From e6d45e38b71fac8c842121de4c198a87238cbbaa Mon Sep 17 00:00:00 2001
From: Andreas Schenk <andreas_schenk@hms.harvard.edu>
Date: Wed, 9 Jan 2013 16:16:21 -0500
Subject: [PATCH] Revert "Delete unused files"

DataViewerProxy is needed to avoid crashes in Python
This reverts commit 0c00106a375fd649062d6f191285f74c0dd45ee7.
---
 modules/gui/pymod/CMakeLists.txt       |   1 +
 modules/gui/pymod/data_viewer_proxy.cc | 115 +++++++++++++++++++++++++
 modules/gui/pymod/data_viewer_proxy.hh |  91 +++++++++++++++++++
 3 files changed, 207 insertions(+)
 create mode 100644 modules/gui/pymod/data_viewer_proxy.cc
 create mode 100644 modules/gui/pymod/data_viewer_proxy.hh

diff --git a/modules/gui/pymod/CMakeLists.txt b/modules/gui/pymod/CMakeLists.txt
index 50ee93141..522f66443 100644
--- a/modules/gui/pymod/CMakeLists.txt
+++ b/modules/gui/pymod/CMakeLists.txt
@@ -65,6 +65,7 @@ query_editor.py
 )
 if (ENABLE_IMG)
   list(APPEND OST_GUI_PYMOD_SOURCES
+  data_viewer_proxy.cc
   export_data_viewer.cc
   export_overlay.cc
   export_overlay_manager.cc
diff --git a/modules/gui/pymod/data_viewer_proxy.cc b/modules/gui/pymod/data_viewer_proxy.cc
new file mode 100644
index 000000000..23551d127
--- /dev/null
+++ b/modules/gui/pymod/data_viewer_proxy.cc
@@ -0,0 +1,115 @@
+//------------------------------------------------------------------------------
+// This file is part of the OpenStructure project <www.openstructure.org>
+//
+// Copyright (C) 2008-2010 by the OpenStructure authors
+// Copyright (C) 2003-2010 by the IPLT authors
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License as published by the Free
+// Software Foundation; either version 3.0 of the License, or (at your option)
+// any later version.
+// This library 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 Lesser General Public License for more
+// details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this library; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+//------------------------------------------------------------------------------
+
+/*
+  Authors: Ansgar Philippsen, Andreas Schenk
+*/
+
+#include <ost/message.hh>
+//#include <ost/gui/snapshot.hh>
+
+#include "data_viewer_proxy.hh"
+
+namespace ost { namespace img { namespace gui {
+
+DataViewerProxy::DataViewerProxy(DataViewer* v):
+  ost::gui::SipHandler<ost::img::gui::DataViewer>(v)
+{}
+
+
+NormalizerPtr DataViewerProxy::GetNormalizer() const
+{
+  return Me()->GetNormalizer();
+}
+
+void DataViewerProxy::Renormalize()
+{
+  Me()->Renormalize();
+}
+
+void DataViewerProxy::UpdateView()
+{
+  Me()->UpdateView();
+}
+
+void DataViewerProxy::Recenter()
+{
+  Me()->Recenter();
+}
+
+Extent DataViewerProxy::GetSelection() const
+{
+  return Me()->GetSelection();
+}
+
+void DataViewerProxy::SetData(const Data& d)
+{
+  Me()->SetData(d);
+}
+
+void DataViewerProxy::SetName(const String& name)
+{
+  Me()->SetName(name);
+}
+
+int DataViewerProxy::AddOverlay(const OverlayPtr& ov, bool make_active)
+{
+  return Me()->AddOverlay(ov,make_active);
+}
+
+void DataViewerProxy::ClearOverlays()
+{
+  Me()->ClearOverlays();
+}
+
+OverlayManagerPtr DataViewerProxy::GetOverlayManager() const
+{
+  return Me()->GetOverlayManager();
+}
+
+
+void DataViewerProxy::AddDockWidget(QWidget* w, const QString& name, bool shown)
+{
+  Me()->AddDockWidget(w,name, shown);
+}
+
+void DataViewerProxy::RemoveDockWidget(QWidget* w)
+{
+  Me()->RemoveDockWidget(w);
+}
+
+void DataViewerProxy::SetAntialiasing(bool f)
+{
+  Me()->SetAntialiasing(f);
+}
+
+void DataViewerProxy::Show()
+{
+  Me()->show();
+}
+
+void DataViewerProxy::Hide() 
+{
+  Me()->hide();
+}
+
+
+
+}}}  //ns
diff --git a/modules/gui/pymod/data_viewer_proxy.hh b/modules/gui/pymod/data_viewer_proxy.hh
new file mode 100644
index 000000000..39a5f6c83
--- /dev/null
+++ b/modules/gui/pymod/data_viewer_proxy.hh
@@ -0,0 +1,91 @@
+//------------------------------------------------------------------------------
+// This file is part of the OpenStructure project <www.openstructure.org>
+//
+// Copyright (C) 2008-2010 by the OpenStructure authors
+// Copyright (C) 2003-2010 by the IPLT authors
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License as published by the Free
+// Software Foundation; either version 3.0 of the License, or (at your option)
+// any later version.
+// This library 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 Lesser General Public License for more
+// details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this library; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+//------------------------------------------------------------------------------
+
+/*
+  DataViewer proxy
+
+  Authors: Ansgar Philippsen, Andreas Schenk
+*/
+
+#ifndef IMG_GUI_DATA_VIEWER_PROXY_H
+#define IMG_GUI_DATA_VIEWER_PROXY_H
+
+#include <boost/shared_ptr.hpp>
+
+#include <ost/img/point.hh>
+#include <ost/img/extent.hh>
+#include <ost/img/normalizer_impl.hh>
+
+#include <ost/gui/data_viewer/overlay_base_fw.hh>
+#include <ost/gui/data_viewer/overlay_manager_fw.hh>
+#include <ost/gui/data_viewer/data_viewer.hh>
+#include <ost/gui/module_config.hh>
+
+#include "sip_handler.hh"
+
+class QWidget;
+class QString;
+
+namespace ost { namespace img { namespace gui {
+
+// fw decl
+class DataViewer;
+
+class TEMPLATE_EXPORT DataViewerProxy : public ost::gui::SipHandler<DataViewer>{
+public:
+  DataViewerProxy(DataViewer* v);
+
+  // data viewer interface
+
+  void SetData(const Data& data);
+  void SetName(const String& name);
+
+  NormalizerPtr GetNormalizer() const;
+  void Renormalize();
+  void Recenter();
+  void UpdateView();
+
+  Extent GetSelection() const;
+  int AddOverlay(const OverlayPtr& ov, bool make_active=true);
+  OverlayManagerPtr GetOverlayManager() const;
+  void ClearOverlays();
+
+  void AddDockWidget(QWidget* w, const QString& name, bool shown=true);
+  void RemoveDockWidget(QWidget* w);
+
+  void SetAntialiasing(bool f);
+
+  // ensure that data viewer is visible
+  void Show();
+
+  //void ShowClickedPosition(bool show=true);
+  //Vec3 GetClickedPosition();
+
+  void Hide();  
+
+};
+
+typedef boost::shared_ptr<DataViewerProxy> DataViewerProxyPtr;
+
+}}}  //ns
+
+#endif
+
+
-- 
GitLab