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 ):
@ -400,6 +400,8 @@ class Config:
# print( module_ldd ) # print( module_ldd )
def find_library( output, libname ): def find_library( output, libname ):
print output
print libname
match = filter( lambda l : l.find( libname ) != -1, output.split( '\n' ) )[0] match = filter( lambda l : l.find( libname ) != -1, output.split( '\n' ) )[0]
return re.split( '.*=> (.*) .*', match )[1] return re.split( '.*=> (.*) .*', match )[1]

View file

@ -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
@ -469,9 +503,8 @@ void ToggleSurface(){
#endif #endif
if ( !g_surfwin ) { if ( !g_surfwin ) {
DoSurface(); DoSurface();
} } else {
else{ CancelDlg();
on_cancel_button_clicked( NULL, NULL );
} }
} }
@ -485,11 +518,9 @@ void SurfaceDlgFitAll(){
// SurfaceDialog class // SurfaceDialog class
void ShowDlg() { void ShowDlg() {
if ( !SurfaceInspector ) { if ( !SurfaceInspector ) {
create_SurfaceInspector(); create_SurfaceInspector();
} } else {
else{
gtk_widget_show( SurfaceInspector ); gtk_widget_show( SurfaceInspector );
} }
@ -503,6 +534,21 @@ void HideDlg(){
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
@ -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 );
} }
// Action Buttons
static void on_done_button_clicked( GtkButton *button, gpointer user_data ) { static void on_done_button_clicked( GtkButton *button, gpointer user_data ) {
if ( !texdef_face_list_empty() ) { DoDone();
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

@ -279,9 +279,7 @@ static gint OnDialogKey( GtkWidget* widget, GdkEventKey* event, gpointer data ){
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;

View file

@ -28,8 +28,7 @@
//#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];
@ -63,7 +62,7 @@ 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_