DemoGuiRoundtrip: now invoke the Proc-Layer commands from within the UI dialog
This commit is contained in:
parent
e54556f565
commit
abfb897336
4 changed files with 79 additions and 53 deletions
|
|
@ -42,6 +42,9 @@
|
|||
#include "gui/gtk-base.hpp"
|
||||
#include "gui/dialog/dialog.hpp"
|
||||
#include "gui/ctrl/bus-term.hpp"
|
||||
#include "gui/model/tangible.hpp"
|
||||
#include "proc/cmd.hpp"
|
||||
#include "include/gui-notification-facade.h"
|
||||
#include "lib/scoped-ptrvect.hpp"
|
||||
#include "lib/diff/gen-node.hpp"
|
||||
#include "lib/nocopy.hpp"
|
||||
|
|
@ -179,14 +182,27 @@ namespace dialog {
|
|||
Gtk::Box markParam_;
|
||||
Gtk::ComboBoxText actionID_{true}; // has free-text entry field
|
||||
|
||||
string
|
||||
int
|
||||
getLogLevel()
|
||||
{
|
||||
return level_info_.get_active()? "NOTE_INFO" :
|
||||
level_warn_.get_active()? "NOTE_WARN" : "NOTE_ERROR";
|
||||
return level_info_.get_active()? NOTE_INFO :
|
||||
level_warn_.get_active()? NOTE_WARN : NOTE_ERROR;
|
||||
}
|
||||
|
||||
Page1(Bus bus)
|
||||
string
|
||||
getContent()
|
||||
{
|
||||
return string{content_.get_text()};
|
||||
}
|
||||
|
||||
string
|
||||
getActionID()
|
||||
{
|
||||
return string{actionID_.get_entry_text()};
|
||||
}
|
||||
|
||||
|
||||
Page1 (Bus bus)
|
||||
{
|
||||
content_.set_tooltip_markup (_("<b>Ticket #1099</b>:\n"
|
||||
"text message content\n"
|
||||
|
|
@ -247,13 +263,13 @@ namespace dialog {
|
|||
|
||||
// define the action triggers...
|
||||
trig_1_.signal_clicked().connect(
|
||||
[&]{ demoGuiRoundtrip(bus, "displayInfo("+getLogLevel()+", \""+content_.get_text()+"\")"); });
|
||||
[&]{ bus.act (model::commandMessage (proc::cmd::test_meta_displayInfo, getLogLevel(), getContent())); });
|
||||
trig_2_.signal_clicked().connect(
|
||||
[&]{ demoGuiRoundtrip(bus, "markError(\""+content_.get_text()+"\")"); });
|
||||
[&]{ bus.act (model::commandMessage (proc::cmd::test_meta_markError, getContent())); });
|
||||
trig_3_.signal_clicked().connect(
|
||||
[&]{ demoGuiRoundtrip(bus, "markNote(\""+content_.get_text()+"\")"); });
|
||||
[&]{ bus.act (model::commandMessage (proc::cmd::test_meta_markNote, getContent())); });
|
||||
trig_4_.signal_clicked().connect(
|
||||
[&]{ demoGuiRoundtrip(bus, "mark("+actionID_.get_entry_text()+", \""+content_.get_text()+"\")"); });
|
||||
[&]{ bus.act (model::commandMessage (proc::cmd::test_meta_markAction, getActionID(), getContent())); });
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
|||
|
|
@ -241,18 +241,32 @@ namespace model {
|
|||
|
||||
|
||||
|
||||
/** convenience shortcut to build a message suitable for command invocation
|
||||
* @param args... sequence of arguments to be packaged into a lib::diff::Rec for invocation
|
||||
*/
|
||||
template<typename...ARGS>
|
||||
inline lib::diff::GenNode
|
||||
commandMessage (Symbol cmdID, ARGS&&... args)
|
||||
{
|
||||
using lib::diff::Rec;
|
||||
using lib::diff::GenNode;
|
||||
using GenNodeIL = std::initializer_list<GenNode>;
|
||||
|
||||
|
||||
return GenNode (string{cmdID},
|
||||
Rec(Rec::TYPE_NIL_SYM
|
||||
,GenNodeIL{}
|
||||
,GenNodeIL {std::forward<ARGS> (args)...}));
|
||||
} // not typed, no attributes, all arguments as children
|
||||
|
||||
|
||||
/** convenience shortcut to issue a command with several arguments */
|
||||
template<typename...ARGS>
|
||||
inline void
|
||||
Tangible::invoke (Symbol cmdID, ARGS&&... args)
|
||||
{
|
||||
using GenNodeIL = std::initializer_list<GenNode>;
|
||||
|
||||
invoke (cmdID,
|
||||
Rec(Rec::TYPE_NIL_SYM
|
||||
,GenNodeIL{}
|
||||
,GenNodeIL {std::forward<ARGS> (args)...}));
|
||||
} // not typed, no attributes, all arguments as children
|
||||
uiBus_.act (commandMessage (cmdID, std::forward<ARGS> (args)...));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@
|
|||
#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 "lib/format-string.hpp" //////////////////////////////////////////////////////////////TICKET #1099 : include needed temporarily
|
||||
|
||||
#include <string>
|
||||
|
||||
|
|
@ -54,7 +54,7 @@ using gui::NOTE_ERROR;
|
|||
using gui::NotifyLevel;
|
||||
using gui::GuiNotification;
|
||||
//using util::cStr;
|
||||
//using util::_Fmt;
|
||||
using util::_Fmt; //////////////////////////////////////////////////////////////TICKET #1099 : include needed temporarily
|
||||
using std::string;
|
||||
|
||||
|
||||
|
|
@ -144,20 +144,17 @@ COMMAND_DEFINITION (meta_deactivateContentDiff)
|
|||
*/
|
||||
COMMAND_DEFINITION (test_meta_displayInfo)
|
||||
{
|
||||
def.operation ([](NotifyLevel level, string message)
|
||||
def.operation ([](int level, string message)
|
||||
{
|
||||
GuiNotification::facade().displayInfo (level, message);
|
||||
GuiNotification::facade().displayInfo (static_cast<NotifyLevel>(level), message);
|
||||
})
|
||||
.captureUndo ([](NotifyLevel level, string message) -> bool
|
||||
.captureUndo ([](int level, string message) -> string
|
||||
{
|
||||
return true;
|
||||
return _Fmt{"displayInfo(%d, '%s')"} % level % message;
|
||||
})
|
||||
.undoOperation ([](NotifyLevel level, string message, bool wasActive)
|
||||
.undoOperation ([](int, string, string uiAction)
|
||||
{
|
||||
if (wasActive)
|
||||
{
|
||||
GuiNotification::facade().displayInfo (NOTE_WARN, "Sorry, can't do that Dave.");
|
||||
}
|
||||
GuiNotification::facade().displayInfo (NOTE_WARN, "can not UNDO UI-Action: "+uiAction);
|
||||
});
|
||||
};
|
||||
|
||||
|
|
@ -172,16 +169,13 @@ COMMAND_DEFINITION (test_meta_markError)
|
|||
ID errorLogID = gui::interact::Wizard::getErrorLogID();
|
||||
GuiNotification::facade().markError (errorLogID, message);
|
||||
})
|
||||
.captureUndo ([](string message) -> bool
|
||||
.captureUndo ([](string message) -> string
|
||||
{
|
||||
return true;
|
||||
return _Fmt{"GUI::errorLog <- markError('%s')"} % message;
|
||||
})
|
||||
.undoOperation ([](string message, bool wasActive)
|
||||
.undoOperation ([](string, string uiAction)
|
||||
{
|
||||
if (wasActive)
|
||||
{
|
||||
GuiNotification::facade().displayInfo (NOTE_WARN, "Sorry, can't do that Dave.");
|
||||
}
|
||||
GuiNotification::facade().displayInfo (NOTE_WARN, "can not UNDO UI-Action: "+uiAction);
|
||||
});
|
||||
};
|
||||
|
||||
|
|
@ -196,16 +190,13 @@ COMMAND_DEFINITION (test_meta_markNote)
|
|||
ID errorLogID = gui::interact::Wizard::getErrorLogID();
|
||||
GuiNotification::facade().markNote (errorLogID, message);
|
||||
})
|
||||
.captureUndo ([](string message) -> bool
|
||||
.captureUndo ([](string message) -> string
|
||||
{
|
||||
return true;
|
||||
return _Fmt{"GUI::errorLog <- markNote('%s')"} % message;
|
||||
})
|
||||
.undoOperation ([](string message, bool wasActive)
|
||||
.undoOperation ([](string, string uiAction)
|
||||
{
|
||||
if (wasActive)
|
||||
{
|
||||
GuiNotification::facade().displayInfo (NOTE_WARN, "Sorry, can't do that Dave.");
|
||||
}
|
||||
GuiNotification::facade().displayInfo (NOTE_WARN, "can not UNDO UI-Action: "+uiAction);
|
||||
});
|
||||
};
|
||||
|
||||
|
|
@ -220,16 +211,13 @@ COMMAND_DEFINITION (test_meta_markAction)
|
|||
ID errorLogID = gui::interact::Wizard::getErrorLogID();
|
||||
UNIMPLEMENTED ("GuiNotification::facade().mark (errorLogID, actionID, message);");
|
||||
})
|
||||
.captureUndo ([](string actionID, string message) -> bool
|
||||
.captureUndo ([](string actionID, string message) -> string
|
||||
{
|
||||
return true;
|
||||
return _Fmt{"GUI::errorLog <- mark(%s, '%s')"} % actionID % message;
|
||||
})
|
||||
.undoOperation ([](string actionID, string message, bool wasActive)
|
||||
.undoOperation ([](string, string, string uiAction)
|
||||
{
|
||||
if (wasActive)
|
||||
{
|
||||
GuiNotification::facade().displayInfo (NOTE_WARN, "Sorry, can't do that Dave.");
|
||||
}
|
||||
GuiNotification::facade().displayInfo (NOTE_WARN, "can not UNDO UI-Action: "+uiAction);
|
||||
});
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -2801,15 +2801,23 @@
|
|||
</node>
|
||||
</node>
|
||||
</node>
|
||||
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1533689243871" ID="ID_1745090225" MODIFIED="1538176877674" TEXT="triggert Dummy-Command">
|
||||
<node COLOR="#338800" CREATED="1533689243871" ID="ID_1745090225" MODIFIED="1538227119464" TEXT="triggert Dummy-Command">
|
||||
<linktarget COLOR="#47ebbb" DESTINATION="ID_1745090225" ENDARROW="Default" ENDINCLINATION="119;0;" ID="Arrow_ID_372783230" SOURCE="ID_1206004" STARTARROW="None" STARTINCLINATION="-10;35;"/>
|
||||
<icon BUILTIN="flag-yellow"/>
|
||||
<icon BUILTIN="button_ok"/>
|
||||
<node COLOR="#435e98" CREATED="1538220904703" HGAP="46" ID="ID_1997338106" MODIFIED="1538220975996" TEXT="definieren..." VSHIFT="31">
|
||||
<icon BUILTIN="yes"/>
|
||||
<node CREATED="1538220944278" MODIFIED="1538220944278" TEXT="test_meta_displayInfo"/>
|
||||
<node CREATED="1538220949651" MODIFIED="1538220949651" TEXT="test_meta_markError"/>
|
||||
<node CREATED="1538220955266" MODIFIED="1538220955266" TEXT="test_meta_markNote"/>
|
||||
<node CREATED="1538220961641" MODIFIED="1538220961641" TEXT="test_meta_markAction"/>
|
||||
<node COLOR="#338800" CREATED="1538220944278" ID="ID_1508594379" MODIFIED="1538227139691" TEXT="test_meta_displayInfo">
|
||||
<icon BUILTIN="button_ok"/>
|
||||
</node>
|
||||
<node COLOR="#338800" CREATED="1538220949651" ID="ID_1282771011" MODIFIED="1538227138739" TEXT="test_meta_markError">
|
||||
<icon BUILTIN="button_ok"/>
|
||||
</node>
|
||||
<node COLOR="#338800" CREATED="1538220955266" ID="ID_1011451863" MODIFIED="1538227137340" TEXT="test_meta_markNote">
|
||||
<icon BUILTIN="button_ok"/>
|
||||
</node>
|
||||
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1538220961641" ID="ID_1936475731" MODIFIED="1538227131061" TEXT="test_meta_markAction">
|
||||
<icon BUILTIN="flag-yellow"/>
|
||||
</node>
|
||||
</node>
|
||||
</node>
|
||||
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1533689255174" ID="ID_821013695" MODIFIED="1538220890763" TEXT="Aufruf via Notification_Facade">
|
||||
|
|
|
|||
Loading…
Reference in a new issue