Ardour  9.0-pre0-582-g084a23a80d
ghostregion.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2005-2017 Paul Davis <paul@linuxaudiosystems.com>
3  * Copyright (C) 2005 Taybin Rutkin <taybin@taybin.com>
4  * Copyright (C) 2006-2015 Tim Mayberry <mojofunk@gmail.com>
5  * Copyright (C) 2008-2014 David Robillard <d@drobilla.net>
6  * Copyright (C) 2009-2011 Carl Hetherington <carl@carlh.net>
7  * Copyright (C) 2015-2017 Robin Gareus <robin@gareus.org>
8  * Copyright (C) 2016-2017 Nick Mainsbridge <mainsbridge@gmail.com>
9  *
10  * This program is free software; you can redistribute it and/or modify
11  * it under the terms of the GNU General Public License as published by
12  * the Free Software Foundation; either version 2 of the License, or
13  * (at your option) any later version.
14  *
15  * This program is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18  * GNU General Public License for more details.
19  *
20  * You should have received a copy of the GNU General Public License along
21  * with this program; if not, write to the Free Software Foundation, Inc.,
22  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
23  */
24 
25 #pragma once
26 
27 #include <vector>
28 
29 #include "evoral/Note.h"
30 #include "pbd/signals.h"
31 
32 #include "gtkmm2ext/colors.h"
33 
34 #include "ghost_event.h"
35 
36 namespace ArdourWaveView {
37  class WaveView;
38 }
39 
40 namespace ArdourCanvas {
41  class Container;
42  class Rectangle;
43  class Item;
44  class Polygon;
45 }
46 
47 class NoteBase;
48 class Note;
49 class Hit;
50 class MidiStreamView;
51 class TimeAxisView;
52 class RegionView;
53 class MidiRegionView;
54 
55 class GhostRegion : virtual public sigc::trackable
56 {
57 public:
60  TimeAxisView& tv,
61  TimeAxisView& source_tv,
62  double initial_unit_pos);
63 
64  virtual ~GhostRegion();
65 
66  virtual void set_samples_per_pixel (double) = 0;
67  virtual void set_height();
68  virtual void set_colors();
69 
70  void set_duration(double units);
71 
72  virtual void set_selected (bool) {}
73 
74  guint source_track_color(unsigned char alpha = 0xff);
76 
84 };
85 
86 class AudioGhostRegion : public GhostRegion {
87 public:
89  TimeAxisView& tv,
90  TimeAxisView& source_tv,
91  double initial_unit_pos);
92 
93  void set_samples_per_pixel (double);
94  void set_height();
95  void set_colors();
96 
97  std::vector<ArdourWaveView::WaveView*> waves;
98 };
99 
100 class MidiGhostRegion : public GhostRegion {
101 public:
103  TimeAxisView& tv,
104  TimeAxisView& source_tv,
105  double initial_unit_pos);
106 
109 
110  void set_height();
111  void set_samples_per_pixel (double spu);
112  void set_colors();
113 
114  virtual void update_contents_height();
115 
116  virtual void add_note(NoteBase*);
117  virtual void update_note (GhostEvent* note);
118  virtual void update_hit (GhostEvent* hit);
119  virtual void remove_note (NoteBase*);
120  virtual void note_selected (NoteBase*) {}
121 
123  void view_changed();
124  void clear_events();
125 
126  protected:
131 
133  GhostEvent* find_event (std::shared_ptr<GhostEvent::NoteType>);
134 
136 };
137 
std::vector< ArdourWaveView::WaveView * > waves
Definition: ghostregion.h:97
AudioGhostRegion(RegionView &rv, TimeAxisView &tv, TimeAxisView &source_tv, double initial_unit_pos)
void set_samples_per_pixel(double)
std::unordered_map< std::shared_ptr< NoteType >, GhostEvent * > EventList
Definition: ghost_event.h:32
TimeAxisView & source_trackview
Definition: ghostregion.h:81
guint source_track_color(unsigned char alpha=0xff)
virtual void set_height()
void set_duration(double units)
virtual void set_selected(bool)
Definition: ghostregion.h:72
GhostRegion(RegionView &rv, ArdourCanvas::Container *parent, TimeAxisView &tv, TimeAxisView &source_tv, double initial_unit_pos)
ArdourCanvas::Container * group
Definition: ghostregion.h:82
virtual ~GhostRegion()
ArdourCanvas::Rectangle * base_rect
Definition: ghostregion.h:83
virtual void set_samples_per_pixel(double)=0
virtual void set_colors()
bool is_automation_ghost()
TimeAxisView & trackview
Definition: ghostregion.h:79
RegionView & parent_rv
Definition: ghostregion.h:77
Definition: hit.h:30
ArdourCanvas::Rectangle * _tmp_rect
Definition: ghostregion.h:129
virtual void update_hit(GhostEvent *hit)
virtual void note_selected(NoteBase *)
Definition: ghostregion.h:120
virtual void update_contents_height()
ArdourCanvas::Polygon * _tmp_poly
Definition: ghostregion.h:130
ArdourCanvas::Container * _note_group
Definition: ghostregion.h:127
virtual void update_note(GhostEvent *note)
Gtkmm2ext::Color _outline
Definition: ghostregion.h:128
GhostEvent::EventList events
Definition: ghostregion.h:135
virtual void add_note(NoteBase *)
GhostEvent * find_event(std::shared_ptr< GhostEvent::NoteType >)
MidiGhostRegion(MidiRegionView &rv, TimeAxisView &tv, TimeAxisView &source_tv, double initial_unit_pos)
MidiRegionView & parent_mrv
Definition: ghostregion.h:132
void set_samples_per_pixel(double spu)
MidiStreamView * midi_view()
virtual void remove_note(NoteBase *)
void model_changed()
uint32_t Color
Definition: colors.h:33
DebugBits WaveView