diff --git a/gtk2_ardour/audio_clip_editor.cc b/gtk2_ardour/audio_clip_editor.cc index cbbad24d2d..fe7220e9e3 100644 --- a/gtk2_ardour/audio_clip_editor.cc +++ b/gtk2_ardour/audio_clip_editor.cc @@ -144,6 +144,7 @@ AudioClipEditor::AudioClipEditor () scroll_bar_handle->set_outline (false); scroll_bar_handle->set_corner_radius (5.); scroll_bar_handle->Event.connect (sigc::mem_fun (*this, &AudioClipEditor::scroll_event_handler)); + scroll_bar_handle->disable_scroll_translation (); /* A scrolling container for our waves and lines etc. */ diff --git a/gtk2_ardour/cuebox_ui.cc b/gtk2_ardour/cuebox_ui.cc index 696aeaaea0..8a4797426d 100644 --- a/gtk2_ardour/cuebox_ui.cc +++ b/gtk2_ardour/cuebox_ui.cc @@ -244,15 +244,16 @@ CueBoxUI::context_menu (uint64_t idx) Menu* follow_menu = manage (new Menu); MenuList& fitems = follow_menu->items (); - fitems.push_back (MenuElem (TriggerUI::follow_action_to_string(Trigger::None), sigc::bind (sigc::mem_fun (*this, &CueBoxUI::set_all_follow_action), Trigger::None, idx))); - fitems.push_back (MenuElem (TriggerUI::follow_action_to_string(Trigger::Stop), sigc::bind (sigc::mem_fun (*this, &CueBoxUI::set_all_follow_action), Trigger::Stop, idx))); - fitems.push_back (MenuElem (TriggerUI::follow_action_to_string(Trigger::Again), sigc::bind (sigc::mem_fun (*this, &CueBoxUI::set_all_follow_action), Trigger::Again, idx))); - fitems.push_back (MenuElem (TriggerUI::follow_action_to_string(Trigger::PrevTrigger), sigc::bind (sigc::mem_fun (*this, &CueBoxUI::set_all_follow_action), Trigger::PrevTrigger, idx))); - fitems.push_back (MenuElem (TriggerUI::follow_action_to_string(Trigger::NextTrigger), sigc::bind (sigc::mem_fun (*this, &CueBoxUI::set_all_follow_action), Trigger::NextTrigger, idx))); - fitems.push_back (MenuElem (TriggerUI::follow_action_to_string(Trigger::ReverseTrigger), sigc::bind (sigc::mem_fun (*this, &CueBoxUI::set_all_follow_action), Trigger::ReverseTrigger, idx))); - fitems.push_back (MenuElem (TriggerUI::follow_action_to_string(Trigger::ForwardTrigger), sigc::bind (sigc::mem_fun (*this, &CueBoxUI::set_all_follow_action), Trigger::ForwardTrigger, idx))); - fitems.push_back (MenuElem (TriggerUI::follow_action_to_string(Trigger::AnyTrigger), sigc::bind (sigc::mem_fun (*this, &CueBoxUI::set_all_follow_action), Trigger::AnyTrigger, idx))); - fitems.push_back (MenuElem (TriggerUI::follow_action_to_string(Trigger::OtherTrigger), sigc::bind (sigc::mem_fun (*this, &CueBoxUI::set_all_follow_action), Trigger::OtherTrigger, idx))); + fitems.push_back (MenuElem (TriggerUI::follow_action_to_string(FollowAction (FollowAction::None)), sigc::bind (sigc::mem_fun (*this, &CueBoxUI::set_all_follow_action), FollowAction (FollowAction::None), idx))); + fitems.push_back (MenuElem (TriggerUI::follow_action_to_string(FollowAction (FollowAction::Stop)), sigc::bind (sigc::mem_fun (*this, &CueBoxUI::set_all_follow_action), FollowAction (FollowAction::Stop), idx))); + fitems.push_back (MenuElem (TriggerUI::follow_action_to_string(FollowAction (FollowAction::Again)), sigc::bind (sigc::mem_fun (*this, &CueBoxUI::set_all_follow_action), FollowAction (FollowAction::Again), idx))); + fitems.push_back (MenuElem (TriggerUI::follow_action_to_string(FollowAction (FollowAction::PrevTrigger)), sigc::bind (sigc::mem_fun (*this, &CueBoxUI::set_all_follow_action), FollowAction (FollowAction::PrevTrigger), idx))); + fitems.push_back (MenuElem (TriggerUI::follow_action_to_string(FollowAction (FollowAction::NextTrigger)), sigc::bind (sigc::mem_fun (*this, &CueBoxUI::set_all_follow_action), FollowAction (FollowAction::NextTrigger), idx))); + fitems.push_back (MenuElem (TriggerUI::follow_action_to_string(FollowAction (FollowAction::ReverseTrigger)), sigc::bind (sigc::mem_fun (*this, &CueBoxUI::set_all_follow_action), FollowAction (FollowAction::ReverseTrigger), idx))); + fitems.push_back (MenuElem (TriggerUI::follow_action_to_string(FollowAction (FollowAction::ForwardTrigger)), sigc::bind (sigc::mem_fun (*this, &CueBoxUI::set_all_follow_action), FollowAction (FollowAction::ForwardTrigger), idx))); + fitems.push_back (MenuElem (TriggerUI::follow_action_to_string(FollowAction (FollowAction::AnyTrigger)), sigc::bind (sigc::mem_fun (*this, &CueBoxUI::set_all_follow_action), FollowAction (FollowAction::AnyTrigger), idx))); + fitems.push_back (MenuElem (TriggerUI::follow_action_to_string(FollowAction (FollowAction::OtherTrigger)), sigc::bind (sigc::mem_fun (*this, &CueBoxUI::set_all_follow_action), FollowAction (FollowAction::OtherTrigger), idx))); + fitems.push_back (MenuElem (TriggerUI::follow_action_to_string(FollowAction (FollowAction::JumpTrigger)), sigc::bind (sigc::mem_fun (*this, &CueBoxUI::set_all_follow_action), FollowAction (FollowAction::JumpTrigger), idx))); Menu* launch_menu = manage (new Menu); MenuList& litems = launch_menu->items (); @@ -355,7 +356,7 @@ CueBoxUI::set_all_colors (uint64_t idx) } void -CueBoxUI::set_all_follow_action (Trigger::FollowAction fa, uint64_t idx) +CueBoxUI::set_all_follow_action (FollowAction const & fa, uint64_t idx) { TriggerList tl; get_slots(tl, idx); @@ -426,7 +427,7 @@ CueBoxUI::build () _slots.clear (); - for (int32_t n = 0; n < TriggerBox::default_triggers_per_box; ++n) { // TODO + for (int32_t n = 0; n < default_triggers_per_box; ++n) { // TODO CueEntry* te = new CueEntry (this, n); _slots.push_back (te); @@ -446,7 +447,7 @@ CueBoxUI::_size_allocate (ArdourCanvas::Rect const& alloc) const float width = alloc.width (); const float height = alloc.height (); - const float slot_h = height / TriggerBox::default_triggers_per_box; // TODO + const float slot_h = height / default_triggers_per_box; // TODO float ypos = 0; for (auto& slot : _slots) { @@ -508,10 +509,10 @@ CueBoxWidget::on_unmap () CueBoxWindow::CueBoxWindow () { - CueBoxWidget* tbw = manage (new CueBoxWidget (-1., TriggerBox::default_triggers_per_box * 16.)); + CueBoxWidget* tbw = manage (new CueBoxWidget (-1., default_triggers_per_box * 16.)); set_title (_("CueBox for XXXX")); - set_default_size (-1., TriggerBox::default_triggers_per_box * 16.); + set_default_size (-1., default_triggers_per_box * 16.); add (*tbw); tbw->show (); } diff --git a/gtk2_ardour/cuebox_ui.h b/gtk2_ardour/cuebox_ui.h index d68c28bf4a..fcbdb3db84 100644 --- a/gtk2_ardour/cuebox_ui.h +++ b/gtk2_ardour/cuebox_ui.h @@ -88,7 +88,7 @@ private: void clear_all_triggers(uint64_t idx); void set_all_colors (uint64_t idx); - void set_all_follow_action (ARDOUR::Trigger::FollowAction, uint64_t idx); + void set_all_follow_action (ARDOUR::FollowAction const &, uint64_t idx); void set_all_launch_style (ARDOUR::Trigger::LaunchStyle, uint64_t idx); void set_all_quantization (Temporal::BBT_Offset const&, uint64_t idx); diff --git a/gtk2_ardour/editor_audio_import.cc b/gtk2_ardour/editor_audio_import.cc index a9e9ef00f4..7b5b236c47 100644 --- a/gtk2_ardour/editor_audio_import.cc +++ b/gtk2_ardour/editor_audio_import.cc @@ -1149,7 +1149,7 @@ Editor::finish_bringing_in_material (boost::shared_ptr region, if (mode == ImportAsTrigger) { boost::shared_ptr copy (RegionFactory::create (region, true)); - for (int s = 0; s < TriggerBox::default_triggers_per_box; ++s) { + for (int s = 0; s < default_triggers_per_box; ++s) { if (!existing_track->triggerbox ()->trigger (s)->region ()) { existing_track->triggerbox ()->set_from_selection (s, copy); break; diff --git a/gtk2_ardour/editor_ops.cc b/gtk2_ardour/editor_ops.cc index e959b9625f..adc757e682 100644 --- a/gtk2_ardour/editor_ops.cc +++ b/gtk2_ardour/editor_ops.cc @@ -4186,7 +4186,7 @@ Editor::bounce_range_selection (BounceTarget target, bool enable_processing) HBox* tbox = manage (new HBox); tslot = manage (new ArdourDropdown ()); - for (int c = 0; c < TriggerBox::default_triggers_per_box; ++c) { + for (int c = 0; c < default_triggers_per_box; ++c) { // XXX ('A' + x) is not translatable, TODO abstract using nth_letter() tslot->AddMenuElem (Menu_Helpers::MenuElem (string_compose ("%1", (char)('A' + c)), sigc::bind ([] (uint32_t* t, uint32_t v) {*t = v;}, &trigger_slot, c))); } diff --git a/gtk2_ardour/editor_routes.h b/gtk2_ardour/editor_routes.h index 095a1ffdff..4f4357ba56 100644 --- a/gtk2_ardour/editor_routes.h +++ b/gtk2_ardour/editor_routes.h @@ -26,13 +26,20 @@ #include #include #include +#include +#include "pbd/properties.h" #include "pbd/signals.h" + +#include "ardour/route.h" +#include "ardour/session_handle.h" +#include "ardour/types.h" + #include "gtkmm2ext/widget_state.h" #include "editor_component.h" -class VCATimeAxisView; +class TimeAxisView; class EditorRoutes : public EditorComponent, public PBD::ScopedConnectionList, public ARDOUR::SessionHandlePtr { @@ -86,7 +93,6 @@ private: void on_tv_solo_isolate_toggled (std::string const &); void on_tv_solo_safe_toggled (std::string const &); void build_menu (); - void presentation_info_changed (PBD::PropertyChange const &); void row_deleted (Gtk::TreeModel::Path const &); void visible_changed (std::string const &); void trigger_changed (std::string const &); @@ -197,7 +203,7 @@ private: bool _redisplay_on_resume; bool _idle_update_queued; - volatile int _redisplay_active; + int _redisplay_active; Gtk::Menu* _menu; Gtk::Widget* old_focus; diff --git a/gtk2_ardour/editor_rulers.cc b/gtk2_ardour/editor_rulers.cc index 7ef47d7ac6..835c767e8e 100644 --- a/gtk2_ardour/editor_rulers.cc +++ b/gtk2_ardour/editor_rulers.cc @@ -251,7 +251,7 @@ Editor::popup_ruler_menu (timepos_t const & where, ItemType t) cme = static_cast (&ruler_items.back()); cme->set_active (Config->get_cue_behavior() != ARDOUR::FollowCues); cme->signal_activate().connect (sigc::mem_fun (*this, &Editor::toggle_cue_behavior)); - for (int32_t n = 0; n < TriggerBox::default_triggers_per_box; ++n) { + for (int32_t n = 0; n < default_triggers_per_box; ++n) { /* XXX the "letter" names of the cues need to be subject to i18n somehow */ ruler_items.push_back (MenuElem (string_compose (_("Cue %1"), (char) ('A' + n)), sigc::bind (sigc::mem_fun(*this, &Editor::mouse_add_new_marker), where, Location::IsCueMarker, n))); } diff --git a/gtk2_ardour/mixer_strip.cc b/gtk2_ardour/mixer_strip.cc index 08ec1708e2..999943603f 100644 --- a/gtk2_ardour/mixer_strip.cc +++ b/gtk2_ardour/mixer_strip.cc @@ -112,7 +112,7 @@ MixerStrip::MixerStrip (Mixer_UI& mx, Session* sess, bool in_mixer) , processor_box (sess, boost::bind (&MixerStrip::plugin_selector, this), mx.selection(), this, in_mixer) , gpm (sess, 250) , panners (sess) - , trigger_display (-1., TriggerBox::default_triggers_per_box*16.) + , trigger_display (-1., default_triggers_per_box*16.) , button_size_group (Gtk::SizeGroup::create (Gtk::SIZE_GROUP_HORIZONTAL)) , rec_mon_table (2, 2) , solo_iso_table (1, 2) diff --git a/gtk2_ardour/slot_properties_box.cc b/gtk2_ardour/slot_properties_box.cc index 9bfb1a4b95..a1e788deb6 100644 --- a/gtk2_ardour/slot_properties_box.cc +++ b/gtk2_ardour/slot_properties_box.cc @@ -137,27 +137,29 @@ SlotPropertyTable::SlotPropertyTable () _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::ReverseTrigger), sigc::bind (sigc::mem_fun (*this, &SlotPropertyTable::set_follow_action), Trigger::ReverseTrigger, 0))); - _follow_left.AddMenuElem (MenuElem (follow_action_to_string(Trigger::ForwardTrigger), sigc::bind (sigc::mem_fun (*this, &SlotPropertyTable::set_follow_action), Trigger::ForwardTrigger, 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.AddMenuElem (MenuElem (follow_action_to_string(FollowAction (FollowAction::None)), sigc::bind (sigc::mem_fun (*this, &SlotPropertyTable::set_follow_action), FollowAction (FollowAction::None), 0))); + _follow_left.AddMenuElem (MenuElem (follow_action_to_string(FollowAction (FollowAction::Stop)), sigc::bind (sigc::mem_fun (*this, &SlotPropertyTable::set_follow_action), FollowAction (FollowAction::Stop), 0))); + _follow_left.AddMenuElem (MenuElem (follow_action_to_string(FollowAction (FollowAction::Again)), sigc::bind (sigc::mem_fun (*this, &SlotPropertyTable::set_follow_action), FollowAction (FollowAction::Again), 0))); + _follow_left.AddMenuElem (MenuElem (follow_action_to_string(FollowAction (FollowAction::PrevTrigger)), sigc::bind (sigc::mem_fun (*this, &SlotPropertyTable::set_follow_action), FollowAction (FollowAction::PrevTrigger), 0))); + _follow_left.AddMenuElem (MenuElem (follow_action_to_string(FollowAction (FollowAction::NextTrigger)), sigc::bind (sigc::mem_fun (*this, &SlotPropertyTable::set_follow_action), FollowAction (FollowAction::NextTrigger), 0))); + _follow_left.AddMenuElem (MenuElem (follow_action_to_string(FollowAction (FollowAction::ReverseTrigger)), sigc::bind (sigc::mem_fun (*this, &SlotPropertyTable::set_follow_action), FollowAction (FollowAction::ReverseTrigger), 0))); + _follow_left.AddMenuElem (MenuElem (follow_action_to_string(FollowAction (FollowAction::ForwardTrigger)), sigc::bind (sigc::mem_fun (*this, &SlotPropertyTable::set_follow_action), FollowAction (FollowAction::ForwardTrigger), 0))); + _follow_left.AddMenuElem (MenuElem (follow_action_to_string(FollowAction (FollowAction::AnyTrigger)), sigc::bind (sigc::mem_fun (*this, &SlotPropertyTable::set_follow_action), FollowAction (FollowAction::AnyTrigger), 0))); + _follow_left.AddMenuElem (MenuElem (follow_action_to_string(FollowAction (FollowAction::OtherTrigger)), sigc::bind (sigc::mem_fun (*this, &SlotPropertyTable::set_follow_action), FollowAction (FollowAction::OtherTrigger), 0))); + _follow_left.AddMenuElem (MenuElem (follow_action_to_string(FollowAction (FollowAction::JumpTrigger)), sigc::bind (sigc::mem_fun (*this, &SlotPropertyTable::set_follow_action), FollowAction (FollowAction::JumpTrigger), 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::ReverseTrigger), sigc::bind (sigc::mem_fun (*this, &SlotPropertyTable::set_follow_action), Trigger::ReverseTrigger, 1))); - _follow_right.AddMenuElem (MenuElem (follow_action_to_string(Trigger::ForwardTrigger), sigc::bind (sigc::mem_fun (*this, &SlotPropertyTable::set_follow_action), Trigger::ForwardTrigger, 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.AddMenuElem (MenuElem (follow_action_to_string(FollowAction (FollowAction::None)), sigc::bind (sigc::mem_fun (*this, &SlotPropertyTable::set_follow_action), FollowAction (FollowAction::None), 1))); + _follow_right.AddMenuElem (MenuElem (follow_action_to_string(FollowAction (FollowAction::Stop)), sigc::bind (sigc::mem_fun (*this, &SlotPropertyTable::set_follow_action), FollowAction (FollowAction::Stop), 1))); + _follow_right.AddMenuElem (MenuElem (follow_action_to_string(FollowAction (FollowAction::Again)), sigc::bind (sigc::mem_fun (*this, &SlotPropertyTable::set_follow_action), FollowAction (FollowAction::Again), 1))); + _follow_right.AddMenuElem (MenuElem (follow_action_to_string(FollowAction (FollowAction::PrevTrigger)), sigc::bind (sigc::mem_fun (*this, &SlotPropertyTable::set_follow_action), FollowAction (FollowAction::PrevTrigger), 1))); + _follow_right.AddMenuElem (MenuElem (follow_action_to_string(FollowAction (FollowAction::NextTrigger)), sigc::bind (sigc::mem_fun (*this, &SlotPropertyTable::set_follow_action), FollowAction (FollowAction::NextTrigger), 1))); + _follow_right.AddMenuElem (MenuElem (follow_action_to_string(FollowAction (FollowAction::ReverseTrigger)), sigc::bind (sigc::mem_fun (*this, &SlotPropertyTable::set_follow_action), FollowAction (FollowAction::ReverseTrigger), 1))); + _follow_right.AddMenuElem (MenuElem (follow_action_to_string(FollowAction (FollowAction::ForwardTrigger)), sigc::bind (sigc::mem_fun (*this, &SlotPropertyTable::set_follow_action), FollowAction (FollowAction::ForwardTrigger), 1))); + _follow_right.AddMenuElem (MenuElem (follow_action_to_string(FollowAction (FollowAction::AnyTrigger)), sigc::bind (sigc::mem_fun (*this, &SlotPropertyTable::set_follow_action), FollowAction (FollowAction::AnyTrigger), 1))); + _follow_right.AddMenuElem (MenuElem (follow_action_to_string(FollowAction (FollowAction::OtherTrigger)), sigc::bind (sigc::mem_fun (*this, &SlotPropertyTable::set_follow_action), FollowAction (FollowAction::OtherTrigger), 1))); + _follow_right.AddMenuElem (MenuElem (follow_action_to_string(FollowAction (FollowAction::JumpTrigger)), sigc::bind (sigc::mem_fun (*this, &SlotPropertyTable::set_follow_action), FollowAction (FollowAction::JumpTrigger), 1))); _follow_right.set_sizing_text (longest_follow); _launch_style_button.set_name("FollowAction"); @@ -468,7 +470,7 @@ SlotPropertyTable::set_launch_style (Trigger::LaunchStyle ls) } void -SlotPropertyTable::set_follow_action (Trigger::FollowAction fa, uint64_t idx) +SlotPropertyTable::set_follow_action (FollowAction const & fa, uint64_t idx) { if (_ignore_changes) { return; @@ -538,7 +540,7 @@ SlotPropertyTable::on_trigger_changed (PropertyChange const& pc) _follow_left.set_text (follow_action_to_string (trigger()->follow_action (0))); /* set widget sensitivity based on 'left' follow action */ - bool follow_widgets_sensitive = trigger()->follow_action (0) != Trigger::None; + bool follow_widgets_sensitive = trigger()->follow_action (0).type != FollowAction::None; if (follow_widgets_sensitive) { _follow_right.set_sensitive(true); _follow_count_spinner.set_sensitive(true); diff --git a/gtk2_ardour/slot_properties_box.h b/gtk2_ardour/slot_properties_box.h index df2c9acc55..40fc3dd4aa 100644 --- a/gtk2_ardour/slot_properties_box.h +++ b/gtk2_ardour/slot_properties_box.h @@ -109,7 +109,7 @@ class SlotPropertyTable : public TriggerUI, public Gtk::Table void set_quantize (Temporal::BBT_Offset); void set_launch_style (ARDOUR::Trigger::LaunchStyle); - void set_follow_action (ARDOUR::Trigger::FollowAction, uint64_t); + void set_follow_action (ARDOUR::FollowAction const &, uint64_t); void on_trigger_changed (PBD::PropertyChange const& ); diff --git a/gtk2_ardour/trigger_master.cc b/gtk2_ardour/trigger_master.cc index 19f71dcf67..afbc5f1ec2 100644 --- a/gtk2_ardour/trigger_master.cc +++ b/gtk2_ardour/trigger_master.cc @@ -341,15 +341,16 @@ TriggerMaster::context_menu () Menu* follow_menu = manage (new Menu); MenuList& fitems = follow_menu->items (); - fitems.push_back (MenuElem (TriggerUI::follow_action_to_string(Trigger::None), sigc::bind (sigc::mem_fun (*this, &TriggerMaster::set_all_follow_action), Trigger::None))); - fitems.push_back (MenuElem (TriggerUI::follow_action_to_string(Trigger::Stop), sigc::bind (sigc::mem_fun (*this, &TriggerMaster::set_all_follow_action), Trigger::Stop))); - fitems.push_back (MenuElem (TriggerUI::follow_action_to_string(Trigger::Again), sigc::bind (sigc::mem_fun (*this, &TriggerMaster::set_all_follow_action), Trigger::Again))); - fitems.push_back (MenuElem (TriggerUI::follow_action_to_string(Trigger::PrevTrigger), sigc::bind (sigc::mem_fun (*this, &TriggerMaster::set_all_follow_action), Trigger::PrevTrigger))); - fitems.push_back (MenuElem (TriggerUI::follow_action_to_string(Trigger::NextTrigger), sigc::bind (sigc::mem_fun (*this, &TriggerMaster::set_all_follow_action), Trigger::NextTrigger))); - fitems.push_back (MenuElem (TriggerUI::follow_action_to_string(Trigger::ForwardTrigger), sigc::bind (sigc::mem_fun (*this, &TriggerMaster::set_all_follow_action), Trigger::ForwardTrigger))); - fitems.push_back (MenuElem (TriggerUI::follow_action_to_string(Trigger::ReverseTrigger), sigc::bind (sigc::mem_fun (*this, &TriggerMaster::set_all_follow_action), Trigger::ReverseTrigger))); - fitems.push_back (MenuElem (TriggerUI::follow_action_to_string(Trigger::AnyTrigger), sigc::bind (sigc::mem_fun (*this, &TriggerMaster::set_all_follow_action), Trigger::AnyTrigger))); - fitems.push_back (MenuElem (TriggerUI::follow_action_to_string(Trigger::OtherTrigger), sigc::bind (sigc::mem_fun (*this, &TriggerMaster::set_all_follow_action), Trigger::OtherTrigger))); + fitems.push_back (MenuElem (TriggerUI::follow_action_to_string(FollowAction (FollowAction::None)), sigc::bind (sigc::mem_fun (*this, &TriggerMaster::set_all_follow_action), FollowAction (FollowAction::None)))); + fitems.push_back (MenuElem (TriggerUI::follow_action_to_string(FollowAction (FollowAction::Stop)), sigc::bind (sigc::mem_fun (*this, &TriggerMaster::set_all_follow_action), FollowAction (FollowAction::Stop)))); + fitems.push_back (MenuElem (TriggerUI::follow_action_to_string(FollowAction (FollowAction::Again)), sigc::bind (sigc::mem_fun (*this, &TriggerMaster::set_all_follow_action), FollowAction (FollowAction::Again)))); + fitems.push_back (MenuElem (TriggerUI::follow_action_to_string(FollowAction (FollowAction::PrevTrigger)), sigc::bind (sigc::mem_fun (*this, &TriggerMaster::set_all_follow_action), FollowAction (FollowAction::PrevTrigger)))); + fitems.push_back (MenuElem (TriggerUI::follow_action_to_string(FollowAction (FollowAction::NextTrigger)), sigc::bind (sigc::mem_fun (*this, &TriggerMaster::set_all_follow_action), FollowAction (FollowAction::NextTrigger)))); + fitems.push_back (MenuElem (TriggerUI::follow_action_to_string(FollowAction (FollowAction::ForwardTrigger)), sigc::bind (sigc::mem_fun (*this, &TriggerMaster::set_all_follow_action), FollowAction (FollowAction::ForwardTrigger)))); + fitems.push_back (MenuElem (TriggerUI::follow_action_to_string(FollowAction (FollowAction::ReverseTrigger)), sigc::bind (sigc::mem_fun (*this, &TriggerMaster::set_all_follow_action), FollowAction (FollowAction::ReverseTrigger)))); + fitems.push_back (MenuElem (TriggerUI::follow_action_to_string(FollowAction (FollowAction::AnyTrigger)), sigc::bind (sigc::mem_fun (*this, &TriggerMaster::set_all_follow_action), FollowAction (FollowAction::AnyTrigger)))); + fitems.push_back (MenuElem (TriggerUI::follow_action_to_string(FollowAction (FollowAction::OtherTrigger)), sigc::bind (sigc::mem_fun (*this, &TriggerMaster::set_all_follow_action), FollowAction (FollowAction::OtherTrigger)))); + fitems.push_back (MenuElem (TriggerUI::follow_action_to_string(FollowAction (FollowAction::JumpTrigger)), sigc::bind (sigc::mem_fun (*this, &TriggerMaster::set_all_follow_action), FollowAction (FollowAction::JumpTrigger)))); Menu* launch_menu = manage (new Menu); MenuList& litems = launch_menu->items (); @@ -441,7 +442,7 @@ TriggerMaster::set_all_colors () case Gtk::RESPONSE_ACCEPT: { c = _color_dialog.get_colorsel()->get_current_color(); color_t ct = ARDOUR_UI_UTILS::gdk_color_to_rgba(c); - for (int n = 0; n< TriggerBox::default_triggers_per_box; n++) { + for (int n = 0; n < default_triggers_per_box; n++) { _triggerbox->trigger (n)->set_color(ct); } } break; @@ -453,10 +454,10 @@ TriggerMaster::set_all_colors () } void -TriggerMaster::set_all_follow_action (Trigger::FollowAction fa) +TriggerMaster::set_all_follow_action (FollowAction const & fa) { - _triggerbox->set_all_follow_action(fa); - _triggerbox->set_all_probability(0); + _triggerbox->set_all_follow_action (fa); + _triggerbox->set_all_probability (0); } void @@ -722,15 +723,17 @@ CueMaster::context_menu () Menu* follow_menu = manage (new Menu); MenuList& fitems = follow_menu->items (); - fitems.push_back (MenuElem (TriggerUI::follow_action_to_string(Trigger::None), sigc::bind (sigc::mem_fun (*this, &CueMaster::set_all_follow_action), Trigger::None))); - fitems.push_back (MenuElem (TriggerUI::follow_action_to_string(Trigger::Stop), sigc::bind (sigc::mem_fun (*this, &CueMaster::set_all_follow_action), Trigger::Stop))); - fitems.push_back (MenuElem (TriggerUI::follow_action_to_string(Trigger::Again), sigc::bind (sigc::mem_fun (*this, &CueMaster::set_all_follow_action), Trigger::Again))); - fitems.push_back (MenuElem (TriggerUI::follow_action_to_string(Trigger::PrevTrigger), sigc::bind (sigc::mem_fun (*this, &CueMaster::set_all_follow_action), Trigger::PrevTrigger))); - fitems.push_back (MenuElem (TriggerUI::follow_action_to_string(Trigger::NextTrigger), sigc::bind (sigc::mem_fun (*this, &CueMaster::set_all_follow_action), Trigger::NextTrigger))); - fitems.push_back (MenuElem (TriggerUI::follow_action_to_string(Trigger::ForwardTrigger), sigc::bind (sigc::mem_fun (*this, &CueMaster::set_all_follow_action), Trigger::ForwardTrigger))); - fitems.push_back (MenuElem (TriggerUI::follow_action_to_string(Trigger::ReverseTrigger), sigc::bind (sigc::mem_fun (*this, &CueMaster::set_all_follow_action), Trigger::ReverseTrigger))); - fitems.push_back (MenuElem (TriggerUI::follow_action_to_string(Trigger::AnyTrigger), sigc::bind (sigc::mem_fun (*this, &CueMaster::set_all_follow_action), Trigger::AnyTrigger))); - fitems.push_back (MenuElem (TriggerUI::follow_action_to_string(Trigger::OtherTrigger), sigc::bind (sigc::mem_fun (*this, &CueMaster::set_all_follow_action), Trigger::OtherTrigger))); + fitems.push_back (MenuElem (TriggerUI::follow_action_to_string(FollowAction (FollowAction::None)), sigc::bind (sigc::mem_fun (*this, &CueMaster::set_all_follow_action), FollowAction (FollowAction::None)))); + fitems.push_back (MenuElem (TriggerUI::follow_action_to_string(FollowAction (FollowAction::Stop)), sigc::bind (sigc::mem_fun (*this, &CueMaster::set_all_follow_action), FollowAction (FollowAction::Stop)))); + fitems.push_back (MenuElem (TriggerUI::follow_action_to_string(FollowAction (FollowAction::Again)), sigc::bind (sigc::mem_fun (*this, &CueMaster::set_all_follow_action), FollowAction (FollowAction::Again)))); + fitems.push_back (MenuElem (TriggerUI::follow_action_to_string(FollowAction (FollowAction::PrevTrigger)), sigc::bind (sigc::mem_fun (*this, &CueMaster::set_all_follow_action), FollowAction (FollowAction::PrevTrigger)))); + fitems.push_back (MenuElem (TriggerUI::follow_action_to_string(FollowAction (FollowAction::NextTrigger)), sigc::bind (sigc::mem_fun (*this, &CueMaster::set_all_follow_action), FollowAction (FollowAction::NextTrigger)))); + fitems.push_back (MenuElem (TriggerUI::follow_action_to_string(FollowAction (FollowAction::ForwardTrigger)), sigc::bind (sigc::mem_fun (*this, &CueMaster::set_all_follow_action), FollowAction (FollowAction::ForwardTrigger)))); + fitems.push_back (MenuElem (TriggerUI::follow_action_to_string(FollowAction (FollowAction::ReverseTrigger)), sigc::bind (sigc::mem_fun (*this, &CueMaster::set_all_follow_action), FollowAction (FollowAction::ReverseTrigger)))); + fitems.push_back (MenuElem (TriggerUI::follow_action_to_string(FollowAction (FollowAction::AnyTrigger)), sigc::bind (sigc::mem_fun (*this, &CueMaster::set_all_follow_action), FollowAction (FollowAction::AnyTrigger)))); + fitems.push_back (MenuElem (TriggerUI::follow_action_to_string(FollowAction (FollowAction::OtherTrigger)), sigc::bind (sigc::mem_fun (*this, &CueMaster::set_all_follow_action), FollowAction (FollowAction::OtherTrigger)))); + fitems.push_back (MenuElem (TriggerUI::follow_action_to_string(FollowAction (FollowAction::JumpTrigger)), sigc::bind (sigc::mem_fun (*this, &CueMaster::set_all_follow_action), FollowAction (FollowAction::JumpTrigger)))); + Menu* launch_menu = manage (new Menu); MenuList& litems = launch_menu->items (); @@ -823,7 +826,7 @@ CueMaster::clear_all_triggers () void -CueMaster::set_all_follow_action (Trigger::FollowAction fa) +CueMaster::set_all_follow_action (FollowAction const & fa) { TriggerBoxList tl; get_boxen(tl); diff --git a/gtk2_ardour/trigger_master.h b/gtk2_ardour/trigger_master.h index a179f18e0d..58710be766 100644 --- a/gtk2_ardour/trigger_master.h +++ b/gtk2_ardour/trigger_master.h @@ -85,7 +85,7 @@ private: void clear_all_triggers(); void set_all_colors(); - void set_all_follow_action (ARDOUR::Trigger::FollowAction); + void set_all_follow_action (ARDOUR::FollowAction const &); void set_all_launch_style (ARDOUR::Trigger::LaunchStyle); void set_all_quantization (Temporal::BBT_Offset const&); @@ -134,7 +134,7 @@ private: void get_boxen (TriggerBoxList &boxlist); void clear_all_triggers(); - void set_all_follow_action (ARDOUR::Trigger::FollowAction); + void set_all_follow_action (ARDOUR::FollowAction const &); void set_all_launch_style (ARDOUR::Trigger::LaunchStyle); void set_all_quantization (Temporal::BBT_Offset const&); diff --git a/gtk2_ardour/trigger_page.cc b/gtk2_ardour/trigger_page.cc index 3092280ec4..7489455241 100644 --- a/gtk2_ardour/trigger_page.cc +++ b/gtk2_ardour/trigger_page.cc @@ -66,7 +66,7 @@ using namespace std; TriggerPage::TriggerPage () : Tabbable (_content, _("Trigger Drom"), X_("trigger")) , _cue_area_frame (0.5, 0, 1.0, 0) - , _cue_box (32, 16 * TriggerBox::default_triggers_per_box) + , _cue_box (32, 16 * default_triggers_per_box) , _master_widget (32, 16) , _master (_master_widget.root ()) { diff --git a/gtk2_ardour/trigger_strip.cc b/gtk2_ardour/trigger_strip.cc index ec1fb1c350..280c007ace 100644 --- a/gtk2_ardour/trigger_strip.cc +++ b/gtk2_ardour/trigger_strip.cc @@ -65,7 +65,7 @@ TriggerStrip::TriggerStrip (Session* s, boost::shared_ptr rt) , _pb_selection () , _tmaster_widget (-1, 16) , _processor_box (s, boost::bind (&TriggerStrip::plugin_selector, this), _pb_selection, 0) - , _trigger_display (-1., TriggerBox::default_triggers_per_box * 16.) + , _trigger_display (-1., default_triggers_per_box * 16.) , _panners (s) , _level_meter (s) { diff --git a/gtk2_ardour/trigger_ui.cc b/gtk2_ardour/trigger_ui.cc index 478e745be0..ad4d52c82f 100644 --- a/gtk2_ardour/trigger_ui.cc +++ b/gtk2_ardour/trigger_ui.cc @@ -76,18 +76,19 @@ TriggerUI::TriggerUI () , _ignore_menu_action (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::ForwardTrigger)); - follow_strings.push_back (follow_action_to_string (Trigger::ReverseTrigger)); - 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)); + follow_strings.push_back (follow_action_to_string (FollowAction (FollowAction::None))); + follow_strings.push_back (follow_action_to_string (FollowAction (FollowAction::Stop))); + follow_strings.push_back (follow_action_to_string (FollowAction (FollowAction::Again))); + follow_strings.push_back (follow_action_to_string (FollowAction (FollowAction::QueuedTrigger))); + follow_strings.push_back (follow_action_to_string (FollowAction (FollowAction::NextTrigger))); + follow_strings.push_back (follow_action_to_string (FollowAction (FollowAction::PrevTrigger))); + follow_strings.push_back (follow_action_to_string (FollowAction (FollowAction::ForwardTrigger))); + follow_strings.push_back (follow_action_to_string (FollowAction (FollowAction::ReverseTrigger))); + follow_strings.push_back (follow_action_to_string (FollowAction (FollowAction::FirstTrigger))); + follow_strings.push_back (follow_action_to_string (FollowAction (FollowAction::LastTrigger))); + follow_strings.push_back (follow_action_to_string (FollowAction (FollowAction::AnyTrigger))); + follow_strings.push_back (follow_action_to_string (FollowAction (FollowAction::OtherTrigger))); + follow_strings.push_back (follow_action_to_string (FollowAction (FollowAction::JumpTrigger))); for (std::vector::const_iterator i = follow_strings.begin(); i != follow_strings.end(); ++i) { if (i->length() > longest_follow.length()) { @@ -159,7 +160,7 @@ TriggerUI::register_actions () { trigger_actions = ActionManager::create_action_group (bindings, X_("Triggers")); - for (int32_t n = 0; n < TriggerBox::default_triggers_per_box; ++n) { + for (int32_t n = 0; n < default_triggers_per_box; ++n) { const std::string action_name = string_compose ("trigger-scene-%1", n); const std::string display_name = string_compose (_("Scene %1"), n); @@ -591,58 +592,63 @@ TriggerUI::follow_context_menu () _ignore_menu_action = true; - fitems.push_back (RadioMenuElem (fagroup, TriggerUI::follow_action_to_string(Trigger::None), sigc::bind(sigc::mem_fun (*this, &TriggerUI::set_follow_action), Trigger::None))); - if (trigger ()->follow_action (0) == Trigger::None) { + fitems.push_back (RadioMenuElem (fagroup, TriggerUI::follow_action_to_string(FollowAction (FollowAction::None)), sigc::bind(sigc::mem_fun (*this, &TriggerUI::set_follow_action), FollowAction (FollowAction::None)))); + if (trigger ()->follow_action (0) == FollowAction::None) { dynamic_cast (&fitems.back ())->set_active (true); } - fitems.push_back (RadioMenuElem (fagroup, TriggerUI::follow_action_to_string(Trigger::Stop), sigc::bind(sigc::mem_fun (*this, &TriggerUI::set_follow_action), Trigger::Stop))); - if (trigger ()->follow_action (0) == Trigger::Stop) { + fitems.push_back (RadioMenuElem (fagroup, TriggerUI::follow_action_to_string(FollowAction (FollowAction::Stop)), sigc::bind(sigc::mem_fun (*this, &TriggerUI::set_follow_action), FollowAction (FollowAction::Stop)))); + if (trigger ()->follow_action (0) == FollowAction::Stop) { dynamic_cast (&fitems.back ())->set_active (true); } - fitems.push_back (RadioMenuElem (fagroup, TriggerUI::follow_action_to_string(Trigger::Again), sigc::bind(sigc::mem_fun (*this, &TriggerUI::set_follow_action), Trigger::Again))); - if (trigger ()->follow_action (0) == Trigger::Again) { + fitems.push_back (RadioMenuElem (fagroup, TriggerUI::follow_action_to_string(FollowAction (FollowAction::Again)), sigc::bind(sigc::mem_fun (*this, &TriggerUI::set_follow_action), FollowAction (FollowAction::Again)))); + if (trigger ()->follow_action (0) == FollowAction::Again) { dynamic_cast (&fitems.back ())->set_active (true); } #if QUEUED_SLOTS_IMPLEMENTED - fitems.push_back (RadioMenuElem (fagroup, TriggerUI::follow_action_to_string(Trigger::QueuedTrigger), sigc::bind(sigc::mem_fun (*this, &TriggerUI::set_follow_action), Trigger::QueuedTrigger))); - if (trigger ()->follow_action (0) == Trigger::QueuedTrigger) { + fitems.push_back (RadioMenuElem (fagroup, TriggerUI::follow_action_to_string(FollowAction (FollowAction::QueuedTrigger)), sigc::bind(sigc::mem_fun (*this, &TriggerUI::set_follow_action), FollowAction (FollowAction::QueuedTrigger)))); + if (trigger ()->follow_action (0) == FollowAction::QueuedTrigger) { dynamic_cast (&fitems.back ())->set_active (true); } #endif - fitems.push_back (RadioMenuElem (fagroup, TriggerUI::follow_action_to_string(Trigger::PrevTrigger), sigc::bind(sigc::mem_fun (*this, &TriggerUI::set_follow_action), Trigger::PrevTrigger))); - if (trigger ()->follow_action (0) == Trigger::PrevTrigger) { + fitems.push_back (RadioMenuElem (fagroup, TriggerUI::follow_action_to_string(FollowAction (FollowAction::PrevTrigger)), sigc::bind(sigc::mem_fun (*this, &TriggerUI::set_follow_action), FollowAction (FollowAction::PrevTrigger)))); + if (trigger ()->follow_action (0) == FollowAction::PrevTrigger) { dynamic_cast (&fitems.back ())->set_active (true); } - fitems.push_back (RadioMenuElem (fagroup, TriggerUI::follow_action_to_string(Trigger::NextTrigger), sigc::bind(sigc::mem_fun (*this, &TriggerUI::set_follow_action), Trigger::NextTrigger))); - if (trigger ()->follow_action (0) == Trigger::NextTrigger) { + fitems.push_back (RadioMenuElem (fagroup, TriggerUI::follow_action_to_string(FollowAction (FollowAction::NextTrigger)), sigc::bind(sigc::mem_fun (*this, &TriggerUI::set_follow_action), FollowAction (FollowAction::NextTrigger)))); + if (trigger ()->follow_action (0) == FollowAction::NextTrigger) { dynamic_cast (&fitems.back ())->set_active (true); } - fitems.push_back (RadioMenuElem (fagroup, TriggerUI::follow_action_to_string(Trigger::ForwardTrigger), sigc::bind(sigc::mem_fun (*this, &TriggerUI::set_follow_action), Trigger::ForwardTrigger))); - if (trigger ()->follow_action (0) == Trigger::ForwardTrigger) { + fitems.push_back (RadioMenuElem (fagroup, TriggerUI::follow_action_to_string(FollowAction (FollowAction::ForwardTrigger)), sigc::bind(sigc::mem_fun (*this, &TriggerUI::set_follow_action), FollowAction (FollowAction::ForwardTrigger)))); + if (trigger ()->follow_action (0) == FollowAction::ForwardTrigger) { dynamic_cast (&fitems.back ())->set_active (true); } - fitems.push_back (RadioMenuElem (fagroup, TriggerUI::follow_action_to_string(Trigger::ReverseTrigger), sigc::bind(sigc::mem_fun (*this, &TriggerUI::set_follow_action), Trigger::ReverseTrigger))); - if (trigger ()->follow_action (0) == Trigger::ReverseTrigger) { + fitems.push_back (RadioMenuElem (fagroup, TriggerUI::follow_action_to_string(FollowAction (FollowAction::ReverseTrigger)), sigc::bind(sigc::mem_fun (*this, &TriggerUI::set_follow_action), FollowAction (FollowAction::ReverseTrigger)))); + if (trigger ()->follow_action (0) == FollowAction::ReverseTrigger) { dynamic_cast (&fitems.back ())->set_active (true); } #if 0 - fitems.push_back (RadioMenuElem (fagroup, TriggerUI::follow_action_to_string(Trigger::FirstTrigger), sigc::bind(sigc::mem_fun (*this, &TriggerUI::set_follow_action), Trigger::FirstTrigger))); - if (trigger ()->follow_action (0) == Trigger::FirstTrigger) { + fitems.push_back (RadioMenuElem (fagroup, TriggerUI::follow_action_to_string(FollowAction (FollowAction::FirstTrigger)), sigc::bind(sigc::mem_fun (*this, &TriggerUI::set_follow_action), FollowAction (FollowAction::FirstTrigger)))); + if (trigger ()->follow_action (0) == FollowAction::FirstTrigger) { dynamic_cast (&fitems.back ())->set_active (true); } - fitems.push_back (RadioMenuElem (fagroup, TriggerUI::follow_action_to_string(Trigger::LastTrigger), sigc::bind(sigc::mem_fun (*this, &TriggerUI::set_follow_action), Trigger::LastTrigger))); - if (trigger ()->follow_action (0) == Trigger::LastTrigger) { + fitems.push_back (RadioMenuElem (fagroup, TriggerUI::follow_action_to_string(FollowAction (FollowAction::LastTrigger)), sigc::bind(sigc::mem_fun (*this, &TriggerUI::set_follow_action), FollowAction (FollowAction::LastTrigger)))); + if (trigger ()->follow_action (0) == FollowAction::LastTrigger) { dynamic_cast (&fitems.back ())->set_active (true); } #endif - fitems.push_back (RadioMenuElem (fagroup, TriggerUI::follow_action_to_string(Trigger::AnyTrigger), sigc::bind(sigc::mem_fun (*this, &TriggerUI::set_follow_action), Trigger::AnyTrigger))); - if (trigger ()->follow_action (0) == Trigger::AnyTrigger) { + fitems.push_back (RadioMenuElem (fagroup, TriggerUI::follow_action_to_string(FollowAction (FollowAction::AnyTrigger)), sigc::bind(sigc::mem_fun (*this, &TriggerUI::set_follow_action), FollowAction (FollowAction::AnyTrigger)))); + if (trigger ()->follow_action (0) == FollowAction::AnyTrigger) { dynamic_cast (&fitems.back ())->set_active (true); } - fitems.push_back (RadioMenuElem (fagroup, TriggerUI::follow_action_to_string(Trigger::OtherTrigger), sigc::bind(sigc::mem_fun (*this, &TriggerUI::set_follow_action), Trigger::OtherTrigger))); - if (trigger ()->follow_action (0) == Trigger::OtherTrigger) { + fitems.push_back (RadioMenuElem (fagroup, TriggerUI::follow_action_to_string(FollowAction (FollowAction::OtherTrigger)), sigc::bind(sigc::mem_fun (*this, &TriggerUI::set_follow_action), FollowAction (FollowAction::OtherTrigger)))); + if (trigger ()->follow_action (0) == FollowAction::OtherTrigger) { + dynamic_cast (&fitems.back ())->set_active (true); + } + + fitems.push_back (RadioMenuElem (fagroup, TriggerUI::follow_action_to_string(FollowAction (FollowAction::JumpTrigger)), sigc::bind(sigc::mem_fun (*this, &TriggerUI::set_follow_action), FollowAction (FollowAction::JumpTrigger)))); + if (trigger ()->follow_action (0) == FollowAction::JumpTrigger) { dynamic_cast (&fitems.back ())->set_active (true); } @@ -684,7 +690,7 @@ TriggerUI::edit_trigger () } void -TriggerUI::set_follow_action (Trigger::FollowAction fa) +TriggerUI::set_follow_action (FollowAction const & fa) { if (_ignore_menu_action) { return; @@ -778,33 +784,35 @@ TriggerUI::quantize_length_to_string (BBT_Offset const & ql) } std::string -TriggerUI::follow_action_to_string (Trigger::FollowAction fa) +TriggerUI::follow_action_to_string (FollowAction const & fa) { - switch (fa) { - case Trigger::None: + switch (fa.type) { + case FollowAction::None: return _("None"); - case Trigger::Stop: + case FollowAction::Stop: return _("Stop"); - case Trigger::Again: + case FollowAction::Again: return _("Again"); - case Trigger::QueuedTrigger: + case FollowAction::QueuedTrigger: return _("Queued"); - case Trigger::NextTrigger: + case FollowAction::NextTrigger: return _("Next"); - case Trigger::PrevTrigger: + case FollowAction::PrevTrigger: return _("Prev"); - case Trigger::ForwardTrigger: + case FollowAction::ForwardTrigger: return _("Forward"); - case Trigger::ReverseTrigger: + case FollowAction::ReverseTrigger: return _("Reverse"); - case Trigger::FirstTrigger: + case FollowAction::FirstTrigger: return _("First"); - case Trigger::LastTrigger: + case FollowAction::LastTrigger: return _("Last"); - case Trigger::AnyTrigger: + case FollowAction::AnyTrigger: return _("Any"); - case Trigger::OtherTrigger: + case FollowAction::OtherTrigger: return _("Other"); + case FollowAction::JumpTrigger: + return _("Jump"); } /*NOTREACHED*/ return std::string(); diff --git a/gtk2_ardour/trigger_ui.h b/gtk2_ardour/trigger_ui.h index c73962db2b..30874f3b70 100644 --- a/gtk2_ardour/trigger_ui.h +++ b/gtk2_ardour/trigger_ui.h @@ -45,8 +45,7 @@ public: virtual void on_trigger_changed (PBD::PropertyChange const& ) = 0; - static std::string follow_action_to_string (ARDOUR::Trigger::FollowAction); - static ARDOUR::Trigger::FollowAction string_to_follow_action (std::string const &); + static std::string follow_action_to_string (ARDOUR::FollowAction const &); static std::string quantize_length_to_string (Temporal::BBT_Offset const &); static std::string launch_style_to_string (ARDOUR::Trigger::LaunchStyle); static std::string stretch_mode_to_string (ARDOUR::Trigger::StretchMode); @@ -74,7 +73,7 @@ public: void follow_context_menu (); void context_menu (); - void set_follow_action (ARDOUR::Trigger::FollowAction); + void set_follow_action (ARDOUR::FollowAction const &); void set_launch_style (ARDOUR::Trigger::LaunchStyle); void set_quantization (Temporal::BBT_Offset const&); void set_from_selection (); diff --git a/gtk2_ardour/triggerbox_ui.cc b/gtk2_ardour/triggerbox_ui.cc index 10630a8575..e2f3f08193 100644 --- a/gtk2_ardour/triggerbox_ui.cc +++ b/gtk2_ardour/triggerbox_ui.cc @@ -178,7 +178,7 @@ TriggerEntry::_size_allocate (ArdourCanvas::Rect const& alloc) } void -TriggerEntry::draw_follow_icon (Cairo::RefPtr context, Trigger::FollowAction icon, float size, float scale) const +TriggerEntry::draw_follow_icon (Cairo::RefPtr context, FollowAction const & icon, float size, float scale) const { uint32_t bg_color = fill_color (); uint32_t fg_color = UIConfiguration::instance ().color ("neutral:midground"); @@ -199,32 +199,32 @@ TriggerEntry::draw_follow_icon (Cairo::RefPtr context, Trigger:: set_source_rgba (context, fg_color); context->set_line_width (1 * scale); - switch (icon) { - case Trigger::Stop: + switch (icon.type) { + case FollowAction::Stop: context->rectangle (6 * scale, 6 * scale, size - 12 * scale, size - 12 * scale); context->stroke (); break; - case Trigger::Again: + case FollowAction::Again: context->arc (size / 2, size / 2, size * 0.20, 60. * (M_PI / 180.0), 2 * M_PI); context->stroke (); context->arc (size / 2 + size * 0.2, size / 2, 1.5 * scale, 0, 2 * M_PI); // arrow head context->fill (); break; - case Trigger::NextTrigger: + case FollowAction::NextTrigger: context->move_to (size / 2, 3 * scale); context->line_to (size / 2, size - 5 * scale); context->stroke (); context->arc (size / 2, size - 5 * scale, 2 * scale, 0, 2 * M_PI); // arrow head context->fill (); break; - case Trigger::PrevTrigger: + case FollowAction::PrevTrigger: context->move_to (size / 2, 5 * scale); context->line_to (size / 2, size - 3 * scale); context->stroke (); context->arc (size / 2, 5 * scale, 2 * scale, 0, 2 * M_PI); // arrow head context->fill (); break; - case Trigger::ForwardTrigger: + case FollowAction::ForwardTrigger: context->move_to (size / 2, 3 * scale); context->line_to (size / 2, size - 3 * scale); context->stroke (); @@ -241,7 +241,7 @@ TriggerEntry::draw_follow_icon (Cairo::RefPtr context, Trigger:: context->arc (size / 2, size - 3 * scale, 2 * scale, 0, 2 * M_PI); // arrow head context->fill (); break; - case Trigger::ReverseTrigger: + case FollowAction::ReverseTrigger: context->arc (size / 2, 3 * scale, 2 * scale, 0, 2 * M_PI); // arrow head set_source_rgba (context, fg_color); context->fill (); @@ -259,17 +259,17 @@ TriggerEntry::draw_follow_icon (Cairo::RefPtr context, Trigger:: context->fill (); break; - case Trigger::QueuedTrigger: { + case FollowAction::QueuedTrigger: { Glib::RefPtr layout = Pango::Layout::create (context); layout->set_font_description (UIConfiguration::instance ().get_SmallMonospaceFont ()); - layout->set_text (icon == Trigger::AnyTrigger ? "&" : "@"); + layout->set_text (icon == FollowAction::AnyTrigger ? "&" : "@"); int tw, th; layout->get_pixel_size (tw, th); context->move_to (size / 2, size / 2); context->rel_move_to (-tw / 2, -th / 2); layout->show_in_cairo_context (context); } break; - case Trigger::AnyTrigger: { + case FollowAction::AnyTrigger: { for (int i = 0; i < 6; i++) { Cairo::Matrix m = context->get_matrix (); context->translate (size / 2, size / 2); @@ -281,7 +281,7 @@ TriggerEntry::draw_follow_icon (Cairo::RefPtr context, Trigger:: } context->set_identity_matrix (); } break; - case Trigger::OtherTrigger: { + case FollowAction::OtherTrigger: { context->set_line_width (1.5 * scale); set_source_rgba (context, HSV (UIConfiguration::instance ().color ("neutral:midground")).lighter (0.25).color ()); // needs to be brighter to maintain balance for (int i = 0; i < 6; i++) { @@ -295,7 +295,22 @@ TriggerEntry::draw_follow_icon (Cairo::RefPtr context, Trigger:: } context->set_identity_matrix (); } break; - case Trigger::None: + /* ben: new shape here ? */ + case FollowAction::JumpTrigger: { + context->set_line_width (1.5 * scale); + set_source_rgba (context, HSV (UIConfiguration::instance ().color ("neutral:midground")).lighter (0.25).color ()); // needs to be brighter to maintain balance + for (int i = 0; i < 6; i++) { + Cairo::Matrix m = context->get_matrix (); + context->translate (size / 2, size / 2); + context->rotate (i * M_PI / 3); + context->move_to (0, 2 * scale); + context->line_to (0, (size / 2) - 4 * scale); + context->stroke (); + context->set_matrix (m); + } + context->set_identity_matrix (); + } break; + case FollowAction::None: default: break; } @@ -924,7 +939,7 @@ TriggerBoxUI::_size_allocate (ArdourCanvas::Rect const& alloc) const float width = alloc.width (); const float height = alloc.height (); - const float slot_h = height / TriggerBox::default_triggers_per_box; // TODO + const float slot_h = height / default_triggers_per_box; // TODO float ypos = 0; for (auto& slot : _slots) { diff --git a/gtk2_ardour/triggerbox_ui.h b/gtk2_ardour/triggerbox_ui.h index d08e2eb197..6faec16137 100644 --- a/gtk2_ardour/triggerbox_ui.h +++ b/gtk2_ardour/triggerbox_ui.h @@ -55,7 +55,7 @@ public: ArdourCanvas::Text* name_text; void draw_launch_icon (Cairo::RefPtr context, float size, float scale) const; - void draw_follow_icon (Cairo::RefPtr context, ARDOUR::Trigger::FollowAction icon, float size, float scale) const; + void draw_follow_icon (Cairo::RefPtr context, ARDOUR::FollowAction const & icon, float size, float scale) const; void render (ArdourCanvas::Rect const& area, Cairo::RefPtr context) const; diff --git a/gtk2_ardour/utils.cc b/gtk2_ardour/utils.cc index 62c8084619..7dacebf109 100644 --- a/gtk2_ardour/utils.cc +++ b/gtk2_ardour/utils.cc @@ -890,7 +890,10 @@ ARDOUR_UI_UTILS::convert_drop_to_paths (vector& paths, const SelectionDa */ string txt = data.get_text(); - char* p = (char *) malloc (txt.length() + 1); + /* copy to char* for easy char-wise checks and modification */ + char* tmp = (char *) malloc (txt.length() + 1); + char* p = tmp; + txt.copy (p, txt.length(), 0); p[txt.length()] = '\0'; @@ -922,7 +925,7 @@ ARDOUR_UI_UTILS::convert_drop_to_paths (vector& paths, const SelectionDa } } - free ((void*)p); + free ((void*)tmp); if (uris.empty()) { return false; diff --git a/libs/ardour/ardour/triggerbox.h b/libs/ardour/ardour/triggerbox.h index b6cedf6ac8..b88723dc39 100644 --- a/libs/ardour/ardour/triggerbox.h +++ b/libs/ardour/ardour/triggerbox.h @@ -44,6 +44,8 @@ #include "ardour/midi_state_tracker.h" #include "ardour/processor.h" #include "ardour/segment_descriptor.h" +#include "ardour/types.h" +#include "ardour/types_convert.h" #include "ardour/libardour_visibility.h" @@ -171,21 +173,6 @@ class LIBARDOUR_API Trigger : public PBD::Stateful { LaunchStyle launch_style() const; void set_launch_style (LaunchStyle); - enum FollowAction { - None, - Stop, - Again, - QueuedTrigger, /* DP-style */ - NextTrigger, /* Live-style, and below */ - PrevTrigger, - ForwardTrigger, /* any "next" skipping empties */ - ReverseTrigger, /* any "prev" skipping empties */ - FirstTrigger, - LastTrigger, - AnyTrigger, - OtherTrigger, - }; - FollowAction follow_action (uint32_t n) const { assert (n < 2); return n ? _follow_action1 : _follow_action0; } void set_follow_action (FollowAction, uint32_t n); @@ -337,6 +324,8 @@ class LIBARDOUR_API Trigger : public PBD::Stateful { void set_region_internal (boost::shared_ptr); virtual void retrigger() = 0; virtual void _startup (Temporal::BBT_Offset const &); + + bool internal_use_follow_length() const; }; typedef boost::shared_ptr TriggerPtr; @@ -571,7 +560,7 @@ class LIBARDOUR_API TriggerBox : public Processor TriggerPtr currently_playing() const { return _currently_playing; } void clear_all_triggers (); - void set_all_follow_action (ARDOUR::Trigger::FollowAction, uint32_t n=0); + void set_all_follow_action (ARDOUR::FollowAction const &, uint32_t n=0); void set_all_launch_style (ARDOUR::Trigger::LaunchStyle); void set_all_quantization (Temporal::BBT_Offset const&); void set_all_probability (int zero_to_a_hundred); @@ -617,8 +606,6 @@ class LIBARDOUR_API TriggerBox : public Processor static void init (); - static const int32_t default_triggers_per_box; - static TriggerBoxThread* worker; static void start_transport_stop (Session&); @@ -733,8 +720,8 @@ namespace Properties { LIBARDOUR_API extern PBD::PropertyDescriptor quantization; LIBARDOUR_API extern PBD::PropertyDescriptor follow_length; LIBARDOUR_API extern PBD::PropertyDescriptor launch_style; - LIBARDOUR_API extern PBD::PropertyDescriptor follow_action0; - LIBARDOUR_API extern PBD::PropertyDescriptor follow_action1; + LIBARDOUR_API extern PBD::PropertyDescriptor follow_action0; + LIBARDOUR_API extern PBD::PropertyDescriptor follow_action1; LIBARDOUR_API extern PBD::PropertyDescriptor stretch_mode; LIBARDOUR_API extern PBD::PropertyDescriptor follow_count; LIBARDOUR_API extern PBD::PropertyDescriptor follow_action_probability; @@ -751,7 +738,7 @@ namespace Properties { } // namespace ARDOUR namespace PBD { -DEFINE_ENUM_CONVERT(ARDOUR::Trigger::FollowAction); +DEFINE_ENUM_CONVERT(ARDOUR::FollowAction::Type); DEFINE_ENUM_CONVERT(ARDOUR::Trigger::LaunchStyle); DEFINE_ENUM_CONVERT(ARDOUR::Trigger::StretchMode); } /* namespace PBD */ diff --git a/libs/ardour/ardour/types.h b/libs/ardour/ardour/types.h index 7644a30f0f..1a7c913c1c 100644 --- a/libs/ardour/ardour/types.h +++ b/libs/ardour/ardour/types.h @@ -31,6 +31,7 @@ #ifndef __ardour_types_h__ #define __ardour_types_h__ +#include #include #include #include @@ -818,6 +819,61 @@ enum CueBehavior { typedef std::vector CaptureInfos; +const int32_t default_triggers_per_box = 8; + + +struct FollowAction { + enum Type { + None, + Stop, + Again, + QueuedTrigger, /* DP-style */ + NextTrigger, /* Live-style, and below */ + PrevTrigger, + ForwardTrigger, /* any "next" skipping empties */ + ReverseTrigger, /* any "prev" skipping empties */ + FirstTrigger, + LastTrigger, + AnyTrigger, + OtherTrigger, + JumpTrigger, + }; + + /* We could theoretically limit this to default_triggers_per_box but + * doing it this way makes it likely that this will not change. Could + * be worth a constexpr-style compile time assert to check + * default_triggers_per_box < 64 + */ + + typedef std::bitset<64> Targets; + + Type type; + Targets targets; + + FollowAction () : type (None) {} + FollowAction (Type t, Targets const & tgts = Targets()) : type (t), targets (tgts) {} + FollowAction (Type t, std::string const & bitstring) : type (t), targets (bitstring) {} + FollowAction (std::string const &); + + static Targets target_any () { Targets t; t.set(); return t; } + static Targets target_other (uint8_t skip) { Targets t; t.set (); t.reset (skip); return t; } + static Targets target_next_wrap (uint8_t from) { Targets t; if (from < t.size() - 1) { t.set (from + 1); } else { t.set (0); } return t; } + static Targets target_prev_wrap (uint8_t from) { Targets t; if (from) { t.set (from - 1); } else { t.set (t.size() - 1); } return t; } + static Targets target_next_nowrap (uint8_t from) { Targets t; if (from < t.size() - 1) { t.set (from + 1); } return t; } + static Targets target_prev_nowrap (uint8_t from) { Targets t; if (from) { t.set (from - 1); } return t; } + + bool operator!= (FollowAction const & other) const { + return other.type != type || other.targets != targets; + } + + bool operator== (FollowAction const & other) const { + return other.type == type && other.targets == targets; + } + + std::string to_string() const; +}; + + } // namespace ARDOUR /* for now, break the rules and use "using" to make this "global" */ diff --git a/libs/ardour/ardour/types_convert.h b/libs/ardour/ardour/types_convert.h index 4bf2778edb..3d445eef81 100644 --- a/libs/ardour/ardour/types_convert.h +++ b/libs/ardour/ardour/types_convert.h @@ -30,6 +30,14 @@ #include "ardour/data_type.h" #include "ardour/mode.h" +/* NOTE: when adding types to this file, you must add four functions: + + std::string to_string (T); + T string_to (std::string const &); + bool to_string (T, std::string &); + bool string_to (std::string const &, T&); +*/ + namespace PBD { DEFINE_ENUM_CONVERT(Timecode::TimecodeFormat) @@ -162,6 +170,33 @@ inline bool string_to (const std::string& str, ARDOUR::DataType& dt) return true; } +template <> +inline bool to_string (ARDOUR::FollowAction fa, std::string& str) +{ + str = fa.to_string(); + return true; +} + +template <> +inline bool string_to (const std::string& str, ARDOUR::FollowAction& fa) +{ + fa = ARDOUR::FollowAction (str); + return true; +} + +template<> +inline std::string to_string (ARDOUR::FollowAction fa) +{ + return fa.to_string (); +} + +template<> +inline ARDOUR::FollowAction string_to (std::string const & str) +{ + return ARDOUR::FollowAction (str); +} + + } // namespace PBD #endif // ARDOUR_TYPES_CONVERT_H diff --git a/libs/ardour/enums.cc b/libs/ardour/enums.cc index baa01cfe90..315b6e77f9 100644 --- a/libs/ardour/enums.cc +++ b/libs/ardour/enums.cc @@ -157,7 +157,7 @@ setup_enum_writer () LocateTransportDisposition _LocateTransportDisposition; Trigger::State _TriggerState; Trigger::LaunchStyle _TriggerLaunchStyle; - Trigger::FollowAction _TriggerFollowAction; + FollowAction::Type _FollowAction; Trigger::StretchMode _TriggerStretchMode; CueBehavior _CueBehavior; @@ -859,19 +859,20 @@ setup_enum_writer () REGISTER_CLASS_ENUM (Trigger, Stopping); REGISTER (_TriggerState); - REGISTER_CLASS_ENUM (Trigger, None); - REGISTER_CLASS_ENUM (Trigger, Stop); - REGISTER_CLASS_ENUM (Trigger, Again); - REGISTER_CLASS_ENUM (Trigger, QueuedTrigger); - REGISTER_CLASS_ENUM (Trigger, NextTrigger); - REGISTER_CLASS_ENUM (Trigger, PrevTrigger); - REGISTER_CLASS_ENUM (Trigger, ForwardTrigger); - REGISTER_CLASS_ENUM (Trigger, ReverseTrigger); - REGISTER_CLASS_ENUM (Trigger, FirstTrigger); - REGISTER_CLASS_ENUM (Trigger, LastTrigger); - REGISTER_CLASS_ENUM (Trigger, AnyTrigger); - REGISTER_CLASS_ENUM (Trigger, OtherTrigger); - REGISTER (_TriggerFollowAction); + REGISTER_CLASS_ENUM (FollowAction, None); + REGISTER_CLASS_ENUM (FollowAction, Stop); + REGISTER_CLASS_ENUM (FollowAction, Again); + REGISTER_CLASS_ENUM (FollowAction, QueuedTrigger); + REGISTER_CLASS_ENUM (FollowAction, NextTrigger); + REGISTER_CLASS_ENUM (FollowAction, PrevTrigger); + REGISTER_CLASS_ENUM (FollowAction, ForwardTrigger); + REGISTER_CLASS_ENUM (FollowAction, ReverseTrigger); + REGISTER_CLASS_ENUM (FollowAction, FirstTrigger); + REGISTER_CLASS_ENUM (FollowAction, LastTrigger); + REGISTER_CLASS_ENUM (FollowAction, AnyTrigger); + REGISTER_CLASS_ENUM (FollowAction, OtherTrigger); + REGISTER_CLASS_ENUM (FollowAction, JumpTrigger); + REGISTER (_FollowAction); REGISTER_CLASS_ENUM (Trigger, OneShot); REGISTER_CLASS_ENUM (Trigger, ReTrigger); diff --git a/libs/ardour/session_command.cc b/libs/ardour/session_command.cc index f8a5a62956..5e545e3086 100644 --- a/libs/ardour/session_command.cc +++ b/libs/ardour/session_command.cc @@ -147,6 +147,10 @@ Session::memento_command_factory(XMLNode *n) /* we failed */ info << string_compose (_("Could not reconstitute MementoCommand from XMLNode. object type = %1 id = %2"), type_name, id.to_s()) << endmsg; + delete after; + delete before; + delete child; + return 0 ; } diff --git a/libs/ardour/session_state.cc b/libs/ardour/session_state.cc index d4b32100dc..af4a9a1e04 100644 --- a/libs/ardour/session_state.cc +++ b/libs/ardour/session_state.cc @@ -1419,10 +1419,10 @@ Session::state (bool save_template, snapshot_t snapshot_type, bool only_used_ass ca->add_child_nocopy (*can); /* see above, child is still "Regions" here */ if (i->second->playlist() == 0 && only_used_assets) { - if (boost::shared_ptr ar = boost::dynamic_pointer_cast( i->second)) { + if (boost::shared_ptr ar = boost::dynamic_pointer_cast (i->second)) { child->add_child_nocopy (ar->get_basic_state ()); } else { - child->add_child_nocopy (ar->get_state ()); + child->add_child_nocopy (i->second->get_state ()); } } } diff --git a/libs/ardour/session_transport.cc b/libs/ardour/session_transport.cc index cf89007693..bc9d3b345b 100644 --- a/libs/ardour/session_transport.cc +++ b/libs/ardour/session_transport.cc @@ -1120,10 +1120,10 @@ Session::butler_transport_work (bool have_process_lock) bool finished = true; PostTransportWork ptw = post_transport_work(); #ifndef NDEBUG - uint64_t before; + uint64_t before = g_get_monotonic_time(); #endif - DEBUG_TRACE (DEBUG::Transport, string_compose ("Butler transport work, todo = [%1] (0x%3%4%5) at %2\n", enum_2_string (ptw), (before = g_get_monotonic_time()), std::hex, ptw, std::dec)); + DEBUG_TRACE (DEBUG::Transport, string_compose ("Butler transport work, todo = [%1] (0x%3%4%5) at %2\n", enum_2_string (ptw), before, std::hex, ptw, std::dec)); if (ptw & PostTransportAdjustPlaybackBuffering) { /* need to prevent concurrency with ARDOUR::Reader::run(), diff --git a/libs/ardour/triggerbox.cc b/libs/ardour/triggerbox.cc index 185c9de16b..14bfc940c8 100644 --- a/libs/ardour/triggerbox.cc +++ b/libs/ardour/triggerbox.cc @@ -54,8 +54,8 @@ namespace ARDOUR { PBD::PropertyDescriptor quantization; PBD::PropertyDescriptor follow_length; PBD::PropertyDescriptor launch_style; - PBD::PropertyDescriptor follow_action0; - PBD::PropertyDescriptor follow_action1; + PBD::PropertyDescriptor follow_action0; + PBD::PropertyDescriptor follow_action1; PBD::PropertyDescriptor currently_playing; PBD::PropertyDescriptor follow_count; PBD::PropertyDescriptor follow_action_probability; @@ -68,6 +68,38 @@ namespace ARDOUR { } } +FollowAction::FollowAction (std::string const & str) +{ + std::string::size_type colon = str.find_first_of (':'); + + if (colon == std::string::npos) { + throw failed_constructor (); + } + + type = FollowAction::Type (string_2_enum (str.substr (0, colon), type)); + + /* We use the ulong representation of the bitset because the string + version is absurd. + */ + unsigned long ul; + std::stringstream ss (str.substr (colon+1)); + ss >> ul; + if (!ss) { + throw failed_constructor(); + } + targets = Targets (ul); +} + +std::string +FollowAction::to_string () const +{ + /* We use the ulong representation of the bitset because the string + version is absurd. + */ + return string_compose ("%1:%2", enum_2_string (type), targets.to_ulong()); +} + + Trigger * const Trigger::MagicClearPointerValue = (Trigger*) 0xfeedface; Trigger::Trigger (uint32_t n, TriggerBox& b) @@ -82,8 +114,8 @@ Trigger::Trigger (uint32_t n, TriggerBox& b) , _pending_velocity_gain (1.0) , _velocity_gain (1.0) , _launch_style (Properties::launch_style, OneShot) - , _follow_action0 (Properties::follow_action0, Again) - , _follow_action1 (Properties::follow_action1, Stop) + , _follow_action0 (Properties::follow_action0, FollowAction (FollowAction::Again)) + , _follow_action1 (Properties::follow_action1, FollowAction (FollowAction::Stop)) , _follow_action_probability (Properties::follow_action_probability, 0) , _follow_count (Properties::follow_count, 1) , _quantization (Properties::quantization, Temporal::BBT_Offset (1, 0, 0)) @@ -148,8 +180,8 @@ Trigger::swap_pending (Trigger* t) bool Trigger::will_not_follow () const { - return (_follow_action0 == None && _follow_action_probability == 0) || - (_follow_action0 == None && _follow_action1 == None); + return (_follow_action0.val().type == FollowAction::None && _follow_action_probability == 0) || + (_follow_action0.val().type == FollowAction::None && _follow_action1.val().type == FollowAction::None); } void @@ -375,6 +407,12 @@ Trigger::set_use_follow_length (bool ufl) _box.session().set_dirty(); } +bool +Trigger::internal_use_follow_length () const +{ + return (_follow_action0.val().type != None) && _use_follow_length; +} + void Trigger::set_legato (bool yn) { @@ -671,6 +709,7 @@ Trigger::maybe_compute_next_transition (samplepos_t start_sample, Temporal::Beat transition_samples = start_sample; transition_beats = start; transition_time = timepos_t (start); + transition_bbt = tmap->bbt_at (transition_beats); } else if (q.bars == 0) { Temporal::Beats transition_beats = start.round_up_to_multiple (Temporal::Beats (q.beats, q.ticks)); transition_bbt = tmap->bbt_at (transition_beats); @@ -1022,20 +1061,20 @@ AudioTrigger::set_expected_end_sample (Temporal::TempoMap::SharedPtr const & tma end_by_follow_length, _follow_length, end_by_barcnt, end_by_data_length)); if (stretching()) { - if (_use_follow_length) { + if (internal_use_follow_length()) { expected_end_sample = std::min (end_by_follow_length, end_by_barcnt); } else { expected_end_sample = end_by_barcnt; } } else { - if (_use_follow_length) { + if (internal_use_follow_length()) { expected_end_sample = std::min (end_by_follow_length, end_by_data_length); } else { expected_end_sample = end_by_data_length; } } - if (_use_follow_length) { + if (internal_use_follow_length()) { final_sample = end_by_follow_length - transition_sample; } else { final_sample = expected_end_sample - transition_sample; @@ -1043,7 +1082,7 @@ AudioTrigger::set_expected_end_sample (Temporal::TempoMap::SharedPtr const & tma samplecnt_t usable_length; - if (_use_follow_length && (end_by_follow_length < end_by_data_length)) { + if (internal_use_follow_length() && (end_by_follow_length < end_by_data_length)) { usable_length = tmap->sample_at (tmap->bbt_walk (Temporal::BBT_Time (), _follow_length)); } else { usable_length = data.length; @@ -1132,18 +1171,18 @@ AudioTrigger::set_region_in_worker_thread (boost::shared_ptr r) if (_segment_tempo == 0.) { _stretchable = false; _quantization = Temporal::BBT_Offset (-1, 0, 0); - _follow_action0 = None; + _follow_action0 = FollowAction (FollowAction::None); } else { if (probably_oneshot()) { /* short trigger, treat as a one shot */ _stretchable = false; - _follow_action0 = None; + _follow_action0 = FollowAction (FollowAction::None); _quantization = Temporal::BBT_Offset (-1, 0, 0); } else { _stretchable = true; _quantization = Temporal::BBT_Offset (1, 0, 0); - _follow_action0 = Again; + _follow_action0 = FollowAction (FollowAction::Again); } } @@ -1719,7 +1758,7 @@ MIDITrigger::set_expected_end_sample (Temporal::TempoMap::SharedPtr const & tmap Temporal::Beats usable_length; - if (_use_follow_length && (end_by_follow_length < end_by_data_length)) { + if (internal_use_follow_length() && (end_by_follow_length < end_by_data_length)) { usable_length = tmap->quarters_at (tmap->bbt_walk (transition_bbt, _follow_length)) - transition_beats; } else { usable_length = data_length; @@ -1729,7 +1768,7 @@ MIDITrigger::set_expected_end_sample (Temporal::TempoMap::SharedPtr const & tmap if (launch_style() != Repeat || (q == Temporal::BBT_Offset())) { - if (_use_follow_length) { + if (internal_use_follow_length()) { final_beat = end_by_follow_length; } else { final_beat = end_by_data_length; @@ -2138,7 +2177,6 @@ Trigger::make_property_quarks () DEBUG_TRACE (DEBUG::Properties, string_compose ("quark for stretch_mode = %1\n", Properties::stretch_mode.property_id)); } -const int32_t TriggerBox::default_triggers_per_box = 8; Temporal::BBT_Offset TriggerBox::_assumed_trigger_duration (4, 0, 0); //TriggerBox::TriggerMidiMapMode TriggerBox::_midi_map_mode (TriggerBox::AbletonPush); TriggerBox::TriggerMidiMapMode TriggerBox::_midi_map_mode (TriggerBox::SequentialNote); @@ -2378,7 +2416,7 @@ TriggerBox::set_all_launch_style (ARDOUR::Trigger::LaunchStyle ls) } void -TriggerBox::set_all_follow_action (ARDOUR::Trigger::FollowAction fa, uint32_t fa_n) +TriggerBox::set_all_follow_action (ARDOUR::FollowAction const & fa, uint32_t fa_n) { for (uint64_t n = 0; n < all_triggers.size(); ++n) { all_triggers[n]->set_follow_action (fa, fa_n); @@ -2964,6 +3002,9 @@ TriggerBox::determine_next_trigger (uint32_t current) { uint32_t n; uint32_t runnable = 0; + std::vector possible_targets; + + possible_targets.reserve (default_triggers_per_box); /* count number of triggers that can actually be run (i.e. they have a region) */ @@ -2982,7 +3023,7 @@ TriggerBox::determine_next_trigger (uint32_t current) */ int r = _pcg.rand (100); // 0 .. 99 - Trigger::FollowAction fa; + FollowAction fa; if (r >= all_triggers[current]->follow_action_probability()) { fa = all_triggers[current]->follow_action (0); @@ -2994,14 +3035,14 @@ TriggerBox::determine_next_trigger (uint32_t current) * nothing or just repeat the current trigger */ - DEBUG_TRACE (DEBUG::Triggers, string_compose ("choose next trigger using follow action %1 given prob %2 and rnd %3\n", enum_2_string (fa), all_triggers[current]->follow_action_probability(), r)); + DEBUG_TRACE (DEBUG::Triggers, string_compose ("choose next trigger using follow action %1 given prob %2 and rnd %3\n", fa.to_string(), all_triggers[current]->follow_action_probability(), r)); - switch (fa) { + switch (fa.type) { - case Trigger::Stop: + case FollowAction::Stop: return -1; - case Trigger::QueuedTrigger: + case FollowAction::QueuedTrigger: /* XXX implement me */ return -1; default: @@ -3015,15 +3056,15 @@ TriggerBox::determine_next_trigger (uint32_t current) /* second switch: handle the "real" follow actions */ - switch (fa) { - case Trigger::None: + switch (fa.type) { + case FollowAction::None: return -1; - case Trigger::Again: + case FollowAction::Again: return current; - case Trigger::NextTrigger: + case FollowAction::NextTrigger: n = current + 1; if (n < all_triggers.size()) { if (all_triggers[n]->region()) { @@ -3032,7 +3073,7 @@ TriggerBox::determine_next_trigger (uint32_t current) } break; - case Trigger::PrevTrigger: + case FollowAction::PrevTrigger: if (current > 0) { n = current - 1; if (all_triggers[n]->region()) { @@ -3041,7 +3082,7 @@ TriggerBox::determine_next_trigger (uint32_t current) } break; - case Trigger::ForwardTrigger: + case FollowAction::ForwardTrigger: n = current; while (true) { ++n; @@ -3062,7 +3103,7 @@ TriggerBox::determine_next_trigger (uint32_t current) } break; - case Trigger::ReverseTrigger: + case FollowAction::ReverseTrigger: n = current; while (true) { if (n == 0) { @@ -3081,14 +3122,14 @@ TriggerBox::determine_next_trigger (uint32_t current) } break; - case Trigger::FirstTrigger: + case FollowAction::FirstTrigger: for (n = 0; n < all_triggers.size(); ++n) { if (all_triggers[n]->region() && !all_triggers[n]->active ()) { return n; } } break; - case Trigger::LastTrigger: + case FollowAction::LastTrigger: for (int i = all_triggers.size() - 1; i >= 0; --i) { if (all_triggers[i]->region() && !all_triggers[i]->active ()) { return i; @@ -3096,7 +3137,7 @@ TriggerBox::determine_next_trigger (uint32_t current) } break; - case Trigger::AnyTrigger: + case FollowAction::AnyTrigger: while (true) { n = _pcg.rand (all_triggers.size()); if (!all_triggers[n]->region()) { @@ -3110,7 +3151,7 @@ TriggerBox::determine_next_trigger (uint32_t current) return n; - case Trigger::OtherTrigger: + case FollowAction::OtherTrigger: while (true) { n = _pcg.rand (all_triggers.size()); if ((uint32_t) n == current) { @@ -3126,10 +3167,21 @@ TriggerBox::determine_next_trigger (uint32_t current) } return n; + case FollowAction::JumpTrigger: + for (std::size_t n = 0; n < default_triggers_per_box; ++n) { + if (fa.targets.test (n) && all_triggers[n]->region()) { + possible_targets.push_back (n); + } + } + if (possible_targets.empty()) { + return 1; + } + return possible_targets[_pcg.rand (possible_targets.size())]; + /* NOTREACHED */ - case Trigger::Stop: - case Trigger::QueuedTrigger: + case FollowAction::Stop: + case FollowAction::QueuedTrigger: break; } diff --git a/libs/canvas/canvas.cc b/libs/canvas/canvas.cc index 955b999509..1ca149e524 100644 --- a/libs/canvas/canvas.cc +++ b/libs/canvas/canvas.cc @@ -299,7 +299,6 @@ Canvas::window_to_canvas (Duple const & d) const { ScrollGroup* best_group = 0; ScrollGroup* sg = 0; - bool grabbed_item_inside = false; /* if the coordinates are negative, clamp to zero and find the item * that covers that "edge" position. @@ -333,8 +332,6 @@ Canvas::window_to_canvas (Duple const & d) const best_group = sg; - grabbed_item_inside = check_grabbed_item_inside (sg); - if (sg->sensitivity() == (ScrollGroup::ScrollsVertically | ScrollGroup::ScrollsHorizontally)) { /* Can't do any better than this. */ break; @@ -343,7 +340,7 @@ Canvas::window_to_canvas (Duple const & d) const } } - if (best_group && (!have_grab() || grabbed_item_inside)) { + if (best_group && (!have_grab() || grab_can_translate ())) { return d.translate (best_group->scroll_offset()); } @@ -1518,13 +1515,14 @@ GtkCanvas::resize_handler () } bool -GtkCanvas::check_grabbed_item_inside (Item* possible_parent) const +GtkCanvas::grab_can_translate () const { if (!_grabbed_item) { - return false; + /* weird, but correct! */ + return true; } - return _grabbed_item->is_descendant_of (*possible_parent); + return _grabbed_item->scroll_translation (); } /** Create a GtkCanvaSViewport. diff --git a/libs/canvas/canvas/canvas.h b/libs/canvas/canvas/canvas.h index 265fbd8ae2..db39005d4b 100644 --- a/libs/canvas/canvas/canvas.h +++ b/libs/canvas/canvas/canvas.h @@ -92,7 +92,7 @@ public: virtual void unfocus (Item*) = 0; virtual bool have_grab() const { return false; } - virtual bool check_grabbed_item_inside (Item*) const { return false; } + virtual bool grab_can_translate () const { return true; } void render (Rect const &, Cairo::RefPtr const &) const; @@ -218,7 +218,7 @@ public: void unfocus (Item*); bool have_grab() const { return _grabbed_item; } - bool check_grabbed_item_inside (Item*) const; + bool grab_can_translate () const; Rect visible_area () const; Coord width() const; diff --git a/libs/canvas/canvas/item.h b/libs/canvas/canvas/item.h index 05b3f0451c..2c74c23fa4 100644 --- a/libs/canvas/canvas/item.h +++ b/libs/canvas/canvas/item.h @@ -285,6 +285,9 @@ public: bool resize_queued() const { return _resize_queued; } void queue_resize(); + bool scroll_translation() const { return _scroll_translation; } + void disable_scroll_translation (); + /* only derived containers need to implement this, but this is where they compute the sizes and position and their children. A fixed-layout container (i.e. one where every child @@ -369,7 +372,8 @@ private: std::string _tooltip; bool _ignore_events; - + bool _scroll_translation; + void find_scroll_parent (); void propagate_show_hide (); }; diff --git a/libs/canvas/item.cc b/libs/canvas/item.cc index 50c842ca1d..5b8c1dde6b 100644 --- a/libs/canvas/item.cc +++ b/libs/canvas/item.cc @@ -49,6 +49,7 @@ Item::Item (Canvas* canvas) , _requested_width (-1) , _requested_height (-1) , _ignore_events (false) + , _scroll_translation (true) { DEBUG_TRACE (DEBUG::CanvasItems, string_compose ("new canvas item %1\n", this)); } @@ -68,6 +69,7 @@ Item::Item (Item* parent) , _requested_width (-1) , _requested_height (-1) , _ignore_events (false) + , _scroll_translation (true) { DEBUG_TRACE (DEBUG::CanvasItems, string_compose ("new canvas item %1\n", this)); @@ -1342,3 +1344,9 @@ Item::set_pack_options (PackOptions po) /* must be called before adding/packing Item in a Container */ _pack_options = po; } + +void +Item::disable_scroll_translation () +{ + _scroll_translation = false; +} diff --git a/wscript b/wscript index 5ba4e247a9..c21d55d11a 100644 --- a/wscript +++ b/wscript @@ -807,8 +807,8 @@ def options(opt): help='Compile with -rdynamic -- allow obtaining backtraces from within Ardour') opt.add_option('--no-carbon', action='store_true', default=False, dest='nocarbon', help='Compile without support for AU Plugins with only CARBON UI (needed for 64bit)') - opt.add_option('--no-compile-database', action='store_true', default=False, dest='clang_compile_db', - help='Do not call clang_compilation_database to write compile_commands.json prior to build') + opt.add_option('--compile-database', action='store_true', default=False, dest='clang_compile_db', + help='Enable clang_compilation_database to write compile_commands.json prior to build') opt.add_option('--boost-sp-debug', action='store_true', default=False, dest='boost_sp_debug', help='Compile with Boost shared pointer debugging') opt.add_option('--debug-symbols', action='store_true', default=False, dest='debug_symbols', @@ -937,7 +937,7 @@ def configure(conf): conf.load('compiler_cxx') if Options.options.dist_target == 'mingw': conf.load('winres') - elif not Options.options.clang_compile_db: + elif Options.options.clang_compile_db: conf.load('clang_compilation_database') if Options.options.dist_target == 'msvc':