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

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrecht Van Lommel <brechtvanlommel@pandora.be>2009-02-17 22:55:20 +0300
committerBrecht Van Lommel <brechtvanlommel@pandora.be>2009-02-17 22:55:20 +0300
commit38410b63a60a70faf0b82b6b2ec4172013dd2af1 (patch)
tree6be6707d1b0e5a7bebe81afbc57c807bf818f935 /source/blender/editors/interface/interface_regions.c
parent8c8792bb127b0b1c33d35e78574e30fa29bd6279 (diff)
2.5: Text edit mode operators back. Took me a while getting
them nicely repeatable, and splitting up the big edit_text operator into individual operator so it's all nicely scriptable, documented, configurable, etc.. * Insert Text, Line Break, Insert Lorem * Toggle Case, Set Case, Toggle Style, Set Style, Set Material * Copy Text, Cut Text, Paste Text, Paste File, Paste Buffer * Move, Move Select, Delete * Change Spacing, Change Character Notes * Text (datablock) to Object doesn't work yet, will need to implement text editor context for that. * Some shortcut keys don't work because screen/wm overrides them, ctrl+x, ctrl+left/right. That override goes top down which works well for some cases, but here we need to override in the other direction. * There's no unicode support in RNA, or the user interface code for that matter, but text strings can contain these characters. At the moment it stores a UTF-8 string in char arrays, which is supposed to be nicely compatible with ascii. Seems reasonable to add support for UTF-8 in the interface code, python bindings, .. eventually?
Diffstat (limited to 'source/blender/editors/interface/interface_regions.c')
-rw-r--r--source/blender/editors/interface/interface_regions.c41
1 files changed, 30 insertions, 11 deletions
diff --git a/source/blender/editors/interface/interface_regions.c b/source/blender/editors/interface/interface_regions.c
index 5bca01ef16d..5365c3e09f0 100644
--- a/source/blender/editors/interface/interface_regions.c
+++ b/source/blender/editors/interface/interface_regions.c
@@ -1661,17 +1661,18 @@ static uiBlock *ui_block_func_MENU_ITEM(bContext *C, uiPopupBlockHandle *handle,
/* 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_INT 5
-#define MENU_ITEM_OPNAME_FLOAT 6
-#define MENU_ITEM_RNA_BOOL 7
-#define MENU_ITEM_RNA_ENUM 8
-#define MENU_ITEM_LEVEL 9
-#define MENU_ITEM_LEVEL_OPNAME_ENUM 10
-#define MENU_ITEM_LEVEL_RNA_ENUM 11
-#define MENU_ITEM_SEPARATOR 12
+#define MENU_ITEM_SEPARATOR 2
+#define MENU_ITEM_OPNAME 10
+#define MENU_ITEM_OPNAME_BOOL 11
+#define MENU_ITEM_OPNAME_ENUM 12
+#define MENU_ITEM_OPNAME_INT 13
+#define MENU_ITEM_OPNAME_FLOAT 14
+#define MENU_ITEM_OPNAME_STRING 15
+#define MENU_ITEM_RNA_BOOL 20
+#define MENU_ITEM_RNA_ENUM 21
+#define MENU_ITEM_LEVEL 30
+#define MENU_ITEM_LEVEL_OPNAME_ENUM 31
+#define MENU_ITEM_LEVEL_RNA_ENUM 32
struct uiMenuItem {
struct uiMenuItem *next, *prev;
@@ -1685,6 +1686,7 @@ struct uiMenuItem {
int retval, enumval, boolval, intval;
float fltval;
+ char *strval;
int opcontext;
uiMenuHandleFunc eventfunc;
void *argv;
@@ -1878,6 +1880,12 @@ static uiBlock *ui_block_func_MENU_ITEM(bContext *C, uiPopupBlockHandle *handle,
y1 -= MENU_BUTTON_HEIGHT;
}
+ else if(item->type==MENU_ITEM_OPNAME_STRING) {
+ but= uiDefIconTextButO(block, BUTM, item->opname, item->opcontext, item->icon, item->name, x1, y1, width+16, MENU_BUTTON_HEIGHT-1, "");
+ RNA_string_set(uiButGetOperatorPtrRNA(but), item->propname, item->strval);
+
+ y1 -= MENU_BUTTON_HEIGHT;
+ }
else if(item->type==MENU_ITEM_OPNAME) {
uiDefIconTextButO(block, BUTM, item->opname, item->opcontext, item->icon, NULL, x1, y1, width+16, MENU_BUTTON_HEIGHT-1, NULL);
y1 -= MENU_BUTTON_HEIGHT;
@@ -2074,6 +2082,17 @@ void uiMenuItemBooleanO(uiMenuItem *head, const char *name, int icon, char *opna
item->type = MENU_ITEM_OPNAME_BOOL;
}
+/* single operator item with property */
+void uiMenuItemStringO(uiMenuItem *head, const char *name, int icon, char *opname, char *propname, char *value)
+{
+ uiMenuItem *item= ui_menu_add_item(head, name, icon, 0);
+
+ item->opname= opname; // static!
+ item->propname= propname; // static!
+ item->strval= value;
+ item->type = MENU_ITEM_OPNAME_STRING;
+}
+
/* add all operator items with property */
void uiMenuItemsEnumO(uiMenuItem *head, char *opname, char *propname)
{