summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2012-04-11 20:18:01 +0000
committerPaul Davis <paul@linuxaudiosystems.com>2012-04-11 20:18:01 +0000
commit5ae258e23b4faa49936fedc2030ba2eb58e581fd (patch)
tree34a15bba3ac3ed4b9b3e923cbbb1a1368953d987
parentb2cd8b004ceb5052c2226505ac0ecadce59ba2de (diff)
MCP: share add-marker code with BasicUI; don't allow route locking if the strip has no current route
git-svn-id: svn://localhost/ardour2/branches/3.0@11916 d708f5d6-7413-0410-9779-e7cbd77b26cf
-rw-r--r--libs/surfaces/control_protocol/basic_ui.cc15
-rw-r--r--libs/surfaces/control_protocol/control_protocol/basic_ui.h2
-rw-r--r--libs/surfaces/mackie/mcp_buttons.cc14
-rw-r--r--libs/surfaces/mackie/strip.cc9
4 files changed, 23 insertions, 17 deletions
diff --git a/libs/surfaces/control_protocol/basic_ui.cc b/libs/surfaces/control_protocol/basic_ui.cc
index 0019efb918..2ed82cd8c3 100644
--- a/libs/surfaces/control_protocol/basic_ui.cc
+++ b/libs/surfaces/control_protocol/basic_ui.cc
@@ -19,6 +19,7 @@
*/
#include "pbd/pthread_utils.h"
+#include "pbd/memento_command.h"
#include "ardour/session.h"
#include "ardour/location.h"
@@ -91,10 +92,16 @@ BasicUI::goto_end ()
}
void
-BasicUI::add_marker ()
-{
- framepos_t when = session->audible_frame();
- session->locations()->add (new Location (*session, when, when, _("unnamed"), Location::IsMark));
+BasicUI::add_marker (const std::string& markername)
+{
+ framepos_t where = session->audible_frame();
+ Location *location = new Location (*session, where, where, markername, Location::IsMark);
+ session->begin_reversible_command (_("add marker"));
+ XMLNode &before = session->locations()->get_state();
+ session->locations()->add (location, true);
+ XMLNode &after = session->locations()->get_state();
+ session->add_command (new MementoCommand<Locations>(*(session->locations()), &before, &after));
+ session->commit_reversible_command ();
}
void
diff --git a/libs/surfaces/control_protocol/control_protocol/basic_ui.h b/libs/surfaces/control_protocol/control_protocol/basic_ui.h
index 3bd5ea1c0a..96a1227463 100644
--- a/libs/surfaces/control_protocol/control_protocol/basic_ui.h
+++ b/libs/surfaces/control_protocol/control_protocol/basic_ui.h
@@ -42,7 +42,7 @@ class BasicUI {
BasicUI (ARDOUR::Session&);
virtual ~BasicUI ();
- void add_marker ();
+ void add_marker (const std::string& = std::string());
void register_thread (std::string name);
diff --git a/libs/surfaces/mackie/mcp_buttons.cc b/libs/surfaces/mackie/mcp_buttons.cc
index 6b6ce6528e..dcf311d08f 100644
--- a/libs/surfaces/mackie/mcp_buttons.cc
+++ b/libs/surfaces/mackie/mcp_buttons.cc
@@ -386,17 +386,11 @@ MackieControlProtocol::timecode_beats_release (Button &)
LedState
MackieControlProtocol::marker_press (Button &)
{
- // cut'n'paste from LocationUI::add_new_location()
string markername;
- framepos_t where = session->audible_frame();
- session->locations()->next_available_name(markername,"mcu");
- Location *location = new Location (*session, where, where, markername, Location::IsMark);
- session->begin_reversible_command (_("add marker"));
- XMLNode &before = session->locations()->get_state();
- session->locations()->add (location, true);
- XMLNode &after = session->locations()->get_state();
- session->add_command (new MementoCommand<Locations>(*(session->locations()), &before, &after));
- session->commit_reversible_command ();
+
+ session->locations()->next_available_name (markername,"mcu");
+ add_marker (markername);
+
return on;
}
diff --git a/libs/surfaces/mackie/strip.cc b/libs/surfaces/mackie/strip.cc
index 42954fae80..24d3e4ac31 100644
--- a/libs/surfaces/mackie/strip.cc
+++ b/libs/surfaces/mackie/strip.cc
@@ -474,7 +474,9 @@ Strip::handle_button (Button& button, ButtonState bs)
int lock_mod = (MackieControlProtocol::MODIFIER_CONTROL|MackieControlProtocol::MODIFIER_SHIFT);
if ((_surface->mcp().modifier_state() & lock_mod) == lock_mod) {
- _route_locked = !_route_locked;
+ if (_route) {
+ _route_locked = !_route_locked;
+ }
} else {
_surface->mcp().select_track (_route);
}
@@ -666,7 +668,10 @@ Strip::display (uint32_t line_number, const std::string& line)
void
Strip::lock_route ()
{
- _route_locked = true;
+ /* don't lock unless we have a route */
+ if (_route) {
+ _route_locked = true;
+ }
}
void