Main Menu: some re-organization of session- and global-centric windows.
[ardour.git] / gtk2_ardour / ardour_ui_ed.cc
index 1b14cba012e0dc66d1a2e28e38eb216f37d94a72..bc40973f2f38f2f4886b10a54a9c0b0f88541dfe 100644 (file)
 #include <gtkmm/accelmap.h>
 #include <gtk/gtk.h>
 
+#include "pbd/file_utils.h"
+#include "pbd/fpu.h"
+#include "pbd/convert.h"
+
 #include "gtkmm2ext/cairo_packer.h"
-#include "gtkmm2ext/tearoff.h"
 #include "gtkmm2ext/utils.h"
 #include "gtkmm2ext/window_title.h"
 
-#include "pbd/file_utils.h"
-#include "pbd/fpu.h"
-#include "pbd/convert.h"
+#include "widgets/tearoff.h"
 
 #include "ardour_ui.h"
 #include "public_editor.h"
@@ -161,7 +162,7 @@ ARDOUR_UI::install_actions ()
 
        /* the real actions */
 
-       act = global_actions.register_action (main_actions, X_("New"), _("New..."),  hide_return (sigc::bind (sigc::mem_fun(*this, &ARDOUR_UI::get_session_parameters), false, true, "")));
+       act = global_actions.register_action (main_actions, X_("New"), _("New..."),  hide_return (sigc::bind (sigc::mem_fun(*this, &ARDOUR_UI::get_session_parameters), true, true, "")));
 
        global_actions.register_action (main_actions, X_("Open"), _("Open..."),  sigc::mem_fun(*this, &ARDOUR_UI::open_session));
        global_actions.register_action (main_actions, X_("Recent"), _("Recent..."),  sigc::mem_fun(*this, &ARDOUR_UI::open_recent_session));
@@ -186,19 +187,11 @@ ARDOUR_UI::install_actions ()
        act = global_actions.register_action (main_actions, X_("Scripting"), S_("Session|Scripting"));
        ActionManager::session_sensitive_actions.push_back (act);
 
-       act = global_actions.register_action (main_actions, X_("AddLuaScript"), _("Add Lua Script..."),
-                     sigc::mem_fun (*this, &ARDOUR_UI::add_lua_script));
-       ActionManager::session_sensitive_actions.push_back (act);
-
-       act = global_actions.register_action (main_actions, X_("RemoveLuaScript"), _("Remove Lua Script"),
-                     sigc::mem_fun (*this, &ARDOUR_UI::remove_lua_script));
-       ActionManager::session_sensitive_actions.push_back (act);
-
        act = global_actions.register_action (main_actions, X_("OpenVideo"), _("Open Video..."),
-                                             sigc::bind (sigc::mem_fun(*this, &ARDOUR_UI::add_video), (Gtk::Window*) 0));
+                                             sigc::bind (sigc::mem_fun(*this, &ARDOUR_UI::add_video), (Gtk::Window*) 0));
        ActionManager::session_sensitive_actions.push_back (act);
        act = global_actions.register_action (main_actions, X_("CloseVideo"), _("Remove Video"),
-                                             sigc::mem_fun (*this, &ARDOUR_UI::remove_video));
+                                             sigc::mem_fun (*this, &ARDOUR_UI::remove_video));
        act->set_sensitive (false);
        act = global_actions.register_action (main_actions, X_("ExportVideo"), _("Export to Video File..."),
                                              hide_return (sigc::bind (sigc::mem_fun(*this, &ARDOUR_UI::export_video), false)));
@@ -230,6 +223,9 @@ ARDOUR_UI::install_actions ()
        act = global_actions.register_action (main_actions, X_("SaveTemplate"), _("Save Template..."),  sigc::mem_fun(*this, &ARDOUR_UI::save_template));
        ActionManager::session_sensitive_actions.push_back (act);
 
+       act = global_actions.register_action (main_actions, X_("ManageTemplates"), _("Templates"), sigc::mem_fun(*this, &ARDOUR_UI::manage_templates));
+       ActionManager::session_sensitive_actions.push_back (act);
+
        act = global_actions.register_action (main_actions, X_("Metadata"), _("Metadata"));
        ActionManager::session_sensitive_actions.push_back (act);
 
@@ -267,8 +263,6 @@ ARDOUR_UI::install_actions ()
        global_actions.register_action (common_actions, X_("Quit"), _("Quit"), (hide_return (sigc::mem_fun(*this, &ARDOUR_UI::finish))));
        global_actions.register_action (common_actions, X_("Hide"), _("Hide"), sigc::mem_fun (*this, &ARDOUR_UI::hide_application));
 
