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:
authorBrecht Van Lommel <brechtvanlommel@pandora.be>2009-02-04 14:52:16 +0300
committerBrecht Van Lommel <brechtvanlommel@pandora.be>2009-02-04 14:52:16 +0300
commitdf7e7660325611847721768fb7d082e7d5f2736c (patch)
treea13434a5824a3f55c46f6d876275f864647c0f95 /source/blender/windowmanager
parent0341e762b28f732dd2913ebec48405f7718a4617 (diff)
UI
* Changed uiPupMenuOperator usage to uiPupMenuBegin/End (simpler, no need to build a string). Also made transform orientation and subdiv type enums instead of ints for this. * Added an icon argument to many of the uiMenu calls, and added a uiMenuItemIntO. * Move auto rna button creation out of outliner code, now is uiDefAutoButR for individual buttons and uiDefAutoButsRNA for a whole block. * Implemented uiPupBlock(O). Pressing F6 gives a menu with the properties of the last operator to test. I tried to make a redo last operator out of this but couldn't get the context correct for the operator to repeat in. Further the popup block also has some issues getting closed while editing buttons. * Fix uiAfterFunc memory leak on Ctrl+Q quit. * Fix handling of RNA number button dragging and sliding for RNA buttons with range -inf/inf.
Diffstat (limited to 'source/blender/windowmanager')
-rw-r--r--source/blender/windowmanager/intern/wm_operators.c74
1 files changed, 27 insertions, 47 deletions
diff --git a/source/blender/windowmanager/intern/wm_operators.c b/source/blender/windowmanager/intern/wm_operators.c
index 5c286e06324..f5e9520c702 100644
--- a/source/blender/windowmanager/intern/wm_operators.c
+++ b/source/blender/windowmanager/intern/wm_operators.c
@@ -201,9 +201,7 @@ void WM_operator_properties_free(PointerRNA *ptr)
int WM_menu_invoke(bContext *C, wmOperator *op, wmEvent *event)
{
PropertyRNA *prop= RNA_struct_find_property(op->ptr, "type");
- const EnumPropertyItem *item;
- int totitem, i, len= strlen(op->type->name) + 8;
- char *menu, *p;
+ uiMenuItem *head;
if(prop==NULL) {
printf("WM_menu_invoke: %s has no \"type\" enum property\n", op->type->idname);
@@ -212,34 +210,24 @@ int WM_menu_invoke(bContext *C, wmOperator *op, wmEvent *event)
printf("WM_menu_invoke: %s \"type\" is not an enum property\n", op->type->idname);
}
else {
- RNA_property_enum_items(op->ptr, prop, &item, &totitem);
-
- for (i=0; i<totitem; i++)
- len+= strlen(item[i].name) + 8;
-
- menu= MEM_callocN(len, "string");
-
- p= menu + sprintf(menu, "%s %%t", op->type->name);
- for (i=0; i<totitem; i++)
- p+= sprintf(p, "|%s %%x%d", item[i].name, item[i].value);
-
- uiPupMenuOperator(C, totitem/30, op, "type", menu);
- MEM_freeN(menu);
-
- return OPERATOR_RUNNING_MODAL;
+ head= uiPupMenuBegin(op->type->name, 0);
+ uiMenuItemsEnumO(head, op->type->idname, "type");
+ uiPupMenuEnd(C, head);
}
+
return OPERATOR_CANCELLED;
}
/* op->invoke */
int WM_operator_confirm(bContext *C, wmOperator *op, wmEvent *event)
{
- char buf[512];
-
- sprintf(buf, "OK? %%i%d%%t|%s", ICON_HELP, op->type->name);
- uiPupMenuOperator(C, 0, op, NULL, buf);
+ uiMenuItem *head;
+
+ head= uiPupMenuBegin("OK?", ICON_HELP);
+ uiMenuItemO(head, 0, op->type->idname);
+ uiPupMenuEnd(C, head);
- return OPERATOR_RUNNING_MODAL;
+ return OPERATOR_CANCELLED;
}
/* op->invoke, opens fileselect if filename property not set, otherwise executes */
@@ -293,26 +281,6 @@ static void WM_OT_save_homefile(wmOperatorType *ot)
/* ********* recent file *********** */
-static void recent_filelist(char *pup)
-{
- struct RecentFile *recent;
- int i, ofs= 0;
- char *p;
-
- p= pup + sprintf(pup, "Open Recent%%t");
-
- if (G.sce[0]) {
- p+= sprintf(p, "|%s %%x%d", G.sce, 1);
- ofs = 1;
- }
-
- for (recent = G.recent_files.first, i=0; (i<U.recent_files) && (recent); recent = recent->next, i++) {
- if (strcmp(recent->filename, G.sce)) {
- p+= sprintf(p, "|%s %%x%d", recent->filename, i+ofs+1);
- }
- }
-}
-
static int recentfile_exec(bContext *C, wmOperator *op)
{
int event= RNA_enum_get(op->ptr, "nr");
@@ -338,12 +306,24 @@ static int recentfile_exec(bContext *C, wmOperator *op)
static int wm_recentfile_invoke(bContext *C, wmOperator *op, wmEvent *event)
{
- char pup[2048];
+ struct RecentFile *recent;
+ uiMenuItem *head;
+ int i, ofs= 0;
+
+ head= uiPupMenuBegin("Open Recent", 0);
+
+ if(G.sce[0]) {
+ uiMenuItemIntO(head, G.sce, 0, op->type->idname, "nr", 1);
+ ofs = 1;
+ }
- recent_filelist(pup);
- uiPupMenuOperator(C, 0, op, "nr", pup);
+ for(recent = G.recent_files.first, i=0; (i<U.recent_files) && (recent); recent = recent->next, i++)
+ if(strcmp(recent->filename, G.sce))
+ uiMenuItemIntO(head, recent->filename, 0, op->type->idname, "nr", i+ofs+1);
+
+ uiPupMenuEnd(C, head);
- return OPERATOR_RUNNING_MODAL;
+ return OPERATOR_CANCELLED;
}
static void WM_OT_open_recentfile(wmOperatorType *ot)