summaryrefslogtreecommitdiff
path: root/gtk2_ardour/editor_ops.cc
diff options
context:
space:
mode:
authorNick Mainsbridge <beatroute@iprimus.com.au>2006-02-15 12:15:29 +0000
committerNick Mainsbridge <beatroute@iprimus.com.au>2006-02-15 12:15:29 +0000
commit69c9f3d7ce4643c75e1490661d51247b699b606a (patch)
treecc8f058f7baa5b9996c8761caa37c4e8f0ee6601 /gtk2_ardour/editor_ops.cc
parent99281692de9a8b5c5b8a903b75e0ffc9620db616 (diff)
select all in time range, show object selection while in range mode, trim range ends by a frame when selecting, make things semantically a bit better.
git-svn-id: svn://localhost/trunk/ardour2@329 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'gtk2_ardour/editor_ops.cc')
-rw-r--r--gtk2_ardour/editor_ops.cc84
1 files changed, 62 insertions, 22 deletions
diff --git a/gtk2_ardour/editor_ops.cc b/gtk2_ardour/editor_ops.cc
index 7191b81b7b..d9bbe73648 100644
--- a/gtk2_ardour/editor_ops.cc
+++ b/gtk2_ardour/editor_ops.cc
@@ -1228,13 +1228,13 @@ Editor::select_all (bool add)
}
(*iter)->get_selectables (0, max_frames, 0, DBL_MAX, touched);
}
-
+ begin_reversible_command (_("select all"));
if (add) {
selection->add (touched);
} else {
selection->set (touched);
}
-
+ commit_reversible_command ();
}
void
@@ -1310,61 +1310,97 @@ Editor::set_selection_from_loop()
}
void
-Editor::select_all_from_punch()
+Editor::set_selection_from_range (Location& loc)
{
- Location* location;
+ if (clicked_trackview == 0) {
+ return;
+ }
+
+ begin_reversible_command (_("set selection from range"));
+ selection->set (0, loc.start(), loc.end());
+ commit_reversible_command ();
+}
+
+void
+Editor::select_all_selectables_using_time_selection ()
+{
+
list<Selectable *> touched;
- if ((location = session->locations()->auto_punch_location()) == 0) {
+
+ if (clicked_trackview == 0) {
return;
}
- for (TrackViewList::iterator iter = track_views.begin(); iter != track_views.end(); ++iter) {
+ if (selection->time.empty()) {
+ return;
+ }
+
+ jack_nframes_t start = selection->time[clicked_selection].start;
+ jack_nframes_t end = selection->time[clicked_selection].end;
+
+ if (end - start < 1) {
+ return;
+ }
+
+ for (TrackViewList::iterator iter = selection->tracks.begin(); iter != selection->tracks.end(); ++iter) {
if ((*iter)->hidden()) {
continue;
}
- (*iter)->get_selectables (location->start(), location->end(), 0, DBL_MAX, touched);
+ (*iter)->get_selectables (start, end - 1, 0, DBL_MAX, touched);
}
- begin_reversible_command (_("select all from punch"));
+ begin_reversible_command (_("select all from range"));
selection->set (touched);
commit_reversible_command ();
}
+
void
-Editor::select_all_from_loop()
+Editor::select_all_selectables_using_punch()
{
- Location* location;
+ Location* location = session->locations()->auto_punch_location();
list<Selectable *> touched;
- if ((location = session->locations()->auto_loop_location()) == 0) {
+ if (location == 0 || (location->end() - location->start() <= 1)) {
return;
}
+
for (TrackViewList::iterator iter = track_views.begin(); iter != track_views.end(); ++iter) {
if ((*iter)->hidden()) {
continue;
}
- (*iter)->get_selectables (location->start(), location->end(), 0, DBL_MAX, touched);
+ (*iter)->get_selectables (location->start(), location->end() - 1, 0, DBL_MAX, touched);
}
- begin_reversible_command (_("select all from loop"));
+ begin_reversible_command (_("select all from punch"));
selection->set (touched);
commit_reversible_command ();
}
void
-Editor::set_selection_from_range (Location& range)
+Editor::select_all_selectables_using_loop()
{
- if (clicked_trackview == 0) {
+ Location* location = session->locations()->auto_punch_location();
+ list<Selectable *> touched;
+
+ if (location == 0 || (location->end() - location->start() <= 1)) {
return;
}
-
- begin_reversible_command (_("set selection from range"));
- selection->set (0, range.start(), range.end());
+
+ for (TrackViewList::iterator iter = track_views.begin(); iter != track_views.end(); ++iter) {
+ if ((*iter)->hidden()) {
+ continue;
+ }
+ (*iter)->get_selectables (location->start(), location->end() - 1, 0, DBL_MAX, touched);
+ }
+ begin_reversible_command (_("select all from loop"));
+ selection->set (touched);
commit_reversible_command ();
+
}
void
-Editor::select_all_after_cursor (Cursor *cursor, bool after)
+Editor::select_all_selectables_using_cursor (Cursor *cursor, bool after)
{
jack_nframes_t start;
jack_nframes_t end;
@@ -1375,9 +1411,13 @@ Editor::select_all_after_cursor (Cursor *cursor, bool after)
start = cursor->current_frame ;
end = session->current_end_frame();
} else {
- begin_reversible_command (_("select all before cursor"));
- start = 0;
- end = cursor->current_frame ;
+ if (cursor->current_frame > 0) {
+ begin_reversible_command (_("select all before cursor"));
+ start = 0;
+ end = cursor->current_frame - 1;
+ } else {
+ return;
+ }
}
for (TrackViewList::iterator iter = track_views.begin(); iter != track_views.end(); ++iter) {
if ((*iter)->hidden()) {