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>
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.
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.
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.
25 #ifndef __ardour_gtk_ghost_region_h__
26 #define __ardour_gtk_ghost_region_h__
29 #include <boost/unordered_map.hpp>
30 #include "pbd/signals.h"
32 namespace ArdourWaveView {
44 class GhostRegion : public sigc::trackable
47 GhostRegion(RegionView& rv,
48 ArdourCanvas::Container* parent,
50 TimeAxisView& source_tv,
51 double initial_unit_pos);
53 virtual ~GhostRegion();
55 virtual void set_samples_per_pixel (double) = 0;
56 virtual void set_height();
57 virtual void set_colors();
59 void set_duration(double units);
61 guint source_track_color(unsigned char alpha = 0xff);
62 bool is_automation_ghost();
64 RegionView& parent_rv;
65 /** TimeAxisView that is the AutomationTimeAxisView that we are on */
66 TimeAxisView& trackview;
67 /** TimeAxisView that we are a ghost for */
68 TimeAxisView& source_trackview;
69 ArdourCanvas::Container* group;
70 ArdourCanvas::Rectangle* base_rect;
73 class AudioGhostRegion : public GhostRegion {
75 AudioGhostRegion(RegionView& rv,
77 TimeAxisView& source_tv,
78 double initial_unit_pos);
80 void set_samples_per_pixel (double);
84 std::vector<ArdourWaveView::WaveView*> waves;
87 class MidiGhostRegion : public GhostRegion {
89 class GhostEvent : public sigc::trackable
92 GhostEvent(::NoteBase *, ArdourCanvas::Container *);
93 virtual ~GhostEvent ();
96 ArdourCanvas::Item* item;
100 MidiGhostRegion(MidiRegionView& rv,
102 TimeAxisView& source_tv,
103 double initial_unit_pos);
105 MidiGhostRegion(MidiRegionView& rv,
107 TimeAxisView& source_tv,
108 double initial_unit_pos);
112 MidiStreamView* midi_view();
115 void set_samples_per_pixel (double spu);
118 void update_contents_height();
120 void add_note(NoteBase*);
121 void update_note (GhostEvent* note);
122 void update_hit (GhostEvent* hit);
123 void remove_note (NoteBase*);
125 void redisplay_model();
129 ArdourCanvas::Container* _note_group;
130 Gtkmm2ext::Color _outline;
131 ArdourCanvas::Rectangle* _tmp_rect;
132 ArdourCanvas::Polygon* _tmp_poly;
134 MidiRegionView& parent_mrv;
135 typedef Evoral::Note<Temporal::Beats> NoteType;
136 MidiGhostRegion::GhostEvent* find_event (boost::shared_ptr<NoteType>);
138 typedef boost::unordered_map<boost::shared_ptr<NoteType>, MidiGhostRegion::GhostEvent* > EventList;
140 EventList::iterator _optimization_iterator;
143 #endif /* __ardour_gtk_ghost_region_h__ */