windstille-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Windstille-devel] rev 332 - in trunk/src: . scripting


From: Ingo Ruhnke
Subject: [Windstille-devel] rev 332 - in trunk/src: . scripting
Date: Sun, 16 May 2004 00:26:18 +0200

Author: grumbel
Date: 2004-05-16 00:26:18 +0200 (Sun, 16 May 2004)
New Revision: 332

Added:
   trunk/src/blitter.cxx
   trunk/src/blitter.hxx
   trunk/src/object_layer.cxx
   trunk/src/object_layer.hxx
Removed:
   trunk/src/editor_grid_layer.cxx
   trunk/src/editor_grid_layer.hxx
   trunk/src/editor_map_layer.hxx
   trunk/src/editor_mapsize_layer.cxx
   trunk/src/editor_mapsize_layer.hxx
   trunk/src/editor_objmap.cxx
   trunk/src/editor_objmap.hxx
Modified:
   trunk/src/SConstruct
   trunk/src/editor.py
   trunk/src/editor_map.cxx
   trunk/src/editor_map.hxx
   trunk/src/editor_map_component.hxx
   trunk/src/flexlay.i
   trunk/src/layer.cxx
   trunk/src/layer.hxx
   trunk/src/object_add_command.cxx
   trunk/src/object_add_command.hxx
   trunk/src/object_delete_command.cxx
   trunk/src/object_delete_command.hxx
   trunk/src/object_move_command.cxx
   trunk/src/object_move_command.hxx
   trunk/src/object_selector.cxx
   trunk/src/objmap_select_tool.cxx
   trunk/src/objmap_select_tool.hxx
   trunk/src/scripting/editor.cxx
   trunk/src/scripting/editor.hxx
   trunk/src/tilemap_layer.cxx
   trunk/src/tilemap_layer.hxx
Log:
- cleaned up interface a bit

Modified: trunk/src/SConstruct
===================================================================
--- trunk/src/SConstruct        2004-05-15 20:26:26 UTC (rev 331)
+++ trunk/src/SConstruct        2004-05-15 22:26:18 UTC (rev 332)
@@ -1,7 +1,7 @@
 ## -*- mode: python -*-
 
 env = Environment(CXX = 'g++-3.3',
-                  CXXFLAGS = '-g -O2 -Wall',
+                  CXXFLAGS = '-g -Wall',
                   SWIGFLAGS='-c++ -python',
                   SHLIBPREFIX='')
 
@@ -16,7 +16,6 @@
                              'tile.hxx',
                              'tile_brush.hxx',
                              'editor.hxx',
-                             'editor_map_layer.hxx',
                              'editor_map.hxx',
                              'workspace.hxx',
                              'tileset.hxx',
@@ -39,11 +38,8 @@
     'command_group.cxx',
     'editor.cxx',
     'scripting/editor.cxx',
-    'editor_grid_layer.cxx',
     'editor_map.cxx',
-    'editor_map_layer.cxx',
     'editor_map_component.cxx',
-    'editor_mapsize_layer.cxx',
     'editor_objmap.cxx',
     'flexlay.cxx',
     'globals.cxx',

Added: trunk/src/blitter.cxx
===================================================================
--- trunk/src/blitter.cxx       2004-05-15 20:26:26 UTC (rev 331)
+++ trunk/src/blitter.cxx       2004-05-15 22:26:18 UTC (rev 332)
@@ -0,0 +1,118 @@
+//  $Id$
+//
+//  Pingus - A free Lemmings clone
+//  Copyright (C) 2002 Ingo Ruhnke <address@hidden>
+//
+//  This program 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.
+//
+//  This program 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 this program; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+
+#include <assert.h>
+#include <iostream>
+#include <algorithm>
+#include <ClanLib/Display/pixel_format.h>
+#include <ClanLib/Display/palette.h>
+#include "blitter.hxx"
+
+void 
+blit(CL_PixelBuffer target, CL_PixelBuffer brush, int x_pos, int y_pos)
+{
+  target.lock();
+  brush.lock();
+
+  int start_x = std::max(0, -x_pos);
+  int start_y = std::max(0, -y_pos);
+  
+  int end_x = std::min(brush.get_width(),  target.get_width()  - x_pos);
+  int end_y = std::min(brush.get_height(), target.get_height() - y_pos);
+
+  unsigned char* target_buf = static_cast<unsigned char*>(target.get_data());
+  unsigned char* brush_buf  = static_cast<unsigned char*>(brush.get_data());
+
+  int target_width = target.get_width();
+  int brush_width  = brush.get_width();
+
+  if (brush.get_format().get_type() == pixelformat_rgba)
+    {
+      if (brush.get_format().get_depth() == 32)
+        {
+          for (int y = start_y; y < end_y; ++y)
+            for (int x = start_x; x < end_x; ++x)
+              {
+                int target_pos = (y + y_pos) * target_width + x + x_pos;
+                int brush_pos  = y * brush_width + x;
+
+                unsigned char a  = brush_buf[4*brush_pos + 0];
+                unsigned char r  = brush_buf[4*brush_pos + 1];
+                unsigned char g  = brush_buf[4*brush_pos + 2];
+                unsigned char b  = brush_buf[4*brush_pos + 3];
+
+                unsigned char ta = target_buf[4*target_pos + 0];
+                unsigned char tr = target_buf[4*target_pos + 1];
+                unsigned char tg = target_buf[4*target_pos + 2];
+                unsigned char tb = target_buf[4*target_pos + 3];
+
+                float alpha  = a/255.0f;
+        
+                target_buf[4*target_pos + 0] = std::min(255, ta + a);
+                target_buf[4*target_pos + 1] = std::min(255, int((1-alpha)*tr 
+ alpha*r));
+                target_buf[4*target_pos + 2] = std::min(255, int((1-alpha)*tg 
+ alpha*g));
+                target_buf[4*target_pos + 3] = std::min(255, int((1-alpha)*tb 
+ alpha*b));
+              }
+        }
+      else if (brush.get_format().get_depth() == 24)
+        {
+          for (int y = start_y; y < end_y; ++y)
+            for (int x = start_x; x < end_x; ++x)
+              {
+                int target_pos = (y + y_pos) * target_width + x + x_pos;
+                int brush_pos  = y * brush_width + x;
+
+                target_buf[4*target_pos + 0] = 255;
+                target_buf[4*target_pos + 1] = brush_buf[3*brush_pos + 0];
+                target_buf[4*target_pos + 2] = brush_buf[3*brush_pos + 1];
+                target_buf[4*target_pos + 3] = brush_buf[3*brush_pos + 2];
+              }
+        }
+      else
+        {
+          std::cout << "Unsupported bpp: " << brush.get_format().get_depth() 
<< std::endl;
+        }
+    }
+  else if (brush.get_format().get_type() == pixelformat_index)
+    {
+      CL_Palette palette = brush.get_palette();
+      for (int y = start_y; y < end_y; ++y)
+        for (int x = start_x; x < end_x; ++x)
+          {
+            int target_pos = (y + y_pos) * target_width + x + x_pos;
+            int brush_pos  = y * brush_width + x;
+            
+            target_buf[4*target_pos + 0] = 255;
+            target_buf[4*target_pos + 1] = 
palette.colors[brush_buf[brush_pos]].get_blue();
+            target_buf[4*target_pos + 2] = 
palette.colors[brush_buf[brush_pos]].get_green();
+            target_buf[4*target_pos + 3] = 
palette.colors[brush_buf[brush_pos]].get_red();
+          }
+    }
+  else
+    {
+      assert(!"Unknown pixelformat type");
+    }
+    
+
+
+  brush.unlock();
+  target.unlock();
+}
+
+/* EOF */

