* draw_win_keybindings_winconf_geometry(),
* draw_win_keybindings_global()
*/
-#include "keybindings.h" /* free_keybindings(), write_keybidings_to_file(),
+#include "keybindings.h" /* write_keybidings_to_file(),
* read_keybindings_from_file()
*/
#include "misc.h" /* array_append() */
* match_func() is just a little helper to it.
*/
static uint8_t match_func(char c, void (** f) (), char c_m, void (* f_m) ());
-static void * get_drawfunc_by_char(char c);
+static void (* get_drawfunc_by_char(char c)) ();
/* Write "win"'s size back to .target_(height/width) as per .target_*_type. */
static void set_win_target_size(struct Win * win);
-static void * get_drawfunc_by_char(char c)
+static void (* get_drawfunc_by_char(char c)) ()
{
void (* f) (struct Win *) = NULL;
if ( match_func(c, &f, 'c', draw_win_inventory)
|| match_func(c, &f, 'm', draw_win_map)
|| match_func(c, &f, '0', draw_win_keybindings_global)
|| match_func(c, &f, '1', draw_win_keybindings_winconf_geometry)
- || match_func(c, &f, '2', draw_win_keybindings_winconf_keybindings));
+ || match_func(c, &f, '2', draw_win_keybindings_winconf_keybindings))
+ {
+ ;
+ }
return f;
}
/* Only resize .v_screen if the rightmost window column has changed. */
char * err_s = "refit_v_screen() grows virtual screen beyond legal sizes.";
char * err_m = "refit_v_screen() triggers memory alloc error in wresize().";
- if (getmaxx(world.winDB.v_screen) + 1 != lastwcol)
+ if ((uint32_t) getmaxx(world.winDB.v_screen) + 1 != lastwcol)
{
uint8_t t = (lastwcol + 2 > UINT16_MAX);
exit_err(t, err_s);
struct Win * next = get_win_after(w->id);
if (next)
{
- return draw_wins(next);
+ draw_wins(next);
}
}
-extern uint16_t center_offset(uint16_t position, uint16_t mapsize,
- uint16_t frame_size)
+extern uint16_t center_offset(uint16_t position, uint32_t mapsize,
+ uint32_t frame_size)
{
uint16_t offset = 0;
if (mapsize > frame_size)
"interface config file. ";
char * err_id = "Illegal ID(s) selected.";
char * err_2 = "Double-initialized window.";
+ char * err_brk = "Illegal line break type index.";
int test_for_end = try_fgetc(file, f_name);
if (EOF == test_for_end || '\n' == test_for_end)
{
win.title = try_malloc(strlen(line), f_name);
memcpy(win.title, line, strlen(line) - 1); /* Eliminate newline char */
win.title[strlen(line) - 1] = '\0'; /* char at end of string. */
+ err_try_fgets(line, linemax, file, context, "0nsi");
+ err_line(atoi(line) > 2, line, context, err_brk);
+ win.linebreak = atoi(line);
err_try_fgets(line, linemax, file, context, "0ni");
win.target_height = atoi(line);
win.target_height_type = (0 >= win.target_height);
try_fwrite(line, sizeof(char), strlen(line), file, f_name);
sprintf(line, "%s\n", wc->title);
try_fwrite(line, sizeof(char), strlen(line), file, f_name);
+ sprintf(line, "%d\n", wc->linebreak);
+ try_fwrite(line, sizeof(char), strlen(line), file, f_name);
sprintf(line, "%d\n", wc->target_height);
try_fwrite(line, sizeof(char), strlen(line), file, f_name);
sprintf(line, "%d\n", wc->target_width);
{
struct Win * wc = get_win_by_id(id);
free(wc->title);
- free_keybindings(wc->kb.kbs);
+ free(wc->kb.kbs);
+ wc->kb.kbs = NULL;
}
free(world.winDB.ids); /* NULL this too since add_win_to_winDB() checks */
world.winDB.ids = NULL; /* for it to detect its first post-DB-purge round.*/
-extern void winch_called(int signal)
+extern void winch_called()
{
world.winch = 1;
}
+extern void toggle_linebreak_type()
+{
+ struct Win * w = get_win_by_id(world.winDB.active);
+ if (0 == w->linebreak)
+ {
+ w->linebreak = 1;
+ }
+ else if (1 == w->linebreak)
+ {
+ w->linebreak = 2;
+ }
+ else if (2 == w->linebreak)
+ {
+ w->linebreak = 0;
+ }
+}
+
+
+
extern void resize_active_win(char change)
{
if (world.winDB.active)
{
w->frame_size.y--;
}
- else if (change == '_' && w->frame_size.y > 1)
+ else if (change == '_' && w->frame_size.x > 1)
{
w->frame_size.x--;
}