AutomationLine time-unit conversion and paste API update
[ardour.git] / gtk2_ardour / selection.cc
index feb7b3b1a578b7680f13b05f3ad35a25a59690a0..1114222248f1f008be12432d688abae27bde80aa 100644 (file)
 
 #include "pbd/error.h"
 #include "pbd/stacktrace.h"
+#include "pbd/types_convert.h"
 
 #include "ardour/playlist.h"
 #include "ardour/rc_configuration.h"
+#include "ardour/evoral_types_convert.h"
 
 #include "control_protocol/control_protocol.h"
 
@@ -40,8 +42,9 @@
 #include "automation_time_axis.h"
 #include "public_editor.h"
 #include "control_point.h"
+#include "vca_time_axis.h"
 
-#include "i18n.h"
+#include "pbd/i18n.h"
 
 using namespace std;
 using namespace ARDOUR;
@@ -57,7 +60,6 @@ Selection::Selection (const PublicEditor* e)
        : tracks (e)
        , editor (e)
        , next_time_id (0)
-       , _no_tracks_changed (false)
 {
        clear ();
 
@@ -132,13 +134,13 @@ void
 Selection::clear_tracks (bool with_signal)
 {
        if (!tracks.empty()) {
+               PresentationInfo::ChangeSuspender cs;
+
                for (TrackViewList::iterator x = tracks.begin(); x != tracks.end(); ++x) {
                        (*x)->set_selected (false);
                }
+
                tracks.clear ();
-               if (!_no_tracks_changed && with_signal) {
-                       TracksChanged();
-               }
        }
 }
 
@@ -272,7 +274,12 @@ Selection::toggle (boost::shared_ptr<Playlist> pl)
 void
 Selection::toggle (const TrackViewList& track_list)
 {
+       PresentationInfo::ChangeSuspender cs;
+
        for (TrackViewList::const_iterator i = track_list.begin(); i != track_list.end(); ++i) {
+               if (dynamic_cast<VCATimeAxisView*> (*i)) {
+                       continue;
+               }
                toggle ((*i));
        }
 }
@@ -280,19 +287,20 @@ Selection::toggle (const TrackViewList& track_list)
 void
 Selection::toggle (TimeAxisView* track)
 {
+       if (dynamic_cast<VCATimeAxisView*> (track)) {
+               return;
+       }
+
        TrackSelection::iterator i;
 
        if ((i = find (tracks.begin(), tracks.end(), track)) == tracks.end()) {
-               track->set_selected (true);
                tracks.push_back (track);
+               track->set_selected (true);
        } else {
-               track->set_selected (false);
                tracks.erase (i);
+               track->set_selected (false);
        }
 
-       if (!_no_tracks_changed) {
-               TracksChanged();
-       }
 }
 
 void
@@ -429,29 +437,32 @@ Selection::add (const list<boost::shared_ptr<Playlist> >& pllist)
 }
 
 void
-Selection::add (const TrackViewList& track_list)
+Selection::add (TrackViewList const & track_list)
 {
        clear_objects();  //enforce object/range exclusivity
 
+       PresentationInfo::ChangeSuspender cs;
+
        TrackViewList added = tracks.add (track_list);
 
        if (!added.empty()) {
                for (TrackViewList::iterator x = added.begin(); x != added.end(); ++x) {
+                       if (dynamic_cast<VCATimeAxisView*> (*x)) {
+                               continue;
+                       }
                        (*x)->set_selected (true);
                }
-               if (!_no_tracks_changed) {
-                       TracksChanged ();
-               }
        }
 }
 
 void
 Selection::add (TimeAxisView* track)
 {
-       clear_objects();  //enforce object/range exclusivity
+       if (dynamic_cast<VCATimeAxisView*> (track)) {
+               return;
+       }
 
        TrackViewList tr;
-       track->set_selected (true);
        tr.push_back (track);
        add (tr);
 }
