pingus-cvs
[Top][All Lists]
Advanced

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

[Pingus-CVS] CVS: Games/Pingus/src/editor editor_event.cxx,1.53,1.54 gen


From: grumbel
Subject: [Pingus-CVS] CVS: Games/Pingus/src/editor editor_event.cxx,1.53,1.54 generic_property_frame.cxx,1.3,1.4 selection.cxx,1.17,1.18 selection.hxx,1.13,1.14
Date: 25 Mar 2003 23:15:25 -0000

Update of /var/lib/cvs/Games/Pingus/src/editor
In directory dark:/tmp/cvs-serv28881/editor

Modified Files:
        editor_event.cxx generic_property_frame.cxx selection.cxx 
        selection.hxx 
Log Message:
- some small bugfixes
- added support to remove object from selection

Index: editor_event.cxx
===================================================================
RCS file: /var/lib/cvs/Games/Pingus/src/editor/editor_event.cxx,v
retrieving revision 1.53
retrieving revision 1.54
diff -u -d -r1.53 -r1.54
--- editor_event.cxx    21 Mar 2003 22:08:06 -0000      1.53
+++ editor_event.cxx    25 Mar 2003 23:15:23 -0000      1.54
@@ -685,18 +685,34 @@
     = object_manager->find_object(editor->view->screen_to_world 
(Vector(CL_Mouse::get_x(), 
                                                                           
CL_Mouse::get_y())));
   
+  int x = CL_Mouse::get_x();
+  int y = CL_Mouse::get_y();
+  bool move_selection = false;
+
+  while (CL_Mouse::left_pressed() && move_selection == false)
+    {
+      if ((abs(x - CL_Mouse::get_x()) > 3)
+          || (abs(y - CL_Mouse::get_y()) > 3))
+        move_selection = true;
+      CL_System::keep_alive();
+    }
+
   if (obj)
     {
-      if (selection->object_selected(obj))
+      if (selection->has_object(obj) && move_selection)
        {
          editor->interactive_move_object();
        }
       else
        {
-         if (!CL_Keyboard::get_keycode(CL_KEY_LSHIFT))
+         if (!CL_Keyboard::get_keycode(CL_KEY_LSHIFT)
+              && !CL_Keyboard::get_keycode(CL_KEY_RSHIFT))
            selection->clear();
-         
-         selection->add(obj);
+        
+          if (selection->has_object(obj))
+            selection->remove(obj);
+          else
+            selection->add(obj);
        }
     }
   else

Index: generic_property_frame.cxx
===================================================================
RCS file: /var/lib/cvs/Games/Pingus/src/editor/generic_property_frame.cxx,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- generic_property_frame.cxx  1 Dec 2002 17:08:47 -0000       1.3
+++ generic_property_frame.cxx  25 Mar 2003 23:15:23 -0000      1.4
@@ -212,7 +212,7 @@
     radio_buttons.push_back(std::pair<int, CL_RadioButton*>(item_value, 
rbutton));
     radio_group.add(rbutton);
 
-    std::cout << "Value: " << *value << " ItemValue: " << item_value << 
std::endl;
+    //std::cout << "Value: " << *value << " ItemValue: " << item_value << 
std::endl;
 
     if (item_value == *value)
       rbutton->set_checked(true);
@@ -236,7 +236,7 @@
 {
   for (std::vector<DataBox*>::iterator i = data_boxes.begin(); i != 
data_boxes.end(); ++i)
     {
-      std::cout << "GenericPropertyFrame: Writing data for: " << *i << 
std::endl;
+      //std::cout << "GenericPropertyFrame: Writing data for: " << *i << 
std::endl;
       (*i)->write_data();
       delete *i;
     }

Index: selection.cxx
===================================================================
RCS file: /var/lib/cvs/Games/Pingus/src/editor/selection.cxx,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -d -r1.17 -r1.18
--- selection.cxx       29 Dec 2002 23:29:01 -0000      1.17
+++ selection.cxx       25 Mar 2003 23:15:23 -0000      1.18
@@ -71,12 +71,7 @@
 bool
 Selection::has_object(EditorObj* obj)
 {
-  for (std::vector<EditorObj*>::iterator it = obj_list.begin(); it != 
obj_list.end(); ++it)
-    {
-      if (*it == obj)
-        return true;
-    }
-  return false;
+  return std::find(obj_list.begin(), obj_list.end(), obj)  !=  obj_list.end();
 }
 
 void
@@ -116,12 +111,6 @@
   y2 = static_cast<int> (Math::max(y1_, y2_));
 
   add(object_manager->rect_get_objs(x1, y1, x2, y2));
-}
-
-bool
-Selection::object_selected(EditorObj* obj) 
-{
-  return std::find(obj_list.begin(), obj_list.end(), obj) != obj_list.end();
 }
 
 EditorObj*

Index: selection.hxx
===================================================================
RCS file: /var/lib/cvs/Games/Pingus/src/editor/selection.hxx,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -d -r1.13 -r1.14
--- selection.hxx       9 Oct 2002 14:49:46 -0000       1.13
+++ selection.hxx       25 Mar 2003 23:15:23 -0000      1.14
@@ -63,8 +63,6 @@
   /** Coordinates must be given in world-co not screen-co */
   void select_rect(float x1_, float y1_, float x2_, float y2_);
     
-  bool object_selected(EditorObj* obj);
-    
   EditorObj* get_current_obj();
   const std::vector<EditorObj*> & get_objects() { return obj_list; }
 





reply via email to

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