Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2012-07-09 23:50:43 +0400
committerCampbell Barton <ideasman42@gmail.com>2012-07-09 23:50:43 +0400
commite66a02e7e21adf6932403890166e7e2c8e266649 (patch)
treec86bfaca9e945e3fa695105b9c4560ca56d61f4e /source/blender/editors
parent18f28e5408940748b3966b8100cde73141857517 (diff)
improve node text alignment with different zoom levels
Diffstat (limited to 'source/blender/editors')
-rw-r--r--source/blender/editors/space_node/drawnode.c10
-rw-r--r--source/blender/editors/space_node/node_draw.c8
-rw-r--r--source/blender/editors/space_node/node_intern.h1
3 files changed, 11 insertions, 8 deletions
diff --git a/source/blender/editors/space_node/drawnode.c b/source/blender/editors/space_node/drawnode.c
index 5df978e73de..c81dc93cb0b 100644
--- a/source/blender/editors/space_node/drawnode.c
+++ b/source/blender/editors/space_node/drawnode.c
@@ -216,15 +216,17 @@ static void node_draw_output_default(const bContext *C, uiBlock *block,
int ofs = 0;
const char *ui_name = IFACE_(name);
UI_ThemeColor(TH_TEXT);
- slen = snode->aspect_sqrt * UI_GetStringWidth(ui_name);
+ slen = (UI_GetStringWidth(ui_name) + NODE_MARGIN_X) * snode->aspect_sqrt;
while (slen > node->width) {
ofs++;
- slen = snode->aspect_sqrt * UI_GetStringWidth(ui_name + ofs);
+ slen = (UI_GetStringWidth(ui_name + ofs) + NODE_MARGIN_X) * snode->aspect_sqrt;
}
uiDefBut(block, LABEL, 0, ui_name + ofs,
- (int)(sock->locx - (15.0f * snode->aspect_sqrt) - slen), (int)(sock->locy - 9.0f),
+ (int)(sock->locx - slen), (int)(sock->locy - 9.0f),
(short)(node->width - NODE_DY), (short)NODE_DY,
NULL, 0, 0, 0, 0, "");
+
+ (void)snode;
}
/* ****************** BASE DRAW FUNCTIONS FOR NEW OPERATOR NODES ***************** */
@@ -830,7 +832,7 @@ static void node_draw_group(const bContext *C, ARegion *ar, SpaceNode *snode, bN
UI_ThemeColor(TH_TEXT_HI);
layout = uiBlockLayout(gnode->block, UI_LAYOUT_VERTICAL, UI_LAYOUT_PANEL,
- (int)(rect.xmin + 15), (int)(rect.ymax + group_header),
+ (int)(rect.xmin + NODE_MARGIN_X), (int)(rect.ymax + group_header),
MIN2((int)(rect.xmax - rect.xmin - 18.0f), node_group_frame + 20), group_header, UI_GetStyle());
RNA_pointer_create(&ntree->id, &RNA_Node, gnode, &ptr);
uiTemplateIDBrowse(layout, (bContext *)C, &ptr, "node_tree", NULL, NULL, NULL);
diff --git a/source/blender/editors/space_node/node_draw.c b/source/blender/editors/space_node/node_draw.c
index fdd3f6330ab..7f3b7cd2dab 100644
--- a/source/blender/editors/space_node/node_draw.c
+++ b/source/blender/editors/space_node/node_draw.c
@@ -798,7 +798,7 @@ static void node_draw_basis(const bContext *C, ARegion *ar, SpaceNode *snode, bN
// BLI_snprintf(showname, sizeof(showname), "[%s]", showname); // XXX - don't print into self!
uiDefBut(node->block, LABEL, 0, showname,
- (int)(rct->xmin + 15), (int)(rct->ymax - NODE_DY),
+ (int)(rct->xmin + (NODE_MARGIN_X / snode->aspect_sqrt)), (int)(rct->ymax - NODE_DY),
(short)(iconofs - rct->xmin - 18.0f), (short)NODE_DY,
NULL, 0, 0, 0, 0, "");
@@ -841,7 +841,7 @@ static void node_draw_basis(const bContext *C, ARegion *ar, SpaceNode *snode, bN
node_socket_circle_draw(ntree, sock, NODE_SOCKSIZE, sock->flag & SELECT);
node->typeinfo->drawinputfunc(C, node->block, ntree, node, sock, IFACE_(sock->name),
- sock->locx+NODE_DYS, sock->locy-NODE_DYS, node->width-NODE_DY);
+ sock->locx + (NODE_DYS / snode->aspect_sqrt), sock->locy-NODE_DYS, node->width-NODE_DY);
}
/* socket outputs */
@@ -852,7 +852,7 @@ static void node_draw_basis(const bContext *C, ARegion *ar, SpaceNode *snode, bN
node_socket_circle_draw(ntree, sock, NODE_SOCKSIZE, sock->flag & SELECT);
node->typeinfo->drawoutputfunc(C, node->block, ntree, node, sock, IFACE_(sock->name),
- sock->locx-node->width+NODE_DYS, sock->locy-NODE_DYS, node->width-NODE_DY);
+ sock->locx - node->width + (NODE_DYS / snode->aspect_sqrt), sock->locy-NODE_DYS, node->width-NODE_DY);
}
/* preview */
@@ -949,7 +949,7 @@ static void node_draw_hidden(const bContext *C, ARegion *ar, SpaceNode *snode, b
// BLI_snprintf(showname, sizeof(showname), "[%s]", showname); // XXX - don't print into self!
uiDefBut(node->block, LABEL, 0, showname,
- (int)(rct->xmin + 15), (int)(centy - 10),
+ (int)(rct->xmin + (NODE_MARGIN_X / snode->aspect_sqrt)), (int)(centy - 10),
(short)(rct->xmax - rct->xmin-18.0f -12.0f), (short)NODE_DY,
NULL, 0, 0, 0, 0, "");
}
diff --git a/source/blender/editors/space_node/node_intern.h b/source/blender/editors/space_node/node_intern.h
index d9dbd646fa5..c2f3c66f4c1 100644
--- a/source/blender/editors/space_node/node_intern.h
+++ b/source/blender/editors/space_node/node_intern.h
@@ -196,6 +196,7 @@ extern const char *node_context_dir[];
#define BASIS_RAD 8.0f
#define NODE_DYS (U.widget_unit/2)
#define NODE_DY U.widget_unit
+#define NODE_MARGIN_X 15
#define NODE_SOCKSIZE 5
// XXX button events (butspace)