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:
authorLukas Toenne <lukas.toenne@googlemail.com>2013-03-21 16:58:31 +0400
committerLukas Toenne <lukas.toenne@googlemail.com>2013-03-21 16:58:31 +0400
commit8066c09df2546f8cf9d4356ec7b3f9108e7b59a2 (patch)
tree0d354e0c81c67bc29af7782ad59b864ddd48f382 /source/blender/editors/interface/interface_layout.c
parent0d7f7c253b6898427a67e6a238287186775f3013 (diff)
Fix for extra string width padding in ui_text_icon_width, causing labels in right-aligned layouts show an annoying gap. If the layout is right-aligned, make the text button align right as well, so text is drawn at the right side of the alloted rect.
Diffstat (limited to 'source/blender/editors/interface/interface_layout.c')
-rw-r--r--source/blender/editors/interface/interface_layout.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/source/blender/editors/interface/interface_layout.c b/source/blender/editors/interface/interface_layout.c
index 5b6e432fc61..53887163778 100644
--- a/source/blender/editors/interface/interface_layout.c
+++ b/source/blender/editors/interface/interface_layout.c
@@ -1599,6 +1599,14 @@ static uiBut *uiItemL_(uiLayout *layout, const char *name, int icon)
else
but = uiDefBut(block, LABEL, 0, name, 0, 0, w, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 0, "");
+ /* to compensate for string size padding in ui_text_icon_width,
+ * make text aligned right if the layout is aligned right.
+ */
+ if (uiLayoutGetAlignment(layout) == UI_LAYOUT_ALIGN_RIGHT) {
+ but->flag &= ~UI_TEXT_LEFT; /* default, needs to be unset */
+ but->flag |= UI_TEXT_RIGHT;
+ }
+
return but;
}