Commit: 5c6e3337801b493926210e96237be2b495fc5d1b
Author: Campbell Barton
Date:   Sun Nov 9 21:20:40 2014 +0100
Branches: master
https://developer.blender.org/rB5c6e3337801b493926210e96237be2b495fc5d1b

UI Refactor T41640

Make the UI API more consistent and reduce confusion with some naming.

mainly:
- API function calls
- enum values

some internal static functions have been left for now

===================================================================

M       source/blender/editors/animation/anim_channels_defines.c
M       source/blender/editors/animation/anim_draw.c
M       source/blender/editors/animation/anim_markers.c
M       source/blender/editors/animation/drivers.c
M       source/blender/editors/animation/fmodifier_ui.c
M       source/blender/editors/animation/keyframing.c
M       source/blender/editors/animation/keyingsets.c
M       source/blender/editors/armature/armature_relations.c
M       source/blender/editors/armature/pose_edit.c
M       source/blender/editors/armature/pose_group.c
M       source/blender/editors/armature/pose_lib.c
M       source/blender/editors/curve/editcurve.c
M       source/blender/editors/curve/editfont.c
M       source/blender/editors/gpencil/gpencil_buttons.c
M       source/blender/editors/include/UI_interface.h
M       source/blender/editors/interface/interface.c
M       source/blender/editors/interface/interface_anim.c
M       source/blender/editors/interface/interface_draw.c
M       source/blender/editors/interface/interface_eyedropper.c
M       source/blender/editors/interface/interface_handlers.c
M       source/blender/editors/interface/interface_intern.h
M       source/blender/editors/interface/interface_layout.c
M       source/blender/editors/interface/interface_ops.c
M       source/blender/editors/interface/interface_panel.c
M       source/blender/editors/interface/interface_regions.c
M       source/blender/editors/interface/interface_style.c
M       source/blender/editors/interface/interface_templates.c
M       source/blender/editors/interface/interface_utils.c
M       source/blender/editors/interface/interface_widgets.c
M       source/blender/editors/interface/view2d.c
M       source/blender/editors/interface/view2d_ops.c
M       source/blender/editors/object/object_constraint.c
M       source/blender/editors/object/object_relations.c
M       source/blender/editors/object/object_select.c
M       source/blender/editors/render/render_preview.c
M       source/blender/editors/render/render_shading.c
M       source/blender/editors/screen/area.c
M       source/blender/editors/screen/screen_context.c
M       source/blender/editors/screen/screen_edit.c
M       source/blender/editors/screen/screen_ops.c
M       source/blender/editors/sculpt_paint/sculpt.c
M       source/blender/editors/sound/sound_ops.c
M       source/blender/editors/space_action/action_draw.c
M       source/blender/editors/space_action/action_edit.c
M       source/blender/editors/space_api/spacetypes.c
M       source/blender/editors/space_buttons/buttons_context.c
M       source/blender/editors/space_buttons/buttons_ops.c
M       source/blender/editors/space_buttons/buttons_texture.c
M       source/blender/editors/space_clip/clip_buttons.c
M       source/blender/editors/space_clip/clip_dopesheet_draw.c
M       source/blender/editors/space_clip/clip_ops.c
M       source/blender/editors/space_clip/clip_toolbar.c
M       source/blender/editors/space_file/file_draw.c
M       source/blender/editors/space_file/file_panels.c
M       source/blender/editors/space_file/filesel.c
M       source/blender/editors/space_graph/graph_buttons.c
M       source/blender/editors/space_graph/graph_draw.c
M       source/blender/editors/space_image/image_buttons.c
M       source/blender/editors/space_image/image_ops.c
M       source/blender/editors/space_info/info_ops.c
M       source/blender/editors/space_logic/logic_buttons.c
M       source/blender/editors/space_logic/logic_window.c
M       source/blender/editors/space_nla/nla_buttons.c
M       source/blender/editors/space_nla/nla_draw.c
M       source/blender/editors/space_nla/nla_edit.c
M       source/blender/editors/space_node/drawnode.c
M       source/blender/editors/space_node/node_add.c
M       source/blender/editors/space_node/node_draw.c
M       source/blender/editors/space_node/node_group.c
M       source/blender/editors/space_node/node_select.c
M       source/blender/editors/space_node/node_templates.c
M       source/blender/editors/space_outliner/outliner_draw.c
M       source/blender/editors/space_outliner/outliner_edit.c
M       source/blender/editors/space_sequencer/sequencer_add.c
M       source/blender/editors/space_sequencer/sequencer_draw.c
M       source/blender/editors/space_text/text_draw.c
M       source/blender/editors/space_text/text_header.c
M       source/blender/editors/space_text/text_ops.c
M       source/blender/editors/space_view3d/view3d_buttons.c
M       source/blender/editors/space_view3d/view3d_draw.c
M       source/blender/editors/space_view3d/view3d_header.c
M       source/blender/editors/space_view3d/view3d_ruler.c
M       source/blender/editors/space_view3d/view3d_select.c
M       source/blender/editors/space_view3d/view3d_toolbar.c
M       source/blender/editors/transform/transform_ops.c
M       source/blender/editors/util/ed_util.c
M       source/blender/editors/util/numinput.c
M       source/blender/editors/util/undo.c
M       source/blender/editors/uvedit/uvedit_buttons.c
M       source/blender/makesrna/intern/rna_wm.c
M       source/blender/makesrna/intern/rna_wm_api.c
M       source/blender/windowmanager/intern/wm_dragdrop.c
M       source/blender/windowmanager/intern/wm_event_system.c
M       source/blender/windowmanager/intern/wm_operators.c
M       source/blenderplayer/bad_level_call_stubs/stubs.c

