13
0

lots of tweaks relating to GUI sync management

git-svn-id: svn://localhost/ardour2/branches/3.0@6051 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Paul Davis 2009-11-10 04:30:08 +00:00
parent dbb0b9ca4f
commit a65149b246
11 changed files with 161 additions and 103 deletions

View File

@ -1112,6 +1112,24 @@ style "green_flashing_alert" = "very_small_text"
bg[ACTIVE] = { 0.52, 1.0, 0}
}
style "sync_alert"
{
#
# this is used when the sync button is indicating that sync is
# active, and alternates with another style if sync is active
# but we are not locked
#
bg[ACTIVE] = { 0.52, 1.0, 0}
bg[PRELIGHT] = { 0.52, 1.0, 0}
bg[SELECTED] = { 0.52, 1.0, 0}
bg[NORMAL] = { 0.52, 1.0, 0}
fg[NORMAL] = { 0, 0, 0 }
fg[PRELIGHT] = { 0, 0, 0 }
fg[SELECTED] = { 0, 0, 0 }
fg[ACTIVE] = { 0, 0, 0 }
}
style "selected_io_selector_port_list" = "medium_bold_text"
{
@ -1362,6 +1380,10 @@ widget "*EditGroupButton" style:highest "very_small_button"
widget "*EditGroupButtonLabel" style:highest "very_small_button"
widget "*TransportButton" style:highest "transport_rec_button"
widget "*TransportButton-active" style:highest "transport_button_active"
widget "*TransportSyncButton" style:highest "transport_button"
widget "*TransportSyncButton*" style:highest "transport_button"
widget "*TransportSyncButton-active" style:highest "sync_alert"
widget "*TransportSyncButton-active*" style:highest "sync_alert"
widget "*ShuttleButton" style:highest "transport_button"
widget "*ShuttleButton*" style:highest "transport_button"
widget "*ShuttleDisplay" style:highest "transport_button"
@ -1528,8 +1550,6 @@ widget "*BypassButton" style:highest "red_when_active"
widget "*BypassButton*" style:highest "red_when_active"
widget "*TransportSoloAlert" style:highest "flashing_alert"
widget "*TransportSoloAlert.*" style:highest "flashing_alert"
widget "*TransportSyncAlert" style:highest "flashing_alert"
widget "*TransportSyncAlert.*" style:highest "flashing_alert"
widget "*SendAlert" style:highest "green_flashing_alert"
widget "*SendAlert.*" style:highest "green_flashing_alert"
widget "*TransportAuditioningAlert" style:highest "flashing_alert"

View File

@ -385,9 +385,7 @@ class ARDOUR_UI : public Gtkmm2ext::UI
BindableButton play_selection_button;
BindableButton rec_button;
Gtk::ToggleButton sync_button;
void sync_button_clicked ();
void toggle_external_sync ();
void toggle_time_master ();
void toggle_video_sync ();
@ -427,6 +425,7 @@ class ARDOUR_UI : public Gtkmm2ext::UI
Gtkmm2ext::StatefulToggleButton auto_input_button;
Gtkmm2ext::StatefulToggleButton click_button;
Gtkmm2ext::StatefulToggleButton time_master_button;
Gtkmm2ext::StatefulToggleButton sync_button;
Gtk::ToggleButton auditioning_alert_button;
Gtk::ToggleButton solo_alert_button;

View File

@ -127,6 +127,19 @@ ARDOUR_UI::display_message (const char *prefix, gint prefix_len, RefPtr<TextBuff
#endif
}
static bool
null_crossing (GdkEventCrossing* /* ignored */)
{
return true;
}
static void
block_prelight (Gtk::Widget& w)
{
w.signal_enter_notify_event().connect (sigc::ptr_fun (null_crossing), false);
w.signal_leave_notify_event().connect (sigc::ptr_fun (null_crossing), false);
}
void
ARDOUR_UI::setup_transport ()
{
@ -172,6 +185,7 @@ ARDOUR_UI::setup_transport ()
punch_out_button.set_name ("TransportButton");
click_button.set_name ("TransportButton");
time_master_button.set_name ("TransportButton");
sync_button.set_name ("TransportSyncButton");
stop_button.set_size_request(29, -1);
roll_button.set_size_request(29, -1);
@ -225,6 +239,8 @@ ARDOUR_UI::setup_transport ()
act->connect_proxy (play_selection_button);
act = ActionManager::get_action (X_("Transport"), X_("ToggleTimeMaster"));
act->connect_proxy (time_master_button);
act = ActionManager::get_action (X_("Transport"), X_("ToggleExternalSync"));
act->connect_proxy (sync_button);
ARDOUR_UI::instance()->tooltips().set_tip (roll_button, _("Play from playhead"));
ARDOUR_UI::instance()->tooltips().set_tip (stop_button, _("Stop playback"));
@ -239,12 +255,13 @@ ARDOUR_UI::setup_transport ()
ARDOUR_UI::instance()->tooltips().set_tip (punch_in_button, _("Start recording at auto-punch start"));
ARDOUR_UI::instance()->tooltips().set_tip (punch_out_button, _("Stop recording at auto-punch end"));
ARDOUR_UI::instance()->tooltips().set_tip (click_button, _("Enable/Disable audio click"));
ARDOUR_UI::instance()->tooltips().set_tip (sync_button, _("Positional sync source"));
ARDOUR_UI::instance()->tooltips().set_tip (sync_button, _("Enable/Disable external positional sync"));
ARDOUR_UI::instance()->tooltips().set_tip (time_master_button, _("Does Ardour control the time?"));
ARDOUR_UI::instance()->tooltips().set_tip (shuttle_box, _("Shuttle speed control"));
ARDOUR_UI::instance()->tooltips().set_tip (shuttle_units_button, _("Select semitones or %%-age for speed display"));
ARDOUR_UI::instance()->tooltips().set_tip (speed_display_box, _("Current transport speed"));
shuttle_box.set_flags (CAN_FOCUS);
shuttle_box.add_events (Gdk::ENTER_NOTIFY_MASK|Gdk::LEAVE_NOTIFY_MASK|Gdk::BUTTON_RELEASE_MASK|Gdk::BUTTON_PRESS_MASK|Gdk::POINTER_MOTION_MASK|Gdk::SCROLL_MASK);
shuttle_box.set_size_request (100, 15);
@ -331,9 +348,7 @@ ARDOUR_UI::setup_transport ()
sdframe->set_shadow_type (SHADOW_IN);
sdframe->add (speed_display_box);
sync_button.set_name ("TransportSyncAlert");
sync_button.signal_clicked().connect (mem_fun (*this, &ARDOUR_UI::sync_button_clicked));
// XXX HOW TO USE set_popdown_strings() with this when we don't know the real strings till later?
/* translators: Egternal is "External" with a descender character */
set_size_request_to_display_given_text (sync_button, X_("Egternal"), 4, 10);
shbox->pack_start (*sdframe, false, false);
@ -488,17 +503,22 @@ void
ARDOUR_UI::sync_blink (bool onoff)
{
if (session == 0 || !session->config.get_external_sync()) {
/* internal sync */
sync_button.set_visual_state (0);
return;
}
if (!session->transport_locked()) {
/* not locked, so blink on and off according to the onoff argument */
if (onoff) {
sync_button.set_state (STATE_ACTIVE);
sync_button.set_visual_state (1); // "-active"
} else {
sync_button.set_state (STATE_NORMAL);
sync_button.set_visual_state (0); // normal
}
} else {
sync_button.set_state (STATE_NORMAL);
/* locked */
sync_button.set_visual_state (1); // "-active"
}
}
@ -862,14 +882,6 @@ ARDOUR_UI::editor_realized ()
reset_dpi ();
}
void
ARDOUR_UI::sync_button_clicked ()
{
if (session) {
session->config.set_external_sync (sync_button.get_active());
}
}
void
ARDOUR_UI::maximise_editing_space ()
{

View File

@ -364,9 +364,12 @@ ARDOUR_UI::install_actions ()
ActionManager::session_sensitive_actions.push_back (act);
ActionManager::transport_sensitive_actions.push_back (act);
ActionManager::register_toggle_action (transport_actions, X_("ToggleVideoSync"), _("Sync startup to video"), mem_fun(*this, &ARDOUR_UI::toggle_video_sync));
act = ActionManager::register_toggle_action (transport_actions, X_("ToggleVideoSync"), _("Sync startup to video"), mem_fun(*this, &ARDOUR_UI::toggle_video_sync));
ActionManager::session_sensitive_actions.push_back (act);
act = ActionManager::register_toggle_action (transport_actions, X_("ToggleTimeMaster"), _("Time Master"), mem_fun(*this, &ARDOUR_UI::toggle_time_master));
ActionManager::session_sensitive_actions.push_back (act);
act = ActionManager::register_toggle_action (transport_actions, X_("ToggleExternalSync"), _(""), mem_fun(*this, &ARDOUR_UI::toggle_external_sync));
ActionManager::session_sensitive_actions.push_back (act);
act = ActionManager::register_action (common_actions, X_("ToggleRecordEnableTrack1"), _("Toggle Record Enable Track1"), bind (mem_fun(*this, &ARDOUR_UI::toggle_record_enable), 0U));
ActionManager::session_sensitive_actions.push_back (act);

View File

@ -47,6 +47,12 @@ using namespace ARDOUR;
using namespace PBD;
using namespace sigc;
void
ARDOUR_UI::toggle_external_sync()
{
ActionManager::toggle_config_state_foo ("Transport", "ToggleExternalSync", mem_fun (session->config, &SessionConfiguration::set_external_sync), mem_fun (session->config, &SessionConfiguration::get_external_sync));
}
void
ARDOUR_UI::toggle_time_master ()
{
@ -296,7 +302,9 @@ ARDOUR_UI::parameter_changed (std::string p)
ENSURE_GUI_THREAD (bind (mem_fun (*this, &ARDOUR_UI::parameter_changed), p));
if (p == "external-sync") {
ActionManager::map_some_state ("Transport", "ToggleExternalSync", mem_fun (session->config, &SessionConfiguration::get_external_sync));
if (!session->config.get_external_sync()) {
sync_button.set_label (_("Internal"));
ActionManager::get_action ("Transport", "ToggleAutoPlay")->set_sensitive (true);

View File

@ -243,6 +243,10 @@ public:
}
}
void set_sensitive (bool yn) {
_combo->set_sensitive (yn);
}
private:
sigc::slot<T> _get;

View File

@ -55,25 +55,25 @@ public:
t->set_spacings (12);
int n = 0;
Label* l = manage (new Label (_("MTC:")));
Label* l = manage (new Label (_("Receive MTC via:")));
l->set_alignment (1, 0.5);
t->attach (*l, 0, 1, n, n + 1, EXPAND | FILL, FILL);
t->attach (_mtc_combo, 1, 2, n, n + 1, EXPAND | FILL, EXPAND | FILL);
++n;
l = manage (new Label (_("MIDI clock:")));
l = manage (new Label (_("Receive MIDI clock via:")));
l->set_alignment (1, 0.5);
t->attach (*l, 0, 1, n, n + 1, FILL, FILL);
t->attach (_midi_clock_combo, 1, 2, n, n + 1, FILL, FILL);
++n;
l = manage (new Label (_("MMC:")));
l = manage (new Label (_("Receive MMC via:")));
l->set_alignment (1, 0.5);
t->attach (*l, 0, 1, n, n + 1, FILL, FILL);
t->attach (_mmc_combo, 1, 2, n, n + 1, FILL, FILL);
++n;
l = manage (new Label (_("MIDI parameter control:")));
l = manage (new Label (_("Receive MIDI parameter control via:")));
l->set_alignment (1, 0.5);
t->attach (*l, 0, 1, n, n + 1, FILL, FILL);
t->attach (_mpc_combo, 1, 2, n, n + 1, FILL, FILL);

View File

@ -141,6 +141,82 @@ SessionOptionEditor::SessionOptionEditor (Session* s)
: OptionEditor (&(s->config), _("Session Preferences"))
, _session_config (&(s->config))
{
/* SYNC */
ComboOption<uint32_t>* spf = new ComboOption<uint32_t> (
"subframes-per-frame",
_("Subframes per frame"),
mem_fun (*_session_config, &SessionConfiguration::get_subframes_per_frame),
mem_fun (*_session_config, &SessionConfiguration::set_subframes_per_frame)
);
spf->add (80, _("80"));
spf->add (100, _("100"));
add_option (_("Sync"), spf);
ComboOption<SyncSource>* ssrc = new ComboOption<SyncSource> (
"sync-source",
_("External sync source"),
mem_fun (*_session_config, &SessionConfiguration::get_sync_source),
mem_fun (*_session_config, &SessionConfiguration::set_sync_source)
);
s->MTC_PortChanged.connect (bind (mem_fun (*this, &SessionOptionEditor::populate_sync_options), s, ssrc));
s->MIDIClock_PortChanged.connect (bind (mem_fun (*this, &SessionOptionEditor::populate_sync_options), s, ssrc));
s->config.ParameterChanged.connect (bind (mem_fun (*this, &SessionOptionEditor::follow_sync_state), s, ssrc));
populate_sync_options (s, ssrc);
follow_sync_state (string ("external-sync"), s, ssrc);
add_option (_("Sync"), ssrc);
ComboOption<TimecodeFormat>* smf = new ComboOption<TimecodeFormat> (
"timecode-format",
_("Timecode frames-per-second"),
mem_fun (*_session_config, &SessionConfiguration::get_timecode_format),
mem_fun (*_session_config, &SessionConfiguration::set_timecode_format)
);
smf->add (timecode_23976, _("23.976"));
smf->add (timecode_24, _("24"));
smf->add (timecode_24976, _("24.976"));
smf->add (timecode_25, _("25"));
smf->add (timecode_2997, _("29.97"));
smf->add (timecode_2997drop, _("29.97 drop"));
smf->add (timecode_30, _("30"));
smf->add (timecode_30drop, _("30 drop"));
smf->add (timecode_5994, _("59.94"));
smf->add (timecode_60, _("60"));
add_option (_("Sync"), smf);
add_option (_("Sync"), new BoolOption (
"timecode-source-is-synced",
_("Timecode source is synced"),
mem_fun (*_session_config, &SessionConfiguration::get_timecode_source_is_synced),
mem_fun (*_session_config, &SessionConfiguration::set_timecode_source_is_synced)
));
ComboOption<float>* vpu = new ComboOption<float> (
"video-pullup",
_("Pull-up / pull-down"),
mem_fun (*_session_config, &SessionConfiguration::get_video_pullup),
mem_fun (*_session_config, &SessionConfiguration::set_video_pullup)
);
vpu->add (4.1667 + 0.1, _("4.1667 + 0.1%"));
vpu->add (4.1667, _("4.1667"));
vpu->add (4.1667 - 0.1, _("4.1667 - 0.1%"));
vpu->add (0.1, _("0.1"));
vpu->add (0, _("none"));
vpu->add (-0.1, _("-0.1"));
vpu->add (-4.1667 + 0.1, _("-4.1667 + 0.1%"));
vpu->add (-4.1667, _("-4.1667"));
vpu->add (-4.1667 - 0.1, _("-4.1667 - 0.1%"));
add_option (_("Sync"), vpu);
/* FADES */
ComboOption<CrossfadeModel>* cfm = new ComboOption<CrossfadeModel> (
@ -208,79 +284,6 @@ SessionOptionEditor::SessionOptionEditor (Session* s)
mem_fun (*_session_config, &SessionConfiguration::set_show_region_fades)
));
/* SYNC */
ComboOption<uint32_t>* spf = new ComboOption<uint32_t> (
"subframes-per-frame",
_("Subframes per frame"),
mem_fun (*_session_config, &SessionConfiguration::get_subframes_per_frame),
mem_fun (*_session_config, &SessionConfiguration::set_subframes_per_frame)
);
spf->add (80, _("80"));
spf->add (100, _("100"));
add_option (_("Sync"), spf);
ComboOption<SyncSource>* ssrc = new ComboOption<SyncSource> (
"sync-source",
_("External sync source"),
mem_fun (*_session_config, &SessionConfiguration::get_sync_source),
mem_fun (*_session_config, &SessionConfiguration::set_sync_source)
);
s->MTC_PortChanged.connect (bind (mem_fun (*this, &SessionOptionEditor::populate_sync_options), s, ssrc));
s->MIDIClock_PortChanged.connect (bind (mem_fun (*this, &SessionOptionEditor::populate_sync_options), s, ssrc));
populate_sync_options (s, ssrc);
add_option (_("Sync"), ssrc);
ComboOption<TimecodeFormat>* smf = new ComboOption<TimecodeFormat> (
"timecode-format",
_("Timecode frames-per-second"),
mem_fun (*_session_config, &SessionConfiguration::get_timecode_format),
mem_fun (*_session_config, &SessionConfiguration::set_timecode_format)
);
smf->add (timecode_23976, _("23.976"));
smf->add (timecode_24, _("24"));
smf->add (timecode_24976, _("24.976"));
smf->add (timecode_25, _("25"));
smf->add (timecode_2997, _("29.97"));
smf->add (timecode_2997drop, _("29.97 drop"));
smf->add (timecode_30, _("30"));
smf->add (timecode_30drop, _("30 drop"));
smf->add (timecode_5994, _("59.94"));
smf->add (timecode_60, _("60"));
add_option (_("Sync"), smf);
add_option (_("Sync"), new BoolOption (
"timecode-source-is-synced",
_("Timecode source is synced"),
mem_fun (*_session_config, &SessionConfiguration::get_timecode_source_is_synced),
mem_fun (*_session_config, &SessionConfiguration::set_timecode_source_is_synced)
));
ComboOption<float>* vpu = new ComboOption<float> (
"video-pullup",
_("Pull-up / pull-down"),
mem_fun (*_session_config, &SessionConfiguration::get_video_pullup),
mem_fun (*_session_config, &SessionConfiguration::set_video_pullup)
);
vpu->add (4.1667 + 0.1, _("4.1667 + 0.1%"));
vpu->add (4.1667, _("4.1667"));
vpu->add (4.1667 - 0.1, _("4.1667 - 0.1%"));
vpu->add (0.1, _("0.1"));
vpu->add (0, _("none"));
vpu->add (-0.1, _("-0.1"));
vpu->add (-4.1667 + 0.1, _("-4.1667 + 0.1%"));
vpu->add (-4.1667, _("-4.1667"));
vpu->add (-4.1667 - 0.1, _("-4.1667 - 0.1%"));
add_option (_("Sync"), vpu);
/* MISC */
add_option (_("Misc"), new OptionEditorHeading (_("Audio file format")));
@ -360,3 +363,15 @@ SessionOptionEditor::populate_sync_options (Session* s, Option* opt)
}
}
void
SessionOptionEditor::follow_sync_state (std::string p, Session* s, Option* opt)
{
ComboOption<SyncSource>* sync_opt = dynamic_cast<ComboOption<SyncSource>* > (opt);
if (p == "external-sync") {
if (s->config.get_external_sync()) {
sync_opt->set_sensitive (false);
} else {
sync_opt->set_sensitive (true);
}
}
}

View File

@ -13,4 +13,5 @@ public:
private:
ARDOUR::SessionConfiguration* _session_config;
void populate_sync_options (ARDOUR::Session*, Option*);
void follow_sync_state (std::string, ARDOUR::Session*, Option*);
};

View File

@ -203,8 +203,6 @@ RCConfiguration::get_state ()
MIDI::Manager::PortMap::const_iterator i;
const MIDI::Manager::PortMap& ports = MIDI::Manager::instance()->get_midi_ports();
cerr << "Saving " << ports.size() << " MIDI ports\n";
for (i = ports.begin(); i != ports.end(); ++i) {
root->add_child_nocopy(i->second->get_state());
}

View File

@ -141,8 +141,6 @@ Session::set_mtc_port (string port_tag)
ms->rebind (*port);
}
cerr << "!!SPT to " << port_tag << endl;
Config->set_mtc_port_name (port_tag);
out: