From 4f3f1d79baf0eb2d7c0a6d1e91a1dd9d35b679db Mon Sep 17 00:00:00 2001 From: nikolay Date: Mon, 15 Sep 2014 12:51:47 +0300 Subject: [PATCH] [Summary] Code improvement [Reviewed] GZharun --- gtk2_ardour/mixer_strip.cc | 16 +++++++--------- gtk2_ardour/route_time_axis.cc | 10 ++++------ 2 files changed, 11 insertions(+), 15 deletions(-) diff --git a/gtk2_ardour/mixer_strip.cc b/gtk2_ardour/mixer_strip.cc index 7ea4103f84..c30b38567c 100644 --- a/gtk2_ardour/mixer_strip.cc +++ b/gtk2_ardour/mixer_strip.cc @@ -261,6 +261,8 @@ MixerStrip::init () _session->engine().Running.connect (*this, invalidator (*this), boost::bind (&MixerStrip::engine_running, this), gui_context()); _session->RecordStateChanged.connect (*this, invalidator (*this), boost::bind (&MixerStrip::on_record_state_changed, this), gui_context()); + _session->session_routes_reconnected.connect(_input_output_channels_update, invalidator (*this), boost::bind (&MixerStrip::update_inspector_info_panel, this), gui_context()); + /* ditto for this button and busses */ name_button.signal_button_press_event().connect (sigc::mem_fun(*this, &MixerStrip::name_button_button_press), false); @@ -318,11 +320,7 @@ MixerStrip::init () /* note that this handler connects *before* the default handler */ _name_button_home.signal_button_press_event().connect (sigc::mem_fun (*this, &MixerStrip::controls_ebox_button_press)); _name_button_home.signal_button_release_event().connect (sigc::mem_fun (*this, &MixerStrip::controls_ebox_button_release)); - _name_entry.set_max_length(13); - - Session* session = ARDOUR_UI::instance()->the_session(); - if( session ) - session->session_routes_reconnected.connect(_input_output_channels_update, invalidator (*this), boost::bind (&MixerStrip::update_inspector_info_panel, this), gui_context()); + _name_entry.set_max_length(13); } MixerStrip::~MixerStrip () @@ -423,7 +421,7 @@ MixerStrip::begin_name_edit () if( _route->is_master () ) return; - if ( (ARDOUR_UI::instance()->the_session()->record_status()==Session::Recording) && (_route->record_enabled()) ) + if ( (_session->record_status()==Session::Recording) && (_route->record_enabled()) ) return; boost::shared_ptr audio_track = boost::dynamic_pointer_cast(_route); @@ -450,10 +448,10 @@ MixerStrip::route_rec_enable_changed () void MixerStrip::on_record_state_changed () { - if ( !ARDOUR_UI::instance()->the_session() ) + if ( !_session ) return; - if ( (ARDOUR_UI::instance()->the_session()->record_status()==Session::Recording) && (_route->record_enabled()) ) + if ( (_session->record_status()==Session::Recording) && (_route->record_enabled()) ) end_name_edit (RESPONSE_CANCEL); } @@ -1948,7 +1946,7 @@ MixerStrip::deselect_all_processors () bool MixerStrip::delete_processors () { - processor_box.processor_operation (ProcessorBox::ProcessorsDelete); + return processor_box.processor_operation (ProcessorBox::ProcessorsDelete); } void diff --git a/gtk2_ardour/route_time_axis.cc b/gtk2_ardour/route_time_axis.cc index 675c4d7abb..12aa3f63e9 100644 --- a/gtk2_ardour/route_time_axis.cc +++ b/gtk2_ardour/route_time_axis.cc @@ -2285,15 +2285,13 @@ RouteTimeAxisView::can_edit_name () const if( audio_track && audio_track->is_master_track() ) return false; - Session *session = ARDOUR_UI::instance()->the_session(); - - if (session == 0) { + if (_session == 0) { return false; } /* we do not allow track name changes if it is record enabled */ - return !( (session->record_status() == Session::Recording) && (_route->record_enabled()) ); + return !( (_session->record_status() == Session::Recording) && (_route->record_enabled()) ); } void @@ -2711,9 +2709,9 @@ RouteTimeAxisView::route_rec_enable_changed() void RouteTimeAxisView::on_record_state_changed () { - if ( !ARDOUR_UI::instance()->the_session() ) + if ( !_session ) return; - if ( (ARDOUR_UI::instance()->the_session()->record_status()==Session::Recording) && (_route->record_enabled()) ) + if ( (_session->record_status()==Session::Recording) && (_route->record_enabled()) ) end_name_edit (RESPONSE_CANCEL); }