===================================================================

diff --git a/source/blender/editors/animation/anim_channels_defines.c 
b/source/blender/editors/animation/anim_channels_defines.c
index 7d8e278..f384b2f 100644
--- a/source/blender/editors/animation/anim_channels_defines.c
+++ b/source/blender/editors/animation/anim_channels_defines.c
@@ -120,8 +120,8 @@ static void acf_generic_root_backdrop(bAnimContext *ac, 
bAnimListElem *ale, floa
        glColor3fv(color);
        
        /* rounded corners on LHS only - top only when expanded, but bottom too 
when collapsed */
-       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);
+       UI_draw_roundbox_corner_set((expanded) ? UI_CNR_TOP_LEFT : 
(UI_CNR_TOP_LEFT | UI_CNR_BOTTOM_LEFT));
+       UI_draw_roundbox_gl_mode(GL_POLYGON, offset,  yminc, v2d->cur.xmax + 
EXTRA_SCROLL_PAD, ymaxc, 8);
 }
 
 
@@ -420,8 +420,8 @@ static void acf_summary_backdrop(bAnimContext *ac, 
bAnimListElem *ale, float ymi
         *      - top and bottom 
         *      - special hack: make the top a bit higher, since we are 
first... 
         */
-       uiSetRoundBox(UI_CNR_TOP_LEFT | UI_CNR_BOTTOM_LEFT);
-       uiDrawBox(GL_POLYGON, 0,  yminc - 2, v2d->cur.xmax + EXTRA_SCROLL_PAD, 
ymaxc, 8);
+       UI_draw_roundbox_corner_set(UI_CNR_TOP_LEFT | UI_CNR_BOTTOM_LEFT);
+       UI_draw_roundbox_gl_mode(GL_POLYGON, 0,  yminc - 2, v2d->cur.xmax + 
EXTRA_SCROLL_PAD, ymaxc, 8);
 }
 
 /* name for summary entries */
