Revision: 60036 http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=60036 Author: jesterking Date: 2013-09-11 07:23:23 +0000 (Wed, 11 Sep 2013) Log Message: ----------- Add read-only access to index data for current line, top line and visible lines count.
Modified Paths: -------------- trunk/blender/source/blender/makesrna/intern/rna_space.c trunk/blender/source/blender/makesrna/intern/rna_text.c Modified: trunk/blender/source/blender/makesrna/intern/rna_space.c =================================================================== --- trunk/blender/source/blender/makesrna/intern/rna_space.c 2013-09-11 07:10:15 UTC (rev 60035) +++ trunk/blender/source/blender/makesrna/intern/rna_space.c 2013-09-11 07:23:23 UTC (rev 60036) @@ -2595,6 +2595,16 @@ 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); + prop = RNA_def_property(srna, "top", PROP_INT, PROP_NONE); + RNA_def_property_clear_flag(prop, PROP_EDITABLE); + RNA_def_property_int_sdna(prop, NULL, "top"); + RNA_def_property_ui_text(prop, "Top Line", "Top line visible."); + + prop = RNA_def_property(srna, "visible_lines", PROP_INT, PROP_NONE); + RNA_def_property_clear_flag(prop, PROP_EDITABLE); + RNA_def_property_int_sdna(prop, NULL, "viewlines"); + RNA_def_property_ui_text(prop, "Top Line", "Amount of lines that can be visible in current editor"); + /* functionality options */ prop = RNA_def_property(srna, "use_overwrite", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "overwrite", 1); Modified: trunk/blender/source/blender/makesrna/intern/rna_text.c =================================================================== --- trunk/blender/source/blender/makesrna/intern/rna_text.c 2013-09-11 07:10:15 UTC (rev 60035) +++ trunk/blender/source/blender/makesrna/intern/rna_text.c 2013-09-11 07:23:23 UTC (rev 60036) @@ -81,6 +81,19 @@ return text_file_modified(text); } +static int rna_Text_current_line_index_get(PointerRNA *ptr) +{ + Text *text = (Text *)ptr->data; + TextLine *linep = text->lines.first; + int i = 0; + while(linep) { + if(text->curl==linep) break; + linep = linep->next; + i++; + } + return i; +} + static void rna_TextLine_body_get(PointerRNA *ptr, char *value) { TextLine *line = (TextLine *)ptr->data; @@ -141,6 +154,11 @@ RNA_def_struct_ui_text(srna, "Text", "Text datablock referencing an external or packed text file"); RNA_def_struct_ui_icon(srna, ICON_TEXT); RNA_def_struct_clear_flag(srna, STRUCT_ID_REFCOUNT); + + prop = RNA_def_property(srna, "current_line_index", PROP_INT, PROP_NONE); + RNA_def_property_clear_flag(prop, PROP_EDITABLE); + RNA_def_property_int_funcs(prop, "rna_Text_current_line_index_get", NULL, NULL); + RNA_def_property_ui_text(prop, "Current Line Index", "Index of current TextLine in TextLine collection"); prop = RNA_def_property(srna, "filepath", PROP_STRING, PROP_NONE); RNA_def_property_string_funcs(prop, "rna_Text_filename_get", "rna_Text_filename_length", "rna_Text_filename_set"); _______________________________________________ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org http://lists.blender.org/mailman/listinfo/bf-blender-cvs