summaryrefslogtreecommitdiff
path: root/gtk2_ardour/time_axis_view.cc
diff options
context:
space:
mode:
authorRobin Gareus <robin@gareus.org>2019-04-18 16:46:44 +0200
committerRobin Gareus <robin@gareus.org>2019-04-18 16:46:44 +0200
commitc28522942301b7ede38871d00e4d75bf22fbc545 (patch)
tree53379a00dddc91fc29a7b5c9702aea317253f6ab /gtk2_ardour/time_axis_view.cc
parent0a9674ec6b1c026180fb3a1f917347a2429475af (diff)
Follow up f5bc64d00e - add gap to range-selection rect as well
Diffstat (limited to 'gtk2_ardour/time_axis_view.cc')
-rw-r--r--gtk2_ardour/time_axis_view.cc30
1 files changed, 29 insertions, 1 deletions
diff --git a/gtk2_ardour/time_axis_view.cc b/gtk2_ardour/time_axis_view.cc
index c5197b7610..50160855f0 100644
--- a/gtk2_ardour/time_axis_view.cc
+++ b/gtk2_ardour/time_axis_view.cc
@@ -46,6 +46,7 @@
#include "widgets/tooltips.h"
#include "ardour_dialog.h"
+#include "audio_time_axis.h"
#include "floating_text_entry.h"
#include "gui_thread.h"
#include "public_editor.h"
@@ -221,6 +222,7 @@ TimeAxisView::TimeAxisView (ARDOUR::Session* sess, PublicEditor& ed, TimeAxisVie
top_hbox.pack_start (scroomer_placeholder, false, false); // OR pack_end to move after meters ?
UIConfiguration::instance().ColorsChanged.connect (sigc::mem_fun (*this, &TimeAxisView::color_handler));
+ UIConfiguration::instance().ParameterChanged.connect (sigc::mem_fun (*this, &TimeAxisView::parameter_changed));
}
TimeAxisView::~TimeAxisView()
@@ -580,7 +582,9 @@ TimeAxisView::set_height (uint32_t h, TrackHeightMode m)
uint32_t lanes = 0;
if (m == TotalHeight) {
for (Children::iterator i = children.begin(); i != children.end(); ++i) {
- if ( !(*i)->hidden()) ++lanes;
+ if (!(*i)->hidden()) {
+ ++lanes;
+ }
}
}
h /= (lanes + 1);
@@ -844,6 +848,12 @@ TimeAxisView::show_selection (TimeSelection& ts)
selection_group->show();
selection_group->raise_to_top();
+ uint32_t gap = UIConfiguration::instance().get_vertical_region_gap ();
+ float ui_scale = UIConfiguration::instance().get_ui_scale ();
+ if (gap > 0 && ui_scale > 0) {
+ gap = ceil (gap * ui_scale);
+ }
+
for (list<AudioRange>::iterator i = ts.begin(); i != ts.end(); ++i) {
samplepos_t start, end;
samplecnt_t cnt;
@@ -858,6 +868,14 @@ TimeAxisView::show_selection (TimeSelection& ts)
x2 = _editor.sample_to_pixel (start + cnt - 1);
y2 = current_height() - 1;
+ if (dynamic_cast<AudioTimeAxisView*>(this)) {
+ if (y2 > gap) {
+ y2 -= gap;
+ } else {
+ y2 = 1;
+ }
+ }
+
rect->rect->set (ArdourCanvas::Rect (x1, 0, x2, y2));
// trim boxes are at the top for selections
@@ -1173,6 +1191,16 @@ TimeAxisView::color_handler ()
}
}
+void
+TimeAxisView::parameter_changed (string const & p)
+{
+ if (p == "vertical-region-gap") {
+ if (selected ()) {
+ show_selection (_editor.get_selection().time);
+ }
+ }
+}
+
/** @return Pair: TimeAxisView, layer index.
* TimeAxisView is non-0 if this object covers @param y, or one of its children
* does. @param y is an offset from the top of the trackview area.