From f6e67fa3dd7ddbb2315887af37a7cb20c3e8157f Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Tue, 7 Jun 2011 17:40:05 +0000 Subject: [PATCH] allow mode changes in the time info box, all synced git-svn-id: svn://localhost/ardour2/branches/3.0@9681 d708f5d6-7413-0410-9779-e7cbd77b26cf --- gtk2_ardour/audio_clock.cc | 12 ++++-------- gtk2_ardour/time_info_box.cc | 34 ++++++++++++++++++++++++++++++++++ gtk2_ardour/time_info_box.h | 5 +++++ 3 files changed, 43 insertions(+), 8 deletions(-) diff --git a/gtk2_ardour/audio_clock.cc b/gtk2_ardour/audio_clock.cc index 83a0b8719b..40ff8f3f14 100644 --- a/gtk2_ardour/audio_clock.cc +++ b/gtk2_ardour/audio_clock.cc @@ -917,8 +917,6 @@ AudioClock::button_press (GdkEventButton *ev, CairoCell* cell) bool AudioClock::button_release (GdkEventButton *ev, CairoCell* cell) { - cerr << "button press, cell = " << cell << endl; - if (dragging) { gdk_pointer_ungrab (GDK_CURRENT_TIME); dragging = false; @@ -950,7 +948,7 @@ AudioClock::button_release (GdkEventButton *ev, CairoCell* cell) bool AudioClock::scroll (GdkEventScroll *ev, CairoCell* cell) { - if (_session == 0) { + if (_session == 0 || !editable) { return false; } @@ -1745,11 +1743,9 @@ AudioClock::connect_signals () { disconnect_signals (); - if (editable) { - scroll_connection = display->scroll.connect (sigc::mem_fun (*this, &AudioClock::scroll)); - button_press_connection = display->button_press.connect (sigc::mem_fun (*this, &AudioClock::button_press)); - button_release_connection = display->button_release.connect (sigc::mem_fun (*this, &AudioClock::button_release)); - } + scroll_connection = display->scroll.connect (sigc::mem_fun (*this, &AudioClock::scroll)); + button_press_connection = display->button_press.connect (sigc::mem_fun (*this, &AudioClock::button_press)); + button_release_connection = display->button_release.connect (sigc::mem_fun (*this, &AudioClock::button_release)); } void diff --git a/gtk2_ardour/time_info_box.cc b/gtk2_ardour/time_info_box.cc index 8319db94ef..ebebade6c1 100644 --- a/gtk2_ardour/time_info_box.cc +++ b/gtk2_ardour/time_info_box.cc @@ -37,6 +37,8 @@ using namespace ARDOUR; TimeInfoBox::TimeInfoBox () : Table (4, 4) + , syncing_selection (false) + , syncing_punch (false) { selection_start = new AudioClock ("selection-start", false, "SelectionClockDisplay", false, false, false, false); selection_end = new AudioClock ("selection-end", false, "SelectionClockDisplay", false, false, false, false); @@ -83,6 +85,7 @@ TimeInfoBox::TimeInfoBox () set_homogeneous (false); set_spacings (0); set_border_width (2); + set_col_spacings (2); /* a bit more spacing between the two "sides" */ set_col_spacing (1, 10); @@ -115,6 +118,13 @@ TimeInfoBox::TimeInfoBox () show_all (); + selection_start->mode_changed.connect (sigc::bind (sigc::mem_fun (*this, &TimeInfoBox::sync_selection_mode), selection_start)); + selection_end->mode_changed.connect (sigc::bind (sigc::mem_fun (*this, &TimeInfoBox::sync_selection_mode), selection_start)); + selection_length->mode_changed.connect (sigc::bind (sigc::mem_fun (*this, &TimeInfoBox::sync_selection_mode), selection_start)); + + punch_start->mode_changed.connect (sigc::bind (sigc::mem_fun (*this, &TimeInfoBox::sync_punch_mode), punch_start)); + punch_end->mode_changed.connect (sigc::bind (sigc::mem_fun (*this, &TimeInfoBox::sync_punch_mode), punch_end)); + Editor::instance().get_selection().TimeChanged.connect (sigc::mem_fun (*this, &TimeInfoBox::selection_changed)); } @@ -128,6 +138,30 @@ TimeInfoBox::~TimeInfoBox () delete punch_end; } +void +TimeInfoBox::sync_selection_mode (AudioClock* src) +{ + if (!syncing_selection) { + syncing_selection = true; + selection_start->set_mode (src->mode()); + selection_end->set_mode (src->mode()); + selection_length->set_mode (src->mode()); + syncing_selection = false; + } +} + +void +TimeInfoBox::sync_punch_mode (AudioClock* src) +{ + if (!syncing_punch) { + syncing_punch = true; + punch_start->set_mode (src->mode()); + punch_end->set_mode (src->mode()); + syncing_punch = false; + } +} + + void TimeInfoBox::set_session (Session* s) { diff --git a/gtk2_ardour/time_info_box.h b/gtk2_ardour/time_info_box.h index a1da519aed..734f9ebb95 100644 --- a/gtk2_ardour/time_info_box.h +++ b/gtk2_ardour/time_info_box.h @@ -60,6 +60,8 @@ class TimeInfoBox : public Gtk::Table, public ARDOUR::SessionHandlePtr Gtk::Label selection_title; Gtk::Label punch_title; + bool syncing_selection; + bool syncing_punch; void punch_changed (ARDOUR::Location*); void punch_location_changed (ARDOUR::Location*); @@ -67,6 +69,9 @@ class TimeInfoBox : public Gtk::Table, public ARDOUR::SessionHandlePtr PBD::ScopedConnectionList punch_connections; void selection_changed (); + + void sync_selection_mode (AudioClock*); + void sync_punch_mode (AudioClock*); }; -- 2.30.2