2005-09-25 14:42:24 -04:00
/*
2019-08-02 17:26:43 -04:00
* Copyright ( C ) 2005 - 2006 Taybin Rutkin < taybin @ taybin . com >
* Copyright ( C ) 2005 - 2018 Paul Davis < paul @ linuxaudiosystems . com >
* Copyright ( C ) 2005 Karsten Wiese < fzuuzf @ googlemail . com >
* Copyright ( C ) 2006 - 2015 David Robillard < d @ drobilla . net >
* Copyright ( C ) 2008 - 2012 Carl Hetherington < carl @ carlh . net >
* Copyright ( C ) 2009 Sampo Savolainen < v2 @ iki . fi >
* Copyright ( C ) 2012 - 2015 Tim Mayberry < mojofunk @ gmail . com >
* Copyright ( C ) 2013 - 2015 Nick Mainsbridge < mainsbridge @ gmail . com >
* Copyright ( C ) 2013 - 2019 Robin Gareus < robin @ gareus . org >
* Copyright ( C ) 2014 - 2017 Ben Loftis < ben @ harrisonconsoles . com >
* Copyright ( C ) 2015 André Nusser < andre . nusser @ googlemail . com >
* Copyright ( C ) 2017 Johannes Mueller < github @ johannes - mueller . 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
2016-11-09 22:54:03 -05:00
# include <map>
2015-12-21 12:54:34 -05:00
# include <boost/algorithm/string.hpp>
2017-07-16 21:48:18 -04:00
# include <gtkmm/stock.h>
2005-09-25 14:42:24 -04:00
2009-02-25 13:26:51 -05:00
# include "pbd/controllable.h"
2009-11-18 08:25:13 -05:00
# include "pbd/enumwriter.h"
2005-09-25 14:42:24 -04:00
2016-03-02 12:12:18 -05:00
# include "ardour/dB.h"
# include "ardour/route_group.h"
2016-04-08 16:49:47 -04:00
# include "ardour/solo_isolate_control.h"
2016-03-02 12:12:18 -05:00
# include "ardour/vca.h"
# include "ardour/vca_manager.h"
2016-04-08 16:49:47 -04:00
# include "ardour/audio_track.h"
2016-11-09 22:54:03 -05:00
# include "ardour/audio_port.h"
2016-04-08 16:49:47 -04:00
# include "ardour/audioengine.h"
# include "ardour/filename_extensions.h"
# include "ardour/midi_track.h"
# include "ardour/monitor_control.h"
# include "ardour/internal_send.h"
2016-11-09 22:54:03 -05:00
# include "ardour/panner_shell.h"
2020-02-18 21:15:05 -05:00
# include "ardour/polarity_processor.h"
2016-04-08 16:49:47 -04:00
# include "ardour/profile.h"
# include "ardour/phase_control.h"
# include "ardour/send.h"
# include "ardour/route.h"
2023-07-31 15:36:25 -04:00
# include "ardour/selection.h"
2016-04-08 16:49:47 -04:00
# include "ardour/session.h"
2021-01-25 17:52:39 -05:00
# include "ardour/session_playlists.h"
2021-02-04 18:36:34 -05:00
# include "ardour/solo_mute_release.h"
2016-04-08 16:49:47 -04:00
# include "ardour/template_utils.h"
2016-03-02 12:12:18 -05:00
2022-08-10 23:11:52 -04:00
# include "gtkmm2ext/colors.h"
2017-07-16 21:48:18 -04:00
# include "gtkmm2ext/gtk_ui.h"
# include "gtkmm2ext/doi.h"
# include "gtkmm2ext/utils.h"
# include "widgets/ardour_button.h"
# include "widgets/binding_proxy.h"
2017-07-16 23:18:48 -04:00
# include "widgets/prompter.h"
2017-07-15 11:38:28 -04:00
2009-05-17 13:05:56 -04:00
# include "ardour_ui.h"
2009-06-17 21:48:11 -04:00
# include "editor.h"
2016-06-08 21:17:44 -04:00
# include "group_tabs.h"
# include "gui_object.h"
2005-09-25 14:42:24 -04:00
# include "gui_thread.h"
2016-06-08 21:17:44 -04:00
# include "keyboard.h"
2009-05-16 22:08:13 -04:00
# include "mixer_strip.h"
2020-03-23 16:13:39 -04:00
# include "mixer_ui.h"
2017-09-09 12:25:36 -04:00
# include "patch_change_widget.h"
2021-01-25 17:52:39 -05:00
# include "playlist_selector.h"
2016-06-08 21:17:44 -04:00
# include "plugin_pin_dialog.h"
2016-06-09 15:35:56 -04:00
# include "rgb_macros.h"
2009-11-19 12:06:00 -05:00
# include "route_time_axis.h"
2016-06-08 21:17:44 -04:00
# include "route_ui.h"
2017-08-19 07:49:33 -04:00
# include "save_template_dialog.h"
2014-12-25 10:02:00 -05:00
# include "timers.h"
2015-01-02 09:44:54 -05:00
# include "ui_config.h"
2005-09-25 14:42:24 -04:00
2016-07-14 14:44:52 -04:00
# include "pbd/i18n.h"
2017-07-16 21:48:18 -04:00
2005-09-25 14:42:24 -04:00
using namespace Gtk ;
2005-09-25 16:33:00 -04:00
using namespace Gtkmm2ext ;
2005-09-25 14:42:24 -04:00
using namespace ARDOUR ;
2014-06-25 15:27:37 -04:00
using namespace ARDOUR_UI_UTILS ;
2017-07-15 11:38:28 -04:00
using namespace ArdourWidgets ;
Large nasty commit in the form of a 5000 line patch chock-full of completely
unecessary changes. (Sorry, doing a "sprint" based thing, this is the end of the first one)
Achieved MIDI track and bus creation, associated Jack port and diskstream creation, and minimal GUI stuff for creating them. Should be set to start work on actually recording and playing midi to/from disk now.
Relevant (significant) changes:
- Creation of a Buffer class. Base class is type agnostic so things can point to a buffer but not care what kind it is (otherwise it'd be a template). Derived into AudioBuffer and MidiBuffer, with a type tag because checking type is necessary in parts of the code where dynamic_cast wouldn't be wise. Originally I considered this a hack, but passing around a type proved to be a very good solution to all the other problems (below). There is a 1:1 mapping between jack port data types and ardour Buffer types (with a conversion function), but that's easily removed if it ever becomes necessary. Having the type scoped in the Buffer class is maybe not the best spot for it, but whatever (this is proof of concept kinda stuff right now...)
- IO now has a "default" port type (passed to the constructor and stored as a member), used by ensure_io (and similar) to create n ports. IO::register_***_port has a type argument that defaults to the default type if not passed. Rationale: previous IO API is identical, no changes needed to existing code, but path is paved for multiple port types in one IO, which we will need for eg synth plugin inserts, among other things. This is not quite ideal (best would be to only have the two port register functions and have them take a type), but the alternative is a lot of work (namely destroying the 'ensure' functions and everything that uses them) for very little gain. (I am convinced after quite a few tries at the whiteboard that subclassing IO in any way is not a feasible option, look at it's inheritance diagram in Doxygen and you can see why)
- AudioEngine::register_audio_input_port is now register_input_port and takes a type argument. Ditto for output.
- (Most significant change) AudioDiskstream abstracted into Distream, and sibling MidiDiskstream created. Very much still a work in progress, but Diskstream is there to switch references over to (most already are), which is the important part. It is still unclear what the MIDI diskstream's relation to channels is, but I'm pretty sure they will be single channel only (so SMF Type 0) since noone can come up with a reason otherwise.
- MidiTrack creation. Same thing as AudioTrack but with a different default type basically. No big deal here.
- Random cleanups and variable renamings etc. because I have OCD and can't help myself. :)
Known broken: Loading of sessions containing MIDI tracks.
git-svn-id: svn://localhost/ardour2/branches/midi@641 d708f5d6-7413-0410-9779-e7cbd77b26cf
2006-06-26 12:01:34 -04:00
using namespace PBD ;
2014-11-30 18:27:04 -05:00
using namespace std ;
2005-09-25 14:42:24 -04:00
2010-09-16 16:12:30 -04:00
uint32_t RouteUI : : _max_invert_buttons = 3 ;
2023-02-16 18:33:28 -05:00
PBD : : Signal1 < void , std : : shared_ptr < Route > > RouteUI : : BusSendDisplayChanged ;
std : : weak_ptr < Route > RouteUI : : _showing_sends_to ;
2015-12-21 12:54:34 -05:00
std : : string RouteUI : : program_port_prefix ;
2010-08-13 17:33:01 -04:00
2021-01-28 20:36:03 -05:00
RouteUI : : IOSelectorMap RouteUI : : input_selectors ;
RouteUI : : IOSelectorMap RouteUI : : output_selectors ;
2022-07-14 10:36:56 -04:00
# define GROUP_ACTION (Config->get_group_override_inverts () ? Controllable::InverseGroup : Controllable::NoGroup)
2021-01-28 20:36:03 -05:00
void
2023-02-16 18:33:28 -05:00
RouteUI : : delete_ioselector ( IOSelectorMap & m , std : : shared_ptr < ARDOUR : : Route > r )
2021-01-28 20:36:03 -05:00
{
if ( ! r ) {
return ;
}
2021-01-30 09:05:31 -05:00
IOSelectorMap : : iterator i = m . find ( r - > id ( ) ) ;
2021-01-28 20:36:03 -05:00
if ( i ! = m . end ( ) ) {
delete i - > second ;
m . erase ( i ) ;
}
}
2009-12-17 13:24:23 -05:00
RouteUI : : RouteUI ( ARDOUR : : Session * sess )
2016-07-25 11:38:59 -04:00
: monitor_input_button ( 0 )
, monitor_disk_button ( 0 )
, mute_menu ( 0 )
2013-07-23 07:30:23 -04:00
, solo_menu ( 0 )
, sends_menu ( 0 )
2021-01-25 17:52:39 -05:00
, playlist_action_menu ( 0 )
2021-06-11 17:23:37 -04:00
, _playlist_selector ( 0 )
2021-03-27 12:44:34 -04:00
, _record_menu ( 0 )
, _comment_window ( 0 )
, _comment_area ( 0 )
2013-07-23 07:30:23 -04:00
, _invert_menu ( 0 )
2008-12-08 11:07:28 -05:00
{
2015-12-21 12:54:34 -05:00
if ( program_port_prefix . empty ( ) ) {
// compare to gtk2_ardour/port_group.cc
string lpn ( PROGRAM_NAME ) ;
boost : : to_lower ( lpn ) ;
program_port_prefix = lpn + " : " ; // e.g. "ardour:"
}
2016-06-05 15:55:19 -04:00
if ( sess ) {
2021-09-19 22:21:21 -04:00
assert ( _session ) ;
2016-06-05 15:55:19 -04:00
init ( ) ;
}
2008-12-08 11:07:28 -05:00
}
RouteUI : : ~ RouteUI ( )
{
2015-04-01 11:58:20 -04:00
if ( _route ) {
2016-06-05 15:56:35 -04:00
ARDOUR_UI : : instance ( ) - > gui_object_state - > remove_node ( route_state_id ( ) ) ;
2015-04-01 11:58:20 -04:00
}
2015-03-30 15:27:18 -04:00
2017-09-09 12:25:36 -04:00
delete_patch_change_dialog ( ) ;
2021-01-28 20:36:03 -05:00
delete_ioselector ( input_selectors , _route ) ;
delete_ioselector ( output_selectors , _route ) ;
2009-12-25 16:06:52 -05:00
_route . reset ( ) ; /* drop reference to route, so that it can be cleaned up */
route_connections . drop_connections ( ) ;
2015-10-04 14:51:05 -04:00
2008-12-08 11:07:28 -05:00
delete solo_menu ;
delete mute_menu ;
2009-05-16 22:08:13 -04:00
delete sends_menu ;
2016-07-25 11:38:59 -04:00
delete monitor_input_button ;
delete monitor_disk_button ;
2021-01-25 17:52:39 -05:00
delete playlist_action_menu ;
2021-03-27 12:44:34 -04:00
delete _record_menu ;
delete _comment_window ;
2014-08-14 11:42:48 -04:00
delete _invert_menu ;
2021-06-07 20:19:09 -04:00
delete _playlist_selector ;
2015-10-05 10:17:49 -04:00
2014-08-22 12:45:34 -04:00
send_blink_connection . disconnect ( ) ;
rec_blink_connection . disconnect ( ) ;
2008-12-08 11:07:28 -05:00
}
void
RouteUI : : init ( )
2005-09-25 14:42:24 -04:00
{
2009-04-15 14:04:23 -04:00
self_destruct = true ;
2021-06-07 20:19:09 -04:00
_playlist_selector = 0 ;
2005-09-25 14:42:24 -04:00
mute_menu = 0 ;
solo_menu = 0 ;
2009-05-16 22:08:13 -04:00
sends_menu = 0 ;
2021-03-27 12:44:34 -04:00
_record_menu = 0 ;
2010-08-13 17:33:01 -04:00
_invert_menu = 0 ;
2009-11-18 08:25:13 -05:00
pre_fader_mute_check = 0 ;
post_fader_mute_check = 0 ;
listen_mute_check = 0 ;
main_mute_check = 0 ;
2016-05-24 15:30:33 -04:00
solo_safe_check = 0 ;
solo_isolated_check = 0 ;
solo_isolated_led = 0 ;
solo_safe_led = 0 ;
2009-12-10 12:45:18 -05:00
_solo_release = 0 ;
_mute_release = 0 ;
2007-05-31 22:27:21 -04:00
denormal_menu_item = 0 ;
2021-03-27 12:44:34 -04:00
_step_edit_item = 0 ;
_rec_safe_item = 0 ;
_ignore_comment_edit = false ;
2010-08-13 17:33:01 -04:00
_i_am_the_modifier = 0 ;
2020-03-06 20:22:09 -05:00
_n_polarity_invert = 0 ;
2005-09-25 14:42:24 -04:00
2010-08-13 17:33:01 -04:00
setup_invert_buttons ( ) ;
2010-03-30 13:44:02 -04:00
2011-11-02 12:46:49 -04:00
mute_button = manage ( new ArdourButton ) ;
mute_button - > set_name ( " mute button " ) ;
2022-06-17 09:04:47 -04:00
std : : string tip = string_compose ( _ ( " Mute this track \n "
2022-06-21 13:51:14 -04:00
" %2+Click to Override Group \n "
2022-06-17 09:04:47 -04:00
" %1+%3+Click to toggle ALL tracks \n "
" %4 for Momentary mute \n "
" Right-Click for Context menu " )
2022-06-21 13:51:14 -04:00
, Keyboard : : primary_modifier_short_name ( ) , Keyboard : : group_override_event_name ( ) , Keyboard : : tertiary_modifier_short_name ( ) , Keyboard : : momentary_push_name ( ) ) ;
2022-06-17 09:04:47 -04:00
UI : : instance ( ) - > set_tip ( mute_button , tip . c_str ( ) , " " ) ;
2008-12-08 11:07:28 -05:00
2011-11-02 14:48:32 -04:00
solo_button = manage ( new ArdourButton ) ;
2011-11-02 12:46:49 -04:00
solo_button - > set_name ( " solo button " ) ;
2009-06-11 09:22:42 -04:00
solo_button - > set_no_show_all ( true ) ;
2008-12-08 11:07:28 -05:00
2011-11-02 15:51:59 -04:00
rec_enable_button = manage ( new ArdourButton ) ;
2011-11-02 12:46:49 -04:00
rec_enable_button - > set_name ( " record enable button " ) ;
2015-05-24 15:45:39 -04:00
rec_enable_button - > set_icon ( ArdourIcon : : RecButton ) ;
2022-06-17 09:04:47 -04:00
tip = string_compose ( _ ( " Enable Recording on this track \n "
2022-06-21 13:51:14 -04:00
" %2+Click to Override group \n "
2022-06-17 09:04:47 -04:00
" %1+%3+Click to toggle ALL tracks \n "
" Right-Click for Context menu " )
2022-06-21 13:51:14 -04:00
, Keyboard : : primary_modifier_short_name ( ) , Keyboard : : group_override_event_name ( ) , Keyboard : : tertiary_modifier_short_name ( ) , Keyboard : : momentary_push_name ( ) ) ;
2022-06-17 09:04:47 -04:00
UI : : instance ( ) - > set_tip ( rec_enable_button , tip . c_str ( ) , " " ) ;
2008-12-12 09:43:24 -05:00
2015-01-02 09:44:54 -05:00
if ( UIConfiguration : : instance ( ) . get_blink_rec_arm ( ) ) {
2014-12-25 10:02:00 -05:00
rec_blink_connection = Timers : : blink_connect ( sigc : : mem_fun ( * this , & RouteUI : : blink_rec_display ) ) ;
2014-09-04 22:20:15 -04:00
}
2014-08-22 12:45:34 -04:00
2011-11-02 12:46:49 -04:00
show_sends_button = manage ( new ArdourButton ) ;
show_sends_button - > set_name ( " send alert button " ) ;
2020-03-23 16:13:39 -04:00
UI : : instance ( ) - > set_tip ( show_sends_button , _ ( " Show the strips that send to this bus, and control them from the faders " ) , " " ) ;
2009-05-16 22:08:13 -04:00
2016-07-25 11:38:59 -04:00
monitor_input_button = new ArdourButton ( ArdourButton : : default_elements ) ;
2012-02-07 12:43:55 -05:00
monitor_input_button - > set_name ( " monitor button " ) ;
2011-10-26 17:01:14 -04:00
monitor_input_button - > set_text ( _ ( " In " ) ) ;
2011-10-20 14:50:29 -04:00
UI : : instance ( ) - > set_tip ( monitor_input_button , _ ( " Monitor input " ) , " " ) ;
monitor_input_button - > set_no_show_all ( true ) ;
2015-10-05 10:17:49 -04:00
2016-07-25 11:38:59 -04:00
monitor_disk_button = new ArdourButton ( ArdourButton : : default_elements ) ;
2012-02-07 12:43:55 -05:00
monitor_disk_button - > set_name ( " monitor button " ) ;
2011-10-26 17:01:14 -04:00
monitor_disk_button - > set_text ( _ ( " Disk " ) ) ;
2011-10-20 14:50:29 -04:00
UI : : instance ( ) - > set_tip ( monitor_disk_button , _ ( " Monitor playback " ) , " " ) ;
monitor_disk_button - > set_no_show_all ( true ) ;
2010-03-30 11:18:43 -04:00
_session - > SoloChanged . connect ( _session_connections , invalidator ( * this ) , boost : : bind ( & RouteUI : : solo_changed_so_update_mute , this ) , gui_context ( ) ) ;
_session - > TransportStateChange . connect ( _session_connections , invalidator ( * this ) , boost : : bind ( & RouteUI : : check_rec_enable_sensitivity , this ) , gui_context ( ) ) ;
_session - > RecordStateChanged . connect ( _session_connections , invalidator ( * this ) , boost : : bind ( & RouteUI : : session_rec_enable_changed , this ) , gui_context ( ) ) ;
2021-03-24 13:16:43 -04:00
_session - > MonitorBusAddedOrRemoved . connect ( _session_connections , invalidator ( * this ) , boost : : bind ( & RouteUI : : update_solo_button , this ) , gui_context ( ) ) ;
2009-06-14 13:56:29 -04:00
2012-04-25 08:58:19 -04:00
_session - > config . ParameterChanged . connect ( * this , invalidator ( * this ) , boost : : bind ( & RouteUI : : parameter_changed , this , _1 ) , gui_context ( ) ) ;
Config - > ParameterChanged . connect ( * this , invalidator ( * this ) , boost : : bind ( & RouteUI : : parameter_changed , this , _1 ) , gui_context ( ) ) ;
2016-10-13 12:07:18 -04:00
UIConfiguration : : instance ( ) . ParameterChanged . connect ( sigc : : mem_fun ( this , & RouteUI : : parameter_changed ) ) ;
2010-01-04 09:54:08 -05:00
rec_enable_button - > signal_button_press_event ( ) . connect ( sigc : : mem_fun ( * this , & RouteUI : : rec_enable_press ) , false ) ;
rec_enable_button - > signal_button_release_event ( ) . connect ( sigc : : mem_fun ( * this , & RouteUI : : rec_enable_release ) , false ) ;
show_sends_button - > signal_button_press_event ( ) . connect ( sigc : : mem_fun ( * this , & RouteUI : : show_sends_press ) , false ) ;
2014-08-28 11:31:57 -04:00
show_sends_button - > signal_button_release_event ( ) . connect ( sigc : : mem_fun ( * this , & RouteUI : : show_sends_release ) , false ) ;
2010-01-04 09:54:08 -05:00
solo_button - > signal_button_press_event ( ) . connect ( sigc : : mem_fun ( * this , & RouteUI : : solo_press ) , false ) ;
solo_button - > signal_button_release_event ( ) . connect ( sigc : : mem_fun ( * this , & RouteUI : : solo_release ) , false ) ;
mute_button - > signal_button_press_event ( ) . connect ( sigc : : mem_fun ( * this , & RouteUI : : mute_press ) , false ) ;
mute_button - > signal_button_release_event ( ) . connect ( sigc : : mem_fun ( * this , & RouteUI : : mute_release ) , false ) ;
2015-10-05 10:17:49 -04:00
2011-10-26 17:01:14 -04:00
monitor_input_button - > set_distinct_led_click ( false ) ;
monitor_disk_button - > set_distinct_led_click ( false ) ;
2011-10-20 14:50:29 -04:00
2014-08-28 11:31:57 -04:00
monitor_input_button - > signal_button_press_event ( ) . connect ( sigc : : mem_fun ( * this , & RouteUI : : monitor_input_press ) , false ) ;
monitor_input_button - > signal_button_release_event ( ) . connect ( sigc : : mem_fun ( * this , & RouteUI : : monitor_input_release ) , false ) ;
2011-10-20 14:50:29 -04:00
2014-08-28 11:31:57 -04:00
monitor_disk_button - > signal_button_press_event ( ) . connect ( sigc : : mem_fun ( * this , & RouteUI : : monitor_disk_press ) , false ) ;
monitor_disk_button - > signal_button_release_event ( ) . connect ( sigc : : mem_fun ( * this , & RouteUI : : monitor_disk_release ) , false ) ;
2011-11-02 20:42:16 -04:00
2013-07-30 11:54:52 -04:00
BusSendDisplayChanged . connect_same_thread ( * this , boost : : bind ( & RouteUI : : bus_send_display_changed , this , _1 ) ) ;
2008-12-08 11:07:28 -05:00
}
void
RouteUI : : reset ( )
{
2009-12-19 15:26:31 -05:00
route_connections . drop_connections ( ) ;
2008-12-08 11:07:28 -05:00
2008-12-18 14:31:00 -05:00
delete solo_menu ;
solo_menu = 0 ;
2008-12-08 11:07:28 -05:00
2008-12-18 14:31:00 -05:00
delete mute_menu ;
mute_menu = 0 ;
2009-10-14 12:10:01 -04:00
2017-09-09 12:25:36 -04:00
delete_patch_change_dialog ( ) ;
2017-03-10 17:51:39 -05:00
_color_picker . reset ( ) ;
2008-12-08 11:07:28 -05:00
denormal_menu_item = 0 ;
}
2005-09-25 14:42:24 -04:00
2009-12-17 13:24:23 -05:00
void
RouteUI : : self_delete ( )
{
2011-09-08 13:48:58 -04:00
delete this ;
2009-12-17 13:24:23 -05:00
}
2021-01-28 20:36:03 -05:00
void
RouteUI : : set_session ( ARDOUR : : Session * s )
{
SessionHandlePtr : : set_session ( s ) ;
if ( ! s ) {
2021-02-25 20:54:45 -05:00
/* This is needed to clean out IDs of sends, when using output selector
* with MixerStrip : : _current_delivery .
* It ' s also prudent to hide / destroy input - selectors early , before delayed
* self_delete ( ) can do that in the ~ RouteUI .
*/
for ( IOSelectorMap : : const_iterator i = input_selectors . begin ( ) ; i ! = input_selectors . end ( ) ; + + i ) {
delete i - > second ;
}
2021-01-28 20:36:03 -05:00
for ( IOSelectorMap : : const_iterator i = output_selectors . begin ( ) ; i ! = output_selectors . end ( ) ; + + i ) {
delete i - > second ;
}
input_selectors . clear ( ) ;
output_selectors . clear ( ) ;
}
}
2008-12-08 11:07:28 -05:00
void
2023-02-16 18:33:28 -05:00
RouteUI : : set_route ( std : : shared_ptr < Route > rp )
2008-12-08 11:07:28 -05:00
{
reset ( ) ;
2007-03-18 02:07:08 -04:00
2008-12-08 11:07:28 -05:00
_route = rp ;
2006-11-19 11:45:16 -05:00
2021-03-25 16:38:10 -04:00
if ( ! _route - > presentation_info ( ) . color_set ( ) ) {
2017-02-27 21:51:04 -05:00
/* deal with older 4.x color, which was stored in the GUI object state */
string p = ARDOUR_UI : : instance ( ) - > gui_object_state - > get_string ( route_state_id ( ) , X_ ( " color " ) ) ;
if ( ! p . empty ( ) ) {
/* old v4.x or earlier session. Use this information */
int red , green , blue ;
char colon ;
stringstream ss ( p ) ;
/* old color format version was:
16 bit value for red : 16 bit value for green : 16 bit value for blue
decode to rgb . .
*/
ss > > red ;
ss > > colon ;
ss > > green ;
ss > > colon ;
ss > > blue ;
red > > = 2 ;
green > > = 2 ;
blue > > = 2 ;
_route - > presentation_info ( ) . set_color ( RGBA_TO_UINT ( red , green , blue , 255 ) ) ;
}
}
2008-12-08 11:07:28 -05:00
if ( set_color_from_route ( ) ) {
2023-05-15 16:23:46 -04:00
if ( _route - > is_track ( ) & & UIConfiguration : : instance ( ) . get_use_palette_for_new_track ( ) ) {
set_color ( gdk_color_to_rgba ( AxisView : : round_robin_palette_color ( ) ) ) ;
} else if ( ! _route - > is_track ( ) & & UIConfiguration : : instance ( ) . get_use_palette_for_new_bus ( ) ) {
2023-04-17 20:18:02 -04:00
set_color ( gdk_color_to_rgba ( AxisView : : round_robin_palette_color ( ) ) ) ;
2023-04-17 19:07:54 -04:00
} else {
2023-05-15 13:14:56 -04:00
string cp = UIConfiguration : : instance ( ) . get_stripable_color_palette ( ) ;
Gdk : : ArrayHandle_Color gc = ColorSelection : : palette_from_string ( cp ) ;
std : : vector < Gdk : : Color > c ( gc ) ;
set_color ( gdk_color_to_rgba ( c [ 0 ] ) ) ;
2023-04-17 19:07:54 -04:00
}
2008-12-08 11:07:28 -05:00
}
2007-03-18 02:07:08 -04:00
2009-04-15 14:04:23 -04:00
if ( self_destruct ) {
2010-03-30 11:18:43 -04:00
rp - > DropReferences . connect ( route_connections , invalidator ( * this ) , boost : : bind ( & RouteUI : : self_delete , this ) , gui_context ( ) ) ;
2009-04-15 14:04:23 -04:00
}
2011-06-01 13:00:29 -04:00
2008-12-08 11:07:28 -05:00
mute_button - > set_controllable ( _route - > mute_control ( ) ) ;
solo_button - > set_controllable ( _route - > solo_control ( ) ) ;
2009-10-14 12:10:01 -04:00
2010-03-30 11:18:43 -04:00
_route - > active_changed . connect ( route_connections , invalidator ( * this ) , boost : : bind ( & RouteUI : : route_active_changed , this ) , gui_context ( ) ) ;
2010-04-26 23:10:53 -04:00
2016-01-21 11:03:14 -05:00
_route - > comment_changed . connect ( route_connections , invalidator ( * this ) , boost : : bind ( & RouteUI : : comment_changed , this ) , gui_context ( ) ) ;
2014-07-29 17:40:19 -04:00
2016-03-09 13:12:42 -05:00
_route - > mute_control ( ) - > Changed . connect ( route_connections , invalidator ( * this ) , boost : : bind ( & RouteUI : : update_mute_display , this ) , gui_context ( ) ) ;
_route - > solo_control ( ) - > Changed . connect ( route_connections , invalidator ( * this ) , boost : : bind ( & RouteUI : : update_solo_display , this ) , gui_context ( ) ) ;
_route - > solo_safe_control ( ) - > Changed . connect ( route_connections , invalidator ( * this ) , boost : : bind ( & RouteUI : : update_solo_display , this ) , gui_context ( ) ) ;
_route - > solo_isolate_control ( ) - > Changed . connect ( route_connections , invalidator ( * this ) , boost : : bind ( & RouteUI : : update_solo_display , this ) , gui_context ( ) ) ;
2020-03-02 13:06:40 -05:00
_route - > phase_control ( ) - > Changed . connect ( route_connections , invalidator ( * this ) , boost : : bind ( & RouteUI : : update_polarity_display , this ) , gui_context ( ) ) ;
2016-03-09 13:12:42 -05:00
2014-09-02 20:35:42 -04:00
if ( is_track ( ) ) {
2016-05-23 21:01:27 -04:00
track ( ) - > FreezeChange . connect ( * this , invalidator ( * this ) , boost : : bind ( & RouteUI : : map_frozen , this ) , gui_context ( ) ) ;
2014-09-02 20:35:42 -04:00
track_mode_changed ( ) ;
}
2010-04-26 23:10:53 -04:00
2016-03-09 13:12:42 -05:00
2016-06-05 16:27:25 -04:00
_route - > PropertyChanged . connect ( route_connections , invalidator ( * this ) , boost : : bind ( & RouteUI : : route_property_changed , this , _1 ) , gui_context ( ) ) ;
2016-06-05 17:16:20 -04:00
_route - > presentation_info ( ) . PropertyChanged . connect ( route_connections , invalidator ( * this ) , boost : : bind ( & RouteUI : : route_gui_changed , this , _1 ) , gui_context ( ) ) ;
2009-10-14 12:10:01 -04:00
2020-03-02 12:17:25 -05:00
_route - > polarity ( ) - > ConfigurationChanged . connect ( route_connections , invalidator ( * this ) , boost : : bind ( & RouteUI : : setup_invert_buttons , this ) , gui_context ( ) ) ;
2010-08-13 17:33:01 -04:00
2009-12-17 13:24:23 -05:00
if ( _session - > writable ( ) & & is_track ( ) ) {
2023-02-16 18:33:28 -05:00
std : : shared_ptr < Track > t = std : : dynamic_pointer_cast < Track > ( _route ) ;
2005-09-25 14:42:24 -04:00
2016-04-08 16:49:47 -04:00
t - > rec_enable_control ( ) - > Changed . connect ( route_connections , invalidator ( * this ) , boost : : bind ( & RouteUI : : route_rec_enable_changed , this ) , gui_context ( ) ) ;
t - > rec_safe_control ( ) - > Changed . connect ( route_connections , invalidator ( * this ) , boost : : bind ( & RouteUI : : route_rec_enable_changed , this ) , gui_context ( ) ) ;
2015-10-05 10:17:49 -04:00
2007-07-07 01:04:34 -04:00
rec_enable_button - > show ( ) ;
2016-01-25 22:08:47 -05:00
rec_enable_button - > set_controllable ( t - > rec_enable_control ( ) ) ;
2008-12-08 11:07:28 -05:00
2017-05-03 18:43:40 -04:00
if ( is_midi_track ( ) ) {
midi_track ( ) - > StepEditStatusChange . connect ( route_connections , invalidator ( * this ) ,
boost : : bind ( & RouteUI : : step_edit_changed , this , _1 ) , gui_context ( ) ) ;
}
2010-07-24 12:40:56 -04:00
2015-10-04 14:51:05 -04:00
}
2012-12-27 09:08:38 -05:00
/* this will work for busses and tracks, and needs to be called to
set up the name entry / name label display .
*/
2011-10-20 14:50:29 -04:00
if ( is_track ( ) ) {
2023-02-16 18:33:28 -05:00
std : : shared_ptr < Track > t = std : : dynamic_pointer_cast < Track > ( _route ) ;
2016-04-09 15:39:39 -04:00
t - > monitoring_control ( ) - > Changed . connect ( route_connections , invalidator ( * this ) , boost : : bind ( & RouteUI : : update_monitoring_display , this ) , gui_context ( ) ) ;
2011-10-21 08:40:06 -04:00
update_monitoring_display ( ) ;
2011-10-20 14:50:29 -04:00
}
2022-02-03 19:18:54 -05:00
if ( _route - > triggerbox ( ) ) {
_route - > triggerbox ( ) - > EmptyStatusChanged . connect ( route_connections , invalidator ( * this ) , boost : : bind ( & RouteUI : : update_monitoring_display , this ) , gui_context ( ) ) ;
}
2022-01-26 16:29:36 -05:00
mute_button - > set_can_focus ( false ) ;
solo_button - > set_can_focus ( false ) ;
2009-10-14 12:10:01 -04:00
2007-07-07 01:04:34 -04:00
mute_button - > show ( ) ;
2009-06-11 09:22:42 -04:00
2013-07-09 10:36:58 -04:00
if ( _route - > is_monitor ( ) | | _route - > is_master ( ) ) {
2009-06-11 09:22:42 -04:00
solo_button - > hide ( ) ;
} else {
solo_button - > show ( ) ;
}
2007-07-07 01:04:34 -04:00
2005-09-25 14:42:24 -04:00
map_frozen ( ) ;
2010-08-13 17:33:01 -04:00
setup_invert_buttons ( ) ;
2011-11-02 20:42:16 -04:00
2023-02-16 18:33:28 -05:00
std : : shared_ptr < Route > s = _showing_sends_to . lock ( ) ;
2011-11-02 20:42:16 -04:00
bus_send_display_changed ( s ) ;
2011-11-19 07:18:20 -05:00
update_mute_display ( ) ;
update_solo_display ( ) ;
2021-03-24 13:16:43 -04:00
update_solo_button ( ) ;
2014-08-22 12:45:34 -04:00
2015-01-02 09:44:54 -05:00
if ( ! UIConfiguration : : instance ( ) . get_blink_rec_arm ( ) ) {
2014-09-06 07:23:59 -04:00
blink_rec_display ( true ) ; // set initial rec-en button state
}
2016-05-23 21:01:27 -04:00
check_rec_enable_sensitivity ( ) ;
2016-05-10 14:11:08 -04:00
maybe_add_route_print_mgr ( ) ;
2014-08-22 12:45:34 -04:00
route_color_changed ( ) ;
2016-06-10 13:50:42 -04:00
route_gui_changed ( PropertyChange ( Properties : : selected ) ) ;
2010-03-30 13:44:02 -04:00
}
2006-09-18 23:29:16 -04:00
bool
2009-12-10 12:45:18 -05:00
RouteUI : : mute_press ( GdkEventButton * ev )
2005-09-25 14:42:24 -04:00
{
2008-12-12 09:43:24 -05:00
if ( ev - > type = = GDK_2BUTTON_PRESS | | ev - > type = = GDK_3BUTTON_PRESS ) {
2008-04-11 10:06:50 -04:00
return true ;
}
2009-12-10 12:45:18 -05:00
2014-08-28 11:31:57 -04:00
//if this is a binding action, let the ArdourButton handle it
2017-07-16 22:55:52 -04:00
if ( BindingProxy : : is_bind_action ( ev ) )
2014-08-28 11:31:57 -04:00
return false ;
2015-10-05 10:17:49 -04:00
2014-07-10 11:54:59 -04:00
if ( Keyboard : : is_context_menu_event ( ev ) ) {
2005-09-25 14:42:24 -04:00
2014-07-10 11:54:59 -04:00
if ( mute_menu = = 0 ) {
build_mute_menu ( ) ;
}
2005-09-25 14:42:24 -04:00
2017-03-24 09:36:17 -04:00
mute_menu - > popup ( 0 , ev - > time ) ;
2015-10-05 10:17:49 -04:00
2014-08-22 12:45:34 -04:00
return true ;
2005-09-25 14:42:24 -04:00
2014-07-10 11:54:59 -04:00
} else {
2009-10-14 12:10:01 -04:00
2022-06-14 17:44:48 -04:00
if ( Keyboard : : is_momentary_push_event ( ev ) ) {
2014-07-10 11:54:59 -04:00
// button2-click is "momentary"
2010-03-16 11:33:04 -04:00
2016-04-08 16:49:47 -04:00
_mute_release = new SoloMuteRelease ( _route - > mute_control ( ) - > muted ( ) ) ;
2014-07-10 11:54:59 -04:00
}
if ( ev - > button = = 1 | | Keyboard : : is_button2_event ( ev ) ) {
2005-09-25 14:42:24 -04:00
2014-07-10 11:54:59 -04:00
if ( Keyboard : : modifier_state_equals ( ev - > state , Keyboard : : ModifierMask ( Keyboard : : PrimaryModifier | Keyboard : : TertiaryModifier ) ) ) {
2005-09-25 14:42:24 -04:00
2014-07-10 11:54:59 -04:00
/* toggle mute on everything (but
* exclude the master and monitor )
*
* because we are going to erase
* elements of the list we need to work
* on a copy .
*/
2015-10-05 10:17:49 -04:00
2023-07-31 15:36:25 -04:00
std : : shared_ptr < StripableList > copy ( new StripableList ) ;
2013-02-05 13:16:10 -05:00
2023-07-31 15:36:25 -04:00
* copy = _session - > get_stripables ( ) ;
2013-02-05 13:16:10 -05:00
2023-07-31 15:36:25 -04:00
for ( StripableList : : iterator i = copy - > begin ( ) ; i ! = copy - > end ( ) ; ) {
2014-07-10 11:54:59 -04:00
if ( ( * i ) - > is_master ( ) | | ( * i ) - > is_monitor ( ) ) {
i = copy - > erase ( i ) ;
} else {
+ + i ;
2013-02-05 13:16:10 -05:00
}
2014-07-10 11:54:59 -04:00
}
2013-02-05 13:16:10 -05:00
2014-07-10 11:54:59 -04:00
if ( _mute_release ) {
2021-02-04 18:36:34 -05:00
_mute_release - > set ( copy ) ;
2014-07-10 11:54:59 -04:00
}
2005-09-25 14:42:24 -04:00
2023-07-31 15:36:25 -04:00
_session - > set_controls ( stripable_list_to_control_list ( copy , & Stripable : : mute_control ) , _route - > muted_by_self ( ) ? 0.0 : 1.0 , Controllable : : NoGroup ) ;
2005-09-25 14:42:24 -04:00
2022-06-21 13:51:14 -04:00
} else if ( Keyboard : : is_group_override_event ( ev ) ) {
2005-09-25 14:42:24 -04:00
2022-06-21 13:51:14 -04:00
/* Tertiary-button1 inverts the implication of
2016-01-25 22:06:41 -05:00
the group being active . If the group is
active ( for mute ) , then this modifier means
" do not apply to mute " . If the group is
inactive ( for mute ) , then this modifier
means " apply to route " . This is all
accomplished by passing just the actual
route , along with the InverseGroup group
control disposition .
2014-07-10 11:54:59 -04:00
NOTE : Primary - button2 is MIDI learn .
*/
2005-09-25 14:42:24 -04:00
2013-02-05 13:16:10 -05:00
2015-10-04 14:51:05 -04:00
if ( ev - > button = = 1 ) {
2023-07-31 15:36:25 -04:00
std : : shared_ptr < StripableList > sl ( new StripableList ) ;
sl - > push_back ( _route ) ;
2015-10-05 10:17:49 -04:00
2016-01-25 22:06:41 -05:00
if ( _mute_release ) {
2023-07-31 15:36:25 -04:00
_mute_release - > set ( sl ) ;
2005-09-25 14:42:24 -04:00
}
2009-10-14 12:10:01 -04:00
2023-02-16 18:33:28 -05:00
std : : shared_ptr < MuteControl > mc = _route - > mute_control ( ) ;
2020-09-26 11:14:59 -04:00
mc - > start_touch ( timepos_t ( _session - > audible_sample ( ) ) ) ;
2023-07-31 15:36:25 -04:00
_session - > set_controls ( stripable_list_to_control_list ( sl , & Stripable : : mute_control ) , _route - > muted_by_self ( ) ? 0.0 : 1.0 , Controllable : : InverseGroup ) ;
2014-07-10 11:54:59 -04:00
}
2005-09-25 14:42:24 -04:00
2014-07-10 11:54:59 -04:00
} else {
2011-06-01 13:00:29 -04:00
2014-07-10 11:54:59 -04:00
/* plain click applies change to this route */
2023-07-31 15:36:25 -04:00
std : : shared_ptr < StripableList > sl ( new StripableList ) ;
_session - > selection ( ) . get_stripables_for_op ( sl , _route , & RouteGroup : : is_mute ) ;
2015-10-05 10:17:49 -04:00
2014-07-10 11:54:59 -04:00
if ( _mute_release ) {
2023-07-31 15:36:25 -04:00
_mute_release - > set ( sl ) ;
2014-07-10 11:54:59 -04:00
}
2009-12-10 12:45:18 -05:00
2023-07-31 15:36:25 -04:00
_session - > set_controls ( stripable_list_to_control_list ( sl , & Stripable : : mute_control ) , _route - > muted_by_self ( ) ? 0.0 : 1.0 , Controllable : : NoGroup ) ;
2005-09-25 14:42:24 -04:00
}
}
}
2014-08-22 12:45:34 -04:00
return false ;
2005-09-25 14:42:24 -04:00
}
2006-09-18 23:29:16 -04:00
bool
2014-09-02 20:37:10 -04:00
RouteUI : : mute_release ( GdkEventButton * /*ev*/ )
2005-09-25 14:42:24 -04:00
{
2021-02-04 18:36:34 -05:00
if ( _mute_release ) {
_mute_release - > release ( _session , true ) ;
2014-07-10 11:54:59 -04:00
delete _mute_release ;
_mute_release = 0 ;
2005-09-25 14:42:24 -04:00
}
2009-12-10 12:45:18 -05:00
2020-09-26 11:14:59 -04:00
_route - > mute_control ( ) - > stop_touch ( timepos_t ( _session - > audible_sample ( ) ) ) ;
2017-02-27 22:59:45 -05:00
2014-08-22 12:45:34 -04:00
return false ;
2005-09-25 14:42:24 -04:00
}
2014-08-01 14:48:33 -04:00
void
RouteUI : : edit_output_configuration ( )
{
2023-02-16 18:33:28 -05:00
std : : shared_ptr < Send > send = std : : dynamic_pointer_cast < Send > ( _current_delivery ) ;
if ( send & & ! std : : dynamic_pointer_cast < InternalSend > ( send ) ) {
2021-01-28 20:36:03 -05:00
send . reset ( ) ;
}
2014-08-01 14:48:33 -04:00
2021-01-28 20:36:03 -05:00
PBD : : ID id = send ? send - > id ( ) : _route - > id ( ) ;
2014-08-01 14:48:33 -04:00
2021-01-28 20:36:03 -05:00
if ( output_selectors . find ( id ) = = output_selectors . end ( ) ) {
output_selectors [ _route - > id ( ) ] = new IOSelectorWindow ( _session , send ? send - > output ( ) : _route - > output ( ) ) ;
2014-08-01 14:48:33 -04:00
}
2021-01-28 20:36:03 -05:00
IOSelectorWindow * w = output_selectors [ id ] ;
2022-01-26 15:21:06 -05:00
if ( w - > get_visible ( ) ) {
2021-01-28 20:36:03 -05:00
w - > get_toplevel ( ) - > get_window ( ) - > raise ( ) ;
2014-08-01 14:48:33 -04:00
} else {
2021-01-28 20:36:03 -05:00
w - > present ( ) ;
2014-08-01 14:48:33 -04:00
}
2021-01-28 20:36:03 -05:00
//w->set_keep_above (true);
2014-08-01 14:48:33 -04:00
}
void
RouteUI : : edit_input_configuration ( )
{
2021-01-28 20:36:03 -05:00
if ( input_selectors . find ( _route - > id ( ) ) = = input_selectors . end ( ) ) {
input_selectors [ _route - > id ( ) ] = new IOSelectorWindow ( _session , _route - > input ( ) ) ;
2014-08-01 14:48:33 -04:00
}
2021-01-28 20:36:03 -05:00
IOSelectorWindow * w = input_selectors [ _route - > id ( ) ] ;
2022-01-26 15:21:06 -05:00
if ( w - > get_visible ( ) ) {
2021-01-28 20:36:03 -05:00
w - > get_toplevel ( ) - > get_window ( ) - > raise ( ) ;
2014-08-01 14:48:33 -04:00
} else {
2021-01-28 20:36:03 -05:00
w - > present ( ) ;
2014-08-01 14:48:33 -04:00
}
2021-01-28 20:36:03 -05:00
//w->set_keep_above (true);
2014-08-01 14:48:33 -04:00
}
2006-09-18 23:29:16 -04:00
bool
2005-09-25 14:42:24 -04:00
RouteUI : : solo_press ( GdkEventButton * ev )
{
2008-12-12 09:43:24 -05:00
/* ignore double/triple clicks */
2008-04-11 10:06:50 -04:00
2008-12-12 09:43:24 -05:00
if ( ev - > type = = GDK_2BUTTON_PRESS | | ev - > type = = GDK_3BUTTON_PRESS ) {
2008-04-11 10:06:50 -04:00
return true ;
}
2011-06-01 13:00:29 -04:00
2014-08-28 11:31:57 -04:00
//if this is a binding action, let the ArdourButton handle it
2017-07-16 22:55:52 -04:00
if ( BindingProxy : : is_bind_action ( ev ) )
2014-08-28 11:31:57 -04:00
return false ;
2015-10-05 10:17:49 -04:00
2014-07-10 11:54:59 -04:00
if ( Keyboard : : is_context_menu_event ( ev ) ) {
2011-06-01 13:00:29 -04:00
2022-06-17 10:24:46 -04:00
if ( solo_menu = = 0 ) {
build_solo_menu ( ) ;
2014-07-10 11:54:59 -04:00
}
2011-06-01 13:00:29 -04:00
2022-06-17 10:24:46 -04:00
solo_menu - > popup ( 1 , ev - > time ) ;
2014-07-10 11:54:59 -04:00
} else {
2011-06-01 13:00:29 -04:00
2022-06-14 17:44:48 -04:00
if ( Keyboard : : is_momentary_push_event ( ev ) ) {
2011-06-01 13:00:29 -04:00
2014-08-22 12:45:34 -04:00
// button2-click is "momentary"
2014-07-10 11:54:59 -04:00
_solo_release = new SoloMuteRelease ( _route - > self_soloed ( ) ) ;
}
2011-06-01 13:00:29 -04:00
2014-07-10 11:54:59 -04:00
if ( ev - > button = = 1 | | Keyboard : : is_button2_event ( ev ) ) {
2011-06-01 13:00:29 -04:00
2014-07-10 11:54:59 -04:00
if ( Keyboard : : modifier_state_equals ( ev - > state , Keyboard : : ModifierMask ( Keyboard : : PrimaryModifier | Keyboard : : TertiaryModifier ) ) ) {
2009-10-14 12:10:01 -04:00
2014-07-10 11:54:59 -04:00
/* Primary-Tertiary-click applies change to all routes */
2011-06-01 13:00:29 -04:00
2023-07-31 15:36:25 -04:00
std : : shared_ptr < StripableList > sl ( new StripableList ) ;
_session - > get_stripables ( * sl , PresentationInfo : : Route ) ;
2014-07-10 11:54:59 -04:00
if ( _solo_release ) {
2023-07-31 15:36:25 -04:00
_solo_release - > set ( sl ) ;
2014-07-10 11:54:59 -04:00
}
2023-07-31 15:36:25 -04:00
_session - > set_controls ( stripable_list_to_control_list ( sl , & Stripable : : solo_control ) , ! _route - > solo_control ( ) - > get_value ( ) , Controllable : : NoGroup ) ;
2011-06-01 13:00:29 -04:00
2021-02-04 18:36:34 -05:00
} else if ( Keyboard : : modifier_state_contains ( ev - > state , Keyboard : : ModifierMask ( Keyboard : : PrimaryModifier | Keyboard : : SecondaryModifier ) ) | | ( ! _route - > self_soloed ( ) & & Config - > get_exclusive_solo ( ) ) ) {
2011-06-01 13:00:29 -04:00
2017-05-03 18:42:07 -04:00
/* Primary-Secondary-click: exclusively solo this track */
2009-12-10 12:45:18 -05:00
2014-07-10 11:54:59 -04:00
if ( _solo_release ) {
2021-02-04 18:36:34 -05:00
_session - > prepare_momentary_solo ( _solo_release , true , _route ) ;
} else {
/* clear solo state */
_session - > prepare_momentary_solo ( 0 , true , _route ) ;
2017-05-03 18:42:07 -04:00
}
2021-03-25 09:46:29 -04:00
DisplaySuspender ds ;
_route - > solo_control ( ) - > set_value ( 1.0 , Controllable : : NoGroup ) ;
2009-12-08 22:05:14 -05:00
2022-06-21 13:51:14 -04:00
/* } else if (Keyboard::modifier_state_equals (ev->state, Keyboard::PrimaryModifier)) { do not explicitly implement Primary Modifier; this is the default for Momentary */
2011-06-01 13:00:29 -04:00
2022-06-21 13:51:14 -04:00
/* } else if (Keyboard::modifier_state_equals (ev->state, Keyboard::TertiaryModifier)) { do not explicitly implement Tertiary Modifier; this is the default for Group-Override */
2011-06-01 13:00:29 -04:00
2022-06-21 13:51:14 -04:00
} else if ( Keyboard : : is_group_override_event ( ev ) ) {
2011-06-01 13:00:29 -04:00
2022-06-21 13:51:14 -04:00
/* Tertiary-button1: override mix group.
2014-07-10 11:54:59 -04:00
NOTE : Primary - button2 is MIDI learn .
*/
2013-02-05 16:39:38 -05:00
2023-02-16 18:33:28 -05:00
std : : shared_ptr < RouteList > rl ;
2013-02-05 16:39:38 -05:00
2015-10-04 14:51:05 -04:00
if ( ev - > button = = 1 ) {
2015-10-05 10:17:49 -04:00
2022-06-21 13:51:14 -04:00
/* Tertiary-button1 inverts the implication of
2016-01-25 22:08:23 -05:00
the group being active . If the group is
active ( for solo ) , then this modifier means
" do not apply to solo " . If the group is
inactive ( for mute ) , then this modifier
means " apply to route " . This is all
accomplished by passing just the actual
route , along with the InverseGroup group
control disposition .
2015-10-05 10:17:49 -04:00
2016-01-25 22:08:23 -05:00
NOTE : Primary - button2 is MIDI learn .
*/
rl . reset ( new RouteList ) ;
rl - > push_back ( _route ) ;
2016-05-27 16:13:10 -04:00
_session - > set_controls ( route_list_to_control_list ( rl , & Stripable : : solo_control ) , ! _route - > self_soloed ( ) , Controllable : : InverseGroup ) ;
2014-07-10 11:54:59 -04:00
}
2011-06-01 13:00:29 -04:00
2015-10-07 08:19:23 -04:00
delete _solo_release ;
_solo_release = 0 ;
2014-07-10 11:54:59 -04:00
} else {
2011-06-01 13:00:29 -04:00
2014-07-10 11:54:59 -04:00
/* click: solo this route */
2011-06-01 13:00:29 -04:00
2023-07-31 15:36:25 -04:00
std : : shared_ptr < StripableList > sl ( new StripableList ) ;
2023-07-26 20:09:26 -04:00
2023-07-31 15:36:25 -04:00
_session - > selection ( ) . get_stripables_for_op ( sl , _route , & RouteGroup : : is_solo ) ;
2009-12-10 12:45:18 -05:00
2014-07-10 11:54:59 -04:00
if ( _solo_release ) {
2023-07-31 15:36:25 -04:00
_solo_release - > set ( sl ) ;
2014-07-10 11:54:59 -04:00
}
2005-09-25 14:42:24 -04:00
2023-07-31 15:36:25 -04:00
_session - > set_controls ( stripable_list_to_control_list ( sl , & Stripable : : solo_control ) , ! _route - > self_soloed ( ) , Controllable : : NoGroup ) ;
2005-09-25 14:42:24 -04:00
}
}
}
2014-08-22 12:45:34 -04:00
return false ;
2005-09-25 14:42:24 -04:00
}
2006-09-18 23:29:16 -04:00
bool
2014-09-02 20:37:10 -04:00
RouteUI : : solo_release ( GdkEventButton * /*ev*/ )
2005-09-25 14:42:24 -04:00
{
2014-07-10 11:54:59 -04:00
if ( _solo_release ) {
2021-02-04 18:36:34 -05:00
_solo_release - > release ( _session , false ) ;
2014-07-10 11:54:59 -04:00
delete _solo_release ;
_solo_release = 0 ;
2005-09-25 14:42:24 -04:00
}
2006-03-29 13:52:55 -05:00
2014-08-22 12:45:34 -04:00
return false ;
2005-09-25 14:42:24 -04:00
}
2006-09-18 23:29:16 -04:00
bool
2005-09-25 14:42:24 -04:00
RouteUI : : rec_enable_press ( GdkEventButton * ev )
{
2008-12-12 09:43:24 -05:00
if ( ev - > type = = GDK_2BUTTON_PRESS | | ev - > type = = GDK_3BUTTON_PRESS ) {
2008-04-11 10:06:50 -04:00
return true ;
}
2014-08-28 11:31:57 -04:00
//if this is a binding action, let the ArdourButton handle it
2023-07-26 23:05:35 -04:00
if ( BindingProxy : : is_bind_action ( ev ) ) {
2014-08-28 11:31:57 -04:00
return false ;
2023-07-26 23:05:35 -04:00
}
2015-10-05 10:17:49 -04:00
2018-11-28 09:17:57 -05:00
if ( ! ARDOUR_UI_UTILS : : engine_is_running ( ) ) {
2014-08-22 12:45:34 -04:00
return false ;
2006-11-19 11:45:16 -05:00
}
2015-01-07 20:12:14 -05:00
if ( is_midi_track ( ) ) {
2010-07-24 12:40:56 -04:00
2018-12-22 17:40:26 -05:00
/* rec-enable button exits from step editing, but not context click */
2010-07-24 12:40:56 -04:00
2018-12-22 17:40:26 -05:00
if ( ! Keyboard : : is_context_menu_event ( ev ) & & midi_track ( ) - > step_editing ( ) ) {
2012-02-03 16:02:18 -05:00
midi_track ( ) - > set_step_editing ( false ) ;
2014-08-22 12:45:34 -04:00
return false ;
2015-01-07 20:12:14 -05:00
}
}
2010-07-24 12:40:56 -04:00
2014-07-10 11:54:59 -04:00
if ( is_track ( ) & & rec_enable_button ) {
2005-09-25 14:42:24 -04:00
2022-06-14 17:44:48 -04:00
if ( Keyboard : : is_momentary_push_event ( ev ) ) {
2015-10-05 10:17:49 -04:00
2014-08-22 12:45:34 -04:00
//rec arm does not have a momentary mode
return false ;
2007-03-18 02:07:08 -04:00
2008-01-10 16:20:59 -05:00
} else if ( Keyboard : : modifier_state_equals ( ev - > state , Keyboard : : ModifierMask ( Keyboard : : PrimaryModifier | Keyboard : : TertiaryModifier ) ) ) {
2005-09-25 14:42:24 -04:00
2016-05-27 16:13:10 -04:00
_session - > set_controls ( route_list_to_control_list ( _session - > get_routes ( ) , & Stripable : : rec_enable_control ) , ! track ( ) - > rec_enable_control ( ) - > get_value ( ) , Controllable : : NoGroup ) ;
2005-09-25 14:42:24 -04:00
2022-06-21 13:51:14 -04:00
} else if ( Keyboard : : is_group_override_event ( ev ) ) {
2008-01-10 16:20:59 -05:00
2022-06-21 13:51:14 -04:00
/* Tertiary-button1 applies change to the route group (even if it is not active)
2008-01-10 16:20:59 -05:00
NOTE : Primary - button2 is MIDI learn .
*/
2013-02-05 16:39:38 -05:00
if ( ev - > button = = 1 ) {
2023-02-16 18:33:28 -05:00
std : : shared_ptr < RouteList > rl ;
2015-10-05 10:17:49 -04:00
2016-01-25 22:10:43 -05:00
rl . reset ( new RouteList ) ;
rl - > push_back ( _route ) ;
2014-06-28 20:52:56 -04:00
2022-07-14 10:36:56 -04:00
_session - > set_controls ( route_list_to_control_list ( rl , & Stripable : : rec_enable_control ) , ! track ( ) - > rec_enable_control ( ) - > get_value ( ) , GROUP_ACTION ) ;
2009-12-07 20:52:49 -05:00
}
2005-09-25 14:42:24 -04:00
2009-09-03 08:39:50 -04:00
} else if ( Keyboard : : is_context_menu_event ( ev ) ) {
2009-10-14 12:10:01 -04:00
2009-09-03 08:39:50 -04:00
/* do this on release */
2005-09-25 14:42:24 -04:00
} else {
2009-12-09 22:25:32 -05:00
2023-07-26 23:06:19 -04:00
if ( ev - > button = = 1 ) {
2023-07-31 15:36:25 -04:00
StripableList sl ;
_session - > selection ( ) . get_stripables_for_op ( sl , _route , & RouteGroup : : is_recenable ) ;
_session - > set_controls ( stripable_list_to_control_list ( sl , & Stripable : : rec_enable_control ) , ! track ( ) - > rec_enable_control ( ) - > get_value ( ) , Controllable : : NoGroup ) ;
2023-07-26 23:06:19 -04:00
}
2005-09-25 14:42:24 -04:00
}
}
2014-08-22 12:45:34 -04:00
return false ;
2007-03-18 02:07:08 -04:00
}
2011-10-21 08:40:06 -04:00
void
RouteUI : : update_monitoring_display ( )
2011-10-20 14:50:29 -04:00
{
2011-10-21 11:05:33 -04:00
if ( ! _route ) {
return ;
}
2023-02-16 18:33:28 -05:00
std : : shared_ptr < Track > t = std : : dynamic_pointer_cast < Track > ( _route ) ;
2011-10-20 14:50:29 -04:00
if ( ! t ) {
return ;
}
2011-10-21 11:05:33 -04:00
MonitorState ms = t - > monitoring_state ( ) ;
2011-10-20 14:50:29 -04:00
2016-04-08 16:49:47 -04:00
if ( t - > monitoring_control ( ) - > monitoring_choice ( ) & MonitorInput ) {
2012-02-07 12:43:55 -05:00
monitor_input_button - > set_active_state ( Gtkmm2ext : : ExplicitActive ) ;
2011-10-21 13:32:31 -04:00
} else {
if ( ms & MonitoringInput ) {
2012-02-07 12:43:55 -05:00
monitor_input_button - > set_active_state ( Gtkmm2ext : : ImplicitActive ) ;
2011-10-21 13:32:31 -04:00
} else {
2011-10-27 07:24:43 -04:00
monitor_input_button - > unset_active_state ( ) ;
2011-10-21 11:05:33 -04:00
}
2011-10-20 14:50:29 -04:00
}
2016-04-08 16:49:47 -04:00
if ( t - > monitoring_control ( ) - > monitoring_choice ( ) & MonitorDisk ) {
2012-02-07 12:43:55 -05:00
monitor_disk_button - > set_active_state ( Gtkmm2ext : : ExplicitActive ) ;
2011-10-21 13:32:31 -04:00
} else {
if ( ms & MonitoringDisk ) {
2012-02-07 12:43:55 -05:00
monitor_disk_button - > set_active_state ( Gtkmm2ext : : ImplicitActive ) ;
2011-10-21 13:32:31 -04:00
} else {
2011-10-27 07:24:43 -04:00
monitor_disk_button - > unset_active_state ( ) ;
2011-10-21 11:05:33 -04:00
}
2011-10-20 14:50:29 -04:00
}
}
bool
2012-05-02 16:29:46 -04:00
RouteUI : : monitor_input_press ( GdkEventButton * )
2011-10-20 14:50:29 -04:00
{
2014-08-28 11:31:57 -04:00
return false ;
2011-10-20 14:50:29 -04:00
}
bool
RouteUI : : monitor_input_release ( GdkEventButton * ev )
{
return monitor_release ( ev , MonitorInput ) ;
}
bool
2012-05-02 16:29:46 -04:00
RouteUI : : monitor_disk_press ( GdkEventButton * )
2011-10-20 14:50:29 -04:00
{
2014-08-28 11:31:57 -04:00
return false ;
2011-10-20 14:50:29 -04:00
}
bool
RouteUI : : monitor_disk_release ( GdkEventButton * ev )
{
2014-08-29 20:26:36 -04:00
return monitor_release ( ev , MonitorDisk ) ;
2011-10-20 14:50:29 -04:00
}
bool
RouteUI : : monitor_release ( GdkEventButton * ev , MonitorChoice monitor_choice )
2015-10-05 10:17:49 -04:00
{
2011-10-20 14:50:29 -04:00
if ( ev - > button ! = 1 ) {
return false ;
}
2023-02-16 18:33:28 -05:00
std : : shared_ptr < Track > t = std : : dynamic_pointer_cast < Track > ( _route ) ;
2011-10-20 14:50:29 -04:00
if ( ! t ) {
return true ;
}
MonitorChoice mc ;
2015-10-05 10:17:49 -04:00
2016-04-08 16:49:47 -04:00
if ( t - > monitoring_control ( ) - > monitoring_choice ( ) & monitor_choice ) {
mc = MonitorChoice ( t - > monitoring_control ( ) - > monitoring_choice ( ) & ~ monitor_choice ) ;
2011-10-20 14:50:29 -04:00
} else {
2017-06-11 19:53:22 -04:00
mc = MonitorChoice ( t - > monitoring_control ( ) - > monitoring_choice ( ) | monitor_choice ) ;
2011-10-20 14:50:29 -04:00
}
2015-10-05 10:17:49 -04:00
if ( Keyboard : : modifier_state_equals ( ev - > state , Keyboard : : ModifierMask ( Keyboard : : PrimaryModifier | Keyboard : : TertiaryModifier ) ) ) {
2017-06-12 14:47:11 -04:00
/* Primary-Tertiary-click applies change to all routes */
2023-04-07 17:33:13 -04:00
std : : shared_ptr < RouteList const > rl = _session - > get_routes ( ) ;
2017-06-12 14:47:11 -04:00
_session - > set_controls ( route_list_to_control_list ( rl , & Stripable : : monitoring_control ) , ( double ) mc , Controllable : : NoGroup ) ;
2022-06-21 13:51:14 -04:00
} else if ( Keyboard : : is_group_override_event ( ev ) ) {
/* Tertiary-click overrides group */
2023-04-07 17:33:13 -04:00
std : : shared_ptr < RouteList > rl ( new RouteList ) ;
2017-06-12 14:47:11 -04:00
rl - > push_back ( route ( ) ) ;
2022-07-14 10:36:56 -04:00
_session - > set_controls ( route_list_to_control_list ( rl , & Stripable : : monitoring_control ) , ( double ) mc , GROUP_ACTION ) ;
2011-10-20 14:50:29 -04:00
} else {
2023-07-29 17:21:15 -04:00
2023-07-31 15:36:25 -04:00
StripableList sl ;
_session - > selection ( ) . get_stripables_for_op ( sl , _route , & RouteGroup : : is_monitoring ) ;
_session - > set_controls ( stripable_list_to_control_list ( sl , & Stripable : : monitoring_control ) , ( double ) mc , Controllable : : NoGroup ) ;
2023-07-29 17:21:15 -04:00
2011-10-20 14:50:29 -04:00
}
2014-08-28 11:31:57 -04:00
return false ;
2011-10-20 14:50:29 -04:00
}
2010-07-24 12:40:56 -04:00
void
RouteUI : : build_record_menu ( )
{
2021-03-27 12:44:34 -04:00
if ( ! _record_menu ) {
_record_menu = new Menu ;
_record_menu - > set_name ( " ArdourContextMenu " ) ;
2015-01-07 20:12:14 -05:00
using namespace Menu_Helpers ;
2021-03-27 12:44:34 -04:00
MenuList & items = _record_menu - > items ( ) ;
2011-06-01 13:00:29 -04:00
2016-05-24 15:30:33 -04:00
items . push_back ( CheckMenuElem ( _ ( " Rec-Safe " ) , sigc : : mem_fun ( * this , & RouteUI : : toggle_rec_safe ) ) ) ;
2021-03-27 12:44:34 -04:00
_rec_safe_item = dynamic_cast < Gtk : : CheckMenuItem * > ( & items . back ( ) ) ;
2010-08-03 17:50:15 -04:00
2016-05-24 15:30:33 -04:00
if ( is_midi_track ( ) ) {
items . push_back ( SeparatorElem ( ) ) ;
items . push_back ( CheckMenuElem ( _ ( " Step Entry " ) , sigc : : mem_fun ( * this , & RouteUI : : toggle_step_edit ) ) ) ;
2021-03-27 12:44:34 -04:00
_step_edit_item = dynamic_cast < Gtk : : CheckMenuItem * > ( & items . back ( ) ) ;
2015-01-07 20:12:14 -05:00
}
2016-05-24 15:30:33 -04:00
}
2010-07-24 12:40:56 -04:00
2021-03-27 12:44:34 -04:00
if ( _step_edit_item ) {
2016-04-08 16:49:47 -04:00
if ( track ( ) - > rec_enable_control ( ) - > get_value ( ) ) {
2021-03-27 12:44:34 -04:00
_step_edit_item - > set_sensitive ( false ) ;
2016-04-08 16:49:47 -04:00
}
2021-03-27 12:44:34 -04:00
_step_edit_item - > set_active ( midi_track ( ) - > step_editing ( ) ) ;
2015-01-07 20:12:14 -05:00
}
2021-03-27 12:44:34 -04:00
if ( _rec_safe_item ) {
_rec_safe_item - > set_sensitive ( ! _route - > rec_enable_control ( ) - > get_value ( ) ) ;
_rec_safe_item - > set_active ( _route - > rec_safe_control ( ) - > get_value ( ) ) ;
2016-05-24 15:30:33 -04:00
}
2010-07-24 12:40:56 -04:00
}
void
RouteUI : : toggle_step_edit ( )
{
2016-04-08 16:49:47 -04:00
if ( ! is_midi_track ( ) | | track ( ) - > rec_enable_control ( ) - > get_value ( ) ) {
2015-01-07 20:12:14 -05:00
return ;
}
2010-08-03 17:50:15 -04:00
2021-03-27 12:44:34 -04:00
midi_track ( ) - > set_step_editing ( _step_edit_item - > get_active ( ) ) ;
2010-07-24 12:40:56 -04:00
}
2016-05-24 15:30:33 -04:00
void
RouteUI : : toggle_rec_safe ( )
{
2023-02-16 18:33:28 -05:00
std : : shared_ptr < AutomationControl > rs = _route - > rec_safe_control ( ) ;
2016-05-27 16:13:10 -04:00
if ( ! rs ) {
2016-05-24 15:30:33 -04:00
return ;
}
2016-05-27 16:13:10 -04:00
/* This check is made inside the control too, but dong it here can't
* hurt .
*/
if ( _route - > rec_enable_control ( ) - > get_value ( ) ) {
return ;
}
2021-03-27 12:44:34 -04:00
rs - > set_value ( _rec_safe_item - > get_active ( ) , Controllable : : UseGroup ) ;
2016-05-24 15:30:33 -04:00
}
2010-07-24 12:40:56 -04:00
void
RouteUI : : step_edit_changed ( bool yn )
{
2015-01-07 20:12:14 -05:00
if ( yn ) {
if ( rec_enable_button ) {
rec_enable_button - > set_active_state ( Gtkmm2ext : : ExplicitActive ) ;
}
2010-08-03 17:50:15 -04:00
2015-01-07 20:12:14 -05:00
start_step_editing ( ) ;
2010-08-03 17:50:15 -04:00
2021-03-27 12:44:34 -04:00
if ( _step_edit_item ) {
_step_edit_item - > set_active ( true ) ;
2015-01-07 20:12:14 -05:00
}
2010-08-03 17:50:15 -04:00
2015-01-07 20:12:14 -05:00
} else {
2010-08-03 17:50:15 -04:00
2015-01-07 20:12:14 -05:00
if ( rec_enable_button ) {
rec_enable_button - > unset_active_state ( ) ;
}
2010-08-03 17:50:15 -04:00
2015-01-07 20:12:14 -05:00
stop_step_editing ( ) ;
2010-08-03 17:50:15 -04:00
2021-03-27 12:44:34 -04:00
if ( _step_edit_item ) {
_step_edit_item - > set_active ( false ) ;
2015-01-07 20:12:14 -05:00
}
}
2010-07-24 12:40:56 -04:00
}
2007-03-18 02:07:08 -04:00
bool
2010-07-24 12:40:56 -04:00
RouteUI : : rec_enable_release ( GdkEventButton * ev )
2007-03-18 02:07:08 -04:00
{
2015-01-07 20:12:14 -05:00
if ( Keyboard : : is_context_menu_event ( ev ) ) {
build_record_menu ( ) ;
2021-03-27 12:44:34 -04:00
if ( _record_menu ) {
_record_menu - > popup ( 1 , ev - > time ) ;
2015-01-07 20:12:14 -05:00
}
return false ;
}
2010-07-24 12:40:56 -04:00
2014-08-22 12:45:34 -04:00
return false ;
2005-09-25 14:42:24 -04:00
}
2009-05-16 22:08:13 -04:00
void
RouteUI : : build_sends_menu ( )
{
using namespace Menu_Helpers ;
2009-10-14 12:10:01 -04:00
2009-05-16 22:08:13 -04:00
sends_menu = new Menu ;
sends_menu - > set_name ( " ArdourContextMenu " ) ;
MenuList & items = sends_menu - > items ( ) ;
2009-10-14 12:10:01 -04:00
2021-03-27 10:52:14 -04:00
if ( ! is_foldbackbus ( ) ) {
items . push_back (
MenuElem ( _ ( " Assign all tracks (prefader) " ) , sigc : : bind ( sigc : : mem_fun ( * this , & RouteUI : : create_sends ) , PreFader , false ) )
) ;
2011-06-01 13:00:29 -04:00
2021-03-27 10:52:14 -04:00
items . push_back (
MenuElem ( _ ( " Assign all tracks and busses (prefader) " ) , sigc : : bind ( sigc : : mem_fun ( * this , & RouteUI : : create_sends ) , PreFader , true ) )
) ;
2011-06-01 13:00:29 -04:00
2021-03-27 10:52:14 -04:00
items . push_back (
MenuElem ( _ ( " Assign all tracks (postfader) " ) , sigc : : bind ( sigc : : mem_fun ( * this , & RouteUI : : create_sends ) , PostFader , false ) )
) ;
2011-06-01 13:00:29 -04:00
2021-03-27 10:52:14 -04:00
items . push_back (
MenuElem ( _ ( " Assign all tracks and busses (postfader) " ) , sigc : : bind ( sigc : : mem_fun ( * this , & RouteUI : : create_sends ) , PostFader , true ) )
) ;
}
2010-12-29 17:07:34 -05:00
items . push_back (
MenuElem ( _ ( " Assign selected tracks (prefader) " ) , sigc : : bind ( sigc : : mem_fun ( * this , & RouteUI : : create_selected_sends ) , PreFader , false ) )
) ;
2021-03-27 10:52:14 -04:00
if ( ! is_foldbackbus ( ) ) {
items . push_back (
MenuElem ( _ ( " Assign selected tracks and busses (prefader) " ) , sigc : : bind ( sigc : : mem_fun ( * this , & RouteUI : : create_selected_sends ) , PreFader , true ) ) ) ;
}
2011-06-01 13:00:29 -04:00
2010-12-29 17:07:34 -05:00
items . push_back (
MenuElem ( _ ( " Assign selected tracks (postfader) " ) , sigc : : bind ( sigc : : mem_fun ( * this , & RouteUI : : create_selected_sends ) , PostFader , false ) )
) ;
2021-03-27 10:52:14 -04:00
if ( ! is_foldbackbus ( ) ) {
items . push_back (
MenuElem ( _ ( " Assign selected tracks and busses (postfader) " ) , sigc : : bind ( sigc : : mem_fun ( * this , & RouteUI : : create_selected_sends ) , PostFader , true ) )
) ;
}
items . push_back ( SeparatorElem ( ) ) ;
2011-06-01 13:00:29 -04:00
2010-12-29 16:07:22 -05:00
items . push_back ( MenuElem ( _ ( " Copy track/bus gains to sends " ) , sigc : : mem_fun ( * this , & RouteUI : : set_sends_gain_from_track ) ) ) ;
2013-07-09 18:02:35 -04:00
items . push_back ( MenuElem ( _ ( " Set sends gain to -inf " ) , sigc : : mem_fun ( * this , & RouteUI : : set_sends_gain_to_zero ) ) ) ;
2009-12-11 18:29:48 -05:00
items . push_back ( MenuElem ( _ ( " Set sends gain to 0dB " ) , sigc : : mem_fun ( * this , & RouteUI : : set_sends_gain_to_unity ) ) ) ;
2009-06-25 16:46:39 -04:00
}
void
2010-12-29 17:07:34 -05:00
RouteUI : : create_sends ( Placement p , bool include_buses )
2009-06-25 16:46:39 -04:00
{
2010-12-29 17:07:34 -05:00
_session - > globally_add_internal_sends ( _route , p , include_buses ) ;
2009-05-16 22:08:13 -04:00
}
2009-11-19 12:06:00 -05:00
void
2010-12-29 17:07:34 -05:00
RouteUI : : create_selected_sends ( Placement p , bool include_buses )
2009-11-19 12:06:00 -05:00
{
2023-02-16 18:33:28 -05:00
std : : shared_ptr < RouteList > rlist ( new RouteList ) ;
2009-11-19 12:06:00 -05:00
TrackSelection & selected_tracks ( ARDOUR_UI : : instance ( ) - > the_editor ( ) . get_selection ( ) . tracks ) ;
for ( TrackSelection : : iterator i = selected_tracks . begin ( ) ; i ! = selected_tracks . end ( ) ; + + i ) {
RouteTimeAxisView * rtv ;
RouteUI * rui ;
if ( ( rtv = dynamic_cast < RouteTimeAxisView * > ( * i ) ) ! = 0 ) {
if ( ( rui = dynamic_cast < RouteUI * > ( rtv ) ) ! = 0 ) {
2023-02-16 18:33:28 -05:00
if ( include_buses | | std : : dynamic_pointer_cast < AudioTrack > ( rui - > route ( ) ) ) {
2009-11-19 12:06:00 -05:00
rlist - > push_back ( rui - > route ( ) ) ;
}
}
}
}
2011-06-01 13:00:29 -04:00
2009-12-17 13:24:23 -05:00
_session - > add_internal_sends ( _route , p , rlist ) ;
2009-11-19 12:06:00 -05:00
}
2009-05-16 22:08:13 -04:00
void
RouteUI : : set_sends_gain_from_track ( )
{
2009-12-17 13:24:23 -05:00
_session - > globally_set_send_gains_from_track ( _route ) ;
2009-05-16 22:08:13 -04:00
}
void
RouteUI : : set_sends_gain_to_zero ( )
{
2009-12-17 13:24:23 -05:00
_session - > globally_set_send_gains_to_zero ( _route ) ;
2009-05-16 22:08:13 -04:00
}
void
RouteUI : : set_sends_gain_to_unity ( )
{
2009-12-17 13:24:23 -05:00
_session - > globally_set_send_gains_to_unity ( _route ) ;
2009-05-16 22:08:13 -04:00
}
bool
RouteUI : : show_sends_press ( GdkEventButton * ev )
{
2021-03-27 10:52:14 -04:00
if ( ev - > type = = GDK_2BUTTON_PRESS | | ev - > type = = GDK_3BUTTON_PRESS ) {
2009-05-16 22:08:13 -04:00
return true ;
}
2014-07-10 11:54:59 -04:00
if ( ! is_track ( ) & & show_sends_button ) {
2009-05-16 22:08:13 -04:00
if ( Keyboard : : is_button2_event ( ev ) & & Keyboard : : modifier_state_equals ( ev - > state , Keyboard : : PrimaryModifier ) ) {
2009-12-11 18:29:48 -05:00
// do nothing on midi sigc::bind event
2009-05-16 22:08:13 -04:00
return false ;
} else if ( Keyboard : : is_context_menu_event ( ev ) ) {
if ( sends_menu = = 0 ) {
build_sends_menu ( ) ;
}
2017-03-24 09:36:17 -04:00
sends_menu - > popup ( 0 , ev - > time ) ;
2009-05-16 22:08:13 -04:00
2021-03-27 10:52:14 -04:00
} else if ( ev - > button = = 1 ) {
2009-05-16 22:08:13 -04:00
2023-02-16 18:33:28 -05:00
std : : shared_ptr < Route > s = _showing_sends_to . lock ( ) ;
2009-05-17 13:05:56 -04:00
2011-11-02 20:42:16 -04:00
if ( s = = _route ) {
2023-02-16 18:33:28 -05:00
set_showing_sends_to ( std : : shared_ptr < Route > ( ) ) ;
Mixer_UI : : instance ( ) - > show_spill ( std : : shared_ptr < ARDOUR : : Stripable > ( ) ) ;
2009-05-16 22:08:13 -04:00
} else {
2011-11-02 20:42:16 -04:00
set_showing_sends_to ( _route ) ;
2020-03-23 16:13:39 -04:00
Mixer_UI : : instance ( ) - > show_spill ( _route ) ;
2009-05-16 22:08:13 -04:00
}
}
2021-03-27 10:52:14 -04:00
return true ;
2009-05-16 22:08:13 -04:00
}
2021-03-27 10:52:14 -04:00
return false ;
2009-05-16 22:08:13 -04:00
}
bool
2009-07-21 11:55:17 -04:00
RouteUI : : show_sends_release ( GdkEventButton * )
2009-05-16 22:08:13 -04:00
{
return true ;
}
2009-05-17 13:05:56 -04:00
void
RouteUI : : send_blink ( bool onoff )
{
if ( ! show_sends_button ) {
return ;
}
2009-10-14 12:10:01 -04:00
2009-05-17 13:05:56 -04:00
if ( onoff ) {
2012-02-07 12:43:55 -05:00
show_sends_button - > set_active_state ( Gtkmm2ext : : ExplicitActive ) ;
2009-05-17 13:05:56 -04:00
} else {
2011-11-02 20:42:16 -04:00
show_sends_button - > unset_active_state ( ) ;
2009-05-17 13:05:56 -04:00
}
}
2011-11-02 14:48:32 -04:00
Gtkmm2ext : : ActiveState
2023-02-16 18:33:28 -05:00
RouteUI : : solo_active_state ( std : : shared_ptr < Stripable > s )
2009-11-25 22:02:16 -05:00
{
2023-02-16 18:33:28 -05:00
std : : shared_ptr < SoloControl > sc = s - > solo_control ( ) ;
2016-05-21 16:36:08 -04:00
if ( ! sc ) {
2012-02-07 12:43:55 -05:00
return Gtkmm2ext : : Off ;
2009-12-10 15:51:35 -05:00
}
2011-06-01 13:00:29 -04:00
2016-05-21 16:36:08 -04:00
if ( ! sc - > can_solo ( ) ) {
return Gtkmm2ext : : Off ;
}
if ( sc - > self_soloed ( ) ) {
2016-04-21 02:02:13 -04:00
return Gtkmm2ext : : ExplicitActive ;
2016-05-21 16:36:08 -04:00
} else if ( sc - > soloed_by_others ( ) ) {
2016-04-21 02:02:13 -04:00
return Gtkmm2ext : : ImplicitActive ;
2009-11-25 22:02:16 -05:00
} else {
2012-02-07 12:43:55 -05:00
return Gtkmm2ext : : Off ;
2009-11-25 22:02:16 -05:00
}
2009-12-10 15:51:35 -05:00
}
2009-11-25 22:02:16 -05:00
2011-11-02 14:48:32 -04:00
Gtkmm2ext : : ActiveState
2023-02-16 18:33:28 -05:00
RouteUI : : solo_isolate_active_state ( std : : shared_ptr < Stripable > s )
2009-12-10 15:51:35 -05:00
{
2023-02-16 18:33:28 -05:00
std : : shared_ptr < SoloIsolateControl > sc = s - > solo_isolate_control ( ) ;
2016-05-21 16:36:08 -04:00
if ( ! sc ) {
return Gtkmm2ext : : Off ;
}
if ( s - > is_master ( ) | | s - > is_monitor ( ) ) {
2012-02-07 12:43:55 -05:00
return Gtkmm2ext : : Off ;
2009-12-10 15:51:35 -05:00
}
2011-06-01 13:00:29 -04:00
2016-05-21 16:36:08 -04:00
if ( sc - > solo_isolated ( ) ) {
2012-02-07 12:43:55 -05:00
return Gtkmm2ext : : ExplicitActive ;
2010-04-05 16:08:37 -04:00
} else {
2012-02-07 12:43:55 -05:00
return Gtkmm2ext : : Off ;
2010-04-05 16:08:37 -04:00
}
}
2011-11-02 14:48:32 -04:00
Gtkmm2ext : : ActiveState
2023-02-16 18:33:28 -05:00
RouteUI : : solo_safe_active_state ( std : : shared_ptr < Stripable > s )
2010-04-05 16:08:37 -04:00
{
2023-02-16 18:33:28 -05:00
std : : shared_ptr < SoloSafeControl > sc = s - > solo_safe_control ( ) ;
2016-05-21 16:36:08 -04:00
if ( ! sc ) {
2012-02-07 12:43:55 -05:00
return Gtkmm2ext : : Off ;
2010-04-05 16:08:37 -04:00
}
2011-06-01 13:00:29 -04:00
2016-05-21 16:36:08 -04:00
if ( s - > is_master ( ) | | s - > is_monitor ( ) ) {
return Gtkmm2ext : : Off ;
}
if ( sc - > solo_safe ( ) ) {
2012-02-07 12:43:55 -05:00
return Gtkmm2ext : : ExplicitActive ;
2009-12-10 15:51:35 -05:00
} else {
2012-02-07 12:43:55 -05:00
return Gtkmm2ext : : Off ;
2009-12-10 15:51:35 -05:00
}
2009-11-25 22:02:16 -05:00
}
2005-09-25 14:42:24 -04:00
void
RouteUI : : update_solo_display ( )
{
2016-04-08 16:49:47 -04:00
bool yn = _route - > solo_safe_control ( ) - > solo_safe ( ) ;
2010-04-20 08:38:37 -04:00
if ( solo_safe_check & & solo_safe_check - > get_active ( ) ! = yn ) {
solo_safe_check - > set_active ( yn ) ;
}
2016-04-08 16:49:47 -04:00
yn = _route - > solo_isolate_control ( ) - > solo_isolated ( ) ;
2010-04-20 08:38:37 -04:00
if ( solo_isolated_check & & solo_isolated_check - > get_active ( ) ! = yn ) {
solo_isolated_check - > set_active ( yn ) ;
}
2016-12-21 15:57:39 -05:00
set_button_names ( ) ;
2010-04-20 08:38:37 -04:00
2016-12-21 15:57:39 -05:00
if ( solo_isolated_led ) {
if ( _route - > solo_isolate_control ( ) - > solo_isolated ( ) ) {
2012-02-07 12:43:55 -05:00
solo_isolated_led - > set_active_state ( Gtkmm2ext : : ExplicitActive ) ;
2011-10-27 07:24:43 -04:00
} else {
solo_isolated_led - > unset_active_state ( ) ;
}
2016-12-21 15:57:39 -05:00
}
2010-05-05 16:29:46 -04:00
2016-12-21 15:57:39 -05:00
if ( solo_safe_led ) {
if ( _route - > solo_safe_control ( ) - > solo_safe ( ) ) {
2012-02-07 12:43:55 -05:00
solo_safe_led - > set_active_state ( Gtkmm2ext : : ExplicitActive ) ;
2011-10-27 07:24:43 -04:00
} else {
solo_safe_led - > unset_active_state ( ) ;
}
2016-12-21 15:57:39 -05:00
}
2010-05-05 16:29:46 -04:00
2011-11-02 14:48:32 -04:00
solo_button - > set_active_state ( solo_active_state ( _route ) ) ;
2011-06-01 13:00:29 -04:00
2016-12-21 15:57:39 -05:00
/* some changes to solo status can affect mute display, so catch up
*/
2010-05-21 10:43:47 -04:00
2016-04-10 18:20:11 -04:00
update_mute_display ( ) ;
2005-09-25 14:42:24 -04:00
}
2007-03-18 02:07:08 -04:00
void
RouteUI : : solo_changed_so_update_mute ( )
{
2010-03-10 12:31:16 -05:00
update_mute_display ( ) ;
2007-03-18 02:07:08 -04:00
}
2011-11-02 12:46:49 -04:00
ActiveState
2023-02-16 18:33:28 -05:00
RouteUI : : mute_active_state ( Session * , std : : shared_ptr < Stripable > s )
2009-11-25 22:02:16 -05:00
{
2023-02-16 18:33:28 -05:00
std : : shared_ptr < MuteControl > mc = s - > mute_control ( ) ;
2016-05-21 16:36:08 -04:00
if ( s - > is_monitor ( ) ) {
return Gtkmm2ext : : Off ;
}
if ( ! mc ) {
return Gtkmm2ext : : Off ;
2009-12-10 15:51:35 -05:00
}
2010-04-27 21:29:06 -04:00
2011-02-22 16:14:51 -05:00
if ( Config - > get_show_solo_mutes ( ) & & ! Config - > get_solo_control_is_listen_control ( ) ) {
2010-04-27 21:29:06 -04:00
2016-05-21 16:36:08 -04:00
if ( mc - > muted_by_self ( ) ) {
2009-11-25 22:02:16 -05:00
/* full mute */
2012-02-07 12:43:55 -05:00
return Gtkmm2ext : : ExplicitActive ;
2016-05-21 16:36:08 -04:00
} else if ( mc - > muted_by_others_soloing ( ) | | mc - > muted_by_masters ( ) ) {
2016-03-12 22:59:00 -05:00
/* this will reflect both solo mutes AND master mutes */
2012-02-07 12:43:55 -05:00
return Gtkmm2ext : : ImplicitActive ;
2009-11-25 22:02:16 -05:00
} else {
/* no mute at all */
2012-02-07 12:43:55 -05:00
return Gtkmm2ext : : Off ;
2009-11-25 22:02:16 -05:00
}
} else {
2016-05-21 16:36:08 -04:00
if ( mc - > muted_by_self ( ) ) {
2009-11-25 22:02:16 -05:00
/* full mute */
2012-02-07 12:43:55 -05:00
return Gtkmm2ext : : ExplicitActive ;
2016-05-21 16:36:08 -04:00
} else if ( mc - > muted_by_masters ( ) ) {
2016-04-15 00:38:03 -04:00
/* this shows only master mutes, not mute-by-others-soloing */
2016-03-12 22:59:00 -05:00
return Gtkmm2ext : : ImplicitActive ;
2009-11-25 22:02:16 -05:00
} else {
/* no mute at all */
2012-02-07 12:43:55 -05:00
return Gtkmm2ext : : Off ;
2009-11-25 22:02:16 -05:00
}
}
2011-11-02 12:46:49 -04:00
return ActiveState ( 0 ) ;
2009-11-25 22:02:16 -05:00
}
2005-09-25 14:42:24 -04:00
void
RouteUI : : update_mute_display ( )
{
2017-05-03 18:43:40 -04:00
if ( ! _route ) {
return ;
}
2010-03-10 12:31:16 -05:00
2017-05-03 18:43:40 -04:00
mute_button - > set_active_state ( mute_active_state ( _session , _route ) ) ;
2005-09-25 14:42:24 -04:00
}
2016-03-02 12:12:18 -05:00
2005-09-25 14:42:24 -04:00
void
2006-08-01 13:19:38 -04:00
RouteUI : : route_rec_enable_changed ( )
2005-09-25 14:42:24 -04:00
{
2016-07-04 09:27:28 -04:00
blink_rec_display ( true ) ; //this lets the button change "immediately" rather than wait for the next blink
2005-09-25 14:42:24 -04:00
}
void
RouteUI : : session_rec_enable_changed ( )
{
2016-07-04 09:27:28 -04:00
blink_rec_display ( true ) ; //this lets the button change "immediately" rather than wait for the next blink
2005-09-25 14:42:24 -04:00
}
void
2014-08-22 12:45:34 -04:00
RouteUI : : blink_rec_display ( bool blinkOn )
2005-09-25 14:42:24 -04:00
{
2010-03-10 12:31:16 -05:00
if ( ! rec_enable_button | | ! _route ) {
2009-12-19 15:26:31 -05:00
return ;
}
2016-04-08 16:49:47 -04:00
2023-02-16 18:33:28 -05:00
if ( std : : dynamic_pointer_cast < Send > ( _current_delivery ) ) {
2014-09-04 22:20:15 -04:00
return ;
}
2011-06-01 13:00:29 -04:00
2016-04-08 16:49:47 -04:00
if ( ! is_track ( ) ) {
return ;
}
if ( track ( ) - > rec_enable_control ( ) - > get_value ( ) ) {
2017-05-03 18:43:40 -04:00
switch ( _session - > record_status ( ) ) {
case Session : : Recording :
rec_enable_button - > set_active_state ( Gtkmm2ext : : ExplicitActive ) ;
break ;
case Session : : Disabled :
case Session : : Enabled :
if ( UIConfiguration : : instance ( ) . get_blink_rec_arm ( ) ) {
rec_enable_button - > set_active_state ( blinkOn ? Gtkmm2ext : : ExplicitActive : Gtkmm2ext : : Off ) ;
} else {
rec_enable_button - > set_active_state ( ImplicitActive ) ;
}
break ;
}
2021-03-27 12:44:34 -04:00
if ( _step_edit_item ) {
_step_edit_item - > set_sensitive ( false ) ;
2017-05-03 18:43:40 -04:00
}
2010-08-03 17:50:15 -04:00
2005-09-25 14:42:24 -04:00
} else {
2011-11-02 15:51:59 -04:00
rec_enable_button - > unset_active_state ( ) ;
2010-08-03 17:50:15 -04:00
2021-03-27 12:44:34 -04:00
if ( _step_edit_item ) {
_step_edit_item - > set_sensitive ( true ) ;
2017-05-03 18:43:40 -04:00
}
2005-09-25 14:42:24 -04:00
}
2011-06-01 13:00:29 -04:00
2009-12-07 20:52:49 -05:00
check_rec_enable_sensitivity ( ) ;
2005-09-25 14:42:24 -04:00
}
void
RouteUI : : build_solo_menu ( void )
{
using namespace Menu_Helpers ;
2009-10-14 12:10:01 -04:00
2005-09-25 14:42:24 -04:00
solo_menu = new Menu ;
solo_menu - > set_name ( " ArdourContextMenu " ) ;
MenuList & items = solo_menu - > items ( ) ;
2013-07-11 15:32:31 -04:00
Gtk : : CheckMenuItem * check ;
2005-09-25 14:42:24 -04:00
2013-07-11 15:32:31 -04:00
check = new Gtk : : CheckMenuItem ( _ ( " Solo Isolate " ) ) ;
2016-04-08 16:49:47 -04:00
check - > set_active ( _route - > solo_isolate_control ( ) - > solo_isolated ( ) ) ;
2009-12-11 18:29:48 -05:00
check - > signal_toggled ( ) . connect ( sigc : : bind ( sigc : : mem_fun ( * this , & RouteUI : : toggle_solo_isolated ) , check ) ) ;
2005-09-25 14:42:24 -04:00
items . push_back ( CheckMenuElem ( * check ) ) ;
2017-05-03 18:43:40 -04:00
solo_isolated_check = dynamic_cast < Gtk : : CheckMenuItem * > ( & items . back ( ) ) ;
2005-09-25 14:42:24 -04:00
check - > show_all ( ) ;
2022-06-17 10:47:48 -04:00
check = new Gtk : : CheckMenuItem ( _ ( " Solo Safe (Locked) " ) ) ;
2016-04-08 16:49:47 -04:00
check - > set_active ( _route - > solo_safe_control ( ) - > solo_safe ( ) ) ;
2009-12-11 18:29:48 -05:00
check - > signal_toggled ( ) . connect ( sigc : : bind ( sigc : : mem_fun ( * this , & RouteUI : : toggle_solo_safe ) , check ) ) ;
2009-11-21 14:33:09 -05:00
items . push_back ( CheckMenuElem ( * check ) ) ;
2017-05-03 18:43:40 -04:00
solo_safe_check = dynamic_cast < Gtk : : CheckMenuItem * > ( & items . back ( ) ) ;
2009-11-21 14:33:09 -05:00
check - > show_all ( ) ;
2005-09-25 14:42:24 -04:00
}
void
RouteUI : : build_mute_menu ( void )
{
using namespace Menu_Helpers ;
2009-10-14 12:10:01 -04:00
2005-09-25 14:42:24 -04:00
mute_menu = new Menu ;
mute_menu - > set_name ( " ArdourContextMenu " ) ;
2009-06-09 16:21:19 -04:00
2005-09-25 14:42:24 -04:00
MenuList & items = mute_menu - > items ( ) ;
2014-02-19 23:44:53 -05:00
pre_fader_mute_check = manage ( new Gtk : : CheckMenuItem ( _ ( " Pre Fader Sends " ) ) ) ;
2009-11-18 08:25:13 -05:00
init_mute_menu ( MuteMaster : : PreFader , pre_fader_mute_check ) ;
2009-12-11 18:29:48 -05:00
pre_fader_mute_check - > signal_toggled ( ) . connect ( sigc : : bind ( sigc : : mem_fun ( * this , & RouteUI : : toggle_mute_menu ) , MuteMaster : : PreFader , pre_fader_mute_check ) ) ;
2009-11-18 08:25:13 -05:00
items . push_back ( CheckMenuElem ( * pre_fader_mute_check ) ) ;
pre_fader_mute_check - > show_all ( ) ;
2014-02-19 23:44:53 -05:00
post_fader_mute_check = manage ( new Gtk : : CheckMenuItem ( _ ( " Post Fader Sends " ) ) ) ;
2009-11-18 08:25:13 -05:00
init_mute_menu ( MuteMaster : : PostFader , post_fader_mute_check ) ;
2009-12-11 18:29:48 -05:00
post_fader_mute_check - > signal_toggled ( ) . connect ( sigc : : bind ( sigc : : mem_fun ( * this , & RouteUI : : toggle_mute_menu ) , MuteMaster : : PostFader , post_fader_mute_check ) ) ;
2009-11-18 08:25:13 -05:00
items . push_back ( CheckMenuElem ( * post_fader_mute_check ) ) ;
post_fader_mute_check - > show_all ( ) ;
2013-07-11 15:32:31 -04:00
listen_mute_check = manage ( new Gtk : : CheckMenuItem ( _ ( " Control Outs " ) ) ) ;
2009-11-18 08:25:13 -05:00
init_mute_menu ( MuteMaster : : Listen , listen_mute_check ) ;
2009-12-11 18:29:48 -05:00
listen_mute_check - > signal_toggled ( ) . connect ( sigc : : bind ( sigc : : mem_fun ( * this , & RouteUI : : toggle_mute_menu ) , MuteMaster : : Listen , listen_mute_check ) ) ;
2009-11-18 08:25:13 -05:00
items . push_back ( CheckMenuElem ( * listen_mute_check ) ) ;
listen_mute_check - > show_all ( ) ;
2013-07-11 15:32:31 -04:00
main_mute_check = manage ( new Gtk : : CheckMenuItem ( _ ( " Main Outs " ) ) ) ;
2009-11-18 08:25:13 -05:00
init_mute_menu ( MuteMaster : : Main , main_mute_check ) ;
2009-12-11 18:29:48 -05:00
main_mute_check - > signal_toggled ( ) . connect ( sigc : : bind ( sigc : : mem_fun ( * this , & RouteUI : : toggle_mute_menu ) , MuteMaster : : Main , main_mute_check ) ) ;
2009-11-18 08:25:13 -05:00
items . push_back ( CheckMenuElem ( * main_mute_check ) ) ;
main_mute_check - > show_all ( ) ;
2005-09-25 14:42:24 -04:00
2010-03-30 11:18:43 -04:00
_route - > mute_points_changed . connect ( route_connections , invalidator ( * this ) , boost : : bind ( & RouteUI : : muting_change , this ) , gui_context ( ) ) ;
2005-09-25 14:42:24 -04:00
}
void
2013-07-11 15:32:31 -04:00
RouteUI : : init_mute_menu ( MuteMaster : : MutePoint mp , Gtk : : CheckMenuItem * check )
2005-09-25 14:42:24 -04:00
{
2016-04-08 16:49:47 -04:00
check - > set_active ( _route - > mute_control ( ) - > mute_points ( ) & mp ) ;
2009-11-18 08:25:13 -05:00
}
void
RouteUI : : toggle_mute_menu ( MuteMaster : : MutePoint mp , Gtk : : CheckMenuItem * check )
{
if ( check - > get_active ( ) ) {
2016-04-08 16:49:47 -04:00
_route - > mute_control ( ) - > set_mute_points ( MuteMaster : : MutePoint ( _route - > mute_control ( ) - > mute_points ( ) | mp ) ) ;
2009-11-18 08:25:13 -05:00
} else {
2016-04-08 16:49:47 -04:00
_route - > mute_control ( ) - > set_mute_points ( MuteMaster : : MutePoint ( _route - > mute_control ( ) - > mute_points ( ) & ~ mp ) ) ;
2009-11-18 08:25:13 -05:00
}
2005-09-25 14:42:24 -04:00
}
void
2009-11-18 08:25:13 -05:00
RouteUI : : muting_change ( )
2005-09-25 14:42:24 -04:00
{
2009-12-11 18:29:48 -05:00
ENSURE_GUI_THREAD ( * this , & RouteUI : : muting_change )
2009-11-18 08:25:13 -05:00
bool yn ;
2016-04-08 16:49:47 -04:00
MuteMaster : : MutePoint current = _route - > mute_control ( ) - > mute_points ( ) ;
2009-11-18 08:25:13 -05:00
yn = ( current & MuteMaster : : PreFader ) ;
if ( pre_fader_mute_check - > get_active ( ) ! = yn ) {
pre_fader_mute_check - > set_active ( yn ) ;
}
yn = ( current & MuteMaster : : PostFader ) ;
if ( post_fader_mute_check - > get_active ( ) ! = yn ) {
post_fader_mute_check - > set_active ( yn ) ;
}
yn = ( current & MuteMaster : : Listen ) ;
if ( listen_mute_check - > get_active ( ) ! = yn ) {
listen_mute_check - > set_active ( yn ) ;
}
yn = ( current & MuteMaster : : Main ) ;
if ( main_mute_check - > get_active ( ) ! = yn ) {
main_mute_check - > set_active ( yn ) ;
}
2005-09-25 14:42:24 -04:00
}
2010-05-05 16:29:46 -04:00
bool
RouteUI : : solo_isolate_button_release ( GdkEventButton * ev )
{
2014-06-28 20:52:56 -04:00
if ( ev - > type = = GDK_2BUTTON_PRESS | | ev - > type = = GDK_3BUTTON_PRESS ) {
return true ;
}
2010-05-06 14:40:37 -04:00
2014-06-28 20:52:56 -04:00
bool view = solo_isolated_led - > active_state ( ) ;
2016-04-08 16:49:47 -04:00
bool model = _route - > solo_isolate_control ( ) - > solo_isolated ( ) ;
2010-05-05 17:10:09 -04:00
2014-06-28 20:52:56 -04:00
/* called BEFORE the view has changed */
2010-05-05 17:10:09 -04:00
2014-06-28 20:52:56 -04:00
if ( ev - > button = = 1 ) {
if ( Keyboard : : modifier_state_equals ( ev - > state , Keyboard : : ModifierMask ( Keyboard : : PrimaryModifier | Keyboard : : TertiaryModifier ) ) ) {
2010-05-06 14:40:37 -04:00
2014-06-28 20:52:56 -04:00
if ( model ) {
/* disable isolate for all routes */
2016-05-27 16:13:10 -04:00
_session - > set_controls ( route_list_to_control_list ( _session - > get_routes ( ) , & Stripable : : solo_isolate_control ) , 0.0 , Controllable : : NoGroup ) ;
2015-07-16 10:08:09 -04:00
} else {
/* enable isolate for all routes */
2016-05-27 16:13:10 -04:00
_session - > set_controls ( route_list_to_control_list ( _session - > get_routes ( ) , & Stripable : : solo_isolate_control ) , 1.0 , Controllable : : NoGroup ) ;
2014-06-28 20:52:56 -04:00
}
2010-05-06 14:40:37 -04:00
2014-06-28 20:52:56 -04:00
} else {
2015-07-16 10:08:09 -04:00
2014-06-28 20:52:56 -04:00
if ( model = = view ) {
2023-07-31 15:36:25 -04:00
StripableList sl ;
_session - > selection ( ) . get_stripables_for_op ( sl , _route , & RouteGroup : : is_solo ) ;
_session - > set_controls ( stripable_list_to_control_list ( sl , & Stripable : : solo_isolate_control ) , view ? 0.0 : 1.0 , Controllable : : NoGroup ) ;
2014-06-28 20:52:56 -04:00
}
}
}
2010-05-05 17:10:09 -04:00
2014-08-28 11:31:57 -04:00
return false ;
2010-05-05 16:29:46 -04:00
}
bool
2012-05-21 06:10:26 -04:00
RouteUI : : solo_safe_button_release ( GdkEventButton * ev )
2010-05-05 16:29:46 -04:00
{
2015-09-28 12:38:33 -04:00
if ( ev - > type = = GDK_2BUTTON_PRESS | | ev - > type = = GDK_3BUTTON_PRESS ) {
return true ;
}
bool view = solo_safe_led - > active_state ( ) ;
2016-04-08 16:49:47 -04:00
bool model = _route - > solo_safe_control ( ) - > solo_safe ( ) ;
2015-09-28 12:38:33 -04:00
2012-05-21 06:10:26 -04:00
if ( ev - > button = = 1 ) {
2023-07-29 17:47:46 -04:00
2015-09-28 12:38:33 -04:00
if ( Keyboard : : modifier_state_equals ( ev - > state , Keyboard : : ModifierMask ( Keyboard : : PrimaryModifier | Keyboard : : TertiaryModifier ) ) ) {
2023-07-29 17:47:46 -04:00
2023-04-07 17:33:13 -04:00
std : : shared_ptr < RouteList const > rl ( _session - > get_routes ( ) ) ;
2023-07-29 17:47:46 -04:00
/* toggle solo safe for all routes */
_session - > set_controls ( route_list_to_control_list ( rl , & Stripable : : solo_safe_control ) , model ? 0.0 : 1.0 , Controllable : : NoGroup ) ;
} else {
2015-09-28 12:38:33 -04:00
if ( model = = view ) {
2023-07-31 15:36:25 -04:00
StripableList sl ;
_session - > selection ( ) . get_stripables_for_op ( sl , _route , & RouteGroup : : is_solo ) ;
_session - > set_controls ( stripable_list_to_control_list ( sl , & Stripable : : solo_safe_control ) , view ? 0.0 : 1.0 , Controllable : : NoGroup ) ;
2015-09-28 12:38:33 -04:00
}
}
2012-05-21 06:10:26 -04:00
}
2015-09-28 12:38:33 -04:00
2012-05-21 06:10:26 -04:00
return false ;
2010-05-05 16:29:46 -04:00
}
2005-09-25 14:42:24 -04:00
void
2009-06-09 16:21:19 -04:00
RouteUI : : toggle_solo_isolated ( Gtk : : CheckMenuItem * check )
2005-09-25 14:42:24 -04:00
{
2017-05-03 18:43:40 -04:00
bool view = check - > get_active ( ) ;
bool model = _route - > solo_isolate_control ( ) - > solo_isolated ( ) ;
2010-05-05 17:10:09 -04:00
2017-05-03 18:43:40 -04:00
/* called AFTER the view has changed */
2010-05-05 17:10:09 -04:00
2017-05-03 18:43:40 -04:00
if ( model ! = view ) {
_route - > solo_isolate_control ( ) - > set_value ( view ? 1.0 : 0.0 , Controllable : : UseGroup ) ;
}
2005-09-25 14:42:24 -04:00
}
2009-11-21 14:33:09 -05:00
void
RouteUI : : toggle_solo_safe ( Gtk : : CheckMenuItem * check )
{
2016-04-08 16:49:47 -04:00
_route - > solo_safe_control ( ) - > set_value ( check - > get_active ( ) ? 1.0 : 0.0 , Controllable : : UseGroup ) ;
2009-11-21 14:33:09 -05:00
}
2017-09-09 12:25:36 -04:00
void
RouteUI : : delete_patch_change_dialog ( )
{
if ( ! _route ) {
return ;
}
delete _route - > patch_selector_dialog ( ) ;
_route - > set_patch_selector_dialog ( 0 ) ;
}
PatchChangeGridDialog *
RouteUI : : patch_change_dialog ( ) const
{
return _route - > patch_selector_dialog ( ) ;
}
void
RouteUI : : select_midi_patch ( )
{
if ( patch_change_dialog ( ) ) {
patch_change_dialog ( ) - > present ( ) ;
return ;
}
/* note: RouteTimeAxisView is resoponsible to updating
* the Dialog ( PatchChangeGridDialog : : refresh ( ) )
* when the midnam model changes .
*/
PatchChangeGridDialog * d = new PatchChangeGridDialog ( _route ) ;
_route - > set_patch_selector_dialog ( d ) ;
d - > present ( ) ;
}
2017-05-03 18:43:40 -04:00
/** Ask the user to choose a colour, and then apply that color to my route */
2011-02-22 20:03:51 -05:00
void
2011-02-22 20:03:37 -05:00
RouteUI : : choose_color ( )
2005-09-25 14:42:24 -04:00
{
2017-03-10 17:51:39 -05:00
_color_picker . popup ( _route ) ;
2005-09-25 14:42:24 -04:00
}
2011-08-30 11:44:00 -04:00
/** Set the route's own color. This may not be used for display if
* the route is in a group which shares its color with its routes .
*/
2005-09-25 14:42:24 -04:00
void
2016-06-05 15:26:12 -04:00
RouteUI : : set_color ( uint32_t c )
2005-09-25 14:42:24 -04:00
{
2016-06-05 15:26:12 -04:00
_route - > presentation_info ( ) . set_color ( c ) ;
2005-09-25 14:42:24 -04:00
}
2011-08-30 11:44:00 -04:00
/** @return GUI state ID for things that are common to the route in all its representations */
string
RouteUI : : route_state_id ( ) const
{
return string_compose ( X_ ( " route %1 " ) , _route - > id ( ) . to_s ( ) ) ;
}
2011-07-06 20:37:13 -04:00
int
RouteUI : : set_color_from_route ( )
2005-09-25 14:42:24 -04:00
{
2016-07-01 18:03:29 -04:00
if ( _route - > presentation_info ( ) . color_set ( ) ) {
return 0 ; /* nothing to do */
}
return 1 ; /* pick a color */
2005-09-25 14:42:24 -04:00
}
2011-08-03 09:28:36 -04:00
/** @return true if this name should be used for the route, otherwise false */
2011-07-25 22:07:59 -04:00
bool
RouteUI : : verify_new_route_name ( const std : : string & name )
{
2011-09-16 07:39:18 -04:00
if ( name . find ( ' : ' ) = = string : : npos ) {
2011-08-03 09:28:36 -04:00
return true ;
}
2015-10-05 10:17:49 -04:00
2011-08-03 09:28:36 -04:00
MessageDialog colon_msg (
_ ( " The use of colons (':') is discouraged in track and bus names. \n Do you want to use this new name? " ) ,
false , MESSAGE_QUESTION , BUTTONS_NONE
) ;
2015-10-05 10:17:49 -04:00
2011-08-03 09:28:36 -04:00
colon_msg . add_button ( _ ( " Use the new name " ) , Gtk : : RESPONSE_ACCEPT ) ;
colon_msg . add_button ( _ ( " Re-edit the name " ) , Gtk : : RESPONSE_CANCEL ) ;
2011-07-25 22:07:59 -04:00
2011-08-03 09:28:36 -04:00
return ( colon_msg . run ( ) = = Gtk : : RESPONSE_ACCEPT ) ;
2011-07-25 22:07:59 -04:00
}
2005-09-25 14:42:24 -04:00
void
RouteUI : : route_rename ( )
{
2017-07-16 23:18:48 -04:00
ArdourWidgets : : Prompter name_prompter ( true ) ;
2005-10-26 21:10:36 -04:00
string result ;
2011-07-25 22:07:59 -04:00
bool done = false ;
2010-05-06 20:18:47 -04:00
if ( is_track ( ) ) {
name_prompter . set_title ( _ ( " Rename Track " ) ) ;
} else {
name_prompter . set_title ( _ ( " Rename Bus " ) ) ;
}
name_prompter . set_prompt ( _ ( " New name: " ) ) ;
2006-07-27 21:08:57 -04:00
name_prompter . set_initial_text ( _route - > name ( ) ) ;
2006-04-19 16:42:17 -04:00
name_prompter . add_button ( _ ( " Rename " ) , Gtk : : RESPONSE_ACCEPT ) ;
2006-04-22 11:28:59 -04:00
name_prompter . set_response_sensitive ( Gtk : : RESPONSE_ACCEPT , false ) ;
2005-09-25 14:42:24 -04:00
name_prompter . show_all ( ) ;
2011-07-25 22:07:59 -04:00
while ( ! done ) {
switch ( name_prompter . run ( ) ) {
case Gtk : : RESPONSE_ACCEPT :
name_prompter . get_result ( result ) ;
name_prompter . hide ( ) ;
if ( result . length ( ) ) {
if ( verify_new_route_name ( result ) ) {
_route - > set_name ( result ) ;
done = true ;
} else {
/* back to name prompter */
}
} else {
/* nothing entered, just get out of here */
done = true ;
}
break ;
2011-12-01 14:33:28 -05:00
default :
done = true ;
break ;
2009-10-14 12:10:01 -04:00
}
2005-09-25 14:42:24 -04:00
}
2005-10-26 21:10:36 -04:00
return ;
2009-10-14 12:10:01 -04:00
2005-09-25 14:42:24 -04:00
}
2014-07-29 17:40:19 -04:00
void
RouteUI : : toggle_comment_editor ( )
{
2022-01-26 15:21:06 -05:00
if ( _comment_window & & _comment_window - > get_visible ( ) ) {
2021-03-27 12:44:34 -04:00
_comment_window - > hide ( ) ;
2014-07-29 17:40:19 -04:00
} else {
open_comment_editor ( ) ;
}
}
void
RouteUI : : open_comment_editor ( )
{
2021-03-27 12:44:34 -04:00
if ( _comment_window = = 0 ) {
2014-07-29 17:40:19 -04:00
setup_comment_editor ( ) ;
}
string title ;
title = _route - > name ( ) ;
title + = _ ( " : comment editor " ) ;
2021-03-27 12:44:34 -04:00
_comment_window - > set_title ( title ) ;
_comment_window - > present ( ) ;
2014-07-29 17:40:19 -04:00
}
void
RouteUI : : setup_comment_editor ( )
{
2021-03-27 12:44:34 -04:00
_comment_window = new ArdourWindow ( " " ) ; // title will be reset to show route
_comment_window - > set_skip_taskbar_hint ( true ) ;
_comment_window - > signal_hide ( ) . connect ( sigc : : mem_fun ( * this , & MixerStrip : : comment_editor_done_editing ) ) ;
_comment_window - > set_default_size ( 400 , 200 ) ;
2014-07-29 17:40:19 -04:00
2021-03-27 12:44:34 -04:00
_comment_area = manage ( new TextView ( ) ) ;
_comment_area - > set_name ( " MixerTrackCommentArea " ) ;
_comment_area - > set_wrap_mode ( WRAP_WORD ) ;
_comment_area - > set_editable ( true ) ;
_comment_area - > get_buffer ( ) - > set_text ( _route - > comment ( ) ) ;
_comment_area - > show ( ) ;
2014-07-29 17:40:19 -04:00
2021-03-27 12:44:34 -04:00
_comment_window - > add ( * _comment_area ) ;
2014-07-29 17:40:19 -04:00
}
void
2016-01-21 11:03:14 -05:00
RouteUI : : comment_changed ( )
2014-07-29 17:40:19 -04:00
{
2021-03-27 11:25:30 -04:00
_ignore_comment_edit = true ;
2021-03-27 12:44:34 -04:00
if ( _comment_area ) {
_comment_area - > get_buffer ( ) - > set_text ( _route - > comment ( ) ) ;
2014-07-29 17:40:19 -04:00
}
2021-03-27 11:25:30 -04:00
_ignore_comment_edit = false ;
2014-07-29 17:40:19 -04:00
}
void
RouteUI : : comment_editor_done_editing ( )
{
2014-08-22 12:45:34 -04:00
ENSURE_GUI_THREAD ( * this , & MixerStrip : : comment_editor_done_editing , src )
2021-03-27 12:44:34 -04:00
string const str = _comment_area - > get_buffer ( ) - > get_text ( ) ;
2014-07-29 17:40:19 -04:00
if ( str = = _route - > comment ( ) ) {
return ;
}
_route - > set_comment ( str , this ) ;
}
2005-09-25 14:42:24 -04:00
void
2011-03-07 08:04:46 -05:00
RouteUI : : set_route_active ( bool a , bool apply_to_selection )
2005-09-25 14:42:24 -04:00
{
2011-03-07 08:04:46 -05:00
if ( apply_to_selection ) {
2020-09-11 14:10:30 -04:00
ARDOUR_UI : : instance ( ) - > the_editor ( ) . get_selection ( ) . tracks . foreach_route_ui ( boost : : bind ( & RouteUI : : set_route_active , _1 , a , false ) ) ;
2022-01-26 11:19:54 -05:00
} else if ( ! is_master ( )
# ifdef MIXBUS
& & ! _route - > mixbus ( )
# endif
) {
2011-03-07 08:04:46 -05:00
_route - > set_active ( a , this ) ;
2005-09-25 14:42:24 -04:00
}
}
2015-11-17 17:55:11 -05:00
void
RouteUI : : duplicate_selected_routes ( )
{
ARDOUR_UI : : instance ( ) - > start_duplicate_routes ( ) ;
}
2007-05-31 22:27:21 -04:00
void
RouteUI : : toggle_denormal_protection ( )
{
if ( denormal_menu_item ) {
bool x ;
2009-12-11 18:29:48 -05:00
ENSURE_GUI_THREAD ( * this , & RouteUI : : toggle_denormal_protection )
2009-10-14 12:10:01 -04:00
2007-05-31 22:27:21 -04:00
if ( ( x = denormal_menu_item - > get_active ( ) ) ! = _route - > denormal_protection ( ) ) {
2009-06-10 14:10:07 -04:00
_route - > set_denormal_protection ( x ) ;
2007-05-31 22:27:21 -04:00
}
}
}
void
RouteUI : : denormal_protection_changed ( )
{
2009-06-10 14:10:07 -04:00
if ( denormal_menu_item ) {
denormal_menu_item - > set_active ( _route - > denormal_protection ( ) ) ;
}
2007-05-31 22:27:21 -04:00
}
2005-09-25 14:42:24 -04:00
void
RouteUI : : disconnect_input ( )
{
2009-06-09 16:21:19 -04:00
_route - > input ( ) - > disconnect ( this ) ;
2005-09-25 14:42:24 -04:00
}
void
RouteUI : : disconnect_output ( )
{
2009-06-09 16:21:19 -04:00
_route - > output ( ) - > disconnect ( this ) ;
2005-09-25 14:42:24 -04:00
}
2006-07-23 08:03:19 -04:00
bool
RouteUI : : is_track ( ) const
{
2023-02-16 18:33:28 -05:00
return std : : dynamic_pointer_cast < Track > ( _route ) ! = 0 ;
2006-07-23 08:03:19 -04:00
}
2020-07-22 17:55:01 -04:00
bool
RouteUI : : is_master ( ) const
{
return _route & & _route - > is_master ( ) ;
}
2021-03-27 10:52:14 -04:00
bool
RouteUI : : is_foldbackbus ( ) const
{
return _route & & _route - > is_foldbackbus ( ) ;
}
2023-02-16 18:33:28 -05:00
std : : shared_ptr < Track >
2006-07-27 21:08:57 -04:00
RouteUI : : track ( ) const
2005-09-25 14:42:24 -04:00
{
2023-02-16 18:33:28 -05:00
return std : : dynamic_pointer_cast < Track > ( _route ) ;
2005-09-25 14:42:24 -04:00
}
2006-07-05 15:47:25 -04:00
bool
2006-07-27 21:08:57 -04:00
RouteUI : : is_audio_track ( ) const
2006-07-05 15:47:25 -04:00
{
2023-02-16 18:33:28 -05:00
return std : : dynamic_pointer_cast < AudioTrack > ( _route ) ! = 0 ;
2006-07-05 15:47:25 -04:00
}
2023-02-16 18:33:28 -05:00
std : : shared_ptr < AudioTrack >
2006-07-27 21:08:57 -04:00
RouteUI : : audio_track ( ) const
2005-09-25 14:42:24 -04:00
{
2023-02-16 18:33:28 -05:00
return std : : dynamic_pointer_cast < AudioTrack > ( _route ) ;
2005-09-25 14:42:24 -04:00
}
2006-07-27 21:08:57 -04:00
bool
RouteUI : : is_midi_track ( ) const
2005-09-25 14:42:24 -04:00
{
2023-02-16 18:33:28 -05:00
return std : : dynamic_pointer_cast < MidiTrack > ( _route ) ! = 0 ;
2005-09-25 14:42:24 -04:00
}
2006-07-05 15:47:25 -04:00
2023-02-16 18:33:28 -05:00
std : : shared_ptr < MidiTrack >
2006-07-05 15:47:25 -04:00
RouteUI : : midi_track ( ) const
{
2023-02-16 18:33:28 -05:00
return std : : dynamic_pointer_cast < MidiTrack > ( _route ) ;
2006-07-05 15:47:25 -04:00
}
2010-08-09 20:09:25 -04:00
bool
RouteUI : : has_audio_outputs ( ) const
{
return ( _route - > n_outputs ( ) . n_audio ( ) > 0 ) ;
}
2005-09-25 14:42:24 -04:00
void
RouteUI : : map_frozen ( )
{
2009-12-11 18:29:48 -05:00
ENSURE_GUI_THREAD ( * this , & RouteUI : : map_frozen )
2005-09-25 14:42:24 -04:00
2016-01-25 22:08:47 -05:00
AudioTrack * at = dynamic_cast < AudioTrack * > ( _route . get ( ) ) ;
2005-09-25 14:42:24 -04:00
if ( at ) {
2016-05-23 21:01:27 -04:00
check_rec_enable_sensitivity ( ) ;
2005-09-25 14:42:24 -04:00
}
}
2006-07-27 21:08:57 -04:00
2017-08-19 07:49:33 -04:00
void
RouteUI : : save_as_template_dialog_response ( int response , SaveTemplateDialog * d )
{
if ( response = = RESPONSE_ACCEPT ) {
const string name = d - > get_template_name ( ) ;
const string desc = d - > get_description ( ) ;
2022-05-14 22:37:03 -04:00
const string path = Glib : : build_filename ( ARDOUR : : user_route_template_directory ( ) , legalize_for_path ( name ) + ARDOUR : : template_suffix ) ;
2015-11-01 15:00:05 -05:00
2017-08-19 07:49:33 -04:00
if ( Glib : : file_test ( path , Glib : : FILE_TEST_EXISTS ) ) { /* file already exists. */
bool overwrite = overwrite_file_dialog ( * d ,
_ ( " Confirm Template Overwrite " ) ,
_ ( " A template already exists with that name. Do you want to overwrite it? " ) ) ;
2015-10-12 06:29:16 -04:00
2017-08-19 07:49:33 -04:00
if ( ! overwrite ) {
d - > show ( ) ;
return ;
}
2015-10-12 06:29:16 -04:00
}
2017-08-19 07:49:33 -04:00
_route - > save_as_template ( path , name , desc ) ;
2015-10-12 06:29:16 -04:00
}
2009-10-14 12:10:01 -04:00
2017-08-19 07:49:33 -04:00
delete d ;
2015-11-01 15:00:05 -05:00
}
void
RouteUI : : save_as_template ( )
{
2017-08-19 08:52:14 -04:00
const std : : string dir = ARDOUR : : user_route_template_directory ( ) ;
2015-11-01 15:00:05 -05:00
if ( g_mkdir_with_parents ( dir . c_str ( ) , 0755 ) ) {
2020-05-24 13:20:45 -04:00
error < < string_compose ( _ ( " Cannot create template directory %1 " ) , dir ) < < endmsg ;
2015-11-01 15:00:05 -05:00
return ;
}
2017-08-19 08:52:38 -04:00
SaveTemplateDialog * d = new SaveTemplateDialog ( _route - > name ( ) , _route - > comment ( ) ) ;
2017-08-19 07:49:33 -04:00
d - > signal_response ( ) . connect ( sigc : : bind ( sigc : : mem_fun ( * this , & RouteUI : : save_as_template_dialog_response ) , d ) ) ;
d - > show ( ) ;
2009-03-02 13:08:15 -05:00
}
2009-06-14 09:44:26 -04:00
void
RouteUI : : check_rec_enable_sensitivity ( )
{
2016-05-23 21:01:27 -04:00
if ( ! rec_enable_button ) {
assert ( 0 ) ; // This should not happen
return ;
}
if ( ! _session - > writable ( ) ) {
rec_enable_button - > set_sensitive ( false ) ;
return ;
}
2011-11-02 15:51:59 -04:00
if ( _session - > transport_rolling ( ) & & rec_enable_button - > active_state ( ) & & Config - > get_disable_disarm_during_roll ( ) ) {
2009-06-14 09:44:26 -04:00
rec_enable_button - > set_sensitive ( false ) ;
2016-05-24 15:30:33 -04:00
} else if ( is_audio_track ( ) & & track ( ) - > freeze_state ( ) = = AudioTrack : : Frozen ) {
2016-05-23 21:01:27 -04:00
rec_enable_button - > set_sensitive ( false ) ;
2009-06-14 09:44:26 -04:00
} else {
2016-05-24 15:30:33 -04:00
rec_enable_button - > set_sensitive ( true ) ;
}
2016-05-27 16:13:10 -04:00
if ( _route & & _route - > rec_safe_control ( ) & & _route - > rec_safe_control ( ) - > get_value ( ) ) {
2016-05-24 15:30:33 -04:00
rec_enable_button - > set_visual_state ( Gtkmm2ext : : VisualState ( solo_button - > visual_state ( ) | Gtkmm2ext : : Insensitive ) ) ;
} else {
rec_enable_button - > set_visual_state ( Gtkmm2ext : : VisualState ( solo_button - > visual_state ( ) & ~ Gtkmm2ext : : Insensitive ) ) ;
2009-06-14 09:44:26 -04:00
}
2011-10-21 11:05:33 -04:00
update_monitoring_display ( ) ;
2009-06-14 09:44:26 -04:00
}
2009-06-14 13:56:29 -04:00
2021-03-24 13:16:43 -04:00
void
RouteUI : : update_solo_button ( )
{
set_button_names ( ) ;
2022-06-17 09:04:47 -04:00
std : : string tip ;
2021-03-24 13:16:43 -04:00
if ( Config - > get_solo_control_is_listen_control ( ) ) {
2022-06-17 09:04:47 -04:00
tip = string_compose ( _ ( " Listen to this track \n "
2022-06-21 13:51:14 -04:00
" %2+Click to Override Group \n "
2022-06-17 09:04:47 -04:00
" %1+%3+Click to toggle ALL tracks \n "
" %4 for Momentary listen \n "
" Right-Click for Context menu " )
2022-06-21 13:51:14 -04:00
, Keyboard : : primary_modifier_short_name ( ) , Keyboard : : group_override_event_name ( ) , Keyboard : : tertiary_modifier_short_name ( ) , Keyboard : : momentary_push_name ( ) ) ;
2021-03-24 13:16:43 -04:00
} else {
2022-06-17 09:04:47 -04:00
tip = string_compose ( _ ( " Solo this track \n "
2022-06-21 13:51:14 -04:00
" %2+Click to Override Group \n "
" %1+%5+Click for Exclusive solo \n "
2022-06-17 09:04:47 -04:00
" %1+%3+Click to toggle ALL tracks \n "
" %4 for Momentary solo \n "
" Right-Click for Context menu " )
2022-06-21 13:51:14 -04:00
, Keyboard : : primary_modifier_short_name ( ) , Keyboard : : group_override_event_name ( ) , Keyboard : : tertiary_modifier_short_name ( ) , Keyboard : : momentary_push_name ( ) , Keyboard : : secondary_modifier_short_name ( ) ) ;
2022-06-17 09:04:47 -04:00
}
UI : : instance ( ) - > set_tip ( solo_button , tip . c_str ( ) ) ;
2021-03-24 13:16:43 -04:00
}
2009-06-14 13:56:29 -04:00
void
RouteUI : : parameter_changed ( string const & p )
{
2011-10-21 11:05:33 -04:00
/* this handles RC and per-session parameter changes */
2009-06-14 13:56:29 -04:00
if ( p = = " disable-disarm-during-roll " ) {
check_rec_enable_sensitivity ( ) ;
2019-03-01 10:51:08 -05:00
} else if ( p = = " solo-control-is-listen-control " | | p = = " listen-position " ) {
2021-03-24 13:16:43 -04:00
update_solo_button ( ) ;
2017-01-16 13:54:20 -05:00
} else if ( p = = " session-monitoring " ) {
update_monitoring_display ( ) ;
2011-10-21 11:05:33 -04:00
} else if ( p = = " auto-input " ) {
update_monitoring_display ( ) ;
2022-02-03 19:18:54 -05:00
} else if ( p = = " triggerbox-overrides-disk-monitoring " ) {
update_monitoring_display ( ) ;
2022-09-19 16:47:59 -04:00
} else if ( p = = " record-mode " ) {
2020-06-17 17:51:48 -04:00
update_monitoring_display ( ) ;
} else if ( p = = " auto-input-does-talkback " ) {
update_monitoring_display ( ) ;
2014-09-04 22:20:15 -04:00
} else if ( p = = " blink-rec-arm " ) {
2015-01-02 09:44:54 -05:00
if ( UIConfiguration : : instance ( ) . get_blink_rec_arm ( ) ) {
2014-09-04 22:20:15 -04:00
rec_blink_connection . disconnect ( ) ;
2014-12-25 10:02:00 -05:00
rec_blink_connection = Timers : : blink_connect ( sigc : : mem_fun ( * this , & RouteUI : : blink_rec_display ) ) ;
2014-09-04 22:20:15 -04:00
} else {
rec_blink_connection . disconnect ( ) ;
2014-09-05 11:26:21 -04:00
RouteUI : : blink_rec_display ( false ) ;
2014-09-04 22:20:15 -04:00
}
2009-06-14 13:56:29 -04:00
}
}
2009-06-23 16:02:15 -04:00
2010-08-13 17:33:01 -04:00
void
RouteUI : : setup_invert_buttons ( )
{
2022-09-04 14:25:51 -04:00
uint32_t N = _route ? _route - > phase_control ( ) - > size ( ) : 0 ;
2023-02-16 18:33:28 -05:00
std : : shared_ptr < Send > send = std : : dynamic_pointer_cast < Send > ( _current_delivery ) ;
2022-09-04 14:25:51 -04:00
send_connections . drop_connections ( ) ;
if ( send ) {
2023-02-16 18:33:28 -05:00
std : : shared_ptr < AutomationControl > ac = send - > polarity_control ( ) ;
2022-09-04 14:25:51 -04:00
if ( ac ) {
N = 1 ;
ac - > Changed . connect ( send_connections , invalidator ( * this ) , boost : : bind ( & RouteUI : : update_polarity_display , this ) , gui_context ( ) ) ;
if ( ac - > alist ( ) ) {
ac - > alist ( ) - > automation_state_changed . connect ( send_connections , invalidator ( * this ) , boost : : bind ( & RouteUI : : update_phase_invert_sensitivty , this ) , gui_context ( ) ) ;
update_phase_invert_sensitivty ( ) ;
}
} else {
N = 0 ;
}
}
2020-03-02 13:18:30 -05:00
if ( _n_polarity_invert = = N ) {
2020-04-04 11:54:33 -04:00
/* buttons are already setup for this strip, but we should still set the values */
update_polarity_display ( ) ;
2022-09-18 16:51:58 -04:00
update_polarity_tooltips ( ) ;
2020-03-02 13:18:30 -05:00
return ;
}
_n_polarity_invert = N ;
2010-08-13 17:33:01 -04:00
/* remove old invert buttons */
2011-11-30 11:40:05 -05:00
for ( vector < ArdourButton * > : : iterator i = _invert_buttons . begin ( ) ; i ! = _invert_buttons . end ( ) ; + + i ) {
2021-03-27 12:44:34 -04:00
invert_button_box . remove ( * * i ) ;
2010-08-13 17:33:01 -04:00
}
_invert_buttons . clear ( ) ;
2020-03-02 13:18:30 -05:00
if ( N = = 0 ) {
2010-08-13 17:33:01 -04:00
return ;
}
uint32_t const to_add = ( N < = _max_invert_buttons ) ? N : 1 ;
for ( uint32_t i = 0 ; i < to_add ; + + i ) {
2011-11-28 12:58:15 -05:00
ArdourButton * b = manage ( new ArdourButton ) ;
2014-08-28 11:31:57 -04:00
b - > signal_button_press_event ( ) . connect ( sigc : : mem_fun ( * this , & RouteUI : : invert_press ) , false ) ;
b - > signal_button_release_event ( ) . connect ( sigc : : bind ( sigc : : mem_fun ( * this , & RouteUI : : invert_release ) , i ) , false ) ;
2011-06-01 13:00:29 -04:00
2012-12-06 15:48:44 -05:00
b - > set_name ( X_ ( " invert button " ) ) ;
2010-08-13 17:33:01 -04:00
if ( to_add = = 1 ) {
2012-03-05 17:06:16 -05:00
if ( N > 1 ) {
b - > set_text ( string_compose ( X_ ( " Ø (%1) " ) , N ) ) ;
} else {
b - > set_text ( X_ ( " Ø " ) ) ;
}
2010-08-13 17:33:01 -04:00
} else {
2011-11-28 12:58:15 -05:00
b - > set_text ( string_compose ( X_ ( " Ø%1 " ) , i + 1 ) ) ;
2010-08-13 17:33:01 -04:00
}
_invert_buttons . push_back ( b ) ;
2021-03-27 12:44:34 -04:00
invert_button_box . pack_start ( * b ) ;
2010-08-13 17:33:01 -04:00
}
2011-06-01 13:00:29 -04:00
2021-03-27 12:44:34 -04:00
invert_button_box . set_spacing ( 1 ) ;
invert_button_box . show_all ( ) ;
2020-03-02 12:17:25 -05:00
2020-03-02 13:06:40 -05:00
update_polarity_display ( ) ;
2022-09-18 16:51:58 -04:00
update_polarity_tooltips ( ) ;
2010-08-13 17:33:01 -04:00
}
void
2020-03-02 13:06:40 -05:00
RouteUI : : update_polarity_display ( )
2010-08-13 17:33:01 -04:00
{
2023-02-16 18:33:28 -05:00
std : : shared_ptr < Send > send = std : : dynamic_pointer_cast < Send > ( _current_delivery ) ;
2022-09-04 14:25:51 -04:00
if ( send ) {
if ( send - > polarity_control ( ) ) {
ArdourButton * b = _invert_buttons . front ( ) ;
b - > set_active_state ( send - > polarity_control ( ) - > get_value ( ) > 0 ? Gtkmm2ext : : ExplicitActive : Gtkmm2ext : : Off ) ;
}
return ;
}
2020-04-04 13:03:45 -04:00
if ( ! _route ) {
return ;
}
2020-02-18 21:15:05 -05:00
uint32_t const N = _route - > phase_control ( ) - > size ( ) ;
2010-08-13 17:33:01 -04:00
if ( N > _max_invert_buttons ) {
2012-03-04 20:16:50 -05:00
/* One button for many channels; explicit active if all channels are inverted,
implicit active if some are , off if none are .
*/
ArdourButton * b = _invert_buttons . front ( ) ;
2015-10-05 10:17:49 -04:00
2016-04-08 16:49:47 -04:00
if ( _route - > phase_control ( ) - > count ( ) = = _route - > phase_control ( ) - > size ( ) ) {
2012-03-04 20:16:50 -05:00
b - > set_active_state ( Gtkmm2ext : : ExplicitActive ) ;
2016-04-08 16:49:47 -04:00
} else if ( _route - > phase_control ( ) - > any ( ) ) {
2012-03-04 20:16:50 -05:00
b - > set_active_state ( Gtkmm2ext : : ImplicitActive ) ;
} else {
b - > set_active_state ( Gtkmm2ext : : Off ) ;
}
} else {
/* One button per channel; just set active */
int j = 0 ;
for ( vector < ArdourButton * > : : iterator i = _invert_buttons . begin ( ) ; i ! = _invert_buttons . end ( ) ; + + i , + + j ) {
2016-04-08 16:49:47 -04:00
( * i ) - > set_active ( _route - > phase_control ( ) - > inverted ( j ) ) ;
2012-03-04 20:16:50 -05:00
}
2015-10-05 10:17:49 -04:00
2010-08-13 17:33:01 -04:00
}
}
2022-09-18 16:51:58 -04:00
void
RouteUI : : update_polarity_tooltips ( )
{
2023-02-16 18:33:28 -05:00
std : : shared_ptr < Send > send = std : : dynamic_pointer_cast < Send > ( _current_delivery ) ;
2022-09-18 16:51:58 -04:00
int i = 0 ;
for ( auto const & b : _invert_buttons ) {
if ( send ) {
UI : : instance ( ) - > set_tip ( * b , _ ( " Click to invert polarity of all send channels " ) ) ;
} else if ( _n_polarity_invert < = _max_invert_buttons ) {
UI : : instance ( ) - > set_tip ( * b , string_compose ( _ ( " Left-click to invert polarity of channel %1 of this track. Right-click to show menu. " ) , + + i ) ) ;
} else {
UI : : instance ( ) - > set_tip ( * b , _ ( " Click to show a menu of channels to invert polarity " ) ) ;
}
}
}
2010-08-13 17:33:01 -04:00
2011-11-30 11:40:05 -05:00
bool
RouteUI : : invert_release ( GdkEventButton * ev , uint32_t i )
2010-08-13 17:33:01 -04:00
{
2011-11-30 11:40:05 -05:00
if ( ev - > button = = 1 & & i < _invert_buttons . size ( ) ) {
2020-02-18 21:15:05 -05:00
uint32_t const N = _route - > phase_control ( ) - > size ( ) ;
2012-03-04 20:16:50 -05:00
if ( N < = _max_invert_buttons ) {
2023-02-16 18:33:28 -05:00
std : : shared_ptr < Send > send = std : : dynamic_pointer_cast < Send > ( _current_delivery ) ;
2022-09-04 14:25:51 -04:00
if ( send ) {
send - > polarity_control ( ) - > set_value ( _invert_buttons [ i ] - > get_active ( ) ? 0 : 1 , Controllable : : NoGroup ) ;
return false ;
}
2012-03-04 20:16:50 -05:00
/* left-click inverts phase so long as we have a button per channel */
2016-04-08 16:49:47 -04:00
_route - > phase_control ( ) - > set_phase_invert ( i , ! _invert_buttons [ i ] - > get_active ( ) ) ;
2014-08-27 11:49:36 -04:00
return false ;
2012-03-04 20:16:50 -05:00
}
2010-08-13 17:33:01 -04:00
}
2011-11-30 11:40:05 -05:00
return false ;
2010-08-13 17:33:01 -04:00
}
bool
RouteUI : : invert_press ( GdkEventButton * ev )
{
using namespace Menu_Helpers ;
2012-03-04 20:16:50 -05:00
2020-02-18 21:15:05 -05:00
uint32_t const N = _route - > phase_control ( ) - > size ( ) ;
2012-03-04 20:16:50 -05:00
if ( N < = _max_invert_buttons & & ev - > button ! = 3 ) {
/* If we have an invert button per channel, we only pop
up a menu on right - click ; left click is handled
on release .
*/
2014-08-22 12:45:34 -04:00
return false ;
2010-08-13 17:33:01 -04:00
}
2015-10-05 10:17:49 -04:00
2023-02-16 18:33:28 -05:00
if ( std : : dynamic_pointer_cast < Send > ( _current_delivery ) ) {
2022-09-18 16:51:58 -04:00
/* do not show context menu for send polarity */
return false ;
}
2010-08-13 17:33:01 -04:00
delete _invert_menu ;
_invert_menu = new Menu ;
_invert_menu - > set_name ( " ArdourContextMenu " ) ;
MenuList & items = _invert_menu - > items ( ) ;
for ( uint32_t i = 0 ; i < N ; + + i ) {
items . push_back ( CheckMenuElem ( string_compose ( X_ ( " Ø%1 " ) , i + 1 ) , sigc : : bind ( sigc : : mem_fun ( * this , & RouteUI : : invert_menu_toggled ) , i ) ) ) ;
2013-07-11 15:32:31 -04:00
Gtk : : CheckMenuItem * e = dynamic_cast < Gtk : : CheckMenuItem * > ( & items . back ( ) ) ;
2010-08-13 17:33:01 -04:00
+ + _i_am_the_modifier ;
2016-04-08 16:49:47 -04:00
e - > set_active ( _route - > phase_control ( ) - > inverted ( i ) ) ;
2010-08-13 17:33:01 -04:00
- - _i_am_the_modifier ;
}
2017-03-24 09:36:17 -04:00
_invert_menu - > popup ( 0 , ev - > time ) ;
2010-08-13 17:33:01 -04:00
2014-08-27 11:49:36 -04:00
return true ;
2010-08-13 17:33:01 -04:00
}
void
RouteUI : : invert_menu_toggled ( uint32_t c )
{
if ( _i_am_the_modifier ) {
return ;
}
2011-06-01 13:00:29 -04:00
2016-04-08 16:49:47 -04:00
_route - > phase_control ( ) - > set_phase_invert ( c , ! _route - > phase_control ( ) - > inverted ( c ) ) ;
2010-08-13 17:33:01 -04:00
}
2011-01-29 10:28:58 -05:00
void
2022-09-04 14:25:51 -04:00
RouteUI : : update_phase_invert_sensitivty ( )
2011-01-29 10:28:58 -05:00
{
2022-09-04 14:25:51 -04:00
bool yn = false ;
2023-02-16 18:33:28 -05:00
std : : shared_ptr < Send > send = std : : dynamic_pointer_cast < Send > ( _current_delivery ) ;
2022-09-04 14:25:51 -04:00
if ( send ) {
2023-02-16 18:33:28 -05:00
std : : shared_ptr < AutomationControl > ac = send - > polarity_control ( ) ;
2022-09-04 14:25:51 -04:00
if ( ac ) {
yn = ( ac - > alist ( ) - > automation_state ( ) & Play ) = = 0 ;
}
} else if ( _route ) {
yn = _route - > active ( ) | | ARDOUR : : Profile - > get_mixbus ( ) ;
}
2017-05-03 18:43:40 -04:00
for ( vector < ArdourButton * > : : iterator b = _invert_buttons . begin ( ) ; b ! = _invert_buttons . end ( ) ; + + b ) {
( * b ) - > set_sensitive ( yn ) ;
}
2011-01-29 10:28:58 -05:00
}
2011-07-06 20:37:13 -04:00
2011-08-30 11:44:00 -04:00
/** The Route's gui_changed signal has been emitted */
void
2016-06-05 17:16:20 -04:00
RouteUI : : route_gui_changed ( PropertyChange const & what_changed )
2011-08-30 11:44:00 -04:00
{
2016-06-05 17:16:20 -04:00
if ( what_changed . contains ( Properties : : color ) ) {
2011-08-30 11:44:00 -04:00
if ( set_color_from_route ( ) = = 0 ) {
route_color_changed ( ) ;
}
}
}
2011-08-31 15:14:12 -04:00
2014-09-02 20:35:42 -04:00
void
RouteUI : : track_mode_changed ( void )
{
assert ( is_track ( ) ) ;
2020-02-25 23:35:07 -05:00
rec_enable_button - > set_icon ( ArdourIcon : : RecButton ) ;
2014-09-02 20:35:42 -04:00
rec_enable_button - > queue_draw ( ) ;
}
2011-08-31 15:14:12 -04:00
/** @return the color that this route should use; it maybe its own,
2017-05-03 18:43:40 -04:00
* or it maybe that of its route group .
*/
2011-08-31 15:14:12 -04:00
Gdk : : Color
2016-06-05 15:26:12 -04:00
RouteUI : : route_color ( ) const
2011-08-31 15:14:12 -04:00
{
2016-06-05 15:26:12 -04:00
Gdk : : Color c ;
2011-08-31 15:14:12 -04:00
RouteGroup * g = _route - > route_group ( ) ;
2016-06-08 21:18:13 -04:00
string p ;
2015-10-05 10:17:49 -04:00
2011-08-31 15:14:12 -04:00
if ( g & & g - > is_color ( ) ) {
2022-08-10 23:11:52 -04:00
Gtkmm2ext : : set_color_from_rgba ( c , GroupTabs : : group_color ( g ) ) ;
2016-06-05 15:26:12 -04:00
} else {
2022-08-10 23:11:52 -04:00
Gtkmm2ext : : set_color_from_rgba ( c , _route - > presentation_info ( ) . color ( ) ) ;
2011-08-31 15:14:12 -04:00
}
2016-06-05 15:26:12 -04:00
return c ;
2011-08-31 15:14:12 -04:00
}
2011-11-02 20:42:16 -04:00
2022-08-11 00:33:40 -04:00
Gdk : : Color
RouteUI : : route_color_tint ( ) const
{
return route_color ( ) ;
#if 0
Gdk : : Color lighter_bg ;
HSV l ( gdk_color_to_rgba ( route_color ( ) ) ) ;
l . h + = std : : min ( l . h + 0.08 , 1.0 ) ;
l . s = 0.15 ;
l . v - = std : : max ( 0.0 , 0.05 ) ;
set_color_from_rgba ( lighter_bg , l . color ( ) ) ;
return lighter_bg ;
2022-08-11 00:37:16 -04:00
# endif
2022-08-11 00:33:40 -04:00
}
2011-11-02 20:42:16 -04:00
void
2023-02-16 18:33:28 -05:00
RouteUI : : set_showing_sends_to ( std : : shared_ptr < Route > send_to )
2011-11-02 20:42:16 -04:00
{
_showing_sends_to = send_to ;
BusSendDisplayChanged ( send_to ) ; /* EMIT SIGNAL */
}
void
2023-02-16 18:33:28 -05:00
RouteUI : : bus_send_display_changed ( std : : shared_ptr < Route > send_to )
2011-11-02 20:42:16 -04:00
{
if ( _route = = send_to ) {
2012-02-07 12:43:55 -05:00
show_sends_button - > set_active ( true ) ;
2014-12-25 10:02:00 -05:00
send_blink_connection = Timers : : blink_connect ( sigc : : mem_fun ( * this , & RouteUI : : send_blink ) ) ;
2011-11-02 20:42:16 -04:00
} else {
2012-02-07 12:43:55 -05:00
show_sends_button - > set_active ( false ) ;
2011-11-02 20:42:16 -04:00
send_blink_connection . disconnect ( ) ;
}
}
2011-11-04 13:53:21 -04:00
RouteGroup *
RouteUI : : route_group ( ) const
{
return _route - > route_group ( ) ;
}
2016-05-10 14:11:08 -04:00
2022-01-01 09:34:47 -05:00
void
2023-02-16 18:33:28 -05:00
RouteUI : : help_count_plugins ( std : : weak_ptr < Processor > p , uint32_t * plugin_insert_cnt )
2022-01-01 09:34:47 -05:00
{
2023-02-16 18:33:28 -05:00
std : : shared_ptr < Processor > processor ( p . lock ( ) ) ;
2022-01-01 09:34:47 -05:00
if ( ! processor | | ! processor - > display_to_user ( ) ) {
return ;
}
2023-02-16 18:33:28 -05:00
std : : shared_ptr < PluginInsert > pi = std : : dynamic_pointer_cast < PluginInsert > ( processor ) ;
2022-01-01 09:34:47 -05:00
# ifdef MIXBUS
if ( pi & & pi - > is_channelstrip ( ) ) {
return ;
}
# endif
if ( pi ) {
+ + ( * plugin_insert_cnt ) ;
}
}
2016-05-10 14:11:08 -04:00
2023-02-16 18:33:28 -05:00
RoutePinWindowProxy : : RoutePinWindowProxy ( std : : string const & name , std : : shared_ptr < ARDOUR : : Route > route )
2016-05-10 14:11:08 -04:00
: WM : : ProxyBase ( name , string ( ) )
2023-02-16 18:33:28 -05:00
, _route ( std : : weak_ptr < Route > ( route ) )
2016-05-10 14:11:08 -04:00
{
route - > DropReferences . connect ( going_away_connection , MISSING_INVALIDATOR , boost : : bind ( & RoutePinWindowProxy : : route_going_away , this ) , gui_context ( ) ) ;
}
RoutePinWindowProxy : : ~ RoutePinWindowProxy ( )
{
_window = 0 ;
}
ARDOUR : : SessionHandlePtr *
RoutePinWindowProxy : : session_handle ( )
{
ArdourWindow * aw = dynamic_cast < ArdourWindow * > ( _window ) ;
if ( aw ) { return aw ; }
return 0 ;
}
Gtk : : Window *
RoutePinWindowProxy : : get ( bool create )
{
2023-02-16 18:33:28 -05:00
std : : shared_ptr < Route > r = _route . lock ( ) ;
2016-05-10 14:11:08 -04:00
if ( ! r ) {
return 0 ;
}
if ( ! _window ) {
if ( ! create ) {
return 0 ;
}
_window = new PluginPinDialog ( r ) ;
ArdourWindow * aw = dynamic_cast < ArdourWindow * > ( _window ) ;
if ( aw ) {
aw - > set_session ( _session ) ;
}
_window - > show_all ( ) ;
}
return _window ;
}
void
RoutePinWindowProxy : : route_going_away ( )
{
delete _window ;
_window = 0 ;
WM : : Manager : : instance ( ) . remove ( this ) ;
going_away_connection . disconnect ( ) ;
2017-01-20 05:54:02 -05:00
delete this ;
2016-05-10 14:11:08 -04:00
}
void
RouteUI : : maybe_add_route_print_mgr ( )
{
if ( _route - > pinmgr_proxy ( ) ) {
return ;
}
RoutePinWindowProxy * wp = new RoutePinWindowProxy (
string_compose ( " RPM-%1 " , _route - > id ( ) ) , _route ) ;
wp - > set_session ( _session ) ;
const XMLNode * ui_xml = _session - > extra_xml ( X_ ( " UI " ) ) ;
if ( ui_xml ) {
wp - > set_state ( * ui_xml , 0 ) ;
}
#if 0
void * existing_ui = _route - > pinmgr_proxy ( ) ;
if ( existing_ui ) {
wp - > use_window ( * ( reinterpret_cast < Gtk : : Window * > ( existing_ui ) ) ) ;
}
# endif
_route - > set_pingmgr_proxy ( wp ) ;
WM : : Manager : : instance ( ) . register_window ( wp ) ;
}
void
RouteUI : : manage_pins ( )
{
RoutePinWindowProxy * proxy = _route - > pinmgr_proxy ( ) ;
if ( proxy ) {
proxy - > get ( true ) ;
proxy - > present ( ) ;
}
}
2016-06-05 15:19:54 -04:00
2016-11-09 22:54:03 -05:00
void
2016-11-10 15:35:40 -05:00
RouteUI : : fan_out ( bool to_busses , bool group )
2016-11-09 22:54:03 -05:00
{
2020-04-02 13:55:33 -04:00
Mixer_UI : : instance ( ) - > fan_out ( _route , to_busses , group ) ;
2016-11-09 22:54:03 -05:00
}
2016-06-05 15:19:54 -04:00
bool
RouteUI : : mark_hidden ( bool yn )
{
if ( yn ! = _route - > presentation_info ( ) . hidden ( ) ) {
_route - > presentation_info ( ) . set_hidden ( yn ) ;
return true ; // things changed
}
return false ;
}
2016-07-06 13:37:30 -04:00
2023-02-16 18:33:28 -05:00
std : : shared_ptr < Stripable >
2016-07-06 13:37:30 -04:00
RouteUI : : stripable ( ) const
{
return _route ;
}
2017-07-21 17:03:41 -04:00
void
RouteUI : : set_disk_io_point ( DiskIOPoint diop )
{
if ( _route & & is_track ( ) ) {
2017-07-25 17:29:30 -04:00
track ( ) - > set_disk_io_point ( diop ) ;
2017-07-21 17:03:41 -04:00
}
}
2021-01-25 17:52:39 -05:00
std : : string
RouteUI : : playlist_tip ( ) const
{
if ( ! is_track ( ) ) {
return " " ;
}
RouteGroup * rg = route_group ( ) ;
if ( rg & & rg - > is_active ( ) & & rg - > enabled_property ( ARDOUR : : Properties : : group_select . property_id ) ) {
string group_string = " . " + rg - > name ( ) + " . " ;
string take_name = track ( ) - > playlist ( ) - > name ( ) ;
string : : size_type idx = take_name . find ( group_string ) ;
if ( idx ! = string : : npos ) {
/* find the bit containing the take number / name */
take_name = take_name . substr ( idx + group_string . length ( ) ) ;
/* set the playlist button tooltip to the take name */
return string_compose ( _ ( " Take: %1.%2 " ) ,
Gtkmm2ext : : markup_escape_text ( rg - > name ( ) ) ,
Gtkmm2ext : : markup_escape_text ( take_name ) ) ;
}
}
/* set the playlist button tooltip to the playlist name */
return _ ( " Playlist " ) + std : : string ( " : " ) + Gtkmm2ext : : markup_escape_text ( track ( ) - > playlist ( ) - > name ( ) ) ;
}
std : : string
2023-02-16 18:33:28 -05:00
RouteUI : : resolve_new_group_playlist_name ( std : : string const & basename , vector < std : : shared_ptr < Playlist > > const & playlists )
2021-01-25 17:52:39 -05:00
{
std : : string ret ( basename ) ;
std : : string const group_string = " . " + route_group ( ) - > name ( ) + " . " ;
// iterate through all playlists
int maxnumber = 0 ;
2023-02-16 18:33:28 -05:00
for ( vector < std : : shared_ptr < Playlist > > : : const_iterator i = playlists . begin ( ) ; i ! = playlists . end ( ) ; + + i ) {
2021-01-25 17:52:39 -05:00
std : : string tmp = ( * i ) - > name ( ) ;
std : : string : : size_type idx = tmp . find ( group_string ) ;
// find those which belong to this group
if ( idx ! = string : : npos ) {
tmp = tmp . substr ( idx + group_string . length ( ) ) ;
// and find the largest current number
int x = atoi ( tmp ) ;
if ( x > maxnumber ) {
maxnumber = x ;
}
}
}
maxnumber + + ;
char buf [ 32 ] ;
snprintf ( buf , sizeof ( buf ) , " %d " , maxnumber ) ;
ret = _route - > name ( ) + " . " + route_group ( ) - > name ( ) + " . " + buf ;
return ret ;
}
void
2023-02-16 18:33:28 -05:00
RouteUI : : use_new_playlist ( std : : string name , std : : string gid , vector < std : : shared_ptr < Playlist > > const & playlists_before_op , bool copy )
2021-01-25 17:52:39 -05:00
{
2023-02-16 18:33:28 -05:00
std : : shared_ptr < Track > tr = track ( ) ;
2021-01-25 17:52:39 -05:00
if ( ! tr ) {
return ;
}
2023-02-16 18:33:28 -05:00
std : : shared_ptr < const Playlist > pl = tr - > playlist ( ) ;
2021-01-25 17:52:39 -05:00
if ( ! pl ) {
return ;
}
2023-06-09 11:22:55 -04:00
XMLNode * before = & tr - > playlist_state ( ) ;
2021-05-31 22:00:59 -04:00
if ( copy ) {
tr - > use_copy_playlist ( ) ;
} else {
tr - > use_default_new_playlist ( ) ;
2021-01-25 17:52:39 -05:00
}
2023-06-09 11:22:55 -04:00
tr - > playlist ( ) - > clear_changes ( ) ;
tr - > playlist ( ) - > clear_owned_changes ( ) ;
2021-05-31 22:00:59 -04:00
tr - > playlist ( ) - > set_name ( name ) ;
tr - > playlist ( ) - > set_pgroup_id ( gid ) ;
2023-06-09 11:22:55 -04:00
XMLNode * after = & tr - > playlist_state ( ) ;
if ( * before ! = * after ) {
_session - > begin_reversible_command ( string_compose ( _ ( " New Playlist for track %1 " ) , tr - > name ( ) ) ) ;
tr - > playlist ( ) - > rdiff_and_add_command ( _session ) ;
_session - > commit_reversible_command ( new MementoCommand < Track > ( * tr , before , after ) ) ;
} else {
delete before ;
delete after ;
}
2021-01-25 17:52:39 -05:00
}
void
RouteUI : : clear_playlist ( )
{
2023-02-16 18:33:28 -05:00
std : : shared_ptr < Track > tr = track ( ) ;
2021-01-25 17:52:39 -05:00
if ( ! tr ) {
return ;
}
2023-02-16 18:33:28 -05:00
std : : shared_ptr < Playlist > pl = tr - > playlist ( ) ;
2021-01-25 17:52:39 -05:00
if ( ! pl ) {
return ;
}
ARDOUR_UI : : instance ( ) - > the_editor ( ) . clear_playlist ( pl ) ;
}
void
RouteUI : : build_playlist_menu ( )
{
using namespace Menu_Helpers ;
if ( ! is_track ( ) ) {
return ;
}
PublicEditor * editor = & ARDOUR_UI : : instance ( ) - > the_editor ( ) ;
delete playlist_action_menu ;
playlist_action_menu = new Menu ;
playlist_action_menu - > set_name ( " ArdourContextMenu " ) ;
MenuList & playlist_items = playlist_action_menu - > items ( ) ;
playlist_action_menu - > set_name ( " ArdourContextMenu " ) ;
playlist_items . clear ( ) ;
RadioMenuItem : : Group playlist_group ;
2023-02-16 18:33:28 -05:00
std : : shared_ptr < Track > tr = track ( ) ;
2021-01-25 17:52:39 -05:00
2023-02-16 18:33:28 -05:00
vector < std : : shared_ptr < Playlist > > playlists_tr = _session - > playlists ( ) - > playlists_for_track ( tr ) ;
2021-01-25 17:52:39 -05:00
/* sort the playlists */
2020-09-11 14:10:30 -04:00
PlaylistSorterByID cmp ;
2021-01-25 17:52:39 -05:00
sort ( playlists_tr . begin ( ) , playlists_tr . end ( ) , cmp ) ;
/* add the playlists to the menu */
2023-02-16 18:33:28 -05:00
for ( vector < std : : shared_ptr < Playlist > > : : iterator i = playlists_tr . begin ( ) ; i ! = playlists_tr . end ( ) ; + + i ) {
2021-05-31 22:00:59 -04:00
string text = ( * i ) - > name ( ) ;
playlist_items . push_back ( RadioMenuElem ( playlist_group , text ) ) ;
2021-01-25 17:52:39 -05:00
RadioMenuItem * item = static_cast < RadioMenuItem * > ( & playlist_items . back ( ) ) ;
if ( tr - > playlist ( ) - > id ( ) = = ( * i ) - > id ( ) ) {
item - > set_active ( ) ;
}
2023-02-16 18:33:28 -05:00
item - > signal_toggled ( ) . connect ( sigc : : bind ( sigc : : mem_fun ( * this , & RouteUI : : use_playlist ) , item , std : : weak_ptr < Playlist > ( * i ) ) ) ;
2021-01-25 17:52:39 -05:00
}
2020-09-11 14:10:30 -04:00
playlist_items . push_back ( SeparatorElem ( ) ) ;
playlist_items . push_back ( MenuElem ( _ ( " Select ... " ) , sigc : : mem_fun ( * this , & RouteUI : : show_playlist_selector ) ) ) ;
2021-01-25 17:52:39 -05:00
playlist_items . push_back ( SeparatorElem ( ) ) ;
playlist_items . push_back ( MenuElem ( _ ( " Rename... " ) , sigc : : mem_fun ( * this , & RouteUI : : rename_current_playlist ) ) ) ;
playlist_items . push_back ( SeparatorElem ( ) ) ;
if ( ! route_group ( ) | | ! route_group ( ) - > is_active ( ) | | ! route_group ( ) - > enabled_property ( ARDOUR : : Properties : : group_select . property_id ) ) {
2021-06-04 10:36:53 -04:00
playlist_items . push_back ( MenuElem ( _ ( " New Playlist... " ) , sigc : : bind ( sigc : : mem_fun ( editor , & PublicEditor : : new_playlists_for_grouped_tracks ) , this , false ) ) ) ;
playlist_items . push_back ( MenuElem ( _ ( " Copy Playlist... " ) , sigc : : bind ( sigc : : mem_fun ( editor , & PublicEditor : : new_playlists_for_grouped_tracks ) , this , true ) ) ) ;
2021-01-25 17:52:39 -05:00
} else {
2021-06-04 10:36:53 -04:00
playlist_items . push_back ( MenuElem ( _ ( " New Playlist (for group) " ) , sigc : : bind ( sigc : : mem_fun ( editor , & PublicEditor : : new_playlists_for_grouped_tracks ) , this , false ) ) ) ;
playlist_items . push_back ( MenuElem ( _ ( " Copy Playlist (for group) " ) , sigc : : bind ( sigc : : mem_fun ( editor , & PublicEditor : : new_playlists_for_grouped_tracks ) , this , true ) ) ) ;
2021-01-25 17:52:39 -05:00
}
playlist_items . push_back ( SeparatorElem ( ) ) ;
2021-05-28 08:47:55 -04:00
if ( ! route_group ( ) | | ! route_group ( ) - > is_active ( ) | | ! route_group ( ) - > enabled_property ( ARDOUR : : Properties : : group_select . property_id ) ) {
2021-06-04 10:36:53 -04:00
playlist_items . push_back ( MenuElem ( _ ( " Clear Current " ) , sigc : : bind ( sigc : : mem_fun ( editor , & PublicEditor : : clear_grouped_playlists ) , this ) ) ) ;
2021-05-28 08:47:55 -04:00
} else {
2021-06-04 10:36:53 -04:00
playlist_items . push_back ( MenuElem ( _ ( " Clear Current (for group) " ) , sigc : : bind ( sigc : : mem_fun ( editor , & PublicEditor : : clear_grouped_playlists ) , this ) ) ) ;
2021-05-28 08:47:55 -04:00
}
2021-01-25 17:52:39 -05:00
playlist_items . push_back ( SeparatorElem ( ) ) ;
2020-09-11 14:10:30 -04:00
Menu * advanced_menu = manage ( new Menu ) ;
MenuList & advanced_items = advanced_menu - > items ( ) ;
advanced_items . push_back ( MenuElem ( _ ( " Copy from ... " ) , sigc : : mem_fun ( * this , & RouteUI : : show_playlist_copy_selector ) ) ) ;
advanced_items . push_back ( MenuElem ( _ ( " Share with ... " ) , sigc : : mem_fun ( * this , & RouteUI : : show_playlist_share_selector ) ) ) ;
advanced_items . push_back ( MenuElem ( _ ( " Steal from ... " ) , sigc : : mem_fun ( * this , & RouteUI : : show_playlist_steal_selector ) ) ) ;
playlist_items . push_back ( MenuElem ( _ ( " Advanced " ) , * advanced_menu ) ) ;
2021-01-25 17:52:39 -05:00
}
void
2023-02-16 18:33:28 -05:00
RouteUI : : use_playlist ( RadioMenuItem * item , std : : weak_ptr < Playlist > wpl )
2021-01-25 17:52:39 -05:00
{
// exit if we were triggered by deactivating the old playlist
2020-09-11 14:10:30 -04:00
if ( item & & ! item - > get_active ( ) ) {
2021-01-25 17:52:39 -05:00
return ;
}
2021-06-27 22:50:51 -04:00
PublicEditor : : instance ( ) . mapover_grouped_routes ( sigc : : bind ( sigc : : mem_fun ( PublicEditor : : instance ( ) , & PublicEditor : : mapped_select_playlist_matching ) , wpl ) , this , ARDOUR : : Properties : : group_select . property_id ) ;
2021-06-27 10:49:51 -04:00
}
void
2023-02-16 18:33:28 -05:00
RouteUI : : select_playlist_matching ( std : : weak_ptr < Playlist > wpl )
2021-06-27 10:49:51 -04:00
{
if ( ! is_track ( ) ) {
return ;
}
2023-02-16 18:33:28 -05:00
std : : shared_ptr < Playlist > pl ( wpl . lock ( ) ) ;
2021-01-25 17:52:39 -05:00
if ( ! pl ) {
return ;
}
2021-06-27 10:49:51 -04:00
if ( track ( ) - > freeze_state ( ) = = Track : : Frozen ) {
/* Don't change playlists of frozen tracks */
2021-01-25 17:52:39 -05:00
return ;
}
2021-06-27 10:49:51 -04:00
if ( track ( ) - > playlist ( ) = = pl ) {
/* already selected; nothing to do */
return ;
}
2021-01-25 17:52:39 -05:00
2023-06-09 11:22:55 -04:00
std : : shared_ptr < Playlist > ipl ;
std : : shared_ptr < Track > t = track ( ) ;
XMLNode * before = & t - > playlist_state ( ) ;
if ( t - > id ( ) = = pl - > get_orig_track_id ( ) ) {
2021-07-20 14:11:33 -04:00
/* this playlist is one of this track's own, no need to match by pgroup-id or name */
2023-06-09 11:22:55 -04:00
t - > use_playlist ( t - > data_type ( ) , pl ) ;
goto checkdiff ;
2021-07-20 14:11:33 -04:00
}
/* Search for a matching playlist .. either by pgroup_id or name */
2023-06-09 11:22:55 -04:00
if ( 0 ! = ( ipl = session ( ) - > playlists ( ) - > for_pgroup ( pl - > pgroup_id ( ) , t - > id ( ) ) ) ) {
// found a playlist that matches the pgroup_id, use it
t - > use_playlist ( t - > data_type ( ) , ipl ) ;
} else { // fallback to prior behavior ... try to find matching names /*DEPRECATED*/
2021-01-25 17:52:39 -05:00
2021-06-27 10:49:51 -04:00
std : : string take_name = pl - > name ( ) ;
std : : string group_name ;
2023-06-09 11:22:55 -04:00
if ( t - > route_group ( ) ) {
group_name = t - > route_group ( ) - > name ( ) ;
2021-06-27 10:49:51 -04:00
}
std : : string group_string = " . " + group_name + " . " ;
2021-01-25 17:52:39 -05:00
2021-06-27 10:49:51 -04:00
std : : string : : size_type idx = take_name . find ( group_string ) ;
2021-01-25 17:52:39 -05:00
2021-06-27 10:49:51 -04:00
if ( idx ! = std : : string : : npos ) {
2021-05-31 22:00:59 -04:00
take_name = take_name . substr ( idx + group_string . length ( ) ) ; // find the bit containing the take number / name
2023-06-09 11:22:55 -04:00
std : : string playlist_name = t - > name ( ) + group_string + take_name ;
2021-01-25 17:52:39 -05:00
2023-02-16 18:33:28 -05:00
std : : shared_ptr < Playlist > ipl = session ( ) - > playlists ( ) - > by_name ( playlist_name ) ;
2021-06-27 10:49:51 -04:00
if ( ipl ) {
2023-06-09 11:22:55 -04:00
t - > use_playlist ( t - > data_type ( ) , ipl ) ;
2021-01-25 17:52:39 -05:00
}
2021-06-27 10:49:51 -04:00
}
2023-06-09 11:22:55 -04:00
}
checkdiff :
XMLNode * after = & t - > playlist_state ( ) ;
if ( * before ! = * after ) {
_session - > begin_reversible_command ( string_compose ( _ ( " Switch Playlist for track %1 " ) , t - > name ( ) ) ) ;
_session - > commit_reversible_command ( new MementoCommand < Track > ( * t , before , after ) ) ;
} else {
delete before ;
delete after ;
}
2021-01-25 17:52:39 -05:00
}
void
RouteUI : : show_playlist_selector ( )
{
2021-06-07 20:19:09 -04:00
if ( ! _playlist_selector ) {
_playlist_selector = new PlaylistSelector ( ) ;
_playlist_selector - > set_session ( _session ) ;
2020-09-11 14:10:30 -04:00
}
2021-06-07 20:19:09 -04:00
_playlist_selector - > prepare ( this , PlaylistSelector : : plSelect ) ;
2021-07-20 11:26:30 -04:00
_playlist_selector - > show ( ) ;
2020-09-11 14:10:30 -04:00
}
void
RouteUI : : show_playlist_copy_selector ( )
{
2021-06-07 20:19:09 -04:00
if ( ! _playlist_selector ) {
_playlist_selector = new PlaylistSelector ( ) ;
_playlist_selector - > set_session ( _session ) ;
2020-09-11 14:10:30 -04:00
}
2021-06-07 20:19:09 -04:00
_playlist_selector - > prepare ( this , PlaylistSelector : : plCopy ) ;
2021-07-20 11:26:30 -04:00
_playlist_selector - > show ( ) ;
2020-09-11 14:10:30 -04:00
}
void
RouteUI : : show_playlist_share_selector ( )
{
2021-06-07 20:19:09 -04:00
if ( ! _playlist_selector ) {
_playlist_selector = new PlaylistSelector ( ) ;
_playlist_selector - > set_session ( _session ) ;
2020-09-11 14:10:30 -04:00
}
2021-06-07 20:19:09 -04:00
_playlist_selector - > prepare ( this , PlaylistSelector : : plShare ) ;
2021-07-20 11:26:30 -04:00
_playlist_selector - > show ( ) ;
2020-09-11 14:10:30 -04:00
}
void
RouteUI : : show_playlist_steal_selector ( )
{
2021-06-07 20:19:09 -04:00
if ( ! _playlist_selector ) {
_playlist_selector = new PlaylistSelector ( ) ;
_playlist_selector - > set_session ( _session ) ;
2020-09-11 14:10:30 -04:00
}
2021-06-07 20:19:09 -04:00
_playlist_selector - > prepare ( this , PlaylistSelector : : plSteal ) ;
2021-07-20 11:26:30 -04:00
_playlist_selector - > show ( ) ;
2021-01-25 17:52:39 -05:00
}
void
RouteUI : : rename_current_playlist ( )
{
Prompter prompter ( true ) ;
string name ;
2023-02-16 18:33:28 -05:00
std : : shared_ptr < Track > tr = track ( ) ;
2021-01-25 17:52:39 -05:00
if ( ! tr ) {
return ;
}
2023-02-16 18:33:28 -05:00
std : : shared_ptr < Playlist > pl = tr - > playlist ( ) ;
2021-01-25 17:52:39 -05:00
if ( ! pl ) {
return ;
}
prompter . set_title ( _ ( " Rename Playlist " ) ) ;
prompter . set_prompt ( _ ( " New name for playlist: " ) ) ;
prompter . add_button ( _ ( " Rename " ) , Gtk : : RESPONSE_ACCEPT ) ;
prompter . set_initial_text ( pl - > name ( ) ) ;
prompter . set_response_sensitive ( Gtk : : RESPONSE_ACCEPT , false ) ;
while ( true ) {
if ( prompter . run ( ) ! = Gtk : : RESPONSE_ACCEPT ) {
break ;
}
prompter . get_result ( name ) ;
if ( name . length ( ) ) {
if ( _session - > playlists ( ) - > by_name ( name ) ) {
2021-05-31 22:00:59 -04:00
prompter . set_prompt ( _ ( " That name is already in use. Use this instead? " ) ) ;
2021-01-25 17:52:39 -05:00
prompter . set_initial_text ( Playlist : : bump_name ( name , * _session ) ) ;
} else {
break ;
}
}
}
2021-06-01 17:17:05 -04:00
if ( name . length ( ) ) {
2023-02-16 18:33:28 -05:00
vector < std : : shared_ptr < Playlist > > playlists_gr = _session - > playlists ( ) - > playlists_for_pgroup ( pl - > pgroup_id ( ) ) ;
for ( vector < std : : shared_ptr < Playlist > > : : iterator i = playlists_gr . begin ( ) ; i ! = playlists_gr . end ( ) ; + + i ) {
2021-06-01 17:17:05 -04:00
( * i ) - > set_name ( name ) ;
}
}
2021-01-25 17:52:39 -05:00
}
2023-07-21 23:15:20 -04:00
void
RouteUI : : set_time_domain ( Temporal : : TimeDomain td , bool apply_to_selection )
{
if ( apply_to_selection ) {
std : : cerr < < " change route TD to " < < td < < std : : endl ;
ARDOUR_UI : : instance ( ) - > the_editor ( ) . get_selection ( ) . tracks . foreach_route_ui ( boost : : bind ( & RouteUI : : set_time_domain , _1 , td , false ) ) ;
} else {
route ( ) - > set_time_domain ( td ) ;
}
}
void
RouteUI : : clear_time_domain ( bool apply_to_selection )
{
if ( apply_to_selection ) {
ARDOUR_UI : : instance ( ) - > the_editor ( ) . get_selection ( ) . tracks . foreach_route_ui ( boost : : bind ( & RouteUI : : clear_time_domain , _1 , false ) ) ;
} else {
route ( ) - > clear_time_domain ( ) ;
}
}