diff options
-rw-r--r-- | release/scripts/ui/space_text.py | 5 | ||||
-rw-r--r-- | source/blender/editors/space_text/space_text.c | 1 | ||||
-rw-r--r-- | source/blender/editors/space_text/text_draw.c | 9 | ||||
-rw-r--r-- | source/blender/makesdna/DNA_space_types.h | 4 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_space.c | 11 |
5 files changed, 30 insertions, 0 deletions
diff --git a/release/scripts/ui/space_text.py b/release/scripts/ui/space_text.py index df5967c9128..d1ccdf2acbb 100644 --- a/release/scripts/ui/space_text.py +++ b/release/scripts/ui/space_text.py @@ -95,6 +95,11 @@ class TEXT_PT_properties(bpy.types.Panel): if text: flow.prop(text, "use_tabs_as_spaces") + flow.prop(st, "show_margin") + col = flow.column() + col.active = st.show_margin + col.prop(st, "margin_column") + class TEXT_PT_find(bpy.types.Panel): bl_space_type = 'TEXT_EDITOR' diff --git a/source/blender/editors/space_text/space_text.c b/source/blender/editors/space_text/space_text.c index 85b9f1b68e6..3a9b8924eed 100644 --- a/source/blender/editors/space_text/space_text.c +++ b/source/blender/editors/space_text/space_text.c @@ -71,6 +71,7 @@ static SpaceLink *text_new(const bContext *UNUSED(C)) stext->lheight= 12; stext->tabnumber= 4; + stext->margin_column= 80; /* header */ ar= MEM_callocN(sizeof(ARegion), "header for text"); diff --git a/source/blender/editors/space_text/text_draw.c b/source/blender/editors/space_text/text_draw.c index bc0eb0a773f..b3e6920aa29 100644 --- a/source/blender/editors/space_text/text_draw.c +++ b/source/blender/editors/space_text/text_draw.c @@ -1779,6 +1779,15 @@ void draw_text_main(SpaceText *st, ARegion *ar) wrap_skip= 0; } + if(st->flags&ST_SHOW_MARGIN) { + UI_ThemeColor(TH_HILITE); + + glBegin(GL_LINES); + glVertex2i(x+st->cwidth*st->margin_column, 0); + glVertex2i(x+st->cwidth*st->margin_column, ar->winy - 2); + glEnd(); + } + /* draw other stuff */ draw_brackets(st, ar); draw_markers(st, ar); diff --git a/source/blender/makesdna/DNA_space_types.h b/source/blender/makesdna/DNA_space_types.h index d6dbabafb0e..a23aed505ae 100644 --- a/source/blender/makesdna/DNA_space_types.h +++ b/source/blender/makesdna/DNA_space_types.h @@ -327,6 +327,9 @@ typedef struct SpaceText { char findstr[256]; /* ST_MAX_FIND_STR */ char replacestr[256]; /* ST_MAX_FIND_STR */ + short margin_column; /* column number to show right margin at */ + char pad[6]; + void *drawcache; /* cache for faster drawing */ } SpaceText; @@ -817,6 +820,7 @@ enum { // execution (see BPY_main.c) #define ST_FIND_WRAP 0x0020 #define ST_FIND_ALL 0x0040 +#define ST_SHOW_MARGIN 0x0080 /* stext->findstr/replacestr */ diff --git a/source/blender/makesrna/intern/rna_space.c b/source/blender/makesrna/intern/rna_space.c index e122f99776d..70c0b70e326 100644 --- a/source/blender/makesrna/intern/rna_space.c +++ b/source/blender/makesrna/intern/rna_space.c @@ -1698,6 +1698,17 @@ static void rna_def_space_text(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Font Size", "Font size to use for displaying the text"); RNA_def_property_update(prop, NC_SPACE|ND_SPACE_TEXT, NULL); + prop= RNA_def_property(srna, "show_margin", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "flags", ST_SHOW_MARGIN); + RNA_def_property_ui_text(prop, "Show Margin", "Show right margin"); + RNA_def_property_update(prop, NC_SPACE|ND_SPACE_TEXT, NULL); + + prop= RNA_def_property(srna, "margin_column", PROP_INT, PROP_NONE); + RNA_def_property_int_sdna(prop, NULL, "margin_column"); + RNA_def_property_range(prop, 0, 1024); + RNA_def_property_ui_text(prop, "Margin Column", "Column number to show right margin at"); + RNA_def_property_update(prop, NC_SPACE|ND_SPACE_TEXT, NULL); + /* functionality options */ prop= RNA_def_property(srna, "use_overwrite", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "overwrite", 1); |