diff options
author | Campbell Barton <ideasman42@gmail.com> | 2011-05-05 19:21:43 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2011-05-05 19:21:43 +0400 |
commit | 53a2f11148a95bf9c3c36a6e567e80f243b758c1 (patch) | |
tree | 5635a1641c2b9fb92f002ab0b41ded327e22c86b /source/blender/editors | |
parent | 05a78baa87f0cb92be53b736e5a0d3ddee349f21 (diff) |
fix [#27285] Renderslot missing
scale fixes size header buttons by DPI
Diffstat (limited to 'source/blender/editors')
-rw-r--r-- | source/blender/editors/include/UI_interface.h | 4 | ||||
-rw-r--r-- | source/blender/editors/space_image/image_buttons.c | 6 | ||||
-rw-r--r-- | source/blender/editors/space_view3d/view3d_header.c | 7 |
3 files changed, 12 insertions, 5 deletions
diff --git a/source/blender/editors/include/UI_interface.h b/source/blender/editors/include/UI_interface.h index 821f0e05a36..d6988aa9618 100644 --- a/source/blender/editors/include/UI_interface.h +++ b/source/blender/editors/include/UI_interface.h @@ -160,6 +160,10 @@ typedef struct uiLayout uiLayout; #define UI_PANEL_WIDTH 340 #define UI_COMPACT_PANEL_WIDTH 160 +/* scale fixed button widths by this to account for DPI + * 8.4852 == sqrtf(72.0f)) */ +#define UI_DPI_FAC (sqrtf((float)U.dpi) / 8.48528137423857f) + /* Button types, bits stored in 1 value... and a short even! - bits 0-4: bitnr (0-31) - bits 5-7: pointer type diff --git a/source/blender/editors/space_image/image_buttons.c b/source/blender/editors/space_image/image_buttons.c index 0fd7ac3e754..c48078118a7 100644 --- a/source/blender/editors/space_image/image_buttons.c +++ b/source/blender/editors/space_image/image_buttons.c @@ -593,6 +593,7 @@ static void uiblock_layer_pass_arrow_buttons(uiLayout *layout, RenderResult *rr, uiBlock *block= uiLayoutGetBlock(layout); uiLayout *row; uiBut *but; + const float dpi_fac= UI_DPI_FAC; row= uiLayoutRow(layout, 1); @@ -609,7 +610,7 @@ static void uiblock_layer_pass_arrow_buttons(uiLayout *layout, RenderResult *rr, but= uiDefIconBut(block, BUT, 0, ICON_TRIA_RIGHT, 0,0,18,20, NULL, 0, 0, 0, 0, "Next Layer"); uiButSetFunc(but, image_multi_inclay_cb, rr, iuser); - uiblock_layer_pass_buttons(row, rr, iuser, 230, render_slot); + uiblock_layer_pass_buttons(row, rr, iuser, 230 * dpi_fac, render_slot); /* decrease, increase arrows */ but= uiDefIconBut(block, BUT, 0, ICON_TRIA_LEFT, 0,0,17,20, NULL, 0, 0, 0, 0, "Previous Pass"); @@ -841,8 +842,9 @@ void uiTemplateImageLayers(uiLayout *layout, bContext *C, Image *ima, ImageUser /* render layers and passes */ if(ima && iuser) { + const float dpi_fac= UI_DPI_FAC; rr= BKE_image_acquire_renderresult(scene, ima); - uiblock_layer_pass_buttons(layout, rr, iuser, 160, (ima->type==IMA_TYPE_R_RESULT)? &ima->render_slot: NULL); + uiblock_layer_pass_buttons(layout, rr, iuser, 160 * dpi_fac, (ima->type==IMA_TYPE_R_RESULT)? &ima->render_slot: NULL); BKE_image_release_renderresult(scene, ima); } } diff --git a/source/blender/editors/space_view3d/view3d_header.c b/source/blender/editors/space_view3d/view3d_header.c index 63c3c6901c3..aad9c1dd3ff 100644 --- a/source/blender/editors/space_view3d/view3d_header.c +++ b/source/blender/editors/space_view3d/view3d_header.c @@ -272,7 +272,7 @@ void VIEW3D_OT_layers(wmOperatorType *ot) static char *view3d_modeselect_pup(Scene *scene) { Object *ob= OBACT; - static char string[1024]; + static char string[256]; static char formatstr[] = "|%s %%x%d %%i%d"; char *str = string; @@ -465,6 +465,7 @@ void uiTemplateHeader3D(uiLayout *layout, struct bContext *C) Object *obedit = CTX_data_edit_object(C); uiBlock *block; uiLayout *row; + const float dpi_fac= UI_DPI_FAC; RNA_pointer_create(&screen->id, &RNA_SpaceView3D, v3d, &v3dptr); RNA_pointer_create(&scene->id, &RNA_ToolSettings, ts, &toolsptr); @@ -484,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,20, &(v3d->modeselect), 0, 0, 0, 0, "Mode"); + 0,0,126 * dpi_fac,20, &(v3d->modeselect), 0, 0, 0, 0, "Mode"); uiBlockEndAlign(block); /* Draw type */ @@ -531,7 +532,7 @@ void uiTemplateHeader3D(uiLayout *layout, struct bContext *C) } str_menu = BIF_menustringTransformOrientation(C, "Orientation"); - uiDefButS(block, MENU, B_MAN_MODE, str_menu,0,0,70,YIC, &v3d->twmode, 0, 0, 0, 0, "Transform Orientation"); + uiDefButS(block, MENU, B_MAN_MODE, str_menu,0,0,70 * dpi_fac, YIC, &v3d->twmode, 0, 0, 0, 0, "Transform Orientation"); MEM_freeN((void *)str_menu); } |