From 08f44adba965dbf4f7c56eb096b0e2709df80e5c Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sun, 5 Jun 2011 14:00:06 +0000 Subject: [PATCH] file selector now scales with DPI better --- source/blender/editors/include/UI_interface_icons.h | 4 ++++ source/blender/editors/space_file/file_draw.c | 4 ++-- source/blender/editors/space_file/filesel.c | 8 +++++--- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/source/blender/editors/include/UI_interface_icons.h b/source/blender/editors/include/UI_interface_icons.h index 50b14cb832a..b6837a4b3c9 100644 --- a/source/blender/editors/include/UI_interface_icons.h +++ b/source/blender/editors/include/UI_interface_icons.h @@ -49,6 +49,10 @@ typedef struct IconFile { #define ICON_DEFAULT_HEIGHT 16 #define ICON_DEFAULT_WIDTH 16 + +#define ICON_DEFAULT_HEIGHT_SCALE (UI_UNIT_Y * 0.8f) +#define ICON_DEFAULT_WIDTH_SCALE (UI_UNIT_X * 0.8f) + #define PREVIEW_DEFAULT_HEIGHT 96 /* diff --git a/source/blender/editors/space_file/file_draw.c b/source/blender/editors/space_file/file_draw.c index 8cef65ea4a2..a6fee359197 100644 --- a/source/blender/editors/space_file/file_draw.c +++ b/source/blender/editors/space_file/file_draw.c @@ -517,8 +517,8 @@ void file_draw_list(const bContext *C, ARegion *ar) file_draw_preview(block, file, sx, sy, imb, layout, !is_icon && (file->flags & IMAGEFILE)); } else { - file_draw_icon(block, file->path, sx, sy-3, get_file_icon(file), ICON_DEFAULT_WIDTH, ICON_DEFAULT_WIDTH); - sx += ICON_DEFAULT_WIDTH + 4; + file_draw_icon(block, file->path, sx, sy-(UI_UNIT_Y / 6), get_file_icon(file), ICON_DEFAULT_WIDTH_SCALE, ICON_DEFAULT_WIDTH_SCALE); + sx += ICON_DEFAULT_WIDTH_SCALE + 4; } UI_ThemeColor4(TH_TEXT); diff --git a/source/blender/editors/space_file/filesel.c b/source/blender/editors/space_file/filesel.c index 968953abf62..793267bfa8c 100644 --- a/source/blender/editors/space_file/filesel.c +++ b/source/blender/editors/space_file/filesel.c @@ -403,10 +403,12 @@ float file_font_pointsize(void) uiStyleFontSet(&style->widget); s = BLF_height(style->widget.uifont_id, tmp); return style->widget.points; -#else +#elif 0 uiStyle *style= U.uistyles.first; uiStyleFontSet(&style->widget); return style->widget.points; +#else + return UI_UNIT_Y * 0.6666f; #endif } @@ -497,11 +499,11 @@ void ED_fileselect_init_layout(struct SpaceFile *sfile, struct ARegion *ar) column_widths(sfile->files, layout); if (params->display == FILE_SHORTDISPLAY) { - maxlen = ICON_DEFAULT_WIDTH + 4 + + maxlen = ICON_DEFAULT_WIDTH_SCALE + 4 + (int)layout->column_widths[COLUMN_NAME] + 12 + (int)layout->column_widths[COLUMN_SIZE] + 12; } else { - maxlen = ICON_DEFAULT_WIDTH + 4 + + maxlen = ICON_DEFAULT_WIDTH_SCALE + 4 + (int)layout->column_widths[COLUMN_NAME] + 12 + #ifndef WIN32 (int)layout->column_widths[COLUMN_MODE1] + 12 +