diff options
author | Paul Davis <paul@linuxaudiosystems.com> | 2009-11-10 04:30:08 +0000 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2009-11-10 04:30:08 +0000 |
commit | a65149b2462ea0e73c4686d7ed7bbc42bf6a1632 (patch) | |
tree | 357ff8dbc5c10e7804da23d7876d3ccf9b14f46e | |
parent | dbb0b9ca4f82ea8e3829cfeb009b9746c3d6f0dc (diff) |
lots of tweaks relating to GUI sync management
git-svn-id: svn://localhost/ardour2/branches/3.0@6051 d708f5d6-7413-0410-9779-e7cbd77b26cf
-rw-r--r-- | gtk2_ardour/ardour3_ui_dark.rc.in | 24 | ||||
-rw-r--r-- | gtk2_ardour/ardour_ui.h | 5 | ||||
-rw-r--r-- | gtk2_ardour/ardour_ui2.cc | 42 | ||||
-rw-r--r-- | gtk2_ardour/ardour_ui_ed.cc | 5 | ||||
-rw-r--r-- | gtk2_ardour/ardour_ui_options.cc | 10 | ||||
-rw-r--r-- | gtk2_ardour/option_editor.h | 4 | ||||
-rw-r--r-- | gtk2_ardour/rc_option_editor.cc | 8 | ||||
-rw-r--r-- | gtk2_ardour/session_option_editor.cc | 149 | ||||
-rw-r--r-- | gtk2_ardour/session_option_editor.h | 1 | ||||
-rw-r--r-- | libs/ardour/rc_configuration.cc | 2 | ||||
-rw-r--r-- | libs/ardour/session_midi.cc | 2 |
11 files changed, 155 insertions, 97 deletions
diff --git a/gtk2_ardour/ardour3_ui_dark.rc.in b/gtk2_ardour/ardour3_ui_dark.rc.in index 01f0085fba..a0643cd7bb 100644 --- a/gtk2_ardour/ardour3_ui_dark.rc.in +++ b/gtk2_ardour/ardour3_ui_dark.rc.in @@ -1112,6 +1112,24 @@ style "green_flashing_alert" = "very_small_text" bg[ACTIVE] = { 0.52, 1.0, 0} } +style "sync_alert" +{ + # + # this is used when the sync button is indicating that sync is + # active, and alternates with another style if sync is active + # but we are not locked + # + bg[ACTIVE] = { 0.52, 1.0, 0} + bg[PRELIGHT] = { 0.52, 1.0, 0} + bg[SELECTED] = { 0.52, 1.0, 0} + bg[NORMAL] = { 0.52, 1.0, 0} + + fg[NORMAL] = { 0, 0, 0 } + fg[PRELIGHT] = { 0, 0, 0 } + fg[SELECTED] = { 0, 0, 0 } + fg[ACTIVE] = { 0, 0, 0 } +} + style "selected_io_selector_port_list" = "medium_bold_text" { @@ -1362,6 +1380,10 @@ widget "*EditGroupButton" style:highest "very_small_button" widget "*EditGroupButtonLabel" style:highest "very_small_button" widget "*TransportButton" style:highest "transport_rec_button" widget "*TransportButton-active" style:highest "transport_button_active" +widget "*TransportSyncButton" style:highest "transport_button" +widget "*TransportSyncButton*" style:highest "transport_button" +widget "*TransportSyncButton-active" style:highest "sync_alert" +widget "*TransportSyncButton-active*" style:highest "sync_alert" widget "*ShuttleButton" style:highest "transport_button" widget "*ShuttleButton*" style:highest "transport_button" widget "*ShuttleDisplay" style:highest "transport_button" @@ -1528,8 +1550,6 @@ widget "*BypassButton" style:highest "red_when_active" widget "*BypassButton*" style:highest "red_when_active" widget "*TransportSoloAlert" style:highest "flashing_alert" widget "*TransportSoloAlert.*" style:highest "flashing_alert" -widget "*TransportSyncAlert" style:highest "flashing_alert" -widget "*TransportSyncAlert.*" style:highest "flashing_alert" widget "*SendAlert" style:highest "green_flashing_alert" widget "*SendAlert.*" style:highest "green_flashing_alert" widget "*TransportAuditioningAlert" style:highest "flashing_alert" diff --git a/gtk2_ardour/ardour_ui.h b/gtk2_ardour/ardour_ui.h index 6a8d790915..97a64c5330 100644 --- a/gtk2_ardour/ardour_ui.h +++ b/gtk2_ardour/ardour_ui.h @@ -385,9 +385,7 @@ class ARDOUR_UI : public Gtkmm2ext::UI BindableButton play_selection_button; BindableButton rec_button; - Gtk::ToggleButton sync_button; - - void sync_button_clicked (); + void toggle_external_sync (); void toggle_time_master (); void toggle_video_sync (); @@ -427,6 +425,7 @@ class ARDOUR_UI : public Gtkmm2ext::UI Gtkmm2ext::StatefulToggleButton auto_input_button; Gtkmm2ext::StatefulToggleButton click_button; Gtkmm2ext::StatefulToggleButton time_master_button; + Gtkmm2ext::StatefulToggleButton sync_button; Gtk::ToggleButton auditioning_alert_button; Gtk::ToggleButton solo_alert_button; diff --git a/gtk2_ardour/ardour_ui2.cc b/gtk2_ardour/ardour_ui2.cc index 7f7d46150c..60477c894f 100644 --- a/gtk2_ardour/ardour_ui2.cc +++ b/gtk2_ardour/ardour_ui2.cc @@ -127,6 +127,19 @@ ARDOUR_UI::display_message (const char *prefix, gint prefix_len, RefPtr<TextBuff #endif } +static bool +null_crossing (GdkEventCrossing* /* ignored */) +{ + return true; +} + +static void +block_prelight (Gtk::Widget& w) +{ + w.signal_enter_notify_event().connect (sigc::ptr_fun (null_crossing), false); + w.signal_leave_notify_event().connect (sigc::ptr_fun (null_crossing), false); +} + void ARDOUR_UI::setup_transport () { @@ -172,6 +185,7 @@ ARDOUR_UI::setup_transport () punch_out_button.set_name ("TransportButton"); click_button.set_name ("TransportButton"); time_master_button.set_name ("TransportButton"); + sync_button.set_name ("TransportSyncButton"); stop_button.set_size_request(29, -1); roll_button.set_size_request(29, -1); @@ -225,6 +239,8 @@ ARDOUR_UI::setup_transport () act->connect_proxy (play_selection_button); act = ActionManager::get_action (X_("Transport"), X_("ToggleTimeMaster")); act->connect_proxy (time_master_button); + act = ActionManager::get_action (X_("Transport"), X_("ToggleExternalSync")); + act->connect_proxy (sync_button); ARDOUR_UI::instance()->tooltips().set_tip (roll_button, _("Play from playhead")); ARDOUR_UI::instance()->tooltips().set_tip (stop_button, _("Stop playback")); @@ -239,12 +255,13 @@ ARDOUR_UI::setup_transport () ARDOUR_UI::instance()->tooltips().set_tip (punch_in_button, _("Start recording at auto-punch start")); ARDOUR_UI::instance()->tooltips().set_tip (punch_out_button, _("Stop recording at auto-punch end")); ARDOUR_UI::instance()->tooltips().set_tip (click_button, _("Enable/Disable audio click")); - ARDOUR_UI::instance()->tooltips().set_tip (sync_button, _("Positional sync source")); + ARDOUR_UI::instance()->tooltips().set_tip (sync_button, _("Enable/Disable external positional sync")); ARDOUR_UI::instance()->tooltips().set_tip (time_master_button, _("Does Ardour control the time?")); ARDOUR_UI::instance()->tooltips().set_tip (shuttle_box, _("Shuttle speed control")); ARDOUR_UI::instance()->tooltips().set_tip (shuttle_units_button, _("Select semitones or %%-age for speed display")); ARDOUR_UI::instance()->tooltips().set_tip (speed_display_box, _("Current transport speed")); + shuttle_box.set_flags (CAN_FOCUS); shuttle_box.add_events (Gdk::ENTER_NOTIFY_MASK|Gdk::LEAVE_NOTIFY_MASK|Gdk::BUTTON_RELEASE_MASK|Gdk::BUTTON_PRESS_MASK|Gdk::POINTER_MOTION_MASK|Gdk::SCROLL_MASK); shuttle_box.set_size_request (100, 15); @@ -331,9 +348,7 @@ ARDOUR_UI::setup_transport () sdframe->set_shadow_type (SHADOW_IN); sdframe->add (speed_display_box); - sync_button.set_name ("TransportSyncAlert"); - sync_button.signal_clicked().connect (mem_fun (*this, &ARDOUR_UI::sync_button_clicked)); - // XXX HOW TO USE set_popdown_strings() with this when we don't know the real strings till later? + /* translators: Egternal is "External" with a descender character */ set_size_request_to_display_given_text (sync_button, X_("Egternal"), 4, 10); shbox->pack_start (*sdframe, false, false); @@ -488,17 +503,22 @@ void ARDOUR_UI::sync_blink (bool onoff) { if (session == 0 || !session->config.get_external_sync()) { + /* internal sync */ + sync_button.set_visual_state (0); return; } if (!session->transport_locked()) { + /* not locked, so blink on and off according to the onoff argument */ + if (onoff) { - sync_button.set_state (STATE_ACTIVE); + sync_button.set_visual_state (1); // "-active" } else { - sync_button.set_state (STATE_NORMAL); + sync_button.set_visual_state (0); // normal } } else { - sync_button.set_state (STATE_NORMAL); + /* locked */ + sync_button.set_visual_state (1); // "-active" } } @@ -863,14 +883,6 @@ ARDOUR_UI::editor_realized () } void -ARDOUR_UI::sync_button_clicked () -{ - if (session) { - session->config.set_external_sync (sync_button.get_active()); - } -} - -void ARDOUR_UI::maximise_editing_space () { if (!editor) { diff --git a/gtk2_ardour/ardour_ui_ed.cc b/gtk2_ardour/ardour_ui_ed.cc index 3da5104f8b..ee93919ece 100644 --- a/gtk2_ardour/ardour_ui_ed.cc +++ b/gtk2_ardour/ardour_ui_ed.cc @@ -364,9 +364,12 @@ ARDOUR_UI::install_actions () ActionManager::session_sensitive_actions.push_back (act); ActionManager::transport_sensitive_actions.push_back (act); - ActionManager::register_toggle_action (transport_actions, X_("ToggleVideoSync"), _("Sync startup to video"), mem_fun(*this, &ARDOUR_UI::toggle_video_sync)); + act = ActionManager::register_toggle_action (transport_actions, X_("ToggleVideoSync"), _("Sync startup to video"), mem_fun(*this, &ARDOUR_UI::toggle_video_sync)); + ActionManager::session_sensitive_actions.push_back (act); act = ActionManager::register_toggle_action (transport_actions, X_("ToggleTimeMaster"), _("Time Master"), mem_fun(*this, &ARDOUR_UI::toggle_time_master)); ActionManager::session_sensitive_actions.push_back (act); + act = ActionManager::register_toggle_action (transport_actions, X_("ToggleExternalSync"), _(""), mem_fun(*this, &ARDOUR_UI::toggle_external_sync)); + ActionManager::session_sensitive_actions.push_back (act); act = ActionManager::register_action (common_actions, X_("ToggleRecordEnableTrack1"), _("Toggle Record Enable Track1"), bind (mem_fun(*this, &ARDOUR_UI::toggle_record_enable), 0U)); ActionManager::session_sensitive_actions.push_back (act); diff --git a/gtk2_ardour/ardour_ui_options.cc b/gtk2_ardour/ardour_ui_options.cc index 8f16b9578a..c00097d417 100644 --- a/gtk2_ardour/ardour_ui_options.cc +++ b/gtk2_ardour/ardour_ui_options.cc @@ -48,6 +48,12 @@ using namespace PBD; using namespace sigc; void +ARDOUR_UI::toggle_external_sync() +{ + ActionManager::toggle_config_state_foo ("Transport", "ToggleExternalSync", mem_fun (session->config, &SessionConfiguration::set_external_sync), mem_fun (session->config, &SessionConfiguration::get_external_sync)); +} + +void ARDOUR_UI::toggle_time_master () { ActionManager::toggle_config_state_foo ("Transport", "ToggleTimeMaster", mem_fun (session->config, &SessionConfiguration::set_jack_time_master), mem_fun (session->config, &SessionConfiguration::get_jack_time_master)); @@ -296,7 +302,9 @@ ARDOUR_UI::parameter_changed (std::string p) ENSURE_GUI_THREAD (bind (mem_fun (*this, &ARDOUR_UI::parameter_changed), p)); if (p == "external-sync") { - + + ActionManager::map_some_state ("Transport", "ToggleExternalSync", mem_fun (session->config, &SessionConfiguration::get_external_sync)); + if (!session->config.get_external_sync()) { sync_button.set_label (_("Internal")); ActionManager::get_action ("Transport", "ToggleAutoPlay")->set_sensitive (true); diff --git a/gtk2_ardour/option_editor.h b/gtk2_ardour/option_editor.h index 3a5281af0c..fb6663e3f9 100644 --- a/gtk2_ardour/option_editor.h +++ b/gtk2_ardour/option_editor.h @@ -243,6 +243,10 @@ public: } } + void set_sensitive (bool yn) { + _combo->set_sensitive (yn); + } + private: sigc::slot<T> _get; diff --git a/gtk2_ardour/rc_option_editor.cc b/gtk2_ardour/rc_option_editor.cc index c20fbef2a6..1ce53e80aa 100644 --- a/gtk2_ardour/rc_option_editor.cc +++ b/gtk2_ardour/rc_option_editor.cc @@ -55,25 +55,25 @@ public: t->set_spacings (12); int n = 0; - Label* l = manage (new Label (_("MTC:"))); + Label* l = manage (new Label (_("Receive MTC via:"))); l->set_alignment (1, 0.5); t->attach (*l, 0, 1, n, n + 1, EXPAND | FILL, FILL); t->attach (_mtc_combo, 1, 2, n, n + 1, EXPAND | FILL, EXPAND | FILL); ++n; - l = manage (new Label (_("MIDI clock:"))); + l = manage (new Label (_("Receive MIDI clock via:"))); l->set_alignment (1, 0.5); t->attach (*l, 0, 1, n, n + 1, FILL, FILL); t->attach (_midi_clock_combo, 1, 2, n, n + 1, FILL, FILL); ++n; - l = manage (new Label (_("MMC:"))); + l = manage (new Label (_("Receive MMC via:"))); l->set_alignment (1, 0.5); t->attach (*l, 0, 1, n, n + 1, FILL, FILL); t->attach (_mmc_combo, 1, 2, n, n + 1, FILL, FILL); ++n; - l = manage (new Label (_("MIDI parameter control:"))); + l = manage (new Label (_("Receive MIDI parameter control via:"))); l->set_alignment (1, 0.5); t->attach (*l, 0, 1, n, n + 1, FILL, FILL); t->attach (_mpc_combo, 1, 2, n, n + 1, FILL, FILL); diff --git a/gtk2_ardour/session_option_editor.cc b/gtk2_ardour/session_option_editor.cc index 49dbcdff15..f8f060684f 100644 --- a/gtk2_ardour/session_option_editor.cc +++ b/gtk2_ardour/session_option_editor.cc @@ -141,73 +141,6 @@ SessionOptionEditor::SessionOptionEditor (Session* s) : OptionEditor (&(s->config), _("Session Preferences")) , _session_config (&(s->config)) { - /* FADES */ - - ComboOption<CrossfadeModel>* cfm = new ComboOption<CrossfadeModel> ( - "xfade-model", - _("Crossfades are created"), - mem_fun (*_session_config, &SessionConfiguration::get_xfade_model), - mem_fun (*_session_config, &SessionConfiguration::set_xfade_model) - ); - - cfm->add (FullCrossfade, _("to span entire overlap")); - cfm->add (ShortCrossfade, _("short")); - - add_option (_("Fades"), cfm); - - add_option (_("Fades"), new SpinOption<float> ( - _("short-xfade-seconds"), - _("Short crossfade length"), - mem_fun (*_session_config, &SessionConfiguration::get_short_xfade_seconds), - mem_fun (*_session_config, &SessionConfiguration::set_short_xfade_seconds), - 0, 1000, 1, 10, - _("ms"), 0.001 - )); - - add_option (_("Fades"), new SpinOption<float> ( - _("destructive-xfade-seconds"), - _("Destructive crossfade length"), - mem_fun (*_session_config, &SessionConfiguration::get_destructive_xfade_msecs), - mem_fun (*_session_config, &SessionConfiguration::set_destructive_xfade_msecs), - 0, 1000, 1, 10, - _("ms") - )); - - add_option (_("Fades"), new BoolOption ( - "auto-xfade", - _("Create crossfades automatically"), - mem_fun (*_session_config, &SessionConfiguration::get_auto_xfade), - mem_fun (*_session_config, &SessionConfiguration::set_auto_xfade) - )); - - add_option (_("Fades"), new BoolOption ( - "xfades-active", - _("Crossfades active"), - mem_fun (*_session_config, &SessionConfiguration::get_xfades_active), - mem_fun (*_session_config, &SessionConfiguration::set_xfades_active) - )); - - add_option (_("Fades"), new BoolOption ( - "xfades-visible", - _("Crossfades visible"), - mem_fun (*_session_config, &SessionConfiguration::get_xfades_visible), - mem_fun (*_session_config, &SessionConfiguration::set_xfades_visible) - )); - - add_option (_("Fades"), new BoolOption ( - "use-region-fades", - _("Region fades active"), - mem_fun (*_session_config, &SessionConfiguration::get_use_region_fades), - mem_fun (*_session_config, &SessionConfiguration::set_use_region_fades) - )); - - add_option (_("Fades"), new BoolOption ( - "show-region-fades", - _("Region fades visible"), - mem_fun (*_session_config, &SessionConfiguration::get_show_region_fades), - mem_fun (*_session_config, &SessionConfiguration::set_show_region_fades) - )); - /* SYNC */ ComboOption<uint32_t>* spf = new ComboOption<uint32_t> ( @@ -231,7 +164,10 @@ SessionOptionEditor::SessionOptionEditor (Session* s) s->MTC_PortChanged.connect (bind (mem_fun (*this, &SessionOptionEditor::populate_sync_options), s, ssrc)); s->MIDIClock_PortChanged.connect (bind (mem_fun (*this, &SessionOptionEditor::populate_sync_options), s, ssrc)); + s->config.ParameterChanged.connect (bind (mem_fun (*this, &SessionOptionEditor::follow_sync_state), s, ssrc)); + populate_sync_options (s, ssrc); + follow_sync_state (string ("external-sync"), s, ssrc); add_option (_("Sync"), ssrc); @@ -281,6 +217,73 @@ SessionOptionEditor::SessionOptionEditor (Session* s) add_option (_("Sync"), vpu); + /* FADES */ + + ComboOption<CrossfadeModel>* cfm = new ComboOption<CrossfadeModel> ( + "xfade-model", + _("Crossfades are created"), + mem_fun (*_session_config, &SessionConfiguration::get_xfade_model), + mem_fun (*_session_config, &SessionConfiguration::set_xfade_model) + ); + + cfm->add (FullCrossfade, _("to span entire overlap")); + cfm->add (ShortCrossfade, _("short")); + + add_option (_("Fades"), cfm); + + add_option (_("Fades"), new SpinOption<float> ( + _("short-xfade-seconds"), + _("Short crossfade length"), + mem_fun (*_session_config, &SessionConfiguration::get_short_xfade_seconds), + mem_fun (*_session_config, &SessionConfiguration::set_short_xfade_seconds), + 0, 1000, 1, 10, + _("ms"), 0.001 + )); + + add_option (_("Fades"), new SpinOption<float> ( + _("destructive-xfade-seconds"), + _("Destructive crossfade length"), + mem_fun (*_session_config, &SessionConfiguration::get_destructive_xfade_msecs), + mem_fun (*_session_config, &SessionConfiguration::set_destructive_xfade_msecs), + 0, 1000, 1, 10, + _("ms") + )); + + add_option (_("Fades"), new BoolOption ( + "auto-xfade", + _("Create crossfades automatically"), + mem_fun (*_session_config, &SessionConfiguration::get_auto_xfade), + mem_fun (*_session_config, &SessionConfiguration::set_auto_xfade) + )); + + add_option (_("Fades"), new BoolOption ( + "xfades-active", + _("Crossfades active"), + mem_fun (*_session_config, &SessionConfiguration::get_xfades_active), + mem_fun (*_session_config, &SessionConfiguration::set_xfades_active) + )); + + add_option (_("Fades"), new BoolOption ( + "xfades-visible", + _("Crossfades visible"), + mem_fun (*_session_config, &SessionConfiguration::get_xfades_visible), + mem_fun (*_session_config, &SessionConfiguration::set_xfades_visible) + )); + + add_option (_("Fades"), new BoolOption ( + "use-region-fades", + _("Region fades active"), + mem_fun (*_session_config, &SessionConfiguration::get_use_region_fades), + mem_fun (*_session_config, &SessionConfiguration::set_use_region_fades) + )); + + add_option (_("Fades"), new BoolOption ( + "show-region-fades", + _("Region fades visible"), + mem_fun (*_session_config, &SessionConfiguration::get_show_region_fades), + mem_fun (*_session_config, &SessionConfiguration::set_show_region_fades) + )); + /* MISC */ add_option (_("Misc"), new OptionEditorHeading (_("Audio file format"))); @@ -360,3 +363,15 @@ SessionOptionEditor::populate_sync_options (Session* s, Option* opt) } } +void +SessionOptionEditor::follow_sync_state (std::string p, Session* s, Option* opt) +{ + ComboOption<SyncSource>* sync_opt = dynamic_cast<ComboOption<SyncSource>* > (opt); + if (p == "external-sync") { + if (s->config.get_external_sync()) { + sync_opt->set_sensitive (false); + } else { + sync_opt->set_sensitive (true); + } + } +} diff --git a/gtk2_ardour/session_option_editor.h b/gtk2_ardour/session_option_editor.h index a2dc750cd2..76d69bd4b5 100644 --- a/gtk2_ardour/session_option_editor.h +++ b/gtk2_ardour/session_option_editor.h @@ -13,4 +13,5 @@ public: private: ARDOUR::SessionConfiguration* _session_config; void populate_sync_options (ARDOUR::Session*, Option*); + void follow_sync_state (std::string, ARDOUR::Session*, Option*); }; diff --git a/libs/ardour/rc_configuration.cc b/libs/ardour/rc_configuration.cc index b34a6fd1ee..f613ae1ecc 100644 --- a/libs/ardour/rc_configuration.cc +++ b/libs/ardour/rc_configuration.cc @@ -203,8 +203,6 @@ RCConfiguration::get_state () MIDI::Manager::PortMap::const_iterator i; const MIDI::Manager::PortMap& ports = MIDI::Manager::instance()->get_midi_ports(); - cerr << "Saving " << ports.size() << " MIDI ports\n"; - for (i = ports.begin(); i != ports.end(); ++i) { root->add_child_nocopy(i->second->get_state()); } diff --git a/libs/ardour/session_midi.cc b/libs/ardour/session_midi.cc index 34d9b470f5..1fe360e397 100644 --- a/libs/ardour/session_midi.cc +++ b/libs/ardour/session_midi.cc @@ -141,8 +141,6 @@ Session::set_mtc_port (string port_tag) ms->rebind (*port); } - cerr << "!!SPT to " << port_tag << endl; - Config->set_mtc_port_name (port_tag); out: |