mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-07 23:35:03 +01:00
mackie: improvements to display when switching subview modes
This commit is contained in:
parent
d19b1b64b1
commit
ea895efb97
4 changed files with 97 additions and 33 deletions
|
|
@ -1654,19 +1654,30 @@ MackieControlProtocol::subview_mode_would_be_ok (SubViewMode mode, boost::shared
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool
|
||||||
|
MackieControlProtocol::redisplay_subview_mode ()
|
||||||
|
{
|
||||||
|
Surfaces copy; /* can't hold surfaces lock while calling Strip::subview_mode_changed */
|
||||||
|
|
||||||
|
{
|
||||||
|
Glib::Threads::Mutex::Lock lm (surfaces_lock);
|
||||||
|
copy = surfaces;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (Surfaces::iterator s = copy.begin(); s != copy.end(); ++s) {
|
||||||
|
(*s)->subview_mode_changed ();
|
||||||
|
}
|
||||||
|
|
||||||
|
/* don't call this again from a timeout */
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
MackieControlProtocol::set_subview_mode (SubViewMode sm, boost::shared_ptr<Route> r)
|
MackieControlProtocol::set_subview_mode (SubViewMode sm, boost::shared_ptr<Route> r)
|
||||||
{
|
{
|
||||||
SubViewMode old_mode = _subview_mode;
|
SubViewMode old_mode = _subview_mode;
|
||||||
boost::shared_ptr<Route> old_route = _subview_route;
|
boost::shared_ptr<Route> old_route = _subview_route;
|
||||||
|
|
||||||
_subview_mode = sm;
|
|
||||||
|
|
||||||
if (r) {
|
|
||||||
/* retain _subview_route even if it is reset to null implicitly */
|
|
||||||
_subview_route = r;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!subview_mode_would_be_ok (sm, r)) {
|
if (!subview_mode_would_be_ok (sm, r)) {
|
||||||
|
|
||||||
Glib::Threads::Mutex::Lock lm (surfaces_lock);
|
Glib::Threads::Mutex::Lock lm (surfaces_lock);
|
||||||
|
|
@ -1690,12 +1701,27 @@ MackieControlProtocol::set_subview_mode (SubViewMode sm, boost::shared_ptr<Route
|
||||||
}
|
}
|
||||||
if (!msg.empty()) {
|
if (!msg.empty()) {
|
||||||
surfaces.front()->display_message_for (msg, 1000);
|
surfaces.front()->display_message_for (msg, 1000);
|
||||||
|
if (_subview_mode != None) {
|
||||||
|
/* redisplay current subview mode after
|
||||||
|
that message goes away.
|
||||||
|
*/
|
||||||
|
Glib::RefPtr<Glib::TimeoutSource> redisplay_timeout = Glib::TimeoutSource::create (1000); // milliseconds
|
||||||
|
redisplay_timeout->connect (sigc::mem_fun (*this, &MackieControlProtocol::redisplay_subview_mode));
|
||||||
|
redisplay_timeout->attach (main_loop()->get_context());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_subview_mode = sm;
|
||||||
|
|
||||||
|
if (r) {
|
||||||
|
/* retain _subview_route even if it is reset to null implicitly */
|
||||||
|
_subview_route = r;
|
||||||
|
}
|
||||||
|
|
||||||
if ((_subview_mode != old_mode) || (_subview_route != old_route)) {
|
if ((_subview_mode != old_mode) || (_subview_route != old_route)) {
|
||||||
|
|
||||||
if (r != old_route) {
|
if (r != old_route) {
|
||||||
|
|
@ -1707,18 +1733,7 @@ MackieControlProtocol::set_subview_mode (SubViewMode sm, boost::shared_ptr<Route
|
||||||
|
|
||||||
/* subview mode did actually change */
|
/* subview mode did actually change */
|
||||||
|
|
||||||
{
|
redisplay_subview_mode ();
|
||||||
Surfaces copy; /* can't hold surfaces lock while calling Strip::subview_mode_changed */
|
|
||||||
|
|
||||||
{
|
|
||||||
Glib::Threads::Mutex::Lock lm (surfaces_lock);
|
|
||||||
copy = surfaces;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (Surfaces::iterator s = copy.begin(); s != copy.end(); ++s) {
|
|
||||||
(*s)->subview_mode_changed ();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (_subview_mode != old_mode) {
|
if (_subview_mode != old_mode) {
|
||||||
|
|
||||||
|
|
@ -1775,13 +1790,11 @@ MackieControlProtocol::set_view_mode (ViewMode m)
|
||||||
|
|
||||||
void
|
void
|
||||||
MackieControlProtocol::display_view_mode ()
|
MackieControlProtocol::display_view_mode ()
|
||||||
{
|
|
||||||
{
|
{
|
||||||
Glib::Threads::Mutex::Lock lm (surfaces_lock);
|
Glib::Threads::Mutex::Lock lm (surfaces_lock);
|
||||||
|
|
||||||
for (Surfaces::iterator s = surfaces.begin(); s != surfaces.end(); ++s) {
|
for (Surfaces::iterator s = surfaces.begin(); s != surfaces.end(); ++s) {
|
||||||
(*s)->update_view_mode_display ();
|
(*s)->update_view_mode_display (true);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1924,7 +1937,18 @@ MackieControlProtocol::_gui_track_selection_changed (ARDOUR::RouteNotificationLi
|
||||||
|
|
||||||
if (gui_selection_did_change) {
|
if (gui_selection_did_change) {
|
||||||
|
|
||||||
/* actual GUI selection changed, which may affect subview state */
|
/* note: this method is also called when we switch banks.
|
||||||
|
* But ... we don't allow bank switching when in subview mode.
|
||||||
|
*
|
||||||
|
* so .. we only have to care about subview mode if the
|
||||||
|
* GUI selection has changed.
|
||||||
|
*
|
||||||
|
* 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_route())) {
|
if (set_subview_mode (_subview_mode, first_selected_route())) {
|
||||||
set_subview_mode (None, boost::shared_ptr<Route>());
|
set_subview_mode (None, boost::shared_ptr<Route>());
|
||||||
|
|
@ -2294,6 +2318,20 @@ MackieControlProtocol::is_hidden (boost::shared_ptr<Route> r) const
|
||||||
return (((r->remote_control_id()) >>31) != 0);
|
return (((r->remote_control_id()) >>31) != 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool
|
||||||
|
MackieControlProtocol::is_mapped (boost::shared_ptr<Route> r) const
|
||||||
|
{
|
||||||
|
Glib::Threads::Mutex::Lock lm (surfaces_lock);
|
||||||
|
|
||||||
|
for (Surfaces::const_iterator s = surfaces.begin(); s != surfaces.end(); ++s) {
|
||||||
|
if ((*s)->route_is_mapped (r)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
boost::shared_ptr<Route>
|
boost::shared_ptr<Route>
|
||||||
MackieControlProtocol::first_selected_route () const
|
MackieControlProtocol::first_selected_route () const
|
||||||
{
|
{
|
||||||
|
|
@ -2303,6 +2341,21 @@ MackieControlProtocol::first_selected_route () const
|
||||||
|
|
||||||
boost::shared_ptr<Route> r = _last_selected_routes.front().lock();
|
boost::shared_ptr<Route> r = _last_selected_routes.front().lock();
|
||||||
|
|
||||||
|
if (r) {
|
||||||
|
/* check it is on one of our surfaces */
|
||||||
|
|
||||||
|
if (is_mapped (r)) {
|
||||||
|
return r;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* route is not mapped. thus, the currently selected route is
|
||||||
|
* not on the surfaces, and so from our perspective, there is
|
||||||
|
* no currently selected route.
|
||||||
|
*/
|
||||||
|
|
||||||
|
r.reset ();
|
||||||
|
}
|
||||||
|
|
||||||
return r; /* may be null */
|
return r; /* may be null */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -163,6 +163,7 @@ class MackieControlProtocol
|
||||||
bool is_midi_track (boost::shared_ptr<ARDOUR::Route>) const;
|
bool is_midi_track (boost::shared_ptr<ARDOUR::Route>) const;
|
||||||
bool selected (boost::shared_ptr<ARDOUR::Route>) const;
|
bool selected (boost::shared_ptr<ARDOUR::Route>) const;
|
||||||
bool is_hidden (boost::shared_ptr<ARDOUR::Route>) const;
|
bool is_hidden (boost::shared_ptr<ARDOUR::Route>) const;
|
||||||
|
bool is_mapped (boost::shared_ptr<ARDOUR::Route>) const;
|
||||||
boost::shared_ptr<ARDOUR::Route> first_selected_route () const;
|
boost::shared_ptr<ARDOUR::Route> first_selected_route () const;
|
||||||
|
|
||||||
void set_view_mode (ViewMode);
|
void set_view_mode (ViewMode);
|
||||||
|
|
@ -367,6 +368,7 @@ class MackieControlProtocol
|
||||||
int create_surfaces ();
|
int create_surfaces ();
|
||||||
bool periodic();
|
bool periodic();
|
||||||
bool redisplay();
|
bool redisplay();
|
||||||
|
bool redisplay_subview_mode ();
|
||||||
bool hui_heartbeat ();
|
bool hui_heartbeat ();
|
||||||
void build_gui ();
|
void build_gui ();
|
||||||
bool midi_input_handler (Glib::IOCondition ioc, MIDI::Port* port);
|
bool midi_input_handler (Glib::IOCondition ioc, MIDI::Port* port);
|
||||||
|
|
|
||||||
|
|
@ -788,7 +788,7 @@ Surface::turn_it_on ()
|
||||||
(*s)->notify_all ();
|
(*s)->notify_all ();
|
||||||
}
|
}
|
||||||
|
|
||||||
update_view_mode_display ();
|
update_view_mode_display (false);
|
||||||
|
|
||||||
if (_mcp.device_info ().has_global_controls ()) {
|
if (_mcp.device_info ().has_global_controls ()) {
|
||||||
_mcp.update_global_button (Button::Read, _mcp.metering_active ());
|
_mcp.update_global_button (Button::Read, _mcp.metering_active ());
|
||||||
|
|
@ -1037,14 +1037,10 @@ Surface::subview_mode_changed ()
|
||||||
for (Strips::iterator s = strips.begin(); s != strips.end(); ++s) {
|
for (Strips::iterator s = strips.begin(); s != strips.end(); ++s) {
|
||||||
(*s)->subview_mode_changed ();
|
(*s)->subview_mode_changed ();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_mcp.subview_mode() == MackieControlProtocol::None) {
|
|
||||||
update_view_mode_display ();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
Surface::update_view_mode_display ()
|
Surface::update_view_mode_display (bool with_helpful_text)
|
||||||
{
|
{
|
||||||
string text;
|
string text;
|
||||||
int id = -1;
|
int id = -1;
|
||||||
|
|
@ -1129,7 +1125,7 @@ Surface::update_view_mode_display ()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!text.empty()) {
|
if (with_helpful_text && !text.empty()) {
|
||||||
display_message_for (text, 1000);
|
display_message_for (text, 1000);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1177,6 +1173,18 @@ Surface::route_is_locked_to_strip (boost::shared_ptr<Route> r) const
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool
|
||||||
|
Surface::route_is_mapped (boost::shared_ptr<Route> r) const
|
||||||
|
{
|
||||||
|
for (Strips::const_iterator s = strips.begin(); s != strips.end(); ++s) {
|
||||||
|
if ((*s)->route() == r) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
Surface::notify_metering_state_changed()
|
Surface::notify_metering_state_changed()
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -80,6 +80,7 @@ public:
|
||||||
Strip* nth_strip (uint32_t n) const;
|
Strip* nth_strip (uint32_t n) const;
|
||||||
|
|
||||||
bool route_is_locked_to_strip (boost::shared_ptr<ARDOUR::Route>) const;
|
bool route_is_locked_to_strip (boost::shared_ptr<ARDOUR::Route>) const;
|
||||||
|
bool route_is_mapped (boost::shared_ptr<ARDOUR::Route>) const;
|
||||||
|
|
||||||
/// This collection owns the groups
|
/// This collection owns the groups
|
||||||
typedef std::map<std::string,Group*> Groups;
|
typedef std::map<std::string,Group*> Groups;
|
||||||
|
|
@ -151,7 +152,7 @@ public:
|
||||||
void show_two_char_display (const std::string & msg, const std::string & dots = " ");
|
void show_two_char_display (const std::string & msg, const std::string & dots = " ");
|
||||||
void show_two_char_display (unsigned int value, const std::string & dots = " ");
|
void show_two_char_display (unsigned int value, const std::string & dots = " ");
|
||||||
|
|
||||||
void update_view_mode_display ();
|
void update_view_mode_display (bool with_helpful_text);
|
||||||
void update_flip_mode_display ();
|
void update_flip_mode_display ();
|
||||||
void update_potmode ();
|
void update_potmode ();
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue