diff options
author | Paul Davis <paul@linuxaudiosystems.com> | 2008-09-19 10:42:09 +0000 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2008-09-19 10:42:09 +0000 |
commit | 21ea541267361b03c66a9cc330b7c862d7bc8e85 (patch) | |
tree | 24c23aca13597cfadea84b98c9f8a857f4894282 | |
parent | 959907af01dd398fd45ee28413d37f5516ce6047 (diff) |
shift-click to extend marker selection; marker drag moves all selected markers
git-svn-id: svn://localhost/ardour2/branches/2.0-ongoing@3758 d708f5d6-7413-0410-9779-e7cbd77b26cf
-rw-r--r-- | gtk2_ardour/draginfo.h | 6 | ||||
-rw-r--r-- | gtk2_ardour/editor.cc | 10 | ||||
-rw-r--r-- | gtk2_ardour/editor_audio_import.cc | 23 | ||||
-rw-r--r-- | gtk2_ardour/editor_canvas.cc | 3 | ||||
-rw-r--r-- | gtk2_ardour/editor_cursors.cc | 2 | ||||
-rw-r--r-- | gtk2_ardour/editor_mouse.cc | 250 | ||||
-rw-r--r-- | gtk2_ardour/editor_ops.cc | 124 | ||||
-rw-r--r-- | gtk2_ardour/marker_selection.h | 1 | ||||
-rw-r--r-- | gtk2_ardour/selection.cc | 34 | ||||
-rw-r--r-- | gtk2_ardour/selection.h | 2 | ||||
-rw-r--r-- | libs/ardour/ardour/location.h | 19 | ||||
-rw-r--r-- | libs/ardour/audioanalyser.cc | 2 | ||||
-rw-r--r-- | libs/ardour/location.cc | 13 | ||||
-rw-r--r-- | libs/ardour/utils.cc | 1 |
14 files changed, 341 insertions, 149 deletions
diff --git a/gtk2_ardour/draginfo.h b/gtk2_ardour/draginfo.h index 4b91fa6c1b..6d3a6b8de3 100644 --- a/gtk2_ardour/draginfo.h +++ b/gtk2_ardour/draginfo.h @@ -20,6 +20,8 @@ #ifndef __gtk2_ardour_drag_info_h_ #define __gtk2_ardour_drag_info_h_ +#include <list> + #include <gdk/gdk.h> #include <stdint.h> @@ -64,7 +66,9 @@ struct DragInfo { bool move_threshold_passed; bool want_move_threshold; bool brushing; - ARDOUR::Location* copied_location; + std::list<ARDOUR::Location*> copied_locations; + + void clear_copied_locations (); }; struct LineDragInfo { diff --git a/gtk2_ardour/editor.cc b/gtk2_ardour/editor.cc index abea41635c..d97867bb69 100644 --- a/gtk2_ardour/editor.cc +++ b/gtk2_ardour/editor.cc @@ -186,6 +186,15 @@ show_me_the_size (Requisition* r, const char* what) cerr << "size of " << what << " = " << r->width << " x " << r->height << endl; } +void +DragInfo::clear_copied_locations () +{ + for (list<Location*>::iterator i = copied_locations.begin(); i != copied_locations.end(); ++i) { + delete *i; + } + copied_locations.clear (); +} + Editor::Editor () : /* time display buttons */ @@ -253,7 +262,6 @@ Editor::Editor () clicked_control_point = 0; last_update_frame = 0; drag_info.item = 0; - drag_info.copied_location = 0; current_mixer_strip = 0; current_bbt_points = 0; diff --git a/gtk2_ardour/editor_audio_import.cc b/gtk2_ardour/editor_audio_import.cc index 3d75de782c..2daec610bd 100644 --- a/gtk2_ardour/editor_audio_import.cc +++ b/gtk2_ardour/editor_audio_import.cc @@ -330,24 +330,27 @@ Editor::_do_import (vector<ustring> paths, ImportDisposition chns, ImportMode mo } } else { - bool replace; + bool replace = false; for (vector<ustring>::iterator a = paths.begin(); a != paths.end() && ok; ++a) { - int check = check_whether_and_how_to_import(*a, true); + int check = check_whether_and_how_to_import (*a, true); - if (check == 2 ) { + switch (check) { + case 2: // skip continue; - } - - if (check == 0) { - fatal << "Updating existing sources should be disabled!" << endl; - replace = true; - } else if (check == 1) { + case 0: + fatal << "Updating existing sources should be disabled!" << endmsg; + /* NOTREACHED*/ + break; + case 1: replace = false; + break; + default: + fatal << "Illegal return " << check << " from check_whether_and_how_to_import()!" << endmsg; + /* NOTREACHED*/ } - switch (chns) { case Editing::ImportDistinctFiles: diff --git a/gtk2_ardour/editor_canvas.cc b/gtk2_ardour/editor_canvas.cc index 6edf2631a1..ef16b42435 100644 --- a/gtk2_ardour/editor_canvas.cc +++ b/gtk2_ardour/editor_canvas.cc @@ -410,7 +410,7 @@ Editor::controls_layout_size_request (Requisition* req) /* this one is important: it determines how big the layout thinks it really is, as opposed to what it displays on the screen */ - controls_layout.set_size (edit_controls_vbox.get_width(), pos ); + controls_layout.set_size (edit_controls_vbox.get_width(), (guint) floor (pos)); controls_layout.set_size_request(edit_controls_vbox.get_width(), -1); time_button_event_box.set_size_request(edit_controls_vbox.get_width(), -1); zoom_box.set_size_request(edit_controls_vbox.get_width(), -1); @@ -641,7 +641,6 @@ Editor::autoscroll_canvas () nframes64_t new_frame; nframes64_t limit = max_frames - current_page_frames(); GdkEventMotion ev; - bool in_track_canvas; double new_pixel; double target_pixel; diff --git a/gtk2_ardour/editor_cursors.cc b/gtk2_ardour/editor_cursors.cc index e6b84ed3a0..ca00ec61d2 100644 --- a/gtk2_ardour/editor_cursors.cc +++ b/gtk2_ardour/editor_cursors.cc @@ -42,7 +42,7 @@ Editor::Cursor::Cursor (Editor& ed, bool (Editor::*callbck)(GdkEvent*,ArdourCanv points.push_back(Gnome::Art::Point(1.0, 1.0)); canvas_item.property_points() = points; - canvas_item.property_width_pixels() = 1.0; + canvas_item.property_width_pixels() = 1; canvas_item.property_first_arrowhead() = TRUE; canvas_item.property_last_arrowhead() = TRUE; canvas_item.property_arrow_shape_a() = 11.0; diff --git a/gtk2_ardour/editor_mouse.cc b/gtk2_ardour/editor_mouse.cc index d34115d0f1..b5dffffc07 100644 --- a/gtk2_ardour/editor_mouse.cc +++ b/gtk2_ardour/editor_mouse.cc @@ -1806,11 +1806,7 @@ Editor::finalize_drag () drag_info.last_pointer_frame = 0; drag_info.current_pointer_frame = 0; drag_info.brushing = false; - - if (drag_info.copied_location) { - delete drag_info.copied_location; - drag_info.copied_location = 0; - } + drag_info.clear_copied_locations (); } void @@ -1855,7 +1851,7 @@ Editor::start_grab (GdkEvent* event, Gdk::Cursor *cursor) drag_info.want_move_threshold = false; drag_info.pointer_frame_offset = 0; drag_info.brushing = false; - drag_info.copied_location = 0; + drag_info.clear_copied_locations (); drag_info.original_x = 0; drag_info.original_y = 0; @@ -2271,7 +2267,6 @@ Editor::start_marker_grab (ArdourCanvas::Item* item, GdkEvent* event) _dragging_edit_point = true; - drag_info.copied_location = new Location (*location); drag_info.pointer_frame_offset = drag_info.grab_frame - (is_start ? location->start() : location->end()); update_marker_drag_item (location); @@ -2297,28 +2292,67 @@ Editor::start_marker_grab (ArdourCanvas::Item* item, GdkEvent* event) selection->toggle (marker); break; case Selection::Set: - selection->set (marker); + if (!selection->selected (marker)) { + selection->set (marker); + } break; case Selection::Extend: - selection->add (marker); + { + Locations::LocationList ll; + list<Marker*> to_add; + nframes64_t s, e; + selection->markers.range (s, e); + s = min (marker->position(), s); + e = max (marker->position(), e); + s = min (s, e); + e = max (s, e); + if (e < max_frames) { + ++e; + } + session->locations()->find_all_between (s, e, ll, Location::Flags (0)); + for (Locations::LocationList::iterator i = ll.begin(); i != ll.end(); ++i) { + LocationMarkers* lm = find_location_markers (*i); + if (lm) { + if (lm->start) { + to_add.push_back (lm->start); + } + if (lm->end) { + to_add.push_back (lm->end); + } + } + } + if (!to_add.empty()) { + selection->add (to_add); + } break; + } case Selection::Add: selection->add (marker); break; } + + /* set up copies for us to manipulate during the drag */ + + drag_info.clear_copied_locations (); + + for (MarkerSelection::iterator i = selection->markers.begin(); i != selection->markers.end(); ++i) { + Location *l = find_location_from_marker (*i, is_start); + drag_info.copied_locations.push_back (new Location (*l)); + } } void Editor::marker_drag_motion_callback (ArdourCanvas::Item* item, GdkEvent* event) { nframes64_t f_delta; - Marker* marker = (Marker *) drag_info.data; - Location *real_location; - Location *copy_location; + nframes64_t newframe; bool is_start; bool move_both = false; + Marker* dragged_marker = (Marker*) drag_info.data; + Marker* marker; + Location *real_location; + Location *copy_location; - nframes64_t newframe; if (drag_info.pointer_frame_offset <= drag_info.current_pointer_frame) { newframe = drag_info.current_pointer_frame - drag_info.pointer_frame_offset; } else { @@ -2335,104 +2369,181 @@ Editor::marker_drag_motion_callback (ArdourCanvas::Item* item, GdkEvent* event) return; } - /* call this to find out if its the start or end */ - - if ((real_location = find_location_from_marker (marker, is_start)) == 0) { - return; + if (Keyboard::modifier_state_equals (event->button.state, Keyboard::PrimaryModifier)) { + move_both = true; } - if (real_location->locked()) { + MarkerSelection::iterator i; + list<Location*>::iterator x; + + /* find the marker we're dragging, and compute the delta */ + + for (i = selection->markers.begin(), x = drag_info.copied_locations.begin(); + x != drag_info.copied_locations.end() && i != selection->markers.end(); + ++i, ++x) { + + copy_location = *x; + marker = *i; + + if (marker == dragged_marker) { + + if ((real_location = find_location_from_marker (marker, is_start)) == 0) { + /* que pasa ?? */ + return; + } + + if (real_location->is_mark()) { + f_delta = newframe - copy_location->start(); + } else if (newframe < copy_location->end()) { + f_delta = newframe - copy_location->end(); + } else { + f_delta = newframe - copy_location->start (); + } + break; + } + } + + if (i == selection->markers.end()) { + /* hmm, impossible - we didn't find the dragged marker */ return; } - /* use the copy that we're "dragging" around */ - - copy_location = drag_info.copied_location; + /* now move them all */ - f_delta = copy_location->end() - copy_location->start(); - - if (Keyboard::modifier_state_equals (event->button.state, Keyboard::PrimaryModifier)) { - move_both = true; - } + for (i = selection->markers.begin(), x = drag_info.copied_locations.begin(); + x != drag_info.copied_locations.end() && i != selection->markers.end(); + ++i, ++x) { - if (copy_location->is_mark()) { - /* just move it */ + copy_location = *x; + marker = *i; - copy_location->set_start (newframe); + /* call this to find out if its the start or end */ + + if ((real_location = find_location_from_marker (marker, is_start)) == 0) { + continue; + } + + if (real_location->locked()) { + continue; + } - } else { + if (copy_location->is_mark()) { - if (is_start) { // start-of-range marker + /* just move it */ - if (move_both) { - copy_location->set_start (newframe); - copy_location->set_end (newframe + f_delta); - } else if (newframe < copy_location->end()) { - copy_location->set_start (newframe); - } else { - snap_to (next, 1, true); - copy_location->set_end (next); - copy_location->set_start (newframe); - } + copy_location->set_start (copy_location->start() + f_delta); + + } else { - } else { // end marker + nframes64_t new_start = copy_location->start() + f_delta; + nframes64_t new_end = copy_location->end() + f_delta; - if (move_both) { - copy_location->set_end (newframe); - copy_location->set_start (newframe - f_delta); - } else if (newframe > copy_location->start()) { - copy_location->set_end (newframe); + if (is_start) { // start-of-range marker + + if (move_both) { + copy_location->set_start (new_start); + copy_location->set_end (new_end); + } else if (new_start < copy_location->end()) { + copy_location->set_start (new_start); + } else { + snap_to (next, 1, true); + copy_location->set_end (next); + copy_location->set_start (newframe); + } - } else if (newframe > 0) { - snap_to (next, -1, true); - copy_location->set_start (next); - copy_location->set_end (newframe); + } else { // end marker + + if (move_both) { + copy_location->set_end (new_end); + copy_location->set_start (new_start); + } else if (new_end > copy_location->start()) { + copy_location->set_end (new_end); + } else if (newframe > 0) { + snap_to (next, -1, true); + copy_location->set_start (next); + copy_location->set_end (newframe); + } } } + update_marker_drag_item (copy_location); + + LocationMarkers* lm = find_location_markers (real_location); + + if (lm) { + lm->set_position (copy_location->start(), copy_location->end()); + } } drag_info.last_pointer_frame = drag_info.current_pointer_frame; drag_info.first_move = false; - update_marker_drag_item (copy_location); + if (drag_info.copied_locations.empty()) { + abort(); + } - LocationMarkers* lm = find_location_markers (real_location); - lm->set_position (copy_location->start(), copy_location->end()); + edit_point_clock.set (drag_info.copied_locations.front()->start()); show_verbose_time_cursor (newframe, 10); + #ifdef GTKOSX track_canvas->update_now (); #endif - edit_point_clock.set (copy_location->start()); } void Editor::marker_drag_finished_callback (ArdourCanvas::Item* item, GdkEvent* event) { if (drag_info.first_move) { - /* just a click, do nothing but whatever selection occured */ + + /* just a click, do nothing but finish + off the selection process + */ + + Selection::Operation op = Keyboard::selection_type (event->button.state); + Marker* marker = (Marker *) drag_info.data; + + switch (op) { + case Selection::Set: + if (selection->selected (marker) && selection->markers.size() > 1) { + selection->set (marker); + } + break; + + case Selection::Toggle: + case Selection::Extend: + case Selection::Add: + break; + } + return; } _dragging_edit_point = false; - Marker* marker = (Marker *) drag_info.data; - bool is_start; begin_reversible_command ( _("move marker") ); XMLNode &before = session->locations()->get_state(); - - Location * location = find_location_from_marker (marker, is_start); - if (location) { - - if (location->locked()) { - return; - } + MarkerSelection::iterator i; + list<Location*>::iterator x; + bool is_start; - if (location->is_mark()) { - location->set_start (drag_info.copied_location->start()); - } else { - location->set (drag_info.copied_location->start(), drag_info.copied_location->end()); + for (i = selection->markers.begin(), x = drag_info.copied_locations.begin(); + x != drag_info.copied_locations.end() && i != selection->markers.end(); + ++i, ++x) { + + Location * location = find_location_from_marker ((*i), is_start); + + if (location) { + + if (location->locked()) { + return; + } + + if (location->is_mark()) { + location->set_start ((*x)->start()); + } else { + location->set ((*x)->start(), (*x)->end()); + } } } @@ -3607,6 +3718,7 @@ Editor::region_drag_motion_callback (ArdourCanvas::Item* item, GdkEvent* event) /* for evaluation of the track position of iy1, we have to adjust to allow for the vertical scrolling adjustment and the height of the timebars. */ + iy1 += vertical_adjustment.get_value() - canvas_timebars_vsize; TimeAxisView* tvp2 = trackview_by_y_position (iy1); diff --git a/gtk2_ardour/editor_ops.cc b/gtk2_ardour/editor_ops.cc index c3c6318178..e3d2f88a20 100644 --- a/gtk2_ardour/editor_ops.cc +++ b/gtk2_ardour/editor_ops.cc @@ -403,40 +403,45 @@ Editor::nudge_forward (bool next, bool force_playhead) } else if (!force_playhead && !selection->markers.empty()) { bool is_start; - Location* loc = find_location_from_marker (selection->markers.front(), is_start); - if (loc) { - - begin_reversible_command (_("nudge location forward")); - - XMLNode& before (loc->get_state()); - - if (is_start) { - distance = get_nudge_distance (loc->start(), next_distance); - if (next) { - distance = next_distance; - } - if (max_frames - distance > loc->start() + loc->length()) { - loc->set_start (loc->start() + distance); - } else { - loc->set_start (max_frames - loc->length()); - } - } else { - distance = get_nudge_distance (loc->end(), next_distance); - if (next) { - distance = next_distance; - } - if (max_frames - distance > loc->end()) { - loc->set_end (loc->end() + distance); + begin_reversible_command (_("nudge location forward")); + + for (MarkerSelection::iterator i = selection->markers.begin(); i != selection->markers.end(); ++i) { + + Location* loc = find_location_from_marker ((*i), is_start); + + if (loc) { + + XMLNode& before (loc->get_state()); + + if (is_start) { + distance = get_nudge_distance (loc->start(), next_distance); + if (next) { + distance = next_distance; + } + if (max_frames - distance > loc->start() + loc->length()) { + loc->set_start (loc->start() + distance); + } else { + loc->set_start (max_frames - loc->length()); + } } else { - loc->set_end (max_frames); + distance = get_nudge_distance (loc->end(), next_distance); + if (next) { + distance = next_distance; + } + if (max_frames - distance > loc->end()) { + loc->set_end (loc->end() + distance); + } else { + loc->set_end (max_frames); + } } + XMLNode& after (loc->get_state()); + session->add_command (new MementoCommand<Location>(*loc, &before, &after)); } - XMLNode& after (loc->get_state()); - session->add_command (new MementoCommand<Location>(*loc, &before, &after)); - commit_reversible_command (); } + commit_reversible_command (); + } else { distance = get_nudge_distance (playhead_cursor->current_frame, next_distance); session->request_locate (playhead_cursor->current_frame + distance); @@ -483,41 +488,48 @@ Editor::nudge_backward (bool next, bool force_playhead) } else if (!force_playhead && !selection->markers.empty()) { bool is_start; - Location* loc = find_location_from_marker (selection->markers.front(), is_start); - - if (loc) { - begin_reversible_command (_("nudge location forward")); - XMLNode& before (loc->get_state()); + begin_reversible_command (_("nudge location forward")); - if (is_start) { - distance = get_nudge_distance (loc->start(), next_distance); - if (next) { - distance = next_distance; - } - if (distance < loc->start()) { - loc->set_start (loc->start() - distance); - } else { - loc->set_start (0); - } - } else { - distance = get_nudge_distance (loc->end(), next_distance); - - if (next) { - distance = next_distance; - } + for (MarkerSelection::iterator i = selection->markers.begin(); i != selection->markers.end(); ++i) { - if (distance < loc->end() - loc->length()) { - loc->set_end (loc->end() - distance); + Location* loc = find_location_from_marker ((*i), is_start); + + if (loc) { + + XMLNode& before (loc->get_state()); + + if (is_start) { + distance = get_nudge_distance (loc->start(), next_distance); + if (next) { + distance = next_distance; + } + if (distance < loc->start()) { + loc->set_start (loc->start() - distance); + } else { + loc->set_start (0); + } } else { - loc->set_end (loc->length()); + distance = get_nudge_distance (loc->end(), next_distance); + + if (next) { + distance = next_distance; + } + + if (distance < loc->end() - loc->length()) { + loc->set_end (loc->end() - distance); + } else { + loc->set_end (loc->length()); + } } + + XMLNode& after (loc->get_state()); + session->add_command (new MementoCommand<Location>(*loc, &before, &after)); } - - XMLNode& after (loc->get_state()); - session->add_command (new MementoCommand<Location>(*loc, &before, &after)); } - + + commit_reversible_command (); + } else { distance = get_nudge_distance (playhead_cursor->current_frame, next_distance); diff --git a/gtk2_ardour/marker_selection.h b/gtk2_ardour/marker_selection.h index aa1413ed3e..ae6417f6c6 100644 --- a/gtk2_ardour/marker_selection.h +++ b/gtk2_ardour/marker_selection.h @@ -26,6 +26,7 @@ struct MarkerSelection : public std::list<Marker*> { + void range (nframes64_t& start, nframes64_t& end); }; #endif /* __ardour_gtk_marker_selection_h__ */ diff --git a/gtk2_ardour/selection.cc b/gtk2_ardour/selection.cc index a647cbcb6e..666f791ade 100644 --- a/gtk2_ardour/selection.cc +++ b/gtk2_ardour/selection.cc @@ -651,6 +651,12 @@ Selection::set (AutomationList *ac) } bool +Selection::selected (Marker* m) +{ + return find (markers.begin(), markers.end(), m) != markers.end(); +} + +bool Selection::selected (TimeAxisView* tv) { return find (tracks.begin(), tracks.end(), tv) != tracks.end(); @@ -826,3 +832,31 @@ Selection::add (Marker* m) MarkersChanged(); } } + +void +Selection::add (const list<Marker*>& m) +{ + markers.insert (markers.end(), m.begin(), m.end()); + MarkersChanged (); +} + +void +MarkerSelection::range (nframes64_t& s, nframes64_t& e) +{ + s = max_frames; + e = 0; + + for (MarkerSelection::iterator i = begin(); i != end(); ++i) { + + if ((*i)->position() < s) { + s = (*i)->position(); + } + + if ((*i)->position() > e) { + e = (*i)->position(); + } + } + + s = std::min (s, e); + e = std::max (s, e); +} diff --git a/gtk2_ardour/selection.h b/gtk2_ardour/selection.h index 4698544d9a..82ceb969a3 100644 --- a/gtk2_ardour/selection.h +++ b/gtk2_ardour/selection.h @@ -93,6 +93,7 @@ class Selection : public sigc::trackable bool selected (TimeAxisView*); bool selected (RegionView*); + bool selected (Marker*); void set (std::list<Selectable*>&); void add (std::list<Selectable*>&); @@ -133,6 +134,7 @@ class Selection : public sigc::trackable void add (const std::list<boost::shared_ptr<ARDOUR::Playlist> >&); void add (boost::shared_ptr<ARDOUR::Redirect>); void add (Marker*); + void add (const std::list<Marker*>&); void add (const RegionSelection&); void remove (TimeAxisView*); diff --git a/libs/ardour/ardour/location.h b/libs/ardour/ardour/location.h index 53d9489823..d5b672a89d 100644 --- a/libs/ardour/ardour/location.h +++ b/libs/ardour/ardour/location.h @@ -100,14 +100,15 @@ class Location : public PBD::StatefulDestructible void set_is_end (bool yn, void* src); void set_is_start (bool yn, void* src); - bool is_auto_punch () { return _flags & IsAutoPunch; } - bool is_auto_loop () { return _flags & IsAutoLoop; } - bool is_mark () { return _flags & IsMark; } - bool is_hidden () { return _flags & IsHidden; } - bool is_cd_marker () { return _flags & IsCDMarker; } - bool is_end() { return _flags & IsEnd; } - bool is_start() { return _flags & IsStart; } - bool is_range_marker() { return _flags & IsRangeMarker; } + bool is_auto_punch () const { return _flags & IsAutoPunch; } + bool is_auto_loop () const { return _flags & IsAutoLoop; } + bool is_mark () const { return _flags & IsMark; } + bool is_hidden () const { return _flags & IsHidden; } + bool is_cd_marker () const { return _flags & IsCDMarker; } + bool is_end() const { return _flags & IsEnd; } + bool is_start() const { return _flags & IsStart; } + bool is_range_marker() const { return _flags & IsRangeMarker; } + bool matches (Flags f) const { return _flags & f; } sigc::signal<void,Location*> name_changed; sigc::signal<void,Location*> end_changed; @@ -175,6 +176,8 @@ class Locations : public PBD::StatefulDestructible nframes_t first_mark_before (nframes_t, bool include_special_ranges = false); nframes_t first_mark_after (nframes_t, bool include_special_ranges = false); + void find_all_between (nframes64_t start, nframes64_t, LocationList&, Location::Flags); + sigc::signal<void,Location*> current_changed; sigc::signal<void> changed; sigc::signal<void,Location*> added; diff --git a/libs/ardour/audioanalyser.cc b/libs/ardour/audioanalyser.cc index 98c4206301..ab3691d8d1 100644 --- a/libs/ardour/audioanalyser.cc +++ b/libs/ardour/audioanalyser.cc @@ -10,6 +10,8 @@ #include <ardour/readable.h> #include <ardour/readable.h> +#include <cstring> + #include "i18n.h" using namespace std; diff --git a/libs/ardour/location.cc b/libs/ardour/location.cc index ebebc68b7f..61471ee5b0 100644 --- a/libs/ardour/location.cc +++ b/libs/ardour/location.cc @@ -924,3 +924,16 @@ Locations::get_location_by_id(PBD::ID id) return 0; } + +void +Locations::find_all_between (nframes64_t start, nframes64_t end, LocationList& ll, Location::Flags flags) +{ + Glib::Mutex::Lock lm (lock); + + for (LocationList::const_iterator i = locations.begin(); i != locations.end(); ++i) { + if ((flags == 0 || (*i)->matches (flags)) && + ((*i)->start() >= start && (*i)->end() < end)) { + ll.push_back (*i); + } + } +} diff --git a/libs/ardour/utils.cc b/libs/ardour/utils.cc index eaf5d474d7..45d77f46a5 100644 --- a/libs/ardour/utils.cc +++ b/libs/ardour/utils.cc @@ -20,7 +20,6 @@ #include <cstdio> /* for sprintf */ #include <cmath> #include <cctype> -#include <string> #include <cstring> #include <cerrno> #include <iostream> |