]> de.git.xonotic.org Git - xonotic/netradiant.git/commitdiff
fixed camera freemove shortcuts bug
authorspog <spog>
Mon, 29 May 2006 12:24:11 +0000 (12:24 +0000)
committerspog <spog>
Mon, 29 May 2006 12:24:11 +0000 (12:24 +0000)
git-svn-id: svn://svn.icculus.org/gtkradiant/GtkRadiant/trunk@73 8a3a26a2-13c4-0310-b231-cf6edde360e5

CHANGES
TODO
libs/gtkutil/accelerator.cpp
libs/gtkutil/widget.h
radiant/camwindow.cpp
radiant/console.cpp
radiant/mainframe.cpp

diff --git a/CHANGES b/CHANGES
index 86e6dd46eb6f2957c53b875ef565dcc70a21ac71..e055d6522dd9f96b99d9d868c8db481ff56694b2 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -4,6 +4,8 @@ that we distribute with the binaries. (see changelog)
 29/05/2006
 SPoG
 - Changed default doom3 light_radius to be taken from the entity-definition.
 29/05/2006
 SPoG
 - Changed default doom3 light_radius to be taken from the entity-definition.
+- Fixed error when entering and exiting camera freemove with LMB pressed.
+  http://zerowing.idsoftware.com/bugzilla/show_bug.cgi?id=1090
 
 13/05/2006
 LordHavoc
 
 13/05/2006
 LordHavoc
diff --git a/TODO b/TODO
index 1cbf0308af36290b082da7d5def461c4ae4eb316..48f39efadf3f98569035d8bf5115ef52b85e0eae 100644 (file)
--- a/TODO
+++ b/TODO
@@ -12,7 +12,12 @@ Entity: creating a new entity with all the brushes of another entity selected re
 SConscript: build fails if SETUP=1
 GUI: can't use arrow keys to navigate in camera view when capslock is enabled
 GUI: screensaver causes: gdkgc-win32.c: line 905 (gdk_win32_hdc_get): assertion failed: (win32_gc->hdc == NULL)
 SConscript: build fails if SETUP=1
 GUI: can't use arrow keys to navigate in camera view when capslock is enabled
 GUI: screensaver causes: gdkgc-win32.c: line 905 (gdk_win32_hdc_get): assertion failed: (win32_gc->hdc == NULL)
-
+GUI: error! In camera window:
+  - press and release RightMouse
+  - press and hold LeftMouse
+  - press and release RightMouse
+  - press and release RightMouse
+  - release LeftMouse
 
 FEATURES
 
 
 FEATURES
 
@@ -39,6 +44,9 @@ At the moment you can only create custom variables by editing the XML file. A cu
 This variable could then be used in a command like this:
 <pre>[arghrad] "[MapFile]"</pre>
 
 This variable could then be used in a command like this:
 <pre>[arghrad] "[MapFile]"</pre>
 
+Texture Browser: add a way to make large texture sets more manageable - shaderlist.txt was previously used this way
+Brush: MMB+ctrl to paint texture on whole brush/patch.
+Camera: add alternative highlighting styles (used to be J).
 Doom3: filter func_splinemovers
 Entity: draw arrowheads to show direction of connection-lines.
 ? MMB to select a texture should also apply that texture to all selected faces.
 Doom3: filter func_splinemovers
 Entity: draw arrowheads to show direction of connection-lines.
 ? MMB to select a texture should also apply that texture to all selected faces.
index bbb2793c412625c64e8f1241b04051035a263211..914fc9f9d7cfa030e60656fe4e41458f9ed4d579 100644 (file)
@@ -147,6 +147,7 @@ void accelerator_write(const Accelerator& accelerator, TextOutputStream& ostream
 }
 
 typedef std::map<Accelerator, Callback> AcceleratorMap;
 }
 
 typedef std::map<Accelerator, Callback> AcceleratorMap;
+typedef std::set<Accelerator> AcceleratorSet;
 
 bool accelerator_map_insert(AcceleratorMap& acceleratorMap, Accelerator accelerator, const Callback& callback)
 {
 
 bool accelerator_map_insert(AcceleratorMap& acceleratorMap, Accelerator accelerator, const Callback& callback)
 {
@@ -260,22 +261,45 @@ bool global_accel_enabled()
 }
 
 
 }
 
 
