X-Git-Url: https://plomlompom.com/repos/?a=blobdiff_plain;f=src%2Fclient%2Fwindows.h;h=91f3f7bf454ee33142a9e893f11c23bb0b35713b;hb=8bf4e35ebe159f9cf051c8dbfc0909d7fe5d3399;hp=92a35a1d93b96ca00e1efc645e81d9b22f00ee16;hpb=f9c94db47aa883149aa762fa128ac1ff1b3f92e1;p=plomrogue diff --git a/src/client/windows.h b/src/client/windows.h index 92a35a1..91f3f7b 100644 --- a/src/client/windows.h +++ b/src/client/windows.h @@ -1,4 +1,8 @@ /* src/client/windows.h + * + * This file is part of PlomRogue. PlomRogue is licensed under the GPL version 3 + * or any later version. For details on its copyright, license, and warranties, + * see the file NOTICE in the root directory of the PlomRogue source package. * * A tiled window manager for the terminal. * @@ -25,12 +29,17 @@ #define WINDOWS_H #include /* WINDOW, chtype */ -#include /* uint8_t, int16_t, uint16_t */ -#include "../common/yx_uint16.h" /* yx_uint16 struct */ +#include /* uint8_t, int16_t, uint16_t, uint32_t */ #include "keybindings.h" /* struct KeyBindingDB */ +struct yx_uint16 +{ + uint16_t y; + uint16_t x; +}; + struct WinDB { WINDOW * t_screen; /* ncurses' pointer to the terminal screen */ @@ -51,7 +60,7 @@ struct Win struct yx_uint16 target_center; /* saves .center when toggling .view */ struct yx_uint16 frame_size; /* size of window/frame to see winmap through*/ struct yx_uint16 start; /* upper left corner of window in v_screen */ - struct yx_uint16 center; /* winnap cell to center frame on if < winmap */ + struct yx_uint16 center; /* winmap cell to center frame on if < winmap */ struct yx_uint16 winmap_size; /* delimits .winmap, sorts it into lines */ chtype * winmap; /* window content in sequence of chtype's to write */ int16_t target_height; /* window size / .frame_size description in config */ @@ -59,39 +68,25 @@ 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; 2: 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 */ +/* Get position of id "c" in world.winDB.order*/ +extern uint8_t get_win_pos_in_order(char c); + +/* Get Win after window identified by "c" or NULL if there is none. */ +extern struct Win * get_win_after(char c); + /* 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" 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); -extern void read_order_wins_visible_active(char * line, uint32_t linemax, - 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(); @@ -110,48 +105,6 @@ extern void reset_windows_on_winch(); */ extern void draw_all_wins(); -/* Toggle display of a window of "id". */ -extern void toggle_window(char id); - -/* Toggle "window configuration" view for active window. Sets sensible .center - * values for each configuration view (for winconf_geometry: y=0, x=0; for - * winconf_keys: x=0 (y is set by draw_winconf_keybindings()); stores default - * view's .center in .target_center to return to it when toggling back. - */ -extern void toggle_winconfig(); - -/* Toggle active window's .target_(height/width)_type ("axis" = "y": height; - * else: width). Don't toggle to .target_width_type of 1 (saving the width as a - * diff to the .t_screen's width) if window's width is larger than .t_screen's - * width, for such width is better saved directly with .target_width_type of 0. - */ -extern void toggle_win_size_type(char axis); - -/* 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 - * title bar) and the width max. (2^16) - 1 cells. If a new window width would - * surpass that of .t_screen, set active window's .target_width_type to 0. - */ -extern void resize_active_win(char c); - -/* Move active window forwards ("dir" == "f") or backwards (any other "dir") in - * window chain. Wrap around in the window chain if start / end of it is met. - */ -extern void shift_active_win(char dir); - -/* Sroll .v_screen one cell to the left if "dir" is "-" and .v_screen_offset is - * more than 1, or to the right if "dir" is "+" and .v_screen's right edge would - * not move (further, if suspension of windows has moved it to the left already) - * leftwards to .t_screen's right edge. - */ -extern void scroll_v_screen(char dir); - -/* Cycle active window selection forwards ("dir" == "f") or backwards (any - * other "dir"). Wrap around in the windows chain if start / end of it is met. - */ -extern void cycle_active_win(char dir); - #endif