Merge pull request #441 from Pan7/dlgi

Dialog improvements
This commit is contained in:
Timothee "TTimo" Besset 2017-03-26 11:21:47 -05:00 committed by GitHub
commit 16453c6ac2
28 changed files with 2435 additions and 2994 deletions

View file

@ -43,7 +43,7 @@
static GtkWidget *pDialogWnd; static GtkWidget *pDialogWnd;
static GtkWidget *pNotebook; static GtkWidget *pNotebook;
static GtkTooltips *pTooltips;
class CBackgroundDialogPage class CBackgroundDialogPage
{ {
@ -223,7 +223,7 @@ CBackgroundDialogPage::CBackgroundDialogPage( VIEWTYPE vt ){
g_signal_connect( G_OBJECT( w ), "clicked", G_CALLBACK( browse_callback ), g_signal_connect( G_OBJECT( w ), "clicked", G_CALLBACK( browse_callback ),
( gpointer ) this ); ( gpointer ) this );
gtk_box_pack_start( GTK_BOX( hbox ),w, FALSE, FALSE, 5 ); 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 ); gtk_widget_show( w );
w = gtk_button_new_with_label( _( "Reload" ) ); w = gtk_button_new_with_label( _( "Reload" ) );
@ -231,7 +231,7 @@ CBackgroundDialogPage::CBackgroundDialogPage( VIEWTYPE vt ){
( gpointer ) this ); ( gpointer ) this );
// TODO disable until we have file // TODO disable until we have file
// gtk_widget_set_sensitive(w,FALSE); // 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_box_pack_start( GTK_BOX( hbox ),w, FALSE, FALSE, 5 );
gtk_widget_show( w ); gtk_widget_show( w );
@ -256,7 +256,7 @@ CBackgroundDialogPage::CBackgroundDialogPage( VIEWTYPE vt ){
g_signal_connect( G_OBJECT( w ), "value-changed", g_signal_connect( G_OBJECT( w ), "value-changed",
G_CALLBACK( alpha_adjust_callback ), ( gpointer ) this ); G_CALLBACK( alpha_adjust_callback ), ( gpointer ) this );
gtk_box_pack_start( GTK_BOX( hbox ),w, TRUE, TRUE, 5 ); 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( w );
gtk_widget_show( hbox ); gtk_widget_show( hbox );
@ -274,7 +274,7 @@ CBackgroundDialogPage::CBackgroundDialogPage( VIEWTYPE vt ){
gtk_box_pack_start( GTK_BOX( hbox ),w, TRUE, FALSE, 5 ); gtk_box_pack_start( GTK_BOX( hbox ),w, TRUE, FALSE, 5 );
g_signal_connect( G_OBJECT( w ), "clicked", G_CALLBACK( size_sel_callback ), g_signal_connect( G_OBJECT( w ), "clicked", G_CALLBACK( size_sel_callback ),
( gpointer ) this ); ( 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 ); gtk_widget_show( w );
if ( m_vt == XY ) { if ( m_vt == XY ) {
@ -282,7 +282,7 @@ CBackgroundDialogPage::CBackgroundDialogPage( VIEWTYPE vt ){
gtk_box_pack_start( GTK_BOX( hbox ),w, TRUE, FALSE, 2 ); gtk_box_pack_start( GTK_BOX( hbox ),w, TRUE, FALSE, 2 );
g_signal_connect( G_OBJECT( w ), "clicked", G_CALLBACK( size_mm_callback ), g_signal_connect( G_OBJECT( w ), "clicked", G_CALLBACK( size_mm_callback ),
( gpointer ) this ); ( 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 ); gtk_widget_show( w );
} }
@ -317,13 +317,13 @@ static gint close_callback( GtkWidget *widget, gpointer data ){
void InitBackgroundDialog(){ void InitBackgroundDialog(){
CBackgroundDialogPage *pPage; CBackgroundDialogPage *pPage;
GtkWidget *content_area, *vbox;
GtkDialogFlags flags = GTK_DIALOG_DESTROY_WITH_PARENT;
pDialogWnd = gtk_dialog_new_with_buttons( _( "Background Images" ), pDialogWnd = gtk_dialog_new_with_buttons( _( "Background Images" ),
GTK_WINDOW( g_pMainWidget ), GTK_WINDOW( g_pMainWidget ),
(GtkDialogFlags)( GTK_DIALOG_DESTROY_WITH_PARENT ), flags,
// TODO dialog with no buttons // TODO dialog with no buttons
// GTK_STOCK_CLOSE,
// GTK_RESPONSE_CLOSE,
NULL ); NULL );
g_signal_connect( G_OBJECT( pDialogWnd ), "delete-event", g_signal_connect( G_OBJECT( pDialogWnd ), "delete-event",
G_CALLBACK( close_callback ), NULL ); G_CALLBACK( close_callback ), NULL );
@ -331,7 +331,8 @@ void InitBackgroundDialog(){
G_CALLBACK( response_callback ), NULL ); G_CALLBACK( response_callback ), NULL );
// g_signal_connect( G_OBJECT (pDialogWnd), "expose-event", G_CALLBACK( ci_expose ), 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(); pNotebook = gtk_notebook_new();
pPage = new CBackgroundDialogPage( XY ); pPage = new CBackgroundDialogPage( XY );
@ -341,11 +342,13 @@ void InitBackgroundDialog(){
pPage = new CBackgroundDialogPage( YZ ); pPage = new CBackgroundDialogPage( YZ );
pPage->Append( pNotebook ); 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_show( pNotebook );
gtk_widget_realize( pDialogWnd );
} }
void ShowBackgroundDialog(){ void ShowBackgroundDialog(){

View file

@ -67,7 +67,7 @@ _QEREntityTable g_EntityTable;
_QERAppDataTable g_DataTable; _QERAppDataTable g_DataTable;
// for the file load dialog // for the file load dialog
void *g_pMainWidget; void *g_pMainWidget = NULL;
// ============================================================================= // =============================================================================
// plugin implementation // 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 ){ extern "C" void QERPlug_Dispatch( const char *p, vec3_t vMin, vec3_t vMax, bool bSingleBrush ){
Sys_Printf( MSG_PREFIX "Command \"%s\"\n",p ); Sys_Printf( MSG_PREFIX "Command \"%s\"\n",p );
if ( !strcmp( p, CMD_ABOUT ) ) { 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 ) ) { else if ( !strcmp( p,CMD_CONFIG ) ) {
ShowBackgroundDialog(); ShowBackgroundDialog();

View file

@ -104,7 +104,7 @@ extern "C" void QERPlug_Dispatch( const char *p, vec3_t vMin, vec3_t vMax, bool
DoVisAnalyse(); DoVisAnalyse();
} }
else if ( !stricmp( p, "about..." ) ) { else if ( !stricmp( p, "about..." ) ) {
DoMessageBox( PLUGIN_ABOUT, "About", IDOK ); DoMessageBox( PLUGIN_ABOUT, "About", MB_OK );
} }
} }

View file

@ -44,6 +44,8 @@ typedef struct {
dlg_texReset_t dlgTexReset; dlg_texReset_t dlgTexReset;
extern void *g_pRadiantWnd;
void Update_TextureReseter(); void Update_TextureReseter();
static void dialog_button_callback_texreset_update( GtkWidget *widget, gpointer data ){ 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 ){ int DoMessageBox( const char* lpText, const char* lpCaption, guint32 uType ){
GtkWidget *window, *w, *vbox, *hbox; GtkWidget *dialog, *w, *vbox, *hbox, *content_area;
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 ); dialog = gtk_dialog_new_with_buttons( lpCaption, NULL, flags, NULL );
g_signal_connect( G_OBJECT( window ), "delete-event", gtk_window_set_transient_for( GTK_WINDOW( dialog ), GTK_WINDOW( g_pRadiantWnd ) );
G_CALLBACK( dialog_delete_callback ), NULL ); gtk_window_set_position( GTK_WINDOW( dialog ), GTK_WIN_POS_CENTER_ON_PARENT );
g_signal_connect( G_OBJECT( window ), "destroy", gtk_container_set_border_width( GTK_CONTAINER( dialog ), 10 );
G_CALLBACK( gtk_widget_destroy ), NULL );
gtk_window_set_title( GTK_WINDOW( window ), lpCaption ); content_area = gtk_dialog_get_content_area( GTK_DIALOG( dialog ) );
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 ); 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 ); gtk_widget_show( vbox );
w = gtk_label_new( lpText ); 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_box_pack_start( GTK_BOX( vbox ), hbox, FALSE, FALSE, 2 );
gtk_widget_show( hbox ); gtk_widget_show( hbox );
mode = ( uType & MB_TYPEMASK );
if ( mode == MB_OK ) { if ( mode == MB_OK ) {
w = gtk_button_new_with_label( _( "Ok" ) ); w = gtk_dialog_add_button( GTK_DIALOG( dialog ), _( "OK" ), GTK_RESPONSE_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; ret = IDOK;
} }
else if ( mode == MB_OKCANCEL ) { else if ( mode == MB_OKCANCEL ) {
w = gtk_button_new_with_label( _( "Ok" ) ); w = gtk_dialog_add_button( GTK_DIALOG( dialog ), _( "OK" ), GTK_RESPONSE_OK );
gtk_box_pack_start( GTK_BOX( hbox ), w, TRUE, TRUE, 0 ); w = gtk_dialog_add_button( GTK_DIALOG( dialog ), _( "Cancel" ), GTK_RESPONSE_CANCEL );
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; ret = IDCANCEL;
} }
else if ( mode == MB_YESNOCANCEL ) { else if ( mode == MB_YESNOCANCEL ) {
w = gtk_button_new_with_label( _( "Yes" ) ); w = gtk_dialog_add_button( GTK_DIALOG( dialog ), _( "Yes" ), GTK_RESPONSE_YES );
gtk_box_pack_start( GTK_BOX( hbox ), w, TRUE, TRUE, 0 ); w = gtk_dialog_add_button( GTK_DIALOG( dialog ), _( "No" ), GTK_RESPONSE_NO );
g_signal_connect( G_OBJECT( w ), "clicked", w = gtk_dialog_add_button( GTK_DIALOG( dialog ), _( "Cancel" ), GTK_RESPONSE_CANCEL );
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; ret = IDCANCEL;
} }
else /* if (mode == MB_YESNO) */ else /* if (mode == MB_YESNO) */
{ {
w = gtk_button_new_with_label( _( "Yes" ) ); w = gtk_dialog_add_button( GTK_DIALOG( dialog ), _( "Yes" ), GTK_RESPONSE_YES );
gtk_box_pack_start( GTK_BOX( hbox ), w, TRUE, TRUE, 0 ); w = gtk_dialog_add_button( GTK_DIALOG( dialog ), _( "No" ), GTK_RESPONSE_NO );
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; ret = IDNO;
} }
gtk_window_set_position( GTK_WINDOW( window ),GTK_WIN_POS_CENTER );
gtk_widget_show( window );
gtk_grab_add( window );
while ( loop ) response_id = gtk_dialog_run( GTK_DIALOG( dialog ) );
gtk_main_iteration();
gtk_grab_remove( window ); switch( response_id )
gtk_widget_destroy( window ); {
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; return ret;
} }
@ -326,6 +294,8 @@ int DoIntersectBox( IntersectRS* rs ){
gtk_window_set_title( GTK_WINDOW( window ), _( "Intersect" ) ); gtk_window_set_title( GTK_WINDOW( window ), _( "Intersect" ) );
gtk_container_set_border_width( GTK_CONTAINER( window ), 10 ); 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 ), "loop", &loop );
g_object_set_data( G_OBJECT( window ), "ret", &ret ); g_object_set_data( G_OBJECT( window ), "ret", &ret );
@ -384,7 +354,6 @@ int DoIntersectBox( IntersectRS* rs ){
// ---- /vbox ---- // ---- /vbox ----
gtk_window_set_position( GTK_WINDOW( window ),GTK_WIN_POS_CENTER );
gtk_widget_show( window ); gtk_widget_show( window );
gtk_grab_add( window ); gtk_grab_add( window );
@ -408,30 +377,28 @@ int DoIntersectBox( IntersectRS* rs ){
} }
int DoPolygonBox( PolygonRS* 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 *check1, *check2, *check3;
GtkWidget *text1, *text2; 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 ); gtk_dialog_add_button( GTK_DIALOG( dialog ), _( "OK" ), GTK_RESPONSE_OK );
gtk_dialog_add_button( GTK_DIALOG( dialog ), _( "Cancel" ), GTK_RESPONSE_CANCEL );
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 );
content_area = gtk_dialog_get_content_area( GTK_DIALOG( dialog ) );
vbox = gtk_vbox_new( FALSE, 10 ); 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 ); gtk_widget_show( vbox );
// ---- vbox ---- // ---- vbox ----
@ -456,13 +423,14 @@ int DoPolygonBox( PolygonRS* rs ){
// ---- hbox2 ---- // ---- hbox2 ----
text1 = gtk_entry_new(); 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_max_length( GTK_ENTRY( text1 ), 256 );
gtk_entry_set_text( GTK_ENTRY( text1 ), "3" ); gtk_entry_set_text( GTK_ENTRY( text1 ), "3" );
gtk_box_pack_start( GTK_BOX( hbox2 ), text1, FALSE, FALSE, 2 ); gtk_box_pack_start( GTK_BOX( hbox2 ), text1, FALSE, FALSE, 2 );
gtk_widget_show( text1 ); 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_box_pack_start( GTK_BOX( hbox2 ), w, FALSE, FALSE, 2 );
gtk_label_set_justify( GTK_LABEL( w ), GTK_JUSTIFY_LEFT ); gtk_label_set_justify( GTK_LABEL( w ), GTK_JUSTIFY_LEFT );
gtk_widget_show( w ); gtk_widget_show( w );
@ -476,13 +444,14 @@ int DoPolygonBox( PolygonRS* rs ){
// ---- hbox2 ---- // ---- hbox2 ----
text2 = gtk_entry_new(); 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_max_length( GTK_ENTRY( text2 ), 256 );
gtk_entry_set_text( GTK_ENTRY( text2 ), "8" ); gtk_entry_set_text( GTK_ENTRY( text2 ), "8" );
gtk_box_pack_start( GTK_BOX( hbox2 ), text2, FALSE, FALSE, 2 ); gtk_box_pack_start( GTK_BOX( hbox2 ), text2, FALSE, FALSE, 2 );
gtk_widget_show( text2 ); 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_box_pack_start( GTK_BOX( hbox2 ), w, FALSE, FALSE, 2 );
gtk_label_set_justify( GTK_LABEL( w ), GTK_JUSTIFY_LEFT ); gtk_label_set_justify( GTK_LABEL( w ), GTK_JUSTIFY_LEFT );
gtk_widget_show( w ); gtk_widget_show( w );
@ -491,6 +460,10 @@ int DoPolygonBox( PolygonRS* rs ){
// ---- /vbox2 ---- // ---- /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 ); vbox2 = gtk_vbox_new( FALSE, 10 );
@ -517,44 +490,17 @@ int DoPolygonBox( PolygonRS* rs ){
// ---- /hbox ---- // ---- /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 ---- // ---- /vbox ----
gtk_window_set_position( GTK_WINDOW( window ),GTK_WIN_POS_CENTER );
gtk_widget_show( window );
gtk_grab_add( window );
bool dialogError = TRUE; bool dialogError = TRUE;
while ( dialogError ) while ( dialogError )
{ {
loop = 1; response_id = gtk_dialog_run( GTK_DIALOG( dialog ) );
while ( loop )
gtk_main_iteration();
dialogError = FALSE; dialogError = FALSE;
if ( ret == IDOK ) { if ( response_id == GTK_RESPONSE_OK ) {
rs->bUseBorder = gtk_toggle_button_get_active( (GtkToggleButton*)check1 ) ? true : false; rs->bUseBorder = gtk_toggle_button_get_active( (GtkToggleButton*)check1 ) ? true : false;
rs->bInverse = gtk_toggle_button_get_active( (GtkToggleButton*)check2 ) ? true : false; rs->bInverse = gtk_toggle_button_get_active( (GtkToggleButton*)check2 ) ? true : false;
rs->bAlignTop = gtk_toggle_button_get_active( (GtkToggleButton*)check3 ) ? 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 ); if( response_id == GTK_RESPONSE_OK ) {
gtk_widget_destroy( window ); ret = IDOK;
} else {
ret = IDCANCEL;
}
gtk_widget_destroy( dialog );
return ret; return ret;
} }
@ -600,8 +551,9 @@ int DoBuildStairsBox( BuildStairsRS* rs ){
g_signal_connect( G_OBJECT( window ), "destroy", G_CALLBACK( gtk_widget_destroy ), NULL ); g_signal_connect( G_OBJECT( window ), "destroy", G_CALLBACK( gtk_widget_destroy ), NULL );
gtk_window_set_title( GTK_WINDOW( window ), _( "Stair Builder" ) ); gtk_window_set_title( GTK_WINDOW( window ), _( "Stair Builder" ) );
gtk_container_set_border_width( GTK_CONTAINER( window ), 10 ); 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 ), "loop", &loop );
g_object_set_data( G_OBJECT( window ), "ret", &ret ); g_object_set_data( G_OBJECT( window ), "ret", &ret );
@ -784,7 +736,6 @@ int DoBuildStairsBox( BuildStairsRS* rs ){
ret = IDCANCEL; ret = IDCANCEL;
// +djbob: need our "little" modal loop mars :P // +djbob: need our "little" modal loop mars :P
gtk_window_set_position( GTK_WINDOW( window ),GTK_WIN_POS_CENTER );
gtk_widget_show( window ); gtk_widget_show( window );
gtk_grab_add( 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 ); g_signal_connect( G_OBJECT( window ), "destroy", G_CALLBACK( gtk_widget_destroy ), NULL );
gtk_window_set_title( GTK_WINDOW( window ), _( "Door Builder" ) ); gtk_window_set_title( GTK_WINDOW( window ), _( "Door Builder" ) );
gtk_container_set_border_width( GTK_CONTAINER( window ), 10 ); 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 ), "loop", &loop );
g_object_set_data( G_OBJECT( window ), "ret", &ret ); g_object_set_data( G_OBJECT( window ), "ret", &ret );
@ -1033,7 +985,6 @@ int DoDoorsBox( DoorRS* rs ){
// ----------------- // // ----------------- //
//+djbob //+djbob
gtk_window_set_position( GTK_WINDOW( window ),GTK_WIN_POS_CENTER );
gtk_widget_show( window ); gtk_widget_show( window );
gtk_grab_add( window ); gtk_grab_add( window );
@ -1077,6 +1028,8 @@ int DoPathPlotterBox( PathPlotterRS* rs ){
gtk_window_set_title( GTK_WINDOW( window ), _( "Texture Reset" ) ); gtk_window_set_title( GTK_WINDOW( window ), _( "Texture Reset" ) );
gtk_container_set_border_width( GTK_CONTAINER( window ), 10 ); 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 ), "loop", &loop );
g_object_set_data( G_OBJECT( window ), "ret", &ret ); 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_widget_show( window );
gtk_grab_add( window ); gtk_grab_add( window );
@ -1250,6 +1202,8 @@ int DoCTFColourChangeBox(){
gtk_window_set_title( GTK_WINDOW( window ), _( "CTF Colour Changer" ) ); gtk_window_set_title( GTK_WINDOW( window ), _( "CTF Colour Changer" ) );
gtk_container_set_border_width( GTK_CONTAINER( window ), 10 ); 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 ), "loop", &loop );
g_object_set_data( G_OBJECT( window ), "ret", &ret ); g_object_set_data( G_OBJECT( window ), "ret", &ret );
@ -1293,7 +1247,6 @@ int DoCTFColourChangeBox(){
// ---- /vbox ---- // ---- /vbox ----
gtk_window_set_position( GTK_WINDOW( window ),GTK_WIN_POS_CENTER );
gtk_widget_show( window ); gtk_widget_show( window );
gtk_grab_add( window ); gtk_grab_add( window );
@ -1308,26 +1261,28 @@ int DoCTFColourChangeBox(){
int DoResetTextureBox( ResetTextureRS* rs ){ int DoResetTextureBox( ResetTextureRS* rs ){
Str texSelected; 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 ); content_area = gtk_dialog_get_content_area( GTK_DIALOG( dialog ) );
g_signal_connect( G_OBJECT( window ), "destroy", G_CALLBACK( gtk_widget_destroy ), NULL );
gtk_window_set_title( GTK_WINDOW( window ), _( "Texture Reset" ) ); vbox = gtk_vbox_new( TRUE, 5 );
gtk_container_set_border_width( GTK_CONTAINER( window ), 10 ); gtk_container_add( GTK_CONTAINER( content_area ), vbox );
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 ); gtk_widget_show( vbox );
// ---- vbox ---- // ---- vbox ----
@ -1355,22 +1310,23 @@ int DoResetTextureBox( ResetTextureRS* rs ){
gtk_box_pack_start( GTK_BOX( vbox ), frame, FALSE, TRUE, 0 ); gtk_box_pack_start( GTK_BOX( vbox ), frame, FALSE, TRUE, 0 );
table = gtk_table_new( 2, 3, TRUE ); table = gtk_table_new( 2, 3, TRUE );
gtk_widget_show( table );
gtk_container_add( GTK_CONTAINER( frame ), table ); gtk_container_add( GTK_CONTAINER( frame ), table );
gtk_table_set_row_spacings( GTK_TABLE( table ), 5 ); gtk_table_set_row_spacings( GTK_TABLE( table ), 5 );
gtk_table_set_col_spacings( GTK_TABLE( table ), 5 ); gtk_table_set_col_spacings( GTK_TABLE( table ), 5 );
gtk_container_set_border_width( GTK_CONTAINER( table ), 5 ); gtk_container_set_border_width( GTK_CONTAINER( table ), 5 );
gtk_widget_show( table );
// ---- frame ---- // ---- frame ----
dlgTexReset.cbTexChange = gtk_check_button_new_with_label( _( "Enabled" ) ); 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 ); 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, gtk_table_attach( GTK_TABLE( table ), dlgTexReset.cbTexChange, 0, 1, 0, 1,
(GtkAttachOptions) ( GTK_FILL ), (GtkAttachOptions) ( GTK_FILL ),
(GtkAttachOptions) ( 0 ), 0, 0 ); (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, gtk_table_attach( GTK_TABLE( table ), w, 1, 2, 0, 1,
(GtkAttachOptions) ( GTK_FILL ), (GtkAttachOptions) ( GTK_FILL ),
(GtkAttachOptions) ( 0 ), 0, 0 ); (GtkAttachOptions) ( 0 ), 0, 0 );
@ -1384,7 +1340,7 @@ int DoResetTextureBox( ResetTextureRS* rs ){
(GtkAttachOptions) ( 0 ), 0, 0 ); (GtkAttachOptions) ( 0 ), 0, 0 );
gtk_widget_show( dlgTexReset.editTexOld ); 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, gtk_table_attach( GTK_TABLE( table ), w, 1, 2, 1, 2,
(GtkAttachOptions) ( GTK_FILL ), (GtkAttachOptions) ( GTK_FILL ),
(GtkAttachOptions) ( 0 ), 0, 0 ); (GtkAttachOptions) ( 0 ), 0, 0 );
@ -1401,26 +1357,27 @@ int DoResetTextureBox( ResetTextureRS* rs ){
// ---- /frame ---- // ---- /frame ----
frame = gtk_frame_new( _( "Reset Scales" ) ); frame = gtk_frame_new( _( "Reset Scales" ) );
gtk_widget_show( frame );
gtk_box_pack_start( GTK_BOX( vbox ), frame, FALSE, TRUE, 0 ); gtk_box_pack_start( GTK_BOX( vbox ), frame, FALSE, TRUE, 0 );
gtk_widget_show( frame );
table = gtk_table_new( 2, 3, TRUE ); table = gtk_table_new( 2, 3, TRUE );
gtk_widget_show( table );
gtk_container_add( GTK_CONTAINER( frame ), table ); gtk_container_add( GTK_CONTAINER( frame ), table );
gtk_table_set_row_spacings( GTK_TABLE( table ), 5 ); gtk_table_set_row_spacings( GTK_TABLE( table ), 5 );
gtk_table_set_col_spacings( GTK_TABLE( table ), 5 ); gtk_table_set_col_spacings( GTK_TABLE( table ), 5 );
gtk_container_set_border_width( GTK_CONTAINER( table ), 5 ); gtk_container_set_border_width( GTK_CONTAINER( table ), 5 );
gtk_widget_show( table );
// ---- frame ---- // ---- frame ----
dlgTexReset.cbScaleHor = gtk_check_button_new_with_label( _( "Enabled" ) ); 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 ); 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, gtk_table_attach( GTK_TABLE( table ), dlgTexReset.cbScaleHor, 0, 1, 0, 1,
(GtkAttachOptions) ( GTK_FILL ), (GtkAttachOptions) ( GTK_FILL ),
(GtkAttachOptions) ( 0 ), 0, 0 ); (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, gtk_table_attach( GTK_TABLE( table ), w, 1, 2, 0, 1,
(GtkAttachOptions) ( GTK_FILL ), (GtkAttachOptions) ( GTK_FILL ),
(GtkAttachOptions) ( 0 ), 0, 0 ); (GtkAttachOptions) ( 0 ), 0, 0 );
@ -1437,12 +1394,12 @@ int DoResetTextureBox( ResetTextureRS* rs ){
dlgTexReset.cbScaleVert = gtk_check_button_new_with_label( _( "Enabled" ) ); 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 ); 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, gtk_table_attach( GTK_TABLE( table ), dlgTexReset.cbScaleVert, 0, 1, 1, 2,
(GtkAttachOptions) ( GTK_FILL ), (GtkAttachOptions) ( GTK_FILL ),
(GtkAttachOptions) ( 0 ), 0, 0 ); (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, gtk_table_attach( GTK_TABLE( table ), w, 1, 2, 1, 2,
(GtkAttachOptions) ( GTK_FILL ), (GtkAttachOptions) ( GTK_FILL ),
(GtkAttachOptions) ( 0 ), 0, 0 ); (GtkAttachOptions) ( 0 ), 0, 0 );
@ -1459,26 +1416,27 @@ int DoResetTextureBox( ResetTextureRS* rs ){
// ---- /frame ---- // ---- /frame ----
frame = gtk_frame_new( _( "Reset Shift" ) ); frame = gtk_frame_new( _( "Reset Shift" ) );
gtk_widget_show( frame );
gtk_box_pack_start( GTK_BOX( vbox ), frame, FALSE, TRUE, 0 ); gtk_box_pack_start( GTK_BOX( vbox ), frame, FALSE, TRUE, 0 );
gtk_widget_show( frame );
table = gtk_table_new( 2, 3, TRUE ); table = gtk_table_new( 2, 3, TRUE );
gtk_widget_show( table );
gtk_container_add( GTK_CONTAINER( frame ), table ); gtk_container_add( GTK_CONTAINER( frame ), table );
gtk_table_set_row_spacings( GTK_TABLE( table ), 5 ); gtk_table_set_row_spacings( GTK_TABLE( table ), 5 );
gtk_table_set_col_spacings( GTK_TABLE( table ), 5 ); gtk_table_set_col_spacings( GTK_TABLE( table ), 5 );
gtk_container_set_border_width( GTK_CONTAINER( table ), 5 ); gtk_container_set_border_width( GTK_CONTAINER( table ), 5 );
gtk_widget_show( table );
// ---- frame ---- // ---- frame ----
dlgTexReset.cbShiftHor = gtk_check_button_new_with_label( _( "Enabled" ) ); 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 ); 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, gtk_table_attach( GTK_TABLE( table ), dlgTexReset.cbShiftHor, 0, 1, 0, 1,
(GtkAttachOptions) ( GTK_FILL ), (GtkAttachOptions) ( GTK_FILL ),
(GtkAttachOptions) ( 0 ), 0, 0 ); (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, gtk_table_attach( GTK_TABLE( table ), w, 1, 2, 0, 1,
(GtkAttachOptions) ( GTK_FILL ), (GtkAttachOptions) ( GTK_FILL ),
(GtkAttachOptions) ( 0 ), 0, 0 ); (GtkAttachOptions) ( 0 ), 0, 0 );
@ -1495,12 +1453,12 @@ int DoResetTextureBox( ResetTextureRS* rs ){
dlgTexReset.cbShiftVert = gtk_check_button_new_with_label( _( "Enabled" ) ); 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 ); 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, gtk_table_attach( GTK_TABLE( table ), dlgTexReset.cbShiftVert, 0, 1, 1, 2,
(GtkAttachOptions) ( GTK_FILL ), (GtkAttachOptions) ( GTK_FILL ),
(GtkAttachOptions) ( 0 ), 0, 0 ); (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, gtk_table_attach( GTK_TABLE( table ), w, 1, 2, 1, 2,
(GtkAttachOptions) ( GTK_FILL ), (GtkAttachOptions) ( GTK_FILL ),
(GtkAttachOptions) ( 0 ), 0, 0 ); (GtkAttachOptions) ( 0 ), 0, 0 );
@ -1517,25 +1475,25 @@ int DoResetTextureBox( ResetTextureRS* rs ){
// ---- /frame ---- // ---- /frame ----
frame = gtk_frame_new( _( "Reset Rotation" ) ); frame = gtk_frame_new( _( "Reset Rotation" ) );
gtk_widget_show( frame );
gtk_box_pack_start( GTK_BOX( vbox ), frame, FALSE, TRUE, 0 ); gtk_box_pack_start( GTK_BOX( vbox ), frame, FALSE, TRUE, 0 );
gtk_widget_show( frame );
table = gtk_table_new( 1, 3, TRUE ); table = gtk_table_new( 1, 3, TRUE );
gtk_widget_show( table );
gtk_container_add( GTK_CONTAINER( frame ), table ); gtk_container_add( GTK_CONTAINER( frame ), table );
gtk_table_set_row_spacings( GTK_TABLE( table ), 5 ); gtk_table_set_row_spacings( GTK_TABLE( table ), 5 );
gtk_table_set_col_spacings( GTK_TABLE( table ), 5 ); gtk_table_set_col_spacings( GTK_TABLE( table ), 5 );
gtk_container_set_border_width( GTK_CONTAINER( table ), 5 ); gtk_container_set_border_width( GTK_CONTAINER( table ), 5 );
gtk_widget_show( table );
// ---- frame ---- // ---- frame ----
dlgTexReset.cbRotation = gtk_check_button_new_with_label( _( "Enabled" ) ); 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, gtk_table_attach( GTK_TABLE( table ), dlgTexReset.cbRotation, 0, 1, 0, 1,
(GtkAttachOptions) ( GTK_FILL ), (GtkAttachOptions) ( GTK_FILL ),
(GtkAttachOptions) ( 0 ), 0, 0 ); (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, gtk_table_attach( GTK_TABLE( table ), w, 1, 2, 0, 1,
(GtkAttachOptions) ( GTK_FILL ), (GtkAttachOptions) ( GTK_FILL ),
(GtkAttachOptions) ( 0 ), 0, 0 ); (GtkAttachOptions) ( 0 ), 0, 0 );
@ -1551,51 +1509,40 @@ int DoResetTextureBox( ResetTextureRS* rs ){
// ---- /frame ---- // ---- /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 ---- // ---- /vbox ----
gtk_window_set_position( GTK_WINDOW( window ),GTK_WIN_POS_CENTER ); label_group = gtk_size_group_new( GTK_SIZE_GROUP_HORIZONTAL );
gtk_widget_show( window ); gtk_size_group_add_widget( label_group, new_label );
gtk_grab_add( window ); 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(); Update_TextureReseter();
ret = IDCANCEL;
bool dialogError = TRUE; bool dialogError = TRUE;
while ( dialogError ) while ( dialogError )
{ {
loop = 1; response_id = gtk_dialog_run( GTK_DIALOG( dialog ) );
while ( loop )
gtk_main_iteration();
dialogError = FALSE; dialogError = FALSE;
if ( ret != IDCANCEL ) { if ( response_id != GTK_RESPONSE_CANCEL ) {
rs->bResetRotation = gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( dlgTexReset.cbRotation ) ); rs->bResetRotation = gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( dlgTexReset.cbRotation ) );
if ( rs->bResetRotation ) { if ( rs->bResetRotation ) {
if ( !ValidateTextInt( gtk_entry_get_text( GTK_ENTRY( dlgTexReset.editRotation ) ), _( "Rotation" ), &rs->rotation ) ) { 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 ); switch( response_id ) {
gtk_widget_destroy( window ); 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; return ret;
} }
@ -1664,6 +1622,8 @@ int DoTrainThingBox( TrainThingRS* rs ){
gtk_window_set_title( GTK_WINDOW( window ), _( "Train Thing" ) ); gtk_window_set_title( GTK_WINDOW( window ), _( "Train Thing" ) );
gtk_container_set_border_width( GTK_CONTAINER( window ), 10 ); 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 ), "loop", &loop );
g_object_set_data( G_OBJECT( window ), "ret", &ret ); g_object_set_data( G_OBJECT( window ), "ret", &ret );
@ -1683,8 +1643,8 @@ int DoTrainThingBox( TrainThingRS* rs ){
// ---- /hbox ---- // ---- /hbox ----
frame = gtk_frame_new( _( "Radii" ) ); frame = gtk_frame_new( _( "Radii" ) );
gtk_widget_show( frame );
gtk_box_pack_start( GTK_BOX( vbox ), frame, FALSE, TRUE, 0 ); gtk_box_pack_start( GTK_BOX( vbox ), frame, FALSE, TRUE, 0 );
gtk_widget_show( frame );
table = gtk_table_new( 2, 3, TRUE ); table = gtk_table_new( 2, 3, TRUE );
gtk_widget_show( table ); gtk_widget_show( table );
@ -1732,11 +1692,11 @@ int DoTrainThingBox( TrainThingRS* rs ){
gtk_box_pack_start( GTK_BOX( vbox ), frame, FALSE, TRUE, 0 ); gtk_box_pack_start( GTK_BOX( vbox ), frame, FALSE, TRUE, 0 );
table = gtk_table_new( 2, 3, TRUE ); table = gtk_table_new( 2, 3, TRUE );
gtk_widget_show( table );
gtk_container_add( GTK_CONTAINER( frame ), table ); gtk_container_add( GTK_CONTAINER( frame ), table );
gtk_table_set_row_spacings( GTK_TABLE( table ), 5 ); gtk_table_set_row_spacings( GTK_TABLE( table ), 5 );
gtk_table_set_col_spacings( GTK_TABLE( table ), 5 ); gtk_table_set_col_spacings( GTK_TABLE( table ), 5 );
gtk_container_set_border_width( GTK_CONTAINER( table ), 5 ); gtk_container_set_border_width( GTK_CONTAINER( table ), 5 );
gtk_widget_show( table );
// ---- frame ---- // ---- frame ----
@ -1772,15 +1732,15 @@ int DoTrainThingBox( TrainThingRS* rs ){
frame = gtk_frame_new( _( "Height" ) ); frame = gtk_frame_new( _( "Height" ) );
gtk_widget_show( frame );
gtk_box_pack_start( GTK_BOX( vbox ), frame, FALSE, TRUE, 0 ); gtk_box_pack_start( GTK_BOX( vbox ), frame, FALSE, TRUE, 0 );
gtk_widget_show( frame );
table = gtk_table_new( 2, 3, TRUE ); table = gtk_table_new( 2, 3, TRUE );
gtk_widget_show( table );
gtk_container_add( GTK_CONTAINER( frame ), table ); gtk_container_add( GTK_CONTAINER( frame ), table );
gtk_table_set_row_spacings( GTK_TABLE( table ), 5 ); gtk_table_set_row_spacings( GTK_TABLE( table ), 5 );
gtk_table_set_col_spacings( GTK_TABLE( table ), 5 ); gtk_table_set_col_spacings( GTK_TABLE( table ), 5 );
gtk_container_set_border_width( GTK_CONTAINER( table ), 5 ); gtk_container_set_border_width( GTK_CONTAINER( table ), 5 );
gtk_widget_show( table );
// ---- frame ---- // ---- frame ----
@ -1817,15 +1777,15 @@ int DoTrainThingBox( TrainThingRS* rs ){
frame = gtk_frame_new( _( "Points" ) ); frame = gtk_frame_new( _( "Points" ) );
gtk_widget_show( frame );
gtk_box_pack_start( GTK_BOX( vbox ), frame, FALSE, TRUE, 0 ); gtk_box_pack_start( GTK_BOX( vbox ), frame, FALSE, TRUE, 0 );
gtk_widget_show( frame );
table = gtk_table_new( 2, 3, TRUE ); table = gtk_table_new( 2, 3, TRUE );
gtk_widget_show( table );
gtk_container_add( GTK_CONTAINER( frame ), table ); gtk_container_add( GTK_CONTAINER( frame ), table );
gtk_table_set_row_spacings( GTK_TABLE( table ), 5 ); gtk_table_set_row_spacings( GTK_TABLE( table ), 5 );
gtk_table_set_col_spacings( GTK_TABLE( table ), 5 ); gtk_table_set_col_spacings( GTK_TABLE( table ), 5 );
gtk_container_set_border_width( GTK_CONTAINER( table ), 5 ); gtk_container_set_border_width( GTK_CONTAINER( table ), 5 );
gtk_widget_show( table );
// ---- frame ---- // ---- 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_widget_show( window );
gtk_grab_add( window ); gtk_grab_add( window );

View file

@ -64,27 +64,26 @@ static gint ci_editmode_add( GtkWidget *widget, gpointer data ){
}*/ }*/
static gint ci_new( GtkWidget *widget, gpointer data ){ static gint ci_new( GtkWidget *widget, gpointer data ){
GtkWidget *window, *w, *vbox, *vbox2, *hbox, *frame; //, *name; GtkWidget *dialog, *w, *vbox, *vbox2, *hbox, *frame; //, *name;
GtkWidget *fixed, *interpolated, *spline; GtkWidget *fixed, *interpolated, *spline, *content_area;
int ret, loop = 1;
GSList *targetTypeRadio = NULL; GSList *targetTypeRadio = NULL;
// char buf[128]; // char buf[128];
gint response_id;
GtkDialogFlags flags = GTK_DIALOG_DESTROY_WITH_PARENT;
// create the window // create the window
window = gtk_window_new( GTK_WINDOW_TOPLEVEL ); dialog = gtk_dialog_new_with_buttons( _( "New Camera" ), NULL, flags, NULL );
gtk_window_set_title( GTK_WINDOW( window ), _( "New Camera" ) ); gtk_dialog_add_button( GTK_DIALOG( dialog ), _( "OK" ), GTK_RESPONSE_OK );
g_signal_connect( G_OBJECT( window ), "delete-event", G_CALLBACK( dialog_delete_callback ), NULL ); gtk_dialog_add_button( GTK_DIALOG( dialog ), _( "Cancel" ), GTK_RESPONSE_CANCEL );
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 ) );
g_object_set_data( G_OBJECT( window ), "loop", &loop ); gtk_window_set_transient_for( GTK_WINDOW( dialog ), GTK_WINDOW( g_pCameraInspectorWnd ) );
g_object_set_data( G_OBJECT( window ), "ret", &ret ); 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 // fill the window
vbox = gtk_vbox_new( FALSE, 5 ); 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 ); gtk_widget_show( vbox );
// -------------------------- // // -------------------------- //
@ -127,53 +126,22 @@ static gint ci_new( GtkWidget *widget, gpointer data ){
// -------------------------- // // -------------------------- //
hbox = gtk_hbox_new( FALSE, 5 ); response_id = gtk_dialog_run( GTK_DIALOG( dialog ) );
gtk_box_pack_start( GTK_BOX( vbox ), hbox, FALSE, FALSE, 0 );
gtk_widget_show( hbox );
w = gtk_button_new_with_label( _( "Ok" ) ); if ( response_id == GTK_RESPONSE_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 ); if ( gtk_toggle_button_get_active( (GtkToggleButton*)fixed ) ) {
gtk_widget_grab_default( w ); DoNewFixedCamera();
}
w = gtk_button_new_with_label( _( "Cancel" ) ); else if ( gtk_toggle_button_get_active( (GtkToggleButton*)interpolated ) ) {
gtk_box_pack_start( GTK_BOX( hbox ), w, TRUE, TRUE, 0 ); DoNewInterpolatedCamera();
g_signal_connect( G_OBJECT( w ), "clicked", G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( IDCANCEL ) ); }
gtk_widget_show( w ); else if ( gtk_toggle_button_get_active( (GtkToggleButton*)spline ) ) {
ret = IDCANCEL; DoNewSplineCamera();
// -------------------------- //
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();
}
} }
} }
gtk_grab_remove( window ); gtk_widget_destroy( dialog );
gtk_widget_destroy( window );
return TRUE; return TRUE;
} }
@ -245,11 +213,11 @@ static gint ci_preview( GtkWidget *widget, gpointer data ){
return TRUE; return TRUE;
} }
static gint ci_expose( GtkWidget *widget, gpointer data ){ static void ci_show( GtkWidget *widget, gpointer data ){
// start edit mode // start edit mode
DoStartEdit( GetCurrentCam() ); DoStartEdit( GetCurrentCam() );
return FALSE; return;
} }
static gint ci_close( GtkWidget *widget, gpointer data ){ static gint ci_close( GtkWidget *widget, gpointer data ){
@ -355,28 +323,25 @@ static void RefreshEventList( void ){
} }
static gint ci_rename( GtkWidget *widget, gpointer data ){ static gint ci_rename( GtkWidget *widget, gpointer data ){
GtkWidget *window, *w, *vbox, *hbox, *name; GtkWidget *dialog, *w, *vbox, *hbox, *name, *content_area;
int ret, loop = 1; gint response_id;
GtkDialogFlags flags = GTK_DIALOG_DESTROY_WITH_PARENT;
if ( !GetCurrentCam() ) { if ( !GetCurrentCam() ) {
return TRUE; return TRUE;
} }
// create the window dialog = gtk_dialog_new_with_buttons( _( "Rename Path" ), NULL, flags, NULL );
window = gtk_window_new( GTK_WINDOW_TOPLEVEL ); gtk_window_set_transient_for( GTK_WINDOW( dialog ), GTK_WINDOW( g_pCameraInspectorWnd ) );
gtk_window_set_title( GTK_WINDOW( window ), _( "Rename Path" ) ); gtk_window_set_position( GTK_WINDOW( dialog ), GTK_WIN_POS_CENTER_ON_PARENT );
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 ) );
g_object_set_data( G_OBJECT( window ), "loop", &loop ); gtk_dialog_add_button( GTK_DIALOG( dialog ), _( "OK" ), GTK_RESPONSE_OK );
g_object_set_data( G_OBJECT( window ), "ret", &ret ); 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 ); 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 ); 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; bool dialogError = TRUE;
while ( dialogError ) { while ( dialogError )
loop = 1; {
while ( loop ) response_id = gtk_dialog_run( GTK_DIALOG( dialog ) );
gtk_main_iteration();
dialogError = FALSE; dialogError = FALSE;
if ( ret == IDOK ) { if( response_id == GTK_RESPONSE_OK ) {
const char *str = gtk_entry_get_text( GTK_ENTRY( name ) ); const char *str = gtk_entry_get_text( GTK_ENTRY( name ) );
if ( str && str[0] ) { if ( str && str[0] ) {
@ -463,38 +404,35 @@ static gint ci_rename( GtkWidget *widget, gpointer data ){
} }
} }
gtk_grab_remove( window ); gtk_widget_destroy( dialog );
gtk_widget_destroy( window );
return TRUE; return TRUE;
} }
static gint ci_add_target( GtkWidget *widget, gpointer data ){ static gint ci_add_target( GtkWidget *widget, gpointer data ){
GtkWidget *window, *w, *vbox, *vbox2, *hbox, *frame, *name; GtkWidget *dialog, *w, *vbox, *vbox2, *hbox, *frame, *name;
GtkWidget *fixed, *interpolated, *spline; GtkWidget *fixed, *interpolated, *spline, *content_area;
int ret, loop = 1;
GSList *targetTypeRadio = NULL; GSList *targetTypeRadio = NULL;
char buf[128]; char buf[128];
gint response_id;
GtkDialogFlags flags = GTK_DIALOG_DESTROY_WITH_PARENT;
if ( !GetCurrentCam() ) { if ( !GetCurrentCam() ) {
return TRUE; return TRUE;
} }
// create the window dialog = gtk_dialog_new_with_buttons( _( "Add Target" ), NULL, flags, NULL );
window = gtk_window_new( GTK_WINDOW_TOPLEVEL ); gtk_window_set_transient_for( GTK_WINDOW( dialog ), GTK_WINDOW( g_pCameraInspectorWnd ) );
gtk_window_set_title( GTK_WINDOW( window ), _( "Add Target" ) ); gtk_window_set_position( GTK_WINDOW( dialog ),GTK_WIN_POS_CENTER );
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 ) );
g_object_set_data( G_OBJECT( window ), "loop", &loop ); gtk_dialog_add_button( GTK_DIALOG( dialog ), _( "OK" ), GTK_RESPONSE_OK );
g_object_set_data( G_OBJECT( window ), "ret", &ret ); 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 ); 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 ); 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; bool dialogError = TRUE;
while ( dialogError ) { while ( dialogError )
loop = 1; {
while ( loop ) response_id = gtk_dialog_run( GTK_DIALOG( dialog ) );
gtk_main_iteration();
dialogError = FALSE; dialogError = FALSE;
if ( ret == IDOK ) { if( response_id == GTK_RESPONSE_OK ) {
const char *str = gtk_entry_get_text( GTK_ENTRY( name ) ); const char *str = gtk_entry_get_text( GTK_ENTRY( name ) );
if ( str && str[0] ) { if ( str && str[0] ) {
@ -628,8 +543,7 @@ static gint ci_add_target( GtkWidget *widget, gpointer data ){
} }
} }
gtk_grab_remove( window ); gtk_widget_destroy( dialog );
gtk_widget_destroy( window );
return TRUE; return TRUE;
} }
@ -817,31 +731,30 @@ const char *camEventStr[] = {
}; };
static gint ci_add( GtkWidget *widget, gpointer data ){ static gint ci_add( GtkWidget *widget, gpointer data ){
GtkWidget *window, *w, *vbox, *vbox2, *hbox, *frame, *parameters; GtkWidget *dialog, *w, *vbox, *vbox2, *hbox, *frame, *parameters;
GtkWidget *eventWidget[EVENT_COUNT]; GtkWidget *eventWidget[EVENT_COUNT], *content_area;
int i, ret, loop = 1; int i;
GSList *eventTypeRadio = NULL; GSList *eventTypeRadio = NULL;
// char buf[128]; // char buf[128];
gint response_id;
GtkDialogFlags flags = GTK_DIALOG_DESTROY_WITH_PARENT;
if ( !GetCurrentCam() ) { if ( !GetCurrentCam() ) {
return TRUE; return TRUE;
} }
// create the window dialog = gtk_dialog_new_with_buttons( _( "Add Event" ), NULL, flags, NULL );
window = gtk_window_new( GTK_WINDOW_TOPLEVEL ); gtk_window_set_transient_for( GTK_WINDOW( dialog ), GTK_WINDOW( g_pCameraInspectorWnd ) );
gtk_window_set_title( GTK_WINDOW( window ), _( "Add Event" ) ); gtk_window_set_position( GTK_WINDOW( dialog ), GTK_WIN_POS_CENTER_ON_PARENT );
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 ) );
g_object_set_data( G_OBJECT( window ), "loop", &loop ); gtk_dialog_add_button( GTK_DIALOG( dialog ), _( "OK" ), GTK_RESPONSE_OK );
g_object_set_data( G_OBJECT( window ), "ret", &ret ); 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 // fill the window
vbox = gtk_vbox_new( FALSE, 5 ); 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 ); 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; bool dialogError = TRUE;
while ( dialogError ) { while ( dialogError )
loop = 1; {
while ( loop ) response_id = gtk_dialog_run( GTK_DIALOG( dialog ) );
gtk_main_iteration();
dialogError = FALSE; dialogError = FALSE;
if ( ret == IDOK ) { if( response_id == GTK_RESPONSE_OK ) {
const char *str = gtk_entry_get_text( GTK_ENTRY( parameters ) ); const char *str = gtk_entry_get_text( GTK_ENTRY( parameters ) );
if ( !camEventFlags[i][0] || ( str && str[0] ) ) { 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( dialog );
gtk_widget_destroy( window );
return TRUE; return TRUE;
} }
@ -991,39 +880,36 @@ static gint ci_timeline_changed( GtkAdjustment *adjustment ){
} }
GtkWidget *CreateCameraInspectorDialog( void ){ 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 dialog = gtk_dialog_new_with_buttons( _( "Camera Inspector" ), NULL, flags, NULL );
window = gtk_window_new( GTK_WINDOW_TOPLEVEL ); w = gtk_dialog_add_button( GTK_DIALOG( dialog ), _( "OK" ), GTK_RESPONSE_OK );
gtk_window_set_title( GTK_WINDOW( window ), _( "Camera Inspector" ) ); g_signal_connect( G_OBJECT( w ), "clicked", G_CALLBACK( ci_close ), NULL );
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 ) );
// don't use show, as you don't want to have it displayed on startup ;-) g_signal_connect( dialog, "delete_event", G_CALLBACK( ci_close ), NULL );
gtk_widget_realize( window ); 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 ); table = gtk_table_new( 3, 2, FALSE );
gtk_widget_show( table ); gtk_container_add( GTK_CONTAINER( content_area ), table );
gtk_container_add( GTK_CONTAINER( window ), table );
gtk_container_set_border_width( GTK_CONTAINER( table ), 5 ); gtk_container_set_border_width( GTK_CONTAINER( table ), 5 );
gtk_table_set_row_spacings( GTK_TABLE( table ), 5 ); gtk_table_set_row_spacings( GTK_TABLE( table ), 5 );
gtk_table_set_col_spacings( GTK_TABLE( table ), 5 ); gtk_table_set_col_spacings( GTK_TABLE( table ), 5 );
gtk_widget_show( table );
// the properties column // the properties column
// -------------------------- // // -------------------------- //
vbox = gtk_vbox_new( FALSE, 5 ); vbox = gtk_vbox_new( FALSE, 5 );
gtk_widget_show( vbox );
gtk_table_attach( GTK_TABLE( table ), vbox, 0, 1, 0, 1, gtk_table_attach( GTK_TABLE( table ), vbox, 0, 1, 0, 1,
(GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
(GtkAttachOptions) ( GTK_FILL ), 0, 0 ); (GtkAttachOptions) ( GTK_FILL ), 0, 0 );
gtk_widget_show( vbox );
// -------------------------- // // -------------------------- //
@ -1070,10 +956,10 @@ GtkWidget *CreateCameraInspectorDialog( void ){
// -------------------------- // // -------------------------- //
frame = gtk_frame_new( _( "Path and Target editing" ) ); frame = gtk_frame_new( _( "Path and Target editing" ) );
gtk_widget_show( frame );
gtk_table_attach( GTK_TABLE( table ), frame, 0, 1, 1, 2, gtk_table_attach( GTK_TABLE( table ), frame, 0, 1, 1, 2,
(GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
(GtkAttachOptions) ( GTK_FILL ), 0, 0 ); (GtkAttachOptions) ( GTK_FILL ), 0, 0 );
gtk_widget_show( frame );
vbox = gtk_vbox_new( FALSE, 5 ); vbox = gtk_vbox_new( FALSE, 5 );
gtk_container_add( GTK_CONTAINER( frame ), vbox ); gtk_container_add( GTK_CONTAINER( frame ), vbox );
@ -1164,10 +1050,10 @@ GtkWidget *CreateCameraInspectorDialog( void ){
// -------------------------- // // -------------------------- //
frame = gtk_frame_new( _( "Time" ) ); frame = gtk_frame_new( _( "Time" ) );
gtk_widget_show( frame );
gtk_table_attach( GTK_TABLE( table ), frame, 0, 1, 2, 3, gtk_table_attach( GTK_TABLE( table ), frame, 0, 1, 2, 3,
(GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
(GtkAttachOptions) ( GTK_FILL ), 0, 0 ); (GtkAttachOptions) ( GTK_FILL ), 0, 0 );
gtk_widget_show( frame );
vbox = gtk_vbox_new( FALSE, 5 ); vbox = gtk_vbox_new( FALSE, 5 );
gtk_container_add( GTK_CONTAINER( frame ), vbox ); gtk_container_add( GTK_CONTAINER( frame ), vbox );
@ -1186,7 +1072,7 @@ GtkWidget *CreateCameraInspectorDialog( void ){
g_pSecondsEntry = gtk_entry_new(); g_pSecondsEntry = gtk_entry_new();
gtk_box_pack_start( GTK_BOX( hbox ), g_pSecondsEntry, FALSE, FALSE, 0 ); 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 ); gtk_widget_show( g_pSecondsEntry );
// -------------------------- // // -------------------------- //
@ -1253,7 +1139,6 @@ GtkWidget *CreateCameraInspectorDialog( void ){
gtk_widget_show( hbox ); gtk_widget_show( hbox );
w = gtk_scrolled_window_new( NULL, NULL ); 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_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_box_pack_start( GTK_BOX( hbox ), w, TRUE, TRUE, 0 );
gtk_widget_show( w ); gtk_widget_show( w );
@ -1287,10 +1172,10 @@ GtkWidget *CreateCameraInspectorDialog( void ){
// -------------------------- // // -------------------------- //
vbox = gtk_vbox_new( FALSE, 5 ); vbox = gtk_vbox_new( FALSE, 5 );
gtk_widget_show( vbox );
gtk_table_attach( GTK_TABLE( table ), vbox, 1, 2, 0, 1, gtk_table_attach( GTK_TABLE( table ), vbox, 1, 2, 0, 1,
(GtkAttachOptions) ( GTK_FILL ), (GtkAttachOptions) ( GTK_FILL ),
(GtkAttachOptions) ( GTK_FILL ), 0, 0 ); (GtkAttachOptions) ( GTK_FILL ), 0, 0 );
gtk_widget_show( vbox );
w = gtk_button_new_with_label( _( "New..." ) ); w = gtk_button_new_with_label( _( "New..." ) );
gtk_box_pack_start( GTK_BOX( vbox ), w, FALSE, FALSE, 0 ); gtk_box_pack_start( GTK_BOX( vbox ), w, FALSE, FALSE, 0 );
@ -1305,10 +1190,10 @@ GtkWidget *CreateCameraInspectorDialog( void ){
// -------------------------- // // -------------------------- //
vbox = gtk_vbox_new( FALSE, 5 ); vbox = gtk_vbox_new( FALSE, 5 );
gtk_widget_show( vbox );
gtk_table_attach( GTK_TABLE( table ), vbox, 1, 2, 1, 2, gtk_table_attach( GTK_TABLE( table ), vbox, 1, 2, 1, 2,
(GtkAttachOptions) ( GTK_FILL ), (GtkAttachOptions) ( GTK_FILL ),
(GtkAttachOptions) ( GTK_FILL ), 0, 0 ); (GtkAttachOptions) ( GTK_FILL ), 0, 0 );
gtk_widget_show( vbox );
w = gtk_button_new_with_label( _( "Save..." ) ); w = gtk_button_new_with_label( _( "Save..." ) );
gtk_box_pack_start( GTK_BOX( vbox ), w, FALSE, FALSE, 0 ); gtk_box_pack_start( GTK_BOX( vbox ), w, FALSE, FALSE, 0 );
@ -1336,24 +1221,5 @@ GtkWidget *CreateCameraInspectorDialog( void ){
// -------------------------- // // -------------------------- //
vbox = gtk_vbox_new( FALSE, 5 ); return dialog;
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;
} }

File diff suppressed because it is too large Load diff

View file

@ -364,7 +364,7 @@ static void preview_spin( GtkAdjustment *adj, double *data ){
void CreateViewWindow(){ void CreateViewWindow(){
GtkWidget *dlg, *vbox, *hbox, *label, *spin, *frame; GtkWidget *dlg, *vbox, *hbox, *label, *spin, *frame;
GtkObject *adj; GtkAdjustment *adj;
#ifndef ISOMETRIC #ifndef ISOMETRIC
elevation = PI / 6.; elevation = PI / 6.;
@ -379,45 +379,51 @@ void CreateViewWindow(){
gtk_window_set_default_size( GTK_WINDOW( dlg ), 300, 400 ); gtk_window_set_default_size( GTK_WINDOW( dlg ), 300, 400 );
vbox = gtk_vbox_new( FALSE, 5 ); vbox = gtk_vbox_new( FALSE, 5 );
gtk_widget_show( vbox );
gtk_container_add( GTK_CONTAINER( dlg ), vbox ); gtk_container_add( GTK_CONTAINER( dlg ), vbox );
gtk_widget_show( vbox );
#ifndef ISOMETRIC #ifndef ISOMETRIC
hbox = gtk_hbox_new( TRUE, 5 ); hbox = gtk_hbox_new( TRUE, 5 );
gtk_widget_show( hbox );
gtk_box_pack_start( GTK_BOX( vbox ), hbox, FALSE, TRUE, 0 ); gtk_box_pack_start( GTK_BOX( vbox ), hbox, FALSE, TRUE, 0 );
gtk_container_set_border_width( GTK_CONTAINER( hbox ), 3 ); gtk_container_set_border_width( GTK_CONTAINER( hbox ), 3 );
gtk_widget_show( hbox );
label = gtk_label_new( _( "Elevation" ) ); 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_misc_set_alignment( GTK_MISC( label ), 1, 0.5 );
gtk_box_pack_start( GTK_BOX( hbox ), label, FALSE, TRUE, 0 ); 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 ); g_signal_connect( adj, "value-changed", G_CALLBACK( preview_spin ), &elevation );
spin = gtk_spin_button_new( GTK_ADJUSTMENT( adj ), 1, 0 ); 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_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 ); 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 ); g_signal_connect( adj, "value-changed", G_CALLBACK( preview_spin ), &azimuth );
spin = gtk_spin_button_new( GTK_ADJUSTMENT( adj ), 1, 0 ); 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_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_box_pack_end( GTK_BOX( hbox ), spin, FALSE, TRUE, 0 );
gtk_widget_show( spin );
label = gtk_label_new( _( "Azimuth" ) ); label = gtk_label_new( _( "Azimuth" ) );
gtk_widget_show( label );
gtk_misc_set_alignment( GTK_MISC( label ), 1, 0.5 ); gtk_misc_set_alignment( GTK_MISC( label ), 1, 0.5 );
gtk_box_pack_end( GTK_BOX( hbox ), label, FALSE, TRUE, 0 ); 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 ); g_signal_connect( G_OBJECT( spin ), "focus-out-event", G_CALLBACK( doublevariable_spinfocusout ), &azimuth );
#endif #endif
frame = gtk_frame_new( NULL ); frame = gtk_frame_new( NULL );
gtk_widget_show( frame );
gtk_frame_set_shadow_type( GTK_FRAME( frame ), GTK_SHADOW_IN ); gtk_frame_set_shadow_type( GTK_FRAME( frame ), GTK_SHADOW_IN );
gtk_box_pack_start( GTK_BOX( vbox ), frame, TRUE, TRUE, 0 ); 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 ); 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_signal_connect( G_OBJECT( g_pPreviewWidget ), "button-press-event",
G_CALLBACK( button_press ), NULL ); G_CALLBACK( button_press ), NULL );
gtk_widget_show( g_pPreviewWidget );
gtk_container_add( GTK_CONTAINER( frame ), g_pPreviewWidget ); gtk_container_add( GTK_CONTAINER( frame ), g_pPreviewWidget );
gtk_widget_show( g_pPreviewWidget );
if ( Preview ) { if ( Preview ) {
gtk_widget_show( g_pWndPreview ); gtk_widget_show( g_pWndPreview );

View file

@ -31,45 +31,20 @@
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
// CAboutDialog dialog // CAboutDialog dialog
static void dialog_button_callback( GtkWidget *widget, gpointer data ){ void DoAboutDlg( GtkWidget *parent ){
GtkWidget *parent; GtkWidget *dialog, *vbox, *label, *content_area;
int *loop, *ret; GtkDialogFlags flags = GTK_DIALOG_DESTROY_WITH_PARENT;
parent = gtk_widget_get_toplevel( widget ); dialog = gtk_dialog_new_with_buttons( _( "About Portal Viewer" ), NULL, flags, NULL );
loop = (int*)g_object_get_data( G_OBJECT( parent ), "loop" ); gtk_dialog_add_button( GTK_DIALOG( dialog ), _( "OK" ), GTK_RESPONSE_OK );
ret = (int*)g_object_get_data( G_OBJECT( parent ), "ret" );
*loop = 0; content_area = gtk_dialog_get_content_area( GTK_DIALOG( dialog ) );
*ret = (int)((intptr_t)data); gtk_window_set_transient_for( GTK_WINDOW( dialog ), GTK_WINDOW( parent) );
}
static gint dialog_delete_callback( GtkWidget *widget, GdkEvent* event, gpointer data ){ vbox = gtk_vbox_new( TRUE, 5 );
int *loop; gtk_container_add( GTK_CONTAINER( content_area ), vbox );
gtk_container_set_border_width( GTK_CONTAINER( vbox ), 5 );
gtk_widget_hide( widget ); gtk_widget_show( vbox );
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 );
label = gtk_label_new( "Version 1.000\n\n" label = gtk_label_new( "Version 1.000\n\n"
"Gtk port by Leonardo Zide\nleo@lokigames.com\n\n" "Gtk port by Leonardo Zide\nleo@lokigames.com\n\n"
@ -77,29 +52,14 @@ void DoAboutDlg(){
"Built against GtkRadiant " RADIANT_VERSION "\n" "Built against GtkRadiant " RADIANT_VERSION "\n"
__DATE__ __DATE__
); );
gtk_widget_show( label ); gtk_box_pack_start( GTK_BOX( vbox ), label, TRUE, TRUE, 0 );
gtk_box_pack_start( GTK_BOX( hbox ), label, TRUE, TRUE, 0 );
gtk_label_set_justify( GTK_LABEL( label ), GTK_JUSTIFY_LEFT ); 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_dialog_run( GTK_DIALOG( dialog ) );
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_grab_add( dlg ); gtk_widget_destroy( dialog );
gtk_widget_show( dlg );
while ( loop )
gtk_main_iteration();
gtk_grab_remove( dlg );
gtk_widget_destroy( dlg );
} }
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////

View file

@ -238,7 +238,7 @@ static void OnFog( GtkWidget *widget, gpointer data ){
} }
static void OnSelchangeZbuffer( 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 ) { if ( interfaces_started ) {
g_FuncTable.m_pfnSysUpdateWindows( UPDATE_3D ); g_FuncTable.m_pfnSysUpdateWindows( UPDATE_3D );
@ -269,163 +269,155 @@ static void OnClip( GtkWidget *widget, gpointer data ){
} }
} }
void DoConfigDialog(){ void DoConfigDialog( GtkWidget *parent ){
GtkWidget *dlg, *hbox, *vbox, *vbox2, *button, *table, *frame; GtkWidget *dialog, *hbox, *vbox, *vbox2, *button, *table, *frame;
GtkWidget *lw3slider, *lw3label, *lw2slider, *lw2label, *zlist, *menu, *item; GtkWidget *lw3slider, *lw3label, *lw2slider, *lw2label, *zlist;
GtkWidget *aa2check, *aa3check, *depthcheck, *linescheck, *polyscheck; GtkWidget *aa2check, *aa3check, *depthcheck, *linescheck, *polyscheck;
GtkWidget *transslider, *translabel, *clipslider, *cliplabel; GtkWidget *transslider, *translabel, *clipslider, *cliplabel;
GtkWidget *show2check, *show3check, *portalcheck; GtkWidget *show2check, *show3check, *portalcheck;
int loop = 1, ret = IDCANCEL; GtkWidget *content_area, *color_button, *depth_button;
GtkObject *adj; GtkSizeGroup *button_group;
GList *combo_list;
GList *lst;
GtkAdjustment *adj;
GtkDialogFlags flags = GTK_DIALOG_DESTROY_WITH_PARENT;
dlg = gtk_window_new( GTK_WINDOW_TOPLEVEL ); dialog = gtk_dialog_new_with_buttons( _( "Portal Viewer Configuration" ), NULL, flags, NULL );
gtk_window_set_title( GTK_WINDOW( dlg ), _( "Portal Viewer Configuration" ) ); gtk_window_set_transient_for( GTK_WINDOW( dialog ), GTK_WINDOW( parent ) );
g_signal_connect( G_OBJECT( dlg ), "delete-event", gtk_dialog_add_button( GTK_DIALOG( dialog ), _( "OK" ), GTK_RESPONSE_OK );
G_CALLBACK( dialog_delete_callback ), NULL );
g_signal_connect( G_OBJECT( dlg ), "destroy", content_area = gtk_dialog_get_content_area( GTK_DIALOG( dialog ) );
G_CALLBACK( gtk_widget_destroy ), NULL );
g_object_set_data( G_OBJECT( dlg ), "loop", &loop );
g_object_set_data( G_OBJECT( dlg ), "ret", &ret );
vbox = gtk_vbox_new( FALSE, 5 ); vbox = gtk_vbox_new( FALSE, 5 );
gtk_widget_show( vbox ); gtk_container_add( GTK_CONTAINER( content_area ), vbox );
gtk_container_add( GTK_CONTAINER( dlg ), vbox );
gtk_container_set_border_width( GTK_CONTAINER( vbox ), 5 ); gtk_container_set_border_width( GTK_CONTAINER( vbox ), 5 );
gtk_widget_show( vbox );
frame = gtk_frame_new( _( "3D View" ) ); frame = gtk_frame_new( _( "3D View" ) );
gtk_widget_show( frame );
gtk_box_pack_start( GTK_BOX( vbox ), frame, TRUE, TRUE, 0 ); gtk_box_pack_start( GTK_BOX( vbox ), frame, TRUE, TRUE, 0 );
gtk_widget_show( frame );
vbox2 = gtk_vbox_new( FALSE, 5 ); vbox2 = gtk_vbox_new( FALSE, 5 );
gtk_widget_show( vbox2 );
gtk_container_add( GTK_CONTAINER( frame ), vbox2 ); gtk_container_add( GTK_CONTAINER( frame ), vbox2 );
gtk_container_set_border_width( GTK_CONTAINER( vbox2 ), 5 ); gtk_container_set_border_width( GTK_CONTAINER( vbox2 ), 5 );
gtk_widget_show( vbox2 );
hbox = gtk_hbox_new( FALSE, 5 ); hbox = gtk_hbox_new( FALSE, 5 );
gtk_widget_show( hbox );
gtk_box_pack_start( GTK_BOX( vbox2 ), hbox, TRUE, TRUE, 0 ); 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 ) ); lw3slider = gtk_hscale_new( GTK_ADJUSTMENT( adj ) );
gtk_widget_show( lw3slider );
gtk_box_pack_start( GTK_BOX( hbox ), lw3slider, TRUE, TRUE, 0 ); gtk_box_pack_start( GTK_BOX( hbox ), lw3slider, TRUE, TRUE, 0 );
gtk_scale_set_draw_value( GTK_SCALE( lw3slider ), FALSE ); gtk_scale_set_draw_value( GTK_SCALE( lw3slider ), FALSE );
gtk_widget_show( lw3slider );
lw3label = gtk_label_new( "" ); lw3label = gtk_label_new( "" );
gtk_widget_show( lw3label );
gtk_box_pack_start( GTK_BOX( hbox ), lw3label, FALSE, TRUE, 0 ); 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 ); g_signal_connect( adj, "value-changed", G_CALLBACK( OnScroll3d ), lw3label );
table = gtk_table_new( 2, 4, FALSE ); table = gtk_table_new( 2, 4, FALSE );
gtk_widget_show( table );
gtk_box_pack_start( GTK_BOX( vbox2 ), table, TRUE, TRUE, 0 ); gtk_box_pack_start( GTK_BOX( vbox2 ), table, TRUE, TRUE, 0 );
gtk_table_set_row_spacings( GTK_TABLE( table ), 5 ); gtk_table_set_row_spacings( GTK_TABLE( table ), 5 );
gtk_table_set_col_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" ) ); color_button = button = gtk_button_new_with_label( _( "Color" ) );
gtk_widget_show( button );
gtk_table_attach( GTK_TABLE( table ), button, 0, 1, 0, 1, gtk_table_attach( GTK_TABLE( table ), button, 0, 1, 0, 1,
(GtkAttachOptions) ( GTK_FILL ), (GtkAttachOptions) ( GTK_FILL ),
(GtkAttachOptions) ( 0 ), 0, 0 ); (GtkAttachOptions) ( 0 ), 0, 0 );
gtk_widget_show( button );
g_signal_connect( G_OBJECT( button ), "clicked", G_CALLBACK( OnColor3d ), NULL ); g_signal_connect( G_OBJECT( button ), "clicked", G_CALLBACK( OnColor3d ), NULL );
button = gtk_button_new_with_label( _( "Depth Color" ) ); depth_button = button = gtk_button_new_with_label( _( "Depth Color" ) );
gtk_widget_show( button );
gtk_table_attach( GTK_TABLE( table ), button, 0, 1, 1, 2, gtk_table_attach( GTK_TABLE( table ), button, 0, 1, 1, 2,
(GtkAttachOptions) ( GTK_FILL ), (GtkAttachOptions) ( GTK_FILL ),
(GtkAttachOptions) ( 0 ), 0, 0 ); (GtkAttachOptions) ( 0 ), 0, 0 );
gtk_widget_show( button );
g_signal_connect( G_OBJECT( button ), "clicked", G_CALLBACK( OnColorFog ), NULL ); 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)" ) ); 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, gtk_table_attach( GTK_TABLE( table ), aa3check, 1, 4, 0, 1,
(GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
(GtkAttachOptions) ( 0 ), 0, 0 ); (GtkAttachOptions) ( 0 ), 0, 0 );
gtk_widget_show( aa3check );
g_signal_connect( G_OBJECT( aa3check ), "toggled", G_CALLBACK( OnAntiAlias3d ), NULL ); g_signal_connect( G_OBJECT( aa3check ), "toggled", G_CALLBACK( OnAntiAlias3d ), NULL );
depthcheck = gtk_check_button_new_with_label( _( "Depth Cue" ) ); depthcheck = gtk_check_button_new_with_label( _( "Depth Cue" ) );
gtk_widget_show( depthcheck );
gtk_table_attach( GTK_TABLE( table ), depthcheck, 1, 2, 1, 2, gtk_table_attach( GTK_TABLE( table ), depthcheck, 1, 2, 1, 2,
(GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
(GtkAttachOptions) ( 0 ), 0, 0 ); (GtkAttachOptions) ( 0 ), 0, 0 );
gtk_widget_show( depthcheck );
g_signal_connect( G_OBJECT( depthcheck ), "toggled", G_CALLBACK( OnFog ), NULL ); g_signal_connect( G_OBJECT( depthcheck ), "toggled", G_CALLBACK( OnFog ), NULL );
linescheck = gtk_check_button_new_with_label( _( "Lines" ) ); linescheck = gtk_check_button_new_with_label( _( "Lines" ) );
gtk_widget_show( linescheck );
gtk_table_attach( GTK_TABLE( table ), linescheck, 2, 3, 1, 2, gtk_table_attach( GTK_TABLE( table ), linescheck, 2, 3, 1, 2,
(GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
(GtkAttachOptions) ( 0 ), 0, 0 ); (GtkAttachOptions) ( 0 ), 0, 0 );
gtk_widget_show( linescheck );
g_signal_connect( G_OBJECT( linescheck ), "toggled", G_CALLBACK( OnLines ), NULL ); g_signal_connect( G_OBJECT( linescheck ), "toggled", G_CALLBACK( OnLines ), NULL );
polyscheck = gtk_check_button_new_with_label( _( "Polygons" ) ); polyscheck = gtk_check_button_new_with_label( _( "Polygons" ) );
gtk_widget_show( polyscheck );
gtk_table_attach( GTK_TABLE( table ), polyscheck, 3, 4, 1, 2, gtk_table_attach( GTK_TABLE( table ), polyscheck, 3, 4, 1, 2,
(GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
(GtkAttachOptions) ( 0 ), 0, 0 ); (GtkAttachOptions) ( 0 ), 0, 0 );
gtk_widget_show( polyscheck );
g_signal_connect( G_OBJECT( polyscheck ), "toggled", G_CALLBACK( OnPoly ), NULL ); g_signal_connect( G_OBJECT( polyscheck ), "toggled", G_CALLBACK( OnPoly ), NULL );
zlist = gtk_option_menu_new(); combo_list = NULL;
gtk_widget_show( zlist ); 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 ); gtk_box_pack_start( GTK_BOX( vbox2 ), zlist, TRUE, FALSE, 0 );
gtk_widget_show( zlist );
menu = gtk_menu_new(); g_signal_connect( zlist, "changed", G_CALLBACK( OnSelchangeZbuffer ), NULL );
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 );
table = gtk_table_new( 2, 2, FALSE ); table = gtk_table_new( 2, 2, FALSE );
gtk_widget_show( table );
gtk_box_pack_start( GTK_BOX( vbox2 ), table, TRUE, TRUE, 0 ); gtk_box_pack_start( GTK_BOX( vbox2 ), table, TRUE, TRUE, 0 );
gtk_table_set_row_spacings( GTK_TABLE( table ), 5 ); gtk_table_set_row_spacings( GTK_TABLE( table ), 5 );
gtk_table_set_col_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 ) ); transslider = gtk_hscale_new( GTK_ADJUSTMENT( adj ) );
gtk_widget_show( transslider );
gtk_table_attach( GTK_TABLE( table ), transslider, 0, 1, 0, 1, gtk_table_attach( GTK_TABLE( table ), transslider, 0, 1, 0, 1,
(GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
(GtkAttachOptions) ( 0 ), 0, 0 ); (GtkAttachOptions) ( 0 ), 0, 0 );
gtk_scale_set_draw_value( GTK_SCALE( transslider ), FALSE ); gtk_scale_set_draw_value( GTK_SCALE( transslider ), FALSE );
gtk_widget_show( transslider );
translabel = gtk_label_new( "" ); translabel = gtk_label_new( "" );
gtk_widget_show( translabel );
gtk_table_attach( GTK_TABLE( table ), translabel, 1, 2, 0, 1, gtk_table_attach( GTK_TABLE( table ), translabel, 1, 2, 0, 1,
(GtkAttachOptions) ( GTK_FILL ), (GtkAttachOptions) ( GTK_FILL ),
(GtkAttachOptions) ( 0 ), 0, 0 ); (GtkAttachOptions) ( 0 ), 0, 0 );
gtk_misc_set_alignment( GTK_MISC( translabel ), 0.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 ); 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 ) ); clipslider = gtk_hscale_new( GTK_ADJUSTMENT( adj ) );
gtk_widget_show( clipslider );
gtk_table_attach( GTK_TABLE( table ), clipslider, 0, 1, 1, 2, gtk_table_attach( GTK_TABLE( table ), clipslider, 0, 1, 1, 2,
(GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
(GtkAttachOptions) ( 0 ), 0, 0 ); (GtkAttachOptions) ( 0 ), 0, 0 );
gtk_scale_set_draw_value( GTK_SCALE( clipslider ), FALSE ); gtk_scale_set_draw_value( GTK_SCALE( clipslider ), FALSE );
gtk_widget_show( clipslider );
cliplabel = gtk_label_new( "" ); cliplabel = gtk_label_new( "" );
gtk_widget_show( cliplabel );
gtk_table_attach( GTK_TABLE( table ), cliplabel, 1, 2, 1, 2, gtk_table_attach( GTK_TABLE( table ), cliplabel, 1, 2, 1, 2,
(GtkAttachOptions) ( GTK_FILL ), (GtkAttachOptions) ( GTK_FILL ),
(GtkAttachOptions) ( 0 ), 0, 0 ); (GtkAttachOptions) ( 0 ), 0, 0 );
gtk_misc_set_alignment( GTK_MISC( cliplabel ), 0.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 ); g_signal_connect( adj, "value-changed", G_CALLBACK( OnScrollClip ), cliplabel );
hbox = gtk_hbox_new( TRUE, 5 ); hbox = gtk_hbox_new( TRUE, 5 );
@ -455,7 +447,7 @@ void DoConfigDialog(){
gtk_widget_show( hbox ); gtk_widget_show( hbox );
gtk_box_pack_start( GTK_BOX( vbox2 ), hbox, TRUE, FALSE, 0 ); 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 ) ); lw2slider = gtk_hscale_new( GTK_ADJUSTMENT( adj ) );
gtk_widget_show( lw2slider ); gtk_widget_show( lw2slider );
gtk_box_pack_start( GTK_BOX( hbox ), lw2slider, TRUE, TRUE, 0 ); 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 ); g_signal_connect( adj, "value-changed", G_CALLBACK( OnScroll2d ), lw2label );
hbox = gtk_hbox_new( FALSE, 5 ); hbox = gtk_hbox_new( FALSE, 5 );
gtk_widget_show( hbox );
gtk_box_pack_start( GTK_BOX( vbox2 ), hbox, TRUE, FALSE, 0 ); gtk_box_pack_start( GTK_BOX( vbox2 ), hbox, TRUE, FALSE, 0 );
gtk_widget_show( hbox );
button = gtk_button_new_with_label( _( "Color" ) ); button = gtk_button_new_with_label( _( "Color" ) );
gtk_widget_show( button );
gtk_box_pack_start( GTK_BOX( hbox ), button, FALSE, FALSE, 0 ); 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 ); 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)" ) ); 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_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 ); g_signal_connect( G_OBJECT( aa2check ), "toggled", G_CALLBACK( OnAntiAlias2d ), NULL );
hbox = gtk_hbox_new( FALSE, 5 ); hbox = gtk_hbox_new( FALSE, 5 );
gtk_widget_show( hbox );
gtk_box_pack_start( GTK_BOX( vbox2 ), hbox, TRUE, FALSE, 0 ); gtk_box_pack_start( GTK_BOX( vbox2 ), hbox, TRUE, FALSE, 0 );
gtk_widget_show( hbox );
show2check = gtk_check_button_new_with_label( _( "Show" ) ); show2check = gtk_check_button_new_with_label( _( "Show" ) );
gtk_widget_show( show2check );
gtk_box_pack_start( GTK_BOX( hbox ), show2check, FALSE, FALSE, 0 ); 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 ); 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 // initialize dialog
gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( show2check ), portals.show_2d ); gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( show2check ), portals.show_2d );
gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( aa2check ), portals.aa_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( polyscheck ), portals.polygons );
gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( linescheck ), portals.lines ); gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( linescheck ), portals.lines );
gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( aa3check ), portals.aa_3d ); 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 ); gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( portalcheck ), portals.clip );
Set3DText( lw3label ); Set3DText( lw3label );
Set3DTransText( translabel ); Set3DTransText( translabel );
SetClipText( cliplabel ); SetClipText( cliplabel );
gtk_grab_add( dlg );
gtk_widget_show( dlg );
while ( loop ) gtk_dialog_run( GTK_DIALOG( dialog ) );
gtk_main_iteration();
gtk_grab_remove( dlg ); gtk_widget_destroy( dialog );
gtk_widget_destroy( dlg );
} }

