remove "Off" as a clock mode, make it a state instead; track editor mouse mode when...
authorPaul Davis <paul@linuxaudiosystems.com>
Tue, 7 Jun 2011 23:07:08 +0000 (23:07 +0000)
committerPaul Davis <paul@linuxaudiosystems.com>
Tue, 7 Jun 2011 23:07:08 +0000 (23:07 +0000)
git-svn-id: svn://localhost/ardour2/branches/3.0@9685 d708f5d6-7413-0410-9779-e7cbd77b26cf

13 files changed:
gtk2_ardour/ardour.menus.in
gtk2_ardour/ardour_ui.cc
gtk2_ardour/ardour_ui_ed.cc
gtk2_ardour/audio_clock.cc
gtk2_ardour/audio_clock.h
gtk2_ardour/editor_regions.cc
gtk2_ardour/enums.cc
gtk2_ardour/export_format_dialog.cc
gtk2_ardour/export_timespan_selector.cc
gtk2_ardour/time_info_box.cc
gtk2_ardour/time_info_box.h
libs/ardour/ardour/export_profile_manager.h
libs/ardour/enums.cc

index ddc3a50bf7734ef310239090ccec44e1bb0e1a28..1c2c6b5194b5eb6cb99e8c12dce76a873e799945 100644 (file)
       <separator/>
 
       <menu action="PrimaryClockMenu">
+        <menuitem action="primary-clock-timecode"/>
         <menuitem action="primary-clock-bbt"/>
         <menuitem action="primary-clock-minsec"/>
         <menuitem action="primary-clock-samples"/>
-        <menuitem action="primary-clock-off"/>
       </menu>
       <menu action="SecondaryClockMenu">
+        <menuitem action="secondary-clock-timecode"/>
         <menuitem action="secondary-clock-bbt"/>
         <menuitem action="secondary-clock-minsec"/>
         <menuitem action="secondary-clock-samples"/>
-        <menuitem action="secondary-clock-off"/>
       </menu>
 
       <separator/>
index 1fa4b21b56e89e4b7ff3885467e1f821928d2375..eefa3b99013a96e150c0bc60e1cf943f1ba82304 100644 (file)
@@ -3482,15 +3482,19 @@ ARDOUR_UI::store_clock_modes ()
        XMLNode* node = new XMLNode(X_("ClockModes"));
 
        for (vector<AudioClock*>::iterator x = AudioClock::clocks.begin(); x != AudioClock::clocks.end(); ++x) {
-               node->add_property ((*x)->name().c_str(), enum_2_string ((*x)->mode()));
+               XMLNode* child = new XMLNode (X_("Clock"));
+               
+               child->add_property (X_("name"), (*x)->name());
+               child->add_property (X_("mode"), enum_2_string ((*x)->mode()));
+               child->add_property (X_("on"), ((*x)->off() ? X_("no") : X_("yes")));
+
+               node->add_child_nocopy (*child);
        }
 
        _session->add_extra_xml (*node);
        _session->set_dirty ();
 }
 
-
-
 ARDOUR_UI::TransportControllable::TransportControllable (std::string name, ARDOUR_UI& u, ToggleType tp)
        : Controllable (name), ui (u), type(tp)
 {
index a7cbb22dfd01a4fc9eae1bfbc18b643a26c05a8f..5892695085702046858e1485256dc2b5152d6431 100644 (file)
@@ -354,23 +354,27 @@ ARDOUR_UI::install_actions ()
        ActionManager::session_sensitive_actions.push_back (act);
        ActionManager::transport_sensitive_actions.push_back (act);
 
+       act = ActionManager::register_action (transport_actions, X_("primary-clock-timecode"), _("Timecode"), sigc::bind (sigc::mem_fun(primary_clock, &AudioClock::set_mode), AudioClock::Timecode));
+       ActionManager::session_sensitive_actions.push_back (act);
        act = ActionManager::register_action (transport_actions, X_("primary-clock-bbt"), _("Bars & Beats"), sigc::bind (sigc::mem_fun(primary_clock, &AudioClock::set_mode), AudioClock::BBT));
        ActionManager::session_sensitive_actions.push_back (act);
        act = ActionManager::register_action (transport_actions, X_("primary-clock-minsec"), _("Minutes & Seconds"), sigc::bind (sigc::mem_fun(primary_clock, &AudioClock::set_mode), AudioClock::MinSec));
        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));
