#include <OptionsWindow.h>
Public Member Functions | |
| OptionsWindow (const int default_width=-1, const int default_height=-1, const int default_x_pos=-1, const int default_y_pos=-1) | |
| ~OptionsWindow () | |
| void | add_option_to_notebook (GtkWidget *description_table, GtkWidget *entry_table, GtkWidget *button_table, int row, String description, GtkWidget *entry, String entry_text, entry_t *info, button_t *buttons) |
| void | update_all_gtk_entries () |
| void | set_all_options () |
| GtkWidget * | get_window_p () |
Static Public Member Functions | |
| void | default_opts (GtkWidget *widget, class OptionsWindow *optionswindow_p) |
| void | load (GtkWidget *widget, class OptionsWindow *optionswindow_p) |
| void | save (GtkWidget *widget, class OptionsWindow *optionswindow_p) |
| void | save_def (GtkWidget *widget, class OptionsWindow *optionswindow_p) |
| void | apply (GtkWidget *widget, class OptionsWindow *optionswindow_p) |
| void | ok (GtkWidget *widget, class OptionsWindow *optionswindow_p) |
| void | cancel (GtkWidget *widget, class OptionsWindow *optionswindow_p) |
| void | delete_event_occured (GtkWidget *widget, GdkEvent *event, class OptionsWindow *optionswindow_p) |
| void | load_options (GtkWidget *widget, class OptionsWindow *optionswindow_p) |
| void | save_options (GtkWidget *widget, class OptionsWindow *optionswindow_p) |
| void | destroy_filesel (GtkWidget *widget, class OptionsWindow *optionswindow_p) |
| void | grab_windows (GtkWidget *widget, class OptionsWindow *optionswindow_p) |
| void | double_min (GtkWidget *widget, option_info_t< double > *option) |
| void | double_def (GtkWidget *widget, option_info_t< double > *option) |
| void | double_max (GtkWidget *widget, option_info_t< double > *option) |
| void | long_min (GtkWidget *widget, option_info_t< long > *option) |
| void | long_def (GtkWidget *widget, option_info_t< long > *option) |
| void | long_max (GtkWidget *widget, option_info_t< long > *option) |
| void | string_def (GtkWidget *widget, option_info_t< String > *option) |
Private Member Functions | |
| GtkWidget * | get_filesel () |
| void | set_filesel (GtkWidget *fs) |
Private Attributes | |
| GtkWidget * | window_p |
| GtkWidget * | filesel |
|
||||||||||||||||||||
|
Definition at line 42 of file OptionsWindow.cc. References _, add_option_to_notebook(), option_info_t< T >::datatype, delete_event_occured(), option_info_t< T >::entry, ENTRY_CHAR, ENTRY_DOUBLE, filesel, Options::get_all_double_options(), Options::get_all_long_options(), Options::get_all_string_options(), gpointer, grab_windows(), GtkWidget, hex2str(), option_info_t< T >::max_letters_in_entry, option_info_t< T >::min_value, option_info_t< T >::page, the_opts, and window_p. 00046 {
00047 // The window widget
00048
00049 window_p = gtk_window_new( GTK_WINDOW_TOPLEVEL );
00050 gtk_widget_set_name( window_p, "RTB Options" );
00051
00052 gtk_window_set_title( GTK_WINDOW( window_p ), _("Options") );
00053
00054 gtk_container_border_width( GTK_CONTAINER( window_p ), 12 );
00055
00056 if( default_width != -1 && default_height != -1 )
00057 gtk_widget_set_usize( window_p, default_width, default_height );
00058 if( default_x_pos != -1 && default_y_pos != -1 )
00059 gtk_widget_set_uposition( window_p, default_x_pos, default_y_pos );
00060
00061 gtk_signal_connect( GTK_OBJECT( window_p ), "delete_event",
00062 (GtkSignalFunc) OptionsWindow::delete_event_occured,
00063 (gpointer) this );
00064
00065 // Main box
00066
00067 GtkWidget* vbox = gtk_vbox_new( FALSE, 10 );
00068 gtk_container_add( GTK_CONTAINER( window_p ), vbox );
00069 gtk_widget_show( vbox );
00070
00071 // The notebook with all options
00072
00073 GtkWidget* notebook = gtk_notebook_new();
00074 gtk_notebook_set_tab_pos( GTK_NOTEBOOK( notebook ), GTK_POS_LEFT );
00075 gtk_box_pack_start( GTK_BOX( vbox ), notebook, TRUE, TRUE, 0 );
00076 gtk_widget_show( notebook );
00077
00078 const char* page_titles[LAST_PAGE] = { _("Environment"), _("Robot"), _("Shot"),
00079 _("Extras"), _("Time"), _("Window sizes"),
00080 _("Misc") };
00081
00082 option_info_t<double>* double_opts = the_opts.get_all_double_options();
00083 option_info_t<long>* long_opts = the_opts.get_all_long_options();
00084 option_info_t<String>* string_opts = the_opts.get_all_string_options();
00085
00086 for( int i=0; i < LAST_PAGE; i++ )
00087 {
00088 int number_of_options = 0;
00089 for( int opt=0; opt<LAST_DOUBLE_OPTION; opt++ )
00090 if( double_opts[opt].page == i )
00091 number_of_options++;
00092 for( int opt=0; opt<LAST_LONG_OPTION; opt++ )
00093 if( long_opts[opt].page == i )
00094 number_of_options++;
00095 for( int opt=0; opt<LAST_STRING_OPTION; opt++ )
00096 if( string_opts[opt].page == i )
00097 number_of_options++;
00098
00099 // Page Boxes
00100
00101 GtkWidget* page_vbox = gtk_vbox_new( FALSE, 10 );
00102 gtk_container_border_width( GTK_CONTAINER( page_vbox ), 10 );
00103 gtk_widget_show( page_vbox );
00104
00105 GtkWidget* page_hbox = gtk_hbox_new( FALSE, 10 );
00106 gtk_box_pack_start( GTK_BOX( page_vbox ), page_hbox,
00107 FALSE, FALSE, 0 );
00108 gtk_widget_show( page_hbox );
00109
00110 // Page tables
00111
00112 GtkWidget* description_table = gtk_table_new( number_of_options, 1, TRUE );
00113 GtkWidget* entry_table = gtk_table_new( number_of_options, 1, TRUE );
00114 GtkWidget* button_table = gtk_table_new( number_of_options, 3, TRUE );
00115 gtk_box_pack_start( GTK_BOX( page_hbox ), description_table, FALSE, TRUE, 0 );
00116 gtk_box_pack_start( GTK_BOX( page_hbox ), entry_table, TRUE, TRUE, 0 );
00117 gtk_box_pack_start( GTK_BOX( page_hbox ), button_table, FALSE, TRUE, 0 );
00118
00119 int row = -1;
00120
00121 for( int opt=0; opt<LAST_DOUBLE_OPTION; opt++ )
00122 if( double_opts[opt].page == i )
00123 {
00124 row++;
00125
00126 bool sign = false;
00127 if( double_opts[opt].min_value < 0.0 )
00128 sign = true;
00129
00130 entry_t* info = new entry_t( ENTRY_DOUBLE, sign );
00131
00132 double_opts[opt].entry =
00133 gtk_entry_new_with_max_length
00134 ( double_opts[opt].max_letters_in_entry );
00135
00136 struct button_t buttons[] = {
00137 { (String)_(" Min "), true, (GtkSignalFunc) OptionsWindow::double_min,
00138 (gpointer) &double_opts[opt] },
00139 { (String)_(" Def "), true, (GtkSignalFunc) OptionsWindow::double_def,
00140 (gpointer) &double_opts[opt] },
00141 { (String)_(" Max "), true, (GtkSignalFunc) OptionsWindow::double_max,
00142 (gpointer) &double_opts[opt] } };
00143
00144 add_option_to_notebook( description_table,
00145 entry_table, button_table,
00146 row, double_opts[opt].translated_label,
00147 double_opts[opt].entry,
00148 String( double_opts[opt].value ),
00149 info, buttons );
00150
00151 }
00152 for( int opt=0; opt<LAST_LONG_OPTION; opt++ )
00153 if( long_opts[opt].page == i )
00154 {
00155 row++;
00156
00157 bool sign = false;
00158 if( long_opts[opt].min_value < 0.0 )
00159 sign = true;
00160
00161 String entry_text;
00162 if( long_opts[opt].datatype == ENTRY_INT )
00163 entry_text = String( long_opts[opt].value );
00164 else if( long_opts[opt].datatype == ENTRY_HEX )
00165 entry_text = hex2str( long_opts[opt].value );
00166
00167 entry_t* info = new entry_t( long_opts[opt].datatype, sign );
00168
00169 long_opts[opt].entry =
00170 gtk_entry_new_with_max_length
00171 ( long_opts[opt].max_letters_in_entry );
00172
00173 struct button_t buttons[] = {
00174 { (String)_(" Min "), true, (GtkSignalFunc) OptionsWindow::long_min,
00175 (gpointer) &long_opts[opt] },
00176 { (String)_(" Def "), true, (GtkSignalFunc) OptionsWindow::long_def,
00177 (gpointer) &long_opts[opt] },
00178 { (String)_(" Max "), true, (GtkSignalFunc) OptionsWindow::long_max,
00179 (gpointer) &long_opts[opt] } };
00180
00181 add_option_to_notebook( description_table,
00182 entry_table, button_table,
00183 row, long_opts[opt].translated_label,
00184 long_opts[opt].entry,
00185 entry_text, info, buttons );
00186
00187 }
00188 for( int opt=0; opt<LAST_STRING_OPTION; opt++ )
00189 if( string_opts[opt].page == i )
00190 {
00191 row++;
00192
00193 entry_t* info = new entry_t( ENTRY_CHAR, false );
00194
00195 string_opts[opt].entry =
00196 gtk_entry_new_with_max_length
00197 ( string_opts[opt].max_letters_in_entry );
00198
00199 struct button_t buttons[] = {
00200 { (String)"" , false, (GtkSignalFunc) NULL, (gpointer) NULL },
00201 { (String)_(" Def "), true, (GtkSignalFunc) OptionsWindow::string_def,
00202 (gpointer) &string_opts[opt] },
00203 { (String)"" , false, (GtkSignalFunc) NULL, (gpointer) NULL } };
00204
00205 add_option_to_notebook( description_table,
00206 entry_table, button_table,
00207 row, string_opts[opt].translated_label,
00208 string_opts[opt].entry,
00209 string_opts[opt].value,
00210 info, buttons );
00211
00212 }
00213 gtk_table_set_row_spacings( GTK_TABLE( description_table ) , 10 );
00214 gtk_table_set_col_spacings( GTK_TABLE( description_table ) , 10 );
00215 gtk_table_set_row_spacings( GTK_TABLE( entry_table ) , 10 );
00216 gtk_table_set_col_spacings( GTK_TABLE( entry_table ) , 10 );
00217 gtk_table_set_row_spacings( GTK_TABLE( button_table ) , 10 );
00218 gtk_table_set_col_spacings( GTK_TABLE( button_table ) , 10 );
00219 gtk_widget_show( description_table );
00220 gtk_widget_show( entry_table );
00221 gtk_widget_show( button_table );
00222
00223 if( i == PAGE_SIZE_OF_WINDOWS )
00224 {
00225 GtkWidget* grab_button = gtk_button_new_with_label
00226 ( _(" Grab sizes and positions from present windows ") );
00227 gtk_signal_connect( GTK_OBJECT( grab_button ), "clicked",
00228 (GtkSignalFunc) OptionsWindow::grab_windows, this );
00229 gtk_box_pack_start( GTK_BOX( page_vbox ), grab_button, FALSE, FALSE, 0 );
00230 gtk_widget_show( grab_button );
00231 }
00232
00233 GtkWidget* label = gtk_label_new( page_titles[i] );
00234 gtk_widget_show( label );
00235 gtk_notebook_append_page( GTK_NOTEBOOK( notebook ),
00236 page_vbox, label );
00237 }
00238
00239 // Lower buttons
00240
00241 GtkWidget* hbox = gtk_hbox_new( FALSE, 10 );
00242 gtk_box_pack_start( GTK_BOX( vbox ), hbox, FALSE, FALSE, 0 );
00243 gtk_widget_show( hbox );
00244
00245 struct button_t buttons[] = {
00246 { (String)_(" Default "), true, (GtkSignalFunc) OptionsWindow::default_opts,
00247 (gpointer) this },
00248 { (String)_(" Load options "), true, (GtkSignalFunc) OptionsWindow::load,
00249 (gpointer) this },
00250 { (String)_(" Save options "), true, (GtkSignalFunc) OptionsWindow::save,
00251 (gpointer) this },
00252 { (String)_(" Save as default "), true, (GtkSignalFunc) OptionsWindow::save_def,
00253 (gpointer) this },
00254 { (String)_(" Apply "), true, (GtkSignalFunc) OptionsWindow::apply,
00255 (gpointer) this },
00256 { (String)_(" Ok "), true, (GtkSignalFunc) OptionsWindow::ok,
00257 (gpointer) this },
00258 { (String)_(" Cancel "), true, (GtkSignalFunc) OptionsWindow::cancel,
00259 (gpointer) this } };
00260
00261 for( int i=0; i<7; i++ )
00262 {
00263 GtkWidget* button_w =
00264 gtk_button_new_with_label( buttons[i].label.chars() );
00265 gtk_signal_connect( GTK_OBJECT( button_w ), "clicked",
00266 buttons[i].func, buttons[i].data );
00267 gtk_box_pack_start( GTK_BOX( hbox ), button_w, TRUE,TRUE, 0 );
00268 gtk_widget_show( button_w );
00269 }
00270
00271 gtk_widget_show( window_p );
00272 filesel = NULL;
00273 }
|
Here is the call graph for this function:

|
|
Definition at line 275 of file OptionsWindow.cc. References window_p. 00276 {
00277 gtk_widget_destroy( window_p );
00278 }
|
|
||||||||||||||||||||||||||||||||||||||||
|
Definition at line 281 of file OptionsWindow.cc. References String::chars(), entry_handler(), GtkWidget, and OptionsWindow::button_t::used. Referenced by OptionsWindow(). 00289 {
00290 GtkWidget* label =
00291 gtk_label_new( description.chars() );
00292 gtk_table_attach_defaults( GTK_TABLE( description_table ),
00293 label, 0, 1, row, row + 1 );
00294 gtk_widget_show( label );
00295
00296 gtk_signal_connect( GTK_OBJECT( entry ), "changed",
00297 (GtkSignalFunc) entry_handler, info);
00298 gtk_entry_set_text( GTK_ENTRY( entry ), entry_text.chars() );
00299 gtk_widget_set_usize( entry, 112, 22 );
00300 gtk_table_attach_defaults( GTK_TABLE( entry_table ),
00301 entry, 0, 1, row, row + 1 );
00302 gtk_widget_show( entry );
00303
00304 GtkWidget* button_w;
00305 for( int i=0; i<3; i++ )
00306 if( buttons[i].used )
00307 {
00308 button_w = gtk_button_new_with_label( buttons[i].label.chars() );
00309 gtk_signal_connect( GTK_OBJECT( button_w ), "clicked",
00310 buttons[i].func, buttons[i].data );
00311 gtk_table_attach_defaults( GTK_TABLE( button_table ), button_w,
00312 i, i+1, row, row+1 );
00313 gtk_widget_show( button_w );
00314 }
00315 }
|
Here is the call graph for this function:

