show window title in DEBUG::Accelerator debug trace
[ardour.git] / gtk2_ardour / ardour_ui_ed.cc
index f091d070ca56dcbc4eca2eaf72a7b03a5d055370..9accf7895324690c4fdb9de9216631c0660f0087 100644 (file)
@@ -51,6 +51,7 @@
 #include "editor.h"
 #include "actions.h"
 #include "meterbridge.h"
+#include "luawindow.h"
 #include "mixer_ui.h"
 #include "startup.h"
 #include "window_manager.h"
@@ -93,6 +94,20 @@ ARDOUR_UI::create_editor ()
        return 0;
 }
 
+int
+ARDOUR_UI::create_luawindow ()
+
+{
+       try {
+               luawindow = LuaWindow::instance ();
+       }
+       catch (failed_constructor& err) {
+               return -1;
+       }
+
+       return 0;
+}
+
 void
 ARDOUR_UI::install_actions ()
 {
@@ -148,6 +163,17 @@ ARDOUR_UI::install_actions ()
        ActionManager::session_sensitive_actions.push_back (act);
        ActionManager::write_sensitive_actions.push_back (act);
 
+       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));
        ActionManager::session_sensitive_actions.push_back (act);
@@ -255,6 +281,9 @@ ARDOUR_UI::install_actions ()
        global_actions.register_action (common_actions, X_("key-change-mixer-visibility"), _("Change"), sigc::bind (sigc::mem_fun (*this, &ARDOUR_UI::key_change_tabbable_visibility), mixer));
        global_actions.register_action (common_actions, X_("key-change-preferences-visibility"), _("Change"), sigc::bind (sigc::mem_fun (*this, &ARDOUR_UI::key_change_tabbable_visibility), rc_option_editor));
 
+       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 */
@@ -273,6 +302,7 @@ ARDOUR_UI::install_actions ()
                global_actions.register_action (common_actions, X_("show-ui-prefs"), _("Show more UI preferences"), sigc::mem_fun (*this, &ARDOUR_UI::show_ui_prefs));
        }
 
+       global_actions.register_action (common_actions, X_("toggle-luawindow"), S_("Window|Scripting"),  sigc::mem_fun(*this, &ARDOUR_UI::toggle_luawindow));
        global_actions.register_action (common_actions, X_("toggle-meterbridge"), S_("Window|Meterbridge"),  sigc::mem_fun(*this, &ARDOUR_UI::toggle_meterbridge));
 
        act = global_actions.register_action (common_actions, X_("NewMIDITracer"), _("MIDI Tracer"), sigc::mem_fun(*this, &ARDOUR_UI::new_midi_tracer_window));
@@ -500,7 +530,7 @@ ARDOUR_UI::install_actions ()
        shuttle_actions->add (Action::create (X_("SetShuttleUnitsPercentage"), _("Percentage")), hide_return (sigc::bind (sigc::mem_fun (*Config, &RCConfiguration::set_shuttle_units), Percentage)));
        shuttle_actions->add (Action::create (X_("SetShuttleUnitsSemitones"), _("Semitones")), hide_return (sigc::bind (sigc::mem_fun (*Config, &RCConfiguration::set_shuttle_units), Semitones)));
 
-       Glib::RefPtr<ActionGroup> option_actions = global_actions.create_action_group ("options");
+       Glib::RefPtr<ActionGroup> option_actions = global_actions.create_action_group ("Options");
 
        act = global_actions.register_toggle_action (option_actions, X_("SendMTC"), _("Send MTC"), sigc::mem_fun (*this, &ARDOUR_UI::toggle_send_mtc));
        ActionManager::session_sensitive_actions.push_back (act);
@@ -519,16 +549,6 @@ ARDOUR_UI::install_actions ()
        global_actions.register_action (midi_actions, X_("panic"), _("Panic"), sigc::mem_fun(*this, &ARDOUR_UI::midi_panic));
 }
 
