*/
#include <algorithm>
-#include <stdlib.h>
+#include <cstdlib>
#include <pbd/stacktrace.h>
#include <ardour/diskstream.h>
#include <ardour/playlist.h>
#include <ardour/route_group.h>
+#include <ardour/profile.h>
#include "editor.h"
#include "actions.h"
break;
case Selection::Set:
- if (selection->selected (&view) && selection->tracks.size() > 1) {
-
- /* reset track selection if there is only 1 other track
- selected OR if no_remove is not set (its there to
- prevent deselecting a multi-track selection
- when clicking on an already selected track
- for some reason.
- */
-
- if (selection->tracks.empty()) {
- selection->set (&view);
- } else if (selection->tracks.size() == 1 || !no_remove) {
- selection->set (&view);
- }
- }
+ selection->set (&view);
break;
case Selection::Extend:
/* select this point and any others that it represents */
double y1, y2;
- nframes_t x1, x2;
+ nframes64_t x1, x2;
x1 = pixel_to_frame (clicked_control_point->get_x() - 10);
x2 = pixel_to_frame (clicked_control_point->get_x() + 10);
equivalent_regions.push_back (basis);
}
+int
+Editor::get_regionview_count_from_region_list (boost::shared_ptr<Region> region)
+{
+ int region_count = 0;
+
+ for (TrackViewList::iterator i = track_views.begin(); i != track_views.end(); ++i) {
+
+ RouteTimeAxisView* tatv;
+
+ if ((tatv = dynamic_cast<RouteTimeAxisView*> (*i)) != 0) {
+
+ boost::shared_ptr<Playlist> pl;
+ vector<boost::shared_ptr<Region> > results;
+ RegionView* marv;
+ boost::shared_ptr<Diskstream> ds;
+
+ if ((ds = tatv->get_diskstream()) == 0) {
+ /* bus */
+ continue;
+ }
+
+ if ((pl = (ds->playlist())) != 0) {
+ pl->get_region_list_equivalent_regions (region, results);
+ }
+
+ for (vector<boost::shared_ptr<Region> >::iterator ir = results.begin(); ir != results.end(); ++ir) {
+ if ((marv = tatv->view()->find_view (*ir)) != 0) {
+ region_count++;
+ }
+ }
+
+ }
+ }
+
+ return region_count;
+}
+
+
bool
Editor::set_selected_regionview_from_click (bool press, Selection::Operation op, bool no_track_remove)
{
} else if (op == Selection::Extend) {
list<Selectable*> results;
- nframes_t last_frame;
- nframes_t first_frame;
+ nframes64_t last_frame;
+ nframes64_t first_frame;
bool same_track = false;
/* 1. find the last selected regionview in the track that was clicked in */
(*i)->set_selected (false);
}
}
+
+ ActionManager::set_sensitive (ActionManager::track_selection_sensitive_actions, !selection->tracks.empty());
}
void
Editor::time_selection_changed ()
{
+ if (Profile->get_sae()) {
+ return;
+ }
+
for (TrackViewList::iterator i = track_views.begin(); i != track_views.end(); ++i) {
(*i)->hide_selection ();
}
}
void
-Editor::region_selection_changed ()
+Editor::sensitize_the_right_region_actions (bool have_selected_regions)
{
- for (TrackViewList::iterator i = track_views.begin(); i != track_views.end(); ++i) {
- (*i)->set_selected_regionviews (selection->regions);
- }
-
- bool have_selected_regions = !selection->regions.empty();
-
for (vector<Glib::RefPtr<Action> >::iterator x = ActionManager::region_selection_sensitive_actions.begin();
x != ActionManager::region_selection_sensitive_actions.end(); ++x) {
(*x)->set_sensitive (have_selected_regions);
}
}
+}
+
+
+void
+Editor::region_selection_changed ()
+{
+ for (TrackViewList::iterator i = track_views.begin(); i != track_views.end(); ++i) {
+ (*i)->set_selected_regionviews (selection->regions);
+ }
+
+ sensitize_the_right_region_actions (!selection->regions.empty());
zoomed_to_region = false;
}
}
bool
-Editor::select_all_within (nframes_t start, nframes_t end, double top, double bot, const TrackViewList& tracklist, Selection::Operation op)
+Editor::select_all_within (nframes64_t start, nframes64_t end, double top, double bot, const TrackViewList& tracklist, Selection::Operation op)
{
list<Selectable*> touched;
list<Selectable*>::size_type n = 0;
}
selection->set (0, selection->regions.start(), selection->regions.end_frame());
- set_mouse_mode (Editing::MouseRange, false);
+ if (!Profile->get_sae()) {
+ set_mouse_mode (Editing::MouseRange, false);
+ }
}
void
selection->set (0, loc.start(), loc.end());
commit_reversible_command ();
- set_mouse_mode (Editing::MouseRange, false);
+ if (!Profile->get_sae()) {
+ set_mouse_mode (Editing::MouseRange, false);
+ }
}
void
return;
}
- nframes_t start = selection->time[clicked_selection].start;
- nframes_t end = selection->time[clicked_selection].end;
+ nframes64_t start = selection->time[clicked_selection].start;
+ nframes64_t end = selection->time[clicked_selection].end;
if (end - start < 1) {
return;
void
Editor::select_all_selectables_using_cursor (Cursor *cursor, bool after)
{
- nframes_t start;
- nframes_t end;
+ nframes64_t start;
+ nframes64_t end;
list<Selectable *> touched;
if (after) {
void
Editor::select_all_selectables_using_edit (bool after)
{
- nframes_t start;
- nframes_t end;
+ nframes64_t start;
+ nframes64_t end;
list<Selectable *> touched;
if (after) {
swap (start, end);
}
+ /* turn range into one delimited by start...end,
+ not start...end-1
+ */
+
+ end++;
+
return true;
}