-AcceleratorMap g_queuedAccelerators;
-
 GClosure* accel_group_add_accelerator(GtkAccelGroup* group, Accelerator accelerator, const Callback& callback);
 GClosure* accel_group_add_accelerator(GtkAccelGroup* group, Accelerator accelerator, const Callback& callback);
+void accel_group_remove_accelerator(GtkAccelGroup* group, Accelerator accelerator);
+
+AcceleratorMap g_queuedAcceleratorsAdd;
+AcceleratorSet g_queuedAcceleratorsRemove;
 
 
-void GlobalQueuedAccelerators_commit()
+void globalQueuedAccelerators_add(Accelerator accelerator, const Callback& callback)
 {
 {
-  for(AcceleratorMap::const_iterator i = g_queuedAccelerators.begin(); i != g_queuedAccelerators.end(); ++i)
+  if(!g_queuedAcceleratorsAdd.insert(AcceleratorMap::value_type(accelerator, callback)).second)
   {
   {
-    accel_group_add_accelerator(global_accel, (*i).first, (*i).second);
+    globalErrorStream() << "globalQueuedAccelerators_add: accelerator already queued: " << accelerator << "\n";
+  }
+}
+
+void globalQueuedAccelerators_remove(Accelerator accelerator)
+{
+  if(g_queuedAcceleratorsAdd.erase(accelerator) == 0)
+  {
+    if(!g_queuedAcceleratorsRemove.insert(accelerator).second)
+    {
+      globalErrorStream() << "globalQueuedAccelerators_remove: accelerator already queued: " << accelerator << "\n";
+    }
   }
   }
-  g_queuedAccelerators.clear();
 }
 
 }
 
-void GlobalQueuedAccelerators_add(Accelerator accelerator, const Callback& callback)
+void globalQueuedAccelerators_commit()
 {
 {
-  g_queuedAccelerators.insert(AcceleratorMap::value_type(accelerator, callback));
+  for(AcceleratorSet::const_iterator i = g_queuedAcceleratorsRemove.begin(); i != g_queuedAcceleratorsRemove.end(); ++i)
+  {
+    //globalOutputStream() << "removing: " << (*i).first << "\n";
+    accel_group_remove_accelerator(global_accel, *i);
+  }
+  g_queuedAcceleratorsRemove.clear();
+  for(AcceleratorMap::const_iterator i = g_queuedAcceleratorsAdd.begin(); i != g_queuedAcceleratorsAdd.end(); ++i)
+  {
+    //globalOutputStream() << "adding: " << (*i).first << "\n";
+    accel_group_add_accelerator(global_accel, (*i).first, (*i).second);
+  }
+  g_queuedAcceleratorsAdd.clear();
 }
 
 void accel_group_test(GtkWindow* toplevel, GtkAccelGroup* accel)
 }
 
 void accel_group_test(GtkWindow* toplevel, GtkAccelGroup* accel)
@@ -336,7 +360,7 @@ bool Buttons_release(ButtonMask& buttons, guint button, guint state)
       accel_group_test(toplevel, global_accel);
 #endif
     }
       accel_group_test(toplevel, global_accel);
 #endif
     }
-    GlobalQueuedAccelerators_commit();
+    globalQueuedAccelerators_commit();
   }
   buttons = bitfield_disable(buttons, ButtonMask_for_event_button(button));
 #if 0
   }
   buttons = bitfield_disable(buttons, ButtonMask_for_event_button(button));
 #if 0
