ardour
ghostregion.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2004 Paul Davis
3 
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.
8 
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.
13 
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.
17 
18 */
19 
20 #ifndef __ardour_gtk_ghost_region_h__
21 #define __ardour_gtk_ghost_region_h__
22 
23 #include <vector>
24 #include "pbd/signals.h"
25 
26 namespace ArdourCanvas {
27  class WaveView;
28 }
29 
30 class NoteBase;
31 class Note;
32 class Hit;
33 class MidiStreamView;
34 class TimeAxisView;
35 
36 class GhostRegion : public sigc::trackable
37 {
38 public:
39  GhostRegion(ArdourCanvas::Container* parent, TimeAxisView& tv, TimeAxisView& source_tv, double initial_unit_pos);
40  virtual ~GhostRegion();
41 
42  virtual void set_samples_per_pixel (double) = 0;
43  virtual void set_height();
44  virtual void set_colors();
45 
46  void set_duration(double units);
47 
48  guint source_track_color(unsigned char alpha = 0xff);
49  bool is_automation_ghost();
50 
55  ArdourCanvas::Container* group;
56  ArdourCanvas::Rectangle* base_rect;
57 
58  static PBD::Signal1<void,GhostRegion*> CatchDeletion;
59 };
60 
61 class AudioGhostRegion : public GhostRegion {
62 public:
63  AudioGhostRegion(TimeAxisView& tv, TimeAxisView& source_tv, double initial_unit_pos);
64 
65  void set_samples_per_pixel (double);
66  void set_height();
67  void set_colors();
68 
69  std::vector<ArdourCanvas::WaveView*> waves;
70 };
71 
72 class MidiGhostRegion : public GhostRegion {
73 public:
74  class GhostEvent : public sigc::trackable {
75  public:
76  GhostEvent(::NoteBase *, ArdourCanvas::Container *);
77  virtual ~GhostEvent ();
78 
80  ArdourCanvas::Item* item;
81  };
82 
83  MidiGhostRegion(TimeAxisView& tv, TimeAxisView& source_tv, double initial_unit_pos);
84  MidiGhostRegion(MidiStreamView& msv, TimeAxisView& source_tv, double initial_unit_pos);
86 
88 
89  void set_height();
90  void set_samples_per_pixel (double spu);
91  void set_colors();
92 
93  void update_range();
94 
95  void add_note(NoteBase*);
96  void update_note (NoteBase*);
97  void remove_note (NoteBase*);
98 
99  void clear_events();
100 
101 private:
102 
104 
105  typedef std::list<MidiGhostRegion::GhostEvent*> EventList;
106  EventList events;
107  EventList::iterator _optimization_iterator;
108 };
109 
110 #endif /* __ardour_gtk_ghost_region_h__ */
void set_duration(double units)
Definition: ghostregion.cc:77
void add_note(NoteBase *)
Definition: ghostregion.cc:307
void remove_note(NoteBase *)
Definition: ghostregion.cc:384
GhostEvent(::NoteBase *, ArdourCanvas::Container *)
Definition: ghostregion.cc:195
void set_samples_per_pixel(double spu)
Definition: ghostregion.cc:219
Definition: note.h:32
MidiGhostRegion::GhostEvent * find_event(NoteBase *)
Definition: ghostregion.cc:402
void set_samples_per_pixel(double)
Definition: ghostregion.cc:116
void update_note(NoteBase *)
Definition: ghostregion.cc:355
std::vector< ArdourCanvas::WaveView * > waves
Definition: ghostregion.h:69
guint source_track_color(unsigned char alpha=0xff)
Definition: ghostregion.cc:97
virtual ~GhostRegion()
Definition: ghostregion.cc:69
EventList events
Definition: ghostregion.h:106
TimeAxisView & source_trackview
Definition: ghostregion.h:54
Definition: hit.h:30
MidiStreamView * midi_view()
Definition: ghostregion.cc:225
ArdourCanvas::Item * item
Definition: ghostregion.h:80
std::list< MidiGhostRegion::GhostEvent * > EventList
Definition: ghostregion.h:105
TimeAxisView & trackview
Definition: ghostregion.h:52
EventList::iterator _optimization_iterator
Definition: ghostregion.h:107
virtual void set_colors()
Definition: ghostregion.cc:89
virtual void set_samples_per_pixel(double)=0
ArdourCanvas::Rectangle * base_rect
Definition: ghostregion.h:56
MidiGhostRegion(TimeAxisView &tv, TimeAxisView &source_tv, double initial_unit_pos)
Definition: ghostregion.cc:166
bool is_automation_ghost()
Definition: ghostregion.cc:104
static PBD::Signal1< void, GhostRegion * > CatchDeletion
Definition: ghostregion.h:58
virtual void set_height()
Definition: ghostregion.cc:83
ArdourCanvas::Container * group
Definition: ghostregion.h:55
AudioGhostRegion(TimeAxisView &tv, TimeAxisView &source_tv, double initial_unit_pos)
Definition: ghostregion.cc:109
GhostRegion(ArdourCanvas::Container *parent, TimeAxisView &tv, TimeAxisView &source_tv, double initial_unit_pos)
Definition: ghostregion.cc:43