X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=gtk2_ardour%2Fmarker.cc;h=505e577c4288d5ae8356efebd1de462400ee4db4;hb=79ba9960964c8ea701abfe00dbef128ca7da9fbd;hp=4065ad978be5a00ed61b61034fb34368ec81ba8f;hpb=291a186cba343ed705c60d15fa7db0b21eb8a1fd;p=ardour.git diff --git a/gtk2_ardour/marker.cc b/gtk2_ardour/marker.cc index 4065ad978b..505e577c42 100644 --- a/gtk2_ardour/marker.cc +++ b/gtk2_ardour/marker.cc @@ -250,9 +250,9 @@ Marker::Marker (PublicEditor& ed, ArdourCanvas::Group& parent, guint32 rgba, con delete font; if (annotate_left) { - text->property_x() = -(text->property_text_width()); + text->property_x() = -(text->property_text_width()); } else { - text->property_x() = label_offset; + text->property_x() = label_offset; } text->property_y() = 0.0; text->property_anchor() = Gtk::ANCHOR_NW; @@ -266,14 +266,59 @@ Marker::Marker (PublicEditor& ed, ArdourCanvas::Group& parent, guint32 rgba, con group->signal_event().connect (bind (mem_fun (editor, &PublicEditor::canvas_marker_event), mark, this)); } + line = 0; + line_points = 0; + } Marker::~Marker () { + drop_references (); + /* destroying the parent group destroys its contents, namely any polygons etc. that we added */ delete text; delete mark; delete points; + + if (line) { + delete line; + delete line_points; + } +} + +void +Marker::add_line (ArdourCanvas::Group* group, double initial_height) +{ + if (!line) { + + line_points = new ArdourCanvas::Points (); + line_points->push_back (Gnome::Art::Point (unit_position + shift, 0.0)); + line_points->push_back (Gnome::Art::Point (unit_position + shift, initial_height)); + + line = new ArdourCanvas::Line (*group); + line->property_width_pixels() = 1; + line->property_points() = *line_points; + line->property_fill_color_rgba() = ARDOUR_UI::config()->canvasvar_EditPoint.get(); + } + + show_line (); +} + +void +Marker::show_line () +{ + if (line) { + line->raise_to_top(); + line->show (); + } +} + +void +Marker::hide_line () +{ + if (line) { + line->hide (); + } } ArdourCanvas::Item& @@ -299,6 +344,12 @@ Marker::set_position (nframes_t frame) group->move (new_unit_position - unit_position, 0.0); frame_position = frame; unit_position = new_unit_position; + + if (line) { + (*line_points)[0].set_x (unit_position + shift); + (*line_points)[1].set_x (unit_position + shift); + line->property_points() = *line_points; + } } void