@@ -800,8 +800,8 @@ static void acf_group_backdrop(bAnimContext *ac, 
bAnimListElem *ale, float yminc
        glColor3fv(color);
        
        /* rounded corners on LHS only - top only when expanded, but bottom too 
when collapsed */
-       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);
+       UI_draw_roundbox_corner_set(expanded ? UI_CNR_TOP_LEFT : 
(UI_CNR_TOP_LEFT | UI_CNR_BOTTOM_LEFT));
+       UI_draw_roundbox_gl_mode(GL_POLYGON, offset,  yminc, v2d->cur.xmax + 
EXTRA_SCROLL_PAD, ymaxc, 8);
 }
 
 /* name for group entries */
@@ -3010,12 +3010,12 @@ static void acf_nlaaction_backdrop(bAnimContext *ac, 
bAnimListElem *ale, float y
        /* only on top left corner, to show that this channel sits on top of 
the preceding ones 
         * while still linking into the action line strip to the right
         */
-       uiSetRoundBox(UI_CNR_TOP_LEFT);
+       UI_draw_roundbox_corner_set(UI_CNR_TOP_LEFT);
        
        /* draw slightly shifted up vertically to look like it has more 
separation from other channels,
         * but we then need to slightly shorten it so that it doesn't look like 
it overlaps
         */
-       uiDrawBox(GL_POLYGON, offset,  yminc + NLACHANNEL_SKIP, 
(float)v2d->cur.xmax, ymaxc + NLACHANNEL_SKIP - 1, 8);
+       UI_draw_roundbox_gl_mode(GL_POLYGON, offset,  yminc + NLACHANNEL_SKIP, 
(float)v2d->cur.xmax, ymaxc + NLACHANNEL_SKIP - 1, 8);
 }
 
 /* name for nla action entries */
