Make layer menu items apply to the selection.
[ardour.git] / gtk2_ardour / editor_selection.cc
index ca3197c533d2730ab0679408c577cb2769d2cc51..3212c93bb76ecbf6ba553cb08fc5811222e9b777 100644 (file)
@@ -36,6 +36,8 @@
 #include "automation_line.h"
 #include "control_point.h"
 #include "editor_regions.h"
+#include "editor_cursors.h"
+#include "midi_region_view.h"
 
 #include "i18n.h"
 
@@ -1211,11 +1213,27 @@ Editor::select_all_in_track (Selection::Operation op)
        }
 }
 
+void
+Editor::select_all_internal_edit (Selection::Operation op)
+{
+        /* currently limited to MIDI only */
+
+       for (MidiRegionSelection::iterator i = selection->midi_regions.begin(); i != selection->midi_regions.end(); ++i) {
+               MidiRegionView* mrv = *i;
+               mrv->select_all_notes ();
+       }
+}
+
 void
 Editor::select_all (Selection::Operation op)
 {
        list<Selectable *> touched;
 
+        if (_internal_editing) {
+                select_all_internal_edit (op);
+                return;
+        }
+
        for (TrackViewList::iterator iter = track_views.begin(); iter != track_views.end(); ++iter) {
                if ((*iter)->hidden()) {
                        continue;
@@ -1274,7 +1292,7 @@ Editor::invert_selection ()
  *  @param preserve_if_selected true to leave the current selection alone if we're adding to the selection and all of the selectables
  *  within the region are already selected.
  */
-bool
+void
 Editor::select_all_within (
        framepos_t start, framepos_t end, double top, double bot, const TrackViewList& tracklist, Selection::Operation op, bool preserve_if_selected
        )
@@ -1291,7 +1309,7 @@ Editor::select_all_within (
        }
 
        if (found.empty()) {
-               return false;
+               return;
        }
 
        if (preserve_if_selected && op != Selection::Toggle) {
@@ -1301,7 +1319,7 @@ Editor::select_all_within (
                }
 
                if (i == found.end()) {
-                       return false;
+                       return;
                }
        }
 
@@ -1322,8 +1340,6 @@ Editor::select_all_within (
        }
 
        commit_reversible_command ();
-
-       return !found.empty();
 }
 
 void
@@ -1482,7 +1498,7 @@ Editor::select_all_selectables_using_cursor (EditorCursor *cursor, bool after)
 
        if (after) {
                begin_reversible_command (_("select all after cursor"));
-               start = cursor->current_frame ;
+               start = cursor->current_frame;
                end = _session->current_end_frame();
        } else {
                if (cursor->current_frame > 0) {