propagate GUI track selection to control protocols; make MCP update when GUI track selection changes

git-svn-id: svn://localhost/ardour2/branches/3.0@11941 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Paul Davis 2012-04-12 14:34:03 +00:00
parent cd21bc58aa
commit 62620122a9
11 changed files with 113 additions and 3 deletions

View file

@ -29,6 +29,8 @@
#include "ardour/midi_region.h"
#include "ardour/audioplaylist.h"
#include "control_protocol/control_protocol.h"
#include "editor.h"
#include "actions.h"
#include "audio_time_axis.h"
@ -965,6 +967,8 @@ Editor::track_selection_changed ()
break;
}
RouteNotificationListPtr routes (new RouteNotificationList);
for (TrackViewList::iterator i = track_views.begin(); i != track_views.end(); ++i) {
bool yn = (find (selection->tracks.begin(), selection->tracks.end(), *i) != selection->tracks.end());
@ -983,9 +987,21 @@ Editor::track_selection_changed ()
} else {
(*i)->hide_selection ();
}
if (yn) {
RouteTimeAxisView* rtav = dynamic_cast<RouteTimeAxisView*> (*i);
if (rtav) {
routes->push_back (rtav->route());
}
}
}
ActionManager::set_sensitive (ActionManager::track_selection_sensitive_actions, !selection->tracks.empty());
/* notify control protocols */
ControlProtocol::TrackSelectionChanged (routes);
}
void

View file

@ -46,6 +46,7 @@ PBD::Signal0<void> ControlProtocol::VerticalZoomInAll;
PBD::Signal0<void> ControlProtocol::VerticalZoomOutAll;
PBD::Signal0<void> ControlProtocol::VerticalZoomInSelected;
PBD::Signal0<void> ControlProtocol::VerticalZoomOutSelected;
PBD::Signal1<void,RouteNotificationListPtr> ControlProtocol::TrackSelectionChanged;
ControlProtocol::ControlProtocol (Session& s, string str, EventLoop* evloop)
: BasicUI (s),

View file

@ -24,10 +24,14 @@
#include <string>
#include <vector>
#include <list>
#include <boost/shared_ptr.hpp>
#include "pbd/stateful.h"
#include "pbd/signals.h"
#include "control_protocol/basic_ui.h"
#include "control_protocol/types.h"
namespace ARDOUR {
@ -72,6 +76,13 @@ class ControlProtocol : virtual public sigc::trackable, public PBD::Stateful, pu
static PBD::Signal0<void> VerticalZoomInSelected;
static PBD::Signal0<void> VerticalZoomOutSelected;
/* signals that one UI (e.g. the GUI) can emit to get all other UI's to
respond. Typically this will always be GUI->"others" - the GUI pays
no attention to these signals.
*/
static PBD::Signal1<void,RouteNotificationListPtr> TrackSelectionChanged;
/* the model here is as follows:
we imagine most control surfaces being able to control

View file

@ -0,0 +1,34 @@
/*
Copyright (C) 2006 Paul Davis
This program is free software; you can redistribute it
and/or modify it under the terms of the GNU Lesser
General Public License as published by the Free Software
Foundation; either version 2 of the License, or (at your
option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifndef __ardour_control_protocol_types_h__
#define __ardour_control_protocol_types_h__
#include <vector>
#include <boost/smart_ptr.hpp>
namespace ARDOUR {
class Route;
typedef std::vector<boost::shared_ptr<ARDOUR::Route> > RouteNotificationList;
typedef boost::shared_ptr<RouteNotificationList> RouteNotificationListPtr;
}
#endif /* __ardour_control_protocol_types_h__ */

View file

@ -57,7 +57,6 @@
#include "mackie_control_exception.h"
#include "surface_port.h"
#include "surface.h"
#include "strip.h"
#include "control_group.h"
#include "meter.h"
@ -112,6 +111,8 @@ MackieControlProtocol::MackieControlProtocol (Session& session)
this
);
TrackSelectionChanged.connect (gui_connections, MISSING_INVALIDATOR, ui_bind (&MackieControlProtocol::gui_track_selection_changed, this, _1), this);
_instance = this;
build_button_map ();
@ -1158,3 +1159,11 @@ MackieControlProtocol::load_device_info (const string& name)
_device_info = i->second;
}
void
MackieControlProtocol::gui_track_selection_changed (ARDOUR::RouteNotificationListPtr rl)
{
for (Surfaces::iterator s = surfaces.begin(); s != surfaces.end(); ++s) {
(*s)->gui_selection_changed (rl);
}
}

