337
337
return undobase.last != undobase.first;
340
/* ************** for interaction with menu/pullown */
342
void undo_editmode_menu(bContext *C)
345
DynStr *ds= BLI_dynstr_new();
349
undo_clean_stack(C); // removes other objects from it
351
BLI_dynstr_append(ds, "Editmode Undo History %t");
353
for(uel= undobase.first; uel; uel= uel->next) {
354
BLI_dynstr_append(ds, "|");
355
BLI_dynstr_append(ds, uel->name);
358
menu= BLI_dynstr_get_cstring(ds);
361
// XXX event= pupmenu_col(menu, 20);
364
if(event>0) undo_number(C, event);
367
static void do_editmode_undohistorymenu(bContext *C, void *UNUSED(arg), int event)
369
Object *obedit= CTX_data_edit_object(C);
371
if(obedit==NULL || event<1) return;
373
undo_number(C, event-1);
377
uiBlock *editmode_undohistorymenu(bContext *C, ARegion *ar, void *UNUSED(arg))
381
short yco = 20, menuwidth = 120;
384
undo_clean_stack(C); // removes other objects from it
386
block= uiBeginBlock(C, ar, "view3d_edit_mesh_undohistorymenu", UI_EMBOSSP);
387
uiBlockSetButmFunc(block, do_editmode_undohistorymenu, NULL);
389
for(uel= undobase.first; uel; uel= uel->next, item++) {
390
if (uel==curundo) uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
391
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, uel->name, 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, (float)item, "");
392
if (uel==curundo) uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
395
uiBlockSetDirection(block, UI_RIGHT);
396
uiTextBoundsBlock(block, 60);
341
/* get name of undo item, return null if no item with this index */
342
/* if active pointer, set it to 1 if true */
343
char *undo_editmode_get_name(bContext *C, int nr, int *active)
347
/* prevent wrong numbers to be returned */
350
if(active) *active= 0;
352
uel= BLI_findlink(&undobase, nr);
354
if(active && uel==curundo)
400
362
void *undo_editmode_get_prev(Object *ob)