Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2011-06-09 19:20:29 +0400
committerCampbell Barton <ideasman42@gmail.com>2011-06-09 19:20:29 +0400
commitf122a74b1e778bc902fa57f0689ac89c1dacbcef (patch)
tree7138ce2ab1fba31d94fc393534ce3bcc9aefc389 /source/blender/editors/util/editmode_undo.c
parent522f9111a56268f2155c93d562abad86c1883332 (diff)
parentd4ae38cc6c4ec8e3d13f26d12f85bca561f64f0f (diff)
svn merge -r37078:37335 https://svn.blender.org/svnroot/bf-blender/trunk/blender
Diffstat (limited to 'source/blender/editors/util/editmode_undo.c')
-rw-r--r--source/blender/editors/util/editmode_undo.c66
1 files changed, 14 insertions, 52 deletions
diff --git a/source/blender/editors/util/editmode_undo.c b/source/blender/editors/util/editmode_undo.c
index 6f4bbff8a0b..f2ab43c281b 100644
--- a/source/blender/editors/util/editmode_undo.c
+++ b/source/blender/editors/util/editmode_undo.c
@@ -296,7 +296,7 @@ void undo_editmode_clear(void)
}
/* based on index nr it does a restore */
-static void undo_number(bContext *C, int nr)
+void undo_editmode_number(bContext *C, int nr)
{
UndoElem *uel;
int a=1;
@@ -337,66 +337,28 @@ int undo_editmode_valid(const char *undoname)
return undobase.last != undobase.first;
}
-/* ************** for interaction with menu/pullown */
-void undo_editmode_menu(bContext *C)
+/* get name of undo item, return null if no item with this index */
+/* if active pointer, set it to 1 if true */
+char *undo_editmode_get_name(bContext *C, int nr, int *active)
{
UndoElem *uel;
- DynStr *ds= BLI_dynstr_new();
- short event= 0;
- char *menu;
-
- undo_clean_stack(C); // removes other objects from it
-
- BLI_dynstr_append(ds, "Editmode Undo History %t");
-
- for(uel= undobase.first; uel; uel= uel->next) {
- BLI_dynstr_append(ds, "|");
- BLI_dynstr_append(ds, uel->name);
- }
-
- menu= BLI_dynstr_get_cstring(ds);
- BLI_dynstr_free(ds);
-
-// XXX event= pupmenu_col(menu, 20);
- MEM_freeN(menu);
- if(event>0) undo_number(C, event);
-}
-
-static void do_editmode_undohistorymenu(bContext *C, void *UNUSED(arg), int event)
-{
- Object *obedit= CTX_data_edit_object(C);
-
- if(obedit==NULL || event<1) return;
-
- undo_number(C, event-1);
+ /* prevent wrong numbers to be returned */
+ undo_clean_stack(C);
-}
-
-uiBlock *editmode_undohistorymenu(bContext *C, ARegion *ar, void *UNUSED(arg))
-{
- uiBlock *block;
- UndoElem *uel;
- short yco = 20, menuwidth = 120;
- short item= 1;
+ if(active) *active= 0;
- undo_clean_stack(C); // removes other objects from it
-
- block= uiBeginBlock(C, ar, "view3d_edit_mesh_undohistorymenu", UI_EMBOSSP);
- uiBlockSetButmFunc(block, do_editmode_undohistorymenu, NULL);
-
- for(uel= undobase.first; uel; uel= uel->next, item++) {
- if (uel==curundo) uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, uel->name, 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, (float)item, "");
- if (uel==curundo) uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
+ uel= BLI_findlink(&undobase, nr);
+ if(uel) {
+ if(active && uel==curundo)
+ *active= 1;
+ return uel->name;
}
-
- uiBlockSetDirection(block, UI_RIGHT);
- uiTextBoundsBlock(block, 60);
- return block;
+ return NULL;
}
+
void *undo_editmode_get_prev(Object *ob)
{
UndoElem *ue= undobase.last;