Option to hide "-none-" from instrument dropdown
This is useful for the audition instrument selector.
This commit is contained in:
parent
c0fe67427d
commit
209536a967
@ -29,9 +29,10 @@
|
|||||||
using namespace Gtk;
|
using namespace Gtk;
|
||||||
using namespace ARDOUR;
|
using namespace ARDOUR;
|
||||||
|
|
||||||
InstrumentSelector::InstrumentSelector()
|
InstrumentSelector::InstrumentSelector (bool allow_none)
|
||||||
: _reasonable_synth_id(0)
|
: _reasonable_synth_id (0)
|
||||||
, _gmsynth_id(UINT32_MAX)
|
, _gmsynth_id (UINT32_MAX)
|
||||||
|
, _allow_none (allow_none)
|
||||||
{
|
{
|
||||||
refill ();
|
refill ();
|
||||||
|
|
||||||
@ -121,11 +122,13 @@ InstrumentSelector::build_instrument_list()
|
|||||||
|
|
||||||
_instrument_list = ListStore::create(_instrument_list_columns);
|
_instrument_list = ListStore::create(_instrument_list_columns);
|
||||||
|
|
||||||
TreeModel::Row row = *(_instrument_list->append());
|
if (_allow_none) {
|
||||||
row[_instrument_list_columns.info_ptr] = PluginInfoPtr();
|
TreeModel::Row row = *(_instrument_list->append());
|
||||||
row[_instrument_list_columns.name] = _("-none-");
|
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;
|
std::string prev;
|
||||||
for (PluginInfoList::const_iterator i = all_plugs.begin(); i != all_plugs.end(); ++i, ++n) {
|
for (PluginInfoList::const_iterator i = all_plugs.begin(); i != all_plugs.end(); ++i, ++n) {
|
||||||
PluginInfoPtr p = *i;
|
PluginInfoPtr p = *i;
|
||||||
@ -169,7 +172,7 @@ InstrumentSelector::build_instrument_list()
|
|||||||
name += " (" + suffix + ")";
|
name += " (" + suffix + ")";
|
||||||
}
|
}
|
||||||
|
|
||||||
row = *(_instrument_list->append());
|
TreeModel::Row row = *(_instrument_list->append());
|
||||||
row[_instrument_list_columns.name] = name;
|
row[_instrument_list_columns.name] = name;
|
||||||
|
|
||||||
row[_instrument_list_columns.info_ptr] = p;
|
row[_instrument_list_columns.info_ptr] = p;
|
||||||
|
@ -39,7 +39,7 @@ class Editor;
|
|||||||
class InstrumentSelector : public Gtk::ComboBox
|
class InstrumentSelector : public Gtk::ComboBox
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
InstrumentSelector();
|
InstrumentSelector (bool allow_none = true);
|
||||||
|
|
||||||
ARDOUR::PluginInfoPtr selected_instrument () const;
|
ARDOUR::PluginInfoPtr selected_instrument () const;
|
||||||
std::string selected_instrument_name () const;
|
std::string selected_instrument_name () const;
|
||||||
@ -61,6 +61,7 @@ private:
|
|||||||
InstrumentListColumns _instrument_list_columns;
|
InstrumentListColumns _instrument_list_columns;
|
||||||
uint32_t _reasonable_synth_id;
|
uint32_t _reasonable_synth_id;
|
||||||
uint32_t _gmsynth_id;
|
uint32_t _gmsynth_id;
|
||||||
|
bool _allow_none;
|
||||||
PBD::ScopedConnection _update_connection;
|
PBD::ScopedConnection _update_connection;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1761,6 +1761,7 @@ SoundFileOmega::SoundFileOmega (string title, ARDOUR::Session* s,
|
|||||||
bool persistent,
|
bool persistent,
|
||||||
Editing::ImportMode mode_hint)
|
Editing::ImportMode mode_hint)
|
||||||
: SoundFileBrowser (title, s, persistent)
|
: SoundFileBrowser (title, s, persistent)
|
||||||
|
, instrument_combo (false)
|
||||||
, copy_files_btn ( _("Copy files to session"))
|
, copy_files_btn ( _("Copy files to session"))
|
||||||
, smf_tempo_btn (_("Use MIDI Tempo Map (if defined)"))
|
, smf_tempo_btn (_("Use MIDI Tempo Map (if defined)"))
|
||||||
, selected_audio_track_cnt (selected_audio_tracks)
|
, selected_audio_track_cnt (selected_audio_tracks)
|
||||||
|
Loading…
Reference in New Issue
Block a user