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, const 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, const 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, const 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, const 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 const 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 *checkScaleMainH, *checkScaleMainV, *checkScaleTrimH, *checkScaleTrimV;
836 GtkWidget *radioNS, *radioEW;
837 GSList *radioOrientation;
839 EMessageBoxReturn ret;
842 auto window = ui::Window( ui::window_type::TOP );
844 window.connect( "delete_event", G_CALLBACK( dialog_delete_callback ), NULL );
845 window.connect( "destroy", G_CALLBACK( gtk_widget_destroy ), NULL );
847 gtk_window_set_title( GTK_WINDOW( window ), "Door Builder" );
849 gtk_container_set_border_width( GTK_CONTAINER( window ), 10 );
851 g_object_set_data( G_OBJECT( window ), "loop", &loop );
852 g_object_set_data( G_OBJECT( window ), "ret", &ret );
854 gtk_widget_realize( window );
857 ui::ListStore listMainTextures = ui::ListStore(gtk_list_store_new( 1, G_TYPE_STRING ));
858 ui::ListStore listTrimTextures = ui::ListStore(gtk_list_store_new( 1, G_TYPE_STRING ));
859 LoadGList( GetFilename( buffer, "plugins/bt/door-tex.txt" ), listMainTextures );
860 LoadGList( GetFilename( buffer, "plugins/bt/door-tex-trim.txt" ), listTrimTextures );
862 auto vbox = ui::VBox( FALSE, 10 );
864 gtk_widget_show( vbox );
866 // -------------------------- //
868 hbox = ui::HBox( FALSE, 10 );
869 gtk_box_pack_start( GTK_BOX( vbox ), hbox, FALSE, FALSE, 0 );
870 gtk_widget_show( hbox );
872 auto textFrontBackTex = ui::Entry( 512 );
873 gtk_entry_set_text( GTK_ENTRY( textFrontBackTex ), rs->mainTexture );
874 gtk_box_pack_start( GTK_BOX( hbox ), textFrontBackTex, FALSE, FALSE, 0 );
875 gtk_widget_show( textFrontBackTex );
877 ui::Widget w = ui::Label( "Door Front/Back Texture" );
878 gtk_box_pack_start( GTK_BOX( hbox ), w, FALSE, FALSE, 0 );
879 gtk_widget_show( w );
881 // ------------------------ //
883 hbox = ui::HBox( FALSE, 10 );
884 gtk_box_pack_start( GTK_BOX( vbox ), hbox, FALSE, FALSE, 0 );
885 gtk_widget_show( hbox );
887 auto textTrimTex = ui::Entry( 512 );
888 gtk_box_pack_start( GTK_BOX( hbox ), textTrimTex, FALSE, FALSE, 0 );
889 gtk_widget_show( textTrimTex );
891 w = ui::Label( "Door Trim Texture" );
892 gtk_box_pack_start( GTK_BOX( hbox ), w, FALSE, FALSE, 0 );
893 gtk_widget_show( w );
895 // ----------------------- //
897 hbox = ui::HBox( FALSE, 10 );
898 gtk_box_pack_start( GTK_BOX( vbox ), hbox, FALSE, FALSE, 0 );
899 gtk_widget_show( hbox );
901 // sp: horizontally ????
902 // djbob: yes mars, u can spell :]
903 checkScaleMainH = ui::CheckButton( "Scale Main Texture Horizontally" );
904 gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( checkScaleMainH ), TRUE );
905 gtk_box_pack_start( GTK_BOX( hbox ), checkScaleMainH, FALSE, FALSE, 0 );
906 gtk_widget_show( checkScaleMainH );
908 checkScaleTrimH = ui::CheckButton( "Scale Trim Texture Horizontally" );
909 gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( checkScaleTrimH ), TRUE );
910 gtk_box_pack_start( GTK_BOX( hbox ), checkScaleTrimH, FALSE, FALSE, 0 );
911 gtk_widget_show( checkScaleTrimH );
913 // ---------------------- //
915 hbox = ui::HBox( FALSE, 10 );
916 gtk_box_pack_start( GTK_BOX( vbox ), hbox, FALSE, FALSE, 0 );
917 gtk_widget_show( hbox );
919 checkScaleMainV = ui::CheckButton( "Scale Main Texture Vertically" );
920 gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( checkScaleMainV ), TRUE );
921 gtk_box_pack_start( GTK_BOX( hbox ), checkScaleMainV, FALSE, FALSE, 0 );
922 gtk_widget_show( checkScaleMainV );
924 checkScaleTrimV = ui::CheckButton( "Scale Trim Texture Vertically" );
925 gtk_box_pack_start( GTK_BOX( hbox ), checkScaleTrimV, FALSE, FALSE, 0 );
926 gtk_widget_show( checkScaleTrimV );
928 // --------------------- //
930 hbox = ui::HBox( FALSE, 10 );
931 gtk_box_pack_start( GTK_BOX( vbox ), hbox, FALSE, FALSE, 0 );
932 gtk_widget_show( hbox );
934 // djbob: lists added
936 auto comboMain = ui::ComboBox(GTK_COMBO_BOX(gtk_combo_box_new_with_model_and_entry(GTK_TREE_MODEL(listMainTextures))));
937 gtk_combo_box_set_entry_text_column(GTK_COMBO_BOX(comboMain), 0);
938 gtk_box_pack_start( GTK_BOX( hbox ), comboMain, FALSE, FALSE, 0 );
939 gtk_widget_show( comboMain );
941 tw1.one = textFrontBackTex;
944 auto buttonSetMain = ui::Button( "Set As Main Texture" );
945 buttonSetMain.connect( "clicked", G_CALLBACK( dialog_button_callback_settex ), &tw1 );
946 gtk_box_pack_start( GTK_BOX( hbox ), buttonSetMain, FALSE, FALSE, 0 );
947 gtk_widget_show( buttonSetMain );
949 // ------------------- //
951 hbox = ui::HBox( FALSE, 10 );
952 gtk_box_pack_start( GTK_BOX( vbox ), hbox, FALSE, FALSE, 0 );
953 gtk_widget_show( hbox );
955 auto comboTrim = ui::ComboBox(GTK_COMBO_BOX(gtk_combo_box_new_with_model_and_entry(GTK_TREE_MODEL(listTrimTextures))));
956 gtk_combo_box_set_entry_text_column(GTK_COMBO_BOX(comboMain), 0);
957 gtk_box_pack_start( GTK_BOX( hbox ), comboTrim, FALSE, FALSE, 0 );
958 gtk_widget_show( comboTrim );
960 tw2.one = textTrimTex;
963 auto buttonSetTrim = ui::Button( "Set As Trim Texture" );
964 buttonSetTrim.connect( "clicked", G_CALLBACK( dialog_button_callback_settex ), &tw2 );
965 gtk_box_pack_start( GTK_BOX( hbox ), buttonSetTrim, FALSE, FALSE, 0 );
966 gtk_widget_show( buttonSetTrim );
968 // ------------------ //
970 hbox = ui::HBox( FALSE, 10 );
971 gtk_box_pack_start( GTK_BOX( vbox ), hbox, FALSE, FALSE, 0 );
972 gtk_widget_show( hbox );
974 w = ui::Label( "Orientation" );
975 gtk_box_pack_start( GTK_BOX( hbox ), w, FALSE, FALSE, 0 );
976 gtk_widget_show( w );
978 // argh more radio buttons!
979 radioNS = gtk_radio_button_new_with_label( NULL, "North - South" );
980 gtk_box_pack_start( GTK_BOX( hbox ), radioNS, FALSE, FALSE, 0 );
981 gtk_widget_show( radioNS );
983 radioOrientation = gtk_radio_button_get_group( GTK_RADIO_BUTTON( radioNS ) );
985 radioEW = gtk_radio_button_new_with_label( radioOrientation, "East - West" );
986 gtk_box_pack_start( GTK_BOX( hbox ), radioEW, FALSE, FALSE, 0 );
987 gtk_widget_show( radioEW );
989 // ----------------- //
991 w = ui::Widget(gtk_hseparator_new());
992 gtk_box_pack_start( GTK_BOX( vbox ), w, FALSE, FALSE, 0 );
993 gtk_widget_show( w );
995 // ----------------- //
997 hbox = ui::HBox( FALSE, 10 );
998 gtk_box_pack_start( GTK_BOX( vbox ), hbox, FALSE, FALSE, 0 );
999 gtk_widget_show( hbox );
1001 w = ui::Button( "OK" );
1002 gtk_box_pack_start( GTK_BOX( hbox ), w, TRUE, TRUE, 0 );
1003 w.connect( "clicked", G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( eIDOK ) );
1004 gtk_widget_set_can_default( w, true );
1005 gtk_widget_grab_default( w );
1006 gtk_widget_show( w );
1008 w = ui::Button( "Cancel" );
1009 gtk_box_pack_start( GTK_BOX( hbox ), w, TRUE, TRUE, 0 );
1010 w.connect( "clicked", G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( eIDCANCEL ) );
1011 gtk_widget_show( w );
1014 // ----------------- //
1017 gtk_window_set_position( GTK_WINDOW( window ),GTK_WIN_POS_CENTER );
1018 gtk_widget_show( window );
1019 gtk_grab_add( window );
1022 gtk_main_iteration();
1024 strcpy( rs->mainTexture, gtk_entry_get_text( GTK_ENTRY( textFrontBackTex ) ) );
1025 strcpy( rs->trimTexture, gtk_entry_get_text( GTK_ENTRY( textTrimTex ) ) );
1027 rs->bScaleMainH = gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( checkScaleMainH ) ) ? true : false;
1028 rs->bScaleMainV = gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( checkScaleMainV ) ) ? true : false;
1029 rs->bScaleTrimH = gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( checkScaleTrimH ) ) ? true : false;
1030 rs->bScaleTrimV = gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( checkScaleTrimV ) ) ? true : false;
1032 if ( gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( radioNS ) ) ) {
1033 rs->nOrientation = DIRECTION_NS;
1035 else if ( gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( radioEW ) ) ) {
1036 rs->nOrientation = DIRECTION_EW;
1039 gtk_grab_remove( window );
1040 gtk_widget_destroy( window );
1046 EMessageBoxReturn DoPathPlotterBox( PathPlotterRS* rs ){
1049 ui::Entry text1, text2, text3;
1050 ui::Widget check1, check2;
1052 EMessageBoxReturn ret;
1055 auto window = ui::Window( ui::window_type::TOP );
1057 window.connect( "delete_event", G_CALLBACK( dialog_delete_callback ), NULL );
1058 window.connect( "destroy", G_CALLBACK( gtk_widget_destroy ), NULL );
1060 gtk_window_set_title( GTK_WINDOW( window ), "Texture Reset" );
1061 gtk_container_set_border_width( GTK_CONTAINER( window ), 10 );
1063 g_object_set_data( G_OBJECT( window ), "loop", &loop );
1064 g_object_set_data( G_OBJECT( window ), "ret", &ret );
1066 gtk_widget_realize( window );
1070 auto vbox = ui::VBox( FALSE, 10 );
1072 gtk_widget_show( vbox );
1076 hbox = ui::HBox( FALSE, 10 );
1077 gtk_box_pack_start( GTK_BOX( vbox ), hbox, FALSE, FALSE, 2 );
1078 gtk_widget_show( hbox );
1082 text1 = ui::Entry( 256 );
1083 gtk_entry_set_text( text1, "25" );
1084 gtk_box_pack_start( GTK_BOX( hbox ), text1, FALSE, FALSE, 2 );
1085 gtk_widget_show( text1 );
1087 w = ui::Label( "Number Of Points" );
1088 gtk_box_pack_start( GTK_BOX( hbox ), w, FALSE, FALSE, 2 );
1089 gtk_label_set_justify( GTK_LABEL( w ), GTK_JUSTIFY_LEFT );
1090 gtk_widget_show( w );
1094 hbox = ui::HBox( FALSE, 10 );
1095 gtk_box_pack_start( GTK_BOX( vbox ), hbox, FALSE, FALSE, 2 );
1096 gtk_widget_show( hbox );
1100 text2 = ui::Entry( 256 );
1101 gtk_entry_set_text( text2, "3" );
1102 gtk_box_pack_start( GTK_BOX( hbox ), text2, FALSE, FALSE, 2 );
1103 gtk_widget_show( text2 );
1105 w = ui::Label( "Multipler" );
1106 gtk_box_pack_start( GTK_BOX( hbox ), w, FALSE, FALSE, 2 );
1107 gtk_label_set_justify( GTK_LABEL( w ), GTK_JUSTIFY_LEFT );
1108 gtk_widget_show( w );
1112 w = ui::Label( "Path Distance = dist(start -> apex) * multiplier" );
1113 gtk_box_pack_start( GTK_BOX( vbox ), w, FALSE, FALSE, 0 );
1114 gtk_label_set_justify( GTK_LABEL( w ), GTK_JUSTIFY_LEFT );
1115 gtk_widget_show( w );
1117 hbox = ui::HBox( FALSE, 10 );
1118 gtk_box_pack_start( GTK_BOX( vbox ), hbox, FALSE, FALSE, 2 );
1119 gtk_widget_show( hbox );
1123 text3 = ui::Entry( 256 );
1124 gtk_entry_set_text( text3, "-800" );
1125 gtk_box_pack_start( GTK_BOX( hbox ), text3, FALSE, FALSE, 2 );
1126 gtk_widget_show( text3 );
1128 w = ui::Label( "Gravity" );
1129 gtk_box_pack_start( GTK_BOX( hbox ), w, FALSE, FALSE, 2 );
1130 gtk_label_set_justify( GTK_LABEL( w ), GTK_JUSTIFY_LEFT );
1131 gtk_widget_show( w );
1135 w = ui::Widget(gtk_hseparator_new());
1136 gtk_box_pack_start( GTK_BOX( vbox ), w, FALSE, FALSE, 0 );
1137 gtk_widget_show( w );
1139 check1 = ui::CheckButton( "No Dynamic Update" );
1140 gtk_box_pack_start( GTK_BOX( vbox ), check1, FALSE, FALSE, 0 );
1141 gtk_widget_show( check1 );
1143 check2 = ui::CheckButton( "Show Bounding Lines" );
1144 gtk_box_pack_start( GTK_BOX( vbox ), check2, FALSE, FALSE, 0 );
1145 gtk_widget_show( check2 );
1150 // ----------------- //
1152 w = ui::Widget(gtk_hseparator_new());
1153 gtk_box_pack_start( GTK_BOX( vbox ), w, FALSE, FALSE, 0 );
1154 gtk_widget_show( w );
1156 // ----------------- //
1158 hbox = ui::HBox( FALSE, 10 );
1159 gtk_box_pack_start( GTK_BOX( vbox ), hbox, FALSE, FALSE, 0 );
1160 gtk_widget_show( hbox );
1162 w = ui::Button( "Enable" );
1163 gtk_box_pack_start( GTK_BOX( hbox ), w, TRUE, TRUE, 0 );
1164 w.connect( "clicked", G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( eIDYES ) );
1165 gtk_widget_show( w );
1167 gtk_widget_set_can_default( w, true );
1168 gtk_widget_grab_default( w );
1170 w = ui::Button( "Disable" );
1171 gtk_box_pack_start( GTK_BOX( hbox ), w, TRUE, TRUE, 0 );
1172 w.connect( "clicked", G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( eIDNO ) );
1173 gtk_widget_show( w );
1175 w = ui::Button( "Cancel" );
1176 gtk_box_pack_start( GTK_BOX( hbox ), w, TRUE, TRUE, 0 );
1177 w.connect( "clicked", G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( eIDCANCEL ) );
1178 gtk_widget_show( w );
1182 // ----------------- //
1184 gtk_window_set_position( GTK_WINDOW( window ),GTK_WIN_POS_CENTER );
1185 gtk_widget_show( window );
1186 gtk_grab_add( window );
1188 bool dialogError = TRUE;
1189 while ( dialogError )
1193 gtk_main_iteration();
1195 dialogError = FALSE;
1197 if ( ret == eIDYES ) {
1198 if ( !ValidateTextIntRange( gtk_entry_get_text( GTK_ENTRY( text1 ) ), 1, 200, "Number Of Points", &rs->nPoints ) ) {
1202 if ( !ValidateTextFloatRange( gtk_entry_get_text( GTK_ENTRY( text2 ) ), 1.0f, 10.0f, "Multiplier", &rs->fMultiplier ) ) {
1206 if ( !ValidateTextFloatRange( gtk_entry_get_text( GTK_ENTRY( text3 ) ), -10000.0f, -1.0f, "Gravity", &rs->fGravity ) ) {
1210 rs->bNoUpdate = gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( check1 ) ) ? true : false;
1211 rs->bShowExtra = gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( check2 ) ) ? true : false;
1215 gtk_grab_remove( window );
1216 gtk_widget_destroy( window );
1221 EMessageBoxReturn DoCTFColourChangeBox(){
1223 EMessageBoxReturn ret;
1226 auto window = ui::Window( ui::window_type::TOP );
1228 window.connect( "delete_event", G_CALLBACK( dialog_delete_callback ), NULL );
1229 window.connect( "destroy", G_CALLBACK( gtk_widget_destroy ), NULL );
1231 gtk_window_set_title( GTK_WINDOW( window ), "CTF Colour Changer" );
1232 gtk_container_set_border_width( GTK_CONTAINER( window ), 10 );
1234 g_object_set_data( G_OBJECT( window ), "loop", &loop );
1235 g_object_set_data( G_OBJECT( window ), "ret", &ret );
1237 gtk_widget_realize( window );
1241 auto vbox = ui::VBox( FALSE, 10 );
1243 gtk_widget_show( vbox );
1247 hbox = ui::HBox( FALSE, 10 );
1248 gtk_box_pack_start( GTK_BOX( vbox ), hbox, TRUE, TRUE, 0 );
1249 gtk_widget_show( hbox );
1251 // ---- hbox ---- ok/cancel buttons
1253 w = ui::Button( "Red->Blue" );
1254 gtk_box_pack_start( GTK_BOX( hbox ), w, TRUE, TRUE, 0 );
1255 w.connect( "clicked", G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( eIDOK ) );
1257 gtk_widget_set_can_default( w, true );
1258 gtk_widget_grab_default( w );
1259 gtk_widget_show( w );
1261 w = ui::Button( "Blue->Red" );
1262 gtk_box_pack_start( GTK_BOX( hbox ), w, TRUE, TRUE, 0 );
1263 w.connect( "clicked", G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( eIDYES ) );
1264 gtk_widget_show( w );
1266 w = ui::Button( "Cancel" );
1267 gtk_box_pack_start( GTK_BOX( hbox ), w, TRUE, TRUE, 0 );
1268 w.connect( "clicked", G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( eIDCANCEL ) );
1269 gtk_widget_show( w );
1276 gtk_window_set_position( GTK_WINDOW( window ),GTK_WIN_POS_CENTER );
1277 gtk_widget_show( window );
1278 gtk_grab_add( window );
1281 gtk_main_iteration();
1283 gtk_grab_remove( window );
1284 gtk_widget_destroy( window );
1289 EMessageBoxReturn DoResetTextureBox( ResetTextureRS* rs ){
1294 EMessageBoxReturn ret;
1297 auto window = ui::Window( ui::window_type::TOP );
1299 window.connect( "delete_event", G_CALLBACK( dialog_delete_callback ), NULL );
1300 window.connect( "destroy", G_CALLBACK( gtk_widget_destroy ), NULL );
1302 gtk_window_set_title( GTK_WINDOW( window ), "Texture Reset" );
1303 gtk_container_set_border_width( GTK_CONTAINER( window ), 10 );
1305 g_object_set_data( G_OBJECT( window ), "loop", &loop );
1306 g_object_set_data( G_OBJECT( window ), "ret", &ret );
1308 gtk_widget_realize( window );
1310 auto vbox = ui::VBox( FALSE, 10 );
1316 hbox = ui::HBox( FALSE, 10 );
1317 gtk_box_pack_start( GTK_BOX( vbox ), hbox, FALSE, FALSE, 2 );
1318 gtk_widget_show( hbox );
1322 texSelected = "Currently Selected Texture: ";
1323 texSelected += GetCurrentTexture();
1325 w = ui::Label( texSelected );
1326 gtk_box_pack_start( GTK_BOX( hbox ), w, FALSE, FALSE, 2 );
1327 gtk_label_set_justify( GTK_LABEL( w ), GTK_JUSTIFY_LEFT );
1328 gtk_widget_show( w );
1332 auto frame = ui::Frame( "Reset Texture Names" );
1333 gtk_widget_show( frame );
1334 gtk_box_pack_start( GTK_BOX( vbox ), frame, FALSE, TRUE, 0 );
1336 auto table = ui::Table( 2, 3, TRUE );
1339 gtk_table_set_row_spacings( GTK_TABLE( table ), 5 );
1340 gtk_table_set_col_spacings( GTK_TABLE( table ), 5 );
1341 gtk_container_set_border_width( GTK_CONTAINER( table ), 5 );
1345 dlgTexReset.cbTexChange = ui::CheckButton( "Enabled" );
1346 dlgTexReset.cbTexChange.connect( "toggled", G_CALLBACK( dialog_button_callback_texreset_update ), NULL );
1347 gtk_widget_show( dlgTexReset.cbTexChange );
1348 gtk_table_attach( GTK_TABLE( table ), dlgTexReset.cbTexChange, 0, 1, 0, 1,
1349 (GtkAttachOptions) ( GTK_FILL ),
1350 (GtkAttachOptions) ( 0 ), 0, 0 );
1352 w = ui::Label( "Old Name: " );
1353 gtk_table_attach( GTK_TABLE( table ), w, 1, 2, 0, 1,
1354 (GtkAttachOptions) ( GTK_FILL ),
1355 (GtkAttachOptions) ( 0 ), 0, 0 );
1356 gtk_widget_show( w );
1358 dlgTexReset.editTexOld = ui::Entry( 256 );
1359 gtk_entry_set_text( GTK_ENTRY( dlgTexReset.editTexOld ), rs->textureName );
1360 gtk_table_attach( GTK_TABLE( table ), dlgTexReset.editTexOld, 2, 3, 0, 1,
1361 (GtkAttachOptions) ( GTK_FILL ),
1362 (GtkAttachOptions) ( 0 ), 0, 0 );
1363 gtk_widget_show( dlgTexReset.editTexOld );
1365 w = ui::Label( "New Name: " );
1366 gtk_table_attach( GTK_TABLE( table ), w, 1, 2, 1, 2,
1367 (GtkAttachOptions) ( GTK_FILL ),
1368 (GtkAttachOptions) ( 0 ), 0, 0 );
1369 gtk_widget_show( w );
1371 dlgTexReset.editTexNew = ui::Entry( 256 );
1372 gtk_entry_set_text( GTK_ENTRY( dlgTexReset.editTexNew ), rs->textureName );
1373 gtk_table_attach( GTK_TABLE( table ), dlgTexReset.editTexNew, 2, 3, 1, 2,
1374 (GtkAttachOptions) ( GTK_FILL ),
1375 (GtkAttachOptions) ( 0 ), 0, 0 );
1376 gtk_widget_show( dlgTexReset.editTexNew );
1380 frame = ui::Frame( "Reset Scales" );
1381 gtk_widget_show( frame );
1382 gtk_box_pack_start( GTK_BOX( vbox ), frame, FALSE, TRUE, 0 );
1384 table = ui::Table( 2, 3, TRUE );
1387 gtk_table_set_row_spacings( GTK_TABLE( table ), 5 );
1388 gtk_table_set_col_spacings( GTK_TABLE( table ), 5 );
1389 gtk_container_set_border_width( GTK_CONTAINER( table ), 5 );
1393 dlgTexReset.cbScaleHor = ui::CheckButton( "Enabled" );
1394 dlgTexReset.cbScaleHor.connect( "toggled", G_CALLBACK( dialog_button_callback_texreset_update ), NULL );
1395 gtk_widget_show( dlgTexReset.cbScaleHor );
1396 gtk_table_attach( GTK_TABLE( table ), dlgTexReset.cbScaleHor, 0, 1, 0, 1,
1397 (GtkAttachOptions) ( GTK_FILL ),
1398 (GtkAttachOptions) ( 0 ), 0, 0 );
1400 w = ui::Label( "New Horizontal Scale: " );
1401 gtk_table_attach( GTK_TABLE( table ), w, 1, 2, 0, 1,
1402 (GtkAttachOptions) ( GTK_FILL ),
1403 (GtkAttachOptions) ( 0 ), 0, 0 );
1404 gtk_widget_show( w );
1406 dlgTexReset.editScaleHor = ui::Entry( 256 );
1407 gtk_entry_set_text( GTK_ENTRY( dlgTexReset.editScaleHor ), "0.5" );
1408 gtk_table_attach( GTK_TABLE( table ), dlgTexReset.editScaleHor, 2, 3, 0, 1,
1409 (GtkAttachOptions) ( GTK_FILL ),
1410 (GtkAttachOptions) ( 0 ), 0, 0 );
1411 gtk_widget_show( dlgTexReset.editScaleHor );
1414 dlgTexReset.cbScaleVert = ui::CheckButton( "Enabled" );
1415 dlgTexReset.cbScaleVert.connect( "toggled", G_CALLBACK( dialog_button_callback_texreset_update ), NULL );
1416 gtk_widget_show( dlgTexReset.cbScaleVert );
1417 gtk_table_attach( GTK_TABLE( table ), dlgTexReset.cbScaleVert, 0, 1, 1, 2,
1418 (GtkAttachOptions) ( GTK_FILL ),
1419 (GtkAttachOptions) ( 0 ), 0, 0 );
1421 w = ui::Label( "New Vertical Scale: " );
1422 gtk_table_attach( GTK_TABLE( table ), w, 1, 2, 1, 2,
1423 (GtkAttachOptions) ( GTK_FILL ),
1424 (GtkAttachOptions) ( 0 ), 0, 0 );
1425 gtk_widget_show( w );
1427 dlgTexReset.editScaleVert = ui::Entry( 256 );
1428 gtk_entry_set_text( GTK_ENTRY( dlgTexReset.editScaleVert ), "0.5" );
1429 gtk_table_attach( GTK_TABLE( table ), dlgTexReset.editScaleVert, 2, 3, 1, 2,
1430 (GtkAttachOptions) ( GTK_FILL ),
1431 (GtkAttachOptions) ( 0 ), 0, 0 );
1432 gtk_widget_show( dlgTexReset.editScaleVert );
1436 frame = ui::Frame( "Reset Shift" );
1437 gtk_widget_show( frame );
1438 gtk_box_pack_start( GTK_BOX( vbox ), frame, FALSE, TRUE, 0 );
1440 table = ui::Table( 2, 3, TRUE );
1443 gtk_table_set_row_spacings( GTK_TABLE( table ), 5 );
1444 gtk_table_set_col_spacings( GTK_TABLE( table ), 5 );
1445 gtk_container_set_border_width( GTK_CONTAINER( table ), 5 );
1449 dlgTexReset.cbShiftHor = ui::CheckButton( "Enabled" );
1450 dlgTexReset.cbShiftHor.connect( "toggled", G_CALLBACK( dialog_button_callback_texreset_update ), NULL );
1451 gtk_widget_show( dlgTexReset.cbShiftHor );
1452 gtk_table_attach( GTK_TABLE( table ), dlgTexReset.cbShiftHor, 0, 1, 0, 1,
1453 (GtkAttachOptions) ( GTK_FILL ),
1454 (GtkAttachOptions) ( 0 ), 0, 0 );
1456 w = ui::Label( "New Horizontal Shift: " );
1457 gtk_table_attach( GTK_TABLE( table ), w, 1, 2, 0, 1,
1458 (GtkAttachOptions) ( GTK_FILL ),
1459 (GtkAttachOptions) ( 0 ), 0, 0 );
1460 gtk_widget_show( w );
1462 dlgTexReset.editShiftHor = ui::Entry( 256 );
1463 gtk_entry_set_text( GTK_ENTRY( dlgTexReset.editShiftHor ), "0" );
1464 gtk_table_attach( GTK_TABLE( table ), dlgTexReset.editShiftHor, 2, 3, 0, 1,
1465 (GtkAttachOptions) ( GTK_FILL ),
1466 (GtkAttachOptions) ( 0 ), 0, 0 );
1467 gtk_widget_show( dlgTexReset.editShiftHor );
1470 dlgTexReset.cbShiftVert = ui::CheckButton( "Enabled" );
1471 dlgTexReset.cbShiftVert.connect( "toggled", G_CALLBACK( dialog_button_callback_texreset_update ), NULL );
1472 gtk_widget_show( dlgTexReset.cbShiftVert );
1473 gtk_table_attach( GTK_TABLE( table ), dlgTexReset.cbShiftVert, 0, 1, 1, 2,
1474 (GtkAttachOptions) ( GTK_FILL ),
1475 (GtkAttachOptions) ( 0 ), 0, 0 );
1477 w = ui::Label( "New Vertical Shift: " );
1478 gtk_table_attach( GTK_TABLE( table ), w, 1, 2, 1, 2,
1479 (GtkAttachOptions) ( GTK_FILL ),
1480 (GtkAttachOptions) ( 0 ), 0, 0 );
1481 gtk_widget_show( w );
1483 dlgTexReset.editShiftVert = ui::Entry( 256 );
1484 gtk_entry_set_text( GTK_ENTRY( dlgTexReset.editShiftVert ), "0" );
1485 gtk_table_attach( GTK_TABLE( table ), dlgTexReset.editShiftVert, 2, 3, 1, 2,
1486 (GtkAttachOptions) ( GTK_FILL ),
1487 (GtkAttachOptions) ( 0 ), 0, 0 );
1488 gtk_widget_show( dlgTexReset.editShiftVert );
1492 frame = ui::Frame( "Reset Rotation" );
1493 gtk_widget_show( frame );
1494 gtk_box_pack_start( GTK_BOX( vbox ), frame, FALSE, TRUE, 0 );
1496 table = ui::Table( 1, 3, TRUE );
1499 gtk_table_set_row_spacings( GTK_TABLE( table ), 5 );
1500 gtk_table_set_col_spacings( GTK_TABLE( table ), 5 );
1501 gtk_container_set_border_width( GTK_CONTAINER( table ), 5 );
1505 dlgTexReset.cbRotation = ui::CheckButton( "Enabled" );
1506 gtk_widget_show( dlgTexReset.cbRotation );
1507 gtk_table_attach( GTK_TABLE( table ), dlgTexReset.cbRotation, 0, 1, 0, 1,
1508 (GtkAttachOptions) ( GTK_FILL ),
1509 (GtkAttachOptions) ( 0 ), 0, 0 );
1511 w = ui::Label( "New Rotation Value: " );
1512 gtk_table_attach( GTK_TABLE( table ), w, 1, 2, 0, 1,
1513 (GtkAttachOptions) ( GTK_FILL ),
1514 (GtkAttachOptions) ( 0 ), 0, 0 );
1515 gtk_widget_show( w );
1517 dlgTexReset.editRotation = ui::Entry( 256 );
1518 gtk_entry_set_text( GTK_ENTRY( dlgTexReset.editRotation ), "0" );
1519 gtk_table_attach( GTK_TABLE( table ), dlgTexReset.editRotation, 2, 3, 0, 1,
1520 (GtkAttachOptions) ( GTK_FILL ),
1521 (GtkAttachOptions) ( 0 ), 0, 0 );
1522 gtk_widget_show( dlgTexReset.editRotation );
1526 hbox = ui::HBox( FALSE, 10 );
1527 gtk_box_pack_start( GTK_BOX( vbox ), hbox, FALSE, FALSE, 2 );
1528 gtk_widget_show( hbox );
1532 w = ui::Button( "Use Selected Brushes" );
1533 gtk_box_pack_start( GTK_BOX( hbox ), w, TRUE, TRUE, 0 );
1534 w.connect( "clicked", G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( eIDOK ) );
1536 gtk_widget_set_can_default( w, true );
1537 gtk_widget_grab_default( w );
1538 gtk_widget_show( w );
1540 w = ui::Button( "Use All Brushes" );
1541 gtk_box_pack_start( GTK_BOX( hbox ), w, TRUE, TRUE, 0 );
1542 w.connect( "clicked", G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( eIDYES ) );
1543 gtk_widget_show( w );
1545 w = ui::Button( "Cancel" );
1546 gtk_box_pack_start( GTK_BOX( hbox ), w, TRUE, TRUE, 0 );
1547 w.connect( "clicked", G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( eIDCANCEL ) );
1548 gtk_widget_show( w );
1555 gtk_window_set_position( GTK_WINDOW( window ),GTK_WIN_POS_CENTER );
1556 gtk_widget_show( window );
1557 gtk_grab_add( window );
1559 Update_TextureReseter();
1561 bool dialogError = TRUE;
1562 while ( dialogError )
1566 gtk_main_iteration();
1568 dialogError = FALSE;
1570 if ( ret != eIDCANCEL ) {
1571 rs->bResetRotation = gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( dlgTexReset.cbRotation ) );
1572 if ( rs->bResetRotation ) {
1573 if ( !ValidateTextInt( gtk_entry_get_text( GTK_ENTRY( dlgTexReset.editRotation ) ), "Rotation", &rs->rotation ) ) {
1578 rs->bResetScale[0] = gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( dlgTexReset.cbScaleHor ) );
1579 if ( rs->bResetScale[0] ) {
1580 if ( !ValidateTextFloat( gtk_entry_get_text( GTK_ENTRY( dlgTexReset.editScaleHor ) ), "Horizontal Scale", &rs->fScale[0] ) ) {
1585 rs->bResetScale[1] = gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( dlgTexReset.cbScaleVert ) );
1586 if ( rs->bResetScale[1] ) {
1587 if ( !ValidateTextFloat( gtk_entry_get_text( GTK_ENTRY( dlgTexReset.editScaleVert ) ), "Vertical Scale", &rs->fScale[1] ) ) {
1592 rs->bResetShift[0] = gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( dlgTexReset.cbShiftHor ) );
1593 if ( rs->bResetShift[0] ) {
1594 if ( !ValidateTextFloat( gtk_entry_get_text( GTK_ENTRY( dlgTexReset.editShiftHor ) ), "Horizontal Shift", &rs->fShift[0] ) ) {
1599 rs->bResetShift[1] = gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( dlgTexReset.cbShiftVert ) );
1600 if ( rs->bResetShift[1] ) {
1601 if ( !ValidateTextFloat( gtk_entry_get_text( GTK_ENTRY( dlgTexReset.editShiftVert ) ), "Vertical Shift", &rs->fShift[1] ) ) {
1606 rs->bResetTextureName = gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( dlgTexReset.cbTexChange ) );
1607 if ( rs->bResetTextureName ) {
1608 strcpy( rs->textureName, gtk_entry_get_text( GTK_ENTRY( dlgTexReset.editTexOld ) ) );
1609 strcpy( rs->newTextureName, gtk_entry_get_text( GTK_ENTRY( dlgTexReset.editTexNew ) ) );
1614 gtk_grab_remove( window );
1615 gtk_widget_destroy( window );
1620 EMessageBoxReturn DoTrainThingBox( TrainThingRS* rs ){
1625 ui::Widget radiusX, radiusY;
1626 ui::Widget angleStart, angleEnd;
1627 ui::Widget heightStart, heightEnd;
1628 ui::Widget numPoints;
1630 EMessageBoxReturn ret;
1633 auto window = ui::Window( ui::window_type::TOP );
1635 window.connect( "delete_event", G_CALLBACK( dialog_delete_callback ), NULL );
1636 window.connect( "destroy", G_CALLBACK( gtk_widget_destroy ), NULL );
1638 gtk_window_set_title( GTK_WINDOW( window ), "Train Thing" );
1639 gtk_container_set_border_width( GTK_CONTAINER( window ), 10 );
1641 g_object_set_data( G_OBJECT( window ), "loop", &loop );
1642 g_object_set_data( G_OBJECT( window ), "ret", &ret );
1644 gtk_widget_realize( window );
1646 auto vbox = ui::VBox( FALSE, 10 );
1652 hbox = ui::HBox( FALSE, 10 );
1653 gtk_box_pack_start( GTK_BOX( vbox ), hbox, FALSE, FALSE, 2 );
1654 gtk_widget_show( hbox );
1658 auto frame = ui::Frame( "Radii" );
1659 gtk_widget_show( frame );
1660 gtk_box_pack_start( GTK_BOX( vbox ), frame, FALSE, TRUE, 0 );
1662 auto table = ui::Table( 2, 3, TRUE );
1665 gtk_table_set_row_spacings( GTK_TABLE( table ), 5 );
1666 gtk_table_set_col_spacings( GTK_TABLE( table ), 5 );
1667 gtk_container_set_border_width( GTK_CONTAINER( table ), 5 );
1671 w = ui::Label( "X: " );
1672 gtk_table_attach( GTK_TABLE( table ), w, 0, 1, 0, 1,
1673 (GtkAttachOptions) ( GTK_FILL ),
1674 (GtkAttachOptions) ( 0 ), 0, 0 );
1675 gtk_widget_show( w );
1677 radiusX = ui::Entry( 256 );
1678 gtk_entry_set_text( GTK_ENTRY( radiusX ), "100" );
1679 gtk_table_attach( GTK_TABLE( table ), radiusX, 1, 2, 0, 1,
1680 (GtkAttachOptions) ( GTK_FILL ),
1681 (GtkAttachOptions) ( 0 ), 0, 0 );
1682 gtk_widget_show( radiusX );
1686 w = ui::Label( "Y: " );
1687 gtk_table_attach( GTK_TABLE( table ), w, 0, 1, 1, 2,
1688 (GtkAttachOptions) ( GTK_FILL ),
1689 (GtkAttachOptions) ( 0 ), 0, 0 );
1690 gtk_widget_show( w );
1692 radiusY = ui::Entry( 256 );
1693 gtk_entry_set_text( GTK_ENTRY( radiusY ), "100" );
1694 gtk_table_attach( GTK_TABLE( table ), radiusY, 1, 2, 1, 2,
1695 (GtkAttachOptions) ( GTK_FILL ),
1696 (GtkAttachOptions) ( 0 ), 0, 0 );
1697 gtk_widget_show( radiusY );
1701 frame = ui::Frame( "Angles" );
1702 gtk_widget_show( frame );
1703 gtk_box_pack_start( GTK_BOX( vbox ), frame, FALSE, TRUE, 0 );
1705 table = ui::Table( 2, 3, TRUE );
1708 gtk_table_set_row_spacings( GTK_TABLE( table ), 5 );
1709 gtk_table_set_col_spacings( GTK_TABLE( table ), 5 );
1710 gtk_container_set_border_width( GTK_CONTAINER( table ), 5 );
1714 w = ui::Label( "Start: " );
1715 gtk_table_attach( GTK_TABLE( table ), w, 0, 1, 0, 1,
1716 (GtkAttachOptions) ( GTK_FILL ),
1717 (GtkAttachOptions) ( 0 ), 0, 0 );
1718 gtk_widget_show( w );
1720 angleStart = ui::Entry( 256 );
1721 gtk_entry_set_text( GTK_ENTRY( angleStart ), "0" );
1722 gtk_table_attach( GTK_TABLE( table ), angleStart, 1, 2, 0, 1,
1723 (GtkAttachOptions) ( GTK_FILL ),
1724 (GtkAttachOptions) ( 0 ), 0, 0 );
1725 gtk_widget_show( angleStart );
1729 w = ui::Label( "End: " );
1730 gtk_table_attach( GTK_TABLE( table ), w, 0, 1, 1, 2,
1731 (GtkAttachOptions) ( GTK_FILL ),
1732 (GtkAttachOptions) ( 0 ), 0, 0 );
1733 gtk_widget_show( w );
1735 angleEnd = ui::Entry( 256 );
1736 gtk_entry_set_text( GTK_ENTRY( angleEnd ), "90" );
1737 gtk_table_attach( GTK_TABLE( table ), angleEnd, 1, 2, 1, 2,
1738 (GtkAttachOptions) ( GTK_FILL ),
1739 (GtkAttachOptions) ( 0 ), 0, 0 );
1740 gtk_widget_show( angleEnd );
1743 frame = ui::Frame( "Height" );
1744 gtk_widget_show( frame );
1745 gtk_box_pack_start( GTK_BOX( vbox ), frame, FALSE, TRUE, 0 );
1747 table = ui::Table( 2, 3, TRUE );
1750 gtk_table_set_row_spacings( GTK_TABLE( table ), 5 );
1751 gtk_table_set_col_spacings( GTK_TABLE( table ), 5 );
1752 gtk_container_set_border_width( GTK_CONTAINER( table ), 5 );
1756 w = ui::Label( "Start: " );
1757 gtk_table_attach( GTK_TABLE( table ), w, 0, 1, 0, 1,
1758 (GtkAttachOptions) ( GTK_FILL ),
1759 (GtkAttachOptions) ( 0 ), 0, 0 );
1760 gtk_widget_show( w );
1762 heightStart = ui::Entry( 256 );
1763 gtk_entry_set_text( GTK_ENTRY( heightStart ), "0" );
1764 gtk_table_attach( GTK_TABLE( table ), heightStart, 1, 2, 0, 1,
1765 (GtkAttachOptions) ( GTK_FILL ),
1766 (GtkAttachOptions) ( 0 ), 0, 0 );
1767 gtk_widget_show( heightStart );
1771 w = ui::Label( "End: " );
1772 gtk_table_attach( GTK_TABLE( table ), w, 0, 1, 1, 2,
1773 (GtkAttachOptions) ( GTK_FILL ),
1774 (GtkAttachOptions) ( 0 ), 0, 0 );
1775 gtk_widget_show( w );
1777 heightEnd = ui::Entry( 256 );
1778 gtk_entry_set_text( GTK_ENTRY( heightEnd ), "0" );
1779 gtk_table_attach( GTK_TABLE( table ), heightEnd, 1, 2, 1, 2,
1780 (GtkAttachOptions) ( GTK_FILL ),
1781 (GtkAttachOptions) ( 0 ), 0, 0 );
1782 gtk_widget_show( heightEnd );
1786 frame = ui::Frame( "Points" );
1787 gtk_widget_show( frame );
1788 gtk_box_pack_start( GTK_BOX( vbox ), frame, FALSE, TRUE, 0 );
1790 table = ui::Table( 2, 3, TRUE );
1793 gtk_table_set_row_spacings( GTK_TABLE( table ), 5 );
1794 gtk_table_set_col_spacings( GTK_TABLE( table ), 5 );
1795 gtk_container_set_border_width( GTK_CONTAINER( table ), 5 );
1799 w = ui::Label( "Number: " );
1800 gtk_table_attach( GTK_TABLE( table ), w, 0, 1, 0, 1,
1801 (GtkAttachOptions) ( GTK_FILL ),
1802 (GtkAttachOptions) ( 0 ), 0, 0 );
1803 gtk_widget_show( w );
1805 numPoints = ui::Entry( 256 );
1806 gtk_entry_set_text( GTK_ENTRY( numPoints ), "0" );
1807 gtk_table_attach( GTK_TABLE( table ), numPoints, 1, 2, 0, 1,
1808 (GtkAttachOptions) ( GTK_FILL ),
1809 (GtkAttachOptions) ( 0 ), 0, 0 );
1810 gtk_widget_show( numPoints );
1813 hbox = ui::HBox( FALSE, 10 );
1814 gtk_box_pack_start( GTK_BOX( vbox ), hbox, FALSE, FALSE, 2 );
1815 gtk_widget_show( hbox );
1819 w = ui::Button( "Ok" );
1820 gtk_box_pack_start( GTK_BOX( hbox ), w, TRUE, TRUE, 0 );
1821 w.connect( "clicked", G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( eIDOK ) );
1823 gtk_widget_set_can_default( w, true );
1824 gtk_widget_grab_default( w );
1825 gtk_widget_show( w );
1827 w = ui::Button( "Cancel" );
1828 gtk_box_pack_start( GTK_BOX( hbox ), w, TRUE, TRUE, 0 );
1829 w.connect( "clicked", G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( eIDCANCEL ) );
1830 gtk_widget_show( w );
1837 gtk_window_set_position( GTK_WINDOW( window ),GTK_WIN_POS_CENTER );
1838 gtk_widget_show( window );
1839 gtk_grab_add( window );
1841 bool dialogError = TRUE;
1842 while ( dialogError )
1846 gtk_main_iteration();
1848 dialogError = FALSE;
1850 if ( ret != eIDCANCEL ) {
1851 if ( !ValidateTextFloat( gtk_entry_get_text( GTK_ENTRY( radiusX ) ), "Radius (X)", &rs->fRadiusX ) ) {
1855 if ( !ValidateTextFloat( gtk_entry_get_text( GTK_ENTRY( radiusY ) ), "Radius (Y)", &rs->fRadiusY ) ) {
1859 if ( !ValidateTextFloat( gtk_entry_get_text( GTK_ENTRY( angleStart ) ), "Angle (Start)", &rs->fStartAngle ) ) {
1863 if ( !ValidateTextFloat( gtk_entry_get_text( GTK_ENTRY( angleEnd ) ), "Angle (End)", &rs->fEndAngle ) ) {
1867 if ( !ValidateTextFloat( gtk_entry_get_text( GTK_ENTRY( heightStart ) ), "Height (Start)", &rs->fStartHeight ) ) {
1871 if ( !ValidateTextFloat( gtk_entry_get_text( GTK_ENTRY( heightEnd ) ), "Height (End)", &rs->fEndHeight ) ) {
1875 if ( !ValidateTextInt( gtk_entry_get_text( GTK_ENTRY( numPoints ) ), "Num Points", &rs->iNumPoints ) ) {
1881 gtk_grab_remove( window );
1882 gtk_widget_destroy( window );
1887 // add a simple input for the MakeChain thing..
1888 EMessageBoxReturn DoMakeChainBox( MakeChainRS* rs ){
1890 ui::Entry textlinkNum, textlinkName;
1891 EMessageBoxReturn ret;
1894 const char *text = "Please set a value in the boxes below and press 'OK' to make a chain";
1896 auto window = ui::Window( ui::window_type::TOP );
1898 window.connect( "delete_event", G_CALLBACK( dialog_delete_callback ), NULL );
1899 window.connect( "destroy", G_CALLBACK( gtk_widget_destroy ), NULL );
1901 gtk_window_set_title( GTK_WINDOW( window ), "Make Chain" );
1903 gtk_container_set_border_width( GTK_CONTAINER( window ), 10 );
1905 g_object_set_data( G_OBJECT( window ), "loop", &loop );
1906 g_object_set_data( G_OBJECT( window ), "ret", &ret );
1908 gtk_widget_realize( window );
1911 auto vbox = ui::VBox( FALSE, 10 );
1915 auto hbox = ui::HBox( FALSE, 10 );
1919 // dunno if you want this text or not ...
1920 w = ui::Label( text );
1921 gtk_box_pack_start( GTK_BOX( hbox ), w, FALSE, FALSE, 0 );
1922 gtk_widget_show( w );
1924 w = ui::Widget(gtk_hseparator_new());
1925 gtk_box_pack_start( GTK_BOX( vbox ), w, FALSE, FALSE, 0 );
1926 gtk_widget_show( w );
1928 // ------------------------- //
1931 hbox = ui::HBox( FALSE, 10 );
1932 gtk_box_pack_start( GTK_BOX( vbox ), hbox, FALSE, FALSE, 0 );
1933 gtk_widget_show( hbox );
1935 textlinkNum = ui::Entry( 256 );
1936 gtk_box_pack_start( GTK_BOX( hbox ), textlinkNum, FALSE, FALSE, 1 );
1937 gtk_widget_show( textlinkNum );
1939 w = ui::Label( "Number of elements in chain" );
1940 gtk_box_pack_start( GTK_BOX( hbox ), w, FALSE, FALSE, 1 );
1941 gtk_widget_show( w );
1943 // -------------------------- //
1945 hbox = ui::HBox( FALSE, 10 );
1946 gtk_box_pack_start( GTK_BOX( vbox ), hbox, FALSE, FALSE, 0 );
1947 gtk_widget_show( hbox );
1949 textlinkName = ui::Entry( 256 );
1950 gtk_box_pack_start( GTK_BOX( hbox ), textlinkName, FALSE, FALSE, 0 );
1951 gtk_widget_show( textlinkName );
1953 w = ui::Label( "Basename for chain's targetnames." );
1954 gtk_box_pack_start( GTK_BOX( hbox ), w, FALSE, FALSE, 1 );
1955 gtk_widget_show( w );
1958 w = ui::Button( "OK" );
1959 gtk_box_pack_start( GTK_BOX( hbox ), w, TRUE, TRUE, 0 );
1960 w.connect( "clicked", G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( eIDOK ) );
1961 gtk_widget_set_can_default( w, true );
1962 gtk_widget_grab_default( w );
1963 gtk_widget_show( w );
1965 w = ui::Button( "Cancel" );
1966 gtk_box_pack_start( GTK_BOX( hbox ), w, TRUE, TRUE, 0 );
1967 w.connect( "clicked", G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( eIDCANCEL ) );
1968 gtk_widget_show( w );
1972 gtk_window_set_position( GTK_WINDOW( window ),GTK_WIN_POS_CENTER );
1973 gtk_widget_show( window );
1974 gtk_grab_add( window );
1976 bool dialogError = TRUE;
1977 while ( dialogError )
1981 gtk_main_iteration();
1983 dialogError = FALSE;
1985 if ( ret == eIDOK ) {
1986 strcpy( rs->linkName, gtk_entry_get_text( textlinkName ) );
1987 if ( !ValidateTextInt( gtk_entry_get_text( textlinkNum ), "Elements", &rs->linkNum ) ) {
1993 gtk_grab_remove( window );
1994 gtk_widget_destroy( window );