From: Christian Heller <c.heller@plomlompom.de>
Date: Thu, 13 Nov 2014 20:41:16 +0000 (+0100)
Subject: Client: Remove unused "active window's keys" window, update README.
X-Git-Tag: tce~608
X-Git-Url: https://plomlompom.com/repos/%22https:/validator.w3.org/%7B%7Bprefix%7D%7D/process?a=commitdiff_plain;h=e34629517265170e7bb3f446b9b067bab382b572;p=plomrogue

Client: Remove unused "active window's keys" window, update README.
---

diff --git a/README b/README
index 15fc87f..25c1736 100644
--- a/README
+++ b/README
@@ -46,18 +46,20 @@ the two by hand.
 Client's keybindings and window management
 ------------------------------------------
 
-In the client's default window configuration, the window appearing on the left
-sports a list of keybindings available globally, and additionally via the window
-selected as active.
-
-Hit "W" (per default keybindings) to switch the "active" window to a view that
-allows changing its geometry. One more hit on "W" switches the window to a view
-that allows changing its window-specific keybindings. The global keybindings can
-be changed in the "Global keys" window, those of the window geometry
-configuration in the "Window geometry keys" window, and those of the
-window-specific keybindings configuration in the "Window keybinding keys"
-window; by default, these three windows are not visible, but may be turned on by
-(per default keybindings) hitting the "F6", "F7" and "F8" keys.
+Multiple windows may fill the screen. One of these will be selected as "active"
+– identified by dollar signs enclosing its title. Active windows may come with
+window-specific keybindings. Furthermore, global keybindings are available no
+matter what window is selected.
+
+Hit "W" (per default global keybindings) to switch the active window to a view
+that allows changing its geometry. One more hit on "W" switches the window to a
+view that sports (and allows changing its) window-specific keybindings. (One
+further "W" will return the window to its default, "normal" view.) The global
+keybindings are visible (and can be changed) in the "Set global keys" window,
+those of the window geometry configuration in the "Set window geometry keys"
+window, and those of the window-specific keybindings configuration in the "Set
+window keybinding keys" window; by default, the latter two are not visible, but
+may be turned on by (per default keybindings) hitting the keys "F6" and "F7".
 
 Keybindings and default window selection / visibilities / geometries are read
 from the textfile ./confclient/interface_conf by default, or by another one
diff --git a/confclient/interface_conf b/confclient/interface_conf
index 333017e..ff45f81 100644
--- a/confclient/interface_conf
+++ b/confclient/interface_conf
@@ -1,4 +1,3 @@
-
 KEYBINDINGS 'global'
 KEY 81 quit
 KEY 87 winconf
@@ -15,7 +14,6 @@ KEY 268 to_logwin
 KEY 269 to_g_keywin
 KEY 270 to_wg_keywin
 KEY 271 to_wk_keywin
-KEY 272 to_a_keywin
 
 KEYBINDINGS 'wingeom'
 KEY 258 shift_f
@@ -105,9 +103,3 @@ KEY 260 map_l
 KEY 261 map_r
 KEY 46 map_c
 KEY 70 to_autofocus
-
-WINDOW a
-NAME 'Active window`s keys'
-BREAK 0
-WIDTH 22
-HEIGHT -8
diff --git a/confclient/single_wins/info b/confclient/single_wins/info
index bf9c031..34cabd2 100644
--- a/confclient/single_wins/info
+++ b/confclient/single_wins/info
@@ -7,7 +7,6 @@ KEY 268 to_logwin
 KEY 269 to_g_keywin
 KEY 270 to_wg_keywin
 KEY 271 to_wk_keywin
-KEY 272 to_a_keywin
 KEY 87 winconf
 KEY 62 cyc_win_f
 KEY 60 cyc_win_b
@@ -117,9 +116,3 @@ KEY 260 map_l
 KEY 261 map_r
 KEY 46 map_c
 KEY 70 to_autofocus
