From af45bdaa3aa64ac15fc6bf13f438e8c2200a6684 Mon Sep 17 00:00:00 2001 From: thrust26 Date: Fri, 31 May 2019 22:30:56 +0200 Subject: [PATCH] doc update save all states now saves ALL states --- docs/index.html | 14 ++++++++++++++ src/common/RewindManager.cxx | 13 +++++++++---- 2 files changed, 23 insertions(+), 4 deletions(-) diff --git a/docs/index.html b/docs/index.html index 7ac6f73fe..db5ace441 100644 --- a/docs/index.html +++ b/docs/index.html @@ -717,6 +717,12 @@ F9 + + Save all states + Alt + F9 + Cmd + F9 + + Change current state slot F10 @@ -729,6 +735,12 @@ F11 + + Load all states + Alt + F11 + Cmd + F1 + + Save PNG snapshot F12 @@ -1819,6 +1831,8 @@ 'Rewind One' buttonNavigates back by one state 'Unwind One' buttonNavigates forward by one state 'Unwind All' buttonNavigates forward to the end of the timeline + 'Save All' buttonSaves all states to disk + 'Load All' buttonLoades all states from disk Navigation infoInforms about the interval of the user's last Time Machine navigation. The interval can vary if the timeline is compressed. Total timeShows the total time covered by the save states diff --git a/src/common/RewindManager.cxx b/src/common/RewindManager.cxx index 021fc0350..32bf64002 100644 --- a/src/common/RewindManager.cxx +++ b/src/common/RewindManager.cxx @@ -237,7 +237,10 @@ string RewindManager::saveAllStates() if (!out) return "Can't save to all states file"; - int numStates = rewindStates(1000) + 1; + uInt32 curIdx = getCurrentIdx(); + rewindStates(1000); + uInt32 numStates = uInt32(cyclesList().size()); + // Save header buf.str(""); out.putString(STATE_HEADER); @@ -245,7 +248,7 @@ string RewindManager::saveAllStates() out.putInt(myStateSize); unique_ptr buffer = make_unique(myStateSize); - for (int i = 0; i < numStates; i++) + for (uInt32 i = 0; i < numStates; i++) { RewindState& state = myStateList.current(); Serializer& s = state.data; @@ -260,6 +263,8 @@ string RewindManager::saveAllStates() if (i < numStates) unwindStates(1); } + // restore old state position + rewindStates(numStates - curIdx); buf.str(""); buf << "Saved " << numStates << " states"; @@ -287,7 +292,7 @@ string RewindManager::loadAllStates() return "Can't load from all states file"; clear(); - int numStates; + uInt32 numStates; // Load header buf.str(""); @@ -298,7 +303,7 @@ string RewindManager::loadAllStates() myStateSize = in.getInt(); unique_ptr buffer = make_unique(myStateSize); - for (int i = 0; i < numStates; i++) + for (uInt32 i = 0; i < numStates; i++) { if (myStateList.full()) compressStates();