View file

@ -28,135 +28,87 @@
//static char THIS_FILE[] = __FILE__; //static char THIS_FILE[] = __FILE__;
#endif #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 ){ static void change_clicked( GtkWidget *widget, gpointer data ){
GtkWidget* file_sel; GtkWidget *file_sel, *parent;
char* filename = NULL; gint response_id;
int loop = 1; GtkFileChooserAction action = GTK_FILE_CHOOSER_ACTION_OPEN;
file_sel = gtk_file_selection_new( _( "Locate portal (.prt) file" ) ); parent = GTK_WIDGET( data );
g_signal_connect( G_OBJECT( GTK_FILE_SELECTION( file_sel )->ok_button ), "clicked", file_sel = gtk_file_chooser_dialog_new( _( "Locate portal (.prt) file" ), NULL, action, NULL, NULL );
G_CALLBACK( file_sel_callback ), GINT_TO_POINTER( IDOK ) ); gtk_window_set_transient_for( GTK_WINDOW( file_sel ), GTK_WINDOW( parent ) );
g_signal_connect( G_OBJECT( GTK_FILE_SELECTION( file_sel )->cancel_button ), "clicked", gtk_dialog_add_button( GTK_DIALOG( file_sel ), _( "_Open" ), GTK_RESPONSE_ACCEPT );
G_CALLBACK( file_sel_callback ), GINT_TO_POINTER( IDCANCEL ) ); gtk_dialog_add_button( GTK_DIALOG( file_sel ), _( "_Cancel" ), GTK_RESPONSE_CANCEL );
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 ) );
g_object_set_data( G_OBJECT( file_sel ), "loop", &loop ); response_id = gtk_dialog_run( GTK_DIALOG( file_sel ) );
g_object_set_data( G_OBJECT( file_sel ), "filename", &filename ); if( response_id == GTK_RESPONSE_ACCEPT )
gtk_file_selection_set_filename( GTK_FILE_SELECTION( file_sel ), portals.fn ); {
gchar *filename;
GtkFileChooser *chooser;
gtk_grab_add( file_sel ); chooser = GTK_FILE_CHOOSER( file_sel );
gtk_widget_show( file_sel ); filename = gtk_file_chooser_get_filename( chooser );
while ( loop ) if ( filename != NULL ) {
gtk_main_iteration(); strcpy( portals.fn, filename );
gtk_entry_set_text( GTK_ENTRY( data ), filename );
gtk_grab_remove( file_sel ); g_free( filename );
gtk_widget_destroy( file_sel ); }
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(){ int DoLoadPortalFileDialog( GtkWidget *parent ){
GtkWidget *dlg, *vbox, *hbox, *button, *entry, *check2d, *check3d; GtkWidget *dialog, *vbox, *hbox, *button, *entry, *check2d, *check3d;
int loop = 1, ret = IDCANCEL; 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 ); dialog = gtk_dialog_new_with_buttons( _( "Load .prt" ), NULL, flags, NULL );
gtk_window_set_title( GTK_WINDOW( dlg ), _( "Load .prt" ) ); gtk_window_set_transient_for( GTK_WINDOW( dialog ), GTK_WINDOW( parent ) );
g_signal_connect( G_OBJECT( dlg ), "delete-event",
G_CALLBACK( dialog_delete_callback ), NULL ); ok_button = gtk_dialog_add_button( GTK_DIALOG( dialog ), _( "OK" ), GTK_RESPONSE_OK );
g_signal_connect( G_OBJECT( dlg ), "destroy", cancel_button = gtk_dialog_add_button( GTK_DIALOG( dialog ), _( "Cancel" ), GTK_RESPONSE_CANCEL );
G_CALLBACK( gtk_widget_destroy ), NULL );
g_object_set_data( G_OBJECT( dlg ), "loop", &loop ); content_area = gtk_dialog_get_content_area( GTK_DIALOG( dialog ) );
g_object_set_data( G_OBJECT( dlg ), "ret", &ret );
vbox = gtk_vbox_new( FALSE, 5 ); vbox = gtk_vbox_new( FALSE, 5 );
gtk_widget_show( vbox ); gtk_container_add( GTK_CONTAINER( content_area ), vbox );
gtk_container_add( GTK_CONTAINER( dlg ), vbox );
gtk_container_set_border_width( GTK_CONTAINER( vbox ), 5 ); gtk_container_set_border_width( GTK_CONTAINER( vbox ), 5 );
gtk_widget_show( vbox );
entry = gtk_entry_new(); entry = gtk_entry_new();
gtk_widget_show( entry ); gtk_editable_set_editable( GTK_EDITABLE( entry ), FALSE );
gtk_entry_set_editable( GTK_ENTRY( entry ), FALSE );
gtk_box_pack_start( GTK_BOX( vbox ), entry, FALSE, FALSE, 0 ); gtk_box_pack_start( GTK_BOX( vbox ), entry, FALSE, FALSE, 0 );
gtk_widget_show( entry );
hbox = gtk_hbox_new( FALSE, 5 ); hbox = gtk_hbox_new( FALSE, 5 );
gtk_widget_show( hbox );
gtk_box_pack_start( GTK_BOX( vbox ), hbox, FALSE, FALSE, 0 ); gtk_box_pack_start( GTK_BOX( vbox ), hbox, FALSE, FALSE, 0 );
gtk_widget_show( hbox );
check3d = gtk_check_button_new_with_label( _( "Show 3D" ) ); 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_box_pack_start( GTK_BOX( hbox ), check3d, FALSE, FALSE, 0 );
gtk_widget_show( check3d );
check2d = gtk_check_button_new_with_label( _( "Show 2D" ) ); 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_box_pack_start( GTK_BOX( hbox ), check2d, FALSE, FALSE, 0 );
gtk_widget_show( check2d );
button = gtk_button_new_with_label( _( "Change" ) ); change_button = button = gtk_button_new_with_label( _( "Change" ) );
gtk_widget_show( button );
gtk_box_pack_end( GTK_BOX( hbox ), button, FALSE, FALSE, 0 ); gtk_box_pack_end( GTK_BOX( hbox ), button, FALSE, FALSE, 0 );
g_signal_connect( G_OBJECT( button ), "clicked", G_CALLBACK( change_clicked ), entry ); g_signal_connect( G_OBJECT( button ), "clicked", G_CALLBACK( change_clicked ), parent );
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" ) );
gtk_widget_show( button ); 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" ) ); size_group = gtk_size_group_new( GTK_SIZE_GROUP_BOTH );
gtk_widget_show( button ); gtk_size_group_add_widget( size_group, ok_button );
gtk_box_pack_end( GTK_BOX( hbox ), button, FALSE, FALSE, 0 ); gtk_size_group_add_widget( size_group, cancel_button );
g_signal_connect( G_OBJECT( button ), "clicked", gtk_size_group_add_widget( size_group, change_button );
G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( IDOK ) ); g_object_unref( size_group );
gtk_widget_set_usize( button, 60, -2 );
char *fn = g_FuncTable.m_pfnGetMapName(); char *fn = g_FuncTable.m_pfnGetMapName();
strcpy( portals.fn, fn ); 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( check2d ), portals.show_2d );
gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( check3d ), portals.show_3d ); gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( check3d ), portals.show_3d );
gtk_grab_add( dlg );
gtk_widget_show( dlg );
while ( loop ) response_id = gtk_dialog_run( GTK_DIALOG( dialog ) );
gtk_main_iteration();
if( response_id == GTK_RESPONSE_OK ) {
if ( ret == IDOK ) {
portals.Purge(); portals.Purge();
portals.show_3d = gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( check3d ) ) ? true : false; 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; 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( dialog );
gtk_widget_destroy( dlg );
return ret; return ret;
} }

