keep velocity value visible in verbose cursor until we leave a note (fixes #5085)
[ardour.git] / gtk2_ardour / editor_regions.cc
index f04bf2329de14f7be6d35919529d9dab4dc4b890..8561fbbfb53f99e7274e90408441a889ff5e13f1 100644 (file)
 
 #include "ardour/audioregion.h"
 #include "ardour/audiofilesource.h"
+#include "ardour/silentfilesource.h"
 #include "ardour/region_factory.h"
 #include "ardour/session.h"
-#include "ardour/session_playlists.h"
-#include "ardour/silentfilesource.h"
 #include "ardour/profile.h"
 
 #include "gtkmm2ext/choice.h"
@@ -48,6 +47,7 @@
 #include "utils.h"
 #include "editor_regions.h"
 #include "editor_drag.h"
+#include "main_clock.h"
 
 #include "i18n.h"
 
@@ -78,8 +78,8 @@ EditorRegions::EditorRegions (Editor* e)
        , expanded (false)
 {
        _display.set_size_request (100, -1);
-       _display.set_name ("RegionListDisplay");
        _display.set_rules_hint (true);
+       _display.set_name ("EditGroupList");
 
        /* Try to prevent single mouse presses from initiating edits.
           This relies on a hack in gtktreeview.c:gtk_treeview_button_press()
@@ -109,12 +109,12 @@ EditorRegions::EditorRegions (Editor* e)
 
        ColumnInfo ci[] = {
                { 0, _("Region"), _("Region name, with number of channels in []'s") },
-               { 1, _("Position"),  _("Length of the region") },
-               { 2, _("End"),  _("Length of the region") },
-               { 3, _("End"),  _("Length of the region") },
+               { 1, _("Position"),  _("Position of start of region") },
+               { 2, _("End"),  _("Position of end of region") },
+               { 3, _("Length"),  _("Length of the region") },
                { 4, _("Sync"),  _("Position of region sync point, relative to start of the region") },
-               { 5, _("Sync"),  _("Region fade-in enabled?") },
-               { 6, _("Fade In"),  _("Region fade-out enabled?") },
+               { 5, _("Fade In"),  _("Length of region fade-in (units: secondary clock), () if disabled") },
+               { 6, _("Fade Out"),  _("Length of region fade-out (units: secondary clock), () if dsisabled") },
                { 7, _("L"),  _("Region position locked?") },
                { 8, _("G"),  _("Region position glued to Bars|Beats time?") },
                { 9, _("M"),  _("Region muted?") },
@@ -213,11 +213,11 @@ EditorRegions::EditorRegions (Editor* e)
 
        //ARDOUR_UI::instance()->secondary_clock.mode_changed.connect (sigc::mem_fun(*this, &Editor::redisplay_regions));
        ARDOUR_UI::instance()->secondary_clock->mode_changed.connect (sigc::mem_fun(*this, &EditorRegions::update_all_rows));
-       ARDOUR::Region::RegionPropertyChanged.connect (region_property_connection, MISSING_INVALIDATOR, ui_bind (&EditorRegions::region_changed, this, _1, _2), gui_context());
-       ARDOUR::RegionFactory::CheckNewRegion.connect (check_new_region_connection, MISSING_INVALIDATOR, ui_bind (&EditorRegions::add_region, this, _1), gui_context());
+       ARDOUR::Region::RegionPropertyChanged.connect (region_property_connection, MISSING_INVALIDATOR, boost::bind (&EditorRegions::region_changed, this, _1, _2), gui_context());
+       ARDOUR::RegionFactory::CheckNewRegion.connect (check_new_region_connection, MISSING_INVALIDATOR, boost::bind (&EditorRegions::add_region, this, _1), gui_context());
 
-       e->EditorFreeze.connect (editor_freeze_connection, MISSING_INVALIDATOR, ui_bind (&EditorRegions::freeze_tree_model, this), gui_context());
-       e->EditorThaw.connect (editor_thaw_connection, MISSING_INVALIDATOR, ui_bind (&EditorRegions::thaw_tree_model, this), gui_context());
+       e->EditorFreeze.connect (editor_freeze_connection, MISSING_INVALIDATOR, boost::bind (&EditorRegions::freeze_tree_model, this), gui_context());
+       e->EditorThaw.connect (editor_thaw_connection, MISSING_INVALIDATOR, boost::bind (&EditorRegions::thaw_tree_model, this), gui_context());
 }
 
 bool
@@ -304,7 +304,6 @@ EditorRegions::add_region (boost::shared_ptr<Region> region)
 
                TreeModel::iterator iter = _model->get_iter ("0");
                TreeModel::Row parent;
-               TreeModel::Row child;
 
                if (!iter) {
                        parent = *(_model->append());
@@ -486,6 +485,8 @@ EditorRegions::region_changed (boost::shared_ptr<Region> r, const PropertyChange
        our_interests.add (ARDOUR::Properties::opaque);
        our_interests.add (ARDOUR::Properties::fade_in);
        our_interests.add (ARDOUR::Properties::fade_out);
+       our_interests.add (ARDOUR::Properties::fade_in_active);
+       our_interests.add (ARDOUR::Properties::fade_out_active);
 
        if (what_changed.contains (our_interests)) {
 
@@ -549,7 +550,7 @@ EditorRegions::selection_changed ()
 
                for (TreeView::Selection::ListHandle_Path::iterator i = rows.begin(); i != rows.end(); ++i) {
 
-                       if (iter = _model->get_iter (*i)) {
+                       if ((iter = _model->get_iter (*i))) {
                                boost::shared_ptr<Region> region = (*iter)[_columns.region];
 
                                // they could have clicked on a row that is just a placeholder, like "Hidden"
@@ -687,7 +688,7 @@ EditorRegions::update_all_rows ()
 }
 
 void
-EditorRegions::format_position (framepos_t pos, char* buf, size_t bufsize)
+EditorRegions::format_position (framepos_t pos, char* buf, size_t bufsize, bool onoff)
 {
        Timecode::BBT_Time bbt;
        Timecode::Time timecode;
@@ -695,7 +696,11 @@ EditorRegions::format_position (framepos_t pos, char* buf, size_t bufsize)
        switch (ARDOUR_UI::instance()->secondary_clock->mode ()) {
        case AudioClock::BBT:
                _session->tempo_map().bbt_time (pos, bbt);
-               snprintf (buf, bufsize, "%03d|%02d|%04d" , bbt.bars, bbt.beats, bbt.ticks);
+               if (onoff) {
+                       snprintf (buf, bufsize, "%03d|%02d|%04d" , bbt.bars, bbt.beats, bbt.ticks);
+               } else {
+                       snprintf (buf, bufsize, "(%03d|%02d|%04d)" , bbt.bars, bbt.beats, bbt.ticks);
+               }
                break;
 
        case AudioClock::MinSec:
@@ -710,17 +715,29 @@ EditorRegions::format_position (framepos_t pos, char* buf, size_t bufsize)
                mins = (int) floor (left / (_session->frame_rate() * 60.0f));
                left -= (framecnt_t) floor (mins * _session->frame_rate() * 60.0f);
                secs = left / (float) _session->frame_rate();
-               snprintf (buf, bufsize, "%02d:%02d:%06.3f", hrs, mins, secs);
+               if (onoff) {
+                       snprintf (buf, bufsize, "%02d:%02d:%06.3f", hrs, mins, secs);
+               } else {
+                       snprintf (buf, bufsize, "(%02d:%02d:%06.3f)", hrs, mins, secs);
+               }
                break;
 
        case AudioClock::Frames:
-               snprintf (buf, bufsize, "%" PRId64, pos);
+               if (onoff) {
+                       snprintf (buf, bufsize, "%" PRId64, pos);
+               } else {
+                       snprintf (buf, bufsize, "(%" PRId64 ")", pos);
+               }
                break;
 
        case AudioClock::Timecode:
        default:
                _session->timecode_time (pos, timecode);
-               snprintf (buf, bufsize, "%02d:%02d:%02d:%02d", timecode.hours, timecode.minutes, timecode.seconds, timecode.frames);
+               if (onoff) {
+                       snprintf (buf, bufsize, "%02d:%02d:%02d:%02d", timecode.hours, timecode.minutes, timecode.seconds, timecode.frames);
+               } else {
+                       snprintf (buf, bufsize, "(%02d:%02d:%02d:%02d)", timecode.hours, timecode.minutes, timecode.seconds, timecode.frames);
+               }
                break;
        }
 }
@@ -852,16 +869,9 @@ EditorRegions::populate_row_fade_in (boost::shared_ptr<Region> region, TreeModel
                if (used > 1) {
                        row[_columns.fadein] = _("Multiple");
                } else {
-
-                       char buf[16];
-                       format_position (audioregion->fade_in()->back()->when, buf, sizeof (buf));
+                       char buf[32];
+                       format_position (audioregion->fade_in()->back()->when, buf, sizeof (buf), audioregion->fade_in_active());
                        row[_columns.fadein] = buf;
-
-                       if (audioregion->fade_in_active()) {
-                               row[_columns.fadein] = string_compose("%1%2%3", " ", buf, " ");
-                       } else {
-                               row[_columns.fadein] = string_compose("%1%2%3", "(", buf, ")");
-                       }
                }
        }
 }
@@ -875,14 +885,9 @@ EditorRegions::populate_row_fade_out (boost::shared_ptr<Region> region, TreeMode
                if (used > 1) {
                        row[_columns.fadeout] = _("Multiple");
                } else {
-                       char buf[16];
-                       format_position (audioregion->fade_out()->back()->when, buf, sizeof (buf));
-
-                       if (audioregion->fade_out_active()) {
-                               row[_columns.fadeout] = string_compose("%1%2%3", " ", buf, " ");
-                       } else {
-                               row[_columns.fadeout] = string_compose("%1%2%3", "(", buf, ")");
-                       }
+                       char buf[32];
+                       format_position (audioregion->fade_out()->back()->when, buf, sizeof (buf), audioregion->fade_out_active());
+                       row[_columns.fadeout] = buf;
                }
        }
 }