2 BobToolz plugin for GtkRadiant
3 Copyright (C) 2001 Gordon Biggans
5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
10 This library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
15 You should have received a copy of the GNU Lesser General Public
16 License along with this library; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 #include "dialogs-gtk.h"
21 #include "../funchandlers.h"
27 #include "gtkutil/pointer.h"
33 /*--------------------------------
35 ---------------------------------*/
38 GtkWidget *cbTexChange;
39 GtkWidget *editTexOld, *editTexNew;
41 GtkWidget *cbScaleHor, *cbScaleVert;
42 GtkWidget *editScaleHor, *editScaleVert;
44 GtkWidget *cbShiftHor, *cbShiftVert;
45 GtkWidget *editShiftHor, *editShiftVert;
47 GtkWidget *cbRotation;
48 GtkWidget *editRotation;
51 dlg_texReset_t dlgTexReset;
53 void Update_TextureReseter();
55 static void dialog_button_callback_texreset_update( GtkWidget *widget, gpointer data ){
56 Update_TextureReseter();
59 void Update_TextureReseter(){
62 check = gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( dlgTexReset.cbTexChange ) );
63 gtk_entry_set_editable( GTK_ENTRY( dlgTexReset.editTexNew ), check );
64 gtk_entry_set_editable( GTK_ENTRY( dlgTexReset.editTexOld ), check );
66 check = gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( dlgTexReset.cbScaleHor ) );
67 gtk_entry_set_editable( GTK_ENTRY( dlgTexReset.editScaleHor ), check );
69 check = gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( dlgTexReset.cbScaleVert ) );
70 gtk_entry_set_editable( GTK_ENTRY( dlgTexReset.editScaleVert ), check );
72 check = gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( dlgTexReset.cbShiftHor ) );
73 gtk_entry_set_editable( GTK_ENTRY( dlgTexReset.editShiftHor ), check );
75 check = gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( dlgTexReset.cbShiftVert ) );
76 gtk_entry_set_editable( GTK_ENTRY( dlgTexReset.editShiftVert ), check );
78 check = gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( dlgTexReset.cbRotation ) );
79 gtk_entry_set_editable( GTK_ENTRY( dlgTexReset.editRotation ), check );
82 static void dialog_button_callback( GtkWidget *widget, gpointer data ){
85 EMessageBoxReturn *ret;
87 parent = gtk_widget_get_toplevel( widget );
88 loop = (int*)g_object_get_data( G_OBJECT( parent ), "loop" );
89 ret = (EMessageBoxReturn*)g_object_get_data( G_OBJECT( parent ), "ret" );
92 *ret = (EMessageBoxReturn)gpointer_to_int( data );
95 static gint dialog_delete_callback( GtkWidget *widget, GdkEvent* event, gpointer data ){
98 gtk_widget_hide( widget );
99 loop = (int*)g_object_get_data( G_OBJECT( widget ), "loop" );
105 static void dialog_button_callback_settex( GtkWidget *widget, gpointer data ){
106 TwinWidget* tw = (TwinWidget*)data;
108 GtkEntry* entry = GTK_ENTRY( tw->one );
109 GtkCombo* combo = GTK_COMBO( tw->two );
111 const gchar* tex = gtk_entry_get_text( GTK_ENTRY( combo->entry ) );
112 gtk_entry_set_text( entry, tex );
115 /*--------------------------------
116 Data validation Routines
117 ---------------------------------*/
119 bool ValidateTextFloat( const char* pData, const char* error_title, float* value ){
121 float testNum = (float)atof( pData );
123 if ( ( testNum == 0.0f ) && strcmp( pData, "0" ) ) {
124 DoMessageBox( "Please Enter A Floating Point Number", error_title, eMB_OK );
134 DoMessageBox( "Please Enter A Floating Point Number", error_title, eMB_OK );
138 bool ValidateTextFloatRange( const char* pData, float min, float max, const char* error_title, float* value ){
139 char error_buffer[256];
140 sprintf( error_buffer, "Please Enter A Floating Point Number Between %.3f and %.3f", min, max );
143 float testNum = (float)atof( pData );
145 if ( ( testNum < min ) || ( testNum > max ) ) {
146 DoMessageBox( error_buffer, error_title, eMB_OK );
156 DoMessageBox( error_buffer, error_title, eMB_OK );
160 bool ValidateTextIntRange( const char* pData, int min, int max, const char* error_title, int* value ){
161 char error_buffer[256];
162 sprintf( error_buffer, "Please Enter An Integer Between %i and %i", min, max );
165 int testNum = atoi( pData );
167 if ( ( testNum < min ) || ( testNum > max ) ) {
168 DoMessageBox( error_buffer, error_title, eMB_OK );
178 DoMessageBox( error_buffer, error_title, eMB_OK );
182 bool ValidateTextInt( const char* pData, const char* error_title, int* value ){
184 int testNum = atoi( pData );
186 if ( ( testNum == 0 ) && strcmp( pData, "0" ) ) {
187 DoMessageBox( "Please Enter An Integer", error_title, eMB_OK );
197 DoMessageBox( "Please Enter An Integer", error_title, eMB_OK );
201 /*--------------------------------
203 ---------------------------------*/
207 Major clean up of variable names etc required, excluding Mars's ones,
208 which are nicely done :)
212 EMessageBoxReturn DoMessageBox( const char* lpText, const char* lpCaption, EMessageBoxType type ){
213 ui::Widget window, w, vbox, hbox;
214 EMessageBoxReturn ret;
217 window = ui::Widget(gtk_window_new( GTK_WINDOW_TOPLEVEL ));
218 gtk_signal_connect( GTK_OBJECT( window ), "delete_event",
219 GTK_SIGNAL_FUNC( dialog_delete_callback ), NULL );
220 gtk_signal_connect( GTK_OBJECT( window ), "destroy",
221 GTK_SIGNAL_FUNC( gtk_widget_destroy ), NULL );
222 gtk_window_set_title( GTK_WINDOW( window ), lpCaption );
223 gtk_container_border_width( GTK_CONTAINER( window ), 10 );
224 g_object_set_data( G_OBJECT( window ), "loop", &loop );
225 g_object_set_data( G_OBJECT( window ), "ret", &ret );
226 gtk_widget_realize( window );
228 vbox = ui::Widget(gtk_vbox_new( FALSE, 10 ));
229 gtk_container_add( GTK_CONTAINER( window ), vbox );
230 gtk_widget_show( vbox );
232 w = ui::Label( lpText );
233 gtk_box_pack_start( GTK_BOX( vbox ), w, FALSE, FALSE, 2 );
234 gtk_label_set_justify( GTK_LABEL( w ), GTK_JUSTIFY_LEFT );
235 gtk_widget_show( w );
237 w = ui::Widget(gtk_hseparator_new());
238 gtk_box_pack_start( GTK_BOX( vbox ), w, FALSE, FALSE, 2 );
239 gtk_widget_show( w );
241 hbox = ui::Widget(gtk_hbox_new( FALSE, 10 ));
242 gtk_box_pack_start( GTK_BOX( vbox ), hbox, FALSE, FALSE, 2 );
243 gtk_widget_show( hbox );
245 if ( type == eMB_OK ) {
246 w = ui::Widget(gtk_button_new_with_label( "Ok" ));
247 gtk_box_pack_start( GTK_BOX( hbox ), w, TRUE, TRUE, 0 );
248 gtk_signal_connect( GTK_OBJECT( w ), "clicked",
249 GTK_SIGNAL_FUNC( dialog_button_callback ), GINT_TO_POINTER( eIDOK ) );
250 GTK_WIDGET_SET_FLAGS( w, GTK_CAN_DEFAULT );
251 gtk_widget_grab_default( w );
252 gtk_widget_show( w );
255 else if ( type == eMB_OKCANCEL ) {
256 w = ui::Widget(gtk_button_new_with_label( "Ok" ));
257 gtk_box_pack_start( GTK_BOX( hbox ), w, TRUE, TRUE, 0 );
258 gtk_signal_connect( GTK_OBJECT( w ), "clicked",
259 GTK_SIGNAL_FUNC( dialog_button_callback ), GINT_TO_POINTER( eIDOK ) );
260 GTK_WIDGET_SET_FLAGS( w, GTK_CAN_DEFAULT );
261 gtk_widget_grab_default( w );
262 gtk_widget_show( w );
264 w = ui::Widget(gtk_button_new_with_label( "Cancel" ));
265 gtk_box_pack_start( GTK_BOX( hbox ), w, TRUE, TRUE, 0 );
266 gtk_signal_connect( GTK_OBJECT( w ), "clicked",
267 GTK_SIGNAL_FUNC( dialog_button_callback ), GINT_TO_POINTER( eIDCANCEL ) );
268 gtk_widget_show( w );
271 else if ( type == eMB_YESNOCANCEL ) {
272 w = ui::Widget(gtk_button_new_with_label( "Yes" ));
273 gtk_box_pack_start( GTK_BOX( hbox ), w, TRUE, TRUE, 0 );
274 gtk_signal_connect( GTK_OBJECT( w ), "clicked",
275 GTK_SIGNAL_FUNC( dialog_button_callback ), GINT_TO_POINTER( eIDYES ) );
276 GTK_WIDGET_SET_FLAGS( w, GTK_CAN_DEFAULT );
277 gtk_widget_grab_default( w );
278 gtk_widget_show( w );
280 w = ui::Widget(gtk_button_new_with_label( "No" ));
281 gtk_box_pack_start( GTK_BOX( hbox ), w, TRUE, TRUE, 0 );
282 gtk_signal_connect( GTK_OBJECT( w ), "clicked",
283 GTK_SIGNAL_FUNC( dialog_button_callback ), GINT_TO_POINTER( eIDNO ) );
284 gtk_widget_show( w );
286 w = ui::Widget(gtk_button_new_with_label( "Cancel" ));
287 gtk_box_pack_start( GTK_BOX( hbox ), w, TRUE, TRUE, 0 );
288 gtk_signal_connect( GTK_OBJECT( w ), "clicked",
289 GTK_SIGNAL_FUNC( dialog_button_callback ), GINT_TO_POINTER( eIDCANCEL ) );
290 gtk_widget_show( w );
293 else /* if (mode == MB_YESNO) */
295 w = ui::Widget(gtk_button_new_with_label( "Yes" ));
296 gtk_box_pack_start( GTK_BOX( hbox ), w, TRUE, TRUE, 0 );
297 gtk_signal_connect( GTK_OBJECT( w ), "clicked",
298 GTK_SIGNAL_FUNC( dialog_button_callback ), GINT_TO_POINTER( eIDYES ) );
299 GTK_WIDGET_SET_FLAGS( w, GTK_CAN_DEFAULT );
300 gtk_widget_grab_default( w );
301 gtk_widget_show( w );
303 w = ui::Widget(gtk_button_new_with_label( "No" ));
304 gtk_box_pack_start( GTK_BOX( hbox ), w, TRUE, TRUE, 0 );
305 gtk_signal_connect( GTK_OBJECT( w ), "clicked",
306 GTK_SIGNAL_FUNC( dialog_button_callback ), GINT_TO_POINTER( eIDNO ) );
307 gtk_widget_show( w );
311 gtk_window_set_position( GTK_WINDOW( window ),GTK_WIN_POS_CENTER );
312 gtk_widget_show( window );
313 gtk_grab_add( window );
316 gtk_main_iteration();
318 gtk_grab_remove( window );
319 gtk_widget_destroy( window );
324 EMessageBoxReturn DoIntersectBox( IntersectRS* rs ){
325 GtkWidget *window, *w, *vbox, *hbox;
326 GtkWidget *radio1, *radio2;
327 GtkWidget *check1, *check2;
328 EMessageBoxReturn ret;
331 window = gtk_window_new( GTK_WINDOW_TOPLEVEL );
333 gtk_signal_connect( GTK_OBJECT( window ), "delete_event", GTK_SIGNAL_FUNC( dialog_delete_callback ), NULL );
334 gtk_signal_connect( GTK_OBJECT( window ), "destroy", GTK_SIGNAL_FUNC( gtk_widget_destroy ), NULL );
336 gtk_window_set_title( GTK_WINDOW( window ), "Intersect" );
337 gtk_container_border_width( GTK_CONTAINER( window ), 10 );
339 g_object_set_data( G_OBJECT( window ), "loop", &loop );
340 g_object_set_data( G_OBJECT( window ), "ret", &ret );
342 gtk_widget_realize( window );
346 vbox = gtk_vbox_new( FALSE, 10 );
347 gtk_container_add( GTK_CONTAINER( window ), vbox );
348 gtk_widget_show( vbox );
353 radio1 = gtk_radio_button_new_with_label( NULL, "Use Whole Map" );
354 gtk_box_pack_start( GTK_BOX( vbox ), radio1, FALSE, FALSE, 2 );
355 gtk_widget_show( radio1 );
357 radio2 = gtk_radio_button_new_with_label( ( (GtkRadioButton*)radio1 )->group, "Use Selected Brushes" );
358 gtk_box_pack_start( GTK_BOX( vbox ), radio2, FALSE, FALSE, 2 );
359 gtk_widget_show( radio2 );
361 w = gtk_hseparator_new();
362 gtk_box_pack_start( GTK_BOX( vbox ), w, FALSE, FALSE, 2 );
363 gtk_widget_show( w );
365 check1 = gtk_check_button_new_with_label( "Include Detail Brushes" );
366 gtk_box_pack_start( GTK_BOX( vbox ), check1, FALSE, FALSE, 0 );
367 gtk_widget_show( check1 );
369 check2 = gtk_check_button_new_with_label( "Select Duplicate Brushes Only" );
370 gtk_box_pack_start( GTK_BOX( vbox ), check2, FALSE, FALSE, 0 );
371 gtk_widget_show( check2 );
373 hbox = gtk_hbox_new( FALSE, 10 );
374 gtk_box_pack_start( GTK_BOX( vbox ), hbox, FALSE, FALSE, 2 );
375 gtk_widget_show( hbox );
377 // ---- hbox ---- ok/cancel buttons
379 w = gtk_button_new_with_label( "Ok" );
380 gtk_box_pack_start( GTK_BOX( hbox ), w, TRUE, TRUE, 0 );
381 gtk_signal_connect( GTK_OBJECT( w ), "clicked", GTK_SIGNAL_FUNC( dialog_button_callback ), GINT_TO_POINTER( eIDOK ) );
383 GTK_WIDGET_SET_FLAGS( w, GTK_CAN_DEFAULT );
384 gtk_widget_grab_default( w );
385 gtk_widget_show( w );
387 w = gtk_button_new_with_label( "Cancel" );
388 gtk_box_pack_start( GTK_BOX( hbox ), w, TRUE, TRUE, 0 );
389 gtk_signal_connect( GTK_OBJECT( w ), "clicked", GTK_SIGNAL_FUNC( dialog_button_callback ), GINT_TO_POINTER( eIDCANCEL ) );
390 gtk_widget_show( w );
397 gtk_window_set_position( GTK_WINDOW( window ),GTK_WIN_POS_CENTER );
398 gtk_widget_show( window );
399 gtk_grab_add( window );
402 gtk_main_iteration();
404 if ( gtk_toggle_button_get_active( (GtkToggleButton*)radio1 ) ) {
405 rs->nBrushOptions = BRUSH_OPT_WHOLE_MAP;
407 else if ( gtk_toggle_button_get_active( (GtkToggleButton*)radio2 ) ) {
408 rs->nBrushOptions = BRUSH_OPT_SELECTED;
411 rs->bUseDetail = gtk_toggle_button_get_active( (GtkToggleButton*)check1 ) ? true : false;
412 rs->bDuplicateOnly = gtk_toggle_button_get_active( (GtkToggleButton*)check2 ) ? true : false;
414 gtk_grab_remove( window );
415 gtk_widget_destroy( window );
420 EMessageBoxReturn DoPolygonBox( PolygonRS* rs ){
421 GtkWidget *window, *w, *vbox, *hbox, *vbox2, *hbox2;
423 GtkWidget *check1, *check2, *check3;
424 GtkWidget *text1, *text2;
426 EMessageBoxReturn ret;
429 window = gtk_window_new( GTK_WINDOW_TOPLEVEL );
431 gtk_signal_connect( GTK_OBJECT( window ), "delete_event", GTK_SIGNAL_FUNC( dialog_delete_callback ), NULL );
432 gtk_signal_connect( GTK_OBJECT( window ), "destroy", GTK_SIGNAL_FUNC( gtk_widget_destroy ), NULL );
434 gtk_window_set_title( GTK_WINDOW( window ), "Polygon Builder" );
435 gtk_container_border_width( GTK_CONTAINER( window ), 10 );
437 g_object_set_data( G_OBJECT( window ), "loop", &loop );
438 g_object_set_data( G_OBJECT( window ), "ret", &ret );
440 gtk_widget_realize( window );
444 vbox = gtk_vbox_new( FALSE, 10 );
445 gtk_container_add( GTK_CONTAINER( window ), vbox );
446 gtk_widget_show( vbox );
450 hbox = gtk_hbox_new( FALSE, 10 );
451 gtk_box_pack_start( GTK_BOX( vbox ), hbox, FALSE, FALSE, 2 );
452 gtk_widget_show( hbox );
457 vbox2 = gtk_vbox_new( FALSE, 10 );
458 gtk_box_pack_start( GTK_BOX( hbox ), vbox2, FALSE, FALSE, 2 );
459 gtk_widget_show( vbox2 );
463 hbox2 = gtk_hbox_new( FALSE, 10 );
464 gtk_box_pack_start( GTK_BOX( vbox2 ), hbox2, FALSE, FALSE, 2 );
465 gtk_widget_show( hbox2 );
469 text1 = gtk_entry_new_with_max_length( 256 );
470 gtk_entry_set_text( (GtkEntry*)text1, "3" );
471 gtk_box_pack_start( GTK_BOX( hbox2 ), text1, FALSE, FALSE, 2 );
472 gtk_widget_show( text1 );
474 w = ui::Label( "Number Of Sides" );
475 gtk_box_pack_start( GTK_BOX( hbox2 ), w, FALSE, FALSE, 2 );
476 gtk_label_set_justify( GTK_LABEL( w ), GTK_JUSTIFY_LEFT );
477 gtk_widget_show( w );
481 hbox2 = gtk_hbox_new( FALSE, 10 );
482 gtk_box_pack_start( GTK_BOX( vbox2 ), hbox2, FALSE, FALSE, 2 );
483 gtk_widget_show( hbox2 );
487 text2 = gtk_entry_new_with_max_length( 256 );
488 gtk_entry_set_text( (GtkEntry*)text2, "8" );
489 gtk_box_pack_start( GTK_BOX( hbox2 ), text2, FALSE, FALSE, 2 );
490 gtk_widget_show( text2 );
492 w = ui::Label( "Border Width" );
493 gtk_box_pack_start( GTK_BOX( hbox2 ), w, FALSE, FALSE, 2 );
494 gtk_label_set_justify( GTK_LABEL( w ), GTK_JUSTIFY_LEFT );
495 gtk_widget_show( w );
503 vbox2 = gtk_vbox_new( FALSE, 10 );
504 gtk_box_pack_start( GTK_BOX( hbox ), vbox2, FALSE, FALSE, 2 );
505 gtk_widget_show( vbox2 );
509 check1 = gtk_check_button_new_with_label( "Use Border" );
510 gtk_box_pack_start( GTK_BOX( vbox2 ), check1, FALSE, FALSE, 0 );
511 gtk_widget_show( check1 );
514 check2 = gtk_check_button_new_with_label( "Inverse Polygon" );
515 gtk_box_pack_start( GTK_BOX( vbox2 ), check2, FALSE, FALSE, 0 );
516 gtk_widget_show( check2 );
519 check3 = gtk_check_button_new_with_label( "Align Top Edge" );
520 gtk_box_pack_start( GTK_BOX( vbox2 ), check3, FALSE, FALSE, 0 );
521 gtk_widget_show( check3 );
527 hbox = gtk_hbox_new( FALSE, 10 );
528 gtk_box_pack_start( GTK_BOX( vbox ), hbox, FALSE, FALSE, 2 );
529 gtk_widget_show( hbox );
533 w = gtk_button_new_with_label( "Ok" );
534 gtk_box_pack_start( GTK_BOX( hbox ), w, TRUE, TRUE, 0 );
535 gtk_signal_connect( GTK_OBJECT( w ), "clicked", GTK_SIGNAL_FUNC( dialog_button_callback ), GINT_TO_POINTER( eIDOK ) );
537 GTK_WIDGET_SET_FLAGS( w, GTK_CAN_DEFAULT );
538 gtk_widget_grab_default( w );
539 gtk_widget_show( w );
541 w = gtk_button_new_with_label( "Cancel" );
542 gtk_box_pack_start( GTK_BOX( hbox ), w, TRUE, TRUE, 0 );
543 gtk_signal_connect( GTK_OBJECT( w ), "clicked", GTK_SIGNAL_FUNC( dialog_button_callback ), GINT_TO_POINTER( eIDCANCEL ) );
544 gtk_widget_show( w );
551 gtk_window_set_position( GTK_WINDOW( window ),GTK_WIN_POS_CENTER );
552 gtk_widget_show( window );
553 gtk_grab_add( window );
555 bool dialogError = TRUE;
556 while ( dialogError )
560 gtk_main_iteration();
564 if ( ret == eIDOK ) {
565 rs->bUseBorder = gtk_toggle_button_get_active( (GtkToggleButton*)check1 ) ? true : false;
566 rs->bInverse = gtk_toggle_button_get_active( (GtkToggleButton*)check2 ) ? true : false;
567 rs->bAlignTop = gtk_toggle_button_get_active( (GtkToggleButton*)check3 ) ? true : false;
569 if ( !ValidateTextIntRange( gtk_entry_get_text( (GtkEntry*)text1 ), 3, 32, "Number Of Sides", &rs->nSides ) ) {
573 if ( rs->bUseBorder ) {
574 if ( !ValidateTextIntRange( gtk_entry_get_text( (GtkEntry*)text2 ), 8, 256, "Border Width", &rs->nBorderWidth ) ) {
581 gtk_grab_remove( window );
582 gtk_widget_destroy( window );
588 // for stair builder stuck as close as i could to the MFC version
589 // obviously feel free to change it at will :)
590 EMessageBoxReturn DoBuildStairsBox( BuildStairsRS* rs ){
591 // i made widgets for just about everything ... i think that's what i need to do dunno tho
592 GtkWidget *window, *w, *vbox, *hbox;
593 GtkWidget *textStairHeight, *textRiserTex, *textMainTex;
594 GtkWidget *radioNorth, *radioSouth, *radioEast, *radioWest; // i'm guessing we can't just abuse 'w' for these if we're getting a value
595 GtkWidget *radioOldStyle, *radioBobStyle, *radioCornerStyle;
596 GtkWidget *checkUseDetail;
597 GSList *radioDirection, *radioStyle;
598 EMessageBoxReturn ret;
601 const gchar *text = "Please set a value in the boxes below and press 'OK' to build the stairs";
603 window = gtk_window_new( GTK_WINDOW_TOPLEVEL );
605 gtk_signal_connect( GTK_OBJECT( window ), "delete_event", GTK_SIGNAL_FUNC( dialog_delete_callback ), NULL );
606 gtk_signal_connect( GTK_OBJECT( window ), "destroy", GTK_SIGNAL_FUNC( gtk_widget_destroy ), NULL );
608 gtk_window_set_title( GTK_WINDOW( window ), "Stair Builder" );
610 gtk_container_border_width( GTK_CONTAINER( window ), 10 );
612 g_object_set_data( G_OBJECT( window ), "loop", &loop );
613 g_object_set_data( G_OBJECT( window ), "ret", &ret );
615 gtk_widget_realize( window );
618 vbox = gtk_vbox_new( FALSE, 10 );
619 gtk_container_add( GTK_CONTAINER( window ), vbox );
620 gtk_widget_show( vbox );
622 hbox = gtk_hbox_new( FALSE, 10 );
623 gtk_container_add( GTK_CONTAINER( vbox ), hbox );
624 gtk_widget_show( hbox );
626 // dunno if you want this text or not ...
627 w = ui::Label( text );
628 gtk_box_pack_start( GTK_BOX( hbox ), w, FALSE, FALSE, 0 ); // not entirely sure on all the parameters / what they do ...
629 gtk_widget_show( w );
631 w = gtk_hseparator_new();
632 gtk_box_pack_start( GTK_BOX( vbox ), w, FALSE, FALSE, 0 );
633 gtk_widget_show( w );
635 // ------------------------- // indenting == good way of keeping track of lines :)
638 hbox = gtk_hbox_new( FALSE, 10 );
639 gtk_box_pack_start( GTK_BOX( vbox ), hbox, FALSE, FALSE, 0 );
640 gtk_widget_show( hbox );
642 textStairHeight = gtk_entry_new_with_max_length( 256 );
643 gtk_box_pack_start( GTK_BOX( hbox ), textStairHeight, FALSE, FALSE, 1 );
644 gtk_widget_show( textStairHeight );
646 w = ui::Label( "Stair Height" );
647 gtk_box_pack_start( GTK_BOX( hbox ), w, FALSE, FALSE, 1 );
648 gtk_widget_show( w );
650 // ------------------------- //
652 hbox = gtk_hbox_new( FALSE, 10 );
653 gtk_box_pack_start( GTK_BOX( vbox ), hbox, FALSE, FALSE, 0 );
654 gtk_widget_show( hbox );
656 w = ui::Label( "Direction:" );
657 gtk_box_pack_start( GTK_BOX( hbox ), w, FALSE, FALSE, 5 );
658 gtk_widget_show( w );
660 // -------------------------- //
662 hbox = gtk_hbox_new( FALSE, 10 );
663 gtk_box_pack_start( GTK_BOX( vbox ), hbox, FALSE, FALSE, 0 );
664 gtk_widget_show( hbox );
666 // radio buttons confuse me ...
667 // but this _looks_ right
669 // djbob: actually it looks very nice :), slightly better than the way i did it
670 // edit: actually it doesn't work :P, you must pass the last radio item each time, ugh
672 radioNorth = gtk_radio_button_new_with_label( NULL, "North" );
673 gtk_box_pack_start( GTK_BOX( hbox ), radioNorth, FALSE, FALSE, 3 );
674 gtk_widget_show( radioNorth );
676 radioDirection = gtk_radio_button_group( GTK_RADIO_BUTTON( radioNorth ) );
678 radioSouth = gtk_radio_button_new_with_label( radioDirection, "South" );
679 gtk_box_pack_start( GTK_BOX( hbox ), radioSouth, FALSE, FALSE, 2 );
680 gtk_widget_show( radioSouth );
682 radioDirection = gtk_radio_button_group( GTK_RADIO_BUTTON( radioSouth ) );
684 radioEast = gtk_radio_button_new_with_label( radioDirection, "East" );
685 gtk_box_pack_start( GTK_BOX( hbox ), radioEast, FALSE, FALSE, 1 );
686 gtk_widget_show( radioEast );
688 radioDirection = gtk_radio_button_group( GTK_RADIO_BUTTON( radioEast ) );
690 radioWest = gtk_radio_button_new_with_label( radioDirection, "West" );
691 gtk_box_pack_start( GTK_BOX( hbox ), radioWest, FALSE, FALSE, 0 );
692 gtk_widget_show( radioWest );
694 // --------------------------- //
696 hbox = gtk_hbox_new( FALSE, 10 );
697 gtk_box_pack_start( GTK_BOX( vbox ), hbox, FALSE, FALSE, 0 );
698 gtk_widget_show( hbox );
700 w = ui::Label( "Style:" );
701 gtk_box_pack_start( GTK_BOX( hbox ), w, FALSE, FALSE, 5 );
702 gtk_widget_show( w );
704 // --------------------------- //
706 hbox = gtk_hbox_new( FALSE, 10 );
707 gtk_box_pack_start( GTK_BOX( vbox ), hbox, FALSE, FALSE, 0 );
708 gtk_widget_show( hbox );
710 radioOldStyle = gtk_radio_button_new_with_label( NULL, "Original" );
711 gtk_box_pack_start( GTK_BOX( hbox ), radioOldStyle, FALSE, FALSE, 0 );
712 gtk_widget_show( radioOldStyle );
714 radioStyle = gtk_radio_button_group( GTK_RADIO_BUTTON( radioOldStyle ) );
716 radioBobStyle = gtk_radio_button_new_with_label( radioStyle, "Bob's Style" );
717 gtk_box_pack_start( GTK_BOX( hbox ), radioBobStyle, FALSE, FALSE, 0 );
718 gtk_widget_show( radioBobStyle );
720 radioStyle = gtk_radio_button_group( GTK_RADIO_BUTTON( radioBobStyle ) );
722 radioCornerStyle = gtk_radio_button_new_with_label( radioStyle, "Corner Style" );
723 gtk_box_pack_start( GTK_BOX( hbox ), radioCornerStyle, FALSE, FALSE, 0 );
724 gtk_widget_show( radioCornerStyle );
726 // err, the q3r has an if or something so you need bob style checked before this
727 // is "ungreyed out" but you'll need to do that, as i suck :)
729 // djbob: er.... yeah um, im not at all sure how i'm gonna sort this
730 // djbob: think we need some button callback functions or smuffin
731 // FIXME: actually get around to doing what i suggested!!!!
733 checkUseDetail = gtk_check_button_new_with_label( "Use Detail Brushes" );
734 gtk_box_pack_start( GTK_BOX( hbox ), checkUseDetail, FALSE, FALSE, 0 );
735 gtk_widget_show( checkUseDetail );
737 // --------------------------- //
739 hbox = gtk_hbox_new( FALSE, 10 );
740 gtk_box_pack_start( GTK_BOX( vbox ), hbox, FALSE, FALSE, 0 );
741 gtk_widget_show( hbox );
743 textMainTex = gtk_entry_new_with_max_length( 512 );
744 gtk_entry_set_text( GTK_ENTRY( textMainTex ), rs->mainTexture );
745 gtk_box_pack_start( GTK_BOX( hbox ), textMainTex, FALSE, FALSE, 0 );
746 gtk_widget_show( textMainTex );
748 w = ui::Label( "Main Texture" );
749 gtk_box_pack_start( GTK_BOX( hbox ), w, FALSE, FALSE, 1 );
750 gtk_widget_show( w );
752 // -------------------------- //
754 hbox = gtk_hbox_new( FALSE, 10 );
755 gtk_box_pack_start( GTK_BOX( vbox ), hbox, FALSE, FALSE, 0 );
756 gtk_widget_show( hbox );
758 textRiserTex = gtk_entry_new_with_max_length( 512 );
759 gtk_box_pack_start( GTK_BOX( hbox ), textRiserTex, FALSE, FALSE, 0 );
760 gtk_widget_show( textRiserTex );
762 w = ui::Label( "Riser Texture" );
763 gtk_box_pack_start( GTK_BOX( hbox ), w, FALSE, FALSE, 1 );
764 gtk_widget_show( w );
766 // -------------------------- //
767 w = gtk_hseparator_new();
768 gtk_box_pack_start( GTK_BOX( vbox ), w, FALSE, FALSE, 0 );
769 gtk_widget_show( w );
771 hbox = gtk_hbox_new( FALSE, 10 );
772 gtk_box_pack_start( GTK_BOX( vbox ), hbox, FALSE, FALSE, 0 );
773 gtk_widget_show( hbox );
775 w = gtk_button_new_with_label( "OK" );
776 gtk_box_pack_start( GTK_BOX( hbox ), w, TRUE, TRUE, 0 );
777 gtk_signal_connect( GTK_OBJECT( w ), "clicked", GTK_SIGNAL_FUNC( dialog_button_callback ), GINT_TO_POINTER( eIDOK ) );
778 GTK_WIDGET_SET_FLAGS( w, GTK_CAN_DEFAULT );
779 gtk_widget_grab_default( w );
780 gtk_widget_show( w );
782 w = gtk_button_new_with_label( "Cancel" );
783 gtk_box_pack_start( GTK_BOX( hbox ), w, TRUE, TRUE, 0 );
784 gtk_signal_connect( GTK_OBJECT( w ), "clicked", GTK_SIGNAL_FUNC( dialog_button_callback ), GINT_TO_POINTER( eIDCANCEL ) );
785 gtk_widget_show( w );
789 // +djbob: need our "little" modal loop mars :P
790 gtk_window_set_position( GTK_WINDOW( window ),GTK_WIN_POS_CENTER );
791 gtk_widget_show( window );
792 gtk_grab_add( window );
794 bool dialogError = TRUE;
795 while ( dialogError )
799 gtk_main_iteration();
803 if ( ret == eIDOK ) {
804 rs->bUseDetail = gtk_toggle_button_get_active( (GtkToggleButton*)checkUseDetail ) ? true : false;
806 strcpy( rs->riserTexture, gtk_entry_get_text( (GtkEntry*)textRiserTex ) );
807 strcpy( rs->mainTexture, gtk_entry_get_text( (GtkEntry*)textMainTex ) );
809 if ( gtk_toggle_button_get_active( (GtkToggleButton*)radioNorth ) ) {
810 rs->direction = MOVE_NORTH;
812 else if ( gtk_toggle_button_get_active( (GtkToggleButton*)radioSouth ) ) {
813 rs->direction = MOVE_SOUTH;
815 else if ( gtk_toggle_button_get_active( (GtkToggleButton*)radioEast ) ) {
816 rs->direction = MOVE_EAST;
818 else if ( gtk_toggle_button_get_active( (GtkToggleButton*)radioWest ) ) {
819 rs->direction = MOVE_WEST;
822 if ( !ValidateTextInt( gtk_entry_get_text( (GtkEntry*)textStairHeight ), "Stair Height", &rs->stairHeight ) ) {
826 if ( gtk_toggle_button_get_active( (GtkToggleButton*)radioOldStyle ) ) {
827 rs->style = STYLE_ORIGINAL;
829 else if ( gtk_toggle_button_get_active( (GtkToggleButton*)radioBobStyle ) ) {
830 rs->style = STYLE_BOB;
832 else if ( gtk_toggle_button_get_active( (GtkToggleButton*)radioCornerStyle ) ) {
833 rs->style = STYLE_CORNER;
838 gtk_grab_remove( window );
839 gtk_widget_destroy( window );
844 // there we go, all done ... on my end at least, not bad for a night's work
847 EMessageBoxReturn DoDoorsBox( DoorRS* rs ){
848 GtkWidget *window, *hbox, *vbox, *w;
849 GtkWidget *textFrontBackTex, *textTrimTex;
850 GtkWidget *checkScaleMainH, *checkScaleMainV, *checkScaleTrimH, *checkScaleTrimV;
851 GtkWidget *comboMain, *comboTrim;
852 GtkWidget *buttonSetMain, *buttonSetTrim;
853 GtkWidget *radioNS, *radioEW;
854 GSList *radioOrientation;
856 EMessageBoxReturn ret;
859 window = gtk_window_new( GTK_WINDOW_TOPLEVEL );
861 gtk_signal_connect( GTK_OBJECT( window ), "delete_event", GTK_SIGNAL_FUNC( dialog_delete_callback ), NULL );
862 gtk_signal_connect( GTK_OBJECT( window ), "destroy", GTK_SIGNAL_FUNC( gtk_widget_destroy ), NULL );
864 gtk_window_set_title( GTK_WINDOW( window ), "Door Builder" );
866 gtk_container_border_width( GTK_CONTAINER( window ), 10 );
868 g_object_set_data( G_OBJECT( window ), "loop", &loop );
869 g_object_set_data( G_OBJECT( window ), "ret", &ret );
871 gtk_widget_realize( window );
874 GList *listMainTextures = NULL;
875 GList *listTrimTextures = NULL;
876 LoadGList( GetFilename( buffer, "plugins/bt/door-tex.txt" ), &listMainTextures );
877 LoadGList( GetFilename( buffer, "plugins/bt/door-tex-trim.txt" ), &listTrimTextures );
879 vbox = gtk_vbox_new( FALSE, 10 );
880 gtk_container_add( GTK_CONTAINER( window ), vbox );
881 gtk_widget_show( vbox );
883 // -------------------------- //
885 hbox = gtk_hbox_new( FALSE, 10 );
886 gtk_box_pack_start( GTK_BOX( vbox ), hbox, FALSE, FALSE, 0 );
887 gtk_widget_show( hbox );
889 textFrontBackTex = gtk_entry_new_with_max_length( 512 );
890 gtk_entry_set_text( GTK_ENTRY( textFrontBackTex ), rs->mainTexture );
891 gtk_box_pack_start( GTK_BOX( hbox ), textFrontBackTex, FALSE, FALSE, 0 );
892 gtk_widget_show( textFrontBackTex );
894 w = ui::Label( "Door Front/Back Texture" );
895 gtk_box_pack_start( GTK_BOX( hbox ), w, FALSE, FALSE, 0 );
896 gtk_widget_show( w );
898 // ------------------------ //
900 hbox = gtk_hbox_new( FALSE, 10 );
901 gtk_box_pack_start( GTK_BOX( vbox ), hbox, FALSE, FALSE, 0 );
902 gtk_widget_show( hbox );
904 textTrimTex = gtk_entry_new_with_max_length( 512 );
905 gtk_box_pack_start( GTK_BOX( hbox ), textTrimTex, FALSE, FALSE, 0 );
906 gtk_widget_show( textTrimTex );
908 w = ui::Label( "Door Trim Texture" );
909 gtk_box_pack_start( GTK_BOX( hbox ), w, FALSE, FALSE, 0 );
910 gtk_widget_show( w );
912 // ----------------------- //
914 hbox = gtk_hbox_new( FALSE, 10 );
915 gtk_box_pack_start( GTK_BOX( vbox ), hbox, FALSE, FALSE, 0 );
916 gtk_widget_show( hbox );
918 // sp: horizontally ????
919 // djbob: yes mars, u can spell :]
920 checkScaleMainH = gtk_check_button_new_with_label( "Scale Main Texture Horizontally" );
921 gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( checkScaleMainH ), TRUE );
922 gtk_box_pack_start( GTK_BOX( hbox ), checkScaleMainH, FALSE, FALSE, 0 );
923 gtk_widget_show( checkScaleMainH );
925 checkScaleTrimH = gtk_check_button_new_with_label( "Scale Trim Texture Horizontally" );
926 gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( checkScaleTrimH ), TRUE );
927 gtk_box_pack_start( GTK_BOX( hbox ), checkScaleTrimH, FALSE, FALSE, 0 );
928 gtk_widget_show( checkScaleTrimH );
930 // ---------------------- //
932 hbox = gtk_hbox_new( FALSE, 10 );
933 gtk_box_pack_start( GTK_BOX( vbox ), hbox, FALSE, FALSE, 0 );
934 gtk_widget_show( hbox );
936 checkScaleMainV = gtk_check_button_new_with_label( "Scale Main Texture Vertically" );
937 gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( checkScaleMainV ), TRUE );
938 gtk_box_pack_start( GTK_BOX( hbox ), checkScaleMainV, FALSE, FALSE, 0 );
939 gtk_widget_show( checkScaleMainV );
941 checkScaleTrimV = gtk_check_button_new_with_label( "Scale Trim Texture Vertically" );
942 gtk_box_pack_start( GTK_BOX( hbox ), checkScaleTrimV, FALSE, FALSE, 0 );
943 gtk_widget_show( checkScaleTrimV );
945 // --------------------- //
947 hbox = gtk_hbox_new( FALSE, 10 );
948 gtk_box_pack_start( GTK_BOX( vbox ), hbox, FALSE, FALSE, 0 );
949 gtk_widget_show( hbox );
951 // djbob: lists added
953 comboMain = gtk_combo_new();
954 gtk_box_pack_start( GTK_BOX( hbox ), comboMain, FALSE, FALSE, 0 );
955 gtk_combo_set_popdown_strings( GTK_COMBO( comboMain ), listMainTextures );
956 gtk_combo_set_use_arrows( GTK_COMBO( comboMain ), 1 );
957 gtk_widget_show( comboMain );
959 tw1.one = textFrontBackTex;
962 buttonSetMain = gtk_button_new_with_label( "Set As Main Texture" );
963 gtk_signal_connect( GTK_OBJECT( buttonSetMain ), "clicked", GTK_SIGNAL_FUNC( dialog_button_callback_settex ), &tw1 );
964 gtk_box_pack_start( GTK_BOX( hbox ), buttonSetMain, FALSE, FALSE, 0 );
965 gtk_widget_show( buttonSetMain );
967 // ------------------- //
969 hbox = gtk_hbox_new( FALSE, 10 );
970 gtk_box_pack_start( GTK_BOX( vbox ), hbox, FALSE, FALSE, 0 );
971 gtk_widget_show( hbox );
973 comboTrim = gtk_combo_new();
974 gtk_box_pack_start( GTK_BOX( hbox ), comboTrim, FALSE, FALSE, 0 );
975 gtk_combo_set_popdown_strings( GTK_COMBO( comboTrim ), listTrimTextures );
976 gtk_combo_set_use_arrows( GTK_COMBO( comboMain ), 1 );
977 gtk_widget_show( comboTrim );
979 tw2.one = textTrimTex;
982 buttonSetTrim = gtk_button_new_with_label( "Set As Trim Texture" );
983 gtk_signal_connect( GTK_OBJECT( buttonSetTrim ), "clicked", GTK_SIGNAL_FUNC( dialog_button_callback_settex ), &tw2 );
984 gtk_box_pack_start( GTK_BOX( hbox ), buttonSetTrim, FALSE, FALSE, 0 );
985 gtk_widget_show( buttonSetTrim );
987 // ------------------ //
989 hbox = gtk_hbox_new( FALSE, 10 );
990 gtk_box_pack_start( GTK_BOX( vbox ), hbox, FALSE, FALSE, 0 );
991 gtk_widget_show( hbox );
993 w = ui::Label( "Orientation" );
994 gtk_box_pack_start( GTK_BOX( hbox ), w, FALSE, FALSE, 0 );
995 gtk_widget_show( w );
997 // argh more radio buttons!
998 radioNS = gtk_radio_button_new_with_label( NULL, "North - South" );
999 gtk_box_pack_start( GTK_BOX( hbox ), radioNS, FALSE, FALSE, 0 );
1000 gtk_widget_show( radioNS );
1002 radioOrientation = gtk_radio_button_group( GTK_RADIO_BUTTON( radioNS ) );
1004 radioEW = gtk_radio_button_new_with_label( radioOrientation, "East - West" );
1005 gtk_box_pack_start( GTK_BOX( hbox ), radioEW, FALSE, FALSE, 0 );
1006 gtk_widget_show( radioEW );
1008 // ----------------- //
1010 w = gtk_hseparator_new();
1011 gtk_box_pack_start( GTK_BOX( vbox ), w, FALSE, FALSE, 0 );
1012 gtk_widget_show( w );
1014 // ----------------- //
1016 hbox = gtk_hbox_new( FALSE, 10 );
1017 gtk_box_pack_start( GTK_BOX( vbox ), hbox, FALSE, FALSE, 0 );
1018 gtk_widget_show( hbox );
1020 w = gtk_button_new_with_label( "OK" );
1021 gtk_box_pack_start( GTK_BOX( hbox ), w, TRUE, TRUE, 0 );
1022 gtk_signal_connect( GTK_OBJECT( w ), "clicked", GTK_SIGNAL_FUNC( dialog_button_callback ), GINT_TO_POINTER( eIDOK ) );
1023 GTK_WIDGET_SET_FLAGS( w, GTK_CAN_DEFAULT );
1024 gtk_widget_grab_default( w );
1025 gtk_widget_show( w );
1027 w = gtk_button_new_with_label( "Cancel" );
1028 gtk_box_pack_start( GTK_BOX( hbox ), w, TRUE, TRUE, 0 );
1029 gtk_signal_connect( GTK_OBJECT( w ), "clicked", GTK_SIGNAL_FUNC( dialog_button_callback ), GINT_TO_POINTER( eIDCANCEL ) );
1030 gtk_widget_show( w );
1033 // ----------------- //
1036 gtk_window_set_position( GTK_WINDOW( window ),GTK_WIN_POS_CENTER );
1037 gtk_widget_show( window );
1038 gtk_grab_add( window );
1041 gtk_main_iteration();
1043 strcpy( rs->mainTexture, gtk_entry_get_text( GTK_ENTRY( textFrontBackTex ) ) );
1044 strcpy( rs->trimTexture, gtk_entry_get_text( GTK_ENTRY( textTrimTex ) ) );
1046 rs->bScaleMainH = gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( checkScaleMainH ) ) ? true : false;
1047 rs->bScaleMainV = gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( checkScaleMainV ) ) ? true : false;
1048 rs->bScaleTrimH = gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( checkScaleTrimH ) ) ? true : false;
1049 rs->bScaleTrimV = gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( checkScaleTrimV ) ) ? true : false;
1051 if ( gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( radioNS ) ) ) {
1052 rs->nOrientation = DIRECTION_NS;
1054 else if ( gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( radioEW ) ) ) {
1055 rs->nOrientation = DIRECTION_EW;
1058 gtk_grab_remove( window );
1059 gtk_widget_destroy( window );
1065 EMessageBoxReturn DoPathPlotterBox( PathPlotterRS* rs ){
1066 GtkWidget *window, *w, *vbox, *hbox;
1068 GtkWidget *text1, *text2, *text3;
1069 GtkWidget *check1, *check2;
1071 EMessageBoxReturn ret;
1074 window = gtk_window_new( GTK_WINDOW_TOPLEVEL );
1076 gtk_signal_connect( GTK_OBJECT( window ), "delete_event", GTK_SIGNAL_FUNC( dialog_delete_callback ), NULL );
1077 gtk_signal_connect( GTK_OBJECT( window ), "destroy", GTK_SIGNAL_FUNC( gtk_widget_destroy ), NULL );
1079 gtk_window_set_title( GTK_WINDOW( window ), "Texture Reset" );
1080 gtk_container_border_width( GTK_CONTAINER( window ), 10 );
1082 g_object_set_data( G_OBJECT( window ), "loop", &loop );
1083 g_object_set_data( G_OBJECT( window ), "ret", &ret );
1085 gtk_widget_realize( window );
1089 vbox = gtk_vbox_new( FALSE, 10 );
1090 gtk_container_add( GTK_CONTAINER( window ), vbox );
1091 gtk_widget_show( vbox );
1095 hbox = gtk_hbox_new( FALSE, 10 );
1096 gtk_box_pack_start( GTK_BOX( vbox ), hbox, FALSE, FALSE, 2 );
1097 gtk_widget_show( hbox );
1101 text1 = gtk_entry_new_with_max_length( 256 );
1102 gtk_entry_set_text( (GtkEntry*)text1, "25" );
1103 gtk_box_pack_start( GTK_BOX( hbox ), text1, FALSE, FALSE, 2 );
1104 gtk_widget_show( text1 );
1106 w = ui::Label( "Number Of Points" );
1107 gtk_box_pack_start( GTK_BOX( hbox ), w, FALSE, FALSE, 2 );
1108 gtk_label_set_justify( GTK_LABEL( w ), GTK_JUSTIFY_LEFT );
1109 gtk_widget_show( w );
1113 hbox = gtk_hbox_new( FALSE, 10 );
1114 gtk_box_pack_start( GTK_BOX( vbox ), hbox, FALSE, FALSE, 2 );
1115 gtk_widget_show( hbox );
1119 text2 = gtk_entry_new_with_max_length( 256 );
1120 gtk_entry_set_text( (GtkEntry*)text2, "3" );
1121 gtk_box_pack_start( GTK_BOX( hbox ), text2, FALSE, FALSE, 2 );
1122 gtk_widget_show( text2 );
1124 w = ui::Label( "Multipler" );
1125 gtk_box_pack_start( GTK_BOX( hbox ), w, FALSE, FALSE, 2 );
1126 gtk_label_set_justify( GTK_LABEL( w ), GTK_JUSTIFY_LEFT );
1127 gtk_widget_show( w );
1131 w = ui::Label( "Path Distance = dist(start -> apex) * multiplier" );
1132 gtk_box_pack_start( GTK_BOX( vbox ), w, FALSE, FALSE, 0 );
1133 gtk_label_set_justify( GTK_LABEL( w ), GTK_JUSTIFY_LEFT );
1134 gtk_widget_show( w );
1136 hbox = gtk_hbox_new( FALSE, 10 );
1137 gtk_box_pack_start( GTK_BOX( vbox ), hbox, FALSE, FALSE, 2 );
1138 gtk_widget_show( hbox );
1142 text3 = gtk_entry_new_with_max_length( 256 );
1143 gtk_entry_set_text( (GtkEntry*)text3, "-800" );
1144 gtk_box_pack_start( GTK_BOX( hbox ), text3, FALSE, FALSE, 2 );
1145 gtk_widget_show( text3 );
1147 w = ui::Label( "Gravity" );
1148 gtk_box_pack_start( GTK_BOX( hbox ), w, FALSE, FALSE, 2 );
1149 gtk_label_set_justify( GTK_LABEL( w ), GTK_JUSTIFY_LEFT );
1150 gtk_widget_show( w );
1154 w = gtk_hseparator_new();
1155 gtk_box_pack_start( GTK_BOX( vbox ), w, FALSE, FALSE, 0 );
1156 gtk_widget_show( w );
1158 check1 = gtk_check_button_new_with_label( "No Dynamic Update" );
1159 gtk_box_pack_start( GTK_BOX( vbox ), check1, FALSE, FALSE, 0 );
1160 gtk_widget_show( check1 );
1162 check2 = gtk_check_button_new_with_label( "Show Bounding Lines" );
1163 gtk_box_pack_start( GTK_BOX( vbox ), check2, FALSE, FALSE, 0 );
1164 gtk_widget_show( check2 );
1169 // ----------------- //
1171 w = gtk_hseparator_new();
1172 gtk_box_pack_start( GTK_BOX( vbox ), w, FALSE, FALSE, 0 );
1173 gtk_widget_show( w );
1175 // ----------------- //
1177 hbox = gtk_hbox_new( FALSE, 10 );
1178 gtk_box_pack_start( GTK_BOX( vbox ), hbox, FALSE, FALSE, 0 );
1179 gtk_widget_show( hbox );
1181 w = gtk_button_new_with_label( "Enable" );
1182 gtk_box_pack_start( GTK_BOX( hbox ), w, TRUE, TRUE, 0 );
1183 gtk_signal_connect( GTK_OBJECT( w ), "clicked", GTK_SIGNAL_FUNC( dialog_button_callback ), GINT_TO_POINTER( eIDYES ) );
1184 gtk_widget_show( w );
1186 GTK_WIDGET_SET_FLAGS( w, GTK_CAN_DEFAULT );
1187 gtk_widget_grab_default( w );
1189 w = gtk_button_new_with_label( "Disable" );
1190 gtk_box_pack_start( GTK_BOX( hbox ), w, TRUE, TRUE, 0 );
1191 gtk_signal_connect( GTK_OBJECT( w ), "clicked", GTK_SIGNAL_FUNC( dialog_button_callback ), GINT_TO_POINTER( eIDNO ) );
1192 gtk_widget_show( w );
1194 w = gtk_button_new_with_label( "Cancel" );
1195 gtk_box_pack_start( GTK_BOX( hbox ), w, TRUE, TRUE, 0 );
1196 gtk_signal_connect( GTK_OBJECT( w ), "clicked", GTK_SIGNAL_FUNC( dialog_button_callback ), GINT_TO_POINTER( eIDCANCEL ) );
1197 gtk_widget_show( w );
1201 // ----------------- //
1203 gtk_window_set_position( GTK_WINDOW( window ),GTK_WIN_POS_CENTER );
1204 gtk_widget_show( window );
1205 gtk_grab_add( window );
1207 bool dialogError = TRUE;
1208 while ( dialogError )
1212 gtk_main_iteration();
1214 dialogError = FALSE;
1216 if ( ret == eIDYES ) {
1217 if ( !ValidateTextIntRange( gtk_entry_get_text( GTK_ENTRY( text1 ) ), 1, 200, "Number Of Points", &rs->nPoints ) ) {
1221 if ( !ValidateTextFloatRange( gtk_entry_get_text( GTK_ENTRY( text2 ) ), 1.0f, 10.0f, "Multiplier", &rs->fMultiplier ) ) {
1225 if ( !ValidateTextFloatRange( gtk_entry_get_text( GTK_ENTRY( text3 ) ), -10000.0f, -1.0f, "Gravity", &rs->fGravity ) ) {
1229 rs->bNoUpdate = gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( check1 ) ) ? true : false;
1230 rs->bShowExtra = gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( check2 ) ) ? true : false;
1234 gtk_grab_remove( window );
1235 gtk_widget_destroy( window );
1240 EMessageBoxReturn DoCTFColourChangeBox(){
1241 GtkWidget *window, *w, *vbox, *hbox;
1242 EMessageBoxReturn ret;
1245 window = gtk_window_new( GTK_WINDOW_TOPLEVEL );
1247 gtk_signal_connect( GTK_OBJECT( window ), "delete_event", GTK_SIGNAL_FUNC( dialog_delete_callback ), NULL );
1248 gtk_signal_connect( GTK_OBJECT( window ), "destroy", GTK_SIGNAL_FUNC( gtk_widget_destroy ), NULL );
1250 gtk_window_set_title( GTK_WINDOW( window ), "CTF Colour Changer" );
1251 gtk_container_border_width( GTK_CONTAINER( window ), 10 );
1253 g_object_set_data( G_OBJECT( window ), "loop", &loop );
1254 g_object_set_data( G_OBJECT( window ), "ret", &ret );
1256 gtk_widget_realize( window );
1260 vbox = gtk_vbox_new( FALSE, 10 );
1261 gtk_container_add( GTK_CONTAINER( window ), vbox );
1262 gtk_widget_show( vbox );
1266 hbox = gtk_hbox_new( FALSE, 10 );
1267 gtk_box_pack_start( GTK_BOX( vbox ), hbox, TRUE, TRUE, 0 );
1268 gtk_widget_show( hbox );
1270 // ---- hbox ---- ok/cancel buttons
1272 w = gtk_button_new_with_label( "Red->Blue" );
1273 gtk_box_pack_start( GTK_BOX( hbox ), w, TRUE, TRUE, 0 );
1274 gtk_signal_connect( GTK_OBJECT( w ), "clicked", GTK_SIGNAL_FUNC( dialog_button_callback ), GINT_TO_POINTER( eIDOK ) );
1276 GTK_WIDGET_SET_FLAGS( w, GTK_CAN_DEFAULT );
1277 gtk_widget_grab_default( w );
1278 gtk_widget_show( w );
1280 w = gtk_button_new_with_label( "Blue->Red" );
1281 gtk_box_pack_start( GTK_BOX( hbox ), w, TRUE, TRUE, 0 );
1282 gtk_signal_connect( GTK_OBJECT( w ), "clicked", GTK_SIGNAL_FUNC( dialog_button_callback ), GINT_TO_POINTER( eIDYES ) );
1283 gtk_widget_show( w );
1285 w = gtk_button_new_with_label( "Cancel" );
1286 gtk_box_pack_start( GTK_BOX( hbox ), w, TRUE, TRUE, 0 );
1287 gtk_signal_connect( GTK_OBJECT( w ), "clicked", GTK_SIGNAL_FUNC( dialog_button_callback ), GINT_TO_POINTER( eIDCANCEL ) );
1288 gtk_widget_show( w );
1295 gtk_window_set_position( GTK_WINDOW( window ),GTK_WIN_POS_CENTER );
1296 gtk_widget_show( window );
1297 gtk_grab_add( window );
1300 gtk_main_iteration();
1302 gtk_grab_remove( window );
1303 gtk_widget_destroy( window );
1308 EMessageBoxReturn DoResetTextureBox( ResetTextureRS* rs ){
1311 GtkWidget *window, *w, *vbox, *hbox, *frame, *table;
1313 EMessageBoxReturn ret;
1316 window = gtk_window_new( GTK_WINDOW_TOPLEVEL );
1318 gtk_signal_connect( GTK_OBJECT( window ), "delete_event", GTK_SIGNAL_FUNC( dialog_delete_callback ), NULL );
1319 gtk_signal_connect( GTK_OBJECT( window ), "destroy", GTK_SIGNAL_FUNC( gtk_widget_destroy ), NULL );
1321 gtk_window_set_title( GTK_WINDOW( window ), "Texture Reset" );
1322 gtk_container_border_width( GTK_CONTAINER( window ), 10 );
1324 g_object_set_data( G_OBJECT( window ), "loop", &loop );
1325 g_object_set_data( G_OBJECT( window ), "ret", &ret );
1327 gtk_widget_realize( window );
1329 vbox = gtk_vbox_new( FALSE, 10 );
1330 gtk_container_add( GTK_CONTAINER( window ), vbox );
1331 gtk_widget_show( vbox );
1335 hbox = gtk_hbox_new( FALSE, 10 );
1336 gtk_box_pack_start( GTK_BOX( vbox ), hbox, FALSE, FALSE, 2 );
1337 gtk_widget_show( hbox );
1341 texSelected = "Currently Selected Texture: ";
1342 texSelected += GetCurrentTexture();
1344 w = ui::Label( texSelected );
1345 gtk_box_pack_start( GTK_BOX( hbox ), w, FALSE, FALSE, 2 );
1346 gtk_label_set_justify( GTK_LABEL( w ), GTK_JUSTIFY_LEFT );
1347 gtk_widget_show( w );
1351 frame = gtk_frame_new( "Reset Texture Names" );
1352 gtk_widget_show( frame );
1353 gtk_box_pack_start( GTK_BOX( vbox ), frame, FALSE, TRUE, 0 );
1355 table = gtk_table_new( 2, 3, TRUE );
1356 gtk_widget_show( table );
1357 gtk_container_add( GTK_CONTAINER( frame ), table );
1358 gtk_table_set_row_spacings( GTK_TABLE( table ), 5 );
1359 gtk_table_set_col_spacings( GTK_TABLE( table ), 5 );
1360 gtk_container_set_border_width( GTK_CONTAINER( table ), 5 );
1364 dlgTexReset.cbTexChange = gtk_check_button_new_with_label( "Enabled" );
1365 gtk_signal_connect( GTK_OBJECT( dlgTexReset.cbTexChange ), "toggled", GTK_SIGNAL_FUNC( dialog_button_callback_texreset_update ), NULL );
1366 gtk_widget_show( dlgTexReset.cbTexChange );
1367 gtk_table_attach( GTK_TABLE( table ), dlgTexReset.cbTexChange, 0, 1, 0, 1,
1368 (GtkAttachOptions) ( GTK_FILL ),
1369 (GtkAttachOptions) ( 0 ), 0, 0 );
1371 w = ui::Label( "Old Name: " );
1372 gtk_table_attach( GTK_TABLE( table ), w, 1, 2, 0, 1,
1373 (GtkAttachOptions) ( GTK_FILL ),
1374 (GtkAttachOptions) ( 0 ), 0, 0 );
1375 gtk_widget_show( w );
1377 dlgTexReset.editTexOld = gtk_entry_new_with_max_length( 256 );
1378 gtk_entry_set_text( GTK_ENTRY( dlgTexReset.editTexOld ), rs->textureName );
1379 gtk_table_attach( GTK_TABLE( table ), dlgTexReset.editTexOld, 2, 3, 0, 1,
1380 (GtkAttachOptions) ( GTK_FILL ),
1381 (GtkAttachOptions) ( 0 ), 0, 0 );
1382 gtk_widget_show( dlgTexReset.editTexOld );
1384 w = ui::Label( "New Name: " );
1385 gtk_table_attach( GTK_TABLE( table ), w, 1, 2, 1, 2,
1386 (GtkAttachOptions) ( GTK_FILL ),
1387 (GtkAttachOptions) ( 0 ), 0, 0 );
1388 gtk_widget_show( w );
1390 dlgTexReset.editTexNew = gtk_entry_new_with_max_length( 256 );
1391 gtk_entry_set_text( GTK_ENTRY( dlgTexReset.editTexNew ), rs->textureName );
1392 gtk_table_attach( GTK_TABLE( table ), dlgTexReset.editTexNew, 2, 3, 1, 2,
1393 (GtkAttachOptions) ( GTK_FILL ),
1394 (GtkAttachOptions) ( 0 ), 0, 0 );
1395 gtk_widget_show( dlgTexReset.editTexNew );
1399 frame = gtk_frame_new( "Reset Scales" );
1400 gtk_widget_show( frame );
1401 gtk_box_pack_start( GTK_BOX( vbox ), frame, FALSE, TRUE, 0 );
1403 table = gtk_table_new( 2, 3, TRUE );
1404 gtk_widget_show( table );
1405 gtk_container_add( GTK_CONTAINER( frame ), table );
1406 gtk_table_set_row_spacings( GTK_TABLE( table ), 5 );
1407 gtk_table_set_col_spacings( GTK_TABLE( table ), 5 );
1408 gtk_container_set_border_width( GTK_CONTAINER( table ), 5 );
1412 dlgTexReset.cbScaleHor = gtk_check_button_new_with_label( "Enabled" );
1413 gtk_signal_connect( GTK_OBJECT( dlgTexReset.cbScaleHor ), "toggled", GTK_SIGNAL_FUNC( dialog_button_callback_texreset_update ), NULL );
1414 gtk_widget_show( dlgTexReset.cbScaleHor );
1415 gtk_table_attach( GTK_TABLE( table ), dlgTexReset.cbScaleHor, 0, 1, 0, 1,
1416 (GtkAttachOptions) ( GTK_FILL ),
1417 (GtkAttachOptions) ( 0 ), 0, 0 );
1419 w = ui::Label( "New Horizontal Scale: " );
1420 gtk_table_attach( GTK_TABLE( table ), w, 1, 2, 0, 1,
1421 (GtkAttachOptions) ( GTK_FILL ),
1422 (GtkAttachOptions) ( 0 ), 0, 0 );
1423 gtk_widget_show( w );
1425 dlgTexReset.editScaleHor = gtk_entry_new_with_max_length( 256 );
1426 gtk_entry_set_text( GTK_ENTRY( dlgTexReset.editScaleHor ), "0.5" );
1427 gtk_table_attach( GTK_TABLE( table ), dlgTexReset.editScaleHor, 2, 3, 0, 1,
1428 (GtkAttachOptions) ( GTK_FILL ),
1429 (GtkAttachOptions) ( 0 ), 0, 0 );
1430 gtk_widget_show( dlgTexReset.editScaleHor );
1433 dlgTexReset.cbScaleVert = gtk_check_button_new_with_label( "Enabled" );
1434 gtk_signal_connect( GTK_OBJECT( dlgTexReset.cbScaleVert ), "toggled", GTK_SIGNAL_FUNC( dialog_button_callback_texreset_update ), NULL );
1435 gtk_widget_show( dlgTexReset.cbScaleVert );
1436 gtk_table_attach( GTK_TABLE( table ), dlgTexReset.cbScaleVert, 0, 1, 1, 2,
1437 (GtkAttachOptions) ( GTK_FILL ),
1438 (GtkAttachOptions) ( 0 ), 0, 0 );
1440 w = ui::Label( "New Vertical Scale: " );
1441 gtk_table_attach( GTK_TABLE( table ), w, 1, 2, 1, 2,
1442 (GtkAttachOptions) ( GTK_FILL ),
1443 (GtkAttachOptions) ( 0 ), 0, 0 );
1444 gtk_widget_show( w );
1446 dlgTexReset.editScaleVert = gtk_entry_new_with_max_length( 256 );
1447 gtk_entry_set_text( GTK_ENTRY( dlgTexReset.editScaleVert ), "0.5" );
1448 gtk_table_attach( GTK_TABLE( table ), dlgTexReset.editScaleVert, 2, 3, 1, 2,
1449 (GtkAttachOptions) ( GTK_FILL ),
1450 (GtkAttachOptions) ( 0 ), 0, 0 );
1451 gtk_widget_show( dlgTexReset.editScaleVert );
1455 frame = gtk_frame_new( "Reset Shift" );
1456 gtk_widget_show( frame );
1457 gtk_box_pack_start( GTK_BOX( vbox ), frame, FALSE, TRUE, 0 );
1459 table = gtk_table_new( 2, 3, TRUE );
1460 gtk_widget_show( table );
1461 gtk_container_add( GTK_CONTAINER( frame ), table );
1462 gtk_table_set_row_spacings( GTK_TABLE( table ), 5 );
1463 gtk_table_set_col_spacings( GTK_TABLE( table ), 5 );
1464 gtk_container_set_border_width( GTK_CONTAINER( table ), 5 );
1468 dlgTexReset.cbShiftHor = gtk_check_button_new_with_label( "Enabled" );
1469 gtk_signal_connect( GTK_OBJECT( dlgTexReset.cbShiftHor ), "toggled", GTK_SIGNAL_FUNC( dialog_button_callback_texreset_update ), NULL );
1470 gtk_widget_show( dlgTexReset.cbShiftHor );
1471 gtk_table_attach( GTK_TABLE( table ), dlgTexReset.cbShiftHor, 0, 1, 0, 1,
1472 (GtkAttachOptions) ( GTK_FILL ),
1473 (GtkAttachOptions) ( 0 ), 0, 0 );
1475 w = ui::Label( "New Horizontal Shift: " );
1476 gtk_table_attach( GTK_TABLE( table ), w, 1, 2, 0, 1,
1477 (GtkAttachOptions) ( GTK_FILL ),
1478 (GtkAttachOptions) ( 0 ), 0, 0 );
1479 gtk_widget_show( w );
1481 dlgTexReset.editShiftHor = gtk_entry_new_with_max_length( 256 );
1482 gtk_entry_set_text( GTK_ENTRY( dlgTexReset.editShiftHor ), "0" );
1483 gtk_table_attach( GTK_TABLE( table ), dlgTexReset.editShiftHor, 2, 3, 0, 1,
1484 (GtkAttachOptions) ( GTK_FILL ),
1485 (GtkAttachOptions) ( 0 ), 0, 0 );
1486 gtk_widget_show( dlgTexReset.editShiftHor );
1489 dlgTexReset.cbShiftVert = gtk_check_button_new_with_label( "Enabled" );
1490 gtk_signal_connect( GTK_OBJECT( dlgTexReset.cbShiftVert ), "toggled", GTK_SIGNAL_FUNC( dialog_button_callback_texreset_update ), NULL );
1491 gtk_widget_show( dlgTexReset.cbShiftVert );
1492 gtk_table_attach( GTK_TABLE( table ), dlgTexReset.cbShiftVert, 0, 1, 1, 2,
1493 (GtkAttachOptions) ( GTK_FILL ),
1494 (GtkAttachOptions) ( 0 ), 0, 0 );
1496 w = ui::Label( "New Vertical Shift: " );
1497 gtk_table_attach( GTK_TABLE( table ), w, 1, 2, 1, 2,
1498 (GtkAttachOptions) ( GTK_FILL ),
1499 (GtkAttachOptions) ( 0 ), 0, 0 );
1500 gtk_widget_show( w );
1502 dlgTexReset.editShiftVert = gtk_entry_new_with_max_length( 256 );
1503 gtk_entry_set_text( GTK_ENTRY( dlgTexReset.editShiftVert ), "0" );
1504 gtk_table_attach( GTK_TABLE( table ), dlgTexReset.editShiftVert, 2, 3, 1, 2,
1505 (GtkAttachOptions) ( GTK_FILL ),
1506 (GtkAttachOptions) ( 0 ), 0, 0 );
1507 gtk_widget_show( dlgTexReset.editShiftVert );
1511 frame = gtk_frame_new( "Reset Rotation" );
1512 gtk_widget_show( frame );
1513 gtk_box_pack_start( GTK_BOX( vbox ), frame, FALSE, TRUE, 0 );
1515 table = gtk_table_new( 1, 3, TRUE );
1516 gtk_widget_show( table );
1517 gtk_container_add( GTK_CONTAINER( frame ), table );
1518 gtk_table_set_row_spacings( GTK_TABLE( table ), 5 );
1519 gtk_table_set_col_spacings( GTK_TABLE( table ), 5 );
1520 gtk_container_set_border_width( GTK_CONTAINER( table ), 5 );
1524 dlgTexReset.cbRotation = gtk_check_button_new_with_label( "Enabled" );
1525 gtk_widget_show( dlgTexReset.cbRotation );
1526 gtk_table_attach( GTK_TABLE( table ), dlgTexReset.cbRotation, 0, 1, 0, 1,
1527 (GtkAttachOptions) ( GTK_FILL ),
1528 (GtkAttachOptions) ( 0 ), 0, 0 );
1530 w = ui::Label( "New Rotation Value: " );
1531 gtk_table_attach( GTK_TABLE( table ), w, 1, 2, 0, 1,
1532 (GtkAttachOptions) ( GTK_FILL ),
1533 (GtkAttachOptions) ( 0 ), 0, 0 );
1534 gtk_widget_show( w );
1536 dlgTexReset.editRotation = gtk_entry_new_with_max_length( 256 );
1537 gtk_entry_set_text( GTK_ENTRY( dlgTexReset.editRotation ), "0" );
1538 gtk_table_attach( GTK_TABLE( table ), dlgTexReset.editRotation, 2, 3, 0, 1,
1539 (GtkAttachOptions) ( GTK_FILL ),
1540 (GtkAttachOptions) ( 0 ), 0, 0 );
1541 gtk_widget_show( dlgTexReset.editRotation );
1545 hbox = gtk_hbox_new( FALSE, 10 );
1546 gtk_box_pack_start( GTK_BOX( vbox ), hbox, FALSE, FALSE, 2 );
1547 gtk_widget_show( hbox );
1551 w = gtk_button_new_with_label( "Use Selected Brushes" );
1552 gtk_box_pack_start( GTK_BOX( hbox ), w, TRUE, TRUE, 0 );
1553 gtk_signal_connect( GTK_OBJECT( w ), "clicked", GTK_SIGNAL_FUNC( dialog_button_callback ), GINT_TO_POINTER( eIDOK ) );
1555 GTK_WIDGET_SET_FLAGS( w, GTK_CAN_DEFAULT );
1556 gtk_widget_grab_default( w );
1557 gtk_widget_show( w );
1559 w = gtk_button_new_with_label( "Use All Brushes" );
1560 gtk_box_pack_start( GTK_BOX( hbox ), w, TRUE, TRUE, 0 );
1561 gtk_signal_connect( GTK_OBJECT( w ), "clicked", GTK_SIGNAL_FUNC( dialog_button_callback ), GINT_TO_POINTER( eIDYES ) );
1562 gtk_widget_show( w );
1564 w = gtk_button_new_with_label( "Cancel" );
1565 gtk_box_pack_start( GTK_BOX( hbox ), w, TRUE, TRUE, 0 );
1566 gtk_signal_connect( GTK_OBJECT( w ), "clicked", GTK_SIGNAL_FUNC( dialog_button_callback ), GINT_TO_POINTER( eIDCANCEL ) );
1567 gtk_widget_show( w );
1574 gtk_window_set_position( GTK_WINDOW( window ),GTK_WIN_POS_CENTER );
1575 gtk_widget_show( window );
1576 gtk_grab_add( window );
1578 Update_TextureReseter();
1580 bool dialogError = TRUE;
1581 while ( dialogError )
1585 gtk_main_iteration();
1587 dialogError = FALSE;
1589 if ( ret != eIDCANCEL ) {
1590 rs->bResetRotation = gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( dlgTexReset.cbRotation ) );
1591 if ( rs->bResetRotation ) {
1592 if ( !ValidateTextInt( gtk_entry_get_text( GTK_ENTRY( dlgTexReset.editRotation ) ), "Rotation", &rs->rotation ) ) {
1597 rs->bResetScale[0] = gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( dlgTexReset.cbScaleHor ) );
1598 if ( rs->bResetScale[0] ) {
1599 if ( !ValidateTextFloat( gtk_entry_get_text( GTK_ENTRY( dlgTexReset.editScaleHor ) ), "Horizontal Scale", &rs->fScale[0] ) ) {
1604 rs->bResetScale[1] = gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( dlgTexReset.cbScaleVert ) );
1605 if ( rs->bResetScale[1] ) {
1606 if ( !ValidateTextFloat( gtk_entry_get_text( GTK_ENTRY( dlgTexReset.editScaleVert ) ), "Vertical Scale", &rs->fScale[1] ) ) {
1611 rs->bResetShift[0] = gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( dlgTexReset.cbShiftHor ) );
1612 if ( rs->bResetShift[0] ) {
1613 if ( !ValidateTextFloat( gtk_entry_get_text( GTK_ENTRY( dlgTexReset.editShiftHor ) ), "Horizontal Shift", &rs->fShift[0] ) ) {
1618 rs->bResetShift[1] = gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( dlgTexReset.cbShiftVert ) );
1619 if ( rs->bResetShift[1] ) {
1620 if ( !ValidateTextFloat( gtk_entry_get_text( GTK_ENTRY( dlgTexReset.editShiftVert ) ), "Vertical Shift", &rs->fShift[1] ) ) {
1625 rs->bResetTextureName = gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( dlgTexReset.cbTexChange ) );
1626 if ( rs->bResetTextureName ) {
1627 strcpy( rs->textureName, gtk_entry_get_text( GTK_ENTRY( dlgTexReset.editTexOld ) ) );
1628 strcpy( rs->newTextureName, gtk_entry_get_text( GTK_ENTRY( dlgTexReset.editTexNew ) ) );
1633 gtk_grab_remove( window );
1634 gtk_widget_destroy( window );
1639 EMessageBoxReturn DoTrainThingBox( TrainThingRS* rs ){
1642 GtkWidget *window, *w, *vbox, *hbox, *frame, *table;
1644 GtkWidget *radiusX, *radiusY;
1645 GtkWidget *angleStart, *angleEnd;
1646 GtkWidget *heightStart, *heightEnd;
1647 GtkWidget *numPoints;
1649 EMessageBoxReturn ret;
1652 window = gtk_window_new( GTK_WINDOW_TOPLEVEL );
1654 gtk_signal_connect( GTK_OBJECT( window ), "delete_event", GTK_SIGNAL_FUNC( dialog_delete_callback ), NULL );
1655 gtk_signal_connect( GTK_OBJECT( window ), "destroy", GTK_SIGNAL_FUNC( gtk_widget_destroy ), NULL );
1657 gtk_window_set_title( GTK_WINDOW( window ), "Train Thing" );
1658 gtk_container_border_width( GTK_CONTAINER( window ), 10 );
1660 gtk_object_set_data( GTK_OBJECT( window ), "loop", &loop );
1661 gtk_object_set_data( GTK_OBJECT( window ), "ret", &ret );
1663 gtk_widget_realize( window );
1665 vbox = gtk_vbox_new( FALSE, 10 );
1666 gtk_container_add( GTK_CONTAINER( window ), vbox );
1667 gtk_widget_show( vbox );
1671 hbox = gtk_hbox_new( FALSE, 10 );
1672 gtk_box_pack_start( GTK_BOX( vbox ), hbox, FALSE, FALSE, 2 );
1673 gtk_widget_show( hbox );
1677 frame = gtk_frame_new( "Radii" );
1678 gtk_widget_show( frame );
1679 gtk_box_pack_start( GTK_BOX( vbox ), frame, FALSE, TRUE, 0 );
1681 table = gtk_table_new( 2, 3, TRUE );
1682 gtk_widget_show( table );
1683 gtk_container_add( GTK_CONTAINER( frame ), table );
1684 gtk_table_set_row_spacings( GTK_TABLE( table ), 5 );
1685 gtk_table_set_col_spacings( GTK_TABLE( table ), 5 );
1686 gtk_container_set_border_width( GTK_CONTAINER( table ), 5 );
1690 w = ui::Label( "X: " );
1691 gtk_table_attach( GTK_TABLE( table ), w, 0, 1, 0, 1,
1692 (GtkAttachOptions) ( GTK_FILL ),
1693 (GtkAttachOptions) ( 0 ), 0, 0 );
1694 gtk_widget_show( w );
1696 radiusX = gtk_entry_new_with_max_length( 256 );
1697 gtk_entry_set_text( GTK_ENTRY( radiusX ), "100" );
1698 gtk_table_attach( GTK_TABLE( table ), radiusX, 1, 2, 0, 1,
1699 (GtkAttachOptions) ( GTK_FILL ),
1700 (GtkAttachOptions) ( 0 ), 0, 0 );
1701 gtk_widget_show( radiusX );
1705 w = ui::Label( "Y: " );
1706 gtk_table_attach( GTK_TABLE( table ), w, 0, 1, 1, 2,
1707 (GtkAttachOptions) ( GTK_FILL ),
1708 (GtkAttachOptions) ( 0 ), 0, 0 );
1709 gtk_widget_show( w );
1711 radiusY = gtk_entry_new_with_max_length( 256 );
1712 gtk_entry_set_text( GTK_ENTRY( radiusY ), "100" );
1713 gtk_table_attach( GTK_TABLE( table ), radiusY, 1, 2, 1, 2,
1714 (GtkAttachOptions) ( GTK_FILL ),
1715 (GtkAttachOptions) ( 0 ), 0, 0 );
1716 gtk_widget_show( radiusY );
1720 frame = gtk_frame_new( "Angles" );
1721 gtk_widget_show( frame );
1722 gtk_box_pack_start( GTK_BOX( vbox ), frame, FALSE, TRUE, 0 );
1724 table = gtk_table_new( 2, 3, TRUE );
1725 gtk_widget_show( table );
1726 gtk_container_add( GTK_CONTAINER( frame ), table );
1727 gtk_table_set_row_spacings( GTK_TABLE( table ), 5 );
1728 gtk_table_set_col_spacings( GTK_TABLE( table ), 5 );
1729 gtk_container_set_border_width( GTK_CONTAINER( table ), 5 );
1733 w = ui::Label( "Start: " );
1734 gtk_table_attach( GTK_TABLE( table ), w, 0, 1, 0, 1,
1735 (GtkAttachOptions) ( GTK_FILL ),
1736 (GtkAttachOptions) ( 0 ), 0, 0 );
1737 gtk_widget_show( w );
1739 angleStart = gtk_entry_new_with_max_length( 256 );
1740 gtk_entry_set_text( GTK_ENTRY( angleStart ), "0" );
1741 gtk_table_attach( GTK_TABLE( table ), angleStart, 1, 2, 0, 1,
1742 (GtkAttachOptions) ( GTK_FILL ),
1743 (GtkAttachOptions) ( 0 ), 0, 0 );
1744 gtk_widget_show( angleStart );
1748 w = ui::Label( "End: " );
1749 gtk_table_attach( GTK_TABLE( table ), w, 0, 1, 1, 2,
1750 (GtkAttachOptions) ( GTK_FILL ),
1751 (GtkAttachOptions) ( 0 ), 0, 0 );
1752 gtk_widget_show( w );
1754 angleEnd = gtk_entry_new_with_max_length( 256 );
1755 gtk_entry_set_text( GTK_ENTRY( angleEnd ), "90" );
1756 gtk_table_attach( GTK_TABLE( table ), angleEnd, 1, 2, 1, 2,
1757 (GtkAttachOptions) ( GTK_FILL ),
1758 (GtkAttachOptions) ( 0 ), 0, 0 );
1759 gtk_widget_show( angleEnd );
1762 frame = gtk_frame_new( "Height" );
1763 gtk_widget_show( frame );
1764 gtk_box_pack_start( GTK_BOX( vbox ), frame, FALSE, TRUE, 0 );
1766 table = gtk_table_new( 2, 3, TRUE );
1767 gtk_widget_show( table );
1768 gtk_container_add( GTK_CONTAINER( frame ), table );
1769 gtk_table_set_row_spacings( GTK_TABLE( table ), 5 );
1770 gtk_table_set_col_spacings( GTK_TABLE( table ), 5 );
1771 gtk_container_set_border_width( GTK_CONTAINER( table ), 5 );
1775 w = ui::Label( "Start: " );
1776 gtk_table_attach( GTK_TABLE( table ), w, 0, 1, 0, 1,
1777 (GtkAttachOptions) ( GTK_FILL ),
1778 (GtkAttachOptions) ( 0 ), 0, 0 );
1779 gtk_widget_show( w );
1781 heightStart = gtk_entry_new_with_max_length( 256 );
1782 gtk_entry_set_text( GTK_ENTRY( heightStart ), "0" );
1783 gtk_table_attach( GTK_TABLE( table ), heightStart, 1, 2, 0, 1,
1784 (GtkAttachOptions) ( GTK_FILL ),
1785 (GtkAttachOptions) ( 0 ), 0, 0 );
1786 gtk_widget_show( heightStart );
1790 w = ui::Label( "End: " );
1791 gtk_table_attach( GTK_TABLE( table ), w, 0, 1, 1, 2,
1792 (GtkAttachOptions) ( GTK_FILL ),
1793 (GtkAttachOptions) ( 0 ), 0, 0 );
1794 gtk_widget_show( w );
1796 heightEnd = gtk_entry_new_with_max_length( 256 );
1797 gtk_entry_set_text( GTK_ENTRY( heightEnd ), "0" );
1798 gtk_table_attach( GTK_TABLE( table ), heightEnd, 1, 2, 1, 2,
1799 (GtkAttachOptions) ( GTK_FILL ),
1800 (GtkAttachOptions) ( 0 ), 0, 0 );
1801 gtk_widget_show( heightEnd );
1805 frame = gtk_frame_new( "Points" );
1806 gtk_widget_show( frame );
1807 gtk_box_pack_start( GTK_BOX( vbox ), frame, FALSE, TRUE, 0 );
1809 table = gtk_table_new( 2, 3, TRUE );
1810 gtk_widget_show( table );
1811 gtk_container_add( GTK_CONTAINER( frame ), table );
1812 gtk_table_set_row_spacings( GTK_TABLE( table ), 5 );
1813 gtk_table_set_col_spacings( GTK_TABLE( table ), 5 );
1814 gtk_container_set_border_width( GTK_CONTAINER( table ), 5 );
1818 w = ui::Label( "Number: " );
1819 gtk_table_attach( GTK_TABLE( table ), w, 0, 1, 0, 1,
1820 (GtkAttachOptions) ( GTK_FILL ),
1821 (GtkAttachOptions) ( 0 ), 0, 0 );
1822 gtk_widget_show( w );
1824 numPoints = gtk_entry_new_with_max_length( 256 );
1825 gtk_entry_set_text( GTK_ENTRY( numPoints ), "0" );
1826 gtk_table_attach( GTK_TABLE( table ), numPoints, 1, 2, 0, 1,
1827 (GtkAttachOptions) ( GTK_FILL ),
1828 (GtkAttachOptions) ( 0 ), 0, 0 );
1829 gtk_widget_show( numPoints );
1832 hbox = gtk_hbox_new( FALSE, 10 );
1833 gtk_box_pack_start( GTK_BOX( vbox ), hbox, FALSE, FALSE, 2 );
1834 gtk_widget_show( hbox );
1838 w = gtk_button_new_with_label( "Ok" );
1839 gtk_box_pack_start( GTK_BOX( hbox ), w, TRUE, TRUE, 0 );
1840 gtk_signal_connect( GTK_OBJECT( w ), "clicked", GTK_SIGNAL_FUNC( dialog_button_callback ), GINT_TO_POINTER( eIDOK ) );
1842 GTK_WIDGET_SET_FLAGS( w, GTK_CAN_DEFAULT );
1843 gtk_widget_grab_default( w );
1844 gtk_widget_show( w );
1846 w = gtk_button_new_with_label( "Cancel" );
1847 gtk_box_pack_start( GTK_BOX( hbox ), w, TRUE, TRUE, 0 );
1848 gtk_signal_connect( GTK_OBJECT( w ), "clicked", GTK_SIGNAL_FUNC( dialog_button_callback ), GINT_TO_POINTER( eIDCANCEL ) );
1849 gtk_widget_show( w );
1856 gtk_window_set_position( GTK_WINDOW( window ),GTK_WIN_POS_CENTER );
1857 gtk_widget_show( window );
1858 gtk_grab_add( window );
1860 bool dialogError = TRUE;
1861 while ( dialogError )
1865 gtk_main_iteration();
1867 dialogError = FALSE;
1869 if ( ret != eIDCANCEL ) {
1870 if ( !ValidateTextFloat( gtk_entry_get_text( GTK_ENTRY( radiusX ) ), "Radius (X)", &rs->fRadiusX ) ) {
1874 if ( !ValidateTextFloat( gtk_entry_get_text( GTK_ENTRY( radiusY ) ), "Radius (Y)", &rs->fRadiusY ) ) {
1878 if ( !ValidateTextFloat( gtk_entry_get_text( GTK_ENTRY( angleStart ) ), "Angle (Start)", &rs->fStartAngle ) ) {
1882 if ( !ValidateTextFloat( gtk_entry_get_text( GTK_ENTRY( angleEnd ) ), "Angle (End)", &rs->fEndAngle ) ) {
1886 if ( !ValidateTextFloat( gtk_entry_get_text( GTK_ENTRY( heightStart ) ), "Height (Start)", &rs->fStartHeight ) ) {
1890 if ( !ValidateTextFloat( gtk_entry_get_text( GTK_ENTRY( heightEnd ) ), "Height (End)", &rs->fEndHeight ) ) {
1894 if ( !ValidateTextInt( gtk_entry_get_text( GTK_ENTRY( numPoints ) ), "Num Points", &rs->iNumPoints ) ) {
1900 gtk_grab_remove( window );
1901 gtk_widget_destroy( window );
1906 // add a simple input for the MakeChain thing..
1907 EMessageBoxReturn DoMakeChainBox( MakeChainRS* rs ){
1908 GtkWidget *window, *w, *vbox, *hbox;
1909 GtkWidget *textlinkNum, *textlinkName;
1910 EMessageBoxReturn ret;
1913 const gchar *text = "Please set a value in the boxes below and press 'OK' to make a chain";
1915 window = gtk_window_new( GTK_WINDOW_TOPLEVEL );
1917 gtk_signal_connect( GTK_OBJECT( window ), "delete_event", GTK_SIGNAL_FUNC( dialog_delete_callback ), NULL );
1918 gtk_signal_connect( GTK_OBJECT( window ), "destroy", GTK_SIGNAL_FUNC( gtk_widget_destroy ), NULL );
1920 gtk_window_set_title( GTK_WINDOW( window ), "Make Chain" );
1922 gtk_container_border_width( GTK_CONTAINER( window ), 10 );
1924 g_object_set_data( G_OBJECT( window ), "loop", &loop );
1925 g_object_set_data( G_OBJECT( window ), "ret", &ret );
1927 gtk_widget_realize( window );
1930 vbox = gtk_vbox_new( FALSE, 10 );
1931 gtk_container_add( GTK_CONTAINER( window ), vbox );
1932 gtk_widget_show( vbox );
1934 hbox = gtk_hbox_new( FALSE, 10 );
1935 gtk_container_add( GTK_CONTAINER( vbox ), hbox );
1936 gtk_widget_show( hbox );
1938 // dunno if you want this text or not ...
1939 w = ui::Label( text );
1940 gtk_box_pack_start( GTK_BOX( hbox ), w, FALSE, FALSE, 0 );
1941 gtk_widget_show( w );
1943 w = gtk_hseparator_new();
1944 gtk_box_pack_start( GTK_BOX( vbox ), w, FALSE, FALSE, 0 );
1945 gtk_widget_show( w );
1947 // ------------------------- //
1950 hbox = gtk_hbox_new( FALSE, 10 );
1951 gtk_box_pack_start( GTK_BOX( vbox ), hbox, FALSE, FALSE, 0 );
1952 gtk_widget_show( hbox );
1954 textlinkNum = gtk_entry_new_with_max_length( 256 );
1955 gtk_box_pack_start( GTK_BOX( hbox ), textlinkNum, FALSE, FALSE, 1 );
1956 gtk_widget_show( textlinkNum );
1958 w = ui::Label( "Number of elements in chain" );
1959 gtk_box_pack_start( GTK_BOX( hbox ), w, FALSE, FALSE, 1 );
1960 gtk_widget_show( w );
1962 // -------------------------- //
1964 hbox = gtk_hbox_new( FALSE, 10 );
1965 gtk_box_pack_start( GTK_BOX( vbox ), hbox, FALSE, FALSE, 0 );
1966 gtk_widget_show( hbox );
1968 textlinkName = gtk_entry_new_with_max_length( 256 );
1969 gtk_box_pack_start( GTK_BOX( hbox ), textlinkName, FALSE, FALSE, 0 );
1970 gtk_widget_show( textlinkName );
1972 w = ui::Label( "Basename for chain's targetnames." );
1973 gtk_box_pack_start( GTK_BOX( hbox ), w, FALSE, FALSE, 1 );
1974 gtk_widget_show( w );
1977 w = gtk_button_new_with_label( "OK" );
1978 gtk_box_pack_start( GTK_BOX( hbox ), w, TRUE, TRUE, 0 );
1979 gtk_signal_connect( GTK_OBJECT( w ), "clicked", GTK_SIGNAL_FUNC( dialog_button_callback ), GINT_TO_POINTER( eIDOK ) );
1980 GTK_WIDGET_SET_FLAGS( w, GTK_CAN_DEFAULT );
1981 gtk_widget_grab_default( w );
1982 gtk_widget_show( w );
1984 w = gtk_button_new_with_label( "Cancel" );
1985 gtk_box_pack_start( GTK_BOX( hbox ), w, TRUE, TRUE, 0 );
1986 gtk_signal_connect( GTK_OBJECT( w ), "clicked", GTK_SIGNAL_FUNC( dialog_button_callback ), GINT_TO_POINTER( eIDCANCEL ) );
1987 gtk_widget_show( w );
1991 gtk_window_set_position( GTK_WINDOW( window ),GTK_WIN_POS_CENTER );
1992 gtk_widget_show( window );
1993 gtk_grab_add( window );
1995 bool dialogError = TRUE;
1996 while ( dialogError )
2000 gtk_main_iteration();
2002 dialogError = FALSE;
2004 if ( ret == eIDOK ) {
2005 strcpy( rs->linkName, gtk_entry_get_text( (GtkEntry*)textlinkName ) );
2006 if ( !ValidateTextInt( gtk_entry_get_text( (GtkEntry*)textlinkNum ), "Elements", &rs->linkNum ) ) {
2012 gtk_grab_remove( window );
2013 gtk_widget_destroy( window );