Merging upstream.

This commit is contained in:
jdolan 2013-07-09 00:08:11 -04:00
commit 5552711b3c
5 changed files with 158 additions and 230 deletions

View File

@ -212,7 +212,7 @@ class Config:
print 'xml2-config failed' print 'xml2-config failed'
assert( False ) assert( False )
xml2libs = commands.getoutput( 'xml2-config --libs' ) xml2libs = commands.getoutput( 'xml2-config --libs' )
env.Append( LINKFLAGS = xml2libs.split( ' ' ) ) env.ParseConfig( 'xml2-config --libs' )
baseflags = [ '-pipe', '-Wall', '-fmessage-length=0', '-fvisibility=hidden', xml2.split( ' ' ) ] baseflags = [ '-pipe', '-Wall', '-fmessage-length=0', '-fvisibility=hidden', xml2.split( ' ' ) ]
if ( useGtk ): if ( useGtk ):
@ -390,26 +390,28 @@ class Config:
]: ]:
shutil.copy( os.path.join( srcdir, x64_dll ), 'install/x64' ) shutil.copy( os.path.join( srcdir, x64_dll ), 'install/x64' )
def FinishBuild( self, target, source, env ): def FinishBuild( self, target, source, env ):
print( 'Lookup and bundle the PNG and JPEG libraries' ) print( 'Lookup and bundle the PNG and JPEG libraries' )
# radiant.bin doesn't link to jpeg lib directly, grab that from a module # radiant.bin doesn't link to jpeg lib directly, grab that from a module
# Python 2.7 only! # Python 2.7 only!
#module_ldd = subprocess.check_output( 'ldd -r install/modules/image.so', shell = True ) #module_ldd = subprocess.check_output( 'ldd -r install/modules/image.so', shell = True )
p = subprocess.Popen( 'ldd -r install/modules/image.so', shell = True, stdout = subprocess.PIPE ) p = subprocess.Popen( 'ldd -r install/modules/image.so', shell = True, stdout = subprocess.PIPE )
module_ldd = p.communicate()[0] module_ldd = p.communicate()[0]
# print( module_ldd ) # print( module_ldd )
def find_library( output, libname ): def find_library( output, libname ):
match = filter( lambda l : l.find( libname ) != -1, output.split( '\n' ) )[0] print output
return re.split( '.*=> (.*) .*', match )[1] print libname
match = filter( lambda l : l.find( libname ) != -1, output.split( '\n' ) )[0]
return re.split( '.*=> (.*) .*', match )[1]
jpeg_path = find_library( module_ldd, 'libjpeg' ) jpeg_path = find_library( module_ldd, 'libjpeg' )
print( 'JPEG library: %s' % repr( jpeg_path ) ) print( 'JPEG library: %s' % repr( jpeg_path ) )
png_path = find_library( module_ldd, 'libpng' ) png_path = find_library( module_ldd, 'libpng' )
print( 'PNG library: %s' % repr( png_path ) ) print( 'PNG library: %s' % repr( png_path ) )
shutil.copy( jpeg_path, 'install' ) shutil.copy( jpeg_path, 'install' )
shutil.copy( png_path, 'install' ) shutil.copy( png_path, 'install' )
# parse the config statement line to produce/update an existing config list # parse the config statement line to produce/update an existing config list
# the configs expose a list of keywords and accepted values, which the engine parses out # the configs expose a list of keywords and accepted values, which the engine parses out

View File

