mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-07 15:25:01 +01:00
update instrument list when rescanning plugins
This commit is contained in:
parent
e14b6428c3
commit
218b016a80
2 changed files with 35 additions and 2 deletions
|
|
@ -17,7 +17,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "ardour/plugin_manager.h"
|
#include "ardour/plugin_manager.h"
|
||||||
|
#include "gtkmm2ext/gui_thread.h"
|
||||||
#include "instrument_selector.h"
|
#include "instrument_selector.h"
|
||||||
|
|
||||||
#include "i18n.h"
|
#include "i18n.h"
|
||||||
|
|
@ -28,10 +28,39 @@ using namespace ARDOUR;
|
||||||
InstrumentSelector::InstrumentSelector()
|
InstrumentSelector::InstrumentSelector()
|
||||||
: _reasonable_synth_id(0)
|
: _reasonable_synth_id(0)
|
||||||
{
|
{
|
||||||
|
refill ();
|
||||||
|
|
||||||
|
PluginManager::instance ().PluginListChanged.connect (_update_connection, invalidator (*this), boost::bind (&InstrumentSelector::refill, this), gui_context());
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
InstrumentSelector::refill()
|
||||||
|
{
|
||||||
|
TreeModel::iterator iter = get_active();
|
||||||
|
std::string selected;
|
||||||
|
if (iter) {
|
||||||
|
const TreeModel::Row& row = (*iter);
|
||||||
|
selected = row[_instrument_list_columns.name];
|
||||||
|
}
|
||||||
|
|
||||||
|
unset_model ();
|
||||||
|
clear ();
|
||||||
build_instrument_list();
|
build_instrument_list();
|
||||||
set_model(_instrument_list);
|
set_model(_instrument_list);
|
||||||
pack_start(_instrument_list_columns.name);
|
pack_start(_instrument_list_columns.name);
|
||||||
set_active(_reasonable_synth_id);
|
if (selected.empty ()) {
|
||||||
|
set_active(_reasonable_synth_id);
|
||||||
|
} else {
|
||||||
|
TreeModel::Children rows = _instrument_list->children();
|
||||||
|
TreeModel::Children::iterator i;
|
||||||
|
for (i = rows.begin(); i != rows.end(); ++i) {
|
||||||
|
std::string cn = (*i)[_instrument_list_columns.name];
|
||||||
|
if (cn == selected) {
|
||||||
|
set_active(*i);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
set_button_sensitivity(Gtk::SENSITIVITY_AUTO);
|
set_button_sensitivity(Gtk::SENSITIVITY_AUTO);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -26,6 +26,8 @@
|
||||||
#include <gtkmm/treemodel.h>
|
#include <gtkmm/treemodel.h>
|
||||||
#include <gtkmm/liststore.h>
|
#include <gtkmm/liststore.h>
|
||||||
|
|
||||||
|
#include "pbd/signals.h"
|
||||||
|
|
||||||
#include "ardour/plugin.h"
|
#include "ardour/plugin.h"
|
||||||
#include "ardour/types.h"
|
#include "ardour/types.h"
|
||||||
#include "ardour/template_utils.h"
|
#include "ardour/template_utils.h"
|
||||||
|
|
@ -52,10 +54,12 @@ private:
|
||||||
};
|
};
|
||||||
|
|
||||||
void build_instrument_list();
|
void build_instrument_list();
|
||||||
|
void refill();
|
||||||
|
|
||||||
Glib::RefPtr<Gtk::ListStore> _instrument_list;
|
Glib::RefPtr<Gtk::ListStore> _instrument_list;
|
||||||
InstrumentListColumns _instrument_list_columns;
|
InstrumentListColumns _instrument_list_columns;
|
||||||
uint32_t _reasonable_synth_id;
|
uint32_t _reasonable_synth_id;
|
||||||
|
PBD::ScopedConnection _update_connection;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* __gtk_ardour_instrument_selector_h__ */
|
#endif /* __gtk_ardour_instrument_selector_h__ */
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue