Revision: 50209
          
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=50209
Author:   campbellbarton
Date:     2012-08-25 20:49:51 +0000 (Sat, 25 Aug 2012)
Log Message:
-----------
code cleanup: comments and some minor edits to interface code.

Modified Paths:
--------------
    trunk/blender/source/blender/editors/interface/interface.c
    trunk/blender/source/blender/editors/interface/interface_handlers.c
    trunk/blender/source/blender/editors/interface/interface_intern.h
    trunk/blender/source/blender/editors/interface/interface_layout.c

Modified: trunk/blender/source/blender/editors/interface/interface.c
===================================================================
--- trunk/blender/source/blender/editors/interface/interface.c  2012-08-25 
20:16:08 UTC (rev 50208)
+++ trunk/blender/source/blender/editors/interface/interface.c  2012-08-25 
20:49:51 UTC (rev 50209)
@@ -510,18 +510,18 @@
 
        /* Draw the inactive lines (lines with neither button being hovered 
over).
         * As we go, remember if we see any active or selected lines. */
-       int foundselectline = 0;
-       int foundactiveline = 0;
+       int foundselectline = FALSE;
+       int foundactiveline = FALSE;
        for (but = block->buttons.first; but; but = but->next) {
                if (but->type == LINK && but->link) {
                        for (line = but->link->lines.first; line; line = 
line->next) {
                                if (!(line->from->flag & UI_ACTIVE) && 
!(line->to->flag & UI_ACTIVE))
                                        ui_draw_linkline(line, 0);
                                else
-                                       foundactiveline = 1;
+                                       foundactiveline = TRUE;
 
                                if ((line->from->flag & UI_SELECT) || 
(line->to->flag & UI_SELECT))
-                                       foundselectline = 1;
+                                       foundselectline = TRUE;
                        }
                }
        }       
