Changeset bcc29ca


Ignore:
Timestamp:
Aug 13, 2025, 8:24:42 AM (2 months ago)
Author:
Frederik Heber <frederik.heber@…>
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)
Message:

Splits off Undo mark actions.

  • Undo action has again no parameters (which is preferable to use in the GUI).
  • undo-mark is now alled set-undo-mark (with parameter telling whether to set or unset the mark).
  • undo-till-mark is now a separate action.
  • adapted userguide accordingly.
  • TESTS: adapted regression tests.
Files:
3 added
5 edited
9 moved

Legend:

Unmodified
Added
Removed
  • doc/userguide/userguide.xml

    r1c355bf rbcc29ca  
    429429        <para>Furthermore, a specific event in the history of actions can be
    430430        marked using
    431         <programlisting>... --add-atom H --domain-position &quot;0,0,0&quot; --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 &quot;0,0,0&quot; --set-undo-mark 1 --select-all-atoms --remove-atom</programlisting>
     432        Using this mark (that is unset by <programlisting>--set-undo-mark 0</programlisting>)
    433433        one can then step directly back to that event by undoing all actions in between
    434434        the current and the marked event.
    435         <programlisting>--undo --till-mark 1</programlisting>
     435        <programlisting>--undo-till-mark</programlisting>
    436436        Here, this will jump back to when the hydrogen atom was just added.
    437437        This function is required as not all actions produce an event in the Action
  • src/Actions/ActionHistory.hpp

    r1c355bf rbcc29ca  
    1818
    1919#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"
    2222
    2323namespace MoleCuilder {
  • src/Actions/CommandAction/RedoAction.cpp

    r1c355bf rbcc29ca  
    4444using namespace MoleCuilder;
    4545
    46 #include "Actions/RedoAction.hpp"
     46#include "Actions/CommandAction/RedoAction.hpp"
    4747
    4848// and construct the stuff
  • src/Actions/CommandAction/SetUndoMarkAction.cpp

    r1c355bf rbcc29ca  
    22 * Project: MoleCuilder
    33 * Description: creates and alters molecular systems
    4  * Copyright (C)  2021 Frederik Heber. All rights reserved.
     4 * Copyright (C)  2025 Frederik Heber. All rights reserved.
    55 *
    66 *
     
    2222
    2323/*
    24  * UndoMarkAction.cpp
     24 * SetUndoMarkAction.cpp
    2525 *
    2626 *  Created on: Apr 06, 2021
     
    3535//#include "CodePatterns/MemDebug.hpp"
    3636
    37 #include "Actions/CommandAction/UndoMarkAction.hpp"
     37#include "Actions/CommandAction/SetUndoMarkAction.hpp"
    3838
    3939#include "Actions/ActionQueue.hpp"
     
    4242
    4343// and construct the stuff
    44 #include "UndoMarkAction.def"
     44#include "SetUndoMarkAction.def"
    4545#include "Action_impl_pre.hpp"
    4646/** =========== define the function ====================== */
    47 ActionState::ptr CommandUndoMarkAction::performCall() {
     47ActionState::ptr CommandSetUndoMarkAction::performCall() {
    4848  // set ActionQueue on to last element (hence skipping all in between)
    4949
     
    5959}
    6060
    61 ActionState::ptr CommandUndoMarkAction::performUndo(ActionState::ptr _state) {
     61ActionState::ptr CommandSetUndoMarkAction::performUndo(ActionState::ptr _state) {
    6262  return Action::success;
    6363}
    6464
    65 ActionState::ptr CommandUndoMarkAction::performRedo(ActionState::ptr _state){
     65ActionState::ptr CommandSetUndoMarkAction::performRedo(ActionState::ptr _state){
    6666  return Action::success;
    6767}
    6868
    69 bool CommandUndoMarkAction::canUndo() {
     69bool CommandSetUndoMarkAction::canUndo() {
    7070  return false;
    7171}
    7272
    73 bool CommandUndoMarkAction::shouldUndo() {
     73bool CommandSetUndoMarkAction::shouldUndo() {
    7474  return false;
    7575}
  • src/Actions/CommandAction/SetUndoMarkAction.def

    r1c355bf rbcc29ca  
    11/*
    2  * UndoMarkAction.def
     2 * SetUndoMarkAction.def
    33 *
    44 *  Created on: Apr 06, 2021
     
    1414// "undefine" if no parameters are required, use (NOPARAM_DEFAULT) for each (undefined) default value
    1515#define paramtypes (bool)
    16 #define paramtokens ("undo-mark")
     16#define paramtokens ("set-undo-mark")
    1717#define paramdescriptions ("whether to set (true) the undo mark or reset (false)")
    1818#undef paramdefaults
     
    2727#define MENUNAME "command"
    2828#define MENUPOSITION 8
    29 #define ACTIONNAME UndoMark
    30 #define TOKEN "undo-mark"
     29#define ACTIONNAME SetUndoMark
     30#define TOKEN "set-undo-mark"
    3131
    3232
  • src/Actions/CommandAction/SetUndoMarkAction.hpp

    r1c355bf rbcc29ca  
    11/*
    2  * UndoMarkAction.hpp
     2 * SetUndoMarkAction.hpp
    33 *
    44 *  Created on: Apr 06, 2021
     
    66 */
    77
    8 #ifndef UNDOMARKACTION_HPP_
    9 #define UNDOMARKACTION_HPP_
     8#ifndef SETUNDOMARKACTION_HPP_
     9#define SETUNDOMARKACTION_HPP_
    1010
    1111// include config.h
     
    1717#include "Actions/Action.hpp"
    1818
    19 #include "UndoMarkAction.def"
     19#include "SetUndoMarkAction.def"
    2020#include "Action_impl_header.hpp"
    2121
    22 #endif /* UNDOMARKACTION_HPP_ */
     22#endif /* SETUNDOMARKACTION_HPP_ */
  • src/Actions/CommandAction/UndoAction.cpp

    r1c355bf rbcc29ca  
    4343using namespace MoleCuilder;
    4444
    45 #include "Actions/UndoAction.hpp"
     45#include "Actions/CommandAction/UndoAction.hpp"
    4646
    4747// and construct the stuff
     
    5252ActionState::ptr UndoAction::performCall(){
    5353  // std::cout << "Undo" << std::endl;
    54   if (params.undoTillMark.get())
    55     ActionQueue::getInstance().undoTillMark();
    56   else
    57     ActionQueue::getInstance().undoLast();
     54  ActionQueue::getInstance().undoLast();
    5855  return Action::success;
    5956}
  • src/Actions/CommandAction/UndoAction.def

    r1c355bf rbcc29ca  
    1313// ValueStorage by the token "Z" -> first column: int, Z, "Z"
    1414// "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
    2120
    2221// some defines for all the names, you may use ACTION, STATE and PARAMS
     
    2827
    2928// 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"
    3130#undef SHORTFORM
  • src/Actions/GlobalListOfActions.hpp

    r1c355bf rbcc29ca  
    2121// NOTE that Redo must remain at the front due to technical reasons
    2222#define GLOBALLISTOFACTIONS_initial \
    23   (Redo) \
    2423  (AnalysisAverageMoleculeForce) \
    2524  (AnalysisDipoleAngularCorrelation) \
     
    5352  (CommandSetRandomNumbersEngine) \
    5453  (CommandSetRandomNumbersDistribution) \
     54  (CommandSetUndoMark) \
    5555  (CommandStoreSession) \
    56   (CommandUndoMark) \
     56  (CommandUndoTillMark) \
    5757  (CommandVerbose) \
    5858  (CommandVersion) \
     
    120120  (ParserSetOutputFormats) \
    121121  (ParserSetTremoloAtomdata) \
     122  (Redo) \
    122123  (Undo) \
    123124  (SelectionAllAtoms) \
  • src/Actions/Makefile.am

    r1c355bf rbcc29ca  
    206206  Actions/CommandAction/HelpRedistributeAction.cpp \
    207207  Actions/CommandAction/NoDryRunAction.cpp \
     208  Actions/CommandAction/RedoAction.cpp \
     209  Actions/CommandAction/SetUndoMarkAction.cpp \
    208210  Actions/CommandAction/StoreSessionAction.cpp \
    209   Actions/CommandAction/UndoMarkAction.cpp \
     211  Actions/CommandAction/UndoAction.cpp \
     212  Actions/CommandAction/UndoTillMarkAction.cpp \
    210213  Actions/CommandAction/VerboseAction.cpp \
    211214  Actions/CommandAction/VersionAction.cpp \
     
    219222  Actions/CommandAction/HelpRedistributeAction.hpp \
    220223  Actions/CommandAction/NoDryRunAction.hpp \
     224  Actions/CommandAction/RedoAction.hpp \
     225  Actions/CommandAction/SetUndoMarkAction.hpp \
    221226  Actions/CommandAction/StoreSessionAction.hpp \
    222   Actions/CommandAction/UndoMarkAction.hpp \
     227  Actions/CommandAction/UndoAction.hpp \
     228  Actions/CommandAction/UndoTillMarkAction.hpp \
    223229  Actions/CommandAction/VerboseAction.hpp \
    224230  Actions/CommandAction/VersionAction.hpp \
     
    232238  Actions/CommandAction/HelpRedistributeAction.def \
    233239  Actions/CommandAction/NoDryRunAction.def \
     240  Actions/CommandAction/RedoAction.def \
     241  Actions/CommandAction/SetUndoMarkAction.def \
    234242  Actions/CommandAction/StoreSessionAction.def \
    235   Actions/CommandAction/UndoMarkAction.def \
     243  Actions/CommandAction/UndoAction.def \
     244  Actions/CommandAction/UndoTillMarkAction.def \
    236245  Actions/CommandAction/VerboseAction.def \
    237246  Actions/CommandAction/VersionAction.def \
     
    648657  Actions/TesselationAction/NonConvexEnvelopeAction.def
    649658
    650 UNDOACTIONSOURCE = \
    651   Actions/RedoAction.cpp \
    652   Actions/UndoAction.cpp
    653 UNDOACTIONHEADER = \
    654   Actions/RedoAction.hpp \
    655   Actions/UndoAction.hpp
    656 UNDOACTIONDEFS = \
    657   Actions/RedoAction.def \
    658   Actions/UndoAction.def
    659659
    660660
  • tests/regression/Options/UndoMark/testsuite-options-undo-mark.at

    r1c355bf rbcc29ca  
    2222
    2323# simple call
    24 AT_CHECK([../../molecuilder --undo-mark 1 --undo --till-mark 1], 0, [ignore], [ignore])
     24AT_CHECK([../../molecuilder --set-undo-mark 1 --undo-till-mark], 0, [ignore], [ignore])
    2525
    2626# 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])
     27AT_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])
     28AT_CHECK([grep -c "ATOM" test-simple-prior.conf], 1, [ignore], [ignore])
    2929
    3030# 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])
     31AT_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])
     32AT_CHECK([grep -c "ATOM" test-simple-after.conf], 1, [ignore], [ignore])
    3333
    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
     35AT_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])
     36AT_CHECK([grep -c "ATOM" test-simple-prior-reset.conf], 1, [ignore], [ignore])
    3737
    3838# 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])
     39AT_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])
    4040AT_CHECK([grep "0 atoms selected" stdout], 0, [ignore], [ignore])
    4141
    4242# 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])
     43AT_CHECK([../../molecuilder --input hydrogen.xyz --add-atom 1 --domain-position "5,5,5" --set-undo-mark 0 --undo-till-mark], 0, [stdout], [ignore])
    4444AT_CHECK([grep "Resetting mark" stdout], 0, [ignore], [ignore])
    4545
Note: See TracChangeset for help on using the changeset viewer.