Changeset bcc29ca
- Timestamp:
- Aug 13, 2025, 8:24:42 AM (2 months ago)
- Branches:
- Candidate_v1.7.0, stable
- Children:
- 780bfa
- Parents:
- 1c355bf
- git-author:
- Frederik Heber <frederik.heber@…> (08/13/25 08:17:04)
- git-committer:
- Frederik Heber <frederik.heber@…> (08/13/25 08:24:42)
- Files:
-
- 3 added
- 5 edited
- 9 moved
-
doc/userguide/userguide.xml (modified) (1 diff)
-
src/Actions/ActionHistory.hpp (modified) (1 diff)
-
src/Actions/CommandAction/RedoAction.cpp (moved) (moved from src/Actions/RedoAction.cpp ) (1 diff)
-
src/Actions/CommandAction/RedoAction.def (moved) (moved from src/Actions/RedoAction.def )
-
src/Actions/CommandAction/RedoAction.hpp (moved) (moved from src/Actions/RedoAction.hpp )
-
src/Actions/CommandAction/SetUndoMarkAction.cpp (moved) (moved from src/Actions/CommandAction/UndoMarkAction.cpp ) (5 diffs)
-
src/Actions/CommandAction/SetUndoMarkAction.def (moved) (moved from src/Actions/CommandAction/UndoMarkAction.def ) (3 diffs)
-
src/Actions/CommandAction/SetUndoMarkAction.hpp (moved) (moved from src/Actions/CommandAction/UndoMarkAction.hpp ) (3 diffs)
-
src/Actions/CommandAction/UndoAction.cpp (moved) (moved from src/Actions/UndoAction.cpp ) (2 diffs)
-
src/Actions/CommandAction/UndoAction.def (moved) (moved from src/Actions/UndoAction.def ) (2 diffs)
-
src/Actions/CommandAction/UndoAction.hpp (moved) (moved from src/Actions/UndoAction.hpp )
-
src/Actions/CommandAction/UndoTillMarkAction.cpp (added)
-
src/Actions/CommandAction/UndoTillMarkAction.def (added)
-
src/Actions/CommandAction/UndoTillMarkAction.hpp (added)
-
src/Actions/GlobalListOfActions.hpp (modified) (3 diffs)
-
src/Actions/Makefile.am (modified) (4 diffs)
-
tests/regression/Options/UndoMark/testsuite-options-undo-mark.at (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
doc/userguide/userguide.xml
r1c355bf rbcc29ca 429 429 <para>Furthermore, a specific event in the history of actions can be 430 430 marked using 431 <programlisting>... --add-atom H --domain-position "0,0,0" -- undo-mark--select-all-atoms --remove-atom</programlisting>432 Using this mark (that is unset by <programlisting>-- undo-mark 0</programlisting>)431 <programlisting>... --add-atom H --domain-position "0,0,0" --set-undo-mark 1 --select-all-atoms --remove-atom</programlisting> 432 Using this mark (that is unset by <programlisting>--set-undo-mark 0</programlisting>) 433 433 one can then step directly back to that event by undoing all actions in between 434 434 the current and the marked event. 435 <programlisting>--undo --till-mark 1</programlisting>435 <programlisting>--undo-till-mark</programlisting> 436 436 Here, this will jump back to when the hydrogen atom was just added. 437 437 This function is required as not all actions produce an event in the Action -
src/Actions/ActionHistory.hpp
r1c355bf rbcc29ca 18 18 19 19 #include "Actions/Action.hpp" 20 #include "Actions/ RedoAction.hpp"21 #include "Actions/ UndoAction.hpp"20 #include "Actions/CommandAction/RedoAction.hpp" 21 #include "Actions/CommandAction/UndoAction.hpp" 22 22 23 23 namespace MoleCuilder { -
src/Actions/CommandAction/RedoAction.cpp
r1c355bf rbcc29ca 44 44 using namespace MoleCuilder; 45 45 46 #include "Actions/ RedoAction.hpp"46 #include "Actions/CommandAction/RedoAction.hpp" 47 47 48 48 // and construct the stuff -
src/Actions/CommandAction/SetUndoMarkAction.cpp
r1c355bf rbcc29ca 2 2 * Project: MoleCuilder 3 3 * Description: creates and alters molecular systems 4 * Copyright (C) 202 1Frederik Heber. All rights reserved.4 * Copyright (C) 2025 Frederik Heber. All rights reserved. 5 5 * 6 6 * … … 22 22 23 23 /* 24 * UndoMarkAction.cpp24 * SetUndoMarkAction.cpp 25 25 * 26 26 * Created on: Apr 06, 2021 … … 35 35 //#include "CodePatterns/MemDebug.hpp" 36 36 37 #include "Actions/CommandAction/ UndoMarkAction.hpp"37 #include "Actions/CommandAction/SetUndoMarkAction.hpp" 38 38 39 39 #include "Actions/ActionQueue.hpp" … … 42 42 43 43 // and construct the stuff 44 #include " UndoMarkAction.def"44 #include "SetUndoMarkAction.def" 45 45 #include "Action_impl_pre.hpp" 46 46 /** =========== define the function ====================== */ 47 ActionState::ptr Command UndoMarkAction::performCall() {47 ActionState::ptr CommandSetUndoMarkAction::performCall() { 48 48 // set ActionQueue on to last element (hence skipping all in between) 49 49 … … 59 59 } 60 60 61 ActionState::ptr Command UndoMarkAction::performUndo(ActionState::ptr _state) {61 ActionState::ptr CommandSetUndoMarkAction::performUndo(ActionState::ptr _state) { 62 62 return Action::success; 63 63 } 64 64 65 ActionState::ptr Command UndoMarkAction::performRedo(ActionState::ptr _state){65 ActionState::ptr CommandSetUndoMarkAction::performRedo(ActionState::ptr _state){ 66 66 return Action::success; 67 67 } 68 68 69 bool Command UndoMarkAction::canUndo() {69 bool CommandSetUndoMarkAction::canUndo() { 70 70 return false; 71 71 } 72 72 73 bool Command UndoMarkAction::shouldUndo() {73 bool CommandSetUndoMarkAction::shouldUndo() { 74 74 return false; 75 75 } -
src/Actions/CommandAction/SetUndoMarkAction.def
r1c355bf rbcc29ca 1 1 /* 2 * UndoMarkAction.def2 * SetUndoMarkAction.def 3 3 * 4 4 * Created on: Apr 06, 2021 … … 14 14 // "undefine" if no parameters are required, use (NOPARAM_DEFAULT) for each (undefined) default value 15 15 #define paramtypes (bool) 16 #define paramtokens (" undo-mark")16 #define paramtokens ("set-undo-mark") 17 17 #define paramdescriptions ("whether to set (true) the undo mark or reset (false)") 18 18 #undef paramdefaults … … 27 27 #define MENUNAME "command" 28 28 #define MENUPOSITION 8 29 #define ACTIONNAME UndoMark30 #define TOKEN " undo-mark"29 #define ACTIONNAME SetUndoMark 30 #define TOKEN "set-undo-mark" 31 31 32 32 -
src/Actions/CommandAction/SetUndoMarkAction.hpp
r1c355bf rbcc29ca 1 1 /* 2 * UndoMarkAction.hpp2 * SetUndoMarkAction.hpp 3 3 * 4 4 * Created on: Apr 06, 2021 … … 6 6 */ 7 7 8 #ifndef UNDOMARKACTION_HPP_9 #define UNDOMARKACTION_HPP_8 #ifndef SETUNDOMARKACTION_HPP_ 9 #define SETUNDOMARKACTION_HPP_ 10 10 11 11 // include config.h … … 17 17 #include "Actions/Action.hpp" 18 18 19 #include " UndoMarkAction.def"19 #include "SetUndoMarkAction.def" 20 20 #include "Action_impl_header.hpp" 21 21 22 #endif /* UNDOMARKACTION_HPP_ */22 #endif /* SETUNDOMARKACTION_HPP_ */ -
src/Actions/CommandAction/UndoAction.cpp
r1c355bf rbcc29ca 43 43 using namespace MoleCuilder; 44 44 45 #include "Actions/ UndoAction.hpp"45 #include "Actions/CommandAction/UndoAction.hpp" 46 46 47 47 // and construct the stuff … … 52 52 ActionState::ptr UndoAction::performCall(){ 53 53 // std::cout << "Undo" << std::endl; 54 if (params.undoTillMark.get()) 55 ActionQueue::getInstance().undoTillMark(); 56 else 57 ActionQueue::getInstance().undoLast(); 54 ActionQueue::getInstance().undoLast(); 58 55 return Action::success; 59 56 } -
src/Actions/CommandAction/UndoAction.def
r1c355bf rbcc29ca 13 13 // ValueStorage by the token "Z" -> first column: int, Z, "Z" 14 14 // "undefine" if no parameters are required, use (NOPARAM_DEFAULT) for each (undefined) default value 15 #define paramtypes (bool) 16 #define paramtokens ("till-mark") 17 #define paramdescriptions ("whether to undo just a single step (false) or until a previously set mark (true)") 18 #define paramdefaults (PARAM_DEFAULT(false)) 19 #define paramreferences (undoTillMark) 20 #define paramvalids (DummyValidator<bool>()) 15 #undef paramtypes 16 #undef paramreferences 17 #undef paramtokens 18 #undef paramdescriptions 19 #undef paramdefaults 21 20 22 21 // some defines for all the names, you may use ACTION, STATE and PARAMS … … 28 27 29 28 // finally the information stored in the ActionTrait specialization 30 #define DESCRIPTION "undo last action or until a given mark"29 #define DESCRIPTION "undo last action" 31 30 #undef SHORTFORM -
src/Actions/GlobalListOfActions.hpp
r1c355bf rbcc29ca 21 21 // NOTE that Redo must remain at the front due to technical reasons 22 22 #define GLOBALLISTOFACTIONS_initial \ 23 (Redo) \24 23 (AnalysisAverageMoleculeForce) \ 25 24 (AnalysisDipoleAngularCorrelation) \ … … 53 52 (CommandSetRandomNumbersEngine) \ 54 53 (CommandSetRandomNumbersDistribution) \ 54 (CommandSetUndoMark) \ 55 55 (CommandStoreSession) \ 56 (CommandUndo Mark) \56 (CommandUndoTillMark) \ 57 57 (CommandVerbose) \ 58 58 (CommandVersion) \ … … 120 120 (ParserSetOutputFormats) \ 121 121 (ParserSetTremoloAtomdata) \ 122 (Redo) \ 122 123 (Undo) \ 123 124 (SelectionAllAtoms) \ -
src/Actions/Makefile.am
r1c355bf rbcc29ca 206 206 Actions/CommandAction/HelpRedistributeAction.cpp \ 207 207 Actions/CommandAction/NoDryRunAction.cpp \ 208 Actions/CommandAction/RedoAction.cpp \ 209 Actions/CommandAction/SetUndoMarkAction.cpp \ 208 210 Actions/CommandAction/StoreSessionAction.cpp \ 209 Actions/CommandAction/UndoMarkAction.cpp \ 211 Actions/CommandAction/UndoAction.cpp \ 212 Actions/CommandAction/UndoTillMarkAction.cpp \ 210 213 Actions/CommandAction/VerboseAction.cpp \ 211 214 Actions/CommandAction/VersionAction.cpp \ … … 219 222 Actions/CommandAction/HelpRedistributeAction.hpp \ 220 223 Actions/CommandAction/NoDryRunAction.hpp \ 224 Actions/CommandAction/RedoAction.hpp \ 225 Actions/CommandAction/SetUndoMarkAction.hpp \ 221 226 Actions/CommandAction/StoreSessionAction.hpp \ 222 Actions/CommandAction/UndoMarkAction.hpp \ 227 Actions/CommandAction/UndoAction.hpp \ 228 Actions/CommandAction/UndoTillMarkAction.hpp \ 223 229 Actions/CommandAction/VerboseAction.hpp \ 224 230 Actions/CommandAction/VersionAction.hpp \ … … 232 238 Actions/CommandAction/HelpRedistributeAction.def \ 233 239 Actions/CommandAction/NoDryRunAction.def \ 240 Actions/CommandAction/RedoAction.def \ 241 Actions/CommandAction/SetUndoMarkAction.def \ 234 242 Actions/CommandAction/StoreSessionAction.def \ 235 Actions/CommandAction/UndoMarkAction.def \ 243 Actions/CommandAction/UndoAction.def \ 244 Actions/CommandAction/UndoTillMarkAction.def \ 236 245 Actions/CommandAction/VerboseAction.def \ 237 246 Actions/CommandAction/VersionAction.def \ … … 648 657 Actions/TesselationAction/NonConvexEnvelopeAction.def 649 658 650 UNDOACTIONSOURCE = \651 Actions/RedoAction.cpp \652 Actions/UndoAction.cpp653 UNDOACTIONHEADER = \654 Actions/RedoAction.hpp \655 Actions/UndoAction.hpp656 UNDOACTIONDEFS = \657 Actions/RedoAction.def \658 Actions/UndoAction.def659 659 660 660 -
tests/regression/Options/UndoMark/testsuite-options-undo-mark.at
r1c355bf rbcc29ca 22 22 23 23 # simple call 24 AT_CHECK([../../molecuilder -- undo-mark 1 --undo --till-mark 1], 0, [ignore], [ignore])24 AT_CHECK([../../molecuilder --set-undo-mark 1 --undo-till-mark], 0, [ignore], [ignore]) 25 25 26 26 # add an atom prior to undo-mark 27 AT_CHECK([../../molecuilder - -add-atom 1 --domain-position "5,5,5" --undo-mark 1 --undo --till-mark 1], 0, [stdout], [ignore])28 AT_CHECK([grep "Removing atom" stdout], 1, [ignore], [ignore])27 AT_CHECK([../../molecuilder -i test-simple-prior.conf --add-atom 1 --domain-position "5,5,5" --set-undo-mark 1 --undo-till-mark], 0, [stdout], [ignore]) 28 AT_CHECK([grep -c "ATOM" test-simple-prior.conf], 1, [ignore], [ignore]) 29 29 30 30 # add an atom after to undo-mark 31 AT_CHECK([../../molecuilder - -undo-mark 1 --add-atom 1 --domain-position "5,5,5" --undo --till-mark 1], 0, [stdout], [ignore])32 AT_CHECK([grep "Removing atom" stdout], 0, [ignore], [ignore])31 AT_CHECK([../../molecuilder -i test-simple-after.conf --set-undo-mark 1 --add-atom 1 --domain-position "5,5,5" --undo-till-mark], 0, [stdout], [ignore]) 32 AT_CHECK([grep -c "ATOM" test-simple-after.conf], 1, [ignore], [ignore]) 33 33 34 # add an atom prior to undo-mark 35 AT_CHECK([../../molecuilder - -undo-mark 0 --add-atom 1 --domain-position "5,5,5" --select-all-atoms --undo --till-mark 1], 0, [stdout], [ignore])36 AT_CHECK([grep "Removing atom" stdout], 1, [ignore], [ignore])34 # add an atom prior to undo-mark reset 35 AT_CHECK([../../molecuilder -i test-simple-prior-reset.conf --set-undo-mark 0 --add-atom 1 --domain-position "5,5,5" --select-all-atoms --undo-till-mark], 0, [stdout], [ignore]) 36 AT_CHECK([grep -c "ATOM" test-simple-prior-reset.conf], 1, [ignore], [ignore]) 37 37 38 38 # input file with added atom 39 AT_CHECK([../../molecuilder -- undo-mark 1 --input hydrogen.xyz --add-atom 1 --domain-position "5,5,5" --undo --till-mark 1--select-all-atoms], 0, [stdout], [ignore])39 AT_CHECK([../../molecuilder --set-undo-mark 1 --input hydrogen.xyz --add-atom 1 --domain-position "5,5,5" --undo-till-mark --select-all-atoms], 0, [stdout], [ignore]) 40 40 AT_CHECK([grep "0 atoms selected" stdout], 0, [ignore], [ignore]) 41 41 42 42 # input file with added atom 43 AT_CHECK([../../molecuilder --input hydrogen.xyz --add-atom 1 --domain-position "5,5,5" -- undo-mark 0 --undo --till-mark 0], 0, [stdout], [ignore])43 AT_CHECK([../../molecuilder --input hydrogen.xyz --add-atom 1 --domain-position "5,5,5" --set-undo-mark 0 --undo-till-mark], 0, [stdout], [ignore]) 44 44 AT_CHECK([grep "Resetting mark" stdout], 0, [ignore], [ignore]) 45 45
Note:
See TracChangeset
for help on using the changeset viewer.
