From 6ee29bfa110ca79fef47bab59da5704f4a3d341d Mon Sep 17 00:00:00 2001 From: Eric Wald Date: Sun, 17 Aug 2014 10:59:33 -0600 Subject: [PATCH 1/4] Moving trade screen search lines Now that this screen uses the window's full height, the hard-coded line is no longer appropriate. --- plugins/search.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/search.cpp b/plugins/search.cpp index b4d5d6cc0..3e4638468 100644 --- a/plugins/search.cpp +++ b/plugins/search.cpp @@ -1074,7 +1074,7 @@ class trade_search_merc : public trade_search_base public: virtual void render() const { - print_search_option(2, 26); + print_search_option(2, -1); if (!search_string.empty()) { @@ -1116,7 +1116,7 @@ class trade_search_fort : public trade_search_base public: virtual void render() const { - print_search_option(42, 26); + print_search_option(42, -1); if (!search_string.empty()) { From 6060da5903be233df157d4a7ae8e6e2af2f0cdbf Mon Sep 17 00:00:00 2001 From: Eric Wald Date: Sun, 17 Aug 2014 12:27:57 -0600 Subject: [PATCH 2/4] Moving Mark/Unmark all in the trade screen These are in a different plugin, but affect the same interface. --- plugins/autotrade.cpp | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/plugins/autotrade.cpp b/plugins/autotrade.cpp index 5eacbf2d7..527f00cef 100644 --- a/plugins/autotrade.cpp +++ b/plugins/autotrade.cpp @@ -480,15 +480,19 @@ struct tradeview_hook : public df::viewscreen_tradegoodsst DEFINE_VMETHOD_INTERPOSE(void, render, ()) { INTERPOSE_NEXT(render)(); + + // Insert into the blank line between trade items and standard keys. + // The blank line at the bottom is taken by the search plugin. + auto dim = Screen::getWindowSize(); + int y = dim.y - 5; + int x = 2; - int y = 27; - OutputHotkeyString(x, y, "Mark all", "m", true, 2); + OutputHotkeyString(x, y, "Mark all, ", "m"); OutputHotkeyString(x, y, "Unmark all", "u"); x = 42; - y = 27; - OutputHotkeyString(x, y, "Mark all", "Shift-m", true, 42); - OutputHotkeyString(x, y, "Unmark all", "Shift-u"); + OutputHotkeyString(x, y, "Mark all, ", "M"); + OutputHotkeyString(x, y, "Unmark all", "U"); } }; From 2b59f0edcac51008b3f72163698b6a9750da3a1f Mon Sep 17 00:00:00 2001 From: Eric Wald Date: Sun, 17 Aug 2014 12:38:13 -0600 Subject: [PATCH 3/4] Switching Mark/Unmark all hotkeys to red Following the policy described in the Readme. --- plugins/autotrade.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/plugins/autotrade.cpp b/plugins/autotrade.cpp index 527f00cef..c7b1b6ecb 100644 --- a/plugins/autotrade.cpp +++ b/plugins/autotrade.cpp @@ -487,12 +487,12 @@ struct tradeview_hook : public df::viewscreen_tradegoodsst int y = dim.y - 5; int x = 2; - OutputHotkeyString(x, y, "Mark all, ", "m"); - OutputHotkeyString(x, y, "Unmark all", "u"); + OutputHotkeyString(x, y, "Mark all, ", "m", false, x, COLOR_WHITE, COLOR_LIGHTRED); + OutputHotkeyString(x, y, "Unmark all", "u", false, x, COLOR_WHITE, COLOR_LIGHTRED); x = 42; - OutputHotkeyString(x, y, "Mark all, ", "M"); - OutputHotkeyString(x, y, "Unmark all", "U"); + OutputHotkeyString(x, y, "Mark all, ", "M", false, x, COLOR_WHITE, COLOR_LIGHTRED); + OutputHotkeyString(x, y, "Unmark all", "U", false, x, COLOR_WHITE, COLOR_LIGHTRED); } }; From 6d9d616fff4a06f2509e9c3386285a89334c74e8 Mon Sep 17 00:00:00 2001 From: Eric Wald Date: Mon, 25 Aug 2014 21:18:52 -0600 Subject: [PATCH 4/4] Prioritizing search hooks on the trade screen. The autotrade plugin has been intercepting the m/u/M/U keys if enabled after enabling the search plugin. An explicit priority makes the search plugin always accept those keys while typing in a search line. --- plugins/search.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/plugins/search.cpp b/plugins/search.cpp index 3e4638468..18586657b 100644 --- a/plugins/search.cpp +++ b/plugins/search.cpp @@ -693,10 +693,10 @@ template V generic_search_hook ::module; // Hook definition helpers -#define IMPLEMENT_HOOKS_WITH_ID(screen, module, id) \ +#define IMPLEMENT_HOOKS_WITH_ID(screen, module, id, prio) \ typedef generic_search_hook module##_hook; \ - template<> IMPLEMENT_VMETHOD_INTERPOSE(module##_hook, feed); \ - template<> IMPLEMENT_VMETHOD_INTERPOSE(module##_hook, render) + template<> IMPLEMENT_VMETHOD_INTERPOSE_PRIO(module##_hook, feed, prio); \ + template<> IMPLEMENT_VMETHOD_INTERPOSE_PRIO(module##_hook, render, prio) #define IMPLEMENT_HOOKS(screen, module) \ typedef generic_search_hook module##_hook; \ @@ -1108,7 +1108,7 @@ private: } }; -IMPLEMENT_HOOKS_WITH_ID(df::viewscreen_tradegoodsst, trade_search_merc, 1); +IMPLEMENT_HOOKS_WITH_ID(df::viewscreen_tradegoodsst, trade_search_merc, 1, 100); class trade_search_fort : public trade_search_base @@ -1150,7 +1150,7 @@ private: } }; -IMPLEMENT_HOOKS_WITH_ID(df::viewscreen_tradegoodsst, trade_search_fort, 2); +IMPLEMENT_HOOKS_WITH_ID(df::viewscreen_tradegoodsst, trade_search_fort, 2, 100); // // END: Trade screen search