Commit: 4d6584ba6a22d4c06cb5e5ecce38dded1247da3f
Author: Campbell Barton
Date:   Fri May 1 01:49:58 2015 +1000
Branches: master
https://developer.blender.org/rB4d6584ba6a22d4c06cb5e5ecce38dded1247da3f

UI: use enum for thumbnail size

===================================================================

M       release/scripts/startup/bl_ui/space_filebrowser.py
M       source/blender/blenloader/intern/versioning_270.c
M       source/blender/editors/space_file/filesel.c
M       source/blender/makesdna/DNA_space_types.h
M       source/blender/makesrna/intern/rna_space.c

===================================================================

diff --git a/release/scripts/startup/bl_ui/space_filebrowser.py 
b/release/scripts/startup/bl_ui/space_filebrowser.py
index 5da660f..bcf0495 100644
--- a/release/scripts/startup/bl_ui/space_filebrowser.py
+++ b/release/scripts/startup/bl_ui/space_filebrowser.py
@@ -55,7 +55,7 @@ class FILEBROWSER_HT_header(Header):
             layout.prop(params, "display_type", expand=True, text="")
 
             if params.display_type == 'FILE_IMGDISPLAY':
-                layout.prop(params, "thumbnails_size")
+                layout.prop(params, "thumbnail_size", text="")
 
             layout.prop(params, "sort_method", expand=True, text="")
 
diff --git a/source/blender/blenloader/intern/versioning_270.c 
b/source/blender/blenloader/intern/versioning_270.c
index 2343ba0..4daf939 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 d89e55c..82409c9 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 7812103..075995c 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 4f54a6f..b02c69c 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);
 }

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to