View file

@ -42,6 +42,8 @@
#include "timer.h"
#include "device_info.h"
class RouteTimeAxisView;
namespace MIDI {
class Port;
}
@ -244,6 +246,7 @@ class MackieControlProtocol
PBD::ScopedConnectionList session_connections;
PBD::ScopedConnectionList port_connections;
PBD::ScopedConnectionList route_connections;
PBD::ScopedConnectionList gui_connections;
bool _transport_previously_rolling;
// timer for two quick marker left presses
Mackie::Timer _frm_left_last;
@ -277,6 +280,8 @@ class MackieControlProtocol
void force_special_route_to_strip (boost::shared_ptr<ARDOUR::Route> r, uint32_t surface, uint32_t strip_number);
void build_button_map ();
void gui_track_selection_changed (ARDOUR::RouteNotificationListPtr);
/* BUTTON HANDLING */
/* implemented button handlers */

View file

@ -612,3 +612,17 @@ Strip::unlock_route ()
{
_route_locked = false;
}
MidiByteArray
Strip::gui_selection_changed (ARDOUR::RouteNotificationListPtr rl)
{
for (ARDOUR::RouteNotificationList::iterator i = rl->begin(); i != rl->end(); ++i) {
if ((*i) == _route) {
std::cerr << "Strip " << _index << " selected, route = " << (*i)->name() << std::endl;
return _select->set_state (on);
}
}
std::cerr << "Strip " << _index << " NOT selected\n";
return _select->set_state (off);
}

View file

@ -7,6 +7,8 @@
#include "pbd/property_basics.h"
#include "pbd/signals.h"
#include "control_protocol/types.h"
#include "control_group.h"
#include "types.h"
#include "midi_byte_array.h"
@ -70,6 +72,8 @@ public:
void lock_route ();
void unlock_route ();
MidiByteArray gui_selection_changed (ARDOUR::RouteNotificationListPtr);
private:
Button* _solo;
Button* _recenable;
@ -101,7 +105,6 @@ private:
void update_automation ();
void update_meter ();
};
}

View file

@ -725,3 +725,15 @@ Surface::update_view_mode_display ()
_port->write ((*s)->display (1, text));
}
}
void
Surface::gui_selection_changed (ARDOUR::RouteNotificationListPtr routes)
{
MidiByteArray msg;
for (Strips::iterator s = strips.begin(); s != strips.end(); ++s) {
msg << (*s)->gui_selection_changed (routes);
}
_port->write (msg);
}

View file

@ -5,6 +5,8 @@
#include "midi++/types.h"
#include "control_protocol/types.h"
#include "controls.h"
#include "types.h"
#include "mackie_jog_wheel.h"
@ -144,6 +146,8 @@ public:
void update_view_mode_display ();
void update_flip_mode_display ();
void gui_selection_changed (ARDOUR::RouteNotificationListPtr);
protected:
void init_controls();
void init_strips ();

View file

@ -41,7 +41,8 @@ def build(bld):
'''
obj.export_includes = ['./mackie']
obj.cxxflags = '-DPACKAGE="ardour_mackie"'
obj.includes = ['.', './mackie']
# need ../libs because some GTK2 header files require stuff there
obj.includes = ['.', '../libs']
obj.name = 'libardour_mcp'
obj.target = 'ardour_mcp'
obj.uselib = 'GTKMM'