+       //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);
        act = ActionManager::register_action (transport_actions, X_("secondary-clock-bbt"), _("Bars & Beats"), sigc::bind (sigc::mem_fun(secondary_clock, &AudioClock::set_mode), AudioClock::BBT));
        ActionManager::session_sensitive_actions.push_back (act);
        act = ActionManager::register_action (transport_actions, X_("secondary-clock-minsec"), _("Minutes & Seconds"), sigc::bind (sigc::mem_fun(secondary_clock, &AudioClock::set_mode), AudioClock::MinSec));
        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_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 bc9783cf860e633f43225bf56c3a5b2781b6c8a7..e983296cc9f63548b54491ea6d3c17ebbc878547 100644 (file)
@@ -55,6 +55,7 @@ sigc::signal<void> AudioClock::ModeChanged;
 vector<AudioClock*> AudioClock::clocks;
 
 uint32_t AudioClock::field_length[] = {
+       1, /* Timecode_Sign */
        2, /* Timecode_Hours */
        2, /* Timecode_Minutes */
        2, /* Timecode_Seconds */
@@ -76,6 +77,7 @@ AudioClock::AudioClock (const string& clock_name, bool transient, const string&
        , is_duration (duration)
        , editable (allow_edit)
        , _follows_playhead (follows_playhead)
+       , _off (false)
        , supplemental_left (0)
        , supplemental_right (0)
        , last_when(0)
@@ -114,8 +116,8 @@ AudioClock::AudioClock (const string& clock_name, bool transient, const string&
        _fixed_cells[Bar1] = new CairoCharCell (Bar1, '|');
        _fixed_cells[Bar2] = new CairoCharCell (Bar2, '|');
        
-       // add an extra character for the negative sign
-       _text_cells[Timecode_Hours] = new CairoTextCell (Timecode_Hours, field_length[Timecode_Hours] + 1); 
+       _text_cells[Timecode_Sign] = new CairoTextCell (Timecode_Sign, field_length[Timecode_Sign]);
+       _text_cells[Timecode_Hours] = new CairoTextCell (Timecode_Hours, field_length[Timecode_Hours]);
        _text_cells[Timecode_Minutes] = new CairoTextCell (Timecode_Minutes, field_length[Timecode_Minutes]);
        _text_cells[Timecode_Seconds] = new CairoTextCell (Timecode_Seconds, field_length[Timecode_Seconds]);
        _text_cells[Timecode_Frames] = new CairoTextCell (Timecode_Frames, field_length[Timecode_Frames]);
@@ -175,6 +177,8 @@ AudioClock::AudioClock (const string& clock_name, bool transient, const string&
        set_mode (Timecode);
        set (last_when, true);
 
+       connect_signals ();
+
        if (!is_transient) {
                clocks.push_back (this);
        }
@@ -185,10 +189,18 @@ AudioClock::~AudioClock ()
        /* these are not manage()'d, so that we can add/remove
           them from containers as necessary.
        */
+
        delete display;
        delete supplemental_left;
        delete supplemental_right;
-       /* XXX need to delete all cells too */
+
+       for (std::map<Field,CairoCell*>::iterator i = _fixed_cells.begin(); i != _fixed_cells.end(); ++i) {
+               delete i->second;
+       }
+
+       for (std::map<Field,CairoTextCell*>::iterator i = _text_cells.begin(); i != _text_cells.end(); ++i) {
+               delete i->second;
+       }
 }
 
 void
@@ -354,9 +366,6 @@ AudioClock::set (framepos_t when, bool force, framecnt_t offset, char which)
        case Frames:
                set_frames (when, force);
                break;
-
-       case Off:
-               break;
        }
 
        last_when = when;
@@ -394,6 +403,18 @@ AudioClock::set_frames (framepos_t when, bool /*force*/)
 {
        char buf[32];
        snprintf (buf, sizeof (buf), "%" PRId64, when);
+
+       if (_off) {
+               display->set_text (_text_cells[AudioFrames], "--");
+
+               if (supplemental_left) {
+                       supplemental_left->set_text (_text_cells[LowerLeft2], "");
+                       supplemental_right->set_text (_text_cells[LowerRight2], "");
+               }
+               
+               return;
+       }
+
        
        display->set_text (_text_cells[AudioFrames], buf);
 
@@ -429,6 +450,20 @@ AudioClock::set_minsec (framepos_t when, bool force)
        int secs;
        int millisecs;
 
+       if (_off) {
+               display->set_text (_text_cells[MS_Hours], "--");
+               display->set_text (_text_cells[MS_Minutes], "--");
+               display->set_text (_text_cells[MS_Seconds], "--");
+               display->set_text (_text_cells[MS_Milliseconds], "--");
+
+               if (supplemental_left) {
+                       supplemental_left->set_text (_text_cells[LowerLeft2], "");
+                       supplemental_right->set_text (_text_cells[LowerRight2], "");
+               }
+               
+               return;
+       }       
+
        left = when;
        hrs = (int) floor (left / (_session->frame_rate() * 60.0f * 60.0f));
        left -= (framecnt_t) floor (hrs * _session->frame_rate() * 60.0f * 60.0f);
@@ -469,6 +504,21 @@ AudioClock::set_timecode (framepos_t when, bool force)
        char buf[32];
        Timecode::Time TC;
 
+       if (_off) {
+               display->set_text (_text_cells[Timecode_Sign], "");
+               display->set_text (_text_cells[Timecode_Hours], "--");
+               display->set_text (_text_cells[Timecode_Minutes], "--");
+               display->set_text (_text_cells[Timecode_Seconds], "--");
+               display->set_text (_text_cells[Timecode_Frames], "--");
+
+               if (supplemental_left) {
+                       supplemental_left->set_text (_text_cells[LowerLeft2], "");
+                       supplemental_right->set_text (_text_cells[LowerRight2], "");
+               }
+               
+               return;
+       }
+
        if (is_duration) {
                _session->timecode_duration (when, TC);
        } else {
@@ -477,9 +527,11 @@ AudioClock::set_timecode (framepos_t when, bool force)
 
        if (force || TC.hours != last_hrs || TC.negative != last_negative) {
                if (TC.negative) {
-                       sprintf (buf, "-%0*" PRIu32, field_length[Timecode_Hours], TC.hours);
+                       display->set_text (_text_cells[Timecode_Sign], "-");
+                       sprintf (buf, "%0*" PRIu32, field_length[Timecode_Hours], TC.hours);
                } else {
-                       sprintf (buf, " %0*" PRIu32, field_length[Timecode_Hours], TC.hours);
+                       display->set_text (_text_cells[Timecode_Sign], " ");
+                       sprintf (buf, "%0*" PRIu32, field_length[Timecode_Hours], TC.hours);
                }
                display->set_text (_text_cells[Timecode_Hours], buf);
                last_hrs = TC.hours;
@@ -532,6 +584,19 @@ AudioClock::set_bbt (framepos_t when, bool force)
        char buf[16];
        Timecode::BBT_Time BBT;
 
+       if (_off) {
+               display->set_text (_text_cells[Bars], "--");
+               display->set_text (_text_cells[Beats], "--");
+               display->set_text (_text_cells[Ticks], "--");
+
+               if (supplemental_left) {
+                       supplemental_left->set_text (_text_cells[LowerLeft2], "");
+                       supplemental_right->set_text (_text_cells[LowerRight2], "");
+               }
+               
+               return;
+       }
+
        /* handle a common case */
        if (is_duration) {
                if (when == 0) {
@@ -588,14 +653,23 @@ AudioClock::set_session (Session *s)
 
                _session->config.ParameterChanged.connect (_session_connections, invalidator (*this), boost::bind (&AudioClock::session_configuration_changed, this, _1), gui_context());
 
-               XMLProperty* prop;
+               const XMLProperty* prop;
                XMLNode* node = _session->extra_xml (X_("ClockModes"));
                AudioClock::Mode amode;
 
                if (node) {
-                       if ((prop = node->property (_name)) != 0) {
-                               amode = AudioClock::Mode (string_2_enum (prop->value(), amode));
-                               set_mode (amode);
+                       for (XMLNodeList::const_iterator i = node->children().begin(); i != node->children().end(); ++i) {
+                               if ((prop = (*i)->property (X_("name"))) && prop->value() == _name) {
+
+                                       if ((prop = (*i)->property (X_("mode"))) != 0) {
+                                               amode = AudioClock::Mode (string_2_enum (prop->value(), amode));
+                                               set_mode (amode);
+                                       }
+                                       if ((prop = (*i)->property (X_("on"))) != 0) {
+                                               set_off (!string_is_affirmative (prop->value()));
+                                       }
+                                       break;
+                               }
                        }
                }
 
@@ -1129,9 +1203,6 @@ AudioClock::current_time (framepos_t pos) const
        case Frames:
                ret = audio_frame_from_display ();
                break;
-
-       case Off:
-               break;
        }
 
        return ret;
@@ -1157,9 +1228,6 @@ AudioClock::current_duration (framepos_t pos) const
        case Frames:
                ret = audio_frame_from_display ();
                break;
-
-       case Off:
-               break;
        }
 
        return ret;
@@ -1233,7 +1301,12 @@ AudioClock::timecode_frame_from_display () const
        Timecode::Time TC;
        framepos_t sample;
 
-       TC.hours = atoi (label (Timecode_Hours)->get_text());
+       if (!label (Timecode_Sign)->get_text().empty()) {
+               TC.hours = atoi (label (Timecode_Hours)->get_text());
+       } else {
+               TC.hours = -atoi (label (Timecode_Hours)->get_text());
+       }
+
        TC.minutes = atoi (label (Timecode_Minutes)->get_text());
        TC.seconds = atoi (label (Timecode_Seconds)->get_text());
        TC.frames = atoi (label (Timecode_Frames)->get_text());
@@ -1696,7 +1769,7 @@ 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::bind (sigc::mem_fun(*this, &AudioClock::set_mode), Off)));
+       ops_items.push_back (MenuElem (_("Off"), sigc::mem_fun(*this, &AudioClock::toggle_off)));
 
        if (editable && !is_duration && !_follows_playhead) {
                ops_items.push_back (SeparatorElem());
@@ -1726,19 +1799,9 @@ AudioClock::locate ()
        _session->request_locate (current_time(), _session->transport_rolling ());
 }
 
-void
-AudioClock::disconnect_signals ()
-{
-       scroll_connection.disconnect ();
-       button_press_connection.disconnect ();
-       button_release_connection.disconnect ();
-}
-
 void
 AudioClock::connect_signals ()
 {
-       disconnect_signals ();
-
        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));
@@ -1762,6 +1825,7 @@ AudioClock::set_mode (Mode m)
 
        switch (_mode) {
        case Timecode:
+               display->add_cell (_text_cells[Timecode_Sign]);
                display->add_cell (_text_cells[Timecode_Hours]);
                display->add_cell (_fixed_cells[Colon1]);
                display->add_cell (_text_cells[Timecode_Minutes]);
@@ -1799,7 +1863,7 @@ AudioClock::set_mode (Mode m)
                        supplemental_right->add_cell (_text_cells[LowerRight1]);
                        supplemental_right->add_cell (_text_cells[LowerRight2]);
 
-                       supplemental_left->set_width_chars (_text_cells[LowerLeft1], 1);
+                       supplemental_left->set_width_chars (_text_cells[LowerLeft1], 1.5); // why not 1? M must be wider than 8, i suppose
                        supplemental_left->set_width_chars (_text_cells[LowerLeft2], 5.25);
 
                        supplemental_right->set_width_chars (_text_cells[LowerRight1], 1);
@@ -1838,9 +1902,6 @@ AudioClock::set_mode (Mode m)
                        supplemental_right->set_text (_text_cells[LowerRight1], _("Pull"));
                }
                break;
-
-       case Off:
-               break;
        }
 
        if (supplemental_left) {
@@ -1855,12 +1916,7 @@ AudioClock::set_mode (Mode m)
                supplemental_left->set_font (smaller_font);
        }
 
-       if (_mode != Off) {
-               connect_signals ();
-       } else {
-               disconnect_signals  ();
-       }
-
+       set_off (false);
        set (last_when, true);
 
         if (!is_transient) {
@@ -1894,3 +1950,29 @@ AudioClock::set_is_duration (bool yn)
        set (last_when, true, 0, 's');
 }
 
+void
+AudioClock::set_off (bool yn) 
+{
+       if (_off == yn) {
+               return;
+       }
+
+       _off = yn;
+
+       if (_off) {
+               _canonical_time = current_time ();
+               _canonical_time_is_displayed = false;
+       } else {
+               _canonical_time_is_displayed = true;
+       }
+
+       /* force a possible redraw */
+       
+       set (_canonical_time, true);
+}
+
+void
+AudioClock::toggle_off ()
+{
+       set_off (!_off);
+}
index 8e0ab53a9d1285b8730f64f90e12ea69cd6c558f..d7971ffafd7acc58f0032097bdb6c588beddc6a6 100644 (file)
@@ -45,8 +45,7 @@ class AudioClock : public Gtk::VBox, public ARDOUR::SessionHandlePtr
                Timecode,
                BBT,
                MinSec,
-               Frames,
-               Off
+               Frames
        };
 
        AudioClock (const std::string& clock_name, bool is_transient, const std::string& widget_name,
@@ -54,6 +53,8 @@ class AudioClock : public Gtk::VBox, public ARDOUR::SessionHandlePtr
        ~AudioClock ();
 
        Mode mode() const { return _mode; }
+       void set_off (bool yn);
+       bool off() const { return _off; }
 
        void focus ();
 
@@ -94,12 +95,14 @@ class AudioClock : public Gtk::VBox, public ARDOUR::SessionHandlePtr
        bool              editable;
        /** true if this clock follows the playhead, meaning that certain operations are redundant */
        bool             _follows_playhead;
+       bool             _off;
 
        Gtk::Menu  *ops_menu;
 
        CairoEditableText* display;
 
        enum Field {
+               Timecode_Sign,
                Timecode_Hours,
                Timecode_Minutes,
                Timecode_Seconds,
@@ -219,6 +222,7 @@ class AudioClock : public Gtk::VBox, public ARDOUR::SessionHandlePtr
        void disconnect_signals ();
 
        void set_theme ();
+       void toggle_off ();
 };
 
 #endif /* __audio_clock_h__ */
index b2de5c638366d0e76f93114f0e27a67af305ed1b..94830b40b946d53818bc248fc28b31c397330871 100644 (file)
@@ -687,7 +687,6 @@ EditorRegions::format_position (framepos_t pos, char* buf, size_t bufsize)
                break;
 
        case AudioClock::Timecode:
-       case AudioClock::Off: /* If the secondary clock is off, default to Timecode */
        default:
                _session->timecode_time (pos, timecode);
                snprintf (buf, bufsize, "%02d:%02d:%02d:%02d", timecode.hours, timecode.minutes, timecode.seconds, timecode.frames);
index 4b205141750105c21381f9b59a3ff85eab163458..930ac7e2d6209f5fcf1ea4d958962fa602de98c0 100644 (file)
@@ -51,7 +51,6 @@ setup_gtk_ardour_enums ()
        REGISTER_CLASS_ENUM (AudioClock, BBT);
        REGISTER_CLASS_ENUM (AudioClock, MinSec);
        REGISTER_CLASS_ENUM (AudioClock, Frames);
-       REGISTER_CLASS_ENUM (AudioClock, Off);
        REGISTER (clock_mode);
 
        REGISTER_ENUM (Wide);
index 098693466160c6ff4d82862213f25510f7a2dbc5..d719fcecb39c73fe96765c06a7b67d943ba40306 100644 (file)
@@ -780,9 +780,6 @@ ExportFormatDialog::update_time (AnyTime & time, AudioClock const & clock)
                time.type = AnyTime::Frames;
                time.frames = frames;
                break;
-         case AudioClock::Off:
-               silence_end_checkbox.set_active (false);
-               return;
        }
 }
 
