fix [#27285] Renderslot missing

scale fixes size header buttons by DPI
This commit is contained in:
Campbell Barton 2011-05-05 15:21:43 +00:00
parent 05a78baa87
commit 53a2f11148
3 changed files with 12 additions and 5 deletions

View File

@ -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

View File

@ -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);
}
}

View File

@ -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);
}