new trim cursors from chrisg, fix up hotspots for said cursors, make Editor cursors...
[ardour.git] / gtk2_ardour / marker.cc
index 75a96ef5a4fce987b7bbcaff71f2a6fa840d8af6..f0f8068e8b86f19df4fb84882c3cf877f8cadebb 100644 (file)
@@ -40,6 +40,8 @@
 using namespace std;
 using namespace ARDOUR;
 
+PBD::Signal1<void,Marker*> Marker::CatchDeletion;
+
 Marker::Marker (PublicEditor& ed, ArdourCanvas::Group& parent, guint32 rgba, const string& annotation,
                Type type, nframes_t frame, bool handle_events)
 
@@ -253,29 +255,26 @@ Marker::Marker (PublicEditor& ed, ArdourCanvas::Group& parent, guint32 rgba, con
        /* setup name pixbuf sizes */
        name_font = get_font_for_style (N_("MarkerText"));
 
-       Gtk::Window win;
        Gtk::Label foo;
-       win.add (foo);
 
        Glib::RefPtr<Pango::Layout> layout = foo.create_pango_layout (X_("Hg")); /* ascender + descender */
        int width;
-       int height;
 
        layout->set_font_description (*name_font);
-       Gtkmm2ext::get_ink_pixel_size (layout, width, height);
-       name_height = height + 6;
+       Gtkmm2ext::get_ink_pixel_size (layout, width, name_height);
 
        name_pixbuf = new ArdourCanvas::Pixbuf(*group);
        name_pixbuf->property_x() = label_offset;
+       name_pixbuf->property_y() = (13/2) - (name_height/2);
 
        set_name (annotation.c_str());
 
-       editor.ZoomChanged.connect (mem_fun (*this, &Marker::reposition));
+       editor.ZoomChanged.connect (sigc::mem_fun (*this, &Marker::reposition));
 
        mark->set_data ("marker", this);
 
        if (handle_events) {
-               group->signal_event().connect (bind (mem_fun (editor, &PublicEditor::canvas_marker_event), mark, this));
+               group->signal_event().connect (sigc::bind (sigc::mem_fun (editor, &PublicEditor::canvas_marker_event), mark, this));
        }
 
        line = 0;
@@ -285,7 +284,7 @@ Marker::Marker (PublicEditor& ed, ArdourCanvas::Group& parent, guint32 rgba, con
 
 Marker::~Marker ()
 {
-       drop_references ();
+       CatchDeletion (this); /* EMIT SIGNAL */
 
        /* destroying the parent group destroys its contents, namely any polygons etc. that we added */
        delete name_pixbuf;
@@ -324,7 +323,7 @@ Marker::add_line (ArdourCanvas::Group* group, double y_origin, double initial_he
                line->property_x2() = unit_position + shift;
                line->property_y2() = y_origin + initial_height;
 
-               line->signal_event().connect (bind (mem_fun (editor, &PublicEditor::canvas_marker_event), mark, this));
+               line->signal_event().connect (sigc::bind (sigc::mem_fun (editor, &PublicEditor::canvas_marker_event), mark, this));
        }
 
        show_line ();
@@ -358,7 +357,7 @@ Marker::set_name (const string& new_name)
 {
        int name_width = pixel_width (new_name, *name_font) + 2;
 
-       name_pixbuf->property_pixbuf() = pixbuf_from_ustring(new_name, name_font, name_width, name_height);
+       name_pixbuf->property_pixbuf() = pixbuf_from_ustring(new_name, name_font, name_width, name_height, Gdk::Color ("#000000"));
 
        if (_type == End || _type == LoopEnd || _type == PunchOut) {
                name_pixbuf->property_x() = - (name_width);
@@ -413,7 +412,7 @@ TempoMarker::TempoMarker (PublicEditor& editor, ArdourCanvas::Group& parent, gui
          _tempo (temp)
 {
        set_position (_tempo.frame());
-       group->signal_event().connect (bind (mem_fun (editor, &PublicEditor::canvas_tempo_marker_event), mark, this));
+       group->signal_event().connect (sigc::bind (sigc::mem_fun (editor, &PublicEditor::canvas_tempo_marker_event), mark, this));
 }
 
 TempoMarker::~TempoMarker ()
@@ -428,7 +427,7 @@ MeterMarker::MeterMarker (PublicEditor& editor, ArdourCanvas::Group& parent, gui
          _meter (m)
 {
        set_position (_meter.frame());
-       group->signal_event().connect (bind (mem_fun (editor, &PublicEditor::canvas_meter_marker_event), mark, this));
+       group->signal_event().connect (sigc::bind (sigc::mem_fun (editor, &PublicEditor::canvas_meter_marker_event), mark, this));
 }
 
 MeterMarker::~MeterMarker ()