From c28522942301b7ede38871d00e4d75bf22fbc545 Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Thu, 18 Apr 2019 16:46:44 +0200 Subject: Follow up f5bc64d00e - add gap to range-selection rect as well --- gtk2_ardour/automation_controller.h | 3 ++- gtk2_ardour/time_axis_view.cc | 30 +++++++++++++++++++++++++++++- gtk2_ardour/time_axis_view.h | 1 + 3 files changed, 32 insertions(+), 2 deletions(-) (limited to 'gtk2_ardour') diff --git a/gtk2_ardour/automation_controller.h b/gtk2_ardour/automation_controller.h index ac87ee300f..3d767a6aa5 100644 --- a/gtk2_ardour/automation_controller.h +++ b/gtk2_ardour/automation_controller.h @@ -33,7 +33,8 @@ #include #include "pbd/signals.h" -#include "evoral/Parameter.hpp" +#include "ardour/parameter_descriptor.h" + #include "widgets/barcontroller.h" namespace ARDOUR { 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::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(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. diff --git a/gtk2_ardour/time_axis_view.h b/gtk2_ardour/time_axis_view.h index a6055c8634..0a6444022d 100644 --- a/gtk2_ardour/time_axis_view.h +++ b/gtk2_ardour/time_axis_view.h @@ -304,6 +304,7 @@ protected: virtual void selection_click (GdkEventButton*); void color_handler (); + void parameter_changed (std::string const &); void conditionally_add_to_selection (); -- cgit v1.2.3