Selection::Selection (const PublicEditor* e)
: tracks (e)
, editor (e)
- , next_time_id (0)
+ , next_time_id (0)
+ , _no_tracks_changed (false)
{
clear ();
void (Selection::*marker_remove)(Marker*) = &Selection::remove;
Marker::CatchDeletion.connect (*this, MISSING_INVALIDATOR, ui_bind (marker_remove, this, _1), gui_context());
-}
+}
#if 0
Selection&
if (!regions.empty()) {
regions.clear_all ();
RegionsChanged();
+ if (Config->get_link_region_and_track_selection()) {
+ clear_tracks ();
+ }
}
}
{
if (!tracks.empty()) {
tracks.clear ();
- TracksChanged();
+ if (!_no_tracks_changed) {
+ TracksChanged();
+ }
}
}
tracks.erase (i);
}
- TracksChanged();
+ if (!_no_tracks_changed) {
+ TracksChanged();
+ }
}
void
TrackViewList added = tracks.add (track_list);
if (!added.empty()) {
- TracksChanged ();
+ if (!_no_tracks_changed) {
+ TracksChanged ();
+ }
}
}
list<TimeAxisView*>::iterator i;
if ((i = find (tracks.begin(), tracks.end(), track)) != tracks.end()) {
tracks.erase (i);
- TracksChanged();
+ if (!_no_tracks_changed) {
+ TracksChanged();
+ }
}
}
}
if (changed) {
- TracksChanged();
+ if (!_no_tracks_changed) {
+ TracksChanged();
+ }
}
}
Selection::set (RegionView* r, bool also_clear_tracks)
{
clear_regions ();
- if (also_clear_tracks) {
+ if (also_clear_tracks && !Config->get_link_region_and_track_selection()) {
+ /* clear_regions() will have done this if the link preference
+ * is enabled
+ */
clear_tracks ();
}
add (r);
}
time.consolidate ();
-
+
TimeChanged ();
}
if (Config->get_link_region_and_track_selection ()) {
clear_tracks ();
}
-
+
add (selectables);
}
Selection::set_point_selection_from_line (AutomationLine const & line)
{
points.clear ();
-
+
AutomationRange current (DBL_MAX, 0, 1, 0, &line.trackview);
for (uint32_t i = 0; i < line.npoints(); ++i) {
double const size = cp->size ();
double const x_size = line.time_converter().from (line.trackview.editor().pixel_to_frame (size));
double const y_size = size / line.trackview.current_height ();
-
+
double const x1 = max (0.0, x - x_size / 2);
double const x2 = x + x_size / 2;
double const y1 = max (0.0, y - y_size / 2);
/* XXX: not complete; just sufficient to get track selection state
so that re-opening plugin windows for editor mixer strips works
*/
-
+
XMLNode* node = new XMLNode (X_("Selection"));
for (TrackSelection::const_iterator i = tracks.begin(); i != tracks.end(); ++i) {
}
}
+ for (MarkerSelection::const_iterator i = markers.begin(); i != markers.end(); ++i) {
+ XMLNode* t = node->add_child (X_("Marker"));
+
+ bool is_start;
+ Location* loc = editor->find_location_from_marker (*i, is_start);
+
+ t->add_property (X_("id"), atoi (loc->id().to_s().c_str()));
+ t->add_property (X_("start"), is_start ? X_("yes") : X_("no"));
+ }
+
return *node;
}
if (node.name() != X_("Selection")) {
return -1;
}
-
+
XMLNodeList children = node.children ();
for (XMLNodeList::const_iterator i = children.begin(); i != children.end(); ++i) {
if ((*i)->name() == X_("RouteView")) {
-
+
XMLProperty* prop_id = (*i)->property (X_("id"));
assert (prop_id);
PBD::ID id (prop_id->value ());
if (rtv) {
add (rtv);
}
-
+
} else if ((*i)->name() == X_("AutomationView")) {
-
+
XMLProperty* prop_id = (*i)->property (X_("id"));
XMLProperty* prop_parameter = (*i)->property (X_("parameter"));
if (rtv) {
boost::shared_ptr<AutomationTimeAxisView> atv = rtv->automation_child (EventTypeMap::instance().new_parameter (prop_parameter->value ()));
-
+
/* the automation could be for an entity that was never saved
in the session file. Don't freak out if we can't find
it.
*/
-
+
if (atv) {
add (atv.get());
}
}
+
+ } else if ((*i)->name() == X_("Marker")) {
+
+ XMLProperty* prop_id = (*i)->property (X_("id"));
+ XMLProperty* prop_start = (*i)->property (X_("start"));
+ assert (prop_id);
+ assert (prop_start);
+
+ PBD::ID id (prop_id->value ());
+ Marker* m = editor->find_marker_from_location_id (id, string_is_affirmative (prop_start->value ()));
+ if (m) {
+ add (m);
+ }
+
}
+
}
return 0;
i = tmp;
}
}
+
+void
+Selection::block_tracks_changed (bool yn)
+{
+ _no_tracks_changed = yn;
+}