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:
authorBastien Montagne <montagne29@wanadoo.fr>2019-03-05 23:01:45 +0300
committerBastien Montagne <montagne29@wanadoo.fr>2019-03-05 23:05:02 +0300
commit4326f8af08c845eeb4eb45800ca047f690044007 (patch)
treecb5ab49dc6f3e33a5f12167dc94cf862cdf29c67 /source/blender/makesdna
parent8858311463b7220eef383781d31dde31868fcd7c (diff)
File Editor: Refactor 'new dir' / renaming code.
We really do not need two 256 chars variables to hanlde renaming, a mere pair of flags can handle the situation just as well. Also, scroll to newly renamed item, will help when one want to find again the directory they just added and rename. At some point we'll probably want to refactor scrolling further (to make it fully out of rename code/context e.g.), but for now think this will do.
Diffstat (limited to 'source/blender/makesdna')
-rw-r--r--source/blender/makesdna/DNA_space_types.h17
1 files changed, 14 insertions, 3 deletions
diff --git a/source/blender/makesdna/DNA_space_types.h b/source/blender/makesdna/DNA_space_types.h
index b9c50660d0b..afe80edfdd3 100644
--- a/source/blender/makesdna/DNA_space_types.h
+++ b/source/blender/makesdna/DNA_space_types.h
@@ -638,11 +638,10 @@ typedef struct FileSelectParams {
* needs to be linked in, where foo.blend/Armature need adding
*/
char dir[1090];
- char _pad0[2];
char file[256];
+
char renamefile[256];
- /** Annoying but the first is only used for initialization. */
- char renameedit[256];
+ short rename_flag;
/** List of filetypes to filter (FILE_MAXFILE). */
char filter_glob[256];
@@ -781,6 +780,18 @@ typedef enum eFileSel_Params_Flag {
FILE_GROUP_INSTANCE = (1 << 10),
} eFileSel_Params_Flag;
+/* sfile->params->rename_flag */
+/* Note: short flag. Defined as bitflags, but currently only used as exclusive status markers... */
+typedef enum eFileSel_Params_RenameFlag {
+ /* Used when we only have the name of the entry we want to rename, but not yet access to its matching file entry. */
+ FILE_PARAMS_RENAME_PENDING = 1 << 0,
+ /* We are actually renaming an entry. */
+ FILE_PARAMS_RENAME_ACTIVE = 1 << 1,
+ /* Used to scroll to newly renamed entry. */
+ FILE_PARAMS_RENAME_POSTSCROLL_PENDING = 1 << 2,
+ FILE_PARAMS_RENAME_POSTSCROLL_ACTIVE = 1 << 3,
+} eFileSel_Params_RenameFlag;
+
/* files in filesel list: file types
* Note we could use mere values (instead of bitflags) for file types themselves,
* but since we do not lack of bytes currently...