@@ -3449,7 +3449,7 @@ void ANIM_channel_draw(bAnimContext *ac, bAnimListElem 
*ale, float yminc, float
                acf->name(ale, name);
                
                offset += 3;
-               UI_DrawString(offset, ytext, name);
+               UI_draw_string(offset, ytext, name);
                
                /* draw red underline if channel is disabled */
                if ((ale->type == ANIMTYPE_FCURVE) && (ale->flag & 
FCURVE_DISABLED)) {
@@ -3788,9 +3788,9 @@ static void draw_setting_widget(bAnimContext *ac, 
bAnimListElem *ale, bAnimChann
        
        /* type of button */
        if (negflag)
-               butType = ICONTOGN;
+               butType = UI_BTYPE_ICON_TOGGLE_N;
        else
-               butType = ICONTOG;
+               butType = UI_BTYPE_ICON_TOGGLE;
        
        /* draw button for setting */
        if (ptr && flag) {
@@ -3819,18 +3819,18 @@ static void draw_setting_widget(bAnimContext *ac, 
bAnimListElem *ale, bAnimChann
                                case ACHANNEL_SETTING_PROTECT: /* General - 
protection flags */
                                case ACHANNEL_SETTING_MUTE: /* General - muting 
flags */
                                case ACHANNEL_SETTING_PINNED: /* NLA Actions - 
'map/nomap' */
-                                       uiButSetNFunc(but, 
achannel_setting_flush_widget_cb, MEM_dupallocN(ale), 
SET_INT_IN_POINTER(setting));
+                                       UI_but_funcN_set(but, 
achannel_setting_flush_widget_cb, MEM_dupallocN(ale), 
SET_INT_IN_POINTER(setting));
                                        break;
                                        
                                /* settings needing special attention */
                                case ACHANNEL_SETTING_SOLO: /* NLA Tracks - 
Solo toggle */
-                                       uiButSetFunc(but, 
achannel_nlatrack_solo_widget_cb, ale->adt, ale->data);
+                                       UI_but_func_set(but, 
achannel_nlatrack_solo_widget_cb, ale->adt, ale->data);
                                        break;
                                        
                                /* no flushing */
                                case ACHANNEL_SETTING_EXPAND: /* expanding - 
cannot flush, otherwise all would open/close at once */
                                default:
-                                       uiButSetFunc(but, 
achannel_setting_widget_cb, NULL, NULL);
+                                       UI_but_func_set(but, 
achannel_setting_widget_cb, NULL, NULL);
                                        break;
                        }
                }
@@ -3861,7 +3861,7 @@ void ANIM_channel_draw_widgets(bContext *C, bAnimContext 
*ac, bAnimListElem *ale
        ymid = y - 0.5f * ICON_WIDTH;
        
        /* no button backdrop behind icons */
-       uiBlockSetEmboss(block, UI_EMBOSSN);
+       UI_block_emboss_set(block, UI_EMBOSS_NONE);
        
        /* step 1) draw expand widget ....................................... */
        if (acf->has_setting(ac, ale, ACHANNEL_SETTING_EXPAND)) {
@@ -3908,14 +3908,14 @@ void ANIM_channel_draw_widgets(bContext *C, 
bAnimContext *ac, bAnimListElem *ale
                        if (acf->name_prop(ale, &ptr, &prop)) {
                                uiBut *but;
                                
-                               uiBlockSetEmboss(block, UI_EMBOSS);
+                               UI_block_emboss_set(block, UI_EMBOSS);
                                
-                               but = uiDefButR(block, TEX, 1, "", offset + 3, 
yminc, RENAME_TEXT_WIDTH, channel_height,
+                               but = uiDefButR(block, UI_BTYPE_TEXT, 1, "", 
offset + 3, yminc, RENAME_TEXT_WIDTH, channel_height,
                                                &ptr, 
RNA_property_identifier(prop), -1, 0, 0, -1, -1, NULL);
-                               uiButSetFunc(but, 
achannel_setting_rename_done_cb, ac->ads, NULL);
-                               uiButActiveOnly(C, ac->ar, block, but);
+                               UI_but_func_set(but, 
achannel_setting_rename_done_cb, ac->ads, NULL);
+                               UI_but_active_only(C, ac->ar, block, but);
                                
-                               uiBlockSetEmboss(block, UI_EMBOSSN);
+                               UI_block_emboss_set(block, UI_EMBOSS_NONE);
                        }
                }
        }
@@ -3972,16 +3972,16 @@ void ANIM_channel_draw_widgets(bContext *C, 
bAnimContext *ac, bAnimListElem *ale
                                uiBut *but;
                                PointerRNA *opptr_b;
                                
-                               uiBlockSetEmboss(block, UI_EMBOSS);
+                               UI_block_emboss_set(block, UI_EMBOSS);
                                
                                offset += UI_UNIT_X;
-                               but = uiDefIconButO(block, BUT, 
"NLA_OT_action_pushdown", WM_OP_INVOKE_DEFAULT, ICON_NLA_PUSHDOWN, 
+                               but = uiDefIconButO(block, UI_BTYPE_BUT, 
"NLA_OT_action_pushdown", WM_OP_INVOKE_DEFAULT, ICON_NLA_PUSHDOWN, 
                                                   (int)v2d->cur.xmax - offset, 
ymid, UI_UNIT_X, UI_UNIT_X, NULL);
                                
-                               opptr_b = uiButGetOperatorPtrRNA(but);
+                               opptr_b = UI_but_operator_ptr_get(but);
                                RNA_int_set(opptr_b, "channel_index", 
channel_index);
                                
-                               uiBlockSetEmboss(block, UI_EMBOSSN);
+                               UI_block_emboss_set(block, UI_EMBOSS_NONE);
                        }
                }
                
@@ -3999,7 +3999,7 @@ void ANIM_channel_draw_widgets(bContext *C, bAnimContext 
*ac, bAnimListElem *ale
                        offset += SLIDER_WIDTH;
                        
                        /* need backdrop behind sliders... */
-                       uiBlockSetEmboss(block, UI_EMBOSS);
+                       UI_block_emboss_set(block, UI_EMBOSS);
                        
                        if (ale->id) { /* Slider using RNA Access 
-------------------- */
                                PointerRNA id_ptr, ptr;
@@ -4037,9 +4037,9 @@ void ANIM_channel_draw_widgets(bContext *C, bAnimContext 
*ac, bAnimListElem *ale
                                                
                                                /* assign keyframing function 
according to slider type */
                                                if (ale->type == 
ANIMTYPE_SHAPEKEY)
-                                                       uiButSetFunc(but, 
achannel_setting_slider_shapekey_cb, ale->id, ale->data);
+                                                       UI_but_func_set(but, 
achannel_setting_slider_shapekey_cb, ale->id, ale->data);
                                                else
-                                                       uiButSetFunc(but, 
achannel_setting_slider_cb, ale->id, ale->data);
+                                                       UI_but_func_set(but, 
achannel_setting_slider_cb, ale->id, ale->data);
                                        }
                                        
                                        /* free the path if necessary */
diff --git a/source/blender/editors/animation/anim_draw.c 
b/source/blender/editors/animation/anim_draw.c
index 9c3f310..9cfe307 100644
--- a/source/blender/editors/animation/anim_draw.c
+++ b/source/blender/editors/animation/anim_draw.c
@@ -79,7 +79,7 @@ static void draw_cfra_number(Scene *scene, View2D *v2d, const 
float cfra, const
        else {
                BLI_timecode_string_from_time_simple(&numstr[4], sizeof(numstr) 
- 4, 1, cfra);
        }
-       slen = (short)UI_GetStringWidth(numstr) - 1;
+       slen = (short)UI_fontstyle_string_width(numstr) - 1;
        
        /* get starting coordinates for drawing */
        x = cfra * xscale;
@@ -91,7 +91,7 @@ static void draw_cfra_number(Scene *scene, View2D *v2d, const 
float cfra, const
        
        /* draw current frame number - black text */
        UI_ThemeColor(TH_TEXT);
-       UI_DrawString(x - 0.25f * U.widget_unit, y + 0.15f * U.widget_unit, 
numstr);
+       UI_draw_string(x - 0.25f * U.widget_unit, y + 0.15f * U.widget_unit, 
numstr);
        
        /* restore view transform */
        glScalef(xscale, 1.0, 1.0);
diff --git a/source/blender/editors/animation/anim_markers.c 
b/source/blender/editors/animation/anim_markers.c
index acf8bdc..b6c7a4a 100644
--- a/source/blender/editors/animation/anim_markers.c
+++ b/source/blender/editors/animation/anim_markers.c
@@ -399,7 +399,7 @@ static void draw_marker(
                }
 #endif
 
-               UI_DrawString(x, y, marker->name);
+               UI_draw_string(x, y, marker->name);
        }
 }
 
diff --git a/source/blender/editors/animation/drivers.c 
b/source/blender/editors/animation/drivers.c
index 296a52e..7bdc49d 100644
--- a/source/blender/editors/animation/drivers.c
+++ b/source/blender/editors/animation/drivers.c
@@ -437,7 +437,7 @@ static int add_driver_button_exec(bContext *C, wmOperator 
*op)
        const bool all = RNA_boolean_get(op->ptr, "all");
        
        /* try to create driver using property retrieved from UI */
-       uiContextActiveProperty(C, &ptr, &prop, &index);
+       UI_context_active_but_prop_get(C, &ptr, &prop, &index);
        
        if (all)
                index = -1;
@@ -455,7 +455,7 @@ static int add_driver_button_exec(bContext *C, wmOperator 
*op)
        
        if (success) {
                /* send updates */
-               uiContextAnimUpdate(C);
+               UI_context_update_anim_flag(C);
                
                WM_event_add_notifier(C, NC_ANIMATION | ND_FCURVES_ORDER, 
NULL); // XXX
        }
@@ -492,7 +492,7 @@ static int remove_driver_button_exec(bContext *C, 
wmOperator *op)
        const bool all = RNA_boolean_get(op->ptr, "all");
        
        /* try to find driver using property retrieved from UI */
-       u

@@ 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