diff options
author | Leo Tenenbaum <pommicket@gmail.com> | 2021-02-21 12:40:26 -0500 |
---|---|---|
committer | Leo Tenenbaum <pommicket@gmail.com> | 2021-02-21 12:40:26 -0500 |
commit | 617907fb4731d67f6e7aca17b9dd7881f2093aad (patch) | |
tree | de7378592c0ccd7d37a08cab05dfb4092efcd745 /ted.h | |
parent | 34fa190c3d490dd8cfec37d27bc03182f2a725a2 (diff) |
started to generalize selector code
Diffstat (limited to 'ted.h')
-rw-r--r-- | ted.h | 23 |
1 files changed, 19 insertions, 4 deletions
@@ -168,6 +168,20 @@ ENUM_U16 { MENU_ASK_RELOAD, // prompt about whether to reload file which has ben changed by another program } ENUM_U16_END(Menu); +typedef struct { + char const *name; + u32 color; +} SelectorEntry; + +typedef struct { + SelectorEntry *entries; + u32 n_entries; + Rect bounds; + u32 cursor; // index where the selector thing is + float scroll; + bool enable_cursor; +} Selector; + // file entries for file selectors typedef struct { char *name; // just the file name @@ -176,14 +190,11 @@ typedef struct { } FileEntry; typedef struct { + Selector sel; Rect bounds; u32 n_entries; - u32 selected; - float scroll; FileEntry *entries; char cwd[TED_PATH_MAX]; - bool open; // is the file selector on screen? - bool submitted; // set to true if the line buffer was just submitted this frame. bool create_menu; // this is for creating files, not opening files } FileSelector; @@ -237,6 +248,7 @@ typedef struct Ted { Menu menu; FileSelector file_selector; TextBuffer line_buffer; // general-purpose line buffer for inputs -- used for menus + bool line_buffer_submitted; // set to true if the line buffer was just submitted this frame. TextBuffer find_buffer; // use for "find" term in find/find+replace TextBuffer replace_buffer; // "replace" for find+replace TextBuffer build_buffer; // buffer for build output (view only) @@ -259,6 +271,9 @@ typedef struct Ted { BuildError *build_errors; // dynamic array of build errors u32 build_error; // build error we are currently "on" + // points to a selector if any is open, otherwise NULL. + Selector *selector_open; + Process build_process; // When we read the stdout from the build process, the tail end of the read could be an // incomplete UTF-8 code point. This is where we store that "tail end" until more |