|
||||||||||||
|
Definition at line 507 of file OptionsWindow.cc. 00509 {
00510 optionswindow_p->set_all_options();
00511 }
|
|
||||||||||||
|
Definition at line 522 of file OptionsWindow.cc. References Options::close_optionswindow(), and the_opts. 00524 {
00525 the_opts.close_optionswindow();
00526 }
|
Here is the call graph for this function:

|
||||||||||||
|
Definition at line 406 of file OptionsWindow.cc. References option_info_t< T >::default_value, Options::get_all_double_options(), Options::get_all_long_options(), Options::get_all_string_options(), the_opts, and option_info_t< T >::value. 00408 {
00409 option_info_t<double>* double_opts = the_opts.get_all_double_options();
00410 option_info_t<long>* long_opts = the_opts.get_all_long_options();
00411 option_info_t<String>* string_opts = the_opts.get_all_string_options();
00412
00413 for(int i=0;i<LAST_DOUBLE_OPTION;i++)
00414 double_opts[i].value = double_opts[i].default_value;
00415 for(int i=0;i<LAST_LONG_OPTION;i++)
00416 long_opts[i].value = long_opts[i].default_value;
00417 for(int i=0;i<LAST_STRING_OPTION;i++)
00418 string_opts[i].value = string_opts[i].default_value;
00419 optionswindow_p->update_all_gtk_entries();
00420 }
|
Here is the call graph for this function:

