diff options
author | Campbell Barton <ideasman42@gmail.com> | 2019-11-27 16:58:34 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2019-11-27 17:04:21 +0300 |
commit | f1c994c555da7c3e27984cc26b7f226badbe670d (patch) | |
tree | a42c43762e56cad6f59f50922ef4c341b5632826 /source/blender/makesdna | |
parent | f6cefbef22c8c6583b4927c179dabac3eb57aa22 (diff) |
Cleanup: move space text vars into a runtime struct
Also use more descriptive names.
Diffstat (limited to 'source/blender/makesdna')
-rw-r--r-- | source/blender/makesdna/DNA_space_types.h | 85 | ||||
-rw-r--r-- | source/blender/makesdna/DNA_text_types.h | 3 |
2 files changed, 56 insertions, 32 deletions
diff --git a/source/blender/makesdna/DNA_space_types.h b/source/blender/makesdna/DNA_space_types.h index 9e8bda2d12f..1ce282a5a91 100644 --- a/source/blender/makesdna/DNA_space_types.h +++ b/source/blender/makesdna/DNA_space_types.h @@ -1167,6 +1167,41 @@ typedef enum eSpaceImage_OtherUVFilter { /** \name Text Editor * \{ */ +typedef struct SpaceText_Runtime { + + /** Actual line height, scaled by dpi. */ + int lheight_px; + + /** Runtime computed, character width. */ + int cwidth_px; + + /** The handle of the scroll-bar which can be clicked and dragged. */ + struct rcti scroll_region_handle; + /** The region for selected text to show in the scrolling area. */ + struct rcti scroll_region_select; + + /** Number of digits to show in the line numbers column (when enabled). */ + int line_number_display_digits; + + /** Number of lines this window can display (even when they aren't used). */ + int viewlines; + + /** Use for drawing scroll-bar & calculating scroll operator motion scaling. */ + float scroll_px_per_line; + + /** + * Run-time for scroll increments smaller than a line (smooth scroll). + * Values must be between zero and the line, column width: (cwidth, TXT_LINE_HEIGHT(st)). + */ + int scroll_ofs_px[2]; + + char _pad1[4]; + + /** Cache for faster drawing. */ + void *drawcache; + +} SpaceText_Runtime; + /* Text Editor */ typedef struct SpaceText { SpaceLink *next, *prev; @@ -1179,30 +1214,26 @@ typedef struct SpaceText { struct Text *text; - int top, viewlines; - short flags, menunr; + int top, left; + char _pad1[4]; + + short flags; /** User preference, is font_size! */ short lheight; - /** - * Runtime computed, character width - * and the number of chars to use when showing line numbers. - */ - char cwidth, linenrs_tot; - int left; - int showlinenrs; + int tabnumber; - short showsyntax; - short line_hlight; - short overwrite; + /* Booleans */ + char wordwrap; + char doplugins; + char showlinenrs; + char showsyntax; + char line_hlight; + char overwrite; /** Run python while editing, evil. */ - short live_edit; - float pix_per_line; - - struct rcti txtscroll, txtbar; - - int wordwrap, doplugins; + char live_edit; + char _pad2[1]; /** ST_MAX_FIND_STR. */ char findstr[256]; @@ -1211,26 +1242,18 @@ typedef struct SpaceText { /** Column number to show right margin at. */ short margin_column; - /** Actual lineheight, dpi controlled. */ - short lheight_dpi; - char _pad[4]; + char _pad3[2]; - /** Cache for faster drawing. */ - void *drawcache; - - /** - * Run-time for scroll increments smaller than a line (smooth scroll). - * Values must be between zero and the line, column width: (cwidth, TXT_LINE_HEIGHT(st)). - */ - int scroll_ofs_px[2]; + /** Keep last. */ + SpaceText_Runtime runtime; } SpaceText; /* SpaceText flags (moved from DNA_text_types.h) */ typedef enum eSpaceText_Flags { /* scrollable */ ST_SCROLL_SELECT = (1 << 0), - /* clear namespace after script execution (BPY_main.c) */ - ST_CLEAR_NAMESPACE = (1 << 4), + + ST_FLAG_UNUSED_4 = (1 << 4), /* dirty */ ST_FIND_WRAP = (1 << 5), ST_FIND_ALL = (1 << 6), diff --git a/source/blender/makesdna/DNA_text_types.h b/source/blender/makesdna/DNA_text_types.h index 4eec2c1fde8..8303f2322b6 100644 --- a/source/blender/makesdna/DNA_text_types.h +++ b/source/blender/makesdna/DNA_text_types.h @@ -36,7 +36,8 @@ typedef struct TextLine { /** May be NULL if syntax is off or not yet formatted. */ char *format; /** Blen unused. */ - int len, blen; + int len; + char _pad0[4]; } TextLine; typedef struct Text { |