@@ -680,28 +680,27 @@
 {
        uiBlock *oldblock;
        uiBut *oldbut;
-       int activate = 0, found = 0, isactive = 0;
+       int activate = FALSE, found = FALSE, isactive = FALSE;
        
        oldblock = block->oldblock;
        if (!oldblock)
-               activate = 1;
+               activate = TRUE;
        else {
                for (oldbut = oldblock->buttons.first; oldbut; oldbut = 
oldbut->next) {
                        if (ui_but_equals_old(oldbut, but)) {
-                               found = 1;
+                               found = TRUE;
                                
                                if (oldbut->active)
-                                       isactive = 1;
+                                       isactive = TRUE;
                                
                                break;
                        }
                }
        }
-       if (activate || found == 0) {
+       if ((activate == TRUE) || (found == FALSE)) {
                ui_button_activate_do((bContext *)C, CTX_wm_region(C), but);
        }
-       else if (found && isactive == 0) {
-               
+       else if ((found == TRUE) && (isactive == FALSE)) {
                BLI_remlink(&block->buttons, but);
                ui_free_but(C, but);
                return 0;
@@ -911,7 +910,7 @@
 
                        if (ot == NULL || WM_operator_poll_context((bContext 
*)C, ot, but->opcontext) == 0) {
                                but->flag |= UI_BUT_DISABLED;
-                               but->lock = 1;
+                               but->lock = TRUE;
                        }
 
                        if (but->context)
@@ -1067,9 +1066,12 @@
 
 static void ui_is_but_sel(uiBut *but, double *value)
 {
-       short is_push = 0, is_true = 1;
+       short is_push = 0;  /* (0 == UNSELECT), (1 == SELECT), (2 == DO-NOHING) 
*/
+       short is_true = TRUE;
 
-       if (ELEM3(but->type, TOGN, ICONTOGN, OPTIONN)) is_true = 0;
+       if (ELEM3(but->type, TOGN, ICONTOGN, OPTIONN)) {
+               is_true = FALSE;
+       }
 
        if (but->bit) {
                int lvalue;
@@ -1198,14 +1200,14 @@
 void uiBlockSetButLock(uiBlock *block, int val, const char *lockstr)
 {
        if (val) {
-               block->lock = val ? 1 : 0;
+               block->lock = val ? TRUE : FALSE;
                block->lockstr = lockstr;
        }
 }
 
 void uiBlockClearButLock(uiBlock *block)
 {
-       block->lock = 0;
+       block->lock = FALSE;
        block->lockstr = NULL;
 }
 
@@ -1515,10 +1517,15 @@
                if (but->pointype == CHA)
                        value = (char)floor(value + 0.5);
                else if (but->pointype == SHO) {
-                       /* gcc 3.2.1 seems to have problems 
+                       /* gcc 3.2.1 seems to have problems
                         * casting a double like 32772.0 to
-                        * a short so we cast to an int, then 
-                        * to a short */
+                        * a short so we cast to an int, then
+                        * to a short.
+                        *
+                        * Update: even in gcc.4.6 using intermediate int cast 
gives -32764,
+                        * where as a direct cast from double to short gives 
-32768,
+                        * if this difference isn't important we could remove 
this hack,
+                        * since we dont support gcc3 anymore - Campbell */
                        int gcckludge;
                        gcckludge = (int) floor(value + 0.5);
                        value = (short)gcckludge;
@@ -2625,7 +2632,7 @@
 
        but->flag |= (block->flag & UI_BUT_ALIGN);
 
-       if (but->lock) {
+       if (but->lock == TRUE) {
                if (but->lockstr) {
                        but->flag |= UI_BUT_DISABLED;
                }
@@ -2855,7 +2862,7 @@
 
        if (!ot) {
                but->flag |= UI_BUT_DISABLED;
-               but->lock = 1;
+               but->lock = TRUE;
                but->lockstr = "";
        }
 
@@ -2894,7 +2901,7 @@
 
        if (!ot) {
                but->flag |= UI_BUT_DISABLED;
-               but->lock = 1;
+               but->lock = TRUE;
                but->lockstr = "";
        }
 

Modified: trunk/blender/source/blender/editors/interface/interface_handlers.c
===================================================================
--- trunk/blender/source/blender/editors/interface/interface_handlers.c 
2012-08-25 20:16:08 UTC (rev 50208)
+++ trunk/blender/source/blender/editors/interface/interface_handlers.c 
2012-08-25 20:49:51 UTC (rev 50209)
@@ -1140,8 +1140,9 @@
        static ColorBand but_copypaste_coba = {0};
        char buf[UI_MAX_DRAW_STR + 1] = {0};
 
-       if (mode == 'v' && but->lock)
+       if (mode == 'v' && but->lock  == TRUE) {
                return;
+       }
 
        if (mode == 'v') {
                /* extract first line from clipboard in case of multi-line 
copies */
@@ -4793,7 +4794,7 @@
        /* verify if we can edit this button */
        if (ELEM(event->type, LEFTMOUSE, RETKEY)) {
                /* this should become disabled button .. */
-               if (but->lock) {
+               if (but->lock == TRUE) {
                        if (but->lockstr) {
                                BKE_report(NULL, RPT_WARNING, but->lockstr);
                                button_activate_state(C, but, 
BUTTON_STATE_EXIT);

Modified: trunk/blender/source/blender/editors/interface/interface_intern.h
===================================================================
--- trunk/blender/source/blender/editors/interface/interface_intern.h   
2012-08-25 20:16:08 UTC (rev 50208)
+++ trunk/blender/source/blender/editors/interface/interface_intern.h   
2012-08-25 20:49:51 UTC (rev 50209)
@@ -303,27 +303,27 @@
        const char *lockstr;
 
        char lock;
-       char active;                // to keep blocks while drawing and free 
them afterwards
-       char tooltipdisabled;       // to avoid tooltip after click
-       char endblock;              // uiEndBlock done?
-       
-       float xofs, yofs;           // offset to parent button
-       int dobounds, mx, my;       // for doing delayed
-       int bounds, minbounds;      // for doing delayed
+       char active;                /* to keep blocks while drawing and free 
them afterwards */
+       char tooltipdisabled;       /* to avoid tooltip after click */
+       char endblock;              /* uiEndBlock done? */
 
-       rctf safety;                // pulldowns, to detect outside, can differ 
per case how it is created
-       ListBase saferct;           // uiSafetyRct list
+       float xofs, yofs;           /* offset to parent button */
+       int dobounds, mx, my;       /* for doing delayed */
+       int bounds, minbounds;      /* for doing delayed */
 
-       uiPopupBlockHandle *handle; // handle
+       rctf safety;                /* pulldowns, to detect outside, can differ 
per case how it is created */
+       ListBase saferct;           /* uiSafetyRct list */
 
-       struct wmOperator *ui_operator; // use so presets can find the operator,
-                                      // across menus and from nested popups 
which fail for operator context.
+       uiPopupBlockHandle *handle; /* handle */
 
-       void *evil_C;               // XXX hack for dynamic operator enums
+       struct wmOperator *ui_operator; /* use so presets can find the 
operator, */
+                                       /* across menus and from nested popups 
which fail for operator context. */
 
-       struct UnitSettings *unit;  // unit system, used a lot for numeric 
buttons so include here rather then fetching through the scene every time.
-       float _hsv[3];              // XXX, only access via ui_block_hsv_get()
-       char color_profile;         // color profile for correcting linear 
colors for display
+       void *evil_C;               /* XXX hack for dynamic operator enums */
+
+       struct UnitSettings *unit;  /* unit system, used a lot for numeric 
buttons so include here rather then fetching through the scene every time. */
+       float _hsv[3];              /* XXX, only access via ui_block_hsv_get() 
*/
+       char color_profile;         /* color profile for correcting linear 
colors for display */
 };
 
 typedef struct uiSafetyRct {

Modified: trunk/blender/source/blender/editors/interface/interface_layout.c
===================================================================
--- trunk/blender/source/blender/editors/interface/interface_layout.c   
2012-08-25 20:16:08 UTC (rev 50208)
+++ trunk/blender/source/blender/editors/interface/interface_layout.c   
2012-08-25 20:49:51 UTC (rev 50209)
@@ -630,7 +630,7 @@
 
        but = uiDefBut(block, LABEL, 0, name, 0, 0, w, UI_UNIT_Y, NULL, 0.0, 
0.0, 0, 0, "");
        but->flag |= UI_BUT_DISABLED;
-       but->lock = 1;
+       but->lock = TRUE;
        but->lockstr = "";
 }
 

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

Reply via email to