Revision: 40114
          
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=40114
Author:   campbellbarton
Date:     2011-09-11 06:41:09 +0000 (Sun, 11 Sep 2011)
Log Message:
-----------
replace magic numbers for flags for uiSetRoundBox();

Modified Paths:
--------------
    trunk/blender/source/blender/editors/animation/anim_channels_defines.c
    trunk/blender/source/blender/editors/include/UI_interface.h
    trunk/blender/source/blender/editors/interface/interface_draw.c
    trunk/blender/source/blender/editors/interface/interface_panel.c
    trunk/blender/source/blender/editors/interface/interface_widgets.c
    trunk/blender/source/blender/editors/screen/area.c
    trunk/blender/source/blender/editors/space_file/file_draw.c
    trunk/blender/source/blender/editors/space_nla/nla_draw.c
    trunk/blender/source/blender/editors/space_node/drawnode.c
    trunk/blender/source/blender/editors/space_node/node_draw.c
    trunk/blender/source/blender/editors/space_outliner/outliner_draw.c
    trunk/blender/source/blender/editors/space_sequencer/sequencer_draw.c
    trunk/blender/source/blender/editors/space_text/text_draw.c
    trunk/blender/source/blender/editors/space_view3d/view3d_draw.c
    trunk/blender/source/blender/windowmanager/intern/wm_dragdrop.c

Modified: trunk/blender/source/blender/editors/animation/anim_channels_defines.c
===================================================================
--- trunk/blender/source/blender/editors/animation/anim_channels_defines.c      
2011-09-11 05:54:07 UTC (rev 40113)
+++ trunk/blender/source/blender/editors/animation/anim_channels_defines.c      
2011-09-11 06:41:09 UTC (rev 40114)
@@ -121,7 +121,7 @@
        glColor3fv(color);
        
        /* rounded corners on LHS only - top only when expanded, but bottom too 
when collapsed */
-       uiSetRoundBox((expanded)? (1):(1|8));
+       uiSetRoundBox(expanded ? UI_CNR_TOP_LEFT : (UI_CNR_TOP_LEFT | 
UI_CNR_BOTTOM_LEFT));
        uiDrawBox(GL_POLYGON, offset,  yminc, v2d->cur.xmax+EXTRA_SCROLL_PAD, 
ymaxc, 8);
 }
 
@@ -401,7 +401,7 @@
         *      - top and bottom 
         *      - special hack: make the top a bit higher, since we are 
first... 
         */
-       uiSetRoundBox((1|8));
+       uiSetRoundBox(UI_CNR_TOP_LEFT | UI_CNR_BOTTOM_LEFT);
        uiDrawBox(GL_POLYGON, 0,  yminc-2, v2d->cur.xmax+EXTRA_SCROLL_PAD, 
ymaxc, 8);
 }
 
@@ -756,7 +756,7 @@
        glColor3fv(color);
        
        /* rounded corners on LHS only - top only when expanded, but bottom too 
when collapsed */
-       uiSetRoundBox((expanded)? (1):(1|8));
+       uiSetRoundBox(expanded ? UI_CNR_TOP_LEFT : (UI_CNR_TOP_LEFT | 
UI_CNR_BOTTOM_LEFT));
        uiDrawBox(GL_POLYGON, offset,  yminc, v2d->cur.xmax+EXTRA_SCROLL_PAD, 
ymaxc, 8);
 }
 

Modified: trunk/blender/source/blender/editors/include/UI_interface.h
===================================================================
--- trunk/blender/source/blender/editors/include/UI_interface.h 2011-09-11 
05:54:07 UTC (rev 40113)
+++ trunk/blender/source/blender/editors/include/UI_interface.h 2011-09-11 
06:41:09 UTC (rev 40114)
@@ -653,6 +653,25 @@
 #define UI_LAYOUT_OP_SHOW_TITLE 1
 #define UI_LAYOUT_OP_SHOW_EMPTY 2
 