@@ -637,33 +648,29 @@ Selection::remove (TimeAxisView* track)
 {
        list<TimeAxisView*>::iterator i;
        if ((i = find (tracks.begin(), tracks.end(), track)) != tracks.end()) {
-               track->set_selected (false);
-               tracks.erase (i);
+               /* erase first, because set_selected() will remove the track
+                  from the selection, invalidating the iterator.
 
-               if (!_no_tracks_changed) {
-                       TracksChanged();
-               }
+                  In fact, we don't really even need to do the erase, but this is
+                  a hangover of axis view selection being in the GUI.
+               */
+               tracks.erase (i);
+               track->set_selected (false);
        }
 }
 
 void
 Selection::remove (const TrackViewList& track_list)
 {
-       bool changed = false;
+       PresentationInfo::ChangeSuspender cs;
 
        for (TrackViewList::const_iterator i = track_list.begin(); i != track_list.end(); ++i) {
 
                TrackViewList::iterator x = find (tracks.begin(), tracks.end(), *i);
+
                if (x != tracks.end()) {
-                       (*i)->set_selected (false);
                        tracks.erase (x);
-                       changed = true;
-               }
-       }
-
-       if (changed) {
-               if (!_no_tracks_changed) {
-                       TracksChanged();
+                       (*i)->set_selected (false);
                }
        }
 }
@@ -796,8 +803,27 @@ Selection::remove (boost::shared_ptr<ARDOUR::AutomationList> ac)
 void
 Selection::set (TimeAxisView* track)
 {
+       if (dynamic_cast<VCATimeAxisView*> (track)) {
+               return;
+       }
        clear_objects ();  //enforce object/range exclusivity
-       clear_tracks (false);
+
+       PresentationInfo::ChangeSuspender cs;
+
+       if (!tracks.empty()) {
+
+               if (tracks.size() == 1 && tracks.front() == track) {
+                       /* already single selection: nothing to do */
+                       return;
+               }
+
+               for (TrackViewList::iterator x = tracks.begin(); x != tracks.end(); ++x) {
+                       (*x)->set_selected (false);
+               }
+
+               tracks.clear ();
+       }
+
        add (track);
 }
 
@@ -805,8 +831,30 @@ void
 Selection::set (const TrackViewList& track_list)
 {
        clear_objects();  //enforce object/range exclusivity
-       clear_tracks (false);
-       add (track_list);
+
+
+       TrackViewList to_be_added;
+       TrackViewList to_be_removed;
+
+       for (TrackViewList::const_iterator x = tracks.begin(); x != tracks.end(); ++x) {
+               if (find (track_list.begin(), track_list.end(), *x) == track_list.end()) {
+                       to_be_removed.push_back (*x);
+               }
+       }
+
+       for (TrackViewList::const_iterator x = track_list.begin(); x != track_list.end(); ++x) {
+               if (dynamic_cast<VCATimeAxisView*> (*x)) {
+                       continue;
+               }
+               if (find (tracks.begin(), tracks.end(), *x) == tracks.end()) {
+                       to_be_added.push_back (*x);
+               }
+       }
+
+       PresentationInfo::ChangeSuspender cs;
+       remove (to_be_removed);
+       add (to_be_added);
+
 }
 
 void
@@ -946,25 +994,25 @@ Selection::set (boost::shared_ptr<Evoral::ControlList> ac)
 }
 
 bool
-Selection::selected (ArdourMarker* m)
+Selection::selected (ArdourMarker* m) const
 {
        return find (markers.begin(), markers.end(), m) != markers.end();
 }
 
 bool
-Selection::selected (TimeAxisView* tv)
+Selection::selected (TimeAxisView* tv) const
 {
        return tv->selected ();
 }
 
 bool
-Selection::selected (RegionView* rv)
+Selection::selected (RegionView* rv) const
 {
        return find (regions.begin(), regions.end(), rv) != regions.end();
 }
 
 bool
-Selection::selected (ControlPoint* cp)
+Selection::selected (ControlPoint* cp) const
 {
        return find (points.begin(), points.end(), cp) != points.end();
 }
@@ -1248,7 +1296,6 @@ Selection::get_state () const
           so that re-opening plugin windows for editor mixer strips works
        */
 