Added: trunk/src/blitter.hxx
===================================================================
--- trunk/src/blitter.hxx       2004-05-15 20:26:26 UTC (rev 331)
+++ trunk/src/blitter.hxx       2004-05-15 22:26:18 UTC (rev 332)
@@ -0,0 +1,29 @@
+//  $Id$
+// 
+//  Pingus - A free Lemmings clone
+//  Copyright (C) 2002 Ingo Ruhnke <address@hidden>
+//
+//  This program 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.
+//
+//  This program 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 this program; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+
+#ifndef HEADER_BLITTER_HXX
+#define HEADER_BLITTER_HXX
+
+#include <ClanLib/Display/pixel_buffer.h>
+
+void blit(CL_PixelBuffer target, CL_PixelBuffer brush, int x_pos, int y_pos);
+
+#endif
+
+/* EOF */

Modified: trunk/src/editor.py
===================================================================
--- trunk/src/editor.py 2004-05-15 20:26:26 UTC (rev 331)
+++ trunk/src/editor.py 2004-05-15 22:26:18 UTC (rev 332)
@@ -97,15 +97,15 @@
         self.background.set_data(get_value_from_tree(["background-tm"], data, 
[]))
 
         self.editormap = EditorMap()
-        self.editormap.add_layer(self.foreground)
-        self.editormap.add_layer(self.interactive)
-        self.editormap.add_layer(self.background)
+        self.editormap.add_layer(self.foreground.to_layer())
+        self.editormap.add_layer(self.interactive.to_layer())
+        self.editormap.add_layer(self.background.to_layer())
 
     def __del__(self):
         print "SuperTuxLevel:__del__"
 
     def activate(self, workspace):
-        editor_tilemap_set_current(self.interactive)
+        #editor_tilemap_set_current(self.interactive.to_layer())
         workspace.set_current_map(self.editormap)
 
 
@@ -124,7 +124,7 @@
 workspace.set_current_map(m)
 tileset = Tileset(32)
 tilemap = TilemapLayer(tileset, 20, 10)
-m.add_layer(tilemap)
+m.add_layer(tilemap.to_layer())
 tile = Tile("/home/ingo/cvs/supertux/supertux/data/images/tilesets/bonus1.png",
             CL_Color(255, 255, 255, 255),
             CL_Color(255,   0,   0, 128))
@@ -134,7 +134,7 @@
 
 load_game_tiles(tileset, 
"/home/ingo/cvs/supertux/supertux/data/images/tilesets/supertux.stgt")
 
-editor_tilemap_set_current(tilemap)
+TilemapLayer_set_current(tilemap)
 tilemap_paint_tool_set_tilemap(tilemap)
 
 editor_set_brush_tile(1)

Deleted: trunk/src/editor_grid_layer.cxx
===================================================================
--- trunk/src/editor_grid_layer.cxx     2004-05-15 20:26:26 UTC (rev 331)
+++ trunk/src/editor_grid_layer.cxx     2004-05-15 22:26:18 UTC (rev 332)
@@ -1,58 +0,0 @@
-//  $Id$
-//
-//  Flexlay - A Generic 2D Game Editor
-//  Copyright (C) 2002 Ingo Ruhnke <address@hidden>
-//
-//  This program 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.
-//
-//  This program 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 this program; if not, write to the Free Software
-//  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
-
-#include <ClanLib/Core/Math/rect.h>
-#include <ClanLib/Display/display.h>
-#include "editor_grid_layer.hxx"
-#include "editor_map_component.hxx"
-
-EditorGridLayer::EditorGridLayer(const CL_Point pos_, int w, int h, int 
tile_size_)
-  : pos(pos_),
-    width(w),
-    height(h),
-    tile_size(tile_size_)
-{
-}
-
-void
-EditorGridLayer::draw(EditorMapComponent* parent)
-{
-  CL_Rect rect = parent->get_clip_rect();
-
-  int start_x = std::max(0, rect.left/tile_size);
-  int start_y = std::max(0, rect.top/tile_size);
-  int end_x   = std::min(width,  rect.right/tile_size + 1);
-  int end_y   = std::min(height, rect.bottom/tile_size + 1);
-
-  for (int y = start_y; y <= end_y; ++y)
-    CL_Display::draw_line(start_x * tile_size,
-                          y * tile_size,
-                          end_x   * tile_size,
-                          y * tile_size, 
-                          CL_Color(150, 150, 150));
-  
-  for (int x = start_x; x <= end_x; ++x)
-    CL_Display::draw_line(x * tile_size,
-                          start_y * tile_size,
-                          x   * tile_size,
-                          end_y * tile_size, 
-                          CL_Color(150, 150, 150));
-}
-
-/* EOF */

Deleted: trunk/src/editor_grid_layer.hxx
===================================================================
--- trunk/src/editor_grid_layer.hxx     2004-05-15 20:26:26 UTC (rev 331)
+++ trunk/src/editor_grid_layer.hxx     2004-05-15 22:26:18 UTC (rev 332)
@@ -1,42 +0,0 @@
-//  $Id$
-// 
-//  Flexlay - A Generic 2D Game Editor
-//  Copyright (C) 2002 Ingo Ruhnke <address@hidden>
-//
-//  This program 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.
-//
-//  This program 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 this program; if not, write to the Free Software
-//  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
-
-#ifndef HEADER_EDITOR_GRID_LAYER_HXX
-#define HEADER_EDITOR_GRID_LAYER_HXX
-
-#include <ClanLib/Core/Math/point.h>
-#include "editor_map_layer.hxx"
-
-/** Little helper layer that displays a simple grid
- */
-class EditorGridLayer : public EditorMapLayer
-{
-private:
-  CL_Point pos;
-  int width;
-  int height;
-  int tile_size;
-public:
-  EditorGridLayer(const CL_Point pos_, int w, int h, int tile_size);
-  void draw(EditorMapComponent* parent);
-};
-
-#endif
-
-/* EOF */

Modified: trunk/src/editor_map.cxx
===================================================================
--- trunk/src/editor_map.cxx    2004-05-15 20:26:26 UTC (rev 331)
+++ trunk/src/editor_map.cxx    2004-05-15 22:26:18 UTC (rev 332)
@@ -44,7 +44,7 @@
 }
 
 void
-EditorMap::add_layer(EditorMapLayer* layer)
+EditorMap::add_layer(Layer layer)
 {
   layers.push_back(layer);
   ++serial;
@@ -58,11 +58,11 @@
   CL_Display::fill_rect(rect, background_color);
   CL_Display::draw_rect(rect, foreground_color);
   for(Layers::iterator i = layers.begin(); i != layers.end(); ++i)
-    (*i)->draw(parent);  
+    (*i).draw(parent);  
   CL_Display::flush();
 }
 
