2 * Copyright (C) 2013-2014 Paul Davis <paul@linuxaudiosystems.com>
3 * Copyright (C) 2014 David Robillard <d@drobilla.net>
4 * Copyright (C) 2016-2017 Nick Mainsbridge <mainsbridge@gmail.com>
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License along
17 * with this program; if not, write to the Free Software Foundation, Inc.,
18 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
21 #ifndef __PATCH_CHANGE_H__
22 #define __PATCH_CHANGE_H__
24 #include "canvas/flag.h"
30 struct PatchPrimaryKey;
37 PatchChange(MidiRegionView& region,
38 ArdourCanvas::Container* parent,
39 const std::string& text,
43 ARDOUR::InstrumentInfo& info,
44 ARDOUR::MidiModel::PatchChangePtr patch,
45 Gtkmm2ext::Color outline_color,
46 Gtkmm2ext::Color fill_color);
50 void initialize_popup_menus();
52 void on_patch_menu_selected(const MIDI::Name::PatchPrimaryKey& key);
55 void move (ArdourCanvas::Duple);
56 void set_height (ArdourCanvas::Distance);
60 double width() const { return _flag->width(); }
61 void set_text (std::string const & s) { _flag->set_text (s); }
63 ARDOUR::MidiModel::PatchChangePtr patch() const { return _patch; }
64 ArdourCanvas::Item* canvas_item() const { return _flag; }
65 ArdourCanvas::Item& item() const { return *_flag; }
68 bool event_handler (GdkEvent *);
70 MidiRegionView& _region;
71 ARDOUR::InstrumentInfo& _info;
72 ARDOUR::MidiModel::PatchChangePtr _patch;
74 bool _popup_initialized;
75 ArdourCanvas::Flag* _flag;
78 #endif /* __PATCH_CHANGE_H__ */