-       char buf[32];
        XMLNode* node = new XMLNode (X_("Selection"));
 
        for (TrackSelection::const_iterator i = tracks.begin(); i != tracks.end(); ++i) {
@@ -1256,50 +1303,31 @@ Selection::get_state () const
                AutomationTimeAxisView* atv = dynamic_cast<AutomationTimeAxisView*> (*i);
                if (rtv) {
                        XMLNode* t = node->add_child (X_("RouteView"));
-                       t->add_property (X_("id"), atoi (rtv->route()->id().to_s().c_str()));
+                       t->set_property (X_("id"), rtv->route()->id ());
                } else if (atv) {
                        XMLNode* t = node->add_child (X_("AutomationView"));
-                       t->add_property (X_("id"), atoi (atv->parent_route()->id().to_s().c_str()));
-                       t->add_property (X_("parameter"), EventTypeMap::instance().to_symbol (atv->parameter ()));
+                       t->set_property (X_("id"), atv->parent_route()->id ());
+                       t->set_property (X_("parameter"), EventTypeMap::instance().to_symbol (atv->parameter ()));
                }
        }
 
        for (RegionSelection::const_iterator i = regions.begin(); i != regions.end(); ++i) {
                XMLNode* r = node->add_child (X_("Region"));
-               r->add_property (X_("id"), atoi ((*i)->region ()->id ().to_s ().c_str()));
+               r->set_property (X_("id"), (*i)->region ()->id ());
        }
 
        /* midi region views have thir own internal selection. */
-       XMLNode* n = NULL;
        list<pair<PBD::ID, std::set<boost::shared_ptr<Evoral::Note<Evoral::Beats> > > > > rid_notes;
        editor->get_per_region_note_selection (rid_notes);
-       if (!rid_notes.empty()) {
-               n = node->add_child (X_("MIDINote"));
-       }
+
        list<pair<PBD::ID, std::set<boost::shared_ptr<Evoral::Note<Evoral::Beats> > > > >::iterator rn_it;
        for (rn_it = rid_notes.begin(); rn_it != rid_notes.end(); ++rn_it) {
-               assert(n); // hint for clang static analysis
-               n->add_property (X_("region_id"), atoi((*rn_it).first.to_s().c_str()));
+               XMLNode* n = node->add_child (X_("MIDINotes"));
+               n->set_property (X_("region-id"), (*rn_it).first);
 
                for (std::set<boost::shared_ptr<Evoral::Note<Evoral::Beats> > >::iterator i = (*rn_it).second.begin(); i != (*rn_it).second.end(); ++i) {
                        XMLNode* nc = n->add_child(X_("note"));
-                       snprintf(buf, sizeof(buf), "%d", (*i)->channel());
-                       nc->add_property(X_("channel"), string(buf));
-
-                       snprintf(buf, sizeof(buf), "%f", (*i)->time().to_double());
-                       nc->add_property(X_("time"), string(buf));
-
-                       snprintf(buf, sizeof(buf), "%d", (*i)->note());
-                       nc->add_property(X_("note"), string(buf));
-
-                       snprintf(buf, sizeof(buf), "%f", (*i)->length().to_double());
-                       nc->add_property(X_("length"), string(buf));
-
-                       snprintf(buf, sizeof(buf), "%d", (*i)->velocity());
-                       nc->add_property(X_("velocity"), string(buf));
-
-                       snprintf(buf, sizeof(buf), "%d", (*i)->off_velocity());
-                       nc->add_property(X_("off-velocity"), string(buf));
+                       nc->set_property(X_("note-id"), (*i)->id());
                }
        }
 
