Follow up f5bc64d00e - add gap to range-selection rect as well

This commit is contained in:
Robin Gareus 2019-04-18 16:46:44 +02:00
parent 0a9674ec6b
commit c285229423
Signed by: rgareus
GPG Key ID: A090BCE02CF57F04
3 changed files with 32 additions and 2 deletions

View File

@ -33,7 +33,8 @@
#include <gtkmm/alignment.h>
#include "pbd/signals.h"
#include "evoral/Parameter.hpp"
#include "ardour/parameter_descriptor.h"
#include "widgets/barcontroller.h"
namespace ARDOUR {

View File

@ -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.

View File

@ -304,6 +304,7 @@ protected:
virtual void selection_click (GdkEventButton*);
void color_handler ();
void parameter_changed (std::string const &);
void conditionally_add_to_selection ();