use session stripable selection API
and remove old ControlProtocol signals to talk to GUI etc.
This commit is contained in:
parent
57ee61772b
commit
291aec468f
@ -495,6 +495,41 @@ BasicUI::sample_to_timecode (framepos_t sample, Timecode::Time& timecode, bool u
|
||||
session->sample_to_timecode (sample, *((Timecode::Time*)&timecode), use_offset, use_subframes);
|
||||
}
|
||||
|
||||
void
|
||||
BasicUI::toggle_selection (PresentationInfo::order_t o, PresentationInfo::Flag flags)
|
||||
{
|
||||
boost::shared_ptr<Stripable> s = session->get_remote_nth_stripable (o, flags);
|
||||
|
||||
if (s) {
|
||||
s->presentation_info().set_selected (!s->presentation_info().selected());
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
BasicUI::clear_stripable_selection ()
|
||||
{
|
||||
session->clear_stripable_selection ();
|
||||
}
|
||||
|
||||
void
|
||||
BasicUI::toggle_stripable_selection (boost::shared_ptr<Stripable> s)
|
||||
{
|
||||
session->toggle_stripable_selection (s);
|
||||
}
|
||||
|
||||
void
|
||||
BasicUI::add_stripable_selection (boost::shared_ptr<Stripable> s)
|
||||
{
|
||||
session->add_stripable_selection (s);
|
||||
}
|
||||
|
||||
void
|
||||
BasicUI::set_stripable_selection (boost::shared_ptr<Stripable> s)
|
||||
{
|
||||
session->set_stripable_selection (s);
|
||||
}
|
||||
|
||||
|
||||
#if 0
|
||||
this stuff is waiting to go in so that all UIs can offer complex solo/mute functionality
|
||||
|
||||
|
@ -50,11 +50,6 @@ PBD::Signal0<void> ControlProtocol::StepTracksDown;
|
||||
PBD::Signal0<void> ControlProtocol::StepTracksUp;
|
||||
|
||||
PBD::Signal1<void,StripableNotificationListPtr> ControlProtocol::StripableSelectionChanged;
|
||||
PBD::Signal1<void,uint64_t> ControlProtocol::AddStripableSelection;
|
||||
PBD::Signal1<void,uint64_t> ControlProtocol::SetStripableSelection;
|
||||
PBD::Signal1<void,uint64_t> ControlProtocol::ToggleStripableSelection;
|
||||
PBD::Signal0<void> ControlProtocol::ClearStripableSelection;
|
||||
|
||||
|
||||
const std::string ControlProtocol::state_node_name ("Protocol");
|
||||
|
||||
|
@ -27,6 +27,7 @@
|
||||
#include "pbd/signals.h"
|
||||
|
||||
#include "ardour/types.h"
|
||||
#include "ardour/presentation_info.h"
|
||||
|
||||
#include "timecode/time.h"
|
||||
|
||||
@ -35,6 +36,7 @@
|
||||
namespace ARDOUR {
|
||||
class Session;
|
||||
class SessionEvent;
|
||||
class Stripable;
|
||||
}
|
||||
|
||||
class LIBCONTROLCP_API BasicUI {
|
||||
@ -44,7 +46,13 @@ class LIBCONTROLCP_API BasicUI {
|
||||
|
||||
void add_marker (const std::string& = std::string());
|
||||
void remove_marker_at_playhead ();
|
||||
|
||||
|
||||
void clear_stripable_selection ();
|
||||
void toggle_stripable_selection (boost::shared_ptr<ARDOUR::Stripable>);
|
||||
void add_stripable_selection (boost::shared_ptr<ARDOUR::Stripable>);
|
||||
void set_stripable_selection (boost::shared_ptr<ARDOUR::Stripable>);
|
||||
void toggle_selection (ARDOUR::PresentationInfo::order_t, ARDOUR::PresentationInfo::Flag);
|
||||
|
||||
// void mark_in();
|
||||
// void mark_out();
|
||||
|
||||
|
@ -78,11 +78,6 @@ class LIBCONTROLCP_API ControlProtocol : public PBD::Stateful, public PBD::Scope
|
||||
static PBD::Signal0<void> StepTracksDown;
|
||||
static PBD::Signal0<void> StepTracksUp;
|
||||
|
||||
static PBD::Signal1<void,uint64_t> AddStripableSelection;
|
||||
static PBD::Signal1<void,uint64_t> SetStripableSelection;
|
||||
static PBD::Signal1<void,uint64_t> ToggleStripableSelection;
|
||||
static PBD::Signal0<void> ClearStripableSelection;
|
||||
|
||||
/* 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.
|
||||
|
@ -165,14 +165,9 @@ MIDIFunction::execute ()
|
||||
|
||||
case Select:
|
||||
if (!_argument.empty()) {
|
||||
/* this uses only the numerical orderpart of a
|
||||
PresentionInfo, because it only sets the lower 32
|
||||
bits of a 64 bit value. This will be interpreted
|
||||
as a request to select only Routes.
|
||||
*/
|
||||
uint32_t rid;
|
||||
sscanf (_argument.c_str(), "%d", &rid);
|
||||
_ui->SetStripableSelection (rid);
|
||||
_ui->toggle_selection (rid, ARDOUR::PresentationInfo::Flag (ARDOUR::PresentationInfo::Route|ARDOUR::PresentationInfo::VCA));
|
||||
DEBUG_TRACE (DEBUG::GenericMidi, string_compose ("Function: SetRouteSelection = %1\n", rid));
|
||||
}
|
||||
break;
|
||||
|
@ -2039,21 +2039,24 @@ MackieControlProtocol::select_range ()
|
||||
return;
|
||||
}
|
||||
|
||||
cerr << "Main modifier state = " << hex << main_modifier_state() << dec << endl;
|
||||
if (stripables.size() == 1 && _last_selected_stripables.size() == 1 && stripables.front()->presentation_info().selected()) {
|
||||
/* cancel selection for one and only selected stripable */
|
||||
session->toggle_stripable_selection (stripables.front());
|
||||
} else {
|
||||
|
||||
for (StripableList::iterator s = stripables.begin(); s != stripables.end(); ++s) {
|
||||
for (StripableList::iterator s = stripables.begin(); s != stripables.end(); ++s) {
|
||||
|
||||
if (main_modifier_state() == MODIFIER_CONTROL) {
|
||||
DEBUG_TRACE (DEBUG::MackieControl, string_compose ("toggle selection of %1 (%2)\n", (*s)->name(), (*s)->presentation_info().order()));
|
||||
cerr << "Toggle selection\n";
|
||||
ToggleStripableSelection ((*s)->presentation_info ().order());
|
||||
} else {
|
||||
if (s == stripables.begin()) {
|
||||
DEBUG_TRACE (DEBUG::MackieControl, string_compose ("set selection of %1 (%2)\n", (*s)->name(), (*s)->presentation_info().order()));
|
||||
SetStripableSelection ((*s)->presentation_info().order());
|
||||
if (main_modifier_state() == MODIFIER_CONTROL) {
|
||||
DEBUG_TRACE (DEBUG::MackieControl, string_compose ("toggle selection of %1 (%2)\n", (*s)->name(), (*s)->presentation_info().order()));
|
||||
session->toggle_stripable_selection (*s);
|
||||
} else {
|
||||
DEBUG_TRACE (DEBUG::MackieControl, string_compose ("add to selection %1 (%2)\n", (*s)->name(), (*s)->presentation_info().order()));
|
||||
AddStripableSelection ((*s)->presentation_info().order());
|
||||
if (s == stripables.begin()) {
|
||||
DEBUG_TRACE (DEBUG::MackieControl, string_compose ("set selection of %1 (%2)\n", (*s)->name(), (*s)->presentation_info().order()));
|
||||
session->set_stripable_selection (*s);
|
||||
} else {
|
||||
DEBUG_TRACE (DEBUG::MackieControl, string_compose ("add to selection %1 (%2)\n", (*s)->name(), (*s)->presentation_info().order()));
|
||||
session->add_stripable_selection (*s);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -2384,12 +2387,41 @@ MackieControlProtocol::is_mapped (boost::shared_ptr<Stripable> r) const
|
||||
}
|
||||
|
||||
void
|
||||
MackieControlProtocol::update_selected (boost::shared_ptr<Stripable> s, bool selected)
|
||||
MackieControlProtocol::update_selected (boost::shared_ptr<Stripable> s, bool became_selected)
|
||||
{
|
||||
if (selected) {
|
||||
_last_selected_stripables.insert (boost::weak_ptr<Stripable> (s));
|
||||
if (became_selected) {
|
||||
|
||||
if (selected (s)) {
|
||||
/* already selected .. mmmm */
|
||||
cerr << "stripable " << s->name() << " already marked as selected\n";
|
||||
return;
|
||||
}
|
||||
|
||||
_last_selected_stripables.push_back (boost::weak_ptr<Stripable> (s));
|
||||
|
||||
check_fader_automation_state ();
|
||||
|
||||
/* It is possible that first_selected_route() may return null if we
|
||||
* are no longer displaying/mapping that route. In that case,
|
||||
* we will exit subview mode. If first_selected_route() is
|
||||
* null, and subview mode is not None, then the first call to
|
||||
* set_subview_mode() will fail, and we will reset to None.
|
||||
*/
|
||||
|
||||
if (set_subview_mode (_subview_mode, first_selected_stripable())) {
|
||||
set_subview_mode (None, boost::shared_ptr<Stripable>());
|
||||
}
|
||||
|
||||
} else {
|
||||
_last_selected_stripables.erase (boost::weak_ptr<Stripable> (s));
|
||||
|
||||
for (Selection::iterator i = _last_selected_stripables.begin(); i != _last_selected_stripables.end(); ++i) {
|
||||
boost::shared_ptr<ARDOUR::Stripable> ss = (*i).lock();
|
||||
|
||||
if (ss == s) {
|
||||
_last_selected_stripables.erase (i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -335,7 +335,7 @@ class MackieControlProtocol
|
||||
bool needs_ipmidi_restart;
|
||||
bool _metering_active;
|
||||
bool _initialized;
|
||||
typedef std::set<boost::weak_ptr<ARDOUR::Stripable> > Selection;
|
||||
typedef std::vector<boost::weak_ptr<ARDOUR::Stripable> > Selection;
|
||||
Selection _last_selected_stripables;
|
||||
XMLNode* configuration_state;
|
||||
int state_version;
|
||||
|
@ -2094,8 +2094,7 @@ OSC::strip_gui_select (int ssid, int yn, lo_message msg)
|
||||
sur->expand_enable = false;
|
||||
boost::shared_ptr<Stripable> s = get_strip (ssid, lo_message_get_source (msg));
|
||||
if (s) {
|
||||
SetStripableSelection (s->presentation_info().order() + 1);
|
||||
//s->presentation_info().set_selected(true);
|
||||
s->presentation_info().set_selected (!s->presentation_info().selected());
|
||||
} else {
|
||||
route_send_fail ("select", ssid, 0, lo_message_get_source (msg));
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user