style cleanup
authorCampbell Barton <ideasman42@gmail.com>
Sun, 19 Aug 2012 10:41:27 +0000 (10:41 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Sun, 19 Aug 2012 10:41:27 +0000 (10:41 +0000)
source/blender/editors/interface/interface.c
source/blender/editors/interface/interface_draw.c
source/blender/editors/interface/interface_handlers.c
source/blender/editors/interface/interface_icons.c
source/blender/editors/interface/interface_layout.c
source/blender/editors/interface/interface_ops.c
source/blender/editors/interface/interface_panel.c
source/blender/editors/interface/interface_regions.c
source/blender/editors/interface/interface_templates.c
source/blender/editors/interface/interface_widgets.c

index e7eb1e3..62b26f5 100644 (file)
@@ -238,7 +238,7 @@ static void ui_text_bounds_block(uiBlock *block, float offset)
                        bt->rect.xmax = maxf(bt->rect.xmax, offset + block->minbounds);
                }
 
-               ui_check_but(bt);   // clips text again
+               ui_check_but(bt);  /* clips text again */
                
                if (nextcol)
                        x1addval += i + block->bounds;
@@ -993,7 +993,7 @@ static void ui_but_to_pixelrect(rcti *rect, const ARegion *ar, uiBlock *block, u
 /* uses local copy of style, to scale things down, and allow widgets to change stuff */
 void uiDrawBlock(const bContext *C, uiBlock *block)
 {
-       uiStyle style = *UI_GetStyle();  // XXX pass on as arg
+       uiStyle style = *UI_GetStyle();  /* XXX pass on as arg */
        ARegion *ar;
        uiBut *but;
        rcti rect;
@@ -1352,7 +1352,7 @@ int ui_is_but_unit(uiBut *but)
        if (unit_type == PROP_UNIT_NONE)
                return 0;
 
-#if 1 // removed so angle buttons get correct snapping
+#if 1 /* removed so angle buttons get correct snapping */
        if (unit->system_rotation == USER_UNIT_ROT_RADIANS && unit_type == PROP_UNIT_ROTATION)
                return 0;
 #endif
@@ -2095,7 +2095,7 @@ uiBlock *uiBeginBlock(const bContext *C, ARegion *region, const char *name, shor
        block = MEM_callocN(sizeof(uiBlock), "uiBlock");
        block->active = 1;
        block->dt = dt;
-       block->evil_C = (void *)C; // XXX
+       block->evil_C = (void *)C;  /* XXX */
 
        if (scn) {
                block->color_profile = (scn->r.color_mgt_flag & R_COLOR_MANAGEMENT);
@@ -2365,7 +2365,7 @@ static int buts_are_horiz(uiBut *but1, uiBut *but2)
 
 void uiBlockEndAlign(uiBlock *block)
 {
-       block->flag &= ~UI_BUT_ALIGN;   // all 4 flags
+       block->flag &= ~UI_BUT_ALIGN;  /* all 4 flags */
 }
 
 int ui_but_can_align(uiBut *but)
@@ -2588,8 +2588,8 @@ static uiBut *ui_def_but(uiBlock *block, int type, int retval, const char *str,
        but->lockstr = block->lockstr;
        but->dt = block->dt;
 
-       but->aspect = 1.0f; //XXX block->aspect;
-       but->block = block;      // pointer back, used for frontbuffer status, and picker
+       but->aspect = 1.0f;  /* XXX block->aspect; */
+       but->block = block;  /* pointer back, used for frontbuffer status, and picker */
 
        if ((block->flag & UI_BUT_ALIGN) && ui_but_can_align(but))
                but->alignnr = block->alignnr;
index f7eff2c..41a827b 100644 (file)
@@ -629,7 +629,7 @@ static void ui_draw_but_CHARTAB(uiBut *but)
        }
 }
 
-#endif // WITH_INTERNATIONAL
+#endif /* WITH_INTERNATIONAL */
 #endif
 
 static void draw_scope_end(rctf *rect, GLint *scissor)
index 5226b2a..4010274 100644 (file)
@@ -4707,7 +4707,6 @@ static int ui_but_menu(bContext *C, uiBut *but)
 
 static int ui_do_button(bContext *C, uiBlock *block, uiBut *but, wmEvent *event)
 {
-//     Scene *scene= CTX_data_scene(C);
        uiHandleButtonData *data;
        int retval;
 
@@ -4874,7 +4873,7 @@ static int ui_do_button(bContext *C, uiBlock *block, uiBut *but, wmEvent *event)
                        retval = ui_do_but_BUT(C, but, data, event);
                        break;
                case COL:
-                       if (but->a1 == UI_GRAD_V_ALT) // signal to prevent calling up color picker
+                       if (but->a1 == UI_GRAD_V_ALT)  /* signal to prevent calling up color picker */
                                retval = ui_do_but_EXIT(C, but, data, event);
                        else
                                retval = ui_do_but_BLOCK(C, but, data, event);
@@ -5280,8 +5279,13 @@ static void button_activate_init(bContext *C, ARegion *ar, uiBut *but, uiButtonA
        data->wm = CTX_wm_manager(C);
        data->window = CTX_wm_window(C);
        data->region = ar;
-       if (ELEM(but->type, BUT_CURVE, SEARCH_MENU) ) ;  // XXX curve is temp
-       else data->interactive = 1;
+
+       if (ELEM(but->type, BUT_CURVE, SEARCH_MENU)) {
+               /* XXX curve is temp */
+       }
+       else {
+               data->interactive = 1;
+       }
        
        data->state = BUTTON_STATE_INIT;
 
index 2bfead7..dd3c2e4 100644 (file)
@@ -596,7 +596,7 @@ static void init_internal_icons(void)
 
        IMB_freeImBuf(bbuf);
 }
-#endif // WITH_HEADLESS
+#endif  /* WITH_HEADLESS */
 
 static void init_iconfile_list(struct ListBase *list)
 {
index 32bad26..350aab7 100644 (file)
@@ -2749,7 +2749,7 @@ static void ui_intro_button(DynStr *ds, uiButtonItem *bitem)
        uiBut *but = bitem->but;
        BLI_dynstr_appendf(ds, "'type':%d, ", but->type); /* see ~ UI_interface.h:200 */
        BLI_dynstr_appendf(ds, "'draw_string':'''%s''', ", but->drawstr);
-       BLI_dynstr_appendf(ds, "'tip':'''%s''', ", but->tip ? but->tip : ""); // not exactly needed, rna has this
+       BLI_dynstr_appendf(ds, "'tip':'''%s''', ", but->tip ? but->tip : "");  /* not exactly needed, rna has this */
 
        if (but->optype) {
                char *opstr = WM_operator_pystring(but->block->evil_C, but->optype, but->opptr, 0);
@@ -2811,7 +2811,7 @@ static void ui_intro_uiLayout(DynStr *ds, uiLayout *layout)
        ui_intro_items(ds, &layout->items);
 }
 
-static char *str = NULL; // XXX, constant re-freeing, far from ideal.
+static char *str = NULL;  /* XXX, constant re-freeing, far from ideal. */
 const char *uiLayoutIntrospect(uiLayout *layout)
 {
        DynStr *ds = BLI_dynstr_new();
@@ -2848,8 +2848,10 @@ void uiLayoutOperatorButs(const bContext *C, uiLayout *layout, wmOperator *op, i
        /* poll() on this operator may still fail, at the moment there is no nice feedback when this happens
         * just fails silently */
        if (!WM_operator_repeat_check(C, op)) {
-               uiBlockSetButLock(uiLayoutGetBlock(layout), TRUE, "Operator cannot redo");
-               uiItemL(layout, IFACE_("* Redo Unsupported *"), ICON_NONE); // XXX, could give some nicer feedback or not show redo panel at all?
+               uiBlockSetButLock(uiLayoutGetBlock(layout), TRUE, "Operator can't' redo");
+
+               /* XXX, could give some nicer feedback or not show redo panel at all? */
+               uiItemL(layout, IFACE_("* Redo Unsupported *"), ICON_NONE);
        }
 
        /* menu */
index 53ff198..8020005 100644 (file)
@@ -1055,7 +1055,7 @@ void UI_buttons_operatortypes(void)
        WM_operatortype_append(UI_OT_copy_data_path_button);
        WM_operatortype_append(UI_OT_reset_default_button);
        WM_operatortype_append(UI_OT_copy_to_selected_button);
-       WM_operatortype_append(UI_OT_reports_to_textblock); // XXX: temp?
+       WM_operatortype_append(UI_OT_reports_to_textblock);  /* XXX: temp? */
 
 #ifdef WITH_PYTHON
        WM_operatortype_append(UI_OT_editsource);
index 501a5cf..3bbf5b1 100644 (file)
@@ -875,11 +875,11 @@ void uiEndPanels(const bContext *C, ARegion *ar, int *x, int *y)
 
        /* consistency; are panels not made, whilst they have tabs */
        for (panot = ar->panels.first; panot; panot = panot->next) {
-               if ((panot->runtime_flag & PNL_ACTIVE) == 0) { // not made
+               if ((panot->runtime_flag & PNL_ACTIVE) == 0) {  /* not made */
 
                        for (panew = ar->panels.first; panew; panew = panew->next) {
                                if ((panew->runtime_flag & PNL_ACTIVE)) {
-                                       if (panew->paneltab == panot) { // panew is tab in notmade pa
+                                       if (panew->paneltab == panot) {  /* panew is tab in notmade pa */
                                                break;
                                        }
                                }
@@ -893,7 +893,7 @@ void uiEndPanels(const bContext *C, ARegion *ar, int *x, int *y)
                                }
                                panot->paneltab = panew;
                                panew->paneltab = NULL;
-                               ED_region_tag_redraw(ar); // the buttons panew were not made
+                               ED_region_tag_redraw(ar); /* the buttons panew were not made */
                        }
                }       
        }
@@ -1045,10 +1045,10 @@ static void ui_handle_panel_header(const bContext *C, uiBlock *block, int mx, in
        }
        
        if (button) {
-               if (button == 2) { // close
+               if (button == 2) {  /* close */
                        ED_region_tag_redraw(ar);
                }
-               else {  // collapse
+               else {  /* collapse */
                        if (block->panel->flag & PNL_CLOSED) {
                                block->panel->flag &= ~PNL_CLOSED;
                                /* snap back up so full panel aligns with screen edge */
@@ -1106,7 +1106,7 @@ int ui_handler_panel_region(bContext *C, wmEvent *event)
 
                if (!pa || pa->paneltab != NULL)
                        continue;
-               if (pa->type && pa->type->flag & PNL_NO_HEADER) // XXX - accessed freed panels when scripts reload, need to fix.
+               if (pa->type && pa->type->flag & PNL_NO_HEADER)  /* XXX - accessed freed panels when scripts reload, need to fix. */
                        continue;
 
                if (block->rect.xmin <= mx && block->rect.xmax >= mx)
@@ -1177,7 +1177,7 @@ int ui_handler_panel_region(bContext *C, wmEvent *event)
 #endif
                                }
                                else if (event->type == PADPLUSKEY || event->type == PADMINUS) {
-#if 0 // XXX make float panel exception?
+#if 0 /* XXX make float panel exception? */
                                        int zoom = 0;
                                
                                        /* if panel is closed, only zoom if mouse is over the header */
@@ -1275,7 +1275,7 @@ static void panel_activate_state(const bContext *C, Panel *pa, uiHandlePanelStat
                         * Aligorith, 2009Sep
                         */
                        //test_add_new_tabs(ar);   // also copies locations of tabs in dragged panel
-                       check_panel_overlap(ar, NULL);  // clears
+                       check_panel_overlap(ar, NULL);  /* clears */
                }
 
                pa->flag &= ~PNL_SELECT;
index dcab175..be118e1 100644 (file)
@@ -1431,7 +1431,7 @@ static void ui_block_position(wmWindow *window, ARegion *butregion, uiBut *but,
                        yof = butrct.ymax - block->rect.ymin;
                        if (dir2 == UI_RIGHT) xof = butrct.xmax - block->rect.xmax;
                        else xof = butrct.xmin - block->rect.xmin;
-                       // changed direction? 
+                       /* changed direction? */
                        if ((dir1 & block->direction) == 0) {
                                if (block->direction & UI_SHIFT_FLIPPED)
                                        xof += dir2 == UI_LEFT ? 25 : -25;
@@ -1442,7 +1442,7 @@ static void ui_block_position(wmWindow *window, ARegion *butregion, uiBut *but,
                        yof = butrct.ymin - block->rect.ymax;
                        if (dir2 == UI_RIGHT) xof = butrct.xmax - block->rect.xmax;
                        else xof = butrct.xmin - block->rect.xmin;
-                       // changed direction?
+                       /* changed direction? */
                        if ((dir1 & block->direction) == 0) {
                                if (block->direction & UI_SHIFT_FLIPPED)
                                        xof += dir2 == UI_LEFT ? 25 : -25;
@@ -1453,7 +1453,7 @@ static void ui_block_position(wmWindow *window, ARegion *butregion, uiBut *but,
                /* and now we handle the exception; no space below or to top */
                if (top == 0 && down == 0) {
                        if (dir1 == UI_LEFT || dir1 == UI_RIGHT) {
-                               // align with bottom of screen 
+                               /* align with bottom of screen */
                                // yof= ysize; (not with menu scrolls)
                        }
                }
@@ -1461,12 +1461,12 @@ static void ui_block_position(wmWindow *window, ARegion *butregion, uiBut *but,
                /* or no space left or right */
                if (left == 0 && right == 0) {
                        if (dir1 == UI_TOP || dir1 == UI_DOWN) {
-                               // align with left size of screen 
+                               /* align with left size of screen */
                                xof = -block->rect.xmin + 5;
                        }
                }
                
-               // apply requested offset in the block
+               /* apply requested offset in the block */
                xof += block->xofs / block->aspect;
                yof += block->yofs / block->aspect;
 #if 0
index 0c69a18..7c4f181 100644 (file)
@@ -1517,7 +1517,7 @@ void uiTemplateWaveform(uiLayout *layout, PointerRNA *ptr, const char *propname)
        scopes->wavefrm_height = (scopes->wavefrm_height <= UI_UNIT_Y) ? UI_UNIT_Y : scopes->wavefrm_height;
 
        bt = uiDefBut(block, WAVEFORM, 0, "", rect.xmin, rect.ymin, rect.xmax - rect.xmin, scopes->wavefrm_height, scopes, 0, 0, 0, 0, "");
-       (void)bt; // UNUSED
+       (void)bt;  /* UNUSED */
        
        MEM_freeN(cb);
 }
@@ -2315,7 +2315,6 @@ static void list_item_row(bContext *C, uiLayout *layout, PointerRNA *ptr, Pointe
 
 void uiTemplateList(uiLayout *layout, bContext *C, PointerRNA *ptr, const char *propname, PointerRNA *activeptr, const char *activepropname, const char *prop_list, int rows, int maxrows, int listtype)
 {
-       //Scene *scene = CTX_data_scene(C);
        PropertyRNA *prop = NULL, *activeprop;
        PropertyType type, activetype;
        StructRNA *ptype;
@@ -2626,7 +2625,7 @@ void uiTemplateRunningJobs(uiLayout *layout, bContext *C)
                uiLayout *ui_abs;
                
                ui_abs = uiLayoutAbsolute(layout, FALSE);
-               (void)ui_abs; // UNUSED
+               (void)ui_abs;  /* UNUSED */
                
                uiDefIconBut(block, BUT, handle_event, ICON_PANEL_CLOSE, 
                             0, UI_UNIT_Y * 0.1, UI_UNIT_X * 0.8, UI_UNIT_Y * 0.8, NULL, 0.0f, 0.0f, 0, 0, TIP_("Stop this job"));
index b439271..aebdb34 100644 (file)
@@ -1095,7 +1095,7 @@ static void ui_text_label_rightclip(uiFontStyle *fstyle, uiBut *but, rcti *rect)
 
 static void widget_draw_text(uiFontStyle *fstyle, uiWidgetColors *wcol, uiBut *but, rcti *rect)
 {
-//     int transopts;
+       //int transopts;  // UNUSED
        char *cpoin = NULL;
        
        /* for underline drawing */
@@ -1170,7 +1170,7 @@ static void widget_draw_text(uiFontStyle *fstyle, uiWidgetColors *wcol, uiBut *b
 
 #if 0
        ui_rasterpos_safe(x, y, but->aspect);
-       if (but->type == IDPOIN) transopts = 0;  // no translation, of course!
+       if (but->type == IDPOIN) transopts = 0;  /* no translation, of course! */
        else transopts = ui_translate_buttons();
 #endif
 
@@ -1654,13 +1654,13 @@ static void widget_state(uiWidgetType *wt, int state)
 static void widget_state_numslider(uiWidgetType *wt, int state)
 {
        uiWidgetStateColors *wcol_state = wt->wcol_state;
-       float blend = wcol_state->blend - 0.2f; // XXX special tweak to make sure that bar will still be visible
+       float blend = wcol_state->blend - 0.2f; /* XXX special tweak to make sure that bar will still be visible */
 
        /* call this for option button */
        widget_state(wt, state);
        
        /* now, set the inner-part so that it reflects state settings too */
-       // TODO: maybe we should have separate settings for the blending colors used for this case?
+       /* TODO: maybe we should have separate settings for the blending colors used for this case? */
        if (state & UI_SELECT) {
                
                if (state & UI_BUT_ANIMATED_KEY)
@@ -2007,13 +2007,13 @@ void ui_draw_gradient(rcti *rect, const float hsv[3], const int type, const floa
        /* old below */
        
        for (dx = 0.0f; dx < 1.0f; dx += color_step) {
-               // previous color
+               /* previous color */
                copy_v3_v3(col0[0], col1[0]);
                copy_v3_v3(col0[1], col1[1]);
                copy_v3_v3(col0[2], col1[2]);
                copy_v3_v3(col0[3], col1[3]);
                
-               // new color
+               /* new color */
                switch (type) {
                        case UI_GRAD_SV:
                                hsv_to_rgb(h, 0.0, dx,   &col1[0][0], &col1[0][1], &col1[0][2]);
@@ -2057,7 +2057,7 @@ void ui_draw_gradient(rcti *rect, const float hsv[3], const int type, const floa
                                break;
                }
                
-               // rect
+               /* rect */
                sx1 = rect->xmin + dx * (rect->xmax - rect->xmin);
                sx2 = rect->xmin + (dx + color_step) * (rect->xmax - rect->xmin);
                sy = rect->ymin;
@@ -2221,7 +2221,6 @@ static void widget_numbut(uiWidgetColors *wcol, rcti *rect, int state, int round
        rect->xmax -= textofs;
 }
 
-//static int ui_link_bezier_points(rcti *rect, float coord_array[][2], int resol)
 int ui_link_bezier_points(rcti *rect, float coord_array[][2], int resol)
 {
        float dist, vec[4][2];
@@ -2252,7 +2251,7 @@ void ui_draw_link_bezier(rcti *rect)
        
        if (ui_link_bezier_points(rect, coord_array, LINK_RESOL)) {
                /* we can reuse the dist variable here to increment the GL curve eval amount*/
-               // const float dist = 1.0f/(float)LINK_RESOL; // UNUSED
+               // const float dist = 1.0f / (float)LINK_RESOL; // UNUSED
 
                glEnable(GL_BLEND);
                glEnable(GL_LINE_SMOOTH);
@@ -2659,7 +2658,7 @@ static void widget_pulldownbut(uiWidgetColors *wcol, rcti *rect, int state, int
 {
        if (state & UI_ACTIVE) {
                uiWidgetBase wtb;
-               float rad = 0.5f * (rect->ymax - rect->ymin); // 4.0f
+               float rad = 0.5f * (rect->ymax - rect->ymin);  /* 4.0f */
                
                widget_init(&wtb);
                
@@ -2787,7 +2786,7 @@ static void widget_but(uiWidgetColors *wcol, rcti *rect, int UNUSED(state), int
 static void widget_roundbut(uiWidgetColors *wcol, rcti *rect, int UNUSED(state), int roundboxalign)
 {
        uiWidgetBase wtb;
-       float rad = 5.0f; //0.5f*(rect->ymax - rect->ymin);
+       float rad = 5.0f;  /* 0.5f * (rect->ymax - rect->ymin); */
        
        widget_init(&wtb);
        
@@ -3176,10 +3175,12 @@ void ui_draw_but(const bContext *C, ARegion *ar, uiStyle *style, uiBut *but, rct
                                break;
                                
                        case HSVCUBE:
-                               if (but->a1 == UI_GRAD_V_ALT) // vertical V slider, uses new widget draw now
+                               if (but->a1 == UI_GRAD_V_ALT) {  /* vertical V slider, uses new widget draw now */
                                        ui_draw_but_HSV_v(but, rect);
-                               else  // other HSV pickers...
+                               }
+                               else {  /* other HSV pickers... */
                                        ui_draw_but_HSVCUBE(but, rect);
+                               }
                                break;
                                
                        case HSVCIRCLE: