Revision: 26674
          
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=26674
Author:   blendix
Date:     2010-02-07 14:49:43 +0100 (Sun, 07 Feb 2010)

Log Message:
-----------
Fix #21008: text editor scrollbar overlapping text, code here was not
fully updated when the scrollbar was moved from left the right.

Modified Paths:
--------------
    trunk/blender/source/blender/editors/screen/area.c
    trunk/blender/source/blender/editors/space_text/text_draw.c
    trunk/blender/source/blender/editors/space_text/text_intern.h
    trunk/blender/source/blender/editors/space_text/text_ops.c
    trunk/blender/source/blender/makesdna/DNA_text_types.h

Modified: trunk/blender/source/blender/editors/screen/area.c
===================================================================
--- trunk/blender/source/blender/editors/screen/area.c  2010-02-07 13:22:46 UTC 
(rev 26673)
+++ trunk/blender/source/blender/editors/screen/area.c  2010-02-07 13:49:43 UTC 
(rev 26674)
@@ -1390,6 +1390,8 @@
        // XXX quick hacks for files saved with 2.5 already (i.e. the builtin 
defaults file)
                // scrollbars for button regions
        ar->v2d.scroll |= (V2D_SCROLL_RIGHT|V2D_SCROLL_BOTTOM); 
+       ar->v2d.scroll |= V2D_SCROLL_HORIZONTAL_HIDE;
+       ar->v2d.scroll &= ~V2D_SCROLL_VERTICAL_HIDE;
        ar->v2d.keepzoom |= V2D_KEEPZOOM;
 
                // correctly initialised User-Prefs?

Modified: trunk/blender/source/blender/editors/space_text/text_draw.c
===================================================================
--- trunk/blender/source/blender/editors/space_text/text_draw.c 2010-02-07 
13:22:46 UTC (rev 26673)
+++ trunk/blender/source/blender/editors/space_text/text_draw.c 2010-02-07 
13:49:43 UTC (rev 26674)
@@ -456,10 +456,11 @@
 
 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 @@
        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 @@
                x= TXT_OFFSET;
        }
        y= ar->winy-st->lheight;
+       winx= ar->winx - TXT_SCROLL_WIDTH;
 
        /* draw cursor */
        draw_cursor(st, ar);
@@ -1279,7 +1281,7 @@
 
                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 @@
        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;
 

Modified: trunk/blender/source/blender/editors/space_text/text_intern.h
===================================================================
--- trunk/blender/source/blender/editors/space_text/text_intern.h       
2010-02-07 13:22:46 UTC (rev 26673)
+++ trunk/blender/source/blender/editors/space_text/text_intern.h       
2010-02-07 13:49:43 UTC (rev 26674)
@@ -58,6 +58,11 @@
 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

Modified: trunk/blender/source/blender/editors/space_text/text_ops.c
===================================================================
--- trunk/blender/source/blender/editors/space_text/text_ops.c  2010-02-07 
13:22:46 UTC (rev 26673)
+++ trunk/blender/source/blender/editors/space_text/text_ops.c  2010-02-07 
13:49:43 UTC (rev 26674)
@@ -1882,7 +1882,8 @@
                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");

Modified: trunk/blender/source/blender/makesdna/DNA_text_types.h
===================================================================
--- trunk/blender/source/blender/makesdna/DNA_text_types.h      2010-02-07 
13:22:46 UTC (rev 26673)
+++ trunk/blender/source/blender/makesdna/DNA_text_types.h      2010-02-07 
13:49:43 UTC (rev 26674)
@@ -70,8 +70,6 @@
        double mtime;
 } Text;
 
-       /* TXT_OFFSET used to be 35 when the scrollbar was on the left... */
-#define TXT_OFFSET 15
 #define TXT_TABSIZE    4
 #define TXT_INIT_UNDO 1024
 #define TXT_MAX_UNDO   (TXT_INIT_UNDO*TXT_INIT_UNDO)


_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to