-
-WINDOW a
-NAME 'Active window`s keys'
-BREAK 0
-WIDTH 22
-HEIGHT -8
diff --git a/confclient/single_wins/inventory b/confclient/single_wins/inventory
index fbc775e..763fa72 100644
--- a/confclient/single_wins/inventory
+++ b/confclient/single_wins/inventory
@@ -7,7 +7,6 @@ KEY 268 to_logwin
 KEY 269 to_g_keywin
 KEY 270 to_wg_keywin
 KEY 271 to_wk_keywin
-KEY 272 to_a_keywin
 KEY 87 winconf
 KEY 62 cyc_win_f
 KEY 60 cyc_win_b
@@ -115,10 +114,3 @@ KEY 260 map_l
 KEY 261 map_r
 KEY 46 map_c
 KEY 70 to_autofocus
-
-WINDOW a
-NAME 'Active window`s keys'
-BREAK 0
-WIDTH 22
-HEIGHT -8
-
diff --git a/confclient/single_wins/log b/confclient/single_wins/log
index d064db5..42d2fba 100644
--- a/confclient/single_wins/log
+++ b/confclient/single_wins/log
@@ -7,7 +7,6 @@ KEY 268 to_logwin
 KEY 269 to_g_keywin
 KEY 270 to_wg_keywin
 KEY 271 to_wk_keywin
-KEY 272 to_a_keywin
 KEY 87 winconf
 KEY 62 cyc_win_f
 KEY 60 cyc_win_b
@@ -117,10 +116,3 @@ KEY 260 map_l
 KEY 261 map_r
 KEY 46 map_c
 KEY 70 to_autofocus
-
-WINDOW a
-NAME 'Active window`s keys'
-BREAK 0
-WIDTH 22
-HEIGHT -8
-
diff --git a/confclient/single_wins/map b/confclient/single_wins/map
index 38ed98a..689f9c4 100644
--- a/confclient/single_wins/map
+++ b/confclient/single_wins/map
@@ -7,7 +7,6 @@ KEY 268 to_logwin
 KEY 269 to_g_keywin
 KEY 270 to_wg_keywin
 KEY 271 to_wk_keywin
-KEY 272 to_a_keywin
 KEY 87 winconf
 KEY 62 cyc_win_f
 KEY 60 cyc_win_b
@@ -106,9 +105,3 @@ NAME 'Log'
 BREAK 0
 WIDTH 13
 HEIGHT -8
-
-WINDOW a
-NAME 'Active window`s keys'
-BREAK 0
-WIDTH 22
-HEIGHT -8
diff --git a/src/client/draw_wins.c b/src/client/draw_wins.c
index b230b6a..1a3c9ad 100644
--- a/src/client/draw_wins.c
+++ b/src/client/draw_wins.c
@@ -16,7 +16,7 @@
 #include "../common/rexit.h" /* exit_err(), exit_trouble() */
 #include "../common/try_malloc.h" /* try_malloc() */
 #include "keybindings.h" /* struct KeyBindingDB, get_keyname_to_keycode() */
-#include "windows.h" /* yx_uint16, Win, get_win_by_id() */
+#include "windows.h" /* yx_uint16, Win */
 #include "world.h" /* global world */
 
 
