mirror of
https://github.com/UberGames/GtkRadiant.git
synced 2024-11-23 04:12:06 +00:00
fixed camera freemove shortcuts bug
git-svn-id: svn://svn.icculus.org/gtkradiant/GtkRadiant/trunk@73 8a3a26a2-13c4-0310-b231-cf6edde360e5
This commit is contained in:
parent
4a43142e7f
commit
665309b15e
7 changed files with 92 additions and 43 deletions
2
CHANGES
2
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
|
||||
|
|
10
TODO
10
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:
|
||||
<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.
|
||||
|
|
|
@ -147,6 +147,7 @@ void accelerator_write(const Accelerator& accelerator, TextOutputStream& ostream
|
|||
}
|
||||
|
||||
typedef std::map<Accelerator, Callback> AcceleratorMap;
|
||||
typedef std::set<Accelerator> 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);
|
||||
|
||||
void GlobalQueuedAccelerators_commit()
|
||||
AcceleratorMap g_queuedAcceleratorsAdd;
|
||||
AcceleratorSet g_queuedAcceleratorsRemove;
|
||||
|
||||
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";
|
||||
}
|
||||
g_queuedAccelerators.clear();
|
||||
}
|
||||
|
||||
void GlobalQueuedAccelerators_add(Accelerator accelerator, const Callback& callback)
|
||||
void globalQueuedAccelerators_remove(Accelerator accelerator)
|
||||
{
|
||||
g_queuedAccelerators.insert(AcceleratorMap::value_type(accelerator, callback));
|
||||
if(g_queuedAcceleratorsAdd.erase(accelerator) == 0)
|
||||
{
|
||||
if(!g_queuedAcceleratorsRemove.insert(accelerator).second)
|
||||
{
|
||||
globalErrorStream() << "globalQueuedAccelerators_remove: accelerator already queued: " << accelerator << "\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void globalQueuedAccelerators_commit()
|
||||
{
|
||||
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);
|
||||
}
|
||||
|
||||
|
|
|
@ -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 "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
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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");
|
||||
|
||||
|
|
Loading…
Reference in a new issue