keyboard->setup_keybindings ();
editor->setup_tooltips ();
editor->UpdateAllTransportClocks.connect (sigc::mem_fun (*this, &ARDOUR_UI::update_transport_clocks));
+
+ editor->track_mixer_selection ();
+ mixer->track_editor_selection ();
}
void
{
try {
- mixer = new Mixer_UI ();
+ mixer = Mixer_UI::instance ();
}
catch (failed_constructor& err) {
#include "marker.h"
#include "midi_time_axis.h"
#include "mixer_strip.h"
+#include "mixer_ui.h"
#include "mouse_cursors.h"
#include "playlist_selector.h"
#include "public_editor.h"
, _last_cut_copy_source_track (0)
, _region_selection_change_updates_region_list (true)
+ , _following_mixer_selection (false)
{
constructed = false;
/** Find a RouteTimeAxisView by the ID of its route */
RouteTimeAxisView*
-Editor::get_route_view_by_route_id (PBD::ID& id) const
+Editor::get_route_view_by_route_id (const PBD::ID& id) const
{
RouteTimeAxisView* v;
_control_point_context_menu.popup (event->button.button, event->button.time);
}
+
void foreach_time_axis_view (sigc::slot<void,TimeAxisView&>);
void add_to_idle_resize (TimeAxisView*, int32_t);
- RouteTimeAxisView* get_route_view_by_route_id (PBD::ID& id) const;
+ RouteTimeAxisView* get_route_view_by_route_id (const PBD::ID& id) const;
void consider_auditioning (boost::shared_ptr<ARDOUR::Region>);
void hide_a_region (boost::shared_ptr<ARDOUR::Region>);
Selection& get_selection() const { return *selection; }
Selection& get_cut_buffer() const { return *cut_buffer; }
+ void track_mixer_selection ();
bool extend_selection_to_track (TimeAxisView&);
void resize_text_widgets ();
+ void follow_mixer_selection ();
+ bool _following_mixer_selection;
+
friend class Drag;
friend class RegionDrag;
friend class RegionMoveDrag;
#include "pbd/enumwriter.h"
+#include "ardour/rc_configuration.h"
+
#include "actions.h"
#include "ardour_ui.h"
#include "audio_time_axis.h"
#include "gui_thread.h"
#include "midi_time_axis.h"
#include "mixer_strip.h"
+#include "mixer_ui.h"
#include "selection.h"
#include "i18n.h"
editor_mixer_strip_width = current_mixer_strip->get_width_enum ();
}
+
+void
+Editor::track_mixer_selection ()
+{
+ Mixer_UI::instance()->selection().RoutesChanged.connect (sigc::mem_fun (*this, &Editor::follow_mixer_selection));
+}
+
+void
+Editor::follow_mixer_selection ()
+{
+ if (!ARDOUR::Config->get_link_editor_and_mixer_selection() || _following_mixer_selection) {
+ return;
+ }
+
+ _following_mixer_selection = true;
+ selection->block_tracks_changed (true);
+
+ RouteUISelection& s (Mixer_UI::instance()->selection().routes);
+
+ selection->clear_tracks ();
+
+ for (RouteUISelection::iterator i = s.begin(); i != s.end(); ++i) {
+ TimeAxisView* tav = get_route_view_by_route_id ((*i)->route()->id());
+ if (tav) {
+ selection->add (tav);
+ }
+ }
+
+ _following_mixer_selection = false;
+ selection->block_tracks_changed (false);
+ selection->TracksChanged (); /* EMIT SIGNAL */
+}
MixerActor ();
virtual ~MixerActor ();
- RouteRedirectSelection& selection() { return _selection; }
+ RouteProcessorSelection& selection() { return _selection; }
void register_actions ();
void load_bindings ();
Gtkmm2ext::Bindings bindings;
protected:
- RouteRedirectSelection _selection;
+ RouteProcessorSelection _selection;
RouteUISelection _route_targets;
Gtkmm2ext::ActionMap myactions;
#include "mixer_strip.h"
#include "monitor_section.h"
#include "plugin_selector.h"
+#include "public_editor.h"
#include "ardour_ui.h"
#include "prompter.h"
#include "utils.h"
using PBD::atoi;
+Mixer_UI* Mixer_UI::_instance = 0;
+
+Mixer_UI*
+Mixer_UI::instance ()
+{
+ if (!_instance) {
+ _instance = new Mixer_UI;
+ }
+
+ return _instance;
+}
+
Mixer_UI::Mixer_UI ()
: Window (Gtk::WINDOW_TOPLEVEL)
+ , _following_editor_selection (false)
{
/* allow this window to become the key focus window */
set_flags (CAN_FOCUS);
{
}
+void
+Mixer_UI::track_editor_selection ()
+{
+ PublicEditor::instance().get_selection().TracksChanged.connect (sigc::mem_fun (*this, &Mixer_UI::follow_editor_selection));
+}
+
+
void
Mixer_UI::ensure_float (Window& win)
{
}
}
+void
+Mixer_UI::follow_editor_selection ()
+{
+ if (!Config->get_link_editor_and_mixer_selection() || _following_editor_selection) {
+ return;
+ }
+
+ _following_editor_selection = true;
+ _selection.block_routes_changed (true);
+
+ TrackSelection& s (PublicEditor::instance().get_selection().tracks);
+
+ _selection.clear_routes ();
+
+ for (TrackViewList::iterator i = s.begin(); i != s.end(); ++i) {
+ RouteTimeAxisView* rtav = dynamic_cast<RouteTimeAxisView*> (*i);
+ if (rtav) {
+ MixerStrip* ms = strip_by_route (rtav->route());
+ if (ms) {
+ _selection.add (ms);
+ }
+ }
+ }
+
+ _following_editor_selection = false;
+ _selection.block_routes_changed (false);
+}
+
+
MixerStrip*
Mixer_UI::strip_by_route (boost::shared_ptr<Route> r)
{
class Mixer_UI : public Gtk::Window, public PBD::ScopedConnectionList, public ARDOUR::SessionHandlePtr, public MixerActor
{
public:
- Mixer_UI ();
+ static Mixer_UI* instance();
~Mixer_UI();
void set_session (ARDOUR::Session *);
+ void track_editor_selection ();
PluginSelector* plugin_selector();
void set_route_targets_for_operation ();
private:
+ Mixer_UI ();
+ static Mixer_UI* _instance;
+
bool _visible;
Gtk::HBox global_hpacker;
void strip_select_op (bool audiotrack, bool select);
void select_strip_op (MixerStrip*, bool select);
- void follow_strip_selection ();
-
gint start_updating ();
gint stop_updating ();
MixerStrip* strip_by_x (int x);
friend class MixerGroupTabs;
+
+ void follow_editor_selection ();
+ bool _following_editor_selection;
};
#endif /* __ardour_mixer_ui_h__ */
}
ProcessorBox::ProcessorBox (ARDOUR::Session* sess, boost::function<PluginSelector*()> get_plugin_selector,
- RouteRedirectSelection& rsel, MixerStrip* parent, bool owner_is_mixer)
+ RouteProcessorSelection& rsel, MixerStrip* parent, bool owner_is_mixer)
: _parent_strip (parent)
, _owner_is_mixer (owner_is_mixer)
, ab_direction (true)
class MotionController;
class PluginSelector;
class PluginUIWindow;
-class RouteRedirectSelection;
+class RouteProcessorSelection;
class MixerStrip;
namespace ARDOUR {
};
ProcessorBox (ARDOUR::Session*, boost::function<PluginSelector*()> get_plugin_selector,
- RouteRedirectSelection&, MixerStrip* parent, bool owner_is_mixer = false);
+ RouteProcessorSelection&, MixerStrip* parent, bool owner_is_mixer = false);
~ProcessorBox ();
void set_route (boost::shared_ptr<ARDOUR::Route>);
*/
int _placement;
- RouteRedirectSelection& _rr_selection;
+ RouteProcessorSelection& _rr_selection;
void route_going_away ();
virtual gulong frame_to_pixel (framepos_t frame) const = 0;
virtual Selection& get_selection () const = 0;
virtual Selection& get_cut_buffer () const = 0;
+ virtual void track_mixer_selection () = 0;
virtual bool extend_selection_to_track (TimeAxisView&) = 0;
virtual void play_selection () = 0;
virtual void set_show_measures (bool yn) = 0;
virtual TimeAxisView* get_named_time_axis(const std::string & name) = 0;
#endif
- virtual RouteTimeAxisView* get_route_view_by_route_id (PBD::ID& id) const = 0;
+ virtual RouteTimeAxisView* get_route_view_by_route_id (const PBD::ID& id) const = 0;
virtual void get_equivalent_regions (RegionView* rv, std::vector<RegionView*>&, PBD::PropertyID) const = 0;
sigc::mem_fun (*_rc_config, &RCConfiguration::set_sync_all_route_ordering)
));
+ add_option (_("Editor"),
+ new BoolOption (
+ "link-editor-and-mixer-selection",
+ _("Synchronise editor and mixer selection"),
+ sigc::mem_fun (*_rc_config, &RCConfiguration::get_link_editor_and_mixer_selection),
+ sigc::mem_fun (*_rc_config, &RCConfiguration::set_link_editor_and_mixer_selection)
+ ));
+
add_option (_("Editor"),
new BoolOption (
"name-new-markers",
IOSelector * _output_iosel;
PluginSelector *_plugin_selector;
- RouteRedirectSelection _rr_selection;
+ RouteProcessorSelection _rr_selection;
boost::shared_ptr<ARDOUR::Route> _route;
PBD::ScopedConnection _route_processors_connection;
using namespace ARDOUR;
using namespace PBD;
-RouteRedirectSelection&
-RouteRedirectSelection::operator= (const RouteRedirectSelection& other)
+RouteProcessorSelection::RouteProcessorSelection()
+ : _no_route_change_signal (false)
+{
+}
+
+RouteProcessorSelection&
+RouteProcessorSelection::operator= (const RouteProcessorSelection& other)
{
if (&other != this) {
processors = other.processors;
}
bool
-operator== (const RouteRedirectSelection& a, const RouteRedirectSelection& b)
+operator== (const RouteProcessorSelection& a, const RouteProcessorSelection& b)
{
// XXX MUST TEST PROCESSORS SOMEHOW
return a.routes == b.routes;
}
void
-RouteRedirectSelection::clear ()
+RouteProcessorSelection::clear ()
{
clear_processors ();
clear_routes ();
}
void
-RouteRedirectSelection::clear_processors ()
+RouteProcessorSelection::clear_processors ()
{
processors.clear ();
ProcessorsChanged ();
}
void
-RouteRedirectSelection::clear_routes ()
+RouteProcessorSelection::clear_routes ()
{
for (RouteUISelection::iterator i = routes.begin(); i != routes.end(); ++i) {
(*i)->set_selected (false);
}
routes.clear ();
drop_connections ();
- RoutesChanged ();
+ if (!_no_route_change_signal) {
+ RoutesChanged ();
+ }
}
void
-RouteRedirectSelection::add (XMLNode* node)
+RouteProcessorSelection::add (XMLNode* node)
{
// XXX check for duplicate
processors.add (node);
}
void
-RouteRedirectSelection::set (XMLNode* node)
+RouteProcessorSelection::set (XMLNode* node)
{
clear_processors ();
processors.set (node);
}
void
-RouteRedirectSelection::add (RouteUI* r)
+RouteProcessorSelection::add (RouteUI* r)
{
if (find (routes.begin(), routes.end(), r) == routes.end()) {
if (routes.insert (r).second) {
MixerStrip* ms = dynamic_cast<MixerStrip*> (r);
if (ms) {
- ms->CatchDeletion.connect (*this, invalidator (*this), ui_bind (&RouteRedirectSelection::remove, this, _1), gui_context());
+ ms->CatchDeletion.connect (*this, invalidator (*this), ui_bind (&RouteProcessorSelection::remove, this, _1), gui_context());
+ }
+
+ if (!_no_route_change_signal) {
+ RoutesChanged();
}
-
- RoutesChanged();
}
}
}
void
-RouteRedirectSelection::remove (RouteUI* r)
+RouteProcessorSelection::remove (RouteUI* r)
{
- ENSURE_GUI_THREAD (*this, &RouteRedirectSelection::remove, r);
+ ENSURE_GUI_THREAD (*this, &RouteProcessorSelection::remove, r);
RouteUISelection::iterator i;
if ((i = find (routes.begin(), routes.end(), r)) != routes.end()) {
routes.erase (i);
(*i)->set_selected (false);
- RoutesChanged ();
+ if (!_no_route_change_signal) {
+ RoutesChanged ();
+ }
}
}
void
-RouteRedirectSelection::set (RouteUI* r)
+RouteProcessorSelection::set (RouteUI* r)
{
clear_routes ();
add (r);
}
bool
-RouteRedirectSelection::selected (RouteUI* r)
+RouteProcessorSelection::selected (RouteUI* r)
{
return find (routes.begin(), routes.end(), r) != routes.end();
}
bool
-RouteRedirectSelection::empty ()
+RouteProcessorSelection::empty ()
{
return processors.empty () && routes.empty ();
}
+void
+RouteProcessorSelection::block_routes_changed (bool yn)
+{
+ _no_route_change_signal = yn;
+}
#include "processor_selection.h"
#include "route_ui_selection.h"
-class RouteRedirectSelection : public PBD::ScopedConnectionList, public sigc::trackable
+class RouteProcessorSelection : public PBD::ScopedConnectionList, public sigc::trackable
{
public:
ProcessorSelection processors;
RouteUISelection routes;
- RouteRedirectSelection() {}
+ RouteProcessorSelection();
- RouteRedirectSelection& operator= (const RouteRedirectSelection& other);
+ RouteProcessorSelection& operator= (const RouteProcessorSelection& other);
sigc::signal<void> ProcessorsChanged;
sigc::signal<void> RoutesChanged;
+ void block_routes_changed (bool);
+
void clear ();
bool empty();
private:
void removed (RouteUI*);
+ bool _no_route_change_signal;
};
-bool operator==(const RouteRedirectSelection& a, const RouteRedirectSelection& b);
+bool operator==(const RouteProcessorSelection& a, const RouteProcessorSelection& b);
#endif /* __ardour_gtk_route_processor_selection_h__ */
: tracks (e)
, editor (e)
, next_time_id (0)
+ , _no_tracks_changed (false)
{
clear ();
{
if (!tracks.empty()) {
tracks.clear ();
- TracksChanged();
+ if (!_no_tracks_changed) {
+ TracksChanged();
+ }
}
}
tracks.erase (i);
}
- TracksChanged();
+ if (!_no_tracks_changed) {
+ TracksChanged();
+ }
}
void
TrackViewList added = tracks.add (track_list);
if (!added.empty()) {
- TracksChanged ();
+ if (!_no_tracks_changed) {
+ TracksChanged ();
+ }
}
}
list<TimeAxisView*>::iterator i;
if ((i = find (tracks.begin(), tracks.end(), track)) != tracks.end()) {
tracks.erase (i);
- TracksChanged();
+ if (!_no_tracks_changed) {
+ TracksChanged();
+ }
}
}
}
if (changed) {
- TracksChanged();
+ if (!_no_tracks_changed) {
+ TracksChanged();
+ }
}
}
i = tmp;
}
}
+
+void
+Selection::block_tracks_changed (bool yn)
+{
+ _no_tracks_changed = yn;
+}
sigc::signal<void> MidiNotesChanged;
sigc::signal<void> MidiRegionsChanged;
+ void block_tracks_changed (bool);
+
void clear ();
bool empty (bool internal_selection = false);
PublicEditor const * editor;
uint32_t next_time_id;
+ bool _no_tracks_changed;
};
bool operator==(const Selection& a, const Selection& b);
CONFIG_VARIABLE (EditMode, edit_mode, "edit-mode", Slide)
CONFIG_VARIABLE (bool, link_region_and_track_selection, "link-region-and-track-selection", false)
+CONFIG_VARIABLE (bool, link_editor_and_mixer_selection, "link-editor-and-mixer-selection", false)
CONFIG_VARIABLE (std::string, keyboard_layout_name, "keyboard-layout-name", "ansi")
CONFIG_VARIABLE (bool, automation_follows_regions, "automation-follows-regions", true)
CONFIG_VARIABLE (bool, region_boundaries_from_selected_tracks, "region-boundaries-from-selected-tracks", true)