+ bool have_selection = false;
+ bool have_entered = false;
+ bool have_edit_point = false;
+ RegionSelection rs;
+
+ // std::cerr << "STRRA: crossing ? " << because_canvas_crossing << " within ? " << within_track_canvas
+ // << std::endl;
+
+ if (!selection->regions.empty()) {
+ have_selection = true;
+ rs = selection->regions;
+ }
+
+ if (entered_regionview) {
+ have_entered = true;
+ rs.add (entered_regionview);
+ }
+
+ if (rs.empty() && !selection->tracks.empty()) {
+
+ /* no selected regions, but some selected tracks.
+ */
+
+ if (_edit_point == EditAtMouse) {
+ if (!within_track_canvas) {
+ /* pointer is not in canvas, so edit point is meaningless */
+ have_edit_point = false;
+ } else {
+ /* inside canvas. we don't know where the edit
+ point will be when an action is invoked, but
+ assume it could intersect with a region.
+ */
+ have_edit_point = true;
+ }
+ } else {
+ RegionSelection at_edit_point;
+ samplepos_t const where = get_preferred_edit_position (Editing::EDIT_IGNORE_NONE, false, !within_track_canvas);
+ get_regions_at (at_edit_point, where, selection->tracks);
+ if (!at_edit_point.empty()) {
+ have_edit_point = true;
+ }
+ if (rs.empty()) {
+ rs.insert (rs.end(), at_edit_point.begin(), at_edit_point.end());
+ }
+ }
+ }