+Marker::setup_line ()
+{
+ if (_shown && (_selected || _line_shown)) {
+
+ if (_line == 0) {
+
+ _line = new ArdourCanvas::SimpleLine (*group);
+ _line->property_color_rgba() = ARDOUR_UI::config()->canvasvar_EditPoint.get();
+
+ _line->signal_event().connect (sigc::bind (sigc::mem_fun (editor, &PublicEditor::canvas_marker_event), mark, this));
+ }
+
+ /* work out where to start the line from so that it extends from the top of the canvas */
+ double yo = 0;
+ double xo = 0;
+
+ _line->i2w (xo, yo);
+
+ _line->property_x1() = _shift;
+ _line->property_x2() = _shift;
+ _line->property_y1() = -yo; // zero in world coordinates, negative in item/parent coordinate space
+ _line->property_y2() = -yo + _canvas_height;
+
+ _line->property_color_rgba() = _selected ? ARDOUR_UI::config()->canvasvar_EditPoint.get() : _color;
+ _line->raise_to_top ();
+ _line->show ();
+
+ } else {
+ if (_line) {
+ _line->hide ();
+ }
+ }
+}
+
+void
+Marker::canvas_height_set (double h)
+{
+ _canvas_height = h;
+ setup_line ();
+}
+
+ArdourCanvas::Item&
+Marker::the_item() const
+{
+ return *mark;
+}
+
+void
+Marker::set_name (const string& new_name)
+{
+ _name = new_name;
+
+ setup_name_display ();
+}
+
+/** @return true if our label is on the left of the mark, otherwise false */
+bool
+Marker::label_on_left () const
+{
+ return (_type == SessionEnd || _type == RangeEnd || _type == LoopEnd || _type == PunchOut);
+}
+
+void
+Marker::setup_name_display ()
+{
+ double limit = DBL_MAX;
+
+ if (label_on_left ()) {
+ limit = _left_label_limit;
+ } else {
+ limit = _right_label_limit;
+ }
+
+ /* Work out how wide the name can be */
+ int name_width = min ((double) pixel_width (_name, name_font) + 2, limit);
+ if (name_width == 0) {
+ name_width = 1;
+ }
+
+ if (label_on_left ()) {
+ name_pixbuf->property_x() = -name_width;
+ }
+
+ name_pixbuf->property_pixbuf() = pixbuf_from_string (_name, name_font, name_width, name_height, Gdk::Color ("#000000"));
+
+ if (label_on_left ()) {
+ _name_background->property_x1() = name_pixbuf->property_x() - 2;
+ _name_background->property_x2() = name_pixbuf->property_x() + name_width + _shift;
+ } else {
+ _name_background->property_x1() = name_pixbuf->property_x() - _label_offset + 2;
+ _name_background->property_x2() = name_pixbuf->property_x() + name_width;
+ }
+
+ _name_background->property_y1() = 0;
+ _name_background->property_y2() = 13;
+}
+
+void
+Marker::set_position (framepos_t frame)