32 #ifndef STAGE_CTRL_ACTIONS_H 33 #define STAGE_CTRL_ACTIONS_H 51 using Gtk::ActionGroup;
52 using Gtk::ToggleAction;
59 namespace Stock = Gtk::Stock;
75 , is_updating_action_state(
false)
91 actionGroup = ActionGroup::create();
92 auto menu = [&](
auto id,
auto menuName) {actionGroup->add (Action::create(
id, menuName)); };
93 auto entry = [&](
auto closure,
auto ...args) {actionGroup->add (Action::create(args...), closure);};
96 menu(
"FileMenu", _(
"_File"));
97 entry ([&]() { globalCtx_.director_.
newProject(); } ,
"FileNewProject", Stock::NEW, _(
"_New Project..."));
98 entry ([&]() { globalCtx_.director_.
saveSnapshot(); } ,
"FileSave", Stock::SAVE, _(
"_Save Project"));
99 entry ([&]() { globalCtx_.director_.
forkProject(); } ,
"FileSaveAs", Stock::SAVE_AS, _(
"_Save Project As..."));
100 entry ([&]() { globalCtx_.director_.
openFile(); } ,
"FileOpen", Stock::OPEN, _(
"_Open..."));
101 entry ([&]() { globalCtx_.director_.
render(); } ,
"FileRender", _(
"_Render...")), AccelKey(
"<shift>R");
102 entry ([&]() { globalCtx_.uiManager_.
terminateUI(); } ,
"FileQuit", Stock::QUIT);
105 menu(
"EditMenu", _(
"_Edit"));
106 entry ([&]() { unimplemented (
"Edit/Undo"); } ,
"EditUndo", Stock::UNDO);
107 entry ([&]() { unimplemented (
"Edit/Redo"); } ,
"EditRedo", Stock::REDO);
108 entry ([&]() { unimplemented (
"Edit/Cut"); } ,
"EditCut", Stock::CUT);
109 entry ([&]() { unimplemented (
"Edit/Copy"); } ,
"EditCopy", Stock::COPY);
110 entry ([&]() { unimplemented (
"Edit/Pasta"); } ,
"EditPaste", Stock::PASTE);
111 entry ([&]() { globalCtx_.director_.
editSetup(); } ,
"EditPreferences", Stock::PREFERENCES);
114 menu(
"SequenceMenu", _(
"_Sequence"));
115 entry ([&]() { globalCtx_.director_.
newSequence(); } ,
"SequenceAdd", _(
"_Add..."));
118 menu(
"TrackMenu", _(
"_Track"));
119 entry ([&]() { globalCtx_.director_.
newTrack(); } ,
"TrackAdd", _(
"_Add..."));
122 menu(
"HelpMenu", _(
"_Help"));
127 menu(
"WindowMenu", _(
"_Window"));
128 entry ([&]() { globalCtx_.windowLoc_.newWindow(); } ,
"WindowNewWindow", StockID(
"new_window"));
129 entry ([&]() { globalCtx_.windowLoc_.
closeWindow();} ,
"WindowCloseWindow", _(
"Close Window"));
130 actionGroup->add(Action::create(
"WindowShowPanel", _(
"_Show Panel")));
133 menu(
"ViewMenu", _(
"_View"));
134 assetsPanelAction = ToggleAction::create(
"ViewAssets", StockID(
"panel_assets"));
135 assetsPanelAction->signal_toggled().connect ( [&]() { onMenu_view_assets(); });
136 actionGroup->add(assetsPanelAction);
138 infoboxPanelAction = ToggleAction::create(
"ViewInfoBox", StockID(
"panel_infobox"));
139 infoboxPanelAction->signal_toggled().connect ( [&]() { onMenu_view_infobox(); });
140 actionGroup->add(infoboxPanelAction);
142 timelinePanelAction = ToggleAction::create(
"ViewTimeline", StockID(
"panel_timeline"));
143 timelinePanelAction->signal_toggled().connect( [&]() { onMenu_view_timeline(); });
144 actionGroup->add(timelinePanelAction);
146 viewerPanelAction = ToggleAction::create(
"ViewViewer", StockID(
"panel_viewer"));
147 viewerPanelAction->signal_toggled().connect( [&]() { onMenu_view_viewer(); });
148 actionGroup->add(viewerPanelAction);
150 uiManager.insert_action_group(actionGroup);
155 string ui_info = R
"***( 157 <menubar name='MenuBar'> 158 <menu action='FileMenu'> 159 <menuitem action='FileNewProject'/> 160 <menuitem action='FileSave'/> 161 <menuitem action='FileSaveAs'/> 162 <menuitem action='FileOpen'/> 164 <menuitem action='FileRender'/> 166 <menuitem action='FileQuit'/> 168 <menu action='EditMenu'> 169 <menuitem action='EditUndo'/> 170 <menuitem action='EditRedo'/> 172 <menuitem action='EditCut'/> 173 <menuitem action='EditCopy'/> 174 <menuitem action='EditPaste'/> 176 <menuitem action='EditPreferences'/> 178 <menu action='ViewMenu'> 179 <menuitem action='ViewAssets'/> 180 <menuitem action='ViewInfoBox'/> 181 <menuitem action='ViewTimeline'/> 182 <menuitem action='ViewViewer'/> 184 <menu action='SequenceMenu'> 185 <menuitem action='SequenceAdd'/> 187 <menu action='TrackMenu'> 188 <menuitem action='TrackAdd'/> 190 <menu action='WindowMenu'> 191 <menuitem action='WindowNewWindow'/> 192 <menuitem action='WindowCloseWindow'/> 193 <menu action='WindowShowPanel'/> 195 <menu action='HelpMenu'> 196 <menuitem action='HelpAbout'/> 197 <menuitem action='HelpTest'/> 200 <toolbar name='ToolBar'> 201 <toolitem action='FileNewProject'/> 202 <toolitem action='FileOpen'/> 203 <toolitem action='FileSave'/> 205 <toolitem action='EditUndo'/> 206 <toolitem action='EditRedo'/> 208 <toolitem action='EditCut'/> 209 <toolitem action='EditCopy'/> 210 <toolitem action='EditPaste'/> 216 uiManager.add_ui_from_string (ui_info);
218 catch(Glib::Error& ex)
220 ERROR (
stage,
"Building menus failed: %s", ex.what().data());
276 Glib::RefPtr<Gtk::ActionGroup> actionGroup = ActionGroup::create();
277 for (uint i = 0; i < count; i++)
280 cuString panelName = ustring::compose(
"Panel%1", i);
281 actionGroup->add(Action::create(panelName, StockID(stock_id)),
289 uiManager.insert_action_group (actionGroup);
291 for (uint i = 0; i < count; i++)
293 cuString
name = ustring::compose(
"Panel%1", i);
294 uiManager.add_ui (uiManager.new_merge_id(),
295 "/MenuBar/WindowMenu/WindowShowPanel",
312 unimplemented (
"view assets");
316 onMenu_view_infobox()
322 unimplemented (
"view infobox");
326 onMenu_view_timeline()
331 unimplemented (
"view timeline");
340 unimplemented (
"view viewer");
346 unimplemented (
const char* todo)
348 WARN (
stage,
"%s is not yet implemented. So sorry.", todo);
355 Glib::RefPtr<Gtk::ActionGroup> actionGroup;
357 Glib::RefPtr<Gtk::ToggleAction> assetsPanelAction;
358 Glib::RefPtr<Gtk::ToggleAction> infoboxPanelAction;
359 Glib::RefPtr<Gtk::ToggleAction> timelinePanelAction;
360 Glib::RefPtr<Gtk::ToggleAction> viewerPanelAction;
364 bool is_updating_action_state;
void saveSnapshot()
Save a snapshot of the current project's contents and the UI state.
void show_HelpAbout()
show the notorious "about Lumiera" dialog.
void newSequence()
Establish a pristine new sequence within the session.
Dependency context to hold all the global UI top-level entities.
AnyPair entry(Query< TY > const &query, typename WrapReturn< TY >::Wrapper &obj)
helper to simplify creating mock table entries, wrapped correctly
void terminateUI()
Cause the main event loop to terminate, so the application as a whole unwinds.
Any copy and copy construction prohibited.
Management of dockable panels.
void newTrack()
Establish a empty new track close to the current scope.
void newProject()
setup a new editing project, possibly close the current one.
void populateShowPanelActions(Gtk::UIManager &uiManager)
Populates the menu entries to show specific panels within the current window.
A front-end for using printf-style formatting.
void forkProject()
Continue evolution of the currently active project under a new identity.
Derived specific exceptions within Lumiera's exception hierarchy.
Mix-Ins to allow or prohibit various degrees of copying and cloning.
void editSetup()
Edit global configuration and setup.
static int getPanelDescriptionCount()
Gets the number of panel descriptions.
Lumiera GTK UI implementation root.
static const gchar * getPanelStockID(const int index)
Gets a panel description's stock id.
A helper class which registers global user actions and populates the main menu and toolbar...
workspace::WorkspaceWindow & findActiveWindow()
find and retrieve a WorkspaceWindow (top-level window) marked as 'active' by GTK. ...
panel::Panel & showPanel(const int description_index)
Shows a panel given a description index.
Manager for all top level application windows.
void render()
Start a render process.
void closeWindow()
close (and thus destroy) the current active window.
The main Lumiera workspace window.
A global circle of top-level UI management facilities.
This file contains the definition of the main workspace window parent, which is the toplevel parent o...
void updateActionState(workspace::WorkspaceWindow ¤tWindow)
Updates the state of the menu/toolbar actions to reflect the current state of the workspace...
void populateMainActions(Gtk::UIManager &uiManager)
Populates the uiManager with the main set of global actions.
void launchTestCtrl()
Launch a non modal child window to trigger self-test actions.
A set of basic GTK includes for the UI.
void openFile()
Select and open a file to perform a suitable operation.