X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=gtk2_ardour%2Fcanvas-hit.cc;h=f00e1134628a6524f5c5c393316f8137bed74ae7;hb=6e0330a304e06311502f82ac1ebc969121695aa5;hp=c9908ac60c4577cb500aad6de064e11454a28570;hpb=2d81a5636dcf5532769a1bf4ddaafb2fa91b990a;p=ardour.git diff --git a/gtk2_ardour/canvas-hit.cc b/gtk2_ardour/canvas-hit.cc index c9908ac60c..f00e113462 100644 --- a/gtk2_ardour/canvas-hit.cc +++ b/gtk2_ardour/canvas-hit.cc @@ -9,52 +9,32 @@ using namespace ARDOUR; namespace Gnome { namespace Canvas { +CanvasHit::CanvasHit (MidiRegionView& region, + Group& group, + double size, + const boost::shared_ptr note, + bool with_events) + : Diamond(group, size) + , CanvasNoteEvent(region, this, note) +{ + if (with_events) { + signal_event().connect (sigc::mem_fun (*this, &CanvasHit::on_event)); + } +} + bool CanvasHit::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_time_axis_view().editor().canvas_note_event (ev, this); + } + return true; } -void +void CanvasHit::move_event(double dx, double dy) { - move (dx, dy); - -#if 0 - cerr << "Move event by " << dx << " " << dy << endl; - - points->coords[0] += dx; - points->coords[1] += dy; - - points->coords[2] += dx; - points->coords[3] += dy; - - points->coords[4] += dx; - points->coords[5] += dy; - - points->coords[6] += dx; - points->coords[7] += dy; - - cerr << "Coords now " << endl - << '\t' << points->coords[0] << ", " << points->coords[1] << endl - << '\t' << points->coords[2] << ", " << points->coords[3] << endl - << '\t' << points->coords[4] << ", " << points->coords[5] << endl - << '\t' << points->coords[6] << ", " << points->coords[7] << endl - ; - - if (_text) { - _text->property_x() = _text->property_x() + dx; - _text->property_y() = _text->property_y() + dy; - } - - hide (); - show (); - // request_update (); -#endif + move_by (dx, dy); } } // namespace Gnome