add line height API to Marker

This will allow region markers, which do not span the whole canvas height, to have a line
This commit is contained in:
Paul Davis 2021-05-14 17:14:52 -06:00
parent 1685843082
commit 3c1ffd1743
2 changed files with 11 additions and 1 deletions

View file

@ -85,6 +85,7 @@ ArdourMarker::ArdourMarker (PublicEditor& ed, ArdourCanvas::Container& parent, g
, _left_label_limit (DBL_MAX) , _left_label_limit (DBL_MAX)
, _right_label_limit (DBL_MAX) , _right_label_limit (DBL_MAX)
, _label_offset (0) , _label_offset (0)
, _line_height (-1)
{ {
@ -374,7 +375,7 @@ ArdourMarker::setup_line ()
_track_canvas_line->set_x0 (d.x); _track_canvas_line->set_x0 (d.x);
_track_canvas_line->set_x1 (d.x); _track_canvas_line->set_x1 (d.x);
_track_canvas_line->set_y0 (d.y); _track_canvas_line->set_y0 (d.y);
_track_canvas_line->set_y1 (ArdourCanvas::COORD_MAX); _track_canvas_line->set_y1 (_line_height > 0 ? _line_height : ArdourCanvas::COORD_MAX);
_track_canvas_line->set_outline_color ( _selected ? UIConfiguration::instance().color ("entered marker") : _color ); _track_canvas_line->set_outline_color ( _selected ? UIConfiguration::instance().color ("entered marker") : _color );
_track_canvas_line->raise_to_top (); _track_canvas_line->raise_to_top ();
_track_canvas_line->show (); _track_canvas_line->show ();
@ -392,6 +393,13 @@ ArdourMarker::the_item() const
return *group; return *group;
} }
void
ArdourMarker::set_line_height (double h)
{
_line_height = h;
setup_line ();
}
void void
ArdourMarker::set_name (const string& new_name) ArdourMarker::set_name (const string& new_name)
{ {

View file

@ -78,6 +78,7 @@ public:
void set_selected (bool); void set_selected (bool);
void set_show_line (bool); void set_show_line (bool);
void set_line_height (double);
void set_position (samplepos_t); void set_position (samplepos_t);
void set_name (const std::string&); void set_name (const std::string&);
@ -131,6 +132,7 @@ protected:
double _left_label_limit; ///< the number of pixels available to the left of this marker for a label double _left_label_limit; ///< the number of pixels available to the left of this marker for a label
double _right_label_limit; ///< the number of pixels available to the right of this marker for a label double _right_label_limit; ///< the number of pixels available to the right of this marker for a label
double _label_offset; double _label_offset;
double _line_height;
void reposition (); void reposition ();
void setup_line_x (); void setup_line_x ();