13
0

triggerboxGUI: use new API and tweak add route dialog to allow choice to add triggerbox

This commit is contained in:
Paul Davis 2021-10-08 13:38:39 -06:00
parent 6326222a48
commit 305c9ba6e9
6 changed files with 34 additions and 57 deletions

View File

@ -80,6 +80,7 @@ AddRouteDialog::AddRouteDialog ()
, strict_io_label (_("Pin Mode:"))
, mode_label (_("Record Mode:"))
, instrument_label (_("Instrument:"))
, with_triggers_label (_("Add TriggerBox:"))
, last_route_count (1)
, route_count_set_by_template (false)
, name_edited_by_user (false)
@ -169,15 +170,6 @@ AddRouteDialog::AddRouteDialog ()
"* " + _("The number of busses to add") + "\n" +
"* " + _("A name for the buss(es)")
));
builtin_types.push_back (
std::pair<string,string> (_("Trigger Tracks"), std::string () +
_("Use these settings to create one or more trigger tracks.") + "\n\n" +
_("Trigger tracks contain audio/MIDI regions that can be triggered on demand.") + "\n\n" +
_("You may select:") + "\n" +
"* " + _("The number of tracks to add") + "\n" +
"* " + _("A name for the track(s)")
));
}
insert_at_combo.append_text (_("First"));
@ -319,6 +311,12 @@ AddRouteDialog::AddRouteDialog ()
++n;
}
with_triggers_label.set_alignment (Gtk::ALIGN_RIGHT, Gtk::ALIGN_CENTER);
settings_table->attach (with_triggers_label, 4, 5, n, n+1, Gtk::FILL, Gtk::SHRINK, 0, 0);
settings_table->attach (with_triggers, 5, 6, n, n+1, Gtk::FILL, Gtk::SHRINK, 0, 0);
++n;
HBox* outer_box = manage (new HBox);
outer_box->set_spacing (4);
@ -592,8 +590,6 @@ AddRouteDialog::type_wanted()
return VCAMaster;
} else if (str == _("Foldback Busses")) {
return FoldbackBus;
} else if (str == _("Trigger Tracks")) {
return TriggerTrack;
} else {
assert (0);
return AudioTrack;
@ -625,9 +621,6 @@ AddRouteDialog::maybe_update_name_template_entry ()
case VCAMaster:
name_template_entry.set_text (VCA::default_name_template());
break;
case TriggerTrack:
name_template_entry.set_text (_("Trigger"));
break;
}
/* ignore programatic change, restore false */
reset_name_edited ();
@ -762,26 +755,6 @@ AddRouteDialog::track_type_chosen ()
insert_label.set_sensitive (false);
insert_at_combo.set_sensitive (false);
break;
case TriggerTrack:
configuration_label.set_sensitive (true);
channel_combo.set_sensitive (true);
mode_label.set_sensitive (false);
mode_combo.set_sensitive (false);
instrument_label.set_sensitive (false);
instrument_combo.set_sensitive (false);
group_label.set_sensitive (false);
route_group_combo.set_sensitive (false);
strict_io_label.set_sensitive (false);
strict_io_combo.set_sensitive (false);
insert_label.set_sensitive (false);
insert_at_combo.set_sensitive (false);
break;
}
@ -1034,6 +1007,12 @@ AddRouteDialog::route_group ()
return _session->route_group_by_name (route_group_combo.get_active_text());
}
bool
AddRouteDialog::use_triggers() {
return with_triggers.get_active();
}
bool
AddRouteDialog::use_strict_io() {
return strict_io_combo.get_active_row_number () == 1;

View File

@ -73,7 +73,6 @@ public:
MidiBus,
VCAMaster,
FoldbackBus,
TriggerTrack,
};
TypeWanted type_wanted();
@ -90,6 +89,7 @@ public:
RouteDialogs::InsertAt insert_at();
bool use_strict_io();
bool use_triggers();
std::string get_template_path();
@ -109,11 +109,13 @@ private:
Gtk::Label strict_io_label;
Gtk::Label mode_label;
Gtk::Label instrument_label;
Gtk::Label with_triggers_label;
Gtk::ComboBoxText mode_combo;
Gtk::ComboBoxText route_group_combo;
InstrumentSelector instrument_combo;
Gtk::ComboBoxText insert_at_combo;
Gtk::ComboBoxText strict_io_combo;
Gtk::CheckButton with_triggers;
void track_type_chosen ();
void refill_channel_setups ();

View File

