TestControl: the first tangible UI feedback caused via UI-Bus (see #1099)
wrap up the helpers and wire the connection to the UI-Bus. Then attempt a direct invocation, still within the GTK thread. While this might seem as just some silly experiment, in fact it is *** THE FUCKING FIRST TIME to transmit a visible action to a real widget *** this links together and integrates various efforts achieved during the last years
This commit is contained in:
parent
74f3ab3932
commit
77980ef024
3 changed files with 81 additions and 21 deletions
|
|
@ -30,6 +30,8 @@
|
|||
** perform within the same environment as regular user interactions.
|
||||
**
|
||||
** @todo as of 9/2018, this is a first rough draft, relevant for #1099 ////////////////////////////TICKET #1074 gradually augment the self-diagnostics controls in the UI
|
||||
** @todo this header also features a design draft how to simplify building notebook widgets.
|
||||
** Which could be polished and moved into a separate utility header eventually.
|
||||
*/
|
||||
|
||||
|
||||
|
|
@ -41,16 +43,35 @@
|
|||
#include "gui/dialog/dialog.hpp"
|
||||
#include "gui/ctrl/bus-term.hpp"
|
||||
#include "lib/scoped-ptrvect.hpp"
|
||||
//#include "lib/meta/function.hpp"
|
||||
#include "lib/diff/gen-node.hpp"
|
||||
#include "lib/nocopy.hpp"
|
||||
|
||||
#include <utility>
|
||||
|
||||
#if true /////////////////////////////////////////////////////////////////////////////////////////////////////////////TICKET #1099 : WIP-WIP-WIP
|
||||
namespace proc {
|
||||
namespace asset {
|
||||
namespace meta {
|
||||
class ErrorLog;
|
||||
|
||||
extern lib::idi::EntryID<ErrorLog> theErrorLog_ID;
|
||||
} } }
|
||||
#endif /////////////////////////////////////////////////////////////////////////////////////////////////////////////TICKET #1099 : WIP-WIP-WIP
|
||||
namespace gui {
|
||||
namespace dialog {
|
||||
|
||||
using std::forward;
|
||||
using lib::diff::GenNode;
|
||||
|
||||
|
||||
/**
|
||||
* Building block for a segment within a dialog page.
|
||||
* This helper widget provides the typical sub section of a dialog
|
||||
* with several child widgets stacked vertically and enclosed within
|
||||
* a frame with a label. The frame serves as the parent widget, as far
|
||||
* as the widget hierarchy is concerned. Both parts are publicly accessible
|
||||
* as members, while providing a shortcut for publishing the box.
|
||||
*/
|
||||
struct FrameVBox
|
||||
{
|
||||
Gtk::Frame frame;
|
||||
|
|
@ -72,6 +93,7 @@ namespace dialog {
|
|||
}
|
||||
};
|
||||
|
||||
/** explicitly named shortcut for the typical dialog page content holder */
|
||||
class Page
|
||||
: public Gtk::Box
|
||||
, util::NonCopyable
|
||||
|
|
@ -80,10 +102,29 @@ namespace dialog {
|
|||
Page()
|
||||
: Gtk::Box{Gtk::ORIENTATION_VERTICAL}
|
||||
{ }
|
||||
|
||||
virtual ~Page() { }
|
||||
};
|
||||
|
||||
/**
|
||||
* Helper widget to simplify construction and wiring of a [Notebook] widget.
|
||||
* Gtk::Notebook is quite powerful container foundation to build complex dialog widgets with
|
||||
* multiple pages on tabs. However, the construction, wiring an setup is notoriously tedious,
|
||||
* due to the repetitiveness and the sheer amount of child widgets spread over various pages.
|
||||
*
|
||||
* This design draft is an attempt to mitigate the required boilerplate, without overly much
|
||||
* obscuring the structure. The basic idea is to package each page into a locally defined child
|
||||
* struct, which is actually heap allocated and managed automatically. This way, each child page
|
||||
* gets its own namespace, and wiring to other components is made explicit by passing named ctor
|
||||
* arguments -- while the overall structure of building and wiring of widgets stays close to the
|
||||
* habits of [programming with GTKmm](https://developer.gnome.org/gtkmm-tutorial/stable/).
|
||||
* - define the pages as custom widgets, typically just as locally known struct types
|
||||
* - invoke #buildPage passing the type and tab label for each page
|
||||
* - define the wiring of the components within a page in the page's ctor
|
||||
* - possibly pass external dependencies for wiring into that ctor
|
||||
* @note the page widgets are actually heap allocated and managed automatically
|
||||
* @see gui::dialog::TestControl as a usage example
|
||||
*
|
||||
* [Notebook]: https://developer.gnome.org/gtkmm-tutorial/stable/sec-multi-item-containers.html.en#sec-notebook
|
||||
*/
|
||||
class Notebook
|
||||
: public Gtk::Notebook
|
||||
, lib::ScopedPtrVect<Gtk::Widget>
|
||||
|
|
@ -99,14 +140,30 @@ namespace dialog {
|
|||
}
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* A complex, tabbed-notebook style non-modal dialog window,
|
||||
* dedicated to development, diagnostics and experimentation.
|
||||
* The TestControl can be launched from Lumiera's "Help" menu,
|
||||
* offers an (passive, up-link) [UI-Bus connection](\ref ui-bus.hpp)
|
||||
* and simplifies adding pages for occasional experiments and diagnostics.
|
||||
*/
|
||||
class TestControl
|
||||
: public Gtk::Dialog
|
||||
, ctrl::BusTerm
|
||||
{
|
||||
using Bus = ctrl::BusTerm&;
|
||||
Bus busTerm() { return *this; }
|
||||
|
||||
Bus uiBus_;
|
||||
Notebook notebook_;
|
||||
|
||||
|
||||
/**
|
||||
* Ticket #1099 : perform a dummy round-trip to verify Proc-GUI integration.
|
||||
* This routine invokes the command 'xxx' down in Proc-Layer, passing the settings
|
||||
* from the radio buttons to select the flavour of feedback, and the text for feedback content.
|
||||
* The expected behaviour is for the invoked command to send a feedback via UI-Bus towards
|
||||
* the ErrorLogDisplay within the InfoboxPanel.
|
||||
*/
|
||||
struct Page1 : Page
|
||||
{
|
||||
FrameVBox seg_1_{_("log notification")},
|
||||
|
|
@ -119,41 +176,35 @@ namespace dialog {
|
|||
trigger_1_.set_use_underline();
|
||||
trigger_1_.set_tooltip_markup (_("<b>Ticket #1099</b>:\ntrigger Proc-GUI roundtrip"));
|
||||
trigger_1_.signal_clicked().connect(
|
||||
mem_fun(*this, &Page1::demoGuiRoundtrip));
|
||||
[&]{ demoGuiRoundtrip(bus); });
|
||||
|
||||
seg_1_.pack_start (trigger_1_, Gtk::PACK_SHRINK);
|
||||
pack_start (seg_1_);
|
||||
pack_start (seg_2_);
|
||||
}
|
||||
|
||||
/**
|
||||
* Ticket #1099 : perform a dummy round-trip to verify Proc-GUI integration.
|
||||
* This routine invokes the command 'xxx' down in Proc-Layer, passing the settings
|
||||
* from the radio buttons to select the flavour of feedback, and the text for feedback content.
|
||||
* The expected behaviour is for the invoked command to send a feedback via UI-Bus towards
|
||||
* the ErrorLogDisplay within the InfoboxPanel.
|
||||
*/
|
||||
void
|
||||
demoGuiRoundtrip()
|
||||
demoGuiRoundtrip (Bus bus)
|
||||
{
|
||||
UNIMPLEMENTED ("collect command arguments and then send the command message for #1099");
|
||||
TODO ("collect command arguments and then send the command message for #1099");
|
||||
ID errorLogID = proc::asset::meta::theErrorLog_ID;
|
||||
bus.mark (errorLogID, GenNode{"Message", "Lalü"});
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Notebook notebook_;
|
||||
|
||||
public:
|
||||
TestControl (ctrl::BusTerm& upLink, Gtk::Window& parent)
|
||||
: Dialog(_("Test and Diagnostics"), parent, Gtk::DIALOG_DESTROY_WITH_PARENT)
|
||||
, ctrl::BusTerm{lib::idi::EntryID<TestControl>{}, upLink}
|
||||
, uiBus_{upLink}
|
||||
{
|
||||
// Setup the overall dialog layout
|
||||
set_border_width (BorderPadding);
|
||||
get_content_area()->pack_start (notebook_);
|
||||
|
||||
// construct and wire the pages...
|
||||
notebook_.buildPage<Page1> (_("#1099"), busTerm());
|
||||
notebook_.buildPage<Page1> (_("#1099"), uiBus_);
|
||||
|
||||
show_all();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -212,6 +212,7 @@ namespace widget {
|
|||
buff->insert_with_tag(buff->end(), text, cuString{markupTagName});
|
||||
else
|
||||
buff->insert (buff->end(), text);
|
||||
buff->insert (buff->end(), "\n");
|
||||
textLog_.scroll_to (cursor);
|
||||
return cursor;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2771,8 +2771,8 @@
|
|||
<icon BUILTIN="info"/>
|
||||
</node>
|
||||
</node>
|
||||
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1537961550200" ID="ID_226231657" MODIFIED="1537962140152" TEXT="setup für Notebook-Widget">
|
||||
<icon BUILTIN="pencil"/>
|
||||
<node COLOR="#338800" CREATED="1537961550200" ID="ID_226231657" MODIFIED="1537969666482" TEXT="setup für Notebook-Widget">
|
||||
<icon BUILTIN="button_ok"/>
|
||||
<node COLOR="#435e98" CREATED="1537961568746" ID="ID_1553519505" MODIFIED="1537962304729" TEXT="Prototyp für generischen Helper">
|
||||
<arrowlink COLOR="#6ea8be" DESTINATION="ID_591860371" ENDARROW="Default" ENDINCLINATION="1162;51;" ID="Arrow_ID_1534615646" STARTARROW="None" STARTINCLINATION="-185;836;"/>
|
||||
<icon BUILTIN="yes"/>
|
||||
|
|
@ -2786,6 +2786,13 @@
|
|||
</node>
|
||||
<node COLOR="#338800" CREATED="1537836579647" ID="ID_951515368" MODIFIED="1537848122882" TEXT="Pling!">
|
||||
<icon BUILTIN="button_ok"/>
|
||||
<node COLOR="#338800" CREATED="1537972817468" ID="ID_443954725" MODIFIED="1537972829195" TEXT="direkt den UI-Bus ansprechen">
|
||||
<icon BUILTIN="button_ok"/>
|
||||
<node BACKGROUND_COLOR="#fdfdcf" COLOR="#ff0000" CREATED="1537973078631" ID="ID_476903403" MODIFIED="1537973140285" TEXT="*** first tangible action sent via UI-Bus ***">
|
||||
<font NAME="SansSerif" SIZE="28"/>
|
||||
<icon BUILTIN="yes"/>
|
||||
</node>
|
||||
</node>
|
||||
<node BACKGROUND_COLOR="#fdfdcf" COLOR="#ff0000" CREATED="1537848127378" ID="ID_1206004" MODIFIED="1537848141916" TEXT="Argument-Werte abgreifen">
|
||||
<icon BUILTIN="flag-pink"/>
|
||||
</node>
|
||||
|
|
@ -4252,7 +4259,8 @@
|
|||
<node CREATED="1537961860374" ID="ID_933681325" MODIFIED="1537961871080" TEXT="managing container"/>
|
||||
<node CREATED="1537961872836" ID="ID_1674501396" MODIFIED="1537961884942" TEXT="builder lambda"/>
|
||||
</node>
|
||||
<node CREATED="1537961894394" ID="ID_1253130867" MODIFIED="1537961909817" TEXT="Prototyp">
|
||||
<node COLOR="#338800" CREATED="1537961894394" ID="ID_1253130867" MODIFIED="1537969684728" TEXT="Prototyp">
|
||||
<icon BUILTIN="button_ok"/>
|
||||
<node CREATED="1537961917592" ID="ID_591860371" MODIFIED="1537962293792" TEXT="im TestControl">
|
||||
<linktarget COLOR="#6ea8be" DESTINATION="ID_591860371" ENDARROW="Default" ENDINCLINATION="1162;51;" ID="Arrow_ID_1534615646" SOURCE="ID_1553519505" STARTARROW="None" STARTINCLINATION="-185;836;"/>
|
||||
</node>
|
||||
|
|
|
|||
Loading…
Reference in a new issue