|
||||||||||||||||
|
Definition at line 529 of file OptionsWindow.cc. References Options::close_optionswindow(), and the_opts. Referenced by OptionsWindow(). 00531 {
00532 the_opts.close_optionswindow();
00533 }
|
Here is the call graph for this function:

|
||||||||||||
|
Definition at line 492 of file OptionsWindow.cc. Referenced by load(), load_options(), save(), and save_options(). 00494 {
00495 gtk_widget_destroy( optionswindow_p->get_filesel() );
00496 optionswindow_p->set_filesel( NULL );
00497 }
|
|
||||||||||||
|
Definition at line 619 of file OptionsWindow.cc. References option_info_t< T >::default_value, and option_info_t< T >::entry. 00621 {
00622 gtk_entry_set_text( GTK_ENTRY( option->entry ),
00623 String( option->default_value ).chars() );
00624 }
|
|
||||||||||||
|
Definition at line 627 of file OptionsWindow.cc. References option_info_t< T >::entry, and option_info_t< T >::max_value. 00629 {
00630 gtk_entry_set_text( GTK_ENTRY( option->entry ),
00631 String( option->max_value ).chars() );
00632 }
|
|
||||||||||||
|
Definition at line 611 of file OptionsWindow.cc. References option_info_t< T >::entry, and option_info_t< T >::min_value. 00613 {
00614 gtk_entry_set_text( GTK_ENTRY( option->entry ),
00615 String( option->min_value ).chars() );
00616 }
|
|
|
Definition at line 113 of file OptionsWindow.h. References GtkWidget. 00113 { return filesel; }
|
|
|
Definition at line 110 of file OptionsWindow.h. References GtkWidget. 00110 { return window_p; }
|
|
||||||||||||
|
Definition at line 536 of file OptionsWindow.cc. References controlwindow_p, Options::get_all_long_options(), Gui::get_arenawindow_p(), Gui::get_messagewindow_p(), Gui::get_scorewindow_p(), Gui::get_statisticswindow_p(), StatisticsWindow::get_window_p(), ScoreWindow::get_window_p(), MessageWindow::get_window_p(), ControlWindow::get_window_p(), ArenaWindow::get_window_p(), Gui::is_arenawindow_up(), Gui::is_messagewindow_up(), Gui::is_scorewindow_up(), Gui::is_statisticswindow_up(), the_gui, the_opts, and option_info_t< T >::value. Referenced by OptionsWindow(). 00538 {
00539 option_info_t<long>* long_opts = the_opts.get_all_long_options();
00540 if( the_gui.is_arenawindow_up() )
00541 {
00542 ArenaWindow* aw_p = the_gui.get_arenawindow_p();
00543 int width, height;
00544 int xpos, ypos;
00545 gdk_window_get_size( aw_p->get_window_p()->window,
00546 &width, &height );
00547 gdk_window_get_root_origin( aw_p->get_window_p()->window,
00548 &xpos, &ypos );
00549
00550 long_opts[OPTION_ARENA_WINDOW_SIZE_X].value = width;
00551 long_opts[OPTION_ARENA_WINDOW_SIZE_Y].value = height;
00552 long_opts[OPTION_ARENA_WINDOW_POS_X].value = xpos;
00553 long_opts[OPTION_ARENA_WINDOW_POS_Y].value = ypos;
00554 optionswindow_p->update_all_gtk_entries();
00555 }
00556 {
00557 int xpos, ypos;
00558 gdk_window_get_root_origin( controlwindow_p->get_window_p()->window,
00559 &xpos, &ypos );
00560
00561 long_opts[OPTION_CONTROL_WINDOW_POS_X].value = xpos;
00562 long_opts[OPTION_CONTROL_WINDOW_POS_Y].value = ypos;
00563 optionswindow_p->update_all_gtk_entries();
00564 }
00565 if( the_gui.is_messagewindow_up() )
00566 {
00567 MessageWindow* mw_p = the_gui.get_messagewindow_p();
00568 int width, height;
00569 int xpos, ypos;
00570 gdk_window_get_size( mw_p->get_window_p()->window,
00571 &width, &height );
00572 gdk_window_get_root_origin( mw_p->get_window_p()->window,
00573 &xpos, &ypos );
00574
00575 long_opts[OPTION_MESSAGE_WINDOW_SIZE_X].value = width;
00576 long_opts[OPTION_MESSAGE_WINDOW_SIZE_Y].value = height;
00577 long_opts[OPTION_MESSAGE_WINDOW_POS_X].value = xpos;
00578 long_opts[OPTION_MESSAGE_WINDOW_POS_Y].value = ypos;
00579 optionswindow_p->update_all_gtk_entries();
00580 }
00581 if( the_gui.is_scorewindow_up() )
00582 {
00583 ScoreWindow* sw_p = the_gui.get_scorewindow_p();
00584 int width, height;
00585 int xpos, ypos;
00586 gdk_window_get_size( sw_p->get_window_p()->window,
00587 &width, &height );
00588 gdk_window_get_root_origin( sw_p->get_window_p()->window,
00589 &xpos, &ypos );
00590
00591 long_opts[OPTION_SCORE_WINDOW_SIZE_X].value = width;
00592 long_opts[OPTION_SCORE_WINDOW_SIZE_Y].value = height;
00593 long_opts[OPTION_SCORE_WINDOW_POS_X].value = xpos;
00594 long_opts[OPTION_SCORE_WINDOW_POS_Y].value = ypos;
00595 optionswindow_p->update_all_gtk_entries();
00596 }
00597 if( the_gui.is_statisticswindow_up() )
00598 {
00599 StatisticsWindow* sw_p = the_gui.get_statisticswindow_p();
00600 int width, height;
00601 gdk_window_get_size( sw_p->get_window_p()->window,
00602 &width, &height );
00603
00604 long_opts[OPTION_STATISTICS_WINDOW_SIZE_X].value = width;
00605 long_opts[OPTION_STATISTICS_WINDOW_SIZE_Y].value = height;
00606 optionswindow_p->update_all_gtk_entries();
00607 }
00608 }
|
Here is the call graph for this function:

