diff options
author | Nick Mainsbridge <beatroute@iprimus.com.au> | 2006-04-01 00:21:25 +0000 |
---|---|---|
committer | Nick Mainsbridge <beatroute@iprimus.com.au> | 2006-04-01 00:21:25 +0000 |
commit | 825d7a769d8e209ced13885857e52630a5b244b3 (patch) | |
tree | e445b5d2a0dce14f0dade2ca0237b9adcb90a6c8 /gtk2_ardour/editor_ops.cc | |
parent | 2aced5ff6515cc3222e0b09e55dbc35c23ba7fb1 (diff) |
fix incorrect marker/range marker right-click menus, try to clarify the text in them, select all between cursors ('u' is the shortcut) separate regions using range marker (a new right click menu on a range matker), easter egg
git-svn-id: svn://localhost/trunk/ardour2@438 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'gtk2_ardour/editor_ops.cc')
-rw-r--r-- | gtk2_ardour/editor_ops.cc | 77 |
1 files changed, 77 insertions, 0 deletions
diff --git a/gtk2_ardour/editor_ops.cc b/gtk2_ardour/editor_ops.cc index 7ce6f46577..f78ecbbcbe 100644 --- a/gtk2_ardour/editor_ops.cc +++ b/gtk2_ardour/editor_ops.cc @@ -1514,6 +1514,36 @@ Editor::select_all_selectables_using_cursor (Cursor *cursor, bool after) } void +Editor::select_all_selectables_between_cursors (Cursor *cursor, Cursor *other_cursor) +{ + jack_nframes_t start; + jack_nframes_t end; + list<Selectable *> touched; + bool other_cursor_is_first = cursor->current_frame > other_cursor->current_frame; + if (cursor->current_frame == other_cursor->current_frame) { + return; + } + begin_reversible_command (_("select all between cursors")); + if ( other_cursor_is_first) { + start = other_cursor->current_frame; + end = cursor->current_frame - 1; + + } else { + start = cursor->current_frame; + end = other_cursor->current_frame - 1; + } + + for (TrackViewList::iterator iter = track_views.begin(); iter != track_views.end(); ++iter) { + if ((*iter)->hidden()) { + continue; + } + (*iter)->get_selectables (start, end, 0, DBL_MAX, touched); + } + selection->set (touched); + commit_reversible_command (); +} + +void Editor::amplitude_zoom_step (bool in) { gdouble zoom = 1.0; @@ -2185,6 +2215,53 @@ Editor::separate_region_from_selection () } void +Editor::separate_regions_using_location (Location& loc) +{ + bool doing_undo = false; + + if (loc.is_mark()) { + return; + } + + Playlist *playlist; + + /* XXX i'm unsure as to whether this should operate on selected tracks only + or the entire enchillada. uncomment the below line to correct the behaviour + (currently set for all tracks) + */ + + for (TrackViewList::iterator i = track_views.begin(); i != track_views.end(); ++i) { + //for (TrackSelection::iterator i = selection->tracks.begin(); i != selection->tracks.end(); ++i) { + + AudioTimeAxisView* atv; + + if ((atv = dynamic_cast<AudioTimeAxisView*> ((*i))) != 0) { + + if (atv->is_audio_track()) { + + if ((playlist = atv->playlist()) != 0) { + if (!doing_undo) { + begin_reversible_command (_("separate")); + doing_undo = true; + } + if (doing_undo) session->add_undo ((playlist)->get_memento()); + + /* XXX need to consider musical time selections here at some point */ + + double speed = atv->get_diskstream()->speed(); + + + playlist->partition ((jack_nframes_t)(loc.start() * speed), (jack_nframes_t)(loc.end() * speed), true); + if (doing_undo) session->add_redo_no_execute (playlist->get_memento()); + } + } + } + } + + if (doing_undo) commit_reversible_command (); +} + +void Editor::crop_region_to_selection () { if (selection->time.empty()) { |