-static
-bool drag_failed (const Glib::RefPtr<Gdk::DragContext>& context, DragResult result, Tabbable* tab)
-{
-       if (result == Gtk::DRAG_RESULT_NO_TARGET) {
-               tab->detach ();
-               return true;
-       }
-       return false;
-}
-
 void
 ARDOUR_UI::build_menu_bar ()
 {
@@ -573,43 +593,6 @@ ARDOUR_UI::build_menu_bar ()
        use_menubar_as_top_menubar ();
 #endif
 
-       Gtk::HBox*   window_button_box = manage (new Gtk::HBox);
-
-       editor_visibility_button.signal_drag_failed().connect (sigc::bind (sigc::ptr_fun (drag_failed), editor));
-       mixer_visibility_button.signal_drag_failed().connect (sigc::bind (sigc::ptr_fun (drag_failed), mixer));
-       prefs_visibility_button.signal_drag_failed().connect (sigc::bind (sigc::ptr_fun (drag_failed), rc_option_editor));
-
-       /* catch context clicks so that we can show a menu on these buttons */
-
-       editor_visibility_button.signal_button_press_event().connect (sigc::bind (sigc::mem_fun (*this, &ARDOUR_UI::tabbable_visibility_button_press), X_("editor")), false);
-       mixer_visibility_button.signal_button_press_event().connect (sigc::bind (sigc::mem_fun (*this, &ARDOUR_UI::tabbable_visibility_button_press), X_("mixer")), false);
-       prefs_visibility_button.signal_button_press_event().connect (sigc::bind (sigc::mem_fun (*this, &ARDOUR_UI::tabbable_visibility_button_press), X_("preferences")), false);
-
-       editor_visibility_button.set_related_action (ActionManager::get_action (X_("Common"), X_("change-editor-visibility")));
-       editor_visibility_button.set_name (X_("page switch button"));
-       mixer_visibility_button.set_related_action (ActionManager::get_action (X_("Common"), X_("change-mixer-visibility")));
-       mixer_visibility_button.set_name (X_("page switch button"));
-       prefs_visibility_button.set_related_action (ActionManager::get_action (X_("Common"), X_("change-preferences-visibility")));
-       prefs_visibility_button.set_name (X_("page switch button"));
-
-       Gtkmm2ext::UI::instance()->set_tip (editor_visibility_button,
-                                           string_compose (_("Drag this tab to the desktop to show %1 in its own window\n\n"
-                                                             "To put the window back, use the Window > %1 > Attach menu action"), editor->name()));
-
-       Gtkmm2ext::UI::instance()->set_tip (mixer_visibility_button,
-                                           string_compose (_("Drag this tab to the desktop to show %1 in its own window\n\n"
-                                                             "To put the window back, use the Window > %1 > Attach menu action"), mixer->name()));
-
-       Gtkmm2ext::UI::instance()->set_tip (prefs_visibility_button,
-                                           string_compose (_("Drag this tab to the desktop to show %1 in its own window\n\n"
-                                                             "To put the window back, use the Window > %1 > Attach menu action"), rc_option_editor->name()));
-
-       window_button_box->pack_start (editor_visibility_button, false, false);
-       window_button_box->pack_start (mixer_visibility_button, false, false);
-       window_button_box->pack_start (prefs_visibility_button, false, false);
-
-       menu_hbox.pack_start (*window_button_box, false, false, 20);
-
        bool wall_clock = false;
        bool disk_space = false;
 
@@ -680,7 +663,7 @@ ARDOUR_UI::use_menubar_as_top_menubar ()
                app->add_app_menu_item (group, dynamic_cast<MenuItem*>(widget));
         }
 
-       if ((widget = ActionManager::get_widget ("/ui/Main/Session/toggle-rc-options-editor"))) {
+       if ((widget = ActionManager::get_widget ("/ui/Main/Edit/menu-show-preferences"))) {
                app->add_app_menu_item (group, dynamic_cast<MenuItem*>(widget));
         }
 
@@ -719,11 +702,11 @@ ARDOUR_UI::save_ardour_state ()
 
        string current_tab;
        int current_page_number = _tabs.get_current_page ();
-       if (editor && (current_page_number == _tabs.page_num (editor->contents()))) {
+       if (current_page_number == _tabs.page_num (editor->contents())) {
                current_tab = "editor";
-       } else if (mixer && (current_page_number == _tabs.page_num (mixer->contents()))) {
+       } else if (current_page_number == _tabs.page_num (mixer->contents())) {
                current_tab = "mixer";
-       } else if (rc_option_editor && (current_page_number == _tabs.page_num (rc_option_editor->contents()))) {
+       } else if (current_page_number == _tabs.page_num (rc_option_editor->contents())) {
                current_tab == "preferences";
        }