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"
26 #include "gtkutil/pointer.h"
32 /*--------------------------------
34 ---------------------------------*/
37 ui::Widget cbTexChange;
38 ui::Widget editTexOld, editTexNew;
40 ui::Widget cbScaleHor, cbScaleVert;
41 ui::Widget editScaleHor, editScaleVert;
43 ui::Widget cbShiftHor, cbShiftVert;
44 ui::Widget editShiftHor, editShiftVert;
46 ui::Widget cbRotation;
47 ui::Widget editRotation;
50 dlg_texReset_t dlgTexReset;
52 void Update_TextureReseter();
54 static void dialog_button_callback_texreset_update( GtkWidget *widget, gpointer data ){
55 Update_TextureReseter();
58 void Update_TextureReseter(){
61 check = gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( dlgTexReset.cbTexChange ) );
62 gtk_editable_set_editable( GTK_EDITABLE( dlgTexReset.editTexNew ), check );
63 gtk_editable_set_editable( GTK_EDITABLE( dlgTexReset.editTexOld ), check );
65 check = gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( dlgTexReset.cbScaleHor ) );
66 gtk_editable_set_editable( GTK_EDITABLE( dlgTexReset.editScaleHor ), check );
68 check = gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( dlgTexReset.cbScaleVert ) );
69 gtk_editable_set_editable( GTK_EDITABLE( dlgTexReset.editScaleVert ), check );
71 check = gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( dlgTexReset.cbShiftHor ) );
72 gtk_editable_set_editable( GTK_EDITABLE( dlgTexReset.editShiftHor ), check );
74 check = gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( dlgTexReset.cbShiftVert ) );
75 gtk_editable_set_editable( GTK_EDITABLE( dlgTexReset.editShiftVert ), check );
77 check = gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( dlgTexReset.cbRotation ) );
78 gtk_editable_set_editable( GTK_EDITABLE( dlgTexReset.editRotation ), check );
81 static void dialog_button_callback( GtkWidget *widget, gpointer data ){
84 EMessageBoxReturn *ret;
86 parent = gtk_widget_get_toplevel( widget );
87 loop = (int*)g_object_get_data( G_OBJECT( parent ), "loop" );
88 ret = (EMessageBoxReturn*)g_object_get_data( G_OBJECT( parent ), "ret" );
91 *ret = (EMessageBoxReturn)gpointer_to_int( data );
94 static gint dialog_delete_callback( GtkWidget *widget, GdkEvent* event, gpointer data ){
97 gtk_widget_hide( widget );
98 loop = (int*)g_object_get_data( G_OBJECT( widget ), "loop" );
104 static void dialog_button_callback_settex( GtkWidget *widget, gpointer data ){
105 TwinWidget* tw = (TwinWidget*)data;
107 GtkEntry* entry = GTK_ENTRY( tw->one );
108 auto* combo = GTK_BIN(tw->two);
110 const gchar *tex = gtk_entry_get_text(GTK_ENTRY (gtk_bin_get_child(combo)));
111 gtk_entry_set_text( entry, tex );
114 /*--------------------------------
115 Data validation Routines
116 ---------------------------------*/
118 bool ValidateTextFloat( const char* pData, char* error_title, float* value ){
120 float testNum = (float)atof( pData );
122 if ( ( testNum == 0.0f ) && strcmp( pData, "0" ) ) {
123 DoMessageBox( "Please Enter A Floating Point Number", error_title, eMB_OK );
133 DoMessageBox( "Please Enter A Floating Point Number", error_title, eMB_OK );
137 bool ValidateTextFloatRange( const char* pData, float min, float max, char* error_title, float* value ){
138 char error_buffer[256];
139 sprintf( error_buffer, "Please Enter A Floating Point Number Between %.3f and %.3f", min, max );
142 float testNum = (float)atof( pData );
144 if ( ( testNum < min ) || ( testNum > max ) ) {
145 DoMessageBox( error_buffer, error_title, eMB_OK );
155 DoMessageBox( error_buffer, error_title, eMB_OK );
159 bool ValidateTextIntRange( const char* pData, int min, int max, char* error_title, int* value ){
160 char error_buffer[256];
161 sprintf( error_buffer, "Please Enter An Integer Between %i and %i", min, max );
164 int testNum = atoi( pData );
166 if ( ( testNum < min ) || ( testNum > max ) ) {
167 DoMessageBox( error_buffer, error_title, eMB_OK );
177 DoMessageBox( error_buffer, error_title, eMB_OK );
181 bool ValidateTextInt( const char* pData, char* error_title, int* value ){
183 int testNum = atoi( pData );
185 if ( ( testNum == 0 ) && strcmp( pData, "0" ) ) {
186 DoMessageBox( "Please Enter An Integer", error_title, eMB_OK );
196 DoMessageBox( "Please Enter An Integer", error_title, eMB_OK );
200 /*--------------------------------
202 ---------------------------------*/
206 Major clean up of variable names etc required, excluding Mars's ones,
207 which are nicely done :)
211 EMessageBoxReturn DoMessageBox( const char* lpText, const char* lpCaption, EMessageBoxType type ){
212 ui::Widget w, vbox, hbox;
213 EMessageBoxReturn ret;
216 auto window = ui::Window( ui::window_type::TOP );
217 window.connect( "delete_event", G_CALLBACK( dialog_delete_callback ), NULL );
218 window.connect( "destroy", G_CALLBACK( gtk_widget_destroy ), NULL );
219 gtk_window_set_title( GTK_WINDOW( window ), lpCaption );
220 gtk_container_set_border_width( GTK_CONTAINER( window ), 10 );
221 g_object_set_data( G_OBJECT( window ), "loop", &loop );
222 g_object_set_data( G_OBJECT( window ), "ret", &ret );
223 gtk_widget_realize( window );
225 vbox = ui::VBox( FALSE, 10 );
227 gtk_widget_show( vbox );
229 w = ui::Label( lpText );
230 gtk_box_pack_start( GTK_BOX( vbox ), w, FALSE, FALSE, 2 );
231 gtk_label_set_justify( GTK_LABEL( w ), GTK_JUSTIFY_LEFT );
232 gtk_widget_show( w );
234 w = ui::Widget(gtk_hseparator_new());
235 gtk_box_pack_start( GTK_BOX( vbox ), w, FALSE, FALSE, 2 );
236 gtk_widget_show( w );
238 hbox = ui::HBox( FALSE, 10 );
239 gtk_box_pack_start( GTK_BOX( vbox ), hbox, FALSE, FALSE, 2 );
240 gtk_widget_show( hbox );
242 if ( type == eMB_OK ) {
243 w = ui::Button( "Ok" );
244 gtk_box_pack_start( GTK_BOX( hbox ), w, TRUE, TRUE, 0 );
245 w.connect( "clicked", G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( eIDOK ) );
246 gtk_widget_set_can_default(w, true);
247 gtk_widget_grab_default( w );
248 gtk_widget_show( w );
251 else if ( type == eMB_OKCANCEL ) {
252 w = ui::Button( "Ok" );
253 gtk_box_pack_start( GTK_BOX( hbox ), w, TRUE, TRUE, 0 );
254 w.connect( "clicked", G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( eIDOK ) );
255 gtk_widget_set_can_default( w, true );
256 gtk_widget_grab_default( w );
257 gtk_widget_show( w );
259 w = ui::Button( "Cancel" );
260 gtk_box_pack_start( GTK_BOX( hbox ), w, TRUE, TRUE, 0 );
261 w.connect( "clicked", G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( eIDCANCEL ) );
262 gtk_widget_show( w );
265 else if ( type == eMB_YESNOCANCEL ) {
266 w = ui::Button( "Yes" );
267 gtk_box_pack_start( GTK_BOX( hbox ), w, TRUE, TRUE, 0 );
268 w.connect( "clicked", G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( eIDYES ) );
269 gtk_widget_set_can_default( w, true );
270 gtk_widget_grab_default( w );
271 gtk_widget_show( w );
273 w = ui::Button( "No" );
274 gtk_box_pack_start( GTK_BOX( hbox ), w, TRUE, TRUE, 0 );
275 w.connect( "clicked", G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( eIDNO ) );
276 gtk_widget_show( w );
278 w = ui::Button( "Cancel" );
279 gtk_box_pack_start( GTK_BOX( hbox ), w, TRUE, TRUE, 0 );
280 w.connect( "clicked", G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( eIDCANCEL ) );
281 gtk_widget_show( w );
284 else /* if (mode == MB_YESNO) */
286 w = ui::Button( "Yes" );
287 gtk_box_pack_start( GTK_BOX( hbox ), w, TRUE, TRUE, 0 );
288 w.connect( "clicked", G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( eIDYES ) );
289 gtk_widget_set_can_default( w, true );
290 gtk_widget_grab_default( w );
291 gtk_widget_show( w );
293 w = ui::Button( "No" );
294 gtk_box_pack_start( GTK_BOX( hbox ), w, TRUE, TRUE, 0 );
295 w.connect( "clicked", G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( eIDNO ) );
296 gtk_widget_show( w );
300 gtk_window_set_position( GTK_WINDOW( window ),GTK_WIN_POS_CENTER );
301 gtk_widget_show( window );
302 gtk_grab_add( window );
305 gtk_main_iteration();
307 gtk_grab_remove( window );
308 gtk_widget_destroy( window );
313 EMessageBoxReturn DoIntersectBox( IntersectRS* rs ){
315 GtkWidget *check1, *check2;
316 EMessageBoxReturn ret;
319 auto window = ui::Window( ui::window_type::TOP );
321 window.connect( "delete_event", G_CALLBACK( dialog_delete_callback ), NULL );
322 window.connect( "destroy", G_CALLBACK( gtk_widget_destroy ), NULL );
324 gtk_window_set_title( GTK_WINDOW( window ), "Intersect" );
325 gtk_container_set_border_width( GTK_CONTAINER( window ), 10 );
327 g_object_set_data( G_OBJECT( window ), "loop", &loop );
328 g_object_set_data( G_OBJECT( window ), "ret", &ret );
330 gtk_widget_realize( window );
334 auto vbox = ui::VBox( FALSE, 10 );
336 gtk_widget_show( vbox );
341 auto radio1 = gtk_radio_button_new_with_label( NULL, "Use Whole Map" );
342 gtk_box_pack_start( GTK_BOX( vbox ), radio1, FALSE, FALSE, 2 );
343 gtk_widget_show( radio1 );
345 auto radio2 = gtk_radio_button_new_with_label( gtk_radio_button_get_group(GTK_RADIO_BUTTON(radio1)), "Use Selected Brushes" );
346 gtk_box_pack_start( GTK_BOX( vbox ), radio2, FALSE, FALSE, 2 );
347 gtk_widget_show( radio2 );
349 auto hsep = ui::Widget(gtk_hseparator_new());
350 gtk_box_pack_start( GTK_BOX( vbox ), hsep, FALSE, FALSE, 2 );
353 check1 = ui::CheckButton( "Include Detail Brushes" );
354 gtk_box_pack_start( GTK_BOX( vbox ), check1, FALSE, FALSE, 0 );
355 gtk_widget_show( check1 );
357 check2 = ui::CheckButton( "Select Duplicate Brushes Only" );
358 gtk_box_pack_start( GTK_BOX( vbox ), check2, FALSE, FALSE, 0 );
359 gtk_widget_show( check2 );
361 hbox = ui::HBox( FALSE, 10 );
362 gtk_box_pack_start( GTK_BOX( vbox ), hbox, FALSE, FALSE, 2 );
363 gtk_widget_show( hbox );
365 // ---- hbox ---- ok/cancel buttons
367 auto w = ui::Button( "Ok" );
368 gtk_box_pack_start( GTK_BOX( hbox ), w, TRUE, TRUE, 0 );
369 w.connect( "clicked", G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( eIDOK ) );
371 gtk_widget_set_can_default( w, true );
372 gtk_widget_grab_default( w );
373 gtk_widget_show( w );
375 w = ui::Button( "Cancel" );
376 gtk_box_pack_start( GTK_BOX( hbox ), w, TRUE, TRUE, 0 );
377 w.connect( "clicked", G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( eIDCANCEL ) );
378 gtk_widget_show( w );
385 gtk_window_set_position( GTK_WINDOW( window ),GTK_WIN_POS_CENTER );
386 gtk_widget_show( window );
387 gtk_grab_add( window );
390 gtk_main_iteration();
392 if ( gtk_toggle_button_get_active( (GtkToggleButton*)radio1 ) ) {
393 rs->nBrushOptions = BRUSH_OPT_WHOLE_MAP;
395 else if ( gtk_toggle_button_get_active( (GtkToggleButton*)radio2 ) ) {
396 rs->nBrushOptions = BRUSH_OPT_SELECTED;
399 rs->bUseDetail = gtk_toggle_button_get_active( (GtkToggleButton*)check1 ) ? true : false;
400 rs->bDuplicateOnly = gtk_toggle_button_get_active( (GtkToggleButton*)check2 ) ? true : false;
402 gtk_grab_remove( window );
403 gtk_widget_destroy( window );
408 EMessageBoxReturn DoPolygonBox( PolygonRS* rs ){
409 GtkWidget *hbox, *vbox2, *hbox2;
411 GtkWidget *check1, *check2, *check3;
412 GtkWidget *text1, *text2;
414 EMessageBoxReturn ret;
417 auto window = ui::Window( ui::window_type::TOP );
419 window.connect( "delete_event", G_CALLBACK( dialog_delete_callback ), NULL );
420 window.connect( "destroy", G_CALLBACK( gtk_widget_destroy ), NULL );
422 gtk_window_set_title( GTK_WINDOW( window ), "Polygon Builder" );
423 gtk_container_set_border_width( GTK_CONTAINER( window ), 10 );
425 g_object_set_data( G_OBJECT( window ), "loop", &loop );
426 g_object_set_data( G_OBJECT( window ), "ret", &ret );
428 gtk_widget_realize( window );
432 auto vbox = ui::VBox( FALSE, 10 );
438 hbox = ui::HBox( FALSE, 10 );
439 gtk_box_pack_start( GTK_BOX( vbox ), hbox, FALSE, FALSE, 2 );
440 gtk_widget_show( hbox );
445 vbox2 = ui::VBox( FALSE, 10 );
446 gtk_box_pack_start( GTK_BOX( hbox ), vbox2, FALSE, FALSE, 2 );
447 gtk_widget_show( vbox2 );
451 hbox2 = ui::HBox( FALSE, 10 );
452 gtk_box_pack_start( GTK_BOX( vbox2 ), hbox2, FALSE, FALSE, 2 );
453 gtk_widget_show( hbox2 );
457 text1 = ui::Entry( 256 );
458 gtk_entry_set_text( (GtkEntry*)text1, "3" );
459 gtk_box_pack_start( GTK_BOX( hbox2 ), text1, FALSE, FALSE, 2 );
460 gtk_widget_show( text1 );
462 auto l = ui::Label( "Number Of Sides" );
463 gtk_box_pack_start( GTK_BOX( hbox2 ), l, FALSE, FALSE, 2 );
464 gtk_label_set_justify( GTK_LABEL( l ), GTK_JUSTIFY_LEFT );
465 gtk_widget_show( l );
469 hbox2 = ui::HBox( FALSE, 10 );
470 gtk_box_pack_start( GTK_BOX( vbox2 ), hbox2, FALSE, FALSE, 2 );
471 gtk_widget_show( hbox2 );
475 text2 = ui::Entry( 256 );
476 gtk_entry_set_text( (GtkEntry*)text2, "8" );
477 gtk_box_pack_start( GTK_BOX( hbox2 ), text2, FALSE, FALSE, 2 );
478 gtk_widget_show( text2 );
480 l = ui::Label( "Border Width" );
481 gtk_box_pack_start( GTK_BOX( hbox2 ), l, FALSE, FALSE, 2 );
482 gtk_label_set_justify( GTK_LABEL( l ), GTK_JUSTIFY_LEFT );
483 gtk_widget_show( l );
491 vbox2 = ui::VBox( FALSE, 10 );
492 gtk_box_pack_start( GTK_BOX( hbox ), vbox2, FALSE, FALSE, 2 );
493 gtk_widget_show( vbox2 );
497 check1 = ui::CheckButton( "Use Border" );
498 gtk_box_pack_start( GTK_BOX( vbox2 ), check1, FALSE, FALSE, 0 );
499 gtk_widget_show( check1 );
502 check2 = ui::CheckButton( "Inverse Polygon" );
503 gtk_box_pack_start( GTK_BOX( vbox2 ), check2, FALSE, FALSE, 0 );
504 gtk_widget_show( check2 );
507 check3 = ui::CheckButton( "Align Top Edge" );
508 gtk_box_pack_start( GTK_BOX( vbox2 ), check3, FALSE, FALSE, 0 );
509 gtk_widget_show( check3 );
515 hbox = ui::HBox( FALSE, 10 );
516 gtk_box_pack_start( GTK_BOX( vbox ), hbox, FALSE, FALSE, 2 );
517 gtk_widget_show( hbox );
521 auto w = ui::Button( "Ok" );
522 gtk_box_pack_start( GTK_BOX( hbox ), w, TRUE, TRUE, 0 );
523 w.connect( "clicked", G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( eIDOK ) );
525 gtk_widget_set_can_default( w, true );
526 gtk_widget_grab_default( w );
527 gtk_widget_show( w );
529 w = ui::Button( "Cancel" );
530 gtk_box_pack_start( GTK_BOX( hbox ), w, TRUE, TRUE, 0 );
531 w.connect( "clicked", G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( eIDCANCEL ) );
532 gtk_widget_show( w );
539 gtk_window_set_position( GTK_WINDOW( window ),GTK_WIN_POS_CENTER );
540 gtk_widget_show( window );
541 gtk_grab_add( window );
543 bool dialogError = TRUE;
544 while ( dialogError )
548 gtk_main_iteration();
552 if ( ret == eIDOK ) {
553 rs->bUseBorder = gtk_toggle_button_get_active( (GtkToggleButton*)check1 ) ? true : false;
554 rs->bInverse = gtk_toggle_button_get_active( (GtkToggleButton*)check2 ) ? true : false;
555 rs->bAlignTop = gtk_toggle_button_get_active( (GtkToggleButton*)check3 ) ? true : false;
557 if ( !ValidateTextIntRange( gtk_entry_get_text( (GtkEntry*)text1 ), 3, 32, "Number Of Sides", &rs->nSides ) ) {
561 if ( rs->bUseBorder ) {
562 if ( !ValidateTextIntRange( gtk_entry_get_text( (GtkEntry*)text2 ), 8, 256, "Border Width", &rs->nBorderWidth ) ) {
569 gtk_grab_remove( window );
570 gtk_widget_destroy( window );
576 // for stair builder stuck as close as i could to the MFC version
577 // obviously feel free to change it at will :)
578 EMessageBoxReturn DoBuildStairsBox( BuildStairsRS* rs ){
579 GtkWidget *textStairHeight, *textRiserTex, *textMainTex;
580 GtkWidget *radioNorth, *radioSouth, *radioEast, *radioWest; // i'm guessing we can't just abuse 'w' for these if we're getting a value
581 GtkWidget *radioOldStyle, *radioBobStyle, *radioCornerStyle;
582 GtkWidget *checkUseDetail;
583 GSList *radioDirection, *radioStyle;
584 EMessageBoxReturn ret;
587 char *text = "Please set a value in the boxes below and press 'OK' to build the stairs";
589 auto window = ui::Window( ui::window_type::TOP );
591 window.connect( "delete_event", G_CALLBACK( dialog_delete_callback ), NULL );
592 window.connect( "destroy", G_CALLBACK( gtk_widget_destroy ), NULL );
594 gtk_window_set_title( GTK_WINDOW( window ), "Stair Builder" );
596 gtk_container_set_border_width( GTK_CONTAINER( window ), 10 );
598 g_object_set_data( G_OBJECT( window ), "loop", &loop );
599 g_object_set_data( G_OBJECT( window ), "ret", &ret );
601 gtk_widget_realize( window );
604 auto vbox = ui::VBox( FALSE, 10 );
606 gtk_widget_show( vbox );
608 auto hbox = ui::HBox( FALSE, 10 );
610 gtk_widget_show( hbox );
612 // dunno if you want this text or not ...
613 ui::Widget w = ui::Label( text );
614 gtk_box_pack_start( GTK_BOX( hbox ), w, FALSE, FALSE, 0 ); // not entirely sure on all the parameters / what they do ...
615 gtk_widget_show( w );
617 w = ui::Widget(gtk_hseparator_new());
618 gtk_box_pack_start( GTK_BOX( vbox ), w, FALSE, FALSE, 0 );
619 gtk_widget_show( w );
621 // ------------------------- // indenting == good way of keeping track of lines :)
624 hbox = ui::HBox( FALSE, 10 );
625 gtk_box_pack_start( GTK_BOX( vbox ), hbox, FALSE, FALSE, 0 );
626 gtk_widget_show( hbox );
628 textStairHeight = ui::Entry( 256 );
629 gtk_box_pack_start( GTK_BOX( hbox ), textStairHeight, FALSE, FALSE, 1 );
630 gtk_widget_show( textStairHeight );
632 w = ui::Label( "Stair Height" );
633 gtk_box_pack_start( GTK_BOX( hbox ), w, FALSE, FALSE, 1 );
634 gtk_widget_show( w );
636 // ------------------------- //
638 hbox = ui::HBox( FALSE, 10 );
639 gtk_box_pack_start( GTK_BOX( vbox ), hbox, FALSE, FALSE, 0 );
640 gtk_widget_show( hbox );
642 w = ui::Label( "Direction:" );
643 gtk_box_pack_start( GTK_BOX( hbox ), w, FALSE, FALSE, 5 );
644 gtk_widget_show( w );
646 // -------------------------- //
648 hbox = ui::HBox( FALSE, 10 );
649 gtk_box_pack_start( GTK_BOX( vbox ), hbox, FALSE, FALSE, 0 );
650 gtk_widget_show( hbox );
652 // radio buttons confuse me ...
653 // but this _looks_ right
655 // djbob: actually it looks very nice :), slightly better than the way i did it
656 // edit: actually it doesn't work :P, you must pass the last radio item each time, ugh
658 radioNorth = gtk_radio_button_new_with_label( NULL, "North" );
659 gtk_box_pack_start( GTK_BOX( hbox ), radioNorth, FALSE, FALSE, 3 );
660 gtk_widget_show( radioNorth );
662 radioDirection = gtk_radio_button_get_group( GTK_RADIO_BUTTON( radioNorth ) );
664 radioSouth = gtk_radio_button_new_with_label( radioDirection, "South" );
665 gtk_box_pack_start( GTK_BOX( hbox ), radioSouth, FALSE, FALSE, 2 );
666 gtk_widget_show( radioSouth );
668 radioDirection = gtk_radio_button_get_group( GTK_RADIO_BUTTON( radioSouth ) );
670 radioEast = gtk_radio_button_new_with_label( radioDirection, "East" );
671 gtk_box_pack_start( GTK_BOX( hbox ), radioEast, FALSE, FALSE, 1 );
672 gtk_widget_show( radioEast );
674 radioDirection = gtk_radio_button_get_group( GTK_RADIO_BUTTON( radioEast ) );
676 radioWest = gtk_radio_button_new_with_label( radioDirection, "West" );
677 gtk_box_pack_start( GTK_BOX( hbox ), radioWest, FALSE, FALSE, 0 );
678 gtk_widget_show( radioWest );
680 // --------------------------- //
682 hbox = ui::HBox( FALSE, 10 );
683 gtk_box_pack_start( GTK_BOX( vbox ), hbox, FALSE, FALSE, 0 );
684 gtk_widget_show( hbox );
686 w = ui::Label( "Style:" );
687 gtk_box_pack_start( GTK_BOX( hbox ), w, FALSE, FALSE, 5 );
688 gtk_widget_show( w );
690 // --------------------------- //
692 hbox = ui::HBox( FALSE, 10 );
693 gtk_box_pack_start( GTK_BOX( vbox ), hbox, FALSE, FALSE, 0 );
694 gtk_widget_show( hbox );
696 radioOldStyle = gtk_radio_button_new_with_label( NULL, "Original" );
697 gtk_box_pack_start( GTK_BOX( hbox ), radioOldStyle, FALSE, FALSE, 0 );
698 gtk_widget_show( radioOldStyle );
700 radioStyle = gtk_radio_button_get_group( GTK_RADIO_BUTTON( radioOldStyle ) );
702 radioBobStyle = gtk_radio_button_new_with_label( radioStyle, "Bob's Style" );
703 gtk_box_pack_start( GTK_BOX( hbox ), radioBobStyle, FALSE, FALSE, 0 );
704 gtk_widget_show( radioBobStyle );
706 radioStyle = gtk_radio_button_get_group( GTK_RADIO_BUTTON( radioBobStyle ) );
708 radioCornerStyle = gtk_radio_button_new_with_label( radioStyle, "Corner Style" );
709 gtk_box_pack_start( GTK_BOX( hbox ), radioCornerStyle, FALSE, FALSE, 0 );
710 gtk_widget_show( radioCornerStyle );
712 // err, the q3r has an if or something so you need bob style checked before this
713 // is "ungreyed out" but you'll need to do that, as i suck :)
715 // djbob: er.... yeah um, im not at all sure how i'm gonna sort this
716 // djbob: think we need some button callback functions or smuffin
717 // FIXME: actually get around to doing what i suggested!!!!
719 checkUseDetail = ui::CheckButton( "Use Detail Brushes" );
720 gtk_box_pack_start( GTK_BOX( hbox ), checkUseDetail, FALSE, FALSE, 0 );
721 gtk_widget_show( checkUseDetail );
723 // --------------------------- //
725 hbox = ui::HBox( FALSE, 10 );
726 gtk_box_pack_start( GTK_BOX( vbox ), hbox, FALSE, FALSE, 0 );
727 gtk_widget_show( hbox );
729 textMainTex = ui::Entry( 512 );
730 gtk_entry_set_text( GTK_ENTRY( textMainTex ), rs->mainTexture );
731 gtk_box_pack_start( GTK_BOX( hbox ), textMainTex, FALSE, FALSE, 0 );
732 gtk_widget_show( textMainTex );
734 w = ui::Label( "Main Texture" );
735 gtk_box_pack_start( GTK_BOX( hbox ), w, FALSE, FALSE, 1 );
736 gtk_widget_show( w );
738 // -------------------------- //
740 hbox = ui::HBox( FALSE, 10 );
741 gtk_box_pack_start( GTK_BOX( vbox ), hbox, FALSE, FALSE, 0 );
742 gtk_widget_show( hbox );
744 textRiserTex = ui::Entry( 512 );
745 gtk_box_pack_start( GTK_BOX( hbox ), textRiserTex, FALSE, FALSE, 0 );
746 gtk_widget_show( textRiserTex );
748 w = ui::Label( "Riser Texture" );
749 gtk_box_pack_start( GTK_BOX( hbox ), w, FALSE, FALSE, 1 );
750 gtk_widget_show( w );
752 // -------------------------- //
753 w = ui::Widget(gtk_hseparator_new());
754 gtk_box_pack_start( GTK_BOX( vbox ), w, FALSE, FALSE, 0 );
755 gtk_widget_show( w );
757 hbox = ui::HBox( FALSE, 10 );
758 gtk_box_pack_start( GTK_BOX( vbox ), hbox, FALSE, FALSE, 0 );
759 gtk_widget_show( hbox );
761 w = ui::Button( "OK" );
762 gtk_box_pack_start( GTK_BOX( hbox ), w, TRUE, TRUE, 0 );
763 w.connect( "clicked", G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( eIDOK ) );
764 gtk_widget_set_can_default( w, true );
765 gtk_widget_grab_default( w );
766 gtk_widget_show( w );
768 w = ui::Button( "Cancel" );
769 gtk_box_pack_start( GTK_BOX( hbox ), w, TRUE, TRUE, 0 );
770 w.connect( "clicked", G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( eIDCANCEL ) );
771 gtk_widget_show( w );
775 // +djbob: need our "little" modal loop mars :P
776 gtk_window_set_position( GTK_WINDOW( window ),GTK_WIN_POS_CENTER );
777 gtk_widget_show( window );
778 gtk_grab_add( window );
780 bool dialogError = TRUE;
781 while ( dialogError )
785 gtk_main_iteration();
789 if ( ret == eIDOK ) {
790 rs->bUseDetail = gtk_toggle_button_get_active( (GtkToggleButton*)checkUseDetail ) ? true : false;
792 strcpy( rs->riserTexture, gtk_entry_get_text( (GtkEntry*)textRiserTex ) );
793 strcpy( rs->mainTexture, gtk_entry_get_text( (GtkEntry*)textMainTex ) );
795 if ( gtk_toggle_button_get_active( (GtkToggleButton*)radioNorth ) ) {
796 rs->direction = MOVE_NORTH;
798 else if ( gtk_toggle_button_get_active( (GtkToggleButton*)radioSouth ) ) {
799 rs->direction = MOVE_SOUTH;
801 else if ( gtk_toggle_button_get_active( (GtkToggleButton*)radioEast ) ) {
802 rs->direction = MOVE_EAST;
804 else if ( gtk_toggle_button_get_active( (GtkToggleButton*)radioWest ) ) {
805 rs->direction = MOVE_WEST;
808 if ( !ValidateTextInt( gtk_entry_get_text( (GtkEntry*)textStairHeight ), "Stair Height", &rs->stairHeight ) ) {
812 if ( gtk_toggle_button_get_active( (GtkToggleButton*)radioOldStyle ) ) {
813 rs->style = STYLE_ORIGINAL;
815 else if ( gtk_toggle_button_get_active( (GtkToggleButton*)radioBobStyle ) ) {
816 rs->style = STYLE_BOB;
818 else if ( gtk_toggle_button_get_active( (GtkToggleButton*)radioCornerStyle ) ) {
819 rs->style = STYLE_CORNER;
824 gtk_grab_remove( window );
825 gtk_widget_destroy( window );
830 // there we go, all done ... on my end at least, not bad for a night's work
833 EMessageBoxReturn DoDoorsBox( DoorRS* rs ){
835 GtkWidget *textFrontBackTex, *textTrimTex;
836 GtkWidget *checkScaleMainH, *checkScaleMainV, *checkScaleTrimH, *checkScaleTrimV;
837 GtkWidget *comboMain, *comboTrim;
838 GtkWidget *radioNS, *radioEW;
839 GSList *radioOrientation;
841 EMessageBoxReturn ret;
844 auto window = ui::Window( ui::window_type::TOP );
846 window.connect( "delete_event", G_CALLBACK( dialog_delete_callback ), NULL );
847 window.connect( "destroy", G_CALLBACK( gtk_widget_destroy ), NULL );
849 gtk_window_set_title( GTK_WINDOW( window ), "Door Builder" );
851 gtk_container_set_border_width( GTK_CONTAINER( window ), 10 );
853 g_object_set_data( G_OBJECT( window ), "loop", &loop );
854 g_object_set_data( G_OBJECT( window ), "ret", &ret );
856 gtk_widget_realize( window );
859 ui::ListStore listMainTextures = ui::ListStore(gtk_list_store_new( 1, G_TYPE_STRING ));
860 ui::ListStore listTrimTextures = ui::ListStore(gtk_list_store_new( 1, G_TYPE_STRING ));
861 LoadGList( GetFilename( buffer, "plugins/bt/door-tex.txt" ), listMainTextures );
862 LoadGList( GetFilename( buffer, "plugins/bt/door-tex-trim.txt" ), listTrimTextures );
864 auto vbox = ui::VBox( FALSE, 10 );
866 gtk_widget_show( vbox );
868 // -------------------------- //
870 hbox = ui::HBox( FALSE, 10 );
871 gtk_box_pack_start( GTK_BOX( vbox ), hbox, FALSE, FALSE, 0 );
872 gtk_widget_show( hbox );
874 textFrontBackTex = ui::Entry( 512 );
875 gtk_entry_set_text( GTK_ENTRY( textFrontBackTex ), rs->mainTexture );
876 gtk_box_pack_start( GTK_BOX( hbox ), textFrontBackTex, FALSE, FALSE, 0 );
877 gtk_widget_show( textFrontBackTex );
879 ui::Widget w = ui::Label( "Door Front/Back Texture" );
880 gtk_box_pack_start( GTK_BOX( hbox ), w, FALSE, FALSE, 0 );
881 gtk_widget_show( w );
883 // ------------------------ //
885 hbox = ui::HBox( FALSE, 10 );
886 gtk_box_pack_start( GTK_BOX( vbox ), hbox, FALSE, FALSE, 0 );
887 gtk_widget_show( hbox );
889 textTrimTex = ui::Entry( 512 );
890 gtk_box_pack_start( GTK_BOX( hbox ), textTrimTex, FALSE, FALSE, 0 );
891 gtk_widget_show( textTrimTex );
893 w = ui::Label( "Door Trim Texture" );
894 gtk_box_pack_start( GTK_BOX( hbox ), w, FALSE, FALSE, 0 );
895 gtk_widget_show( w );
897 // ----------------------- //
899 hbox = ui::HBox( FALSE, 10 );
900 gtk_box_pack_start( GTK_BOX( vbox ), hbox, FALSE, FALSE, 0 );
901 gtk_widget_show( hbox );
903 // sp: horizontally ????
904 // djbob: yes mars, u can spell :]
905 checkScaleMainH = ui::CheckButton( "Scale Main Texture Horizontally" );
906 gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( checkScaleMainH ), TRUE );
907 gtk_box_pack_start( GTK_BOX( hbox ), checkScaleMainH, FALSE, FALSE, 0 );
908 gtk_widget_show( checkScaleMainH );
910 checkScaleTrimH = ui::CheckButton( "Scale Trim Texture Horizontally" );
911 gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( checkScaleTrimH ), TRUE );
912 gtk_box_pack_start( GTK_BOX( hbox ), checkScaleTrimH, FALSE, FALSE, 0 );
913 gtk_widget_show( checkScaleTrimH );
915 // ---------------------- //
917 hbox = ui::HBox( FALSE, 10 );
918 gtk_box_pack_start( GTK_BOX( vbox ), hbox, FALSE, FALSE, 0 );
919 gtk_widget_show( hbox );
921 checkScaleMainV = ui::CheckButton( "Scale Main Texture Vertically" );
922 gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( checkScaleMainV ), TRUE );
923 gtk_box_pack_start( GTK_BOX( hbox ), checkScaleMainV, FALSE, FALSE, 0 );
924 gtk_widget_show( checkScaleMainV );
926 checkScaleTrimV = ui::CheckButton( "Scale Trim Texture Vertically" );
927 gtk_box_pack_start( GTK_BOX( hbox ), checkScaleTrimV, FALSE, FALSE, 0 );
928 gtk_widget_show( checkScaleTrimV );
930 // --------------------- //
932 hbox = ui::HBox( FALSE, 10 );
933 gtk_box_pack_start( GTK_BOX( vbox ), hbox, FALSE, FALSE, 0 );
934 gtk_widget_show( hbox );
936 // djbob: lists added
938 comboMain = gtk_combo_box_new_with_model_and_entry(GTK_TREE_MODEL(listMainTextures));
939 gtk_combo_box_set_entry_text_column(GTK_COMBO_BOX(comboMain), 0);
940 gtk_box_pack_start( GTK_BOX( hbox ), comboMain, FALSE, FALSE, 0 );
941 gtk_widget_show( comboMain );
943 tw1.one = textFrontBackTex;
944 tw1.two = GTK_COMBO_BOX(comboMain);
946 auto buttonSetMain = ui::Button( "Set As Main Texture" );
947 buttonSetMain.connect( "clicked", G_CALLBACK( dialog_button_callback_settex ), &tw1 );
948 gtk_box_pack_start( GTK_BOX( hbox ), buttonSetMain, FALSE, FALSE, 0 );
949 gtk_widget_show( buttonSetMain );
951 // ------------------- //
953 hbox = ui::HBox( FALSE, 10 );
954 gtk_box_pack_start( GTK_BOX( vbox ), hbox, FALSE, FALSE, 0 );
955 gtk_widget_show( hbox );
957 comboTrim = gtk_combo_box_new_with_model_and_entry(GTK_TREE_MODEL(listTrimTextures));
958 gtk_combo_box_set_entry_text_column(GTK_COMBO_BOX(comboMain), 0);
959 gtk_box_pack_start( GTK_BOX( hbox ), comboTrim, FALSE, FALSE, 0 );
960 gtk_widget_show( comboTrim );
962 tw2.one = textTrimTex;
963 tw2.two = GTK_COMBO_BOX(comboTrim);
965 auto buttonSetTrim = ui::Button( "Set As Trim Texture" );
966 buttonSetTrim.connect( "clicked", G_CALLBACK( dialog_button_callback_settex ), &tw2 );
967 gtk_box_pack_start( GTK_BOX( hbox ), buttonSetTrim, FALSE, FALSE, 0 );
968 gtk_widget_show( buttonSetTrim );
970 // ------------------ //
972 hbox = ui::HBox( FALSE, 10 );
973 gtk_box_pack_start( GTK_BOX( vbox ), hbox, FALSE, FALSE, 0 );
974 gtk_widget_show( hbox );
976 w = ui::Label( "Orientation" );
977 gtk_box_pack_start( GTK_BOX( hbox ), w, FALSE, FALSE, 0 );
978 gtk_widget_show( w );
980 // argh more radio buttons!
981 radioNS = gtk_radio_button_new_with_label( NULL, "North - South" );
982 gtk_box_pack_start( GTK_BOX( hbox ), radioNS, FALSE, FALSE, 0 );
983 gtk_widget_show( radioNS );
985 radioOrientation = gtk_radio_button_get_group( GTK_RADIO_BUTTON( radioNS ) );
987 radioEW = gtk_radio_button_new_with_label( radioOrientation, "East - West" );
988 gtk_box_pack_start( GTK_BOX( hbox ), radioEW, FALSE, FALSE, 0 );
989 gtk_widget_show( radioEW );
991 // ----------------- //
993 w = ui::Widget(gtk_hseparator_new());
994 gtk_box_pack_start( GTK_BOX( vbox ), w, FALSE, FALSE, 0 );
995 gtk_widget_show( w );
997 // ----------------- //
999 hbox = ui::HBox( FALSE, 10 );
1000 gtk_box_pack_start( GTK_BOX( vbox ), hbox, FALSE, FALSE, 0 );
1001 gtk_widget_show( hbox );
1003 w = ui::Button( "OK" );
1004 gtk_box_pack_start( GTK_BOX( hbox ), w, TRUE, TRUE, 0 );
1005 w.connect( "clicked", G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( eIDOK ) );
1006 gtk_widget_set_can_default( w, true );
1007 gtk_widget_grab_default( w );
1008 gtk_widget_show( w );
1010 w = ui::Button( "Cancel" );
1011 gtk_box_pack_start( GTK_BOX( hbox ), w, TRUE, TRUE, 0 );
1012 w.connect( "clicked", G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( eIDCANCEL ) );
1013 gtk_widget_show( w );
1016 // ----------------- //
1019 gtk_window_set_position( GTK_WINDOW( window ),GTK_WIN_POS_CENTER );
1020 gtk_widget_show( window );
1021 gtk_grab_add( window );
1024 gtk_main_iteration();
1026 strcpy( rs->mainTexture, gtk_entry_get_text( GTK_ENTRY( textFrontBackTex ) ) );
1027 strcpy( rs->trimTexture, gtk_entry_get_text( GTK_ENTRY( textTrimTex ) ) );
1029 rs->bScaleMainH = gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( checkScaleMainH ) ) ? true : false;
1030 rs->bScaleMainV = gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( checkScaleMainV ) ) ? true : false;
1031 rs->bScaleTrimH = gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( checkScaleTrimH ) ) ? true : false;
1032 rs->bScaleTrimV = gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( checkScaleTrimV ) ) ? true : false;
1034 if ( gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( radioNS ) ) ) {
1035 rs->nOrientation = DIRECTION_NS;
1037 else if ( gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( radioEW ) ) ) {
1038 rs->nOrientation = DIRECTION_EW;
1041 gtk_grab_remove( window );
1042 gtk_widget_destroy( window );
1048 EMessageBoxReturn DoPathPlotterBox( PathPlotterRS* rs ){
1051 ui::Entry text1, text2, text3;
1052 ui::Widget check1, check2;
1054 EMessageBoxReturn ret;
1057 auto window = ui::Window( ui::window_type::TOP );
1059 window.connect( "delete_event", G_CALLBACK( dialog_delete_callback ), NULL );
1060 window.connect( "destroy", G_CALLBACK( gtk_widget_destroy ), NULL );
1062 gtk_window_set_title( GTK_WINDOW( window ), "Texture Reset" );
1063 gtk_container_set_border_width( GTK_CONTAINER( window ), 10 );
1065 g_object_set_data( G_OBJECT( window ), "loop", &loop );
1066 g_object_set_data( G_OBJECT( window ), "ret", &ret );
1068 gtk_widget_realize( window );
1072 auto vbox = ui::VBox( FALSE, 10 );
1074 gtk_widget_show( vbox );
1078 hbox = ui::HBox( FALSE, 10 );
1079 gtk_box_pack_start( GTK_BOX( vbox ), hbox, FALSE, FALSE, 2 );
1080 gtk_widget_show( hbox );
1084 text1 = ui::Entry( 256 );
1085 gtk_entry_set_text( text1, "25" );
1086 gtk_box_pack_start( GTK_BOX( hbox ), text1, FALSE, FALSE, 2 );
1087 gtk_widget_show( text1 );
1089 w = ui::Label( "Number Of Points" );
1090 gtk_box_pack_start( GTK_BOX( hbox ), w, FALSE, FALSE, 2 );
1091 gtk_label_set_justify( GTK_LABEL( w ), GTK_JUSTIFY_LEFT );
1092 gtk_widget_show( w );
1096 hbox = ui::HBox( FALSE, 10 );
1097 gtk_box_pack_start( GTK_BOX( vbox ), hbox, FALSE, FALSE, 2 );
1098 gtk_widget_show( hbox );
1102 text2 = ui::Entry( 256 );
1103 gtk_entry_set_text( text2, "3" );
1104 gtk_box_pack_start( GTK_BOX( hbox ), text2, FALSE, FALSE, 2 );
1105 gtk_widget_show( text2 );
1107 w = ui::Label( "Multipler" );
1108 gtk_box_pack_start( GTK_BOX( hbox ), w, FALSE, FALSE, 2 );
1109 gtk_label_set_justify( GTK_LABEL( w ), GTK_JUSTIFY_LEFT );
1110 gtk_widget_show( w );
1114 w = ui::Label( "Path Distance = dist(start -> apex) * multiplier" );
1115 gtk_box_pack_start( GTK_BOX( vbox ), w, FALSE, FALSE, 0 );
1116 gtk_label_set_justify( GTK_LABEL( w ), GTK_JUSTIFY_LEFT );
1117 gtk_widget_show( w );
1119 hbox = ui::HBox( FALSE, 10 );
1120 gtk_box_pack_start( GTK_BOX( vbox ), hbox, FALSE, FALSE, 2 );
1121 gtk_widget_show( hbox );
1125 text3 = ui::Entry( 256 );
1126 gtk_entry_set_text( text3, "-800" );
1127 gtk_box_pack_start( GTK_BOX( hbox ), text3, FALSE, FALSE, 2 );
1128 gtk_widget_show( text3 );
1130 w = ui::Label( "Gravity" );
1131 gtk_box_pack_start( GTK_BOX( hbox ), w, FALSE, FALSE, 2 );
1132 gtk_label_set_justify( GTK_LABEL( w ), GTK_JUSTIFY_LEFT );
1133 gtk_widget_show( w );
1137 w = ui::Widget(gtk_hseparator_new());
1138 gtk_box_pack_start( GTK_BOX( vbox ), w, FALSE, FALSE, 0 );
1139 gtk_widget_show( w );
1141 check1 = ui::CheckButton( "No Dynamic Update" );
1142 gtk_box_pack_start( GTK_BOX( vbox ), check1, FALSE, FALSE, 0 );
1143 gtk_widget_show( check1 );
1145 check2 = ui::CheckButton( "Show Bounding Lines" );
1146 gtk_box_pack_start( GTK_BOX( vbox ), check2, FALSE, FALSE, 0 );
1147 gtk_widget_show( check2 );
1152 // ----------------- //
1154 w = ui::Widget(gtk_hseparator_new());
1155 gtk_box_pack_start( GTK_BOX( vbox ), w, FALSE, FALSE, 0 );
1156 gtk_widget_show( w );
1158 // ----------------- //
1160 hbox = ui::HBox( FALSE, 10 );
1161 gtk_box_pack_start( GTK_BOX( vbox ), hbox, FALSE, FALSE, 0 );
1162 gtk_widget_show( hbox );
1164 w = ui::Button( "Enable" );
1165 gtk_box_pack_start( GTK_BOX( hbox ), w, TRUE, TRUE, 0 );
1166 w.connect( "clicked", G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( eIDYES ) );
1167 gtk_widget_show( w );
1169 gtk_widget_set_can_default( w, true );
1170 gtk_widget_grab_default( w );
1172 w = ui::Button( "Disable" );
1173 gtk_box_pack_start( GTK_BOX( hbox ), w, TRUE, TRUE, 0 );
1174 w.connect( "clicked", G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( eIDNO ) );
1175 gtk_widget_show( w );
1177 w = ui::Button( "Cancel" );
1178 gtk_box_pack_start( GTK_BOX( hbox ), w, TRUE, TRUE, 0 );
1179 w.connect( "clicked", G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( eIDCANCEL ) );
1180 gtk_widget_show( w );
1184 // ----------------- //
1186 gtk_window_set_position( GTK_WINDOW( window ),GTK_WIN_POS_CENTER );
1187 gtk_widget_show( window );
1188 gtk_grab_add( window );
1190 bool dialogError = TRUE;
1191 while ( dialogError )
1195 gtk_main_iteration();
1197 dialogError = FALSE;
1199 if ( ret == eIDYES ) {
1200 if ( !ValidateTextIntRange( gtk_entry_get_text( GTK_ENTRY( text1 ) ), 1, 200, "Number Of Points", &rs->nPoints ) ) {
1204 if ( !ValidateTextFloatRange( gtk_entry_get_text( GTK_ENTRY( text2 ) ), 1.0f, 10.0f, "Multiplier", &rs->fMultiplier ) ) {
1208 if ( !ValidateTextFloatRange( gtk_entry_get_text( GTK_ENTRY( text3 ) ), -10000.0f, -1.0f, "Gravity", &rs->fGravity ) ) {
1212 rs->bNoUpdate = gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( check1 ) ) ? true : false;
1213 rs->bShowExtra = gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( check2 ) ) ? true : false;
1217 gtk_grab_remove( window );
1218 gtk_widget_destroy( window );
1223 EMessageBoxReturn DoCTFColourChangeBox(){
1225 EMessageBoxReturn ret;
1228 auto window = ui::Window( ui::window_type::TOP );
1230 window.connect( "delete_event", G_CALLBACK( dialog_delete_callback ), NULL );
1231 window.connect( "destroy", G_CALLBACK( gtk_widget_destroy ), NULL );
1233 gtk_window_set_title( GTK_WINDOW( window ), "CTF Colour Changer" );
1234 gtk_container_set_border_width( GTK_CONTAINER( window ), 10 );
1236 g_object_set_data( G_OBJECT( window ), "loop", &loop );
1237 g_object_set_data( G_OBJECT( window ), "ret", &ret );
1239 gtk_widget_realize( window );
1243 auto vbox = ui::VBox( FALSE, 10 );
1245 gtk_widget_show( vbox );
1249 hbox = ui::HBox( FALSE, 10 );
1250 gtk_box_pack_start( GTK_BOX( vbox ), hbox, TRUE, TRUE, 0 );
1251 gtk_widget_show( hbox );
1253 // ---- hbox ---- ok/cancel buttons
1255 w = ui::Button( "Red->Blue" );
1256 gtk_box_pack_start( GTK_BOX( hbox ), w, TRUE, TRUE, 0 );
1257 w.connect( "clicked", G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( eIDOK ) );
1259 gtk_widget_set_can_default( w, true );
1260 gtk_widget_grab_default( w );
1261 gtk_widget_show( w );
1263 w = ui::Button( "Blue->Red" );
1264 gtk_box_pack_start( GTK_BOX( hbox ), w, TRUE, TRUE, 0 );
1265 w.connect( "clicked", G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( eIDYES ) );
1266 gtk_widget_show( w );
1268 w = ui::Button( "Cancel" );
1269 gtk_box_pack_start( GTK_BOX( hbox ), w, TRUE, TRUE, 0 );
1270 w.connect( "clicked", G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( eIDCANCEL ) );
1271 gtk_widget_show( w );
1278 gtk_window_set_position( GTK_WINDOW( window ),GTK_WIN_POS_CENTER );
1279 gtk_widget_show( window );
1280 gtk_grab_add( window );
1283 gtk_main_iteration();
1285 gtk_grab_remove( window );
1286 gtk_widget_destroy( window );
1291 EMessageBoxReturn DoResetTextureBox( ResetTextureRS* rs ){
1296 EMessageBoxReturn ret;
1299 auto window = ui::Window( ui::window_type::TOP );
1301 window.connect( "delete_event", G_CALLBACK( dialog_delete_callback ), NULL );
1302 window.connect( "destroy", G_CALLBACK( gtk_widget_destroy ), NULL );
1304 gtk_window_set_title( GTK_WINDOW( window ), "Texture Reset" );
1305 gtk_container_set_border_width( GTK_CONTAINER( window ), 10 );
1307 g_object_set_data( G_OBJECT( window ), "loop", &loop );
1308 g_object_set_data( G_OBJECT( window ), "ret", &ret );
1310 gtk_widget_realize( window );
1312 auto vbox = ui::VBox( FALSE, 10 );
1318 hbox = ui::HBox( FALSE, 10 );
1319 gtk_box_pack_start( GTK_BOX( vbox ), hbox, FALSE, FALSE, 2 );
1320 gtk_widget_show( hbox );
1324 texSelected = "Currently Selected Texture: ";
1325 texSelected += GetCurrentTexture();
1327 w = ui::Label( texSelected );
1328 gtk_box_pack_start( GTK_BOX( hbox ), w, FALSE, FALSE, 2 );
1329 gtk_label_set_justify( GTK_LABEL( w ), GTK_JUSTIFY_LEFT );
1330 gtk_widget_show( w );
1334 auto frame = ui::Frame( "Reset Texture Names" );
1335 gtk_widget_show( frame );
1336 gtk_box_pack_start( GTK_BOX( vbox ), frame, FALSE, TRUE, 0 );
1338 auto table = ui::Table( 2, 3, TRUE );
1341 gtk_table_set_row_spacings( GTK_TABLE( table ), 5 );
1342 gtk_table_set_col_spacings( GTK_TABLE( table ), 5 );
1343 gtk_container_set_border_width( GTK_CONTAINER( table ), 5 );
1347 dlgTexReset.cbTexChange = ui::CheckButton( "Enabled" );
1348 dlgTexReset.cbTexChange.connect( "toggled", G_CALLBACK( dialog_button_callback_texreset_update ), NULL );
1349 gtk_widget_show( dlgTexReset.cbTexChange );
1350 gtk_table_attach( GTK_TABLE( table ), dlgTexReset.cbTexChange, 0, 1, 0, 1,
1351 (GtkAttachOptions) ( GTK_FILL ),
1352 (GtkAttachOptions) ( 0 ), 0, 0 );
1354 w = ui::Label( "Old Name: " );
1355 gtk_table_attach( GTK_TABLE( table ), w, 1, 2, 0, 1,
1356 (GtkAttachOptions) ( GTK_FILL ),
1357 (GtkAttachOptions) ( 0 ), 0, 0 );
1358 gtk_widget_show( w );
1360 dlgTexReset.editTexOld = ui::Entry( 256 );
1361 gtk_entry_set_text( GTK_ENTRY( dlgTexReset.editTexOld ), rs->textureName );
1362 gtk_table_attach( GTK_TABLE( table ), dlgTexReset.editTexOld, 2, 3, 0, 1,
1363 (GtkAttachOptions) ( GTK_FILL ),
1364 (GtkAttachOptions) ( 0 ), 0, 0 );
1365 gtk_widget_show( dlgTexReset.editTexOld );
1367 w = ui::Label( "New Name: " );
1368 gtk_table_attach( GTK_TABLE( table ), w, 1, 2, 1, 2,
1369 (GtkAttachOptions) ( GTK_FILL ),
1370 (GtkAttachOptions) ( 0 ), 0, 0 );
1371 gtk_widget_show( w );
1373 dlgTexReset.editTexNew = ui::Entry( 256 );
1374 gtk_entry_set_text( GTK_ENTRY( dlgTexReset.editTexNew ), rs->textureName );
1375 gtk_table_attach( GTK_TABLE( table ), dlgTexReset.editTexNew, 2, 3, 1, 2,
1376 (GtkAttachOptions) ( GTK_FILL ),
1377 (GtkAttachOptions) ( 0 ), 0, 0 );
1378 gtk_widget_show( dlgTexReset.editTexNew );
1382 frame = ui::Frame( "Reset Scales" );
1383 gtk_widget_show( frame );
1384 gtk_box_pack_start( GTK_BOX( vbox ), frame, FALSE, TRUE, 0 );
1386 table = ui::Table( 2, 3, TRUE );
1389 gtk_table_set_row_spacings( GTK_TABLE( table ), 5 );
1390 gtk_table_set_col_spacings( GTK_TABLE( table ), 5 );
1391 gtk_container_set_border_width( GTK_CONTAINER( table ), 5 );
1395 dlgTexReset.cbScaleHor = ui::CheckButton( "Enabled" );
1396 dlgTexReset.cbScaleHor.connect( "toggled", G_CALLBACK( dialog_button_callback_texreset_update ), NULL );
1397 gtk_widget_show( dlgTexReset.cbScaleHor );
1398 gtk_table_attach( GTK_TABLE( table ), dlgTexReset.cbScaleHor, 0, 1, 0, 1,
1399 (GtkAttachOptions) ( GTK_FILL ),
1400 (GtkAttachOptions) ( 0 ), 0, 0 );
1402 w = ui::Label( "New Horizontal Scale: " );
1403 gtk_table_attach( GTK_TABLE( table ), w, 1, 2, 0, 1,
1404 (GtkAttachOptions) ( GTK_FILL ),
1405 (GtkAttachOptions) ( 0 ), 0, 0 );
1406 gtk_widget_show( w );
1408 dlgTexReset.editScaleHor = ui::Entry( 256 );
1409 gtk_entry_set_text( GTK_ENTRY( dlgTexReset.editScaleHor ), "0.5" );
1410 gtk_table_attach( GTK_TABLE( table ), dlgTexReset.editScaleHor, 2, 3, 0, 1,
1411 (GtkAttachOptions) ( GTK_FILL ),
1412 (GtkAttachOptions) ( 0 ), 0, 0 );
1413 gtk_widget_show( dlgTexReset.editScaleHor );
1416 dlgTexReset.cbScaleVert = ui::CheckButton( "Enabled" );
1417 dlgTexReset.cbScaleVert.connect( "toggled", G_CALLBACK( dialog_button_callback_texreset_update ), NULL );
1418 gtk_widget_show( dlgTexReset.cbScaleVert );
1419 gtk_table_attach( GTK_TABLE( table ), dlgTexReset.cbScaleVert, 0, 1, 1, 2,
1420 (GtkAttachOptions) ( GTK_FILL ),
1421 (GtkAttachOptions) ( 0 ), 0, 0 );
1423 w = ui::Label( "New Vertical Scale: " );
1424 gtk_table_attach( GTK_TABLE( table ), w, 1, 2, 1, 2,
1425 (GtkAttachOptions) ( GTK_FILL ),
1426 (GtkAttachOptions) ( 0 ), 0, 0 );
1427 gtk_widget_show( w );
1429 dlgTexReset.editScaleVert = ui::Entry( 256 );
1430 gtk_entry_set_text( GTK_ENTRY( dlgTexReset.editScaleVert ), "0.5" );
1431 gtk_table_attach( GTK_TABLE( table ), dlgTexReset.editScaleVert, 2, 3, 1, 2,
1432 (GtkAttachOptions) ( GTK_FILL ),
1433 (GtkAttachOptions) ( 0 ), 0, 0 );
1434 gtk_widget_show( dlgTexReset.editScaleVert );
1438 frame = ui::Frame( "Reset Shift" );
1439 gtk_widget_show( frame );
1440 gtk_box_pack_start( GTK_BOX( vbox ), frame, FALSE, TRUE, 0 );
1442 table = ui::Table( 2, 3, TRUE );
1445 gtk_table_set_row_spacings( GTK_TABLE( table ), 5 );
1446 gtk_table_set_col_spacings( GTK_TABLE( table ), 5 );
1447 gtk_container_set_border_width( GTK_CONTAINER( table ), 5 );
1451 dlgTexReset.cbShiftHor = ui::CheckButton( "Enabled" );
1452 dlgTexReset.cbShiftHor.connect( "toggled", G_CALLBACK( dialog_button_callback_texreset_update ), NULL );
1453 gtk_widget_show( dlgTexReset.cbShiftHor );
1454 gtk_table_attach( GTK_TABLE( table ), dlgTexReset.cbShiftHor, 0, 1, 0, 1,
1455 (GtkAttachOptions) ( GTK_FILL ),
1456 (GtkAttachOptions) ( 0 ), 0, 0 );
1458 w = ui::Label( "New Horizontal Shift: " );
1459 gtk_table_attach( GTK_TABLE( table ), w, 1, 2, 0, 1,
1460 (GtkAttachOptions) ( GTK_FILL ),
1461 (GtkAttachOptions) ( 0 ), 0, 0 );
1462 gtk_widget_show( w );
1464 dlgTexReset.editShiftHor = ui::Entry( 256 );
1465 gtk_entry_set_text( GTK_ENTRY( dlgTexReset.editShiftHor ), "0" );
1466 gtk_table_attach( GTK_TABLE( table ), dlgTexReset.editShiftHor, 2, 3, 0, 1,
1467 (GtkAttachOptions) ( GTK_FILL ),
1468 (GtkAttachOptions) ( 0 ), 0, 0 );
1469 gtk_widget_show( dlgTexReset.editShiftHor );
1472 dlgTexReset.cbShiftVert = ui::CheckButton( "Enabled" );
1473 dlgTexReset.cbShiftVert.connect( "toggled", G_CALLBACK( dialog_button_callback_texreset_update ), NULL );
1474 gtk_widget_show( dlgTexReset.cbShiftVert );
1475 gtk_table_attach( GTK_TABLE( table ), dlgTexReset.cbShiftVert, 0, 1, 1, 2,
1476 (GtkAttachOptions) ( GTK_FILL ),
1477 (GtkAttachOptions) ( 0 ), 0, 0 );
1479 w = ui::Label( "New Vertical Shift: " );
1480 gtk_table_attach( GTK_TABLE( table ), w, 1, 2, 1, 2,
1481 (GtkAttachOptions) ( GTK_FILL ),
1482 (GtkAttachOptions) ( 0 ), 0, 0 );
1483 gtk_widget_show( w );
1485 dlgTexReset.editShiftVert = ui::Entry( 256 );
1486 gtk_entry_set_text( GTK_ENTRY( dlgTexReset.editShiftVert ), "0" );
1487 gtk_table_attach( GTK_TABLE( table ), dlgTexReset.editShiftVert, 2, 3, 1, 2,
1488 (GtkAttachOptions) ( GTK_FILL ),
1489 (GtkAttachOptions) ( 0 ), 0, 0 );
1490 gtk_widget_show( dlgTexReset.editShiftVert );
1494 frame = ui::Frame( "Reset Rotation" );
1495 gtk_widget_show( frame );
1496 gtk_box_pack_start( GTK_BOX( vbox ), frame, FALSE, TRUE, 0 );
1498 table = ui::Table( 1, 3, TRUE );
1501 gtk_table_set_row_spacings( GTK_TABLE( table ), 5 );
1502 gtk_table_set_col_spacings( GTK_TABLE( table ), 5 );
1503 gtk_container_set_border_width( GTK_CONTAINER( table ), 5 );
1507 dlgTexReset.cbRotation = ui::CheckButton( "Enabled" );
1508 gtk_widget_show( dlgTexReset.cbRotation );
1509 gtk_table_attach( GTK_TABLE( table ), dlgTexReset.cbRotation, 0, 1, 0, 1,
1510 (GtkAttachOptions) ( GTK_FILL ),
1511 (GtkAttachOptions) ( 0 ), 0, 0 );
1513 w = ui::Label( "New Rotation Value: " );
1514 gtk_table_attach( GTK_TABLE( table ), w, 1, 2, 0, 1,
1515 (GtkAttachOptions) ( GTK_FILL ),
1516 (GtkAttachOptions) ( 0 ), 0, 0 );
1517 gtk_widget_show( w );
1519 dlgTexReset.editRotation = ui::Entry( 256 );
1520 gtk_entry_set_text( GTK_ENTRY( dlgTexReset.editRotation ), "0" );
1521 gtk_table_attach( GTK_TABLE( table ), dlgTexReset.editRotation, 2, 3, 0, 1,
1522 (GtkAttachOptions) ( GTK_FILL ),
1523 (GtkAttachOptions) ( 0 ), 0, 0 );
1524 gtk_widget_show( dlgTexReset.editRotation );
1528 hbox = ui::HBox( FALSE, 10 );
1529 gtk_box_pack_start( GTK_BOX( vbox ), hbox, FALSE, FALSE, 2 );
1530 gtk_widget_show( hbox );
1534 w = ui::Button( "Use Selected Brushes" );
1535 gtk_box_pack_start( GTK_BOX( hbox ), w, TRUE, TRUE, 0 );
1536 w.connect( "clicked", G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( eIDOK ) );
1538 gtk_widget_set_can_default( w, true );
1539 gtk_widget_grab_default( w );
1540 gtk_widget_show( w );
1542 w = ui::Button( "Use All Brushes" );
1543 gtk_box_pack_start( GTK_BOX( hbox ), w, TRUE, TRUE, 0 );
1544 w.connect( "clicked", G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( eIDYES ) );
1545 gtk_widget_show( w );
1547 w = ui::Button( "Cancel" );
1548 gtk_box_pack_start( GTK_BOX( hbox ), w, TRUE, TRUE, 0 );
1549 w.connect( "clicked", G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( eIDCANCEL ) );
1550 gtk_widget_show( w );
1557 gtk_window_set_position( GTK_WINDOW( window ),GTK_WIN_POS_CENTER );
1558 gtk_widget_show( window );
1559 gtk_grab_add( window );
1561 Update_TextureReseter();
1563 bool dialogError = TRUE;
1564 while ( dialogError )
1568 gtk_main_iteration();
1570 dialogError = FALSE;
1572 if ( ret != eIDCANCEL ) {
1573 rs->bResetRotation = gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( dlgTexReset.cbRotation ) );
1574 if ( rs->bResetRotation ) {
1575 if ( !ValidateTextInt( gtk_entry_get_text( GTK_ENTRY( dlgTexReset.editRotation ) ), "Rotation", &rs->rotation ) ) {
1580 rs->bResetScale[0] = gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( dlgTexReset.cbScaleHor ) );
1581 if ( rs->bResetScale[0] ) {
1582 if ( !ValidateTextFloat( gtk_entry_get_text( GTK_ENTRY( dlgTexReset.editScaleHor ) ), "Horizontal Scale", &rs->fScale[0] ) ) {
1587 rs->bResetScale[1] = gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( dlgTexReset.cbScaleVert ) );
1588 if ( rs->bResetScale[1] ) {
1589 if ( !ValidateTextFloat( gtk_entry_get_text( GTK_ENTRY( dlgTexReset.editScaleVert ) ), "Vertical Scale", &rs->fScale[1] ) ) {
1594 rs->bResetShift[0] = gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( dlgTexReset.cbShiftHor ) );
1595 if ( rs->bResetShift[0] ) {
1596 if ( !ValidateTextFloat( gtk_entry_get_text( GTK_ENTRY( dlgTexReset.editShiftHor ) ), "Horizontal Shift", &rs->fShift[0] ) ) {
1601 rs->bResetShift[1] = gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( dlgTexReset.cbShiftVert ) );
1602 if ( rs->bResetShift[1] ) {
1603 if ( !ValidateTextFloat( gtk_entry_get_text( GTK_ENTRY( dlgTexReset.editShiftVert ) ), "Vertical Shift", &rs->fShift[1] ) ) {
1608 rs->bResetTextureName = gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( dlgTexReset.cbTexChange ) );
1609 if ( rs->bResetTextureName ) {
1610 strcpy( rs->textureName, gtk_entry_get_text( GTK_ENTRY( dlgTexReset.editTexOld ) ) );
1611 strcpy( rs->newTextureName, gtk_entry_get_text( GTK_ENTRY( dlgTexReset.editTexNew ) ) );
1616 gtk_grab_remove( window );
1617 gtk_widget_destroy( window );
1622 EMessageBoxReturn DoTrainThingBox( TrainThingRS* rs ){
1627 ui::Widget radiusX, radiusY;
1628 ui::Widget angleStart, angleEnd;
1629 ui::Widget heightStart, heightEnd;
1630 ui::Widget numPoints;
1632 EMessageBoxReturn ret;
1635 auto window = ui::Window( ui::window_type::TOP );
1637 window.connect( "delete_event", G_CALLBACK( dialog_delete_callback ), NULL );
1638 window.connect( "destroy", G_CALLBACK( gtk_widget_destroy ), NULL );
1640 gtk_window_set_title( GTK_WINDOW( window ), "Train Thing" );
1641 gtk_container_set_border_width( GTK_CONTAINER( window ), 10 );
1643 g_object_set_data( G_OBJECT( window ), "loop", &loop );
1644 g_object_set_data( G_OBJECT( window ), "ret", &ret );
1646 gtk_widget_realize( window );
1648 auto vbox = ui::VBox( FALSE, 10 );
1654 hbox = ui::HBox( FALSE, 10 );
1655 gtk_box_pack_start( GTK_BOX( vbox ), hbox, FALSE, FALSE, 2 );
1656 gtk_widget_show( hbox );
1660 auto frame = ui::Frame( "Radii" );
1661 gtk_widget_show( frame );
1662 gtk_box_pack_start( GTK_BOX( vbox ), frame, FALSE, TRUE, 0 );
1664 auto table = ui::Table( 2, 3, TRUE );
1667 gtk_table_set_row_spacings( GTK_TABLE( table ), 5 );
1668 gtk_table_set_col_spacings( GTK_TABLE( table ), 5 );
1669 gtk_container_set_border_width( GTK_CONTAINER( table ), 5 );
1673 w = ui::Label( "X: " );
1674 gtk_table_attach( GTK_TABLE( table ), w, 0, 1, 0, 1,
1675 (GtkAttachOptions) ( GTK_FILL ),
1676 (GtkAttachOptions) ( 0 ), 0, 0 );
1677 gtk_widget_show( w );
1679 radiusX = ui::Entry( 256 );
1680 gtk_entry_set_text( GTK_ENTRY( radiusX ), "100" );
1681 gtk_table_attach( GTK_TABLE( table ), radiusX, 1, 2, 0, 1,
1682 (GtkAttachOptions) ( GTK_FILL ),
1683 (GtkAttachOptions) ( 0 ), 0, 0 );
1684 gtk_widget_show( radiusX );
1688 w = ui::Label( "Y: " );
1689 gtk_table_attach( GTK_TABLE( table ), w, 0, 1, 1, 2,
1690 (GtkAttachOptions) ( GTK_FILL ),
1691 (GtkAttachOptions) ( 0 ), 0, 0 );
1692 gtk_widget_show( w );
1694 radiusY = ui::Entry( 256 );
1695 gtk_entry_set_text( GTK_ENTRY( radiusY ), "100" );
1696 gtk_table_attach( GTK_TABLE( table ), radiusY, 1, 2, 1, 2,
1697 (GtkAttachOptions) ( GTK_FILL ),
1698 (GtkAttachOptions) ( 0 ), 0, 0 );
1699 gtk_widget_show( radiusY );
1703 frame = ui::Frame( "Angles" );
1704 gtk_widget_show( frame );
1705 gtk_box_pack_start( GTK_BOX( vbox ), frame, FALSE, TRUE, 0 );
1707 table = ui::Table( 2, 3, TRUE );
1710 gtk_table_set_row_spacings( GTK_TABLE( table ), 5 );
1711 gtk_table_set_col_spacings( GTK_TABLE( table ), 5 );
1712 gtk_container_set_border_width( GTK_CONTAINER( table ), 5 );
1716 w = ui::Label( "Start: " );
1717 gtk_table_attach( GTK_TABLE( table ), w, 0, 1, 0, 1,
1718 (GtkAttachOptions) ( GTK_FILL ),
1719 (GtkAttachOptions) ( 0 ), 0, 0 );
1720 gtk_widget_show( w );
1722 angleStart = ui::Entry( 256 );
1723 gtk_entry_set_text( GTK_ENTRY( angleStart ), "0" );
1724 gtk_table_attach( GTK_TABLE( table ), angleStart, 1, 2, 0, 1,
1725 (GtkAttachOptions) ( GTK_FILL ),
1726 (GtkAttachOptions) ( 0 ), 0, 0 );
1727 gtk_widget_show( angleStart );
1731 w = ui::Label( "End: " );
1732 gtk_table_attach( GTK_TABLE( table ), w, 0, 1, 1, 2,
1733 (GtkAttachOptions) ( GTK_FILL ),
1734 (GtkAttachOptions) ( 0 ), 0, 0 );
1735 gtk_widget_show( w );
1737 angleEnd = ui::Entry( 256 );
1738 gtk_entry_set_text( GTK_ENTRY( angleEnd ), "90" );
1739 gtk_table_attach( GTK_TABLE( table ), angleEnd, 1, 2, 1, 2,
1740 (GtkAttachOptions) ( GTK_FILL ),
1741 (GtkAttachOptions) ( 0 ), 0, 0 );
1742 gtk_widget_show( angleEnd );
1745 frame = ui::Frame( "Height" );
1746 gtk_widget_show( frame );
1747 gtk_box_pack_start( GTK_BOX( vbox ), frame, FALSE, TRUE, 0 );
1749 table = ui::Table( 2, 3, TRUE );
1752 gtk_table_set_row_spacings( GTK_TABLE( table ), 5 );
1753 gtk_table_set_col_spacings( GTK_TABLE( table ), 5 );
1754 gtk_container_set_border_width( GTK_CONTAINER( table ), 5 );
1758 w = ui::Label( "Start: " );
1759 gtk_table_attach( GTK_TABLE( table ), w, 0, 1, 0, 1,
1760 (GtkAttachOptions) ( GTK_FILL ),
1761 (GtkAttachOptions) ( 0 ), 0, 0 );
1762 gtk_widget_show( w );
1764 heightStart = ui::Entry( 256 );
1765 gtk_entry_set_text( GTK_ENTRY( heightStart ), "0" );
1766 gtk_table_attach( GTK_TABLE( table ), heightStart, 1, 2, 0, 1,
1767 (GtkAttachOptions) ( GTK_FILL ),
1768 (GtkAttachOptions) ( 0 ), 0, 0 );
1769 gtk_widget_show( heightStart );
1773 w = ui::Label( "End: " );
1774 gtk_table_attach( GTK_TABLE( table ), w, 0, 1, 1, 2,
1775 (GtkAttachOptions) ( GTK_FILL ),
1776 (GtkAttachOptions) ( 0 ), 0, 0 );
1777 gtk_widget_show( w );
1779 heightEnd = ui::Entry( 256 );
1780 gtk_entry_set_text( GTK_ENTRY( heightEnd ), "0" );
1781 gtk_table_attach( GTK_TABLE( table ), heightEnd, 1, 2, 1, 2,
1782 (GtkAttachOptions) ( GTK_FILL ),
1783 (GtkAttachOptions) ( 0 ), 0, 0 );
1784 gtk_widget_show( heightEnd );
1788 frame = ui::Frame( "Points" );
1789 gtk_widget_show( frame );
1790 gtk_box_pack_start( GTK_BOX( vbox ), frame, FALSE, TRUE, 0 );
1792 table = ui::Table( 2, 3, TRUE );
1795 gtk_table_set_row_spacings( GTK_TABLE( table ), 5 );
1796 gtk_table_set_col_spacings( GTK_TABLE( table ), 5 );
1797 gtk_container_set_border_width( GTK_CONTAINER( table ), 5 );
1801 w = ui::Label( "Number: " );
1802 gtk_table_attach( GTK_TABLE( table ), w, 0, 1, 0, 1,
1803 (GtkAttachOptions) ( GTK_FILL ),
1804 (GtkAttachOptions) ( 0 ), 0, 0 );
1805 gtk_widget_show( w );
1807 numPoints = ui::Entry( 256 );
1808 gtk_entry_set_text( GTK_ENTRY( numPoints ), "0" );
1809 gtk_table_attach( GTK_TABLE( table ), numPoints, 1, 2, 0, 1,
1810 (GtkAttachOptions) ( GTK_FILL ),
1811 (GtkAttachOptions) ( 0 ), 0, 0 );
1812 gtk_widget_show( numPoints );
1815 hbox = ui::HBox( FALSE, 10 );
1816 gtk_box_pack_start( GTK_BOX( vbox ), hbox, FALSE, FALSE, 2 );
1817 gtk_widget_show( hbox );
1821 w = ui::Button( "Ok" );
1822 gtk_box_pack_start( GTK_BOX( hbox ), w, TRUE, TRUE, 0 );
1823 w.connect( "clicked", G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( eIDOK ) );
1825 gtk_widget_set_can_default( w, true );
1826 gtk_widget_grab_default( w );
1827 gtk_widget_show( w );
1829 w = ui::Button( "Cancel" );
1830 gtk_box_pack_start( GTK_BOX( hbox ), w, TRUE, TRUE, 0 );
1831 w.connect( "clicked", G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( eIDCANCEL ) );
1832 gtk_widget_show( w );
1839 gtk_window_set_position( GTK_WINDOW( window ),GTK_WIN_POS_CENTER );
1840 gtk_widget_show( window );
1841 gtk_grab_add( window );
1843 bool dialogError = TRUE;
1844 while ( dialogError )
1848 gtk_main_iteration();
1850 dialogError = FALSE;
1852 if ( ret != eIDCANCEL ) {
1853 if ( !ValidateTextFloat( gtk_entry_get_text( GTK_ENTRY( radiusX ) ), "Radius (X)", &rs->fRadiusX ) ) {
1857 if ( !ValidateTextFloat( gtk_entry_get_text( GTK_ENTRY( radiusY ) ), "Radius (Y)", &rs->fRadiusY ) ) {
1861 if ( !ValidateTextFloat( gtk_entry_get_text( GTK_ENTRY( angleStart ) ), "Angle (Start)", &rs->fStartAngle ) ) {
1865 if ( !ValidateTextFloat( gtk_entry_get_text( GTK_ENTRY( angleEnd ) ), "Angle (End)", &rs->fEndAngle ) ) {
1869 if ( !ValidateTextFloat( gtk_entry_get_text( GTK_ENTRY( heightStart ) ), "Height (Start)", &rs->fStartHeight ) ) {
1873 if ( !ValidateTextFloat( gtk_entry_get_text( GTK_ENTRY( heightEnd ) ), "Height (End)", &rs->fEndHeight ) ) {
1877 if ( !ValidateTextInt( gtk_entry_get_text( GTK_ENTRY( numPoints ) ), "Num Points", &rs->iNumPoints ) ) {
1883 gtk_grab_remove( window );
1884 gtk_widget_destroy( window );
1889 // add a simple input for the MakeChain thing..
1890 EMessageBoxReturn DoMakeChainBox( MakeChainRS* rs ){
1892 ui::Entry textlinkNum, textlinkName;
1893 EMessageBoxReturn ret;
1896 char const *text = "Please set a value in the boxes below and press 'OK' to make a chain";
1898 auto window = ui::Window( ui::window_type::TOP );
1900 window.connect( "delete_event", G_CALLBACK( dialog_delete_callback ), NULL );
1901 window.connect( "destroy", G_CALLBACK( gtk_widget_destroy ), NULL );
1903 gtk_window_set_title( GTK_WINDOW( window ), "Make Chain" );
1905 gtk_container_set_border_width( GTK_CONTAINER( window ), 10 );
1907 g_object_set_data( G_OBJECT( window ), "loop", &loop );
1908 g_object_set_data( G_OBJECT( window ), "ret", &ret );
1910 gtk_widget_realize( window );
1913 auto vbox = ui::VBox( FALSE, 10 );
1917 auto hbox = ui::HBox( FALSE, 10 );
1921 // dunno if you want this text or not ...
1922 w = ui::Label( text );
1923 gtk_box_pack_start( GTK_BOX( hbox ), w, FALSE, FALSE, 0 );
1924 gtk_widget_show( w );
1926 w = ui::Widget(gtk_hseparator_new());
1927 gtk_box_pack_start( GTK_BOX( vbox ), w, FALSE, FALSE, 0 );
1928 gtk_widget_show( w );
1930 // ------------------------- //
1933 hbox = ui::HBox( FALSE, 10 );
1934 gtk_box_pack_start( GTK_BOX( vbox ), hbox, FALSE, FALSE, 0 );
1935 gtk_widget_show( hbox );
1937 textlinkNum = ui::Entry( 256 );
1938 gtk_box_pack_start( GTK_BOX( hbox ), textlinkNum, FALSE, FALSE, 1 );
1939 gtk_widget_show( textlinkNum );
1941 w = ui::Label( "Number of elements in chain" );
1942 gtk_box_pack_start( GTK_BOX( hbox ), w, FALSE, FALSE, 1 );
1943 gtk_widget_show( w );
1945 // -------------------------- //
1947 hbox = ui::HBox( FALSE, 10 );
1948 gtk_box_pack_start( GTK_BOX( vbox ), hbox, FALSE, FALSE, 0 );
1949 gtk_widget_show( hbox );
1951 textlinkName = ui::Entry( 256 );
1952 gtk_box_pack_start( GTK_BOX( hbox ), textlinkName, FALSE, FALSE, 0 );
1953 gtk_widget_show( textlinkName );
1955 w = ui::Label( "Basename for chain's targetnames." );
1956 gtk_box_pack_start( GTK_BOX( hbox ), w, FALSE, FALSE, 1 );
1957 gtk_widget_show( w );
1960 w = ui::Button( "OK" );
1961 gtk_box_pack_start( GTK_BOX( hbox ), w, TRUE, TRUE, 0 );
1962 w.connect( "clicked", G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( eIDOK ) );
1963 gtk_widget_set_can_default( w, true );
1964 gtk_widget_grab_default( w );
1965 gtk_widget_show( w );
1967 w = ui::Button( "Cancel" );
1968 gtk_box_pack_start( GTK_BOX( hbox ), w, TRUE, TRUE, 0 );
1969 w.connect( "clicked", G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( eIDCANCEL ) );
1970 gtk_widget_show( w );
1974 gtk_window_set_position( GTK_WINDOW( window ),GTK_WIN_POS_CENTER );
1975 gtk_widget_show( window );
1976 gtk_grab_add( window );
1978 bool dialogError = TRUE;
1979 while ( dialogError )
1983 gtk_main_iteration();
1985 dialogError = FALSE;
1987 if ( ret == eIDOK ) {
1988 strcpy( rs->linkName, gtk_entry_get_text( textlinkName ) );
1989 if ( !ValidateTextInt( gtk_entry_get_text( textlinkNum ), "Elements", &rs->linkNum ) ) {
1995 gtk_grab_remove( window );
1996 gtk_widget_destroy( window );