Main Menu: some re-organization of session- and global-centric windows.
[ardour.git] / gtk2_ardour / ardour_ui_ed.cc
index 905e2c5d07152f96033f17d460a197258dbf626d..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));
@@ -187,10 +188,10 @@ ARDOUR_UI::install_actions ()
        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)));
@@ -222,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);
 
@@ -275,7 +279,7 @@ ARDOUR_UI::install_actions ()
        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"), sigc::bind (sigc::mem_fun (*this, &ARDOUR_UI::show_tabbable), mixer));
+       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.
@@ -357,6 +361,8 @@ ARDOUR_UI::install_actions ()
        global_actions.register_action (common_actions, X_("previous-tab"), _("Previous Tab"), sigc::mem_fun (*this, &ARDOUR_UI::step_up_through_tabs));
        global_actions.register_action (common_actions, X_("next-tab"), _("Next Tab"), sigc::mem_fun (*this, &ARDOUR_UI::step_down_through_tabs));
 
+       global_actions.register_action (common_actions, X_("toggle-editor-and-mixer"), _("Toggle Editor & Mixer"), sigc::mem_fun (*this, &ARDOUR_UI::toggle_editor_and_mixer));
+
        /* windows visibility actions */
 
        global_actions.register_toggle_action (common_actions, X_("ToggleMaximalEditor"), _("Maximise Editor Space"), sigc::mem_fun (*this, &ARDOUR_UI::toggle_editing_space));
@@ -730,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 */
 
@@ -747,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);
 }
@@ -767,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 */
 
@@ -781,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 ();
@@ -796,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 */
 
@@ -901,7 +906,7 @@ ARDOUR_UI::tabbable_visibility_button_press (GdkEventButton* ev, string const& t
        string menu_name = string ("/ui/") + tabbable_name + X_("TabbableButtonMenu");
        Gtk::Menu* menu = dynamic_cast<Gtk::Menu*> (ActionManager::get_widget (menu_name.c_str()));
        if (menu) {
-               menu->popup (ev->button, ev->time);
+               menu->popup (3, ev->time);
        }
        return true;
 }