don't use selection clocks show MIDI selection when in internal edit mode; remove...
authorPaul Davis <paul@linuxaudiosystems.com>
Wed, 8 Jun 2011 13:44:18 +0000 (13:44 +0000)
committerPaul Davis <paul@linuxaudiosystems.com>
Wed, 8 Jun 2011 13:44:18 +0000 (13:44 +0000)
git-svn-id: svn://localhost/ardour2/branches/3.0@9688 d708f5d6-7413-0410-9779-e7cbd77b26cf

gtk2_ardour/ardour_ui_ed.cc
gtk2_ardour/audio_clock.cc
gtk2_ardour/audio_clock.h
gtk2_ardour/time_info_box.cc

index 5892695085702046858e1485256dc2b5152d6431..98da8d21f900296da3185c8e5720b3f4dc3d1d50 100644 (file)
@@ -362,8 +362,6 @@ ARDOUR_UI::install_actions ()
        ActionManager::session_sensitive_actions.push_back (act);
        act = ActionManager::register_action (transport_actions, X_("primary-clock-samples"), _("Samples"), sigc::bind (sigc::mem_fun(primary_clock, &AudioClock::set_mode), AudioClock::Frames));
        ActionManager::session_sensitive_actions.push_back (act);
-       //act = ActionManager::register_action (transport_actions, X_("primary-clock-off"), _("Off"), sigc::bind (sigc::mem_fun(primary_clock, &AudioClock::set_mode), AudioClock::Off));
-       ActionManager::session_sensitive_actions.push_back (act);
 
        act = ActionManager::register_action (transport_actions, X_("secondary-clock-timecode"), _("Timecode"), sigc::bind (sigc::mem_fun(secondary_clock, &AudioClock::set_mode), AudioClock::Timecode));
        ActionManager::session_sensitive_actions.push_back (act);
@@ -373,8 +371,6 @@ ARDOUR_UI::install_actions ()
        ActionManager::session_sensitive_actions.push_back (act);
        act = ActionManager::register_action (transport_actions, X_("secondary-clock-samples"), _("Samples"), sigc::bind (sigc::mem_fun(secondary_clock, &AudioClock::set_mode), AudioClock::Frames));
        ActionManager::session_sensitive_actions.push_back (act);
-       //act = ActionManager::register_action (transport_actions, X_("secondary-clock-off"), _("Off"), sigc::bind (sigc::mem_fun(secondary_clock, &AudioClock::set_mode), AudioClock::Off));
-       //ActionManager::session_sensitive_actions.push_back (act);
 
        act = ActionManager::register_toggle_action (transport_actions, X_("TogglePunchIn"), _("Punch In"), sigc::mem_fun(*this, &ARDOUR_UI::toggle_punch_in));
        ActionManager::session_sensitive_actions.push_back (act);
index e983296cc9f63548b54491ea6d3c17ebbc878547..e7eb0245c76b57204f96e13ec03585b743960d67 100644 (file)
@@ -1769,7 +1769,6 @@ AudioClock::build_ops_menu ()
        ops_items.push_back (MenuElem (_("Bars:Beats"), sigc::bind (sigc::mem_fun(*this, &AudioClock::set_mode), BBT)));
        ops_items.push_back (MenuElem (_("Minutes:Seconds"), sigc::bind (sigc::mem_fun(*this, &AudioClock::set_mode), MinSec)));
        ops_items.push_back (MenuElem (_("Samples"), sigc::bind (sigc::mem_fun(*this, &AudioClock::set_mode), Frames)));
-       ops_items.push_back (MenuElem (_("Off"), sigc::mem_fun(*this, &AudioClock::toggle_off)));
 
        if (editable && !is_duration && !_follows_playhead) {
                ops_items.push_back (SeparatorElem());
@@ -1971,8 +1970,3 @@ AudioClock::set_off (bool yn)
        set (_canonical_time, true);
 }
 
-void
-AudioClock::toggle_off ()
-{
-       set_off (!_off);
-}
index d7971ffafd7acc58f0032097bdb6c588beddc6a6..4ce057b01bd603b1ff9fdb2ce35105d53a1467c8 100644 (file)
@@ -222,7 +222,6 @@ class AudioClock : public Gtk::VBox, public ARDOUR::SessionHandlePtr
        void disconnect_signals ();
 
        void set_theme ();
-       void toggle_off ();
 };
 
 #endif /* __audio_clock_h__ */
index e79e7c2d732425c30b95d3b8f9842f34fd81632e..e8068ba92fe9df5f891a50b1d8121dfb81655bde 100644 (file)
@@ -17,6 +17,7 @@
 
 */
 
+#include <algorithm>
 #include "pbd/compose.h"
 
 #include "gtkmm2ext/cairocell.h"
@@ -34,6 +35,8 @@
 
 using namespace Gtk;
 using namespace ARDOUR;
+using std::min;
+using std::max;
 
 TimeInfoBox::TimeInfoBox ()
        : Table (4, 4)
@@ -119,8 +122,8 @@ 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));
+       selection_end->mode_changed.connect (sigc::bind (sigc::mem_fun (*this, &TimeInfoBox::sync_selection_mode), selection_end));
+       selection_length->mode_changed.connect (sigc::bind (sigc::mem_fun (*this, &TimeInfoBox::sync_selection_mode), selection_length));
 
        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));
@@ -223,20 +226,45 @@ TimeInfoBox::selection_changed ()
        Selection& selection (Editor::instance().get_selection());
 
        switch (Editor::instance().current_mouse_mode()) {
+
        case Editing::MouseObject:
-               if (selection.regions.empty()) {
+               if (Editor::instance().internal_editing()) {
+                       /* displaying MIDI note selection is tricky */
+                       
                        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);
+                       if (selection.regions.empty()) {
+                               if (selection.points.empty()) {
+                                       selection_start->set_off (true);
+                                       selection_end->set_off (true);
+                                       selection_length->set_off (true);
+                               } else {
+                                       s = max_framepos;
+                                       e = 0;
+                                       for (PointSelection::iterator i = selection.points.begin(); i != selection.points.end(); ++i) {
+                                               s = min (s, (framepos_t) i->start);
+                                               e = max (e, (framepos_t) i->end);
+                                       }
+                                       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);
+                               }
+                       } 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;