* rename some view2d defines to be clearer and more in line with the rest of view2d...
authorNathan Letwory <nathan@letworyinteractive.com>
Thu, 4 Dec 2008 20:28:59 +0000 (20:28 +0000)
committerNathan Letwory <nathan@letworyinteractive.com>
Thu, 4 Dec 2008 20:28:59 +0000 (20:28 +0000)
source/blender/blenloader/intern/readfile.c
source/blender/editors/interface/view2d.c
source/blender/editors/interface/view2d_ops.c
source/blender/makesdna/DNA_view2d_types.h

index 70e06627449574a192aeda643fce0587fb9d5d24..89fe51b00690d6826c80ea7016b116d47795fd34 100644 (file)
@@ -5074,8 +5074,8 @@ static void do_versions_windowmanager_2_50(bScreen *screen)
                                SpaceOops *soops= sa->spacedata.first;
                                
                                memcpy(&ar->v2d, &soops->v2d, sizeof(View2D));
-                               ar->v2d.scroll &= ~L_SCROLL;
-                               ar->v2d.scroll |= R_SCROLL;
+                               ar->v2d.scroll &= ~V2D_SCROLL_LEFT;
+                               ar->v2d.scroll |= V2D_SCROLL_RIGHT;
                        }
                                break;
                        case SPACE_TIME:
@@ -5083,7 +5083,7 @@ static void do_versions_windowmanager_2_50(bScreen *screen)
                                SpaceTime *stime= sa->spacedata.first;
                                memcpy(&ar->v2d, &stime->v2d, sizeof(View2D));
                                
-                               ar->v2d.scroll |= (B_SCROLL|BGRID_SCROLL);
+                               ar->v2d.scroll |= (V2D_SCROLL_BOTTOM|V2D_SCROLL_SCALE_BOTTOM);
                                ar->v2d.keepofs |= V2D_LOCKOFS_Y;
                        }
                                break;