@ -1534,15 +1534,6 @@ ARDOUR_UI::session_add_midi_route (
error << string_compose(P_("could not create %1 new mixed track", "could not create %1 new mixed tracks", how_many), how_many) << endmsg;
}
boost::shared_ptr<TriggerBox> tb (tracks.front()->triggerbox());
if (tb) {
TriggerBoxWindow* tbw = new TriggerBoxWindow (*(tb.get()));
tbw->present ();
cerr << " window presented\n";
} else {
cerr << "no trigger box\n";
}
} else {
RouteList routes;
@ -1570,7 +1561,8 @@ ARDOUR_UI::session_add_audio_route (
uint32_t how_many,
string const & name_template,
bool strict_io,
ARDOUR::PresentationInfo::order_t order)
ARDOUR::PresentationInfo::order_t order,
bool with_triggers)
{
list<boost::shared_ptr<AudioTrack> > tracks;
RouteList routes;
@ -1579,7 +1571,7 @@ ARDOUR_UI::session_add_audio_route (
try {
if (track) {
tracks = _session->new_audio_track (input_channels, output_channels, route_group, how_many, name_template, order, mode);
tracks = _session->new_audio_track (input_channels, output_channels, route_group, how_many, name_template, order, mode, true, with_triggers);
if (tracks.size() != how_many) {
error << string_compose (P_("could not create %1 new audio track", "could not create %1 new audio tracks", how_many), how_many)
@ -2861,6 +2853,7 @@ ARDOUR_UI::add_route_dialog_response (int r)
RouteGroup* route_group = add_route_dialog->route_group ();
AutoConnectOption oac = Config->get_output_auto_connect();
bool strict_io = add_route_dialog->use_strict_io ();
bool with_triggers = add_route_dialog->use_triggers ();
if (oac & AutoConnectMaster) {
output_chan.set (DataType::AUDIO, (_session->master_out() ? _session->master_out()->n_inputs().n_audio() : input_chan.n_audio()));
@ -2875,16 +2868,13 @@ ARDOUR_UI::add_route_dialog_response (int r)
switch (add_route_dialog->type_wanted()) {
case AddRouteDialog::AudioTrack:
session_add_audio_route (true, input_chan.n_audio(), output_chan.n_audio(), add_route_dialog->mode(), route_group, count, name_template, strict_io, order);
session_add_audio_route (true, input_chan.n_audio(), output_chan.n_audio(), add_route_dialog->mode(), route_group, count, name_template, strict_io, order, with_triggers);
break;
case AddRouteDialog::AudioBus:
session_add_audio_route (false, input_chan.n_audio(), output_chan.n_audio(), ARDOUR::Normal, route_group, count, name_template, strict_io, order);
session_add_audio_route (false, input_chan.n_audio(), output_chan.n_audio(), ARDOUR::Normal, route_group, count, name_template, strict_io, order, false);
break;
case AddRouteDialog::MidiTrack:
session_add_midi_route (true, route_group, count, name_template, strict_io, instrument, 0, order, false);
break;
case AddRouteDialog::TriggerTrack:
session_add_midi_route (true, route_group, count, name_template, strict_io, 0, 0, order, true);
session_add_midi_route (true, route_group, count, name_template, strict_io, instrument, 0, order, with_triggers);
break;
case AddRouteDialog::MidiBus:
session_add_midi_route (false, route_group, count, name_template, strict_io, instrument, 0, order, false);

View File

@ -323,7 +323,7 @@ public:
void export_video (bool range = false);
void session_add_audio_route (bool, int32_t, int32_t, ARDOUR::TrackMode, ARDOUR::RouteGroup *,
uint32_t, std::string const &, bool, ARDOUR::PresentationInfo::order_t order);
uint32_t, std::string const &, bool, ARDOUR::PresentationInfo::order_t order, bool with_triggers);
void session_add_midi_route (bool, ARDOUR::RouteGroup *, uint32_t, std::string const &, bool,
ARDOUR::PluginInfoPtr, ARDOUR::Plugin::PresetRecord*,

View File

@ -3030,6 +3030,8 @@ ProcessorBox::add_processor_to_display (boost::weak_ptr<Processor> p)
e->set_selectable(false);
}
cerr << "Adding " << processor->name() << endl;
/* Set up this entry's state from the GUIObjectState */
XMLNode* proc = entry_gui_object_state (e);
if (proc) {

View File

@ -74,11 +74,13 @@ TriggerEntry::TriggerEntry (Canvas* canvas, ARDOUR::Trigger& t)
play_button->set_outline (false);
play_button->set_fill_color (outline_color());
play_button->name = string_compose ("playbutton %1", _trigger.index());
play_button->hide ();
play_shape = new ArdourCanvas::Polygon (play_button);
play_shape->set_fill_color (UIConfiguration::instance().color (X_("theme:contrasting selection")));
play_shape->set_outline (false);
play_shape->name = string_compose ("playshape %1", _trigger.index());
play_shape->hide ();
name_text = new Text (this);
name_text->set_font_description (UIConfiguration::instance().get_SmallerFont());
@ -103,14 +105,16 @@ TriggerEntry::~TriggerEntry ()
bool
TriggerEntry::event_handler (GdkEvent* ev)
{
std::cerr << "trigUI event\n";
switch (ev->type) {
case GDK_ENTER_NOTIFY:
std::cerr << "in!\n";
play_button->show ();
play_shape->show ();
redraw ();
break;
case GDK_LEAVE_NOTIFY:
std::cerr << "out!\n";
play_button->hide ();
play_shape->hide ();
redraw ();
break;
default:
break;