|
||||||||||||
|
Definition at line 423 of file OptionsWindow.cc. References _, destroy_filesel(), gpointer, and GtkWidget. 00425 {
00426 if( optionswindow_p->get_filesel() == NULL )
00427 {
00428 GtkWidget* fs =
00429 gtk_file_selection_new( _("Choose an options file to load") );
00430 gtk_signal_connect( GTK_OBJECT( fs ), "destroy",
00431 (GtkSignalFunc) OptionsWindow::destroy_filesel,
00432 (gpointer) optionswindow_p );
00433 gtk_signal_connect
00434 ( GTK_OBJECT( GTK_FILE_SELECTION( fs )->cancel_button ), "clicked",
00435 (GtkSignalFunc) OptionsWindow::destroy_filesel,
00436 (gpointer) optionswindow_p );
00437 gtk_signal_connect
00438 ( GTK_OBJECT( GTK_FILE_SELECTION( fs )->ok_button ), "clicked",
00439 (GtkSignalFunc) OptionsWindow::load_options,
00440 (gpointer) optionswindow_p );
00441 gtk_widget_show( fs );
00442 optionswindow_p->set_filesel( fs );
00443 }
00444 }
|
Here is the call graph for this function:

|
||||||||||||
|
Definition at line 471 of file OptionsWindow.cc. References destroy_filesel(), Options::read_options_file(), and the_opts. 00473 {
00474 the_opts.read_options_file
00475 ( gtk_file_selection_get_filename
00476 ( GTK_FILE_SELECTION( optionswindow_p->get_filesel() )), false );
00477 optionswindow_p->update_all_gtk_entries();
00478 destroy_filesel( optionswindow_p->get_filesel(), optionswindow_p );
00479 }
|
Here is the call graph for this function:

