X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=gtk2_ardour%2Fcanvas-note.cc;h=35f7ace581f09e357aae3455acf654bb503e2244;hb=da67628bcf19c47d6531e212e8a650d82b1abd4c;hp=b43514edcc82d5383bba0a5303e614b00714a2bc;hpb=1bf79fa88502a156a71cd3d2de35aa234950c40c;p=ardour.git diff --git a/gtk2_ardour/canvas-note.cc b/gtk2_ardour/canvas-note.cc index b43514edcc..35f7ace581 100644 --- a/gtk2_ardour/canvas-note.cc +++ b/gtk2_ardour/canvas-note.cc @@ -8,15 +8,43 @@ using namespace ARDOUR; namespace Gnome { namespace Canvas { +CanvasNote::CanvasNote (MidiRegionView& region, + Group& group, + const boost::shared_ptr note, + bool with_events) + : SimpleRect(group), CanvasNoteEvent(region, this, note) +{ + if (with_events) { + signal_event().connect (sigc::mem_fun (*this, &CanvasNote::on_event)); + } +} + bool CanvasNote::on_event(GdkEvent* ev) { - if (!_region.get_trackview().editor().canvas_note_event (ev, this)) { - return CanvasNoteEvent::on_event (ev); - } else { - return true; + if (!CanvasNoteEvent::on_event (ev)) { + return _region.get_trackview().editor().canvas_note_event (ev, this); + } + + return true; +} + +void +CanvasNote::move_event(double dx, double dy) +{ + property_x1() = property_x1() + dx; + property_y1() = property_y1() + dy; + property_x2() = property_x2() + dx; + property_y2() = property_y2() + dy; + + if (_text) { + _text->hide(); + _text->property_x() = _text->property_x() + dx; + _text->property_y() = _text->property_y() + dy; + _text->show(); } } + } // namespace Gnome } // namespace Canvas