From 030757d082e7373a9bd30c24e0eb570d22c76262 Mon Sep 17 00:00:00 2001
From: Marco Biasini <marco.biasini@unibas.ch>
Date: Thu, 6 Oct 2011 17:57:42 +0200
Subject: [PATCH] gcc 4.1 now also compiles gfx and gui

---
 modules/gfx/pymod/export_gfx_obj.cc       | 59 ++++++++++++++++++++++-
 modules/gfx/pymod/scene_observer_proxy.hh |  2 -
 modules/gui/pymod/export_tool.cc          |  5 --
 3 files changed, 57 insertions(+), 9 deletions(-)

diff --git a/modules/gfx/pymod/export_gfx_obj.cc b/modules/gfx/pymod/export_gfx_obj.cc
index 704580559..5ed62786b 100644
--- a/modules/gfx/pymod/export_gfx_obj.cc
+++ b/modules/gfx/pymod/export_gfx_obj.cc
@@ -25,7 +25,6 @@ using namespace ost::gfx;
 
 #include "color_by_def.hh"
 
-namespace {
   // convenience for python
   void set_mat_amb2(GfxObjBase* b, float c) {b->SetMatAmb(Color(c,c,c,1.0));}
   void set_mat_diff2(GfxObjBase* b, float c) {b->SetMatDiff(Color(c,c,c,1.0));}
@@ -58,7 +57,63 @@ namespace {
     LOG_INFO("AALines(bool) is deprecated, use SetAALines(bool) instead");
     b->SetAALines(f);
   }
-}
+
+  class GfxObjWrap: public GfxObj, public wrapper<GfxObj>
+  {
+  public:
+    GfxObjWrap(const std::string& name):
+      GfxObj(name)
+    {}
+
+    virtual geom::AlignedCuboid GetBoundingBox() const
+    {
+      if(override f = this->get_override("GetBoundingBox")) {
+        return f();
+      } else {
+        return GfxObj::GetBoundingBox();
+      }
+    }
+
+    geom::AlignedCuboid default_GetBoundingBox() const {
+      return GfxObj::GetBoundingBox();
+    }
+
+    virtual void CustomRenderGL(RenderPass pass) {
+      if(override f = this->get_override("_CustomRenderGL")) {
+        f(pass);
+      } else {
+        GfxObj::CustomRenderGL(pass);
+      }
+    }
+
+    void default_CustomRenderGL(RenderPass pass) {
+        GfxObj::CustomRenderGL(pass);
+    }
+
+    virtual void CustomPreRenderGL(bool rebuild) {
+      if(override f = this->get_override("_CustomPreRenderGL")) {
+        f(rebuild);
+      } else {
+        GfxObj::CustomPreRenderGL(rebuild);
+      }
+    }
+
+    void default_CustomPreRenderGL(bool rebuild) {
+        GfxObj::CustomPreRenderGL(rebuild);
+    }
+
+    virtual void InitGL() {
+      if(override f = this->get_override("_InitGL")) {
+        f();
+      } else {
+        GfxObj::InitGL();
+      }
+    }
+
+    void default_InitGL() {
+        GfxObj::InitGL();
+    }
+  };
 
 void export_GfxObj()
 {
diff --git a/modules/gfx/pymod/scene_observer_proxy.hh b/modules/gfx/pymod/scene_observer_proxy.hh
index 63209cb20..8ba5faa6b 100644
--- a/modules/gfx/pymod/scene_observer_proxy.hh
+++ b/modules/gfx/pymod/scene_observer_proxy.hh
@@ -16,7 +16,6 @@
 using namespace ost;
 using namespace ost::gfx;
 
-namespace {
 
 class SceneObserverProxy: public SceneObserver {
 public:
@@ -75,6 +74,5 @@ private:
   PyObject* self;
 };
 
-}
 
 #endif
diff --git a/modules/gui/pymod/export_tool.cc b/modules/gui/pymod/export_tool.cc
index fbcf9375b..c5165570e 100644
--- a/modules/gui/pymod/export_tool.cc
+++ b/modules/gui/pymod/export_tool.cc
@@ -32,7 +32,6 @@ using namespace boost::python;
 using namespace ost::gui;
 using namespace ost;
 
-namespace {
   
 struct WrappedTool : public Tool
 {
@@ -81,7 +80,6 @@ struct WrappedTool : public Tool
 };
                                 
 
-namespace {
   
 void tm_add_tool(ToolManager& tm, QPtr<WrappedTool> tool)
 {
@@ -127,13 +125,10 @@ object get_delta_wrapper(MouseEvent& me)
   return qpoint_to_bp_object(delta);
 }
 
-}
-
 
 ToolOption* (ToolOptions::*get_option_a)(const String&, 
                                            const String&) const=&ToolOptions::GetOption;
 ToolOption* (ToolOptions::*get_option_b)(const String&) const=&ToolOptions::GetOption;
-}
 
 void export_Tool()
 {
-- 
GitLab