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:
authorTon Roosendaal <ton@blender.org>2011-06-04 21:03:46 +0400
committerTon Roosendaal <ton@blender.org>2011-06-04 21:03:46 +0400
commit88676349a473020937ba5f2637535bf5960059c9 (patch)
treecb02be5fea2f127b284430508fcab3de959c37d7 /source/blender/editors/util/editmode_undo.c
parent4a59928484b93a6c3876c0c8b065f6d313640804 (diff)
Code holiday commit:
- fix: user pref, window title was reset to 'Blender' on tab usage - Undo history menu back: - name "Undo History" - hotkey alt+ctrl+z (alt+apple+z for mac) - works like 2.4x, only for global undo, editmode and particle edit. - Menu scroll - for small windows or screens, popup menus now allow to display all items, using internal scrolling - works with a timer, scrolling 10 items per second when mouse is over the top or bottom arrow - if menu is too big to display, it now draws to top or bottom, based on largest available space. - also works for hotkey driven pop up menus. - User pref "DPI" follows widget/layout size - widgets & headers now become bigger and smaller, to match 'dpi' font sizes. Works well to match UI to monitor size. - note that icons can get fuzzy, we need better mipmaps for it
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 732e5087af2..bcbc134d06d 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;