diff options
author | Campbell Barton <ideasman42@gmail.com> | 2012-03-03 20:31:46 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2012-03-03 20:31:46 +0400 |
commit | a2c182e9233333fc3b8ff40d352113ec95e7e30c (patch) | |
tree | 37a9e08f4e6c4bf794aa0c8c15af875299db4a1b /source/blender/editors/space_text | |
parent | 86cec98f9e1523ed41b67ef998174289dbae9b83 (diff) |
style cleanup - use aligned * prefixed blocks for descriptive comments (was already used a lot and part of proposed style guide).
Diffstat (limited to 'source/blender/editors/space_text')
-rw-r--r-- | source/blender/editors/space_text/space_text.c | 4 | ||||
-rw-r--r-- | source/blender/editors/space_text/text_draw.c | 100 | ||||
-rw-r--r-- | source/blender/editors/space_text/text_ops.c | 26 |
3 files changed, 64 insertions, 66 deletions
diff --git a/source/blender/editors/space_text/space_text.c b/source/blender/editors/space_text/space_text.c index 314afeac0e6..a416e9cf973 100644 --- a/source/blender/editors/space_text/space_text.c +++ b/source/blender/editors/space_text/space_text.c @@ -127,8 +127,8 @@ static void text_listener(ScrArea *sa, wmNotifier *wmn) switch(wmn->category) { case NC_TEXT: /* check if active text was changed, no need to redraw if text isn't active - reference==NULL means text was unlinked, should update anyway for this - case -- no way to know was text active before unlinking or not */ + * reference==NULL means text was unlinked, should update anyway for this + * case -- no way to know was text active before unlinking or not */ if(wmn->reference && wmn->reference != st->text) break; diff --git a/source/blender/editors/space_text/text_draw.c b/source/blender/editors/space_text/text_draw.c index 8a78f236fea..dec1abfd009 100644 --- a/source/blender/editors/space_text/text_draw.c +++ b/source/blender/editors/space_text/text_draw.c @@ -180,11 +180,11 @@ void flatten_string_free(FlattenString *fs) } /* Checks the specified source string for a Python built-in function name. This - name must start at the beginning of the source string and must be followed by - a non-identifier (see text_check_identifier(char)) or null character. - - If a built-in function is found, the length of the matching name is returned. - Otherwise, -1 is returned. */ + * name must start at the beginning of the source string and must be followed by + * a non-identifier (see text_check_identifier(char)) or null character. + * + * If a built-in function is found, the length of the matching name is returned. + * Otherwise, -1 is returned. */ static int find_builtinfunc(char *string) { @@ -219,11 +219,11 @@ static int find_builtinfunc(char *string) } /* Checks the specified source string for a Python special name. This name must - start at the beginning of the source string and must be followed by a non- - identifier (see text_check_identifier(char)) or null character. - - If a special name is found, the length of the matching name is returned. - Otherwise, -1 is returned. */ + * start at the beginning of the source string and must be followed by a non- + * identifier (see text_check_identifier(char)) or null character. + * + * If a special name is found, the length of the matching name is returned. + * Otherwise, -1 is returned. */ static int find_specialvar(char *string) { @@ -271,7 +271,7 @@ static int find_bool(char *string) } /* Ensures the format string for the given line is long enough, reallocating - as needed. Allocation is done here, alone, to ensure consistency. */ + * as needed. Allocation is done here, alone, to ensure consistency. */ static int text_check_format_len(TextLine *line, unsigned int len) { if(line->format) { @@ -290,18 +290,18 @@ static int text_check_format_len(TextLine *line, unsigned int len) } /* Formats the specified line. If do_next is set, the process will move on to - the succeeding line if it is affected (eg. multiline strings). Format strings - may contain any of the following characters: - '_' Whitespace - '#' Comment text - '!' Punctuation and other symbols - 'n' Numerals - 'l' String letters - 'v' Special variables (class, def) - 'b' Built-in names (print, for, etc.) - 'q' Other text (identifiers, etc.) - It is terminated with a null-terminator '\0' followed by a continuation - flag indicating whether the line is part of a multi-line string. */ + * the succeeding line if it is affected (eg. multiline strings). Format strings + * may contain any of the following characters: + * '_' Whitespace + * '#' Comment text + * '!' Punctuation and other symbols + * 'n' Numerals + * 'l' String letters + * 'v' Special variables (class, def) + * 'b' Built-in names (print, for, etc.) + * 'q' Other text (identifiers, etc.) + * It is terminated with a null-terminator '\0' followed by a continuation + * flag indicating whether the line is part of a multi-line string. */ static void txt_format_line(SpaceText *st, TextLine *line, int do_next) { @@ -488,31 +488,29 @@ static void format_draw_color(char formatchar) /************************** draw text *****************************/ -/***********************/ /* - -Notes on word-wrap --- -All word-wrap functions follow the algorithm below to maintain consistency. - line The line to wrap (tabs converted to spaces) - view_width The maximum number of characters displayable in the region - This equals region_width/font_width for the region - wrap_chars Characters that allow wrapping. This equals [' ', '\t', '-'] - -def wrap(line, view_width, wrap_chars): - draw_start = 0 - draw_end = view_width - pos = 0 - for c in line: - if pos-draw_start >= view_width: - print line[draw_start:draw_end] - draw_start = draw_end - draw_end += view_width - elif c in wrap_chars: - draw_end = pos+1 - pos += 1 - print line[draw_start:] - -*/ /***********************/ +/* Notes on word-wrap + * -- + * All word-wrap functions follow the algorithm below to maintain consistency. + * line The line to wrap (tabs converted to spaces) + * view_width The maximum number of characters displayable in the region + * This equals region_width/font_width for the region + * wrap_chars Characters that allow wrapping. This equals [' ', '\t', '-'] + * + * def wrap(line, view_width, wrap_chars): + * draw_start = 0 + * draw_end = view_width + * pos = 0 + * for c in line: + * if pos-draw_start >= view_width: + * print line[draw_start:draw_end] + * draw_start = draw_end + * draw_end += view_width + * elif c in wrap_chars: + * draw_end = pos+1 + * pos += 1 + * print line[draw_start:] + * + */ int wrap_width(SpaceText *st, ARegion *ar) { @@ -961,8 +959,8 @@ void text_drawcache_tag_update(SpaceText *st, int full) } /* quick cache recalculation is also used in delete operator, - which could merge lines which are adjusent to current selection lines - expand recalculate area to this lines */ + * which could merge lines which are adjusent to current selection lines + * expand recalculate area to this lines */ if(drawcache->valid_head>0) drawcache->valid_head--; if(drawcache->valid_tail>0) drawcache->valid_tail--; } else { @@ -1856,7 +1854,7 @@ void text_update_character_width(SpaceText *st) } /* Moves the view to the cursor location, - also used to make sure the view isnt outside the file */ + * also used to make sure the view isnt outside the file */ void text_scroll_to_cursor(SpaceText *st, ScrArea *sa) { Text *text; diff --git a/source/blender/editors/space_text/text_ops.c b/source/blender/editors/space_text/text_ops.c index a44d5909a4f..1975e4ca633 100644 --- a/source/blender/editors/space_text/text_ops.c +++ b/source/blender/editors/space_text/text_ops.c @@ -1775,10 +1775,10 @@ static void txt_wrap_move_down(SpaceText *st, ARegion *ar, short sel) } /* Moves the cursor vertically by the specified number of lines. - If the destination line is shorter than the current cursor position, the - cursor will be positioned at the end of this line. - - This is to replace screen_skip for PageUp/Down operations. + * If the destination line is shorter than the current cursor position, the + * cursor will be positioned at the end of this line. + * + * This is to replace screen_skip for PageUp/Down operations. */ static void cursor_skip(SpaceText* st, ARegion *ar, Text *text, int lines, int sel) { @@ -2243,9 +2243,9 @@ void TEXT_OT_scroll(wmOperatorType *ot) { /* identifiers */ ot->name= "Scroll"; - /*don't really see the difference between this and - scroll_bar. Both do basically the same thing (aside - from keymaps).*/ + /* don't really see the difference between this and + * scroll_bar. Both do basically the same thing (aside + * from keymaps).*/ ot->idname= "TEXT_OT_scroll"; ot->description= "Scroll text screen"; @@ -2337,9 +2337,9 @@ void TEXT_OT_scroll_bar(wmOperatorType *ot) { /* identifiers */ ot->name= "Scrollbar"; - /*don't really see the difference between this and - scroll. Both do basically the same thing (aside - from keymaps).*/ + /* don't really see the difference between this and + * scroll. Both do basically the same thing (aside + * from keymaps).*/ ot->idname= "TEXT_OT_scroll_bar"; ot->description= "Scroll text screen"; @@ -3103,9 +3103,9 @@ static EnumPropertyItem resolution_items[]= { {0, NULL, 0, NULL, NULL}}; /* returns 0 if file on disk is the same or Text is in memory only - returns 1 if file has been modified on disk since last local edit - returns 2 if file on disk has been deleted - -1 is returned if an error occurs */ + * returns 1 if file has been modified on disk since last local edit + * returns 2 if file on disk has been deleted + * -1 is returned if an error occurs */ int text_file_modified(Text *text) { |