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-09-10 18:20:21 +0400
committerBrecht Van Lommel <brechtvanlommel@pandora.be>2009-09-10 18:20:21 +0400
commitcfb6f35f9fd2905b7d51b78258f98ab45d2c5ced (patch)
tree9c954266778cb7344dde5e01b77df335537f3dba /source/blender/editors
parent15d77f17a40398a63f95e16607deb81257c02698 (diff)
UI:
* layout.itemR now has icon_only option to show only icon in e.g. enums buttons, for uv editor header. * Automatic key shortcuts in menus now show the shortcut even if operator properties don't match. Not sure this will work well everywhere, but seems to be working ok for now. * Open recent now show shorter filenames instead of the whole file path. * Tweak object Duplicate menu item.
Diffstat (limited to 'source/blender/editors')
-rw-r--r--source/blender/editors/include/UI_interface.h1
-rw-r--r--source/blender/editors/interface/interface_layout.c31
-rw-r--r--source/blender/editors/interface/interface_utils.c7
-rw-r--r--source/blender/editors/object/object_add.c2
-rw-r--r--source/blender/editors/object/object_ops.c2
5 files changed, 25 insertions, 18 deletions
diff --git a/source/blender/editors/include/UI_interface.h b/source/blender/editors/include/UI_interface.h
index e2338078a8a..b45ab2d4997 100644
--- a/source/blender/editors/include/UI_interface.h
+++ b/source/blender/editors/include/UI_interface.h
@@ -589,6 +589,7 @@ void UI_exit(void);
#define UI_ITEM_R_EXPAND 2
#define UI_ITEM_R_SLIDER 4
#define UI_ITEM_R_TOGGLE 8
+#define UI_ITEM_R_ICON_ONLY 16
uiLayout *uiBlockLayout(uiBlock *block, int dir, int type, int x, int y, int size, int em, struct uiStyle *style);
void uiBlockSetCurLayout(uiBlock *block, uiLayout *layout);
diff --git a/source/blender/editors/interface/interface_layout.c b/source/blender/editors/interface/interface_layout.c
index 04d575d96d4..bf449dba597 100644
--- a/source/blender/editors/interface/interface_layout.c
+++ b/source/blender/editors/interface/interface_layout.c
@@ -443,7 +443,7 @@ static void ui_item_array(uiLayout *layout, uiBlock *block, char *name, int icon
uiBlockSetCurLayout(block, layout);
}
-static void ui_item_enum_row(uiLayout *layout, uiBlock *block, PointerRNA *ptr, PropertyRNA *prop, char *uiname, int x, int y, int w, int h)
+static void ui_item_enum_row(uiLayout *layout, uiBlock *block, PointerRNA *ptr, PropertyRNA *prop, char *uiname, int x, int y, int w, int h, int icon_only)
{
EnumPropertyItem *item;
const char *identifier;
@@ -463,7 +463,7 @@ static void ui_item_enum_row(uiLayout *layout, uiBlock *block, PointerRNA *ptr,
value= item[a].value;
itemw= ui_text_icon_width(block->curlayout, name, icon, 0);
- if(icon && strcmp(name, "") != 0)
+ if(icon && strcmp(name, "") != 0 && !icon_only)
uiDefIconTextButR(block, ROW, 0, icon, name, 0, 0, itemw, h, ptr, identifier, -1, 0, value, -1, -1, NULL);
else if(icon)
uiDefIconButR(block, ROW, 0, icon, 0, 0, itemw, h, ptr, identifier, -1, 0, value, -1, -1, NULL);
@@ -477,7 +477,7 @@ static void ui_item_enum_row(uiLayout *layout, uiBlock *block, PointerRNA *ptr,
}
/* create label + button for RNA property */
-static uiBut *ui_item_with_label(uiLayout *layout, uiBlock *block, char *name, int icon, PointerRNA *ptr, PropertyRNA *prop, int index, int x, int y, int w, int h)
+static uiBut *ui_item_with_label(uiLayout *layout, uiBlock *block, char *name, int icon, PointerRNA *ptr, PropertyRNA *prop, int index, int x, int y, int w, int h, int icon_only)
{
uiLayout *sub;
uiBut *but;
@@ -506,7 +506,7 @@ static uiBut *ui_item_with_label(uiLayout *layout, uiBlock *block, char *name, i
but= uiDefIconButO(block, BUT, "BUTTONS_OT_file_browse", WM_OP_INVOKE_DEFAULT, ICON_FILESEL, x, y, UI_UNIT_X, h, "Browse for file or directory.");
}
else
- but= uiDefAutoButR(block, ptr, prop, index, "", icon, x, y, w, h);
+ but= uiDefAutoButR(block, ptr, prop, index, (icon_only)? "": NULL, icon, x, y, w, h);
uiBlockSetCurLayout(block, layout);
return but;
@@ -788,7 +788,7 @@ void uiItemO(uiLayout *layout, char *name, int icon, char *opname)
/* RNA property items */
-static void ui_item_rna_size(uiLayout *layout, char *name, int icon, PointerRNA *ptr, PropertyRNA *prop, int index, int *r_w, int *r_h)
+static void ui_item_rna_size(uiLayout *layout, char *name, int icon, PointerRNA *ptr, PropertyRNA *prop, int index, int icon_only, int *r_w, int *r_h)
{
PropertyType type;
PropertySubType subtype;
@@ -799,9 +799,9 @@ static void ui_item_rna_size(uiLayout *layout, char *name, int icon, PointerRNA
subtype= RNA_property_subtype(prop);
len= RNA_property_array_length(ptr, prop);
- if(ELEM3(type, PROP_STRING, PROP_POINTER, PROP_ENUM) && !name[0])
+ if(ELEM3(type, PROP_STRING, PROP_POINTER, PROP_ENUM) && !name[0] && !icon_only)
name= "non-empty text";
- else if(type == PROP_BOOLEAN && !name[0])
+ else if(type == PROP_BOOLEAN && !name[0] && !icon_only)
icon= ICON_DOT;
w= ui_text_icon_width(layout, name, icon, 0);
@@ -823,7 +823,7 @@ static void ui_item_rna_size(uiLayout *layout, char *name, int icon, PointerRNA
if(type == PROP_BOOLEAN && strcmp(name, "") != 0)
w += UI_UNIT_X/5;
else if(type == PROP_ENUM)
- w += UI_UNIT_X/2;
+ w += UI_UNIT_X/4;
else if(type == PROP_FLOAT || type == PROP_INT)
w += UI_UNIT_X*3;
}
@@ -838,7 +838,7 @@ void uiItemFullR(uiLayout *layout, char *name, int icon, PointerRNA *ptr, Proper
uiBut *but;
PropertyType type;
char namestr[UI_MAX_NAME_STR];
- int len, w, h, slider, toggle, expand;
+ int len, w, h, slider, toggle, expand, icon_only;
if(!ptr->data || !prop)
return;
@@ -872,9 +872,10 @@ void uiItemFullR(uiLayout *layout, char *name, int icon, PointerRNA *ptr, Proper
slider= (flag & UI_ITEM_R_SLIDER);
toggle= (flag & UI_ITEM_R_TOGGLE);
expand= (flag & UI_ITEM_R_EXPAND);
+ icon_only= (flag & UI_ITEM_R_ICON_ONLY);
/* get size */
- ui_item_rna_size(layout, name, icon, ptr, prop, index, &w, &h);
+ ui_item_rna_size(layout, name, icon, ptr, prop, index, icon_only, &w, &h);
/* array property */
if(index == RNA_NO_INDEX && len > 0)
@@ -883,7 +884,7 @@ void uiItemFullR(uiLayout *layout, char *name, int icon, PointerRNA *ptr, Proper
else if(type == PROP_ENUM && index == RNA_ENUM_VALUE) {
char *identifier= (char*)RNA_property_identifier(prop);
- if(icon && strcmp(name, "") != 0)
+ if(icon && strcmp(name, "") != 0 && !icon_only)
uiDefIconTextButR(block, ROW, 0, icon, name, 0, 0, w, h, ptr, identifier, -1, 0, value, -1, -1, NULL);
else if(icon)
uiDefIconButR(block, ROW, 0, icon, 0, 0, w, h, ptr, identifier, -1, 0, value, -1, -1, NULL);
@@ -892,10 +893,10 @@ void uiItemFullR(uiLayout *layout, char *name, int icon, PointerRNA *ptr, Proper
}
/* expanded enum */
else if(type == PROP_ENUM && expand)
- ui_item_enum_row(layout, block, ptr, prop, name, 0, 0, w, h);
+ ui_item_enum_row(layout, block, ptr, prop, name, 0, 0, w, h, icon_only);
/* property with separate label */
else if(type == PROP_ENUM || type == PROP_STRING || type == PROP_POINTER) {
- but= ui_item_with_label(layout, block, name, icon, ptr, prop, index, 0, 0, w, h);
+ but= ui_item_with_label(layout, block, name, icon, ptr, prop, index, 0, 0, w, h, icon_only);
ui_but_add_search(but, ptr, prop, NULL, NULL);
}
/* single button */
@@ -1160,8 +1161,8 @@ void uiItemPointerR(uiLayout *layout, char *name, int icon, struct PointerRNA *p
/* create button */
block= uiLayoutGetBlock(layout);
- ui_item_rna_size(layout, name, icon, ptr, prop, 0, &w, &h);
- but= ui_item_with_label(layout, block, name, icon, ptr, prop, 0, 0, 0, w, h);
+ ui_item_rna_size(layout, name, icon, ptr, prop, 0, 0, &w, &h);
+ but= ui_item_with_label(layout, block, name, icon, ptr, prop, 0, 0, 0, w, h, 0);
ui_but_add_search(but, ptr, prop, searchptr, searchprop);
}
diff --git a/source/blender/editors/interface/interface_utils.c b/source/blender/editors/interface/interface_utils.c
index 5b44f6544d1..63f81c9e46c 100644
--- a/source/blender/editors/interface/interface_utils.c
+++ b/source/blender/editors/interface/interface_utils.c
@@ -108,7 +108,12 @@ uiBut *uiDefAutoButR(uiBlock *block, PointerRNA *ptr, PropertyRNA *prop, int ind
but= uiDefButR(block, NUM, 0, name, x1, y1, x2, y2, ptr, propname, index, 0, 0, -1, -1, NULL);
break;
case PROP_ENUM:
- but= uiDefButR(block, MENU, 0, NULL, x1, y1, x2, y2, ptr, propname, index, 0, 0, -1, -1, NULL);
+ if(icon && name && strcmp(name, "") == 0)
+ but= uiDefIconButR(block, MENU, 0, icon, x1, y1, x2, y2, ptr, propname, index, 0, 0, -1, -1, NULL);
+ else if(icon)
+ but= uiDefIconTextButR(block, MENU, 0, icon, NULL, x1, y1, x2, y2, ptr, propname, index, 0, 0, -1, -1, NULL);
+ else
+ but= uiDefButR(block, MENU, 0, NULL, x1, y1, x2, y2, ptr, propname, index, 0, 0, -1, -1, NULL);
break;
case PROP_STRING:
if(icon && name && strcmp(name, "") == 0)
diff --git a/source/blender/editors/object/object_add.c b/source/blender/editors/object/object_add.c
index eaf7d41b9fe..f4c8c63c480 100644
--- a/source/blender/editors/object/object_add.c
+++ b/source/blender/editors/object/object_add.c
@@ -1122,7 +1122,7 @@ void OBJECT_OT_convert(wmOperatorType *ot)
RNA_def_boolean(ot->srna, "keep_original", 0, "Keep Original", "Keep original objects instead of replacing them.");
}
-/************************** Add Duplicate **********************/
+/**************************** Duplicate ************************/
/*
dupflag: a flag made from constants declared in DNA_userdef_types.h
diff --git a/source/blender/editors/object/object_ops.c b/source/blender/editors/object/object_ops.c
index bb8c5dc292e..ddcecdeb1f1 100644
--- a/source/blender/editors/object/object_ops.c
+++ b/source/blender/editors/object/object_ops.c
@@ -176,7 +176,7 @@ void ED_operatortypes_object(void)
WM_operatortype_append(LATTICE_OT_make_regular);
/* macros */
- ot= WM_operatortype_append_macro("OBJECT_OT_duplicate_move", "Add Duplicate", OPTYPE_UNDO|OPTYPE_REGISTER);
+ ot= WM_operatortype_append_macro("OBJECT_OT_duplicate_move", "Duplicate", OPTYPE_UNDO|OPTYPE_REGISTER);
if(ot) {
WM_operatortype_macro_define(ot, "OBJECT_OT_duplicate");
WM_operatortype_macro_define(ot, "TFM_OT_translate");