X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=gtk2_ardour%2Fghostregion.h;h=1b2fb700c18e046221df0cfbccda93aa79d9c70c;hb=54fd56de755a44420d906ad660b18c2d671f1057;hp=e8271a8ad8aa6e947b69c16518198a89a51caf70;hpb=b05968fb4e303ce47b6e09cd1bc713f3af28a6f9;p=ardour.git diff --git a/gtk2_ardour/ghostregion.h b/gtk2_ardour/ghostregion.h index e8271a8ad8..1b2fb700c1 100644 --- a/gtk2_ardour/ghostregion.h +++ b/gtk2_ardour/ghostregion.h @@ -21,6 +21,7 @@ #define __ardour_gtk_ghost_region_h__ #include +#include #include "pbd/signals.h" namespace ArdourCanvas { @@ -32,11 +33,18 @@ class Note; class Hit; class MidiStreamView; class TimeAxisView; +class RegionView; +class MidiRegionView; class GhostRegion : public sigc::trackable { public: - GhostRegion(ArdourCanvas::Group* parent, TimeAxisView& tv, TimeAxisView& source_tv, double initial_unit_pos); + GhostRegion(RegionView& rv, + ArdourCanvas::Container* parent, + TimeAxisView& tv, + TimeAxisView& source_tv, + double initial_unit_pos); + virtual ~GhostRegion(); virtual void set_samples_per_pixel (double) = 0; @@ -48,19 +56,21 @@ public: guint source_track_color(unsigned char alpha = 0xff); bool is_automation_ghost(); + RegionView& parent_rv; /** 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::Container* group; ArdourCanvas::Rectangle* base_rect; - - static PBD::Signal1 CatchDeletion; }; class AudioGhostRegion : public GhostRegion { public: - AudioGhostRegion(TimeAxisView& tv, TimeAxisView& source_tv, double initial_unit_pos); + AudioGhostRegion(RegionView& rv, + TimeAxisView& tv, + TimeAxisView& source_tv, + double initial_unit_pos); void set_samples_per_pixel (double); void set_height(); @@ -73,15 +83,24 @@ class MidiGhostRegion : public GhostRegion { public: class GhostEvent : public sigc::trackable { public: - GhostEvent(::NoteBase *, ArdourCanvas::Group *); + GhostEvent(::NoteBase *, ArdourCanvas::Container *); virtual ~GhostEvent (); - + NoteBase* event; - ArdourCanvas::Rectangle* rect; + ArdourCanvas::Item* item; + bool is_hit; }; - MidiGhostRegion(TimeAxisView& tv, TimeAxisView& source_tv, double initial_unit_pos); - MidiGhostRegion(MidiStreamView& msv, TimeAxisView& source_tv, double initial_unit_pos); + MidiGhostRegion(MidiRegionView& rv, + TimeAxisView& tv, + TimeAxisView& source_tv, + double initial_unit_pos); + + MidiGhostRegion(MidiRegionView& rv, + MidiStreamView& msv, + TimeAxisView& source_tv, + double initial_unit_pos); + ~MidiGhostRegion(); MidiStreamView* midi_view(); @@ -90,19 +109,27 @@ public: void set_samples_per_pixel (double spu); void set_colors(); - void update_range(); + void update_contents_height(); void add_note(NoteBase*); - void update_note (NoteBase*); + void update_note (GhostEvent* note); + void update_hit (GhostEvent* hit); void remove_note (NoteBase*); + void redisplay_model(); void clear_events(); private: + ArdourCanvas::Container* _note_group; + ArdourCanvas::Color _outline; + ArdourCanvas::Rectangle* _tmp_rect; + ArdourCanvas::Polygon* _tmp_poly; - MidiGhostRegion::GhostEvent* find_event (NoteBase*); + MidiRegionView& parent_mrv; + typedef Evoral::Note NoteType; + MidiGhostRegion::GhostEvent* find_event (boost::shared_ptr); - typedef std::list EventList; + typedef boost::unordered_map, MidiGhostRegion::GhostEvent* > EventList; EventList events; EventList::iterator _optimization_iterator; };