Index: src/Actions/ShapeAction/CombineShapesAction.cpp
===================================================================
--- src/Actions/ShapeAction/CombineShapesAction.cpp	(revision ff9e5aa00cb3a198f58315ad4dda3952ed5b34eb)
+++ src/Actions/ShapeAction/CombineShapesAction.cpp	(revision ff9e5aa00cb3a198f58315ad4dda3952ed5b34eb)
@@ -0,0 +1,146 @@
+/*
+ * Project: MoleCuilder
+ * Description: creates and alters molecular systems
+ * Copyright (C)  2010-2012 University of Bonn. All rights reserved.
+ *
+ *
+ *   This file is part of MoleCuilder.
+ *
+ *    MoleCuilder is free software: you can redistribute it and/or modify
+ *    it under the terms of the GNU General Public License as published by
+ *    the Free Software Foundation, either version 2 of the License, or
+ *    (at your option) any later version.
+ *
+ *    MoleCuilder is distributed in the hope that it will be useful,
+ *    but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *    GNU General Public License for more details.
+ *
+ *    You should have received a copy of the GNU General Public License
+ *    along with MoleCuilder.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+/*
+ * CombineShapesAction.cpp
+ *
+ *  Created on: Oct 1, 2012
+ *      Author: ankele
+ */
+
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "CodePatterns/MemDebug.hpp"
+
+#include "Shapes/BaseShapes.hpp"
+#include "Shapes/ShapeRegistry.hpp"
+#include "CodePatterns/Log.hpp"
+#include "CodePatterns/Verbose.hpp"
+
+#include <iostream>
+#include <string>
+
+#include "CombineShapesAction.hpp"
+
+using namespace MoleCuilder;
+
+// and construct the stuff
+#include "CombineShapesAction.def"
+#include "Action_impl_pre.hpp"
+/** =========== define the function ====================== */
+Action::state_ptr ShapeCombineShapesAction::performCall() {
+  LOG(1, "Combining shapes in ShapeRegistry.");
+
+  std::vector<Shape*> selectedShapes = ShapeRegistry::getInstance().getSelectedShapes();
+  Shape s = Sphere();
+
+  std::string op = params.shape_op.get();
+  if (op == "AND"){
+    if (selectedShapes.size() != 2){
+      ELOG(1, "Operation AND requires exactly 2 selected shapes.");
+      return Action::failure;
+    }
+    s = (*selectedShapes[0]) && (*selectedShapes[1]);
+  }else if (op == "OR"){
+    if (selectedShapes.size() != 2){
+      ELOG(1, "Operation OR requires exactly 2 selected shapes.");
+      return Action::failure;
+    }
+    s = (*selectedShapes[0]) || (*selectedShapes[1]);
+  }else if (op == "NOT"){
+    if (selectedShapes.size() != 1){
+      ELOG(1, "Operation NOT requires exactly 1 selected shape.");
+      return Action::failure;
+    }
+    s = ! (*selectedShapes[0]);
+  }else{
+    ASSERT(0, "ShapeCombineShapesAction::performCall() - unhandled shape operation");
+  }
+
+  if (params.shape_name.get() != "")
+    s.setName(params.shape_name.get());
+  else
+    s.setName(ShapeRegistry::getInstance().getDefaultNameForShape(s));
+  std::string old_name = s.getName();
+  std::cout << s.getName() << "\n";
+  ShapeRegistry::getInstance().addShape(s);
+
+  return Action::state_ptr(new ShapeCombineShapesState(old_name, params));
+}
+
+Action::state_ptr ShapeCombineShapesAction::performUndo(Action::state_ptr _state) {
+  ShapeCombineShapesState *state = assert_cast<ShapeCombineShapesState*>(_state.get());
+
+  LOG(1, "INFO: Removing '" << state->old_name << "' from ShapeRegistry.");
+
+  std::cout << state->old_name << "\n";
+  ShapeRegistry::getInstance().removeShape(state->old_name);
+
+  return Action::state_ptr(_state);
+}
+
+Action::state_ptr ShapeCombineShapesAction::performRedo(Action::state_ptr _state){
+  ShapeCombineShapesState *state = assert_cast<ShapeCombineShapesState*>(_state.get());
+
+  std::vector<Shape*> selectedShapes = ShapeRegistry::getInstance().getSelectedShapes();
+  Shape s = Sphere();
+
+  std::string op = params.shape_op.get();
+  if (op == "AND"){
+    if (selectedShapes.size() != 2){
+      ELOG(1, "Operation AND requires exactly 2 selected shapes.");
+      return Action::failure;
+    }
+    s = (*selectedShapes[0]) && (*selectedShapes[1]);
+  }else if (op == "OR"){
+    if (selectedShapes.size() != 2){
+      ELOG(1, "Operation OR requires exactly 2 selected shapes.");
+      return Action::failure;
+    }
+    s = (*selectedShapes[0]) || (*selectedShapes[1]);
+  }else if (op == "NOT"){
+    if (selectedShapes.size() != 1){
+      ELOG(1, "Operation NOT requires exactly 1 selected shape.");
+      return Action::failure;
+    }
+    s = ! (*selectedShapes[0]);
+  }else{
+    ASSERT(0, "ShapeCombineShapesAction::performCall() - unhandled shape operation");
+  }
+
+  s.setName(state->old_name);
+  ShapeRegistry::getInstance().addShape(s);
+
+  return Action::state_ptr(_state);
+}
+
+bool ShapeCombineShapesAction::canUndo() {
+  return true;
+}
+
+bool ShapeCombineShapesAction::shouldUndo() {
+  return true;
+}
+/** =========== end of function ====================== */
Index: src/Actions/ShapeAction/CombineShapesAction.def
===================================================================
--- src/Actions/ShapeAction/CombineShapesAction.def	(revision ff9e5aa00cb3a198f58315ad4dda3952ed5b34eb)
+++ src/Actions/ShapeAction/CombineShapesAction.def	(revision ff9e5aa00cb3a198f58315ad4dda3952ed5b34eb)
@@ -0,0 +1,40 @@
+/*
+ * CombineShapesAction.def
+ *
+ *  Created on: Oct 1, 2012
+ *      Author: ankele
+ */
+
+// all includes and forward declarations necessary for non-integral types below
+#include <boost/filesystem.hpp>
+
+#include "Parameters/Validators/DummyValidator.hpp"
+#include "Parameters/Validators/Specific/ShapeOpValidator.hpp"
+
+// i.e. there is an integer with variable name Z that can be found in
+// ValueStorage by the token "Z" -> first column: int, Z, "Z"
+// "undefine" if no parameters are required, use (NOPARAM_DEFAULT) for each (undefined) default value
+#define paramtypes (std::string)(std::string)
+#define paramtokens ("shape-name")("shape-op")
+#define paramdescriptions ("name shape to create")("combining operation")
+#define paramdefaults (PARAM_DEFAULT(std::string("")))(NOPARAM_DEFAULT)
+#define paramreferences (shape_name)(shape_op)
+#define paramvalids \
+(DummyValidator<std::string>()) \
+(ShapeOpValidator())
+
+#define statetypes (std::string)
+#define statereferences (old_name)
+
+
+// some defines for all the names, you may use ACTION, STATE and PARAMS
+#define CATEGORY Shape
+#define MENUNAME "shape"
+#define MENUPOSITION 3
+#define ACTIONNAME CombineShapes
+#define TOKEN "combine-shapes"
+
+
+// finally the information stored in the ActionTrait specialization
+#define DESCRIPTION "creates a new shape by combining one or two selected shapes"
+#undef SHORTFORM
Index: src/Actions/ShapeAction/CombineShapesAction.hpp
===================================================================
--- src/Actions/ShapeAction/CombineShapesAction.hpp	(revision ff9e5aa00cb3a198f58315ad4dda3952ed5b34eb)
+++ src/Actions/ShapeAction/CombineShapesAction.hpp	(revision ff9e5aa00cb3a198f58315ad4dda3952ed5b34eb)
@@ -0,0 +1,22 @@
+/*
+ * CombineShapesAction.hpp
+ *
+ *  Created on: Oct 1, 2012
+ *      Author: ankele
+ */
+
+#ifndef COMBINESHAPESACTION_HPP_
+#define COMBINESHAPESACTION_HPP_
+
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+
+#include "Actions/Action.hpp"
+
+#include "CombineShapesAction.def"
+#include "Action_impl_header.hpp"
+
+#endif /* COMBINESHAPESACTION_HPP_ */
