pingus-cvs
[Top][All Lists]
Advanced

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

[Pingus-CVS] r3445 - trunk/pingus/src/editor


From: grumbel at BerliOS
Subject: [Pingus-CVS] r3445 - trunk/pingus/src/editor
Date: Thu, 1 Nov 2007 09:15:28 +0100

Author: grumbel
Date: 2007-11-01 09:15:27 +0100 (Thu, 01 Nov 2007)
New Revision: 3445

Modified:
   trunk/pingus/src/editor/editor_level.cpp
   trunk/pingus/src/editor/editor_level.hpp
   trunk/pingus/src/editor/editor_screen.cpp
   trunk/pingus/src/editor/editor_viewport.cpp
   trunk/pingus/src/editor/editor_viewport.hpp
Log:
- moved a few methods from viewport to level

Modified: trunk/pingus/src/editor/editor_level.cpp
===================================================================
--- trunk/pingus/src/editor/editor_level.cpp    2007-11-01 08:09:37 UTC (rev 
3444)
+++ trunk/pingus/src/editor/editor_level.cpp    2007-11-01 08:15:27 UTC (rev 
3445)
@@ -308,7 +308,7 @@
           obj->set_release_rate(tmp_int);
         }
 
-      editor->get_viewport()->add_object(obj);
+      add_object(obj);
     }
 
   sort();
@@ -518,6 +518,26 @@
 {
   return &(impl->objects);
 }
+
+void 
+EditorLevel::add_object(LevelObj* obj)
+{
+  impl->objects.push_back(obj);
+}
+
+LevelObj*
+EditorLevel::object_at (int x, int y)
+{
+  // we travel reversly through the object list, so that we get the
+  // top-most object
+  for (std::vector<LevelObj*>::reverse_iterator i = (*get_objects()).rbegin ();
+       i != (*get_objects()).rend (); ++i)
+    {
+      if ((*i)->is_at(x, y))
+        return *i;
+    }
+  return 0;
+}
 
 } // namespace Editor
 

Modified: trunk/pingus/src/editor/editor_level.hpp
===================================================================
--- trunk/pingus/src/editor/editor_level.hpp    2007-11-01 08:09:37 UTC (rev 
3444)
+++ trunk/pingus/src/editor/editor_level.hpp    2007-11-01 08:15:27 UTC (rev 
3445)
@@ -99,6 +99,9 @@
 
   std::vector<LevelObj*>* get_objects();
 
+  void add_object(LevelObj* obj);
+  LevelObj* object_at (int x, int y);
+
 private:
   LevelImpl* impl;
 

Modified: trunk/pingus/src/editor/editor_screen.cpp
===================================================================
--- trunk/pingus/src/editor/editor_screen.cpp   2007-11-01 08:09:37 UTC (rev 
3444)
+++ trunk/pingus/src/editor/editor_screen.cpp   2007-11-01 08:15:27 UTC (rev 
3445)
@@ -275,7 +275,7 @@
 void
 EditorScreen::add_object(LevelObj* obj)
 {
-  viewport->add_object(obj);
+  plf->add_object(obj);
 }
 
 void

Modified: trunk/pingus/src/editor/editor_viewport.cpp
===================================================================
--- trunk/pingus/src/editor/editor_viewport.cpp 2007-11-01 08:09:37 UTC (rev 
3444)
+++ trunk/pingus/src/editor/editor_viewport.cpp 2007-11-01 08:15:27 UTC (rev 
3445)
@@ -92,7 +92,7 @@
   
   if (current_action == NOTHING)
     {
-      LevelObj* obj = object_at(mouse_world_pos.x, mouse_world_pos.y);
+      LevelObj* obj = editor->get_level()->object_at(mouse_world_pos.x, 
mouse_world_pos.y);
 
       if (obj)
         {
@@ -368,20 +368,6 @@
     }
 }
 
-LevelObj*
-EditorViewport::object_at (int x, int y)
-{
-  // we travel reversly through the object list, so that we get the
-  // top-most object
-  for (std::vector<LevelObj*>::reverse_iterator i = (*get_objects()).rbegin ();
-       i != (*get_objects()).rend (); ++i)
-    {
-      if ((*i)->is_at(x, y))
-        return *i;
-    }
-  return 0;
-}
-
 void
 EditorViewport::refresh()
 {
@@ -391,12 +377,6 @@
   //            << std::endl;
 }
 
-void 
-EditorViewport::add_object(LevelObj* obj)
-{
-  (*get_objects()).push_back(obj);
-}
-
 void
 EditorViewport::duplicate_selected_objects()
 {

Modified: trunk/pingus/src/editor/editor_viewport.hpp
===================================================================
--- trunk/pingus/src/editor/editor_viewport.hpp 2007-11-01 08:09:37 UTC (rev 
3444)
+++ trunk/pingus/src/editor/editor_viewport.hpp 2007-11-01 08:15:27 UTC (rev 
3445)
@@ -67,9 +67,6 @@
   /** The region that is currently highlighted */
   Rect highlighted_area;
 
-  /** Returns the topmost object at this x, y location */
-  LevelObj* object_at(int x, int y);
-
   /** There should only be 0 or 1 context menus on the screen */
   ContextMenu* context_menu;
 
@@ -106,9 +103,6 @@
   /** Turns the "snap-to-grid" option on or off */
   void set_snap_to(bool s) { snap_to = s; }
 
-  /** Add an object to the currently displayed vector of objects */
-  void add_object(LevelObj* obj);
-
   /** Return a pointer to the EditorScreen object */
   EditorScreen* get_screen() { return editor; }
 





reply via email to

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