-EditorMapLayer*
+Layer
 EditorMap::get_layer(int i)
 {
   if (i >= 0 && i < static_cast<int>(layers.size()))
@@ -95,16 +95,16 @@
 
   for(Layers::iterator i = layers.begin(); i != layers.end(); ++i)
     {
-      if ((*i)->has_bounding_rect())
+      if (i->has_bounding_rect())
         {
           if (!init)
             {
-              rect = (*i)->get_bounding_rect();
+              rect = i->get_bounding_rect();
               init = true;
             }
           else
             {
-              CL_Rect other = (*i)->get_bounding_rect();
+              CL_Rect other = i->get_bounding_rect();
               rect.top    = std::min(rect.top,    other.top);
               rect.bottom = std::max(rect.bottom, other.bottom);
               rect.left   = std::min(rect.left,   other.left);

Modified: trunk/src/editor_map.hxx
===================================================================
--- trunk/src/editor_map.hxx    2004-05-15 20:26:26 UTC (rev 331)
+++ trunk/src/editor_map.hxx    2004-05-15 22:26:18 UTC (rev 332)
@@ -25,9 +25,9 @@
 #include <ClanLib/GUI/component.h>
 #include <ClanLib/Core/Math/point.h>
 #include "field.hxx"
-#include "editor_objmap.hxx"
+#include "object_layer.hxx"
 #include "tilemap_layer.hxx"
-#include "editor_map_layer.hxx"
+#include "layer.hxx"
 
 class EditorMapComponent;
 class TileMapTool;
@@ -45,7 +45,7 @@
       can update if required */
   int serial;
 
-  typedef std::vector<EditorMapLayer*> Layers;
+  typedef std::vector<Layer> Layers;
   Layers layers;
 
   CL_Color background_color;
@@ -61,7 +61,7 @@
 
   void draw(EditorMapComponent* parent);
 
-  void add_layer(EditorMapLayer* layer);
+  void add_layer(Layer layer);
 
   bool is_modified() const { return modified; }
   void set_unmodified() { modified = false; }
@@ -69,7 +69,7 @@
 
   int get_serial() const { return serial; }
 
-  EditorMapLayer* get_layer(int i);
+  Layer get_layer(int i);
 
 #ifdef SWIGGUILE
   void   set_metadata(const SCMObj& obj);

Modified: trunk/src/editor_map_component.hxx
===================================================================
--- trunk/src/editor_map_component.hxx  2004-05-15 20:26:26 UTC (rev 331)
+++ trunk/src/editor_map_component.hxx  2004-05-15 22:26:18 UTC (rev 332)
@@ -25,7 +25,7 @@
 #include <ClanLib/GUI/component.h>
 #include <ClanLib/Core/Math/point.h>
 #include "field.hxx"
-#include "editor_objmap.hxx"
+#include "object_layer.hxx"
 #include "graphic_context_state.hxx"
 
 class Workspace;

Deleted: trunk/src/editor_map_layer.hxx
===================================================================
--- trunk/src/editor_map_layer.hxx      2004-05-15 20:26:26 UTC (rev 331)
+++ trunk/src/editor_map_layer.hxx      2004-05-15 22:26:18 UTC (rev 332)
@@ -1,50 +0,0 @@
-//  $Id$
-// 
-//  Flexlay - A Generic 2D Game Editor
-//  Copyright (C) 2002 Ingo Ruhnke <address@hidden>
-//
-//  This program 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.
-//
-//  This program 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 this program; if not, write to the Free Software
-//  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
-
-#ifndef HEADER_EDITOR_MAP_LAYER_HXX
-#define HEADER_EDITOR_MAP_LAYER_HXX
-
-#include <ClanLib/Core/Math/rect.h>
-
-class EditorMapComponent;
-
-/** Each \a EditorMap consists out of one or more \a EditorMapLayer,
-    The \a EditorMapLayer is an abstract base class from which the
-    data holding layers derive. The basic functionality of a layer
-    consists only of data holding and visualization. (FIXME: move
-    visuals off into another class) */
-class EditorMapLayer
-{
-public:
-  EditorMapLayer();
-  virtual ~EditorMapLayer();
-
-  virtual void draw(EditorMapComponent* parent) =0;
-
-  virtual bool has_bounding_rect() const { return false; }
-  virtual CL_Rect get_bounding_rect() { return CL_Rect(); }
-
-private:
-  EditorMapLayer (const EditorMapLayer&);
-  EditorMapLayer& operator= (const EditorMapLayer&);
-};
-
-#endif
-
-/* EOF */

Deleted: trunk/src/editor_mapsize_layer.cxx
===================================================================
--- trunk/src/editor_mapsize_layer.cxx  2004-05-15 20:26:26 UTC (rev 331)
+++ trunk/src/editor_mapsize_layer.cxx  2004-05-15 22:26:18 UTC (rev 332)
@@ -1,34 +0,0 @@
-//  $Id$
-//
-//  Flexlay - A Generic 2D Game Editor
-//  Copyright (C) 2002 Ingo Ruhnke <address@hidden>
-//
-//  This program 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.
-//
-//  This program 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 this program; if not, write to the Free Software
-//  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
-
-#include <ClanLib/Display/display.h>
-#include "editor_mapsize_layer.hxx"
-
-EditorMapsizeLayer::EditorMapsizeLayer(const CL_Rect& r)
-  : rect(r)
-{
-}
-
-void
-EditorMapsizeLayer::draw(EditorMapComponent* parent)
-{
-  CL_Display::draw_rect(rect, CL_Color(205, 205, 205));
-}
-
-/* EOF */

Deleted: trunk/src/editor_mapsize_layer.hxx
===================================================================
--- trunk/src/editor_mapsize_layer.hxx  2004-05-15 20:26:26 UTC (rev 331)
+++ trunk/src/editor_mapsize_layer.hxx  2004-05-15 22:26:18 UTC (rev 332)
@@ -1,48 +0,0 @@
-//  $Id$
-// 
-//  Flexlay - A Generic 2D Game Editor
-//  Copyright (C) 2002 Ingo Ruhnke <address@hidden>
-//
-//  This program 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.
-//
-//  This program 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 this program; if not, write to the Free Software
-//  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
-
-#ifndef HEADER_EDITOR_MAPSIZE_LAYER_HXX
-#define HEADER_EDITOR_MAPSIZE_LAYER_HXX
-
-#include <ClanLib/Core/Math/rect.h>
-#include "editor_map_layer.hxx"
-
-/** Simple layer that displays the map size, only needed in case the
-    mapsize isn't clear out of the other layers itself */
-class EditorMapsizeLayer : public EditorMapLayer
-{
-private:
-  CL_Rect rect;
-public:
-  EditorMapsizeLayer(const CL_Rect& r);
-
-  void draw(EditorMapComponent* parent);
-
-  bool has_bounding_rect() const { return true; }
-  CL_Rect get_bounding_rect() { return rect; }
-  void set_bounding_rect(const CL_Rect& r) { rect = r; }
-  
-private:
-  EditorMapsizeLayer (const EditorMapsizeLayer&);
-  EditorMapsizeLayer& operator= (const EditorMapsizeLayer&);
-};
-
-#endif
-
-/* EOF */

Deleted: trunk/src/editor_objmap.cxx
===================================================================
--- trunk/src/editor_objmap.cxx 2004-05-15 20:26:26 UTC (rev 331)
+++ trunk/src/editor_objmap.cxx 2004-05-15 22:26:18 UTC (rev 332)
@@ -1,139 +0,0 @@
-//  $Id$
-//
-//  Flexlay - A Generic 2D Game Editor
-//  Copyright (C) 2002 Ingo Ruhnke <address@hidden>
-//
-//  This program 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.
-//
-//  This program 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 this program; if not, write to the Free Software
-//  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
-
-#include <iostream>
-#include <ClanLib/Display/display.h>
-#include <ClanLib/Core/Math/origin.h>
-#include <ClanLib/Core/System/error.h>
-#include "objmap_object.hxx"
-#include "objmap_sprite_object.hxx"
-#include "editor_objmap.hxx"
-
-extern CL_ResourceManager* resources;
-EditorObjMap* EditorObjMap::current_ = 0;
-
-EditorObjMap::EditorObjMap()
-{
-  handle_count = 0;
-}
-
-EditorObjMap::~EditorObjMap()
-{
-}
-
-void
-EditorObjMap::draw(EditorMapComponent* parent)
-{
-  for(Objs::iterator i = objects.begin(); i != objects.end(); ++i)
-    {
-      (*i)->draw();
-    }
-}
-
-int
-EditorObjMap::duplicate_object(int id)
-{
-  ObjMapObject* obj    = get_object(id);
-  ObjMapObject* newobj = obj->duplicate(++handle_count);
-  objects.push_back(newobj);  
-
-  // FIXME: Move to scripting level
-  newobj->set_pos(newobj->get_pos() + CL_Point(16, 16));
-
-  return newobj->get_handle();
-}
-
-#ifdef SWIGGUILE
-int
-EditorObjMap::add_object(const CL_Sprite& sprite, const CL_Point& pos, const 
SCMObj& data)
-{
-  ObjMapObject* obj = new ObjMapSpriteObject(++handle_count, pos, data, 
sprite);
-
-  objects.push_back(obj);  
-
-  return obj->get_handle();
-}
-#endif
-
-ObjMapObject*
-EditorObjMap::find_object(const CL_Point& click_pos)
-{
-  for(Objs::reverse_iterator i = objects.rbegin(); i != objects.rend(); ++i)
-    {
-      CL_Rect rect = (*i)->get_bound_rect();
-     
-      if (rect.is_inside(click_pos))
-        return *i;
-    }
-  return 0;
-}
-
-void
-EditorObjMap::delete_object(int id)
-{
-  for(Objs::iterator i = objects.begin(); i != objects.end(); ++i)
-    {
-      if ((*i)->get_handle() == id)
-        {
-          //delete *i;
-          objects.erase(i);
-          break;
-        }
-    }
-}
-
-std::vector<EditorObjMap::Obj*>
-EditorObjMap::get_selection(const CL_Rect& rect)
-{
-  std::vector<EditorObjMap::Obj*> selection;
-
-  for(Objs::iterator i = objects.begin(); i != objects.end(); ++i)
-    {
-      // FIXME:
-      if (rect.is_inside((*i)->get_pos()))
-        {
-          selection.push_back(*i);
-        }
-    }
-  
-  return selection;
-}
-
-EditorObjMap::Obj*
-EditorObjMap::get_object(int id)
-{
-  for(Objs::iterator i = objects.begin(); i != objects.end(); ++i)
-    if ((*i)->get_handle() == id)
-      return *i;
-  return 0;
-}
-
-EditorObjMap::Objs*
-EditorObjMap::get_objects()
-{
-  return &objects;
-}
-
-void
-EditorObjMap::add_object(ObjMapObject* obj)
-{
-  objects.push_back(obj);
-}
-
-/* EOF */

Deleted: trunk/src/editor_objmap.hxx
===================================================================
--- trunk/src/editor_objmap.hxx 2004-05-15 20:26:26 UTC (rev 331)
+++ trunk/src/editor_objmap.hxx 2004-05-15 22:26:18 UTC (rev 332)
@@ -1,78 +0,0 @@
-//  $Id$
-// 
-//  Flexlay - A Generic 2D Game Editor
-//  Copyright (C) 2002 Ingo Ruhnke <address@hidden>
-//
-//  This program 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.
-//
-//  This program 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 this program; if not, write to the Free Software
-//  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
-
-#ifndef HEADER_EDITOR_OBJMAP_HXX
-#define HEADER_EDITOR_OBJMAP_HXX
-
-#include <vector>
-#include <ClanLib/Display/sprite.h>
-#include <ClanLib/GUI/component.h>
-#include <ClanLib/Core/Math/point.h>
-#ifdef SWIGGUILE
-#include "scm_obj.hxx"
-#endif
-#include "editor_map_layer.hxx"
-
-class ObjMapObject;
-
-/** The EditorObjMap provides a simple Layer for holding positioned
-    objects. Objects consist of a CL_Sprite and some properties
-    accessible from scripting languages */
-class EditorObjMap : public EditorMapLayer
-{
-private:
-  CL_SlotContainer slots;
-
-public:
-  typedef ObjMapObject Obj;
-  typedef std::vector<ObjMapObject*> Objs;
-  Objs objects;
-
-  int handle_count;
-  static EditorObjMap* current_;
-public:
-  static EditorObjMap* current() { return current_; }
-  static void set_current(EditorObjMap* c) { current_ = c; }
-
-  EditorObjMap();
-  ~EditorObjMap();
-
-  void draw(EditorMapComponent* parent);
-
-  /** Add an object to the map and return a handle to it */
-#ifdef SWIGGUILE
-  int  add_object(const CL_Sprite& sprite, const CL_Point& pos, const SCMObj& 
data);
-#endif
-  void add_object(ObjMapObject* obj);
-  void delete_object(int id);
-  int  duplicate_object(int id);
-
-  ObjMapObject* find_object(const CL_Point& pos);
-  std::vector<ObjMapObject*> get_selection(const CL_Rect& rect);
-  Objs* get_objects();
-  EditorObjMap::Obj* get_object(int id);
-  int get_next_object_handle() { return ++handle_count; }
-private:
-  EditorObjMap (const EditorObjMap&);
-  EditorObjMap& operator= (const EditorObjMap&);
-};
-
-#endif
-
-/* EOF */

Modified: trunk/src/flexlay.i
===================================================================
--- trunk/src/flexlay.i 2004-05-15 20:26:26 UTC (rev 331)
+++ trunk/src/flexlay.i 2004-05-15 22:26:18 UTC (rev 332)
@@ -16,8 +16,10 @@
 #include "tile.hxx"
 #include "tile_brush.hxx"
 #include "editor.hxx"
-#include "editor_map_layer.hxx"
+
+#include "layer.hxx"
 #include "tilemap_layer.hxx"
+
 #include "editor_map.hxx"
 #include "workspace.hxx"
 #include "tileset.hxx"
@@ -46,8 +48,10 @@
 %include "tile.hxx"
 %include "tile_brush.hxx"
 %include "editor.hxx"
-%include "editor_map_layer.hxx"
+ 
+%include "layer.hxx"
 %include "tilemap_layer.hxx"
+
 %include "editor_map.hxx"
 %include "workspace.hxx"
 %include "tileset.hxx"

Modified: trunk/src/layer.cxx
===================================================================
--- trunk/src/layer.cxx 2004-05-15 20:26:26 UTC (rev 331)
+++ trunk/src/layer.cxx 2004-05-15 22:26:18 UTC (rev 332)
@@ -20,6 +20,11 @@
 #include "layer_impl.hxx"
 #include "layer.hxx"
 
+Layer::Layer(LayerImpl* i)
+  : impl(i)
+{
+}
+
 Layer::Layer()
   : impl(0)
 {  

Modified: trunk/src/layer.hxx
===================================================================
--- trunk/src/layer.hxx 2004-05-15 20:26:26 UTC (rev 331)
+++ trunk/src/layer.hxx 2004-05-15 22:26:18 UTC (rev 332)
@@ -26,12 +26,17 @@
 class EditorMapComponent;
 class LayerImpl;
 
-/** */
+/** Each \a EditorMap consists out of one or more \a EditorMapLayer,
+    The \a EditorMapLayer is an abstract base class from which the
+    data holding layers derive. The basic functionality of a layer
+    consists only of data holding and visualization. (FIXME: move
+    visuals off into another class) */
 class Layer
 {
 private:
 public:
   Layer();
+  Layer(LayerImpl* i);
   
   void draw(EditorMapComponent* parent);
   bool has_bounding_rect() const;

Modified: trunk/src/object_add_command.cxx
===================================================================
--- trunk/src/object_add_command.cxx    2004-05-15 20:26:26 UTC (rev 331)
+++ trunk/src/object_add_command.cxx    2004-05-15 22:26:18 UTC (rev 332)
@@ -17,11 +17,11 @@
 //  along with this program; if not, write to the Free Software
 //  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 
-#include "editor_objmap.hxx"
+#include "object_layer.hxx"
 #include "objmap_object.hxx"
 #include "object_add_command.hxx"
 
-ObjectAddCommand::ObjectAddCommand(EditorObjMap* o, ObjMapObject* ob)
+ObjectAddCommand::ObjectAddCommand(ObjectLayer* o, ObjMapObject* ob)
   : objmap(o), obj(ob)
 {
 }

Modified: trunk/src/object_add_command.hxx
===================================================================
--- trunk/src/object_add_command.hxx    2004-05-15 20:26:26 UTC (rev 331)
+++ trunk/src/object_add_command.hxx    2004-05-15 22:26:18 UTC (rev 332)
@@ -22,21 +22,21 @@
 
 #include "command.hxx"
 
-class EditorObjMap;
+class ObjectLayer;
 class ObjMapObject;
 
-/** ObjectAddCommand adds on object to an EditorObjMap, the user needs
-    to supply an Object together with the \a EditorObjMap to which it
+/** ObjectAddCommand adds on object to an ObjectLayer, the user needs
+    to supply an Object together with the \a ObjectLayer to which it
     should be added. FIXME: position should be part of the command,
     not the object */
 class ObjectAddCommand : public Command
 {
 private:
-  EditorObjMap* objmap;
+  ObjectLayer* objmap;
   ObjMapObject* obj;
 
 public:
-  ObjectAddCommand(EditorObjMap* o, ObjMapObject* ob);
+  ObjectAddCommand(ObjectLayer* o, ObjMapObject* ob);
   virtual ~ObjectAddCommand();
 
   int get_handle() const;

Modified: trunk/src/object_delete_command.cxx
===================================================================
--- trunk/src/object_delete_command.cxx 2004-05-15 20:26:26 UTC (rev 331)
+++ trunk/src/object_delete_command.cxx 2004-05-15 22:26:18 UTC (rev 332)
@@ -17,11 +17,11 @@
 //  along with this program; if not, write to the Free Software
 //  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 
-#include "editor_objmap.hxx"
+#include "object_layer.hxx"
 #include "objmap_object.hxx"
 #include "object_delete_command.hxx"
 
-ObjectDeleteCommand::ObjectDeleteCommand(EditorObjMap* o)
+ObjectDeleteCommand::ObjectDeleteCommand(ObjectLayer* o)
   : objmap(o)
 {
 }

Modified: trunk/src/object_delete_command.hxx
===================================================================
--- trunk/src/object_delete_command.hxx 2004-05-15 20:26:26 UTC (rev 331)
+++ trunk/src/object_delete_command.hxx 2004-05-15 22:26:18 UTC (rev 332)
@@ -24,18 +24,18 @@
 #include "command.hxx"
 
 class ObjMapObject;
-class EditorObjMap;
+class ObjectLayer;
 
 /** */
 class ObjectDeleteCommand : public Command
 {
 private:
-  EditorObjMap* objmap;
+  ObjectLayer* objmap;
   
   typedef std::vector<ObjMapObject*> Objects;
   Objects objects;
 public:
-  ObjectDeleteCommand(EditorObjMap* o);
+  ObjectDeleteCommand(ObjectLayer* o);
   virtual ~ObjectDeleteCommand() {}
 
   void add_object(int id);

Copied: trunk/src/object_layer.cxx (from rev 325, trunk/src/editor_objmap.cxx)
===================================================================
--- trunk/src/editor_objmap.cxx 2004-05-14 23:38:21 UTC (rev 325)
+++ trunk/src/object_layer.cxx  2004-05-15 22:26:18 UTC (rev 332)
@@ -0,0 +1,146 @@
+//  $Id$
+//
+//  Flexlay - A Generic 2D Game Editor
+//  Copyright (C) 2002 Ingo Ruhnke <address@hidden>
+//
+//  This program 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.
+//
+//  This program 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 this program; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+
+#include <iostream>
+#include <ClanLib/Display/display.h>
+#include <ClanLib/Core/Math/origin.h>
+#include <ClanLib/Core/System/error.h>
+#include "objmap_object.hxx"
+#include "objmap_sprite_object.hxx"
+#include "editor_objmap.hxx"
+
+extern CL_ResourceManager* resources;
+ObjectLayer* ObjectLayer::current_ = 0;
+
+ObjectLayer::ObjectLayer()
+{
+  handle_count = 0;
+}
+
+ObjectLayer::~ObjectLayer()
+{
+}
+
+void
+ObjectLayer::draw(EditorMapComponent* parent)
+{
+  for(Objs::iterator i = objects.begin(); i != objects.end(); ++i)
+    {
+      (*i)->draw();
+    }
+}
+
+int
+ObjectLayer::duplicate_object(int id)
+{
+  ObjMapObject* obj    = get_object(id);
+  ObjMapObject* newobj = obj->duplicate(++handle_count);
+  objects.push_back(newobj);  
+
+  // FIXME: Move to scripting level
+  newobj->set_pos(newobj->get_pos() + CL_Point(16, 16));
+
+  return newobj->get_handle();
+}
+
+#ifdef SWIGGUILE
+int
+ObjectLayer::add_object(const CL_Sprite& sprite, const CL_Point& pos, const 
SCMObj& data)
+{
+  ObjMapObject* obj = new ObjMapSpriteObject(++handle_count, pos, data, 
sprite);
+
+  objects.push_back(obj);  
+
+  return obj->get_handle();
+}
+#endif
+
+ObjMapObject*
+ObjectLayer::find_object(const CL_Point& click_pos)
+{
+  for(Objs::reverse_iterator i = objects.rbegin(); i != objects.rend(); ++i)
+    {
+      CL_Rect rect = (*i)->get_bound_rect();
+     
+      if (rect.is_inside(click_pos))
+        return *i;
+    }
+  return 0;
+}
+
+void
+ObjectLayer::delete_object(int id)
+{
+  for(Objs::iterator i = objects.begin(); i != objects.end(); ++i)
+    {
+      if ((*i)->get_handle() == id)
+        {
+          //delete *i;
+          objects.erase(i);
+          break;
+        }
+    }
+}
+
+std::vector<ObjectLayer::Obj*>
+ObjectLayer::get_selection(const CL_Rect& rect)
+{
+  std::vector<ObjectLayer::Obj*> selection;
+
+  for(Objs::iterator i = objects.begin(); i != objects.end(); ++i)
+    {
+      // FIXME:
+      if (rect.is_inside((*i)->get_pos()))
+        {
+          selection.push_back(*i);
+        }
+    }
+  
+  return selection;
+}
+
+ObjectLayer::Obj*
+ObjectLayer::get_object(int id)
+{
+  for(Objs::iterator i = objects.begin(); i != objects.end(); ++i)
+    if ((*i)->get_handle() == id)
+      return *i;
+  return 0;
+}
+
+ObjectLayer::Objs*
+ObjectLayer::get_objects()
+{
+  return &objects;
+}
+
+void
+ObjectLayer::add_object(ObjMapObject* obj)
+{
+  objects.push_back(obj);
+}
+
+Layer
+ObjectLayer::to_layer()
+{
+  //return Layer(impl);
+  return Layer();
+}
+
+/* EOF */

Copied: trunk/src/object_layer.hxx (from rev 325, trunk/src/editor_objmap.hxx)
===================================================================
--- trunk/src/editor_objmap.hxx 2004-05-14 23:38:21 UTC (rev 325)
+++ trunk/src/object_layer.hxx  2004-05-15 22:26:18 UTC (rev 332)
@@ -0,0 +1,77 @@
+//  $Id$
+// 
+//  Flexlay - A Generic 2D Game Editor
+//  Copyright (C) 2002 Ingo Ruhnke <address@hidden>
+//
+//  This program 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.
+//
+//  This program 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 this program; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+
+#ifndef HEADER_OBJECT_LAYER_HXX
+#define HEADER_OBJECT_LAYER_HXX
+
+#include <vector>
+#include <ClanLib/Display/sprite.h>
+#include <ClanLib/GUI/component.h>
+#include <ClanLib/Core/Math/point.h>
+#include "layer.hxx"
+
+class ObjMapObject;
+class ObjectLayerImpl;
+
+/** The ObjectLayer provides a simple Layer for holding positioned
+    objects. Objects consist of a CL_Sprite and some properties
+    accessible from scripting languages */
+class ObjectLayer
+{
+private:
+  CL_SlotContainer slots;
+
+public:
+  typedef ObjMapObject Obj;
+  typedef std::vector<ObjMapObject*> Objs;
+  Objs objects;
+
+  int handle_count;
+  static ObjectLayer* current_;
+public:
+  static ObjectLayer* current() { return current_; }
+  static void set_current(ObjectLayer* c) { current_ = c; }
+
+  ObjectLayer();
+  ~ObjectLayer();
+
+  void draw(EditorMapComponent* parent);
+
+  /** Add an object to the map and return a handle to it */
+#ifdef SWIGGUILE
+  int  add_object(const CL_Sprite& sprite, const CL_Point& pos, const SCMObj& 
data);
+#endif
+  void add_object(ObjMapObject* obj);
+  void delete_object(int id);
+  int  duplicate_object(int id);
+
+  ObjMapObject* find_object(const CL_Point& pos);
+  std::vector<ObjMapObject*> get_selection(const CL_Rect& rect);
+  Objs* get_objects();
+  ObjectLayer::Obj* get_object(int id);
+  int get_next_object_handle() { return ++handle_count; }
+
+  Layer to_layer();
+private:
+  CL_SharedPtr<ObjectLayerImpl> impl;
+};
+
+#endif
+
+/* EOF */

Modified: trunk/src/object_move_command.cxx
===================================================================
--- trunk/src/object_move_command.cxx   2004-05-15 20:26:26 UTC (rev 331)
+++ trunk/src/object_move_command.cxx   2004-05-15 22:26:18 UTC (rev 332)
@@ -17,11 +17,11 @@
 //  along with this program; if not, write to the Free Software
 //  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 
-#include "editor_objmap.hxx"
+#include "object_layer.hxx"
 #include "objmap_object.hxx"
 #include "object_move_command.hxx"
 
-ObjectMoveCommand::ObjectMoveCommand(EditorObjMap* o)
+ObjectMoveCommand::ObjectMoveCommand(ObjectLayer* o)
   : objmap(o)
 {
   

Modified: trunk/src/object_move_command.hxx
===================================================================
--- trunk/src/object_move_command.hxx   2004-05-15 20:26:26 UTC (rev 331)
+++ trunk/src/object_move_command.hxx   2004-05-15 22:26:18 UTC (rev 332)
@@ -22,13 +22,13 @@
 
 #include "command.hxx"
 
-class EditorObjMap;
+class ObjectLayer;
 
 /** */
 class ObjectMoveCommand : public Command
 {
 private:
-  EditorObjMap* objmap;
+  ObjectLayer* objmap;
 
   struct Obj {
     CL_Point old_pos;
@@ -39,7 +39,7 @@
   typedef std::vector<Obj> Objects;
   Objects objects;
 public:
-  ObjectMoveCommand(EditorObjMap* o);
+  ObjectMoveCommand(ObjectLayer* o);
   virtual ~ObjectMoveCommand() {}
 
   void add_obj(int id);

Modified: trunk/src/object_selector.cxx
===================================================================
--- trunk/src/object_selector.cxx       2004-05-15 20:26:26 UTC (rev 331)
+++ trunk/src/object_selector.cxx       2004-05-15 22:26:18 UTC (rev 332)
@@ -80,7 +80,7 @@
                 CL_Point target(screen.x - 
EditorMapComponent::current()->get_screen_rect().left,
                                 screen.y - 
EditorMapComponent::current()->get_screen_rect().top);
       
-                EditorObjMap* objmap = EditorObjMap::current();
+                ObjectLayer* objmap = ObjectLayer::current();
                 if (objmap)
                   {
                     ObjMapObject* obj 

Modified: trunk/src/objmap_select_tool.cxx
===================================================================
--- trunk/src/objmap_select_tool.cxx    2004-05-15 20:26:26 UTC (rev 331)
+++ trunk/src/objmap_select_tool.cxx    2004-05-15 22:26:18 UTC (rev 332)
@@ -72,7 +72,7 @@
 void
 ObjMapSelectTool::on_mouse_up(const CL_InputEvent& event)
 {
-  EditorObjMap* objmap = EditorObjMap::current();
+  ObjectLayer* objmap = ObjectLayer::current();
   if (objmap)
     {
       EditorMapComponent* parent = EditorMapComponent::current();
@@ -124,7 +124,7 @@
 void
 ObjMapSelectTool::on_mouse_down(const CL_InputEvent& event)
 {
-  EditorObjMap* objmap = EditorObjMap::current();
+  ObjectLayer* objmap = ObjectLayer::current();
   if (objmap)
     {
       EditorMapComponent* parent = EditorMapComponent::current();
@@ -136,7 +136,7 @@
           switch(state)
             {
             default:
-              EditorObjMap::Obj* obj = objmap->find_object(pos);
+              ObjectLayer::Obj* obj = objmap->find_object(pos);
           
               if (obj)
                 {

Modified: trunk/src/objmap_select_tool.hxx
===================================================================
--- trunk/src/objmap_select_tool.hxx    2004-05-15 20:26:26 UTC (rev 331)
+++ trunk/src/objmap_select_tool.hxx    2004-05-15 22:26:18 UTC (rev 332)
@@ -21,7 +21,7 @@
 #define HEADER_OBJMAP_SELECT_TOOL_HXX
 
 #include "tilemap_tool.hxx"
-#include "editor_objmap.hxx"
+#include "object_layer.hxx"
 #include "object_brush.hxx"
 
 class CL_Menu;
@@ -33,7 +33,7 @@
 class ObjMapSelectTool : public TileMapTool
 {
 public:
-  typedef std::vector<EditorObjMap::Obj*> Selection; 
+  typedef std::vector<ObjectLayer::Obj*> Selection; 
 
 private:
   CL_Signal_v1<CL_Menu*> on_popup_menu_display;

Modified: trunk/src/scripting/editor.cxx
===================================================================
--- trunk/src/scripting/editor.cxx      2004-05-15 20:26:26 UTC (rev 331)
+++ trunk/src/scripting/editor.cxx      2004-05-15 22:26:18 UTC (rev 332)
@@ -53,10 +53,8 @@
 #include "../workspace.hxx"
 
 #include "../editor_map.hxx"
-#include "../editor_map_layer.hxx"
-#include "../editor_mapsize_layer.hxx"
-#include "../editor_objmap.hxx"
-#include "../editor_grid_layer.hxx"
+#include "../object_layer.hxx"
+#include "../object_layer.hxx"
 
 #include "../python_functor.hxx"
 #include "editor.hxx"
@@ -115,7 +113,7 @@
 int
 editor_objectmap_add_sprite_object (EditorMapLayer* layer, SCM desc, int x, 
int y, SCM userdata)
 {
-  EditorObjMap* objmap = dynamic_cast<EditorObjMap*>(obj);
+  ObjectLayer* objmap = dynamic_cast<ObjectLayer*>(obj);
   if (objmap)
     {
       try {
@@ -153,7 +151,7 @@
 int
 objectmap_add_object(EditorMapLayer* layer, const char* filename, int x, int 
y, SCM userdata)
 {
-  EditorObjMap* objmap = dynamic_cast<EditorObjMap*>(layer);
+  ObjectLayer* objmap = dynamic_cast<ObjectLayer*>(layer);
   try {
     if (objmap)
       {
@@ -197,31 +195,19 @@
   TileMapPaintTool::current()->set_brush(brush);
 }
 
-EditorMapLayer*
-editor_grid_layer_create(int w, int h, int tile_size)
-{
-  return new EditorGridLayer(CL_Point(0, 0), w, h, tile_size);
-}
-
+#if 0
 void
-editor_toggle_grid(EditorMapLayer* layer)
-{
-  TilemapLayer* tilemap = dynamic_cast<TilemapLayer*>(layer);
-  if (tilemap)
-    tilemap->set_draw_grid(!tilemap->get_draw_grid());
-}
-
-void
 editor_toggle_attributes(EditorMapLayer* layer)
 {
   TilemapLayer* tilemap = dynamic_cast<TilemapLayer*>(layer);
   if (tilemap)
     tilemap->set_draw_attribute(!tilemap->get_draw_attribute());
 }
+#endif
 
 #ifdef SWIGGUILE
 SCM
-obj2scm(const EditorObjMap::Obj& obj)
+obj2scm(const ObjectLayer::Obj& obj)
 {
   SCM lst = SCM_EOL;
   
@@ -306,36 +292,24 @@
 }
 #endif
 
-void
-editor_objectmap_set_current(EditorMapLayer* layer)
-{
-  EditorObjMap* objmap = dynamic_cast<EditorObjMap*>(layer);
-  EditorObjMap::set_current(objmap);
-}
-
-void
-editor_tilemap_set_current(EditorMapLayer* layer)
-{
-  TilemapLayer* tilemap = dynamic_cast<TilemapLayer*>(layer);
-  TilemapLayer::set_current(tilemap);
-}
-
+#if 0
 int
 editor_objectmap_duplicate_object(EditorMapLayer* layer, int id)
 {
-  EditorObjMap* objmap = dynamic_cast<EditorObjMap*>(layer);
+  ObjectLayer* objmap = dynamic_cast<ObjectLayer*>(layer);
   if (objmap)
     {
       return objmap->duplicate_object(id);
     }
   return -1;
 }  
+#endif
 
 #ifdef SWIGGUILE
 void
 editor_objectmap_delete_objects(EditorMapLayer* layer, SCM lst)
 {
-  EditorObjMap* objmap = dynamic_cast<EditorObjMap*>(layer);
+  ObjectLayer* objmap = dynamic_cast<ObjectLayer*>(layer);
   if (objmap)
     {
       ObjectDeleteCommand* command = new ObjectDeleteCommand(objmap);
@@ -351,7 +325,7 @@
 void
 tilemap_object_tool_set_objects(EditorMapLayer* layer, SCM lst)
 {
-  EditorObjMap* objmap = dynamic_cast<EditorObjMap*>(layer);
+  ObjectLayer* objmap = dynamic_cast<ObjectLayer*>(layer);
   if (objmap)
     {
       ObjMapSelectTool::Selection selection;
@@ -376,27 +350,29 @@
 }
 #endif
 
+#if 0
 void
 editor_objectmap_set_pos(EditorMapLayer* layer, int id, int x, int y)
 {
-  EditorObjMap* objmap = dynamic_cast<EditorObjMap*>(layer);
+  ObjectLayer* objmap = dynamic_cast<ObjectLayer*>(layer);
   if (objmap)
     {
       ObjMapObject* obj = objmap->get_object(id);
       obj->set_pos(CL_Point(x, y));
     }
 }
+#endif
 
 #ifdef SWIGGUILE
 SCM
 editor_objectmap_get_objects(EditorMapLayer* layer)
 {
-  EditorObjMap* objmap = dynamic_cast<EditorObjMap*>(layer);
+  ObjectLayer* objmap = dynamic_cast<ObjectLayer*>(layer);
   if (objmap)
     {
       SCM lst = SCM_EOL;
 
-      for(EditorObjMap::Objs::iterator i = objmap->get_objects()->begin();
+      for(ObjectLayer::Objs::iterator i = objmap->get_objects()->begin();
           i != objmap->get_objects()->end();
           ++i)
         {
@@ -431,7 +407,7 @@
 
   ObjMapSelectTool::Selection selection = tool->get_selection();
 
-  for(EditorObjMap::Objs::iterator i = selection.begin(); i != 
selection.end(); ++i)
+  for(ObjectLayer::Objs::iterator i = selection.begin(); i != selection.end(); 
++i)
     {
       lst = gh_cons(SCM_MAKINUM((*i)->get_handle()), lst);
     }
@@ -441,10 +417,10 @@
 SCM
 editor_objectmap_get_object(EditorMapLayer* layer, int id)
 {
-  EditorObjMap* objmap = dynamic_cast<EditorObjMap*>(layer);
+  ObjectLayer* objmap = dynamic_cast<ObjectLayer*>(layer);
   if (objmap)
     {
-      EditorObjMap::Obj* obj = objmap->get_object(id);
+      ObjectLayer::Obj* obj = objmap->get_object(id);
 
       if (obj)
         return obj2scm(*obj);
@@ -454,10 +430,11 @@
 }
 #endif
 
+#if 0
 void
 objmap_sprite_object_flip(EditorMapLayer* layer, int id)
 {
-  EditorObjMap* objmap = dynamic_cast<EditorObjMap*>(layer);
+  ObjectLayer* objmap = dynamic_cast<ObjectLayer*>(layer);
   if (objmap)
     {
       ObjMapSpriteObject* obj = 
dynamic_cast<ObjMapSpriteObject*>(objmap->get_object(id));
@@ -475,6 +452,7 @@
       tilemap->resize(CL_Size(w, h), CL_Point(x, y));
     }
 }
+#endif
 
 void 
 tilemap_paint_tool_set_brush(TileBrush brush)
@@ -788,18 +766,13 @@
   return new EditorMap();
 }
 
+#if 0
 void
 editor_map_add_layer(EditorMap* m, EditorMapLayer* layer)
 {
   m->add_layer(layer);
 }
 
-EditorMapLayer* 
-editor_objmap_create()
-{
-  return new EditorObjMap();
-}
-
 void
 editor_tilemap_save_png(EditorMapLayer* l, const char* filename)
 {
@@ -862,6 +835,7 @@
       tilemap->set_foreground_color(CL_Color(r, g, b, a));
     }
 }
+#endif 
 
 #ifdef SWIGGUILE
 SCM
@@ -1009,19 +983,6 @@
   Tileset::set_current(tileset);
 }
 
-EditorMapLayer*
-editor_mapsize_layer_create(int w, int h)
-{
-  return new EditorMapsizeLayer(CL_Rect(CL_Point(0, 0), CL_Size(w, h)));
-}
-
-void
-editor_mapsize_layer_set_size(EditorMapLayer* l, int w, int h)
-{
-  EditorMapsizeLayer* layer = dynamic_cast<EditorMapsizeLayer*>(l);
-  layer->set_bounding_rect(CL_Rect(CL_Point(0, 0), CL_Size(w, h)));
-}
-
 Workspace*
 workspace_current()
 {
@@ -1041,5 +1002,9 @@
   workspace->add_map(m, CL_Point(x, y));
 }
 
+void tilemap_paint_tool_set_tilemap(TilemapLayer tilemap)
+{
+  TileMapPaintTool::current()->set_tilemap(tilemap);
+}
 
 /* EOF */

Modified: trunk/src/scripting/editor.hxx
===================================================================
--- trunk/src/scripting/editor.hxx      2004-05-15 20:26:26 UTC (rev 331)
+++ trunk/src/scripting/editor.hxx      2004-05-15 22:26:18 UTC (rev 332)
@@ -29,13 +29,14 @@
 #  include <guile/gh.h>
 #endif
 
+#include "../tilemap_layer.hxx"
+
 #include "Python.h"
 
 class Workspace;
 class EditorMap;
 class EditorObjMap;
 class EditorTileMap;
-class EditorMapLayer;
 class CL_Component;
 class TileBrush;
 class Tileset;
@@ -67,40 +68,16 @@
 void editor_set_tool(int i);
 void tilemap_paint_tool_set_brush(TileBrush brush);
 
-int  editor_objectmap_duplicate_object(EditorMapLayer* layer, int id);
-void editor_objectmap_set_pos         (EditorMapLayer* layer, int id, int x, 
int y);
-
-void editor_tilemap_set_current(EditorMapLayer* layer);
-void editor_objectmap_set_current(EditorMapLayer* layer);
-
-void objmap_sprite_object_flip(EditorMapLayer* layer, int id);
 void tilemap_object_tool_clear_selection();
 
 CL_Component* editor_add_tileeditor(int x, int y, int w, int h);
 
 void tileeditor_set_tile(CL_Component* comp, int id);
+void tilemap_paint_tool_set_tilemap(TilemapLayer tilemap);
 
 int  screen_get_width();
 int  screen_get_height();
 
-// Map stuff
-EditorMap*      editor_map_create();
-void            editor_map_add_layer(EditorMap* m, EditorMapLayer* layer);
-bool            editor_map_is_modified(EditorMap* m);
-void            editor_map_set_unmodified(EditorMap* m);
-
-EditorMapLayer* editor_grid_layer_create(int w, int h, int tile_size);
-EditorMapLayer* editor_objmap_create();
-
-void            editor_toggle_grid(EditorMapLayer* layer);
-void            editor_toggle_attributes(EditorMapLayer* layer);
-void            editor_tilemap_resize(EditorMapLayer* , int w, int h, int x, 
int y);
-int             editor_tilemap_get_width(EditorMapLayer* l);
-int             editor_tilemap_get_height(EditorMapLayer* l);
-void            editor_tilemap_set_bgcolor(EditorMapLayer* l, int r, int g, 
int b, int a);
-void            editor_tilemap_set_fgcolor(EditorMapLayer* l, int r, int g, 
int b, int a);
-void            editor_tilemap_save_png(EditorMapLayer* l, const char* 
filename);
-
 void connect(CL_Signal_v0& sig, PyObject* obj);
 
 Workspace* workspace_current();
@@ -115,15 +92,11 @@
 #endif
 void tileset_set_current(Tileset* tileset);
 
-EditorMapLayer* editor_mapsize_layer_create(int w, int h);
-void editor_mapsize_layer_set_size(EditorMapLayer*, int w, int h);
-
 #ifdef SWIGGUILE
 // Guile Specific Stuff
 SCM  editor_get_tile_selection();
 void object_selector_add_brush(CL_Component* comp, const char* name, SCM 
brush);
-int  objectmap_add_object(EditorMapLayer* obj, const char* name, int x, int y, 
SCM userdata);
-//int  objectmap_add_sprite_object (EditorMapLayer* layer, SCM desc, int x, 
int y, SCM userdata);
+
 void editor_objectmap_delete_objects  (EditorMapLayer* layer,SCM selection);
 SCM  editor_objectmap_get_objects     (EditorMapLayer* layer);
 SCM  editor_objectmap_get_object      (EditorMapLayer* layer, int id);

Modified: trunk/src/tilemap_layer.cxx
===================================================================
--- trunk/src/tilemap_layer.cxx 2004-05-15 20:26:26 UTC (rev 331)
+++ trunk/src/tilemap_layer.cxx 2004-05-15 22:26:18 UTC (rev 332)
@@ -38,11 +38,15 @@
 
 TilemapLayer* TilemapLayer::current_ = 0;
 
-class TilemapLayerImpl
+class TilemapLayerImpl : public LayerImpl
 {
 public:
-  TilemapLayerImpl() {}
-  virtual ~TilemapLayerImpl() {}
+  TilemapLayerImpl() {
+    std::cout << "TilemapLayerImpl()" << std::endl;
+  }
+  virtual ~TilemapLayerImpl() {
+    std::cout << "~TilemapLayerImpl()" << std::endl;
+  }
 
   Tileset* tileset;
   CL_Color background_color;
@@ -409,4 +413,10 @@
   return true;
 }
 
+Layer
+TilemapLayer::to_layer()
+{
+  return Layer(impl);
+}
+
 /* EOF */

Modified: trunk/src/tilemap_layer.hxx
===================================================================
--- trunk/src/tilemap_layer.hxx 2004-05-15 20:26:26 UTC (rev 331)
+++ trunk/src/tilemap_layer.hxx 2004-05-15 22:26:18 UTC (rev 332)
@@ -23,6 +23,7 @@
 #include <ClanLib/Core/System/sharedptr.h>
 #include <ClanLib/Display/pixel_buffer.h>
 #include "field.hxx"
+#include "layer.hxx"
 
 class Tileset;
 class TileBrush;
@@ -92,6 +93,8 @@
 
   bool is_null() const { return impl.is_null(); }
 
+  Layer to_layer();
+
 private:
   CL_SharedPtr<TilemapLayerImpl> impl;
 };





reply via email to

[Prev in Thread] Current Thread [Next in Thread]