~ubuntu-branches/ubuntu/trusty/blender/trusty

« back to all changes in this revision

Viewing changes to source/blender/editors/space_view3d/view3d_toolbar.c

  • Committer: Package Import Robot
  • Author(s): Jeremy Bicha
  • Date: 2013-03-06 12:08:47 UTC
  • mfrom: (1.5.1) (14.1.8 experimental)
  • Revision ID: package-import@ubuntu.com-20130306120847-frjfaryb2zrotwcg
Tags: 2.66a-1ubuntu1
* Resynchronize with Debian (LP: #1076930, #1089256, #1052743, #999024,
  #1122888, #1147084)
* debian/control:
  - Lower build-depends on libavcodec-dev since we're not
    doing the libav9 transition in Ubuntu yet

Show diffs side-by-side

added added

removed removed

Lines of Context:
64
64
#include "UI_interface.h"
65
65
#include "UI_resources.h"
66
66
 
67
 
#include "view3d_intern.h"  // own include
 
67
#include "view3d_intern.h"  /* own include */
68
68
 
69
69
 
70
70
/* ******************* view3d space & buttons ************** */
78
78
{
79
79
        wmOperator *op = WM_operator_last_redo(C);
80
80
 
81
 
        if (op) BLI_strncpy(pa->drawname, op->type->name, sizeof(pa->drawname));
82
 
        else BLI_strncpy(pa->drawname, IFACE_("Operator"), sizeof(pa->drawname));
 
81
        if (op)
 
82
                BLI_strncpy(pa->drawname, RNA_struct_ui_name(op->type->srna), sizeof(pa->drawname));
 
83
        else
 
84
                BLI_strncpy(pa->drawname, IFACE_("Operator"), sizeof(pa->drawname));
83
85
}
84
86
 
85
87
static void view3d_panel_operator_redo_operator(const bContext *C, Panel *pa, wmOperator *op)
86
88
{
87
89
        if (op->type->flag & OPTYPE_MACRO) {
88
90
                for (op = op->macro.first; op; op = op->next) {
89
 
                        uiItemL(pa->layout, op->type->name, ICON_NONE);
 
91
                        uiItemL(pa->layout, RNA_struct_ui_name(op->type->srna), ICON_NONE);
90
92
                        view3d_panel_operator_redo_operator(C, pa, op);
91
93
                }
92
94
        }
99
101
static void view3d_panel_operator_redo(const bContext *C, Panel *pa)
100
102
{
101
103
        wmOperator *op = WM_operator_last_redo(C);
102
 
        uiBlock *block;
103
 
        
104
 
        if (op == NULL)
105
 
                return;
106
 
        if (WM_operator_poll((bContext *)C, op->type) == 0)
107
 
                return;
108
 
        
109
 
        block = uiLayoutGetBlock(pa->layout);
110
 
        
111
 
        if (!WM_operator_check_ui_enabled(C, op->type->name))
112
 
                uiLayoutSetEnabled(pa->layout, 0);
113
 
 
114
 
        /* note, blockfunc is a default but->func, use Handle func to allow button callbacks too */
115
 
        uiBlockSetHandleFunc(block, ED_undo_operator_repeat_cb_evt, op);
116
 
        
117
 
        view3d_panel_operator_redo_operator(C, pa, op);
 
104
        ARegion *ar;
 
105
        ARegion *ar1;
 
106
 
 
107
        if (op == NULL) {
 
108
                return;
 
109
        }
 
110
 
 
111
        /* keep in sync with logic in ED_undo_operator_repeat() */
 
112
        ar = CTX_wm_region(C);
 
113
        ar1 = BKE_area_find_region_active_win(CTX_wm_area(C));
 
114
        if (ar1)
 
115
                CTX_wm_region_set((bContext *)C, ar1);
 
116
 
 
117
        if (WM_operator_poll((bContext *)C, op->type)) {
 
118
                uiBlock *block = uiLayoutGetBlock(pa->layout);
 
119
 
 
120
                if (!WM_operator_check_ui_enabled(C, op->type->name))
 
121
                        uiLayoutSetEnabled(pa->layout, FALSE);
 
122
 
 
123
                /* note, blockfunc is a default but->func, use Handle func to allow button callbacks too */
 
124
                uiBlockSetHandleFunc(block, ED_undo_operator_repeat_cb_evt, op);
 
125
 
 
126
                view3d_panel_operator_redo_operator(C, pa, op);
 
127
        }
 
128
 
 
129
        /* set region back */
 
130
        CTX_wm_region_set((bContext *)C, ar);
118
131
}
119
132
 
120
133
/* ******************* */
171
184
        search[0] = 0;
172
185
        
173
186
        block = uiBeginBlock(C, ar, "_popup", UI_EMBOSS);
174
 
        uiBlockSetFlag(block, UI_BLOCK_LOOP | UI_BLOCK_REDRAW | UI_BLOCK_RET_1);
 
187
        uiBlockSetFlag(block, UI_BLOCK_LOOP | UI_BLOCK_REDRAW | UI_BLOCK_SEARCH_MENU);
175
188
        
176
189
        /* fake button, it holds space for search items */
177
 
        uiDefBut(block, LABEL, 0, "", 10, 15, 150, uiSearchBoxhHeight(), NULL, 0, 0, 0, 0, NULL);
 
190
        uiDefBut(block, LABEL, 0, "", 10, 15, uiSearchBoxWidth(), uiSearchBoxHeight(), NULL, 0, 0, 0, 0, NULL);
178
191
        
179
192
        but = uiDefSearchBut(block, search, 0, ICON_VIEWZOOM, sizeof(search), 10, 0, 150, 19, 0, 0, "");
180
193
        uiButSetSearchFunc(but, operator_search_cb, arg_listbase, operator_call_cb, NULL);
181
194
        
182
195
        uiBoundsBlock(block, 6);
183
 
        uiBlockSetDirection(block, UI_DOWN);    
 
196
        uiBlockSetDirection(block, UI_DOWN);
184
197
        uiEndBlock(C, block);
185
198
        
186
199
        event = *(win->eventstate);  /* XXX huh huh? make api call */
209
222
                
210
223
                for (ct = st->toolshelf.first; ct; ct = ct->next) {
211
224
                        if (0 == strncmp(context, ct->context, OP_MAX_TYPENAME)) {
212
 
                                col = uiLayoutColumn(pa->layout, 1);
 
225
                                col = uiLayoutColumn(pa->layout, TRUE);
213
226
                                uiItemFullO(col, ct->opname, NULL, ICON_NONE, NULL, WM_OP_INVOKE_REGION_WIN, 0);
214
227
                        }
215
228
                }
216
229
        }
217
 
        col = uiLayoutColumn(pa->layout, 1);
 
230
        col = uiLayoutColumn(pa->layout, TRUE);
218
231
        uiDefBlockBut(uiLayoutGetBlock(pa->layout), tool_search_menu, &st->toolshelf, "Add Tool", 0, 0, UI_UNIT_X, UI_UNIT_Y, "Add Tool in shelf, gets saved in files");
219
232
}
220
233