Lumiera 0.pre.04
»edit your freedom«
Loading...
Searching...
No Matches
meta-cmd.cpp
Go to the documentation of this file.
1/*
2 MetaCmd - actual steam command scripts for internal meta and control activities
3
4 Copyright (C)
5 2018, Hermann Vosseler <Ichthyostega@web.de>
6
7  **Lumiera** is free software; you can redistribute it and/or modify it
8  under the terms of the GNU General Public License as published by the
9  Free Software Foundation; either version 2 of the License, or (at your
10  option) any later version. See the file COPYING for further details.
11
12* *****************************************************************/
13
14
29#include "steam/cmd.hpp"
31//#include "steam/mobject/session.hpp"
35#include "lib/diff/gen-node.hpp"
36#include "lib/idi/entry-id.hpp"
37#include "lib/format-string.hpp"
38//#include "lib/symbol.hpp"
39#include "lib/util.hpp"
40
41#include <string>
42
44using stage::ID;
52//using util::cStr;
53using util::_Fmt;
54using util::isYes;
55using std::string;
56
57
58namespace steam {
59namespace cmd {
60 namespace error = lumiera::error;
61
62 //using mobject::Session;
63
64 namespace { // implementation helper...
65 }//(End) implementation helper
66
67
68
69
81 {
82 def.operation ([]()
83 {
84 TODO ("send a population diff starting from scratch");
85 TODO ("activate life-update service within the session");
86 // Temporary hack to get any meaningful UI <-> Steam communication
87 GuiNotification::facade().displayInfo(NOTE_INFO, "Request: population-Diff from Session.");
88 })
89 .captureUndo ([]() -> bool
90 {
91 return false;
92 })
93 .undoOperation ([](bool wasActive)
94 {
95 if (not wasActive)
96 {
97 UNIMPLEMENTED ("send a status update diff into the root node, to mark it as defunct");
98 TODO ("clear the life-update service within the session");
99 }
100 });
101 };
102
103
114 {
115 def.operation ([]()
116 {
117 TODO ("send a status update diff into the root node, to mark it as defunct");
118 TODO ("clear the life-update service within the session");
119 })
120 .captureUndo ([]() -> bool
121 {
122 return true;
123 })
124 .undoOperation ([](bool wasActive)
125 {
126 if (wasActive)
127 {
128 UNIMPLEMENTED ("send a diff update to completely clear the root node, then send a population diff with current session content");
129 TODO ("activate life-update service within the session");
130 }
131 });
132 };
133
134
135
136
137 /* ===== Demo and Development ===== */
138
143 {
144 def.operation ([](int level, string message)
145 {
146 GuiNotification::facade().displayInfo (static_cast<NotifyLevel>(level), message);
147 })
148 .captureUndo ([](int level, string message) -> string
149 {
150 return _Fmt{"displayInfo(%d, '%s')"} % level % message;
151 })
152 .undoOperation ([](int, string, string uiAction)
153 {
154 GuiNotification::facade().displayInfo (NOTE_WARN, "can not UNDO UI-Action: "+uiAction);
155 });
156 };
157
158
163 {
164 def.operation ([](string message)
165 {
167 GuiNotification::facade().markError (errorLogID, message);
168 })
169 .captureUndo ([](string message) -> string
170 {
171 return _Fmt{"GUI::errorLog <- markError('%s')"} % message;
172 })
173 .undoOperation ([](string, string uiAction)
174 {
175 GuiNotification::facade().displayInfo (NOTE_WARN, "can not UNDO UI-Action: "+uiAction);
176 });
177 };
178
179
184 {
185 def.operation ([](string message)
186 {
188 GuiNotification::facade().markNote (errorLogID, message);
189 })
190 .captureUndo ([](string message) -> string
191 {
192 return _Fmt{"GUI::errorLog <- markNote('%s')"} % message;
193 })
194 .undoOperation ([](string, string uiAction)
195 {
196 GuiNotification::facade().displayInfo (NOTE_WARN, "can not UNDO UI-Action: "+uiAction);
197 });
198 };
199
200
205 {
206 def.operation ([](string actionID, string message)
207 {
209 GuiNotification::facade().mark (errorLogID
210 ,actionID==MARK_expand? GenNode{actionID, isYes(message)}
211 : GenNode{actionID, message});
212 })
213 .captureUndo ([](string actionID, string message) -> string
214 {
215 return _Fmt{"GUI::errorLog <- mark(%s, '%s')"} % actionID % message;
216 })
217 .undoOperation ([](string, string, string uiAction)
218 {
219 GuiNotification::facade().displayInfo (NOTE_WARN, "can not UNDO UI-Action: "+uiAction);
220 });
221 };
222
223
224
229}} // namespace steam::cmd
Hash implementation based on a lumiera unique object id (LUID) When invoking the default ctor,...
Global access point to push state update and notification of events from the lower layers into the Lu...
static lib::Depend< GuiNotification > facade
static storage for the facade access front-end
static ID getErrorLogID()
Definition wizard.hpp:90
A front-end for using printf-style formatting.
Common ID definitions for Steam-Layer commands.
Actually defining a command and binding it to execution parameters.
#define COMMAND_DEFINITION(_NAME_)
Macro to write command definitions in a compact form.
Bare symbolic and hash ID used for accounting of asset like entries.
Front-end for printf-style string template interpolation.
Generic building block for tree shaped (meta)data structures.
Major public Interface of the Lumiera GUI.
lib::idi::BareEntryID const & ID
@ NOTE_INFO
possibly interesting info that can be safely ignored
@ NOTE_ERROR
severe condition to be indicated prominently
@ NOTE_WARN
something to be aware of, to be indicated unobtrusively
const Symbol MARK_expand
CommandSetup test_meta_markAction
CommandSetup test_meta_markNote
CommandSetup test_meta_markError
CommandSetup test_meta_displayInfo
CommandSetup test_meta_activateContentDiff
CommandSetup meta_deactivateContentDiff
Steam-Layer implementation namespace root.
bool isYes(string const &textForm) noexcept
check the given text if it can be interpreted as affirmative answer (bool true).
Definition util.cpp:108
generic data element node within a tree
Definition gen-node.hpp:224
Hard wired key constants and basic definitions for communication with the GUI.
Tiny helper functions and shortcuts to be used everywhere Consider this header to be effectively incl...
Global help controller.