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:
authorTon Roosendaal <ton@blender.org>2011-06-04 21:03:46 +0400
committerTon Roosendaal <ton@blender.org>2011-06-04 21:03:46 +0400
commit88676349a473020937ba5f2637535bf5960059c9 (patch)
treecb02be5fea2f127b284430508fcab3de959c37d7 /source/blender
parent4a59928484b93a6c3876c0c8b065f6d313640804 (diff)
Code holiday commit:
- fix: user pref, window title was reset to 'Blender' on tab usage - Undo history menu back: - name "Undo History" - hotkey alt+ctrl+z (alt+apple+z for mac) - works like 2.4x, only for global undo, editmode and particle edit. - Menu scroll - for small windows or screens, popup menus now allow to display all items, using internal scrolling - works with a timer, scrolling 10 items per second when mouse is over the top or bottom arrow - if menu is too big to display, it now draws to top or bottom, based on largest available space. - also works for hotkey driven pop up menus. - User pref "DPI" follows widget/layout size - widgets & headers now become bigger and smaller, to match 'dpi' font sizes. Works well to match UI to monitor size. - note that icons can get fuzzy, we need better mipmaps for it
Diffstat (limited to 'source/blender')
-rw-r--r--source/blender/blenkernel/BKE_blender.h1
-rw-r--r--source/blender/blenkernel/intern/blender.c17
-rw-r--r--source/blender/editors/include/ED_particle.h3
-rw-r--r--source/blender/editors/include/ED_screen.h1
-rw-r--r--source/blender/editors/include/ED_types.h4
-rw-r--r--source/blender/editors/include/ED_util.h5
-rw-r--r--source/blender/editors/include/UI_interface.h9
-rw-r--r--source/blender/editors/interface/interface.c9
-rw-r--r--source/blender/editors/interface/interface_handlers.c90
-rw-r--r--source/blender/editors/interface/interface_icons.c5
-rw-r--r--source/blender/editors/interface/interface_intern.h13
-rw-r--r--source/blender/editors/interface/interface_panel.c9
-rw-r--r--source/blender/editors/interface/interface_regions.c102
-rw-r--r--source/blender/editors/interface/interface_templates.c6
-rw-r--r--source/blender/editors/interface/interface_widgets.c14
-rw-r--r--source/blender/editors/interface/resources.c2
-rw-r--r--source/blender/editors/physics/particle_edit.c58
-rw-r--r--source/blender/editors/screen/area.c30
-rw-r--r--source/blender/editors/screen/screen_edit.c19
-rw-r--r--source/blender/editors/screen/screen_ops.c14
-rw-r--r--source/blender/editors/space_action/space_action.c1
-rw-r--r--source/blender/editors/space_buttons/buttons_header.c6
-rw-r--r--source/blender/editors/space_script/script_header.c6
-rw-r--r--source/blender/editors/space_sound/sound_header.c6
-rw-r--r--source/blender/editors/space_view3d/view3d_header.c20
-rw-r--r--source/blender/editors/util/editmode_undo.c66
-rw-r--r--source/blender/editors/util/undo.c172
-rw-r--r--source/blender/editors/util/util_intern.h8
-rw-r--r--source/blender/makesdna/DNA_screen_types.h1
-rw-r--r--source/blender/makesdna/DNA_userdef_types.h3
-rw-r--r--source/blender/makesrna/intern/rna_userdef.c9
-rw-r--r--source/blender/windowmanager/intern/wm_files.c7
-rw-r--r--source/blender/windowmanager/intern/wm_operators.c24
-rw-r--r--source/blender/windowmanager/intern/wm_window.c6
34 files changed, 531 insertions, 215 deletions
diff --git a/source/blender/blenkernel/BKE_blender.h b/source/blender/blenkernel/BKE_blender.h
index a45e9a17dc9..07f0885372a 100644
--- a/source/blender/blenkernel/BKE_blender.h
+++ b/source/blender/blenkernel/BKE_blender.h
@@ -89,6 +89,7 @@ extern int BKE_undo_valid(const char *name);
extern void BKE_reset_undo(void);
extern char *BKE_undo_menu_string(void);
extern void BKE_undo_number(struct bContext *C, int nr);
+extern char *BKE_undo_get_name(int nr, int *active);
extern void BKE_undo_save_quit(void);
extern struct Main *BKE_undo_get_main(struct Scene **scene);
diff --git a/source/blender/blenkernel/intern/blender.c b/source/blender/blenkernel/intern/blender.c
index b852629e49c..20b44b3b899 100644
--- a/source/blender/blenkernel/intern/blender.c
+++ b/source/blender/blenkernel/intern/blender.c
@@ -620,7 +620,7 @@ void BKE_reset_undo(void)
/* based on index nr it does a restore */
void BKE_undo_number(bContext *C, int nr)
{
- curundo= BLI_findlink(&undobase, nr - 1);
+ curundo= BLI_findlink(&undobase, nr);
BKE_undo_step(C, 0);
}
@@ -646,6 +646,21 @@ int BKE_undo_valid(const char *name)
return undobase.last != undobase.first;
}
+/* get name of undo item, return null if no item with this index */
+/* if active pointer, set it to 1 if true */
+char *BKE_undo_get_name(int nr, int *active)
+{
+ UndoElem *uel= BLI_findlink(&undobase, nr);
+
+ if(active) *active= 0;
+
+ if(uel) {
+ if(active && uel==curundo)
+ *active= 1;
+ return uel->name;
+ }
+ return NULL;
+}
char *BKE_undo_menu_string(void)
{
diff --git a/source/blender/editors/include/ED_particle.h b/source/blender/editors/include/ED_particle.h
index 23997e06aef..f2973d0d070 100644
--- a/source/blender/editors/include/ED_particle.h
+++ b/source/blender/editors/include/ED_particle.h
@@ -71,8 +71,9 @@ void PE_undo_push(struct Scene *scene, const char *str);
void PE_undo_step(struct Scene *scene, int step);
void PE_undo(struct Scene *scene);
void PE_redo(struct Scene *scene);
-void PE_undo_menu(struct Scene *scene, struct Object *ob);
int PE_undo_valid(struct Scene *scene);
+void PE_undo_number(struct Scene *scene, int nr);
+char *PE_undo_get_name(struct Scene *scene, int nr, int *active);
#endif /* ED_PARTICLE_H */
diff --git a/source/blender/editors/include/ED_screen.h b/source/blender/editors/include/ED_screen.h
index 93ce82fa483..6e396a1021b 100644
--- a/source/blender/editors/include/ED_screen.h
+++ b/source/blender/editors/include/ED_screen.h
@@ -90,6 +90,7 @@ void ED_area_headerprint(ScrArea *sa, const char *str);
void ED_area_newspace(struct bContext *C, ScrArea *sa, int type);
void ED_area_prevspace(struct bContext *C, ScrArea *sa);
void ED_area_swapspace(struct bContext *C, ScrArea *sa1, ScrArea *sa2);
+int ED_area_headersize(void);
/* screens */
void ED_screens_initialize(struct wmWindowManager *wm);
diff --git a/source/blender/editors/include/ED_types.h b/source/blender/editors/include/ED_types.h
index 0218b8d9c2d..c1c31372011 100644
--- a/source/blender/editors/include/ED_types.h
+++ b/source/blender/editors/include/ED_types.h
@@ -40,10 +40,6 @@
#define SELECT 1
#define ACTIVE 2
-/* buttons */
-#define XIC 20
-#define YIC 20
-
/* proposal = put scene pointers on function calls? */
// #define BASACT (scene->basact)
// #define OBACT (BASACT? BASACT->object: NULL)
diff --git a/source/blender/editors/include/ED_util.h b/source/blender/editors/include/ED_util.h
index 50dd2308b6b..5e004fd8d47 100644
--- a/source/blender/editors/include/ED_util.h
+++ b/source/blender/editors/include/ED_util.h
@@ -59,6 +59,7 @@ void ED_undo_redo (struct bContext *C);
void ED_OT_undo (struct wmOperatorType *ot);
void ED_OT_undo_push (struct wmOperatorType *ot);
void ED_OT_redo (struct wmOperatorType *ot);
+void ED_OT_undo_history (struct wmOperatorType *ot);
int ED_undo_operator_repeat(struct bContext *C, struct wmOperator *op);
/* convenience since UI callbacks use this mostly*/
@@ -76,11 +77,7 @@ void undo_editmode_push(struct bContext *C, const char *name,
int (*validate_undo)(void *, void *));
-void *undo_editmode_get_prev (struct Object *ob);
-struct uiBlock *editmode_undohistorymenu(struct bContext *C, struct ARegion *ar, void *arg_unused);
-void undo_editmode_menu (struct bContext *C);
void undo_editmode_clear (void);
-void undo_editmode_step (struct bContext *C, int step);
/* crazyspace.c */
float *crazyspace_get_mapped_editverts(struct Scene *scene, struct Object *obedit);
diff --git a/source/blender/editors/include/UI_interface.h b/source/blender/editors/include/UI_interface.h
index d6988aa9618..1a26079800c 100644
--- a/source/blender/editors/include/UI_interface.h
+++ b/source/blender/editors/include/UI_interface.h
@@ -35,6 +35,7 @@
#define UI_INTERFACE_H
#include "RNA_types.h"
+#include "DNA_userdef_types.h"
/* Struct Declarations */
@@ -100,8 +101,8 @@ typedef struct uiLayout uiLayout;
#define UI_BLOCK_RET_1 4 /* XXX 2.5 not implemented */
#define UI_BLOCK_NUMSELECT 8
/*#define UI_BLOCK_ENTER_OK 16*/ /*UNUSED*/
-/*#define UI_BLOCK_NOSHADOW 32*/ /*UNUSED*/
-/*#define UI_BLOCK_UNUSED 64*/ /*UNUSED*/
+#define UI_BLOCK_CLIPBOTTOM 32
+#define UI_BLOCK_CLIPTOP 64
#define UI_BLOCK_MOVEMOUSE_QUIT 128
#define UI_BLOCK_KEEP_OPEN 256
#define UI_BLOCK_POPUP 512
@@ -622,8 +623,8 @@ void UI_exit(void);
#define UI_LAYOUT_MENU 2
#define UI_LAYOUT_TOOLBAR 3
-#define UI_UNIT_X 20
-#define UI_UNIT_Y 20
+#define UI_UNIT_X U.widget_unit
+#define UI_UNIT_Y U.widget_unit
#define UI_LAYOUT_ALIGN_EXPAND 0
#define UI_LAYOUT_ALIGN_LEFT 1
diff --git a/source/blender/editors/interface/interface.c b/source/blender/editors/interface/interface.c
index d139eafc09d..c431af9fd8e 100644
--- a/source/blender/editors/interface/interface.c
+++ b/source/blender/editors/interface/interface.c
@@ -892,13 +892,14 @@ void uiDrawBlock(const bContext *C, uiBlock *block)
/* widgets */
for(but= block->buttons.first; but; but= but->next) {
- ui_but_to_pixelrect(&rect, ar, block, but);
+ if(!(but->flag & (UI_HIDDEN|UI_SCROLLED))) {
+ ui_but_to_pixelrect(&rect, ar, block, but);
- if(!(but->flag & UI_HIDDEN) &&
/* XXX: figure out why invalid coordinates happen when closing render window */
/* and material preview is redrawn in main window (temp fix for bug #23848) */
- rect.xmin < rect.xmax && rect.ymin < rect.ymax)
- ui_draw_but(C, ar, &style, but, &rect);
+ if(rect.xmin < rect.xmax && rect.ymin < rect.ymax)
+ ui_draw_but(C, ar, &style, but, &rect);
+ }
}
/* restore matrix */
diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c
index 531c9dbf799..99a31e039c8 100644
--- a/source/blender/editors/interface/interface_handlers.c
+++ b/source/blender/editors/interface/interface_handlers.c
@@ -81,6 +81,7 @@ static void ui_add_link(bContext *C, uiBut *from, uiBut *to);
#define BUTTON_TOOLTIP_DELAY 0.500
#define BUTTON_FLASH_DELAY 0.020
+#define MENU_SCROLL_INTERVAL 0.1
#define BUTTON_AUTO_OPEN_THRESH 0.3
#define BUTTON_MOUSE_TOWARDS_THRESH 1.0
@@ -4743,6 +4744,8 @@ static uiBut *ui_but_find_mouse_over(ARegion *ar, int x, int y)
continue;
if(but->flag & UI_HIDDEN)
continue;
+ if(but->flag & UI_SCROLLED)
+ continue;
if(ui_but_contains_pt(but, mx, my))
butover= but;
}
@@ -5572,6 +5575,76 @@ static int ui_mouse_motion_towards_check(uiBlock *block, uiPopupBlockHandle *men
return menu->dotowards;
}
+static char ui_menu_scroll_test(uiBlock *block, int my)
+{
+ if(block->flag & (UI_BLOCK_CLIPTOP|UI_BLOCK_CLIPBOTTOM)) {
+ if(block->flag & UI_BLOCK_CLIPTOP)
+ if(my > block->maxy-14)
+ return 't';
+ if(block->flag & UI_BLOCK_CLIPBOTTOM)
+ if(my < block->miny+14)
+ return 'b';
+ }
+ return 0;
+}
+
+static int ui_menu_scroll(ARegion *ar, uiBlock *block, int my)
+{
+ char test= ui_menu_scroll_test(block, my);
+
+ if(test) {
+ uiBut *b1= block->buttons.first;
+ uiBut *b2= block->buttons.last;
+ uiBut *bnext;
+ uiBut *bprev;
+ int dy= 0;
+
+ /* get first and last visible buttons */
+ while(b1 && ui_but_next(b1) && (b1->flag & UI_SCROLLED))
+ b1= ui_but_next(b1);
+ while(b2 && ui_but_prev(b2) && (b2->flag & UI_SCROLLED))
+ b2= ui_but_prev(b2);
+ /* skips separators */
+ bnext= ui_but_next(b1);
+ bprev= ui_but_prev(b2);
+
+ if(bnext==NULL || bprev==NULL)
+ return 0;
+
+ if(test=='t') {
+ /* bottom button is first button */
+ if(b1->y1 < b2->y1)
+ dy= bnext->y1 - b1->y1;
+ /* bottom button is last button */
+ else
+ dy= bprev->y1 - b2->y1;
+ }
+ else if(test=='b') {
+ /* bottom button is first button */
+ if(b1->y1 < b2->y1)
+ dy= b1->y1 - bnext->y1;
+ /* bottom button is last button */
+ else
+ dy= b2->y1 - bprev->y1;
+ }
+ if(dy) {
+
+ for(b1= block->buttons.first; b1; b1= b1->next) {
+ b1->y1 -= dy;
+ b1->y2 -= dy;
+ }
+ /* set flags again */
+ ui_popup_block_scrolltest(block);
+
+ ED_region_tag_redraw(ar);
+
+ return 1;
+ }
+ }
+
+ return 0;
+}
+
static int ui_handle_menu_event(bContext *C, wmEvent *event, uiPopupBlockHandle *menu, int UNUSED(topmenu))
{
ARegion *ar;
@@ -5603,11 +5676,22 @@ static int ui_handle_menu_event(bContext *C, wmEvent *event, uiPopupBlockHandle
* and don't handle events */
ui_mouse_motion_towards_init(menu, mx, my, 1);
}
- else if(event->type != TIMER) {
+ else if(event->type == TIMER) {
+ if(event->customdata == menu->scrolltimer)
+ ui_menu_scroll(ar, block, my);
+ }
+ else {
/* for ui_mouse_motion_towards_block */
- if(event->type == MOUSEMOVE)
+ if(event->type == MOUSEMOVE) {
ui_mouse_motion_towards_init(menu, mx, my, 0);
-
+
+ /* add menu scroll timer, if needed */
+ if(ui_menu_scroll_test(block, my))
+ if(menu->scrolltimer==NULL)
+ menu->scrolltimer=
+ WM_event_add_timer(CTX_wm_manager(C), CTX_wm_window(C), TIMER, MENU_SCROLL_INTERVAL);
+ }
+
/* first block own event func */
if(block->block_event_func && block->block_event_func(C, block, event));
/* events not for active search menu button */
diff --git a/source/blender/editors/interface/interface_icons.c b/source/blender/editors/interface/interface_icons.c
index 037cc22f879..b92097d124b 100644
--- a/source/blender/editors/interface/interface_icons.c
+++ b/source/blender/editors/interface/interface_icons.c
@@ -945,6 +945,7 @@ static void icon_draw_size(float x, float y, int icon_id, float aspect, float al
Icon *icon = NULL;
DrawInfo *di = NULL;
IconImage *iimg;
+ float fdraw_size= UI_DPI_FAC*draw_size;
int w, h;
icon = BKE_icon_get(icon_id);
@@ -965,8 +966,8 @@ static void icon_draw_size(float x, float y, int icon_id, float aspect, float al
}
/* scale width and height according to aspect */
- w = (int)(draw_size/aspect + 0.5f);
- h = (int)(draw_size/aspect + 0.5f);
+ w = (int)(fdraw_size/aspect + 0.5f);
+ h = (int)(fdraw_size/aspect + 0.5f);
if(di->type == ICON_TYPE_VECTOR) {
/* vector icons use the uiBlock transformation, they are not drawn
diff --git a/source/blender/editors/interface/interface_intern.h b/source/blender/editors/interface/interface_intern.h
index e95b544d0c0..d185e839fdd 100644
--- a/source/blender/editors/interface/interface_intern.h
+++ b/source/blender/editors/interface/interface_intern.h
@@ -45,6 +45,7 @@ struct uiHandleButtonData;
struct wmEvent;
struct wmOperatorType;
struct wmWindow;
+struct wmTimer;
struct uiStyle;
struct uiWidgetColors;
struct uiLayout;
@@ -107,8 +108,8 @@ typedef enum {
#define UI_PANEL_MINY 70
/* uiBut->flag */
-#define UI_SELECT 1 /* use when the button is pressed */
-/*#define UI_MOUSE_OVER 2*/ /*UNUSED, free flag*/
+#define UI_SELECT 1 /* use when the button is pressed */
+#define UI_SCROLLED 2 /* temp hidden, scrolled away */
#define UI_ACTIVE 4
#define UI_HAS_ICON 8
#define UI_TEXTINPUT 16
@@ -395,6 +396,8 @@ struct uiPopupBlockHandle {
void (*popup_func)(struct bContext *C, void *arg, int event);
void (*cancel_func)(void *arg);
void *popup_arg;
+
+ struct wmTimer *scrolltimer;
/* for operator popups */
struct wmOperatorType *optype;
@@ -416,9 +419,11 @@ void ui_block_func_ICONTEXTROW(struct bContext *C, uiLayout *layout, void *arg_b
struct ARegion *ui_tooltip_create(struct bContext *C, struct ARegion *butregion, uiBut *but);
void ui_tooltip_free(struct bContext *C, struct ARegion *ar);
-uiBut *ui_popup_menu_memory(uiBlock *block, uiBut *but);
+uiBut *ui_popup_menu_memory(struct uiBlock *block, struct uiBut *but);
+
+float *ui_block_hsv_get(struct uiBlock *block);
+void ui_popup_block_scrolltest(struct uiBlock *block);
-float *ui_block_hsv_get(uiBlock *block);
/* searchbox for string button */
ARegion *ui_searchbox_create(struct bContext *C, struct ARegion *butregion, uiBut *but);
diff --git a/source/blender/editors/interface/interface_panel.c b/source/blender/editors/interface/interface_panel.c
index 6677f2b1bae..42017f749be 100644
--- a/source/blender/editors/interface/interface_panel.c
+++ b/source/blender/editors/interface/interface_panel.c
@@ -334,10 +334,13 @@ static void uiPanelPop(uiBlock *UNUSED(block))
void UI_DrawTriIcon(float x, float y, char dir)
{
if(dir=='h') {
- ui_draw_anti_tria( x-3,y-5, x-3,y+5, x+7,y );
+ ui_draw_anti_tria( x-3, y-5, x-3, y+5, x+7,y );
}
- else {
- ui_draw_anti_tria( x-5,y+3, x+5,y+3, x,y-7);
+ else if(dir=='t') {
+ ui_draw_anti_tria( x-5, y-7, x+5, y-7, x, y+3);
+ }
+ else { /* 'v' = vertical, down */
+ ui_draw_anti_tria( x-5, y+3, x+5, y+3, x, y-7);
}
}
diff --git a/source/blender/editors/interface/interface_regions.c b/source/blender/editors/interface/interface_regions.c
index 8b20406e036..623651083d2 100644
--- a/source/blender/editors/interface/interface_regions.c
+++ b/source/blender/editors/interface/interface_regions.c
@@ -67,7 +67,6 @@
#include "interface_intern.h"
-#define MENU_BUTTON_HEIGHT 20
#define MENU_SEPR_HEIGHT 6
#define B_NOP -1
#define MENU_SHADOW_SIDE 8
@@ -675,7 +674,7 @@ int uiSearchItemAdd(uiSearchItems *items, const char *name, void *poin, int icon
int uiSearchBoxhHeight(void)
{
- return SEARCH_ITEMS*MENU_BUTTON_HEIGHT + 2*MENU_TOP;
+ return SEARCH_ITEMS*UI_UNIT_Y + 2*MENU_TOP;
}
/* ar is the search box itself */
@@ -972,8 +971,6 @@ static void ui_searchbox_region_free_cb(ARegion *ar)
ar->regiondata= NULL;
}
-static void ui_block_position(wmWindow *window, ARegion *butregion, uiBut *but, uiBlock *block);
-
ARegion *ui_searchbox_create(bContext *C, ARegion *butregion, uiBut *but)
{
uiStyle *style= U.uistyles.first; // XXX pass on as arg
@@ -1229,18 +1226,26 @@ static void ui_block_position(wmWindow *window, ARegion *butregion, uiBut *but,
if(but) {
int left=0, right=0, top=0, down=0;
int winx, winy;
- int offscreen;
+ // int offscreen;
wm_window_get_size(window, &winx, &winy);
if(block->direction & UI_CENTER) center= ysize/2;
else center= 0;
-
+
+ /* check if there's space at all */
if( butrct.xmin-xsize > 0.0f) left= 1;
if( butrct.xmax+xsize < winx) right= 1;
if( butrct.ymin-ysize+center > 0.0f) down= 1;
if( butrct.ymax+ysize-center < winy) top= 1;
+ if(top==0 && down==0) {
+ if (butrct.ymin-ysize < winy-butrct.ymax-ysize)
+ top= 1;
+ else
+ down= 1;
+ }
+
dir1= block->direction & UI_DIRECTION;
/* secundary directions */
@@ -1305,7 +1310,7 @@ static void ui_block_position(wmWindow *window, ARegion *butregion, uiBut *but,
if(top==0 && down==0) {
if(dir1==UI_LEFT || dir1==UI_RIGHT) {
// align with bottom of screen
- yof= ysize;
+ // yof= ysize; (not with menu scrolls)
}
}
@@ -1320,15 +1325,16 @@ static void ui_block_position(wmWindow *window, ARegion *butregion, uiBut *but,
// apply requested offset in the block
xof += block->xofs/block->aspect;
yof += block->yofs/block->aspect;
-
+#if 0
/* clamp to window bounds, could be made into an option if its ever annoying */
if( (offscreen= (block->miny+yof)) < 0) yof -= offscreen; /* bottom */
else if((offscreen= (block->maxy+yof)-winy) > 0) yof -= offscreen; /* top */
if( (offscreen= (block->minx+xof)) < 0) xof -= offscreen; /* left */
else if((offscreen= (block->maxx+xof)-winx) > 0) xof -= offscreen; /* right */
+#endif
}
- /* apply */
+ /* apply offset, buttons in window coords */
for(bt= block->buttons.first; bt; bt= bt->next) {
ui_block_to_window_fl(butregion, but->block, &bt->x1, &bt->y1);
@@ -1402,6 +1408,62 @@ static void ui_block_region_draw(const bContext *C, ARegion *ar)
uiDrawBlock(C, block);
}
+static void ui_popup_block_clip(wmWindow *window, uiBlock *block)
+{
+ int winx, winy;
+
+ wm_window_get_size(window, &winx, &winy);
+
+ if(block->minx < MENU_SHADOW_SIDE)
+ block->minx= MENU_SHADOW_SIDE;
+ if(block->maxx > winx-MENU_SHADOW_SIDE)
+ block->maxx= winx-MENU_SHADOW_SIDE;
+
+ if(block->miny < MENU_SHADOW_BOTTOM)
+ block->miny= MENU_SHADOW_BOTTOM;
+ if(block->maxy > winy-MENU_TOP)
+ block->maxy= winy-MENU_TOP;
+}
+
+void ui_popup_block_scrolltest(uiBlock *block)
+{
+ uiBut *bt;
+
+ block->flag &= ~(UI_BLOCK_CLIPBOTTOM|UI_BLOCK_CLIPTOP);
+
+ for(bt= block->buttons.first; bt; bt= bt->next)
+ bt->flag &= ~UI_SCROLLED;
+
+ if(block->buttons.first==block->buttons.last)
+ return;
+
+ /* mark buttons that are outside boundary and the ones next to it for arrow(s) */
+ for(bt= block->buttons.first; bt; bt= bt->next) {
+ if(bt->y1 < block->miny) {
+ bt->flag |= UI_SCROLLED;
+ block->flag |= UI_BLOCK_CLIPBOTTOM;
+ /* make space for arrow */
+ if(bt->y2 < block->miny +10) {
+ if(bt->next && bt->next->y1 > bt->y1)
+ bt->next->flag |= UI_SCROLLED;
+ if(bt->prev && bt->prev->y1 > bt->y1)
+ bt->prev->flag |= UI_SCROLLED;
+ }
+ }
+ if(bt->y2 > block->maxy) {
+ bt->flag |= UI_SCROLLED;
+ block->flag |= UI_BLOCK_CLIPTOP;
+ /* make space for arrow */
+ if(bt->y1 > block->maxy -10) {
+ if(bt->next && bt->next->y2 < bt->y2)
+ bt->next->flag |= UI_SCROLLED;
+ if(bt->prev && bt->prev->y2 < bt->y2)
+ bt->prev->flag |= UI_SCROLLED;
+ }
+ }
+ }
+}
+
uiPopupBlockHandle *ui_popup_block_create(bContext *C, ARegion *butregion, uiBut *but, uiBlockCreateFunc create_func, uiBlockHandleCreateFunc handle_create_func, void *arg)
{
wmWindow *window= CTX_wm_window(C);
@@ -1472,6 +1534,9 @@ uiPopupBlockHandle *ui_popup_block_create(bContext *C, ARegion *butregion, uiBut
block->flag |= UI_BLOCK_POPUP|UI_BLOCK_NUMSELECT;
}
+ /* clip block with window boundary */
+ ui_popup_block_clip(window, block);
+
/* the block and buttons were positioned in window space as in 2.4x, now
* these menu blocks are regions so we bring it back to region space.
* additionally we add some padding for the menu shadow or rounded menus */
@@ -1479,7 +1544,7 @@ uiPopupBlockHandle *ui_popup_block_create(bContext *C, ARegion *butregion, uiBut
ar->winrct.xmax= block->maxx + MENU_SHADOW_SIDE;
ar->winrct.ymin= block->miny - MENU_SHADOW_BOTTOM;
ar->winrct.ymax= block->maxy + MENU_TOP;
-
+
block->minx -= ar->winrct.xmin;
block->maxx -= ar->winrct.xmin;
block->miny -= ar->winrct.ymin;
@@ -1491,12 +1556,15 @@ uiPopupBlockHandle *ui_popup_block_create(bContext *C, ARegion *butregion, uiBut
bt->y1 -= ar->winrct.ymin;
bt->y2 -= ar->winrct.ymin;
}
-
+
block->flag |= UI_BLOCK_LOOP;
/* adds subwindow */
ED_region_init(C, ar);
+ /* checks which buttons are visible, sets flags to prevent draw (do after region init) */
+ ui_popup_block_scrolltest(block);
+
/* get winmat now that we actually have the subwindow */
wmSubWindowSet(window, ar->swinid);
@@ -1511,6 +1579,10 @@ uiPopupBlockHandle *ui_popup_block_create(bContext *C, ARegion *butregion, uiBut
void ui_popup_block_free(bContext *C, uiPopupBlockHandle *handle)
{
ui_remove_temporary_region(C, CTX_wm_screen(C), handle->region);
+
+ if(handle->scrolltimer)
+ WM_event_remove_timer(CTX_wm_manager(C), CTX_wm_window(C), handle->scrolltimer);
+
MEM_freeN(handle);
}
@@ -2171,7 +2243,7 @@ static uiBlock *ui_block_func_POPUP(bContext *C, uiPopupBlockHandle *handle, voi
the offset is negative because we are inverse moving the
block to be under the mouse */
offset[0]= -(bt->x1 + 0.8f*(bt->x2 - bt->x1));
- offset[1]= -(bt->y1 + 0.5f*MENU_BUTTON_HEIGHT);
+ offset[1]= -(bt->y1 + 0.5f*UI_UNIT_Y);
}
else {
/* position mouse at 0.8*width of the button and below the tile
@@ -2180,7 +2252,7 @@ static uiBlock *ui_block_func_POPUP(bContext *C, uiPopupBlockHandle *handle, voi
for(bt=block->buttons.first; bt; bt=bt->next)
offset[0]= MIN2(offset[0], -(bt->x1 + 0.8f*(bt->x2 - bt->x1)));
- offset[1]= 1.5*MENU_BUTTON_HEIGHT;
+ offset[1]= 1.5*UI_UNIT_Y;
}
block->minbounds= minwidth;
@@ -2284,10 +2356,10 @@ uiPopupMenu *uiPupMenuBegin(bContext *C, const char *title, int icon)
if(icon) {
sprintf(titlestr, " %s", title);
- uiDefIconTextBut(pup->block, LABEL, 0, icon, titlestr, 0, 0, 200, MENU_BUTTON_HEIGHT, NULL, 0.0, 0.0, 0, 0, "");
+ uiDefIconTextBut(pup->block, LABEL, 0, icon, titlestr, 0, 0, 200, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 0, "");
}
else {
- but= uiDefBut(pup->block, LABEL, 0, title, 0, 0, 200, MENU_BUTTON_HEIGHT, NULL, 0.0, 0.0, 0, 0, "");
+ but= uiDefBut(pup->block, LABEL, 0, title, 0, 0, 200, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 0, "");
but->flag= UI_TEXT_LEFT;
}
}
diff --git a/source/blender/editors/interface/interface_templates.c b/source/blender/editors/interface/interface_templates.c
index 69e3a1792c6..37c8c43e107 100644
--- a/source/blender/editors/interface/interface_templates.c
+++ b/source/blender/editors/interface/interface_templates.c
@@ -751,7 +751,7 @@ static uiLayout *draw_modifier(uiLayout *layout, Scene *scene, Object *ob, Modif
if ((ob->type==OB_MESH) && modifier_couldBeCage(scene, md) && (index <= lastCageIndex))
{
/* -- convert to rna ? */
- but = uiDefIconButBitI(block, TOG, eModifierMode_OnCage, 0, ICON_MESH_DATA, 0, 0, 16, 20, &md->mode, 0.0, 0.0, 0.0, 0.0, "Apply modifier to editing cage during Editmode");
+ but = uiDefIconButBitI(block, TOG, eModifierMode_OnCage, 0, ICON_MESH_DATA, 0, 0, UI_UNIT_X-2, UI_UNIT_Y, &md->mode, 0.0, 0.0, 0.0, 0.0, "Apply modifier to editing cage during Editmode");
if (index < cageIndex)
uiButSetFlag(but, UI_BUT_DISABLED);
uiButSetFunc(but, modifiers_setOnCage, ob, md);
@@ -763,7 +763,7 @@ static uiLayout *draw_modifier(uiLayout *layout, Scene *scene, Object *ob, Modif
if (ELEM3(md->type, eModifierType_Hook, eModifierType_Softbody, eModifierType_MeshDeform)) {
/* add disabled pre-tesselated button, so users could have
message for this modifiers */
- but = uiDefIconButBitI(block, TOG, eModifierMode_ApplyOnSpline, 0, ICON_SURFACE_DATA, 0, 0, 16, 20, &md->mode, 0.0, 0.0, 0.0, 0.0, "This modifier could be applied on splines' points only");
+ but = uiDefIconButBitI(block, TOG, eModifierMode_ApplyOnSpline, 0, ICON_SURFACE_DATA, 0, 0, UI_UNIT_X-2, UI_UNIT_Y, &md->mode, 0.0, 0.0, 0.0, 0.0, "This modifier could be applied on splines' points only");
uiButSetFlag(but, UI_BUT_DISABLED);
} else if (mti->type != eModifierTypeType_Constructive) {
/* constructive modifiers tesselates curve before applying */
@@ -1993,7 +1993,7 @@ void uiTemplateLayers(uiLayout *layout, PointerRNA *ptr, const char *propname,
else if(used_prop && RNA_property_boolean_get_index(used_ptr, used_prop, layer))
icon = ICON_LAYER_USED;
- but= uiDefAutoButR(block, ptr, prop, layer, "", icon, 0, 0, 10, 10);
+ but= uiDefAutoButR(block, ptr, prop, layer, "", icon, 0, 0, UI_UNIT_X/2, UI_UNIT_Y/2);
uiButSetFunc(but, handle_layer_buttons, but, SET_INT_IN_POINTER(layer));
but->type= TOG;
}
diff --git a/source/blender/editors/interface/interface_widgets.c b/source/blender/editors/interface/interface_widgets.c
index 58ed1e31b81..f767a432cd0 100644
--- a/source/blender/editors/interface/interface_widgets.c
+++ b/source/blender/editors/interface/interface_widgets.c
@@ -771,7 +771,7 @@ static void widget_draw_preview(BIFIconID icon, float UNUSED(alpha), rcti *rect)
/* icons have been standardized... and this call draws in untransformed coordinates */
-#define ICON_HEIGHT 16.0f
+#define ICON_HEIGHT UI_DPI_FAC*16.0f
static void widget_draw_icon(uiBut *but, BIFIconID icon, float alpha, rcti *rect)
{
@@ -3081,6 +3081,18 @@ void ui_draw_menu_back(uiStyle *UNUSED(style), uiBlock *block, rcti *rect)
else
wt->draw(&wt->wcol, rect, 0, 0);
+ if(block) {
+ if(block->flag & UI_BLOCK_CLIPTOP) {
+ /* XXX no scaling for UI here yet */
+ glColor3ubv((unsigned char*)wt->wcol.text);
+ UI_DrawTriIcon((rect->xmax+rect->xmin)/2, rect->ymax-8, 't');
+ }
+ if(block->flag & UI_BLOCK_CLIPBOTTOM) {
+ /* XXX no scaling for UI here yet */
+ glColor3ubv((unsigned char*)wt->wcol.text);
+ UI_DrawTriIcon((rect->xmax+rect->xmin)/2, rect->ymin+10, 'v');
+ }
+ }
}
void ui_draw_search_back(uiStyle *UNUSED(style), uiBlock *block, rcti *rect)
diff --git a/source/blender/editors/interface/resources.c b/source/blender/editors/interface/resources.c
index 1a2a2906f1a..6d4d88da270 100644
--- a/source/blender/editors/interface/resources.c
+++ b/source/blender/editors/interface/resources.c
@@ -1578,6 +1578,8 @@ void init_userdef_do_versions(void)
}
if (U.dragthreshold == 0 )
U.dragthreshold= 5;
+ if (U.widget_unit==0)
+ U.widget_unit= (U.dpi * 20 + 36)/72;
/* funny name, but it is GE stuff, moves userdef stuff to engine */
// XXX space_set_commmandline_options();
diff --git a/source/blender/editors/physics/particle_edit.c b/source/blender/editors/physics/particle_edit.c
index c5ab840914e..6155929243b 100644
--- a/source/blender/editors/physics/particle_edit.c
+++ b/source/blender/editors/physics/particle_edit.c
@@ -3970,18 +3970,6 @@ int PE_undo_valid(Scene *scene)
return 0;
}
-static void PTCacheUndo_number(Scene *scene, PTCacheEdit *edit, int nr)
-{
- PTCacheUndo *undo;
- int a=1;
-
- for(undo= edit->undo.first; undo; undo= undo->next, a++) {
- if(a==nr) break;
- }
- edit->curundo= undo;
- PE_undo_step(scene, 0);
-}
-
static void PTCacheUndo_clear(PTCacheEdit *edit)
{
PTCacheUndo *undo;
@@ -4007,32 +3995,38 @@ void PE_redo(Scene *scene)
PE_undo_step(scene, -1);
}
-void PE_undo_menu(Scene *scene, Object *ob)
+void PE_undo_number(Scene *scene, int nr)
{
- PTCacheEdit *edit= PE_get_current(scene, ob);
+ PTCacheEdit *edit= PE_get_current(scene, OBACT);
PTCacheUndo *undo;
- DynStr *ds;
- short event=0;
- char *menu;
-
- if(!edit) return;
-
- ds= BLI_dynstr_new();
-
- BLI_dynstr_append(ds, "Particlemode Undo History %t");
+ int a=0;
- for(undo= edit->undo.first; undo; undo= undo->next) {
- BLI_dynstr_append(ds, "|");
- BLI_dynstr_append(ds, undo->name);
+ for(undo= edit->undo.first; undo; undo= undo->next, a++) {
+ if(a==nr) break;
}
+ edit->curundo= undo;
+ PE_undo_step(scene, 0);
+}
+
+
+/* get name of undo item, return null if no item with this index */
+/* if active pointer, set it to 1 if true */
+char *PE_undo_get_name(Scene *scene, int nr, int *active)
+{
+ PTCacheEdit *edit= PE_get_current(scene, OBACT);
+ PTCacheUndo *undo;
- menu= BLI_dynstr_get_cstring(ds);
- BLI_dynstr_free(ds);
-
-// XXX event= pupmenu_col(menu, 20);
- MEM_freeN(menu);
+ if(active) *active= 0;
- if(event>0) PTCacheUndo_number(scene, edit, event);
+ if(edit) {
+ undo= BLI_findlink(&edit->undo, nr);
+ if(undo) {
+ if(active && undo==edit->curundo)
+ *active= 1;
+ return undo->name;
+ }
+ }
+ return NULL;
}
/************************ utilities ******************************/
diff --git a/source/blender/editors/screen/area.c b/source/blender/editors/screen/area.c
index a1a4f33d008..fb535f2fee5 100644
--- a/source/blender/editors/screen/area.c
+++ b/source/blender/editors/screen/area.c
@@ -650,8 +650,12 @@ static void region_rect_recursive(ScrArea *sa, ARegion *ar, rcti *remainder, int
if(ar->next==NULL && alignment!=RGN_ALIGN_QSPLIT)
alignment= RGN_ALIGN_NONE;
+ /* prefsize, for header we stick to exception */
prefsizex= ar->sizex?ar->sizex:ar->type->prefsizex;
- prefsizey= ar->sizey?ar->sizey:ar->type->prefsizey;
+ if(ar->regiontype==RGN_TYPE_HEADER)
+ prefsizey= ar->type->prefsizey;
+ else
+ prefsizey= ar->sizey?ar->sizey:ar->type->prefsizey;
/* hidden is user flag */
if(ar->flag & RGN_FLAG_HIDDEN);
@@ -953,6 +957,8 @@ void ED_area_initialize(wmWindowManager *wm, wmWindow *win, ScrArea *sa)
uiFreeBlocks(NULL, &ar->uiblocks);
}
+ /* rechecks all 2d matrices */
+ ar->v2d.flag &= ~V2D_IS_INITIALISED;
}
}
@@ -1208,13 +1214,13 @@ int ED_area_header_switchbutton(const bContext *C, uiBlock *block, int yco)
int xco= 8;
but= uiDefIconTextButC(block, ICONTEXTROW, 0, ICON_VIEW3D,
- editortype_pup(), xco, yco, XIC+10, YIC,
+ editortype_pup(), xco, yco, UI_UNIT_X+10, UI_UNIT_Y,
&(sa->butspacetype), 1.0, SPACEICONMAX, 0, 0,
"Displays current editor type. "
"Click for menu of available types");
uiButSetFunc(but, spacefunc, NULL, NULL);
- return xco + XIC + 14;
+ return xco + UI_UNIT_X + 14;
}
int ED_area_header_standardbuttons(const bContext *C, uiBlock *block, int yco)
@@ -1230,21 +1236,21 @@ int ED_area_header_standardbuttons(const bContext *C, uiBlock *block, int yco)
if (sa->flag & HEADER_NO_PULLDOWN) {
uiDefIconButBitS(block, TOG, HEADER_NO_PULLDOWN, 0,
ICON_DISCLOSURE_TRI_RIGHT,
- xco,yco,XIC,YIC-2,
+ xco,yco,UI_UNIT_X,UI_UNIT_Y-2,
&(sa->flag), 0, 0, 0, 0,
"Show pulldown menus");
}
else {
uiDefIconButBitS(block, TOG, HEADER_NO_PULLDOWN, 0,
ICON_DISCLOSURE_TRI_DOWN,
- xco,yco,XIC,YIC-2,
+ xco,yco,UI_UNIT_X,UI_UNIT_Y-2,
&(sa->flag), 0, 0, 0, 0,
"Hide pulldown menus");
}
uiBlockSetEmboss(block, UI_EMBOSS);
- return xco + XIC;
+ return xco + UI_UNIT_X;
}
/************************ standard UI regions ************************/
@@ -1446,6 +1452,7 @@ void ED_region_header(const bContext *C, ARegion *ar)
HeaderType *ht;
Header header = {NULL};
int maxco, xco, yco;
+ int headery= ED_area_headersize();
/* clear */
UI_ThemeClearColor((ED_screen_area_active(C))?TH_HEADER:TH_HEADERDESEL);
@@ -1455,12 +1462,12 @@ void ED_region_header(const bContext *C, ARegion *ar)
UI_view2d_view_ortho(&ar->v2d);
xco= maxco= 8;
- yco= HEADERY-4;
+ yco= headery-4;
/* draw all headers types */
for(ht= ar->type->headertypes.first; ht; ht= ht->next) {
block= uiBeginBlock(C, ar, ht->idname, UI_EMBOSS);
- layout= uiBlockLayout(block, UI_LAYOUT_HORIZONTAL, UI_LAYOUT_HEADER, xco, yco, HEADERY-6, 1, style);
+ layout= uiBlockLayout(block, UI_LAYOUT_HORIZONTAL, UI_LAYOUT_HEADER, xco, yco, UI_UNIT_Y, 1, style);
if(ht->draw) {
header.type= ht;
@@ -1484,7 +1491,7 @@ void ED_region_header(const bContext *C, ARegion *ar)
}
/* always as last */
- UI_view2d_totRect_set(&ar->v2d, maxco+XIC+80, ar->v2d.tot.ymax-ar->v2d.tot.ymin);
+ UI_view2d_totRect_set(&ar->v2d, maxco+UI_UNIT_X+80, ar->v2d.tot.ymax-ar->v2d.tot.ymin);
/* restore view matrix? */
UI_view2d_view_restore(C);
@@ -1495,3 +1502,8 @@ void ED_region_header_init(ARegion *ar)
UI_view2d_region_reinit(&ar->v2d, V2D_COMMONVIEW_HEADER, ar->winx, ar->winy);
}
+/* UI_UNIT_Y is defined as U variable now, depending dpi */
+int ED_area_headersize(void)
+{
+ return UI_UNIT_Y+6;
+}
diff --git a/source/blender/editors/screen/screen_edit.c b/source/blender/editors/screen/screen_edit.c
index 9bc2b1a402c..eb41dcd147b 100644
--- a/source/blender/editors/screen/screen_edit.c
+++ b/source/blender/editors/screen/screen_edit.c
@@ -671,9 +671,9 @@ static void screen_test_scale(bScreen *sc, int winsizex, int winsizey)
/* test for collapsed areas. This could happen in some blender version... */
/* ton: removed option now, it needs Context... */
- /* make each window at least HEADERY high */
+ /* make each window at least ED_area_headersize() high */
for(sa= sc->areabase.first; sa; sa= sa->next) {
- int headery= HEADERY+1;
+ int headery= ED_area_headersize()+1;
if(sa->v1->vec.y+headery > sa->v2->vec.y) {
/* lower edge */
@@ -1055,6 +1055,18 @@ void ED_screen_draw(wmWindow *win)
win->screen->do_draw= 0;
}
+/* helper call for below, dpi changes headers */
+static void screen_refresh_headersizes(void)
+{
+ const ListBase *lb= BKE_spacetypes_list();
+ SpaceType *st;
+
+ for(st= lb->first; st; st= st->next) {
+ ARegionType *art= BKE_regiontype_from_id(st, RGN_TYPE_HEADER);
+ if(art) art->prefsizey= ED_area_headersize();
+ }
+}
+
/* make this screen usable */
/* for file read and first use, for scaling window, area moves */
void ED_screen_refresh(wmWindowManager *wm, wmWindow *win)
@@ -1076,6 +1088,9 @@ void ED_screen_refresh(wmWindowManager *wm, wmWindow *win)
else
wm_subwindow_position(win, win->screen->mainwin, &winrct);
+ /* header size depends on DPI, let's verify */
+ screen_refresh_headersizes();
+
for(sa= win->screen->areabase.first; sa; sa= sa->next) {
/* set spacetype and region callbacks, calls init() */
/* sets subwindows for regions, adds handlers */
diff --git a/source/blender/editors/screen/screen_ops.c b/source/blender/editors/screen/screen_ops.c
index f454dd9ce02..d1d59457fd9 100644
--- a/source/blender/editors/screen/screen_ops.c
+++ b/source/blender/editors/screen/screen_ops.c
@@ -868,13 +868,14 @@ typedef struct sAreaMoveData {
static void area_move_set_limits(bScreen *sc, int dir, int *bigger, int *smaller)
{
ScrArea *sa;
+ int areaminy= ED_area_headersize()+1;
/* we check all areas and test for free space with MINSIZE */
*bigger= *smaller= 100000;
for(sa= sc->areabase.first; sa; sa= sa->next) {
if(dir=='h') {
- int y1= sa->v2->vec.y - sa->v1->vec.y-AREAMINY;
+ int y1= sa->v2->vec.y - sa->v1->vec.y-areaminy;
/* if top or down edge selected, test height */
if(sa->v1->flag && sa->v4->flag)
@@ -933,6 +934,7 @@ static void area_move_apply_do(bContext *C, int origval, int delta, int dir, int
bScreen *sc= CTX_wm_screen(C);
ScrVert *v1;
ScrArea *sa;
+ int areaminy= ED_area_headersize()+1;
delta= CLAMPIS(delta, -smaller, bigger);
@@ -950,8 +952,8 @@ static void area_move_apply_do(bContext *C, int origval, int delta, int dir, int
v1->vec.y-= (v1->vec.y % AREAGRID);
/* prevent too small top header */
- if(v1->vec.y > win->sizey-AREAMINY)
- v1->vec.y= win->sizey-AREAMINY;
+ if(v1->vec.y > win->sizey-areaminy)
+ v1->vec.y= win->sizey-areaminy;
}
}
}
@@ -1165,6 +1167,7 @@ static int area_split_init(bContext *C, wmOperator *op)
{
ScrArea *sa= CTX_wm_area(C);
sAreaSplitData *sd;
+ int areaminy= ED_area_headersize()+1;
int dir;
/* required context */
@@ -1175,7 +1178,7 @@ static int area_split_init(bContext *C, wmOperator *op)
/* minimal size */
if(dir=='v' && sa->winx < 2*AREAMINX) return 0;
- if(dir=='h' && sa->winy < 2*AREAMINY) return 0;
+ if(dir=='h' && sa->winy < 2*areaminy) return 0;
/* custom data */
sd= (sAreaSplitData*)MEM_callocN(sizeof (sAreaSplitData), "op_area_split");
@@ -3314,6 +3317,7 @@ void ED_operatortypes_screen(void)
WM_operatortype_append(ED_OT_undo);
WM_operatortype_append(ED_OT_undo_push);
WM_operatortype_append(ED_OT_redo);
+ WM_operatortype_append(ED_OT_undo_history);
}
@@ -3422,9 +3426,11 @@ void ED_keymap_screen(wmKeyConfig *keyconf)
#ifdef __APPLE__
WM_keymap_add_item(keymap, "ED_OT_undo", ZKEY, KM_PRESS, KM_OSKEY, 0);
WM_keymap_add_item(keymap, "ED_OT_redo", ZKEY, KM_PRESS, KM_SHIFT|KM_OSKEY, 0);
+ WM_keymap_add_item(keymap, "ED_OT_undo_history", ZKEY, KM_PRESS, KM_ALT|KM_OSKEY, 0);
#endif
WM_keymap_add_item(keymap, "ED_OT_undo", ZKEY, KM_PRESS, KM_CTRL, 0);
WM_keymap_add_item(keymap, "ED_OT_redo", ZKEY, KM_PRESS, KM_SHIFT|KM_CTRL, 0);
+ WM_keymap_add_item(keymap, "ED_OT_undo_history", ZKEY, KM_PRESS, KM_ALT|KM_CTRL, 0);
/* render */
diff --git a/source/blender/editors/space_action/space_action.c b/source/blender/editors/space_action/space_action.c
index 10a1fe62cca..7a824e6bf9d 100644
--- a/source/blender/editors/space_action/space_action.c
+++ b/source/blender/editors/space_action/space_action.c
@@ -58,6 +58,7 @@
#include "UI_view2d.h"
#include "ED_space_api.h"
+#include "ED_screen.h"
#include "ED_anim_api.h"
#include "ED_markers.h"
diff --git a/source/blender/editors/space_buttons/buttons_header.c b/source/blender/editors/space_buttons/buttons_header.c
index 8d48836704e..19c600be937 100644
--- a/source/blender/editors/space_buttons/buttons_header.c
+++ b/source/blender/editors/space_buttons/buttons_header.c
@@ -104,7 +104,7 @@ void buttons_header_buttons(const bContext *C, ARegion *ar)
{
SpaceButs *sbuts= CTX_wm_space_buts(C);
uiBlock *block;
- int xco, yco= 1;
+ int xco, yco= 2;
buttons_context_compute(C, sbuts);
@@ -115,7 +115,7 @@ void buttons_header_buttons(const bContext *C, ARegion *ar)
uiBlockSetEmboss(block, UI_EMBOSS);
- xco -= XIC;
+ xco -= UI_UNIT_X;
// Default panels
uiBlockBeginAlign(block);
@@ -150,7 +150,7 @@ void buttons_header_buttons(const bContext *C, ARegion *ar)
uiBlockEndAlign(block);
/* always as last */
- UI_view2d_totRect_set(&ar->v2d, xco+(XIC/2), ar->v2d.tot.ymax-ar->v2d.tot.ymin);
+ UI_view2d_totRect_set(&ar->v2d, xco+(UI_UNIT_X/2), ar->v2d.tot.ymax-ar->v2d.tot.ymin);
uiEndBlock(C, block);
uiDrawBlock(C, block);
diff --git a/source/blender/editors/space_script/script_header.c b/source/blender/editors/space_script/script_header.c
index 57a1d36e3a2..d88d4296008 100644
--- a/source/blender/editors/space_script/script_header.c
+++ b/source/blender/editors/space_script/script_header.c
@@ -106,14 +106,14 @@ void script_header_buttons(const bContext *C, ARegion *ar)
xmax= GetButStringLength("View");
uiDefPulldownBut(block, dummy_viewmenu, CTX_wm_area(C),
- "View", xco, yco-2, xmax-3, 24, "");
- xco+=XIC+xmax;
+ "View", xco, yco-2, xmax-3, UI_UNIT_Y, "");
+ xco+=UI_UNIT_X+xmax;
}
uiBlockSetEmboss(block, UI_EMBOSS);
/* always as last */
- UI_view2d_totRect_set(&ar->v2d, xco+XIC+80, ar->v2d.tot.ymax-ar->v2d.tot.ymin);
+ UI_view2d_totRect_set(&ar->v2d, xco+UI_UNIT_X+80, ar->v2d.tot.ymax-ar->v2d.tot.ymin);
uiEndBlock(C, block);
uiDrawBlock(C, block);
diff --git a/source/blender/editors/space_sound/sound_header.c b/source/blender/editors/space_sound/sound_header.c
index 60707e18187..2246eb310b5 100644
--- a/source/blender/editors/space_sound/sound_header.c
+++ b/source/blender/editors/space_sound/sound_header.c
@@ -113,14 +113,14 @@ void sound_header_buttons(const bContext *C, ARegion *ar)
xmax= GetButStringLength("View");
uiDefPulldownBut(block, dummy_viewmenu, CTX_wm_area(C),
- "View", xco, yco-2, xmax-3, 24, "");
- xco+=XIC+xmax;
+ "View", xco, yco-2, xmax-3, UI_UNIT_Y, "");
+ xco+=UI_UNIT_X+xmax;
}
uiBlockSetEmboss(block, UI_EMBOSS);
/* always as last */
- UI_view2d_totRect_set(&ar->v2d, xco+XIC+80, ar->v2d.tot.ymax-ar->v2d.tot.ymin);
+ UI_view2d_totRect_set(&ar->v2d, xco+UI_UNIT_X+80, ar->v2d.tot.ymax-ar->v2d.tot.ymin);
uiEndBlock(C, block);
uiDrawBlock(C, block);
diff --git a/source/blender/editors/space_view3d/view3d_header.c b/source/blender/editors/space_view3d/view3d_header.c
index fce23df3810..75c8d5cae73 100644
--- a/source/blender/editors/space_view3d/view3d_header.c
+++ b/source/blender/editors/space_view3d/view3d_header.c
@@ -445,9 +445,9 @@ void uiTemplateEditModeSelection(uiLayout *layout, struct bContext *C)
row= uiLayoutRow(layout, 1);
block= uiLayoutGetBlock(row);
- uiDefIconButBitS(block, TOG, SCE_SELECT_VERTEX, B_SEL_VERT, ICON_VERTEXSEL, 0,0,XIC,YIC, &em->selectmode, 1.0, 0.0, 0, 0, "Vertex select mode");
- uiDefIconButBitS(block, TOG, SCE_SELECT_EDGE, B_SEL_EDGE, ICON_EDGESEL, 0,0,XIC,YIC, &em->selectmode, 1.0, 0.0, 0, 0, "Edge select mode");
- uiDefIconButBitS(block, TOG, SCE_SELECT_FACE, B_SEL_FACE, ICON_FACESEL, 0,0,XIC,YIC, &em->selectmode, 1.0, 0.0, 0, 0, "Face select mode");
+ uiDefIconButBitS(block, TOG, SCE_SELECT_VERTEX, B_SEL_VERT, ICON_VERTEXSEL, 0,0,UI_UNIT_X,UI_UNIT_Y, &em->selectmode, 1.0, 0.0, 0, 0, "Vertex select mode");
+ uiDefIconButBitS(block, TOG, SCE_SELECT_EDGE, B_SEL_EDGE, ICON_EDGESEL, 0,0,UI_UNIT_X,UI_UNIT_Y, &em->selectmode, 1.0, 0.0, 0, 0, "Edge select mode");
+ uiDefIconButBitS(block, TOG, SCE_SELECT_FACE, B_SEL_FACE, ICON_FACESEL, 0,0,UI_UNIT_X,UI_UNIT_Y, &em->selectmode, 1.0, 0.0, 0, 0, "Face select mode");
BKE_mesh_end_editmesh(obedit->data, em);
}
@@ -485,7 +485,7 @@ void uiTemplateHeader3D(uiLayout *layout, struct bContext *C)
uiBlockBeginAlign(block);
uiDefIconTextButS(block, MENU, B_MODESELECT, object_mode_icon(v3d->modeselect), view3d_modeselect_pup(scene) ,
- 0,0,126 * dpi_fac,20, &(v3d->modeselect), 0, 0, 0, 0, "Mode");
+ 0,0,126 * dpi_fac, UI_UNIT_Y, &(v3d->modeselect), 0, 0, 0, 0, "Mode");
uiBlockEndAlign(block);
/* Draw type */
@@ -508,10 +508,10 @@ void uiTemplateHeader3D(uiLayout *layout, struct bContext *C)
/* NDOF */
/* Not implemented yet
if (G.ndofdevice ==0 ) {
- uiDefIconTextButC(block, ICONTEXTROW,B_NDOF, ICON_NDOF_TURN, ndof_pup(), 0,0,XIC+10,YIC, &(v3d->ndofmode), 0, 3.0, 0, 0, "Ndof mode");
+ uiDefIconTextButC(block, ICONTEXTROW,B_NDOF, ICON_NDOF_TURN, ndof_pup(), 0,0,UI_UNIT_X+10,UI_UNIT_Y, &(v3d->ndofmode), 0, 3.0, 0, 0, "Ndof mode");
uiDefIconButC(block, TOG, B_NDOF, ICON_NDOF_DOM,
- 0,0,XIC,YIC,
+ 0,0,UI_UNIT_X,UI_UNIT_Y,
&v3d->ndoffilter, 0, 1, 0, 0, "dominant axis");
}
*/
@@ -522,9 +522,9 @@ void uiTemplateHeader3D(uiLayout *layout, struct bContext *C)
block= uiLayoutGetBlock(row);
if(v3d->twflag & V3D_USE_MANIPULATOR) {
- uiDefIconButBitC(block, TOG, V3D_MANIP_TRANSLATE, B_MAN_TRANS, ICON_MAN_TRANS, 0,0,XIC,YIC, &v3d->twtype, 1.0, 0.0, 0, 0, "Translate manipulator mode");
- uiDefIconButBitC(block, TOG, V3D_MANIP_ROTATE, B_MAN_ROT, ICON_MAN_ROT, 0,0,XIC,YIC, &v3d->twtype, 1.0, 0.0, 0, 0, "Rotate manipulator mode");
- uiDefIconButBitC(block, TOG, V3D_MANIP_SCALE, B_MAN_SCALE, ICON_MAN_SCALE, 0,0,XIC,YIC, &v3d->twtype, 1.0, 0.0, 0, 0, "Scale manipulator mode");
+ uiDefIconButBitC(block, TOG, V3D_MANIP_TRANSLATE, B_MAN_TRANS, ICON_MAN_TRANS, 0,0,UI_UNIT_X,UI_UNIT_Y, &v3d->twtype, 1.0, 0.0, 0, 0, "Translate manipulator mode");
+ uiDefIconButBitC(block, TOG, V3D_MANIP_ROTATE, B_MAN_ROT, ICON_MAN_ROT, 0,0,UI_UNIT_X,UI_UNIT_Y, &v3d->twtype, 1.0, 0.0, 0, 0, "Rotate manipulator mode");
+ uiDefIconButBitC(block, TOG, V3D_MANIP_SCALE, B_MAN_SCALE, ICON_MAN_SCALE, 0,0,UI_UNIT_X,UI_UNIT_Y, &v3d->twtype, 1.0, 0.0, 0, 0, "Scale manipulator mode");
}
if (v3d->twmode > (BIF_countTransformOrientation(C) - 1) + V3D_MANIP_CUSTOM) {
@@ -532,7 +532,7 @@ void uiTemplateHeader3D(uiLayout *layout, struct bContext *C)
}
str_menu = BIF_menustringTransformOrientation(C, "Orientation");
- uiDefButC(block, MENU, B_MAN_MODE, str_menu,0,0,70 * dpi_fac, YIC, &v3d->twmode, 0, 0, 0, 0, "Transform Orientation");
+ uiDefButC(block, MENU, B_MAN_MODE, str_menu,0,0,70 * dpi_fac, UI_UNIT_Y, &v3d->twmode, 0, 0, 0, 0, "Transform Orientation");
MEM_freeN((void *)str_menu);
}
diff --git a/source/blender/editors/util/editmode_undo.c b/source/blender/editors/util/editmode_undo.c
index 732e5087af2..bcbc134d06d 100644
--- a/source/blender/editors/util/editmode_undo.c
+++ b/source/blender/editors/util/editmode_undo.c
@@ -296,7 +296,7 @@ void undo_editmode_clear(void)
}
/* based on index nr it does a restore */
-static void undo_number(bContext *C, int nr)
+void undo_editmode_number(bContext *C, int nr)
{
UndoElem *uel;
int a=1;
@@ -337,66 +337,28 @@ int undo_editmode_valid(const char *undoname)
return undobase.last != undobase.first;
}
-/* ************** for interaction with menu/pullown */
-void undo_editmode_menu(bContext *C)
+/* get name of undo item, return null if no item with this index */
+/* if active pointer, set it to 1 if true */
+char *undo_editmode_get_name(bContext *C, int nr, int *active)
{
UndoElem *uel;
- DynStr *ds= BLI_dynstr_new();
- short event= 0;
- char *menu;
-
- undo_clean_stack(C); // removes other objects from it
-
- BLI_dynstr_append(ds, "Editmode Undo History %t");
-
- for(uel= undobase.first; uel; uel= uel->next) {
- BLI_dynstr_append(ds, "|");
- BLI_dynstr_append(ds, uel->name);
- }
-
- menu= BLI_dynstr_get_cstring(ds);
- BLI_dynstr_free(ds);
-
-// XXX event= pupmenu_col(menu, 20);
- MEM_freeN(menu);
- if(event>0) undo_number(C, event);
-}
-
-static void do_editmode_undohistorymenu(bContext *C, void *UNUSED(arg), int event)
-{
- Object *obedit= CTX_data_edit_object(C);
-
- if(obedit==NULL || event<1) return;
-
- undo_number(C, event-1);
+ /* prevent wrong numbers to be returned */
+ undo_clean_stack(C);
-}
-
-uiBlock *editmode_undohistorymenu(bContext *C, ARegion *ar, void *UNUSED(arg))
-{
- uiBlock *block;
- UndoElem *uel;
- short yco = 20, menuwidth = 120;
- short item= 1;
+ if(active) *active= 0;
- undo_clean_stack(C); // removes other objects from it
-
- block= uiBeginBlock(C, ar, "view3d_edit_mesh_undohistorymenu", UI_EMBOSSP);
- uiBlockSetButmFunc(block, do_editmode_undohistorymenu, NULL);
-
- for(uel= undobase.first; uel; uel= uel->next, item++) {
- if (uel==curundo) uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, uel->name, 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, (float)item, "");
- if (uel==curundo) uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
+ uel= BLI_findlink(&undobase, nr);
+ if(uel) {
+ if(active && uel==curundo)
+ *active= 1;
+ return uel->name;
}
-
- uiBlockSetDirection(block, UI_RIGHT);
- uiTextBoundsBlock(block, 60);
- return block;
+ return NULL;
}
+
void *undo_editmode_get_prev(Object *ob)
{
UndoElem *ue= undobase.last;
diff --git a/source/blender/editors/util/undo.c b/source/blender/editors/util/undo.c
index f4e27a5faf9..692a19a7198 100644
--- a/source/blender/editors/util/undo.c
+++ b/source/blender/editors/util/undo.c
@@ -68,6 +68,9 @@
#include "RNA_access.h"
#include "RNA_define.h"
+#include "UI_interface.h"
+#include "UI_resources.h"
+
#include "util_intern.h"
#define MAXUNDONAME 64 /* XXX, make common define */
@@ -111,10 +114,12 @@ void ED_undo_push(bContext *C, const char *str)
if(wm->file_saved) {
wm->file_saved= 0;
+ /* notifier that data changed, for save-over warning or header */
WM_event_add_notifier(C, NC_WM|ND_DATACHANGED, NULL);
}
}
+/* note: also check undo_history_exec() in bottom if you change notifiers */
static int ed_undo_step(bContext *C, int step, const char *undoname)
{
Object *obedit= CTX_data_edit_object(C);
@@ -277,32 +282,6 @@ static int ed_redo_exec(bContext *C, wmOperator *UNUSED(op))
return ed_undo_step(C, -1, NULL);
}
-#if 0 /* UNUSED */
-void ED_undo_menu(bContext *C)
-{
- Object *obedit= CTX_data_edit_object(C);
- Object *obact= CTX_data_active_object(C);
-
- if(obedit) {
- //if ELEM7(obedit->type, OB_MESH, OB_FONT, OB_CURVE, OB_SURF, OB_MBALL, OB_LATTICE, OB_ARMATURE)
- // undo_editmode_menu();
- }
- else {
- if(obact && obact->mode & OB_MODE_PARTICLE_EDIT)
- PE_undo_menu(CTX_data_scene(C), CTX_data_active_object(C));
- else if(U.uiflag & USER_GLOBALUNDO) {
- char *menu= BKE_undo_menu_string();
- if(menu) {
- short event= 0; // XXX pupmenu_col(menu, 20);
- MEM_freeN(menu);
- if(event>0) {
- BKE_undo_number(C, event);
- }
- }
- }
- }
-}
-#endif
/* ********************** */
@@ -399,3 +378,144 @@ void ED_undo_operator_repeat_cb_evt(bContext *C, void *arg_op, int UNUSED(arg_ev
{
ED_undo_operator_repeat(C, (wmOperator *)arg_op);
}
+
+
+/* ************************** */
+
+#define UNDOSYSTEM_GLOBAL 1
+#define UNDOSYSTEM_EDITMODE 2
+#define UNDOSYSTEM_PARTICLE 3
+
+static int get_undo_system(bContext *C)
+{
+ Object *obedit= CTX_data_edit_object(C);
+
+ /* find out which undo system */
+ if(obedit) {
+ if (ELEM7(obedit->type, OB_MESH, OB_FONT, OB_CURVE, OB_SURF, OB_MBALL, OB_LATTICE, OB_ARMATURE))
+ return UNDOSYSTEM_EDITMODE;
+ }
+ else {
+ Object *obact= CTX_data_active_object(C);
+
+ if(obact && obact->mode & OB_MODE_PARTICLE_EDIT)
+ return UNDOSYSTEM_PARTICLE;
+ else if(U.uiflag & USER_GLOBALUNDO)
+ return UNDOSYSTEM_GLOBAL;
+ }
+
+ return 0;
+}
+
+/* create enum based on undo items */
+static EnumPropertyItem *rna_undo_itemf(bContext *C, int undosys, int *totitem)
+{
+ EnumPropertyItem item_tmp= {0}, *item= NULL;
+ int active, i= 0;
+
+ while(TRUE) {
+ char *name= NULL;
+
+ if(undosys==UNDOSYSTEM_PARTICLE) {
+ name= PE_undo_get_name(CTX_data_scene(C), i, &active);
+ }
+ else if(undosys==UNDOSYSTEM_EDITMODE) {
+ name= undo_editmode_get_name(C, i, &active);
+ }
+ else {
+ name= BKE_undo_get_name(i, &active);
+ }
+
+ if(name) {
+ item_tmp.identifier= item_tmp.name= name;
+ if(active)
+ item_tmp.icon= ICON_RESTRICT_VIEW_OFF;
+ else
+ item_tmp.icon= ICON_NONE;
+ item_tmp.value= i++;
+ RNA_enum_item_add(&item, totitem, &item_tmp);
+ }
+ else
+ break;
+ }
+
+ RNA_enum_item_end(&item, totitem);
+
+ return item;
+}
+
+
+static int undo_history_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event))
+{
+ int undosys, totitem= 0;
+
+ undosys= get_undo_system(C);
+
+ if(undosys) {
+ EnumPropertyItem *item= rna_undo_itemf(C, undosys, &totitem);
+
+ if(totitem > 0) {
+ uiPopupMenu *pup= uiPupMenuBegin(C, op->type->name, ICON_NONE);
+ uiLayout *layout= uiPupMenuLayout(pup);
+ uiLayout *split= uiLayoutSplit(layout, 0, 0), *column;
+ int i, c;
+
+ for(c=0, i=totitem-1; i >= 0; i--, c++) {
+ if( (c % 20)==0 )
+ column= uiLayoutColumn(split, 0);
+ if(item[i].identifier)
+ uiItemIntO(column, item[i].name, item[i].icon, op->type->idname, "item", item[i].value);
+
+ }
+
+ MEM_freeN(item);
+
+ uiPupMenuEnd(C, pup);
+ }
+
+ }
+ return OPERATOR_CANCELLED;
+}
+
+/* note: also check ed_undo_step() in top if you change notifiers */
+static int undo_history_exec(bContext *C, wmOperator *op)
+{
+ if(RNA_property_is_set(op->ptr, "item")) {
+ int undosys= get_undo_system(C);
+ int item= RNA_int_get(op->ptr, "item");
+
+ if(undosys==UNDOSYSTEM_PARTICLE) {
+ PE_undo_number(CTX_data_scene(C), item);
+ }
+ else if(undosys==UNDOSYSTEM_EDITMODE) {
+ undo_editmode_number(C, item+1);
+ WM_event_add_notifier(C, NC_GEOM|ND_DATA, NULL);
+ }
+ else {
+ BKE_undo_number(C, item);
+ WM_event_add_notifier(C, NC_SCENE|ND_LAYER_CONTENT, CTX_data_scene(C));
+ }
+ WM_event_add_notifier(C, NC_WINDOW, NULL);
+
+ return OPERATOR_FINISHED;
+ }
+ return OPERATOR_CANCELLED;
+}
+
+void ED_OT_undo_history(wmOperatorType *ot)
+{
+ /* identifiers */
+ ot->name= "Undo History";
+ ot->description= "Redo specific action in history";
+ ot->idname= "ED_OT_undo_history";
+
+ /* api callbacks */
+ ot->invoke= undo_history_invoke;
+ ot->exec= undo_history_exec;
+ ot->poll= ED_operator_screenactive;
+
+ RNA_def_int(ot->srna, "item", 0, 0, INT_MAX, "Item", "", 0, INT_MAX);
+
+}
+
+
diff --git a/source/blender/editors/util/util_intern.h b/source/blender/editors/util/util_intern.h
index 1a82668236d..bfa758b3faa 100644
--- a/source/blender/editors/util/util_intern.h
+++ b/source/blender/editors/util/util_intern.h
@@ -37,8 +37,12 @@
/* internal exports only */
/* editmode_undo.c */
-void undo_editmode_name(bContext *C, const char *undoname);
-int undo_editmode_valid(const char *undoname);
+void undo_editmode_name (struct bContext *C, const char *undoname);
+int undo_editmode_valid (const char *undoname);
+char *undo_editmode_get_name (struct bContext *C, int nr, int *active);
+void *undo_editmode_get_prev (struct Object *ob);
+void undo_editmode_step (struct bContext *C, int step);
+void undo_editmode_number (struct bContext *C, int nr);
#endif /* ED_UTIL_INTERN_H */
diff --git a/source/blender/makesdna/DNA_screen_types.h b/source/blender/makesdna/DNA_screen_types.h
index cd19f4cb3de..b52ed35ddce 100644
--- a/source/blender/makesdna/DNA_screen_types.h
+++ b/source/blender/makesdna/DNA_screen_types.h
@@ -187,7 +187,6 @@ typedef struct ARegion {
#define AREA_FLAG_DRAWSPLIT_H 16
#define AREA_FLAG_DRAWSPLIT_V 32
-/* If you change EDGEWIDTH, also do the global arrat edcol[] */
#define EDGEWIDTH 1
#define AREAGRID 4
#define AREAMINX 32
diff --git a/source/blender/makesdna/DNA_userdef_types.h b/source/blender/makesdna/DNA_userdef_types.h
index 1057eeae40f..50e66f91028 100644
--- a/source/blender/makesdna/DNA_userdef_types.h
+++ b/source/blender/makesdna/DNA_userdef_types.h
@@ -374,7 +374,8 @@ typedef struct UserDef {
short scrcastfps; /* frame rate for screencast to be played back */
short scrcastwait; /* milliseconds between screencast snapshots */
- short pad8, pad[3]; /* Value for Dual/Single Column UI */
+ short widget_unit; /* defaults to 20 for 72 DPI setting */
+ short pad[3];
char versemaster[160];
char verseuser[160];
diff --git a/source/blender/makesrna/intern/rna_userdef.c b/source/blender/makesrna/intern/rna_userdef.c
index 33808446757..b67805c97b9 100644
--- a/source/blender/makesrna/intern/rna_userdef.c
+++ b/source/blender/makesrna/intern/rna_userdef.c
@@ -69,6 +69,13 @@ static void rna_userdef_update(Main *UNUSED(bmain), Scene *UNUSED(scene), Pointe
WM_main_add_notifier(NC_WINDOW, NULL);
}
+static void rna_userdef_dpi_update(Main *bmain, Scene *scene, PointerRNA *ptr)
+{
+ U.widget_unit = (U.dpi * 20 + 36)/72;
+ WM_main_add_notifier(NC_WINDOW, NULL); /* full redraw */
+ WM_main_add_notifier(NC_SCREEN|NA_EDITED, NULL); /* refresh region sizes */
+}
+
static void rna_userdef_show_manipulator_update(Main *bmain, Scene *scene, PointerRNA *ptr)
{
UserDef *userdef = (UserDef *)ptr->data;
@@ -2444,7 +2451,7 @@ static void rna_def_userdef_system(BlenderRNA *brna)
RNA_def_property_int_sdna(prop, NULL, "dpi");
RNA_def_property_range(prop, 48, 128);
RNA_def_property_ui_text(prop, "DPI", "Font size and resolution for display");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+ RNA_def_property_update(prop, 0, "rna_userdef_dpi_update");
prop= RNA_def_property(srna, "scrollback", PROP_INT, PROP_UNSIGNED);
RNA_def_property_int_sdna(prop, NULL, "scrollback");
diff --git a/source/blender/windowmanager/intern/wm_files.c b/source/blender/windowmanager/intern/wm_files.c
index a5ee01de2f1..5d005e23029 100644
--- a/source/blender/windowmanager/intern/wm_files.c
+++ b/source/blender/windowmanager/intern/wm_files.c
@@ -485,15 +485,16 @@ int WM_read_homefile(bContext *C, ReportList *reports, short from_memory)
/* prevent buggy files that had G_FILE_RELATIVE_REMAP written out by mistake. Screws up autosaves otherwise
* can remove this eventually, only in a 2.53 and older, now its not written */
G.fileflags &= ~G_FILE_RELATIVE_REMAP;
-
+
+ /* check userdef before open window, keymaps etc */
+ wm_init_userdef(C);
+
/* match the read WM with current WM */
wm_window_match_do(C, &wmbase);
WM_check(C); /* opens window(s), checks keymaps */
G.main->name[0]= '\0';
- wm_init_userdef(C);
-
/* When loading factory settings, the reset solid OpenGL lights need to be applied. */
if (!G.background) GPU_default_lights();
diff --git a/source/blender/windowmanager/intern/wm_operators.c b/source/blender/windowmanager/intern/wm_operators.c
index 34702558bc8..6959231a2fa 100644
--- a/source/blender/windowmanager/intern/wm_operators.c
+++ b/source/blender/windowmanager/intern/wm_operators.c
@@ -727,14 +727,14 @@ static uiBlock *wm_enum_search_menu(bContext *C, ARegion *ar, void *arg_op)
block= uiBeginBlock(C, ar, "_popup", UI_EMBOSS);
uiBlockSetFlag(block, UI_BLOCK_LOOP|UI_BLOCK_RET_1|UI_BLOCK_MOVEMOUSE_QUIT);
- //uiDefBut(block, LABEL, 0, op->type->name, 10, 10, 180, 19, NULL, 0.0, 0.0, 0, 0, ""); // ok, this isnt so easy...
- but= uiDefSearchBut(block, search, 0, ICON_VIEWZOOM, 256, 10, 10, 180, 19, 0, 0, "");
+ //uiDefBut(block, LABEL, 0, op->type->name, 10, 10, 180, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 0, ""); // ok, this isnt so easy...
+ but= uiDefSearchBut(block, search, 0, ICON_VIEWZOOM, 256, 10, 10, 9*UI_UNIT_X, UI_UNIT_Y, 0, 0, "");
uiButSetSearchFunc(but, operator_enum_search_cb, op->type, operator_enum_call_cb, NULL);
/* fake button, it holds space for search items */
- uiDefBut(block, LABEL, 0, "", 10, 10 - uiSearchBoxhHeight(), 180, uiSearchBoxhHeight(), NULL, 0, 0, 0, 0, NULL);
+ uiDefBut(block, LABEL, 0, "", 10, 10 - uiSearchBoxhHeight(), 9*UI_UNIT_X, uiSearchBoxhHeight(), NULL, 0, 0, 0, 0, NULL);
- uiPopupBoundsBlock(block, 6, 0, -20); /* move it downwards, mouse over button */
+ uiPopupBoundsBlock(block, 6, 0, -UI_UNIT_Y); /* move it downwards, mouse over button */
uiEndBlock(C, block);
event= *(win->eventstate); /* XXX huh huh? make api call */
@@ -916,7 +916,7 @@ static uiBlock *wm_block_create_redo(bContext *C, ARegion *ar, void *arg_op)
assert(op->type->flag & OPTYPE_REGISTER);
uiBlockSetHandleFunc(block, ED_undo_operator_repeat_cb_evt, arg_op);
- layout= uiBlockLayout(block, UI_LAYOUT_VERTICAL, UI_LAYOUT_PANEL, 0, 0, width, 20, style);
+ layout= uiBlockLayout(block, UI_LAYOUT_VERTICAL, UI_LAYOUT_PANEL, 0, 0, width, UI_UNIT_Y, style);
if(ED_undo_valid(C, op->type->name)==0)
uiLayoutSetEnabled(layout, 0);
@@ -981,7 +981,7 @@ static uiBlock *wm_block_create_dialog(bContext *C, ARegion *ar, void *userData)
col= uiLayoutColumn(layout, FALSE);
col_block= uiLayoutGetBlock(col);
/* Create OK button, the callback of which will execute op */
- btn= uiDefBut(col_block, BUT, 0, "OK", 0, -30, 0, 20, NULL, 0, 0, 0, 0, "");
+ btn= uiDefBut(col_block, BUT, 0, "OK", 0, -30, 0, UI_UNIT_Y, NULL, 0, 0, 0, 0, "");
uiButSetFunc(btn, dialog_exec_cb, op, col_block);
}
@@ -1087,7 +1087,7 @@ static int wm_debug_menu_exec(bContext *C, wmOperator *op)
static int wm_debug_menu_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event))
{
RNA_int_set(op->ptr, "debug_value", G.rt);
- return WM_operator_props_dialog_popup(C, op, 180, 20);
+ return WM_operator_props_dialog_popup(C, op, 9*UI_UNIT_X, UI_UNIT_Y);
}
static void WM_OT_debug_menu(wmOperatorType *ot)
@@ -1185,8 +1185,8 @@ static uiBlock *wm_block_create_splash(bContext *C, ARegion *ar, void *UNUSED(ar
uiBlockSetFunc(block, wm_block_splash_refreshmenu, block, NULL);
#ifdef NAN_BUILDINFO
- uiDefBut(block, LABEL, 0, version_str, 494-ver_width, 282-24, ver_width, 20, NULL, 0, 0, 0, 0, NULL);
- uiDefBut(block, LABEL, 0, revision_str, 494-rev_width, 282-36, rev_width, 20, NULL, 0, 0, 0, 0, NULL);
+ uiDefBut(block, LABEL, 0, version_str, 494-ver_width, 282-24, ver_width, UI_UNIT_Y, NULL, 0, 0, 0, 0, NULL);
+ uiDefBut(block, LABEL, 0, revision_str, 494-rev_width, 282-36, rev_width, UI_UNIT_Y, NULL, 0, 0, 0, 0, NULL);
#endif //NAN_BUILDINFO
layout= uiBlockLayout(block, UI_LAYOUT_VERTICAL, UI_LAYOUT_PANEL, 10, 2, 480, 110, style);
@@ -1310,13 +1310,13 @@ static uiBlock *wm_block_search_menu(bContext *C, ARegion *ar, void *UNUSED(arg_
block= uiBeginBlock(C, ar, "_popup", UI_EMBOSS);
uiBlockSetFlag(block, UI_BLOCK_LOOP|UI_BLOCK_RET_1|UI_BLOCK_MOVEMOUSE_QUIT);
- but= uiDefSearchBut(block, search, 0, ICON_VIEWZOOM, 256, 10, 10, 180, 19, 0, 0, "");
+ but= uiDefSearchBut(block, search, 0, ICON_VIEWZOOM, 256, 10, 10, 9*UI_UNIT_X, UI_UNIT_Y, 0, 0, "");
uiButSetSearchFunc(but, operator_search_cb, NULL, operator_call_cb, NULL);
/* fake button, it holds space for search items */
- uiDefBut(block, LABEL, 0, "", 10, 10 - uiSearchBoxhHeight(), 180, uiSearchBoxhHeight(), NULL, 0, 0, 0, 0, NULL);
+ uiDefBut(block, LABEL, 0, "", 10, 10 - uiSearchBoxhHeight(), 9*UI_UNIT_X, uiSearchBoxhHeight(), NULL, 0, 0, 0, 0, NULL);
- uiPopupBoundsBlock(block, 6, 0, -20); /* move it downwards, mouse over button */
+ uiPopupBoundsBlock(block, 6, 0, -UI_UNIT_Y); /* move it downwards, mouse over button */
uiEndBlock(C, block);
event= *(win->eventstate); /* XXX huh huh? make api call */
diff --git a/source/blender/windowmanager/intern/wm_window.c b/source/blender/windowmanager/intern/wm_window.c
index 82fe42f2b42..9ee39132521 100644
--- a/source/blender/windowmanager/intern/wm_window.c
+++ b/source/blender/windowmanager/intern/wm_window.c
@@ -271,9 +271,11 @@ void wm_window_close(bContext *C, wmWindowManager *wm, wmWindow *win)
void wm_window_title(wmWindowManager *wm, wmWindow *win)
{
- /* handle the 'temp' window */
+ /* handle the 'temp' window, only set title when not set before */
if(win->screen && win->screen->temp) {
- GHOST_SetTitle(win->ghostwin, "Blender");
+ char *title= GHOST_GetTitle(win->ghostwin);
+ if(title==NULL || title[0]==0)
+ GHOST_SetTitle(win->ghostwin, "Blender");
}
else {