diff options
author | Bastien Montagne <montagne29@wanadoo.fr> | 2015-04-29 22:25:34 +0300 |
---|---|---|
committer | Bastien Montagne <montagne29@wanadoo.fr> | 2015-04-29 22:30:33 +0300 |
commit | 054aa61f3c9af0997cbb0ecf89f73227723a24cd (patch) | |
tree | 12633d0b7c8727a645050fc852efa028456c893b /source/blender/editors/space_file | |
parent | 3de45ee7fe451ab4267b824a569a2173660d2575 (diff) |
File browser - change thumbnails size with a slider
We can now scale from 32px up to 256px (default has been upgraded to 128px).
Thumbnails are now generated as 'large', i.e. 256px.
Previews are scaled up if necessary, unlike icons (for folders or files without preview images).
Note that .blend thumbnails themselves remain in 128px for now (they are embeded in .blend files,
not quite sure we want to make them four times bigger...).
Patch by DMS (Yaron Dames), with final edits by myself.
Reviewers: mont29
Subscribers: Severin, mont29
Differential Revision: https://developer.blender.org/D1260
Diffstat (limited to 'source/blender/editors/space_file')
-rw-r--r-- | source/blender/editors/space_file/file_draw.c | 16 | ||||
-rw-r--r-- | source/blender/editors/space_file/filelist.c | 2 | ||||
-rw-r--r-- | source/blender/editors/space_file/filesel.c | 6 |
3 files changed, 15 insertions, 9 deletions
diff --git a/source/blender/editors/space_file/file_draw.c b/source/blender/editors/space_file/file_draw.c index 9763efbc7b5..d5b9c169192 100644 --- a/source/blender/editors/space_file/file_draw.c +++ b/source/blender/editors/space_file/file_draw.c @@ -329,6 +329,7 @@ static void file_draw_preview(uiBlock *block, struct direntry *file, int sx, int float fx, fy; float dx, dy; int xco, yco; + float ui_imbx, ui_imby; float scaledx, scaledy; float scale; int ex, ey; @@ -336,23 +337,26 @@ static void file_draw_preview(uiBlock *block, struct direntry *file, int sx, int BLI_assert(imb != NULL); - if ((imb->x * UI_DPI_FAC > layout->prv_w) || - (imb->y * UI_DPI_FAC > layout->prv_h)) + ui_imbx = imb->x * UI_DPI_FAC; + ui_imby = imb->y * UI_DPI_FAC; + /* Unlike thumbnails, icons are not scaled up. */ + if (((ui_imbx > layout->prv_w) || (ui_imby > layout->prv_h)) || + (!is_icon && ((ui_imbx < layout->prv_w) || (ui_imby < layout->prv_h)))) { if (imb->x > imb->y) { scaledx = (float)layout->prv_w; - scaledy = ( (float)imb->y / (float)imb->x) * layout->prv_w; + scaledy = ((float)imb->y / (float)imb->x) * layout->prv_w; scale = scaledx / imb->x; } else { scaledy = (float)layout->prv_h; - scaledx = ( (float)imb->x / (float)imb->y) * layout->prv_h; + scaledx = ((float)imb->x / (float)imb->y) * layout->prv_h; scale = scaledy / imb->y; } } else { - scaledx = (float)imb->x * UI_DPI_FAC; - scaledy = (float)imb->y * UI_DPI_FAC; + scaledx = ui_imbx; + scaledy = ui_imby; scale = UI_DPI_FAC; } diff --git a/source/blender/editors/space_file/filelist.c b/source/blender/editors/space_file/filelist.c index 87e6183f4f8..2853ee9c053 100644 --- a/source/blender/editors/space_file/filelist.c +++ b/source/blender/editors/space_file/filelist.c @@ -1349,7 +1349,7 @@ static void thumbnails_startjob(void *tjv, short *stop, short *do_update, float else if (limg->flags & FILE_TYPE_FTFONT) { source = THB_SOURCE_FONT; } - limg->img = IMB_thumb_manage(limg->path, THB_NORMAL, source); + limg->img = IMB_thumb_manage(limg->path, THB_LARGE, source); *do_update = true; PIL_sleep_ms(10); limg = limg->next; diff --git a/source/blender/editors/space_file/filesel.c b/source/blender/editors/space_file/filesel.c index 6858f536e92..d89e55cb55f 100644 --- a/source/blender/editors/space_file/filesel.c +++ b/source/blender/editors/space_file/filesel.c @@ -102,6 +102,8 @@ short ED_fileselect_set_params(SpaceFile *sfile) /* set path to most recently opened .blend */ BLI_split_dirfile(G.main->name, sfile->params->dir, sfile->params->file, sizeof(sfile->params->dir), sizeof(sfile->params->file)); sfile->params->filter_glob[0] = '\0'; + /* set the default thumbnails size */ + sfile->params->thumbnails_size = 128; } params = sfile->params; @@ -527,8 +529,8 @@ void ED_fileselect_init_layout(struct SpaceFile *sfile, ARegion *ar) layout->textheight = textheight; if (params->display == FILE_IMGDISPLAY) { - layout->prv_w = 4.8f * UI_UNIT_X; - layout->prv_h = 4.8f * UI_UNIT_Y; + layout->prv_w = ((float)params->thumbnails_size / 20.0f) * UI_UNIT_X; + layout->prv_h = ((float)params->thumbnails_size / 20.0f) * UI_UNIT_Y; layout->tile_border_x = 0.3f * UI_UNIT_X; layout->tile_border_y = 0.3f * UI_UNIT_X; layout->prv_border_x = 0.3f * UI_UNIT_X; |