diff options
author | Sv. Lockal <lockalsash@gmail.com> | 2012-09-16 23:06:17 +0400 |
---|---|---|
committer | Sv. Lockal <lockalsash@gmail.com> | 2012-09-16 23:06:17 +0400 |
commit | b1d1355f308d7fd1042fcb26a77f028de4887050 (patch) | |
tree | 09036fcc68cb27cc8c4f58e7e6b911b2f070d577 | |
parent | 237a9fde92111ed415071e2a6a0bacc955294335 (diff) |
Fix drawing of output slots with utf-8 names. Also always show last letters in already clipped output slots names
-rw-r--r-- | source/blender/editors/space_node/drawnode.c | 25 |
1 files changed, 11 insertions, 14 deletions
diff --git a/source/blender/editors/space_node/drawnode.c b/source/blender/editors/space_node/drawnode.c index 5c3cbf40bbc..e2b7e09b2ae 100644 --- a/source/blender/editors/space_node/drawnode.c +++ b/source/blender/editors/space_node/drawnode.c @@ -200,25 +200,22 @@ static void node_draw_output_default(const bContext *C, uiBlock *block, const char *name, int UNUSED(x), int UNUSED(y), int UNUSED(width)) { SpaceNode *snode = CTX_wm_space_node(C); - float slen; - int ofs = 0; const char *ui_name = IFACE_(name); - int len = strlen(ui_name); + float slen; + UI_ThemeColor(TH_TEXT); slen = (UI_GetStringWidth(ui_name) + NODE_MARGIN_X) * snode->aspect_sqrt; - while (slen > node->width && ofs < len) { - ofs++; - slen = (UI_GetStringWidth(ui_name + ofs) + NODE_MARGIN_X) * snode->aspect_sqrt; + while (slen > node->width && *ui_name) { + ui_name = BLI_str_find_next_char_utf8(ui_name, NULL); + slen = (UI_GetStringWidth(ui_name) + NODE_MARGIN_X) * snode->aspect_sqrt; } - - if (ofs < len) { - uiDefBut(block, LABEL, 0, ui_name + ofs, - (int)(sock->locx - slen), (int)(sock->locy - 9.0f), - (short)(node->width - NODE_DY), (short)NODE_DY, - NULL, 0, 0, 0, 0, ""); + + if (*ui_name) { + uiDefBut(block, LABEL, 0, ui_name, + (int)(sock->locx - slen), (int)(sock->locy - 9.0f), + (short)slen, (short)NODE_DY, + NULL, 0, 0, 0, 0, ""); } - - (void)snode; } /* ****************** BASE DRAW FUNCTIONS FOR NEW OPERATOR NODES ***************** */ |