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-01-30 15:18:08 +0300
committerBrecht Van Lommel <brechtvanlommel@pandora.be>2009-01-30 15:18:08 +0300
commit8036342ea8c20ede363d5d3fe5459cc2af58a0f6 (patch)
tree1579a7a80e7d63fa655ebb4c0058b413d30b9c7e /source/blender
parent445bbdf75d94dbe4db25e9a81f6fed47c59acb5a (diff)
2.5: UI & Menus
* Cleaned up UI_interface.h a bit, and added some comments to organize things a bit and indicate what should be used when. * uiMenu* functions can now be used to create menus for headers too, this is done with a uiDefMenuBut, which takes a pointer to a uiMenuCreateFunc, that will then call uiMenu* functions. * Renamed uiMenuBegin/End to uiPupMenuBegin/End, as these are specific to making popup menus. Will convert the other conformation popup menu functions to use this too so we can remove some code. * Extended uiMenu functions, now there is is also: BooleanO, FloatO, BooleanR, EnumR, LevelEnumR, Separator. * Converted image window headers to use uiMenu functions, simplifies menu code further here. Did not remove the uiDefMenu functions as they are used in sequencer/view3d in some places now (will fix). * Also tried to simplify and fix bounds computation a bit better for popup menus. It tried to find out in advance what the size of the menu was but this is difficult with keymap strings in there, now uiPopupBoundsBlock can figure this out afterwards and ensure the popup is within the window bounds. Will convert some other functions to use this too.
Diffstat (limited to 'source/blender')
-rw-r--r--source/blender/editors/include/ED_util.h4
-rw-r--r--source/blender/editors/include/UI_interface.h303
-rw-r--r--source/blender/editors/interface/interface.c193
-rw-r--r--source/blender/editors/interface/interface_draw.c3
-rw-r--r--source/blender/editors/interface/interface_handlers.c65
-rw-r--r--source/blender/editors/interface/interface_intern.h69
-rw-r--r--source/blender/editors/interface/interface_panel.c2
-rw-r--r--source/blender/editors/interface/interface_regions.c968
-rw-r--r--source/blender/editors/mesh/editmesh_tools.c6
-rw-r--r--source/blender/editors/object/object_edit.c8
-rw-r--r--source/blender/editors/screen/screen_ops.c8
-rw-r--r--source/blender/editors/space_action/action_header.c68
-rw-r--r--source/blender/editors/space_buttons/buttons_header.c4
-rw-r--r--source/blender/editors/space_file/file_header.c4
-rw-r--r--source/blender/editors/space_image/image_header.c406
-rw-r--r--source/blender/editors/space_info/info_header.c4
-rw-r--r--source/blender/editors/space_ipo/ipo_header.c4
-rw-r--r--source/blender/editors/space_nla/nla_header.c4
-rw-r--r--source/blender/editors/space_node/node_draw.c4
-rw-r--r--source/blender/editors/space_node/node_header.c64
-rw-r--r--source/blender/editors/space_outliner/outliner_header.c4
-rw-r--r--source/blender/editors/space_script/script_header.c4
-rw-r--r--source/blender/editors/space_sequencer/sequencer_header.c24
-rw-r--r--source/blender/editors/space_sound/sound_header.c4
-rw-r--r--source/blender/editors/space_text/text_header.c4
-rw-r--r--source/blender/editors/space_time/time_header.c12
-rw-r--r--source/blender/editors/space_view3d/view3d_header.c352
-rw-r--r--source/blender/editors/transform/transform_ops.c2
-rw-r--r--source/blender/editors/util/editmode_undo.c4
-rw-r--r--source/blender/render/intern/source/occlusion.c9
-rw-r--r--source/blender/windowmanager/intern/wm_event_system.c6
-rw-r--r--source/blender/windowmanager/intern/wm_operators.c6
32 files changed, 1378 insertions, 1244 deletions
diff --git a/source/blender/editors/include/ED_util.h b/source/blender/editors/include/ED_util.h
index 4fe7112bc26..1fbf5453f98 100644
--- a/source/blender/editors/include/ED_util.h
+++ b/source/blender/editors/include/ED_util.h
@@ -30,7 +30,7 @@
struct Object;
struct bContext;
-struct uiMenuBlockHandle;
+struct ARegion;
struct uiBlock;
struct wmOperatorType;
@@ -55,7 +55,7 @@ void undo_editmode_push(struct bContext *C, char *name,
void *undo_editmode_get_prev (struct Object *ob);
-struct uiBlock *editmode_undohistorymenu(struct bContext *C, struct uiMenuBlockHandle *handle, void *arg_unused);
+struct uiBlock *editmode_undohistorymenu(struct bContext *C, struct ARegion *ar, void *arg_unused);
void undo_editmode_menu (struct bContext *C);
void undo_editmode_clear (void);
void undo_editmode_step (struct bContext *C, int step);
diff --git a/source/blender/editors/include/UI_interface.h b/source/blender/editors/include/UI_interface.h
index 95a5220ecca..8ad4ea2a1e7 100644
--- a/source/blender/editors/include/UI_interface.h
+++ b/source/blender/editors/include/UI_interface.h
@@ -30,6 +30,8 @@
#ifndef UI_INTERFACE_H
#define UI_INTERFACE_H
+/* Struct Declarations */
+
struct ID;
struct ListBase;
struct ARegion;
@@ -42,6 +44,12 @@ struct PointerRNA;
struct PropertyRNA;
struct ReportList;
+typedef struct uiBut uiBut;
+typedef struct uiBlock uiBlock;
+typedef struct uiPopupBlockHandle uiPopupBlockHandle;
+
+/* Defines */
+
/* uiBlock->dt */
#define UI_EMBOSS 0 /* use one of the themes for drawing */
#define UI_EMBOSSN 1 /* Nothing */
@@ -76,7 +84,7 @@ struct ReportList;
#define UI_BLOCK_MOVEMOUSE_QUIT 128
#define UI_BLOCK_KEEP_OPEN 256
-/* uiMenuBlockHandle->menuretval */
+/* uiPopupBlockHandle->menuretval */
#define UI_RETURN_CANCEL 1 /* cancel all menus cascading */
#define UI_RETURN_OK 2 /* choice made */
#define UI_RETURN_OUT 4 /* left the menu */
@@ -169,12 +177,13 @@ struct ReportList;
#define ICONTOGN (34<<9)
#define FTPREVIEW (35<<9)
#define NUMABS (36<<9)
+#define HMENU (37<<9)
#define BUTTYPE (63<<9)
-typedef struct uiBut uiBut;
-typedef struct uiBlock uiBlock;
-
-/* Common Drawing Functions */
+/* Drawing
+ *
+ * Functions to draw various shapes, taking theme settings into account.
+ * Used for code that draws its own UI style elements. */
void uiEmboss(float x1, float y1, float x2, float y2, int sel);
void uiRoundBox(float minx, float miny, float maxx, float maxy, float rad);
@@ -183,91 +192,137 @@ void uiRoundRect(float minx, float miny, float maxx, float maxy, float rad);
void uiDrawMenuBox(float minx, float miny, float maxx, float maxy, short flag, short direction);
void uiDrawBoxShadow(unsigned char alpha, float minx, float miny, float maxx, float maxy);
-/* Popup Menu's */
-
-typedef struct uiMenuBlockHandle {
- /* internal */
- struct ARegion *region;
- int towardsx, towardsy;
- double towardstime;
- int dotowards;
-
- int popup;
- void (*popup_func)(struct bContext *C, void *arg, int event);
- void *popup_arg;
- /* for operator menus */
- struct wmOperator *op_arg;
- const char *propname;
-
- /* return values */
- int butretval;
- int menuretval;
- float retvalue;
- float retvec[3];
-} uiMenuBlockHandle;
-
-typedef uiBlock* (*uiBlockFuncFP)(struct bContext *C, struct uiMenuBlockHandle *handle, void *arg1);
-typedef void (*uiPupmenuFunc)(struct bContext *C, void *arg, int event);
-
-void uiPupmenuSetActive(int val);
-
-void uiPupmenuOperator(struct bContext *C, int maxrow, struct wmOperator *op, const char *propname, char *str);
-void uiPupmenu(struct bContext *C, int maxrow, uiPupmenuFunc func, void *arg, char *str, ...);
-void uiPupmenuOkee(struct bContext *C, char *opname, char *str, ...);
-void uiPupmenuSaveOver(struct bContext *C, char *opname, char *filename, ...);
-void uiPupmenuNotice(struct bContext *C, char *str, ...);
-void uiPupmenuError(struct bContext *C, char *str, ...);
-void uiPupmenuReports(struct bContext *C, struct ReportList *reports);
-
-/* Custom popup menus and toolbox */
+/* Menus
+ *
+ * These functions are used by popup menus, toolbox and header menus. They
+ * assume uiMenuItem head is already created, which is done by uiMenuButton
+ * for header menus, or can be done with uiPupMenuBegin for popups. These
+ * functions do not use uiDefBut functions in order to simplify creating
+ * them, and to permit other types of menus (radial, ..) in the future. */
+
typedef struct uiMenuItem uiMenuItem;
-uiMenuItem *uiMenuBegin(const char *title);
+typedef void (*uiMenuCreateFunc)(struct bContext *C, uiMenuItem *head, void *arg1);
+typedef void (*uiMenuHandleFunc)(struct bContext *C, void *arg, int event);
-void uiMenuFunc(uiMenuItem *head, void (*eventfunc)(struct bContext *, void *, int), void *argv);
+void uiMenuFunc(uiMenuItem *head, uiMenuHandleFunc handlefunc, void *argv);
void uiMenuContext(uiMenuItem *head, int opcontext);
void uiMenuItemVal(uiMenuItem *head, const char *name, int icon, int argval);
+
void uiMenuItemEnumO(uiMenuItem *head, char *opname, char *propname, int value);
+void uiMenuItemBooleanO(uiMenuItem *head, char *opname, char *propname, int value);
void uiMenuItemsEnumO(uiMenuItem *head, char *opname, char *propname);
+void uiMenuItemFloatO(uiMenuItem *head, const char *name, char *opname, char *propname, float value);
void uiMenuItemO(uiMenuItem *head, char *name, int icon);
-void uiMenuLevel(uiMenuItem *head, const char *name, void (*newlevel)(uiMenuItem *));
+
+void uiMenuItemBooleanR(uiMenuItem *head, struct PointerRNA *ptr, char *propname);
+void uiMenuItemEnumR(uiMenuItem *head, struct PointerRNA *ptr, char *propname, int value);
+void uiMenuItemsEnumR(uiMenuItem *head, struct PointerRNA *ptr, char *propname);
+
+void uiMenuLevel(uiMenuItem *head, const char *name, uiMenuCreateFunc newlevel);
void uiMenuLevelEnumO(uiMenuItem *head, char *opname, char *propname);
+void uiMenuLevelEnumR(uiMenuItem *head, struct PointerRNA *ptr, char *propname);
+
+void uiMenuSeparator(uiMenuItem *head);
+
+/* Popup Menus
+ *
+ * Functions used to create popup menus. For more extended menus the
+ * uiPupMenuBegin/End functions can be used to define own items with
+ * the uiMenu functions inbetween. If it is a simple confirmation menu
+ * or similar, popups can be created with a single function call. */
+
+uiMenuItem *uiPupMenuBegin(const char *title);
+void uiPupMenuEnd(struct bContext *C, struct uiMenuItem *head);
+
+void uiPupMenu(struct bContext *C, int maxrow, uiMenuHandleFunc func, void *arg, char *str, ...);
+void uiPupMenuOperator(struct bContext *C, int maxrow, struct wmOperator *op, const char *propname, char *str);
+void uiPupMenuOkee(struct bContext *C, char *opname, char *str, ...);
+void uiPupMenuSaveOver(struct bContext *C, char *opname, char *filename, ...);
+void uiPupMenuNotice(struct bContext *C, char *str, ...);
+void uiPupMenuError(struct bContext *C, char *str, ...);
+void uiPupMenuReports(struct bContext *C, struct ReportList *reports);
+
+void uiPupMenuSetActive(int val);
-void uiMenuEnd(struct bContext *C, struct uiMenuItem *head);
+/* Popup Blocks
+ *
+ * Functions used to create popup blocks. These are like popup menus
+ * but allow using all button types and creating an own layout. */
+
+uiBlock *uiPupBlockBegin(struct bContext *C, const char *title);
+void uiPupBlockEnd(struct bContext *C, uiBlock *block);
-/* Block */
+/* Blocks
+ *
+ * Functions for creating, drawing and freeing blocks. A Block is a
+ * container of buttons and used for various purposes.
+ *
+ * Begin/Define Buttons/End/Draw is the typical order in which these
+ * function should be called, though for popup blocks Draw is left out.
+ * Freeing blocks is done by the screen/ module automatically.
+ *
+ * */
uiBlock *uiBeginBlock(const struct bContext *C, struct ARegion *region, char *name, short dt, short font);
void uiEndBlock(const struct bContext *C, uiBlock *block);
void uiDrawBlock(const struct bContext *C, struct uiBlock *block);
+
uiBlock *uiGetBlock(char *name, struct ARegion *ar);
+
void uiFreeBlock(const struct bContext *C, uiBlock *block);
void uiFreeBlocks(const struct bContext *C, struct ListBase *lb);
void uiFreeInactiveBlocks(const struct bContext *C, struct ListBase *lb);
-void uiBoundsBlock(struct uiBlock *block, int addval);
-void uiTextBoundsBlock(uiBlock *block, int addval);
-
void uiBlockSetButLock(uiBlock *block, int val, char *lockstr);
void uiBlockClearButLock(uiBlock *block);
+/* Appearance/Cruft
+ *
+ * These functions should mostly dissappear ideally, or become internal.
+ * Font handling could move to blenfont/, and appearance could be dictated
+ * better by high level information instead of spread out all over. */
+
+void uiSetCurFont(uiBlock *block, int index);
+void *uiSetCurFont_ext(float aspect);
+void uiDefFont(unsigned int index, void *xl, void *large, void *medium, void *small);
+void *uiBlockGetCurFont (uiBlock *block);
+
/* automatic aligning, horiz or verical */
void uiBlockBeginAlign(uiBlock *block);
void uiBlockEndAlign(uiBlock *block);
-/* Misc */
+void uiBoundsBlock(struct uiBlock *block, int addval);
+void uiTextBoundsBlock(uiBlock *block, int addval);
+void uiPopupBoundsBlock(uiBlock *block, int addval);
-void uiSetCurFont(uiBlock *block, int index);
-void *uiSetCurFont_ext(float aspect);
-void uiDefFont(unsigned int index, void *xl, void *large, void *medium, void *small);
+int uiBlocksGetYMin (ListBase *lb);
+int uiBlockGetCol (uiBlock *block);
-void uiComposeLinks(uiBlock *block);
-uiBut *uiFindInlink(uiBlock *block, void *poin);
+void uiBlockSetCol (uiBlock *block, int col);
+void uiBlockSetEmboss (uiBlock *block, int emboss);
+void uiBlockSetDirection (uiBlock *block, int direction);
+void uiBlockFlipOrder (uiBlock *block);
+void uiBlockSetFlag (uiBlock *block, int flag);
+void uiBlockSetXOfs (uiBlock *block, int xofs);
-void uiBlockPickerButtons(struct uiBlock *block, float *col, float *hsv, float *old, char *hexcol, char mode, short retval);
+int uiButGetRetVal (uiBut *but);
+
+void uiButSetFlag (uiBut *but, int flag);
+void uiButClearFlag (uiBut *but, int flag);
-/* Defining Buttons */
+void uiAutoBlock(uiBlock *block, float minx, float miny, float sizex, float sizey, int flag);
+
+/* Buttons
+ *
+ * Functions to define various types of buttons in a block. Postfixes:
+ * - F: float
+ * - I: int
+ * - S: short
+ * - C: char
+ * - R: RNA
+ * - O: operator */
uiBut *uiDefBut(uiBlock *block,
int type, int retval, char *str,
@@ -323,65 +378,93 @@ uiBut *uiDefIconTextButBitC(uiBlock *block, int type, int bit, int retval, int i
uiBut *uiDefIconTextButR(uiBlock *block, int type, int retval, int icon, char *str, short x1, short y1, short x2, short y2, struct PointerRNA *ptr, const char *propname, int index, float min, float max, float a1, float a2, char *tip);
uiBut *uiDefIconTextButO(uiBlock *block, int type, char *opname, int opcontext, int icon, char *str, short x1, short y1, short x2, short y2, char *tip);
-typedef void (*uiIDPoinFuncFP) (struct bContext *C, char *str, struct ID **idpp);
+/* for passing inputs to ButO buttons */
+struct PointerRNA *uiButGetOperatorPtrRNA(uiBut *but);
+
+/* Special Buttons
+ *
+ * Butons with a more specific purpose:
+ * - IDPoinBut: for creating buttons that work on a pointer to an ID block.
+ * - MenuBut: buttons that popup a menu (in headers usually).
+ * - PulldownBut: like MenuBut, but creating a uiBlock (for compatibility).
+ * - BlockBut: buttons that popup a block with more buttons.
+ * - KeyevtBut: buttons that can be used to turn key events into values.
+ * - PickerButtons: buttons like the color picker (for code sharing). */
+
+typedef uiBlock* (*uiBlockCreateFunc)(struct bContext *C, struct ARegion *ar, void *arg1);
+typedef void (*uiIDPoinFuncFP)(struct bContext *C, char *str, struct ID **idpp);
+
uiBut *uiDefIDPoinBut(struct uiBlock *block, uiIDPoinFuncFP func, short blocktype, int retval, char *str,
short x1, short y1, short x2, short y2, void *idpp, char *tip);
-uiBut *uiDefBlockBut(uiBlock *block, uiBlockFuncFP func, void *func_arg1, char *str, short x1, short y1, short x2, short y2, char *tip);
-uiBut *uiDefPulldownBut(uiBlock *block, uiBlockFuncFP func, void *func_arg1, char *str, short x1, short y1, short x2, short y2, char *tip);
+uiBut *uiDefPulldownBut(uiBlock *block, uiBlockCreateFunc func, void *arg, char *str, short x1, short y1, short x2, short y2, char *tip);
+uiBut *uiDefMenuBut(uiBlock *block, uiMenuCreateFunc func, void *arg, char *str, short x1, short y1, short x2, short y2, char *tip);
+uiBut *uiDefIconTextMenuBut(uiBlock *block, uiMenuCreateFunc func, void *arg, int icon, char *str, short x1, short y1, short x2, short y2, char *tip);
-uiBut *uiDefIconTextBlockBut(uiBlock *block, uiBlockFuncFP func, void *arg, int icon, char *str, short x1, short y1, short x2, short y2, char *tip);
-uiBut *uiDefIconBlockBut(uiBlock *block, uiBlockFuncFP func, void *arg, int retval, int icon, short x1, short y1, short x2, short y2, char *tip);
+uiBut *uiDefBlockBut(uiBlock *block, uiBlockCreateFunc func, void *func_arg1, char *str, short x1, short y1, short x2, short y2, char *tip);
+uiBut *uiDefIconBlockBut(uiBlock *block, uiBlockCreateFunc func, void *arg, int retval, int icon, short x1, short y1, short x2, short y2, char *tip);
+uiBut *uiDefIconTextBlockBut(uiBlock *block, uiBlockCreateFunc func, void *arg, int icon, char *str, short x1, short y1, short x2, short y2, char *tip);
void uiDefKeyevtButS(uiBlock *block, int retval, char *str, short x1, short y1, short x2, short y2, short *spoin, char *tip);
-uiBut *uiDefMenuButO(uiBlock *block, char *opname, char *name);
-uiBut *uiDefMenuSep(uiBlock *block);
-uiBut *uiDefMenuSub(uiBlock *block, uiBlockFuncFP func, char *name);
-uiBut *uiDefMenuTogR(uiBlock *block, struct PointerRNA *ptr, char *propname, char *propvalue, char *name);
-
-void uiAutoBlock(struct uiBlock *block,
- float minx, float miny,
- float sizex, float sizey, int flag);
-void uiSetButLink(struct uiBut *but,
- void **poin,
- void ***ppoin,
- short *tot,
- int from, int to);
+void uiBlockPickerButtons(struct uiBlock *block, float *col, float *hsv, float *old, char *hexcol, char mode, short retval);
-int uiBlocksGetYMin (ListBase *lb);
-int uiBlockGetCol (uiBlock *block);
-void* uiBlockGetCurFont (uiBlock *block);
+/* Links
+ *
+ * Game engine logic brick links. Non-functional currently in 2.5,
+ * code to handle and draw these is disabled internally. */
-void uiBlockSetCol (uiBlock *block, int col);
-void uiBlockSetEmboss (uiBlock *block, int emboss);
-void uiBlockSetDirection (uiBlock *block, int direction);
-void uiBlockFlipOrder (uiBlock *block);
-void uiBlockSetFlag (uiBlock *block, int flag);
-void uiBlockSetXOfs (uiBlock *block, int xofs);
+void uiSetButLink(struct uiBut *but, void **poin, void ***ppoin, short *tot, int from, int to);
-int uiButGetRetVal (uiBut *but);
+void uiComposeLinks(uiBlock *block);
+uiBut *uiFindInlink(uiBlock *block, void *poin);
-void uiButSetFlag (uiBut *but, int flag);
-void uiButClearFlag (uiBut *but, int flag);
+/* Callbacks
+ *
+ * uiBlockSetHandleFunc/ButmFunc are for handling events through a callback.
+ * HandleFunc gets the retval passed on, and ButmFunc gets a2. The latter is
+ * mostly for compatibility with older code.
+ *
+ * uiButSetCompleteFunc is for tab completion.
+ *
+ * uiBlockSetFunc and uiButSetFunc are callbacks run when a button is used,
+ * in case events, operators or RNA are not sufficient to handle the button. */
-struct PointerRNA *uiButGetOperatorPtrRNA(uiBut *but);
+typedef void (*uiButHandleFunc)(struct bContext *C, void *arg1, void *arg2);
+typedef void (*uiButCompleteFunc)(struct bContext *C, char *str, void *arg);
+typedef void (*uiBlockHandleFunc)(struct bContext *C, void *arg, int event);
-void uiBlockSetHandleFunc(uiBlock *block, void (*func)(struct bContext *C, void *arg, int event), void *arg);
-void uiBlockSetButmFunc (uiBlock *block, void (*func)(struct bContext *C, void *arg, int but_a2), void *arg);
+void uiBlockSetHandleFunc(uiBlock *block, uiBlockHandleFunc func, void *arg);
+void uiBlockSetButmFunc (uiBlock *block, uiMenuHandleFunc func, void *arg);
-void uiBlockSetFunc (uiBlock *block, void (*func)(struct bContext *C, void *arg1, void *arg2), void *arg1, void *arg2);
-void uiButSetFunc (uiBut *but, void (*func)(struct bContext *C, void *arg1, void *arg2), void *arg1, void *arg2);
+void uiBlockSetFunc (uiBlock *block, uiButHandleFunc func, void *arg1, void *arg2);
+void uiButSetFunc (uiBut *but, uiButHandleFunc func, void *arg1, void *arg2);
-void uiButSetCompleteFunc(uiBut *but, void (*func)(struct bContext *C, char *str, void *arg), void *arg);
+void uiButSetCompleteFunc(uiBut *but, uiButCompleteFunc func, void *arg);
void uiBlockSetDrawExtraFunc(uiBlock *block, void (*func)(struct bContext *C, uiBlock *block));
-/* Panels */
+/* Autocomplete
+ *
+ * Tab complete helper functions, for use in uiButCompleteFunc callbacks.
+ * Call begin once, then multiple times do_name with all possibilities,
+ * and finally end to finish and get the completed name. */
+
+typedef struct AutoComplete AutoComplete;
+
+AutoComplete *autocomplete_begin(char *startname, int maxlen);
+void autocomplete_do_name(AutoComplete *autocpl, const char *name);
+void autocomplete_end(AutoComplete *autocpl, char *autoname);
+
+/* Panels
+ *
+ * Functions for creating, freeing and drawing panels. The API here
+ * could use a good cleanup, though how they will function in 2.5 is
+ * not clear yet so we postpone that. */
-extern void uiFreePanels(struct ListBase *lb);
extern void uiNewPanelTabbed(char *, char *);
extern int uiNewPanel(const struct bContext *C, struct ARegion *ar, uiBlock *block, char *panelname, char *tabname, int ofsx, int ofsy, int sizex, int sizey);
+extern void uiFreePanels(struct ListBase *lb);
extern void uiDrawPanels(const struct bContext *C, int re_align);
extern void uiSetPanelsView2d(struct ARegion *ar);
@@ -394,25 +477,31 @@ extern int uiAlignPanelStep(struct ScrArea *sa, struct ARegion *ar, float fac);
extern void uiPanelControl(int);
extern void uiSetPanelHandler(int);
-/* Autocomplete */
-
-typedef struct AutoComplete AutoComplete;
-
-AutoComplete *autocomplete_begin(char *startname, int maxlen);
-void autocomplete_do_name(AutoComplete *autocpl, const char *name);
-void autocomplete_end(AutoComplete *autocpl, char *autoname);
-
-/* Handlers for regions with UI blocks */
+/* Handlers
+ *
+ * Handlers that can be registered in regions, areas and windows for
+ * handling WM events. Mostly this is done automatic by modules such
+ * as screen/ if ED_KEYMAP_UI is set, or internally in popup functions. */
void UI_add_region_handlers(struct ListBase *handlers);
void UI_add_area_handlers(struct ListBase *handlers);
-void UI_add_popup_handlers(struct ListBase *handlers, uiMenuBlockHandle *menu);
+void UI_add_popup_handlers(struct ListBase *handlers, uiPopupBlockHandle *menu);
-/* Module initialization and exit */
+/* Module
+ *
+ * init and exit should be called before using this module. init_userdef must
+ * be used to reinitialize some internal state if user preferences change. */
void UI_init(void);
void UI_init_userdef(void);
void UI_exit(void);
+/* XXX hide this */
+
+uiBut *uiDefMenuButO(uiBlock *block, char *opname, char *name);
+uiBut *uiDefMenuSep(uiBlock *block);
+uiBut *uiDefMenuSub(uiBlock *block, uiBlockCreateFunc func, char *name);
+uiBut *uiDefMenuTogR(uiBlock *block, struct PointerRNA *ptr, char *propname, char *propvalue, char *name);
+
#endif /* UI_INTERFACE_H */
diff --git a/source/blender/editors/interface/interface.c b/source/blender/editors/interface/interface.c
index 5b8dda2f3b4..ff4e1f46145 100644
--- a/source/blender/editors/interface/interface.c
+++ b/source/blender/editors/interface/interface.c
@@ -207,17 +207,27 @@ void ui_window_to_region(const ARegion *ar, int *x, int *y)
/* ******************* block calc ************************* */
-void uiTextBoundsBlock(uiBlock *block, int addval)
+static void ui_block_translate(uiBlock *block, int x, int y)
{
- block->textbounds= addval;
- block->dotextbounds= 1;
+ uiBut *bt;
+
+ for(bt= block->buttons.first; bt; bt=bt->next) {
+ bt->x1 += x;
+ bt->y1 += y;
+ bt->x2 += x;
+ bt->y2 += y;
+ }
+
+ block->minx += x;
+ block->miny += y;
+ block->maxx += x;
+ block->maxy += y;
}
-/* only for pulldowns */
-static void ui_text_bounds_block(uiBlock *block)
+static void ui_text_bounds_block(uiBlock *block, float offset)
{
uiBut *bt;
- int i = 0, j, x1addval= 0, nextcol, addval= block->textbounds;
+ int i = 0, j, x1addval= offset, nextcol;
bt= block->buttons.first;
while(bt) {
@@ -239,25 +249,22 @@ static void ui_text_bounds_block(uiBlock *block)
else nextcol= 0;
bt->x1 = x1addval;
- bt->x2 = bt->x1 + i + addval;
+ bt->x2 = bt->x1 + i + block->bounds;
ui_check_but(bt); // clips text again
if(nextcol)
- x1addval+= i + addval;
+ x1addval+= i + block->bounds;
bt= bt->next;
}
}
-void uiBoundsBlock(uiBlock *block, int addval)
+void ui_bounds_block(uiBlock *block)
{
uiBut *bt;
int xof;
- if(block==NULL)
- return;
-
if(block->buttons.first==NULL) {
if(block->panel) {
block->minx= 0.0; block->maxx= block->panel->sizex;
@@ -280,10 +287,10 @@ void uiBoundsBlock(uiBlock *block, int addval)
bt= bt->next;
}
- block->minx -= addval;
- block->miny -= addval;
- block->maxx += addval;
- block->maxy += addval;
+ block->minx -= block->bounds;
+ block->miny -= block->bounds;
+ block->maxx += block->bounds;
+ block->maxy += block->bounds;
}
/* hardcoded exception... but that one is annoying with larger safety */
@@ -297,34 +304,80 @@ void uiBoundsBlock(uiBlock *block, int addval)
block->safety.ymax= block->maxy+xof;
}
-void uiBlockTranslate(uiBlock *block, int x, int y)
+static void ui_popup_bounds_block(const bContext *C, uiBlock *block)
{
- uiBut *bt;
+ int startx, starty, endx, endy, width, height;
+ int oldbounds, mx, my, xmax, ymax;
- for(bt= block->buttons.first; bt; bt=bt->next) {
- bt->x1 += x;
- bt->y1 += y;
- bt->x2 += x;
- bt->y2 += y;
+ oldbounds= block->bounds;
+
+ /* compute bounds */
+ ui_bounds_block(block);
+ mx= block->minx;
+ my= block->miny;
+
+ wm_window_get_size(CTX_wm_window(C), &xmax, &ymax);
+
+ /* first we ensure wide enough text bounds */
+ block->bounds= 50;
+ ui_text_bounds_block(block, block->minx);
+
+ /* next we recompute bounds */
+ block->bounds= oldbounds;
+ ui_bounds_block(block);
+
+ /* and we adjust the position to fit within window */
+ width= block->maxx - block->minx;
+ height= block->maxy - block->miny;
+
+ startx= mx-(0.8*(width));
+ starty= my;
+
+ if(startx<10)
+ startx= 10;
+ if(starty<10)
+ starty= 10;
+
+ endx= startx+width;
+ endy= starty+height;
+
+ if(endx>xmax) {
+ endx= xmax-10;
+ startx= endx-width;
+ }
+ if(endy>ymax-20) {
+ endy= ymax-20;
+ starty= endy-height;
}
- block->minx += x;
- block->miny += y;
- block->maxx += x;
- block->maxy += y;
+ ui_block_translate(block, startx - block->minx, starty - block->miny);
+
+ /* now recompute bounds and safety */
+ ui_bounds_block(block);
}
-void uiBlockOrigin(uiBlock *block)
+/* used for various cases */
+void uiBoundsBlock(uiBlock *block, int addval)
{
- uiBut *bt;
- int minx= 10000, miny= 10000;
+ if(block==NULL)
+ return;
+
+ block->bounds= addval;
+ block->dobounds= 1;
+}
- for(bt= block->buttons.first; bt; bt=bt->next) {
- if(bt->x1 < minx) minx= bt->x1;
- if(bt->y1 < miny) miny= bt->y1;
- }
+/* used for pulldowns */
+void uiTextBoundsBlock(uiBlock *block, int addval)
+{
+ block->bounds= addval;
+ block->dobounds= 2;
+}
- uiBlockTranslate(block, -minx, -miny);
+/* used for menu popups */
+void uiPopupBoundsBlock(uiBlock *block, int addval)
+{
+ block->bounds= addval;
+ block->dobounds= 3;
}
void ui_autofill(uiBlock *block)
@@ -485,12 +538,15 @@ static int ui_but_update_from_old_block(const bContext *C, uiBlock *block, uiBut
return found;
}
-static void ui_menu_block_set_keymaps(const bContext *C, uiBlock *block)
+void ui_menu_block_set_keymaps(const bContext *C, uiBlock *block)
{
uiBut *but;
IDProperty *prop;
char buf[512], *butstr;
- int bounds= 0;;
+
+ /* only do it before bounding */
+ if(block->minx != block->maxx)
+ return;
for(but=block->buttons.first; but; but=but->next) {
if(but->opname) {
@@ -507,7 +563,6 @@ static void ui_menu_block_set_keymaps(const bContext *C, uiBlock *block)
MEM_freeN(butstr);
ui_check_but(but);
- bounds= 1;
}
}
}
@@ -535,7 +590,12 @@ void uiEndBlock(const bContext *C, uiBlock *block)
/* handle pending stuff */
if(block->flag & UI_BLOCK_LOOP) ui_menu_block_set_keymaps(C, block);
- if(block->dotextbounds) ui_text_bounds_block(block); /* after keymaps! */
+
+ /* after keymaps! */
+ if(block->dobounds == 1) ui_bounds_block(block);
+ else if(block->dobounds == 2) ui_text_bounds_block(block, 0.0f);
+ else if(block->dobounds == 3) ui_popup_bounds_block(C, block);
+
if(block->autofill) ui_autofill(block);
if(block->minx==0.0 && block->maxx==0.0) uiBoundsBlock(block, 0);
if(block->flag & UI_BUT_ALIGN) uiBlockEndAlign(block);
@@ -1782,6 +1842,7 @@ static int ui_auto_themecol(uiBut *but)
case TEX:
return TH_BUT_TEXTFIELD;
case PULLDOWN:
+ case HMENU:
case BLOCK:
case MENU:
case BUTM:
@@ -2118,6 +2179,18 @@ uiBut *ui_def_but_rna(uiBlock *block, int type, int retval, char *str, short x1,
freestr= 1;
}
+ else if(type == ROW && proptype == PROP_ENUM) {
+ const EnumPropertyItem *item;
+ int i, totitem;
+
+ RNA_property_enum_items(ptr, prop, &item, &totitem);
+ for(i=0; i<totitem; i++)
+ if(item[i].value == (int)max)
+ str= (char*)item[i].name;
+
+ if(!str)
+ str= (char*)RNA_property_ui_name(ptr, prop);
+ }
else
str= (char*)RNA_property_ui_name(ptr, prop);
}
@@ -2579,7 +2652,7 @@ uiBut *uiDefMenuSep(uiBlock *block)
return uiDefBut(block, SEPR, 0, "", 0, y, MENU_WIDTH, MENU_SEP_HEIGHT, NULL, 0.0, 0.0, 0, 0, "");
}
-uiBut *uiDefMenuSub(uiBlock *block, uiBlockFuncFP func, char *name)
+uiBut *uiDefMenuSub(uiBlock *block, uiBlockCreateFunc func, char *name)
{
int y= ui_menu_y(block) - MENU_ITEM_HEIGHT;
return uiDefIconTextBlockBut(block, func, NULL, ICON_RIGHTARROW_THIN, name, 0, y, MENU_WIDTH, MENU_ITEM_HEIGHT-1, "");
@@ -2813,24 +2886,48 @@ uiBut *uiDefIDPoinBut(uiBlock *block, uiIDPoinFuncFP func, short blocktype, int
return but;
}
-uiBut *uiDefBlockBut(uiBlock *block, uiBlockFuncFP func, void *arg, char *str, short x1, short y1, short x2, short y2, char *tip)
+uiBut *uiDefBlockBut(uiBlock *block, uiBlockCreateFunc func, void *arg, char *str, short x1, short y1, short x2, short y2, char *tip)
{
uiBut *but= ui_def_but(block, BLOCK, 0, str, x1, y1, x2, y2, arg, 0.0, 0.0, 0.0, 0.0, tip);
- but->block_func= func;
+ but->block_create_func= func;
ui_check_but(but);
return but;
}
-uiBut *uiDefPulldownBut(uiBlock *block, uiBlockFuncFP func, void *arg, char *str, short x1, short y1, short x2, short y2, char *tip)
+uiBut *uiDefPulldownBut(uiBlock *block, uiBlockCreateFunc func, void *arg, char *str, short x1, short y1, short x2, short y2, char *tip)
{
uiBut *but= ui_def_but(block, PULLDOWN, 0, str, x1, y1, x2, y2, arg, 0.0, 0.0, 0.0, 0.0, tip);
- but->block_func= func;
+ but->block_create_func= func;
+ ui_check_but(but);
+ return but;
+}
+
+uiBut *uiDefMenuBut(uiBlock *block, uiMenuCreateFunc func, void *arg, char *str, short x1, short y1, short x2, short y2, char *tip)
+{
+ uiBut *but= ui_def_but(block, HMENU, 0, str, x1, y1, x2, y2, arg, 0.0, 0.0, 0.0, 0.0, tip);
+ but->menu_create_func= func;
+ ui_check_but(but);
+ return but;
+}
+
+uiBut *uiDefIconTextMenuBut(uiBlock *block, uiMenuCreateFunc func, void *arg, int icon, char *str, short x1, short y1, short x2, short y2, char *tip)
+{
+ uiBut *but= ui_def_but(block, HMENU, 0, str, x1, y1, x2, y2, arg, 0.0, 0.0, 0.0, 0.0, tip);
+
+ but->icon= (BIFIconID) icon;
+ but->flag|= UI_HAS_ICON;
+
+ but->flag|= UI_ICON_LEFT;
+ but->flag|= UI_ICON_RIGHT;
+
+ but->menu_create_func= func;
ui_check_but(but);
+
return but;
}
/* Block button containing both string label and icon */
-uiBut *uiDefIconTextBlockBut(uiBlock *block, uiBlockFuncFP func, void *arg, int icon, char *str, short x1, short y1, short x2, short y2, char *tip)
+uiBut *uiDefIconTextBlockBut(uiBlock *block, uiBlockCreateFunc func, void *arg, int icon, char *str, short x1, short y1, short x2, short y2, char *tip)
{
uiBut *but= ui_def_but(block, BLOCK, 0, str, x1, y1, x2, y2, arg, 0.0, 0.0, 0.0, 0.0, tip);
@@ -2840,14 +2937,14 @@ uiBut *uiDefIconTextBlockBut(uiBlock *block, uiBlockFuncFP func, void *arg, int
but->flag|= UI_ICON_LEFT;
but->flag|= UI_ICON_RIGHT;
- but->block_func= func;
+ but->block_create_func= func;
ui_check_but(but);
return but;
}
/* Block button containing icon */
-uiBut *uiDefIconBlockBut(uiBlock *block, uiBlockFuncFP func, void *arg, int retval, int icon, short x1, short y1, short x2, short y2, char *tip)
+uiBut *uiDefIconBlockBut(uiBlock *block, uiBlockCreateFunc func, void *arg, int retval, int icon, short x1, short y1, short x2, short y2, char *tip)
{
uiBut *but= ui_def_but(block, BLOCK, retval, "", x1, y1, x2, y2, arg, 0.0, 0.0, 0.0, 0.0, tip);
@@ -2857,7 +2954,7 @@ uiBut *uiDefIconBlockBut(uiBlock *block, uiBlockFuncFP func, void *arg, int retv
but->flag|= UI_ICON_LEFT;
but->flag|= UI_ICON_RIGHT;
- but->block_func= func;
+ but->block_create_func= func;
ui_check_but(but);
return but;
diff --git a/source/blender/editors/interface/interface_draw.c b/source/blender/editors/interface/interface_draw.c
index 799c1cc743c..db9f621c1fd 100644
--- a/source/blender/editors/interface/interface_draw.c
+++ b/source/blender/editors/interface/interface_draw.c
@@ -3214,7 +3214,8 @@ void ui_set_embossfunc(uiBut *but, int drawtype)
// standard builtin first:
if(but->type==LABEL || but->type==ROUNDBOX) but->embossfunc= ui_draw_nothing;
- else if(but->type==PULLDOWN) but->embossfunc= ui_draw_pulldown_round;
+ else if(ELEM(but->type, PULLDOWN, HMENU) && !(but->block->flag & UI_BLOCK_LOOP))
+ but->embossfunc= ui_draw_pulldown_round;
else if(drawtype==UI_EMBOSSM) but->embossfunc= ui_draw_minimal;
else if(drawtype==UI_EMBOSSN) but->embossfunc= ui_draw_nothing;
else if(drawtype==UI_EMBOSSP) but->embossfunc= ui_draw_pulldown_item;
diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c
index 85735a42026..61ea1b1b8e3 100644
--- a/source/blender/editors/interface/interface_handlers.c
+++ b/source/blender/editors/interface/interface_handlers.c
@@ -122,7 +122,7 @@ typedef struct uiHandleButtonData {
CBData *dragcbd;
/* menu open */
- uiMenuBlockHandle *menu;
+ uiPopupBlockHandle *menu;
int menuretval;
/* post activate */
@@ -598,6 +598,7 @@ static void ui_apply_button(bContext *C, uiBlock *block, uiBut *but, uiHandleBut
case ICONTEXTROW:
case BLOCK:
case PULLDOWN:
+ case HMENU:
case COL:
ui_apply_but_BLOCK(C, but, data);
break;
@@ -1429,13 +1430,19 @@ static void ui_numedit_apply(bContext *C, uiBlock *block, uiBut *but, uiHandleBu
static void ui_blockopen_begin(bContext *C, uiBut *but, uiHandleButtonData *data)
{
- uiBlockFuncFP func= NULL;
+ uiBlockCreateFunc func= NULL;
+ uiBlockHandleCreateFunc handlefunc= NULL;
+ uiMenuCreateFunc menufunc= NULL;
void *arg= NULL;
switch(but->type) {
case BLOCK:
case PULLDOWN:
- func= but->block_func;
+ func= but->block_create_func;
+ arg= but->poin;
+ break;
+ case HMENU:
+ menufunc= but->menu_create_func;
arg= but->poin;
break;
case MENU:
@@ -1443,15 +1450,15 @@ static void ui_blockopen_begin(bContext *C, uiBut *but, uiHandleButtonData *data
data->value= data->origvalue;
but->editval= &data->value;
- func= ui_block_func_MENU;
+ handlefunc= ui_block_func_MENU;
arg= but;
break;
case ICONROW:
- func= ui_block_func_ICONROW;
+ handlefunc= ui_block_func_ICONROW;
arg= but;
break;
case ICONTEXTROW:
- func= ui_block_func_ICONTEXTROW;
+ handlefunc= ui_block_func_ICONTEXTROW;
arg= but;
break;
case COL:
@@ -1459,13 +1466,18 @@ static void ui_blockopen_begin(bContext *C, uiBut *but, uiHandleButtonData *data
VECCOPY(data->vec, data->origvec);
but->editvec= data->vec;
- func= ui_block_func_COL;
+ handlefunc= ui_block_func_COL;
arg= but;
break;
}
- if(func) {
- data->menu= ui_menu_block_create(C, data->region, but, func, arg);
+ if(func || handlefunc) {
+ data->menu= ui_popup_block_create(C, data->region, but, func, handlefunc, arg);
+ if(but->block->handle)
+ data->menu->popup= but->block->handle->popup;
+ }
+ else if(menufunc) {
+ data->menu= ui_popup_menu_create(C, data->region, but, menufunc, arg);
if(but->block->handle)
data->menu->popup= but->block->handle->popup;
}
@@ -1484,7 +1496,7 @@ static void ui_blockopen_end(bContext *C, uiBut *but, uiHandleButtonData *data)
}
if(data->menu) {
- ui_menu_block_free(C, data->menu);
+ ui_popup_block_free(C, data->menu);
data->menu= NULL;
}
}
@@ -2658,6 +2670,7 @@ static int ui_do_button(bContext *C, uiBlock *block, uiBut *but, wmEvent *event)
break;
case BLOCK:
case PULLDOWN:
+ case HMENU:
retval= ui_do_but_BLOCK(C, but, data, event);
break;
case BUTM:
@@ -2835,7 +2848,7 @@ static void button_activate_state(bContext *C, uiBut *but, uiHandleButtonState s
button_tooltip_timer_reset(but);
/* automatic open pulldown block timer */
- if(but->type==BLOCK || but->type==MENU || but->type==PULLDOWN || but->type==ICONTEXTROW) {
+ if(ELEM5(but->type, BLOCK, MENU, PULLDOWN, HMENU, ICONTEXTROW)) {
if(!data->autoopentimer) {
int time;
@@ -2975,7 +2988,7 @@ static void button_activate_exit(bContext *C, uiHandleButtonData *data, uiBut *b
* value to the button value and the menu return value to ok, the
* menu return value will be picked up and the menu will close */
if(block->handle && !(block->flag & UI_BLOCK_KEEP_OPEN) && !data->cancel) {
- uiMenuBlockHandle *menu;
+ uiPopupBlockHandle *menu;
menu= block->handle;
menu->butretval= data->retval;
@@ -3184,7 +3197,7 @@ static int ui_handle_button_event(bContext *C, wmEvent *event, uiBut *but)
static void ui_handle_button_closed_submenu(bContext *C, wmEvent *event, uiBut *but)
{
uiHandleButtonData *data;
- uiMenuBlockHandle *menu;
+ uiPopupBlockHandle *menu;
data= but->active;
menu= data->menu;
@@ -3226,7 +3239,7 @@ static void ui_handle_button_closed_submenu(bContext *C, wmEvent *event, uiBut *
* - only for 1 second
*/
-static void ui_mouse_motion_towards_init(uiMenuBlockHandle *menu, int mx, int my)
+static void ui_mouse_motion_towards_init(uiPopupBlockHandle *menu, int mx, int my)
{
if(!menu->dotowards) {
menu->dotowards= 1;
@@ -3236,7 +3249,7 @@ static void ui_mouse_motion_towards_init(uiMenuBlockHandle *menu, int mx, int my
}
}
-static int ui_mouse_motion_towards_check(uiBlock *block, uiMenuBlockHandle *menu, int mx, int my)
+static int ui_mouse_motion_towards_check(uiBlock *block, uiPopupBlockHandle *menu, int mx, int my)
{
int fac, dx, dy, domx, domy;
@@ -3290,7 +3303,7 @@ static int ui_mouse_motion_towards_check(uiBlock *block, uiMenuBlockHandle *menu
return menu->dotowards;
}
-int ui_handle_menu_event(bContext *C, wmEvent *event, uiMenuBlockHandle *menu, int topmenu)
+int ui_handle_menu_event(bContext *C, wmEvent *event, uiPopupBlockHandle *menu, int topmenu)
{
ARegion *ar;
uiBlock *block;
@@ -3514,13 +3527,13 @@ int ui_handle_menu_event(bContext *C, wmEvent *event, uiMenuBlockHandle *menu, i
return retval;
}
-static int ui_handle_menu_closed_submenu(bContext *C, wmEvent *event, uiMenuBlockHandle *menu)
+static int ui_handle_menu_closed_submenu(bContext *C, wmEvent *event, uiPopupBlockHandle *menu)
{
ARegion *ar;
uiBut *but;
uiBlock *block;
uiHandleButtonData *data;
- uiMenuBlockHandle *submenu;
+ uiPopupBlockHandle *submenu;
ar= menu->region;
block= ar->uiblocks.first;
@@ -3550,11 +3563,11 @@ static int ui_handle_menu_closed_submenu(bContext *C, wmEvent *event, uiMenuBloc
return WM_UI_HANDLER_BREAK;
}
-static int ui_handle_menus_recursive(bContext *C, wmEvent *event, uiMenuBlockHandle *menu)
+static int ui_handle_menus_recursive(bContext *C, wmEvent *event, uiPopupBlockHandle *menu)
{
uiBut *but;
uiHandleButtonData *data;
- uiMenuBlockHandle *submenu;
+ uiPopupBlockHandle *submenu;
int retval= WM_UI_HANDLER_CONTINUE;
/* check if we have a submenu, and handle events for it first */
@@ -3683,16 +3696,16 @@ static int ui_handler_region_menu(bContext *C, wmEvent *event, void *userdata)
/* two types of popups, one with operator + enum, other with regular callbacks */
static int ui_handler_popup(bContext *C, wmEvent *event, void *userdata)
{
- uiMenuBlockHandle *menu= userdata;
+ uiPopupBlockHandle *menu= userdata;
ui_handle_menus_recursive(C, event, menu);
/* free if done, does not free handle itself */
if(menu->menuretval) {
/* copy values, we have to free first (closes region) */
- uiMenuBlockHandle temp= *menu;
+ uiPopupBlockHandle temp= *menu;
- ui_menu_block_free(C, menu);
+ ui_popup_block_free(C, menu);
WM_event_remove_ui_handler(&CTX_wm_window(C)->handlers, ui_handler_popup, ui_handler_remove_popup, menu);
if(temp.menuretval == UI_RETURN_OK) {
@@ -3725,10 +3738,10 @@ static int ui_handler_popup(bContext *C, wmEvent *event, void *userdata)
static void ui_handler_remove_popup(bContext *C, void *userdata)
{
- uiMenuBlockHandle *menu= userdata;
+ uiPopupBlockHandle *menu= userdata;
/* free menu block if window is closed for some reason */
- ui_menu_block_free(C, menu);
+ ui_popup_block_free(C, menu);
/* delayed apply callbacks */
ui_apply_but_funcs_after(C);
@@ -3740,7 +3753,7 @@ void UI_add_region_handlers(ListBase *handlers)
WM_event_add_ui_handler(NULL, handlers, ui_handler_region, ui_handler_remove_region, NULL);
}
-void UI_add_popup_handlers(ListBase *handlers, uiMenuBlockHandle *menu)
+void UI_add_popup_handlers(ListBase *handlers, uiPopupBlockHandle *menu)
{
WM_event_add_ui_handler(NULL, handlers, ui_handler_popup, ui_handler_remove_popup, menu);
}
diff --git a/source/blender/editors/interface/interface_intern.h b/source/blender/editors/interface/interface_intern.h
index 43b7e280170..d66c6e4129e 100644
--- a/source/blender/editors/interface/interface_intern.h
+++ b/source/blender/editors/interface/interface_intern.h
@@ -121,14 +121,14 @@ struct uiBut {
float a1, a2, hsv[3]; // hsv is temp memory for hsv buttons
float aspect;
- void (*func)(struct bContext*, void *, void *);
+ uiButHandleFunc func;
void *func_arg1;
void *func_arg2;
void (*embossfunc)(int , int , float, float, float, float, float, int);
void (*sliderfunc)(int , float, float, float, float, float, float, int);
- void (*autocomplete_func)(struct bContext*, char *, void *);
+ uiButCompleteFunc autocomplete_func;
void *autofunc_arg;
uiLink *link;
@@ -143,19 +143,22 @@ struct uiBut {
short lock, win;
short iconadd, dt;
- /* IDPOIN data */
+ /* IDPOIN data */
uiIDPoinFuncFP idpoin_func;
ID **idpoin_idpp;
- /* BLOCK data */
- uiBlockFuncFP block_func;
+ /* BLOCK data */
+ uiBlockCreateFunc block_create_func;
- /* RNA */
+ /* HMENU data */
+ uiMenuCreateFunc menu_create_func;
+
+ /* RNA data */
struct PointerRNA rnapoin;
struct PropertyRNA *rnaprop;
int rnaindex;
- /* Operator */
+ /* Operator data */
const char *opname;
int opcontext;
struct IDProperty *opproperties;
@@ -188,14 +191,14 @@ struct uiBlock {
float minx, miny, maxx, maxy;
float aspect;
- void (*func)(struct bContext*, void *arg1, void *arg2);
+ uiButHandleFunc func;
void *func_arg1;
void *func_arg2;
- void (*butm_func)(struct bContext*, void *arg, int but_a2);
+ uiMenuHandleFunc butm_func;
void *butm_func_arg;
- void (*handle_func)(struct bContext*, void *arg, int event);
+ uiBlockHandleFunc handle_func;
void *handle_func_arg;
/* extra draw function for custom blocks */
@@ -215,13 +218,13 @@ struct uiBlock {
char *lockstr;
float xofs, yofs; // offset to parent button
- int textbounds, dotextbounds; // for doing delayed
+ int bounds, dobounds; // for doing delayed
int endblock; // uiEndBlock done?
rctf safety; // pulldowns, to detect outside, can differ per case how it is created
ListBase saferct; // uiSafetyRct list
- uiMenuBlockHandle *handle; // handle
+ uiPopupBlockHandle *handle; // handle
int tooltipdisabled; // to avoid tooltip after click
int handler; // for panels in other windows than buttonswin... just event code
@@ -260,18 +263,46 @@ extern void ui_autofill(uiBlock *block);
extern int ui_is_but_float(uiBut *but);
extern void ui_update_block_buts_hsv(uiBlock *block, float *hsv);
+extern void ui_bounds_block(uiBlock *block);
+
/* interface_regions.c */
-uiBlock *ui_block_func_MENU(struct bContext *C, uiMenuBlockHandle *handle, void *arg_but);
-uiBlock *ui_block_func_ICONROW(struct bContext *C, uiMenuBlockHandle *handle, void *arg_but);
-uiBlock *ui_block_func_ICONTEXTROW(struct bContext *C, uiMenuBlockHandle *handle, void *arg_but);
-uiBlock *ui_block_func_COL(struct bContext *C, uiMenuBlockHandle *handle, void *arg_but);
+
+struct uiPopupBlockHandle {
+ /* internal */
+ struct ARegion *region;
+ int towardsx, towardsy;
+ double towardstime;
+ int dotowards;
+
+ int popup;
+ void (*popup_func)(struct bContext *C, void *arg, int event);
+ void *popup_arg;
+ /* for operator menus */
+ struct wmOperator *op_arg;
+ const char *propname;
+
+ /* return values */
+ int butretval;
+ int menuretval;
+ float retvalue;
+ float retvec[3];
+};
+
+uiBlock *ui_block_func_MENU(struct bContext *C, uiPopupBlockHandle *handle, void *arg_but);
+uiBlock *ui_block_func_ICONROW(struct bContext *C, uiPopupBlockHandle *handle, void *arg_but);
+uiBlock *ui_block_func_ICONTEXTROW(struct bContext *C, uiPopupBlockHandle *handle, void *arg_but);
+uiBlock *ui_block_func_COL(struct bContext *C, uiPopupBlockHandle *handle, void *arg_but);
struct ARegion *ui_tooltip_create(struct bContext *C, struct ARegion *butregion, uiBut *but);
void ui_tooltip_free(struct bContext *C, struct ARegion *ar);
-uiMenuBlockHandle *ui_menu_block_create(struct bContext *C, struct ARegion *butregion, uiBut *but,
- uiBlockFuncFP block_func, void *arg);
-void ui_menu_block_free(struct bContext *C, uiMenuBlockHandle *handle);
+typedef uiBlock* (*uiBlockHandleCreateFunc)(struct bContext *C, struct uiPopupBlockHandle *handle, void *arg1);
+
+uiPopupBlockHandle *ui_popup_block_create(struct bContext *C, struct ARegion *butregion, uiBut *but,
+ uiBlockCreateFunc create_func, uiBlockHandleCreateFunc handle_create_func, void *arg);
+uiPopupBlockHandle *ui_popup_menu_create(struct bContext *C, struct ARegion *butregion, uiBut *but,
+ uiMenuCreateFunc create_func, void *arg);
+void ui_popup_block_free(struct bContext *C, uiPopupBlockHandle *handle);
void ui_set_name_menu(uiBut *but, int value);
diff --git a/source/blender/editors/interface/interface_panel.c b/source/blender/editors/interface/interface_panel.c
index 0d6aa4082d3..74cd888df26 100644
--- a/source/blender/editors/interface/interface_panel.c
+++ b/source/blender/editors/interface/interface_panel.c
@@ -266,7 +266,7 @@ static void ui_scale_panel_block(uiBlock *block)
if(block->autofill) ui_autofill(block);
/* buttons min/max centered, offset calculated */
- uiBoundsBlock(block, 0);
+ ui_bounds_block(block);
if( block->maxx-block->minx > block->panel->sizex - 2*PNL_SAFETY ) {
facx= (block->panel->sizex - (2*PNL_SAFETY))/( block->maxx-block->minx );
diff --git a/source/blender/editors/interface/interface_regions.c b/source/blender/editors/interface/interface_regions.c
index 90385ab2897..7fb3567033b 100644
--- a/source/blender/editors/interface/interface_regions.c
+++ b/source/blender/editors/interface/interface_regions.c
@@ -622,18 +622,18 @@ static void ui_block_region_draw(const bContext *C, ARegion *ar)
uiDrawBlock(C, block);
}
-uiMenuBlockHandle *ui_menu_block_create(bContext *C, ARegion *butregion, uiBut *but, uiBlockFuncFP block_func, void *arg)
+uiPopupBlockHandle *ui_popup_block_create(bContext *C, ARegion *butregion, uiBut *but, uiBlockCreateFunc create_func, uiBlockHandleCreateFunc handle_create_func, void *arg)
{
wmWindow *window= CTX_wm_window(C);
static ARegionType type;
ARegion *ar;
uiBlock *block;
uiBut *bt;
- uiMenuBlockHandle *handle;
+ uiPopupBlockHandle *handle;
uiSafetyRct *saferct;
/* create handle */
- handle= MEM_callocN(sizeof(uiMenuBlockHandle), "uiMenuBlockHandle");
+ handle= MEM_callocN(sizeof(uiPopupBlockHandle), "uiPopupBlockHandle");
/* create area region */
ar= ui_add_temporary_region(CTX_wm_screen(C));
@@ -648,7 +648,10 @@ uiMenuBlockHandle *ui_menu_block_create(bContext *C, ARegion *butregion, uiBut *
ar->regiondata= handle;
/* create ui block */
- block= block_func(C, handle, arg);
+ if(create_func)
+ block= create_func(C, handle->region, arg);
+ else
+ block= handle_create_func(C, handle, arg);
block->handle= handle;
if(!block->endblock)
@@ -656,7 +659,7 @@ uiMenuBlockHandle *ui_menu_block_create(bContext *C, ARegion *butregion, uiBut *
/* if this is being created from a button */
if(but) {
- if(ELEM(but->type, BLOCK, PULLDOWN))
+ if(ELEM3(but->type, BLOCK, PULLDOWN, HMENU))
block->xofs = -2; /* for proper alignment */
/* only used for automatic toolbox, so can set the shift flag */
@@ -712,7 +715,7 @@ uiMenuBlockHandle *ui_menu_block_create(bContext *C, ARegion *butregion, uiBut *
return handle;
}
-void ui_menu_block_free(bContext *C, uiMenuBlockHandle *handle)
+void ui_popup_block_free(bContext *C, uiPopupBlockHandle *handle)
{
ui_remove_temporary_region(C, CTX_wm_screen(C), handle->region);
MEM_freeN(handle);
@@ -720,7 +723,7 @@ void ui_menu_block_free(bContext *C, uiMenuBlockHandle *handle)
/***************************** Menu Button ***************************/
-uiBlock *ui_block_func_MENU(bContext *C, uiMenuBlockHandle *handle, void *arg_but)
+uiBlock *ui_block_func_MENU(bContext *C, uiPopupBlockHandle *handle, void *arg_but)
{
uiBut *but= arg_but;
uiBlock *block;
@@ -836,7 +839,7 @@ uiBlock *ui_block_func_MENU(bContext *C, uiMenuBlockHandle *handle, void *arg_bu
return block;
}
-uiBlock *ui_block_func_ICONROW(bContext *C, uiMenuBlockHandle *handle, void *arg_but)
+uiBlock *ui_block_func_ICONROW(bContext *C, uiPopupBlockHandle *handle, void *arg_but)
{
uiBut *but= arg_but;
uiBlock *block;
@@ -857,7 +860,7 @@ uiBlock *ui_block_func_ICONROW(bContext *C, uiMenuBlockHandle *handle, void *arg
return block;
}
-uiBlock *ui_block_func_ICONTEXTROW(bContext *C, uiMenuBlockHandle *handle, void *arg_but)
+uiBlock *ui_block_func_ICONTEXTROW(bContext *C, uiPopupBlockHandle *handle, void *arg_but)
{
uiBut *but= arg_but;
uiBlock *block;
@@ -1262,7 +1265,7 @@ void uiBlockPickerButtons(uiBlock *block, float *col, float *hsv, float *old, ch
uiBlockEndAlign(block);
}
-uiBlock *ui_block_func_COL(bContext *C, uiMenuBlockHandle *handle, void *arg_but)
+uiBlock *ui_block_func_COL(bContext *C, uiPopupBlockHandle *handle, void *arg_but)
{
uiBut *but= arg_but;
uiBlock *block;
@@ -1287,7 +1290,7 @@ uiBlock *ui_block_func_COL(bContext *C, uiMenuBlockHandle *handle, void *arg_but
static int pupmenu_set= 0;
-void uiPupmenuSetActive(int val)
+void uiPupMenuSetActive(int val)
{
pupmenu_set= val;
}
@@ -1322,7 +1325,7 @@ typedef struct uiPupMenuInfo {
int maxrow;
} uiPupMenuInfo;
-uiBlock *ui_block_func_PUPMENU(bContext *C, uiMenuBlockHandle *handle, void *arg_info)
+uiBlock *ui_block_func_PUPMENU(bContext *C, uiPopupBlockHandle *handle, void *arg_info)
{
uiBlock *block;
uiPupMenuInfo *info;
@@ -1486,7 +1489,7 @@ uiBlock *ui_block_func_PUPMENU(bContext *C, uiMenuBlockHandle *handle, void *arg
return block;
}
-uiBlock *ui_block_func_PUPMENUCOL(bContext *C, uiMenuBlockHandle *handle, void *arg_info)
+uiBlock *ui_block_func_PUPMENUCOL(bContext *C, uiPopupBlockHandle *handle, void *arg_info)
{
uiBlock *block;
uiPupMenuInfo *info;
@@ -1641,205 +1644,304 @@ uiBlock *ui_block_func_PUPMENUCOL(bContext *C, uiMenuBlockHandle *handle, void *
return block;
}
-/* This one will set enum propname, call operator and register it, and free the operator itself,
- call it in op->invoke with returning OPERATOR_RUNNING_MODAL */
-/* Note: propname has to be static */
-void uiPupmenuOperator(bContext *C, int maxrow, wmOperator *op, const char *propname, char *str)
-{
- wmWindow *window= CTX_wm_window(C);
- uiPupMenuInfo info;
- uiMenuBlockHandle *menu;
-
- memset(&info, 0, sizeof(info));
- info.mx= window->eventstate->x;
- info.my= window->eventstate->y;
- info.maxrow= maxrow;
- info.instr= str;
-
- menu= ui_menu_block_create(C, NULL, NULL, ui_block_func_PUPMENU, &info);
- menu->popup= 1;
-
- UI_add_popup_handlers(&window->handlers, menu);
- WM_event_add_mousemove(C);
-
- menu->op_arg= op;
- menu->propname= propname;
-}
-
+/************************** Menu Definitions ***************************/
-/* this one only to be called with operatortype name option */
-void uiPupmenu(bContext *C, int maxrow, uiPupmenuFunc func, void *arg, char *str, ...)
-{
- wmWindow *window= CTX_wm_window(C);
- uiPupMenuInfo info;
- uiMenuBlockHandle *menu;
-
- memset(&info, 0, sizeof(info));
- info.mx= window->eventstate->x;
- info.my= window->eventstate->y;
- info.maxrow= maxrow;
- info.instr= str;
-
- menu= ui_menu_block_create(C, NULL, NULL, ui_block_func_PUPMENU, &info);
- menu->popup= 1;
+/* prototype */
+static uiBlock *ui_block_func_MENU_ITEM(bContext *C, uiPopupBlockHandle *handle, void *arg_info);
- UI_add_popup_handlers(&window->handlers, menu);
- WM_event_add_mousemove(C);
+#define MAX_MENU_STR 64
- menu->popup_func= func;
- menu->popup_arg= arg;
-}
+/* type, internal */
+#define MENU_ITEM_TITLE 0
+#define MENU_ITEM_ITEM 1
+#define MENU_ITEM_OPNAME 2
+#define MENU_ITEM_OPNAME_BOOL 3
+#define MENU_ITEM_OPNAME_ENUM 4
+#define MENU_ITEM_OPNAME_FLOAT 5
+#define MENU_ITEM_RNA_BOOL 6
+#define MENU_ITEM_RNA_ENUM 7
+#define MENU_ITEM_LEVEL 8
+#define MENU_ITEM_LEVEL_OPNAME_ENUM 9
+#define MENU_ITEM_LEVEL_RNA_ENUM 10
+#define MENU_ITEM_SEPARATOR 11
-/* standard pupmenus */
+struct uiMenuItem {
+ struct uiMenuItem *next, *prev;
+
+ int type;
+ int icon;
+ char name[MAX_MENU_STR];
+
+ char *opname; /* static string */
+ char *propname; /* static string */
+
+ int retval, enumval, boolval;
+ float fltval;
+ int opcontext;
+ uiMenuHandleFunc eventfunc;
+ void *argv;
+ uiMenuCreateFunc newlevel;
+ PointerRNA rnapoin;
+
+ ListBase items;
+};
-static void operator_cb(bContext *C, void *arg, int retval)
-{
- const char *opname= arg;
+typedef struct uiMenuInfo {
+ uiMenuItem *head;
+ int mx, my, popup, slideout;
+ int startx, starty;
+} uiMenuInfo;
- if(opname && retval > 0)
- WM_operator_name_call(C, opname, WM_OP_EXEC_DEFAULT, NULL);
-}
+/************************ Menu Definitions to uiBlocks ***********************/
-static void vconfirm(bContext *C, char *opname, char *title, char *itemfmt, va_list ap)
+const char *ui_menu_enumpropname(char *opname, const char *propname, int retval)
{
- char *s, buf[512];
+ wmOperatorType *ot= WM_operatortype_find(opname);
+ PointerRNA ptr;
+ PropertyRNA *prop;
- s= buf;
- if (title) s+= sprintf(s, "%s%%t|", title);
- vsprintf(s, itemfmt, ap);
+ if(!ot || !ot->srna)
+ return "";
+
+ RNA_pointer_create(NULL, ot->srna, NULL, &ptr);
+ prop= RNA_struct_find_property(&ptr, propname);
+
+ if(prop) {
+ const EnumPropertyItem *item;
+ int totitem, i;
+
+ RNA_property_enum_items(&ptr, prop, &item, &totitem);
+
+ for (i=0; i<totitem; i++) {
+ if(item[i].value==retval)
+ return item[i].name;
+ }
+ }
- uiPupmenu(C, 0, operator_cb, opname, buf);
+ return "";
}
-static void confirm(bContext *C, char *opname, char *title, char *itemfmt, ...)
+/* make a menu level from enum properties */
+static void menu_item_enum_opname_menu(bContext *C, uiMenuItem *head, void *arg)
{
- va_list ap;
+ uiBut *but= arg; /* parent caller */
+ char *opname= but->func_arg1;
+ char *propname= but->func_arg2;
- va_start(ap, itemfmt);
- vconfirm(C, opname, title, itemfmt, ap);
- va_end(ap);
+ uiMenuItemsEnumO(head, opname, propname);
}
-void uiPupmenuOkee(bContext *C, char *opname, char *str, ...)
+static void menu_item_enum_rna_menu(bContext *C, uiMenuItem *head, void *arg)
{
- va_list ap;
- char titlestr[256];
-
- sprintf(titlestr, "OK? %%i%d", ICON_HELP);
+ uiBut *but= arg; /* parent caller */
+ char *propname= but->func_arg1;
- va_start(ap, str);
- vconfirm(C, opname, titlestr, str, ap);
- va_end(ap);
+ uiMenuItemsEnumR(head, &but->rnapoin, propname);
}
-void uiPupmenuSaveOver(bContext *C, char *opname, char *filename, ...)
+static uiBlock *ui_block_func_MENU_ITEM(bContext *C, uiPopupBlockHandle *handle, void *arg_info)
{
- size_t len= strlen(filename);
-
- if(len==0)
- return;
+ uiBlock *block;
+ uiBut *but;
+ uiMenuInfo *info= arg_info;
+ uiMenuItem *head, *item;
+ ScrArea *sa;
+ ARegion *ar;
+ static int counter= 0;
+ int width, height, icon;
+ int startx, starty, x1, y1;
+ char str[16];
+
+ head= info->head;
+ height= 0;
+
+ /* block stuff first, need to know the font */
+ sprintf(str, "tb %d", counter++);
+ block= uiBeginBlock(C, handle->region, str, UI_EMBOSSP, UI_HELV);
+ uiBlockSetButmFunc(block, head->eventfunc, head->argv);
+ block->themecol= TH_MENU_ITEM;
+ block->direction= UI_DOWN;
- if(BLI_exists(filename)==0)
- operator_cb(C, opname, 1);
+ width= 50; // fixed with, uiPopupBoundsBlock will compute actual width
- if(filename[len-1]=='/' || filename[len-1]=='\\') {
- uiPupmenuError(C, "Cannot overwrite a directory");
- return;
+ for(item= head->items.first; item; item= item->next) {
+ if(0) height+= PUP_LABELH; // XXX sepr line
+ else height+= MENU_BUTTON_HEIGHT;
}
- confirm(C, opname, "Save over", filename);
-}
-
-void uiPupmenuNotice(bContext *C, char *str, ...)
-{
- va_list ap;
-
- va_start(ap, str);
- vconfirm(C, NULL, NULL, str, ap);
- va_end(ap);
-}
-
-void uiPupmenuError(bContext *C, char *str, ...)
-{
- va_list ap;
- char nfmt[256];
- char titlestr[256];
+ startx= info->mx;
+ starty= info->my-height+MENU_BUTTON_HEIGHT/2;
+
+ /* here we go! */
+ if(head->name[0]) {
+ char titlestr[256];
+ uiSetCurFont(block, UI_HELVB);
+
+ if(head->icon) {
+ width+= 20;
+ sprintf(titlestr, " %s", head->name);
+ uiDefIconTextBut(block, LABEL, 0, head->icon, titlestr, startx, (short)(starty+height), width, MENU_BUTTON_HEIGHT, NULL, 0.0, 0.0, 0, 0, "");
+ }
+ else {
+ but= uiDefBut(block, LABEL, 0, head->name, startx, (short)(starty+height), width, MENU_BUTTON_HEIGHT, NULL, 0.0, 0.0, 0, 0, "");
+ but->flag= UI_TEXT_LEFT;
+ }
+ uiSetCurFont(block, UI_HELV);
+
+ //uiDefBut(block, SEPR, 0, "", startx, (short)(starty+height)-MENU_SEPR_HEIGHT, width, MENU_SEPR_HEIGHT, NULL, 0.0, 0.0, 0, 0, "");
+ }
+
+ x1= startx;
+ y1= starty + height - MENU_BUTTON_HEIGHT; // - MENU_SEPR_HEIGHT;
+
+ for(item= head->items.first; item; item= item->next) {
+
+ if(item->type==MENU_ITEM_LEVEL) {
+ uiDefIconTextMenuBut(block, item->newlevel, NULL, ICON_RIGHTARROW_THIN, item->name, x1, y1, width+16, MENU_BUTTON_HEIGHT-1, NULL);
+ y1 -= MENU_BUTTON_HEIGHT;
+ }
+ else if(item->type==MENU_ITEM_LEVEL_OPNAME_ENUM) {
+ but= uiDefIconTextMenuBut(block, menu_item_enum_opname_menu, NULL, ICON_RIGHTARROW_THIN, item->name, x1, y1, width+16, MENU_BUTTON_HEIGHT-1, NULL);
+ /* XXX warning, abuse of func_arg! */
+ but->poin= (char*)but;
+ but->func_arg1= item->opname;
+ but->func_arg2= item->propname;
+
+ y1 -= MENU_BUTTON_HEIGHT;
+ }
+ else if(item->type==MENU_ITEM_LEVEL_RNA_ENUM) {
+ but= uiDefIconTextMenuBut(block, menu_item_enum_rna_menu, NULL, ICON_RIGHTARROW_THIN, item->name, x1, y1, width+16, MENU_BUTTON_HEIGHT-1, NULL);
+ /* XXX warning, abuse of func_arg! */
+ but->poin= (char*)but;
+ but->rnapoin= item->rnapoin;
+ but->func_arg1= item->propname;
+
+ y1 -= MENU_BUTTON_HEIGHT;
+ }
+ else if(item->type==MENU_ITEM_OPNAME_BOOL) {
+ but= uiDefIconTextButO(block, BUTM, item->opname, head->opcontext, item->icon, item->name, x1, y1, width+16, MENU_BUTTON_HEIGHT-1, "");
+ RNA_boolean_set(uiButGetOperatorPtrRNA(but), item->propname, item->boolval);
+
+ y1 -= MENU_BUTTON_HEIGHT;
+ }
+ else if(item->type==MENU_ITEM_OPNAME_ENUM) {
+ const char *name;
+ char bname[64];
- sprintf(titlestr, "Error %%i%d", ICON_ERROR);
+ name= ui_menu_enumpropname(item->opname, item->propname, item->enumval);
+ BLI_strncpy(bname, name, sizeof(bname));
+
+ but= uiDefIconTextButO(block, BUTM, item->opname, head->opcontext, item->icon, bname, x1, y1, width+16, MENU_BUTTON_HEIGHT-1, "");
+ RNA_enum_set(uiButGetOperatorPtrRNA(but), item->propname, item->enumval);
+
+ y1 -= MENU_BUTTON_HEIGHT;
+ }
+ else if(item->type==MENU_ITEM_OPNAME_FLOAT) {
+ but= uiDefIconTextButO(block, BUTM, item->opname, head->opcontext, item->icon, item->name, x1, y1, width+16, MENU_BUTTON_HEIGHT-1, "");
+ RNA_float_set(uiButGetOperatorPtrRNA(but), item->propname, item->fltval);
+
+ y1 -= MENU_BUTTON_HEIGHT;
+ }
+ else if(item->type==MENU_ITEM_OPNAME) {
+ uiDefIconTextButO(block, BUTM, item->opname, head->opcontext, item->icon, NULL, x1, y1, width+16, MENU_BUTTON_HEIGHT-1, NULL);
+ y1 -= MENU_BUTTON_HEIGHT;
+ }
+ else if(item->type==MENU_ITEM_RNA_BOOL) {
+ PropertyRNA *prop= RNA_struct_find_property(&item->rnapoin, item->propname);
- sprintf(nfmt, "%s", str);
+ if(prop && RNA_property_type(&item->rnapoin, prop) == PROP_BOOLEAN) {
+ icon= (RNA_property_boolean_get(&item->rnapoin, prop))? ICON_CHECKBOX_HLT: ICON_CHECKBOX_DEHLT;
+ uiDefIconTextButR(block, TOG, 0, icon, NULL, x1, y1, width+16, MENU_BUTTON_HEIGHT-1, &item->rnapoin, item->propname, 0, 0, 0, 0, 0, NULL);
+ }
+ else {
+ uiBlockSetButLock(block, 1, "");
+ uiDefIconTextBut(block, BUT, 0, ICON_BLANK1, item->propname, x1, y1, width+16, MENU_BUTTON_HEIGHT-1, NULL, 0.0, 0.0, 0, 0, "");
+ uiBlockClearButLock(block);
+ }
- va_start(ap, str);
- vconfirm(C, NULL, titlestr, nfmt, ap);
- va_end(ap);
-}
+ y1 -= MENU_BUTTON_HEIGHT;
+ }
+ else if(item->type==MENU_ITEM_RNA_ENUM) {
+ PropertyRNA *prop= RNA_struct_find_property(&item->rnapoin, item->propname);
-void uiPupmenuReports(bContext *C, ReportList *reports)
-{
- Report *report;
- DynStr *ds;
- char *str;
+ if(prop && RNA_property_type(&item->rnapoin, prop) == PROP_ENUM) {
+ icon= (RNA_property_enum_get(&item->rnapoin, prop) == item->enumval)? ICON_CHECKBOX_HLT: ICON_CHECKBOX_DEHLT;
+ uiDefIconTextButR(block, ROW, 0, icon, NULL, x1, y1, width+16, MENU_BUTTON_HEIGHT-1, &item->rnapoin, item->propname, 0, 0, item->enumval, 0, 0, NULL);
+ }
+ else {
+ uiBlockSetButLock(block, 1, "");
+ uiDefIconTextBut(block, BUT, 0, ICON_BLANK1, item->propname, x1, y1, width+16, MENU_BUTTON_HEIGHT-1, NULL, 0.0, 0.0, 0, 0, "");
+ uiBlockClearButLock(block);
+ }
+
+ y1 -= MENU_BUTTON_HEIGHT;
+ }
+ else if(item->type == MENU_ITEM_ITEM) {
+ uiDefIconTextButF(block, BUTM, B_NOP, item->icon, item->name, x1, y1, width+16, MENU_BUTTON_HEIGHT-1, &handle->retvalue, 0.0, 0.0, 0, item->retval, "");
+ y1 -= MENU_BUTTON_HEIGHT;
+ }
+ else {
+ uiDefBut(block, SEPR, 0, "", x1, y1, width+16, MENU_SEPR_HEIGHT-1, NULL, 0.0, 0.0, 0, 0, "");
+ y1 -= MENU_SEPR_HEIGHT;
+ }
+ }
- if(!reports || !reports->list.first)
- return;
- if(!CTX_wm_window(C))
- return;
+ if(info->popup) {
+ uiBlockSetFlag(block, UI_BLOCK_LOOP|UI_BLOCK_REDRAW|UI_BLOCK_NUMSELECT|UI_BLOCK_RET_1);
+ uiBlockSetDirection(block, UI_DOWN);
- ds= BLI_dynstr_new();
+ uiPopupBoundsBlock(block, 1);
+ }
+ else {
+ /* for a header menu we set the direction automatic */
+ if(!info->slideout) {
+ sa= CTX_wm_area(C);
+ ar= CTX_wm_region(C);
+
+ if(sa && sa->headertype==HEADERDOWN) {
+ if(ar && ar->regiontype == RGN_TYPE_HEADER) {
+ uiBlockSetDirection(block, UI_TOP);
+ uiBlockFlipOrder(block);
+ }
+ }
+ }
- for(report=reports->list.first; report; report=report->next) {
- if(report->type >= RPT_ERROR)
- BLI_dynstr_appendf(ds, "Error %%i%d%%t|%s", ICON_ERROR, report->message);
- else if(report->type >= RPT_WARNING)
- BLI_dynstr_appendf(ds, "Warning %%i%d%%t|%s", ICON_ERROR, report->message);
+ uiTextBoundsBlock(block, 50);
}
- str= BLI_dynstr_get_cstring(ds);
- uiPupmenu(C, 0, NULL, NULL, str);
- MEM_freeN(str);
+ /* if menu slides out of other menu, override direction */
+ if(info->slideout)
+ uiBlockSetDirection(block, UI_RIGHT);
- BLI_dynstr_free(ds);
+ uiEndBlock(C, block);
+
+ return block;
}
-/* ******************* customize own menus, toolbox *************** */
-
-/* prototype */
-static uiBlock *ui_block_func_MENU_ITEM(bContext *C, uiMenuBlockHandle *handle, void *arg_info);
-
-#define MAX_MENU_STR 64
-
-/* type, internal */
-#define MENU_ITEM_TITLE 0
-#define MENU_ITEM_ITEM 1
-#define MENU_ITEM_OPNAME 2
-#define MENU_ITEM_OPNAME_ENUM 3
-#define MENU_ITEM_LEVEL 4
-#define MENU_ITEM_LEVEL_ENUM 5
-
-struct uiMenuItem {
- struct uiMenuItem *next, *prev;
+uiPopupBlockHandle *ui_popup_menu_create(bContext *C, ARegion *butregion, uiBut *but, uiMenuCreateFunc menu_func, void *arg)
+{
+ uiPopupBlockHandle *handle;
+ uiMenuItem *head;
+ uiMenuInfo info;
- int type;
- int icon;
- char name[MAX_MENU_STR];
+ head= MEM_callocN(sizeof(uiMenuItem), "menu dummy");
+ head->opcontext= WM_OP_EXEC_REGION_WIN;
+
+ menu_func(C, head, arg);
- char *opname; /* static string */
- char *propname; /* static string */
+ memset(&info, 0, sizeof(info));
+ info.head= head;
+ info.slideout= (but && (but->block->flag & UI_BLOCK_LOOP));
- int retval;
- int opcontext;
- void (*eventfunc)(bContext *, void *, int);
- void *argv;
- void (*newlevel)(uiMenuItem *);
+ handle= ui_popup_block_create(C, butregion, but, NULL, ui_block_func_MENU_ITEM, &info);
- ListBase items;
-};
+ BLI_freelistN(&head->items);
+ MEM_freeN(head);
-typedef struct uiMenuInfo {
- uiMenuItem *head;
- int mx, my;
- int startx, starty;
-} uiMenuInfo;
+ return handle;
+}
+
+/*************************** Menu Creating API **************************/
/* internal add func */
static uiMenuItem *ui_menu_add_item(uiMenuItem *head, const char *name, int icon, int argval)
@@ -1859,22 +1961,6 @@ static uiMenuItem *ui_menu_add_item(uiMenuItem *head, const char *name, int icon
return item;
}
-
-/* only return handler, and set optional title */
-uiMenuItem *uiMenuBegin(const char *title)
-{
- uiMenuItem *item= MEM_callocN(sizeof(uiMenuItem), "menu start");
-
- item->type = MENU_ITEM_TITLE;
- item->opcontext= WM_OP_EXEC_REGION_WIN;
-
- /* NULL is no title */
- if(title)
- BLI_strncpy(item->name, title, MAX_MENU_STR);
-
- return item;
-}
-
/* set callback for regular items */
void uiMenuFunc(uiMenuItem *head, void (*eventfunc)(bContext *, void *, int), void *argv)
{
@@ -1906,48 +1992,103 @@ void uiMenuItemO(uiMenuItem *head, char *name, int icon)
item->type = MENU_ITEM_OPNAME;
}
-/* Single operator item with property */
+/* single operator item with property */
void uiMenuItemEnumO(uiMenuItem *head, char *opname, char *propname, int value)
{
uiMenuItem *item= ui_menu_add_item(head, "", 0, 0);
item->opname= opname; // static!
item->propname= propname; // static!
- item->retval= value;
+ item->enumval= value;
item->type = MENU_ITEM_OPNAME_ENUM;
}
-/* Add all operator items with property */
+/* single operator item with property */
+void uiMenuItemFloatO(uiMenuItem *head, const char *name, char *opname, char *propname, float value)
+{
+ uiMenuItem *item= ui_menu_add_item(head, name, 0, 0);
+
+ item->opname= opname; // static!
+ item->propname= propname; // static!
+ item->fltval= value;
+ item->type = MENU_ITEM_OPNAME_FLOAT;
+}
+
+/* single operator item with property */
+void uiMenuItemBooleanO(uiMenuItem *head, char *opname, char *propname, int value)
+{
+ uiMenuItem *item= ui_menu_add_item(head, "", 0, 0);
+
+ item->opname= opname; // static!
+ item->propname= propname; // static!
+ item->boolval= value;
+ item->type = MENU_ITEM_OPNAME_BOOL;
+}
+
+/* add all operator items with property */
void uiMenuItemsEnumO(uiMenuItem *head, char *opname, char *propname)
{
- wmOperatorType *ot;
+ wmOperatorType *ot= WM_operatortype_find(opname);
+ PointerRNA ptr;
+ PropertyRNA *prop;
+
+ if(!ot || !ot->srna)
+ return;
- ot= WM_operatortype_find(opname);
- if(ot) {
- PointerRNA *opptr= MEM_callocN(sizeof(PointerRNA), "uiButOpPtr");
- PropertyRNA *prop;
+ RNA_pointer_create(NULL, ot->srna, NULL, &ptr);
+ prop= RNA_struct_find_property(&ptr, propname);
+
+ if(prop && RNA_property_type(&ptr, prop) == PROP_ENUM) {
+ const EnumPropertyItem *item;
+ int totitem, i;
- WM_operator_properties_create(opptr, opname);
- prop= RNA_struct_find_property(opptr, propname);
+ RNA_property_enum_items(&ptr, prop, &item, &totitem);
- if(prop) {
- const EnumPropertyItem *item;
- int totitem, i;
-
- RNA_property_enum_items(opptr, prop, &item, &totitem);
-
- for (i=0; i<totitem; i++) {
- uiMenuItemEnumO(head, opname, propname, item[i].value);
- }
- }
- WM_operator_properties_free(opptr);
- MEM_freeN(opptr);
+ for (i=0; i<totitem; i++)
+ uiMenuItemEnumO(head, opname, propname, item[i].value);
}
}
+/* rna property toggle */
+void uiMenuItemBooleanR(uiMenuItem *head, PointerRNA *ptr, char *propname)
+{
+ uiMenuItem *item= ui_menu_add_item(head, "", 0, 0);
+
+ item->propname= propname; // static!
+ item->rnapoin= *ptr;
+ item->type = MENU_ITEM_RNA_BOOL;
+}
+
+void uiMenuItemEnumR(uiMenuItem *head, PointerRNA *ptr, char *propname, int value)
+{
+ uiMenuItem *item= ui_menu_add_item(head, "", 0, 0);
+
+ item->propname= propname; // static!
+ item->rnapoin= *ptr;
+ item->enumval= value;
+ item->type = MENU_ITEM_RNA_ENUM;
+}
+
+/* add all rna items with property */
+void uiMenuItemsEnumR(uiMenuItem *head, PointerRNA *ptr, char *propname)
+{
+ PropertyRNA *prop;
+
+ prop= RNA_struct_find_property(ptr, propname);
+
+ if(prop && RNA_property_type(ptr, prop) == PROP_ENUM) {
+ const EnumPropertyItem *item;
+ int totitem, i;
+
+ RNA_property_enum_items(ptr, prop, &item, &totitem);
+
+ for (i=0; i<totitem; i++)
+ uiMenuItemEnumR(head, ptr, propname, item[i].value);
+ }
+}
/* generic new menu level */
-void uiMenuLevel(uiMenuItem *head, const char *name, void (*newlevel)(uiMenuItem *))
+void uiMenuLevel(uiMenuItem *head, const char *name, uiMenuCreateFunc newlevel)
{
uiMenuItem *item= ui_menu_add_item(head, name, 0, 0);
@@ -1961,7 +2102,7 @@ void uiMenuLevelEnumO(uiMenuItem *head, char *opname, char *propname)
uiMenuItem *item= ui_menu_add_item(head, "", 0, 0);
wmOperatorType *ot;
- item->type = MENU_ITEM_LEVEL_ENUM;
+ item->type = MENU_ITEM_LEVEL_OPNAME_ENUM;
ot= WM_operatortype_find(opname);
if(ot)
BLI_strncpy(item->name, ot->name, MAX_MENU_STR);
@@ -1972,19 +2113,62 @@ void uiMenuLevelEnumO(uiMenuItem *head, char *opname, char *propname)
BLI_addtail(&head->items, item);
}
+/* make a new level from enum properties */
+void uiMenuLevelEnumR(uiMenuItem *head, PointerRNA *ptr, char *propname)
+{
+ uiMenuItem *item= ui_menu_add_item(head, "", 0, 0);
+ PropertyRNA *prop;
+
+ item->type = MENU_ITEM_LEVEL_RNA_ENUM;
+ prop= RNA_struct_find_property(ptr, propname);
+ if(prop)
+ BLI_strncpy(item->name, RNA_property_ui_name(ptr, prop), MAX_MENU_STR);
+
+ item->rnapoin= *ptr;
+ item->propname= propname; // static!
+
+ BLI_addtail(&head->items, item);
+}
+
+/* separator */
+void uiMenuSeparator(uiMenuItem *head)
+{
+ uiMenuItem *item= ui_menu_add_item(head, "", 0, 0);
+
+ item->type = MENU_ITEM_SEPARATOR;
+}
+
+/*************************** Popup Menu API **************************/
+
+/* only return handler, and set optional title */
+uiMenuItem *uiPupMenuBegin(const char *title)
+{
+ uiMenuItem *item= MEM_callocN(sizeof(uiMenuItem), "menu start");
+
+ item->type = MENU_ITEM_TITLE;
+ item->opcontext= WM_OP_EXEC_REGION_WIN;
+
+ /* NULL is no title */
+ if(title)
+ BLI_strncpy(item->name, title, MAX_MENU_STR);
+
+ return item;
+}
+
/* set the whole structure to work */
-void uiMenuEnd(bContext *C, uiMenuItem *head)
+void uiPupMenuEnd(bContext *C, uiMenuItem *head)
{
wmWindow *window= CTX_wm_window(C);
uiMenuInfo info;
- uiMenuBlockHandle *menu;
+ uiPopupBlockHandle *menu;
memset(&info, 0, sizeof(info));
+ info.popup= 1;
info.mx= window->eventstate->x;
info.my= window->eventstate->y;
info.head= head;
- menu= ui_menu_block_create(C, NULL, NULL, ui_block_func_MENU_ITEM, &info);
+ menu= ui_popup_block_create(C, NULL, NULL, NULL, ui_block_func_MENU_ITEM, &info);
menu->popup= 1;
UI_add_popup_handlers(&window->handlers, menu);
@@ -1994,239 +2178,163 @@ void uiMenuEnd(bContext *C, uiMenuItem *head)
MEM_freeN(head);
}
-/* *********** internal code for menu/toolbox system */
-
-const char *ui_menu_enumpropname(PointerRNA *opptr, const char *propname, int retval)
+/* This one will set enum propname, call operator and register it, and free the operator itself,
+ call it in op->invoke with returning OPERATOR_RUNNING_MODAL */
+/* Note: propname has to be static */
+void uiPupMenuOperator(bContext *C, int maxrow, wmOperator *op, const char *propname, char *str)
{
- PropertyRNA *prop;
+ wmWindow *window= CTX_wm_window(C);
+ uiPupMenuInfo info;
+ uiPopupBlockHandle *menu;
- prop= RNA_struct_find_property(opptr, propname);
+ memset(&info, 0, sizeof(info));
+ info.mx= window->eventstate->x;
+ info.my= window->eventstate->y;
+ info.maxrow= maxrow;
+ info.instr= str;
- if(prop) {
- const EnumPropertyItem *item;
- int totitem, i;
-
- RNA_property_enum_items(opptr, prop, &item, &totitem);
-
- for (i=0; i<totitem; i++) {
- if(item[i].value==retval)
- return item[i].name;
- }
- }
- return "";
+ menu= ui_popup_block_create(C, NULL, NULL, NULL, ui_block_func_PUPMENU, &info);
+ menu->popup= 1;
+
+ UI_add_popup_handlers(&window->handlers, menu);
+ WM_event_add_mousemove(C);
+
+ menu->op_arg= op;
+ menu->propname= propname;
}
-/* make a menu level from uiMenuItems */
-static uiBlock *menu_item_makemenu(bContext *C, uiMenuBlockHandle *handle, void *arg)
+
+/* this one only to be called with operatortype name option */
+void uiPupMenu(bContext *C, int maxrow, uiMenuHandleFunc func, void *arg, char *str, ...)
{
- uiBlock *block;
- uiMenuInfo info;
- uiMenuItem *head;
- void (*newlevel)(uiMenuItem *)= arg;
-
- if(arg==NULL) return NULL;
-
- head= MEM_callocN(sizeof(uiMenuItem), "sub level item");
- head->opcontext= WM_OP_EXEC_REGION_WIN;
+ wmWindow *window= CTX_wm_window(C);
+ uiPupMenuInfo info;
+ uiPopupBlockHandle *menu;
- newlevel(head);
-
memset(&info, 0, sizeof(info));
- info.head= head;
-
- block= ui_block_func_MENU_ITEM(C, handle, &info);
- block->direction= UI_RIGHT;
-
- BLI_freelistN(&head->items);
- MEM_freeN(head);
-
- return block;
+ info.mx= window->eventstate->x;
+ info.my= window->eventstate->y;
+ info.maxrow= maxrow;
+ info.instr= str;
+
+ menu= ui_popup_block_create(C, NULL, NULL, NULL, ui_block_func_PUPMENU, &info);
+ menu->popup= 1;
+
+ UI_add_popup_handlers(&window->handlers, menu);
+ WM_event_add_mousemove(C);
+
+ menu->popup_func= func;
+ menu->popup_arg= arg;
}
-/* make a menu level from enum properties */
-static uiBlock *menu_item_enum_menu(bContext *C, uiMenuBlockHandle *handle, void *arg)
+/* standard pupmenus */
+
+static void operator_cb(bContext *C, void *arg, int retval)
{
- uiBlock *block;
- uiBut *but= arg; /* parent caller */
- wmOperatorType *ot;
- uiMenuInfo info;
- uiMenuItem *head;
-
- head= MEM_callocN(sizeof(uiMenuItem), "sub level item");
- head->opcontext= WM_OP_EXEC_REGION_WIN;
-
- ot= WM_operatortype_find(but->func_arg1);
- if(ot) {
- PointerRNA *opptr= MEM_callocN(sizeof(PointerRNA), "uiButOpPtr");
- PropertyRNA *prop;
-
- WM_operator_properties_create(opptr, but->func_arg1);
- prop= RNA_struct_find_property(opptr, but->func_arg2);
-
- if(prop) {
- const EnumPropertyItem *item;
- int totitem, i;
-
- RNA_property_enum_items(opptr, prop, &item, &totitem);
-
- for (i=0; i<totitem; i++) {
- uiMenuItemEnumO(head, but->func_arg1, but->func_arg2, item[i].value);
- }
- }
- WM_operator_properties_free(opptr);
- MEM_freeN(opptr);
- }
-
- memset(&info, 0, sizeof(info));
- info.head= head;
+ const char *opname= arg;
- block= ui_block_func_MENU_ITEM(C, handle, &info);
- block->direction= UI_RIGHT;
-
- BLI_freelistN(&head->items);
- MEM_freeN(head);
-
- return block;
+ if(opname && retval > 0)
+ WM_operator_name_call(C, opname, WM_OP_EXEC_DEFAULT, NULL);
}
-static uiBlock *ui_block_func_MENU_ITEM(bContext *C, uiMenuBlockHandle *handle, void *arg_info)
+static void vconfirm(bContext *C, char *opname, char *title, char *itemfmt, va_list ap)
{
- uiBlock *block;
- uiBut *but;
- uiMenuInfo *info= arg_info;
- uiMenuItem *head, *item;
- static int counter= 0;
- int width, height, xmax, ymax;
- int startx, starty, endx, endy, x1, y1;
- char str[16];
-
- head= info->head;
- height= 0;
-
- /* block stuff first, need to know the font */
- sprintf(str, "tb %d", counter++);
- block= uiBeginBlock(C, handle->region, str, UI_EMBOSSP, UI_HELV);
- uiBlockSetFlag(block, UI_BLOCK_LOOP|UI_BLOCK_REDRAW|UI_BLOCK_RET_1|UI_BLOCK_NUMSELECT);
- uiBlockSetButmFunc(block, head->eventfunc, head->argv);
- block->themecol= TH_MENU_ITEM;
- block->direction= UI_DOWN;
-
- /* size and location, title slightly bigger for bold */
- if(head->name[0]) {
- width= 2*strlen(head->name)+UI_GetStringWidth(uiBlockGetCurFont(block), head->name, ui_translate_buttons());
- }
- else width= UI_GetStringWidth(uiBlockGetCurFont(block), "Standardtext", ui_translate_buttons());
-
- for(item= head->items.first; item; item= item->next) {
- xmax= UI_GetStringWidth(uiBlockGetCurFont(block), item->name, ui_translate_buttons());
- if(xmax>width) width= xmax;
-
- if(0) height+= PUP_LABELH; // XXX sepr line
- else height+= MENU_BUTTON_HEIGHT;
- }
-
- width+= 10;
- if (width<50) width=50;
-
- wm_window_get_size(CTX_wm_window(C), &xmax, &ymax);
-
- /* boundbox */
-
- startx= info->mx-(0.8*(width));
- starty= info->my-height+MENU_BUTTON_HEIGHT/2;
-
- if(startx<10) {
- startx= 10;
- }
- if(starty<10) {
- starty= 10;
- }
-
- endx= startx+width;
- endy= starty+height;
-
- if(endx>xmax) {
- endx= xmax-10;
- startx= endx-width;
- }
- if(endy>ymax-20) {
- endy= ymax-20;
- starty= endy-height;
- }
-
- /* here we go! */
- if(head->name[0]) {
- char titlestr[256];
- uiSetCurFont(block, UI_HELVB);
-
- if(head->icon) {
- width+= 20;
- sprintf(titlestr, " %s", head->name);
- uiDefIconTextBut(block, LABEL, 0, head->icon, titlestr, startx, (short)(starty+height), width, MENU_BUTTON_HEIGHT, NULL, 0.0, 0.0, 0, 0, "");
- }
- else {
- but= uiDefBut(block, LABEL, 0, head->name, startx, (short)(starty+height), width, MENU_BUTTON_HEIGHT, NULL, 0.0, 0.0, 0, 0, "");
- but->flag= UI_TEXT_LEFT;
- }
- uiSetCurFont(block, UI_HELV);
-
- //uiDefBut(block, SEPR, 0, "", startx, (short)(starty+height)-MENU_SEPR_HEIGHT, width, MENU_SEPR_HEIGHT, NULL, 0.0, 0.0, 0, 0, "");
- }
-
- x1= startx;
- y1= starty + height - MENU_BUTTON_HEIGHT; // - MENU_SEPR_HEIGHT;
-
- for(item= head->items.first; item; item= item->next) {
-
- if(0) { // SEPR
- uiDefBut(block, SEPR, B_NOP, "", x1, y1, width, PUP_LABELH, NULL, 0, 0.0, 0, 0, "");
- y1 -= PUP_LABELH;
- }
- else if(item->type==MENU_ITEM_LEVEL) {
- uiDefIconTextBlockBut(block, menu_item_makemenu, item->newlevel, ICON_RIGHTARROW_THIN, item->name, x1, y1, width+16, MENU_BUTTON_HEIGHT-1, NULL);
- y1 -= MENU_BUTTON_HEIGHT;
- }
- else if(item->type==MENU_ITEM_LEVEL_ENUM) {
- but= uiDefIconTextBlockBut(block, menu_item_enum_menu, NULL, ICON_RIGHTARROW_THIN, item->name, x1, y1, width+16, MENU_BUTTON_HEIGHT-1, NULL);
- /* XXX warning, abuse of func_arg! */
- but->poin= (char *)but;
- but->func_arg1= item->opname;
- but->func_arg2= item->propname;
-
- y1 -= MENU_BUTTON_HEIGHT;
- }
- else if(item->type==MENU_ITEM_OPNAME_ENUM) {
- PointerRNA *opptr= MEM_callocN(sizeof(PointerRNA), "uiButOpPtr");
- char bname[64];
- const char *name;
-
- WM_operator_properties_create(opptr, item->opname);
- RNA_enum_set(opptr, item->propname, item->retval);
- name= ui_menu_enumpropname(opptr, item->propname, item->retval);
- BLI_strncpy(bname, name, 64);
-
- but= uiDefIconTextBut(block, BUTM, item->retval, item->icon, bname, x1, y1, width+16, MENU_BUTTON_HEIGHT-1, NULL, 0.0, 0.0, 0, 0, "");
-
- but->opptr= opptr;
- but->opname= item->opname;
- but->opcontext= head->opcontext;
-
- y1 -= MENU_BUTTON_HEIGHT;
- }
- else if(item->type==MENU_ITEM_OPNAME) {
- uiDefIconTextButO(block, BUTM, item->opname, head->opcontext, item->icon, NULL, x1, y1, width+16, MENU_BUTTON_HEIGHT-1, NULL);
- y1 -= MENU_BUTTON_HEIGHT;
- }
- else {
- uiDefIconTextButF(block, BUTM, B_NOP, item->icon, item->name, x1, y1, width+16, MENU_BUTTON_HEIGHT-1, &handle->retvalue, 0.0, 0.0, 0, item->retval, "");
- y1 -= MENU_BUTTON_HEIGHT;
- }
+ char *s, buf[512];
+
+ s= buf;
+ if (title) s+= sprintf(s, "%s%%t|", title);
+ vsprintf(s, itemfmt, ap);
+
+ uiPupMenu(C, 0, operator_cb, opname, buf);
+}
+
+static void confirm(bContext *C, char *opname, char *title, char *itemfmt, ...)
+{
+ va_list ap;
+
+ va_start(ap, itemfmt);
+ vconfirm(C, opname, title, itemfmt, ap);
+ va_end(ap);
+}
+
+void uiPupMenuOkee(bContext *C, char *opname, char *str, ...)
+{
+ va_list ap;
+ char titlestr[256];
+
+ sprintf(titlestr, "OK? %%i%d", ICON_HELP);
+
+ va_start(ap, str);
+ vconfirm(C, opname, titlestr, str, ap);
+ va_end(ap);
+}
+
+void uiPupMenuSaveOver(bContext *C, char *opname, char *filename, ...)
+{
+ size_t len= strlen(filename);
+
+ if(len==0)
+ return;
+
+ if(BLI_exists(filename)==0)
+ operator_cb(C, opname, 1);
+
+ if(filename[len-1]=='/' || filename[len-1]=='\\') {
+ uiPupMenuError(C, "Cannot overwrite a directory");
+ return;
}
-
- uiBoundsBlock(block, 1);
- uiEndBlock(C, block);
-
- return block;
+
+ confirm(C, opname, "Save over", filename);
}
+void uiPupMenuNotice(bContext *C, char *str, ...)
+{
+ va_list ap;
+
+ va_start(ap, str);
+ vconfirm(C, NULL, NULL, str, ap);
+ va_end(ap);
+}
+
+void uiPupMenuError(bContext *C, char *str, ...)
+{
+ va_list ap;
+ char nfmt[256];
+ char titlestr[256];
+
+ sprintf(titlestr, "Error %%i%d", ICON_ERROR);
+
+ sprintf(nfmt, "%s", str);
+
+ va_start(ap, str);
+ vconfirm(C, NULL, titlestr, nfmt, ap);
+ va_end(ap);
+}
+
+void uiPupMenuReports(bContext *C, ReportList *reports)
+{
+ Report *report;
+ DynStr *ds;
+ char *str;
+
+ if(!reports || !reports->list.first)
+ return;
+ if(!CTX_wm_window(C))
+ return;
+
+ ds= BLI_dynstr_new();
+
+ for(report=reports->list.first; report; report=report->next) {
+ if(report->type >= RPT_ERROR)
+ BLI_dynstr_appendf(ds, "Error %%i%d%%t|%s", ICON_ERROR, report->message);
+ else if(report->type >= RPT_WARNING)
+ BLI_dynstr_appendf(ds, "Warning %%i%d%%t|%s", ICON_ERROR, report->message);
+ }
+
+ str= BLI_dynstr_get_cstring(ds);
+ uiPupMenu(C, 0, NULL, NULL, str);
+ MEM_freeN(str);
+
+ BLI_dynstr_free(ds);
+}
diff --git a/source/blender/editors/mesh/editmesh_tools.c b/source/blender/editors/mesh/editmesh_tools.c
index c0fb38b8839..3a9faec7e93 100644
--- a/source/blender/editors/mesh/editmesh_tools.c
+++ b/source/blender/editors/mesh/editmesh_tools.c
@@ -6478,7 +6478,7 @@ static int subdivs_invoke(bContext *C, wmOperator *op, wmEvent *event)
p+= sprintf(p, "|%s %%x%d", "fractal", 1);
p+= sprintf(p, "|%s %%x%d", "smooth", 0);
- uiPupmenuOperator(C, 20, op, "index", menu);
+ uiPupMenuOperator(C, 20, op, "index", menu);
MEM_freeN(menu);
return OPERATOR_RUNNING_MODAL;
@@ -6740,7 +6740,7 @@ static int edit_faces_invoke(bContext *C, wmOperator *op, wmEvent *event)
p+= sprintf(p, "|%s %%x%d", "set solid", 0);
- uiPupmenuOperator(C, 20, op, "index", menu);
+ uiPupMenuOperator(C, 20, op, "index", menu);
MEM_freeN(menu);
return OPERATOR_RUNNING_MODAL;
@@ -6794,4 +6794,4 @@ void MESH_OT_edit_faces(wmOperatorType *ot)
/*props */
RNA_def_int(ot->srna, "index", 0, 0, INT_MAX, "Index", "", 0, 1000);
-} \ No newline at end of file
+}
diff --git a/source/blender/editors/object/object_edit.c b/source/blender/editors/object/object_edit.c
index f53fbc3f835..6bf8cde7942 100644
--- a/source/blender/editors/object/object_edit.c
+++ b/source/blender/editors/object/object_edit.c
@@ -474,7 +474,7 @@ void OBJECT_OT_curve_add(wmOperatorType *ot)
static int object_add_primitive_invoke(bContext *C, wmOperator *op, wmEvent *event)
{
- uiMenuItem *head= uiMenuBegin("Add Object");
+ uiMenuItem *head= uiPupMenuBegin("Add Object");
uiMenuLevelEnumO(head, "OBJECT_OT_mesh_add", "type");
uiMenuLevelEnumO(head, "OBJECT_OT_curve_add", "type");
@@ -486,7 +486,7 @@ static int object_add_primitive_invoke(bContext *C, wmOperator *op, wmEvent *eve
uiMenuItemEnumO(head, "OBJECT_OT_object_add", "type", OB_ARMATURE);
uiMenuItemEnumO(head, "OBJECT_OT_object_add", "type", OB_LATTICE);
- uiMenuEnd(C, head);
+ uiPupMenuEnd(C, head);
/* this operator is only for a menu, not used further */
return OPERATOR_CANCELLED;
@@ -2425,7 +2425,7 @@ static int make_parent_exec(bContext *C, wmOperator *op)
static int make_parent_invoke(bContext *C, wmOperator *op, wmEvent *event)
{
Object *ob= CTX_data_active_object(C);
- uiMenuItem *head= uiMenuBegin("Make Parent To");
+ uiMenuItem *head= uiPupMenuBegin("Make Parent To");
uiMenuContext(head, WM_OP_EXEC_DEFAULT);
uiMenuItemEnumO(head, "OBJECT_OT_make_parent", "type", PAR_OBJECT);
@@ -2444,7 +2444,7 @@ static int make_parent_invoke(bContext *C, wmOperator *op, wmEvent *event)
uiMenuItemEnumO(head, "OBJECT_OT_make_parent", "type", PAR_LATTICE);
}
- uiMenuEnd(C, head);
+ uiPupMenuEnd(C, head);
return OPERATOR_RUNNING_MODAL;
}
diff --git a/source/blender/editors/screen/screen_ops.c b/source/blender/editors/screen/screen_ops.c
index 62bdfb5980b..2cf440ad62e 100644
--- a/source/blender/editors/screen/screen_ops.c
+++ b/source/blender/editors/screen/screen_ops.c
@@ -1359,7 +1359,7 @@ static int repeat_history_invoke(bContext *C, wmOperator *op, wmEvent *event)
for (i=items-1, lastop= wm->operators.last; lastop; lastop= lastop->prev, i--)
p+= sprintf(p, "|%s %%x%d", lastop->type->name, i);
- uiPupmenuOperator(C, i/20, op, "index", menu);
+ uiPupMenuOperator(C, i/20, op, "index", menu);
MEM_freeN(menu);
return OPERATOR_RUNNING_MODAL;
@@ -1559,7 +1559,7 @@ static void testfunc(bContext *C, void *argv, int arg)
printf("arg %d\n", arg);
}
-static void newlevel1(uiMenuItem *head)
+static void newlevel1(bContext *C, uiMenuItem *head, void *arg)
{
uiMenuFunc(head, testfunc, NULL);
@@ -1571,7 +1571,7 @@ static void newlevel1(uiMenuItem *head)
static int testing123(bContext *C, wmOperator *op, wmEvent *event)
{
- uiMenuItem *head= uiMenuBegin("Hello world");
+ uiMenuItem *head= uiPupMenuBegin("Hello world");
uiMenuContext(head, WM_OP_EXEC_DEFAULT);
uiMenuItemO(head, "SCREEN_OT_region_flip", ICON_PROP_ON);
@@ -1580,7 +1580,7 @@ static int testing123(bContext *C, wmOperator *op, wmEvent *event)
uiMenuLevel(head, "Submenu", newlevel1);
uiMenuItemO(head, "SCREEN_OT_area_rip", ICON_PROP_ON);
- uiMenuEnd(C, head);
+ uiPupMenuEnd(C, head);
/* this operator is only for a menu, not used further */
return OPERATOR_CANCELLED;
diff --git a/source/blender/editors/space_action/action_header.c b/source/blender/editors/space_action/action_header.c
index 2e8b34742b0..dedca434ce8 100644
--- a/source/blender/editors/space_action/action_header.c
+++ b/source/blender/editors/space_action/action_header.c
@@ -247,12 +247,12 @@ static void do_keymenu_transformmenu(bContext *C, void *arg, int event)
}
}
-static uiBlock *action_keymenu_transformmenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused)
+static uiBlock *action_keymenu_transformmenu(bContext *C, ARegion *ar, void *arg_unused)
{
uiBlock *block;
short yco= 0, menuwidth=120;
- block= uiBeginBlock(C, handle->region, "action_keymenu_transformmenu", UI_EMBOSSP, UI_HELV);
+ block= uiBeginBlock(C, ar, "action_keymenu_transformmenu", UI_EMBOSSP, UI_HELV);
uiBlockSetButmFunc(block, do_keymenu_transformmenu, NULL);
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1,
@@ -293,14 +293,14 @@ static void do_keymenu_snapmenu(bContext *C, void *arg, int event)
}
}
-static uiBlock *action_keymenu_snapmenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused)
+static uiBlock *action_keymenu_snapmenu(bContext *C, ARegion *ar, void *arg_unused)
{
SpaceAction *saction= (SpaceAction*)CTX_wm_space_data(C);
uiBlock *block;
short yco= 0, menuwidth=120;
- block= uiBeginBlock(C, handle->region, "action_keymenu_snapmenu", UI_EMBOSSP, UI_HELV);
+ block= uiBeginBlock(C, ar, "action_keymenu_snapmenu", UI_EMBOSSP, UI_HELV);
uiBlockSetButmFunc(block, do_keymenu_snapmenu, NULL);
if (saction->flag & SACTION_DRAWTIME) {
@@ -357,12 +357,12 @@ static void do_keymenu_mirrormenu(bContext *C, void *arg, int event)
}
-static uiBlock *action_keymenu_mirrormenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused)
+static uiBlock *action_keymenu_mirrormenu(bContext *C, ARegion *ar, void *arg_unused)
{
uiBlock *block;
short yco= 0, menuwidth=120;
- block= uiBeginBlock(C, handle->region, "action_keymenu_mirrormenu", UI_EMBOSSP, UI_HELV);
+ block= uiBeginBlock(C, ar, "action_keymenu_mirrormenu", UI_EMBOSSP, UI_HELV);
uiBlockSetButmFunc(block, do_keymenu_mirrormenu, NULL);
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1,
@@ -411,12 +411,12 @@ static void do_keymenu_handlemenu(bContext *C, void *arg, int event)
}
}
-static uiBlock *action_keymenu_handlemenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused)
+static uiBlock *action_keymenu_handlemenu(bContext *C, ARegion *ar, void *arg_unused)
{
uiBlock *block;
short yco= 0, menuwidth=120;
- block= uiBeginBlock(C, handle->region, "action_keymenu_handlemenu", UI_EMBOSSP, UI_HELV);
+ block= uiBeginBlock(C, ar, "action_keymenu_handlemenu", UI_EMBOSSP, UI_HELV);
uiBlockSetButmFunc(block, do_keymenu_handlemenu, NULL);
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1,
@@ -463,12 +463,12 @@ static void do_keymenu_extendmenu(bContext *C, void *arg, int event)
}
}
-static uiBlock *action_keymenu_extendmenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused)
+static uiBlock *action_keymenu_extendmenu(bContext *C, ARegion *ar, void *arg_unused)
{
uiBlock *block;
short yco= 0, menuwidth=120;
- block= uiBeginBlock(C, handle->region, "action_keymenu_extendmenu", UI_EMBOSSP, UI_HELV);
+ block= uiBeginBlock(C, ar, "action_keymenu_extendmenu", UI_EMBOSSP, UI_HELV);
uiBlockSetButmFunc(block, do_keymenu_extendmenu, NULL);
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1,
@@ -512,12 +512,12 @@ static void do_keymenu_intpolmenu(bContext *C, void *arg, int event)
}
}
-static uiBlock *action_keymenu_intpolmenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused)
+static uiBlock *action_keymenu_intpolmenu(bContext *C, ARegion *ar, void *arg_unused)
{
uiBlock *block;
short yco= 0, menuwidth=120;
- block= uiBeginBlock(C, handle->region, "action_keymenu_intpolmenu", UI_EMBOSSP, UI_HELV);
+ block= uiBeginBlock(C, ar, "action_keymenu_intpolmenu", UI_EMBOSSP, UI_HELV);
uiBlockSetButmFunc(block, do_keymenu_intpolmenu, NULL);
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1,
@@ -572,13 +572,13 @@ static void do_action_keymenu(bContext *C, void *arg, int event)
}
}
-static uiBlock *action_keymenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused)
+static uiBlock *action_keymenu(bContext *C, ARegion *ar, void *arg_unused)
{
ScrArea *curarea= CTX_wm_area(C);
uiBlock *block;
short yco= 0, menuwidth=120;
- block= uiBeginBlock(C, handle->region, "action_keymenu", UI_EMBOSSP, UI_HELV);
+ block= uiBeginBlock(C, ar, "action_keymenu", UI_EMBOSSP, UI_HELV);
uiBlockSetButmFunc(block, do_action_keymenu, NULL);
@@ -661,13 +661,13 @@ static uiBlock *action_keymenu(bContext *C, uiMenuBlockHandle *handle, void *arg
// framemenu uses functions from keymenu
-static uiBlock *action_framemenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused)
+static uiBlock *action_framemenu(bContext *C, ARegion *ar, void *arg_unused)
{
ScrArea *curarea= CTX_wm_area(C);
uiBlock *block;
short yco= 0, menuwidth=120;
- block= uiBeginBlock(C, handle->region, "action_framemenu", UI_EMBOSSP, UI_HELV);
+ block= uiBeginBlock(C, ar, "action_framemenu", UI_EMBOSSP, UI_HELV);
uiBlockSetButmFunc(block, do_action_keymenu, NULL);
uiDefIconTextBlockBut(block, action_keymenu_transformmenu,
@@ -744,14 +744,14 @@ static void do_markermenu(bContext *C, void *arg, int event)
}
}
-static uiBlock *action_markermenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused)
+static uiBlock *action_markermenu(bContext *C, ARegion *ar, void *arg_unused)
{
SpaceAction *saction= (SpaceAction*)CTX_wm_space_data(C);
ScrArea *curarea= CTX_wm_area(C);
uiBlock *block;
short yco= 0, menuwidth=120;
- block= uiBeginBlock(C, handle->region, "action_markermenu", UI_EMBOSSP, UI_HELV);
+ block= uiBeginBlock(C, ar, "action_markermenu", UI_EMBOSSP, UI_HELV);
uiBlockSetButmFunc(block, do_markermenu, NULL);
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Add Marker|M", 0, yco-=20,
@@ -817,12 +817,12 @@ static void do_channelmenu_posmenu(bContext *C, void *arg, int event)
}
}
-static uiBlock *action_channelmenu_posmenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused)
+static uiBlock *action_channelmenu_posmenu(bContext *C, ARegion *ar, void *arg_unused)
{
uiBlock *block;
short yco= 0, menuwidth=120;
- block= uiBeginBlock(C, handle->region, "action_channelmenu_posmenu", UI_EMBOSSP, UI_HELV);
+ block= uiBeginBlock(C, ar, "action_channelmenu_posmenu", UI_EMBOSSP, UI_HELV);
uiBlockSetButmFunc(block, do_channelmenu_posmenu, NULL);
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1,
@@ -871,12 +871,12 @@ static void do_channelmenu_groupmenu(bContext *C, void *arg, int event)
}
}
-static uiBlock *action_channelmenu_groupmenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused)
+static uiBlock *action_channelmenu_groupmenu(bContext *C, ARegion *ar, void *arg_unused)
{
uiBlock *block;
short yco= 0, menuwidth=120;
- block= uiBeginBlock(C, handle->region, "action_channelmenu_groupmenu", UI_EMBOSSP, UI_HELV);
+ block= uiBeginBlock(C, ar, "action_channelmenu_groupmenu", UI_EMBOSSP, UI_HELV);
uiBlockSetButmFunc(block, do_channelmenu_groupmenu, NULL);
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1,
@@ -915,12 +915,12 @@ static void do_channelmenu_settingsmenu(bContext *C, void *arg, int event)
//setflag_action_channels(event);
}
-static uiBlock *action_channelmenu_settingsmenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused)
+static uiBlock *action_channelmenu_settingsmenu(bContext *C, ARegion *ar, void *arg_unused)
{
uiBlock *block;
short yco= 0, menuwidth=120;
- block= uiBeginBlock(C, handle->region, "action_channelmenu_settingsmenu", UI_EMBOSSP, UI_HELV);
+ block= uiBeginBlock(C, ar, "action_channelmenu_settingsmenu", UI_EMBOSSP, UI_HELV);
uiBlockSetButmFunc(block, do_channelmenu_settingsmenu, NULL);
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1,
@@ -970,13 +970,13 @@ static void do_channelmenu(bContext *C, void *arg, int event)
}
}
-static uiBlock *action_channelmenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused)
+static uiBlock *action_channelmenu(bContext *C, ARegion *ar, void *arg_unused)
{
ScrArea *curarea= CTX_wm_area(C);
uiBlock *block;
short yco= 0, menuwidth=120;
- block= uiBeginBlock(C, handle->region, "action_channelmenu", UI_EMBOSSP, UI_HELV);
+ block= uiBeginBlock(C, ar, "action_channelmenu", UI_EMBOSSP, UI_HELV);
uiBlockSetButmFunc(block, do_channelmenu, NULL);
uiDefIconTextBlockBut(block, action_channelmenu_groupmenu,
@@ -1034,13 +1034,13 @@ static uiBlock *action_channelmenu(bContext *C, uiMenuBlockHandle *handle, void
/* Grease Pencil --------------------------- */
/* Uses channelmenu functions */
-static uiBlock *action_gplayermenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused)
+static uiBlock *action_gplayermenu(bContext *C, ARegion *ar, void *arg_unused)
{
ScrArea *curarea= CTX_wm_area(C);
uiBlock *block;
short yco= 0, menuwidth=120;
- block= uiBeginBlock(C, handle->region, "action_gplayermenu", UI_EMBOSSP, UI_HELV);
+ block= uiBeginBlock(C, ar, "action_gplayermenu", UI_EMBOSSP, UI_HELV);
uiBlockSetButmFunc(block, do_channelmenu, NULL);
uiDefIconTextBlockBut(block, action_channelmenu_settingsmenu,
@@ -1088,13 +1088,13 @@ static void do_selectmenu_columnmenu(bContext *C, void *arg, int event)
}
}
-static uiBlock *action_selectmenu_columnmenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused)
+static uiBlock *action_selectmenu_columnmenu(bContext *C, ARegion *ar, void *arg_unused)
{
SpaceAction *saction= (SpaceAction*)CTX_wm_space_data(C);
uiBlock *block;
short yco= 0, menuwidth=120;
- block= uiBeginBlock(C, handle->region, "action_selectmenu_columnmenu", UI_EMBOSSP, UI_HELV);
+ block= uiBeginBlock(C, ar, "action_selectmenu_columnmenu", UI_EMBOSSP, UI_HELV);
uiBlockSetButmFunc(block, do_selectmenu_columnmenu, NULL);
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1,
@@ -1198,14 +1198,14 @@ static void do_selectmenu(bContext *C, void *arg, int event)
}
}
-static uiBlock *action_selectmenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused)
+static uiBlock *action_selectmenu(bContext *C, ARegion *ar, void *arg_unused)
{
ScrArea *curarea= CTX_wm_area(C);
SpaceAction *saction= (SpaceAction*)CTX_wm_space_data(C);
uiBlock *block;
short yco= 0, menuwidth=120;
- block= uiBeginBlock(C, handle->region, "action_selectmenu", UI_EMBOSSP, UI_HELV);
+ block= uiBeginBlock(C, ar, "action_selectmenu", UI_EMBOSSP, UI_HELV);
uiBlockSetButmFunc(block, do_selectmenu, NULL);
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1,
@@ -1371,7 +1371,7 @@ static void do_viewmenu(bContext *C, void *arg, int event)
}
}
-static uiBlock *action_viewmenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused)
+static uiBlock *action_viewmenu(bContext *C, ARegion *ar, void *arg_unused)
{
ScrArea *curarea= CTX_wm_area(C);
SpaceAction *saction= (SpaceAction*)CTX_wm_space_data(C);
@@ -1379,7 +1379,7 @@ static uiBlock *action_viewmenu(bContext *C, uiMenuBlockHandle *handle, void *ar
uiBlock *block;
short yco= 0, menuwidth=120;
- block= uiBeginBlock(C, handle->region, "viewmenu", UI_EMBOSSP, UI_HELV);
+ block= uiBeginBlock(C, ar, "viewmenu", UI_EMBOSSP, UI_HELV);
uiBlockSetButmFunc(block, do_viewmenu, NULL);
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1,
diff --git a/source/blender/editors/space_buttons/buttons_header.c b/source/blender/editors/space_buttons/buttons_header.c
index 5090a81aaa7..abccb1aa733 100644
--- a/source/blender/editors/space_buttons/buttons_header.c
+++ b/source/blender/editors/space_buttons/buttons_header.c
@@ -65,13 +65,13 @@ static void do_viewmenu(bContext *C, void *arg, int event)
}
-static uiBlock *dummy_viewmenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused)
+static uiBlock *dummy_viewmenu(bContext *C, ARegion *ar, void *arg_unused)
{
ScrArea *curarea= CTX_wm_area(C);
uiBlock *block;
short yco= 0, menuwidth=120;
- block= uiBeginBlock(C, handle->region, "dummy_viewmenu", UI_EMBOSSP, UI_HELV);
+ block= uiBeginBlock(C, ar, "dummy_viewmenu", UI_EMBOSSP, UI_HELV);
uiBlockSetButmFunc(block, do_viewmenu, NULL);
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Nothing yet", 0, yco-=20,
diff --git a/source/blender/editors/space_file/file_header.c b/source/blender/editors/space_file/file_header.c
index cbe36f28c9d..ef86eb5b7f3 100644
--- a/source/blender/editors/space_file/file_header.c
+++ b/source/blender/editors/space_file/file_header.c
@@ -72,13 +72,13 @@ static void do_viewmenu(bContext *C, void *arg, int event)
}
-static uiBlock *dummy_viewmenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused)
+static uiBlock *dummy_viewmenu(bContext *C, ARegion *ar, void *arg_unused)
{
ScrArea *curarea= CTX_wm_area(C);
uiBlock *block;
short yco= 0, menuwidth=120;
- block= uiBeginBlock(C, handle->region, "dummy_viewmenu", UI_EMBOSSP, UI_HELV);
+ block= uiBeginBlock(C, ar, "dummy_viewmenu", UI_EMBOSSP, UI_HELV);
uiBlockSetButmFunc(block, do_viewmenu, NULL);
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Nothing yet", 0, yco-=20,
diff --git a/source/blender/editors/space_image/image_header.c b/source/blender/editors/space_image/image_header.c
index e015d5aeedf..9f1f2fb4f3f 100644
--- a/source/blender/editors/space_image/image_header.c
+++ b/source/blender/editors/space_image/image_header.c
@@ -83,89 +83,52 @@
#define B_SIMA_RECORD 8
#define B_SIMA_PLAY 9
-static uiBlock *image_view_viewnavmenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused)
+static void image_view_viewnavmenu(bContext *C, uiMenuItem *head, void *arg_unused)
{
- uiBlock *block;
- uiBut *but;
int a;
- /* create menu */
- block= uiBeginBlock(C, handle->region, "image_view_viewnavmenu", UI_EMBOSSP, UI_HELV);
-
- uiDefMenuButO(block, "IMAGE_OT_view_zoom_in", NULL);
- uiDefMenuButO(block, "IMAGE_OT_view_zoom_out", NULL);
+ uiMenuItemO(head, "IMAGE_OT_view_zoom_in", ICON_BLANK1);
+ uiMenuItemO(head, "IMAGE_OT_view_zoom_out", ICON_BLANK1);
- uiDefMenuSep(block);
+ uiMenuSeparator(head);
for(a=0; a<7; a++) {
const int ratios[7][2] = {{1, 8}, {1, 4}, {1, 2}, {1, 1}, {2, 1}, {4, 1}, {8, 1}};
char namestr[128];
sprintf(namestr, "Zoom %d:%d", ratios[a][0], ratios[a][1]);
-
- but= uiDefMenuButO(block, "IMAGE_OT_view_zoom_ratio", namestr);
- RNA_float_set(uiButGetOperatorPtrRNA(but), "ratio", (float)ratios[a][0]/(float)ratios[a][1]);
+ uiMenuItemFloatO(head, namestr, "IMAGE_OT_view_zoom_ratio", "ratio", (float)ratios[a][0]/(float)ratios[a][1]);
}
-
- /* XXX find key shortcut! */
-
- /* position menu */
- uiBlockSetDirection(block, UI_RIGHT);
- uiTextBoundsBlock(block, 50);
- uiEndBlock(C, block);
-
- return block;
}
#if 0
static void do_viewmenu(bContext *C, void *arg, int event)
{
- switch(event) {
- case 1: /* View All */
- do_image_buttons(B_SIMAGEHOME);
- break;
- case 4: /* Realtime Panel... */
- add_blockhandler(curarea, IMAGE_HANDLER_VIEW_PROPERTIES, UI_PNL_UNSTOW);
- break;
- case 7: /* Properties Panel */
- add_blockhandler(curarea, IMAGE_HANDLER_PROPERTIES, UI_PNL_UNSTOW);
- break;
- case 8: /* Paint Panel... */
- add_blockhandler(curarea, IMAGE_HANDLER_PAINT, UI_PNL_UNSTOW);
- break;
- case 9:
- image_viewcenter();
- break;
- case 11: /* Curves Panel... */
- add_blockhandler(curarea, IMAGE_HANDLER_CURVES, UI_PNL_UNSTOW);
- break;
- case 12: /* composite preview */
- toggle_blockhandler(curarea, IMAGE_HANDLER_PREVIEW, 0);
- scrarea_queue_winredraw(curarea);
- break;
- case 13: /* Realtime Panel... */
- add_blockhandler(curarea, IMAGE_HANDLER_GAME_PROPERTIES, UI_PNL_UNSTOW);
- break;
- case 15: /* Grease Pencil... */
- add_blockhandler(curarea, IMAGE_HANDLER_GREASEPENCIL, UI_PNL_UNSTOW);
- break;
- }
+ add_blockhandler(curarea, IMAGE_HANDLER_VIEW_PROPERTIES, UI_PNL_UNSTOW);
+ add_blockhandler(curarea, IMAGE_HANDLER_PROPERTIES, UI_PNL_UNSTOW);
+ add_blockhandler(curarea, IMAGE_HANDLER_PAINT, UI_PNL_UNSTOW);
+ add_blockhandler(curarea, IMAGE_HANDLER_CURVES, UI_PNL_UNSTOW);
+
+ toggle_blockhandler(curarea, IMAGE_HANDLER_PREVIEW, 0);
+ scrarea_queue_winredraw(curarea);
+
+ add_blockhandler(curarea, IMAGE_HANDLER_GAME_PROPERTIES, UI_PNL_UNSTOW);
+ add_blockhandler(curarea, IMAGE_HANDLER_GREASEPENCIL, UI_PNL_UNSTOW);
allqueue(REDRAWIMAGE, 0);
allqueue(REDRAWVIEW3D, 0);
}
#endif
-static uiBlock *image_viewmenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused)
+static void image_viewmenu(bContext *C, uiMenuItem *head, void *arg_unused)
{
bScreen *sc= CTX_wm_screen(C);
ScrArea *sa= CTX_wm_area(C);
SpaceImage *sima= (SpaceImage*)CTX_wm_space_data(C);
PointerRNA spaceptr, uvptr;
- uiBlock *block;
int show_paint, show_render, show_uvedit;
- /* retrrieve state */
+ /* retrieve state */
RNA_pointer_create(&sc->id, &RNA_SpaceImageEditor, sima, &spaceptr);
RNA_pointer_create(&sc->id, &RNA_SpaceUVEditor, sima, &uvptr);
@@ -174,43 +137,27 @@ static uiBlock *image_viewmenu(bContext *C, uiMenuBlockHandle *handle, void *arg
show_uvedit= get_space_image_show_uvedit(sima, CTX_data_edit_object(C));
/* create menu */
- block= uiBeginBlock(C, handle->region, "image_viewmenu", UI_EMBOSSP, UI_HELV);
-
- uiDefMenuButO(block, "IMAGE_OT_toggle_view_properties_panel", NULL); // View Properties...
- uiDefMenuButO(block, "IMAGE_OT_toggle_image_properties_panel", NULL); // Image Properties...|N
- uiDefMenuButO(block, "IMAGE_OT_toggle_realtime_properties_panel", NULL); // Real-time properties...
- if(show_paint) uiDefMenuButO(block, "IMAGE_OT_toggle_paint_panel", NULL); // Paint Tool...|C
- uiDefMenuButO(block, "IMAGE_OT_toggle_curves_panel", NULL); // Curves Tool...
- if(show_render) uiDefMenuButO(block, "IMAGE_OT_toggle_compositing_preview_panel", NULL); // Compositing Preview...|Shift P
- uiDefMenuButO(block, "IMAGE_OT_toggle_grease_pencil_panel", NULL); // Grease Pencil...
+ uiMenuItemO(head, "IMAGE_OT_toggle_view_properties_panel", ICON_MENU_PANEL); // View Properties...
+ uiMenuItemO(head, "IMAGE_OT_toggle_image_properties_panel", ICON_MENU_PANEL); // Image Properties...|N
+ uiMenuItemO(head, "IMAGE_OT_toggle_realtime_properties_panel", ICON_MENU_PANEL); // Real-time properties...
+ if(show_paint) uiMenuItemO(head, "IMAGE_OT_toggle_paint_panel", ICON_MENU_PANEL); // Paint Tool...|C
+ uiMenuItemO(head, "IMAGE_OT_toggle_curves_panel", ICON_MENU_PANEL); // Curves Tool...
+ if(show_render) uiMenuItemO(head, "IMAGE_OT_toggle_compositing_preview_panel", ICON_MENU_PANEL); // Compositing Preview...|Shift P
+ uiMenuItemO(head, "IMAGE_OT_toggle_grease_pencil_panel", ICON_MENU_PANEL); // Grease Pencil...
- uiDefMenuSep(block);
+ uiMenuSeparator(head);
- uiDefMenuTogR(block, &spaceptr, "update_automatically", NULL, NULL);
- // XXX if(show_uvedit) uiDefMenuTogR(block, &uvptr, "local_view", NULL, "UV Local View"); // Numpad /
+ uiMenuItemBooleanR(head, &spaceptr, "update_automatically");
+ // XXX if(show_uvedit) uiMenuItemBooleanR(head, &uvptr, "local_view"); // "UV Local View", Numpad /
- uiDefMenuSep(block);
+ uiMenuSeparator(head);
- uiDefMenuSub(block, image_view_viewnavmenu, "View Navigation");
- if(show_uvedit) uiDefMenuButO(block, "IMAGE_OT_view_selected", NULL);
- uiDefMenuButO(block, "IMAGE_OT_view_all", NULL);
+ uiMenuLevel(head, "View Navigation", image_view_viewnavmenu);
+ if(show_uvedit) uiMenuItemO(head, "IMAGE_OT_view_selected", ICON_BLANK1);
+ uiMenuItemO(head, "IMAGE_OT_view_all", ICON_BLANK1);
- if(sa->full) uiDefMenuButO(block, "SCREEN_OT_screen_full_area", "Tile Window"); // Ctrl UpArrow
- else uiDefMenuButO(block, "SCREEN_OT_screen_full_area", "Maximize Window"); // Ctr DownArrow
-
- /* position menu */
- if(sa->headertype==HEADERTOP) {
- uiBlockSetDirection(block, UI_DOWN);
- }
- else {
- uiBlockSetDirection(block, UI_TOP);
- uiBlockFlipOrder(block);
- }
-
- uiTextBoundsBlock(block, 50);
- uiEndBlock(C, block);
-
- return block;
+ if(sa->full) uiMenuItemO(head, "SCREEN_OT_screen_full_area", ICON_BLANK1); // "Tile Window", Ctrl UpArrow
+ else uiMenuItemO(head, "SCREEN_OT_screen_full_area", ICON_BLANK1); // "Maximize Window", Ctr DownArrow
}
#if 0
@@ -231,41 +178,21 @@ static void do_selectmenu(bContext *C, void *arg, int event)
}
#endif
-static uiBlock *image_selectmenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused)
+static void image_selectmenu(bContext *C, uiMenuItem *head, void *arg_unused)
{
- ScrArea *sa= CTX_wm_area(C);
- uiBlock *block;
-
- /* create menu */
- block= uiBeginBlock(C, handle->region, "image_selectmenu", UI_EMBOSSP, UI_HELV);
+ uiMenuItemO(head, "UV_OT_border_select", ICON_BLANK1); // Border Select|B
+ uiMenuItemO(head, "UV_OT_border_select_pinned", ICON_BLANK1); // Border Select Pinned|Shift B
- uiDefMenuButO(block, "UV_OT_border_select", NULL); // Border Select|B
- uiDefMenuButO(block, "UV_OT_border_select_pinned", NULL); // Border Select Pinned|Shift B
-
- uiDefMenuSep(block);
+ uiMenuSeparator(head);
- uiDefMenuButO(block, "UV_OT_de_select_all", NULL);
- uiDefMenuButO(block, "UV_OT_select_invert", NULL);
- uiDefMenuButO(block, "UV_OT_unlink_selection", NULL); // Unlink Selection|Alt L
+ uiMenuItemO(head, "UV_OT_de_select_all", ICON_BLANK1);
+ uiMenuItemO(head, "UV_OT_select_invert", ICON_BLANK1);
+ uiMenuItemO(head, "UV_OT_unlink_selection", ICON_BLANK1); // Unlink Selection|Alt L
- uiDefMenuSep(block);
-
- uiDefMenuButO(block, "UV_OT_select_pinned", NULL); // Select Pinned|Shift P
- uiDefMenuButO(block, "UV_OT_select_linked", NULL); // Select Linked|Ctrl L
+ uiMenuSeparator(head);
- /* position menu */
- if(sa->headertype==HEADERTOP) {
- uiBlockSetDirection(block, UI_DOWN);
- }
- else {
- uiBlockSetDirection(block, UI_TOP);
- uiBlockFlipOrder(block);
- }
-
- uiTextBoundsBlock(block, 50);
- uiEndBlock(C, block);
-
- return block;
+ uiMenuItemO(head, "UV_OT_select_pinned", ICON_BLANK1); // Select Pinned|Shift P
+ uiMenuItemO(head, "UV_OT_select_linked", ICON_BLANK1); // Select Linked|Ctrl L
}
#if 0
@@ -332,12 +259,10 @@ static void do_image_image_rtmappingmenu(void *arg, int event)
}
#endif
-static uiBlock *image_imagemenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused)
+static void image_imagemenu(bContext *C, uiMenuItem *head, void *arg_unused)
{
bScreen *sc= CTX_wm_screen(C);
- ScrArea *sa= CTX_wm_area(C);
SpaceImage *sima= (SpaceImage*)CTX_wm_space_data(C);
- uiBlock *block;
PointerRNA spaceptr;
Image *ima;
ImBuf *ibuf;
@@ -352,34 +277,32 @@ static uiBlock *image_imagemenu(bContext *C, uiMenuBlockHandle *handle, void *ar
RNA_pointer_create(&sc->id, &RNA_SpaceImageEditor, sima, &spaceptr);
/* create menu */
- block= uiBeginBlock(C, handle->region, "image_imagemenu", UI_EMBOSSP, UI_HELV);
-
- uiDefMenuButO(block, "IMAGE_OT_new", NULL); // New...|Alt N
- uiDefMenuButO(block, "IMAGE_OT_open", NULL); // Open...|Alt O
+ uiMenuItemO(head, "IMAGE_OT_new", ICON_BLANK1); // New...|Alt N
+ uiMenuItemO(head, "IMAGE_OT_open", ICON_BLANK1); // Open...|Alt O
if(ima) {
- uiDefMenuButO(block, "IMAGE_OT_replace", NULL); // Replace...
- uiDefMenuButO(block, "IMAGE_OT_reload", NULL); // Reload...|Alt R
- uiDefMenuButO(block, "IMAGE_OT_save", NULL); // Save|Alt S
- uiDefMenuButO(block, "IMAGE_OT_save_as", NULL); // Save As...
+ uiMenuItemO(head, "IMAGE_OT_replace", ICON_BLANK1); // Replace...
+ uiMenuItemO(head, "IMAGE_OT_reload", ICON_BLANK1); // Reload...|Alt R
+ uiMenuItemO(head, "IMAGE_OT_save", ICON_BLANK1); // Save|Alt S
+ uiMenuItemO(head, "IMAGE_OT_save_as", ICON_BLANK1); // Save As...
if(ima->source == IMA_SRC_SEQUENCE)
- uiDefMenuButO(block, "IMAGE_OT_save_changed", NULL); // Save Changed Images
+ uiMenuItemO(head, "IMAGE_OT_save_changed", ICON_BLANK1); // Save Changed Images
if(!show_render) {
- uiDefMenuSep(block);
+ uiMenuSeparator(head);
- if(ima->packedfile) uiDefMenuButO(block, "IMAGE_OT_unpack", NULL); // Unpack Image...
- else uiDefMenuButO(block, "IMAGE_OT_pack", NULL); // Pack Image
+ if(ima->packedfile) uiMenuItemO(head, "IMAGE_OT_unpack", ICON_BLANK1); // Unpack Image...
+ else uiMenuItemO(head, "IMAGE_OT_pack", ICON_BLANK1); // Pack Image
/* only for dirty && specific image types : XXX poll? */
if(ibuf && (ibuf->userflags & IB_BITMAPDIRTY))
if(ELEM(ima->source, IMA_SRC_FILE, IMA_SRC_GENERATED) && ima->type != IMA_TYPE_MULTILAYER)
- uiDefMenuButO(block, "IMAGE_OT_pack_as_png", NULL); // Pack Image As PNG
+ uiMenuItemO(head, "IMAGE_OT_pack_as_png", ICON_BLANK1); // Pack Image As PNG
- uiDefMenuSep(block);
+ uiMenuSeparator(head);
/* XXX check state better */
- uiDefMenuTogR(block, &spaceptr, "image_painting", NULL, NULL);
+ uiMenuItemBooleanR(head, &spaceptr, "image_painting");
}
}
@@ -399,20 +322,6 @@ static uiBlock *image_imagemenu(bContext *C, uiMenuBlockHandle *handle, void *ar
}
#endif
#endif
-
- /* position menu */
- if(sa->headertype==HEADERTOP) {
- uiBlockSetDirection(block, UI_DOWN);
- }
- else {
- uiBlockSetDirection(block, UI_TOP);
- uiBlockFlipOrder(block);
- }
-
- uiTextBoundsBlock(block, 80);
- uiEndBlock(C, block);
-
- return block;
}
#if 0
@@ -433,61 +342,11 @@ static void do_image_uvs_showhidemenu(void *arg, int event)
}
#endif
-static uiBlock *image_uvs_showhidemenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused)
+static void image_uvs_showhidemenu(bContext *C, uiMenuItem *head, void *arg_unused)
{
- uiBlock *block;
-
- /* create menu */
- block= uiBeginBlock(C, handle->region, "image_uvs_showhidemenu", UI_EMBOSSP, UI_HELV);
-
- uiDefMenuButO(block, "UV_OT_show_hidden_faces", NULL); // Show Hidden Faces|Alt H
- uiDefMenuButO(block, "UV_OT_hide_selected_faces", NULL); // Hide Selected Faces|H
- uiDefMenuButO(block, "UV_OT_hide_deselected_faces", NULL); // Hide Deselected Faces|Shift H
-
- /* position menu */
- uiBlockSetDirection(block, UI_RIGHT);
- uiTextBoundsBlock(block, 60);
-
- uiEndBlock(C, block);
-
- return block;
-}
-
-#if 0
-static void do_image_uvs_propfalloffmenu(void *arg, int event)
-{
- G.scene->prop_mode= event;
- allqueue(REDRAWVIEW3D, 1);
-}
-#endif
-
-static uiBlock *image_uvs_propfalloffmenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused)
-{
- Scene *scene= CTX_data_scene(C);
- PointerRNA sceneptr;
- uiBlock *block;
-
- /* retrieve state */
- RNA_id_pointer_create(&scene->id, &sceneptr);
-
- /* create menu */
- block= uiBeginBlock(C, handle->region, "image_uvs_propfalloffmenu", UI_EMBOSSP, UI_HELV);
-
- uiDefMenuTogR(block, &sceneptr, "proportional_editing_falloff", "SMOOTH", NULL); // Smooth|Shift O
- uiDefMenuTogR(block, &sceneptr, "proportional_editing_falloff", "SPHERE", NULL); // Sphere|Shift O
- uiDefMenuTogR(block, &sceneptr, "proportional_editing_falloff", "ROOT", NULL); // Root|Shift O
- uiDefMenuTogR(block, &sceneptr, "proportional_editing_falloff", "SHARP", NULL); // Sharp|Shift O
- uiDefMenuTogR(block, &sceneptr, "proportional_editing_falloff", "LINEAR", NULL); // Linear|Shift O
- uiDefMenuTogR(block, &sceneptr, "proportional_editing_falloff", "RANDOM", NULL); // Random|Shift O
- uiDefMenuTogR(block, &sceneptr, "proportional_editing_falloff", "CONSTANT", NULL); // Constant|Shift O
-
- /* position menu */
- uiBlockSetDirection(block, UI_RIGHT);
- uiTextBoundsBlock(block, 60);
-
- uiEndBlock(C, block);
-
- return block;
+ uiMenuItemO(head, "UV_OT_show_hidden_faces", ICON_BLANK1); // Show Hidden Faces|Alt H
+ uiMenuItemO(head, "UV_OT_hide_selected_faces", ICON_BLANK1); // Hide Selected Faces|H
+ uiMenuItemO(head, "UV_OT_hide_deselected_faces", ICON_BLANK1); // Hide Deselected Faces|Shift H
}
#if 0
@@ -510,24 +369,11 @@ static void do_image_uvs_transformmenu(void *arg, int event)
}
#endif
-static uiBlock *image_uvs_transformmenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused)
+static void image_uvs_transformmenu(bContext *C, uiMenuItem *head, void *arg_unused)
{
- uiBlock *block;
-
- /* create menu */
- block= uiBeginBlock(C, handle->region, "image_uvs_transformmenu", UI_EMBOSSP, UI_HELV);
-
- uiDefMenuButO(block, "UV_OT_grab", NULL); // Grab/Move|G
- uiDefMenuButO(block, "UV_OT_rotate", NULL); // Rotate|R
- uiDefMenuButO(block, "UV_OT_scale", NULL); // Scale|S
-
- /* position menu */
- uiBlockSetDirection(block, UI_RIGHT);
- uiTextBoundsBlock(block, 60);
-
- uiEndBlock(C, block);
-
- return block;
+ uiMenuItemO(head, "UV_OT_grab", ICON_BLANK1); // Grab/Move|G
+ uiMenuItemO(head, "UV_OT_rotate", ICON_BLANK1); // Rotate|R
+ uiMenuItemO(head, "UV_OT_scale", ICON_BLANK1); // Scale|S
}
#if 0
@@ -554,26 +400,10 @@ static void do_image_uvs_mirrormenu(void *arg, int event)
}
#endif
-static uiBlock *image_uvs_mirrormenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused)
+static void image_uvs_mirrormenu(bContext *C, uiMenuItem *head, void *arg_unused)
{
- uiBlock *block;
- uiBut *but;
-
- /* create menu */
- block= uiBeginBlock(C, handle->region, "image_uvs_mirrormenu", UI_EMBOSSP, UI_HELV);
-
- but= uiDefMenuButO(block, "UV_OT_mirror", "X Axis"); // M, 1
- RNA_enum_set(uiButGetOperatorPtrRNA(but), "axis", 'x');
- but= uiDefMenuButO(block, "UV_OT_mirror", "Y Axis"); // M, 2
- RNA_enum_set(uiButGetOperatorPtrRNA(but), "axis", 'y');
-
- /* position menu */
- uiBlockSetDirection(block, UI_RIGHT);
- uiTextBoundsBlock(block, 60);
-
- uiEndBlock(C, block);
-
- return block;
+ uiMenuItemEnumO(head, "UV_OT_mirror", "axis", 'x'); // "X Axis", M, 1
+ uiMenuItemEnumO(head, "UV_OT_mirror", "axis", 'y'); // "Y Axis", M, 2
}
#if 0
@@ -599,29 +429,10 @@ static void do_image_uvs_weldalignmenu(void *arg, int event)
}
#endif
-static uiBlock *image_uvs_weldalignmenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused)
+static void image_uvs_weldalignmenu(bContext *C, uiMenuItem *head, void *arg_unused)
{
- uiBlock *block;
- uiBut *but;
-
- /* create menu */
- block= uiBeginBlock(C, handle->region, "image_uvs_weldalignmenu", UI_EMBOSSP, UI_HELV);
-
- but= uiDefMenuButO(block, "UV_OT_weld", NULL); // W, 1
- but= uiDefMenuButO(block, "UV_OT_align", "Align Auto"); // W, 2
- RNA_enum_set(uiButGetOperatorPtrRNA(but), "axis", 'a');
- but= uiDefMenuButO(block, "UV_OT_align", "Align X"); // W, 3
- RNA_enum_set(uiButGetOperatorPtrRNA(but), "axis", 'x');
- but= uiDefMenuButO(block, "UV_OT_align", "Align Y"); // W, 4
- RNA_enum_set(uiButGetOperatorPtrRNA(but), "axis", 'y');
-
- /* position menu */
- uiBlockSetDirection(block, UI_RIGHT);
- uiTextBoundsBlock(block, 60);
-
- uiEndBlock(C, block);
-
- return block;
+ uiMenuItemO(head, "UV_OT_weld", ICON_BLANK1); // W, 1
+ uiMenuItemsEnumO(head, "UV_OT_align", "axis"); // W, 2/3/4
}
#if 0
@@ -633,7 +444,7 @@ static void do_image_uvs_scriptsmenu(void *arg, int event)
allqueue(REDRAWIMAGE, 0);
}
-static uiBlock *image_uvs_scriptsmenu (void *args_unused)
+static void image_uvs_scriptsmenu (void *args_unused)
{
uiBlock *block;
BPyMenu *pym;
@@ -702,13 +513,11 @@ static void do_uvsmenu(bContext *C, void *arg, int event)
}
#endif
-static uiBlock *image_uvsmenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused)
+static void image_uvsmenu(bContext *C, uiMenuItem *head, void *arg_unused)
{
bScreen *sc= CTX_wm_screen(C);
- ScrArea *sa= CTX_wm_area(C);
Scene *scene= CTX_data_scene(C);
SpaceImage *sima= (SpaceImage*)CTX_wm_space_data(C);
- uiBlock *block;
PointerRNA uvptr, sceneptr;
Image *ima;
ImBuf *ibuf;
@@ -721,60 +530,45 @@ static uiBlock *image_uvsmenu(bContext *C, uiMenuBlockHandle *handle, void *arg_
RNA_id_pointer_create(&scene->id, &sceneptr);
/* create menu */
- block= uiBeginBlock(C, handle->region, "image_imagemenu", UI_EMBOSSP, UI_HELV);
+ uiMenuItemBooleanR(head, &uvptr, "snap_to_pixels");
+ uiMenuItemBooleanR(head, &uvptr, "constrain_to_image_bounds");
- uiDefMenuTogR(block, &uvptr, "snap_to_pixels", 0, NULL);
- uiDefMenuTogR(block, &uvptr, "constrain_to_image_bounds", 0, NULL);
+ uiMenuSeparator(head);
- uiDefMenuSep(block);
+ uiMenuItemBooleanR(head, &uvptr, "live_unwrap");
+ uiMenuItemO(head, "UV_OT_unwrap", ICON_BLANK1); // Unwrap|E
+ uiMenuItemO(head, "UV_OT_unpin", ICON_BLANK1); // Unpin|Alt P
+ uiMenuItemO(head, "UV_OT_pin", ICON_BLANK1); // Pin|P
- uiDefMenuTogR(block, &uvptr, "live_unwrap", 0, NULL);
- uiDefMenuButO(block, "UV_OT_unwrap", NULL); // Unwrap|E
- uiDefMenuButO(block, "UV_OT_unpin", NULL); // Unpin|Alt P
- uiDefMenuButO(block, "UV_OT_pin", NULL); // Pin|P
+ uiMenuSeparator(head);
- uiDefMenuSep(block);
+ uiMenuItemO(head, "UV_OT_pack_islands", ICON_BLANK1); // Pack Islands|Ctr P
+ uiMenuItemO(head, "UV_OT_average_islands", ICON_BLANK1); // Average Islands Scale|Ctrl A
+ uiMenuItemO(head, "UV_OT_minimize_stretch", ICON_BLANK1); // Minimize Stretch...|Ctrl V
+ uiMenuItemO(head, "UV_OT_stitch", ICON_BLANK1);
- uiDefMenuButO(block, "UV_OT_pack_islands", NULL); // Pack Islands|Ctr P
- uiDefMenuButO(block, "UV_OT_average_islands", NULL); // Average Islands Scale|Ctrl A
- uiDefMenuButO(block, "UV_OT_minimize_stretch", NULL); // Minimize Stretch...|Ctrl V
- uiDefMenuButO(block, "UV_OT_stitch", NULL);
+ uiMenuSeparator(head);
- uiDefMenuSep(block);
+ uiMenuLevel(head, "Transform", image_uvs_transformmenu);
+ uiMenuLevel(head, "Mirror", image_uvs_mirrormenu);
+ uiMenuLevel(head, "Weld/Align", image_uvs_weldalignmenu);
- uiDefMenuSub(block, image_uvs_transformmenu, "Transform");
- uiDefMenuSub(block, image_uvs_mirrormenu, "Mirror");
- uiDefMenuSub(block, image_uvs_weldalignmenu, "Weld/Align");
+ uiMenuSeparator(head);
- uiDefMenuSep(block);
+ uiMenuItemBooleanR(head, &sceneptr, "proportional_editing");
+ uiMenuLevelEnumR(head, &sceneptr, "proportional_editing_falloff");
- uiDefMenuTogR(block, &sceneptr, "proportional_editing", 0, NULL);
- uiDefMenuSub(block, image_uvs_propfalloffmenu, "Proportional Falloff");
+ uiMenuSeparator(head);
- uiDefMenuSep(block);
-
- uiDefMenuSub(block, image_uvs_showhidemenu, "Show/Hide Faces");
+ uiMenuLevel(head, "Show/Hide Faces", image_uvs_showhidemenu);
#if 0
#ifndef DISABLE_PYTHON
- uiDefMenuSep(block);
+ uiMenuSeparator(head);
- uiDefMenuSub(block, image_uvs_scriptsmenu, "Scripts");
+ uiMenuLevel(head, "Scripts", image_uvs_scriptsmenu);
#endif
#endif
-
- if(sa->headertype==HEADERTOP) {
- uiBlockSetDirection(block, UI_DOWN);
- }
- else {
- uiBlockSetDirection(block, UI_TOP);
- uiBlockFlipOrder(block);
- }
-
- uiTextBoundsBlock(block, 50);
- uiEndBlock(C, block);
-
- return block;
}
static void image_menu_uvlayers(Object *obedit, char *menustr, int *active)
@@ -1130,23 +924,23 @@ void image_header_buttons(const bContext *C, ARegion *ar)
uiBlockSetEmboss(block, UI_EMBOSSP);
xmax= GetButStringLength("View");
- uiDefPulldownBut(block, image_viewmenu, NULL, "View", xco, yco-2, xmax-3, 24, "");
+ uiDefMenuBut(block, image_viewmenu, NULL, "View", xco, yco-2, xmax-3, 24, "");
xco+= xmax;
if(show_uvedit) {
xmax= GetButStringLength("Select");
- uiDefPulldownBut(block, image_selectmenu, NULL, "Select", xco, yco-2, xmax-3, 24, "");
+ uiDefMenuBut(block, image_selectmenu, NULL, "Select", xco, yco-2, xmax-3, 24, "");
xco+= xmax;
}
menuname= (ibuf && (ibuf->userflags & IB_BITMAPDIRTY))? "Image*": "Image";
xmax= GetButStringLength(menuname);
- uiDefPulldownBut(block, image_imagemenu, NULL, menuname, xco, yco-2, xmax-3, 24, "");
+ uiDefMenuBut(block, image_imagemenu, NULL, menuname, xco, yco-2, xmax-3, 24, "");
xco+= xmax;
if(show_uvedit) {
xmax= GetButStringLength("UVs");
- uiDefPulldownBut(block, image_uvsmenu, NULL, "UVs", xco, yco-2, xmax-3, 24, "");
+ uiDefMenuBut(block, image_uvsmenu, NULL, "UVs", xco, yco-2, xmax-3, 24, "");
xco+= xmax;
}
}
diff --git a/source/blender/editors/space_info/info_header.c b/source/blender/editors/space_info/info_header.c
index 4ee5939d1c5..0a6ff9e0b3e 100644
--- a/source/blender/editors/space_info/info_header.c
+++ b/source/blender/editors/space_info/info_header.c
@@ -65,13 +65,13 @@ static void do_viewmenu(bContext *C, void *arg, int event)
}
-static uiBlock *dummy_viewmenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused)
+static uiBlock *dummy_viewmenu(bContext *C, ARegion *ar, void *arg_unused)
{
ScrArea *curarea= CTX_wm_area(C);
uiBlock *block;
short yco= 0, menuwidth=120;
- block= uiBeginBlock(C, handle->region, "dummy_viewmenu", UI_EMBOSSP, UI_HELV);
+ block= uiBeginBlock(C, ar, "dummy_viewmenu", UI_EMBOSSP, UI_HELV);
uiBlockSetButmFunc(block, do_viewmenu, NULL);
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Nothing yet", 0, yco-=20,
diff --git a/source/blender/editors/space_ipo/ipo_header.c b/source/blender/editors/space_ipo/ipo_header.c
index ed6efde9604..0135a274372 100644
--- a/source/blender/editors/space_ipo/ipo_header.c
+++ b/source/blender/editors/space_ipo/ipo_header.c
@@ -91,14 +91,14 @@ static void do_viewmenu(bContext *C, void *arg, int event)
}
}
-static uiBlock *graph_viewmenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused)
+static uiBlock *graph_viewmenu(bContext *C, ARegion *ar, void *arg_unused)
{
ScrArea *curarea= CTX_wm_area(C);
SpaceIpo *sipo= (SpaceIpo *)CTX_wm_space_data(C);
uiBlock *block;
short yco= 0, menuwidth=120;
- block= uiBeginBlock(C, handle->region, "graph_viewmenu", UI_EMBOSSP, UI_HELV);
+ block= uiBeginBlock(C, ar, "graph_viewmenu", UI_EMBOSSP, UI_HELV);
uiBlockSetButmFunc(block, do_viewmenu, NULL);
// XXX these options should use new menu-options
diff --git a/source/blender/editors/space_nla/nla_header.c b/source/blender/editors/space_nla/nla_header.c
index ef850df1c59..cee940ca428 100644
--- a/source/blender/editors/space_nla/nla_header.c
+++ b/source/blender/editors/space_nla/nla_header.c
@@ -65,13 +65,13 @@ static void do_viewmenu(bContext *C, void *arg, int event)
}
-static uiBlock *dummy_viewmenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused)
+static uiBlock *dummy_viewmenu(bContext *C, ARegion *ar, void *arg_unused)
{
ScrArea *curarea= CTX_wm_area(C);
uiBlock *block;
short yco= 0, menuwidth=120;
- block= uiBeginBlock(C, handle->region, "dummy_viewmenu", UI_EMBOSSP, UI_HELV);
+ block= uiBeginBlock(C, ar, "dummy_viewmenu", UI_EMBOSSP, UI_HELV);
uiBlockSetButmFunc(block, do_viewmenu, NULL);
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Nothing yet", 0, yco-=20,
diff --git a/source/blender/editors/space_node/node_draw.c b/source/blender/editors/space_node/node_draw.c
index 30b4bf86b68..06c4b6bacd1 100644
--- a/source/blender/editors/space_node/node_draw.c
+++ b/source/blender/editors/space_node/node_draw.c
@@ -503,7 +503,7 @@ static void socket_vector_menu_cb(bContext *C, void *node_v, void *ntree_v)
}
/* NOTE: this is a block-menu, needs 0 events, otherwise the menu closes */
-static uiBlock *socket_vector_menu(bContext *C, uiMenuBlockHandle *handle, void *socket_v)
+static uiBlock *socket_vector_menu(bContext *C, ARegion *ar, void *socket_v)
{
SpaceNode *snode= (SpaceNode*)CTX_wm_space_data(C);
ScrArea *sa= CTX_wm_area(C);
@@ -523,7 +523,7 @@ static uiBlock *socket_vector_menu(bContext *C, uiMenuBlockHandle *handle, void
break;
}
- block= uiBeginBlock(C, handle->region, "socket menu", UI_EMBOSS, UI_HELV);
+ block= uiBeginBlock(C, ar, "socket menu", UI_EMBOSS, UI_HELV);
/* use this for a fake extra empy space around the buttons */
uiDefBut(block, LABEL, 0, "", -4, -4, 188, 68, NULL, 0, 0, 0, 0, "");
diff --git a/source/blender/editors/space_node/node_header.c b/source/blender/editors/space_node/node_header.c
index 8655a7aeac9..451e9631f87 100644
--- a/source/blender/editors/space_node/node_header.c
+++ b/source/blender/editors/space_node/node_header.c
@@ -91,13 +91,13 @@ static void do_node_selectmenu(bContext *C, void *arg, int event)
ED_area_tag_redraw(curarea);
}
-static uiBlock *node_selectmenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused)
+static uiBlock *node_selectmenu(bContext *C, ARegion *ar, void *arg_unused)
{
ScrArea *curarea= CTX_wm_area(C);
uiBlock *block;
short yco= 0, menuwidth=120;
- block= uiBeginBlock(C, handle->region, "node_selectmenu",
+ block= uiBeginBlock(C, ar, "node_selectmenu",
UI_EMBOSSP, UI_HELV);
uiBlockSetButmFunc(block, do_node_selectmenu, NULL);
@@ -218,11 +218,11 @@ static void node_make_addmenu(bContext *C, int nodeclass, uiBlock *block)
}
}
-static uiBlock *node_add_inputmenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused)
+static uiBlock *node_add_inputmenu(bContext *C, ARegion *ar, void *arg_unused)
{
uiBlock *block;
- block= uiBeginBlock(C, handle->region, "node_add_inputmenu", UI_EMBOSSP, UI_HELV);
+ block= uiBeginBlock(C, ar, "node_add_inputmenu", UI_EMBOSSP, UI_HELV);
uiBlockSetButmFunc(block, do_node_addmenu, NULL);
node_make_addmenu(C, NODE_CLASS_INPUT, block);
@@ -233,11 +233,11 @@ static uiBlock *node_add_inputmenu(bContext *C, uiMenuBlockHandle *handle, void
return block;
}
-static uiBlock *node_add_outputmenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused)
+static uiBlock *node_add_outputmenu(bContext *C, ARegion *ar, void *arg_unused)
{
uiBlock *block;
- block= uiBeginBlock(C, handle->region, "node_add_outputmenu", UI_EMBOSSP, UI_HELV);
+ block= uiBeginBlock(C, ar, "node_add_outputmenu", UI_EMBOSSP, UI_HELV);
uiBlockSetButmFunc(block, do_node_addmenu, NULL);
node_make_addmenu(C, NODE_CLASS_OUTPUT, block);
@@ -248,11 +248,11 @@ static uiBlock *node_add_outputmenu(bContext *C, uiMenuBlockHandle *handle, void
return block;
}
-static uiBlock *node_add_colormenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused)
+static uiBlock *node_add_colormenu(bContext *C, ARegion *ar, void *arg_unused)
{
uiBlock *block;
- block= uiBeginBlock(C, handle->region, "node_add_colormenu", UI_EMBOSSP, UI_HELV);
+ block= uiBeginBlock(C, ar, "node_add_colormenu", UI_EMBOSSP, UI_HELV);
uiBlockSetButmFunc(block, do_node_addmenu, NULL);
node_make_addmenu(C, NODE_CLASS_OP_COLOR, block);
@@ -263,11 +263,11 @@ static uiBlock *node_add_colormenu(bContext *C, uiMenuBlockHandle *handle, void
return block;
}
-static uiBlock *node_add_vectormenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused)
+static uiBlock *node_add_vectormenu(bContext *C, ARegion *ar, void *arg_unused)
{
uiBlock *block;
- block= uiBeginBlock(C, handle->region, "node_add_vectormenu", UI_EMBOSSP, UI_HELV);
+ block= uiBeginBlock(C, ar, "node_add_vectormenu", UI_EMBOSSP, UI_HELV);
uiBlockSetButmFunc(block, do_node_addmenu, NULL);
node_make_addmenu(C, NODE_CLASS_OP_VECTOR, block);
@@ -278,11 +278,11 @@ static uiBlock *node_add_vectormenu(bContext *C, uiMenuBlockHandle *handle, void
return block;
}
-static uiBlock *node_add_filtermenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused)
+static uiBlock *node_add_filtermenu(bContext *C, ARegion *ar, void *arg_unused)
{
uiBlock *block;
- block= uiBeginBlock(C, handle->region, "node_add_filtermenu", UI_EMBOSSP, UI_HELV);
+ block= uiBeginBlock(C, ar, "node_add_filtermenu", UI_EMBOSSP, UI_HELV);
uiBlockSetButmFunc(block, do_node_addmenu, NULL);
node_make_addmenu(C, NODE_CLASS_OP_FILTER, block);
@@ -293,11 +293,11 @@ static uiBlock *node_add_filtermenu(bContext *C, uiMenuBlockHandle *handle, void
return block;
}
-static uiBlock *node_add_convertermenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused)
+static uiBlock *node_add_convertermenu(bContext *C, ARegion *ar, void *arg_unused)
{
uiBlock *block;
- block= uiBeginBlock(C, handle->region, "node_add_convertermenu", UI_EMBOSSP, UI_HELV);
+ block= uiBeginBlock(C, ar, "node_add_convertermenu", UI_EMBOSSP, UI_HELV);
uiBlockSetButmFunc(block, do_node_addmenu, NULL);
node_make_addmenu(C, NODE_CLASS_CONVERTOR, block);
@@ -308,11 +308,11 @@ static uiBlock *node_add_convertermenu(bContext *C, uiMenuBlockHandle *handle, v
return block;
}
-static uiBlock *node_add_mattemenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused)
+static uiBlock *node_add_mattemenu(bContext *C, ARegion *ar, void *arg_unused)
{
uiBlock *block;
- block= uiBeginBlock(C, handle->region, "node_add_mattemenu", UI_EMBOSSP, UI_HELV);
+ block= uiBeginBlock(C, ar, "node_add_mattemenu", UI_EMBOSSP, UI_HELV);
uiBlockSetButmFunc(block, do_node_addmenu, NULL);
node_make_addmenu(C, NODE_CLASS_MATTE, block);
@@ -323,11 +323,11 @@ static uiBlock *node_add_mattemenu(bContext *C, uiMenuBlockHandle *handle, void
return block;
}
-static uiBlock *node_add_distortmenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused)
+static uiBlock *node_add_distortmenu(bContext *C, ARegion *ar, void *arg_unused)
{
uiBlock *block;
- block= uiBeginBlock(C, handle->region, "node_add_distortmenu", UI_EMBOSSP, UI_HELV);
+ block= uiBeginBlock(C, ar, "node_add_distortmenu", UI_EMBOSSP, UI_HELV);
uiBlockSetButmFunc(block, do_node_addmenu, NULL);
node_make_addmenu(C, NODE_CLASS_DISTORT, block);
@@ -338,11 +338,11 @@ static uiBlock *node_add_distortmenu(bContext *C, uiMenuBlockHandle *handle, voi
return block;
}
-static uiBlock *node_add_patternmenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused)
+static uiBlock *node_add_patternmenu(bContext *C, ARegion *ar, void *arg_unused)
{
uiBlock *block;
- block= uiBeginBlock(C, handle->region, "node_add_patternmenu", UI_EMBOSSP, UI_HELV);
+ block= uiBeginBlock(C, ar, "node_add_patternmenu", UI_EMBOSSP, UI_HELV);
uiBlockSetButmFunc(block, do_node_addmenu, NULL);
node_make_addmenu(C, NODE_CLASS_PATTERN, block);
@@ -353,11 +353,11 @@ static uiBlock *node_add_patternmenu(bContext *C, uiMenuBlockHandle *handle, vo
return block;
}
-static uiBlock *node_add_texturemenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused)
+static uiBlock *node_add_texturemenu(bContext *C, ARegion *ar, void *arg_unused)
{
uiBlock *block;
- block= uiBeginBlock(C, handle->region, "node_add_texturemenu", UI_EMBOSSP, UI_HELV);
+ block= uiBeginBlock(C, ar, "node_add_texturemenu", UI_EMBOSSP, UI_HELV);
uiBlockSetButmFunc(block, do_node_addmenu, NULL);
node_make_addmenu(C, NODE_CLASS_TEXTURE, block);
@@ -368,11 +368,11 @@ static uiBlock *node_add_texturemenu(bContext *C, uiMenuBlockHandle *handle, voi
return block;
}
-static uiBlock *node_add_groupmenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused)
+static uiBlock *node_add_groupmenu(bContext *C, ARegion *ar, void *arg_unused)
{
uiBlock *block;
- block= uiBeginBlock(C, handle->region, "node_add_groupmenu", UI_EMBOSSP, UI_HELV);
+ block= uiBeginBlock(C, ar, "node_add_groupmenu", UI_EMBOSSP, UI_HELV);
uiBlockSetButmFunc(block, do_node_addmenu, NULL);
node_make_addmenu(C, NODE_CLASS_GROUP, block);
@@ -384,11 +384,11 @@ static uiBlock *node_add_groupmenu(bContext *C, uiMenuBlockHandle *handle, void
return block;
}
-static uiBlock *node_add_dynamicmenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused)
+static uiBlock *node_add_dynamicmenu(bContext *C, ARegion *ar, void *arg_unused)
{
uiBlock *block;
- block= uiBeginBlock(C, handle->region, "node_add_dynamicmenu", UI_EMBOSSP, UI_HELV);
+ block= uiBeginBlock(C, ar, "node_add_dynamicmenu", UI_EMBOSSP, UI_HELV);
uiBlockSetButmFunc(block, do_node_addmenu, NULL);
node_make_addmenu(C, NODE_CLASS_OP_DYNAMIC, block);
@@ -400,14 +400,14 @@ static uiBlock *node_add_dynamicmenu(bContext *C, uiMenuBlockHandle *handle, voi
return block;
}
-static uiBlock *node_addmenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused)
+static uiBlock *node_addmenu(bContext *C, ARegion *ar, void *arg_unused)
{
ScrArea *curarea= CTX_wm_area(C);
SpaceNode *snode= (SpaceNode*)CTX_wm_space_data(C);
uiBlock *block;
short yco= 0, menuwidth=120;
- block= uiBeginBlock(C, handle->region, "node_addmenu", UI_EMBOSSP, UI_HELV);
+ block= uiBeginBlock(C, ar, "node_addmenu", UI_EMBOSSP, UI_HELV);
uiBlockSetButmFunc(block, do_node_addmenu, NULL);
if(snode->treetype==NTREE_SHADER) {
@@ -521,14 +521,14 @@ static void do_node_nodemenu(bContext *C, void *arg, int event)
ED_area_tag_redraw(curarea);
}
-static uiBlock *node_nodemenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused)
+static uiBlock *node_nodemenu(bContext *C, ARegion *ar, void *arg_unused)
{
ScrArea *curarea= CTX_wm_area(C);
SpaceNode *snode= (SpaceNode*)CTX_wm_space_data(C);
uiBlock *block;
short yco= 0, menuwidth=120;
- block= uiBeginBlock(C, handle->region, "node_nodemenu",
+ block= uiBeginBlock(C, ar, "node_nodemenu",
UI_EMBOSSP, UI_HELV);
uiBlockSetButmFunc(block, do_node_nodemenu, NULL);
@@ -606,14 +606,14 @@ static void do_node_viewmenu(bContext *C, void *arg, int event)
ED_area_tag_redraw(sa);
}
-static uiBlock *node_viewmenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused)
+static uiBlock *node_viewmenu(bContext *C, ARegion *ar, void *arg_unused)
{
ScrArea *curarea= CTX_wm_area(C);
SpaceNode *snode= (SpaceNode*)CTX_wm_space_data(C);
uiBlock *block;
short yco= 0, menuwidth=120;
- block= uiBeginBlock(C, handle->region, "node_viewmenu", UI_EMBOSSP, UI_HELV);
+ block= uiBeginBlock(C, ar, "node_viewmenu", UI_EMBOSSP, UI_HELV);
uiBlockSetButmFunc(block, do_node_viewmenu, NULL);
if (snode->nodetree) {
diff --git a/source/blender/editors/space_outliner/outliner_header.c b/source/blender/editors/space_outliner/outliner_header.c
index f0cf5480e71..1f3bf71f814 100644
--- a/source/blender/editors/space_outliner/outliner_header.c
+++ b/source/blender/editors/space_outliner/outliner_header.c
@@ -111,14 +111,14 @@ static void do_viewmenu(bContext *C, void *arg, int event)
ED_area_tag_redraw(curarea);
}
-static uiBlock *outliner_viewmenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused)
+static uiBlock *outliner_viewmenu(bContext *C, ARegion *ar, void *arg_unused)
{
ScrArea *curarea= CTX_wm_area(C);
SpaceOops *soops= curarea->spacedata.first;
uiBlock *block;
short yco= 0, menuwidth=120;
- block= uiBeginBlock(C, handle->region, "outliner_viewmenu", UI_EMBOSSP, UI_HELV);
+ block= uiBeginBlock(C, ar, "outliner_viewmenu", UI_EMBOSSP, UI_HELV);
uiBlockSetButmFunc(block, do_viewmenu, NULL);
if(soops->type==SO_OUTLINER) {
diff --git a/source/blender/editors/space_script/script_header.c b/source/blender/editors/space_script/script_header.c
index 37e77e1497a..2a7006348b3 100644
--- a/source/blender/editors/space_script/script_header.c
+++ b/source/blender/editors/space_script/script_header.c
@@ -65,13 +65,13 @@ static void do_viewmenu(bContext *C, void *arg, int event)
}
-static uiBlock *dummy_viewmenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused)
+static uiBlock *dummy_viewmenu(bContext *C, ARegion *ar, void *arg_unused)
{
ScrArea *curarea= CTX_wm_area(C);
uiBlock *block;
short yco= 0, menuwidth=120;
- block= uiBeginBlock(C, handle->region, "dummy_viewmenu", UI_EMBOSSP, UI_HELV);
+ block= uiBeginBlock(C, ar, "dummy_viewmenu", UI_EMBOSSP, UI_HELV);
uiBlockSetButmFunc(block, do_viewmenu, NULL);
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Nothing yet", 0, yco-=20,
diff --git a/source/blender/editors/space_sequencer/sequencer_header.c b/source/blender/editors/space_sequencer/sequencer_header.c
index eef59a7dc6b..8ae10bfb0bf 100644
--- a/source/blender/editors/space_sequencer/sequencer_header.c
+++ b/source/blender/editors/space_sequencer/sequencer_header.c
@@ -72,13 +72,13 @@
#define B_IPOBORDER 4
#define B_SEQCLEAR 5
-static uiBlock *seq_viewmenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused)
+static uiBlock *seq_viewmenu(bContext *C, ARegion *ar, void *arg_unused)
{
ScrArea *sa= CTX_wm_area(C);
SpaceSeq *sseq= sa->spacedata.first;
View2D *v2d= UI_view2d_fromcontext(C);
- uiBlock *block= uiBeginBlock(C, handle->region, "seq_viewmenu", UI_EMBOSSP, UI_HELV);
+ uiBlock *block= uiBeginBlock(C, ar, "seq_viewmenu", UI_EMBOSSP, UI_HELV);
short yco= 0, menuwidth=120;
if (sseq->mainb == SEQ_DRAW_SEQUENCE) {
@@ -146,11 +146,11 @@ static uiBlock *seq_viewmenu(bContext *C, uiMenuBlockHandle *handle, void *arg_u
return block;
}
-static uiBlock *seq_selectmenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused)
+static uiBlock *seq_selectmenu(bContext *C, ARegion *ar, void *arg_unused)
{
ScrArea *sa= CTX_wm_area(C);
- uiBlock *block= uiBeginBlock(C, handle->region, "seq_selectmenu", UI_EMBOSSP, UI_HELV);
+ uiBlock *block= uiBeginBlock(C, ar, "seq_selectmenu", UI_EMBOSSP, UI_HELV);
uiBut *but;
but= uiDefMenuButO(block, "SEQUENCER_OT_select_active_side", "Strips to the Left");
@@ -188,13 +188,13 @@ static uiBlock *seq_selectmenu(bContext *C, uiMenuBlockHandle *handle, void *arg
return block;
}
-static uiBlock *seq_markermenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused)
+static uiBlock *seq_markermenu(bContext *C, ARegion *ar, void *arg_unused)
{
ScrArea *sa= CTX_wm_area(C);
SpaceSeq *sseq= sa->spacedata.first;
- uiBlock *block= uiBeginBlock(C, handle->region, "seq_markermenu", UI_EMBOSSP, UI_HELV);
+ uiBlock *block= uiBeginBlock(C, ar, "seq_markermenu", UI_EMBOSSP, UI_HELV);
short yco= 0, menuwidth=120;
@@ -235,9 +235,9 @@ static uiBlock *seq_markermenu(bContext *C, uiMenuBlockHandle *handle, void *arg
return block;
}
-static uiBlock *seq_addmenu_effectmenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused)
+static uiBlock *seq_addmenu_effectmenu(bContext *C, ARegion *ar, void *arg_unused)
{
- uiBlock *block= uiBeginBlock(C, handle->region, "seq_addmenu_effectmenu", UI_EMBOSSP, UI_HELV);
+ uiBlock *block= uiBeginBlock(C, ar, "seq_addmenu_effectmenu", UI_EMBOSSP, UI_HELV);
RNA_enum_set(uiButGetOperatorPtrRNA(uiDefMenuButO(block, "SEQUENCER_OT_add_effect_strip", "Add")), "type", SEQ_ADD);
@@ -266,10 +266,10 @@ static uiBlock *seq_addmenu_effectmenu(bContext *C, uiMenuBlockHandle *handle, v
}
-static uiBlock *seq_addmenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused)
+static uiBlock *seq_addmenu(bContext *C, ARegion *ar, void *arg_unused)
{
ScrArea *sa= CTX_wm_area(C);
- uiBlock *block= uiBeginBlock(C, handle->region, "seq_addmenu", UI_EMBOSSP, UI_HELV);
+ uiBlock *block= uiBeginBlock(C, ar, "seq_addmenu", UI_EMBOSSP, UI_HELV);
uiBut *but;
uiDefMenuSub(block, seq_addmenu_effectmenu, "Effect");
@@ -308,13 +308,13 @@ static uiBlock *seq_addmenu(bContext *C, uiMenuBlockHandle *handle, void *arg_un
return block;
}
-static uiBlock *seq_editmenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused)
+static uiBlock *seq_editmenu(bContext *C, ARegion *ar, void *arg_unused)
{
ScrArea *sa= CTX_wm_area(C);
Scene *scene= CTX_data_scene(C);
Editing *ed= seq_give_editing(scene, FALSE);
- uiBlock *block= uiBeginBlock(C, handle->region, "seq_editmenu", UI_EMBOSSP, UI_HELV);
+ uiBlock *block= uiBeginBlock(C, ar, "seq_editmenu", UI_EMBOSSP, UI_HELV);
uiBut *but;
diff --git a/source/blender/editors/space_sound/sound_header.c b/source/blender/editors/space_sound/sound_header.c
index 7e47cb832a2..3eed96d14d7 100644
--- a/source/blender/editors/space_sound/sound_header.c
+++ b/source/blender/editors/space_sound/sound_header.c
@@ -65,13 +65,13 @@ static void do_viewmenu(bContext *C, void *arg, int event)
}
-static uiBlock *dummy_viewmenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused)
+static uiBlock *dummy_viewmenu(bContext *C, ARegion *ar, void *arg_unused)
{
ScrArea *curarea= CTX_wm_area(C);
uiBlock *block;
short yco= 0, menuwidth=120;
- block= uiBeginBlock(C, handle->region, "dummy_viewmenu", UI_EMBOSSP, UI_HELV);
+ block= uiBeginBlock(C, ar, "dummy_viewmenu", UI_EMBOSSP, UI_HELV);
uiBlockSetButmFunc(block, do_viewmenu, NULL);
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Nothing yet", 0, yco-=20,
diff --git a/source/blender/editors/space_text/text_header.c b/source/blender/editors/space_text/text_header.c
index 84182f70cdb..b8898e40f01 100644
--- a/source/blender/editors/space_text/text_header.c
+++ b/source/blender/editors/space_text/text_header.c
@@ -65,13 +65,13 @@ static void do_viewmenu(bContext *C, void *arg, int event)
}
-static uiBlock *dummy_viewmenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused)
+static uiBlock *dummy_viewmenu(bContext *C, ARegion *ar, void *arg_unused)
{
ScrArea *curarea= CTX_wm_area(C);
uiBlock *block;
short yco= 0, menuwidth=120;
- block= uiBeginBlock(C, handle->region, "dummy_viewmenu", UI_EMBOSSP, UI_HELV);
+ block= uiBeginBlock(C, ar, "dummy_viewmenu", UI_EMBOSSP, UI_HELV);
uiBlockSetButmFunc(block, do_viewmenu, NULL);
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Nothing yet", 0, yco-=20,
diff --git a/source/blender/editors/space_time/time_header.c b/source/blender/editors/space_time/time_header.c
index d12775eba9a..7672325c114 100644
--- a/source/blender/editors/space_time/time_header.c
+++ b/source/blender/editors/space_time/time_header.c
@@ -84,7 +84,7 @@ static void do_time_redrawmenu(bContext *C, void *arg, int event)
}
-static uiBlock *time_redrawmenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused)
+static uiBlock *time_redrawmenu(bContext *C, ARegion *ar, void *arg_unused)
{
ScrArea *curarea= CTX_wm_area(C);
SpaceTime *stime= (SpaceTime*)CTX_wm_space_data(C);
@@ -93,7 +93,7 @@ static uiBlock *time_redrawmenu(bContext *C, uiMenuBlockHandle *handle, void *ar
short yco= 0, menuwidth=120, icon;
char str[32];
- block= uiBeginBlock(C, handle->region, "header time_redrawmenu", UI_EMBOSSP, UI_HELV);
+ block= uiBeginBlock(C, ar, "header time_redrawmenu", UI_EMBOSSP, UI_HELV);
uiBlockSetButmFunc(block, do_time_redrawmenu, NULL);
if(stime->redraws & TIME_LEFTMOST_3D_WIN) icon= ICON_CHECKBOX_HLT;
@@ -205,7 +205,7 @@ static void do_time_viewmenu(bContext *C, void *arg, int event)
}
}
-static uiBlock *time_viewmenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused)
+static uiBlock *time_viewmenu(bContext *C, ARegion *ar, void *arg_unused)
{
ScrArea *curarea= CTX_wm_area(C);
SpaceTime *stime= (SpaceTime*)CTX_wm_space_data(C);
@@ -213,7 +213,7 @@ static uiBlock *time_viewmenu(bContext *C, uiMenuBlockHandle *handle, void *arg_
uiBlock *block;
short yco= 0, menuwidth=120;
- block= uiBeginBlock(C, handle->region, "time_viewmenu", UI_EMBOSSP, UI_HELV);
+ block= uiBeginBlock(C, ar, "time_viewmenu", UI_EMBOSSP, UI_HELV);
uiBlockSetButmFunc(block, do_time_viewmenu, NULL);
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Play Back Animation", 0, yco-=20,
@@ -293,13 +293,13 @@ static void do_time_framemenu(bContext *C, void *arg, int event)
}
}
-static uiBlock *time_framemenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused)
+static uiBlock *time_framemenu(bContext *C, ARegion *ar, void *arg_unused)
{
ScrArea *curarea= CTX_wm_area(C);
uiBlock *block;
short yco= 0, menuwidth=120;
- block= uiBeginBlock(C, handle->region, "time_framemenu", UI_EMBOSSP, UI_HELV);
+ block= uiBeginBlock(C, ar, "time_framemenu", UI_EMBOSSP, UI_HELV);
uiBlockSetButmFunc(block, do_time_framemenu, NULL);
uiDefIconTextButO(block, BUTM, "MARKER_OT_add", WM_OP_EXEC_REGION_WIN, ICON_BLANK1, "Add Marker",
diff --git a/source/blender/editors/space_view3d/view3d_header.c b/source/blender/editors/space_view3d/view3d_header.c
index be831c27d3c..15b2c453b9d 100644
--- a/source/blender/editors/space_view3d/view3d_header.c
+++ b/source/blender/editors/space_view3d/view3d_header.c
@@ -278,7 +278,7 @@ static void do_view3d_view_camerasmenu(bContext *C, void *arg, int event)
allqueue(REDRAWVIEW3D, 0);
}
-static uiBlock *view3d_view_camerasmenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused)
+static uiBlock *view3d_view_camerasmenu(bContext *C, ARegion *ar, void *arg_unused)
{
Scene *scene= CTX_data_scene(C);
Base *base;
@@ -287,7 +287,7 @@ static uiBlock *view3d_view_camerasmenu(bContext *C, uiMenuBlockHandle *handle,
int i=1;
char camname[48];
- block= uiBeginBlock(C, handle->region, "view3d_view_camerasmenu", UI_EMBOSSP, UI_HELV);
+ block= uiBeginBlock(C, ar, "view3d_view_camerasmenu", UI_EMBOSSP, UI_HELV);
uiBlockSetButmFunc(block, do_view3d_view_camerasmenu, NULL);
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Set Active Object as Active Camera|Ctrl NumPad 0", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 1, "");
@@ -365,13 +365,13 @@ static void do_view3d_view_cameracontrolsmenu(bContext *C, void *arg, int event)
allqueue(REDRAWVIEW3D, 0);
}
-static uiBlock *view3d_view_cameracontrolsmenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused)
+static uiBlock *view3d_view_cameracontrolsmenu(bContext *C, ARegion *ar, void *arg_unused)
{
/* static short tog=0; */
uiBlock *block;
short yco= 0, menuwidth=120;
- block= uiBeginBlock(C, handle->region, "view3d_view_cameracontrolsmenu", UI_EMBOSSP, UI_HELV);
+ block= uiBeginBlock(C, ar, "view3d_view_cameracontrolsmenu", UI_EMBOSSP, UI_HELV);
uiBlockSetButmFunc(block, do_view3d_view_cameracontrolsmenu, NULL);
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Camera Fly Mode|Shift F", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 11, "");
@@ -456,14 +456,14 @@ static void do_view3d_view_alignviewmenu(bContext *C, void *arg, int event)
allqueue(REDRAWVIEW3D, 0);
}
-static uiBlock *view3d_view_alignviewmenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused)
+static uiBlock *view3d_view_alignviewmenu(bContext *C, ARegion *ar, void *arg_unused)
{
/* static short tog=0; */
uiBlock *block;
Object *obedit = CTX_data_edit_object(C);
short yco= 0, menuwidth=120;
- block= uiBeginBlock(C, handle->region, "view3d_view_alignviewmenu", UI_EMBOSSP, UI_HELV);
+ block= uiBeginBlock(C, ar, "view3d_view_alignviewmenu", UI_EMBOSSP, UI_HELV);
uiBlockSetButmFunc(block, do_view3d_view_alignviewmenu, NULL);
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Center View to Cursor|C", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 3, "");
@@ -488,7 +488,7 @@ static uiBlock *view3d_view_alignviewmenu(bContext *C, uiMenuBlockHandle *handle
//{
//}
-static uiBlock *view3d_view_spacehandlers(bContext *C, uiMenuBlockHandle *handle, void *arg_unused)
+static uiBlock *view3d_view_spacehandlers(bContext *C, ARegion *ar, void *arg_unused)
{
/* XXX */
return NULL;
@@ -553,7 +553,7 @@ static void do_view3d_viewmenu(bContext *C, void *arg, int event)
allqueue(REDRAWVIEW3D, 1);
}
-static uiBlock *view3d_viewmenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused)
+static uiBlock *view3d_viewmenu(bContext *C, ARegion *ar, void *arg_unused)
{
ScrArea *sa= CTX_wm_area(C);
View3D *v3d= sa->spacedata.first;
@@ -561,7 +561,7 @@ static uiBlock *view3d_viewmenu(bContext *C, uiMenuBlockHandle *handle, void *ar
uiBlock *block;
short yco= 0, menuwidth=120;
- block= uiBeginBlock(C, handle->region, "view3d_viewmenu", UI_EMBOSSP, UI_HELV);
+ block= uiBeginBlock(C, ar, "view3d_viewmenu", UI_EMBOSSP, UI_HELV);
uiBlockSetButmFunc(block, do_view3d_viewmenu, NULL);
uiDefIconTextBut(block, BUTM, 1, ICON_MENU_PANEL, "Transform Orientations...", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 20, "");
@@ -630,7 +630,7 @@ static uiBlock *view3d_viewmenu(bContext *C, uiMenuBlockHandle *handle, void *ar
uiDefIconTextBlockBut(block, view3d_view_spacehandlers, NULL, ICON_RIGHTARROW_THIN, "Space Handler Scripts", 0, yco-=20, 120, 19, "");
#endif
- if(handle->region->alignment==RGN_ALIGN_TOP) {
+ if(ar->alignment==RGN_ALIGN_TOP) {
uiBlockSetDirection(block, UI_DOWN);
}
else {
@@ -687,12 +687,12 @@ void do_view3d_select_object_typemenu(bContext *C, void *arg, int event)
allqueue(REDRAWVIEW3D, 0);
}
-static uiBlock *view3d_select_object_typemenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused)
+static uiBlock *view3d_select_object_typemenu(bContext *C, ARegion *ar, void *arg_unused)
{
uiBlock *block;
short yco = 20, menuwidth = 120;
- block= uiBeginBlock(C, handle->region, "view3d_select_object_typemenu", UI_EMBOSSP, UI_HELV);
+ block= uiBeginBlock(C, ar, "view3d_select_object_typemenu", UI_EMBOSSP, UI_HELV);
uiBlockSetButmFunc(block, do_view3d_select_object_typemenu, NULL);
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Mesh", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 1, "");
@@ -750,12 +750,12 @@ void do_view3d_select_object_layermenu(bContext *C, void *arg, int event)
allqueue(REDRAWVIEW3D, 0);
}
-static uiBlock *view3d_select_object_layermenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused)
+static uiBlock *view3d_select_object_layermenu(bContext *C, ARegion *ar, void *arg_unused)
{
uiBlock *block;
short xco= 0, yco = 20, menuwidth = 22;
- block= uiBeginBlock(C, handle->region, "view3d_select_object_layermenu", UI_EMBOSSP, UI_HELV);
+ block= uiBeginBlock(C, ar, "view3d_select_object_layermenu", UI_EMBOSSP, UI_HELV);
uiBlockSetButmFunc(block, do_view3d_select_object_layermenu, NULL);
uiDefBut(block, BUTM, 1, "1", xco, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 1, "");
@@ -801,12 +801,12 @@ void do_view3d_select_object_linkedmenu(bContext *C, void *arg, int event)
allqueue(REDRAWVIEW3D, 0);
}
-static uiBlock *view3d_select_object_linkedmenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused)
+static uiBlock *view3d_select_object_linkedmenu(bContext *C, ARegion *ar, void *arg_unused)
{
uiBlock *block;
short yco = 20, menuwidth = 120;
- block= uiBeginBlock(C, handle->region, "view3d_select_object_linkedmenu", UI_EMBOSSP, UI_HELV);
+ block= uiBeginBlock(C, ar, "view3d_select_object_linkedmenu", UI_EMBOSSP, UI_HELV);
uiBlockSetButmFunc(block, do_view3d_select_object_linkedmenu, NULL);
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Object Ipo|Shift L, 1", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 1, "");
@@ -841,12 +841,12 @@ void do_view3d_select_object_groupedmenu(bContext *C, void *arg, int event)
}
-static uiBlock *view3d_select_object_groupedmenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused)
+static uiBlock *view3d_select_object_groupedmenu(bContext *C, ARegion *ar, void *arg_unused)
{
uiBlock *block;
short yco = 20, menuwidth = 120;
- block= uiBeginBlock(C, handle->region, "view3d_select_object_groupedmenu", UI_EMBOSSP, UI_HELV);
+ block= uiBeginBlock(C, ar, "view3d_select_object_groupedmenu", UI_EMBOSSP, UI_HELV);
uiBlockSetButmFunc(block, do_view3d_select_object_groupedmenu, NULL);
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Children|Shift G, 1", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 1, "");
@@ -868,12 +868,12 @@ static uiBlock *view3d_select_object_groupedmenu(bContext *C, uiMenuBlockHandle
#endif
-static uiBlock *view3d_select_objectmenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused)
+static uiBlock *view3d_select_objectmenu(bContext *C, ARegion *ar, void *arg_unused)
{
uiBlock *block;
// short yco= 0, menuwidth=120;
- block= uiBeginBlock(C, handle->region, "view3d_select_objectmenu", UI_EMBOSSP, UI_HELV);
+ block= uiBeginBlock(C, ar, "view3d_select_objectmenu", UI_EMBOSSP, UI_HELV);
#if 0
uiBlockSetButmFunc(block, do_view3d_select_objectmenu, NULL);
@@ -905,7 +905,7 @@ static uiBlock *view3d_select_objectmenu(bContext *C, uiMenuBlockHandle *handle,
uiDefMenuButO(block, "OBJECT_OT_select_by_type", "Select All by Type");
- if(handle->region->alignment==RGN_ALIGN_TOP) {
+ if(ar->alignment==RGN_ALIGN_TOP) {
uiBlockSetDirection(block, UI_DOWN);
}
else {
@@ -989,12 +989,12 @@ void do_view3d_select_meshmenu(bContext *C, void *arg, int event)
}
-static uiBlock *view3d_select_meshmenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused)
+static uiBlock *view3d_select_meshmenu(bContext *C, ARegion *ar, void *arg_unused)
{
uiBlock *block;
short yco= 0, menuwidth=120;
- block= uiBeginBlock(C, handle->region, "view3d_select_meshmenu", UI_EMBOSSP, UI_HELV);
+ block= uiBeginBlock(C, ar, "view3d_select_meshmenu", UI_EMBOSSP, UI_HELV);
uiBlockSetButmFunc(block, do_view3d_select_meshmenu, NULL);
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Border Select|B", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 0, "");
@@ -1056,7 +1056,7 @@ static uiBlock *view3d_select_meshmenu(bContext *C, uiMenuBlockHandle *handle, v
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Loop to Region|Ctrl E 8", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 19, "");
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Region to Loop|Ctrl E 9", 0, yco-=20, menuwidth, 20, NULL, 0.0, 0.0, 1, 20, "");
- if(handle->region->alignment==RGN_ALIGN_TOP) {
+ if(ar->alignment==RGN_ALIGN_TOP) {
uiBlockSetDirection(block, UI_DOWN);
}
else {
@@ -1122,13 +1122,13 @@ void do_view3d_select_curvemenu(bContext *C, void *arg, int event)
}
-static uiBlock *view3d_select_curvemenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused)
+static uiBlock *view3d_select_curvemenu(bContext *C, ARegion *ar, void *arg_unused)
{
Scene *scene= CTX_data_scene(C);
uiBlock *block;
short yco= 0, menuwidth=120;
- block= uiBeginBlock(C, handle->region, "view3d_select_curvemenu", UI_EMBOSSP, UI_HELV);
+ block= uiBeginBlock(C, ar, "view3d_select_curvemenu", UI_EMBOSSP, UI_HELV);
uiBlockSetButmFunc(block, do_view3d_select_curvemenu, NULL);
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Border Select|B", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 0, "");
@@ -1161,7 +1161,7 @@ static uiBlock *view3d_select_curvemenu(bContext *C, uiMenuBlockHandle *handle,
/* commented out because it seems to only like the LKEY method - based on mouse pointer position :( */
/*uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Connected Control Points|Ctrl L", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 4, "");*/
- if(handle->region->alignment==RGN_ALIGN_TOP) {
+ if(ar->alignment==RGN_ALIGN_TOP) {
uiBlockSetDirection(block, UI_DOWN);
}
else {
@@ -1196,12 +1196,12 @@ void do_view3d_select_metaballmenu(bContext *C, void *arg, int event)
}
-static uiBlock *view3d_select_metaballmenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused)
+static uiBlock *view3d_select_metaballmenu(bContext *C, ARegion *ar, void *arg_unused)
{
uiBlock *block;
short yco= 0, menuwidth=120;
- block= uiBeginBlock(C, handle->region, "view3d_select_metaballmenu", UI_EMBOSSP, UI_HELV);
+ block= uiBeginBlock(C, ar, "view3d_select_metaballmenu", UI_EMBOSSP, UI_HELV);
uiBlockSetButmFunc(block, do_view3d_select_metaballmenu, NULL);
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Border Select|B", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 0, "");
@@ -1216,7 +1216,7 @@ static uiBlock *view3d_select_metaballmenu(bContext *C, uiMenuBlockHandle *handl
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Random...", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 4, "");
- if(handle->region->alignment==RGN_ALIGN_TOP) {
+ if(ar->alignment==RGN_ALIGN_TOP) {
uiBlockSetDirection(block, UI_DOWN);
}
else {
@@ -1245,12 +1245,12 @@ static void do_view3d_select_latticemenu(bContext *C, void *arg, int event)
#endif
}
-static uiBlock *view3d_select_latticemenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused)
+static uiBlock *view3d_select_latticemenu(bContext *C, ARegion *ar, void *arg_unused)
{
uiBlock *block;
short yco= 0, menuwidth=120;
- block= uiBeginBlock(C, handle->region, "view3d_select_latticemenu", UI_EMBOSSP, UI_HELV);
+ block= uiBeginBlock(C, ar, "view3d_select_latticemenu", UI_EMBOSSP, UI_HELV);
uiBlockSetButmFunc(block, do_view3d_select_latticemenu, NULL);
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Border Select|B", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 0, "");
@@ -1259,7 +1259,7 @@ static uiBlock *view3d_select_latticemenu(bContext *C, uiMenuBlockHandle *handle
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Select/Deselect All|A", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 2, "");
- if(handle->region->alignment==RGN_ALIGN_TOP) {
+ if(ar->alignment==RGN_ALIGN_TOP) {
uiBlockSetDirection(block, UI_DOWN);
}
else {
@@ -1303,12 +1303,12 @@ static void do_view3d_select_armaturemenu(bContext *C, void *arg, int event)
#endif
}
-static uiBlock *view3d_select_armaturemenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused)
+static uiBlock *view3d_select_armaturemenu(bContext *C, ARegion *ar, void *arg_unused)
{
uiBlock *block;
short yco= 0, menuwidth=120;
- block= uiBeginBlock(C, handle->region, "view3d_select_armaturemenu", UI_EMBOSSP, UI_HELV);
+ block= uiBeginBlock(C, ar, "view3d_select_armaturemenu", UI_EMBOSSP, UI_HELV);
uiBlockSetButmFunc(block, do_view3d_select_armaturemenu, NULL);
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Border Select|B", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 0, "");
@@ -1328,7 +1328,7 @@ static uiBlock *view3d_select_armaturemenu(bContext *C, uiMenuBlockHandle *handl
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Extend Select Parent|Shift [", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 6, "");
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Extend Select Child|Shift ]", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 7, "");
- if(handle->region->alignment==RGN_ALIGN_TOP) {
+ if(ar->alignment==RGN_ALIGN_TOP) {
uiBlockSetDirection(block, UI_DOWN);
}
else {
@@ -1375,12 +1375,12 @@ static void do_view3d_select_pose_armaturemenu(bContext *C, void *arg, int event
#endif
}
-static uiBlock *view3d_select_pose_armaturemenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused)
+static uiBlock *view3d_select_pose_armaturemenu(bContext *C, ARegion *ar, void *arg_unused)
{
uiBlock *block;
short yco= 0, menuwidth=120;
- block= uiBeginBlock(C, handle->region, "view3d_select_pose_armaturemenu", UI_EMBOSSP, UI_HELV);
+ block= uiBeginBlock(C, ar, "view3d_select_pose_armaturemenu", UI_EMBOSSP, UI_HELV);
uiBlockSetButmFunc(block, do_view3d_select_pose_armaturemenu, NULL);
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Border Select|B", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 0, "");
@@ -1401,7 +1401,7 @@ static uiBlock *view3d_select_pose_armaturemenu(bContext *C, uiMenuBlockHandle *
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Extend Select Parent|Shift [", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 8, "");
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Extend Select Child|Shift ]", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 9, "");
- if(handle->region->alignment==RGN_ALIGN_TOP) {
+ if(ar->alignment==RGN_ALIGN_TOP) {
uiBlockSetDirection(block, UI_DOWN);
}
else {
@@ -1439,7 +1439,7 @@ void do_view3d_select_faceselmenu(bContext *C, void *arg, int event)
#endif
}
-static uiBlock *view3d_select_faceselmenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused)
+static uiBlock *view3d_select_faceselmenu(bContext *C, ARegion *ar, void *arg_unused)
{
uiBlock *block;
short yco= 0, menuwidth=120;
@@ -1448,7 +1448,7 @@ static uiBlock *view3d_select_faceselmenu(bContext *C, uiMenuBlockHandle *handle
// int i = 0;
#endif
- block= uiBeginBlock(C, handle->region, "view3d_select_faceselmenu", UI_EMBOSSP, UI_HELV);
+ block= uiBeginBlock(C, ar, "view3d_select_faceselmenu", UI_EMBOSSP, UI_HELV);
uiBlockSetButmFunc(block, do_view3d_select_faceselmenu, NULL);
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Border Select|B", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 0, "");
@@ -1472,7 +1472,7 @@ static uiBlock *view3d_select_faceselmenu(bContext *C, uiMenuBlockHandle *handle
// }
#endif
- if(handle->region->alignment==RGN_ALIGN_TOP) {
+ if(ar->alignment==RGN_ALIGN_TOP) {
uiBlockSetDirection(block, UI_DOWN);
}
else {
@@ -1515,12 +1515,12 @@ void do_view3d_edit_snapmenu(bContext *C, void *arg, int event)
#endif
}
-static uiBlock *view3d_edit_snapmenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused)
+static uiBlock *view3d_edit_snapmenu(bContext *C, ARegion *ar, void *arg_unused)
{
uiBlock *block;
short yco = 20, menuwidth = 120;
- block= uiBeginBlock(C, handle->region, "view3d_edit_snapmenu", UI_EMBOSSP, UI_HELV);
+ block= uiBeginBlock(C, ar, "view3d_edit_snapmenu", UI_EMBOSSP, UI_HELV);
uiBlockSetButmFunc(block, do_view3d_edit_snapmenu, NULL);
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Selection -> Grid|Shift S, 1", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 1, "");
@@ -1582,12 +1582,12 @@ void do_view3d_transform_moveaxismenu(bContext *C, void *arg, int event)
#endif
}
-static uiBlock *view3d_transform_moveaxismenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused)
+static uiBlock *view3d_transform_moveaxismenu(bContext *C, ARegion *ar, void *arg_unused)
{
uiBlock *block;
short yco = 20, menuwidth = 120;
- block= uiBeginBlock(C, handle->region, "view3d_transform_moveaxismenu", UI_EMBOSSP, UI_HELV);
+ block= uiBeginBlock(C, ar, "view3d_transform_moveaxismenu", UI_EMBOSSP, UI_HELV);
uiBlockSetButmFunc(block, do_view3d_transform_moveaxismenu, NULL);
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "X Global|G, X", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 0, "");
@@ -1650,12 +1650,12 @@ void do_view3d_transform_rotateaxismenu(bContext *C, void *arg, int event)
#endif
}
-static uiBlock *view3d_transform_rotateaxismenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused)
+static uiBlock *view3d_transform_rotateaxismenu(bContext *C, ARegion *ar, void *arg_unused)
{
uiBlock *block;
short yco = 20, menuwidth = 120;
- block= uiBeginBlock(C, handle->region, "view3d_transform_rotateaxismenu", UI_EMBOSSP, UI_HELV);
+ block= uiBeginBlock(C, ar, "view3d_transform_rotateaxismenu", UI_EMBOSSP, UI_HELV);
uiBlockSetButmFunc(block, do_view3d_transform_rotateaxismenu, NULL);
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "X Global|R, X", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 0, "");
@@ -1718,12 +1718,12 @@ void do_view3d_transform_scaleaxismenu(bContext *C, void *arg, int event)
#endif
}
-static uiBlock *view3d_transform_scaleaxismenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused)
+static uiBlock *view3d_transform_scaleaxismenu(bContext *C, ARegion *ar, void *arg_unused)
{
uiBlock *block;
short yco = 20, menuwidth = 120;
- block= uiBeginBlock(C, handle->region, "view3d_transform_scaleaxismenu", UI_EMBOSSP, UI_HELV);
+ block= uiBeginBlock(C, ar, "view3d_transform_scaleaxismenu", UI_EMBOSSP, UI_HELV);
uiBlockSetButmFunc(block, do_view3d_transform_scaleaxismenu, NULL);
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "X Global|S, X", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 0, "");
@@ -1829,14 +1829,14 @@ static void do_view3d_transformmenu(bContext *C, void *arg, int event)
#endif
}
-static uiBlock *view3d_transformmenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused)
+static uiBlock *view3d_transformmenu(bContext *C, ARegion *ar, void *arg_unused)
{
Scene *scene= CTX_data_scene(C);
Object *obedit = CTX_data_edit_object(C);
uiBlock *block;
short yco = 20, menuwidth = 120;
- block= uiBeginBlock(C, handle->region, "view3d_transformmenu", UI_EMBOSSP, UI_HELV);
+ block= uiBeginBlock(C, ar, "view3d_transformmenu", UI_EMBOSSP, UI_HELV);
uiBlockSetButmFunc(block, do_view3d_transformmenu, NULL);
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Grab/Move|G", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 1, "");
@@ -1958,12 +1958,12 @@ void do_view3d_object_mirrormenu(bContext *C, void *arg, int event)
#endif
}
-static uiBlock *view3d_object_mirrormenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused)
+static uiBlock *view3d_object_mirrormenu(bContext *C, ARegion *ar, void *arg_unused)
{
uiBlock *block;
short yco = 20, menuwidth = 120;
- block= uiBeginBlock(C, handle->region, "view3d_object_mirrormenu", UI_EMBOSSP, UI_HELV);
+ block= uiBeginBlock(C, ar, "view3d_object_mirrormenu", UI_EMBOSSP, UI_HELV);
uiBlockSetButmFunc(block, do_view3d_object_mirrormenu, NULL);
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Interactive Mirror|Ctrl M", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 0, "");
@@ -2010,12 +2010,12 @@ static void do_view3d_edit_object_transformmenu(bContext *C, void *arg, int even
#endif
}
-static uiBlock *view3d_edit_object_transformmenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused)
+static uiBlock *view3d_edit_object_transformmenu(bContext *C, ARegion *ar, void *arg_unused)
{
uiBlock *block;
short yco = 20, menuwidth = 120;
- block= uiBeginBlock(C, handle->region, "view3d_edit_object_transformmenu", UI_EMBOSSP, UI_HELV);
+ block= uiBeginBlock(C, ar, "view3d_edit_object_transformmenu", UI_EMBOSSP, UI_HELV);
uiBlockSetButmFunc(block, do_view3d_edit_object_transformmenu, NULL);
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Apply Scale/Rotation to ObData|Ctrl A, 1", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 6, "");
@@ -2048,12 +2048,12 @@ static void do_view3d_edit_object_makelocalmenu(bContext *C, void *arg, int even
#endif
}
-static uiBlock *view3d_edit_object_makelocalmenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused)
+static uiBlock *view3d_edit_object_makelocalmenu(bContext *C, ARegion *ar, void *arg_unused)
{
uiBlock *block;
short yco = 20, menuwidth = 120;
- block= uiBeginBlock(C, handle->region, "view3d_edit_object_makelocalmenu", UI_EMBOSSP, UI_HELV);
+ block= uiBeginBlock(C, ar, "view3d_edit_object_makelocalmenu", UI_EMBOSSP, UI_HELV);
uiBlockSetButmFunc(block, do_view3d_edit_object_makelocalmenu, NULL);
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Selected Objects|L, 1", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 1, "");
@@ -2080,7 +2080,7 @@ static void do_view3d_edit_object_makelinksmenu(bContext *C, void *arg, int even
#endif
}
-static uiBlock *view3d_edit_object_makelinksmenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused)
+static uiBlock *view3d_edit_object_makelinksmenu(bContext *C, ARegion *ar, void *arg_unused)
{
Scene *scene= CTX_data_scene(C);
Object *ob=NULL;
@@ -2088,7 +2088,7 @@ static uiBlock *view3d_edit_object_makelinksmenu(bContext *C, uiMenuBlockHandle
uiBlock *block;
short yco = 20, menuwidth = 120;
- block= uiBeginBlock(C, handle->region, "view3d_edit_object_makelinksmenu", UI_EMBOSSP, UI_HELV);
+ block= uiBeginBlock(C, ar, "view3d_edit_object_makelinksmenu", UI_EMBOSSP, UI_HELV);
uiBlockSetButmFunc(block, do_view3d_edit_object_makelinksmenu, NULL);
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "To Scene...|Ctrl L, 1", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 1, "");
@@ -2160,13 +2160,13 @@ static void do_view3d_edit_object_singleusermenu(bContext *C, void *arg, int eve
#endif
}
-static uiBlock *view3d_edit_object_singleusermenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused)
+static uiBlock *view3d_edit_object_singleusermenu(bContext *C, ARegion *ar, void *arg_unused)
{
uiBlock *block;
short yco = 20, menuwidth = 120;
- block= uiBeginBlock(C, handle->region, "view3d_edit_object_singleusermenu", UI_EMBOSSP, UI_HELV);
+ block= uiBeginBlock(C, ar, "view3d_edit_object_singleusermenu", UI_EMBOSSP, UI_HELV);
uiBlockSetButmFunc(block, do_view3d_edit_object_singleusermenu, NULL);
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Object|U, 1", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 1, "");
@@ -2212,7 +2212,7 @@ static void do_view3d_edit_object_copyattrmenu(bContext *C, void *arg, int event
allqueue(REDRAWVIEW3D, 0);
}
-static uiBlock *view3d_edit_object_copyattrmenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused)
+static uiBlock *view3d_edit_object_copyattrmenu(bContext *C, ARegion *ar, void *arg_unused)
{
Scene *scene= CTX_data_scene(C);
Object *ob=NULL;
@@ -2220,7 +2220,7 @@ static uiBlock *view3d_edit_object_copyattrmenu(bContext *C, uiMenuBlockHandle *
uiBlock *block;
short yco = 20, menuwidth = 120;
- block= uiBeginBlock(C, handle->region, "view3d_edit_object_copyattrmenu", UI_EMBOSSP, UI_HELV);
+ block= uiBeginBlock(C, ar, "view3d_edit_object_copyattrmenu", UI_EMBOSSP, UI_HELV);
uiBlockSetButmFunc(block, do_view3d_edit_object_copyattrmenu, NULL);
ob= OBACT;
@@ -2291,12 +2291,12 @@ static void do_view3d_edit_object_parentmenu(bContext *C, void *arg, int event)
#endif
}
-static uiBlock *view3d_edit_object_parentmenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused)
+static uiBlock *view3d_edit_object_parentmenu(bContext *C, ARegion *ar, void *arg_unused)
{
uiBlock *block;
short yco = 20, menuwidth = 120;
- block= uiBeginBlock(C, handle->region, "view3d_edit_object_parentmenu", UI_EMBOSSP, UI_HELV);
+ block= uiBeginBlock(C, ar, "view3d_edit_object_parentmenu", UI_EMBOSSP, UI_HELV);
uiBlockSetButmFunc(block, do_view3d_edit_object_parentmenu, NULL);
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Make Parent...|Ctrl P", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 1, "");
@@ -2321,12 +2321,12 @@ static void do_view3d_edit_object_groupmenu(bContext *C, void *arg, int event)
#endif
}
-static uiBlock *view3d_edit_object_groupmenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused)
+static uiBlock *view3d_edit_object_groupmenu(bContext *C, ARegion *ar, void *arg_unused)
{
uiBlock *block;
short yco = 20, menuwidth = 120;
- block= uiBeginBlock(C, handle->region, "view3d_edit_object_groupmenu", UI_EMBOSSP, UI_HELV);
+ block= uiBeginBlock(C, ar, "view3d_edit_object_groupmenu", UI_EMBOSSP, UI_HELV);
uiBlockSetButmFunc(block, do_view3d_edit_object_groupmenu, NULL);
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Add to Existing Group|Ctrl G, 1", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 3, "");
@@ -2353,12 +2353,12 @@ static void do_view3d_edit_object_trackmenu(bContext *C, void *arg, int event)
#endif
}
-static uiBlock *view3d_edit_object_trackmenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused)
+static uiBlock *view3d_edit_object_trackmenu(bContext *C, ARegion *ar, void *arg_unused)
{
uiBlock *block;
short yco = 20, menuwidth = 120;
- block= uiBeginBlock(C, handle->region, "view3d_edit_object_trackmenu", UI_EMBOSSP, UI_HELV);
+ block= uiBeginBlock(C, ar, "view3d_edit_object_trackmenu", UI_EMBOSSP, UI_HELV);
uiBlockSetButmFunc(block, do_view3d_edit_object_trackmenu, NULL);
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Make Track...|Ctrl T", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 1, "");
@@ -2384,12 +2384,12 @@ static void do_view3d_edit_object_constraintsmenu(bContext *C, void *arg, int ev
#endif
}
-static uiBlock *view3d_edit_object_constraintsmenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused)
+static uiBlock *view3d_edit_object_constraintsmenu(bContext *C, ARegion *ar, void *arg_unused)
{
uiBlock *block;
short yco = 20, menuwidth = 120;
- block= uiBeginBlock(C, handle->region, "view3d_edit_object_constraintsmenu", UI_EMBOSSP, UI_HELV);
+ block= uiBeginBlock(C, ar, "view3d_edit_object_constraintsmenu", UI_EMBOSSP, UI_HELV);
uiBlockSetButmFunc(block, do_view3d_edit_object_constraintsmenu, NULL);
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Add Constraint...|Ctrl Alt C", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 1, "");
@@ -2420,12 +2420,12 @@ static void do_view3d_edit_object_showhidemenu(bContext *C, void *arg, int event
#endif
}
-static uiBlock *view3d_edit_object_showhidemenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused)
+static uiBlock *view3d_edit_object_showhidemenu(bContext *C, ARegion *ar, void *arg_unused)
{
uiBlock *block;
short yco = 20, menuwidth = 120;
- block= uiBeginBlock(C, handle->region, "view3d_edit_object_showhidemenu", UI_EMBOSSP, UI_HELV);
+ block= uiBeginBlock(C, ar, "view3d_edit_object_showhidemenu", UI_EMBOSSP, UI_HELV);
uiBlockSetButmFunc(block, do_view3d_edit_object_showhidemenu, NULL);
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Show Hidden|Alt H", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 0, "");
@@ -2447,14 +2447,14 @@ static void do_view3d_edit_object_scriptsmenu(bContext *C, void *arg, int event)
#endif
}
-static uiBlock *view3d_edit_object_scriptsmenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused)
+static uiBlock *view3d_edit_object_scriptsmenu(bContext *C, ARegion *ar, void *arg_unused)
{
uiBlock *block;
// short yco = 20, menuwidth = 120;
// XXX BPyMenu *pym;
// int i = 0;
- block= uiBeginBlock(C, handle->region, "v3d_eobject_pymenu", UI_EMBOSSP, UI_HELV);
+ block= uiBeginBlock(C, ar, "v3d_eobject_pymenu", UI_EMBOSSP, UI_HELV);
uiBlockSetButmFunc(block, do_view3d_edit_object_scriptsmenu, NULL);
// for (pym = BPyMenuTable[PYMENU_OBJECT]; pym; pym = pym->next, i++) {
@@ -2522,13 +2522,13 @@ static void do_view3d_edit_objectmenu(bContext *C, void *arg, int event)
#endif
}
-static uiBlock *view3d_edit_objectmenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused)
+static uiBlock *view3d_edit_objectmenu(bContext *C, ARegion *ar, void *arg_unused)
{
Scene *scene= CTX_data_scene(C);
uiBlock *block;
short yco= 0, menuwidth=120;
- block= uiBeginBlock(C, handle->region, "view3d_edit_objectmenu", UI_EMBOSSP, UI_HELV);
+ block= uiBeginBlock(C, ar, "view3d_edit_objectmenu", UI_EMBOSSP, UI_HELV);
uiBlockSetButmFunc(block, do_view3d_edit_objectmenu, NULL);
uiDefIconTextBut(block, BUTM, 1, ICON_MENU_PANEL, "Transform Properties|N", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 15, "");
@@ -2582,7 +2582,7 @@ static uiBlock *view3d_edit_objectmenu(bContext *C, uiMenuBlockHandle *handle, v
uiDefIconTextBlockBut(block, view3d_edit_object_scriptsmenu, NULL, ICON_RIGHTARROW_THIN, "Scripts", 0, yco-=20, 120, 19, "");
#endif
- if(handle->region->alignment==RGN_ALIGN_TOP) {
+ if(ar->alignment==RGN_ALIGN_TOP) {
uiBlockSetDirection(block, UI_DOWN);
}
else {
@@ -2604,13 +2604,13 @@ static void do_view3d_edit_propfalloffmenu(bContext *C, void *arg, int event)
allqueue(REDRAWVIEW3D, 1);
}
-static uiBlock *view3d_edit_propfalloffmenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused)
+static uiBlock *view3d_edit_propfalloffmenu(bContext *C, ARegion *ar, void *arg_unused)
{
Scene *scene= CTX_data_scene(C);
uiBlock *block;
short yco = 20, menuwidth = 120;
- block= uiBeginBlock(C, handle->region, "view3d_edit_propfalloffmenu", UI_EMBOSSP, UI_HELV);
+ block= uiBeginBlock(C, ar, "view3d_edit_propfalloffmenu", UI_EMBOSSP, UI_HELV);
uiBlockSetButmFunc(block, do_view3d_edit_propfalloffmenu, NULL);
if (scene->prop_mode==PROP_SMOOTH) uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_HLT, "Smooth|Shift O", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, PROP_SMOOTH, "");
@@ -2677,12 +2677,12 @@ void do_view3d_edit_mesh_verticesmenu(bContext *C, void *arg, int event)
#endif
}
-static uiBlock *view3d_edit_mesh_verticesmenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused)
+static uiBlock *view3d_edit_mesh_verticesmenu(bContext *C, ARegion *ar, void *arg_unused)
{
uiBlock *block;
short yco = 20, menuwidth = 120;
- block= uiBeginBlock(C, handle->region, "view3d_edit_mesh_verticesmenu", UI_EMBOSSP, UI_HELV);
+ block= uiBeginBlock(C, ar, "view3d_edit_mesh_verticesmenu", UI_EMBOSSP, UI_HELV);
uiBlockSetButmFunc(block, do_view3d_edit_mesh_verticesmenu, NULL);
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Merge...|Alt M", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 5, "");
@@ -2796,12 +2796,12 @@ void do_view3d_edit_mesh_edgesmenu(bContext *C, void *arg, int event)
#endif
}
-static uiBlock *view3d_edit_mesh_edgesmenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused)
+static uiBlock *view3d_edit_mesh_edgesmenu(bContext *C, ARegion *ar, void *arg_unused)
{
uiBlock *block;
short yco = 20, menuwidth = 120;
- block= uiBeginBlock(C, handle->region, "view3d_edit_mesh_edgesmenu", UI_EMBOSSP, UI_HELV);
+ block= uiBeginBlock(C, ar, "view3d_edit_mesh_edgesmenu", UI_EMBOSSP, UI_HELV);
uiBlockSetButmFunc(block, do_view3d_edit_mesh_edgesmenu, NULL);
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Make Edge/Face|F", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 5, "");
@@ -2886,12 +2886,12 @@ void do_view3d_edit_mesh_facesmenu(bContext *C, void *arg, int event)
#endif
}
-static uiBlock *view3d_edit_mesh_facesmenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused)
+static uiBlock *view3d_edit_mesh_facesmenu(bContext *C, ARegion *ar, void *arg_unused)
{
uiBlock *block;
short yco = 20, menuwidth = 120;
- block= uiBeginBlock(C, handle->region, "view3d_edit_mesh_facesmenu", UI_EMBOSSP, UI_HELV);
+ block= uiBeginBlock(C, ar, "view3d_edit_mesh_facesmenu", UI_EMBOSSP, UI_HELV);
uiBlockSetButmFunc(block, do_view3d_edit_mesh_facesmenu, NULL);
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Make Edge/Face|F", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 5, "");
@@ -2933,12 +2933,12 @@ void do_view3d_edit_mesh_normalsmenu(bContext *C, void *arg, int event)
#endif
}
-static uiBlock *view3d_edit_mesh_normalsmenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused)
+static uiBlock *view3d_edit_mesh_normalsmenu(bContext *C, ARegion *ar, void *arg_unused)
{
uiBlock *block;
short yco = 20, menuwidth = 120;
- block= uiBeginBlock(C, handle->region, "view3d_edit_mesh_normalsmenu", UI_EMBOSSP, UI_HELV);
+ block= uiBeginBlock(C, ar, "view3d_edit_mesh_normalsmenu", UI_EMBOSSP, UI_HELV);
uiBlockSetButmFunc(block, do_view3d_edit_mesh_normalsmenu, NULL);
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Recalculate Outside|Ctrl N", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 2, "");
@@ -3000,12 +3000,12 @@ void do_view3d_edit_mirrormenu(bContext *C, void *arg, int event)
#endif
}
-static uiBlock *view3d_edit_mirrormenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused)
+static uiBlock *view3d_edit_mirrormenu(bContext *C, ARegion *ar, void *arg_unused)
{
uiBlock *block;
short yco = 20, menuwidth = 120;
- block= uiBeginBlock(C, handle->region, "view3d_edit_mirrormenu", UI_EMBOSSP, UI_HELV);
+ block= uiBeginBlock(C, ar, "view3d_edit_mirrormenu", UI_EMBOSSP, UI_HELV);
uiBlockSetButmFunc(block, do_view3d_edit_mirrormenu, NULL);
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Interactive Mirror|Ctrl M", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 0, "");
@@ -3047,12 +3047,12 @@ static void do_view3d_edit_mesh_showhidemenu(bContext *C, void *arg, int event)
#endif
}
-static uiBlock *view3d_edit_mesh_showhidemenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused)
+static uiBlock *view3d_edit_mesh_showhidemenu(bContext *C, ARegion *ar, void *arg_unused)
{
uiBlock *block;
short yco = 20, menuwidth = 120;
- block= uiBeginBlock(C, handle->region, "view3d_edit_mesh_showhidemenu", UI_EMBOSSP, UI_HELV);
+ block= uiBeginBlock(C, ar, "view3d_edit_mesh_showhidemenu", UI_EMBOSSP, UI_HELV);
uiBlockSetButmFunc(block, do_view3d_edit_mesh_showhidemenu, NULL);
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Show Hidden|Alt H", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 0, "");
@@ -3074,14 +3074,14 @@ static void do_view3d_edit_mesh_scriptsmenu(bContext *C, void *arg, int event)
#endif
}
-static uiBlock *view3d_edit_mesh_scriptsmenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused)
+static uiBlock *view3d_edit_mesh_scriptsmenu(bContext *C, ARegion *ar, void *arg_unused)
{
uiBlock *block;
// short yco = 20, menuwidth = 120;
// XXX BPyMenu *pym;
// int i = 0;
- block= uiBeginBlock(C, handle->region, "v3d_emesh_pymenu", UI_EMBOSSP, UI_HELV);
+ block= uiBeginBlock(C, ar, "v3d_emesh_pymenu", UI_EMBOSSP, UI_HELV);
uiBlockSetButmFunc(block, do_view3d_edit_mesh_scriptsmenu, NULL);
// for (pym = BPyMenuTable[PYMENU_MESH]; pym; pym = pym->next, i++) {
@@ -3159,14 +3159,14 @@ static void do_view3d_edit_meshmenu(bContext *C, void *arg, int event)
#endif
}
-static uiBlock *view3d_edit_meshmenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused)
+static uiBlock *view3d_edit_meshmenu(bContext *C, ARegion *ar, void *arg_unused)
{
Scene *scene= CTX_data_scene(C);
Object *obedit = CTX_data_edit_object(C);
uiBlock *block;
short yco= 0, menuwidth=120;
- block= uiBeginBlock(C, handle->region, "view3d_edit_meshmenu", UI_EMBOSSP, UI_HELV);
+ block= uiBeginBlock(C, ar, "view3d_edit_meshmenu", UI_EMBOSSP, UI_HELV);
uiBlockSetButmFunc(block, do_view3d_edit_meshmenu, NULL);
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Undo Editing|Ctrl Z", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 0, "");
@@ -3231,7 +3231,7 @@ static uiBlock *view3d_edit_meshmenu(bContext *C, uiMenuBlockHandle *handle, voi
uiDefIconTextBlockBut(block, view3d_edit_mesh_scriptsmenu, NULL, ICON_RIGHTARROW_THIN, "Scripts", 0, yco-=20, 120, 19, "");
#endif
- if(handle->region->alignment==RGN_ALIGN_TOP) {
+ if(ar->alignment==RGN_ALIGN_TOP) {
uiBlockSetDirection(block, UI_DOWN);
}
else {
@@ -3282,13 +3282,13 @@ static void do_view3d_edit_curve_controlpointsmenu(bContext *C, void *arg, int e
#endif
}
-static uiBlock *view3d_edit_curve_controlpointsmenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused)
+static uiBlock *view3d_edit_curve_controlpointsmenu(bContext *C, ARegion *ar, void *arg_unused)
{
Scene *scene= CTX_data_scene(C);
uiBlock *block;
short yco = 20, menuwidth = 120;
- block= uiBeginBlock(C, handle->region, "view3d_edit_curve_controlpointsmenu", UI_EMBOSSP, UI_HELV);
+ block= uiBeginBlock(C, ar, "view3d_edit_curve_controlpointsmenu", UI_EMBOSSP, UI_HELV);
uiBlockSetButmFunc(block, do_view3d_edit_curve_controlpointsmenu, NULL);
if (OBACT->type == OB_CURVE) {
@@ -3327,12 +3327,12 @@ void do_view3d_edit_curve_segmentsmenu(bContext *C, void *arg, int event)
#endif
}
-static uiBlock *view3d_edit_curve_segmentsmenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused)
+static uiBlock *view3d_edit_curve_segmentsmenu(bContext *C, ARegion *ar, void *arg_unused)
{
uiBlock *block;
short yco = 20, menuwidth = 120;
- block= uiBeginBlock(C, handle->region, "view3d_edit_curve_segmentsmenu", UI_EMBOSSP, UI_HELV);
+ block= uiBeginBlock(C, ar, "view3d_edit_curve_segmentsmenu", UI_EMBOSSP, UI_HELV);
uiBlockSetButmFunc(block, do_view3d_edit_curve_segmentsmenu, NULL);
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Subdivide", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 0, "");
@@ -3361,13 +3361,13 @@ void do_view3d_edit_curve_showhidemenu(bContext *C, void *arg, int event)
#endif
}
-static uiBlock *view3d_edit_curve_showhidemenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused)
+static uiBlock *view3d_edit_curve_showhidemenu(bContext *C, ARegion *ar, void *arg_unused)
{
Scene *scene= CTX_data_scene(C);
uiBlock *block;
short yco = 20, menuwidth = 120;
- block= uiBeginBlock(C, handle->region, "view3d_edit_curve_showhidemenu", UI_EMBOSSP, UI_HELV);
+ block= uiBeginBlock(C, ar, "view3d_edit_curve_showhidemenu", UI_EMBOSSP, UI_HELV);
uiBlockSetButmFunc(block, do_view3d_edit_curve_showhidemenu, NULL);
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Show Hidden|Alt H", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 10, "");
@@ -3436,13 +3436,13 @@ static void do_view3d_edit_curvemenu(bContext *C, void *arg, int event)
#endif
}
-static uiBlock *view3d_edit_curvemenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused)
+static uiBlock *view3d_edit_curvemenu(bContext *C, ARegion *ar, void *arg_unused)
{
Scene *scene= CTX_data_scene(C);
uiBlock *block;
short yco= 0, menuwidth=120;
- block= uiBeginBlock(C, handle->region, "view3d_edit_curvemenu", UI_EMBOSSP, UI_HELV);
+ block= uiBeginBlock(C, ar, "view3d_edit_curvemenu", UI_EMBOSSP, UI_HELV);
uiBlockSetButmFunc(block, do_view3d_edit_curvemenu, NULL);
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Reload Original|U", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 0, "");
@@ -3489,7 +3489,7 @@ static uiBlock *view3d_edit_curvemenu(bContext *C, uiMenuBlockHandle *handle, vo
uiDefIconTextBlockBut(block, view3d_edit_curve_showhidemenu, NULL, ICON_RIGHTARROW_THIN, "Show/Hide Control Points", 0, yco-=20, menuwidth, 19, "");
- if(handle->region->alignment==RGN_ALIGN_TOP) {
+ if(ar->alignment==RGN_ALIGN_TOP) {
uiBlockSetDirection(block, UI_DOWN);
}
else {
@@ -3519,12 +3519,12 @@ static void do_view3d_edit_mball_showhidemenu(bContext *C, void *arg, int event)
#endif
}
-static uiBlock *view3d_edit_mball_showhidemenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused)
+static uiBlock *view3d_edit_mball_showhidemenu(bContext *C, ARegion *ar, void *arg_unused)
{
uiBlock *block;
short yco = 20, menuwidth = 120;
- block= uiBeginBlock(C, handle->region, "view3d_edit_mball_showhidemenu", UI_EMBOSSP, UI_HELV);
+ block= uiBeginBlock(C, ar, "view3d_edit_mball_showhidemenu", UI_EMBOSSP, UI_HELV);
uiBlockSetButmFunc(block, do_view3d_edit_mball_showhidemenu, NULL);
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Show Hidden|Alt H", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 10, "");
@@ -3574,12 +3574,12 @@ static void do_view3d_edit_metaballmenu(bContext *C, void *arg, int event)
#endif
}
-static uiBlock *view3d_edit_metaballmenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused)
+static uiBlock *view3d_edit_metaballmenu(bContext *C, ARegion *ar, void *arg_unused)
{
uiBlock *block;
short yco= 0, menuwidth=120;
- block= uiBeginBlock(C, handle->region, "view3d_edit_metaballmenu", UI_EMBOSSP, UI_HELV);
+ block= uiBeginBlock(C, ar, "view3d_edit_metaballmenu", UI_EMBOSSP, UI_HELV);
uiBlockSetButmFunc(block, do_view3d_edit_metaballmenu, NULL);
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Undo Editing|Ctrl Z", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 1, "");
@@ -3606,7 +3606,7 @@ static uiBlock *view3d_edit_metaballmenu(bContext *C, uiMenuBlockHandle *handle,
uiDefIconTextBlockBut(block, view3d_edit_mball_showhidemenu, NULL, ICON_RIGHTARROW_THIN, "Hide MetaElems", 0, yco-=20, 120, 19, "");
- if(handle->region->alignment==RGN_ALIGN_TOP) {
+ if(ar->alignment==RGN_ALIGN_TOP) {
uiBlockSetDirection(block, UI_DOWN);
}
else {
@@ -3678,12 +3678,12 @@ static void do_view3d_edit_text_charsmenu(bContext *C, void *arg, int event)
#endif
}
-static uiBlock *view3d_edit_text_charsmenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused)
+static uiBlock *view3d_edit_text_charsmenu(bContext *C, ARegion *ar, void *arg_unused)
{
uiBlock *block;
short yco = 20, menuwidth = 120;
- block= uiBeginBlock(C, handle->region, "view3d_edit_text_charsmenu", UI_EMBOSSP, UI_HELV);
+ block= uiBeginBlock(C, ar, "view3d_edit_text_charsmenu", UI_EMBOSSP, UI_HELV);
uiBlockSetButmFunc(block, do_view3d_edit_text_charsmenu, NULL);
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Copyright|Alt C", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 0, "");
@@ -3735,12 +3735,12 @@ static void do_view3d_edit_textmenu(bContext *C, void *arg, int event)
#endif
}
-static uiBlock *view3d_edit_textmenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused)
+static uiBlock *view3d_edit_textmenu(bContext *C, ARegion *ar, void *arg_unused)
{
uiBlock *block;
short yco= 0, menuwidth=120;
- block= uiBeginBlock(C, handle->region, "view3d_edit_textmenu", UI_EMBOSSP, UI_HELV);
+ block= uiBeginBlock(C, ar, "view3d_edit_textmenu", UI_EMBOSSP, UI_HELV);
uiBlockSetButmFunc(block, do_view3d_edit_textmenu, NULL);
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Undo Editing|U", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 0, "");
@@ -3753,7 +3753,7 @@ static uiBlock *view3d_edit_textmenu(bContext *C, uiMenuBlockHandle *handle, voi
uiDefIconTextBlockBut(block, view3d_edit_text_charsmenu, NULL, ICON_RIGHTARROW_THIN, "Special Characters", 0, yco-=20, 120, 19, "");
- if(handle->region->alignment==RGN_ALIGN_TOP) {
+ if(ar->alignment==RGN_ALIGN_TOP) {
uiBlockSetDirection(block, UI_DOWN);
}
else {
@@ -3801,13 +3801,13 @@ static void do_view3d_edit_latticemenu(bContext *C, void *arg, int event)
#endif
}
-static uiBlock *view3d_edit_latticemenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused)
+static uiBlock *view3d_edit_latticemenu(bContext *C, ARegion *ar, void *arg_unused)
{
Scene *scene= CTX_data_scene(C);
uiBlock *block;
short yco= 0, menuwidth=120;
- block= uiBeginBlock(C, handle->region, "view3d_edit_latticemenu", UI_EMBOSSP, UI_HELV);
+ block= uiBeginBlock(C, ar, "view3d_edit_latticemenu", UI_EMBOSSP, UI_HELV);
uiBlockSetButmFunc(block, do_view3d_edit_latticemenu, NULL);
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Undo Editing|U", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 0, "");
@@ -3836,7 +3836,7 @@ static uiBlock *view3d_edit_latticemenu(bContext *C, uiMenuBlockHandle *handle,
}
uiDefIconTextBlockBut(block, view3d_edit_propfalloffmenu, NULL, ICON_RIGHTARROW_THIN, "Proportional Falloff", 0, yco-=20, 120, 19, "");
- if(handle->region->alignment==RGN_ALIGN_TOP) {
+ if(ar->alignment==RGN_ALIGN_TOP) {
uiBlockSetDirection(block, UI_DOWN);
}
else {
@@ -3863,12 +3863,12 @@ void do_view3d_edit_armature_parentmenu(bContext *C, void *arg, int event)
#endif
}
-static uiBlock *view3d_edit_armature_parentmenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused)
+static uiBlock *view3d_edit_armature_parentmenu(bContext *C, ARegion *ar, void *arg_unused)
{
uiBlock *block;
short yco = 20, menuwidth = 120;
- block= uiBeginBlock(C, handle->region, "view3d_edit_armature_parentmenu", UI_EMBOSSP, UI_HELV);
+ block= uiBeginBlock(C, ar, "view3d_edit_armature_parentmenu", UI_EMBOSSP, UI_HELV);
uiBlockSetButmFunc(block, do_view3d_edit_armature_parentmenu, NULL);
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Make Parent...|Ctrl P", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 1, "");
@@ -3894,12 +3894,12 @@ void do_view3d_edit_armature_rollmenu(bContext *C, void *arg, int event)
#endif
}
-static uiBlock *view3d_edit_armature_rollmenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused)
+static uiBlock *view3d_edit_armature_rollmenu(bContext *C, ARegion *ar, void *arg_unused)
{
uiBlock *block;
short yco = 20, menuwidth = 120;
- block= uiBeginBlock(C, handle->region, "view3d_edit_armature_rollmenu", UI_EMBOSSP, UI_HELV);
+ block= uiBeginBlock(C, ar, "view3d_edit_armature_rollmenu", UI_EMBOSSP, UI_HELV);
uiBlockSetButmFunc(block, do_view3d_edit_armature_rollmenu, NULL);
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Clear Roll (Z-Axis Up)|Ctrl N, 1", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 1, "");
@@ -3991,14 +3991,14 @@ static void do_view3d_scripts_armaturemenu(bContext *C, void *arg, int event)
#endif
}
-static uiBlock *view3d_scripts_armaturemenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused)
+static uiBlock *view3d_scripts_armaturemenu(bContext *C, ARegion *ar, void *arg_unused)
{
uiBlock *block;
// XXX BPyMenu *pym;
// int i= 0;
// short yco = 20, menuwidth = 120;
- block= uiBeginBlock(C, handle->region, "view3d_scripts_armaturemenu", UI_EMBOSSP, UI_HELV);
+ block= uiBeginBlock(C, ar, "view3d_scripts_armaturemenu", UI_EMBOSSP, UI_HELV);
uiBlockSetButmFunc(block, do_view3d_scripts_armaturemenu, NULL);
/* note that we acount for the N previous entries with i+20: */
@@ -4021,12 +4021,12 @@ static void do_view3d_armature_settingsmenu(bContext *C, void *arg, int event)
// XXX setflag_armature(event);
}
-static uiBlock *view3d_armature_settingsmenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused)
+static uiBlock *view3d_armature_settingsmenu(bContext *C, ARegion *ar, void *arg_unused)
{
uiBlock *block;
short yco= 0, menuwidth=120;
- block= uiBeginBlock(C, handle->region, "view3d_armature_settingsmenu", UI_EMBOSSP, UI_HELV);
+ block= uiBeginBlock(C, ar, "view3d_armature_settingsmenu", UI_EMBOSSP, UI_HELV);
uiBlockSetButmFunc(block, do_view3d_armature_settingsmenu, NULL);
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Toggle a Setting|Shift W", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 0, "");
@@ -4039,14 +4039,14 @@ static uiBlock *view3d_armature_settingsmenu(bContext *C, uiMenuBlockHandle *han
return block;
}
-static uiBlock *view3d_edit_armaturemenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused)
+static uiBlock *view3d_edit_armaturemenu(bContext *C, ARegion *ar, void *arg_unused)
{
Object *obedit = CTX_data_edit_object(C);
bArmature *arm= obedit->data;
uiBlock *block;
short yco= 0, menuwidth=120;
- block= uiBeginBlock(C, handle->region, "view3d_edit_armaturemenu", UI_EMBOSSP, UI_HELV);
+ block= uiBeginBlock(C, ar, "view3d_edit_armaturemenu", UI_EMBOSSP, UI_HELV);
uiBlockSetButmFunc(block, do_view3d_edit_armaturemenu, NULL);
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Undo Editing|U", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 0, "");
@@ -4101,7 +4101,7 @@ static uiBlock *view3d_edit_armaturemenu(bContext *C, uiMenuBlockHandle *handle,
uiDefIconTextBlockBut(block, view3d_scripts_armaturemenu, NULL, ICON_RIGHTARROW_THIN, "Scripts", 0, yco-=20, 120, 19, "");
#endif
- if(handle->region->alignment==RGN_ALIGN_TOP) {
+ if(ar->alignment==RGN_ALIGN_TOP) {
uiBlockSetDirection(block, UI_DOWN);
}
else {
@@ -4143,12 +4143,12 @@ static void do_view3d_pose_armature_transformmenu(bContext *C, void *arg, int ev
#endif
}
-static uiBlock *view3d_pose_armature_transformmenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused)
+static uiBlock *view3d_pose_armature_transformmenu(bContext *C, ARegion *ar, void *arg_unused)
{
uiBlock *block;
short yco = 20, menuwidth = 120;
- block= uiBeginBlock(C, handle->region, "view3d_pose_armature_transformmenu", UI_EMBOSSP, UI_HELV);
+ block= uiBeginBlock(C, ar, "view3d_pose_armature_transformmenu", UI_EMBOSSP, UI_HELV);
uiBlockSetButmFunc(block, do_view3d_pose_armature_transformmenu, NULL);
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Clear User Transform|W", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 4, "");
@@ -4183,12 +4183,12 @@ static void do_view3d_pose_armature_showhidemenu(bContext *C, void *arg, int eve
#endif
}
-static uiBlock *view3d_pose_armature_showhidemenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused)
+static uiBlock *view3d_pose_armature_showhidemenu(bContext *C, ARegion *ar, void *arg_unused)
{
uiBlock *block;
short yco = 20, menuwidth = 120;
- block= uiBeginBlock(C, handle->region, "view3d_pose_armature_showhidemenu", UI_EMBOSSP, UI_HELV);
+ block= uiBeginBlock(C, ar, "view3d_pose_armature_showhidemenu", UI_EMBOSSP, UI_HELV);
uiBlockSetButmFunc(block, do_view3d_pose_armature_showhidemenu, NULL);
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Show Hidden|Alt H", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 0, "");
@@ -4217,12 +4217,12 @@ static void do_view3d_pose_armature_ikmenu(bContext *C, void *arg, int event)
#endif
}
-static uiBlock *view3d_pose_armature_ikmenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused)
+static uiBlock *view3d_pose_armature_ikmenu(bContext *C, ARegion *ar, void *arg_unused)
{
uiBlock *block;
short yco = 20, menuwidth = 120;
- block= uiBeginBlock(C, handle->region, "view3d_pose_armature_ikmenu", UI_EMBOSSP, UI_HELV);
+ block= uiBeginBlock(C, ar, "view3d_pose_armature_ikmenu", UI_EMBOSSP, UI_HELV);
uiBlockSetButmFunc(block, do_view3d_pose_armature_ikmenu, NULL);
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Add IK to Bone...|Shift I", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 1, "");
@@ -4250,12 +4250,12 @@ static void do_view3d_pose_armature_constraintsmenu(bContext *C, void *arg, int
#endif
}
-static uiBlock *view3d_pose_armature_constraintsmenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused)
+static uiBlock *view3d_pose_armature_constraintsmenu(bContext *C, ARegion *ar, void *arg_unused)
{
uiBlock *block;
short yco = 20, menuwidth = 120;
- block= uiBeginBlock(C, handle->region, "view3d_pose_armature_constraintsmenu", UI_EMBOSSP, UI_HELV);
+ block= uiBeginBlock(C, ar, "view3d_pose_armature_constraintsmenu", UI_EMBOSSP, UI_HELV);
uiBlockSetButmFunc(block, do_view3d_pose_armature_constraintsmenu, NULL);
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Add Constraint to Bone...|Ctrl Alt C", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 1, "");
@@ -4289,12 +4289,12 @@ static void do_view3d_pose_armature_groupmenu(bContext *C, void *arg, int event)
#endif
}
-static uiBlock *view3d_pose_armature_groupmenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused)
+static uiBlock *view3d_pose_armature_groupmenu(bContext *C, ARegion *ar, void *arg_unused)
{
uiBlock *block;
short yco = 20, menuwidth = 120;
- block= uiBeginBlock(C, handle->region, "view3d_pose_armature_groupmenu", UI_EMBOSSP, UI_HELV);
+ block= uiBeginBlock(C, ar, "view3d_pose_armature_groupmenu", UI_EMBOSSP, UI_HELV);
uiBlockSetButmFunc(block, do_view3d_pose_armature_groupmenu, NULL);
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Add Selected to Active Group|Ctrl G", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 1, "");
@@ -4325,12 +4325,12 @@ static void do_view3d_pose_armature_motionpathsmenu(bContext *C, void *arg, int
#endif
}
-static uiBlock *view3d_pose_armature_motionpathsmenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused)
+static uiBlock *view3d_pose_armature_motionpathsmenu(bContext *C, ARegion *ar, void *arg_unused)
{
uiBlock *block;
short yco = 20, menuwidth = 120;
- block= uiBeginBlock(C, handle->region, "view3d_pose_armature_motionpathsmenu", UI_EMBOSSP, UI_HELV);
+ block= uiBeginBlock(C, ar, "view3d_pose_armature_motionpathsmenu", UI_EMBOSSP, UI_HELV);
uiBlockSetButmFunc(block, do_view3d_pose_armature_motionpathsmenu, NULL);
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Calculate Paths|W", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 1, "");
@@ -4365,12 +4365,12 @@ static void do_view3d_pose_armature_poselibmenu(bContext *C, void *arg, int even
#endif
}
-static uiBlock *view3d_pose_armature_poselibmenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused)
+static uiBlock *view3d_pose_armature_poselibmenu(bContext *C, ARegion *ar, void *arg_unused)
{
uiBlock *block;
short yco = 20, menuwidth = 120;
- block= uiBeginBlock(C, handle->region, "view3d_pose_armature_poselibmenu", UI_EMBOSSP, UI_HELV);
+ block= uiBeginBlock(C, ar, "view3d_pose_armature_poselibmenu", UI_EMBOSSP, UI_HELV);
uiBlockSetButmFunc(block, do_view3d_pose_armature_poselibmenu, NULL);
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Browse Poses|Ctrl L", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 1, "");
@@ -4447,12 +4447,12 @@ static void do_view3d_pose_armaturemenu(bContext *C, void *arg, int event)
#endif
}
-static uiBlock *view3d_pose_armaturemenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused)
+static uiBlock *view3d_pose_armaturemenu(bContext *C, ARegion *ar, void *arg_unused)
{
uiBlock *block;
short yco= 0, menuwidth=120;
- block= uiBeginBlock(C, handle->region, "view3d_pose_armaturemenu", UI_EMBOSSP, UI_HELV);
+ block= uiBeginBlock(C, ar, "view3d_pose_armaturemenu", UI_EMBOSSP, UI_HELV);
uiBlockSetButmFunc(block, do_view3d_pose_armaturemenu, NULL);
uiDefIconTextBut(block, BUTM, 1, ICON_MENU_PANEL, "Transform Properties|N", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 0, "");
@@ -4506,7 +4506,7 @@ static uiBlock *view3d_pose_armaturemenu(bContext *C, uiMenuBlockHandle *handle,
uiDefIconTextBlockBut(block, view3d_armature_settingsmenu,
NULL, ICON_RIGHTARROW_THIN, "Bone Settings", 0, yco-=20, 120, 19, "");
- if(handle->region->alignment==RGN_ALIGN_TOP) {
+ if(ar->alignment==RGN_ALIGN_TOP) {
uiBlockSetDirection(block, UI_DOWN);
}
else {
@@ -4545,7 +4545,7 @@ static void do_view3d_vpaintmenu(bContext *C, void *arg, int event)
#endif
}
-static uiBlock *view3d_vpaintmenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused)
+static uiBlock *view3d_vpaintmenu(bContext *C, ARegion *ar, void *arg_unused)
{
uiBlock *block;
short yco= 0, menuwidth=120;
@@ -4554,7 +4554,7 @@ static uiBlock *view3d_vpaintmenu(bContext *C, uiMenuBlockHandle *handle, void *
// int i=0;
#endif
- block= uiBeginBlock(C, handle->region, "view3d_paintmenu", UI_EMBOSSP, UI_HELV);
+ block= uiBeginBlock(C, ar, "view3d_paintmenu", UI_EMBOSSP, UI_HELV);
uiBlockSetButmFunc(block, do_view3d_vpaintmenu, NULL);
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Undo Vertex Painting|U", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 0, "");
@@ -4571,7 +4571,7 @@ static uiBlock *view3d_vpaintmenu(bContext *C, uiMenuBlockHandle *handle, void *
// }
#endif
- if(handle->region->alignment==RGN_ALIGN_TOP) {
+ if(ar->alignment==RGN_ALIGN_TOP) {
uiBlockSetDirection(block, UI_DOWN);
}
else {
@@ -4598,18 +4598,18 @@ static void do_view3d_tpaintmenu(bContext *C, void *arg, int event)
#endif
}
-static uiBlock *view3d_tpaintmenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused)
+static uiBlock *view3d_tpaintmenu(bContext *C, ARegion *ar, void *arg_unused)
{
uiBlock *block;
short yco= 0, menuwidth=120;
- block= uiBeginBlock(C, handle->region, "view3d_paintmenu", UI_EMBOSSP, UI_HELV);
+ block= uiBeginBlock(C, ar, "view3d_paintmenu", UI_EMBOSSP, UI_HELV);
uiBlockSetButmFunc(block, do_view3d_tpaintmenu, NULL);
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Undo Texture Painting|U", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 0, "");
uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
- if(handle->region->alignment==RGN_ALIGN_TOP) {
+ if(ar->alignment==RGN_ALIGN_TOP) {
uiBlockSetDirection(block, UI_DOWN);
}
else {
@@ -4649,7 +4649,7 @@ static void do_view3d_wpaintmenu(bContext *C, void *arg, int event)
#endif
}
-static uiBlock *view3d_wpaintmenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused)
+static uiBlock *view3d_wpaintmenu(bContext *C, ARegion *ar, void *arg_unused)
{
uiBlock *block;
short yco= 0, menuwidth=120, menunr=1;
@@ -4658,7 +4658,7 @@ static uiBlock *view3d_wpaintmenu(bContext *C, uiMenuBlockHandle *handle, void *
// int i=0;
#endif
- block= uiBeginBlock(C, handle->region, "view3d_paintmenu", UI_EMBOSSP, UI_HELV);
+ block= uiBeginBlock(C, ar, "view3d_paintmenu", UI_EMBOSSP, UI_HELV);
uiBlockSetButmFunc(block, do_view3d_wpaintmenu, NULL);
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Undo Weight Painting|U", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 0, "");
@@ -4686,7 +4686,7 @@ static uiBlock *view3d_wpaintmenu(bContext *C, uiMenuBlockHandle *handle, void *
// }
#endif
- if(handle->region->alignment==RGN_ALIGN_TOP) {
+ if(ar->alignment==RGN_ALIGN_TOP) {
uiBlockSetDirection(block, UI_DOWN);
}
else {
@@ -4800,13 +4800,13 @@ void do_view3d_sculptmenu(bContext *C, void *arg, int event)
#endif
}
-uiBlock *view3d_sculpt_inputmenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused)
+uiBlock *view3d_sculpt_inputmenu(bContext *C, ARegion *ar, void *arg_unused)
{
uiBlock *block;
short yco= 0, menuwidth= 120;
Sculpt *sd= CTX_data_tool_settings(C)->sculpt;
- block= uiBeginBlock(C, handle->region, "view3d_sculpt_inputmenu", UI_EMBOSSP, UI_HELV);
+ block= uiBeginBlock(C, ar, "view3d_sculpt_inputmenu", UI_EMBOSSP, UI_HELV);
uiBlockSetButmFunc(block, do_view3d_sculpt_inputmenu, NULL);
uiDefIconTextBut(block, BUTM, 1, ((sd->flags & SCULPT_INPUT_SMOOTH) ? ICON_CHECKBOX_HLT : ICON_CHECKBOX_DEHLT), "Smooth Stroke|Shift S", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 0, "");
@@ -4818,7 +4818,7 @@ uiBlock *view3d_sculpt_inputmenu(bContext *C, uiMenuBlockHandle *handle, void *a
return block;
}
-uiBlock *view3d_sculptmenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused)
+uiBlock *view3d_sculptmenu(bContext *C, ARegion *ar, void *arg_unused)
{
ScrArea *sa= CTX_wm_area(C);
View3D *v3d= sa->spacedata.first;
@@ -4827,7 +4827,7 @@ uiBlock *view3d_sculptmenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unu
// XXX const BrushData *br= sculptmode_brush();
short yco= 0, menuwidth= 120;
- block= uiBeginBlock(C, handle->region, "view3d_sculptmenu", UI_EMBOSSP, UI_HELV);
+ block= uiBeginBlock(C, ar, "view3d_sculptmenu", UI_EMBOSSP, UI_HELV);
uiBlockSetButmFunc(block, do_view3d_sculptmenu, NULL);
uiDefIconTextBut(block, BUTM, 1, ICON_MENU_PANEL, "Sculpt Properties|N", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 14, "");
@@ -4868,7 +4868,7 @@ uiBlock *view3d_sculptmenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unu
uiDefIconTextBut(block, BUTM, 1, (sd->brush_type==DRAW_BRUSH ? ICON_CHECKBOX_HLT : ICON_CHECKBOX_DEHLT), "Draw|D", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 0, "");*/
- if(handle->region->alignment==RGN_ALIGN_TOP) {
+ if(ar->alignment==RGN_ALIGN_TOP) {
uiBlockSetDirection(block, UI_DOWN);
}
else {
@@ -4901,12 +4901,12 @@ static void do_view3d_facesel_showhidemenu(bContext *C, void *arg, int event)
#endif
}
-static uiBlock *view3d_facesel_showhidemenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused)
+static uiBlock *view3d_facesel_showhidemenu(bContext *C, ARegion *ar, void *arg_unused)
{
uiBlock *block;
short yco = 20, menuwidth = 120;
- block= uiBeginBlock(C, handle->region, "view3d_facesel_showhidemenu", UI_EMBOSSP, UI_HELV);
+ block= uiBeginBlock(C, ar, "view3d_facesel_showhidemenu", UI_EMBOSSP, UI_HELV);
uiBlockSetButmFunc(block, do_view3d_facesel_showhidemenu, NULL);
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Show Hidden Faces|Alt H", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 4, "");
@@ -4937,12 +4937,12 @@ static void do_view3d_faceselmenu(bContext *C, void *arg, int event)
#endif
}
-static uiBlock *view3d_faceselmenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused)
+static uiBlock *view3d_faceselmenu(bContext *C, ARegion *ar, void *arg_unused)
{
uiBlock *block;
short yco= 0, menuwidth=120;
- block= uiBeginBlock(C, handle->region, "view3d_faceselmenu", UI_EMBOSSP, UI_HELV);
+ block= uiBeginBlock(C, ar, "view3d_faceselmenu", UI_EMBOSSP, UI_HELV);
uiBlockSetButmFunc(block, do_view3d_faceselmenu, NULL);
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Set Vertex Colors|Shift K", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 0, "");
@@ -4956,7 +4956,7 @@ static uiBlock *view3d_faceselmenu(bContext *C, uiMenuBlockHandle *handle, void
uiDefIconTextBlockBut(block, view3d_facesel_showhidemenu, NULL, ICON_RIGHTARROW_THIN, "Show/Hide Faces", 0, yco-=20, 120, 19, "");
- if(handle->region->alignment==RGN_ALIGN_TOP) {
+ if(ar->alignment==RGN_ALIGN_TOP) {
uiBlockSetDirection(block, UI_DOWN);
}
else {
@@ -5000,12 +5000,12 @@ void do_view3d_select_particlemenu(bContext *C, void *arg, int event)
}
}
-static uiBlock *view3d_select_particlemenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused)
+static uiBlock *view3d_select_particlemenu(bContext *C, ARegion *ar, void *arg_unused)
{
uiBlock *block;
short yco= 0, menuwidth=120;
- block= uiBeginBlock(C, handle->region, "view3d_select_particlemenu", UI_EMBOSSP, UI_HELV);
+ block= uiBeginBlock(C, ar, "view3d_select_particlemenu", UI_EMBOSSP, UI_HELV);
uiBlockSetButmFunc(block, do_view3d_select_particlemenu, NULL);
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Border Select|B",
@@ -5032,7 +5032,7 @@ static uiBlock *view3d_select_particlemenu(bContext *C, uiMenuBlockHandle *handl
0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 5, "");
- if(handle->region->alignment==RGN_ALIGN_TOP) {
+ if(ar->alignment==RGN_ALIGN_TOP) {
uiBlockSetDirection(block, UI_DOWN);
}
else {
@@ -5060,12 +5060,12 @@ void do_view3d_particle_showhidemenu(bContext *C, void *arg, int event)
}
}
-static uiBlock *view3d_particle_showhidemenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused)
+static uiBlock *view3d_particle_showhidemenu(bContext *C, ARegion *ar, void *arg_unused)
{
uiBlock *block;
short yco = 20, menuwidth = 120;
- block= uiBeginBlock(C, handle->region, "view3d_particle_showhidemenu", UI_EMBOSSP, UI_HELV);
+ block= uiBeginBlock(C, ar, "view3d_particle_showhidemenu", UI_EMBOSSP, UI_HELV);
uiBlockSetButmFunc(block, do_view3d_particle_showhidemenu, NULL);
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Show Hidden|Alt H",
@@ -5117,14 +5117,14 @@ void do_view3d_particlemenu(bContext *C, void *arg, int event)
#endif
}
-uiBlock *view3d_particlemenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused)
+uiBlock *view3d_particlemenu(bContext *C, ARegion *ar, void *arg_unused)
{
Scene *scene= CTX_data_scene(C);
uiBlock *block;
ParticleEditSettings *pset= PE_settings(scene);
short yco= 0, menuwidth= 120;
-
- block= uiBeginBlock(C, handle->region, "view3d_particlemenu", UI_EMBOSSP, UI_HELV);
+
+ block= uiBeginBlock(C, ar, "view3d_particlemenu", UI_EMBOSSP, UI_HELV);
uiBlockSetButmFunc(block, do_view3d_particlemenu, NULL);
uiDefIconTextBut(block, BUTM, 1, ICON_MENU_PANEL, "Particle Edit Properties|N", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 1, "");
@@ -5144,7 +5144,7 @@ uiBlock *view3d_particlemenu(bContext *C, uiMenuBlockHandle *handle, void *arg_u
uiDefIconTextBlockBut(block, view3d_particle_showhidemenu, NULL, ICON_RIGHTARROW_THIN, "Show/Hide Particles", 0, yco-=20, menuwidth, 19, "");
- if(handle->region->alignment==RGN_ALIGN_TOP) {
+ if(ar->alignment==RGN_ALIGN_TOP) {
uiBlockSetDirection(block, UI_DOWN);
}
else {
diff --git a/source/blender/editors/transform/transform_ops.c b/source/blender/editors/transform/transform_ops.c
index 03f634145f5..3bad5379484 100644
--- a/source/blender/editors/transform/transform_ops.c
+++ b/source/blender/editors/transform/transform_ops.c
@@ -66,7 +66,7 @@ static int select_orientation_invoke(bContext *C, wmOperator *op, wmEvent *event
op->customdata = string;
- uiPupmenuOperator(C, 0, op, "orientation", string);
+ uiPupMenuOperator(C, 0, op, "orientation", string);
return OPERATOR_RUNNING_MODAL;
}
diff --git a/source/blender/editors/util/editmode_undo.c b/source/blender/editors/util/editmode_undo.c
index 84ecf8e2d38..b593c99e5f4 100644
--- a/source/blender/editors/util/editmode_undo.c
+++ b/source/blender/editors/util/editmode_undo.c
@@ -334,7 +334,7 @@ static void do_editmode_undohistorymenu(bContext *C, void *arg, int event)
}
-uiBlock *editmode_undohistorymenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused)
+uiBlock *editmode_undohistorymenu(bContext *C, ARegion *ar, void *arg_unused)
{
uiBlock *block;
UndoElem *uel;
@@ -343,7 +343,7 @@ uiBlock *editmode_undohistorymenu(bContext *C, uiMenuBlockHandle *handle, void *
undo_clean_stack(C); // removes other objects from it
- block= uiBeginBlock(C, handle->region, "view3d_edit_mesh_undohistorymenu", UI_EMBOSSP, UI_HELV);
+ block= uiBeginBlock(C, ar, "view3d_edit_mesh_undohistorymenu", UI_EMBOSSP, UI_HELV);
uiBlockSetButmFunc(block, do_editmode_undohistorymenu, NULL);
for(uel= undobase.first; uel; uel= uel->next, item++) {
diff --git a/source/blender/render/intern/source/occlusion.c b/source/blender/render/intern/source/occlusion.c
index 174a9db4398..c75de189b10 100644
--- a/source/blender/render/intern/source/occlusion.c
+++ b/source/blender/render/intern/source/occlusion.c
@@ -514,10 +514,6 @@ static void occ_build_recursive(OcclusionTree *tree, OccNode *node, int begin, i
OccFace *face;
int a, b, totthread=0, offset[TOTCHILD], count[TOTCHILD];
- /* keep track of maximum depth for stack */
- if(depth > tree->maxdepth)
- tree->maxdepth= depth;
-
/* add a new node */
node->occlusion= 1.0f;
@@ -552,6 +548,10 @@ static void occ_build_recursive(OcclusionTree *tree, OccNode *node, int begin, i
child= BLI_memarena_alloc(tree->arena, sizeof(OccNode));
node->child[b].node= child;
+ /* keep track of maximum depth for stack */
+ if(depth+1 > tree->maxdepth)
+ tree->maxdepth= depth+1;
+
if(tree->dothreadedbuild)
BLI_unlock_thread(LOCK_CUSTOM1);
@@ -679,6 +679,7 @@ static OcclusionTree *occ_tree_build(Render *re)
/* recurse */
tree->root= BLI_memarena_alloc(tree->arena, sizeof(OccNode));
+ tree->maxdepth= 1;
occ_build_recursive(tree, tree->root, 0, totface, 1);
#if 0
diff --git a/source/blender/windowmanager/intern/wm_event_system.c b/source/blender/windowmanager/intern/wm_event_system.c
index 8e3c87c654d..81efe5f8860 100644
--- a/source/blender/windowmanager/intern/wm_event_system.c
+++ b/source/blender/windowmanager/intern/wm_event_system.c
@@ -220,7 +220,7 @@ int WM_operator_call(bContext *C, wmOperator *op)
if(!(retval & OPERATOR_RUNNING_MODAL))
if(op->reports->list.first)
- uiPupmenuReports(C, op->reports);
+ uiPupMenuReports(C, op->reports);
if((retval & OPERATOR_FINISHED) && (op->type->flag & OPTYPE_REGISTER)) {
wm_operator_register(CTX_wm_manager(C), op);
@@ -283,7 +283,7 @@ static int wm_operator_invoke(bContext *C, wmOperatorType *ot, wmEvent *event, P
if(!(retval & OPERATOR_RUNNING_MODAL)) {
if(op->reports->list.first) /* only show the report if the report list was not given in the function */
- uiPupmenuReports(C, op->reports);
+ uiPupMenuReports(C, op->reports);
if (retval & OPERATOR_FINISHED) /* todo - this may conflict with the other WM_operator_print, if theres ever 2 prints for 1 action will may need to add modal check here */
if(G.f & G_DEBUG)
@@ -558,7 +558,7 @@ static int wm_handler_operator_call(bContext *C, ListBase *handlers, wmEventHand
if(!(retval & OPERATOR_RUNNING_MODAL))
if(op->reports->list.first)
- uiPupmenuReports(C, op->reports);
+ uiPupMenuReports(C, op->reports);
if (retval & OPERATOR_FINISHED) {
if(G.f & G_DEBUG)
diff --git a/source/blender/windowmanager/intern/wm_operators.c b/source/blender/windowmanager/intern/wm_operators.c
index 3bcebdf258a..827c7572788 100644
--- a/source/blender/windowmanager/intern/wm_operators.c
+++ b/source/blender/windowmanager/intern/wm_operators.c
@@ -217,7 +217,7 @@ int WM_menu_invoke(bContext *C, wmOperator *op, wmEvent *event)
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);
+ uiPupMenuOperator(C, totitem/30, op, "type", menu);
MEM_freeN(menu);
return OPERATOR_RUNNING_MODAL;
@@ -231,7 +231,7 @@ 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);
+ uiPupMenuOperator(C, 0, op, NULL, buf);
return OPERATOR_RUNNING_MODAL;
}
@@ -337,7 +337,7 @@ static int wm_recentfile_invoke(bContext *C, wmOperator *op, wmEvent *event)
char pup[2048];
recent_filelist(pup);
- uiPupmenuOperator(C, 0, op, "nr", pup);
+ uiPupMenuOperator(C, 0, op, "nr", pup);
return OPERATOR_RUNNING_MODAL;
}