Instrument Selector: use a 3-way Disposition to disambiguate the uses of this widget
This commit is contained in:
parent
9eb626cc37
commit
9ad82787a1
|
@ -81,6 +81,7 @@ AddRouteDialog::AddRouteDialog ()
|
||||||
, mode_label (_("Record Mode:"))
|
, mode_label (_("Record Mode:"))
|
||||||
, instrument_label (_("Instrument:"))
|
, instrument_label (_("Instrument:"))
|
||||||
, last_route_count (1)
|
, last_route_count (1)
|
||||||
|
, instrument_combo (InstrumentSelector::ForTrackSelector)
|
||||||
, route_count_set_by_template (false)
|
, route_count_set_by_template (false)
|
||||||
, name_edited_by_user (false)
|
, name_edited_by_user (false)
|
||||||
{
|
{
|
||||||
|
|
|
@ -432,7 +432,7 @@ Editor::drop_paths_part_two (const vector<string>& paths, timepos_t const & p, d
|
||||||
|
|
||||||
/* drop onto canvas background: create new tracks */
|
/* drop onto canvas background: create new tracks */
|
||||||
|
|
||||||
InstrumentSelector is; // instantiation builds instrument-list and sets default.
|
InstrumentSelector is(InstrumentSelector::ForTrackDefault); // instantiation builds instrument-list and sets default.
|
||||||
do_import (midi_paths, Editing::ImportDistinctFiles, ImportAsTrack, SrcBest, SMFTrackNumber, SMFTempoIgnore, pos, is.selected_instrument(), false);
|
do_import (midi_paths, Editing::ImportDistinctFiles, ImportAsTrack, SrcBest, SMFTrackNumber, SMFTempoIgnore, pos, is.selected_instrument(), false);
|
||||||
|
|
||||||
if (UIConfiguration::instance().get_only_copy_imported_files() || copy) {
|
if (UIConfiguration::instance().get_only_copy_imported_files() || copy) {
|
||||||
|
|
|
@ -29,10 +29,10 @@
|
||||||
using namespace Gtk;
|
using namespace Gtk;
|
||||||
using namespace ARDOUR;
|
using namespace ARDOUR;
|
||||||
|
|
||||||
InstrumentSelector::InstrumentSelector (bool allow_none)
|
InstrumentSelector::InstrumentSelector (InstrumentListDisposition disp)
|
||||||
: _reasonable_synth_id (0)
|
: _reasonable_synth_id (0)
|
||||||
, _gmsynth_id (UINT32_MAX)
|
, _gmsynth_id (UINT32_MAX)
|
||||||
, _allow_none (allow_none)
|
, _disposition (disp)
|
||||||
{
|
{
|
||||||
refill ();
|
refill ();
|
||||||
|
|
||||||
|
@ -122,17 +122,23 @@ InstrumentSelector::build_instrument_list()
|
||||||
|
|
||||||
_instrument_list = ListStore::create(_instrument_list_columns);
|
_instrument_list = ListStore::create(_instrument_list_columns);
|
||||||
|
|
||||||
if (_allow_none) {
|
if (_disposition==ForTrackSelector) {
|
||||||
TreeModel::Row row = *(_instrument_list->append());
|
TreeModel::Row row = *(_instrument_list->append());
|
||||||
row[_instrument_list_columns.info_ptr] = PluginInfoPtr();
|
row[_instrument_list_columns.info_ptr] = PluginInfoPtr();
|
||||||
row[_instrument_list_columns.name] = _("-none-");
|
row[_instrument_list_columns.name] = _("-none-");
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t n = _allow_none ? 1 : 0;
|
_longest_instrument_name = "";
|
||||||
|
|
||||||
|
uint32_t n = (_disposition==ForTrackSelector) ? 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;
|
||||||
|
|
||||||
|
if (p->name.length() > _longest_instrument_name.length()) {
|
||||||
|
_longest_instrument_name = p->name;
|
||||||
|
}
|
||||||
|
|
||||||
std::string suffix;
|
std::string suffix;
|
||||||
|
|
||||||
#ifdef MIXBUS
|
#ifdef MIXBUS
|
||||||
|
|
|
@ -39,7 +39,13 @@ class Editor;
|
||||||
class InstrumentSelector : public Gtk::ComboBox
|
class InstrumentSelector : public Gtk::ComboBox
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
InstrumentSelector (bool allow_none = true);
|
enum InstrumentListDisposition {
|
||||||
|
ForAuditioner, /* this will always return some synth, never 'None' */
|
||||||
|
ForTrackDefault, /* functionally same as ForAuditioner, but for tracks */
|
||||||
|
ForTrackSelector /* this provides the 'None' option so the user can add a synth later */
|
||||||
|
};
|
||||||
|
|
||||||
|
InstrumentSelector (InstrumentListDisposition);
|
||||||
|
|
||||||
ARDOUR::PluginInfoPtr selected_instrument () const;
|
ARDOUR::PluginInfoPtr selected_instrument () const;
|
||||||
std::string selected_instrument_name () const;
|
std::string selected_instrument_name () const;
|
||||||
|
@ -57,11 +63,13 @@ private:
|
||||||
void build_instrument_list();
|
void build_instrument_list();
|
||||||
void refill();
|
void refill();
|
||||||
|
|
||||||
|
std::string _longest_instrument_name;
|
||||||
|
|
||||||
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;
|
||||||
uint32_t _gmsynth_id;
|
uint32_t _gmsynth_id;
|
||||||
bool _allow_none;
|
InstrumentListDisposition _disposition;
|
||||||
PBD::ScopedConnection _update_connection;
|
PBD::ScopedConnection _update_connection;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -1094,7 +1094,7 @@ RecorderUI::new_track_for_port (DataType dt, string const& port_name)
|
||||||
ArdourDialog d (_("Create track for input"), true, false);
|
ArdourDialog d (_("Create track for input"), true, false);
|
||||||
|
|
||||||
Entry track_name_entry;
|
Entry track_name_entry;
|
||||||
InstrumentSelector instrument_combo;
|
InstrumentSelector instrument_combo(InstrumentSelector::ForTrackDefault);
|
||||||
ComboBoxText strict_io_combo;
|
ComboBoxText strict_io_combo;
|
||||||
|
|
||||||
string pn = AudioEngine::instance()->get_pretty_name_by_name (port_name);
|
string pn = AudioEngine::instance()->get_pretty_name_by_name (port_name);
|
||||||
|
|
|
@ -1757,7 +1757,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)
|
, instrument_combo (InstrumentSelector::ForTrackSelector)
|
||||||
, 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)"))
|
||||||
, smf_marker_btn (_("Import MIDI markers (if any)"))
|
, smf_marker_btn (_("Import MIDI markers (if any)"))
|
||||||
|
|
|
@ -742,7 +742,7 @@ TriggerPage::drop_paths_part_two (std::vector<std::string> paths)
|
||||||
audio_paths.push_back (*s);
|
audio_paths.push_back (*s);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
InstrumentSelector is; // instantiation builds instrument-list and sets default.
|
InstrumentSelector is(InstrumentSelector::ForTrackDefault); // instantiation builds instrument-list and sets default.
|
||||||
timepos_t pos (0);
|
timepos_t pos (0);
|
||||||
Editing::ImportDisposition disposition = Editing::ImportSerializeFiles; // or Editing::ImportDistinctFiles // TODO use drop modifier? config?
|
Editing::ImportDisposition disposition = Editing::ImportSerializeFiles; // or Editing::ImportDistinctFiles // TODO use drop modifier? config?
|
||||||
PublicEditor::instance().do_import (midi_paths, disposition, Editing::ImportAsTrigger, SrcBest, SMFTrackNumber, SMFTempoIgnore, pos, is.selected_instrument (), false);
|
PublicEditor::instance().do_import (midi_paths, disposition, Editing::ImportAsTrigger, SrcBest, SMFTrackNumber, SMFTempoIgnore, pos, is.selected_instrument (), false);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user