+/* flags to set which corners will become rounded:
+ *
+ * 1------2
+ * |      |
+ * 8------4 */
+
+enum {
+       UI_CNR_TOP_LEFT= 1,
+       UI_CNR_TOP_RIGHT= 2,
+       UI_CNR_BOTTOM_RIGHT= 4,
+       UI_CNR_BOTTOM_LEFT= 8,
+       /* just for convenience */
+       UI_CNR_NONE= 0,
+       UI_CNR_ALL= (UI_CNR_TOP_LEFT | UI_CNR_TOP_RIGHT | UI_CNR_BOTTOM_RIGHT | 
UI_CNR_BOTTOM_LEFT)
+};
+
+/* not apart of the corner flags but mixed in some functions  */
+#define UI_RB_ALPHA (UI_CNR_ALL + 1)
+
 uiLayout *uiBlockLayout(uiBlock *block, int dir, int type, int x, int y, int 
size, int em, struct uiStyle *style);
 void uiBlockSetCurLayout(uiBlock *block, uiLayout *layout);
 void uiBlockLayoutResolve(uiBlock *block, int *x, int *y);

Modified: trunk/blender/source/blender/editors/interface/interface_draw.c
===================================================================
--- trunk/blender/source/blender/editors/interface/interface_draw.c     
2011-09-11 05:54:07 UTC (rev 40113)
+++ trunk/blender/source/blender/editors/interface/interface_draw.c     
2011-09-11 06:41:09 UTC (rev 40114)
@@ -58,10 +58,9 @@
 /* own include */
 #include "interface_intern.h"
 
-#define UI_RB_ALPHA 16
 #define UI_DISABLED_ALPHA_OFFS -160
 
-static int roundboxtype= 15;
+static int roundboxtype= UI_CNR_ALL;
 
 void uiSetRoundBox(int type)
 {
@@ -69,13 +68,6 @@
         * if this is undone, its not that big a deal, only makes curves edges
         * square for the  */
        roundboxtype= type;
-
-       /* flags to set which corners will become rounded:
-
-       1------2
-       |      |
-       8------4
-       */
        
 }
 
@@ -98,7 +90,7 @@
        glBegin(mode);
 
        /* start with corner right-bottom */