@ -34,7 +34,7 @@
#include "surfdlg_plugin.h" #include "surfdlg_plugin.h"
#ifdef _DEBUG #ifdef _DEBUG
//#define DBG_SI 1 // #define DBG_SI 1
#endif #endif
#include "gtkr_vector.h" #include "gtkr_vector.h"
@ -63,6 +63,7 @@ bool is_TextureName_conflicting;
void ShowDlg(); void ShowDlg();
void HideDlg(); void HideDlg();
void CancelDlg();
void SetTexMods(); void SetTexMods();
void GetTexMods( bool b_SetUndoPoint = FALSE ); void GetTexMods( bool b_SetUndoPoint = FALSE );
void BuildDialog(); void BuildDialog();
@ -163,7 +164,6 @@ GtkWidget *axial_button;
GtkWidget *done_button; GtkWidget *done_button;
GtkWidget *apply_button; GtkWidget *apply_button;
GtkWidget *cancel_button;
// Callbacks // Callbacks
gboolean on_texture_combo_entry_key_press_event( GtkWidget *widget, GdkEventKey *event, gpointer user_data ); gboolean on_texture_combo_entry_key_press_event( GtkWidget *widget, GdkEventKey *event, gpointer user_data );
@ -197,7 +197,6 @@ static void on_axial_button_clicked( GtkButton *button, gpointer user_data );
static void on_done_button_clicked( GtkButton *button, gpointer user_data ); static void on_done_button_clicked( GtkButton *button, gpointer user_data );
static void on_apply_button_clicked( GtkButton *button, gpointer user_data ); static void on_apply_button_clicked( GtkButton *button, gpointer user_data );
static void on_cancel_button_clicked( GtkButton *button, gpointer user_data );
/* /*
@ -397,6 +396,40 @@ static gint delete_event_callback( GtkWidget *widget, GdkEvent* event, gpointer
return TRUE; return TRUE;
} }
void DoDone() {
if ( !texdef_face_list_empty() ) {
GetTexMods( TRUE );
}
HideDlg();
Sys_UpdateWindows( W_ALL );
}
void DoApply() {
if ( !g_bListenChanged ) {
return;
}
if ( !texdef_face_list_empty() ) {
GetTexMods( TRUE );
Sys_UpdateWindows( W_CAMERA );
GetTexdefInfo_from_Radiant();
SetTexMods();
}
}
static gint surface_inspector_key_press_event( GtkWidget *widget, GdkEventKey* event, gpointer data ) {
// NOTE: catching the 'S' key to hide back the surface inspector has been suggested, but would have bad interactions with the texture typing box
// we could do it, but would have to add some focus management and edit logic to that texture name box
// we would also need to expose radiant's g_Commands to identify remapped command keys etc. (or do a first version with hardcoded 'S')
if ( event->keyval == GDK_Escape ) {
CancelDlg();
return TRUE;
} else if ( event->keyval == GDK_Return ) {
DoApply();
return TRUE;
}
return FALSE;
}
// make the shift increments match the grid settings // make the shift increments match the grid settings
// the objective being that the shift+arrows shortcuts move the texture by the corresponding grid size // 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: // this depends on a scale value if you have selected a particular texture on which you want it to work:
@ -431,13 +464,14 @@ void UpdateSurfaceDialog(){
return; return;
} }
if ( !SurfaceInspector ) { if ( SurfaceInspector == NULL ) {
return; return;
} }
// avoid long delays on slow computers // avoid long delays on slow computers
while ( gtk_events_pending() ) while ( gtk_events_pending() ) {
gtk_main_iteration(); gtk_main_iteration();
}
if ( g_surfwin ) { if ( g_surfwin ) {
#ifdef DBG_SI #ifdef DBG_SI
@ -451,28 +485,27 @@ void UpdateSurfaceDialog(){
// DoSurface will always try to show the surface inspector // DoSurface will always try to show the surface inspector
// or update it because something new has been selected // or update it because something new has been selected
void DoSurface( void ){ void DoSurface( void ) {
#ifdef DBG_SI #ifdef DBG_SI
Sys_Printf( "DoSurface\n" ); Sys_Printf( "DoSurface\n" );
#endif #endif
if ( !SurfaceInspector ) { if ( !SurfaceInspector ) {
create_SurfaceInspector(); create_SurfaceInspector();
} }
ShowDlg(); ShowDlg();
SetTexMods(); SetTexMods();
} }
void ToggleSurface(){ void ToggleSurface() {
#ifdef DBG_SI #ifdef DBG_SI
Sys_Printf( "ToggleSurface Module\n" ); Sys_Printf( "ToggleSurface Module\n" );
#endif #endif
if ( !g_surfwin ) { if ( !g_surfwin ) {
DoSurface(); DoSurface();
} } else {
else{ CancelDlg();
on_cancel_button_clicked( NULL, NULL ); }
}
} }
// NOTE: will raise and show the Surface inspector and exec fit for patches and brushes // NOTE: will raise and show the Surface inspector and exec fit for patches and brushes
@ -484,25 +517,38 @@ void SurfaceDlgFitAll(){
// ============================================================================= // =============================================================================
// SurfaceDialog class // SurfaceDialog class
void ShowDlg(){ void ShowDlg() {
if ( !SurfaceInspector ) {
create_SurfaceInspector();
} else {
gtk_widget_show( SurfaceInspector );
}
if ( !SurfaceInspector ) { GetTexdefInfo_from_Radiant();
create_SurfaceInspector(); GetTexMods( TRUE ); // Set Initial Undo Point
} g_surfwin = TRUE;
else{
gtk_widget_show( SurfaceInspector );
}
GetTexdefInfo_from_Radiant();
GetTexMods( TRUE ); // Set Initial Undo Point
g_surfwin = TRUE;
} }
void HideDlg(){ void HideDlg() {
g_surfwin = FALSE; g_surfwin = FALSE;
gtk_widget_hide( SurfaceInspector ); gtk_widget_hide( SurfaceInspector );
} }
void CancelDlg() {
texturewin = Texturewin();
texturewin->texdef = g_old_texdef;
// cancel the last do if we own it
if ( ( m_nUndoId == Undo_GetUndoId() ) && ( m_nUndoId != 0 ) ) {
#ifdef DBG_SI
Sys_Printf( "CancelDlg calling Undo_Undo\n" );
#endif
g_bListenUpdate = false;
Undo_Undo( TRUE );
g_bListenUpdate = true;
m_nUndoId = 0;
}
HideDlg();
}
// set default values for increments (shift scale and rot) // set default values for increments (shift scale and rot)
// this is called by the prefs code if can't find the values // this is called by the prefs code if can't find the values
@ -622,7 +668,7 @@ void SetTexMods(){
Shows any changes to the main Radiant windows Shows any changes to the main Radiant windows
=============== ===============
*/ */
void GetTexMods( bool b_SetUndoPoint ){ void GetTexMods( bool b_SetUndoPoint ) {
#ifdef DBG_SI #ifdef DBG_SI
Sys_Printf( "SurfaceDlg GetTexMods\n" ); Sys_Printf( "SurfaceDlg GetTexMods\n" );
@ -662,27 +708,15 @@ GtkWidget* create_SurfaceInspector( void ){
GtkWidget *viewport7; GtkWidget *viewport7;
GtkWidget *viewport5; GtkWidget *viewport5;
GtkWidget *viewport6; GtkWidget *viewport6;
GtkWidget *viewport10;
GtkWidget *table1; GtkWidget *table1;
GtkWidget *table4; GtkWidget *table4;
GtkWidget *table5; GtkWidget *table5;
GtkWidget *table7; GtkWidget *table7;
GtkWidget *alignment1;
GtkWidget *alignment2;
GtkWidget *alignment3;
GtkWidget *vbox7; GtkWidget *vbox7;
GtkWidget *hbox1; GtkWidget *hbox1;
GtkWidget *hbox2;
GtkWidget *hbox3;
GtkWidget *hbox4;
GtkWidget *image1;
GtkWidget *image2;
GtkWidget *image3;
GtkWidget *hbuttonbox1; GtkWidget *hbuttonbox1;
@ -1240,84 +1274,19 @@ GtkWidget* create_SurfaceInspector( void ){
gtk_widget_set_size_request( axial_button, 56, 29 ); gtk_widget_set_size_request( axial_button, 56, 29 );
gtk_container_set_border_width( GTK_CONTAINER( axial_button ), 4 ); gtk_container_set_border_width( GTK_CONTAINER( axial_button ), 4 );
viewport10 = gtk_viewport_new( NULL, NULL ); hbuttonbox1 = gtk_hbox_new( FALSE, 5 );
gtk_widget_show( viewport10 );
gtk_box_pack_start( GTK_BOX( vbox7 ), viewport10, FALSE, TRUE, 0 );
gtk_container_set_border_width( GTK_CONTAINER( viewport10 ), 2 );
gtk_viewport_set_shadow_type( GTK_VIEWPORT( viewport10 ), GTK_SHADOW_ETCHED_IN );
hbuttonbox1 = gtk_hbutton_box_new();
gtk_widget_show( hbuttonbox1 ); gtk_widget_show( hbuttonbox1 );
gtk_container_add( GTK_CONTAINER( viewport10 ), hbuttonbox1 ); gtk_box_pack_start( GTK_BOX( vbox7 ), hbuttonbox1, TRUE, FALSE, 0 );
gtk_container_set_border_width( GTK_CONTAINER( hbuttonbox1 ), 4 );
gtk_button_box_set_layout( GTK_BUTTON_BOX( hbuttonbox1 ), GTK_BUTTONBOX_SPREAD );
done_button = gtk_button_new(); apply_button = gtk_button_new_with_label( "Apply" );
gtk_widget_show( done_button );
gtk_container_add( GTK_CONTAINER( hbuttonbox1 ), done_button );
GTK_WIDGET_SET_FLAGS( done_button, GTK_CAN_DEFAULT );
alignment1 = gtk_alignment_new( 0.5, 0.5, 0, 0 );
gtk_widget_show( alignment1 );
gtk_container_add( GTK_CONTAINER( done_button ), alignment1 );
hbox2 = gtk_hbox_new( FALSE, 2 );
gtk_widget_show( hbox2 );
gtk_container_add( GTK_CONTAINER( alignment1 ), hbox2 );
image1 = gtk_image_new_from_stock( "gtk-yes", GTK_ICON_SIZE_BUTTON );
gtk_widget_show( image1 );
gtk_box_pack_start( GTK_BOX( hbox2 ), image1, FALSE, FALSE, 0 );
label = gtk_label_new_with_mnemonic( "Done" );
gtk_widget_show( label );
gtk_box_pack_start( GTK_BOX( hbox2 ), label, FALSE, FALSE, 0 );
gtk_label_set_justify( GTK_LABEL( label ), GTK_JUSTIFY_LEFT );
apply_button = gtk_button_new();
gtk_widget_show( apply_button ); gtk_widget_show( apply_button );
gtk_container_add( GTK_CONTAINER( hbuttonbox1 ), apply_button ); gtk_box_pack_end( GTK_BOX( hbuttonbox1 ), apply_button, FALSE, FALSE, 0 );
GTK_WIDGET_SET_FLAGS( apply_button, GTK_CAN_DEFAULT ); gtk_widget_set_usize( apply_button, 60, -1 );
alignment3 = gtk_alignment_new( 0.5, 0.5, 0, 0 );
gtk_widget_show( alignment3 );
gtk_container_add( GTK_CONTAINER( apply_button ), alignment3 );
hbox4 = gtk_hbox_new( FALSE, 2 );
gtk_widget_show( hbox4 );
gtk_container_add( GTK_CONTAINER( alignment3 ), hbox4 );
image3 = gtk_image_new_from_stock( "gtk-apply", GTK_ICON_SIZE_BUTTON );
gtk_widget_show( image3 );
gtk_box_pack_start( GTK_BOX( hbox4 ), image3, FALSE, FALSE, 0 );
label = gtk_label_new_with_mnemonic( "Apply" );
gtk_widget_show( label );
gtk_box_pack_start( GTK_BOX( hbox4 ), label, FALSE, FALSE, 0 );
gtk_label_set_justify( GTK_LABEL( label ), GTK_JUSTIFY_LEFT );
cancel_button = gtk_button_new();
gtk_widget_show( cancel_button );
gtk_container_add( GTK_CONTAINER( hbuttonbox1 ), cancel_button );
GTK_WIDGET_SET_FLAGS( cancel_button, GTK_CAN_DEFAULT );
alignment2 = gtk_alignment_new( 0.5, 0.5, 0, 0 );
gtk_widget_show( alignment2 );
gtk_container_add( GTK_CONTAINER( cancel_button ), alignment2 );
hbox3 = gtk_hbox_new( FALSE, 2 );
gtk_widget_show( hbox3 );
gtk_container_add( GTK_CONTAINER( alignment2 ), hbox3 );
image2 = gtk_image_new_from_stock( "gtk-no", GTK_ICON_SIZE_BUTTON );
gtk_widget_show( image2 );
gtk_box_pack_start( GTK_BOX( hbox3 ), image2, FALSE, FALSE, 0 );
label = gtk_label_new_with_mnemonic( "Cancel" );
gtk_widget_show( label );
gtk_box_pack_start( GTK_BOX( hbox3 ), label, FALSE, FALSE, 0 );
gtk_label_set_justify( GTK_LABEL( label ), GTK_JUSTIFY_LEFT );
done_button = gtk_button_new_with_label( "Done" );
gtk_widget_show( done_button );
gtk_box_pack_end( GTK_BOX( hbuttonbox1 ), done_button, FALSE, FALSE, 0 );
gtk_widget_set_usize( done_button, 60, -1 );
g_signal_connect( (gpointer) SurfaceInspector, g_signal_connect( (gpointer) SurfaceInspector,
"delete_event", "delete_event",
@ -1326,6 +1295,9 @@ GtkWidget* create_SurfaceInspector( void ){
g_signal_connect( (gpointer) SurfaceInspector, "destroy", g_signal_connect( (gpointer) SurfaceInspector, "destroy",
G_CALLBACK( gtk_widget_destroy ), G_CALLBACK( gtk_widget_destroy ),
NULL ); 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_signal_connect( (gpointer) texture_combo_entry, "key_press_event",
G_CALLBACK( on_texture_combo_entry_key_press_event ), G_CALLBACK( on_texture_combo_entry_key_press_event ),
@ -1410,10 +1382,6 @@ GtkWidget* create_SurfaceInspector( void ){
g_signal_connect( (gpointer) apply_button, "clicked", g_signal_connect( (gpointer) apply_button, "clicked",
G_CALLBACK( on_apply_button_clicked ), G_CALLBACK( on_apply_button_clicked ),
NULL ); NULL );
g_signal_connect( (gpointer) cancel_button, "clicked",
G_CALLBACK( on_cancel_button_clicked ),
NULL );
return SurfaceInspector; return SurfaceInspector;
} }
@ -1862,40 +1830,10 @@ static void on_axial_button_clicked( GtkButton *button, gpointer user_data ){
Sys_UpdateWindows( W_ALL ); Sys_UpdateWindows( W_ALL );
} }
static void on_done_button_clicked( GtkButton *button, gpointer user_data ) {
// Action Buttons DoDone();
static void on_done_button_clicked( GtkButton *button, gpointer user_data ){
if ( !texdef_face_list_empty() ) {
GetTexMods( TRUE );
}
HideDlg();
Sys_UpdateWindows( W_ALL );
} }
static void on_apply_button_clicked( GtkButton *button, gpointer user_data ){ static void on_apply_button_clicked( GtkButton *button, gpointer user_data ) {
if ( !g_bListenChanged ) { DoApply();
return;
}
if ( !texdef_face_list_empty() ) {
GetTexMods( TRUE );
Sys_UpdateWindows( W_CAMERA );
GetTexdefInfo_from_Radiant();
SetTexMods();
}
}
static void on_cancel_button_clicked( GtkButton *button, gpointer user_data ){
texturewin = Texturewin();
texturewin->texdef = g_old_texdef;
// cancel the last do if we own it
if ( ( m_nUndoId == Undo_GetUndoId() ) && ( m_nUndoId != 0 ) ) {
#ifdef DBG_SI
Sys_Printf( "OnCancel calling Undo_Undo\n" );
#endif
g_bListenUpdate = false;
Undo_Undo( TRUE );
g_bListenUpdate = true;
m_nUndoId = 0;
}
HideDlg();
} }

View File

@ -73,8 +73,6 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "bobtoolz", "contrib\bobtool
EndProject EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "gtkgensurf", "contrib\gtkgensurf\gtkgensurf.vcxproj", "{E37A9846-84FC-48F8-9880-954C5D9F8ED0}" Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "gtkgensurf", "contrib\gtkgensurf\gtkgensurf.vcxproj", "{E37A9846-84FC-48F8-9880-954C5D9F8ED0}"
EndProject EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "idtech2", "contrib\idtech2\idtech2.vcxproj", "{850DD97C-B457-497D-B5F5-DA1904FAC5F9}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "bkgrnd2d", "contrib\bkgrnd2d\bkgrnd2d.vcxproj", "{D43C13B9-35AC-4EC1-8A90-DF6D7132B9BD}" Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "bkgrnd2d", "contrib\bkgrnd2d\bkgrnd2d.vcxproj", "{D43C13B9-35AC-4EC1-8A90-DF6D7132B9BD}"
EndProject EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "vfsqlpk3", "plugins\vfsqlpk3\vfsqlpk3.vcxproj", "{9FD68F2C-B26A-461D-96E0-55AFC48AC9E0}" Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "vfsqlpk3", "plugins\vfsqlpk3\vfsqlpk3.vcxproj", "{9FD68F2C-B26A-461D-96E0-55AFC48AC9E0}"
@ -358,13 +356,6 @@ Global
{E37A9846-84FC-48F8-9880-954C5D9F8ED0}.Release|Win32.Build.0 = Release|Win32 {E37A9846-84FC-48F8-9880-954C5D9F8ED0}.Release|Win32.Build.0 = Release|Win32
{E37A9846-84FC-48F8-9880-954C5D9F8ED0}.Release|x64.ActiveCfg = Release|x64 {E37A9846-84FC-48F8-9880-954C5D9F8ED0}.Release|x64.ActiveCfg = Release|x64
{E37A9846-84FC-48F8-9880-954C5D9F8ED0}.Release|x64.Build.0 = Release|x64 {E37A9846-84FC-48F8-9880-954C5D9F8ED0}.Release|x64.Build.0 = Release|x64
{850DD97C-B457-497D-B5F5-DA1904FAC5F9}.Debug|Win32.ActiveCfg = Debug|Win32
{850DD97C-B457-497D-B5F5-DA1904FAC5F9}.Debug|Win32.Build.0 = Debug|Win32
{850DD97C-B457-497D-B5F5-DA1904FAC5F9}.Debug|x64.ActiveCfg = Debug|x64
{850DD97C-B457-497D-B5F5-DA1904FAC5F9}.Release|Win32.ActiveCfg = Release|Win32
{850DD97C-B457-497D-B5F5-DA1904FAC5F9}.Release|Win32.Build.0 = Release|Win32
{850DD97C-B457-497D-B5F5-DA1904FAC5F9}.Release|x64.ActiveCfg = Release|x64
{850DD97C-B457-497D-B5F5-DA1904FAC5F9}.Release|x64.Build.0 = Release|x64
{D43C13B9-35AC-4EC1-8A90-DF6D7132B9BD}.Debug|Win32.ActiveCfg = Debug|Win32 {D43C13B9-35AC-4EC1-8A90-DF6D7132B9BD}.Debug|Win32.ActiveCfg = Debug|Win32
{D43C13B9-35AC-4EC1-8A90-DF6D7132B9BD}.Debug|Win32.Build.0 = Debug|Win32 {D43C13B9-35AC-4EC1-8A90-DF6D7132B9BD}.Debug|Win32.Build.0 = Debug|Win32
{D43C13B9-35AC-4EC1-8A90-DF6D7132B9BD}.Debug|x64.ActiveCfg = Debug|x64 {D43C13B9-35AC-4EC1-8A90-DF6D7132B9BD}.Debug|x64.ActiveCfg = Debug|x64

View File

@ -273,25 +273,23 @@ static void OnCancel( GtkWidget *widget, gpointer data ){
g_dlgSurface.HideDlg(); g_dlgSurface.HideDlg();
} }
static gint OnDialogKey( GtkWidget* widget, GdkEventKey* event, gpointer data ){ static gint OnDialogKey( GtkWidget* widget, GdkEventKey* event, gpointer data ) {
if ( g_surfwin ) { if ( g_surfwin ) {
if ( event->keyval == GDK_Return ) { if ( event->keyval == GDK_Return ) {
if ( g_dlgSurface.m_bEditingTextureWidget ) { if ( g_dlgSurface.m_bEditingTextureWidget ) {
OnApply( NULL, NULL ); OnApply( NULL, NULL );
g_dlgSurface.m_bEditingTextureWidget = false; g_dlgSurface.m_bEditingTextureWidget = false;
} } else {
else OnDone( NULL, NULL );
{ }
OnDone( NULL, NULL ); return TRUE;
} }
return TRUE; if ( event->keyval == GDK_Escape ) {
} OnCancel( NULL, NULL );
if ( event->keyval == GDK_Escape ) { return TRUE;
OnCancel( NULL, NULL ); }
return TRUE; }
} return FALSE;
}
return FALSE;
} }
// the widget can be one of hshift, vshift, hscale, vscale, rotate // the widget can be one of hshift, vshift, hscale, vscale, rotate
@ -499,7 +497,7 @@ void SurfaceDlg::InitDefaultIncrement( texdef_t *tex ){
tex->rotate = 10; tex->rotate = 10;
} }
void SurfaceDlg::BuildDialog(){ void SurfaceDlg::BuildDialog() {
GtkWidget *dlg, *vbox, *hbox2, *frame, *table, *label; GtkWidget *dlg, *vbox, *hbox2, *frame, *table, *label;
GtkWidget *button, *entry, *spin; GtkWidget *button, *entry, *spin;

View File

@ -28,42 +28,41 @@
//#define DBG_SI 1 //#define DBG_SI 1
#endif #endif
class SurfaceDlg : public Dialog class SurfaceDlg : public Dialog {
{ bool m_bPatchMode;
bool m_bPatchMode; // brush primitive fake shift scale rot coords
// brush primitive fake shift scale rot coords float m_shift[2];
float m_shift[2]; float m_rotate;
float m_rotate; float m_scale[2];
float m_scale[2];
public: public:
SurfaceDlg (); SurfaceDlg();
virtual void ShowDlg(); virtual void ShowDlg();
virtual void HideDlg(); virtual void HideDlg();
void SetTexMods(); void SetTexMods();
void GetTexMods(); void GetTexMods();
void InitDefaultIncrement( texdef_t * ); void InitDefaultIncrement( texdef_t * );
// Dialog Data // Dialog Data
int m_nHeight; int m_nHeight;
int m_nWidth; int m_nWidth;
// 0 is invalid, otherwise it's the Id of the last 'do' we are responsible for // 0 is invalid, otherwise it's the Id of the last 'do' we are responsible for
int m_nUndoId; int m_nUndoId;
// is the user editing the texture widget (that changes the behaviour of 'Enter' key from OnDone to OnApply // is the user editing the texture widget (that changes the behaviour of 'Enter' key from OnDone to OnApply
// reset to false at each SetTexMods or when dealing with Enter key // reset to false at each SetTexMods or when dealing with Enter key
bool m_bEditingTextureWidget; bool m_bEditingTextureWidget;
protected: protected:
void BuildDialog(); void BuildDialog();
public: public:
// called to perform a fitting from the outside (shortcut key) // called to perform a fitting from the outside (shortcut key)
void FitAll(); void FitAll();
GtkWidget *GetWidget(); // { return m_pWidget; } GtkWidget *GetWidget();
}; };
#endif // _SURFACEDIALOG_H_ #endif // _SURFACEDIALOG_H_