diff options
author | Paul Davis <paul@linuxaudiosystems.com> | 2010-05-06 18:40:37 +0000 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2010-05-06 18:40:37 +0000 |
commit | f2ceb5c3404bb3e7f4ccc5bb3f2236f593775d73 (patch) | |
tree | b8cc08678ab9b4e189a5cd97ae16f425fe8ab0b4 | |
parent | e1ed9467dc9f9ffec7549958b1bca27b753e8742 (diff) |
lots of odds and ends to do with solo isolate and its GUI
git-svn-id: svn://localhost/ardour2/branches/3.0@7072 d708f5d6-7413-0410-9779-e7cbd77b26cf
-rw-r--r-- | gtk2_ardour/ardour3_ui_dark.rc.in | 17 | ||||
-rw-r--r-- | gtk2_ardour/led.cc | 48 | ||||
-rw-r--r-- | gtk2_ardour/led.h | 5 | ||||
-rw-r--r-- | gtk2_ardour/mixer_strip.cc | 12 | ||||
-rw-r--r-- | gtk2_ardour/monitor_section.cc | 34 | ||||
-rw-r--r-- | gtk2_ardour/monitor_section.h | 5 | ||||
-rw-r--r-- | gtk2_ardour/route_ui.cc | 24 | ||||
-rw-r--r-- | libs/ardour/ardour/session.h | 7 | ||||
-rw-r--r-- | libs/ardour/route.cc | 9 | ||||
-rw-r--r-- | libs/ardour/session.cc | 50 | ||||
-rw-r--r-- | libs/ardour/session_rtevents.cc | 18 | ||||
-rw-r--r-- | libs/ardour/session_state.cc | 1 |
12 files changed, 186 insertions, 44 deletions
diff --git a/gtk2_ardour/ardour3_ui_dark.rc.in b/gtk2_ardour/ardour3_ui_dark.rc.in index 1c1fdd520c..e423ad7960 100644 --- a/gtk2_ardour/ardour3_ui_dark.rc.in +++ b/gtk2_ardour/ardour3_ui_dark.rc.in @@ -332,14 +332,14 @@ style "solo_button" = "small_button" style "solo_isolate_led" { + fg[NORMAL] = { 0.725, 0.925, 0.949 } fg[ACTIVE] = { 1.0, 0, 0 } - fg[NORMAL] = { 0, 1.0, 0 } } style "solo_safe_led" { - fg[ACTIVE] = { 0.26, 0.47, 0.69 } - fg[NORMAL] = { 0, 1.0, 0 } + fg[NORMAL] = { 0.725, 0.925, 0.949 } + fg[ACTIVE] = { 1.0, 0, 0 } } style "solo_button_alternate" = "small_button" @@ -456,6 +456,13 @@ style "monitor_dim_button" = "small_button" fg[ACTIVE] = { 0, 0, 0 } } +style "monitor_iso_button" = "small_button" +{ + font_name = "@FONT_SMALLER@" + bg[ACTIVE] = { 0.725, 0.925, 0.949 } + fg[ACTIVE] = { 0, 0, 0 } +} + style "mute_button" = "small_button" { bg[ACTIVE] = { 0.90, 0.89, 0.73 } @@ -1689,6 +1696,8 @@ widget "*MonitorInvertButton" style:highest "monitor_invert_button" widget "*MonitorInvertButton*" style:highest "monitor_invert_button" widget "*MonitorOptButton" style:highest "monitor_opt_button" widget "*MonitorOptButton*" style:highest "monitor_opt_button" +widget "*MonitorIsoAlert" style:highest "monitor_iso_button" +widget "*MonitorIsoAlert*" style:highest "monitor_iso_button" widget "*BypassButton" style:highest "red_when_active" widget "*BypassButton*" style:highest "red_when_active" widget "*TransportSoloAlert" style:highest "flashing_alert" @@ -1806,4 +1815,4 @@ widget "*PortMatrixLabel*" style:highest "small_text" widget "*MidiTracerTextView" style:highest "midi_tracer_textview" widget "*SoloIsolatedLED" style:highest "solo_isolate_led" widget "*SoloSafeLED" style:highest "solo_safe_led" -widget "*SoloLEDLabel" style:highest "smallest_text" +widget "*SoloLEDLabel" style:highest "very_small_text" diff --git a/gtk2_ardour/led.cc b/gtk2_ardour/led.cc index 645b65e99b..76d71bc35e 100644 --- a/gtk2_ardour/led.cc +++ b/gtk2_ardour/led.cc @@ -122,24 +122,7 @@ LED::set_visual_state (int32_t s) if (s != _visual_state) { _visual_state = s; - - RefPtr<Style> style = get_style(); - Color c; - - switch (_visual_state) { - case 0: - c = style->get_fg (STATE_NORMAL); - break; - default: - c = style->get_fg (STATE_ACTIVE); - break; - } - - _red = c.get_red_p (); - _green = c.get_green_p (); - _blue = c.get_blue_p (); - - set_dirty (); + set_colors_from_style (); } } @@ -156,6 +139,13 @@ LED::set_diameter (float d) } void +LED::on_realize () +{ + set_colors_from_style (); + CairoWidget::on_realize (); +} + +void LED::on_size_request (Gtk::Requisition* req) { if (_fixed_diameter) { @@ -165,3 +155,25 @@ LED::on_size_request (Gtk::Requisition* req) CairoWidget::on_size_request (req); } } + +void +LED::set_colors_from_style () +{ + RefPtr<Style> style = get_style(); + Color c; + + switch (_visual_state) { + case 0: + c = style->get_fg (STATE_NORMAL); + break; + default: + c = style->get_fg (STATE_ACTIVE); + break; + } + + _red = c.get_red_p (); + _green = c.get_green_p (); + _blue = c.get_blue_p (); + + set_dirty (); +} diff --git a/gtk2_ardour/led.h b/gtk2_ardour/led.h index 6350a36ba3..06ac7454df 100644 --- a/gtk2_ardour/led.h +++ b/gtk2_ardour/led.h @@ -37,7 +37,8 @@ class LED : public CairoWidget protected: void render (cairo_t *); void on_size_request (Gtk::Requisition* req); - + void on_realize (); + private: int32_t _visual_state; bool _active; @@ -46,6 +47,8 @@ class LED : public CairoWidget float _red; float _green; float _blue; + + void set_colors_from_style (); }; #endif /* __gtk2_ardour_led_h__ */ diff --git a/gtk2_ardour/mixer_strip.cc b/gtk2_ardour/mixer_strip.cc index df9fc36084..ede93736e9 100644 --- a/gtk2_ardour/mixer_strip.cc +++ b/gtk2_ardour/mixer_strip.cc @@ -188,7 +188,7 @@ MixerStrip::init () solo_isolated_led = manage (new LED); solo_isolated_led->show (); - solo_isolated_led->set_diameter (5); + solo_isolated_led->set_diameter (6); solo_isolated_led->set_no_show_all (true); solo_isolated_led->set_name (X_("SoloIsolatedLED")); solo_isolated_led->add_events (Gdk::BUTTON_PRESS_MASK|Gdk::BUTTON_RELEASE_MASK); @@ -197,7 +197,7 @@ MixerStrip::init () solo_safe_led = manage (new LED); solo_safe_led->show (); - solo_safe_led->set_diameter (5); + solo_safe_led->set_diameter (6); solo_safe_led->set_no_show_all (true); solo_safe_led->set_name (X_("SoloSafeLED")); solo_safe_led->add_events (Gdk::BUTTON_PRESS_MASK|Gdk::BUTTON_RELEASE_MASK); @@ -215,10 +215,10 @@ MixerStrip::init () solo_led_table.set_spacings (0); solo_led_table.set_border_width (1); - solo_led_table.attach (*solo_isolated_led, 0, 1, 0, 1, Gtk::FILL, Gtk::FILL); - solo_led_table.attach (*iso_label, 1, 2, 0, 1, Gtk::FILL, Gtk::FILL); - solo_led_table.attach (*solo_safe_led, 0, 1, 1, 2, Gtk::FILL, Gtk::FILL); - solo_led_table.attach (*safe_label, 1, 2, 1, 2, Gtk::FILL, Gtk::FILL); + solo_led_table.attach (*iso_label, 0, 1, 0, 1, Gtk::FILL, Gtk::FILL); + solo_led_table.attach (*solo_isolated_led, 1, 2, 0, 1, Gtk::FILL, Gtk::FILL); + solo_led_table.attach (*safe_label, 0, 1, 1, 2, Gtk::FILL, Gtk::FILL); + solo_led_table.attach (*solo_safe_led, 1, 2, 1, 2, Gtk::FILL, Gtk::FILL); solo_led_table.show (); solo_led_box.pack_end (solo_led_table, false, false); diff --git a/gtk2_ardour/monitor_section.cc b/gtk2_ardour/monitor_section.cc index a5331a0c8e..5b60942bb1 100644 --- a/gtk2_ardour/monitor_section.cc +++ b/gtk2_ardour/monitor_section.cc @@ -51,6 +51,7 @@ MonitorSection::MonitorSection (Session* s) , dim_all_button (_("dim")) , mono_button (_("mono")) , rude_solo_button (_("soloing")) + , rude_iso_button (_("isolated")) , rude_audition_button (_("auditioning")) , exclusive_solo_button (_("Exclusive")) , solo_mute_override_button (_("Solo/Mute")) @@ -92,6 +93,9 @@ MonitorSection::MonitorSection (Session* s) rude_solo_button.set_name ("TransportSoloAlert"); rude_solo_button.show (); + rude_iso_button.set_name ("MonitorIsoAlert"); + rude_iso_button.show (); + rude_audition_button.set_name ("TransportAuditioningAlert"); rude_audition_button.show (); @@ -100,6 +104,9 @@ MonitorSection::MonitorSection (Session* s) rude_solo_button.signal_button_press_event().connect (sigc::mem_fun(*this, &MonitorSection::cancel_solo), false); UI::instance()->set_tip (rude_solo_button, _("When active, something is soloed.\nClick to de-solo everything")); + rude_iso_button.signal_button_press_event().connect (sigc::mem_fun(*this, &MonitorSection::cancel_isolate), false); + UI::instance()->set_tip (rude_iso_button, _("When active, something is solo-isolated.\nClick to de-isolate everything")); + rude_audition_button.signal_button_press_event().connect (sigc::mem_fun(*this, &MonitorSection::cancel_audition), false); UI::instance()->set_tip (rude_audition_button, _("When active, auditioning is active.\nClick to stop the audition")); @@ -182,7 +189,12 @@ MonitorSection::MonitorSection (Session* s) solo_opt_box->show (); upper_packer.set_spacing (12); - upper_packer.pack_start (rude_solo_button, false, false); + + Gtk::HBox* rude_box = manage (new HBox); + rude_box->pack_start (rude_solo_button, true, true); + rude_box->pack_start (rude_iso_button, true, true); + + upper_packer.pack_start (*rude_box, false, false); upper_packer.pack_start (rude_audition_button, false, false); upper_packer.pack_start (solo_model_box, false, false); upper_packer.pack_start (*solo_opt_box, false, false); @@ -306,12 +318,13 @@ MonitorSection::set_session (Session* s) _route.reset (); } - } else { /* no session */ _monitor.reset (); _route.reset (); control_connections.drop_connections (); + rude_iso_button.set_active (false); + rude_solo_button.set_active (false); } /* both might be null */ @@ -920,9 +933,15 @@ MonitorSection::solo_blink (bool onoff) } else { rude_solo_button.set_state (STATE_NORMAL); } + + if (_session->soloing()) { + rude_iso_button.set_active (_session->solo_isolated()); + } + } else { // rude_solo_button.set_active (false); rude_solo_button.set_state (STATE_NORMAL); + rude_iso_button.set_active (false); } } @@ -941,6 +960,17 @@ MonitorSection::cancel_solo (GdkEventButton* ev) } bool +MonitorSection::cancel_isolate (GdkEventButton* ev) +{ + if (_session) { + boost::shared_ptr<RouteList> rl (_session->get_routes ()); + _session->set_solo_isolated (rl, false, Session::rt_cleanup, true); + } + + return true; +} + +bool MonitorSection::cancel_audition (GdkEventButton* ev) { if (_session) { diff --git a/gtk2_ardour/monitor_section.h b/gtk2_ardour/monitor_section.h index d543ea1acd..b3edb624b9 100644 --- a/gtk2_ardour/monitor_section.h +++ b/gtk2_ardour/monitor_section.h @@ -115,6 +115,7 @@ class MonitorSection : public RouteUI BindableToggleButton dim_all_button; BindableToggleButton mono_button; BindableToggleButton rude_solo_button; + BindableToggleButton rude_iso_button; BindableToggleButton rude_audition_button; BindableToggleButton exclusive_solo_button; BindableToggleButton solo_mute_override_button; @@ -123,11 +124,13 @@ class MonitorSection : public RouteUI void solo_blink (bool); void audition_blink (bool); bool cancel_solo (GdkEventButton*); + bool cancel_isolate (GdkEventButton*); bool cancel_audition (GdkEventButton*); void solo_cut_changed (); void update_solo_model (); void parameter_changed (std::string); - + void isolated_changed (); + PBD::ScopedConnection config_connection; PBD::ScopedConnectionList control_connections; diff --git a/gtk2_ardour/route_ui.cc b/gtk2_ardour/route_ui.cc index 3bc36da091..58d5a721b5 100644 --- a/gtk2_ardour/route_ui.cc +++ b/gtk2_ardour/route_ui.cc @@ -1072,13 +1072,33 @@ RouteUI::muting_change () bool RouteUI::solo_isolate_button_release (GdkEventButton* ev) { + if (ev->type == GDK_2BUTTON_PRESS || ev->type == GDK_3BUTTON_PRESS) { + return true; + } + bool view = (solo_isolated_led->visual_state() != 0); bool model = _route->solo_isolated(); /* called BEFORE the view has changed */ - if (model == view) { - _route->set_solo_isolated (!view, this); + if (ev->button == 1) { + if (Keyboard::modifier_state_equals (ev->state, Keyboard::ModifierMask (Keyboard::PrimaryModifier|Keyboard::TertiaryModifier))) { + + if (model) { + /* disable isolate for all routes */ + _session->set_solo_isolated (_session->get_routes(), false, Session::rt_cleanup, true); + } + + } else { + if (model == view) { + + /* flip just this route */ + + boost::shared_ptr<RouteList> rl (new RouteList); + rl->push_back (_route); + _session->set_solo_isolated (rl, !view, Session::rt_cleanup, true); + } + } } return true; diff --git a/libs/ardour/ardour/session.h b/libs/ardour/ardour/session.h index b399745187..a321d1ffcc 100644 --- a/libs/ardour/ardour/session.h +++ b/libs/ardour/ardour/session.h @@ -583,6 +583,7 @@ class Session : public PBD::StatefulDestructible, public PBD::ScopedConnectionLi bool soloing() const { return _non_soloed_outs_muted; } bool listening() const { return _listen_cnt > 0; } + bool solo_isolated() const { return _solo_isolated_cnt > 0; } static const SessionEvent::RTeventCallback rt_cleanup; @@ -591,11 +592,12 @@ class Session : public PBD::StatefulDestructible, public PBD::ScopedConnectionLi void set_mute (boost::shared_ptr<RouteList>, bool, SessionEvent::RTeventCallback after = rt_cleanup, bool group_override = false); void set_listen (boost::shared_ptr<RouteList>, bool, SessionEvent::RTeventCallback after = rt_cleanup, bool group_override = false); void set_record_enable (boost::shared_ptr<RouteList>, bool, SessionEvent::RTeventCallback after = rt_cleanup, bool group_override = false); + void set_solo_isolated (boost::shared_ptr<RouteList>, bool, SessionEvent::RTeventCallback after = rt_cleanup, bool group_override = false); PBD::Signal1<void,bool> SoloActive; PBD::Signal0<void> SoloChanged; + PBD::Signal0<void> IsolatedChanged; - /* control/master out */ boost::shared_ptr<Route> monitor_out() const { return _monitor_out; } @@ -861,6 +863,7 @@ class Session : public PBD::StatefulDestructible, public PBD::ScopedConnectionLi float _meter_falloff; bool _non_soloed_outs_muted; uint32_t _listen_cnt; + uint32_t _solo_isolated_cnt; bool _writable; bool _was_seamless; @@ -1220,6 +1223,7 @@ class Session : public PBD::StatefulDestructible, public PBD::ScopedConnectionLi void route_listen_changed (void *src, boost::weak_ptr<Route>); void route_mute_changed (void *src); void route_solo_changed (bool self_solo_change, void *src, boost::weak_ptr<Route>); + void route_solo_isolated_changed (void *src, boost::weak_ptr<Route>); void update_route_solo_state (boost::shared_ptr<RouteList> r = boost::shared_ptr<RouteList>()); void listen_position_changed (); @@ -1437,6 +1441,7 @@ class Session : public PBD::StatefulDestructible, public PBD::ScopedConnectionLi void rt_set_just_one_solo (boost::shared_ptr<RouteList>, bool yn, bool /* ignored*/ ); void rt_set_mute (boost::shared_ptr<RouteList>, bool yn, bool group_override); void rt_set_listen (boost::shared_ptr<RouteList>, bool yn, bool group_override); + void rt_set_solo_isolated (boost::shared_ptr<RouteList>, bool yn, bool group_override); void rt_set_record_enable (boost::shared_ptr<RouteList>, bool yn, bool group_override); /** temporary list of Diskstreams used only during load of 2.X sessions */ diff --git a/libs/ardour/route.cc b/libs/ardour/route.cc index 48eeae7774..e5a4b01fd1 100644 --- a/libs/ardour/route.cc +++ b/libs/ardour/route.cc @@ -716,22 +716,27 @@ Route::set_solo_isolated (bool yn, void *src) /* XXX should we back-propagate as well? (April 2010: myself and chris goddard think not) */ + bool changed = false; + if (yn) { if (_solo_isolated == 0) { _mute_master->set_solo_ignore (true); + changed = true; } _solo_isolated++; - solo_isolated_changed (src); } else { if (_solo_isolated > 0) { _solo_isolated--; if (_solo_isolated == 0) { _mute_master->set_solo_ignore (false); + changed = true; } - solo_isolated_changed (src); } } + if (changed) { + solo_isolated_changed (src); + } } bool diff --git a/libs/ardour/session.cc b/libs/ardour/session.cc index 0b796a32bf..3e22150762 100644 --- a/libs/ardour/session.cc +++ b/libs/ardour/session.cc @@ -1993,6 +1993,7 @@ Session::add_routes (RouteList& new_routes, bool save) r->listen_changed.connect_same_thread (*this, boost::bind (&Session::route_listen_changed, this, _1, wpr)); r->solo_changed.connect_same_thread (*this, boost::bind (&Session::route_solo_changed, this, _1, _2, wpr)); + r->solo_isolated_changed.connect_same_thread (*this, boost::bind (&Session::route_solo_isolated_changed, this, _1, wpr)); r->mute_changed.connect_same_thread (*this, boost::bind (&Session::route_mute_changed, this, _1)); r->output()->changed.connect_same_thread (*this, boost::bind (&Session::set_worst_io_latencies_x, this, _1, _2)); r->processors_changed.connect_same_thread (*this, boost::bind (&Session::route_processors_changed, this, _1)); @@ -2161,14 +2162,13 @@ Session::remove_route (shared_ptr<Route> route) _monitor_out.reset (); } - update_route_solo_state (); - /* writer goes out of scope, forces route list update */ } - + + update_route_solo_state (); find_current_end (); - // We need to disconnect the routes inputs and outputs + // We need to disconnect the route's inputs and outputs route->input()->disconnect (0); route->output()->disconnect (0); @@ -2244,7 +2244,36 @@ Session::route_listen_changed (void* /*src*/, boost::weak_ptr<Route> wpr) _listen_cnt--; } } +void +Session::route_solo_isolated_changed (void* /*src*/, boost::weak_ptr<Route> wpr) +{ + boost::shared_ptr<Route> route = wpr.lock (); + if (!route) { + /* should not happen */ + error << string_compose (_("programming error: %1"), X_("invalid route weak ptr passed to route_solo_changed")) << endmsg; + return; + } + + bool send_changed = false; + + if (route->solo_isolated()) { + if (_solo_isolated_cnt == 0) { + send_changed = true; + } + _solo_isolated_cnt++; + } else if (_solo_isolated_cnt > 0) { + _solo_isolated_cnt--; + if (_solo_isolated_cnt == 0) { + send_changed = true; + } + } + + if (send_changed) { + IsolatedChanged (); /* EMIT SIGNAL */ + } +} + void Session::route_solo_changed (bool self_solo_change, void* /*src*/, boost::weak_ptr<Route> wpr) { @@ -2340,6 +2369,7 @@ Session::update_route_solo_state (boost::shared_ptr<RouteList> r) bool something_soloed = false; uint32_t listeners = 0; + uint32_t isolated = 0; if (!r) { r = routes.reader(); @@ -2348,7 +2378,6 @@ Session::update_route_solo_state (boost::shared_ptr<RouteList> r) for (RouteList::iterator i = r->begin(); i != r->end(); ++i) { if (!(*i)->is_master() && !(*i)->is_monitor() && !(*i)->is_hidden() && (*i)->self_soloed()) { something_soloed = true; - break; } if (!(*i)->is_hidden() && (*i)->listening()) { @@ -2358,6 +2387,10 @@ Session::update_route_solo_state (boost::shared_ptr<RouteList> r) (*i)->set_listen (false, this); } } + + if ((*i)->solo_isolated()) { + isolated++; + } } if (something_soloed != _non_soloed_outs_muted) { @@ -2365,8 +2398,11 @@ Session::update_route_solo_state (boost::shared_ptr<RouteList> r) SoloActive (_non_soloed_outs_muted); /* EMIT SIGNAL */ } - if (listeners) { - _listen_cnt = listeners; + _listen_cnt = listeners; + + if (isolated != _solo_isolated_cnt) { + _solo_isolated_cnt = isolated; + IsolatedChanged (); /* EMIT SIGNAL */ } } diff --git a/libs/ardour/session_rtevents.cc b/libs/ardour/session_rtevents.cc index 2befe47c16..921a6348eb 100644 --- a/libs/ardour/session_rtevents.cc +++ b/libs/ardour/session_rtevents.cc @@ -130,6 +130,24 @@ Session::rt_set_mute (boost::shared_ptr<RouteList> rl, bool yn, bool /*group_ove } void +Session::set_solo_isolated (boost::shared_ptr<RouteList> rl, bool yn, SessionEvent::RTeventCallback after, bool group_override) +{ + queue_event (get_rt_event (rl, yn, after, group_override, &Session::rt_set_solo_isolated)); +} + +void +Session::rt_set_solo_isolated (boost::shared_ptr<RouteList> rl, bool yn, bool /*group_override*/) +{ + for (RouteList::iterator i = rl->begin(); i != rl->end(); ++i) { + if (!(*i)->is_master() && !(*i)->is_monitor() && !(*i)->is_hidden()) { + (*i)->set_solo_isolated (yn, this); + } + } + + set_dirty(); +} + +void Session::set_record_enable (boost::shared_ptr<RouteList> rl, bool yn, SessionEvent::RTeventCallback after, bool group_override) { if (!writable()) { diff --git a/libs/ardour/session_state.cc b/libs/ardour/session_state.cc index ae2eda81d4..a0e61d547a 100644 --- a/libs/ardour/session_state.cc +++ b/libs/ardour/session_state.cc @@ -170,6 +170,7 @@ Session::first_stage_init (string fullpath, string snapshot_name) _non_soloed_outs_muted = false; _listen_cnt = 0; + _solo_isolated_cnt = 0; g_atomic_int_set (&processing_prohibited, 0); _transport_speed = 0; _last_transport_speed = 0; |