Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/interface/interface_templates.c
| Context not available. | |||||
| } | } | ||||
| #endif | #endif | ||||
| /* enables an ugly alternative ID template drawing to test UI_BTYPE_TAB */ | |||||
| #define USE_UGLY_TAB_TESTING | |||||
| static void template_ID( | static void template_ID( | ||||
| bContext *C, uiLayout *layout, TemplateID *template, StructRNA *type, short idcode, int flag, | bContext *C, uiLayout *layout, TemplateID *template, StructRNA *type, short idcode, int flag, | ||||
| const char *newop, const char *openop, const char *unlinkop) | const char *newop, const char *openop, const char *unlinkop) | ||||
| Context not available. | |||||
| uiLayoutRow(layout, true); | uiLayoutRow(layout, true); | ||||
| } | } | ||||
| else if (flag & UI_ID_BROWSE) { | else if (flag & UI_ID_BROWSE) { | ||||
| #ifdef USE_UGLY_TAB_TESTING | |||||
| UI_block_align_begin(block); | |||||
| for (ID *id_iter = template->idlb->first; id_iter; id_iter = id_iter->next) { | |||||
| float width = BLF_width_default(id_iter->name + 2, strlen(id_iter->name + 2)); | |||||
| but = uiDefButR(block, UI_BTYPE_TAB, 0, id_iter->name + 2, 0, 0, width + UI_UNIT_X, UI_UNIT_Y, &idptr, "name", 0, 0.0f, 0.0f, 0.0f, 0.0f, ""); | |||||
| UI_but_funcN_set(but, id_search_call_cb, MEM_dupallocN(template), id_iter); | |||||
| if (id == id_iter) { | |||||
| but->flag |= UI_ACTIVE; | |||||
| } | |||||
| } | |||||
| UI_block_align_end(block); | |||||
| #else | |||||
| but = uiDefBlockButN(block, id_search_menu, MEM_dupallocN(template), "", 0, 0, UI_UNIT_X * 1.6, UI_UNIT_Y, | but = uiDefBlockButN(block, id_search_menu, MEM_dupallocN(template), "", 0, 0, UI_UNIT_X * 1.6, UI_UNIT_Y, | ||||
| TIP_(template_id_browse_tip(type))); | TIP_(template_id_browse_tip(type))); | ||||
| ui_def_but_icon(but, RNA_struct_ui_icon(type), UI_HAS_ICON); | ui_def_but_icon(but, RNA_struct_ui_icon(type), UI_HAS_ICON); | ||||
| Context not available. | |||||
| if ((idfrom && idfrom->lib) || !editable) | if ((idfrom && idfrom->lib) || !editable) | ||||
| UI_but_flag_enable(but, UI_BUT_DISABLED); | UI_but_flag_enable(but, UI_BUT_DISABLED); | ||||
| #endif | |||||
| } | } | ||||
| #ifndef USE_UGLY_TAB_TESTING | |||||
| /* text button with name */ | /* text button with name */ | ||||
| if (id) { | if (id) { | ||||
| char name[UI_MAX_NAME_STR]; | char name[UI_MAX_NAME_STR]; | ||||
| Context not available. | |||||
| uiDefButR(block, UI_BTYPE_TOGGLE, 0, "F", 0, 0, UI_UNIT_X, UI_UNIT_Y, &idptr, "use_fake_user", -1, 0, 0, -1, -1, NULL); | uiDefButR(block, UI_BTYPE_TOGGLE, 0, "F", 0, 0, UI_UNIT_X, UI_UNIT_Y, &idptr, "use_fake_user", -1, 0, 0, -1, -1, NULL); | ||||
| } | } | ||||
| } | } | ||||
| #endif | |||||
| if (flag & UI_ID_ADD_NEW) { | if (flag & UI_ID_ADD_NEW) { | ||||
| int w = id ? UI_UNIT_X : (flag & UI_ID_OPEN) ? UI_UNIT_X * 3 : UI_UNIT_X * 6; | int w = id ? UI_UNIT_X : (flag & UI_ID_OPEN) ? UI_UNIT_X * 3 : UI_UNIT_X * 6; | ||||
| Context not available. | |||||