diff --git a/gtk2_ardour/instrument_selector.cc b/gtk2_ardour/instrument_selector.cc index 510fbd8861..2b44ecd296 100644 --- a/gtk2_ardour/instrument_selector.cc +++ b/gtk2_ardour/instrument_selector.cc @@ -29,9 +29,10 @@ using namespace Gtk; using namespace ARDOUR; -InstrumentSelector::InstrumentSelector() - : _reasonable_synth_id(0) - , _gmsynth_id(UINT32_MAX) +InstrumentSelector::InstrumentSelector (bool allow_none) + : _reasonable_synth_id (0) + , _gmsynth_id (UINT32_MAX) + , _allow_none (allow_none) { refill (); @@ -121,11 +122,13 @@ InstrumentSelector::build_instrument_list() _instrument_list = ListStore::create(_instrument_list_columns); - TreeModel::Row row = *(_instrument_list->append()); - row[_instrument_list_columns.info_ptr] = PluginInfoPtr(); - row[_instrument_list_columns.name] = _("-none-"); + if (_allow_none) { + TreeModel::Row row = *(_instrument_list->append()); + row[_instrument_list_columns.info_ptr] = PluginInfoPtr(); + row[_instrument_list_columns.name] = _("-none-"); + } - uint32_t n = 1; + uint32_t n = _allow_none ? 1 : 0; std::string prev; for (PluginInfoList::const_iterator i = all_plugs.begin(); i != all_plugs.end(); ++i, ++n) { PluginInfoPtr p = *i; @@ -169,7 +172,7 @@ InstrumentSelector::build_instrument_list() name += " (" + suffix + ")"; } - row = *(_instrument_list->append()); + TreeModel::Row row = *(_instrument_list->append()); row[_instrument_list_columns.name] = name; row[_instrument_list_columns.info_ptr] = p; diff --git a/gtk2_ardour/instrument_selector.h b/gtk2_ardour/instrument_selector.h index b973ecee7f..15906b50df 100644 --- a/gtk2_ardour/instrument_selector.h +++ b/gtk2_ardour/instrument_selector.h @@ -39,7 +39,7 @@ class Editor; class InstrumentSelector : public Gtk::ComboBox { public: - InstrumentSelector(); + InstrumentSelector (bool allow_none = true); ARDOUR::PluginInfoPtr selected_instrument () const; std::string selected_instrument_name () const; @@ -61,6 +61,7 @@ private: InstrumentListColumns _instrument_list_columns; uint32_t _reasonable_synth_id; uint32_t _gmsynth_id; + bool _allow_none; PBD::ScopedConnection _update_connection; }; diff --git a/gtk2_ardour/sfdb_ui.cc b/gtk2_ardour/sfdb_ui.cc index 2cac216a99..8b4fef51dd 100644 --- a/gtk2_ardour/sfdb_ui.cc +++ b/gtk2_ardour/sfdb_ui.cc @@ -1761,6 +1761,7 @@ SoundFileOmega::SoundFileOmega (string title, ARDOUR::Session* s, bool persistent, Editing::ImportMode mode_hint) : SoundFileBrowser (title, s, persistent) + , instrument_combo (false) , copy_files_btn ( _("Copy files to session")) , smf_tempo_btn (_("Use MIDI Tempo Map (if defined)")) , selected_audio_track_cnt (selected_audio_tracks)