fix up file renaming code a little bit
[ArdourMidi.git] / gtk2_ardour / ghostregion.h
blob3939c46a4b897f3e4e8b0dd0029128d0454747fd
1 /*
2 Copyright (C) 2004 Paul Davis
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 2 of the License, or
7 (at your option) any later version.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20 #ifndef __ardour_gtk_ghost_region_h__
21 #define __ardour_gtk_ghost_region_h__
23 #include <vector>
24 #include <libgnomecanvasmm.h>
25 #include "pbd/signals.h"
26 #include "canvas.h"
28 namespace Gnome {
29 namespace Canvas {
30 class CanvasNoteEvent;
31 class CanvasNote;
32 class CanvasHit;
33 class Diamond;
37 class MidiStreamView;
38 class TimeAxisView;
40 class GhostRegion
42 public:
43 GhostRegion(ArdourCanvas::Group* parent, TimeAxisView& tv, TimeAxisView& source_tv, double initial_unit_pos);
44 virtual ~GhostRegion();
46 virtual void set_samples_per_unit(double spu) = 0;
47 virtual void set_height();
48 virtual void set_colors();
50 void set_duration(double units);
52 guint source_track_color(unsigned char alpha = 0xff);
53 bool is_automation_ghost();
55 TimeAxisView& trackview;
56 TimeAxisView& source_trackview;
57 ArdourCanvas::Group* group;
58 ArdourCanvas::SimpleRect* base_rect;
60 static PBD::Signal1<void,GhostRegion*> CatchDeletion;
63 class AudioGhostRegion : public GhostRegion {
64 public:
65 AudioGhostRegion(TimeAxisView& tv, TimeAxisView& source_tv, double initial_unit_pos);
67 void set_samples_per_unit(double spu);
68 void set_height();
69 void set_colors();
71 std::vector<ArdourCanvas::WaveView*> waves;
74 class MidiGhostRegion : public GhostRegion {
75 public:
76 class Event : public sigc::trackable {
77 public:
78 Event(ArdourCanvas::CanvasNoteEvent*);
79 virtual ~Event() {}
81 virtual void x_changed() = 0;
82 ArdourCanvas::CanvasNoteEvent* event;
85 class Note : public Event {
86 public:
87 Note(ArdourCanvas::CanvasNote*, ArdourCanvas::Group*);
88 ~Note();
90 void x_changed();
91 ArdourCanvas::SimpleRect* rect;
94 class Hit : public Event {
95 public:
96 Hit(ArdourCanvas::CanvasHit*, ArdourCanvas::Group*);
97 ~Hit();
99 void x_changed();
100 ArdourCanvas::Diamond* diamond;
103 MidiGhostRegion(TimeAxisView& tv, TimeAxisView& source_tv, double initial_unit_pos);
104 MidiGhostRegion(MidiStreamView& msv, TimeAxisView& source_tv, double initial_unit_pos);
105 ~MidiGhostRegion();
107 MidiStreamView* midi_view();
109 void set_height();
110 void set_samples_per_unit(double spu);
111 void set_colors();
113 void update_range();
115 void add_note(ArdourCanvas::CanvasNote*);
116 void add_hit(ArdourCanvas::CanvasHit*);
118 void clear_events();
120 typedef std::list<MidiGhostRegion::Event*> EventList;
121 EventList events;
124 #endif /* __ardour_gtk_ghost_region_h__ */