|
||||||||||||
|
Definition at line 647 of file OptionsWindow.cc. References String::chars(), option_info_t< T >::datatype, option_info_t< T >::default_value, option_info_t< T >::entry, and hex2str(). 00649 {
00650 if( option->datatype == ENTRY_INT )
00651 gtk_entry_set_text( GTK_ENTRY( option->entry ),
00652 String( option->default_value).chars() );
00653 else if( option->datatype == ENTRY_HEX )
00654 gtk_entry_set_text( GTK_ENTRY( option->entry ),
00655 hex2str( option->default_value).chars() );
00656 }
|
Here is the call graph for this function:

|
||||||||||||
|
Definition at line 659 of file OptionsWindow.cc. References String::chars(), option_info_t< T >::datatype, option_info_t< T >::entry, hex2str(), and option_info_t< T >::max_value. 00661 {
00662 if( option->datatype == ENTRY_INT )
00663 gtk_entry_set_text( GTK_ENTRY( option->entry ),
00664 String( option->max_value).chars() );
00665 else if( option->datatype == ENTRY_HEX )
00666 gtk_entry_set_text( GTK_ENTRY( option->entry ),
00667 hex2str( option->max_value).chars() );
00668 }
|
Here is the call graph for this function:

|
||||||||||||
|
Definition at line 635 of file OptionsWindow.cc. References String::chars(), option_info_t< T >::datatype, option_info_t< T >::entry, hex2str(), and option_info_t< T >::min_value. 00637 {
00638 if( option->datatype == ENTRY_INT )
00639 gtk_entry_set_text( GTK_ENTRY( option->entry ),
00640 String( option->min_value).chars() );
00641 else if( option->datatype == ENTRY_HEX )
00642 gtk_entry_set_text( GTK_ENTRY( option->entry ),
00643 hex2str( option->min_value).chars() );
00644 }
|
Here is the call graph for this function:

|
||||||||||||
|
Definition at line 514 of file OptionsWindow.cc. References Options::close_optionswindow(), and the_opts. 00516 {
00517 optionswindow_p->set_all_options();
00518 the_opts.close_optionswindow();
00519 }
|
Here is the call graph for this function:

|
||||||||||||
|
Definition at line 447 of file OptionsWindow.cc. References _, destroy_filesel(), gpointer, and GtkWidget. 00449 {
00450 if( optionswindow_p->get_filesel() == NULL )
00451 {
00452 GtkWidget* fs =
00453 gtk_file_selection_new( _("Choose an options file to save") );
00454 gtk_signal_connect( GTK_OBJECT( fs ), "destroy",
00455 (GtkSignalFunc) OptionsWindow::destroy_filesel,
00456 (gpointer) optionswindow_p );
00457 gtk_signal_connect
00458 ( GTK_OBJECT( GTK_FILE_SELECTION( fs )->cancel_button ), "clicked",
00459 (GtkSignalFunc) OptionsWindow::destroy_filesel,
00460 (gpointer) optionswindow_p );
00461 gtk_signal_connect
00462 ( GTK_OBJECT( GTK_FILE_SELECTION( fs )->ok_button ), "clicked",
00463 (GtkSignalFunc) OptionsWindow::save_options,
00464 (gpointer) optionswindow_p );
00465 gtk_widget_show( fs );
00466 optionswindow_p->set_filesel( fs );
00467 }
00468 }
|
Here is the call graph for this function:

|
||||||||||||
|
Definition at line 500 of file OptionsWindow.cc. References Options::save_all_options_to_file(), and the_opts. 00502 {
00503 the_opts.save_all_options_to_file("",true);
00504 }
|
Here is the call graph for this function:

|
||||||||||||
|
Definition at line 482 of file OptionsWindow.cc. References destroy_filesel(), Options::save_all_options_to_file(), and the_opts. 00484 {
00485 the_opts.save_all_options_to_file
00486 ( gtk_file_selection_get_filename
00487 ( GTK_FILE_SELECTION( optionswindow_p->get_filesel() )), false );
00488 destroy_filesel( optionswindow_p->get_filesel(), optionswindow_p );
00489 }
|
Here is the call graph for this function:

