41 #ifndef STAGE_CTRL_ACTIONS_H 42 #define STAGE_CTRL_ACTIONS_H 60 using Gtk::ActionGroup;
61 using Gtk::ToggleAction;
68 namespace Stock = Gtk::Stock;
84 , is_updating_action_state(
false)
100 actionGroup = ActionGroup::create();
101 auto menu = [&](
auto id,
auto menuName) {actionGroup->add (Action::create(
id, menuName)); };
102 auto entry = [&](
auto closure,
auto ...args) {actionGroup->add (Action::create(args...), closure);};
105 menu(
"FileMenu", _(
"_File"));
106 entry ([&]() { globalCtx_.director_.
newProject(); } ,
"FileNewProject", Stock::NEW, _(
"_New Project..."));
107 entry ([&]() { globalCtx_.director_.
saveSnapshot(); } ,
"FileSave", Stock::SAVE, _(
"_Save Project"));
108 entry ([&]() { globalCtx_.director_.
forkProject(); } ,
"FileSaveAs", Stock::SAVE_AS, _(
"_Save Project As..."));
109 entry ([&]() { globalCtx_.director_.
openFile(); } ,
"FileOpen", Stock::OPEN, _(
"_Open..."));
110 entry ([&]() { globalCtx_.director_.
render(); } ,
"FileRender", _(
"_Render...")), AccelKey(
"<shift>R");
111 entry ([&]() { globalCtx_.uiManager_.
terminateUI(); } ,
"FileQuit", Stock::QUIT);
114 menu(
"EditMenu", _(
"_Edit"));
115 entry ([&]() { unimplemented (
"Edit/Undo"); } ,
"EditUndo", Stock::UNDO);
116 entry ([&]() { unimplemented (
"Edit/Redo"); } ,
"EditRedo", Stock::REDO);
117 entry ([&]() { unimplemented (
"Edit/Cut"); } ,
"EditCut", Stock::CUT);
118 entry ([&]() { unimplemented (
"Edit/Copy"); } ,
"EditCopy", Stock::COPY);
119 entry ([&]() { unimplemented (
"Edit/Pasta"); } ,
"EditPaste", Stock::PASTE);
120 entry ([&]() { globalCtx_.director_.
editSetup(); } ,
"EditPreferences", Stock::PREFERENCES);
123 menu(
"SequenceMenu", _(
"_Sequence"));
124 entry ([&]() { globalCtx_.director_.
newSequence(); } ,
"SequenceAdd", _(
"_Add..."));
127 menu(
"TrackMenu", _(
"_Track"));
128 entry ([&]() { globalCtx_.director_.
newTrack(); } ,
"TrackAdd", _(
"_Add..."));
131 menu(
"HelpMenu", _(
"_Help"));
136 menu(
"WindowMenu", _(
"_Window"));
137 entry ([&]() { globalCtx_.windowLoc_.newWindow(); } ,
"WindowNewWindow", StockID(
"new_window"));
138 entry ([&]() { globalCtx_.windowLoc_.
closeWindow();} ,
"WindowCloseWindow", _(
"Close Window"));
139 actionGroup->add(Action::create(
"WindowShowPanel", _(
"_Show Panel")));
142 menu(
"ViewMenu", _(
"_View"));
143 assetsPanelAction = ToggleAction::create(
"ViewAssets", StockID(
"panel_assets"));
144 assetsPanelAction->signal_toggled().connect ( [&]() { onMenu_view_assets(); });
145 actionGroup->add(assetsPanelAction);
147 infoboxPanelAction = ToggleAction::create(
"ViewInfoBox", StockID(
"panel_infobox"));
148 infoboxPanelAction->signal_toggled().connect ( [&]() { onMenu_view_infobox(); });
149 actionGroup->add(infoboxPanelAction);
151 timelinePanelAction = ToggleAction::create(
"ViewTimeline", StockID(
"panel_timeline"));
152 timelinePanelAction->signal_toggled().connect( [&]() { onMenu_view_timeline(); });
153 actionGroup->add(timelinePanelAction);
155 viewerPanelAction = ToggleAction::create(
"ViewViewer", StockID(
"panel_viewer"));
156 viewerPanelAction->signal_toggled().connect( [&]() { onMenu_view_viewer(); });
157 actionGroup->add(viewerPanelAction);
159 uiManager.insert_action_group(actionGroup);
164 string ui_info = R
"***( 166 <menubar name='MenuBar'> 167 <menu action='FileMenu'> 168 <menuitem action='FileNewProject'/> 169 <menuitem action='FileSave'/> 170 <menuitem action='FileSaveAs'/> 171 <menuitem action='FileOpen'/> 173 <menuitem action='FileRender'/> 175 <menuitem action='FileQuit'/> 177 <menu action='EditMenu'> 178 <menuitem action='EditUndo'/> 179 <menuitem action='EditRedo'/> 181 <menuitem action='EditCut'/> 182 <menuitem action='EditCopy'/> 183 <menuitem action='EditPaste'/> 185 <menuitem action='EditPreferences'/> 187 <menu action='ViewMenu'> 188 <menuitem action='ViewAssets'/> 189 <menuitem action='ViewInfoBox'/> 190 <menuitem action='ViewTimeline'/> 191 <menuitem action='ViewViewer'/> 193 <menu action='SequenceMenu'> 194 <menuitem action='SequenceAdd'/> 196 <menu action='TrackMenu'> 197 <menuitem action='TrackAdd'/> 199 <menu action='WindowMenu'> 200 <menuitem action='WindowNewWindow'/> 201 <menuitem action='WindowCloseWindow'/> 202 <menu action='WindowShowPanel'/> 204 <menu action='HelpMenu'> 205 <menuitem action='HelpAbout'/> 206 <menuitem action='HelpTest'/> 209 <toolbar name='ToolBar'> 210 <toolitem action='FileNewProject'/> 211 <toolitem action='FileOpen'/> 212 <toolitem action='FileSave'/> 214 <toolitem action='EditUndo'/> 215 <toolitem action='EditRedo'/> 217 <toolitem action='EditCut'/> 218 <toolitem action='EditCopy'/> 219 <toolitem action='EditPaste'/> 225 uiManager.add_ui_from_string (ui_info);
227 catch(Glib::Error& ex)
229 ERROR (
stage,
"Building menus failed: %s", ex.what().data());
285 Glib::RefPtr<Gtk::ActionGroup> actionGroup = ActionGroup::create();
286 for (uint i = 0; i < count; i++)
289 cuString panelName = ustring::compose(
"Panel%1", i);
290 actionGroup->add(Action::create(panelName, StockID(stock_id)),
298 uiManager.insert_action_group (actionGroup);
300 for (uint i = 0; i < count; i++)
302 cuString
name = ustring::compose(
"Panel%1", i);
303 uiManager.add_ui (uiManager.new_merge_id(),
304 "/MenuBar/WindowMenu/WindowShowPanel",
321 unimplemented (
"view assets");
325 onMenu_view_infobox()
331 unimplemented (
"view infobox");
335 onMenu_view_timeline()
340 unimplemented (
"view timeline");
349 unimplemented (
"view viewer");
355 unimplemented (
const char* todo)
357 WARN (
stage,
"%s is not yet implemented. So sorry.", todo);
364 Glib::RefPtr<Gtk::ActionGroup> actionGroup;
366 Glib::RefPtr<Gtk::ToggleAction> assetsPanelAction;
367 Glib::RefPtr<Gtk::ToggleAction> infoboxPanelAction;
368 Glib::RefPtr<Gtk::ToggleAction> timelinePanelAction;
369 Glib::RefPtr<Gtk::ToggleAction> viewerPanelAction;
373 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.