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.cxx,1.9,1.10 editor_eve


From: grumbel
Subject: [Pingus-CVS] CVS: Games/Pingus/src/editor editor.cxx,1.9,1.10 editor_event.cxx,1.13,1.14 editor_event.hxx,1.6,1.7
Date: 29 Jun 2002 16:04:24 -0000

Update of /usr/local/cvsroot/Games/Pingus/src/editor
In directory dark:/tmp/cvs-serv14895/editor

Modified Files:
        editor.cxx editor_event.cxx editor_event.hxx 
Log Message:
- added workaround for focus/input bug in the editor, its not really clean, but 
works

Index: editor.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/editor/editor.cxx,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- editor.cxx  29 Jun 2002 11:54:22 -0000      1.9
+++ editor.cxx  29 Jun 2002 16:04:22 -0000      1.10
@@ -62,8 +62,8 @@
                     move_x(0), move_y(0), show_help_screen(true), 
tool(SELECTOR_TOOL)
 {
   EditorObj::set_editor(this);
-
   event      = new EditorEvent;
+
   panel      = new Panel;
   scroll_map = new ScrollMap;
   object_manager  = new ObjectManager;
@@ -160,6 +160,7 @@
       move_objects();
       draw();
       gui->show ();
+      //std::cout << "GUI has Focus: " << (gui->get_focus () !=  gui) << 
std::endl;
       Display::flip_display(true);
     }
 

Index: editor_event.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/editor/editor_event.cxx,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -d -r1.13 -r1.14
--- editor_event.cxx    29 Jun 2002 11:54:22 -0000      1.13
+++ editor_event.cxx    29 Jun 2002 16:04:22 -0000      1.14
@@ -46,10 +46,8 @@
 #include "action_window.hxx"
 
 EditorEvent::EditorEvent()
-  : is_enabled (0)
+  : is_enabled (1)
 {
-  enable();
-  
 }
 
 EditorEvent::~EditorEvent()
@@ -69,18 +67,26 @@
 EditorEvent::enable()
 {
   ++is_enabled;
+  
+  if (is_enabled)
+    editor->get_gui_manager ()->enable_input ();
 }
 
 void
 EditorEvent::disable()
 {
   --is_enabled;
+
+  if (is_enabled == 0)
+    {
+      editor->get_gui_manager ()->disable_input ();
+    }
 }
 
 void
 EditorEvent::on_button_press(CL_InputDevice *device, const CL_Key& key)
 {
-  if (!is_enabled)
+  if (!accept_input ())
     return;
 
   if (device == CL_Input::keyboards[0])
@@ -375,7 +381,7 @@
 void
 EditorEvent::on_button_release(CL_InputDevice *device, const CL_Key &key)
 {
-  if (!is_enabled)
+  if (!accept_input ())
     return;
 
   if (device == CL_Input::keyboards[0])
@@ -849,6 +855,15 @@
     {
       std::cout << "EditorEvent::editor_show_object_properties (): error: 
multiple objects selected" << std::endl;
     }
+}
+
+bool
+EditorEvent::accept_input ()
+{
+  return
+    is_enabled
+    && 
+    (editor->get_gui_manager ()->get_focus () == editor->get_gui_manager ());
 }
 
 /* EOF */

Index: editor_event.hxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/editor/editor_event.hxx,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- editor_event.hxx    29 Jun 2002 11:54:22 -0000      1.6
+++ editor_event.hxx    29 Jun 2002 16:04:22 -0000      1.7
@@ -92,6 +92,9 @@
   void editor_zoom_in ();
   void editor_zoom_out ();
   void zoom_mode ();
+
+private:
+  bool accept_input ();
 };
 
 #endif




reply via email to

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