@@ -1308,33 +1336,28 @@ Selection::get_state () const
                if (atv) {
 
                        XMLNode* r = node->add_child (X_("ControlPoint"));
-                       r->add_property (X_("type"), "track");
-                       r->add_property (X_("route-id"), atoi (atv->parent_route()->id ().to_s ().c_str()));
-                       r->add_property (X_("automation-list-id"), atoi ((*i)->line().the_list()->id ().to_s ().c_str()));
-                       r->add_property (X_("parameter"), EventTypeMap::instance().to_symbol ((*i)->line().the_list()->parameter ()));
-
-                       snprintf(buf, sizeof(buf), "%d", (*i)->view_index());
-                       r->add_property (X_("view-index"), string(buf));
+                       r->set_property (X_("type"), "track");
+                       r->set_property (X_("route-id"), atv->parent_route()->id ());
+                       r->set_property (X_("automation-list-id"), (*i)->line().the_list()->id ());
+                       r->set_property (X_("parameter"), EventTypeMap::instance().to_symbol ((*i)->line().the_list()->parameter ()));
+                       r->set_property (X_("view-index"), (*i)->view_index());
                        continue;
                }
 
                AudioRegionGainLine* argl = dynamic_cast<AudioRegionGainLine*> (&(*i)->line());
                if (argl) {
                        XMLNode* r = node->add_child (X_("ControlPoint"));
-                       r->add_property (X_("type"), "region");
-                       r->add_property (X_("region-id"), atoi (argl->region_view ().region ()->id ().to_s ().c_str()));
-                       snprintf(buf, sizeof(buf), "%d", (*i)->view_index());
-                       r->add_property (X_("view-index"), string(buf));
+                       r->set_property (X_("type"), "region");
+                       r->set_property (X_("region-id"), argl->region_view ().region ()->id ());
+                       r->set_property (X_("view-index"), (*i)->view_index());
                }
 
        }
 
        for (TimeSelection::const_iterator i = time.begin(); i != time.end(); ++i) {
                XMLNode* t = node->add_child (X_("AudioRange"));
-               snprintf(buf, sizeof(buf), "%" PRId64, (*i).start);
-               t->add_property (X_("start"), string(buf));
-               snprintf(buf, sizeof(buf), "%" PRId64, (*i).end);
-               t->add_property (X_("end"), string(buf));
+               t->set_property (X_("start"), (*i).start);
+               t->set_property (X_("end"), (*i).end);
        }
 
        for (MarkerSelection::const_iterator i = markers.begin(); i != markers.end(); ++i) {
@@ -1343,8 +1366,8 @@ Selection::get_state () const
                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"));
+               t->set_property (X_("id"), loc->id());
+               t->set_property (X_("start"), is_start);
        }
 
        return *node;
@@ -1364,28 +1387,33 @@ Selection::set_state (XMLNode const & node, int)
        clear_tracks ();
        clear_markers ();
 
