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:
-rw-r--r--release/scripts/modules/bpy_types.py2
-rw-r--r--release/scripts/op/console_python.py10
-rw-r--r--release/scripts/op/console_shell.py2
-rw-r--r--release/scripts/ui/space_text.py13
-rw-r--r--source/blender/editors/space_image/image_ops.c1
-rw-r--r--source/blender/editors/space_text/text_draw.c16
-rw-r--r--source/blender/makesdna/DNA_space_types.h3
-rw-r--r--source/blender/makesrna/intern/rna_space.c51
-rw-r--r--source/blender/makesrna/intern/rna_text.c18
9 files changed, 69 insertions, 47 deletions
diff --git a/release/scripts/modules/bpy_types.py b/release/scripts/modules/bpy_types.py
index 0cd0aaaa3f0..0a796793d01 100644
--- a/release/scripts/modules/bpy_types.py
+++ b/release/scripts/modules/bpy_types.py
@@ -525,7 +525,7 @@ class Text(bpy_types.ID):
def as_string(self):
"""Return the text as a string."""
- return "\n".join(line.line for line in self.lines)
+ return "\n".join(line.body for line in self.lines)
def from_string(self, string):
"""Replace text with this string."""
diff --git a/release/scripts/op/console_python.py b/release/scripts/op/console_python.py
index cc0f3673e5c..918c31cff04 100644
--- a/release/scripts/op/console_python.py
+++ b/release/scripts/op/console_python.py
@@ -131,7 +131,7 @@ def execute(context):
is_multiline = False
try:
- line = line_object.line
+ line = line_object.body
# run the console, "\n" executes a multiline statement
line_exec = line if line.strip() else "\n"
@@ -212,13 +212,13 @@ def autocomplete(context):
try:
current_line = sc.history[-1]
- line = current_line.line
+ line = current_line.body
# This function isnt aware of the text editor or being an operator
# just does the autocomp then copy its results back
- current_line.line, current_line.current_character, scrollback = \
+ current_line.body, current_line.current_character, scrollback = \
intellisense.expand(
- line=current_line.line,
+ line=current_line.body,
cursor=current_line.current_character,
namespace=console.locals,
private=bpy.app.debug)
@@ -233,7 +233,7 @@ def autocomplete(context):
# Separate automplete output by command prompts
if scrollback != '':
- bpy.ops.console.scrollback_append(text=sc.prompt + current_line.line, type='INPUT')
+ bpy.ops.console.scrollback_append(text=sc.prompt + current_line.body, type='INPUT')
# Now we need to copy back the line from blender back into the
# text editor. This will change when we dont use the text editor
diff --git a/release/scripts/op/console_shell.py b/release/scripts/op/console_shell.py
index e269cc0bb2f..2c5b48acd34 100644
--- a/release/scripts/op/console_shell.py
+++ b/release/scripts/op/console_shell.py
@@ -47,7 +47,7 @@ def execute(context):
sc = context.space_data
try:
- line = sc.history[-1].line
+ line = sc.history[-1].body
except:
return {'CANCELLED'}
diff --git a/release/scripts/ui/space_text.py b/release/scripts/ui/space_text.py
index 71ab6540132..d9fce39fee8 100644
--- a/release/scripts/ui/space_text.py
+++ b/release/scripts/ui/space_text.py
@@ -48,9 +48,9 @@ class TEXT_HT_header(bpy.types.Header):
layout.template_ID(st, "text", new="text.new", unlink="text.unlink")
row = layout.row(align=True)
- row.prop(st, "line_numbers", text="")
- row.prop(st, "word_wrap", text="")
- row.prop(st, "syntax_highlight", text="")
+ row.prop(st, "show_line_numbers", text="")
+ row.prop(st, "show_word_wrap", text="")
+ row.prop(st, "show_syntax_highlight", text="")
if text:
row = layout.row()
@@ -81,9 +81,10 @@ class TEXT_PT_properties(bpy.types.Panel):
st = context.space_data
flow = layout.column_flow()
- flow.prop(st, "line_numbers")
- flow.prop(st, "word_wrap")
- flow.prop(st, "syntax_highlight")
+ flow.prop(st, "show_line_numbers")
+ flow.prop(st, "show_word_wrap")
+ flow.prop(st, "show_syntax_highlight")
+ flow.prop(st, "show_line_highlight")
flow.prop(st, "live_edit")
flow = layout.column_flow()
diff --git a/source/blender/editors/space_image/image_ops.c b/source/blender/editors/space_image/image_ops.c
index fc1a5f345ae..314d5dd9043 100644
--- a/source/blender/editors/space_image/image_ops.c
+++ b/source/blender/editors/space_image/image_ops.c
@@ -747,7 +747,6 @@ static int open_invoke(bContext *C, wmOperator *op, wmEvent *event)
}
if (ima==NULL) {
- SpaceButs *sbuts= CTX_wm_space_buts(C);
Tex *tex= CTX_data_pointer_get_type(C, "texture", &RNA_Texture).data;
if(tex && tex->type==TEX_IMAGE)
ima= tex->ima;
diff --git a/source/blender/editors/space_text/text_draw.c b/source/blender/editors/space_text/text_draw.c
index 926ccc1914a..6fbfc463c45 100644
--- a/source/blender/editors/space_text/text_draw.c
+++ b/source/blender/editors/space_text/text_draw.c
@@ -1101,6 +1101,20 @@ static void draw_cursor(SpaceText *st, ARegion *ar)
}
}
+ if(st->line_hlight) {
+ /* TODO, dont draw if hidden */
+ int x1= st->showlinenrs ? TXT_OFFSET + TEXTXLOC : TXT_OFFSET;
+ int x2= x1 + ar->winx;
+ y= ar->winy-2 - vsell*st->lheight;
+
+ glColor4ub(255, 255, 255, 32);
+
+ glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
+ glEnable(GL_BLEND);
+ glRecti(x1, y, x2, y-st->lheight+1);
+ glDisable(GL_BLEND);
+ }
+
if(!hidden) {
/* Draw the cursor itself (we draw the sel. cursor as this is the leading edge) */
x= st->showlinenrs ? TXT_OFFSET + TEXTXLOC : TXT_OFFSET;
@@ -1288,7 +1302,7 @@ void draw_text_main(SpaceText *st, ARegion *ar)
}
y= ar->winy-st->lheight;
winx= ar->winx - TXT_SCROLL_WIDTH;
-
+
/* draw cursor */
draw_cursor(st, ar);
diff --git a/source/blender/makesdna/DNA_space_types.h b/source/blender/makesdna/DNA_space_types.h
index e5308cccdfe..c365d33a9a4 100644
--- a/source/blender/makesdna/DNA_space_types.h
+++ b/source/blender/makesdna/DNA_space_types.h
@@ -303,7 +303,8 @@ typedef struct SpaceText {
int showlinenrs;
int tabnumber;
- int showsyntax;
+ short showsyntax;
+ short line_hlight;
short overwrite;
short live_edit; /* run python while editing, evil */
float pix_per_line;
diff --git a/source/blender/makesrna/intern/rna_space.c b/source/blender/makesrna/intern/rna_space.c
index 436e9f60dc7..d72eb25dd2f 100644
--- a/source/blender/makesrna/intern/rna_space.c
+++ b/source/blender/makesrna/intern/rna_space.c
@@ -567,31 +567,30 @@ static void rna_SpaceProperties_align_set(PointerRNA *ptr, int value)
}
/* Space Console */
-static void rna_ConsoleLine_line_get(PointerRNA *ptr, char *value)
+static void rna_ConsoleLine_body_get(PointerRNA *ptr, char *value)
{
ConsoleLine *ci= (ConsoleLine*)ptr->data;
strcpy(value, ci->line);
}
-static int rna_ConsoleLine_line_length(PointerRNA *ptr)
+static int rna_ConsoleLine_body_length(PointerRNA *ptr)
{
ConsoleLine *ci= (ConsoleLine*)ptr->data;
return ci->len;
}
-static void rna_ConsoleLine_line_set(PointerRNA *ptr, const char *value)
+static void rna_ConsoleLine_body_set(PointerRNA *ptr, const char *value)
{
ConsoleLine *ci= (ConsoleLine*)ptr->data;
int len= strlen(value);
- if(len < ci->len_alloc) { /* allocated size is enough? */
- strcpy(ci->line, value);
- }
- else { /* allocate a new strnig */
+ if((len >= ci->len_alloc) || (len * 2 < ci->len_alloc) ) { /* allocate a new strnig */
MEM_freeN(ci->line);
- ci->line= BLI_strdup(value);
- ci->len_alloc= len;
+ ci->line= MEM_mallocN((len + 1) * sizeof(char), "rna_consoleline");
+ ci->len_alloc= len + 1;
}
+
+ memcpy(ci->line, value, len + 1);
ci->len= len;
if(ci->cursor > len) /* clamp the cursor */
@@ -1536,31 +1535,28 @@ static void rna_def_space_text(BlenderRNA *brna)
RNA_def_property_update(prop, NC_SPACE|ND_SPACE_TEXT, NULL);
/* display */
- prop= RNA_def_property(srna, "syntax_highlight", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "showsyntax", 0);
- RNA_def_property_ui_text(prop, "Syntax Highlight", "Syntax highlight for scripting");
- RNA_def_property_ui_icon(prop, ICON_SYNTAX_OFF, 1);
- RNA_def_property_update(prop, NC_SPACE|ND_SPACE_TEXT, NULL);
-
- prop= RNA_def_property(srna, "word_wrap", PROP_BOOLEAN, PROP_NONE);
+ prop= RNA_def_property(srna, "show_word_wrap", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "wordwrap", 0);
RNA_def_property_boolean_funcs(prop, NULL, "rna_SpaceTextEditor_word_wrap_set");
RNA_def_property_ui_text(prop, "Word Wrap", "Wrap words if there is not enough horizontal space");
RNA_def_property_ui_icon(prop, ICON_WORDWRAP_OFF, 1);
RNA_def_property_update(prop, NC_SPACE|ND_SPACE_TEXT, NULL);
- prop= RNA_def_property(srna, "line_numbers", PROP_BOOLEAN, PROP_NONE);
+ prop= RNA_def_property(srna, "show_line_numbers", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "showlinenrs", 0);
RNA_def_property_ui_text(prop, "Line Numbers", "Show line numbers next to the text");
RNA_def_property_ui_icon(prop, ICON_LINENUMBERS_OFF, 1);
RNA_def_property_update(prop, NC_SPACE|ND_SPACE_TEXT, NULL);
- prop= RNA_def_property(srna, "overwrite", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_ui_text(prop, "Overwrite", "Overwrite characters when typing rather than inserting them");
+ prop= RNA_def_property(srna, "show_syntax_highlight", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "showsyntax", 0);
+ RNA_def_property_ui_text(prop, "Syntax Highlight", "Syntax highlight for scripting");
+ RNA_def_property_ui_icon(prop, ICON_SYNTAX_OFF, 1);
RNA_def_property_update(prop, NC_SPACE|ND_SPACE_TEXT, NULL);
- prop= RNA_def_property(srna, "live_edit", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_ui_text(prop, "Live Edit", "Run python while editing");
+ prop= RNA_def_property(srna, "show_line_highlight", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "line_hlight", 0);
+ RNA_def_property_ui_text(prop, "Highlight Line", "Highlight the current line");
RNA_def_property_update(prop, NC_SPACE|ND_SPACE_TEXT, NULL);
prop= RNA_def_property(srna, "tab_width", PROP_INT, PROP_NONE);
@@ -1575,6 +1571,15 @@ 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);
+ /* functionality options */
+ prop= RNA_def_property(srna, "overwrite", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_ui_text(prop, "Overwrite", "Overwrite characters when typing rather than inserting them");
+ RNA_def_property_update(prop, NC_SPACE|ND_SPACE_TEXT, NULL);
+
+ prop= RNA_def_property(srna, "live_edit", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_ui_text(prop, "Live Edit", "Run python while editing");
+ RNA_def_property_update(prop, NC_SPACE|ND_SPACE_TEXT, NULL);
+
/* find */
prop= RNA_def_property(srna, "find_all", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flags", ST_FIND_ALL);
@@ -1925,8 +1930,8 @@ static void rna_def_console_line(BlenderRNA *brna)
RNA_def_struct_ui_text(srna, "Console Input", "Input line for the interactive console");
// XXX using non-inited "prop", uh? RNA_def_property_update(prop, NC_SPACE|ND_SPACE_CONSOLE, NULL);
- prop= RNA_def_property(srna, "line", PROP_STRING, PROP_NONE);
- RNA_def_property_string_funcs(prop, "rna_ConsoleLine_line_get", "rna_ConsoleLine_line_length", "rna_ConsoleLine_line_set");
+ prop= RNA_def_property(srna, "body", PROP_STRING, PROP_NONE);
+ RNA_def_property_string_funcs(prop, "rna_ConsoleLine_body_get", "rna_ConsoleLine_body_length", "rna_ConsoleLine_body_set");
RNA_def_property_ui_text(prop, "Line", "Text in the line");
RNA_def_property_update(prop, NC_SPACE|ND_SPACE_CONSOLE, NULL);
diff --git a/source/blender/makesrna/intern/rna_text.c b/source/blender/makesrna/intern/rna_text.c
index d8651e5d05d..e8d1422d045 100644
--- a/source/blender/makesrna/intern/rna_text.c
+++ b/source/blender/makesrna/intern/rna_text.c
@@ -76,7 +76,7 @@ static int rna_Text_modified_get(PointerRNA *ptr)
return text_file_modified(text);
}
-static void rna_TextLine_line_get(PointerRNA *ptr, char *value)
+static void rna_TextLine_body_get(PointerRNA *ptr, char *value)
{
TextLine *line= (TextLine*)ptr->data;
@@ -86,21 +86,23 @@ static void rna_TextLine_line_get(PointerRNA *ptr, char *value)
strcpy(value, "");
}
-static int rna_TextLine_line_length(PointerRNA *ptr)
+static int rna_TextLine_body_length(PointerRNA *ptr)
{
TextLine *line= (TextLine*)ptr->data;
return line->len;
}
-static void rna_TextLine_line_set(PointerRNA *ptr, const char *value)
+static void rna_TextLine_body_set(PointerRNA *ptr, const char *value)
{
TextLine *line= (TextLine*)ptr->data;
+ int len= strlen(value);
if(line->line)
MEM_freeN(line->line);
-
- line->line= BLI_strdup(value);
- line->len= strlen(line->line);
+
+ line->line= MEM_mallocN((len + 1) * sizeof(char), "rna_text_body");
+ line->len= len;
+ memcpy(line->line, value, len + 1);
if(line->format) {
MEM_freeN(line->format);
@@ -118,8 +120,8 @@ static void rna_def_text_line(BlenderRNA *brna)
srna = RNA_def_struct(brna, "TextLine", NULL);
RNA_def_struct_ui_text(srna, "Text Line", "Line of text in a Text datablock");
- prop= RNA_def_property(srna, "line", PROP_STRING, PROP_NONE);
- RNA_def_property_string_funcs(prop, "rna_TextLine_line_get", "rna_TextLine_line_length", "rna_TextLine_line_set");
+ prop= RNA_def_property(srna, "body", PROP_STRING, PROP_NONE);
+ RNA_def_property_string_funcs(prop, "rna_TextLine_body_get", "rna_TextLine_body_length", "rna_TextLine_body_set");
RNA_def_property_ui_text(prop, "Line", "Text in the line");
RNA_def_property_update(prop, NC_TEXT|NA_EDITED, NULL);
}