From: spog Date: Mon, 29 May 2006 12:24:11 +0000 (+0000) Subject: fixed camera freemove shortcuts bug X-Git-Tag: xonotic-v0.7.0~16^2~12^2~221 X-Git-Url: http://de.git.xonotic.org/?p=xonotic%2Fnetradiant.git;a=commitdiff_plain;h=665309b15e2438423bd4e060f7c38c5cce30515c fixed camera freemove shortcuts bug git-svn-id: svn://svn.icculus.org/gtkradiant/GtkRadiant/trunk@73 8a3a26a2-13c4-0310-b231-cf6edde360e5 --- diff --git a/CHANGES b/CHANGES index 86e6dd46..e055d652 100644 --- 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. +- 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 diff --git a/TODO b/TODO index 1cbf0308..48f39efa 100644 --- 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) - +GUI: error! In camera window: + - press and release RightMouse + - press and hold LeftMouse + - press and release RightMouse + - press and release RightMouse + - release LeftMouse 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:
[arghrad] "[MapFile]"
+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. diff --git a/libs/gtkutil/accelerator.cpp b/libs/gtkutil/accelerator.cpp index bbb2793c..914fc9f9 100644 --- a/libs/gtkutil/accelerator.cpp +++ b/libs/gtkutil/accelerator.cpp @@ -147,6 +147,7 @@ void accelerator_write(const Accelerator& accelerator, TextOutputStream& ostream } typedef std::map AcceleratorMap; +typedef std::set AcceleratorSet; 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); +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) @@ -336,7 +360,7 @@ bool Buttons_release(ButtonMask& buttons, guint button, guint state) accel_group_test(toplevel, global_accel); #endif } - GlobalQueuedAccelerators_commit(); + globalQueuedAccelerators_commit(); } 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) { + //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"; @@ -503,6 +528,7 @@ void special_accelerators_add(Accelerator accelerator, const Callback& callback) } 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"; @@ -511,6 +537,7 @@ void special_accelerators_remove(Accelerator accelerator) 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"; @@ -518,6 +545,7 @@ void keydown_accelerators_add(Accelerator accelerator, const Callback& callback) } 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"; @@ -526,6 +554,7 @@ void keydown_accelerators_remove(Accelerator accelerator) 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"; @@ -533,6 +562,7 @@ void keyup_accelerators_add(Accelerator accelerator, const Callback& callback) } 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"; @@ -550,7 +580,7 @@ GClosure* accel_group_add_accelerator(GtkAccelGroup* group, Accelerator accelera { 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; @@ -566,6 +596,7 @@ void accel_group_remove_accelerator(GtkAccelGroup* group, Accelerator accelerato { 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 @@ -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 - 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) { - //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); } diff --git a/libs/gtkutil/widget.h b/libs/gtkutil/widget.h index 3bfa1fca..225fccf4 100644 --- a/libs/gtkutil/widget.h +++ b/libs/gtkutil/widget.h @@ -26,6 +26,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA #include #include "generic/callback.h" #include "warnings.h" +#include "debugging/debugging.h" 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); } +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 diff --git a/radiant/camwindow.cpp b/radiant/camwindow.cpp index 62e209b8..73c416c6 100644 --- a/radiant/camwindow.cpp +++ b/radiant/camwindow.cpp @@ -1351,9 +1351,8 @@ static gboolean camwindow_freemove_focusout(GtkWidget* widget, GdkEventFocus* ev 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); @@ -1370,9 +1369,8 @@ void CamWnd::EnableFreeMove() 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); diff --git a/radiant/console.cpp b/radiant/console.cpp index f48a9877..37a03428 100644 --- a/radiant/console.cpp +++ b/radiant/console.cpp @@ -107,6 +107,7 @@ gboolean destroy_set_null(GtkWindow* widget, GtkWidget** p) return FALSE; } +WidgetFocusPrinter g_consoleWidgetFocusPrinter("console"); GtkWidget* Console_constructWindow(GtkWindow* toplevel) { @@ -128,6 +129,8 @@ GtkWidget* Console_constructWindow(GtkWindow* toplevel) 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); } diff --git a/radiant/mainframe.cpp b/radiant/mainframe.cpp index 56f8b600..c3fea836 100644 --- a/radiant/mainframe.cpp +++ b/radiant/mainframe.cpp @@ -2544,30 +2544,6 @@ GtkWidget* create_main_statusbar(GtkWidget *pStatusLabel[c_count_status]) #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");