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>2012-12-12 22:58:11 +0400
committerTon Roosendaal <ton@blender.org>2012-12-12 22:58:11 +0400
commit12b642062c6fcef70151bd2424c2ebbc6a1a6843 (patch)
treecefb983f370b982f5e8b606c21ac884eb32a35a2 /source/blender/editors/interface
parent26ae649b01c1147ec2fbb147bb652a8bc49a0019 (diff)
Holiday coding log :)
Nice formatted version (pictures soon): http://wiki.blender.org/index.php/Dev:Ref/Release_Notes/2.66/Usability Short list of main changes: - Transparent region option (over main region), added code to blend in/out such panels. - Min size window now 640 x 480 - Fixed DPI for ui - lots of cleanup and changes everywhere. Icon image need correct size still, layer-in-use icon needs remake. - Macbook retina support, use command line --no-native-pixels to disable it - Timeline Marker label was drawing wrong - Trackpad and magic mouse: supports zoom (hold ctrl) - Fix for splash position: removed ghost function and made window size update after creation immediate - Fast undo buffer save now adds UI as well. Could be checked for regular file save even... Quit.blend and temp file saving use this now. - Dixed filename in window on reading quit.blend or temp saves, and they now add a warning in window title: "(Recovered)" - New Userpref option "Keep Session" - this always saves quit.blend, and loads on start. This allows keeping UI and data without actual saves, until you actually save. When you load startup.blend and quit, it recognises the quit.blend as a startup (no file name in header) - Added 3D view copy/paste buffers (selected objects). Shortcuts ctrl-c, ctrl-v (OSX, cmd-c, cmd-v). Coded partial file saving for it. Could be used for other purposes. Todo: use OS clipboards. - User preferences (themes, keymaps, user settings) now can be saved as a separate file. Old option is called "Save Startup File" the new one "Save User Settings". To visualise this difference, the 'save startup file' button has been removed from user preferences window. That option is available as CTRL+U and in File menu still. - OSX: fixed bug that stopped giving mouse events outside window. This also fixes "Continuous Grab" for OSX. (error since 2009)
Diffstat (limited to 'source/blender/editors/interface')
-rw-r--r--source/blender/editors/interface/interface.c21
-rw-r--r--source/blender/editors/interface/interface_draw.c14
-rw-r--r--source/blender/editors/interface/interface_handlers.c4
-rw-r--r--source/blender/editors/interface/interface_icons.c9
-rw-r--r--source/blender/editors/interface/interface_intern.h2
-rw-r--r--source/blender/editors/interface/interface_layout.c14
-rw-r--r--source/blender/editors/interface/interface_panel.c12
-rw-r--r--source/blender/editors/interface/interface_regions.c78
-rw-r--r--source/blender/editors/interface/interface_style.c40
-rw-r--r--source/blender/editors/interface/interface_templates.c45
-rw-r--r--source/blender/editors/interface/interface_widgets.c177
-rw-r--r--source/blender/editors/interface/resources.c19
-rw-r--r--source/blender/editors/interface/view2d.c52
13 files changed, 297 insertions, 190 deletions
diff --git a/source/blender/editors/interface/interface.c b/source/blender/editors/interface/interface.c
index ce82e064531..3a377ade44c 100644
--- a/source/blender/editors/interface/interface.c
+++ b/source/blender/editors/interface/interface.c
@@ -69,7 +69,6 @@
#include "WM_api.h"
#include "WM_types.h"
#include "wm_subwindow.h"
-#include "wm_window.h"
#include "RNA_access.h"
@@ -298,9 +297,9 @@ static void ui_centered_bounds_block(const bContext *C, uiBlock *block)
/* note: this is used for the splash where window bounds event has not been
* updated by ghost, get the window bounds from ghost directly */
- // wm_window_get_size(window, &xmax, &ymax);
- wm_window_get_size_ghost(window, &xmax, &ymax);
-
+ xmax = WM_window_pixels_x(window);
+ ymax = WM_window_pixels_y(window);
+
ui_bounds_block(block);
width = BLI_rctf_size_x(&block->rect);
@@ -326,7 +325,8 @@ static void ui_popup_bounds_block(const bContext *C, uiBlock *block, eBlockBound
/* compute mouse position with user defined offset */
ui_bounds_block(block);
- wm_window_get_size(window, &xmax, &ymax);
+ xmax = WM_window_pixels_x(window);
+ ymax = WM_window_pixels_y(window);
oldwidth = BLI_rctf_size_x(&block->rect);
oldheight = BLI_rctf_size_y(&block->rect);
@@ -334,7 +334,7 @@ static void ui_popup_bounds_block(const bContext *C, uiBlock *block, eBlockBound
/* first we ensure wide enough text bounds */
if (bounds_calc == UI_BLOCK_BOUNDS_POPUP_MENU) {
if (block->flag & UI_BLOCK_LOOP) {
- block->bounds = 50;
+ block->bounds = 2.5f * UI_UNIT_X;
ui_text_bounds_block(block, block->rect.xmin);
}
}
@@ -983,7 +983,8 @@ void ui_fontscale(short *points, float aspect)
float pointsf = *points;
/* for some reason scaling fonts goes too fast compared to widget size */
- aspect = sqrt(aspect);
+ /* XXX not true anymore? (ton) */
+ //aspect = sqrt(aspect);
pointsf /= aspect;
if (aspect > 1.0f)
@@ -1000,7 +1001,7 @@ static void ui_but_to_pixelrect(rcti *rect, const ARegion *ar, uiBlock *block, u
ui_block_to_window_fl(ar, block, &rectf.xmin, &rectf.ymin);
ui_block_to_window_fl(ar, block, &rectf.xmax, &rectf.ymax);
-
+
rectf.xmin -= ar->winrct.xmin;
rectf.ymin -= ar->winrct.ymin;
rectf.xmax -= ar->winrct.xmin;
@@ -1015,7 +1016,7 @@ static void ui_but_to_pixelrect(rcti *rect, const ARegion *ar, uiBlock *block, u
/* uses local copy of style, to scale things down, and allow widgets to change stuff */
void uiDrawBlock(const bContext *C, uiBlock *block)
{
- uiStyle style = *UI_GetStyle(); /* XXX pass on as arg */
+ uiStyle style = *UI_GetStyleDraw(); /* XXX pass on as arg */
ARegion *ar;
uiBut *but;
rcti rect;
@@ -2650,7 +2651,7 @@ static uiBut *ui_def_but(uiBlock *block, int type, int retval, const char *str,
BLI_assert(width >= 0);
BLI_assert(height >= 0);
-
+
/* we could do some more error checks here */
if ((type & BUTTYPE) == LABEL) {
BLI_assert((poin != NULL || min != 0.0f || max != 0.0f || (a1 == 0.0f && a2 != 0.0f) || (a1 != 0.0f && a1 != 1.0f)) == FALSE);
diff --git a/source/blender/editors/interface/interface_draw.c b/source/blender/editors/interface/interface_draw.c
index 4d96ad810d4..792553f842c 100644
--- a/source/blender/editors/interface/interface_draw.c
+++ b/source/blender/editors/interface/interface_draw.c
@@ -429,17 +429,18 @@ void ui_draw_but_IMAGE(ARegion *UNUSED(ar), uiBut *but, uiWidgetColors *UNUSED(w
#else
ImBuf *ibuf = (ImBuf *)but->poin;
//GLint scissor[4];
- //int w, h;
+ int w, h;
if (!ibuf) return;
+ w = BLI_rcti_size_x(rect);
+ h = BLI_rcti_size_y(rect);
+
/* scissor doesn't seem to be doing the right thing...? */
#if 0
//glColor4f(1.0, 0.f, 0.f, 1.f);
//fdrawbox(rect->xmin, rect->ymin, rect->xmax, rect->ymax)
- w = BLI_rcti_size_x(rect);
- h = BLI_rcti_size_y(rect);
/* prevent drawing outside widget area */
glGetIntegerv(GL_SCISSOR_BOX, scissor);
glScissor(ar->winrct.xmin + rect->xmin, ar->winrct.ymin + rect->ymin, w, h);
@@ -448,9 +449,16 @@ void ui_draw_but_IMAGE(ARegion *UNUSED(ar), uiBut *but, uiWidgetColors *UNUSED(w
glEnable(GL_BLEND);
glColor4f(0.0, 0.0, 0.0, 0.0);
+ if (w != ibuf->x || h != ibuf->y) {
+ float facx = (float)w / (float)ibuf->x;
+ float facy = (float)h / (float)ibuf->y;
+ glPixelZoom(facx, facy);
+ }
glaDrawPixelsSafe((float)rect->xmin, (float)rect->ymin, ibuf->x, ibuf->y, ibuf->x, GL_RGBA, GL_UNSIGNED_BYTE, ibuf->rect);
//glaDrawPixelsTex((float)rect->xmin, (float)rect->ymin, ibuf->x, ibuf->y, GL_UNSIGNED_BYTE, ibuf->rect);
+ glPixelZoom(1.0f, 1.0f);
+
glDisable(GL_BLEND);
#if 0
diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c
index 1ac56fd30bb..258775867cc 100644
--- a/source/blender/editors/interface/interface_handlers.c
+++ b/source/blender/editors/interface/interface_handlers.c
@@ -4530,7 +4530,7 @@ static uiBlock *menu_change_shortcut(bContext *C, ARegion *ar, void *arg)
wmKeyMapItem *kmi;
PointerRNA ptr;
uiLayout *layout;
- uiStyle *style = UI_GetStyle();
+ uiStyle *style = UI_GetStyleDraw();
IDProperty *prop = (but->opptr) ? but->opptr->data : NULL;
int kmi_id = WM_key_event_operator_id(C, but->optype->idname, but->opcontext, prop, 1, &km);
@@ -4562,7 +4562,7 @@ static uiBlock *menu_add_shortcut(bContext *C, ARegion *ar, void *arg)
wmKeyMapItem *kmi;
PointerRNA ptr;
uiLayout *layout;
- uiStyle *style = UI_GetStyle();
+ uiStyle *style = UI_GetStyleDraw();
IDProperty *prop = (but->opptr) ? but->opptr->data : NULL;
int kmi_id;
diff --git a/source/blender/editors/interface/interface_icons.c b/source/blender/editors/interface/interface_icons.c
index bb0cc1176d8..d78985fa5e2 100644
--- a/source/blender/editors/interface/interface_icons.c
+++ b/source/blender/editors/interface/interface_icons.c
@@ -750,7 +750,7 @@ static DrawInfo *icon_create_drawinfo(void)
return di;
}
-/* note!, returns unscaled by DPI, may need to multiply result by UI_DPI_ICON_FAC */
+/* note!, returns unscaled by DPI */
int UI_icon_get_width(int icon_id)
{
Icon *icon = NULL;
@@ -887,7 +887,7 @@ static void icon_draw_rect(float x, float y, int w, int h, float UNUSED(aspect),
/* first allocate imbuf for scaling and copy preview into it */
ima = IMB_allocImBuf(rw, rh, 32, IB_rect);
memcpy(ima->rect, rect, rw * rh * sizeof(unsigned int));
- IMB_scaleImBuf(ima, w, h); /* scale it */
+ IMB_scalefastImBuf(ima, w, h); /* scale it */
rect = ima->rect;
}
@@ -965,7 +965,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 = is_preview ? draw_size : (draw_size * UI_DPI_ICON_FAC);
+ float fdraw_size = draw_size;
int w, h;
icon = BKE_icon_get(icon_id);
@@ -1158,9 +1158,10 @@ void UI_icon_draw_aspect_color(float x, float y, int icon_id, float aspect, cons
icon_draw_size(x, y, icon_id, aspect, 1.0f, rgb, ICON_SIZE_ICON, draw_size, FALSE, FALSE);
}
+/* draws icon with dpi scale factor */
void UI_icon_draw(float x, float y, int icon_id)
{
- UI_icon_draw_aspect(x, y, icon_id, 1.0f, 1.0f);
+ UI_icon_draw_aspect(x, y, icon_id, 1.0f / UI_DPI_ICON_FAC, 1.0f);
}
void UI_icon_draw_size(float x, float y, int size, int icon_id, float alpha)
diff --git a/source/blender/editors/interface/interface_intern.h b/source/blender/editors/interface/interface_intern.h
index 1dc98639fe7..fce43173832 100644
--- a/source/blender/editors/interface/interface_intern.h
+++ b/source/blender/editors/interface/interface_intern.h
@@ -267,7 +267,7 @@ struct uiBut {
void *dragpoin;
struct ImBuf *imb;
float imb_scale;
-
+
/* active button data */
struct uiHandleButtonData *active;
diff --git a/source/blender/editors/interface/interface_layout.c b/source/blender/editors/interface/interface_layout.c
index c67c64a0540..e93ecc72725 100644
--- a/source/blender/editors/interface/interface_layout.c
+++ b/source/blender/editors/interface/interface_layout.c
@@ -65,8 +65,6 @@
#define RNA_NO_INDEX -1
#define RNA_ENUM_VALUE -2
-#define EM_SEPR_X 6
-#define EM_SEPR_Y 6
// #define USE_OP_RESET_BUT // we may want to make this optional, disable for now.
@@ -227,14 +225,16 @@ static int ui_layout_vary_direction(uiLayout *layout)
/* estimated size of text + icon */
static int ui_text_icon_width(uiLayout *layout, const char *name, int icon, int compact)
{
+ float f5 = 0.25f * UI_UNIT_X;
+ float f10 = 0.5f * UI_UNIT_X;
int variable = ui_layout_vary_direction(layout) == UI_ITEM_VARY_X;
if (icon && !name[0])
return UI_UNIT_X; /* icon only */
else if (icon)
- return (variable) ? UI_GetStringWidth(name) + (compact ? 5 : 10) + UI_UNIT_X : 10 * UI_UNIT_X; /* icon + text */
+ return (variable) ? UI_GetStringWidth(name) + (compact ? f5 : f10) + UI_UNIT_X : 10 * UI_UNIT_X; /* icon + text */
else
- return (variable) ? UI_GetStringWidth(name) + (compact ? 5 : 10) + UI_UNIT_X : 10 * UI_UNIT_X; /* text only */
+ return (variable) ? UI_GetStringWidth(name) + (compact ? f5 : f10) + UI_UNIT_X : 10 * UI_UNIT_X; /* text only */
}
static void ui_item_size(uiItem *item, int *r_w, int *r_h)
@@ -1495,7 +1495,7 @@ static void ui_item_menu(uiLayout *layout, const char *name, int icon, uiMenuCre
h = UI_UNIT_Y;
if (layout->root->type == UI_LAYOUT_HEADER) /* ugly .. */
- w -= 10;
+ w -= UI_UNIT_Y/2;
if (name[0] && icon)
but = uiDefIconTextMenuBut(block, func, arg, icon, name, 0, 0, w, h, tip);
@@ -1610,7 +1610,7 @@ void uiItemS(uiLayout *layout)
uiBlock *block = layout->root->block;
uiBlockSetCurLayout(block, layout);
- uiDefBut(block, SEPR, 0, "", 0, 0, EM_SEPR_X, EM_SEPR_Y, NULL, 0.0, 0.0, 0, 0, "");
+ uiDefBut(block, SEPR, 0, "", 0, 0, 0.3f * UI_UNIT_X, 0.3f * UI_UNIT_Y, NULL, 0.0, 0.0, 0, 0, "");
}
/* level items */
@@ -2941,7 +2941,7 @@ void uiLayoutOperatorButs(const bContext *C, uiLayout *layout, wmOperator *op,
col = uiLayoutColumn(layout, FALSE);
block = uiLayoutGetBlock(col);
- but = uiDefIconTextBut(block, BUT, 0, ICON_FILE_REFRESH, IFACE_("Reset"), 0, 0, 18, 20,
+ but = uiDefIconTextBut(block, BUT, 0, ICON_FILE_REFRESH, IFACE_("Reset"), 0, 0, UI_UNIT_X, UI_UNIT_Y,
NULL, 0.0, 0.0, 0.0, 0.0, TIP_("Reset operator defaults"));
uiButSetFunc(but, ui_layout_operator_buts__reset_cb, op, NULL);
}
diff --git a/source/blender/editors/interface/interface_panel.c b/source/blender/editors/interface/interface_panel.c
index 2b170ea546b..0bdb39cb58e 100644
--- a/source/blender/editors/interface/interface_panel.c
+++ b/source/blender/editors/interface/interface_panel.c
@@ -305,7 +305,7 @@ void uiEndPanel(uiBlock *block, int width, int height)
static void ui_offset_panel_block(uiBlock *block)
{
- uiStyle *style = UI_GetStyle();
+ uiStyle *style = UI_GetStyleDraw();
uiBut *but;
int ofsy;
@@ -345,14 +345,18 @@ static void uiPanelPop(uiBlock *UNUSED(block))
/* triangle 'icon' for panel header */
void UI_DrawTriIcon(float x, float y, char dir)
{
+ float f3 = 0.15 * U.widget_unit;
+ float f5 = 0.25 * U.widget_unit;
+ float f7 = 0.35 * U.widget_unit;
+
if (dir == 'h') {
- ui_draw_anti_tria(x - 3, y - 5, x - 3, y + 5, x + 7, y);
+ ui_draw_anti_tria(x - f3, y - f5, x - f3, y + f5, x + f7, y);
}
else if (dir == 't') {
- ui_draw_anti_tria(x - 5, y - 7, x + 5, y - 7, x, y + 3);
+ ui_draw_anti_tria(x - f5, y - f7, x + f5, y - f7, x, y + f3);
}
else { /* 'v' = vertical, down */
- ui_draw_anti_tria(x - 5, y + 3, x + 5, y + 3, x, y - 7);
+ ui_draw_anti_tria(x - f5, y + f3, x + f5, y + f3, x, y - f7);
}
}
diff --git a/source/blender/editors/interface/interface_regions.c b/source/blender/editors/interface/interface_regions.c
index b62e634b1eb..ed619605963 100644
--- a/source/blender/editors/interface/interface_regions.c
+++ b/source/blender/editors/interface/interface_regions.c
@@ -672,7 +672,9 @@ ARegion *ui_tooltip_create(bContext *C, ARegion *butregion, uiBut *but)
BLI_rcti_translate(&rect_i, butregion->winrct.xmin, butregion->winrct.ymin);
}
- wm_window_get_size(CTX_wm_window(C), &winx, &winy);
+ winx = WM_window_pixels_x(CTX_wm_window(C));
+ winy = WM_window_pixels_y(CTX_wm_window(C));
+ //wm_window_get_size(CTX_wm_window(C), &winx, &winy);
if (rect_i.xmax > winx) {
/* super size */
@@ -1185,7 +1187,9 @@ ARegion *ui_searchbox_create(bContext *C, ARegion *butregion, uiBut *but)
BLI_rcti_translate(&rect_i, butregion->winrct.xmin, butregion->winrct.ymin);
- wm_window_get_size(CTX_wm_window(C), &winx, &winy);
+ winx = WM_window_pixels_x(CTX_wm_window(C));
+ winy = WM_window_pixels_y(CTX_wm_window(C));
+ //wm_window_get_size(CTX_wm_window(C), &winx, &winy);
if (rect_i.xmax > winx) {
/* super size */
@@ -1314,11 +1318,11 @@ static void ui_block_position(wmWindow *window, ARegion *butregion, uiBut *but,
/* widget_roundbox_set has this correction too, keep in sync */
if (but->type != PULLDOWN) {
if (but->flag & UI_BUT_ALIGN_TOP)
- butrct.ymax += 1.0f;
+ butrct.ymax += U.pixelsize;
if (but->flag & UI_BUT_ALIGN_LEFT)
- butrct.xmin -= 1.0f;
+ butrct.xmin -= U.pixelsize;
}
-
+
/* calc block rect */
if (block->rect.xmin == 0.0f && block->rect.xmax == 0.0f) {
if (block->buttons.first) {
@@ -1334,7 +1338,7 @@ static void ui_block_position(wmWindow *window, ARegion *butregion, uiBut *but,
block->rect.xmax = block->rect.ymax = 20;
}
}
-
+
/* aspect = (float)(BLI_rcti_size_x(&block->rect) + 4);*/ /*UNUSED*/
ui_block_to_window_fl(butregion, but->block, &block->rect.xmin, &block->rect.ymin);
ui_block_to_window_fl(butregion, but->block, &block->rect.xmax, &block->rect.ymax);
@@ -1342,8 +1346,8 @@ static void ui_block_position(wmWindow *window, ARegion *butregion, uiBut *but,
//block->rect.xmin -= 2.0; block->rect.ymin -= 2.0;
//block->rect.xmax += 2.0; block->rect.ymax += 2.0;
- xsize = BLI_rctf_size_x(&block->rect) + 4; /* 4 for shadow */
- ysize = BLI_rctf_size_y(&block->rect) + 4;
+ xsize = BLI_rctf_size_x(&block->rect) + 0.2f * UI_UNIT_X; /* 4 for shadow */
+ ysize = BLI_rctf_size_y(&block->rect) + 0.2f * UI_UNIT_Y;
/* aspect /= (float)xsize;*/ /*UNUSED*/
{
@@ -1351,7 +1355,9 @@ static void ui_block_position(wmWindow *window, ARegion *butregion, uiBut *but,
int winx, winy;
// int offscreen;
- wm_window_get_size(window, &winx, &winy);
+ winx = WM_window_pixels_x(window);
+ winy = WM_window_pixels_y(window);
+ // wm_window_get_size(window, &winx, &winy);
if (block->direction & UI_CENTER) center = ysize / 2;
else center = 0;
@@ -1523,7 +1529,9 @@ static void ui_popup_block_clip(wmWindow *window, uiBlock *block)
return;
}
- wm_window_get_size(window, &winx, &winy);
+ winx = WM_window_pixels_x(window);
+ winy = WM_window_pixels_y(window);
+ // wm_window_get_size(window, &winx, &winy);
if (block->rect.xmin < MENU_SHADOW_SIDE)
block->rect.xmin = MENU_SHADOW_SIDE;
@@ -1635,7 +1643,6 @@ uiPopupBlockHandle *ui_popup_block_create(bContext *C, ARegion *butregion, uiBut
/* if this is being created from a button */
if (but) {
block->aspect = but->block->aspect;
-
ui_block_position(window, butregion, but, block);
handle->direction = block->direction;
}
@@ -2019,10 +2026,10 @@ static void do_picker_new_mode_cb(bContext *UNUSED(C), void *bt1, void *UNUSED(a
picker_new_hide_reveal(bt->block, colormode);
}
-#define PICKER_H 150
-#define PICKER_W 150
-#define PICKER_SPACE 6
-#define PICKER_BAR 14
+#define PICKER_H (7.5f * U.widget_unit)
+#define PICKER_W (7.5f * U.widget_unit)
+#define PICKER_SPACE (0.3f * U.widget_unit)
+#define PICKER_BAR (0.7f * U.widget_unit)
#define PICKER_TOTAL_W (PICKER_W + PICKER_SPACE + PICKER_BAR)
@@ -2066,11 +2073,12 @@ static void uiBlockPicker(uiBlock *block, float rgba[4], PointerRNA *ptr, Proper
float rgb_gamma[3];
float min, max, step, precision;
float *hsv = ui_block_hsv_get(block);
+ int yco;
ui_block_hsv_get(block);
width = PICKER_TOTAL_W;
- butwidth = width - UI_UNIT_X - 10;
+ butwidth = width - 1.5f * UI_UNIT_X;
/* existence of profile means storage is in linear color space, with display correction */
/* XXX That tip message is not use anywhere! */
@@ -2108,44 +2116,47 @@ static void uiBlockPicker(uiBlock *block, float rgba[4], PointerRNA *ptr, Proper
}
/* mode */
+ yco = -1.5f * UI_UNIT_Y;
uiBlockBeginAlign(block);
- bt = uiDefButS(block, ROW, 0, IFACE_("RGB"), 0, -30, width / 3, UI_UNIT_Y, &colormode, 0.0, 0.0, 0, 0, "");
+ bt = uiDefButS(block, ROW, 0, IFACE_("RGB"), 0, yco, width / 3, UI_UNIT_Y, &colormode, 0.0, 0.0, 0, 0, "");
uiButSetFunc(bt, do_picker_new_mode_cb, bt, NULL);
- bt = uiDefButS(block, ROW, 0, IFACE_("HSV"), width / 3, -30, width / 3, UI_UNIT_Y, &colormode, 0.0, 1.0, 0, 0, "");
+ bt = uiDefButS(block, ROW, 0, IFACE_("HSV"), width / 3, yco, width / 3, UI_UNIT_Y, &colormode, 0.0, 1.0, 0, 0, "");
uiButSetFunc(bt, do_picker_new_mode_cb, bt, NULL);
- bt = uiDefButS(block, ROW, 0, IFACE_("Hex"), 2 * width / 3, -30, width / 3, UI_UNIT_Y, &colormode, 0.0, 2.0, 0, 0, "");
+ bt = uiDefButS(block, ROW, 0, IFACE_("Hex"), 2 * width / 3, yco, width / 3, UI_UNIT_Y, &colormode, 0.0, 2.0, 0, 0, "");
uiButSetFunc(bt, do_picker_new_mode_cb, bt, NULL);
uiBlockEndAlign(block);
+ yco = -3.0f * UI_UNIT_Y;
if (show_picker) {
- bt = uiDefIconButO(block, BUT, "UI_OT_eyedropper", WM_OP_INVOKE_DEFAULT, ICON_EYEDROPPER, butwidth + 10, -60, UI_UNIT_X, UI_UNIT_Y, NULL);
+ bt = uiDefIconButO(block, BUT, "UI_OT_eyedropper", WM_OP_INVOKE_DEFAULT, ICON_EYEDROPPER, butwidth + 10, yco, UI_UNIT_X, UI_UNIT_Y, NULL);
uiButSetFunc(bt, close_popup_cb, bt, NULL);
}
/* RGB values */
uiBlockBeginAlign(block);
- bt = uiDefButR_prop(block, NUMSLI, 0, IFACE_("R "), 0, -60, butwidth, UI_UNIT_Y, ptr, prop, 0, 0.0, 0.0, 0, 3, TIP_("Red"));
+ bt = uiDefButR_prop(block, NUMSLI, 0, IFACE_("R "), 0, yco, butwidth, UI_UNIT_Y, ptr, prop, 0, 0.0, 0.0, 0, 3, TIP_("Red"));
uiButSetFunc(bt, do_picker_rna_cb, bt, NULL);
- bt = uiDefButR_prop(block, NUMSLI, 0, IFACE_("G "), 0, -80, butwidth, UI_UNIT_Y, ptr, prop, 1, 0.0, 0.0, 0, 3, TIP_("Green"));
+ bt = uiDefButR_prop(block, NUMSLI, 0, IFACE_("G "), 0, yco -= UI_UNIT_Y, butwidth, UI_UNIT_Y, ptr, prop, 1, 0.0, 0.0, 0, 3, TIP_("Green"));
uiButSetFunc(bt, do_picker_rna_cb, bt, NULL);
- bt = uiDefButR_prop(block, NUMSLI, 0, IFACE_("B "), 0, -100, butwidth, UI_UNIT_Y, ptr, prop, 2, 0.0, 0.0, 0, 3, TIP_("Blue"));
+ bt = uiDefButR_prop(block, NUMSLI, 0, IFACE_("B "), 0, yco -= UI_UNIT_Y, butwidth, UI_UNIT_Y, ptr, prop, 2, 0.0, 0.0, 0, 3, TIP_("Blue"));
uiButSetFunc(bt, do_picker_rna_cb, bt, NULL);
/* could use uiItemFullR(col, ptr, prop, -1, 0, UI_ITEM_R_EXPAND|UI_ITEM_R_SLIDER, "", ICON_NONE);
* but need to use uiButSetFunc for updating other fake buttons */
/* HSV values */
+ yco = -3.0f * UI_UNIT_Y;
uiBlockBeginAlign(block);
- bt = uiDefButF(block, NUMSLI, 0, IFACE_("H "), 0, -60, butwidth, UI_UNIT_Y, hsv, 0.0, 1.0, 10, 3, TIP_("Hue"));
+ bt = uiDefButF(block, NUMSLI, 0, IFACE_("H "), 0, yco, butwidth, UI_UNIT_Y, hsv, 0.0, 1.0, 10, 3, TIP_("Hue"));
uiButSetFunc(bt, do_hsv_rna_cb, bt, hsv);
- bt = uiDefButF(block, NUMSLI, 0, IFACE_("S "), 0, -80, butwidth, UI_UNIT_Y, hsv + 1, 0.0, 1.0, 10, 3, TIP_("Saturation"));
+ bt = uiDefButF(block, NUMSLI, 0, IFACE_("S "), 0, yco -= UI_UNIT_Y, butwidth, UI_UNIT_Y, hsv + 1, 0.0, 1.0, 10, 3, TIP_("Saturation"));
uiButSetFunc(bt, do_hsv_rna_cb, bt, hsv);
- bt = uiDefButF(block, NUMSLI, 0, IFACE_("V "), 0, -100, butwidth, UI_UNIT_Y, hsv + 2, 0.0, max, 10, 3, TIP_("Value"));
+ bt = uiDefButF(block, NUMSLI, 0, IFACE_("V "), 0, yco -= UI_UNIT_Y, butwidth, UI_UNIT_Y, hsv + 2, 0.0, max, 10, 3, TIP_("Value"));
uiButSetFunc(bt, do_hsv_rna_cb, bt, hsv);
uiBlockEndAlign(block);
if (rgba[3] != FLT_MAX) {
- bt = uiDefButR_prop(block, NUMSLI, 0, IFACE_("A "), 0, -120, butwidth, UI_UNIT_Y, ptr, prop, 3, 0.0, 0.0, 0, 0, TIP_("Alpha"));
+ bt = uiDefButR_prop(block, NUMSLI, 0, IFACE_("A "), 0, yco -= UI_UNIT_Y, butwidth, UI_UNIT_Y, ptr, prop, 3, 0.0, 0.0, 0, 0, TIP_("Alpha"));
uiButSetFunc(bt, do_picker_rna_cb, bt, NULL);
}
else {
@@ -2154,9 +2165,10 @@ static void uiBlockPicker(uiBlock *block, float rgba[4], PointerRNA *ptr, Proper
BLI_snprintf(hexcol, sizeof(hexcol), "%02X%02X%02X", FTOCHAR(rgb_gamma[0]), FTOCHAR(rgb_gamma[1]), FTOCHAR(rgb_gamma[2]));
- bt = uiDefBut(block, TEX, 0, IFACE_("Hex: "), 0, -60, butwidth, UI_UNIT_Y, hexcol, 0, 8, 0, 0, TIP_("Hex triplet for color (#RRGGBB)"));
+ yco = -3.0f * UI_UNIT_Y;
+ bt = uiDefBut(block, TEX, 0, IFACE_("Hex: "), 0, yco, butwidth, UI_UNIT_Y, hexcol, 0, 8, 0, 0, TIP_("Hex triplet for color (#RRGGBB)"));
uiButSetFunc(bt, do_hex_rna_cb, bt, hexcol);
- uiDefBut(block, LABEL, 0, IFACE_("(Gamma Corrected)"), 0, -80, butwidth, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 0, "");
+ uiDefBut(block, LABEL, 0, IFACE_("(Gamma Corrected)"), 0, yco - UI_UNIT_Y, butwidth, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 0, "");
rgb_to_hsv_v(rgba, hsv);
@@ -2228,7 +2240,7 @@ uiBlock *ui_block_func_COLOR(bContext *C, uiPopupBlockHandle *handle, void *arg_
uiBlockPicker(block, handle->retvec, &but->rnapoin, but->rnaprop, show_picker);
block->flag = UI_BLOCK_LOOP | UI_BLOCK_REDRAW | UI_BLOCK_KEEP_OPEN | UI_BLOCK_OUT_1 | UI_BLOCK_MOVEMOUSE_QUIT;
- uiBoundsBlock(block, 10);
+ uiBoundsBlock(block, 0.5 * UI_UNIT_X);
block->block_event_func = ui_picker_small_wheel_cb;
@@ -2386,7 +2398,7 @@ static uiBlock *ui_block_func_POPUP(bContext *C, uiPopupBlockHandle *handle, voi
}
block->minbounds = minwidth;
- uiTextBoundsBlock(block, 50);
+ uiTextBoundsBlock(block, 2.5 * UI_UNIT_X);
}
/* if menu slides out of other menu, override direction */
@@ -2402,7 +2414,7 @@ uiPopupBlockHandle *ui_popup_menu_create(bContext *C, ARegion *butregion, uiBut
uiMenuCreateFunc menu_func, void *arg, char *str)
{
wmWindow *window = CTX_wm_window(C);
- uiStyle *style = UI_GetStyle();
+ uiStyle *style = UI_GetStyleDraw();
uiPopupBlockHandle *handle;
uiPopupMenu *pup;
pup = MEM_callocN(sizeof(uiPopupMenu), __func__);
@@ -2466,7 +2478,7 @@ uiPopupBlockHandle *ui_popup_menu_create(bContext *C, ARegion *butregion, uiBut
/* only return handler, and set optional title */
uiPopupMenu *uiPupMenuBegin(bContext *C, const char *title, int icon)
{
- uiStyle *style = UI_GetStyle();
+ uiStyle *style = UI_GetStyleDraw();
uiPopupMenu *pup = MEM_callocN(sizeof(uiPopupMenu), "popup menu");
uiBut *but;
diff --git a/source/blender/editors/interface/interface_style.c b/source/blender/editors/interface/interface_style.c
index 7e7db6aeaaa..7118cbcd855 100644
--- a/source/blender/editors/interface/interface_style.c
+++ b/source/blender/editors/interface/interface_style.c
@@ -166,7 +166,7 @@ void uiStyleFontDrawExt(uiFontStyle *fs, rcti *rect, const char *str,
}
/* clip is very strict, so we give it some space */
- BLF_clipping(fs->uifont_id, rect->xmin - 1, rect->ymin - 4, rect->xmax + 1, rect->ymax + 4);
+ BLF_clipping(fs->uifont_id, rect->xmin - 2, rect->ymin - 4, rect->xmax + 1, rect->ymax + 4);
BLF_enable(fs->uifont_id, BLF_CLIPPING);
BLF_position(fs->uifont_id, rect->xmin + xofs, rect->ymin + yofs, 0.0f);
@@ -261,6 +261,32 @@ uiStyle *UI_GetStyle(void)
return (style != NULL) ? style : U.uistyles.first;
}
+/* for drawing, scaled with DPI setting */
+uiStyle *UI_GetStyleDraw(void)
+{
+ uiStyle *style = UI_GetStyle();
+ static uiStyle _style;
+
+ _style = *style;
+
+ _style.paneltitle.shadx = (short)(UI_DPI_FAC * _style.paneltitle.shadx);
+ _style.paneltitle.shady = (short)(UI_DPI_FAC * _style.grouplabel.shady);
+ _style.grouplabel.shadx = (short)(UI_DPI_FAC * _style.grouplabel.shadx);
+ _style.grouplabel.shady = (short)(UI_DPI_FAC * _style.paneltitle.shady);
+ _style.widgetlabel.shadx = (short)(UI_DPI_FAC * _style.widgetlabel.shadx);
+ _style.widgetlabel.shady = (short)(UI_DPI_FAC * _style.widgetlabel.shady);
+
+ _style.columnspace = (short)(UI_DPI_FAC * _style.columnspace);
+ _style.templatespace = (short)(UI_DPI_FAC * _style.templatespace);
+ _style.boxspace = (short)(UI_DPI_FAC * _style.boxspace);
+ _style.buttonspacex = (short)(UI_DPI_FAC * _style.buttonspacex);
+ _style.buttonspacey = (short)(UI_DPI_FAC * _style.buttonspacey);
+ _style.panelspace = (short)(UI_DPI_FAC * _style.panelspace);
+ _style.panelouter = (short)(UI_DPI_FAC * _style.panelouter);
+
+ return &_style;
+}
+
/* temporarily, does widget font */
int UI_GetStringWidth(const char *str)
{
@@ -364,9 +390,9 @@ void uiStyleInit(void)
* Yes, this build the glyph cache and create
* the texture.
*/
- BLF_size(font->blf_id, 11, U.dpi);
- BLF_size(font->blf_id, 12, U.dpi);
- BLF_size(font->blf_id, 14, U.dpi);
+ BLF_size(font->blf_id, 11 * U.pixelsize, U.dpi);
+ BLF_size(font->blf_id, 12 * U.pixelsize, U.dpi);
+ BLF_size(font->blf_id, 14 * U.pixelsize, U.dpi);
}
}
@@ -378,19 +404,19 @@ void uiStyleInit(void)
if (blf_mono_font == -1)
blf_mono_font = BLF_load_mem_unique("monospace", (unsigned char *)datatoc_bmonofont_ttf, datatoc_bmonofont_ttf_size);
- BLF_size(blf_mono_font, 12, 72);
+ BLF_size(blf_mono_font, 12 * U.pixelsize, 72);
/* second for rendering else we get threading problems */
if (blf_mono_font_render == -1)
blf_mono_font_render = BLF_load_mem_unique("monospace", (unsigned char *)datatoc_bmonofont_ttf, datatoc_bmonofont_ttf_size);
- BLF_size(blf_mono_font_render, 12, 72);
+ BLF_size(blf_mono_font_render, 12 * U.pixelsize, 72 );
}
void uiStyleFontSet(uiFontStyle *fs)
{
uiFont *font = uifont_to_blfont(fs->uifont_id);
- BLF_size(font->blf_id, fs->points, U.dpi);
+ BLF_size(font->blf_id, fs->points * U.pixelsize, U.dpi);
}
diff --git a/source/blender/editors/interface/interface_templates.c b/source/blender/editors/interface/interface_templates.c
index f7a53c6bab2..0e3c32334b8 100644
--- a/source/blender/editors/interface/interface_templates.c
+++ b/source/blender/editors/interface/interface_templates.c
@@ -179,29 +179,29 @@ static uiBlock *id_search_menu(bContext *C, ARegion *ar, void *arg_litem)
/* preview thumbnails */
if (template.prv_rows > 0 && template.prv_cols > 0) {
- int w = 96 * template.prv_cols;
- int h = 96 * template.prv_rows + 20;
+ int w = 4 * U.widget_unit * template.prv_cols;
+ int h = 4 * U.widget_unit * template.prv_rows + U.widget_unit;
/* fake button, it holds space for search items */
uiDefBut(block, LABEL, 0, "", 10, 15, w, h, NULL, 0, 0, 0, 0, NULL);
- but = uiDefSearchBut(block, search, 0, ICON_VIEWZOOM, sizeof(search), 10, 0, w, 19,
- template.prv_rows, template.prv_cols, "");
+ but = uiDefSearchBut(block, search, 0, ICON_VIEWZOOM, sizeof(search), 10, 0, w, UI_UNIT_Y,
+ template.prv_rows, template.prv_cols, "");
uiButSetSearchFunc(but, id_search_cb, &template, id_search_call_cb, idptr.data);
}
/* list view */
else {
const int searchbox_width = uiSearchBoxWidth();
const int searchbox_height = uiSearchBoxHeight();
+
/* fake button, it holds space for search items */
uiDefBut(block, LABEL, 0, "", 10, 15, searchbox_width, searchbox_height, NULL, 0, 0, 0, 0, NULL);
-
but = uiDefSearchBut(block, search, 0, ICON_VIEWZOOM, sizeof(search), 10, 0, searchbox_width, UI_UNIT_Y - 1, 0, 0, "");
uiButSetSearchFunc(but, id_search_cb, &template, id_search_call_cb, idptr.data);
}
- uiBoundsBlock(block, 6);
+ uiBoundsBlock(block, 0.3f * U.widget_unit);
uiBlockSetDirection(block, UI_DOWN);
uiEndBlock(C, block);
@@ -1437,7 +1437,7 @@ static void colorband_buttons_large(uiLayout *layout, uiBlock *block, ColorBand
const int line2_y = yoffs + 65;
if (coba == NULL) return;
-
+
bt = uiDefBut(block, BUT, 0, IFACE_("Add"), 0 + xoffs, line1_y, 40, UI_UNIT_Y, NULL, 0, 0, 0, 0,
TIP_("Add a new color stop to the colorband"));
uiButSetNFunc(bt, colorband_add_cb, MEM_dupallocN(cb), coba);
@@ -1547,8 +1547,8 @@ void uiTemplateColorRamp(uiLayout *layout, PointerRNA *ptr, const char *propname
cb->ptr = *ptr;
cb->prop = prop;
- rect.xmin = 0; rect.xmax = 200;
- rect.ymin = 0; rect.ymax = 190;
+ rect.xmin = 0; rect.xmax = 10.0f * UI_UNIT_X;
+ rect.ymin = 0; rect.ymax = 19.5f * UI_UNIT_X;
block = uiLayoutAbsoluteBlock(layout);
colorband_buttons_layout(layout, block, cptr.data, &rect, !expand, cb);
@@ -1579,8 +1579,8 @@ void uiTemplateHistogram(uiLayout *layout, PointerRNA *ptr, const char *propname
cb->ptr = *ptr;
cb->prop = prop;
- rect.xmin = 0; rect.xmax = 200;
- rect.ymin = 0; rect.ymax = 190;
+ rect.xmin = 0; rect.xmax = 10.0f * UI_UNIT_X;
+ rect.ymin = 0; rect.ymax = 9.5f * UI_UNIT_Y;
block = uiLayoutAbsoluteBlock(layout);
//colorband_buttons_layout(layout, block, cptr.data, &rect, !expand, cb);
@@ -1589,8 +1589,9 @@ void uiTemplateHistogram(uiLayout *layout, PointerRNA *ptr, const char *propname
hist->height = (hist->height <= UI_UNIT_Y) ? UI_UNIT_Y : hist->height;
- bt = uiDefBut(block, HISTOGRAM, 0, "", rect.xmin, rect.ymin, BLI_rctf_size_x(&rect), hist->height, hist,
- 0, 0, 0, 0, "");
+ bt = uiDefBut(block, HISTOGRAM, 0, "", rect.xmin, rect.ymin, BLI_rctf_size_x(&rect), UI_DPI_FAC * hist->height,
+ hist, 0, 0, 0, 0, "");
+
uiButSetNFunc(bt, rna_update_cb, MEM_dupallocN(cb), NULL);
MEM_freeN(cb);
@@ -1620,15 +1621,15 @@ void uiTemplateWaveform(uiLayout *layout, PointerRNA *ptr, const char *propname)
cb->ptr = *ptr;
cb->prop = prop;
- rect.xmin = 0; rect.xmax = 200;
- rect.ymin = 0; rect.ymax = 190;
+ rect.xmin = 0; rect.xmax = 10.0f * UI_UNIT_X;
+ rect.ymin = 0; rect.ymax = 9.5f * UI_UNIT_Y;
block = uiLayoutAbsoluteBlock(layout);
scopes->wavefrm_height = (scopes->wavefrm_height <= UI_UNIT_Y) ? UI_UNIT_Y : scopes->wavefrm_height;
- bt = uiDefBut(block, WAVEFORM, 0, "", rect.xmin, rect.ymin, BLI_rctf_size_x(&rect), scopes->wavefrm_height, scopes,
- 0, 0, 0, 0, "");
+ bt = uiDefBut(block, WAVEFORM, 0, "", rect.xmin, rect.ymin, BLI_rctf_size_x(&rect), UI_DPI_FAC * scopes->wavefrm_height,
+ scopes, 0, 0, 0, 0, "");
(void)bt; /* UNUSED */
MEM_freeN(cb);
@@ -1658,15 +1659,15 @@ void uiTemplateVectorscope(uiLayout *layout, PointerRNA *ptr, const char *propna
cb->ptr = *ptr;
cb->prop = prop;
- rect.xmin = 0; rect.xmax = 200;
- rect.ymin = 0; rect.ymax = 190;
+ rect.xmin = 0; rect.xmax = 10.0f * UI_UNIT_X;
+ rect.ymin = 0; rect.ymax = 9.5f * UI_UNIT_Y;
block = uiLayoutAbsoluteBlock(layout);
scopes->vecscope_height = (scopes->vecscope_height <= UI_UNIT_Y) ? UI_UNIT_Y : scopes->vecscope_height;
bt = uiDefBut(block, VECTORSCOPE, 0, "", rect.xmin, rect.ymin, BLI_rctf_size_x(&rect),
- scopes->vecscope_height, scopes, 0, 0, 0, 0, "");
+ UI_DPI_FAC * scopes->vecscope_height, scopes, 0, 0, 0, 0, "");
uiButSetNFunc(bt, rna_update_cb, MEM_dupallocN(cb), NULL);
MEM_freeN(cb);
@@ -2010,7 +2011,7 @@ static void curvemap_buttons_layout(uiLayout *layout, PointerRNA *ptr, char labe
/* curve itself */
size = uiLayoutGetWidth(layout);
row = uiLayoutRow(layout, FALSE);
- uiDefBut(block, BUT_CURVE, 0, "", 0, 0, size, MIN2(size, 200), cumap, 0.0f, 1.0f, bg, 0, "");
+ uiDefBut(block, BUT_CURVE, 0, "", 0, 0, size, MIN2(size, 10.0f * UI_UNIT_X), cumap, 0.0f, 1.0f, bg, 0, "");
/* sliders for selected point */
for (i = 0; i < cm->totpoint; i++) {
@@ -2081,7 +2082,7 @@ void uiTemplateCurveMapping(uiLayout *layout, PointerRNA *ptr, const char *propn
/********************* ColorPicker Template ************************/
-#define WHEEL_SIZE 100
+#define WHEEL_SIZE (5*U.widget_unit)
/* This template now follows User Preference for type - name is not correct anymore... */
void uiTemplateColorPicker(uiLayout *layout, PointerRNA *ptr, const char *propname, int value_slider,
diff --git a/source/blender/editors/interface/interface_widgets.c b/source/blender/editors/interface/interface_widgets.c
index c4b80f0a42f..77fbe940c4a 100644
--- a/source/blender/editors/interface/interface_widgets.c
+++ b/source/blender/editors/interface/interface_widgets.c
@@ -333,10 +333,10 @@ static void round_box__edges(uiWidgetBase *wt, int roundboxalign, rcti *rect, fl
{
float vec[WIDGET_CURVE_RESOLU][2], veci[WIDGET_CURVE_RESOLU][2];
float minx = rect->xmin, miny = rect->ymin, maxx = rect->xmax, maxy = rect->ymax;
- float minxi = minx + 1.0f; /* boundbox inner */
- float maxxi = maxx - 1.0f;
- float minyi = miny + 1.0f;
- float maxyi = maxy - 1.0f;
+ float minxi = minx + U.pixelsize; /* boundbox inner */
+ float maxxi = maxx - U.pixelsize;
+ float minyi = miny + U.pixelsize;
+ float maxyi = maxy - U.pixelsize;
float facxi = (maxxi != minxi) ? 1.0f / (maxxi - minxi) : 0.0f; /* for uv, can divide by zero */
float facyi = (maxyi != minyi) ? 1.0f / (maxyi - minyi) : 0.0f;
int a, tot = 0, minsize;
@@ -352,7 +352,7 @@ static void round_box__edges(uiWidgetBase *wt, int roundboxalign, rcti *rect, fl
rad = 0.5f * minsize;
if (2.0f * (radi + 1.0f) > minsize)
- radi = 0.5f * minsize - 1.0f;
+ radi = 0.5f * minsize - U.pixelsize;
/* mult */
for (a = 0; a < WIDGET_CURVE_RESOLU; a++) {
@@ -481,7 +481,7 @@ static void round_box__edges(uiWidgetBase *wt, int roundboxalign, rcti *rect, fl
static void round_box_edges(uiWidgetBase *wt, int roundboxalign, rcti *rect, float rad)
{
- round_box__edges(wt, roundboxalign, rect, rad, rad - 1.0f);
+ round_box__edges(wt, roundboxalign, rect, rad, rad - U.pixelsize);
}
@@ -863,7 +863,7 @@ static int ui_but_draw_menu_icon(uiBut *but)
static void widget_draw_icon(uiBut *but, BIFIconID icon, float alpha, rcti *rect)
{
- int xs = 0, ys = 0;
+ float xs = 0.0f, ys = 0.0f;
float aspect, height;
if (but->flag & UI_ICON_PREVIEW) {
@@ -874,21 +874,13 @@ static void widget_draw_icon(uiBut *but, BIFIconID icon, float alpha, rcti *rect
/* this icon doesn't need draw... */
if (icon == ICON_BLANK1 && (but->flag & UI_ICON_SUBMENU) == 0) return;
- /* we need aspect from block, for menus... these buttons are scaled in uiPositionBlock() */
- aspect = but->block->aspect;
- if (aspect != but->aspect) {
- /* prevent scaling up icon in pupmenu */
- if (aspect < 1.0f) {
- height = UI_DPI_ICON_SIZE;
- aspect = 1.0f;
-
- }
- else
- height = UI_DPI_ICON_SIZE / aspect;
- }
- else
- height = UI_DPI_ICON_SIZE;
-
+ /* XXX remove hack when new icons are made */
+ if ( icon == ICON_LAYER_ACTIVE || icon == ICON_LAYER_USED)
+ height = 1.2f * BLI_rcti_size_y(rect); else
+ /* icons are 80% of height of button (16 pixels inside 20 height) */
+ height = 0.8f * BLI_rcti_size_y(rect);
+ aspect = height / ICON_DEFAULT_HEIGHT;
+
/* calculate blend color */
if (ELEM4(but->type, TOG, ROW, TOGN, LISTROW)) {
if (but->flag & UI_SELECT) {}
@@ -905,45 +897,45 @@ static void widget_draw_icon(uiBut *but, BIFIconID icon, float alpha, rcti *rect
if (but->flag & UI_ICON_LEFT) {
if (but->type == BUT_TOGDUAL) {
if (but->drawstr[0]) {
- xs = rect->xmin - 1;
+ xs = rect->xmin - 1.0f * aspect;
}
else {
- xs = (rect->xmin + rect->xmax - height) / 2;
+ xs = (rect->xmin + rect->xmax - height) / 2.0f;
}
}
else if (but->block->flag & UI_BLOCK_LOOP) {
if (but->type == SEARCH_MENU)
- xs = rect->xmin + 4;
+ xs = rect->xmin + 4.0f * aspect;
else
- xs = rect->xmin + 1;
+ xs = rect->xmin + 1.0f * aspect;
}
else if ((but->type == ICONROW) || (but->type == ICONTEXTROW)) {
- xs = rect->xmin + 3;
+ xs = rect->xmin + 3.0f * aspect;
}
else {
- xs = rect->xmin + 4;
+ xs = rect->xmin + 4.0f * aspect;
}
- ys = (rect->ymin + rect->ymax - height) / 2;
+ ys = (rect->ymin + rect->ymax - height) / 2.0f;
}
else {
- xs = (rect->xmin + rect->xmax - height) / 2;
- ys = (rect->ymin + rect->ymax - height) / 2;
+ xs = (rect->xmin + rect->xmax - height) / 2.0f;
+ ys = (rect->ymin + rect->ymax - height) / 2.0f;
}
-
+
/* to indicate draggable */
if (but->dragpoin && (but->flag & UI_ACTIVE)) {
float rgb[3] = {1.25f, 1.25f, 1.25f};
- UI_icon_draw_aspect_color(xs, ys, icon, aspect, rgb);
+ UI_icon_draw_aspect_color(xs, ys, icon, 1.0f / aspect, rgb);
}
else
- UI_icon_draw_aspect(xs, ys, icon, aspect, alpha);
+ UI_icon_draw_aspect(xs, ys, icon, 1.0f / aspect, alpha);
}
if (ui_but_draw_menu_icon(but)) {
- xs = rect->xmax - UI_DPI_ICON_SIZE - 1;
- ys = (rect->ymin + rect->ymax - height) / 2;
+ xs = rect->xmax - UI_DPI_ICON_SIZE - aspect;
+ ys = (rect->ymin + rect->ymax - height) / 2.0f;
- UI_icon_draw_aspect(xs, ys, ICON_RIGHTARROW_THIN, aspect, alpha);
+ UI_icon_draw_aspect(xs, ys, ICON_RIGHTARROW_THIN, 1.0f / aspect, alpha);
}
glDisable(GL_BLEND);
@@ -1329,14 +1321,15 @@ static void widget_draw_text_icon(uiFontStyle *fstyle, uiWidgetColors *wcol, uiB
if (but->flag & UI_HAS_ICON) {
widget_draw_icon(but, but->icon + but->iconadd, 1.0f, rect);
-
- rect->xmin += (int)((float)UI_icon_get_width(but->icon + but->iconadd) * UI_DPI_ICON_FAC);
+
+ /* icons default draw 0.8f x height */
+ rect->xmin += (int)(0.8f * BLI_rcti_size_y(rect));
if (but->editstr || (but->flag & UI_TEXT_LEFT))
- rect->xmin += 5;
+ rect->xmin += 0.4f * U.widget_unit;
}
else if ((but->flag & UI_TEXT_LEFT))
- rect->xmin += 5;
+ rect->xmin += 0.4f * U.widget_unit;
/* always draw text for textbutton cursor */
widget_draw_text(fstyle, wcol, but, rect);
@@ -1816,17 +1809,20 @@ static void widget_softshadow(rcti *rect, int roundboxalign, float radin, float
float quad_strip[WIDGET_SIZE_MAX * 2][2];
/* prevent tooltips to not show round shadow */
- if (2.0f * radout > 0.2f * BLI_rcti_size_y(&rect1))
+ if (radout > 0.2f * BLI_rcti_size_y(&rect1))
rect1.ymax -= 0.2f * BLI_rcti_size_y(&rect1);
else
- rect1.ymax -= 2.0f * radout;
+ rect1.ymax -= radout;
/* inner part */
totvert = round_box_shadow_edges(wtb.inner_v, &rect1, radin, roundboxalign & (UI_CNR_BOTTOM_RIGHT | UI_CNR_BOTTOM_LEFT), 0.0f);
/* inverse linear shadow alpha */
- alpha = 0.15;
- alphastep = 0.67;
+ alpha = 0.15f;
+ if (U.pixelsize > 1.0f)
+ alphastep = 0.78f;
+ else
+ alphastep = 0.67f;
glEnableClientState(GL_VERTEX_ARRAY);
@@ -1858,17 +1854,17 @@ static void widget_menu_back(uiWidgetColors *wcol, rcti *rect, int flag, int dir
}
else if (direction == UI_DOWN) {
roundboxalign = (UI_CNR_BOTTOM_RIGHT | UI_CNR_BOTTOM_LEFT);
- rect->ymin -= 4.0;
+ rect->ymin -= 0.1f * U.widget_unit;
}
else if (direction == UI_TOP) {
roundboxalign = UI_CNR_TOP_LEFT | UI_CNR_TOP_RIGHT;
- rect->ymax += 4.0;
+ rect->ymax += 0.1f * U.widget_unit;
}
glEnable(GL_BLEND);
- widget_softshadow(rect, roundboxalign, 5.0f, 8.0f);
+ widget_softshadow(rect, roundboxalign, 0.25f * U.widget_unit, 0.4f * U.widget_unit);
- round_box_edges(&wtb, roundboxalign, rect, 5.0f);
+ round_box_edges(&wtb, roundboxalign, rect, 0.25f * U.widget_unit);
wtb.emboss = 0;
widgetbase_draw(&wtb, wcol);
@@ -2540,14 +2536,15 @@ static void widget_numslider(uiBut *but, uiWidgetColors *wcol, rcti *rect, int s
fac = ((float)value - but->softmin) * (BLI_rcti_size_x(&rect1) - offs) / (but->softmax - but->softmin);
/* left part of slider, always rounded */
- rect1.xmax = rect1.xmin + ceil(offs + 1.0f);
+ rect1.xmax = rect1.xmin + ceil(offs + U.pixelsize);
round_box_edges(&wtb1, roundboxalign & ~(UI_CNR_TOP_RIGHT | UI_CNR_BOTTOM_RIGHT), &rect1, offs);
wtb1.outline = 0;
widgetbase_draw(&wtb1, wcol);
/* right part of slider, interpolate roundness */
rect1.xmax = rect1.xmin + fac + offs;
- rect1.xmin += floor(offs - 1.0f);
+ rect1.xmin += floor(offs - U.pixelsize);
+
if (rect1.xmax + offs > rect->xmax)
offs *= (rect1.xmax + offs - rect->xmax) / offs;
else
@@ -2577,7 +2574,7 @@ static void widget_numslider(uiBut *but, uiWidgetColors *wcol, rcti *rect, int s
static void widget_swatch(uiBut *but, uiWidgetColors *wcol, rcti *rect, int state, int roundboxalign)
{
uiWidgetBase wtb;
- float col[4];
+ float rad, col[4];
int color_profile = but->block->color_profile;
col[3] = 1.0f;
@@ -2594,7 +2591,8 @@ static void widget_swatch(uiBut *but, uiWidgetColors *wcol, rcti *rect, int stat
widget_init(&wtb);
/* half rounded */
- round_box_edges(&wtb, roundboxalign, rect, 5.0f);
+ rad = 0.25f * U.widget_unit;
+ round_box_edges(&wtb, roundboxalign, rect, rad);
ui_get_but_vectorf(but, col);
@@ -2608,7 +2606,7 @@ static void widget_swatch(uiBut *but, uiWidgetColors *wcol, rcti *rect, int stat
rect->ymin += SWATCH_KEYED_BORDER;
rect->ymax -= SWATCH_KEYED_BORDER;
- round_box_edges(&wtb, roundboxalign, rect, 5.0f);
+ round_box_edges(&wtb, roundboxalign, rect, rad);
}
if (color_profile)
@@ -2632,12 +2630,14 @@ static void widget_icon_has_anim(uiBut *UNUSED(but), uiWidgetColors *wcol, rcti
{
if (state & (UI_BUT_ANIMATED | UI_BUT_ANIMATED_KEY | UI_BUT_DRIVEN | UI_BUT_REDALERT)) {
uiWidgetBase wtb;
-
+ float rad;
+
widget_init(&wtb);
wtb.outline = 0;
/* rounded */
- round_box_edges(&wtb, UI_CNR_ALL, rect, 10.0f);
+ rad = 0.5f * BLI_rcti_size_y(rect);
+ round_box_edges(&wtb, UI_CNR_ALL, rect, rad);
widgetbase_draw(&wtb, wcol);
}
}
@@ -2646,6 +2646,7 @@ static void widget_icon_has_anim(uiBut *UNUSED(but), uiWidgetColors *wcol, rcti
static void widget_textbut(uiWidgetColors *wcol, rcti *rect, int state, int roundboxalign)
{
uiWidgetBase wtb;
+ float rad;
if (state & UI_SELECT)
SWAP(short, wcol->shadetop, wcol->shadedown);
@@ -2653,7 +2654,8 @@ static void widget_textbut(uiWidgetColors *wcol, rcti *rect, int state, int roun
widget_init(&wtb);
/* half rounded */
- round_box_edges(&wtb, roundboxalign, rect, 4.0f);
+ rad = 0.2f * U.widget_unit;
+ round_box_edges(&wtb, roundboxalign, rect, rad);
widgetbase_draw(&wtb, wcol);
@@ -2663,11 +2665,13 @@ static void widget_textbut(uiWidgetColors *wcol, rcti *rect, int state, int roun
static void widget_menubut(uiWidgetColors *wcol, rcti *rect, int UNUSED(state), int roundboxalign)
{
uiWidgetBase wtb;
+ float rad;
widget_init(&wtb);
/* half rounded */
- round_box_edges(&wtb, roundboxalign, rect, 4.0f);
+ rad = 0.2f * U.widget_unit;
+ round_box_edges(&wtb, roundboxalign, rect, rad);
/* decoration */
widget_menu_trias(&wtb.tria1, rect);
@@ -2681,11 +2685,13 @@ static void widget_menubut(uiWidgetColors *wcol, rcti *rect, int UNUSED(state),
static void widget_menuiconbut(uiWidgetColors *wcol, rcti *rect, int UNUSED(state), int roundboxalign)
{
uiWidgetBase wtb;
+ float rad;
widget_init(&wtb);
/* half rounded */
- round_box_edges(&wtb, roundboxalign, rect, 4.0f);
+ rad = 0.2f * U.widget_unit;
+ round_box_edges(&wtb, roundboxalign, rect, rad);
/* decoration */
widgetbase_draw(&wtb, wcol);
@@ -2696,11 +2702,13 @@ static void widget_menunodebut(uiWidgetColors *wcol, rcti *rect, int UNUSED(stat
/* silly node link button hacks */
uiWidgetBase wtb;
uiWidgetColors wcol_backup = *wcol;
+ float rad;
widget_init(&wtb);
/* half rounded */
- round_box_edges(&wtb, roundboxalign, rect, 4.0f);
+ rad = 0.2f * U.widget_unit;
+ round_box_edges(&wtb, roundboxalign, rect, rad);
wcol->inner[0] += 15;
wcol->inner[1] += 15;
@@ -2718,7 +2726,7 @@ static void widget_pulldownbut(uiWidgetColors *wcol, rcti *rect, int state, int
{
if (state & UI_ACTIVE) {
uiWidgetBase wtb;
- float rad = 0.25f * BLI_rcti_size_y(rect); /* 4.0f */
+ float rad = 0.2f * U.widget_unit;
widget_init(&wtb);
@@ -2745,12 +2753,14 @@ static void widget_menu_itembut(uiWidgetColors *wcol, rcti *rect, int UNUSED(sta
static void widget_list_itembut(uiWidgetColors *wcol, rcti *rect, int UNUSED(state), int UNUSED(roundboxalign))
{
uiWidgetBase wtb;
+ float rad;
widget_init(&wtb);
/* rounded, but no outline */
wtb.outline = 0;
- round_box_edges(&wtb, UI_CNR_ALL, rect, 4.0f);
+ rad = 0.2f * U.widget_unit;
+ round_box_edges(&wtb, UI_CNR_ALL, rect, rad);
widgetbase_draw(&wtb, wcol);
}
@@ -2759,6 +2769,7 @@ static void widget_optionbut(uiWidgetColors *wcol, rcti *rect, int state, int UN
{
uiWidgetBase wtb;
rcti recttemp = *rect;
+ float rad;
int delta;
widget_init(&wtb);
@@ -2774,7 +2785,8 @@ static void widget_optionbut(uiWidgetColors *wcol, rcti *rect, int state, int UN
recttemp.ymax -= delta;
/* half rounded */
- round_box_edges(&wtb, UI_CNR_ALL, &recttemp, 4.0f);
+ rad = 0.2f * U.widget_unit;
+ round_box_edges(&wtb, UI_CNR_ALL, &recttemp, rad);
/* decoration */
if (state & UI_SELECT) {
@@ -2791,11 +2803,13 @@ static void widget_optionbut(uiWidgetColors *wcol, rcti *rect, int state, int UN
static void widget_radiobut(uiWidgetColors *wcol, rcti *rect, int UNUSED(state), int roundboxalign)
{
uiWidgetBase wtb;
+ float rad;
widget_init(&wtb);
/* half rounded */
- round_box_edges(&wtb, roundboxalign, rect, 4.0f);
+ rad = 0.2f * U.widget_unit;
+ round_box_edges(&wtb, roundboxalign, rect, rad);
widgetbase_draw(&wtb, wcol);
@@ -2804,6 +2818,7 @@ static void widget_radiobut(uiWidgetColors *wcol, rcti *rect, int UNUSED(state),
static void widget_box(uiBut *but, uiWidgetColors *wcol, rcti *rect, int UNUSED(state), int roundboxalign)
{
uiWidgetBase wtb;
+ float rad;
char old_col[3];
widget_init(&wtb);
@@ -2818,7 +2833,8 @@ static void widget_box(uiBut *but, uiWidgetColors *wcol, rcti *rect, int UNUSED(
}
/* half rounded */
- round_box_edges(&wtb, roundboxalign, rect, 4.0f);
+ rad = 0.2f * U.widget_unit;
+ round_box_edges(&wtb, roundboxalign, rect, rad);
widgetbase_draw(&wtb, wcol);
@@ -2833,12 +2849,14 @@ static void widget_box(uiBut *but, uiWidgetColors *wcol, rcti *rect, int UNUSED(
static void widget_but(uiWidgetColors *wcol, rcti *rect, int UNUSED(state), int roundboxalign)
{
uiWidgetBase wtb;
+ float rad;
widget_init(&wtb);
/* half rounded */
- round_box_edges(&wtb, roundboxalign, rect, 4.0f);
-
+ rad = 0.2f * U.widget_unit;
+ round_box_edges(&wtb, roundboxalign, rect, rad);
+
widgetbase_draw(&wtb, wcol);
}
@@ -2846,7 +2864,7 @@ static void widget_but(uiWidgetColors *wcol, rcti *rect, int UNUSED(state), int
static void widget_roundbut(uiWidgetColors *wcol, rcti *rect, int UNUSED(state), int roundboxalign)
{
uiWidgetBase wtb;
- float rad = 5.0f; /* 0.5f * BLI_rcti_size_y(rect); */
+ float rad = 0.25f * U.widget_unit;
widget_init(&wtb);
@@ -2859,6 +2877,7 @@ static void widget_roundbut(uiWidgetColors *wcol, rcti *rect, int UNUSED(state),
static void widget_draw_extra_mask(const bContext *C, uiBut *but, uiWidgetType *wt, rcti *rect)
{
uiWidgetBase wtb;
+ float rad = 0.25f * U.widget_unit;
unsigned char col[4];
/* state copy! */
@@ -2874,12 +2893,12 @@ static void widget_draw_extra_mask(const bContext *C, uiBut *but, uiWidgetType *
UI_GetThemeColor3ubv(TH_BACK, col);
glColor3ubv(col);
- round_box__edges(&wtb, UI_CNR_ALL, rect, 0.0f, 4.0);
+ round_box__edges(&wtb, UI_CNR_ALL, rect, 0.0f, rad);
widgetbase_outline(&wtb);
}
/* outline */
- round_box_edges(&wtb, UI_CNR_ALL, rect, 5.0f);
+ round_box_edges(&wtb, UI_CNR_ALL, rect, rad);
wtb.outline = 1;
wtb.inner = 0;
widgetbase_draw(&wtb, &wt->wcol);
@@ -3068,9 +3087,9 @@ static int widget_roundbox_set(uiBut *but, rcti *rect)
/* ui_block_position has this correction too, keep in sync */
if (but->flag & UI_BUT_ALIGN_TOP)
- rect->ymax += 1;
+ rect->ymax += U.pixelsize;
if (but->flag & UI_BUT_ALIGN_LEFT)
- rect->xmin -= 1;
+ rect->xmin -= U.pixelsize;
switch (but->flag & UI_BUT_ALIGN) {
case UI_BUT_ALIGN_TOP:
@@ -3381,7 +3400,7 @@ void ui_draw_search_back(uiStyle *UNUSED(style), uiBlock *block, rcti *rect)
uiWidgetType *wt = widget_type(UI_WTYPE_BOX);
glEnable(GL_BLEND);
- widget_softshadow(rect, UI_CNR_ALL, 5.0f, 8.0f);
+ widget_softshadow(rect, UI_CNR_ALL, 0.25f * U.widget_unit, 0.4f * U.widget_unit);
glDisable(GL_BLEND);
wt->state(wt, 0);
@@ -3408,7 +3427,7 @@ void ui_draw_menu_item(uiFontStyle *fstyle, rcti *rect, const char *name, int ic
fstyle->align = UI_STYLE_TEXT_LEFT;
/* text location offset */
- rect->xmin += 5;
+ rect->xmin += 0.25f * UI_UNIT_X;
if (iconid) rect->xmin += UI_DPI_ICON_SIZE;
/* cut string in 2 parts? */
@@ -3433,10 +3452,16 @@ void ui_draw_menu_item(uiFontStyle *fstyle, rcti *rect, const char *name, int ic
*rect = _rect;
if (iconid) {
- int xs = rect->xmin + 4;
+ float height, aspect;
+ int xs = rect->xmin + 0.2f * UI_UNIT_X;
int ys = 1 + (rect->ymin + rect->ymax - UI_DPI_ICON_SIZE) / 2;
+
+ /* icons are 80% of height of button (16 pixels inside 20 height) */
+ height = 0.8f * BLI_rcti_size_y(rect);
+ aspect = ICON_DEFAULT_HEIGHT / height;
+
glEnable(GL_BLEND);
- UI_icon_draw_aspect(xs, ys, iconid, 1.2f, 0.5f); /* XXX scale weak get from fstyle? */
+ UI_icon_draw_aspect(xs, ys, iconid, aspect, 0.5f); /* XXX scale weak get from fstyle? */
glDisable(GL_BLEND);
}
}
diff --git a/source/blender/editors/interface/resources.c b/source/blender/editors/interface/resources.c
index fa5d5806bb8..3a482b97d37 100644
--- a/source/blender/editors/interface/resources.c
+++ b/source/blender/editors/interface/resources.c
@@ -1990,7 +1990,7 @@ 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;
+ U.widget_unit = 20;
if (U.anisotropic_filter <= 0)
U.anisotropic_filter = 1;
@@ -2009,6 +2009,23 @@ void init_userdef_do_versions(void)
if (U.tweak_threshold == 0)
U.tweak_threshold = 10;
+ if (bmain->versionfile < 265) { /* XXX fix for when you apply */
+ bTheme *btheme;
+
+ for (btheme = U.themes.first; btheme; btheme = btheme->next) {
+ /* note: the toggle operator for transparent backdrops limits to these spacetypes */
+ if (btheme->tnode.button[3] == 255) {
+ btheme->tv3d.button[3] = 128;
+ btheme->tnode.button[3] = 128;
+ btheme->tima.button[3] = 128;
+ btheme->tseq.button[3] = 128;
+ btheme->tclip.button[3] = 128;
+ }
+ }
+ }
+ if (U.pixelsize == 0.0f)
+ U.pixelsize = 1.0f;
+
/* funny name, but it is GE stuff, moves userdef stuff to engine */
// XXX space_set_commmandline_options();
/* this timer uses U */
diff --git a/source/blender/editors/interface/view2d.c b/source/blender/editors/interface/view2d.c
index f1a3f59bc22..356b5a687ff 100644
--- a/source/blender/editors/interface/view2d.c
+++ b/source/blender/editors/interface/view2d.c
@@ -1150,7 +1150,7 @@ View2DGrid *UI_view2d_grid_calc(Scene *scene, View2D *v2d,
pixels = (float)BLI_rcti_size_x(&v2d->mask);
if (pixels != 0.0f) {
- grid->dx = (U.v2d_min_gridsize * space) / (seconddiv * pixels);
+ grid->dx = (U.v2d_min_gridsize * U.pixelsize * space) / (seconddiv * pixels);
step_to_grid(&grid->dx, &grid->powerx, xunits);
grid->dx *= seconddiv;
}
@@ -1167,7 +1167,7 @@ View2DGrid *UI_view2d_grid_calc(Scene *scene, View2D *v2d,
space = BLI_rctf_size_y(&v2d->cur);
pixels = (float)winy;
- grid->dy = U.v2d_min_gridsize * space / pixels;
+ grid->dy = U.v2d_min_gridsize * U.pixelsize * space / pixels;
step_to_grid(&grid->dy, &grid->powery, yunits);
if (yclamp == V2D_GRID_CLAMP) {
@@ -1212,7 +1212,7 @@ void UI_view2d_grid_draw(View2D *v2d, View2DGrid *grid, int flag)
vec2[1] = v2d->cur.ymax;
/* minor gridlines */
- step = (BLI_rcti_size_x(&v2d->mask) + 1) / U.v2d_min_gridsize;
+ step = (BLI_rcti_size_x(&v2d->mask) + 1) / (U.v2d_min_gridsize * U.pixelsize);
UI_ThemeColor(TH_GRID);
for (a = 0; a < step; a++) {
@@ -1246,7 +1246,7 @@ void UI_view2d_grid_draw(View2D *v2d, View2DGrid *grid, int flag)
vec1[0] = grid->startx;
vec2[0] = v2d->cur.xmax;
- step = (BLI_rcti_size_y(&v2d->mask) + 1) / U.v2d_min_gridsize;
+ step = (BLI_rcti_size_y(&v2d->mask) + 1) / (U.v2d_min_gridsize * U.pixelsize);
UI_ThemeColor(TH_GRID);
for (a = 0; a <= step; a++) {
@@ -1427,6 +1427,7 @@ View2DScrollers *UI_view2d_scrollers_calc(const bContext *C, View2D *v2d,
rcti vert, hor;
float fac1, fac2, totsize, scrollsize;
int scroll = view2d_scroll_mapped(v2d->scroll);
+ int smaller;
/* scrollers is allocated here... */
scrollers = MEM_callocN(sizeof(View2DScrollers), "View2DScrollers");
@@ -1435,19 +1436,20 @@ View2DScrollers *UI_view2d_scrollers_calc(const bContext *C, View2D *v2d,
hor = v2d->hor;
/* slider rects need to be smaller than region */
- hor.xmin += 4;
- hor.xmax -= 4;
+ smaller = (int)(0.2f * U.widget_unit);
+ hor.xmin += smaller;
+ hor.xmax -= smaller;
if (scroll & V2D_SCROLL_BOTTOM)
- hor.ymin += 4;
+ hor.ymin += smaller;
else
- hor.ymax -= 4;
+ hor.ymax -= smaller;
if (scroll & V2D_SCROLL_LEFT)
- vert.xmin += 4;
+ vert.xmin += smaller;
else
- vert.xmax -= 4;
- vert.ymin += 4;
- vert.ymax -= 4;
+ vert.xmax -= smaller;
+ vert.ymin += smaller;
+ vert.ymax -= smaller;
CLAMP(vert.ymin, vert.ymin, vert.ymax - V2D_SCROLLER_HANDLE_SIZE);
CLAMP(hor.xmin, hor.xmin, hor.xmax - V2D_SCROLLER_HANDLE_SIZE);
@@ -1621,6 +1623,7 @@ void UI_view2d_scrollers_draw(const bContext *C, View2D *v2d, View2DScrollers *v
uiWidgetColors wcol = btheme->tui.wcol_scroll;
rcti slider;
int state;
+ unsigned char col[4];
slider.xmin = vs->hor_min;
slider.xmax = vs->hor_max;
@@ -1643,8 +1646,12 @@ void UI_view2d_scrollers_draw(const bContext *C, View2D *v2d, View2DScrollers *v
state |= UI_SCROLL_ARROWS;
}
- UI_ThemeColor(TH_BACK);
- glRecti(v2d->hor.xmin, v2d->hor.ymin, v2d->hor.xmax, v2d->hor.ymax);
+ /* clean rect behind slider, but not with transparent background */
+ UI_GetThemeColor4ubv(TH_BACK, col);
+ if (col[3] == 255) {
+ glColor3ub(col[0], col[1],col[2]);
+ glRecti(v2d->hor.xmin, v2d->hor.ymin, v2d->hor.xmax, v2d->hor.ymax);
+ }
uiWidgetScrollDraw(&wcol, &hor, &slider, state);
}
@@ -1680,12 +1687,12 @@ void UI_view2d_scrollers_draw(const bContext *C, View2D *v2d, View2DScrollers *v
/* draw numbers in the appropriate range */
if (dfac > 0.0f) {
- float h = 2.0f + (float)(hor.ymin);
+ float h = 0.1f*UI_UNIT_Y + (float)(hor.ymin);
- for (; fac < hor.xmax - 10; fac += dfac, val += grid->dx) {
+ for (; fac < hor.xmax - 0.5f * U.widget_unit; fac += dfac, val += grid->dx) {
/* make prints look nicer for scrollers */
- if (fac < hor.xmin + 10)
+ if (fac < hor.xmin + 0.5f * U.widget_unit)
continue;
switch (vs->xunits) {
@@ -1732,6 +1739,7 @@ void UI_view2d_scrollers_draw(const bContext *C, View2D *v2d, View2DScrollers *v
uiWidgetColors wcol = btheme->tui.wcol_scroll;
rcti slider;
int state;
+ unsigned char col[4];
slider.xmin = vert.xmin;
slider.xmax = vert.xmax;
@@ -1753,9 +1761,13 @@ void UI_view2d_scrollers_draw(const bContext *C, View2D *v2d, View2DScrollers *v
{
state |= UI_SCROLL_ARROWS;
}
-
- UI_ThemeColor(TH_BACK);
- glRecti(v2d->vert.xmin, v2d->vert.ymin, v2d->vert.xmax, v2d->vert.ymax);
+
+ /* clean rect behind slider, but not with transparent background */
+ UI_GetThemeColor4ubv(TH_BACK, col);
+ if (col[3] == 255) {
+ glColor3ub(col[0], col[1],col[2]);
+ glRecti(v2d->vert.xmin, v2d->vert.ymin, v2d->vert.xmax, v2d->vert.ymax);
+ }
uiWidgetScrollDraw(&wcol, &vert, &slider, state);
}