Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2015-04-30 18:49:58 +0300
committerCampbell Barton <ideasman42@gmail.com>2015-04-30 18:49:58 +0300
commit4d6584ba6a22d4c06cb5e5ecce38dded1247da3f (patch)
tree91ee28e7f2521d87941dba61e87aedc171b80d0e /source/blender
parent5ced6cb2bc52a50365e4bc4003994c39cdcb895f (diff)
UI: use enum for thumbnail size
Diffstat (limited to 'source/blender')
-rw-r--r--source/blender/blenloader/intern/versioning_270.c4
-rw-r--r--source/blender/editors/space_file/filesel.c6
-rw-r--r--source/blender/makesdna/DNA_space_types.h3
-rw-r--r--source/blender/makesrna/intern/rna_space.c14
4 files changed, 18 insertions, 9 deletions
diff --git a/source/blender/blenloader/intern/versioning_270.c b/source/blender/blenloader/intern/versioning_270.c
index 2343ba06e75..4daf93916c9 100644
--- a/source/blender/blenloader/intern/versioning_270.c
+++ b/source/blender/blenloader/intern/versioning_270.c
@@ -803,7 +803,7 @@ void blo_do_versions_270(FileData *fd, Library *UNUSED(lib), Main *main)
if (!MAIN_VERSION_ATLEAST(main, 274, 6)) {
bScreen *screen;
- if (!DNA_struct_elem_find(fd->filesdna, "FileSelectParams", "int", "thumbnails_size")) {
+ if (!DNA_struct_elem_find(fd->filesdna, "FileSelectParams", "int", "thumbnail_size")) {
for (screen = main->screen.first; screen; screen = screen->id.next) {
ScrArea *sa;
@@ -815,7 +815,7 @@ void blo_do_versions_270(FileData *fd, Library *UNUSED(lib), Main *main)
SpaceFile *sfile = (SpaceFile *)sl;
if (sfile->params) {
- sfile->params->thumbnails_size = 128;
+ sfile->params->thumbnail_size = 128;
}
}
}
diff --git a/source/blender/editors/space_file/filesel.c b/source/blender/editors/space_file/filesel.c
index d89e55cb55f..82409c9ecb4 100644
--- a/source/blender/editors/space_file/filesel.c
+++ b/source/blender/editors/space_file/filesel.c
@@ -103,7 +103,7 @@ short ED_fileselect_set_params(SpaceFile *sfile)
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;
+ sfile->params->thumbnail_size = 128;
}
params = sfile->params;
@@ -529,8 +529,8 @@ void ED_fileselect_init_layout(struct SpaceFile *sfile, ARegion *ar)
layout->textheight = textheight;
if (params->display == FILE_IMGDISPLAY) {
- 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->prv_w = ((float)params->thumbnail_size / 20.0f) * UI_UNIT_X;
+ layout->prv_h = ((float)params->thumbnail_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;
diff --git a/source/blender/makesdna/DNA_space_types.h b/source/blender/makesdna/DNA_space_types.h
index 78121035371..075995c2924 100644
--- a/source/blender/makesdna/DNA_space_types.h
+++ b/source/blender/makesdna/DNA_space_types.h
@@ -590,7 +590,8 @@ typedef struct FileSelectParams {
int active_file;
int sel_first;
int sel_last;
- int thumbnails_size;
+ unsigned short thumbnail_size;
+ short pad;
/* short */
short type; /* XXXXX for now store type here, should be moved to the operator */
diff --git a/source/blender/makesrna/intern/rna_space.c b/source/blender/makesrna/intern/rna_space.c
index 4f54a6f07dc..b02c69c54ef 100644
--- a/source/blender/makesrna/intern/rna_space.c
+++ b/source/blender/makesrna/intern/rna_space.c
@@ -3698,6 +3698,14 @@ static void rna_def_fileselect_params(BlenderRNA *brna)
{0, NULL, 0, NULL, NULL}
};
+ static EnumPropertyItem thumbnail_size_items[] = {
+ {32, "TINY", 0, "Tiny", ""},
+ {64, "SMALL", 0, "Small", ""},
+ {128, "NORMAL", 0, "Normal", ""},
+ {256, "LARGE", 0, "Large", ""},
+ {0, NULL, 0, NULL, NULL}
+ };
+
srna = RNA_def_struct(brna, "FileSelectParams", NULL);
RNA_def_struct_ui_text(srna, "File Select Parameters", "File Select Parameters");
@@ -3803,9 +3811,9 @@ static void rna_def_fileselect_params(BlenderRNA *brna)
RNA_def_property_flag(prop, PROP_TEXTEDIT_UPDATE);
RNA_def_property_update(prop, NC_SPACE | ND_SPACE_FILE_LIST, NULL);
- prop = RNA_def_property(srna, "thumbnails_size", PROP_INT, PROP_PIXEL);
- RNA_def_property_int_sdna(prop, NULL, "thumbnails_size");
- RNA_def_property_range(prop, 32, 256);
+ prop = RNA_def_property(srna, "thumbnail_size", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "thumbnail_size");
+ RNA_def_property_enum_items(prop, thumbnail_size_items);
RNA_def_property_ui_text(prop, "Thumbnails Size", "Change the size of the thumbnails");
RNA_def_property_update(prop, NC_SPACE | ND_SPACE_FILE_LIST, NULL);
}