2010-12-28 13:43:22 -05:00
|
|
|
/*
|
2019-08-02 17:26:43 -04:00
|
|
|
* Copyright (C) 2013-2014 Paul Davis <paul@linuxaudiosystems.com>
|
|
|
|
* Copyright (C) 2014 David Robillard <d@drobilla.net>
|
|
|
|
* Copyright (C) 2016-2017 Nick Mainsbridge <mainsbridge@gmail.com>
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License along
|
|
|
|
* with this program; if not, write to the Free Software Foundation, Inc.,
|
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
|
|
*/
|
2010-12-28 13:43:22 -05:00
|
|
|
|
2013-04-04 00:32:52 -04:00
|
|
|
#ifndef __PATCH_CHANGE_H__
|
|
|
|
#define __PATCH_CHANGE_H__
|
2010-12-28 13:43:22 -05:00
|
|
|
|
2013-04-04 00:32:52 -04:00
|
|
|
#include "canvas/flag.h"
|
2010-12-28 13:43:22 -05:00
|
|
|
|
|
|
|
class MidiRegionView;
|
|
|
|
|
|
|
|
namespace MIDI {
|
|
|
|
namespace Name {
|
|
|
|
struct PatchPrimaryKey;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-04-04 00:32:52 -04:00
|
|
|
class PatchChange
|
2010-12-28 13:43:22 -05:00
|
|
|
{
|
|
|
|
public:
|
2020-04-03 19:41:32 -04:00
|
|
|
PatchChange (MidiRegionView& region,
|
|
|
|
ArdourCanvas::Container* parent,
|
|
|
|
double height,
|
|
|
|
double x,
|
|
|
|
double y,
|
|
|
|
ARDOUR::InstrumentInfo& info,
|
|
|
|
ARDOUR::MidiModel::PatchChangePtr patch,
|
|
|
|
Gtkmm2ext::Color outline_color,
|
|
|
|
Gtkmm2ext::Color fill_color);
|
2010-12-28 13:43:22 -05:00
|
|
|
|
2020-04-03 19:41:32 -04:00
|
|
|
~PatchChange ();
|
2010-12-28 13:43:22 -05:00
|
|
|
|
2020-04-03 19:41:32 -04:00
|
|
|
void initialize_popup_menus ();
|
2010-12-28 13:43:22 -05:00
|
|
|
|
2020-04-03 19:41:32 -04:00
|
|
|
void on_patch_menu_selected (const MIDI::Name::PatchPrimaryKey& key);
|
2013-04-04 00:32:52 -04:00
|
|
|
|
|
|
|
void move (ArdourCanvas::Duple);
|
|
|
|
void set_height (ArdourCanvas::Distance);
|
|
|
|
void hide ();
|
|
|
|
void show ();
|
|
|
|
|
2020-04-03 19:41:32 -04:00
|
|
|
void update_name ();
|
2017-02-01 12:39:32 -05:00
|
|
|
|
2020-04-03 19:41:32 -04:00
|
|
|
double width () const { return _flag->width (); }
|
|
|
|
ARDOUR::MidiModel::PatchChangePtr patch () const { return _patch; }
|
|
|
|
ArdourCanvas::Item* canvas_item () const { return _flag; }
|
|
|
|
ArdourCanvas::Item& item () const { return *_flag; }
|
2013-04-04 18:45:27 -04:00
|
|
|
|
2010-12-28 13:43:22 -05:00
|
|
|
private:
|
2020-04-03 19:41:32 -04:00
|
|
|
bool event_handler (GdkEvent*);
|
2013-04-04 00:32:52 -04:00
|
|
|
|
2014-12-17 20:18:11 -05:00
|
|
|
MidiRegionView& _region;
|
|
|
|
ARDOUR::InstrumentInfo& _info;
|
2010-12-28 13:43:22 -05:00
|
|
|
ARDOUR::MidiModel::PatchChangePtr _patch;
|
2014-12-17 20:18:11 -05:00
|
|
|
Gtk::Menu _popup;
|
|
|
|
bool _popup_initialized;
|
|
|
|
ArdourCanvas::Flag* _flag;
|
2010-12-28 13:43:22 -05:00
|
|
|
};
|
|
|
|
|
2013-04-04 00:32:52 -04:00
|
|
|
#endif /* __PATCH_CHANGE_H__ */
|