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
path: root/source
diff options
context:
space:
mode:
authorBrecht Van Lommel <brechtvanlommel@pandora.be>2009-03-13 16:38:41 +0300
committerBrecht Van Lommel <brechtvanlommel@pandora.be>2009-03-13 16:38:41 +0300
commit4c3d64116e2c74315afea7b005ffaf320178337f (patch)
tree86d6db3a35fd5847387c2970ba0d160d9f92b0a7 /source
parenta4793a3b4ac298a651f7bab0bafd809287647509 (diff)
2.5: UI Layout Engine, initial code.
* As a test, used by: * Object buttons, tried to make it match the mockup. * Text window header. * Text window properties panel. * Panel interaction with view2d is still problematic, need to make this work properly still. * Templates are very basic, the ones there are simple but already can follow the object buttons mockup quite closely. * It's based on a three level system: panels, templates and items. To get an idea of what that means in practice, see: http://wiki.blender.org/index.php/BlenderDev/Blender2.5/UI_LayoutEngine#Panels.2C_Templates_and_Items
Diffstat (limited to 'source')
-rw-r--r--source/blender/blenloader/intern/readfile.c7
-rw-r--r--source/blender/editors/include/UI_interface.h100
-rw-r--r--source/blender/editors/include/UI_view2d.h2
-rw-r--r--source/blender/editors/interface/interface_draw.c4
-rw-r--r--source/blender/editors/interface/interface_handlers.c3
-rw-r--r--source/blender/editors/interface/interface_layout.c943
-rw-r--r--source/blender/editors/interface/interface_panel.c3
-rw-r--r--source/blender/editors/interface/interface_utils.c57
-rw-r--r--source/blender/editors/interface/view2d.c21
-rw-r--r--source/blender/editors/space_buttons/buttons_header.c34
-rw-r--r--source/blender/editors/space_buttons/buttons_intern.h1
-rw-r--r--source/blender/editors/space_buttons/buttons_object.c179
-rw-r--r--source/blender/editors/space_buttons/space_buttons.c12
-rw-r--r--source/blender/editors/space_image/image_draw.c2
-rw-r--r--source/blender/editors/space_outliner/outliner.c4
-rw-r--r--source/blender/editors/space_text/space_text.c32
-rw-r--r--source/blender/editors/space_text/text_header.c211
-rw-r--r--source/blender/editors/space_text/text_intern.h4
-rw-r--r--source/blender/editors/space_text/text_ops.c1
-rw-r--r--source/blender/makesdna/DNA_space_types.h2
-rw-r--r--source/blender/makesrna/RNA_access.h1
-rw-r--r--source/blender/makesrna/intern/rna_access.c13
-rw-r--r--source/blender/makesrna/intern/rna_image.c1
-rw-r--r--source/blender/makesrna/intern/rna_object.c2
-rw-r--r--source/blender/makesrna/intern/rna_space.c4
-rw-r--r--source/blender/makesrna/intern/rna_text.c19
-rw-r--r--source/blender/python/intern/bpy_ui.c2
27 files changed, 1441 insertions, 223 deletions
diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c
index 338dc810641..e7d5fba23c8 100644
--- a/source/blender/blenloader/intern/readfile.c
+++ b/source/blender/blenloader/intern/readfile.c
@@ -4329,7 +4329,7 @@ void lib_link_screen_restore(Main *newmain, bScreen *curscreen, Scene *curscene)
v3d->bgpic->ima= restore_pointer_by_name(newmain, (ID *)v3d->bgpic->ima, 1);
}
if(v3d->localvd) {
- Base *base;
+ /*Base *base;*/
v3d->localvd->camera= sc->scene->camera;
@@ -5960,10 +5960,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
while(sl) {
if(sl->spacetype==SPACE_TEXT) {
SpaceText *st= (SpaceText*) sl;
- if(st->font_id>1) {
- st->font_id= 0;
- st->lheight= 13;
- }
+ st->lheight= 12;
}
sl= sl->next;
}
diff --git a/source/blender/editors/include/UI_interface.h b/source/blender/editors/include/UI_interface.h
index 75c78f4a0d2..24d44f3484f 100644
--- a/source/blender/editors/include/UI_interface.h
+++ b/source/blender/editors/include/UI_interface.h
@@ -36,6 +36,7 @@ struct ID;
struct Main;
struct ListBase;
struct ARegion;
+struct ScrArea;
struct wmWindow;
struct wmWindowManager;
struct wmOperator;
@@ -303,7 +304,7 @@ void uiTextBoundsBlock(uiBlock *block, int addval);
void uiPopupBoundsBlock(uiBlock *block, int addval, int mx, int my);
void uiMenuPopupBoundsBlock(uiBlock *block, int addvall, int mx, int my);
-int uiBlocksGetYMin (ListBase *lb);
+int uiBlocksGetYMin (struct ListBase *lb);
int uiBlockGetCol (uiBlock *block);
void uiBlockSetCol (uiBlock *block, int col);
@@ -430,7 +431,7 @@ void uiDefKeyevtButS(uiBlock *block, int retval, char *str, short x1, short y1,
void uiBlockPickerButtons(struct uiBlock *block, float *col, float *hsv, float *old, char *hexcol, char mode, short retval);
-uiBut *uiDefAutoButR(uiBlock *block, struct PointerRNA *ptr, struct PropertyRNA *prop, int index, char *name, int x1, int y1, int x2, int y2);
+uiBut *uiDefAutoButR(uiBlock *block, struct PointerRNA *ptr, struct PropertyRNA *prop, int index, char *name, int icon, int x1, int y1, int x2, int y2);
int uiDefAutoButsRNA(uiBlock *block, struct PointerRNA *ptr);
/* Links
@@ -500,7 +501,7 @@ extern void uiMatchPanelsView2d(struct ARegion *ar);
extern void uiNewPanelHeight(struct uiBlock *block, int sizey);
extern void uiNewPanelTitle(struct uiBlock *block, char *str);
-extern uiBlock *uiFindOpenPanelBlockName(ListBase *lb, char *name);
+extern uiBlock *uiFindOpenPanelBlockName(struct ListBase *lb, char *name);
extern int uiAlignPanelStep(struct ScrArea *sa, struct ARegion *ar, float fac);
extern void uiPanelControl(int);
extern void uiSetPanelHandler(int);
@@ -519,16 +520,16 @@ void UI_add_popup_handlers(struct ListBase *handlers, uiPopupBlockHandle *menu);
* Callbacks and utils to get 2.48 work */
void test_idbutton_cb(struct bContext *C, void *namev, void *arg2);
-void test_scriptpoin_but(struct bContext *C, char *name, ID **idpp);
-void test_actionpoin_but(struct bContext *C, char *name, ID **idpp);
-void test_obpoin_but(struct bContext *C, char *name, ID **idpp);
-void test_meshobpoin_but(struct bContext *C, char *name, ID **idpp);
-void test_meshpoin_but(struct bContext *C, char *name, ID **idpp);
-void test_matpoin_but(struct bContext *C, char *name, ID **idpp);
-void test_scenepoin_but(struct bContext *C, char *name, ID **idpp);
-void test_grouppoin_but(struct bContext *C, char *name, ID **idpp);
-void test_texpoin_but(struct bContext *C, char *name, ID **idpp);
-void test_imapoin_but(struct bContext *C, char *name, ID **idpp);
+void test_scriptpoin_but(struct bContext *C, char *name, struct ID **idpp);
+void test_actionpoin_but(struct bContext *C, char *name, struct ID **idpp);
+void test_obpoin_but(struct bContext *C, char *name, struct ID **idpp);
+void test_meshobpoin_but(struct bContext *C, char *name, struct ID **idpp);
+void test_meshpoin_but(struct bContext *C, char *name, struct ID **idpp);
+void test_matpoin_but(struct bContext *C, char *name, struct ID **idpp);
+void test_scenepoin_but(struct bContext *C, char *name, struct ID **idpp);
+void test_grouppoin_but(struct bContext *C, char *name, struct ID **idpp);
+void test_texpoin_but(struct bContext *C, char *name, struct ID **idpp);
+void test_imapoin_but(struct bContext *C, char *name, struct ID **idpp);
void autocomplete_bone(struct bContext *C, char *str, void *arg_v);
void autocomplete_vgroup(struct bContext *C, char *str, void *arg_v);
@@ -553,5 +554,78 @@ 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);
+/* Layout
+ *
+ * More automated layout of buttons. Has three levels:
+ * - Layout: contains a number templates, within a bounded width or height.
+ * - Template: predefined layouts for buttons with a number of slots, each
+ * slot can contain multiple items.
+ * - Item: item to put in a template slot, being either an RNA property,
+ * operator, label or menu currently. */
+
+/* layout */
+#define UI_LAYOUT_HORIZONTAL 0
+#define UI_LAYOUT_VERTICAL 1
+
+typedef struct uiLayout uiLayout;
+
+uiLayout *uiLayoutBegin(int dir, int x, int y, int w, int h);
+void uiLayoutContext(uiLayout *layout, int opcontext);
+void uiLayoutEnd(const struct bContext *C, uiBlock *block, uiLayout *layout, int *x, int *y);
+
+/* vertical button templates */
+#define UI_TSLOT_COLUMN_1 0
+#define UI_TSLOT_COLUMN_2 1
+#define UI_TSLOT_COLUMN_3 2
+#define UI_TSLOT_COLUMN_4 3
+#define UI_TSLOT_COLUMN_5 4
+#define UI_TSLOT_COLUMN_MAX 5
+
+#define UI_TSLOT_LR_LEFT 0
+#define UI_TSLOT_LR_RIGHT 1
+
+void uiTemplateLeftRight(uiLayout *layout);
+void uiTemplateColumn(uiLayout *layout);
+uiLayout *uiTemplateStack(uiLayout *layout);
+
+/* horizontal header templates */
+#define UI_TSLOT_HEADER 0
+
+void uiTemplateHeaderMenus(uiLayout *layout);
+void uiTemplateHeaderButtons(uiLayout *layout);
+void uiTemplateHeaderID(uiLayout *layout, struct PointerRNA *ptr, char *propname, int flag, uiIDPoinFunc func);
+void uiTemplateSetColor(uiLayout *layout, int color);
+
+/* items */
+void uiItemO(uiLayout *layout, int slot, const char *name, int icon, char *opname);
+void uiItemEnumO(uiLayout *layout, int slot, const char *name, int icon, char *opname, char *propname, int value);
+void uiItemsEnumO(uiLayout *layout, int slot, char *opname, char *propname);
+void uiItemBooleanO(uiLayout *layout, int slot, const char *name, int icon, char *opname, char *propname, int value);
+void uiItemIntO(uiLayout *layout, int slot, const char *name, int icon, char *opname, char *propname, int value);
+void uiItemFloatO(uiLayout *layout, int slot, const char *name, int icon, char *opname, char *propname, float value);
+void uiItemStringO(uiLayout *layout, int slot, const char *name, int icon, char *opname, char *propname, char *value);
+void uiItemFullO(uiLayout *layout, int slot, const char *name, int icon, char *idname, IDProperty *properties, int context);
+
+void uiItemR(uiLayout *layout, int slot, const char *name, int icon, struct PointerRNA *ptr, char *propname);
+void uiItemFullR(uiLayout *layout, int slot, const char *name, int icon, struct PointerRNA *ptr, char *propname, int index);
+
+void uiItemLabel(uiLayout *layout, int slot, const char *name, int icon);
+
+void uiItemMenu(uiLayout *layout, int slot, const char *name, int icon, uiMenuCreateFunc func);
+
+/* utilities */
+#define UI_PANEL_WIDTH 340
+#define UI_COMPACT_PANEL_WIDTH 160
+
+typedef void (*uiHeaderCreateFunc)(const struct bContext *C, uiLayout *layout);
+typedef void (*uiPanelCreateFunc)(const struct bContext *C, uiLayout *layout);
+
+void uiPanelLayout(const struct bContext *C, struct ARegion *ar, char *blockname,
+ char *panelname, char *tabname, uiPanelCreateFunc func, int order);
+void uiCompactPanelLayout(const struct bContext *C, struct ARegion *ar, char *blockname,
+ char *panelname, char *tabname, uiPanelCreateFunc func, int order);
+void uiHeaderLayout(const struct bContext *C, struct ARegion *ar,
+ uiHeaderCreateFunc func);
+
#endif /* UI_INTERFACE_H */
diff --git a/source/blender/editors/include/UI_view2d.h b/source/blender/editors/include/UI_view2d.h
index eacdba9218e..0650a5611dc 100644
--- a/source/blender/editors/include/UI_view2d.h
+++ b/source/blender/editors/include/UI_view2d.h
@@ -56,6 +56,8 @@ enum {
V2D_COMMONVIEW_HEADER,
/* ui listviews, tries to wrap tot inside region width */
V2D_COMMONVIEW_LIST_UI,
+ /* ui region containing panels */
+ V2D_COMMONVIEW_PANELS_UI,
} eView2D_CommonViewTypes;
/* ---- Defines for Scroller/Grid Arguments ----- */
diff --git a/source/blender/editors/interface/interface_draw.c b/source/blender/editors/interface/interface_draw.c
index 8c090227737..f93c4aa759a 100644
--- a/source/blender/editors/interface/interface_draw.c
+++ b/source/blender/editors/interface/interface_draw.c
@@ -2221,8 +2221,8 @@ static void ui_draw_text(uiBut *but, float x, float y, int sunken)
/* text color, with pulldown item exception */
if(but->dt==UI_EMBOSSP) {
if (sunken) {
- float col[4];
- UI_GetThemeColor4ubv(TH_MENU_TEXT, col);
+ float col[3];
+ UI_GetThemeColor3fv(TH_MENU_TEXT, col);
if ((col[0] + col[1] + col[2]) / 3.f < 0.5f)
UI_ThemeColorShadeAlpha(TH_HEADER, 20, alpha_offs);
} else if((but->flag & UI_ACTIVE) && but->type!=LABEL) { // LABEL = title in pulldowns
diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c
index e4a5ddf75fa..9d679f64378 100644
--- a/source/blender/editors/interface/interface_handlers.c
+++ b/source/blender/editors/interface/interface_handlers.c
@@ -2961,6 +2961,8 @@ static void button_activate_state(bContext *C, uiBut *but, uiHandleButtonState s
data->state= state;
+ ui_check_but(but);
+
/* redraw */
ED_region_tag_redraw(data->region);
}
@@ -3050,6 +3052,7 @@ static void button_activate_exit(bContext *C, uiHandleButtonData *data, uiBut *b
MEM_freeN(but->active);
but->active= NULL;
but->flag &= ~(UI_ACTIVE|UI_SELECT);
+ ui_check_but(but);
/* adds empty mousemove in queue for re-init handler, in case mouse is
* still over a button. we cannot just check for this ourselfs because
diff --git a/source/blender/editors/interface/interface_layout.c b/source/blender/editors/interface/interface_layout.c
new file mode 100644
index 00000000000..42f656c46a0
--- /dev/null
+++ b/source/blender/editors/interface/interface_layout.c
@@ -0,0 +1,943 @@
+
+#include <limits.h>
+#include <math.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "MEM_guardedalloc.h"
+
+#include "DNA_ID.h"
+#include "DNA_scene_types.h"
+#include "DNA_screen_types.h"
+#include "DNA_windowmanager_types.h"
+
+#include "BLI_listbase.h"
+
+#include "BKE_context.h"
+#include "BKE_global.h"
+#include "BKE_idprop.h"
+#include "BKE_utildefines.h"
+
+#include "RNA_access.h"
+
+#include "UI_interface.h"
+#include "UI_resources.h"
+#include "UI_view2d.h"
+
+#include "ED_util.h"
+#include "ED_types.h"
+#include "ED_screen.h"
+
+#include "WM_api.h"
+#include "WM_types.h"
+
+/************************ Structs and Defines *************************/
+
+#define COLUMN_SPACE 5
+#define TEMPLATE_SPACE 5
+#define STACK_SPACE 5
+#define BUTTON_SPACE_X 5
+#define BUTTON_SPACE_Y 2
+
+#define RNA_NO_INDEX -1
+
+/* Item */
+
+typedef enum uiItemType {
+ ITEM_OPERATOR,
+ ITEM_RNA_PROPERTY,
+ ITEM_MENU,
+ ITEM_LABEL
+} uiItemType;
+
+enum uiItemFlag {
+ ITEM_ICON,
+ ITEM_TEXT
+};
+
+typedef struct uiItem {
+ struct uiItem *next, *prev;
+ uiItemType type;
+ int slot;
+
+ const char *name;
+ int icon;
+} uiItem;
+
+typedef struct uiItemRNA {
+ uiItem item;
+
+ PointerRNA ptr;
+ PropertyRNA *prop;
+ int index;
+} uiItemRNA;
+
+typedef struct uiItemOp {
+ uiItem item;
+
+ wmOperatorType *ot;
+ IDProperty *properties;
+ int context;
+} uiItemOp;
+
+typedef struct uiItemLMenu {
+ uiItem item;
+
+ uiMenuCreateFunc func;
+} uiItemLMenu;
+
+/* Template */
+
+typedef enum uiTemplateType {
+ TEMPLATE_COLUMN,
+ TEMPLATE_LR,
+ TEMPLATE_STACK,
+
+ TEMPLATE_HEADER_MENUS,
+ TEMPLATE_HEADER_BUTTONS,
+ TEMPLATE_HEADER_ID
+} uiTemplateType;
+
+typedef struct uiTemplate {
+ struct uiTemplate *next, *prev;
+ uiTemplateType type;
+
+ ListBase items;
+ int color;
+} uiTemplate;
+
+typedef struct uiTemplateStck {
+ uiTemplate template;
+ uiLayout *sublayout;
+} uiTemplateStck;
+
+typedef struct uiTemplateHeadID {
+ uiTemplate template;
+
+ PointerRNA ptr;
+ char *propname;
+ int flag;
+ uiIDPoinFunc func;
+} uiTemplateHeadID;
+
+/* Layout */
+
+struct uiLayout {
+ ListBase templates;
+ int opcontext;
+ int dir;
+ int x, y, w, h;
+};
+
+void ui_layout_free(uiLayout *layout);
+void ui_layout_end(const bContext *C, uiBlock *block, uiLayout *layout, int *x, int *y);
+
+/************************** Item ***************************/
+
+static int ui_item_fit(int item, int all, int available)
+{
+ if(all > available)
+ return (item*available)/all;
+
+ return all;
+}
+
+/* create buttons for an item with an RNA array */
+static void ui_item_array(uiBlock *block, uiItemRNA *rnaitem, int len, int x, int y, int w, int h)
+{
+ PropertyType type;
+ PropertySubType subtype;
+ char *name;
+ int a;
+
+ /* retrieve type and subtype */
+ type= RNA_property_type(&rnaitem->ptr, rnaitem->prop);
+ subtype= RNA_property_subtype(&rnaitem->ptr, rnaitem->prop);
+
+ /* create label */
+ if(rnaitem->item.name)
+ name= (char*)rnaitem->item.name;
+ else
+ name= (char*)RNA_property_ui_name(&rnaitem->ptr, rnaitem->prop);
+
+ uiDefBut(block, LABEL, 0, name, x, y + h - YIC, w, YIC, NULL, 0.0, 0.0, 0, 0, "");
+
+ /* create buttons */
+ uiBlockBeginAlign(block);
+
+ if(type == PROP_BOOLEAN && len == 20) {
+ /* special check for layer layout */
+ int butw, buth;
+
+ butw= ui_item_fit(XIC, XIC*10 + BUTTON_SPACE_X, w);
+ buth= MIN2(YIC, butw);
+
+ y += 2*(YIC - buth);
+
+ uiBlockBeginAlign(block);
+ for(a=0; a<5; a++)
+ uiDefAutoButR(block, &rnaitem->ptr, rnaitem->prop, a, "", ICON_BLANK1, x + butw*a, y+buth, butw, buth);
+ for(a=0; a<5; a++)
+ uiDefAutoButR(block, &rnaitem->ptr, rnaitem->prop, a+10, "", ICON_BLANK1, x + butw*a, y, butw, buth);
+ uiBlockEndAlign(block);
+
+ x += 5*butw + BUTTON_SPACE_X;
+
+ uiBlockBeginAlign(block);
+ for(a=0; a<5; a++)
+ uiDefAutoButR(block, &rnaitem->ptr, rnaitem->prop, a+5, "", ICON_BLANK1, x + butw*a, y+buth, butw, buth);
+ for(a=0; a<5; a++)
+ uiDefAutoButR(block, &rnaitem->ptr, rnaitem->prop, a+15, "", ICON_BLANK1, x + butw*a, y, butw, buth);
+ uiBlockEndAlign(block);
+ }
+ else if(subtype == PROP_MATRIX) {
+ /* matrix layout */
+ int row, col;
+
+ len= ceil(sqrt(len));
+
+ h /= len;
+ w /= len;
+
+ // XXX test
+ for(a=0; a<len; a++) {
+ col= a%len;
+ row= a/len;
+
+ uiDefAutoButR(block, &rnaitem->ptr, rnaitem->prop, a, "", 0, x + w*col, y+(row-a-1)*YIC, w, YIC);
+ }
+ }
+ else if(len <= 4 && ELEM3(subtype, PROP_ROTATION, PROP_VECTOR, PROP_COLOR)) {
+ /* layout for known array subtypes */
+ static char *vectoritem[4]= {"X:", "Y:", "Z:", "W:"};
+ static char *quatitem[4]= {"W:", "X:", "Y:", "Z:"};
+ static char *coloritem[4]= {"R:", "G:", "B:", "A:"};
+
+ for(a=0; a<len; a++) {
+ if(len == 4 && subtype == PROP_ROTATION)
+ name= quatitem[a];
+ else if(subtype == PROP_VECTOR || subtype == PROP_ROTATION)
+ name= vectoritem[a];
+ else
+ name= coloritem[a];
+
+ uiDefAutoButR(block, &rnaitem->ptr, rnaitem->prop, a, name, 0, x, y+(len-a-1)*YIC, w, YIC);
+ }
+ }
+ else {
+ /* default array layout */
+ for(a=0; a<len; a++)
+ uiDefAutoButR(block, &rnaitem->ptr, rnaitem->prop, a, "", 0, x, y+(len-a-1)*YIC, w, YIC);
+ }
+
+ uiBlockEndAlign(block);
+}
+
+/* create lable + button for RNA property */
+static void ui_item_with_label(uiBlock *block, uiItemRNA *rnaitem, int x, int y, int w, int h)
+{
+ char *name;
+ int butw;
+
+ if(rnaitem->item.name)
+ name= (char*)rnaitem->item.name;
+ else
+ name= (char*)RNA_property_ui_name(&rnaitem->ptr, rnaitem->prop);
+
+ if(strcmp(name, "") != 0) {
+ butw= GetButStringLength(name);
+ uiDefBut(block, LABEL, 0, name, x, y, butw, h, NULL, 0.0, 0.0, 0, 0, "");
+
+ x += butw;
+ w -= butw;
+ }
+
+ uiDefAutoButR(block, &rnaitem->ptr, rnaitem->prop, rnaitem->index, "", rnaitem->item.icon, x, y, w, h);
+}
+
+/* create buttons for an arbitrary item */
+static void ui_item_buts(uiBlock *block, uiItem *item, int x, int y, int w, int h)
+{
+ if(item->type == ITEM_RNA_PROPERTY) {
+ /* RNA property */
+ uiItemRNA *rnaitem= (uiItemRNA*)item;
+ PropertyType type;
+ int len;
+
+ /* retrieve info */
+ type= RNA_property_type(&rnaitem->ptr, rnaitem->prop);
+ len= RNA_property_array_length(&rnaitem->ptr, rnaitem->prop);
+
+ /* array property */
+ if(rnaitem->index == RNA_NO_INDEX && len > 0)
+ ui_item_array(block, rnaitem, len, x, y, w, h);
+ /* property with separate label */
+ else if(type == PROP_ENUM || type == PROP_STRING || type == PROP_POINTER)
+ ui_item_with_label(block, rnaitem, x, y, w, h);
+ /* single button */
+ else
+ uiDefAutoButR(block, &rnaitem->ptr, rnaitem->prop, rnaitem->index, (char*)item->name, item->icon, x, y, w, h);
+ }
+ else if(item->type == ITEM_OPERATOR) {
+ /* operator */
+ uiItemOp *opitem= (uiItemOp*)item;
+
+ if(item->icon && item->name)
+ uiDefIconTextButO(block, BUT, opitem->ot->idname, opitem->context, item->icon, (char*)item->name, x, y, w, h, NULL);
+ else if(item->icon)
+ uiDefIconButO(block, BUT, opitem->ot->idname, opitem->context, item->icon, x, y, w, h, NULL);
+ /* text only */
+ else
+ uiDefButO(block, BUT, opitem->ot->idname, opitem->context, (char*)item->name, x, y, w, h, NULL);
+ }
+ else if(item->type == ITEM_MENU) {
+ /* menu */
+ uiItemLMenu *menuitem= (uiItemLMenu*)item;
+
+ uiDefMenuBut(block, menuitem->func, NULL, (char*)item->name, x, y-2, w-3, h+4, "");
+ }
+ else if(item->type == ITEM_LABEL) {
+ /* label */
+
+ if(item->icon && item->name)
+ uiDefIconTextBut(block, LABEL, 0, item->icon, (char*)item->name, x, y, w, h, NULL, 0.0, 0.0, 0, 0, "");
+ else if(item->icon)
+ uiDefIconBut(block, LABEL, 0, item->icon, x, y, w, h, NULL, 0.0, 0.0, 0, 0, "");
+ else if((char*)item->name)
+ uiDefBut(block, LABEL, 0, (char*)item->name, x, y, w, h, NULL, 0.0, 0.0, 0, 0, "");
+ }
+ else {
+ /* separator */
+ uiDefBut(block, SEPR, 0, "", x, y, w, h, NULL, 0.0, 0.0, 0, 0, "");
+ }
+}
+
+/* estimated size of text + icon */
+static int ui_text_icon_width(const char *name, int icon)
+{
+ if(icon && name && strcmp(name, "") == 0)
+ return XIC; /* icon only */
+ else if(icon && name)
+ return XIC + GetButStringLength((char*)name); /* icon + text */
+ else if(name)
+ return GetButStringLength((char*)name); /* text only */
+ else
+ return 0;
+}
+
+/* estimated size of an item */
+static void ui_item_size(uiItem *item, int *r_w, int *r_h)
+{
+ const char *name;
+ int w, h;
+
+ if(item->type == ITEM_RNA_PROPERTY) {
+ /* RNA property */
+ uiItemRNA *rnaitem= (uiItemRNA*)item;
+ PropertyType type;
+ PropertySubType subtype;
+ int len;
+
+ name= item->name;
+ if(!name)
+ name= RNA_property_ui_name(&rnaitem->ptr, rnaitem->prop);
+
+ w= ui_text_icon_width(name, item->icon);
+ h= YIC;
+
+ /* arbitrary extended width by type */
+ type= RNA_property_type(&rnaitem->ptr, rnaitem->prop);
+ subtype= RNA_property_subtype(&rnaitem->ptr, rnaitem->prop);
+ len= RNA_property_array_length(&rnaitem->ptr, rnaitem->prop);
+
+ if(type == PROP_BOOLEAN && !item->icon)
+ w += XIC;
+ else if(type == PROP_INT || type == PROP_FLOAT)
+ w += 2*XIC;
+ else if(type == PROP_STRING)
+ w += 8*XIC;
+
+ /* increase height for arrays */
+ if(rnaitem->index == RNA_NO_INDEX && len > 0) {
+ if(name && strcmp(name, "") == 0 && item->icon == 0)
+ h= 0;
+
+ if(type == PROP_BOOLEAN && len == 20)
+ h += 2*YIC;
+ else if(subtype == PROP_MATRIX)
+ h += ceil(sqrt(len))*YIC;
+ else
+ h += len*YIC;
+ }
+ }
+ else if(item->type == ITEM_OPERATOR) {
+ /* operator */
+ uiItemOp *opitem= (uiItemOp*)item;
+
+ name= item->name;
+ if(!name)
+ name= opitem->ot->name;
+
+ w= ui_text_icon_width(name, item->icon);
+ h= YIC;
+ }
+ else {
+ /* other */
+ w= ui_text_icon_width(item->name, item->icon);
+ h= YIC;
+ }
+
+ if(r_w) *r_w= w;
+ if(r_h) *r_h= h;
+}
+
+static void ui_item_free(uiItem *item)
+{
+ if(item->type == ITEM_OPERATOR) {
+ uiItemOp *opitem= (uiItemOp*)item;
+
+ if(opitem->properties) {
+ IDP_FreeProperty(opitem->properties);
+ MEM_freeN(opitem->properties);
+ }
+ }
+}
+
+/* operator items */
+void uiItemFullO(uiLayout *layout, int slot, const char *name, int icon, char *idname, IDProperty *properties, int context)
+{
+ uiTemplate *template= layout->templates.last;
+ wmOperatorType *ot= WM_operatortype_find(idname);
+ uiItemOp *opitem;
+
+ if(!ot)
+ return;
+
+ opitem= MEM_callocN(sizeof(uiItemOp), "uiItemOp");
+
+ opitem->item.name= name;
+ opitem->item.icon= icon;
+ opitem->item.type= ITEM_OPERATOR;
+ opitem->item.slot= slot;
+
+ opitem->ot= ot;
+ opitem->properties= properties;
+ opitem->context= context;
+
+ BLI_addtail(&template->items, opitem);
+}
+
+void uiItemEnumO(uiLayout *layout, int slot, const char *name, int icon, char *opname, char *propname, int value)
+{
+ PointerRNA ptr;
+
+ WM_operator_properties_create(&ptr, opname);
+ RNA_enum_set(&ptr, propname, value);
+
+ uiItemFullO(layout, slot, name, icon, opname, ptr.data, layout->opcontext);
+}
+
+void uiItemsEnumO(uiLayout *layout, int slot, char *opname, char *propname)
+{
+ wmOperatorType *ot= WM_operatortype_find(opname);
+ PointerRNA ptr;
+ PropertyRNA *prop;
+
+ if(!ot || !ot->srna)
+ return;
+
+ 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;
+
+ RNA_property_enum_items(&ptr, prop, &item, &totitem);
+
+ for(i=0; i<totitem; i++)
+ uiItemEnumO(layout, slot, "", 0, opname, propname, item[i].value);
+ }
+}
+
+void uiItemBooleanO(uiLayout *layout, int slot, const char *name, int icon, char *opname, char *propname, int value)
+{
+ PointerRNA ptr;
+
+ WM_operator_properties_create(&ptr, opname);
+ RNA_boolean_set(&ptr, propname, value);
+
+ uiItemFullO(layout, slot, name, icon, opname, ptr.data, layout->opcontext);
+}
+
+void uiItemIntO(uiLayout *layout, int slot, const char *name, int icon, char *opname, char *propname, int value)
+{
+ PointerRNA ptr;
+
+ WM_operator_properties_create(&ptr, opname);
+ RNA_int_set(&ptr, propname, value);
+
+ uiItemFullO(layout, slot, name, icon, opname, ptr.data, layout->opcontext);
+}
+
+void uiItemFloatO(uiLayout *layout, int slot, const char *name, int icon, char *opname, char *propname, float value)
+{
+ PointerRNA ptr;
+
+ WM_operator_properties_create(&ptr, opname);
+ RNA_float_set(&ptr, propname, value);
+
+ uiItemFullO(layout, slot, name, icon, opname, ptr.data, layout->opcontext);
+}
+
+void uiItemStringO(uiLayout *layout, int slot, const char *name, int icon, char *opname, char *propname, char *value)
+{
+ PointerRNA ptr;
+
+ WM_operator_properties_create(&ptr, opname);
+ RNA_string_set(&ptr, propname, value);
+
+ uiItemFullO(layout, slot, name, icon, opname, ptr.data, layout->opcontext);
+}
+
+void uiItemO(uiLayout *layout, int slot, const char *name, int icon, char *opname)
+{
+ uiItemFullO(layout, slot, name, icon, opname, NULL, layout->opcontext);
+}
+
+/* RNA property items */
+void uiItemFullR(uiLayout *layout, int slot, const char *name, int icon, PointerRNA *ptr, char *propname, int index)
+{
+ uiTemplate *template= layout->templates.last;
+ PropertyRNA *prop;
+ uiItemRNA *rnaitem;
+
+ prop= RNA_struct_find_property(ptr, propname);
+ if(!prop)
+ return;
+
+ rnaitem= MEM_callocN(sizeof(uiItemRNA), "uiItemRNA");
+
+ rnaitem->item.name= name;
+ rnaitem->item.icon= icon;
+ rnaitem->item.type= ITEM_RNA_PROPERTY;
+ rnaitem->item.slot= slot;
+
+ rnaitem->ptr= *ptr;
+ rnaitem->prop= prop;
+ rnaitem->index= index;
+
+ BLI_addtail(&template->items, rnaitem);
+}
+
+void uiItemR(uiLayout *layout, int slot, const char *name, int icon, PointerRNA *ptr, char *propname)
+{
+ uiItemFullR(layout, slot, name, icon, ptr, propname, RNA_NO_INDEX);
+}
+
+/* menu item */
+void uiItemMenu(uiLayout *layout, int slot, const char *name, int icon, uiMenuCreateFunc func)
+{
+ uiTemplate *template= layout->templates.last;
+ uiItemLMenu *menuitem= MEM_callocN(sizeof(uiItemLMenu), "uiItemLMenu");
+
+ menuitem->item.name= name;
+ menuitem->item.icon= icon;
+ menuitem->item.type= ITEM_MENU;
+ menuitem->item.slot= slot;
+
+ menuitem->func= func;
+
+ BLI_addtail(&template->items, menuitem);
+}
+
+/* label item */
+void uiItemLabel(uiLayout *layout, int slot, const char *name, int icon)
+{
+ uiTemplate *template= layout->templates.last;
+ uiItem *item= MEM_callocN(sizeof(uiItem), "uiItem");
+
+ item->name= name;
+ item->icon= icon;
+ item->type= ITEM_LABEL;
+ item->slot= slot;
+
+ BLI_addtail(&template->items, item);
+}
+
+/**************************** Template ***************************/
+
+/* multi-column layout */
+static void ui_layout_column(uiLayout *layout, uiBlock *block, uiTemplate *template, int *x, int *y, int w, int h)
+{
+ uiItem *item;
+ int col, totcol= 0, colx, coly, colw, miny, itemw, itemh;
+
+ /* compute number of columns */
+ for(item=template->items.first; item; item=item->next)
+ totcol= MAX2(item->slot+1, totcol);
+
+ if(totcol == 0)
+ return;
+
+ colx= *x;
+ colw= (w - (totcol-1)*COLUMN_SPACE)/totcol;
+ miny= *y;
+
+ /* create column per column */
+ for(col=0; col<totcol; col++) {
+ coly= *y;
+
+ for(item=template->items.first; item; item=item->next) {
+ if(item->slot != col)
+ continue;
+
+ ui_item_size(item, &itemw, &itemh);
+
+ coly -= itemh + BUTTON_SPACE_Y;
+ ui_item_buts(block, item, colx, coly, colw, itemh);
+ }
+
+ colx += colw + COLUMN_SPACE;
+ miny= MIN2(miny, coly);
+ }
+
+ *y= miny;
+}
+
+/* left-right layout, with buttons aligned on both sides */
+static void ui_layout_lr(uiLayout *layout, uiBlock *block, uiTemplate *template, int *x, int *y, int w, int h)
+{
+ uiItem *item;
+ int totw= 0, maxh= 0, itemw, itemh, leftx, rightx;
+
+ /* estimate total width of buttons */
+ for(item=template->items.first; item; item=item->next) {
+ ui_item_size(item, &itemw, &itemh);
+ totw += itemw;
+ maxh= MAX2(maxh, itemh);
+ }
+
+ if(totw == 0)
+ return;
+
+ /* create buttons starting from left and right */
+ leftx= *x;
+ rightx= *x + w;
+
+ for(item=template->items.first; item; item=item->next) {
+ ui_item_size(item, &itemw, &itemh);
+ itemw= ui_item_fit(itemw, totw+BUTTON_SPACE_X, w);
+
+ if(item->slot == UI_TSLOT_LR_LEFT) {
+ ui_item_buts(block, item, leftx, *y-itemh, itemw, itemh);
+ leftx += itemw;
+ }
+ else {
+ rightx -= itemw;
+ ui_item_buts(block, item, rightx, *y-itemh, itemw, itemh);
+ }
+ }
+
+ *y -= maxh;
+}
+
+/* element in a stack layout */
+static void ui_layout_stack(const bContext *C, uiLayout *layout, uiBlock *block, uiTemplate *template, int *x, int *y, int w, int h)
+{
+ uiTemplateStck *stack= (uiTemplateStck*)template;
+ int starty, startx;
+
+ startx= *x;
+ starty= *y;
+
+ /* some extra padding */
+ stack->sublayout->x= *x + STACK_SPACE;
+ stack->sublayout->w= w - 2*STACK_SPACE;
+ stack->sublayout->y= *y - STACK_SPACE;
+ stack->sublayout->h= h;
+
+ /* do layout for elements in sublayout */
+ ui_layout_end(C, block, stack->sublayout, NULL, y);
+
+ /* roundbox around the sublayout */
+ uiDefBut(block, ROUNDBOX, 0, "", startx, *y, w, starty - *y, NULL, 7.0, 0.0, 3, 20, "");
+}
+
+static void ui_layout_header_buttons(uiLayout *layout, uiBlock *block, uiTemplate *template, int *x, int *y, int w, int h)
+{
+ uiItem *item;
+ int itemw, itemh;
+
+ uiBlockBeginAlign(block);
+
+ for(item=template->items.first; item; item=item->next) {
+ ui_item_size(item, &itemw, &itemh);
+ ui_item_buts(block, item, *x, *y, itemw, itemh);
+ *x += itemw;
+ }
+
+ uiBlockEndAlign(block);
+}
+
+static void ui_layout_header_menus(const bContext *C, uiLayout *layout, uiBlock *block, uiTemplate *template, int *x, int *y, int w, int h)
+{
+ ScrArea *sa= CTX_wm_area(C);
+
+ *x= ED_area_header_standardbuttons(C, block, *y);
+
+ if((sa->flag & HEADER_NO_PULLDOWN)==0) {
+ uiBlockSetEmboss(block, UI_EMBOSSP);
+ ui_layout_header_buttons(layout, block, template, x, y, w, h);
+ }
+
+ uiBlockSetEmboss(block, UI_EMBOSS);
+}
+
+static void ui_layout_header_id(const bContext *C, uiLayout *layout, uiBlock *block, uiTemplate *template, int *x, int *y, int w, int h)
+{
+ uiTemplateHeadID *idtemplate= (uiTemplateHeadID*)template;
+ PointerRNA idptr;
+
+ idptr= RNA_pointer_get(&idtemplate->ptr, idtemplate->propname);
+
+ *x= uiDefIDPoinButs(block, CTX_data_main(C), NULL, (ID*)idptr.data, ID_TXT, NULL, *x, *y,
+ idtemplate->func, UI_ID_BROWSE|UI_ID_RENAME|UI_ID_ADD_NEW|UI_ID_OPEN|UI_ID_DELETE);
+}
+
+void ui_template_free(uiTemplate *template)
+{
+ uiItem *item;
+
+ if(template->type == TEMPLATE_STACK) {
+ uiTemplateStck *stack= (uiTemplateStck*)template;
+ ui_layout_free(stack->sublayout);
+ }
+
+ for(item=template->items.first; item; item=item->next)
+ ui_item_free(item);
+
+ BLI_freelistN(&template->items);
+}
+
+/* template create functions */
+void uiTemplateColumn(uiLayout *layout)
+{
+ uiTemplate *template;
+
+ template= MEM_callocN(sizeof(uiTemplate), "uiTemplate");
+ template->type= TEMPLATE_COLUMN;
+
+ BLI_addtail(&layout->templates, template);
+}
+
+
+void uiTemplateLeftRight(uiLayout *layout)
+{
+ uiTemplate *template;
+
+ template= MEM_callocN(sizeof(uiTemplate), "uiTemplate");
+ template->type= TEMPLATE_LR;
+
+ BLI_addtail(&layout->templates, template);
+}
+
+uiLayout *uiTemplateStack(uiLayout *layout)
+{
+ uiTemplateStck *stack;
+
+ stack= MEM_callocN(sizeof(uiTemplateStck), "uiTemplateStck");
+ stack->template.type= TEMPLATE_STACK;
+ stack->sublayout= uiLayoutBegin(layout->dir, 0, 0, 0, 0);
+ BLI_addtail(&layout->templates, stack);
+
+ return stack->sublayout;
+}
+
+void uiTemplateHeaderMenus(uiLayout *layout)
+{
+ uiTemplate *template;
+
+ template= MEM_callocN(sizeof(uiTemplate), "uiTemplate");
+ template->type= TEMPLATE_HEADER_MENUS;
+
+ BLI_addtail(&layout->templates, template);
+}
+
+void uiTemplateHeaderButtons(uiLayout *layout)
+{
+ uiTemplate *template;
+
+ template= MEM_callocN(sizeof(uiTemplate), "uiTemplate");
+ template->type= TEMPLATE_HEADER_BUTTONS;
+
+ BLI_addtail(&layout->templates, template);
+}
+
+void uiTemplateHeaderID(uiLayout *layout, PointerRNA *ptr, char *propname, int flag, uiIDPoinFunc func)
+{
+ uiTemplateHeadID *idtemplate;
+
+ idtemplate= MEM_callocN(sizeof(uiTemplateHeadID), "uiTemplateHeadID");
+ idtemplate->template.type= TEMPLATE_HEADER_ID;
+ idtemplate->ptr= *ptr;
+ idtemplate->propname= propname;
+ idtemplate->flag= flag;
+ idtemplate->func= func;
+
+ BLI_addtail(&layout->templates, idtemplate);
+}
+
+void uiTemplateSetColor(uiLayout *layout, int color)
+{
+ uiTemplate *template= layout->templates.last;
+
+ template->color= color;
+}
+
+/********************** Layout *******************/
+
+static void ui_layout_templates(const bContext *C, uiBlock *block, uiLayout *layout)
+{
+ uiTemplate *template;
+ int oldcolor= 0;
+
+ for(template=layout->templates.first; template; template=template->next) {
+ if(template->color) {
+ oldcolor= uiBlockGetCol(block);
+ uiBlockSetCol(block, template->color);
+ }
+
+ switch(template->type) {
+ case TEMPLATE_COLUMN:
+ ui_layout_column(layout, block, template, &layout->x, &layout->y, layout->w, layout->h);
+ break;
+ case TEMPLATE_LR:
+ ui_layout_lr(layout, block, template, &layout->x, &layout->y, layout->w, layout->h);
+ break;
+ case TEMPLATE_STACK:
+ ui_layout_stack(C, layout, block, template, &layout->x, &layout->y, layout->w, layout->h);
+ break;
+ case TEMPLATE_HEADER_MENUS:
+ ui_layout_header_menus(C, layout, block, template, &layout->x, &layout->y, layout->w, layout->h);
+ break;
+ case TEMPLATE_HEADER_BUTTONS:
+ ui_layout_header_buttons(layout, block, template, &layout->x, &layout->y, layout->w, layout->h);
+ break;
+ case TEMPLATE_HEADER_ID:
+ ui_layout_header_id(C, layout, block, template, &layout->x, &layout->y, layout->w, layout->h);
+ break;
+ }
+
+ if(template->color)
+ uiBlockSetCol(block, oldcolor);
+
+ if(layout->dir == UI_LAYOUT_HORIZONTAL)
+ layout->x += TEMPLATE_SPACE;
+ else
+ layout->y -= TEMPLATE_SPACE;
+ }
+}
+
+void ui_layout_end(const bContext *C, uiBlock *block, uiLayout *layout, int *x, int *y)
+{
+ ui_layout_templates(C, block, layout);
+
+ if(x) *x= layout->x;
+ if(y) *y= layout->y;
+}
+
+void ui_layout_free(uiLayout *layout)
+{
+ uiTemplate *template;
+
+ for(template=layout->templates.first; template; template=template->next)
+ ui_template_free(template);
+
+ BLI_freelistN(&layout->templates);
+ MEM_freeN(layout);
+}
+
+uiLayout *uiLayoutBegin(int dir, int x, int y, int w, int h)
+{
+ uiLayout *layout;
+
+ layout= MEM_callocN(sizeof(uiLayout), "uiLayout");
+ layout->opcontext= WM_OP_INVOKE_REGION_WIN;
+ layout->dir= dir;
+ layout->x= x;
+ layout->y= y;
+ layout->w= w;
+ layout->h= h;
+
+ return layout;
+}
+
+void uiLayoutContext(uiLayout *layout, int opcontext)
+{
+ layout->opcontext= opcontext;
+}
+
+void uiLayoutEnd(const bContext *C, uiBlock *block, uiLayout *layout, int *x, int *y)
+{
+ ui_layout_end(C, block, layout, x, y);
+ ui_layout_free(layout);
+}
+
+/* Utilities */
+
+static void ui_panel_layout(const bContext *C, ARegion *ar, char *blockname, char *panelname, char *tabname, uiPanelCreateFunc func, int order, int w)
+{
+ uiBlock *block;
+ uiLayout *layout;
+ int xco, yco, x, y;
+
+ // XXX this only hides cruft
+
+ x= 20*order;
+ y= -100*(order+1);
+
+ block= uiBeginBlock(C, ar, blockname, UI_EMBOSS, UI_HELV);
+ if(uiNewPanel(C, ar, block, panelname, tabname, x, y, w, 0)==0) return;
+
+ layout= uiLayoutBegin(UI_LAYOUT_VERTICAL, x, y, w, 0);
+
+ func(C, layout);
+
+ uiLayoutEnd(C, block, layout, &xco, &yco);
+ uiEndBlock(C, block);
+
+ uiNewPanelHeight(block, y - yco + 6);
+}
+
+void uiCompactPanelLayout(const bContext *C, ARegion *ar, char *blockname, char *panelname, char *tabname, uiPanelCreateFunc func, int order)
+{
+ ui_panel_layout(C, ar, blockname, panelname, tabname, func, order, UI_COMPACT_PANEL_WIDTH-22);
+}
+
+void uiPanelLayout(const bContext *C, ARegion *ar, char *blockname, char *panelname, char *tabname, uiPanelCreateFunc func, int order)
+{
+ ui_panel_layout(C, ar, blockname, panelname, tabname, func, order, UI_PANEL_WIDTH-22);
+}
+
+void uiHeaderLayout(const bContext *C, ARegion *ar, uiHeaderCreateFunc func)
+{
+ uiBlock *block;
+ uiLayout *layout;
+ int xco, yco;
+
+ // XXX this only hides cruft
+
+ block= uiBeginBlock(C, ar, "header buttons", UI_EMBOSS, UI_HELV);
+ layout= uiLayoutBegin(UI_LAYOUT_HORIZONTAL, 8, 3, 0, 24);
+
+ func(C, layout);
+
+ uiLayoutEnd(C, block, layout, &xco, &yco);
+ uiEndBlock(C, block);
+ uiDrawBlock(C, block);
+
+ /* always as last */
+ UI_view2d_totRect_set(&ar->v2d, xco+XIC+80, ar->v2d.tot.ymax-ar->v2d.tot.ymin);
+}
+
diff --git a/source/blender/editors/interface/interface_panel.c b/source/blender/editors/interface/interface_panel.c
index 6775f6362b8..da70d847176 100644
--- a/source/blender/editors/interface/interface_panel.c
+++ b/source/blender/editors/interface/interface_panel.c
@@ -932,8 +932,7 @@ int uiAlignPanelStep(ScrArea *sa, ARegion *ar, float fac)
if(align==BUT_VERTICAL)
ps->pa->ofsy= -ps->pa->sizey-PNL_HEADER-PNL_DIST;
else
- ps->pa->ofsy= 0;
-
+ ps->pa->ofsy= -ps->pa->sizey-PNL_HEADER-PNL_DIST; // XXX was 0;
for(a=0 ; a<tot-1; a++, ps++) {
psnext= ps+1;
diff --git a/source/blender/editors/interface/interface_utils.c b/source/blender/editors/interface/interface_utils.c
index 58563166847..456eae1463d 100644
--- a/source/blender/editors/interface/interface_utils.c
+++ b/source/blender/editors/interface/interface_utils.c
@@ -217,7 +217,7 @@ int UI_GetIconRNA(PointerRNA *ptr)
return ICON_DOT;
}
-uiBut *uiDefAutoButR(uiBlock *block, PointerRNA *ptr, PropertyRNA *prop, int index, char *name, int x1, int y1, int x2, int y2)
+uiBut *uiDefAutoButR(uiBlock *block, PointerRNA *ptr, PropertyRNA *prop, int index, char *name, int icon, int x1, int y1, int x2, int y2)
{
uiBut *but=NULL;
const char *propname= RNA_property_identifier(ptr, prop);
@@ -237,10 +237,12 @@ uiBut *uiDefAutoButR(uiBlock *block, PointerRNA *ptr, PropertyRNA *prop, int ind
else
value= RNA_property_boolean_get(ptr, prop);
- if(name && strcmp(name, "") == 0)
- name= (value)? "Enabled": "Disabled";
-
- but= uiDefButR(block, TOG, 0, name, x1, y1, x2, y2, ptr, propname, index, 0, 0, -1, -1, NULL);
+ if(icon && name && strcmp(name, "") == 0)
+ but= uiDefIconButR(block, ICONTOG, 0, icon, x1, y1, x2, y2, ptr, propname, index, 0, 0, -1, -1, NULL);
+ else if(icon)
+ but= uiDefIconTextButR(block, ICONTOG, 0, icon, name, x1, y1, x2, y2, ptr, propname, index, 0, 0, -1, -1, NULL);
+ else
+ but= uiDefButR(block, TOG, 0, name, x1, y1, x2, y2, ptr, propname, index, 0, 0, -1, -1, NULL);
break;
}
case PROP_INT:
@@ -267,24 +269,29 @@ uiBut *uiDefAutoButR(uiBlock *block, PointerRNA *ptr, PropertyRNA *prop, int ind
int icon;
pptr= RNA_property_pointer_get(ptr, prop);
+ descr= (char*)RNA_property_ui_description(ptr, prop);
- if(!pptr.data)
- return NULL;
+ if(!pptr.type)
+ pptr.type= RNA_property_pointer_type(ptr, prop);
icon= UI_GetIconRNA(&pptr);
- nameprop= RNA_struct_name_property(&pptr);
-
- if(nameprop) {
- text= RNA_property_string_get_alloc(&pptr, nameprop, textbuf, sizeof(textbuf));
- descr= (char*)RNA_property_ui_description(&pptr, prop);
- but= uiDefIconTextBut(block, LABEL, 0, icon, text, x1, y1, x2, y2, NULL, 0, 0, 0, 0, descr);
- if(text != textbuf)
- MEM_freeN(text);
+
+ if(pptr.data == NULL) {
+ but= uiDefIconTextBut(block, LABEL, 0, icon, "", x1, y1, x2, y2, NULL, 0, 0, 0, 0, "");
}
else {
- text= (char*)RNA_struct_ui_name(&pptr);
- descr= (char*)RNA_property_ui_description(&pptr, prop);
- but= uiDefIconTextBut(block, LABEL, 0, icon, text, x1, y1, x2, y2, NULL, 0, 0, 0, 0, descr);
+ nameprop= RNA_struct_name_property(&pptr);
+
+ if(nameprop) {
+ text= RNA_property_string_get_alloc(&pptr, nameprop, textbuf, sizeof(textbuf));
+ but= uiDefIconTextBut(block, LABEL, 0, icon, text, x1, y1, x2, y2, NULL, 0, 0, 0, 0, descr);
+ if(text != textbuf)
+ MEM_freeN(text);
+ }
+ else {
+ text= (char*)RNA_struct_ui_name(&pptr);
+ but= uiDefIconTextBut(block, LABEL, 0, icon, text, x1, y1, x2, y2, NULL, 0, 0, 0, 0, descr);
+ }
}
break;
}
@@ -338,8 +345,10 @@ int uiDefAutoButsRNA(uiBlock *block, PointerRNA *ptr)
subtype= RNA_property_subtype(ptr, prop);
- name= (char*)RNA_property_ui_name(ptr, prop);
- uiDefBut(block, LABEL, 0, name, x, y, DEF_BUT_WIDTH, DEF_BUT_HEIGHT-1, NULL, 0, 0, 0, 0, "");
+ if(RNA_property_type(ptr, prop) != PROP_BOOLEAN) {
+ name= (char*)RNA_property_ui_name(ptr, prop);
+ uiDefBut(block, LABEL, 0, name, x, y, DEF_BUT_WIDTH, DEF_BUT_HEIGHT-1, NULL, 0, 0, 0, 0, "");
+ }
uiBlockBeginAlign(block);
@@ -355,7 +364,7 @@ int uiDefAutoButsRNA(uiBlock *block, PointerRNA *ptr)
col= a%size;
row= a/size;
- uiDefAutoButR(block, ptr, prop, a, "", x+butwidth*col, y-row*DEF_BUT_HEIGHT, butwidth, DEF_BUT_HEIGHT-1);
+ uiDefAutoButR(block, ptr, prop, a, "", 0, x+butwidth*col, y-row*DEF_BUT_HEIGHT, butwidth, DEF_BUT_HEIGHT-1);
}
y -= DEF_BUT_HEIGHT*(length/size);
@@ -377,7 +386,7 @@ int uiDefAutoButsRNA(uiBlock *block, PointerRNA *ptr)
else
name= coloritem[a];
- uiDefAutoButR(block, ptr, prop, a, name, x+butwidth*a, y, butwidth, DEF_BUT_HEIGHT-1);
+ uiDefAutoButR(block, ptr, prop, a, name, 0, x+butwidth*a, y, butwidth, DEF_BUT_HEIGHT-1);
}
y -= DEF_BUT_HEIGHT;
}
@@ -386,10 +395,12 @@ int uiDefAutoButsRNA(uiBlock *block, PointerRNA *ptr)
sprintf(namebuf, "%d:", a+1);
name= namebuf;
}
+ else if(RNA_property_type(ptr, prop) == PROP_BOOLEAN)
+ name= (char*)RNA_property_ui_name(ptr, prop);
else
name= "";
- uiDefAutoButR(block, ptr, prop, 0, name, x+DEF_BUT_WIDTH, y, DEF_BUT_WIDTH, DEF_BUT_HEIGHT-1);
+ uiDefAutoButR(block, ptr, prop, 0, name, 0, x+DEF_BUT_WIDTH, y, DEF_BUT_WIDTH, DEF_BUT_HEIGHT-1);
y -= DEF_BUT_HEIGHT;
}
diff --git a/source/blender/editors/interface/view2d.c b/source/blender/editors/interface/view2d.c
index 6e738942e29..d81d9eb79ca 100644
--- a/source/blender/editors/interface/view2d.c
+++ b/source/blender/editors/interface/view2d.c
@@ -249,9 +249,30 @@ void UI_view2d_region_reinit(View2D *v2d, short type, int winx, int winy)
v2d->tot.ymin= -336.0f*((float)winy)/(float)winx;
v2d->cur= v2d->tot;
+ }
+ break;
+
+ /* panels view, with free/horizontal/vertical align */
+ case V2D_COMMONVIEW_PANELS_UI:
+ {
+ /* for now, aspect ratio should be maintained, and zoom is clamped within sane default limits */
+ v2d->keepzoom= (V2D_LOCKZOOM_X|V2D_LOCKZOOM_Y|V2D_KEEPASPECT|V2D_KEEPZOOM);
+ v2d->minzoom= 0.5f;
+ v2d->maxzoom= 2.0f;
+
+ v2d->align= (V2D_ALIGN_NO_NEG_X|V2D_ALIGN_NO_POS_Y);
+ v2d->keeptot= V2D_KEEPTOT_BOUNDS;
+ v2d->tot.xmin= 0.0f;
+ v2d->tot.xmax= winx;
+
+ v2d->tot.ymax= 0.0f;
+ v2d->tot.ymin= -winy;
+
+ v2d->cur= v2d->tot;
}
break;
+
/* other view types are completely defined using their own settings already */
default:
/* we don't do anything here, as settings should be fine, but just make sure that rect */
diff --git a/source/blender/editors/space_buttons/buttons_header.c b/source/blender/editors/space_buttons/buttons_header.c
index 515083c9fec..40e3564e69b 100644
--- a/source/blender/editors/space_buttons/buttons_header.c
+++ b/source/blender/editors/space_buttons/buttons_header.c
@@ -62,22 +62,44 @@
static void do_viewmenu(bContext *C, void *arg, int event)
{
-
+ SpaceButs *sbuts= (SpaceButs*)CTX_wm_space_data(C);
+ ScrArea *sa= CTX_wm_area(C);
+
+ switch(event) {
+ case 0: /* panel alignment */
+ case 1:
+ case 2:
+ sbuts->align= event;
+ if(event) {
+ sbuts->re_align= 1;
+ // uiAlignPanelStep(sa, 1.0);
+ }
+ break;
+ }
+
+ ED_area_tag_redraw(sa);
}
static uiBlock *dummy_viewmenu(bContext *C, ARegion *ar, void *arg_unused)
{
- ScrArea *curarea= CTX_wm_area(C);
+ SpaceButs *sbuts= (SpaceButs*)CTX_wm_space_data(C);
+ ScrArea *sa= CTX_wm_area(C);
uiBlock *block;
short yco= 0, menuwidth=120;
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,
- menuwidth, 19, NULL, 0.0, 0.0, 1, 3, "");
-
- if(curarea->headertype==HEADERTOP) {
+ if (sbuts->align == 1) uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_HLT, "Horizontal", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 1, "");
+ else uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_DEHLT, "Horizontal", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 1, "");
+
+ if (sbuts->align == 2) uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_HLT, "Vertical", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 2, "");
+ else uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_DEHLT, "Vertical", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 2, "");
+
+ if (sbuts->align == 0) uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_HLT, "Free", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 0, "");
+ else uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_DEHLT, "Free", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 0, "");
+
+ if(sa->headertype==HEADERTOP) {
uiBlockSetDirection(block, UI_DOWN);
}
else {
diff --git a/source/blender/editors/space_buttons/buttons_intern.h b/source/blender/editors/space_buttons/buttons_intern.h
index ffc325e59ab..17c4e39ddd6 100644
--- a/source/blender/editors/space_buttons/buttons_intern.h
+++ b/source/blender/editors/space_buttons/buttons_intern.h
@@ -75,6 +75,7 @@
/* image_header.c */
void buttons_header_buttons(const bContext *C, ARegion *ar);
void buttons_scene(const bContext *C, ARegion *ar);
+void buttons_object(const bContext *C, ARegion *ar);
#endif /* ED_BUTTONS_INTERN_H */
diff --git a/source/blender/editors/space_buttons/buttons_object.c b/source/blender/editors/space_buttons/buttons_object.c
new file mode 100644
index 00000000000..bb7bf346808
--- /dev/null
+++ b/source/blender/editors/space_buttons/buttons_object.c
@@ -0,0 +1,179 @@
+/**
+ * $Id$
+ *
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
+ * All rights reserved.
+ *
+ * The Original Code is: all of this file.
+ *
+ * Contributor(s): none yet.
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "DNA_group_types.h"
+#include "DNA_object_types.h"
+#include "DNA_screen_types.h"
+#include "DNA_space_types.h"
+
+#include "BKE_context.h"
+#include "BKE_group.h"
+#include "BKE_main.h"
+
+#include "UI_interface.h"
+#include "UI_resources.h"
+
+#include "RNA_access.h"
+
+#include "WM_types.h"
+
+static void object_panel_transform(const bContext *C, uiLayout *layout)
+{
+ Object *ob= CTX_data_active_object(C);
+ PointerRNA obptr;
+
+ RNA_id_pointer_create(&ob->id, &obptr);
+
+ uiTemplateColumn(layout);
+ uiItemR(layout, UI_TSLOT_COLUMN_1, NULL, 0, &obptr, "location");
+ uiItemR(layout, UI_TSLOT_COLUMN_2, NULL, 0, &obptr, "rotation");
+ uiItemR(layout, UI_TSLOT_COLUMN_3, NULL, 0, &obptr, "scale");
+}
+
+static void object_panel_groups(const bContext *C, uiLayout *layout)
+{
+ Main *bmain= CTX_data_main(C);
+ Object *ob= CTX_data_active_object(C);
+ Group *group;
+ PointerRNA obptr, groupptr;
+ uiLayout *sublayout;
+
+ RNA_id_pointer_create(&ob->id, &obptr);
+
+ uiTemplateColumn(layout);
+ uiItemR(layout, UI_TSLOT_COLUMN_1, NULL, 0, &obptr, "pass_index");
+ uiItemR(layout, UI_TSLOT_COLUMN_2, NULL, 0, &obptr, "parent");
+
+ /* uiTemplateLeftRight(layout);
+ uiItemO(layout, UI_TSLOT_LR_LEFT, NULL, 0, "OBJECT_OT_add_group"); */
+
+ for(group=bmain->group.first; group; group=group->id.next) {
+ if(object_in_group(ob, group)) {
+ RNA_id_pointer_create(&group->id, &groupptr);
+
+ sublayout= uiTemplateStack(layout);
+
+ uiTemplateLeftRight(sublayout);
+ uiItemR(sublayout, UI_TSLOT_LR_LEFT, NULL, 0, &groupptr, "name");
+ // uiItemO(sublayout, UI_TSLOT_LR_RIGHT, "", ICON_X, "OBJECT_OT_remove_group");
+
+ uiTemplateColumn(sublayout);
+ uiItemR(sublayout, UI_TSLOT_COLUMN_1, NULL, 0, &groupptr, "layer");
+ uiItemR(sublayout, UI_TSLOT_COLUMN_2, NULL, 0, &groupptr, "dupli_offset");
+ }
+ }
+}
+
+static void object_panel_display(const bContext *C, uiLayout *layout)
+{
+ Object *ob= CTX_data_active_object(C);
+ PointerRNA obptr;
+
+ RNA_id_pointer_create(&ob->id, &obptr);
+
+ uiTemplateColumn(layout);
+ uiItemR(layout, UI_TSLOT_COLUMN_1, "Type", 0, &obptr, "max_draw_type");
+ uiItemR(layout, UI_TSLOT_COLUMN_2, "Bounds", 0, &obptr, "draw_bounds_type");
+
+ uiTemplateColumn(layout);
+ uiItemLabel(layout, UI_TSLOT_COLUMN_1, "Extra", 0);
+ uiItemR(layout, UI_TSLOT_COLUMN_1, "Name", 0, &obptr, "draw_name");
+ uiItemR(layout, UI_TSLOT_COLUMN_1, "Axis", 0, &obptr, "draw_axis");
+ uiItemR(layout, UI_TSLOT_COLUMN_1, "Wire", 0, &obptr, "draw_wire");
+ uiItemLabel(layout, UI_TSLOT_COLUMN_2, "", 0);
+ uiItemR(layout, UI_TSLOT_COLUMN_2, "Texture Space", 0, &obptr, "draw_texture_space");
+ uiItemR(layout, UI_TSLOT_COLUMN_2, "X-Ray", 0, &obptr, "x_ray");
+ uiItemR(layout, UI_TSLOT_COLUMN_2, "Transparency", 0, &obptr, "draw_transparent");
+}
+
+static void object_panel_duplication(const bContext *C, uiLayout *layout)
+{
+ Object *ob= CTX_data_active_object(C);
+ PointerRNA obptr;
+
+ RNA_id_pointer_create(&ob->id, &obptr);
+
+ uiTemplateColumn(layout);
+ uiItemR(layout, UI_TSLOT_COLUMN_1, "Frames", 0, &obptr, "dupli_frames");
+ uiItemR(layout, UI_TSLOT_COLUMN_2, "Verts", 0, &obptr, "dupli_verts");
+ uiItemR(layout, UI_TSLOT_COLUMN_3, "Faces", 0, &obptr, "dupli_faces");
+ uiItemR(layout, UI_TSLOT_COLUMN_4, "Group", 0, &obptr, "use_dupli_group");
+
+ if(RNA_boolean_get(&obptr, "dupli_frames")) {
+ uiTemplateColumn(layout);
+ uiItemR(layout, UI_TSLOT_COLUMN_1, "Start:", 0, &obptr, "dupli_frames_start");
+ uiItemR(layout, UI_TSLOT_COLUMN_1, "End:", 0, &obptr, "dupli_frames_end");
+
+ uiItemR(layout, UI_TSLOT_COLUMN_2, "On:", 0, &obptr, "dupli_frames_on");
+ uiItemR(layout, UI_TSLOT_COLUMN_2, "Off:", 0, &obptr, "dupli_frames_off");
+ }
+}
+
+static void object_panel_animation(const bContext *C, uiLayout *layout)
+{
+ Object *ob= CTX_data_active_object(C);
+ PointerRNA obptr;
+
+ RNA_id_pointer_create(&ob->id, &obptr);
+
+ uiTemplateColumn(layout);
+ uiItemLabel(layout, UI_TSLOT_COLUMN_1, "Time Offset:", 0);
+ uiItemR(layout, UI_TSLOT_COLUMN_1, "Edit", 0, &obptr, "time_offset_edit");
+ uiItemR(layout, UI_TSLOT_COLUMN_1, "Particle", 0, &obptr, "time_offset_particle");
+ uiItemR(layout, UI_TSLOT_COLUMN_1, "Parent", 0, &obptr, "time_offset_parent");
+ uiItemR(layout, UI_TSLOT_COLUMN_1, NULL, 0, &obptr, "slow_parent");
+ uiItemR(layout, UI_TSLOT_COLUMN_1, "Offset: ", 0, &obptr, "time_offset");
+
+ uiItemLabel(layout, UI_TSLOT_COLUMN_2, "Tracking:", 0);
+ uiItemR(layout, UI_TSLOT_COLUMN_2, "Axis: ", 0, &obptr, "track_axis");
+ uiItemR(layout, UI_TSLOT_COLUMN_2, "Up Axis: ", 0, &obptr, "up_axis");
+ uiItemR(layout, UI_TSLOT_COLUMN_2, "Rotation", 0, &obptr, "track_rotation");
+}
+
+void buttons_object(const bContext *C, ARegion *ar)
+{
+ SpaceButs *sbuts= (SpaceButs*)CTX_wm_space_data(C);
+ Object *ob= CTX_data_active_object(C);
+ int tab= sbuts->tab[CONTEXT_OBJECT];
+
+ if(tab == TAB_OBJECT_OBJECT) {
+ if(!ob)
+ return;
+
+ uiPanelLayout(C, ar, "OBJECT_PT_transform", "Transform", "Object", object_panel_transform, 0);
+ uiPanelLayout(C, ar, "OBJECT_PT_groups", "Groups", "Object", object_panel_groups, 1);
+ uiPanelLayout(C, ar, "OBJECT_PT_display", "Display", "Object", object_panel_display, 2);
+ uiPanelLayout(C, ar, "OBJECT_PT_duplication", "Duplication", "Object", object_panel_duplication, 3);
+ uiPanelLayout(C, ar, "OBJECT_PT_animation", "Animation", "Object", object_panel_animation, 4);
+ }
+}
+
diff --git a/source/blender/editors/space_buttons/space_buttons.c b/source/blender/editors/space_buttons/space_buttons.c
index f2134af7424..1bc57b38abe 100644
--- a/source/blender/editors/space_buttons/space_buttons.c
+++ b/source/blender/editors/space_buttons/space_buttons.c
@@ -141,14 +141,12 @@ static SpaceLink *buttons_duplicate(SpaceLink *sl)
return (SpaceLink *)sbutsn;
}
-
-
/* add handlers, stuff you only do once or on area/region changes */
static void buttons_main_area_init(wmWindowManager *wm, ARegion *ar)
{
ListBase *keymap;
-
- UI_view2d_region_reinit(&ar->v2d, V2D_COMMONVIEW_STANDARD, ar->winx, ar->winy);
+
+ UI_view2d_region_reinit(&ar->v2d, V2D_COMMONVIEW_PANELS_UI, ar->winx, ar->winy);
/* own keymap */
keymap= WM_keymap_listbase(wm, "Buttons", SPACE_BUTS, 0); /* XXX weak? */
@@ -169,7 +167,7 @@ static void buttons_main_area_draw(const bContext *C, ARegion *ar)
glClear(GL_COLOR_BUFFER_BIT);
UI_view2d_view_ortho(C, v2d);
-
+
/* swapbuffers indicator */
fac= BLI_frand();
glColor3f(fac, fac, fac);
@@ -178,12 +176,14 @@ static void buttons_main_area_draw(const bContext *C, ARegion *ar)
/* panels */
if(sbuts->mainb == CONTEXT_SCENE)
buttons_scene(C, ar);
+ else if(sbuts->mainb == CONTEXT_OBJECT)
+ buttons_object(C, ar);
if(sbuts->align)
if(sbuts->re_align || sbuts->mainbo!=sbuts->mainb || sbuts->tabo!=sbuts->tab[sbuts->mainb])
align= 1;
- uiDrawPanels(C, align);
+ uiDrawPanels(C, 1); // XXX align);
uiMatchPanelsView2d(ar);
/* reset view matrix */
diff --git a/source/blender/editors/space_image/image_draw.c b/source/blender/editors/space_image/image_draw.c
index 1b7a96459ff..ab042fce41f 100644
--- a/source/blender/editors/space_image/image_draw.c
+++ b/source/blender/editors/space_image/image_draw.c
@@ -144,7 +144,7 @@ static void draw_render_info(SpaceImage *sima, ARegion *ar)
/* clear header rect */
UI_GetThemeColor3fv(TH_BACK, colf);
glColor3f(colf[0]+0.1f, colf[1]+0.1f, colf[2]+0.1f);
- glRecti(rect.xmin, rect.ymin, rect.xmax, rect.ymax);
+ glRecti(rect.xmin, rect.ymin, rect.xmax, rect.ymax+1);
UI_ThemeColor(TH_TEXT_HI);
glRasterPos2i(12, rect.ymin + 5);
diff --git a/source/blender/editors/space_outliner/outliner.c b/source/blender/editors/space_outliner/outliner.c
index 220fd7b8dc8..389878f7b6c 100644
--- a/source/blender/editors/space_outliner/outliner.c
+++ b/source/blender/editors/space_outliner/outliner.c
@@ -4204,13 +4204,13 @@ static void outliner_draw_rnabuts(uiBlock *block, Scene *scene, ARegion *ar, Spa
prop= te->directdata;
if(!(RNA_property_type(ptr, prop) == PROP_POINTER && (tselem->flag & TSE_CLOSED)==0))
- uiDefAutoButR(block, ptr, prop, -1, "", sizex, (int)te->ys, OL_RNA_COL_SIZEX, OL_H-1);
+ uiDefAutoButR(block, ptr, prop, -1, "", 0, sizex, (int)te->ys, OL_RNA_COL_SIZEX, OL_H-1);
}
else if(tselem->type == TSE_RNA_ARRAY_ELEM) {
ptr= &te->rnaptr;
prop= te->directdata;
- uiDefAutoButR(block, ptr, prop, te->index, "", sizex, (int)te->ys, OL_RNA_COL_SIZEX, OL_H-1);
+ uiDefAutoButR(block, ptr, prop, te->index, "", 0, sizex, (int)te->ys, OL_RNA_COL_SIZEX, OL_H-1);
}
}
diff --git a/source/blender/editors/space_text/space_text.c b/source/blender/editors/space_text/space_text.c
index 160b93d185e..a854ebe72d9 100644
--- a/source/blender/editors/space_text/space_text.c
+++ b/source/blender/editors/space_text/space_text.c
@@ -74,7 +74,6 @@ static SpaceLink *text_new(const bContext *C)
stext= MEM_callocN(sizeof(SpaceText), "inittext");
stext->spacetype= SPACE_TEXT;
- stext->font_id= 5;
stext->lheight= 12;
stext->tabnumber= 4;
@@ -185,7 +184,8 @@ static void text_operatortypes(void)
WM_operatortype_append(TEXT_OT_line_break);
WM_operatortype_append(TEXT_OT_insert);
- WM_operatortype_append(TEXT_OT_find_and_replace);
+ WM_operatortype_append(TEXT_OT_properties);
+
WM_operatortype_append(TEXT_OT_find);
WM_operatortype_append(TEXT_OT_find_set_selected);
WM_operatortype_append(TEXT_OT_replace);
@@ -220,8 +220,8 @@ static void text_keymap(struct wmWindowManager *wm)
WM_keymap_add_item(keymap, "TEXT_OT_jump", JKEY, KM_PRESS, KM_ALT, 0);
WM_keymap_add_item(keymap, "TEXT_OT_find", FKEY, KM_PRESS, KM_ALT, 0);
- WM_keymap_add_item(keymap, "TEXT_OT_find_and_replace", FKEY, KM_PRESS, KM_ALT, 0);
- WM_keymap_add_item(keymap, "TEXT_OT_find_and_replace", FKEY, KM_PRESS, KM_CTRL, 0);
+ WM_keymap_add_item(keymap, "TEXT_OT_properties", FKEY, KM_PRESS, KM_ALT, 0);
+ WM_keymap_add_item(keymap, "TEXT_OT_properties", FKEY, KM_PRESS, KM_CTRL, 0);
WM_keymap_add_item(keymap, "TEXT_OT_replace", HKEY, KM_PRESS, KM_ALT, 0);
WM_keymap_add_item(keymap, "TEXT_OT_replace", HKEY, KM_PRESS, KM_CTRL, 0);
@@ -368,31 +368,27 @@ static void text_header_area_draw(const bContext *C, ARegion *ar)
UI_view2d_view_restore(C);
}
-/****************** find & replace region ******************/
+/****************** properties region ******************/
/* add handlers, stuff you only do once or on area/region changes */
-static void text_find_area_init(wmWindowManager *wm, ARegion *ar)
+static void text_properties_area_init(wmWindowManager *wm, ARegion *ar)
{
- UI_view2d_region_reinit(&ar->v2d, V2D_COMMONVIEW_HEADER, ar->winx, ar->winy);
+ UI_view2d_region_reinit(&ar->v2d, V2D_COMMONVIEW_PANELS_UI, ar->winx, ar->winy);
}
-static void text_find_area_draw(const bContext *C, ARegion *ar)
+static void text_properties_area_draw(const bContext *C, ARegion *ar)
{
float col[3];
/* clear */
- if(ED_screen_area_active(C))
- UI_GetThemeColor3fv(TH_HEADER, col);
- else
- UI_GetThemeColor3fv(TH_HEADERDESEL, col);
-
+ UI_GetThemeColor3fv(TH_HEADER, col);
glClearColor(col[0], col[1], col[2], 0.0);
glClear(GL_COLOR_BUFFER_BIT);
/* set view2d view matrix for scrolling (without scrollers) */
UI_view2d_view_ortho(C, &ar->v2d);
- text_find_buttons(C, ar);
+ text_properties_buttons(C, ar);
/* restore view matrix? */
UI_view2d_view_restore(C);
@@ -437,14 +433,14 @@ void ED_spacetype_text(void)
BLI_addhead(&st->regiontypes, art);
- /* regions: find & replace */
+ /* regions: properties */
art= MEM_callocN(sizeof(ARegionType), "spacetype text region");
art->regionid = RGN_TYPE_UI;
- art->minsizey= HEADERY;
+ art->minsizex= UI_COMPACT_PANEL_WIDTH;
art->keymapflag= ED_KEYMAP_UI|ED_KEYMAP_VIEW2D;
- art->init= text_find_area_init;
- art->draw= text_find_area_draw;
+ art->init= text_properties_area_init;
+ art->draw= text_properties_area_draw;
BLI_addhead(&st->regiontypes, art);
diff --git a/source/blender/editors/space_text/text_header.c b/source/blender/editors/space_text/text_header.c
index ea0005fd716..bb9ef5899b3 100644
--- a/source/blender/editors/space_text/text_header.c
+++ b/source/blender/editors/space_text/text_header.c
@@ -215,7 +215,7 @@ static void text_editmenu(bContext *C, uiMenuItem *head, void *arg_unused)
uiMenuSeparator(head);
uiMenuItemO(head, 0, "TEXT_OT_jump");
- uiMenuItemO(head, 0, "TEXT_OT_find_and_replace");
+ uiMenuItemO(head, 0, "TEXT_OT_properties");
uiMenuSeparator(head);
@@ -353,85 +353,38 @@ static void text_idpoin_handle(bContext *C, ID *id, int event)
/********************** header buttons ***********************/
-void text_header_buttons(const bContext *C, ARegion *ar)
+static void header_buttons(const bContext *C, uiLayout *layout)
{
bScreen *sc= CTX_wm_screen(C);
SpaceText *st= (SpaceText*)CTX_wm_space_data(C);
PointerRNA spaceptr;
Text *text= st->text;
- ScrArea *sa= CTX_wm_area(C);
- uiBlock *block;
- int xco, yco= 3, xmax, oldcol;
RNA_pointer_create(&sc->id, &RNA_SpaceTextEditor, st, &spaceptr);
- block= uiBeginBlock(C, ar, "header buttons", UI_EMBOSS, UI_HELV);
-
- xco= ED_area_header_standardbuttons(C, block, yco);
-
- if((sa->flag & HEADER_NO_PULLDOWN)==0) {
- /* pull down menus */
- uiBlockSetEmboss(block, UI_EMBOSSP);
-
- xmax= GetButStringLength("Text");
- uiDefMenuBut(block, text_filemenu, NULL, "Text", xco, yco-2, xmax-3, 24, "");
- xco+=xmax;
-
- if(text) {
- xmax= GetButStringLength("Edit");
- uiDefMenuBut(block, text_editmenu, NULL, "Edit", xco, yco-2, xmax-3, 24, "");
- xco+=xmax;
-
- xmax= GetButStringLength("Format");
- uiDefMenuBut(block, text_formatmenu, NULL, "Format", xco, yco-2, xmax-3, 24, "");
- xco+=xmax;
- }
+ uiTemplateHeaderMenus(layout);
+ uiItemMenu(layout, UI_TSLOT_HEADER, "Text", 0, text_filemenu);
+ if(text) {
+ uiItemMenu(layout, UI_TSLOT_HEADER, "Edit", 0, text_editmenu);
+ uiItemMenu(layout, UI_TSLOT_HEADER, "Format", 0, text_formatmenu);
}
-
- uiBlockSetEmboss(block, UI_EMBOSS);
-
- uiBlockBeginAlign(block);
- uiDefIconButR(block, ICONTOG, 0, ICON_LINENUMBERS_OFF, xco, yco,XIC,YIC, &spaceptr, "line_numbers", 0, 0, 0, 0, 0, NULL);
- uiDefIconButR(block, ICONTOG, 0, ICON_WORDWRAP_OFF, xco+=XIC, yco,XIC,YIC, &spaceptr, "word_wrap", 0, 0, 0, 0, 0, NULL);
- uiDefIconButR(block, ICONTOG, 0, ICON_SYNTAX_OFF, xco+=XIC, yco,XIC,YIC, &spaceptr, "syntax_highlight", 0, 0, 0, 0, 0, NULL);
- // uiDefIconButR(block, ICONTOG, 0, ICON_SCRIPTPLUGINS, xco+=XIC, yco,XIC,YIC, &spaceptr, "do_python_plugins", 0, 0, 0, 0, 0, "Enables Python text plugins");
- uiBlockEndAlign(block);
-
+
/* warning button if text is out of date */
if(text && text_file_modified(text)) {
- xco+= XIC;
-
- oldcol= uiBlockGetCol(block);
- uiBlockSetCol(block, TH_REDALERT);
- uiDefIconButO(block, BUT, "TEXT_OT_resolve_conflict", WM_OP_INVOKE_DEFAULT, ICON_HELP, xco+=XIC,yco,XIC,YIC, "External text is out of sync, click for options to resolve the conflict");
- uiBlockSetCol(block, oldcol);
- }
-
- /* browse text datablock */
- xco+= 2*XIC;
- xco= uiDefIDPoinButs(block, CTX_data_main(C), NULL, (ID*)st->text, ID_TXT, NULL, xco, yco,
- text_idpoin_handle, UI_ID_BROWSE|UI_ID_RENAME|UI_ID_ADD_NEW|UI_ID_OPEN|UI_ID_DELETE);
- xco+=XIC;
-
- /*
- if(st->text) {
- if(st->text->flags & TXT_ISDIRTY && (st->text->flags & TXT_ISEXT || !(st->text->flags & TXT_ISMEM)))
- uiDefIconBut(block, BUT,0, ICON_ERROR, xco+=XIC,yco,XIC,YIC, 0, 0, 0, 0, 0, "The text has been changed");
- if(st->text->flags & TXT_ISEXT)
- uiDefBut(block, BUT,B_TEXTSTORE, ICON(), xco+=XIC,yco,XIC,YIC, 0, 0, 0, 0, 0, "Stores text in project file");
- else
- uiDefBut(block, BUT,B_TEXTSTORE, ICON(), xco+=XIC,yco,XIC,YIC, 0, 0, 0, 0, 0, "Disables storing of text in project file");
- xco+=10;
+ uiTemplateHeaderButtons(layout);
+ uiTemplateSetColor(layout, TH_REDALERT);
+ uiItemO(layout, UI_TSLOT_HEADER, "", ICON_HELP, "TEXT_OT_resolve_conflict");
}
- */
-
- /* display settings */
- if(st->font_id>1) st->font_id= 0;
- uiDefButR(block, MENU, 0, NULL, xco,yco,100,YIC, &spaceptr, "font_size", 0, 0, 0, 0, 0, NULL);
- xco+=105;
-
- uiDefButR(block, NUM, 0, "Tab:", xco,yco,XIC+50,YIC, &spaceptr, "tab_width", 0, 0, 0, 0, 0, NULL);
- xco+= XIC+50;
+
+ uiTemplateHeaderButtons(layout);
+ uiItemR(layout, UI_TSLOT_HEADER, "", ICON_LINENUMBERS_OFF, &spaceptr, "line_numbers");
+ uiItemR(layout, UI_TSLOT_HEADER, "", ICON_WORDWRAP_OFF, &spaceptr, "word_wrap");
+ uiItemR(layout, UI_TSLOT_HEADER, "", ICON_SYNTAX_OFF, &spaceptr, "syntax_highlight");
+ // XXX uiItemR(layout, "", ICON_SCRIPTPLUGINS, &spaceptr, "do_python_plugins");
+
+ uiTemplateHeaderID(layout, &spaceptr, "text",
+ UI_ID_BROWSE|UI_ID_RENAME|UI_ID_ADD_NEW|UI_ID_OPEN|UI_ID_DELETE,
+ text_idpoin_handle);
/* file info */
if(text) {
@@ -452,74 +405,78 @@ void text_header_buttons(const bContext *C, ARegion *ar)
else
sprintf(headtxt, text->id.lib? "Text: External": "Text: Internal");
- UI_ThemeColor(TH_MENU_TEXT);
- UI_RasterPos(xco+=XIC, yco+6);
-
- UI_DrawString(G.font, headtxt, 0);
- xco += UI_GetStringWidth(G.font, headtxt, 0);
+ uiTemplateHeaderButtons(layout);
+ uiItemLabel(layout, UI_TSLOT_HEADER, headtxt, 0);
}
+}
- uiEndBlock(C, block);
- uiDrawBlock(C, block);
-
- /* always as last */
- UI_view2d_totRect_set(&ar->v2d, xco+XIC+80, ar->v2d.tot.ymax-ar->v2d.tot.ymin);
+void text_header_buttons(const bContext *C, ARegion *ar)
+{
+ uiHeaderLayout(C, ar, header_buttons);
}
-/************************* find & replace ***************************/
+/************************** properties ******************************/
-void text_find_buttons(const bContext *C, ARegion *ar)
+void properties_buttons(const bContext *C, uiLayout *layout)
{
bScreen *sc= CTX_wm_screen(C);
SpaceText *st= CTX_wm_space_text(C);
PointerRNA spaceptr;
- uiBlock *block;
- int xco= 5, yco= 3;
RNA_pointer_create(&sc->id, &RNA_SpaceTextEditor, st, &spaceptr);
- block= uiBeginBlock(C, ar, "find buttons", UI_EMBOSS, UI_HELV);
+ uiTemplateColumn(layout);
+ uiItemR(layout, UI_TSLOT_COLUMN_1, NULL, ICON_LINENUMBERS_OFF, &spaceptr, "line_numbers");
+ uiItemR(layout, UI_TSLOT_COLUMN_1, NULL, ICON_WORDWRAP_OFF, &spaceptr, "word_wrap");
+ uiItemR(layout, UI_TSLOT_COLUMN_1, NULL, ICON_SYNTAX_OFF, &spaceptr, "syntax_highlight");
+
+ uiTemplateColumn(layout);
+ uiItemR(layout, UI_TSLOT_COLUMN_1, NULL, 0, &spaceptr, "font_size");
+ uiItemR(layout, UI_TSLOT_COLUMN_1, NULL, 0, &spaceptr, "tab_width");
+}
+
+void find_buttons(const bContext *C, uiLayout *layout)
+{
+ bScreen *sc= CTX_wm_screen(C);
+ SpaceText *st= CTX_wm_space_text(C);
+ PointerRNA spaceptr;
+
+ RNA_pointer_create(&sc->id, &RNA_SpaceTextEditor, st, &spaceptr);
/* find */
- uiBlockBeginAlign(block);
- uiDefButR(block, TEX, 0, "Find: ", xco, yco,220,20, &spaceptr, "find_text", 0, 0, 0, 0, 0, NULL);
- xco += 220;
- uiDefIconButO(block, BUT, "TEXT_OT_find_set_selected", WM_OP_INVOKE_DEFAULT, ICON_TEXT, xco,yco,20,20, "Copy from selection");
- xco += 20+XIC;
- uiBlockEndAlign(block);
+ uiTemplateLeftRight(layout);
+ uiItemR(layout, UI_TSLOT_LR_LEFT, "", 0, &spaceptr, "find_text");
+ uiItemO(layout, UI_TSLOT_LR_RIGHT, "", ICON_TEXT, "TEXT_OT_find_set_selected");
+ uiTemplateColumn(layout);
+ uiItemO(layout, UI_TSLOT_COLUMN_1, NULL, 0, "TEXT_OT_find");
/* replace */
- uiBlockBeginAlign(block);
- uiDefButR(block, TEX, 0, "Replace: ", xco, yco,220,20, &spaceptr, "replace_text", 0, 0, 0, 0, 0, NULL);
- xco += 220;
- uiDefIconButO(block, BUT, "TEXT_OT_replace_set_selected", WM_OP_INVOKE_DEFAULT, ICON_TEXT, xco,yco,20,20, "Copy from selection");
- xco += 20+XIC;
- uiBlockEndAlign(block);
-
- uiBlockBeginAlign(block);
- uiDefButR(block, TOG, 0, "Wrap", xco, yco,60,20, &spaceptr, "find_wrap", 0, 0, 0, 0, 0, NULL);
- xco += 60;
- uiDefButR(block, TOG, 0, "All", xco, yco,60,20, &spaceptr, "find_all", 0, 0, 0, 0, 0, NULL);
- xco += 50+XIC;
- uiBlockEndAlign(block);
-
- uiBlockBeginAlign(block);
- uiDefButO(block, BUT, "TEXT_OT_find", WM_OP_INVOKE_REGION_WIN, "Find", xco,yco,50,20, "Find next.");
- xco += 50;
- uiDefButO(block, BUT, "TEXT_OT_replace", WM_OP_INVOKE_REGION_WIN, "Replace", xco,yco,70,20, "Replace then find next.");
- xco += 70;
- uiDefButO(block, BUT, "TEXT_OT_mark_all", WM_OP_INVOKE_REGION_WIN, "Mark All", xco,yco,80,20, "Mark each occurrence to edit all from one");
- xco += 80;
- uiBlockEndAlign(block);
-
- uiEndBlock(C, block);
- uiDrawBlock(C, block);
+ uiTemplateLeftRight(layout);
+ uiItemR(layout, UI_TSLOT_LR_LEFT, "", 0, &spaceptr, "replace_text");
+ uiItemO(layout, UI_TSLOT_LR_RIGHT, "", ICON_TEXT, "TEXT_OT_replace_set_selected");
+ uiTemplateColumn(layout);
+ uiItemO(layout, UI_TSLOT_COLUMN_1, NULL, 0, "TEXT_OT_replace");
+
+ /* mark */
+ uiTemplateColumn(layout);
+ uiItemO(layout, UI_TSLOT_COLUMN_1, NULL, 0, "TEXT_OT_mark_all");
+
+ /* settings */
+ uiTemplateColumn(layout);
+ uiItemR(layout, UI_TSLOT_COLUMN_1, "Wrap", 0, &spaceptr, "find_wrap");
+ uiItemR(layout, UI_TSLOT_COLUMN_2, "All", 0, &spaceptr, "find_all");
+}
+
+void text_properties_buttons(const bContext *C, ARegion *ar)
+{
+ uiCompactPanelLayout(C, ar, "TEXT_OT_properties", "Properties", "Text", properties_buttons, 0);
+ uiCompactPanelLayout(C, ar, "TEXT_OT_find", "Find", "Text", find_buttons, 1);
- /* always as last */
- UI_view2d_totRect_set(&ar->v2d, xco+XIC+80, ar->v2d.tot.ymax-ar->v2d.tot.ymin);
+ uiDrawPanels(C, 1);
+ uiMatchPanelsView2d(ar);
}
-ARegion *text_has_find_region(ScrArea *sa)
+ARegion *text_has_properties_region(ScrArea *sa)
{
ARegion *ar, *arnew;
@@ -535,18 +492,18 @@ ARegion *text_has_find_region(ScrArea *sa)
/* is error! */
if(ar==NULL) return NULL;
- arnew= MEM_callocN(sizeof(ARegion), "find and replace region");
+ arnew= MEM_callocN(sizeof(ARegion), "properties region");
BLI_insertlinkafter(&sa->regionbase, ar, arnew);
arnew->regiontype= RGN_TYPE_UI;
- arnew->alignment= RGN_ALIGN_BOTTOM;
+ arnew->alignment= RGN_ALIGN_LEFT;
arnew->flag = RGN_FLAG_HIDDEN;
return arnew;
}
-static int find_and_replace_poll(bContext *C)
+static int properties_poll(bContext *C)
{
SpaceText *st= CTX_wm_space_text(C);
Text *text= CTX_data_edit_text(C);
@@ -554,10 +511,10 @@ static int find_and_replace_poll(bContext *C)
return (st && text);
}
-static int find_and_replace_exec(bContext *C, wmOperator *op)
+static int properties_exec(bContext *C, wmOperator *op)
{
ScrArea *sa= CTX_wm_area(C);
- ARegion *ar= text_has_find_region(sa);
+ ARegion *ar= text_has_properties_region(sa);
if(ar) {
ar->flag ^= RGN_FLAG_HIDDEN;
@@ -570,15 +527,15 @@ static int find_and_replace_exec(bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
-void TEXT_OT_find_and_replace(wmOperatorType *ot)
+void TEXT_OT_properties(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Find and Replace";
- ot->idname= "TEXT_OT_find_and_replace";
+ ot->name= "Properties";
+ ot->idname= "TEXT_OT_properties";
/* api callbacks */
- ot->exec= find_and_replace_exec;
- ot->poll= find_and_replace_poll;
+ ot->exec= properties_exec;
+ ot->poll= properties_poll;
}
/******************** XXX popup menus *******************/
diff --git a/source/blender/editors/space_text/text_intern.h b/source/blender/editors/space_text/text_intern.h
index b7e45501047..45360a9392d 100644
--- a/source/blender/editors/space_text/text_intern.h
+++ b/source/blender/editors/space_text/text_intern.h
@@ -44,6 +44,7 @@ struct wmWindowManager;
/* text_header.c */
void text_header_buttons(const struct bContext *C, struct ARegion *ar);
void text_find_buttons(const struct bContext *C, struct ARegion *ar);
+void text_properties_buttons(const struct bContext *C, struct ARegion *ar);
/* text_draw.c */
void draw_text_main(struct SpaceText *st, struct ARegion *ar);
@@ -142,7 +143,8 @@ void TEXT_OT_scroll_bar(struct wmOperatorType *ot);
void TEXT_OT_set_cursor(struct wmOperatorType *ot);
void TEXT_OT_line_number(struct wmOperatorType *ot);
-void TEXT_OT_find_and_replace(struct wmOperatorType *ot);
+void TEXT_OT_properties(struct wmOperatorType *ot);
+
void TEXT_OT_find(struct wmOperatorType *ot);
void TEXT_OT_find_set_selected(struct wmOperatorType *ot);
void TEXT_OT_replace(struct wmOperatorType *ot);
diff --git a/source/blender/editors/space_text/text_ops.c b/source/blender/editors/space_text/text_ops.c
index a77bea4c640..239e819c6de 100644
--- a/source/blender/editors/space_text/text_ops.c
+++ b/source/blender/editors/space_text/text_ops.c
@@ -2489,6 +2489,7 @@ void TEXT_OT_resolve_conflict(wmOperatorType *ot)
/* identifiers */
ot->name= "Resolve Conflict";
ot->idname= "TEXT_OT_resolve_conflict";
+ ot->description= "When external text is out of sync, resolve the conflict.";
/* api callbacks */
ot->exec= resolve_conflict_exec;
diff --git a/source/blender/makesdna/DNA_space_types.h b/source/blender/makesdna/DNA_space_types.h
index 2334af03709..686119f77fa 100644
--- a/source/blender/makesdna/DNA_space_types.h
+++ b/source/blender/makesdna/DNA_space_types.h
@@ -270,14 +270,12 @@ typedef struct SpaceText {
int top, viewlines;
short flags, menunr;
- int font_id;
int lheight;
int left;
int showlinenrs;
int tabnumber;
- int pad;
int showsyntax;
int overwrite;
float pix_per_line;
diff --git a/source/blender/makesrna/RNA_access.h b/source/blender/makesrna/RNA_access.h
index 8bc8c58f425..dfa74ea2f24 100644
--- a/source/blender/makesrna/RNA_access.h
+++ b/source/blender/makesrna/RNA_access.h
@@ -327,6 +327,7 @@ void RNA_property_float_range(PointerRNA *ptr, PropertyRNA *prop, float *hardmin
void RNA_property_float_ui_range(PointerRNA *ptr, PropertyRNA *prop, float *softmin, float *softmax, float *step, float *precision);
int RNA_property_string_maxlength(PointerRNA *ptr, PropertyRNA *prop);
+StructRNA *RNA_property_pointer_type(PointerRNA *ptr, PropertyRNA *prop);
void RNA_property_enum_items(PointerRNA *ptr, PropertyRNA *prop, const EnumPropertyItem **item, int *totitem);
int RNA_property_enum_value(PointerRNA *ptr, PropertyRNA *prop, const char *identifier, int *value);
diff --git a/source/blender/makesrna/intern/rna_access.c b/source/blender/makesrna/intern/rna_access.c
index bbf2030e4f3..202bd6bc615 100644
--- a/source/blender/makesrna/intern/rna_access.c
+++ b/source/blender/makesrna/intern/rna_access.c
@@ -431,6 +431,19 @@ int RNA_property_string_maxlength(PointerRNA *ptr, PropertyRNA *prop)
return sprop->maxlength;
}
+StructRNA *RNA_property_pointer_type(PointerRNA *ptr, PropertyRNA *prop)
+{
+ PointerPropertyRNA *pprop;
+
+ rna_idproperty_check(&prop, ptr);
+ pprop= (PointerPropertyRNA*)prop;
+
+ if(pprop->structtype)
+ return pprop->structtype;
+
+ return &RNA_UnknownType;
+}
+
void RNA_property_enum_items(PointerRNA *ptr, PropertyRNA *prop, const EnumPropertyItem **item, int *totitem)
{
EnumPropertyRNA *eprop;
diff --git a/source/blender/makesrna/intern/rna_image.c b/source/blender/makesrna/intern/rna_image.c
index c98a936030a..3ea26f198e9 100644
--- a/source/blender/makesrna/intern/rna_image.c
+++ b/source/blender/makesrna/intern/rna_image.c
@@ -230,4 +230,3 @@ void RNA_def_image(BlenderRNA *brna)
#endif
-
diff --git a/source/blender/makesrna/intern/rna_object.c b/source/blender/makesrna/intern/rna_object.c
index 2907658b17e..e1b24a93605 100644
--- a/source/blender/makesrna/intern/rna_object.c
+++ b/source/blender/makesrna/intern/rna_object.c
@@ -830,7 +830,7 @@ static StructRNA *rna_def_object(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Draw Bounds", "Displays the object's bounds.");
RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, NULL);
- prop= RNA_def_property(srna, "draw_bounds_types", PROP_ENUM, PROP_NONE);
+ prop= RNA_def_property(srna, "draw_bounds_type", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_sdna(prop, NULL, "boundtype");
RNA_def_property_enum_items(prop, boundtype_items);
RNA_def_property_ui_text(prop, "Draw Bounds Type", "Object boundary display type.");
diff --git a/source/blender/makesrna/intern/rna_space.c b/source/blender/makesrna/intern/rna_space.c
index c889a0ec195..2639f1b3012 100644
--- a/source/blender/makesrna/intern/rna_space.c
+++ b/source/blender/makesrna/intern/rna_space.c
@@ -218,9 +218,9 @@ static void rna_def_space_image_uv(BlenderRNA *brna)
RNA_def_property_boolean_sdna(prop, NULL, "flag", SI_LOCAL_UV);
RNA_def_property_ui_text(prop, "Local View", "Draw only faces with the currently displayed image assigned.");*/
- prop= RNA_def_property(srna, "display_normalized_coordinates", PROP_BOOLEAN, PROP_NONE);
+ prop= RNA_def_property(srna, "normalized_coordinates", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", SI_COORDFLOATS);
- RNA_def_property_ui_text(prop, "Display Normalized Coordinates", "Display UV coordinates from 0.0 to 1.0 rather than in pixels.");
+ RNA_def_property_ui_text(prop, "Normalized Coordinates", "Display UV coordinates from 0.0 to 1.0 rather than in pixels.");
/* todo: move edge and face drawing options here from G.f */
diff --git a/source/blender/makesrna/intern/rna_text.c b/source/blender/makesrna/intern/rna_text.c
index 80b9e56eff5..020ba635e4a 100644
--- a/source/blender/makesrna/intern/rna_text.c
+++ b/source/blender/makesrna/intern/rna_text.c
@@ -36,6 +36,8 @@
#include "DNA_text_types.h"
+#include "WM_types.h"
+
#ifdef RNA_RUNTIME
static void rna_Text_filename_get(PointerRNA *ptr, char *value)
@@ -83,7 +85,6 @@ static int rna_TextLine_line_length(PointerRNA *ptr)
return line->len;
}
-#if 0
static void rna_TextLine_line_set(PointerRNA *ptr, const char *value)
{
TextLine *line= (TextLine*)ptr->data;
@@ -91,16 +92,14 @@ static void rna_TextLine_line_set(PointerRNA *ptr, const char *value)
if(line->line)
MEM_freeN(line->line);
- if(strlen(value)) {
- line->line= BLI_strdup(value);
- line->len= strlen(line->line);
- }
- else {
- line->line= NULL;
- line->len= 0;
+ line->line= BLI_strdup(value);
+ line->len= strlen(line->line);
+
+ if(line->format) {
+ MEM_freeN(line->format);
+ line->format= NULL;
}
}
-#endif
#else
@@ -113,9 +112,9 @@ static void rna_def_text_line(BlenderRNA *brna)
RNA_def_struct_ui_text(srna, "Text Line", "Line of text in a Text datablock.");
prop= RNA_def_property(srna, "line", PROP_STRING, PROP_NONE);
- RNA_def_property_flag(prop, PROP_NOT_EDITABLE);
RNA_def_property_string_funcs(prop, "rna_TextLine_line_get", "rna_TextLine_line_length", "rna_TextLine_line_set");
RNA_def_property_ui_text(prop, "Line", "Text in the line.");
+ RNA_def_property_update(prop, NC_TEXT|NA_EDITED, NULL);
}
static void rna_def_text_marker(BlenderRNA *brna)
diff --git a/source/blender/python/intern/bpy_ui.c b/source/blender/python/intern/bpy_ui.c
index 82d48b1dcda..d9df8820e95 100644
--- a/source/blender/python/intern/bpy_ui.c
+++ b/source/blender/python/intern/bpy_ui.c
@@ -115,7 +115,7 @@ static PyObject *Method_defAutoButR( PyObject * self, PyObject * args )
return NULL;
}
- return PyCObject_FromVoidPtr( uiDefAutoButR(PyCObject_AsVoidPtr(py_block), &py_rna->ptr, prop, index, butname, xco, yco, width, height), NULL);
+ return PyCObject_FromVoidPtr( uiDefAutoButR(PyCObject_AsVoidPtr(py_block), &py_rna->ptr, prop, index, butname, 0, xco, yco, width, height), NULL);
}