@@ -56,9 +56,6 @@ static void add_line_compact(struct Win * win, char * line, attr_t attri,
 static void add_text_with_linebreaks(struct Win * win, char * text);
 static void draw_text_from_bottom(struct Win * win, char * text);
 
-/* Return a properly formatted keybinding list line for "kb". */
-static char * get_kb_line(struct KeyBinding * kb);
-
 /* Draw from line "start" on config view for keybindings defined at "kb". */
 static void draw_keybinding_config(struct Win * win, struct KeyBindingDB * kbdb,
                                    uint16_t offset);
@@ -259,19 +256,6 @@ static void draw_text_from_bottom(struct Win * win, char * text)
 
 
 
-static char * get_kb_line(struct KeyBinding * kb)
-{
-    char * keyname = get_keyname_to_keycode(kb->keycode);
-    uint16_t size = strlen(keyname) + 3 + strlen(kb->command->dsc_long) + 1;
-    char * kb_line = try_malloc(size, __func__);
-    int test = sprintf(kb_line, "%s - %s", keyname, kb->command->dsc_long);
-    exit_trouble(test < 0, __func__, "sprintf");
-    free(keyname);
-    return kb_line;
-}
-
-
-
 static void draw_keybinding_config(struct Win * win, struct KeyBindingDB * kbdb,
                                    uint16_t offset)
 {
@@ -293,7 +277,13 @@ static void draw_keybinding_config(struct Win * win, struct KeyBindingDB * kbdb,
             }
             win->center.y = win->winmap_size.y;
         }
-        char * kb_line = get_kb_line(&kbdb->kbs[kb_n]);
+        struct KeyBinding kb = kbdb->kbs[kb_n];
+        char * keyname = get_keyname_to_keycode(kb.keycode);
+        uint16_t size = strlen(keyname) + 3 + strlen(kb.command->dsc_long) + 1;
+        char * kb_line = try_malloc(size, __func__);
+        int test = sprintf(kb_line, "%s - %s", keyname, kb.command->dsc_long);
+        exit_trouble(test < 0, __func__, "sprintf");
+        free(keyname);
         add_line(win, kb_line, attri, &offset, (kbdb->n_of_kbs == kb_n + 1));
         free(kb_line);
     }
@@ -444,36 +434,6 @@ extern void draw_win_inventory(struct Win * win)
 
 
 
-extern void draw_win_active_windows_keys(struct Win * win)
-{
-    struct Win * win_active = get_win_by_id(world.winDB.active);
-    struct KeyBindingDB * kbdb = &win_active->kb;
-    if      (1 == win_active->view)
-    {
-        kbdb = &world.kb_wingeom;
-    }
-    else if (2 == win_active->view)
-    {
-        kbdb = &world.kb_winkeys;
-    }
-    uint16_t offset = 0;
-    if (0 == kbdb->n_of_kbs)
-    {
-        add_line(win, "(none)", 0, &offset, 0);
-        return;
-    }
-    uint8_t kb_n;
-    for (kb_n = 0; kb_n < kbdb->n_of_kbs; kb_n++)
-    {
-        char * kb_line = get_kb_line(&kbdb->kbs[kb_n]);
-        add_line(win, kb_line, 0, &offset, (0 == kb_n + 1));
-        free(kb_line);
-    }
-
-}
-
-
-
 extern void draw_win_keybindings_global(struct Win * win)
 {
     win->center.y = world.kb_global.select;
diff --git a/src/client/main.c b/src/client/main.c
index 4bf6461..d08ac7d 100644
--- a/src/client/main.c
+++ b/src/client/main.c
@@ -33,7 +33,7 @@ int main(int argc, char * argv[])
     /* Declare hard-coded paths and values here. */
     world.path_commands    = "confclient/commands";
     world.path_interface   = "confclient/interface_conf";
-    world.winDB.legal_ids  = "012cilma";
+    world.winDB.legal_ids  = "012cilm";
     char * path_server_in  = "server/in";
     char * path_server_out = "server/out";
 
diff --git a/src/client/windows.c b/src/client/windows.c
index 6884ddf..576cd56 100644
--- a/src/client/windows.c
+++ b/src/client/windows.c
@@ -21,10 +21,9 @@
 #include "../common/try_malloc.h" /* try_malloc() */
 #include "draw_wins.h" /* draw_winconf_geometry(), draw_winconf_keybindings(),
                         * draw_win_inventory(), draw_win_info(), draw_win_log(),
-                        * draw_win_active_windows_keys(), draw_win_map(),
                         * draw_win_keybindings_winconf_keybindings(),
                         * draw_win_keybindings_winconf_geometry(),
-                        * draw_win_keybindings_global()
+                        * draw_win_keybindings_global(), draw_win_map()
                         */
 #include "wincontrol.h" /* toggle_window() */
 #include "world.h" /* world */
@@ -121,7 +120,6 @@ static void (* get_drawfunc_by_char(char c)) ()
     if (   match_func(c, &f, 'c', draw_win_inventory)
         || match_func(c, &f, 'i', draw_win_info)
         || match_func(c, &f, 'l', draw_win_log)
-        || match_func(c, &f, 'a', draw_win_active_windows_keys)
         || 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)