13
0

trigger_ui: move the patch-dialog to the properties area.

* patch-dialog is now launched from a button and stays open
* patch-dialog now tracks the current selection
This commit is contained in:
Ben Loftis 2022-02-11 10:39:53 -06:00
parent a8cf442bc9
commit 40b483e71e
4 changed files with 42 additions and 19 deletions

View File

@ -244,6 +244,10 @@ SlotPropertyTable::SlotPropertyTable ()
_follow_size_group->add_widget(_velocity_slider);
_follow_size_group->add_widget(_follow_count_spinner);
_patch_button.set_text (_("MIDI Patches"));
_patch_button.set_name("FollowAction");
_patch_button.signal_clicked.connect (sigc::mem_fun (*this, (&SlotPropertyTable::patch_button_event)));
set_spacings (8); //match to TriggerPage:: table->set_spacings
set_border_width (0); //change TriggerPage:: table->set_border_width instead
set_homogeneous (false);
@ -260,7 +264,8 @@ SlotPropertyTable::SlotPropertyTable ()
_trigger_table.attach(_color_label, 1, 2, row, row + 1, Gtk::FILL, Gtk::SHRINK);
_trigger_table.attach(_color_button, 2, 3, row, row+1, Gtk::SHRINK, Gtk::SHRINK );
_trigger_table.attach(_gain_label, 3, 4, row, row + 1, Gtk::FILL, Gtk::SHRINK);
_trigger_table.attach(_gain_spinner, 4, 5, row, row + 1, Gtk::FILL, Gtk::SHRINK);
_trigger_table.attach(_gain_spinner, 4, 5, row, row + 1, Gtk::FILL, Gtk::SHRINK); row++;
_trigger_table.attach(_patch_button, 0, 5, row, row + 1, Gtk::FILL, Gtk::SHRINK);
/* ---- Launch settings ----- */
@ -373,6 +378,19 @@ SlotPropertyTable::set_quantize (BBT_Offset bbo)
trigger()->set_quantization (bbo);
}
void
SlotPropertyTable::patch_button_event ()
{
boost::shared_ptr<Trigger> trigr = trigger();
if (boost::dynamic_pointer_cast<MIDITrigger> (trigr)) {
SessionObject* obj = trigr->box ().owner ();
boost::shared_ptr<Stripable> stripable = obj->session().stripable_by_id (obj->id ());
_patch_change_window.reset (boost::dynamic_pointer_cast<Route> (stripable), boost::dynamic_pointer_cast<MIDITrigger> (trigr));
_patch_change_window.present ();
}
}
void
SlotPropertyTable::follow_length_event ()
{
@ -515,6 +533,20 @@ SlotPropertyTable::set_follow_action (FollowAction const & fa, uint64_t idx)
}
}
void
SlotPropertyTable::on_trigger_set ()
{
boost::shared_ptr<Trigger> trigr = trigger();
if (boost::dynamic_pointer_cast<MIDITrigger> (trigr)) {
SessionObject* obj = triggerbox ().owner ();
boost::shared_ptr<Stripable> stripable = obj->session().stripable_by_id (obj->id ());
_patch_change_window.reset (boost::dynamic_pointer_cast<Route> (stripable), boost::dynamic_pointer_cast<MIDITrigger> (trigr));
_patch_button.show();
} else {
_patch_button.hide();
}
}
void
SlotPropertyTable::on_trigger_changed (PropertyChange const& pc)
{

View File

@ -36,6 +36,7 @@
#include "gtkmm2ext/cairo_packer.h"
#include "patch_change_widget.h"
#include "trigger_ui.h"
namespace ARDOUR {
@ -59,6 +60,8 @@ class SlotPropertyTable : public TriggerUI, public Gtk::Table
SlotPropertyTable ();
~SlotPropertyTable ();
virtual void on_trigger_set ();
Glib::RefPtr<Gtk::SizeGroup> _follow_size_group;
ArdourWidgets::ArdourButton _color_button;
@ -77,6 +80,8 @@ class SlotPropertyTable : public TriggerUI, public Gtk::Table
Gtk::SpinButton _gain_spinner;
Gtk::Label _gain_label;
ArdourWidgets::ArdourButton _patch_button;
Gtk::Label _beat_label;
Gtk::Label _follow_length_label;
Gtk::Label _follow_count_label;
@ -129,8 +134,12 @@ class SlotPropertyTable : public TriggerUI, public Gtk::Table
void probability_adjusted ();
void velocity_adjusted ();
void patch_button_event ();
private:
bool _ignore_changes;
PatchChangeTriggerWindow _patch_change_window;
};
class SlotPropertyWidget : public Gtk::VBox

View File

@ -390,8 +390,6 @@ TriggerPage::selection_changed ()
_parameter_box.hide ();
bool hide_patch_selector = true;
if (!selection.triggers.empty ()) {
TriggerSelection ts = selection.triggers;
TriggerEntry* entry = *ts.begin ();
@ -410,20 +408,6 @@ TriggerPage::selection_changed ()
}
}
_parameter_box.show ();
if (boost::dynamic_pointer_cast<MIDITrigger> (trigger)) {
/* TODO @ben: only show optionally. checkbox? */
hide_patch_selector = false;
SessionObject* obj = trigger->box ().owner ();
boost::shared_ptr<Stripable> stripable = _session->stripable_by_id (obj->id ());
_patch_change_window.reset (boost::dynamic_pointer_cast<Route> (stripable), boost::dynamic_pointer_cast<MIDITrigger> (trigger));
_patch_change_window.present ();
}
}
if (hide_patch_selector) {
_patch_change_window.hide ();
_patch_change_window.clear (); /* drop route/trigger ref */
}
}

View File

@ -38,7 +38,6 @@
#include "midi_region_operations_box.h"
#include "midi_region_properties_box.h"
#include "midi_trigger_properties_box.h"
#include "patch_change_widget.h"
#include "route_processor_selection.h"
#include "slot_properties_box.h"
#include "trigger_clip_picker.h"
@ -138,7 +137,6 @@ private:
MidiClipEditorBox _midi_trim_box;
#endif
PatchChangeTriggerWindow _patch_change_window;
RouteProcessorSelection _selection;
std::list<TriggerStrip*> _strips;
sigc::connection _fast_screen_update_connection;