Ignore:
Timestamp:
Aug 28, 2010, 12:57:56 AM (15 years ago)
Author:
Frederik Heber <heber@…>
Branches:
Action_Thermostats, Add_AtomRandomPerturbation, Add_FitFragmentPartialChargesAction, Add_RotateAroundBondAction, Add_SelectAtomByNameAction, Added_ParseSaveFragmentResults, AddingActions_SaveParseParticleParameters, Adding_Graph_to_ChangeBondActions, Adding_MD_integration_tests, Adding_ParticleName_to_Atom, Adding_StructOpt_integration_tests, AtomFragments, Automaking_mpqc_open, AutomationFragmentation_failures, Candidate_v1.5.4, Candidate_v1.6.0, Candidate_v1.6.1, ChangeBugEmailaddress, ChangingTestPorts, ChemicalSpaceEvaluator, CombiningParticlePotentialParsing, Combining_Subpackages, Debian_Package_split, Debian_package_split_molecuildergui_only, Disabling_MemDebug, Docu_Python_wait, EmpiricalPotential_contain_HomologyGraph, EmpiricalPotential_contain_HomologyGraph_documentation, Enable_parallel_make_install, Enhance_userguide, Enhanced_StructuralOptimization, Enhanced_StructuralOptimization_continued, Example_ManyWaysToTranslateAtom, Exclude_Hydrogens_annealWithBondGraph, FitPartialCharges_GlobalError, Fix_BoundInBox_CenterInBox_MoleculeActions, Fix_ChargeSampling_PBC, Fix_ChronosMutex, Fix_FitPartialCharges, Fix_FitPotential_needs_atomicnumbers, Fix_ForceAnnealing, Fix_IndependentFragmentGrids, Fix_ParseParticles, Fix_ParseParticles_split_forward_backward_Actions, Fix_PopActions, Fix_QtFragmentList_sorted_selection, Fix_Restrictedkeyset_FragmentMolecule, Fix_StatusMsg, Fix_StepWorldTime_single_argument, Fix_Verbose_Codepatterns, Fix_fitting_potentials, Fixes, ForceAnnealing_goodresults, ForceAnnealing_oldresults, ForceAnnealing_tocheck, ForceAnnealing_with_BondGraph, ForceAnnealing_with_BondGraph_continued, ForceAnnealing_with_BondGraph_continued_betteresults, ForceAnnealing_with_BondGraph_contraction-expansion, FragmentAction_writes_AtomFragments, FragmentMolecule_checks_bonddegrees, GeometryObjects, Gui_Fixes, Gui_displays_atomic_force_velocity, ImplicitCharges, IndependentFragmentGrids, IndependentFragmentGrids_IndividualZeroInstances, IndependentFragmentGrids_IntegrationTest, IndependentFragmentGrids_Sole_NN_Calculation, JobMarket_RobustOnKillsSegFaults, JobMarket_StableWorkerPool, JobMarket_unresolvable_hostname_fix, MoreRobust_FragmentAutomation, ODR_violation_mpqc_open, PartialCharges_OrthogonalSummation, PdbParser_setsAtomName, PythonUI_with_named_parameters, QtGui_reactivate_TimeChanged_changes, Recreated_GuiChecks, Rewrite_FitPartialCharges, RotateToPrincipalAxisSystem_UndoRedo, SaturateAtoms_findBestMatching, SaturateAtoms_singleDegree, StoppableMakroAction, Subpackage_CodePatterns, Subpackage_JobMarket, Subpackage_LinearAlgebra, Subpackage_levmar, Subpackage_mpqc_open, Subpackage_vmg, Switchable_LogView, ThirdParty_MPQC_rebuilt_buildsystem, TrajectoryDependenant_MaxOrder, TremoloParser_IncreasedPrecision, TremoloParser_MultipleTimesteps, TremoloParser_setsAtomName, Ubuntu_1604_changes, stable
Children:
966e12
Parents:
53d01c
git-author:
Frederik Heber <heber@…> (08/26/10 21:05:34)
git-committer:
Frederik Heber <heber@…> (08/28/10 00:57:56)
Message:

All Actions are converted to the new macro framework.

  • included all three values that have been used to create or convert the files
    • createdef.sh
    • createCpp.sh
    • createHeader.sh
Location:
src/Actions/SelectionAction
Files:
22 added
44 edited

Legend:

