void MarkerList::ValueTreeWrapper::readFrom (const MarkerList& markerList, UndoManager* undoManager) { state.removeAllChildren (undoManager); for (int i = 0; i < markerList.getNumMarkers(); ++i) setMarker (*markerList.getMarker(i), undoManager); }
//============================================================================== void MarkerList::ValueTreeWrapper::applyTo (MarkerList& markerList) { const int numMarkers = getNumMarkers(); StringArray updatedMarkers; for (int i = 0; i < numMarkers; ++i) { const ValueTree marker (state.getChild (i)); const String name (marker [nameProperty].toString()); markerList.setMarker (name, RelativeCoordinate (marker [posProperty].toString())); updatedMarkers.add (name); } for (int i = markerList.getNumMarkers(); --i >= 0;) if (! updatedMarkers.contains (markerList.getMarker (i)->name)) markerList.removeMarker (i); }