X-Git-Url: https://plomlompom.com/repos/feed.xml?a=blobdiff_plain;f=src%2Fclient%2Fwindows.h;h=0a46192beaa89adca4877ba17cbbc41c7e6322cd;hb=c74615b516cd7e44cc1a4005663eed1a373d0f68;hp=59cf64dec6da821a99207d7ce98b49373d2845c1;hpb=a053b626309d3d9c51caecf35a018b6e1df5ecb5;p=plomrogue diff --git a/src/client/windows.h b/src/client/windows.h index 59cf64d..0a46192 100644 --- a/src/client/windows.h +++ b/src/client/windows.h @@ -25,9 +25,9 @@ #define WINDOWS_H #include /* WINDOW, chtype */ -#include /* uint8_t, int16_t, uint16_t */ -#include "keybindings.h" /* struct KeyBindingDB */ +#include /* uint8_t, int16_t, uint16_t, uint32_t */ #include "../common/yx_uint16.h" /* yx_uint16 struct */ +#include "keybindings.h" /* struct KeyBindingDB */ @@ -37,6 +37,7 @@ struct WinDB WINDOW * v_screen; /* virtual screen (ncurses pad) */ struct Win * wins; /* array of windows */ struct yx_uint16 v_screen_size; /* virtual screen size */ + char * legal_ids; /* ids allowed to be used */ char * ids; /* all windows' ids, followed by \0 */ char * order; /* visible windows' id's order, followed by \0 */ uint16_t v_screen_offset; /* how many cells v_screen view moved rightwards*/ @@ -58,28 +59,39 @@ struct Win char id; /* Win identifier; also maps to default window drawing function. */ uint8_t target_height_type; /* 0: read .height/.width as positive size; */ uint8_t target_width_type; /* 1: as negative diff to v_screen size */ - uint8_t view; /* winde view mode: 0: use default draw function set by .id */ + uint8_t linebreak; /* linebreaking modes: 0: wide; 1: long; 1: compact */ + uint8_t view; /* window view mode: 0: use .id- set default draw function */ }; /* 1/2: use one of the two config view draw function */ /* Return yx offset to focus map of "mapsize" on "position" in "frame_size". */ extern uint16_t center_offset(uint16_t position, - uint16_t mapsize, uint16_t frame_size); + uint32_t mapsize, uint32_t frame_size); /* Get Win of "id". */ extern struct Win * get_win_by_id(char id); /* Read/write individual Win (identified by "c") and world.winDB.order / - * world.winDB.active from/to "file". Follow writing with "delim" delimiter. - * Use "line" and "linemax" as expected by try_fgets(). + * world.winDB.active from/to "file" up to the world.delim delimiter. Use "line" + * and "linemax" as expected by try_fgets(). + * + * Note that read_winconf_from_file() returns 1 on success and 0 if it detects + * having found the end of the valid interface configuration file by either + * hitting a EOF or a newline (so empty newlines at the end of the file are ok). + * + * Note that read_order_wins_visible_active() only reads the promised values + * into pointers for temporary storage. This is due to the order in which window + * data is initialized: winDB.order and winDB.active should only be set when all + * windows have been initialized, so cleaning up on error is not confused. */ extern uint8_t read_winconf_from_file(char * line, uint32_t linemax, FILE * file); -extern void write_winconf_of_id_to_file(FILE * file, char c, char * delim); +extern void write_winconf_of_id_to_file(FILE * file, char c); extern void read_order_wins_visible_active(char * line, uint32_t linemax, - FILE * file); -extern void write_order_wins_visible_active(FILE * file, char * delim); + FILE * file, char ** tmp_order, + char * tmp_active); +extern void write_order_wins_visible_active(FILE * file); /* Builds virtual sreen from .t_screen's size, fits win's sizes to them.*/ extern void make_v_screen_and_init_win_sizes(); @@ -116,6 +128,8 @@ extern void toggle_winconfig(); */ extern void toggle_win_size_type(char axis); +extern void toggle_linebreak_type(); + /* Grow or shrink active window horizontally ("change" = "*"/"_") or vertically * ("change" = "+"/"-") if the new size was at least 1x1, the height at least * one cell smaller than .v_screen's vertical hight (to provide space for the