+       RegionSelection selected_regions;
+
+       PBD::ID id;
        XMLNodeList children = node.children ();
        for (XMLNodeList::const_iterator i = children.begin(); i != children.end(); ++i) {
                if ((*i)->name() == X_("RouteView")) {
 
-                       XMLProperty const * prop_id = (*i)->property (X_("id"));
-                       assert (prop_id);
-                       PBD::ID id (prop_id->value ());
+                       if (!(*i)->get_property (X_("id"), id)) {
+                               assert(false); // handle this more gracefully?
+                       }
+
                        RouteTimeAxisView* rtv = editor->get_route_view_by_route_id (id);
                        if (rtv) {
                                add (rtv);
                        }
 
                } else if ((*i)->name() == X_("Region")) {
-                       XMLProperty const * prop_id = (*i)->property (X_("id"));
-                       assert (prop_id);
-                       PBD::ID id (prop_id->value ());
+
+                       if (!(*i)->get_property (X_("id"), id)) {
+                               assert(false);
+                       }
 
                        RegionSelection rs;
                        editor->get_regionviews_by_id (id, rs);
 
                        if (!rs.empty ()) {
-                               add (rs);
+                               selected_regions.insert (selected_regions.end(), rs.begin(), rs.end());
                        } else {
                                /*
                                  regionviews haven't been constructed - stash the region IDs
@@ -1394,45 +1422,24 @@ Selection::set_state (XMLNode const & node, int)
                                regions.pending.push_back (id);
                        }
 
-               } else if ((*i)->name() == X_("MIDINote")) {
-                       XMLProperty const * prop_region_id = (*i)->property (X_("region-id"));
+               } else if ((*i)->name() == X_("MIDINotes")) {
 
-                       assert (prop_region_id);
+                       if (!(*i)->get_property (X_("region-id"), id)) {
+                               assert (false);
+                       }
 
-                       PBD::ID const id (prop_region_id->value ());
                        RegionSelection rs;
 
                        editor->get_regionviews_by_id (id, rs); // there could be more than one
 
-                       std::list<boost::shared_ptr<Evoral::Note<Evoral::Beats> > > notes;
+                       std::list<Evoral::event_id_t> notes;
                        XMLNodeList children = (*i)->children ();
 
                        for (XMLNodeList::const_iterator ci = children.begin(); ci != children.end(); ++ci) {
-                               XMLProperty const * prop_channel = (*ci)->property (X_("channel"));
-                               XMLProperty const * prop_time = (*ci)->property (X_("time"));
-                               XMLProperty const * prop_note = (*ci)->property (X_("note"));
-                               XMLProperty const * prop_length = (*ci)->property (X_("length"));
-                               XMLProperty const * prop_velocity = (*ci)->property (X_("velocity"));
-                               XMLProperty const * prop_off_velocity = (*ci)->property (X_("off-velocity"));
-
-                               assert (prop_channel);
-                               assert (prop_time);
-                               assert (prop_note);
-                               assert (prop_length);
-                               assert (prop_velocity);
-                               assert (prop_off_velocity);
-
-                               uint8_t channel = atoi(prop_channel->value());
-                               Evoral::Beats time (atof(prop_time->value()));
-                               Evoral::Beats length (atof(prop_length->value()));
-                               uint8_t note = atoi(prop_note->value());
-                               uint8_t velocity = atoi(prop_velocity->value());
-                               uint8_t off_velocity = atoi(prop_off_velocity->value());
-                               boost::shared_ptr<Evoral::Note<Evoral::Beats> > the_note
-                                       (new Evoral::Note<Evoral::Beats>  (channel, time, length, note, velocity));
-                               the_note->set_off_velocity (off_velocity);
-
-                               notes.push_back (the_note);
+                               Evoral::event_id_t id;
+                               if ((*ci)->get_property (X_ ("note-id"), id)) {
+                                       notes.push_back (id);
+                               }
                        }
 
                        for (RegionSelection::iterator rsi = rs.begin(); rsi != rs.end(); ++rsi) {
@@ -1454,27 +1461,28 @@ Selection::set_state (XMLNode const & node, int)
 
                        if (prop_type->value () == "track") {
 
-                               XMLProperty const * prop_route_id = (*i)->property (X_("route-id"));
-                               XMLProperty const * prop_alist_id = (*i)->property (X_("automation-list-id"));
-                               XMLProperty const * prop_parameter = (*i)->property (X_("parameter"));
-                               XMLProperty const * prop_view_index = (*i)->property (X_("view-index"));
+                               PBD::ID route_id;
+                               PBD::ID alist_id;
+                               std::string param;
+                               uint32_t view_index;
 
-                               assert (prop_route_id);
-                               assert (prop_alist_id);
-                               assert (prop_parameter);
-                               assert (prop_view_index);
+                               if (!(*i)->get_property (X_("route-id"), route_id) ||
+                                   !(*i)->get_property (X_("automation-list-id"), alist_id) ||
+                                   !(*i)->get_property (X_("parameter"), param) ||
+                                   !(*i)->get_property (X_("view-index"), view_index)) {
+                                       assert(false);
+                               }
 
-                               PBD::ID route_id (prop_route_id->value ());
                                RouteTimeAxisView* rtv = editor->get_route_view_by_route_id (route_id);
                                vector <ControlPoint *> cps;
 
                                if (rtv) {
-                                       boost::shared_ptr<AutomationTimeAxisView> atv = rtv->automation_child (EventTypeMap::instance().from_symbol (prop_parameter->value ()));
+                                       boost::shared_ptr<AutomationTimeAxisView> atv = rtv->automation_child (EventTypeMap::instance().from_symbol (param));
                                        if (atv) {
                                                list<boost::shared_ptr<AutomationLine> > lines = atv->lines();
                                                for (list<boost::shared_ptr<AutomationLine> > ::iterator li = lines.begin(); li != lines.end(); ++li) {
-                                                       if ((*li)->the_list()->id() == prop_alist_id->value()) {
-                                                               ControlPoint* cp = (*li)->nth(atol(prop_view_index->value().c_str()));
+                                                       if ((*li)->the_list()->id() == alist_id) {
+                                                               ControlPoint* cp = (*li)->nth(view_index);
                                                                if (cp) {
                                                                        cps.push_back (cp);
                                                                        cp->show();
@@ -1487,14 +1495,14 @@ Selection::set_state (XMLNode const & node, int)
                                        add (cps);
                                }
                        } else if (prop_type->value () == "region") {
-                               XMLProperty const * prop_region_id = (*i)->property (X_("region-id"));
-                               XMLProperty const * prop_view_index = (*i)->property (X_("view-index"));
 
-                               if (!prop_region_id || !prop_view_index) {
+                               PBD::ID region_id;
+                               uint32_t view_index;
+                               if (!(*i)->get_property (X_("region-id"), region_id) ||
+                                   !(*i)->get_property (X_("view-index"), view_index)) {
                                        continue;
                                }
 
-                               PBD::ID region_id (prop_region_id->value ());
                                RegionSelection rs;
                                editor->get_regionviews_by_id (region_id, rs);
 
@@ -1504,7 +1512,7 @@ Selection::set_state (XMLNode const & node, int)
                                                AudioRegionView* arv = dynamic_cast<AudioRegionView*> (*rsi);
                                                if (arv) {
                                                        boost::shared_ptr<AudioRegionGainLine> gl = arv->get_gain_line ();
-                                                       ControlPoint* cp = gl->nth(atol(prop_view_index->value().c_str()));
+                                                       ControlPoint* cp = gl->nth(view_index);
                                                        if (cp) {
                                                                cps.push_back (cp);
                                                                cp->show();
@@ -1518,30 +1526,26 @@ Selection::set_state (XMLNode const & node, int)
                        }
 
                } else if  ((*i)->name() == X_("AudioRange")) {
-                       XMLProperty const * prop_start = (*i)->property (X_("start"));
-                       XMLProperty const * prop_end = (*i)->property (X_("end"));
+                       framepos_t start;
+                       framepos_t end;
 
-                       assert (prop_start);
-                       assert (prop_end);
-
-                       framepos_t s (atol (prop_start->value ().c_str()));
-                       framepos_t e (atol (prop_end->value ().c_str()));
-
-                       set_preserving_all_ranges (s, e);
+                       if (!(*i)->get_property (X_("start"), start) || !(*i)->get_property (X_("end"), end)) {
+                               assert(false);
+                       }
+                       set_preserving_all_ranges (start, end);
 
                } else if ((*i)->name() == X_("AutomationView")) {
 
-                       XMLProperty const * prop_id = (*i)->property (X_("id"));
-                       XMLProperty const * prop_parameter = (*i)->property (X_("parameter"));
+                       std::string param;
 
-                       assert (prop_id);
-                       assert (prop_parameter);
+                       if (!(*i)->get_property (X_("id"), id) || !(*i)->get_property (X_("parameter"), param)) {
+                               assert (false);
+                       }
 
-                       PBD::ID id (prop_id->value ());
                        RouteTimeAxisView* rtv = editor->get_route_view_by_route_id (id);
 
                        if (rtv) {
-                               boost::shared_ptr<AutomationTimeAxisView> atv = rtv->automation_child (EventTypeMap::instance().from_symbol (prop_parameter->value ()));
+                               boost::shared_ptr<AutomationTimeAxisView> atv = rtv->automation_child (EventTypeMap::instance().from_symbol (param));
 
                                /* the automation could be for an entity that was never saved
                                   in the session file. Don't freak out if we can't find
@@ -1555,13 +1559,12 @@ Selection::set_state (XMLNode const & node, int)
 
                } else if ((*i)->name() == X_("Marker")) {
 
-                       XMLProperty const * prop_id = (*i)->property (X_("id"));
-                       XMLProperty const * prop_start = (*i)->property (X_("start"));
-                       assert (prop_id);
-                       assert (prop_start);
+                       bool is_start;
+                       if (!(*i)->get_property (X_("id"), id) || !(*i)->get_property (X_("start"), is_start)) {
+                               assert(false);
+                       }
 
-                       PBD::ID id (prop_id->value ());
-                       ArdourMarker* m = editor->find_marker_from_location_id (id, string_is_affirmative (prop_start->value ()));
+                       ArdourMarker* m = editor->find_marker_from_location_id (id, is_start);
                        if (m) {
                                add (m);
                        }
@@ -1570,6 +1573,9 @@ Selection::set_state (XMLNode const & node, int)
 
        }
 
+       // now add regions to selection at once
+       add (selected_regions);
+
        return 0;
 }
 
@@ -1588,9 +1594,3 @@ Selection::remove_regions (TimeAxisView* t)
                i = tmp;
        }
 }
-
-void
-Selection::block_tracks_changed (bool yn)
-{
-       _no_tracks_changed = yn;
-}