From 133b51922af0019cdb39e9a3bfb54190e50b055b Mon Sep 17 00:00:00 2001 From: Ben Loftis Date: Thu, 30 Dec 2021 10:25:00 -0600 Subject: [PATCH] trigger_ui: move old triggerui implementation into slot_properties where it is used --- gtk2_ardour/slot_properties_box.cc | 411 ++++++++++++++++++++++++- gtk2_ardour/slot_properties_box.h | 86 +++++- gtk2_ardour/trigger_ui.cc | 463 +++-------------------------- gtk2_ardour/trigger_ui.h | 89 +----- gtk2_ardour/triggerbox_ui.cc | 2 + libs/widgets/widgets/frame.h | 1 + 6 files changed, 539 insertions(+), 513 deletions(-) diff --git a/gtk2_ardour/slot_properties_box.cc b/gtk2_ardour/slot_properties_box.cc index a4c79bb732..3a892591c5 100644 --- a/gtk2_ardour/slot_properties_box.cc +++ b/gtk2_ardour/slot_properties_box.cc @@ -18,29 +18,54 @@ */ #include +#include "pbd/basename.h" #include "pbd/compose.h" +#include "pbd/convert.h" +#include "pbd/file_utils.h" +#include "pbd/pathexpand.h" +#include "pbd/search_path.h" -#include "gtkmm2ext/gui_thread.h" #include "gtkmm2ext/utils.h" +#include "gtkmm2ext/gui_thread.h" #include "gtkmm2ext/actions.h" +#include +#include +#include +#include +#include + #include "ardour/location.h" #include "ardour/profile.h" #include "ardour/session.h" +#include "ardour/region.h" +#include "ardour/triggerbox.h" +#include "ardour_ui.h" #include "audio_clock.h" -#include "automation_line.h" -#include "control_point.h" -#include "editor.h" #include "region_view.h" #include "trigger_ui.h" +#include "utils.h" + +#include "audio_region_properties_box.h" +#include "audio_trigger_properties_box.h" +#include "audio_region_operations_box.h" + +#include "midi_trigger_properties_box.h" +#include "midi_region_properties_box.h" +#include "midi_region_operations_box.h" +#include "midi_clip_editor.h" #include "slot_properties_box.h" #include "pbd/i18n.h" + using namespace Gtk; +using namespace PBD; using namespace ARDOUR; +using namespace ArdourWidgets; +using namespace Temporal; using std::min; using std::max; @@ -78,3 +103,381 @@ SlotPropertiesBox::set_slot (TriggerReference tref) { _triggerwidget->set_trigger (tref); } + +/* **************************************** */ + +SlotPropertyTable::SlotPropertyTable () + : _color_button (ArdourButton::Element (ArdourButton::just_led_default_elements | ArdourButton::ColorBox)) + , _follow_action_button (ArdourButton::led_default_elements) + , _velocity_adjustment(1.,0.,1.0,0.01,0.1) + , _velocity_slider (&_velocity_adjustment, boost::shared_ptr(), 24/*length*/, 12/*girth*/ ) + , _follow_probability_adjustment(0,0,100,2,5) + , _follow_probability_slider (&_follow_probability_adjustment, boost::shared_ptr(), 24/*length*/, 12/*girth*/ ) + , _follow_count_adjustment (1, 1, 128, 1, 4) + , _follow_count_spinner (_follow_count_adjustment) + , _legato_button (ArdourButton::led_default_elements) + +{ + using namespace Gtk::Menu_Helpers; + + set_spacings (2); + set_homogeneous (false); + + _follow_action_button.set_name("FollowAction"); + _follow_action_button.set_text (_("Follow Action")); + _follow_action_button.signal_event().connect (sigc::mem_fun (*this, (&SlotPropertyTable::follow_action_button_event))); + + _follow_count_spinner.set_can_focus(false); + _follow_count_spinner.signal_changed ().connect (sigc::mem_fun (*this, &SlotPropertyTable::follow_count_event)); + + _velocity_adjustment.signal_value_changed ().connect (sigc::mem_fun (*this, &SlotPropertyTable::velocity_adjusted)); + + _velocity_slider.set_name("FollowAction"); + + _follow_probability_adjustment.signal_value_changed ().connect (sigc::mem_fun (*this, &SlotPropertyTable::probability_adjusted)); + + _follow_probability_slider.set_name("FollowAction"); + + _follow_left.set_name("FollowAction"); + _follow_left.AddMenuElem (MenuElem (follow_action_to_string(Trigger::None), sigc::bind (sigc::mem_fun (*this, &SlotPropertyTable::set_follow_action), Trigger::None, 0))); + _follow_left.AddMenuElem (MenuElem (follow_action_to_string(Trigger::Stop), sigc::bind (sigc::mem_fun (*this, &SlotPropertyTable::set_follow_action), Trigger::Stop, 0))); + _follow_left.AddMenuElem (MenuElem (follow_action_to_string(Trigger::Again), sigc::bind (sigc::mem_fun (*this, &SlotPropertyTable::set_follow_action), Trigger::Again, 0))); + _follow_left.AddMenuElem (MenuElem (follow_action_to_string(Trigger::PrevTrigger), sigc::bind (sigc::mem_fun (*this, &SlotPropertyTable::set_follow_action), Trigger::PrevTrigger, 0))); + _follow_left.AddMenuElem (MenuElem (follow_action_to_string(Trigger::NextTrigger), sigc::bind (sigc::mem_fun (*this, &SlotPropertyTable::set_follow_action), Trigger::NextTrigger, 0))); + _follow_left.AddMenuElem (MenuElem (follow_action_to_string(Trigger::AnyTrigger), sigc::bind (sigc::mem_fun (*this, &SlotPropertyTable::set_follow_action), Trigger::AnyTrigger, 0))); + _follow_left.AddMenuElem (MenuElem (follow_action_to_string(Trigger::OtherTrigger), sigc::bind (sigc::mem_fun (*this, &SlotPropertyTable::set_follow_action), Trigger::OtherTrigger, 0))); + _follow_left.set_sizing_text (longest_follow); + + _follow_right.set_name("FollowAction"); + _follow_right.AddMenuElem (MenuElem (follow_action_to_string(Trigger::None), sigc::bind (sigc::mem_fun (*this, &SlotPropertyTable::set_follow_action), Trigger::None, 1))); + _follow_right.AddMenuElem (MenuElem (follow_action_to_string(Trigger::Stop), sigc::bind (sigc::mem_fun (*this, &SlotPropertyTable::set_follow_action), Trigger::Stop, 1))); + _follow_right.AddMenuElem (MenuElem (follow_action_to_string(Trigger::Again), sigc::bind (sigc::mem_fun (*this, &SlotPropertyTable::set_follow_action), Trigger::Again, 1))); + _follow_right.AddMenuElem (MenuElem (follow_action_to_string(Trigger::PrevTrigger), sigc::bind (sigc::mem_fun (*this, &SlotPropertyTable::set_follow_action), Trigger::PrevTrigger, 1))); + _follow_right.AddMenuElem (MenuElem (follow_action_to_string(Trigger::NextTrigger), sigc::bind (sigc::mem_fun (*this, &SlotPropertyTable::set_follow_action), Trigger::NextTrigger, 1))); + _follow_right.AddMenuElem (MenuElem (follow_action_to_string(Trigger::AnyTrigger), sigc::bind (sigc::mem_fun (*this, &SlotPropertyTable::set_follow_action), Trigger::AnyTrigger, 1))); + _follow_right.AddMenuElem (MenuElem (follow_action_to_string(Trigger::OtherTrigger), sigc::bind (sigc::mem_fun (*this, &SlotPropertyTable::set_follow_action), Trigger::OtherTrigger, 1))); + _follow_right.set_sizing_text (longest_follow); + + _launch_style_button.set_name("FollowAction"); + _launch_style_button.set_sizing_text (longest_launch); + _launch_style_button.AddMenuElem (MenuElem (launch_style_to_string (Trigger::OneShot), sigc::bind (sigc::mem_fun (*this, &SlotPropertyTable::set_launch_style), Trigger::OneShot))); + _launch_style_button.AddMenuElem (MenuElem (launch_style_to_string (Trigger::Gate), sigc::bind (sigc::mem_fun (*this, &SlotPropertyTable::set_launch_style), Trigger::Gate))); + _launch_style_button.AddMenuElem (MenuElem (launch_style_to_string (Trigger::Toggle), sigc::bind (sigc::mem_fun (*this, &SlotPropertyTable::set_launch_style), Trigger::Toggle))); + _launch_style_button.AddMenuElem (MenuElem (launch_style_to_string (Trigger::Repeat), sigc::bind (sigc::mem_fun (*this, &SlotPropertyTable::set_launch_style), Trigger::Repeat))); + + _launch_style_button.set_name("FollowAction"); + _legato_button.set_text (_("Legato")); + _legato_button.signal_event().connect (sigc::mem_fun (*this, (&SlotPropertyTable::legato_button_event))); + +#define quantize_item(b) _quantize_button.AddMenuElem (MenuElem (quantize_length_to_string (b), sigc::bind (sigc::mem_fun (*this, &SlotPropertyTable::set_quantize), b))); + +#if TRIGGER_PAGE_GLOBAL_QUANTIZATION_IMPLEMENTED + quantize_item (BBT_Offset (0, 0, 0)); +#endif + quantize_item (BBT_Offset (1, 0, 0)); + quantize_item (BBT_Offset (0, 4, 0)); + quantize_item (BBT_Offset (0, 2, 0)); + quantize_item (BBT_Offset (0, 1, 0)); + quantize_item (BBT_Offset (0, 0, Temporal::ticks_per_beat/2)); + quantize_item (BBT_Offset (0, 0, Temporal::ticks_per_beat/4)); + quantize_item (BBT_Offset (0, 0, Temporal::ticks_per_beat/8)); + quantize_item (BBT_Offset (0, 0, Temporal::ticks_per_beat/16)); + quantize_item (BBT_Offset (-1, 0, 0)); + + for (std::vector::const_iterator i = quantize_strings.begin(); i != quantize_strings.end(); ++i) { + if (i->length() > longest_quantize.length()) { + longest_quantize = *i; + } + } + _quantize_button.set_sizing_text (longest_quantize); + _quantize_button.set_name("FollowAction"); + +#undef quantize_item + + _name_label.set_name (X_("TrackNameEditor")); + _name_label.set_alignment (0.0, 0.5); + _name_label.set_padding (4, 0); + _name_label.set_width_chars (12); + + _namebox.add (_name_label); + _namebox.add_events (Gdk::BUTTON_PRESS_MASK); + _namebox.signal_button_press_event ().connect (sigc::mem_fun (*this, &SlotPropertyTable::namebox_button_press)); + + _name_frame.add (_namebox); + _name_frame.set_edge_color (0x000000ff); + _name_frame.set_border_width (0); + _name_frame.set_padding (0); + + _load_button.set_name("FollowAction"); + _load_button.set_text (_("Load")); + _load_button.signal_clicked.connect (sigc::mem_fun (*this, (&SlotPropertyTable::choose_sample))); + + _color_button.set_name("FollowAction"); + _color_button.signal_clicked.connect (sigc::mem_fun (*this, (&SlotPropertyTable::choose_color))); + + _follow_size_group = Gtk::SizeGroup::create (Gtk::SIZE_GROUP_VERTICAL); + _follow_size_group->add_widget(_name_frame); + _follow_size_group->add_widget(_load_button); + _follow_size_group->add_widget(_color_button); + _follow_size_group->add_widget(_velocity_slider); + _follow_size_group->add_widget(_follow_count_spinner); + + int row=0; + Gtk::Label *label; + + attach(_name_frame, 0, 2, row, row+1, Gtk::FILL, Gtk::SHRINK ); + attach(_load_button, 2, 3, row, row+1, Gtk::FILL, Gtk::SHRINK ); + attach(_color_button, 3, 4, row, row+1, Gtk::FILL, Gtk::SHRINK ); row++; + + label = manage(new Gtk::Label(_("Velocity Sense:"))); label->set_alignment(1.0, 0.5); + attach(*label, 0, 1, row, row+1, Gtk::FILL, Gtk::SHRINK ); + attach(_velocity_slider, 1, 3, row, row+1, Gtk::FILL, Gtk::SHRINK ); row++; + + label = manage(new Gtk::Label(_("Launch Style:"))); label->set_alignment(1.0, 0.5); + attach(*label, 0, 1, row, row+1, Gtk::FILL, Gtk::SHRINK ); + attach(_launch_style_button, 1, 3, row, row+1, Gtk::FILL, Gtk::SHRINK ); row++; + + label = manage(new Gtk::Label(_("Launch Quantize:"))); label->set_alignment(1.0, 0.5); + attach(*label, 0, 1, row, row+1, Gtk::FILL, Gtk::SHRINK ); + attach(_quantize_button, 1, 3, row, row+1, Gtk::FILL, Gtk::SHRINK ); row++; + + label = manage(new Gtk::Label(_("Legato Mode:"))); label->set_alignment(1.0, 0.5); + attach(*label, 0, 1, row, row+1, Gtk::FILL, Gtk::SHRINK ); + attach(_legato_button, 1, 3, row, row+1, Gtk::FILL, Gtk::SHRINK ); row++; + + attach(_follow_action_button, 0, 3, row, row+1, Gtk::FILL, Gtk::SHRINK ); row++; + + label = manage(new Gtk::Label(_("Follow Count:"))); label->set_alignment(1.0, 0.5); + attach(*label, 0, 1, row, row+1, Gtk::FILL, Gtk::SHRINK ); + Gtk::Alignment *align = manage (new Gtk::Alignment (0, .5, 0, 0)); + align->add (_follow_count_spinner); + attach(*align, 1, 3, row, row+1, Gtk::FILL, Gtk::SHRINK, 0, 0 ); row++; + + Gtkmm2ext::set_size_request_to_display_given_text (_left_probability_label, "100% Left ", 12, 0); + _left_probability_label.set_alignment(0.0, 0.5); + Gtkmm2ext::set_size_request_to_display_given_text (_right_probability_label, "100% Right", 12, 0); + _right_probability_label.set_alignment(1.0, 0.5); + + Gtk::Table *prob_table = manage(new Gtk::Table()); + prob_table->set_spacings(2); + prob_table->attach(_follow_probability_slider, 0, 2, 0, 1, Gtk::FILL, Gtk::SHRINK ); + prob_table->attach(_left_probability_label, 0, 1, 1, 2, Gtk::FILL, Gtk::SHRINK ); + prob_table->attach(_right_probability_label, 1, 2, 1, 2, Gtk::FILL, Gtk::SHRINK ); + + attach( *prob_table, 0, 3, row, row+1, Gtk::FILL, Gtk::SHRINK ); row++; + attach(_follow_left, 0, 1, row, row+1, Gtk::FILL, Gtk::SHRINK ); + attach(_follow_right, 1, 3, row, row+1, Gtk::FILL, Gtk::SHRINK ); row++; +} + +SlotPropertyTable::~SlotPropertyTable () +{ +} + +void +SlotPropertyTable::set_quantize (BBT_Offset bbo) +{ +#if TRIGGER_PAGE_GLOBAL_QUANTIZATION_IMPLEMENTED + if (bbo == BBT_Offset (0, 0, 0)) { + /* use grid */ + bbo = BBT_Offset (1, 2, 3); /* XXX get grid from editor */ + } +#endif + + trigger()->set_quantization (bbo); +} + +void +SlotPropertyTable::follow_count_event () +{ + trigger()->set_follow_count ((int) _follow_count_adjustment.get_value()); +} + +void +SlotPropertyTable::velocity_adjusted () +{ + trigger()->set_midi_velocity_effect (_velocity_adjustment.get_value()); +} + +void +SlotPropertyTable::probability_adjusted () +{ + trigger()->set_follow_action_probability ((int) _follow_probability_adjustment.get_value()); +} + +bool +SlotPropertyTable::follow_action_button_event (GdkEvent* ev) +{ + switch (ev->type) { + case GDK_BUTTON_PRESS: + trigger()->set_use_follow (!trigger()->use_follow()); + return true; + + default: + break; + } + + return false; +} + +bool +SlotPropertyTable::legato_button_event (GdkEvent* ev) +{ + switch (ev->type) { + case GDK_BUTTON_PRESS: + trigger()->set_legato (!trigger()->legato()); + return true; + + default: + break; + } + + return false; +} + +void +SlotPropertyTable::set_launch_style (Trigger::LaunchStyle ls) +{ + trigger()->set_launch_style (ls); +} + +void +SlotPropertyTable::set_follow_action (Trigger::FollowAction fa, uint64_t idx) +{ + trigger()->set_follow_action (fa, idx); +} + +void +SlotPropertyTable::on_trigger_changed (PropertyChange pc) +{ + if (pc.contains (Properties::name)) { + _name_label.set_text (trigger()->name()); + } + if (pc.contains (Properties::color)) { + _color_button.set_custom_led_color (trigger()->color()); + } + if (pc.contains (Properties::quantization)) { + BBT_Offset bbo (trigger()->quantization()); + _quantize_button.set_active (quantize_length_to_string (bbo)); + } + + if (pc.contains (Properties::use_follow)) { + _follow_action_button.set_active_state (trigger()->use_follow() ? Gtkmm2ext::ExplicitActive : Gtkmm2ext::Off); + } + + if (pc.contains (Properties::follow_count)) { + _follow_count_adjustment.set_value (trigger()->follow_count()); + } + + if (pc.contains (Properties::legato)) { + _legato_button.set_active_state (trigger()->legato() ? Gtkmm2ext::ExplicitActive : Gtkmm2ext::Off); + } + + if (pc.contains (Properties::launch_style)) { + _launch_style_button.set_active (launch_style_to_string (trigger()->launch_style())); + } + + if (pc.contains (Properties::follow_action0)) { + _follow_left.set_text (follow_action_to_string (trigger()->follow_action (0))); + } + + if (pc.contains (Properties::follow_action1)) { + _follow_right.set_text (follow_action_to_string (trigger()->follow_action (1))); + } + + if (pc.contains (Properties::velocity_effect)) { + _velocity_adjustment.set_value (trigger()->midi_velocity_effect()); + } + + if (pc.contains (Properties::follow_action_probability)) { + int pval = trigger()->follow_action_probability(); + _follow_probability_adjustment.set_value (pval); + _left_probability_label.set_text (string_compose(_("%1%% Left"), 100-pval)); + _right_probability_label.set_text (string_compose(_("%1%% Right"), pval)); + } + + if (trigger()->use_follow()) { + _follow_left.set_sensitive(true); + _follow_right.set_sensitive(true); + _follow_count_spinner.set_sensitive(true); + _follow_probability_slider.set_sensitive(true); + _left_probability_label.set_sensitive(true); + _right_probability_label.set_sensitive(true); + } else { + _follow_left.set_sensitive(false); + _follow_right.set_sensitive(false); + _follow_count_spinner.set_sensitive(false); + _follow_probability_slider.set_sensitive(false); + _left_probability_label.set_sensitive(false); + _right_probability_label.set_sensitive(false); + } +} + +/* ------------ */ + +SlotPropertyWidget::SlotPropertyWidget () +{ + ui = new SlotPropertyTable (); + pack_start(*ui); + ui->show(); +// set_background_color (UIConfiguration::instance().color (X_("theme:bg"))); +} + +/* ------------ */ + +SlotPropertyWindow::SlotPropertyWindow (TriggerReference tref) +{ + TriggerPtr trigger (tref.trigger()); + + set_title (string_compose (_("Trigger: %1"), trigger->name())); + + SlotPropertiesBox* slot_prop_box = manage (new SlotPropertiesBox ()); + slot_prop_box->set_slot (tref); + + Gtk::Table* table = manage (new Gtk::Table); + table->set_homogeneous (false); + table->set_spacings (16); + table->set_border_width (8); + + int col = 0; + table->attach(*slot_prop_box, col, col+1, 0, 1, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::EXPAND ); col++; + + if (trigger->region()) { + if (trigger->region()->data_type() == DataType::AUDIO) { + _trig_box = manage(new AudioTriggerPropertiesBox ()); + _ops_box = manage(new AudioRegionOperationsBox ()); + _trim_box = manage(new AudioClipEditorBox ()); + + _trig_box->set_trigger (tref); + } else { + _trig_box = manage(new MidiTriggerPropertiesBox ()); + _ops_box = manage(new MidiRegionOperationsBox ()); + _trim_box = manage(new MidiClipEditorBox ()); + + _trig_box->set_trigger (tref); + } + + _trim_box->set_region(trigger->region(), tref); + _ops_box->set_session(&trigger->region()->session()); + + table->attach(*_trig_box, col, col+1, 0, 1, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::EXPAND ); col++; + table->attach(*_trim_box, col, col+1, 0, 1, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::EXPAND ); col++; + table->attach(*_ops_box, col, col+1, 0, 1, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::EXPAND ); col++; + } + + add (*table); + table->show_all(); +} + +bool +SlotPropertyWindow::on_key_press_event (GdkEventKey* ev) +{ + Gtk::Window& main_window (ARDOUR_UI::instance()->main_window()); + return ARDOUR_UI_UTILS::relay_key_press (ev, &main_window); +} + +bool +SlotPropertyWindow::on_key_release_event (GdkEventKey* ev) +{ + Gtk::Window& main_window (ARDOUR_UI::instance()->main_window()); + return ARDOUR_UI_UTILS::relay_key_press (ev, &main_window); +} diff --git a/gtk2_ardour/slot_properties_box.h b/gtk2_ardour/slot_properties_box.h index 6a049244c9..81f22791d5 100644 --- a/gtk2_ardour/slot_properties_box.h +++ b/gtk2_ardour/slot_properties_box.h @@ -24,21 +24,91 @@ #include #include +#include "gtkmm/sizegroup.h" #include #include "ardour/ardour.h" #include "ardour/session_handle.h" #include "widgets/ardour_button.h" +#include "widgets/slider_controller.h" +#include "widgets/ardour_dropdown.h" #include "gtkmm2ext/cairo_packer.h" +#include "trigger_ui.h" + namespace ARDOUR { class Session; class Location; } -class SlotPropertyWidget; +namespace ArdourWidgets { + class ArdourButton; + class HSliderController; +} + +class TriggerPropertiesBox; +class RegionPropertiesBox; +class RegionOperationsBox; +class ClipEditorBox; + +class SlotPropertyTable : public TriggerUI, public Gtk::Table +{ + public: + SlotPropertyTable (); + ~SlotPropertyTable (); + + Glib::RefPtr _follow_size_group; + ArdourWidgets::ArdourButton _color_button; + + ArdourWidgets::ArdourButton _load_button; + + ArdourWidgets::ArdourButton _follow_action_button; + + Gtk::Adjustment _velocity_adjustment; + ArdourWidgets::HSliderController _velocity_slider; + + Gtk::Label _left_probability_label; + Gtk::Label _right_probability_label; + Gtk::Adjustment _follow_probability_adjustment; + ArdourWidgets::HSliderController _follow_probability_slider; + + Gtk::Adjustment _follow_count_adjustment; + Gtk::SpinButton _follow_count_spinner; + + ArdourWidgets::ArdourDropdown _follow_left; + ArdourWidgets::ArdourDropdown _follow_right; + + ArdourWidgets::ArdourButton _legato_button; + + ArdourWidgets::ArdourDropdown _quantize_button; + + ArdourWidgets::ArdourDropdown _launch_style_button; + + void set_quantize (Temporal::BBT_Offset); + void set_launch_style (ARDOUR::Trigger::LaunchStyle); + void set_follow_action (ARDOUR::Trigger::FollowAction, uint64_t); + + void on_trigger_changed (PBD::PropertyChange); + + bool follow_action_button_event (GdkEvent*); + bool legato_button_event (GdkEvent*); + void follow_count_event (); + + void probability_adjusted (); + void velocity_adjusted (); +}; + +class SlotPropertyWidget : public Gtk::VBox +{ + public: + SlotPropertyWidget (); + void set_trigger (ARDOUR::TriggerReference tr) const { ui->set_trigger(tr); } + + private: + SlotPropertyTable* ui; +}; class SlotPropertiesBox : public Gtk::VBox, public ARDOUR::SessionHandlePtr { @@ -58,4 +128,18 @@ private: SlotPropertyWidget* _triggerwidget; }; +/* XXX probably for testing only */ + +class SlotPropertyWindow : public Gtk::Window +{ + public: + SlotPropertyWindow (ARDOUR::TriggerReference); + + bool on_key_press_event (GdkEventKey*); + bool on_key_release_event (GdkEventKey*); + + TriggerPropertiesBox *_trig_box; + RegionOperationsBox *_ops_box; + ClipEditorBox *_trim_box; +}; #endif /* __multi_region_properties_box_h__ */ diff --git a/gtk2_ardour/trigger_ui.cc b/gtk2_ardour/trigger_ui.cc index 1699493ceb..e19a050f78 100644 --- a/gtk2_ardour/trigger_ui.cc +++ b/gtk2_ardour/trigger_ui.cc @@ -35,27 +35,13 @@ #include "ardour/region.h" #include "ardour/triggerbox.h" -#include "gtkmm/sizegroup.h" -#include "gtkmm2ext/utils.h" - -#include "audio_region_properties_box.h" -#include "audio_trigger_properties_box.h" -#include "audio_region_operations_box.h" - -#include "midi_trigger_properties_box.h" -#include "midi_region_properties_box.h" -#include "midi_region_operations_box.h" - #include "slot_properties_box.h" -#include "midi_clip_editor.h" #include "ardour_ui.h" #include "gui_thread.h" #include "keyboard.h" #include "trigger_ui.h" -#include "public_editor.h" #include "ui_config.h" -#include "utils.h" #include "pbd/i18n.h" @@ -65,16 +51,45 @@ using namespace Gtkmm2ext; using namespace PBD; using namespace Temporal; -static std::vector follow_strings; -static std::string longest_follow; -static std::vector quantize_strings; -static std::string longest_quantize; -static std::vector launch_strings; -static std::string longest_launch; +std::vector TriggerUI::follow_strings; +std::string TriggerUI::longest_follow; +std::vector TriggerUI::quantize_strings; +std::string TriggerUI::longest_quantize; +std::vector TriggerUI::launch_strings; +std::string TriggerUI::longest_launch; TriggerUI::TriggerUI () : _renaming (false) { + if (follow_strings.empty()) { + follow_strings.push_back (follow_action_to_string (Trigger::None)); + follow_strings.push_back (follow_action_to_string (Trigger::Stop)); + follow_strings.push_back (follow_action_to_string (Trigger::Again)); + follow_strings.push_back (follow_action_to_string (Trigger::QueuedTrigger)); + follow_strings.push_back (follow_action_to_string (Trigger::NextTrigger)); + follow_strings.push_back (follow_action_to_string (Trigger::PrevTrigger)); + follow_strings.push_back (follow_action_to_string (Trigger::FirstTrigger)); + follow_strings.push_back (follow_action_to_string (Trigger::LastTrigger)); + follow_strings.push_back (follow_action_to_string (Trigger::AnyTrigger)); + follow_strings.push_back (follow_action_to_string (Trigger::OtherTrigger)); + + for (std::vector::const_iterator i = follow_strings.begin(); i != follow_strings.end(); ++i) { + if (i->length() > longest_follow.length()) { + longest_follow = *i; + } + } + + launch_strings.push_back (launch_style_to_string (Trigger::OneShot)); + launch_strings.push_back (launch_style_to_string (Trigger::Gate)); + launch_strings.push_back (launch_style_to_string (Trigger::Toggle)); + launch_strings.push_back (launch_style_to_string (Trigger::Repeat)); + + for (std::vector::const_iterator i = launch_strings.begin(); i != launch_strings.end(); ++i) { + if (i->length() > longest_launch.length()) { + longest_launch = *i; + } + } + } } TriggerUI::~TriggerUI() @@ -437,411 +452,3 @@ TriggerUI::set_trigger (ARDOUR::TriggerReference tr) trigger()->PropertyChanged.connect (trigger_connections, MISSING_INVALIDATOR, boost::bind (&TriggerUI::trigger_changed, this, _1), gui_context()); } - -/* **************************************** */ - -SlotPropertyTable::SlotPropertyTable () - : _color_button (ArdourButton::Element (ArdourButton::just_led_default_elements | ArdourButton::ColorBox)) - , _follow_action_button (ArdourButton::led_default_elements) - , _velocity_adjustment(1.,0.,1.0,0.01,0.1) - , _velocity_slider (&_velocity_adjustment, boost::shared_ptr(), 24/*length*/, 12/*girth*/ ) - , _follow_probability_adjustment(0,0,100,2,5) - , _follow_probability_slider (&_follow_probability_adjustment, boost::shared_ptr(), 24/*length*/, 12/*girth*/ ) - , _follow_count_adjustment (1, 1, 128, 1, 4) - , _follow_count_spinner (_follow_count_adjustment) - , _legato_button (ArdourButton::led_default_elements) - -{ - using namespace Gtk::Menu_Helpers; - - if (follow_strings.empty()) { - follow_strings.push_back (follow_action_to_string (Trigger::None)); - follow_strings.push_back (follow_action_to_string (Trigger::Stop)); - follow_strings.push_back (follow_action_to_string (Trigger::Again)); - follow_strings.push_back (follow_action_to_string (Trigger::QueuedTrigger)); - follow_strings.push_back (follow_action_to_string (Trigger::NextTrigger)); - follow_strings.push_back (follow_action_to_string (Trigger::PrevTrigger)); - follow_strings.push_back (follow_action_to_string (Trigger::FirstTrigger)); - follow_strings.push_back (follow_action_to_string (Trigger::LastTrigger)); - follow_strings.push_back (follow_action_to_string (Trigger::AnyTrigger)); - follow_strings.push_back (follow_action_to_string (Trigger::OtherTrigger)); - - for (std::vector::const_iterator i = follow_strings.begin(); i != follow_strings.end(); ++i) { - if (i->length() > longest_follow.length()) { - longest_follow = *i; - } - } - - launch_strings.push_back (launch_style_to_string (Trigger::OneShot)); - launch_strings.push_back (launch_style_to_string (Trigger::Gate)); - launch_strings.push_back (launch_style_to_string (Trigger::Toggle)); - launch_strings.push_back (launch_style_to_string (Trigger::Repeat)); - - for (std::vector::const_iterator i = launch_strings.begin(); i != launch_strings.end(); ++i) { - if (i->length() > longest_launch.length()) { - longest_launch = *i; - } - } - } - - set_spacings (2); - set_homogeneous (false); - - _follow_action_button.set_name("FollowAction"); - _follow_action_button.set_text (_("Follow Action")); - _follow_action_button.signal_event().connect (sigc::mem_fun (*this, (&SlotPropertyTable::follow_action_button_event))); - - _follow_count_spinner.set_can_focus(false); - _follow_count_spinner.signal_changed ().connect (sigc::mem_fun (*this, &SlotPropertyTable::follow_count_event)); - - _velocity_adjustment.signal_value_changed ().connect (sigc::mem_fun (*this, &SlotPropertyTable::velocity_adjusted)); - - _velocity_slider.set_name("FollowAction"); - - _follow_probability_adjustment.signal_value_changed ().connect (sigc::mem_fun (*this, &SlotPropertyTable::probability_adjusted)); - - _follow_probability_slider.set_name("FollowAction"); - - _follow_left.set_name("FollowAction"); - _follow_left.AddMenuElem (MenuElem (follow_action_to_string(Trigger::None), sigc::bind (sigc::mem_fun (*this, &SlotPropertyTable::set_follow_action), Trigger::None, 0))); - _follow_left.AddMenuElem (MenuElem (follow_action_to_string(Trigger::Stop), sigc::bind (sigc::mem_fun (*this, &SlotPropertyTable::set_follow_action), Trigger::Stop, 0))); - _follow_left.AddMenuElem (MenuElem (follow_action_to_string(Trigger::Again), sigc::bind (sigc::mem_fun (*this, &SlotPropertyTable::set_follow_action), Trigger::Again, 0))); - _follow_left.AddMenuElem (MenuElem (follow_action_to_string(Trigger::PrevTrigger), sigc::bind (sigc::mem_fun (*this, &SlotPropertyTable::set_follow_action), Trigger::PrevTrigger, 0))); - _follow_left.AddMenuElem (MenuElem (follow_action_to_string(Trigger::NextTrigger), sigc::bind (sigc::mem_fun (*this, &SlotPropertyTable::set_follow_action), Trigger::NextTrigger, 0))); - _follow_left.AddMenuElem (MenuElem (follow_action_to_string(Trigger::AnyTrigger), sigc::bind (sigc::mem_fun (*this, &SlotPropertyTable::set_follow_action), Trigger::AnyTrigger, 0))); - _follow_left.AddMenuElem (MenuElem (follow_action_to_string(Trigger::OtherTrigger), sigc::bind (sigc::mem_fun (*this, &SlotPropertyTable::set_follow_action), Trigger::OtherTrigger, 0))); - _follow_left.set_sizing_text (longest_follow); - - _follow_right.set_name("FollowAction"); - _follow_right.AddMenuElem (MenuElem (follow_action_to_string(Trigger::None), sigc::bind (sigc::mem_fun (*this, &SlotPropertyTable::set_follow_action), Trigger::None, 1))); - _follow_right.AddMenuElem (MenuElem (follow_action_to_string(Trigger::Stop), sigc::bind (sigc::mem_fun (*this, &SlotPropertyTable::set_follow_action), Trigger::Stop, 1))); - _follow_right.AddMenuElem (MenuElem (follow_action_to_string(Trigger::Again), sigc::bind (sigc::mem_fun (*this, &SlotPropertyTable::set_follow_action), Trigger::Again, 1))); - _follow_right.AddMenuElem (MenuElem (follow_action_to_string(Trigger::PrevTrigger), sigc::bind (sigc::mem_fun (*this, &SlotPropertyTable::set_follow_action), Trigger::PrevTrigger, 1))); - _follow_right.AddMenuElem (MenuElem (follow_action_to_string(Trigger::NextTrigger), sigc::bind (sigc::mem_fun (*this, &SlotPropertyTable::set_follow_action), Trigger::NextTrigger, 1))); - _follow_right.AddMenuElem (MenuElem (follow_action_to_string(Trigger::AnyTrigger), sigc::bind (sigc::mem_fun (*this, &SlotPropertyTable::set_follow_action), Trigger::AnyTrigger, 1))); - _follow_right.AddMenuElem (MenuElem (follow_action_to_string(Trigger::OtherTrigger), sigc::bind (sigc::mem_fun (*this, &SlotPropertyTable::set_follow_action), Trigger::OtherTrigger, 1))); - _follow_right.set_sizing_text (longest_follow); - - _launch_style_button.set_name("FollowAction"); - _launch_style_button.set_sizing_text (longest_launch); - _launch_style_button.AddMenuElem (MenuElem (launch_style_to_string (Trigger::OneShot), sigc::bind (sigc::mem_fun (*this, &SlotPropertyTable::set_launch_style), Trigger::OneShot))); - _launch_style_button.AddMenuElem (MenuElem (launch_style_to_string (Trigger::Gate), sigc::bind (sigc::mem_fun (*this, &SlotPropertyTable::set_launch_style), Trigger::Gate))); - _launch_style_button.AddMenuElem (MenuElem (launch_style_to_string (Trigger::Toggle), sigc::bind (sigc::mem_fun (*this, &SlotPropertyTable::set_launch_style), Trigger::Toggle))); - _launch_style_button.AddMenuElem (MenuElem (launch_style_to_string (Trigger::Repeat), sigc::bind (sigc::mem_fun (*this, &SlotPropertyTable::set_launch_style), Trigger::Repeat))); - - _launch_style_button.set_name("FollowAction"); - _legato_button.set_text (_("Legato")); - _legato_button.signal_event().connect (sigc::mem_fun (*this, (&SlotPropertyTable::legato_button_event))); - -#define quantize_item(b) _quantize_button.AddMenuElem (MenuElem (quantize_length_to_string (b), sigc::bind (sigc::mem_fun (*this, &SlotPropertyTable::set_quantize), b))); - -#if TRIGGER_PAGE_GLOBAL_QUANTIZATION_IMPLEMENTED - quantize_item (BBT_Offset (0, 0, 0)); -#endif - quantize_item (BBT_Offset (1, 0, 0)); - quantize_item (BBT_Offset (0, 4, 0)); - quantize_item (BBT_Offset (0, 2, 0)); - quantize_item (BBT_Offset (0, 1, 0)); - quantize_item (BBT_Offset (0, 0, Temporal::ticks_per_beat/2)); - quantize_item (BBT_Offset (0, 0, Temporal::ticks_per_beat/4)); - quantize_item (BBT_Offset (0, 0, Temporal::ticks_per_beat/8)); - quantize_item (BBT_Offset (0, 0, Temporal::ticks_per_beat/16)); - quantize_item (BBT_Offset (-1, 0, 0)); - - for (std::vector::const_iterator i = quantize_strings.begin(); i != quantize_strings.end(); ++i) { - if (i->length() > longest_quantize.length()) { - longest_quantize = *i; - } - } - _quantize_button.set_sizing_text (longest_quantize); - _quantize_button.set_name("FollowAction"); - -#undef quantize_item - - _name_label.set_name (X_("TrackNameEditor")); - _name_label.set_alignment (0.0, 0.5); - _name_label.set_padding (4, 0); - _name_label.set_width_chars (12); - - _namebox.add (_name_label); - _namebox.add_events (Gdk::BUTTON_PRESS_MASK); - _namebox.signal_button_press_event ().connect (sigc::mem_fun (*this, &SlotPropertyTable::namebox_button_press)); - - _name_frame.add (_namebox); - _name_frame.set_edge_color (0x000000ff); - _name_frame.set_border_width (0); - _name_frame.set_padding (0); - - _load_button.set_name("FollowAction"); - _load_button.set_text (_("Load")); - _load_button.signal_clicked.connect (sigc::mem_fun (*this, (&SlotPropertyTable::choose_sample))); - - _color_button.set_name("FollowAction"); - _color_button.signal_clicked.connect (sigc::mem_fun (*this, (&SlotPropertyTable::choose_color))); - - _follow_size_group = Gtk::SizeGroup::create (Gtk::SIZE_GROUP_VERTICAL); - _follow_size_group->add_widget(_name_frame); - _follow_size_group->add_widget(_load_button); - _follow_size_group->add_widget(_color_button); - _follow_size_group->add_widget(_velocity_slider); - _follow_size_group->add_widget(_follow_count_spinner); - - int row=0; - Gtk::Label *label; - - attach(_name_frame, 0, 2, row, row+1, Gtk::FILL, Gtk::SHRINK ); - attach(_load_button, 2, 3, row, row+1, Gtk::FILL, Gtk::SHRINK ); - attach(_color_button, 3, 4, row, row+1, Gtk::FILL, Gtk::SHRINK ); row++; - - label = manage(new Gtk::Label(_("Velocity Sense:"))); label->set_alignment(1.0, 0.5); - attach(*label, 0, 1, row, row+1, Gtk::FILL, Gtk::SHRINK ); - attach(_velocity_slider, 1, 3, row, row+1, Gtk::FILL, Gtk::SHRINK ); row++; - - label = manage(new Gtk::Label(_("Launch Style:"))); label->set_alignment(1.0, 0.5); - attach(*label, 0, 1, row, row+1, Gtk::FILL, Gtk::SHRINK ); - attach(_launch_style_button, 1, 3, row, row+1, Gtk::FILL, Gtk::SHRINK ); row++; - - label = manage(new Gtk::Label(_("Launch Quantize:"))); label->set_alignment(1.0, 0.5); - attach(*label, 0, 1, row, row+1, Gtk::FILL, Gtk::SHRINK ); - attach(_quantize_button, 1, 3, row, row+1, Gtk::FILL, Gtk::SHRINK ); row++; - - label = manage(new Gtk::Label(_("Legato Mode:"))); label->set_alignment(1.0, 0.5); - attach(*label, 0, 1, row, row+1, Gtk::FILL, Gtk::SHRINK ); - attach(_legato_button, 1, 3, row, row+1, Gtk::FILL, Gtk::SHRINK ); row++; - - attach(_follow_action_button, 0, 3, row, row+1, Gtk::FILL, Gtk::SHRINK ); row++; - - label = manage(new Gtk::Label(_("Follow Count:"))); label->set_alignment(1.0, 0.5); - attach(*label, 0, 1, row, row+1, Gtk::FILL, Gtk::SHRINK ); - Gtk::Alignment *align = manage (new Gtk::Alignment (0, .5, 0, 0)); - align->add (_follow_count_spinner); - attach(*align, 1, 3, row, row+1, Gtk::FILL, Gtk::SHRINK, 0, 0 ); row++; - - Gtkmm2ext::set_size_request_to_display_given_text (_left_probability_label, "100% Left ", 12, 0); - _left_probability_label.set_alignment(0.0, 0.5); - Gtkmm2ext::set_size_request_to_display_given_text (_right_probability_label, "100% Right", 12, 0); - _right_probability_label.set_alignment(1.0, 0.5); - - Gtk::Table *prob_table = manage(new Gtk::Table()); - prob_table->set_spacings(2); - prob_table->attach(_follow_probability_slider, 0, 2, 0, 1, Gtk::FILL, Gtk::SHRINK ); - prob_table->attach(_left_probability_label, 0, 1, 1, 2, Gtk::FILL, Gtk::SHRINK ); - prob_table->attach(_right_probability_label, 1, 2, 1, 2, Gtk::FILL, Gtk::SHRINK ); - - attach( *prob_table, 0, 3, row, row+1, Gtk::FILL, Gtk::SHRINK ); row++; - attach(_follow_left, 0, 1, row, row+1, Gtk::FILL, Gtk::SHRINK ); - attach(_follow_right, 1, 3, row, row+1, Gtk::FILL, Gtk::SHRINK ); row++; -} - -SlotPropertyTable::~SlotPropertyTable () -{ -} - -void -SlotPropertyTable::set_quantize (BBT_Offset bbo) -{ -#if TRIGGER_PAGE_GLOBAL_QUANTIZATION_IMPLEMENTED - if (bbo == BBT_Offset (0, 0, 0)) { - /* use grid */ - bbo = BBT_Offset (1, 2, 3); /* XXX get grid from editor */ - } -#endif - - trigger()->set_quantization (bbo); -} - -void -SlotPropertyTable::follow_count_event () -{ - trigger()->set_follow_count ((int) _follow_count_adjustment.get_value()); -} - -void -SlotPropertyTable::velocity_adjusted () -{ - trigger()->set_midi_velocity_effect (_velocity_adjustment.get_value()); -} - -void -SlotPropertyTable::probability_adjusted () -{ - trigger()->set_follow_action_probability ((int) _follow_probability_adjustment.get_value()); -} - -bool -SlotPropertyTable::follow_action_button_event (GdkEvent* ev) -{ - switch (ev->type) { - case GDK_BUTTON_PRESS: - trigger()->set_use_follow (!trigger()->use_follow()); - return true; - - default: - break; - } - - return false; -} - -bool -SlotPropertyTable::legato_button_event (GdkEvent* ev) -{ - switch (ev->type) { - case GDK_BUTTON_PRESS: - trigger()->set_legato (!trigger()->legato()); - return true; - - default: - break; - } - - return false; -} - -void -SlotPropertyTable::set_launch_style (Trigger::LaunchStyle ls) -{ - trigger()->set_launch_style (ls); -} - -void -SlotPropertyTable::set_follow_action (Trigger::FollowAction fa, uint64_t idx) -{ - trigger()->set_follow_action (fa, idx); -} - -void -SlotPropertyTable::on_trigger_changed (PropertyChange pc) -{ - if (pc.contains (Properties::name)) { - _name_label.set_text (trigger()->name()); - } - if (pc.contains (Properties::color)) { - _color_button.set_custom_led_color (trigger()->color()); - } - if (pc.contains (Properties::quantization)) { - BBT_Offset bbo (trigger()->quantization()); - _quantize_button.set_active (quantize_length_to_string (bbo)); - } - - if (pc.contains (Properties::use_follow)) { - _follow_action_button.set_active_state (trigger()->use_follow() ? Gtkmm2ext::ExplicitActive : Gtkmm2ext::Off); - } - - if (pc.contains (Properties::follow_count)) { - _follow_count_adjustment.set_value (trigger()->follow_count()); - } - - if (pc.contains (Properties::legato)) { - _legato_button.set_active_state (trigger()->legato() ? Gtkmm2ext::ExplicitActive : Gtkmm2ext::Off); - } - - if (pc.contains (Properties::launch_style)) { - _launch_style_button.set_active (launch_style_to_string (trigger()->launch_style())); - } - - if (pc.contains (Properties::follow_action0)) { - _follow_left.set_text (follow_action_to_string (trigger()->follow_action (0))); - } - - if (pc.contains (Properties::follow_action1)) { - _follow_right.set_text (follow_action_to_string (trigger()->follow_action (1))); - } - - if (pc.contains (Properties::velocity_effect)) { - _velocity_adjustment.set_value (trigger()->midi_velocity_effect()); - } - - if (pc.contains (Properties::follow_action_probability)) { - int pval = trigger()->follow_action_probability(); - _follow_probability_adjustment.set_value (pval); - _left_probability_label.set_text (string_compose(_("%1%% Left"), 100-pval)); - _right_probability_label.set_text (string_compose(_("%1%% Right"), pval)); - } - - if (trigger()->use_follow()) { - _follow_left.set_sensitive(true); - _follow_right.set_sensitive(true); - _follow_count_spinner.set_sensitive(true); - _follow_probability_slider.set_sensitive(true); - _left_probability_label.set_sensitive(true); - _right_probability_label.set_sensitive(true); - } else { - _follow_left.set_sensitive(false); - _follow_right.set_sensitive(false); - _follow_count_spinner.set_sensitive(false); - _follow_probability_slider.set_sensitive(false); - _left_probability_label.set_sensitive(false); - _right_probability_label.set_sensitive(false); - } -} - -/* ------------ */ - -SlotPropertyWidget::SlotPropertyWidget () -{ - ui = new SlotPropertyTable (); - pack_start(*ui); - ui->show(); -// set_background_color (UIConfiguration::instance().color (X_("theme:bg"))); -} - -/* ------------ */ - -SlotPropertyWindow::SlotPropertyWindow (TriggerReference tref) -{ - TriggerPtr trigger (tref.trigger()); - - set_title (string_compose (_("Trigger: %1"), trigger->name())); - - SlotPropertiesBox* slot_prop_box = manage (new SlotPropertiesBox ()); - slot_prop_box->set_slot (tref); - - Gtk::Table* table = manage (new Gtk::Table); - table->set_homogeneous (false); - table->set_spacings (16); - table->set_border_width (8); - - int col = 0; - table->attach(*slot_prop_box, col, col+1, 0, 1, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::EXPAND ); col++; - - if (trigger->region()) { - if (trigger->region()->data_type() == DataType::AUDIO) { - _trig_box = manage(new AudioTriggerPropertiesBox ()); - _ops_box = manage(new AudioRegionOperationsBox ()); - _trim_box = manage(new AudioClipEditorBox ()); - - _trig_box->set_trigger (tref); - } else { - _trig_box = manage(new MidiTriggerPropertiesBox ()); - _ops_box = manage(new MidiRegionOperationsBox ()); - _trim_box = manage(new MidiClipEditorBox ()); - - _trig_box->set_trigger (tref); - } - - _trim_box->set_region(trigger->region(), tref); - _ops_box->set_session(&trigger->region()->session()); - - table->attach(*_trig_box, col, col+1, 0, 1, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::EXPAND ); col++; - table->attach(*_trim_box, col, col+1, 0, 1, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::EXPAND ); col++; - table->attach(*_ops_box, col, col+1, 0, 1, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::EXPAND ); col++; - } - - add (*table); - table->show_all(); -} - -bool -SlotPropertyWindow::on_key_press_event (GdkEventKey* ev) -{ - Gtk::Window& main_window (ARDOUR_UI::instance()->main_window()); - return ARDOUR_UI_UTILS::relay_key_press (ev, &main_window); -} - -bool -SlotPropertyWindow::on_key_release_event (GdkEventKey* ev) -{ - Gtk::Window& main_window (ARDOUR_UI::instance()->main_window()); - return ARDOUR_UI_UTILS::relay_key_press (ev, &main_window); -} diff --git a/gtk2_ardour/trigger_ui.h b/gtk2_ardour/trigger_ui.h index b5150cf4c4..21584c7645 100644 --- a/gtk2_ardour/trigger_ui.h +++ b/gtk2_ardour/trigger_ui.h @@ -19,21 +19,13 @@ #ifndef __ardour_gtk_trigger_ui_h__ #define __ardour_gtk_trigger_ui_h__ +#include "gtkmm/colorselection.h" + #include "ardour/triggerbox.h" #include "widgets/ardour_button.h" #include "widgets/slider_controller.h" #include "widgets/frame.h" -namespace ArdourWidgets { - class ArdourButton; - class HSliderController; -} - -class TriggerPropertiesBox; -class RegionPropertiesBox; -class RegionOperationsBox; -class ClipEditorBox; - class TriggerUI { public: @@ -49,6 +41,13 @@ public: static std::string quantize_length_to_string (Temporal::BBT_Offset const &); static std::string launch_style_to_string (ARDOUR::Trigger::LaunchStyle); + static std::vector follow_strings; + static std::string longest_follow; + static std::vector quantize_strings; + static std::string longest_quantize; + static std::vector launch_strings; + static std::string longest_launch; + private: void trigger_changed (PBD::PropertyChange); //calls on_trigger_changed to subclasses @@ -86,76 +85,6 @@ protected: PBD::ScopedConnectionList trigger_connections; }; -class SlotPropertyTable : public TriggerUI, public Gtk::Table -{ - public: - SlotPropertyTable (); - ~SlotPropertyTable (); - Glib::RefPtr _follow_size_group; - ArdourWidgets::ArdourButton _color_button; - - ArdourWidgets::ArdourButton _load_button; - - ArdourWidgets::ArdourButton _follow_action_button; - - Gtk::Adjustment _velocity_adjustment; - ArdourWidgets::HSliderController _velocity_slider; - - Gtk::Label _left_probability_label; - Gtk::Label _right_probability_label; - Gtk::Adjustment _follow_probability_adjustment; - ArdourWidgets::HSliderController _follow_probability_slider; - - Gtk::Adjustment _follow_count_adjustment; - Gtk::SpinButton _follow_count_spinner; - - ArdourWidgets::ArdourDropdown _follow_left; - ArdourWidgets::ArdourDropdown _follow_right; - - ArdourWidgets::ArdourButton _legato_button; - - ArdourWidgets::ArdourDropdown _quantize_button; - - ArdourWidgets::ArdourDropdown _launch_style_button; - - void set_quantize (Temporal::BBT_Offset); - void set_launch_style (ARDOUR::Trigger::LaunchStyle); - void set_follow_action (ARDOUR::Trigger::FollowAction, uint64_t); - - void on_trigger_changed (PBD::PropertyChange); - - bool follow_action_button_event (GdkEvent*); - bool legato_button_event (GdkEvent*); - void follow_count_event (); - - void probability_adjusted (); - void velocity_adjusted (); -}; - -class SlotPropertyWidget : public Gtk::VBox -{ - public: - SlotPropertyWidget (); - void set_trigger (ARDOUR::TriggerReference tr) const { ui->set_trigger(tr); } - - private: - SlotPropertyTable* ui; -}; - -/* XXX probably for testing only */ - -class SlotPropertyWindow : public Gtk::Window -{ - public: - SlotPropertyWindow (ARDOUR::TriggerReference); - - bool on_key_press_event (GdkEventKey*); - bool on_key_release_event (GdkEventKey*); - - TriggerPropertiesBox *_trig_box; - RegionOperationsBox *_ops_box; - ClipEditorBox *_trim_box; -}; #endif /* __ardour_gtk_trigger_ui_h__ */ diff --git a/gtk2_ardour/triggerbox_ui.cc b/gtk2_ardour/triggerbox_ui.cc index 1b1bc46df5..9934225f49 100644 --- a/gtk2_ardour/triggerbox_ui.cc +++ b/gtk2_ardour/triggerbox_ui.cc @@ -22,6 +22,7 @@ #include #include #include +#include "gtkmm/sizegroup.h" #include "pbd/compose.h" #include "pbd/convert.h" @@ -53,6 +54,7 @@ #include "timers.h" #include "trigger_ui.h" #include "triggerbox_ui.h" +#include "slot_properties_box.h" #include "ui_config.h" #include "utils.h" diff --git a/libs/widgets/widgets/frame.h b/libs/widgets/widgets/frame.h index 875670eaae..6a18052af1 100644 --- a/libs/widgets/widgets/frame.h +++ b/libs/widgets/widgets/frame.h @@ -22,6 +22,7 @@ #include #include +#include "gtkmm2ext/colors.h" #include "gtkmm2ext/cairo_theme.h" #include "widgets/visibility.h"