summaryrefslogtreecommitdiff
path: root/gtk2_ardour/editor_ops.cc
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2008-09-19 10:42:09 +0000
committerPaul Davis <paul@linuxaudiosystems.com>2008-09-19 10:42:09 +0000
commit21ea541267361b03c66a9cc330b7c862d7bc8e85 (patch)
tree24c23aca13597cfadea84b98c9f8a857f4894282 /gtk2_ardour/editor_ops.cc
parent959907af01dd398fd45ee28413d37f5516ce6047 (diff)
shift-click to extend marker selection; marker drag moves all selected markers
git-svn-id: svn://localhost/ardour2/branches/2.0-ongoing@3758 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'gtk2_ardour/editor_ops.cc')
-rw-r--r--gtk2_ardour/editor_ops.cc124
1 files changed, 68 insertions, 56 deletions
diff --git a/gtk2_ardour/editor_ops.cc b/gtk2_ardour/editor_ops.cc
index c3c6318178..e3d2f88a20 100644
--- a/gtk2_ardour/editor_ops.cc
+++ b/gtk2_ardour/editor_ops.cc
@@ -403,40 +403,45 @@ Editor::nudge_forward (bool next, bool force_playhead)
} else if (!force_playhead && !selection->markers.empty()) {
bool is_start;
- Location* loc = find_location_from_marker (selection->markers.front(), is_start);
- if (loc) {
-
- begin_reversible_command (_("nudge location forward"));
-
- XMLNode& before (loc->get_state());
-
- if (is_start) {
- distance = get_nudge_distance (loc->start(), next_distance);
- if (next) {
- distance = next_distance;
- }
- if (max_frames - distance > loc->start() + loc->length()) {
- loc->set_start (loc->start() + distance);
- } else {
- loc->set_start (max_frames - loc->length());
- }
- } else {
- distance = get_nudge_distance (loc->end(), next_distance);
- if (next) {
- distance = next_distance;
- }
- if (max_frames - distance > loc->end()) {
- loc->set_end (loc->end() + distance);
+ begin_reversible_command (_("nudge location forward"));
+
+ for (MarkerSelection::iterator i = selection->markers.begin(); i != selection->markers.end(); ++i) {
+
+ Location* loc = find_location_from_marker ((*i), is_start);
+
+ if (loc) {
+
+ XMLNode& before (loc->get_state());
+
+ if (is_start) {
+ distance = get_nudge_distance (loc->start(), next_distance);
+ if (next) {
+ distance = next_distance;
+ }
+ if (max_frames - distance > loc->start() + loc->length()) {
+ loc->set_start (loc->start() + distance);
+ } else {
+ loc->set_start (max_frames - loc->length());
+ }
} else {
- loc->set_end (max_frames);
+ distance = get_nudge_distance (loc->end(), next_distance);
+ if (next) {
+ distance = next_distance;
+ }
+ if (max_frames - distance > loc->end()) {
+ loc->set_end (loc->end() + distance);
+ } else {
+ loc->set_end (max_frames);
+ }
}
+ XMLNode& after (loc->get_state());
+ session->add_command (new MementoCommand<Location>(*loc, &before, &after));
}
- XMLNode& after (loc->get_state());
- session->add_command (new MementoCommand<Location>(*loc, &before, &after));
- commit_reversible_command ();
}
+ commit_reversible_command ();
+
} else {
distance = get_nudge_distance (playhead_cursor->current_frame, next_distance);
session->request_locate (playhead_cursor->current_frame + distance);
@@ -483,41 +488,48 @@ Editor::nudge_backward (bool next, bool force_playhead)
} else if (!force_playhead && !selection->markers.empty()) {
bool is_start;
- Location* loc = find_location_from_marker (selection->markers.front(), is_start);
-
- if (loc) {
- begin_reversible_command (_("nudge location forward"));
- XMLNode& before (loc->get_state());
+ begin_reversible_command (_("nudge location forward"));
- if (is_start) {
- distance = get_nudge_distance (loc->start(), next_distance);
- if (next) {
- distance = next_distance;
- }
- if (distance < loc->start()) {
- loc->set_start (loc->start() - distance);
- } else {
- loc->set_start (0);
- }
- } else {
- distance = get_nudge_distance (loc->end(), next_distance);
-
- if (next) {
- distance = next_distance;
- }
+ for (MarkerSelection::iterator i = selection->markers.begin(); i != selection->markers.end(); ++i) {
- if (distance < loc->end() - loc->length()) {
- loc->set_end (loc->end() - distance);
+ Location* loc = find_location_from_marker ((*i), is_start);
+
+ if (loc) {
+
+ XMLNode& before (loc->get_state());
+
+ if (is_start) {
+ distance = get_nudge_distance (loc->start(), next_distance);
+ if (next) {
+ distance = next_distance;
+ }
+ if (distance < loc->start()) {
+ loc->set_start (loc->start() - distance);
+ } else {
+ loc->set_start (0);
+ }
} else {
- loc->set_end (loc->length());
+ distance = get_nudge_distance (loc->end(), next_distance);
+
+ if (next) {
+ distance = next_distance;
+ }
+
+ if (distance < loc->end() - loc->length()) {
+ loc->set_end (loc->end() - distance);
+ } else {
+ loc->set_end (loc->length());
+ }
}
+
+ XMLNode& after (loc->get_state());
+ session->add_command (new MementoCommand<Location>(*loc, &before, &after));
}
-
- XMLNode& after (loc->get_state());
- session->add_command (new MementoCommand<Location>(*loc, &before, &after));
}
-
+
+ commit_reversible_command ();
+
} else {
distance = get_nudge_distance (playhead_cursor->current_frame, next_distance);