X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=gtk2_ardour%2Feditor_selection.cc;h=203df9f32281a3b2dea26317bd300d929481255f;hb=0f1c7b1d7107;hp=e1027e4e9bd0418018e59340b16d2277d6aab233;hpb=8c9749e42faf7808034ed8b7afce4a2fe6dc6f33;p=ardour.git diff --git a/gtk2_ardour/editor_selection.cc b/gtk2_ardour/editor_selection.cc index e1027e4e9b..203df9f322 100644 --- a/gtk2_ardour/editor_selection.cc +++ b/gtk2_ardour/editor_selection.cc @@ -991,6 +991,15 @@ Editor::time_selection_changed () return; } + /* XXX this is superficially inefficient. Hide the selection in all + * tracks, then show it in all selected tracks. + * + * However, if you investigate what this actually does, it isn't + * anywhere nearly as bad as it may appear. Remember: nothing is + * redrawn or even recomputed during these two loops - that only + * happens when we next render ... + */ + for (TrackViewList::iterator i = track_views.begin(); i != track_views.end(); ++i) { (*i)->hide_selection (); } @@ -1369,17 +1378,7 @@ Editor::select_all (Selection::Operation op) { list touched; - TrackViewList ts; - - if (selection->tracks.empty()) { - if (entered_track) { - ts.push_back (entered_track); - } else { - ts = track_views; - } - } else { - ts = selection->tracks; - } + TrackViewList ts = track_views; if (_internal_editing) { @@ -1409,8 +1408,10 @@ Editor::select_all (Selection::Operation op) continue; } (*iter)->get_selectables (0, max_framepos, 0, DBL_MAX, touched); + selection->add (*iter); } + begin_reversible_command (_("select all")); switch (op) { case Selection::Add: @@ -1833,98 +1834,102 @@ Editor::select_range_between () bool Editor::get_edit_op_range (framepos_t& start, framepos_t& end) const { - framepos_t m; - bool ignored; +// framepos_t m; +// bool ignored; /* if an explicit range exists, use it */ - if (!selection->time.empty()) { + if ( (mouse_mode == MouseRange || get_smart_mode() ) && !selection->time.empty()) { /* we know that these are ordered */ start = selection->time.start(); end = selection->time.end_frame(); return true; - } - - if (!mouse_frame (m, ignored)) { - /* mouse is not in a canvas, try playhead+selected marker. - this is probably most true when using menus. - */ - - if (selection->markers.empty()) { - return false; - } - - start = selection->markers.front()->position(); - end = _session->audible_frame(); - } else { - - switch (_edit_point) { - case EditAtPlayhead: - if (selection->markers.empty()) { - /* use mouse + playhead */ - start = m; - end = _session->audible_frame(); - } else { - /* use playhead + selected marker */ - start = _session->audible_frame(); - end = selection->markers.front()->position(); - } - break; - - case EditAtMouse: - /* use mouse + selected marker */ - if (selection->markers.empty()) { - start = m; - end = _session->audible_frame(); - } else { - start = selection->markers.front()->position(); - end = m; - } - break; - - case EditAtSelectedMarker: - /* use mouse + selected marker */ - if (selection->markers.empty()) { - - MessageDialog win (_("No edit range defined"), - false, - MESSAGE_INFO, - BUTTONS_OK); - - win.set_secondary_text ( - _("the edit point is Selected Marker\nbut there is no selected marker.")); - - - win.set_default_response (RESPONSE_CLOSE); - win.set_position (Gtk::WIN_POS_MOUSE); - win.show_all(); - - win.run (); - - return false; // NO RANGE - } - start = selection->markers.front()->position(); - end = m; - break; - } - } - - if (start == end) { + start = 0; + end = 0; return false; } - - if (start > end) { - swap (start, end); - } + +// if (!mouse_frame (m, ignored)) { +// /* mouse is not in a canvas, try playhead+selected marker. +// this is probably most true when using menus. +// */ +// +// if (selection->markers.empty()) { +// return false; +// } + +// start = selection->markers.front()->position(); +// end = _session->audible_frame(); + +// } else { + +// switch (_edit_point) { +// case EditAtPlayhead: +// if (selection->markers.empty()) { +// /* use mouse + playhead */ +// start = m; +// end = _session->audible_frame(); +// } else { +// /* use playhead + selected marker */ +// start = _session->audible_frame(); +// end = selection->markers.front()->position(); +// } +// break; + +// case EditAtMouse: +// /* use mouse + selected marker */ +// if (selection->markers.empty()) { +// start = m; +// end = _session->audible_frame(); +// } else { +// start = selection->markers.front()->position(); +// end = m; +// } +// break; + +// case EditAtSelectedMarker: +// /* use mouse + selected marker */ +// if (selection->markers.empty()) { + +// MessageDialog win (_("No edit range defined"), +// false, +// MESSAGE_INFO, +// BUTTONS_OK); + +// win.set_secondary_text ( +// _("the edit point is Selected Marker\nbut there is no selected marker.")); + + +// win.set_default_response (RESPONSE_CLOSE); +// win.set_position (Gtk::WIN_POS_MOUSE); +// win.show_all(); + +// win.run (); + +// return false; // NO RANGE +// } +// start = selection->markers.front()->position(); +// end = m; +// break; +// } +// } + +// if (start == end) { +// return false; +// } + +// if (start > end) { +// swap (start, end); +// } /* turn range into one delimited by start...end, not start...end-1 */ - end++; +// end++; - return true; +// return true; } void