View file

@ -140,7 +140,7 @@ int DoLoadPortalFileDialog(){
gtk_widget_show( button ); gtk_widget_show( button );
gtk_box_pack_end( GTK_BOX( hbox ), button, FALSE, FALSE, 0 ); gtk_box_pack_end( GTK_BOX( hbox ), button, FALSE, FALSE, 0 );
g_signal_connect( G_OBJECT( button ), "clicked", G_CALLBACK( change_clicked ), entry ); 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 ); hbox = gtk_hbox_new( FALSE, 5 );
gtk_widget_show( hbox ); gtk_widget_show( hbox );
@ -151,14 +151,14 @@ int DoLoadPortalFileDialog(){
gtk_box_pack_end( GTK_BOX( hbox ), button, FALSE, FALSE, 0 ); gtk_box_pack_end( GTK_BOX( hbox ), button, FALSE, FALSE, 0 );
g_signal_connect( G_OBJECT( button ), "clicked", g_signal_connect( G_OBJECT( button ), "clicked",
G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( IDCANCEL ) ); 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" ) ); button = gtk_button_new_with_label( _( "OK" ) );
gtk_widget_show( button ); gtk_widget_show( button );
gtk_box_pack_end( GTK_BOX( hbox ), button, FALSE, FALSE, 0 ); gtk_box_pack_end( GTK_BOX( hbox ), button, FALSE, FALSE, 0 );
g_signal_connect( G_OBJECT( button ), "clicked", g_signal_connect( G_OBJECT( button ), "clicked",
G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( IDOK ) ); 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(); char *fn = g_IBSPTable.m_pfnGetMapName();
strcpy( portals.fn, fn ); strcpy( portals.fn, fn );
@ -228,7 +228,7 @@ void DoAboutDlg(){
gtk_box_pack_start( GTK_BOX( vbox ), button, FALSE, FALSE, 0 ); gtk_box_pack_start( GTK_BOX( vbox ), button, FALSE, FALSE, 0 );
g_signal_connect( G_OBJECT( button ), "clicked", g_signal_connect( G_OBJECT( button ), "clicked",
G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( IDOK ) ); 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_grab_add( dlg );
gtk_widget_show( dlg ); gtk_widget_show( dlg );
@ -659,7 +659,7 @@ void DoConfigDialog(){
gtk_widget_show( button ); gtk_widget_show( button );
gtk_box_pack_start( GTK_BOX( hbox ), button, FALSE, FALSE, 0 ); gtk_box_pack_start( GTK_BOX( hbox ), button, FALSE, FALSE, 0 );
g_signal_connect( G_OBJECT( button ), "clicked", G_CALLBACK( OnColor2d ), NULL ); 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)" ) ); aa2check = gtk_check_button_new_with_label( _( "Anti-Alias (May not work on some video cards)" ) );
gtk_widget_show( aa2check ); gtk_widget_show( aa2check );
@ -684,7 +684,7 @@ void DoConfigDialog(){
gtk_box_pack_end( GTK_BOX( hbox ), button, FALSE, FALSE, 0 ); gtk_box_pack_end( GTK_BOX( hbox ), button, FALSE, FALSE, 0 );
g_signal_connect( G_OBJECT( button ), "clicked", g_signal_connect( G_OBJECT( button ), "clicked",
G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( IDOK ) ); 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 // initialize dialog
gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( show2check ), portals.show_2d ); gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( show2check ), portals.show_2d );

View file

@ -20,8 +20,8 @@
#ifndef _GTKDLGS_H_ #ifndef _GTKDLGS_H_
#define _GTKDLGS_H_ #define _GTKDLGS_H_
int DoLoadPortalFileDialog(); int DoLoadPortalFileDialog( GtkWidget *parent );
void DoAboutDlg(); void DoAboutDlg( GtkWidget *parent );
void DoConfigDialog(); void DoConfigDialog( GtkWidget *parent );
#endif // _GTKDLGS_H_ #endif // _GTKDLGS_H_

View file

@ -25,12 +25,12 @@
#include <stdlib.h> #include <stdlib.h>
#define Q3R_CMD_SPLITTER "-" #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_LOAD "Load .prt file"
#define Q3R_CMD_RELEASE "Unload .prt file" #define Q3R_CMD_RELEASE "Unload .prt file"
#define Q3R_CMD_SHOW_3D "Toggle portals (3D)" #define Q3R_CMD_SHOW_3D "Toggle portals (3D)"
#define Q3R_CMD_SHOW_2D "Toggle portals (2D)" #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]; static char INIfn[NAME_MAX];
@ -55,6 +55,8 @@ static char INIfn[NAME_MAX];
#define CLIP_RANGE "ClipRange" #define CLIP_RANGE "ClipRange"
#define CLIP "Clip" #define CLIP "Clip"
void *g_pMainWidget = NULL;
void InitInstance(){ void InitInstance(){
#ifdef _WIN32 #ifdef _WIN32
char fn[_MAX_PATH]; 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" LPCSTR WINAPI QERPlug_Init (HMODULE hApp, GtkWidget* hwndMain)
extern "C" const char* QERPlug_Init( void *hApp, void* pMainWidget ){ extern "C" const char* QERPlug_Init( void *hApp, void* pMainWidget ){
g_pMainWidget = pMainWidget;
// Setup defaults & load config // Setup defaults & load config
InitInstance(); 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 ); Sys_Printf( MSG_PREFIX "Command \"%s\"\n",p );
if ( !strcmp( p,Q3R_CMD_ABOUT ) ) { if ( !strcmp( p,Q3R_CMD_ABOUT ) ) {
DoAboutDlg(); DoAboutDlg( GTK_WIDGET( g_pMainWidget ) );
} }
else if ( !strcmp( p,Q3R_CMD_LOAD ) ) { else if ( !strcmp( p,Q3R_CMD_LOAD ) ) {
CheckInterfaces(); CheckInterfaces();
if ( interfaces_started ) { if ( interfaces_started ) {
if ( DoLoadPortalFileDialog() == IDOK ) { if ( DoLoadPortalFileDialog( GTK_WIDGET( g_pMainWidget ) ) == IDOK ) {
portals.Load(); portals.Load();
g_FuncTable.m_pfnSysUpdateWindows( UPDATE_ALL ); 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 ) ) { else if ( !strcmp( p,Q3R_CMD_OPTIONS ) ) {
DoConfigDialog(); DoConfigDialog( GTK_WIDGET( g_pMainWidget ) );
SaveConfig(); SaveConfig();
if ( interfaces_started ) { if ( interfaces_started ) {

View file

@ -122,31 +122,31 @@ GtkWidget *texture_combo_entry;
GtkWidget *match_grid_button; GtkWidget *match_grid_button;
GtkObject *hshift_value_spinbutton_adj; GtkAdjustment *hshift_value_spinbutton_adj;
GtkWidget *hshift_value_spinbutton; GtkWidget *hshift_value_spinbutton;
GtkObject *vshift_value_spinbutton_adj; GtkAdjustment *vshift_value_spinbutton_adj;
GtkWidget *vshift_value_spinbutton; GtkWidget *vshift_value_spinbutton;
GtkObject *hscale_value_spinbutton_adj; GtkAdjustment *hscale_value_spinbutton_adj;
GtkWidget *hscale_value_spinbutton; GtkWidget *hscale_value_spinbutton;
GtkObject *vscale_value_spinbutton_adj; GtkAdjustment *vscale_value_spinbutton_adj;
GtkWidget *vscale_value_spinbutton; GtkWidget *vscale_value_spinbutton;
GtkObject *rotate_value_spinbutton_adj; GtkAdjustment *rotate_value_spinbutton_adj;
GtkWidget *rotate_value_spinbutton; GtkWidget *rotate_value_spinbutton;
GtkObject *hshift_step_spinbutton_adj; GtkAdjustment *hshift_step_spinbutton_adj;
GtkWidget *hshift_step_spinbutton; GtkWidget *hshift_step_spinbutton;
GtkObject *vshift_step_spinbutton_adj; GtkAdjustment *vshift_step_spinbutton_adj;
GtkWidget *vshift_step_spinbutton; GtkWidget *vshift_step_spinbutton;
GtkObject *hscale_step_spinbutton_adj; GtkAdjustment *hscale_step_spinbutton_adj;
GtkWidget *hscale_step_spinbutton; GtkWidget *hscale_step_spinbutton;
GtkObject *vscale_step_spinbutton_adj; GtkAdjustment *vscale_step_spinbutton_adj;
GtkWidget *vscale_step_spinbutton; GtkWidget *vscale_step_spinbutton;
GtkObject *rotate_step_spinbutton_adj; GtkAdjustment *rotate_step_spinbutton_adj;
GtkWidget *rotate_step_spinbutton; GtkWidget *rotate_step_spinbutton;
GtkObject *fit_width_spinbutton_adj; GtkAdjustment *fit_width_spinbutton_adj;
GtkWidget *fit_width_spinbutton; GtkWidget *fit_width_spinbutton;
GtkObject *fit_height_spinbutton_adj; GtkAdjustment *fit_height_spinbutton_adj;
GtkWidget *fit_height_spinbutton; GtkWidget *fit_height_spinbutton;
GtkWidget *fit_button; GtkWidget *fit_button;
GtkWidget *axial_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) // 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 ) { 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 FALSE;
} }
return apply_and_hide( widget, (GdkEvent*)event, data ); return apply_and_hide( widget, (GdkEvent*)event, data );
@ -641,6 +641,7 @@ GtkWidget* create_SurfaceInspector( void ){
GtkWidget *hbox1; GtkWidget *hbox1;
GtkWidget *hbuttonbox1; GtkWidget *hbuttonbox1;
GtkSizeGroup *size_group;
SurfaceInspector = gtk_window_new( GTK_WINDOW_TOPLEVEL ); SurfaceInspector = gtk_window_new( GTK_WINDOW_TOPLEVEL );
gtk_container_set_border_width( GTK_CONTAINER( SurfaceInspector ), 4 ); gtk_container_set_border_width( GTK_CONTAINER( SurfaceInspector ), 4 );
@ -649,515 +650,530 @@ GtkWidget* create_SurfaceInspector( void ){
SetWinPos_from_Prefs( SurfaceInspector ); SetWinPos_from_Prefs( SurfaceInspector );
viewport8 = gtk_viewport_new( NULL, NULL ); viewport8 = gtk_viewport_new( NULL, NULL );
gtk_widget_show( viewport8 );
gtk_container_add( GTK_CONTAINER( SurfaceInspector ), viewport8 ); gtk_container_add( GTK_CONTAINER( SurfaceInspector ), viewport8 );
gtk_viewport_set_shadow_type( GTK_VIEWPORT( viewport8 ), GTK_SHADOW_NONE ); gtk_viewport_set_shadow_type( GTK_VIEWPORT( viewport8 ), GTK_SHADOW_NONE );
gtk_widget_show( viewport8 );
vbox7 = gtk_vbox_new( FALSE, 0 ); vbox7 = gtk_vbox_new( FALSE, 0 );
gtk_widget_show( vbox7 );
gtk_container_add( GTK_CONTAINER( viewport8 ), vbox7 ); gtk_container_add( GTK_CONTAINER( viewport8 ), vbox7 );
gtk_widget_show( vbox7 );
viewport9 = gtk_viewport_new( NULL, NULL ); viewport9 = gtk_viewport_new( NULL, NULL );
gtk_widget_show( viewport9 );
gtk_box_pack_start( GTK_BOX( vbox7 ), viewport9, FALSE, FALSE, 0 ); gtk_box_pack_start( GTK_BOX( vbox7 ), viewport9, FALSE, FALSE, 0 );
gtk_container_set_border_width( GTK_CONTAINER( viewport9 ), 2 ); gtk_container_set_border_width( GTK_CONTAINER( viewport9 ), 2 );
gtk_viewport_set_shadow_type( GTK_VIEWPORT( viewport9 ), GTK_SHADOW_ETCHED_IN ); gtk_viewport_set_shadow_type( GTK_VIEWPORT( viewport9 ), GTK_SHADOW_ETCHED_IN );
gtk_widget_show( viewport9 );
hbox1 = gtk_hbox_new( FALSE, 0 ); hbox1 = gtk_hbox_new( FALSE, 0 );
gtk_widget_show( hbox1 );
gtk_container_add( GTK_CONTAINER( viewport9 ), hbox1 ); gtk_container_add( GTK_CONTAINER( viewport9 ), hbox1 );
gtk_container_set_border_width( GTK_CONTAINER( hbox1 ), 4 ); gtk_container_set_border_width( GTK_CONTAINER( hbox1 ), 4 );
gtk_widget_show( hbox1 );
label = gtk_label_new( _( "Texture: " ) ); label = gtk_label_new( _( "Texture: " ) );
gtk_widget_show( label );
gtk_box_pack_start( GTK_BOX( hbox1 ), label, FALSE, FALSE, 0 ); gtk_box_pack_start( GTK_BOX( hbox1 ), label, FALSE, FALSE, 0 );
gtk_misc_set_alignment( GTK_MISC( label ), 1, 0.5 ); gtk_misc_set_alignment( GTK_MISC( label ), 1, 0.5 );
gtk_widget_show( label );
texture_combo = gtk_combo_new(); texture_combo = gtk_combo_new();
g_object_set_data( G_OBJECT( GTK_COMBO( texture_combo )->popwin ), g_object_set_data( G_OBJECT( GTK_COMBO( texture_combo )->popwin ),
"KeepMeAround", texture_combo ); "KeepMeAround", texture_combo );
gtk_combo_disable_activate( (GtkCombo*) 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_box_pack_start( GTK_BOX( hbox1 ), texture_combo, TRUE, TRUE, 0 );
gtk_widget_show( texture_combo );
texture_combo_entry = GTK_COMBO( texture_combo )->entry; 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_entry_set_max_length( GTK_ENTRY( texture_combo_entry ), 128 );
gtk_widget_show( texture_combo_entry );
viewport2 = gtk_viewport_new( NULL, NULL ); viewport2 = gtk_viewport_new( NULL, NULL );
gtk_widget_show( viewport2 );
gtk_box_pack_start( GTK_BOX( vbox7 ), viewport2, FALSE, TRUE, 0 ); gtk_box_pack_start( GTK_BOX( vbox7 ), viewport2, FALSE, TRUE, 0 );
gtk_container_set_border_width( GTK_CONTAINER( viewport2 ), 2 ); gtk_container_set_border_width( GTK_CONTAINER( viewport2 ), 2 );
gtk_viewport_set_shadow_type( GTK_VIEWPORT( viewport2 ), GTK_SHADOW_ETCHED_IN ); gtk_viewport_set_shadow_type( GTK_VIEWPORT( viewport2 ), GTK_SHADOW_ETCHED_IN );
gtk_widget_show( viewport2 );
table1 = gtk_table_new( 13, 4, FALSE ); table1 = gtk_table_new( 13, 4, FALSE );
gtk_widget_show( table1 );
gtk_container_add( GTK_CONTAINER( viewport2 ), table1 ); gtk_container_add( GTK_CONTAINER( viewport2 ), table1 );
gtk_widget_show( table1 );
hseparator = gtk_hseparator_new(); hseparator = gtk_hseparator_new();
gtk_widget_show( hseparator );
gtk_table_attach( GTK_TABLE( table1 ), hseparator, 1, 2, 1, 2, gtk_table_attach( GTK_TABLE( table1 ), hseparator, 1, 2, 1, 2,
(GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
(GtkAttachOptions) ( GTK_FILL ), 0, 0 ); (GtkAttachOptions) ( GTK_FILL ), 0, 0 );
gtk_widget_show( hseparator );
hseparator = gtk_hseparator_new(); hseparator = gtk_hseparator_new();
gtk_widget_show( hseparator );
gtk_table_attach( GTK_TABLE( table1 ), hseparator, 2, 3, 1, 2, gtk_table_attach( GTK_TABLE( table1 ), hseparator, 2, 3, 1, 2,
(GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
(GtkAttachOptions) ( GTK_FILL ), 0, 0 ); (GtkAttachOptions) ( GTK_FILL ), 0, 0 );
gtk_widget_show( hseparator );
hseparator = gtk_hseparator_new(); hseparator = gtk_hseparator_new();
gtk_widget_show( hseparator );
gtk_table_attach( GTK_TABLE( table1 ), hseparator, 3, 4, 1, 2, gtk_table_attach( GTK_TABLE( table1 ), hseparator, 3, 4, 1, 2,
(GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
(GtkAttachOptions) ( GTK_FILL ), 0, 0 ); (GtkAttachOptions) ( GTK_FILL ), 0, 0 );
gtk_widget_show( hseparator );
hseparator = gtk_hseparator_new(); hseparator = gtk_hseparator_new();
gtk_widget_show( hseparator );
gtk_table_attach( GTK_TABLE( table1 ), hseparator, 1, 2, 3, 4, gtk_table_attach( GTK_TABLE( table1 ), hseparator, 1, 2, 3, 4,
(GtkAttachOptions) ( GTK_FILL ), (GtkAttachOptions) ( GTK_FILL ),
(GtkAttachOptions) ( GTK_FILL ), 0, 0 ); (GtkAttachOptions) ( GTK_FILL ), 0, 0 );
gtk_widget_show( hseparator );
hseparator = gtk_hseparator_new(); hseparator = gtk_hseparator_new();
gtk_widget_show( hseparator );
gtk_table_attach( GTK_TABLE( table1 ), hseparator, 2, 3, 3, 4, gtk_table_attach( GTK_TABLE( table1 ), hseparator, 2, 3, 3, 4,
(GtkAttachOptions) ( GTK_FILL ), (GtkAttachOptions) ( GTK_FILL ),
(GtkAttachOptions) ( GTK_FILL ), 0, 0 ); (GtkAttachOptions) ( GTK_FILL ), 0, 0 );
gtk_widget_show( hseparator );
hseparator = gtk_hseparator_new(); hseparator = gtk_hseparator_new();
gtk_widget_show( hseparator );
gtk_table_attach( GTK_TABLE( table1 ), hseparator, 3, 4, 3, 4, gtk_table_attach( GTK_TABLE( table1 ), hseparator, 3, 4, 3, 4,
(GtkAttachOptions) ( GTK_FILL ), (GtkAttachOptions) ( GTK_FILL ),
(GtkAttachOptions) ( GTK_FILL ), 0, 0 ); (GtkAttachOptions) ( GTK_FILL ), 0, 0 );
gtk_widget_show( hseparator );
hseparator = gtk_hseparator_new(); hseparator = gtk_hseparator_new();
gtk_widget_show( hseparator );
gtk_table_attach( GTK_TABLE( table1 ), hseparator, 1, 2, 5, 6, gtk_table_attach( GTK_TABLE( table1 ), hseparator, 1, 2, 5, 6,
(GtkAttachOptions) ( GTK_FILL ), (GtkAttachOptions) ( GTK_FILL ),
(GtkAttachOptions) ( GTK_FILL ), 0, 0 ); (GtkAttachOptions) ( GTK_FILL ), 0, 0 );
gtk_widget_show( hseparator );
hseparator = gtk_hseparator_new(); hseparator = gtk_hseparator_new();
gtk_widget_show( hseparator );
gtk_table_attach( GTK_TABLE( table1 ), hseparator, 2, 3, 5, 6, gtk_table_attach( GTK_TABLE( table1 ), hseparator, 2, 3, 5, 6,
(GtkAttachOptions) ( GTK_FILL ), (GtkAttachOptions) ( GTK_FILL ),
(GtkAttachOptions) ( GTK_FILL ), 0, 0 ); (GtkAttachOptions) ( GTK_FILL ), 0, 0 );
gtk_widget_show( hseparator );
hseparator = gtk_hseparator_new(); hseparator = gtk_hseparator_new();
gtk_widget_show( hseparator );
gtk_table_attach( GTK_TABLE( table1 ), hseparator, 3, 4, 5, 6, gtk_table_attach( GTK_TABLE( table1 ), hseparator, 3, 4, 5, 6,
(GtkAttachOptions) ( GTK_FILL ), (GtkAttachOptions) ( GTK_FILL ),
(GtkAttachOptions) ( GTK_FILL ), 0, 0 ); (GtkAttachOptions) ( GTK_FILL ), 0, 0 );
gtk_widget_show( hseparator );
hseparator = gtk_hseparator_new(); hseparator = gtk_hseparator_new();
gtk_widget_show( hseparator );
gtk_table_attach( GTK_TABLE( table1 ), hseparator, 1, 2, 7, 8, gtk_table_attach( GTK_TABLE( table1 ), hseparator, 1, 2, 7, 8,
(GtkAttachOptions) ( GTK_FILL ), (GtkAttachOptions) ( GTK_FILL ),
(GtkAttachOptions) ( GTK_FILL ), 0, 0 ); (GtkAttachOptions) ( GTK_FILL ), 0, 0 );
gtk_widget_show( hseparator );
hseparator = gtk_hseparator_new(); hseparator = gtk_hseparator_new();
gtk_widget_show( hseparator );
gtk_table_attach( GTK_TABLE( table1 ), hseparator, 2, 3, 7, 8, gtk_table_attach( GTK_TABLE( table1 ), hseparator, 2, 3, 7, 8,
(GtkAttachOptions) ( GTK_FILL ), (GtkAttachOptions) ( GTK_FILL ),
(GtkAttachOptions) ( GTK_FILL ), 0, 0 ); (GtkAttachOptions) ( GTK_FILL ), 0, 0 );
gtk_widget_show( hseparator );
hseparator = gtk_hseparator_new(); hseparator = gtk_hseparator_new();
gtk_widget_show( hseparator );
gtk_table_attach( GTK_TABLE( table1 ), hseparator, 3, 4, 7, 8, gtk_table_attach( GTK_TABLE( table1 ), hseparator, 3, 4, 7, 8,
(GtkAttachOptions) ( GTK_FILL ), (GtkAttachOptions) ( GTK_FILL ),
(GtkAttachOptions) ( GTK_FILL ), 0, 0 ); (GtkAttachOptions) ( GTK_FILL ), 0, 0 );
gtk_widget_show( hseparator );
hseparator = gtk_hseparator_new(); hseparator = gtk_hseparator_new();
gtk_widget_show( hseparator );
gtk_table_attach( GTK_TABLE( table1 ), hseparator, 1, 2, 9, 10, gtk_table_attach( GTK_TABLE( table1 ), hseparator, 1, 2, 9, 10,
(GtkAttachOptions) ( GTK_FILL ), (GtkAttachOptions) ( GTK_FILL ),
(GtkAttachOptions) ( GTK_FILL ), 0, 0 ); (GtkAttachOptions) ( GTK_FILL ), 0, 0 );
gtk_widget_show( hseparator );
hseparator = gtk_hseparator_new(); hseparator = gtk_hseparator_new();
gtk_widget_show( hseparator );
gtk_table_attach( GTK_TABLE( table1 ), hseparator, 2, 3, 9, 10, gtk_table_attach( GTK_TABLE( table1 ), hseparator, 2, 3, 9, 10,
(GtkAttachOptions) ( GTK_FILL ), (GtkAttachOptions) ( GTK_FILL ),
(GtkAttachOptions) ( GTK_FILL ), 0, 0 ); (GtkAttachOptions) ( GTK_FILL ), 0, 0 );
gtk_widget_show( hseparator );
hseparator = gtk_hseparator_new(); hseparator = gtk_hseparator_new();
gtk_widget_show( hseparator );
gtk_table_attach( GTK_TABLE( table1 ), hseparator, 3, 4, 9, 10, gtk_table_attach( GTK_TABLE( table1 ), hseparator, 3, 4, 9, 10,
(GtkAttachOptions) ( GTK_FILL ), (GtkAttachOptions) ( GTK_FILL ),
(GtkAttachOptions) ( GTK_FILL ), 0, 0 ); (GtkAttachOptions) ( GTK_FILL ), 0, 0 );
gtk_widget_show( hseparator );
hseparator = gtk_hseparator_new(); hseparator = gtk_hseparator_new();
gtk_widget_show( hseparator );
gtk_table_attach( GTK_TABLE( table1 ), hseparator, 1, 2, 11, 12, gtk_table_attach( GTK_TABLE( table1 ), hseparator, 1, 2, 11, 12,
(GtkAttachOptions) ( GTK_FILL ), (GtkAttachOptions) ( GTK_FILL ),
(GtkAttachOptions) ( GTK_FILL ), 0, 0 ); (GtkAttachOptions) ( GTK_FILL ), 0, 0 );
gtk_widget_show( hseparator );
hseparator = gtk_hseparator_new(); hseparator = gtk_hseparator_new();
gtk_widget_show( hseparator );
gtk_table_attach( GTK_TABLE( table1 ), hseparator, 2, 3, 11, 12, gtk_table_attach( GTK_TABLE( table1 ), hseparator, 2, 3, 11, 12,
(GtkAttachOptions) ( GTK_FILL ), (GtkAttachOptions) ( GTK_FILL ),
(GtkAttachOptions) ( GTK_FILL ), 0, 0 ); (GtkAttachOptions) ( GTK_FILL ), 0, 0 );
gtk_widget_show( hseparator );
hseparator = gtk_hseparator_new(); hseparator = gtk_hseparator_new();
gtk_widget_show( hseparator );
gtk_table_attach( GTK_TABLE( table1 ), hseparator, 3, 4, 11, 12, gtk_table_attach( GTK_TABLE( table1 ), hseparator, 3, 4, 11, 12,
(GtkAttachOptions) ( GTK_FILL ), (GtkAttachOptions) ( GTK_FILL ),
(GtkAttachOptions) ( GTK_FILL ), 0, 0 ); (GtkAttachOptions) ( GTK_FILL ), 0, 0 );
gtk_widget_show( hseparator );
label = gtk_label_new( _( "Step" ) ); label = gtk_label_new( _( "Step" ) );
gtk_widget_show( label );
gtk_table_attach( GTK_TABLE( table1 ), label, 3, 4, 0, 1, gtk_table_attach( GTK_TABLE( table1 ), label, 3, 4, 0, 1,
(GtkAttachOptions) ( GTK_FILL ), (GtkAttachOptions) ( GTK_FILL ),
(GtkAttachOptions) ( 0 ), 0, 0 ); (GtkAttachOptions) ( 0 ), 0, 0 );
gtk_widget_show( label );
eventbox = gtk_event_box_new(); eventbox = gtk_event_box_new();
gtk_widget_show( eventbox );
gtk_table_attach( GTK_TABLE( table1 ), eventbox, 3, 4, 12, 13, gtk_table_attach( GTK_TABLE( table1 ), eventbox, 3, 4, 12, 13,
(GtkAttachOptions) ( GTK_FILL ), (GtkAttachOptions) ( GTK_FILL ),
(GtkAttachOptions) ( GTK_FILL ), 0, 0 ); (GtkAttachOptions) ( GTK_FILL ), 0, 0 );
gtk_widget_show( eventbox );
match_grid_button = gtk_button_new_with_mnemonic( _( "Match Grid" ) ); 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_container_add( GTK_CONTAINER( eventbox ), match_grid_button );
gtk_widget_show( match_grid_button );
label = gtk_label_new( _( "Value" ) ); label = gtk_label_new( _( "Value" ) );
gtk_widget_show( label );
gtk_table_attach( GTK_TABLE( table1 ), label, 1, 2, 0, 1, gtk_table_attach( GTK_TABLE( table1 ), label, 1, 2, 0, 1,
(GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
(GtkAttachOptions) ( 0 ), 0, 0 ); (GtkAttachOptions) ( 0 ), 0, 0 );
gtk_misc_set_alignment( GTK_MISC( label ), 0.5, 1 ); gtk_misc_set_alignment( GTK_MISC( label ), 0.5, 1 );
gtk_widget_show( label );
hseparator = gtk_hseparator_new(); hseparator = gtk_hseparator_new();
gtk_widget_show( hseparator );
gtk_table_attach( GTK_TABLE( table1 ), hseparator, 0, 1, 3, 4, gtk_table_attach( GTK_TABLE( table1 ), hseparator, 0, 1, 3, 4,
(GtkAttachOptions) ( GTK_SHRINK | GTK_FILL ), (GtkAttachOptions) ( GTK_SHRINK | GTK_FILL ),
(GtkAttachOptions) ( GTK_FILL ), 0, 0 ); (GtkAttachOptions) ( GTK_FILL ), 0, 0 );
gtk_widget_show( hseparator );
hseparator = gtk_hseparator_new(); hseparator = gtk_hseparator_new();
gtk_widget_show( hseparator );
gtk_table_attach( GTK_TABLE( table1 ), hseparator, 0, 1, 5, 6, gtk_table_attach( GTK_TABLE( table1 ), hseparator, 0, 1, 5, 6,
(GtkAttachOptions) ( GTK_FILL ), (GtkAttachOptions) ( GTK_FILL ),
(GtkAttachOptions) ( GTK_FILL ), 0, 0 ); (GtkAttachOptions) ( GTK_FILL ), 0, 0 );
gtk_widget_show( hseparator );
hseparator = gtk_hseparator_new(); hseparator = gtk_hseparator_new();
gtk_widget_show( hseparator );
gtk_table_attach( GTK_TABLE( table1 ), hseparator, 0, 1, 7, 8, gtk_table_attach( GTK_TABLE( table1 ), hseparator, 0, 1, 7, 8,
(GtkAttachOptions) ( GTK_FILL ), (GtkAttachOptions) ( GTK_FILL ),
(GtkAttachOptions) ( GTK_FILL ), 0, 0 ); (GtkAttachOptions) ( GTK_FILL ), 0, 0 );
gtk_widget_show( hseparator );
hseparator = gtk_hseparator_new(); hseparator = gtk_hseparator_new();
gtk_widget_show( hseparator );
gtk_table_attach( GTK_TABLE( table1 ), hseparator, 0, 1, 9, 10, gtk_table_attach( GTK_TABLE( table1 ), hseparator, 0, 1, 9, 10,
(GtkAttachOptions) ( GTK_FILL ), (GtkAttachOptions) ( GTK_FILL ),
(GtkAttachOptions) ( GTK_FILL ), 0, 0 ); (GtkAttachOptions) ( GTK_FILL ), 0, 0 );
gtk_widget_show( hseparator );
hseparator = gtk_hseparator_new(); hseparator = gtk_hseparator_new();
gtk_widget_show( hseparator );
gtk_table_attach( GTK_TABLE( table1 ), hseparator, 0, 1, 11, 12, gtk_table_attach( GTK_TABLE( table1 ), hseparator, 0, 1, 11, 12,
(GtkAttachOptions) ( GTK_FILL ), (GtkAttachOptions) ( GTK_FILL ),
(GtkAttachOptions) ( GTK_FILL ), 0, 0 ); (GtkAttachOptions) ( GTK_FILL ), 0, 0 );
gtk_widget_show( hseparator );
eventbox = gtk_event_box_new(); eventbox = gtk_event_box_new();
gtk_widget_show( eventbox );
gtk_table_attach( GTK_TABLE( table1 ), eventbox, 0, 1, 4, 5, gtk_table_attach( GTK_TABLE( table1 ), eventbox, 0, 1, 4, 5,
(GtkAttachOptions) ( GTK_FILL ), (GtkAttachOptions) ( GTK_FILL ),
(GtkAttachOptions) ( GTK_FILL ), 0, 0 ); (GtkAttachOptions) ( GTK_FILL ), 0, 0 );
gtk_widget_show( eventbox );
label = gtk_label_new( _( "Vertical Shift: " ) ); label = gtk_label_new( _( "Vertical Shift: " ) );
gtk_widget_show( label );
gtk_container_add( GTK_CONTAINER( eventbox ), label ); gtk_container_add( GTK_CONTAINER( eventbox ), label );
gtk_label_set_justify( GTK_LABEL( label ), GTK_JUSTIFY_LEFT ); gtk_label_set_justify( GTK_LABEL( label ), GTK_JUSTIFY_LEFT );
gtk_misc_set_alignment( GTK_MISC( label ), 1, 0.5 ); gtk_misc_set_alignment( GTK_MISC( label ), 1, 0.5 );
gtk_widget_show( label );
eventbox = gtk_event_box_new(); eventbox = gtk_event_box_new();
gtk_widget_show( eventbox );
gtk_table_attach( GTK_TABLE( table1 ), eventbox, 0, 1, 6, 7, gtk_table_attach( GTK_TABLE( table1 ), eventbox, 0, 1, 6, 7,
(GtkAttachOptions) ( GTK_FILL ), (GtkAttachOptions) ( GTK_FILL ),
(GtkAttachOptions) ( GTK_FILL ), 0, 0 ); (GtkAttachOptions) ( GTK_FILL ), 0, 0 );
gtk_widget_show( eventbox );
label = gtk_label_new( _( "Horizontal Scale: " ) ); label = gtk_label_new( _( "Horizontal Scale: " ) );
gtk_widget_show( label );
gtk_container_add( GTK_CONTAINER( eventbox ), label ); gtk_container_add( GTK_CONTAINER( eventbox ), label );
gtk_label_set_justify( GTK_LABEL( label ), GTK_JUSTIFY_LEFT ); gtk_label_set_justify( GTK_LABEL( label ), GTK_JUSTIFY_LEFT );
gtk_misc_set_alignment( GTK_MISC( label ), 1, 0.5 ); gtk_misc_set_alignment( GTK_MISC( label ), 1, 0.5 );
gtk_widget_show( label );
eventbox = gtk_event_box_new(); eventbox = gtk_event_box_new();
gtk_widget_show( eventbox );
gtk_table_attach( GTK_TABLE( table1 ), eventbox, 0, 1, 8, 9, gtk_table_attach( GTK_TABLE( table1 ), eventbox, 0, 1, 8, 9,
(GtkAttachOptions) ( GTK_FILL ), (GtkAttachOptions) ( GTK_FILL ),
(GtkAttachOptions) ( GTK_FILL ), 0, 0 ); (GtkAttachOptions) ( GTK_FILL ), 0, 0 );
gtk_widget_show( eventbox );
label = gtk_label_new( _( "Vertical Scale: " ) ); label = gtk_label_new( _( "Vertical Scale: " ) );
gtk_widget_show( label );
gtk_container_add( GTK_CONTAINER( eventbox ), label ); gtk_container_add( GTK_CONTAINER( eventbox ), label );
gtk_label_set_justify( GTK_LABEL( label ), GTK_JUSTIFY_LEFT ); gtk_label_set_justify( GTK_LABEL( label ), GTK_JUSTIFY_LEFT );
gtk_misc_set_alignment( GTK_MISC( label ), 1, 0.5 ); gtk_misc_set_alignment( GTK_MISC( label ), 1, 0.5 );
gtk_widget_show( label );
eventbox = gtk_event_box_new(); eventbox = gtk_event_box_new();
gtk_widget_show( eventbox );
gtk_table_attach( GTK_TABLE( table1 ), eventbox, 0, 1, 10, 11, gtk_table_attach( GTK_TABLE( table1 ), eventbox, 0, 1, 10, 11,
(GtkAttachOptions) ( GTK_FILL ), (GtkAttachOptions) ( GTK_FILL ),
(GtkAttachOptions) ( GTK_FILL ), 0, 0 ); (GtkAttachOptions) ( GTK_FILL ), 0, 0 );
gtk_widget_show( eventbox );
label = gtk_label_new( _( "Rotate: " ) ); label = gtk_label_new( _( "Rotate: " ) );
gtk_widget_show( label );
gtk_container_add( GTK_CONTAINER( eventbox ), label ); gtk_container_add( GTK_CONTAINER( eventbox ), label );
gtk_label_set_justify( GTK_LABEL( label ), GTK_JUSTIFY_LEFT ); gtk_label_set_justify( GTK_LABEL( label ), GTK_JUSTIFY_LEFT );
gtk_misc_set_alignment( GTK_MISC( label ), 1, 0.5 ); gtk_misc_set_alignment( GTK_MISC( label ), 1, 0.5 );
gtk_widget_show( label );
eventbox = gtk_event_box_new(); eventbox = gtk_event_box_new();
gtk_widget_show( eventbox );
gtk_table_attach( GTK_TABLE( table1 ), eventbox, 0, 1, 2, 3, gtk_table_attach( GTK_TABLE( table1 ), eventbox, 0, 1, 2, 3,
(GtkAttachOptions) ( GTK_FILL ), (GtkAttachOptions) ( GTK_FILL ),
(GtkAttachOptions) ( GTK_FILL ), 0, 0 ); (GtkAttachOptions) ( GTK_FILL ), 0, 0 );
gtk_widget_show( eventbox );
label = gtk_label_new( _( "Horizontal Shift: " ) ); label = gtk_label_new( _( "Horizontal Shift: " ) );
gtk_widget_show( label );
gtk_container_add( GTK_CONTAINER( eventbox ), label ); gtk_container_add( GTK_CONTAINER( eventbox ), label );
gtk_label_set_justify( GTK_LABEL( label ), GTK_JUSTIFY_LEFT ); gtk_label_set_justify( GTK_LABEL( label ), GTK_JUSTIFY_LEFT );
gtk_misc_set_alignment( GTK_MISC( label ), 1, 0.5 ); gtk_misc_set_alignment( GTK_MISC( label ), 1, 0.5 );
gtk_widget_show( label );
hseparator = gtk_hseparator_new(); hseparator = gtk_hseparator_new();
gtk_widget_show( hseparator );
gtk_table_attach( GTK_TABLE( table1 ), hseparator, 0, 1, 1, 2, gtk_table_attach( GTK_TABLE( table1 ), hseparator, 0, 1, 1, 2,
(GtkAttachOptions) ( GTK_FILL ), (GtkAttachOptions) ( GTK_FILL ),
(GtkAttachOptions) ( GTK_FILL ), 0, 0 ); (GtkAttachOptions) ( GTK_FILL ), 0, 0 );
gtk_widget_show( hseparator );
eventbox = gtk_event_box_new(); eventbox = gtk_event_box_new();
gtk_widget_show( eventbox );
gtk_table_attach( GTK_TABLE( table1 ), eventbox, 1, 2, 12, 13, gtk_table_attach( GTK_TABLE( table1 ), eventbox, 1, 2, 12, 13,
(GtkAttachOptions) ( GTK_FILL ), (GtkAttachOptions) ( GTK_FILL ),
(GtkAttachOptions) ( GTK_FILL ), 0, 0 ); (GtkAttachOptions) ( GTK_FILL ), 0, 0 );
gtk_widget_show( eventbox );
// Value Spins // 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 ); 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, gtk_table_attach( GTK_TABLE( table1 ), hshift_value_spinbutton, 1, 2, 2, 3,
(GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
(GtkAttachOptions) ( 0 ), 0, 0 ); (GtkAttachOptions) ( 0 ), 0, 0 );
gtk_spin_button_set_update_policy( GTK_SPIN_BUTTON( hshift_value_spinbutton ), GTK_UPDATE_IF_VALID ); 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_spin_button_set_wrap( GTK_SPIN_BUTTON( hshift_value_spinbutton ), TRUE );
gtk_widget_set_sensitive( GTK_WIDGET( 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 ); 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, gtk_table_attach( GTK_TABLE( table1 ), vshift_value_spinbutton, 1, 2, 4, 5,
(GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
(GtkAttachOptions) ( 0 ), 0, 0 ); (GtkAttachOptions) ( 0 ), 0, 0 );
gtk_spin_button_set_update_policy( GTK_SPIN_BUTTON( vshift_value_spinbutton ), GTK_UPDATE_IF_VALID ); 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_spin_button_set_wrap( GTK_SPIN_BUTTON( vshift_value_spinbutton ), TRUE );
gtk_widget_set_sensitive( GTK_WIDGET( 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 ); 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, gtk_table_attach( GTK_TABLE( table1 ), hscale_value_spinbutton, 1, 2, 6, 7,
(GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
(GtkAttachOptions) ( 0 ), 0, 0 ); (GtkAttachOptions) ( 0 ), 0, 0 );
gtk_spin_button_set_update_policy( GTK_SPIN_BUTTON( hscale_value_spinbutton ), GTK_UPDATE_IF_VALID ); 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_spin_button_set_wrap( GTK_SPIN_BUTTON( hscale_value_spinbutton ), TRUE );
gtk_widget_set_sensitive( GTK_WIDGET( 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 ); 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, gtk_table_attach( GTK_TABLE( table1 ), vscale_value_spinbutton, 1, 2, 8, 9,
(GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
(GtkAttachOptions) ( 0 ), 0, 0 ); (GtkAttachOptions) ( 0 ), 0, 0 );
gtk_spin_button_set_update_policy( GTK_SPIN_BUTTON( vscale_value_spinbutton ), GTK_UPDATE_IF_VALID ); 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_spin_button_set_wrap( GTK_SPIN_BUTTON( vscale_value_spinbutton ), TRUE );
gtk_widget_set_sensitive( GTK_WIDGET( 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 ); 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, gtk_table_attach( GTK_TABLE( table1 ), rotate_value_spinbutton, 1, 2, 10, 11,
(GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
(GtkAttachOptions) ( 0 ), 0, 0 ); (GtkAttachOptions) ( 0 ), 0, 0 );
gtk_spin_button_set_update_policy( GTK_SPIN_BUTTON( rotate_value_spinbutton ), GTK_UPDATE_IF_VALID ); 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_spin_button_set_wrap( GTK_SPIN_BUTTON( rotate_value_spinbutton ), TRUE );
gtk_widget_set_sensitive( GTK_WIDGET( 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 // 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 ); 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, gtk_table_attach( GTK_TABLE( table1 ), hshift_step_spinbutton, 3, 4, 2, 3,
(GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
(GtkAttachOptions) ( 0 ), 0, 0 ); (GtkAttachOptions) ( 0 ), 0, 0 );
gtk_spin_button_set_update_policy( GTK_SPIN_BUTTON( hshift_step_spinbutton ), GTK_UPDATE_IF_VALID ); 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 ); 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, gtk_table_attach( GTK_TABLE( table1 ), vshift_step_spinbutton, 3, 4, 4, 5,
(GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
(GtkAttachOptions) ( 0 ), 0, 0 ); (GtkAttachOptions) ( 0 ), 0, 0 );
gtk_spin_button_set_update_policy( GTK_SPIN_BUTTON( vshift_step_spinbutton ), GTK_UPDATE_IF_VALID ); 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 ); 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, gtk_table_attach( GTK_TABLE( table1 ), hscale_step_spinbutton, 3, 4, 6, 7,
(GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
(GtkAttachOptions) ( 0 ), 0, 0 ); (GtkAttachOptions) ( 0 ), 0, 0 );
gtk_spin_button_set_update_policy( GTK_SPIN_BUTTON( hscale_step_spinbutton ), GTK_UPDATE_IF_VALID ); 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 ); 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, gtk_table_attach( GTK_TABLE( table1 ), vscale_step_spinbutton, 3, 4, 8, 9,
(GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
(GtkAttachOptions) ( 0 ), 0, 0 ); (GtkAttachOptions) ( 0 ), 0, 0 );
gtk_spin_button_set_update_policy( GTK_SPIN_BUTTON( vscale_step_spinbutton ), GTK_UPDATE_IF_VALID ); 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 ); 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, gtk_table_attach( GTK_TABLE( table1 ), rotate_step_spinbutton, 3, 4, 10, 11,
(GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
(GtkAttachOptions) ( 0 ), 0, 0 ); (GtkAttachOptions) ( 0 ), 0, 0 );
gtk_spin_button_set_update_policy( GTK_SPIN_BUTTON( rotate_step_spinbutton ), GTK_UPDATE_IF_VALID ); 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(); eventbox = gtk_event_box_new();
gtk_widget_show( eventbox );
gtk_table_attach( GTK_TABLE( table1 ), eventbox, 2, 3, 12, 13, gtk_table_attach( GTK_TABLE( table1 ), eventbox, 2, 3, 12, 13,
(GtkAttachOptions) ( 0 ), (GtkAttachOptions) ( 0 ),
(GtkAttachOptions) ( 0 ), 0, 0 ); (GtkAttachOptions) ( 0 ), 0, 0 );
gtk_widget_show( eventbox );
eventbox = gtk_event_box_new(); eventbox = gtk_event_box_new();
gtk_widget_show( eventbox );
gtk_table_attach( GTK_TABLE( table1 ), eventbox, 0, 1, 12, 13, gtk_table_attach( GTK_TABLE( table1 ), eventbox, 0, 1, 12, 13,
(GtkAttachOptions) ( 0 ), (GtkAttachOptions) ( 0 ),
(GtkAttachOptions) ( 0 ), 0, 0 ); (GtkAttachOptions) ( 0 ), 0, 0 );
gtk_widget_show( eventbox );
eventbox = gtk_event_box_new(); eventbox = gtk_event_box_new();
gtk_widget_show( eventbox );
gtk_table_attach( GTK_TABLE( table1 ), eventbox, 0, 1, 0, 1, gtk_table_attach( GTK_TABLE( table1 ), eventbox, 0, 1, 0, 1,
(GtkAttachOptions) ( 0 ), (GtkAttachOptions) ( 0 ),
(GtkAttachOptions) ( 0 ), 0, 0 ); (GtkAttachOptions) ( 0 ), 0, 0 );
gtk_widget_show( eventbox );
viewport7 = gtk_viewport_new( NULL, NULL ); viewport7 = gtk_viewport_new( NULL, NULL );
gtk_widget_show( viewport7 );
gtk_box_pack_start( GTK_BOX( vbox7 ), viewport7, FALSE, TRUE, 0 ); gtk_box_pack_start( GTK_BOX( vbox7 ), viewport7, FALSE, TRUE, 0 );
gtk_container_set_border_width( GTK_CONTAINER( viewport7 ), 2 ); gtk_container_set_border_width( GTK_CONTAINER( viewport7 ), 2 );
gtk_viewport_set_shadow_type( GTK_VIEWPORT( viewport7 ), GTK_SHADOW_ETCHED_IN ); gtk_viewport_set_shadow_type( GTK_VIEWPORT( viewport7 ), GTK_SHADOW_ETCHED_IN );
gtk_widget_show( viewport7 );
table4 = gtk_table_new( 4, 7, FALSE ); table4 = gtk_table_new( 4, 7, FALSE );
gtk_widget_show( table4 );
gtk_container_add( GTK_CONTAINER( viewport7 ), table4 ); gtk_container_add( GTK_CONTAINER( viewport7 ), table4 );
gtk_widget_show( table4 );
viewport5 = gtk_viewport_new( NULL, NULL ); viewport5 = gtk_viewport_new( NULL, NULL );
gtk_widget_show( viewport5 );
gtk_table_attach( GTK_TABLE( table4 ), viewport5, 1, 7, 0, 4, gtk_table_attach( GTK_TABLE( table4 ), viewport5, 1, 7, 0, 4,
(GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
(GtkAttachOptions) ( 0 ), 0, 0 ); (GtkAttachOptions) ( 0 ), 0, 0 );
gtk_container_set_border_width( GTK_CONTAINER( viewport5 ), 6 ); gtk_container_set_border_width( GTK_CONTAINER( viewport5 ), 6 );
gtk_viewport_set_shadow_type( GTK_VIEWPORT( viewport5 ), GTK_SHADOW_ETCHED_OUT ); gtk_viewport_set_shadow_type( GTK_VIEWPORT( viewport5 ), GTK_SHADOW_ETCHED_OUT );
gtk_widget_show( viewport5 );
table5 = gtk_table_new( 2, 3, FALSE ); table5 = gtk_table_new( 2, 3, FALSE );
gtk_widget_show( table5 );
gtk_container_add( GTK_CONTAINER( viewport5 ), table5 ); gtk_container_add( GTK_CONTAINER( viewport5 ), table5 );
gtk_container_set_border_width( GTK_CONTAINER( table5 ), 5 ); gtk_container_set_border_width( GTK_CONTAINER( table5 ), 5 );
gtk_table_set_col_spacings( GTK_TABLE( table5 ), 2 ); gtk_table_set_col_spacings( GTK_TABLE( table5 ), 2 );
gtk_widget_show( table5 );
label = gtk_label_new( _( "Height" ) ); label = gtk_label_new( _( "Height" ) );
gtk_widget_show( label );
gtk_table_attach( GTK_TABLE( table5 ), label, 2, 3, 0, 1, gtk_table_attach( GTK_TABLE( table5 ), label, 2, 3, 0, 1,
(GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
(GtkAttachOptions) ( GTK_FILL ), 0, 0 ); (GtkAttachOptions) ( GTK_FILL ), 0, 0 );
gtk_label_set_justify( GTK_LABEL( label ), GTK_JUSTIFY_LEFT ); gtk_label_set_justify( GTK_LABEL( label ), GTK_JUSTIFY_LEFT );
gtk_misc_set_alignment( GTK_MISC( label ), 0.5, 1 ); gtk_misc_set_alignment( GTK_MISC( label ), 0.5, 1 );
gtk_widget_show( label );
label = gtk_label_new( _( "Width" ) ); label = gtk_label_new( _( "Width" ) );
gtk_widget_show( label );
gtk_table_attach( GTK_TABLE( table5 ), label, 1, 2, 0, 1, gtk_table_attach( GTK_TABLE( table5 ), label, 1, 2, 0, 1,
(GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
(GtkAttachOptions) ( GTK_FILL ), 0, 0 ); (GtkAttachOptions) ( GTK_FILL ), 0, 0 );
gtk_label_set_justify( GTK_LABEL( label ), GTK_JUSTIFY_LEFT ); gtk_label_set_justify( GTK_LABEL( label ), GTK_JUSTIFY_LEFT );
gtk_misc_set_alignment( GTK_MISC( label ), 0.5, 1 ); 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 ); 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, gtk_table_attach( GTK_TABLE( table5 ), fit_width_spinbutton, 1, 2, 1, 2,
(GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
(GtkAttachOptions) ( GTK_FILL ), 0, 0 ); (GtkAttachOptions) ( GTK_FILL ), 0, 0 );
gtk_spin_button_set_numeric( GTK_SPIN_BUTTON( fit_width_spinbutton ), TRUE ); 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 ); 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 ); 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, gtk_table_attach( GTK_TABLE( table5 ), fit_height_spinbutton, 2, 3, 1, 2,
(GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
(GtkAttachOptions) ( GTK_FILL ), 3, 0 ); (GtkAttachOptions) ( GTK_FILL ), 3, 0 );
gtk_spin_button_set_numeric( GTK_SPIN_BUTTON( fit_height_spinbutton ), TRUE ); 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 ); 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(); eventbox = gtk_event_box_new();
gtk_widget_show( eventbox );
gtk_table_attach( GTK_TABLE( table5 ), eventbox, 0, 1, 0, 1, gtk_table_attach( GTK_TABLE( table5 ), eventbox, 0, 1, 0, 1,
(GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
(GtkAttachOptions) ( GTK_FILL ), 0, 0 ); (GtkAttachOptions) ( GTK_FILL ), 0, 0 );
gtk_widget_show( eventbox );
eventbox = gtk_event_box_new(); eventbox = gtk_event_box_new();
gtk_widget_show( eventbox );
gtk_table_attach( GTK_TABLE( table5 ), eventbox, 0, 1, 1, 2, gtk_table_attach( GTK_TABLE( table5 ), eventbox, 0, 1, 1, 2,
(GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
(GtkAttachOptions) ( GTK_FILL ), 4, 0 ); (GtkAttachOptions) ( GTK_FILL ), 4, 0 );
gtk_widget_show( eventbox );
fit_button = gtk_button_new_with_mnemonic( _( "Fit" ) ); fit_button = gtk_button_new_with_mnemonic( _( "Fit" ) );
gtk_widget_show( fit_button );
gtk_container_add( GTK_CONTAINER( eventbox ), fit_button ); gtk_container_add( GTK_CONTAINER( eventbox ), fit_button );
gtk_widget_show( fit_button );
viewport6 = gtk_viewport_new( NULL, NULL ); viewport6 = gtk_viewport_new( NULL, NULL );
gtk_widget_show( viewport6 );
gtk_table_attach( GTK_TABLE( table4 ), viewport6, 0, 1, 0, 4, gtk_table_attach( GTK_TABLE( table4 ), viewport6, 0, 1, 0, 4,
(GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
(GtkAttachOptions) ( 0 ), 0, 0 ); (GtkAttachOptions) ( 0 ), 0, 0 );
gtk_container_set_border_width( GTK_CONTAINER( viewport6 ), 4 ); gtk_container_set_border_width( GTK_CONTAINER( viewport6 ), 4 );
gtk_viewport_set_shadow_type( GTK_VIEWPORT( viewport6 ), GTK_SHADOW_NONE ); gtk_viewport_set_shadow_type( GTK_VIEWPORT( viewport6 ), GTK_SHADOW_NONE );
gtk_widget_show( viewport6 );
table7 = gtk_table_new( 2, 1, FALSE ); table7 = gtk_table_new( 2, 1, FALSE );
gtk_widget_show( table7 );
gtk_container_add( GTK_CONTAINER( viewport6 ), table7 ); gtk_container_add( GTK_CONTAINER( viewport6 ), table7 );
gtk_widget_show( table7 );
eventbox = gtk_event_box_new(); eventbox = gtk_event_box_new();
gtk_widget_show( eventbox );
gtk_table_attach( GTK_TABLE( table7 ), eventbox, 0, 1, 0, 2, gtk_table_attach( GTK_TABLE( table7 ), eventbox, 0, 1, 0, 2,
(GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
(GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), 0, 0 ); (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), 0, 0 );
gtk_widget_show( eventbox );
axial_button = gtk_button_new_with_mnemonic( _( "Axial" ) ); axial_button = gtk_button_new_with_mnemonic( _( "Axial" ) );
gtk_widget_show( axial_button );
gtk_container_add( GTK_CONTAINER( eventbox ), axial_button ); gtk_container_add( GTK_CONTAINER( eventbox ), axial_button );
gtk_widget_set_size_request( axial_button, 56, 29 ); gtk_widget_set_size_request( axial_button, 56, 29 );
gtk_container_set_border_width( GTK_CONTAINER( axial_button ), 4 ); gtk_container_set_border_width( GTK_CONTAINER( axial_button ), 4 );
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 ); hbuttonbox1 = gtk_hbox_new( FALSE, 5 );
gtk_widget_show( hbuttonbox1 );
gtk_box_pack_start( GTK_BOX( vbox7 ), hbuttonbox1, TRUE, FALSE, 0 ); gtk_box_pack_start( GTK_BOX( vbox7 ), hbuttonbox1, TRUE, FALSE, 0 );
gtk_widget_show( hbuttonbox1 );
// closing the window (upper right window manager click) // closing the window (upper right window manager click)
g_signal_connect( (gpointer) SurfaceInspector, g_signal_connect( (gpointer) SurfaceInspector,
"delete-event", "delete-event",
G_CALLBACK( apply_and_hide ), G_CALLBACK( apply_and_hide ),
NULL ); NULL );
g_signal_connect( (gpointer) SurfaceInspector, "destroy", g_signal_connect( (gpointer) SurfaceInspector, "destroy",
G_CALLBACK( gtk_widget_destroy ), G_CALLBACK( gtk_widget_destroy ),
NULL ); NULL );
@ -1165,7 +1181,7 @@ GtkWidget* create_SurfaceInspector( void ){
G_CALLBACK( on_texture_combo_entry_key_press_event ), G_CALLBACK( on_texture_combo_entry_key_press_event ),
NULL ); NULL );
g_signal_connect( (gpointer) SurfaceInspector, "key-press-event", g_signal_connect( (gpointer) SurfaceInspector, "key-press-event",
G_CALLBACK( surface_dialog_key_press ), G_CALLBACK( surface_dialog_key_press ),
NULL ); NULL );
@ -1230,7 +1246,7 @@ GtkWidget* create_SurfaceInspector( void ){
// Texture Combo // Texture Combo
gboolean on_texture_combo_entry_key_press_event( GtkWidget *widget, GdkEventKey *event, gpointer user_data ){ gboolean on_texture_combo_entry_key_press_event( GtkWidget *widget, GdkEventKey *event, gpointer user_data ){
// Have Tab activate selection as well as Return // 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" ); g_signal_emit_by_name( texture_combo_entry, "activate" );
} }

View file

@ -539,8 +539,8 @@ void FitAll(){
GtkWidget* create_SurfaceInspector( void ){ GtkWidget* create_SurfaceInspector( void ){
GtkWidget *label; GtkWidget *label;
GtkObject *adjustment; GtkAdjustment *adjustment;
GtkSizeGroup *size_group;
GtkWidget *table1; GtkWidget *table1;
GtkWidget *table2; GtkWidget *table2;
@ -557,246 +557,268 @@ GtkWidget* create_SurfaceInspector( void ){
SetWinPos_from_Prefs( SurfaceInspector ); SetWinPos_from_Prefs( SurfaceInspector );
vbox1 = gtk_vbox_new( FALSE, 5 ); vbox1 = gtk_vbox_new( FALSE, 5 );
gtk_widget_show( vbox1 );
gtk_container_add( GTK_CONTAINER( SurfaceInspector ), vbox1 ); gtk_container_add( GTK_CONTAINER( SurfaceInspector ), vbox1 );
gtk_widget_show( vbox1 );
hbox1 = gtk_hbox_new( FALSE, 5 ); hbox1 = gtk_hbox_new( FALSE, 5 );
gtk_widget_show( hbox1 );
gtk_container_add( GTK_CONTAINER( vbox1 ), hbox1 ); gtk_container_add( GTK_CONTAINER( vbox1 ), hbox1 );
gtk_container_set_border_width( GTK_CONTAINER( hbox1 ), 4 ); gtk_container_set_border_width( GTK_CONTAINER( hbox1 ), 4 );
gtk_widget_show( hbox1 );
label = gtk_label_new( _( "Texture: " ) ); label = gtk_label_new( _( "Texture: " ) );
gtk_widget_show( label );
gtk_box_pack_start( GTK_BOX( hbox1 ), label, FALSE, FALSE, 0 ); gtk_box_pack_start( GTK_BOX( hbox1 ), label, FALSE, FALSE, 0 );
gtk_misc_set_alignment( GTK_MISC( label ), 1, 0.5 ); gtk_misc_set_alignment( GTK_MISC( label ), 1, 0.5 );
gtk_widget_show( label );
texture_combo = gtk_combo_new(); texture_combo = gtk_combo_new();
g_object_set_data( G_OBJECT( GTK_COMBO( texture_combo )->popwin ), g_object_set_data( G_OBJECT( GTK_COMBO( texture_combo )->popwin ),
"KeepMeAround", texture_combo ); "KeepMeAround", texture_combo );
gtk_combo_disable_activate( (GtkCombo*) 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_box_pack_start( GTK_BOX( hbox1 ), texture_combo, TRUE, TRUE, 0 );
gtk_widget_show( texture_combo );
texture_combo_entry = GTK_COMBO( texture_combo )->entry; 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_entry_set_max_length( GTK_ENTRY( texture_combo_entry ), 1024 );
gtk_widget_show( texture_combo_entry );
frame1 = gtk_frame_new( _( "Surface" ) ); frame1 = gtk_frame_new( _( "Surface" ) );
gtk_widget_show( frame1 );
gtk_container_add( GTK_CONTAINER( vbox1 ), frame1 ); gtk_container_add( GTK_CONTAINER( vbox1 ), frame1 );
gtk_widget_show( frame1 );
table1 = gtk_table_new( 7, 3, FALSE ); table1 = gtk_table_new( 7, 3, FALSE );
gtk_widget_show( table1 );
gtk_table_set_col_spacings( GTK_TABLE( table1 ), 5 ); gtk_table_set_col_spacings( GTK_TABLE( table1 ), 5 );
gtk_table_set_row_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_set_border_width( GTK_CONTAINER( table1 ), 5 );
gtk_container_add( GTK_CONTAINER( frame1 ), table1 ); gtk_container_add( GTK_CONTAINER( frame1 ), table1 );
gtk_widget_show( table1 );
label = gtk_label_new( _( "Step" ) ); label = gtk_label_new( _( "Step" ) );
gtk_widget_show( label );
gtk_table_attach( GTK_TABLE( table1 ), label, 2, 3, 0, 1, gtk_table_attach( GTK_TABLE( table1 ), label, 2, 3, 0, 1,
(GtkAttachOptions) ( GTK_FILL ), (GtkAttachOptions) ( GTK_FILL ),
(GtkAttachOptions) ( 0 ), 0, 0 ); (GtkAttachOptions) ( 0 ), 0, 0 );
gtk_widget_show( label );
label = gtk_label_new( _( "Value" ) ); label = gtk_label_new( _( "Value" ) );
gtk_widget_show( label );
gtk_table_attach( GTK_TABLE( table1 ), label, 1, 2, 0, 1, gtk_table_attach( GTK_TABLE( table1 ), label, 1, 2, 0, 1,
(GtkAttachOptions) ( GTK_FILL ), (GtkAttachOptions) ( GTK_FILL ),
(GtkAttachOptions) ( 0 ), 0, 0 ); (GtkAttachOptions) ( 0 ), 0, 0 );
gtk_misc_set_alignment( GTK_MISC( label ), 0.5, 1 ); gtk_misc_set_alignment( GTK_MISC( label ), 0.5, 1 );
gtk_widget_show( label );
label = gtk_label_new( _( "Horizontal shift: " ) ); label = gtk_label_new( _( "Horizontal shift: " ) );
gtk_widget_show( label );
gtk_table_attach( GTK_TABLE( table1 ), label, 0, 1, 1, 2, gtk_table_attach( GTK_TABLE( table1 ), label, 0, 1, 1, 2,
(GtkAttachOptions) ( GTK_FILL ), (GtkAttachOptions) ( GTK_FILL ),
(GtkAttachOptions) ( GTK_FILL ), 0, 0 ); (GtkAttachOptions) ( GTK_FILL ), 0, 0 );
gtk_widget_show( label );
label = gtk_label_new( _( "Vertical shift: " ) ); label = gtk_label_new( _( "Vertical shift: " ) );
gtk_widget_show( label );
gtk_table_attach( GTK_TABLE( table1 ), label, 0, 1, 2, 3, gtk_table_attach( GTK_TABLE( table1 ), label, 0, 1, 2, 3,
(GtkAttachOptions) ( GTK_FILL ), (GtkAttachOptions) ( GTK_FILL ),
(GtkAttachOptions) ( GTK_FILL ), 0, 0 ); (GtkAttachOptions) ( GTK_FILL ), 0, 0 );
gtk_widget_show( label );
label = gtk_label_new( _( "Horizontal scale: " ) ); label = gtk_label_new( _( "Horizontal scale: " ) );
gtk_widget_show( label );
gtk_table_attach( GTK_TABLE( table1 ), label, 0, 1, 3, 4, gtk_table_attach( GTK_TABLE( table1 ), label, 0, 1, 3, 4,
(GtkAttachOptions) ( GTK_FILL ), (GtkAttachOptions) ( GTK_FILL ),
(GtkAttachOptions) ( GTK_FILL ), 0, 0 ); (GtkAttachOptions) ( GTK_FILL ), 0, 0 );
gtk_widget_show( label );
label = gtk_label_new( _( "Vertical scale: " ) ); label = gtk_label_new( _( "Vertical scale: " ) );
gtk_widget_show( label );
gtk_table_attach( GTK_TABLE( table1 ), label, 0, 1, 4, 5, gtk_table_attach( GTK_TABLE( table1 ), label, 0, 1, 4, 5,
(GtkAttachOptions) ( GTK_FILL ), (GtkAttachOptions) ( GTK_FILL ),
(GtkAttachOptions) ( GTK_FILL ), 0, 0 ); (GtkAttachOptions) ( GTK_FILL ), 0, 0 );
gtk_widget_show( label );
label = gtk_label_new( _( "Rotate: " ) ); label = gtk_label_new( _( "Rotate: " ) );
gtk_widget_show( label );
gtk_table_attach( GTK_TABLE( table1 ), label, 0, 1, 5, 6, gtk_table_attach( GTK_TABLE( table1 ), label, 0, 1, 5, 6,
(GtkAttachOptions) ( GTK_FILL ), (GtkAttachOptions) ( GTK_FILL ),
(GtkAttachOptions) ( GTK_FILL ), 0, 0 ); (GtkAttachOptions) ( GTK_FILL ), 0, 0 );
gtk_widget_show( label );
// Value Spins // 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 ); 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, gtk_table_attach( GTK_TABLE( table1 ), hshift_value_spinbutton, 1, 2, 1, 2,
(GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
(GtkAttachOptions) ( 0 ), 0, 0 ); (GtkAttachOptions) ( 0 ), 0, 0 );
gtk_spin_button_set_update_policy( GTK_SPIN_BUTTON( hshift_value_spinbutton ), GTK_UPDATE_IF_VALID ); 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_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 ); 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, gtk_table_attach( GTK_TABLE( table1 ), vshift_value_spinbutton, 1, 2, 2, 3,
(GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
(GtkAttachOptions) ( 0 ), 0, 0 ); (GtkAttachOptions) ( 0 ), 0, 0 );
gtk_spin_button_set_update_policy( GTK_SPIN_BUTTON( vshift_value_spinbutton ), GTK_UPDATE_IF_VALID ); 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_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 ); 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, gtk_table_attach( GTK_TABLE( table1 ), hscale_value_spinbutton, 1, 2, 3, 4,
(GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
(GtkAttachOptions) ( 0 ), 0, 0 ); (GtkAttachOptions) ( 0 ), 0, 0 );
gtk_spin_button_set_update_policy( GTK_SPIN_BUTTON( hscale_value_spinbutton ), GTK_UPDATE_IF_VALID ); 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_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 ); 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, gtk_table_attach( GTK_TABLE( table1 ), vscale_value_spinbutton, 1, 2, 4, 5,
(GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
(GtkAttachOptions) ( 0 ), 0, 0 ); (GtkAttachOptions) ( 0 ), 0, 0 );
gtk_spin_button_set_update_policy( GTK_SPIN_BUTTON( vscale_value_spinbutton ), GTK_UPDATE_IF_VALID ); 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 ); 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, gtk_table_attach( GTK_TABLE( table1 ), rotate_value_spinbutton, 1, 2, 5, 6,
(GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
(GtkAttachOptions) ( 0 ), 0, 0 ); (GtkAttachOptions) ( 0 ), 0, 0 );
gtk_spin_button_set_update_policy( GTK_SPIN_BUTTON( rotate_value_spinbutton ), GTK_UPDATE_IF_VALID ); 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_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 // 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 ); 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, gtk_table_attach( GTK_TABLE( table1 ), hshift_step_spinbutton, 2, 3, 1, 2,
(GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
(GtkAttachOptions) ( 0 ), 0, 0 ); (GtkAttachOptions) ( 0 ), 0, 0 );
gtk_spin_button_set_update_policy( GTK_SPIN_BUTTON( hshift_step_spinbutton ), GTK_UPDATE_IF_VALID ); 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 ); 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, gtk_table_attach( GTK_TABLE( table1 ), vshift_step_spinbutton, 2, 3, 2, 3,
(GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
(GtkAttachOptions) ( 0 ), 0, 0 ); (GtkAttachOptions) ( 0 ), 0, 0 );
gtk_spin_button_set_update_policy( GTK_SPIN_BUTTON( vshift_step_spinbutton ), GTK_UPDATE_IF_VALID ); 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 ); 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, gtk_table_attach( GTK_TABLE( table1 ), hscale_step_spinbutton, 2, 3, 3, 4,
(GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
(GtkAttachOptions) ( 0 ), 0, 0 ); (GtkAttachOptions) ( 0 ), 0, 0 );
gtk_spin_button_set_update_policy( GTK_SPIN_BUTTON( hscale_step_spinbutton ), GTK_UPDATE_IF_VALID ); 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 ); 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, gtk_table_attach( GTK_TABLE( table1 ), vscale_step_spinbutton, 2, 3, 4, 5,
(GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
(GtkAttachOptions) ( 0 ), 0, 0 ); (GtkAttachOptions) ( 0 ), 0, 0 );
gtk_spin_button_set_update_policy( GTK_SPIN_BUTTON( vscale_step_spinbutton ), GTK_UPDATE_IF_VALID ); 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 ); 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, gtk_table_attach( GTK_TABLE( table1 ), rotate_step_spinbutton, 2, 3, 5, 6,
(GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
(GtkAttachOptions) ( 0 ), 0, 0 ); (GtkAttachOptions) ( 0 ), 0, 0 );
gtk_spin_button_set_update_policy( GTK_SPIN_BUTTON( rotate_step_spinbutton ), GTK_UPDATE_IF_VALID ); 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" ) ); 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, gtk_table_attach( GTK_TABLE( table1 ), match_grid_button, 2, 3, 6, 7,
(GtkAttachOptions) ( GTK_FILL ), (GtkAttachOptions) ( GTK_FILL ),
(GtkAttachOptions) ( 0 ), 0, 0 ); (GtkAttachOptions) ( 0 ), 0, 0 );
gtk_widget_show( match_grid_button );
frame2 = gtk_frame_new( _( "Tools" ) ); frame2 = gtk_frame_new( _( "Tools" ) );
gtk_widget_show( frame2 );
gtk_container_add( GTK_CONTAINER( vbox1 ), frame2 ); gtk_container_add( GTK_CONTAINER( vbox1 ), frame2 );
gtk_widget_show( frame2 );
table2 = gtk_table_new( 2, 4, TRUE ); table2 = gtk_table_new( 2, 4, TRUE );
gtk_widget_show( table2 );
gtk_table_set_col_spacings( GTK_TABLE( table2), 5 ); gtk_table_set_col_spacings( GTK_TABLE( table2), 5 );
gtk_table_set_row_spacings( GTK_TABLE( table2 ), 0 ); gtk_table_set_row_spacings( GTK_TABLE( table2 ), 0 );
gtk_container_set_border_width( GTK_CONTAINER( table2 ), 5 ); gtk_container_set_border_width( GTK_CONTAINER( table2 ), 5 );
gtk_container_add( GTK_CONTAINER( frame2 ), table2 ); gtk_container_add( GTK_CONTAINER( frame2 ), table2 );
gtk_widget_show( table2 );
label = gtk_label_new( _( "Height" ) ); label = gtk_label_new( _( "Height" ) );
gtk_widget_show( label );
gtk_table_attach( GTK_TABLE( table2 ), label, 3, 4, 0, 1, gtk_table_attach( GTK_TABLE( table2 ), label, 3, 4, 0, 1,
(GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
(GtkAttachOptions) ( 0 ), 0, 0 ); (GtkAttachOptions) ( 0 ), 0, 0 );
gtk_widget_show( label );
label = gtk_label_new( _( "Width" ) ); label = gtk_label_new( _( "Width" ) );
gtk_widget_show( label );
gtk_table_attach( GTK_TABLE( table2 ), label, 2, 3, 0, 1, gtk_table_attach( GTK_TABLE( table2 ), label, 2, 3, 0, 1,
(GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
(GtkAttachOptions) ( 0 ), 0, 0 ); (GtkAttachOptions) ( 0 ), 0, 0 );
gtk_widget_show( label );
label = gtk_label_new( _( "Brush" ) ); label = gtk_label_new( _( "Brush" ) );
gtk_widget_show( label );
gtk_table_attach( GTK_TABLE( table2 ), label, 0, 2, 0, 1, gtk_table_attach( GTK_TABLE( table2 ), label, 0, 2, 0, 1,
(GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
(GtkAttachOptions) ( 0 ), 0, 0 ); (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 ); 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, gtk_table_attach( GTK_TABLE( table2 ), fit_height_spinbutton, 3, 4, 1, 2,
(GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
(GtkAttachOptions) ( 0 ), 0, 0 ); (GtkAttachOptions) ( 0 ), 0, 0 );
gtk_spin_button_set_numeric( GTK_SPIN_BUTTON( fit_height_spinbutton ), TRUE ); 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 ); 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 ); 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, gtk_table_attach( GTK_TABLE( table2 ), fit_width_spinbutton, 2, 3, 1, 2,
(GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
(GtkAttachOptions) ( 0 ), 0, 0 ); (GtkAttachOptions) ( 0 ), 0, 0 );
gtk_spin_button_set_numeric( GTK_SPIN_BUTTON( fit_width_spinbutton ), TRUE ); 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 ); 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" ) ); 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, gtk_table_attach( GTK_TABLE( table2 ), fit_button, 1, 2, 1, 2,
(GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
(GtkAttachOptions) ( 0 ), 0, 0 ); (GtkAttachOptions) ( 0 ), 0, 0 );
gtk_widget_show( fit_button );
axial_button = gtk_button_new_with_mnemonic( _( "Axial" ) ); 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, gtk_table_attach( GTK_TABLE( table2 ), axial_button, 0, 1, 1, 2,
(GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
(GtkAttachOptions) ( 0 ), 0, 0 ); (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 // Add the SURF_ and CONTENTS_ flags frame
create_SurfaceFlagsFrame( vbox1 ); create_SurfaceFlagsFrame( vbox1 );
@ -877,7 +899,7 @@ GtkWidget* create_SurfaceInspector( void ){
gboolean on_texture_combo_entry_key_press_event( GtkWidget *widget, GdkEventKey *event, gboolean on_texture_combo_entry_key_press_event( GtkWidget *widget, GdkEventKey *event,
gpointer user_data ){ gpointer user_data ){
// Have Tab activate selection as well as Return // 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" ); g_signal_emit_by_name( texture_combo_entry, "activate" );
} }

View file

@ -305,28 +305,29 @@ GtkWidget* create_SurfaceFlagsFrame( GtkWidget* surfacedialog_widget ){
char buffer[8]; char buffer[8];
frame1 = gtk_frame_new( _( "Flags" ) ); frame1 = gtk_frame_new( _( "Flags" ) );
gtk_widget_show( frame1 );
gtk_container_add( GTK_CONTAINER( surfacedialog_widget ), frame1 ); gtk_container_add( GTK_CONTAINER( surfacedialog_widget ), frame1 );
gtk_widget_show( frame1 );
vbox1 = gtk_vbox_new( FALSE, 0 ); vbox1 = gtk_vbox_new( FALSE, 0 );
gtk_widget_show( vbox1 );
gtk_container_add( GTK_CONTAINER( frame1 ), vbox1 ); gtk_container_add( GTK_CONTAINER( frame1 ), vbox1 );
gtk_widget_show( vbox1 );
notebook1 = gtk_notebook_new(); notebook1 = gtk_notebook_new();
gtk_widget_show( notebook1 );
gtk_box_pack_start( GTK_BOX( vbox1 ), notebook1, TRUE, TRUE, 0 ); gtk_box_pack_start( GTK_BOX( vbox1 ), notebook1, TRUE, TRUE, 0 );
gtk_notebook_set_show_tabs( GTK_NOTEBOOK( notebook1 ), TRUE ); gtk_notebook_set_show_tabs( GTK_NOTEBOOK( notebook1 ), TRUE );
gtk_container_set_border_width( GTK_CONTAINER( notebook1 ), 5 ); gtk_container_set_border_width( GTK_CONTAINER( notebook1 ), 5 );
gtk_widget_show( notebook1 );
vbox2 = gtk_vbox_new( FALSE, 5 ); vbox2 = gtk_vbox_new( FALSE, 5 );
gtk_widget_show( vbox2 );
gtk_container_add( GTK_CONTAINER( notebook1 ), vbox2 ); gtk_container_add( GTK_CONTAINER( notebook1 ), vbox2 );
gtk_widget_show( vbox2 );
table4 = gtk_table_new( 8, 4, TRUE ); table4 = gtk_table_new( 8, 4, TRUE );
gtk_widget_show( table4 );
gtk_table_set_col_spacings( GTK_TABLE( table4 ), 5 ); gtk_table_set_col_spacings( GTK_TABLE( table4 ), 5 );
gtk_table_set_row_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_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; y = -1;
for ( i = 0; i < MAX_BUTTONS; i++ ) { for ( i = 0; i < MAX_BUTTONS; i++ ) {
@ -339,27 +340,28 @@ GtkWidget* create_SurfaceFlagsFrame( GtkWidget* surfacedialog_widget ){
//Sys_Printf( "%s: %s\n", buffer, buttonLabel ); //Sys_Printf( "%s: %s\n", buffer, buttonLabel );
surface_buttons[i] = gtk_toggle_button_new_with_label( 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 ) ); 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 ), 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 ),
(GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), 0, 0 ); (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), 0, 0 );
gtk_widget_show( surface_buttons[i] );
} }
hbox2 = gtk_hbox_new( FALSE, 0 ); hbox2 = gtk_hbox_new( FALSE, 0 );
gtk_widget_show( hbox2 );
gtk_box_pack_start( GTK_BOX( vbox2 ), hbox2, FALSE, FALSE, 0 ); 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 ); hbox3 = gtk_hbox_new( FALSE, 0 );
gtk_widget_show( hbox3 );
gtk_box_pack_start( GTK_BOX( hbox2 ), hbox3, TRUE, TRUE, 0 ); gtk_box_pack_start( GTK_BOX( hbox2 ), hbox3, TRUE, TRUE, 0 );
gtk_widget_show( hbox3 );
vbox4 = gtk_vbox_new( FALSE, 0 ); vbox4 = gtk_vbox_new( FALSE, 0 );
gtk_widget_show( vbox4 );
gtk_box_pack_start( GTK_BOX( hbox3 ), vbox4, TRUE, TRUE, 0 ); gtk_box_pack_start( GTK_BOX( hbox3 ), vbox4, TRUE, TRUE, 0 );
gtk_widget_show( vbox4 );
value_label = gtk_label_new( _( "Value: " ) ); value_label = gtk_label_new( _( "Value: " ) );
gtk_widget_show( value_label );
gtk_box_pack_start( GTK_BOX( hbox3 ), value_label, FALSE, FALSE, 0 ); gtk_box_pack_start( GTK_BOX( hbox3 ), value_label, FALSE, FALSE, 0 );
gtk_widget_show( value_label );
value_entry = gtk_entry_new(); value_entry = gtk_entry_new();
g_signal_connect( G_OBJECT( value_entry ), "changed", 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 ), G_CALLBACK( on_value_entry_insert_text ),
NULL ); NULL );
gtk_entry_set_max_length( (GtkEntry *)value_entry, 11 ); 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_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 ); vbox3 = gtk_vbox_new( FALSE, 0 );
gtk_widget_show( vbox3 );
gtk_box_pack_start( GTK_BOX( hbox3 ), vbox3, TRUE, TRUE, 0 ); gtk_box_pack_start( GTK_BOX( hbox3 ), vbox3, TRUE, TRUE, 0 );
gtk_widget_show( vbox3 );
label5 = gtk_label_new( _( "Surface Flags" ) ); 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_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 ); table3 = gtk_table_new( 8, 4, TRUE );
gtk_widget_show( table3 );
gtk_table_set_col_spacings( GTK_TABLE( table3 ), 5 ); gtk_table_set_col_spacings( GTK_TABLE( table3 ), 5 );
gtk_table_set_row_spacings( GTK_TABLE( table3 ), 5 ); gtk_table_set_row_spacings( GTK_TABLE( table3 ), 5 );
gtk_container_add( GTK_CONTAINER( notebook1 ), table3 ); gtk_container_add( GTK_CONTAINER( notebook1 ), table3 );
gtk_container_set_border_width( GTK_CONTAINER( table3 ), 5 );
gtk_widget_show( table3 );
y = -1; y = -1;
for ( i = 0; i < MAX_BUTTONS; i++ ) { for ( i = 0; i < MAX_BUTTONS; i++ ) {
@ -396,10 +400,10 @@ GtkWidget* create_SurfaceFlagsFrame( GtkWidget* surfacedialog_widget ){
buttonLabel = g_FuncTable.m_pfnReadProjectKey( buffer ); buttonLabel = g_FuncTable.m_pfnReadProjectKey( buffer );
content_buttons[i] = gtk_toggle_button_new_with_label( buttonLabel ); 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 ) ); 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 ), 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 ),
(GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), 0, 0 ); (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), 0, 0 );
gtk_widget_show( content_buttons[i] );
} }
label6 = gtk_label_new( _( "Content Flags" ) ); label6 = gtk_label_new( _( "Content Flags" ) );

View file

@ -28,137 +28,7 @@
#include "StdAfx.h" #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 // Radiant function table
_QERFuncTable_1 g_FuncTable; _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" "Gtk port by Leonardo Zide (leo@lokigames.com)\n"
"Original version by Timothee \"TTimo\" Besset (timo@qeradiant.com)"; "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(){ extern "C" void* WINAPI QERPlug_GetFuncTable(){
return &g_FuncTable; return &g_FuncTable;
} }

View file

@ -28,56 +28,31 @@
#include "stdafx.h" #include "stdafx.h"
#include <glib/gi18n.h> #include <glib/gi18n.h>
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 // 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 // the user might decide to switch the BP mode in project settings
// status: 0 = loading regular, got conflict 1 = loading BP, got conflict // status: 0 = loading regular, got conflict 1 = loading BP, got conflict
int BP_MessageBox( int status ){ int BP_MessageBox( int status ){
GtkWidget *window, *w, *vbox, *hbox; GtkWidget *dialog, *w, *vbox, *hbox, *content_area;
GtkAccelGroup *accel; GtkAccelGroup *accel;
int ret, loop = 1; gint response_id;
GtkDialogFlags flags = GTK_DIALOG_DESTROY_WITH_PARENT;
window = gtk_window_new( GTK_WINDOW_TOPLEVEL ); dialog = gtk_dialog_new_with_buttons( _( "Current map format is incompatible" ), NULL, flags, NULL );
g_signal_connect( G_OBJECT( window ), "delete-event", gtk_window_set_transient_for( GTK_WINDOW( dialog ), GTK_WINDOW( g_pParentWnd->m_pWidget ) );
G_CALLBACK( BP_dialog_delete_callback ), NULL ); gtk_container_set_border_width( GTK_CONTAINER( dialog ), 10 );
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 ) );
accel = gtk_accel_group_new(); 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 ); 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 ); gtk_widget_show( vbox );
if ( status == 0 ) { if ( status == 0 ) {
@ -107,34 +82,10 @@ int BP_MessageBox( int status ){
gtk_box_pack_start( GTK_BOX( vbox ), hbox, FALSE, FALSE, 2 ); gtk_box_pack_start( GTK_BOX( vbox ), hbox, FALSE, FALSE, 2 );
gtk_widget_show( hbox ); 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" ) ); response_id = gtk_dialog_run( GTK_DIALOG( dialog ) );
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 );
w = gtk_button_new_with_label( _( "Abort load" ) ); if( response_id == 2 ) {
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 ) {
// change project settings // change project settings
if ( status == 0 ) { if ( status == 0 ) {
g_qeglobals.m_bBrushPrimitMode = TRUE; 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" ) ); 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 ); return response_id;
gtk_widget_destroy( window );
return ret;
} }

View file

@ -33,7 +33,7 @@
typedef struct typedef struct
{ {
GtkObject *object; GObject *object;
void *buffer; void *buffer;
DLG_DATA_TYPE type; DLG_DATA_TYPE type;
} DLG_DATA; } 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; DLG_DATA *data;
data = (DLG_DATA*)qmalloc( sizeof( DLG_DATA ) ); data = (DLG_DATA*)qmalloc( sizeof( DLG_DATA ) );

View file

@ -70,8 +70,8 @@ bool m_nLoop;
int m_nReturn; int m_nReturn;
void AddDialogData( GtkWidget *widget, void *buf, DLG_DATA_TYPE type ) void AddDialogData( GtkWidget *widget, void *buf, DLG_DATA_TYPE type )
{ AddDialogData( GTK_OBJECT( widget ), buf, type ); }; { AddDialogData( G_OBJECT( widget ), buf, type ); };
void AddDialogData( GtkObject *object, void *buf, DLG_DATA_TYPE type ); void AddDialogData( GObject *object, void *buf, DLG_DATA_TYPE type );
/*! /*!
used in overloaded BuildDialog implementations to configure modal behaviour easily used in overloaded BuildDialog implementations to configure modal behaviour easily
*/ */

View file

@ -38,19 +38,18 @@ GtkWidget *s_pEdit;
void ShowInfoDialog( const char* pText ){ void ShowInfoDialog( const char* pText ){
if ( g_dlgInfo == NULL ) { 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 ); g_dlgInfo = dialog = gtk_dialog_new_with_buttons( _( "Information" ), NULL, flags, NULL );
gtk_window_set_title( GTK_WINDOW( dlg ), _( "Information" ) ); g_signal_connect( G_OBJECT( dialog ), "delete-event", G_CALLBACK( gtk_widget_hide ), NULL );
g_signal_connect( G_OBJECT( dlg ), "delete-event", gtk_window_set_default_size( GTK_WINDOW( dialog ), 300, 150 );
G_CALLBACK( gtk_widget_hide ), NULL );
g_signal_connect( G_OBJECT( dlg ), "destroy", content_area = gtk_dialog_get_content_area( GTK_DIALOG( dialog ) );
G_CALLBACK( gtk_widget_destroy ), NULL );
gtk_window_set_default_size( GTK_WINDOW( dlg ), 300, 150 );
scr = gtk_scrolled_window_new( NULL, NULL ); scr = gtk_scrolled_window_new( NULL, NULL );
gtk_widget_show( scr ); 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_scrolled_window_set_policy( GTK_SCROLLED_WINDOW( scr ), GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC );
gtk_container_set_border_width( GTK_CONTAINER( scr ), 5 ); gtk_container_set_border_width( GTK_CONTAINER( scr ), 5 );
gtk_scrolled_window_set_shadow_type( GTK_SCROLLED_WINDOW( scr ), GTK_SHADOW_IN ); gtk_scrolled_window_set_shadow_type( GTK_SCROLLED_WINDOW( scr ), GTK_SHADOW_IN );

View file

@ -74,7 +74,7 @@ static void find_clicked( GtkWidget *widget, gpointer data ){
item = gtk_menu_item_new_with_label( pShader->getName() ); item = gtk_menu_item_new_with_label( pShader->getName() );
g_signal_connect( G_OBJECT( item ), "activate", G_CALLBACK( popup_selected ), data ); g_signal_connect( G_OBJECT( item ), "activate", G_CALLBACK( popup_selected ), data );
gtk_widget_show( item ); 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 ); 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 ) ); gtk_window_set_transient_for( GTK_WINDOW( dlg ), GTK_WINDOW( g_pParentWnd->m_pWidget ) );
hbox = gtk_hbox_new( FALSE, 5 ); hbox = gtk_hbox_new( FALSE, 5 );
gtk_widget_show( hbox );
gtk_container_add( GTK_CONTAINER( dlg ), hbox ); gtk_container_add( GTK_CONTAINER( dlg ), hbox );
gtk_container_set_border_width( GTK_CONTAINER( hbox ), 5 ); gtk_container_set_border_width( GTK_CONTAINER( hbox ), 5 );
gtk_widget_show( hbox );
vbox = gtk_vbox_new( FALSE, 5 ); vbox = gtk_vbox_new( FALSE, 5 );
gtk_box_pack_start( GTK_BOX( hbox ), vbox, TRUE, TRUE, 5 );
gtk_widget_show( vbox ); gtk_widget_show( vbox );
gtk_box_pack_start( GTK_BOX( hbox ), vbox, TRUE, TRUE, 0 );
table = gtk_table_new( 2, 3, FALSE ); table = gtk_table_new( 2, 3, FALSE );
gtk_widget_show( table );
gtk_box_pack_start( GTK_BOX( vbox ), table, TRUE, TRUE, 0 ); gtk_box_pack_start( GTK_BOX( vbox ), table, TRUE, TRUE, 0 );
gtk_table_set_row_spacings( GTK_TABLE( table ), 5 ); gtk_table_set_row_spacings( GTK_TABLE( table ), 5 );
gtk_table_set_col_spacings( GTK_TABLE( table ), 5 ); gtk_table_set_col_spacings( GTK_TABLE( table ), 5 );
gtk_widget_show( table );
label = gtk_label_new( _( "Find:" ) ); label = gtk_label_new( _( "Find:" ) );
gtk_widget_show( label );
gtk_table_attach( GTK_TABLE( table ), label, 0, 1, 0, 1, gtk_table_attach( GTK_TABLE( table ), label, 0, 1, 0, 1,
(GtkAttachOptions) ( GTK_FILL ), (GtkAttachOptions) ( GTK_FILL ),
(GtkAttachOptions) ( 0 ), 0, 0 ); (GtkAttachOptions) ( 0 ), 0, 0 );
gtk_misc_set_alignment( GTK_MISC( label ), 0, 0.5 ); gtk_misc_set_alignment( GTK_MISC( label ), 0, 0.5 );
gtk_widget_show( label );
label = gtk_label_new( _( "Replace:" ) ); label = gtk_label_new( _( "Replace:" ) );
gtk_widget_show( label );
gtk_table_attach( GTK_TABLE( table ), label, 0, 1, 1, 2, gtk_table_attach( GTK_TABLE( table ), label, 0, 1, 1, 2,
(GtkAttachOptions) ( GTK_FILL ), (GtkAttachOptions) ( GTK_FILL ),
(GtkAttachOptions) ( 0 ), 0, 0 ); (GtkAttachOptions) ( 0 ), 0, 0 );
gtk_misc_set_alignment( GTK_MISC( label ), 0, 0.5 ); gtk_misc_set_alignment( GTK_MISC( label ), 0, 0.5 );
gtk_widget_show( label );
entry = gtk_entry_new(); entry = gtk_entry_new();
gtk_widget_show( entry );
gtk_table_attach( GTK_TABLE( table ), entry, 1, 2, 0, 1, gtk_table_attach( GTK_TABLE( table ), entry, 1, 2, 0, 1,
(GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
(GtkAttachOptions) ( 0 ), 0, 0 ); (GtkAttachOptions) ( 0 ), 0, 0 );
gtk_widget_show( entry );
g_signal_connect( G_OBJECT( entry ), "focus-in-event", g_signal_connect( G_OBJECT( entry ), "focus-in-event",
G_CALLBACK( find_focus_in ), NULL ); G_CALLBACK( find_focus_in ), NULL );
AddDialogData( entry, &m_strFind, DLG_ENTRY_TEXT ); AddDialogData( entry, &m_strFind, DLG_ENTRY_TEXT );
button = gtk_button_new(); button = gtk_button_new();
gtk_widget_show( button );
gtk_table_attach( GTK_TABLE( table ), button, 2, 3, 0, 1, gtk_table_attach( GTK_TABLE( table ), button, 2, 3, 0, 1,
(GtkAttachOptions) ( GTK_FILL ), (GtkAttachOptions) ( GTK_FILL ),
(GtkAttachOptions) ( GTK_FILL ), 0, 0 ); (GtkAttachOptions) ( GTK_FILL ), 0, 0 );
gtk_widget_show( button );
g_signal_connect( G_OBJECT( button ), "clicked", g_signal_connect( G_OBJECT( button ), "clicked",
G_CALLBACK( find_clicked ), entry ); G_CALLBACK( find_clicked ), entry );
arrow = gtk_arrow_new( GTK_ARROW_DOWN, GTK_SHADOW_OUT ); arrow = gtk_arrow_new( GTK_ARROW_DOWN, GTK_SHADOW_OUT );
gtk_widget_show( arrow );
gtk_container_add( GTK_CONTAINER( button ), arrow ); gtk_container_add( GTK_CONTAINER( button ), arrow );
gtk_widget_show( arrow );
entry = gtk_entry_new(); entry = gtk_entry_new();
gtk_widget_show( entry );
gtk_table_attach( GTK_TABLE( table ), entry, 1, 2, 1, 2, gtk_table_attach( GTK_TABLE( table ), entry, 1, 2, 1, 2,
(GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
(GtkAttachOptions) ( 0 ), 0, 0 ); (GtkAttachOptions) ( 0 ), 0, 0 );
gtk_widget_show( entry );
g_signal_connect( G_OBJECT( entry ), "focus-in-event", g_signal_connect( G_OBJECT( entry ), "focus-in-event",
G_CALLBACK( replace_focus_in ), NULL ); G_CALLBACK( replace_focus_in ), NULL );
AddDialogData( entry, &m_strReplace, DLG_ENTRY_TEXT ); AddDialogData( entry, &m_strReplace, DLG_ENTRY_TEXT );
button = gtk_button_new(); button = gtk_button_new();
gtk_widget_show( button );
gtk_table_attach( GTK_TABLE( table ), button, 2, 3, 1, 2, gtk_table_attach( GTK_TABLE( table ), button, 2, 3, 1, 2,
(GtkAttachOptions) ( GTK_FILL ), (GtkAttachOptions) ( GTK_FILL ),
(GtkAttachOptions) ( GTK_FILL ), 0, 0 ); (GtkAttachOptions) ( GTK_FILL ), 0, 0 );
gtk_widget_show( button );
g_signal_connect( G_OBJECT( button ), "clicked", g_signal_connect( G_OBJECT( button ), "clicked",
G_CALLBACK( find_clicked ), entry ); G_CALLBACK( find_clicked ), entry );
arrow = gtk_arrow_new( GTK_ARROW_DOWN, GTK_SHADOW_OUT ); arrow = gtk_arrow_new( GTK_ARROW_DOWN, GTK_SHADOW_OUT );
gtk_widget_show( arrow );
gtk_container_add( GTK_CONTAINER( button ), arrow ); gtk_container_add( GTK_CONTAINER( button ), arrow );
gtk_widget_show( arrow );
check = gtk_check_button_new_with_label( _( "Use selected brushes only" ) ); 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_box_pack_start( GTK_BOX( vbox ), check, TRUE, TRUE, 0 );
gtk_widget_show( check );
AddDialogData( check, &m_bSelectedOnly, DLG_CHECK_BOOL ); AddDialogData( check, &m_bSelectedOnly, DLG_CHECK_BOOL );
check = gtk_check_button_new_with_label( _( "Replace everywhere (selected/active), don't test against Find" ) ); 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_box_pack_start( GTK_BOX( vbox ), check, TRUE, TRUE, 0 );
gtk_widget_show( check );
AddDialogData( check, &m_bForce, DLG_CHECK_BOOL ); AddDialogData( check, &m_bForce, DLG_CHECK_BOOL );
check = gtk_check_button_new_with_label( _( "Live updates from Texture/Camera windows" ) ); 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_box_pack_start( GTK_BOX( vbox ), check, TRUE, TRUE, 0 );
gtk_widget_show( check );
AddDialogData( check, &m_bLive, DLG_CHECK_BOOL ); AddDialogData( check, &m_bLive, DLG_CHECK_BOOL );
vbox = gtk_vbox_new( FALSE, 5 ); vbox = gtk_vbox_new( FALSE, 5 );
gtk_widget_show( vbox );
gtk_box_pack_start( GTK_BOX( hbox ), vbox, TRUE, TRUE, 0 ); gtk_box_pack_start( GTK_BOX( hbox ), vbox, TRUE, TRUE, 0 );
gtk_widget_show( vbox );
button = gtk_button_new_with_label( _( "Find" ) ); button = gtk_button_new_with_label( _( "Find" ) );
gtk_widget_show( button );
gtk_box_pack_start( GTK_BOX( vbox ), button, FALSE, FALSE, 0 ); gtk_box_pack_start( GTK_BOX( vbox ), button, FALSE, FALSE, 0 );
g_signal_connect( G_OBJECT( button ), "clicked", g_signal_connect( G_OBJECT( button ), "clicked",
G_CALLBACK( OnFind ), NULL ); G_CALLBACK( OnFind ), NULL );
gtk_widget_set_usize( button, 60, -2 ); gtk_widget_set_usize( button, 60, -2 );
gtk_widget_show( button );
button = gtk_button_new_with_label( _( "OK" ) ); button = gtk_button_new_with_label( _( "OK" ) );
gtk_widget_show( button );
gtk_box_pack_start( GTK_BOX( vbox ), button, FALSE, FALSE, 0 ); gtk_box_pack_start( GTK_BOX( vbox ), button, FALSE, FALSE, 0 );
g_signal_connect( G_OBJECT( button ), "clicked", g_signal_connect( G_OBJECT( button ), "clicked",
G_CALLBACK( OnOK ), NULL ); G_CALLBACK( OnOK ), NULL );
gtk_widget_set_usize( button, 60, -2 ); gtk_widget_set_usize( button, 60, -2 );
gtk_widget_show( button );
button = gtk_button_new_with_label( _( "Apply" ) ); button = gtk_button_new_with_label( _( "Apply" ) );
gtk_widget_show( button );
gtk_box_pack_start( GTK_BOX( vbox ), button, FALSE, FALSE, 0 ); gtk_box_pack_start( GTK_BOX( vbox ), button, FALSE, FALSE, 0 );
g_signal_connect( G_OBJECT( button ), "clicked", g_signal_connect( G_OBJECT( button ), "clicked",
G_CALLBACK( OnApply ), NULL ); G_CALLBACK( OnApply ), NULL );
gtk_widget_set_usize( button, 60, -2 ); gtk_widget_set_usize( button, 60, -2 );
button = gtk_button_new_with_label( _( "Close" ) ); button = gtk_button_new_with_label( _( "Close" ) );
gtk_widget_show( button );
gtk_box_pack_start( GTK_BOX( vbox ), button, FALSE, FALSE, 0 ); gtk_box_pack_start( GTK_BOX( vbox ), button, FALSE, FALSE, 0 );
g_signal_connect( G_OBJECT( button ), "clicked", g_signal_connect( G_OBJECT( button ), "clicked",
G_CALLBACK( OnClose ), NULL ); G_CALLBACK( OnClose ), NULL );

File diff suppressed because it is too large Load diff

View file

@ -708,7 +708,7 @@ GtkWidget* new_plugin_image_icon( const char* filename ) {
GtkWidget* menu_separator( GtkWidget *menu ){ GtkWidget* menu_separator( GtkWidget *menu ){
GtkWidget *menu_item = gtk_menu_item_new(); 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_set_sensitive( menu_item, FALSE );
gtk_widget_show( menu_item ); gtk_widget_show( menu_item );
return menu_item; return menu_item;
@ -716,7 +716,7 @@ GtkWidget* menu_separator( GtkWidget *menu ){
GtkWidget* menu_tearoff( GtkWidget *menu ){ GtkWidget* menu_tearoff( GtkWidget *menu ){
GtkWidget *menu_item = gtk_tearoff_menu_item_new(); 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_set_sensitive (menu_item, FALSE); -- controls whether menu is detachable
gtk_widget_show( menu_item ); gtk_widget_show( menu_item );
return menu_item; return menu_item;
@ -726,12 +726,14 @@ GtkWidget* create_sub_menu_with_mnemonic( GtkWidget *bar, const gchar *mnemonic
GtkWidget *item, *sub_menu; GtkWidget *item, *sub_menu;
item = gtk_menu_item_new_with_mnemonic( mnemonic ); item = gtk_menu_item_new_with_mnemonic( mnemonic );
gtk_widget_show( item );
gtk_container_add( GTK_CONTAINER( bar ), item );
sub_menu = gtk_menu_new(); sub_menu = gtk_menu_new();
gtk_menu_item_set_submenu( GTK_MENU_ITEM( item ), sub_menu ); 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; 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 ); item = gtk_menu_item_new_with_mnemonic( mnemonic );
gtk_widget_show( item ); 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 ) ); g_signal_connect( G_OBJECT( item ), "activate", G_CALLBACK( func ), GINT_TO_POINTER( id ) );
AddMenuItem( item, 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_check_menu_item_set_active( GTK_CHECK_MENU_ITEM( item ), active );
gtk_widget_show( item ); 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 ) ); g_signal_connect( G_OBJECT( item ), "activate", func, GINT_TO_POINTER( id ) );
AddMenuItem( item, 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_check_menu_item_set_active( GTK_CHECK_MENU_ITEM( item ), state );
gtk_widget_show( item ); 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 ) ); g_signal_connect( G_OBJECT( item ), "activate", func, GINT_TO_POINTER( id ) );
AddMenuItem( item, id ); AddMenuItem( item, id );
@ -786,12 +791,13 @@ GtkWidget* create_menu_in_menu_with_mnemonic( GtkWidget *menu, const gchar *mnem
GtkWidget *item, *submenu; GtkWidget *item, *submenu;
item = gtk_menu_item_new_with_mnemonic( mnemonic ); item = gtk_menu_item_new_with_mnemonic( mnemonic );
gtk_widget_show( item );
gtk_container_add( GTK_CONTAINER( menu ), item );
submenu = gtk_menu_new(); submenu = gtk_menu_new();
gtk_menu_item_set_submenu( GTK_MENU_ITEM( item ), submenu ); 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; return submenu;
} }
@ -852,32 +858,28 @@ static const int MSGBOX_PAD_MINOR = 2;
int WINAPI gtk_MessageBoxNew( void *parent, const char *message, int WINAPI gtk_MessageBoxNew( void *parent, const char *message,
const char *caption, const guint32 flags, const char *caption, const guint32 flags,
const char *URL ) { 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 gtk_container_set_border_width( GTK_CONTAINER( dialog ), MSGBOX_PAD_MAJOR );
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 );
if( parent ) { if( parent ) {
gtk_window_set_transient_for( GTK_WINDOW( dlg ), GTK_WINDOW( parent ) ); gtk_window_set_transient_for( GTK_WINDOW( dialog ), GTK_WINDOW( parent ) );
gtk_window_set_position( GTK_WINDOW( dlg ), GTK_WIN_POS_CENTER_ON_PARENT ); gtk_window_set_position( GTK_WINDOW( dialog ), GTK_WIN_POS_CENTER_ON_PARENT );
} }
GtkAccelGroup *accel = gtk_accel_group_new(); 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 // begin layout
GtkWidget *outer_vbox = gtk_vbox_new( FALSE, MSGBOX_PAD_MAJOR ); 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 ); gtk_widget_show( outer_vbox );
// add icon // add icon
@ -921,6 +923,7 @@ int WINAPI gtk_MessageBoxNew( void *parent, const char *message,
GtkWidget *dlg_msg = gtk_label_new( 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_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_justify( GTK_LABEL( dlg_msg ), GTK_JUSTIFY_LEFT );
gtk_label_set_selectable( GTK_LABEL( dlg_msg ), TRUE );
gtk_widget_show( dlg_msg ); gtk_widget_show( dlg_msg );
// add buttons // add buttons
@ -936,16 +939,17 @@ int WINAPI gtk_MessageBoxNew( void *parent, const char *message,
switch( flags & MB_TYPEMASK ) { switch( flags & MB_TYPEMASK ) {
case MB_OK: case MB_OK:
default: { 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_Escape, (GdkModifierType)0, (GtkAccelFlags)0 );
gtk_widget_add_accelerator( btn_ok, "clicked", accel, GDK_KEY_Return, (GdkModifierType)0, (GtkAccelFlags)0 ); gtk_widget_add_accelerator( btn_ok, "clicked", accel, GDK_KEY_Return, (GdkModifierType)0, (GtkAccelFlags)0 );
ret = IDOK; ret = IDOK;
break; break;
} }
case MB_OKCANCEL: { 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 ); 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 ); gtk_widget_add_accelerator( btn_cancel, "clicked", accel, GDK_KEY_Escape, (GdkModifierType)0, (GtkAccelFlags)0 );
ret = IDCANCEL; ret = IDCANCEL;
break; break;
@ -956,16 +960,16 @@ int WINAPI gtk_MessageBoxNew( void *parent, const char *message,
} }
case MB_YESNOCANCEL: { case MB_YESNOCANCEL: {
//! @todo accelerators? //! @todo accelerators?
gtk_AddDlgButton( buttons_hbox, _( "Yes" ), IDYES, TRUE ); gtk_dialog_add_button( GTK_DIALOG( dialog ), _( "Yes" ), GTK_RESPONSE_YES );
gtk_AddDlgButton( buttons_hbox, _( "No" ), IDNO, FALSE ); gtk_dialog_add_button( GTK_DIALOG( dialog ), _( "No" ), GTK_RESPONSE_NO );
gtk_AddDlgButton( buttons_hbox, _( "Cancel" ), IDCANCEL, FALSE ); gtk_dialog_add_button( GTK_DIALOG( dialog ), _( "Cancel" ), GTK_RESPONSE_CANCEL );
ret = IDCANCEL; ret = IDCANCEL;
break; break;
} }
case MB_YESNO: { case MB_YESNO: {
//! @todo accelerators? //! @todo accelerators?
gtk_AddDlgButton( buttons_hbox, _( "Yes" ), IDYES, TRUE ); gtk_dialog_add_button( GTK_DIALOG( dialog ), _( "Yes" ), GTK_RESPONSE_YES );
gtk_AddDlgButton( buttons_hbox, _( "No" ), IDNO, FALSE ); gtk_dialog_add_button( GTK_DIALOG( dialog ), _( "No" ), GTK_RESPONSE_NO );
ret = IDNO; ret = IDNO;
break; break;
} }
@ -988,56 +992,61 @@ int WINAPI gtk_MessageBoxNew( void *parent, const char *message,
g_signal_connect( G_OBJECT( btn_url ), "clicked", g_signal_connect( G_OBJECT( btn_url ), "clicked",
G_CALLBACK( dialog_url_callback ), NULL ); G_CALLBACK( dialog_url_callback ), NULL );
g_object_set_data( G_OBJECT( btn_url ), "URL", (void *)URL ); 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 ); gtk_widget_show( btn_url );
} }
// show it
gtk_widget_show( dlg );
gtk_grab_add( dlg );
while( loop ) response_id = gtk_dialog_run( GTK_DIALOG( dialog ) );
gtk_main_iteration();
gtk_grab_remove( dlg ); switch( response_id ) {
gtk_widget_destroy( dlg ); 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; return ret;
} }
int WINAPI gtk_MessageBox( void *parent, const char* lpText, const char* lpCaption, guint32 uType, const char* URL ){ 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; 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 ); dialog = gtk_dialog_new_with_buttons( lpCaption, NULL, flags, NULL );
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_window_set_policy( GTK_WINDOW( window ),FALSE,FALSE,TRUE ); gtk_container_set_border_width( GTK_CONTAINER( dialog ), 10 );
if ( parent != NULL ) { 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(); 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 ); 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 ); gtk_widget_show( vbox );
w = gtk_label_new( lpText ); w = gtk_label_new( lpText );
gtk_box_pack_start( GTK_BOX( vbox ), w, FALSE, FALSE, 2 ); gtk_box_pack_start( GTK_BOX( vbox ), w, FALSE, FALSE, 2 );
gtk_label_set_justify( GTK_LABEL( w ), GTK_JUSTIFY_LEFT ); gtk_label_set_justify( GTK_LABEL( w ), GTK_JUSTIFY_LEFT );
gtk_label_set_selectable( GTK_LABEL( w ), TRUE );
gtk_widget_show( w ); gtk_widget_show( w );
w = gtk_hseparator_new(); 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_box_pack_start( GTK_BOX( vbox ), hbox, FALSE, FALSE, 2 );
gtk_widget_show( hbox ); gtk_widget_show( hbox );
mode = ( uType & MB_TYPEMASK );
if ( mode == MB_OK ) { if ( mode == MB_OK ) {
w = gtk_button_new_with_label( _( "Ok" ) ); w = gtk_dialog_add_button( GTK_DIALOG( dialog ), _( "OK" ), GTK_RESPONSE_OK );
gtk_box_pack_start( GTK_BOX( hbox ), w, TRUE, TRUE, 0 ); gtk_widget_add_accelerator( w, "clicked", accel, GDK_KEY_Escape, (GdkModifierType)0, (GtkAccelFlags)0 );
g_signal_connect( G_OBJECT( w ), "clicked", gtk_widget_add_accelerator( w, "clicked", accel, GDK_KEY_Return, (GdkModifierType)0, (GtkAccelFlags)0 );
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 );
gtk_widget_set_can_default( w, TRUE ); gtk_widget_set_can_default( w, TRUE );
gtk_widget_grab_default( w ); gtk_widget_grab_default( w );
gtk_widget_show( w );
ret = IDOK; ret = IDOK;
} }
else if ( mode == MB_OKCANCEL ) { else if ( mode == MB_OKCANCEL ) {
w = gtk_button_new_with_label( _( "Ok" ) ); w = gtk_dialog_add_button( GTK_DIALOG( dialog ), _( "OK" ), GTK_RESPONSE_OK );
gtk_box_pack_start( GTK_BOX( hbox ), w, TRUE, TRUE, 0 ); gtk_widget_add_accelerator( w, "clicked", accel, GDK_KEY_Return, (GdkModifierType)0, (GtkAccelFlags)0 );
g_signal_connect( G_OBJECT( w ), "clicked",
G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( IDOK ) ); w = gtk_dialog_add_button( GTK_DIALOG( dialog ), _( "Cancel" ), GTK_RESPONSE_CANCEL );
gtk_widget_add_accelerator( w, "clicked", accel, GDK_Return, (GdkModifierType)0, (GtkAccelFlags)0 ); gtk_widget_add_accelerator( w, "clicked", accel, GDK_KEY_Escape, (GdkModifierType)0, (GtkAccelFlags)0 );
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_add_accelerator( w, "clicked", accel, GDK_Escape, (GdkModifierType)0, (GtkAccelFlags)0 );
gtk_widget_show( w );
ret = IDCANCEL; ret = IDCANCEL;
} }
else if ( mode == MB_YESNOCANCEL ) { else if ( mode == MB_YESNOCANCEL ) {
w = gtk_button_new_with_label( _( "Yes" ) ); w = gtk_dialog_add_button( GTK_DIALOG( dialog ), _( "Yes" ), GTK_RESPONSE_YES );
gtk_box_pack_start( GTK_BOX( hbox ), w, TRUE, TRUE, 0 ); w = gtk_dialog_add_button( GTK_DIALOG( dialog ), _( "No" ), GTK_RESPONSE_NO );
g_signal_connect( G_OBJECT( w ), "clicked", w = gtk_dialog_add_button( GTK_DIALOG( dialog ), _( "Cancel" ), GTK_RESPONSE_CANCEL );
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; ret = IDCANCEL;
} }
else /* if (mode == MB_YESNO) */ else /* if (mode == MB_YESNO) */
{ {
w = gtk_button_new_with_label( _( "Yes" ) ); w = gtk_dialog_add_button( GTK_DIALOG( dialog ), _( "Yes" ), GTK_RESPONSE_YES );
gtk_box_pack_start( GTK_BOX( hbox ), w, TRUE, TRUE, 0 ); w = gtk_dialog_add_button( GTK_DIALOG( dialog ), _( "No" ), GTK_RESPONSE_NO );
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; 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_signal_connect( G_OBJECT( w ), "clicked",
G_CALLBACK( dialog_url_callback ), NULL ); G_CALLBACK( dialog_url_callback ), NULL );
g_object_set_data( G_OBJECT( w ), "URL", (void *)URL ); 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( w );
} }
gtk_widget_show( window ); response_id = gtk_dialog_run( GTK_DIALOG( dialog ) );
gtk_grab_add( window );
while ( loop ) switch( response_id ) {
gtk_main_iteration(); 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( dialog );
gtk_widget_destroy( window );
return ret; return ret;
} }
@ -1336,6 +1317,7 @@ const char* file_dialog( void *parent, gboolean open, const char* title, const c
#endif #endif
// Gtk dialog // Gtk dialog
GtkFileChooserAction action;
GtkWidget* file_sel; GtkWidget* file_sel;
char *new_path = NULL; char *new_path = NULL;
@ -1480,14 +1462,11 @@ const char* file_dialog( void *parent, gboolean open, const char* title, const c
// terminate string // terminate string
*w = '\0'; *w = '\0';
file_sel = gtk_file_chooser_dialog_new( title, action = open ? GTK_FILE_CHOOSER_ACTION_OPEN : GTK_FILE_CHOOSER_ACTION_SAVE;
GTK_WINDOW( parent ), file_sel = gtk_file_chooser_dialog_new( title, GTK_WINDOW( parent ), action, NULL, NULL );
open ? GTK_FILE_CHOOSER_ACTION_OPEN : GTK_FILE_CHOOSER_ACTION_SAVE, gtk_dialog_add_button( GTK_DIALOG( file_sel ), open ? _( "Open" ) : _("Save" ), GTK_RESPONSE_ACCEPT );
GTK_STOCK_CANCEL, gtk_dialog_add_button( GTK_DIALOG( file_sel ), _( "Cancel" ), GTK_RESPONSE_CANCEL );
GTK_RESPONSE_CANCEL,
open ? GTK_STOCK_OPEN : GTK_STOCK_SAVE,
GTK_RESPONSE_ACCEPT,
(char *) NULL );
gtk_file_chooser_set_current_folder( GTK_FILE_CHOOSER( file_sel ), new_path ); gtk_file_chooser_set_current_folder( GTK_FILE_CHOOSER( file_sel ), new_path );
delete[] 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 ) { 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 { else {
szFile[0] = '\0'; 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 ){ char* WINAPI dir_dialog( void *parent, const char* title, const char* path ){
GtkWidget* file_sel; GtkWidget* file_sel;
char* filename = (char*)NULL; 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 ), file_sel = gtk_file_chooser_dialog_new( title, GTK_WINDOW( parent ), action, NULL, NULL );
GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER, gtk_dialog_add_button( GTK_DIALOG( file_sel ), _( "OK" ), GTK_RESPONSE_ACCEPT );
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, gtk_dialog_add_button( GTK_DIALOG( file_sel ), _( "Cancel" ), GTK_RESPONSE_CANCEL );
GTK_STOCK_OK, GTK_RESPONSE_ACCEPT,
(char *) NULL );
if ( path != NULL ) { if ( path != NULL ) {
gtk_file_chooser_set_current_folder( GTK_FILE_CHOOSER( file_sel ), path ); 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 ) { if ( response_id == GTK_RESPONSE_ACCEPT ) {
filename = g_strdup( gtk_file_chooser_get_filename( GTK_FILE_CHOOSER( file_sel ) ) ); filename = gtk_file_chooser_get_filename( GTK_FILE_CHOOSER( file_sel ) );
} }
else { else {
filename = NULL; filename = NULL;
@ -1713,7 +1697,7 @@ void CheckMenuSplitting( GtkWidget *&menu ){
item = GTK_WIDGET( g_list_last( gtk_container_get_children( GTK_CONTAINER( menu ) ) )->data ); item = GTK_WIDGET( g_list_last( gtk_container_get_children( GTK_CONTAINER( menu ) ) )->data );
g_object_ref( item ); g_object_ref( item );
gtk_container_remove( GTK_CONTAINER( menu ), 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 ); g_object_unref( item );
} }

View file

@ -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 ); g_object_set_data( G_OBJECT( window ), "tb_handle_box", handle_box );
toolbar = gtk_toolbar_new(); 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 ), GTK_TOOLBAR_ICONS );
// gtk_toolbar_set_style (GTK_TOOLBAR (toolbar), user_rc.toolbar_style); // gtk_toolbar_set_style (GTK_TOOLBAR (toolbar), user_rc.toolbar_style);
gtk_container_add( GTK_CONTAINER( handle_box ), toolbar ); 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" ), "", w = gtk_toolbar_append_item( GTK_TOOLBAR( toolbar ), _( "Open" ), _( "Open an existing map" ), "",
new_image_icon("file_open.png"), G_CALLBACK( HandleCommand ), 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; m_bCamPreview = true;
g_nScaleHow = ( SCALE_X | SCALE_Y | SCALE_Z ); g_nScaleHow = ( SCALE_X | SCALE_Y | SCALE_Z );
gtk_widget_show( toolbar );
} }
void MainFrame::create_plugin_toolbar( GtkWidget *window, GtkWidget *vbox ){ 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 ); g_object_set_data( G_OBJECT( window ), "tb_handle_box", handle_box );
toolbar = gtk_toolbar_new(); 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 ), GTK_TOOLBAR_ICONS );
// gtk_toolbar_set_style (GTK_TOOLBAR (toolbar), user_rc.toolbar_style); // gtk_toolbar_set_style (GTK_TOOLBAR (toolbar), user_rc.toolbar_style);
gtk_container_add( GTK_CONTAINER( handle_box ), toolbar ); gtk_container_add( GTK_CONTAINER( handle_box ), toolbar );
@ -1985,15 +1986,15 @@ void MainFrame::create_main_statusbar( GtkWidget *window, GtkWidget *vbox ){
GtkWidget *label; GtkWidget *label;
hbox = gtk_hbox_new( FALSE, 0 ); hbox = gtk_hbox_new( FALSE, 0 );
gtk_widget_show( hbox ); gtk_widget_set_size_request( hbox, -1, 24 );
gtk_widget_set_usize( hbox, -1, 24 );
gtk_container_set_border_width( GTK_CONTAINER( hbox ), 1 ); gtk_container_set_border_width( GTK_CONTAINER( hbox ), 1 );
gtk_box_pack_end( GTK_BOX( vbox ), hbox, FALSE, TRUE, 2 ); gtk_box_pack_end( GTK_BOX( vbox ), hbox, FALSE, TRUE, 2 );
gtk_widget_show( hbox );
frame = gtk_frame_new( (char*)NULL ); frame = gtk_frame_new( (char*)NULL );
gtk_widget_show( frame );
gtk_box_pack_start( GTK_BOX( hbox ), frame, TRUE, TRUE, 0 ); gtk_box_pack_start( GTK_BOX( hbox ), frame, TRUE, TRUE, 0 );
gtk_frame_set_shadow_type( GTK_FRAME( frame ), GTK_SHADOW_IN ); gtk_frame_set_shadow_type( GTK_FRAME( frame ), GTK_SHADOW_IN );
gtk_widget_show( frame );
hbox1 = gtk_hbox_new( FALSE, 0 ); hbox1 = gtk_hbox_new( FALSE, 0 );
gtk_container_add( GTK_CONTAINER( frame ), hbox1 ); gtk_container_add( GTK_CONTAINER( frame ), hbox1 );
@ -2001,22 +2002,22 @@ void MainFrame::create_main_statusbar( GtkWidget *window, GtkWidget *vbox ){
gtk_widget_show( hbox1 ); gtk_widget_show( hbox1 );
label = gtk_label_new( _( " Label " ) ); label = gtk_label_new( _( " Label " ) );
gtk_widget_show( label );
gtk_box_pack_start( GTK_BOX( hbox1 ), label, FALSE, TRUE, 0 ); gtk_box_pack_start( GTK_BOX( hbox1 ), label, FALSE, TRUE, 0 );
gtk_label_set_justify( GTK_LABEL( label ), GTK_JUSTIFY_LEFT ); gtk_label_set_justify( GTK_LABEL( label ), GTK_JUSTIFY_LEFT );
gtk_misc_set_padding( GTK_MISC( label ), 3, 0 ); gtk_misc_set_padding( GTK_MISC( label ), 3, 0 );
gtk_widget_show( label );
m_pStatusLabel[0] = label; m_pStatusLabel[0] = label;
for ( int i = 1; i < 6; i++ ) for ( int i = 1; i < 6; i++ )
{ {
frame = gtk_frame_new( (char*)NULL ); frame = gtk_frame_new( (char*)NULL );
gtk_widget_show( frame );
gtk_box_pack_start( GTK_BOX( hbox ), frame, FALSE, TRUE, 0 ); gtk_box_pack_start( GTK_BOX( hbox ), frame, FALSE, TRUE, 0 );
gtk_frame_set_shadow_type( GTK_FRAME( frame ), GTK_SHADOW_IN ); gtk_frame_set_shadow_type( GTK_FRAME( frame ), GTK_SHADOW_IN );
gtk_widget_show( frame );
label = gtk_label_new( _( " Label " ) ); label = gtk_label_new( _( " Label " ) );
gtk_widget_show( label );
gtk_container_add( GTK_CONTAINER( frame ), label ); gtk_container_add( GTK_CONTAINER( frame ), label );
gtk_widget_show( label );
m_pStatusLabel[i] = 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" ) ); GtkWidget* item = gtk_menu_item_new_with_label( _( "Clear" ) );
g_signal_connect( G_OBJECT( item ), "activate", G_CALLBACK( Sys_ClearPrintf ), NULL ); g_signal_connect( G_OBJECT( item ), "activate", G_CALLBACK( Sys_ClearPrintf ), NULL );
gtk_widget_show( item ); 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 ){ void console_construct( GtkWidget* textview ){
@ -2362,10 +2363,10 @@ void PositionWindowOnPrimaryScreen( window_position_t& position ){
GtkWidget* create_framed_widget( GtkWidget* widget ){ GtkWidget* create_framed_widget( GtkWidget* widget ){
GtkWidget* frame = gtk_frame_new( (char*)NULL ); GtkWidget* frame = gtk_frame_new( (char*)NULL );
gtk_widget_show( frame );
gtk_frame_set_shadow_type( GTK_FRAME( frame ), GTK_SHADOW_IN ); gtk_frame_set_shadow_type( GTK_FRAME( frame ), GTK_SHADOW_IN );
gtk_container_add( GTK_CONTAINER( frame ), widget ); gtk_container_add( GTK_CONTAINER( frame ), widget );
gtk_widget_show( widget ); gtk_widget_show( widget );
gtk_widget_show( frame );
return frame; return frame;
} }

View file

@ -122,7 +122,7 @@ static void OnSpinChanged( GtkAdjustment *adj, gpointer data ){
} }
if ( adj == g_object_get_data( G_OBJECT( g_PatchDialog.GetWidget() ), "hshift_adj" ) ) { 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 ) { if ( gtk_adjustment_get_value( adj ) > 0 ) {
td.shift[0] = l_pPIIncrement->shift[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" ) ) { 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 ) { if ( gtk_adjustment_get_value( adj ) > 0 ) {
td.shift[1] = l_pPIIncrement->shift[1]; 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" ) ) { 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 ) { if ( l_pPIIncrement->scale[0] == 0.0f ) {
return; 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" ) ) { 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 ) { if ( l_pPIIncrement->scale[1] == 0.0f ) {
return; 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" ) ) { 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 ) { if ( gtk_adjustment_get_value( adj ) > 0 ) {
td.rotate = l_pPIIncrement->rotate; td.rotate = l_pPIIncrement->rotate;
@ -289,9 +289,10 @@ void PatchDialog::ShowDlg(){
void PatchDialog::BuildDialog(){ void PatchDialog::BuildDialog(){
GtkWidget *dlg, *vbox, *vbox2, *hbox, *hbox2, *frame, *table, *label; GtkWidget *dlg, *vbox, *vbox2, *hbox, *hbox2, *frame, *table, *label;
GtkWidget *button, *entry, *spin, *combo; GtkWidget *button, *entry, *spin, *combo, *row_label, *col_label;
GtkObject *adj; GtkAdjustment *adj;
char buf[32]; GtkSizeGroup *size_group;
GtkWidget *cap_button, *set_button, *nat_button, *fit_button;
dlg = m_pWidget; dlg = m_pWidget;
@ -305,344 +306,390 @@ void PatchDialog::BuildDialog(){
vbox = gtk_vbox_new( FALSE, 5 ); vbox = gtk_vbox_new( FALSE, 5 );
gtk_widget_show( vbox );
gtk_container_add( GTK_CONTAINER( dlg ), vbox ); gtk_container_add( GTK_CONTAINER( dlg ), vbox );
gtk_container_set_border_width( GTK_CONTAINER( vbox ), 5 ); gtk_container_set_border_width( GTK_CONTAINER( vbox ), 5 );
gtk_widget_show( vbox );
hbox = gtk_hbox_new( FALSE, 5 ); hbox = gtk_hbox_new( FALSE, 5 );
gtk_widget_show( hbox );
gtk_box_pack_start( GTK_BOX( vbox ), hbox, TRUE, TRUE, 0 ); gtk_box_pack_start( GTK_BOX( vbox ), hbox, TRUE, TRUE, 0 );
gtk_widget_show( hbox );
frame = gtk_frame_new( _( "Details" ) ); frame = gtk_frame_new( _( "Details" ) );
gtk_widget_show( frame );
gtk_box_pack_start( GTK_BOX( hbox ), frame, TRUE, TRUE, 0 ); gtk_box_pack_start( GTK_BOX( hbox ), frame, TRUE, TRUE, 0 );
gtk_widget_show( frame );
vbox2 = gtk_vbox_new( FALSE, 5 ); vbox2 = gtk_vbox_new( FALSE, 5 );
gtk_widget_show( vbox2 );
gtk_container_add( GTK_CONTAINER( frame ), vbox2 ); gtk_container_add( GTK_CONTAINER( frame ), vbox2 );
gtk_container_set_border_width( GTK_CONTAINER( vbox2 ), 5 ); gtk_container_set_border_width( GTK_CONTAINER( vbox2 ), 5 );
gtk_widget_show( vbox2 );
table = gtk_table_new( 2, 2, FALSE ); table = gtk_table_new( 2, 2, FALSE );
gtk_widget_show( table );
gtk_box_pack_start( GTK_BOX( vbox2 ), table, TRUE, TRUE, 0 ); gtk_box_pack_start( GTK_BOX( vbox2 ), table, TRUE, TRUE, 0 );
gtk_table_set_row_spacings( GTK_TABLE( table ), 5 ); gtk_table_set_row_spacings( GTK_TABLE( table ), 5 );
gtk_table_set_col_spacings( GTK_TABLE( table ), 5 ); gtk_table_set_col_spacings( GTK_TABLE( table ), 5 );
gtk_widget_show( table );
label = gtk_label_new( _( "Row:" ) ); row_label = label = gtk_label_new( _( "Row:" ) );
gtk_widget_show( label );
gtk_table_attach( GTK_TABLE( table ), label, 0, 1, 0, 1, gtk_table_attach( GTK_TABLE( table ), label, 0, 1, 0, 1,
(GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
(GtkAttachOptions) ( 0 ), 0, 0 ); (GtkAttachOptions) ( 0 ), 0, 0 );
label = gtk_label_new( _( "Column:" ) );
gtk_widget_show( label ); gtk_widget_show( label );
col_label = label = gtk_label_new( _( "Column:" ) );
gtk_table_attach( GTK_TABLE( table ), label, 1, 2, 0, 1, gtk_table_attach( GTK_TABLE( table ), label, 1, 2, 0, 1,
(GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
(GtkAttachOptions) ( 0 ), 0, 0 ); (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(); combo = gtk_combo_new();
gtk_widget_show( combo );
gtk_table_attach( GTK_TABLE( table ), combo, 0, 1, 1, 2, gtk_table_attach( GTK_TABLE( table ), combo, 0, 1, 1, 2,
(GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
(GtkAttachOptions) ( 0 ), 0, 0 ); (GtkAttachOptions) ( 0 ), 0, 0 );
gtk_widget_set_usize( combo, 60, -1 ); gtk_widget_set_usize( combo, 60, -1 );
gtk_entry_set_editable( GTK_ENTRY( GTK_COMBO( combo )->entry ), FALSE ); 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_signal_connect( G_OBJECT( GTK_COMBO( combo )->entry ), "changed",
G_CALLBACK( OnSelchangeComboColRow ), this ); G_CALLBACK( OnSelchangeComboColRow ), this );
AddDialogData( combo, &m_nRow, DLG_COMBO_INT ); AddDialogData( combo, &m_nRow, DLG_COMBO_INT );
m_pRowCombo = combo; m_pRowCombo = combo;
combo = gtk_combo_new(); combo = gtk_combo_new();
gtk_widget_show( combo );
gtk_table_attach( GTK_TABLE( table ), combo, 1, 2, 1, 2, gtk_table_attach( GTK_TABLE( table ), combo, 1, 2, 1, 2,
(GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
(GtkAttachOptions) ( 0 ), 0, 0 ); (GtkAttachOptions) ( 0 ), 0, 0 );
gtk_widget_set_usize( combo, 60, -1 ); gtk_widget_set_usize( combo, 60, -1 );
gtk_entry_set_editable( GTK_ENTRY( GTK_COMBO( combo )->entry ), FALSE ); 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_signal_connect( G_OBJECT( GTK_COMBO( combo )->entry ), "changed",
G_CALLBACK( OnSelchangeComboColRow ), this ); G_CALLBACK( OnSelchangeComboColRow ), this );
AddDialogData( combo, &m_nCol, DLG_COMBO_INT ); AddDialogData( combo, &m_nCol, DLG_COMBO_INT );
m_pColCombo = combo; m_pColCombo = combo;
table = gtk_table_new( 5, 2, FALSE ); table = gtk_table_new( 5, 2, FALSE );
gtk_widget_show( table );
gtk_box_pack_start( GTK_BOX( vbox2 ), table, TRUE, TRUE, 0 ); gtk_box_pack_start( GTK_BOX( vbox2 ), table, TRUE, TRUE, 0 );
gtk_table_set_row_spacings( GTK_TABLE( table ), 5 ); gtk_table_set_row_spacings( GTK_TABLE( table ), 5 );
gtk_table_set_col_spacings( GTK_TABLE( table ), 5 ); gtk_table_set_col_spacings( GTK_TABLE( table ), 5 );
gtk_widget_show( table );
label = gtk_label_new( _( "X:" ) ); label = gtk_label_new( _( "X:" ) );
gtk_widget_show( label );
gtk_table_attach( GTK_TABLE( table ), label, 0, 1, 0, 1, gtk_table_attach( GTK_TABLE( table ), label, 0, 1, 0, 1,
(GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
(GtkAttachOptions) ( 0 ), 0, 0 ); (GtkAttachOptions) ( 0 ), 0, 0 );
gtk_widget_set_tooltip_text( label, _( "X-Axis" ) );
gtk_widget_show( label );
label = gtk_label_new( _( "Y:" ) ); label = gtk_label_new( _( "Y:" ) );
gtk_widget_show( label );
gtk_table_attach( GTK_TABLE( table ), label, 0, 1, 1, 2, gtk_table_attach( GTK_TABLE( table ), label, 0, 1, 1, 2,
(GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
(GtkAttachOptions) ( 0 ), 0, 0 ); (GtkAttachOptions) ( 0 ), 0, 0 );
gtk_widget_set_tooltip_text( label, _( "Y-Axis" ) );
gtk_widget_show( label );
label = gtk_label_new( _( "Z:" ) ); label = gtk_label_new( _( "Z:" ) );
gtk_widget_show( label );
gtk_table_attach( GTK_TABLE( table ), label, 0, 1, 2, 3, gtk_table_attach( GTK_TABLE( table ), label, 0, 1, 2, 3,
(GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
(GtkAttachOptions) ( 0 ), 0, 0 ); (GtkAttachOptions) ( 0 ), 0, 0 );
gtk_widget_set_tooltip_text( label, _( "Z-Axis" ) );
gtk_widget_show( label );
label = gtk_label_new( _( "S:" ) ); label = gtk_label_new( _( "S:" ) );
gtk_widget_show( label );
gtk_table_attach( GTK_TABLE( table ), label, 0, 1, 3, 4, gtk_table_attach( GTK_TABLE( table ), label, 0, 1, 3, 4,
(GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
(GtkAttachOptions) ( 0 ), 0, 0 ); (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:" ) ); label = gtk_label_new( _( "T:" ) );
gtk_widget_show( label );
gtk_table_attach( GTK_TABLE( table ), label, 0, 1, 4, 5, gtk_table_attach( GTK_TABLE( table ), label, 0, 1, 4, 5,
(GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
(GtkAttachOptions) ( 0 ), 0, 0 ); (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(); adj = GTK_ADJUSTMENT( gtk_adjustment_new( 0, -INT_MAX, INT_MAX, 1, 10, 0 ) );
gtk_widget_show( entry ); spin = gtk_spin_button_new( GTK_ADJUSTMENT( adj ), 1, 4 );
gtk_table_attach( GTK_TABLE( table ), entry, 1, 2, 0, 1, gtk_table_attach( GTK_TABLE( table ), spin, 1, 2, 0, 1,
(GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
(GtkAttachOptions) ( 0 ), 0, 0 ); (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(); adj = GTK_ADJUSTMENT( gtk_adjustment_new( 0, -INT_MAX, INT_MAX, 1, 10, 0 ) );
gtk_widget_show( entry ); spin = gtk_spin_button_new( GTK_ADJUSTMENT( adj ), 1, 4 );
gtk_table_attach( GTK_TABLE( table ), entry, 1, 2, 1, 2, gtk_table_attach( GTK_TABLE( table ), spin, 1, 2, 1, 2,
(GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
(GtkAttachOptions) ( 0 ), 0, 0 ); (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(); adj = GTK_ADJUSTMENT( gtk_adjustment_new( 0, -INT_MAX, INT_MAX, 1, 10, 0 ) );
gtk_widget_show( entry ); spin = gtk_spin_button_new( GTK_ADJUSTMENT( adj ), 1, 4 );
gtk_table_attach( GTK_TABLE( table ), entry, 1, 2, 2, 3, gtk_table_attach( GTK_TABLE( table ), spin, 1, 2, 2, 3,
(GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
(GtkAttachOptions) ( 0 ), 0, 0 ); (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(); adj = GTK_ADJUSTMENT( gtk_adjustment_new( 0, -INT_MAX, INT_MAX, 1, 10, 0 ) );
gtk_widget_show( entry ); spin = gtk_spin_button_new( GTK_ADJUSTMENT( adj ), 1, 4 );
gtk_table_attach( GTK_TABLE( table ), entry, 1, 2, 3, 4, gtk_table_attach( GTK_TABLE( table ), spin, 1, 2, 3, 4,
(GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
(GtkAttachOptions) ( 0 ), 0, 0 ); (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(); adj = GTK_ADJUSTMENT( gtk_adjustment_new( 0, -INT_MAX, INT_MAX, 1, 10, 0 ) );
gtk_widget_show( entry ); spin = gtk_spin_button_new( GTK_ADJUSTMENT( adj ), 1, 4 );
gtk_table_attach( GTK_TABLE( table ), entry, 1, 2, 4, 5, gtk_table_attach( GTK_TABLE( table ), spin, 1, 2, 4, 5,
(GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
(GtkAttachOptions) ( 0 ), 0, 0 ); (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" ) ); frame = gtk_frame_new( _( "Texturing" ) );
gtk_widget_show( frame );
gtk_box_pack_start( GTK_BOX( hbox ), frame, TRUE, TRUE, 0 ); gtk_box_pack_start( GTK_BOX( hbox ), frame, TRUE, TRUE, 0 );
gtk_widget_show( frame );
vbox2 = gtk_vbox_new( FALSE, 5 ); vbox2 = gtk_vbox_new( FALSE, 5 );
gtk_widget_show( vbox2 );
gtk_container_add( GTK_CONTAINER( frame ), vbox2 ); gtk_container_add( GTK_CONTAINER( frame ), vbox2 );
gtk_container_set_border_width( GTK_CONTAINER( vbox2 ), 5 ); gtk_container_set_border_width( GTK_CONTAINER( vbox2 ), 5 );
gtk_widget_show( vbox2 );
label = gtk_label_new( _( "Name:" ) ); label = gtk_label_new( _( "Name:" ) );
gtk_widget_show( label );
gtk_box_pack_start( GTK_BOX( vbox2 ), label, TRUE, TRUE, 0 ); gtk_box_pack_start( GTK_BOX( vbox2 ), label, TRUE, TRUE, 0 );
gtk_label_set_justify( GTK_LABEL( label ), GTK_JUSTIFY_LEFT ); gtk_label_set_justify( GTK_LABEL( label ), GTK_JUSTIFY_LEFT );
gtk_misc_set_alignment( GTK_MISC( label ), 0, 0.5 ); gtk_misc_set_alignment( GTK_MISC( label ), 0, 0.5 );
gtk_widget_show( label );
entry = gtk_entry_new(); entry = gtk_entry_new();
// gtk_entry_set_editable (GTK_ENTRY (entry), false); // gtk_entry_set_editable (GTK_ENTRY (entry), false);
gtk_widget_show( entry );
gtk_box_pack_start( GTK_BOX( vbox2 ), entry, TRUE, TRUE, 0 ); gtk_box_pack_start( GTK_BOX( vbox2 ), entry, TRUE, TRUE, 0 );
gtk_widget_show( entry );
AddDialogData( entry, &m_strName, DLG_ENTRY_TEXT ); AddDialogData( entry, &m_strName, DLG_ENTRY_TEXT );
table = gtk_table_new( 5, 3, FALSE ); table = gtk_table_new( 5, 3, FALSE );
gtk_widget_show( table );
gtk_box_pack_start( GTK_BOX( vbox2 ), table, TRUE, TRUE, 0 ); gtk_box_pack_start( GTK_BOX( vbox2 ), table, TRUE, TRUE, 0 );
gtk_table_set_row_spacings( GTK_TABLE( table ), 5 ); gtk_table_set_row_spacings( GTK_TABLE( table ), 5 );
gtk_table_set_col_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" ) ); label = gtk_label_new( _( "Horizontal Shift Step" ) );
gtk_widget_show( label );
gtk_table_attach( GTK_TABLE( table ), label, 2, 3, 0, 1, gtk_table_attach( GTK_TABLE( table ), label, 2, 3, 0, 1,
(GtkAttachOptions) ( GTK_FILL ), (GtkAttachOptions) ( GTK_FILL ),
(GtkAttachOptions) ( 0 ), 0, 0 ); (GtkAttachOptions) ( 0 ), 0, 0 );
gtk_misc_set_alignment( GTK_MISC( label ), 0, 0.5 ); gtk_misc_set_alignment( GTK_MISC( label ), 0, 0.5 );
gtk_widget_show( label );
label = gtk_label_new( _( "Vertical Shift Step" ) ); label = gtk_label_new( _( "Vertical Shift Step" ) );
gtk_widget_show( label );
gtk_table_attach( GTK_TABLE( table ), label, 2, 3, 1, 2, gtk_table_attach( GTK_TABLE( table ), label, 2, 3, 1, 2,
(GtkAttachOptions) ( GTK_FILL ), (GtkAttachOptions) ( GTK_FILL ),
(GtkAttachOptions) ( 0 ), 0, 0 ); (GtkAttachOptions) ( 0 ), 0, 0 );
gtk_misc_set_alignment( GTK_MISC( label ), 0, 0.5 ); gtk_misc_set_alignment( GTK_MISC( label ), 0, 0.5 );
gtk_widget_show( label );
label = gtk_label_new( _( "Horizontal Stretch Step" ) ); label = gtk_label_new( _( "Horizontal Stretch Step" ) );
gtk_widget_show( label );
gtk_table_attach( GTK_TABLE( table ), label, 2, 3, 2, 3, gtk_table_attach( GTK_TABLE( table ), label, 2, 3, 2, 3,
(GtkAttachOptions) ( GTK_FILL ), (GtkAttachOptions) ( GTK_FILL ),
(GtkAttachOptions) ( 0 ), 0, 0 ); (GtkAttachOptions) ( 0 ), 0, 0 );
gtk_misc_set_alignment( GTK_MISC( label ), 0, 0.5 ); gtk_misc_set_alignment( GTK_MISC( label ), 0, 0.5 );
gtk_widget_show( label );
label = gtk_label_new( _( "Vertical Stretch Step" ) ); label = gtk_label_new( _( "Vertical Stretch Step" ) );
gtk_widget_show( label );
gtk_table_attach( GTK_TABLE( table ), label, 2, 3, 3, 4, gtk_table_attach( GTK_TABLE( table ), label, 2, 3, 3, 4,
(GtkAttachOptions) ( GTK_FILL ), (GtkAttachOptions) ( GTK_FILL ),
(GtkAttachOptions) ( 0 ), 0, 0 ); (GtkAttachOptions) ( 0 ), 0, 0 );
gtk_misc_set_alignment( GTK_MISC( label ), 0, 0.5 ); gtk_misc_set_alignment( GTK_MISC( label ), 0, 0.5 );
gtk_widget_show( label );
label = gtk_label_new( _( "Rotate Step" ) ); label = gtk_label_new( _( "Rotate Step" ) );
gtk_widget_show( label );
gtk_table_attach( GTK_TABLE( table ), label, 2, 3, 4, 5, gtk_table_attach( GTK_TABLE( table ), label, 2, 3, 4, 5,
(GtkAttachOptions) ( GTK_FILL ), (GtkAttachOptions) ( GTK_FILL ),
(GtkAttachOptions) ( 0 ), 0, 0 ); (GtkAttachOptions) ( 0 ), 0, 0 );
gtk_misc_set_alignment( GTK_MISC( label ), 0, 0.5 ); gtk_misc_set_alignment( GTK_MISC( label ), 0, 0.5 );
gtk_widget_show( label );
entry = gtk_entry_new(); adj = GTK_ADJUSTMENT( gtk_adjustment_new( 0, -INT_MAX, INT_MAX, 1, 10, 0 ) );
gtk_widget_show( entry ); spin = gtk_spin_button_new( GTK_ADJUSTMENT( adj ), 1, 4 );
gtk_table_attach( GTK_TABLE( table ), entry, 0, 1, 0, 1, gtk_table_attach( GTK_TABLE( table ), spin, 0, 1, 0, 1,
(GtkAttachOptions) ( GTK_FILL ), (GtkAttachOptions) ( GTK_FILL ),
(GtkAttachOptions) ( 0 ), 0, 0 ); (GtkAttachOptions) ( 0 ), 0, 0 );
gtk_widget_set_usize( entry, 50, -2 ); gtk_spin_button_set_wrap( GTK_SPIN_BUTTON( spin ), FALSE );
g_object_set_data( G_OBJECT( m_pWidget ), "hshift_entry", entry ); 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 // 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 // so we need to have at least one initialisation somewhere
sprintf( buf, "%g", l_pPIIncrement->shift[0] ); gtk_spin_button_set_value( GTK_SPIN_BUTTON( spin ), l_pPIIncrement->shift[0] );
gtk_entry_set_text( GTK_ENTRY( entry ), buf );
adj = gtk_adjustment_new( 0, -8192, 8192, 1, 1, 0 ); adj = GTK_ADJUSTMENT( gtk_adjustment_new( 0, -8192, 8192, 1, 1, 0 ) );
g_signal_connect( adj, "value-changed", G_CALLBACK( OnSpinChanged ), entry ); g_signal_connect( adj, "value-changed", G_CALLBACK( OnSpinChanged ), spin );
g_object_set_data( G_OBJECT( m_pWidget ), "hshift_adj", adj ); g_object_set_data( G_OBJECT( m_pWidget ), "hshift_adj", adj );
spin = gtk_spin_button_new( GTK_ADJUSTMENT( adj ), 1, 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_table_attach( GTK_TABLE( table ), spin, 1, 2, 0, 1, gtk_table_attach( GTK_TABLE( table ), spin, 1, 2, 0, 1,
(GtkAttachOptions) ( 0 ), (GtkAttachOptions) ( 0 ),
(GtkAttachOptions) ( 0 ), 0, 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(); adj = GTK_ADJUSTMENT( gtk_adjustment_new( 0, -INT_MAX, INT_MAX, 1, 10, 0 ) );
gtk_widget_show( entry ); spin = gtk_spin_button_new( GTK_ADJUSTMENT( adj ), 1, 4 );
gtk_table_attach( GTK_TABLE( table ), entry, 0, 1, 1, 2, gtk_table_attach( GTK_TABLE( table ), spin, 0, 1, 1, 2,
(GtkAttachOptions) ( GTK_FILL ), (GtkAttachOptions) ( GTK_FILL ),
(GtkAttachOptions) ( 0 ), 0, 0 ); (GtkAttachOptions) ( 0 ), 0, 0 ); gtk_spin_button_set_wrap( GTK_SPIN_BUTTON( spin ), FALSE );
gtk_widget_set_usize( entry, 50, -2 ); gtk_spin_button_set_numeric( GTK_SPIN_BUTTON( spin ), TRUE );
sprintf( buf, "%g", l_pPIIncrement->shift[1] ); gtk_entry_set_alignment( GTK_ENTRY( spin ), 1.0 ); //right
gtk_entry_set_text( GTK_ENTRY( entry ), buf ); 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 ); adj = GTK_ADJUSTMENT( gtk_adjustment_new( 0, -8192, 8192, 1, 1, 0 ) );
g_signal_connect( adj, "value-changed", G_CALLBACK( OnSpinChanged ), entry ); g_signal_connect( adj, "value-changed", G_CALLBACK( OnSpinChanged ), spin );
g_object_set_data( G_OBJECT( m_pWidget ), "vshift_adj", adj ); g_object_set_data( G_OBJECT( m_pWidget ), "vshift_adj", adj );
spin = gtk_spin_button_new( GTK_ADJUSTMENT( adj ), 1, 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_table_attach( GTK_TABLE( table ), spin, 1, 2, 1, 2, gtk_table_attach( GTK_TABLE( table ), spin, 1, 2, 1, 2,
(GtkAttachOptions) ( 0 ), (GtkAttachOptions) ( 0 ),
(GtkAttachOptions) ( 0 ), 0, 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(); adj = GTK_ADJUSTMENT( gtk_adjustment_new( 0, -INT_MAX, INT_MAX, 1, 10, 0 ) );
gtk_widget_show( entry ); spin = gtk_spin_button_new( GTK_ADJUSTMENT( adj ), 1, 4 );
gtk_table_attach( GTK_TABLE( table ), entry, 0, 1, 2, 3, gtk_table_attach( GTK_TABLE( table ), spin, 0, 1, 2, 3,
(GtkAttachOptions) ( GTK_FILL ), (GtkAttachOptions) ( GTK_FILL ),
(GtkAttachOptions) ( 0 ), 0, 0 ); (GtkAttachOptions) ( 0 ), 0, 0 );
gtk_widget_set_usize( entry, 50, -2 ); gtk_spin_button_set_wrap( GTK_SPIN_BUTTON( spin ), FALSE );
sprintf( buf, "%g", l_pPIIncrement->scale[0] ); gtk_spin_button_set_numeric( GTK_SPIN_BUTTON( spin ), TRUE );
gtk_entry_set_text( GTK_ENTRY( entry ), buf ); 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 ); adj = GTK_ADJUSTMENT( gtk_adjustment_new( 0, -1000, 1000, 1, 1, 0 ) );
g_signal_connect( adj, "value-changed", G_CALLBACK( OnSpinChanged ), entry ); g_signal_connect( adj, "value-changed", G_CALLBACK( OnSpinChanged ), spin );
g_object_set_data( G_OBJECT( m_pWidget ), "hscale_adj", adj ); g_object_set_data( G_OBJECT( m_pWidget ), "hscale_adj", adj );
spin = gtk_spin_button_new( GTK_ADJUSTMENT( adj ), 1, 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_table_attach( GTK_TABLE( table ), spin, 1, 2, 2, 3, gtk_table_attach( GTK_TABLE( table ), spin, 1, 2, 2, 3,
(GtkAttachOptions) ( 0 ), (GtkAttachOptions) ( 0 ),
(GtkAttachOptions) ( 0 ), 0, 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(); adj = GTK_ADJUSTMENT( gtk_adjustment_new( 0, -INT_MAX, INT_MAX, 1, 10, 0 ) );
gtk_widget_show( entry ); spin = gtk_spin_button_new( GTK_ADJUSTMENT( adj ), 1, 4 );
gtk_table_attach( GTK_TABLE( table ), entry, 0, 1, 3, 4, gtk_table_attach( GTK_TABLE( table ), spin, 0, 1, 3, 4,
(GtkAttachOptions) ( GTK_FILL ), (GtkAttachOptions) ( GTK_FILL ),
(GtkAttachOptions) ( 0 ), 0, 0 ); (GtkAttachOptions) ( 0 ), 0, 0 ); gtk_spin_button_set_wrap( GTK_SPIN_BUTTON( spin ), FALSE );
gtk_widget_set_usize( entry, 50, -2 ); gtk_spin_button_set_numeric( GTK_SPIN_BUTTON( spin ), TRUE );
sprintf( buf, "%g", l_pPIIncrement->scale[1] ); gtk_entry_set_alignment( GTK_ENTRY( spin ), 1.0 ); //right
gtk_entry_set_text( GTK_ENTRY( entry ), buf ); 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 ); adj = GTK_ADJUSTMENT( gtk_adjustment_new( 0, -1000, 1000, 1, 1, 0 ) );
g_signal_connect( adj, "value-changed", G_CALLBACK( OnSpinChanged ), entry ); g_signal_connect( adj, "value-changed", G_CALLBACK( OnSpinChanged ), spin );
g_object_set_data( G_OBJECT( m_pWidget ), "vscale_adj", adj ); g_object_set_data( G_OBJECT( m_pWidget ), "vscale_adj", adj );
spin = gtk_spin_button_new( GTK_ADJUSTMENT( adj ), 1, 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_table_attach( GTK_TABLE( table ), spin, 1, 2, 3, 4, gtk_table_attach( GTK_TABLE( table ), spin, 1, 2, 3, 4,
(GtkAttachOptions) ( 0 ), (GtkAttachOptions) ( 0 ),
(GtkAttachOptions) ( 0 ), 0, 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(); adj = GTK_ADJUSTMENT( gtk_adjustment_new( 0, -360, 360, 1, 10, 0 ) );
gtk_widget_show( entry ); spin = gtk_spin_button_new( GTK_ADJUSTMENT( adj ), 1, 4 );
gtk_table_attach( GTK_TABLE( table ), entry, 0, 1, 4, 5, gtk_table_attach( GTK_TABLE( table ), spin, 0, 1, 4, 5,
(GtkAttachOptions) ( GTK_FILL ), (GtkAttachOptions) ( GTK_FILL ),
(GtkAttachOptions) ( 0 ), 0, 0 ); (GtkAttachOptions) ( 0 ), 0, 0 );
gtk_widget_set_usize( entry, 50, -2 ); gtk_spin_button_set_wrap( GTK_SPIN_BUTTON( spin ), TRUE );
sprintf( buf, "%g", l_pPIIncrement->rotate ); gtk_spin_button_set_numeric( GTK_SPIN_BUTTON( spin ), TRUE );
gtk_entry_set_text( GTK_ENTRY( entry ), buf ); 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 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 ), entry ); g_signal_connect( adj, "value-changed", G_CALLBACK( OnSpinChanged ), spin );
g_object_set_data( G_OBJECT( m_pWidget ), "rotate_adj", adj ); g_object_set_data( G_OBJECT( m_pWidget ), "rotate_adj", adj );
spin = gtk_spin_button_new( GTK_ADJUSTMENT( adj ), 1, 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_table_attach( GTK_TABLE( table ), spin, 1, 2, 4, 5, gtk_table_attach( GTK_TABLE( table ), spin, 1, 2, 4, 5,
(GtkAttachOptions) ( 0 ), (GtkAttachOptions) ( 0 ),
(GtkAttachOptions) ( 0 ), 0, 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 ); hbox2 = gtk_hbox_new( TRUE, 5 );
gtk_widget_show( hbox2 );
gtk_box_pack_start( GTK_BOX( vbox2 ), hbox2, TRUE, FALSE, 0 ); gtk_box_pack_start( GTK_BOX( vbox2 ), hbox2, TRUE, FALSE, 0 );
gtk_widget_show( hbox2 );
button = gtk_button_new_with_label( _( "CAP" ) ); cap_button = button = gtk_button_new_with_label( _( "CAP" ) );
gtk_widget_show( button );
gtk_box_pack_end( GTK_BOX( hbox2 ), button, TRUE, FALSE, 0 ); 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 ); 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..." ) ); set_button = button = gtk_button_new_with_label( _( "Set..." ) );
gtk_widget_show( button );
gtk_box_pack_end( GTK_BOX( hbox2 ), button, TRUE, FALSE, 0 ); 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 ); 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" ) ); nat_button = button = gtk_button_new_with_label( _( "Natural" ) );
gtk_widget_show( button );
gtk_box_pack_end( GTK_BOX( hbox2 ), button, TRUE, FALSE, 0 ); 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 ); 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" ) ); fit_button = button = gtk_button_new_with_label( _( "Fit" ) );
gtk_widget_show( button );
gtk_box_pack_end( GTK_BOX( hbox2 ), button, TRUE, FALSE, 0 ); 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 ); 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 ); hbox = gtk_hbox_new( FALSE, 5 );
gtk_widget_show( hbox );
gtk_box_pack_start( GTK_BOX( vbox ), hbox, TRUE, FALSE, 0 ); gtk_box_pack_start( GTK_BOX( vbox ), hbox, TRUE, FALSE, 0 );
gtk_widget_show( hbox );
button = gtk_button_new_with_label( _( "Done" ) ); button = gtk_button_new_with_label( _( "Done" ) );
gtk_widget_show( button );
gtk_box_pack_end( GTK_BOX( hbox ), button, FALSE, FALSE, 0 ); 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 ); 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" ) ); button = gtk_button_new_with_label( _( "Apply" ) );
gtk_widget_show( button );
gtk_box_pack_end( GTK_BOX( hbox ), button, FALSE, FALSE, 0 ); 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 ); 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 // sync the dialog our internal data structures
@ -660,11 +707,11 @@ void PatchDialog::UpdateData( bool retrieve ){
void PatchDialog::GetPatchInfo(){ void PatchDialog::GetPatchInfo(){
m_Patch = SinglePatchSelected(); m_Patch = SinglePatchSelected();
if ( m_Patch != NULL ) { if ( m_Patch != NULL ) {
m_strName = m_Patch->pShader->getName();
GList *combo_list = NULL; GList *combo_list = NULL;
int i; int i;
m_strName = m_Patch->pShader->getName();
// fill in the numbers for Row / Col selection // fill in the numbers for Row / Col selection
m_bListenChanged = false; m_bListenChanged = false;

File diff suppressed because it is too large Load diff

View file

@ -503,12 +503,14 @@ void SurfaceDlg::InitDefaultIncrement( texdef_t *tex ){
void SurfaceDlg::BuildDialog() { void SurfaceDlg::BuildDialog() {
GtkWidget *dlg, *vbox, *hbox2, *frame, *table, *label; GtkWidget *dlg, *vbox, *hbox2, *frame, *table, *label;
GtkWidget *button, *entry, *spin; GtkWidget *button, *entry, *spin;
GtkWidget *axial_button, *cap_button, *set_button, *nat_button, *fit_button;
GtkSizeGroup *button_group;
dlg = m_pWidget; dlg = m_pWidget;
load_window_pos( dlg, g_PrefsDlg.mWindowInfo.posSurfaceWnd ); 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); //g_signal_connect (G_OBJECT (dlg), "delete-event", G_CALLBACK (OnCancel), NULL);
// we catch 'Enter' and interpret is as OnDone // we catch 'Enter' and interpret is as OnDone
g_signal_connect( G_OBJECT( dlg ), "key-press-event", G_CALLBACK( OnDialogKey ), NULL ); 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: // replaced by only the vbox:
vbox = gtk_vbox_new( FALSE, 5 ); vbox = gtk_vbox_new( FALSE, 5 );
gtk_widget_show( vbox );
gtk_container_add( GTK_CONTAINER( dlg ), vbox ); gtk_container_add( GTK_CONTAINER( dlg ), vbox );
gtk_container_set_border_width( GTK_CONTAINER( vbox ), 5 ); gtk_container_set_border_width( GTK_CONTAINER( vbox ), 5 );
gtk_widget_show( vbox );
hbox2 = gtk_hbox_new( FALSE, 5 ); hbox2 = gtk_hbox_new( FALSE, 5 );
gtk_widget_show( hbox2 );
gtk_box_pack_start( GTK_BOX( vbox ), hbox2, FALSE, TRUE, 0 ); gtk_box_pack_start( GTK_BOX( vbox ), hbox2, FALSE, TRUE, 0 );
gtk_widget_show( hbox2 );
label = gtk_label_new( _( "Texture" ) ); label = gtk_label_new( _( "Texture" ) );
gtk_widget_show( label );
gtk_box_pack_start( GTK_BOX( hbox2 ), label, FALSE, TRUE, 0 ); gtk_box_pack_start( GTK_BOX( hbox2 ), label, FALSE, TRUE, 0 );
gtk_widget_show( label );
entry = gtk_entry_new(); entry = gtk_entry_new();
g_signal_connect( G_OBJECT( entry ), "key-press-event", G_CALLBACK( OnTextureKey ), NULL ); 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_box_pack_start( GTK_BOX( hbox2 ), entry, TRUE, TRUE, 0 );
gtk_widget_show( entry );
g_object_set_data( G_OBJECT( m_pWidget ), "texture", entry ); g_object_set_data( G_OBJECT( m_pWidget ), "texture", entry );
// table = gtk_table_new (5, 4, FALSE); // table = gtk_table_new (5, 4, FALSE);
table = gtk_table_new( 6, 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_box_pack_start( GTK_BOX( vbox ), table, FALSE, TRUE, 0 );
gtk_table_set_row_spacings( GTK_TABLE( table ), 5 ); gtk_table_set_row_spacings( GTK_TABLE( table ), 5 );
gtk_table_set_col_spacings( GTK_TABLE( table ), 5 ); gtk_table_set_col_spacings( GTK_TABLE( table ), 5 );
gtk_widget_show( table );
label = gtk_label_new( _( "Horizontal shift" ) ); label = gtk_label_new( _( "Horizontal shift" ) );
gtk_widget_show( label );
gtk_misc_set_alignment( GTK_MISC( label ), 0, 0 ); gtk_misc_set_alignment( GTK_MISC( label ), 0, 0 );
gtk_table_attach( GTK_TABLE( table ), label, 0, 1, 0, 1, gtk_table_attach( GTK_TABLE( table ), label, 0, 1, 0, 1,
(GtkAttachOptions) ( GTK_FILL ), (GtkAttachOptions) ( GTK_FILL ),
(GtkAttachOptions) ( 0 ), 0, 0 ); (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 ); 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_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_signal_connect( G_OBJECT( gtk_spin_button_get_adjustment( GTK_SPIN_BUTTON( spin ) ) ), "value-changed",
G_CALLBACK( OnUpdate ), NULL ); G_CALLBACK( OnUpdate ), NULL );
gtk_widget_show( spin );
gtk_table_attach( GTK_TABLE( table ), spin, 1, 2, 0, 1, gtk_table_attach( GTK_TABLE( table ), spin, 1, 2, 0, 1,
(GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
(GtkAttachOptions) ( 0 ), 0, 0 ); (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" ) ); label = gtk_label_new( _( "Step" ) );
gtk_widget_show( label );
gtk_misc_set_alignment( GTK_MISC( label ), 0, 0 ); gtk_misc_set_alignment( GTK_MISC( label ), 0, 0 );
gtk_table_attach( GTK_TABLE( table ), label, 2, 3, 0, 1, gtk_table_attach( GTK_TABLE( table ), label, 2, 3, 0, 1,
(GtkAttachOptions) ( GTK_FILL ), (GtkAttachOptions) ( GTK_FILL ),
(GtkAttachOptions) ( 0 ), 0, 0 ); (GtkAttachOptions) ( 0 ), 0, 0 );
gtk_widget_show( label );
entry = gtk_entry_new(); entry = gtk_entry_new();
g_object_set_data( G_OBJECT( dlg ), "hshift_inc", entry ); g_object_set_data( G_OBJECT( dlg ), "hshift_inc", entry );
g_signal_connect( G_OBJECT( entry ), "changed", g_signal_connect( G_OBJECT( entry ), "changed",
G_CALLBACK( OnIncrementChanged ), NULL ); G_CALLBACK( OnIncrementChanged ), NULL );
gtk_widget_show( entry );
gtk_table_attach( GTK_TABLE( table ), entry, 3, 4, 0, 1, gtk_table_attach( GTK_TABLE( table ), entry, 3, 4, 0, 1,
(GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
(GtkAttachOptions) ( 0 ), 0, 0 ); (GtkAttachOptions) ( 0 ), 0, 0 );
gtk_widget_set_usize( entry, 50, -2 ); gtk_widget_show( entry );
label = gtk_label_new( _( "Vertical shift" ) ); label = gtk_label_new( _( "Vertical shift" ) );
gtk_widget_show( label );
gtk_misc_set_alignment( GTK_MISC( label ), 0, 0 ); gtk_misc_set_alignment( GTK_MISC( label ), 0, 0 );
gtk_table_attach( GTK_TABLE( table ), label, 0, 1, 1, 2, gtk_table_attach( GTK_TABLE( table ), label, 0, 1, 1, 2,
(GtkAttachOptions) ( GTK_FILL ), (GtkAttachOptions) ( GTK_FILL ),
(GtkAttachOptions) ( 0 ), 0, 0 ); (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 ); 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_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_signal_connect( G_OBJECT( gtk_spin_button_get_adjustment( GTK_SPIN_BUTTON( spin ) ) ), "value-changed",
G_CALLBACK( OnUpdate ), NULL ); G_CALLBACK( OnUpdate ), NULL );
gtk_widget_show( spin );
gtk_table_attach( GTK_TABLE( table ), spin, 1, 2, 1, 2, gtk_table_attach( GTK_TABLE( table ), spin, 1, 2, 1, 2,
(GtkAttachOptions) ( GTK_FILL ), (GtkAttachOptions) ( GTK_FILL ),
(GtkAttachOptions) ( 0 ), 0, 0 ); (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" ) ); label = gtk_label_new( _( "Step" ) );
gtk_widget_show( label );
gtk_misc_set_alignment( GTK_MISC( label ), 0, 0 ); gtk_misc_set_alignment( GTK_MISC( label ), 0, 0 );
gtk_table_attach( GTK_TABLE( table ), label, 2, 3, 1, 2, gtk_table_attach( GTK_TABLE( table ), label, 2, 3, 1, 2,
(GtkAttachOptions) ( GTK_FILL ), (GtkAttachOptions) ( GTK_FILL ),
(GtkAttachOptions) ( 0 ), 0, 0 ); (GtkAttachOptions) ( 0 ), 0, 0 );
gtk_widget_show( label );
entry = gtk_entry_new(); entry = gtk_entry_new();
g_object_set_data( G_OBJECT( dlg ), "vshift_inc", entry ); g_object_set_data( G_OBJECT( dlg ), "vshift_inc", entry );
g_signal_connect( G_OBJECT( entry ), "changed", g_signal_connect( G_OBJECT( entry ), "changed",
G_CALLBACK( OnIncrementChanged ), NULL ); G_CALLBACK( OnIncrementChanged ), NULL );
gtk_widget_show( entry );
gtk_table_attach( GTK_TABLE( table ), entry, 3, 4, 1, 2, gtk_table_attach( GTK_TABLE( table ), entry, 3, 4, 1, 2,
(GtkAttachOptions) ( GTK_FILL ), (GtkAttachOptions) ( GTK_FILL ),
(GtkAttachOptions) ( 0 ), 0, 0 ); (GtkAttachOptions) ( 0 ), 0, 0 );
gtk_widget_set_usize( entry, 50, -2 ); gtk_widget_show( entry );
label = gtk_label_new( _( "Horizontal stretch" ) ); label = gtk_label_new( _( "Horizontal stretch" ) );
gtk_widget_show( label );
gtk_misc_set_alignment( GTK_MISC( label ), 0, 0 ); gtk_misc_set_alignment( GTK_MISC( label ), 0, 0 );
gtk_table_attach( GTK_TABLE( table ), label, 0, 1, 2, 3, gtk_table_attach( GTK_TABLE( table ), label, 0, 1, 2, 3,
(GtkAttachOptions) ( GTK_FILL ), (GtkAttachOptions) ( GTK_FILL ),
(GtkAttachOptions) ( 0 ), 0, 0 ); (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 ); 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_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_signal_connect( G_OBJECT( gtk_spin_button_get_adjustment( GTK_SPIN_BUTTON( spin ) ) ), "value-changed",
G_CALLBACK( OnUpdate ), NULL ); G_CALLBACK( OnUpdate ), NULL );
gtk_widget_show( spin );
gtk_table_attach( GTK_TABLE( table ), spin, 1, 2, 2, 3, gtk_table_attach( GTK_TABLE( table ), spin, 1, 2, 2, 3,
(GtkAttachOptions) ( GTK_FILL ), (GtkAttachOptions) ( GTK_FILL ),
(GtkAttachOptions) ( 0 ), 0, 0 ); (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" ) ); label = gtk_label_new( _( "Step" ) );
gtk_widget_show( label );
gtk_misc_set_alignment( GTK_MISC( label ), 0, 0 ); gtk_misc_set_alignment( GTK_MISC( label ), 0, 0 );
gtk_table_attach( GTK_TABLE( table ), label, 2, 3, 2, 3, gtk_table_attach( GTK_TABLE( table ), label, 2, 3, 2, 3,
(GtkAttachOptions) ( GTK_FILL ), (GtkAttachOptions) ( GTK_FILL ),
(GtkAttachOptions) ( 0 ), 2, 3 ); (GtkAttachOptions) ( 0 ), 2, 3 );
gtk_widget_show( label );
entry = gtk_entry_new(); entry = gtk_entry_new();
g_object_set_data( G_OBJECT( dlg ), "hscale_inc", entry ); g_object_set_data( G_OBJECT( dlg ), "hscale_inc", entry );
g_signal_connect( G_OBJECT( entry ), "changed", g_signal_connect( G_OBJECT( entry ), "changed",
G_CALLBACK( OnIncrementChanged ), NULL ); G_CALLBACK( OnIncrementChanged ), NULL );
gtk_widget_show( entry );
gtk_table_attach( GTK_TABLE( table ), entry, 3, 4, 2, 3, gtk_table_attach( GTK_TABLE( table ), entry, 3, 4, 2, 3,
(GtkAttachOptions) ( GTK_FILL ), (GtkAttachOptions) ( GTK_FILL ),
(GtkAttachOptions) ( 0 ), 2, 3 ); (GtkAttachOptions) ( 0 ), 2, 3 );
gtk_widget_set_usize( entry, 50, -2 ); gtk_widget_show( entry );
label = gtk_label_new( _( "Vertical stretch" ) ); label = gtk_label_new( _( "Vertical stretch" ) );
gtk_widget_show( label );
gtk_misc_set_alignment( GTK_MISC( label ), 0, 0 ); gtk_misc_set_alignment( GTK_MISC( label ), 0, 0 );
gtk_table_attach( GTK_TABLE( table ), label, 0, 1, 3, 4, gtk_table_attach( GTK_TABLE( table ), label, 0, 1, 3, 4,
(GtkAttachOptions) ( GTK_FILL ), (GtkAttachOptions) ( GTK_FILL ),
(GtkAttachOptions) ( 0 ), 0, 0 ); (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 ); 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_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_signal_connect( G_OBJECT( gtk_spin_button_get_adjustment( GTK_SPIN_BUTTON( spin ) ) ), "value-changed",
G_CALLBACK( OnUpdate ), NULL ); G_CALLBACK( OnUpdate ), NULL );
gtk_widget_show( spin );
gtk_table_attach( GTK_TABLE( table ), spin, 1, 2, 3, 4, gtk_table_attach( GTK_TABLE( table ), spin, 1, 2, 3, 4,
(GtkAttachOptions) ( GTK_FILL ), (GtkAttachOptions) ( GTK_FILL ),
(GtkAttachOptions) ( 0 ), 0, 0 ); (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" ) ); label = gtk_label_new( _( "Step" ) );
gtk_widget_show( label );
gtk_misc_set_alignment( GTK_MISC( label ), 0, 0 ); gtk_misc_set_alignment( GTK_MISC( label ), 0, 0 );
gtk_table_attach( GTK_TABLE( table ), label, 2, 3, 3, 4, gtk_table_attach( GTK_TABLE( table ), label, 2, 3, 3, 4,
(GtkAttachOptions) ( GTK_FILL ), (GtkAttachOptions) ( GTK_FILL ),
(GtkAttachOptions) ( 0 ), 0, 0 ); (GtkAttachOptions) ( 0 ), 0, 0 );
gtk_widget_show( label );
entry = gtk_entry_new(); entry = gtk_entry_new();
g_object_set_data( G_OBJECT( dlg ), "vscale_inc", entry ); g_object_set_data( G_OBJECT( dlg ), "vscale_inc", entry );
g_signal_connect( G_OBJECT( entry ), "changed", g_signal_connect( G_OBJECT( entry ), "changed",
G_CALLBACK( OnIncrementChanged ), NULL ); G_CALLBACK( OnIncrementChanged ), NULL );
gtk_widget_show( entry );
gtk_table_attach( GTK_TABLE( table ), entry, 3, 4, 3, 4, gtk_table_attach( GTK_TABLE( table ), entry, 3, 4, 3, 4,
(GtkAttachOptions) ( GTK_FILL ), (GtkAttachOptions) ( GTK_FILL ),
(GtkAttachOptions) ( 0 ), 0, 0 ); (GtkAttachOptions) ( 0 ), 0, 0 );
gtk_widget_set_usize( entry, 50, -2 ); gtk_widget_show( entry );
label = gtk_label_new( _( "Rotate" ) ); label = gtk_label_new( _( "Rotate" ) );
gtk_widget_show( label );
gtk_misc_set_alignment( GTK_MISC( label ), 0, 0 ); gtk_misc_set_alignment( GTK_MISC( label ), 0, 0 );
gtk_table_attach( GTK_TABLE( table ), label, 0, 1, 4, 5, gtk_table_attach( GTK_TABLE( table ), label, 0, 1, 4, 5,
(GtkAttachOptions) ( GTK_FILL ), (GtkAttachOptions) ( GTK_FILL ),
(GtkAttachOptions) ( 0 ), 0, 0 ); (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 ); 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_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_signal_connect( G_OBJECT( gtk_spin_button_get_adjustment( GTK_SPIN_BUTTON( spin ) ) ), "value-changed",
G_CALLBACK( OnUpdate ), NULL ); G_CALLBACK( OnUpdate ), NULL );
gtk_widget_show( spin );
gtk_table_attach( GTK_TABLE( table ), spin, 1, 2, 4, 5, gtk_table_attach( GTK_TABLE( table ), spin, 1, 2, 4, 5,
(GtkAttachOptions) ( GTK_FILL ), (GtkAttachOptions) ( GTK_FILL ),
(GtkAttachOptions) ( 0 ), 0, 0 ); (GtkAttachOptions) ( 0 ), 0, 0 );
gtk_widget_set_usize( spin, 60, -2 ); gtk_spin_button_set_numeric( GTK_SPIN_BUTTON( spin ), TRUE );
gtk_spin_button_set_wrap( GTK_SPIN_BUTTON( spin ), TRUE ); gtk_widget_show( spin );
label = gtk_label_new( _( "Step" ) ); label = gtk_label_new( _( "Step" ) );
gtk_widget_show( label );
gtk_misc_set_alignment( GTK_MISC( label ), 0, 0 ); gtk_misc_set_alignment( GTK_MISC( label ), 0, 0 );
gtk_table_attach( GTK_TABLE( table ), label, 2, 3, 4, 5, gtk_table_attach( GTK_TABLE( table ), label, 2, 3, 4, 5,
(GtkAttachOptions) ( GTK_FILL ), (GtkAttachOptions) ( GTK_FILL ),
(GtkAttachOptions) ( 0 ), 0, 0 ); (GtkAttachOptions) ( 0 ), 0, 0 );
gtk_widget_show( label );
entry = gtk_entry_new(); entry = gtk_entry_new();
g_object_set_data( G_OBJECT( dlg ), "rotate_inc", entry ); g_object_set_data( G_OBJECT( dlg ), "rotate_inc", entry );
g_signal_connect( G_OBJECT( entry ), "changed", g_signal_connect( G_OBJECT( entry ), "changed",
G_CALLBACK( OnIncrementChanged ), NULL ); G_CALLBACK( OnIncrementChanged ), NULL );
gtk_widget_show( entry );
gtk_table_attach( GTK_TABLE( table ), entry, 3, 4, 4, 5, gtk_table_attach( GTK_TABLE( table ), entry, 3, 4, 4, 5,
(GtkAttachOptions) ( GTK_FILL ), (GtkAttachOptions) ( GTK_FILL ),
(GtkAttachOptions) ( 0 ), 0, 0 ); (GtkAttachOptions) ( 0 ), 0, 0 );
gtk_widget_set_usize( entry, 50, -2 ); gtk_widget_show( entry );
// match grid button // match grid button
button = gtk_button_new_with_label( _( "Match Grid" ) ); button = gtk_button_new_with_label( _( "Match Grid" ) );
gtk_widget_show( button );
gtk_table_attach( GTK_TABLE( table ), button, 2, 4, 5, 6, gtk_table_attach( GTK_TABLE( table ), button, 2, 4, 5, 6,
(GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
(GtkAttachOptions) ( 0 ), 0, 0 ); (GtkAttachOptions) ( 0 ), 0, 0 );
gtk_widget_show( button );
g_signal_connect( G_OBJECT( button ), "clicked", g_signal_connect( G_OBJECT( button ), "clicked",
G_CALLBACK( OnBtnMatchGrid ), NULL ); G_CALLBACK( OnBtnMatchGrid ), NULL );
frame = gtk_frame_new( _( "Texturing" ) ); frame = gtk_frame_new( _( "Texturing" ) );
gtk_widget_show( frame );
gtk_box_pack_start( GTK_BOX( vbox ), frame, FALSE, TRUE, 0 ); gtk_box_pack_start( GTK_BOX( vbox ), frame, FALSE, TRUE, 0 );
gtk_widget_show( frame );
table = gtk_table_new( 4, 4, FALSE ); table = gtk_table_new( 4, 4, FALSE );
gtk_widget_show( table );
gtk_container_add( GTK_CONTAINER( frame ), table ); gtk_container_add( GTK_CONTAINER( frame ), table );
gtk_table_set_row_spacings( GTK_TABLE( table ), 5 ); gtk_table_set_row_spacings( GTK_TABLE( table ), 5 );
gtk_table_set_col_spacings( GTK_TABLE( table ), 5 ); gtk_table_set_col_spacings( GTK_TABLE( table ), 5 );
gtk_container_set_border_width( GTK_CONTAINER( table ), 5 ); gtk_container_set_border_width( GTK_CONTAINER( table ), 5 );
gtk_widget_show( table );
label = gtk_label_new( _( "Brush" ) ); label = gtk_label_new( _( "Brush" ) );
gtk_widget_show( label );
gtk_table_attach( GTK_TABLE( table ), label, 0, 1, 0, 1, gtk_table_attach( GTK_TABLE( table ), label, 0, 1, 0, 1,
(GtkAttachOptions) ( GTK_FILL ), (GtkAttachOptions) ( GTK_FILL ),
(GtkAttachOptions) ( 0 ), 0, 0 ); (GtkAttachOptions) ( 0 ), 0, 0 );
gtk_widget_show( label );
label = gtk_label_new( _( "Patch" ) ); label = gtk_label_new( _( "Patch" ) );
gtk_widget_show( label );
gtk_table_attach( GTK_TABLE( table ), label, 0, 1, 2, 3, gtk_table_attach( GTK_TABLE( table ), label, 0, 1, 2, 3,
(GtkAttachOptions) ( GTK_FILL ), (GtkAttachOptions) ( GTK_FILL ),
(GtkAttachOptions) ( 0 ), 0, 0 ); (GtkAttachOptions) ( 0 ), 0, 0 );
gtk_widget_show( label );
label = gtk_label_new( _( "Width" ) ); label = gtk_label_new( _( "Width" ) );
gtk_widget_show( label );
gtk_table_attach( GTK_TABLE( table ), label, 2, 3, 0, 1, gtk_table_attach( GTK_TABLE( table ), label, 2, 3, 0, 1,
(GtkAttachOptions) ( GTK_FILL ), (GtkAttachOptions) ( GTK_FILL ),
(GtkAttachOptions) ( 0 ), 0, 0 ); (GtkAttachOptions) ( 0 ), 0, 0 );
gtk_widget_show( label );
label = gtk_label_new( _( "Height" ) ); label = gtk_label_new( _( "Height" ) );
gtk_widget_show( label );
gtk_table_attach( GTK_TABLE( table ), label, 3, 4, 0, 1, gtk_table_attach( GTK_TABLE( table ), label, 3, 4, 0, 1,
(GtkAttachOptions) ( GTK_FILL ), (GtkAttachOptions) ( GTK_FILL ),
(GtkAttachOptions) ( 0 ), 0, 0 ); (GtkAttachOptions) ( 0 ), 0, 0 );
gtk_widget_show( label );
button = gtk_button_new_with_label( _( "Axial" ) ); axial_button = button = gtk_button_new_with_label( _( "Axial" ) );
gtk_widget_show( button );
gtk_table_attach( GTK_TABLE( table ), button, 0, 1, 1, 2, gtk_table_attach( GTK_TABLE( table ), button, 0, 1, 1, 2,
(GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
(GtkAttachOptions) ( 0 ), 0, 0 ); (GtkAttachOptions) ( 0 ), 0, 0 );
gtk_widget_show( button );
g_signal_connect( G_OBJECT( button ), "clicked", g_signal_connect( G_OBJECT( button ), "clicked",
G_CALLBACK( OnBtnAxial ), NULL ); G_CALLBACK( OnBtnAxial ), NULL );
gtk_widget_set_usize( button, 60, -2 );
button = gtk_button_new_with_label( _( "Fit" ) ); fit_button = button = gtk_button_new_with_label( _( "Fit" ) );
gtk_widget_show( button );
gtk_table_attach( GTK_TABLE( table ), button, 1, 2, 1, 2, gtk_table_attach( GTK_TABLE( table ), button, 1, 2, 1, 2,
(GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
(GtkAttachOptions) ( 0 ), 0, 0 ); (GtkAttachOptions) ( 0 ), 0, 0 );
gtk_widget_show( button );
g_signal_connect( G_OBJECT( button ), "clicked", g_signal_connect( G_OBJECT( button ), "clicked",
G_CALLBACK( OnBtnFaceFit ), NULL ); G_CALLBACK( OnBtnFaceFit ), NULL );
gtk_widget_set_usize( button, 60, -2 );
button = gtk_button_new_with_label( _( "CAP" ) ); button_group = gtk_size_group_new( GTK_SIZE_GROUP_BOTH );
gtk_widget_show( button ); 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, gtk_table_attach( GTK_TABLE( table ), button, 0, 1, 3, 4,
(GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
(GtkAttachOptions) ( 0 ), 0, 0 ); (GtkAttachOptions) ( 0 ), 0, 0 );
gtk_widget_show( button );
g_signal_connect( G_OBJECT( button ), "clicked", g_signal_connect( G_OBJECT( button ), "clicked",
G_CALLBACK( OnBtnPatchdetails ), NULL ); G_CALLBACK( OnBtnPatchdetails ), NULL );
gtk_widget_set_usize( button, 60, -2 );
button = gtk_button_new_with_label( _( "Set..." ) ); set_button = button = gtk_button_new_with_label( _( "Set..." ) );
gtk_widget_show( button );
gtk_table_attach( GTK_TABLE( table ), button, 1, 2, 3, 4, gtk_table_attach( GTK_TABLE( table ), button, 1, 2, 3, 4,
(GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
(GtkAttachOptions) ( 0 ), 0, 0 ); (GtkAttachOptions) ( 0 ), 0, 0 );
gtk_widget_show( button );
g_signal_connect( G_OBJECT( button ), "clicked", g_signal_connect( G_OBJECT( button ), "clicked",
G_CALLBACK( OnBtnPatchreset ), NULL ); G_CALLBACK( OnBtnPatchreset ), NULL );
gtk_widget_set_usize( button, 60, -2 );
button = gtk_button_new_with_label( _( "Natural" ) ); nat_button = button = gtk_button_new_with_label( _( "Natural" ) );
gtk_widget_show( button );
gtk_table_attach( GTK_TABLE( table ), button, 2, 3, 3, 4, gtk_table_attach( GTK_TABLE( table ), button, 2, 3, 3, 4,
(GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
(GtkAttachOptions) ( 0 ), 0, 0 ); (GtkAttachOptions) ( 0 ), 0, 0 );
gtk_widget_show( button );
g_signal_connect( G_OBJECT( button ), "clicked", g_signal_connect( G_OBJECT( button ), "clicked",
G_CALLBACK( OnBtnPatchnatural ), NULL ); G_CALLBACK( OnBtnPatchnatural ), NULL );
gtk_widget_set_usize( button, 60, -2 );
button = gtk_button_new_with_label( _( "Fit" ) ); fit_button = button = gtk_button_new_with_label( _( "Fit" ) );
gtk_widget_show( button );
gtk_table_attach( GTK_TABLE( table ), button, 3, 4, 3, 4, gtk_table_attach( GTK_TABLE( table ), button, 3, 4, 3, 4,
(GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
(GtkAttachOptions) ( 0 ), 0, 0 ); (GtkAttachOptions) ( 0 ), 0, 0 );
gtk_widget_show( button );
g_signal_connect( G_OBJECT( button ), "clicked", g_signal_connect( G_OBJECT( button ), "clicked",
G_CALLBACK( OnBtnPatchFit ), NULL ); 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 ); 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, gtk_table_attach( GTK_TABLE( table ), spin, 2, 3, 1, 2,
(GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
(GtkAttachOptions) ( 0 ), 0, 0 ); (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 ); 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 ); 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, gtk_table_attach( GTK_TABLE( table ), spin, 3, 4, 1, 2,
(GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
(GtkAttachOptions) ( 0 ), 0, 0 ); (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 ); AddDialogData( spin, &m_nHeight, DLG_SPIN_INT );
hbox2 = gtk_hbox_new( FALSE, 5 ); hbox2 = gtk_hbox_new( FALSE, 5 );
gtk_widget_show( hbox2 );
gtk_box_pack_start( GTK_BOX( vbox ), hbox2, FALSE, TRUE, 0 ); gtk_box_pack_start( GTK_BOX( vbox ), hbox2, FALSE, TRUE, 0 );
gtk_widget_show( hbox2 );
button = gtk_button_new_with_label( _( "Done" ) ); button = gtk_button_new_with_label( _( "Done" ) );
gtk_widget_show( button );
gtk_box_pack_start( GTK_BOX( hbox2 ), button, FALSE, FALSE, 0 ); gtk_box_pack_start( GTK_BOX( hbox2 ), button, FALSE, FALSE, 0 );
gtk_widget_show( button );
g_signal_connect( G_OBJECT( button ), "clicked", g_signal_connect( G_OBJECT( button ), "clicked",
G_CALLBACK( OnDone ), NULL ); G_CALLBACK( OnDone ), NULL );
gtk_widget_set_usize( button, 60, -2 );
button = gtk_button_new_with_label( _( "Apply" ) ); button = gtk_button_new_with_label( _( "Apply" ) );
gtk_widget_show( button );
gtk_box_pack_start( GTK_BOX( hbox2 ), button, FALSE, FALSE, 0 ); gtk_box_pack_start( GTK_BOX( hbox2 ), button, FALSE, FALSE, 0 );
gtk_widget_show( button );
g_signal_connect( G_OBJECT( button ), "clicked", g_signal_connect( G_OBJECT( button ), "clicked",
G_CALLBACK( OnApply ), NULL ); G_CALLBACK( OnApply ), NULL );
gtk_widget_set_usize( button, 60, -2 );
button = gtk_button_new_with_label( _( "Cancel" ) ); button = gtk_button_new_with_label( _( "Cancel" ) );
gtk_widget_show( button );
gtk_box_pack_start( GTK_BOX( hbox2 ), button, FALSE, FALSE, 0 ); gtk_box_pack_start( GTK_BOX( hbox2 ), button, FALSE, FALSE, 0 );
gtk_widget_show( button );
g_signal_connect( G_OBJECT( button ), "clicked", g_signal_connect( G_OBJECT( button ), "clicked",
G_CALLBACK( OnCancel ), NULL ); G_CALLBACK( OnCancel ), NULL );
gtk_widget_set_usize( button, 60, -2 );
// that's a bit of trashy stuff from Textool-v2 branch // that's a bit of trashy stuff from Textool-v2 branch
#ifdef _DEBUG #ifdef _DEBUG
// FIXME: testing only, scaling in BP mode // FIXME: testing only, scaling in BP mode
button = gtk_button_new_with_label( _( "Test" ) ); button = gtk_button_new_with_label( _( "Test" ) );
gtk_widget_show( button );
gtk_box_pack_start( GTK_BOX( hbox2 ), button, FALSE, FALSE, 0 ); gtk_box_pack_start( GTK_BOX( hbox2 ), button, FALSE, FALSE, 0 );
gtk_widget_show( button );
g_signal_connect( G_OBJECT( button ), "clicked", g_signal_connect( G_OBJECT( button ), "clicked",
G_CALLBACK( OnTest ), NULL ); G_CALLBACK( OnTest ), NULL );
gtk_widget_set_usize( button, 60, -2 );
#endif #endif
// Initialize // Initialize