UI-top-level: define the menu bindings by lambda
...allows us to get rid of a lot of sigc boilerplate syntax. The downside is that the resulting functors are not sigc::trackable. This seems adequate here, since the whole top-level UI backbone is maintained by GtkLumiera, and thus ensured to exist as long as the main GTK event loop is running. WARNING: beware of creating "wild" background thrads in the UI, without proper scheduling of any communication via the event loop!
This commit is contained in:
parent
0f2fa24a01
commit
02ba010d2c
2 changed files with 45 additions and 56 deletions
|
|
@ -93,6 +93,11 @@ namespace workspace {
|
|||
|
||||
/**
|
||||
* Populates the uiManager with the main set of global actions.
|
||||
* @remarks we define the menu bindings with the help of stock language lambdas.
|
||||
* This does not make the resulting functors `sigc::trackable`, yet this
|
||||
* is not necessary either, since Actions, together with all the other
|
||||
* top level UI backbone entities, is created and maintained by GtkLumiera,
|
||||
* and thus ensured to exist as long as the GTK event loop is running.
|
||||
*/
|
||||
void
|
||||
populateMainActions (Gtk::UIManager& uiManager)
|
||||
|
|
@ -102,80 +107,54 @@ namespace workspace {
|
|||
|
||||
// File menu
|
||||
actionGroup->add(Action::create("FileMenu", _("_File")));
|
||||
actionGroup->add(Action::create("FileNewProject", Stock::NEW, _("_New Project...")),
|
||||
mem_fun(*this, &Actions::onMenu_file_new_project));
|
||||
actionGroup->add(Action::create("FileOpenProject", Stock::OPEN, _("_Open Project...")),
|
||||
mem_fun(*this, &Actions::onMenu_file_open_project));
|
||||
actionGroup->add(Action::create("FileSaveProject", Stock::SAVE, _("_Save Project")),
|
||||
mem_fun(*this, &Actions::onMenu_others));
|
||||
actionGroup->add(Action::create("FileSaveProjectAs",Stock::SAVE_AS, _("_Save Project As...")),
|
||||
mem_fun(*this, &Actions::onMenu_others));
|
||||
actionGroup->add(Action::create("FileRender", _("_Render...")),
|
||||
AccelKey("<shift>R"),
|
||||
mem_fun(*this, &Actions::onMenu_file_render));
|
||||
actionGroup->add(Action::create("FileQuit", Stock::QUIT),
|
||||
mem_fun(*this, &Actions::onMenu_file_quit));
|
||||
actionGroup->add(Action::create("FileNewProject", Stock::NEW, _("_New Project...")), [&]() { onMenu_file_new_project(); });
|
||||
actionGroup->add(Action::create("FileOpenProject", Stock::OPEN, _("_Open Project...")), [&]() { onMenu_file_open_project(); });
|
||||
actionGroup->add(Action::create("FileSaveProject", Stock::SAVE, _("_Save Project")), [&]() { onMenu_others(); });
|
||||
actionGroup->add(Action::create("FileSaveProjectAs",Stock::SAVE_AS, _("_Save Project As...")), [&]() { onMenu_others(); });
|
||||
actionGroup->add(Action::create("FileRender", _("_Render...")), AccelKey("<shift>R"), [&]() { onMenu_file_render(); });
|
||||
actionGroup->add(Action::create("FileQuit", Stock::QUIT), [&]() { onMenu_file_quit(); });
|
||||
|
||||
// Edit menu
|
||||
actionGroup->add(Action::create("EditMenu", _("_Edit")));
|
||||
actionGroup->add(Action::create("EditUndo", Stock::UNDO),
|
||||
mem_fun(*this, &Actions::onMenu_others));
|
||||
actionGroup->add(Action::create("EditRedo", Stock::REDO),
|
||||
mem_fun(*this, &Actions::onMenu_others));
|
||||
actionGroup->add(Action::create("EditCut", Stock::CUT),
|
||||
mem_fun(*this, &Actions::onMenu_others));
|
||||
actionGroup->add(Action::create("EditCopy", Stock::COPY),
|
||||
mem_fun(*this, &Actions::onMenu_others));
|
||||
actionGroup->add(Action::create("EditPaste",Stock::PASTE),
|
||||
mem_fun(*this, &Actions::onMenu_others));
|
||||
actionGroup->add(Action::create("EditPreferences", Stock::PREFERENCES),
|
||||
mem_fun(*this, &Actions::onMenu_edit_preferences));
|
||||
actionGroup->add(Action::create("EditUndo", Stock::UNDO), [&]() { onMenu_others(); });
|
||||
actionGroup->add(Action::create("EditRedo", Stock::REDO), [&]() { onMenu_others(); });
|
||||
actionGroup->add(Action::create("EditCut", Stock::CUT), [&]() { onMenu_others(); });
|
||||
actionGroup->add(Action::create("EditCopy", Stock::COPY), [&]() { onMenu_others(); });
|
||||
actionGroup->add(Action::create("EditPaste",Stock::PASTE), [&]() { onMenu_others(); });
|
||||
actionGroup->add(Action::create("EditPreferences", Stock::PREFERENCES), [&]() { onMenu_edit_preferences(); });
|
||||
|
||||
// View Menu
|
||||
actionGroup->add(Action::create("ViewMenu", _("_View")));
|
||||
|
||||
assetsPanelAction = ToggleAction::create("ViewAssets",
|
||||
StockID("panel_assets"));
|
||||
assetsPanelAction->signal_toggled().connect(
|
||||
mem_fun(*this, &Actions::onMenu_view_assets));
|
||||
assetsPanelAction = ToggleAction::create("ViewAssets", StockID("panel_assets"));
|
||||
assetsPanelAction->signal_toggled().connect ( [&]() { onMenu_view_assets(); });
|
||||
actionGroup->add(assetsPanelAction);
|
||||
|
||||
timelinePanelAction = ToggleAction::create("ViewTimeline",
|
||||
StockID("panel_timeline"));
|
||||
timelinePanelAction->signal_toggled().connect(
|
||||
mem_fun(*this, &Actions::onMenu_view_timeline));
|
||||
timelinePanelAction = ToggleAction::create("ViewTimeline", StockID("panel_timeline"));
|
||||
timelinePanelAction->signal_toggled().connect( [&]() { onMenu_view_timeline(); });
|
||||
actionGroup->add(timelinePanelAction);
|
||||
|
||||
viewerPanelAction = ToggleAction::create("ViewViewer",
|
||||
StockID("panel_viewer"));
|
||||
viewerPanelAction->signal_toggled().connect(
|
||||
mem_fun(*this, &Actions::onMenu_view_viewer));
|
||||
viewerPanelAction = ToggleAction::create("ViewViewer", StockID("panel_viewer"));
|
||||
viewerPanelAction->signal_toggled().connect( [&]() { onMenu_view_viewer(); });
|
||||
actionGroup->add(viewerPanelAction);
|
||||
|
||||
// Sequence Menu
|
||||
actionGroup->add(Action::create("SequenceMenu", _("_Sequence")));
|
||||
actionGroup->add(Action::create("SequenceAdd", _("_Add...")),
|
||||
mem_fun(*this, &Actions::onMenu_sequence_add));
|
||||
actionGroup->add(Action::create("SequenceAdd", _("_Add...")), [&]() { onMenu_sequence_add(); });
|
||||
|
||||
// Track Menu
|
||||
actionGroup->add(Action::create("TrackMenu", _("_Track")));
|
||||
actionGroup->add(Action::create("TrackAdd", _("_Add...")),
|
||||
mem_fun(*this, &Actions::onMenu_track_add));
|
||||
actionGroup->add(Action::create("TrackAdd", _("_Add...")), [&]() { onMenu_track_add(); });
|
||||
|
||||
// Window Menu
|
||||
actionGroup->add(Action::create("WindowMenu", _("_Window")));
|
||||
actionGroup->add(Action::create("WindowNewWindow",
|
||||
StockID("new_window")),
|
||||
mem_fun(*this, &Actions::onMenu_window_new_window));
|
||||
actionGroup->add(Action::create("WindowCloseWindow",
|
||||
_("Close Window")),
|
||||
mem_fun(*this, &Actions::onMenu_window_close_window));
|
||||
actionGroup->add(Action::create("WindowNewWindow", StockID("new_window")), [&]() { onMenu_window_new_window(); });
|
||||
actionGroup->add(Action::create("WindowCloseWindow", _("Close Window")), [&]() { onMenu_window_close_window(); });
|
||||
actionGroup->add(Action::create("WindowShowPanel", _("_Show Panel")));
|
||||
|
||||
// Help Menu
|
||||
actionGroup->add(Action::create("HelpMenu", _("_Help")) );
|
||||
actionGroup->add(Action::create("HelpAbout", Stock::ABOUT),
|
||||
mem_fun(*this, &Actions::onMenu_help_about) );
|
||||
actionGroup->add(Action::create("HelpAbout", Stock::ABOUT), [&]() { onMenu_help_about(); });
|
||||
|
||||
uiManager.insert_action_group(actionGroup);
|
||||
|
||||
|
|
|
|||
|
|
@ -1864,13 +1864,14 @@
|
|||
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1485917597429" ID="ID_713875638" MODIFIED="1485917626785" TEXT="auf welche Sub-Komponenten wird referenziert">
|
||||
<icon BUILTIN="help"/>
|
||||
</node>
|
||||
<node CREATED="1486063810921" ID="ID_719539281" MODIFIED="1486063815428" TEXT="Zweck">
|
||||
<node CREATED="1486063810921" ID="ID_719539281" MODIFIED="1486067393086" TEXT="Zweck">
|
||||
<icon BUILTIN="info"/>
|
||||
<node CREATED="1486063816320" ID="ID_151179000" MODIFIED="1486063819332" TEXT="ist ein Builder"/>
|
||||
<node CREATED="1486063819992" ID="ID_445639565" MODIFIED="1486063826794" TEXT="ist eine Closure"/>
|
||||
<node CREATED="1486063831790" ID="ID_328966967" MODIFIED="1486063840849" TEXT="muß bloß am Leben bleiben"/>
|
||||
<node CREATED="1486063841293" ID="ID_1675242982" MODIFIED="1486063848831" TEXT="hat nach Init nichts mehr zu tun"/>
|
||||
</node>
|
||||
<node CREATED="1486063858283" ID="ID_130675776" MODIFIED="1486063883707" TEXT="ist Impl-Detail">
|
||||
<node CREATED="1486063858283" HGAP="42" ID="ID_130675776" MODIFIED="1486067387891" TEXT="ist Impl-Detail" VSHIFT="5">
|
||||
<node CREATED="1486063886407" ID="ID_1294385692" MODIFIED="1486063896241" TEXT="sollte aus den weitverbreiteten Header-Includes raus"/>
|
||||
<node CREATED="1486063911188" ID="ID_1391435276" MODIFIED="1486063939019" TEXT="gegenwärtig Member im UiManager">
|
||||
<richcontent TYPE="NOTE"><html>
|
||||
|
|
@ -1932,12 +1933,21 @@
|
|||
</node>
|
||||
</node>
|
||||
</node>
|
||||
<node CREATED="1486064478968" ID="ID_1610028838" MODIFIED="1486064483792" TEXT="Umbau">
|
||||
<icon BUILTIN="pencil"/>
|
||||
<node CREATED="1486064487215" ID="ID_195778340" MODIFIED="1486064493007" TEXT="Actions wird PImpl"/>
|
||||
<node CREATED="1486064493614" ID="ID_566562539" MODIFIED="1486064499969" TEXT="Actions wird Header-only"/>
|
||||
<node CREATED="1486064503229" ID="ID_1200627448" MODIFIED="1486064513472" TEXT="alle wildcard-Includes weg"/>
|
||||
<node COLOR="#338800" CREATED="1486064478968" ID="ID_1610028838" MODIFIED="1486067358363" TEXT="Umbau">
|
||||
<icon BUILTIN="button_ok"/>
|
||||
<node CREATED="1486064487215" ID="ID_195778340" MODIFIED="1486067334136" TEXT="Actions wird PImpl">
|
||||
<icon BUILTIN="button_ok"/>
|
||||
</node>
|
||||
<node CREATED="1486064493614" ID="ID_566562539" MODIFIED="1486067337261" TEXT="Actions wird Header-only">
|
||||
<icon BUILTIN="button_ok"/>
|
||||
</node>
|
||||
<node CREATED="1486064503229" ID="ID_1200627448" MODIFIED="1486067340766" TEXT="alle wildcard-Includes weg">
|
||||
<icon BUILTIN="button_ok"/>
|
||||
</node>
|
||||
</node>
|
||||
</node>
|
||||
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1486067362505" HGAP="26" ID="ID_264522454" MODIFIED="1486067383244" TEXT="globaler Ui-Kontext (Verdrahtung)" VSHIFT="24">
|
||||
<icon BUILTIN="flag-yellow"/>
|
||||
</node>
|
||||
</node>
|
||||
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1485898796393" ID="ID_1217726538" MODIFIED="1485898814419" TEXT="#1069 how to refer to the current window">
|
||||
|
|
|
|||
Loading…
Reference in a new issue