X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=gtk2_ardour%2Fghostregion.h;h=64211669d12511bb7a7a49f45d990c1af41e1d99;hb=3cbd73de498b2136c9821030c41d6861d71c29f1;hp=b2050996a67aff9a451ad51001392b0f881d197e;hpb=aae367b63c9b619db1e40f27dc334c6987219481;p=ardour.git diff --git a/gtk2_ardour/ghostregion.h b/gtk2_ardour/ghostregion.h index b2050996a6..64211669d1 100644 --- a/gtk2_ardour/ghostregion.h +++ b/gtk2_ardour/ghostregion.h @@ -21,29 +21,25 @@ #define __ardour_gtk_ghost_region_h__ #include -#include #include "pbd/signals.h" -#include "canvas.h" - -namespace Gnome { - namespace Canvas { - class CanvasNoteEvent; - class CanvasNote; - class CanvasHit; - class Diamond; - } + +namespace ArdourCanvas { + class WaveView; } +class NoteBase; +class Note; +class Hit; class MidiStreamView; class TimeAxisView; -class GhostRegion +class GhostRegion : public sigc::trackable { public: - GhostRegion(ArdourCanvas::Group* parent, TimeAxisView& tv, TimeAxisView& source_tv, double initial_unit_pos); + GhostRegion(ArdourCanvas::Container* parent, TimeAxisView& tv, TimeAxisView& source_tv, double initial_unit_pos); virtual ~GhostRegion(); - virtual void set_samples_per_unit(double spu) = 0; + virtual void set_samples_per_pixel (double) = 0; virtual void set_height(); virtual void set_colors(); @@ -52,19 +48,21 @@ public: guint source_track_color(unsigned char alpha = 0xff); bool is_automation_ghost(); + /** TimeAxisView that is the AutomationTimeAxisView that we are on */ TimeAxisView& trackview; + /** TimeAxisView that we are a ghost for */ TimeAxisView& source_trackview; - ArdourCanvas::Group* group; - ArdourCanvas::SimpleRect* base_rect; + ArdourCanvas::Container* group; + ArdourCanvas::Rectangle* base_rect; - static PBD::Signal1 GoingAway; + static PBD::Signal1 CatchDeletion; }; class AudioGhostRegion : public GhostRegion { public: AudioGhostRegion(TimeAxisView& tv, TimeAxisView& source_tv, double initial_unit_pos); - void set_samples_per_unit(double spu); + void set_samples_per_pixel (double); void set_height(); void set_colors(); @@ -73,31 +71,13 @@ public: class MidiGhostRegion : public GhostRegion { public: - class Event : public sigc::trackable { - public: - Event(ArdourCanvas::CanvasNoteEvent*); - virtual ~Event() {} - - virtual void x_changed() = 0; - ArdourCanvas::CanvasNoteEvent* event; - }; - - class Note : public Event { - public: - Note(ArdourCanvas::CanvasNote*, ArdourCanvas::Group*); - ~Note(); - - void x_changed(); - ArdourCanvas::SimpleRect* rect; - }; - - class Hit : public Event { - public: - Hit(ArdourCanvas::CanvasHit*, ArdourCanvas::Group*); - ~Hit(); - - void x_changed(); - ArdourCanvas::Diamond* diamond; + class GhostEvent : public sigc::trackable { + public: + GhostEvent(::NoteBase *, ArdourCanvas::Container *); + virtual ~GhostEvent (); + + NoteBase* event; + ArdourCanvas::Item* item; }; MidiGhostRegion(TimeAxisView& tv, TimeAxisView& source_tv, double initial_unit_pos); @@ -107,18 +87,24 @@ public: MidiStreamView* midi_view(); void set_height(); - void set_samples_per_unit(double spu); + void set_samples_per_pixel (double spu); void set_colors(); void update_range(); - void add_note(ArdourCanvas::CanvasNote*); - void add_hit(ArdourCanvas::CanvasHit*); + void add_note(NoteBase*); + void update_note (NoteBase*); + void remove_note (NoteBase*); void clear_events(); - typedef std::list EventList; +private: + + MidiGhostRegion::GhostEvent* find_event (NoteBase*); + + typedef std::list EventList; EventList events; + EventList::iterator _optimization_iterator; }; #endif /* __ardour_gtk_ghost_region_h__ */