editor: delete remote keys when creating new document

This commit is contained in:
Erik Faye-Lund 2010-11-13 14:05:19 +01:00
parent 7edb2082be
commit 5318b90d7a

View File

@ -195,16 +195,17 @@ std::wstring fileName;
void fileNew() void fileNew()
{ {
// document.purgeUnusedTracks(); // document.purgeUnusedTracks();
for (size_t i = 0; i < document.num_tracks; ++i) SyncDocument::MultiCommand *multiCmd = new SyncDocument::MultiCommand();
{ for (size_t i = 0; i < document.num_tracks; ++i) {
sync_track *t = document.tracks[i]; sync_track *t = document.tracks[i];
free(t->keys); for (size_t j = 0; j < t->num_keys; ++j)
t->keys = NULL; multiCmd->addCommand(new SyncDocument::DeleteCommand(i, t->keys[j].row));
t->num_keys = 0;
} }
document.exec(multiCmd);
setWindowFileName(L"Untitled"); setWindowFileName(L"Untitled");
fileName.clear(); fileName.clear();
document.clearUndoStack(); document.clearUndoStack();
document.clearRedoStack(); document.clearRedoStack();
} }