Unmodified
Added
Removed
  • src/Actions/SelectionAction/AllAtomsAction.cpp

    r53d01c r1fd675  
    2020#include "Helpers/MemDebug.hpp"
    2121
    22 #include "Actions/SelectionAction/AllAtomsAction.hpp"
    23 #include "Actions/ActionRegistry.hpp"
    2422#include "Descriptors/AtomDescriptor.hpp"
    2523#include "atom.hpp"
     
    3331using namespace std;
    3432
    35 #include "UIElements/UIFactory.hpp"
    36 #include "UIElements/Dialog.hpp"
    37 #include "Actions/ValueStorage.hpp"
     33#include "Actions/SelectionAction/AllAtomsAction.hpp"
    3834
     35// and construct the stuff
     36#include "AllAtomsAction.def"
     37#include "Action_impl_pre.hpp"
     38/** =========== define the function ====================== */
     39Action::state_ptr SelectionAllAtomsAction::performCall() {
     40  // obtain information
     41  getParametersfromValueStorage();
    3942
    40 // memento to remember the state when undoing
    41 
    42 class SelectionAllAtomsState : public ActionState {
    43 public:
    44   SelectionAllAtomsState(std::vector<atom*> _selectedAtoms) :
    45     selectedAtoms(_selectedAtoms)
    46   {}
    47   std::vector<atom*> selectedAtoms;
    48 };
    49 
    50 const char SelectionAllAtomsAction::NAME[] = "select-all-atoms";
    51 
    52 SelectionAllAtomsAction::SelectionAllAtomsAction() :
    53   Action(NAME)
    54 {}
    55 
    56 SelectionAllAtomsAction::~SelectionAllAtomsAction()
    57 {}
    58 
    59 void SelectionAllAtoms() {
    60   ActionRegistry::getInstance().getActionByName(SelectionAllAtomsAction::NAME)->call(Action::NonInteractive);
    61 };
    62 
    63 void SelectionAllAtomsAction::getParametersfromValueStorage()
    64 {};
    65 
    66 Dialog* SelectionAllAtomsAction::fillDialog(Dialog *dialog) {
    67   ASSERT(dialog,"No Dialog given when filling action dialog");
    68 
    69   dialog->queryEmpty(NAME, ValueStorage::getInstance().getDescription(NAME));
    70 
    71   return dialog;
    72 }
    73 
    74 Action::state_ptr SelectionAllAtomsAction::performCall() {
    7543  std::vector<atom *> selectedAtoms = World::getInstance().getSelectedAtoms();
    7644  DoLog(1) && (Log() << Verbose(1) << "Selecting all atoms." << endl);
    7745  World::getInstance().selectAllAtoms(AllAtoms());
    78   return Action::state_ptr(new SelectionAllAtomsState(selectedAtoms));
     46  return Action::state_ptr(new SelectionAllAtomsState(selectedAtoms,params));
    7947}
    8048
     
    8654    World::getInstance().selectAtom(*iter);
    8755
    88   return Action::state_ptr(new SelectionAllAtomsState(state->selectedAtoms));
     56  return Action::state_ptr(_state);
    8957}
    9058
    9159Action::state_ptr SelectionAllAtomsAction::performRedo(Action::state_ptr _state){
    92   SelectionAllAtomsState *state = assert_cast<SelectionAllAtomsState*>(_state.get());
     60  //SelectionAllAtomsState *state = assert_cast<SelectionAllAtomsState*>(_state.get());
    9361
    9462  World::getInstance().selectAllAtoms(AllAtoms());
    9563
    96   return Action::state_ptr(new SelectionAllAtomsState(state->selectedAtoms));
     64  return Action::state_ptr(_state);
    9765}
    9866
     
    10876  return NAME;
    10977}
     78/** =========== end of function ====================== */
  • src/Actions/SelectionAction/AllAtomsAction.hpp

    r53d01c r1fd675  
    1111#include "Actions/Action.hpp"
    1212
    13 void SelectionAllAtoms();
    14 
    15 class SelectionAllAtomsAction : public Action {
    16   friend void SelectionAllAtoms();
    17 
    18 public:
    19   SelectionAllAtomsAction();
    20   virtual ~SelectionAllAtomsAction();
    21 
    22   bool canUndo();
    23   bool shouldUndo();
    24 
    25   virtual const std::string getName();
    26 protected:
    27   virtual Dialog * fillDialog(Dialog *dialog);
    28 private:
    29   virtual void getParametersfromValueStorage();
    30   virtual Action::state_ptr performCall();
    31   virtual Action::state_ptr performUndo(Action::state_ptr);
    32   virtual Action::state_ptr performRedo(Action::state_ptr);
    33 
    34   static const char NAME[];
    35 };
     13#include "AllAtomsAction.def"
     14#include "Action_impl_header.hpp"
    3615
    3716#endif /* ALLATOMSACTION_HPP_ */
  • src/Actions/SelectionAction/AllAtomsInsideCuboidAction.cpp

    r53d01c r1fd675  
    2020#include "Helpers/MemDebug.hpp"
    2121
    22 #include "Actions/SelectionAction/AllAtomsInsideCuboidAction.hpp"
    23 #include "Actions/ActionRegistry.hpp"
    2422#include "Descriptors/AtomDescriptor.hpp"
    2523#include "Descriptors/AtomShapeDescriptor.hpp"
     
    3937using namespace std;
    4038
    41 #include "UIElements/UIFactory.hpp"
    42 #include "UIElements/Dialog.hpp"
    43 #include "Actions/ValueStorage.hpp"
     39#include "Actions/SelectionAction/AllAtomsInsideCuboidAction.hpp"
    4440
    45 
    46 // memento to remember the state when undoing
    47 
    48 class SelectionAllAtomsInsideCuboidState : public ActionState {
    49 public:
    50   SelectionAllAtomsInsideCuboidState(std::vector<atom*> _selectedAtoms, const Vector &_position, const Vector &_extension, const double _Xangle, const double _Yangle, const double _Zangle) :
    51     selectedAtoms(_selectedAtoms),
    52     position(_position),
    53     extension(_extension),
    54     Xangle(_Xangle),
    55     Yangle(_Yangle),
    56     Zangle(_Zangle)
    57   {}
    58   std::vector<atom*> selectedAtoms;
    59   Vector position;
    60   Vector extension;
    61   double Xangle;
    62   double Yangle;
    63   double Zangle;
    64 };
    65 
    66 const char SelectionAllAtomsInsideCuboidAction::NAME[] = "select-atoms-inside-cuboid";
    67 
    68 SelectionAllAtomsInsideCuboidAction::SelectionAllAtomsInsideCuboidAction() :
    69   Action(NAME)
    70 {}
    71 
    72 SelectionAllAtomsInsideCuboidAction::~SelectionAllAtomsInsideCuboidAction()
    73 {}
    74 
    75 void SelectionAllAtomsInsideCuboid(const Vector &position, const Vector &extension) {
    76   ValueStorage::getInstance().setCurrentValue(SelectionAllAtomsInsideCuboidAction::NAME, extension);
    77   ValueStorage::getInstance().setCurrentValue("position", position);
    78   ActionRegistry::getInstance().getActionByName(SelectionAllAtomsInsideCuboidAction::NAME)->call(Action::NonInteractive);
    79 };
    80 
    81 void SelectionAllAtomsInsideCuboid(const Vector &position, const Vector &extension, const double Xangle, const double Yangle, const double Zangle) {
    82   ValueStorage::getInstance().setCurrentValue(SelectionAllAtomsInsideCuboidAction::NAME, extension);
    83   ValueStorage::getInstance().setCurrentValue("position", position);
    84   ValueStorage::getInstance().setCurrentValue("angle-x", Xangle);
    85   ValueStorage::getInstance().setCurrentValue("angle-y", Yangle);
    86   ValueStorage::getInstance().setCurrentValue("angle-z", Zangle);
    87   ActionRegistry::getInstance().getActionByName(SelectionAllAtomsInsideCuboidAction::NAME)->call(Action::NonInteractive);
    88 };
    89 
    90 void SelectionAllAtomsInsideCuboidAction::getParametersfromValueStorage()
    91 {};
    92 
    93 Dialog* SelectionAllAtomsInsideCuboidAction::fillDialog(Dialog *dialog) {
    94   ASSERT(dialog,"No Dialog given when filling action dialog");
    95 
    96   dialog->queryVector(NAME, false, ValueStorage::getInstance().getDescription(NAME));
    97   dialog->queryVector("position", false, ValueStorage::getInstance().getDescription("position"));
    98 
    99   return dialog;
    100 }
    101 
     41// and construct the stuff
     42#include "AllAtomsInsideCuboidAction.def"
     43#include "Action_impl_pre.hpp"
     44/** =========== define the function ====================== */
    10245Action::state_ptr SelectionAllAtomsInsideCuboidAction::performCall() {
    10346  std::vector<atom *> selectedAtoms = World::getInstance().getSelectedAtoms();
    104   Vector position;
    105   Vector extension;
    106   double Xangle = 0.;
    107   double Yangle = 0.;
    108   double Zangle = 0.;
    10947  Matrix RotationMatrix;
    11048
    111   ValueStorage::getInstance().queryCurrentValue("position", position);
    112   ValueStorage::getInstance().queryCurrentValue(NAME, extension);
    113   // check whether a rotation is given.
    114   if (ValueStorage::getInstance().queryCurrentValue("angle-x", Xangle, true))
    115     Xangle = 0.;
    116   if (ValueStorage::getInstance().queryCurrentValue("angle-y", Yangle, true))
    117     Yangle = 0.;
    118   if (ValueStorage::getInstance().queryCurrentValue("angle-z", Zangle, true))
    119     Zangle = 0.;
    120   RotationMatrix.rotation(Xangle, Yangle, Zangle);
     49  // obtain information
     50  getParametersfromValueStorage();
    12151
    122   DoLog(1) && (Log() << Verbose(1) << "Selecting all atoms inside a rotated " << RotationMatrix << " cuboid at " << position << " and extension of " << extension << "." << endl);
    123   Shape s = translate(transform(stretch(Cuboid(),extension),RotationMatrix),position);
     52  RotationMatrix.rotation(params.Xangle, params.Yangle, params.Zangle);
     53
     54  DoLog(1) && (Log() << Verbose(1) << "Selecting all atoms inside a rotated " << RotationMatrix << " cuboid at " << params.position << " and extension of " << params.extension << "." << endl);
     55  Shape s = translate(transform(stretch(Cuboid(),params.extension),RotationMatrix),params.position);
    12456  World::getInstance().selectAllAtoms(AtomByShape(s));
    125   return Action::state_ptr(new SelectionAllAtomsInsideCuboidState(selectedAtoms, position, extension, Xangle, Yangle, Zangle));
     57  return Action::state_ptr(new SelectionAllAtomsInsideCuboidState(selectedAtoms, params));
    12658}
    12759
     
    14072  Matrix RotationMatrix;
    14173
    142   RotationMatrix.rotation(state->Xangle, state->Yangle, state->Zangle);
    143   Shape s = translate(transform(stretch(Cuboid(),state->extension),RotationMatrix),state->position);
     74  RotationMatrix.rotation(state->params.Xangle, state->params.Yangle, state->params.Zangle);
     75  Shape s = translate(transform(stretch(Cuboid(),state->params.extension),RotationMatrix),state->params.position);
    14476  World::getInstance().selectAllAtoms(AtomByShape(s));
    14577
     
    15890  return NAME;
    15991}
     92/** =========== end of function ====================== */
  • src/Actions/SelectionAction/AllAtomsInsideCuboidAction.hpp

    r53d01c r1fd675  
    1111#include "Actions/Action.hpp"
    1212
    13 class Vector;
    14 
    15 void SelectionAllAtomsInsideCuboid();
    16 
    17 class SelectionAllAtomsInsideCuboidAction : public Action {
    18   friend void SelectionAllAtomsInsideCuboid(const Vector &position, const Vector &extension);
    19   friend void SelectionAllAtomsInsideCuboid(const Vector &position, const Vector &extension, const double Xangle, const double Yangle, const double Zangle);
    20 
    21 public:
    22   SelectionAllAtomsInsideCuboidAction();
    23   virtual ~SelectionAllAtomsInsideCuboidAction();
    24 
    25   bool canUndo();
    26   bool shouldUndo();
    27 
    28   virtual const std::string getName();
    29 protected:
    30   virtual Dialog * fillDialog(Dialog *dialog);
    31 private:
    32   virtual void getParametersfromValueStorage();
    33   virtual Action::state_ptr performCall();
    34   virtual Action::state_ptr performUndo(Action::state_ptr);
    35   virtual Action::state_ptr performRedo(Action::state_ptr);
    36 
    37   static const char NAME[];
    38 };
     13#include "AllAtomsInsideCuboidAction.def"
     14#include "Action_impl_header.hpp"
    3915
    4016#endif /* ALLATOMSINSIDECUBOIDACTION_HPP_ */
  • src/Actions/SelectionAction/AllAtomsInsideSphereAction.cpp

    r53d01c r1fd675  
    2020#include "Helpers/MemDebug.hpp"
    2121
    22 #include "Actions/SelectionAction/AllAtomsInsideSphereAction.hpp"
    23 #include "Actions/ActionRegistry.hpp"
    2422#include "Descriptors/AtomDescriptor.hpp"
    2523#include "Descriptors/AtomShapeDescriptor.hpp"
     
    3836using namespace std;
    3937
    40 #include "UIElements/UIFactory.hpp"
    41 #include "UIElements/Dialog.hpp"
    42 #include "Actions/ValueStorage.hpp"
     38#include "Actions/SelectionAction/AllAtomsInsideSphereAction.hpp"
    4339
    44 
    45 // memento to remember the state when undoing
    46 
    47 class SelectionAllAtomsInsideSphereState : public ActionState {
    48 public:
    49   SelectionAllAtomsInsideSphereState(std::vector<atom*> _selectedAtoms, const Vector &_position, const double _radius) :
    50     selectedAtoms(_selectedAtoms),
    51     position(_position),
    52     radius(_radius)
    53   {}
    54   std::vector<atom*> selectedAtoms;
    55   Vector position;
    56   double radius;
    57 };
    58 
    59 const char SelectionAllAtomsInsideSphereAction::NAME[] = "select-atoms-inside-sphere";
    60 
    61 SelectionAllAtomsInsideSphereAction::SelectionAllAtomsInsideSphereAction() :
    62   Action(NAME)
    63 {}
    64 
    65 SelectionAllAtomsInsideSphereAction::~SelectionAllAtomsInsideSphereAction()
    66 {}
    67 
    68 void SelectionAllAtomsInsideSphere(const Vector &position, const double radius) {
    69   ValueStorage::getInstance().setCurrentValue(SelectionAllAtomsInsideSphereAction::NAME, radius);
    70   ValueStorage::getInstance().setCurrentValue("position", position);
    71   ActionRegistry::getInstance().getActionByName(SelectionAllAtomsInsideSphereAction::NAME)->call(Action::NonInteractive);
    72 };
    73 
    74 void SelectionAllAtomsInsideSphereAction::getParametersfromValueStorage()
    75 {};
    76 
    77 Dialog* SelectionAllAtomsInsideSphereAction::fillDialog(Dialog *dialog) {
    78   ASSERT(dialog,"No Dialog given when filling action dialog");
    79 
    80   dialog->queryDouble(NAME, ValueStorage::getInstance().getDescription(NAME));
    81   dialog->queryVector("position", false, ValueStorage::getInstance().getDescription("position"));
    82 
    83   return dialog;
    84 }
    85 
     40// and construct the stuff
     41#include "AllAtomsInsideSphereAction.def"
     42#include "Action_impl_pre.hpp"
     43/** =========== define the function ====================== */
    8644Action::state_ptr SelectionAllAtomsInsideSphereAction::performCall() {
    8745  std::vector<atom *> selectedAtoms = World::getInstance().getSelectedAtoms();
    88   double radius = 0.;
    89   Vector position;
    9046
    91   ValueStorage::getInstance().queryCurrentValue(NAME, radius);
    92   ValueStorage::getInstance().queryCurrentValue("position", position);
     47  // obtain information
     48  getParametersfromValueStorage();
    9349
    94   DoLog(1) && (Log() << Verbose(1) << "Selecting all atoms inside a sphere at " << position << " with radius " << radius << "." << endl);
    95   Shape s = translate(resize(Sphere(),radius),position);
     50  DoLog(1) && (Log() << Verbose(1) << "Selecting all atoms inside a sphere at " << params.position << " with radius " << params.radius << "." << endl);
     51  Shape s = translate(resize(Sphere(),params.radius),params.position);
    9652  World::getInstance().selectAllAtoms(AtomByShape(s));
    97   return Action::state_ptr(new SelectionAllAtomsInsideSphereState(selectedAtoms, position, radius));
     53  return Action::state_ptr(new SelectionAllAtomsInsideSphereState(selectedAtoms, params));
    9854}
    9955
     
    10561    World::getInstance().selectAtom(*iter);
    10662
    107   return Action::state_ptr(new SelectionAllAtomsInsideSphereState(state->selectedAtoms, state->position, state->radius));
     63  return Action::state_ptr(_state);
    10864}
    10965
     
    11167  SelectionAllAtomsInsideSphereState *state = assert_cast<SelectionAllAtomsInsideSphereState*>(_state.get());
    11268
    113   Shape s = translate(resize(Sphere(),state->radius),state->position);
     69  Shape s = translate(resize(Sphere(),state->params.radius),state->params.position);
    11470  World::getInstance().selectAllAtoms(AtomByShape(s));
    11571
    116   return Action::state_ptr(new SelectionAllAtomsInsideSphereState(state->selectedAtoms, state->position, state->radius));
     72  return Action::state_ptr(_state);
    11773}
    11874
     
    12884  return NAME;
    12985}
     86/** =========== end of function ====================== */
  • src/Actions/SelectionAction/AllAtomsInsideSphereAction.hpp

    r53d01c r1fd675  
    1111#include "Actions/Action.hpp"
    1212
    13 class Vector;
    14 
    15 void SelectionAllAtomsInsideSphere();
    16 
    17 class SelectionAllAtomsInsideSphereAction : public Action {
    18   friend void SelectionAllAtomsInsideSphere(const Vector &position, const double radius);
    19 
    20 public:
    21   SelectionAllAtomsInsideSphereAction();
    22   virtual ~SelectionAllAtomsInsideSphereAction();
    23 
    24   bool canUndo();
    25   bool shouldUndo();
    26 
    27   virtual const std::string getName();
    28 protected:
    29   virtual Dialog * fillDialog(Dialog *dialog);
    30 private:
    31   virtual void getParametersfromValueStorage();
    32   virtual Action::state_ptr performCall();
    33   virtual Action::state_ptr performUndo(Action::state_ptr);
    34   virtual Action::state_ptr performRedo(Action::state_ptr);
    35 
    36   static const char NAME[];
    37 };
     13#include "AllAtomsInsideSphereAction.def"
     14#include "Action_impl_header.hpp"
    3815
    3916#endif /* ALLATOMSINSIDESPHEREACTION_HPP_ */
  • src/Actions/SelectionAction/AllAtomsOfMoleculeAction.cpp

    r53d01c r1fd675  
    2020#include "Helpers/MemDebug.hpp"
    2121
    22 #include "Actions/SelectionAction/AllAtomsOfMoleculeAction.hpp"
    23 #include "Actions/ActionRegistry.hpp"
    2422#include "Descriptors/AtomDescriptor.hpp"
    2523#include "atom.hpp"
     
    3432using namespace std;
    3533
    36 #include "UIElements/UIFactory.hpp"
    37 #include "UIElements/Dialog.hpp"
    38 #include "Actions/ValueStorage.hpp"
     34#include "Actions/SelectionAction/AllAtomsOfMoleculeAction.hpp"
    3935
    40 
    41 // memento to remember the state when undoing
    42 
    43 class SelectionAllAtomsOfMoleculeState : public ActionState {
    44 public:
    45   SelectionAllAtomsOfMoleculeState(std::vector<atom*> _selectedAtoms, molecule *_mol) :
    46     selectedAtoms(_selectedAtoms),
    47     mol(_mol)
    48   {}
    49   std::vector<atom*> selectedAtoms;
    50   molecule *mol;
    51 };
    52 
    53 const char SelectionAllAtomsOfMoleculeAction::NAME[] = "select-molecules-atoms";
    54 
    55 SelectionAllAtomsOfMoleculeAction::SelectionAllAtomsOfMoleculeAction() :
    56   Action(NAME)
    57 {}
    58 
    59 SelectionAllAtomsOfMoleculeAction::~SelectionAllAtomsOfMoleculeAction()
    60 {}
    61 
    62 void SelectionAllAtomsOfMolecule() {
    63   ActionRegistry::getInstance().getActionByName(SelectionAllAtomsOfMoleculeAction::NAME)->call(Action::NonInteractive);
    64 };
    65 
    66 void SelectionAllAtomsOfMoleculeAction::getParametersfromValueStorage()
    67 {};
    68 
    69 Dialog* SelectionAllAtomsOfMoleculeAction::fillDialog(Dialog *dialog) {
    70   ASSERT(dialog,"No Dialog given when filling action dialog");
    71 
    72   dialog->queryMolecule(NAME, ValueStorage::getInstance().getDescription(NAME));
    73 
    74   return dialog;
    75 }
    76 
     36// and construct the stuff
     37#include "AllAtomsOfMoleculeAction.def"
     38#include "Action_impl_pre.hpp"
     39/** =========== define the function ====================== */
    7740Action::state_ptr SelectionAllAtomsOfMoleculeAction::performCall() {
    78   molecule *mol = NULL;
    7941  std::vector<atom *> selectedAtoms = World::getInstance().getSelectedAtoms();
    8042
    81   ValueStorage::getInstance().queryCurrentValue(NAME, mol);
     43  // obtain information
     44  getParametersfromValueStorage();
    8245
    83   DoLog(1) && (Log() << Verbose(1) << "Selecting all atoms of molecule " << mol->getName() << "." << endl);
    84   World::getInstance().selectAtomsOfMolecule(mol);
    85   return Action::state_ptr(new SelectionAllAtomsOfMoleculeState(selectedAtoms, mol));
     46  DoLog(1) && (Log() << Verbose(1) << "Selecting all atoms of molecule " << params.mol->getName() << "." << endl);
     47  World::getInstance().selectAtomsOfMolecule(params.mol);
     48  return Action::state_ptr(new SelectionAllAtomsOfMoleculeState(selectedAtoms, params));
    8649}
    8750
     
    9356    World::getInstance().selectAtom(*iter);
    9457
    95   return Action::state_ptr(new SelectionAllAtomsOfMoleculeState(state->selectedAtoms, state->mol));
     58  return Action::state_ptr(_state);
    9659}
    9760
     
    9962  SelectionAllAtomsOfMoleculeState *state = assert_cast<SelectionAllAtomsOfMoleculeState*>(_state.get());
    10063
    101   World::getInstance().selectAtomsOfMolecule(state->mol);
     64  World::getInstance().selectAtomsOfMolecule(state->params.mol);
    10265
    103   return Action::state_ptr(new SelectionAllAtomsOfMoleculeState(state->selectedAtoms, state->mol));
     66  return Action::state_ptr(_state);
    10467}
    10568
     
    11578  return NAME;
    11679}
     80/** =========== end of function ====================== */
  • src/Actions/SelectionAction/AllAtomsOfMoleculeAction.hpp

    r53d01c r1fd675  
    1111#include "Actions/Action.hpp"
    1212
    13 void SelectionAllAtomsOfMolecule();
    14 
    15 class SelectionAllAtomsOfMoleculeAction : public Action {
    16   friend void SelectionAllAtomsOfMolecule();
    17 
    18 public:
    19   SelectionAllAtomsOfMoleculeAction();
    20   virtual ~SelectionAllAtomsOfMoleculeAction();
    21 
    22   bool canUndo();
    23   bool shouldUndo();
    24 
    25   virtual const std::string getName();
    26 protected:
    27   virtual Dialog * fillDialog(Dialog *dialog);
    28 private:
    29   virtual void getParametersfromValueStorage();
    30   virtual Action::state_ptr performCall();
    31   virtual Action::state_ptr performUndo(Action::state_ptr);
    32   virtual Action::state_ptr performRedo(Action::state_ptr);
    33 
    34   static const char NAME[];
    35 };
     13#include "AllAtomsOfMoleculeAction.def"
     14#include "Action_impl_header.hpp"
    3615
    3716#endif /* ALLATOMSOFMOLECULEACTION_HPP_ */
  • src/Actions/SelectionAction/AllMoleculesAction.cpp

    r53d01c r1fd675  
    2020#include "Helpers/MemDebug.hpp"
    2121
    22 #include "Actions/SelectionAction/AllMoleculesAction.hpp"
    23 #include "Actions/ActionRegistry.hpp"
    2422#include "Descriptors/MoleculeDescriptor.hpp"
    2523#include "atom.hpp"
     
    3331using namespace std;
    3432
    35 #include "UIElements/UIFactory.hpp"
    36 #include "UIElements/Dialog.hpp"
    37 #include "Actions/ValueStorage.hpp"
     33#include "Actions/SelectionAction/AllMoleculesAction.hpp"
    3834
     35// and construct the stuff
     36#include "AllMoleculesAction.def"
     37#include "Action_impl_pre.hpp"
     38/** =========== define the function ====================== */
     39Action::state_ptr SelectionAllMoleculesAction::performCall() {
     40  // obtain information
     41  getParametersfromValueStorage();
    3942
    40 // memento to remember the state when undoing
    41 
    42 class SelectionAllMoleculesState : public ActionState {
    43 public:
    44   SelectionAllMoleculesState(std::vector<molecule*> selectedMolecules) :
    45     selectedMolecules(selectedMolecules)
    46   {}
    47   std::vector<molecule*> selectedMolecules;
    48 };
    49 
    50 const char SelectionAllMoleculesAction::NAME[] = "select-all-molecules";
    51 
    52 SelectionAllMoleculesAction::SelectionAllMoleculesAction() :
    53   Action(NAME)
    54 {}
    55 
    56 SelectionAllMoleculesAction::~SelectionAllMoleculesAction()
    57 {}
    58 
    59 void SelectionAllMolecules() {
    60   ActionRegistry::getInstance().getActionByName(SelectionAllMoleculesAction::NAME)->call(Action::NonInteractive);
    61 };
    62 
    63 void SelectionAllMoleculesAction::getParametersfromValueStorage()
    64 {};
    65 
    66 Dialog* SelectionAllMoleculesAction::fillDialog(Dialog *dialog) {
    67   ASSERT(dialog,"No Dialog given when filling action dialog");
    68 
    69   dialog->queryEmpty(NAME, ValueStorage::getInstance().getDescription(NAME));
    70 
    71   return dialog;
    72 }
    73 
    74 Action::state_ptr SelectionAllMoleculesAction::performCall() {
    7543  std::vector<molecule *> selectedMolecules = World::getInstance().getSelectedMolecules();
    7644  DoLog(1) && (Log() << Verbose(1) << "Selecting all molecules." << endl);
    7745  World::getInstance().selectAllMolecules(AllMolecules());
    78   return Action::state_ptr(new SelectionAllMoleculesState(selectedMolecules));
     46  return Action::state_ptr(new SelectionAllMoleculesState(selectedMolecules,params));
    7947}
    8048
     
    8654    World::getInstance().selectMolecule(*iter);
    8755
    88   return Action::state_ptr(new SelectionAllMoleculesState(state->selectedMolecules));
     56  return Action::state_ptr(_state);
    8957}
    9058
    9159Action::state_ptr SelectionAllMoleculesAction::performRedo(Action::state_ptr _state){
    92   SelectionAllMoleculesState *state = assert_cast<SelectionAllMoleculesState*>(_state.get());
     60  //SelectionAllMoleculesState *state = assert_cast<SelectionAllMoleculesState*>(_state.get());
    9361
    9462  World::getInstance().selectAllMolecules(AllMolecules());
    9563
    96   return Action::state_ptr(new SelectionAllMoleculesState(state->selectedMolecules));
     64  return Action::state_ptr(_state);
    9765}
    9866
     
    10876  return NAME;
    10977}
     78/** =========== end of function ====================== */
  • src/Actions/SelectionAction/AllMoleculesAction.hpp

    r53d01c r1fd675  
    22 * AllMoleculesAction.hpp
    33 *
    4  *  Created on: May 12, 2010
     4 *  Created on: Aug 09, 2010
    55 *      Author: heber
    66 */
     
    99#define ALLMOLECULESSACTION_HPP_
    1010
     11
    1112#include "Actions/Action.hpp"
    1213
    13 void SelectionAllMolecules();
    14 
    15 class SelectionAllMoleculesAction : public Action {
    16   friend void SelectionAllMolecules();
    17 
    18 public:
    19   SelectionAllMoleculesAction();
    20   virtual ~SelectionAllMoleculesAction();
    21 
    22   bool canUndo();
    23   bool shouldUndo();
    24 
    25   virtual const std::string getName();
    26 protected:
    27   virtual Dialog * fillDialog(Dialog *dialog);
    28 private:
    29   virtual void getParametersfromValueStorage();
    30   virtual Action::state_ptr performCall();
    31   virtual Action::state_ptr performUndo(Action::state_ptr);
    32   virtual Action::state_ptr performRedo(Action::state_ptr);
    33 
    34   static const char NAME[];
    35 };
     14#include "AllMoleculesAction.def"
     15#include "Action_impl_header.hpp"
    3616
    3717#endif /* ALLMOLECULESSACTION_HPP_ */
  • src/Actions/SelectionAction/AtomByElementAction.cpp

    r53d01c r1fd675  
    2020#include "Helpers/MemDebug.hpp"
    2121
    22 #include "Actions/SelectionAction/AtomByElementAction.hpp"
    23 #include "Actions/ActionRegistry.hpp"
    2422#include "Descriptors/AtomTypeDescriptor.hpp"
    2523#include "atom.hpp"
     
    3432using namespace std;
    3533
    36 #include "UIElements/UIFactory.hpp"
    37 #include "UIElements/Dialog.hpp"
    38 #include "Actions/ValueStorage.hpp"
     34#include "Actions/SelectionAction/AtomByElementAction.hpp"
    3935
    40 
    41 // memento to remember the state when undoing
    42 
    43 class SelectionAtomByElementState : public ActionState {
    44 public:
    45   SelectionAtomByElementState(std::vector<atom*> _selectedAtoms, const element *_elemental) :
    46     selectedAtoms(_selectedAtoms),
    47     elemental(_elemental)
    48   {}
    49   std::vector<atom*> selectedAtoms;
    50   const element *elemental;
    51 };
    52 
    53 const char SelectionAtomByElementAction::NAME[] = "select-atom-by-element";
    54 
    55 SelectionAtomByElementAction::SelectionAtomByElementAction() :
    56   Action(NAME)
    57 {}
    58 
    59 SelectionAtomByElementAction::~SelectionAtomByElementAction()
    60 {}
    61 
    62 void SelectionAtomByElement(const element &_element) {
    63   ValueStorage::getInstance().setCurrentValue(SelectionAtomByElementAction::NAME, _element);
    64   ActionRegistry::getInstance().getActionByName(SelectionAtomByElementAction::NAME)->call(Action::NonInteractive);
    65 };
    66 
    67 void SelectionAtomByElementAction::getParametersfromValueStorage()
    68 {};
    69 
    70 Dialog* SelectionAtomByElementAction::fillDialog(Dialog *dialog) {
    71   ASSERT(dialog,"No Dialog given when filling action dialog");
    72 
    73   dialog->queryElement(NAME, ValueStorage::getInstance().getDescription(NAME));
    74 
    75   return dialog;
    76 }
    77 
     36// and construct the stuff
     37#include "AtomByElementAction.def"
     38#include "Action_impl_pre.hpp"
     39/** =========== define the function ====================== */
    7840Action::state_ptr SelectionAtomByElementAction::performCall() {
    79   const element *elemental;
    8041  std::vector<atom *> selectedAtoms = World::getInstance().getSelectedAtoms();
    8142
    82   ValueStorage::getInstance().queryCurrentValue(NAME, elemental);
     43  // obtain information
     44  getParametersfromValueStorage();
    8345
    84   DoLog(1) && (Log() << Verbose(1) << "Selecting atoms of type " << *elemental << endl);
    85   World::getInstance().selectAllAtoms(AtomByType(elemental));
    86   return Action::state_ptr(new SelectionAtomByElementState(selectedAtoms,elemental));
     46  DoLog(1) && (Log() << Verbose(1) << "Selecting atoms of type " << *params.elemental << endl);
     47  World::getInstance().selectAllAtoms(AtomByType(params.elemental));
     48  return Action::state_ptr(new SelectionAtomByElementState(selectedAtoms,params));
    8749}
    8850
     
    10062  SelectionAtomByElementState *state = assert_cast<SelectionAtomByElementState*>(_state.get());
    10163
    102   World::getInstance().selectAllAtoms(AtomByType(state->elemental));
     64  World::getInstance().selectAllAtoms(AtomByType(state->params.elemental));
    10365
    10466  return Action::state_ptr(_state);
     
    11678  return NAME;
    11779}
     80/** =========== end of function ====================== */
  • src/Actions/SelectionAction/AtomByElementAction.hpp

    r53d01c r1fd675  
    1111#include "Actions/Action.hpp"
    1212
    13 class element;
    14 
    15 void SelectionAtomByElement(const element &_element);
    16 
    17 class SelectionAtomByElementAction : public Action {
    18   friend void SelectionAtomByElement(const element &_element);
    19 
    20 public:
    21   SelectionAtomByElementAction();
    22   virtual ~SelectionAtomByElementAction();
    23 
    24   bool canUndo();
    25   bool shouldUndo();
    26 
    27   virtual const std::string getName();
    28 protected:
    29   virtual Dialog * fillDialog(Dialog *dialog);
    30 private:
    31   virtual void getParametersfromValueStorage();
    32   virtual Action::state_ptr performCall();
    33   virtual Action::state_ptr performUndo(Action::state_ptr);
    34   virtual Action::state_ptr performRedo(Action::state_ptr);
    35 
    36   static const char NAME[];
    37 };
     13#include "AtomByElementAction.def"
     14#include "Action_impl_header.hpp"
    3815
    3916#endif /* ATOMBYELEMENTACTION_HPP_ */
  • src/Actions/SelectionAction/AtomByIdAction.cpp

    r53d01c r1fd675  
    2020#include "Helpers/MemDebug.hpp"
    2121
    22 #include "Actions/SelectionAction/AtomByIdAction.hpp"
    23 #include "Actions/ActionRegistry.hpp"
    2422#include "atom.hpp"
    2523#include "Helpers/Log.hpp"
     
    3230using namespace std;
    3331
    34 #include "UIElements/UIFactory.hpp"
    35 #include "UIElements/Dialog.hpp"
    36 #include "Actions/ValueStorage.hpp"
     32#include "Actions/SelectionAction/AtomByIdAction.hpp"
    3733
     34// and construct the stuff
     35#include "AtomByIdAction.def"
     36#include "Action_impl_pre.hpp"
     37/** =========== define the function ====================== */
     38Action::state_ptr SelectionAtomByIdAction::performCall() {
     39  // obtain information
     40  getParametersfromValueStorage();
    3841
    39 // memento to remember the state when undoing
    40 
    41 class SelectionAtomByIdState : public ActionState {
    42 public:
    43   SelectionAtomByIdState(atom* _walker) :
    44     walker(_walker)
    45   {}
    46   atom* walker;
    47 };
    48 
    49 const char SelectionAtomByIdAction::NAME[] = "select-atom-by-id";
    50 
    51 SelectionAtomByIdAction::SelectionAtomByIdAction() :
    52   Action(NAME)
    53 {}
    54 
    55 SelectionAtomByIdAction::~SelectionAtomByIdAction()
    56 {}
    57 
    58 void SelectionAtomById(atom *_atom) {
    59   ValueStorage::getInstance().setCurrentValue(SelectionAtomByIdAction::NAME, _atom);
    60   ActionRegistry::getInstance().getActionByName(SelectionAtomByIdAction::NAME)->call(Action::NonInteractive);
    61 };
    62 
    63 void SelectionAtomByIdAction::getParametersfromValueStorage()
    64 {};
    65 
    66 Dialog* SelectionAtomByIdAction::fillDialog(Dialog *dialog) {
    67   ASSERT(dialog,"No Dialog given when filling action dialog");
    68 
    69   dialog->queryAtom(NAME, ValueStorage::getInstance().getDescription(NAME));
    70 
    71   return dialog;
    72 }
    73 
    74 Action::state_ptr SelectionAtomByIdAction::performCall() {
    75   atom *Walker = NULL;
    76 
    77   ValueStorage::getInstance().queryCurrentValue(NAME, Walker);
    78 
    79   if (!World::getInstance().isSelected(Walker)) {
    80     DoLog(1) && (Log() << Verbose(1) << "Selecting atom " << *Walker << endl);
    81     World::getInstance().selectAtom(Walker);
    82     return Action::state_ptr(new SelectionAtomByIdState(Walker));
     42  if (!World::getInstance().isSelected(params.Walker)) {
     43    DoLog(1) && (Log() << Verbose(1) << "Selecting atom " << *params.Walker << endl);
     44    World::getInstance().selectAtom(params.Walker);
     45    return Action::state_ptr(new SelectionAtomByIdState(params));
    8346  } else {
    8447    return Action::success;
     
    8952  SelectionAtomByIdState *state = assert_cast<SelectionAtomByIdState*>(_state.get());
    9053
    91   if (state->walker != NULL)
    92     World::getInstance().unselectAtom(state->walker);
     54  if (state->params.Walker != NULL)
     55    World::getInstance().unselectAtom(state->params.Walker);
    9356
    94   return Action::state_ptr(new SelectionAtomByIdState(state->walker));
     57  return Action::state_ptr(_state);
    9558}
    9659
     
    9861  SelectionAtomByIdState *state = assert_cast<SelectionAtomByIdState*>(_state.get());
    9962
    100   if (state->walker != NULL)
    101     World::getInstance().selectAtom(state->walker);
     63  if (state->params.Walker != NULL)
     64    World::getInstance().selectAtom(state->params.Walker);
    10265
    103   return Action::state_ptr(new SelectionAtomByIdState(state->walker));
     66  return Action::state_ptr(_state);
    10467}
    10568
     
    11578  return NAME;
    11679}
     80/** =========== end of function ====================== */
  • src/Actions/SelectionAction/AtomByIdAction.hpp

    r53d01c r1fd675  
    1111#include "Actions/Action.hpp"
    1212
    13 class atom;
    14 
    15 void SelectionAtomById(atom *_atom);
    16 
    17 class SelectionAtomByIdAction : public Action {
    18   friend void SelectionAtomById(atom *_atom);
    19 
    20 public:
    21   SelectionAtomByIdAction();
    22   virtual ~SelectionAtomByIdAction();
    23 
    24   bool canUndo();
    25   bool shouldUndo();
    26 
    27   virtual const std::string getName();
    28 protected:
    29   virtual Dialog * fillDialog(Dialog *dialog);
    30 private:
    31   virtual void getParametersfromValueStorage();
    32   virtual Action::state_ptr performCall();
    33   virtual Action::state_ptr performUndo(Action::state_ptr);
    34   virtual Action::state_ptr performRedo(Action::state_ptr);
    35 
    36   static const char NAME[];
    37 };
     13#include "AtomByIdAction.def"
     14#include "Action_impl_header.hpp"
    3815
    3916#endif /* ATOMBYIDACTION_HPP_ */
  • src/Actions/SelectionAction/ClearAllAtomsAction.cpp

    r53d01c r1fd675  
    2020#include "Helpers/MemDebug.hpp"
    2121
    22 #include "Actions/SelectionAction/ClearAllAtomsAction.hpp"
    23 #include "Actions/ActionRegistry.hpp"
    2422#include "Descriptors/AtomDescriptor.hpp"
    2523#include "atom.hpp"
     
    3331using namespace std;
    3432
    35 #include "UIElements/UIFactory.hpp"
    36 #include "UIElements/Dialog.hpp"
    37 #include "Actions/ValueStorage.hpp"
     33#include "Actions/SelectionAction/ClearAllAtomsAction.hpp"
    3834
     35// and construct the stuff
     36#include "ClearAllAtomsAction.def"
     37#include "Action_impl_pre.hpp"
     38/** =========== define the function ====================== */
     39Action::state_ptr SelectionClearAllAtomsAction::performCall() {
     40  // obtain information
     41  getParametersfromValueStorage();
    3942
    40 // memento to remember the state when undoing
    41 
    42 class SelectionClearAllAtomsState : public ActionState {
    43 public:
    44   SelectionClearAllAtomsState(std::vector<atom*> _selectedAtoms) :
    45     selectedAtoms(_selectedAtoms)
    46   {}
    47   std::vector<atom*> selectedAtoms;
    48 };
    49 
    50 const char SelectionClearAllAtomsAction::NAME[] = "clear-atom-selection";
    51 
    52 SelectionClearAllAtomsAction::SelectionClearAllAtomsAction() :
    53   Action(NAME)
    54 {}
    55 
    56 SelectionClearAllAtomsAction::~SelectionClearAllAtomsAction()
    57 {}
    58 
    59 void SelectionClearAllAtoms() {
    60   ActionRegistry::getInstance().getActionByName(SelectionClearAllAtomsAction::NAME)->call(Action::NonInteractive);
    61 };
    62 
    63 void SelectionClearAllAtomsAction::getParametersfromValueStorage()
    64 {};
    65 
    66 Dialog* SelectionClearAllAtomsAction::fillDialog(Dialog *dialog) {
    67   ASSERT(dialog,"No Dialog given when filling action dialog");
    68 
    69   dialog->queryEmpty(NAME, ValueStorage::getInstance().getDescription(NAME));
    70 
    71   return dialog;
    72 }
    73 
    74 Action::state_ptr SelectionClearAllAtomsAction::performCall() {
    7543  std::vector<atom *> selectedAtoms = World::getInstance().getSelectedAtoms();
    7644  DoLog(1) && (Log() << Verbose(1) << "Clearing atoms selection." << endl);
    7745  World::getInstance().clearAtomSelection();
    78   return Action::state_ptr(new SelectionClearAllAtomsState(selectedAtoms));
     46  return Action::state_ptr(new SelectionClearAllAtomsState(selectedAtoms, params));
    7947}
    8048
     
    8654    World::getInstance().selectAtom(*iter);
    8755
    88   return Action::state_ptr(new SelectionClearAllAtomsState(state->selectedAtoms));
     56  return Action::state_ptr(_state);
    8957}
    9058
    9159Action::state_ptr SelectionClearAllAtomsAction::performRedo(Action::state_ptr _state){
    92   SelectionClearAllAtomsState *state = assert_cast<SelectionClearAllAtomsState*>(_state.get());
     60  //SelectionClearAllAtomsState *state = assert_cast<SelectionClearAllAtomsState*>(_state.get());
    9361
    9462  World::getInstance().clearAtomSelection();
    9563
    96   return Action::state_ptr(new SelectionClearAllAtomsState(state->selectedAtoms));
     64  return Action::state_ptr(_state);
    9765}
    9866
     
    10876  return NAME;
    10977}
     78/** =========== end of function ====================== */
  • src/Actions/SelectionAction/ClearAllAtomsAction.hpp

    r53d01c r1fd675  
    1111#include "Actions/Action.hpp"
    1212
    13 void SelectionAllAtoms();
    14 
    15 class SelectionClearAllAtomsAction : public Action {
    16   friend void SelectionClearAllAtoms();
    17 
    18 public:
    19   SelectionClearAllAtomsAction();
    20   virtual ~SelectionClearAllAtomsAction();
    21 
    22   bool canUndo();
    23   bool shouldUndo();
    24 
    25   virtual const std::string getName();
    26 protected:
    27   virtual Dialog * fillDialog(Dialog *dialog);
    28 private:
    29   virtual void getParametersfromValueStorage();
    30   virtual Action::state_ptr performCall();
    31   virtual Action::state_ptr performUndo(Action::state_ptr);
    32   virtual Action::state_ptr performRedo(Action::state_ptr);
    33 
    34   static const char NAME[];
    35 };
     13#include "ClearAllAtomsAction.def"
     14#include "Action_impl_header.hpp"
    3615
    3716#endif /* CLEARALLATOMSACTION_HPP_ */
  • src/Actions/SelectionAction/ClearAllMoleculesAction.cpp

    r53d01c r1fd675  
    2020#include "Helpers/MemDebug.hpp"
    2121
    22 #include "Actions/SelectionAction/ClearAllMoleculesAction.hpp"
    23 #include "Actions/ActionRegistry.hpp"
    2422#include "Descriptors/MoleculeDescriptor.hpp"
    2523#include "atom.hpp"
     
    3331using namespace std;
    3432
    35 #include "UIElements/UIFactory.hpp"
    36 #include "UIElements/Dialog.hpp"
    37 #include "Actions/ValueStorage.hpp"
     33#include "Actions/SelectionAction/ClearAllMoleculesAction.hpp"
    3834
     35// and construct the stuff
     36#include "ClearAllMoleculesAction.def"
     37#include "Action_impl_pre.hpp"
     38/** =========== define the function ====================== */
     39Action::state_ptr SelectionClearAllMoleculesAction::performCall() {
     40  // obtain information
     41  getParametersfromValueStorage();
    3942
    40 // memento to remember the state when undoing
    41 
    42 class SelectionClearAllMoleculesState : public ActionState {
    43 public:
    44   SelectionClearAllMoleculesState(std::vector<molecule*> selectedMolecules) :
    45     selectedMolecules(selectedMolecules)
    46   {}
    47   std::vector<molecule*> selectedMolecules;
    48 };
    49 
    50 const char SelectionClearAllMoleculesAction::NAME[] = "clear-molecule-selection";
    51 
    52 SelectionClearAllMoleculesAction::SelectionClearAllMoleculesAction() :
    53   Action(NAME)
    54 {}
    55 
    56 SelectionClearAllMoleculesAction::~SelectionClearAllMoleculesAction()
    57 {}
    58 
    59 void SelectionClearAllMolecules() {
    60   ActionRegistry::getInstance().getActionByName(SelectionClearAllMoleculesAction::NAME)->call(Action::NonInteractive);
    61 };
    62 
    63 void SelectionClearAllMoleculesAction::getParametersfromValueStorage()
    64 {};
    65 
    66 Dialog* SelectionClearAllMoleculesAction::fillDialog(Dialog *dialog) {
    67   ASSERT(dialog,"No Dialog given when filling action dialog");
    68 
    69   dialog->queryEmpty(NAME, ValueStorage::getInstance().getDescription(NAME));
    70 
    71   return dialog;
    72 }
    73 
    74 Action::state_ptr SelectionClearAllMoleculesAction::performCall() {
    7543  std::vector<molecule *> selectedMolecules = World::getInstance().getSelectedMolecules();
    7644  DoLog(1) && (Log() << Verbose(1) << "Clearing molecule selection." << endl);
    7745  World::getInstance().clearMoleculeSelection();
    78   return Action::state_ptr(new SelectionClearAllMoleculesState(selectedMolecules));
     46  return Action::state_ptr(new SelectionClearAllMoleculesState(selectedMolecules,params));
    7947}
    8048
     
    8654    World::getInstance().selectMolecule(*iter);
    8755
    88   return Action::state_ptr(new SelectionClearAllMoleculesState(state->selectedMolecules));
     56  return Action::state_ptr(_state);
    8957}
    9058
    9159Action::state_ptr SelectionClearAllMoleculesAction::performRedo(Action::state_ptr _state){
    92   SelectionClearAllMoleculesState *state = assert_cast<SelectionClearAllMoleculesState*>(_state.get());
     60  //SelectionClearAllMoleculesState *state = assert_cast<SelectionClearAllMoleculesState*>(_state.get());
    9361
    9462  World::getInstance().clearMoleculeSelection();
    9563
    96   return Action::state_ptr(new SelectionClearAllMoleculesState(state->selectedMolecules));
     64  return Action::state_ptr(_state);
    9765}
    9866
     
    10876  return NAME;
    10977}
     78/** =========== end of function ====================== */
  • src/Actions/SelectionAction/ClearAllMoleculesAction.hpp

    r53d01c r1fd675  
    1111#include "Actions/Action.hpp"
    1212
    13 void SelectionClearAllMolecules();
    14 
    15 class SelectionClearAllMoleculesAction : public Action {
    16   friend void SelectionClearAllMolecules();
    17 
    18 public:
    19   SelectionClearAllMoleculesAction();
    20   virtual ~SelectionClearAllMoleculesAction();
    21 
    22   bool canUndo();
    23   bool shouldUndo();
    24 
    25   virtual const std::string getName();
    26 protected:
    27   virtual Dialog * fillDialog(Dialog *dialog);
    28 private:
    29   virtual void getParametersfromValueStorage();
    30   virtual Action::state_ptr performCall();
    31   virtual Action::state_ptr performUndo(Action::state_ptr);
    32   virtual Action::state_ptr performRedo(Action::state_ptr);
    33 
    34   static const char NAME[];
    35 };
     13#include "ClearAllMoleculesAction.def"
     14#include "Action_impl_header.hpp"
    3615
    3716#endif /* CLEARALLMOLECULESSACTION_HPP_ */
  • src/Actions/SelectionAction/MoleculeByFormulaAction.cpp

    r53d01c r1fd675  
    2020#include "Helpers/MemDebug.hpp"
    2121
    22 #include "Actions/SelectionAction/MoleculeByFormulaAction.hpp"
    23 #include "Actions/ActionRegistry.hpp"
    2422#include "Descriptors/MoleculeFormulaDescriptor.hpp"
    2523#include "molecule.hpp"
     
    3331using namespace std;
    3432
    35 #include "UIElements/UIFactory.hpp"
    36 #include "UIElements/Dialog.hpp"
    37 #include "Actions/ValueStorage.hpp"
     33#include "Actions/SelectionAction/MoleculeByFormulaAction.hpp"
    3834
    39 
    40 // memento to remember the state when undoing
    41 
    42 class SelectionMoleculeByFormulaState : public ActionState {
    43 public:
    44   SelectionMoleculeByFormulaState(std::vector<molecule*> selectedMolecules, const std::string &_formula) :
    45     selectedMolecules(selectedMolecules),
    46     formula(_formula)
    47   {}
    48   std::vector<molecule*> selectedMolecules;
    49   std::string formula;
    50 };
    51 
    52 const char SelectionMoleculeByFormulaAction::NAME[] = "select-molecule-by-formula";
    53 
    54 SelectionMoleculeByFormulaAction::SelectionMoleculeByFormulaAction() :
    55   Action(NAME)
    56 {}
    57 
    58 SelectionMoleculeByFormulaAction::~SelectionMoleculeByFormulaAction()
    59 {}
    60 
    61 void SelectionMoleculeByFormula(const std::string &_formula) {
    62   ValueStorage::getInstance().setCurrentValue(SelectionMoleculeByFormulaAction::NAME, _formula);
    63   ActionRegistry::getInstance().getActionByName(SelectionMoleculeByFormulaAction::NAME)->call(Action::NonInteractive);
    64 };
    65 
    66 void SelectionMoleculeByFormulaAction::getParametersfromValueStorage()
    67 {};
    68 
    69 Dialog* SelectionMoleculeByFormulaAction::fillDialog(Dialog *dialog) {
    70   ASSERT(dialog,"No Dialog given when filling action dialog");
    71 
    72   dialog->queryString(NAME, ValueStorage::getInstance().getDescription(NAME));
    73 
    74   return dialog;
    75 }
    76 
     35// and construct the stuff
     36#include "MoleculeByFormulaAction.def"
     37#include "Action_impl_pre.hpp"
     38/** =========== define the function ====================== */
    7739Action::state_ptr SelectionMoleculeByFormulaAction::performCall() {
    78   std::string formula;
    7940  std::vector<molecule *> selectedMolecules = World::getInstance().getSelectedMolecules();
    8041
    81   ValueStorage::getInstance().queryCurrentValue(NAME, formula);
     42  // obtain information
     43  getParametersfromValueStorage();
    8244
    83   DoLog(1) && (Log() << Verbose(1) << "Selecting molecules with chemical formula " << formula << ":" << endl);
    84   std::vector<molecule *> matchingMolecules = World::getInstance().getAllMolecules(MoleculeByFormula(formula));
     45  DoLog(1) && (Log() << Verbose(1) << "Selecting molecules with chemical formula " << params.formula << ":" << endl);
     46  std::vector<molecule *> matchingMolecules = World::getInstance().getAllMolecules(MoleculeByFormula(params.formula));
    8547  for (std::vector<molecule *>::const_iterator iter = matchingMolecules.begin(); iter != matchingMolecules.end(); ++iter) {
    8648    DoLog(1) && (Log() << Verbose(1) << "\t" << (*iter)->getId() << ", " << (*iter)->getName() << "." << endl);
    8749  }
    88   World::getInstance().selectAllMolecules(MoleculeByFormula(formula));
    89   return Action::state_ptr(new SelectionMoleculeByFormulaState(selectedMolecules,formula));
     50  World::getInstance().selectAllMolecules(MoleculeByFormula(params.formula));
     51  return Action::state_ptr(new SelectionMoleculeByFormulaState(selectedMolecules,params));
    9052}
    9153
     
    10365  SelectionMoleculeByFormulaState *state = assert_cast<SelectionMoleculeByFormulaState*>(_state.get());
    10466
    105   World::getInstance().selectAllMolecules(MoleculeByFormula(state->formula));
     67  World::getInstance().selectAllMolecules(MoleculeByFormula(state->params.formula));
    10668
    10769  return Action::state_ptr(_state);
     
    11981  return NAME;
    12082}
     83/** =========== end of function ====================== */
  • src/Actions/SelectionAction/MoleculeByFormulaAction.hpp

    r53d01c r1fd675  
    1111#include "Actions/Action.hpp"
    1212
    13 class molecule;
    14 
    15 void SelectionMoleculeByFormula(molecule *_mol);
    16 
    17 class SelectionMoleculeByFormulaAction : public Action {
    18   friend void SelectionMoleculeByFormula(const std::string &_formula);
    19 
    20 public:
    21   SelectionMoleculeByFormulaAction();
    22   virtual ~SelectionMoleculeByFormulaAction();
    23 
    24   bool canUndo();
    25   bool shouldUndo();
    26 
    27   virtual const std::string getName();
    28 protected:
    29   virtual Dialog * fillDialog(Dialog *dialog);
    30 private:
    31   virtual void getParametersfromValueStorage();
    32   virtual Action::state_ptr performCall();
    33   virtual Action::state_ptr performUndo(Action::state_ptr);
    34   virtual Action::state_ptr performRedo(Action::state_ptr);
    35 
    36   static const char NAME[];
    37 };
     13#include "MoleculeByFormulaAction.def"
     14#include "Action_impl_header.hpp"
    3815
    3916#endif /* MOLECULEBYFORMULAACTION_HPP_ */
  • src/Actions/SelectionAction/MoleculeByIdAction.cpp

    r53d01c r1fd675  
    2020#include "Helpers/MemDebug.hpp"
    2121
    22 #include "Actions/SelectionAction/MoleculeByIdAction.hpp"
    23 #include "Actions/ActionRegistry.hpp"
    2422#include "molecule.hpp"
    2523#include "Helpers/Log.hpp"
     
    3230using namespace std;
    3331
    34 #include "UIElements/UIFactory.hpp"
    35 #include "UIElements/Dialog.hpp"
    36 #include "Actions/ValueStorage.hpp"
     32#include "Actions/SelectionAction/MoleculeByIdAction.hpp"
    3733
     34// and construct the stuff
     35#include "MoleculeByIdAction.def"
     36#include "Action_impl_pre.hpp"
     37/** =========== define the function ====================== */
     38Action::state_ptr SelectionMoleculeByIdAction::performCall() {
     39  // obtain information
     40  getParametersfromValueStorage();
    3841
    39 // memento to remember the state when undoing
    40 
    41 class SelectionMoleculeByIdState : public ActionState {
    42 public:
    43   SelectionMoleculeByIdState(molecule* _mol) :
    44     mol(_mol)
    45   {}
    46   molecule* mol;
    47 };
    48 
    49 const char SelectionMoleculeByIdAction::NAME[] = "select-molecule-by-id";
    50 
    51 SelectionMoleculeByIdAction::SelectionMoleculeByIdAction() :
    52   Action(NAME)
    53 {}
    54 
    55 SelectionMoleculeByIdAction::~SelectionMoleculeByIdAction()
    56 {}
    57 
    58 void SelectionMoleculeById(molecule *_mol) {
    59   ValueStorage::getInstance().setCurrentValue(SelectionMoleculeByIdAction::NAME, _mol);
    60   ActionRegistry::getInstance().getActionByName(SelectionMoleculeByIdAction::NAME)->call(Action::NonInteractive);
    61 };
    62 
    63 void SelectionMoleculeByIdAction::getParametersfromValueStorage()
    64 {};
    65 
    66 Dialog* SelectionMoleculeByIdAction::fillDialog(Dialog *dialog) {
    67   ASSERT(dialog,"No Dialog given when filling action dialog");
    68 
    69   dialog->queryMolecule(NAME, ValueStorage::getInstance().getDescription(NAME));
    70 
    71   return dialog;
    72 }
    73 
    74 Action::state_ptr SelectionMoleculeByIdAction::performCall() {
    75   molecule *mol = NULL;
    76 
    77   ValueStorage::getInstance().queryCurrentValue(NAME, mol);
    78 
    79   if (!World::getInstance().isSelected(mol)) {
    80     DoLog(1) && (Log() << Verbose(1) << "Selecting molecule " << mol->name << endl);
    81     World::getInstance().selectMolecule(mol);
    82     return Action::state_ptr(new SelectionMoleculeByIdState(mol));
     42  if (!World::getInstance().isSelected(params.mol)) {
     43    DoLog(1) && (Log() << Verbose(1) << "Selecting molecule " << params.mol->name << endl);
     44    World::getInstance().selectMolecule(params.mol);
     45    return Action::state_ptr(new SelectionMoleculeByIdState(params));
    8346  } else {
    8447    return Action::success;
     
    8952  SelectionMoleculeByIdState *state = assert_cast<SelectionMoleculeByIdState*>(_state.get());
    9053
    91   if (state->mol != NULL)
    92     World::getInstance().unselectMolecule(state->mol);
     54  if (state->params.mol != NULL)
     55    World::getInstance().unselectMolecule(state->params.mol);
    9356
    94   return Action::state_ptr(new SelectionMoleculeByIdState(state->mol));
     57  return Action::state_ptr(_state);
    9558}
    9659
     
    9861  SelectionMoleculeByIdState *state = assert_cast<SelectionMoleculeByIdState*>(_state.get());
    9962
    100   if (state->mol != NULL)
    101     World::getInstance().selectMolecule(state->mol);
     63  if (state->params.mol != NULL)
     64    World::getInstance().selectMolecule(state->params.mol);
    10265
    103   return Action::state_ptr(new SelectionMoleculeByIdState(state->mol));
     66  return Action::state_ptr(state);
    10467}
    10568
     
    11578  return NAME;
    11679}
     80/** =========== end of function ====================== */
  • src/Actions/SelectionAction/MoleculeByIdAction.hpp

    r53d01c r1fd675  
    1111#include "Actions/Action.hpp"
    1212
    13 class molecule;
    14 
    15 void SelectionMoleculeById(molecule *_mol);
    16 
    17 class SelectionMoleculeByIdAction : public Action {
    18   friend void SelectionMoleculeById(molecule *_mol);
    19 
    20 public:
    21   SelectionMoleculeByIdAction();
    22   virtual ~SelectionMoleculeByIdAction();
    23 
    24   bool canUndo();
    25   bool shouldUndo();
    26 
    27   virtual const std::string getName();
    28 protected:
    29   virtual Dialog * fillDialog(Dialog *dialog);
    30 private:
    31   virtual void getParametersfromValueStorage();
    32   virtual Action::state_ptr performCall();
    33   virtual Action::state_ptr performUndo(Action::state_ptr);
    34   virtual Action::state_ptr performRedo(Action::state_ptr);
    35 
    36   static const char NAME[];
    37 };
     13#include "MoleculeByIdAction.def"
     14#include "Action_impl_header.hpp"
    3815
    3916#endif /* MOLECULEBYIDACTION_HPP_ */
  • src/Actions/SelectionAction/MoleculeOfAtomAction.cpp

    r53d01c r1fd675  
    2020#include "Helpers/MemDebug.hpp"
    2121
    22 #include "Actions/SelectionAction/MoleculeOfAtomAction.hpp"
    23 #include "Actions/ActionRegistry.hpp"
    2422#include "Descriptors/MoleculeDescriptor.hpp"
    2523#include "atom.hpp"
     
    3331using namespace std;
    3432
    35 #include "UIElements/UIFactory.hpp"
    36 #include "UIElements/Dialog.hpp"
    37 #include "Actions/ValueStorage.hpp"
     33#include "Actions/SelectionAction/MoleculeOfAtomAction.hpp"
    3834
    39 
    40 // memento to remember the state when undoing
    41 
    42 class SelectionMoleculeOfAtomState : public ActionState {
    43 public:
    44   SelectionMoleculeOfAtomState(std::vector<molecule*> selectedMolecules, atom *_Walker) :
    45     selectedMolecules(selectedMolecules),
    46     Walker(_Walker)
    47   {}
    48   std::vector<molecule*> selectedMolecules;
    49   atom *Walker;
    50 };
    51 
    52 const char SelectionMoleculeOfAtomAction::NAME[] = "select-molecule-of-atom";
    53 
    54 SelectionMoleculeOfAtomAction::SelectionMoleculeOfAtomAction() :
    55   Action(NAME)
    56 {}
    57 
    58 SelectionMoleculeOfAtomAction::~SelectionMoleculeOfAtomAction()
    59 {}
    60 
    61 void SelectionMoleculeOfAtom() {
    62   ActionRegistry::getInstance().getActionByName(SelectionMoleculeOfAtomAction::NAME)->call(Action::NonInteractive);
    63 };
    64 
    65 void SelectionMoleculeOfAtomAction::getParametersfromValueStorage()
    66 {};
    67 
    68 Dialog* SelectionMoleculeOfAtomAction::fillDialog(Dialog *dialog) {
    69   ASSERT(dialog,"No Dialog given when filling action dialog");
    70 
    71   dialog->queryAtom(NAME, ValueStorage::getInstance().getDescription(NAME));
    72 
    73   return dialog;
    74 }
    75 
     35// and construct the stuff
     36#include "MoleculeOfAtomAction.def"
     37#include "Action_impl_pre.hpp"
     38/** =========== define the function ====================== */
    7639Action::state_ptr SelectionMoleculeOfAtomAction::performCall() {
    77   atom *Walker = NULL;
    78 
    79   ValueStorage::getInstance().queryCurrentValue(NAME, Walker);
     40  // obtain information
     41  getParametersfromValueStorage();
    8042
    8143  std::vector<molecule *> selectedMolecules = World::getInstance().getSelectedMolecules();
    82   DoLog(1) && (Log() << Verbose(1) << "Selecting molecule to which " << Walker->getName() << " belongs." << endl);
    83   World::getInstance().selectMoleculeOfAtom(Walker);
    84   return Action::state_ptr(new SelectionMoleculeOfAtomState(selectedMolecules, Walker));
     44  DoLog(1) && (Log() << Verbose(1) << "Selecting molecule to which " << params.Walker->getName() << " belongs." << endl);
     45  World::getInstance().selectMoleculeOfAtom(params.Walker);
     46  return Action::state_ptr(new SelectionMoleculeOfAtomState(selectedMolecules, params));
    8547}
    8648
     
    9254    World::getInstance().selectMolecule(*iter);
    9355
    94   return Action::state_ptr(new SelectionMoleculeOfAtomState(state->selectedMolecules, state->Walker));
     56  return Action::state_ptr(_state);
    9557}
    9658
     
    9860  SelectionMoleculeOfAtomState *state = assert_cast<SelectionMoleculeOfAtomState*>(_state.get());
    9961
    100   World::getInstance().selectMoleculeOfAtom(state->Walker);
     62  World::getInstance().selectMoleculeOfAtom(state->params.Walker);
    10163
    102   return Action::state_ptr(new SelectionMoleculeOfAtomState(state->selectedMolecules, state->Walker));
     64  return Action::state_ptr(_state);
    10365}
    10466
     
    11476  return NAME;
    11577}
     78/** =========== end of function ====================== */
  • src/Actions/SelectionAction/MoleculeOfAtomAction.hpp

    r53d01c r1fd675  
    1111#include "Actions/Action.hpp"
    1212
    13 void SelectionMoleculeOfAtom();
    14 
    15 class SelectionMoleculeOfAtomAction : public Action {
    16   friend void SelectionMoleculeOfAtom();
    17 
    18 public:
    19   SelectionMoleculeOfAtomAction();
    20   virtual ~SelectionMoleculeOfAtomAction();
    21 
    22   bool canUndo();
    23   bool shouldUndo();
    24 
    25   virtual const std::string getName();
    26 protected:
    27   virtual Dialog * fillDialog(Dialog *dialog);
    28 private:
    29   virtual void getParametersfromValueStorage();
    30   virtual Action::state_ptr performCall();
    31   virtual Action::state_ptr performUndo(Action::state_ptr);
    32   virtual Action::state_ptr performRedo(Action::state_ptr);
    33 
    34   static const char NAME[];
    35 };
     13#include "MoleculeOfAtomAction.def"
     14#include "Action_impl_header.hpp"
    3615
    3716#endif /* MOLECULEOFATOMSACTION_HPP_ */
  • src/Actions/SelectionAction/NotAllAtomsAction.cpp

    r53d01c r1fd675  
    2020#include "Helpers/MemDebug.hpp"
    2121
    22 #include "Actions/SelectionAction/NotAllAtomsAction.hpp"
    23 #include "Actions/ActionRegistry.hpp"
    2422#include "Descriptors/AtomDescriptor.hpp"
    2523#include "atom.hpp"
     
    3331using namespace std;
    3432
    35 #include "UIElements/UIFactory.hpp"
    36 #include "UIElements/Dialog.hpp"
    37 #include "Actions/ValueStorage.hpp"
     33#include "Actions/SelectionAction/NotAllAtomsAction.hpp"
    3834
     35// and construct the stuff
     36#include "NotAllAtomsAction.def"
     37#include "Action_impl_pre.hpp"
     38/** =========== define the function ====================== */
     39Action::state_ptr SelectionNotAllAtomsAction::performCall() {
     40  // obtain information
     41  getParametersfromValueStorage();
    3942
    40 // memento to remember the state when undoing
    41 
    42 class SelectionNotAllAtomsState : public ActionState {
    43 public:
    44   SelectionNotAllAtomsState(std::vector<atom*> _selectedAtoms) :
    45     selectedAtoms(_selectedAtoms)
    46   {}
    47   std::vector<atom*> selectedAtoms;
    48 };
    49 
    50 const char SelectionNotAllAtomsAction::NAME[] = "unselect-all-atoms";
    51 
    52 SelectionNotAllAtomsAction::SelectionNotAllAtomsAction() :
    53   Action(NAME)
    54 {}
    55 
    56 SelectionNotAllAtomsAction::~SelectionNotAllAtomsAction()
    57 {}
    58 
    59 void SelectionNotAllAtoms() {
    60   ActionRegistry::getInstance().getActionByName(SelectionNotAllAtomsAction::NAME)->call(Action::NonInteractive);
    61 };
    62 
    63 void SelectionNotAllAtomsAction::getParametersfromValueStorage()
    64 {};
    65 
    66 Dialog* SelectionNotAllAtomsAction::fillDialog(Dialog *dialog) {
    67   ASSERT(dialog,"No Dialog given when filling action dialog");
    68 
    69   dialog->queryEmpty(NAME, ValueStorage::getInstance().getDescription(NAME));
    70 
    71   return dialog;
    72 }
    73 
    74 Action::state_ptr SelectionNotAllAtomsAction::performCall() {
    7543  std::vector<atom *> selectedAtoms = World::getInstance().getSelectedAtoms();
    7644  DoLog(1) && (Log() << Verbose(1) << "Unselecting all atoms." << endl);
    7745  World::getInstance().clearAtomSelection();
    78   return Action::state_ptr(new SelectionNotAllAtomsState(selectedAtoms));
     46  return Action::state_ptr(new SelectionNotAllAtomsState(selectedAtoms, params));
    7947}
    8048
     
    8654    World::getInstance().selectAtom(*iter);
    8755
    88   return Action::state_ptr(new SelectionNotAllAtomsState(state->selectedAtoms));
     56  return Action::state_ptr(_state);
    8957}
    9058
    9159Action::state_ptr SelectionNotAllAtomsAction::performRedo(Action::state_ptr _state){
    92   SelectionNotAllAtomsState *state = assert_cast<SelectionNotAllAtomsState*>(_state.get());
     60  //SelectionNotAllAtomsState *state = assert_cast<SelectionNotAllAtomsState*>(_state.get());
    9361
    9462  World::getInstance().clearAtomSelection();
    9563
    96   return Action::state_ptr(new SelectionNotAllAtomsState(state->selectedAtoms));
     64  return Action::state_ptr(_state);
    9765}
    9866
     
    10876  return NAME;
    10977}
     78/** =========== end of function ====================== */
  • src/Actions/SelectionAction/NotAllAtomsAction.hpp

    r53d01c r1fd675  
    1111#include "Actions/Action.hpp"
    1212
    13 void SelectionNotAllAtoms();
    14 
    15 class SelectionNotAllAtomsAction : public Action {
    16   friend void SelectionNotAllAtoms();
    17 
    18 public:
    19   SelectionNotAllAtomsAction();
    20   virtual ~SelectionNotAllAtomsAction();
    21 
    22   bool canUndo();
    23   bool shouldUndo();
    24 
    25   virtual const std::string getName();
    26 protected:
    27   virtual Dialog * fillDialog(Dialog *dialog);
    28 private:
    29   virtual void getParametersfromValueStorage();
    30   virtual Action::state_ptr performCall();
    31   virtual Action::state_ptr performUndo(Action::state_ptr);
    32   virtual Action::state_ptr performRedo(Action::state_ptr);
    33 
    34   static const char NAME[];
    35 };
     13#include "NotAllAtomsAction.def"
     14#include "Action_impl_header.hpp"
    3615
    3716#endif /* NOTALLATOMSACTION_HPP_ */
  • src/Actions/SelectionAction/NotAllAtomsInsideCuboidAction.cpp

    r53d01c r1fd675  
    2020#include "Helpers/MemDebug.hpp"
    2121
    22 #include "Actions/SelectionAction/NotAllAtomsInsideCuboidAction.hpp"
    23 #include "Actions/ActionRegistry.hpp"
    2422#include "Descriptors/AtomDescriptor.hpp"
    2523#include "Descriptors/AtomShapeDescriptor.hpp"
     
    3937using namespace std;
    4038
    41 #include "UIElements/UIFactory.hpp"
    42 #include "UIElements/Dialog.hpp"
    43 #include "Actions/ValueStorage.hpp"
     39#include "Actions/SelectionAction/NotAllAtomsInsideCuboidAction.hpp"
    4440
    45 
    46 // memento to remember the state when undoing
    47 
    48 class SelectionNotAllAtomsInsideCuboidState : public ActionState {
    49 public:
    50   SelectionNotAllAtomsInsideCuboidState(std::vector<atom*> _selectedAtoms, const Vector &_position, const Vector &_extension, const double _Xangle, const double _Yangle, const double _Zangle) :
    51     selectedAtoms(_selectedAtoms),
    52     position(_position),
    53     extension(_extension),
    54     Xangle(_Xangle),
    55     Yangle(_Yangle),
    56     Zangle(_Zangle)
    57   {}
    58   std::vector<atom*> selectedAtoms;
    59   Vector position;
    60   Vector extension;
    61   double Xangle;
    62   double Yangle;
    63   double Zangle;
    64 };
    65 
    66 const char SelectionNotAllAtomsInsideCuboidAction::NAME[] = "unselect-atoms-inside-cuboid";
    67 
    68 SelectionNotAllAtomsInsideCuboidAction::SelectionNotAllAtomsInsideCuboidAction() :
    69   Action(NAME)
    70 {}
    71 
    72 SelectionNotAllAtomsInsideCuboidAction::~SelectionNotAllAtomsInsideCuboidAction()
    73 {}
    74 
    75 void SelectionNotAllAtomsInsideCuboid(const Vector &position, const Vector &extension) {
    76   ValueStorage::getInstance().setCurrentValue(SelectionNotAllAtomsInsideCuboidAction::NAME, extension);
    77   ValueStorage::getInstance().setCurrentValue("position", position);
    78   ActionRegistry::getInstance().getActionByName(SelectionNotAllAtomsInsideCuboidAction::NAME)->call(Action::NonInteractive);
    79 };
    80 
    81 void SelectionNotAllAtomsInsideCuboid(const Vector &position, const Vector &extension, const double Xangle, const double Yangle, const double Zangle) {
    82   ValueStorage::getInstance().setCurrentValue(SelectionNotAllAtomsInsideCuboidAction::NAME, extension);
    83   ValueStorage::getInstance().setCurrentValue("position", position);
    84   ValueStorage::getInstance().setCurrentValue("angle-x", Xangle);
    85   ValueStorage::getInstance().setCurrentValue("angle-y", Yangle);
    86   ValueStorage::getInstance().setCurrentValue("angle-z", Zangle);
    87   ActionRegistry::getInstance().getActionByName(SelectionNotAllAtomsInsideCuboidAction::NAME)->call(Action::NonInteractive);
    88 };
    89 
    90 void SelectionNotAllAtomsInsideCuboidAction::getParametersfromValueStorage()
    91 {};
    92 
    93 Dialog* SelectionNotAllAtomsInsideCuboidAction::fillDialog(Dialog *dialog) {
    94   ASSERT(dialog,"No Dialog given when filling action dialog");
    95 
    96   dialog->queryVector(NAME, false, ValueStorage::getInstance().getDescription(NAME));
    97   dialog->queryVector("position", false, ValueStorage::getInstance().getDescription("position"));
    98 
    99   return dialog;
    100 }
    101 
     41// and construct the stuff
     42#include "NotAllAtomsInsideCuboidAction.def"
     43#include "Action_impl_pre.hpp"
     44/** =========== define the function ====================== */
    10245Action::state_ptr SelectionNotAllAtomsInsideCuboidAction::performCall() {
    10346  std::vector<atom *> selectedAtoms = World::getInstance().getSelectedAtoms();
    104   Vector position;
    105   Vector extension;
    106   double Xangle = 0.;
    107   double Yangle = 0.;
    108   double Zangle = 0.;
    10947  Matrix RotationMatrix;
    11048
    111   ValueStorage::getInstance().queryCurrentValue("position", position);
    112   ValueStorage::getInstance().queryCurrentValue(NAME, extension);
    113   // check whether a rotation is given.
    114   if (ValueStorage::getInstance().queryCurrentValue("angle-x", Xangle, true))
    115     Xangle = 0.;
    116   if (ValueStorage::getInstance().queryCurrentValue("angle-y", Yangle, true))
    117     Yangle = 0.;
    118   if (ValueStorage::getInstance().queryCurrentValue("angle-z", Zangle, true))
    119     Zangle = 0.;
    120   RotationMatrix.rotation(Xangle, Yangle, Zangle);
     49  // obtain information
     50  getParametersfromValueStorage();
     51  RotationMatrix.rotation(params.Xangle, params.Yangle, params.Zangle);
    12152
    122   DoLog(1) && (Log() << Verbose(1) << "Unselecting all atoms inside a rotated " << RotationMatrix << " cuboid at " << position << " and extension of " << extension << "." << endl);
    123   Shape s = translate(transform(stretch(Cuboid(),extension),RotationMatrix),position);
     53  DoLog(1) && (Log() << Verbose(1) << "Unselecting all atoms inside a rotated " << RotationMatrix << " cuboid at " << params.position << " and extension of " << params.extension << "." << endl);
     54  Shape s = translate(transform(stretch(Cuboid(),params.extension),RotationMatrix),params.position);
    12455
    12556  World::getInstance().unselectAllAtoms(AtomByShape(s));
    126   return Action::state_ptr(new SelectionNotAllAtomsInsideCuboidState(selectedAtoms, position, extension, Xangle, Yangle, Zangle));
     57  return Action::state_ptr(new SelectionNotAllAtomsInsideCuboidState(selectedAtoms, params));
    12758}
    12859
     
    14172  Matrix RotationMatrix;
    14273
    143   RotationMatrix.rotation(state->Xangle, state->Yangle, state->Zangle);
    144   Shape s = translate(transform(stretch(Cuboid(),state->extension),RotationMatrix),state->position);
     74  RotationMatrix.rotation(state->params.Xangle, state->params.Yangle, state->params.Zangle);
     75  Shape s = translate(transform(stretch(Cuboid(),state->params.extension),RotationMatrix),state->params.position);
    14576  World::getInstance().unselectAllAtoms(AtomByShape(s));
    14677
     
    15990  return NAME;
    16091}
     92/** =========== end of function ====================== */
  • src/Actions/SelectionAction/NotAllAtomsInsideCuboidAction.hpp

    r53d01c r1fd675  
    1111#include "Actions/Action.hpp"
    1212
    13 class Vector;
    14 
    15 void SelectionNotAllAtomsInsideCuboid();
    16 
    17 class SelectionNotAllAtomsInsideCuboidAction : public Action {
    18   friend void SelectionNotAllAtomsInsideCuboid(const Vector &position, const Vector &extension);
    19   friend void SelectionNotAllAtomsInsideCuboid(const Vector &position, const Vector &extension, const double Xangle, const double Yangle, const double Zangle);
    20 
    21 public:
    22   SelectionNotAllAtomsInsideCuboidAction();
    23   virtual ~SelectionNotAllAtomsInsideCuboidAction();
    24 
    25   bool canUndo();
    26   bool shouldUndo();
    27 
    28   virtual const std::string getName();
    29 protected:
    30   virtual Dialog * fillDialog(Dialog *dialog);
    31 private:
    32   virtual void getParametersfromValueStorage();
    33   virtual Action::state_ptr performCall();
    34   virtual Action::state_ptr performUndo(Action::state_ptr);
    35   virtual Action::state_ptr performRedo(Action::state_ptr);
    36 
    37   static const char NAME[];
    38 };
     13#include "NotAllAtomsInsideCuboidAction.def"
     14#include "Action_impl_header.hpp"
    3915
    4016#endif /* NOTALLATOMSINSIDECUBOIDACTION_HPP_ */
  • src/Actions/SelectionAction/NotAllAtomsInsideSphereAction.cpp

    r53d01c r1fd675  
    2020#include "Helpers/MemDebug.hpp"
    2121
    22 #include "Actions/SelectionAction/NotAllAtomsInsideSphereAction.hpp"
    23 #include "Actions/ActionRegistry.hpp"
    2422#include "Descriptors/AtomDescriptor.hpp"
    2523#include "Descriptors/AtomShapeDescriptor.hpp"
     
    3836using namespace std;
    3937
    40 #include "UIElements/UIFactory.hpp"
    41 #include "UIElements/Dialog.hpp"
    42 #include "Actions/ValueStorage.hpp"
     38#include "Actions/SelectionAction/NotAllAtomsInsideSphereAction.hpp"
    4339
    44 
    45 // memento to remember the state when undoing
    46 
    47 class SelectionNotAllAtomsInsideSphereState : public ActionState {
    48 public:
    49   SelectionNotAllAtomsInsideSphereState(std::vector<atom*> _selectedAtoms, const Vector &_position, const double _radius) :
    50     selectedAtoms(_selectedAtoms),
    51     position(_position),
    52     radius(_radius)
    53   {}
    54   std::vector<atom*> selectedAtoms;
    55   Vector position;
    56   double radius;
    57 };
    58 
    59 const char SelectionNotAllAtomsInsideSphereAction::NAME[] = "unselect-atoms-inside-sphere";
    60 
    61 SelectionNotAllAtomsInsideSphereAction::SelectionNotAllAtomsInsideSphereAction() :
    62   Action(NAME)
    63 {}
    64 
    65 SelectionNotAllAtomsInsideSphereAction::~SelectionNotAllAtomsInsideSphereAction()
    66 {}
    67 
    68 void SelectionNotAllAtomsInsideSphere(const Vector &position, const double radius) {
    69   ValueStorage::getInstance().setCurrentValue(SelectionNotAllAtomsInsideSphereAction::NAME, radius);
    70   ValueStorage::getInstance().setCurrentValue("position", position);
    71   ActionRegistry::getInstance().getActionByName(SelectionNotAllAtomsInsideSphereAction::NAME)->call(Action::NonInteractive);
    72 };
    73 
    74 void SelectionNotAllAtomsInsideSphereAction::getParametersfromValueStorage()
    75 {};
    76 
    77 Dialog* SelectionNotAllAtomsInsideSphereAction::fillDialog(Dialog *dialog) {
    78   ASSERT(dialog,"No Dialog given when filling action dialog");
    79 
    80   dialog->queryDouble(NAME, ValueStorage::getInstance().getDescription(NAME));
    81   dialog->queryVector("position", false, ValueStorage::getInstance().getDescription("position"));
    82 
    83   return dialog;
    84 }
    85 
     40// and construct the stuff
     41#include "NotAllAtomsInsideSphereAction.def"
     42#include "Action_impl_pre.hpp"
     43/** =========== define the function ====================== */
    8644Action::state_ptr SelectionNotAllAtomsInsideSphereAction::performCall() {
    8745  std::vector<atom *> selectedAtoms = World::getInstance().getSelectedAtoms();
    88   double radius = 0.;
    89   Vector position;
    9046
    91   ValueStorage::getInstance().queryCurrentValue(NAME, radius);
    92   ValueStorage::getInstance().queryCurrentValue("position", position);
     47  // obtain information
     48  getParametersfromValueStorage();
    9349
    94   DoLog(1) && (Log() << Verbose(1) << "Unselecting all atoms inside a sphere at " << position << " with radius " << radius << "." << endl);
    95   Shape s = translate(resize(Sphere(),radius),position);
     50  DoLog(1) && (Log() << Verbose(1) << "Unselecting all atoms inside a sphere at " << params.position << " with radius " << params.radius << "." << endl);
     51  Shape s = translate(resize(Sphere(),params.radius),params.position);
    9652  World::getInstance().unselectAllAtoms(AtomByShape(s));
    97   return Action::state_ptr(new SelectionNotAllAtomsInsideSphereState(selectedAtoms, position, radius));
     53  return Action::state_ptr(new SelectionNotAllAtomsInsideSphereState(selectedAtoms, params));
    9854}
    9955
     
    10561    World::getInstance().selectAtom(*iter);
    10662
    107   return Action::state_ptr(new SelectionNotAllAtomsInsideSphereState(state->selectedAtoms, state->position, state->radius));
     63  return Action::state_ptr(_state);
    10864}
    10965
     
    11167  SelectionNotAllAtomsInsideSphereState *state = assert_cast<SelectionNotAllAtomsInsideSphereState*>(_state.get());
    11268
    113   Shape s = translate(resize(Sphere(),state->radius),state->position);
     69  Shape s = translate(resize(Sphere(),state->params.radius),state->params.position);
    11470  World::getInstance().unselectAllAtoms(AtomByShape(s));
    11571
    116   return Action::state_ptr(new SelectionNotAllAtomsInsideSphereState(state->selectedAtoms, state->position, state->radius));
     72  return Action::state_ptr(_state);
    11773}
    11874
     
    12884  return NAME;
    12985}
     86/** =========== end of function ====================== */
  • src/Actions/SelectionAction/NotAllAtomsInsideSphereAction.hpp

    r53d01c r1fd675  
    1111#include "Actions/Action.hpp"
    1212
    13 class Vector;
    14 
    15 void SelectionNotAllAtomsInsideSphere();
    16 
    17 class SelectionNotAllAtomsInsideSphereAction : public Action {
    18   friend void SelectionNotAllAtomsInsideSphere(const Vector &position, const double radius);
    19 
    20 public:
    21   SelectionNotAllAtomsInsideSphereAction();
    22   virtual ~SelectionNotAllAtomsInsideSphereAction();
    23 
    24   bool canUndo();
    25   bool shouldUndo();
    26 
    27   virtual const std::string getName();
    28 protected:
    29   virtual Dialog * fillDialog(Dialog *dialog);
    30 private:
    31   virtual void getParametersfromValueStorage();
    32   virtual Action::state_ptr performCall();
    33   virtual Action::state_ptr performUndo(Action::state_ptr);
    34   virtual Action::state_ptr performRedo(Action::state_ptr);
    35 
    36   static const char NAME[];
    37 };
     13#include "NotAllAtomsInsideSphereAction.def"
     14#include "Action_impl_header.hpp"
    3815
    3916#endif /* NOTALLATOMSINSIDESPHEREACTION_HPP_ */
  • src/Actions/SelectionAction/NotAllAtomsOfMoleculeAction.cpp

    r53d01c r1fd675  
    2020#include "Helpers/MemDebug.hpp"
    2121
    22 #include "Actions/SelectionAction/NotAllAtomsOfMoleculeAction.hpp"
    23 #include "Actions/ActionRegistry.hpp"
    2422#include "Descriptors/AtomDescriptor.hpp"
    2523#include "atom.hpp"
     
    3432using namespace std;
    3533
    36 #include "UIElements/UIFactory.hpp"
    37 #include "UIElements/Dialog.hpp"
    38 #include "Actions/ValueStorage.hpp"
     34#include "Actions/SelectionAction/NotAllAtomsOfMoleculeAction.hpp"
    3935
    40 
    41 // memento to remember the state when undoing
    42 
    43 class SelectionNotAllAtomsOfMoleculeState : public ActionState {
    44 public:
    45   SelectionNotAllAtomsOfMoleculeState(std::vector<atom*> _selectedAtoms, molecule *_mol) :
    46     selectedAtoms(_selectedAtoms),
    47     mol(_mol)
    48   {}
    49   std::vector<atom*> selectedAtoms;
    50   molecule *mol;
    51 };
    52 
    53 const char SelectionNotAllAtomsOfMoleculeAction::NAME[] = "unselect-molecules-atoms";
    54 
    55 SelectionNotAllAtomsOfMoleculeAction::SelectionNotAllAtomsOfMoleculeAction() :
    56   Action(NAME)
    57 {}
    58 
    59 SelectionNotAllAtomsOfMoleculeAction::~SelectionNotAllAtomsOfMoleculeAction()
    60 {}
    61 
    62 void SelectionNotAllAtomsOfMolecule() {
    63   ActionRegistry::getInstance().getActionByName(SelectionNotAllAtomsOfMoleculeAction::NAME)->call(Action::NonInteractive);
    64 };
    65 
    66 void SelectionNotAllAtomsOfMoleculeAction::getParametersfromValueStorage()
    67 {};
    68 
    69 Dialog* SelectionNotAllAtomsOfMoleculeAction::fillDialog(Dialog *dialog) {
    70   ASSERT(dialog,"No Dialog given when filling action dialog");
    71 
    72   dialog->queryMolecule(NAME, ValueStorage::getInstance().getDescription(NAME));
    73 
    74   return dialog;
    75 }
    76 
     36// and construct the stuff
     37#include "NotAllAtomsOfMoleculeAction.def"
     38#include "Action_impl_pre.hpp"
     39/** =========== define the function ====================== */
    7740Action::state_ptr SelectionNotAllAtomsOfMoleculeAction::performCall() {
    78   molecule *mol = NULL;
    7941  std::vector<atom *> selectedAtoms = World::getInstance().getSelectedAtoms();
    8042
    81   ValueStorage::getInstance().queryCurrentValue(NAME, mol);
     43  // obtain information
     44  getParametersfromValueStorage();
    8245
    83   DoLog(1) && (Log() << Verbose(1) << "Unselecting all atoms of molecule " << mol->getName() << "." << endl);
    84   World::getInstance().unselectAtomsOfMolecule(mol);
    85   return Action::state_ptr(new SelectionNotAllAtomsOfMoleculeState(selectedAtoms, mol));
     46  DoLog(1) && (Log() << Verbose(1) << "Unselecting all atoms of molecule " << params.mol->getName() << "." << endl);
     47  World::getInstance().unselectAtomsOfMolecule(params.mol);
     48  return Action::state_ptr(new SelectionNotAllAtomsOfMoleculeState(selectedAtoms, params));
    8649}
    8750
     
    9356    World::getInstance().selectAtom(*iter);
    9457
    95   return Action::state_ptr(new SelectionNotAllAtomsOfMoleculeState(state->selectedAtoms, state->mol));
     58  return Action::state_ptr(_state);
    9659}
    9760
     
    9962  SelectionNotAllAtomsOfMoleculeState *state = assert_cast<SelectionNotAllAtomsOfMoleculeState*>(_state.get());
    10063
    101   World::getInstance().unselectAtomsOfMolecule(state->mol);
     64  World::getInstance().unselectAtomsOfMolecule(state->params.mol);
    10265
    103   return Action::state_ptr(new SelectionNotAllAtomsOfMoleculeState(state->selectedAtoms, state->mol));
     66  return Action::state_ptr(_state);
    10467}
    10568
     
    11578  return NAME;
    11679}
     80/** =========== end of function ====================== */
  • src/Actions/SelectionAction/NotAllAtomsOfMoleculeAction.hpp

    r53d01c r1fd675  
    1111#include "Actions/Action.hpp"
    1212
    13 void SelectionNotAllAtomsOfMolecule();
    14 
    15 class SelectionNotAllAtomsOfMoleculeAction : public Action {
    16   friend void SelectionNotAllAtomsOfMolecule();
    17 
    18 public:
    19   SelectionNotAllAtomsOfMoleculeAction();
    20   virtual ~SelectionNotAllAtomsOfMoleculeAction();
    21 
    22   bool canUndo();
    23   bool shouldUndo();
    24 
    25   virtual const std::string getName();
    26 protected:
    27   virtual Dialog * fillDialog(Dialog *dialog);
    28 private:
    29   virtual void getParametersfromValueStorage();
    30   virtual Action::state_ptr performCall();
    31   virtual Action::state_ptr performUndo(Action::state_ptr);
    32   virtual Action::state_ptr performRedo(Action::state_ptr);
    33 
    34   static const char NAME[];
    35 };
     13#include "NotAllAtomsOfMoleculeAction.def"
     14#include "Action_impl_header.hpp"
    3615
    3716#endif /* NOTALLATOMSOFMOLECULEACTION_HPP_ */
  • src/Actions/SelectionAction/NotAllMoleculesAction.cpp

    r53d01c r1fd675  
    2020#include "Helpers/MemDebug.hpp"
    2121
    22 #include "Actions/SelectionAction/NotAllMoleculesAction.hpp"
    23 #include "Actions/ActionRegistry.hpp"
    2422#include "Descriptors/MoleculeDescriptor.hpp"
    2523#include "atom.hpp"
     
    3331using namespace std;
    3432
    35 #include "UIElements/UIFactory.hpp"
    36 #include "UIElements/Dialog.hpp"
    37 #include "Actions/ValueStorage.hpp"
     33#include "Actions/SelectionAction/NotAllMoleculesAction.hpp"
    3834
     35// and construct the stuff
     36#include "NotAllMoleculesAction.def"
     37#include "Action_impl_pre.hpp"
     38/** =========== define the function ====================== */
     39Action::state_ptr SelectionNotAllMoleculesAction::performCall() {
     40  // obtain information
     41  getParametersfromValueStorage();
    3942
    40 // memento to remember the state when undoing
    41 
    42 class SelectionNotAllMoleculesState : public ActionState {
    43 public:
    44   SelectionNotAllMoleculesState(std::vector<molecule*> selectedMolecules) :
    45     selectedMolecules(selectedMolecules)
    46   {}
    47   std::vector<molecule*> selectedMolecules;
    48 };
    49 
    50 const char SelectionNotAllMoleculesAction::NAME[] = "unselect-all-molecules";
    51 
    52 SelectionNotAllMoleculesAction::SelectionNotAllMoleculesAction() :
    53   Action(NAME)
    54 {}
    55 
    56 SelectionNotAllMoleculesAction::~SelectionNotAllMoleculesAction()
    57 {}
    58 
    59 void SelectionNotAllMolecules() {
    60   ActionRegistry::getInstance().getActionByName(SelectionNotAllMoleculesAction::NAME)->call(Action::NonInteractive);
    61 };
    62 
    63 void SelectionNotAllMoleculesAction::getParametersfromValueStorage()
    64 {};
    65 
    66 Dialog* SelectionNotAllMoleculesAction::fillDialog(Dialog *dialog) {
    67   ASSERT(dialog,"No Dialog given when filling action dialog");
    68 
    69   dialog->queryEmpty(NAME, ValueStorage::getInstance().getDescription(NAME));
    70 
    71   return dialog;
    72 }
    73 
    74 Action::state_ptr SelectionNotAllMoleculesAction::performCall() {
    7543  std::vector<molecule *> selectedMolecules = World::getInstance().getSelectedMolecules();
    7644  DoLog(1) && (Log() << Verbose(1) << "Unselecting all molecules." << endl);
    7745  World::getInstance().clearMoleculeSelection();
    78   return Action::state_ptr(new SelectionNotAllMoleculesState(selectedMolecules));
     46  return Action::state_ptr(new SelectionNotAllMoleculesState(selectedMolecules,params));
    7947}
    8048
     
    8654    World::getInstance().selectMolecule(*iter);
    8755
    88   return Action::state_ptr(new SelectionNotAllMoleculesState(state->selectedMolecules));
     56  return Action::state_ptr(_state);
    8957}
    9058
    9159Action::state_ptr SelectionNotAllMoleculesAction::performRedo(Action::state_ptr _state){
    92   SelectionNotAllMoleculesState *state = assert_cast<SelectionNotAllMoleculesState*>(_state.get());
     60  //SelectionNotAllMoleculesState *state = assert_cast<SelectionNotAllMoleculesState*>(_state.get());
    9361
    9462  World::getInstance().clearMoleculeSelection();
    9563
    96   return Action::state_ptr(new SelectionNotAllMoleculesState(state->selectedMolecules));
     64  return Action::state_ptr(_state);
    9765}
    9866
     
    10876  return NAME;
    10977}
     78/** =========== end of function ====================== */
  • src/Actions/SelectionAction/NotAllMoleculesAction.hpp

    r53d01c r1fd675  
    22 * NotAllMoleculesAction.hpp
    33 *
    4  *  Created on: May 12, 2010
     4 *  Created on: Aug 09, 2010
    55 *      Author: heber
    66 */
     
    1111#include "Actions/Action.hpp"
    1212
    13 void SelectionNotAllMolecules();
    14 
    15 class SelectionNotAllMoleculesAction : public Action {
    16   friend void SelectionNotAllMolecules();
    17 
    18 public:
    19   SelectionNotAllMoleculesAction();
    20   virtual ~SelectionNotAllMoleculesAction();
    21 
    22   bool canUndo();
    23   bool shouldUndo();
    24 
    25   virtual const std::string getName();
    26 protected:
    27   virtual Dialog * fillDialog(Dialog *dialog);
    28 private:
    29   virtual void getParametersfromValueStorage();
    30   virtual Action::state_ptr performCall();
    31   virtual Action::state_ptr performUndo(Action::state_ptr);
    32   virtual Action::state_ptr performRedo(Action::state_ptr);
    33 
    34   static const char NAME[];
    35 };
     13#include "NotAllMoleculesAction.def"
     14#include "Action_impl_header.hpp"
    3615
    3716#endif /* NOTALLMOLECULESSACTION_HPP_ */
  • src/Actions/SelectionAction/NotAtomByElementAction.cpp

    r53d01c r1fd675  
    2020#include "Helpers/MemDebug.hpp"
    2121
    22 #include "Actions/SelectionAction/NotAtomByElementAction.hpp"
    23 #include "Actions/ActionRegistry.hpp"
    2422#include "Descriptors/AtomTypeDescriptor.hpp"
    2523#include "atom.hpp"
     
    3432using namespace std;
    3533
    36 #include "UIElements/UIFactory.hpp"
    37 #include "UIElements/Dialog.hpp"
    38 #include "Actions/ValueStorage.hpp"
     34#include "Actions/SelectionAction/NotAtomByElementAction.hpp"
    3935
    40 
    41 // memento to remember the state when undoing
    42 
    43 class SelectionNotAtomByElementState : public ActionState {
    44 public:
    45   SelectionNotAtomByElementState(std::vector<atom*> _selectedAtoms, const element *_elemental) :
    46     selectedAtoms(_selectedAtoms),
    47     elemental(_elemental)
    48   {}
    49   std::vector<atom*> selectedAtoms;
    50   const element *elemental;
    51 };
    52 
    53 const char SelectionNotAtomByElementAction::NAME[] = "unselect-atom-by-element";
    54 
    55 SelectionNotAtomByElementAction::SelectionNotAtomByElementAction() :
    56   Action(NAME)
    57 {}
    58 
    59 SelectionNotAtomByElementAction::~SelectionNotAtomByElementAction()
    60 {}
    61 
    62 void SelectionNotAtomByElement(const element &_element) {
    63   ValueStorage::getInstance().setCurrentValue(SelectionNotAtomByElementAction::NAME, _element);
    64   ActionRegistry::getInstance().getActionByName(SelectionNotAtomByElementAction::NAME)->call(Action::NonInteractive);
    65 };
    66 
    67 void SelectionNotAtomByElementAction::getParametersfromValueStorage()
    68 {};
    69 
    70 Dialog* SelectionNotAtomByElementAction::fillDialog(Dialog *dialog) {
    71   ASSERT(dialog,"No Dialog given when filling action dialog");
    72 
    73   dialog->queryElement(NAME, ValueStorage::getInstance().getDescription(NAME));
    74 
    75   return dialog;
    76 }
    77 
     36// and construct the stuff
     37#include "NotAtomByElementAction.def"
     38#include "Action_impl_pre.hpp"
     39/** =========== define the function ====================== */
    7840Action::state_ptr SelectionNotAtomByElementAction::performCall() {
    79   const element *elemental;
    8041  std::vector<atom *> selectedAtoms = World::getInstance().getSelectedAtoms();
    8142
    82   ValueStorage::getInstance().queryCurrentValue(NAME, elemental);
     43  // obtain information
     44  getParametersfromValueStorage();
    8345
    84   DoLog(1) && (Log() << Verbose(1) << "Unselecting atoms of type " << *elemental << endl);
    85   World::getInstance().unselectAllAtoms(AtomByType(elemental));
    86   return Action::state_ptr(new SelectionNotAtomByElementState(selectedAtoms,elemental));
     46  DoLog(1) && (Log() << Verbose(1) << "Unselecting atoms of type " << *params.elemental << endl);
     47  World::getInstance().unselectAllAtoms(AtomByType(params.elemental));
     48  return Action::state_ptr(new SelectionNotAtomByElementState(selectedAtoms,params));
    8749}
    8850
     
    10062  SelectionNotAtomByElementState *state = assert_cast<SelectionNotAtomByElementState*>(_state.get());
    10163
    102   World::getInstance().unselectAllAtoms(AtomByType(state->elemental));
     64  World::getInstance().unselectAllAtoms(AtomByType(state->params.elemental));
    10365
    10466  return Action::state_ptr(_state);
     
    11678  return NAME;
    11779}
     80/** =========== end of function ====================== */
  • src/Actions/SelectionAction/NotAtomByElementAction.hpp

    r53d01c r1fd675  
    1111#include "Actions/Action.hpp"
    1212
    13 class element;
    14 
    15 void SelectionNotAtomByElement(const element &_element);
    16 
    17 class SelectionNotAtomByElementAction : public Action {
    18   friend void SelectionNotAtomByElement(const element &_element);
    19 
    20 public:
    21   SelectionNotAtomByElementAction();
    22   virtual ~SelectionNotAtomByElementAction();
    23 
    24   bool canUndo();
    25   bool shouldUndo();
    26 
    27   virtual const std::string getName();
    28 protected:
    29   virtual Dialog * fillDialog(Dialog *dialog);
    30 private:
    31   virtual void getParametersfromValueStorage();
    32   virtual Action::state_ptr performCall();
    33   virtual Action::state_ptr performUndo(Action::state_ptr);
    34   virtual Action::state_ptr performRedo(Action::state_ptr);
    35 
    36   static const char NAME[];
    37 };
     13#include "NotAtomByElementAction.def"
     14#include "Action_impl_header.hpp"
    3815
    3916#endif /* NOTATOMBYELEMENTACTION_HPP_ */
  • src/Actions/SelectionAction/NotAtomByIdAction.cpp

    r53d01c r1fd675  
    2020#include "Helpers/MemDebug.hpp"
    2121
    22 #include "Actions/SelectionAction/NotAtomByIdAction.hpp"
    23 #include "Actions/ActionRegistry.hpp"
    2422#include "atom.hpp"
    2523#include "Helpers/Log.hpp"
     
    3230using namespace std;
    3331
    34 #include "UIElements/UIFactory.hpp"
    35 #include "UIElements/Dialog.hpp"
    36 #include "Actions/ValueStorage.hpp"
     32#include "Actions/SelectionAction/NotAtomByIdAction.hpp"
    3733
     34// and construct the stuff
     35#include "NotAtomByIdAction.def"
     36#include "Action_impl_pre.hpp"
     37/** =========== define the function ====================== */
     38Action::state_ptr SelectionNotAtomByIdAction::performCall() {
     39  // obtain information
     40  getParametersfromValueStorage();
    3841
    39 // memento to remember the state when undoing
    40 
    41 class SelectionNotAtomByIdState : public ActionState {
    42 public:
    43   SelectionNotAtomByIdState(atom* _walker) :
    44     walker(_walker)
    45   {}
    46   atom* walker;
    47 };
    48 
    49 const char SelectionNotAtomByIdAction::NAME[] = "unselect-atom-by-id";
    50 
    51 SelectionNotAtomByIdAction::SelectionNotAtomByIdAction() :
    52   Action(NAME)
    53 {}
    54 
    55 SelectionNotAtomByIdAction::~SelectionNotAtomByIdAction()
    56 {}
    57 
    58 void SelectionNotAtomById(atom *_atom) {
    59   ValueStorage::getInstance().setCurrentValue(SelectionNotAtomByIdAction::NAME, _atom);
    60   ActionRegistry::getInstance().getActionByName(SelectionNotAtomByIdAction::NAME)->call(Action::NonInteractive);
    61 };
    62 
    63 void SelectionNotAtomByIdAction::getParametersfromValueStorage()
    64 {};
    65 
    66 Dialog* SelectionNotAtomByIdAction::fillDialog(Dialog *dialog) {
    67   ASSERT(dialog,"No Dialog given when filling action dialog");
    68 
    69   dialog->queryAtom(NAME, ValueStorage::getInstance().getDescription(NAME));
    70 
    71   return dialog;
    72 }
    73 
    74 Action::state_ptr SelectionNotAtomByIdAction::performCall() {
    75   atom *Walker = NULL;
    76 
    77   ValueStorage::getInstance().queryCurrentValue(NAME, Walker);
    78 
    79   if (World::getInstance().isSelected(Walker)) {
    80     DoLog(1) && (Log() << Verbose(1) << "Unselecting atom " << *Walker << endl);
    81     World::getInstance().unselectAtom(Walker);
    82     return Action::state_ptr(new SelectionNotAtomByIdState(Walker));
     42  if (World::getInstance().isSelected(params.Walker)) {
     43    DoLog(1) && (Log() << Verbose(1) << "Unselecting atom " << *params.Walker << endl);
     44    World::getInstance().unselectAtom(params.Walker);
     45    return Action::state_ptr(new SelectionNotAtomByIdState(params));
    8346  } else {
    8447    return Action::success;
     
    8952  SelectionNotAtomByIdState *state = assert_cast<SelectionNotAtomByIdState*>(_state.get());
    9053
    91   if (state->walker != NULL)
    92     World::getInstance().selectAtom(state->walker);
     54  if (state->params.Walker != NULL)
     55    World::getInstance().selectAtom(state->params.Walker);
    9356
    94   return Action::state_ptr(new SelectionNotAtomByIdState(state->walker));
     57  return Action::state_ptr(_state);
    9558}
    9659
     
    9861  SelectionNotAtomByIdState *state = assert_cast<SelectionNotAtomByIdState*>(_state.get());
    9962
    100   if (state->walker != NULL)
    101     World::getInstance().unselectAtom(state->walker);
     63  if (state->params.Walker != NULL)
     64    World::getInstance().unselectAtom(state->params.Walker);
    10265
    103   return Action::state_ptr(new SelectionNotAtomByIdState(state->walker));
     66  return Action::state_ptr(_state);
    10467}
    10568
     
    11578  return NAME;
    11679}
     80/** =========== end of function ====================== */
  • src/Actions/SelectionAction/NotAtomByIdAction.hpp

    r53d01c r1fd675  
    1111#include "Actions/Action.hpp"
    1212
    13 class atom;
    14 
    15 void SelectionNotAtomById(atom *_atom);
    16 
    17 class SelectionNotAtomByIdAction : public Action {
    18   friend void SelectionNotAtomById(atom *_atom);
    19 
    20 public:
    21   SelectionNotAtomByIdAction();
    22   virtual ~SelectionNotAtomByIdAction();
    23 
    24   bool canUndo();
    25   bool shouldUndo();
    26 
    27   virtual const std::string getName();
    28 protected:
    29   virtual Dialog * fillDialog(Dialog *dialog);
    30 private:
    31   virtual void getParametersfromValueStorage();
    32   virtual Action::state_ptr performCall();
    33   virtual Action::state_ptr performUndo(Action::state_ptr);
    34   virtual Action::state_ptr performRedo(Action::state_ptr);
    35 
    36   static const char NAME[];
    37 };
     13#include "NotAtomByIdAction.def"
     14#include "Action_impl_header.hpp"
    3815
    3916#endif /* NOTATOMBYIDACTION_HPP_ */
  • src/Actions/SelectionAction/NotMoleculeByFormulaAction.cpp

    r53d01c r1fd675  
    2020#include "Helpers/MemDebug.hpp"
    2121
    22 #include "Actions/SelectionAction/NotMoleculeByFormulaAction.hpp"
    23 #include "Actions/ActionRegistry.hpp"
    2422#include "Descriptors/MoleculeFormulaDescriptor.hpp"
    2523#include "molecule.hpp"
     
    3331using namespace std;
    3432
    35 #include "UIElements/UIFactory.hpp"
    36 #include "UIElements/Dialog.hpp"
    37 #include "Actions/ValueStorage.hpp"
     33#include "Actions/SelectionAction/NotMoleculeByFormulaAction.hpp"
    3834
    39 
    40 // memento to remember the state when undoing
    41 
    42 class SelectionNotMoleculeByFormulaState : public ActionState {
    43 public:
    44   SelectionNotMoleculeByFormulaState(std::vector<molecule*> selectedMolecules, const std::string &_formula) :
    45     selectedMolecules(selectedMolecules),
    46     formula(_formula)
    47   {}
    48   std::vector<molecule*> selectedMolecules;
    49   std::string formula;
    50 };
    51 
    52 const char SelectionNotMoleculeByFormulaAction::NAME[] = "unselect-molecule-by-formula";
    53 
    54 SelectionNotMoleculeByFormulaAction::SelectionNotMoleculeByFormulaAction() :
    55   Action(NAME)
    56 {}
    57 
    58 SelectionNotMoleculeByFormulaAction::~SelectionNotMoleculeByFormulaAction()
    59 {}
    60 
    61 void SelectionNotMoleculeByFormula(const std::string &_formula) {
    62   ValueStorage::getInstance().setCurrentValue(SelectionNotMoleculeByFormulaAction::NAME, _formula);
    63   ActionRegistry::getInstance().getActionByName(SelectionNotMoleculeByFormulaAction::NAME)->call(Action::NonInteractive);
    64 };
    65 
    66 void SelectionNotMoleculeByFormulaAction::getParametersfromValueStorage()
    67 {};
    68 
    69 Dialog* SelectionNotMoleculeByFormulaAction::fillDialog(Dialog *dialog) {
    70   ASSERT(dialog,"No Dialog given when filling action dialog");
    71 
    72   dialog->queryString(NAME, ValueStorage::getInstance().getDescription(NAME));
    73 
    74   return dialog;
    75 }
    76 
     35// and construct the stuff
     36#include "NotMoleculeByFormulaAction.def"
     37#include "Action_impl_pre.hpp"
     38/** =========== define the function ====================== */
    7739Action::state_ptr SelectionNotMoleculeByFormulaAction::performCall() {
    78   std::string formula;
    7940  std::vector<molecule *> selectedMolecules = World::getInstance().getSelectedMolecules();
    8041
    81   ValueStorage::getInstance().queryCurrentValue(NAME, formula);
     42  // obtain information
     43  getParametersfromValueStorage();
    8244
    83   DoLog(1) && (Log() << Verbose(1) << "Unselecting molecules with chemical formula " << formula << ":" << endl);
    84   std::vector<molecule *> matchingMolecules = World::getInstance().getAllMolecules(MoleculeByFormula(formula));
     45  DoLog(1) && (Log() << Verbose(1) << "Unselecting molecules with chemical formula " << params.formula << ":" << endl);
     46  std::vector<molecule *> matchingMolecules = World::getInstance().getAllMolecules(MoleculeByFormula(params.formula));
    8547  for (std::vector<molecule *>::const_iterator iter = matchingMolecules.begin(); iter != matchingMolecules.end(); ++iter) {
    8648    DoLog(1) && (Log() << Verbose(1) << "\t" << (*iter)->getId() << ", " << (*iter)->getName() << "." << endl);
    8749  }
    88   World::getInstance().unselectAllMolecules(MoleculeByFormula(formula));
    89   return Action::state_ptr(new SelectionNotMoleculeByFormulaState(selectedMolecules,formula));
     50  World::getInstance().unselectAllMolecules(MoleculeByFormula(params.formula));
     51  return Action::state_ptr(new SelectionNotMoleculeByFormulaState(selectedMolecules,params));
    9052}
    9153
     
    10365  SelectionNotMoleculeByFormulaState *state = assert_cast<SelectionNotMoleculeByFormulaState*>(_state.get());
    10466
    105   World::getInstance().unselectAllMolecules(MoleculeByFormula(state->formula));
     67  World::getInstance().unselectAllMolecules(MoleculeByFormula(state->params.formula));
    10668
    10769  return Action::state_ptr(_state);
     
    11981  return NAME;
    12082}
     83/** =========== end of function ====================== */
  • src/Actions/SelectionAction/NotMoleculeByFormulaAction.hpp

    r53d01c r1fd675  
    1111#include "Actions/Action.hpp"
    1212
    13 class molecule;
    14 
    15 void SelectionNotMoleculeByFormula(molecule *_mol);
    16 
    17 class SelectionNotMoleculeByFormulaAction : public Action {
    18   friend void SelectionNotMoleculeByFormula(const std::string &_formula);
    19 
    20 public:
    21   SelectionNotMoleculeByFormulaAction();
    22   virtual ~SelectionNotMoleculeByFormulaAction();
    23 
    24   bool canUndo();
    25   bool shouldUndo();
    26 
    27   virtual const std::string getName();
    28 protected:
    29   virtual Dialog * fillDialog(Dialog *dialog);
    30 private:
    31   virtual void getParametersfromValueStorage();
    32   virtual Action::state_ptr performCall();
    33   virtual Action::state_ptr performUndo(Action::state_ptr);
    34   virtual Action::state_ptr performRedo(Action::state_ptr);
    35 
    36   static const char NAME[];
    37 };
     13#include "NotMoleculeByFormulaAction.def"
     14#include "Action_impl_header.hpp"
    3815
    3916#endif /* NOTMOLECULEBYFORMULAACTION_HPP_ */
  • src/Actions/SelectionAction/NotMoleculeByIdAction.cpp

    r53d01c r1fd675  
    2020#include "Helpers/MemDebug.hpp"
    2121
    22 #include "Actions/SelectionAction/NotMoleculeByIdAction.hpp"
    23 #include "Actions/ActionRegistry.hpp"
    2422#include "molecule.hpp"
    2523#include "Helpers/Log.hpp"
     
    3230using namespace std;
    3331
    34 #include "UIElements/UIFactory.hpp"
    35 #include "UIElements/Dialog.hpp"
    36 #include "Actions/ValueStorage.hpp"
     32#include "Actions/SelectionAction/NotMoleculeByIdAction.hpp"
    3733
     34// and construct the stuff
     35#include "NotMoleculeByIdAction.def"
     36#include "Action_impl_pre.hpp"
     37/** =========== define the function ====================== */
     38Action::state_ptr SelectionNotMoleculeByIdAction::performCall() {
     39  // obtain information
     40  getParametersfromValueStorage();
    3841
    39 // memento to remember the state when undoing
    40 
    41 class SelectionNotMoleculeByIdState : public ActionState {
    42 public:
    43   SelectionNotMoleculeByIdState(molecule* _mol) :
    44     mol(_mol)
    45   {}
    46   molecule* mol;
    47 };
    48 
    49 const char SelectionNotMoleculeByIdAction::NAME[] = "unselect-molecule-by-id";
    50 
    51 SelectionNotMoleculeByIdAction::SelectionNotMoleculeByIdAction() :
    52   Action(NAME)
    53 {}
    54 
    55 SelectionNotMoleculeByIdAction::~SelectionNotMoleculeByIdAction()
    56 {}
    57 
    58 void SelectionNotMoleculeById(molecule *_mol) {
    59   ValueStorage::getInstance().setCurrentValue(SelectionNotMoleculeByIdAction::NAME, _mol);
    60   ActionRegistry::getInstance().getActionByName(SelectionNotMoleculeByIdAction::NAME)->call(Action::NonInteractive);
    61 };
    62 
    63 void SelectionNotMoleculeByIdAction::getParametersfromValueStorage()
    64 {};
    65 
    66 Dialog* SelectionNotMoleculeByIdAction::fillDialog(Dialog *dialog) {
    67   ASSERT(dialog,"No Dialog given when filling action dialog");
    68 
    69   dialog->queryMolecule(NAME, ValueStorage::getInstance().getDescription(NAME));
    70 
    71   return dialog;
    72 }
    73 
    74 Action::state_ptr SelectionNotMoleculeByIdAction::performCall() {
    75   molecule *mol = NULL;
    76 
    77   ValueStorage::getInstance().queryCurrentValue(NAME, mol);
    78 
    79   if (World::getInstance().isSelected(mol)) {
    80     DoLog(1) && (Log() << Verbose(1) << "Unselecting molecule " << mol->name << endl);
    81     World::getInstance().unselectMolecule(mol);
    82     return Action::state_ptr(new SelectionNotMoleculeByIdState(mol));
     42  if (World::getInstance().isSelected(params.mol)) {
     43    DoLog(1) && (Log() << Verbose(1) << "Unselecting molecule " << params.mol->name << endl);
     44    World::getInstance().unselectMolecule(params.mol);
     45    return Action::state_ptr(new SelectionNotMoleculeByIdState(params));
    8346  } else {
    8447    return Action::success;
     
    8952  SelectionNotMoleculeByIdState *state = assert_cast<SelectionNotMoleculeByIdState*>(_state.get());
    9053
    91   if (state->mol != NULL)
    92     World::getInstance().selectMolecule(state->mol);
     54  if (state->params.mol != NULL)
     55    World::getInstance().selectMolecule(state->params.mol);
    9356
    94   return Action::state_ptr(new SelectionNotMoleculeByIdState(state->mol));
     57  return Action::state_ptr(_state);
    9558}
    9659
     
    9861  SelectionNotMoleculeByIdState *state = assert_cast<SelectionNotMoleculeByIdState*>(_state.get());
    9962
    100   if (state->mol != NULL)
    101     World::getInstance().unselectMolecule(state->mol);
     63  if (state->params.mol != NULL)
     64    World::getInstance().unselectMolecule(state->params.mol);
    10265
    103   return Action::state_ptr(new SelectionNotMoleculeByIdState(state->mol));
     66  return Action::state_ptr(_state);
    10467}
    10568
     
    11578  return NAME;
    11679}
     80/** =========== end of function ====================== */
  • src/Actions/SelectionAction/NotMoleculeByIdAction.hpp

    r53d01c r1fd675  
    1111#include "Actions/Action.hpp"
    1212
    13 class molecule;
    14 
    15 void SelectionNotMoleculeById(molecule *_mol);
    16 
    17 class SelectionNotMoleculeByIdAction : public Action {
    18   friend void SelectionNotMoleculeById(molecule *_mol);
    19 
    20 public:
    21   SelectionNotMoleculeByIdAction();
    22   virtual ~SelectionNotMoleculeByIdAction();
    23 
    24   bool canUndo();
    25   bool shouldUndo();
    26 
    27   virtual const std::string getName();
    28 protected:
    29   virtual Dialog * fillDialog(Dialog *dialog);
    30 private:
    31   virtual void getParametersfromValueStorage();
    32   virtual Action::state_ptr performCall();
    33   virtual Action::state_ptr performUndo(Action::state_ptr);
    34   virtual Action::state_ptr performRedo(Action::state_ptr);
    35 
    36   static const char NAME[];
    37 };
     13#include "NotMoleculeByIdAction.def"
     14#include "Action_impl_header.hpp"
    3815
    3916#endif /* NOTMOLECULEBYIDACTION_HPP_ */
  • src/Actions/SelectionAction/NotMoleculeOfAtomAction.cpp

    r53d01c r1fd675  
    2020#include "Helpers/MemDebug.hpp"
    2121
    22 #include "Actions/SelectionAction/NotMoleculeOfAtomAction.hpp"
    23 #include "Actions/ActionRegistry.hpp"
    2422#include "Descriptors/MoleculeDescriptor.hpp"
    2523#include "atom.hpp"
     
    3331using namespace std;
    3432
    35 #include "UIElements/UIFactory.hpp"
    36 #include "UIElements/Dialog.hpp"
    37 #include "Actions/ValueStorage.hpp"
     33#include "Actions/SelectionAction/NotMoleculeOfAtomAction.hpp"
    3834
    39 
    40 // memento to remember the state when undoing
    41 
    42 class SelectionNotMoleculeOfAtomState : public ActionState {
    43 public:
    44   SelectionNotMoleculeOfAtomState(std::vector<molecule*> selectedMolecules, atom *_Walker) :
    45     selectedMolecules(selectedMolecules),
    46     Walker(_Walker)
    47   {}
    48   std::vector<molecule*> selectedMolecules;
    49   atom *Walker;
    50 };
    51 
    52 const char SelectionNotMoleculeOfAtomAction::NAME[] = "unselect-molecule-of-atom";
    53 
    54 SelectionNotMoleculeOfAtomAction::SelectionNotMoleculeOfAtomAction() :
    55   Action(NAME)
    56 {}
    57 
    58 SelectionNotMoleculeOfAtomAction::~SelectionNotMoleculeOfAtomAction()
    59 {}
    60 
    61 void SelectionNotMoleculeOfAtom() {
    62   ActionRegistry::getInstance().getActionByName(SelectionNotMoleculeOfAtomAction::NAME)->call(Action::NonInteractive);
    63 };
    64 
    65 void SelectionNotMoleculeOfAtomAction::getParametersfromValueStorage()
    66 {};
    67 
    68 Dialog* SelectionNotMoleculeOfAtomAction::fillDialog(Dialog *dialog) {
    69   ASSERT(dialog,"No Dialog given when filling action dialog");
    70 
    71   dialog->queryAtom(NAME, ValueStorage::getInstance().getDescription(NAME));
    72 
    73   return dialog;
    74 }
    75 
     35// and construct the stuff
     36#include "NotMoleculeOfAtomAction.def"
     37#include "Action_impl_pre.hpp"
     38/** =========== define the function ====================== */
    7639Action::state_ptr SelectionNotMoleculeOfAtomAction::performCall() {
    77   atom *Walker = NULL;
    78 
    79   ValueStorage::getInstance().queryCurrentValue(NAME, Walker);
     40  // obtain information
     41  getParametersfromValueStorage();
    8042
    8143  std::vector<molecule *> selectedMolecules = World::getInstance().getSelectedMolecules();
    82   DoLog(1) && (Log() << Verbose(1) << "Unselecting molecule to which " << Walker->getName() << " belongs." << endl);
    83   World::getInstance().unselectMoleculeOfAtom(Walker);
    84   return Action::state_ptr(new SelectionNotMoleculeOfAtomState(selectedMolecules, Walker));
     44  DoLog(1) && (Log() << Verbose(1) << "Unselecting molecule to which " << params.Walker->getName() << " belongs." << endl);
     45  World::getInstance().unselectMoleculeOfAtom(params.Walker);
     46  return Action::state_ptr(new SelectionNotMoleculeOfAtomState(selectedMolecules, params));
    8547}
    8648
     
    9254    World::getInstance().selectMolecule(*iter);
    9355
    94   return Action::state_ptr(new SelectionNotMoleculeOfAtomState(state->selectedMolecules, state->Walker));
     56  return Action::state_ptr(_state);
    9557}
    9658
     
    9860  SelectionNotMoleculeOfAtomState *state = assert_cast<SelectionNotMoleculeOfAtomState*>(_state.get());
    9961
    100   World::getInstance().unselectMoleculeOfAtom(state->Walker);
     62  World::getInstance().unselectMoleculeOfAtom(state->params.Walker);
    10163
    102   return Action::state_ptr(new SelectionNotMoleculeOfAtomState(state->selectedMolecules, state->Walker));
     64  return Action::state_ptr(_state);
    10365}
    10466
     
    11476  return NAME;
    11577}
     78/** =========== end of function ====================== */
  • src/Actions/SelectionAction/NotMoleculeOfAtomAction.hpp

    r53d01c r1fd675  
    1111#include "Actions/Action.hpp"
    1212
    13 void SelectionNotMoleculeOfAtom();
    14 
    15 class SelectionNotMoleculeOfAtomAction : public Action {
    16   friend void SelectionNotMoleculeOfAtom();
    17 
    18 public:
    19   SelectionNotMoleculeOfAtomAction();
    20   virtual ~SelectionNotMoleculeOfAtomAction();
    21 
    22   bool canUndo();
    23   bool shouldUndo();
    24 
    25   virtual const std::string getName();
    26 protected:
    27   virtual Dialog * fillDialog(Dialog *dialog);
    28 private:
    29   virtual void getParametersfromValueStorage();
    30   virtual Action::state_ptr performCall();
    31   virtual Action::state_ptr performUndo(Action::state_ptr);
    32   virtual Action::state_ptr performRedo(Action::state_ptr);
    33 
    34   static const char NAME[];
    35 };
     13#include "NotMoleculeOfAtomAction.def"
     14#include "Action_impl_header.hpp"
    3615
    3716#endif /* NOTMOLECULEOFATOMSACTION_HPP_ */
Note: See TracChangeset for help on using the changeset viewer.