2005-09-25 14:42:24 -04:00
/*
2019-08-02 17:26:43 -04:00
* Copyright ( C ) 2005 - 2007 Taybin Rutkin < taybin @ taybin . com >
* Copyright ( C ) 2005 - 2017 Paul Davis < paul @ linuxaudiosystems . com >
* Copyright ( C ) 2007 - 2011 Carl Hetherington < carl @ carlh . net >
* Copyright ( C ) 2007 - 2012 David Robillard < d @ drobilla . net >
* Copyright ( C ) 2013 - 2019 Robin Gareus < robin @ gareus . org >
*
* This program is free software ; you can redistribute it and / or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation ; either version 2 of the License , or
* ( at your option ) any later version .
*
* This program is distributed in the hope that it will be useful ,
* but WITHOUT ANY WARRANTY ; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE . See the
* GNU General Public License for more details .
*
* You should have received a copy of the GNU General Public License along
* with this program ; if not , write to the Free Software Foundation , Inc . ,
* 51 Franklin Street , Fifth Floor , Boston , MA 02110 - 1301 USA .
*/
2005-09-25 14:42:24 -04:00
# include <algorithm>
2007-06-27 18:06:35 -04:00
# include <inttypes.h>
2005-09-25 14:42:24 -04:00
2012-07-25 13:48:55 -04:00
# include <glibmm/threads.h>
2017-07-16 21:48:18 -04:00
# include <gtkmm/stock.h>
2005-09-25 14:42:24 -04:00
2011-10-28 11:35:09 -04:00
# include "ardour/audioengine.h"
2014-06-03 18:27:01 -04:00
# include "ardour/audio_track.h"
2009-02-25 13:26:51 -05:00
# include "ardour/plugin.h"
2009-05-07 13:31:18 -04:00
# include "ardour/plugin_insert.h"
2009-02-25 13:26:51 -05:00
# include "ardour/plugin_manager.h"
2009-05-07 13:31:18 -04:00
# include "ardour/port_insert.h"
# include "ardour/return.h"
2009-02-25 13:26:51 -05:00
# include "ardour/route.h"
# include "ardour/send.h"
2013-07-27 09:02:19 -04:00
# include "ardour/internal_send.h"
2005-09-25 14:42:24 -04:00
2017-07-16 21:48:18 -04:00
# include "gtkmm2ext/utils.h"
# include "gtkmm2ext/window_title.h"
2009-05-07 13:31:18 -04:00
# include "ardour_ui.h"
# include "gui_thread.h"
# include "io_selector.h"
2005-09-25 14:42:24 -04:00
# include "keyboard.h"
2019-05-24 18:12:55 -04:00
# include "mixer_ui.h"
2005-09-25 14:42:24 -04:00
# include "mixer_strip.h"
2010-08-31 10:16:29 -04:00
# include "port_insert_ui.h"
2005-09-25 14:42:24 -04:00
# include "plugin_selector.h"
# include "plugin_ui.h"
2009-05-07 13:31:18 -04:00
# include "return_ui.h"
# include "route_params_ui.h"
2005-09-25 14:42:24 -04:00
# include "send_ui.h"
2014-12-25 10:02:00 -05:00
# include "timers.h"
2005-09-25 14:42:24 -04:00
2016-07-14 14:44:52 -04:00
# include "pbd/i18n.h"
2005-09-25 14:42:24 -04:00
using namespace ARDOUR ;
2006-06-21 19:01:03 -04:00
using namespace PBD ;
2005-09-25 14:42:24 -04:00
using namespace Gtk ;
2007-03-18 12:45:43 -04:00
using namespace Gtkmm2ext ;
2005-09-25 14:42:24 -04:00
2007-03-13 12:17:29 -04:00
RouteParams_UI : : RouteParams_UI ( )
2017-05-05 07:31:49 -04:00
: ArdourWindow ( _ ( " Tracks and Busses " ) )
, track_menu ( 0 )
2005-09-25 14:42:24 -04:00
{
2009-07-12 20:26:28 -04:00
insert_box = 0 ;
2005-09-25 14:42:24 -04:00
_input_iosel = 0 ;
_output_iosel = 0 ;
2009-07-12 20:26:28 -04:00
_active_view = 0 ;
2007-06-27 18:06:35 -04:00
2005-09-25 14:42:24 -04:00
using namespace Notebook_Helpers ;
2017-09-18 14:45:56 -04:00
input_frame . set_shadow_type ( Gtk : : SHADOW_NONE ) ;
output_frame . set_shadow_type ( Gtk : : SHADOW_NONE ) ;
2007-06-27 18:06:35 -04:00
2005-09-25 14:42:24 -04:00
notebook . set_show_tabs ( true ) ;
notebook . set_show_border ( true ) ;
notebook . set_name ( " RouteParamNotebook " ) ;
2005-10-06 14:24:23 -04:00
// create the tree model
route_display_model = ListStore : : create ( route_display_columns ) ;
// setup the treeview
route_display . set_model ( route_display_model ) ;
2007-10-19 10:57:04 -04:00
route_display . append_column ( _ ( " Tracks/Busses " ) , route_display_columns . text ) ;
2005-10-06 14:24:23 -04:00
route_display . set_name ( X_ ( " RouteParamsListDisplay " ) ) ;
route_display . get_selection ( ) - > set_mode ( Gtk : : SELECTION_SINGLE ) ; // default
route_display . set_reorderable ( false ) ;
route_display . set_size_request ( 75 , - 1 ) ;
route_display . set_headers_visible ( true ) ;
route_display . set_headers_clickable ( true ) ;
2010-03-16 16:16:13 -04:00
dynamic_cast < Gtk : : CellRendererText * > ( route_display . get_column_cell_renderer ( 0 ) ) - > property_ellipsize ( ) = Pango : : ELLIPSIZE_START ;
2010-03-16 15:21:09 -04:00
2005-10-06 14:24:23 -04:00
route_select_scroller . add ( route_display ) ;
route_select_scroller . set_policy ( Gtk : : POLICY_NEVER , Gtk : : POLICY_AUTOMATIC ) ;
2017-09-18 14:45:56 -04:00
route_select_frame . set_name ( " RouteSelectBaseFrame " ) ;
route_select_frame . set_shadow_type ( Gtk : : SHADOW_IN ) ;
route_select_frame . add ( route_select_scroller ) ;
2005-09-25 14:42:24 -04:00
2017-09-18 14:45:56 -04:00
list_vpacker . pack_start ( route_select_frame , true , true ) ;
2009-10-14 12:10:01 -04:00
2017-09-18 14:45:56 -04:00
notebook . pages ( ) . push_back ( TabElem ( input_frame , _ ( " Inputs " ) ) ) ;
notebook . pages ( ) . push_back ( TabElem ( output_frame , _ ( " Outputs " ) ) ) ;
2009-07-12 20:26:28 -04:00
notebook . pages ( ) . push_back ( TabElem ( redir_hpane , _ ( " Plugins, Inserts & Sends " ) ) ) ;
2005-09-25 14:42:24 -04:00
notebook . set_name ( " InspectorNotebook " ) ;
2009-10-14 12:10:01 -04:00
2005-09-25 14:42:24 -04:00
title_label . set_name ( " RouteParamsTitleLabel " ) ;
update_title ( ) ;
2009-10-14 12:10:01 -04:00
2005-09-25 14:42:24 -04:00
// changeable area
2017-09-18 14:45:56 -04:00
route_param_frame . set_name ( " RouteParamsBaseFrame " ) ;
route_param_frame . set_shadow_type ( Gtk : : SHADOW_IN ) ;
2009-10-14 12:10:01 -04:00
2005-09-25 14:42:24 -04:00
route_hpacker . pack_start ( notebook , true , true ) ;
2009-10-14 12:10:01 -04:00
2005-09-25 14:42:24 -04:00
route_vpacker . pack_start ( title_label , false , false ) ;
route_vpacker . pack_start ( route_hpacker , true , true ) ;
2016-05-26 10:46:28 -04:00
list_hpane . add ( list_vpacker ) ;
list_hpane . add ( route_vpacker ) ;
2005-09-25 14:42:24 -04:00
2011-11-18 19:56:35 -05:00
add ( list_hpane ) ;
2009-10-14 12:10:01 -04:00
2005-09-25 14:42:24 -04:00
set_name ( " RouteParamsWindow " ) ;
set_default_size ( 620 , 370 ) ;
2010-08-16 20:28:20 -04:00
set_wmclass ( X_ ( " ardour_route_parameters " ) , PROGRAM_NAME ) ;
2005-09-25 14:42:24 -04:00
// events
2009-12-11 18:29:48 -05:00
route_display . get_selection ( ) - > signal_changed ( ) . connect ( sigc : : mem_fun ( * this , & RouteParams_UI : : route_selected ) ) ;
route_display . get_column ( 0 ) - > signal_clicked ( ) . connect ( sigc : : mem_fun ( * this , & RouteParams_UI : : show_track_menu ) ) ;
2005-09-25 14:42:24 -04:00
2005-09-25 16:33:00 -04:00
add_events ( Gdk : : KEY_PRESS_MASK | Gdk : : KEY_RELEASE_MASK | Gdk : : BUTTON_RELEASE_MASK ) ;
2009-10-14 12:10:01 -04:00
2013-07-10 07:16:42 -04:00
show_all ( ) ;
2005-09-25 14:42:24 -04:00
}
RouteParams_UI : : ~ RouteParams_UI ( )
{
2019-03-07 19:44:30 -05:00
delete track_menu ;
2005-09-25 14:42:24 -04:00
}
void
2023-04-07 17:33:13 -04:00
RouteParams_UI : : add_routes ( RouteList const & routes )
2005-09-25 14:42:24 -04:00
{
2023-04-07 17:33:13 -04:00
ENSURE_GUI_THREAD ( * this , & RouteParams_UI : : add_routes , routes ) ;
2009-10-14 12:10:01 -04:00
2023-04-07 17:33:13 -04:00
for ( auto const & route : routes ) {
2005-10-06 14:24:23 -04:00
2013-04-06 16:04:02 -04:00
if ( route - > is_auditioner ( ) ) {
2006-08-16 22:12:20 -04:00
return ;
}
2009-10-14 12:10:01 -04:00
2006-08-16 22:12:20 -04:00
TreeModel : : Row row = * ( route_display_model - > append ( ) ) ;
row [ route_display_columns . text ] = route - > name ( ) ;
row [ route_display_columns . route ] = route ;
2009-10-14 12:10:01 -04:00
2006-08-16 22:12:20 -04:00
//route_select_list.rows().back().select ();
2009-10-14 12:10:01 -04:00
2023-02-16 18:33:28 -05:00
route - > PropertyChanged . connect ( * this , invalidator ( * this ) , boost : : bind ( & RouteParams_UI : : route_property_changed , this , _1 , std : : weak_ptr < Route > ( route ) ) , gui_context ( ) ) ;
route - > DropReferences . connect ( * this , invalidator ( * this ) , boost : : bind ( & RouteParams_UI : : route_removed , this , std : : weak_ptr < Route > ( route ) ) , gui_context ( ) ) ;
2006-08-16 22:12:20 -04:00
}
2005-09-25 14:42:24 -04:00
}
void
2023-02-16 18:33:28 -05:00
RouteParams_UI : : route_property_changed ( const PropertyChange & what_changed , std : : weak_ptr < Route > wr )
2005-09-25 14:42:24 -04:00
{
2010-02-19 13:09:08 -05:00
if ( ! what_changed . contains ( ARDOUR : : Properties : : name ) ) {
return ;
}
2023-02-16 18:33:28 -05:00
std : : shared_ptr < Route > route ( wr . lock ( ) ) ;
2009-12-17 13:24:23 -05:00
2011-06-01 13:00:29 -04:00
if ( ! route ) {
2009-12-17 13:24:23 -05:00
return ;
}
ENSURE_GUI_THREAD ( * this , & RouteParams_UI : : route_name_changed , wr )
2005-09-25 14:42:24 -04:00
2005-10-06 14:24:23 -04:00
bool found = false ;
TreeModel : : Children rows = route_display_model - > children ( ) ;
for ( TreeModel : : Children : : iterator iter = rows . begin ( ) ; iter ! = rows . end ( ) ; + + iter ) {
2023-02-16 18:33:28 -05:00
std : : shared_ptr < Route > r = ( * iter ) [ route_display_columns . route ] ;
2006-07-27 12:52:14 -04:00
if ( r = = route ) {
2005-10-06 14:24:23 -04:00
( * iter ) [ route_display_columns . text ] = route - > name ( ) ;
found = true ;
break ;
}
2005-09-25 14:42:24 -04:00
}
2006-07-27 12:52:14 -04:00
if ( ! found ) {
2020-05-24 13:20:45 -04:00
error < < _ ( " Display list item for renamed track/bus was not found! " ) < < endmsg ;
2005-10-06 14:24:23 -04:00
}
2005-09-25 14:42:24 -04:00
if ( route = = _route ) {
track_input_label . set_text ( route - > name ( ) ) ;
update_title ( ) ;
}
}
2014-06-03 18:27:01 -04:00
void
RouteParams_UI : : map_frozen ( )
{
ENSURE_GUI_THREAD ( * this , & RouteParams_UI : : map_frozen )
2023-02-16 18:33:28 -05:00
std : : shared_ptr < AudioTrack > at = std : : dynamic_pointer_cast < AudioTrack > ( _route ) ;
2014-06-03 18:27:01 -04:00
if ( at & & insert_box ) {
switch ( at - > freeze_state ( ) ) {
case AudioTrack : : Frozen :
insert_box - > set_sensitive ( false ) ;
//hide_redirect_editors (); // TODO hide editor windows
break ;
default :
insert_box - > set_sensitive ( true ) ;
// XXX need some way, maybe, to retoggle redirect editors
break ;
}
}
}
2019-05-24 18:12:55 -04:00
PluginSelector *
RouteParams_UI : : plugin_selector ( ) {
return Mixer_UI : : instance ( ) - > plugin_selector ( ) ;
}
2005-09-25 14:42:24 -04:00
void
2007-06-27 16:23:48 -04:00
RouteParams_UI : : setup_processor_boxes ( )
2005-09-25 14:42:24 -04:00
{
2009-12-17 13:24:23 -05:00
if ( _session & & _route ) {
2005-09-25 14:42:24 -04:00
// just in case... shouldn't need this
2007-06-27 16:23:48 -04:00
cleanup_processor_boxes ( ) ;
2009-10-14 12:10:01 -04:00
2005-09-25 14:42:24 -04:00
// construct new redirect boxes
2017-05-05 07:31:49 -04:00
insert_box = new ProcessorBox ( _session , boost : : bind ( & RouteParams_UI : : plugin_selector , this ) , _p_selection , 0 ) ;
2009-10-22 13:17:34 -04:00
insert_box - > set_route ( _route ) ;
2009-07-12 20:26:28 -04:00
2023-02-16 18:33:28 -05:00
std : : shared_ptr < AudioTrack > at = std : : dynamic_pointer_cast < AudioTrack > ( _route ) ;
2014-06-03 18:27:01 -04:00
if ( at ) {
at - > FreezeChange . connect ( route_connections , invalidator ( * this ) , boost : : bind ( & RouteParams_UI : : map_frozen , this ) , gui_context ( ) ) ;
}
2016-05-26 10:46:28 -04:00
redir_hpane . add ( * insert_box ) ;
2009-07-12 20:26:28 -04:00
2014-07-24 23:49:33 -04:00
insert_box - > ProcessorSelected . connect ( sigc : : mem_fun ( * this , & RouteParams_UI : : redirect_selected ) ) ; //note: this indicates a double-click activation, not just a "selection"
2009-12-11 18:29:48 -05:00
insert_box - > ProcessorUnselected . connect ( sigc : : mem_fun ( * this , & RouteParams_UI : : redirect_selected ) ) ;
2009-07-12 20:26:28 -04:00
redir_hpane . show_all ( ) ;
2005-09-25 14:42:24 -04:00
}
}
void
2007-06-27 16:23:48 -04:00
RouteParams_UI : : cleanup_processor_boxes ( )
2005-09-25 14:42:24 -04:00
{
2009-07-12 20:26:28 -04:00
if ( insert_box ) {
redir_hpane . remove ( * insert_box ) ;
delete insert_box ;
insert_box = 0 ;
2005-09-25 14:42:24 -04:00
}
}
void
2019-04-08 16:14:09 -04:00
RouteParams_UI : : setup_io_selector ( )
2005-09-25 14:42:24 -04:00
{
2019-04-08 16:14:09 -04:00
cleanup_io_selector ( ) ;
2009-10-14 12:10:01 -04:00
2005-09-25 14:42:24 -04:00
// input
2009-12-17 13:24:23 -05:00
_input_iosel = new IOSelector ( this , _session , _route - > input ( ) ) ;
2009-01-12 20:15:19 -05:00
_input_iosel - > setup ( ) ;
2017-09-18 14:45:56 -04:00
input_frame . add ( * _input_iosel ) ;
input_frame . show_all ( ) ;
2009-10-14 12:10:01 -04:00
2005-09-25 14:42:24 -04:00
// output
2009-12-17 13:24:23 -05:00
_output_iosel = new IOSelector ( this , _session , _route - > output ( ) ) ;
2009-01-12 20:15:19 -05:00
_output_iosel - > setup ( ) ;
2017-09-18 14:45:56 -04:00
output_frame . add ( * _output_iosel ) ;
output_frame . show_all ( ) ;
2005-09-25 14:42:24 -04:00
}
void
2019-04-08 16:14:09 -04:00
RouteParams_UI : : cleanup_io_selector ( )
2005-09-25 14:42:24 -04:00
{
if ( _input_iosel ) {
_input_iosel - > Finished ( IOSelector : : Cancelled ) ;
2017-09-18 14:45:56 -04:00
input_frame . remove ( ) ;
2005-09-25 14:42:24 -04:00
delete _input_iosel ;
_input_iosel = 0 ;
}
if ( _output_iosel ) {
_output_iosel - > Finished ( IOSelector : : Cancelled ) ;
2017-09-18 14:45:56 -04:00
output_frame . remove ( ) ;
2005-09-25 14:42:24 -04:00
delete _output_iosel ;
_output_iosel = 0 ;
}
}
void
2009-07-12 20:26:28 -04:00
RouteParams_UI : : cleanup_view ( bool stopupdate )
2005-09-25 14:42:24 -04:00
{
2009-07-12 20:26:28 -04:00
if ( _active_view ) {
2019-04-13 11:48:27 -04:00
GenericPluginUI * plugui = 0 ;
2009-10-14 12:10:01 -04:00
2009-07-12 20:26:28 -04:00
if ( stopupdate & & ( plugui = dynamic_cast < GenericPluginUI * > ( _active_view ) ) ! = 0 ) {
2019-04-13 11:48:27 -04:00
plugui - > stop_updating ( 0 ) ;
2005-09-25 14:42:24 -04:00
}
2009-12-17 13:24:23 -05:00
_processor_going_away_connection . disconnect ( ) ;
2019-04-13 11:48:27 -04:00
redir_hpane . remove ( * _active_view ) ;
2009-07-12 20:26:28 -04:00
delete _active_view ;
_active_view = 0 ;
2005-09-25 14:42:24 -04:00
}
}
void
2023-02-16 18:33:28 -05:00
RouteParams_UI : : route_removed ( std : : weak_ptr < Route > wr )
2005-09-25 14:42:24 -04:00
{
2023-02-16 18:33:28 -05:00
std : : shared_ptr < Route > route ( wr . lock ( ) ) ;
2009-12-17 13:24:23 -05:00
2011-06-01 13:00:29 -04:00
if ( ! route ) {
2009-12-17 13:24:23 -05:00
return ;
}
2010-03-30 11:18:43 -04:00
ENSURE_GUI_THREAD ( * this , invalidator ( * this ) , & RouteParams_UI : : route_removed , wr )
2005-10-06 14:24:23 -04:00
TreeModel : : Children rows = route_display_model - > children ( ) ;
TreeModel : : Children : : iterator ri ;
for ( TreeModel : : Children : : iterator iter = rows . begin ( ) ; iter ! = rows . end ( ) ; + + iter ) {
2023-02-16 18:33:28 -05:00
std : : shared_ptr < Route > r = ( * iter ) [ route_display_columns . route ] ;
2006-07-27 12:52:14 -04:00
if ( r = = route ) {
2005-10-06 14:24:23 -04:00
route_display_model - > erase ( iter ) ;
break ;
}
2005-09-25 14:42:24 -04:00
}
2006-07-27 12:52:14 -04:00
if ( route = = _route ) {
2019-04-08 16:14:09 -04:00
cleanup_io_selector ( ) ;
2009-07-12 20:26:28 -04:00
cleanup_view ( ) ;
2007-06-27 16:23:48 -04:00
cleanup_processor_boxes ( ) ;
2009-10-14 12:10:01 -04:00
2006-07-27 12:52:14 -04:00
_route . reset ( ( Route * ) 0 ) ;
2009-07-12 20:26:28 -04:00
_processor . reset ( ( Processor * ) 0 ) ;
2005-09-25 14:42:24 -04:00
update_title ( ) ;
}
}
void
RouteParams_UI : : set_session ( Session * sess )
{
2011-11-18 19:56:35 -05:00
ArdourWindow : : set_session ( sess ) ;
2011-06-01 13:00:29 -04:00
2005-11-28 17:36:26 -05:00
route_display_model - > clear ( ) ;
2005-09-25 14:42:24 -04:00
2009-12-17 13:24:23 -05:00
if ( _session ) {
2023-04-07 17:33:13 -04:00
std : : shared_ptr < RouteList const > r = _session - > get_routes ( ) ;
2006-08-16 22:12:20 -04:00
add_routes ( * r ) ;
2012-04-25 08:58:19 -04:00
_session - > RouteAdded . connect ( _session_connections , invalidator ( * this ) , boost : : bind ( & RouteParams_UI : : add_routes , this , _1 ) , gui_context ( ) ) ;
2005-09-25 14:42:24 -04:00
}
2009-10-14 12:10:01 -04:00
}
2005-09-25 14:42:24 -04:00
void
2009-12-17 13:24:23 -05:00
RouteParams_UI : : session_going_away ( )
2005-09-25 14:42:24 -04:00
{
2009-12-17 13:24:23 -05:00
ENSURE_GUI_THREAD ( * this , & RouteParams_UI : : session_going_away ) ;
SessionHandlePtr : : session_going_away ( ) ;
2005-09-25 14:42:24 -04:00
2005-11-28 17:36:26 -05:00
route_display_model - > clear ( ) ;
2005-09-25 14:42:24 -04:00
2019-04-08 16:14:09 -04:00
cleanup_io_selector ( ) ;
2009-07-12 20:26:28 -04:00
cleanup_view ( ) ;
2007-06-27 16:23:48 -04:00
cleanup_processor_boxes ( ) ;
2005-09-25 14:42:24 -04:00
2006-07-27 12:52:14 -04:00
_route . reset ( ( Route * ) 0 ) ;
2009-07-12 20:26:28 -04:00
_processor . reset ( ( Processor * ) 0 ) ;
2005-09-25 14:42:24 -04:00
update_title ( ) ;
}
void
2005-10-06 14:24:23 -04:00
RouteParams_UI : : route_selected ( )
2005-09-25 14:42:24 -04:00
{
2005-10-06 14:24:23 -04:00
Glib : : RefPtr < TreeSelection > selection = route_display . get_selection ( ) ;
TreeModel : : iterator iter = selection - > get_selected ( ) ; // only used with Gtk::SELECTION_SINGLE
2007-06-27 18:06:35 -04:00
2005-10-06 14:24:23 -04:00
if ( iter ) {
//If anything is selected
2023-02-16 18:33:28 -05:00
std : : shared_ptr < Route > route = ( * iter ) [ route_display_columns . route ] ;
2005-09-25 14:42:24 -04:00
if ( _route = = route ) {
// do nothing
return ;
}
2005-10-06 14:24:23 -04:00
2005-09-25 14:42:24 -04:00
// remove event binding from previously selected
if ( _route ) {
2009-12-17 13:24:23 -05:00
_route_processors_connection . disconnect ( ) ;
2007-06-27 16:23:48 -04:00
cleanup_processor_boxes ( ) ;
2009-07-12 20:26:28 -04:00
cleanup_view ( ) ;
2019-04-08 16:14:09 -04:00
cleanup_io_selector ( ) ;
2005-09-25 14:42:24 -04:00
}
2005-10-06 14:24:23 -04:00
2005-09-25 14:42:24 -04:00
// update the other panes with the correct info
_route = route ;
//update_routeinfo (route);
2019-04-08 16:14:09 -04:00
setup_io_selector ( ) ;
2007-06-27 16:23:48 -04:00
setup_processor_boxes ( ) ;
2005-10-06 14:24:23 -04:00
2012-04-25 08:58:19 -04:00
route - > processors_changed . connect ( _route_processors_connection , invalidator ( * this ) , boost : : bind ( & RouteParams_UI : : processors_changed , this , _1 ) , gui_context ( ) ) ;
2011-06-01 13:00:29 -04:00
2005-09-25 14:42:24 -04:00
track_input_label . set_text ( _route - > name ( ) ) ;
2005-10-06 14:24:23 -04:00
2005-09-25 14:42:24 -04:00
update_title ( ) ;
2007-06-27 18:06:35 -04:00
2005-10-06 14:24:23 -04:00
} else {
// no selection
if ( _route ) {
2009-12-17 13:24:23 -05:00
_route_processors_connection . disconnect ( ) ;
2005-10-06 14:24:23 -04:00
// remove from view
2019-04-08 16:14:09 -04:00
cleanup_io_selector ( ) ;
2009-07-12 20:26:28 -04:00
cleanup_view ( ) ;
2007-06-27 16:23:48 -04:00
cleanup_processor_boxes ( ) ;
2005-10-06 14:24:23 -04:00
2006-07-27 12:52:14 -04:00
_route . reset ( ( Route * ) 0 ) ;
2009-07-12 20:26:28 -04:00
_processor . reset ( ( Processor * ) 0 ) ;
2005-10-06 14:24:23 -04:00
track_input_label . set_text ( _ ( " NO TRACK " ) ) ;
update_title ( ) ;
}
2005-09-25 14:42:24 -04:00
}
}
void
2010-09-02 13:01:36 -04:00
RouteParams_UI : : processors_changed ( RouteProcessorChange )
2005-09-25 14:42:24 -04:00
{
2009-07-12 20:26:28 -04:00
cleanup_view ( ) ;
2009-10-14 12:10:01 -04:00
2009-07-12 20:26:28 -04:00
_processor . reset ( ( Processor * ) 0 ) ;
2007-06-27 18:06:35 -04:00
2005-09-25 14:42:24 -04:00
//update_title();
}
void
2005-10-06 14:24:23 -04:00
RouteParams_UI : : show_track_menu ( )
2005-09-25 14:42:24 -04:00
{
using namespace Menu_Helpers ;
2009-10-14 12:10:01 -04:00
2005-09-25 14:42:24 -04:00
if ( track_menu = = 0 ) {
track_menu = new Menu ;
track_menu - > set_name ( " ArdourContextMenu " ) ;
2016-04-23 11:55:58 -04:00
track_menu - > items ( ) . push_back ( MenuElem ( _ ( " Add Track or Bus " ) , sigc : : mem_fun ( * ( ARDOUR_UI : : instance ( ) ) , & ARDOUR_UI : : add_route ) ) ) ;
2005-09-25 14:42:24 -04:00
}
2006-11-21 19:58:22 -05:00
track_menu - > popup ( 1 , gtk_get_current_event_time ( ) ) ;
2005-09-25 14:42:24 -04:00
}
void
2023-02-16 18:33:28 -05:00
RouteParams_UI : : redirect_selected ( std : : shared_ptr < ARDOUR : : Processor > proc )
2005-09-25 14:42:24 -04:00
{
2023-02-16 18:33:28 -05:00
std : : shared_ptr < Send > send ;
std : : shared_ptr < Return > retrn ;
std : : shared_ptr < PluginInsert > plugin_insert ;
std : : shared_ptr < PortInsert > port_insert ;
2009-10-14 12:10:01 -04:00
2023-02-16 18:33:28 -05:00
if ( ( std : : dynamic_pointer_cast < InternalSend > ( proc ) ) ! = 0 ) {
2013-07-27 09:02:19 -04:00
cleanup_view ( ) ;
_processor . reset ( ( Processor * ) 0 ) ;
update_title ( ) ;
return ;
2023-02-16 18:33:28 -05:00
} else if ( ( send = std : : dynamic_pointer_cast < Send > ( proc ) ) ! = 0 ) {
2005-09-25 14:42:24 -04:00
2022-10-11 00:10:14 -04:00
SendUI * send_ui = new SendUI ( this , _session , send ) ;
2005-09-25 14:42:24 -04:00
2009-07-12 20:26:28 -04:00
cleanup_view ( ) ;
2023-02-16 18:33:28 -05:00
send - > DropReferences . connect ( _processor_going_away_connection , invalidator ( * this ) , boost : : bind ( & RouteParams_UI : : processor_going_away , this , std : : weak_ptr < Processor > ( proc ) ) , gui_context ( ) ) ;
2009-07-12 20:26:28 -04:00
_active_view = send_ui ;
2009-10-14 12:10:01 -04:00
2016-05-26 10:46:28 -04:00
redir_hpane . add ( * _active_view ) ;
2009-07-12 20:26:28 -04:00
redir_hpane . show_all ( ) ;
2009-05-07 13:31:18 -04:00
2023-02-16 18:33:28 -05:00
} else if ( ( retrn = std : : dynamic_pointer_cast < Return > ( proc ) ) ! = 0 ) {
2009-05-07 13:31:18 -04:00
2009-12-17 13:24:23 -05:00
ReturnUI * return_ui = new ReturnUI ( this , retrn , _session ) ;
2009-05-07 13:31:18 -04:00
2009-07-12 20:26:28 -04:00
cleanup_view ( ) ;
2023-02-16 18:33:28 -05:00
retrn - > DropReferences . connect ( _processor_going_away_connection , invalidator ( * this ) , boost : : bind ( & RouteParams_UI : : processor_going_away , this , std : : weak_ptr < Processor > ( proc ) ) , gui_context ( ) ) ;
2009-07-12 20:26:28 -04:00
_active_view = return_ui ;
2009-10-14 12:10:01 -04:00
2016-05-26 10:46:28 -04:00
redir_hpane . add ( * _active_view ) ;
2009-07-12 20:26:28 -04:00
redir_hpane . show_all ( ) ;
2009-05-07 13:31:18 -04:00
2023-02-16 18:33:28 -05:00
} else if ( ( plugin_insert = std : : dynamic_pointer_cast < PluginInsert > ( proc ) ) ! = 0 ) {
2005-09-25 14:42:24 -04:00
2008-01-10 16:20:59 -05:00
GenericPluginUI * plugin_ui = new GenericPluginUI ( plugin_insert , true ) ;
2005-09-25 14:42:24 -04:00
2009-07-12 20:26:28 -04:00
cleanup_view ( ) ;
2010-03-30 11:18:43 -04:00
plugin_insert - > plugin ( ) - > DropReferences . connect ( _processor_going_away_connection , invalidator ( * this ) , boost : : bind ( & RouteParams_UI : : plugin_going_away , this , PreFader ) , gui_context ( ) ) ;
2009-07-12 20:26:28 -04:00
plugin_ui - > start_updating ( 0 ) ;
_active_view = plugin_ui ;
2009-12-19 15:26:31 -05:00
2016-05-26 10:46:28 -04:00
redir_hpane . add ( * _active_view ) ;
2009-07-12 20:26:28 -04:00
redir_hpane . show_all ( ) ;
2005-09-25 14:42:24 -04:00
2023-02-16 18:33:28 -05:00
} else if ( ( port_insert = std : : dynamic_pointer_cast < PortInsert > ( proc ) ) ! = 0 ) {
2005-09-25 14:42:24 -04:00
2009-12-17 13:24:23 -05:00
PortInsertUI * portinsert_ui = new PortInsertUI ( this , _session , port_insert ) ;
2009-10-14 12:10:01 -04:00
2009-07-12 20:26:28 -04:00
cleanup_view ( ) ;
2023-02-16 18:33:28 -05:00
port_insert - > DropReferences . connect ( _processor_going_away_connection , invalidator ( * this ) , boost : : bind ( & RouteParams_UI : : processor_going_away , this , std : : weak_ptr < Processor > ( proc ) ) , gui_context ( ) ) ;
2009-07-12 20:26:28 -04:00
_active_view = portinsert_ui ;
2009-12-19 15:26:31 -05:00
2016-05-26 10:46:28 -04:00
redir_hpane . add ( * _active_view ) ;
2009-07-12 20:26:28 -04:00
redir_hpane . show_all ( ) ;
2005-09-25 14:42:24 -04:00
}
2009-10-14 12:10:01 -04:00
2009-12-17 13:24:23 -05:00
_processor = proc ;
2005-09-25 14:42:24 -04:00
update_title ( ) ;
2009-10-14 12:10:01 -04:00
2005-09-25 14:42:24 -04:00
}
void
2006-08-24 21:07:15 -04:00
RouteParams_UI : : plugin_going_away ( Placement place )
2005-09-25 14:42:24 -04:00
{
2009-12-11 18:29:48 -05:00
ENSURE_GUI_THREAD ( * this , & RouteParams_UI : : plugin_going_away , place )
2009-10-14 12:10:01 -04:00
2005-09-25 14:42:24 -04:00
// delete the current view without calling finish
if ( place = = PreFader ) {
2009-07-12 20:26:28 -04:00
cleanup_view ( false ) ;
_processor . reset ( ( Processor * ) 0 ) ;
2005-09-25 14:42:24 -04:00
}
}
void
2023-02-16 18:33:28 -05:00
RouteParams_UI : : processor_going_away ( std : : weak_ptr < ARDOUR : : Processor > wproc )
2005-09-25 14:42:24 -04:00
{
2023-02-16 18:33:28 -05:00
std : : shared_ptr < Processor > proc = ( wproc . lock ( ) ) ;
2009-12-17 13:24:23 -05:00
if ( ! proc ) {
return ;
}
ENSURE_GUI_THREAD ( * this , & RouteParams_UI : : processor_going_away , wproc )
2009-10-14 12:10:01 -04:00
2005-09-25 14:42:24 -04:00
printf ( " redirect going away \n " ) ;
// delete the current view without calling finish
2009-12-17 13:24:23 -05:00
if ( proc = = _processor ) {
2009-07-12 20:26:28 -04:00
cleanup_view ( false ) ;
_processor . reset ( ( Processor * ) 0 ) ;
2009-10-14 12:10:01 -04:00
}
2005-09-25 14:42:24 -04:00
}
void
RouteParams_UI : : update_title ( )
{
2010-05-02 19:54:25 -04:00
WindowTitle title ( _ ( " Tracks and Busses " ) ) ;
2007-03-18 12:45:43 -04:00
if ( _route ) {
title_label . set_text ( _route - > name ( ) ) ;
title + = _route - > name ( ) ;
set_title ( title . get_string ( ) ) ;
2010-05-02 19:54:25 -04:00
} else {
title_label . set_text ( _ ( " No Track or Bus Selected " ) ) ;
title + = _ ( " No Track or Bus Selected " ) ;
2007-03-18 12:45:43 -04:00
set_title ( title . get_string ( ) ) ;
2009-10-14 12:10:01 -04:00
}
2005-09-25 14:42:24 -04:00
}