64
64
#include "UI_interface.h"
65
65
#include "UI_resources.h"
67
#include "view3d_intern.h" // own include
67
#include "view3d_intern.h" /* own include */
70
70
/* ******************* view3d space & buttons ************** */
79
79
wmOperator *op = WM_operator_last_redo(C);
81
if (op) BLI_strncpy(pa->drawname, op->type->name, sizeof(pa->drawname));
82
else BLI_strncpy(pa->drawname, IFACE_("Operator"), sizeof(pa->drawname));
82
BLI_strncpy(pa->drawname, RNA_struct_ui_name(op->type->srna), sizeof(pa->drawname));
84
BLI_strncpy(pa->drawname, IFACE_("Operator"), sizeof(pa->drawname));
85
87
static void view3d_panel_operator_redo_operator(const bContext *C, Panel *pa, wmOperator *op)
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);
99
101
static void view3d_panel_operator_redo(const bContext *C, Panel *pa)
101
103
wmOperator *op = WM_operator_last_redo(C);
106
if (WM_operator_poll((bContext *)C, op->type) == 0)
109
block = uiLayoutGetBlock(pa->layout);
111
if (!WM_operator_check_ui_enabled(C, op->type->name))
112
uiLayoutSetEnabled(pa->layout, 0);
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);
117
view3d_panel_operator_redo_operator(C, pa, op);
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));
115
CTX_wm_region_set((bContext *)C, ar1);
117
if (WM_operator_poll((bContext *)C, op->type)) {
118
uiBlock *block = uiLayoutGetBlock(pa->layout);
120
if (!WM_operator_check_ui_enabled(C, op->type->name))
121
uiLayoutSetEnabled(pa->layout, FALSE);
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);
126
view3d_panel_operator_redo_operator(C, pa, op);
129
/* set region back */
130
CTX_wm_region_set((bContext *)C, ar);
120
133
/* ******************* */
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);
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);
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);
182
195
uiBoundsBlock(block, 6);
183
uiBlockSetDirection(block, UI_DOWN);
196
uiBlockSetDirection(block, UI_DOWN);
184
197
uiEndBlock(C, block);
186
199
event = *(win->eventstate); /* XXX huh huh? make api call */
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);
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");