From c9cf966b34b8f073836948a54c9aaf9ff9169119 Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Wed, 8 Jun 2011 13:22:40 +0000 Subject: [PATCH] turn selection clocks off if there is no selection git-svn-id: svn://localhost/ardour2/branches/3.0@9687 d708f5d6-7413-0410-9779-e7cbd77b26cf --- gtk2_ardour/time_info_box.cc | 42 +++++++++++++++++++++++------------- 1 file changed, 27 insertions(+), 15 deletions(-) diff --git a/gtk2_ardour/time_info_box.cc b/gtk2_ardour/time_info_box.cc index ba96416fba..e79e7c2d73 100644 --- a/gtk2_ardour/time_info_box.cc +++ b/gtk2_ardour/time_info_box.cc @@ -220,27 +220,39 @@ void TimeInfoBox::selection_changed () { framepos_t s, e; + Selection& selection (Editor::instance().get_selection()); 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); + if (selection.regions.empty()) { + selection_start->set_off (true); + selection_end->set_off (true); + selection_length->set_off (true); + } else { + s = selection.regions.start(); + e = 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()); + if (selection.time.empty()) { + selection_start->set_off (true); + selection_end->set_off (true); + selection_length->set_off (true); + } else { + selection_start->set_off (false); + selection_end->set_off (false); + selection_length->set_off (false); + selection_start->set (selection.time.start()); + selection_end->set (selection.time.end_frame()); + selection_length->set (selection.time.length()); + } break; default: