mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-17 12:16:30 +01:00
use session stripable selection API
and remove old ControlProtocol signals to talk to GUI etc.
This commit is contained in:
parent
57ee61772b
commit
291aec468f
8 changed files with 95 additions and 36 deletions
|
|
@ -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);
|
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
|
#if 0
|
||||||
this stuff is waiting to go in so that all UIs can offer complex solo/mute functionality
|
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::Signal0<void> ControlProtocol::StepTracksUp;
|
||||||
|
|
||||||
PBD::Signal1<void,StripableNotificationListPtr> ControlProtocol::StripableSelectionChanged;
|
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");
|
const std::string ControlProtocol::state_node_name ("Protocol");
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -27,6 +27,7 @@
|
||||||
#include "pbd/signals.h"
|
#include "pbd/signals.h"
|
||||||
|
|
||||||
#include "ardour/types.h"
|
#include "ardour/types.h"
|
||||||
|
#include "ardour/presentation_info.h"
|
||||||
|
|
||||||
#include "timecode/time.h"
|
#include "timecode/time.h"
|
||||||
|
|
||||||
|
|
@ -35,6 +36,7 @@
|
||||||
namespace ARDOUR {
|
namespace ARDOUR {
|
||||||
class Session;
|
class Session;
|
||||||
class SessionEvent;
|
class SessionEvent;
|
||||||
|
class Stripable;
|
||||||
}
|
}
|
||||||
|
|
||||||
class LIBCONTROLCP_API BasicUI {
|
class LIBCONTROLCP_API BasicUI {
|
||||||
|
|
@ -45,6 +47,12 @@ class LIBCONTROLCP_API BasicUI {
|
||||||
void add_marker (const std::string& = std::string());
|
void add_marker (const std::string& = std::string());
|
||||||
void remove_marker_at_playhead ();
|
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_in();
|
||||||
// void mark_out();
|
// 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> StepTracksDown;
|
||||||
static PBD::Signal0<void> StepTracksUp;
|
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
|
/* 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
|
respond. Typically this will always be GUI->"others" - the GUI pays
|
||||||
no attention to these signals.
|
no attention to these signals.
|
||||||
|
|
|
||||||
|
|
@ -165,14 +165,9 @@ MIDIFunction::execute ()
|
||||||
|
|
||||||
case Select:
|
case Select:
|
||||||
if (!_argument.empty()) {
|
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;
|
uint32_t rid;
|
||||||
sscanf (_argument.c_str(), "%d", &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));
|
DEBUG_TRACE (DEBUG::GenericMidi, string_compose ("Function: SetRouteSelection = %1\n", rid));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
|
||||||
|
|
@ -2039,21 +2039,24 @@ MackieControlProtocol::select_range ()
|
||||||
return;
|
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) {
|
if (main_modifier_state() == MODIFIER_CONTROL) {
|
||||||
DEBUG_TRACE (DEBUG::MackieControl, string_compose ("toggle selection of %1 (%2)\n", (*s)->name(), (*s)->presentation_info().order()));
|
DEBUG_TRACE (DEBUG::MackieControl, string_compose ("toggle selection of %1 (%2)\n", (*s)->name(), (*s)->presentation_info().order()));
|
||||||
cerr << "Toggle selection\n";
|
session->toggle_stripable_selection (*s);
|
||||||
ToggleStripableSelection ((*s)->presentation_info ().order());
|
|
||||||
} else {
|
} else {
|
||||||
if (s == stripables.begin()) {
|
if (s == stripables.begin()) {
|
||||||
DEBUG_TRACE (DEBUG::MackieControl, string_compose ("set selection of %1 (%2)\n", (*s)->name(), (*s)->presentation_info().order()));
|
DEBUG_TRACE (DEBUG::MackieControl, string_compose ("set selection of %1 (%2)\n", (*s)->name(), (*s)->presentation_info().order()));
|
||||||
SetStripableSelection ((*s)->presentation_info().order());
|
session->set_stripable_selection (*s);
|
||||||
} else {
|
} else {
|
||||||
DEBUG_TRACE (DEBUG::MackieControl, string_compose ("add to selection %1 (%2)\n", (*s)->name(), (*s)->presentation_info().order()));
|
DEBUG_TRACE (DEBUG::MackieControl, string_compose ("add to selection %1 (%2)\n", (*s)->name(), (*s)->presentation_info().order()));
|
||||||
AddStripableSelection ((*s)->presentation_info().order());
|
session->add_stripable_selection (*s);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -2384,12 +2387,41 @@ MackieControlProtocol::is_mapped (boost::shared_ptr<Stripable> r) const
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
MackieControlProtocol::update_selected (boost::shared_ptr<Stripable> s, bool selected)
|
MackieControlProtocol::update_selected (boost::shared_ptr<Stripable> s, bool became_selected)
|
||||||
{
|
{
|
||||||
if (selected) {
|
if (became_selected) {
|
||||||
_last_selected_stripables.insert (boost::weak_ptr<Stripable> (s));
|
|
||||||
|
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 {
|
} 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 needs_ipmidi_restart;
|
||||||
bool _metering_active;
|
bool _metering_active;
|
||||||
bool _initialized;
|
bool _initialized;
|
||||||
typedef std::set<boost::weak_ptr<ARDOUR::Stripable> > Selection;
|
typedef std::vector<boost::weak_ptr<ARDOUR::Stripable> > Selection;
|
||||||
Selection _last_selected_stripables;
|
Selection _last_selected_stripables;
|
||||||
XMLNode* configuration_state;
|
XMLNode* configuration_state;
|
||||||
int state_version;
|
int state_version;
|
||||||
|
|
|
||||||
|
|
@ -2094,8 +2094,7 @@ OSC::strip_gui_select (int ssid, int yn, lo_message msg)
|
||||||
sur->expand_enable = false;
|
sur->expand_enable = false;
|
||||||
boost::shared_ptr<Stripable> s = get_strip (ssid, lo_message_get_source (msg));
|
boost::shared_ptr<Stripable> s = get_strip (ssid, lo_message_get_source (msg));
|
||||||
if (s) {
|
if (s) {
|
||||||
SetStripableSelection (s->presentation_info().order() + 1);
|
s->presentation_info().set_selected (!s->presentation_info().selected());
|
||||||
//s->presentation_info().set_selected(true);
|
|
||||||
} else {
|
} else {
|
||||||
route_send_fail ("select", ssid, 0, lo_message_get_source (msg));
|
route_send_fail ("select", ssid, 0, lo_message_get_source (msg));
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue