+
+ struct ControlEvent
+ {
+ nframes_t time;
+ uint8_t value;
+ uint8_t channel;
+
+ ControlEvent(nframes_t a_time, uint8_t a_value, uint8_t a_channel)
+ : time(a_time), value(a_value), channel(a_channel) {}
+
+ ControlEvent& operator=(const ControlEvent& other) {
+ time = other.time;
+ value = other.value;
+ channel = other.channel;
+ return *this;
+ }
+ };
+
+ /** Add a new program change flag to the canvas.
+ * @param program the MidiRegionView::ControlEvent to add
+ * @param the text to display in the flag
+ */
+ void add_pgm_change(ControlEvent& program, string displaytext);
+
+ /** Look up the given time and channel in the 'automation' and set keys accordingly.
+ * @param time the time of the program change event
+ * @param channel the MIDI channel of the event
+ * @key a reference to an instance of MIDI::Name::PatchPrimaryKey whose fields will
+ * will be set according to the result of the lookup
+ */
+ void get_patch_key_at(double time, uint8_t channel, MIDI::Name::PatchPrimaryKey& key);
+
+ /** Change the 'automation' data of old_program to new values which correspond to new_patch.
+ * @param old_program identifies the program change event which is to be altered
+ * @param new_patch defines the new lsb, msb and program number which are to be set in the automation list data
+ */
+ void alter_program_change(ControlEvent& old_program, const MIDI::Name::PatchPrimaryKey& new_patch);
+
+ /** Alter a given program to the new given one.
+ * (Called on context menu select on CanvasProgramChange)
+ */
+ void program_selected(
+ ArdourCanvas::CanvasProgramChange& program,
+ const MIDI::Name::PatchPrimaryKey& new_patch);
+
+ /** Alter a given program to be its predecessor in the MIDNAM file.
+ */
+ void previous_program(ArdourCanvas::CanvasProgramChange& program);
+
+ /** Alters a given program to be its successor in the MIDNAM file.
+ */
+ void next_program(ArdourCanvas::CanvasProgramChange& program);
+
+ /** Displays all program changed events in the region as flags on the canvas.
+ */
+ void find_and_insert_program_change_flags();