index 8cbe92b5e27a7f53be1ae87028472790906af8e8..bf89f8c9ee72f9bec924e6ce37c0aa4329a90a29 100644 (file)
@@ -180,9 +180,6 @@ ExportTimespanSelector::construct_label (ARDOUR::Location const * location) cons
                start = to_string (start_frame, std::dec);
                end = to_string (end_frame, std::dec);
                break;
-
-         case AudioClock::Off:
-               break;
        }
 
        // label += _("from ");
@@ -229,9 +226,6 @@ ExportTimespanSelector::construct_length (ARDOUR::Location const * location) con
        case AudioClock::Frames:
                s << location->length ();
                break;
-
-       case AudioClock::Off:
-               break;
        }
 
        return s.str ();
index ae3d3b65d4ced7414efc8a154f43467f2d145ce7..d25bd16e14e5fe76e2a4d6fa40a32aab4ed91ce0 100644 (file)
@@ -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
index 50561d1249a2dffe6d21ced4d8ef066cc73ac5b0..5be6a0e45aba9c0004193b1401af73dea2a8a474 100644 (file)
@@ -68,12 +68,15 @@ class TimeInfoBox : public Gtk::Table, public ARDOUR::SessionHandlePtr
     void watch_punch (ARDOUR::Location*);
     PBD::ScopedConnectionList punch_connections;
 
