From a56555e8b200970a364c5f341d9ad938f53553c6 Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Tue, 7 Jun 2011 23:07:08 +0000 Subject: remove "Off" as a clock mode, make it a state instead; track editor mouse mode when displaying selection (not 100% coverage of different selections yet); add extra negative field for timecode clock to help with text alignment; add clock mode = timecode option to menus git-svn-id: svn://localhost/ardour2/branches/3.0@9685 d708f5d6-7413-0410-9779-e7cbd77b26cf --- gtk2_ardour/time_info_box.cc | 42 +++++++++++++++++++++++++++++++++++++++--- 1 file changed, 39 insertions(+), 3 deletions(-) (limited to 'gtk2_ardour/time_info_box.cc') diff --git a/gtk2_ardour/time_info_box.cc b/gtk2_ardour/time_info_box.cc index ae3d3b65d4..d25bd16e14 100644 --- a/gtk2_ardour/time_info_box.cc +++ b/gtk2_ardour/time_info_box.cc @@ -132,6 +132,9 @@ TimeInfoBox::TimeInfoBox () punch_end->signal_button_release_event().connect (sigc::bind (sigc::mem_fun (*this, &TimeInfoBox::clock_button_release_event), punch_end), true); Editor::instance().get_selection().TimeChanged.connect (sigc::mem_fun (*this, &TimeInfoBox::selection_changed)); + Editor::instance().get_selection().RegionsChanged.connect (sigc::mem_fun (*this, &TimeInfoBox::selection_changed)); + + Editor::instance().MouseModeChanged.connect (editor_connections, invalidator(*this), ui_bind (&TimeInfoBox::track_mouse_mode, this), gui_context()); } TimeInfoBox::~TimeInfoBox () @@ -144,6 +147,12 @@ TimeInfoBox::~TimeInfoBox () delete punch_end; } +void +TimeInfoBox::track_mouse_mode () +{ + selection_changed (); +} + bool TimeInfoBox::clock_button_release_event (GdkEventButton* ev, AudioClock* src) { @@ -210,9 +219,36 @@ TimeInfoBox::set_session (Session* s) void TimeInfoBox::selection_changed () { - selection_start->set (Editor::instance().get_selection().time.start()); - selection_end->set (Editor::instance().get_selection().time.end_frame()); - selection_length->set (Editor::instance().get_selection().time.length()); + framepos_t s, e; + + switch (Editor::instance().current_mouse_mode()) { + case Editing::MouseObject: + s = Editor::instance().get_selection().regions.start(); + e = Editor::instance().get_selection().regions.end_frame(); + + selection_start->set_off (false); + selection_end->set_off (false); + selection_length->set_off (false); + selection_start->set (s); + selection_end->set (e); + selection_length->set (e - s + 1); + break; + + case Editing::MouseRange: + selection_start->set_off (false); + selection_end->set_off (false); + selection_length->set_off (false); + selection_start->set (Editor::instance().get_selection().time.start()); + selection_end->set (Editor::instance().get_selection().time.end_frame()); + selection_length->set (Editor::instance().get_selection().time.length()); + break; + + default: + selection_start->set_off (true); + selection_end->set_off (true); + selection_length->set_off (true); + break; + } } void -- cgit v1.2.3