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
path: root/source
diff options
context:
space:
mode:
authorWilliam Reynish <billrey@me.com>2019-08-04 13:51:28 +0300
committerWilliam Reynish <billrey@me.com>2019-08-04 13:51:28 +0300
commita2fe386153ee976bf5b687257f117ca4efb1ef8f (patch)
treeacb3754063b1a98c62292896850a6832cb992d28 /source
parentc0aada58c9820b36176ec54d281513eeac65ca0c (diff)
Text Editor UI
Tweak Text Editor to fit better with the rest of Blender 2.8: - Move sidebar to the right - Add proper context menu - Move view toggles to the View menu - Change the indentation option to be an enum between spaces and tabs - Several layout tweaks Patch by @tintwotin / Peter Fog with additional tweaks by me. Differential Revision https://developer.blender.org/D5028 Reviewers: Brecht, Campbell
Diffstat (limited to 'source')
-rw-r--r--source/blender/blenloader/intern/versioning_280.c13
-rw-r--r--source/blender/editors/space_text/space_text.c2
-rw-r--r--source/blender/makesrna/intern/rna_text.c15
3 files changed, 25 insertions, 5 deletions
diff --git a/source/blender/blenloader/intern/versioning_280.c b/source/blender/blenloader/intern/versioning_280.c
index 5780221bcc5..1573f4ed02f 100644
--- a/source/blender/blenloader/intern/versioning_280.c
+++ b/source/blender/blenloader/intern/versioning_280.c
@@ -3555,5 +3555,18 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *bmain)
U.view_rotate_sensitivity_turntable = DEG2RADF(0.4f);
U.view_rotate_sensitivity_trackball = 1.0f;
}
+ for (bScreen *screen = bmain->screens.first; screen; screen = screen->id.next) {
+ for (ScrArea *sa = screen->areabase.first; sa; sa = sa->next) {
+ for (SpaceLink *sl = sa->spacedata.first; sl; sl = sl->next) {
+ if (sl->spacetype == SPACE_TEXT) {
+ ListBase *regionbase = (sl == sa->spacedata.first) ? &sa->regionbase : &sl->regionbase;
+ ARegion *ar = do_versions_find_region(regionbase, RGN_TYPE_UI);
+ if (ar) {
+ ar->alignment = RGN_ALIGN_RIGHT;
+ }
+ }
+ }
+ }
+ }
}
}
diff --git a/source/blender/editors/space_text/space_text.c b/source/blender/editors/space_text/space_text.c
index 7d8424a5996..945b9190d26 100644
--- a/source/blender/editors/space_text/space_text.c
+++ b/source/blender/editors/space_text/space_text.c
@@ -82,7 +82,7 @@ static SpaceLink *text_new(const ScrArea *UNUSED(area), const Scene *UNUSED(scen
BLI_addtail(&stext->regionbase, ar);
ar->regiontype = RGN_TYPE_UI;
- ar->alignment = RGN_ALIGN_LEFT;
+ ar->alignment = RGN_ALIGN_RIGHT;
ar->flag = RGN_FLAG_HIDDEN;
/* main region */
diff --git a/source/blender/makesrna/intern/rna_text.c b/source/blender/makesrna/intern/rna_text.c
index 454367b5233..b09b5327f57 100644
--- a/source/blender/makesrna/intern/rna_text.c
+++ b/source/blender/makesrna/intern/rna_text.c
@@ -146,6 +146,13 @@ static void rna_def_text_line(BlenderRNA *brna)
static void rna_def_text(BlenderRNA *brna)
{
+
+ static const EnumPropertyItem indentation_items[] = {
+ {0, "TABS", 0, "Tabs", "Indent using tabs"},
+ {TXT_TABSTOSPACES, "SPACES", 0, "Spaces", "Indent using spaces"},
+ {0, NULL, 0, NULL, NULL},
+ };
+
StructRNA *srna;
PropertyRNA *prop;
@@ -182,10 +189,10 @@ static void rna_def_text(BlenderRNA *brna)
RNA_def_property_ui_text(
prop, "Register", "Run this text as a script on loading, Text name must end with \".py\"");
- prop = RNA_def_property(srna, "use_tabs_as_spaces", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flags", TXT_TABSTOSPACES);
- RNA_def_property_ui_text(
- prop, "Tabs as Spaces", "Automatically converts all new tabs into spaces");
+ prop = RNA_def_property(srna, "indentation", PROP_ENUM, PROP_NONE); /* as an enum */
+ RNA_def_property_enum_bitflag_sdna(prop, NULL, "flags");
+ RNA_def_property_enum_items(prop, indentation_items);
+ RNA_def_property_ui_text(prop, "Indentation", "Use tabs or spaces for indentation");
prop = RNA_def_property(srna, "lines", PROP_COLLECTION, PROP_NONE);
RNA_def_property_struct_type(prop, "TextLine");