index 577d3bc7289d1ffb5af354c2a52ce21913d9392b..e6ef33f3ddc4aaf128180b485e9beee98d547f52 100644 (file)
@@ -66,30 +66,30 @@ void UI_view2d_update_size(View2D *v2d, int winx, int winy)
         */
        if (v2d->scroll) {
                /* vertical scrollbar */
-               if (v2d->scroll & L_SCROLL) {
+               if (v2d->scroll & V2D_SCROLL_LEFT) {
                        /* on left-hand edge of region */
                        v2d->vert= v2d->mask;
-                       v2d->vert.xmax= SCROLLB;
-                       v2d->mask.xmin= SCROLLB;
+                       v2d->vert.xmax= V2D_SCROLL_WIDTH;
+                       v2d->mask.xmin= V2D_SCROLL_WIDTH;
                }
-               else if (v2d->scroll & R_SCROLL) {
+               else if (v2d->scroll & V2D_SCROLL_RIGHT) {
                        /* on right-hand edge of region */
                        v2d->vert= v2d->mask;
-                       v2d->vert.xmin= v2d->vert.xmax-SCROLLB;
+                       v2d->vert.xmin= v2d->vert.xmax-V2D_SCROLL_WIDTH;
                        v2d->mask.xmax= v2d->vert.xmin;
                }
                
                /* horizontal scrollbar */
-               if (v2d->scroll & (B_SCROLL|B_SCROLLO)) {
-                       /* on bottom edge of region (B_SCROLLO is outliner, the ohter is for standard) */
+               if (v2d->scroll & (V2D_SCROLL_BOTTOM|V2D_SCROLL_BOTTOM_O)) {
+                       /* on bottom edge of region (V2D_SCROLL_BOTTOM_O is outliner, the ohter is for standard) */
                        v2d->hor= v2d->mask;
-                       v2d->hor.ymax= SCROLLH;
-                       v2d->mask.ymin= SCROLLH;
+                       v2d->hor.ymax= V2D_SCROLL_HEIGHT;
+                       v2d->mask.ymin= V2D_SCROLL_HEIGHT;
                }
-               else if (v2d->scroll & T_SCROLL) {
+               else if (v2d->scroll & V2D_SCROLL_TOP) {
                        /* on upper edge of region */
                        v2d->hor= v2d->mask;
-                       v2d->hor.ymin= v2d->hor.ymax-SCROLLH;
+                       v2d->hor.ymin= v2d->hor.ymax-V2D_SCROLL_HEIGHT;
                        v2d->mask.ymax= v2d->hor.ymin;
                }
        }
@@ -107,8 +107,8 @@ void UI_view2d_enforce_status(View2D *v2d, int winx, int winy)
        float dx, dy, temp, fac, zoom;
        
        /* correct winx for scrollbars */
-       if (v2d->scroll & L_SCROLL) winx-= SCROLLB;
-       if (v2d->scroll & (B_SCROLL|B_SCROLLO)) winy-= SCROLLH;
+       if (v2d->scroll & V2D_SCROLL_LEFT) winx-= V2D_SCROLL_WIDTH;
+       if (v2d->scroll & (V2D_SCROLL_BOTTOM|V2D_SCROLL_BOTTOM_O)) winy-= V2D_SCROLL_HEIGHT;
        
        /* header completely closed window */
        if (winy <= 0) return;
@@ -638,7 +638,7 @@ View2DScrollers *UI_view2d_calc_scrollers(const bContext *C, View2D *v2d, short
         */
        
        /* horizontal scrollers */
-       if (v2d->scroll & (HOR_SCROLL|HOR_SCROLLO)) {
+       if (v2d->scroll & (V2D_SCROLL_HORIZONTAL|V2D_SCROLL_HORIZONTAL_O)) {
                /* slider 'button' extents */
                totsize= v2d->tot.xmax - v2d->tot.xmin;
                scrollsize= hor.xmax - hor.xmin;
@@ -656,7 +656,7 @@ View2DScrollers *UI_view2d_calc_scrollers(const bContext *C, View2D *v2d, short
        }
        
        /* vertical scrollers */
-       if (v2d->scroll & VERT_SCROLL) {
+       if (v2d->scroll & V2D_SCROLL_VERTICAL) {
                /* slider 'button' extents */
                totsize= v2d->tot.ymax - v2d->tot.ymin;
                scrollsize= vert.ymax - vert.ymin;
@@ -674,7 +674,7 @@ View2DScrollers *UI_view2d_calc_scrollers(const bContext *C, View2D *v2d, short
        }
        
        /* grid markings on scrollbars */
-       if (v2d->scroll & (HOR_SCROLLGRID|VERT_SCROLLGRID)) {
+       if (v2d->scroll & (V2D_SCROLL_SCALE_HORIZONTAL|V2D_SCROLL_SCALE_VERTICAL)) {
                /* store clamping */
                scrollers->xclamp= xclamp;
                scrollers->xunits= xunits;
@@ -682,9 +682,9 @@ View2DScrollers *UI_view2d_calc_scrollers(const bContext *C, View2D *v2d, short
                scrollers->yunits= yunits;
                
                /* calculate grid */
-               if (v2d->scroll & HOR_SCROLLGRID)
+               if (v2d->scroll & V2D_SCROLL_SCALE_HORIZONTAL)
                        scrollers->grid= UI_view2d_calc_grid(C, v2d, xunits, xclamp, (hor.xmax - hor.xmin), (vert.ymax - vert.ymin));
-               else if (v2d->scroll & VERT_SCROLLGRID)
+               else if (v2d->scroll & V2D_SCROLL_SCALE_VERTICAL)
                        scrollers->grid= UI_view2d_calc_grid(C, v2d, yunits, yclamp, (hor.xmax - hor.xmin), (vert.ymax - vert.ymin));
        }
        
@@ -743,7 +743,7 @@ void UI_view2d_draw_scrollers(const bContext *C, View2D *v2d, View2DScrollers *s
        hor= v2d->hor;
        
        /* horizontal scrollbar */
-       if (v2d->scroll & (HOR_SCROLL|HOR_SCROLLO)) {
+       if (v2d->scroll & (V2D_SCROLL_HORIZONTAL|V2D_SCROLL_HORIZONTAL_O)) {
                /* scroller backdrop */
                UI_ThemeColorShade(TH_SHADE1, light);
                glRecti(hor.xmin,  hor.ymin,  hor.xmax,  hor.ymax);
@@ -764,7 +764,7 @@ void UI_view2d_draw_scrollers(const bContext *C, View2D *v2d, View2DScrollers *s
                
                /* scale indicators */
                // XXX will need to update the font drawing when the new stuff comes in
-               if (v2d->scroll & HOR_SCROLLGRID) {
+               if (v2d->scroll & V2D_SCROLL_SCALE_HORIZONTAL) {
                        View2DGrid *grid= scrollers->grid;
                        float fac, dfac, fac2, val;
                        
@@ -828,14 +828,14 @@ void UI_view2d_draw_scrollers(const bContext *C, View2D *v2d, View2DScrollers *s
                
                /* decoration outer bevel line */
                UI_ThemeColorShade(TH_SHADE1, lighter);
-               if (v2d->scroll & (B_SCROLL|B_SCROLLO))
+               if (v2d->scroll & (V2D_SCROLL_BOTTOM|V2D_SCROLL_BOTTOM_O))
                        sdrawline(hor.xmin, hor.ymax, hor.xmax, hor.ymax);
-               else if (v2d->scroll & T_SCROLL)
+               else if (v2d->scroll & V2D_SCROLL_TOP)
                        sdrawline(hor.xmin, hor.ymin, hor.xmax, hor.ymin);
        }
        
        /* vertical scrollbar */
-       if (v2d->scroll & VERT_SCROLL) {
+       if (v2d->scroll & V2D_SCROLL_VERTICAL) {
                /* scroller backdrop  */
                UI_ThemeColorShade(TH_SHADE1, light);
                glRecti(vert.xmin,  vert.ymin,  vert.xmax,  vert.ymax);
@@ -856,7 +856,7 @@ void UI_view2d_draw_scrollers(const bContext *C, View2D *v2d, View2DScrollers *s
                
                /* scale indiators */
                // XXX will need to update the font drawing when the new stuff comes in
-               if (v2d->scroll & VERT_SCROLLGRID) {
+               if (v2d->scroll & V2D_SCROLL_SCALE_VERTICAL) {
                        View2DGrid *grid= scrollers->grid;
                        float fac, dfac, val;
                        
@@ -867,10 +867,10 @@ void UI_view2d_draw_scrollers(const bContext *C, View2D *v2d, View2DScrollers *s
                         *        NOTE: it's assumed that that scrollbar is there if this is involved!
                         */
                        fac= (grid->starty- v2d->cur.ymin) / (v2d->cur.ymax - v2d->cur.ymin);
-                       fac= (vert.ymin + SCROLLH) + fac*(vert.ymax - vert.ymin - SCROLLH);
+                       fac= (vert.ymin + V2D_SCROLL_HEIGHT) + fac*(vert.ymax - vert.ymin - V2D_SCROLL_HEIGHT);
                        
                        dfac= (grid->dy) / (v2d->cur.ymax - v2d->cur.ymin);
-                       dfac= dfac * (vert.ymax - vert.ymin - SCROLLH);
+                       dfac= dfac * (vert.ymax - vert.ymin - V2D_SCROLL_HEIGHT);
                        
                        /* set starting value, and text color */
                        UI_ThemeColor(TH_TEXT);
@@ -889,9 +889,9 @@ void UI_view2d_draw_scrollers(const bContext *C, View2D *v2d, View2DScrollers *s
                
                /* decoration outer bevel line */
                UI_ThemeColorShade(TH_SHADE1, lighter);
-               if (v2d->scroll & R_SCROLL)
+               if (v2d->scroll & V2D_SCROLL_RIGHT)
                        sdrawline(vert.xmin, vert.ymin, vert.xmin, vert.ymax);
-               else if (v2d->scroll & L_SCROLL)
+               else if (v2d->scroll & V2D_SCROLL_LEFT)
                        sdrawline(vert.xmax, vert.ymin, vert.xmax, vert.ymax);
        }
 }
index 6e434a3ca2f77f14187fc2bab537902492f7d458..44f1655af9547a6c57f8c601adfcc515935a9bcb 100644 (file)
@@ -71,10 +71,10 @@ static short mouse_in_v2d_scrollers (const bContext *C, View2D *v2d, int x, int
        co[1]= y - ar->winrct.ymin;
        
        /* check if within scrollbars */
-       if (v2d->scroll & (HOR_SCROLL|HOR_SCROLLO)) {
+       if (v2d->scroll & (V2D_SCROLL_HORIZONTAL|V2D_SCROLL_HORIZONTAL_O)) {
                if (IN_2D_HORIZ_SCROLL(v2d, co)) return 'h';
        }
-       if (v2d->scroll & VERT_SCROLL) {
+       if (v2d->scroll & V2D_SCROLL_VERTICAL) {
                if (IN_2D_VERT_SCROLL(v2d, co)) return 'v';
        }       
        
index 263b271813658bf05f12de062e9463b476549890..b2086533b308a6b5cb01d2ab16cbcb22fa3103a5 100644 (file)
@@ -77,31 +77,29 @@ typedef struct View2D {
 #define V2D_VIEWLOCK   (1<<0)
 
 /* scrollbar thickness */
-       /* height */
-#define SCROLLH        16
-       /* width */
-#define SCROLLB        16
+#define V2D_SCROLL_HEIGHT      16
+#define V2D_SCROLL_WIDTH       16
 
 /* scrollbar flags for View2D */
        /* left scrollbar */
-#define L_SCROLL               (1<<0)          
-#define R_SCROLL               (1<<1)
-#define VERT_SCROLL    (L_SCROLL|R_SCROLL)
+#define V2D_SCROLL_LEFT                (1<<0)          
+#define V2D_SCROLL_RIGHT               (1<<1)
+#define V2D_SCROLL_VERTICAL    (V2D_SCROLL_LEFT|V2D_SCROLL_RIGHT)
        /* horizontal scrollbar */
-#define T_SCROLL               (1<<2)
-#define B_SCROLL               (1<<3)
-#define HOR_SCROLL     (T_SCROLL|B_SCROLL)
+#define V2D_SCROLL_TOP                 (1<<2)
+#define V2D_SCROLL_BOTTOM              (1<<3)
+#define V2D_SCROLL_HORIZONTAL          (V2D_SCROLL_TOP|V2D_SCROLL_BOTTOM)
        /* special hacks for outliner hscroll - prevent hanging older versions of Blender */
-#define B_SCROLLO      (1<<4)
-#define HOR_SCROLLO    (T_SCROLL|B_SCROLLO)
+#define V2D_SCROLL_BOTTOM_O    (1<<4)
+#define V2D_SCROLL_HORIZONTAL_O        (V2D_SCROLL_BOTTOM|V2D_SCROLL_BOTTOM_O)
        /* scale markings - vertical */
-#define LGRID_SCROLL   (1<<5)
-#define RGRID_SCROLL   (1<<6)
-#define VERT_SCROLLGRID        (LGRID_SCROLL|RGRID_SCROLL)
+#define V2D_SCROLL_SCALE_LEFT  (1<<5)
+#define V2D_SCROLL_SCALE_RIGHT (1<<6)
+#define V2D_SCROLL_SCALE_VERTICAL      (V2D_SCROLL_SCALE_LEFT|V2D_SCROLL_SCALE_RIGHT)
        /* scale markings - horizontal */
-#define BGRID_SCROLL   (1<<7)
-#define TGRID_SCROLL   (1<<8)  
-#define HOR_SCROLLGRID (BGRID_SCROLL|TGRID_SCROLL)
+#define V2D_SCROLL_SCALE_BOTTOM        (1<<7)
+#define V2D_SCROLL_SCALE_TOP   (1<<8)  
+#define V2D_SCROLL_SCALE_HORIZONTAL    (V2D_SCROLL_SCALE_BOTTOM|V2D_SCROLL_SCALE_TOP)
 
 #endif