-       if(roundboxtype & 4) {
+       if(roundboxtype & UI_CNR_BOTTOM_RIGHT) {
                glVertex2f(maxx-rad, miny);
                for(a=0; a<7; a++) {
                        glVertex2f(maxx-rad+vec[a][0], miny+vec[a][1]);
@@ -108,7 +100,7 @@
        else glVertex2f(maxx, miny);
        
        /* corner right-top */
-       if(roundboxtype & 2) {
+       if(roundboxtype & UI_CNR_TOP_RIGHT) {
                glVertex2f(maxx, maxy-rad);
                for(a=0; a<7; a++) {
                        glVertex2f(maxx-vec[a][1], maxy-rad+vec[a][0]);
@@ -118,7 +110,7 @@
        else glVertex2f(maxx, maxy);
        
        /* corner left-top */
-       if(roundboxtype & 1) {
+       if(roundboxtype & UI_CNR_TOP_LEFT) {
                glVertex2f(minx+rad, maxy);
                for(a=0; a<7; a++) {
                        glVertex2f(minx+rad-vec[a][0], maxy-vec[a][1]);
@@ -128,7 +120,7 @@
        else glVertex2f(minx, maxy);
        
        /* corner left-bottom */
-       if(roundboxtype & 8) {
+       if(roundboxtype & UI_CNR_BOTTOM_LEFT) {
                glVertex2f(minx, miny+rad);
                for(a=0; a<7; a++) {
                        glVertex2f(minx+vec[a][1], miny+rad-vec[a][0]);
@@ -180,7 +172,7 @@
        glBegin(mode);
 
        /* start with corner right-bottom */
-       if(roundboxtype & 4) {
+       if(roundboxtype & UI_CNR_BOTTOM_RIGHT) {
                
                round_box_shade_col(coltop, coldown, 0.0);
                glVertex2f(maxx-rad, miny);
@@ -199,7 +191,7 @@
        }
        
        /* corner right-top */
-       if(roundboxtype & 2) {
+       if(roundboxtype & UI_CNR_TOP_RIGHT) {
                
                round_box_shade_col(coltop, coldown, (div-rad)*idiv);
                glVertex2f(maxx, maxy-rad);
@@ -217,7 +209,7 @@
        }
        
        /* corner left-top */
-       if(roundboxtype & 1) {
+       if(roundboxtype & UI_CNR_TOP_LEFT) {
                
                round_box_shade_col(coltop, coldown, 1.0);
                glVertex2f(minx+rad, maxy);
@@ -236,7 +228,7 @@
        }
        
        /* corner left-bottom */
-       if(roundboxtype & 8) {
+       if(roundboxtype & UI_CNR_BOTTOM_LEFT) {
                
                round_box_shade_col(coltop, coldown, rad*idiv);
                glVertex2f(minx, miny+rad);
@@ -288,7 +280,7 @@
        glBegin(mode);
 
        /* start with corner right-bottom */
-       if(roundboxtype & 4) {
+       if(roundboxtype & UI_CNR_BOTTOM_RIGHT) {
                round_box_shade_col(colLeft, colRight, 0.0);
                glVertex2f(maxx-rad, miny);
                
@@ -306,7 +298,7 @@
        }
        
        /* corner right-top */
-       if(roundboxtype & 2) {
+       if(roundboxtype & UI_CNR_TOP_RIGHT) {
                round_box_shade_col(colLeft, colRight, 0.0);
                glVertex2f(maxx, maxy-rad);
                
@@ -324,7 +316,7 @@
        }
        
        /* corner left-top */
-       if(roundboxtype & 1) {
+       if(roundboxtype & UI_CNR_TOP_LEFT) {
                round_box_shade_col(colLeft, colRight, (div-rad)*idiv);
                glVertex2f(minx+rad, maxy);
                
@@ -342,7 +334,7 @@
        }
        
        /* corner left-bottom */
-       if(roundboxtype & 8) {
+       if(roundboxtype & UI_CNR_BOTTOM_LEFT) {
                round_box_shade_col(colLeft, colRight, 1.0);
                glVertex2f(minx, miny+rad);
                
@@ -709,7 +701,7 @@
        
        /* outline */
        glColor4f(0.f, 0.f, 0.f, 0.5f);
-       uiSetRoundBox(15);
+       uiSetRoundBox(UI_CNR_ALL);
        uiDrawBox(GL_LINE_LOOP, rect->xmin-1, rect->ymin, rect->xmax+1, 
rect->ymax+1, 3.0f);
 }
 
@@ -768,7 +760,7 @@
        glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
        
        glColor4f(0.f, 0.f, 0.f, 0.3f);
-       uiSetRoundBox(15);
+       uiSetRoundBox(UI_CNR_ALL);
        uiDrawBox(GL_POLYGON, rect.xmin-1, rect.ymin-1, rect.xmax+1, 
rect.ymax+1, 3.0f);
 
        /* need scissor test, histogram can draw outside of boundary */
@@ -837,7 +829,7 @@
        glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
        
        glColor4f(0.f, 0.f, 0.f, 0.3f);
-       uiSetRoundBox(15);
+       uiSetRoundBox(UI_CNR_ALL);
        uiDrawBox(GL_POLYGON, rect.xmin-1, rect.ymin-1, rect.xmax+1, 
rect.ymax+1, 3.0f);
        
 
@@ -1048,7 +1040,7 @@
        glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
        
        glColor4f(0.f, 0.f, 0.f, 0.3f);
-       uiSetRoundBox(15);
+       uiSetRoundBox(UI_CNR_ALL);
        uiDrawBox(GL_POLYGON, rect.xmin-1, rect.ymin-1, rect.xmax+1, 
rect.ymax+1, 3.0f);
 
        /* need scissor test, hvectorscope can draw outside of boundary */
@@ -1233,7 +1225,7 @@
                
        /* backdrop */
        glColor3ubv((unsigned char*)wcol->inner);
-       uiSetRoundBox(15);
+       uiSetRoundBox(UI_CNR_ALL);
        uiDrawBox(GL_POLYGON, rect->xmin, rect->ymin, rect->xmax, rect->ymax, 
5.0f);
        
        /* sphere color */

Modified: trunk/blender/source/blender/editors/interface/interface_panel.c
===================================================================
--- trunk/blender/source/blender/editors/interface/interface_panel.c    
2011-09-11 05:54:07 UTC (rev 40113)
+++ trunk/blender/source/blender/editors/interface/interface_panel.c    
2011-09-11 06:41:09 UTC (rev 40114)
@@ -537,8 +537,8 @@
                
                /* in some occasions, draw a border */
                if(panel->flag & PNL_SELECT) {
-                       if(panel->control & UI_PNL_SOLID) uiSetRoundBox(15);
-                       else uiSetRoundBox(3);
+                       if(panel->control & UI_PNL_SOLID) 
uiSetRoundBox(UI_CNR_ALL);
+                       else uiSetRoundBox(UI_CNR_TOP_LEFT | UI_CNR_TOP_RIGHT);
                        
                        UI_ThemeColorShade(TH_BACK, -120);
                        uiRoundRect(0.5f + rect->xmin, 0.5f + rect->ymin, 0.5f 
+ rect->xmax, 0.5f + headrect.ymax+1, 8);

Modified: trunk/blender/source/blender/editors/interface/interface_widgets.c
===================================================================
--- trunk/blender/source/blender/editors/interface/interface_widgets.c  
2011-09-11 05:54:07 UTC (rev 40113)
+++ trunk/blender/source/blender/editors/interface/interface_widgets.c  
2011-09-11 06:41:09 UTC (rev 40114)
@@ -90,15 +90,6 @@
 #define WIDGET_CURVE_RESOLU 9
 #define WIDGET_SIZE_MAX (WIDGET_CURVE_RESOLU*4)
 
-enum {
-       WIDGET_TOP_LEFT= 1,
-       WIDGET_TOP_RIGHT= 2,
-       WIDGET_BOTTOM_RIGHT= 4,
-       WIDGET_BOTTOM_LEFT= 8,
-       /* just for convenience */
-       WIDGET_ALL_CORNERS= (WIDGET_TOP_LEFT | WIDGET_TOP_RIGHT | 
WIDGET_BOTTOM_RIGHT | WIDGET_BOTTOM_LEFT)
-};
-
 typedef struct uiWidgetBase {
        
        int totvert, halfwayvert;
@@ -249,7 +240,7 @@
        }
        
        /* start with left-top, anti clockwise */
-       if(roundboxalign & WIDGET_TOP_LEFT) {
+       if(roundboxalign & UI_CNR_TOP_LEFT) {
                for(a=0; a < WIDGET_CURVE_RESOLU; a++, tot++) {
                        vert[tot][0]= minx+rad-vec[a][0];
                        vert[tot][1]= maxy-vec[a][1];
@@ -262,7 +253,7 @@
                }
        }
        
-       if(roundboxalign & WIDGET_BOTTOM_LEFT) {
+       if(roundboxalign & UI_CNR_BOTTOM_LEFT) {
                for(a=0; a < WIDGET_CURVE_RESOLU; a++, tot++) {
                        vert[tot][0]= minx+vec[a][1];
                        vert[tot][1]= miny+rad-vec[a][0];
@@ -275,7 +266,7 @@
                }
        }
        
-       if(roundboxalign & WIDGET_BOTTOM_RIGHT) {
+       if(roundboxalign & UI_CNR_BOTTOM_RIGHT) {
                for(a=0; a < WIDGET_CURVE_RESOLU; a++, tot++) {
                        vert[tot][0]= maxx-rad+vec[a][0];
                        vert[tot][1]= miny+vec[a][1];
@@ -288,7 +279,7 @@
                }
        }
        
-       if(roundboxalign & WIDGET_TOP_RIGHT) {
+       if(roundboxalign & UI_CNR_TOP_RIGHT) {
                for(a=0; a < WIDGET_CURVE_RESOLU; a++, tot++) {
                        vert[tot][0]= maxx-vec[a][1];
                        vert[tot][1]= maxy-rad+vec[a][0];
@@ -315,10 +306,10 @@
        float facxi= (maxxi!=minxi) ? 1.0f/(maxxi-minxi) : 0.0f; /* for uv, can 
divide by zero */
        float facyi= (maxyi!=minyi) ? 1.0f/(maxyi-minyi) : 0.0f;
        int a, tot= 0, minsize;
-       const int hnum= ((roundboxalign & 
(WIDGET_TOP_LEFT|WIDGET_TOP_RIGHT))==(WIDGET_TOP_LEFT|WIDGET_TOP_RIGHT) ||
-                        (roundboxalign & 
(WIDGET_BOTTOM_RIGHT|WIDGET_BOTTOM_LEFT))==(WIDGET_BOTTOM_RIGHT|WIDGET_BOTTOM_LEFT))
 ? 1 : 2;
-       const int vnum= ((roundboxalign & 
(WIDGET_TOP_LEFT|WIDGET_BOTTOM_LEFT))==(WIDGET_TOP_LEFT|WIDGET_BOTTOM_LEFT) ||

@@ Diff output truncated at 10240 characters. @@
_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to