Update PatchChange when instrument/midnam changes
This commit is contained in:
parent
d0a116b2ae
commit
4e005540c6
|
@ -1353,16 +1353,14 @@ MidiRegionView::display_patch_changes_on_channel (uint8_t channel, bool active_c
|
|||
p->hide();
|
||||
} else {
|
||||
const double x = trackview.editor().sample_to_pixel (region_samples);
|
||||
const string patch_name = instrument_info().get_patch_name ((*i)->bank(), (*i)->program(), channel);
|
||||
p->canvas_item()->set_position (ArdourCanvas::Duple (x, 1.0));
|
||||
p->set_text (patch_name);
|
||||
p->update_name ();
|
||||
|
||||
p->show();
|
||||
}
|
||||
|
||||
} else {
|
||||
const string patch_name = instrument_info().get_patch_name ((*i)->bank(), (*i)->program(), channel);
|
||||
add_canvas_patch_change (*i, patch_name, active_channel);
|
||||
add_canvas_patch_change (*i);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1960,7 +1958,7 @@ MidiRegionView::step_sustain (Temporal::Beats beats)
|
|||
* @param active_channel true to display the flag as on an active channel, false to grey it out for an inactive channel.
|
||||
*/
|
||||
void
|
||||
MidiRegionView::add_canvas_patch_change (MidiModel::PatchChangePtr patch, const string& displaytext, bool /*active_channel*/)
|
||||
MidiRegionView::add_canvas_patch_change (MidiModel::PatchChangePtr patch)
|
||||
{
|
||||
samplecnt_t region_samples = source_beats_to_region_samples (patch->time());
|
||||
const double x = trackview.editor().sample_to_pixel (region_samples);
|
||||
|
@ -1973,9 +1971,7 @@ MidiRegionView::add_canvas_patch_change (MidiModel::PatchChangePtr patch, const
|
|||
// up to date.
|
||||
boost::shared_ptr<PatchChange> patch_change = boost::shared_ptr<PatchChange>(
|
||||
new PatchChange(*this, group,
|
||||
displaytext,
|
||||
height,
|
||||
x, 1.0,
|
||||
height, x, 1.0,
|
||||
instrument_info(),
|
||||
patch,
|
||||
_patch_change_outline,
|
||||
|
@ -3707,6 +3703,10 @@ void
|
|||
MidiRegionView::instrument_settings_changed ()
|
||||
{
|
||||
redisplay_model();
|
||||
|
||||
for (PatchChanges::iterator x = _patch_changes.begin(); x != _patch_changes.end(); ++x) {
|
||||
(*x).second->update_name ();
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -131,7 +131,7 @@ public:
|
|||
bool paste (samplepos_t pos, const ::Selection& selection, PasteContext& ctx, const int32_t sub_num);
|
||||
void paste_internal (samplepos_t pos, unsigned paste_count, float times, const MidiCutBuffer&);
|
||||
|
||||
void add_canvas_patch_change (ARDOUR::MidiModel::PatchChangePtr patch, const std::string& displaytext, bool);
|
||||
void add_canvas_patch_change (ARDOUR::MidiModel::PatchChangePtr patch);
|
||||
void remove_canvas_patch_change (PatchChange* pc);
|
||||
|
||||
/** Look up the given time and channel in the 'automation' and set keys accordingly.
|
||||
|
|
|
@ -46,7 +46,6 @@ using Gtkmm2ext::Keyboard;
|
|||
*/
|
||||
PatchChange::PatchChange(MidiRegionView& region,
|
||||
ArdourCanvas::Container* parent,
|
||||
const string& text,
|
||||
double height,
|
||||
double x,
|
||||
double y,
|
||||
|
@ -67,11 +66,12 @@ PatchChange::PatchChange(MidiRegionView& region,
|
|||
ArdourCanvas::Duple (x, y),
|
||||
true);
|
||||
|
||||
CANVAS_DEBUG_NAME (_flag, text);
|
||||
CANVAS_DEBUG_NAME (_flag, _info.get_patch_name (_patch->bank (), _patch->program (), _patch->channel ()));
|
||||
|
||||
_flag->Event.connect (sigc::mem_fun (*this, &PatchChange::event_handler));
|
||||
_flag->set_font_description (UIConfiguration::instance().get_SmallFont());
|
||||
_flag->set_text(text);
|
||||
|
||||
update_name ();
|
||||
}
|
||||
|
||||
PatchChange::~PatchChange()
|
||||
|
@ -79,6 +79,12 @@ PatchChange::~PatchChange()
|
|||
delete _flag;
|
||||
}
|
||||
|
||||
void
|
||||
PatchChange::update_name ()
|
||||
{
|
||||
_flag->set_text (_info.get_patch_name (_patch->bank (), _patch->program (), _patch->channel ()));
|
||||
}
|
||||
|
||||
void
|
||||
PatchChange::initialize_popup_menus()
|
||||
{
|
||||
|
|
|
@ -34,38 +34,36 @@ namespace MIDI {
|
|||
class PatchChange
|
||||
{
|
||||
public:
|
||||
PatchChange(MidiRegionView& region,
|
||||
ArdourCanvas::Container* parent,
|
||||
const std::string& text,
|
||||
double height,
|
||||
double x,
|
||||
double y,
|
||||
ARDOUR::InstrumentInfo& info,
|
||||
ARDOUR::MidiModel::PatchChangePtr patch,
|
||||
Gtkmm2ext::Color outline_color,
|
||||
Gtkmm2ext::Color fill_color);
|
||||
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);
|
||||
|
||||
~PatchChange();
|
||||
~PatchChange ();
|
||||
|
||||
void initialize_popup_menus();
|
||||
|
||||
void on_patch_menu_selected(const MIDI::Name::PatchPrimaryKey& key);
|
||||
void initialize_popup_menus ();
|
||||
|
||||
void on_patch_menu_selected (const MIDI::Name::PatchPrimaryKey& key);
|
||||
|
||||
void move (ArdourCanvas::Duple);
|
||||
void set_height (ArdourCanvas::Distance);
|
||||
void hide ();
|
||||
void show ();
|
||||
|
||||
double width() const { return _flag->width(); }
|
||||
void set_text (std::string const & s) { _flag->set_text (s); }
|
||||
void update_name ();
|
||||
|
||||
ARDOUR::MidiModel::PatchChangePtr patch() const { return _patch; }
|
||||
ArdourCanvas::Item* canvas_item() const { return _flag; }
|
||||
ArdourCanvas::Item& item() const { return *_flag; }
|
||||
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; }
|
||||
|
||||
private:
|
||||
bool event_handler (GdkEvent *);
|
||||
bool event_handler (GdkEvent*);
|
||||
|
||||
MidiRegionView& _region;
|
||||
ARDOUR::InstrumentInfo& _info;
|
||||
|
|
Loading…
Reference in New Issue