Hide surface inspector on ESC, just like Q3 inspector.

This commit is contained in:
jdolan 2013-09-11 18:39:13 -04:00
parent c410aad9d7
commit 87c191207b
2 changed files with 15 additions and 5 deletions

View file

@ -24,7 +24,6 @@
//
#include <gtk/gtk.h>
#include <glib/gi18n.h>
#include <gdk/gdkkeysyms.h>
#include "surfacedialog.h"
@ -325,6 +324,14 @@ static gint delete_event_callback( GtkWidget *widget, GdkEvent* event, gpointer
return TRUE;
}
static gint surface_inspector_key_press_event( GtkWidget *widget, GdkEventKey* event, gpointer data ) {
if ( event->keyval == GDK_Escape ) {
HideDlg();
return TRUE;
}
return FALSE;
}
// make the shift increments match the grid settings
// the objective being that the shift+arrows shortcuts move the texture by the corresponding grid size
// this depends on a scale value if you have selected a particular texture on which you want it to work:
@ -416,8 +423,7 @@ void ShowDlg(){
if ( !SurfaceInspector ) {
create_SurfaceInspector();
}
else{
} else {
gtk_widget_show( SurfaceInspector );
}
@ -435,7 +441,6 @@ void HideDlg(){
gtk_widget_hide( SurfaceInspector );
}
// set default values for increments (shift scale and rot)
// this is called by the prefs code if can't find the values
void InitDefaultIncrement( texdef_t *tex ){
@ -790,6 +795,9 @@ GtkWidget* create_SurfaceInspector( void ){
g_signal_connect( (gpointer) SurfaceInspector, "destroy",
G_CALLBACK( gtk_widget_destroy ),
NULL );
g_signal_connect( (gpointer) SurfaceInspector, "key_press_event",
G_CALLBACK( surface_inspector_key_press_event ),
NULL );
g_signal_connect( (gpointer) texture_combo_entry, "key_press_event",
G_CALLBACK( on_texture_combo_entry_key_press_event ),

View file

@ -182,7 +182,9 @@ void apply_surface_flags( texdef_to_face_t *faces ){
tex->contents = ( tex->contents & ~content_mask ) | working_content_flags;
tex->value = working_value;
#ifdef _DEBUG
Sys_Printf( "Surface: %d\tContents: %d\tValue: %d\n", tex->flags, tex->contents, tex->value );
#endif
}
}
@ -334,7 +336,7 @@ GtkWidget* create_SurfaceFlagsFrame( GtkWidget* surfacedialog_widget ){
x = i % 4;
snprintf( buffer, sizeof( buffer ) - 1, "surf%i", i + 1 );
buttonLabel = g_FuncTable.m_pfnReadProjectKey( buffer );
Sys_Printf( "%s: %s\n", buffer, buttonLabel );
//Sys_Printf( "%s: %s\n", buffer, buttonLabel );
surface_buttons[i] = gtk_toggle_button_new_with_label( buttonLabel );
gtk_signal_connect( GTK_OBJECT( surface_buttons[i] ), "toggled", GTK_SIGNAL_FUNC( on_surface_button_toggled ), GINT_TO_POINTER( 1 << i ) );
gtk_widget_show( surface_buttons[i] );