diff --git a/src/gui/ctrl/actions.hpp b/src/gui/ctrl/actions.hpp index 06196b111..a2f3fd01d 100644 --- a/src/gui/ctrl/actions.hpp +++ b/src/gui/ctrl/actions.hpp @@ -35,21 +35,14 @@ #ifndef GUI_CTRL_ACTIONS_H #define GUI_CTRL_ACTIONS_H -#include "gui/gtk-lumiera.hpp" -#include "gui/config-keys.hpp" +#include "gui/gtk-base.hpp" #include "gui/ctrl/global-ctx.hpp" +#include "gui/ctrl/window-list.hpp" #include "gui/workspace/workspace-window.hpp" -#include "gui/dialog/render.hpp" -#include "gui/dialog/preferences-dialog.hpp" -#include "gui/dialog/name-chooser.hpp" +#include "gui/workspace/panel-manager.hpp" #include "lib/format-string.hpp" -#include "include/logging.h" -#include -#include #include -#include -#include #include @@ -57,20 +50,14 @@ namespace gui { namespace ctrl { namespace error = lumiera::error; - using std::function; - using boost::algorithm::is_any_of; - using boost::algorithm::split; using Gtk::Action; using Gtk::ActionGroup; using Gtk::ToggleAction; - using Gtk::AboutDialog; using Gtk::AccelKey; using Gtk::StockID; using Gtk::Main; /////////////////////////////////////////////////////////////////////////////////////TICKET #1032 replace Main -> Application - using sigc::mem_fun; using Glib::ustring; using ::util::_Fmt; - using std::vector; using std::string; namespace Stock = Gtk::Stock; @@ -115,7 +102,7 @@ namespace ctrl { entry ([&]() { globalCtx_.director_.saveSnapshot(); } , "FileSave", Stock::SAVE, _("_Save Project")); entry ([&]() { globalCtx_.director_.forkProject(); } , "FileSaveAs", Stock::SAVE_AS, _("_Save Project As...")); entry ([&]() { globalCtx_.director_.openFile(); } , "FileOpen", Stock::OPEN, _("_Open...")); - entry ([&]() { onMenu_file_render(); } , "FileRender", _("_Render...")), AccelKey("R"); + entry ([&]() { globalCtx_.director_.render(); } , "FileRender", _("_Render...")), AccelKey("R"); entry ([&]() { globalCtx_.uiManager_.terminateUI(); } , "FileQuit", Stock::QUIT); @@ -125,7 +112,7 @@ namespace ctrl { entry ([&]() { onMenu_others(); } , "EditCut", Stock::CUT); entry ([&]() { onMenu_others(); } , "EditCopy", Stock::COPY); entry ([&]() { onMenu_others(); } , "EditPaste", Stock::PASTE); - entry ([&]() { onMenu_edit_preferences(); } , "EditPreferences", Stock::PREFERENCES); + entry ([&]() { globalCtx_.director_.editSetup(); } , "EditPreferences", Stock::PREFERENCES); menu("SequenceMenu", _("_Sequence")); @@ -137,7 +124,7 @@ namespace ctrl { menu("HelpMenu", _("_Help")); - entry ([&]() { onMenu_help_about(); } , "HelpAbout", Stock::ABOUT); + entry ([&]() { globalCtx_.wizard_.show_HelpAbout(); } , "HelpAbout", Stock::ABOUT); menu("WindowMenu", _("_Window")); @@ -238,15 +225,16 @@ namespace ctrl { private: /* ===== Internals ===== */ - workspace::WorkspaceWindow& - getWorkspaceWindow() - { - return globalCtx_.windowList_.findActiveWindow(); - } /** - * Populates a uiManager with actions for the Show Panel menu. + * Populates the menu entries to show specific panels + * within the current window. + * @todo 4/2017 this can only be a preliminary solution. + * What we actually want is perspectives, and we want + * a specific UI to be anchored somewhere in UI space, + * so we'll be rather be navigating _towards it_, instead + * of "showing it here". */ void populateShowPanelActions (Gtk::UIManager& uiManager) @@ -257,9 +245,13 @@ namespace ctrl { for (uint i = 0; i < count; i++) { const gchar *stock_id = workspace::PanelManager::getPanelStockID(i); - cuString name = ustring::compose("Panel%1", i); - actionGroup->add(Action::create(name, StockID(stock_id)), - bind(mem_fun(*this, &Actions::onMenu_show_panel), i)); + cuString panelName = ustring::compose("Panel%1", i); + actionGroup->add(Action::create(panelName, StockID(stock_id)), + [i,this]() { + globalCtx_.windowList_.findActiveWindow() + .getPanelManager() + .showPanel (i); + }); } uiManager.insert_action_group (actionGroup); @@ -301,31 +293,10 @@ namespace ctrl { - private: /* ====== Actions =========== */ - - /* ============ File Menu ========== */ - - void - onMenu_file_render() - { - dialog::Render dialog(getWorkspaceWindow()); //////global -> InteractionDirector - dialog.run(); - } + private: - - /* ============ Edit Menu ========== */ - - void - onMenu_edit_preferences() - { - dialog::PreferencesDialog dialog(getWorkspaceWindow()); //////global -> InteractionDirector - dialog.run(); - } - - - - /* ============ View Menu ========== */ + /* ============ View Actions ========== */ void onMenu_view_assets() @@ -353,45 +324,6 @@ namespace ctrl { } - - - void - onMenu_show_panel(int panel_index) - { - getWorkspaceWindow().getPanelManager().showPanel (panel_index); - } - - - void - onMenu_help_about() - { - // Configure the about dialog - AboutDialog dialog; - - cuString copyrightNotice {_Fmt(_("© %s the original Authors\n" - "-- Lumiera Team --\n" - "Lumiera is Free Software (GPL)")) - % Config::get (KEY_COPYRIGHT)}; - - string authors = Config::get (KEY_AUTHORS); - vector authorsList; - split (authorsList, authors, is_any_of (",|")); - - - dialog.set_program_name(Config::get (KEY_TITLE)); - dialog.set_version(Config::get (KEY_VERSION)); - dialog.set_copyright(copyrightNotice); - dialog.set_website(Config::get (KEY_WEBSITE)); - dialog.set_authors(authorsList); - - dialog.set_transient_for(getWorkspaceWindow()); - - // Show the about dialog - dialog.run(); - } - - - // Temporary Junk void onMenu_others() /////////////////////////TICKET #1070 need a concept how to bind global actions diff --git a/src/gui/interact/interaction-director.cpp b/src/gui/interact/interaction-director.cpp index 2cedd2e49..9b1382bec 100644 --- a/src/gui/interact/interaction-director.cpp +++ b/src/gui/interact/interaction-director.cpp @@ -34,6 +34,9 @@ #include "gui/interact/spot-locator.hpp" #include "gui/interact/navigator.hpp" #include "gui/interact/focus-tracker.hpp" +#include "gui/dialog/preferences-dialog.hpp" +#include "gui/dialog/render.hpp" +#include "gui/workspace/workspace-window.hpp" #include "gui/ctrl/ui-state.hpp" #include "gui/setting/asset-controller.hpp" #include "gui/timeline/timeline-controller.hpp" @@ -151,6 +154,25 @@ namespace interact { } + /** + * Edit global configuration and setup. + * This action will launch the project setup UI, which allows to adjust configuration + * - for this installation of Lumiera + * - for the current project + * - for this user's session in this project + * @todo 4/2017 not yet implemented, delegate to the AssetControler, which represents + * all global aspects of the application, session and project + */ + void + InteractionDirector::editSetup() + { + dialog::PreferencesDialog dialog(getWorkspaceWindow()); + dialog.run(); + + UNIMPLEMENTED ("edit global configuration"); + } + + /** * Select and open a file to perform a suitable operation. * This action will launch the fileOpen UI. Depending on the selected file's meaning, @@ -165,6 +187,24 @@ namespace interact { } + /** + * Start a render process. This action will launch the render setup UI. + * Depending on the current Spot, a suitable object to render will be preselected, + * typically the current timeline. + * @todo 4/2017 not yet implemented, and it is not clear how to access the functionality. + * Do we send a command? Or do we access the Play-Out subsystem directly, to create + * some kind of dedicated player instance? + */ + void + InteractionDirector::render() + { + dialog::Render dialog(getWorkspaceWindow()); //////global -> InteractionDirector + dialog.run(); + + UNIMPLEMENTED ("start render"); + } + + /** * Establish a pristine new sequence within the session. * The goal is to create a new _playground_ for the user to add content. @@ -208,5 +248,12 @@ namespace interact { } + workspace::WorkspaceWindow& + InteractionDirector::getWorkspaceWindow() + { + return globalCtx_.windowList_.findActiveWindow(); + } + + }}// namespace gui::interact diff --git a/src/gui/interact/interaction-director.hpp b/src/gui/interact/interaction-director.hpp index c1e567c47..b169c7e3a 100644 --- a/src/gui/interact/interaction-director.hpp +++ b/src/gui/interact/interaction-director.hpp @@ -77,6 +77,9 @@ namespace setting { namespace timeline { class TimelineController; } +namespace workspace { + class WorkspaceWindow; +} namespace interact { //using std::string; @@ -126,13 +129,15 @@ namespace interact { void newProject(); void saveSnapshot(); void forkProject(); + void editSetup(); void openFile(); + void render(); void newSequence(); void newTrack(); private: - + workspace::WorkspaceWindow& getWorkspaceWindow(); }; diff --git a/src/gui/interact/wizard.cpp b/src/gui/interact/wizard.cpp index 881b062af..ea5181e3e 100644 --- a/src/gui/interact/wizard.cpp +++ b/src/gui/interact/wizard.cpp @@ -28,20 +28,35 @@ */ -//#include "gui/gtk-lumiera.hpp" +#include "gui/gtk-base.hpp" +#include "gui/config-keys.hpp" #include "gui/interact/wizard.hpp" #include "gui/interact/spot-locator.hpp" +#include "gui/workspace/workspace-window.hpp" #include "gui/ctrl/global-ctx.hpp" +#include "lib/format-string.hpp" //#include "lib/util.hpp" +#include +#include +#include +#include + //using util::cStr; //using util::isnil; +using ::util::_Fmt; +using std::vector; +using std::string; namespace gui { namespace interact { + using boost::algorithm::is_any_of; + using boost::algorithm::split; + using workspace::WorkspaceWindow; using ctrl::GlobalCtx; + using Gtk::AboutDialog; // dtors via smart-ptr invoked from here... (TODO any to come here?) @@ -54,8 +69,39 @@ namespace interact { { } - /** */ + /** + * show the notorious "about Lumiera" dialog. + * Something every application has and no user really cares about. + */ + void + Wizard::show_HelpAbout() + { + // Configure the about dialog + AboutDialog dialog; + + cuString copyrightNotice {_Fmt(_("© %s the original Authors\n" + "-- Lumiera Team --\n" + "Lumiera is Free Software (GPL)")) + % Config::get (KEY_COPYRIGHT)}; + + string authors = Config::get (KEY_AUTHORS); + vector authorsList; + split (authorsList, authors, is_any_of (",|")); + + + dialog.set_program_name(Config::get (KEY_TITLE)); + dialog.set_version(Config::get (KEY_VERSION)); + dialog.set_copyright(copyrightNotice); + dialog.set_website(Config::get (KEY_WEBSITE)); + dialog.set_authors(authorsList); + + WorkspaceWindow& currentWindow = globalCtx_.windowList_.findActiveWindow(); + dialog.set_transient_for (currentWindow); + + // Show the about dialog + dialog.run(); + } }}// namespace gui::interact diff --git a/src/gui/interact/wizard.hpp b/src/gui/interact/wizard.hpp index 774265775..8d7fed8c8 100644 --- a/src/gui/interact/wizard.hpp +++ b/src/gui/interact/wizard.hpp @@ -77,6 +77,7 @@ namespace interact { Wizard (ctrl::GlobalCtx&); ~Wizard (); + void show_HelpAbout(); private: };