3 #include "wincontrol.h"
4 #include <string.h> /* for strlen() */
5 #include <stdint.h> /* for uint8_t, uint16_t */
6 #include "windows.h" /* for suspend_win(), append_win(), reset_pad_offset(),
7 * resize_active_win(), struct Win, struct WinMeta
9 #include "yx_uint16.h" /* for yx_uint16 struct */
10 #include "main.h" /* for Wins struct */
11 #include "misc.h" /* for textfile_sizes() */
12 #include "rexit.h" /* for exit_err() */
13 #include "main.h" /* for World, Wins structs */
18 extern void sorted_wintoggle(struct World * world)
20 char * err = "Trouble in sorted_wintoggle() with fopen() on file "
21 "'config/toggle_win_order'.";
22 FILE * file = fopen("config/toggle_win_order", "r");
23 exit_err(NULL == file, world, err);
25 textfile_sizes(file, &linemax, NULL);
26 char win_order[linemax];
27 err = "Trouble in sorted_wintoggle() with fgets() on file "
28 "'config/toggle_win_order'.";
29 exit_err(NULL == fgets(win_order, linemax, file), world, err);
30 err = "Trouble in sorted_wintoggle() with fclose() on file "
31 "'toggle_win_order'.";
32 exit_err(fclose(file), world, err);
36 for (; i < linemax; i++)
41 toggle_window(world->wins.meta, world->wins.keys);
45 toggle_window(world->wins.meta, world->wins.map);
49 toggle_window(world->wins.meta, world->wins.info);
53 toggle_window(world->wins.meta, world->wins.log);
61 extern uint8_t toggle_window(struct WinMeta * win_meta, struct Win * win)
63 if (0 != win->frame.curses_win)
65 return suspend_win(win_meta, win);
69 return append_win(win_meta, win);
75 extern void scroll_pad(struct WinMeta * win_meta, char dir)
79 reset_pad_offset(win_meta, win_meta->pad_offset + 1);
83 reset_pad_offset(win_meta, win_meta->pad_offset - 1);
89 extern uint8_t growshrink_active_window(struct WinMeta * win_meta, char change)
91 if (0 != win_meta->active)
93 struct yx_uint16 size = win_meta->active->frame.size;
98 else if (change == '+')
102 else if (change == '_')
106 else if (change == '*')
110 return resize_active_win (win_meta, size);