2005-12-31 18:20:42 +00:00
/*
2008-08-04 22:37:24 +00:00
Copyright ( C ) 2005 Paul Davis
2005-12-31 18:20:42 +00: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 .
*/
2009-07-13 00:26:28 +00:00
# ifdef WAF_BUILD
# include "gtk2ardour-config.h"
# endif
2009-02-25 18:26:51 +00:00
# include "pbd/convert.h"
# include "pbd/stacktrace.h"
2017-01-16 19:54:20 +01:00
# include "pbd/unwind.h"
2006-04-25 20:23:50 +00:00
2006-01-08 02:56:49 +00:00
# include <gtkmm2ext/utils.h>
2010-10-18 22:02:12 +00:00
# include "ardour/rc_configuration.h"
2012-05-24 06:09:29 +00:00
# include "ardour/session.h"
2005-12-31 18:20:42 +00:00
2013-10-20 09:04:48 -04:00
# include "canvas/wave_view.h"
2007-12-15 23:29:30 +00:00
2011-06-02 17:50:37 +00:00
# include "audio_clock.h"
2005-12-31 18:20:42 +00:00
# include "ardour_ui.h"
# include "actions.h"
2006-01-08 02:56:49 +00:00
# include "gui_thread.h"
2008-01-10 21:20:59 +00:00
# include "public_editor.h"
2012-05-31 23:14:03 +00:00
# include "main_clock.h"
2006-01-08 02:56:49 +00:00
2016-07-14 14:44:52 -04:00
# include "pbd/i18n.h"
2005-12-31 18:20:42 +00:00
using namespace Gtk ;
2006-01-08 02:56:49 +00:00
using namespace Gtkmm2ext ;
2005-12-31 18:20:42 +00:00
using namespace ARDOUR ;
2006-06-21 23:01:03 +00:00
using namespace PBD ;
2005-12-31 18:20:42 +00:00
2009-11-10 04:30:08 +00:00
void
ARDOUR_UI : : toggle_external_sync ( )
{
2010-11-25 20:37:39 +00:00
if ( _session ) {
if ( _session - > config . get_video_pullup ( ) ! = 0.0f ) {
2013-09-19 17:34:23 -04:00
if ( Config - > get_sync_source ( ) = = Engine ) {
2010-11-25 20:37:39 +00:00
MessageDialog msg (
_ ( " It is not possible to use JACK as the the sync source \n \
2010-08-31 01:49:33 +00:00
when the pull up / down setting is non - zero . " ));
2010-11-25 20:37:39 +00:00
msg . run ( ) ;
return ;
}
}
2011-06-01 17:00:29 +00:00
2013-01-05 10:40:07 +00:00
ActionManager : : toggle_config_state_foo ( " Transport " , " ToggleExternalSync " , sigc : : mem_fun ( _session - > config , & SessionConfiguration : : set_external_sync ) , sigc : : mem_fun ( _session - > config , & SessionConfiguration : : get_external_sync ) ) ;
2012-11-12 16:49:11 +00:00
/* activating a slave is a session-property.
* The slave type is a RC property .
* When the slave is active is must not be reconfigured .
* This is a UI limitation , imposed by audio - clock and
* status displays which combine RC - config & session - properties .
*
* Notficy RCOptionEditor by emitting a signal if the active
* status changed :
*/
Config - > ParameterChanged ( " sync-source " ) ;
2010-11-25 20:37:39 +00:00
}
2009-11-10 04:30:08 +00:00
}
2006-09-25 21:24:00 +00:00
void
ARDOUR_UI : : toggle_time_master ( )
{
2009-12-17 18:24:23 +00:00
ActionManager : : toggle_config_state_foo ( " Transport " , " ToggleTimeMaster " , sigc : : mem_fun ( _session - > config , & SessionConfiguration : : set_jack_time_master ) , sigc : : mem_fun ( _session - > config , & SessionConfiguration : : get_jack_time_master ) ) ;
2006-09-25 21:24:00 +00:00
}
2005-12-31 18:20:42 +00:00
void
ARDOUR_UI : : toggle_send_mtc ( )
{
2016-02-28 01:11:48 +01:00
ActionManager : : toggle_config_state ( " Options " , " SendMTC " , & RCConfiguration : : set_send_mtc , & RCConfiguration : : get_send_mtc ) ;
2005-12-31 18:20:42 +00:00
}
void
ARDOUR_UI : : toggle_send_mmc ( )
{
2016-02-28 01:11:48 +01:00
ActionManager : : toggle_config_state ( " Options " , " SendMMC " , & RCConfiguration : : set_send_mmc , & RCConfiguration : : get_send_mmc ) ;
2005-12-31 18:20:42 +00:00
}
2008-11-26 23:32:55 +00:00
void
ARDOUR_UI : : toggle_send_midi_clock ( )
{
2016-02-28 01:11:48 +01:00
ActionManager : : toggle_config_state ( " Options " , " SendMidiClock " , & RCConfiguration : : set_send_midi_clock , & RCConfiguration : : get_send_midi_clock ) ;
2008-11-26 23:32:55 +00:00
}
2005-12-31 18:20:42 +00:00
void
ARDOUR_UI : : toggle_use_mmc ( )
{
2016-02-28 01:11:48 +01:00
ActionManager : : toggle_config_state ( " Options " , " UseMMC " , & RCConfiguration : : set_mmc_control , & RCConfiguration : : get_mmc_control ) ;
2005-12-31 18:20:42 +00:00
}
2006-01-08 05:19:38 +00:00
void
ARDOUR_UI : : toggle_auto_input ( )
{
2009-12-17 18:24:23 +00:00
ActionManager : : toggle_config_state_foo ( " Transport " , " ToggleAutoInput " , sigc : : mem_fun ( _session - > config , & SessionConfiguration : : set_auto_input ) , sigc : : mem_fun ( _session - > config , & SessionConfiguration : : get_auto_input ) ) ;
2006-01-08 05:19:38 +00:00
}
void
ARDOUR_UI : : toggle_auto_play ( )
{
2009-12-17 18:24:23 +00:00
ActionManager : : toggle_config_state_foo ( " Transport " , " ToggleAutoPlay " , sigc : : mem_fun ( _session - > config , & SessionConfiguration : : set_auto_play ) , sigc : : mem_fun ( _session - > config , & SessionConfiguration : : get_auto_play ) ) ;
2006-01-08 05:19:38 +00:00
}
2015-06-25 12:47:29 -04:00
void
ARDOUR_UI : : toggle_auto_return ( )
{
ActionManager : : toggle_config_state_foo ( " Transport " , " ToggleAutoReturn " , sigc : : mem_fun ( _session - > config , & SessionConfiguration : : set_auto_return ) , sigc : : mem_fun ( _session - > config , & SessionConfiguration : : get_auto_return ) ) ;
}
2006-01-08 05:19:38 +00:00
void
ARDOUR_UI : : toggle_click ( )
{
2009-05-14 00:13:27 +00:00
ActionManager : : toggle_config_state ( " Transport " , " ToggleClick " , & RCConfiguration : : set_clicking , & RCConfiguration : : get_clicking ) ;
2006-01-08 05:19:38 +00:00
}
2017-01-16 19:54:20 +01:00
void
ARDOUR_UI : : toggle_session_monitoring_in ( )
{
Glib : : RefPtr < Action > act = ActionManager : : get_action ( X_ ( " Transport " ) , X_ ( " SessionMonitorIn " ) ) ;
if ( ! act ) {
return ;
}
Glib : : RefPtr < ToggleAction > tact = Glib : : RefPtr < ToggleAction > : : cast_dynamic ( act ) ;
if ( ! tact ) {
return ;
}
2017-01-18 12:25:02 +01:00
if ( tact - > get_active ( ) & & _session - > config . get_session_monitoring ( ) = = MonitorInput ) {
return ;
}
if ( ! tact - > get_active ( ) & & _session - > config . get_session_monitoring ( ) ! = MonitorInput ) {
return ;
}
2017-01-16 19:54:20 +01:00
if ( tact - > get_active ( ) ) {
_session - > config . set_session_monitoring ( MonitorInput ) ;
} else {
_session - > config . set_session_monitoring ( MonitorAuto ) ;
}
}
void
ARDOUR_UI : : toggle_session_monitoring_disk ( )
{
Glib : : RefPtr < Action > act = ActionManager : : get_action ( X_ ( " Transport " ) , X_ ( " SessionMonitorDisk " ) ) ;
if ( ! act ) {
return ;
}
Glib : : RefPtr < ToggleAction > tact = Glib : : RefPtr < ToggleAction > : : cast_dynamic ( act ) ;
if ( ! tact ) {
return ;
}
2017-01-18 12:25:02 +01:00
if ( tact - > get_active ( ) & & _session - > config . get_session_monitoring ( ) = = MonitorDisk ) {
return ;
}
if ( ! tact - > get_active ( ) & & _session - > config . get_session_monitoring ( ) ! = MonitorDisk ) {
return ;
}
2017-01-16 19:54:20 +01:00
if ( tact - > get_active ( ) ) {
_session - > config . set_session_monitoring ( MonitorDisk ) ;
} else {
_session - > config . set_session_monitoring ( MonitorAuto ) ;
}
}
2008-03-17 20:54:03 +00:00
void
ARDOUR_UI : : unset_dual_punch ( )
{
Glib : : RefPtr < Action > action = ActionManager : : get_action ( " Transport " , " TogglePunch " ) ;
2008-08-04 22:37:24 +00:00
2008-03-17 20:54:03 +00:00
if ( action ) {
Glib : : RefPtr < ToggleAction > tact = Glib : : RefPtr < ToggleAction > : : cast_dynamic ( action ) ;
if ( tact ) {
ignore_dual_punch = true ;
tact - > set_active ( false ) ;
ignore_dual_punch = false ;
}
}
}
void
ARDOUR_UI : : toggle_punch ( )
{
if ( ignore_dual_punch ) {
return ;
}
Glib : : RefPtr < Action > action = ActionManager : : get_action ( " Transport " , " TogglePunch " ) ;
if ( action ) {
Glib : : RefPtr < ToggleAction > tact = Glib : : RefPtr < ToggleAction > : : cast_dynamic ( action ) ;
if ( ! tact ) {
return ;
}
/* drive the other two actions from this one */
Glib : : RefPtr < Action > in_action = ActionManager : : get_action ( " Transport " , " TogglePunchIn " ) ;
Glib : : RefPtr < Action > out_action = ActionManager : : get_action ( " Transport " , " TogglePunchOut " ) ;
if ( in_action & & out_action ) {
Glib : : RefPtr < ToggleAction > tiact = Glib : : RefPtr < ToggleAction > : : cast_dynamic ( in_action ) ;
Glib : : RefPtr < ToggleAction > toact = Glib : : RefPtr < ToggleAction > : : cast_dynamic ( out_action ) ;
tiact - > set_active ( tact - > get_active ( ) ) ;
toact - > set_active ( tact - > get_active ( ) ) ;
}
}
}
2006-01-08 05:19:38 +00:00
void
ARDOUR_UI : : toggle_punch_in ( )
{
2009-10-20 21:58:46 +00:00
Glib : : RefPtr < Action > act = ActionManager : : get_action ( X_ ( " Transport " ) , X_ ( " TogglePunchIn " ) ) ;
if ( ! act ) {
return ;
}
Glib : : RefPtr < ToggleAction > tact = Glib : : RefPtr < ToggleAction > : : cast_dynamic ( act ) ;
if ( ! tact ) {
return ;
}
2009-12-17 18:24:23 +00:00
if ( tact - > get_active ( ) ! = _session - > config . get_punch_in ( ) ) {
_session - > config . set_punch_in ( tact - > get_active ( ) ) ;
2009-10-20 21:58:46 +00:00
}
if ( tact - > get_active ( ) ) {
/* if punch-in is turned on, make sure the loop/punch ruler is visible, and stop it being hidden,
to avoid confusing the user */
show_loop_punch_ruler_and_disallow_hide ( ) ;
}
reenable_hide_loop_punch_ruler_if_appropriate ( ) ;
2006-01-08 05:19:38 +00:00
}
void
ARDOUR_UI : : toggle_punch_out ( )
{
2009-10-20 21:58:46 +00:00
Glib : : RefPtr < Action > act = ActionManager : : get_action ( X_ ( " Transport " ) , X_ ( " TogglePunchOut " ) ) ;
if ( ! act ) {
return ;
}
Glib : : RefPtr < ToggleAction > tact = Glib : : RefPtr < ToggleAction > : : cast_dynamic ( act ) ;
if ( ! tact ) {
return ;
}
2009-12-17 18:24:23 +00:00
if ( tact - > get_active ( ) ! = _session - > config . get_punch_out ( ) ) {
_session - > config . set_punch_out ( tact - > get_active ( ) ) ;
2009-10-20 21:58:46 +00:00
}
if ( tact - > get_active ( ) ) {
/* if punch-out is turned on, make sure the loop/punch ruler is visible, and stop it being hidden,
to avoid confusing the user */
show_loop_punch_ruler_and_disallow_hide ( ) ;
}
reenable_hide_loop_punch_ruler_if_appropriate ( ) ;
}
void
ARDOUR_UI : : show_loop_punch_ruler_and_disallow_hide ( )
{
Glib : : RefPtr < Action > act = ActionManager : : get_action ( X_ ( " Rulers " ) , " toggle-loop-punch-ruler " ) ;
if ( ! act ) {
return ;
}
act - > set_sensitive ( false ) ;
2011-06-01 17:00:29 +00:00
2009-10-20 21:58:46 +00:00
Glib : : RefPtr < ToggleAction > tact = Glib : : RefPtr < ToggleAction > : : cast_dynamic ( act ) ;
if ( ! tact ) {
return ;
}
2011-06-01 17:00:29 +00:00
2009-10-20 21:58:46 +00:00
if ( ! tact - > get_active ( ) ) {
tact - > set_active ( ) ;
}
}
/* This is a bit of a silly name for a method */
void
ARDOUR_UI : : reenable_hide_loop_punch_ruler_if_appropriate ( )
{
2009-12-17 18:24:23 +00:00
if ( ! _session - > config . get_punch_in ( ) & & ! _session - > config . get_punch_out ( ) ) {
2009-10-20 21:58:46 +00:00
/* if punch in/out are now both off, reallow hiding of the loop/punch ruler */
Glib : : RefPtr < Action > act = ActionManager : : get_action ( X_ ( " Rulers " ) , " toggle-loop-punch-ruler " ) ;
if ( act ) {
act - > set_sensitive ( true ) ;
}
}
2006-01-08 05:19:38 +00:00
}
2006-09-25 21:24:00 +00:00
void
2006-08-31 13:23:43 +00:00
ARDOUR_UI : : toggle_video_sync ( )
{
Glib : : RefPtr < Action > act = ActionManager : : get_action ( " Transport " , " ToggleVideoSync " ) ;
if ( act ) {
Glib : : RefPtr < ToggleAction > tact = Glib : : RefPtr < ToggleAction > : : cast_dynamic ( act ) ;
2009-12-17 18:24:23 +00:00
_session - > config . set_use_video_sync ( tact - > get_active ( ) ) ;
2006-08-31 13:23:43 +00:00
}
}
2006-01-19 18:05:31 +00:00
void
ARDOUR_UI : : toggle_editing_space ( )
{
Glib : : RefPtr < Action > act = ActionManager : : get_action ( " Common " , " ToggleMaximalEditor " ) ;
2011-12-07 15:48:24 +00:00
2006-01-19 18:05:31 +00:00
if ( act ) {
Glib : : RefPtr < ToggleAction > tact = Glib : : RefPtr < ToggleAction > : : cast_dynamic ( act ) ;
if ( tact - > get_active ( ) ) {
2012-06-13 04:21:46 +00:00
maximise_editing_space ( ) ;
2006-01-19 18:05:31 +00:00
} else {
2012-06-13 04:21:46 +00:00
restore_editing_space ( ) ;
2006-01-19 18:05:31 +00:00
}
}
}
2006-01-08 02:56:49 +00:00
void
2009-11-09 20:05:18 +00:00
ARDOUR_UI : : setup_session_options ( )
2006-01-08 02:56:49 +00:00
{
2012-04-25 12:58:19 +00:00
_session - > config . ParameterChanged . connect ( _session_connections , MISSING_INVALIDATOR , boost : : bind ( & ARDOUR_UI : : parameter_changed , this , _1 ) , gui_context ( ) ) ;
2009-12-12 15:02:15 +00:00
boost : : function < void ( std : : string ) > pc ( boost : : bind ( & ARDOUR_UI : : parameter_changed , this , _1 ) ) ;
2009-12-17 18:24:23 +00:00
_session - > config . map_parameters ( pc ) ;
2006-01-08 02:56:49 +00:00
}
void
2009-05-16 01:22:43 +00:00
ARDOUR_UI : : parameter_changed ( std : : string p )
2006-09-25 21:24:00 +00:00
{
2009-11-09 20:05:18 +00:00
if ( p = = " external-sync " ) {
2009-11-10 04:30:08 +00:00
2009-12-17 18:24:23 +00:00
ActionManager : : map_some_state ( " Transport " , " ToggleExternalSync " , sigc : : mem_fun ( _session - > config , & SessionConfiguration : : get_external_sync ) ) ;
2009-11-10 04:30:08 +00:00
2009-12-17 18:24:23 +00:00
if ( ! _session - > config . get_external_sync ( ) ) {
2016-12-18 23:17:29 +01:00
sync_button . set_text ( S_ ( " SyncSource|Int. " ) ) ;
2015-12-10 12:38:35 +01:00
auto_loop_button . set_sensitive ( true ) ;
2007-04-11 13:07:51 +00:00
ActionManager : : get_action ( " Transport " , " ToggleAutoPlay " ) - > set_sensitive ( true ) ;
ActionManager : : get_action ( " Transport " , " ToggleAutoReturn " ) - > set_sensitive ( true ) ;
2012-11-26 22:35:57 +00:00
ActionManager : : get_action ( " Transport " , " ToggleFollowEdits " ) - > set_sensitive ( true ) ;
2009-11-09 20:05:18 +00:00
} else {
2012-10-11 03:10:18 +00:00
sync_button . set_text ( sync_source_to_string ( Config - > get_sync_source ( ) , true ) ) ;
2015-12-10 12:47:08 +01:00
if ( _session & & _session - > locations ( ) - > auto_loop_location ( ) ) {
// disable looping with external sync.
// This is not necessary because session-transport ignores the loop-state,
// but makes it clear to the user that it's disabled.
2015-12-15 08:39:44 +01:00
_session - > request_play_loop ( false , false ) ;
2015-12-10 12:47:08 +01:00
}
2015-12-10 12:38:35 +01:00
auto_loop_button . set_sensitive ( false ) ;
2015-12-10 12:47:08 +01:00
/* XXX we need to make sure that auto-play is off as well as insensitive */
2007-04-11 13:07:51 +00:00
ActionManager : : get_action ( " Transport " , " ToggleAutoPlay " ) - > set_sensitive ( false ) ;
ActionManager : : get_action ( " Transport " , " ToggleAutoReturn " ) - > set_sensitive ( false ) ;
2012-11-26 22:35:57 +00:00
ActionManager : : get_action ( " Transport " , " ToggleFollowEdits " ) - > set_sensitive ( false ) ;
2007-04-11 13:07:51 +00:00
}
2011-06-01 17:00:29 +00:00
2014-07-28 15:55:20 -05:00
} else if ( p = = " follow-edits " ) {
2012-01-30 22:53:22 +00:00
2014-12-22 13:39:41 -05:00
ActionManager : : map_some_state ( " Transport " , " ToggleFollowEdits " , & UIConfiguration : : get_follow_edits ) ;
2012-01-30 22:53:22 +00:00
2009-05-16 01:22:43 +00:00
} else if ( p = = " send-mtc " ) {
2006-09-25 21:24:00 +00:00
2016-02-28 01:11:48 +01:00
ActionManager : : map_some_state ( " Options " , " SendMTC " , & RCConfiguration : : get_send_mtc ) ;
2006-09-25 21:24:00 +00:00
2009-05-16 01:22:43 +00:00
} else if ( p = = " send-mmc " ) {
2006-09-25 21:24:00 +00:00
2016-02-28 01:11:48 +01:00
ActionManager : : map_some_state ( " Options " , " SendMMC " , & RCConfiguration : : get_send_mmc ) ;
2006-09-25 21:24:00 +00:00
2009-05-16 01:22:43 +00:00
} else if ( p = = " mmc-control " ) {
2016-02-28 01:11:48 +01:00
ActionManager : : map_some_state ( " Options " , " UseMMC " , & RCConfiguration : : get_mmc_control ) ;
2009-05-16 01:22:43 +00:00
} else if ( p = = " auto-play " ) {
2009-12-17 18:24:23 +00:00
ActionManager : : map_some_state ( " Transport " , " ToggleAutoPlay " , sigc : : mem_fun ( _session - > config , & SessionConfiguration : : get_auto_play ) ) ;
2009-05-16 01:22:43 +00:00
} else if ( p = = " auto-return " ) {
2009-12-17 18:24:23 +00:00
ActionManager : : map_some_state ( " Transport " , " ToggleAutoReturn " , sigc : : mem_fun ( _session - > config , & SessionConfiguration : : get_auto_return ) ) ;
2009-05-16 01:22:43 +00:00
} else if ( p = = " auto-input " ) {
2009-12-17 18:24:23 +00:00
ActionManager : : map_some_state ( " Transport " , " ToggleAutoInput " , sigc : : mem_fun ( _session - > config , & SessionConfiguration : : get_auto_input ) ) ;
2017-01-16 19:54:20 +01:00
} else if ( p = = " session-monitoring " ) {
Glib : : RefPtr < Action > iact = ActionManager : : get_action ( X_ ( " Transport " ) , X_ ( " SessionMonitorIn " ) ) ;
Glib : : RefPtr < Action > dact = ActionManager : : get_action ( X_ ( " Transport " ) , X_ ( " SessionMonitorDisk " ) ) ;
if ( iact & & dact ) {
Glib : : RefPtr < ToggleAction > tdact = Glib : : RefPtr < ToggleAction > : : cast_dynamic ( dact ) ;
Glib : : RefPtr < ToggleAction > tiact = Glib : : RefPtr < ToggleAction > : : cast_dynamic ( iact ) ;
if ( tdact & & tiact ) {
switch ( _session - > config . get_session_monitoring ( ) ) {
case MonitorDisk :
tdact - > set_active ( true ) ;
2017-01-18 12:25:02 +01:00
tiact - > set_active ( false ) ;
2017-01-16 19:54:20 +01:00
break ;
case MonitorInput :
tiact - > set_active ( true ) ;
2017-01-18 12:25:02 +01:00
tdact - > set_active ( false ) ;
2017-01-16 19:54:20 +01:00
break ;
default :
tdact - > set_active ( false ) ;
tiact - > set_active ( false ) ;
break ;
}
}
}
2009-05-16 01:22:43 +00:00
} else if ( p = = " punch-out " ) {
2009-12-17 18:24:23 +00:00
ActionManager : : map_some_state ( " Transport " , " TogglePunchOut " , sigc : : mem_fun ( _session - > config , & SessionConfiguration : : get_punch_out ) ) ;
if ( ! _session - > config . get_punch_out ( ) ) {
2008-03-17 20:54:03 +00:00
unset_dual_punch ( ) ;
}
2009-05-16 01:22:43 +00:00
} else if ( p = = " punch-in " ) {
2009-12-17 18:24:23 +00:00
ActionManager : : map_some_state ( " Transport " , " TogglePunchIn " , sigc : : mem_fun ( _session - > config , & SessionConfiguration : : get_punch_in ) ) ;
if ( ! _session - > config . get_punch_in ( ) ) {
2008-03-17 20:54:03 +00:00
unset_dual_punch ( ) ;
}
2009-05-16 01:22:43 +00:00
} else if ( p = = " clicking " ) {
2009-05-14 00:13:27 +00:00
ActionManager : : map_some_state ( " Transport " , " ToggleClick " , & RCConfiguration : : get_clicking ) ;
2009-05-16 01:22:43 +00:00
} else if ( p = = " use-video-sync " ) {
2009-12-17 18:24:23 +00:00
ActionManager : : map_some_state ( " Transport " , " ToggleVideoSync " , sigc : : mem_fun ( _session - > config , & SessionConfiguration : : get_use_video_sync ) ) ;
2010-11-25 20:37:39 +00:00
} else if ( p = = " sync-source " ) {
2010-08-31 01:49:33 +00:00
2010-11-25 20:37:39 +00:00
synchronize_sync_source_and_video_pullup ( ) ;
2014-08-30 20:57:22 +02:00
set_fps_timeout_connection ( ) ;
2010-08-31 01:49:33 +00:00
2009-05-16 01:22:43 +00:00
} else if ( p = = " show-track-meters " ) {
2014-12-22 13:39:41 -05:00
if ( editor ) editor - > toggle_meter_updating ( ) ;
2010-10-18 22:02:12 +00:00
} else if ( p = = " primary-clock-delta-edit-cursor " ) {
2015-01-02 21:44:54 +07:00
if ( UIConfiguration : : instance ( ) . get_primary_clock_delta_edit_cursor ( ) ) {
2011-11-18 17:06:11 +00:00
primary_clock - > set_is_duration ( true ) ;
primary_clock - > set_editable ( false ) ;
primary_clock - > set_widget_name ( " transport delta " ) ;
} else {
primary_clock - > set_is_duration ( false ) ;
primary_clock - > set_editable ( true ) ;
primary_clock - > set_widget_name ( " transport " ) ;
}
2010-11-25 20:37:39 +00:00
} else if ( p = = " secondary-clock-delta-edit-cursor " ) {
2015-01-02 21:44:54 +07:00
if ( UIConfiguration : : instance ( ) . get_secondary_clock_delta_edit_cursor ( ) ) {
2011-11-18 17:06:11 +00:00
secondary_clock - > set_is_duration ( true ) ;
secondary_clock - > set_editable ( false ) ;
secondary_clock - > set_widget_name ( " secondary delta " ) ;
} else {
secondary_clock - > set_is_duration ( false ) ;
secondary_clock - > set_editable ( true ) ;
secondary_clock - > set_widget_name ( " secondary " ) ;
}
2013-03-03 13:45:32 +00:00
} else if ( p = = " super-rapid-clock-update " ) {
2014-08-31 07:54:59 +02:00
if ( _session ) {
stop_clocking ( ) ;
start_clocking ( ) ;
}
2016-04-27 01:06:01 +02:00
} else if ( p = = " use-tooltips " ) {
/* this doesn't really belong here but it has to go somewhere */
if ( UIConfiguration : : instance ( ) . get_use_tooltips ( ) ) {
Gtkmm2ext : : enable_tooltips ( ) ;
} else {
Gtkmm2ext : : disable_tooltips ( ) ;
}
2013-06-21 17:15:56 -04:00
} else if ( p = = " waveform-gradient-depth " ) {
2015-01-02 21:44:54 +07:00
ArdourCanvas : : WaveView : : set_global_gradient_depth ( UIConfiguration : : instance ( ) . get_waveform_gradient_depth ( ) ) ;
2016-12-20 03:11:21 +01:00
} else if ( p = = " show-mini-timeline " ) {
repack_transport_hbox ( ) ;
2017-01-16 21:58:53 +01:00
} else if ( p = = " show-toolbar-recpunch " ) {
repack_transport_hbox ( ) ;
} else if ( p = = " show-toolbar-monitoring " ) {
repack_transport_hbox ( ) ;
2016-12-20 03:11:21 +01:00
} else if ( p = = " show-toolbar-selclock " ) {
repack_transport_hbox ( ) ;
2013-08-04 00:06:29 +02:00
} else if ( p = = " show-editor-meter " ) {
2016-12-20 03:11:21 +01:00
repack_transport_hbox ( ) ;
2016-12-21 23:01:34 +01:00
} else if ( p = = " show-secondary-clock " ) {
update_clock_visibility ( ) ;
2014-05-27 00:34:27 +02:00
} else if ( p = = " waveform-scale " ) {
2015-01-02 21:44:54 +07:00
ArdourCanvas : : WaveView : : set_global_logscaled ( UIConfiguration : : instance ( ) . get_waveform_scale ( ) = = Logarithmic ) ;
2015-01-28 02:22:52 +01:00
} else if ( p = = " widget-prelight " ) {
2015-01-02 21:44:54 +07:00
CairoWidget : : set_widget_prelight ( UIConfiguration : : instance ( ) . get_widget_prelight ( ) ) ;
2014-05-27 00:34:27 +02:00
} else if ( p = = " waveform-shape " ) {
2015-01-02 21:44:54 +07:00
ArdourCanvas : : WaveView : : set_global_shape ( UIConfiguration : : instance ( ) . get_waveform_shape ( ) = = Rectified
2014-05-27 00:34:27 +02:00
? ArdourCanvas : : WaveView : : Rectified : ArdourCanvas : : WaveView : : Normal ) ;
} else if ( p = = " show-waveform-clipping " ) {
2015-01-02 21:44:54 +07:00
ArdourCanvas : : WaveView : : set_global_show_waveform_clipping ( UIConfiguration : : instance ( ) . get_show_waveform_clipping ( ) ) ;
2015-06-23 08:18:11 -04:00
} else if ( p = = " waveform-cache-size " ) {
/* GUI option has units of megabytes; image cache uses units of bytes */
2015-01-02 21:44:54 +07:00
ArdourCanvas : : WaveView : : set_image_cache_size ( UIConfiguration : : instance ( ) . get_waveform_cache_size ( ) * 1048576 ) ;
2016-06-07 18:29:40 -04:00
} else if ( p = = " use-wm-visibility " ) {
VisibilityTracker : : set_use_window_manager_visibility ( UIConfiguration : : instance ( ) . get_use_wm_visibility ( ) ) ;
2016-04-25 00:16:08 +02:00
} else if ( p = = " action-table-columns " ) {
const uint32_t cols = UIConfiguration : : instance ( ) . get_action_table_columns ( ) ;
for ( int i = 0 ; i < 9 ; + + i ) {
2016-12-11 17:24:30 +01:00
const int col = i / 2 ;
2016-04-25 00:16:08 +02:00
if ( cols & ( 1 < < col ) ) {
action_script_call_btn [ i ] . show ( ) ;
} else {
action_script_call_btn [ i ] . hide ( ) ;
}
}
2016-12-12 21:48:29 +01:00
} else if ( p = = " layered-record-mode " ) {
layered_button . set_active ( _session - > config . get_layered_record_mode ( ) ) ;
2016-12-29 23:04:39 +01:00
} else if ( p = = " show-waveform-clipping " ) {
ArdourCanvas : : WaveView : : set_global_show_waveform_clipping ( UIConfiguration : : instance ( ) . get_show_waveform_clipping ( ) ) ;
} else if ( p = = " waveform-gradient-depth " ) {
ArdourCanvas : : WaveView : : set_global_gradient_depth ( UIConfiguration : : instance ( ) . get_waveform_gradient_depth ( ) ) ;
} else if ( p = = " flat-buttons " ) {
bool flat = UIConfiguration : : instance ( ) . get_flat_buttons ( ) ;
if ( ArdourButton : : flat_buttons ( ) ! = flat ) {
ArdourButton : : set_flat_buttons ( flat ) ;
/* force a redraw */
gtk_rc_reset_styles ( gtk_settings_get_default ( ) ) ;
}
2017-01-20 17:06:44 -06:00
} else if ( p = = " click-gain " ) {
float gain_db = accurate_coefficient_to_dB ( Config - > get_click_gain ( ) ) ;
set_tip ( click_button , string_compose ( " Enable/Disable metronome \n \n Right-click to access preferences \n Mouse-wheel to modify level \n \n Level %1dbFS " , gain_db ) ) ;
2010-11-25 20:37:39 +00:00
}
2006-01-08 02:56:49 +00:00
}
2009-12-01 13:21:41 +00:00
2011-07-03 00:45:15 +00:00
void
ARDOUR_UI : : session_parameter_changed ( std : : string p )
{
if ( p = = " native-file-data-format " | | p = = " native-file-header-format " ) {
update_format ( ) ;
2014-08-30 20:57:22 +02:00
} else if ( p = = " timecode-format " ) {
set_fps_timeout_connection ( ) ;
2014-08-30 20:11:07 +02:00
} else if ( p = = " video-pullup " | | p = = " timecode-format " ) {
2014-08-30 20:57:22 +02:00
set_fps_timeout_connection ( ) ;
2014-08-30 20:11:07 +02:00
synchronize_sync_source_and_video_pullup ( ) ;
reset_main_clocks ( ) ;
editor - > queue_visual_videotimeline_update ( ) ;
2014-08-31 07:12:21 +02:00
} else if ( p = = " track-name-number " ) {
/* DisplaySuspender triggers _route->redisplay() when going out of scope
* which eventually calls reset_controls_layout_width ( ) and re - sets the
* track - header width .
* see also RouteTimeAxisView : : update_track_number_visibility ( )
*/
DisplaySuspender ds ;
2011-07-03 00:45:15 +00:00
}
}
2009-12-01 13:21:41 +00:00
void
ARDOUR_UI : : reset_main_clocks ( )
{
2009-12-11 23:29:48 +00:00
ENSURE_GUI_THREAD ( * this , & ARDOUR_UI : : reset_main_clocks )
2009-12-01 13:21:41 +00:00
2009-12-17 18:24:23 +00:00
if ( _session ) {
2011-06-02 17:50:37 +00:00
primary_clock - > set ( _session - > audible_frame ( ) , true ) ;
secondary_clock - > set ( _session - > audible_frame ( ) , true ) ;
2009-12-01 13:21:41 +00:00
} else {
2011-06-02 17:50:37 +00:00
primary_clock - > set ( 0 , true ) ;
secondary_clock - > set ( 0 , true ) ;
2009-12-01 13:21:41 +00:00
}
}
2010-08-31 01:49:33 +00:00
void
ARDOUR_UI : : synchronize_sync_source_and_video_pullup ( )
{
2010-11-25 20:37:39 +00:00
Glib : : RefPtr < Action > act = ActionManager : : get_action ( X_ ( " Transport " ) , X_ ( " ToggleExternalSync " ) ) ;
if ( ! act ) {
return ;
}
if ( ! _session ) {
goto just_label ;
}
if ( _session - > config . get_video_pullup ( ) = = 0.0f ) {
/* with no video pull up/down, any sync source is OK */
act - > set_sensitive ( true ) ;
} else {
/* can't sync to JACK if video pullup != 0.0 */
2013-09-19 17:34:23 -04:00
if ( Config - > get_sync_source ( ) = = Engine ) {
2010-11-25 20:37:39 +00:00
act - > set_sensitive ( false ) ;
} else {
act - > set_sensitive ( true ) ;
}
}
/* XXX should really be able to set the video pull up
action to insensitive / sensitive , but there is no action .
FIXME
*/
2010-08-31 01:49:33 +00:00
just_label :
2010-11-25 20:37:39 +00:00
if ( act - > get_sensitive ( ) ) {
set_tip ( sync_button , _ ( " Enable/Disable external positional sync " ) ) ;
} else {
set_tip ( sync_button , _ ( " Sync to JACK is not possible: video pull up/down is set " ) ) ;
}
2010-08-31 01:49:33 +00:00
}