diff --git a/contrib/bkgrnd2d/dialog.cpp b/contrib/bkgrnd2d/dialog.cpp index c4661470..41e54c89 100644 --- a/contrib/bkgrnd2d/dialog.cpp +++ b/contrib/bkgrnd2d/dialog.cpp @@ -43,7 +43,7 @@ static GtkWidget *pDialogWnd; static GtkWidget *pNotebook; -static GtkTooltips *pTooltips; + class CBackgroundDialogPage { @@ -223,7 +223,7 @@ CBackgroundDialogPage::CBackgroundDialogPage( VIEWTYPE vt ){ g_signal_connect( G_OBJECT( w ), "clicked", G_CALLBACK( browse_callback ), ( gpointer ) this ); gtk_box_pack_start( GTK_BOX( hbox ),w, FALSE, FALSE, 5 ); - gtk_tooltips_set_tip( pTooltips, w, _( "Select a file" ), NULL ); + gtk_widget_set_tooltip_text( w, _( "Select a file" ) ); gtk_widget_show( w ); w = gtk_button_new_with_label( _( "Reload" ) ); @@ -231,7 +231,7 @@ CBackgroundDialogPage::CBackgroundDialogPage( VIEWTYPE vt ){ ( gpointer ) this ); // TODO disable until we have file // gtk_widget_set_sensitive(w,FALSE); - gtk_tooltips_set_tip( pTooltips, w, _( "Reload current file" ), NULL ); + gtk_widget_set_tooltip_text( w, _( "Reload current file" ) ); gtk_box_pack_start( GTK_BOX( hbox ),w, FALSE, FALSE, 5 ); gtk_widget_show( w ); @@ -256,7 +256,7 @@ CBackgroundDialogPage::CBackgroundDialogPage( VIEWTYPE vt ){ g_signal_connect( G_OBJECT( w ), "value-changed", G_CALLBACK( alpha_adjust_callback ), ( gpointer ) this ); gtk_box_pack_start( GTK_BOX( hbox ),w, TRUE, TRUE, 5 ); - gtk_tooltips_set_tip( pTooltips, w, _( "Set image transparancy" ), NULL ); + gtk_widget_set_tooltip_text( w, _( "Set image transparancy" ) ); gtk_widget_show( w ); gtk_widget_show( hbox ); @@ -274,7 +274,7 @@ CBackgroundDialogPage::CBackgroundDialogPage( VIEWTYPE vt ){ gtk_box_pack_start( GTK_BOX( hbox ),w, TRUE, FALSE, 5 ); g_signal_connect( G_OBJECT( w ), "clicked", G_CALLBACK( size_sel_callback ), ( gpointer ) this ); - gtk_tooltips_set_tip( pTooltips, w, _( "Set the size of the image to the bounding rectangle of all selected brushes and entities" ), NULL ); + gtk_widget_set_tooltip_text( w, _( "Set the size of the image to the bounding rectangle of all selected brushes and entities" ) ); gtk_widget_show( w ); if ( m_vt == XY ) { @@ -282,7 +282,7 @@ CBackgroundDialogPage::CBackgroundDialogPage( VIEWTYPE vt ){ gtk_box_pack_start( GTK_BOX( hbox ),w, TRUE, FALSE, 2 ); g_signal_connect( G_OBJECT( w ), "clicked", G_CALLBACK( size_mm_callback ), ( gpointer ) this ); - gtk_tooltips_set_tip( pTooltips, w, _( "Set the size of the image using the mapcoordsmins and mapcoordsmaxs keys of the worldspawn entity" ), NULL ); + gtk_widget_set_tooltip_text( w, _( "Set the size of the image using the mapcoordsmins and mapcoordsmaxs keys of the worldspawn entity" ) ); gtk_widget_show( w ); } @@ -317,13 +317,13 @@ static gint close_callback( GtkWidget *widget, gpointer data ){ void InitBackgroundDialog(){ CBackgroundDialogPage *pPage; + GtkWidget *content_area, *vbox; + GtkDialogFlags flags = GTK_DIALOG_DESTROY_WITH_PARENT; pDialogWnd = gtk_dialog_new_with_buttons( _( "Background Images" ), GTK_WINDOW( g_pMainWidget ), - (GtkDialogFlags)( GTK_DIALOG_DESTROY_WITH_PARENT ), + flags, // TODO dialog with no buttons - // GTK_STOCK_CLOSE, - // GTK_RESPONSE_CLOSE, NULL ); g_signal_connect( G_OBJECT( pDialogWnd ), "delete-event", G_CALLBACK( close_callback ), NULL ); @@ -331,7 +331,8 @@ void InitBackgroundDialog(){ G_CALLBACK( response_callback ), NULL ); // g_signal_connect( G_OBJECT (pDialogWnd), "expose-event", G_CALLBACK( ci_expose ), NULL ); - pTooltips = gtk_tooltips_new(); + + content_area = gtk_dialog_get_content_area( GTK_DIALOG( pDialogWnd ) ); pNotebook = gtk_notebook_new(); pPage = new CBackgroundDialogPage( XY ); @@ -341,11 +342,13 @@ void InitBackgroundDialog(){ pPage = new CBackgroundDialogPage( YZ ); pPage->Append( pNotebook ); - gtk_box_pack_start( GTK_BOX( GTK_DIALOG( pDialogWnd )->vbox ), pNotebook, TRUE, TRUE, 0 ); + vbox = gtk_hbox_new( TRUE, 5 ); + gtk_container_add( GTK_CONTAINER( content_area ), vbox ); + gtk_widget_show( vbox ); + + gtk_box_pack_start( GTK_BOX( vbox ), pNotebook, TRUE, TRUE, 0 ); gtk_widget_show( pNotebook ); - - gtk_widget_realize( pDialogWnd ); } void ShowBackgroundDialog(){ diff --git a/contrib/bkgrnd2d/plugin.cpp b/contrib/bkgrnd2d/plugin.cpp index 319c0ac4..85223734 100644 --- a/contrib/bkgrnd2d/plugin.cpp +++ b/contrib/bkgrnd2d/plugin.cpp @@ -67,7 +67,7 @@ _QEREntityTable g_EntityTable; _QERAppDataTable g_DataTable; // for the file load dialog -void *g_pMainWidget; +void *g_pMainWidget = NULL; // ============================================================================= // plugin implementation @@ -188,7 +188,7 @@ extern "C" const char* QERPlug_GetCommandList(){ extern "C" void QERPlug_Dispatch( const char *p, vec3_t vMin, vec3_t vMax, bool bSingleBrush ){ Sys_Printf( MSG_PREFIX "Command \"%s\"\n",p ); if ( !strcmp( p, CMD_ABOUT ) ) { - g_FuncTable.m_pfnMessageBox( NULL, PLUGIN_ABOUT, "About", MB_OK, NULL ); + g_FuncTable.m_pfnMessageBox( g_pMainWidget, PLUGIN_ABOUT, "About", MB_OK, NULL ); } else if ( !strcmp( p,CMD_CONFIG ) ) { ShowBackgroundDialog(); diff --git a/contrib/bobtoolz/bobToolz-GTK.cpp b/contrib/bobtoolz/bobToolz-GTK.cpp index 1cd11552..96975429 100644 --- a/contrib/bobtoolz/bobToolz-GTK.cpp +++ b/contrib/bobtoolz/bobToolz-GTK.cpp @@ -104,7 +104,7 @@ extern "C" void QERPlug_Dispatch( const char *p, vec3_t vMin, vec3_t vMax, bool DoVisAnalyse(); } else if ( !stricmp( p, "about..." ) ) { - DoMessageBox( PLUGIN_ABOUT, "About", IDOK ); + DoMessageBox( PLUGIN_ABOUT, "About", MB_OK ); } } diff --git a/contrib/bobtoolz/dialogs/dialogs-gtk.cpp b/contrib/bobtoolz/dialogs/dialogs-gtk.cpp index 423dca18..a274adf3 100644 --- a/contrib/bobtoolz/dialogs/dialogs-gtk.cpp +++ b/contrib/bobtoolz/dialogs/dialogs-gtk.cpp @@ -44,6 +44,8 @@ typedef struct { dlg_texReset_t dlgTexReset; +extern void *g_pRadiantWnd; + void Update_TextureReseter(); static void dialog_button_callback_texreset_update( GtkWidget *widget, gpointer data ){ @@ -203,22 +205,20 @@ bool ValidateTextInt( const char* pData, const char* error_title, int* value ){ */ int DoMessageBox( const char* lpText, const char* lpCaption, guint32 uType ){ - GtkWidget *window, *w, *vbox, *hbox; - int mode = ( uType & MB_TYPEMASK ), ret, loop = 1; + GtkWidget *dialog, *w, *vbox, *hbox, *content_area; + gint response_id; + int mode, ret; + GtkDialogFlags flags = GTK_DIALOG_DESTROY_WITH_PARENT; - window = gtk_window_new( GTK_WINDOW_TOPLEVEL ); - g_signal_connect( G_OBJECT( window ), "delete-event", - G_CALLBACK( dialog_delete_callback ), NULL ); - g_signal_connect( G_OBJECT( window ), "destroy", - G_CALLBACK( gtk_widget_destroy ), NULL ); - gtk_window_set_title( GTK_WINDOW( window ), lpCaption ); - gtk_container_set_border_width( GTK_CONTAINER( window ), 10 ); - g_object_set_data( G_OBJECT( window ), "loop", &loop ); - g_object_set_data( G_OBJECT( window ), "ret", &ret ); - gtk_widget_realize( window ); + dialog = gtk_dialog_new_with_buttons( lpCaption, NULL, flags, NULL ); + gtk_window_set_transient_for( GTK_WINDOW( dialog ), GTK_WINDOW( g_pRadiantWnd ) ); + gtk_window_set_position( GTK_WINDOW( dialog ), GTK_WIN_POS_CENTER_ON_PARENT ); + gtk_container_set_border_width( GTK_CONTAINER( dialog ), 10 ); + + content_area = gtk_dialog_get_content_area( GTK_DIALOG( dialog ) ); vbox = gtk_vbox_new( FALSE, 10 ); - gtk_container_add( GTK_CONTAINER( window ), vbox ); + gtk_container_add( GTK_CONTAINER( content_area ), vbox ); gtk_widget_show( vbox ); w = gtk_label_new( lpText ); @@ -234,81 +234,49 @@ int DoMessageBox( const char* lpText, const char* lpCaption, guint32 uType ){ gtk_box_pack_start( GTK_BOX( vbox ), hbox, FALSE, FALSE, 2 ); gtk_widget_show( hbox ); + mode = ( uType & MB_TYPEMASK ); if ( mode == MB_OK ) { - w = gtk_button_new_with_label( _( "Ok" ) ); - gtk_box_pack_start( GTK_BOX( hbox ), w, TRUE, TRUE, 0 ); - g_signal_connect( G_OBJECT( w ), "clicked", - G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( IDOK ) ); - gtk_widget_set_can_default( w, TRUE ); - gtk_widget_grab_default( w ); - gtk_widget_show( w ); + w = gtk_dialog_add_button( GTK_DIALOG( dialog ), _( "OK" ), GTK_RESPONSE_OK ); ret = IDOK; } else if ( mode == MB_OKCANCEL ) { - w = gtk_button_new_with_label( _( "Ok" ) ); - gtk_box_pack_start( GTK_BOX( hbox ), w, TRUE, TRUE, 0 ); - g_signal_connect( G_OBJECT( w ), "clicked", - G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( IDOK ) ); - gtk_widget_set_can_default( w, TRUE ); - gtk_widget_grab_default( w ); - gtk_widget_show( w ); - - w = gtk_button_new_with_label( _( "Cancel" ) ); - gtk_box_pack_start( GTK_BOX( hbox ), w, TRUE, TRUE, 0 ); - g_signal_connect( G_OBJECT( w ), "clicked", - G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( IDCANCEL ) ); - gtk_widget_show( w ); + w = gtk_dialog_add_button( GTK_DIALOG( dialog ), _( "OK" ), GTK_RESPONSE_OK ); + w = gtk_dialog_add_button( GTK_DIALOG( dialog ), _( "Cancel" ), GTK_RESPONSE_CANCEL ); ret = IDCANCEL; } else if ( mode == MB_YESNOCANCEL ) { - w = gtk_button_new_with_label( _( "Yes" ) ); - gtk_box_pack_start( GTK_BOX( hbox ), w, TRUE, TRUE, 0 ); - g_signal_connect( G_OBJECT( w ), "clicked", - G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( IDYES ) ); - gtk_widget_set_can_default( w, TRUE ); - gtk_widget_grab_default( w ); - gtk_widget_show( w ); - - w = gtk_button_new_with_label( _( "No" ) ); - gtk_box_pack_start( GTK_BOX( hbox ), w, TRUE, TRUE, 0 ); - g_signal_connect( G_OBJECT( w ), "clicked", - G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( IDNO ) ); - gtk_widget_show( w ); - - w = gtk_button_new_with_label( _( "Cancel" ) ); - gtk_box_pack_start( GTK_BOX( hbox ), w, TRUE, TRUE, 0 ); - g_signal_connect( G_OBJECT( w ), "clicked", - G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( IDCANCEL ) ); - gtk_widget_show( w ); + w = gtk_dialog_add_button( GTK_DIALOG( dialog ), _( "Yes" ), GTK_RESPONSE_YES ); + w = gtk_dialog_add_button( GTK_DIALOG( dialog ), _( "No" ), GTK_RESPONSE_NO ); + w = gtk_dialog_add_button( GTK_DIALOG( dialog ), _( "Cancel" ), GTK_RESPONSE_CANCEL ); ret = IDCANCEL; } else /* if (mode == MB_YESNO) */ { - w = gtk_button_new_with_label( _( "Yes" ) ); - gtk_box_pack_start( GTK_BOX( hbox ), w, TRUE, TRUE, 0 ); - g_signal_connect( G_OBJECT( w ), "clicked", - G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( IDYES ) ); - gtk_widget_set_can_default( w, TRUE ); - gtk_widget_grab_default( w ); - gtk_widget_show( w ); - - w = gtk_button_new_with_label( _( "No" ) ); - gtk_box_pack_start( GTK_BOX( hbox ), w, TRUE, TRUE, 0 ); - g_signal_connect( G_OBJECT( w ), "clicked", - G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( IDNO ) ); - gtk_widget_show( w ); + w = gtk_dialog_add_button( GTK_DIALOG( dialog ), _( "Yes" ), GTK_RESPONSE_YES ); + w = gtk_dialog_add_button( GTK_DIALOG( dialog ), _( "No" ), GTK_RESPONSE_NO ); ret = IDNO; } - gtk_window_set_position( GTK_WINDOW( window ),GTK_WIN_POS_CENTER ); - gtk_widget_show( window ); - gtk_grab_add( window ); - while ( loop ) - gtk_main_iteration(); + response_id = gtk_dialog_run( GTK_DIALOG( dialog ) ); - gtk_grab_remove( window ); - gtk_widget_destroy( window ); + switch( response_id ) + { + case GTK_RESPONSE_OK: + ret = IDOK; + break; + case GTK_RESPONSE_CANCEL: + ret = IDCANCEL; + break; + case GTK_RESPONSE_YES: + ret = IDYES; + break; + case GTK_RESPONSE_NO: + ret = IDNO; + break; + } + + gtk_widget_destroy( dialog ); return ret; } @@ -326,6 +294,8 @@ int DoIntersectBox( IntersectRS* rs ){ gtk_window_set_title( GTK_WINDOW( window ), _( "Intersect" ) ); gtk_container_set_border_width( GTK_CONTAINER( window ), 10 ); + gtk_window_set_transient_for( GTK_WINDOW( window ), GTK_WINDOW( g_pRadiantWnd ) ); + gtk_window_set_position( GTK_WINDOW( window ), GTK_WIN_POS_CENTER_ON_PARENT ); g_object_set_data( G_OBJECT( window ), "loop", &loop ); g_object_set_data( G_OBJECT( window ), "ret", &ret ); @@ -384,7 +354,6 @@ int DoIntersectBox( IntersectRS* rs ){ // ---- /vbox ---- - gtk_window_set_position( GTK_WINDOW( window ),GTK_WIN_POS_CENTER ); gtk_widget_show( window ); gtk_grab_add( window ); @@ -408,30 +377,28 @@ int DoIntersectBox( IntersectRS* rs ){ } int DoPolygonBox( PolygonRS* rs ){ - GtkWidget *window, *w, *vbox, *hbox, *vbox2, *hbox2; - + GtkWidget *dialog, *w, *vbox, *hbox, *vbox2, *hbox2; + GtkSizeGroup *label_group; GtkWidget *check1, *check2, *check3; GtkWidget *text1, *text2; + GtkWidget *sides_label, *width_label, *content_area; + gint response_id; + int ret; + GtkDialogFlags flags = GTK_DIALOG_DESTROY_WITH_PARENT; - int ret, loop = 1; + dialog = gtk_dialog_new_with_buttons( _( "Polygon Builder" ), NULL, flags, NULL ); + gtk_window_set_transient_for( GTK_WINDOW( dialog ), GTK_WINDOW( g_pRadiantWnd ) ); + gtk_window_set_position( GTK_WINDOW( dialog ), GTK_WIN_POS_CENTER_ON_PARENT ); + gtk_container_set_border_width( GTK_CONTAINER( dialog ), 5 ); - window = gtk_window_new( GTK_WINDOW_TOPLEVEL ); - - g_signal_connect( G_OBJECT( window ), "delete-event", G_CALLBACK( dialog_delete_callback ), NULL ); - g_signal_connect( G_OBJECT( window ), "destroy", G_CALLBACK( gtk_widget_destroy ), NULL ); - - gtk_window_set_title( GTK_WINDOW( window ), _( "Polygon Builder" ) ); - gtk_container_set_border_width( GTK_CONTAINER( window ), 10 ); - - g_object_set_data( G_OBJECT( window ), "loop", &loop ); - g_object_set_data( G_OBJECT( window ), "ret", &ret ); - - gtk_widget_realize( window ); + gtk_dialog_add_button( GTK_DIALOG( dialog ), _( "OK" ), GTK_RESPONSE_OK ); + gtk_dialog_add_button( GTK_DIALOG( dialog ), _( "Cancel" ), GTK_RESPONSE_CANCEL ); + content_area = gtk_dialog_get_content_area( GTK_DIALOG( dialog ) ); vbox = gtk_vbox_new( FALSE, 10 ); - gtk_container_add( GTK_CONTAINER( window ), vbox ); + gtk_container_add( GTK_CONTAINER( content_area ), vbox ); gtk_widget_show( vbox ); // ---- vbox ---- @@ -456,13 +423,14 @@ int DoPolygonBox( PolygonRS* rs ){ // ---- hbox2 ---- text1 = gtk_entry_new(); - g_object_set( text1, "xalign", 1.0, NULL ); + gtk_entry_set_alignment( GTK_ENTRY( text1 ), 1.0 ); //right gtk_entry_set_max_length( GTK_ENTRY( text1 ), 256 ); gtk_entry_set_text( GTK_ENTRY( text1 ), "3" ); gtk_box_pack_start( GTK_BOX( hbox2 ), text1, FALSE, FALSE, 2 ); gtk_widget_show( text1 ); - w = gtk_label_new( _( "Number Of Sides" ) ); + sides_label = w = gtk_label_new( _( "Number Of Sides" ) ); + g_object_set( w, "xalign", 0.0, NULL ); gtk_box_pack_start( GTK_BOX( hbox2 ), w, FALSE, FALSE, 2 ); gtk_label_set_justify( GTK_LABEL( w ), GTK_JUSTIFY_LEFT ); gtk_widget_show( w ); @@ -476,13 +444,14 @@ int DoPolygonBox( PolygonRS* rs ){ // ---- hbox2 ---- text2 = gtk_entry_new(); - g_object_set( text2, "xalign", 1.0, NULL ); + gtk_entry_set_alignment( GTK_ENTRY( text2 ), 1.0 ); //right gtk_entry_set_max_length( GTK_ENTRY( text2 ), 256 ); gtk_entry_set_text( GTK_ENTRY( text2 ), "8" ); gtk_box_pack_start( GTK_BOX( hbox2 ), text2, FALSE, FALSE, 2 ); gtk_widget_show( text2 ); - w = gtk_label_new( _( "Border Width" ) ); + width_label = w = gtk_label_new( _( "Border Width" ) ); + g_object_set( w, "xalign", 0.0, NULL ); gtk_box_pack_start( GTK_BOX( hbox2 ), w, FALSE, FALSE, 2 ); gtk_label_set_justify( GTK_LABEL( w ), GTK_JUSTIFY_LEFT ); gtk_widget_show( w ); @@ -491,6 +460,10 @@ int DoPolygonBox( PolygonRS* rs ){ // ---- /vbox2 ---- + label_group = gtk_size_group_new( GTK_SIZE_GROUP_HORIZONTAL ); + gtk_size_group_add_widget( label_group, sides_label ); + gtk_size_group_add_widget( label_group, width_label ); + g_object_unref( label_group ); vbox2 = gtk_vbox_new( FALSE, 10 ); @@ -517,44 +490,17 @@ int DoPolygonBox( PolygonRS* rs ){ // ---- /hbox ---- - hbox = gtk_hbox_new( FALSE, 10 ); - gtk_box_pack_start( GTK_BOX( vbox ), hbox, FALSE, FALSE, 2 ); - gtk_widget_show( hbox ); - - // ---- hbox ---- - - w = gtk_button_new_with_label( _( "Ok" ) ); - gtk_box_pack_start( GTK_BOX( hbox ), w, TRUE, TRUE, 0 ); - g_signal_connect( G_OBJECT( w ), "clicked", G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( IDOK ) ); - - gtk_widget_set_can_default( w, TRUE ); - gtk_widget_grab_default( w ); - gtk_widget_show( w ); - - w = gtk_button_new_with_label( _( "Cancel" ) ); - gtk_box_pack_start( GTK_BOX( hbox ), w, TRUE, TRUE, 0 ); - g_signal_connect( G_OBJECT( w ), "clicked", G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( IDCANCEL ) ); - gtk_widget_show( w ); - ret = IDCANCEL; - - // ---- /hbox ---- - // ---- /vbox ---- - gtk_window_set_position( GTK_WINDOW( window ),GTK_WIN_POS_CENTER ); - gtk_widget_show( window ); - gtk_grab_add( window ); bool dialogError = TRUE; while ( dialogError ) { - loop = 1; - while ( loop ) - gtk_main_iteration(); + response_id = gtk_dialog_run( GTK_DIALOG( dialog ) ); dialogError = FALSE; - if ( ret == IDOK ) { + if ( response_id == GTK_RESPONSE_OK ) { rs->bUseBorder = gtk_toggle_button_get_active( (GtkToggleButton*)check1 ) ? true : false; rs->bInverse = gtk_toggle_button_get_active( (GtkToggleButton*)check2 ) ? true : false; rs->bAlignTop = gtk_toggle_button_get_active( (GtkToggleButton*)check3 ) ? true : false; @@ -571,8 +517,13 @@ int DoPolygonBox( PolygonRS* rs ){ } } - gtk_grab_remove( window ); - gtk_widget_destroy( window ); + if( response_id == GTK_RESPONSE_OK ) { + ret = IDOK; + } else { + ret = IDCANCEL; + } + + gtk_widget_destroy( dialog ); return ret; } @@ -600,8 +551,9 @@ int DoBuildStairsBox( BuildStairsRS* rs ){ g_signal_connect( G_OBJECT( window ), "destroy", G_CALLBACK( gtk_widget_destroy ), NULL ); gtk_window_set_title( GTK_WINDOW( window ), _( "Stair Builder" ) ); - gtk_container_set_border_width( GTK_CONTAINER( window ), 10 ); + gtk_window_set_transient_for( GTK_WINDOW( window ), GTK_WINDOW( g_pRadiantWnd ) ); + gtk_window_set_position( GTK_WINDOW( window ), GTK_WIN_POS_CENTER_ON_PARENT ); g_object_set_data( G_OBJECT( window ), "loop", &loop ); g_object_set_data( G_OBJECT( window ), "ret", &ret ); @@ -784,7 +736,6 @@ int DoBuildStairsBox( BuildStairsRS* rs ){ ret = IDCANCEL; // +djbob: need our "little" modal loop mars :P - gtk_window_set_position( GTK_WINDOW( window ),GTK_WIN_POS_CENTER ); gtk_widget_show( window ); gtk_grab_add( window ); @@ -860,8 +811,9 @@ int DoDoorsBox( DoorRS* rs ){ g_signal_connect( G_OBJECT( window ), "destroy", G_CALLBACK( gtk_widget_destroy ), NULL ); gtk_window_set_title( GTK_WINDOW( window ), _( "Door Builder" ) ); - gtk_container_set_border_width( GTK_CONTAINER( window ), 10 ); + gtk_window_set_transient_for( GTK_WINDOW( window ), GTK_WINDOW( g_pRadiantWnd ) ); + gtk_window_set_position( GTK_WINDOW( window ), GTK_WIN_POS_CENTER_ON_PARENT ); g_object_set_data( G_OBJECT( window ), "loop", &loop ); g_object_set_data( G_OBJECT( window ), "ret", &ret ); @@ -1033,7 +985,6 @@ int DoDoorsBox( DoorRS* rs ){ // ----------------- // //+djbob - gtk_window_set_position( GTK_WINDOW( window ),GTK_WIN_POS_CENTER ); gtk_widget_show( window ); gtk_grab_add( window ); @@ -1077,6 +1028,8 @@ int DoPathPlotterBox( PathPlotterRS* rs ){ gtk_window_set_title( GTK_WINDOW( window ), _( "Texture Reset" ) ); gtk_container_set_border_width( GTK_CONTAINER( window ), 10 ); + gtk_window_set_transient_for( GTK_WINDOW( window ), GTK_WINDOW( g_pRadiantWnd ) ); + gtk_window_set_position( GTK_WINDOW( window ), GTK_WIN_POS_CENTER_ON_PARENT ); g_object_set_data( G_OBJECT( window ), "loop", &loop ); g_object_set_data( G_OBJECT( window ), "ret", &ret ); @@ -1202,7 +1155,6 @@ int DoPathPlotterBox( PathPlotterRS* rs ){ // ----------------- // - gtk_window_set_position( GTK_WINDOW( window ),GTK_WIN_POS_CENTER ); gtk_widget_show( window ); gtk_grab_add( window ); @@ -1250,6 +1202,8 @@ int DoCTFColourChangeBox(){ gtk_window_set_title( GTK_WINDOW( window ), _( "CTF Colour Changer" ) ); gtk_container_set_border_width( GTK_CONTAINER( window ), 10 ); + gtk_window_set_transient_for( GTK_WINDOW( window ), GTK_WINDOW( g_pRadiantWnd ) ); + gtk_window_set_position( GTK_WINDOW( window ), GTK_WIN_POS_CENTER_ON_PARENT ); g_object_set_data( G_OBJECT( window ), "loop", &loop ); g_object_set_data( G_OBJECT( window ), "ret", &ret ); @@ -1293,7 +1247,6 @@ int DoCTFColourChangeBox(){ // ---- /vbox ---- - gtk_window_set_position( GTK_WINDOW( window ),GTK_WIN_POS_CENTER ); gtk_widget_show( window ); gtk_grab_add( window ); @@ -1308,26 +1261,28 @@ int DoCTFColourChangeBox(){ int DoResetTextureBox( ResetTextureRS* rs ){ Str texSelected; + gint response_id; + GtkSizeGroup *label_group; + GtkWidget *dialog, *w, *vbox, *hbox, *frame, *table, *content_area; + GtkWidget *new_label, *old_label, *hscale_label, *vscale_label; + GtkWidget *hshift_label, *vshift_label, *rvalue_label; + int ret; + GtkDialogFlags flags = GTK_DIALOG_DESTROY_WITH_PARENT; - GtkWidget *window, *w, *vbox, *hbox, *frame, *table; + dialog = gtk_dialog_new_with_buttons( _( "Texture Reset" ), NULL, flags, NULL ); + gtk_window_set_transient_for( GTK_WINDOW( dialog ), GTK_WINDOW( g_pRadiantWnd ) ); + gtk_window_set_position( GTK_WINDOW( dialog ), GTK_WIN_POS_CENTER ); + gtk_container_set_border_width( GTK_CONTAINER( dialog ), 5 ); - int ret, loop = 1; + gtk_dialog_add_button( GTK_DIALOG( dialog ), _( "Use Selected Brushes" ), GTK_RESPONSE_OK ); + gtk_dialog_add_button( GTK_DIALOG( dialog ), _( "Use All Brushes" ), GTK_RESPONSE_YES ); + gtk_dialog_add_button( GTK_DIALOG( dialog ), _( "Cancel" ), GTK_RESPONSE_CANCEL ); - window = gtk_window_new( GTK_WINDOW_TOPLEVEL ); - g_signal_connect( G_OBJECT( window ), "delete-event", G_CALLBACK( dialog_delete_callback ), NULL ); - g_signal_connect( G_OBJECT( window ), "destroy", G_CALLBACK( gtk_widget_destroy ), NULL ); + content_area = gtk_dialog_get_content_area( GTK_DIALOG( dialog ) ); - gtk_window_set_title( GTK_WINDOW( window ), _( "Texture Reset" ) ); - gtk_container_set_border_width( GTK_CONTAINER( window ), 10 ); - - g_object_set_data( G_OBJECT( window ), "loop", &loop ); - g_object_set_data( G_OBJECT( window ), "ret", &ret ); - - gtk_widget_realize( window ); - - vbox = gtk_vbox_new( FALSE, 10 ); - gtk_container_add( GTK_CONTAINER( window ), vbox ); + vbox = gtk_vbox_new( TRUE, 5 ); + gtk_container_add( GTK_CONTAINER( content_area ), vbox ); gtk_widget_show( vbox ); // ---- vbox ---- @@ -1355,22 +1310,23 @@ int DoResetTextureBox( ResetTextureRS* rs ){ gtk_box_pack_start( GTK_BOX( vbox ), frame, FALSE, TRUE, 0 ); table = gtk_table_new( 2, 3, TRUE ); - gtk_widget_show( table ); + gtk_container_add( GTK_CONTAINER( frame ), table ); gtk_table_set_row_spacings( GTK_TABLE( table ), 5 ); gtk_table_set_col_spacings( GTK_TABLE( table ), 5 ); gtk_container_set_border_width( GTK_CONTAINER( table ), 5 ); + gtk_widget_show( table ); // ---- frame ---- dlgTexReset.cbTexChange = gtk_check_button_new_with_label( _( "Enabled" ) ); g_signal_connect( G_OBJECT( dlgTexReset.cbTexChange ), "toggled", G_CALLBACK( dialog_button_callback_texreset_update ), NULL ); - gtk_widget_show( dlgTexReset.cbTexChange ); gtk_table_attach( GTK_TABLE( table ), dlgTexReset.cbTexChange, 0, 1, 0, 1, (GtkAttachOptions) ( GTK_FILL ), (GtkAttachOptions) ( 0 ), 0, 0 ); + gtk_widget_show( dlgTexReset.cbTexChange ); - w = gtk_label_new( _( "Old Name: " ) ); + new_label = w = gtk_label_new( _( "Old Name: " ) ); gtk_table_attach( GTK_TABLE( table ), w, 1, 2, 0, 1, (GtkAttachOptions) ( GTK_FILL ), (GtkAttachOptions) ( 0 ), 0, 0 ); @@ -1384,7 +1340,7 @@ int DoResetTextureBox( ResetTextureRS* rs ){ (GtkAttachOptions) ( 0 ), 0, 0 ); gtk_widget_show( dlgTexReset.editTexOld ); - w = gtk_label_new( _( "New Name: " ) ); + old_label = w = gtk_label_new( _( "New Name: " ) ); gtk_table_attach( GTK_TABLE( table ), w, 1, 2, 1, 2, (GtkAttachOptions) ( GTK_FILL ), (GtkAttachOptions) ( 0 ), 0, 0 ); @@ -1401,26 +1357,27 @@ int DoResetTextureBox( ResetTextureRS* rs ){ // ---- /frame ---- frame = gtk_frame_new( _( "Reset Scales" ) ); - gtk_widget_show( frame ); gtk_box_pack_start( GTK_BOX( vbox ), frame, FALSE, TRUE, 0 ); + gtk_widget_show( frame ); table = gtk_table_new( 2, 3, TRUE ); - gtk_widget_show( table ); + gtk_container_add( GTK_CONTAINER( frame ), table ); gtk_table_set_row_spacings( GTK_TABLE( table ), 5 ); gtk_table_set_col_spacings( GTK_TABLE( table ), 5 ); gtk_container_set_border_width( GTK_CONTAINER( table ), 5 ); + gtk_widget_show( table ); // ---- frame ---- dlgTexReset.cbScaleHor = gtk_check_button_new_with_label( _( "Enabled" ) ); g_signal_connect( G_OBJECT( dlgTexReset.cbScaleHor ), "toggled", G_CALLBACK( dialog_button_callback_texreset_update ), NULL ); - gtk_widget_show( dlgTexReset.cbScaleHor ); gtk_table_attach( GTK_TABLE( table ), dlgTexReset.cbScaleHor, 0, 1, 0, 1, (GtkAttachOptions) ( GTK_FILL ), (GtkAttachOptions) ( 0 ), 0, 0 ); + gtk_widget_show( dlgTexReset.cbScaleHor ); - w = gtk_label_new( _( "New Horizontal Scale: " ) ); + hscale_label = w = gtk_label_new( _( "New Horizontal Scale: " ) ); gtk_table_attach( GTK_TABLE( table ), w, 1, 2, 0, 1, (GtkAttachOptions) ( GTK_FILL ), (GtkAttachOptions) ( 0 ), 0, 0 ); @@ -1437,12 +1394,12 @@ int DoResetTextureBox( ResetTextureRS* rs ){ dlgTexReset.cbScaleVert = gtk_check_button_new_with_label( _( "Enabled" ) ); g_signal_connect( G_OBJECT( dlgTexReset.cbScaleVert ), "toggled", G_CALLBACK( dialog_button_callback_texreset_update ), NULL ); - gtk_widget_show( dlgTexReset.cbScaleVert ); gtk_table_attach( GTK_TABLE( table ), dlgTexReset.cbScaleVert, 0, 1, 1, 2, (GtkAttachOptions) ( GTK_FILL ), (GtkAttachOptions) ( 0 ), 0, 0 ); + gtk_widget_show( dlgTexReset.cbScaleVert ); - w = gtk_label_new( _( "New Vertical Scale: " ) ); + vscale_label = w = gtk_label_new( _( "New Vertical Scale: " ) ); gtk_table_attach( GTK_TABLE( table ), w, 1, 2, 1, 2, (GtkAttachOptions) ( GTK_FILL ), (GtkAttachOptions) ( 0 ), 0, 0 ); @@ -1459,26 +1416,27 @@ int DoResetTextureBox( ResetTextureRS* rs ){ // ---- /frame ---- frame = gtk_frame_new( _( "Reset Shift" ) ); - gtk_widget_show( frame ); gtk_box_pack_start( GTK_BOX( vbox ), frame, FALSE, TRUE, 0 ); + gtk_widget_show( frame ); table = gtk_table_new( 2, 3, TRUE ); - gtk_widget_show( table ); + gtk_container_add( GTK_CONTAINER( frame ), table ); gtk_table_set_row_spacings( GTK_TABLE( table ), 5 ); gtk_table_set_col_spacings( GTK_TABLE( table ), 5 ); gtk_container_set_border_width( GTK_CONTAINER( table ), 5 ); + gtk_widget_show( table ); // ---- frame ---- dlgTexReset.cbShiftHor = gtk_check_button_new_with_label( _( "Enabled" ) ); g_signal_connect( G_OBJECT( dlgTexReset.cbShiftHor ), "toggled", G_CALLBACK( dialog_button_callback_texreset_update ), NULL ); - gtk_widget_show( dlgTexReset.cbShiftHor ); gtk_table_attach( GTK_TABLE( table ), dlgTexReset.cbShiftHor, 0, 1, 0, 1, (GtkAttachOptions) ( GTK_FILL ), (GtkAttachOptions) ( 0 ), 0, 0 ); + gtk_widget_show( dlgTexReset.cbShiftHor ); - w = gtk_label_new( _( "New Horizontal Shift: " ) ); + hshift_label = w = gtk_label_new( _( "New Horizontal Shift: " ) ); gtk_table_attach( GTK_TABLE( table ), w, 1, 2, 0, 1, (GtkAttachOptions) ( GTK_FILL ), (GtkAttachOptions) ( 0 ), 0, 0 ); @@ -1495,12 +1453,12 @@ int DoResetTextureBox( ResetTextureRS* rs ){ dlgTexReset.cbShiftVert = gtk_check_button_new_with_label( _( "Enabled" ) ); g_signal_connect( G_OBJECT( dlgTexReset.cbShiftVert ), "toggled", G_CALLBACK( dialog_button_callback_texreset_update ), NULL ); - gtk_widget_show( dlgTexReset.cbShiftVert ); gtk_table_attach( GTK_TABLE( table ), dlgTexReset.cbShiftVert, 0, 1, 1, 2, (GtkAttachOptions) ( GTK_FILL ), (GtkAttachOptions) ( 0 ), 0, 0 ); + gtk_widget_show( dlgTexReset.cbShiftVert ); - w = gtk_label_new( _( "New Vertical Shift: " ) ); + vshift_label = w = gtk_label_new( _( "New Vertical Shift: " ) ); gtk_table_attach( GTK_TABLE( table ), w, 1, 2, 1, 2, (GtkAttachOptions) ( GTK_FILL ), (GtkAttachOptions) ( 0 ), 0, 0 ); @@ -1517,25 +1475,25 @@ int DoResetTextureBox( ResetTextureRS* rs ){ // ---- /frame ---- frame = gtk_frame_new( _( "Reset Rotation" ) ); - gtk_widget_show( frame ); gtk_box_pack_start( GTK_BOX( vbox ), frame, FALSE, TRUE, 0 ); + gtk_widget_show( frame ); table = gtk_table_new( 1, 3, TRUE ); - gtk_widget_show( table ); gtk_container_add( GTK_CONTAINER( frame ), table ); gtk_table_set_row_spacings( GTK_TABLE( table ), 5 ); gtk_table_set_col_spacings( GTK_TABLE( table ), 5 ); gtk_container_set_border_width( GTK_CONTAINER( table ), 5 ); + gtk_widget_show( table ); // ---- frame ---- dlgTexReset.cbRotation = gtk_check_button_new_with_label( _( "Enabled" ) ); - gtk_widget_show( dlgTexReset.cbRotation ); gtk_table_attach( GTK_TABLE( table ), dlgTexReset.cbRotation, 0, 1, 0, 1, (GtkAttachOptions) ( GTK_FILL ), (GtkAttachOptions) ( 0 ), 0, 0 ); + gtk_widget_show( dlgTexReset.cbRotation ); - w = gtk_label_new( _( "New Rotation Value: " ) ); + rvalue_label = w = gtk_label_new( _( "New Rotation Value: " ) ); gtk_table_attach( GTK_TABLE( table ), w, 1, 2, 0, 1, (GtkAttachOptions) ( GTK_FILL ), (GtkAttachOptions) ( 0 ), 0, 0 ); @@ -1551,51 +1509,40 @@ int DoResetTextureBox( ResetTextureRS* rs ){ // ---- /frame ---- - hbox = gtk_hbox_new( FALSE, 10 ); - gtk_box_pack_start( GTK_BOX( vbox ), hbox, FALSE, FALSE, 2 ); - gtk_widget_show( hbox ); - - // ---- hbox ---- - - w = gtk_button_new_with_label( _( "Use Selected Brushes" ) ); - gtk_box_pack_start( GTK_BOX( hbox ), w, TRUE, TRUE, 0 ); - g_signal_connect( G_OBJECT( w ), "clicked", G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( IDOK ) ); - - gtk_widget_set_can_default( w, TRUE ); - gtk_widget_grab_default( w ); - gtk_widget_show( w ); - - w = gtk_button_new_with_label( _( "Use All Brushes" ) ); - gtk_box_pack_start( GTK_BOX( hbox ), w, TRUE, TRUE, 0 ); - g_signal_connect( G_OBJECT( w ), "clicked", G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( IDYES ) ); - gtk_widget_show( w ); - - w = gtk_button_new_with_label( _( "Cancel" ) ); - gtk_box_pack_start( GTK_BOX( hbox ), w, TRUE, TRUE, 0 ); - g_signal_connect( G_OBJECT( w ), "clicked", G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( IDCANCEL ) ); - gtk_widget_show( w ); - ret = IDCANCEL; - - // ---- /hbox ---- - // ---- /vbox ---- - gtk_window_set_position( GTK_WINDOW( window ),GTK_WIN_POS_CENTER ); - gtk_widget_show( window ); - gtk_grab_add( window ); + label_group = gtk_size_group_new( GTK_SIZE_GROUP_HORIZONTAL ); + gtk_size_group_add_widget( label_group, new_label ); + gtk_size_group_add_widget( label_group, old_label ); + gtk_size_group_add_widget( label_group, hscale_label ); + gtk_size_group_add_widget( label_group, vscale_label ); + gtk_size_group_add_widget( label_group, hshift_label ); + gtk_size_group_add_widget( label_group, vshift_label ); + gtk_size_group_add_widget( label_group, rvalue_label ); + g_object_unref( label_group ); + + //by default text is centered in labels, + //setting text in labels left align because the label size is managed by the gtksizegroup + g_object_set( new_label, "xalign", 0.0, NULL ); + g_object_set( old_label, "xalign", 0.0, NULL ); + g_object_set( hscale_label, "xalign", 0.0, NULL ); + g_object_set( vscale_label, "xalign", 0.0, NULL ); + g_object_set( hshift_label, "xalign", 0.0, NULL ); + g_object_set( vshift_label, "xalign", 0.0, NULL ); + g_object_set( rvalue_label, "xalign", 0.0, NULL ); + Update_TextureReseter(); + ret = IDCANCEL; bool dialogError = TRUE; while ( dialogError ) { - loop = 1; - while ( loop ) - gtk_main_iteration(); + response_id = gtk_dialog_run( GTK_DIALOG( dialog ) ); dialogError = FALSE; - if ( ret != IDCANCEL ) { + if ( response_id != GTK_RESPONSE_CANCEL ) { rs->bResetRotation = gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( dlgTexReset.cbRotation ) ); if ( rs->bResetRotation ) { if ( !ValidateTextInt( gtk_entry_get_text( GTK_ENTRY( dlgTexReset.editRotation ) ), _( "Rotation" ), &rs->rotation ) ) { @@ -1639,8 +1586,19 @@ int DoResetTextureBox( ResetTextureRS* rs ){ } } - gtk_grab_remove( window ); - gtk_widget_destroy( window ); + switch( response_id ) { + case GTK_RESPONSE_OK: + ret = IDOK; + break; + case GTK_RESPONSE_CANCEL: + ret = IDCANCEL; + break; + case GTK_RESPONSE_YES: + ret = IDYES; + break; + } + + gtk_widget_destroy( dialog ); return ret; } @@ -1664,6 +1622,8 @@ int DoTrainThingBox( TrainThingRS* rs ){ gtk_window_set_title( GTK_WINDOW( window ), _( "Train Thing" ) ); gtk_container_set_border_width( GTK_CONTAINER( window ), 10 ); + gtk_window_set_transient_for( GTK_WINDOW( window ), GTK_WINDOW( g_pRadiantWnd ) ); + gtk_window_set_position( GTK_WINDOW( window ), GTK_WIN_POS_CENTER_ON_PARENT ); g_object_set_data( G_OBJECT( window ), "loop", &loop ); g_object_set_data( G_OBJECT( window ), "ret", &ret ); @@ -1683,8 +1643,8 @@ int DoTrainThingBox( TrainThingRS* rs ){ // ---- /hbox ---- frame = gtk_frame_new( _( "Radii" ) ); - gtk_widget_show( frame ); gtk_box_pack_start( GTK_BOX( vbox ), frame, FALSE, TRUE, 0 ); + gtk_widget_show( frame ); table = gtk_table_new( 2, 3, TRUE ); gtk_widget_show( table ); @@ -1732,11 +1692,11 @@ int DoTrainThingBox( TrainThingRS* rs ){ gtk_box_pack_start( GTK_BOX( vbox ), frame, FALSE, TRUE, 0 ); table = gtk_table_new( 2, 3, TRUE ); - gtk_widget_show( table ); gtk_container_add( GTK_CONTAINER( frame ), table ); gtk_table_set_row_spacings( GTK_TABLE( table ), 5 ); gtk_table_set_col_spacings( GTK_TABLE( table ), 5 ); gtk_container_set_border_width( GTK_CONTAINER( table ), 5 ); + gtk_widget_show( table ); // ---- frame ---- @@ -1772,15 +1732,15 @@ int DoTrainThingBox( TrainThingRS* rs ){ frame = gtk_frame_new( _( "Height" ) ); - gtk_widget_show( frame ); gtk_box_pack_start( GTK_BOX( vbox ), frame, FALSE, TRUE, 0 ); + gtk_widget_show( frame ); table = gtk_table_new( 2, 3, TRUE ); - gtk_widget_show( table ); gtk_container_add( GTK_CONTAINER( frame ), table ); gtk_table_set_row_spacings( GTK_TABLE( table ), 5 ); gtk_table_set_col_spacings( GTK_TABLE( table ), 5 ); gtk_container_set_border_width( GTK_CONTAINER( table ), 5 ); + gtk_widget_show( table ); // ---- frame ---- @@ -1817,15 +1777,15 @@ int DoTrainThingBox( TrainThingRS* rs ){ frame = gtk_frame_new( _( "Points" ) ); - gtk_widget_show( frame ); gtk_box_pack_start( GTK_BOX( vbox ), frame, FALSE, TRUE, 0 ); + gtk_widget_show( frame ); table = gtk_table_new( 2, 3, TRUE ); - gtk_widget_show( table ); gtk_container_add( GTK_CONTAINER( frame ), table ); gtk_table_set_row_spacings( GTK_TABLE( table ), 5 ); gtk_table_set_col_spacings( GTK_TABLE( table ), 5 ); gtk_container_set_border_width( GTK_CONTAINER( table ), 5 ); + gtk_widget_show( table ); // ---- frame ---- @@ -1868,7 +1828,6 @@ int DoTrainThingBox( TrainThingRS* rs ){ - gtk_window_set_position( GTK_WINDOW( window ),GTK_WIN_POS_CENTER ); gtk_widget_show( window ); gtk_grab_add( window ); diff --git a/contrib/camera/dialogs.cpp b/contrib/camera/dialogs.cpp index 43f86b62..1c8e4d2d 100644 --- a/contrib/camera/dialogs.cpp +++ b/contrib/camera/dialogs.cpp @@ -64,27 +64,26 @@ static gint ci_editmode_add( GtkWidget *widget, gpointer data ){ }*/ static gint ci_new( GtkWidget *widget, gpointer data ){ - GtkWidget *window, *w, *vbox, *vbox2, *hbox, *frame; //, *name; - GtkWidget *fixed, *interpolated, *spline; - int ret, loop = 1; + GtkWidget *dialog, *w, *vbox, *vbox2, *hbox, *frame; //, *name; + GtkWidget *fixed, *interpolated, *spline, *content_area; GSList *targetTypeRadio = NULL; // char buf[128]; + gint response_id; + GtkDialogFlags flags = GTK_DIALOG_DESTROY_WITH_PARENT; // create the window - window = gtk_window_new( GTK_WINDOW_TOPLEVEL ); - gtk_window_set_title( GTK_WINDOW( window ), _( "New Camera" ) ); - g_signal_connect( G_OBJECT( window ), "delete-event", G_CALLBACK( dialog_delete_callback ), NULL ); - g_signal_connect( G_OBJECT( window ), "destroy", G_CALLBACK( gtk_widget_destroy ), NULL ); - gtk_window_set_transient_for( GTK_WINDOW( window ), GTK_WINDOW( g_pCameraInspectorWnd ) ); + dialog = gtk_dialog_new_with_buttons( _( "New Camera" ), NULL, flags, NULL ); + gtk_dialog_add_button( GTK_DIALOG( dialog ), _( "OK" ), GTK_RESPONSE_OK ); + gtk_dialog_add_button( GTK_DIALOG( dialog ), _( "Cancel" ), GTK_RESPONSE_CANCEL ); - g_object_set_data( G_OBJECT( window ), "loop", &loop ); - g_object_set_data( G_OBJECT( window ), "ret", &ret ); + gtk_window_set_transient_for( GTK_WINDOW( dialog ), GTK_WINDOW( g_pCameraInspectorWnd ) ); + gtk_window_set_position( GTK_WINDOW( dialog ), GTK_WIN_POS_CENTER_ON_PARENT ); - gtk_widget_realize( window ); + content_area = gtk_dialog_get_content_area( GTK_DIALOG( dialog ) ); // fill the window vbox = gtk_vbox_new( FALSE, 5 ); - gtk_container_add( GTK_CONTAINER( window ), vbox ); + gtk_container_add( GTK_CONTAINER( content_area ), vbox ); gtk_widget_show( vbox ); // -------------------------- // @@ -127,53 +126,22 @@ static gint ci_new( GtkWidget *widget, gpointer data ){ // -------------------------- // - hbox = gtk_hbox_new( FALSE, 5 ); - gtk_box_pack_start( GTK_BOX( vbox ), hbox, FALSE, FALSE, 0 ); - gtk_widget_show( hbox ); + response_id = gtk_dialog_run( GTK_DIALOG( dialog ) ); - w = gtk_button_new_with_label( _( "Ok" ) ); - gtk_box_pack_start( GTK_BOX( hbox ), w, TRUE, TRUE, 0 ); - g_signal_connect( G_OBJECT( w ), "clicked", G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( IDOK ) ); - gtk_widget_show( w ); + if ( response_id == GTK_RESPONSE_OK ) { - gtk_widget_set_can_default( w, TRUE ); - gtk_widget_grab_default( w ); - - w = gtk_button_new_with_label( _( "Cancel" ) ); - gtk_box_pack_start( GTK_BOX( hbox ), w, TRUE, TRUE, 0 ); - g_signal_connect( G_OBJECT( w ), "clicked", G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( IDCANCEL ) ); - gtk_widget_show( w ); - ret = IDCANCEL; - - // -------------------------- // - - gtk_window_set_position( GTK_WINDOW( window ),GTK_WIN_POS_CENTER ); - gtk_widget_show( window ); - gtk_grab_add( window ); - - bool dialogError = TRUE; - while ( dialogError ) { - loop = 1; - while ( loop ) - gtk_main_iteration(); - - dialogError = FALSE; - - if ( ret == IDOK ) { - if ( gtk_toggle_button_get_active( (GtkToggleButton*)fixed ) ) { - DoNewFixedCamera(); - } - else if ( gtk_toggle_button_get_active( (GtkToggleButton*)interpolated ) ) { - DoNewInterpolatedCamera(); - } - else if ( gtk_toggle_button_get_active( (GtkToggleButton*)spline ) ) { - DoNewSplineCamera(); - } + if ( gtk_toggle_button_get_active( (GtkToggleButton*)fixed ) ) { + DoNewFixedCamera(); + } + else if ( gtk_toggle_button_get_active( (GtkToggleButton*)interpolated ) ) { + DoNewInterpolatedCamera(); + } + else if ( gtk_toggle_button_get_active( (GtkToggleButton*)spline ) ) { + DoNewSplineCamera(); } } - gtk_grab_remove( window ); - gtk_widget_destroy( window ); + gtk_widget_destroy( dialog ); return TRUE; } @@ -245,11 +213,11 @@ static gint ci_preview( GtkWidget *widget, gpointer data ){ return TRUE; } -static gint ci_expose( GtkWidget *widget, gpointer data ){ +static void ci_show( GtkWidget *widget, gpointer data ){ // start edit mode DoStartEdit( GetCurrentCam() ); - return FALSE; + return; } static gint ci_close( GtkWidget *widget, gpointer data ){ @@ -355,28 +323,25 @@ static void RefreshEventList( void ){ } static gint ci_rename( GtkWidget *widget, gpointer data ){ - GtkWidget *window, *w, *vbox, *hbox, *name; - int ret, loop = 1; + GtkWidget *dialog, *w, *vbox, *hbox, *name, *content_area; + gint response_id; + GtkDialogFlags flags = GTK_DIALOG_DESTROY_WITH_PARENT; if ( !GetCurrentCam() ) { return TRUE; } - // create the window - window = gtk_window_new( GTK_WINDOW_TOPLEVEL ); - gtk_window_set_title( GTK_WINDOW( window ), _( "Rename Path" ) ); - g_signal_connect( G_OBJECT( window ), "delete-event", G_CALLBACK( dialog_delete_callback ), NULL ); - g_signal_connect( G_OBJECT( window ), "destroy", G_CALLBACK( gtk_widget_destroy ), NULL ); - gtk_window_set_transient_for( GTK_WINDOW( window ), GTK_WINDOW( g_pCameraInspectorWnd ) ); + dialog = gtk_dialog_new_with_buttons( _( "Rename Path" ), NULL, flags, NULL ); + gtk_window_set_transient_for( GTK_WINDOW( dialog ), GTK_WINDOW( g_pCameraInspectorWnd ) ); + gtk_window_set_position( GTK_WINDOW( dialog ), GTK_WIN_POS_CENTER_ON_PARENT ); - g_object_set_data( G_OBJECT( window ), "loop", &loop ); - g_object_set_data( G_OBJECT( window ), "ret", &ret ); + gtk_dialog_add_button( GTK_DIALOG( dialog ), _( "OK" ), GTK_RESPONSE_OK ); + gtk_dialog_add_button( GTK_DIALOG( dialog ), _( "Cancel" ), GTK_RESPONSE_CANCEL ); - gtk_widget_realize( window ); + content_area = gtk_dialog_get_content_area( GTK_DIALOG( dialog ) ); - // fill the window vbox = gtk_vbox_new( FALSE, 5 ); - gtk_container_add( GTK_CONTAINER( window ), vbox ); + gtk_container_add( GTK_CONTAINER( content_area ), vbox ); gtk_widget_show( vbox ); // -------------------------- // @@ -408,39 +373,15 @@ static gint ci_rename( GtkWidget *widget, gpointer data ){ // -------------------------- // - hbox = gtk_hbox_new( FALSE, 5 ); - gtk_box_pack_start( GTK_BOX( vbox ), hbox, FALSE, FALSE, 0 ); - gtk_widget_show( hbox ); - - w = gtk_button_new_with_label( _( "Ok" ) ); - gtk_box_pack_start( GTK_BOX( hbox ), w, TRUE, TRUE, 0 ); - g_signal_connect( G_OBJECT( w ), "clicked", G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( IDOK ) ); - gtk_widget_show( w ); - - gtk_widget_set_can_default( w, TRUE ); - gtk_widget_grab_default( w ); - - w = gtk_button_new_with_label( _( "Cancel" ) ); - gtk_box_pack_start( GTK_BOX( hbox ), w, TRUE, TRUE, 0 ); - g_signal_connect( G_OBJECT( w ), "clicked", G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( IDCANCEL ) ); - gtk_widget_show( w ); - ret = IDCANCEL; - - // -------------------------- // - - gtk_window_set_position( GTK_WINDOW( window ),GTK_WIN_POS_CENTER ); - gtk_widget_show( window ); - gtk_grab_add( window ); - bool dialogError = TRUE; - while ( dialogError ) { - loop = 1; - while ( loop ) - gtk_main_iteration(); + while ( dialogError ) + { + response_id = gtk_dialog_run( GTK_DIALOG( dialog ) ); dialogError = FALSE; - if ( ret == IDOK ) { + if( response_id == GTK_RESPONSE_OK ) { + const char *str = gtk_entry_get_text( GTK_ENTRY( name ) ); if ( str && str[0] ) { @@ -463,38 +404,35 @@ static gint ci_rename( GtkWidget *widget, gpointer data ){ } } - gtk_grab_remove( window ); - gtk_widget_destroy( window ); + gtk_widget_destroy( dialog ); return TRUE; } static gint ci_add_target( GtkWidget *widget, gpointer data ){ - GtkWidget *window, *w, *vbox, *vbox2, *hbox, *frame, *name; - GtkWidget *fixed, *interpolated, *spline; - int ret, loop = 1; + GtkWidget *dialog, *w, *vbox, *vbox2, *hbox, *frame, *name; + GtkWidget *fixed, *interpolated, *spline, *content_area; GSList *targetTypeRadio = NULL; char buf[128]; + gint response_id; + GtkDialogFlags flags = GTK_DIALOG_DESTROY_WITH_PARENT; if ( !GetCurrentCam() ) { return TRUE; } - // create the window - window = gtk_window_new( GTK_WINDOW_TOPLEVEL ); - gtk_window_set_title( GTK_WINDOW( window ), _( "Add Target" ) ); - g_signal_connect( G_OBJECT( window ), "delete-event", G_CALLBACK( dialog_delete_callback ), NULL ); - g_signal_connect( G_OBJECT( window ), "destroy", G_CALLBACK( gtk_widget_destroy ), NULL ); - gtk_window_set_transient_for( GTK_WINDOW( window ), GTK_WINDOW( g_pCameraInspectorWnd ) ); + dialog = gtk_dialog_new_with_buttons( _( "Add Target" ), NULL, flags, NULL ); + gtk_window_set_transient_for( GTK_WINDOW( dialog ), GTK_WINDOW( g_pCameraInspectorWnd ) ); + gtk_window_set_position( GTK_WINDOW( dialog ),GTK_WIN_POS_CENTER ); - g_object_set_data( G_OBJECT( window ), "loop", &loop ); - g_object_set_data( G_OBJECT( window ), "ret", &ret ); + gtk_dialog_add_button( GTK_DIALOG( dialog ), _( "OK" ), GTK_RESPONSE_OK ); + gtk_dialog_add_button( GTK_DIALOG( dialog ), _( "Cancel" ), GTK_RESPONSE_CANCEL ); - gtk_widget_realize( window ); - // fill the window + content_area = gtk_dialog_get_content_area( GTK_DIALOG( dialog ) ); + vbox = gtk_vbox_new( FALSE, 5 ); - gtk_container_add( GTK_CONTAINER( window ), vbox ); + gtk_container_add( GTK_CONTAINER( content_area ), vbox ); gtk_widget_show( vbox ); // -------------------------- // @@ -554,39 +492,16 @@ static gint ci_add_target( GtkWidget *widget, gpointer data ){ // -------------------------- // - hbox = gtk_hbox_new( FALSE, 5 ); - gtk_box_pack_start( GTK_BOX( vbox ), hbox, FALSE, FALSE, 0 ); - gtk_widget_show( hbox ); - - w = gtk_button_new_with_label( _( "Ok" ) ); - gtk_box_pack_start( GTK_BOX( hbox ), w, TRUE, TRUE, 0 ); - g_signal_connect( G_OBJECT( w ), "clicked", G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( IDOK ) ); - gtk_widget_show( w ); - - gtk_widget_set_can_default( w, TRUE ); - gtk_widget_grab_default( w ); - - w = gtk_button_new_with_label( _( "Cancel" ) ); - gtk_box_pack_start( GTK_BOX( hbox ), w, TRUE, TRUE, 0 ); - g_signal_connect( G_OBJECT( w ), "clicked", G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( IDCANCEL ) ); - gtk_widget_show( w ); - ret = IDCANCEL; - - // -------------------------- // - - gtk_window_set_position( GTK_WINDOW( window ),GTK_WIN_POS_CENTER ); - gtk_widget_show( window ); - gtk_grab_add( window ); bool dialogError = TRUE; - while ( dialogError ) { - loop = 1; - while ( loop ) - gtk_main_iteration(); + while ( dialogError ) + { + response_id = gtk_dialog_run( GTK_DIALOG( dialog ) ); dialogError = FALSE; - if ( ret == IDOK ) { + if( response_id == GTK_RESPONSE_OK ) { + const char *str = gtk_entry_get_text( GTK_ENTRY( name ) ); if ( str && str[0] ) { @@ -628,8 +543,7 @@ static gint ci_add_target( GtkWidget *widget, gpointer data ){ } } - gtk_grab_remove( window ); - gtk_widget_destroy( window ); + gtk_widget_destroy( dialog ); return TRUE; } @@ -817,31 +731,30 @@ const char *camEventStr[] = { }; static gint ci_add( GtkWidget *widget, gpointer data ){ - GtkWidget *window, *w, *vbox, *vbox2, *hbox, *frame, *parameters; - GtkWidget *eventWidget[EVENT_COUNT]; - int i, ret, loop = 1; + GtkWidget *dialog, *w, *vbox, *vbox2, *hbox, *frame, *parameters; + GtkWidget *eventWidget[EVENT_COUNT], *content_area; + int i; GSList *eventTypeRadio = NULL; // char buf[128]; + gint response_id; + GtkDialogFlags flags = GTK_DIALOG_DESTROY_WITH_PARENT; if ( !GetCurrentCam() ) { return TRUE; } - // create the window - window = gtk_window_new( GTK_WINDOW_TOPLEVEL ); - gtk_window_set_title( GTK_WINDOW( window ), _( "Add Event" ) ); - g_signal_connect( G_OBJECT( window ), "delete-event", G_CALLBACK( dialog_delete_callback ), NULL ); - g_signal_connect( G_OBJECT( window ), "destroy", G_CALLBACK( gtk_widget_destroy ), NULL ); - gtk_window_set_transient_for( GTK_WINDOW( window ), GTK_WINDOW( g_pCameraInspectorWnd ) ); + dialog = gtk_dialog_new_with_buttons( _( "Add Event" ), NULL, flags, NULL ); + gtk_window_set_transient_for( GTK_WINDOW( dialog ), GTK_WINDOW( g_pCameraInspectorWnd ) ); + gtk_window_set_position( GTK_WINDOW( dialog ), GTK_WIN_POS_CENTER_ON_PARENT ); - g_object_set_data( G_OBJECT( window ), "loop", &loop ); - g_object_set_data( G_OBJECT( window ), "ret", &ret ); + gtk_dialog_add_button( GTK_DIALOG( dialog ), _( "OK" ), GTK_RESPONSE_OK ); + gtk_dialog_add_button( GTK_DIALOG( dialog ), _( "Cancel" ), GTK_RESPONSE_CANCEL ); - gtk_widget_realize( window ); + content_area = gtk_dialog_get_content_area( GTK_DIALOG( dialog ) ); // fill the window vbox = gtk_vbox_new( FALSE, 5 ); - gtk_container_add( GTK_CONTAINER( window ), vbox ); + gtk_container_add( GTK_CONTAINER( content_area ), vbox ); gtk_widget_show( vbox ); // -------------------------- // @@ -893,39 +806,16 @@ static gint ci_add( GtkWidget *widget, gpointer data ){ // -------------------------- // - hbox = gtk_hbox_new( FALSE, 5 ); - gtk_box_pack_start( GTK_BOX( vbox ), hbox, FALSE, FALSE, 0 ); - gtk_widget_show( hbox ); - - w = gtk_button_new_with_label( _( "Ok" ) ); - gtk_box_pack_start( GTK_BOX( hbox ), w, TRUE, TRUE, 0 ); - g_signal_connect( G_OBJECT( w ), "clicked", G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( IDOK ) ); - gtk_widget_show( w ); - - gtk_widget_set_can_default( w, TRUE ); - gtk_widget_grab_default( w ); - - w = gtk_button_new_with_label( _( "Cancel" ) ); - gtk_box_pack_start( GTK_BOX( hbox ), w, TRUE, TRUE, 0 ); - g_signal_connect( G_OBJECT( w ), "clicked", G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( IDCANCEL ) ); - gtk_widget_show( w ); - ret = IDCANCEL; - - // -------------------------- // - - gtk_window_set_position( GTK_WINDOW( window ),GTK_WIN_POS_CENTER ); - gtk_widget_show( window ); - gtk_grab_add( window ); bool dialogError = TRUE; - while ( dialogError ) { - loop = 1; - while ( loop ) - gtk_main_iteration(); + while ( dialogError ) + { + response_id = gtk_dialog_run( GTK_DIALOG( dialog ) ); dialogError = FALSE; - if ( ret == IDOK ) { + if( response_id == GTK_RESPONSE_OK ) { + const char *str = gtk_entry_get_text( GTK_ENTRY( parameters ) ); if ( !camEventFlags[i][0] || ( str && str[0] ) ) { @@ -950,8 +840,7 @@ static gint ci_add( GtkWidget *widget, gpointer data ){ } } - gtk_grab_remove( window ); - gtk_widget_destroy( window ); + gtk_widget_destroy( dialog ); return TRUE; } @@ -991,39 +880,36 @@ static gint ci_timeline_changed( GtkAdjustment *adjustment ){ } GtkWidget *CreateCameraInspectorDialog( void ){ - GtkWidget *window, *w, *vbox, *hbox, *table, *frame; + GtkWidget *dialog, *w, *vbox, *hbox, *table, *frame; + GtkWidget *content_area; + GtkDialogFlags flags = GTK_DIALOG_DESTROY_WITH_PARENT; - // create the window - window = gtk_window_new( GTK_WINDOW_TOPLEVEL ); - gtk_window_set_title( GTK_WINDOW( window ), _( "Camera Inspector" ) ); - g_signal_connect( G_OBJECT( window ), "delete-event", G_CALLBACK( ci_close ), NULL ); - g_signal_connect( G_OBJECT( window ), "expose-event", G_CALLBACK( ci_expose ), NULL ); - // g_signal_connect( G_OBJECT (window), "destroy", G_CALLBACK( gtk_widget_destroy ), NULL ); - gtk_window_set_transient_for( GTK_WINDOW( window ), GTK_WINDOW( g_pRadiantWnd ) ); + dialog = gtk_dialog_new_with_buttons( _( "Camera Inspector" ), NULL, flags, NULL ); + w = gtk_dialog_add_button( GTK_DIALOG( dialog ), _( "OK" ), GTK_RESPONSE_OK ); + g_signal_connect( G_OBJECT( w ), "clicked", G_CALLBACK( ci_close ), NULL ); - // don't use show, as you don't want to have it displayed on startup ;-) - gtk_widget_realize( window ); + g_signal_connect( dialog, "delete_event", G_CALLBACK( ci_close ), NULL ); + g_signal_connect( dialog, "show", G_CALLBACK( ci_show ), NULL ); - // fill the window + gtk_window_set_transient_for( GTK_WINDOW( dialog ), GTK_WINDOW( g_pCameraInspectorWnd ) ); - // the table - // -------------------------- // + content_area = gtk_dialog_get_content_area( GTK_DIALOG( dialog ) ); table = gtk_table_new( 3, 2, FALSE ); - gtk_widget_show( table ); - gtk_container_add( GTK_CONTAINER( window ), table ); + gtk_container_add( GTK_CONTAINER( content_area ), table ); gtk_container_set_border_width( GTK_CONTAINER( table ), 5 ); gtk_table_set_row_spacings( GTK_TABLE( table ), 5 ); gtk_table_set_col_spacings( GTK_TABLE( table ), 5 ); + gtk_widget_show( table ); // the properties column // -------------------------- // vbox = gtk_vbox_new( FALSE, 5 ); - gtk_widget_show( vbox ); gtk_table_attach( GTK_TABLE( table ), vbox, 0, 1, 0, 1, (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), (GtkAttachOptions) ( GTK_FILL ), 0, 0 ); + gtk_widget_show( vbox ); // -------------------------- // @@ -1070,10 +956,10 @@ GtkWidget *CreateCameraInspectorDialog( void ){ // -------------------------- // frame = gtk_frame_new( _( "Path and Target editing" ) ); - gtk_widget_show( frame ); gtk_table_attach( GTK_TABLE( table ), frame, 0, 1, 1, 2, (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), (GtkAttachOptions) ( GTK_FILL ), 0, 0 ); + gtk_widget_show( frame ); vbox = gtk_vbox_new( FALSE, 5 ); gtk_container_add( GTK_CONTAINER( frame ), vbox ); @@ -1164,10 +1050,10 @@ GtkWidget *CreateCameraInspectorDialog( void ){ // -------------------------- // frame = gtk_frame_new( _( "Time" ) ); - gtk_widget_show( frame ); gtk_table_attach( GTK_TABLE( table ), frame, 0, 1, 2, 3, (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), (GtkAttachOptions) ( GTK_FILL ), 0, 0 ); + gtk_widget_show( frame ); vbox = gtk_vbox_new( FALSE, 5 ); gtk_container_add( GTK_CONTAINER( frame ), vbox ); @@ -1186,7 +1072,7 @@ GtkWidget *CreateCameraInspectorDialog( void ){ g_pSecondsEntry = gtk_entry_new(); gtk_box_pack_start( GTK_BOX( hbox ), g_pSecondsEntry, FALSE, FALSE, 0 ); - g_object_set( g_pSecondsEntry, "xalign", 1.0, NULL ); + gtk_entry_set_alignment( GTK_ENTRY( g_pSecondsEntry ), 1.0 ); //right gtk_widget_show( g_pSecondsEntry ); // -------------------------- // @@ -1253,7 +1139,6 @@ GtkWidget *CreateCameraInspectorDialog( void ){ gtk_widget_show( hbox ); w = gtk_scrolled_window_new( NULL, NULL ); - gtk_widget_set_usize( w, 0, 150 ); gtk_scrolled_window_set_policy( GTK_SCROLLED_WINDOW( w ), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC ); gtk_box_pack_start( GTK_BOX( hbox ), w, TRUE, TRUE, 0 ); gtk_widget_show( w ); @@ -1287,10 +1172,10 @@ GtkWidget *CreateCameraInspectorDialog( void ){ // -------------------------- // vbox = gtk_vbox_new( FALSE, 5 ); - gtk_widget_show( vbox ); gtk_table_attach( GTK_TABLE( table ), vbox, 1, 2, 0, 1, (GtkAttachOptions) ( GTK_FILL ), (GtkAttachOptions) ( GTK_FILL ), 0, 0 ); + gtk_widget_show( vbox ); w = gtk_button_new_with_label( _( "New..." ) ); gtk_box_pack_start( GTK_BOX( vbox ), w, FALSE, FALSE, 0 ); @@ -1305,10 +1190,10 @@ GtkWidget *CreateCameraInspectorDialog( void ){ // -------------------------- // vbox = gtk_vbox_new( FALSE, 5 ); - gtk_widget_show( vbox ); gtk_table_attach( GTK_TABLE( table ), vbox, 1, 2, 1, 2, (GtkAttachOptions) ( GTK_FILL ), (GtkAttachOptions) ( GTK_FILL ), 0, 0 ); + gtk_widget_show( vbox ); w = gtk_button_new_with_label( _( "Save..." ) ); gtk_box_pack_start( GTK_BOX( vbox ), w, FALSE, FALSE, 0 ); @@ -1336,24 +1221,5 @@ GtkWidget *CreateCameraInspectorDialog( void ){ // -------------------------- // - vbox = gtk_vbox_new( FALSE, 5 ); - gtk_widget_show( vbox ); - gtk_table_attach( GTK_TABLE( table ), vbox, 1, 2, 2, 3, - (GtkAttachOptions) ( GTK_FILL ), - (GtkAttachOptions) ( GTK_FILL ), 0, 0 ); - - hbox = gtk_hbox_new( FALSE, 5 ); - gtk_box_pack_start( GTK_BOX( vbox ), hbox, TRUE, TRUE, 0 ); - gtk_widget_show( hbox ); - - w = gtk_button_new_with_label( _( "Close" ) ); - gtk_box_pack_start( GTK_BOX( vbox ), w, FALSE, FALSE, 0 ); - g_signal_connect( G_OBJECT( w ), "clicked", G_CALLBACK( ci_close ), NULL ); - gtk_widget_set_can_default( w, TRUE ); - gtk_widget_grab_default( w ); - gtk_widget_show( w ); - - // -------------------------- // - - return window; + return dialog; } diff --git a/contrib/gtkgensurf/gendlgs.cpp b/contrib/gtkgensurf/gendlgs.cpp index fd2272a3..d5dc3003 100644 --- a/contrib/gtkgensurf/gendlgs.cpp +++ b/contrib/gtkgensurf/gendlgs.cpp @@ -42,7 +42,6 @@ static GtkWidget *plane_radios[6]; static guint current_tab; static int OldPreview; static int WasDetail; -static GtkTooltips *tooltips; static int FirstPassComplete = 0; void About( GtkWidget *parent ){ @@ -357,11 +356,11 @@ static void SetDlgValues( int tab ){ gpointer spin = g_object_get_data( G_OBJECT( g_pWnd ), "nh" ); GtkAdjustment *adj = gtk_spin_button_get_adjustment( GTK_SPIN_BUTTON( spin ) ); - adj->lower = 2; + gtk_adjustment_set_lower( adj, 2 ); gtk_adjustment_changed( adj ); spin = g_object_get_data( G_OBJECT( g_pWnd ), "nv" ); adj = gtk_spin_button_get_adjustment( GTK_SPIN_BUTTON( spin ) ); - adj->lower = 2; + gtk_adjustment_set_lower( adj, 2 ); gtk_adjustment_changed( adj ); } else @@ -370,11 +369,11 @@ static void SetDlgValues( int tab ){ gpointer spin = g_object_get_data( G_OBJECT( g_pWnd ), "nh" ); GtkAdjustment *adj = gtk_spin_button_get_adjustment( GTK_SPIN_BUTTON( spin ) ); - adj->lower = 1; + gtk_adjustment_set_lower( adj, 1 ); gtk_adjustment_changed( adj ); spin = g_object_get_data( G_OBJECT( g_pWnd ), "nv" ); adj = gtk_spin_button_get_adjustment( GTK_SPIN_BUTTON( spin ) ); - adj->lower = 1; + gtk_adjustment_set_lower( adj, 1 ); gtk_adjustment_changed( adj ); } @@ -728,14 +727,14 @@ static void main_go( GtkWidget *widget, gpointer data ){ if ( NH < 1 || NH > MAX_ROWS ) { sprintf( Text, _( "The number of divisions must be > 0 and no greater than %d." ), MAX_ROWS ); g_FuncTable.m_pfnMessageBox( g_pWnd, Text, _( "GenSurf" ), MB_ICONEXCLAMATION, NULL ); - gtk_notebook_set_page( GTK_NOTEBOOK( notebook ), EXTENTS_TAB ); + gtk_notebook_set_current_page( GTK_NOTEBOOK( notebook ), EXTENTS_TAB ); return; } if ( NV < 1 || NV > MAX_ROWS ) { sprintf( Text, _( "The number of divisions must be > 0 and no greater than %d." ), MAX_ROWS ); g_FuncTable.m_pfnMessageBox( g_pWnd, Text, _( "GenSurf" ), MB_ICONEXCLAMATION, NULL ); - gtk_notebook_set_page( GTK_NOTEBOOK( notebook ), EXTENTS_TAB ); + gtk_notebook_set_current_page( GTK_NOTEBOOK( notebook ), EXTENTS_TAB ); return; } @@ -743,7 +742,7 @@ static void main_go( GtkWidget *widget, gpointer data ){ g_FuncTable.m_pfnMessageBox( g_pWnd, _( "The \"lower-left\" values must be less than " "the corresponding \"upper-right\" values in " "the \"Extent\" box." ), _( "GenSurf" ), MB_OK | MB_ICONEXCLAMATION, NULL ); - gtk_notebook_set_page( GTK_NOTEBOOK( notebook ), EXTENTS_TAB ); + gtk_notebook_set_current_page( GTK_NOTEBOOK( notebook ), EXTENTS_TAB ); return; } @@ -751,13 +750,13 @@ static void main_go( GtkWidget *widget, gpointer data ){ g_FuncTable.m_pfnMessageBox( g_pWnd, _( "The \"lower-left\" values must be less than " "the corresponding \"upper-right\" values in " "the \"Extent\" box." ), _( "GenSurf" ), MB_OK | MB_ICONEXCLAMATION, NULL ); - gtk_notebook_set_page( GTK_NOTEBOOK( notebook ), EXTENTS_TAB ); + gtk_notebook_set_current_page( GTK_NOTEBOOK( notebook ), EXTENTS_TAB ); return; } if ( !strlen( Texture[Game][0] ) ) { g_FuncTable.m_pfnMessageBox( g_pWnd, _( "You must supply a texture name." ), _( "GenSurf" ), MB_ICONEXCLAMATION, NULL ); - gtk_notebook_set_page( GTK_NOTEBOOK( notebook ), EXTENTS_TAB ); + gtk_notebook_set_current_page( GTK_NOTEBOOK( notebook ), EXTENTS_TAB ); return; } @@ -806,7 +805,7 @@ static void general_wave( GtkToggleButton *widget, gpointer data ){ } static void general_random( GtkAdjustment *adj, gpointer data ){ - int nPos = (int)adj->value; + int nPos = (int)gtk_adjustment_get_value( adj ); if ( RandomSeed != nPos ) { RandomSeed = nPos; @@ -834,7 +833,7 @@ static void extents_use_patches( GtkToggleButton *check, gpointer data ){ } static void extents_nhnv_spin( GtkAdjustment *adj, int *data ){ - int nPos = (int)adj->value; + int nPos = (int)gtk_adjustment_get_value( adj ); if ( *data != nPos ) { if ( Game == QUAKE3 && UsePatches && ( nPos % 2 ) ) { @@ -854,7 +853,7 @@ static void extents_nhnv_spin( GtkAdjustment *adj, int *data ){ } static void extents_decimate( GtkAdjustment *adj, gpointer data ){ - int nPos = (int)adj->value; + int nPos = (int)gtk_adjustment_get_value( adj ); Decimate = nPos; UpdatePreview( true ); @@ -863,7 +862,7 @@ static void extents_decimate( GtkAdjustment *adj, gpointer data ){ // Hydra : snap to grid begin /*static void extents_snaptogrid (GtkAdjustment *adj, gpointer data) { - int nPos = (int)adj->value; + int nPos = (int)gtk_adjustment_get_value( adj ); SnapToGrid = nPos; UpdatePreview (true); @@ -871,7 +870,7 @@ static void extents_decimate( GtkAdjustment *adj, gpointer data ){ // ^Fishman - Modified version of Hydra's snap to grid code. static void extents_snaptogrid_spin( GtkAdjustment *adj, int *data ){ - int nPos = (int)adj->value; + int nPos = (int)gtk_adjustment_get_value( adj ); SnapToGrid = nPos; UpdatePreview( true ); } @@ -951,7 +950,7 @@ static gint fix_value_entryfocusout( GtkWidget* widget, GdkEventFocus *event, gp } static void fix_value_changed( GtkAdjustment *adj, gpointer data ){ - int k, i = (int)adj->value; + int k, i = (int)gtk_adjustment_get_value( adj ); if ( xyz[Vertex[0].i][Vertex[0].j].fixed_value != i ) { for ( k = 0; k < NumVerticesSelected; k++ ) @@ -1099,248 +1098,247 @@ static gint doublevariable_entryfocusout( GtkWidget* widget, GdkEventFocus* even // create tooltips void create_tooltips(){ - tooltips = gtk_tooltips_new(); // Main - gtk_tooltips_set_tip( GTK_TOOLTIPS( tooltips ), + gtk_widget_set_tooltip_text( GTK_WIDGET( g_object_get_data( G_OBJECT( g_pWnd ), "go" ) ), - _( "Accept all input and generate a surface in Q3Radiant" ), - "" ); - gtk_tooltips_set_tip( GTK_TOOLTIPS( tooltips ), + _( "Accept all input and generate a surface in Q3Radiant" ) + ); + gtk_widget_set_tooltip_text( GTK_WIDGET( g_object_get_data( G_OBJECT( g_pWnd ), "open" ) ), - _( "Open a previously saved GenSurf settings file." ), - "" ); - gtk_tooltips_set_tip( GTK_TOOLTIPS( tooltips ), + _( "Open a previously saved GenSurf settings file." ) + ); + gtk_widget_set_tooltip_text( GTK_WIDGET( g_object_get_data( G_OBJECT( g_pWnd ), "save" ) ), - _( "Save all settings to a file." ), - "" ); - gtk_tooltips_set_tip( GTK_TOOLTIPS( tooltips ), + _( "Save all settings to a file." ) + ); + gtk_widget_set_tooltip_text( GTK_WIDGET( g_object_get_data( G_OBJECT( g_pWnd ), "defaults" ) ), _( "Restore default values from DEFAULTS.SRF. If this file does not exist, GenSurf " "initializes all input parameters to reasonable values. You can create your own " "default surface by setting all parameters to your liking, then saving a settings " - "file as DEFAULTS.SRF with the Save As button." ), - "" ); + "file as DEFAULTS.SRF with the Save As button." ) + ); - gtk_tooltips_set_tip( GTK_TOOLTIPS( tooltips ), + gtk_widget_set_tooltip_text( GTK_WIDGET( g_object_get_data( G_OBJECT( g_pWnd ), "main_preview" ) ), - _( "View a wire-frame representation of the surface" ), - "" ); + _( "View a wire-frame representation of the surface" ) + ); - gtk_tooltips_set_tip( GTK_TOOLTIPS( tooltips ), + gtk_widget_set_tooltip_text( GTK_WIDGET( g_object_get_data( G_OBJECT( g_pWnd ), "main_antialiasing" ) ), - _( "The lines in the preview window are antialiased for better quality" ), - "" ); + _( "The lines in the preview window are antialiased for better quality" ) + ); // General tab - gtk_tooltips_set_tip( GTK_TOOLTIPS( tooltips ), + gtk_widget_set_tooltip_text( GTK_WIDGET( wave_radios[0] ), _( "Builds a surface with alternating hills and valleys. Uses the general form Z=cos(X) " - "x sin(Y)" ), - "" ); - gtk_tooltips_set_tip( GTK_TOOLTIPS( tooltips ), + "x sin(Y)" ) + ); + gtk_widget_set_tooltip_text( GTK_WIDGET( wave_radios[1] ), - _( "Builds a surface with ridges parallel to the vertical axis." ), - "" ); - gtk_tooltips_set_tip( GTK_TOOLTIPS( tooltips ), + _( "Builds a surface with ridges parallel to the vertical axis." ) + ); + gtk_widget_set_tooltip_text( GTK_WIDGET( wave_radios[2] ), - _( "Builds a surface with ridges parallel to the horizontal axis." ), - "" ); - gtk_tooltips_set_tip( GTK_TOOLTIPS( tooltips ), + _( "Builds a surface with ridges parallel to the horizontal axis." ) + ); + gtk_widget_set_tooltip_text( GTK_WIDGET( wave_radios[3] ), _( "Builds a map from a bitmap image representing a contour plot. Click the \"Bitmap\" " "tab to select the image. GenSurf only supports 256-color (8 bit) " "bitmaps. GenSurf will work with any 256-color bitmap, but gray scale bitmaps are a bit " - "more intuitive." ), - "" ); - gtk_tooltips_set_tip( GTK_TOOLTIPS( tooltips ), + "more intuitive." ) + ); + gtk_widget_set_tooltip_text( GTK_WIDGET( wave_radios[4] ), _( "Builds a random surface using the Plasma Cloud technique. Variance is controlled " "by the Roughness input. To build a surface with completely random values not " - "dependent on neighboring vertices, use one of the other waveforms with 0 amplitude." ), - "" ); - gtk_tooltips_set_tip( GTK_TOOLTIPS( tooltips ), + "dependent on neighboring vertices, use one of the other waveforms with 0 amplitude." ) + ); + gtk_widget_set_tooltip_text( GTK_WIDGET( g_object_get_data( G_OBJECT( g_pWnd ), "wavelength" ) ), _( "Enter the wavelength (distance between crests). NOTE: Wavelengths equal to the grid " "size or 2 times the grid size will result in 0 amplitudes. For best results, the " "wavelength value should be at least 4 times the grid size (extents divided by the " - "number of divisions" ), - "" ); - gtk_tooltips_set_tip( GTK_TOOLTIPS( tooltips ), + "number of divisions" ) + ); + gtk_widget_set_tooltip_text( GTK_WIDGET( g_object_get_data( G_OBJECT( g_pWnd ), "amplitude" ) ), - _( "Enter the height of hills/ridges." ), - "" ); - gtk_tooltips_set_tip( GTK_TOOLTIPS( tooltips ), + _( "Enter the height of hills/ridges." ) + ); + gtk_widget_set_tooltip_text( GTK_WIDGET( g_object_get_data( G_OBJECT( g_pWnd ), "roughness" ) ), _( "Enter the roughness value (noise) for the surface. For fractal surfaces, this value " - "is used as a variance in the fractal calculations." ), - "" ); - gtk_tooltips_set_tip( GTK_TOOLTIPS( tooltips ), + "is used as a variance in the fractal calculations." ) + ); + gtk_widget_set_tooltip_text( GTK_WIDGET( g_object_get_data( G_OBJECT( g_pWnd ), "random" ) ), - _( "Seed value for the pseudo-random number generator." ), - "" ); + _( "Seed value for the pseudo-random number generator." ) + ); // Extents tab - gtk_tooltips_set_tip( GTK_TOOLTIPS( tooltips ), + gtk_widget_set_tooltip_text( GTK_WIDGET( g_object_get_data( G_OBJECT( g_pWnd ), "hmin" ) ), _( "Minimum horizontal coordinate of the surface, i.e. X for a surface parallel to " "the XY or XZ planes, Y for a surface parallel to the YZ plane. For best results, " "the extents (maximum-minimum values) in a given direction should be evenly " - "divisible by the number of divisions in that direction." ), - "" ); - gtk_tooltips_set_tip( GTK_TOOLTIPS( tooltips ), + "divisible by the number of divisions in that direction." ) + ); + gtk_widget_set_tooltip_text( GTK_WIDGET( g_object_get_data( G_OBJECT( g_pWnd ), "hmax" ) ), _( "Maximum horizontal coordinate of the surface, i.e. X for a surface parallel to " "the XY or XZ planes, Y for a surface parallel to the YZ plane. For best results, " "the extents (maximum-minimum values) in a given direction should be evenly " - "divisible by the number of divisions in that direction." ), - "" ); - gtk_tooltips_set_tip( GTK_TOOLTIPS( tooltips ), + "divisible by the number of divisions in that direction." ) + ); + gtk_widget_set_tooltip_text( GTK_WIDGET( g_object_get_data( G_OBJECT( g_pWnd ), "vmin" ) ), _( "Minimum vertical coordinate of the surface, i.e. Y for a surface parallel to " "the XY plane, Z for a surface parallel to the XZ or YZ planes. For best results, " "the extents (maximum-minimum values) in a given direction should be evenly " - "divisible by the number of divisions in that direction." ), - "" ); - gtk_tooltips_set_tip( GTK_TOOLTIPS( tooltips ), + "divisible by the number of divisions in that direction." ) + ); + gtk_widget_set_tooltip_text( GTK_WIDGET( g_object_get_data( G_OBJECT( g_pWnd ), "vmax" ) ), _( "Maximum vertical coordinate of the surface, i.e. Y for a surface parallel to " "the XY plane, Z for a surface parallel to the XZ or YZ planes. For best results, " "the extents (maximum-minimum values) in a given direction should be evenly " - "divisible by the number of divisions in that direction." ), - "" ); - gtk_tooltips_set_tip( GTK_TOOLTIPS( tooltips ), + "divisible by the number of divisions in that direction." ) + ); + gtk_widget_set_tooltip_text( GTK_WIDGET( g_object_get_data( G_OBJECT( g_pWnd ), "nh" ) ), _( "Number of divisions in the horizontal direction. For best results, the extents " "in a given direction should be evenly divisible by the number of divisions in " - "that direction." ), - "" ); - gtk_tooltips_set_tip( GTK_TOOLTIPS( tooltips ), + "that direction." ) + ); + gtk_widget_set_tooltip_text( GTK_WIDGET( g_object_get_data( G_OBJECT( g_pWnd ), "nv" ) ), _( "Number of divisions in the vertical direction. For best results, the extents " "in a given direction should be evenly divisible by the number of divisions in " - "that direction." ), - "" ); - gtk_tooltips_set_tip( GTK_TOOLTIPS( tooltips ), + "that direction." ) + ); + gtk_widget_set_tooltip_text( GTK_WIDGET( g_object_get_data( G_OBJECT( g_pWnd ), "use_patches" ) ), _( "Produce one or more curved patches in the shape of your selected surface rather " "than producing solid brushes. Depending on the size of your surface (and the " "user's graphic detail settings, which you cannot control), curved surfaces will " "be represented in the game by a very large number of polygons. Read the warnings " - "concerning curved surfaces on the GenSurf web page before using this feature." ), - "" ); - gtk_tooltips_set_tip( GTK_TOOLTIPS( tooltips ), + "concerning curved surfaces on the GenSurf web page before using this feature." ) + ); + gtk_widget_set_tooltip_text( GTK_WIDGET( g_object_get_data( G_OBJECT( g_pWnd ), "decimate" ) ), _( "Use the slider to control the number of vertices discarded by GenSurf. For many " "surfaces, you can produce roughly the same shape surface with a high decimation " "value. This will generally result in a map with lower polygon counts (and better " "in-game performance). However, this feature should NOT be used for large terrain " - "surfaces in Q3" ), - "" ); - gtk_tooltips_set_tip( GTK_TOOLTIPS( tooltips ), + "surfaces in Q3" ) + ); + gtk_widget_set_tooltip_text( GTK_WIDGET( g_object_get_data( G_OBJECT( g_pWnd ), "z00" ) ), _( "Enter the height of the surface at the lower left corner. This value will likely " - "be modified unless \"Linear Borders\" is checked." ), - "" ); - gtk_tooltips_set_tip( GTK_TOOLTIPS( tooltips ), + "be modified unless \"Linear Borders\" is checked." ) + ); + gtk_widget_set_tooltip_text( GTK_WIDGET( g_object_get_data( G_OBJECT( g_pWnd ), "z01" ) ), _( "Enter the height of the surface at the upper left corner. This value will likely " - "be modified unless \"Linear Borders\" is checked." ), - "" ); - gtk_tooltips_set_tip( GTK_TOOLTIPS( tooltips ), + "be modified unless \"Linear Borders\" is checked." ) + ); + gtk_widget_set_tooltip_text( GTK_WIDGET( g_object_get_data( G_OBJECT( g_pWnd ), "z10" ) ), _( "Enter the height of the surface at the lower right corner. This value will likely " - "be modified unless \"Linear Borders\" is checked." ), - "" ); - gtk_tooltips_set_tip( GTK_TOOLTIPS( tooltips ), + "be modified unless \"Linear Borders\" is checked." ) + ); + gtk_widget_set_tooltip_text( GTK_WIDGET( g_object_get_data( G_OBJECT( g_pWnd ), "z11" ) ), _( "Enter the height of the surface at the upper right corner. This value will likely " - "be modified unless \"Linear Borders\" is checked." ), - "" ); - gtk_tooltips_set_tip( GTK_TOOLTIPS( tooltips ), + "be modified unless \"Linear Borders\" is checked." ) + ); + gtk_widget_set_tooltip_text( GTK_WIDGET( g_object_get_data( G_OBJECT( g_pWnd ), "linearborder" ) ), _( "Restrict the edges of the surface to a straight line. This will help match up " - "brush edges if you drop this surface into another map." ), - "" ); + "brush edges if you drop this surface into another map." ) + ); // Bitmap tab - gtk_tooltips_set_tip( GTK_TOOLTIPS( tooltips ), + gtk_widget_set_tooltip_text( GTK_WIDGET( g_object_get_data( G_OBJECT( g_pWnd ), "bmp_file" ) ), _( "Type the name of an 8-bit bitmap image file, or click Browse to select an image " - "from a list of those available on your system." ), - "" ); - gtk_tooltips_set_tip( GTK_TOOLTIPS( tooltips ), + "from a list of those available on your system." ) + ); + gtk_widget_set_tooltip_text( GTK_WIDGET( g_object_get_data( G_OBJECT( g_pWnd ), "bmp_file_browse" ) ), - _( "Select a bitmap image file from a list of those available on your system." ), - "" ); - gtk_tooltips_set_tip( GTK_TOOLTIPS( tooltips ), + _( "Select a bitmap image file from a list of those available on your system." ) + ); + gtk_widget_set_tooltip_text( GTK_WIDGET( g_object_get_data( G_OBJECT( g_pWnd ), "bmp_reload" ) ), - _( "Reload the selected bitmap file after making changes in an external image editor." ), - "" ); - gtk_tooltips_set_tip( GTK_TOOLTIPS( tooltips ), + _( "Reload the selected bitmap file after making changes in an external image editor." ) + ); + gtk_widget_set_tooltip_text( GTK_WIDGET( g_object_get_data( G_OBJECT( g_pWnd ), "bmp_black" ) ), _( "Enter the value corresponding to color index 0 in the bitmap file. For gray scale " - "images, color 0 is normally black." ), - "" ); - gtk_tooltips_set_tip( GTK_TOOLTIPS( tooltips ), + "images, color 0 is normally black." ) + ); + gtk_widget_set_tooltip_text( GTK_WIDGET( g_object_get_data( G_OBJECT( g_pWnd ), "bmp_white" ) ), _( "Enter the value corresponding to color index 255 in the bitmap file. For gray scale " - "images, color 255 is normally white." ), - "" ); + "images, color 255 is normally white." ) + ); // Fixpoints tab - gtk_tooltips_set_tip( GTK_TOOLTIPS( tooltips ), + gtk_widget_set_tooltip_text( GTK_WIDGET( g_object_get_data( G_OBJECT( g_pWnd ), "fix_value" ) ), _( "Enter a value for the selected vertex. This value will not be adjusted when applying " "a waveform or roughness to the surface. Unlock this vertex (so that it will be " "adjusted normally) by clicking \"Free\". This vertex will influence vertices within " - "the \"Range affected\" of this vertex." ), - "" ); - gtk_tooltips_set_tip( GTK_TOOLTIPS( tooltips ), + "the \"Range affected\" of this vertex." ) + ); + gtk_widget_set_tooltip_text( GTK_WIDGET( g_object_get_data( G_OBJECT( g_pWnd ), "fix_range" ) ), _( "Enter the range away from the selected vertex that other vertices will be affected. " "Use 0 if you don't want other vertices to be influenced by the currently selected " "one. Note: this box is disabled if you've chosen the fractal generator, as it uses " - "a completely different method for determining values." ), - "" ); - gtk_tooltips_set_tip( GTK_TOOLTIPS( tooltips ), + "a completely different method for determining values." ) + ); + gtk_widget_set_tooltip_text( GTK_WIDGET( g_object_get_data( G_OBJECT( g_pWnd ), "fix_rate" ) ), _( "Enter a rate of change for the surface affected by the fixed value. 0 gives a smooth " "sinusoidal curve, values less than 0 give progressively sharper spikes, and values " "greater than 0 take on a square shape. Values less than -30 or greater than 30 are " "set to -30 and 30, respectively. Note that this entry will have no effect unless " - "you also specify a \"range affected\"." ), - "" ); - gtk_tooltips_set_tip( GTK_TOOLTIPS( tooltips ), + "you also specify a \"range affected\"." ) + ); + gtk_widget_set_tooltip_text( GTK_WIDGET( g_object_get_data( G_OBJECT( g_pWnd ), "fix_free" ) ), - _( "Click this to free (unlock the value of) the currently selected vertex." ), - "" ); - gtk_tooltips_set_tip( GTK_TOOLTIPS( tooltips ), + _( "Click this to free (unlock the value of) the currently selected vertex." ) + ); + gtk_widget_set_tooltip_text( GTK_WIDGET( g_object_get_data( G_OBJECT( g_pWnd ), "fix_freeall" ) ), - _( "Click this to free (unlock the values of) all vertices." ), - "" ); + _( "Click this to free (unlock the values of) all vertices." ) + ); // Texture tab - gtk_tooltips_set_tip( GTK_TOOLTIPS( tooltips ), + gtk_widget_set_tooltip_text( GTK_WIDGET( g_object_get_data( G_OBJECT( g_pWnd ), "texture1" ) ), - _( "Enter the name of the texture or shader used for the surface faces." ), - "" ); - gtk_tooltips_set_tip( GTK_TOOLTIPS( tooltips ), + _( "Enter the name of the texture or shader used for the surface faces." ) + ); + gtk_widget_set_tooltip_text( GTK_WIDGET( g_object_get_data( G_OBJECT( g_pWnd ), "texture2" ) ), _( "Enter the name of the texture or shader used for faces other than the surface. Under " - "normal circumstances this should be \"common/caulk\"" ), - "" ); - gtk_tooltips_set_tip( GTK_TOOLTIPS( tooltips ), + "normal circumstances this should be \"common/caulk\"" ) + ); + gtk_widget_set_tooltip_text( GTK_WIDGET( g_object_get_data( G_OBJECT( g_pWnd ), "texture3" ) ), _( "Enter the name of the texture or shader used for \"steep\" surface faces, where \"steep\" " "is the angle specified below. If this entry is left blank or if the \"steep\" angle is 0, " - "all surface faces will use the texture specified by \"Surface\"." ), - "" ); + "all surface faces will use the texture specified by \"Surface\"." ) + ); - gtk_tooltips_set_tip( GTK_TOOLTIPS( tooltips ), + gtk_widget_set_tooltip_text( GTK_WIDGET( g_object_get_data( G_OBJECT( g_pWnd ), "detail" ) ), _( "Check this box to use the detail content property on the generated brushes. Compile " "times will be considerably shorter if the detail property is used, though the surface " "will not block visibility at all. If you use the detail property, you should make sure " "that \"common/caulk\" is used for the non-surface faces, or the polygon count will be " - "much higher than necessary." ), - "" ); + "much higher than necessary." ) + ); } // ============================================================================= @@ -1348,9 +1346,10 @@ void create_tooltips(){ GtkWidget* create_main_dialog(){ GtkWidget *dlg, *vbox, *hbox, *hbox2, *button, *notebook, *frame, *table, *table2; - GtkWidget *check, *spin, *radio, *label, *entry, *scale; - GtkObject *adj; + GtkWidget *check, *spin, *radio, *label, *entry, *scale, *offset_label, *scale_label; + GtkAdjustment *adj; GSList *group; + GtkSizeGroup *size_group; int i; const char *games[] = { "Quake 2", "Half-Life", "SiN", "Heretic 2", "Kingpin", "Genesis3D", "Quake 3 Arena" }; const char *waveforms[] = { "Alternating hill/valley", "Cylindrical left-to-right", "Cylindrical top-to-bottom", @@ -1365,373 +1364,377 @@ GtkWidget* create_main_dialog(){ gtk_window_set_transient_for( GTK_WINDOW( dlg ), GTK_WINDOW( g_pRadiantWnd ) ); hbox = gtk_hbox_new( FALSE, 5 ); - gtk_widget_show( hbox ); gtk_container_add( GTK_CONTAINER( dlg ), hbox ); gtk_container_set_border_width( GTK_CONTAINER( hbox ), 5 ); + gtk_widget_show( hbox ); notebook = gtk_notebook_new(); - gtk_widget_show( notebook ); gtk_box_pack_start( GTK_BOX( hbox ), notebook, TRUE, TRUE, 0 ); g_signal_connect( G_OBJECT( notebook ), "switch-page", G_CALLBACK( switch_page ), NULL ); gtk_notebook_set_tab_pos( GTK_NOTEBOOK( notebook ), GTK_POS_TOP ); g_object_set_data( G_OBJECT( dlg ), "notebook", notebook ); + gtk_widget_show( notebook ); table = gtk_table_new( 2, 2, FALSE ); - gtk_widget_show( table ); gtk_container_set_border_width( GTK_CONTAINER( table ), 5 ); gtk_table_set_row_spacings( GTK_TABLE( table ), 5 ); gtk_table_set_col_spacings( GTK_TABLE( table ), 5 ); + gtk_widget_show( table ); label = gtk_label_new( _( "General" ) ); - gtk_widget_show( label ); gtk_notebook_append_page( GTK_NOTEBOOK( notebook ), table, label ); + gtk_widget_show( label ); frame = gtk_frame_new( _( "Game" ) ); - gtk_widget_show( frame ); gtk_table_attach( GTK_TABLE( table ), frame, 0, 1, 0, 1, (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), 0, 0 ); + gtk_widget_show( frame ); vbox = gtk_vbox_new( TRUE, 5 ); - gtk_widget_show( vbox ); gtk_container_add( GTK_CONTAINER( frame ), vbox ); gtk_container_set_border_width( GTK_CONTAINER( vbox ), 5 ); + gtk_widget_show( vbox ); for ( i = 0, group = NULL; i < NUMGAMES; i++ ) { radio = gtk_radio_button_new_with_label( group, games[i] ); - gtk_widget_show( radio ); gtk_box_pack_start( GTK_BOX( vbox ), radio, TRUE, TRUE, 0 ); + gtk_widget_show( radio ); group = gtk_radio_button_get_group( GTK_RADIO_BUTTON( radio ) ); game_radios[i] = radio; g_signal_connect( G_OBJECT( radio ), "toggled", G_CALLBACK( general_game ), GINT_TO_POINTER( i ) ); } frame = gtk_frame_new( _( "Waveform" ) ); - gtk_widget_show( frame ); gtk_table_attach( GTK_TABLE( table ), frame, 1, 2, 0, 1, (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), 0, 0 ); + gtk_widget_show( frame ); vbox = gtk_vbox_new( TRUE, 5 ); - gtk_widget_show( vbox ); gtk_container_add( GTK_CONTAINER( frame ), vbox ); gtk_container_set_border_width( GTK_CONTAINER( vbox ), 5 ); + gtk_widget_show( vbox ); for ( i = 0, group = NULL; i < 5; i++ ) { radio = gtk_radio_button_new_with_label( group, waveforms[i] ); - gtk_widget_show( radio ); gtk_box_pack_start( GTK_BOX( vbox ), radio, TRUE, TRUE, 0 ); + gtk_widget_show( radio ); group = gtk_radio_button_get_group( GTK_RADIO_BUTTON( radio ) ); wave_radios[i] = radio; g_signal_connect( G_OBJECT( radio ), "toggled", G_CALLBACK( general_wave ), GINT_TO_POINTER( i ) ); } frame = gtk_frame_new( _( "Orientation" ) ); - gtk_widget_show( frame ); gtk_table_attach( GTK_TABLE( table ), frame, 0, 1, 1, 2, (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), 0, 0 ); + gtk_widget_show( frame ); vbox = gtk_vbox_new( TRUE, 5 ); - gtk_widget_show( vbox ); gtk_container_add( GTK_CONTAINER( frame ), vbox ); gtk_container_set_border_width( GTK_CONTAINER( vbox ), 5 ); + gtk_widget_show( vbox ); for ( i = 0, group = NULL; i < 6; i++ ) { radio = gtk_radio_button_new_with_label( group, orientations[i] ); - gtk_widget_show( radio ); gtk_box_pack_start( GTK_BOX( vbox ), radio, TRUE, TRUE, 0 ); + gtk_widget_show( radio ); group = gtk_radio_button_get_group( GTK_RADIO_BUTTON( radio ) ); plane_radios[i] = radio; g_signal_connect( G_OBJECT( radio ), "toggled", G_CALLBACK( general_plane ), GINT_TO_POINTER( i ) ); } table2 = gtk_table_new( 4, 2, FALSE ); - gtk_widget_show( table2 ); gtk_table_set_row_spacings( GTK_TABLE( table2 ), 5 ); gtk_table_set_col_spacings( GTK_TABLE( table2 ), 5 ); gtk_table_attach( GTK_TABLE( table ), table2, 1, 2, 1, 2, (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), 0, 0 ); + gtk_widget_show( table2 ); label = gtk_label_new( _( "Wavelength:" ) ); - gtk_widget_show( label ); gtk_table_attach( GTK_TABLE( table2 ), label, 0, 1, 0, 1, (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), 0, 0 ); gtk_misc_set_alignment( GTK_MISC( label ), 1, 0.5 ); gtk_label_set_justify( GTK_LABEL( label ), GTK_JUSTIFY_RIGHT ); + gtk_widget_show( label ); label = gtk_label_new( _( "Max. amplitude:" ) ); - gtk_widget_show( label ); gtk_table_attach( GTK_TABLE( table2 ), label, 0, 1, 1, 2, (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), 0, 0 ); gtk_misc_set_alignment( GTK_MISC( label ), 1, 0.5 ); gtk_label_set_justify( GTK_LABEL( label ), GTK_JUSTIFY_RIGHT ); + gtk_widget_show( label ); label = gtk_label_new( _( "Roughness:" ) ); - gtk_widget_show( label ); gtk_table_attach( GTK_TABLE( table2 ), label, 0, 1, 2, 3, (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), 0, 0 ); gtk_misc_set_alignment( GTK_MISC( label ), 1, 0.5 ); gtk_label_set_justify( GTK_LABEL( label ), GTK_JUSTIFY_RIGHT ); + gtk_widget_show( label ); label = gtk_label_new( _( "Random seed:" ) ); - gtk_widget_show( label ); gtk_table_attach( GTK_TABLE( table2 ), label, 0, 1, 3, 4, (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), 0, 0 ); gtk_misc_set_alignment( GTK_MISC( label ), 1, 0.5 ); gtk_label_set_justify( GTK_LABEL( label ), GTK_JUSTIFY_RIGHT ); + gtk_widget_show( label ); entry = gtk_entry_new(); - gtk_widget_show( entry ); gtk_table_attach( GTK_TABLE( table2 ), entry, 1, 2, 0, 1, (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), 0, 0 ); - gtk_widget_set_usize( entry, 50, -2 ); + gtk_entry_set_alignment( GTK_ENTRY( entry ), 1.0 ); //right + gtk_widget_show( entry ); g_object_set_data( G_OBJECT( dlg ), "wavelength", entry ); g_signal_connect( G_OBJECT( entry ), "focus-out-event", G_CALLBACK( doublevariable_entryfocusout ), &WaveLength ); entry = gtk_entry_new(); - gtk_widget_show( entry ); gtk_table_attach( GTK_TABLE( table2 ), entry, 1, 2, 1, 2, (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), 0, 0 ); - gtk_widget_set_usize( entry, 50, -2 ); + gtk_entry_set_alignment( GTK_ENTRY( entry ), 1.0 ); //right + gtk_widget_show( entry ); g_object_set_data( G_OBJECT( dlg ), "amplitude", entry ); g_signal_connect( G_OBJECT( entry ), "focus-out-event", G_CALLBACK( doublevariable_entryfocusout ), &Amplitude ); entry = gtk_entry_new(); - gtk_widget_show( entry ); gtk_table_attach( GTK_TABLE( table2 ), entry, 1, 2, 2, 3, (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), 0, 0 ); - gtk_widget_set_usize( entry, 50, -2 ); + gtk_entry_set_alignment( GTK_ENTRY( entry ), 1.0 ); //right + gtk_widget_show( entry ); g_object_set_data( G_OBJECT( dlg ), "roughness", entry ); g_signal_connect( G_OBJECT( entry ), "focus-out-event", G_CALLBACK( doublevariable_entryfocusout ), &Roughness ); - adj = gtk_adjustment_new( 1, 1, 32767, 1, 10, 0 ); + adj = GTK_ADJUSTMENT( gtk_adjustment_new( 1, 1, 32767, 1, 10, 0 ) ); g_signal_connect( G_OBJECT( adj ), "value-changed", G_CALLBACK( general_random ), NULL ); spin = gtk_spin_button_new( GTK_ADJUSTMENT( adj ), 1, 0 ); - gtk_widget_show( spin ); gtk_table_attach( GTK_TABLE( table2 ), spin, 1, 2, 3, 4, (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), 0, 0 ); - gtk_widget_set_usize( spin, 60, -2 ); + gtk_entry_set_alignment( GTK_ENTRY( spin ), 1.0 ); //right + gtk_widget_show( spin ); g_object_set_data( G_OBJECT( dlg ), "random", spin ); vbox = gtk_vbox_new( FALSE, 5 ); - gtk_widget_show( vbox ); gtk_container_set_border_width( GTK_CONTAINER( vbox ), 5 ); + gtk_widget_show( vbox ); label = gtk_label_new( _( "Extents" ) ); - gtk_widget_show( label ); gtk_notebook_append_page( GTK_NOTEBOOK( notebook ), vbox, label ); + gtk_widget_show( label ); hbox2 = gtk_hbox_new( FALSE, 5 ); - gtk_widget_show( hbox2 ); gtk_box_pack_start( GTK_BOX( vbox ), hbox2, FALSE, TRUE, 0 ); + gtk_widget_show( hbox2 ); frame = gtk_frame_new( _( "Extents" ) ); - gtk_widget_show( frame ); gtk_box_pack_start( GTK_BOX( hbox2 ), frame, TRUE, TRUE, 0 ); + gtk_widget_show( frame ); table = gtk_table_new( 3, 4, FALSE ); - gtk_widget_show( table ); gtk_container_set_border_width( GTK_CONTAINER( table ), 5 ); gtk_container_add( GTK_CONTAINER( frame ), table ); gtk_table_set_row_spacings( GTK_TABLE( table ), 5 ); gtk_table_set_col_spacings( GTK_TABLE( table ), 5 ); + gtk_widget_show( table ); label = gtk_label_new( _( "X:" ) ); - gtk_widget_show( label ); gtk_table_attach( GTK_TABLE( table ), label, 0, 1, 1, 2, (GtkAttachOptions) ( GTK_FILL ), (GtkAttachOptions) ( GTK_FILL ), 0, 0 ); g_object_set_data( G_OBJECT( dlg ), "hmin_text", label ); + gtk_widget_show( label ); label = gtk_label_new( _( "X:" ) ); - gtk_widget_show( label ); gtk_table_attach( GTK_TABLE( table ), label, 2, 3, 1, 2, (GtkAttachOptions) ( GTK_FILL ), (GtkAttachOptions) ( GTK_FILL ), 0, 0 ); g_object_set_data( G_OBJECT( dlg ), "hmax_text", label ); + gtk_widget_show( label ); label = gtk_label_new( _( "Y:" ) ); - gtk_widget_show( label ); gtk_table_attach( GTK_TABLE( table ), label, 0, 1, 2, 3, (GtkAttachOptions) ( GTK_FILL ), (GtkAttachOptions) ( GTK_FILL ), 0, 0 ); + gtk_widget_show( label ); g_object_set_data( G_OBJECT( dlg ), "vmin_text", label ); label = gtk_label_new( _( "Y:" ) ); - gtk_widget_show( label ); gtk_table_attach( GTK_TABLE( table ), label, 2, 3, 2, 3, (GtkAttachOptions) ( GTK_FILL ), (GtkAttachOptions) ( GTK_FILL ), 0, 0 ); + gtk_widget_show( label ); g_object_set_data( G_OBJECT( dlg ), "vmax_text", label ); label = gtk_label_new( _( "Lower-left" ) ); - gtk_widget_show( label ); gtk_table_attach( GTK_TABLE( table ), label, 1, 2, 0, 1, (GtkAttachOptions) ( GTK_FILL ), (GtkAttachOptions) ( GTK_FILL ), 0, 0 ); + gtk_widget_show( label ); label = gtk_label_new( _( "Upper-right" ) ); - gtk_widget_show( label ); gtk_table_attach( GTK_TABLE( table ), label, 3, 4, 0, 1, (GtkAttachOptions) ( GTK_FILL ), (GtkAttachOptions) ( GTK_FILL ), 0, 0 ); + gtk_widget_show( label ); entry = gtk_entry_new(); - gtk_widget_show( entry ); gtk_table_attach( GTK_TABLE( table ), entry, 1, 2, 1, 2, (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), 0, 0 ); - gtk_widget_set_usize( entry, 50, -2 ); + gtk_entry_set_alignment( GTK_ENTRY( entry ), 1.0 ); //right + gtk_widget_show( entry ); g_object_set_data( G_OBJECT( dlg ), "hmin", entry ); g_signal_connect( G_OBJECT( entry ), "focus-out-event", G_CALLBACK( doublevariable_entryfocusout ), &Hll ); entry = gtk_entry_new(); - gtk_widget_show( entry ); gtk_table_attach( GTK_TABLE( table ), entry, 3, 4, 1, 2, (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), 0, 0 ); - gtk_widget_set_usize( entry, 50, -2 ); + gtk_entry_set_alignment( GTK_ENTRY( entry ), 1.0 ); //right + gtk_widget_show( entry ); g_object_set_data( G_OBJECT( dlg ), "hmax", entry ); g_signal_connect( G_OBJECT( entry ), "focus-out-event", G_CALLBACK( doublevariable_entryfocusout ), &Hur ); entry = gtk_entry_new(); - gtk_widget_show( entry ); gtk_table_attach( GTK_TABLE( table ), entry, 1, 2, 2, 3, (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), 0, 0 ); - gtk_widget_set_usize( entry, 50, -2 ); + gtk_entry_set_alignment( GTK_ENTRY( entry ), 1.0 ); //right + gtk_widget_show( entry ); g_object_set_data( G_OBJECT( dlg ), "vmin", entry ); g_signal_connect( G_OBJECT( entry ), "focus-out-event", G_CALLBACK( doublevariable_entryfocusout ), &Vll ); entry = gtk_entry_new(); - gtk_widget_show( entry ); gtk_table_attach( GTK_TABLE( table ), entry, 3, 4, 2, 3, (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), 0, 0 ); - gtk_widget_set_usize( entry, 50, -2 ); + gtk_entry_set_alignment( GTK_ENTRY( entry ), 1.0 ); //right + gtk_widget_show( entry ); g_object_set_data( G_OBJECT( dlg ), "vmax", entry ); g_signal_connect( G_OBJECT( entry ), "focus-out-event", G_CALLBACK( doublevariable_entryfocusout ), &Vur ); frame = gtk_frame_new( _( "Divisions" ) ); - gtk_widget_show( frame ); gtk_box_pack_start( GTK_BOX( hbox2 ), frame, TRUE, TRUE, 0 ); + gtk_widget_show( frame ); table = gtk_table_new( 2, 2, FALSE ); - gtk_widget_show( table ); gtk_container_set_border_width( GTK_CONTAINER( table ), 5 ); gtk_container_add( GTK_CONTAINER( frame ), table ); gtk_table_set_row_spacings( GTK_TABLE( table ), 5 ); gtk_table_set_col_spacings( GTK_TABLE( table ), 5 ); + gtk_widget_show( table ); label = gtk_label_new( _( "X:" ) ); - gtk_widget_show( label ); gtk_table_attach( GTK_TABLE( table ), label, 0, 1, 0, 1, (GtkAttachOptions) ( GTK_FILL ), (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), 0, 0 ); + gtk_widget_show( label ); g_object_set_data( G_OBJECT( dlg ), "nh_text", label ); label = gtk_label_new( _( "Y:" ) ); - gtk_widget_show( label ); gtk_table_attach( GTK_TABLE( table ), label, 0, 1, 1, 2, (GtkAttachOptions) ( GTK_FILL ), (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), 0, 0 ); + gtk_widget_show( label ); g_object_set_data( G_OBJECT( dlg ), "nv_text", label ); - adj = gtk_adjustment_new( 8, 1, MAX_ROWS, 1, 10, 0 ); + adj = GTK_ADJUSTMENT( gtk_adjustment_new( 8, 1, MAX_ROWS, 1, 10, 0 ) ); g_signal_connect( G_OBJECT( adj ), "value-changed", G_CALLBACK( extents_nhnv_spin ), &NH ); spin = gtk_spin_button_new( GTK_ADJUSTMENT( adj ), 1, 0 ); - gtk_widget_show( spin ); + gtk_spin_button_set_numeric( GTK_SPIN_BUTTON( spin ), TRUE ); gtk_table_attach( GTK_TABLE( table ), spin, 1, 2, 0, 1, (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), 0, 0 ); - gtk_widget_set_usize( spin, 60, -2 ); + gtk_entry_set_alignment( GTK_ENTRY( spin ), 1.0 ); //right + gtk_widget_show( spin ); g_object_set_data( G_OBJECT( dlg ), "nh", spin ); - adj = gtk_adjustment_new( 8, 1, MAX_ROWS, 1, 10, 0 ); + adj = GTK_ADJUSTMENT( gtk_adjustment_new( 8, 1, MAX_ROWS, 1, 10, 0 ) ); g_signal_connect( G_OBJECT( adj ), "value-changed", G_CALLBACK( extents_nhnv_spin ), &NV ); spin = gtk_spin_button_new( GTK_ADJUSTMENT( adj ), 1, 0 ); - gtk_widget_show( spin ); + gtk_spin_button_set_numeric( GTK_SPIN_BUTTON( spin ), TRUE ); gtk_table_attach( GTK_TABLE( table ), spin, 1, 2, 1, 2, (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), 0, 0 ); - gtk_widget_set_usize( spin, 60, -2 ); + gtk_entry_set_alignment( GTK_ENTRY( spin ), 1.0 ); //right + gtk_widget_show( spin ); g_object_set_data( G_OBJECT( dlg ), "nv", spin ); check = gtk_check_button_new_with_label( _( "Use Bezier patches" ) ); - gtk_widget_show( check ); gtk_box_pack_start( GTK_BOX( vbox ), check, FALSE, TRUE, 0 ); + gtk_widget_show( check ); g_object_set_data( G_OBJECT( dlg ), "use_patches", check ); g_signal_connect( G_OBJECT( check ), "toggled", G_CALLBACK( extents_use_patches ), NULL ); // ^Fishman - Snap to grid, replaced scroll bar with a texbox. label = gtk_label_new( _( "Snap to grid:" ) ); - gtk_widget_show( label ); gtk_box_pack_start( GTK_BOX( vbox ), label, FALSE, TRUE, 0 ); + gtk_widget_show( label ); g_object_set_data( G_OBJECT( dlg ), "snap_text", label ); - adj = gtk_adjustment_new( 8, 0, 256, 1, 10, 0 ); + adj = GTK_ADJUSTMENT( gtk_adjustment_new( 8, 0, 256, 1, 10, 0 ) ); g_signal_connect( G_OBJECT( adj ), "value-changed", G_CALLBACK( extents_snaptogrid_spin ), &SP ); spin = gtk_spin_button_new( GTK_ADJUSTMENT( adj ), 1, 0 ); - gtk_widget_show( spin ); + gtk_spin_button_set_numeric( GTK_SPIN_BUTTON( spin ), TRUE ); gtk_box_pack_start( GTK_BOX( vbox ), spin, FALSE, TRUE, 0 ); - gtk_widget_set_usize( spin, 60, -2 ); + gtk_entry_set_alignment( GTK_ENTRY( spin ), 1.0 ); //right + gtk_widget_show( spin ); g_object_set_data( G_OBJECT( dlg ), "sp", spin ); // ^Fishman - End of Snap to grid code. hbox2 = gtk_hbox_new( FALSE, 5 ); - gtk_widget_show( hbox2 ); gtk_box_pack_start( GTK_BOX( vbox ), hbox2, FALSE, TRUE, 10 ); + gtk_widget_show( hbox2 ); label = gtk_label_new( _( "Decimate:" ) ); - gtk_widget_show( label ); gtk_box_pack_start( GTK_BOX( hbox2 ), label, FALSE, TRUE, 0 ); + gtk_widget_show( label ); - adj = gtk_adjustment_new( 0, 0, 110, 1, 10, 0 ); + adj = GTK_ADJUSTMENT( gtk_adjustment_new( 0, 0, 110, 1, 10, 0 ) ); g_signal_connect( G_OBJECT( adj ), "value-changed", G_CALLBACK( extents_decimate ), NULL ); g_object_set_data( G_OBJECT( dlg ), "decimate_adj", adj ); scale = gtk_hscale_new( GTK_ADJUSTMENT( adj ) ); - gtk_widget_show( scale ); gtk_box_pack_start( GTK_BOX( hbox2 ), scale, TRUE, TRUE, 0 ); gtk_scale_set_value_pos( GTK_SCALE( scale ), GTK_POS_RIGHT ); gtk_scale_set_digits( GTK_SCALE( scale ), 0 ); + gtk_widget_show( scale ); g_object_set_data( G_OBJECT( dlg ), "decimate", scale ); frame = gtk_frame_new( _( "Corner values" ) ); - gtk_widget_show( frame ); gtk_box_pack_start( GTK_BOX( vbox ), frame, FALSE, TRUE, 0 ); + gtk_widget_show( frame ); table = gtk_table_new( 3, 4, FALSE ); - gtk_widget_show( table ); + gtk_container_set_border_width( GTK_CONTAINER( table ), 5 ); gtk_container_add( GTK_CONTAINER( frame ), table ); gtk_table_set_row_spacings( GTK_TABLE( table ), 5 ); gtk_table_set_col_spacings( GTK_TABLE( table ), 5 ); + gtk_widget_show( table ); label = gtk_label_new( _( "Upper-left:" ) ); - gtk_widget_show( label ); gtk_table_attach( GTK_TABLE( table ), label, 0, 1, 0, 1, (GtkAttachOptions) ( GTK_FILL ), (GtkAttachOptions) ( GTK_FILL ), 0, 0 ); + gtk_widget_show( label ); label = gtk_label_new( _( "Lower-left:" ) ); - gtk_widget_show( label ); gtk_table_attach( GTK_TABLE( table ), label, 0, 1, 1, 2, (GtkAttachOptions) ( GTK_FILL ), (GtkAttachOptions) ( GTK_FILL ), 0, 0 ); + gtk_widget_show( label ); label = gtk_label_new( _( "Upper-right:" ) ); gtk_widget_show( label ); @@ -1740,168 +1743,166 @@ GtkWidget* create_main_dialog(){ (GtkAttachOptions) ( GTK_FILL ), 0, 0 ); label = gtk_label_new( _( "Lower-right:" ) ); - gtk_widget_show( label ); gtk_table_attach( GTK_TABLE( table ), label, 2, 3, 1, 2, (GtkAttachOptions) ( GTK_FILL ), (GtkAttachOptions) ( GTK_FILL ), 0, 0 ); + gtk_widget_show( label ); entry = gtk_entry_new(); - gtk_widget_show( entry ); gtk_table_attach( GTK_TABLE( table ), entry, 1, 2, 0, 1, (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), 0, 0 ); - gtk_widget_set_usize( entry, 50, -2 ); + gtk_entry_set_alignment( GTK_ENTRY( entry ), 1.0 ); //right + gtk_widget_show( entry ); g_object_set_data( G_OBJECT( dlg ), "z01", entry ); g_signal_connect( G_OBJECT( entry ), "focus-out-event", G_CALLBACK( doublevariable_entryfocusout ), &Z01 ); entry = gtk_entry_new(); - gtk_widget_show( entry ); gtk_table_attach( GTK_TABLE( table ), entry, 1, 2, 1, 2, (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), 0, 0 ); - gtk_widget_set_usize( entry, 50, -2 ); + gtk_entry_set_alignment( GTK_ENTRY( entry ), 1.0 ); //right + gtk_widget_show( entry ); g_object_set_data( G_OBJECT( dlg ), "z00", entry ); g_signal_connect( G_OBJECT( entry ), "focus-out-event", G_CALLBACK( doublevariable_entryfocusout ), &Z00 ); entry = gtk_entry_new(); - gtk_widget_show( entry ); gtk_table_attach( GTK_TABLE( table ), entry, 3, 4, 0, 1, (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), 0, 0 ); - gtk_widget_set_usize( entry, 50, -2 ); + gtk_entry_set_alignment( GTK_ENTRY( entry ), 1.0 ); //right + gtk_widget_show( entry ); g_object_set_data( G_OBJECT( dlg ), "z11", entry ); g_signal_connect( G_OBJECT( entry ), "focus-out-event", G_CALLBACK( doublevariable_entryfocusout ), &Z11 ); entry = gtk_entry_new(); - gtk_widget_show( entry ); gtk_table_attach( GTK_TABLE( table ), entry, 3, 4, 1, 2, (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), 0, 0 ); - gtk_widget_set_usize( entry, 50, -2 ); + gtk_entry_set_alignment( GTK_ENTRY( entry ), 1.0 ); //right + gtk_widget_show( entry ); g_object_set_data( G_OBJECT( dlg ), "z10", entry ); g_signal_connect( G_OBJECT( entry ), "focus-out-event", G_CALLBACK( doublevariable_entryfocusout ), &Z10 ); check = gtk_check_button_new_with_label( _( "Linear borders" ) ); - gtk_widget_show( check ); gtk_table_attach( GTK_TABLE( table ), check, 0, 4, 2, 3, (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), 0, 0 ); + gtk_widget_show( check ); g_object_set_data( G_OBJECT( dlg ), "linearborder", check ); g_signal_connect( G_OBJECT( check ), "toggled", G_CALLBACK( extents_linearborder ), NULL ); vbox = gtk_vbox_new( FALSE, 10 ); - gtk_widget_show( vbox ); gtk_container_set_border_width( GTK_CONTAINER( vbox ), 5 ); + gtk_widget_show( vbox ); label = gtk_label_new( _( "Bitmap" ) ); - gtk_widget_show( label ); gtk_notebook_append_page( GTK_NOTEBOOK( notebook ), vbox, label ); + gtk_widget_show( label ); label = gtk_label_new( "" ); - gtk_widget_show( label ); gtk_box_pack_start( GTK_BOX( vbox ), label, FALSE, TRUE, 0 ); + gtk_widget_show( label ); g_object_set_data( G_OBJECT( dlg ), "bmp_note", label ); table = gtk_table_new( 2, 2, FALSE ); - gtk_widget_show( table ); gtk_container_set_border_width( GTK_CONTAINER( table ), 5 ); gtk_box_pack_start( GTK_BOX( vbox ), table, FALSE, TRUE, 0 ); gtk_table_set_row_spacings( GTK_TABLE( table ), 5 ); gtk_table_set_col_spacings( GTK_TABLE( table ), 5 ); + gtk_widget_show( table ); label = gtk_label_new( _( "Filename:" ) ); - gtk_widget_show( label ); gtk_table_attach( GTK_TABLE( table ), label, 0, 1, 0, 1, (GtkAttachOptions) ( GTK_FILL ), (GtkAttachOptions) ( GTK_FILL ), 0, 0 ); + gtk_widget_show( label ); g_object_set_data( G_OBJECT( dlg ), "bmp_text1", label ); entry = gtk_entry_new(); - gtk_widget_show( entry ); gtk_table_attach( GTK_TABLE( table ), entry, 1, 2, 0, 1, (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), (GtkAttachOptions) ( GTK_FILL ), 0, 0 ); + gtk_widget_show( entry ); g_object_set_data( G_OBJECT( dlg ), "bmp_file", entry ); g_signal_connect( G_OBJECT( entry ), "focus-out-event", G_CALLBACK( bitmap_file_entryfocusout ), NULL ); hbox2 = gtk_hbox_new( TRUE, 5 ); - gtk_widget_show( hbox2 ); gtk_table_attach( GTK_TABLE( table ), hbox2, 1, 2, 1, 2, (GtkAttachOptions) ( 0 ), (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), 0, 0 ); + gtk_widget_show( hbox2 ); button = gtk_button_new_with_label( _( "Browse..." ) ); - gtk_widget_show( button ); gtk_box_pack_start( GTK_BOX( hbox2 ), button, FALSE, FALSE, 0 ); - gtk_widget_set_usize( button, 60, -2 ); + gtk_widget_show( button ); g_object_set_data( G_OBJECT( dlg ), "bmp_file_browse", button ); g_signal_connect( G_OBJECT( button ), "clicked", G_CALLBACK( bitmap_browse ), NULL ); button = gtk_button_new_with_label( _( "Reload" ) ); - gtk_widget_show( button ); gtk_box_pack_start( GTK_BOX( hbox2 ), button, FALSE, FALSE, 0 ); - gtk_widget_set_usize( button, 60, -2 ); + gtk_widget_show( button ); g_object_set_data( G_OBJECT( dlg ), "bmp_reload", button ); g_signal_connect( G_OBJECT( button ), "clicked", G_CALLBACK( bitmap_reload ), NULL ); table = gtk_table_new( 2, 2, TRUE ); - gtk_widget_show( table ); gtk_container_set_border_width( GTK_CONTAINER( table ), 5 ); gtk_box_pack_start( GTK_BOX( vbox ), table, FALSE, TRUE, 0 ); gtk_table_set_row_spacings( GTK_TABLE( table ), 5 ); gtk_table_set_col_spacings( GTK_TABLE( table ), 5 ); + gtk_widget_show( table ); label = gtk_label_new( _( "Map color 0 to:" ) ); - gtk_widget_show( label ); gtk_table_attach( GTK_TABLE( table ), label, 0, 1, 0, 1, (GtkAttachOptions) ( GTK_FILL | GTK_EXPAND ), (GtkAttachOptions) ( GTK_FILL ), 0, 0 ); - g_object_set_data( G_OBJECT( dlg ), "bmp_text2", label ); gtk_misc_set_alignment( GTK_MISC( label ), 1, 0.5 ); gtk_label_set_justify( GTK_LABEL( label ), GTK_JUSTIFY_RIGHT ); + gtk_widget_show( label ); + g_object_set_data( G_OBJECT( dlg ), "bmp_text2", label ); label = gtk_label_new( _( "Map color 255 to:" ) ); - gtk_widget_show( label ); gtk_table_attach( GTK_TABLE( table ), label, 0, 1, 1, 2, (GtkAttachOptions) ( GTK_FILL | GTK_EXPAND ), (GtkAttachOptions) ( GTK_FILL ), 0, 0 ); g_object_set_data( G_OBJECT( dlg ), "bmp_text3", label ); gtk_misc_set_alignment( GTK_MISC( label ), 1, 0.5 ); gtk_label_set_justify( GTK_LABEL( label ), GTK_JUSTIFY_RIGHT ); + gtk_widget_show( label ); hbox2 = gtk_hbox_new( FALSE, 5 ); - gtk_widget_show( hbox2 ); gtk_table_attach( GTK_TABLE( table ), hbox2, 1, 2, 0, 1, (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), 0, 0 ); + gtk_widget_show( hbox2 ); entry = gtk_entry_new(); - gtk_widget_show( entry ); gtk_box_pack_start( GTK_BOX( hbox2 ), entry, FALSE, FALSE, 0 ); - gtk_widget_set_usize( entry, 50, -2 ); + gtk_entry_set_alignment( GTK_ENTRY( entry ), 1.0 ); //right + gtk_widget_show( entry ); g_object_set_data( G_OBJECT( dlg ), "bmp_black", entry ); g_signal_connect( G_OBJECT( entry ), "focus-out-event", G_CALLBACK( doublevariable_entryfocusout ), &gbmp.black_value ); hbox2 = gtk_hbox_new( FALSE, 5 ); - gtk_widget_show( hbox2 ); gtk_table_attach( GTK_TABLE( table ), hbox2, 1, 2, 1, 2, (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), 0, 0 ); + gtk_widget_show( hbox2 ); entry = gtk_entry_new(); - gtk_widget_show( entry ); gtk_box_pack_start( GTK_BOX( hbox2 ), entry, FALSE, FALSE, 0 ); - gtk_widget_set_usize( entry, 50, -2 ); + gtk_entry_set_alignment( GTK_ENTRY( entry ), 1.0 ); //right + gtk_widget_show( entry ); g_object_set_data( G_OBJECT( dlg ), "bmp_white", entry ); g_signal_connect( G_OBJECT( entry ), "focus-out-event", G_CALLBACK( doublevariable_entryfocusout ), &gbmp.white_value ); vbox = gtk_vbox_new( FALSE, 10 ); - gtk_widget_show( vbox ); gtk_container_set_border_width( GTK_CONTAINER( vbox ), 5 ); + gtk_widget_show( vbox ); label = gtk_label_new( _( "Fix Points" ) ); - gtk_widget_show( label ); gtk_notebook_append_page( GTK_NOTEBOOK( notebook ), vbox, label ); + gtk_widget_show( label ); label = gtk_label_new( _( "Click on a vertex in the lower half of the preview window,\n" "then use the arrow keys or text box to assign a value.\n" @@ -1909,282 +1910,284 @@ GtkWidget* create_main_dialog(){ "selection. Use Shift+Click to select a range of vertices.\n\n" "Click \"Free\" to unlock a vertex. Vertices within \"Range\n" "affected\" will be influenced by this vertex." ) ); - gtk_widget_show( label ); gtk_box_pack_start( GTK_BOX( vbox ), label, FALSE, TRUE, 0 ); + gtk_widget_show( label ); table = gtk_table_new( 3, 3, FALSE ); - gtk_widget_show( table ); gtk_container_set_border_width( GTK_CONTAINER( table ), 5 ); gtk_box_pack_start( GTK_BOX( vbox ), table, FALSE, TRUE, 0 ); gtk_table_set_row_spacings( GTK_TABLE( table ), 5 ); gtk_table_set_col_spacings( GTK_TABLE( table ), 5 ); + gtk_widget_show( table ); label = gtk_label_new( _( "Value:" ) ); - gtk_widget_show( label ); gtk_table_attach( GTK_TABLE( table ), label, 0, 1, 0, 1, (GtkAttachOptions) ( GTK_FILL ), (GtkAttachOptions) ( GTK_FILL ), 0, 0 ); gtk_misc_set_alignment( GTK_MISC( label ), 1, 0.5 ); + gtk_widget_show( label ); g_object_set_data( G_OBJECT( dlg ), "fix_value_text", label ); label = gtk_label_new( _( "Range affected:" ) ); - gtk_widget_show( label ); gtk_table_attach( GTK_TABLE( table ), label, 0, 1, 1, 2, (GtkAttachOptions) ( GTK_FILL ), (GtkAttachOptions) ( GTK_FILL ), 0, 0 ); gtk_misc_set_alignment( GTK_MISC( label ), 1, 0.5 ); + gtk_widget_show( label ); g_object_set_data( G_OBJECT( dlg ), "fix_range_text", label ); label = gtk_label_new( _( "Rate of change:" ) ); - gtk_widget_show( label ); gtk_table_attach( GTK_TABLE( table ), label, 0, 1, 2, 3, (GtkAttachOptions) ( GTK_FILL ), (GtkAttachOptions) ( GTK_FILL ), 0, 0 ); gtk_misc_set_alignment( GTK_MISC( label ), 1, 0.5 ); + gtk_widget_show( label ); g_object_set_data( G_OBJECT( dlg ), "fix_rate_text", label ); - adj = gtk_adjustment_new( 0, -65536, 65536, 1, 16, 0 ); + adj = GTK_ADJUSTMENT( gtk_adjustment_new( 0, -65536, 65536, 1, 16, 0 ) ); g_signal_connect( G_OBJECT( adj ), "value-changed", G_CALLBACK( fix_value_changed ), NULL ); spin = gtk_spin_button_new( GTK_ADJUSTMENT( adj ), 1, 0 ); - gtk_widget_show( spin ); gtk_table_attach( GTK_TABLE( table ), spin, 1, 2, 0, 1, (GtkAttachOptions) ( GTK_EXPAND ), (GtkAttachOptions) ( GTK_EXPAND ), 0, 0 ); - gtk_widget_set_usize( spin, 60, -2 ); + gtk_entry_set_alignment( GTK_ENTRY( spin ), 1.0 ); //right + gtk_widget_show( spin ); g_object_set_data( G_OBJECT( dlg ), "fix_value", spin ); g_signal_connect( G_OBJECT( spin ), "focus-out-event", G_CALLBACK( fix_value_entryfocusout ), NULL ); entry = gtk_entry_new(); - gtk_widget_show( entry ); gtk_table_attach( GTK_TABLE( table ), entry, 1, 2, 1, 2, (GtkAttachOptions) ( GTK_EXPAND ), (GtkAttachOptions) ( GTK_FILL ), 0, 0 ); - gtk_widget_set_usize( entry, 60, -2 ); + gtk_entry_set_alignment( GTK_ENTRY( entry ), 1.0 ); //right + gtk_widget_show( entry ); g_object_set_data( G_OBJECT( dlg ), "fix_range", entry ); g_signal_connect( G_OBJECT( entry ), "focus-out-event", G_CALLBACK( fix_range_entryfocusout ), NULL ); entry = gtk_entry_new(); - gtk_widget_show( entry ); gtk_table_attach( GTK_TABLE( table ), entry, 1, 2, 2, 3, (GtkAttachOptions) ( GTK_EXPAND ), (GtkAttachOptions) ( GTK_FILL ), 0, 0 ); - gtk_widget_set_usize( entry, 60, -2 ); + gtk_entry_set_alignment( GTK_ENTRY( entry ), 1.0 ); //right + gtk_widget_show( entry ); g_object_set_data( G_OBJECT( dlg ), "fix_rate", entry ); g_signal_connect( G_OBJECT( entry ), "focus-out-event", G_CALLBACK( fix_rate_entryfocusout ), NULL ); button = gtk_button_new_with_label( _( "Free" ) ); - gtk_widget_show( button ); gtk_table_attach( GTK_TABLE( table ), button, 2, 3, 0, 1, (GtkAttachOptions) ( GTK_EXPAND ), (GtkAttachOptions) ( GTK_FILL ), 0, 0 ); - gtk_widget_set_usize( button, 60, -2 ); + gtk_widget_show( button ); g_object_set_data( G_OBJECT( dlg ), "fix_free", button ); g_signal_connect( G_OBJECT( button ), "clicked", G_CALLBACK( fix_free ), NULL ); button = gtk_button_new_with_label( _( "Free All" ) ); - gtk_widget_show( button ); gtk_table_attach( GTK_TABLE( table ), button, 2, 3, 1, 2, (GtkAttachOptions) ( GTK_EXPAND ), (GtkAttachOptions) ( GTK_FILL ), 0, 0 ); - gtk_widget_set_usize( button, 60, -2 ); + gtk_widget_show( button ); g_object_set_data( G_OBJECT( dlg ), "fix_freeall", button ); g_signal_connect( G_OBJECT( button ), "clicked", G_CALLBACK( fix_freeall ), NULL ); vbox = gtk_vbox_new( FALSE, 10 ); - gtk_widget_show( vbox ); gtk_container_set_border_width( GTK_CONTAINER( vbox ), 5 ); + gtk_widget_show( vbox ); label = gtk_label_new( _( "Texture" ) ); - gtk_widget_show( label ); gtk_notebook_append_page( GTK_NOTEBOOK( notebook ), vbox, label ); + gtk_widget_show( label ); // ^Fishman - Modified to add more labels and textboxes. table = gtk_table_new( 5, 2, FALSE ); - gtk_widget_show( table ); gtk_box_pack_start( GTK_BOX( vbox ), table, FALSE, TRUE, 0 ); gtk_table_set_row_spacings( GTK_TABLE( table ), 5 ); gtk_table_set_col_spacings( GTK_TABLE( table ), 5 ); + gtk_widget_show( table ); label = gtk_label_new( _( "Surface:" ) ); - gtk_widget_show( label ); gtk_table_attach( GTK_TABLE( table ), label, 0, 1, 0, 1, (GtkAttachOptions) ( GTK_FILL ), (GtkAttachOptions) ( GTK_FILL ), 0, 0 ); gtk_misc_set_alignment( GTK_MISC( label ), 1, 0.5 ); + gtk_widget_show( label ); label = gtk_label_new( _( "Other:" ) ); - gtk_widget_show( label ); gtk_table_attach( GTK_TABLE( table ), label, 0, 1, 1, 2, (GtkAttachOptions) ( GTK_FILL ), (GtkAttachOptions) ( GTK_FILL ), 0, 0 ); gtk_misc_set_alignment( GTK_MISC( label ), 1, 0.5 ); + gtk_widget_show( label ); label = gtk_label_new( _( "Steep:" ) ); - gtk_widget_show( label ); gtk_table_attach( GTK_TABLE( table ), label, 0, 1, 2, 3, (GtkAttachOptions) ( GTK_FILL ), (GtkAttachOptions) ( GTK_FILL ), 0, 0 ); gtk_misc_set_alignment( GTK_MISC( label ), 1, 0.5 ); + gtk_widget_show( label ); entry = gtk_entry_new(); - gtk_widget_show( entry ); gtk_table_attach( GTK_TABLE( table ), entry, 1, 2, 0, 1, (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), (GtkAttachOptions) ( GTK_FILL ), 0, 0 ); - gtk_widget_set_usize( entry, 60, -2 ); + gtk_widget_show( entry ); g_object_set_data( G_OBJECT( dlg ), "texture1", entry ); g_signal_connect( G_OBJECT( entry ), "focus-out-event", G_CALLBACK( texture_entryfocusout ), GINT_TO_POINTER( 0 ) ); entry = gtk_entry_new(); - gtk_widget_show( entry ); gtk_table_attach( GTK_TABLE( table ), entry, 1, 2, 1, 2, (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), (GtkAttachOptions) ( GTK_FILL ), 0, 0 ); - gtk_widget_set_usize( entry, 60, -2 ); + gtk_widget_show( entry ); g_object_set_data( G_OBJECT( dlg ), "texture2", entry ); g_signal_connect( G_OBJECT( entry ), "focus-out-event", G_CALLBACK( texture_entryfocusout ), GINT_TO_POINTER( 1 ) ); entry = gtk_entry_new(); - gtk_widget_show( entry ); gtk_table_attach( GTK_TABLE( table ), entry, 1, 2, 2, 3, (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), (GtkAttachOptions) ( GTK_FILL ), 0, 0 ); - gtk_widget_set_usize( entry, 60, -2 ); + gtk_widget_show( entry ); g_object_set_data( G_OBJECT( dlg ), "texture3", entry ); hbox2 = gtk_hbox_new( FALSE, 5 ); - gtk_widget_show( hbox2 ); gtk_box_pack_start( GTK_BOX( vbox ), hbox2, FALSE, TRUE, 0 ); + gtk_widget_show( hbox2 ); label = gtk_label_new( _( "\"Steep\" angle:" ) ); - gtk_widget_show( label ); gtk_box_pack_start( GTK_BOX( hbox2 ), label, FALSE, TRUE, 0 ); + gtk_widget_show( label ); - adj = gtk_adjustment_new( 60, 0, 90, 1, 10, 0 ); + adj = GTK_ADJUSTMENT( gtk_adjustment_new( 60, 0, 90, 1, 10, 0 ) ); spin = gtk_spin_button_new( GTK_ADJUSTMENT( adj ), 1, 0 ); - gtk_widget_show( spin ); + gtk_spin_button_set_numeric( GTK_SPIN_BUTTON( spin ), TRUE ); gtk_box_pack_start( GTK_BOX( hbox2 ), spin, FALSE, TRUE, 0 ); + gtk_entry_set_alignment( GTK_ENTRY( spin ), 1.0 ); //right + gtk_widget_show( spin ); g_object_set_data( G_OBJECT( dlg ), "tex_slant", spin ); table = gtk_table_new( 2, 4, TRUE ); - gtk_widget_show( table ); gtk_box_pack_start( GTK_BOX( vbox ), table, FALSE, TRUE, 0 ); gtk_table_set_row_spacings( GTK_TABLE( table ), 5 ); gtk_table_set_col_spacings( GTK_TABLE( table ), 5 ); + gtk_widget_show( table ); - label = gtk_label_new( _( "Offset " ) ); - gtk_widget_show( label ); + offset_label = label = gtk_label_new( _( "Offset " ) ); gtk_table_attach( GTK_TABLE( table ), label, 0, 2, 0, 1, (GtkAttachOptions) ( GTK_FILL ), (GtkAttachOptions) ( GTK_FILL ), 0, 0 ); - - label = gtk_label_new( _( "Scale " ) ); gtk_widget_show( label ); + + scale_label = label = gtk_label_new( _( "Scale " ) ); gtk_table_attach( GTK_TABLE( table ), label, 2, 4, 0, 1, (GtkAttachOptions) ( GTK_FILL ), (GtkAttachOptions) ( GTK_FILL ), 0, 0 ); + gtk_widget_show( label ); entry = gtk_entry_new(); - gtk_widget_show( entry ); gtk_table_attach( GTK_TABLE( table ), entry, 0, 1, 1, 2, (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), (GtkAttachOptions) ( GTK_FILL ), 0, 0 ); - gtk_widget_set_usize( entry, 60, -2 ); + gtk_entry_set_alignment( GTK_ENTRY( entry ), 1.0 ); //right + gtk_widget_show( entry ); g_object_set_data( G_OBJECT( dlg ), "texoffsetx", entry ); entry = gtk_entry_new(); - gtk_widget_show( entry ); gtk_table_attach( GTK_TABLE( table ), entry, 1, 2, 1, 2, (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), (GtkAttachOptions) ( GTK_FILL ), 0, 0 ); - gtk_widget_set_usize( entry, 60, -2 ); + gtk_entry_set_alignment( GTK_ENTRY( entry ), 1.0 ); //right + gtk_widget_show( entry ); g_object_set_data( G_OBJECT( dlg ), "texoffsety", entry ); entry = gtk_entry_new(); - gtk_widget_show( entry ); gtk_table_attach( GTK_TABLE( table ), entry, 2, 3, 1, 2, (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), (GtkAttachOptions) ( GTK_FILL ), 0, 0 ); - gtk_widget_set_usize( entry, 60, -2 ); + gtk_entry_set_alignment( GTK_ENTRY( entry ), 1.0 ); //right + gtk_widget_show( entry ); g_object_set_data( G_OBJECT( dlg ), "texscalex", entry ); entry = gtk_entry_new(); - gtk_widget_show( entry ); gtk_table_attach( GTK_TABLE( table ), entry, 3, 4, 1, 2, (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), (GtkAttachOptions) ( GTK_FILL ), 0, 0 ); - gtk_widget_set_usize( entry, 60, -2 ); + gtk_entry_set_alignment( GTK_ENTRY( entry ), 1.0 ); //right + gtk_widget_show( entry ); g_object_set_data( G_OBJECT( dlg ), "texscaley", entry ); + size_group = gtk_size_group_new( GTK_SIZE_GROUP_BOTH ); + gtk_size_group_add_widget( size_group, offset_label ); + gtk_size_group_add_widget( size_group, scale_label ); + g_object_unref( size_group ); + check = gtk_check_button_new_with_label( _( "Use detail brushes" ) ); - gtk_widget_show( check ); gtk_box_pack_start( GTK_BOX( vbox ), check, FALSE, TRUE, 0 ); + gtk_widget_show( check ); g_object_set_data( G_OBJECT( dlg ), "detail", check ); g_signal_connect( G_OBJECT( check ), "toggled", G_CALLBACK( texture_detail ), NULL ); check = gtk_check_button_new_with_label( _( "Detail hint brushes" ) ); - gtk_widget_show( check ); gtk_box_pack_start( GTK_BOX( vbox ), check, FALSE, TRUE, 0 ); + gtk_widget_show( check ); g_object_set_data( G_OBJECT( dlg ), "hint", check ); g_signal_connect( G_OBJECT( check ), "toggled", G_CALLBACK( texture_hint ), NULL ); // ^Fishman - Add terrain key to func_group. check = gtk_check_button_new_with_label( _( "Add terrain key" ) ); - gtk_widget_show( check ); gtk_box_pack_start( GTK_BOX( vbox ), check, FALSE, TRUE, 0 ); + gtk_widget_show( check ); g_object_set_data( G_OBJECT( dlg ), "terrain_ent", check ); g_signal_connect( G_OBJECT( check ), "toggled", G_CALLBACK( texture_terrainent ), NULL ); vbox = gtk_vbox_new( FALSE, 5 ); - gtk_widget_show( vbox ); gtk_box_pack_start( GTK_BOX( hbox ), vbox, FALSE, TRUE, 0 ); + gtk_widget_show( vbox ); button = gtk_button_new_with_label( _( "OK" ) ); - gtk_widget_show( button ); gtk_box_pack_start( GTK_BOX( vbox ), button, FALSE, TRUE, 0 ); - gtk_widget_set_usize( button, 60, -2 ); + gtk_widget_show( button ); g_object_set_data( G_OBJECT( dlg ), "go", button ); g_signal_connect( G_OBJECT( button ), "clicked", G_CALLBACK( main_go ), NULL ); label = gtk_label_new( _( "Settings:" ) ); - gtk_widget_show( label ); gtk_box_pack_start( GTK_BOX( vbox ), label, FALSE, TRUE, 0 ); + gtk_widget_show( label ); button = gtk_button_new_with_label( _( "Open..." ) ); - gtk_widget_show( button ); gtk_box_pack_start( GTK_BOX( vbox ), button, FALSE, TRUE, 0 ); + gtk_widget_show( button ); g_object_set_data( G_OBJECT( dlg ), "open", button ); g_signal_connect( G_OBJECT( button ), "clicked", G_CALLBACK( main_open ), NULL ); button = gtk_button_new_with_label( _( "Save as..." ) ); - gtk_widget_show( button ); gtk_box_pack_start( GTK_BOX( vbox ), button, FALSE, TRUE, 0 ); + gtk_widget_show( button ); g_object_set_data( G_OBJECT( dlg ), "save", button ); g_signal_connect( G_OBJECT( button ), "clicked", G_CALLBACK( main_save ), NULL ); button = gtk_button_new_with_label( _( "Defaults" ) ); - gtk_widget_show( button ); gtk_box_pack_start( GTK_BOX( vbox ), button, FALSE, TRUE, 0 ); + gtk_widget_show( button ); g_object_set_data( G_OBJECT( dlg ), "defaults", button ); g_signal_connect( G_OBJECT( button ), "clicked", G_CALLBACK( main_defaults ), NULL ); button = gtk_button_new_with_label( _( "About..." ) ); - gtk_widget_show( button ); gtk_box_pack_start( GTK_BOX( vbox ), button, FALSE, TRUE, 0 ); + gtk_widget_show( button ); g_signal_connect( G_OBJECT( button ), "clicked", G_CALLBACK( main_about ), NULL ); + check = gtk_check_button_new_with_label( _( "Preview" ) ); - gtk_widget_show( check ); gtk_box_pack_start( GTK_BOX( vbox ), check, FALSE, TRUE, 0 ); + gtk_widget_show( check ); g_signal_connect( G_OBJECT( check ), "toggled", G_CALLBACK( main_preview ), NULL ); g_object_set_data( G_OBJECT( dlg ), "main_preview", check ); // ^Fishman - Antializing for the preview window. check = gtk_check_button_new_with_label( _( "Antialised lines" ) ); - gtk_widget_show( check ); gtk_box_pack_start( GTK_BOX( vbox ), check, FALSE, TRUE, 0 ); + gtk_widget_show( check ); g_object_set_data( G_OBJECT( dlg ), "main_antialiasing", check ); g_signal_connect( G_OBJECT( check ), "toggled", G_CALLBACK( main_antialiasing ), NULL ); diff --git a/contrib/gtkgensurf/view.cpp b/contrib/gtkgensurf/view.cpp index ab24dcbd..9eaaba00 100644 --- a/contrib/gtkgensurf/view.cpp +++ b/contrib/gtkgensurf/view.cpp @@ -364,7 +364,7 @@ static void preview_spin( GtkAdjustment *adj, double *data ){ void CreateViewWindow(){ GtkWidget *dlg, *vbox, *hbox, *label, *spin, *frame; - GtkObject *adj; + GtkAdjustment *adj; #ifndef ISOMETRIC elevation = PI / 6.; @@ -379,45 +379,51 @@ void CreateViewWindow(){ gtk_window_set_default_size( GTK_WINDOW( dlg ), 300, 400 ); vbox = gtk_vbox_new( FALSE, 5 ); - gtk_widget_show( vbox ); gtk_container_add( GTK_CONTAINER( dlg ), vbox ); + gtk_widget_show( vbox ); #ifndef ISOMETRIC hbox = gtk_hbox_new( TRUE, 5 ); - gtk_widget_show( hbox ); gtk_box_pack_start( GTK_BOX( vbox ), hbox, FALSE, TRUE, 0 ); gtk_container_set_border_width( GTK_CONTAINER( hbox ), 3 ); + gtk_widget_show( hbox ); label = gtk_label_new( _( "Elevation" ) ); - gtk_widget_show( label ); + g_object_set( label, "xalign", 1.0, NULL ); gtk_misc_set_alignment( GTK_MISC( label ), 1, 0.5 ); gtk_box_pack_start( GTK_BOX( hbox ), label, FALSE, TRUE, 0 ); + gtk_widget_show( label ); - adj = gtk_adjustment_new( 30, -90, 90, 1, 10, 0 ); + adj = GTK_ADJUSTMENT( gtk_adjustment_new( 30, -90, 90, 1, 10, 0 ) ); g_signal_connect( adj, "value-changed", G_CALLBACK( preview_spin ), &elevation ); spin = gtk_spin_button_new( GTK_ADJUSTMENT( adj ), 1, 0 ); - gtk_widget_show( spin ); + gtk_entry_set_alignment( GTK_ENTRY( spin ), 1.0 ); //right + gtk_spin_button_set_numeric( GTK_SPIN_BUTTON( spin ), TRUE ); gtk_box_pack_start( GTK_BOX( hbox ), spin, FALSE, TRUE, 0 ); + gtk_widget_show( spin ); g_signal_connect( G_OBJECT( spin ), "focus-out-event", G_CALLBACK( doublevariable_spinfocusout ), &elevation ); - adj = gtk_adjustment_new( 30, 0, 359, 1, 10, 0 ); + adj = GTK_ADJUSTMENT( gtk_adjustment_new( 30, 0, 359, 1, 10, 0 ) ); g_signal_connect( adj, "value-changed", G_CALLBACK( preview_spin ), &azimuth ); spin = gtk_spin_button_new( GTK_ADJUSTMENT( adj ), 1, 0 ); - gtk_widget_show( spin ); + gtk_entry_set_alignment( GTK_ENTRY( spin ), 1.0 ); //right gtk_spin_button_set_wrap( GTK_SPIN_BUTTON( spin ), TRUE ); + gtk_spin_button_set_numeric( GTK_SPIN_BUTTON( spin ), TRUE ); gtk_box_pack_end( GTK_BOX( hbox ), spin, FALSE, TRUE, 0 ); + gtk_widget_show( spin ); label = gtk_label_new( _( "Azimuth" ) ); - gtk_widget_show( label ); gtk_misc_set_alignment( GTK_MISC( label ), 1, 0.5 ); gtk_box_pack_end( GTK_BOX( hbox ), label, FALSE, TRUE, 0 ); + gtk_widget_show( label ); g_signal_connect( G_OBJECT( spin ), "focus-out-event", G_CALLBACK( doublevariable_spinfocusout ), &azimuth ); + #endif frame = gtk_frame_new( NULL ); - gtk_widget_show( frame ); gtk_frame_set_shadow_type( GTK_FRAME( frame ), GTK_SHADOW_IN ); gtk_box_pack_start( GTK_BOX( vbox ), frame, TRUE, TRUE, 0 ); + gtk_widget_show( frame ); g_pPreviewWidget = g_UIGtkTable.m_pfn_glwidget_new( FALSE, NULL ); @@ -427,8 +433,8 @@ void CreateViewWindow(){ g_signal_connect( G_OBJECT( g_pPreviewWidget ), "button-press-event", G_CALLBACK( button_press ), NULL ); - gtk_widget_show( g_pPreviewWidget ); gtk_container_add( GTK_CONTAINER( frame ), g_pPreviewWidget ); + gtk_widget_show( g_pPreviewWidget ); if ( Preview ) { gtk_widget_show( g_pWndPreview ); diff --git a/contrib/prtview/AboutDialog.cpp b/contrib/prtview/AboutDialog.cpp index 7a924fc4..0005ef10 100644 --- a/contrib/prtview/AboutDialog.cpp +++ b/contrib/prtview/AboutDialog.cpp @@ -31,45 +31,20 @@ ///////////////////////////////////////////////////////////////////////////// // CAboutDialog dialog -static void dialog_button_callback( GtkWidget *widget, gpointer data ){ - GtkWidget *parent; - int *loop, *ret; +void DoAboutDlg( GtkWidget *parent ){ + GtkWidget *dialog, *vbox, *label, *content_area; + GtkDialogFlags flags = GTK_DIALOG_DESTROY_WITH_PARENT; - parent = gtk_widget_get_toplevel( widget ); - loop = (int*)g_object_get_data( G_OBJECT( parent ), "loop" ); - ret = (int*)g_object_get_data( G_OBJECT( parent ), "ret" ); + dialog = gtk_dialog_new_with_buttons( _( "About Portal Viewer" ), NULL, flags, NULL ); + gtk_dialog_add_button( GTK_DIALOG( dialog ), _( "OK" ), GTK_RESPONSE_OK ); - *loop = 0; - *ret = (int)((intptr_t)data); -} + content_area = gtk_dialog_get_content_area( GTK_DIALOG( dialog ) ); + gtk_window_set_transient_for( GTK_WINDOW( dialog ), GTK_WINDOW( parent) ); -static gint dialog_delete_callback( GtkWidget *widget, GdkEvent* event, gpointer data ){ - int *loop; - - gtk_widget_hide( widget ); - loop = (int*)g_object_get_data( G_OBJECT( widget ), "loop" ); - *loop = 0; - - return TRUE; -} - -void DoAboutDlg(){ - GtkWidget *dlg, *hbox, *vbox, *button, *label; - int loop = 1, ret = IDCANCEL; - - dlg = gtk_window_new( GTK_WINDOW_TOPLEVEL ); - gtk_window_set_title( GTK_WINDOW( dlg ), _( "About Portal Viewer" ) ); - g_signal_connect( G_OBJECT( dlg ), "delete-event", - G_CALLBACK( dialog_delete_callback ), NULL ); - g_signal_connect( G_OBJECT( dlg ), "destroy", - G_CALLBACK( gtk_widget_destroy ), NULL ); - g_object_set_data( G_OBJECT( dlg ), "loop", &loop ); - g_object_set_data( G_OBJECT( dlg ), "ret", &ret ); - - hbox = gtk_hbox_new( FALSE, 10 ); - gtk_widget_show( hbox ); - gtk_container_add( GTK_CONTAINER( dlg ), hbox ); - gtk_container_set_border_width( GTK_CONTAINER( hbox ), 10 ); + vbox = gtk_vbox_new( TRUE, 5 ); + gtk_container_add( GTK_CONTAINER( content_area ), vbox ); + gtk_container_set_border_width( GTK_CONTAINER( vbox ), 5 ); + gtk_widget_show( vbox ); label = gtk_label_new( "Version 1.000\n\n" "Gtk port by Leonardo Zide\nleo@lokigames.com\n\n" @@ -77,29 +52,14 @@ void DoAboutDlg(){ "Built against GtkRadiant " RADIANT_VERSION "\n" __DATE__ ); - gtk_widget_show( label ); - gtk_box_pack_start( GTK_BOX( hbox ), label, TRUE, TRUE, 0 ); + gtk_box_pack_start( GTK_BOX( vbox ), label, TRUE, TRUE, 0 ); gtk_label_set_justify( GTK_LABEL( label ), GTK_JUSTIFY_LEFT ); + gtk_widget_show( label ); - vbox = gtk_vbox_new( FALSE, 0 ); - gtk_widget_show( vbox ); - gtk_box_pack_start( GTK_BOX( hbox ), vbox, FALSE, FALSE, 0 ); - button = gtk_button_new_with_label( _( "OK" ) ); - gtk_widget_show( button ); - gtk_box_pack_start( GTK_BOX( vbox ), button, FALSE, FALSE, 0 ); - g_signal_connect( G_OBJECT( button ), "clicked", - G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( IDOK ) ); - gtk_widget_set_usize( button, 60, -2 ); + gtk_dialog_run( GTK_DIALOG( dialog ) ); - gtk_grab_add( dlg ); - gtk_widget_show( dlg ); - - while ( loop ) - gtk_main_iteration(); - - gtk_grab_remove( dlg ); - gtk_widget_destroy( dlg ); + gtk_widget_destroy( dialog ); } ///////////////////////////////////////////////////////////////////////////// diff --git a/contrib/prtview/ConfigDialog.cpp b/contrib/prtview/ConfigDialog.cpp index 20769631..3b2399b4 100644 --- a/contrib/prtview/ConfigDialog.cpp +++ b/contrib/prtview/ConfigDialog.cpp @@ -238,7 +238,7 @@ static void OnFog( GtkWidget *widget, gpointer data ){ } static void OnSelchangeZbuffer( GtkWidget *widget, gpointer data ){ - portals.zbuffer = GPOINTER_TO_INT( data ); + portals.zbuffer = gtk_combo_box_get_active( GTK_COMBO_BOX( GTK_COMBO_BOX_TEXT( widget ) ) ); if ( interfaces_started ) { g_FuncTable.m_pfnSysUpdateWindows( UPDATE_3D ); @@ -269,163 +269,155 @@ static void OnClip( GtkWidget *widget, gpointer data ){ } } -void DoConfigDialog(){ - GtkWidget *dlg, *hbox, *vbox, *vbox2, *button, *table, *frame; - GtkWidget *lw3slider, *lw3label, *lw2slider, *lw2label, *zlist, *menu, *item; +void DoConfigDialog( GtkWidget *parent ){ + GtkWidget *dialog, *hbox, *vbox, *vbox2, *button, *table, *frame; + GtkWidget *lw3slider, *lw3label, *lw2slider, *lw2label, *zlist; GtkWidget *aa2check, *aa3check, *depthcheck, *linescheck, *polyscheck; GtkWidget *transslider, *translabel, *clipslider, *cliplabel; GtkWidget *show2check, *show3check, *portalcheck; - int loop = 1, ret = IDCANCEL; - GtkObject *adj; + GtkWidget *content_area, *color_button, *depth_button; + GtkSizeGroup *button_group; + GList *combo_list; + GList *lst; + GtkAdjustment *adj; + GtkDialogFlags flags = GTK_DIALOG_DESTROY_WITH_PARENT; - dlg = gtk_window_new( GTK_WINDOW_TOPLEVEL ); - gtk_window_set_title( GTK_WINDOW( dlg ), _( "Portal Viewer Configuration" ) ); - g_signal_connect( G_OBJECT( dlg ), "delete-event", - G_CALLBACK( dialog_delete_callback ), NULL ); - g_signal_connect( G_OBJECT( dlg ), "destroy", - G_CALLBACK( gtk_widget_destroy ), NULL ); - g_object_set_data( G_OBJECT( dlg ), "loop", &loop ); - g_object_set_data( G_OBJECT( dlg ), "ret", &ret ); + dialog = gtk_dialog_new_with_buttons( _( "Portal Viewer Configuration" ), NULL, flags, NULL ); + gtk_window_set_transient_for( GTK_WINDOW( dialog ), GTK_WINDOW( parent ) ); + gtk_dialog_add_button( GTK_DIALOG( dialog ), _( "OK" ), GTK_RESPONSE_OK ); + + content_area = gtk_dialog_get_content_area( GTK_DIALOG( dialog ) ); vbox = gtk_vbox_new( FALSE, 5 ); - gtk_widget_show( vbox ); - gtk_container_add( GTK_CONTAINER( dlg ), vbox ); + gtk_container_add( GTK_CONTAINER( content_area ), vbox ); gtk_container_set_border_width( GTK_CONTAINER( vbox ), 5 ); + gtk_widget_show( vbox ); frame = gtk_frame_new( _( "3D View" ) ); - gtk_widget_show( frame ); gtk_box_pack_start( GTK_BOX( vbox ), frame, TRUE, TRUE, 0 ); + gtk_widget_show( frame ); vbox2 = gtk_vbox_new( FALSE, 5 ); - gtk_widget_show( vbox2 ); gtk_container_add( GTK_CONTAINER( frame ), vbox2 ); gtk_container_set_border_width( GTK_CONTAINER( vbox2 ), 5 ); + gtk_widget_show( vbox2 ); hbox = gtk_hbox_new( FALSE, 5 ); - gtk_widget_show( hbox ); gtk_box_pack_start( GTK_BOX( vbox2 ), hbox, TRUE, TRUE, 0 ); + gtk_widget_show( hbox ); - adj = gtk_adjustment_new( portals.width_3d, 2, 40, 1, 1, 1 ); + adj = GTK_ADJUSTMENT( gtk_adjustment_new( portals.width_3d, 2, 40, 1, 1, 1 ) ); lw3slider = gtk_hscale_new( GTK_ADJUSTMENT( adj ) ); - gtk_widget_show( lw3slider ); gtk_box_pack_start( GTK_BOX( hbox ), lw3slider, TRUE, TRUE, 0 ); gtk_scale_set_draw_value( GTK_SCALE( lw3slider ), FALSE ); + gtk_widget_show( lw3slider ); lw3label = gtk_label_new( "" ); - gtk_widget_show( lw3label ); gtk_box_pack_start( GTK_BOX( hbox ), lw3label, FALSE, TRUE, 0 ); + gtk_widget_show( lw3label ); g_signal_connect( adj, "value-changed", G_CALLBACK( OnScroll3d ), lw3label ); table = gtk_table_new( 2, 4, FALSE ); - gtk_widget_show( table ); gtk_box_pack_start( GTK_BOX( vbox2 ), table, TRUE, TRUE, 0 ); gtk_table_set_row_spacings( GTK_TABLE( table ), 5 ); gtk_table_set_col_spacings( GTK_TABLE( table ), 5 ); + gtk_widget_show( table ); - button = gtk_button_new_with_label( _( "Color" ) ); - gtk_widget_show( button ); + color_button = button = gtk_button_new_with_label( _( "Color" ) ); gtk_table_attach( GTK_TABLE( table ), button, 0, 1, 0, 1, (GtkAttachOptions) ( GTK_FILL ), (GtkAttachOptions) ( 0 ), 0, 0 ); + gtk_widget_show( button ); g_signal_connect( G_OBJECT( button ), "clicked", G_CALLBACK( OnColor3d ), NULL ); - button = gtk_button_new_with_label( _( "Depth Color" ) ); - gtk_widget_show( button ); + depth_button = button = gtk_button_new_with_label( _( "Depth Color" ) ); gtk_table_attach( GTK_TABLE( table ), button, 0, 1, 1, 2, (GtkAttachOptions) ( GTK_FILL ), (GtkAttachOptions) ( 0 ), 0, 0 ); + gtk_widget_show( button ); g_signal_connect( G_OBJECT( button ), "clicked", G_CALLBACK( OnColorFog ), NULL ); aa3check = gtk_check_button_new_with_label( _( "Anti-Alias (May not work on some video cards)" ) ); - gtk_widget_show( aa3check ); gtk_table_attach( GTK_TABLE( table ), aa3check, 1, 4, 0, 1, (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), (GtkAttachOptions) ( 0 ), 0, 0 ); + gtk_widget_show( aa3check ); g_signal_connect( G_OBJECT( aa3check ), "toggled", G_CALLBACK( OnAntiAlias3d ), NULL ); depthcheck = gtk_check_button_new_with_label( _( "Depth Cue" ) ); - gtk_widget_show( depthcheck ); gtk_table_attach( GTK_TABLE( table ), depthcheck, 1, 2, 1, 2, (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), (GtkAttachOptions) ( 0 ), 0, 0 ); + gtk_widget_show( depthcheck ); g_signal_connect( G_OBJECT( depthcheck ), "toggled", G_CALLBACK( OnFog ), NULL ); linescheck = gtk_check_button_new_with_label( _( "Lines" ) ); - gtk_widget_show( linescheck ); gtk_table_attach( GTK_TABLE( table ), linescheck, 2, 3, 1, 2, (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), (GtkAttachOptions) ( 0 ), 0, 0 ); + gtk_widget_show( linescheck ); g_signal_connect( G_OBJECT( linescheck ), "toggled", G_CALLBACK( OnLines ), NULL ); polyscheck = gtk_check_button_new_with_label( _( "Polygons" ) ); - gtk_widget_show( polyscheck ); gtk_table_attach( GTK_TABLE( table ), polyscheck, 3, 4, 1, 2, (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), (GtkAttachOptions) ( 0 ), 0, 0 ); + gtk_widget_show( polyscheck ); g_signal_connect( G_OBJECT( polyscheck ), "toggled", G_CALLBACK( OnPoly ), NULL ); - zlist = gtk_option_menu_new(); - gtk_widget_show( zlist ); + combo_list = NULL; + combo_list = g_list_append( combo_list, (void *)_( "Z-Buffer Test and Write (recommended for solid or no polygons)" ) ); + combo_list = g_list_append( combo_list, (void *)_( "Z-Buffer Test Only (recommended for transparent polygons)" ) ); + combo_list = g_list_append( combo_list, (void *)_( "Z-Buffer Off" ) ); + + zlist = gtk_combo_box_text_new(); + for ( lst = combo_list; lst != NULL; lst = g_list_next( lst ) ) + { + gtk_combo_box_text_append_text( GTK_COMBO_BOX_TEXT( zlist ), (const char *)lst->data ); + } + g_list_free( combo_list ); + combo_list = NULL; + gtk_box_pack_start( GTK_BOX( vbox2 ), zlist, TRUE, FALSE, 0 ); - - menu = gtk_menu_new(); - gtk_widget_show( menu ); - gtk_option_menu_set_menu( GTK_OPTION_MENU( zlist ), menu ); - - item = gtk_menu_item_new_with_label( _( "Z-Buffer Test and Write (recommended for solid or no polygons)" ) ); - gtk_widget_show( item ); - g_signal_connect( G_OBJECT( item ), "activate", - G_CALLBACK( OnSelchangeZbuffer ), GINT_TO_POINTER( 0 ) ); - gtk_menu_append( GTK_MENU( menu ), item ); - - item = gtk_menu_item_new_with_label( _( "Z-Buffer Test Only (recommended for transparent polygons)" ) ); - gtk_widget_show( item ); - g_signal_connect( G_OBJECT( item ), "activate", - G_CALLBACK( OnSelchangeZbuffer ), GINT_TO_POINTER( 1 ) ); - gtk_menu_append( GTK_MENU( menu ), item ); - - item = gtk_menu_item_new_with_label( _( "Z-Buffer Off" ) ); - gtk_widget_show( item ); - g_signal_connect( G_OBJECT( item ), "activate", - G_CALLBACK( OnSelchangeZbuffer ), GINT_TO_POINTER( 2 ) ); - gtk_menu_append( GTK_MENU( menu ), item ); + gtk_widget_show( zlist ); + g_signal_connect( zlist, "changed", G_CALLBACK( OnSelchangeZbuffer ), NULL ); table = gtk_table_new( 2, 2, FALSE ); - gtk_widget_show( table ); gtk_box_pack_start( GTK_BOX( vbox2 ), table, TRUE, TRUE, 0 ); gtk_table_set_row_spacings( GTK_TABLE( table ), 5 ); gtk_table_set_col_spacings( GTK_TABLE( table ), 5 ); + gtk_widget_show( table ); - adj = gtk_adjustment_new( portals.trans_3d, 0, 100, 1, 1, 1 ); + adj = GTK_ADJUSTMENT( gtk_adjustment_new( portals.trans_3d, 0, 100, 1, 1, 1 ) ); transslider = gtk_hscale_new( GTK_ADJUSTMENT( adj ) ); - gtk_widget_show( transslider ); gtk_table_attach( GTK_TABLE( table ), transslider, 0, 1, 0, 1, (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), (GtkAttachOptions) ( 0 ), 0, 0 ); gtk_scale_set_draw_value( GTK_SCALE( transslider ), FALSE ); + gtk_widget_show( transslider ); translabel = gtk_label_new( "" ); - gtk_widget_show( translabel ); gtk_table_attach( GTK_TABLE( table ), translabel, 1, 2, 0, 1, (GtkAttachOptions) ( GTK_FILL ), (GtkAttachOptions) ( 0 ), 0, 0 ); gtk_misc_set_alignment( GTK_MISC( translabel ), 0.0, 0.0 ); + gtk_widget_show( translabel ); g_signal_connect( adj, "value-changed", G_CALLBACK( OnScrollTrans ), translabel ); - adj = gtk_adjustment_new( portals.clip_range, 1, 128, 1, 1, 1 ); + adj = GTK_ADJUSTMENT( gtk_adjustment_new( portals.clip_range, 1, 128, 1, 1, 1 ) ); clipslider = gtk_hscale_new( GTK_ADJUSTMENT( adj ) ); - gtk_widget_show( clipslider ); gtk_table_attach( GTK_TABLE( table ), clipslider, 0, 1, 1, 2, (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), (GtkAttachOptions) ( 0 ), 0, 0 ); gtk_scale_set_draw_value( GTK_SCALE( clipslider ), FALSE ); + gtk_widget_show( clipslider ); cliplabel = gtk_label_new( "" ); - gtk_widget_show( cliplabel ); gtk_table_attach( GTK_TABLE( table ), cliplabel, 1, 2, 1, 2, (GtkAttachOptions) ( GTK_FILL ), (GtkAttachOptions) ( 0 ), 0, 0 ); gtk_misc_set_alignment( GTK_MISC( cliplabel ), 0.0, 0.0 ); + gtk_widget_show( cliplabel ); g_signal_connect( adj, "value-changed", G_CALLBACK( OnScrollClip ), cliplabel ); hbox = gtk_hbox_new( TRUE, 5 ); @@ -455,7 +447,7 @@ void DoConfigDialog(){ gtk_widget_show( hbox ); gtk_box_pack_start( GTK_BOX( vbox2 ), hbox, TRUE, FALSE, 0 ); - adj = gtk_adjustment_new( portals.width_2d, 2, 40, 1, 1, 1 ); + adj = GTK_ADJUSTMENT( gtk_adjustment_new( portals.width_2d, 2, 40, 1, 1, 1 ) ); lw2slider = gtk_hscale_new( GTK_ADJUSTMENT( adj ) ); gtk_widget_show( lw2slider ); gtk_box_pack_start( GTK_BOX( hbox ), lw2slider, TRUE, TRUE, 0 ); @@ -467,40 +459,34 @@ void DoConfigDialog(){ g_signal_connect( adj, "value-changed", G_CALLBACK( OnScroll2d ), lw2label ); hbox = gtk_hbox_new( FALSE, 5 ); - gtk_widget_show( hbox ); gtk_box_pack_start( GTK_BOX( vbox2 ), hbox, TRUE, FALSE, 0 ); + gtk_widget_show( hbox ); button = gtk_button_new_with_label( _( "Color" ) ); - gtk_widget_show( button ); gtk_box_pack_start( GTK_BOX( hbox ), button, FALSE, FALSE, 0 ); + gtk_widget_show( button ); g_signal_connect( G_OBJECT( button ), "clicked", G_CALLBACK( OnColor2d ), NULL ); - gtk_widget_set_usize( button, 60, -2 ); + + button_group = gtk_size_group_new( GTK_SIZE_GROUP_BOTH ); + gtk_size_group_add_widget( button_group, color_button ); + gtk_size_group_add_widget( button_group, depth_button ); + gtk_size_group_add_widget( button_group, button ); + g_object_unref( button_group ); aa2check = gtk_check_button_new_with_label( _( "Anti-Alias (May not work on some video cards)" ) ); - gtk_widget_show( aa2check ); gtk_box_pack_start( GTK_BOX( hbox ), aa2check, TRUE, TRUE, 0 ); + gtk_widget_show( aa2check ); g_signal_connect( G_OBJECT( aa2check ), "toggled", G_CALLBACK( OnAntiAlias2d ), NULL ); hbox = gtk_hbox_new( FALSE, 5 ); - gtk_widget_show( hbox ); gtk_box_pack_start( GTK_BOX( vbox2 ), hbox, TRUE, FALSE, 0 ); + gtk_widget_show( hbox ); show2check = gtk_check_button_new_with_label( _( "Show" ) ); - gtk_widget_show( show2check ); gtk_box_pack_start( GTK_BOX( hbox ), show2check, FALSE, FALSE, 0 ); + gtk_widget_show( show2check ); g_signal_connect( G_OBJECT( show2check ), "toggled", G_CALLBACK( OnConfig2d ), NULL ); - hbox = gtk_hbox_new( FALSE, 5 ); - gtk_widget_show( hbox ); - gtk_box_pack_start( GTK_BOX( vbox ), hbox, FALSE, FALSE, 0 ); - - button = gtk_button_new_with_label( _( "OK" ) ); - gtk_widget_show( button ); - gtk_box_pack_end( GTK_BOX( hbox ), button, FALSE, FALSE, 0 ); - g_signal_connect( G_OBJECT( button ), "clicked", - G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( IDOK ) ); - gtk_widget_set_usize( button, 60, -2 ); - // initialize dialog gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( show2check ), portals.show_2d ); gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( aa2check ), portals.aa_2d ); @@ -511,19 +497,15 @@ void DoConfigDialog(){ gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( polyscheck ), portals.polygons ); gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( linescheck ), portals.lines ); gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( aa3check ), portals.aa_3d ); - gtk_option_menu_set_history( GTK_OPTION_MENU( zlist ), portals.zbuffer ); + gtk_combo_box_set_active( GTK_COMBO_BOX( GTK_COMBO_BOX_TEXT( zlist ) ), portals.zbuffer ); gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( portalcheck ), portals.clip ); Set3DText( lw3label ); Set3DTransText( translabel ); SetClipText( cliplabel ); - gtk_grab_add( dlg ); - gtk_widget_show( dlg ); - while ( loop ) - gtk_main_iteration(); + gtk_dialog_run( GTK_DIALOG( dialog ) ); - gtk_grab_remove( dlg ); - gtk_widget_destroy( dlg ); + gtk_widget_destroy( dialog ); } diff --git a/contrib/prtview/LoadPortalFileDialog.cpp b/contrib/prtview/LoadPortalFileDialog.cpp index 9be5fc57..bbda6cf9 100644 --- a/contrib/prtview/LoadPortalFileDialog.cpp +++ b/contrib/prtview/LoadPortalFileDialog.cpp @@ -28,135 +28,87 @@ //static char THIS_FILE[] = __FILE__; #endif -static void dialog_button_callback( GtkWidget *widget, gpointer data ){ - GtkWidget *parent; - int *loop, *ret; - parent = gtk_widget_get_toplevel( widget ); - loop = (int*)g_object_get_data( G_OBJECT( parent ), "loop" ); - ret = (int*)g_object_get_data( G_OBJECT( parent ), "ret" ); - *loop = 0; - *ret = (intptr_t)data; -} - -static gint dialog_delete_callback( GtkWidget *widget, GdkEvent* event, gpointer data ){ - int *loop; - - gtk_widget_hide( widget ); - loop = (int*)g_object_get_data( G_OBJECT( widget ), "loop" ); - *loop = 0; - - return TRUE; -} - -static void file_sel_callback( GtkWidget *widget, gpointer data ){ - GtkWidget *parent; - int *loop; - char **filename; - - parent = gtk_widget_get_toplevel( widget ); - loop = (int*)g_object_get_data( G_OBJECT( parent ), "loop" ); - filename = (char**)g_object_get_data( G_OBJECT( parent ), "filename" ); - - *loop = 0; - if ( (intptr_t)data == IDOK ) { - *filename = g_strdup( gtk_file_selection_get_filename( GTK_FILE_SELECTION( parent ) ) ); - } -} static void change_clicked( GtkWidget *widget, gpointer data ){ - GtkWidget* file_sel; - char* filename = NULL; - int loop = 1; + GtkWidget *file_sel, *parent; + gint response_id; + GtkFileChooserAction action = GTK_FILE_CHOOSER_ACTION_OPEN; - file_sel = gtk_file_selection_new( _( "Locate portal (.prt) file" ) ); - g_signal_connect( G_OBJECT( GTK_FILE_SELECTION( file_sel )->ok_button ), "clicked", - G_CALLBACK( file_sel_callback ), GINT_TO_POINTER( IDOK ) ); - g_signal_connect( G_OBJECT( GTK_FILE_SELECTION( file_sel )->cancel_button ), "clicked", - G_CALLBACK( file_sel_callback ), GINT_TO_POINTER( IDCANCEL ) ); - g_signal_connect( G_OBJECT( file_sel ), "delete-event", - G_CALLBACK( dialog_delete_callback ), NULL ); - gtk_file_selection_hide_fileop_buttons( GTK_FILE_SELECTION( file_sel ) ); + parent = GTK_WIDGET( data ); + file_sel = gtk_file_chooser_dialog_new( _( "Locate portal (.prt) file" ), NULL, action, NULL, NULL ); + gtk_window_set_transient_for( GTK_WINDOW( file_sel ), GTK_WINDOW( parent ) ); + gtk_dialog_add_button( GTK_DIALOG( file_sel ), _( "_Open" ), GTK_RESPONSE_ACCEPT ); + gtk_dialog_add_button( GTK_DIALOG( file_sel ), _( "_Cancel" ), GTK_RESPONSE_CANCEL ); - g_object_set_data( G_OBJECT( file_sel ), "loop", &loop ); - g_object_set_data( G_OBJECT( file_sel ), "filename", &filename ); - gtk_file_selection_set_filename( GTK_FILE_SELECTION( file_sel ), portals.fn ); + response_id = gtk_dialog_run( GTK_DIALOG( file_sel ) ); + if( response_id == GTK_RESPONSE_ACCEPT ) + { + gchar *filename; + GtkFileChooser *chooser; - gtk_grab_add( file_sel ); - gtk_widget_show( file_sel ); + chooser = GTK_FILE_CHOOSER( file_sel ); + filename = gtk_file_chooser_get_filename( chooser ); - while ( loop ) - gtk_main_iteration(); - - gtk_grab_remove( file_sel ); - gtk_widget_destroy( file_sel ); - - if ( filename != NULL ) { - strcpy( portals.fn, filename ); - gtk_entry_set_text( GTK_ENTRY( data ), filename ); - g_free( filename ); + if ( filename != NULL ) { + strcpy( portals.fn, filename ); + gtk_entry_set_text( GTK_ENTRY( data ), filename ); + g_free( filename ); + } } + + gtk_widget_destroy( file_sel ); } -int DoLoadPortalFileDialog(){ - GtkWidget *dlg, *vbox, *hbox, *button, *entry, *check2d, *check3d; - int loop = 1, ret = IDCANCEL; +int DoLoadPortalFileDialog( GtkWidget *parent ){ + GtkWidget *dialog, *vbox, *hbox, *button, *entry, *check2d, *check3d; + GtkWidget *content_area, *ok_button, *cancel_button, *change_button; + gint response_id; + int ret; + GtkSizeGroup *size_group; + GtkDialogFlags flags = GTK_DIALOG_DESTROY_WITH_PARENT; - dlg = gtk_window_new( GTK_WINDOW_TOPLEVEL ); - gtk_window_set_title( GTK_WINDOW( dlg ), _( "Load .prt" ) ); - g_signal_connect( G_OBJECT( dlg ), "delete-event", - G_CALLBACK( dialog_delete_callback ), NULL ); - g_signal_connect( G_OBJECT( dlg ), "destroy", - G_CALLBACK( gtk_widget_destroy ), NULL ); - g_object_set_data( G_OBJECT( dlg ), "loop", &loop ); - g_object_set_data( G_OBJECT( dlg ), "ret", &ret ); + dialog = gtk_dialog_new_with_buttons( _( "Load .prt" ), NULL, flags, NULL ); + gtk_window_set_transient_for( GTK_WINDOW( dialog ), GTK_WINDOW( parent ) ); + + ok_button = gtk_dialog_add_button( GTK_DIALOG( dialog ), _( "OK" ), GTK_RESPONSE_OK ); + cancel_button = gtk_dialog_add_button( GTK_DIALOG( dialog ), _( "Cancel" ), GTK_RESPONSE_CANCEL ); + + content_area = gtk_dialog_get_content_area( GTK_DIALOG( dialog ) ); vbox = gtk_vbox_new( FALSE, 5 ); - gtk_widget_show( vbox ); - gtk_container_add( GTK_CONTAINER( dlg ), vbox ); + gtk_container_add( GTK_CONTAINER( content_area ), vbox ); gtk_container_set_border_width( GTK_CONTAINER( vbox ), 5 ); + gtk_widget_show( vbox ); entry = gtk_entry_new(); - gtk_widget_show( entry ); - gtk_entry_set_editable( GTK_ENTRY( entry ), FALSE ); + gtk_editable_set_editable( GTK_EDITABLE( entry ), FALSE ); gtk_box_pack_start( GTK_BOX( vbox ), entry, FALSE, FALSE, 0 ); + gtk_widget_show( entry ); hbox = gtk_hbox_new( FALSE, 5 ); - gtk_widget_show( hbox ); gtk_box_pack_start( GTK_BOX( vbox ), hbox, FALSE, FALSE, 0 ); + gtk_widget_show( hbox ); check3d = gtk_check_button_new_with_label( _( "Show 3D" ) ); - gtk_widget_show( check3d ); gtk_box_pack_start( GTK_BOX( hbox ), check3d, FALSE, FALSE, 0 ); + gtk_widget_show( check3d ); check2d = gtk_check_button_new_with_label( _( "Show 2D" ) ); - gtk_widget_show( check2d ); gtk_box_pack_start( GTK_BOX( hbox ), check2d, FALSE, FALSE, 0 ); + gtk_widget_show( check2d ); - button = gtk_button_new_with_label( _( "Change" ) ); - gtk_widget_show( button ); + change_button = button = gtk_button_new_with_label( _( "Change" ) ); gtk_box_pack_end( GTK_BOX( hbox ), button, FALSE, FALSE, 0 ); - g_signal_connect( G_OBJECT( button ), "clicked", G_CALLBACK( change_clicked ), entry ); - gtk_widget_set_usize( button, 60, -2 ); - - hbox = gtk_hbox_new( FALSE, 5 ); - gtk_widget_show( hbox ); - gtk_box_pack_start( GTK_BOX( vbox ), hbox, FALSE, FALSE, 0 ); - - button = gtk_button_new_with_label( _( "Cancel" ) ); + g_signal_connect( G_OBJECT( button ), "clicked", G_CALLBACK( change_clicked ), parent ); gtk_widget_show( button ); - gtk_box_pack_end( GTK_BOX( hbox ), button, FALSE, FALSE, 0 ); - g_signal_connect( G_OBJECT( button ), "clicked", - G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( IDCANCEL ) ); - gtk_widget_set_usize( button, 60, -2 ); - button = gtk_button_new_with_label( _( "OK" ) ); - gtk_widget_show( button ); - gtk_box_pack_end( GTK_BOX( hbox ), button, FALSE, FALSE, 0 ); - g_signal_connect( G_OBJECT( button ), "clicked", - G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( IDOK ) ); - gtk_widget_set_usize( button, 60, -2 ); + size_group = gtk_size_group_new( GTK_SIZE_GROUP_BOTH ); + gtk_size_group_add_widget( size_group, ok_button ); + gtk_size_group_add_widget( size_group, cancel_button ); + gtk_size_group_add_widget( size_group, change_button ); + g_object_unref( size_group ); char *fn = g_FuncTable.m_pfnGetMapName(); strcpy( portals.fn, fn ); @@ -170,21 +122,22 @@ int DoLoadPortalFileDialog(){ gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( check2d ), portals.show_2d ); gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( check3d ), portals.show_3d ); - gtk_grab_add( dlg ); - gtk_widget_show( dlg ); - while ( loop ) - gtk_main_iteration(); + response_id = gtk_dialog_run( GTK_DIALOG( dialog ) ); + + if( response_id == GTK_RESPONSE_OK ) { - if ( ret == IDOK ) { portals.Purge(); portals.show_3d = gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( check3d ) ) ? true : false; portals.show_2d = gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( check2d ) ) ? true : false; + + ret = IDOK; + } else { + ret = IDCANCEL; } - gtk_grab_remove( dlg ); - gtk_widget_destroy( dlg ); + gtk_widget_destroy( dialog ); return ret; } diff --git a/contrib/prtview/gtkdlgs.cpp b/contrib/prtview/gtkdlgs.cpp index 62a00c22..9e79ee48 100644 --- a/contrib/prtview/gtkdlgs.cpp +++ b/contrib/prtview/gtkdlgs.cpp @@ -140,7 +140,7 @@ int DoLoadPortalFileDialog(){ gtk_widget_show( button ); gtk_box_pack_end( GTK_BOX( hbox ), button, FALSE, FALSE, 0 ); g_signal_connect( G_OBJECT( button ), "clicked", G_CALLBACK( change_clicked ), entry ); - gtk_widget_set_usize( button, 60, -2 ); + gtk_widget_set_size_request( button, 60, -2 ); hbox = gtk_hbox_new( FALSE, 5 ); gtk_widget_show( hbox ); @@ -151,14 +151,14 @@ int DoLoadPortalFileDialog(){ gtk_box_pack_end( GTK_BOX( hbox ), button, FALSE, FALSE, 0 ); g_signal_connect( G_OBJECT( button ), "clicked", G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( IDCANCEL ) ); - gtk_widget_set_usize( button, 60, -2 ); + gtk_widget_set_size_request( button, 60, -2 ); button = gtk_button_new_with_label( _( "OK" ) ); gtk_widget_show( button ); gtk_box_pack_end( GTK_BOX( hbox ), button, FALSE, FALSE, 0 ); g_signal_connect( G_OBJECT( button ), "clicked", G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( IDOK ) ); - gtk_widget_set_usize( button, 60, -2 ); + gtk_widget_set_size_request( button, 60, -2 ); char *fn = g_IBSPTable.m_pfnGetMapName(); strcpy( portals.fn, fn ); @@ -228,7 +228,7 @@ void DoAboutDlg(){ gtk_box_pack_start( GTK_BOX( vbox ), button, FALSE, FALSE, 0 ); g_signal_connect( G_OBJECT( button ), "clicked", G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( IDOK ) ); - gtk_widget_set_usize( button, 60, -2 ); + gtk_widget_set_size_request( button, 60, -2 ); gtk_grab_add( dlg ); gtk_widget_show( dlg ); @@ -659,7 +659,7 @@ void DoConfigDialog(){ gtk_widget_show( button ); gtk_box_pack_start( GTK_BOX( hbox ), button, FALSE, FALSE, 0 ); g_signal_connect( G_OBJECT( button ), "clicked", G_CALLBACK( OnColor2d ), NULL ); - gtk_widget_set_usize( button, 60, -2 ); + gtk_widget_set_size_request( button, 60, -2 ); aa2check = gtk_check_button_new_with_label( _( "Anti-Alias (May not work on some video cards)" ) ); gtk_widget_show( aa2check ); @@ -684,7 +684,7 @@ void DoConfigDialog(){ gtk_box_pack_end( GTK_BOX( hbox ), button, FALSE, FALSE, 0 ); g_signal_connect( G_OBJECT( button ), "clicked", G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( IDOK ) ); - gtk_widget_set_usize( button, 60, -2 ); + gtk_widget_set_size_request( button, 60, -2 ); // initialize dialog gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( show2check ), portals.show_2d ); diff --git a/contrib/prtview/gtkdlgs.h b/contrib/prtview/gtkdlgs.h index 6677bdeb..1d783b87 100644 --- a/contrib/prtview/gtkdlgs.h +++ b/contrib/prtview/gtkdlgs.h @@ -20,8 +20,8 @@ #ifndef _GTKDLGS_H_ #define _GTKDLGS_H_ -int DoLoadPortalFileDialog(); -void DoAboutDlg(); -void DoConfigDialog(); +int DoLoadPortalFileDialog( GtkWidget *parent ); +void DoAboutDlg( GtkWidget *parent ); +void DoConfigDialog( GtkWidget *parent ); #endif // _GTKDLGS_H_ diff --git a/contrib/prtview/prtview.cpp b/contrib/prtview/prtview.cpp index 65ffd14d..b36a8b13 100644 --- a/contrib/prtview/prtview.cpp +++ b/contrib/prtview/prtview.cpp @@ -25,12 +25,12 @@ #include #define Q3R_CMD_SPLITTER "-" -#define Q3R_CMD_ABOUT "About Portal Viewer" +#define Q3R_CMD_ABOUT "About Portal Viewer..." #define Q3R_CMD_LOAD "Load .prt file" #define Q3R_CMD_RELEASE "Unload .prt file" #define Q3R_CMD_SHOW_3D "Toggle portals (3D)" #define Q3R_CMD_SHOW_2D "Toggle portals (2D)" -#define Q3R_CMD_OPTIONS "Configure Portal Viewer" +#define Q3R_CMD_OPTIONS "Configure Portal Viewer..." static char INIfn[NAME_MAX]; @@ -55,6 +55,8 @@ static char INIfn[NAME_MAX]; #define CLIP_RANGE "ClipRange" #define CLIP "Clip" +void *g_pMainWidget = NULL; + void InitInstance(){ #ifdef _WIN32 char fn[_MAX_PATH]; @@ -366,6 +368,7 @@ extern "C" LPVOID WINAPI QERPlug_GetFuncTable(){ //extern "C" LPCSTR WINAPI QERPlug_Init (HMODULE hApp, GtkWidget* hwndMain) extern "C" const char* QERPlug_Init( void *hApp, void* pMainWidget ){ + g_pMainWidget = pMainWidget; // Setup defaults & load config InitInstance(); @@ -410,13 +413,13 @@ extern "C" void QERPlug_Dispatch( const char* p, vec3_t vMin, vec3_t vMax, bool Sys_Printf( MSG_PREFIX "Command \"%s\"\n",p ); if ( !strcmp( p,Q3R_CMD_ABOUT ) ) { - DoAboutDlg(); + DoAboutDlg( GTK_WIDGET( g_pMainWidget ) ); } else if ( !strcmp( p,Q3R_CMD_LOAD ) ) { CheckInterfaces(); if ( interfaces_started ) { - if ( DoLoadPortalFileDialog() == IDOK ) { + if ( DoLoadPortalFileDialog( GTK_WIDGET( g_pMainWidget ) ) == IDOK ) { portals.Load(); g_FuncTable.m_pfnSysUpdateWindows( UPDATE_ALL ); } @@ -466,7 +469,7 @@ extern "C" void QERPlug_Dispatch( const char* p, vec3_t vMin, vec3_t vMax, bool } } else if ( !strcmp( p,Q3R_CMD_OPTIONS ) ) { - DoConfigDialog(); + DoConfigDialog( GTK_WIDGET( g_pMainWidget ) ); SaveConfig(); if ( interfaces_started ) { diff --git a/plugins/surface/surfacedialog.cpp b/plugins/surface/surfacedialog.cpp index 2aa2548f..bd55b465 100644 --- a/plugins/surface/surfacedialog.cpp +++ b/plugins/surface/surfacedialog.cpp @@ -122,31 +122,31 @@ GtkWidget *texture_combo_entry; GtkWidget *match_grid_button; -GtkObject *hshift_value_spinbutton_adj; +GtkAdjustment *hshift_value_spinbutton_adj; GtkWidget *hshift_value_spinbutton; -GtkObject *vshift_value_spinbutton_adj; +GtkAdjustment *vshift_value_spinbutton_adj; GtkWidget *vshift_value_spinbutton; -GtkObject *hscale_value_spinbutton_adj; +GtkAdjustment *hscale_value_spinbutton_adj; GtkWidget *hscale_value_spinbutton; -GtkObject *vscale_value_spinbutton_adj; +GtkAdjustment *vscale_value_spinbutton_adj; GtkWidget *vscale_value_spinbutton; -GtkObject *rotate_value_spinbutton_adj; +GtkAdjustment *rotate_value_spinbutton_adj; GtkWidget *rotate_value_spinbutton; -GtkObject *hshift_step_spinbutton_adj; +GtkAdjustment *hshift_step_spinbutton_adj; GtkWidget *hshift_step_spinbutton; -GtkObject *vshift_step_spinbutton_adj; +GtkAdjustment *vshift_step_spinbutton_adj; GtkWidget *vshift_step_spinbutton; -GtkObject *hscale_step_spinbutton_adj; +GtkAdjustment *hscale_step_spinbutton_adj; GtkWidget *hscale_step_spinbutton; -GtkObject *vscale_step_spinbutton_adj; +GtkAdjustment *vscale_step_spinbutton_adj; GtkWidget *vscale_step_spinbutton; -GtkObject *rotate_step_spinbutton_adj; +GtkAdjustment *rotate_step_spinbutton_adj; GtkWidget *rotate_step_spinbutton; -GtkObject *fit_width_spinbutton_adj; +GtkAdjustment *fit_width_spinbutton_adj; GtkWidget *fit_width_spinbutton; -GtkObject *fit_height_spinbutton_adj; +GtkAdjustment *fit_height_spinbutton_adj; GtkWidget *fit_height_spinbutton; GtkWidget *fit_button; GtkWidget *axial_button; @@ -372,7 +372,7 @@ static gint apply_and_hide( GtkWidget *widget, GdkEvent *event, gpointer data ) // Listen for 'Esc' globally and apply+hide - that's all we can really do (same as closing the dialog) static gint surface_dialog_key_press( GtkWidget *widget, GdkEventKey *event, gpointer data ) { - if ( event->keyval != GDK_Escape ) { + if ( event->keyval != GDK_KEY_Escape ) { return FALSE; } return apply_and_hide( widget, (GdkEvent*)event, data ); @@ -641,6 +641,7 @@ GtkWidget* create_SurfaceInspector( void ){ GtkWidget *hbox1; GtkWidget *hbuttonbox1; + GtkSizeGroup *size_group; SurfaceInspector = gtk_window_new( GTK_WINDOW_TOPLEVEL ); gtk_container_set_border_width( GTK_CONTAINER( SurfaceInspector ), 4 ); @@ -649,515 +650,530 @@ GtkWidget* create_SurfaceInspector( void ){ SetWinPos_from_Prefs( SurfaceInspector ); viewport8 = gtk_viewport_new( NULL, NULL ); - gtk_widget_show( viewport8 ); gtk_container_add( GTK_CONTAINER( SurfaceInspector ), viewport8 ); gtk_viewport_set_shadow_type( GTK_VIEWPORT( viewport8 ), GTK_SHADOW_NONE ); + gtk_widget_show( viewport8 ); vbox7 = gtk_vbox_new( FALSE, 0 ); - gtk_widget_show( vbox7 ); gtk_container_add( GTK_CONTAINER( viewport8 ), vbox7 ); + gtk_widget_show( vbox7 ); viewport9 = gtk_viewport_new( NULL, NULL ); - gtk_widget_show( viewport9 ); gtk_box_pack_start( GTK_BOX( vbox7 ), viewport9, FALSE, FALSE, 0 ); gtk_container_set_border_width( GTK_CONTAINER( viewport9 ), 2 ); gtk_viewport_set_shadow_type( GTK_VIEWPORT( viewport9 ), GTK_SHADOW_ETCHED_IN ); + gtk_widget_show( viewport9 ); hbox1 = gtk_hbox_new( FALSE, 0 ); - gtk_widget_show( hbox1 ); gtk_container_add( GTK_CONTAINER( viewport9 ), hbox1 ); gtk_container_set_border_width( GTK_CONTAINER( hbox1 ), 4 ); + gtk_widget_show( hbox1 ); label = gtk_label_new( _( "Texture: " ) ); - gtk_widget_show( label ); gtk_box_pack_start( GTK_BOX( hbox1 ), label, FALSE, FALSE, 0 ); gtk_misc_set_alignment( GTK_MISC( label ), 1, 0.5 ); + gtk_widget_show( label ); texture_combo = gtk_combo_new(); g_object_set_data( G_OBJECT( GTK_COMBO( texture_combo )->popwin ), "KeepMeAround", texture_combo ); gtk_combo_disable_activate( (GtkCombo*) texture_combo ); - gtk_widget_show( texture_combo ); gtk_box_pack_start( GTK_BOX( hbox1 ), texture_combo, TRUE, TRUE, 0 ); + gtk_widget_show( texture_combo ); texture_combo_entry = GTK_COMBO( texture_combo )->entry; - gtk_widget_show( texture_combo_entry ); gtk_entry_set_max_length( GTK_ENTRY( texture_combo_entry ), 128 ); + gtk_widget_show( texture_combo_entry ); viewport2 = gtk_viewport_new( NULL, NULL ); - gtk_widget_show( viewport2 ); gtk_box_pack_start( GTK_BOX( vbox7 ), viewport2, FALSE, TRUE, 0 ); gtk_container_set_border_width( GTK_CONTAINER( viewport2 ), 2 ); gtk_viewport_set_shadow_type( GTK_VIEWPORT( viewport2 ), GTK_SHADOW_ETCHED_IN ); + gtk_widget_show( viewport2 ); table1 = gtk_table_new( 13, 4, FALSE ); - gtk_widget_show( table1 ); gtk_container_add( GTK_CONTAINER( viewport2 ), table1 ); + gtk_widget_show( table1 ); hseparator = gtk_hseparator_new(); - gtk_widget_show( hseparator ); gtk_table_attach( GTK_TABLE( table1 ), hseparator, 1, 2, 1, 2, (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), (GtkAttachOptions) ( GTK_FILL ), 0, 0 ); + gtk_widget_show( hseparator ); hseparator = gtk_hseparator_new(); - gtk_widget_show( hseparator ); gtk_table_attach( GTK_TABLE( table1 ), hseparator, 2, 3, 1, 2, (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), (GtkAttachOptions) ( GTK_FILL ), 0, 0 ); + gtk_widget_show( hseparator ); hseparator = gtk_hseparator_new(); - gtk_widget_show( hseparator ); gtk_table_attach( GTK_TABLE( table1 ), hseparator, 3, 4, 1, 2, (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), (GtkAttachOptions) ( GTK_FILL ), 0, 0 ); + gtk_widget_show( hseparator ); hseparator = gtk_hseparator_new(); - gtk_widget_show( hseparator ); gtk_table_attach( GTK_TABLE( table1 ), hseparator, 1, 2, 3, 4, (GtkAttachOptions) ( GTK_FILL ), (GtkAttachOptions) ( GTK_FILL ), 0, 0 ); + gtk_widget_show( hseparator ); hseparator = gtk_hseparator_new(); - gtk_widget_show( hseparator ); gtk_table_attach( GTK_TABLE( table1 ), hseparator, 2, 3, 3, 4, (GtkAttachOptions) ( GTK_FILL ), (GtkAttachOptions) ( GTK_FILL ), 0, 0 ); + gtk_widget_show( hseparator ); hseparator = gtk_hseparator_new(); - gtk_widget_show( hseparator ); gtk_table_attach( GTK_TABLE( table1 ), hseparator, 3, 4, 3, 4, (GtkAttachOptions) ( GTK_FILL ), (GtkAttachOptions) ( GTK_FILL ), 0, 0 ); + gtk_widget_show( hseparator ); hseparator = gtk_hseparator_new(); - gtk_widget_show( hseparator ); gtk_table_attach( GTK_TABLE( table1 ), hseparator, 1, 2, 5, 6, (GtkAttachOptions) ( GTK_FILL ), (GtkAttachOptions) ( GTK_FILL ), 0, 0 ); + gtk_widget_show( hseparator ); hseparator = gtk_hseparator_new(); - gtk_widget_show( hseparator ); gtk_table_attach( GTK_TABLE( table1 ), hseparator, 2, 3, 5, 6, (GtkAttachOptions) ( GTK_FILL ), (GtkAttachOptions) ( GTK_FILL ), 0, 0 ); + gtk_widget_show( hseparator ); hseparator = gtk_hseparator_new(); - gtk_widget_show( hseparator ); gtk_table_attach( GTK_TABLE( table1 ), hseparator, 3, 4, 5, 6, (GtkAttachOptions) ( GTK_FILL ), (GtkAttachOptions) ( GTK_FILL ), 0, 0 ); + gtk_widget_show( hseparator ); hseparator = gtk_hseparator_new(); - gtk_widget_show( hseparator ); gtk_table_attach( GTK_TABLE( table1 ), hseparator, 1, 2, 7, 8, (GtkAttachOptions) ( GTK_FILL ), (GtkAttachOptions) ( GTK_FILL ), 0, 0 ); + gtk_widget_show( hseparator ); hseparator = gtk_hseparator_new(); - gtk_widget_show( hseparator ); gtk_table_attach( GTK_TABLE( table1 ), hseparator, 2, 3, 7, 8, (GtkAttachOptions) ( GTK_FILL ), (GtkAttachOptions) ( GTK_FILL ), 0, 0 ); + gtk_widget_show( hseparator ); hseparator = gtk_hseparator_new(); - gtk_widget_show( hseparator ); gtk_table_attach( GTK_TABLE( table1 ), hseparator, 3, 4, 7, 8, (GtkAttachOptions) ( GTK_FILL ), (GtkAttachOptions) ( GTK_FILL ), 0, 0 ); + gtk_widget_show( hseparator ); hseparator = gtk_hseparator_new(); - gtk_widget_show( hseparator ); gtk_table_attach( GTK_TABLE( table1 ), hseparator, 1, 2, 9, 10, (GtkAttachOptions) ( GTK_FILL ), (GtkAttachOptions) ( GTK_FILL ), 0, 0 ); + gtk_widget_show( hseparator ); hseparator = gtk_hseparator_new(); - gtk_widget_show( hseparator ); gtk_table_attach( GTK_TABLE( table1 ), hseparator, 2, 3, 9, 10, (GtkAttachOptions) ( GTK_FILL ), (GtkAttachOptions) ( GTK_FILL ), 0, 0 ); + gtk_widget_show( hseparator ); hseparator = gtk_hseparator_new(); - gtk_widget_show( hseparator ); gtk_table_attach( GTK_TABLE( table1 ), hseparator, 3, 4, 9, 10, (GtkAttachOptions) ( GTK_FILL ), (GtkAttachOptions) ( GTK_FILL ), 0, 0 ); + gtk_widget_show( hseparator ); hseparator = gtk_hseparator_new(); - gtk_widget_show( hseparator ); gtk_table_attach( GTK_TABLE( table1 ), hseparator, 1, 2, 11, 12, (GtkAttachOptions) ( GTK_FILL ), (GtkAttachOptions) ( GTK_FILL ), 0, 0 ); + gtk_widget_show( hseparator ); hseparator = gtk_hseparator_new(); - gtk_widget_show( hseparator ); gtk_table_attach( GTK_TABLE( table1 ), hseparator, 2, 3, 11, 12, (GtkAttachOptions) ( GTK_FILL ), (GtkAttachOptions) ( GTK_FILL ), 0, 0 ); + gtk_widget_show( hseparator ); hseparator = gtk_hseparator_new(); - gtk_widget_show( hseparator ); gtk_table_attach( GTK_TABLE( table1 ), hseparator, 3, 4, 11, 12, (GtkAttachOptions) ( GTK_FILL ), (GtkAttachOptions) ( GTK_FILL ), 0, 0 ); + gtk_widget_show( hseparator ); label = gtk_label_new( _( "Step" ) ); - gtk_widget_show( label ); gtk_table_attach( GTK_TABLE( table1 ), label, 3, 4, 0, 1, (GtkAttachOptions) ( GTK_FILL ), (GtkAttachOptions) ( 0 ), 0, 0 ); + gtk_widget_show( label ); eventbox = gtk_event_box_new(); - gtk_widget_show( eventbox ); gtk_table_attach( GTK_TABLE( table1 ), eventbox, 3, 4, 12, 13, (GtkAttachOptions) ( GTK_FILL ), (GtkAttachOptions) ( GTK_FILL ), 0, 0 ); + gtk_widget_show( eventbox ); match_grid_button = gtk_button_new_with_mnemonic( _( "Match Grid" ) ); - gtk_widget_show( match_grid_button ); gtk_container_add( GTK_CONTAINER( eventbox ), match_grid_button ); + gtk_widget_show( match_grid_button ); label = gtk_label_new( _( "Value" ) ); - gtk_widget_show( label ); gtk_table_attach( GTK_TABLE( table1 ), label, 1, 2, 0, 1, (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), (GtkAttachOptions) ( 0 ), 0, 0 ); gtk_misc_set_alignment( GTK_MISC( label ), 0.5, 1 ); + gtk_widget_show( label ); hseparator = gtk_hseparator_new(); - gtk_widget_show( hseparator ); gtk_table_attach( GTK_TABLE( table1 ), hseparator, 0, 1, 3, 4, (GtkAttachOptions) ( GTK_SHRINK | GTK_FILL ), (GtkAttachOptions) ( GTK_FILL ), 0, 0 ); + gtk_widget_show( hseparator ); hseparator = gtk_hseparator_new(); - gtk_widget_show( hseparator ); gtk_table_attach( GTK_TABLE( table1 ), hseparator, 0, 1, 5, 6, (GtkAttachOptions) ( GTK_FILL ), (GtkAttachOptions) ( GTK_FILL ), 0, 0 ); + gtk_widget_show( hseparator ); hseparator = gtk_hseparator_new(); - gtk_widget_show( hseparator ); gtk_table_attach( GTK_TABLE( table1 ), hseparator, 0, 1, 7, 8, (GtkAttachOptions) ( GTK_FILL ), (GtkAttachOptions) ( GTK_FILL ), 0, 0 ); + gtk_widget_show( hseparator ); hseparator = gtk_hseparator_new(); - gtk_widget_show( hseparator ); gtk_table_attach( GTK_TABLE( table1 ), hseparator, 0, 1, 9, 10, (GtkAttachOptions) ( GTK_FILL ), (GtkAttachOptions) ( GTK_FILL ), 0, 0 ); + gtk_widget_show( hseparator ); hseparator = gtk_hseparator_new(); - gtk_widget_show( hseparator ); gtk_table_attach( GTK_TABLE( table1 ), hseparator, 0, 1, 11, 12, (GtkAttachOptions) ( GTK_FILL ), (GtkAttachOptions) ( GTK_FILL ), 0, 0 ); + gtk_widget_show( hseparator ); eventbox = gtk_event_box_new(); - gtk_widget_show( eventbox ); gtk_table_attach( GTK_TABLE( table1 ), eventbox, 0, 1, 4, 5, (GtkAttachOptions) ( GTK_FILL ), (GtkAttachOptions) ( GTK_FILL ), 0, 0 ); + gtk_widget_show( eventbox ); label = gtk_label_new( _( "Vertical Shift: " ) ); - gtk_widget_show( label ); gtk_container_add( GTK_CONTAINER( eventbox ), label ); gtk_label_set_justify( GTK_LABEL( label ), GTK_JUSTIFY_LEFT ); gtk_misc_set_alignment( GTK_MISC( label ), 1, 0.5 ); + gtk_widget_show( label ); eventbox = gtk_event_box_new(); - gtk_widget_show( eventbox ); gtk_table_attach( GTK_TABLE( table1 ), eventbox, 0, 1, 6, 7, (GtkAttachOptions) ( GTK_FILL ), (GtkAttachOptions) ( GTK_FILL ), 0, 0 ); + gtk_widget_show( eventbox ); label = gtk_label_new( _( "Horizontal Scale: " ) ); - gtk_widget_show( label ); gtk_container_add( GTK_CONTAINER( eventbox ), label ); gtk_label_set_justify( GTK_LABEL( label ), GTK_JUSTIFY_LEFT ); gtk_misc_set_alignment( GTK_MISC( label ), 1, 0.5 ); + gtk_widget_show( label ); eventbox = gtk_event_box_new(); - gtk_widget_show( eventbox ); gtk_table_attach( GTK_TABLE( table1 ), eventbox, 0, 1, 8, 9, (GtkAttachOptions) ( GTK_FILL ), (GtkAttachOptions) ( GTK_FILL ), 0, 0 ); + gtk_widget_show( eventbox ); label = gtk_label_new( _( "Vertical Scale: " ) ); - gtk_widget_show( label ); gtk_container_add( GTK_CONTAINER( eventbox ), label ); gtk_label_set_justify( GTK_LABEL( label ), GTK_JUSTIFY_LEFT ); gtk_misc_set_alignment( GTK_MISC( label ), 1, 0.5 ); + gtk_widget_show( label ); eventbox = gtk_event_box_new(); - gtk_widget_show( eventbox ); gtk_table_attach( GTK_TABLE( table1 ), eventbox, 0, 1, 10, 11, (GtkAttachOptions) ( GTK_FILL ), (GtkAttachOptions) ( GTK_FILL ), 0, 0 ); + gtk_widget_show( eventbox ); label = gtk_label_new( _( "Rotate: " ) ); - gtk_widget_show( label ); gtk_container_add( GTK_CONTAINER( eventbox ), label ); gtk_label_set_justify( GTK_LABEL( label ), GTK_JUSTIFY_LEFT ); gtk_misc_set_alignment( GTK_MISC( label ), 1, 0.5 ); + gtk_widget_show( label ); eventbox = gtk_event_box_new(); - gtk_widget_show( eventbox ); gtk_table_attach( GTK_TABLE( table1 ), eventbox, 0, 1, 2, 3, (GtkAttachOptions) ( GTK_FILL ), (GtkAttachOptions) ( GTK_FILL ), 0, 0 ); + gtk_widget_show( eventbox ); label = gtk_label_new( _( "Horizontal Shift: " ) ); - gtk_widget_show( label ); gtk_container_add( GTK_CONTAINER( eventbox ), label ); gtk_label_set_justify( GTK_LABEL( label ), GTK_JUSTIFY_LEFT ); gtk_misc_set_alignment( GTK_MISC( label ), 1, 0.5 ); + gtk_widget_show( label ); hseparator = gtk_hseparator_new(); - gtk_widget_show( hseparator ); gtk_table_attach( GTK_TABLE( table1 ), hseparator, 0, 1, 1, 2, (GtkAttachOptions) ( GTK_FILL ), (GtkAttachOptions) ( GTK_FILL ), 0, 0 ); + gtk_widget_show( hseparator ); eventbox = gtk_event_box_new(); - gtk_widget_show( eventbox ); gtk_table_attach( GTK_TABLE( table1 ), eventbox, 1, 2, 12, 13, (GtkAttachOptions) ( GTK_FILL ), (GtkAttachOptions) ( GTK_FILL ), 0, 0 ); + gtk_widget_show( eventbox ); // Value Spins - hshift_value_spinbutton_adj = gtk_adjustment_new( 0.0, -8192.0, 8192.0, 2.0, 8.0, 0.0 ); + hshift_value_spinbutton_adj = GTK_ADJUSTMENT( gtk_adjustment_new( 0.0, -8192.0, 8192.0, 2.0, 8.0, 0.0 ) ); hshift_value_spinbutton = gtk_spin_button_new( GTK_ADJUSTMENT( hshift_value_spinbutton_adj ), 1, 2 ); - gtk_widget_show( hshift_value_spinbutton ); gtk_table_attach( GTK_TABLE( table1 ), hshift_value_spinbutton, 1, 2, 2, 3, (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), (GtkAttachOptions) ( 0 ), 0, 0 ); gtk_spin_button_set_update_policy( GTK_SPIN_BUTTON( hshift_value_spinbutton ), GTK_UPDATE_IF_VALID ); + gtk_spin_button_set_numeric( GTK_SPIN_BUTTON( hshift_value_spinbutton ), TRUE ); gtk_spin_button_set_wrap( GTK_SPIN_BUTTON( hshift_value_spinbutton ), TRUE ); gtk_widget_set_sensitive( GTK_WIDGET( hshift_value_spinbutton ), TRUE ); - g_object_set( hshift_value_spinbutton, "xalign", 1.0, NULL ); + gtk_entry_set_alignment( GTK_ENTRY( hshift_value_spinbutton ), 1.0 ); //right + gtk_widget_show( hshift_value_spinbutton ); - vshift_value_spinbutton_adj = gtk_adjustment_new( 0.0, -8192.0, 8192.0, 2.0, 8.0, 0.0 ); + vshift_value_spinbutton_adj = GTK_ADJUSTMENT( gtk_adjustment_new( 0.0, -8192.0, 8192.0, 2.0, 8.0, 0.0 ) ); vshift_value_spinbutton = gtk_spin_button_new( GTK_ADJUSTMENT( vshift_value_spinbutton_adj ), 1, 2 ); - gtk_widget_show( vshift_value_spinbutton ); gtk_table_attach( GTK_TABLE( table1 ), vshift_value_spinbutton, 1, 2, 4, 5, (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), (GtkAttachOptions) ( 0 ), 0, 0 ); gtk_spin_button_set_update_policy( GTK_SPIN_BUTTON( vshift_value_spinbutton ), GTK_UPDATE_IF_VALID ); + gtk_spin_button_set_numeric( GTK_SPIN_BUTTON( vshift_value_spinbutton ), TRUE ); gtk_spin_button_set_wrap( GTK_SPIN_BUTTON( vshift_value_spinbutton ), TRUE ); gtk_widget_set_sensitive( GTK_WIDGET( vshift_value_spinbutton ), TRUE ); - g_object_set( vshift_value_spinbutton, "xalign", 1.0, NULL ); + gtk_entry_set_alignment( GTK_ENTRY( vshift_value_spinbutton ), 1.0 ); //right + gtk_widget_show( vshift_value_spinbutton ); - hscale_value_spinbutton_adj = gtk_adjustment_new( 0.0, -1024.0, 1024.0, 1.0, 4.0, 0.0 ); + hscale_value_spinbutton_adj = GTK_ADJUSTMENT( gtk_adjustment_new( 0.0, -1024.0, 1024.0, 1.0, 4.0, 0.0 ) ); hscale_value_spinbutton = gtk_spin_button_new( GTK_ADJUSTMENT( hscale_value_spinbutton_adj ), 1, 4 ); - gtk_widget_show( hscale_value_spinbutton ); gtk_table_attach( GTK_TABLE( table1 ), hscale_value_spinbutton, 1, 2, 6, 7, (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), (GtkAttachOptions) ( 0 ), 0, 0 ); gtk_spin_button_set_update_policy( GTK_SPIN_BUTTON( hscale_value_spinbutton ), GTK_UPDATE_IF_VALID ); + gtk_spin_button_set_numeric( GTK_SPIN_BUTTON( hscale_value_spinbutton ), TRUE ); gtk_spin_button_set_wrap( GTK_SPIN_BUTTON( hscale_value_spinbutton ), TRUE ); gtk_widget_set_sensitive( GTK_WIDGET( hscale_value_spinbutton ), TRUE ); - g_object_set( hscale_value_spinbutton, "xalign", 1.0, NULL ); + gtk_entry_set_alignment( GTK_ENTRY( hscale_value_spinbutton ), 1.0 ); //right + gtk_widget_show( hscale_value_spinbutton ); - vscale_value_spinbutton_adj = gtk_adjustment_new( 0.0, -1024.0, 1024.0, 1.0, 4.0, 0.0 ); + vscale_value_spinbutton_adj = GTK_ADJUSTMENT( gtk_adjustment_new( 0.0, -1024.0, 1024.0, 1.0, 4.0, 0.0 ) ); vscale_value_spinbutton = gtk_spin_button_new( GTK_ADJUSTMENT( vscale_value_spinbutton_adj ), 1, 4 ); - gtk_widget_show( vscale_value_spinbutton ); gtk_table_attach( GTK_TABLE( table1 ), vscale_value_spinbutton, 1, 2, 8, 9, (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), (GtkAttachOptions) ( 0 ), 0, 0 ); gtk_spin_button_set_update_policy( GTK_SPIN_BUTTON( vscale_value_spinbutton ), GTK_UPDATE_IF_VALID ); + gtk_spin_button_set_numeric( GTK_SPIN_BUTTON( vscale_value_spinbutton ), TRUE ); gtk_spin_button_set_wrap( GTK_SPIN_BUTTON( vscale_value_spinbutton ), TRUE ); gtk_widget_set_sensitive( GTK_WIDGET( vscale_value_spinbutton ), TRUE ); - g_object_set( vscale_value_spinbutton, "xalign", 1.0, NULL ); + gtk_entry_set_alignment( GTK_ENTRY( vscale_value_spinbutton ), 1.0 ); //right + gtk_widget_show( vscale_value_spinbutton ); - rotate_value_spinbutton_adj = gtk_adjustment_new( 0.0, -360.0, 360.0, 1.0, 10.0, 0.0 ); + rotate_value_spinbutton_adj = GTK_ADJUSTMENT( gtk_adjustment_new( 0.0, -360.0, 360.0, 1.0, 10.0, 0.0 ) ); rotate_value_spinbutton = gtk_spin_button_new( GTK_ADJUSTMENT( rotate_value_spinbutton_adj ), 1, 4 ); - gtk_widget_show( rotate_value_spinbutton ); gtk_table_attach( GTK_TABLE( table1 ), rotate_value_spinbutton, 1, 2, 10, 11, (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), (GtkAttachOptions) ( 0 ), 0, 0 ); gtk_spin_button_set_update_policy( GTK_SPIN_BUTTON( rotate_value_spinbutton ), GTK_UPDATE_IF_VALID ); + gtk_spin_button_set_numeric( GTK_SPIN_BUTTON( rotate_value_spinbutton ), TRUE ); gtk_spin_button_set_wrap( GTK_SPIN_BUTTON( rotate_value_spinbutton ), TRUE ); gtk_widget_set_sensitive( GTK_WIDGET( rotate_value_spinbutton ), TRUE ); - g_object_set( rotate_value_spinbutton, "xalign", 1.0, NULL ); + gtk_entry_set_alignment( GTK_ENTRY( rotate_value_spinbutton ), 1.0 ); //right + gtk_widget_show( rotate_value_spinbutton ); // Step Spins - hshift_step_spinbutton_adj = gtk_adjustment_new( 0.0, -8192.0, 8192.0, 2.0, 8.0, 0.0 ); + hshift_step_spinbutton_adj = GTK_ADJUSTMENT( gtk_adjustment_new( 0.0, -8192.0, 8192.0, 2.0, 8.0, 0.0 ) ); hshift_step_spinbutton = gtk_spin_button_new( GTK_ADJUSTMENT( hshift_step_spinbutton_adj ), 1, 2 ); - gtk_widget_show( hshift_step_spinbutton ); gtk_table_attach( GTK_TABLE( table1 ), hshift_step_spinbutton, 3, 4, 2, 3, (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), (GtkAttachOptions) ( 0 ), 0, 0 ); gtk_spin_button_set_update_policy( GTK_SPIN_BUTTON( hshift_step_spinbutton ), GTK_UPDATE_IF_VALID ); - g_object_set( hshift_step_spinbutton, "xalign", 1.0, NULL ); + gtk_spin_button_set_numeric( GTK_SPIN_BUTTON( hshift_step_spinbutton ), TRUE ); + gtk_entry_set_alignment( GTK_ENTRY( hshift_step_spinbutton ), 1.0 ); //right + gtk_widget_show( hshift_step_spinbutton ); - vshift_step_spinbutton_adj = gtk_adjustment_new( 0.0, -8192.0, 8192.0, 2.0, 8.0, 0.0 ); + vshift_step_spinbutton_adj = GTK_ADJUSTMENT( gtk_adjustment_new( 0.0, -8192.0, 8192.0, 2.0, 8.0, 0.0 ) ); vshift_step_spinbutton = gtk_spin_button_new( GTK_ADJUSTMENT( vshift_step_spinbutton_adj ), 1, 2 ); - gtk_widget_show( vshift_step_spinbutton ); gtk_table_attach( GTK_TABLE( table1 ), vshift_step_spinbutton, 3, 4, 4, 5, (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), (GtkAttachOptions) ( 0 ), 0, 0 ); gtk_spin_button_set_update_policy( GTK_SPIN_BUTTON( vshift_step_spinbutton ), GTK_UPDATE_IF_VALID ); - g_object_set( vshift_step_spinbutton, "xalign", 1.0, NULL ); + gtk_spin_button_set_numeric( GTK_SPIN_BUTTON( vshift_step_spinbutton ), TRUE ); + gtk_entry_set_alignment( GTK_ENTRY( vshift_step_spinbutton ), 1.0 ); //right + gtk_widget_show( vshift_step_spinbutton ); - hscale_step_spinbutton_adj = gtk_adjustment_new( 0.0, -1024.0, 1024.0, 1.0, 4.0, 0.0 ); + hscale_step_spinbutton_adj = GTK_ADJUSTMENT( gtk_adjustment_new( 0.0, -1024.0, 1024.0, 1.0, 4.0, 0.0 ) ); hscale_step_spinbutton = gtk_spin_button_new( GTK_ADJUSTMENT( hscale_step_spinbutton_adj ), 1, 4 ); - gtk_widget_show( hscale_step_spinbutton ); gtk_table_attach( GTK_TABLE( table1 ), hscale_step_spinbutton, 3, 4, 6, 7, (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), (GtkAttachOptions) ( 0 ), 0, 0 ); gtk_spin_button_set_update_policy( GTK_SPIN_BUTTON( hscale_step_spinbutton ), GTK_UPDATE_IF_VALID ); - g_object_set( hscale_step_spinbutton, "xalign", 1.0, NULL ); + gtk_spin_button_set_numeric( GTK_SPIN_BUTTON( hscale_step_spinbutton ), TRUE ); + gtk_entry_set_alignment( GTK_ENTRY( hscale_step_spinbutton ), 1.0 ); //right + gtk_widget_show( hscale_step_spinbutton ); - vscale_step_spinbutton_adj = gtk_adjustment_new( 0.0, -1024.0, 1024.0, 1.0, 4.0, 0.0 ); + vscale_step_spinbutton_adj = GTK_ADJUSTMENT( gtk_adjustment_new( 0.0, -1024.0, 1024.0, 1.0, 4.0, 0.0 ) ); vscale_step_spinbutton = gtk_spin_button_new( GTK_ADJUSTMENT( vscale_step_spinbutton_adj ), 1, 4 ); - gtk_widget_show( vscale_step_spinbutton ); gtk_table_attach( GTK_TABLE( table1 ), vscale_step_spinbutton, 3, 4, 8, 9, (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), (GtkAttachOptions) ( 0 ), 0, 0 ); gtk_spin_button_set_update_policy( GTK_SPIN_BUTTON( vscale_step_spinbutton ), GTK_UPDATE_IF_VALID ); - g_object_set( vscale_step_spinbutton, "xalign", 1.0, NULL ); + gtk_spin_button_set_numeric( GTK_SPIN_BUTTON( vscale_step_spinbutton ), TRUE ); + gtk_entry_set_alignment( GTK_ENTRY( vscale_step_spinbutton ), 1.0 ); //right + gtk_widget_show( vscale_step_spinbutton ); - rotate_step_spinbutton_adj = gtk_adjustment_new( 0.0, -360.0, 360.0, 1.0, 10.0, 0.0 ); + rotate_step_spinbutton_adj = GTK_ADJUSTMENT( gtk_adjustment_new( 0.0, -360.0, 360.0, 1.0, 10.0, 0.0 ) ); rotate_step_spinbutton = gtk_spin_button_new( GTK_ADJUSTMENT( rotate_step_spinbutton_adj ), 1, 4 ); - gtk_widget_show( rotate_step_spinbutton ); gtk_table_attach( GTK_TABLE( table1 ), rotate_step_spinbutton, 3, 4, 10, 11, (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), (GtkAttachOptions) ( 0 ), 0, 0 ); gtk_spin_button_set_update_policy( GTK_SPIN_BUTTON( rotate_step_spinbutton ), GTK_UPDATE_IF_VALID ); - g_object_set( rotate_step_spinbutton, "xalign", 1.0, NULL ); + gtk_spin_button_set_numeric( GTK_SPIN_BUTTON( rotate_step_spinbutton ), TRUE ); + gtk_entry_set_alignment( GTK_ENTRY( rotate_step_spinbutton ), 1.0 ); //right + gtk_widget_show( rotate_step_spinbutton ); eventbox = gtk_event_box_new(); - gtk_widget_show( eventbox ); gtk_table_attach( GTK_TABLE( table1 ), eventbox, 2, 3, 12, 13, (GtkAttachOptions) ( 0 ), (GtkAttachOptions) ( 0 ), 0, 0 ); + gtk_widget_show( eventbox ); eventbox = gtk_event_box_new(); - gtk_widget_show( eventbox ); gtk_table_attach( GTK_TABLE( table1 ), eventbox, 0, 1, 12, 13, (GtkAttachOptions) ( 0 ), (GtkAttachOptions) ( 0 ), 0, 0 ); + gtk_widget_show( eventbox ); eventbox = gtk_event_box_new(); - gtk_widget_show( eventbox ); gtk_table_attach( GTK_TABLE( table1 ), eventbox, 0, 1, 0, 1, (GtkAttachOptions) ( 0 ), (GtkAttachOptions) ( 0 ), 0, 0 ); + gtk_widget_show( eventbox ); viewport7 = gtk_viewport_new( NULL, NULL ); - gtk_widget_show( viewport7 ); gtk_box_pack_start( GTK_BOX( vbox7 ), viewport7, FALSE, TRUE, 0 ); gtk_container_set_border_width( GTK_CONTAINER( viewport7 ), 2 ); gtk_viewport_set_shadow_type( GTK_VIEWPORT( viewport7 ), GTK_SHADOW_ETCHED_IN ); + gtk_widget_show( viewport7 ); table4 = gtk_table_new( 4, 7, FALSE ); - gtk_widget_show( table4 ); gtk_container_add( GTK_CONTAINER( viewport7 ), table4 ); + gtk_widget_show( table4 ); viewport5 = gtk_viewport_new( NULL, NULL ); - gtk_widget_show( viewport5 ); gtk_table_attach( GTK_TABLE( table4 ), viewport5, 1, 7, 0, 4, (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), (GtkAttachOptions) ( 0 ), 0, 0 ); gtk_container_set_border_width( GTK_CONTAINER( viewport5 ), 6 ); gtk_viewport_set_shadow_type( GTK_VIEWPORT( viewport5 ), GTK_SHADOW_ETCHED_OUT ); + gtk_widget_show( viewport5 ); table5 = gtk_table_new( 2, 3, FALSE ); - gtk_widget_show( table5 ); gtk_container_add( GTK_CONTAINER( viewport5 ), table5 ); gtk_container_set_border_width( GTK_CONTAINER( table5 ), 5 ); gtk_table_set_col_spacings( GTK_TABLE( table5 ), 2 ); + gtk_widget_show( table5 ); label = gtk_label_new( _( "Height" ) ); - gtk_widget_show( label ); gtk_table_attach( GTK_TABLE( table5 ), label, 2, 3, 0, 1, (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), (GtkAttachOptions) ( GTK_FILL ), 0, 0 ); gtk_label_set_justify( GTK_LABEL( label ), GTK_JUSTIFY_LEFT ); gtk_misc_set_alignment( GTK_MISC( label ), 0.5, 1 ); + gtk_widget_show( label ); label = gtk_label_new( _( "Width" ) ); - gtk_widget_show( label ); gtk_table_attach( GTK_TABLE( table5 ), label, 1, 2, 0, 1, (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), (GtkAttachOptions) ( GTK_FILL ), 0, 0 ); gtk_label_set_justify( GTK_LABEL( label ), GTK_JUSTIFY_LEFT ); gtk_misc_set_alignment( GTK_MISC( label ), 0.5, 1 ); + gtk_widget_show( label ); - fit_width_spinbutton_adj = gtk_adjustment_new( 1, 1, 32, 1, 10, 0 ); + fit_width_spinbutton_adj = GTK_ADJUSTMENT( gtk_adjustment_new( 1, 1, 32, 1, 10, 0 ) ); fit_width_spinbutton = gtk_spin_button_new( GTK_ADJUSTMENT( fit_width_spinbutton_adj ), 1, 0 ); - gtk_widget_show( fit_width_spinbutton ); gtk_table_attach( GTK_TABLE( table5 ), fit_width_spinbutton, 1, 2, 1, 2, (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), (GtkAttachOptions) ( GTK_FILL ), 0, 0 ); gtk_spin_button_set_numeric( GTK_SPIN_BUTTON( fit_width_spinbutton ), TRUE ); gtk_spin_button_set_update_policy( GTK_SPIN_BUTTON( fit_width_spinbutton ), GTK_UPDATE_IF_VALID ); - g_object_set( fit_width_spinbutton, "xalign", 1.0, NULL ); + gtk_entry_set_alignment( GTK_ENTRY( fit_width_spinbutton ), 1.0 ); //right + gtk_widget_show( fit_width_spinbutton ); - fit_height_spinbutton_adj = gtk_adjustment_new( 1, 1, 32, 1, 10, 0 ); + fit_height_spinbutton_adj = GTK_ADJUSTMENT( gtk_adjustment_new( 1, 1, 32, 1, 10, 0 ) ); fit_height_spinbutton = gtk_spin_button_new( GTK_ADJUSTMENT( fit_height_spinbutton_adj ), 1, 0 ); - gtk_widget_show( fit_height_spinbutton ); gtk_table_attach( GTK_TABLE( table5 ), fit_height_spinbutton, 2, 3, 1, 2, (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), (GtkAttachOptions) ( GTK_FILL ), 3, 0 ); gtk_spin_button_set_numeric( GTK_SPIN_BUTTON( fit_height_spinbutton ), TRUE ); gtk_spin_button_set_update_policy( GTK_SPIN_BUTTON( fit_height_spinbutton ), GTK_UPDATE_IF_VALID ); - g_object_set( fit_height_spinbutton, "xalign", 1.0, NULL ); + gtk_entry_set_alignment( GTK_ENTRY( fit_height_spinbutton ), 1.0 ); //right + gtk_widget_show( fit_height_spinbutton ); eventbox = gtk_event_box_new(); - gtk_widget_show( eventbox ); gtk_table_attach( GTK_TABLE( table5 ), eventbox, 0, 1, 0, 1, (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), (GtkAttachOptions) ( GTK_FILL ), 0, 0 ); + gtk_widget_show( eventbox ); eventbox = gtk_event_box_new(); - gtk_widget_show( eventbox ); gtk_table_attach( GTK_TABLE( table5 ), eventbox, 0, 1, 1, 2, (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), (GtkAttachOptions) ( GTK_FILL ), 4, 0 ); + gtk_widget_show( eventbox ); fit_button = gtk_button_new_with_mnemonic( _( "Fit" ) ); - gtk_widget_show( fit_button ); gtk_container_add( GTK_CONTAINER( eventbox ), fit_button ); + gtk_widget_show( fit_button ); viewport6 = gtk_viewport_new( NULL, NULL ); - gtk_widget_show( viewport6 ); gtk_table_attach( GTK_TABLE( table4 ), viewport6, 0, 1, 0, 4, (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), (GtkAttachOptions) ( 0 ), 0, 0 ); gtk_container_set_border_width( GTK_CONTAINER( viewport6 ), 4 ); gtk_viewport_set_shadow_type( GTK_VIEWPORT( viewport6 ), GTK_SHADOW_NONE ); + gtk_widget_show( viewport6 ); table7 = gtk_table_new( 2, 1, FALSE ); - gtk_widget_show( table7 ); gtk_container_add( GTK_CONTAINER( viewport6 ), table7 ); + gtk_widget_show( table7 ); eventbox = gtk_event_box_new(); - gtk_widget_show( eventbox ); gtk_table_attach( GTK_TABLE( table7 ), eventbox, 0, 1, 0, 2, (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), 0, 0 ); + gtk_widget_show( eventbox ); axial_button = gtk_button_new_with_mnemonic( _( "Axial" ) ); - gtk_widget_show( axial_button ); gtk_container_add( GTK_CONTAINER( eventbox ), axial_button ); gtk_widget_set_size_request( axial_button, 56, 29 ); gtk_container_set_border_width( GTK_CONTAINER( axial_button ), 4 ); + gtk_widget_show( axial_button ); + + size_group = gtk_size_group_new( GTK_SIZE_GROUP_BOTH ); + gtk_size_group_add_widget( size_group, axial_button ); + gtk_size_group_add_widget( size_group, fit_button ); + g_object_unref( size_group ); hbuttonbox1 = gtk_hbox_new( FALSE, 5 ); - gtk_widget_show( hbuttonbox1 ); gtk_box_pack_start( GTK_BOX( vbox7 ), hbuttonbox1, TRUE, FALSE, 0 ); + gtk_widget_show( hbuttonbox1 ); // closing the window (upper right window manager click) - g_signal_connect( (gpointer) SurfaceInspector, + g_signal_connect( (gpointer) SurfaceInspector, "delete-event", G_CALLBACK( apply_and_hide ), NULL ); - g_signal_connect( (gpointer) SurfaceInspector, "destroy", + g_signal_connect( (gpointer) SurfaceInspector, "destroy", G_CALLBACK( gtk_widget_destroy ), NULL ); @@ -1165,7 +1181,7 @@ GtkWidget* create_SurfaceInspector( void ){ G_CALLBACK( on_texture_combo_entry_key_press_event ), NULL ); - g_signal_connect( (gpointer) SurfaceInspector, "key-press-event", + g_signal_connect( (gpointer) SurfaceInspector, "key-press-event", G_CALLBACK( surface_dialog_key_press ), NULL ); @@ -1230,7 +1246,7 @@ GtkWidget* create_SurfaceInspector( void ){ // Texture Combo gboolean on_texture_combo_entry_key_press_event( GtkWidget *widget, GdkEventKey *event, gpointer user_data ){ // Have Tab activate selection as well as Return - if ( event->keyval == GDK_Tab ) { + if ( event->keyval == GDK_KEY_Tab ) { g_signal_emit_by_name( texture_combo_entry, "activate" ); } diff --git a/plugins/surface_idtech2/surfacedialog.cpp b/plugins/surface_idtech2/surfacedialog.cpp index 3102e043..e82e95aa 100644 --- a/plugins/surface_idtech2/surfacedialog.cpp +++ b/plugins/surface_idtech2/surfacedialog.cpp @@ -539,8 +539,8 @@ void FitAll(){ GtkWidget* create_SurfaceInspector( void ){ GtkWidget *label; - GtkObject *adjustment; - + GtkAdjustment *adjustment; + GtkSizeGroup *size_group; GtkWidget *table1; GtkWidget *table2; @@ -557,246 +557,268 @@ GtkWidget* create_SurfaceInspector( void ){ SetWinPos_from_Prefs( SurfaceInspector ); vbox1 = gtk_vbox_new( FALSE, 5 ); - gtk_widget_show( vbox1 ); gtk_container_add( GTK_CONTAINER( SurfaceInspector ), vbox1 ); + gtk_widget_show( vbox1 ); hbox1 = gtk_hbox_new( FALSE, 5 ); - gtk_widget_show( hbox1 ); gtk_container_add( GTK_CONTAINER( vbox1 ), hbox1 ); gtk_container_set_border_width( GTK_CONTAINER( hbox1 ), 4 ); + gtk_widget_show( hbox1 ); label = gtk_label_new( _( "Texture: " ) ); - gtk_widget_show( label ); gtk_box_pack_start( GTK_BOX( hbox1 ), label, FALSE, FALSE, 0 ); gtk_misc_set_alignment( GTK_MISC( label ), 1, 0.5 ); + gtk_widget_show( label ); texture_combo = gtk_combo_new(); g_object_set_data( G_OBJECT( GTK_COMBO( texture_combo )->popwin ), "KeepMeAround", texture_combo ); gtk_combo_disable_activate( (GtkCombo*) texture_combo ); - gtk_widget_show( texture_combo ); gtk_box_pack_start( GTK_BOX( hbox1 ), texture_combo, TRUE, TRUE, 0 ); + gtk_widget_show( texture_combo ); texture_combo_entry = GTK_COMBO( texture_combo )->entry; - gtk_widget_show( texture_combo_entry ); gtk_entry_set_max_length( GTK_ENTRY( texture_combo_entry ), 1024 ); + gtk_widget_show( texture_combo_entry ); frame1 = gtk_frame_new( _( "Surface" ) ); - gtk_widget_show( frame1 ); gtk_container_add( GTK_CONTAINER( vbox1 ), frame1 ); + gtk_widget_show( frame1 ); table1 = gtk_table_new( 7, 3, FALSE ); - gtk_widget_show( table1 ); gtk_table_set_col_spacings( GTK_TABLE( table1 ), 5 ); gtk_table_set_row_spacings( GTK_TABLE( table1 ), 5 ); gtk_container_set_border_width( GTK_CONTAINER( table1 ), 5 ); gtk_container_add( GTK_CONTAINER( frame1 ), table1 ); + gtk_widget_show( table1 ); label = gtk_label_new( _( "Step" ) ); - gtk_widget_show( label ); gtk_table_attach( GTK_TABLE( table1 ), label, 2, 3, 0, 1, (GtkAttachOptions) ( GTK_FILL ), (GtkAttachOptions) ( 0 ), 0, 0 ); + gtk_widget_show( label ); label = gtk_label_new( _( "Value" ) ); - gtk_widget_show( label ); gtk_table_attach( GTK_TABLE( table1 ), label, 1, 2, 0, 1, (GtkAttachOptions) ( GTK_FILL ), (GtkAttachOptions) ( 0 ), 0, 0 ); gtk_misc_set_alignment( GTK_MISC( label ), 0.5, 1 ); + gtk_widget_show( label ); label = gtk_label_new( _( "Horizontal shift: " ) ); - gtk_widget_show( label ); gtk_table_attach( GTK_TABLE( table1 ), label, 0, 1, 1, 2, (GtkAttachOptions) ( GTK_FILL ), (GtkAttachOptions) ( GTK_FILL ), 0, 0 ); + gtk_widget_show( label ); label = gtk_label_new( _( "Vertical shift: " ) ); - gtk_widget_show( label ); gtk_table_attach( GTK_TABLE( table1 ), label, 0, 1, 2, 3, (GtkAttachOptions) ( GTK_FILL ), (GtkAttachOptions) ( GTK_FILL ), 0, 0 ); + gtk_widget_show( label ); label = gtk_label_new( _( "Horizontal scale: " ) ); - gtk_widget_show( label ); gtk_table_attach( GTK_TABLE( table1 ), label, 0, 1, 3, 4, (GtkAttachOptions) ( GTK_FILL ), (GtkAttachOptions) ( GTK_FILL ), 0, 0 ); + gtk_widget_show( label ); label = gtk_label_new( _( "Vertical scale: " ) ); - gtk_widget_show( label ); gtk_table_attach( GTK_TABLE( table1 ), label, 0, 1, 4, 5, (GtkAttachOptions) ( GTK_FILL ), (GtkAttachOptions) ( GTK_FILL ), 0, 0 ); + gtk_widget_show( label ); label = gtk_label_new( _( "Rotate: " ) ); - gtk_widget_show( label ); gtk_table_attach( GTK_TABLE( table1 ), label, 0, 1, 5, 6, (GtkAttachOptions) ( GTK_FILL ), (GtkAttachOptions) ( GTK_FILL ), 0, 0 ); + gtk_widget_show( label ); // Value Spins - adjustment = gtk_adjustment_new( 0.0, -8192.0, 8192.0, 2.0, 8.0, 0.0 ); + adjustment = GTK_ADJUSTMENT( gtk_adjustment_new( 0.0, -8192.0, 8192.0, 2.0, 8.0, 0.0 ) ); hshift_value_spinbutton = gtk_spin_button_new( GTK_ADJUSTMENT( adjustment ), 1, 2 ); - gtk_widget_show( hshift_value_spinbutton ); gtk_table_attach( GTK_TABLE( table1 ), hshift_value_spinbutton, 1, 2, 1, 2, (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), (GtkAttachOptions) ( 0 ), 0, 0 ); gtk_spin_button_set_update_policy( GTK_SPIN_BUTTON( hshift_value_spinbutton ), GTK_UPDATE_IF_VALID ); + gtk_spin_button_set_numeric( GTK_SPIN_BUTTON( hshift_value_spinbutton ), TRUE ); gtk_spin_button_set_wrap( GTK_SPIN_BUTTON( hshift_value_spinbutton ), TRUE ); - g_object_set( hshift_value_spinbutton, "xalign", 1.0, NULL ); + gtk_entry_set_alignment( GTK_ENTRY( hshift_value_spinbutton ), 1.0 ); //right + gtk_widget_show( hshift_value_spinbutton ); - adjustment = gtk_adjustment_new( 0.0, -8192.0, 8192.0, 2.0, 8.0, 0.0 ); + + adjustment = GTK_ADJUSTMENT( gtk_adjustment_new( 0.0, -8192.0, 8192.0, 2.0, 8.0, 0.0 ) ); vshift_value_spinbutton = gtk_spin_button_new( GTK_ADJUSTMENT( adjustment ), 1, 2 ); - gtk_widget_show( vshift_value_spinbutton ); gtk_table_attach( GTK_TABLE( table1 ), vshift_value_spinbutton, 1, 2, 2, 3, (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), (GtkAttachOptions) ( 0 ), 0, 0 ); gtk_spin_button_set_update_policy( GTK_SPIN_BUTTON( vshift_value_spinbutton ), GTK_UPDATE_IF_VALID ); + gtk_spin_button_set_numeric( GTK_SPIN_BUTTON( vshift_value_spinbutton ), TRUE ); gtk_spin_button_set_wrap( GTK_SPIN_BUTTON( vshift_value_spinbutton ), TRUE ); - g_object_set( vshift_value_spinbutton, "xalign", 1.0, NULL ); + gtk_entry_set_alignment( GTK_ENTRY( vshift_value_spinbutton ), 1.0 ); //right + gtk_widget_show( vshift_value_spinbutton ); - adjustment = gtk_adjustment_new( 0.0, -1024.0, 1024.0, 1.0, 4.0, 0.0 ); + adjustment = GTK_ADJUSTMENT( gtk_adjustment_new( 0.0, -1024.0, 1024.0, 1.0, 4.0, 0.0 ) ); hscale_value_spinbutton = gtk_spin_button_new( GTK_ADJUSTMENT( adjustment ), 1, 4 ); - gtk_widget_show( hscale_value_spinbutton ); gtk_table_attach( GTK_TABLE( table1 ), hscale_value_spinbutton, 1, 2, 3, 4, (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), (GtkAttachOptions) ( 0 ), 0, 0 ); gtk_spin_button_set_update_policy( GTK_SPIN_BUTTON( hscale_value_spinbutton ), GTK_UPDATE_IF_VALID ); + gtk_spin_button_set_numeric( GTK_SPIN_BUTTON( hscale_value_spinbutton ), TRUE ); gtk_spin_button_set_wrap( GTK_SPIN_BUTTON( hscale_value_spinbutton ), TRUE ); - g_object_set( hscale_value_spinbutton, "xalign", 1.0, NULL ); + gtk_entry_set_alignment( GTK_ENTRY( hscale_value_spinbutton ), 1.0 ); //right + gtk_widget_show( hscale_value_spinbutton ); - adjustment = gtk_adjustment_new( 0.0, -1024.0, 1024.0, 1.0, 4.0, 0.0 ); + adjustment = GTK_ADJUSTMENT( gtk_adjustment_new( 0.0, -1024.0, 1024.0, 1.0, 4.0, 0.0 ) ); vscale_value_spinbutton = gtk_spin_button_new( GTK_ADJUSTMENT( adjustment ), 1, 4 ); - gtk_widget_show( vscale_value_spinbutton ); gtk_table_attach( GTK_TABLE( table1 ), vscale_value_spinbutton, 1, 2, 4, 5, (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), (GtkAttachOptions) ( 0 ), 0, 0 ); gtk_spin_button_set_update_policy( GTK_SPIN_BUTTON( vscale_value_spinbutton ), GTK_UPDATE_IF_VALID ); - g_object_set( vscale_value_spinbutton, "xalign", 1.0, NULL ); + gtk_spin_button_set_numeric( GTK_SPIN_BUTTON( vscale_value_spinbutton ), TRUE ); + gtk_entry_set_alignment( GTK_ENTRY( vscale_value_spinbutton ), 1.0 ); //right + gtk_widget_show( vscale_value_spinbutton ); - adjustment = gtk_adjustment_new( 0.0, -360.0, 360.0, 1.0, 10.0, 0.0 ); + + adjustment = GTK_ADJUSTMENT( gtk_adjustment_new( 0.0, -360.0, 360.0, 1.0, 10.0, 0.0 ) ); rotate_value_spinbutton = gtk_spin_button_new( GTK_ADJUSTMENT( adjustment ), 1, 2 ); - gtk_widget_show( rotate_value_spinbutton ); gtk_table_attach( GTK_TABLE( table1 ), rotate_value_spinbutton, 1, 2, 5, 6, (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), (GtkAttachOptions) ( 0 ), 0, 0 ); gtk_spin_button_set_update_policy( GTK_SPIN_BUTTON( rotate_value_spinbutton ), GTK_UPDATE_IF_VALID ); + gtk_spin_button_set_numeric( GTK_SPIN_BUTTON( rotate_value_spinbutton ), TRUE ); gtk_spin_button_set_wrap( GTK_SPIN_BUTTON( rotate_value_spinbutton ), TRUE ); - g_object_set( rotate_value_spinbutton, "xalign", 1.0, NULL ); + gtk_entry_set_alignment( GTK_ENTRY( rotate_value_spinbutton ), 1.0 ); //right + gtk_widget_show( rotate_value_spinbutton ); // Step Spins - adjustment = gtk_adjustment_new( 0.0, -8192.0, 8192.0, 2.0, 8.0, 0.0 ); + adjustment = GTK_ADJUSTMENT( gtk_adjustment_new( 0.0, -8192.0, 8192.0, 2.0, 8.0, 0.0 ) ); hshift_step_spinbutton = gtk_spin_button_new( GTK_ADJUSTMENT( adjustment ), 1, 2 ); - gtk_widget_show( hshift_step_spinbutton ); gtk_table_attach( GTK_TABLE( table1 ), hshift_step_spinbutton, 2, 3, 1, 2, (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), (GtkAttachOptions) ( 0 ), 0, 0 ); gtk_spin_button_set_update_policy( GTK_SPIN_BUTTON( hshift_step_spinbutton ), GTK_UPDATE_IF_VALID ); - g_object_set( hshift_step_spinbutton, "xalign", 1.0, NULL ); + gtk_spin_button_set_numeric( GTK_SPIN_BUTTON( hshift_step_spinbutton ), TRUE ); + gtk_entry_set_alignment( GTK_ENTRY( hshift_step_spinbutton ), 1.0 ); //right + gtk_widget_show( hshift_step_spinbutton ); - adjustment = gtk_adjustment_new( 0.0, -8192.0, 8192.0, 2.0, 8.0, 0.0 ); + + adjustment = GTK_ADJUSTMENT( gtk_adjustment_new( 0.0, -8192.0, 8192.0, 2.0, 8.0, 0.0 ) ); vshift_step_spinbutton = gtk_spin_button_new( GTK_ADJUSTMENT( adjustment ), 1, 2 ); - gtk_widget_show( vshift_step_spinbutton ); gtk_table_attach( GTK_TABLE( table1 ), vshift_step_spinbutton, 2, 3, 2, 3, (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), (GtkAttachOptions) ( 0 ), 0, 0 ); gtk_spin_button_set_update_policy( GTK_SPIN_BUTTON( vshift_step_spinbutton ), GTK_UPDATE_IF_VALID ); - g_object_set( vshift_step_spinbutton, "xalign", 1.0, NULL ); + gtk_spin_button_set_numeric( GTK_SPIN_BUTTON( vshift_step_spinbutton ), TRUE ); + gtk_entry_set_alignment( GTK_ENTRY( vshift_step_spinbutton ), 1.0 ); //right + gtk_widget_show( vshift_step_spinbutton ); - adjustment = gtk_adjustment_new( 0.0, -1024.0, 1024.0, 1.0, 4.0, 0.0 ); + + adjustment = GTK_ADJUSTMENT( gtk_adjustment_new( 0.0, -1024.0, 1024.0, 1.0, 4.0, 0.0 ) ); hscale_step_spinbutton = gtk_spin_button_new( GTK_ADJUSTMENT( adjustment ), 1, 4 ); - gtk_widget_show( hscale_step_spinbutton ); gtk_table_attach( GTK_TABLE( table1 ), hscale_step_spinbutton, 2, 3, 3, 4, (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), (GtkAttachOptions) ( 0 ), 0, 0 ); gtk_spin_button_set_update_policy( GTK_SPIN_BUTTON( hscale_step_spinbutton ), GTK_UPDATE_IF_VALID ); - g_object_set( hscale_step_spinbutton, "xalign", 1.0, NULL ); + gtk_spin_button_set_numeric( GTK_SPIN_BUTTON( hscale_step_spinbutton ), TRUE ); + gtk_entry_set_alignment( GTK_ENTRY( hscale_step_spinbutton ), 1.0 ); //right + gtk_widget_show( hscale_step_spinbutton ); - adjustment = gtk_adjustment_new( 0.0, -1024.0, 1024.0, 1.0, 4.0, 0.0 ); + + adjustment = GTK_ADJUSTMENT( gtk_adjustment_new( 0.0, -1024.0, 1024.0, 1.0, 4.0, 0.0 ) ); vscale_step_spinbutton = gtk_spin_button_new( GTK_ADJUSTMENT( adjustment ), 1, 4 ); - gtk_widget_show( vscale_step_spinbutton ); gtk_table_attach( GTK_TABLE( table1 ), vscale_step_spinbutton, 2, 3, 4, 5, (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), (GtkAttachOptions) ( 0 ), 0, 0 ); gtk_spin_button_set_update_policy( GTK_SPIN_BUTTON( vscale_step_spinbutton ), GTK_UPDATE_IF_VALID ); - g_object_set( vscale_step_spinbutton, "xalign", 1.0, NULL ); + gtk_spin_button_set_numeric( GTK_SPIN_BUTTON( vscale_step_spinbutton ), TRUE ); + gtk_entry_set_alignment( GTK_ENTRY( vscale_step_spinbutton ), 1.0 ); //right + gtk_widget_show( vscale_step_spinbutton ); - adjustment = gtk_adjustment_new( 0.0, -360.0, 360.0, 1.0, 10.0, 0.0 ); + + adjustment = GTK_ADJUSTMENT( gtk_adjustment_new( 0.0, -360.0, 360.0, 1.0, 10.0, 0.0 ) ); rotate_step_spinbutton = gtk_spin_button_new( GTK_ADJUSTMENT( adjustment ), 1, 2 ); - gtk_widget_show( rotate_step_spinbutton ); gtk_table_attach( GTK_TABLE( table1 ), rotate_step_spinbutton, 2, 3, 5, 6, (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), (GtkAttachOptions) ( 0 ), 0, 0 ); gtk_spin_button_set_update_policy( GTK_SPIN_BUTTON( rotate_step_spinbutton ), GTK_UPDATE_IF_VALID ); - g_object_set( rotate_step_spinbutton, "xalign", 1.0, NULL ); + gtk_spin_button_set_numeric( GTK_SPIN_BUTTON( rotate_step_spinbutton ), TRUE ); + gtk_entry_set_alignment( GTK_ENTRY( rotate_step_spinbutton ), 1.0 ); //right + gtk_widget_show( rotate_step_spinbutton ); + match_grid_button = gtk_button_new_with_mnemonic( _( "Match Grid" ) ); - gtk_widget_show( match_grid_button ); gtk_table_attach( GTK_TABLE( table1 ), match_grid_button, 2, 3, 6, 7, (GtkAttachOptions) ( GTK_FILL ), (GtkAttachOptions) ( 0 ), 0, 0 ); + gtk_widget_show( match_grid_button ); frame2 = gtk_frame_new( _( "Tools" ) ); - gtk_widget_show( frame2 ); gtk_container_add( GTK_CONTAINER( vbox1 ), frame2 ); + gtk_widget_show( frame2 ); table2 = gtk_table_new( 2, 4, TRUE ); - gtk_widget_show( table2 ); gtk_table_set_col_spacings( GTK_TABLE( table2), 5 ); gtk_table_set_row_spacings( GTK_TABLE( table2 ), 0 ); gtk_container_set_border_width( GTK_CONTAINER( table2 ), 5 ); gtk_container_add( GTK_CONTAINER( frame2 ), table2 ); + gtk_widget_show( table2 ); label = gtk_label_new( _( "Height" ) ); - gtk_widget_show( label ); gtk_table_attach( GTK_TABLE( table2 ), label, 3, 4, 0, 1, (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), (GtkAttachOptions) ( 0 ), 0, 0 ); + gtk_widget_show( label ); label = gtk_label_new( _( "Width" ) ); - gtk_widget_show( label ); gtk_table_attach( GTK_TABLE( table2 ), label, 2, 3, 0, 1, (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), (GtkAttachOptions) ( 0 ), 0, 0 ); + gtk_widget_show( label ); label = gtk_label_new( _( "Brush" ) ); - gtk_widget_show( label ); gtk_table_attach( GTK_TABLE( table2 ), label, 0, 2, 0, 1, (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), (GtkAttachOptions) ( 0 ), 0, 0 ); + gtk_widget_show( label ); - adjustment = gtk_adjustment_new( 1, 1, 32, 1, 10, 0 ); + adjustment = GTK_ADJUSTMENT( gtk_adjustment_new( 1, 1, 32, 1, 10, 0 ) ); fit_height_spinbutton = gtk_spin_button_new( GTK_ADJUSTMENT( adjustment ), 1, 0 ); - gtk_widget_show( fit_height_spinbutton ); gtk_table_attach( GTK_TABLE( table2 ), fit_height_spinbutton, 3, 4, 1, 2, (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), (GtkAttachOptions) ( 0 ), 0, 0 ); gtk_spin_button_set_numeric( GTK_SPIN_BUTTON( fit_height_spinbutton ), TRUE ); gtk_spin_button_set_update_policy( GTK_SPIN_BUTTON( fit_height_spinbutton ), GTK_UPDATE_IF_VALID ); - g_object_set( fit_height_spinbutton, "xalign", 1.0, NULL ); + gtk_entry_set_alignment( GTK_ENTRY( fit_height_spinbutton ), 1.0 ); //right + gtk_widget_show( fit_height_spinbutton ); - adjustment = gtk_adjustment_new( 1, 1, 32, 1, 10, 0 ); + adjustment = GTK_ADJUSTMENT( gtk_adjustment_new( 1, 1, 32, 1, 10, 0 ) ); fit_width_spinbutton = gtk_spin_button_new( GTK_ADJUSTMENT( adjustment ), 1, 0 ); - gtk_widget_show( fit_width_spinbutton ); gtk_table_attach( GTK_TABLE( table2 ), fit_width_spinbutton, 2, 3, 1, 2, (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), (GtkAttachOptions) ( 0 ), 0, 0 ); gtk_spin_button_set_numeric( GTK_SPIN_BUTTON( fit_width_spinbutton ), TRUE ); gtk_spin_button_set_update_policy( GTK_SPIN_BUTTON( fit_width_spinbutton ), GTK_UPDATE_IF_VALID ); - g_object_set( fit_width_spinbutton, "xalign", 1.0, NULL ); + gtk_entry_set_alignment( GTK_ENTRY( fit_width_spinbutton ), 1.0 ); //right + gtk_widget_show( fit_width_spinbutton ); fit_button = gtk_button_new_with_mnemonic( _( "Fit" ) ); - gtk_widget_show( fit_button ); gtk_table_attach( GTK_TABLE( table2 ), fit_button, 1, 2, 1, 2, (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), (GtkAttachOptions) ( 0 ), 0, 0 ); + gtk_widget_show( fit_button ); axial_button = gtk_button_new_with_mnemonic( _( "Axial" ) ); - gtk_widget_show( axial_button ); gtk_table_attach( GTK_TABLE( table2 ), axial_button, 0, 1, 1, 2, (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), (GtkAttachOptions) ( 0 ), 0, 0 ); + gtk_widget_show( axial_button ); + + size_group = gtk_size_group_new( GTK_SIZE_GROUP_BOTH ); + gtk_size_group_add_widget( size_group, axial_button ); + gtk_size_group_add_widget( size_group, fit_button ); + g_object_unref( size_group ); // Add the SURF_ and CONTENTS_ flags frame create_SurfaceFlagsFrame( vbox1 ); @@ -877,7 +899,7 @@ GtkWidget* create_SurfaceInspector( void ){ gboolean on_texture_combo_entry_key_press_event( GtkWidget *widget, GdkEventKey *event, gpointer user_data ){ // Have Tab activate selection as well as Return - if ( event->keyval == GDK_Tab ) { + if ( event->keyval == GDK_KEY_Tab ) { g_signal_emit_by_name( texture_combo_entry, "activate" ); } diff --git a/plugins/surface_idtech2/surfaceflags.cpp b/plugins/surface_idtech2/surfaceflags.cpp index acb1db14..07f8e2d4 100644 --- a/plugins/surface_idtech2/surfaceflags.cpp +++ b/plugins/surface_idtech2/surfaceflags.cpp @@ -305,28 +305,29 @@ GtkWidget* create_SurfaceFlagsFrame( GtkWidget* surfacedialog_widget ){ char buffer[8]; frame1 = gtk_frame_new( _( "Flags" ) ); - gtk_widget_show( frame1 ); gtk_container_add( GTK_CONTAINER( surfacedialog_widget ), frame1 ); + gtk_widget_show( frame1 ); vbox1 = gtk_vbox_new( FALSE, 0 ); - gtk_widget_show( vbox1 ); gtk_container_add( GTK_CONTAINER( frame1 ), vbox1 ); + gtk_widget_show( vbox1 ); notebook1 = gtk_notebook_new(); - gtk_widget_show( notebook1 ); gtk_box_pack_start( GTK_BOX( vbox1 ), notebook1, TRUE, TRUE, 0 ); gtk_notebook_set_show_tabs( GTK_NOTEBOOK( notebook1 ), TRUE ); gtk_container_set_border_width( GTK_CONTAINER( notebook1 ), 5 ); + gtk_widget_show( notebook1 ); vbox2 = gtk_vbox_new( FALSE, 5 ); - gtk_widget_show( vbox2 ); gtk_container_add( GTK_CONTAINER( notebook1 ), vbox2 ); + gtk_widget_show( vbox2 ); table4 = gtk_table_new( 8, 4, TRUE ); - gtk_widget_show( table4 ); gtk_table_set_col_spacings( GTK_TABLE( table4 ), 5 ); gtk_table_set_row_spacings( GTK_TABLE( table4 ), 5 ); gtk_box_pack_start( GTK_BOX( vbox2 ), table4, TRUE, TRUE, 0 ); + gtk_container_set_border_width( GTK_CONTAINER( table4 ), 5 ); + gtk_widget_show( table4 ); y = -1; for ( i = 0; i < MAX_BUTTONS; i++ ) { @@ -339,27 +340,28 @@ GtkWidget* create_SurfaceFlagsFrame( GtkWidget* surfacedialog_widget ){ //Sys_Printf( "%s: %s\n", buffer, buttonLabel ); surface_buttons[i] = gtk_toggle_button_new_with_label( buttonLabel ); g_signal_connect( G_OBJECT( surface_buttons[i] ), "toggled", G_CALLBACK( on_surface_button_toggled ), GINT_TO_POINTER( 1 << i ) ); - gtk_widget_show( surface_buttons[i] ); gtk_table_attach( GTK_TABLE( table4 ), surface_buttons[i], 0 + x, 1 + x, ( 0 + y ), ( 1 + y ), (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), 0, 0 ); + gtk_widget_show( surface_buttons[i] ); } hbox2 = gtk_hbox_new( FALSE, 0 ); - gtk_widget_show( hbox2 ); gtk_box_pack_start( GTK_BOX( vbox2 ), hbox2, FALSE, FALSE, 0 ); + gtk_container_set_border_width( GTK_CONTAINER( hbox2 ), 4 ); + gtk_widget_show( hbox2 ); hbox3 = gtk_hbox_new( FALSE, 0 ); - gtk_widget_show( hbox3 ); gtk_box_pack_start( GTK_BOX( hbox2 ), hbox3, TRUE, TRUE, 0 ); + gtk_widget_show( hbox3 ); vbox4 = gtk_vbox_new( FALSE, 0 ); - gtk_widget_show( vbox4 ); gtk_box_pack_start( GTK_BOX( hbox3 ), vbox4, TRUE, TRUE, 0 ); + gtk_widget_show( vbox4 ); value_label = gtk_label_new( _( "Value: " ) ); - gtk_widget_show( value_label ); gtk_box_pack_start( GTK_BOX( hbox3 ), value_label, FALSE, FALSE, 0 ); + gtk_widget_show( value_label ); value_entry = gtk_entry_new(); g_signal_connect( G_OBJECT( value_entry ), "changed", @@ -369,22 +371,24 @@ GtkWidget* create_SurfaceFlagsFrame( GtkWidget* surfacedialog_widget ){ G_CALLBACK( on_value_entry_insert_text ), NULL ); gtk_entry_set_max_length( (GtkEntry *)value_entry, 11 ); - gtk_widget_show( value_entry ); gtk_box_pack_start( GTK_BOX( hbox3 ), value_entry, TRUE, TRUE, 0 ); + gtk_entry_set_alignment( GTK_ENTRY( value_entry ), 1.0 ); //right + gtk_widget_show( value_entry ); vbox3 = gtk_vbox_new( FALSE, 0 ); - gtk_widget_show( vbox3 ); gtk_box_pack_start( GTK_BOX( hbox3 ), vbox3, TRUE, TRUE, 0 ); + gtk_widget_show( vbox3 ); label5 = gtk_label_new( _( "Surface Flags" ) ); - gtk_widget_show( label5 ); gtk_notebook_set_tab_label( GTK_NOTEBOOK( notebook1 ), gtk_notebook_get_nth_page( GTK_NOTEBOOK( notebook1 ), 0 ), label5 ); + gtk_widget_show( label5 ); table3 = gtk_table_new( 8, 4, TRUE ); - gtk_widget_show( table3 ); gtk_table_set_col_spacings( GTK_TABLE( table3 ), 5 ); gtk_table_set_row_spacings( GTK_TABLE( table3 ), 5 ); gtk_container_add( GTK_CONTAINER( notebook1 ), table3 ); + gtk_container_set_border_width( GTK_CONTAINER( table3 ), 5 ); + gtk_widget_show( table3 ); y = -1; for ( i = 0; i < MAX_BUTTONS; i++ ) { @@ -396,10 +400,10 @@ GtkWidget* create_SurfaceFlagsFrame( GtkWidget* surfacedialog_widget ){ buttonLabel = g_FuncTable.m_pfnReadProjectKey( buffer ); content_buttons[i] = gtk_toggle_button_new_with_label( buttonLabel ); g_signal_connect( G_OBJECT( content_buttons[i] ), "toggled", G_CALLBACK( on_content_button_toggled ), GINT_TO_POINTER( 1 << i ) ); - gtk_widget_show( content_buttons[i] ); gtk_table_attach( GTK_TABLE( table3 ), content_buttons[i], 0 + x, 1 + x, ( 0 + y ), ( 1 + y ), (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), 0, 0 ); + gtk_widget_show( content_buttons[i] ); } label6 = gtk_label_new( _( "Content Flags" ) ); diff --git a/plugins/textool/TexTool.cpp b/plugins/textool/TexTool.cpp index 40322b90..993b67bc 100644 --- a/plugins/textool/TexTool.cpp +++ b/plugins/textool/TexTool.cpp @@ -28,137 +28,7 @@ #include "StdAfx.h" -static void dialog_button_callback( GtkWidget *widget, gpointer data ){ - GtkWidget *parent; - int *loop, *ret; - parent = gtk_widget_get_toplevel( widget ); - loop = (int*)g_object_get_data( G_OBJECT( parent ), "loop" ); - ret = (int*)g_object_get_data( G_OBJECT( parent ), "ret" ); - - *loop = 0; - *ret = (intptr_t) data; -} - -static gint dialog_delete_callback( GtkWidget *widget, GdkEvent* event, gpointer data ){ - int *loop; - - gtk_widget_hide( widget ); - loop = (int*)g_object_get_data( G_OBJECT( widget ), "loop" ); - *loop = 0; - - return TRUE; -} - -int DoMessageBox( const char* lpText, const char* lpCaption, guint32 uType ){ - GtkWidget *window, *w, *vbox, *hbox; - int mode = ( uType & MB_TYPEMASK ), ret, loop = 1; - - window = gtk_window_new( GTK_WINDOW_TOPLEVEL ); - g_signal_connect( G_OBJECT( window ), "delete-event", - G_CALLBACK( dialog_delete_callback ), NULL ); - g_signal_connect( G_OBJECT( window ), "destroy", - G_CALLBACK( gtk_widget_destroy ), NULL ); - gtk_window_set_title( GTK_WINDOW( window ), lpCaption ); - gtk_container_set_border_width( GTK_CONTAINER( window ), 10 ); - g_object_set_data( G_OBJECT( window ), "loop", &loop ); - g_object_set_data( G_OBJECT( window ), "ret", &ret ); - gtk_widget_realize( window ); - - vbox = gtk_vbox_new( FALSE, 10 ); - gtk_container_add( GTK_CONTAINER( window ), vbox ); - gtk_widget_show( vbox ); - - w = gtk_label_new( lpText ); - gtk_box_pack_start( GTK_BOX( vbox ), w, FALSE, FALSE, 2 ); - gtk_label_set_justify( GTK_LABEL( w ), GTK_JUSTIFY_LEFT ); - gtk_widget_show( w ); - - w = gtk_hseparator_new(); - gtk_box_pack_start( GTK_BOX( vbox ), w, FALSE, FALSE, 2 ); - gtk_widget_show( w ); - - hbox = gtk_hbox_new( FALSE, 10 ); - gtk_box_pack_start( GTK_BOX( vbox ), hbox, FALSE, FALSE, 2 ); - gtk_widget_show( hbox ); - - if ( mode == MB_OK ) { - w = gtk_button_new_with_label( _( "Ok" ) ); - gtk_box_pack_start( GTK_BOX( hbox ), w, TRUE, TRUE, 0 ); - g_signal_connect( G_OBJECT( w ), "clicked", - G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( IDOK ) ); - gtk_widget_set_can_default( w, TRUE ); - gtk_widget_grab_default( w ); - gtk_widget_show( w ); - ret = IDOK; - } - else if ( mode == MB_OKCANCEL ) { - w = gtk_button_new_with_label( _( "Ok" ) ); - gtk_box_pack_start( GTK_BOX( hbox ), w, TRUE, TRUE, 0 ); - g_signal_connect( G_OBJECT( w ), "clicked", - G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( IDOK ) ); - gtk_widget_set_can_default( w, TRUE ); - gtk_widget_grab_default( w ); - gtk_widget_show( w ); - - w = gtk_button_new_with_label( _( "Cancel" ) ); - gtk_box_pack_start( GTK_BOX( hbox ), w, TRUE, TRUE, 0 ); - g_signal_connect( G_OBJECT( w ), "clicked", - G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( IDCANCEL ) ); - gtk_widget_show( w ); - ret = IDCANCEL; - } - else if ( mode == MB_YESNOCANCEL ) { - w = gtk_button_new_with_label( _( "Yes" ) ); - gtk_box_pack_start( GTK_BOX( hbox ), w, TRUE, TRUE, 0 ); - g_signal_connect( G_OBJECT( w ), "clicked", - G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( IDYES ) ); - gtk_widget_set_can_default( w, TRUE ); - gtk_widget_grab_default( w ); - gtk_widget_show( w ); - - w = gtk_button_new_with_label( _( "No" ) ); - gtk_box_pack_start( GTK_BOX( hbox ), w, TRUE, TRUE, 0 ); - g_signal_connect( G_OBJECT( w ), "clicked", - G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( IDNO ) ); - gtk_widget_show( w ); - - w = gtk_button_new_with_label( _( "Cancel" ) ); - gtk_box_pack_start( GTK_BOX( hbox ), w, TRUE, TRUE, 0 ); - g_signal_connect( G_OBJECT( w ), "clicked", - G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( IDCANCEL ) ); - gtk_widget_show( w ); - ret = IDCANCEL; - } - else /* if (mode == MB_YESNO) */ - { - w = gtk_button_new_with_label( _( "Yes" ) ); - gtk_box_pack_start( GTK_BOX( hbox ), w, TRUE, TRUE, 0 ); - g_signal_connect( G_OBJECT( w ), "clicked", - G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( IDYES ) ); - gtk_widget_set_can_default( w, TRUE ); - gtk_widget_grab_default( w ); - gtk_widget_show( w ); - - w = gtk_button_new_with_label( _( "No" ) ); - gtk_box_pack_start( GTK_BOX( hbox ), w, TRUE, TRUE, 0 ); - g_signal_connect( G_OBJECT( w ), "clicked", - G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( IDNO ) ); - gtk_widget_show( w ); - ret = IDNO; - } - - gtk_widget_show( window ); - gtk_grab_add( window ); - - while ( loop ) - gtk_main_iteration(); - - gtk_grab_remove( window ); - gtk_widget_destroy( window ); - - return ret; -} // Radiant function table _QERFuncTable_1 g_FuncTable; @@ -234,6 +104,89 @@ const char *PLUGIN_ABOUT = "Texture Tools for Radiant\n\n" "Gtk port by Leonardo Zide (leo@lokigames.com)\n" "Original version by Timothee \"TTimo\" Besset (timo@qeradiant.com)"; + +int DoMessageBox( const char* lpText, const char* lpCaption, guint32 uType ){ + GtkWidget *dialog, *w, *vbox, *hbox, *content_area; + int mode, ret; + gint response_id; + GtkDialogFlags flags = GTK_DIALOG_DESTROY_WITH_PARENT; + + dialog = gtk_dialog_new_with_buttons( lpCaption, NULL, flags, NULL ); + gtk_window_set_transient_for( GTK_WINDOW( dialog ), GTK_WINDOW( g_pMainWnd ) ); + gtk_container_set_border_width( GTK_CONTAINER( dialog ), 10 ); + + content_area = gtk_dialog_get_content_area( GTK_DIALOG( dialog ) ); + + vbox = gtk_hbox_new( FALSE, 10 ); + gtk_container_add( GTK_CONTAINER( content_area ), vbox ); + gtk_widget_show( vbox ); + + w = gtk_label_new( lpText ); + gtk_box_pack_start( GTK_BOX( vbox ), w, FALSE, FALSE, 2 ); + gtk_label_set_justify( GTK_LABEL( w ), GTK_JUSTIFY_LEFT ); + gtk_label_set_selectable( GTK_LABEL( w ), TRUE ); + gtk_widget_show( w ); + + w = gtk_hseparator_new(); + gtk_box_pack_start( GTK_BOX( vbox ), w, FALSE, FALSE, 2 ); + gtk_widget_show( w ); + + hbox = gtk_hbox_new( FALSE, 10 ); + gtk_box_pack_start( GTK_BOX( vbox ), hbox, FALSE, FALSE, 2 ); + gtk_widget_show( hbox ); + + mode = ( uType & MB_TYPEMASK ); + if ( mode == MB_OK ) { + w = gtk_dialog_add_button( GTK_DIALOG( dialog ), _( "OK" ), GTK_RESPONSE_OK ); + + ret = IDOK; + } + else if ( mode == MB_OKCANCEL ) { + w = gtk_dialog_add_button( GTK_DIALOG( dialog ), _( "OK" ), GTK_RESPONSE_OK ); + w = gtk_dialog_add_button( GTK_DIALOG( dialog ), _( "Cancel" ), GTK_RESPONSE_CANCEL ); + + ret = IDCANCEL; + } + else if ( mode == MB_YESNOCANCEL ) { + w = gtk_dialog_add_button( GTK_DIALOG( dialog ), _( "Yes" ), GTK_RESPONSE_YES ); + w = gtk_dialog_add_button( GTK_DIALOG( dialog ), _( "No" ), GTK_RESPONSE_NO ); + w = gtk_dialog_add_button( GTK_DIALOG( dialog ), _( "Cancel" ), GTK_RESPONSE_CANCEL ); + + ret = IDCANCEL; + } + else /* if (mode == MB_YESNO) */ + { + w = gtk_dialog_add_button( GTK_DIALOG( dialog ), _( "Yes" ), GTK_RESPONSE_YES ); + w = gtk_dialog_add_button( GTK_DIALOG( dialog ), _( "No" ), GTK_RESPONSE_NO ); + + ret = IDNO; + } + + + response_id = gtk_dialog_run( GTK_DIALOG( dialog ) ); + + switch( response_id ) + { + case GTK_RESPONSE_OK: + ret = IDOK; + break; + case GTK_RESPONSE_CANCEL: + ret = IDCANCEL; + break; + case GTK_RESPONSE_YES: + ret = IDYES; + break; + case GTK_RESPONSE_NO: + ret = IDNO; + break; + } + + + gtk_widget_destroy( dialog ); + + return ret; +} + extern "C" void* WINAPI QERPlug_GetFuncTable(){ return &g_FuncTable; } diff --git a/radiant/bp_dlg.cpp b/radiant/bp_dlg.cpp index ff71f8fd..56583795 100644 --- a/radiant/bp_dlg.cpp +++ b/radiant/bp_dlg.cpp @@ -28,56 +28,31 @@ #include "stdafx.h" #include -void BP_dialog_button_callback( GtkWidget *widget, gpointer data ){ - GtkWidget *parent; - int *loop, *ret; - - parent = gtk_widget_get_toplevel( widget ); - loop = (int*)g_object_get_data( G_OBJECT( parent ), "loop" ); - ret = (int*)g_object_get_data( G_OBJECT( parent ), "ret" ); - - *loop = 0; - *ret = GPOINTER_TO_INT( data ); -} - -gint BP_dialog_delete_callback( GtkWidget *widget, GdkEvent* event, gpointer data ){ - int *loop; - - gtk_widget_hide( widget ); - loop = (int*)g_object_get_data( G_OBJECT( widget ), "loop" ); - *loop = 0; - - return TRUE; -} // ret: 0 = abort, 1 = load and convert, 2 = changed project settings, load and don't convert // the user might decide to switch the BP mode in project settings // status: 0 = loading regular, got conflict 1 = loading BP, got conflict int BP_MessageBox( int status ){ - GtkWidget *window, *w, *vbox, *hbox; + GtkWidget *dialog, *w, *vbox, *hbox, *content_area; GtkAccelGroup *accel; - int ret, loop = 1; + gint response_id; + GtkDialogFlags flags = GTK_DIALOG_DESTROY_WITH_PARENT; - window = gtk_window_new( GTK_WINDOW_TOPLEVEL ); - g_signal_connect( G_OBJECT( window ), "delete-event", - G_CALLBACK( BP_dialog_delete_callback ), NULL ); - g_signal_connect( G_OBJECT( window ), "destroy", - G_CALLBACK( gtk_widget_destroy ), NULL ); - - gtk_window_set_title( GTK_WINDOW( window ), _( "Current map format is incompatible" ) ); - - gtk_container_set_border_width( GTK_CONTAINER( window ), 10 ); - g_object_set_data( G_OBJECT( window ), "loop", &loop ); - g_object_set_data( G_OBJECT( window ), "ret", &ret ); - gtk_widget_realize( window ); - - gtk_window_set_transient_for( GTK_WINDOW( window ), GTK_WINDOW( g_pParentWnd->m_pWidget ) ); + dialog = gtk_dialog_new_with_buttons( _( "Current map format is incompatible" ), NULL, flags, NULL ); + gtk_window_set_transient_for( GTK_WINDOW( dialog ), GTK_WINDOW( g_pParentWnd->m_pWidget ) ); + gtk_container_set_border_width( GTK_CONTAINER( dialog ), 10 ); accel = gtk_accel_group_new(); - gtk_window_add_accel_group( GTK_WINDOW( window ), accel ); + gtk_window_add_accel_group( GTK_WINDOW( dialog ), accel ); + + gtk_dialog_add_button( GTK_DIALOG( dialog ), _( "Convert" ), 1 ); + gtk_dialog_add_button( GTK_DIALOG( dialog ), _( "Change default" ), 2 ); + gtk_dialog_add_button( GTK_DIALOG( dialog ), _( "Abort load" ), 0 ); + + content_area = gtk_dialog_get_content_area( GTK_DIALOG( dialog ) ); vbox = gtk_vbox_new( FALSE, 10 ); - gtk_container_add( GTK_CONTAINER( window ), vbox ); + gtk_container_add( GTK_CONTAINER( content_area ), vbox ); gtk_widget_show( vbox ); if ( status == 0 ) { @@ -107,34 +82,10 @@ int BP_MessageBox( int status ){ gtk_box_pack_start( GTK_BOX( vbox ), hbox, FALSE, FALSE, 2 ); gtk_widget_show( hbox ); - w = gtk_button_new_with_label( _( "Convert" ) ); - gtk_box_pack_start( GTK_BOX( hbox ), w, TRUE, TRUE, 0 ); - g_signal_connect( G_OBJECT( w ), "clicked", - G_CALLBACK( BP_dialog_button_callback ), GINT_TO_POINTER( 1 ) ); - GTK_WIDGET_SET_FLAGS( w, GTK_CAN_DEFAULT ); - gtk_widget_grab_default( w ); - gtk_widget_show( w ); - w = gtk_button_new_with_label( _( "Change default" ) ); - gtk_box_pack_start( GTK_BOX( hbox ), w, TRUE, TRUE, 0 ); - g_signal_connect( G_OBJECT( w ), "clicked", - G_CALLBACK( BP_dialog_button_callback ), GINT_TO_POINTER( 2 ) ); - gtk_widget_show( w ); + response_id = gtk_dialog_run( GTK_DIALOG( dialog ) ); - w = gtk_button_new_with_label( _( "Abort load" ) ); - gtk_box_pack_start( GTK_BOX( hbox ), w, TRUE, TRUE, 0 ); - g_signal_connect( G_OBJECT( w ), "clicked", - G_CALLBACK( BP_dialog_button_callback ), GINT_TO_POINTER( 0 ) ); - gtk_widget_show( w ); - ret = 0; // abort - - gtk_widget_show( window ); - gtk_grab_add( window ); - - while ( loop ) - gtk_main_iteration(); - - if ( ret == 2 ) { + if( response_id == 2 ) { // change project settings if ( status == 0 ) { g_qeglobals.m_bBrushPrimitMode = TRUE; @@ -144,9 +95,10 @@ int BP_MessageBox( int status ){ } SetKeyValue( g_qeglobals.d_project_entity, "brush_primit", ( g_qeglobals.m_bBrushPrimitMode ? "1" : "0" ) ); } + if( response_id < 0 ) { + response_id = 0; //default abort + } + gtk_widget_destroy( dialog ); - gtk_grab_remove( window ); - gtk_widget_destroy( window ); - - return ret; + return response_id; } diff --git a/radiant/dialog.cpp b/radiant/dialog.cpp index 05fbe19b..e6ce550a 100644 --- a/radiant/dialog.cpp +++ b/radiant/dialog.cpp @@ -33,7 +33,7 @@ typedef struct { - GtkObject *object; + GObject *object; void *buffer; DLG_DATA_TYPE type; } DLG_DATA; @@ -100,7 +100,7 @@ void Dialog::Destroy(){ } } -void Dialog::AddDialogData( GtkObject *object, void *buf, DLG_DATA_TYPE type ){ +void Dialog::AddDialogData( GObject *object, void *buf, DLG_DATA_TYPE type ){ DLG_DATA *data; data = (DLG_DATA*)qmalloc( sizeof( DLG_DATA ) ); diff --git a/radiant/dialog.h b/radiant/dialog.h index 69779821..7bd22722 100644 --- a/radiant/dialog.h +++ b/radiant/dialog.h @@ -70,8 +70,8 @@ bool m_nLoop; int m_nReturn; void AddDialogData( GtkWidget *widget, void *buf, DLG_DATA_TYPE type ) -{ AddDialogData( GTK_OBJECT( widget ), buf, type ); }; -void AddDialogData( GtkObject *object, void *buf, DLG_DATA_TYPE type ); +{ AddDialogData( G_OBJECT( widget ), buf, type ); }; +void AddDialogData( GObject *object, void *buf, DLG_DATA_TYPE type ); /*! used in overloaded BuildDialog implementations to configure modal behaviour easily */ diff --git a/radiant/dialoginfo.cpp b/radiant/dialoginfo.cpp index 5ce5c9b1..0610bfe0 100644 --- a/radiant/dialoginfo.cpp +++ b/radiant/dialoginfo.cpp @@ -38,19 +38,18 @@ GtkWidget *s_pEdit; void ShowInfoDialog( const char* pText ){ if ( g_dlgInfo == NULL ) { - GtkWidget *dlg, *scr, *text; + GtkWidget *dialog, *scr, *text, *content_area; + GtkDialogFlags flags = GTK_DIALOG_DESTROY_WITH_PARENT; - g_dlgInfo = dlg = gtk_window_new( GTK_WINDOW_TOPLEVEL ); - gtk_window_set_title( GTK_WINDOW( dlg ), _( "Information" ) ); - g_signal_connect( G_OBJECT( dlg ), "delete-event", - G_CALLBACK( gtk_widget_hide ), NULL ); - g_signal_connect( G_OBJECT( dlg ), "destroy", - G_CALLBACK( gtk_widget_destroy ), NULL ); - gtk_window_set_default_size( GTK_WINDOW( dlg ), 300, 150 ); + g_dlgInfo = dialog = gtk_dialog_new_with_buttons( _( "Information" ), NULL, flags, NULL ); + g_signal_connect( G_OBJECT( dialog ), "delete-event", G_CALLBACK( gtk_widget_hide ), NULL ); + gtk_window_set_default_size( GTK_WINDOW( dialog ), 300, 150 ); + + content_area = gtk_dialog_get_content_area( GTK_DIALOG( dialog ) ); scr = gtk_scrolled_window_new( NULL, NULL ); gtk_widget_show( scr ); - gtk_container_add( GTK_CONTAINER( dlg ), scr ); + gtk_container_add( GTK_CONTAINER( content_area ), scr ); gtk_scrolled_window_set_policy( GTK_SCROLLED_WINDOW( scr ), GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC ); gtk_container_set_border_width( GTK_CONTAINER( scr ), 5 ); gtk_scrolled_window_set_shadow_type( GTK_SCROLLED_WINDOW( scr ), GTK_SHADOW_IN ); diff --git a/radiant/findtexturedialog.cpp b/radiant/findtexturedialog.cpp index b73dfd2a..ccc8bcc3 100644 --- a/radiant/findtexturedialog.cpp +++ b/radiant/findtexturedialog.cpp @@ -74,7 +74,7 @@ static void find_clicked( GtkWidget *widget, gpointer data ){ item = gtk_menu_item_new_with_label( pShader->getName() ); g_signal_connect( G_OBJECT( item ), "activate", G_CALLBACK( popup_selected ), data ); gtk_widget_show( item ); - gtk_menu_append( GTK_MENU( menu ), item ); + gtk_menu_shell_append( GTK_MENU_SHELL( menu ), item ); } gtk_menu_popup( GTK_MENU( menu ), NULL, NULL, NULL, NULL, 1, GDK_CURRENT_TIME ); @@ -113,118 +113,116 @@ void FindTextureDialog::BuildDialog(){ gtk_window_set_transient_for( GTK_WINDOW( dlg ), GTK_WINDOW( g_pParentWnd->m_pWidget ) ); hbox = gtk_hbox_new( FALSE, 5 ); - gtk_widget_show( hbox ); gtk_container_add( GTK_CONTAINER( dlg ), hbox ); gtk_container_set_border_width( GTK_CONTAINER( hbox ), 5 ); + gtk_widget_show( hbox ); vbox = gtk_vbox_new( FALSE, 5 ); + gtk_box_pack_start( GTK_BOX( hbox ), vbox, TRUE, TRUE, 5 ); gtk_widget_show( vbox ); - gtk_box_pack_start( GTK_BOX( hbox ), vbox, TRUE, TRUE, 0 ); table = gtk_table_new( 2, 3, FALSE ); - gtk_widget_show( table ); gtk_box_pack_start( GTK_BOX( vbox ), table, TRUE, TRUE, 0 ); gtk_table_set_row_spacings( GTK_TABLE( table ), 5 ); gtk_table_set_col_spacings( GTK_TABLE( table ), 5 ); + gtk_widget_show( table ); label = gtk_label_new( _( "Find:" ) ); - gtk_widget_show( label ); gtk_table_attach( GTK_TABLE( table ), label, 0, 1, 0, 1, (GtkAttachOptions) ( GTK_FILL ), (GtkAttachOptions) ( 0 ), 0, 0 ); gtk_misc_set_alignment( GTK_MISC( label ), 0, 0.5 ); + gtk_widget_show( label ); label = gtk_label_new( _( "Replace:" ) ); - gtk_widget_show( label ); gtk_table_attach( GTK_TABLE( table ), label, 0, 1, 1, 2, (GtkAttachOptions) ( GTK_FILL ), (GtkAttachOptions) ( 0 ), 0, 0 ); gtk_misc_set_alignment( GTK_MISC( label ), 0, 0.5 ); + gtk_widget_show( label ); entry = gtk_entry_new(); - gtk_widget_show( entry ); gtk_table_attach( GTK_TABLE( table ), entry, 1, 2, 0, 1, (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), (GtkAttachOptions) ( 0 ), 0, 0 ); + gtk_widget_show( entry ); g_signal_connect( G_OBJECT( entry ), "focus-in-event", G_CALLBACK( find_focus_in ), NULL ); AddDialogData( entry, &m_strFind, DLG_ENTRY_TEXT ); button = gtk_button_new(); - gtk_widget_show( button ); gtk_table_attach( GTK_TABLE( table ), button, 2, 3, 0, 1, (GtkAttachOptions) ( GTK_FILL ), (GtkAttachOptions) ( GTK_FILL ), 0, 0 ); + gtk_widget_show( button ); g_signal_connect( G_OBJECT( button ), "clicked", G_CALLBACK( find_clicked ), entry ); arrow = gtk_arrow_new( GTK_ARROW_DOWN, GTK_SHADOW_OUT ); - gtk_widget_show( arrow ); gtk_container_add( GTK_CONTAINER( button ), arrow ); + gtk_widget_show( arrow ); entry = gtk_entry_new(); - gtk_widget_show( entry ); gtk_table_attach( GTK_TABLE( table ), entry, 1, 2, 1, 2, (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), (GtkAttachOptions) ( 0 ), 0, 0 ); + gtk_widget_show( entry ); g_signal_connect( G_OBJECT( entry ), "focus-in-event", G_CALLBACK( replace_focus_in ), NULL ); AddDialogData( entry, &m_strReplace, DLG_ENTRY_TEXT ); button = gtk_button_new(); - gtk_widget_show( button ); gtk_table_attach( GTK_TABLE( table ), button, 2, 3, 1, 2, (GtkAttachOptions) ( GTK_FILL ), (GtkAttachOptions) ( GTK_FILL ), 0, 0 ); + gtk_widget_show( button ); g_signal_connect( G_OBJECT( button ), "clicked", G_CALLBACK( find_clicked ), entry ); arrow = gtk_arrow_new( GTK_ARROW_DOWN, GTK_SHADOW_OUT ); - gtk_widget_show( arrow ); gtk_container_add( GTK_CONTAINER( button ), arrow ); + gtk_widget_show( arrow ); check = gtk_check_button_new_with_label( _( "Use selected brushes only" ) ); - gtk_widget_show( check ); gtk_box_pack_start( GTK_BOX( vbox ), check, TRUE, TRUE, 0 ); + gtk_widget_show( check ); AddDialogData( check, &m_bSelectedOnly, DLG_CHECK_BOOL ); check = gtk_check_button_new_with_label( _( "Replace everywhere (selected/active), don't test against Find" ) ); - gtk_widget_show( check ); gtk_box_pack_start( GTK_BOX( vbox ), check, TRUE, TRUE, 0 ); + gtk_widget_show( check ); AddDialogData( check, &m_bForce, DLG_CHECK_BOOL ); check = gtk_check_button_new_with_label( _( "Live updates from Texture/Camera windows" ) ); - gtk_widget_show( check ); gtk_box_pack_start( GTK_BOX( vbox ), check, TRUE, TRUE, 0 ); + gtk_widget_show( check ); AddDialogData( check, &m_bLive, DLG_CHECK_BOOL ); vbox = gtk_vbox_new( FALSE, 5 ); - gtk_widget_show( vbox ); gtk_box_pack_start( GTK_BOX( hbox ), vbox, TRUE, TRUE, 0 ); + gtk_widget_show( vbox ); button = gtk_button_new_with_label( _( "Find" ) ); - gtk_widget_show( button ); gtk_box_pack_start( GTK_BOX( vbox ), button, FALSE, FALSE, 0 ); g_signal_connect( G_OBJECT( button ), "clicked", G_CALLBACK( OnFind ), NULL ); gtk_widget_set_usize( button, 60, -2 ); + gtk_widget_show( button ); button = gtk_button_new_with_label( _( "OK" ) ); - gtk_widget_show( button ); gtk_box_pack_start( GTK_BOX( vbox ), button, FALSE, FALSE, 0 ); g_signal_connect( G_OBJECT( button ), "clicked", G_CALLBACK( OnOK ), NULL ); gtk_widget_set_usize( button, 60, -2 ); + gtk_widget_show( button ); button = gtk_button_new_with_label( _( "Apply" ) ); - gtk_widget_show( button ); gtk_box_pack_start( GTK_BOX( vbox ), button, FALSE, FALSE, 0 ); g_signal_connect( G_OBJECT( button ), "clicked", G_CALLBACK( OnApply ), NULL ); gtk_widget_set_usize( button, 60, -2 ); button = gtk_button_new_with_label( _( "Close" ) ); - gtk_widget_show( button ); gtk_box_pack_start( GTK_BOX( vbox ), button, FALSE, FALSE, 0 ); g_signal_connect( G_OBJECT( button ), "clicked", G_CALLBACK( OnClose ), NULL ); diff --git a/radiant/gtkdlgs.cpp b/radiant/gtkdlgs.cpp index 6d0f3347..f312eafa 100644 --- a/radiant/gtkdlgs.cpp +++ b/radiant/gtkdlgs.cpp @@ -47,6 +47,8 @@ #include #endif +static GtkWidget *EntityList_dialog = NULL; + // ============================================================================= // Color selection dialog @@ -109,82 +111,64 @@ qboolean DoColor( int iIndex ){ static void UpdateBSPCommandList( GtkWidget *dialog ); static void DoProjectAddEdit( bool edit, GtkWidget *parent ){ - GtkWidget *dlg, *vbox, *hbox, *label, *table, *button; - GtkWidget *cmd, *text; - int loop = 1, ret = IDCANCEL; + GtkWidget *dialog, *vbox, *hbox, *label, *table; + GtkWidget *cmd, *text, *content_area; + gint response_id; + GtkDialogFlags flags = GTK_DIALOG_DESTROY_WITH_PARENT; - dlg = gtk_window_new( GTK_WINDOW_TOPLEVEL ); if ( edit ) { - gtk_window_set_title( GTK_WINDOW( dlg ), _( "Edit Command" ) ); + dialog = gtk_dialog_new_with_buttons( _( "Edit Command" ), NULL, flags, NULL, NULL ); } else{ - gtk_window_set_title( GTK_WINDOW( dlg ), _( "Add Command" ) ); + dialog = gtk_dialog_new_with_buttons( _( "Add Command" ), NULL, flags, NULL, NULL ); } - g_signal_connect( G_OBJECT( dlg ), "delete-event", - G_CALLBACK( dialog_delete_callback ), NULL ); - g_signal_connect( G_OBJECT( dlg ), "destroy", - G_CALLBACK( gtk_widget_destroy ), NULL ); - g_object_set_data( G_OBJECT( dlg ), "loop", &loop ); - g_object_set_data( G_OBJECT( dlg ), "ret", &ret ); + gtk_window_set_transient_for( GTK_WINDOW( dialog ), GTK_WINDOW( parent ) ); + + gtk_dialog_add_button( GTK_DIALOG( dialog ), _( "OK" ), GTK_RESPONSE_OK ); + gtk_dialog_add_button( GTK_DIALOG( dialog ), _( "Cancel" ), GTK_RESPONSE_CANCEL ); + + content_area = gtk_dialog_get_content_area( GTK_DIALOG( dialog ) ); vbox = gtk_vbox_new( FALSE, 5 ); - gtk_widget_show( vbox ); - gtk_container_add( GTK_CONTAINER( dlg ), vbox ); + gtk_container_add( GTK_CONTAINER( content_area ), vbox ); gtk_container_set_border_width( GTK_CONTAINER( vbox ), 5 ); + gtk_widget_show( vbox ); table = gtk_table_new( 2, 2, FALSE ); - gtk_widget_show( table ); gtk_box_pack_start( GTK_BOX( vbox ), table, FALSE, TRUE, 0 ); gtk_table_set_row_spacings( GTK_TABLE( table ), 5 ); gtk_table_set_col_spacings( GTK_TABLE( table ), 5 ); + gtk_widget_show( table ); label = gtk_label_new( _( "Menu text" ) ); - gtk_widget_show( label ); gtk_table_attach( GTK_TABLE( table ), label, 0, 1, 0, 1, (GtkAttachOptions) ( GTK_FILL ), (GtkAttachOptions) ( 0 ), 0, 0 ); gtk_misc_set_alignment( GTK_MISC( label ), 1, 0.5 ); + gtk_widget_show( label ); label = gtk_label_new( _( "Command" ) ); - gtk_widget_show( label ); gtk_table_attach( GTK_TABLE( table ), label, 0, 1, 1, 2, (GtkAttachOptions) ( GTK_FILL ), (GtkAttachOptions) ( 0 ), 0, 0 ); gtk_misc_set_alignment( GTK_MISC( label ), 1, 0.5 ); + gtk_widget_show( label ); text = gtk_entry_new(); - g_object_set_data( G_OBJECT( dlg ), "text", text ); + g_object_set_data( G_OBJECT( dialog ), "text", text ); gtk_widget_show( text ); - gtk_table_attach( GTK_TABLE( table ), text, 1, 2, 0, 1, - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), - (GtkAttachOptions) ( 0 ), 0, 0 ); - gtk_widget_set_usize( text, 300, -2 ); + g_object_set_data( G_OBJECT( dialog ), "text", text ); cmd = gtk_entry_new(); - g_object_set_data( G_OBJECT( dlg ), "cmd", cmd ); - gtk_widget_show( cmd ); gtk_table_attach( GTK_TABLE( table ), cmd, 1, 2, 1, 2, (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), (GtkAttachOptions) ( 0 ), 0, 0 ); - gtk_widget_set_usize( cmd, 300, -2 ); + gtk_widget_show( cmd ); + g_object_set_data( G_OBJECT( dialog ), "cmd", cmd ); hbox = gtk_hbox_new( FALSE, 5 ); - gtk_widget_show( hbox ); gtk_box_pack_start( GTK_BOX( vbox ), hbox, FALSE, TRUE, 0 ); - - button = gtk_button_new_with_label( _( "OK" ) ); - gtk_widget_show( button ); - gtk_box_pack_start( GTK_BOX( hbox ), button, FALSE, FALSE, 0 ); - g_signal_connect( G_OBJECT( button ), "clicked", - G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( IDOK ) ); - gtk_widget_set_usize( button, 60, -2 ); - - button = gtk_button_new_with_label( _( "Cancel" ) ); - gtk_widget_show( button ); - gtk_box_pack_start( GTK_BOX( hbox ), button, FALSE, FALSE, 0 ); - g_signal_connect( G_OBJECT( button ), "clicked", - G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( IDCANCEL ) ); - gtk_widget_set_usize( button, 60, -2 ); + gtk_widget_show( hbox ); if ( edit ) { GtkTreeView* view = GTK_TREE_VIEW( g_object_get_data( G_OBJECT( parent ), "view" ) ); @@ -201,13 +185,10 @@ static void DoProjectAddEdit( bool edit, GtkWidget *parent ){ } } - gtk_grab_add( dlg ); - gtk_widget_show( dlg ); - while ( loop ) - gtk_main_iteration(); + response_id = gtk_dialog_run( GTK_DIALOG( dialog ) ); - if ( ret == IDOK ) { + if ( response_id == GTK_RESPONSE_OK ) { const char* key = gtk_entry_get_text( GTK_ENTRY( text ) ); const char* value = gtk_entry_get_text( GTK_ENTRY( cmd ) ); @@ -235,8 +216,7 @@ static void DoProjectAddEdit( bool edit, GtkWidget *parent ){ } } - gtk_grab_remove( dlg ); - gtk_widget_destroy( dlg ); + gtk_widget_destroy( dialog ); } static void UpdateBSPCommandList( GtkWidget *dialog ){ @@ -458,8 +438,9 @@ void OnSelchangeComboWhatgame( GtkWidget *widget, gpointer data ){ } void DoProjectSettings(){ - GtkWidget *project; + GtkWidget *dialog, *content_area; GtkWidget *frame, *label, *vbox, *table1, *table2, *button; + GtkWidget *add_button, *change_button, *remove_button; GtkWidget *brush; GtkWidget *scr, *entry; GtkWidget *base, *game_select; @@ -469,97 +450,80 @@ void DoProjectSettings(){ GList *combo_list = (GList*)NULL; const char *fs_game; qboolean isBasegame; + GtkSizeGroup *button_group; + gint response_id; + GtkDialogFlags flags = GTK_DIALOG_DESTROY_WITH_PARENT; - int loop = 1, ret = IDCANCEL; + dialog = gtk_dialog_new_with_buttons( _( "Project Settings" ), NULL, flags, NULL ); + gtk_window_set_transient_for( GTK_WINDOW( dialog ), GTK_WINDOW( g_pParentWnd->m_pWidget ) ); + gtk_window_set_default_size( GTK_WINDOW( dialog ), 550, 400 ); - project = gtk_window_new( GTK_WINDOW_TOPLEVEL ); - gtk_window_set_title( GTK_WINDOW( project ), _( "Project Settings" ) ); - g_signal_connect( G_OBJECT( project ), "delete-event", - G_CALLBACK( dialog_delete_callback ), NULL ); - g_signal_connect( G_OBJECT( project ), "destroy", - G_CALLBACK( gtk_widget_destroy ), NULL ); - g_object_set_data( G_OBJECT( project ), "loop", &loop ); - g_object_set_data( G_OBJECT( project ), "ret", &ret ); - gtk_window_set_default_size( GTK_WINDOW( project ), 550, 400 ); + gtk_dialog_add_button( GTK_DIALOG( dialog ), _( "OK" ), GTK_RESPONSE_OK ); + gtk_dialog_add_button( GTK_DIALOG( dialog ), _( "Cancel" ), GTK_RESPONSE_CANCEL ); + + content_area = gtk_dialog_get_content_area( GTK_DIALOG( dialog ) ); table1 = gtk_table_new( 3, 2, FALSE ); - gtk_widget_show( table1 ); - gtk_container_add( GTK_CONTAINER( project ), table1 ); + gtk_container_add( GTK_CONTAINER( content_area ), table1 ); gtk_container_set_border_width( GTK_CONTAINER( table1 ), 5 ); gtk_table_set_row_spacings( GTK_TABLE( table1 ), 5 ); gtk_table_set_col_spacings( GTK_TABLE( table1 ), 5 ); + gtk_widget_show( table1 ); vbox = gtk_vbox_new( FALSE, 5 ); - gtk_widget_show( vbox ); - gtk_table_attach( GTK_TABLE( table1 ), vbox, 1, 2, 0, 1, - (GtkAttachOptions) ( GTK_FILL ), - (GtkAttachOptions) ( GTK_FILL ), 0, 0 ); - - button = gtk_button_new_with_label( _( "OK" ) ); - gtk_widget_show( button ); - gtk_box_pack_start( GTK_BOX( vbox ), button, FALSE, FALSE, 0 ); - g_signal_connect( G_OBJECT( button ), "clicked", - G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( IDOK ) ); - gtk_widget_set_usize( button, 60, -2 ); - - button = gtk_button_new_with_label( _( "Cancel" ) ); - gtk_widget_show( button ); - gtk_box_pack_start( GTK_BOX( vbox ), button, FALSE, FALSE, 0 ); - g_signal_connect( G_OBJECT( button ), "clicked", - G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( IDCANCEL ) ); - gtk_widget_set_usize( button, 60, -2 ); - - vbox = gtk_vbox_new( FALSE, 5 ); - gtk_widget_show( vbox ); gtk_table_attach( GTK_TABLE( table1 ), vbox, 1, 2, 1, 2, (GtkAttachOptions) ( GTK_FILL ), (GtkAttachOptions) ( GTK_FILL ), 0, 0 ); + gtk_widget_show( vbox ); - button = gtk_button_new_with_label( _( "Add..." ) ); - gtk_widget_show( button ); + add_button = button = gtk_button_new_with_label( _( "Add..." ) ); gtk_box_pack_start( GTK_BOX( vbox ), button, FALSE, FALSE, 0 ); g_signal_connect( G_OBJECT( button ), "clicked", - G_CALLBACK( project_add ), project ); - gtk_widget_set_usize( button, 60, -2 ); - - button = gtk_button_new_with_label( _( "Change..." ) ); + G_CALLBACK( project_add ), dialog ); gtk_widget_show( button ); + + change_button = button = gtk_button_new_with_label( _( "Change..." ) ); gtk_box_pack_start( GTK_BOX( vbox ), button, FALSE, FALSE, 0 ); g_signal_connect( G_OBJECT( button ), "clicked", - G_CALLBACK( project_change ), project ); - gtk_widget_set_usize( button, 60, -2 ); - - button = gtk_button_new_with_label( _( "Remove" ) ); + G_CALLBACK( project_change ), dialog ); gtk_widget_show( button ); + + remove_button = button = gtk_button_new_with_label( _( "Remove" ) ); gtk_box_pack_start( GTK_BOX( vbox ), button, FALSE, FALSE, 0 ); g_signal_connect( G_OBJECT( button ), "clicked", - G_CALLBACK( project_remove ), project ); - gtk_widget_set_usize( button, 60, -2 ); + G_CALLBACK( project_remove ), dialog ); + gtk_widget_show( button ); frame = gtk_frame_new( _( "Misc settings" ) ); - gtk_widget_show( frame ); gtk_table_attach( GTK_TABLE( table1 ), frame, 0, 1, 2, 3, (GtkAttachOptions) ( GTK_FILL ), (GtkAttachOptions) ( GTK_FILL ), 0, 0 ); + gtk_widget_show( frame ); + + button_group = gtk_size_group_new( GTK_SIZE_GROUP_BOTH ); + gtk_size_group_add_widget( button_group, add_button ); + gtk_size_group_add_widget( button_group, change_button ); + gtk_size_group_add_widget( button_group, remove_button ); + g_object_unref( button_group ); brush = gtk_check_button_new_with_label( _( "Use brush primitives in MAP files (NOTE: experimental feature,\n" "required by the texture tools plugin)" ) ); - gtk_widget_show( brush ); gtk_container_add( GTK_CONTAINER( frame ), brush ); gtk_container_set_border_width( GTK_CONTAINER( brush ), 5 ); + gtk_widget_show( brush ); frame = gtk_frame_new( _( "Menu commands" ) ); - gtk_widget_show( frame ); gtk_table_attach( GTK_TABLE( table1 ), frame, 0, 1, 1, 2, (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), 0, 0 ); + gtk_widget_show( frame ); scr = gtk_scrolled_window_new( (GtkAdjustment*)NULL, (GtkAdjustment*)NULL ); - gtk_widget_show( scr ); gtk_container_add( GTK_CONTAINER( frame ), scr ); gtk_container_set_border_width( GTK_CONTAINER( scr ), 5 ); gtk_scrolled_window_set_policy( GTK_SCROLLED_WINDOW( scr ), GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC ); gtk_scrolled_window_set_shadow_type( GTK_SCROLLED_WINDOW( scr ), GTK_SHADOW_IN ); + gtk_widget_show( scr ); { @@ -577,25 +541,25 @@ void DoProjectSettings(){ gtk_widget_show( view ); - g_object_set_data( G_OBJECT( project ), "view", view ); - g_object_set_data( G_OBJECT( project ), "bsp_commands", store ); + g_object_set_data( G_OBJECT( dialog ), "view", view ); + g_object_set_data( G_OBJECT( dialog ), "bsp_commands", store ); gtk_container_add( GTK_CONTAINER( scr ), view ); g_object_unref( G_OBJECT( store ) ); } frame = gtk_frame_new( _( "Project settings" ) ); - gtk_widget_show( frame ); gtk_table_attach( GTK_TABLE( table1 ), frame, 0, 1, 0, 1, (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), (GtkAttachOptions) ( GTK_FILL ), 0, 0 ); + gtk_widget_show( frame ); table2 = gtk_table_new( 9, 2, FALSE ); - gtk_widget_show( table2 ); gtk_container_add( GTK_CONTAINER( frame ), table2 ); gtk_container_set_border_width( GTK_CONTAINER( table2 ), 5 ); gtk_table_set_row_spacings( GTK_TABLE( table2 ), 5 ); gtk_table_set_col_spacings( GTK_TABLE( table2 ), 5 ); + gtk_widget_show( table2 ); mod_list = newModListForGameFile( g_pGameDescription->mGameFile ); game_select = gtk_combo_new(); @@ -609,23 +573,22 @@ void DoProjectSettings(){ gtk_combo_set_popdown_strings( GTK_COMBO( game_select ), combo_list ); g_list_free( combo_list ); - gtk_widget_show( game_select ); gtk_table_attach( GTK_TABLE( table2 ), game_select, 1, 2, 6, 7, (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), (GtkAttachOptions) ( 0 ), 0, 0 ); - + gtk_widget_show( game_select ); g_signal_connect( G_OBJECT( GTK_COMBO( game_select )->entry ), "changed", - G_CALLBACK( OnSelchangeComboWhatgame ), project ); - g_object_set_data( G_OBJECT( project ), "game_select", game_select ); + G_CALLBACK( OnSelchangeComboWhatgame ), dialog ); + g_object_set_data( G_OBJECT( dialog ), "game_select", game_select ); gtk_entry_set_editable( GTK_ENTRY( GTK_COMBO( game_select )->entry ), FALSE ); fs_game_entry = entry = gtk_entry_new(); gtk_widget_set_sensitive( GTK_WIDGET( fs_game_entry ), false ); - gtk_widget_show( entry ); gtk_table_attach( GTK_TABLE( table2 ), entry, 1, 2, 7, 8, (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), (GtkAttachOptions) ( 0 ), 0, 0 ); - g_object_set_data( G_OBJECT( project ), "fs_game_entry", entry ); + gtk_widget_show( entry ); + g_object_set_data( G_OBJECT( dialog ), "fs_game_entry", entry ); fs_game = ValueForKey( g_qeglobals.d_project_entity, "gamename" ); isBasegame = qtrue; @@ -725,49 +688,46 @@ void DoProjectSettings(){ */ base = gtk_entry_new(); - g_object_set_data( G_OBJECT( project ), "base", base ); - gtk_widget_show( base ); + g_object_set_data( G_OBJECT( dialog ), "base", base ); gtk_table_attach( GTK_TABLE( table2 ), base, 1, 2, 0, 1, (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), (GtkAttachOptions) ( 0 ), 0, 0 ); + gtk_widget_show( base ); label = gtk_label_new( _( "basepath" ) ); - gtk_widget_show( label ); gtk_table_attach( GTK_TABLE( table2 ), label, 0, 1, 0, 1, (GtkAttachOptions) ( GTK_FILL ), (GtkAttachOptions) ( 0 ), 0, 0 ); gtk_misc_set_alignment( GTK_MISC( label ), 1, 0.5 ); + gtk_widget_show( label ); label = gtk_label_new( _( "Select mod" ) ); - gtk_widget_show( label ); gtk_table_attach( GTK_TABLE( table2 ), label, 0, 1, 6, 7, (GtkAttachOptions) ( GTK_FILL ), (GtkAttachOptions) ( 0 ), 0, 0 ); gtk_misc_set_alignment( GTK_MISC( label ), 1, 0.5 ); + gtk_widget_show( label ); label = gtk_label_new( _( "fs_game" ) ); - gtk_widget_show( label ); gtk_table_attach( GTK_TABLE( table2 ), label, 0, 1, 7, 8, (GtkAttachOptions) ( GTK_FILL ), (GtkAttachOptions) ( 0 ), 0, 0 ); gtk_misc_set_alignment( GTK_MISC( label ), 1, 0.5 ); + gtk_widget_show( label ); // Initialize fields gtk_entry_set_text( GTK_ENTRY( base ), ValueForKey( g_qeglobals.d_project_entity, "basepath" ) ); - UpdateBSPCommandList( project ); + UpdateBSPCommandList( dialog ); gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( brush ), ( g_qeglobals.m_bBrushPrimitMode ) ? TRUE : FALSE ); - gtk_grab_add( project ); - gtk_widget_show( project ); g_pGameDescription->Dump(); - while ( loop ) - gtk_main_iteration(); + response_id = gtk_dialog_run( GTK_DIALOG( dialog ) ); - if ( ret == IDOK ) { + if( response_id == GTK_RESPONSE_OK ) { char buf[1024]; const char *r; char *w; @@ -877,115 +837,103 @@ void DoProjectSettings(){ g_list_free( mod_list ); g_list_free( gamemode_list ); - gtk_grab_remove( project ); - gtk_widget_destroy( project ); + gtk_widget_destroy( dialog ); } // ============================================================================= // MapInfo dialog void DoMapInfo(){ - static GtkWidget *dlg; - GtkWidget *vbox, *vbox2, *hbox, *table, *button, *label, *scr; - GtkWidget *brushes_entry, *entities_entry, *net_entry; - int loop = 1, ret = IDCANCEL; + static GtkWidget *dialog; + GtkWidget *vbox, *hbox, *table, *button, *label, *scr; + GtkWidget *brushes_label, *entities_label, *net_label, *content_area; + GtkDialogFlags flags = GTK_DIALOG_DESTROY_WITH_PARENT; - if ( dlg != NULL ) { + if ( dialog != NULL ) { return; } - dlg = gtk_window_new( GTK_WINDOW_TOPLEVEL ); + dialog = gtk_dialog_new_with_buttons( _( "Map Info" ), NULL, flags, NULL ); + gtk_window_set_transient_for( GTK_WINDOW( dialog ), GTK_WINDOW( g_pParentWnd->m_pWidget ) ); + load_window_pos( dialog, g_PrefsDlg.mWindowInfo.posMapInfoWnd ); - load_window_pos( dlg, g_PrefsDlg.mWindowInfo.posMapInfoWnd ); + button = gtk_dialog_add_button( GTK_DIALOG( dialog ), _( "OK" ), GTK_RESPONSE_OK ); + gtk_widget_grab_focus( button ); - gtk_window_set_title( GTK_WINDOW( dlg ), _( "Map Info" ) ); - g_signal_connect( G_OBJECT( dlg ), "delete-event", - G_CALLBACK( dialog_delete_callback ), NULL ); - g_signal_connect( G_OBJECT( dlg ), "destroy", - G_CALLBACK( gtk_widget_destroy ), NULL ); - g_object_set_data( G_OBJECT( dlg ), "loop", &loop ); - g_object_set_data( G_OBJECT( dlg ), "ret", &ret ); + content_area = gtk_dialog_get_content_area( GTK_DIALOG( dialog ) ); vbox = gtk_vbox_new( FALSE, 5 ); - gtk_widget_show( vbox ); - gtk_container_add( GTK_CONTAINER( dlg ), vbox ); + gtk_container_add( GTK_CONTAINER( content_area ), vbox ); gtk_container_set_border_width( GTK_CONTAINER( vbox ), 5 ); + gtk_widget_show( vbox ); hbox = gtk_hbox_new( FALSE, 5 ); - gtk_widget_show( hbox ); gtk_box_pack_start( GTK_BOX( vbox ), hbox, FALSE, TRUE, 0 ); + gtk_widget_show( hbox ); table = gtk_table_new( 3, 2, FALSE ); - gtk_widget_show( table ); gtk_box_pack_start( GTK_BOX( hbox ), table, TRUE, TRUE, 0 ); gtk_table_set_row_spacings( GTK_TABLE( table ), 5 ); gtk_table_set_col_spacings( GTK_TABLE( table ), 5 ); + gtk_widget_show( table ); - brushes_entry = gtk_entry_new(); - gtk_widget_show( brushes_entry ); - gtk_table_attach( GTK_TABLE( table ), brushes_entry, 1, 2, 0, 1, - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), + brushes_label = gtk_label_new( "" ); + gtk_table_attach( GTK_TABLE( table ), brushes_label, 1, 2, 0, 1, + (GtkAttachOptions) ( GTK_FILL ), (GtkAttachOptions) ( 0 ), 0, 0 ); - gtk_entry_set_editable( GTK_ENTRY( brushes_entry ), FALSE ); + g_object_set( brushes_label, "xalign", 1.0, NULL ); + gtk_widget_show( brushes_label ); - entities_entry = gtk_entry_new(); - gtk_widget_show( entities_entry ); - gtk_table_attach( GTK_TABLE( table ), entities_entry, 1, 2, 1, 2, - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), + entities_label = gtk_label_new( "" ); + gtk_table_attach( GTK_TABLE( table ), entities_label, 1, 2, 1, 2, + (GtkAttachOptions) ( GTK_FILL ), (GtkAttachOptions) ( 0 ), 0, 0 ); - gtk_entry_set_editable( GTK_ENTRY( entities_entry ), FALSE ); + g_object_set( entities_label, "xalign", 1.0, NULL ); + gtk_widget_show( entities_label ); - net_entry = gtk_entry_new(); - gtk_widget_show( net_entry ); - gtk_table_attach( GTK_TABLE( table ), net_entry, 1, 2, 2, 3, - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), + net_label = gtk_label_new( "" ); + gtk_table_attach( GTK_TABLE( table ), net_label, 1, 2, 2, 3, + (GtkAttachOptions) ( GTK_FILL ), (GtkAttachOptions) ( 0 ), 0, 0 ); - gtk_entry_set_editable( GTK_ENTRY( net_entry ), FALSE ); + g_object_set( net_label, "xalign", 1.0, NULL ); + gtk_widget_show( net_label ); label = gtk_label_new( _( "Total Brushes" ) ); - gtk_widget_show( label ); gtk_table_attach( GTK_TABLE( table ), label, 0, 1, 0, 1, (GtkAttachOptions) ( GTK_FILL ), (GtkAttachOptions) ( 0 ), 0, 0 ); gtk_misc_set_alignment( GTK_MISC( label ), 0, 0.5 ); + gtk_widget_show( label ); label = gtk_label_new( _( "Total Entities" ) ); - gtk_widget_show( label ); gtk_table_attach( GTK_TABLE( table ), label, 0, 1, 1, 2, (GtkAttachOptions) ( GTK_FILL ), (GtkAttachOptions) ( 0 ), 0, 0 ); gtk_misc_set_alignment( GTK_MISC( label ), 0, 0.5 ); + gtk_widget_show( label ); label = gtk_label_new( _( "Net brush count\n(non entity)" ) ); - gtk_widget_show( label ); gtk_table_attach( GTK_TABLE( table ), label, 0, 1, 2, 3, (GtkAttachOptions) ( GTK_FILL ), (GtkAttachOptions) ( 0 ), 0, 0 ); gtk_misc_set_alignment( GTK_MISC( label ), 0, 0.5 ); + gtk_widget_show( label ); - vbox2 = gtk_vbox_new( FALSE, 5 ); - gtk_widget_show( vbox2 ); - gtk_box_pack_start( GTK_BOX( hbox ), vbox2, FALSE, FALSE, 0 ); - button = gtk_button_new_with_label( _( "Close" ) );; - gtk_widget_show( button ); - gtk_box_pack_start( GTK_BOX( vbox2 ), button, FALSE, FALSE, 0 ); - g_signal_connect( G_OBJECT( button ), "clicked", - G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( IDOK ) ); - gtk_widget_set_usize( button, 60, -2 ); label = gtk_label_new( _( "Entity breakdown" ) ); - gtk_widget_show( label ); gtk_box_pack_start( GTK_BOX( vbox ), label, FALSE, TRUE, 0 ); gtk_misc_set_alignment( GTK_MISC( label ), 0, 0.5 ); + gtk_widget_show( label ); scr = gtk_scrolled_window_new( (GtkAdjustment*)NULL, (GtkAdjustment*)NULL ); - gtk_widget_show( scr ); + gtk_box_pack_start( GTK_BOX( vbox ), scr, TRUE, TRUE, 0 ); gtk_container_set_border_width( GTK_CONTAINER( scr ), 5 ); gtk_scrolled_window_set_policy( GTK_SCROLLED_WINDOW( scr ), GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC ); gtk_scrolled_window_set_shadow_type( GTK_SCROLLED_WINDOW( scr ), GTK_SHADOW_IN ); + gtk_widget_show( scr ); GtkListStore* store = gtk_list_store_new( 2, G_TYPE_STRING, G_TYPE_STRING ); @@ -1007,9 +955,9 @@ void DoMapInfo(){ gtk_tree_view_column_set_sort_column_id( column, 1 ); } - gtk_widget_show( view ); gtk_container_add( GTK_CONTAINER( scr ), view ); + gtk_widget_show( view ); } // Initialize fields @@ -1072,24 +1020,19 @@ void DoMapInfo(){ char tmp[16]; sprintf( tmp, "%d", TotalBrushes ); - gtk_entry_set_text( GTK_ENTRY( brushes_entry ), tmp ); + gtk_label_set_text( GTK_LABEL( brushes_label ), tmp ); sprintf( tmp, "%d", TotalEntities ); - gtk_entry_set_text( GTK_ENTRY( entities_entry ), tmp ); + gtk_label_set_text( GTK_LABEL( entities_label ), tmp ); sprintf( tmp, "%d", Net ); - gtk_entry_set_text( GTK_ENTRY( net_entry ), tmp ); + gtk_label_set_text( GTK_LABEL( net_label ), tmp ); - gtk_grab_add( dlg ); - gtk_widget_show( dlg ); - while ( loop ) - gtk_main_iteration(); + gtk_dialog_run( GTK_DIALOG( dialog ) ); - // save before exit - save_window_pos( dlg, g_PrefsDlg.mWindowInfo.posMapInfoWnd ); + save_window_pos( dialog, g_PrefsDlg.mWindowInfo.posMapInfoWnd ); - gtk_grab_remove( dlg ); - gtk_widget_destroy( dlg ); - dlg = NULL; + gtk_widget_destroy( dialog ); + dialog = NULL; } // ============================================================================= @@ -1147,43 +1090,48 @@ static void entitylist_selection_changed( GtkTreeSelection* selection, gpointer } } -void DoEntityList(){ - static GtkWidget *dlg; - GtkWidget *vbox, *hbox, *hbox2, *button, *scr; - int loop = 1, ret = IDCANCEL; +static void EnitityList_response( GtkDialog *dialog, gint response_id, gpointer user_data ) +{ + save_window_pos( GTK_WIDGET( dialog ), g_PrefsDlg.mWindowInfo.posEntityInfoWnd ); - if ( dlg != NULL ) { + gtk_widget_destroy( GTK_WIDGET( dialog ) ); + + EntityList_dialog = NULL; +} +void DoEntityList(){ + static GtkWidget *dialog; + GtkWidget *vbox, *hbox, *hbox2, *button, *scr, *content_area; + GtkDialogFlags flags = GTK_DIALOG_DESTROY_WITH_PARENT; + + if ( EntityList_dialog != NULL ) { return; } - dlg = gtk_window_new( GTK_WINDOW_TOPLEVEL ); + EntityList_dialog = dialog = gtk_dialog_new_with_buttons( _( "Entity Info" ), GTK_WINDOW( g_pParentWnd->m_pWidget ), flags, NULL ); + gtk_window_set_transient_for( GTK_WINDOW( dialog ), GTK_WINDOW( g_pParentWnd->m_pWidget ) ); + load_window_pos( dialog, g_PrefsDlg.mWindowInfo.posEntityInfoWnd ); - load_window_pos( dlg, g_PrefsDlg.mWindowInfo.posEntityInfoWnd ); + button = gtk_dialog_add_button( GTK_DIALOG( dialog ), _( "OK" ), GTK_RESPONSE_OK ); + gtk_widget_grab_default( button ); - gtk_window_set_title( GTK_WINDOW( dlg ), _( "Entities" ) ); - g_signal_connect( G_OBJECT( dlg ), "delete-event", - G_CALLBACK( dialog_delete_callback ), NULL ); - g_signal_connect( G_OBJECT( dlg ), "destroy", - G_CALLBACK( gtk_widget_destroy ), NULL ); - g_object_set_data( G_OBJECT( dlg ), "loop", &loop ); - g_object_set_data( G_OBJECT( dlg ), "ret", &ret ); + content_area = gtk_dialog_get_content_area( GTK_DIALOG( dialog ) ); hbox = gtk_hbox_new( TRUE, 5 ); - gtk_widget_show( hbox ); - gtk_container_add( GTK_CONTAINER( dlg ), hbox ); + gtk_container_add( GTK_CONTAINER( content_area ), hbox ); gtk_container_set_border_width( GTK_CONTAINER( hbox ), 5 ); + gtk_widget_show( hbox ); scr = gtk_scrolled_window_new( (GtkAdjustment*)NULL, (GtkAdjustment*)NULL ); - gtk_widget_show( scr ); gtk_box_pack_start( GTK_BOX( hbox ), scr, TRUE, TRUE, 0 ); gtk_scrolled_window_set_policy( GTK_SCROLLED_WINDOW( scr ), GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC ); gtk_scrolled_window_set_shadow_type( GTK_SCROLLED_WINDOW( scr ), GTK_SHADOW_IN ); + gtk_widget_show( scr ); { GtkTreeStore* store = gtk_tree_store_new( 2, G_TYPE_STRING, G_TYPE_POINTER ); GtkWidget* view = gtk_tree_view_new_with_model( GTK_TREE_MODEL( store ) ); - g_signal_connect( G_OBJECT( view ), "button-press-event", G_CALLBACK( entitylist_click ), dlg ); + g_signal_connect( G_OBJECT( view ), "button-press-event", G_CALLBACK( entitylist_click ), dialog ); gtk_tree_view_set_headers_visible( GTK_TREE_VIEW( view ), FALSE ); { @@ -1194,13 +1142,13 @@ void DoEntityList(){ { GtkTreeSelection* selection = gtk_tree_view_get_selection( GTK_TREE_VIEW( view ) ); - g_signal_connect( G_OBJECT( selection ), "changed", G_CALLBACK( entitylist_selection_changed ), dlg ); + g_signal_connect( G_OBJECT( selection ), "changed", G_CALLBACK( entitylist_selection_changed ), dialog ); } - gtk_widget_show( view ); - gtk_container_add( GTK_CONTAINER( scr ), view ); - g_object_set_data( G_OBJECT( dlg ), "entities", view ); + g_object_set_data( G_OBJECT( dialog ), "entities", view ); + + gtk_widget_show( view ); { { @@ -1259,14 +1207,14 @@ void DoEntityList(){ } vbox = gtk_vbox_new( FALSE, 5 ); - gtk_widget_show( vbox ); gtk_box_pack_start( GTK_BOX( hbox ), vbox, TRUE, TRUE, 0 ); + gtk_widget_show( vbox ); scr = gtk_scrolled_window_new( (GtkAdjustment*)NULL, (GtkAdjustment*)NULL ); - gtk_widget_show( scr ); gtk_box_pack_start( GTK_BOX( vbox ), scr, TRUE, TRUE, 0 ); gtk_scrolled_window_set_policy( GTK_SCROLLED_WINDOW( scr ), GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC ); gtk_scrolled_window_set_shadow_type( GTK_SCROLLED_WINDOW( scr ), GTK_SHADOW_IN ); + gtk_widget_show( scr ); { GtkListStore* store = gtk_list_store_new( 2, G_TYPE_STRING, G_TYPE_STRING ); @@ -1287,42 +1235,27 @@ void DoEntityList(){ gtk_widget_show( view ); - g_object_set_data( G_OBJECT( dlg ), "keyvalues", store ); + g_object_set_data( G_OBJECT( dialog ), "keyvalues", store ); gtk_container_add( GTK_CONTAINER( scr ), view ); g_object_unref( G_OBJECT( store ) ); } hbox2 = gtk_hbox_new( FALSE, 5 ); - gtk_widget_show( hbox2 ); gtk_box_pack_start( GTK_BOX( vbox ), hbox2, TRUE, TRUE, 0 ); + gtk_widget_show( hbox2 ); button = gtk_button_new_with_label( _( "Select" ) ); - gtk_widget_show( button ); gtk_box_pack_start( GTK_BOX( hbox2 ), button, FALSE, FALSE, 0 ); g_signal_connect( G_OBJECT( button ), "clicked", - G_CALLBACK( entitylist_select ), dlg ); - gtk_widget_set_usize( button, 60, -2 ); - - button = gtk_button_new_with_label( _( "Close" ) );; + G_CALLBACK( entitylist_select ), dialog ); + gtk_widget_set_size_request( button, 60, -2 ); gtk_widget_show( button ); - gtk_box_pack_end( GTK_BOX( hbox2 ), button, FALSE, FALSE, 0 ); - g_signal_connect( G_OBJECT( button ), "clicked", - G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( IDOK ) ); - gtk_widget_set_usize( button, 60, -2 ); - gtk_grab_add( dlg ); - gtk_widget_show( dlg ); - while ( loop ) - gtk_main_iteration(); + g_signal_connect( dialog, "response", G_CALLBACK( EnitityList_response ), dialog ); - save_window_pos( dlg, g_PrefsDlg.mWindowInfo.posMapInfoWnd ); - - gtk_grab_remove( dlg ); - gtk_widget_destroy( dlg ); - - dlg = NULL; + gtk_widget_show( dialog ); } // ============================================================================= @@ -1335,220 +1268,180 @@ static void rotatedlg_apply( GtkWidget *widget, gpointer data ){ spin = GTK_SPIN_BUTTON( g_object_get_data( G_OBJECT( data ), "x" ) ); f = gtk_spin_button_get_value( spin ); if ( f != 0.0 ) { - Select_RotateAxis( 0,f ); + Select_RotateAxis( 0, f ); } gtk_spin_button_set_value( GTK_SPIN_BUTTON( spin ), 0.0f ); // reset to 0 on Apply spin = GTK_SPIN_BUTTON( g_object_get_data( G_OBJECT( data ), "y" ) ); f = gtk_spin_button_get_value( spin ); if ( f != 0.0 ) { - Select_RotateAxis( 1,f ); + Select_RotateAxis( 1, f ); } gtk_spin_button_set_value( GTK_SPIN_BUTTON( spin ), 0.0f ); spin = GTK_SPIN_BUTTON( g_object_get_data( G_OBJECT( data ), "z" ) ); f = gtk_spin_button_get_value( spin ); if ( f != 0.0 ) { - Select_RotateAxis( 2,f ); + Select_RotateAxis( 2, f ); } gtk_spin_button_set_value( GTK_SPIN_BUTTON( spin ), 0.0f ); } +static void rotatedialog_response( GtkWidget *widget, gint response_id, gpointer data ){ + + if ( response_id == GTK_RESPONSE_OK || response_id == GTK_RESPONSE_APPLY ) { + rotatedlg_apply( widget, data ); + } + + if ( response_id == GTK_RESPONSE_OK || response_id == GTK_RESPONSE_CANCEL ) { + gtk_widget_destroy( GTK_WIDGET( widget ) ); + } +} + static void rotatedialog_activate( GtkWidget *widget, gpointer data ){ GtkWidget *dialog = (GtkWidget *)data; rotatedlg_apply( dialog, dialog ); } void DoRotateDlg(){ - GtkWidget *dlg, *hbox, *vbox, *table, *label, *button; - GtkWidget *x, *y, *z; - GtkObject *adj; - int loop = 1, ret = IDCANCEL; + GtkWidget *dialog, *hbox, *table, *label; + GtkWidget *x, *y, *z, *content_area; + GtkAdjustment *adj; + GtkDialogFlags flags = GTK_DIALOG_DESTROY_WITH_PARENT; - dlg = gtk_window_new( GTK_WINDOW_TOPLEVEL ); - gtk_window_set_title( GTK_WINDOW( dlg ), _( "Arbitrary rotation" ) ); - g_signal_connect( G_OBJECT( dlg ), "delete-event", - G_CALLBACK( dialog_delete_callback ), NULL ); - g_signal_connect( G_OBJECT( dlg ), "destroy", - G_CALLBACK( gtk_widget_destroy ), NULL ); - g_object_set_data( G_OBJECT( dlg ), "loop", &loop ); - g_object_set_data( G_OBJECT( dlg ), "ret", &ret ); + dialog = gtk_dialog_new_with_buttons( _( "Arbitrary rotation" ), NULL, flags, NULL ); + gtk_window_set_transient_for( GTK_WINDOW( dialog ), GTK_WINDOW( g_pParentWnd->m_pWidget ) ); + + gtk_dialog_add_button( GTK_DIALOG( dialog ), _( "OK" ), GTK_RESPONSE_OK ); + gtk_dialog_add_button( GTK_DIALOG( dialog ), _( "Cancel" ), GTK_RESPONSE_CANCEL ); + gtk_dialog_add_button( GTK_DIALOG( dialog ), _( "Apply" ), GTK_RESPONSE_APPLY ); + + content_area = gtk_dialog_get_content_area( GTK_DIALOG( dialog ) ); hbox = gtk_hbox_new( FALSE, 5 ); - gtk_widget_show( hbox ); - gtk_container_add( GTK_CONTAINER( dlg ), hbox ); + gtk_container_add( GTK_CONTAINER( content_area ), hbox ); gtk_container_set_border_width( GTK_CONTAINER( hbox ), 5 ); + gtk_widget_show( hbox ); table = gtk_table_new( 3, 2, FALSE ); - gtk_widget_show( table ); gtk_box_pack_start( GTK_BOX( hbox ), table, TRUE, TRUE, 0 ); gtk_table_set_row_spacings( GTK_TABLE( table ), 5 ); gtk_table_set_col_spacings( GTK_TABLE( table ), 5 ); + gtk_widget_show( table ); label = gtk_label_new( _( "X" ) ); - gtk_widget_show( label ); gtk_table_attach( GTK_TABLE( table ), label, 0, 1, 0, 1, (GtkAttachOptions) ( 0 ), (GtkAttachOptions) ( 0 ), 0, 0 ); + gtk_widget_show( label ); label = gtk_label_new( _( "Y" ) ); - gtk_widget_show( label ); gtk_table_attach( GTK_TABLE( table ), label, 0, 1, 1, 2, (GtkAttachOptions) ( 0 ), (GtkAttachOptions) ( 0 ), 0, 0 ); + gtk_widget_show( label ); label = gtk_label_new( _( "Z" ) ); - gtk_widget_show( label ); gtk_table_attach( GTK_TABLE( table ), label, 0, 1, 2, 3, (GtkAttachOptions) ( 0 ), (GtkAttachOptions) ( 0 ), 0, 0 ); + gtk_widget_show( label ); - adj = gtk_adjustment_new( 0, -359, 359, 1, 10, 0 ); + adj = GTK_ADJUSTMENT( gtk_adjustment_new( 0, -359, 359, 1, 10, 0 ) ); x = gtk_spin_button_new( GTK_ADJUSTMENT( adj ), 1, 0 ); - gtk_spin_button_set_numeric( GTK_SPIN_BUTTON( x ), TRUE ); - g_object_set_data( G_OBJECT( dlg ), "x", x ); - gtk_widget_show( x ); gtk_table_attach( GTK_TABLE( table ), x, 1, 2, 0, 1, (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), (GtkAttachOptions) ( 0 ), 0, 0 ); - gtk_widget_set_usize( x, 60, -2 ); gtk_spin_button_set_wrap( GTK_SPIN_BUTTON( x ), TRUE ); - g_signal_connect_after( x, "activate", G_CALLBACK( rotatedialog_activate ), dlg ); - g_object_set( x, "xalign", 1.0, NULL ); //right align numbers + gtk_spin_button_set_numeric( GTK_SPIN_BUTTON( x ), TRUE ); + gtk_entry_set_alignment( GTK_ENTRY( x ), 1.0 ); //right align numbers + gtk_widget_show( x ); + g_object_set_data( G_OBJECT( dialog ), "x", x ); + g_signal_connect_after( x, "activate", G_CALLBACK( rotatedialog_activate ), dialog ); - adj = gtk_adjustment_new( 0, -359, 359, 1, 10, 0 ); + adj = GTK_ADJUSTMENT( gtk_adjustment_new( 0, -359, 359, 1, 10, 0 ) ); y = gtk_spin_button_new( GTK_ADJUSTMENT( adj ), 1, 0 ); - gtk_spin_button_set_numeric( GTK_SPIN_BUTTON( y ), TRUE ); - g_object_set_data( G_OBJECT( dlg ), "y", y ); - gtk_widget_show( y ); gtk_table_attach( GTK_TABLE( table ), y, 1, 2, 1, 2, (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), (GtkAttachOptions) ( 0 ), 0, 0 ); gtk_spin_button_set_wrap( GTK_SPIN_BUTTON( y ), TRUE ); - g_signal_connect_after( y, "activate", G_CALLBACK( rotatedialog_activate ), dlg ); - g_object_set( y, "xalign", 1.0, NULL ); //right align numbers + gtk_spin_button_set_numeric( GTK_SPIN_BUTTON( y ), TRUE ); + gtk_entry_set_alignment( GTK_ENTRY( y ), 1.0 ); //right align numbers + gtk_widget_show( y ); + g_signal_connect_after( y, "activate", G_CALLBACK( rotatedialog_activate ), dialog ); + g_object_set_data( G_OBJECT( dialog ), "y", y ); - adj = gtk_adjustment_new( 0, -359, 359, 1, 10, 0 ); + + adj = GTK_ADJUSTMENT( gtk_adjustment_new( 0, -359, 359, 1, 10, 0 ) ); z = gtk_spin_button_new( GTK_ADJUSTMENT( adj ), 1, 0 ); - gtk_spin_button_set_numeric( GTK_SPIN_BUTTON( z ), TRUE ); - g_object_set_data( G_OBJECT( dlg ), "z", z ); - gtk_widget_show( z ); gtk_table_attach( GTK_TABLE( table ), z, 1, 2, 2, 3, (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), (GtkAttachOptions) ( 0 ), 0, 0 ); gtk_spin_button_set_wrap( GTK_SPIN_BUTTON( z ), TRUE ); - g_signal_connect_after( z, "activate", G_CALLBACK( rotatedialog_activate ), dlg ); - g_object_set( z, "xalign", 1.0, NULL ); //right align numbers + gtk_spin_button_set_numeric( GTK_SPIN_BUTTON( z ), TRUE ); + gtk_entry_set_alignment( GTK_ENTRY( z ), 1.0 ); //right align numbers + gtk_widget_show( z ); + g_signal_connect_after( z, "activate", G_CALLBACK( rotatedialog_activate ), dialog ); + g_object_set_data( G_OBJECT( dialog ), "z", z ); - vbox = gtk_vbox_new( FALSE, 5 ); - gtk_widget_show( vbox ); - gtk_box_pack_start( GTK_BOX( hbox ), vbox, TRUE, TRUE, 0 ); - button = gtk_button_new_with_label( _( "OK" ) ); - gtk_widget_show( button ); - gtk_box_pack_start( GTK_BOX( vbox ), button, FALSE, FALSE, 0 ); - g_signal_connect( G_OBJECT( button ), "clicked", - G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( IDOK ) ); - gtk_widget_set_usize( button, 60, -2 ); - button = gtk_button_new_with_label( _( "Cancel" ) );; - gtk_widget_show( button ); - gtk_box_pack_start( GTK_BOX( vbox ), button, FALSE, FALSE, 0 ); - g_signal_connect( G_OBJECT( button ), "clicked", - G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( IDCANCEL ) ); + g_signal_connect( G_OBJECT( dialog ), "response", G_CALLBACK( rotatedialog_response ), dialog ); - button = gtk_button_new_with_label( _( "Apply" ) ); - gtk_widget_show( button ); - gtk_box_pack_start( GTK_BOX( vbox ), button, FALSE, FALSE, 0 ); - g_signal_connect( G_OBJECT( button ), "clicked", - G_CALLBACK( rotatedlg_apply ), dlg ); - - gtk_grab_add( dlg ); - gtk_widget_show( dlg ); - - while ( loop ) - gtk_main_iteration(); - - if ( ret == IDOK ) { - rotatedlg_apply( button, dlg ); - } - - gtk_grab_remove( dlg ); - gtk_widget_destroy( dlg ); + gtk_widget_show( dialog ); } // ============================================================================= // Gamma dialog void DoGamma(){ - GtkWidget *dlg, *vbox, *hbox, *label, *button, *entry; - int loop = 1, ret = IDCANCEL; + GtkWidget *dialog, *vbox, *label, *spin, *content_area; + gint response_id; + GtkAdjustment *adj; + GtkDialogFlags flags = GTK_DIALOG_DESTROY_WITH_PARENT; - dlg = gtk_window_new( GTK_WINDOW_TOPLEVEL ); - gtk_window_set_title( GTK_WINDOW( dlg ), _( "Gamma" ) ); - g_signal_connect( G_OBJECT( dlg ), "delete-event", - G_CALLBACK( dialog_delete_callback ), NULL ); - g_signal_connect( G_OBJECT( dlg ), "destroy", - G_CALLBACK( gtk_widget_destroy ), NULL ); - g_object_set_data( G_OBJECT( dlg ), "loop", &loop ); - g_object_set_data( G_OBJECT( dlg ), "ret", &ret ); + dialog = gtk_dialog_new_with_buttons( _( "Gamma" ), NULL, flags, NULL ); + gtk_window_set_transient_for( GTK_WINDOW( dialog ), GTK_WINDOW( g_pParentWnd->m_pWidget ) ); - hbox = gtk_hbox_new( FALSE, 5 ); - gtk_widget_show( hbox ); - gtk_container_add( GTK_CONTAINER( dlg ), hbox ); - gtk_container_set_border_width( GTK_CONTAINER( hbox ), 5 ); + gtk_dialog_add_button( GTK_DIALOG( dialog ), _( "OK" ), GTK_RESPONSE_OK ); + gtk_dialog_add_button( GTK_DIALOG( dialog ), _( "Cancel" ), GTK_RESPONSE_CANCEL ); - vbox = gtk_vbox_new( FALSE, 5 ); + content_area = gtk_dialog_get_content_area( GTK_DIALOG( dialog ) ); + + vbox = gtk_vbox_new( TRUE, 5 ); + gtk_container_add( GTK_CONTAINER( content_area ), vbox ); + gtk_container_set_border_width( GTK_CONTAINER( vbox ), 5 ); gtk_widget_show( vbox ); - gtk_box_pack_start( GTK_BOX( hbox ), vbox, TRUE, TRUE, 0 ); - - entry = gtk_entry_new(); - gtk_widget_show( entry ); - gtk_box_pack_start( GTK_BOX( vbox ), entry, TRUE, TRUE, 0 ); label = gtk_label_new( _( "0.0 is brightest\n1.0 is darkest" ) ); - gtk_widget_show( label ); + gtk_misc_set_alignment( GTK_MISC( label ), 0, 0.5 ); gtk_box_pack_start( GTK_BOX( vbox ), label, TRUE, TRUE, 0 ); + gtk_widget_show( label ); label = gtk_label_new( _( "You must restart for the\nsettings to take effect" ) ); - gtk_widget_show( label ); + gtk_misc_set_alignment( GTK_MISC( label ), 0, 0.5 ); gtk_box_pack_start( GTK_BOX( vbox ), label, TRUE, TRUE, 0 ); + gtk_widget_show( label ); - vbox = gtk_vbox_new( FALSE, 5 ); - gtk_widget_show( vbox ); - gtk_box_pack_start( GTK_BOX( hbox ), vbox, TRUE, TRUE, 0 ); - - button = gtk_button_new_with_label( _( "OK" ) ); - gtk_widget_show( button ); - gtk_box_pack_start( GTK_BOX( vbox ), button, FALSE, FALSE, 0 ); - g_signal_connect( G_OBJECT( button ), "clicked", - G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( IDOK ) ); - gtk_widget_set_usize( button, 60, -2 ); - - button = gtk_button_new_with_label( _( "Cancel" ) );; - gtk_widget_show( button ); - gtk_box_pack_start( GTK_BOX( vbox ), button, FALSE, FALSE, 0 ); - g_signal_connect( G_OBJECT( button ), "clicked", - G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( IDCANCEL ) ); + adj = GTK_ADJUSTMENT( gtk_adjustment_new( 1, 0, 1, 0.1, 0.01, 0 ) ); + spin = gtk_spin_button_new( GTK_ADJUSTMENT( adj ), 1, 2 ); + gtk_box_pack_start( GTK_BOX( vbox ), spin, TRUE, TRUE, 0 ); + gtk_spin_button_set_wrap( GTK_SPIN_BUTTON( spin ), FALSE ); + gtk_spin_button_set_numeric( GTK_SPIN_BUTTON( spin ), TRUE ); + gtk_entry_set_alignment( GTK_ENTRY( spin ), 1.0 ); //right + gtk_widget_show( spin ); // Initialize dialog - char buf[16]; - sprintf( buf, "%1.1f", g_qeglobals.d_savedinfo.fGamma ); - gtk_entry_set_text( GTK_ENTRY( entry ), buf ); + gtk_spin_button_set_value( GTK_SPIN_BUTTON( spin ), g_qeglobals.d_savedinfo.fGamma ); - gtk_grab_add( dlg ); - gtk_widget_show( dlg ); + response_id = gtk_dialog_run( GTK_DIALOG( dialog ) ); - while ( loop ) - gtk_main_iteration(); - - if ( ret == IDOK ) { - g_qeglobals.d_savedinfo.fGamma = g_strtod( gtk_entry_get_text( GTK_ENTRY( entry ) ), NULL ); + if( response_id == GTK_RESPONSE_OK ) { + g_qeglobals.d_savedinfo.fGamma = gtk_spin_button_get_value( GTK_SPIN_BUTTON( spin ) ); } - gtk_grab_remove( dlg ); - gtk_widget_destroy( dlg ); + gtk_widget_destroy( dialog ); } // ============================================================================= @@ -1691,211 +1584,198 @@ static void GetSelectionIndex( int *ent, int *brush ){ for ( b2 = b->owner->brushes.onext; b2 != b && b2 != &b->owner->brushes; b2 = b2->onext, ( *brush )++ ) ; } +static void findbrushdialog_apply( GtkWidget *widget, gpointer data ){ + int ent_num; + int brush_num; + GtkSpinButton *spin; + + spin = GTK_SPIN_BUTTON( g_object_get_data( G_OBJECT( data ), "entity-spin" ) ); + ent_num = gtk_spin_button_get_value_as_int( spin ); + + spin = GTK_SPIN_BUTTON( g_object_get_data( G_OBJECT( data ), "brush-spin" ) ); + brush_num = gtk_spin_button_get_value_as_int( spin ); + + SelectBrush( ent_num, brush_num ); +} +static void findbrushdialog_response( GtkWidget *widget, gint response_id, gpointer data ){ + + if ( response_id == GTK_RESPONSE_OK || response_id == GTK_RESPONSE_APPLY ) { + findbrushdialog_apply( widget, widget ); + } + + if ( response_id == GTK_RESPONSE_OK || response_id == GTK_RESPONSE_CANCEL ) { + gtk_widget_destroy( GTK_WIDGET( widget ) ); + } +} void DoFind(){ - GtkWidget *dlg, *vbox, *hbox, *table, *label, *button, *entity, *brush; - int loop = 1, ret = IDCANCEL; + GtkWidget *dialog, *vbox, *table, *label, *entity, *brush, *content_area, *spin; + GtkAdjustment *adj; + int ent, br; + GtkDialogFlags flags = GTK_DIALOG_DESTROY_WITH_PARENT; - dlg = gtk_window_new( GTK_WINDOW_TOPLEVEL ); - gtk_window_set_title( GTK_WINDOW( dlg ), _( "Find Brush" ) ); - g_signal_connect( G_OBJECT( dlg ), "delete-event", - G_CALLBACK( dialog_delete_callback ), NULL ); - g_signal_connect( G_OBJECT( dlg ), "destroy", - G_CALLBACK( gtk_widget_destroy ), NULL ); - g_object_set_data( G_OBJECT( dlg ), "loop", &loop ); - g_object_set_data( G_OBJECT( dlg ), "ret", &ret ); + dialog = gtk_dialog_new_with_buttons( _( "Find Brush" ), NULL, flags, NULL ); + gtk_window_set_transient_for( GTK_WINDOW( dialog ), GTK_WINDOW( g_pParentWnd->m_pWidget ) ); + + gtk_dialog_add_button( GTK_DIALOG( dialog ), _( "OK" ), GTK_RESPONSE_OK ); + gtk_dialog_add_button( GTK_DIALOG( dialog ), _( "Cancel" ), GTK_RESPONSE_CANCEL ); + + content_area = gtk_dialog_get_content_area( GTK_DIALOG( dialog ) ); vbox = gtk_vbox_new( FALSE, 5 ); - gtk_widget_show( vbox ); - gtk_container_add( GTK_CONTAINER( dlg ), vbox ); + gtk_container_add( GTK_CONTAINER( content_area ), vbox ); gtk_container_set_border_width( GTK_CONTAINER( vbox ), 5 ); + gtk_widget_show( vbox ); table = gtk_table_new( 2, 2, FALSE ); - gtk_widget_show( table ); gtk_box_pack_start( GTK_BOX( vbox ), table, TRUE, TRUE, 0 ); gtk_table_set_row_spacings( GTK_TABLE( table ), 5 ); gtk_table_set_col_spacings( GTK_TABLE( table ), 5 ); + gtk_widget_show( table ); label = gtk_label_new( _( "Entity number" ) ); - gtk_widget_show( label ); gtk_table_attach( GTK_TABLE( table ), label, 0, 1, 0, 1, (GtkAttachOptions) ( 0 ), (GtkAttachOptions) ( 0 ), 0, 0 ); + gtk_widget_show( label ); label = gtk_label_new( _( "Brush number" ) ); - gtk_widget_show( label ); gtk_table_attach( GTK_TABLE( table ), label, 0, 1, 1, 2, (GtkAttachOptions) ( 0 ), (GtkAttachOptions) ( 0 ), 0, 0 ); + gtk_widget_show( label ); - entity = gtk_entry_new(); - gtk_widget_show( entity ); + adj = GTK_ADJUSTMENT( gtk_adjustment_new( 0, 0, G_MAXINT, 1, 10, 0 ) ); + entity = spin = gtk_spin_button_new( GTK_ADJUSTMENT( adj ), 1, 0 ); gtk_table_attach( GTK_TABLE( table ), entity, 1, 2, 0, 1, (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), (GtkAttachOptions) ( 0 ), 0, 0 ); + gtk_spin_button_set_wrap( GTK_SPIN_BUTTON( spin ), FALSE ); + gtk_spin_button_set_numeric( GTK_SPIN_BUTTON( spin ), TRUE ); + gtk_entry_set_alignment( GTK_ENTRY( spin ), 1.0 ); //right align numbers + gtk_widget_show( spin ); + g_object_set_data( G_OBJECT( dialog ), "entity-spin", spin ); - brush = gtk_entry_new(); - gtk_widget_show( brush ); + adj = GTK_ADJUSTMENT( gtk_adjustment_new( 0, 0, G_MAXINT, 1, 10, 0 ) ); + brush = spin = gtk_spin_button_new( GTK_ADJUSTMENT( adj ), 1, 0 ); gtk_table_attach( GTK_TABLE( table ), brush, 1, 2, 1, 2, (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), (GtkAttachOptions) ( 0 ), 0, 0 ); - - hbox = gtk_hbox_new( FALSE, 5 ); - gtk_widget_show( hbox ); - gtk_box_pack_start( GTK_BOX( vbox ), hbox, FALSE, TRUE, 0 ); - - button = gtk_button_new_with_label( _( "OK" ) ); - gtk_widget_show( button ); - gtk_box_pack_start( GTK_BOX( hbox ), button, FALSE, FALSE, 0 ); - g_signal_connect( G_OBJECT( button ), "clicked", - G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( IDOK ) ); - gtk_widget_set_usize( button, 60, -2 ); - - button = gtk_button_new_with_label( _( "Cancel" ) );; - gtk_widget_show( button ); - gtk_box_pack_start( GTK_BOX( hbox ), button, FALSE, FALSE, 0 ); - g_signal_connect( G_OBJECT( button ), "clicked", - G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( IDCANCEL ) ); + gtk_spin_button_set_wrap( GTK_SPIN_BUTTON( spin ), FALSE ); + gtk_spin_button_set_numeric( GTK_SPIN_BUTTON( spin ), TRUE ); + gtk_entry_set_alignment( GTK_ENTRY( spin ), 1.0 ); //right align numbers + gtk_widget_show( spin ); + g_object_set_data( G_OBJECT( dialog ), "brush-spin", spin ); // Initialize dialog - char buf[16]; - int ent, br; - GetSelectionIndex( &ent, &br ); - sprintf( buf, "%i", ent ); - gtk_entry_set_text( GTK_ENTRY( entity ), buf ); - sprintf( buf, "%i", br ); - gtk_entry_set_text( GTK_ENTRY( brush ), buf ); - gtk_grab_add( dlg ); - gtk_widget_show( dlg ); + gtk_spin_button_set_value( GTK_SPIN_BUTTON( entity ), ent ); + gtk_spin_button_set_value( GTK_SPIN_BUTTON( brush ), br ); - while ( loop ) - gtk_main_iteration(); + g_signal_connect( dialog, "response", G_CALLBACK( findbrushdialog_response ), dialog ); - if ( ret == IDOK ) { - const char *entstr = gtk_entry_get_text( GTK_ENTRY( entity ) ); - const char *brushstr = gtk_entry_get_text( GTK_ENTRY( brush ) ); - SelectBrush( atoi( entstr ), atoi( brushstr ) ); - } - - gtk_grab_remove( dlg ); - gtk_widget_destroy( dlg ); + gtk_widget_show( dialog ); } // ============================================================================= // Arbitrary Sides dialog void DoSides( bool bCone, bool bSphere, bool bTorus ){ - GtkWidget *dlg, *vbox, *hbox, *button, *label, *entry; - int loop = 1, ret = IDCANCEL; + GtkWidget *dialog, *hbox, *label, *content_area, *spin; + GtkAdjustment *adj; + gint response_id; + GtkDialogFlags flags = GTK_DIALOG_DESTROY_WITH_PARENT; - dlg = gtk_window_new( GTK_WINDOW_TOPLEVEL ); - gtk_window_set_title( GTK_WINDOW( dlg ), _( "Arbitrary sides" ) ); - g_signal_connect( G_OBJECT( dlg ), "delete-event", - G_CALLBACK( dialog_delete_callback ), NULL ); - g_signal_connect( G_OBJECT( dlg ), "destroy", - G_CALLBACK( gtk_widget_destroy ), NULL ); - g_object_set_data( G_OBJECT( dlg ), "loop", &loop ); - g_object_set_data( G_OBJECT( dlg ), "ret", &ret ); + dialog = gtk_dialog_new_with_buttons( _( "Arbitrary sides" ), NULL, flags, NULL ); + gtk_window_set_transient_for( GTK_WINDOW( dialog ), GTK_WINDOW( g_pParentWnd->m_pWidget ) ); + + gtk_dialog_add_button( GTK_DIALOG( dialog ), _( "OK" ), GTK_RESPONSE_OK ); + gtk_dialog_add_button( GTK_DIALOG( dialog ), _( "Cancel" ), GTK_RESPONSE_CANCEL ); + + content_area = gtk_dialog_get_content_area( GTK_DIALOG( dialog ) ); hbox = gtk_hbox_new( FALSE, 5 ); - gtk_widget_show( hbox ); - gtk_container_add( GTK_CONTAINER( dlg ), hbox ); + gtk_container_add( GTK_CONTAINER( content_area ), hbox ); gtk_container_set_border_width( GTK_CONTAINER( hbox ), 5 ); + gtk_widget_show( hbox ); label = gtk_label_new( _( "Sides:" ) ); - gtk_widget_show( label ); gtk_box_pack_start( GTK_BOX( hbox ), label, FALSE, FALSE, 0 ); + gtk_widget_show( label ); - entry = gtk_entry_new(); - gtk_widget_show( entry ); - gtk_box_pack_start( GTK_BOX( hbox ), entry, FALSE, FALSE, 0 ); + adj = GTK_ADJUSTMENT( gtk_adjustment_new( 3, 3, 100, 1, 10, 0 ) ); + spin = gtk_spin_button_new( adj, 1, 0 ); + gtk_box_pack_start( GTK_BOX( hbox ), spin, TRUE, TRUE, 0 ); + gtk_spin_button_set_wrap( GTK_SPIN_BUTTON( spin ), TRUE ); + gtk_spin_button_set_numeric( GTK_SPIN_BUTTON( spin ), TRUE ); + gtk_entry_set_alignment( GTK_ENTRY( spin ), 1.0 ); //right + gtk_widget_show( spin ); - vbox = gtk_vbox_new( FALSE, 5 ); - gtk_widget_show( vbox ); - gtk_box_pack_start( GTK_BOX( hbox ), vbox, FALSE, TRUE, 0 ); + response_id = gtk_dialog_run( GTK_DIALOG( dialog ) ); - button = gtk_button_new_with_label( _( "OK" ) ); - gtk_widget_show( button ); - gtk_box_pack_start( GTK_BOX( vbox ), button, FALSE, FALSE, 0 ); - g_signal_connect( G_OBJECT( button ), "clicked", - G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( IDOK ) ); - gtk_widget_set_usize( button, 60, -2 ); - - button = gtk_button_new_with_label( _( "Cancel" ) );; - gtk_widget_show( button ); - gtk_box_pack_start( GTK_BOX( vbox ), button, FALSE, FALSE, 0 ); - g_signal_connect( G_OBJECT( button ), "clicked", - G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( IDCANCEL ) ); - - gtk_grab_add( dlg ); - gtk_widget_show( dlg ); - - while ( loop ) - gtk_main_iteration(); - - if ( ret == IDOK ) { - const char *str = gtk_entry_get_text( GTK_ENTRY( entry ) ); + if( response_id == GTK_RESPONSE_OK ) { + int sides = gtk_spin_button_get_value_as_int( GTK_SPIN_BUTTON( spin ) ); if ( bCone ) { - Brush_MakeSidedCone( atoi( str ) ); + Brush_MakeSidedCone( sides ); } else if ( bSphere ) { - Brush_MakeSidedSphere( atoi( str ) ); + Brush_MakeSidedSphere( sides ); } else{ - Brush_MakeSided( atoi( str ) ); + Brush_MakeSided( sides ); } } - gtk_grab_remove( dlg ); - gtk_widget_destroy( dlg ); + gtk_widget_destroy( dialog ); } // ============================================================================= // New Patch dialog void DoNewPatchDlg(){ - GtkWidget *dlg, *hbox, *table, *vbox, *label, *button, *combo; - GtkWidget *width, *height; - GList *combo_list = (GList*)NULL; - int loop = 1, ret = IDCANCEL; + GtkWidget *dialog, *table, *hbox, *label, *combo; + GtkWidget *width_combo, *height_combo, *content_area; + GList *combo_list; + GList *lst, *cells; + gint response_id; + GtkDialogFlags flags = GTK_DIALOG_DESTROY_WITH_PARENT; - dlg = gtk_window_new( GTK_WINDOW_TOPLEVEL ); - gtk_window_set_title( GTK_WINDOW( dlg ), _( "Patch density" ) ); - g_signal_connect( G_OBJECT( dlg ), "delete-event", - G_CALLBACK( dialog_delete_callback ), NULL ); - g_signal_connect( G_OBJECT( dlg ), "destroy", - G_CALLBACK( gtk_widget_destroy ), NULL ); - g_object_set_data( G_OBJECT( dlg ), "loop", &loop ); - g_object_set_data( G_OBJECT( dlg ), "ret", &ret ); + dialog = gtk_dialog_new_with_buttons( _( "Patch density" ), NULL, flags, NULL ); + gtk_window_set_transient_for( GTK_WINDOW( dialog ), GTK_WINDOW( g_pParentWnd->m_pWidget ) ); + + gtk_dialog_add_button( GTK_DIALOG( dialog ), _( "OK" ), GTK_RESPONSE_OK ); + gtk_dialog_add_button( GTK_DIALOG( dialog ), _( "Cancel" ), GTK_RESPONSE_CANCEL ); + + content_area = gtk_dialog_get_content_area( GTK_DIALOG( dialog ) ); hbox = gtk_hbox_new( FALSE, 5 ); - gtk_widget_show( hbox ); - gtk_container_add( GTK_CONTAINER( dlg ), hbox ); + gtk_container_add( GTK_CONTAINER( content_area ), hbox ); gtk_container_set_border_width( GTK_CONTAINER( hbox ), 5 ); + gtk_widget_show( hbox ); table = gtk_table_new( 2, 2, FALSE ); - gtk_widget_show( table ); gtk_box_pack_start( GTK_BOX( hbox ), table, TRUE, TRUE, 0 ); gtk_table_set_row_spacings( GTK_TABLE( table ), 5 ); gtk_table_set_col_spacings( GTK_TABLE( table ), 5 ); + gtk_widget_show( table ); label = gtk_label_new( _( "Width:" ) ); - gtk_widget_show( label ); gtk_table_attach( GTK_TABLE( table ), label, 0, 1, 0, 1, (GtkAttachOptions) ( GTK_FILL ), (GtkAttachOptions) ( 0 ), 0, 0 ); gtk_misc_set_alignment( GTK_MISC( label ), 0, 0.5 ); + gtk_widget_show( label ); label = gtk_label_new( _( "Height:" ) ); - gtk_widget_show( label ); gtk_table_attach( GTK_TABLE( table ), label, 0, 1, 1, 2, (GtkAttachOptions) ( GTK_FILL ), (GtkAttachOptions) ( 0 ), 0, 0 ); gtk_misc_set_alignment( GTK_MISC( label ), 0, 0.5 ); + gtk_widget_show( label ); + combo_list = (GList*)NULL; combo_list = g_list_append( combo_list, (void *)_( "3" ) ); combo_list = g_list_append( combo_list, (void *)_( "5" ) ); combo_list = g_list_append( combo_list, (void *)_( "7" ) ); @@ -1904,62 +1784,55 @@ void DoNewPatchDlg(){ combo_list = g_list_append( combo_list, (void *)_( "13" ) ); combo_list = g_list_append( combo_list, (void *)_( "15" ) ); - combo = gtk_combo_new(); - width = GTK_COMBO( combo )->entry; - gtk_combo_set_popdown_strings( GTK_COMBO( combo ), combo_list ); - gtk_widget_show( combo ); + width_combo = combo = gtk_combo_box_text_new(); + for( lst = combo_list; lst != NULL; lst = g_list_next( lst ) ) + { + gtk_combo_box_text_append_text( GTK_COMBO_BOX_TEXT( combo ), (const char *)lst->data ); + } + gtk_combo_box_set_active( GTK_COMBO_BOX( combo ), 0 ); gtk_table_attach( GTK_TABLE( table ), combo, 1, 2, 0, 1, (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), (GtkAttachOptions) ( 0 ), 0, 0 ); - - combo = gtk_combo_new(); - height = GTK_COMBO( combo )->entry; - gtk_combo_set_popdown_strings( GTK_COMBO( combo ), combo_list ); gtk_widget_show( combo ); +// g_object_set( combo, "xalign", 1.0, NULL ); + cells = gtk_cell_layout_get_cells( GTK_CELL_LAYOUT( combo ) ); + for( lst = cells; lst != NULL; lst = g_list_next( lst ) ) + { + g_object_set( lst->data, "xalign", 1.0, NULL ); + } + g_list_free( cells ); + + height_combo = combo = gtk_combo_box_text_new(); + for( lst = combo_list; lst != NULL; lst = g_list_next( lst ) ) + { + gtk_combo_box_text_append_text( GTK_COMBO_BOX_TEXT( combo ), (const char *)lst->data ); + } + gtk_combo_box_set_active( GTK_COMBO_BOX( combo ), 0 ); gtk_table_attach( GTK_TABLE( table ), combo, 1, 2, 1, 2, (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), (GtkAttachOptions) ( 0 ), 0, 0 ); + gtk_widget_show( combo ); +// g_object_set( combo, "xalign", 1.0, NULL ); + cells = gtk_cell_layout_get_cells( GTK_CELL_LAYOUT( combo ) ); + for( lst = cells; lst != NULL; lst = g_list_next( lst ) ) + { + g_object_set( lst->data, "xalign", 1.0, NULL ); + } + g_list_free( cells ); - vbox = gtk_vbox_new( FALSE, 5 ); - gtk_widget_show( vbox ); - gtk_box_pack_start( GTK_BOX( hbox ), vbox, TRUE, TRUE, 0 ); - - button = gtk_button_new_with_label( _( "OK" ) ); - gtk_widget_show( button ); - gtk_box_pack_start( GTK_BOX( vbox ), button, FALSE, FALSE, 0 ); - g_signal_connect( G_OBJECT( button ), "clicked", - G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( IDOK ) ); - gtk_widget_set_usize( button, 60, -2 ); - - button = gtk_button_new_with_label( _( "Cancel" ) );; - gtk_widget_show( button ); - gtk_box_pack_start( GTK_BOX( vbox ), button, FALSE, FALSE, 0 ); - g_signal_connect( G_OBJECT( button ), "clicked", - G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( IDCANCEL ) ); - - // Initialize dialog g_list_free( combo_list ); - gtk_entry_set_text( GTK_ENTRY( width ), _( "3" ) ); - gtk_entry_set_editable( GTK_ENTRY( width ), FALSE ); - gtk_entry_set_text( GTK_ENTRY( height ), _( "3" ) ); - gtk_entry_set_editable( GTK_ENTRY( height ), FALSE ); - gtk_grab_add( dlg ); - gtk_widget_show( dlg ); + response_id = gtk_dialog_run( GTK_DIALOG( dialog ) ); - while ( loop ) - gtk_main_iteration(); - - if ( ret == IDOK ) { - const char* w = gtk_entry_get_text( GTK_ENTRY( width ) ); - const char* h = gtk_entry_get_text( GTK_ENTRY( height ) ); + if( response_id == GTK_RESPONSE_OK ) { + const char* w = gtk_combo_box_text_get_active_text( GTK_COMBO_BOX_TEXT( width_combo ) ); + const char* h = gtk_combo_box_text_get_active_text( GTK_COMBO_BOX_TEXT( height_combo ) ); Patch_GenericMesh( atoi( w ), atoi( h ), g_pParentWnd->ActiveXY()->GetViewType() ); Sys_UpdateWindows( W_ALL ); } - gtk_grab_remove( dlg ); - gtk_widget_destroy( dlg ); + gtk_widget_destroy( dialog ); } // ============================================================================= @@ -1995,191 +1868,159 @@ static void scaledlg_activate( GtkWidget *widget, gpointer data ){ scaledlg_apply( dialog, dialog ); } -void DoScaleDlg(){ - GtkWidget *dlg, *hbox, *table, *vbox, *label, *button; - GtkWidget *x, *y, *z; - GtkObject *adj; - int loop = 1, ret = IDCANCEL; +static void ScaleDialog_response( GtkWidget *widget, gint response_id, gpointer data ){ - dlg = gtk_window_new( GTK_WINDOW_TOPLEVEL ); - gtk_window_set_title( GTK_WINDOW( dlg ), _( "Scale" ) ); - g_signal_connect( G_OBJECT( dlg ), "delete-event", - G_CALLBACK( dialog_delete_callback ), NULL ); - g_signal_connect( G_OBJECT( dlg ), "destroy", - G_CALLBACK( gtk_widget_destroy ), NULL ); - g_object_set_data( G_OBJECT( dlg ), "loop", &loop ); - g_object_set_data( G_OBJECT( dlg ), "ret", &ret ); + if ( response_id == GTK_RESPONSE_OK || response_id == GTK_RESPONSE_APPLY ) { + scaledlg_apply( widget, widget ); + } + + if ( response_id == GTK_RESPONSE_OK || response_id == GTK_RESPONSE_CANCEL ) { + gtk_widget_destroy( GTK_WIDGET( widget ) ); + } +} + +void DoScaleDlg(){ + GtkWidget *dialog, *hbox, *table, *label; + GtkWidget *x, *y, *z, *content_area; + GtkAdjustment *adj; + GtkDialogFlags flags = GTK_DIALOG_DESTROY_WITH_PARENT; + + dialog = gtk_dialog_new_with_buttons( _( "Scale" ), NULL, flags, NULL ); + gtk_window_set_transient_for( GTK_WINDOW( dialog ), GTK_WINDOW( g_pParentWnd->m_pWidget ) ); + + gtk_dialog_add_button( GTK_DIALOG( dialog ), _( "OK" ), GTK_RESPONSE_OK ); + gtk_dialog_add_button( GTK_DIALOG( dialog ), _( "Cancel" ), GTK_RESPONSE_CANCEL ); + gtk_dialog_add_button( GTK_DIALOG( dialog ), _( "Apply" ), GTK_RESPONSE_APPLY ); + + content_area = gtk_dialog_get_content_area( GTK_DIALOG( dialog ) ); hbox = gtk_hbox_new( FALSE, 5 ); - gtk_widget_show( hbox ); - gtk_container_add( GTK_CONTAINER( dlg ), hbox ); + gtk_container_add( GTK_CONTAINER( content_area ), hbox ); gtk_container_set_border_width( GTK_CONTAINER( hbox ), 5 ); + gtk_widget_show( hbox ); table = gtk_table_new( 3, 2, FALSE ); - gtk_widget_show( table ); gtk_box_pack_start( GTK_BOX( hbox ), table, TRUE, TRUE, 0 ); gtk_table_set_row_spacings( GTK_TABLE( table ), 5 ); gtk_table_set_col_spacings( GTK_TABLE( table ), 5 ); + gtk_widget_show( table ); label = gtk_label_new( _( "X:" ) ); - gtk_widget_show( label ); gtk_table_attach( GTK_TABLE( table ), label, 0, 1, 0, 1, (GtkAttachOptions) ( GTK_FILL ), (GtkAttachOptions) ( 0 ), 0, 0 ); gtk_misc_set_alignment( GTK_MISC( label ), 0, 0.5 ); + gtk_widget_show( label ); label = gtk_label_new( _( "Y:" ) ); - gtk_widget_show( label ); gtk_table_attach( GTK_TABLE( table ), label, 0, 1, 1, 2, (GtkAttachOptions) ( GTK_FILL ), (GtkAttachOptions) ( 0 ), 0, 0 ); gtk_misc_set_alignment( GTK_MISC( label ), 0, 0.5 ); + gtk_widget_show( label ); label = gtk_label_new( _( "Z:" ) ); - gtk_widget_show( label ); gtk_table_attach( GTK_TABLE( table ), label, 0, 1, 2, 3, (GtkAttachOptions) ( GTK_FILL ), (GtkAttachOptions) ( 0 ), 0, 0 ); gtk_misc_set_alignment( GTK_MISC( label ), 0, 0.5 ); + gtk_widget_show( label ); - adj = gtk_adjustment_new( 1.0, 0, 100, 0.1, 1, 0 ); + adj = GTK_ADJUSTMENT( gtk_adjustment_new( 1.0, 0, 100, 0.1, 1, 0 ) ); x = gtk_spin_button_new( GTK_ADJUSTMENT( adj ), 0.1, 1 ); gtk_spin_button_set_wrap( GTK_SPIN_BUTTON( x ), TRUE ); gtk_spin_button_set_numeric( GTK_SPIN_BUTTON( x ), TRUE ); - gtk_widget_show( x ); gtk_table_attach( GTK_TABLE( table ), x, 1, 2, 0, 1, (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), (GtkAttachOptions) ( 0 ), 0, 0 ); - g_object_set_data( G_OBJECT( dlg ), "x", x ); - g_signal_connect_after( x, "activate", G_CALLBACK( scaledlg_activate ), dlg ); - g_object_set( x, "xalign", 1.0, NULL ); //right align numbers + gtk_entry_set_alignment( GTK_ENTRY( x ), 1.0 ); //right align numbers + gtk_widget_show( x ); + g_object_set_data( G_OBJECT( dialog ), "x", x ); + g_signal_connect_after( x, "activate", G_CALLBACK( scaledlg_activate ), dialog ); - adj = gtk_adjustment_new( 1.0, 0, 100, 0.1, 1, 0 ); + adj = GTK_ADJUSTMENT( gtk_adjustment_new( 1.0, 0, 100, 0.1, 1, 0 ) ); y = gtk_spin_button_new( GTK_ADJUSTMENT( adj ), 0.1, 1 ); gtk_spin_button_set_wrap( GTK_SPIN_BUTTON( y ), TRUE ); gtk_spin_button_set_numeric( GTK_SPIN_BUTTON( y ), TRUE ); - gtk_widget_show( y ); gtk_table_attach( GTK_TABLE( table ), y, 1, 2, 1, 2, (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), (GtkAttachOptions) ( 0 ), 0, 0 ); - g_object_set_data( G_OBJECT( dlg ), "y", y ); - g_signal_connect_after( y, "activate", G_CALLBACK( scaledlg_activate ), dlg ); - g_object_set( y, "xalign", 1.0, NULL ); //right align numbers + gtk_entry_set_alignment( GTK_ENTRY( y ), 1.0 ); //right align numbers + gtk_widget_show( y ); + g_object_set_data( G_OBJECT( dialog ), "y", y ); + g_signal_connect_after( y, "activate", G_CALLBACK( scaledlg_activate ), dialog ); - adj = gtk_adjustment_new( 1.0, 0, 100, 0.1, 1, 0 ); + + adj = GTK_ADJUSTMENT( gtk_adjustment_new( 1.0, 0, 100, 0.1, 1, 0 ) ); z = gtk_spin_button_new( GTK_ADJUSTMENT( adj ), 0.1, 1 ); gtk_spin_button_set_wrap( GTK_SPIN_BUTTON( z ), TRUE ); gtk_spin_button_set_numeric( GTK_SPIN_BUTTON( z ), TRUE ); - gtk_widget_show( z ); gtk_table_attach( GTK_TABLE( table ), z, 1, 2, 2, 3, (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), (GtkAttachOptions) ( 0 ), 0, 0 ); - g_object_set_data( G_OBJECT( dlg ), "z", z ); - g_signal_connect_after( z, "activate", G_CALLBACK( scaledlg_activate ), dlg ); - g_object_set( z, "xalign", 1.0, NULL ); //right align numbers + gtk_entry_set_alignment( GTK_ENTRY( z ), 1.0 ); //right align numbers + gtk_widget_show( z ); + g_object_set_data( G_OBJECT( dialog ), "z", z ); + g_signal_connect_after( z, "activate", G_CALLBACK( scaledlg_activate ), dialog ); - vbox = gtk_vbox_new( FALSE, 5 ); - gtk_widget_show( vbox ); - gtk_box_pack_start( GTK_BOX( hbox ), vbox, TRUE, TRUE, 0 ); + g_signal_connect( dialog, "response", G_CALLBACK( ScaleDialog_response ), dialog ); - button = gtk_button_new_with_label( _( "OK" ) ); - gtk_widget_show( button ); - gtk_box_pack_start( GTK_BOX( vbox ), button, FALSE, FALSE, 0 ); - g_signal_connect( G_OBJECT( button ), "clicked", - G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( IDOK ) ); - gtk_widget_set_usize( button, 60, -2 ); - - button = gtk_button_new_with_label( _( "Cancel" ) );; - gtk_widget_show( button ); - gtk_box_pack_start( GTK_BOX( vbox ), button, FALSE, FALSE, 0 ); - g_signal_connect( G_OBJECT( button ), "clicked", - G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( IDCANCEL ) ); - - button = gtk_button_new_with_label( _( "Apply" ) ); - gtk_widget_show( button ); - gtk_box_pack_start( GTK_BOX( vbox ), button, FALSE, FALSE, 0 ); - g_signal_connect( G_OBJECT( button ), "clicked", - G_CALLBACK( scaledlg_apply ), dlg ); - - gtk_grab_add( dlg ); - gtk_widget_show( dlg ); - - while ( loop ) - gtk_main_iteration(); - - if ( ret == IDOK ) { - scaledlg_apply( dlg, dlg ); - } - - gtk_grab_remove( dlg ); - gtk_widget_destroy( dlg ); + gtk_widget_show( dialog ); } // ============================================================================= // Thicken Patch dialog void DoThickenDlg(){ - GtkWidget *dlg, *vbox, *hbox, *vbox2, *button, *label; - GtkWidget *amount, *seams, *group; - int loop = 1, ret = IDCANCEL; + GtkWidget *dialog, *vbox, *hbox, *label, *content_area; + GtkWidget *amount, *seams, *group, *spin; + GtkAdjustment *adj; + gint response_id; + GtkDialogFlags flags = GTK_DIALOG_DESTROY_WITH_PARENT; static qboolean bGroupResult = true; - dlg = gtk_window_new( GTK_WINDOW_TOPLEVEL ); - gtk_window_set_title( GTK_WINDOW( dlg ), _( "Thicken Patch" ) ); - g_signal_connect( G_OBJECT( dlg ), "delete-event", - G_CALLBACK( dialog_delete_callback ), NULL ); - g_signal_connect( G_OBJECT( dlg ), "destroy", - G_CALLBACK( gtk_widget_destroy ), NULL ); - g_object_set_data( G_OBJECT( dlg ), "loop", &loop ); - g_object_set_data( G_OBJECT( dlg ), "ret", &ret ); + dialog = gtk_dialog_new_with_buttons( _( "Thicken Patch" ), NULL, flags, NULL ); + gtk_window_set_transient_for( GTK_WINDOW( dialog ), GTK_WINDOW( g_pParentWnd->m_pWidget ) ); + + gtk_dialog_add_button( GTK_DIALOG( dialog ), _( "OK" ), GTK_RESPONSE_OK ); + gtk_dialog_add_button( GTK_DIALOG( dialog ), _( "Cancel" ), GTK_RESPONSE_CANCEL ); + + content_area = gtk_dialog_get_content_area( GTK_DIALOG( dialog ) ); vbox = gtk_vbox_new( FALSE, 5 ); - gtk_widget_show( vbox ); - gtk_container_add( GTK_CONTAINER( dlg ), vbox ); + gtk_container_add( GTK_CONTAINER( content_area ), vbox ); gtk_container_set_border_width( GTK_CONTAINER( vbox ), 5 ); + gtk_widget_show( vbox ); hbox = gtk_hbox_new( FALSE, 5 ); - gtk_widget_show( hbox ); gtk_box_pack_start( GTK_BOX( vbox ), hbox, FALSE, TRUE, 0 ); + gtk_widget_show( hbox ); label = gtk_label_new( _( "This produces a set of patches\n" "that contains the original patch along with the\n" "'thick' patch and an optimal set of seam patches." ) ); - gtk_widget_show( label ); gtk_box_pack_start( GTK_BOX( hbox ), label, FALSE, FALSE, 0 ); - - vbox2 = gtk_vbox_new( FALSE, 5 ); - gtk_widget_show( vbox2 ); - gtk_box_pack_start( GTK_BOX( hbox ), vbox2, FALSE, TRUE, 0 ); - - button = gtk_button_new_with_label( _( "OK" ) ); - gtk_widget_show( button ); - gtk_box_pack_start( GTK_BOX( vbox2 ), button, FALSE, FALSE, 0 ); - g_signal_connect( G_OBJECT( button ), "clicked", - G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( IDOK ) ); - gtk_widget_set_usize( button, 60, -2 ); - - button = gtk_button_new_with_label( _( "Cancel" ) );; - gtk_widget_show( button ); - gtk_box_pack_start( GTK_BOX( vbox2 ), button, FALSE, FALSE, 0 ); - g_signal_connect( G_OBJECT( button ), "clicked", - G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( IDCANCEL ) ); + gtk_widget_show( label ); hbox = gtk_hbox_new( FALSE, 5 ); - gtk_widget_show( hbox ); gtk_box_pack_start( GTK_BOX( vbox ), hbox, FALSE, TRUE, 0 ); + gtk_widget_show( hbox ); label = gtk_label_new( _( "Amount:" ) ); - gtk_widget_show( label ); gtk_box_pack_start( GTK_BOX( hbox ), label, FALSE, FALSE, 0 ); + gtk_widget_show( label ); - amount = gtk_entry_new(); - gtk_widget_show( amount ); + adj = GTK_ADJUSTMENT( gtk_adjustment_new( 1, 1, 100, 1, 10, 0 ) ); + amount = spin = gtk_spin_button_new( GTK_ADJUSTMENT( adj ), 1, 0 ); gtk_box_pack_start( GTK_BOX( hbox ), amount, FALSE, FALSE, 0 ); + gtk_spin_button_set_wrap( GTK_SPIN_BUTTON( spin ), FALSE ); + gtk_spin_button_set_numeric( GTK_SPIN_BUTTON( spin ), TRUE ); + gtk_entry_set_alignment( GTK_ENTRY( spin ), 1.0 ); //right + gtk_widget_show( spin ); seams = gtk_check_button_new_with_label( _( "Seams" ) ); - gtk_widget_show( seams ); gtk_box_pack_start( GTK_BOX( hbox ), seams, FALSE, FALSE, 0 ); + gtk_widget_show( seams ); // bGroupResult group = gtk_check_button_new_with_label( _( "Result to func_group" ) ); @@ -2190,28 +2031,26 @@ void DoThickenDlg(){ // Initialize dialog gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( seams ), TRUE ); - gtk_entry_set_text( GTK_ENTRY( amount ), "8" ); + gtk_spin_button_set_value( GTK_SPIN_BUTTON( amount ), 8 ); - gtk_grab_add( dlg ); - gtk_widget_show( dlg ); - while ( loop ) - gtk_main_iteration(); + response_id = gtk_dialog_run( GTK_DIALOG( dialog ) ); + + if( response_id == GTK_RESPONSE_OK ) { + int new_amount; - if ( ret == IDOK ) { if ( gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( group ) ) ) { bGroupResult = true; } else{ bGroupResult = false; } - Patch_Thicken( atoi( gtk_entry_get_text( GTK_ENTRY( amount ) ) ), - gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( seams ) ), bGroupResult ); + new_amount = gtk_spin_button_get_value_as_int( GTK_SPIN_BUTTON( amount ) ); + Patch_Thicken( new_amount, gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( seams ) ), bGroupResult ); Sys_UpdateWindows( W_ALL ); } - gtk_grab_remove( dlg ); - gtk_widget_destroy( dlg ); + gtk_widget_destroy( dialog ); } // ============================================================================= @@ -2236,44 +2075,43 @@ void about_button_credits( GtkWidget *widget, gpointer data ){ } void DoAbout(){ - int loop = TRUE, ret = IDCANCEL; + GtkWidget *dialog, *content_area, *button; + GtkDialogFlags flags = GTK_DIALOG_DESTROY_WITH_PARENT; // create dialog window - GtkWidget *dlg = gtk_window_new( GTK_WINDOW_TOPLEVEL ); - gtk_window_set_transient_for( GTK_WINDOW( dlg ), GTK_WINDOW( g_pParentWnd->m_pWidget ) ); - gtk_window_set_position( GTK_WINDOW( dlg ), GTK_WIN_POS_CENTER_ON_PARENT ); - gtk_window_set_title( GTK_WINDOW( dlg ), _( "About GtkRadiant" ) ); - gtk_window_set_resizable( GTK_WINDOW( dlg ), FALSE ); - g_signal_connect( G_OBJECT( dlg ), "delete-event", - G_CALLBACK( dialog_delete_callback ), NULL ); - g_signal_connect( G_OBJECT( dlg ), "destroy", - G_CALLBACK( gtk_widget_destroy ), NULL ); - g_object_set_data( G_OBJECT( dlg ), "loop", &loop ); - g_object_set_data( G_OBJECT( dlg ), "ret", &ret ); + dialog = gtk_dialog_new_with_buttons( _( "About GtkRadiant" ), GTK_WINDOW( g_pParentWnd->m_pWidget ), flags, NULL ); + gtk_window_set_transient_for( GTK_WINDOW( dialog ), GTK_WINDOW( g_pParentWnd->m_pWidget ) ); + gtk_window_set_position( GTK_WINDOW( dialog ), GTK_WIN_POS_CENTER_ON_PARENT ); + gtk_window_set_resizable( GTK_WINDOW( dialog ), FALSE ); + + button = gtk_dialog_add_button( GTK_DIALOG( dialog ), _( "OK" ), GTK_RESPONSE_OK ); + gtk_widget_grab_focus( button ); + + content_area = gtk_dialog_get_content_area( GTK_DIALOG( dialog ) ); // layout top logo and everything else vertically without border padding GtkWidget *outer_vbox = gtk_vbox_new( FALSE, 0 ); - gtk_widget_show( outer_vbox ); - gtk_container_add( GTK_CONTAINER( dlg ), outer_vbox ); + gtk_container_add( GTK_CONTAINER( content_area ), outer_vbox ); gtk_container_set_border_width( GTK_CONTAINER( outer_vbox ), 0 ); + gtk_widget_show( outer_vbox ); // radiant logo CString s = g_strBitmapsPath; s += "logo.png"; GtkWidget *logo_image = gtk_image_new_from_file( s.GetBuffer() ); - gtk_widget_show( logo_image ); gtk_box_pack_start( GTK_BOX( outer_vbox ), logo_image, FALSE, FALSE, 0 ); + gtk_widget_show( logo_image ); // all other widgets layout GtkWidget *inner_vbox = gtk_vbox_new( FALSE, ABT_WIDGET_PADDING ); - gtk_widget_show( inner_vbox ); gtk_box_pack_start( GTK_BOX( outer_vbox ), inner_vbox, FALSE, FALSE, 0 ); gtk_container_set_border_width( GTK_CONTAINER( inner_vbox ), ABT_WIDGET_PADDING ); + gtk_widget_show( inner_vbox ); // informative text GtkWidget *info_hbox = gtk_hbox_new( FALSE, 0 ); - gtk_widget_show( info_hbox ); gtk_box_pack_start( GTK_BOX( inner_vbox ), info_hbox, FALSE, FALSE, 0 ); + gtk_widget_show( info_hbox ); GtkWidget *info_label = gtk_label_new( "GtkRadiant " RADIANT_VERSION " - " __DATE__ "\n" @@ -2283,73 +2121,77 @@ void DoAbout(){ "Visit http://icculus.org/gtkradiant/ to view a full list of credits,\n" "changelogs, and to report problems with this software." ); - gtk_widget_show( info_label ); gtk_box_pack_start( GTK_BOX( info_hbox ), info_label, FALSE, FALSE, 0 ); gtk_label_set_justify( GTK_LABEL( info_label ), GTK_JUSTIFY_LEFT ); + gtk_label_set_selectable( GTK_LABEL( info_label ), TRUE ); + gtk_widget_show( info_label ); // OpenGL properties GtkWidget *gl_prop_frame = gtk_frame_new( _( "OpenGL Properties" ) ); - gtk_widget_show( gl_prop_frame ); gtk_box_pack_start( GTK_BOX( inner_vbox ), gl_prop_frame, FALSE, FALSE, 0 ); + gtk_widget_show( gl_prop_frame ); GtkWidget *gl_prop_table = gtk_table_new( 3, 2, FALSE ); - gtk_widget_show( gl_prop_table ); gtk_container_add( GTK_CONTAINER( gl_prop_frame ), gl_prop_table ); gtk_table_set_row_spacings( GTK_TABLE( gl_prop_table ), 4 ); gtk_table_set_col_spacings( GTK_TABLE( gl_prop_table ), 4 ); gtk_container_set_border_width( GTK_CONTAINER( gl_prop_table ), 4 ); + gtk_widget_show( gl_prop_table ); GtkWidget *vendor_label = gtk_label_new( _( "Vendor:" ) ); - gtk_widget_show( vendor_label ); gtk_table_attach( GTK_TABLE( gl_prop_table ), vendor_label, 0, 1, 0, 1, (GtkAttachOptions) ( GTK_FILL ), (GtkAttachOptions) ( 0 ), 0, 0 ); gtk_misc_set_alignment( GTK_MISC( vendor_label ), 0, 0.5 ); + gtk_widget_show( vendor_label ); GtkWidget *version_label = gtk_label_new( _( "Version:" ) ); - gtk_widget_show( version_label ); gtk_table_attach( GTK_TABLE( gl_prop_table ), version_label, 0, 1, 1, 2, (GtkAttachOptions) ( GTK_FILL ), (GtkAttachOptions) ( 0 ), 0, 0 ); gtk_misc_set_alignment( GTK_MISC( version_label ), 0, 0.5 ); + gtk_widget_show( version_label ); GtkWidget *renderer_label = gtk_label_new( _( "Renderer:" ) ); - gtk_widget_show( renderer_label ); gtk_table_attach( GTK_TABLE( gl_prop_table ), renderer_label, 0, 1, 2, 3, (GtkAttachOptions) ( GTK_FILL ), (GtkAttachOptions) ( 0 ), 0, 0 ); gtk_misc_set_alignment( GTK_MISC( renderer_label ), 0, 0.5 ); + gtk_widget_show( renderer_label ); GtkWidget *gl_vendor_label = gtk_label_new( (char*)qglGetString( GL_VENDOR ) ); - gtk_widget_show( gl_vendor_label ); gtk_table_attach( GTK_TABLE( gl_prop_table ), gl_vendor_label, 1, 2, 0, 1, (GtkAttachOptions) ( GTK_FILL ), (GtkAttachOptions) ( 0 ), 0, 0 ); gtk_misc_set_alignment( GTK_MISC( gl_vendor_label ), 0, 0.5 ); + gtk_label_set_selectable( GTK_LABEL( gl_vendor_label ), TRUE ); + gtk_widget_show( gl_vendor_label ); GtkWidget *gl_version_label = gtk_label_new( (char*)qglGetString( GL_VERSION ) ); - gtk_widget_show( gl_version_label ); gtk_table_attach( GTK_TABLE( gl_prop_table ), gl_version_label, 1, 2, 1, 2, (GtkAttachOptions) ( GTK_FILL ), (GtkAttachOptions) ( 0 ), 0, 0 ); gtk_misc_set_alignment( GTK_MISC( gl_version_label ), 0, 0.5 ); + gtk_label_set_selectable( GTK_LABEL( gl_version_label ), TRUE ); + gtk_widget_show( gl_version_label ); GtkWidget *gl_renderer_label = gtk_label_new( (char*)qglGetString( GL_RENDERER ) ); - gtk_widget_show( gl_renderer_label ); gtk_table_attach( GTK_TABLE( gl_prop_table ), gl_renderer_label, 1, 2, 2, 3, (GtkAttachOptions) ( GTK_FILL ), (GtkAttachOptions) ( 0 ), 0, 0 ); gtk_misc_set_alignment( GTK_MISC( gl_renderer_label ), 0, 0.5 ); + gtk_label_set_selectable( GTK_LABEL( gl_renderer_label ), TRUE ); + gtk_widget_show( gl_renderer_label ); // OpenGL extensions GtkWidget *gl_ext_frame = gtk_frame_new( _( "OpenGL Extensions" ) ); - gtk_widget_show( gl_ext_frame ); gtk_box_pack_start( GTK_BOX( inner_vbox ), gl_ext_frame, TRUE, TRUE, 0 ); + gtk_widget_show( gl_ext_frame ); GtkWidget *gl_ext_hbox = gtk_hbox_new( FALSE, ABT_WIDGET_PADDING ); - gtk_widget_show( gl_ext_hbox ); gtk_container_add( GTK_CONTAINER( gl_ext_frame ), gl_ext_hbox ); gtk_container_set_border_width( GTK_CONTAINER( gl_ext_hbox ), 4 ); + gtk_widget_show( gl_ext_hbox ); GtkWidget *gl_ext_scroll = gtk_scrolled_window_new( NULL, NULL ); gtk_box_pack_start( GTK_BOX( gl_ext_hbox ), gl_ext_scroll, TRUE, TRUE, 0 ); @@ -2365,16 +2207,6 @@ void DoAbout(){ gtk_text_view_set_wrap_mode( GTK_TEXT_VIEW( gl_ext_textview ), GTK_WRAP_WORD );; gtk_widget_show( gl_ext_textview ); - // buttons - GtkWidget *button_hbox = gtk_hbox_new( FALSE, 4 ); - gtk_widget_show( button_hbox ); - gtk_box_pack_start( GTK_BOX( inner_vbox ), button_hbox, FALSE, TRUE, 0 ); - - GtkWidget *ok_button = gtk_button_new_with_label( _( "OK" ) ); - gtk_widget_show( ok_button ); - gtk_box_pack_end( GTK_BOX( button_hbox ), ok_button, FALSE, FALSE, 0 ); - g_signal_connect( G_OBJECT( ok_button ), "clicked", - G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( IDOK ) ); /* button = gtk_button_new_with_label( _( "Credits" ) ); @@ -2390,46 +2222,38 @@ void DoAbout(){ G_CALLBACK( about_button_changelog ), NULL ); */ - // show it - gtk_grab_add( dlg ); - gtk_widget_show( dlg ); + gtk_dialog_run( GTK_DIALOG( dialog ) ); - while( loop ) - gtk_main_iteration(); - - gtk_grab_remove( dlg ); - gtk_widget_destroy( dlg ); + gtk_widget_destroy( dialog ); } // ============================================================================= // Command List dialog void DoCommandListDlg(){ - GtkWidget *dlg, *vbox, *hbox, *scr, *button; - int loop = 1, ret = IDCANCEL; + GtkWidget *dialog, *hbox, *scr, *content_area, *button; + GtkDialogFlags flags = GTK_DIALOG_DESTROY_WITH_PARENT; - dlg = gtk_window_new( GTK_WINDOW_TOPLEVEL ); - gtk_window_set_transient_for( GTK_WINDOW( dlg ), GTK_WINDOW( g_pParentWnd->m_pWidget ) ); - gtk_window_set_position( GTK_WINDOW( dlg ), GTK_WIN_POS_CENTER_ON_PARENT ); - gtk_window_set_title( GTK_WINDOW( dlg ), _( "Shortcut List" ) ); - g_signal_connect( G_OBJECT( dlg ), "delete-event", - G_CALLBACK( dialog_delete_callback ), NULL ); - g_signal_connect( G_OBJECT( dlg ), "destroy", - G_CALLBACK( gtk_widget_destroy ), NULL ); - g_object_set_data( G_OBJECT( dlg ), "loop", &loop ); - g_object_set_data( G_OBJECT( dlg ), "ret", &ret ); - gtk_window_set_default_size( GTK_WINDOW( dlg ), 400, 400 ); + dialog = gtk_dialog_new_with_buttons( _( "Shortcut List" ), NULL, flags, NULL ); + gtk_window_set_transient_for( GTK_WINDOW( dialog ), GTK_WINDOW( g_pParentWnd->m_pWidget ) ); + gtk_window_set_position( GTK_WINDOW( dialog ), GTK_WIN_POS_CENTER_ON_PARENT ); + gtk_window_set_default_size( GTK_WINDOW( dialog ), 400, 400 ); + + button = gtk_dialog_add_button( GTK_DIALOG( dialog ), _( "OK" ), GTK_RESPONSE_OK ); + gtk_widget_grab_focus( button ); + + content_area = gtk_dialog_get_content_area( GTK_DIALOG( dialog ) ); hbox = gtk_hbox_new( FALSE, 5 ); - gtk_widget_show( hbox ); - gtk_container_add( GTK_CONTAINER( dlg ), hbox ); + gtk_container_add( GTK_CONTAINER( content_area ), hbox ); gtk_container_set_border_width( GTK_CONTAINER( hbox ), 5 ); + gtk_widget_show( hbox ); scr = gtk_scrolled_window_new( (GtkAdjustment*)NULL, (GtkAdjustment*)NULL ); - gtk_widget_show( scr ); gtk_box_pack_start( GTK_BOX( hbox ), scr, TRUE, TRUE, 0 ); gtk_scrolled_window_set_policy( GTK_SCROLLED_WINDOW( scr ), GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC ); gtk_scrolled_window_set_shadow_type( GTK_SCROLLED_WINDOW( scr ), GTK_SHADOW_IN ); + gtk_widget_show( scr ); { GtkListStore* store = gtk_list_store_new( 2, G_TYPE_STRING, G_TYPE_STRING ); @@ -2521,54 +2345,67 @@ void DoCommandListDlg(){ g_object_unref( G_OBJECT( store ) ); } - vbox = gtk_vbox_new( FALSE, 5 ); - gtk_widget_show( vbox ); - gtk_box_pack_start( GTK_BOX( hbox ), vbox, FALSE, FALSE, 0 ); - button = gtk_button_new_with_label( _( "Close" ) );; - gtk_widget_show( button ); - gtk_box_pack_end( GTK_BOX( vbox ), button, FALSE, FALSE, 0 ); - g_signal_connect( G_OBJECT( button ), "clicked", - G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( IDOK ) ); - gtk_widget_set_usize( button, 60, -2 ); + gtk_dialog_run( GTK_DIALOG( dialog ) ); - gtk_grab_add( dlg ); - gtk_widget_show( dlg ); - - while ( loop ) - gtk_main_iteration(); - - gtk_grab_remove( dlg ); - gtk_widget_destroy( dlg ); + gtk_widget_destroy( dialog ); } // ============================================================================= // Texture List dialog -void DoTextureListDlg(){ - GtkWidget *dlg, *vbox, *hbox, *scr, *button; - int loop = 1, ret = IDCANCEL; +static void TextureListDialog_apply( GtkWidget *widget, gpointer data ){ - dlg = gtk_window_new( GTK_WINDOW_TOPLEVEL ); - gtk_window_set_title( GTK_WINDOW( dlg ), _( "Textures" ) ); - g_signal_connect( G_OBJECT( dlg ), "delete-event", - G_CALLBACK( dialog_delete_callback ), NULL ); - g_signal_connect( G_OBJECT( dlg ), "destroy", - G_CALLBACK( gtk_widget_destroy ), NULL ); - g_object_set_data( G_OBJECT( dlg ), "loop", &loop ); - g_object_set_data( G_OBJECT( dlg ), "ret", &ret ); - gtk_window_set_default_size( GTK_WINDOW( dlg ), 400, 400 ); + GtkWidget *texture_list; + GtkTreeSelection* selection; + GtkTreeModel* model; + GtkTreeIter iter; + + texture_list = GTK_WIDGET( g_object_get_data( G_OBJECT( widget ), "view" ) ); + selection = gtk_tree_view_get_selection( GTK_TREE_VIEW( texture_list ) ); + + if ( gtk_tree_selection_get_selected( selection, &model, &iter ) ) { + GtkTreePath* path = gtk_tree_model_get_path( model, &iter ); + if ( gtk_tree_path_get_depth( path ) == 1 ) { + Texture_ShowDirectory( gtk_tree_path_get_indices( path )[0] + CMD_TEXTUREWAD ); + } + gtk_tree_path_free( path ); + } +} +static void TextureListDialog_response( GtkWidget *widget, gint response_id, gpointer data ){ + + if ( response_id == GTK_RESPONSE_OK || response_id == GTK_RESPONSE_APPLY ) { + TextureListDialog_apply( widget, widget ); + } + + if ( response_id == GTK_RESPONSE_OK || response_id == GTK_RESPONSE_CANCEL ) { + gtk_widget_destroy( GTK_WIDGET( widget ) ); + } +} +void DoTextureListDlg(){ + GtkWidget *dialog, *hbox, *scr, *content_area; + GtkDialogFlags flags = GTK_DIALOG_DESTROY_WITH_PARENT; + + dialog = gtk_dialog_new_with_buttons( _( "Textures" ), NULL, flags, NULL ); + gtk_window_set_transient_for( GTK_WINDOW( dialog ), GTK_WINDOW( g_pParentWnd->m_pWidget ) ); + + gtk_dialog_add_button( GTK_DIALOG( dialog ), _( "Load" ), GTK_RESPONSE_OK ); + gtk_dialog_add_button( GTK_DIALOG( dialog ), _( "Cancel" ), GTK_RESPONSE_CANCEL ); + + gtk_window_set_default_size( GTK_WINDOW( dialog ), 400, 400 ); + + content_area = gtk_dialog_get_content_area( GTK_DIALOG( dialog ) ); hbox = gtk_hbox_new( FALSE, 5 ); - gtk_widget_show( hbox ); - gtk_container_add( GTK_CONTAINER( dlg ), hbox ); + gtk_container_add( GTK_CONTAINER( content_area ), hbox ); gtk_container_set_border_width( GTK_CONTAINER( hbox ), 5 ); + gtk_widget_show( hbox ); scr = gtk_scrolled_window_new( (GtkAdjustment*)NULL, (GtkAdjustment*)NULL ); - gtk_widget_show( scr ); gtk_box_pack_start( GTK_BOX( hbox ), scr, TRUE, TRUE, 0 ); gtk_scrolled_window_set_policy( GTK_SCROLLED_WINDOW( scr ), GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC ); gtk_scrolled_window_set_shadow_type( GTK_SCROLLED_WINDOW( scr ), GTK_SHADOW_IN ); + gtk_widget_show( scr ); GtkWidget* texture_list; @@ -2606,72 +2443,37 @@ void DoTextureListDlg(){ g_object_unref( G_OBJECT( store ) ); texture_list = view; + g_object_set_data( G_OBJECT( dialog ), "view", view ); } - vbox = gtk_vbox_new( FALSE, 5 ); - gtk_widget_show( vbox ); - gtk_box_pack_start( GTK_BOX( hbox ), vbox, FALSE, FALSE, 0 ); + g_signal_connect( dialog, "response", G_CALLBACK( TextureListDialog_response ), texture_list ); - button = gtk_button_new_with_label( _( "Load" ) );; - gtk_widget_show( button ); - gtk_box_pack_start( GTK_BOX( vbox ), button, FALSE, FALSE, 0 ); - g_signal_connect( G_OBJECT( button ), "clicked", - G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( IDOK ) ); - gtk_widget_set_usize( button, 60, -2 ); - - button = gtk_button_new_with_label( _( "Close" ) );; - gtk_widget_show( button ); - gtk_box_pack_start( GTK_BOX( vbox ), button, FALSE, FALSE, 0 ); - g_signal_connect( G_OBJECT( button ), "clicked", - G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( IDCANCEL ) ); - gtk_widget_set_usize( button, 60, -2 ); - - gtk_grab_add( dlg ); - gtk_widget_show( dlg ); - - while ( loop ) - gtk_main_iteration(); - - if ( ret == IDOK ) { - GtkTreeSelection* selection = gtk_tree_view_get_selection( GTK_TREE_VIEW( texture_list ) ); - - GtkTreeModel* model; - GtkTreeIter iter; - if ( gtk_tree_selection_get_selected( selection, &model, &iter ) ) { - GtkTreePath* path = gtk_tree_model_get_path( model, &iter ); - if ( gtk_tree_path_get_depth( path ) == 1 ) { - Texture_ShowDirectory( gtk_tree_path_get_indices( path )[0] + CMD_TEXTUREWAD ); - } - gtk_tree_path_free( path ); - } - } - - gtk_grab_remove( dlg ); - gtk_widget_destroy( dlg ); + gtk_widget_show( dialog ); } // ============================================================================= // Cap dialog int DoCapDlg( int *type, bool *b_GroupResult ){ - GtkWidget *dlg, *vbox, *hbox, *table, *pixmap, *button, *group_toggle, *radio_vbox; + GtkWidget *dialog, *hbox, *table, *pixmap, *group_toggle, *radio_vbox, *content_area; GtkWidget *bevel, *endcap, *ibevel, *iendcap; + gint response_id; + int ret; GSList *group = (GSList*)NULL; - int loop = 1, ret = IDCANCEL; + GtkDialogFlags flags = GTK_DIALOG_DESTROY_WITH_PARENT; - dlg = gtk_window_new( GTK_WINDOW_TOPLEVEL ); - gtk_window_set_title( GTK_WINDOW( dlg ), _( "Cap" ) ); - g_signal_connect( G_OBJECT( dlg ), "delete-event", - G_CALLBACK( dialog_delete_callback ), NULL ); - g_signal_connect( G_OBJECT( dlg ), "destroy", - G_CALLBACK( gtk_widget_destroy ), NULL ); - g_object_set_data( G_OBJECT( dlg ), "loop", &loop ); - g_object_set_data( G_OBJECT( dlg ), "ret", &ret ); + dialog = gtk_dialog_new_with_buttons( _( "Cap" ), NULL, flags, NULL ); + gtk_window_set_transient_for( GTK_WINDOW( dialog ), GTK_WINDOW( g_pParentWnd->m_pWidget ) ); + + gtk_dialog_add_button( GTK_DIALOG( dialog ), _( "OK" ), GTK_RESPONSE_OK ); + gtk_dialog_add_button( GTK_DIALOG( dialog ), _( "Cancel" ), GTK_RESPONSE_CANCEL ); + + content_area = gtk_dialog_get_content_area( GTK_DIALOG( dialog ) ); hbox = gtk_hbox_new( FALSE, 5 ); - gtk_widget_show( hbox ); - gtk_container_add( GTK_CONTAINER( dlg ), hbox ); + gtk_container_add( GTK_CONTAINER( content_area ), hbox ); gtk_container_set_border_width( GTK_CONTAINER( hbox ), 5 ); + gtk_widget_show( hbox ); // Gef: Added a vbox to contain the toggle buttons radio_vbox = gtk_vbox_new( FALSE, 4 ); @@ -2679,61 +2481,65 @@ int DoCapDlg( int *type, bool *b_GroupResult ){ gtk_widget_show( radio_vbox ); table = gtk_table_new( 4, 2, FALSE ); - gtk_widget_show( table ); gtk_box_pack_start( GTK_BOX( radio_vbox ), table, TRUE, TRUE, 0 ); gtk_table_set_row_spacings( GTK_TABLE( table ), 5 ); gtk_table_set_col_spacings( GTK_TABLE( table ), 5 ); + gtk_widget_show( table ); pixmap = new_image_icon("cap_bevel.png"); - gtk_widget_show( pixmap ); gtk_table_attach( GTK_TABLE( table ), pixmap, 0, 1, 0, 1, (GtkAttachOptions) ( GTK_FILL ), (GtkAttachOptions) ( 0 ), 0, 0 ); + gtk_widget_show( pixmap ); pixmap = new_image_icon("cap_endcap.png"); - gtk_widget_show( pixmap ); gtk_table_attach( GTK_TABLE( table ), pixmap, 0, 1, 1, 2, (GtkAttachOptions) ( GTK_FILL ), (GtkAttachOptions) ( 0 ), 0, 0 ); + gtk_widget_show( pixmap ); pixmap = new_image_icon("cap_ibevel.png"); - gtk_widget_show( pixmap ); gtk_table_attach( GTK_TABLE( table ), pixmap, 0, 1, 2, 3, (GtkAttachOptions) ( GTK_FILL ), (GtkAttachOptions) ( 0 ), 0, 0 ); + gtk_widget_show( pixmap ); pixmap = new_image_icon("cap_iendcap.png"); - gtk_widget_show( pixmap ); gtk_table_attach( GTK_TABLE( table ), pixmap, 0, 1, 3, 4, (GtkAttachOptions) ( GTK_FILL ), (GtkAttachOptions) ( 0 ), 0, 0 ); + gtk_widget_show( pixmap ); bevel = gtk_radio_button_new_with_label( group, _( "Bevel" ) ); - gtk_widget_show( bevel ); gtk_table_attach( GTK_TABLE( table ), bevel, 1, 2, 0, 1, (GtkAttachOptions) ( GTK_FILL | GTK_EXPAND ), (GtkAttachOptions) ( 0 ), 0, 0 ); + gtk_widget_show( bevel ); + group = gtk_radio_button_get_group( GTK_RADIO_BUTTON( bevel ) ); endcap = gtk_radio_button_new_with_label( group, _( "Endcap" ) ); - gtk_widget_show( endcap ); gtk_table_attach( GTK_TABLE( table ), endcap, 1, 2, 1, 2, (GtkAttachOptions) ( GTK_FILL | GTK_EXPAND ), (GtkAttachOptions) ( 0 ), 0, 0 ); + gtk_widget_show( endcap ); + group = gtk_radio_button_get_group( GTK_RADIO_BUTTON( endcap ) ); ibevel = gtk_radio_button_new_with_label( group, _( "Inverted Bevel" ) ); - gtk_widget_show( ibevel ); gtk_table_attach( GTK_TABLE( table ), ibevel, 1, 2, 2, 3, (GtkAttachOptions) ( GTK_FILL | GTK_EXPAND ), (GtkAttachOptions) ( 0 ), 0, 0 ); + gtk_widget_show( ibevel ); + group = gtk_radio_button_get_group( GTK_RADIO_BUTTON( ibevel ) ); iendcap = gtk_radio_button_new_with_label( group, _( "Inverted Endcap" ) ); - gtk_widget_show( iendcap ); gtk_table_attach( GTK_TABLE( table ), iendcap, 1, 2, 3, 4, (GtkAttachOptions) ( GTK_FILL | GTK_EXPAND ), (GtkAttachOptions) ( 0 ), 0, 0 ); + gtk_widget_show( iendcap ); + group = gtk_radio_button_get_group( GTK_RADIO_BUTTON( iendcap ) ); // Gef: added radio toggle for func_grouping capped patches @@ -2741,37 +2547,16 @@ int DoCapDlg( int *type, bool *b_GroupResult ){ gtk_container_add( GTK_CONTAINER( radio_vbox ), group_toggle ); gtk_widget_show( group_toggle ); - vbox = gtk_vbox_new( FALSE, 5 ); - gtk_widget_show( vbox ); - gtk_box_pack_start( GTK_BOX( hbox ), vbox, FALSE, FALSE, 0 ); - - button = gtk_button_new_with_label( _( "OK" ) ); - gtk_widget_show( button ); - gtk_box_pack_start( GTK_BOX( vbox ), button, FALSE, FALSE, 0 ); - g_signal_connect( G_OBJECT( button ), "clicked", - G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( IDOK ) ); - gtk_widget_set_usize( button, 60, -2 ); - - button = gtk_button_new_with_label( _( "Cancel" ) ); - gtk_widget_show( button ); - gtk_box_pack_start( GTK_BOX( vbox ), button, FALSE, FALSE, 0 ); - g_signal_connect( G_OBJECT( button ), "clicked", - G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( IDCANCEL ) ); - gtk_widget_set_usize( button, 60, -2 ); - // Gef: Set the state of the func_group toggle gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( group_toggle ), *b_GroupResult ); // Initialize dialog gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( bevel ), TRUE ); - gtk_grab_add( dlg ); - gtk_widget_show( dlg ); - while ( loop ) - gtk_main_iteration(); + response_id = gtk_dialog_run( GTK_DIALOG( dialog ) ); - if ( ret == IDOK ) { + if( response_id == GTK_RESPONSE_OK ) { if ( gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( bevel ) ) ) { *type = BEVEL; //*type = CapDialog::BEVEL; } @@ -2787,10 +2572,13 @@ int DoCapDlg( int *type, bool *b_GroupResult ){ } // Gef: Added toggle for optional cap func_grouping *b_GroupResult = (bool)gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( group_toggle ) ); + + ret = IDOK; + } else { + ret = IDCANCEL; } - gtk_grab_remove( dlg ); - gtk_widget_destroy( dlg ); + gtk_widget_destroy( dialog ); return ret; } @@ -2799,41 +2587,44 @@ int DoCapDlg( int *type, bool *b_GroupResult ){ // Scripts dialog void DoScriptsDlg(){ - GtkWidget *dlg, *vbox, *vbox2, *hbox, *label, *button, *scr; - int loop = 1, ret = IDCANCEL; + GtkWidget *dialog, *vbox, *vbox2, *hbox, *label, *button, *scr; + GtkWidget *run_button, *new_button, *edit_button, *content_area; + GtkSizeGroup *button_group; + gint response_id; + GtkDialogFlags flags = GTK_DIALOG_DESTROY_WITH_PARENT; - dlg = gtk_window_new( GTK_WINDOW_TOPLEVEL ); - gtk_window_set_title( GTK_WINDOW( dlg ), _( "Available Scripts - Not Implemented Yet" ) ); - g_signal_connect( G_OBJECT( dlg ), "delete-event", - G_CALLBACK( dialog_delete_callback ), NULL ); - g_signal_connect( G_OBJECT( dlg ), "destroy", - G_CALLBACK( gtk_widget_destroy ), NULL ); - g_object_set_data( G_OBJECT( dlg ), "loop", &loop ); - g_object_set_data( G_OBJECT( dlg ), "ret", &ret ); + dialog = gtk_dialog_new_with_buttons( _( "Available Scripts - Not Implemented Yet" ), NULL, flags, NULL ); + gtk_window_set_transient_for( GTK_WINDOW( dialog ), GTK_WINDOW( g_pParentWnd->m_pWidget ) ); + +// gtk_dialog_add_button( GTK_DIALOG( dialog ), _( "OK" ), GTK_RESPONSE_OK ); +// gtk_dialog_add_button( GTK_DIALOG( dialog ), _( "Cancel" ), GTK_RESPONSE_CANCEL ); + gtk_dialog_add_button( GTK_DIALOG( dialog ), _( "Close" ), GTK_RESPONSE_CANCEL ); + + content_area = gtk_dialog_get_content_area( GTK_DIALOG( dialog ) ); vbox = gtk_vbox_new( FALSE, 5 ); - gtk_widget_show( vbox ); - gtk_container_add( GTK_CONTAINER( dlg ), vbox ); + gtk_container_add( GTK_CONTAINER( content_area ), vbox ); gtk_container_set_border_width( GTK_CONTAINER( vbox ), 5 ); + gtk_widget_show( vbox ); label = gtk_label_new( _( "WARNING: BrushScripting is in a highly experimental state and is\n" "far from complete. If you attempt to use them it is VERY LIKELY\n" "that Radiant will crash. Save your work before attempting to\n" "make use of any scripting features." ) ); - gtk_widget_show( label ); gtk_box_pack_start( GTK_BOX( vbox ), label, FALSE, FALSE, 0 ); - gtk_misc_set_alignment( GTK_MISC( label ), 1, 0.5 ); + gtk_misc_set_alignment( GTK_MISC( label ), 0, 0.5 ); gtk_label_set_justify( GTK_LABEL( label ), GTK_JUSTIFY_LEFT ); + gtk_widget_show( label ); hbox = gtk_hbox_new( FALSE, 5 ); - gtk_widget_show( hbox ); gtk_box_pack_start( GTK_BOX( vbox ), hbox, TRUE, TRUE, 0 ); + gtk_widget_show( hbox ); scr = gtk_scrolled_window_new( (GtkAdjustment*)NULL, (GtkAdjustment*)NULL ); - gtk_widget_show( scr ); gtk_box_pack_start( GTK_BOX( hbox ), scr, TRUE, TRUE, 0 ); gtk_scrolled_window_set_policy( GTK_SCROLLED_WINDOW( scr ), GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC ); gtk_scrolled_window_set_shadow_type( GTK_SCROLLED_WINDOW( scr ), GTK_SHADOW_IN ); + gtk_widget_show( scr ); GtkWidget* scripts_list; @@ -2889,42 +2680,36 @@ void DoScriptsDlg(){ } vbox2 = gtk_vbox_new( FALSE, 5 ); - gtk_widget_show( vbox2 ); gtk_box_pack_start( GTK_BOX( hbox ), vbox2, FALSE, FALSE, 0 ); + gtk_widget_show( vbox2 ); - button = gtk_button_new_with_label( _( "Run" ) ); - gtk_widget_show( button ); + run_button = button = gtk_button_new_with_label( _( "Run" ) ); gtk_box_pack_start( GTK_BOX( vbox2 ), button, FALSE, FALSE, 0 ); g_signal_connect( G_OBJECT( button ), "clicked", G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( IDOK ) ); - gtk_widget_set_usize( button, 60, -2 ); - - button = gtk_button_new_with_label( _( "New..." ) ); gtk_widget_show( button ); + + new_button = button = gtk_button_new_with_label( _( "New..." ) ); gtk_box_pack_start( GTK_BOX( vbox2 ), button, FALSE, FALSE, 0 ); gtk_widget_set_sensitive( button, FALSE ); - gtk_widget_set_usize( button, 60, -2 ); - - button = gtk_button_new_with_label( _( "Edit..." ) ); gtk_widget_show( button ); + + edit_button = button = gtk_button_new_with_label( _( "Edit..." ) ); gtk_box_pack_start( GTK_BOX( vbox2 ), button, FALSE, FALSE, 0 ); gtk_widget_set_sensitive( button, FALSE ); - gtk_widget_set_usize( button, 60, -2 ); - - button = gtk_button_new_with_label( _( "Close" ) ); gtk_widget_show( button ); - gtk_box_pack_end( GTK_BOX( vbox2 ), button, FALSE, FALSE, 0 ); - g_signal_connect( G_OBJECT( button ), "clicked", - G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( IDCANCEL ) ); - gtk_widget_set_usize( button, 60, -2 ); - gtk_grab_add( dlg ); - gtk_widget_show( dlg ); - while ( loop ) - gtk_main_iteration(); + button_group = gtk_size_group_new( GTK_SIZE_GROUP_BOTH ); + gtk_size_group_add_widget( button_group, run_button ); + gtk_size_group_add_widget( button_group, new_button ); + gtk_size_group_add_widget( button_group, edit_button ); + g_object_unref( button_group ); - if ( ret == IDOK ) { + + response_id = gtk_dialog_run( GTK_DIALOG( dialog ) ); + + if( response_id == GTK_RESPONSE_OK ) { GtkTreeSelection* selection = gtk_tree_view_get_selection( GTK_TREE_VIEW( scripts_list ) ); GtkTreeModel* model; @@ -2937,35 +2722,35 @@ void DoScriptsDlg(){ } } - gtk_grab_remove( dlg ); - gtk_widget_destroy( dlg ); + gtk_widget_destroy( dialog ); } // ============================================================================= // dialog int DoBSInputDlg( const char *fields[5], float values[5] ){ - GtkWidget *dlg, *vbox, *hbox, *label, *button; + GtkWidget *dialog, *vbox, *hbox, *label, *content_area; GtkWidget *entries[5]; - int i, loop = 1, ret = IDCANCEL; + int i, ret; + gint response_id; + GtkDialogFlags flags = GTK_DIALOG_DESTROY_WITH_PARENT; - dlg = gtk_window_new( GTK_WINDOW_TOPLEVEL ); - gtk_window_set_title( GTK_WINDOW( dlg ), _( "BrushScript Input" ) ); - g_signal_connect( G_OBJECT( dlg ), "delete-event", - G_CALLBACK( dialog_delete_callback ), NULL ); - g_signal_connect( G_OBJECT( dlg ), "destroy", - G_CALLBACK( gtk_widget_destroy ), NULL ); - g_object_set_data( G_OBJECT( dlg ), "loop", &loop ); - g_object_set_data( G_OBJECT( dlg ), "ret", &ret ); + dialog = gtk_dialog_new_with_buttons( _( "BrushScript Input" ), NULL, flags, NULL ); + gtk_window_set_transient_for( GTK_WINDOW( dialog ), GTK_WINDOW( g_pParentWnd->m_pWidget ) ); + + gtk_dialog_add_button( GTK_DIALOG( dialog ), _( "OK" ), GTK_RESPONSE_OK ); + gtk_dialog_add_button( GTK_DIALOG( dialog ), _( "Cancel" ), GTK_RESPONSE_CANCEL ); + + content_area = gtk_dialog_get_content_area( GTK_DIALOG( dialog ) ); hbox = gtk_hbox_new( FALSE, 5 ); - gtk_widget_show( hbox ); - gtk_container_add( GTK_CONTAINER( dlg ), hbox ); + gtk_container_add( GTK_CONTAINER( content_area ), hbox ); gtk_container_set_border_width( GTK_CONTAINER( hbox ), 5 ); + gtk_widget_show( hbox ); vbox = gtk_vbox_new( FALSE, 5 ); - gtk_widget_show( vbox ); gtk_box_pack_start( GTK_BOX( hbox ), vbox, TRUE, TRUE, 0 ); + gtk_widget_show( vbox ); // Create entries and initialize them for ( i = 0; i < 5; i++ ) @@ -2975,43 +2760,22 @@ int DoBSInputDlg( const char *fields[5], float values[5] ){ } label = gtk_label_new( fields[i] ); - gtk_widget_show( label ); gtk_box_pack_start( GTK_BOX( vbox ), label, FALSE, FALSE, 0 ); gtk_misc_set_alignment( GTK_MISC( label ), 1, 0.5 ); gtk_label_set_justify( GTK_LABEL( label ), GTK_JUSTIFY_LEFT ); + gtk_widget_show( label ); entries[i] = gtk_entry_new(); - gtk_widget_show( entries[i] ); gtk_box_pack_start( GTK_BOX( vbox ), entries[i], TRUE, TRUE, 0 ); + gtk_widget_show( entries[i] ); char buf[32]; sprintf( buf, "%f", values[i] ); gtk_entry_set_text( GTK_ENTRY( entries[i] ), buf ); } - vbox = gtk_vbox_new( FALSE, 5 ); - gtk_widget_show( vbox ); - gtk_box_pack_start( GTK_BOX( hbox ), vbox, FALSE, FALSE, 0 ); - button = gtk_button_new_with_label( _( "OK" ) ); - gtk_widget_show( button ); - gtk_box_pack_start( GTK_BOX( vbox ), button, FALSE, FALSE, 0 ); - g_signal_connect( G_OBJECT( button ), "clicked", - G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( IDOK ) ); - gtk_widget_set_usize( button, 60, -2 ); - - button = gtk_button_new_with_label( _( "Cancel" ) ); - gtk_widget_show( button ); - gtk_box_pack_start( GTK_BOX( vbox ), button, FALSE, FALSE, 0 ); - g_signal_connect( G_OBJECT( button ), "clicked", - G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( IDCANCEL ) ); - gtk_widget_set_usize( button, 60, -2 ); - - gtk_grab_add( dlg ); - gtk_widget_show( dlg ); - - while ( loop ) - gtk_main_iteration(); + response_id = gtk_dialog_run( GTK_DIALOG( dialog ) ); for ( i = 0; i < 5; i++ ) { @@ -3021,9 +2785,17 @@ int DoBSInputDlg( const char *fields[5], float values[5] ){ values[i] = atof( gtk_entry_get_text( GTK_ENTRY( entries[i] ) ) ); } + switch( response_id ) { + case GTK_RESPONSE_OK: + ret = IDOK; + break; + //case GTK_RESPONSE_CANCEL: + default: + ret = IDCANCEL; + break; + } - gtk_grab_remove( dlg ); - gtk_widget_destroy( dlg ); + gtk_widget_destroy( dialog ); return ret; } @@ -3032,103 +2804,89 @@ int DoBSInputDlg( const char *fields[5], float values[5] ){ // TextureLayout dialog int DoTextureLayout( float *fx, float *fy ){ - GtkWidget *dlg, *vbox, *hbox, *table, *label, *button; - GtkWidget *x, *y; - int loop = 1, ret = IDCANCEL; + GtkWidget *dialog, *vbox, *hbox, *table, *label; + GtkWidget *x, *y, *content_area; + gint response_id; + int ret; + GtkDialogFlags flags = GTK_DIALOG_DESTROY_WITH_PARENT; - dlg = gtk_window_new( GTK_WINDOW_TOPLEVEL ); - gtk_window_set_title( GTK_WINDOW( dlg ), _( "Patch texture layout" ) ); - g_signal_connect( G_OBJECT( dlg ), "delete-event", - G_CALLBACK( dialog_delete_callback ), NULL ); - g_signal_connect( G_OBJECT( dlg ), "destroy", - G_CALLBACK( gtk_widget_destroy ), NULL ); - g_object_set_data( G_OBJECT( dlg ), "loop", &loop ); - g_object_set_data( G_OBJECT( dlg ), "ret", &ret ); + dialog = gtk_dialog_new_with_buttons( _( "Patch texture layout" ), NULL, flags, NULL ); + gtk_window_set_transient_for( GTK_WINDOW( dialog ), GTK_WINDOW( g_pParentWnd->m_pWidget ) ); + + gtk_dialog_add_button( GTK_DIALOG( dialog ), _( "OK" ), GTK_RESPONSE_OK ); + gtk_dialog_add_button( GTK_DIALOG( dialog ), _( "Cancel" ), GTK_RESPONSE_CANCEL ); + + content_area = gtk_dialog_get_content_area( GTK_DIALOG( dialog ) ); hbox = gtk_hbox_new( FALSE, 5 ); - gtk_widget_show( hbox ); - gtk_container_add( GTK_CONTAINER( dlg ), hbox ); + gtk_container_add( GTK_CONTAINER( content_area ), hbox ); gtk_container_set_border_width( GTK_CONTAINER( hbox ), 5 ); + gtk_widget_show( hbox ); vbox = gtk_vbox_new( FALSE, 5 ); - gtk_widget_show( vbox ); gtk_box_pack_start( GTK_BOX( hbox ), vbox, TRUE, TRUE, 0 ); + gtk_widget_show( vbox ); label = gtk_label_new( _( "Texture will be fit across the patch based\n" "on the x and y values given. Values of 1x1\n" "will \"fit\" the texture. 2x2 will repeat\n" "it twice, etc." ) ); - gtk_widget_show( label ); gtk_box_pack_start( GTK_BOX( vbox ), label, TRUE, TRUE, 0 ); + gtk_misc_set_alignment( GTK_MISC( label ), 0, 0.5 ); gtk_label_set_justify( GTK_LABEL( label ), GTK_JUSTIFY_LEFT ); + gtk_widget_show( label ); table = gtk_table_new( 2, 2, FALSE ); - gtk_widget_show( table ); gtk_box_pack_start( GTK_BOX( vbox ), table, TRUE, TRUE, 0 ); gtk_table_set_row_spacings( GTK_TABLE( table ), 5 ); gtk_table_set_col_spacings( GTK_TABLE( table ), 5 ); + gtk_widget_show( table ); label = gtk_label_new( _( "Texture x:" ) ); - gtk_widget_show( label ); gtk_table_attach( GTK_TABLE( table ), label, 0, 1, 0, 1, (GtkAttachOptions) ( GTK_FILL ), (GtkAttachOptions) ( 0 ), 0, 0 ); gtk_misc_set_alignment( GTK_MISC( label ), 0, 0.5 ); + gtk_widget_show( label ); label = gtk_label_new( _( "Texture y:" ) ); - gtk_widget_show( label ); gtk_table_attach( GTK_TABLE( table ), label, 0, 1, 1, 2, (GtkAttachOptions) ( GTK_FILL ), (GtkAttachOptions) ( 0 ), 0, 0 ); gtk_misc_set_alignment( GTK_MISC( label ), 0, 0.5 ); + gtk_widget_show( label ); x = gtk_entry_new(); - gtk_widget_show( x ); gtk_table_attach( GTK_TABLE( table ), x, 1, 2, 0, 1, (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), (GtkAttachOptions) ( 0 ), 0, 0 ); + gtk_widget_show( x ); y = gtk_entry_new(); - gtk_widget_show( y ); gtk_table_attach( GTK_TABLE( table ), y, 1, 2, 1, 2, (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), (GtkAttachOptions) ( 0 ), 0, 0 ); + gtk_widget_show( y ); - vbox = gtk_vbox_new( FALSE, 5 ); - gtk_widget_show( vbox ); - gtk_box_pack_start( GTK_BOX( hbox ), vbox, FALSE, FALSE, 0 ); - - button = gtk_button_new_with_label( _( "OK" ) ); - gtk_widget_show( button ); - gtk_box_pack_start( GTK_BOX( vbox ), button, FALSE, FALSE, 0 ); - g_signal_connect( G_OBJECT( button ), "clicked", - G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( IDOK ) ); - gtk_widget_set_usize( button, 60, -2 ); - - button = gtk_button_new_with_label( _( "Cancel" ) ); - gtk_widget_show( button ); - gtk_box_pack_start( GTK_BOX( vbox ), button, FALSE, FALSE, 0 ); - g_signal_connect( G_OBJECT( button ), "clicked", - G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( IDCANCEL ) ); - gtk_widget_set_usize( button, 60, -2 ); // Initialize gtk_entry_set_text( GTK_ENTRY( x ), _( "4.0" ) ); gtk_entry_set_text( GTK_ENTRY( y ), _( "4.0" ) ); - gtk_grab_add( dlg ); - gtk_widget_show( dlg ); - while ( loop ) - gtk_main_iteration(); + response_id = gtk_dialog_run( GTK_DIALOG( dialog ) ); + + if( response_id == GTK_RESPONSE_OK ) { - if ( ret == IDOK ) { *fx = atof( gtk_entry_get_text( GTK_ENTRY( x ) ) ); *fy = atof( gtk_entry_get_text( GTK_ENTRY( y ) ) ); + + ret = IDOK; + } else { + ret = IDCANCEL; } - gtk_grab_remove( dlg ); - gtk_widget_destroy( dlg ); + gtk_widget_destroy( dialog ); return ret; } @@ -3172,14 +2930,14 @@ char* DoNameDlg( const char* title ){ gtk_box_pack_start( GTK_BOX( vbox ), button, FALSE, FALSE, 0 ); g_signal_connect( G_OBJECT( button ), "clicked", G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( IDOK ) ); - gtk_widget_set_usize( button, 60, -2 ); + gtk_widget_set_size_request( button, 60, -2 ); button = gtk_button_new_with_label( _( "Cancel" ) ); gtk_widget_show( button ); gtk_box_pack_start( GTK_BOX( vbox ), button, FALSE, FALSE, 0 ); g_signal_connect( G_OBJECT( button ), "clicked", G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( IDCANCEL ) ); - gtk_widget_set_usize( button, 60, -2 ); + gtk_widget_set_size_request( button, 60, -2 ); gtk_grab_add( dlg ); gtk_widget_show( dlg ); @@ -3203,10 +2961,12 @@ char* DoNameDlg( const char* title ){ // ============================================================================= // NewProject dialog + char* DoNewProjectDlg(){ - GtkWidget *dlg, *vbox, *hbox, *label, *button, *entry, *check; - int loop = 1, ret = IDCANCEL; + GtkWidget *dialog, *vbox, *label, *entry, *check, *content_area; + gint response_id; char *str; + GtkDialogFlags flags = GTK_DIALOG_DESTROY_WITH_PARENT; // start by a warning message // mattn: URLs no longer valid @@ -3219,78 +2979,52 @@ char* DoNewProjectDlg(){ // return NULL; // } - dlg = gtk_window_new( GTK_WINDOW_TOPLEVEL ); - gtk_window_set_title( GTK_WINDOW( dlg ), _( "New Project" ) ); - g_signal_connect( G_OBJECT( dlg ), "delete-event", - G_CALLBACK( dialog_delete_callback ), NULL ); - g_signal_connect( G_OBJECT( dlg ), "destroy", - G_CALLBACK( gtk_widget_destroy ), NULL ); - g_object_set_data( G_OBJECT( dlg ), "loop", &loop ); - g_object_set_data( G_OBJECT( dlg ), "ret", &ret ); + dialog = gtk_dialog_new_with_buttons( _( "New Project" ), NULL, flags, NULL ); + gtk_window_set_transient_for( GTK_WINDOW( dialog ), GTK_WINDOW( g_pParentWnd->m_pWidget ) ); - hbox = gtk_hbox_new( FALSE, 10 ); - gtk_widget_show( hbox ); - gtk_container_add( GTK_CONTAINER( dlg ), hbox ); - gtk_container_set_border_width( GTK_CONTAINER( hbox ), 5 ); + gtk_dialog_add_button( GTK_DIALOG( dialog ), _( "OK" ), GTK_RESPONSE_OK ); + gtk_dialog_add_button( GTK_DIALOG( dialog ), _( "Cancel" ), GTK_RESPONSE_CANCEL ); + + content_area = gtk_dialog_get_content_area( GTK_DIALOG( dialog ) ); vbox = gtk_vbox_new( FALSE, 5 ); + gtk_container_add( GTK_CONTAINER( content_area ), vbox ); + gtk_container_set_border_width( GTK_CONTAINER( vbox ), 5 ); gtk_widget_show( vbox ); - gtk_box_pack_start( GTK_BOX( hbox ), vbox, FALSE, FALSE, 0 ); label = gtk_label_new( _( "This will create a new directory beneath your\n" "game path based on the project name you give." ) ); - gtk_widget_show( label ); - gtk_box_pack_start( GTK_BOX( vbox ), label, FALSE, FALSE, 0 ); + gtk_box_pack_start( GTK_BOX( vbox ), label, TRUE, TRUE, 0 ); + gtk_misc_set_alignment( GTK_MISC( label ), 0, 0.5 ); gtk_label_set_justify( GTK_LABEL( label ), GTK_JUSTIFY_LEFT ); + gtk_widget_show( label ); label = gtk_label_new( _( "Project name:" ) ); - gtk_widget_show( label ); + gtk_box_pack_start( GTK_BOX( vbox ), label, TRUE, TRUE, 0 ); gtk_label_set_justify( GTK_LABEL( label ), GTK_JUSTIFY_LEFT ); gtk_misc_set_alignment( GTK_MISC( label ), 0, 0.5 ); + gtk_widget_show( label ); entry = gtk_entry_new(); - gtk_widget_show( entry ); gtk_box_pack_start( GTK_BOX( vbox ), entry, TRUE, TRUE, 0 ); + gtk_widget_show( entry ); check = gtk_check_button_new_with_label( _( "Include game dll files" ) ); - gtk_widget_show( check ); gtk_box_pack_start( GTK_BOX( vbox ), check, TRUE, TRUE, 0 ); gtk_widget_set_sensitive( check, FALSE ); + gtk_widget_show( check ); - vbox = gtk_vbox_new( FALSE, 5 ); - gtk_widget_show( vbox ); - gtk_box_pack_start( GTK_BOX( hbox ), vbox, FALSE, FALSE, 0 ); - button = gtk_button_new_with_label( _( "OK" ) ); - gtk_widget_show( button ); - gtk_box_pack_start( GTK_BOX( vbox ), button, FALSE, FALSE, 0 ); - g_signal_connect( G_OBJECT( button ), "clicked", - G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( IDOK ) ); - gtk_widget_set_usize( button, 60, -2 ); + response_id = gtk_dialog_run( GTK_DIALOG( dialog ) ); - button = gtk_button_new_with_label( _( "Cancel" ) ); - gtk_widget_show( button ); - gtk_box_pack_start( GTK_BOX( vbox ), button, FALSE, FALSE, 0 ); - g_signal_connect( G_OBJECT( button ), "clicked", - G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( IDCANCEL ) ); - gtk_widget_set_usize( button, 60, -2 ); - - gtk_grab_add( dlg ); - gtk_widget_show( dlg ); - - while ( loop ) - gtk_main_iteration(); - - if ( ret == IDOK ) { + if( response_id == GTK_RESPONSE_OK ) { str = strdup( gtk_entry_get_text( GTK_ENTRY( entry ) ) ); - } - else{ + } else { str = NULL; } - gtk_grab_remove( dlg ); - gtk_widget_destroy( dlg ); + gtk_widget_destroy( dialog ); return str; } @@ -3410,39 +3144,39 @@ static void CreateGtkTextEditor(){ gtk_window_set_default_size( GTK_WINDOW( dlg ), 600, 300 ); vbox = gtk_vbox_new( FALSE, 5 ); - gtk_widget_show( vbox ); gtk_container_add( GTK_CONTAINER( dlg ), vbox ); gtk_container_set_border_width( GTK_CONTAINER( vbox ), 5 ); + gtk_widget_show( vbox ); scr = gtk_scrolled_window_new( NULL, NULL ); - gtk_widget_show( scr ); gtk_box_pack_start( GTK_BOX( vbox ), scr, TRUE, TRUE, 0 ); gtk_scrolled_window_set_policy( GTK_SCROLLED_WINDOW( scr ), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC ); gtk_scrolled_window_set_shadow_type( GTK_SCROLLED_WINDOW( scr ), GTK_SHADOW_IN ); + gtk_widget_show( scr ); text = gtk_text_view_new(); gtk_container_add( GTK_CONTAINER( scr ), text ); - gtk_widget_show( text ); g_object_set_data( G_OBJECT( dlg ), "text", text ); gtk_text_view_set_editable( GTK_TEXT_VIEW( text ), TRUE ); + gtk_widget_show( text ); hbox = gtk_hbox_new( FALSE, 5 ); - gtk_widget_show( hbox ); gtk_box_pack_start( GTK_BOX( vbox ), hbox, FALSE, TRUE, 0 ); + gtk_widget_show( hbox ); button = gtk_button_new_with_label( _( "Close" ) ); - gtk_widget_show( button ); gtk_box_pack_end( GTK_BOX( hbox ), button, FALSE, FALSE, 0 ); g_signal_connect( G_OBJECT( button ), "clicked", G_CALLBACK( editor_close ), dlg ); - gtk_widget_set_usize( button, 60, -2 ); + gtk_widget_set_size_request( button, 60, -2 ); + gtk_widget_show( button ); button = gtk_button_new_with_label( _( "Save" ) ); gtk_widget_show( button ); gtk_box_pack_end( GTK_BOX( hbox ), button, FALSE, FALSE, 0 ); g_signal_connect( G_OBJECT( button ), "clicked", G_CALLBACK( editor_save ), dlg ); - gtk_widget_set_usize( button, 60, -2 ); + gtk_widget_set_size_request( button, 60, -2 ); text_editor = dlg; text_widget = text; @@ -3614,76 +3348,62 @@ void DoTextEditor( const char* filename, int cursorpos ){ // Light Intensity dialog int DoLightIntensityDlg( int *intensity ){ - GtkWidget *dlg, *vbox, *hbox, *label, *button, *entry; - int loop = 1, ret = IDCANCEL; + GtkWidget *dialog, *vbox, *hbox, *label, *content_area, *spinbutton, *button; + GtkAdjustment *adj; + gint response_id; + int ret; + GtkDialogFlags flags = GTK_DIALOG_DESTROY_WITH_PARENT; - dlg = gtk_window_new( GTK_WINDOW_TOPLEVEL ); - gtk_window_set_title( GTK_WINDOW( dlg ), _( "Light intensity" ) ); - g_signal_connect( G_OBJECT( dlg ), "delete-event", - G_CALLBACK( dialog_delete_callback ), NULL ); - g_signal_connect( G_OBJECT( dlg ), "destroy", - G_CALLBACK( gtk_widget_destroy ), NULL ); - g_object_set_data( G_OBJECT( dlg ), "loop", &loop ); - g_object_set_data( G_OBJECT( dlg ), "ret", &ret ); + dialog = gtk_dialog_new_with_buttons( _( "Light intensity" ), NULL, flags, NULL ); + gtk_window_set_transient_for( GTK_WINDOW( dialog ), GTK_WINDOW( g_pParentWnd->m_pWidget ) ); GtkAccelGroup *accel_group = gtk_accel_group_new(); - gtk_window_add_accel_group( GTK_WINDOW( dlg ), accel_group ); + gtk_window_add_accel_group( GTK_WINDOW( dialog ), accel_group ); - hbox = gtk_hbox_new( FALSE, 5 ); - gtk_widget_show( hbox ); - gtk_container_add( GTK_CONTAINER( dlg ), hbox ); - gtk_container_set_border_width( GTK_CONTAINER( hbox ), 5 ); + button = gtk_dialog_add_button( GTK_DIALOG( dialog ), _( "OK" ), GTK_RESPONSE_OK ); + gtk_widget_add_accelerator( button, "clicked", accel_group, + GDK_KEY_Return, (GdkModifierType)0, GTK_ACCEL_VISIBLE ); + button = gtk_dialog_add_button( GTK_DIALOG( dialog ), _( "Cancel" ), GTK_RESPONSE_CANCEL ); + gtk_widget_add_accelerator( button, "clicked", accel_group, + GDK_KEY_Escape, (GdkModifierType)0, GTK_ACCEL_VISIBLE ); + + content_area = gtk_dialog_get_content_area( GTK_DIALOG( dialog ) ); vbox = gtk_vbox_new( FALSE, 5 ); + gtk_container_add( GTK_CONTAINER( content_area ), vbox ); gtk_widget_show( vbox ); - gtk_box_pack_start( GTK_BOX( hbox ), vbox, TRUE, TRUE, 0 ); label = gtk_label_new( _( "ESC for default, ENTER to validate" ) ); - gtk_widget_show( label ); gtk_box_pack_start( GTK_BOX( vbox ), label, FALSE, FALSE, 0 ); + gtk_misc_set_alignment( GTK_MISC( label ), 0, 0.5 ); + gtk_widget_show( label ); - entry = gtk_entry_new(); - gtk_widget_show( entry ); - gtk_box_pack_start( GTK_BOX( vbox ), entry, TRUE, TRUE, 0 ); + hbox = gtk_hbox_new( TRUE, 5 ); + gtk_box_pack_start( GTK_BOX( vbox ), hbox, TRUE, TRUE, 0 ); + gtk_container_set_border_width( GTK_CONTAINER( hbox ), 5 ); + gtk_widget_show( hbox ); - vbox = gtk_vbox_new( FALSE, 5 ); - gtk_widget_show( vbox ); - gtk_box_pack_start( GTK_BOX( hbox ), vbox, FALSE, FALSE, 0 ); + adj = GTK_ADJUSTMENT( gtk_adjustment_new( *intensity, 0, G_MAXINT, 1, 10, 0 ) ); + spinbutton = gtk_spin_button_new( GTK_ADJUSTMENT( adj ), 1, 0 ); + gtk_box_pack_start( GTK_BOX( hbox ), spinbutton, TRUE, TRUE, 0 ); + gtk_spin_button_set_wrap( GTK_SPIN_BUTTON( spinbutton ), FALSE ); + gtk_spin_button_set_numeric( GTK_SPIN_BUTTON( spinbutton ), TRUE ); + gtk_entry_set_alignment( GTK_ENTRY( spinbutton ), 1.0 ); //right + gtk_widget_show( spinbutton ); - button = gtk_button_new_with_label( _( "OK" ) ); - gtk_widget_show( button ); - gtk_box_pack_start( GTK_BOX( vbox ), button, FALSE, FALSE, 0 ); - g_signal_connect( G_OBJECT( button ), "clicked", - G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( IDOK ) ); - gtk_widget_add_accelerator( button, "clicked", accel_group, - GDK_Return, (GdkModifierType)0, GTK_ACCEL_VISIBLE ); - gtk_widget_set_usize( button, 60, -2 ); + gtk_spin_button_set_value( GTK_SPIN_BUTTON( spinbutton ), *intensity ); - button = gtk_button_new_with_label( _( "Cancel" ) ); - gtk_widget_show( button ); - gtk_box_pack_start( GTK_BOX( vbox ), button, FALSE, FALSE, 0 ); - g_signal_connect( G_OBJECT( button ), "clicked", - G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( IDCANCEL ) ); - gtk_widget_add_accelerator( button, "clicked", accel_group, - GDK_Escape, (GdkModifierType)0, GTK_ACCEL_VISIBLE ); - gtk_widget_set_usize( button, 60, -2 ); - char buf[16]; - sprintf( buf, "%d", *intensity ); - gtk_entry_set_text( GTK_ENTRY( entry ), buf ); + response_id = gtk_dialog_run( GTK_DIALOG( dialog ) ); - gtk_grab_add( dlg ); - gtk_widget_show( dlg ); - - while ( loop ) - gtk_main_iteration(); - - if ( ret == IDOK ) { - *intensity = atoi( gtk_entry_get_text( GTK_ENTRY( entry ) ) ); + if( response_id == GTK_RESPONSE_OK ) { + *intensity = gtk_spin_button_get_value_as_int( GTK_SPIN_BUTTON( spinbutton ) ); + ret = IDOK; + } else { + ret = IDCANCEL; } - gtk_grab_remove( dlg ); - gtk_widget_destroy( dlg ); + gtk_widget_destroy( dialog ); return ret; -} +} \ No newline at end of file diff --git a/radiant/gtkmisc.cpp b/radiant/gtkmisc.cpp index 1a62b3db..227e6fa7 100644 --- a/radiant/gtkmisc.cpp +++ b/radiant/gtkmisc.cpp @@ -708,7 +708,7 @@ GtkWidget* new_plugin_image_icon( const char* filename ) { GtkWidget* menu_separator( GtkWidget *menu ){ GtkWidget *menu_item = gtk_menu_item_new(); - gtk_menu_append( GTK_MENU( menu ), menu_item ); + gtk_menu_shell_append( GTK_MENU_SHELL( menu ), menu_item ); gtk_widget_set_sensitive( menu_item, FALSE ); gtk_widget_show( menu_item ); return menu_item; @@ -716,7 +716,7 @@ GtkWidget* menu_separator( GtkWidget *menu ){ GtkWidget* menu_tearoff( GtkWidget *menu ){ GtkWidget *menu_item = gtk_tearoff_menu_item_new(); - gtk_menu_append( GTK_MENU( menu ), menu_item ); + gtk_menu_shell_append( GTK_MENU_SHELL( menu ), menu_item ); // gtk_widget_set_sensitive (menu_item, FALSE); -- controls whether menu is detachable gtk_widget_show( menu_item ); return menu_item; @@ -726,12 +726,14 @@ GtkWidget* create_sub_menu_with_mnemonic( GtkWidget *bar, const gchar *mnemonic GtkWidget *item, *sub_menu; item = gtk_menu_item_new_with_mnemonic( mnemonic ); - gtk_widget_show( item ); - gtk_container_add( GTK_CONTAINER( bar ), item ); sub_menu = gtk_menu_new(); gtk_menu_item_set_submenu( GTK_MENU_ITEM( item ), sub_menu ); + gtk_menu_shell_append( GTK_MENU_SHELL( bar ), item ); +// gtk_container_add( GTK_CONTAINER( bar ), item ); + + gtk_widget_show( item ); return sub_menu; } @@ -743,7 +745,8 @@ GtkWidget* create_menu_item_with_mnemonic( GtkWidget *menu, const gchar *mnemoni item = gtk_menu_item_new_with_mnemonic( mnemonic ); gtk_widget_show( item ); - gtk_container_add( GTK_CONTAINER( menu ), item ); + gtk_menu_shell_append( GTK_MENU_SHELL( menu ), item ); +// gtk_container_add( GTK_CONTAINER( menu ), item ); g_signal_connect( G_OBJECT( item ), "activate", G_CALLBACK( func ), GINT_TO_POINTER( id ) ); AddMenuItem( item, id ); @@ -757,7 +760,8 @@ GtkWidget* create_check_menu_item_with_mnemonic( GtkWidget *menu, const gchar *m gtk_check_menu_item_set_active( GTK_CHECK_MENU_ITEM( item ), active ); gtk_widget_show( item ); - gtk_container_add( GTK_CONTAINER( menu ), item ); + gtk_menu_shell_append( GTK_MENU_SHELL( menu ), item ); +// gtk_container_add( GTK_CONTAINER( menu ), item ); g_signal_connect( G_OBJECT( item ), "activate", func, GINT_TO_POINTER( id ) ); AddMenuItem( item, id ); @@ -775,7 +779,8 @@ GtkWidget* create_radio_menu_item_with_mnemonic( GtkWidget *menu, GtkWidget *las gtk_check_menu_item_set_active( GTK_CHECK_MENU_ITEM( item ), state ); gtk_widget_show( item ); - gtk_container_add( GTK_CONTAINER( menu ), item ); + gtk_menu_shell_append( GTK_MENU_SHELL( menu ), item ); +// gtk_container_add( GTK_CONTAINER( menu ), item ); g_signal_connect( G_OBJECT( item ), "activate", func, GINT_TO_POINTER( id ) ); AddMenuItem( item, id ); @@ -786,12 +791,13 @@ GtkWidget* create_menu_in_menu_with_mnemonic( GtkWidget *menu, const gchar *mnem GtkWidget *item, *submenu; item = gtk_menu_item_new_with_mnemonic( mnemonic ); - gtk_widget_show( item ); - gtk_container_add( GTK_CONTAINER( menu ), item ); submenu = gtk_menu_new(); gtk_menu_item_set_submenu( GTK_MENU_ITEM( item ), submenu ); - +// gtk_container_add( GTK_CONTAINER( menu ), item ); + gtk_menu_shell_append( GTK_MENU_SHELL( menu ), item ); + + gtk_widget_show( item ); return submenu; } @@ -852,32 +858,28 @@ static const int MSGBOX_PAD_MINOR = 2; int WINAPI gtk_MessageBoxNew( void *parent, const char *message, const char *caption, const guint32 flags, const char *URL ) { + GtkWidget *dialog, *content_area; + gint response_id; + int ret; + GtkDialogFlags dialog_flags = GTK_DIALOG_DESTROY_WITH_PARENT; - int loop = TRUE, ret = IDCANCEL; + dialog = gtk_dialog_new_with_buttons( caption, NULL, dialog_flags, NULL ); - // create dialog window - GtkWidget *dlg = gtk_window_new( GTK_WINDOW_TOPLEVEL ); - g_signal_connect( G_OBJECT( dlg ), "delete-event", - G_CALLBACK( dialog_delete_callback ), NULL ); - g_signal_connect( G_OBJECT( dlg ), "destroy", - G_CALLBACK( gtk_widget_destroy ), NULL ); - gtk_window_set_title( GTK_WINDOW( dlg ), caption ); - gtk_window_set_policy( GTK_WINDOW( dlg ), FALSE, FALSE, TRUE ); - gtk_container_set_border_width( GTK_CONTAINER( dlg ), MSGBOX_PAD_MAJOR ); - g_object_set_data( G_OBJECT( dlg ), "loop", &loop ); - g_object_set_data( G_OBJECT( dlg ), "ret", &ret ); + gtk_container_set_border_width( GTK_CONTAINER( dialog ), MSGBOX_PAD_MAJOR ); if( parent ) { - gtk_window_set_transient_for( GTK_WINDOW( dlg ), GTK_WINDOW( parent ) ); - gtk_window_set_position( GTK_WINDOW( dlg ), GTK_WIN_POS_CENTER_ON_PARENT ); + gtk_window_set_transient_for( GTK_WINDOW( dialog ), GTK_WINDOW( parent ) ); + gtk_window_set_position( GTK_WINDOW( dialog ), GTK_WIN_POS_CENTER_ON_PARENT ); } GtkAccelGroup *accel = gtk_accel_group_new(); - gtk_window_add_accel_group( GTK_WINDOW( dlg ), accel ); + gtk_window_add_accel_group( GTK_WINDOW( dialog ), accel ); + + content_area = gtk_dialog_get_content_area( GTK_DIALOG( dialog ) ); // begin layout GtkWidget *outer_vbox = gtk_vbox_new( FALSE, MSGBOX_PAD_MAJOR ); - gtk_container_add( GTK_CONTAINER( dlg ), outer_vbox ); + gtk_container_add( GTK_CONTAINER( content_area ), outer_vbox ); gtk_widget_show( outer_vbox ); // add icon @@ -921,6 +923,7 @@ int WINAPI gtk_MessageBoxNew( void *parent, const char *message, GtkWidget *dlg_msg = gtk_label_new( message ); gtk_box_pack_start( GTK_BOX( icon_text_hbox ), dlg_msg, FALSE, FALSE, MSGBOX_PAD_MINOR ); gtk_label_set_justify( GTK_LABEL( dlg_msg ), GTK_JUSTIFY_LEFT ); + gtk_label_set_selectable( GTK_LABEL( dlg_msg ), TRUE ); gtk_widget_show( dlg_msg ); // add buttons @@ -936,16 +939,17 @@ int WINAPI gtk_MessageBoxNew( void *parent, const char *message, switch( flags & MB_TYPEMASK ) { case MB_OK: default: { - GtkWidget *btn_ok = gtk_AddDlgButton( buttons_hbox, _( "Ok" ), IDOK, TRUE ); + GtkWidget *btn_ok = gtk_dialog_add_button( GTK_DIALOG( dialog ), _( "OK" ), GTK_RESPONSE_OK ); + gtk_widget_set_can_default( btn_ok, TRUE ); gtk_widget_add_accelerator( btn_ok, "clicked", accel, GDK_KEY_Escape, (GdkModifierType)0, (GtkAccelFlags)0 ); gtk_widget_add_accelerator( btn_ok, "clicked", accel, GDK_KEY_Return, (GdkModifierType)0, (GtkAccelFlags)0 ); ret = IDOK; break; } case MB_OKCANCEL: { - GtkWidget *btn_ok = gtk_AddDlgButton( buttons_hbox, _( "Ok" ), IDOK, TRUE ); + GtkWidget *btn_ok = gtk_dialog_add_button( GTK_DIALOG( dialog ), _( "OK" ), GTK_RESPONSE_OK ); gtk_widget_add_accelerator( btn_ok, "clicked", accel, GDK_KEY_Return, (GdkModifierType)0, (GtkAccelFlags)0 ); - GtkWidget *btn_cancel = gtk_AddDlgButton( buttons_hbox, _( "Cancel" ), IDCANCEL, FALSE ); + GtkWidget *btn_cancel = gtk_dialog_add_button( GTK_DIALOG( dialog ), _( "Cancel" ), GTK_RESPONSE_CANCEL ); gtk_widget_add_accelerator( btn_cancel, "clicked", accel, GDK_KEY_Escape, (GdkModifierType)0, (GtkAccelFlags)0 ); ret = IDCANCEL; break; @@ -956,16 +960,16 @@ int WINAPI gtk_MessageBoxNew( void *parent, const char *message, } case MB_YESNOCANCEL: { //! @todo accelerators? - gtk_AddDlgButton( buttons_hbox, _( "Yes" ), IDYES, TRUE ); - gtk_AddDlgButton( buttons_hbox, _( "No" ), IDNO, FALSE ); - gtk_AddDlgButton( buttons_hbox, _( "Cancel" ), IDCANCEL, FALSE ); + gtk_dialog_add_button( GTK_DIALOG( dialog ), _( "Yes" ), GTK_RESPONSE_YES ); + gtk_dialog_add_button( GTK_DIALOG( dialog ), _( "No" ), GTK_RESPONSE_NO ); + gtk_dialog_add_button( GTK_DIALOG( dialog ), _( "Cancel" ), GTK_RESPONSE_CANCEL ); ret = IDCANCEL; break; } case MB_YESNO: { //! @todo accelerators? - gtk_AddDlgButton( buttons_hbox, _( "Yes" ), IDYES, TRUE ); - gtk_AddDlgButton( buttons_hbox, _( "No" ), IDNO, FALSE ); + gtk_dialog_add_button( GTK_DIALOG( dialog ), _( "Yes" ), GTK_RESPONSE_YES ); + gtk_dialog_add_button( GTK_DIALOG( dialog ), _( "No" ), GTK_RESPONSE_NO ); ret = IDNO; break; } @@ -988,56 +992,61 @@ int WINAPI gtk_MessageBoxNew( void *parent, const char *message, g_signal_connect( G_OBJECT( btn_url ), "clicked", G_CALLBACK( dialog_url_callback ), NULL ); g_object_set_data( G_OBJECT( btn_url ), "URL", (void *)URL ); - gtk_widget_set_can_default( btn_url, TRUE ); - gtk_widget_grab_default( btn_url ); gtk_widget_show( btn_url ); } - // show it - gtk_widget_show( dlg ); - gtk_grab_add( dlg ); - while( loop ) - gtk_main_iteration(); + response_id = gtk_dialog_run( GTK_DIALOG( dialog ) ); - gtk_grab_remove( dlg ); - gtk_widget_destroy( dlg ); + switch( response_id ) { + case GTK_RESPONSE_OK: + ret = IDOK; + break; + case GTK_RESPONSE_CANCEL: + ret = IDCANCEL; + break; + case GTK_RESPONSE_YES: + ret = IDYES; + break; + case GTK_RESPONSE_NO: + ret = IDNO; + break; + } + + gtk_widget_destroy( dialog ); return ret; } int WINAPI gtk_MessageBox( void *parent, const char* lpText, const char* lpCaption, guint32 uType, const char* URL ){ - GtkWidget *window, *w, *vbox, *hbox; + GtkWidget *dialog, *w, *vbox, *hbox, *content_area; GtkAccelGroup *accel; - int mode = ( uType & MB_TYPEMASK ), ret, loop = 1; + gint response_id; + int mode, ret; + GtkDialogFlags flags = GTK_DIALOG_DESTROY_WITH_PARENT; - window = gtk_window_new( GTK_WINDOW_TOPLEVEL ); - g_signal_connect( G_OBJECT( window ), "delete-event", - G_CALLBACK( dialog_delete_callback ), NULL ); - g_signal_connect( G_OBJECT( window ), "destroy", - G_CALLBACK( gtk_widget_destroy ), NULL ); - gtk_window_set_title( GTK_WINDOW( window ), lpCaption ); - gtk_container_set_border_width( GTK_CONTAINER( window ), 10 ); - g_object_set_data( G_OBJECT( window ), "loop", &loop ); - g_object_set_data( G_OBJECT( window ), "ret", &ret ); + dialog = gtk_dialog_new_with_buttons( lpCaption, NULL, flags, NULL ); - gtk_window_set_policy( GTK_WINDOW( window ),FALSE,FALSE,TRUE ); + gtk_container_set_border_width( GTK_CONTAINER( dialog ), 10 ); if ( parent != NULL ) { - gtk_window_set_transient_for( GTK_WINDOW( window ), GTK_WINDOW( parent ) ); + gtk_window_set_transient_for( GTK_WINDOW( dialog ), GTK_WINDOW( parent ) ); } accel = gtk_accel_group_new(); - gtk_window_add_accel_group( GTK_WINDOW( window ), accel ); + gtk_window_add_accel_group( GTK_WINDOW( dialog ), accel ); + + content_area = gtk_dialog_get_content_area( GTK_DIALOG( dialog ) ); vbox = gtk_vbox_new( FALSE, 10 ); - gtk_container_add( GTK_CONTAINER( window ), vbox ); + gtk_container_add( GTK_CONTAINER( content_area ), vbox ); gtk_widget_show( vbox ); w = gtk_label_new( lpText ); gtk_box_pack_start( GTK_BOX( vbox ), w, FALSE, FALSE, 2 ); gtk_label_set_justify( GTK_LABEL( w ), GTK_JUSTIFY_LEFT ); + gtk_label_set_selectable( GTK_LABEL( w ), TRUE ); gtk_widget_show( w ); w = gtk_hseparator_new(); @@ -1048,73 +1057,37 @@ int WINAPI gtk_MessageBox( void *parent, const char* lpText, const char* lpCapti gtk_box_pack_start( GTK_BOX( vbox ), hbox, FALSE, FALSE, 2 ); gtk_widget_show( hbox ); + mode = ( uType & MB_TYPEMASK ); if ( mode == MB_OK ) { - w = gtk_button_new_with_label( _( "Ok" ) ); - gtk_box_pack_start( GTK_BOX( hbox ), w, TRUE, TRUE, 0 ); - g_signal_connect( G_OBJECT( w ), "clicked", - G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( IDOK ) ); - gtk_widget_add_accelerator( w, "clicked", accel, GDK_Escape, (GdkModifierType)0, (GtkAccelFlags)0 ); - gtk_widget_add_accelerator( w, "clicked", accel, GDK_Return, (GdkModifierType)0, (GtkAccelFlags)0 ); + w = gtk_dialog_add_button( GTK_DIALOG( dialog ), _( "OK" ), GTK_RESPONSE_OK ); + gtk_widget_add_accelerator( w, "clicked", accel, GDK_KEY_Escape, (GdkModifierType)0, (GtkAccelFlags)0 ); + gtk_widget_add_accelerator( w, "clicked", accel, GDK_KEY_Return, (GdkModifierType)0, (GtkAccelFlags)0 ); gtk_widget_set_can_default( w, TRUE ); gtk_widget_grab_default( w ); - gtk_widget_show( w ); + ret = IDOK; } else if ( mode == MB_OKCANCEL ) { - w = gtk_button_new_with_label( _( "Ok" ) ); - gtk_box_pack_start( GTK_BOX( hbox ), w, TRUE, TRUE, 0 ); - g_signal_connect( G_OBJECT( w ), "clicked", - G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( IDOK ) ); - gtk_widget_add_accelerator( w, "clicked", accel, GDK_Return, (GdkModifierType)0, (GtkAccelFlags)0 ); - gtk_widget_set_can_default( w, TRUE ); - gtk_widget_grab_default( w ); - gtk_widget_show( w ); + w = gtk_dialog_add_button( GTK_DIALOG( dialog ), _( "OK" ), GTK_RESPONSE_OK ); + gtk_widget_add_accelerator( w, "clicked", accel, GDK_KEY_Return, (GdkModifierType)0, (GtkAccelFlags)0 ); + + w = gtk_dialog_add_button( GTK_DIALOG( dialog ), _( "Cancel" ), GTK_RESPONSE_CANCEL ); + gtk_widget_add_accelerator( w, "clicked", accel, GDK_KEY_Escape, (GdkModifierType)0, (GtkAccelFlags)0 ); - w = gtk_button_new_with_label( _( "Cancel" ) ); - gtk_box_pack_start( GTK_BOX( hbox ), w, TRUE, TRUE, 0 ); - g_signal_connect( G_OBJECT( w ), "clicked", - G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( IDCANCEL ) ); - gtk_widget_add_accelerator( w, "clicked", accel, GDK_Escape, (GdkModifierType)0, (GtkAccelFlags)0 ); - gtk_widget_show( w ); ret = IDCANCEL; } else if ( mode == MB_YESNOCANCEL ) { - w = gtk_button_new_with_label( _( "Yes" ) ); - gtk_box_pack_start( GTK_BOX( hbox ), w, TRUE, TRUE, 0 ); - g_signal_connect( G_OBJECT( w ), "clicked", - G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( IDYES ) ); - gtk_widget_set_can_default( w, TRUE ); - gtk_widget_grab_default( w ); - gtk_widget_show( w ); + w = gtk_dialog_add_button( GTK_DIALOG( dialog ), _( "Yes" ), GTK_RESPONSE_YES ); + w = gtk_dialog_add_button( GTK_DIALOG( dialog ), _( "No" ), GTK_RESPONSE_NO ); + w = gtk_dialog_add_button( GTK_DIALOG( dialog ), _( "Cancel" ), GTK_RESPONSE_CANCEL ); - w = gtk_button_new_with_label( _( "No" ) ); - gtk_box_pack_start( GTK_BOX( hbox ), w, TRUE, TRUE, 0 ); - g_signal_connect( G_OBJECT( w ), "clicked", - G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( IDNO ) ); - gtk_widget_show( w ); - - w = gtk_button_new_with_label( _( "Cancel" ) ); - gtk_box_pack_start( GTK_BOX( hbox ), w, TRUE, TRUE, 0 ); - g_signal_connect( G_OBJECT( w ), "clicked", - G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( IDCANCEL ) ); - gtk_widget_show( w ); ret = IDCANCEL; } else /* if (mode == MB_YESNO) */ { - w = gtk_button_new_with_label( _( "Yes" ) ); - gtk_box_pack_start( GTK_BOX( hbox ), w, TRUE, TRUE, 0 ); - g_signal_connect( G_OBJECT( w ), "clicked", - G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( IDYES ) ); - gtk_widget_set_can_default( w, TRUE ); - gtk_widget_grab_default( w ); - gtk_widget_show( w ); + w = gtk_dialog_add_button( GTK_DIALOG( dialog ), _( "Yes" ), GTK_RESPONSE_YES ); + w = gtk_dialog_add_button( GTK_DIALOG( dialog ), _( "No" ), GTK_RESPONSE_NO ); - w = gtk_button_new_with_label( _( "No" ) ); - gtk_box_pack_start( GTK_BOX( hbox ), w, TRUE, TRUE, 0 ); - g_signal_connect( G_OBJECT( w ), "clicked", - G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( IDNO ) ); - gtk_widget_show( w ); ret = IDNO; } @@ -1124,20 +1097,28 @@ int WINAPI gtk_MessageBox( void *parent, const char* lpText, const char* lpCapti g_signal_connect( G_OBJECT( w ), "clicked", G_CALLBACK( dialog_url_callback ), NULL ); g_object_set_data( G_OBJECT( w ), "URL", (void *)URL ); - gtk_widget_set_can_default( w, TRUE ); - gtk_widget_grab_default( w ); gtk_widget_show( w ); } - gtk_widget_show( window ); - gtk_grab_add( window ); + response_id = gtk_dialog_run( GTK_DIALOG( dialog ) ); - while ( loop ) - gtk_main_iteration(); + switch( response_id ) { + case GTK_RESPONSE_OK: + ret = IDOK; + break; + case GTK_RESPONSE_CANCEL: + ret = IDCANCEL; + break; + case GTK_RESPONSE_YES: + ret = IDYES; + break; + case GTK_RESPONSE_NO: + ret = IDNO; + break; + } - gtk_grab_remove( window ); - gtk_widget_destroy( window ); + gtk_widget_destroy( dialog ); return ret; } @@ -1336,6 +1317,7 @@ const char* file_dialog( void *parent, gboolean open, const char* title, const c #endif // Gtk dialog + GtkFileChooserAction action; GtkWidget* file_sel; char *new_path = NULL; @@ -1480,14 +1462,11 @@ const char* file_dialog( void *parent, gboolean open, const char* title, const c // terminate string *w = '\0'; - file_sel = gtk_file_chooser_dialog_new( title, - GTK_WINDOW( parent ), - open ? GTK_FILE_CHOOSER_ACTION_OPEN : GTK_FILE_CHOOSER_ACTION_SAVE, - GTK_STOCK_CANCEL, - GTK_RESPONSE_CANCEL, - open ? GTK_STOCK_OPEN : GTK_STOCK_SAVE, - GTK_RESPONSE_ACCEPT, - (char *) NULL ); + action = open ? GTK_FILE_CHOOSER_ACTION_OPEN : GTK_FILE_CHOOSER_ACTION_SAVE; + file_sel = gtk_file_chooser_dialog_new( title, GTK_WINDOW( parent ), action, NULL, NULL ); + gtk_dialog_add_button( GTK_DIALOG( file_sel ), open ? _( "Open" ) : _("Save" ), GTK_RESPONSE_ACCEPT ); + gtk_dialog_add_button( GTK_DIALOG( file_sel ), _( "Cancel" ), GTK_RESPONSE_CANCEL ); + gtk_file_chooser_set_current_folder( GTK_FILE_CHOOSER( file_sel ), new_path ); delete[] new_path; @@ -1513,7 +1492,13 @@ const char* file_dialog( void *parent, gboolean open, const char* title, const c } if ( gtk_dialog_run( GTK_DIALOG( file_sel ) ) == GTK_RESPONSE_ACCEPT ) { - strcpy( szFile, gtk_file_chooser_get_filename( GTK_FILE_CHOOSER( file_sel ) ) ); + gchar * filename = gtk_file_chooser_get_filename( GTK_FILE_CHOOSER( file_sel ) ); + if ( filename != NULL ) { + Q_strncpyz( szFile, filename, sizeof( szFile ) ); + g_free( filename ); + } else { + szFile[0] = '\0'; + } } else { szFile[0] = '\0'; @@ -1597,22 +1582,21 @@ const char* file_dialog( void *parent, gboolean open, const char* title, const c char* WINAPI dir_dialog( void *parent, const char* title, const char* path ){ GtkWidget* file_sel; char* filename = (char*)NULL; - int ret; + gint response_id; + GtkFileChooserAction action = GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER; - file_sel = gtk_file_chooser_dialog_new( title, GTK_WINDOW( parent ), - GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER, - GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, - GTK_STOCK_OK, GTK_RESPONSE_ACCEPT, - (char *) NULL ); + file_sel = gtk_file_chooser_dialog_new( title, GTK_WINDOW( parent ), action, NULL, NULL ); + gtk_dialog_add_button( GTK_DIALOG( file_sel ), _( "OK" ), GTK_RESPONSE_ACCEPT ); + gtk_dialog_add_button( GTK_DIALOG( file_sel ), _( "Cancel" ), GTK_RESPONSE_CANCEL ); if ( path != NULL ) { gtk_file_chooser_set_current_folder( GTK_FILE_CHOOSER( file_sel ), path ); } - ret = gtk_dialog_run( GTK_DIALOG( file_sel ) ); + response_id = gtk_dialog_run( GTK_DIALOG( file_sel ) ); - if ( ret == GTK_RESPONSE_ACCEPT ) { - filename = g_strdup( gtk_file_chooser_get_filename( GTK_FILE_CHOOSER( file_sel ) ) ); + if ( response_id == GTK_RESPONSE_ACCEPT ) { + filename = gtk_file_chooser_get_filename( GTK_FILE_CHOOSER( file_sel ) ); } else { filename = NULL; @@ -1713,7 +1697,7 @@ void CheckMenuSplitting( GtkWidget *&menu ){ item = GTK_WIDGET( g_list_last( gtk_container_get_children( GTK_CONTAINER( menu ) ) )->data ); g_object_ref( item ); gtk_container_remove( GTK_CONTAINER( menu ), item ); - gtk_menu_append( GTK_MENU( menu2 ), item ); + gtk_menu_shell_append( GTK_MENU_SHELL( menu2 ), item ); g_object_unref( item ); } diff --git a/radiant/mainframe.cpp b/radiant/mainframe.cpp index e0fefa21..6a11932a 100644 --- a/radiant/mainframe.cpp +++ b/radiant/mainframe.cpp @@ -1706,12 +1706,11 @@ void MainFrame::create_main_toolbar( GtkWidget *window, GtkWidget *vbox ){ g_object_set_data( G_OBJECT( window ), "tb_handle_box", handle_box ); toolbar = gtk_toolbar_new(); - gtk_toolbar_set_orientation( GTK_TOOLBAR( toolbar ), GTK_ORIENTATION_HORIZONTAL ); + gtk_orientable_set_orientation( GTK_ORIENTABLE( toolbar ), GTK_ORIENTATION_HORIZONTAL ); gtk_toolbar_set_style( GTK_TOOLBAR( toolbar ), GTK_TOOLBAR_ICONS ); // gtk_toolbar_set_style (GTK_TOOLBAR (toolbar), user_rc.toolbar_style); gtk_container_add( GTK_CONTAINER( handle_box ), toolbar ); - gtk_widget_show( toolbar ); w = gtk_toolbar_append_item( GTK_TOOLBAR( toolbar ), _( "Open" ), _( "Open an existing map" ), "", new_image_icon("file_open.png"), G_CALLBACK( HandleCommand ), @@ -1958,6 +1957,8 @@ void MainFrame::create_main_toolbar( GtkWidget *window, GtkWidget *vbox ){ m_bCamPreview = true; g_nScaleHow = ( SCALE_X | SCALE_Y | SCALE_Z ); + + gtk_widget_show( toolbar ); } void MainFrame::create_plugin_toolbar( GtkWidget *window, GtkWidget *vbox ){ @@ -1971,7 +1972,7 @@ void MainFrame::create_plugin_toolbar( GtkWidget *window, GtkWidget *vbox ){ g_object_set_data( G_OBJECT( window ), "tb_handle_box", handle_box ); toolbar = gtk_toolbar_new(); - gtk_toolbar_set_orientation( GTK_TOOLBAR( toolbar ), GTK_ORIENTATION_HORIZONTAL ); + gtk_orientable_set_orientation( GTK_ORIENTABLE( toolbar ), GTK_ORIENTATION_HORIZONTAL ); gtk_toolbar_set_style( GTK_TOOLBAR( toolbar ), GTK_TOOLBAR_ICONS ); // gtk_toolbar_set_style (GTK_TOOLBAR (toolbar), user_rc.toolbar_style); gtk_container_add( GTK_CONTAINER( handle_box ), toolbar ); @@ -1985,15 +1986,15 @@ void MainFrame::create_main_statusbar( GtkWidget *window, GtkWidget *vbox ){ GtkWidget *label; hbox = gtk_hbox_new( FALSE, 0 ); - gtk_widget_show( hbox ); - gtk_widget_set_usize( hbox, -1, 24 ); + gtk_widget_set_size_request( hbox, -1, 24 ); gtk_container_set_border_width( GTK_CONTAINER( hbox ), 1 ); gtk_box_pack_end( GTK_BOX( vbox ), hbox, FALSE, TRUE, 2 ); + gtk_widget_show( hbox ); frame = gtk_frame_new( (char*)NULL ); - gtk_widget_show( frame ); gtk_box_pack_start( GTK_BOX( hbox ), frame, TRUE, TRUE, 0 ); gtk_frame_set_shadow_type( GTK_FRAME( frame ), GTK_SHADOW_IN ); + gtk_widget_show( frame ); hbox1 = gtk_hbox_new( FALSE, 0 ); gtk_container_add( GTK_CONTAINER( frame ), hbox1 ); @@ -2001,22 +2002,22 @@ void MainFrame::create_main_statusbar( GtkWidget *window, GtkWidget *vbox ){ gtk_widget_show( hbox1 ); label = gtk_label_new( _( " Label " ) ); - gtk_widget_show( label ); gtk_box_pack_start( GTK_BOX( hbox1 ), label, FALSE, TRUE, 0 ); gtk_label_set_justify( GTK_LABEL( label ), GTK_JUSTIFY_LEFT ); gtk_misc_set_padding( GTK_MISC( label ), 3, 0 ); + gtk_widget_show( label ); m_pStatusLabel[0] = label; for ( int i = 1; i < 6; i++ ) { frame = gtk_frame_new( (char*)NULL ); - gtk_widget_show( frame ); gtk_box_pack_start( GTK_BOX( hbox ), frame, FALSE, TRUE, 0 ); gtk_frame_set_shadow_type( GTK_FRAME( frame ), GTK_SHADOW_IN ); + gtk_widget_show( frame ); label = gtk_label_new( _( " Label " ) ); - gtk_widget_show( label ); gtk_container_add( GTK_CONTAINER( frame ), label ); + gtk_widget_show( label ); m_pStatusLabel[i] = label; } } @@ -2114,7 +2115,7 @@ void console_populate_popup( GtkTextView* textview, GtkMenu* menu, gpointer user GtkWidget* item = gtk_menu_item_new_with_label( _( "Clear" ) ); g_signal_connect( G_OBJECT( item ), "activate", G_CALLBACK( Sys_ClearPrintf ), NULL ); gtk_widget_show( item ); - gtk_menu_append( GTK_MENU( menu ), item ); + gtk_menu_shell_append( GTK_MENU_SHELL( menu ), item ); } void console_construct( GtkWidget* textview ){ @@ -2362,10 +2363,10 @@ void PositionWindowOnPrimaryScreen( window_position_t& position ){ GtkWidget* create_framed_widget( GtkWidget* widget ){ GtkWidget* frame = gtk_frame_new( (char*)NULL ); - gtk_widget_show( frame ); gtk_frame_set_shadow_type( GTK_FRAME( frame ), GTK_SHADOW_IN ); gtk_container_add( GTK_CONTAINER( frame ), widget ); gtk_widget_show( widget ); + gtk_widget_show( frame ); return frame; } diff --git a/radiant/patchdialog.cpp b/radiant/patchdialog.cpp index dd796526..03946757 100644 --- a/radiant/patchdialog.cpp +++ b/radiant/patchdialog.cpp @@ -122,7 +122,7 @@ static void OnSpinChanged( GtkAdjustment *adj, gpointer data ){ } if ( adj == g_object_get_data( G_OBJECT( g_PatchDialog.GetWidget() ), "hshift_adj" ) ) { - l_pPIIncrement->shift[0] = atof( gtk_entry_get_text( GTK_ENTRY( data ) ) ); + l_pPIIncrement->shift[0] = gtk_spin_button_get_value( GTK_SPIN_BUTTON( data ) ); if ( gtk_adjustment_get_value( adj ) > 0 ) { td.shift[0] = l_pPIIncrement->shift[0]; @@ -132,7 +132,7 @@ static void OnSpinChanged( GtkAdjustment *adj, gpointer data ){ } } else if ( adj == g_object_get_data( G_OBJECT( g_PatchDialog.GetWidget() ), "vshift_adj" ) ) { - l_pPIIncrement->shift[1] = atof( gtk_entry_get_text( GTK_ENTRY( data ) ) ); + l_pPIIncrement->shift[1] = gtk_spin_button_get_value( GTK_SPIN_BUTTON( data ) ); if ( gtk_adjustment_get_value( adj ) > 0 ) { td.shift[1] = l_pPIIncrement->shift[1]; @@ -142,7 +142,7 @@ static void OnSpinChanged( GtkAdjustment *adj, gpointer data ){ } } else if ( adj == g_object_get_data( G_OBJECT( g_PatchDialog.GetWidget() ), "hscale_adj" ) ) { - l_pPIIncrement->scale[0] = atof( gtk_entry_get_text( GTK_ENTRY( data ) ) ); + l_pPIIncrement->scale[0] = gtk_spin_button_get_value( GTK_SPIN_BUTTON( data ) ); if ( l_pPIIncrement->scale[0] == 0.0f ) { return; } @@ -166,7 +166,7 @@ static void OnSpinChanged( GtkAdjustment *adj, gpointer data ){ } } else if ( adj == g_object_get_data( G_OBJECT( g_PatchDialog.GetWidget() ), "vscale_adj" ) ) { - l_pPIIncrement->scale[1] = atof( gtk_entry_get_text( GTK_ENTRY( data ) ) ); + l_pPIIncrement->scale[1] = gtk_spin_button_get_value( GTK_SPIN_BUTTON( data ) ); if ( l_pPIIncrement->scale[1] == 0.0f ) { return; } @@ -190,7 +190,7 @@ static void OnSpinChanged( GtkAdjustment *adj, gpointer data ){ } } else if ( adj == g_object_get_data( G_OBJECT( g_PatchDialog.GetWidget() ), "rotate_adj" ) ) { - l_pPIIncrement->rotate = atof( gtk_entry_get_text( GTK_ENTRY( data ) ) ); + l_pPIIncrement->rotate = gtk_spin_button_get_value( GTK_SPIN_BUTTON( data ) ); if ( gtk_adjustment_get_value( adj ) > 0 ) { td.rotate = l_pPIIncrement->rotate; @@ -289,9 +289,10 @@ void PatchDialog::ShowDlg(){ void PatchDialog::BuildDialog(){ GtkWidget *dlg, *vbox, *vbox2, *hbox, *hbox2, *frame, *table, *label; - GtkWidget *button, *entry, *spin, *combo; - GtkObject *adj; - char buf[32]; + GtkWidget *button, *entry, *spin, *combo, *row_label, *col_label; + GtkAdjustment *adj; + GtkSizeGroup *size_group; + GtkWidget *cap_button, *set_button, *nat_button, *fit_button; dlg = m_pWidget; @@ -305,344 +306,390 @@ void PatchDialog::BuildDialog(){ vbox = gtk_vbox_new( FALSE, 5 ); - gtk_widget_show( vbox ); gtk_container_add( GTK_CONTAINER( dlg ), vbox ); gtk_container_set_border_width( GTK_CONTAINER( vbox ), 5 ); + gtk_widget_show( vbox ); hbox = gtk_hbox_new( FALSE, 5 ); - gtk_widget_show( hbox ); gtk_box_pack_start( GTK_BOX( vbox ), hbox, TRUE, TRUE, 0 ); + gtk_widget_show( hbox ); frame = gtk_frame_new( _( "Details" ) ); - gtk_widget_show( frame ); gtk_box_pack_start( GTK_BOX( hbox ), frame, TRUE, TRUE, 0 ); + gtk_widget_show( frame ); vbox2 = gtk_vbox_new( FALSE, 5 ); - gtk_widget_show( vbox2 ); gtk_container_add( GTK_CONTAINER( frame ), vbox2 ); gtk_container_set_border_width( GTK_CONTAINER( vbox2 ), 5 ); + gtk_widget_show( vbox2 ); table = gtk_table_new( 2, 2, FALSE ); - gtk_widget_show( table ); gtk_box_pack_start( GTK_BOX( vbox2 ), table, TRUE, TRUE, 0 ); gtk_table_set_row_spacings( GTK_TABLE( table ), 5 ); gtk_table_set_col_spacings( GTK_TABLE( table ), 5 ); + gtk_widget_show( table ); - label = gtk_label_new( _( "Row:" ) ); - gtk_widget_show( label ); + row_label = label = gtk_label_new( _( "Row:" ) ); gtk_table_attach( GTK_TABLE( table ), label, 0, 1, 0, 1, (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), (GtkAttachOptions) ( 0 ), 0, 0 ); - - label = gtk_label_new( _( "Column:" ) ); gtk_widget_show( label ); + + col_label = label = gtk_label_new( _( "Column:" ) ); gtk_table_attach( GTK_TABLE( table ), label, 1, 2, 0, 1, (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), (GtkAttachOptions) ( 0 ), 0, 0 ); + gtk_widget_show( label ); + + size_group = gtk_size_group_new( GTK_SIZE_GROUP_BOTH ); + gtk_size_group_add_widget( size_group, row_label ); + gtk_size_group_add_widget( size_group, col_label ); + g_object_unref( size_group ); combo = gtk_combo_new(); - gtk_widget_show( combo ); gtk_table_attach( GTK_TABLE( table ), combo, 0, 1, 1, 2, (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), (GtkAttachOptions) ( 0 ), 0, 0 ); gtk_widget_set_usize( combo, 60, -1 ); gtk_entry_set_editable( GTK_ENTRY( GTK_COMBO( combo )->entry ), FALSE ); + gtk_entry_set_alignment( GTK_ENTRY( GTK_COMBO( combo )->entry ), 1.0 ); //right + gtk_widget_show( combo ); g_signal_connect( G_OBJECT( GTK_COMBO( combo )->entry ), "changed", G_CALLBACK( OnSelchangeComboColRow ), this ); AddDialogData( combo, &m_nRow, DLG_COMBO_INT ); m_pRowCombo = combo; combo = gtk_combo_new(); - gtk_widget_show( combo ); gtk_table_attach( GTK_TABLE( table ), combo, 1, 2, 1, 2, (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), (GtkAttachOptions) ( 0 ), 0, 0 ); gtk_widget_set_usize( combo, 60, -1 ); gtk_entry_set_editable( GTK_ENTRY( GTK_COMBO( combo )->entry ), FALSE ); + gtk_entry_set_alignment( GTK_ENTRY( GTK_COMBO( combo )->entry ), 1.0 ); //right + gtk_widget_show( combo ); g_signal_connect( G_OBJECT( GTK_COMBO( combo )->entry ), "changed", G_CALLBACK( OnSelchangeComboColRow ), this ); AddDialogData( combo, &m_nCol, DLG_COMBO_INT ); m_pColCombo = combo; table = gtk_table_new( 5, 2, FALSE ); - gtk_widget_show( table ); gtk_box_pack_start( GTK_BOX( vbox2 ), table, TRUE, TRUE, 0 ); gtk_table_set_row_spacings( GTK_TABLE( table ), 5 ); gtk_table_set_col_spacings( GTK_TABLE( table ), 5 ); + gtk_widget_show( table ); label = gtk_label_new( _( "X:" ) ); - gtk_widget_show( label ); gtk_table_attach( GTK_TABLE( table ), label, 0, 1, 0, 1, (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), (GtkAttachOptions) ( 0 ), 0, 0 ); + gtk_widget_set_tooltip_text( label, _( "X-Axis" ) ); + gtk_widget_show( label ); label = gtk_label_new( _( "Y:" ) ); - gtk_widget_show( label ); gtk_table_attach( GTK_TABLE( table ), label, 0, 1, 1, 2, (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), (GtkAttachOptions) ( 0 ), 0, 0 ); + gtk_widget_set_tooltip_text( label, _( "Y-Axis" ) ); + gtk_widget_show( label ); label = gtk_label_new( _( "Z:" ) ); - gtk_widget_show( label ); gtk_table_attach( GTK_TABLE( table ), label, 0, 1, 2, 3, (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), (GtkAttachOptions) ( 0 ), 0, 0 ); + gtk_widget_set_tooltip_text( label, _( "Z-Axis" ) ); + gtk_widget_show( label ); label = gtk_label_new( _( "S:" ) ); - gtk_widget_show( label ); gtk_table_attach( GTK_TABLE( table ), label, 0, 1, 3, 4, (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), (GtkAttachOptions) ( 0 ), 0, 0 ); + gtk_widget_set_tooltip_text( label, _( "S-coordinates correspond to the \"x\" coordinates on the texture itself" ) ); + gtk_widget_show( label ); label = gtk_label_new( _( "T:" ) ); - gtk_widget_show( label ); gtk_table_attach( GTK_TABLE( table ), label, 0, 1, 4, 5, (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), (GtkAttachOptions) ( 0 ), 0, 0 ); + gtk_widget_set_tooltip_text( label, _( "T-coordinates correspond to the \"y\" coordinates on the texture itself. The measurements are in game units." ) ); + gtk_widget_show( label ); - entry = gtk_entry_new(); - gtk_widget_show( entry ); - gtk_table_attach( GTK_TABLE( table ), entry, 1, 2, 0, 1, + adj = GTK_ADJUSTMENT( gtk_adjustment_new( 0, -INT_MAX, INT_MAX, 1, 10, 0 ) ); + spin = gtk_spin_button_new( GTK_ADJUSTMENT( adj ), 1, 4 ); + gtk_table_attach( GTK_TABLE( table ), spin, 1, 2, 0, 1, (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), (GtkAttachOptions) ( 0 ), 0, 0 ); - AddDialogData( entry, &m_fX, DLG_ENTRY_FLOAT ); + gtk_spin_button_set_wrap( GTK_SPIN_BUTTON( spin ), TRUE ); + gtk_spin_button_set_numeric( GTK_SPIN_BUTTON( spin ), TRUE ); + gtk_entry_set_alignment( GTK_ENTRY( spin ), 1.0 ); //right + gtk_widget_show( spin ); + AddDialogData( spin, &m_fX, DLG_SPIN_FLOAT ); - entry = gtk_entry_new(); - gtk_widget_show( entry ); - gtk_table_attach( GTK_TABLE( table ), entry, 1, 2, 1, 2, + adj = GTK_ADJUSTMENT( gtk_adjustment_new( 0, -INT_MAX, INT_MAX, 1, 10, 0 ) ); + spin = gtk_spin_button_new( GTK_ADJUSTMENT( adj ), 1, 4 ); + gtk_table_attach( GTK_TABLE( table ), spin, 1, 2, 1, 2, (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), (GtkAttachOptions) ( 0 ), 0, 0 ); - AddDialogData( entry, &m_fY, DLG_ENTRY_FLOAT ); + gtk_spin_button_set_wrap( GTK_SPIN_BUTTON( spin ), TRUE ); + gtk_spin_button_set_numeric( GTK_SPIN_BUTTON( spin ), TRUE ); + gtk_entry_set_alignment( GTK_ENTRY( spin ), 1.0 ); //right + gtk_widget_show( spin ); + AddDialogData( spin, &m_fY, DLG_SPIN_FLOAT ); - entry = gtk_entry_new(); - gtk_widget_show( entry ); - gtk_table_attach( GTK_TABLE( table ), entry, 1, 2, 2, 3, + adj = GTK_ADJUSTMENT( gtk_adjustment_new( 0, -INT_MAX, INT_MAX, 1, 10, 0 ) ); + spin = gtk_spin_button_new( GTK_ADJUSTMENT( adj ), 1, 4 ); + gtk_table_attach( GTK_TABLE( table ), spin, 1, 2, 2, 3, (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), (GtkAttachOptions) ( 0 ), 0, 0 ); - AddDialogData( entry, &m_fZ, DLG_ENTRY_FLOAT ); + gtk_spin_button_set_wrap( GTK_SPIN_BUTTON( spin ), TRUE ); + gtk_spin_button_set_numeric( GTK_SPIN_BUTTON( spin ), TRUE ); + gtk_entry_set_alignment( GTK_ENTRY( spin ), 1.0 ); //right + gtk_widget_show( spin ); + AddDialogData( spin, &m_fZ, DLG_SPIN_FLOAT ); - entry = gtk_entry_new(); - gtk_widget_show( entry ); - gtk_table_attach( GTK_TABLE( table ), entry, 1, 2, 3, 4, + adj = GTK_ADJUSTMENT( gtk_adjustment_new( 0, -INT_MAX, INT_MAX, 1, 10, 0 ) ); + spin = gtk_spin_button_new( GTK_ADJUSTMENT( adj ), 1, 4 ); + gtk_table_attach( GTK_TABLE( table ), spin, 1, 2, 3, 4, (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), (GtkAttachOptions) ( 0 ), 0, 0 ); - AddDialogData( entry, &m_fS, DLG_ENTRY_FLOAT ); + gtk_spin_button_set_wrap( GTK_SPIN_BUTTON( spin ), TRUE ); + gtk_spin_button_set_numeric( GTK_SPIN_BUTTON( spin ), TRUE ); + gtk_entry_set_alignment( GTK_ENTRY( spin ), 1.0 ); //right + gtk_widget_show( spin ); + AddDialogData( spin, &m_fS, DLG_SPIN_FLOAT ); - entry = gtk_entry_new(); - gtk_widget_show( entry ); - gtk_table_attach( GTK_TABLE( table ), entry, 1, 2, 4, 5, + adj = GTK_ADJUSTMENT( gtk_adjustment_new( 0, -INT_MAX, INT_MAX, 1, 10, 0 ) ); + spin = gtk_spin_button_new( GTK_ADJUSTMENT( adj ), 1, 4 ); + gtk_table_attach( GTK_TABLE( table ), spin, 1, 2, 4, 5, (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), (GtkAttachOptions) ( 0 ), 0, 0 ); - AddDialogData( entry, &m_fT, DLG_ENTRY_FLOAT ); + gtk_spin_button_set_wrap( GTK_SPIN_BUTTON( spin ), TRUE ); + gtk_spin_button_set_numeric( GTK_SPIN_BUTTON( spin ), TRUE ); + gtk_entry_set_alignment( GTK_ENTRY( spin ), 1.0 ); //right + gtk_widget_show( spin ); + AddDialogData( spin, &m_fT, DLG_SPIN_FLOAT ); frame = gtk_frame_new( _( "Texturing" ) ); - gtk_widget_show( frame ); gtk_box_pack_start( GTK_BOX( hbox ), frame, TRUE, TRUE, 0 ); + gtk_widget_show( frame ); vbox2 = gtk_vbox_new( FALSE, 5 ); - gtk_widget_show( vbox2 ); gtk_container_add( GTK_CONTAINER( frame ), vbox2 ); gtk_container_set_border_width( GTK_CONTAINER( vbox2 ), 5 ); + gtk_widget_show( vbox2 ); label = gtk_label_new( _( "Name:" ) ); - gtk_widget_show( label ); gtk_box_pack_start( GTK_BOX( vbox2 ), label, TRUE, TRUE, 0 ); gtk_label_set_justify( GTK_LABEL( label ), GTK_JUSTIFY_LEFT ); gtk_misc_set_alignment( GTK_MISC( label ), 0, 0.5 ); + gtk_widget_show( label ); entry = gtk_entry_new(); // gtk_entry_set_editable (GTK_ENTRY (entry), false); - gtk_widget_show( entry ); gtk_box_pack_start( GTK_BOX( vbox2 ), entry, TRUE, TRUE, 0 ); + gtk_widget_show( entry ); AddDialogData( entry, &m_strName, DLG_ENTRY_TEXT ); table = gtk_table_new( 5, 3, FALSE ); - gtk_widget_show( table ); gtk_box_pack_start( GTK_BOX( vbox2 ), table, TRUE, TRUE, 0 ); gtk_table_set_row_spacings( GTK_TABLE( table ), 5 ); gtk_table_set_col_spacings( GTK_TABLE( table ), 5 ); + gtk_widget_show( table ); label = gtk_label_new( _( "Horizontal Shift Step" ) ); - gtk_widget_show( label ); gtk_table_attach( GTK_TABLE( table ), label, 2, 3, 0, 1, (GtkAttachOptions) ( GTK_FILL ), (GtkAttachOptions) ( 0 ), 0, 0 ); gtk_misc_set_alignment( GTK_MISC( label ), 0, 0.5 ); + gtk_widget_show( label ); label = gtk_label_new( _( "Vertical Shift Step" ) ); - gtk_widget_show( label ); gtk_table_attach( GTK_TABLE( table ), label, 2, 3, 1, 2, (GtkAttachOptions) ( GTK_FILL ), (GtkAttachOptions) ( 0 ), 0, 0 ); gtk_misc_set_alignment( GTK_MISC( label ), 0, 0.5 ); + gtk_widget_show( label ); label = gtk_label_new( _( "Horizontal Stretch Step" ) ); - gtk_widget_show( label ); gtk_table_attach( GTK_TABLE( table ), label, 2, 3, 2, 3, (GtkAttachOptions) ( GTK_FILL ), (GtkAttachOptions) ( 0 ), 0, 0 ); gtk_misc_set_alignment( GTK_MISC( label ), 0, 0.5 ); + gtk_widget_show( label ); label = gtk_label_new( _( "Vertical Stretch Step" ) ); - gtk_widget_show( label ); gtk_table_attach( GTK_TABLE( table ), label, 2, 3, 3, 4, (GtkAttachOptions) ( GTK_FILL ), (GtkAttachOptions) ( 0 ), 0, 0 ); gtk_misc_set_alignment( GTK_MISC( label ), 0, 0.5 ); + gtk_widget_show( label ); label = gtk_label_new( _( "Rotate Step" ) ); - gtk_widget_show( label ); gtk_table_attach( GTK_TABLE( table ), label, 2, 3, 4, 5, (GtkAttachOptions) ( GTK_FILL ), (GtkAttachOptions) ( 0 ), 0, 0 ); gtk_misc_set_alignment( GTK_MISC( label ), 0, 0.5 ); + gtk_widget_show( label ); - entry = gtk_entry_new(); - gtk_widget_show( entry ); - gtk_table_attach( GTK_TABLE( table ), entry, 0, 1, 0, 1, + adj = GTK_ADJUSTMENT( gtk_adjustment_new( 0, -INT_MAX, INT_MAX, 1, 10, 0 ) ); + spin = gtk_spin_button_new( GTK_ADJUSTMENT( adj ), 1, 4 ); + gtk_table_attach( GTK_TABLE( table ), spin, 0, 1, 0, 1, (GtkAttachOptions) ( GTK_FILL ), (GtkAttachOptions) ( 0 ), 0, 0 ); - gtk_widget_set_usize( entry, 50, -2 ); - g_object_set_data( G_OBJECT( m_pWidget ), "hshift_entry", entry ); + gtk_spin_button_set_wrap( GTK_SPIN_BUTTON( spin ), FALSE ); + gtk_spin_button_set_numeric( GTK_SPIN_BUTTON( spin ), TRUE ); + gtk_entry_set_alignment( GTK_ENTRY( spin ), 1.0 ); //right + gtk_widget_show( spin ); + // we fill in this data, if no patch is selected the widgets are unmodified when the inspector is raised // so we need to have at least one initialisation somewhere - sprintf( buf, "%g", l_pPIIncrement->shift[0] ); - gtk_entry_set_text( GTK_ENTRY( entry ), buf ); + gtk_spin_button_set_value( GTK_SPIN_BUTTON( spin ), l_pPIIncrement->shift[0] ); - adj = gtk_adjustment_new( 0, -8192, 8192, 1, 1, 0 ); - g_signal_connect( adj, "value-changed", G_CALLBACK( OnSpinChanged ), entry ); + adj = GTK_ADJUSTMENT( gtk_adjustment_new( 0, -8192, 8192, 1, 1, 0 ) ); + g_signal_connect( adj, "value-changed", G_CALLBACK( OnSpinChanged ), spin ); g_object_set_data( G_OBJECT( m_pWidget ), "hshift_adj", adj ); spin = gtk_spin_button_new( GTK_ADJUSTMENT( adj ), 1, 0 ); - gtk_widget_show( spin ); + gtk_spin_button_set_numeric( GTK_SPIN_BUTTON( spin ), TRUE ); gtk_table_attach( GTK_TABLE( table ), spin, 1, 2, 0, 1, (GtkAttachOptions) ( 0 ), (GtkAttachOptions) ( 0 ), 0, 0 ); - gtk_widget_set_usize( spin, 10, -2 ); + gtk_entry_set_alignment( GTK_ENTRY( spin ), 1.0 ); //right + gtk_widget_show( spin ); - entry = gtk_entry_new(); - gtk_widget_show( entry ); - gtk_table_attach( GTK_TABLE( table ), entry, 0, 1, 1, 2, + adj = GTK_ADJUSTMENT( gtk_adjustment_new( 0, -INT_MAX, INT_MAX, 1, 10, 0 ) ); + spin = gtk_spin_button_new( GTK_ADJUSTMENT( adj ), 1, 4 ); + gtk_table_attach( GTK_TABLE( table ), spin, 0, 1, 1, 2, (GtkAttachOptions) ( GTK_FILL ), - (GtkAttachOptions) ( 0 ), 0, 0 ); - gtk_widget_set_usize( entry, 50, -2 ); - sprintf( buf, "%g", l_pPIIncrement->shift[1] ); - gtk_entry_set_text( GTK_ENTRY( entry ), buf ); + (GtkAttachOptions) ( 0 ), 0, 0 ); gtk_spin_button_set_wrap( GTK_SPIN_BUTTON( spin ), FALSE ); + gtk_spin_button_set_numeric( GTK_SPIN_BUTTON( spin ), TRUE ); + gtk_entry_set_alignment( GTK_ENTRY( spin ), 1.0 ); //right + gtk_widget_show( spin ); + gtk_spin_button_set_value( GTK_SPIN_BUTTON( spin ), l_pPIIncrement->shift[1] ); - adj = gtk_adjustment_new( 0, -8192, 8192, 1, 1, 0 ); - g_signal_connect( adj, "value-changed", G_CALLBACK( OnSpinChanged ), entry ); + adj = GTK_ADJUSTMENT( gtk_adjustment_new( 0, -8192, 8192, 1, 1, 0 ) ); + g_signal_connect( adj, "value-changed", G_CALLBACK( OnSpinChanged ), spin ); g_object_set_data( G_OBJECT( m_pWidget ), "vshift_adj", adj ); spin = gtk_spin_button_new( GTK_ADJUSTMENT( adj ), 1, 0 ); - gtk_widget_show( spin ); + gtk_spin_button_set_numeric( GTK_SPIN_BUTTON( spin ), TRUE ); gtk_table_attach( GTK_TABLE( table ), spin, 1, 2, 1, 2, (GtkAttachOptions) ( 0 ), (GtkAttachOptions) ( 0 ), 0, 0 ); - gtk_widget_set_usize( spin, 10, -2 ); + gtk_entry_set_alignment( GTK_ENTRY( spin ), 1.0 ); //right + gtk_widget_show( spin ); - entry = gtk_entry_new(); - gtk_widget_show( entry ); - gtk_table_attach( GTK_TABLE( table ), entry, 0, 1, 2, 3, + adj = GTK_ADJUSTMENT( gtk_adjustment_new( 0, -INT_MAX, INT_MAX, 1, 10, 0 ) ); + spin = gtk_spin_button_new( GTK_ADJUSTMENT( adj ), 1, 4 ); + gtk_table_attach( GTK_TABLE( table ), spin, 0, 1, 2, 3, (GtkAttachOptions) ( GTK_FILL ), (GtkAttachOptions) ( 0 ), 0, 0 ); - gtk_widget_set_usize( entry, 50, -2 ); - sprintf( buf, "%g", l_pPIIncrement->scale[0] ); - gtk_entry_set_text( GTK_ENTRY( entry ), buf ); + gtk_spin_button_set_wrap( GTK_SPIN_BUTTON( spin ), FALSE ); + gtk_spin_button_set_numeric( GTK_SPIN_BUTTON( spin ), TRUE ); + gtk_entry_set_alignment( GTK_ENTRY( spin ), 1.0 ); //right + gtk_widget_show( spin ); + gtk_spin_button_set_value( GTK_SPIN_BUTTON( spin ), l_pPIIncrement->scale[0] ); - adj = gtk_adjustment_new( 0, -1000, 1000, 1, 1, 0 ); - g_signal_connect( adj, "value-changed", G_CALLBACK( OnSpinChanged ), entry ); + adj = GTK_ADJUSTMENT( gtk_adjustment_new( 0, -1000, 1000, 1, 1, 0 ) ); + g_signal_connect( adj, "value-changed", G_CALLBACK( OnSpinChanged ), spin ); g_object_set_data( G_OBJECT( m_pWidget ), "hscale_adj", adj ); spin = gtk_spin_button_new( GTK_ADJUSTMENT( adj ), 1, 0 ); - gtk_widget_show( spin ); + gtk_spin_button_set_numeric( GTK_SPIN_BUTTON( spin ), TRUE ); gtk_table_attach( GTK_TABLE( table ), spin, 1, 2, 2, 3, (GtkAttachOptions) ( 0 ), (GtkAttachOptions) ( 0 ), 0, 0 ); - gtk_widget_set_usize( spin, 10, -2 ); + gtk_entry_set_alignment( GTK_ENTRY( spin ), 1.0 ); //right + gtk_widget_show( spin ); - entry = gtk_entry_new(); - gtk_widget_show( entry ); - gtk_table_attach( GTK_TABLE( table ), entry, 0, 1, 3, 4, + adj = GTK_ADJUSTMENT( gtk_adjustment_new( 0, -INT_MAX, INT_MAX, 1, 10, 0 ) ); + spin = gtk_spin_button_new( GTK_ADJUSTMENT( adj ), 1, 4 ); + gtk_table_attach( GTK_TABLE( table ), spin, 0, 1, 3, 4, (GtkAttachOptions) ( GTK_FILL ), - (GtkAttachOptions) ( 0 ), 0, 0 ); - gtk_widget_set_usize( entry, 50, -2 ); - sprintf( buf, "%g", l_pPIIncrement->scale[1] ); - gtk_entry_set_text( GTK_ENTRY( entry ), buf ); + (GtkAttachOptions) ( 0 ), 0, 0 ); gtk_spin_button_set_wrap( GTK_SPIN_BUTTON( spin ), FALSE ); + gtk_spin_button_set_numeric( GTK_SPIN_BUTTON( spin ), TRUE ); + gtk_entry_set_alignment( GTK_ENTRY( spin ), 1.0 ); //right + gtk_widget_show( spin ); + gtk_spin_button_set_value( GTK_SPIN_BUTTON( spin ), l_pPIIncrement->scale[1] ); - adj = gtk_adjustment_new( 0, -1000, 1000, 1, 1, 0 ); - g_signal_connect( adj, "value-changed", G_CALLBACK( OnSpinChanged ), entry ); + adj = GTK_ADJUSTMENT( gtk_adjustment_new( 0, -1000, 1000, 1, 1, 0 ) ); + g_signal_connect( adj, "value-changed", G_CALLBACK( OnSpinChanged ), spin ); g_object_set_data( G_OBJECT( m_pWidget ), "vscale_adj", adj ); spin = gtk_spin_button_new( GTK_ADJUSTMENT( adj ), 1, 0 ); - gtk_widget_show( spin ); + gtk_spin_button_set_numeric( GTK_SPIN_BUTTON( spin ), TRUE ); gtk_table_attach( GTK_TABLE( table ), spin, 1, 2, 3, 4, (GtkAttachOptions) ( 0 ), (GtkAttachOptions) ( 0 ), 0, 0 ); - gtk_widget_set_usize( spin, 10, -2 ); + gtk_entry_set_alignment( GTK_ENTRY( spin ), 1.0 ); //right + gtk_widget_show( spin ); - entry = gtk_entry_new(); - gtk_widget_show( entry ); - gtk_table_attach( GTK_TABLE( table ), entry, 0, 1, 4, 5, + adj = GTK_ADJUSTMENT( gtk_adjustment_new( 0, -360, 360, 1, 10, 0 ) ); + spin = gtk_spin_button_new( GTK_ADJUSTMENT( adj ), 1, 4 ); + gtk_table_attach( GTK_TABLE( table ), spin, 0, 1, 4, 5, (GtkAttachOptions) ( GTK_FILL ), (GtkAttachOptions) ( 0 ), 0, 0 ); - gtk_widget_set_usize( entry, 50, -2 ); - sprintf( buf, "%g", l_pPIIncrement->rotate ); - gtk_entry_set_text( GTK_ENTRY( entry ), buf ); + gtk_spin_button_set_wrap( GTK_SPIN_BUTTON( spin ), TRUE ); + gtk_spin_button_set_numeric( GTK_SPIN_BUTTON( spin ), TRUE ); + gtk_entry_set_alignment( GTK_ENTRY( spin ), 1.0 ); //right + gtk_widget_show( spin ); + gtk_spin_button_set_value( GTK_SPIN_BUTTON( spin ), l_pPIIncrement->rotate ); - adj = gtk_adjustment_new( 0, -1000, 1000, 1, 1, 0 ); // NOTE: Arnout - this really should be 360 but can't change it anymore as it could break existing maps - g_signal_connect( adj, "value-changed", G_CALLBACK( OnSpinChanged ), entry ); + adj = GTK_ADJUSTMENT( gtk_adjustment_new( 0, -1000, 1000, 1, 1, 0 ) ); // NOTE: Arnout - this really should be 360 but can't change it anymore as it could break existing maps + g_signal_connect( adj, "value-changed", G_CALLBACK( OnSpinChanged ), spin ); g_object_set_data( G_OBJECT( m_pWidget ), "rotate_adj", adj ); spin = gtk_spin_button_new( GTK_ADJUSTMENT( adj ), 1, 0 ); - gtk_widget_show( spin ); + gtk_spin_button_set_numeric( GTK_SPIN_BUTTON( spin ), TRUE ); gtk_table_attach( GTK_TABLE( table ), spin, 1, 2, 4, 5, (GtkAttachOptions) ( 0 ), (GtkAttachOptions) ( 0 ), 0, 0 ); - gtk_widget_set_usize( spin, 10, -2 ); + gtk_entry_set_alignment( GTK_ENTRY( spin ), 1.0 ); //right + gtk_widget_show( spin ); hbox2 = gtk_hbox_new( TRUE, 5 ); - gtk_widget_show( hbox2 ); gtk_box_pack_start( GTK_BOX( vbox2 ), hbox2, TRUE, FALSE, 0 ); + gtk_widget_show( hbox2 ); - button = gtk_button_new_with_label( _( "CAP" ) ); - gtk_widget_show( button ); + cap_button = button = gtk_button_new_with_label( _( "CAP" ) ); gtk_box_pack_end( GTK_BOX( hbox2 ), button, TRUE, FALSE, 0 ); + gtk_widget_show( button ); g_signal_connect( G_OBJECT( button ), "clicked", G_CALLBACK( OnBtnPatchdetails ), NULL ); - gtk_widget_set_usize( button, 60, -1 ); - button = gtk_button_new_with_label( _( "Set..." ) ); - gtk_widget_show( button ); + set_button = button = gtk_button_new_with_label( _( "Set..." ) ); gtk_box_pack_end( GTK_BOX( hbox2 ), button, TRUE, FALSE, 0 ); + gtk_widget_show( button ); g_signal_connect( G_OBJECT( button ), "clicked", G_CALLBACK( OnBtnPatchreset ), NULL ); - gtk_widget_set_usize( button, 60, -1 ); - button = gtk_button_new_with_label( _( "Natural" ) ); - gtk_widget_show( button ); + nat_button = button = gtk_button_new_with_label( _( "Natural" ) ); gtk_box_pack_end( GTK_BOX( hbox2 ), button, TRUE, FALSE, 0 ); + gtk_widget_show( button ); g_signal_connect( G_OBJECT( button ), "clicked", G_CALLBACK( OnBtnPatchnatural ), NULL ); - gtk_widget_set_usize( button, 60, -1 ); - button = gtk_button_new_with_label( _( "Fit" ) ); - gtk_widget_show( button ); + fit_button = button = gtk_button_new_with_label( _( "Fit" ) ); gtk_box_pack_end( GTK_BOX( hbox2 ), button, TRUE, FALSE, 0 ); + gtk_widget_show( button ); g_signal_connect( G_OBJECT( button ), "clicked", G_CALLBACK( OnBtnPatchfit ), NULL ); - gtk_widget_set_usize( button, 60, -1 ); + + size_group = gtk_size_group_new( GTK_SIZE_GROUP_BOTH ); + gtk_size_group_add_widget( size_group, cap_button ); + gtk_size_group_add_widget( size_group, set_button ); + gtk_size_group_add_widget( size_group, nat_button ); + gtk_size_group_add_widget( size_group, fit_button ); + g_object_unref( size_group ); hbox = gtk_hbox_new( FALSE, 5 ); - gtk_widget_show( hbox ); gtk_box_pack_start( GTK_BOX( vbox ), hbox, TRUE, FALSE, 0 ); + gtk_widget_show( hbox ); button = gtk_button_new_with_label( _( "Done" ) ); - gtk_widget_show( button ); gtk_box_pack_end( GTK_BOX( hbox ), button, FALSE, FALSE, 0 ); + gtk_widget_show( button ); g_signal_connect( G_OBJECT( button ), "clicked", G_CALLBACK( OnDone ), NULL ); - gtk_widget_set_usize( button, 60, -1 ); button = gtk_button_new_with_label( _( "Apply" ) ); - gtk_widget_show( button ); gtk_box_pack_end( GTK_BOX( hbox ), button, FALSE, FALSE, 0 ); + gtk_widget_show( button ); g_signal_connect( G_OBJECT( button ), "clicked", G_CALLBACK( OnApply ), NULL ); - gtk_widget_set_usize( button, 60, -1 ); } // sync the dialog our internal data structures @@ -660,11 +707,11 @@ void PatchDialog::UpdateData( bool retrieve ){ void PatchDialog::GetPatchInfo(){ m_Patch = SinglePatchSelected(); if ( m_Patch != NULL ) { - m_strName = m_Patch->pShader->getName(); - GList *combo_list = NULL; int i; + m_strName = m_Patch->pShader->getName(); + // fill in the numbers for Row / Col selection m_bListenChanged = false; diff --git a/radiant/preferences.cpp b/radiant/preferences.cpp index c4b0edf9..a88b7bd3 100644 --- a/radiant/preferences.cpp +++ b/radiant/preferences.cpp @@ -1048,41 +1048,41 @@ GtkWidget* CGameDialog::GetGlobalFrame(){ gtk_widget_show( mFrame ); vbox = gtk_vbox_new( FALSE, 5 ); - gtk_widget_show( vbox ); gtk_container_add( GTK_CONTAINER( mFrame ), vbox ); gtk_container_set_border_width( GTK_CONTAINER( vbox ), 5 ); + gtk_widget_show( vbox ); /*text = gtk_label_new( _( "Select the game:" ) ); gtk_widget_show( text ); gtk_box_pack_start( GTK_BOX( vbox ), text, FALSE, FALSE, 0 );*/ combo = gtk_combo_box_new_text(); - gtk_widget_show( combo ); gtk_box_pack_start( GTK_BOX( vbox ), combo, FALSE, FALSE, 0 ); + gtk_widget_show( combo ); AddDialogData( combo, &m_nComboSelect, DLG_COMBO_BOX_INT ); mGameCombo = GTK_COMBO_BOX( combo ); UpdateGameCombo(); check = gtk_check_button_new_with_label( _( "Auto load selected game on startup" ) ); - gtk_widget_show( check ); gtk_box_pack_start( GTK_BOX( vbox ), check, FALSE, FALSE, 0 ); + gtk_widget_show( check ); AddDialogData( check, &m_bAutoLoadGame, DLG_CHECK_BOOL ); text = gtk_label_new( _( "(use preferences to undo this)" ) ); - gtk_widget_show( text ); gtk_box_pack_start( GTK_BOX( vbox ), text, FALSE, FALSE, 0 ); + gtk_widget_show( text ); #ifdef _WIN32 check = gtk_check_button_new_with_label( _( "Networked install - per-user settings" ) ); - gtk_widget_show( check ); gtk_box_pack_start( GTK_BOX( vbox ), check, FALSE, FALSE, 0 ); + gtk_widget_show( check ); AddDialogData( check, &m_bNetRun, DLG_CHECK_BOOL ); #endif check = gtk_check_button_new_with_label( _( "Log the console to radiant.log" ) ); - gtk_widget_show( check ); gtk_box_pack_start( GTK_BOX( vbox ), check, FALSE, FALSE, 0 ); + gtk_widget_show( check ); AddDialogData( check, &m_bLogConsole, DLG_CHECK_BOOL ); // incref it so we can pass it around @@ -1138,26 +1138,26 @@ void CGameDialog::BuildDialog() { vbox1 = gtk_vbox_new( FALSE, 0 ); gtk_container_set_border_width( GTK_CONTAINER( vbox1 ), 5 ); - gtk_widget_show( vbox1 ); gtk_container_add( GTK_CONTAINER( dlg ), vbox1 ); + gtk_widget_show( vbox1 ); gtk_container_add( GTK_CONTAINER( vbox1 ), GetGlobalFrame() ); mTopBox = vbox1; button = gtk_button_new_with_label( _( "Start editor on selected game" ) ); - gtk_widget_show( button ); gtk_box_pack_start( GTK_BOX( vbox1 ), button, FALSE, FALSE, 0 ); + gtk_widget_show( button ); AddModalButton( button, IDOK ); setup_button = gtk_button_new_with_label( _( "Configure editor for another game" ) ); - gtk_widget_show( setup_button ); gtk_box_pack_start( GTK_BOX( vbox1 ), setup_button, FALSE, FALSE, 0 ); + gtk_widget_show( setup_button ); g_signal_connect( G_OBJECT( setup_button ), "clicked", G_CALLBACK( SInstallCallback ), this ); button = gtk_button_new_with_label( _( "Exit" ) ); - gtk_widget_show( button ); gtk_box_pack_start( GTK_BOX( vbox1 ), button, FALSE, FALSE, 0 ); + gtk_widget_show( button ); AddModalButton( button, IDCANCEL ); gtk_widget_set_size_request( dlg, 320, -1 ); @@ -1517,7 +1517,7 @@ static void UpdateEditorSensitivity( GtkWidget *widget, gpointer data ){ /*! Utility function for swapping notebook pages for tree list selections */ void PrefsDlg::showPrefPage( int prefpage ){ if ( gtk_notebook_get_current_page( GTK_NOTEBOOK( notebook ) ) != prefpage ) { - gtk_notebook_set_page( GTK_NOTEBOOK( notebook ), prefpage ); + gtk_notebook_set_current_page( GTK_NOTEBOOK( notebook ), prefpage ); } return; @@ -1559,7 +1559,7 @@ void PrefsDlg::BuildDialog(){ GList *combo_list = (GList*)NULL; - GtkObject *adj; + GtkAdjustment *adj; dialog = m_pWidget; gtk_window_set_title( GTK_WINDOW( dialog ), _( "GtkRadiant Preferences" ) ); @@ -1573,26 +1573,26 @@ void PrefsDlg::BuildDialog(){ gtk_widget_show( mainvbox ); hbox = gtk_hbox_new( FALSE, 5 ); - gtk_widget_show( hbox ); gtk_box_pack_end( GTK_BOX( mainvbox ), hbox, FALSE, TRUE, 0 ); + gtk_widget_show( hbox ); button = gtk_button_new_with_label( _( "OK" ) ); - gtk_widget_show( button ); gtk_box_pack_end( GTK_BOX( hbox ), button, FALSE, FALSE, 0 ); - gtk_widget_set_usize( button, 60, -2 ); + gtk_widget_set_size_request( button, 60, -1 ); + gtk_widget_show( button ); AddModalButton( button, IDOK ); button = gtk_button_new_with_label( _( "Cancel" ) ); - gtk_widget_show( button ); gtk_box_pack_end( GTK_BOX( hbox ), button, FALSE, FALSE, 0 ); - gtk_widget_set_usize( button, 60, -2 ); + gtk_widget_set_size_request( button, 60, -1 ); + gtk_widget_show( button ); AddModalButton( button, IDCANCEL ); button = gtk_button_new_with_label( _( "Clean" ) ); - gtk_widget_show( button ); g_signal_connect( G_OBJECT( button ), "clicked", G_CALLBACK( OnButtonClean ), this ); gtk_box_pack_start( GTK_BOX( hbox ), button, FALSE, FALSE, 0 ); - gtk_widget_set_usize( button, 60, -2 ); + gtk_widget_set_size_request( button, 60, -1 ); + gtk_widget_show( button ); hbox = gtk_hbox_new( FALSE, 5 ); gtk_box_pack_start( GTK_BOX( mainvbox ), hbox, TRUE, TRUE, 0 ); @@ -1640,7 +1640,7 @@ void PrefsDlg::BuildDialog(){ { GtkTreeIter group; gtk_tree_store_append( store, &group, NULL ); - gtk_tree_store_set( store, &group, 0, _( "Globals" ), 1, PTAB_FRONT, -1 ); + gtk_tree_store_set( store, &group, 0, _( "Globals" ), 1, PTAB_GAME_SETTINGS, -1 ); { GtkTreeIter tab; gtk_tree_store_append( store, &tab, &group ); @@ -1651,7 +1651,7 @@ void PrefsDlg::BuildDialog(){ { GtkTreeIter group; gtk_tree_store_append( store, &group, NULL ); - gtk_tree_store_set( store, &group, 0, _( "Display" ), 1, PTAB_FRONT, -1 ); + gtk_tree_store_set( store, &group, 0, _( "Display" ), 1, PTAB_2D, -1 ); { GtkTreeIter tab; gtk_tree_store_append( store, &tab, &group ); @@ -1672,7 +1672,7 @@ void PrefsDlg::BuildDialog(){ { GtkTreeIter group; gtk_tree_store_append( store, &group, NULL ); - gtk_tree_store_set( store, &group, 0, _( "Interface" ), 1, PTAB_FRONT, -1 ); + gtk_tree_store_set( store, &group, 0, _( "Interface" ), 1, PTAB_LAYOUT, -1 ); { GtkTreeIter tab; gtk_tree_store_append( store, &tab, &group ); @@ -1693,7 +1693,7 @@ void PrefsDlg::BuildDialog(){ { GtkTreeIter group; gtk_tree_store_append( store, &group, NULL ); - gtk_tree_store_set( store, &group, 0, _( "Other" ), 1, PTAB_FRONT, -1 ); + gtk_tree_store_set( store, &group, 0, _( "Other" ), 1, PTAB_STARTUP, -1 ); { GtkTreeIter tab; gtk_tree_store_append( store, &tab, &group ); @@ -1740,10 +1740,10 @@ void PrefsDlg::BuildDialog(){ gtk_container_set_border_width( GTK_CONTAINER( pageframe ), 5 ); gtk_widget_show( pageframe ); vbox = gtk_vbox_new( FALSE, 5 ); - gtk_widget_show( vbox ); - gtk_widget_set_usize( GTK_WIDGET( vbox ), 350, -2 ); gtk_container_set_border_width( GTK_CONTAINER( vbox ), 5 ); gtk_container_add( GTK_CONTAINER( pageframe ), vbox ); + gtk_widget_set_size_request( GTK_WIDGET( vbox ), 350, -1 ); + gtk_widget_show( vbox ); gtk_notebook_append_page( GTK_NOTEBOOK( notebook ), pageframe, preflabel ); @@ -1761,40 +1761,40 @@ void PrefsDlg::BuildDialog(){ gtk_container_set_border_width( GTK_CONTAINER( pageframe ), 5 ); gtk_widget_show( pageframe ); vbox = gtk_vbox_new( FALSE, 5 ); - gtk_widget_show( vbox ); gtk_container_set_border_width( GTK_CONTAINER( vbox ), 5 ); gtk_container_add( GTK_CONTAINER( pageframe ), vbox ); + gtk_widget_show( vbox ); // OpenGL Display Lists check = gtk_check_button_new_with_label( _( "OpenGL Display Lists" ) ); - gtk_widget_show( check ); gtk_box_pack_start( GTK_BOX( vbox ), check, FALSE, FALSE, 0 ); + gtk_widget_show( check ); AddDialogData( check, &m_bDisplayLists, DLG_CHECK_BOOL ); // Antialiased points & lines // Fishman - Add antialiazed points and lines support. 09/03/00 check = gtk_check_button_new_with_label( _( "OpenGL antialiased points and lines" ) ); - gtk_widget_show( check ); gtk_box_pack_start( GTK_BOX( vbox ), check, FALSE, FALSE, 0 ); + gtk_widget_show( check ); AddDialogData( check, &m_bAntialiasedPointsAndLines, DLG_CHECK_BOOL ); // Solid selection boxes check = gtk_check_button_new_with_label( _( "Solid selection boxes" ) ); - gtk_widget_show( check ); gtk_box_pack_start( GTK_BOX( vbox ), check, FALSE, FALSE, 0 ); + gtk_widget_show( check ); AddDialogData( check, &m_bNoStipple, DLG_CHECK_BOOL ); // Display size info check = gtk_check_button_new_with_label( _( "Display size info" ) ); - gtk_widget_show( check ); gtk_box_pack_start( GTK_BOX( vbox ), check, FALSE, FALSE, 0 ); + gtk_widget_show( check ); AddDialogData( check, &m_bSizePaint, DLG_CHECK_BOOL ); // Alternate vertex/edge handles // Gef: Kyro GL_POINT work around 25-aug-2001 check = gtk_check_button_new_with_label( _( "Alternate vertex/edge handles" ) ); - gtk_widget_show( check ); gtk_box_pack_start( GTK_BOX( vbox ), check, FALSE, FALSE, 0 ); + gtk_widget_show( check ); AddDialogData( check, &m_bGlPtWorkaround, DLG_CHECK_BOOL ); g_list_free( combo_list ); @@ -1802,15 +1802,15 @@ void PrefsDlg::BuildDialog(){ #ifdef ATIHACK_812 // ATI bugs check = gtk_check_button_new_with_label( _( "ATI and Intel cards w/ buggy drivers (disappearing polygons)" ) ); - gtk_widget_show( check ); gtk_box_pack_start( GTK_BOX( vbox ), check, FALSE, FALSE, 0 ); + gtk_widget_show( check ); AddDialogData( check, &m_bGlATIHack, DLG_CHECK_BOOL ); #endif #ifdef NVIDIA_AERO_HACK check = gtk_check_button_new_with_label( _( "NVIDIA/Aero bug - disable Windows composition" ) ); - gtk_widget_show( check ); gtk_box_pack_start( GTK_BOX( vbox ), check, FALSE, FALSE, 0 ); + gtk_widget_show( check ); AddDialogData( check, &m_bGlNvidiaAeroHack, DLG_CHECK_BOOL ); #endif @@ -1824,85 +1824,85 @@ void PrefsDlg::BuildDialog(){ gtk_container_set_border_width( GTK_CONTAINER( pageframe ), 5 ); gtk_widget_show( pageframe ); vbox = gtk_vbox_new( FALSE, 5 ); - gtk_widget_show( vbox ); gtk_container_set_border_width( GTK_CONTAINER( vbox ), 5 ); gtk_container_add( GTK_CONTAINER( pageframe ), vbox ); + gtk_widget_show( vbox ); // Directional velocity (Movement Velocity) // label container hbox2 = gtk_hbox_new( FALSE, 0 ); - gtk_widget_show( hbox2 ); gtk_box_pack_start( GTK_BOX( vbox ), hbox2, FALSE, FALSE, 0 ); + gtk_widget_show( hbox2 ); // label label = gtk_label_new( _( "Movement Velocity" ) ); gtk_label_set_justify( GTK_LABEL( label ), GTK_JUSTIFY_LEFT ); - gtk_widget_show( label ); gtk_box_pack_start( GTK_BOX( hbox2 ), label, FALSE, FALSE, 0 ); + gtk_widget_show( label ); // adjustment - adj = gtk_adjustment_new( 100, 1, 300, 1, 10, 10 ); - AddDialogData( adj, &m_nMoveSpeed, DLG_ADJ_INT ); + adj = GTK_ADJUSTMENT( gtk_adjustment_new( 100, 1, 300, 1, 10, 10 ) ); + AddDialogData( G_OBJECT( adj ), &m_nMoveSpeed, DLG_ADJ_INT ); // scale scale = gtk_hscale_new( GTK_ADJUSTMENT( adj ) ); - gtk_widget_show( scale ); gtk_box_pack_start( GTK_BOX( vbox ), scale, FALSE, TRUE, 2 ); + gtk_widget_show( scale ); gtk_scale_set_draw_value( GTK_SCALE( scale ), TRUE ); // Angular velocity (Rotational Velocity) // label container hbox2 = gtk_hbox_new( FALSE, 0 ); - gtk_widget_show( hbox2 ); gtk_box_pack_start( GTK_BOX( vbox ), hbox2, FALSE, FALSE, 0 ); + gtk_widget_show( hbox2 ); // label label = gtk_label_new( _( "Rotational Velocity" ) ); gtk_label_set_justify( GTK_LABEL( label ), GTK_JUSTIFY_LEFT ); - gtk_widget_show( label ); gtk_box_pack_start( GTK_BOX( hbox2 ), label, FALSE, FALSE, 0 ); + gtk_widget_show( label ); // adjustment - adj = gtk_adjustment_new( 3, 1, 180, 1, 10, 10 ); // value, low, high, step, page_step, page_size - AddDialogData( adj, &m_nAngleSpeed, DLG_ADJ_INT ); + adj = GTK_ADJUSTMENT( gtk_adjustment_new( 3, 1, 180, 1, 10, 10 ) ); // value, low, high, step, page_step, page_size + AddDialogData( G_OBJECT( adj ), &m_nAngleSpeed, DLG_ADJ_INT ); // scale scale = gtk_hscale_new( GTK_ADJUSTMENT( adj ) ); - gtk_widget_show( scale ); gtk_box_pack_start( GTK_BOX( vbox ), scale, FALSE, TRUE, 2 ); gtk_scale_set_draw_value( GTK_SCALE( scale ), TRUE ); + gtk_widget_show( scale ); // Text under the velocity sliders // container hbox2 = gtk_hbox_new( FALSE, 0 ); - gtk_widget_show( hbox2 ); gtk_box_pack_start( GTK_BOX( vbox ), hbox2, FALSE, FALSE, 0 ); + gtk_widget_show( hbox2 ); // label label = gtk_label_new( _( "slow" ) ); - gtk_widget_show( label ); gtk_box_pack_start( GTK_BOX( hbox2 ), label, FALSE, FALSE, 0 ); + gtk_widget_show( label ); // label label = gtk_label_new( _( "fast" ) ); - gtk_widget_show( label ); gtk_box_pack_end( GTK_BOX( hbox2 ), label, FALSE, FALSE, 0 ); + gtk_widget_show( label ); // Allow drag to select multiple faces/brushes // container table = gtk_table_new( 2, 1, FALSE ); - gtk_widget_show( table ); gtk_box_pack_start( GTK_BOX( vbox ), table, FALSE, TRUE, 0 ); gtk_table_set_row_spacings( GTK_TABLE( table ), 5 ); gtk_table_set_col_spacings( GTK_TABLE( table ), 5 ); + gtk_widget_show( table ); label = gtk_label_new( _( "Use paint-select in camera view:" ) ); - gtk_widget_show( label ); gtk_label_set_justify( GTK_LABEL( label ), GTK_JUSTIFY_LEFT ); gtk_table_attach( GTK_TABLE( table ), label, 0, 1, 0, 1, (GtkAttachOptions) ( 0 ), (GtkAttachOptions) ( 0 ), 0, 0 ); + gtk_widget_show( label ); combo_list = NULL; combo_list = g_list_append( combo_list, (void *)_( "No" ) ); @@ -1911,46 +1911,46 @@ void PrefsDlg::BuildDialog(){ combo = gtk_combo_new(); gtk_combo_set_popdown_strings( GTK_COMBO( combo ), combo_list ); - gtk_widget_show( combo ); gtk_table_attach( GTK_TABLE( table ), combo, 1, 2, 0, 1, (GtkAttachOptions) ( GTK_FILL ), (GtkAttachOptions) ( 0 ), 0, 0 ); gtk_entry_set_editable( GTK_ENTRY( GTK_COMBO( combo )->entry ), FALSE ); + gtk_widget_show( combo ); AddDialogData( combo, &m_nCamDragMultiSelect, DLG_COMBO_INT ); // Freelook in Camera view check = gtk_check_button_new_with_label( _( "Freelook in Camera view" ) ); - gtk_widget_show( check ); gtk_box_pack_start( GTK_BOX( vbox ), check, FALSE, FALSE, 0 ); gtk_label_set_justify( GTK_LABEL( GTK_BIN( check )->child ), GTK_JUSTIFY_LEFT ); + gtk_widget_show( check ); AddDialogData( check, &m_bCamFreeLook, DLG_CHECK_BOOL ); // Freelook in Camera view w/ forward & back strafing instead of up and down looking check = gtk_check_button_new_with_label( _( "Freelook strafes Forward and Back" ) ); - gtk_widget_show( check ); gtk_box_pack_start( GTK_BOX( vbox ), check, FALSE, FALSE, 0 ); gtk_label_set_justify( GTK_LABEL( GTK_BIN( check )->child ), GTK_JUSTIFY_LEFT ); + gtk_widget_show( check ); AddDialogData( check, &m_bCamFreeLookStrafe, DLG_CHECK_BOOL ); // Invert mouse in freelook check = gtk_check_button_new_with_label( _( "Invert mouse in freelook" ) ); - gtk_widget_show( check ); gtk_box_pack_start( GTK_BOX( vbox ), check, FALSE, FALSE, 0 ); gtk_label_set_justify( GTK_LABEL( GTK_BIN( check )->child ), GTK_JUSTIFY_LEFT ); + gtk_widget_show( check ); AddDialogData( check, &m_bCamInverseMouse, DLG_CHECK_BOOL ); // Discrete movement check = gtk_check_button_new_with_label( _( "Discrete movement" ) ); - gtk_widget_show( check ); gtk_box_pack_start( GTK_BOX( vbox ), check, FALSE, FALSE, 0 ); gtk_label_set_justify( GTK_LABEL( GTK_BIN( check )->child ), GTK_JUSTIFY_LEFT ); + gtk_widget_show( check ); AddDialogData( check, &m_bCamDiscrete, DLG_CHECK_BOOL ); // Update XY views on camera move check = gtk_check_button_new_with_label( _( "Update XY views on camera move" ) ); - gtk_widget_show( check ); gtk_box_pack_start( GTK_BOX( vbox ), check, FALSE, FALSE, 0 ); gtk_label_set_justify( GTK_LABEL( GTK_BIN( check )->child ), GTK_JUSTIFY_LEFT ); + gtk_widget_show( check ); AddDialogData( check, &m_bCamXYUpdate, DLG_CHECK_BOOL ); // Add the page to the notebook @@ -1963,73 +1963,76 @@ void PrefsDlg::BuildDialog(){ gtk_container_set_border_width( GTK_CONTAINER( pageframe ), 5 ); gtk_widget_show( pageframe ); vbox = gtk_vbox_new( FALSE, 5 ); - gtk_widget_show( vbox ); gtk_container_set_border_width( GTK_CONTAINER( vbox ), 5 ); gtk_container_add( GTK_CONTAINER( pageframe ), vbox ); + gtk_widget_show( vbox ); // Texture quality slider // label label = gtk_label_new( _( "Texture quality" ) ); - gtk_widget_show( label ); gtk_box_pack_start( GTK_BOX( vbox ), label, FALSE, FALSE, 0 ); gtk_misc_set_alignment( GTK_MISC( label ), 0, 0.5 ); gtk_label_set_justify( GTK_LABEL( label ), GTK_JUSTIFY_LEFT ); + gtk_widget_show( label ); // adjustment - adj = gtk_adjustment_new( 0, 0, 4, 1, 1, 1 ); - AddDialogData( adj, &m_nLatchedTextureQuality, DLG_ADJ_INT ); + adj = GTK_ADJUSTMENT( gtk_adjustment_new( 0, 0, 4, 1, 1, 1 ) ); + AddDialogData( G_OBJECT( adj ), &m_nLatchedTextureQuality, DLG_ADJ_INT ); // scale scale = gtk_hscale_new( GTK_ADJUSTMENT( adj ) ); - gtk_widget_show( scale ); gtk_box_pack_start( GTK_BOX( vbox ), scale, FALSE, FALSE, 0 ); gtk_scale_set_draw_value( GTK_SCALE( scale ), FALSE ); + gtk_widget_show( scale ); // text under the texture slider hbox2 = gtk_hbox_new( FALSE, 0 ); - gtk_widget_show( hbox2 ); gtk_box_pack_start( GTK_BOX( vbox ), hbox2, FALSE, FALSE, 0 ); + gtk_widget_show( hbox2 ); + label = gtk_label_new( _( "low" ) ); - gtk_widget_show( label ); gtk_box_pack_start( GTK_BOX( hbox2 ), label, FALSE, FALSE, 0 ); - label = gtk_label_new( _( "high" ) ); gtk_widget_show( label ); + + label = gtk_label_new( _( "high" ) ); gtk_box_pack_end( GTK_BOX( hbox2 ), label, FALSE, FALSE, 0 ); + gtk_widget_show( label ); // texture subsets check = gtk_check_button_new_with_label( _( "Texture subsets" ) ); - gtk_widget_show( check ); gtk_box_pack_start( GTK_BOX( vbox ), check, FALSE, FALSE, 0 ); + gtk_widget_show( check ); AddDialogData( check, &m_bTextureWindow, DLG_CHECK_BOOL ); // texture scrollbar check = gtk_check_button_new_with_label( _( "Texture scrollbar" ) ); - gtk_widget_show( check ); gtk_box_pack_start( GTK_BOX( vbox ), check, FALSE, FALSE, 0 ); + gtk_widget_show( check ); AddDialogData( check, &m_bTextureScrollbar, DLG_CHECK_BOOL ); // texture increment matches grid check = gtk_check_button_new_with_label( _( "Tex increment matches grid" ) ); - gtk_widget_show( check ); gtk_box_pack_start( GTK_BOX( vbox ), check, FALSE, FALSE, 0 ); + gtk_widget_show( check ); AddDialogData( check, &m_bSnapTToGrid, DLG_CHECK_BOOL ); // RIANT // Texture compression choice label // container table = gtk_table_new( 2, 1, FALSE ); - gtk_widget_show( table ); gtk_box_pack_start( GTK_BOX( vbox ), table, FALSE, TRUE, 0 ); gtk_table_set_row_spacings( GTK_TABLE( table ), 5 ); gtk_table_set_col_spacings( GTK_TABLE( table ), 5 ); + gtk_widget_show( table ); label = gtk_label_new( _( "Texture Compression (if available):" ) ); - gtk_widget_show( label ); + g_object_set( label, "xalign", 0.0, NULL ); gtk_label_set_justify( GTK_LABEL( label ), GTK_JUSTIFY_LEFT ); gtk_table_attach( GTK_TABLE( table ), label, 0, 1, 0, 1, (GtkAttachOptions) ( 0 ), (GtkAttachOptions) ( 0 ), 0, 0 ); gtk_misc_set_alignment( GTK_MISC( label ), 0, 0.5 ); + gtk_widget_show( label ); // Texture compression choice label combo_list = NULL; @@ -2051,30 +2054,31 @@ void PrefsDlg::BuildDialog(){ combo = gtk_combo_new(); gtk_combo_set_popdown_strings( GTK_COMBO( combo ), combo_list ); - gtk_widget_show( combo ); gtk_table_attach( GTK_TABLE( table ), combo, 1, 2, 0, 1, (GtkAttachOptions) ( GTK_FILL ), (GtkAttachOptions) ( 0 ), 0, 0 ); gtk_entry_set_editable( GTK_ENTRY( GTK_COMBO( combo )->entry ), FALSE ); + gtk_widget_show( combo ); AddDialogData( combo, &m_nTextureCompressionFormat, DLG_COMBO_INT ); g_list_free( combo_list ); // container table = gtk_table_new( 2, 1, FALSE ); - gtk_widget_show( table ); gtk_box_pack_start( GTK_BOX( vbox ), table, FALSE, TRUE, 0 ); gtk_table_set_row_spacings( GTK_TABLE( table ), 5 ); gtk_table_set_col_spacings( GTK_TABLE( table ), 5 ); + gtk_widget_show( table ); // Startup shaders // label label = gtk_label_new( _( "Startup Shaders:" ) ); - gtk_widget_show( label ); + g_object_set( label, "xalign", 0.0, NULL ); gtk_label_set_justify( GTK_LABEL( label ), GTK_JUSTIFY_LEFT ); gtk_table_attach( GTK_TABLE( table ), label, 0, 1, 0, 1, (GtkAttachOptions) ( 0 ), (GtkAttachOptions) ( 0 ), 0, 0 ); gtk_misc_set_alignment( GTK_MISC( label ), 0, 0.5 ); + gtk_widget_show( label ); // combo list combo_list = NULL; @@ -2091,11 +2095,11 @@ void PrefsDlg::BuildDialog(){ combo_list = g_list_append( combo_list, (void *)_( "All" ) ); combo = gtk_combo_new(); gtk_combo_set_popdown_strings( GTK_COMBO( combo ), combo_list ); - gtk_widget_show( combo ); gtk_table_attach( GTK_TABLE( table ), combo, 1, 2, 0, 1, (GtkAttachOptions) ( GTK_FILL ), (GtkAttachOptions) ( 0 ), 0, 0 ); gtk_entry_set_editable( GTK_ENTRY( GTK_COMBO( combo )->entry ), FALSE ); + gtk_widget_show( combo ); AddDialogData( combo, &m_nLatchedShader, DLG_COMBO_INT ); g_list_free( combo_list ); @@ -2109,85 +2113,85 @@ void PrefsDlg::BuildDialog(){ gtk_container_set_border_width( GTK_CONTAINER( pageframe ), 5 ); gtk_widget_show( pageframe ); vbox = gtk_vbox_new( FALSE, 5 ); - gtk_widget_show( vbox ); gtk_container_set_border_width( GTK_CONTAINER( vbox ), 5 ); gtk_container_add( GTK_CONTAINER( pageframe ), vbox ); + gtk_widget_show( vbox ); // View types // table table = gtk_table_new( 2, 4, FALSE ); - gtk_widget_show( table ); gtk_box_pack_start( GTK_BOX( vbox ), table, FALSE, TRUE, 0 ); gtk_table_set_row_spacings( GTK_TABLE( table ), 5 ); gtk_table_set_col_spacings( GTK_TABLE( table ), 5 ); + gtk_widget_show( table ); // view type 1 pixmap = new_image_icon("window1.png"); - gtk_widget_show( pixmap ); gtk_table_attach( GTK_TABLE( table ), pixmap, 0, 1, 0, 1, (GtkAttachOptions) ( 0 ), (GtkAttachOptions) ( 0 ), 0, 0 ); + gtk_widget_show( pixmap ); // view type 2 pixmap = new_image_icon("window2.png"); - gtk_widget_show( pixmap ); gtk_table_attach( GTK_TABLE( table ), pixmap, 1, 2, 0, 1, (GtkAttachOptions) ( 0 ), (GtkAttachOptions) ( 0 ), 0, 0 ); + gtk_widget_show( pixmap ); // view type 3 pixmap = new_image_icon("window3.png"); - gtk_widget_show( pixmap ); gtk_table_attach( GTK_TABLE( table ), pixmap, 2, 3, 0, 1, (GtkAttachOptions) ( 0 ), (GtkAttachOptions) ( 0 ), 0, 0 ); + gtk_widget_show( pixmap ); // view type 4 pixmap = new_image_icon("window4.png"); - gtk_widget_show( pixmap ); gtk_table_attach( GTK_TABLE( table ), pixmap, 3, 4, 0, 1, (GtkAttachOptions) ( 0 ), (GtkAttachOptions) ( 0 ), 0, 0 ); + gtk_widget_show( pixmap ); // view type 1 selector radio = gtk_radio_button_new( NULL ); - gtk_widget_show( radio ); gtk_table_attach( GTK_TABLE( table ), radio, 0, 1, 1, 2, (GtkAttachOptions) ( 0 ), (GtkAttachOptions) ( 0 ), 0, 0 ); + gtk_widget_show( radio ); // view type 2 selector radio = gtk_radio_button_new_from_widget( GTK_RADIO_BUTTON( radio ) ); - gtk_widget_show( radio ); gtk_table_attach( GTK_TABLE( table ), radio, 1, 2, 1, 2, (GtkAttachOptions) ( 0 ), (GtkAttachOptions) ( 0 ), 0, 0 ); + gtk_widget_show( radio ); // view type 3 selector radio = gtk_radio_button_new_from_widget( GTK_RADIO_BUTTON( radio ) ); - gtk_widget_show( radio ); gtk_table_attach( GTK_TABLE( table ), radio, 2, 3, 1, 2, (GtkAttachOptions) ( 0 ), (GtkAttachOptions) ( 0 ), 0, 0 ); + gtk_widget_show( radio ); // view type 4 selector radio = gtk_radio_button_new_from_widget( GTK_RADIO_BUTTON( radio ) ); - gtk_widget_show( radio ); gtk_table_attach( GTK_TABLE( table ), radio, 3, 4, 1, 2, (GtkAttachOptions) ( 0 ), (GtkAttachOptions) ( 0 ), 0, 0 ); + gtk_widget_show( radio ); AddDialogData( radio, &m_nLatchedView, DLG_RADIO_INT ); // Floating Z window check = gtk_check_button_new_with_label( _( "Floating Z Window" ) ); - gtk_widget_show( check ); gtk_box_pack_start( GTK_BOX( vbox ), check, FALSE, FALSE, 0 ); + gtk_widget_show( check ); AddDialogData( check, &m_bLatchedFloatingZ, DLG_CHECK_BOOL ); // show menu tear-off seperators check = gtk_check_button_new_with_label( _( "Detachable Menus" ) ); - gtk_widget_show( check ); gtk_box_pack_start( GTK_BOX( vbox ), check, FALSE, FALSE, 0 ); + gtk_widget_show( check ); AddDialogData( check, &m_bLatchedDetachableMenus, DLG_CHECK_BOOL ); if ( !g_pGameDescription->mNoPatch ) { @@ -2201,8 +2205,8 @@ void PrefsDlg::BuildDialog(){ // use wide toolbar check = gtk_check_button_new_with_label( _( "Wide Toolbar" ) ); - gtk_widget_show( check ); gtk_box_pack_start( GTK_BOX( vbox ), check, FALSE, FALSE, 0 ); + gtk_widget_show( check ); AddDialogData( check, &m_bLatchedWideToolbar, DLG_CHECK_BOOL ); // use plugin toolbar @@ -2214,15 +2218,15 @@ void PrefsDlg::BuildDialog(){ #ifdef _WIN32 // win32 file dialog check = gtk_check_button_new_with_label( _( "Use win32 file dialog (hacky)" ) ); - gtk_widget_show( check ); // gtk_container_add (GTK_CONTAINER (vbox), check); gtk_box_pack_start( GTK_BOX( vbox ), check, FALSE, FALSE, 0 ); + gtk_widget_show( check ); AddDialogData( check, &m_bNativeGUI, DLG_CHECK_BOOL ); // position on primary monitor check = gtk_check_button_new_with_label( _( "Start on Primary Monitor" ) ); - gtk_widget_show( check ); gtk_box_pack_start( GTK_BOX( vbox ), check, FALSE, FALSE, 0 ); + gtk_widget_show( check ); g_object_set_data( G_OBJECT( dialog ), "check_startonprimary", check ); g_signal_connect( G_OBJECT( check ), "clicked", G_CALLBACK( UpdateSensitivity ), this ); AddDialogData( check, &m_bStartOnPrimMon, DLG_CHECK_BOOL ); @@ -2238,67 +2242,67 @@ void PrefsDlg::BuildDialog(){ gtk_container_set_border_width( GTK_CONTAINER( pageframe ), 5 ); gtk_widget_show( pageframe ); vbox = gtk_vbox_new( FALSE, 5 ); - gtk_widget_show( vbox ); gtk_container_set_border_width( GTK_CONTAINER( vbox ), 5 ); gtk_container_add( GTK_CONTAINER( pageframe ), vbox ); + gtk_widget_show( vbox ); // Buttons // container hbox2 = gtk_hbox_new( FALSE, 5 ); - gtk_widget_show( hbox2 ); gtk_box_pack_start( GTK_BOX( vbox ), hbox2, FALSE, FALSE, 0 ); + gtk_widget_show( hbox2 ); // 2 button radio radio = gtk_radio_button_new_with_label( NULL, _( "2 button" ) ); - gtk_widget_show( radio ); gtk_box_pack_start( GTK_BOX( hbox2 ), radio, FALSE, FALSE, 0 ); + gtk_widget_show( radio ); // 3 button radio radio = gtk_radio_button_new_with_label_from_widget( GTK_RADIO_BUTTON( radio ), _( "3 button" ) ); - gtk_widget_show( radio ); gtk_box_pack_start( GTK_BOX( hbox2 ), radio, FALSE, FALSE, 0 ); + gtk_widget_show( radio ); AddDialogData( radio, &m_nMouse, DLG_RADIO_INT ); // right click to drop entity check = gtk_check_button_new_with_label( _( "Right click to drop entities" ) ); - gtk_widget_show( check ); gtk_box_pack_start( GTK_BOX( vbox ), check, FALSE, FALSE, 0 ); + gtk_widget_show( check ); AddDialogData( check, &m_bRightClick, DLG_CHECK_BOOL ); // Mouse chaser (and this does what?) check = gtk_check_button_new_with_label( _( "Mouse chaser" ) ); - gtk_widget_show( check ); gtk_box_pack_start( GTK_BOX( vbox ), check, FALSE, FALSE, 0 ); + gtk_widget_show( check ); AddDialogData( check, &m_bChaseMouse, DLG_CHECK_BOOL ); // Alt + multi-drag check = gtk_check_button_new_with_label( _( "ALT + multi-drag" ) ); - gtk_widget_show( check ); gtk_box_pack_start( GTK_BOX( vbox ), check, FALSE, FALSE, 0 ); + gtk_widget_show( check ); AddDialogData( check, &m_bALTEdge, DLG_CHECK_BOOL ); // Imroved mouse wheel zoom in check = gtk_check_button_new_with_label( _( "Improved mousewheel zoom-in" ) ); - gtk_widget_show( check ); gtk_box_pack_start( GTK_BOX( vbox ), check, FALSE, FALSE, 0 ); + gtk_widget_show( check ); AddDialogData( check, &m_bMousewheelZoom, DLG_CHECK_BOOL ); // Mouse wheel increments // container hbox2 = gtk_hbox_new( FALSE, 5 ); - gtk_widget_show( hbox2 ); gtk_box_pack_start( GTK_BOX( vbox ), hbox2, FALSE, FALSE, 0 ); + gtk_widget_show( hbox2 ); // label label = gtk_label_new( _( "Wheel Mouse inc:" ) ); - gtk_widget_show( label ); gtk_box_pack_start( GTK_BOX( hbox2 ), label, FALSE, FALSE, 0 ); + gtk_widget_show( label ); // entry entry = gtk_entry_new(); - gtk_widget_show( entry ); - gtk_widget_set_usize( entry, 40, -2 ); + gtk_entry_set_alignment( GTK_ENTRY( entry ), 1.0 ); //right gtk_box_pack_start( GTK_BOX( hbox2 ), entry, FALSE, FALSE, 0 ); + gtk_widget_show( entry ); AddDialogData( entry, &m_nWheelInc, DLG_ENTRY_INT ); // Add the page to the notebook @@ -2311,102 +2315,105 @@ void PrefsDlg::BuildDialog(){ gtk_container_set_border_width( GTK_CONTAINER( pageframe ), 5 ); gtk_widget_show( pageframe ); vbox = gtk_vbox_new( FALSE, 5 ); - gtk_widget_show( vbox ); gtk_container_set_border_width( GTK_CONTAINER( vbox ), 5 ); gtk_container_add( GTK_CONTAINER( pageframe ), vbox ); + gtk_widget_show( vbox ); // Vertex editing splits faces check = gtk_check_button_new_with_label( _( "Vertex editing splits face" ) ); - gtk_widget_show( check ); gtk_box_pack_start( GTK_BOX( vbox ), check, FALSE, FALSE, 0 ); + gtk_widget_show( check ); AddDialogData( check, &m_bVertexSplit, DLG_CHECK_BOOL ); // Fix target/targetname collisions check = gtk_check_button_new_with_label( _( "Fix target/targetname collisions" ) ); - gtk_widget_show( check ); gtk_box_pack_start( GTK_BOX( vbox ), check, FALSE, FALSE, 0 ); + gtk_widget_show( check ); AddDialogData( check, &m_bDoTargetFix, DLG_CHECK_BOOL ); // Clipper tool uses caulk check = gtk_check_button_new_with_label( _( "Clipper tool uses caulk" ) ); - gtk_widget_show( check ); gtk_box_pack_start( GTK_BOX( vbox ), check, FALSE, FALSE, 0 ); + gtk_widget_show( check ); AddDialogData( check, &m_bClipCaulk, DLG_CHECK_BOOL ); // Don't clamp plane points check = gtk_check_button_new_with_label( _( "Don't clamp plane points" ) ); - gtk_widget_show( check ); gtk_box_pack_start( GTK_BOX( vbox ), check, FALSE, FALSE, 0 ); + gtk_widget_show( check ); AddDialogData( check, &m_bNoClamp, DLG_CHECK_BOOL ); // Snap to grid check = gtk_check_button_new_with_label( _( "Snap to grid" ) ); - gtk_widget_show( check ); gtk_box_pack_start( GTK_BOX( vbox ), check, FALSE, FALSE, 0 ); + gtk_widget_show( check ); AddDialogData( check, &m_bSnap, DLG_CHECK_BOOL ); // Select patch by bounding box check = gtk_check_button_new_with_label( _( "Select patches by bounding box" ) ); - gtk_widget_show( check ); gtk_box_pack_start( GTK_BOX( vbox ), check, FALSE, FALSE, 0 ); + gtk_widget_show( check ); AddDialogData( check, &m_bPatchBBoxSelect, DLG_CHECK_BOOL ); // Rotation increment // container table = gtk_table_new( 2, 3, FALSE ); - gtk_widget_show( table ); gtk_box_pack_start( GTK_BOX( vbox ), table, FALSE, TRUE, 0 ); gtk_table_set_row_spacings( GTK_TABLE( table ), 5 ); gtk_table_set_col_spacings( GTK_TABLE( table ), 5 ); + gtk_widget_show( table ); // label label = gtk_label_new( _( "Rotation increment:" ) ); - gtk_widget_show( label ); gtk_table_attach( GTK_TABLE( table ), label, 0, 1, 0, 1, (GtkAttachOptions) ( 0 ), (GtkAttachOptions) ( 0 ), 0, 0 ); + gtk_widget_show( label ); // entry entry = gtk_entry_new(); - gtk_widget_show( entry ); - gtk_widget_set_usize( entry, 60, -2 ); + gtk_entry_set_alignment( GTK_ENTRY( entry ), 1.0 ); //right gtk_table_attach( GTK_TABLE( table ), entry, 1, 2, 0, 1, (GtkAttachOptions) ( GTK_FILL ), (GtkAttachOptions) ( 0 ), 0, 0 ); + gtk_widget_show( entry ); AddDialogData( entry, &m_nRotation, DLG_ENTRY_INT ); // Undo levels // label label = gtk_label_new( _( "Undo Levels:" ) ); - gtk_widget_show( label ); + g_object_set( label, "xalign", 0.0, NULL ); gtk_table_attach( GTK_TABLE( table ), label, 0, 1, 1, 2, (GtkAttachOptions) ( 0 ), (GtkAttachOptions) ( 0 ), 0, 0 ); + gtk_widget_show( label ); // spinner (allows undo levels to be set to zero) spin = gtk_spin_button_new( GTK_ADJUSTMENT( gtk_adjustment_new( 1, 0, 64, 1, 10, 0 ) ), 1, 0 ); - gtk_widget_show( spin ); + gtk_spin_button_set_numeric( GTK_SPIN_BUTTON( spin ), TRUE ); + gtk_entry_set_alignment( GTK_ENTRY( spin ), 1.0 ); //right gtk_table_attach( GTK_TABLE( table ), spin, 1, 2, 1, 2, (GtkAttachOptions) ( GTK_FILL ), (GtkAttachOptions) ( 0 ), 0, 0 ); - gtk_widget_set_usize( spin, 60, -2 ); + gtk_widget_show( spin ); AddDialogData( spin, &m_nUndoLevels, DLG_SPIN_INT ); // Patch subdivisions // label label = gtk_label_new( _( "Patch subdivisions:" ) ); - gtk_widget_show( label ); + g_object_set( label, "xalign", 0.0, NULL ); gtk_table_attach( GTK_TABLE( table ), label, 0, 1, 2, 3, (GtkAttachOptions) ( 0 ), (GtkAttachOptions) ( 0 ), 0, 0 ); + gtk_widget_show( label ); // entry (spinner perhaps? [2-16]) entry = gtk_entry_new(); - gtk_widget_show( entry ); - gtk_widget_set_usize( entry, 60, -2 ); + gtk_entry_set_alignment( GTK_ENTRY( entry ), 1.0 ); //right gtk_table_attach( GTK_TABLE( table ), entry, 1, 2, 2, 3, (GtkAttachOptions) ( GTK_FILL ), (GtkAttachOptions) ( 0 ), 0, 0 ); + gtk_widget_show( entry ); AddDialogData( entry, &m_nSubdivisions, DLG_ENTRY_INT ); // Add the page to the notebook @@ -2419,52 +2426,53 @@ void PrefsDlg::BuildDialog(){ gtk_container_set_border_width( GTK_CONTAINER( pageframe ), 5 ); gtk_widget_show( pageframe ); vbox = gtk_vbox_new( FALSE, 5 ); - gtk_widget_show( vbox ); gtk_container_set_border_width( GTK_CONTAINER( vbox ), 5 ); gtk_container_add( GTK_CONTAINER( pageframe ), vbox ); + gtk_widget_show( vbox ); // Snapshots check = gtk_check_button_new_with_label( _( "Snapshots" ) ); - gtk_widget_show( check ); gtk_box_pack_start( GTK_BOX( vbox ), check, FALSE, FALSE, 0 ); + gtk_widget_show( check ); AddDialogData( check, &m_bSnapShots, DLG_CHECK_BOOL ); // load last project on open check = gtk_check_button_new_with_label( _( "Load last project on open" ) ); - gtk_widget_show( check ); gtk_box_pack_start( GTK_BOX( vbox ), check, FALSE, FALSE, 0 ); + gtk_widget_show( check ); AddDialogData( check, &m_bLoadLast, DLG_CHECK_BOOL ); // load last map on open check = gtk_check_button_new_with_label( _( "Load last map on open" ) ); - gtk_widget_show( check ); gtk_box_pack_start( GTK_BOX( vbox ), check, FALSE, FALSE, 0 ); + gtk_widget_show( check ); AddDialogData( check, &m_bLoadLastMap, DLG_CHECK_BOOL ); // Auto save.. // container hbox2 = gtk_hbox_new( FALSE, 5 ); - gtk_widget_show( hbox2 ); gtk_box_pack_start( GTK_BOX( vbox ), hbox2, FALSE, FALSE, 0 ); + gtk_widget_show( hbox2 ); gtk_container_set_border_width( GTK_CONTAINER( hbox2 ), 0 ); // label check = gtk_check_button_new_with_label( _( "Auto save every" ) ); - gtk_widget_show( check ); gtk_box_pack_start( GTK_BOX( hbox2 ), check, FALSE, FALSE, 0 ); + gtk_widget_show( check ); AddDialogData( check, &m_bAutoSave, DLG_CHECK_BOOL ); // spinner spin = gtk_spin_button_new( GTK_ADJUSTMENT( gtk_adjustment_new( 1, 1, 60, 1, 10, 0 ) ), 1, 0 ); - gtk_widget_show( spin ); + gtk_spin_button_set_numeric( GTK_SPIN_BUTTON( spin ), TRUE ); + gtk_entry_set_alignment( GTK_ENTRY( spin ), 1.0 ); //right gtk_box_pack_start( GTK_BOX( hbox2 ), spin, FALSE, FALSE, 0 ); - gtk_widget_set_usize( spin, 60, -2 ); + gtk_widget_show( spin ); AddDialogData( spin, &m_nAutoSave, DLG_SPIN_INT ); // label label = gtk_label_new( _( "minutes" ) ); - gtk_widget_show( label ); gtk_box_pack_start( GTK_BOX( hbox2 ), label, FALSE, FALSE, 0 ); + gtk_widget_show( label ); check = gtk_check_button_new_with_label( _( "Beep on save" ) ); gtk_box_pack_start( GTK_BOX( vbox ), check, FALSE, FALSE, 0 ); @@ -2481,69 +2489,70 @@ void PrefsDlg::BuildDialog(){ gtk_container_set_border_width( GTK_CONTAINER( pageframe ), 5 ); gtk_widget_show( pageframe ); vbox = gtk_vbox_new( FALSE, 5 ); - gtk_widget_show( vbox ); gtk_container_set_border_width( GTK_CONTAINER( vbox ), 5 ); gtk_container_add( GTK_CONTAINER( pageframe ), vbox ); + gtk_widget_show( vbox ); // prefab path // table table = gtk_table_new( 3, 3, FALSE ); - gtk_widget_show( table ); gtk_box_pack_start( GTK_BOX( vbox ), table, FALSE, TRUE, 0 ); gtk_table_set_row_spacings( GTK_TABLE( table ), 5 ); gtk_table_set_col_spacings( GTK_TABLE( table ), 5 ); + gtk_widget_show( table ); // label label = gtk_label_new( _( "Prefab path:" ) ); - gtk_widget_show( label ); + g_object_set( label, "xalign", 0.0, NULL ); gtk_table_attach( GTK_TABLE( table ), label, 0, 1, 0, 1, (GtkAttachOptions) ( 0 ), (GtkAttachOptions) ( 0 ), 0, 0 ); gtk_misc_set_alignment( GTK_MISC( label ), 1, 0.5 ); + gtk_widget_show( label ); // path entry entry = gtk_entry_new(); - gtk_widget_show( entry ); - gtk_widget_set_usize( GTK_WIDGET( entry ), 240, -2 ); gtk_table_attach( GTK_TABLE( table ), entry, 1, 2, 0, 1, (GtkAttachOptions) ( GTK_FILL ), (GtkAttachOptions) ( 0 ), 1, 0 ); + gtk_widget_show( entry ); AddDialogData( entry, &m_strPrefabPath, DLG_ENTRY_TEXT ); #if PREFERENCES_HAVE_PREFAB_PATH // browse button button = gtk_button_new_with_label( _( "..." ) ); - gtk_widget_show( button ); g_signal_connect( G_OBJECT( button ), "clicked", G_CALLBACK( OnBtnBrowseprefab ), this ); gtk_table_attach( GTK_TABLE( table ), button, 2, 3, 0, 1, (GtkAttachOptions) ( 0 ), (GtkAttachOptions) ( 0 ), 0, 0 ); + gtk_widget_show( button ); #endif // User ini path // label label = gtk_label_new( _( "User INI path:" ) ); - gtk_widget_show( label ); + g_object_set( label, "xalign", 0.0, NULL ); gtk_table_attach( GTK_TABLE( table ), label, 0, 1, 1, 2, (GtkAttachOptions) ( 0 ), (GtkAttachOptions) ( 0 ), 0, 0 ); gtk_misc_set_alignment( GTK_MISC( label ), 1, 0.5 ); + gtk_widget_show( label ); // user ini path entry entry = gtk_entry_new(); - gtk_widget_show( entry ); gtk_table_attach( GTK_TABLE( table ), entry, 1, 2, 1, 2, (GtkAttachOptions) ( GTK_FILL ), (GtkAttachOptions) ( 0 ), 1, 0 ); + gtk_widget_show( entry ); AddDialogData( entry, &m_strUserPath, DLG_ENTRY_TEXT ); // user ini browse button button = gtk_button_new_with_label( _( "..." ) ); - gtk_widget_show( button ); g_signal_connect( G_OBJECT( button ), "clicked", G_CALLBACK( OnBtnBrowseuserini ), this ); gtk_table_attach( GTK_TABLE( table ), button, 2, 3, 1, 2, (GtkAttachOptions) ( 0 ), (GtkAttachOptions) ( 0 ), 0, 0 ); + gtk_widget_show( button ); // Add the page to the notebook gtk_notebook_append_page( GTK_NOTEBOOK( notebook ), pageframe, preflabel ); @@ -2555,42 +2564,43 @@ void PrefsDlg::BuildDialog(){ gtk_container_set_border_width( GTK_CONTAINER( pageframe ), 5 ); gtk_widget_show( pageframe ); vbox = gtk_vbox_new( FALSE, 5 ); - gtk_widget_show( vbox ); gtk_container_set_border_width( GTK_CONTAINER( vbox ), 5 ); gtk_container_add( GTK_CONTAINER( pageframe ), vbox ); + gtk_widget_show( vbox ); // default texture scale // table table = gtk_table_new( 2, 1, FALSE ); // I believe that the 2 and 1 are switched here, and this is // intentional to be consistent with other calls to gtk_table_new() // [that are probably also switched]. - gtk_widget_show( table ); gtk_box_pack_start( GTK_BOX( vbox ), table, FALSE, TRUE, 0 ); gtk_table_set_row_spacings( GTK_TABLE( table ), 5 ); gtk_table_set_col_spacings( GTK_TABLE( table ), 5 ); + gtk_widget_show( table ); // label label = gtk_label_new( _( "Default texture scale:" ) ); - gtk_widget_show( label ); + g_object_set( label, "xalign", 0.0, NULL ); gtk_label_set_justify( GTK_LABEL( label ), GTK_JUSTIFY_LEFT ); gtk_table_attach( GTK_TABLE( table ), label, 0, 1, 0, 1, (GtkAttachOptions) ( 0 ), (GtkAttachOptions) ( 0 ), 0, 0 ); + gtk_widget_show( label ); // scale entry entry = gtk_entry_new(); - gtk_widget_show( entry ); - gtk_widget_set_usize( GTK_WIDGET( entry ), 60, -2 ); + gtk_entry_set_alignment( GTK_ENTRY( entry ), 1.0 ); //right gtk_table_attach( GTK_TABLE( table ), entry, 1, 2, 0, 1, (GtkAttachOptions) ( GTK_FILL ), (GtkAttachOptions) ( 0 ), 0, 0 ); + gtk_widget_show( entry ); AddDialogData( entry, &m_fDefTextureScale, DLG_ENTRY_FLOAT ); // caulk new brushes check = gtk_check_button_new_with_label( _( "Always use caulk for new brushes" ) ); - gtk_widget_show( check ); gtk_box_pack_start( GTK_BOX( vbox ), check, FALSE, FALSE, 0 ); + gtk_widget_show( check ); g_object_set_data( G_OBJECT( dialog ), "check_caulkbrush", check ); AddDialogData( check, &m_bCaulkNewBrushes, DLG_CHECK_BOOL ); @@ -2604,30 +2614,31 @@ void PrefsDlg::BuildDialog(){ gtk_container_set_border_width( GTK_CONTAINER( pageframe ), 5 ); gtk_widget_show( pageframe ); vbox = gtk_vbox_new( FALSE, 5 ); - gtk_widget_show( vbox ); gtk_container_set_border_width( GTK_CONTAINER( vbox ), 5 ); gtk_container_add( GTK_CONTAINER( pageframe ), vbox ); + gtk_widget_show( vbox ); // Light drawing check = gtk_check_button_new_with_label( _( "Light drawing" ) ); - gtk_widget_show( check ); gtk_box_pack_start( GTK_BOX( vbox ), check, FALSE, FALSE, 0 ); + gtk_widget_show( check ); AddDialogData( check, &m_bNewLightDraw, DLG_CHECK_BOOL ); // Light radiuses // container table = gtk_table_new( 2, 1, FALSE ); - gtk_widget_show( table ); gtk_box_pack_start( GTK_BOX( vbox ), table, FALSE, TRUE, 0 ); gtk_table_set_row_spacings( GTK_TABLE( table ), 5 ); gtk_table_set_col_spacings( GTK_TABLE( table ), 5 ); + gtk_widget_show( table ); label = gtk_label_new( _( "Light radiuses:" ) ); - gtk_widget_show( label ); + g_object_set( label, "xalign", 0.0, NULL ); gtk_label_set_justify( GTK_LABEL( label ), GTK_JUSTIFY_LEFT ); gtk_table_attach( GTK_TABLE( table ), label, 0, 1, 0, 1, (GtkAttachOptions) ( 0 ), (GtkAttachOptions) ( 0 ), 0, 0 ); + gtk_widget_show( label ); combo_list = NULL; combo_list = g_list_append( combo_list, (void *)_( "Disabled" ) ); @@ -2636,23 +2647,23 @@ void PrefsDlg::BuildDialog(){ combo = gtk_combo_new(); gtk_combo_set_popdown_strings( GTK_COMBO( combo ), combo_list ); - gtk_widget_show( combo ); gtk_table_attach( GTK_TABLE( table ), combo, 1, 2, 0, 1, (GtkAttachOptions) ( GTK_FILL ), (GtkAttachOptions) ( 0 ), 0, 0 ); gtk_entry_set_editable( GTK_ENTRY( GTK_COMBO( combo )->entry ), FALSE ); + gtk_widget_show( combo ); AddDialogData( combo, &m_nLightRadiuses, DLG_COMBO_INT ); #ifdef _WIN32 check = gtk_check_button_new_with_label( _( "Use win32 file associations to open text files instead of builtin editor" ) ); - gtk_widget_show( check ); gtk_box_pack_start( GTK_BOX( vbox ), check, FALSE, FALSE, 0 ); + gtk_widget_show( check ); AddDialogData( check, &g_PrefsDlg.m_bUseWin32Editor, DLG_CHECK_BOOL ); #else // use custom shader editor check = gtk_check_button_new_with_label( _( "Use Custom Shader Editor" ) ); - gtk_widget_show( check ); gtk_box_pack_start( GTK_BOX( vbox ), check, FALSE, FALSE, 0 ); + gtk_widget_show( check ); g_signal_connect( G_OBJECT( check ), "clicked", G_CALLBACK( UpdateEditorSensitivity ), this ); g_object_set_data( G_OBJECT( dialog ), "check_customeditor", check ); AddDialogData( check, &g_PrefsDlg.m_bUseCustomEditor, DLG_CHECK_BOOL ); @@ -2660,41 +2671,41 @@ void PrefsDlg::BuildDialog(){ // custom shader editor executable // table table = gtk_table_new( 3, 1, FALSE ); - gtk_widget_show( table ); gtk_box_pack_start( GTK_BOX( vbox ), table, FALSE, TRUE, 0 ); gtk_table_set_row_spacings( GTK_TABLE( table ), 5 ); gtk_table_set_col_spacings( GTK_TABLE( table ), 5 ); + gtk_widget_show( table ); // label label = gtk_label_new( _( "Custom Editor Command" ) ); - gtk_widget_show( label ); + g_object_set( label, "xalign", 0.0, NULL ); gtk_table_attach( GTK_TABLE( table ), label, 0, 1, 0, 1, (GtkAttachOptions) ( 0 ), (GtkAttachOptions) ( 0 ), 0, 0 ); gtk_misc_set_alignment( GTK_MISC( label ), 1, 0.5 ); g_object_set_data( G_OBJECT( dialog ), "label_customeditor", label ); gtk_widget_set_sensitive( label, g_PrefsDlg.m_bUseCustomEditor ); + gtk_widget_show( label ); // custom editor command entry entry = gtk_entry_new(); - gtk_widget_show( entry ); - gtk_widget_set_usize( GTK_WIDGET( entry ), 240, -2 ); gtk_table_attach( GTK_TABLE( table ), entry, 1, 2, 0, 1, (GtkAttachOptions) ( GTK_FILL ), (GtkAttachOptions) ( 0 ), 1, 0 ); AddDialogData( entry, &m_strEditorCommand, DLG_ENTRY_TEXT ); gtk_widget_set_sensitive( entry, g_PrefsDlg.m_bUseCustomEditor ); g_object_set_data( G_OBJECT( dialog ), "entry_customeditor", entry ); + gtk_widget_show( entry ); // browse button button = gtk_button_new_with_label( _( "..." ) ); - gtk_widget_show( button ); g_signal_connect( G_OBJECT( button ), "clicked", G_CALLBACK( OnBtnBrowseEditor ), this ); gtk_table_attach( GTK_TABLE( table ), button, 2, 3, 0, 1, (GtkAttachOptions) ( 0 ), (GtkAttachOptions) ( 0 ), 0, 0 ); g_object_set_data( G_OBJECT( dialog ), "button_customeditor", button ); gtk_widget_set_sensitive( button, g_PrefsDlg.m_bUseCustomEditor ); + gtk_widget_show( button ); #endif // Add the page to the notebook @@ -2708,52 +2719,52 @@ void PrefsDlg::BuildDialog(){ gtk_container_set_border_width( GTK_CONTAINER( pageframe ), 5 ); gtk_widget_show( pageframe ); vbox = gtk_vbox_new( FALSE, 5 ); - gtk_widget_show( vbox ); gtk_container_set_border_width( GTK_CONTAINER( vbox ), 5 ); gtk_container_add( GTK_CONTAINER( pageframe ), vbox ); + gtk_widget_show( vbox ); // Enable BSP process monitoring check = gtk_check_button_new_with_label( _( "Enable BSP process monitoring" ) ); - gtk_widget_show( check ); gtk_box_pack_start( GTK_BOX( vbox ), check, FALSE, FALSE, 0 ); + gtk_widget_show( check ); g_object_set_data( G_OBJECT( dialog ), "check_monitorbsp", check ); g_signal_connect( G_OBJECT( check ), "clicked", G_CALLBACK( UpdateSensitivity ), this ); AddDialogData( check, &g_PrefsDlg.m_bWatchBSP, DLG_CHECK_BOOL ); // Stop on leak check = gtk_check_button_new_with_label( _( "Stop compilation on leak" ) ); - gtk_widget_show( check ); gtk_box_pack_start( GTK_BOX( vbox ), check, FALSE, FALSE, 0 ); + gtk_widget_show( check ); g_object_set_data( G_OBJECT( dialog ), "check_leakstop", check ); AddDialogData( check, &g_PrefsDlg.m_bLeakStop, DLG_CHECK_BOOL ); // engine after compile check = gtk_check_button_new_with_label( _( "Run engine after compile" ) ); - gtk_widget_show( check ); gtk_box_pack_start( GTK_BOX( vbox ), check, FALSE, FALSE, 0 ); + gtk_widget_show( check ); g_object_set_data( G_OBJECT( dialog ), "check_runengine", check ); g_signal_connect( G_OBJECT( check ), "clicked", G_CALLBACK( UpdateSensitivity ), this ); AddDialogData( check, &g_PrefsDlg.m_bRunQuake, DLG_CHECK_BOOL ); // sleep mode when running engine check = gtk_check_button_new_with_label( _( "Activate sleep mode when running the engine" ) ); - gtk_widget_show( check ); gtk_box_pack_start( GTK_BOX( vbox ), check, FALSE, FALSE, 0 ); + gtk_widget_show( check ); g_object_set_data( G_OBJECT( dialog ), "check_sleep", check ); AddDialogData( check, &g_PrefsDlg.m_bDoSleep, DLG_CHECK_BOOL ); // use q3map2's texture projection check = gtk_check_button_new_with_label( _( "Texturing compatible with q3map2" ) ); - gtk_widget_show( check ); gtk_box_pack_start( GTK_BOX( vbox ), check, FALSE, FALSE, 0 ); + gtk_widget_show( check ); g_object_set_data( G_OBJECT( dialog ), "check_q3map2", check ); AddDialogData( check, &g_PrefsDlg.m_bQ3Map2Texturing, DLG_CHECK_BOOL ); #ifdef _WIN32 // use 64 bit q3map2 check = gtk_check_button_new_with_label( _( "Use 64 bit q3map2" ) ); - gtk_widget_show( check ); gtk_box_pack_start( GTK_BOX( vbox ), check, FALSE, FALSE, 0 ); + gtk_widget_show( check ); g_object_set_data( G_OBJECT( dialog ), "check_x64_q3map2", check ); AddDialogData( check, &g_PrefsDlg.m_bx64q3map2, DLG_CHECK_BOOL ); g_signal_connect( G_OBJECT( check ), "toggled", G_CALLBACK( OnX64Toggle ), this ); diff --git a/radiant/surfacedialog.cpp b/radiant/surfacedialog.cpp index 136e8584..b71dcb90 100644 --- a/radiant/surfacedialog.cpp +++ b/radiant/surfacedialog.cpp @@ -503,12 +503,14 @@ void SurfaceDlg::InitDefaultIncrement( texdef_t *tex ){ void SurfaceDlg::BuildDialog() { GtkWidget *dlg, *vbox, *hbox2, *frame, *table, *label; GtkWidget *button, *entry, *spin; + GtkWidget *axial_button, *cap_button, *set_button, *nat_button, *fit_button; + GtkSizeGroup *button_group; dlg = m_pWidget; load_window_pos( dlg, g_PrefsDlg.mWindowInfo.posSurfaceWnd ); - gtk_window_set_title( GTK_WINDOW( dlg ), _( "Surface inspector" ) ); + gtk_window_set_title( GTK_WINDOW( dlg ), _( "Surface Inspector" ) ); //g_signal_connect (G_OBJECT (dlg), "delete-event", G_CALLBACK (OnCancel), NULL); // we catch 'Enter' and interpret is as OnDone g_signal_connect( G_OBJECT( dlg ), "key-press-event", G_CALLBACK( OnDialogKey ), NULL ); @@ -516,350 +518,347 @@ void SurfaceDlg::BuildDialog() { // replaced by only the vbox: vbox = gtk_vbox_new( FALSE, 5 ); - gtk_widget_show( vbox ); gtk_container_add( GTK_CONTAINER( dlg ), vbox ); gtk_container_set_border_width( GTK_CONTAINER( vbox ), 5 ); + gtk_widget_show( vbox ); hbox2 = gtk_hbox_new( FALSE, 5 ); - gtk_widget_show( hbox2 ); gtk_box_pack_start( GTK_BOX( vbox ), hbox2, FALSE, TRUE, 0 ); + gtk_widget_show( hbox2 ); label = gtk_label_new( _( "Texture" ) ); - gtk_widget_show( label ); gtk_box_pack_start( GTK_BOX( hbox2 ), label, FALSE, TRUE, 0 ); + gtk_widget_show( label ); entry = gtk_entry_new(); g_signal_connect( G_OBJECT( entry ), "key-press-event", G_CALLBACK( OnTextureKey ), NULL ); - gtk_widget_show( entry ); gtk_box_pack_start( GTK_BOX( hbox2 ), entry, TRUE, TRUE, 0 ); + gtk_widget_show( entry ); g_object_set_data( G_OBJECT( m_pWidget ), "texture", entry ); // table = gtk_table_new (5, 4, FALSE); table = gtk_table_new( 6, 4, FALSE ); - gtk_widget_show( table ); gtk_box_pack_start( GTK_BOX( vbox ), table, FALSE, TRUE, 0 ); gtk_table_set_row_spacings( GTK_TABLE( table ), 5 ); gtk_table_set_col_spacings( GTK_TABLE( table ), 5 ); + gtk_widget_show( table ); label = gtk_label_new( _( "Horizontal shift" ) ); - gtk_widget_show( label ); gtk_misc_set_alignment( GTK_MISC( label ), 0, 0 ); gtk_table_attach( GTK_TABLE( table ), label, 0, 1, 0, 1, (GtkAttachOptions) ( GTK_FILL ), (GtkAttachOptions) ( 0 ), 0, 0 ); + gtk_widget_show( label ); spin = gtk_spin_button_new( GTK_ADJUSTMENT( gtk_adjustment_new( 0, -8192, 8192, 2, 8, 0 ) ), 0, 0 ); g_object_set_data( G_OBJECT( dlg ), "hshift", spin ); g_signal_connect( G_OBJECT( gtk_spin_button_get_adjustment( GTK_SPIN_BUTTON( spin ) ) ), "value-changed", G_CALLBACK( OnUpdate ), NULL ); - gtk_widget_show( spin ); gtk_table_attach( GTK_TABLE( table ), spin, 1, 2, 0, 1, (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), (GtkAttachOptions) ( 0 ), 0, 0 ); - gtk_widget_set_usize( spin, 60, -2 ); + gtk_spin_button_set_numeric( GTK_SPIN_BUTTON( spin ), TRUE ); + gtk_widget_show( spin ); label = gtk_label_new( _( "Step" ) ); - gtk_widget_show( label ); gtk_misc_set_alignment( GTK_MISC( label ), 0, 0 ); gtk_table_attach( GTK_TABLE( table ), label, 2, 3, 0, 1, (GtkAttachOptions) ( GTK_FILL ), (GtkAttachOptions) ( 0 ), 0, 0 ); + gtk_widget_show( label ); entry = gtk_entry_new(); g_object_set_data( G_OBJECT( dlg ), "hshift_inc", entry ); g_signal_connect( G_OBJECT( entry ), "changed", G_CALLBACK( OnIncrementChanged ), NULL ); - gtk_widget_show( entry ); gtk_table_attach( GTK_TABLE( table ), entry, 3, 4, 0, 1, (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), (GtkAttachOptions) ( 0 ), 0, 0 ); - gtk_widget_set_usize( entry, 50, -2 ); + gtk_widget_show( entry ); label = gtk_label_new( _( "Vertical shift" ) ); - gtk_widget_show( label ); gtk_misc_set_alignment( GTK_MISC( label ), 0, 0 ); gtk_table_attach( GTK_TABLE( table ), label, 0, 1, 1, 2, (GtkAttachOptions) ( GTK_FILL ), (GtkAttachOptions) ( 0 ), 0, 0 ); + gtk_widget_show( label ); spin = gtk_spin_button_new( GTK_ADJUSTMENT( gtk_adjustment_new( 0, -8192, 8192, 2, 8, 0 ) ), 0, 0 ); g_object_set_data( G_OBJECT( dlg ), "vshift", spin ); g_signal_connect( G_OBJECT( gtk_spin_button_get_adjustment( GTK_SPIN_BUTTON( spin ) ) ), "value-changed", G_CALLBACK( OnUpdate ), NULL ); - gtk_widget_show( spin ); gtk_table_attach( GTK_TABLE( table ), spin, 1, 2, 1, 2, (GtkAttachOptions) ( GTK_FILL ), (GtkAttachOptions) ( 0 ), 0, 0 ); - gtk_widget_set_usize( spin, 60, -2 ); + gtk_spin_button_set_numeric( GTK_SPIN_BUTTON( spin ), TRUE ); + gtk_widget_show( spin ); label = gtk_label_new( _( "Step" ) ); - gtk_widget_show( label ); gtk_misc_set_alignment( GTK_MISC( label ), 0, 0 ); gtk_table_attach( GTK_TABLE( table ), label, 2, 3, 1, 2, (GtkAttachOptions) ( GTK_FILL ), (GtkAttachOptions) ( 0 ), 0, 0 ); + gtk_widget_show( label ); entry = gtk_entry_new(); g_object_set_data( G_OBJECT( dlg ), "vshift_inc", entry ); g_signal_connect( G_OBJECT( entry ), "changed", G_CALLBACK( OnIncrementChanged ), NULL ); - gtk_widget_show( entry ); gtk_table_attach( GTK_TABLE( table ), entry, 3, 4, 1, 2, (GtkAttachOptions) ( GTK_FILL ), (GtkAttachOptions) ( 0 ), 0, 0 ); - gtk_widget_set_usize( entry, 50, -2 ); + gtk_widget_show( entry ); label = gtk_label_new( _( "Horizontal stretch" ) ); - gtk_widget_show( label ); gtk_misc_set_alignment( GTK_MISC( label ), 0, 0 ); gtk_table_attach( GTK_TABLE( table ), label, 0, 1, 2, 3, (GtkAttachOptions) ( GTK_FILL ), (GtkAttachOptions) ( 0 ), 0, 0 ); + gtk_widget_show( label ); spin = gtk_spin_button_new( GTK_ADJUSTMENT( gtk_adjustment_new( 0, -1000, 1000, 1, 10, 0 ) ), 0, 0 ); g_object_set_data( G_OBJECT( dlg ), "hscale", spin ); g_signal_connect( G_OBJECT( gtk_spin_button_get_adjustment( GTK_SPIN_BUTTON( spin ) ) ), "value-changed", G_CALLBACK( OnUpdate ), NULL ); - gtk_widget_show( spin ); gtk_table_attach( GTK_TABLE( table ), spin, 1, 2, 2, 3, (GtkAttachOptions) ( GTK_FILL ), (GtkAttachOptions) ( 0 ), 0, 0 ); - gtk_widget_set_usize( spin, 60, -2 ); + gtk_spin_button_set_numeric( GTK_SPIN_BUTTON( spin ), TRUE ); + gtk_widget_show( spin ); label = gtk_label_new( _( "Step" ) ); - gtk_widget_show( label ); gtk_misc_set_alignment( GTK_MISC( label ), 0, 0 ); gtk_table_attach( GTK_TABLE( table ), label, 2, 3, 2, 3, (GtkAttachOptions) ( GTK_FILL ), (GtkAttachOptions) ( 0 ), 2, 3 ); + gtk_widget_show( label ); entry = gtk_entry_new(); g_object_set_data( G_OBJECT( dlg ), "hscale_inc", entry ); g_signal_connect( G_OBJECT( entry ), "changed", G_CALLBACK( OnIncrementChanged ), NULL ); - gtk_widget_show( entry ); gtk_table_attach( GTK_TABLE( table ), entry, 3, 4, 2, 3, (GtkAttachOptions) ( GTK_FILL ), (GtkAttachOptions) ( 0 ), 2, 3 ); - gtk_widget_set_usize( entry, 50, -2 ); + gtk_widget_show( entry ); label = gtk_label_new( _( "Vertical stretch" ) ); - gtk_widget_show( label ); gtk_misc_set_alignment( GTK_MISC( label ), 0, 0 ); gtk_table_attach( GTK_TABLE( table ), label, 0, 1, 3, 4, (GtkAttachOptions) ( GTK_FILL ), (GtkAttachOptions) ( 0 ), 0, 0 ); + gtk_widget_show( label ); spin = gtk_spin_button_new( GTK_ADJUSTMENT( gtk_adjustment_new( 0, -1000, 1000, 1, 10, 0 ) ), 0, 0 ); g_object_set_data( G_OBJECT( dlg ), "vscale", spin ); g_signal_connect( G_OBJECT( gtk_spin_button_get_adjustment( GTK_SPIN_BUTTON( spin ) ) ), "value-changed", G_CALLBACK( OnUpdate ), NULL ); - gtk_widget_show( spin ); gtk_table_attach( GTK_TABLE( table ), spin, 1, 2, 3, 4, (GtkAttachOptions) ( GTK_FILL ), (GtkAttachOptions) ( 0 ), 0, 0 ); - gtk_widget_set_usize( spin, 60, -2 ); + gtk_spin_button_set_numeric( GTK_SPIN_BUTTON( spin ), TRUE ); + gtk_widget_show( spin ); label = gtk_label_new( _( "Step" ) ); - gtk_widget_show( label ); gtk_misc_set_alignment( GTK_MISC( label ), 0, 0 ); gtk_table_attach( GTK_TABLE( table ), label, 2, 3, 3, 4, (GtkAttachOptions) ( GTK_FILL ), (GtkAttachOptions) ( 0 ), 0, 0 ); + gtk_widget_show( label ); entry = gtk_entry_new(); g_object_set_data( G_OBJECT( dlg ), "vscale_inc", entry ); g_signal_connect( G_OBJECT( entry ), "changed", G_CALLBACK( OnIncrementChanged ), NULL ); - gtk_widget_show( entry ); gtk_table_attach( GTK_TABLE( table ), entry, 3, 4, 3, 4, (GtkAttachOptions) ( GTK_FILL ), (GtkAttachOptions) ( 0 ), 0, 0 ); - gtk_widget_set_usize( entry, 50, -2 ); + gtk_widget_show( entry ); label = gtk_label_new( _( "Rotate" ) ); - gtk_widget_show( label ); gtk_misc_set_alignment( GTK_MISC( label ), 0, 0 ); gtk_table_attach( GTK_TABLE( table ), label, 0, 1, 4, 5, (GtkAttachOptions) ( GTK_FILL ), (GtkAttachOptions) ( 0 ), 0, 0 ); + gtk_widget_show( label ); spin = gtk_spin_button_new( GTK_ADJUSTMENT( gtk_adjustment_new( 0, -360, 360, 1, 10, 0 ) ), 1, 0 ); + gtk_spin_button_set_wrap( GTK_SPIN_BUTTON( spin ), TRUE ); g_object_set_data( G_OBJECT( dlg ), "rotate", spin ); g_signal_connect( G_OBJECT( gtk_spin_button_get_adjustment( GTK_SPIN_BUTTON( spin ) ) ), "value-changed", G_CALLBACK( OnUpdate ), NULL ); - gtk_widget_show( spin ); gtk_table_attach( GTK_TABLE( table ), spin, 1, 2, 4, 5, (GtkAttachOptions) ( GTK_FILL ), (GtkAttachOptions) ( 0 ), 0, 0 ); - gtk_widget_set_usize( spin, 60, -2 ); - gtk_spin_button_set_wrap( GTK_SPIN_BUTTON( spin ), TRUE ); + gtk_spin_button_set_numeric( GTK_SPIN_BUTTON( spin ), TRUE ); + gtk_widget_show( spin ); label = gtk_label_new( _( "Step" ) ); - gtk_widget_show( label ); gtk_misc_set_alignment( GTK_MISC( label ), 0, 0 ); gtk_table_attach( GTK_TABLE( table ), label, 2, 3, 4, 5, (GtkAttachOptions) ( GTK_FILL ), (GtkAttachOptions) ( 0 ), 0, 0 ); + gtk_widget_show( label ); entry = gtk_entry_new(); g_object_set_data( G_OBJECT( dlg ), "rotate_inc", entry ); g_signal_connect( G_OBJECT( entry ), "changed", G_CALLBACK( OnIncrementChanged ), NULL ); - gtk_widget_show( entry ); gtk_table_attach( GTK_TABLE( table ), entry, 3, 4, 4, 5, (GtkAttachOptions) ( GTK_FILL ), (GtkAttachOptions) ( 0 ), 0, 0 ); - gtk_widget_set_usize( entry, 50, -2 ); + gtk_widget_show( entry ); // match grid button button = gtk_button_new_with_label( _( "Match Grid" ) ); - gtk_widget_show( button ); gtk_table_attach( GTK_TABLE( table ), button, 2, 4, 5, 6, (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), (GtkAttachOptions) ( 0 ), 0, 0 ); + gtk_widget_show( button ); g_signal_connect( G_OBJECT( button ), "clicked", G_CALLBACK( OnBtnMatchGrid ), NULL ); frame = gtk_frame_new( _( "Texturing" ) ); - gtk_widget_show( frame ); gtk_box_pack_start( GTK_BOX( vbox ), frame, FALSE, TRUE, 0 ); + gtk_widget_show( frame ); table = gtk_table_new( 4, 4, FALSE ); - gtk_widget_show( table ); gtk_container_add( GTK_CONTAINER( frame ), table ); gtk_table_set_row_spacings( GTK_TABLE( table ), 5 ); gtk_table_set_col_spacings( GTK_TABLE( table ), 5 ); gtk_container_set_border_width( GTK_CONTAINER( table ), 5 ); + gtk_widget_show( table ); label = gtk_label_new( _( "Brush" ) ); - gtk_widget_show( label ); gtk_table_attach( GTK_TABLE( table ), label, 0, 1, 0, 1, (GtkAttachOptions) ( GTK_FILL ), (GtkAttachOptions) ( 0 ), 0, 0 ); + gtk_widget_show( label ); label = gtk_label_new( _( "Patch" ) ); - gtk_widget_show( label ); gtk_table_attach( GTK_TABLE( table ), label, 0, 1, 2, 3, (GtkAttachOptions) ( GTK_FILL ), (GtkAttachOptions) ( 0 ), 0, 0 ); + gtk_widget_show( label ); label = gtk_label_new( _( "Width" ) ); - gtk_widget_show( label ); gtk_table_attach( GTK_TABLE( table ), label, 2, 3, 0, 1, (GtkAttachOptions) ( GTK_FILL ), (GtkAttachOptions) ( 0 ), 0, 0 ); + gtk_widget_show( label ); label = gtk_label_new( _( "Height" ) ); - gtk_widget_show( label ); gtk_table_attach( GTK_TABLE( table ), label, 3, 4, 0, 1, (GtkAttachOptions) ( GTK_FILL ), (GtkAttachOptions) ( 0 ), 0, 0 ); + gtk_widget_show( label ); - button = gtk_button_new_with_label( _( "Axial" ) ); - gtk_widget_show( button ); + axial_button = button = gtk_button_new_with_label( _( "Axial" ) ); gtk_table_attach( GTK_TABLE( table ), button, 0, 1, 1, 2, (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), (GtkAttachOptions) ( 0 ), 0, 0 ); + gtk_widget_show( button ); g_signal_connect( G_OBJECT( button ), "clicked", G_CALLBACK( OnBtnAxial ), NULL ); - gtk_widget_set_usize( button, 60, -2 ); - button = gtk_button_new_with_label( _( "Fit" ) ); - gtk_widget_show( button ); + fit_button = button = gtk_button_new_with_label( _( "Fit" ) ); gtk_table_attach( GTK_TABLE( table ), button, 1, 2, 1, 2, (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), (GtkAttachOptions) ( 0 ), 0, 0 ); + gtk_widget_show( button ); g_signal_connect( G_OBJECT( button ), "clicked", G_CALLBACK( OnBtnFaceFit ), NULL ); - gtk_widget_set_usize( button, 60, -2 ); - button = gtk_button_new_with_label( _( "CAP" ) ); - gtk_widget_show( button ); + button_group = gtk_size_group_new( GTK_SIZE_GROUP_BOTH ); + gtk_size_group_add_widget( button_group, axial_button ); + gtk_size_group_add_widget( button_group, fit_button ); + g_object_unref( button_group ); + + cap_button = button = gtk_button_new_with_label( _( "CAP" ) ); gtk_table_attach( GTK_TABLE( table ), button, 0, 1, 3, 4, (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), (GtkAttachOptions) ( 0 ), 0, 0 ); + gtk_widget_show( button ); g_signal_connect( G_OBJECT( button ), "clicked", G_CALLBACK( OnBtnPatchdetails ), NULL ); - gtk_widget_set_usize( button, 60, -2 ); - button = gtk_button_new_with_label( _( "Set..." ) ); - gtk_widget_show( button ); + set_button = button = gtk_button_new_with_label( _( "Set..." ) ); gtk_table_attach( GTK_TABLE( table ), button, 1, 2, 3, 4, (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), (GtkAttachOptions) ( 0 ), 0, 0 ); + gtk_widget_show( button ); g_signal_connect( G_OBJECT( button ), "clicked", G_CALLBACK( OnBtnPatchreset ), NULL ); - gtk_widget_set_usize( button, 60, -2 ); - button = gtk_button_new_with_label( _( "Natural" ) ); - gtk_widget_show( button ); + nat_button = button = gtk_button_new_with_label( _( "Natural" ) ); gtk_table_attach( GTK_TABLE( table ), button, 2, 3, 3, 4, (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), (GtkAttachOptions) ( 0 ), 0, 0 ); + gtk_widget_show( button ); g_signal_connect( G_OBJECT( button ), "clicked", G_CALLBACK( OnBtnPatchnatural ), NULL ); - gtk_widget_set_usize( button, 60, -2 ); - button = gtk_button_new_with_label( _( "Fit" ) ); - gtk_widget_show( button ); + fit_button = button = gtk_button_new_with_label( _( "Fit" ) ); gtk_table_attach( GTK_TABLE( table ), button, 3, 4, 3, 4, (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), (GtkAttachOptions) ( 0 ), 0, 0 ); + gtk_widget_show( button ); g_signal_connect( G_OBJECT( button ), "clicked", G_CALLBACK( OnBtnPatchFit ), NULL ); - gtk_widget_set_usize( button, 60, -2 ); + + button_group = gtk_size_group_new( GTK_SIZE_GROUP_BOTH ); + gtk_size_group_add_widget( button_group, cap_button ); + gtk_size_group_add_widget( button_group, set_button ); + gtk_size_group_add_widget( button_group, nat_button ); + gtk_size_group_add_widget( button_group, fit_button ); + g_object_unref( button_group ); spin = gtk_spin_button_new( GTK_ADJUSTMENT( gtk_adjustment_new( 1, 1, 32, 1, 10, 0 ) ), 1, 0 ); - gtk_widget_show( spin ); gtk_table_attach( GTK_TABLE( table ), spin, 2, 3, 1, 2, (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), (GtkAttachOptions) ( 0 ), 0, 0 ); - gtk_widget_set_usize( spin, 60, -2 ); + gtk_spin_button_set_numeric( GTK_SPIN_BUTTON( spin ), TRUE ); + gtk_widget_show( spin ); AddDialogData( spin, &m_nWidth, DLG_SPIN_INT ); spin = gtk_spin_button_new( GTK_ADJUSTMENT( gtk_adjustment_new( 1, 1, 32, 1, 10, 0 ) ), 1, 0 ); - gtk_widget_show( spin ); gtk_table_attach( GTK_TABLE( table ), spin, 3, 4, 1, 2, (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), (GtkAttachOptions) ( 0 ), 0, 0 ); - gtk_widget_set_usize( spin, 60, -2 ); + gtk_spin_button_set_numeric( GTK_SPIN_BUTTON( spin ), TRUE ); + gtk_widget_show( spin ); AddDialogData( spin, &m_nHeight, DLG_SPIN_INT ); hbox2 = gtk_hbox_new( FALSE, 5 ); - gtk_widget_show( hbox2 ); gtk_box_pack_start( GTK_BOX( vbox ), hbox2, FALSE, TRUE, 0 ); + gtk_widget_show( hbox2 ); button = gtk_button_new_with_label( _( "Done" ) ); - gtk_widget_show( button ); gtk_box_pack_start( GTK_BOX( hbox2 ), button, FALSE, FALSE, 0 ); + gtk_widget_show( button ); g_signal_connect( G_OBJECT( button ), "clicked", G_CALLBACK( OnDone ), NULL ); - gtk_widget_set_usize( button, 60, -2 ); button = gtk_button_new_with_label( _( "Apply" ) ); - gtk_widget_show( button ); gtk_box_pack_start( GTK_BOX( hbox2 ), button, FALSE, FALSE, 0 ); + gtk_widget_show( button ); g_signal_connect( G_OBJECT( button ), "clicked", G_CALLBACK( OnApply ), NULL ); - gtk_widget_set_usize( button, 60, -2 ); button = gtk_button_new_with_label( _( "Cancel" ) ); - gtk_widget_show( button ); gtk_box_pack_start( GTK_BOX( hbox2 ), button, FALSE, FALSE, 0 ); + gtk_widget_show( button ); g_signal_connect( G_OBJECT( button ), "clicked", G_CALLBACK( OnCancel ), NULL ); - gtk_widget_set_usize( button, 60, -2 ); // that's a bit of trashy stuff from Textool-v2 branch #ifdef _DEBUG // FIXME: testing only, scaling in BP mode button = gtk_button_new_with_label( _( "Test" ) ); - gtk_widget_show( button ); gtk_box_pack_start( GTK_BOX( hbox2 ), button, FALSE, FALSE, 0 ); + gtk_widget_show( button ); g_signal_connect( G_OBJECT( button ), "clicked", G_CALLBACK( OnTest ), NULL ); - gtk_widget_set_usize( button, 60, -2 ); #endif // Initialize