From e54556f565e1504ea4b85cfabab2debe251c0095 Mon Sep 17 00:00:00 2001 From: Ichthyostega Date: Sat, 29 Sep 2018 13:37:48 +0200 Subject: [PATCH] DemoGuiRoundtrip: draft mock commands to be invoked this would be the first half of the roundtrip, the call UI -> Proc --- src/proc/cmd.hpp | 5 ++ src/proc/cmd/meta-cmd.cpp | 111 ++++++++++++++++++++++++++++++++++++-- wiki/thinkPad.ichthyo.mm | 34 +++++++----- 3 files changed, 134 insertions(+), 16 deletions(-) diff --git a/src/proc/cmd.hpp b/src/proc/cmd.hpp index e23aec071..c56ac6c2c 100644 --- a/src/proc/cmd.hpp +++ b/src/proc/cmd.hpp @@ -76,6 +76,11 @@ namespace cmd { extern CommandSetup test_meta_activateContentDiff; ////////////////////////////////TICKET #211 prefix test_ bypasses logging and immediately executes for now (2018) extern CommandSetup meta_deactivateContentDiff; + //--Demo-and-Development---- + extern CommandSetup test_meta_displayInfo; + extern CommandSetup test_meta_markError; + extern CommandSetup test_meta_markNote; + extern CommandSetup test_meta_markAction; }} // namespace proc::cmd diff --git a/src/proc/cmd/meta-cmd.cpp b/src/proc/cmd/meta-cmd.cpp index 100eddfe3..ef0cf7ed3 100644 --- a/src/proc/cmd/meta-cmd.cpp +++ b/src/proc/cmd/meta-cmd.cpp @@ -39,16 +39,23 @@ #include "proc/control/command-def.hpp" //#include "proc/mobject/session.hpp" #include "include/gui-notification-facade.h" +#include "gui/interact/wizard.hpp" //////////////////////////////////////////////////////////////TICKET #1099 : include needed temporarily //#include "lib/symbol.hpp" #include "lib/idi/entry-id.hpp" //#include "lib/format-string.hpp" -//#include +#include using lib::hash::LuidH; -//using std::string; +using gui::ID; +using gui::NOTE_INFO; +using gui::NOTE_WARN; +using gui::NOTE_ERROR; +using gui::NotifyLevel; +using gui::GuiNotification; //using util::cStr; //using util::_Fmt; +using std::string; namespace proc { @@ -80,7 +87,7 @@ COMMAND_DEFINITION (test_meta_activateContentDiff) TODO ("send a population diff starting from scratch"); TODO ("activate life-update service within the session"); // Temporary hack to get any meaningful UI <-> Proc communication - gui::GuiNotification::facade().displayInfo(gui::NOTE_INFO, "Request: population-Diff from Session."); + GuiNotification::facade().displayInfo(NOTE_INFO, "Request: population-Diff from Session."); }) .captureUndo ([]() -> bool { @@ -130,6 +137,104 @@ COMMAND_DEFINITION (meta_deactivateContentDiff) + /* ===== Demo and Development ===== */ + + /** DemoGuiRoundtrip: push a notification info message back up into the UI. + * @todo this is a demo mock setup to further development of the Proc-UI integration //////////////////TICKET #1099 : prototypical Proc-GUI communication + */ +COMMAND_DEFINITION (test_meta_displayInfo) + { + def.operation ([](NotifyLevel level, string message) + { + GuiNotification::facade().displayInfo (level, message); + }) + .captureUndo ([](NotifyLevel level, string message) -> bool + { + return true; + }) + .undoOperation ([](NotifyLevel level, string message, bool wasActive) + { + if (wasActive) + { + GuiNotification::facade().displayInfo (NOTE_WARN, "Sorry, can't do that Dave."); + } + }); + }; + + + /** DemoGuiRoundtrip: send a `markError` message back up into the UI. + * @todo this is a demo mock setup to further development of the Proc-UI integration //////////////////TICKET #1099 : prototypical Proc-GUI communication + */ +COMMAND_DEFINITION (test_meta_markError) + { + def.operation ([](string message) + { + ID errorLogID = gui::interact::Wizard::getErrorLogID(); + GuiNotification::facade().markError (errorLogID, message); + }) + .captureUndo ([](string message) -> bool + { + return true; + }) + .undoOperation ([](string message, bool wasActive) + { + if (wasActive) + { + GuiNotification::facade().displayInfo (NOTE_WARN, "Sorry, can't do that Dave."); + } + }); + }; + + + /** DemoGuiRoundtrip: send a `markNote` message back up into the UI. + * @todo this is a demo mock setup to further development of the Proc-UI integration //////////////////TICKET #1099 : prototypical Proc-GUI communication + */ +COMMAND_DEFINITION (test_meta_markNote) + { + def.operation ([](string message) + { + ID errorLogID = gui::interact::Wizard::getErrorLogID(); + GuiNotification::facade().markNote (errorLogID, message); + }) + .captureUndo ([](string message) -> bool + { + return true; + }) + .undoOperation ([](string message, bool wasActive) + { + if (wasActive) + { + GuiNotification::facade().displayInfo (NOTE_WARN, "Sorry, can't do that Dave."); + } + }); + }; + + + /** DemoGuiRoundtrip: send a generic `mark` message with given _action ID_ back up into the UI. + * @todo this is a demo mock setup to further development of the Proc-UI integration //////////////////TICKET #1099 : prototypical Proc-GUI communication + */ +COMMAND_DEFINITION (test_meta_markAction) + { + def.operation ([](string actionID, string message) + { + ID errorLogID = gui::interact::Wizard::getErrorLogID(); + UNIMPLEMENTED ("GuiNotification::facade().mark (errorLogID, actionID, message);"); + }) + .captureUndo ([](string actionID, string message) -> bool + { + return true; + }) + .undoOperation ([](string actionID, string message, bool wasActive) + { + if (wasActive) + { + GuiNotification::facade().displayInfo (NOTE_WARN, "Sorry, can't do that Dave."); + } + }); + }; + + + /** more to come here...*/ diff --git a/wiki/thinkPad.ichthyo.mm b/wiki/thinkPad.ichthyo.mm index e42405ae8..51b725218 100644 --- a/wiki/thinkPad.ichthyo.mm +++ b/wiki/thinkPad.ichthyo.mm @@ -2804,28 +2804,36 @@ + + + + + + - - - - - - - + + + + + + - - + + + + + - - + + - - + +