diff options
author | Dalai Felinto <dfelinto@gmail.com> | 2010-03-07 00:45:46 +0300 |
---|---|---|
committer | Dalai Felinto <dfelinto@gmail.com> | 2010-03-07 00:45:46 +0300 |
commit | 782cb1f0e0d9c019bfb7b9391ffa4b827ed1aa6f (patch) | |
tree | dd8cab7e9f035c9403fdf526b3dc3d6e6e67d919 /source | |
parent | 50b13f0a560ef6dabee413bbff3bd549209b8d11 (diff) |
Tab as Space as a User Preference option. to affect new and loaded text files.
* I put it under General->System. Not sure is the better place for it though (space_userpref.py)
** also: creator.c fix to avoid autoplay of games when scripts are disabled.
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/blenkernel/intern/text.c | 11 | ||||
-rw-r--r-- | source/blender/makesdna/DNA_userdef_types.h | 1 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_userdef.c | 4 | ||||
-rw-r--r-- | source/creator/creator.c | 2 |
4 files changed, 13 insertions, 5 deletions
diff --git a/source/blender/blenkernel/intern/text.c b/source/blender/blenkernel/intern/text.c index 4dcc26827d0..c28f4fde8ed 100644 --- a/source/blender/blenkernel/intern/text.c +++ b/source/blender/blenkernel/intern/text.c @@ -190,7 +190,9 @@ Text *add_empty_text(char *name) init_undo_text(ta); ta->nlines=1; - ta->flags= TXT_ISDIRTY | TXT_ISMEM | TXT_TABSTOSPACES; + ta->flags= TXT_ISDIRTY | TXT_ISMEM; + if(U.flag & USER_TXT_TABSTOSPACES) + ta->flags |= TXT_TABSTOSPACES; ta->lines.first= ta->lines.last= NULL; ta->markers.first= ta->markers.last= NULL; @@ -354,9 +356,10 @@ Text *add_text(char *file, const char *relpath) ta->lines.first= ta->lines.last= NULL; ta->markers.first= ta->markers.last= NULL; ta->curl= ta->sell= NULL; - - ta->flags= TXT_TABSTOSPACES; - + + if(U.flag & USER_TXT_TABSTOSPACES) + ta->flags= TXT_TABSTOSPACES; + fseek(fp, 0L, SEEK_END); len= ftell(fp); fseek(fp, 0L, SEEK_SET); diff --git a/source/blender/makesdna/DNA_userdef_types.h b/source/blender/makesdna/DNA_userdef_types.h index 85c6e73a909..945a1977f03 100644 --- a/source/blender/makesdna/DNA_userdef_types.h +++ b/source/blender/makesdna/DNA_userdef_types.h @@ -406,6 +406,7 @@ extern UserDef U; /* from blenkernel blender.c */ #define USER_SCRIPT_AUTOEXEC_DISABLE (1 << 22) #define USER_FILENOUI (1 << 23) #define USER_NONEGFRAMES (1 << 24) +#define USER_TXT_TABSTOSPACES (1 << 25) /* helper macro for checking frame clamping */ #define FRAMENUMBER_MIN_CLAMP(cfra) \ diff --git a/source/blender/makesrna/intern/rna_userdef.c b/source/blender/makesrna/intern/rna_userdef.c index 6f6ee5216ae..536942bb9a9 100644 --- a/source/blender/makesrna/intern/rna_userdef.c +++ b/source/blender/makesrna/intern/rna_userdef.c @@ -2358,6 +2358,10 @@ static void rna_def_userdef_system(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Auto Run Python Scripts", "Allow any .blend file to run scripts automatically (unsafe with blend files from an untrusted source)"); RNA_def_property_update(prop, 0, "rna_userdef_script_autoexec_update"); + prop= RNA_def_property(srna, "tabs_as_spaces", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "flag", USER_TXT_TABSTOSPACES); + RNA_def_property_ui_text(prop, "Tabs as Spaces", "Automatically converts all new tabs into spaces in Text Editor"); + prop= RNA_def_property(srna, "prefetch_frames", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "prefetchframes"); RNA_def_property_range(prop, 0, 500); diff --git a/source/creator/creator.c b/source/creator/creator.c index 1d811ba61f3..79272568261 100644 --- a/source/creator/creator.c +++ b/source/creator/creator.c @@ -1038,7 +1038,7 @@ int main(int argc, char **argv) } else { - if(G.fileflags & G_FILE_AUTOPLAY){ + if((G.fileflags & (G_FILE_AUTOPLAY | G_SCRIPT_AUTOEXEC)){ WM_init_game(C); } |