|
|
Definition at line 318 of file OptionsWindow.cc. References option_info_t< T >::datatype, Options::get_all_double_options(), Options::get_all_long_options(), Options::get_all_string_options(), ArenaController::is_started(), option_info_t< T >::max_value, option_info_t< T >::min_value, NO_STATE, NOT_STARTED, Gui::set_colours(), str2dbl(), str2hex(), str2long(), the_arena, the_arena_controller, the_gui, the_opts, and option_info_t< T >::value. Referenced by Options::save_all_options_to_file(). 00319 {
00320 bool allowed = false;
00321
00322 if( the_arena_controller.is_started() )
00323 {
00324 if( ( the_arena.get_game_mode() == ArenaBase::COMPETITION_MODE &&
00325 ( the_arena.get_state() == NO_STATE ||
00326 the_arena.get_state() == NOT_STARTED ||
00327 the_arena.get_state() == FINISHED ) ) ||
00328 ( the_arena.get_game_mode() != ArenaBase::COMPETITION_MODE ) )
00329 allowed = true;
00330 }
00331 if( !the_arena_controller.is_started() || allowed )
00332 {
00333 option_info_t<double>* double_opts = the_opts.get_all_double_options();
00334 option_info_t<long>* long_opts = the_opts.get_all_long_options();
00335 option_info_t<String>* string_opts = the_opts.get_all_string_options();
00336 for(int i=0;i<LAST_DOUBLE_OPTION;i++)
00337 {
00338
00339 double entry_value = str2dbl
00340 ( gtk_entry_get_text( GTK_ENTRY( double_opts[i].entry ) ) );
00341
00342 if( entry_value > double_opts[i].max_value )
00343 entry_value = double_opts[i].max_value;
00344 if( entry_value < double_opts[i].min_value )
00345 entry_value = double_opts[i].min_value;
00346
00347 double_opts[i].value = entry_value;
00348 }
00349
00350 for(int i=0;i<LAST_LONG_OPTION;i++)
00351 {
00352 long entry_value = 0;
00353 if( long_opts[i].datatype == ENTRY_INT )
00354 entry_value = str2long
00355 ( gtk_entry_get_text( GTK_ENTRY( long_opts[i].entry ) ) );
00356 if( long_opts[i].datatype == ENTRY_HEX )
00357 entry_value = str2hex
00358 ( gtk_entry_get_text( GTK_ENTRY( long_opts[i].entry ) ) );
00359
00360 if( entry_value > long_opts[i].max_value )
00361 entry_value = long_opts[i].max_value;
00362 if( entry_value < long_opts[i].min_value )
00363 entry_value = long_opts[i].min_value;
00364
00365 long_opts[i].value = entry_value;
00366 }
00367
00368 for(int i=0;i<LAST_STRING_OPTION;i++)
00369 string_opts[i].value =
00370 gtk_entry_get_text( GTK_ENTRY( string_opts[i].entry ) );
00371
00372 #ifndef NO_GRAPHICS
00373 if( !no_graphics )
00374 the_gui.set_colours();
00375 #endif
00376 }
00377 }
|
Here is the call graph for this function:

|
|
Definition at line 114 of file OptionsWindow.h. 00114 { filesel = fs; }
|
|
||||||||||||
|
Definition at line 671 of file OptionsWindow.cc. References String::chars(), option_info_t< T >::default_value, and option_info_t< T >::entry. 00673 {
00674 gtk_entry_set_text( GTK_ENTRY( option->entry ),
00675 option->default_value.chars() );
00676 }
|
Here is the call graph for this function:

|
|
Definition at line 380 of file OptionsWindow.cc. References option_info_t< T >::datatype, Options::get_all_double_options(), Options::get_all_long_options(), Options::get_all_string_options(), hex2str(), and the_opts. 00381 {
00382 option_info_t<double>* double_opts = the_opts.get_all_double_options();
00383 option_info_t<long>* long_opts = the_opts.get_all_long_options();
00384 option_info_t<String>* string_opts = the_opts.get_all_string_options();
00385
00386 for(int i=0;i<LAST_DOUBLE_OPTION;i++)
00387 {
00388 gtk_entry_set_text( GTK_ENTRY( double_opts[i].entry ),
00389 String(double_opts[i].value).chars() );
00390 }
00391 for(int i=0;i<LAST_LONG_OPTION;i++)
00392 {
00393 if( long_opts[i].datatype == ENTRY_INT )
00394 gtk_entry_set_text( GTK_ENTRY( long_opts[i].entry ),
00395 String( long_opts[i].value).chars() );
00396 else if (long_opts[i].datatype == ENTRY_HEX)
00397 gtk_entry_set_text( GTK_ENTRY( long_opts[i].entry ),
00398 hex2str(long_opts[i].value).chars() );
00399 }
00400 for(int i=0;i<LAST_STRING_OPTION;i++)
00401 gtk_entry_set_text( GTK_ENTRY( string_opts[i].entry ),
00402 string_opts[i].value.chars() );
00403 }
|
Here is the call graph for this function:

|
|
Definition at line 117 of file OptionsWindow.h. Referenced by OptionsWindow(). |
|
|
Definition at line 116 of file OptionsWindow.h. Referenced by OptionsWindow(), and ~OptionsWindow(). |
1.3.9.1