Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/interface/interface_templates.c
| Show First 20 Lines • Show All 424 Lines • ▼ Show 20 Lines | static void template_ID( | ||||
| if (idptr.type) | if (idptr.type) | ||||
| type = idptr.type; | type = idptr.type; | ||||
| if (flag & UI_ID_PREVIEWS) { | if (flag & UI_ID_PREVIEWS) { | ||||
| template->preview = true; | template->preview = true; | ||||
| but = uiDefBlockButN(block, id_search_menu, MEM_dupallocN(template), "", 0, 0, UI_UNIT_X * 6, UI_UNIT_Y * 6, | but = uiDefBlockButN(block, id_search_menu, MEM_dupallocN(template), "", 0, 0, UI_UNIT_X * 6, UI_UNIT_Y * 6, | ||||
| TIP_(template_id_browse_tip(type))); | TIP_(template_id_browse_tip(type))); | ||||
| but->icon = id ? ui_id_icon_get(C, id, true) : RNA_struct_ui_icon(type); | ui_def_but_icon(but, id ? ui_id_icon_get(C, id, true) : RNA_struct_ui_icon(type), | ||||
| UI_but_flag_enable(but, UI_HAS_ICON | UI_BUT_ICON_PREVIEW); | UI_HAS_ICON | UI_BUT_ICON_PREVIEW); | ||||
| 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); | ||||
| uiLayoutRow(layout, true); | uiLayoutRow(layout, true); | ||||
| } | } | ||||
| else if (flag & UI_ID_BROWSE) { | else if (flag & UI_ID_BROWSE) { | ||||
| 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))); | ||||
| but->icon = RNA_struct_ui_icon(type); | ui_def_but_icon(but, RNA_struct_ui_icon(type), UI_HAS_ICON); | ||||
| /* default dragging of icon for id browse buttons */ | /* default dragging of icon for id browse buttons */ | ||||
| UI_but_drag_set_id(but, id); | UI_but_drag_set_id(but, id); | ||||
| UI_but_flag_enable(but, UI_HAS_ICON); | |||||
| UI_but_drawflag_enable(but, UI_BUT_ICON_LEFT); | UI_but_drawflag_enable(but, UI_BUT_ICON_LEFT); | ||||
| 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); | ||||
| } | } | ||||
| /* text button with name */ | /* text button with name */ | ||||
| if (id) { | if (id) { | ||||
| ▲ Show 20 Lines • Show All 1,205 Lines • ▼ Show 20 Lines | for (a = 0; item[a].identifier; a++) { | ||||
| int x, y; | int x, y; | ||||
| /* XXX hardcoded size to 5 x unit */ | /* XXX hardcoded size to 5 x unit */ | ||||
| x = (a % 8) * UI_UNIT_X * 5; | x = (a % 8) * UI_UNIT_X * 5; | ||||
| y = (a / 8) * UI_UNIT_X * 5; | y = (a / 8) * UI_UNIT_X * 5; | ||||
| icon = item[a].icon; | icon = item[a].icon; | ||||
| value = item[a].value; | value = item[a].value; | ||||
| but = uiDefIconButR_prop(block, UI_BTYPE_ROW, 0, icon, x, y, UI_UNIT_X * 5, UI_UNIT_Y * 5, | but = uiDefIconButR_prop(block, UI_BTYPE_ROW, 0, ICON_NONE, x, y, UI_UNIT_X * 5, UI_UNIT_Y * 5, | ||||
| &cb.ptr, cb.prop, -1, 0, value, -1, -1, NULL); | &cb.ptr, cb.prop, -1, 0, value, -1, -1, NULL); | ||||
| UI_but_flag_enable(but, UI_HAS_ICON | UI_BUT_ICON_PREVIEW); | ui_def_but_icon(but, icon, UI_HAS_ICON | UI_BUT_ICON_PREVIEW); | ||||
| } | } | ||||
| UI_block_bounds_set_normal(block, 0.3f * U.widget_unit); | UI_block_bounds_set_normal(block, 0.3f * U.widget_unit); | ||||
| UI_block_direction_set(block, UI_DIR_DOWN); | UI_block_direction_set(block, UI_DIR_DOWN); | ||||
| if (free) { | if (free) { | ||||
| MEM_freeN(item); | MEM_freeN(item); | ||||
| } | } | ||||
| Show All 23 Lines | void uiTemplateIconView(uiLayout *layout, PointerRNA *ptr, const char *propname) | ||||
| RNA_enum_icon_from_value(items, value, &icon); | RNA_enum_icon_from_value(items, value, &icon); | ||||
| cb = MEM_callocN(sizeof(RNAUpdateCb), "RNAUpdateCb"); | cb = MEM_callocN(sizeof(RNAUpdateCb), "RNAUpdateCb"); | ||||
| cb->ptr = *ptr; | cb->ptr = *ptr; | ||||
| cb->prop = prop; | cb->prop = prop; | ||||
| but = uiDefBlockButN(block, ui_icon_view_menu_cb, cb, "", 0, 0, UI_UNIT_X * 6, UI_UNIT_Y * 6, ""); | but = uiDefBlockButN(block, ui_icon_view_menu_cb, cb, "", 0, 0, UI_UNIT_X * 6, UI_UNIT_Y * 6, ""); | ||||
| but->icon = icon; | ui_def_but_icon(but, icon, UI_HAS_ICON | UI_BUT_ICON_PREVIEW); | ||||
| UI_but_flag_enable(but, UI_HAS_ICON | UI_BUT_ICON_PREVIEW); | |||||
| if (free_items) { | if (free_items) { | ||||
| MEM_freeN(items); | MEM_freeN(items); | ||||
| } | } | ||||
| } | } | ||||
| /********************* Histogram Template ************************/ | /********************* Histogram Template ************************/ | ||||
| ▲ Show 20 Lines • Show All 1,995 Lines • Show Last 20 Lines | |||||