Fix session-open after selecting new, template, then back
[ardour.git] / gtk2_ardour / ardour_ui_options.cc
1 /*
2     Copyright (C) 2005 Paul Davis
3
4     This program is free software; you can redistribute it and/or modify
5     it under the terms of the GNU General Public License as published by
6     the Free Software Foundation; either version 2 of the License, or
7     (at your option) any later version.
8
9     This program is distributed in the hope that it will be useful,
10     but WITHOUT ANY WARRANTY; without even the implied warranty of
11     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12     GNU General Public License for more details.
13
14     You should have received a copy of the GNU General Public License
15     along with this program; if not, write to the Free Software
16     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
17
18 */
19
20 #ifdef WAF_BUILD
21 #include "gtk2ardour-config.h"
22 #endif
23
24 #include "pbd/convert.h"
25 #include "pbd/stacktrace.h"
26 #include "pbd/unwind.h"
27
28 #include "ardour/rc_configuration.h"
29 #include "ardour/session.h"
30
31 #include "gtkmm2ext/utils.h"
32 #include "waveview/wave_view.h"
33
34 #include "audio_clock.h"
35 #include "ardour_ui.h"
36 #include "actions.h"
37 #include "gui_thread.h"
38 #include "public_editor.h"
39 #include "main_clock.h"
40
41 #include "pbd/i18n.h"
42
43 using namespace Gtk;
44 using namespace Gtkmm2ext;
45 using namespace ARDOUR;
46 using namespace PBD;
47 using namespace ArdourWidgets;
48
49 void
50 ARDOUR_UI::toggle_external_sync()
51 {
52         if (_session) {
53                 if (_session->config.get_video_pullup() != 0.0f) {
54                         if (Config->get_sync_source() == Engine) {
55                                 MessageDialog msg (
56                                         _("It is not possible to use JACK as the the sync source\n\
57 when the pull up/down setting is non-zero."));
58                                 msg.run ();
59                                 return;
60                         }
61                 }
62
63                 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));
64
65                 /* activating a slave is a session-property.
66                  * The slave type is a RC property.
67                  * When the slave is active is must not be reconfigured.
68                  * This is a UI limitation, imposed by audio-clock and
69                  * status displays which combine RC-config & session-properties.
70                  *
71                  * Notficy RCOptionEditor by emitting a signal if the active
72                  * status changed:
73                  */
74                 Config->ParameterChanged("sync-source");
75         }
76 }
77
78 void
79 ARDOUR_UI::toggle_time_master ()
80 {
81         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));
82 }
83
84 void
85 ARDOUR_UI::toggle_send_mtc ()
86 {
87         ActionManager::toggle_config_state ("Options", "SendMTC", &RCConfiguration::set_send_mtc, &RCConfiguration::get_send_mtc);
88 }
89
90 void
91 ARDOUR_UI::toggle_send_mmc ()
92 {
93         ActionManager::toggle_config_state ("Options", "SendMMC", &RCConfiguration::set_send_mmc, &RCConfiguration::get_send_mmc);
94 }
95
96 void
97 ARDOUR_UI::toggle_send_midi_clock ()
98 {
99         ActionManager::toggle_config_state ("Options", "SendMidiClock", &RCConfiguration::set_send_midi_clock, &RCConfiguration::get_send_midi_clock);
100 }
101
102 void
103 ARDOUR_UI::toggle_use_mmc ()
104 {
105         ActionManager::toggle_config_state ("Options", "UseMMC", &RCConfiguration::set_mmc_control, &RCConfiguration::get_mmc_control);
106 }
107
108 void
109 ARDOUR_UI::toggle_auto_input ()
110 {
111         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));
112 }
113
114 void
115 ARDOUR_UI::toggle_auto_play ()
116 {
117         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));
118 }
119
120 void
121 ARDOUR_UI::toggle_auto_return ()
122 {
123         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));
124 }
125
126 void
127 ARDOUR_UI::toggle_click ()
128 {
129         ActionManager::toggle_config_state ("Transport", "ToggleClick", &RCConfiguration::set_clicking, &RCConfiguration::get_clicking);
130 }
131
132 void
133 ARDOUR_UI::toggle_session_monitoring_in ()
134 {
135         Glib::RefPtr<Action> act = ActionManager::get_action (X_("Transport"), X_("SessionMonitorIn"));
136         if (!act) {
137                 return;
138         }
139         Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic (act);
140         if (!tact) {
141                 return;
142         }
143
144         if (tact->get_active() && _session->config.get_session_monitoring () == MonitorInput) {
145                 return;
146         }
147         if (!tact->get_active() && _session->config.get_session_monitoring () != MonitorInput) {
148                 return;
149         }
150
151         if (tact->get_active()) {
152                 _session->config.set_session_monitoring (MonitorInput);
153         } else {
154                 _session->config.set_session_monitoring (MonitorAuto);
155         }
156 }
157
158 void
159 ARDOUR_UI::toggle_session_monitoring_disk ()
160 {
161         Glib::RefPtr<Action> act = ActionManager::get_action (X_("Transport"), X_("SessionMonitorDisk"));
162         if (!act) {
163                 return;
164         }
165         Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic (act);
166         if (!tact) {
167                 return;
168         }
169         if (tact->get_active() && _session->config.get_session_monitoring () == MonitorDisk) {
170                 return;
171         }
172         if (!tact->get_active() && _session->config.get_session_monitoring () != MonitorDisk) {
173                 return;
174         }
175
176         if (tact->get_active()) {
177                 _session->config.set_session_monitoring (MonitorDisk);
178         } else {
179                 _session->config.set_session_monitoring (MonitorAuto);
180         }
181 }
182
183 void
184 ARDOUR_UI::unset_dual_punch ()
185 {
186         Glib::RefPtr<Action> action = ActionManager::get_action ("Transport", "TogglePunch");
187
188         if (action) {
189                 Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic(action);
190                 if (tact) {
191                         ignore_dual_punch = true;
192                         tact->set_active (false);
193                         ignore_dual_punch = false;
194                 }
195         }
196 }
197
198 void
199 ARDOUR_UI::toggle_punch ()
200 {
201         if (ignore_dual_punch) {
202                 return;
203         }
204
205         Glib::RefPtr<Action> action = ActionManager::get_action ("Transport", "TogglePunch");
206
207         if (action) {
208
209                 Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic(action);
210
211                 if (!tact) {
212                         return;
213                 }
214
215                 /* drive the other two actions from this one */
216
217                 Glib::RefPtr<Action> in_action = ActionManager::get_action ("Transport", "TogglePunchIn");
218                 Glib::RefPtr<Action> out_action = ActionManager::get_action ("Transport", "TogglePunchOut");
219
220                 if (in_action && out_action) {
221                         Glib::RefPtr<ToggleAction> tiact = Glib::RefPtr<ToggleAction>::cast_dynamic(in_action);
222                         Glib::RefPtr<ToggleAction> toact = Glib::RefPtr<ToggleAction>::cast_dynamic(out_action);
223                         tiact->set_active (tact->get_active());
224                         toact->set_active (tact->get_active());
225                 }
226         }
227 }
228
229 void
230 ARDOUR_UI::toggle_punch_in ()
231 {
232         Glib::RefPtr<Action> act = ActionManager::get_action (X_("Transport"), X_("TogglePunchIn"));
233         if (!act) {
234                 return;
235         }
236
237         Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic (act);
238         if (!tact) {
239                 return;
240         }
241
242         if (tact->get_active() != _session->config.get_punch_in()) {
243                 _session->config.set_punch_in (tact->get_active ());
244         }
245
246         if (tact->get_active()) {
247                 /* if punch-in is turned on, make sure the loop/punch ruler is visible, and stop it being hidden,
248                    to avoid confusing the user */
249                 show_loop_punch_ruler_and_disallow_hide ();
250         }
251
252         reenable_hide_loop_punch_ruler_if_appropriate ();
253 }
254
255 void
256 ARDOUR_UI::toggle_punch_out ()
257 {
258         Glib::RefPtr<Action> act = ActionManager::get_action (X_("Transport"), X_("TogglePunchOut"));
259         if (!act) {
260                 return;
261         }
262
263         Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic (act);
264         if (!tact) {
265                 return;
266         }
267
268         if (tact->get_active() != _session->config.get_punch_out()) {
269                 _session->config.set_punch_out (tact->get_active ());
270         }
271
272         if (tact->get_active()) {
273                 /* if punch-out is turned on, make sure the loop/punch ruler is visible, and stop it being hidden,
274                    to avoid confusing the user */
275                 show_loop_punch_ruler_and_disallow_hide ();
276         }
277
278         reenable_hide_loop_punch_ruler_if_appropriate ();
279 }
280
281 void
282 ARDOUR_UI::show_loop_punch_ruler_and_disallow_hide ()
283 {
284         Glib::RefPtr<Action> act = ActionManager::get_action (X_("Rulers"), "toggle-loop-punch-ruler");
285         if (!act) {
286                 return;
287         }
288
289         act->set_sensitive (false);
290
291         Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic (act);
292         if (!tact) {
293                 return;
294         }
295
296         if (!tact->get_active()) {
297                 tact->set_active ();
298         }
299 }
300
301 /* This is a bit of a silly name for a method */
302 void
303 ARDOUR_UI::reenable_hide_loop_punch_ruler_if_appropriate ()
304 {
305         if (!_session->config.get_punch_in() && !_session->config.get_punch_out()) {
306                 /* if punch in/out are now both off, reallow hiding of the loop/punch ruler */
307                 Glib::RefPtr<Action> act = ActionManager::get_action (X_("Rulers"), "toggle-loop-punch-ruler");
308                 if (act) {
309                         act->set_sensitive (true);
310                 }
311         }
312 }
313
314 void
315 ARDOUR_UI::toggle_video_sync()
316 {
317         Glib::RefPtr<Action> act = ActionManager::get_action ("Transport", "ToggleVideoSync");
318         if (act) {
319                 Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic(act);
320                 _session->config.set_use_video_sync (tact->get_active());
321         }
322 }
323
324 void
325 ARDOUR_UI::toggle_editing_space()
326 {
327         Glib::RefPtr<Action> act = ActionManager::get_action ("Common", "ToggleMaximalEditor");
328
329         if (act) {
330                 Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic(act);
331                 if (tact->get_active()) {
332                         maximise_editing_space ();
333                 } else {
334                         restore_editing_space ();
335                 }
336         }
337 }
338
339 void
340 ARDOUR_UI::setup_session_options ()
341 {
342         _session->config.ParameterChanged.connect (_session_connections, MISSING_INVALIDATOR, boost::bind (&ARDOUR_UI::parameter_changed, this, _1), gui_context());
343         boost::function<void (std::string)> pc (boost::bind (&ARDOUR_UI::parameter_changed, this, _1));
344         _session->config.map_parameters (pc);
345 }
346
347 void
348 ARDOUR_UI::parameter_changed (std::string p)
349 {
350         if (p == "external-sync") {
351
352                 ActionManager::map_some_state ("Transport", "ToggleExternalSync", sigc::mem_fun (_session->config, &SessionConfiguration::get_external_sync));
353
354                 if (!_session->config.get_external_sync()) {
355                         sync_button.set_text (S_("SyncSource|Int."));
356                         ActionManager::get_action ("Transport", "ToggleAutoPlay")->set_sensitive (true);
357                         ActionManager::get_action ("Transport", "ToggleAutoReturn")->set_sensitive (true);
358                         ActionManager::get_action ("Transport", "ToggleFollowEdits")->set_sensitive (true);
359                 } else {
360                         sync_button.set_text (sync_source_to_string (Config->get_sync_source(), true));
361                         if (_session && _session->locations()->auto_loop_location()) {
362                                 // disable looping with external sync.
363                                 // This is not necessary because session-transport ignores the loop-state,
364                                 // but makes it clear to the user that it's disabled.
365                                 _session->request_play_loop (false, false);
366                         }
367                         /* XXX we need to make sure that auto-play is off as well as insensitive */
368                         ActionManager::get_action ("Transport", "ToggleAutoPlay")->set_sensitive (false);
369                         ActionManager::get_action ("Transport", "ToggleAutoReturn")->set_sensitive (false);
370                         ActionManager::get_action ("Transport", "ToggleFollowEdits")->set_sensitive (false);
371                 }
372                 set_loop_sensitivity ();
373
374         } else if (p == "follow-edits") {
375
376                 ActionManager::map_some_state ("Transport", "ToggleFollowEdits", &UIConfiguration::get_follow_edits);
377
378         } else if (p == "send-mtc") {
379
380                 ActionManager::map_some_state ("Options", "SendMTC", &RCConfiguration::get_send_mtc);
381
382         } else if (p == "send-mmc") {
383
384                 ActionManager::map_some_state ("Options", "SendMMC", &RCConfiguration::get_send_mmc);
385
386         } else if (p == "mmc-control") {
387                 ActionManager::map_some_state ("Options", "UseMMC", &RCConfiguration::get_mmc_control);
388         } else if (p == "auto-play") {
389                 ActionManager::map_some_state ("Transport", "ToggleAutoPlay", sigc::mem_fun (_session->config, &SessionConfiguration::get_auto_play));
390         } else if (p == "auto-return") {
391                 ActionManager::map_some_state ("Transport", "ToggleAutoReturn", sigc::mem_fun (_session->config, &SessionConfiguration::get_auto_return));
392         } else if (p == "auto-input") {
393                 ActionManager::map_some_state ("Transport", "ToggleAutoInput", sigc::mem_fun (_session->config, &SessionConfiguration::get_auto_input));
394         } else if (p == "session-monitoring") {
395                 Glib::RefPtr<Action> iact = ActionManager::get_action (X_("Transport"), X_("SessionMonitorIn"));
396                 Glib::RefPtr<Action> dact = ActionManager::get_action (X_("Transport"), X_("SessionMonitorDisk"));
397                 if (iact && dact) {
398                         Glib::RefPtr<ToggleAction> tdact = Glib::RefPtr<ToggleAction>::cast_dynamic(dact);
399                         Glib::RefPtr<ToggleAction> tiact = Glib::RefPtr<ToggleAction>::cast_dynamic(iact);
400                         if (tdact && tiact) {
401                                 switch (_session->config.get_session_monitoring ()) {
402                                         case MonitorDisk:
403                                                 tdact->set_active (true);
404                                                 tiact->set_active (false);
405                                                 break;
406                                         case MonitorInput:
407                                                 tiact->set_active (true);
408                                                 tdact->set_active (false);
409                                                 break;
410                                         default:
411                                                 tdact->set_active (false);
412                                                 tiact->set_active (false);
413                                                 break;
414                                 }
415                         }
416                 }
417         } else if (p == "punch-out") {
418                 ActionManager::map_some_state ("Transport", "TogglePunchOut", sigc::mem_fun (_session->config, &SessionConfiguration::get_punch_out));
419                 if (!_session->config.get_punch_out()) {
420                         unset_dual_punch ();
421                 }
422         } else if (p == "punch-in") {
423                 ActionManager::map_some_state ("Transport", "TogglePunchIn", sigc::mem_fun (_session->config, &SessionConfiguration::get_punch_in));
424                 if (!_session->config.get_punch_in()) {
425                         unset_dual_punch ();
426                 }
427         } else if (p == "clicking") {
428                 ActionManager::map_some_state ("Transport", "ToggleClick", &RCConfiguration::get_clicking);
429         } else if (p == "click-record-only") {
430                 // TODO set a flag, blink or gray-out metronome button while rolling, only
431                 if (Config->get_click_record_only()) {
432                         click_button.set_name ("generic button"); // XXX
433                 } else {
434                         click_button.set_name ("transport button");
435                 }
436         } else if (p == "use-video-sync") {
437                 ActionManager::map_some_state ("Transport",  "ToggleVideoSync", sigc::mem_fun (_session->config, &SessionConfiguration::get_use_video_sync));
438         } else if (p == "sync-source") {
439
440                 synchronize_sync_source_and_video_pullup ();
441                 set_fps_timeout_connection ();
442
443         } else if (p == "show-track-meters") {
444                 if (editor) editor->toggle_meter_updating();
445         } else if (p == "primary-clock-delta-edit-cursor") {
446                 if (UIConfiguration::instance().get_primary_clock_delta_edit_cursor()) {
447                         primary_clock->set_is_duration (true);
448                         primary_clock->set_editable (false);
449                         primary_clock->set_widget_name ("transport delta");
450                 } else {
451                         primary_clock->set_is_duration (false);
452                         primary_clock->set_editable (true);
453                         primary_clock->set_widget_name ("transport");
454                 }
455         } else if (p == "secondary-clock-delta-edit-cursor") {
456                 if (UIConfiguration::instance().get_secondary_clock_delta_edit_cursor()) {
457                         secondary_clock->set_is_duration (true);
458                         secondary_clock->set_editable (false);
459                         secondary_clock->set_widget_name ("secondary delta");
460                 } else {
461                         secondary_clock->set_is_duration (false);
462                         secondary_clock->set_editable (true);
463                         secondary_clock->set_widget_name ("secondary");
464                 }
465         } else if (p == "super-rapid-clock-update") {
466                 if (_session) {
467                         stop_clocking ();
468                         start_clocking ();
469                 }
470         } else if (p == "use-tooltips") {
471                 /* this doesn't really belong here but it has to go somewhere */
472                 if (UIConfiguration::instance().get_use_tooltips()) {
473                         Gtkmm2ext::enable_tooltips ();
474                 } else {
475                         Gtkmm2ext::disable_tooltips ();
476                 }
477         } else if (p == "waveform-gradient-depth") {
478                 ArdourWaveView::WaveView::set_global_gradient_depth (UIConfiguration::instance().get_waveform_gradient_depth());
479         } else if (p == "show-mini-timeline") {
480                 repack_transport_hbox ();
481         } else if (p == "show-toolbar-recpunch") {
482                 repack_transport_hbox ();
483         } else if (p == "show-toolbar-monitoring") {
484                 repack_transport_hbox ();
485         } else if (p == "show-toolbar-selclock") {
486                 repack_transport_hbox ();
487         } else if (p == "show-editor-meter") {
488                 repack_transport_hbox ();
489         } else if (p == "show-secondary-clock") {
490                 update_clock_visibility ();
491         } else if (p == "waveform-scale") {
492                 ArdourWaveView::WaveView::set_global_logscaled (UIConfiguration::instance().get_waveform_scale() == Logarithmic);
493         } else if (p == "widget-prelight") {
494                 CairoWidget::set_widget_prelight (UIConfiguration::instance().get_widget_prelight());
495         } else if (p == "waveform-shape") {
496                 ArdourWaveView::WaveView::set_global_shape (UIConfiguration::instance().get_waveform_shape() == Rectified
497                                 ? ArdourWaveView::WaveView::Rectified : ArdourWaveView::WaveView::Normal);
498         } else if (p == "show-waveform-clipping") {
499                 ArdourWaveView::WaveView::set_global_show_waveform_clipping (UIConfiguration::instance().get_show_waveform_clipping());
500         } else if (p == "waveform-cache-size") {
501                 /* GUI option has units of megabytes; image cache uses units of bytes */
502                 ArdourWaveView::WaveView::set_image_cache_size (UIConfiguration::instance().get_waveform_cache_size() * 1048576);
503         } else if (p == "use-wm-visibility") {
504                 VisibilityTracker::set_use_window_manager_visibility (UIConfiguration::instance().get_use_wm_visibility());
505         } else if (p == "action-table-columns") {
506                 const uint32_t cols = UIConfiguration::instance().get_action_table_columns ();
507                 for (int i = 0; i < 9; ++i) {
508                         const int col = i / 2;
509                         if (cols & (1<<col)) {
510                                 action_script_call_btn[i].show();
511                         } else {
512                                 action_script_call_btn[i].hide();
513                         }
514                 }
515         } else if (p == "layered-record-mode") {
516                 layered_button.set_active (_session->config.get_layered_record_mode ());
517         } else if (p == "show-waveform-clipping") {
518                 ArdourWaveView::WaveView::set_global_show_waveform_clipping (UIConfiguration::instance().get_show_waveform_clipping());
519         } else if (p == "waveform-gradient-depth") {
520                 ArdourWaveView::WaveView::set_global_gradient_depth (UIConfiguration::instance().get_waveform_gradient_depth());
521         } else if (p == "flat-buttons") {
522                 bool flat = UIConfiguration::instance().get_flat_buttons();
523                 if (ArdourButton::flat_buttons () != flat) {
524                         ArdourButton::set_flat_buttons (flat);
525                         /* force a redraw */
526                         gtk_rc_reset_styles (gtk_settings_get_default());
527                 }
528         } else if (p == "click-gain") {
529                 float gain_db = accurate_coefficient_to_dB (Config->get_click_gain());
530                 char tmp[32];
531                 snprintf(tmp, 31, "%+.1f", gain_db);
532                 set_tip (click_button, string_compose (_("Enable/Disable metronome\n\nRight-click to access preferences\nMouse-wheel to modify level\nSignal Level: %1 dBFS"), tmp));
533         }
534 }
535
536 void
537 ARDOUR_UI::session_parameter_changed (std::string p)
538 {
539         if (p == "native-file-data-format" || p == "native-file-header-format") {
540                 update_format ();
541         } else if (p == "timecode-format") {
542                 set_fps_timeout_connection ();
543         } else if (p == "video-pullup" || p == "timecode-format") {
544                 set_fps_timeout_connection ();
545
546                 synchronize_sync_source_and_video_pullup ();
547                 reset_main_clocks ();
548                 editor->queue_visual_videotimeline_update();
549         } else if (p == "track-name-number") {
550                 /* DisplaySuspender triggers _route->redisplay() when going out of scope
551                  * which eventually calls reset_controls_layout_width() and re-sets the
552                  * track-header width.
553                  * see also RouteTimeAxisView::update_track_number_visibility()
554                  */
555                 DisplaySuspender ds;
556         }
557 }
558
559 void
560 ARDOUR_UI::reset_main_clocks ()
561 {
562         ENSURE_GUI_THREAD (*this, &ARDOUR_UI::reset_main_clocks)
563
564         if (_session) {
565                 primary_clock->set (_session->audible_frame(), true);
566                 secondary_clock->set (_session->audible_frame(), true);
567         } else {
568                 primary_clock->set (0, true);
569                 secondary_clock->set (0, true);
570         }
571 }
572
573 void
574 ARDOUR_UI::synchronize_sync_source_and_video_pullup ()
575 {
576         Glib::RefPtr<Action> act = ActionManager::get_action (X_("Transport"), X_("ToggleExternalSync"));
577
578         if (!act) {
579                 return;
580         }
581
582         if (!_session) {
583                 goto just_label;
584         }
585
586         if (_session->config.get_video_pullup() == 0.0f) {
587                 /* with no video pull up/down, any sync source is OK */
588                 act->set_sensitive (true);
589         } else {
590                 /* can't sync to JACK if video pullup != 0.0 */
591                 if (Config->get_sync_source() == Engine) {
592                         act->set_sensitive (false);
593                 } else {
594                         act->set_sensitive (true);
595                 }
596         }
597
598         /* XXX should really be able to set the video pull up
599            action to insensitive/sensitive, but there is no action.
600            FIXME
601         */
602
603   just_label:
604         if (act->get_sensitive ()) {
605                 set_tip (sync_button, _("Enable/Disable external positional sync"));
606         } else {
607                 set_tip (sync_button, _("Sync to JACK is not possible: video pull up/down is set"));
608         }
609
610 }
611