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:
authorBrecht Van Lommel <brechtvanlommel@pandora.be>2010-02-07 16:49:43 +0300
committerBrecht Van Lommel <brechtvanlommel@pandora.be>2010-02-07 16:49:43 +0300
commit7f64e230688618aff3c6916acdabd3a4421550e0 (patch)
tree6af7543b6b3351a0a89eb61324a615947067ebd8 /source/blender/editors/space_text
parentaea91b97fc410468cd55e1ce7c6542dbaef54163 (diff)
Fix #21008: text editor scrollbar overlapping text, code here was not
fully updated when the scrollbar was moved from left the right.
Diffstat (limited to 'source/blender/editors/space_text')
-rw-r--r--source/blender/editors/space_text/text_draw.c10
-rw-r--r--source/blender/editors/space_text/text_intern.h5
-rw-r--r--source/blender/editors/space_text/text_ops.c3
3 files changed, 14 insertions, 4 deletions
diff --git a/source/blender/editors/space_text/text_draw.c b/source/blender/editors/space_text/text_draw.c
index b74e1f6cfb2..48e860ed88a 100644
--- a/source/blender/editors/space_text/text_draw.c
+++ b/source/blender/editors/space_text/text_draw.c
@@ -456,10 +456,11 @@ def wrap(line, view_width, wrap_chars):
int wrap_width(SpaceText *st, ARegion *ar)
{
+ int winx= ar->winx - TXT_SCROLL_WIDTH;
int x, max;
x= st->showlinenrs ? TXT_OFFSET + TEXTXLOC : TXT_OFFSET;
- max= (ar->winx-x)/st->cwidth;
+ max= (winx-x)/st->cwidth;
return max>8 ? max : 8;
}
@@ -1209,7 +1210,7 @@ void draw_text_main(SpaceText *st, ARegion *ar)
TextLine *tmp;
rcti scroll;
char linenr[12];
- int i, x, y, linecount= 0;
+ int i, x, y, winx, linecount= 0;
/* if no text, nothing to do */
if(!text)
@@ -1252,6 +1253,7 @@ void draw_text_main(SpaceText *st, ARegion *ar)
x= TXT_OFFSET;
}
y= ar->winy-st->lheight;
+ winx= ar->winx - TXT_SCROLL_WIDTH;
/* draw cursor */
draw_cursor(st, ar);
@@ -1279,7 +1281,7 @@ void draw_text_main(SpaceText *st, ARegion *ar)
if(st->wordwrap) {
/* draw word wrapped text */
- int lines = text_draw_wrapped(st, tmp->line, x, y, ar->winx-x, tmp->format);
+ int lines = text_draw_wrapped(st, tmp->line, x, y, winx-x, tmp->format);
y -= lines*st->lheight;
}
else {
@@ -1325,6 +1327,8 @@ void text_update_cursor_moved(bContext *C)
for(ar=sa->regionbase.first; ar; ar= ar->next)
if(ar->regiontype==RGN_TYPE_WINDOW)
winx= ar->winx;
+
+ winx -= TXT_SCROLL_WIDTH;
if(!text || !text->curl) return;
diff --git a/source/blender/editors/space_text/text_intern.h b/source/blender/editors/space_text/text_intern.h
index 5e3070c4718..59ca649dee8 100644
--- a/source/blender/editors/space_text/text_intern.h
+++ b/source/blender/editors/space_text/text_intern.h
@@ -58,6 +58,11 @@ void text_update_edited(struct Text *text);
void text_update_character_width(struct SpaceText *st);
void text_update_cursor_moved(struct bContext *C);
+ /* TXT_OFFSET used to be 35 when the scrollbar was on the left... */
+#define TXT_OFFSET 15
+#define TXT_SCROLL_WIDTH 20
+#define TXT_SCROLL_SPACE 2
+
#define TEXTXLOC (st->cwidth * st->linenrs_tot)
#define SUGG_LIST_SIZE 7
diff --git a/source/blender/editors/space_text/text_ops.c b/source/blender/editors/space_text/text_ops.c
index 58d8e6b3363..d0a3fd3c1d9 100644
--- a/source/blender/editors/space_text/text_ops.c
+++ b/source/blender/editors/space_text/text_ops.c
@@ -1882,7 +1882,8 @@ static int scroll_bar_invoke(bContext *C, wmOperator *op, wmEvent *event)
return scroll_exec(C, op);
/* verify we are in the right zone */
- if(!(mval[0]>ar->winx-20 && mval[0]<ar->winx-2 && mval[1]>2 && mval[1]<ar->winy))
+ if(!(mval[0]>ar->winx-TXT_SCROLL_WIDTH && mval[0]<ar->winx-TXT_SCROLL_SPACE
+ && mval[1]>TXT_SCROLL_SPACE && mval[1]<ar->winy))
return OPERATOR_PASS_THROUGH;
tsc= MEM_callocN(sizeof(TextScroll), "TextScroll");