diff options
Diffstat (limited to 'source/blender/editors/interface/interface.c')
-rw-r--r-- | source/blender/editors/interface/interface.c | 32 |
1 files changed, 19 insertions, 13 deletions
diff --git a/source/blender/editors/interface/interface.c b/source/blender/editors/interface/interface.c index ce82e064531..807f5279821 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); @@ -2786,6 +2787,10 @@ static uiBut *ui_def_but_rna(uiBlock *block, int type, int retval, const char *s uiBut *but; int freestr = 0, icon = 0; + if (ELEM3(type, COLOR, HSVCIRCLE, HSVCUBE)) { + BLI_assert(index == -1); + } + /* use rna values if parameters are not specified */ if (!str) { if (type == MENU && proptype == PROP_ENUM) { @@ -2826,12 +2831,13 @@ static uiBut *ui_def_but_rna(uiBlock *block, int type, int retval, const char *s EnumPropertyItem *item; int i, totitem, free; - /* TODO, translate after getting the item, saves many lookups */ - RNA_property_enum_items_gettexted(block->evil_C, ptr, prop, &item, &totitem, &free); + /* get untranslated, then translate the single string we need */ + RNA_property_enum_items(block->evil_C, ptr, prop, &item, &totitem, &free); for (i = 0; i < totitem; i++) { if (item[i].identifier[0] && item[i].value == (int)max) { - str = item[i].name; + str = CTX_IFACE_(RNA_property_translation_context(prop), item[i].name); icon = item[i].icon; + break; } } |