file selector now scales with DPI better
authorCampbell Barton <ideasman42@gmail.com>
Sun, 5 Jun 2011 14:00:06 +0000 (14:00 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Sun, 5 Jun 2011 14:00:06 +0000 (14:00 +0000)
source/blender/editors/include/UI_interface_icons.h
source/blender/editors/space_file/file_draw.c
source/blender/editors/space_file/filesel.c

index 50b14cb..b6837a4 100644 (file)
@@ -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
 
 /*
index 8cef65e..a6fee35 100644 (file)
@@ -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);
index 968953a..793267b 100644 (file)
@@ -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 +