-       global_actions.register_action (common_actions, X_("show-editor"), _("Show"), sigc::bind (sigc::mem_fun (*this, &ARDOUR_UI::show_tabbable), editor));
-       global_actions.register_action (common_actions, X_("show-mixer"), _("Show"), sigc::bind (sigc::mem_fun (*this, &ARDOUR_UI::show_tabbable), mixer));
        global_actions.register_action (common_actions, X_("show-preferences"), _("Show"), sigc::bind (sigc::mem_fun (*this, &ARDOUR_UI::show_tabbable), rc_option_editor));
        global_actions.register_action (common_actions, X_("menu-show-preferences"), _("Preferences"), sigc::bind (sigc::mem_fun (*this, &ARDOUR_UI::show_tabbable), rc_option_editor));
 
@@ -284,6 +278,9 @@ ARDOUR_UI::install_actions ()
        global_actions.register_action (common_actions, X_("detach-mixer"), _("Detach"), sigc::bind (sigc::mem_fun (*this, &ARDOUR_UI::detach_tabbable), mixer));
        global_actions.register_action (common_actions, X_("detach-preferences"), _("Detach"), sigc::bind (sigc::mem_fun (*this, &ARDOUR_UI::detach_tabbable), rc_option_editor));
 
+       Glib::RefPtr<Gtk::ActionGroup> window_actions = ARDOUR_UI::instance()->global_actions.create_action_group (X_("Window"));
+       global_actions.register_action (window_actions, X_("show-mixer"), _("Show Mixer"), sigc::bind (sigc::mem_fun (*this, &ARDOUR_UI::show_tabbable), mixer));
+
        /* these actions are all currently implemented by the Editor, but need
         * to be accessible from anywhere as actions.
         */
@@ -474,6 +471,10 @@ ARDOUR_UI::install_actions ()
        ActionManager::session_sensitive_actions.push_back (act);
        ActionManager::write_sensitive_actions.push_back (act);
 
+       act = global_actions.register_action (transport_actions, X_("RecordCountIn"), _("Record w/Count-In"), sigc::mem_fun(*this, &ARDOUR_UI::transport_rec_count_in));
+       ActionManager::session_sensitive_actions.push_back (act);
+       ActionManager::write_sensitive_actions.push_back (act);
+
        act = global_actions.register_action (transport_actions, X_("Record"), _("Enable Record"), sigc::bind (sigc::mem_fun(*this, &ARDOUR_UI::transport_record), false));
        ActionManager::session_sensitive_actions.push_back (act);
        ActionManager::write_sensitive_actions.push_back (act);
@@ -735,8 +736,8 @@ ARDOUR_UI::use_menubar_as_top_menubar ()
        Gtk::Widget* widget;
        Application* app = Application::instance ();
 
-        /* the addresses ("/ui/Main...") used below are based on the menu definitions in the menus file
-         */
+       /* the addresses ("/ui/Main...") used below are based on the menu definitions in the menus file
+       */
 
        /* Quit will be taken care of separately */
 
@@ -752,11 +753,11 @@ ARDOUR_UI::use_menubar_as_top_menubar ()
 
        if ((widget = ActionManager::get_widget ("/ui/Main/Session/toggle-about"))) {
                app->add_app_menu_item (group, dynamic_cast<MenuItem*>(widget));
-        }
+       }
 
        if ((widget = ActionManager::get_widget ("/ui/Main/Edit/menu-show-preferences"))) {
                app->add_app_menu_item (group, dynamic_cast<MenuItem*>(widget));
-        }
+       }
 
        app->set_menu_bar (*menu_bar);
 }
@@ -772,12 +773,11 @@ ARDOUR_UI::save_ardour_state ()
           a different lifetime model from add_instant_xml().
        */
 
-       LocaleGuard lg; // one guard to rule them all
        XMLNode* node = new XMLNode (keyboard->get_state());
        Config->add_extra_xml (*node);
 
        XMLNode* window_node = new XMLNode (X_("UI"));
-       window_node->add_property (_status_bar_visibility.get_state_name().c_str(), _status_bar_visibility.get_state_value ());
+       window_node->set_property (_status_bar_visibility.get_state_name().c_str(), _status_bar_visibility.get_state_value ());
 
        /* main window */
 
@@ -786,10 +786,10 @@ ARDOUR_UI::save_ardour_state ()
        _main_window.get_size (mw, mh);
 
        XMLNode main_window_node (X_("Main"));
-       main_window_node.add_property (X_("x"), PBD::to_string (mx, std::dec));
-       main_window_node.add_property (X_("y"), PBD::to_string (my, std::dec));
-       main_window_node.add_property (X_("w"), PBD::to_string (mw, std::dec));
-       main_window_node.add_property (X_("h"), PBD::to_string (mh, std::dec));
+       main_window_node.set_property (X_("x"), mx);
+       main_window_node.set_property (X_("y"), my);
+       main_window_node.set_property (X_("w"), mw);
+       main_window_node.set_property (X_("h"), mh);
 
        string current_tab;
        int current_page_number = _tabs.get_current_page ();
@@ -801,7 +801,7 @@ ARDOUR_UI::save_ardour_state ()
                current_tab = "preferences";
        }
 
-       main_window_node.add_property (X_("current-tab"), current_tab);
+       main_window_node.set_property (X_("current-tab"), current_tab);
 
        /* Windows */