Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/util/undo.c
| Show First 20 Lines • Show All 530 Lines • ▼ Show 20 Lines | static int undo_history_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(event)) | ||||
| int undosys, totitem = 0; | int undosys, totitem = 0; | ||||
| undosys = get_undo_system(C); | undosys = get_undo_system(C); | ||||
| if (undosys) { | if (undosys) { | ||||
| EnumPropertyItem *item = rna_undo_itemf(C, undosys, &totitem); | EnumPropertyItem *item = rna_undo_itemf(C, undosys, &totitem); | ||||
| if (totitem > 0) { | if (totitem > 0) { | ||||
| uiPopupMenu *pup = uiPupMenuBegin(C, RNA_struct_ui_name(op->type->srna), ICON_NONE); | uiPopupMenu *pup = UI_popup_menu_begin(C, RNA_struct_ui_name(op->type->srna), ICON_NONE); | ||||
| uiLayout *layout = uiPupMenuLayout(pup); | uiLayout *layout = UI_popup_menu_layout(pup); | ||||
| uiLayout *split = uiLayoutSplit(layout, 0.0f, false); | uiLayout *split = uiLayoutSplit(layout, 0.0f, false); | ||||
| uiLayout *column = NULL; | uiLayout *column = NULL; | ||||
| const int col_size = 20 + totitem / 12; | const int col_size = 20 + totitem / 12; | ||||
| int i, c; | int i, c; | ||||
| bool add_col = true; | bool add_col = true; | ||||
| for (c = 0, i = totitem; i--;) { | for (c = 0, i = totitem; i--;) { | ||||
| if (add_col && !(c % col_size)) { | if (add_col && !(c % col_size)) { | ||||
| column = uiLayoutColumn(split, false); | column = uiLayoutColumn(split, false); | ||||
| add_col = false; | add_col = false; | ||||
| } | } | ||||
| if (item[i].identifier) { | if (item[i].identifier) { | ||||
| uiItemIntO(column, item[i].name, item[i].icon, op->type->idname, "item", item[i].value); | uiItemIntO(column, item[i].name, item[i].icon, op->type->idname, "item", item[i].value); | ||||
| ++c; | ++c; | ||||
| add_col = true; | add_col = true; | ||||
| } | } | ||||
| } | } | ||||
| MEM_freeN(item); | MEM_freeN(item); | ||||
| uiPupMenuEnd(C, pup); | UI_popup_menu_end(C, pup); | ||||
| } | } | ||||
| } | } | ||||
| return OPERATOR_CANCELLED; | return OPERATOR_CANCELLED; | ||||
| } | } | ||||
| /* note: also check ed_undo_step() in top if you change notifiers */ | /* note: also check ed_undo_step() in top if you change notifiers */ | ||||
| static int undo_history_exec(bContext *C, wmOperator *op) | static int undo_history_exec(bContext *C, wmOperator *op) | ||||
| ▲ Show 20 Lines • Show All 44 Lines • Show Last 20 Lines | |||||