Use uint32_t type instead of uint
[ardour.git] / gtk2_ardour / ghostregion.h
index 885edfde595d4670899e709fc667124c3a76e11e..083f71b3e28c3f4c97572214d30726fc880abd96 100644 (file)
@@ -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,9 +21,8 @@
 #define __ardour_gtk_ghost_region_h__
 
 #include <vector>
-#include <sigc++/signal.h>
 #include <libgnomecanvasmm.h>
-#include <ardour/configuration.h>
+#include "pbd/signals.h"
 #include "canvas.h"
 
 namespace Gnome {
@@ -38,7 +37,7 @@ namespace Gnome {
 class MidiStreamView;
 class TimeAxisView;
 
-class GhostRegion : public sigc::trackable 
+class GhostRegion : public sigc::trackable
 {
 public:
        GhostRegion(ArdourCanvas::Group* parent, TimeAxisView& tv, TimeAxisView& source_tv, double initial_unit_pos);
@@ -53,12 +52,14 @@ public:
        guint source_track_color(unsigned char alpha = 0xff);
        bool is_automation_ghost();
 
-       sigc::signal<void,GhostRegion*> GoingAway;
-
+       /** 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;
+
+       static PBD::Signal1<void,GhostRegion*> CatchDeletion;
 };
 
 class AudioGhostRegion : public GhostRegion {
@@ -76,31 +77,13 @@ class MidiGhostRegion : public GhostRegion {
 public:
        class Event : public sigc::trackable {
        public:
-               Event(ArdourCanvas::CanvasNoteEvent*);
-               virtual ~Event() {}
+               Event(ArdourCanvas::CanvasNoteEvent *, ArdourCanvas::Group *);
+               ~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;
-       };
-       
        MidiGhostRegion(TimeAxisView& tv, TimeAxisView& source_tv, double initial_unit_pos);
        MidiGhostRegion(MidiStreamView& msv, TimeAxisView& source_tv, double initial_unit_pos);
        ~MidiGhostRegion();
@@ -114,12 +97,18 @@ public:
        void update_range();
 
        void add_note(ArdourCanvas::CanvasNote*);
-       void add_hit(ArdourCanvas::CanvasHit*);
+       void update_note (ArdourCanvas::CanvasNote *);
+       void remove_note (ArdourCanvas::CanvasNoteEvent *);
 
        void clear_events();
 
+private:
+
+       MidiGhostRegion::Event* find_event (ArdourCanvas::CanvasNoteEvent *);
+
        typedef std::list<MidiGhostRegion::Event*> EventList;
        EventList events;
+       EventList::iterator _optimization_iterator;
 };
 
 #endif /* __ardour_gtk_ghost_region_h__ */