Index: src/Actions/SelectionAction/AllAtomsAction.cpp
===================================================================
--- src/Actions/SelectionAction/AllAtomsAction.cpp	(revision e472eab9f7f6929151469defe1f2df63c0c7f1f5)
+++ src/Actions/SelectionAction/AllAtomsAction.cpp	(revision e472eab9f7f6929151469defe1f2df63c0c7f1f5)
@@ -0,0 +1,89 @@
+/*
+ * AllAtomsAction.cpp
+ *
+ *  Created on: May 12, 2010
+ *      Author: heber
+ */
+
+#include "Helpers/MemDebug.hpp"
+
+#include "Actions/SelectionAction/AllAtomsAction.hpp"
+#include "Descriptors/AtomDescriptor.hpp"
+#include "atom.hpp"
+#include "log.hpp"
+#include "verbose.hpp"
+#include "World.hpp"
+
+#include <iostream>
+#include <string>
+
+using namespace std;
+
+#include "UIElements/UIFactory.hpp"
+#include "UIElements/Dialog.hpp"
+#include "UIElements/ValueStorage.hpp"
+
+
+// memento to remember the state when undoing
+
+class SelectionAllAtomsState : public ActionState {
+public:
+  SelectionAllAtomsState(std::vector<atom*> _selectedAtoms) :
+    selectedAtoms(_selectedAtoms)
+  {}
+  std::vector<atom*> selectedAtoms;
+};
+
+const char SelectionAllAtomsAction::NAME[] = "select-all-atoms";
+
+SelectionAllAtomsAction::SelectionAllAtomsAction() :
+  Action(NAME)
+{}
+
+SelectionAllAtomsAction::~SelectionAllAtomsAction()
+{}
+
+Dialog* SelectionAllAtomsAction::createDialog() {
+  Dialog *dialog = UIFactory::getInstance().makeDialog();
+
+  dialog->queryEmpty(NAME, ValueStorage::getInstance().getDescription(NAME));
+
+  return dialog;
+}
+
+Action::state_ptr SelectionAllAtomsAction::performCall() {
+  std::vector<atom *> selectedAtoms = World::getInstance().getSelectedAtoms();
+  DoLog(1) && (Log() << Verbose(1) << "Selecting all atoms." << endl);
+  World::getInstance().selectAllAtoms(AllAtoms());
+  return Action::state_ptr(new SelectionAllAtomsState(selectedAtoms));
+}
+
+Action::state_ptr SelectionAllAtomsAction::performUndo(Action::state_ptr _state) {
+  SelectionAllAtomsState *state = assert_cast<SelectionAllAtomsState*>(_state.get());
+
+  World::getInstance().clearAtomSelection();
+  for(std::vector<atom *>::iterator iter = state->selectedAtoms.begin(); iter != state->selectedAtoms.end(); ++iter)
+    World::getInstance().selectAtom(*iter);
+
+  return Action::state_ptr(new SelectionAllAtomsState(state->selectedAtoms));
+}
+
+Action::state_ptr SelectionAllAtomsAction::performRedo(Action::state_ptr _state){
+  SelectionAllAtomsState *state = assert_cast<SelectionAllAtomsState*>(_state.get());
+
+  World::getInstance().selectAllAtoms(AllAtoms());
+
+  return Action::state_ptr(new SelectionAllAtomsState(state->selectedAtoms));
+}
+
+bool SelectionAllAtomsAction::canUndo() {
+  return true;
+}
+
+bool SelectionAllAtomsAction::shouldUndo() {
+  return true;
+}
+
+const string SelectionAllAtomsAction::getName() {
+  return NAME;
+}
Index: src/Actions/SelectionAction/AllAtomsAction.hpp
===================================================================
--- src/Actions/SelectionAction/AllAtomsAction.hpp	(revision e472eab9f7f6929151469defe1f2df63c0c7f1f5)
+++ src/Actions/SelectionAction/AllAtomsAction.hpp	(revision e472eab9f7f6929151469defe1f2df63c0c7f1f5)
@@ -0,0 +1,31 @@
+/*
+ * AllAtomsAction.hpp
+ *
+ *  Created on: May 12, 2010
+ *      Author: heber
+ */
+
+#ifndef ALLATOMSACTION_HPP_
+#define ALLATOMSACTION_HPP_
+
+#include "Actions/Action.hpp"
+
+class SelectionAllAtomsAction : public Action {
+public:
+  SelectionAllAtomsAction();
+  virtual ~SelectionAllAtomsAction();
+
+  bool canUndo();
+  bool shouldUndo();
+
+  virtual const std::string getName();
+private:
+  virtual Dialog* createDialog();
+  virtual Action::state_ptr performCall();
+  virtual Action::state_ptr performUndo(Action::state_ptr);
+  virtual Action::state_ptr performRedo(Action::state_ptr);
+
+  static const char NAME[];
+};
+
+#endif /* ALLATOMSACTION_HPP_ */
Index: src/Actions/SelectionAction/AllMoleculesAction.cpp
===================================================================
--- src/Actions/SelectionAction/AllMoleculesAction.cpp	(revision e472eab9f7f6929151469defe1f2df63c0c7f1f5)
+++ src/Actions/SelectionAction/AllMoleculesAction.cpp	(revision e472eab9f7f6929151469defe1f2df63c0c7f1f5)
@@ -0,0 +1,89 @@
+/*
+ * AllMoleculesAction.cpp
+ *
+ *  Created on: May 12, 2010
+ *      Author: heber
+ */
+
+#include "Helpers/MemDebug.hpp"
+
+#include "Actions/SelectionAction/AllMoleculesAction.hpp"
+#include "Descriptors/MoleculeDescriptor.hpp"
+#include "atom.hpp"
+#include "log.hpp"
+#include "verbose.hpp"
+#include "World.hpp"
+
+#include <iostream>
+#include <string>
+
+using namespace std;
+
+#include "UIElements/UIFactory.hpp"
+#include "UIElements/Dialog.hpp"
+#include "UIElements/ValueStorage.hpp"
+
+
+// memento to remember the state when undoing
+
+class SelectionAllMoleculesState : public ActionState {
+public:
+  SelectionAllMoleculesState(std::vector<molecule*> selectedMolecules) :
+    selectedMolecules(selectedMolecules)
+  {}
+  std::vector<molecule*> selectedMolecules;
+};
+
+const char SelectionAllMoleculesAction::NAME[] = "select-all-molecules";
+
+SelectionAllMoleculesAction::SelectionAllMoleculesAction() :
+  Action(NAME)
+{}
+
+SelectionAllMoleculesAction::~SelectionAllMoleculesAction()
+{}
+
+Dialog* SelectionAllMoleculesAction::createDialog() {
+  Dialog *dialog = UIFactory::getInstance().makeDialog();
+
+  dialog->queryEmpty(NAME, ValueStorage::getInstance().getDescription(NAME));
+
+  return dialog;
+}
+
+Action::state_ptr SelectionAllMoleculesAction::performCall() {
+  std::vector<molecule *> selectedMolecules = World::getInstance().getSelectedMolecules();
+  DoLog(1) && (Log() << Verbose(1) << "Selecting all molecules." << endl);
+  World::getInstance().selectAllMolecules(AllMolecules());
+  return Action::state_ptr(new SelectionAllMoleculesState(selectedMolecules));
+}
+
+Action::state_ptr SelectionAllMoleculesAction::performUndo(Action::state_ptr _state) {
+  SelectionAllMoleculesState *state = assert_cast<SelectionAllMoleculesState*>(_state.get());
+
+  World::getInstance().clearMoleculeSelection();
+  for(std::vector<molecule *>::iterator iter = state->selectedMolecules.begin(); iter != state->selectedMolecules.end(); ++iter)
+    World::getInstance().selectMolecule(*iter);
+
+  return Action::state_ptr(new SelectionAllMoleculesState(state->selectedMolecules));
+}
+
+Action::state_ptr SelectionAllMoleculesAction::performRedo(Action::state_ptr _state){
+  SelectionAllMoleculesState *state = assert_cast<SelectionAllMoleculesState*>(_state.get());
+
+  World::getInstance().selectAllMolecules(AllMolecules());
+
+  return Action::state_ptr(new SelectionAllMoleculesState(state->selectedMolecules));
+}
+
+bool SelectionAllMoleculesAction::canUndo() {
+  return true;
+}
+
+bool SelectionAllMoleculesAction::shouldUndo() {
+  return true;
+}
+
+const string SelectionAllMoleculesAction::getName() {
+  return NAME;
+}
Index: src/Actions/SelectionAction/AllMoleculesAction.hpp
===================================================================
--- src/Actions/SelectionAction/AllMoleculesAction.hpp	(revision e472eab9f7f6929151469defe1f2df63c0c7f1f5)
+++ src/Actions/SelectionAction/AllMoleculesAction.hpp	(revision e472eab9f7f6929151469defe1f2df63c0c7f1f5)
@@ -0,0 +1,31 @@
+/*
+ * AllMoleculesAction.hpp
+ *
+ *  Created on: May 12, 2010
+ *      Author: heber
+ */
+
+#ifndef ALLMOLECULESSACTION_HPP_
+#define ALLMOLECULESSACTION_HPP_
+
+#include "Actions/Action.hpp"
+
+class SelectionAllMoleculesAction : public Action {
+public:
+  SelectionAllMoleculesAction();
+  virtual ~SelectionAllMoleculesAction();
+
+  bool canUndo();
+  bool shouldUndo();
+
+  virtual const std::string getName();
+private:
+  virtual Dialog* createDialog();
+  virtual Action::state_ptr performCall();
+  virtual Action::state_ptr performUndo(Action::state_ptr);
+  virtual Action::state_ptr performRedo(Action::state_ptr);
+
+  static const char NAME[];
+};
+
+#endif /* ALLMOLECULESSACTION_HPP_ */
Index: src/Actions/SelectionAction/NotAllAtomsAction.cpp
===================================================================
--- src/Actions/SelectionAction/NotAllAtomsAction.cpp	(revision e472eab9f7f6929151469defe1f2df63c0c7f1f5)
+++ src/Actions/SelectionAction/NotAllAtomsAction.cpp	(revision e472eab9f7f6929151469defe1f2df63c0c7f1f5)
@@ -0,0 +1,89 @@
+/*
+ * NotAllAtomsAction.cpp
+ *
+ *  Created on: May 12, 2010
+ *      Author: heber
+ */
+
+#include "Helpers/MemDebug.hpp"
+
+#include "Actions/SelectionAction/NotAllAtomsAction.hpp"
+#include "Descriptors/AtomDescriptor.hpp"
+#include "atom.hpp"
+#include "log.hpp"
+#include "verbose.hpp"
+#include "World.hpp"
+
+#include <iostream>
+#include <string>
+
+using namespace std;
+
+#include "UIElements/UIFactory.hpp"
+#include "UIElements/Dialog.hpp"
+#include "UIElements/ValueStorage.hpp"
+
+
+// memento to remember the state when undoing
+
+class SelectionAllAtomsState : public ActionState {
+public:
+  SelectionAllAtomsState(std::vector<atom*> _selectedAtoms) :
+    selectedAtoms(_selectedAtoms)
+  {}
+  std::vector<atom*> selectedAtoms;
+};
+
+const char SelectionNotAllAtomsAction::NAME[] = "unselect-all-atoms";
+
+SelectionNotAllAtomsAction::SelectionNotAllAtomsAction() :
+  Action(NAME)
+{}
+
+SelectionNotAllAtomsAction::~SelectionNotAllAtomsAction()
+{}
+
+Dialog* SelectionNotAllAtomsAction::createDialog() {
+  Dialog *dialog = UIFactory::getInstance().makeDialog();
+
+  dialog->queryEmpty(NAME, ValueStorage::getInstance().getDescription(NAME));
+
+  return dialog;
+}
+
+Action::state_ptr SelectionNotAllAtomsAction::performCall() {
+  std::vector<atom *> selectedAtoms = World::getInstance().getSelectedAtoms();
+  DoLog(1) && (Log() << Verbose(1) << "Unselecting all atoms." << endl);
+  World::getInstance().clearAtomSelection();
+  return Action::state_ptr(new SelectionAllAtomsState(selectedAtoms));
+}
+
+Action::state_ptr SelectionNotAllAtomsAction::performUndo(Action::state_ptr _state) {
+  SelectionAllAtomsState *state = assert_cast<SelectionAllAtomsState*>(_state.get());
+
+  World::getInstance().clearAtomSelection();
+  for(std::vector<atom *>::iterator iter = state->selectedAtoms.begin(); iter != state->selectedAtoms.end(); ++iter)
+    World::getInstance().selectAtom(*iter);
+
+  return Action::state_ptr(new SelectionAllAtomsState(state->selectedAtoms));
+}
+
+Action::state_ptr SelectionNotAllAtomsAction::performRedo(Action::state_ptr _state){
+  SelectionAllAtomsState *state = assert_cast<SelectionAllAtomsState*>(_state.get());
+
+  World::getInstance().clearAtomSelection();
+
+  return Action::state_ptr(new SelectionAllAtomsState(state->selectedAtoms));
+}
+
+bool SelectionNotAllAtomsAction::canUndo() {
+  return true;
+}
+
+bool SelectionNotAllAtomsAction::shouldUndo() {
+  return true;
+}
+
+const string SelectionNotAllAtomsAction::getName() {
+  return NAME;
+}
Index: src/Actions/SelectionAction/NotAllAtomsAction.hpp
===================================================================
--- src/Actions/SelectionAction/NotAllAtomsAction.hpp	(revision e472eab9f7f6929151469defe1f2df63c0c7f1f5)
+++ src/Actions/SelectionAction/NotAllAtomsAction.hpp	(revision e472eab9f7f6929151469defe1f2df63c0c7f1f5)
@@ -0,0 +1,31 @@
+/*
+ * NotAllAtomsAction.hpp
+ *
+ *  Created on: May 12, 2010
+ *      Author: heber
+ */
+
+#ifndef NOTALLATOMSACTION_HPP_
+#define NOTALLATOMSACTION_HPP_
+
+#include "Actions/Action.hpp"
+
+class SelectionNotAllAtomsAction : public Action {
+public:
+  SelectionNotAllAtomsAction();
+  virtual ~SelectionNotAllAtomsAction();
+
+  bool canUndo();
+  bool shouldUndo();
+
+  virtual const std::string getName();
+private:
+  virtual Dialog* createDialog();
+  virtual Action::state_ptr performCall();
+  virtual Action::state_ptr performUndo(Action::state_ptr);
+  virtual Action::state_ptr performRedo(Action::state_ptr);
+
+  static const char NAME[];
+};
+
+#endif /* NOTALLATOMSACTION_HPP_ */
Index: src/Actions/SelectionAction/NotAllMoleculesAction.cpp
===================================================================
--- src/Actions/SelectionAction/NotAllMoleculesAction.cpp	(revision e472eab9f7f6929151469defe1f2df63c0c7f1f5)
+++ src/Actions/SelectionAction/NotAllMoleculesAction.cpp	(revision e472eab9f7f6929151469defe1f2df63c0c7f1f5)
@@ -0,0 +1,89 @@
+/*
+ * NotAllMoleculesAction.cpp
+ *
+ *  Created on: May 12, 2010
+ *      Author: heber
+ */
+
+#include "Helpers/MemDebug.hpp"
+
+#include "Actions/SelectionAction/NotAllMoleculesAction.hpp"
+#include "Descriptors/MoleculeDescriptor.hpp"
+#include "atom.hpp"
+#include "log.hpp"
+#include "verbose.hpp"
+#include "World.hpp"
+
+#include <iostream>
+#include <string>
+
+using namespace std;
+
+#include "UIElements/UIFactory.hpp"
+#include "UIElements/Dialog.hpp"
+#include "UIElements/ValueStorage.hpp"
+
+
+// memento to remember the state when undoing
+
+class SelectionNotAllMoleculesState : public ActionState {
+public:
+  SelectionNotAllMoleculesState(std::vector<molecule*> selectedMolecules) :
+    selectedMolecules(selectedMolecules)
+  {}
+  std::vector<molecule*> selectedMolecules;
+};
+
+const char SelectionNotAllMoleculesAction::NAME[] = "unselect-all-molecules";
+
+SelectionNotAllMoleculesAction::SelectionNotAllMoleculesAction() :
+  Action(NAME)
+{}
+
+SelectionNotAllMoleculesAction::~SelectionNotAllMoleculesAction()
+{}
+
+Dialog* SelectionNotAllMoleculesAction::createDialog() {
+  Dialog *dialog = UIFactory::getInstance().makeDialog();
+
+  dialog->queryEmpty(NAME, ValueStorage::getInstance().getDescription(NAME));
+
+  return dialog;
+}
+
+Action::state_ptr SelectionNotAllMoleculesAction::performCall() {
+  std::vector<molecule *> selectedMolecules = World::getInstance().getSelectedMolecules();
+  DoLog(1) && (Log() << Verbose(1) << "Unselecting all molecules." << endl);
+  World::getInstance().clearMoleculeSelection();
+  return Action::state_ptr(new SelectionNotAllMoleculesState(selectedMolecules));
+}
+
+Action::state_ptr SelectionNotAllMoleculesAction::performUndo(Action::state_ptr _state) {
+  SelectionNotAllMoleculesState *state = assert_cast<SelectionNotAllMoleculesState*>(_state.get());
+
+  World::getInstance().clearMoleculeSelection();
+  for(std::vector<molecule *>::iterator iter = state->selectedMolecules.begin(); iter != state->selectedMolecules.end(); ++iter)
+    World::getInstance().selectMolecule(*iter);
+
+  return Action::state_ptr(new SelectionNotAllMoleculesState(state->selectedMolecules));
+}
+
+Action::state_ptr SelectionNotAllMoleculesAction::performRedo(Action::state_ptr _state){
+  SelectionNotAllMoleculesState *state = assert_cast<SelectionNotAllMoleculesState*>(_state.get());
+
+  World::getInstance().clearMoleculeSelection();
+
+  return Action::state_ptr(new SelectionNotAllMoleculesState(state->selectedMolecules));
+}
+
+bool SelectionNotAllMoleculesAction::canUndo() {
+  return true;
+}
+
+bool SelectionNotAllMoleculesAction::shouldUndo() {
+  return true;
+}
+
+const string SelectionNotAllMoleculesAction::getName() {
+  return NAME;
+}
Index: src/Actions/SelectionAction/NotAllMoleculesAction.hpp
===================================================================
--- src/Actions/SelectionAction/NotAllMoleculesAction.hpp	(revision e472eab9f7f6929151469defe1f2df63c0c7f1f5)
+++ src/Actions/SelectionAction/NotAllMoleculesAction.hpp	(revision e472eab9f7f6929151469defe1f2df63c0c7f1f5)
@@ -0,0 +1,31 @@
+/*
+ * NotAllMoleculesAction.hpp
+ *
+ *  Created on: May 12, 2010
+ *      Author: heber
+ */
+
+#ifndef NOTALLMOLECULESSACTION_HPP_
+#define NOTALLMOLECULESSACTION_HPP_
+
+#include "Actions/Action.hpp"
+
+class SelectionNotAllMoleculesAction : public Action {
+public:
+  SelectionNotAllMoleculesAction();
+  virtual ~SelectionNotAllMoleculesAction();
+
+  bool canUndo();
+  bool shouldUndo();
+
+  virtual const std::string getName();
+private:
+  virtual Dialog* createDialog();
+  virtual Action::state_ptr performCall();
+  virtual Action::state_ptr performUndo(Action::state_ptr);
+  virtual Action::state_ptr performRedo(Action::state_ptr);
+
+  static const char NAME[];
+};
+
+#endif /* NOTALLMOLECULESSACTION_HPP_ */