+    PBD::ScopedConnectionList editor_connections;
+
     void selection_changed ();
 
     void sync_selection_mode (AudioClock*);
     void sync_punch_mode (AudioClock*);
 
     bool clock_button_release_event (GdkEventButton* ev, AudioClock* src);
+    void track_mouse_mode ();
 };
 
 
index b7a3b950387f4cd42124083f148d76dceeda811f..fef6f3aad50de5b3ebc003afe393f7589baeffee 100644 (file)
@@ -114,7 +114,6 @@ class ExportProfileManager
                BBT,
                MinSec,
                Frames,
-               Off
        };
 
        struct TimespanState {
index 2509862241e827ec8e01f248eeea130827190952..d172e65f5fbeb94d3ea2c56960257c1e6804ad91 100644 (file)
@@ -523,7 +523,6 @@ setup_enum_writer ()
        REGISTER_CLASS_ENUM (ExportProfileManager, BBT);
        REGISTER_CLASS_ENUM (ExportProfileManager, MinSec);
        REGISTER_CLASS_ENUM (ExportProfileManager, Frames);
-       REGISTER_CLASS_ENUM (ExportProfileManager, Off);
        REGISTER (_ExportProfileManager_TimeFormat);
 
        REGISTER_CLASS_ENUM (Delivery, Insert);