X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=gtk2_ardour%2Fghostregion.h;h=5c57289151b0ffdd8f4336d21535f250913fc3b1;hb=3dcb7bf3d3f4eca512c799b5f63fd412e5e3e233;hp=72658f2d530eb5f66a5b982e4a845eeb1ffe2e5c;hpb=faf4e1d8e863477a13b6c3e3c04d76fbd8011c61;p=ardour.git diff --git a/gtk2_ardour/ghostregion.h b/gtk2_ardour/ghostregion.h index 72658f2d53..5c57289151 100644 --- a/gtk2_ardour/ghostregion.h +++ b/gtk2_ardour/ghostregion.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2004 Paul Davis + Copyright (C) 2004 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -21,30 +21,33 @@ #define __ardour_gtk_ghost_region_h__ #include -#include -#include -#include -#include "canvas.h" - -namespace Gnome { - namespace Canvas { - class CanvasMidiEvent; - class CanvasNote; - class CanvasHit; - class Diamond; - } +#include +#include "pbd/signals.h" + +namespace ArdourWaveView { + class WaveView; } +class NoteBase; +class Note; +class Hit; class MidiStreamView; class TimeAxisView; +class RegionView; +class MidiRegionView; -class GhostRegion : public sigc::trackable +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_unit(double spu) = 0; + virtual void set_samples_per_pixel (double) = 0; virtual void set_height(); virtual void set_colors(); @@ -53,73 +56,83 @@ public: guint source_track_color(unsigned char alpha = 0xff); bool is_automation_ghost(); - sigc::signal GoingAway; - + 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::SimpleRect* base_rect; + ArdourCanvas::Container* group; + ArdourCanvas::Rectangle* base_rect; }; 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_unit(double spu); + void set_samples_per_pixel (double); void set_height(); void set_colors(); - std::vector waves; + std::vector waves; }; class MidiGhostRegion : public GhostRegion { public: - class Event : public sigc::trackable { + class GhostEvent : public sigc::trackable + { public: - Event(ArdourCanvas::CanvasMidiEvent*); - virtual ~Event() {} + GhostEvent(::NoteBase *, ArdourCanvas::Container *); + virtual ~GhostEvent (); - virtual void x_changed() = 0; - ArdourCanvas::CanvasMidiEvent* event; + NoteBase* event; + ArdourCanvas::Item* item; + bool is_hit; }; - class Note : public Event { - public: - Note(ArdourCanvas::CanvasNote*, ArdourCanvas::Group*); - ~Note(); - - void x_changed(); - ArdourCanvas::SimpleRect* rect; - }; + MidiGhostRegion(MidiRegionView& rv, + TimeAxisView& tv, + TimeAxisView& source_tv, + double initial_unit_pos); - class Hit : public Event { - public: - Hit(ArdourCanvas::CanvasHit*, ArdourCanvas::Group*); - ~Hit(); + MidiGhostRegion(MidiRegionView& rv, + MidiStreamView& msv, + TimeAxisView& source_tv, + double initial_unit_pos); - void x_changed(); - ArdourCanvas::Diamond* diamond; - }; - - MidiGhostRegion(TimeAxisView& tv, TimeAxisView& source_tv, double initial_unit_pos); - MidiGhostRegion(MidiStreamView& msv, TimeAxisView& source_tv, double initial_unit_pos); ~MidiGhostRegion(); 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 update_contents_height(); - void add_note(ArdourCanvas::CanvasNote*); - void add_hit(ArdourCanvas::CanvasHit*); + void add_note(NoteBase*); + void update_note (GhostEvent* note); + void update_hit (GhostEvent* hit); + void remove_note (NoteBase*); + void redisplay_model(); void clear_events(); - typedef std::list EventList; +private: + ArdourCanvas::Container* _note_group; + Gtkmm2ext::Color _outline; + ArdourCanvas::Rectangle* _tmp_rect; + ArdourCanvas::Polygon* _tmp_poly; + + MidiRegionView& parent_mrv; + typedef Evoral::Note NoteType; + MidiGhostRegion::GhostEvent* find_event (boost::shared_ptr); + + typedef boost::unordered_map, MidiGhostRegion::GhostEvent* > EventList; EventList events; + EventList::iterator _optimization_iterator; }; #endif /* __ardour_gtk_ghost_region_h__ */