X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=gtk2_ardour%2Fardour_ui_ed.cc;h=d10e67339625287203914377f1b47dc6485a4fe5;hb=d13435a4e1d0e85654a8477ae99a7b41ff621159;hp=16e1edd68e2825d22ac53ea5eb33afa3e609a43a;hpb=4ed2cb67b7bd2a27bd007a89b732d187ec669908;p=ardour.git diff --git a/gtk2_ardour/ardour_ui_ed.cc b/gtk2_ardour/ardour_ui_ed.cc index 16e1edd68e..d10e673396 100644 --- a/gtk2_ardour/ardour_ui_ed.cc +++ b/gtk2_ardour/ardour_ui_ed.cc @@ -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" @@ -67,7 +68,7 @@ #include "control_protocol/control_protocol.h" -#include "i18n.h" +#include "pbd/i18n.h" using namespace std; using namespace ARDOUR; @@ -88,11 +89,31 @@ ARDOUR_UI::create_editor () return -1; } - editor->signal_event().connect (sigc::bind (sigc::ptr_fun (&Keyboard::catch_user_event_for_pre_dialog_focus), editor)); + // editor->signal_event().connect (sigc::bind (sigc::ptr_fun (&Keyboard::catch_user_event_for_pre_dialog_focus), editor)); + + return 0; +} + +int +ARDOUR_UI::create_luawindow () + +{ + try { + luawindow = LuaWindow::instance (); + } + catch (failed_constructor& err) { + return -1; + } return 0; } +void +ARDOUR_UI::escape () +{ + Escape (); /* EMIT SIGNAL */ +} + void ARDOUR_UI::install_actions () { @@ -100,6 +121,8 @@ ARDOUR_UI::install_actions () Glib::RefPtr main_menu_actions = global_actions.create_action_group (X_("Main_menu")); Glib::RefPtr act; + global_actions.register_action (main_actions, X_("Escape"), _("Escape"), sigc::mem_fun (*this, &ARDOUR_UI::escape)); + /* menus + submenus that need action items */ global_actions.register_action (main_menu_actions, X_("Session"), _("Session")); @@ -133,8 +156,7 @@ ARDOUR_UI::install_actions () act = global_actions.register_action (main_actions, X_("Close"), _("Close"), sigc::mem_fun(*this, &ARDOUR_UI::close_session)); ActionManager::session_sensitive_actions.push_back (act); - act = global_actions.register_action (main_actions, X_("AddTrackBus"), _("Add Track or Bus..."), - sigc::bind (sigc::mem_fun(*this, &ARDOUR_UI::add_route), (Gtk::Window*) 0)); + act = global_actions.register_action (main_actions, X_("AddTrackBus"), _("Add Track or Bus..."), sigc::mem_fun(*this, &ARDOUR_UI::add_route)); ActionManager::session_sensitive_actions.push_back (act); ActionManager::write_sensitive_actions.push_back (act); @@ -148,27 +170,35 @@ 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_("OpenVideo"), _("Open Video"), + 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); act = global_actions.register_action (main_actions, X_("CloseVideo"), _("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"), + 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))); ActionManager::session_sensitive_actions.push_back (act); act = global_actions.register_action (main_actions, X_("SnapshotStay"), _("Snapshot (& keep working on current version) ..."), sigc::bind (sigc::mem_fun(*this, &ARDOUR_UI::snapshot_session), false)); ActionManager::session_sensitive_actions.push_back (act); - ActionManager::write_sensitive_actions.push_back (act); act = global_actions.register_action (main_actions, X_("SnapshotSwitch"), _("Snapshot (& switch to new version) ..."), sigc::bind (sigc::mem_fun(*this, &ARDOUR_UI::snapshot_session), true)); ActionManager::session_sensitive_actions.push_back (act); - ActionManager::write_sensitive_actions.push_back (act); - act = global_actions.register_action (main_actions, X_("QuickSnapshotStay"), _("Quick Snapshot(& keep working on current version) ..."), sigc::bind (sigc::mem_fun(*this, &ARDOUR_UI::quick_snapshot_session), false)); + act = global_actions.register_action (main_actions, X_("QuickSnapshotStay"), _("Quick Snapshot (& keep working on current version) ..."), sigc::bind (sigc::mem_fun(*this, &ARDOUR_UI::quick_snapshot_session), false)); ActionManager::session_sensitive_actions.push_back (act); - ActionManager::write_sensitive_actions.push_back (act); act = global_actions.register_action (main_actions, X_("QuickSnapshotSwitch"), _("Quick Snapshot (& switch to new version) ..."), sigc::bind (sigc::mem_fun(*this, &ARDOUR_UI::quick_snapshot_session), true)); ActionManager::session_sensitive_actions.push_back (act); @@ -176,7 +206,6 @@ ARDOUR_UI::install_actions () act = global_actions.register_action (main_actions, X_("SaveAs"), _("Save As..."), sigc::mem_fun(*this, &ARDOUR_UI::save_session_as)); ActionManager::session_sensitive_actions.push_back (act); - ActionManager::write_sensitive_actions.push_back (act); act = global_actions.register_action (main_actions, X_("Rename"), _("Rename..."), sigc::mem_fun(*this, &ARDOUR_UI::rename_session)); ActionManager::session_sensitive_actions.push_back (act); @@ -255,6 +284,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 +305,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)); @@ -434,22 +467,22 @@ ARDOUR_UI::install_actions () ActionManager::session_sensitive_actions.push_back (act); ActionManager::transport_sensitive_actions.push_back (act); - act = global_actions.register_action (transport_actions, X_("primary-clock-timecode"), _("Timecode"), sigc::bind (sigc::mem_fun(primary_clock, &AudioClock::set_mode), AudioClock::Timecode)); + act = global_actions.register_action (transport_actions, X_("primary-clock-timecode"), _("Timecode"), sigc::bind (sigc::mem_fun(primary_clock, &AudioClock::set_mode), AudioClock::Timecode, false)); ActionManager::session_sensitive_actions.push_back (act); - act = global_actions.register_action (transport_actions, X_("primary-clock-bbt"), _("Bars & Beats"), sigc::bind (sigc::mem_fun(primary_clock, &AudioClock::set_mode), AudioClock::BBT)); + act = global_actions.register_action (transport_actions, X_("primary-clock-bbt"), _("Bars & Beats"), sigc::bind (sigc::mem_fun(primary_clock, &AudioClock::set_mode), AudioClock::BBT, false)); ActionManager::session_sensitive_actions.push_back (act); - act = global_actions.register_action (transport_actions, X_("primary-clock-minsec"), _("Minutes & Seconds"), sigc::bind (sigc::mem_fun(primary_clock, &AudioClock::set_mode), AudioClock::MinSec)); + act = global_actions.register_action (transport_actions, X_("primary-clock-minsec"), _("Minutes & Seconds"), sigc::bind (sigc::mem_fun(primary_clock, &AudioClock::set_mode), AudioClock::MinSec, false)); ActionManager::session_sensitive_actions.push_back (act); - act = global_actions.register_action (transport_actions, X_("primary-clock-samples"), _("Samples"), sigc::bind (sigc::mem_fun(primary_clock, &AudioClock::set_mode), AudioClock::Frames)); + act = global_actions.register_action (transport_actions, X_("primary-clock-samples"), _("Samples"), sigc::bind (sigc::mem_fun(primary_clock, &AudioClock::set_mode), AudioClock::Frames, false)); ActionManager::session_sensitive_actions.push_back (act); - act = global_actions.register_action (transport_actions, X_("secondary-clock-timecode"), _("Timecode"), sigc::bind (sigc::mem_fun(secondary_clock, &AudioClock::set_mode), AudioClock::Timecode)); + act = global_actions.register_action (transport_actions, X_("secondary-clock-timecode"), _("Timecode"), sigc::bind (sigc::mem_fun(secondary_clock, &AudioClock::set_mode), AudioClock::Timecode, false)); ActionManager::session_sensitive_actions.push_back (act); - act = global_actions.register_action (transport_actions, X_("secondary-clock-bbt"), _("Bars & Beats"), sigc::bind (sigc::mem_fun(secondary_clock, &AudioClock::set_mode), AudioClock::BBT)); + act = global_actions.register_action (transport_actions, X_("secondary-clock-bbt"), _("Bars & Beats"), sigc::bind (sigc::mem_fun(secondary_clock, &AudioClock::set_mode), AudioClock::BBT, false)); ActionManager::session_sensitive_actions.push_back (act); - act = global_actions.register_action (transport_actions, X_("secondary-clock-minsec"), _("Minutes & Seconds"), sigc::bind (sigc::mem_fun(secondary_clock, &AudioClock::set_mode), AudioClock::MinSec)); + act = global_actions.register_action (transport_actions, X_("secondary-clock-minsec"), _("Minutes & Seconds"), sigc::bind (sigc::mem_fun(secondary_clock, &AudioClock::set_mode), AudioClock::MinSec, false)); ActionManager::session_sensitive_actions.push_back (act); - act = global_actions.register_action (transport_actions, X_("secondary-clock-samples"), _("Samples"), sigc::bind (sigc::mem_fun(secondary_clock, &AudioClock::set_mode), AudioClock::Frames)); + act = global_actions.register_action (transport_actions, X_("secondary-clock-samples"), _("Samples"), sigc::bind (sigc::mem_fun(secondary_clock, &AudioClock::set_mode), AudioClock::Frames, false)); ActionManager::session_sensitive_actions.push_back (act); act = global_actions.register_toggle_action (transport_actions, X_("TogglePunchIn"), _("Punch In"), sigc::mem_fun(*this, &ARDOUR_UI::toggle_punch_in)); @@ -500,7 +533,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 option_actions = global_actions.create_action_group ("options"); + Glib::RefPtr 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 +552,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& 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,55 +596,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; - - if (!Profile->get_small_screen()) { -#ifndef __APPLE__ - // OSX provides its own wallclock, thank you very much - wall_clock = true; -#endif - disk_space = true; - } - - hbox->pack_end (error_alert_button, false, false, 2); hbox->pack_end (wall_clock_label, false, false, 2); @@ -640,9 +614,10 @@ ARDOUR_UI::build_menu_bar () menu_bar_base.add (menu_hbox); #ifndef __APPLE__ - _status_bar_visibility.add (&wall_clock_label, X_("WallClock"), _("Wall Clock"), wall_clock); + // OSX provides its own wallclock, thank you very much + _status_bar_visibility.add (&wall_clock_label, X_("WallClock"), _("Wall Clock"), true); #endif - _status_bar_visibility.add (&disk_space_label, X_("Disk"), _("Disk Space"), disk_space); + _status_bar_visibility.add (&disk_space_label, X_("Disk"), _("Disk Space"), !Profile->get_small_screen()); _status_bar_visibility.add (&cpu_load_label, X_("DSP"), _("DSP"), true); _status_bar_visibility.add (&xrun_label, X_("XRun"), _("X-run"), false); _status_bar_visibility.add (&peak_thread_work_label,X_("Peakfile"), _("Active Peak-file Work"), false); @@ -680,7 +655,7 @@ ARDOUR_UI::use_menubar_as_top_menubar () app->add_app_menu_item (group, dynamic_cast(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(widget)); } @@ -698,6 +673,7 @@ 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); Config->add_extra_xml (get_transport_controllable_state()); @@ -719,12 +695,12 @@ 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()))) { - current_tab == "preferences"; + } else if (current_page_number == _tabs.page_num (rc_option_editor->contents())) { + current_tab = "preferences"; } main_window_node.add_property (X_("current-tab"), current_tab); @@ -746,6 +722,7 @@ ARDOUR_UI::save_ardour_state () XMLNode& enode (editor->get_state()); XMLNode& mnode (mixer->get_state()); XMLNode& bnode (meterbridge->get_state()); + XMLNode& pnode (rc_option_editor->get_state()); Config->add_extra_xml (*window_node); Config->add_extra_xml (audio_midi_setup->get_state()); @@ -758,6 +735,7 @@ ARDOUR_UI::save_ardour_state () _session->add_instant_xml (main_window_node); _session->add_instant_xml (enode); _session->add_instant_xml (mnode); + _session->add_instant_xml (pnode); _session->add_instant_xml (bnode); if (location_ui) { _session->add_instant_xml (location_ui->ui().get_state ()); @@ -766,12 +744,17 @@ ARDOUR_UI::save_ardour_state () Config->add_instant_xml (main_window_node); Config->add_instant_xml (enode); Config->add_instant_xml (mnode); + Config->add_instant_xml (pnode); Config->add_instant_xml (bnode); if (location_ui) { Config->add_instant_xml (location_ui->ui().get_state ()); } } + delete &enode; + delete &mnode; + delete &bnode; + delete &pnode; Keyboard::save_keybindings (); }