@@ -496,6 +520,7 @@ void GlobalPressedKeys_disconnect(GtkWindow* window)
 
 void special_accelerators_add(Accelerator accelerator, const Callback& callback)
 {
 
 void special_accelerators_add(Accelerator accelerator, const Callback& callback)
 {
+  //globalOutputStream() << "special_accelerators_add: " << makeQuoted(accelerator) << "\n";
   if(!accelerator_map_insert(g_special_accelerators, accelerator, callback))
   {
     globalErrorStream() << "special_accelerators_add: already exists: " << makeQuoted(accelerator) << "\n";
   if(!accelerator_map_insert(g_special_accelerators, accelerator, callback))
   {
     globalErrorStream() << "special_accelerators_add: already exists: " << makeQuoted(accelerator) << "\n";
@@ -503,6 +528,7 @@ void special_accelerators_add(Accelerator accelerator, const Callback& callback)
 }
 void special_accelerators_remove(Accelerator accelerator)
 {
 }
 void special_accelerators_remove(Accelerator accelerator)
 {
+  //globalOutputStream() << "special_accelerators_remove: " << makeQuoted(accelerator) << "\n";
   if(!accelerator_map_erase(g_special_accelerators, accelerator))
   {
     globalErrorStream() << "special_accelerators_remove: not found: " << makeQuoted(accelerator) << "\n";
   if(!accelerator_map_erase(g_special_accelerators, accelerator))
   {
     globalErrorStream() << "special_accelerators_remove: not found: " << makeQuoted(accelerator) << "\n";
@@ -511,6 +537,7 @@ void special_accelerators_remove(Accelerator accelerator)
 
 void keydown_accelerators_add(Accelerator accelerator, const Callback& callback)
 {
 
 void keydown_accelerators_add(Accelerator accelerator, const Callback& callback)
 {
+  //globalOutputStream() << "keydown_accelerators_add: " << makeQuoted(accelerator) << "\n";
   if(!accelerator_map_insert(g_keydown_accelerators, accelerator, callback))
   {
     globalErrorStream() << "keydown_accelerators_add: already exists: " << makeQuoted(accelerator) << "\n";
   if(!accelerator_map_insert(g_keydown_accelerators, accelerator, callback))
   {
     globalErrorStream() << "keydown_accelerators_add: already exists: " << makeQuoted(accelerator) << "\n";
@@ -518,6 +545,7 @@ void keydown_accelerators_add(Accelerator accelerator, const Callback& callback)
 }
 void keydown_accelerators_remove(Accelerator accelerator)
 {
 }
 void keydown_accelerators_remove(Accelerator accelerator)
 {
+  //globalOutputStream() << "keydown_accelerators_remove: " << makeQuoted(accelerator) << "\n";
   if(!accelerator_map_erase(g_keydown_accelerators, accelerator))
   {
     globalErrorStream() << "keydown_accelerators_remove: not found: " << makeQuoted(accelerator) << "\n";
   if(!accelerator_map_erase(g_keydown_accelerators, accelerator))
   {
     globalErrorStream() << "keydown_accelerators_remove: not found: " << makeQuoted(accelerator) << "\n";
@@ -526,6 +554,7 @@ void keydown_accelerators_remove(Accelerator accelerator)
 
 void keyup_accelerators_add(Accelerator accelerator, const Callback& callback)
 {
 
 void keyup_accelerators_add(Accelerator accelerator, const Callback& callback)
 {
+  //globalOutputStream() << "keyup_accelerators_add: " << makeQuoted(accelerator) << "\n";
   if(!accelerator_map_insert(g_keyup_accelerators, accelerator, callback))
   {
     globalErrorStream() << "keyup_accelerators_add: already exists: " << makeQuoted(accelerator) << "\n";
   if(!accelerator_map_insert(g_keyup_accelerators, accelerator, callback))
   {
     globalErrorStream() << "keyup_accelerators_add: already exists: " << makeQuoted(accelerator) << "\n";
@@ -533,6 +562,7 @@ void keyup_accelerators_add(Accelerator accelerator, const Callback& callback)
 }
 void keyup_accelerators_remove(Accelerator accelerator)
 {
 }
 void keyup_accelerators_remove(Accelerator accelerator)
 {
+  //globalOutputStream() << "keyup_accelerators_remove: " << makeQuoted(accelerator) << "\n";
   if(!accelerator_map_erase(g_keyup_accelerators, accelerator))
   {
     globalErrorStream() << "keyup_accelerators_remove: not found: " << makeQuoted(accelerator) << "\n";
   if(!accelerator_map_erase(g_keyup_accelerators, accelerator))
   {
     globalErrorStream() << "keyup_accelerators_remove: not found: " << makeQuoted(accelerator) << "\n";
@@ -550,7 +580,7 @@ GClosure* accel_group_add_accelerator(GtkAccelGroup* group, Accelerator accelera
 {
   if(accelerator.key != 0 && gtk_accelerator_valid(accelerator.key, accelerator.modifiers))
   {
 {
   if(accelerator.key != 0 && gtk_accelerator_valid(accelerator.key, accelerator.modifiers))
   {
-    //globalOutputStream() << "adding accelerator: " << accelerator.key << " " << accelerator.modifiers << "\n";
+    //globalOutputStream() << "global_accel_connect: " << makeQuoted(accelerator) << "\n";
     GClosure* closure = create_cclosure(G_CALLBACK(accel_closure_callback), callback);
     gtk_accel_group_connect(group, accelerator.key, accelerator.modifiers, GTK_ACCEL_VISIBLE, closure);
     return closure;
     GClosure* closure = create_cclosure(G_CALLBACK(accel_closure_callback), callback);
     gtk_accel_group_connect(group, accelerator.key, accelerator.modifiers, GTK_ACCEL_VISIBLE, closure);
     return closure;
@@ -566,6 +596,7 @@ void accel_group_remove_accelerator(GtkAccelGroup* group, Accelerator accelerato
 {
   if(accelerator.key != 0 && gtk_accelerator_valid(accelerator.key, accelerator.modifiers))
   {
 {
   if(accelerator.key != 0 && gtk_accelerator_valid(accelerator.key, accelerator.modifiers))
   {
+    //globalOutputStream() << "global_accel_disconnect: " << makeQuoted(accelerator) << "\n";
     gtk_accel_group_disconnect_key(group, accelerator.key, accelerator.modifiers);
   }
   else
     gtk_accel_group_disconnect_key(group, accelerator.key, accelerator.modifiers);
   }
   else
@@ -591,14 +622,20 @@ GClosure* global_accel_group_add_accelerator(Accelerator accelerator, const Call
   if(!global_accel_enabled())
   {
     // workaround: cannot add to GtkAccelGroup while it is disabled
   if(!global_accel_enabled())
   {
     // workaround: cannot add to GtkAccelGroup while it is disabled
-    GlobalQueuedAccelerators_add(accelerator, callback);
+    //globalOutputStream() << "queued for add: " << accelerator << "\n";
+    globalQueuedAccelerators_add(accelerator, callback);
     return 0;
   }
   return accel_group_add_accelerator(global_accel, accelerator, callback);
 }
 void global_accel_group_remove_accelerator(Accelerator accelerator)
 {
     return 0;
   }
   return accel_group_add_accelerator(global_accel, accelerator, callback);
 }
 void global_accel_group_remove_accelerator(Accelerator accelerator)
 {
-  //ASSERT_MESSAGE(global_accel_enabled(), "removing accelerator while global accel is disabled");
+  if(!global_accel_enabled())
+  {
+    //globalOutputStream() << "queued for remove: " << accelerator << "\n";
+    globalQueuedAccelerators_remove(accelerator);
+    return;
+  }
   accel_group_remove_accelerator(global_accel, accelerator);
 }
 
   accel_group_remove_accelerator(global_accel, accelerator);
 }
 
index 3bfa1fcaddbb323d9f59792bce24ceb1f75dc5cc..225fccf4f595e2ea3e3eee7e331693ab88540322 100644 (file)
@@ -26,6 +26,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 #include <gtk/gtkwidget.h>
 #include "generic/callback.h"
 #include "warnings.h"
 #include <gtk/gtkwidget.h>
 #include "generic/callback.h"
 #include "warnings.h"
+#include "debugging/debugging.h"
 
 inline void widget_set_visible(GtkWidget* widget, bool shown)
 {
 
 inline void widget_set_visible(GtkWidget* widget, bool shown)
 {
@@ -161,5 +162,29 @@ inline void widget_make_default(GtkWidget* widget)
   gtk_widget_grab_default(widget);
 }
 
   gtk_widget_grab_default(widget);
 }
 
+class WidgetFocusPrinter
+{
+  const char* m_name;
+
+  static gboolean focus_in(GtkWidget *widget, GdkEventFocus *event, WidgetFocusPrinter* self)
+  {
+    globalOutputStream() << self->m_name << " takes focus\n";
+    return FALSE;
+  }
+  static gboolean focus_out(GtkWidget *widget, GdkEventFocus *event, WidgetFocusPrinter* self)
+  {
+    globalOutputStream() << self->m_name << " loses focus\n";
+    return FALSE;
+  }
+public:
+  WidgetFocusPrinter(const char* name) : m_name(name)
+  {
+  }
+  void connect(GtkWidget* widget)
+  {
+    g_signal_connect(G_OBJECT(widget), "focus_in_event", G_CALLBACK(focus_in), this);
+    g_signal_connect(G_OBJECT(widget), "focus_out_event", G_CALLBACK(focus_out), this);
+  }
+};
 
 #endif
 
 #endif
index 62e209b8b58a77e7d2410c88c53424ae383a0da9..73c416c6fd8623f694e544190ff33b4a175b2f46 100644 (file)
@@ -1351,9 +1351,8 @@ static gboolean camwindow_freemove_focusout(GtkWidget* widget, GdkEventFocus* ev
 
 void CamWnd::EnableFreeMove()
 {
 
 void CamWnd::EnableFreeMove()
 {
-#if 0
-  globalOutputStream() << "EnableFreeMove\n";
-#endif
+  //globalOutputStream() << "EnableFreeMove\n";
+
   ASSERT_MESSAGE(!m_bFreeMove, "EnableFreeMove: free-move was already enabled");
   m_bFreeMove = true;
   Camera_clearMovementFlags(getCamera(), MOVE_ALL);
   ASSERT_MESSAGE(!m_bFreeMove, "EnableFreeMove: free-move was already enabled");
   m_bFreeMove = true;
   Camera_clearMovementFlags(getCamera(), MOVE_ALL);
@@ -1370,9 +1369,8 @@ void CamWnd::EnableFreeMove()
 
 void CamWnd::DisableFreeMove()
 {
 
 void CamWnd::DisableFreeMove()
 {
-#if 0
-  globalOutputStream() << "DisableFreeMove\n";
-#endif
+  //globalOutputStream() << "DisableFreeMove\n";
+
   ASSERT_MESSAGE(m_bFreeMove, "DisableFreeMove: free-move was not enabled");
   m_bFreeMove = false;
   Camera_clearMovementFlags(getCamera(), MOVE_ALL);
   ASSERT_MESSAGE(m_bFreeMove, "DisableFreeMove: free-move was not enabled");
   m_bFreeMove = false;
   Camera_clearMovementFlags(getCamera(), MOVE_ALL);
index f48a9877b77b44fa66189c8487d3defc7cfecb71..37a034284212d1fdc3d53a4f12cf27628a4d59ea 100644 (file)
@@ -107,6 +107,7 @@ gboolean destroy_set_null(GtkWindow* widget, GtkWidget** p)
   return FALSE;
 }
 
   return FALSE;
 }
 
+WidgetFocusPrinter g_consoleWidgetFocusPrinter("console");
 
 GtkWidget* Console_constructWindow(GtkWindow* toplevel)
 {
 
 GtkWidget* Console_constructWindow(GtkWindow* toplevel)
 {
@@ -128,6 +129,8 @@ GtkWidget* Console_constructWindow(GtkWindow* toplevel)
 
     widget_connect_escape_clear_focus_widget(g_console);
 
 
     widget_connect_escape_clear_focus_widget(g_console);
 
+    //g_consoleWidgetFocusPrinter.connect(g_console);
+
     g_signal_connect(G_OBJECT(g_console), "populate-popup", G_CALLBACK(console_populate_popup), 0);
     g_signal_connect(G_OBJECT(g_console), "destroy", G_CALLBACK(destroy_set_null), &g_console);
   }
     g_signal_connect(G_OBJECT(g_console), "populate-popup", G_CALLBACK(console_populate_popup), 0);
     g_signal_connect(G_OBJECT(g_console), "destroy", G_CALLBACK(destroy_set_null), &g_console);
   }
index 56f8b6001e532537fc750a14b2eecd67ae5be920..c3fea8364efb51a922f98c52c11b9a0b6706ded1 100644 (file)
@@ -2544,30 +2544,6 @@ GtkWidget* create_main_statusbar(GtkWidget *pStatusLabel[c_count_status])
 
 #if 0
 
 
 #if 0
 
-class WidgetFocusPrinter
-{
-  const char* m_name;
-
-  static gboolean focus_in(GtkWidget *widget, GdkEventFocus *event, WidgetFocusPrinter* self)
-  {
-    globalOutputStream() << self->m_name << " takes focus\n";
-    return FALSE;
-  }
-  static gboolean focus_out(GtkWidget *widget, GdkEventFocus *event, WidgetFocusPrinter* self)
-  {
-    globalOutputStream() << self->m_name << " loses focus\n";
-    return FALSE;
-  }
-public:
-  WidgetFocusPrinter(const char* name) : m_name(name)
-  {
-  }
-  void connect(GtkWindow* window)
-  {
-    g_signal_connect(G_OBJECT(window), "focus_in_event", G_CALLBACK(focus_in), this);
-    g_signal_connect(G_OBJECT(window), "focus_out_event", G_CALLBACK(focus_out), this);
-  }
-};
 
 WidgetFocusPrinter g_mainframeWidgetFocusPrinter("mainframe");
 
 
 WidgetFocusPrinter g_mainframeWidgetFocusPrinter("mainframe");