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/editors/interface
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/editors/interface')
-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
9 files changed, 215 insertions, 35 deletions
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();