2005-09-25 14:42:24 -04:00
/*
2009-10-14 12:10:01 -04:00
Copyright ( C ) 2002 - 2006 Paul Davis
2005-09-25 14:42:24 -04:00
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 . , 675 Mass Ave , Cambridge , MA 0213 9 , USA .
*/
2005-09-25 16:33:00 -04:00
# include <gtkmm2ext/gtk_ui.h>
# include <gtkmm2ext/stop_signal.h>
# include <gtkmm2ext/choice.h>
# include <gtkmm2ext/doi.h>
2006-07-13 23:43:32 -04:00
# include <gtkmm2ext/bindable_button.h>
2007-06-27 18:06:35 -04:00
# include <gtkmm2ext/barcontroller.h>
2008-12-12 09:43:24 -05:00
# include <gtkmm2ext/gtk_ui.h>
2005-09-25 14:42:24 -04:00
2009-02-25 13:26:51 -05:00
# include "ardour/route_group.h"
2009-07-13 19:09:16 -04:00
# include "ardour/dB.h"
2009-02-25 13:26:51 -05:00
# include "pbd/memento_command.h"
# include "pbd/stacktrace.h"
# include "pbd/shiva.h"
# include "pbd/controllable.h"
2005-09-25 14:42:24 -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"
2005-09-25 14:42:24 -04:00
# include "route_ui.h"
# include "keyboard.h"
# include "utils.h"
# include "prompter.h"
# include "gui_thread.h"
2007-06-27 18:06:35 -04:00
# include "ardour_dialog.h"
# include "latency_gui.h"
2009-05-16 22:08:13 -04:00
# include "mixer_strip.h"
2007-07-03 20:39:00 -04:00
# include "automation_time_axis.h"
2005-09-25 14:42:24 -04:00
2009-02-25 13:26:51 -05:00
# include "ardour/route.h"
2009-10-14 13:35:33 -04:00
# include "ardour/event_type_map.h"
2009-02-25 13:26:51 -05:00
# include "ardour/session.h"
# include "ardour/audioengine.h"
# include "ardour/audio_track.h"
# include "ardour/audio_diskstream.h"
# include "ardour/midi_track.h"
# include "ardour/midi_diskstream.h"
2009-03-02 13:08:15 -05:00
# include "ardour/template_utils.h"
# include "ardour/filename_extensions.h"
# include "ardour/directory_names.h"
2009-02-25 13:26:51 -05:00
# include "ardour/profile.h"
2005-09-25 14:42:24 -04:00
# include "i18n.h"
2005-10-10 16:38:53 -04:00
using namespace sigc ;
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 ;
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 ;
2005-09-25 14:42:24 -04:00
2009-06-23 16:02:15 -04:00
RouteUI : : RouteUI ( ARDOUR : : Session & sess )
2008-12-08 11:07:28 -05:00
: AxisView ( sess )
{
init ( ) ;
}
2009-06-23 16:02:15 -04:00
RouteUI : : RouteUI ( boost : : shared_ptr < ARDOUR : : Route > rt , ARDOUR : : Session & sess )
2008-12-08 11:07:28 -05:00
: AxisView ( sess )
{
init ( ) ;
set_route ( rt ) ;
}
RouteUI : : ~ RouteUI ( )
{
2009-04-15 14:04:23 -04:00
/* derived classes should emit GoingAway so that they receive the signal
when the object is still a legal derived instance .
*/
2009-10-14 12:10:01 -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 ;
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 ;
2005-09-25 14:42:24 -04:00
xml_node = 0 ;
mute_menu = 0 ;
solo_menu = 0 ;
2009-05-16 22:08:13 -04:00
sends_menu = 0 ;
2005-09-25 14:42:24 -04:00
ignore_toggle = false ;
wait_for_release = false ;
route_active_menu_item = 0 ;
2007-05-31 22:27:21 -04:00
polarity_menu_item = 0 ;
denormal_menu_item = 0 ;
2008-12-12 09:43:24 -05:00
multiple_mute_change = false ;
multiple_solo_change = false ;
2005-09-25 14:42:24 -04:00
2009-06-23 16:02:15 -04:00
mute_button = manage ( new BindableToggleButton ( ) ) ;
2008-12-08 11:07:28 -05:00
mute_button - > set_self_managed ( true ) ;
mute_button - > set_name ( " MuteButton " ) ;
2009-06-23 16:02:15 -04:00
mute_button - > add ( mute_button_label ) ;
mute_button_label . show ( ) ;
2008-12-12 09:43:24 -05:00
UI : : instance ( ) - > set_tip ( mute_button , _ ( " Mute this track " ) , " " ) ;
2008-12-08 11:07:28 -05:00
2009-06-23 16:02:15 -04:00
solo_button = manage ( new BindableToggleButton ( ) ) ;
2008-12-08 11:07:28 -05:00
solo_button - > set_self_managed ( true ) ;
solo_button - > set_name ( " SoloButton " ) ;
2009-06-23 16:02:15 -04:00
solo_button - > add ( solo_button_label ) ;
solo_button_label . show ( ) ;
2008-12-12 09:43:24 -05:00
UI : : instance ( ) - > set_tip ( solo_button , _ ( " Mute other (non-soloed) tracks " ) , " " ) ;
2009-06-11 09:22:42 -04:00
solo_button - > set_no_show_all ( true ) ;
2008-12-08 11:07:28 -05:00
2009-06-23 16:02:15 -04:00
rec_enable_button = manage ( new BindableToggleButton ( ) ) ;
2008-12-08 11:07:28 -05:00
rec_enable_button - > set_name ( " RecordEnableButton " ) ;
rec_enable_button - > set_self_managed ( true ) ;
2009-06-23 16:02:15 -04:00
rec_enable_button - > add ( rec_enable_button_label ) ;
rec_enable_button_label . show ( ) ;
2008-12-12 09:43:24 -05:00
UI : : instance ( ) - > set_tip ( rec_enable_button , _ ( " Enable recording on this track " ) , " " ) ;
2009-05-16 22:08:13 -04:00
show_sends_button = manage ( new BindableToggleButton ( " " ) ) ;
2009-05-17 13:05:56 -04:00
show_sends_button - > set_name ( " SendAlert " ) ;
2009-05-16 22:08:13 -04:00
show_sends_button - > set_self_managed ( true ) ;
UI : : instance ( ) - > set_tip ( show_sends_button , _ ( " make mixer strips show sends to this bus " ) , " " ) ;
2008-12-08 11:07:28 -05:00
_session . SoloChanged . connect ( mem_fun ( * this , & RouteUI : : solo_changed_so_update_mute ) ) ;
2009-06-14 09:44:26 -04:00
_session . TransportStateChange . connect ( mem_fun ( * this , & RouteUI : : check_rec_enable_sensitivity ) ) ;
2009-06-14 13:56:29 -04:00
Config - > ParameterChanged . connect ( mem_fun ( * this , & RouteUI : : parameter_changed ) ) ;
2008-12-08 11:07:28 -05:00
}
void
RouteUI : : reset ( )
{
2009-04-21 21:49:48 -04:00
//Remove route connections associated with us.
for ( vector < sigc : : connection > : : iterator it = connections . begin ( ) ; it ! = connections . end ( ) ; + + it ) {
( * it ) . disconnect ( ) ;
}
2008-12-08 11:07:28 -05:00
connections . clear ( ) ;
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
2008-12-08 11:07:28 -05:00
if ( xml_node ) {
/* do not delete the node - its owned by the route */
xml_node = 0 ;
}
2006-10-21 15:01:50 -04:00
2008-12-08 11:07:28 -05:00
route_active_menu_item = 0 ;
polarity_menu_item = 0 ;
denormal_menu_item = 0 ;
}
2005-09-25 14:42:24 -04:00
2008-12-08 11:07:28 -05:00
void
RouteUI : : set_route ( boost : : shared_ptr < Route > rp )
{
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
2008-12-08 11:07:28 -05:00
if ( set_color_from_route ( ) ) {
set_color ( unique_random_color ( ) ) ;
}
2007-03-18 02:07:08 -04:00
2008-12-08 11:07:28 -05:00
/* no, there is no memory leak here. This object cleans itself (and other stuff)
up when the route is destroyed .
*/
2009-04-15 14:04:23 -04:00
if ( self_destruct ) {
new PairedShiva < Route , RouteUI > ( * _route , * this ) ;
}
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
2008-12-08 11:07:28 -05:00
connections . push_back ( _route - > active_changed . connect ( mem_fun ( * this , & RouteUI : : route_active_changed ) ) ) ;
connections . push_back ( _route - > mute_changed . connect ( mem_fun ( * this , & RouteUI : : mute_changed ) ) ) ;
connections . push_back ( _route - > solo_changed . connect ( mem_fun ( * this , & RouteUI : : solo_changed ) ) ) ;
2009-07-01 09:36:50 -04:00
connections . push_back ( _route - > listen_changed . connect ( mem_fun ( * this , & RouteUI : : listen_changed ) ) ) ;
2009-06-09 16:21:19 -04:00
connections . push_back ( _route - > solo_isolated_changed . connect ( mem_fun ( * this , & RouteUI : : solo_changed ) ) ) ;
2009-10-14 12:10:01 -04:00
2009-10-13 16:43:28 -04:00
if ( _session . writable ( ) & & is_track ( ) ) {
2006-07-27 21:08:57 -04:00
boost : : shared_ptr < Track > t = boost : : dynamic_pointer_cast < Track > ( _route ) ;
2005-09-25 14:42:24 -04:00
2008-12-08 11:07:28 -05:00
connections . push_back ( t - > diskstream ( ) - > RecordEnableChanged . connect ( mem_fun ( * this , & RouteUI : : route_rec_enable_changed ) ) ) ;
connections . push_back ( _session . RecordStateChanged . connect ( mem_fun ( * this , & RouteUI : : session_rec_enable_changed ) ) ) ;
2005-09-25 14:42:24 -04:00
2007-07-07 01:04:34 -04:00
rec_enable_button - > show ( ) ;
2008-12-08 11:07:28 -05:00
rec_enable_button - > set_controllable ( t - > rec_enable_control ( ) ) ;
2006-07-13 23:43:32 -04:00
update_rec_display ( ) ;
2009-10-14 12:10:01 -04:00
}
2006-09-18 23:29:16 -04:00
2005-09-25 16:33:00 -04:00
mute_button - > unset_flags ( Gtk : : CAN_FOCUS ) ;
solo_button - > unset_flags ( Gtk : : CAN_FOCUS ) ;
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
2009-07-01 19:14:27 -04:00
if ( _route - > is_control ( ) ) {
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 the current state */
2009-04-21 21:49:48 -04:00
mute_changed ( 0 ) ;
solo_changed ( 0 ) ;
2005-09-25 14:42:24 -04:00
map_frozen ( ) ;
}
2006-09-18 23:29:16 -04:00
bool
2005-09-25 14:42:24 -04:00
RouteUI : : mute_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 ;
}
2008-12-12 09:43:24 -05:00
multiple_mute_change = false ;
2005-09-25 14:42:24 -04:00
if ( ! ignore_toggle ) {
if ( Keyboard : : is_context_menu_event ( ev ) ) {
if ( mute_menu = = 0 ) {
build_mute_menu ( ) ;
}
2006-11-19 11:45:16 -05:00
mute_menu - > popup ( 0 , ev - > time ) ;
2005-09-25 14:42:24 -04:00
} else {
2008-12-12 09:43:24 -05:00
if ( Keyboard : : is_button2_event ( ev ) ) {
2008-01-10 16:20:59 -05:00
// Primary-button2 click is the midi binding click
2005-09-25 14:42:24 -04:00
// button2-click is "momentary"
2009-10-14 12:10:01 -04:00
2008-01-10 16:20:59 -05:00
if ( ! Keyboard : : modifier_state_equals ( ev - > state , Keyboard : : ModifierMask ( Keyboard : : PrimaryModifier ) ) ) {
2005-09-25 14:42:24 -04:00
wait_for_release = true ;
2006-11-19 11:45:16 -05:00
} else {
return false ;
2005-09-25 14:42:24 -04:00
}
}
2008-12-12 09:43:24 -05:00
if ( ev - > button = = 1 | | Keyboard : : is_button2_event ( ev ) ) {
2005-09-25 14:42:24 -04:00
2008-01-10 16:20:59 -05:00
if ( Keyboard : : modifier_state_equals ( ev - > state , Keyboard : : ModifierMask ( Keyboard : : PrimaryModifier | Keyboard : : TertiaryModifier ) ) ) {
2005-09-25 14:42:24 -04:00
2008-01-10 16:20:59 -05:00
/* Primary-Tertiary-click applies change to all routes */
2005-09-25 14:42:24 -04:00
_session . begin_reversible_command ( _ ( " mute change " ) ) ;
2006-08-09 21:22:45 -04:00
Session : : GlobalMuteStateCommand * cmd = new Session : : GlobalMuteStateCommand ( _session , this ) ;
2006-07-27 21:08:57 -04:00
_session . set_all_mute ( ! _route - > muted ( ) ) ;
2006-08-09 21:22:45 -04:00
cmd - > mark ( ) ;
_session . add_command ( cmd ) ;
2005-09-25 14:42:24 -04:00
_session . commit_reversible_command ( ) ;
2008-12-12 09:43:24 -05:00
multiple_mute_change = true ;
2005-09-25 14:42:24 -04:00
2008-01-10 16:20:59 -05:00
} else if ( Keyboard : : modifier_state_equals ( ev - > state , Keyboard : : PrimaryModifier ) ) {
2005-09-25 14:42:24 -04:00
2008-01-10 16:20:59 -05:00
/* Primary-button1 applies change to the mix group.
NOTE : Primary - button2 is MIDI learn .
2005-09-25 14:42:24 -04:00
*/
if ( ev - > button = = 1 ) {
2009-06-21 15:59:56 -04:00
set_route_group_mute ( _route , ! _route - > muted ( ) ) ;
2005-09-25 14:42:24 -04:00
}
2009-10-14 12:10:01 -04:00
2005-09-25 14:42:24 -04:00
} else {
/* plain click applies change to this route */
2008-12-12 09:43:24 -05:00
if ( wait_for_release ) {
_route - > set_mute ( ! _route - > muted ( ) , this ) ;
} else {
reversibly_apply_route_boolean ( " mute change " , & Route : : set_mute , ! _route - > muted ( ) , this ) ;
}
2005-09-25 14:42:24 -04:00
}
}
}
}
2005-12-06 11:21:06 -05:00
return true ;
2005-09-25 14:42:24 -04:00
}
2006-09-18 23:29:16 -04:00
bool
2009-07-21 11:55:17 -04:00
RouteUI : : mute_release ( GdkEventButton * )
2005-09-25 14:42:24 -04:00
{
if ( ! ignore_toggle ) {
if ( wait_for_release ) {
wait_for_release = false ;
2008-12-12 09:43:24 -05:00
if ( multiple_mute_change ) {
multiple_mute_change = false ;
// undo the last op
// because the press was the last undoable thing we did
_session . undo ( 1U ) ;
} else {
_route - > set_mute ( ! _route - > muted ( ) , this ) ;
}
2005-09-25 14:42:24 -04:00
}
}
2005-12-06 11:21:06 -05:00
return true ;
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 : : 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 ;
}
2005-09-25 14:42:24 -04:00
2009-07-01 09:36:50 -04:00
if ( Config - > get_solo_control_is_listen_control ( ) ) {
2005-09-25 14:42:24 -04:00
2009-07-01 09:36:50 -04:00
_route - > set_listen ( ! _route - > listening ( ) , this ) ;
2005-09-25 14:42:24 -04:00
2009-07-01 09:36:50 -04:00
} else {
2005-09-25 14:42:24 -04:00
2009-07-01 09:36:50 -04:00
multiple_solo_change = false ;
if ( ! ignore_toggle ) {
2009-10-14 12:10:01 -04:00
2009-07-01 09:36:50 -04:00
if ( Keyboard : : is_context_menu_event ( ev ) ) {
2009-10-14 12:10:01 -04:00
2009-07-01 09:36:50 -04:00
if ( solo_menu = = 0 ) {
build_solo_menu ( ) ;
2005-09-25 14:42:24 -04:00
}
2009-10-14 12:10:01 -04:00
2009-07-01 09:36:50 -04:00
solo_menu - > popup ( 1 , ev - > time ) ;
2009-10-14 12:10:01 -04:00
2009-07-01 09:36:50 -04:00
} else {
2009-10-14 12:10:01 -04:00
2009-07-01 09:36:50 -04:00
if ( Keyboard : : is_button2_event ( ev ) ) {
2009-10-14 12:10:01 -04:00
2009-07-01 09:36:50 -04:00
// Primary-button2 click is the midi binding click
// button2-click is "momentary"
2009-10-14 12:10:01 -04:00
2009-07-01 09:36:50 -04:00
if ( ! Keyboard : : modifier_state_equals ( ev - > state , Keyboard : : ModifierMask ( Keyboard : : PrimaryModifier ) ) ) {
wait_for_release = true ;
} else {
return false ;
2008-12-12 09:43:24 -05:00
}
2009-07-01 09:36:50 -04:00
}
2009-10-14 12:10:01 -04:00
2009-07-01 09:36:50 -04:00
if ( ev - > button = = 1 | | Keyboard : : is_button2_event ( ev ) ) {
2009-10-14 12:10:01 -04:00
2009-07-01 09:36:50 -04:00
if ( Keyboard : : modifier_state_equals ( ev - > state , Keyboard : : ModifierMask ( Keyboard : : PrimaryModifier | Keyboard : : TertiaryModifier ) ) ) {
2009-10-14 12:10:01 -04:00
2009-07-01 09:36:50 -04:00
/* Primary-Tertiary-click applies change to all routes */
bool was_not_latched = false ;
2008-12-12 09:43:24 -05:00
if ( ! Config - > get_solo_latched ( ) ) {
2009-07-01 09:36:50 -04:00
was_not_latched = true ;
/*
2009-10-14 12:10:01 -04:00
XXX it makes no sense to solo all tracks if we ' re
not in latched mode , but doing nothing feels like a bug ,
so do it anyway
2009-07-01 09:36:50 -04:00
*/
2008-12-12 09:43:24 -05:00
Config - > set_solo_latched ( true ) ;
2009-07-01 09:36:50 -04:00
}
_session . begin_reversible_command ( _ ( " solo change " ) ) ;
Session : : GlobalSoloStateCommand * cmd = new Session : : GlobalSoloStateCommand ( _session , this ) ;
_session . set_all_solo ( ! _route - > soloed ( ) ) ;
cmd - > mark ( ) ;
_session . add_command ( cmd ) ;
_session . commit_reversible_command ( ) ;
multiple_solo_change = true ;
if ( was_not_latched ) {
2008-12-12 09:43:24 -05:00
Config - > set_solo_latched ( false ) ;
}
2009-10-14 12:10:01 -04:00
2009-07-01 09:36:50 -04:00
} else if ( Keyboard : : modifier_state_contains ( ev - > state , Keyboard : : ModifierMask ( Keyboard : : PrimaryModifier | Keyboard : : SecondaryModifier ) ) ) {
2009-10-14 12:10:01 -04:00
2009-07-01 09:36:50 -04:00
// Primary-Secondary-click: exclusively solo this track, not a toggle */
_session . begin_reversible_command ( _ ( " solo change " ) ) ;
Session : : GlobalSoloStateCommand * cmd = new Session : : GlobalSoloStateCommand ( _session , this ) ;
_session . set_all_solo ( false ) ;
_route - > set_solo ( true , this ) ;
cmd - > mark ( ) ;
_session . add_command ( cmd ) ;
_session . commit_reversible_command ( ) ;
} else if ( Keyboard : : modifier_state_equals ( ev - > state , Keyboard : : TertiaryModifier ) ) {
// shift-click: set this route to solo safe
if ( Profile - > get_sae ( ) & & ev - > button = = 1 ) {
// button 1 and shift-click: disables solo_latched for this click
if ( ! Config - > get_solo_latched ( ) ) {
Config - > set_solo_latched ( true ) ;
reversibly_apply_route_boolean ( " solo change " , & Route : : set_solo , ! _route - > soloed ( ) , this ) ;
Config - > set_solo_latched ( false ) ;
}
} else {
_route - > set_solo_isolated ( ! _route - > solo_isolated ( ) , this ) ;
wait_for_release = false ;
}
2005-09-25 14:42:24 -04:00
2009-07-01 09:36:50 -04:00
} else if ( Keyboard : : modifier_state_equals ( ev - > state , Keyboard : : PrimaryModifier ) ) {
2005-09-25 14:42:24 -04:00
2009-07-01 09:36:50 -04:00
/* Primary-button1: solo mix group.
NOTE : Primary - button2 is MIDI learn .
*/
2005-09-25 14:42:24 -04:00
2009-07-01 09:36:50 -04:00
if ( ev - > button = = 1 ) {
set_route_group_solo ( _route , ! _route - > soloed ( ) ) ;
}
2005-09-25 14:42:24 -04:00
2008-12-12 09:43:24 -05:00
} else {
2009-07-01 09:36:50 -04:00
/* click: solo this route */
if ( wait_for_release ) {
_route - > set_solo ( ! _route - > soloed ( ) , this ) ;
} else {
reversibly_apply_route_boolean ( " solo change " , & Route : : set_solo , ! _route - > soloed ( ) , this ) ;
}
2008-12-12 09:43:24 -05:00
}
2005-09-25 14:42:24 -04:00
}
}
}
}
2006-03-29 13:52:55 -05:00
return true ;
2005-09-25 14:42:24 -04:00
}
2006-09-18 23:29:16 -04:00
bool
2009-07-21 11:55:17 -04:00
RouteUI : : solo_release ( GdkEventButton * )
2005-09-25 14:42:24 -04:00
{
2006-03-29 13:52:55 -05:00
if ( ! ignore_toggle ) {
if ( wait_for_release ) {
2005-09-25 14:42:24 -04:00
wait_for_release = false ;
2008-12-12 09:43:24 -05:00
if ( multiple_solo_change ) {
multiple_solo_change = false ;
// undo the last op
// because the press was the last undoable thing we did
_session . undo ( 1U ) ;
} else {
// we don't use "undo the last op"
// here because its expensive for the GUI
_route - > set_solo ( ! _route - > soloed ( ) , this ) ;
}
2005-09-25 14:42:24 -04:00
}
}
2006-03-29 13:52:55 -05:00
return true ;
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 ;
}
2006-11-19 11:45:16 -05:00
if ( ! _session . engine ( ) . connected ( ) ) {
MessageDialog msg ( _ ( " Not connected to JACK - cannot engage record " ) ) ;
msg . run ( ) ;
return true ;
}
2006-07-23 08:03:19 -04:00
if ( ! ignore_toggle & & is_track ( ) & & rec_enable_button ) {
2005-09-25 14:42:24 -04:00
2008-12-12 09:43:24 -05:00
if ( Keyboard : : is_button2_event ( ev ) & & Keyboard : : modifier_state_equals ( ev - > state , Keyboard : : PrimaryModifier ) ) {
2007-03-18 02:07:08 -04:00
2005-09-25 14:42:24 -04:00
// do nothing on midi bind event
2008-01-10 16:20:59 -05:00
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
_session . begin_reversible_command ( _ ( " rec-enable change " ) ) ;
2006-08-09 21:22:45 -04:00
Session : : GlobalRecordEnableStateCommand * cmd = new Session : : GlobalRecordEnableStateCommand ( _session , this ) ;
2005-09-25 14:42:24 -04:00
if ( rec_enable_button - > get_active ( ) ) {
_session . record_disenable_all ( ) ;
} else {
_session . record_enable_all ( ) ;
2009-06-14 09:44:26 -04:00
check_rec_enable_sensitivity ( ) ;
2005-09-25 14:42:24 -04:00
}
2006-08-09 21:22:45 -04:00
cmd - > mark ( ) ;
_session . add_command ( cmd ) ;
2005-09-25 14:42:24 -04:00
_session . commit_reversible_command ( ) ;
2008-01-10 16:20:59 -05:00
} else if ( Keyboard : : modifier_state_equals ( ev - > state , Keyboard : : PrimaryModifier ) ) {
/* Primary-button1 applies change to the mix group.
NOTE : Primary - button2 is MIDI learn .
*/
2005-09-25 14:42:24 -04:00
2009-06-21 15:59:56 -04:00
set_route_group_rec_enable ( _route , ! _route - > record_enabled ( ) ) ;
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 {
2006-08-14 04:44:14 -04:00
reversibly_apply_track_boolean ( " rec-enable change " , & Track : : set_record_enable , ! track ( ) - > record_enabled ( ) , this ) ;
2009-06-14 09:44:26 -04:00
check_rec_enable_sensitivity ( ) ;
2005-09-25 14:42:24 -04:00
}
}
2007-03-18 02:07:08 -04:00
return true ;
}
bool
2009-09-09 12:38:32 -04:00
RouteUI : : rec_enable_release ( GdkEventButton * )
2007-03-18 02:07:08 -04:00
{
return true ;
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
2009-07-14 20:47:34 -04:00
items . push_back ( MenuElem ( _ ( " Assign all tracks (prefader) " ) , bind ( mem_fun ( * this , & RouteUI : : create_sends ) , PreFader ) ) ) ;
items . push_back ( MenuElem ( _ ( " Assign all tracks (postfader) " ) , bind ( mem_fun ( * this , & RouteUI : : create_sends ) , PostFader ) ) ) ;
2009-05-16 22:08:13 -04:00
items . push_back ( MenuElem ( _ ( " Copy track gains to sends " ) , mem_fun ( * this , & RouteUI : : set_sends_gain_from_track ) ) ) ;
items . push_back ( MenuElem ( _ ( " Set sends gain to -inf " ) , mem_fun ( * this , & RouteUI : : set_sends_gain_to_zero ) ) ) ;
items . push_back ( MenuElem ( _ ( " Set sends gain to 0dB " ) , mem_fun ( * this , & RouteUI : : set_sends_gain_to_unity ) ) ) ;
2009-06-25 16:46:39 -04:00
}
void
2009-07-14 20:47:34 -04:00
RouteUI : : create_sends ( Placement p )
2009-06-25 16:46:39 -04:00
{
2009-07-14 20:47:34 -04:00
_session . globally_add_internal_sends ( _route , p ) ;
2009-05-16 22:08:13 -04:00
}
void
RouteUI : : set_sends_gain_from_track ( )
{
2009-07-21 08:05:44 -04: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-07-21 08:05:44 -04: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-07-21 08:05:44 -04:00
_session . globally_set_send_gains_to_unity ( _route ) ;
2009-05-16 22:08:13 -04:00
}
bool
RouteUI : : show_sends_press ( GdkEventButton * ev )
{
if ( ev - > type = = GDK_2BUTTON_PRESS | | ev - > type = = GDK_3BUTTON_PRESS ) {
return true ;
}
if ( ! ignore_toggle & & ! is_track ( ) & & show_sends_button ) {
if ( Keyboard : : is_button2_event ( ev ) & & Keyboard : : modifier_state_equals ( ev - > state , Keyboard : : PrimaryModifier ) ) {
// do nothing on midi bind event
return false ;
} else if ( Keyboard : : is_context_menu_event ( ev ) ) {
if ( sends_menu = = 0 ) {
build_sends_menu ( ) ;
}
sends_menu - > popup ( 0 , ev - > time ) ;
} else {
/* change button state */
show_sends_button - > set_active ( ! show_sends_button - > get_active ( ) ) ;
2009-05-17 13:05:56 -04:00
/* start blinking */
2009-05-16 22:08:13 -04:00
if ( show_sends_button - > get_active ( ) ) {
/* show sends to this bus */
MixerStrip : : SwitchIO ( _route ) ;
2009-05-17 13:05:56 -04:00
send_blink_connection = ARDOUR_UI : : instance ( ) - > Blink . connect ( mem_fun ( * this , & RouteUI : : send_blink ) ) ;
2009-05-16 22:08:13 -04:00
} else {
/* everybody back to normal */
2009-05-17 13:05:56 -04:00
send_blink_connection . disconnect ( ) ;
2009-05-16 22:08:13 -04:00
MixerStrip : : SwitchIO ( boost : : shared_ptr < Route > ( ) ) ;
}
}
}
return true ;
}
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 ) {
show_sends_button - > set_state ( STATE_ACTIVE ) ;
} else {
show_sends_button - > set_state ( STATE_NORMAL ) ;
}
}
2005-09-25 14:42:24 -04:00
void
2009-07-21 11:55:17 -04:00
RouteUI : : solo_changed ( void * /*src*/ )
2005-09-25 14:42:24 -04:00
{
2009-07-01 09:36:50 -04:00
Gtkmm2ext : : UI : : instance ( ) - > call_slot ( mem_fun ( * this , & RouteUI : : update_solo_display ) ) ;
}
2008-12-12 09:43:24 -05:00
2009-07-01 09:36:50 -04:00
void
2009-07-21 11:55:17 -04:00
RouteUI : : listen_changed ( void * /*src*/ )
2009-07-01 09:36:50 -04:00
{
2005-09-25 17:19:23 -04:00
Gtkmm2ext : : UI : : instance ( ) - > call_slot ( mem_fun ( * this , & RouteUI : : update_solo_display ) ) ;
2005-09-25 14:42:24 -04:00
}
void
RouteUI : : update_solo_display ( )
{
bool x ;
2009-07-01 09:36:50 -04:00
if ( Config - > get_solo_control_is_listen_control ( ) ) {
if ( solo_button - > get_active ( ) ! = ( x = _route - > listening ( ) ) ) {
ignore_toggle = true ;
solo_button - > set_active ( x ) ;
ignore_toggle = false ;
}
2009-07-01 19:14:27 -04:00
if ( x ) {
solo_button - > set_visual_state ( 1 ) ;
} else {
solo_button - > set_visual_state ( 0 ) ;
}
2005-09-25 14:42:24 -04:00
} else {
2009-07-01 09:36:50 -04:00
if ( solo_button - > get_active ( ) ! = ( x = _route - > soloed ( ) ) ) {
ignore_toggle = true ;
2009-07-01 19:14:27 -04:00
solo_button - > set_active ( x ) ;
2009-07-01 09:36:50 -04:00
ignore_toggle = false ;
2009-10-14 12:10:01 -04:00
}
2009-07-01 09:36:50 -04:00
if ( _route - > solo_isolated ( ) ) {
solo_button - > set_visual_state ( 2 ) ;
2009-07-01 19:14:27 -04:00
} else if ( x ) {
2009-07-01 09:36:50 -04:00
solo_button - > set_visual_state ( 1 ) ;
} else {
solo_button - > set_visual_state ( 0 ) ;
}
2005-09-25 14:42:24 -04:00
}
}
2007-03-18 02:07:08 -04:00
void
RouteUI : : solo_changed_so_update_mute ( )
{
Gtkmm2ext : : UI : : instance ( ) - > call_slot ( mem_fun ( * this , & RouteUI : : update_mute_display ) ) ;
}
2005-09-25 14:42:24 -04:00
void
2009-07-21 11:55:17 -04:00
RouteUI : : mute_changed ( void * /*src*/ )
2005-09-25 14:42:24 -04:00
{
2005-09-25 17:19:23 -04:00
Gtkmm2ext : : UI : : instance ( ) - > call_slot ( mem_fun ( * this , & RouteUI : : update_mute_display ) ) ;
2005-09-25 14:42:24 -04:00
}
void
RouteUI : : update_mute_display ( )
{
2007-03-18 02:07:08 -04:00
bool model = _route - > muted ( ) ;
bool view = mute_button - > get_active ( ) ;
2005-09-25 14:42:24 -04:00
2007-03-18 02:07:08 -04:00
/* first make sure the button's "depressed" visual
is correct .
*/
if ( model ! = view ) {
2005-09-25 14:42:24 -04:00
ignore_toggle = true ;
2007-03-18 02:07:08 -04:00
mute_button - > set_active ( model ) ;
2005-09-25 14:42:24 -04:00
ignore_toggle = false ;
}
2007-03-18 02:07:08 -04:00
/* now attend to visual state */
2009-10-14 12:10:01 -04:00
2007-03-18 02:07:08 -04:00
if ( Config - > get_show_solo_mutes ( ) ) {
if ( _route - > muted ( ) ) {
mute_button - > set_visual_state ( 2 ) ;
2009-06-09 16:21:19 -04:00
} else if ( ! _route - > soloed ( ) & & _session . soloing ( ) ) {
2007-03-18 02:07:08 -04:00
mute_button - > set_visual_state ( 1 ) ;
} else {
mute_button - > set_visual_state ( 0 ) ;
}
} else {
if ( _route - > muted ( ) ) {
mute_button - > set_visual_state ( 2 ) ;
} else {
mute_button - > set_visual_state ( 0 ) ;
}
}
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
{
2005-09-25 17:19:23 -04:00
Gtkmm2ext : : UI : : instance ( ) - > call_slot ( mem_fun ( * this , & RouteUI : : update_rec_display ) ) ;
2005-09-25 14:42:24 -04:00
}
void
RouteUI : : session_rec_enable_changed ( )
{
2005-09-25 17:19:23 -04:00
Gtkmm2ext : : UI : : instance ( ) - > call_slot ( mem_fun ( * this , & RouteUI : : update_rec_display ) ) ;
2005-09-25 14:42:24 -04:00
}
void
RouteUI : : update_rec_display ( )
{
2006-07-27 21:08:57 -04:00
bool model = _route - > record_enabled ( ) ;
2005-09-25 14:42:24 -04:00
bool view = rec_enable_button - > get_active ( ) ;
/* first make sure the button's "depressed" visual
is correct .
*/
2007-03-18 02:07:08 -04:00
2005-09-25 14:42:24 -04:00
if ( model ! = view ) {
ignore_toggle = true ;
rec_enable_button - > set_active ( model ) ;
ignore_toggle = false ;
}
2009-06-17 21:48:11 -04:00
else {
return ;
}
2009-10-14 12:10:01 -04:00
2005-09-25 14:42:24 -04:00
/* now make sure its color state is correct */
if ( model ) {
switch ( _session . record_status ( ) ) {
2007-03-18 02:07:08 -04:00
case Session : : Recording :
rec_enable_button - > set_visual_state ( 1 ) ;
break ;
2005-09-25 14:42:24 -04:00
case Session : : Disabled :
case Session : : Enabled :
2007-03-18 02:07:08 -04:00
rec_enable_button - > set_visual_state ( 2 ) ;
2005-09-25 14:42:24 -04:00
break ;
}
} else {
2007-03-18 02:07:08 -04:00
rec_enable_button - > set_visual_state ( 0 ) ;
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 ( ) ;
CheckMenuItem * check ;
2009-06-09 16:21:19 -04:00
check = new CheckMenuItem ( _ ( " Solo Isolate " ) ) ;
check - > set_active ( _route - > solo_isolated ( ) ) ;
check - > signal_toggled ( ) . connect ( bind ( mem_fun ( * this , & RouteUI : : toggle_solo_isolated ) , check ) ) ;
_route - > solo_isolated_changed . connect ( bind ( mem_fun ( * this , & RouteUI : : solo_isolated_toggle ) , check ) ) ;
2005-09-25 14:42:24 -04:00
items . push_back ( CheckMenuElem ( * check ) ) ;
check - > show_all ( ) ;
2006-11-19 11:45:16 -05:00
//items.push_back (SeparatorElem());
2006-07-13 23:43:32 -04:00
// items.push_back (MenuElem (_("MIDI Bind"), mem_fun (*mute_button, &BindableToggleButton::midi_learn)));
2009-10-14 12:10:01 -04:00
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
2009-10-14 12:10:01 -04:00
# if FIX_ME_IN_3_0
2005-09-25 14:42:24 -04:00
MenuList & items = mute_menu - > items ( ) ;
CheckMenuItem * check ;
2009-06-09 16:21:19 -04:00
2005-09-25 14:42:24 -04:00
check = new CheckMenuItem ( _ ( " Pre Fader " ) ) ;
init_mute_menu ( PRE_FADER , check ) ;
2005-10-06 14:24:23 -04:00
check - > signal_toggled ( ) . connect ( bind ( mem_fun ( * this , & RouteUI : : toggle_mute_menu ) , PRE_FADER , check ) ) ;
2006-07-27 21:08:57 -04:00
_route - > pre_fader_changed . connect ( bind ( mem_fun ( * this , & RouteUI : : pre_fader_toggle ) , check ) ) ;
2005-09-25 14:42:24 -04:00
items . push_back ( CheckMenuElem ( * check ) ) ;
check - > show_all ( ) ;
check = new CheckMenuItem ( _ ( " Post Fader " ) ) ;
init_mute_menu ( POST_FADER , check ) ;
2005-10-06 14:24:23 -04:00
check - > signal_toggled ( ) . connect ( bind ( mem_fun ( * this , & RouteUI : : toggle_mute_menu ) , POST_FADER , check ) ) ;
2006-07-27 21:08:57 -04:00
_route - > post_fader_changed . connect ( bind ( mem_fun ( * this , & RouteUI : : post_fader_toggle ) , check ) ) ;
2005-09-25 14:42:24 -04:00
items . push_back ( CheckMenuElem ( * check ) ) ;
check - > show_all ( ) ;
2009-10-14 12:10:01 -04:00
2005-09-25 14:42:24 -04:00
check = new CheckMenuItem ( _ ( " Control Outs " ) ) ;
init_mute_menu ( CONTROL_OUTS , check ) ;
2005-10-06 14:24:23 -04:00
check - > signal_toggled ( ) . connect ( bind ( mem_fun ( * this , & RouteUI : : toggle_mute_menu ) , CONTROL_OUTS , check ) ) ;
2006-07-27 21:08:57 -04:00
_route - > control_outs_changed . connect ( bind ( mem_fun ( * this , & RouteUI : : control_outs_toggle ) , check ) ) ;
2005-09-25 14:42:24 -04:00
items . push_back ( CheckMenuElem ( * check ) ) ;
check - > show_all ( ) ;
check = new CheckMenuItem ( _ ( " Main Outs " ) ) ;
init_mute_menu ( MAIN_OUTS , check ) ;
2005-10-06 14:24:23 -04:00
check - > signal_toggled ( ) . connect ( bind ( mem_fun ( * this , & RouteUI : : toggle_mute_menu ) , MAIN_OUTS , check ) ) ;
2006-07-27 21:08:57 -04:00
_route - > main_outs_changed . connect ( bind ( mem_fun ( * this , & RouteUI : : main_outs_toggle ) , check ) ) ;
2005-09-25 14:42:24 -04:00
items . push_back ( CheckMenuElem ( * check ) ) ;
check - > show_all ( ) ;
2009-06-09 16:21:19 -04:00
# endif
2006-11-19 11:45:16 -05:00
//items.push_back (SeparatorElem());
2006-07-13 23:43:32 -04:00
// items.push_back (MenuElem (_("MIDI Bind"), mem_fun (*mute_button, &BindableToggleButton::midi_learn)));
2005-09-25 14:42:24 -04:00
}
void
2009-06-09 16:21:19 -04:00
RouteUI : : init_mute_menu ( MuteMaster : : MutePoint mp , CheckMenuItem * check )
2005-09-25 14:42:24 -04:00
{
2009-06-09 16:21:19 -04:00
check - > set_active ( _route - > mute_master ( ) - > muted_at ( mp ) ) ;
2005-09-25 14:42:24 -04:00
}
void
2009-07-21 11:55:17 -04:00
RouteUI : : toggle_mute_menu ( MuteMaster : : MutePoint /*mp*/ , Gtk : : CheckMenuItem * /*check*/ )
2005-09-25 14:42:24 -04:00
{
2009-06-09 16:21:19 -04:00
// _route->set_mute_config(type, check->get_active(), this);
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
{
2009-06-09 16:21:19 -04:00
_route - > set_solo_isolated ( check - > get_active ( ) , this ) ;
2005-09-25 14:42:24 -04:00
}
void
2009-06-21 15:59:56 -04:00
RouteUI : : set_route_group_solo ( boost : : shared_ptr < Route > route , bool yn )
2005-09-25 14:42:24 -04:00
{
2009-06-21 15:59:56 -04:00
RouteGroup * route_group ;
2005-09-25 14:42:24 -04:00
2009-06-21 15:59:56 -04:00
if ( ( route_group = route - > route_group ( ) ) ! = 0 ) {
2005-09-25 14:42:24 -04:00
_session . begin_reversible_command ( _ ( " mix group solo change " ) ) ;
2006-08-09 21:22:45 -04:00
Session : : GlobalSoloStateCommand * cmd = new Session : : GlobalSoloStateCommand ( _session , this ) ;
2009-06-21 15:59:56 -04:00
route_group - > apply ( & Route : : set_solo , yn , this ) ;
2006-08-09 21:22:45 -04:00
cmd - > mark ( ) ;
_session . add_command ( cmd ) ;
2005-09-25 14:42:24 -04:00
_session . commit_reversible_command ( ) ;
} else {
2006-07-27 21:08:57 -04:00
reversibly_apply_route_boolean ( " solo change " , & Route : : set_solo , ! route - > soloed ( ) , this ) ;
2005-09-25 14:42:24 -04:00
}
}
void
RouteUI : : reversibly_apply_route_boolean ( string name , void ( Route : : * func ) ( bool , void * ) , bool yn , void * arg )
{
_session . begin_reversible_command ( name ) ;
2007-07-03 20:39:00 -04:00
XMLNode & before = _route - > get_state ( ) ;
bind ( mem_fun ( * _route , func ) , yn , arg ) ( ) ;
XMLNode & after = _route - > get_state ( ) ;
_session . add_command ( new MementoCommand < Route > ( * _route , & before , & after ) ) ;
2005-09-25 14:42:24 -04:00
_session . commit_reversible_command ( ) ;
}
2006-08-14 04:44:14 -04:00
void
RouteUI : : reversibly_apply_track_boolean ( string name , void ( Track : : * func ) ( bool , void * ) , bool yn , void * arg )
{
_session . begin_reversible_command ( name ) ;
2007-07-03 20:39:00 -04:00
XMLNode & before = track ( ) - > get_state ( ) ;
2006-08-14 04:44:14 -04:00
bind ( mem_fun ( * track ( ) , func ) , yn , arg ) ( ) ;
2007-07-03 20:39:00 -04:00
XMLNode & after = track ( ) - > get_state ( ) ;
2006-08-24 03:37:17 -04:00
_session . add_command ( new MementoCommand < Track > ( * track ( ) , & before , & after ) ) ;
2006-08-14 04:44:14 -04:00
_session . commit_reversible_command ( ) ;
}
2005-09-25 14:42:24 -04:00
void
2009-06-21 15:59:56 -04:00
RouteUI : : set_route_group_mute ( boost : : shared_ptr < Route > route , bool yn )
2005-09-25 14:42:24 -04:00
{
2009-06-21 15:59:56 -04:00
RouteGroup * route_group ;
2005-09-25 14:42:24 -04:00
2009-06-21 15:59:56 -04:00
if ( ( route_group = route - > route_group ( ) ) ! = 0 ) {
2005-09-25 14:42:24 -04:00
_session . begin_reversible_command ( _ ( " mix group mute change " ) ) ;
2006-08-09 21:22:45 -04:00
Session : : GlobalMuteStateCommand * cmd = new Session : : GlobalMuteStateCommand ( _session , this ) ;
2009-06-21 15:59:56 -04:00
route_group - > apply ( & Route : : set_mute , yn , this ) ;
2006-08-09 21:22:45 -04:00
cmd - > mark ( ) ;
_session . add_command ( cmd ) ;
2005-09-25 14:42:24 -04:00
_session . commit_reversible_command ( ) ;
} else {
2006-07-27 21:08:57 -04:00
reversibly_apply_route_boolean ( " mute change " , & Route : : set_mute , ! route - > muted ( ) , this ) ;
2005-09-25 14:42:24 -04:00
}
}
void
2009-06-21 15:59:56 -04:00
RouteUI : : set_route_group_rec_enable ( boost : : shared_ptr < Route > route , bool yn )
2005-09-25 14:42:24 -04:00
{
2009-06-21 15:59:56 -04:00
RouteGroup * route_group ;
2005-09-25 14:42:24 -04:00
2009-06-21 15:59:56 -04:00
if ( ( route_group = route - > route_group ( ) ) ! = 0 ) {
2005-09-25 14:42:24 -04:00
_session . begin_reversible_command ( _ ( " mix group rec-enable change " ) ) ;
2006-08-09 21:22:45 -04:00
Session : : GlobalRecordEnableStateCommand * cmd = new Session : : GlobalRecordEnableStateCommand ( _session , this ) ;
2009-06-21 15:59:56 -04:00
route_group - > apply ( & Route : : set_record_enable , yn , this ) ;
2006-08-09 21:22:45 -04:00
cmd - > mark ( ) ;
_session . add_command ( cmd ) ;
2005-09-25 14:42:24 -04:00
_session . commit_reversible_command ( ) ;
} else {
2006-07-27 21:08:57 -04:00
reversibly_apply_route_boolean ( " rec-enable change " , & Route : : set_record_enable , ! _route - > record_enabled ( ) , this ) ;
2005-09-25 14:42:24 -04:00
}
}
bool
RouteUI : : choose_color ( )
{
bool picked ;
2005-10-06 14:24:23 -04:00
Gdk : : Color color ;
2005-09-25 14:42:24 -04:00
2005-12-18 07:02:42 -05:00
color = Gtkmm2ext : : UI : : instance ( ) - > get_color ( _ ( " ardour: color selection " ) , picked , & _color ) ;
2005-09-25 14:42:24 -04:00
if ( picked ) {
set_color ( color ) ;
}
return picked ;
}
void
2005-12-18 07:02:42 -05:00
RouteUI : : set_color ( const Gdk : : Color & c )
2005-09-25 14:42:24 -04:00
{
char buf [ 64 ] ;
2009-10-14 12:10:01 -04:00
2005-09-25 14:42:24 -04:00
_color = c ;
2009-10-14 12:10:01 -04:00
2005-09-25 14:42:24 -04:00
ensure_xml_node ( ) ;
2005-10-06 14:24:23 -04:00
snprintf ( buf , sizeof ( buf ) , " %d:%d:%d " , c . get_red ( ) , c . get_green ( ) , c . get_blue ( ) ) ;
2005-09-25 14:42:24 -04:00
xml_node - > add_property ( " color " , buf ) ;
2007-01-09 18:24:54 -05:00
_route - > gui_changed ( " color " , ( void * ) 0 ) ; /* EMIT_SIGNAL */
2005-09-25 14:42:24 -04:00
}
void
RouteUI : : ensure_xml_node ( )
{
if ( xml_node = = 0 ) {
2006-07-27 21:08:57 -04:00
if ( ( xml_node = _route - > extra_xml ( " GUI " ) ) = = 0 ) {
2005-09-25 14:42:24 -04:00
xml_node = new XMLNode ( " GUI " ) ;
2006-07-27 21:08:57 -04:00
_route - > add_extra_xml ( * xml_node ) ;
2005-09-25 14:42:24 -04:00
}
}
}
XMLNode *
2008-09-29 18:47:40 -04:00
RouteUI : : get_automation_child_xml_node ( Evoral : : Parameter param )
2005-09-25 14:42:24 -04:00
{
ensure_xml_node ( ) ;
2009-10-14 12:10:01 -04:00
2007-07-03 20:39:00 -04:00
XMLNodeList kids = xml_node - > children ( ) ;
XMLNodeConstIterator iter ;
2008-09-29 18:47:40 -04:00
const string sym = ARDOUR : : EventTypeMap : : instance ( ) . to_symbol ( param ) ;
2007-07-03 20:39:00 -04:00
for ( iter = kids . begin ( ) ; iter ! = kids . end ( ) ; + + iter ) {
if ( ( * iter ) - > name ( ) = = AutomationTimeAxisView : : state_node_name ) {
XMLProperty * type = ( * iter ) - > property ( " automation-id " ) ;
2008-09-29 18:47:40 -04:00
if ( type & & type - > value ( ) = = sym )
2007-07-03 20:39:00 -04:00
return * iter ;
}
2005-09-25 14:42:24 -04:00
}
2007-07-03 20:39:00 -04:00
// Didn't find it, make a new one
XMLNode * child = new XMLNode ( AutomationTimeAxisView : : state_node_name ) ;
2008-09-29 18:47:40 -04:00
child - > add_property ( " automation-id " , sym ) ;
2007-07-03 20:39:00 -04:00
xml_node - > add_child_nocopy ( * child ) ;
2005-09-25 14:42:24 -04:00
return child ;
}
int
RouteUI : : set_color_from_route ( )
{
XMLProperty * prop ;
2009-10-14 12:10:01 -04:00
2005-09-25 14:42:24 -04:00
RouteUI : : ensure_xml_node ( ) ;
if ( ( prop = xml_node - > property ( " color " ) ) ! = 0 ) {
int r , g , b ;
sscanf ( prop - > value ( ) . c_str ( ) , " %d:%d:%d " , & r , & g , & b ) ;
2005-10-06 14:24:23 -04:00
_color . set_red ( r ) ;
_color . set_green ( g ) ;
_color . set_blue ( b ) ;
2005-09-25 14:42:24 -04:00
return 0 ;
2009-10-14 12:10:01 -04:00
}
2005-09-25 14:42:24 -04:00
return 1 ;
}
void
RouteUI : : remove_this_route ( )
{
vector < string > choices ;
string prompt ;
2006-07-23 08:03:19 -04:00
if ( is_track ( ) ) {
2006-07-27 21:08:57 -04:00
prompt = string_compose ( _ ( " Do you really want to remove track \" %1 \" ? \n \n You may also lose the playlist used by this track. \n (cannot be undone) " ) , _route - > name ( ) ) ;
2005-09-25 14:42:24 -04:00
} else {
2006-07-27 21:08:57 -04:00
prompt = string_compose ( _ ( " Do you really want to remove bus \" %1 \" ? \n (cannot be undone) " ) , _route - > name ( ) ) ;
2005-09-25 14:42:24 -04:00
}
choices . push_back ( _ ( " No, do nothing. " ) ) ;
2006-04-20 07:41:45 -04:00
choices . push_back ( _ ( " Yes, remove it. " ) ) ;
2005-09-25 14:42:24 -04:00
Choice prompter ( prompt , choices ) ;
2006-04-20 07:41:45 -04:00
if ( prompter . run ( ) = = 1 ) {
2006-03-22 12:03:00 -05:00
Glib : : signal_idle ( ) . connect ( bind ( sigc : : ptr_fun ( & RouteUI : : idle_remove_this_route ) , this ) ) ;
2005-09-25 14:42:24 -04:00
}
}
gint
RouteUI : : idle_remove_this_route ( RouteUI * rui )
{
rui - > _session . remove_route ( rui - > _route ) ;
2008-12-12 09:43:24 -05:00
return false ;
2005-09-25 14:42:24 -04:00
}
void
RouteUI : : route_rename ( )
{
ArdourPrompter name_prompter ( true ) ;
2005-10-26 21:10:36 -04:00
string result ;
2006-04-22 11:28:59 -04:00
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 ( ) ;
2005-10-26 21:10:36 -04:00
switch ( name_prompter . run ( ) ) {
2005-09-25 14:42:24 -04:00
2006-01-13 14:48:55 -05:00
case Gtk : : RESPONSE_ACCEPT :
name_prompter . get_result ( result ) ;
if ( result . length ( ) ) {
2007-06-23 16:13:13 -04:00
_route - > set_name ( result ) ;
2009-10-14 12:10:01 -04:00
}
2005-10-26 21:10:36 -04:00
break ;
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
}
void
2007-06-23 16:13:13 -04:00
RouteUI : : name_changed ( )
2005-09-25 14:42:24 -04:00
{
2007-06-23 16:13:13 -04:00
ENSURE_GUI_THREAD ( sigc : : mem_fun ( * this , & RouteUI : : name_changed ) ) ;
2006-05-17 08:07:16 -04:00
2006-07-27 21:08:57 -04:00
name_label . set_text ( _route - > name ( ) ) ;
2005-09-25 14:42:24 -04:00
}
void
RouteUI : : toggle_route_active ( )
{
bool yn ;
if ( route_active_menu_item ) {
2006-07-27 21:08:57 -04:00
if ( route_active_menu_item - > get_active ( ) ! = ( yn = _route - > active ( ) ) ) {
_route - > set_active ( ! yn ) ;
2005-09-25 14:42:24 -04:00
}
}
}
void
RouteUI : : route_active_changed ( )
{
if ( route_active_menu_item ) {
2006-07-27 21:08:57 -04:00
Gtkmm2ext : : UI : : instance ( ) - > call_slot ( bind ( mem_fun ( * route_active_menu_item , & CheckMenuItem : : set_active ) , _route - > active ( ) ) ) ;
2005-09-25 14:42:24 -04:00
}
}
2006-03-30 10:50:08 -05:00
void
RouteUI : : toggle_polarity ( )
{
if ( polarity_menu_item ) {
bool x ;
ENSURE_GUI_THREAD ( mem_fun ( * this , & RouteUI : : toggle_polarity ) ) ;
2009-10-14 12:10:01 -04:00
2006-07-27 21:08:57 -04:00
if ( ( x = polarity_menu_item - > get_active ( ) ) ! = _route - > phase_invert ( ) ) {
2009-06-10 14:10:07 -04:00
_route - > set_phase_invert ( x ) ;
2006-05-17 08:07:16 -04:00
if ( x ) {
name_label . set_text ( X_ ( " Ø " ) + name_label . get_text ( ) ) ;
} else {
2006-07-27 21:08:57 -04:00
name_label . set_text ( _route - > name ( ) ) ;
2006-05-17 08:07:16 -04:00
}
2006-03-30 10:50:08 -05:00
}
}
}
void
RouteUI : : polarity_changed ( )
{
2009-06-10 14:10:07 -04:00
if ( _route - > phase_invert ( ) ) {
name_label . set_text ( X_ ( " Ø " ) + name_label . get_text ( ) ) ;
} else {
name_label . set_text ( _route - > name ( ) ) ;
}
2006-03-30 10:50:08 -05:00
}
2007-05-31 22:27:21 -04:00
void
RouteUI : : toggle_denormal_protection ( )
{
if ( denormal_menu_item ) {
bool x ;
ENSURE_GUI_THREAD ( mem_fun ( * 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
2009-07-21 11:55:17 -04:00
RouteUI : : solo_isolated_toggle ( void * /*src*/ , Gtk : : CheckMenuItem * check )
2005-09-25 14:42:24 -04:00
{
2009-06-09 16:21:19 -04:00
bool yn = _route - > solo_isolated ( ) ;
2005-09-25 14:42:24 -04:00
if ( check - > get_active ( ) ! = yn ) {
check - > set_active ( yn ) ;
}
}
2009-06-09 16:21:19 -04:00
# ifdef FIX_THIS_FOR_3_0
2005-09-25 14:42:24 -04:00
void
RouteUI : : pre_fader_toggle ( void * src , Gtk : : CheckMenuItem * check )
{
2005-09-25 17:19:23 -04:00
ENSURE_GUI_THREAD ( bind ( mem_fun ( * this , & RouteUI : : pre_fader_toggle ) , src , check ) ) ;
2009-10-14 12:10:01 -04:00
2006-07-27 21:08:57 -04:00
bool yn = _route - > get_mute_config ( PRE_FADER ) ;
2005-09-25 14:42:24 -04:00
if ( check - > get_active ( ) ! = yn ) {
check - > set_active ( yn ) ;
}
}
void
RouteUI : : post_fader_toggle ( void * src , Gtk : : CheckMenuItem * check )
{
2005-09-25 17:19:23 -04:00
ENSURE_GUI_THREAD ( bind ( mem_fun ( * this , & RouteUI : : post_fader_toggle ) , src , check ) ) ;
2009-10-14 12:10:01 -04:00
2006-07-27 21:08:57 -04:00
bool yn = _route - > get_mute_config ( POST_FADER ) ;
2005-09-25 14:42:24 -04:00
if ( check - > get_active ( ) ! = yn ) {
check - > set_active ( yn ) ;
}
}
void
RouteUI : : control_outs_toggle ( void * src , Gtk : : CheckMenuItem * check )
{
2005-09-25 17:19:23 -04:00
ENSURE_GUI_THREAD ( bind ( mem_fun ( * this , & RouteUI : : control_outs_toggle ) , src , check ) ) ;
2009-10-14 12:10:01 -04:00
2006-07-27 21:08:57 -04:00
bool yn = _route - > get_mute_config ( CONTROL_OUTS ) ;
2005-09-25 14:42:24 -04:00
if ( check - > get_active ( ) ! = yn ) {
check - > set_active ( yn ) ;
}
}
void
RouteUI : : main_outs_toggle ( void * src , Gtk : : CheckMenuItem * check )
{
2005-09-25 17:19:23 -04:00
ENSURE_GUI_THREAD ( bind ( mem_fun ( * this , & RouteUI : : main_outs_toggle ) , src , check ) ) ;
2009-10-14 12:10:01 -04:00
2006-07-27 21:08:57 -04:00
bool yn = _route - > get_mute_config ( MAIN_OUTS ) ;
2005-09-25 14:42:24 -04:00
if ( check - > get_active ( ) ! = yn ) {
check - > set_active ( yn ) ;
}
}
2009-06-09 16:21:19 -04:00
# endif
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
{
2007-06-15 18:05:07 -04:00
return boost : : dynamic_pointer_cast < Track > ( _route ) ! = 0 ;
2006-07-23 08:03:19 -04:00
}
2007-06-15 18:05:07 -04:00
boost : : shared_ptr < Track >
2006-07-27 21:08:57 -04:00
RouteUI : : track ( ) const
2005-09-25 14:42:24 -04:00
{
2007-06-15 18:05:07 -04:00
return boost : : 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
{
2007-06-15 18:05:07 -04:00
return boost : : dynamic_pointer_cast < AudioTrack > ( _route ) ! = 0 ;
2006-07-05 15:47:25 -04:00
}
2007-06-15 18:05:07 -04:00
boost : : shared_ptr < AudioTrack >
2006-07-27 21:08:57 -04:00
RouteUI : : audio_track ( ) const
2005-09-25 14:42:24 -04:00
{
2007-06-15 18:05:07 -04:00
return boost : : 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
{
2007-06-15 18:05:07 -04:00
return boost : : dynamic_pointer_cast < MidiTrack > ( _route ) ! = 0 ;
2005-09-25 14:42:24 -04:00
}
2006-07-05 15:47:25 -04:00
2007-06-15 18:05:07 -04:00
boost : : shared_ptr < MidiTrack >
2006-07-05 15:47:25 -04:00
RouteUI : : midi_track ( ) const
{
2007-06-15 18:05:07 -04:00
return boost : : dynamic_pointer_cast < MidiTrack > ( _route ) ;
2006-07-05 15:47:25 -04:00
}
2006-08-24 03:37:17 -04:00
boost : : shared_ptr < Diskstream >
2006-07-23 08:03:19 -04:00
RouteUI : : get_diskstream ( ) const
{
2006-07-27 21:08:57 -04:00
boost : : shared_ptr < Track > t ;
2006-07-23 08:03:19 -04:00
2006-07-27 21:08:57 -04:00
if ( ( t = boost : : dynamic_pointer_cast < Track > ( _route ) ) ! = 0 ) {
2006-08-24 03:37:17 -04:00
return t - > diskstream ( ) ;
2006-07-23 08:03:19 -04:00
} else {
2006-08-24 03:37:17 -04:00
return boost : : shared_ptr < Diskstream > ( ( Diskstream * ) 0 ) ;
2006-07-23 08:03:19 -04:00
}
}
2005-09-25 14:42:24 -04:00
string
RouteUI : : name ( ) const
{
2006-07-27 21:08:57 -04:00
return _route - > name ( ) ;
2005-09-25 14:42:24 -04:00
}
void
RouteUI : : map_frozen ( )
{
2005-09-25 17:19:23 -04:00
ENSURE_GUI_THREAD ( mem_fun ( * this , & RouteUI : : map_frozen ) ) ;
2005-09-25 14:42:24 -04:00
2006-07-27 21:08:57 -04:00
AudioTrack * at = dynamic_cast < AudioTrack * > ( _route . get ( ) ) ;
2005-09-25 14:42:24 -04:00
if ( at ) {
switch ( at - > freeze_state ( ) ) {
case AudioTrack : : Frozen :
rec_enable_button - > set_sensitive ( false ) ;
break ;
default :
rec_enable_button - > set_sensitive ( true ) ;
break ;
}
}
}
2006-07-27 21:08:57 -04:00
2007-06-27 18:06:35 -04:00
void
RouteUI : : adjust_latency ( )
{
2009-06-21 22:00:25 -04:00
LatencyDialog dialog ( _route - > name ( ) + _ ( " latency " ) , * ( _route - > output ( ) ) , _session . frame_rate ( ) , _session . engine ( ) . frames_per_cycle ( ) ) ;
2007-06-27 18:06:35 -04:00
}
2009-02-27 17:52:39 -05:00
2009-03-02 13:08:15 -05:00
void
RouteUI : : save_as_template ( )
{
sys : : path path ;
Glib : : ustring safe_name ;
string name ;
2009-10-14 12:10:01 -04:00
2009-03-02 13:08:15 -05:00
path = ARDOUR : : user_route_template_directory ( ) ;
2009-10-14 12:10:01 -04:00
2009-03-02 13:08:15 -05:00
if ( g_mkdir_with_parents ( path . to_string ( ) . c_str ( ) , 0755 ) ) {
error < < string_compose ( _ ( " Cannot create route template directory %1 " ) , path . to_string ( ) ) < < endmsg ;
return ;
}
2009-10-14 12:10:01 -04:00
2009-03-02 13:08:15 -05:00
Prompter p ( true ) ; // modal
2009-10-14 12:10:01 -04:00
2009-03-02 13:08:15 -05:00
p . set_prompt ( _ ( " Template name: " ) ) ;
switch ( p . run ( ) ) {
case RESPONSE_ACCEPT :
break ;
default :
return ;
}
2009-10-14 12:10:01 -04:00
2009-03-02 13:08:15 -05:00
p . hide ( ) ;
p . get_result ( name , true ) ;
2009-10-14 12:10:01 -04:00
2009-03-02 13:08:15 -05:00
safe_name = legalize_for_path ( name ) ;
2009-04-21 21:35:31 -04:00
safe_name + = template_suffix ;
2009-10-14 12:10:01 -04:00
2009-03-02 13:08:15 -05:00
path / = safe_name ;
2009-10-14 12:10:01 -04:00
2009-03-02 13:08:15 -05:00
_route - > save_as_template ( path . to_string ( ) , name ) ;
}
2009-06-14 09:44:26 -04:00
void
RouteUI : : check_rec_enable_sensitivity ( )
{
2009-06-14 13:56:29 -04:00
if ( _session . transport_rolling ( ) & & rec_enable_button - > get_active ( ) & & Config - > get_disable_disarm_during_roll ( ) ) {
2009-06-14 09:44:26 -04:00
rec_enable_button - > set_sensitive ( false ) ;
} else {
rec_enable_button - > set_sensitive ( true ) ;
}
}
2009-06-14 13:56:29 -04:00
void
RouteUI : : parameter_changed ( string const & p )
{
ENSURE_GUI_THREAD ( bind ( mem_fun ( * this , & RouteUI : : parameter_changed ) , p ) ) ;
2009-10-14 12:10:01 -04:00
2009-06-14 13:56:29 -04:00
if ( p = = " disable-disarm-during-roll " ) {
check_rec_enable_sensitivity ( ) ;
2009-07-01 09:36:50 -04:00
} else if ( p = = " solo-control-is-listen-control " ) {
set_button_names ( ) ;
} else if ( p = = " listen-position " ) {
2009-06-23 16:02:15 -04:00
set_button_names ( ) ;
2009-06-14 13:56:29 -04:00
}
}
2009-06-23 16:02:15 -04:00
2009-07-13 19:09:16 -04:00
void
RouteUI : : step_gain_up ( )
{
2009-08-22 06:21:39 -04:00
_route - > set_gain ( dB_to_coefficient ( accurate_coefficient_to_dB ( _route - > gain_control ( ) - > get_value ( ) ) + 0.1 ) , this ) ;
2009-07-13 19:09:16 -04:00
}
void
RouteUI : : page_gain_up ( )
{
2009-08-22 06:21:39 -04:00
_route - > set_gain ( dB_to_coefficient ( accurate_coefficient_to_dB ( _route - > gain_control ( ) - > get_value ( ) ) + 0.5 ) , this ) ;
2009-07-13 19:09:16 -04:00
}
void
RouteUI : : step_gain_down ( )
{
2009-08-22 06:21:39 -04:00
_route - > set_gain ( dB_to_coefficient ( accurate_coefficient_to_dB ( _route - > gain_control ( ) - > get_value ( ) ) - 0.1 ) , this ) ;
2009-07-13 19:09:16 -04:00
}
void
RouteUI : : page_gain_down ( )
{
2009-08-22 06:21:39 -04:00
_route - > set_gain ( dB_to_coefficient ( accurate_coefficient_to_dB ( _route - > gain_control ( ) - > get_value ( ) ) - 0.5 ) , this ) ;
2009-07-13 19:09:16 -04:00
}
2009-08-29 19:31:59 -04:00
void
RouteUI : : open_remote_control_id_dialog ( )
{
ArdourDialog dialog ( _ ( " Remote Control ID " ) ) ;
uint32_t const limit = _session . ntracks ( ) + _session . nbusses ( ) + 4 ;
HBox * hbox = manage ( new HBox ) ;
hbox - > set_spacing ( 6 ) ;
hbox - > pack_start ( * manage ( new Label ( _ ( " Remote control ID: " ) ) ) ) ;
SpinButton * spin = manage ( new SpinButton ) ;
spin - > set_digits ( 0 ) ;
spin - > set_increments ( 1 , 10 ) ;
spin - > set_range ( 0 , limit ) ;
spin - > set_value ( _route - > remote_control_id ( ) ) ;
hbox - > pack_start ( * spin ) ;
dialog . get_vbox ( ) - > pack_start ( * hbox ) ;
dialog . add_button ( Stock : : CANCEL , RESPONSE_CANCEL ) ;
dialog . add_button ( Stock : : APPLY , RESPONSE_ACCEPT ) ;
dialog . show_all ( ) ;
int const r = dialog . run ( ) ;
if ( r = = RESPONSE_ACCEPT ) {
_route - > set_remote_control_id ( spin - > get_value_as_int ( ) ) ;
}
}