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>2014-05-30 04:20:58 +0400
committerCampbell Barton <ideasman42@gmail.com>2014-05-30 04:21:45 +0400
commitd914d101ecc7f2e70398182978b491c9710ef64b (patch)
tree8aa711aff267d8ed6d0352a92eb906e1dcdadf9b /source/blender/editors/interface/interface_widgets.c
parent54e054cce4b013bc70df56059bf0fcd4bfee9827 (diff)
UI: fix for drawing textselect outside of button
also draw cursor even when there is a selection.
Diffstat (limited to 'source/blender/editors/interface/interface_widgets.c')
-rw-r--r--source/blender/editors/interface/interface_widgets.c33
1 files changed, 16 insertions, 17 deletions
diff --git a/source/blender/editors/interface/interface_widgets.c b/source/blender/editors/interface/interface_widgets.c
index b25aac785a7..b0be614fa17 100644
--- a/source/blender/editors/interface/interface_widgets.c
+++ b/source/blender/editors/interface/interface_widgets.c
@@ -1248,40 +1248,39 @@ static void widget_draw_text(uiFontStyle *fstyle, uiWidgetColors *wcol, uiBut *b
/* text button selection and cursor */
if (but->editstr && but->pos != -1) {
- short t = 0, pos = 0;
- short selsta_tmp, selend_tmp, selsta_draw, selwidth_draw;
+ /* text button selection */
if ((but->selend - but->selsta) > 0) {
- /* text button selection */
- selsta_tmp = but->selsta;
- selend_tmp = but->selend;
+ int selsta_draw, selwidth_draw;
if (drawstr[0] != 0) {
if (but->selsta >= but->ofs) {
- selsta_draw = BLF_width(fstyle->uifont_id, drawstr + but->ofs, selsta_tmp - but->ofs);
+ selsta_draw = BLF_width(fstyle->uifont_id, drawstr + but->ofs, but->selsta - but->ofs);
}
else {
selsta_draw = 0;
}
- selwidth_draw = BLF_width(fstyle->uifont_id, drawstr + but->ofs, selend_tmp - but->ofs);
+ selwidth_draw = BLF_width(fstyle->uifont_id, drawstr + but->ofs, but->selend - but->ofs);
glColor4ubv((unsigned char *)wcol->item);
- glRects(rect->xmin + selsta_draw, rect->ymin + 2, rect->xmin + selwidth_draw, rect->ymax - 2);
+ glRecti(rect->xmin + selsta_draw,
+ rect->ymin + 2,
+ min_ii(rect->xmin + selwidth_draw, rect->xmax - 2),
+ rect->ymax - 2);
}
}
- else {
- /* text cursor */
- pos = but->pos;
- if (pos >= but->ofs) {
- if (drawstr[0] != 0) {
- t = BLF_width(fstyle->uifont_id, drawstr + but->ofs, pos - but->ofs);
- }
- glColor3f(0.20, 0.6, 0.9);
- glRects(rect->xmin + t, rect->ymin + 2, rect->xmin + t + 2, rect->ymax - 2);
+ /* text cursor */
+ if (but->pos >= but->ofs) {
+ int t;
+ if (drawstr[0] != 0) {
+ t = BLF_width(fstyle->uifont_id, drawstr + but->ofs, but->pos - but->ofs);
}
+
+ glColor3f(0.20, 0.6, 0.9);
+ glRecti(rect->xmin + t, rect->ymin + 2, rect->xmin + t + 2, rect->ymax - 2);
}
}