diff options
Diffstat (limited to 'source/blender/editors/space_view3d/view3d_toolbar.c')
-rw-r--r-- | source/blender/editors/space_view3d/view3d_toolbar.c | 34 |
1 files changed, 17 insertions, 17 deletions
diff --git a/source/blender/editors/space_view3d/view3d_toolbar.c b/source/blender/editors/space_view3d/view3d_toolbar.c index fa683f95988..8ea33927c4d 100644 --- a/source/blender/editors/space_view3d/view3d_toolbar.c +++ b/source/blender/editors/space_view3d/view3d_toolbar.c @@ -73,15 +73,15 @@ typedef struct CustomTool { static void operator_call_cb(struct bContext *C, void *arg_listbase, void *arg2) { wmOperatorType *ot = arg2; - + if (ot) { CustomTool *ct = MEM_callocN(sizeof(CustomTool), "CustomTool"); - + BLI_addtail(arg_listbase, ct); BLI_strncpy(ct->opname, ot->idname, OP_MAX_TYPENAME); BLI_strncpy(ct->context, CTX_data_mode_string(C), OP_MAX_TYPENAME); } - + } static void operator_search_cb(const struct bContext *C, void *UNUSED(arg), const char *str, uiSearchItems *items) @@ -93,7 +93,7 @@ static void operator_search_cb(const struct bContext *C, void *UNUSED(arg), cons if (BLI_strcasestr(ot->name, str)) { if (WM_operator_poll((bContext *)C, ot)) { - + if (false == UI_search_item_add(items, ot->name, ot, 0)) break; } @@ -110,30 +110,30 @@ static uiBlock *tool_search_menu(bContext *C, ARegion *ar, void *arg_listbase) wmWindow *win = CTX_wm_window(C); uiBlock *block; uiBut *but; - + /* clear initial search string, then all items show */ search[0] = 0; - + block = UI_block_begin(C, ar, "_popup", UI_EMBOSS); UI_block_flag_enable(block, UI_BLOCK_LOOP | UI_BLOCK_SEARCH_MENU); - + /* fake button, it holds space for search items */ uiDefBut(block, UI_BTYPE_LABEL, 0, "", 10, 15, UI_searchbox_size_x(), UI_searchbox_size_y(), NULL, 0, 0, 0, 0, NULL); - + but = uiDefSearchBut(block, search, 0, ICON_VIEWZOOM, sizeof(search), 10, 0, 150, 19, 0, 0, ""); UI_but_func_search_set(but, NULL, operator_search_cb, arg_listbase, operator_call_cb, NULL); - + UI_block_bounds_set_normal(block, 6); UI_block_direction_set(block, UI_DIR_DOWN); UI_block_end(C, block); - + wm_event_init_from_window(win, &event); event.type = EVT_BUT_OPEN; event.val = KM_PRESS; event.customdata = but; event.customdatafree = false; wm_event_add(win, &event); - + return block; } @@ -144,13 +144,13 @@ static void view3d_panel_tool_shelf(const bContext *C, Panel *pa) SpaceType *st = NULL; uiLayout *col; const char *context = CTX_data_mode_string(C); - + if (sl) st = BKE_spacetype_from_id(sl->spacetype); - + if (st && st->toolshelf.first) { CustomTool *ct; - + for (ct = st->toolshelf.first; ct; ct = ct->next) { if (STREQLEN(context, ct->context, OP_MAX_TYPENAME)) { col = uiLayoutColumn(pa->layout, true); @@ -181,7 +181,7 @@ static int view3d_toolshelf_toggle_exec(bContext *C, wmOperator *UNUSED(op)) { ScrArea *sa = CTX_wm_area(C); ARegion *ar = view3d_has_tools_region(sa); - + if (ar) ED_region_toggle_hidden(C, ar); @@ -193,10 +193,10 @@ void VIEW3D_OT_toolshelf(wmOperatorType *ot) ot->name = "Tool Shelf"; ot->description = "Toggles tool shelf display"; ot->idname = "VIEW3D_OT_toolshelf"; - + ot->exec = view3d_toolshelf_toggle_exec; ot->poll = ED_operator_view3d_active; - + /* flags */ ot->flag = 0; } |