2 Copyright (C) 2001-2006 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.
25 #include <gtkmm2ext/gtk_ui.h>
27 #include <ardour/playlist.h>
28 #include <ardour/midi_region.h>
29 #include <ardour/midi_source.h>
30 #include <ardour/midi_diskstream.h>
32 #include "streamview.h"
33 #include "midi_region_view.h"
34 #include "midi_time_axis.h"
35 #include "simplerect.h"
36 #include "simpleline.h"
37 #include "public_editor.h"
38 //#include "midi_region_editor.h"
39 #include "ghostregion.h"
40 #include "midi_time_axis.h"
42 #include "rgb_macros.h"
43 #include "gui_thread.h"
48 using namespace ARDOUR;
50 using namespace Editing;
51 using namespace ArdourCanvas;
53 MidiRegionView::MidiRegionView (ArdourCanvas::Group *parent, RouteTimeAxisView &tv, boost::shared_ptr<MidiRegion> r, double spu,
54 Gdk::Color& basic_color)
55 : RegionView (parent, tv, r, spu, basic_color)
59 MidiRegionView::MidiRegionView (ArdourCanvas::Group *parent, RouteTimeAxisView &tv, boost::shared_ptr<MidiRegion> r, double spu,
60 Gdk::Color& basic_color, TimeAxisViewItem::Visibility visibility)
61 : RegionView (parent, tv, r, spu, basic_color, visibility)
66 MidiRegionView::init (Gdk::Color& basic_color, bool wfd)
68 // FIXME: Some redundancy here with RegionView::init. Need to figure out
69 // where order is important and where it isn't...
72 RegionView::init(basic_color, /*wfd*/false);
74 compute_colors (basic_color);
76 reset_width_dependent_items ((double) _region->length() / samples_per_unit);
78 set_y_position_and_height (0, trackview.height);
81 region_resized (BoundsChanged);
84 _region->StateChanged.connect (mem_fun(*this, &MidiRegionView::region_changed));
89 MidiRegionView::~MidiRegionView ()
93 RegionViewGoingAway (this); /* EMIT_SIGNAL */
96 boost::shared_ptr<ARDOUR::MidiRegion>
97 MidiRegionView::midi_region() const
99 // "Guaranteed" to succeed...
100 return boost::dynamic_pointer_cast<MidiRegion>(_region);
104 MidiRegionView::show_region_editor ()
106 cerr << "No MIDI region editor." << endl;
110 MidiRegionView::add_ghost (AutomationTimeAxisView& atv)