triggerboxUI: showing trigger box UI is global now; move load op to context menu; handle multiple selection

This commit is contained in:
Paul Davis 2021-10-11 17:58:51 -06:00
parent 7b14c5666a
commit a30148b2a1
4 changed files with 42 additions and 8 deletions

View file

@ -535,6 +535,17 @@ MixerStrip::set_route (boost::shared_ptr<Route> rt)
bottom_button_table.remove (group_button);
}
if (rt != route()) {
if (rt && route()) {
std::cerr << "switching from " << rt->name() << " to " << route()->name() << std::endl;
}
if (trigger_display && trigger_display->get_parent() == &global_vpacker) {
global_vpacker.remove (*trigger_display);
delete trigger_display;
trigger_display = 0;
}
}
RouteUI::set_route (rt);
control_slave_ui.set_stripable (boost::dynamic_pointer_cast<Stripable> (rt));
@ -1643,6 +1654,19 @@ MixerStrip::revert_to_default_display ()
}
reset_strip_style ();
if (_route->triggerbox() && UIConfiguration::instance().get_show_triggers_inline()) {
create_trigger_display (_route->triggerbox());
if (trigger_display->get_parent() != &global_vpacker) {
global_vpacker.pack_start (*trigger_display, true, true);
trigger_display->show ();
global_vpacker.reorder_child (*trigger_display, 4);
}
} else {
if (trigger_display && (trigger_display->get_parent() == &global_vpacker)) {
global_vpacker.remove (*trigger_display);
}
}
}
void
@ -1794,6 +1818,12 @@ MixerStrip::parameter_changed (string p)
master_volume_table.hide ();
}
}
} else if (p == "show-triggers-inline") {
boost::shared_ptr<TriggerBox> tb = route()->triggerbox();
if (tb) {
create_trigger_display (tb);
toggle_trigger_display ();
}
}
}

View file

@ -4302,10 +4302,7 @@ ProcessorBox::edit_triggerbox (boost::shared_ptr<Processor> processor)
return false;
}
if (_parent_strip) {
_parent_strip->create_trigger_display (tb);
_parent_strip->toggle_trigger_display ();
}
UIConfiguration::instance().set_show_triggers_inline (!UIConfiguration::instance().get_show_triggers_inline());
return true;
}

View file

@ -257,6 +257,7 @@ TriggerBoxUI::TriggerBoxUI (ArdourCanvas::Item* parent, TriggerBox& tb)
TriggerBoxUI::~TriggerBoxUI ()
{
update_connection.disconnect ();
}
void
@ -299,7 +300,7 @@ TriggerBoxUI::event (GdkEvent* ev, uint64_t n)
{
switch (ev->type) {
case GDK_2BUTTON_PRESS:
choose_sample (n);
edit_trigger (n);
return true;
case GDK_BUTTON_RELEASE:
switch (ev->button.button) {
@ -483,6 +484,7 @@ TriggerBoxUI::context_menu (uint64_t n)
dynamic_cast<Gtk::CheckMenuItem*> (&qitems.back ())->set_active (true);
}
items.push_back (MenuElem (_("Load..."), sigc::bind (sigc::mem_fun (*this, &TriggerBoxUI::choose_sample), n)));
items.push_back (MenuElem (_("Edit..."), sigc::bind (sigc::mem_fun (*this, &TriggerBoxUI::edit_trigger), n)));
items.push_back (MenuElem (_("Follow Action..."), *follow_menu));
items.push_back (MenuElem (_("Launch Style..."), *launch_menu));
@ -530,6 +532,7 @@ TriggerBoxUI::choose_sample (uint64_t n)
file_chooser = new Gtk::FileChooserDialog (_("Select sample"), Gtk::FILE_CHOOSER_ACTION_OPEN);
file_chooser->add_button(Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL);
file_chooser->add_button(Gtk::Stock::OK, Gtk::RESPONSE_OK);
file_chooser->set_select_multiple (true);
}
file_chooser_connection.disconnect ();
@ -550,10 +553,13 @@ TriggerBoxUI::sample_chosen (int response, uint64_t n)
return;
}
std::string path = file_chooser->get_filename ();
std::list<std::string> paths = file_chooser->get_filenames ();
_triggerbox.set_from_path (n, path);
// _triggerbox.trigger (n)->set_length (timecnt_t (Temporal::Beats (4, 0)));
for (std::list<std::string>::iterator s = paths.begin(); s != paths.end(); ++s) {
/* this will do nothing if n is too large */
_triggerbox.set_from_path (n, *s);
++n;
}
}
void

View file

@ -132,3 +132,4 @@ UI_CONFIG_VARIABLE (bool, rulers_follow_grid, "rulers-follow-grid", false)
UI_CONFIG_VARIABLE (bool, grid_follows_internal, "grid-follows-internal", false) //this feature is deprecated, default it FALSE for now; remove it in v6
UI_CONFIG_VARIABLE (bool, show_region_name, "show-region-name", true)
UI_CONFIG_VARIABLE (int, time_axis_name_ellipsize_mode, "time-axis-name-ellipsize-mode", 0)
UI_CONFIG_VARIABLE (bool, show_triggers_inline, "show-triggers-inline", false)