ControlWindow Class Reference

#include <ControlWindow.h>


Public Types

enum  displayed_t { NO_WIDGETS, DEBUG_WIDGETS, REPLAY_WIDGETS }

Public Member Functions

 ControlWindow (const int default_width=-1, const int default_height=-1, const int default_x_pos=-1, const int default_y_pos=-1)
 ~ControlWindow ()
void set_window_title (const String &text)
void remove_replay_widgets ()
void clear_extra_widgets ()
void display_debug_widgets ()
void display_replay_widgets ()
void open_replay_filesel ()
displayed_t get_displayed ()
GtkWidgetget_filesel ()
GtkWidgetget_window_p ()
bool is_arenawindow_checked ()
bool is_messagewindow_checked ()
bool is_scorewindow_checked ()
GtkWidgetget_show_arena_menu_item ()
GtkWidgetget_show_message_menu_item ()
GtkWidgetget_show_score_menu_item ()
void set_filesel (GtkWidget *fs)
void set_progress_time (const double time)
void change_time_limitations ()

Static Public Member Functions

void delete_event_occured (GtkWidget *widget, GdkEvent *event, class ControlWindow *cw_p)
void quit_rtb (GtkWidget *widget, class ControlWindow *cw_p)
void pause (GtkWidget *widget, class ControlWindow *cw_p)
void step (GtkWidget *widget, gpointer data)
void end_game (GtkWidget *widget, gpointer data)
void kill_robot (GtkWidget *widget, gpointer data)
void change_debug_level (GtkAdjustment *adj, class ControlWindow *cw_p)
void end_clicked (GtkWidget *widget, gpointer data)
void end_tournament (int result)
void options_clicked (GtkWidget *widget, class ControlWindow *cw_p)
void statistics_clicked (GtkWidget *widget, class ControlWindow *cw_p)
void new_tournament (GtkWidget *widget, class ControlWindow *cw_p)
void replay_tournament (GtkWidget *widget, class ControlWindow *cw_p)
void arena_window_toggle (GtkWidget *widget, class ControlWindow *cw_p)
void message_window_toggle (GtkWidget *widget, class ControlWindow *cw_p)
void score_window_toggle (GtkWidget *widget, class ControlWindow *cw_p)
void replay (GtkWidget *widget, class ControlWindow *cw_p)
void rewind_pressed (GtkWidget *widget, class ControlWindow *cw_p)
void rewind_released (GtkWidget *widget, class ControlWindow *cw_p)
void fast_forward_pressed (GtkWidget *widget, class ControlWindow *cw_p)
void fast_forward_released (GtkWidget *widget, class ControlWindow *cw_p)
void step_forward (GtkWidget *widget, class ControlWindow *cw_p)
void step_backward (GtkWidget *widget, class ControlWindow *cw_p)
void next_game (GtkWidget *widget, class ControlWindow *cw_p)
void prev_game (GtkWidget *widget, class ControlWindow *cw_p)
void next_seq (GtkWidget *widget, class ControlWindow *cw_p)
void prev_seq (GtkWidget *widget, class ControlWindow *cw_p)
void dummy (GtkWidget *widget, class ControlWindow *cw_p)
void change_current_replay_time (GtkAdjustment *adj, class ControlWindow *cw_p)
void destroy_filesel (GtkWidget *widget, class ControlWindow *cw_p)
void kill_and_open_filesel (int result)

Private Attributes

GtkWidgetwindow_p
GtkWidgetdebug_level
GtkWidgetfilesel
GtkWidgetwindow_hbox
GtkWidgetvseparator
GtkWidgetextra_vbox
GtkWidgetshow_arena_menu_item
GtkWidgetshow_message_menu_item
GtkWidgetshow_score_menu_item
GtkWidgettime_control
GtkAdjustmentcurrent_replay_time_adjustment
displayed_t displayed


Member Enumeration Documentation

enum ControlWindow::displayed_t
 

Enumeration values:
NO_WIDGETS 
DEBUG_WIDGETS 
REPLAY_WIDGETS 

Definition at line 44 of file ControlWindow.h.

00044 { NO_WIDGETS, DEBUG_WIDGETS, REPLAY_WIDGETS };


Constructor & Destructor Documentation

ControlWindow::ControlWindow const int  default_width = -1,
const int  default_height = -1,
const int  default_x_pos = -1,
const int  default_y_pos = -1
 

Definition at line 39 of file ControlWindow.cc.

References _, delete_event_occured(), extra_vbox, filesel, gpointer, GtkWidget, remove_replay_widgets(), set_window_title(), show_arena_menu_item, show_message_menu_item, show_score_menu_item, vseparator, window_hbox, and window_p.

00043 {
00044   // The window widget
00045 
00046   window_p = gtk_window_new( GTK_WINDOW_TOPLEVEL );
00047   gtk_widget_set_name( window_p, "RTB Control" );
00048   gtk_window_set_policy( GTK_WINDOW( window_p ), FALSE, FALSE, FALSE );
00049 
00050   set_window_title( "RealTimeBattle" );
00051 
00052   gtk_container_border_width( GTK_CONTAINER( window_p ), 12 );
00053 
00054   if( default_width != -1 && default_height != -1 )
00055     gtk_widget_set_usize( window_p, default_width, default_height );
00056   if( default_x_pos != -1 && default_y_pos != -1 )
00057     gtk_widget_set_uposition( window_p, default_x_pos, default_y_pos );
00058 
00059   gtk_signal_connect( GTK_OBJECT( window_p ), "delete_event",
00060                       (GtkSignalFunc) ControlWindow::delete_event_occured,
00061                       (gpointer) this );
00062 
00063   // Main boxes
00064 
00065   window_hbox = gtk_hbox_new ( FALSE, 10 );
00066   gtk_container_add( GTK_CONTAINER( window_p ), window_hbox );
00067   gtk_widget_show( window_hbox );
00068 
00069   GtkWidget* vbox = gtk_vbox_new( FALSE, 10 );
00070   gtk_container_add( GTK_CONTAINER( window_hbox ), vbox );
00071   gtk_widget_show( vbox );
00072 
00073   // Buttons for all modes
00074 
00075   struct button_t { String label; GtkSignalFunc func; int pack; };
00076 
00077   struct button_t buttons[] = {
00078     { (String)_(" New Tournament "), 
00079       (GtkSignalFunc) ControlWindow::new_tournament    , TRUE  },
00080     { (String)_(" Replay Tournament "), 
00081       (GtkSignalFunc) ControlWindow::replay_tournament , TRUE  },
00082     { (String)_(" Pause "),
00083       (GtkSignalFunc) ControlWindow::pause             , TRUE  },
00084     { (String)_(" End "),
00085       (GtkSignalFunc) ControlWindow::end_clicked       , TRUE  },
00086     { (String)_(" Options "),
00087       (GtkSignalFunc) ControlWindow::options_clicked   , TRUE  },
00088     { (String)_(" Statistics "),
00089       (GtkSignalFunc) ControlWindow::statistics_clicked, TRUE  },
00090     { (String)_("         Quit         "),
00091       (GtkSignalFunc) ControlWindow::quit_rtb          , FALSE } };
00092 
00093   GtkWidget* button_hbox[3] = { NULL,NULL,NULL };
00094   int hbox_index = -1;
00095   for(int i = 0;i < 7; i++)
00096     {
00097       if( i == 0 || i == 4 || i == 6 )
00098         {
00099           hbox_index++;
00100           button_hbox[hbox_index] = gtk_hbox_new( FALSE, 10 );
00101           gtk_box_pack_start( GTK_BOX( vbox ), button_hbox[hbox_index],
00102                               FALSE, FALSE, 0);
00103           gtk_widget_show( button_hbox[hbox_index] );
00104         }
00105       GtkWidget* button =
00106         gtk_button_new_with_label( buttons[i].label.chars() );
00107       gtk_signal_connect( GTK_OBJECT( button ), "clicked",
00108                           (GtkSignalFunc) buttons[i].func,
00109                           (gpointer) this );
00110       gtk_box_pack_start( GTK_BOX( button_hbox[hbox_index] ), button,
00111                           TRUE, buttons[i].pack , 0 );
00112       gtk_widget_show( button );
00113     }
00114 
00115   struct button_t menu_items_data[] = {
00116     { (String)_("Show arena window"),
00117       (GtkSignalFunc) ControlWindow::arena_window_toggle, TRUE  },
00118     { (String)_("Show message window"),
00119       (GtkSignalFunc) ControlWindow::message_window_toggle, TRUE  },
00120     { (String)_("Show score window"),
00121       (GtkSignalFunc) ControlWindow::score_window_toggle, TRUE  } };
00122   
00123 
00124   GtkWidget* omenu = gtk_option_menu_new();
00125   GtkWidget* menu = gtk_menu_new();
00126   for( int i = 0;i < 3; i++ )
00127     {
00128       GtkWidget* menu_item =
00129         gtk_check_menu_item_new_with_label( menu_items_data[i].label.chars() );
00130       gtk_signal_connect( GTK_OBJECT( menu_item ), "toggled",
00131                           menu_items_data[i].func, (gpointer) this );
00132       gtk_menu_append (GTK_MENU (menu), menu_item);
00133       gtk_check_menu_item_set_show_toggle( GTK_CHECK_MENU_ITEM( menu_item ), TRUE );
00134       gtk_check_menu_item_set_active( GTK_CHECK_MENU_ITEM( menu_item ), TRUE );
00135       gtk_widget_show( menu_item );
00136 
00137       switch( i )
00138         {
00139         case 0:
00140           show_arena_menu_item = menu_item;
00141           break;
00142         case 1:
00143           show_message_menu_item = menu_item;
00144           break;
00145         case 2:
00146           show_score_menu_item = menu_item;
00147           break;
00148         }
00149     }
00150 
00151   gtk_box_pack_start( GTK_BOX( button_hbox[1] ), omenu, TRUE, TRUE, 0 );
00152   gtk_option_menu_set_menu( GTK_OPTION_MENU( omenu ), menu );
00153   gtk_widget_show( omenu );
00154 
00155   vseparator = NULL;
00156   extra_vbox = NULL;
00157   filesel = NULL;
00158 
00159   remove_replay_widgets();
00160   gtk_widget_show( window_p );
00161 }

Here is the call graph for this function:

ControlWindow::~ControlWindow  ) 
 

Definition at line 424 of file ControlWindow.cc.

References window_p.

00425 {
00426   gtk_widget_destroy( window_p );
00427 }


Member Function Documentation

void ControlWindow::arena_window_toggle GtkWidget widget,
class ControlWindow cw_p
[static]
 

Definition at line 554 of file ControlWindow.cc.

References Gui::get_arenawindow_p(), ArenaWindow::get_window_p(), Gui::is_arenawindow_up(), and the_gui.

00556 {
00557   bool active = GTK_CHECK_MENU_ITEM( widget )->active;
00558 
00559   if( the_gui.is_arenawindow_up() )
00560     {
00561       if( active )
00562         the_gui.get_arenawindow_p()->
00563           show_window( the_gui.get_arenawindow_p()->get_window_p(),
00564                        the_gui.get_arenawindow_p() );
00565       else
00566         the_gui.get_arenawindow_p()->
00567           hide_window( the_gui.get_arenawindow_p()->get_window_p(),
00568                        NULL, the_gui.get_arenawindow_p() );
00569     }
00570 }

Here is the call graph for this function:

void ControlWindow::change_current_replay_time GtkAdjustment adj,
class ControlWindow cw_p
[static]
 

Definition at line 768 of file ControlWindow.cc.

References replay_arena.

Referenced by change_time_limitations(), and display_replay_widgets().

00770 {
00771   replay_arena.change_replay_time( adj->value );
00772 }

void ControlWindow::change_debug_level GtkAdjustment adj,
class ControlWindow cw_p
[static]
 

Definition at line 487 of file ControlWindow.cc.

References ArenaController::is_started(), the_arena, and the_arena_controller.

Referenced by display_debug_widgets().

00489 {
00490   if( the_arena_controller.is_started() )
00491     the_arena.set_debug_level
00492       ( gtk_spin_button_get_value_as_int
00493         ( GTK_SPIN_BUTTON( cw_p->debug_level ) ) );
00494 }

Here is the call graph for this function:

void ControlWindow::change_time_limitations  ) 
 

Definition at line 406 of file ControlWindow.cc.

References change_current_replay_time(), current_replay_time_adjustment, displayed, gpointer, GtkAdjustment, replay_arena, and time_control.

Referenced by ArenaReplay::parse_log_line().

00407 {
00408   if( displayed == REPLAY_WIDGETS )
00409     {
00410       // Possible memory leak: Do not know how to destroy old adjustment
00411       // possibly destroyed by gtk_range_set_adjustment()
00412       current_replay_time_adjustment =
00413         (GtkAdjustment*) gtk_adjustment_new ( 0.0, 0.0,
00414                                               replay_arena.get_length_of_current_game(),
00415                                               0.1, 1.0, 1.0 );
00416       gtk_signal_connect( GTK_OBJECT( current_replay_time_adjustment ), "value_changed",
00417                           (GtkSignalFunc) change_current_replay_time,
00418                           (gpointer) this );
00419       gtk_range_set_adjustment( GTK_RANGE( time_control ),
00420                                 current_replay_time_adjustment );
00421     }
00422 }

Here is the call graph for this function:

void ControlWindow::clear_extra_widgets  ) 
 

Definition at line 173 of file ControlWindow.cc.

References displayed, extra_vbox, and vseparator.

Referenced by display_debug_widgets(), display_replay_widgets(), and remove_replay_widgets().

00174 {
00175   if( extra_vbox != NULL ) gtk_widget_destroy( extra_vbox );
00176   if( vseparator != NULL ) gtk_widget_destroy( vseparator );
00177 
00178   extra_vbox = NULL;
00179   vseparator = NULL;
00180 
00181   displayed = NO_WIDGETS;
00182 }

void ControlWindow::delete_event_occured GtkWidget widget,
GdkEvent event,
class ControlWindow cw_p
[static]
 

Definition at line 437 of file ControlWindow.cc.

References Quit().

Referenced by ControlWindow().

00439 {
00440   Quit();
00441 }

Here is the call graph for this function:

void ControlWindow::destroy_filesel GtkWidget widget,
class ControlWindow cw_p
[static]
 

Definition at line 646 of file ControlWindow.cc.

Referenced by open_replay_filesel(), and replay().

00648 {
00649   gtk_widget_destroy( cw_p->get_filesel() );
00650   cw_p->set_filesel( NULL );
00651 }

void ControlWindow::display_debug_widgets  ) 
 

Definition at line 185 of file ControlWindow.cc.

References _, change_debug_level(), clear_extra_widgets(), debug_level, ArenaController::debug_level, displayed, extra_vbox, gpointer, GtkAdjustment, GtkWidget, the_arena_controller, vseparator, and window_hbox.

Referenced by remove_replay_widgets().

00186 {
00187   clear_extra_widgets();
00188   
00189   vseparator = gtk_vseparator_new();
00190   gtk_box_pack_start( GTK_BOX (window_hbox), vseparator, FALSE, FALSE, 0 );
00191   gtk_widget_show( vseparator );
00192 
00193   extra_vbox = gtk_vbox_new( FALSE, 10 );
00194   gtk_container_add( GTK_CONTAINER( window_hbox ), extra_vbox );
00195   gtk_widget_show( extra_vbox );
00196 
00197   struct button_t { String label; GtkSignalFunc func; int pack; };
00198   struct button_t debug_buttons[] = {
00199     { (String)_(" Step "), 
00200       (GtkSignalFunc) ControlWindow::step      , TRUE  },
00201     { (String)_(" End Game "), 
00202       (GtkSignalFunc) ControlWindow::end_game  , TRUE  },
00203     { (String)_(" Kill Marked Robot "), 
00204       (GtkSignalFunc) ControlWindow::kill_robot, TRUE  } };
00205 
00206   GtkWidget* button_hbox = NULL;
00207   for(int i = 0;i < 3; i++)
00208     {
00209       if( i == 0 || i == 2 )
00210         {
00211           button_hbox = gtk_hbox_new( FALSE, 10 );
00212           gtk_box_pack_start( GTK_BOX( extra_vbox ), button_hbox,
00213                               FALSE, FALSE, 0);
00214           gtk_widget_show( button_hbox );
00215         }
00216       GtkWidget* button = 
00217         gtk_button_new_with_label( debug_buttons[i].label.chars() );
00218       gtk_signal_connect( GTK_OBJECT( button ), "clicked",
00219                           (GtkSignalFunc) debug_buttons[i].func,
00220                           (gpointer) NULL );
00221       gtk_box_pack_start( GTK_BOX( button_hbox ), button,
00222                           TRUE, debug_buttons[i].pack , 0);
00223       gtk_widget_show( button );
00224     }
00225 
00226   button_hbox = gtk_hbox_new( FALSE, 10 );
00227   gtk_box_pack_start( GTK_BOX( extra_vbox ), button_hbox,
00228                       FALSE, FALSE, 0);
00229   gtk_widget_show( button_hbox );
00230 
00231   GtkWidget* label = gtk_label_new( _(" Debug Level: ") );
00232   gtk_box_pack_start( GTK_BOX( button_hbox ), label, TRUE, FALSE, 0 );
00233   gtk_widget_show( label );
00234 
00235   GtkAdjustment* adj =
00236     (GtkAdjustment*) gtk_adjustment_new( the_arena_controller.debug_level, 0,
00237                                          max_debug_level, 1, 1, 0 );
00238 
00239   debug_level = gtk_spin_button_new( adj, 0, 0 );
00240   gtk_signal_connect( GTK_OBJECT( adj ), "value_changed",
00241                       (GtkSignalFunc) change_debug_level,
00242                       (gpointer) this );
00243   gtk_box_pack_start( GTK_BOX( button_hbox ), debug_level, TRUE, FALSE, 0 );
00244   gtk_widget_show( debug_level );
00245 
00246   displayed = DEBUG_WIDGETS;
00247 }

Here is the call graph for this function:

void ControlWindow::display_replay_widgets  ) 
 

Definition at line 250 of file ControlWindow.cc.

References _, change_current_replay_time(), clear_extra_widgets(), current_replay_time_adjustment, displayed, dummy(), extra_vbox, fast_forward_released(), gpointer, GtkAdjustment, GtkWidget, replay_arena, rewind_released(), time_control, vseparator, window_hbox, and window_p.

Referenced by ArenaReplay::timeout_function().

00251 {
00252   clear_extra_widgets();
00253 
00254   vseparator = gtk_vseparator_new();
00255   gtk_box_pack_start( GTK_BOX (window_hbox), vseparator, FALSE, FALSE, 0 );
00256   gtk_widget_show( vseparator );
00257 
00258   extra_vbox = gtk_vbox_new( FALSE, 10 );
00259   gtk_container_add( GTK_CONTAINER( window_hbox ), extra_vbox );
00260   gtk_widget_show( extra_vbox );
00261 
00262   GtkWidget* hbox = gtk_hbox_new( FALSE, 10 );
00263   gtk_box_pack_start( GTK_BOX( extra_vbox ), hbox, FALSE, FALSE, 0 );
00264   gtk_widget_show( hbox );
00265 
00266   current_replay_time_adjustment =
00267     (GtkAdjustment*) gtk_adjustment_new ( 0.0, 0.0,
00268                                           replay_arena.get_length_of_current_game(),
00269                                           0.1, 1.0, 1.0 );
00270 
00271   gtk_signal_connect( GTK_OBJECT( current_replay_time_adjustment ), "value_changed",
00272                       (GtkSignalFunc) change_current_replay_time,
00273                       (gpointer) this );
00274 
00275   time_control =
00276     gtk_hscale_new( GTK_ADJUSTMENT( current_replay_time_adjustment ) );
00277   gtk_widget_set_usize( GTK_WIDGET( time_control ), 150, 30 );
00278   gtk_range_set_update_policy( GTK_RANGE( time_control ), GTK_UPDATE_DELAYED );
00279   gtk_scale_set_value_pos( GTK_SCALE( time_control ), GTK_POS_TOP);
00280   gtk_scale_set_digits( GTK_SCALE( time_control ), 0 );
00281   gtk_scale_set_draw_value( GTK_SCALE( time_control ), TRUE );
00282   gtk_box_pack_start( GTK_BOX( hbox ), time_control, TRUE, TRUE, 0 );
00283   gtk_widget_show( time_control );
00284 
00285   char* rew_xpm[13] =
00286   { "18 10 2 1",
00287     "       c None",
00288     "x      c #000000000000",
00289     "       xx       xx",
00290     "     xxxx     xxxx",  
00291     "   xxxxxx   xxxxxx",
00292     " xxxxxxxx xxxxxxxx",
00293     "xxxxxxxxxxxxxxxxxx",
00294     "xxxxxxxxxxxxxxxxxx",
00295     " xxxxxxxx xxxxxxxx",
00296     "   xxxxxx   xxxxxx",
00297     "     xxxx     xxxx",
00298     "       xx       xx" };
00299   char* ffw_xpm[13] =
00300   { "18 10 2 1",
00301     "       c None",
00302     "x      c #000000000000",
00303     "xx       xx       ",
00304     "xxxx     xxxx     ",  
00305     "xxxxxx   xxxxxx   ",
00306     "xxxxxxxx xxxxxxxx ",
00307     "xxxxxxxxxxxxxxxxxx",
00308     "xxxxxxxxxxxxxxxxxx",
00309     "xxxxxxxx xxxxxxxx ",
00310     "xxxxxx   xxxxxx   ",
00311     "xxxx     xxxx     ",
00312     "xx       xx       " };
00313 
00314   struct button_t
00315   {
00316     char** xpm;
00317     String label;
00318     GtkSignalFunc clicked_func;
00319     GtkSignalFunc pressed_func;
00320     GtkSignalFunc released_func;
00321   };
00322 
00323   struct button_t replay_buttons[] = {
00324     { rew_xpm, (String)"",
00325       (GtkSignalFunc) ControlWindow::dummy,
00326       (GtkSignalFunc) ControlWindow::rewind_pressed,
00327       (GtkSignalFunc) ControlWindow::rewind_released },
00328     { ffw_xpm, (String)"", 
00329       (GtkSignalFunc) ControlWindow::dummy,
00330       (GtkSignalFunc) ControlWindow::fast_forward_pressed,
00331       (GtkSignalFunc) ControlWindow::fast_forward_released },
00332     { NULL, (String)_(" Step forward "), 
00333       (GtkSignalFunc) ControlWindow::step_forward,
00334       (GtkSignalFunc) ControlWindow::dummy,
00335       (GtkSignalFunc) ControlWindow::dummy },
00336     { NULL, (String)_(" Step backward "), 
00337       (GtkSignalFunc) ControlWindow::step_backward,
00338       (GtkSignalFunc) ControlWindow::dummy,
00339       (GtkSignalFunc) ControlWindow::dummy },
00340     { NULL, (String)_(" Next Game "), 
00341       (GtkSignalFunc) ControlWindow::next_game,
00342       (GtkSignalFunc) ControlWindow::dummy,
00343       (GtkSignalFunc) ControlWindow::dummy },
00344     { NULL, (String)_(" Prev Game "), 
00345       (GtkSignalFunc) ControlWindow::prev_game,
00346       (GtkSignalFunc) ControlWindow::dummy,
00347       (GtkSignalFunc) ControlWindow::dummy },
00348     { NULL, (String)_(" Next Seq "), 
00349       (GtkSignalFunc) ControlWindow::next_seq,
00350       (GtkSignalFunc) ControlWindow::dummy,
00351       (GtkSignalFunc) ControlWindow::dummy },
00352     { NULL, (String)_(" Prev Seq "), 
00353       (GtkSignalFunc) ControlWindow::prev_seq,
00354       (GtkSignalFunc) ControlWindow::dummy,
00355       (GtkSignalFunc) ControlWindow::dummy } };
00356 
00357   GtkWidget* button_hbox = NULL;
00358 
00359   for(int i = 0;i < 8; i++)
00360     {
00361       if( i == 0 || i == 4 )
00362         {
00363           button_hbox = gtk_hbox_new( FALSE, 10 );
00364           gtk_box_pack_start( GTK_BOX( extra_vbox ), button_hbox,
00365                               FALSE, FALSE, 0);
00366           gtk_widget_show( button_hbox );
00367         }
00368       GtkWidget* button_w;
00369       if( replay_buttons[i].xpm != NULL )
00370         {
00371           button_w = gtk_button_new();
00372           GdkPixmap* pixmap;
00373           GdkBitmap* bitmap_mask;
00374 
00375           pixmap = gdk_pixmap_create_from_xpm_d( window_p->window,
00376                                                  &bitmap_mask,
00377                                                  &(window_p->style->black),
00378                                                  replay_buttons[i].xpm );
00379           GtkWidget* pixmap_widget = gtk_pixmap_new( pixmap, bitmap_mask );
00380           gtk_widget_show( pixmap_widget );
00381           gtk_container_add( GTK_CONTAINER( button_w ), pixmap_widget );
00382           gtk_widget_set_usize( button_w, 32, 20 );
00383         }
00384       else
00385         button_w = 
00386           gtk_button_new_with_label( replay_buttons[i].label.chars() );
00387 
00388       gtk_signal_connect( GTK_OBJECT( button_w ), "clicked",
00389                           (GtkSignalFunc) replay_buttons[i].clicked_func,
00390                           (gpointer) NULL );
00391       gtk_signal_connect( GTK_OBJECT( button_w ), "pressed",
00392                           (GtkSignalFunc) replay_buttons[i].pressed_func,
00393                           (gpointer) NULL );
00394       gtk_signal_connect( GTK_OBJECT( button_w ), "released",
00395                           (GtkSignalFunc) replay_buttons[i].released_func,
00396                           (gpointer) NULL );
00397       gtk_box_pack_start( GTK_BOX( button_hbox ), button_w,
00398                           TRUE, TRUE , 0);
00399       gtk_widget_show( button_w );
00400     }
00401 
00402   displayed = REPLAY_WIDGETS;
00403 }

Here is the call graph for this function:

void ControlWindow::dummy GtkWidget widget,
class ControlWindow cw_p
[inline, static]
 

Definition at line 107 of file ControlWindow.h.

Referenced by display_replay_widgets().

00108                                                                  {}

void ControlWindow::end_clicked GtkWidget widget,
gpointer  data
[static]
 

Definition at line 654 of file ControlWindow.cc.

References _, DialogFunction, end_tournament(), List< T >::insert_last(), ArenaController::is_started(), NOT_STARTED, the_arena, and the_arena_controller.

00655 {
00656   if( the_arena_controller.is_started() )
00657     if( the_arena.get_state() != NOT_STARTED &&
00658         the_arena.get_state() != FINISHED )
00659       {
00660         String info_text = _("This action will kill the current tournament.\n"
00661                              "Do you want to do that?");
00662         List<String> string_list;
00663         string_list.insert_last( new String( _("Yes") ) );
00664         string_list.insert_last( new String( _("No")  ) );
00665         Dialog( info_text, string_list,
00666                 (DialogFunction) ControlWindow::end_tournament );
00667       }
00668 }

Here is the call graph for this function:

void ControlWindow::end_game GtkWidget widget,
gpointer  data
[static]
 

Definition at line 465 of file ControlWindow.cc.

References ArenaController::is_started(), NOT_STARTED, the_arena, and the_arena_controller.

00466 {
00467   if( the_arena_controller.is_started() )
00468     if( the_arena.get_state() != NOT_STARTED &&
00469         the_arena.get_state() != FINISHED )
00470       the_arena.end_game();
00471 }

Here is the call graph for this function:

void ControlWindow::end_tournament int  result  )  [static]
 

Definition at line 671 of file ControlWindow.cc.

References ArenaController::is_started(), the_arena, and the_arena_controller.

Referenced by end_clicked().

00672 {
00673   if( the_arena_controller.is_started() && result == 1 )
00674     the_arena.interrupt_tournament();
00675 }

Here is the call graph for this function:

void ControlWindow::fast_forward_pressed GtkWidget widget,
class ControlWindow cw_p
[static]
 

Definition at line 708 of file ControlWindow.cc.

References replay_arena.

00710 {
00711   //  cout << "forwarding ... " << endl;
00712   replay_arena.change_speed( true, true );
00713 }

void ControlWindow::fast_forward_released GtkWidget widget,
class ControlWindow cw_p
[static]
 

Definition at line 716 of file ControlWindow.cc.

References replay_arena.

Referenced by display_replay_widgets().

00718 {
00719   //  cout << "until released" << endl;
00720   replay_arena.change_speed( true, false );
00721 }

displayed_t ControlWindow::get_displayed  )  [inline]
 

Definition at line 116 of file ControlWindow.h.

Referenced by ArenaReplay::timeout_function().

00116 { return displayed; }

GtkWidget* ControlWindow::get_filesel  )  [inline]
 

Definition at line 117 of file ControlWindow.h.

References GtkWidget.

00117 { return filesel; }

GtkWidget* ControlWindow::get_show_arena_menu_item  )  [inline]
 

Definition at line 124 of file ControlWindow.h.

References GtkWidget.

Referenced by ArenaWindow::hide_window().

00124 { return show_arena_menu_item; }

GtkWidget* ControlWindow::get_show_message_menu_item  )  [inline]
 

Definition at line 125 of file ControlWindow.h.

References GtkWidget.

Referenced by MessageWindow::hide_window().

00125 { return show_message_menu_item; }

GtkWidget* ControlWindow::get_show_score_menu_item  )  [inline]
 

Definition at line 126 of file ControlWindow.h.

References GtkWidget.

Referenced by ScoreWindow::hide_window().

00126 { return show_score_menu_item; }

GtkWidget* ControlWindow::get_window_p  )  [inline]
 

Definition at line 118 of file ControlWindow.h.

References GtkWidget.

Referenced by OptionsWindow::grab_windows().

00118 { return window_p; }

bool ControlWindow::is_arenawindow_checked  ) 
 

Definition at line 573 of file ControlWindow.cc.

References show_arena_menu_item.

Referenced by ArenaWindow::ArenaWindow(), and ArenaWindow::hide_window().

00574 {
00575   return GTK_CHECK_MENU_ITEM( show_arena_menu_item )->active;
00576 }

bool ControlWindow::is_messagewindow_checked  ) 
 

Definition at line 598 of file ControlWindow.cc.

References show_message_menu_item.

Referenced by MessageWindow::hide_window(), and MessageWindow::MessageWindow().

00599 {
00600   return GTK_CHECK_MENU_ITEM( show_message_menu_item )->active;
00601 }

bool ControlWindow::is_scorewindow_checked  ) 
 

Definition at line 623 of file ControlWindow.cc.

References show_score_menu_item.

Referenced by ScoreWindow::hide_window(), and ScoreWindow::ScoreWindow().

00624 {
00625   return GTK_CHECK_MENU_ITEM( show_score_menu_item )->active;
00626 }

void ControlWindow::kill_and_open_filesel int  result  )  [static]
 

Definition at line 543 of file ControlWindow.cc.

References controlwindow_p, ArenaController::is_started(), open_replay_filesel(), the_arena, and the_arena_controller.

Referenced by replay_tournament().

00544 {
00545   if( the_arena_controller.is_started() && result == 1 )
00546     {
00547       the_arena.interrupt_tournament();
00548       controlwindow_p->open_replay_filesel();
00549     }
00550 }

Here is the call graph for this function:

void ControlWindow::kill_robot GtkWidget widget,
gpointer  data
[static]
 

Definition at line 474 of file ControlWindow.cc.

References Robot::die(), GAME_IN_PROGRESS, Gui::get_scorewindow_p(), ScoreWindow::get_selected_robot(), ArenaController::is_started(), the_arena, the_arena_controller, and the_gui.

00475 {
00476   if( the_arena_controller.is_started() )
00477     if(the_arena.get_state() == GAME_IN_PROGRESS || 
00478        the_arena.get_state() == PAUSED )
00479       {
00480         Robot* robotp = the_gui.get_scorewindow_p()->get_selected_robot();
00481         if( robotp != NULL )
00482           robotp->die();
00483       }
00484 }

Here is the call graph for this function:

void ControlWindow::message_window_toggle GtkWidget widget,
class ControlWindow cw_p
[static]
 

Definition at line 579 of file ControlWindow.cc.

References Gui::get_messagewindow_p(), MessageWindow::get_window_p(), Gui::is_messagewindow_up(), and the_gui.

00581 {
00582   bool active = GTK_CHECK_MENU_ITEM( widget )->active;
00583 
00584   if( the_gui.is_messagewindow_up() )
00585     {
00586       if( active )
00587         the_gui.get_messagewindow_p()->
00588           show_window( the_gui.get_messagewindow_p()->get_window_p(),
00589                        the_gui.get_messagewindow_p() );
00590       else
00591         the_gui.get_messagewindow_p()->
00592           hide_window( the_gui.get_messagewindow_p()->get_window_p(),
00593                        NULL, the_gui.get_messagewindow_p() );
00594     }
00595 }

Here is the call graph for this function:

void ControlWindow::new_tournament GtkWidget widget,
class ControlWindow cw_p
[static]
 

Definition at line 497 of file ControlWindow.cc.

References Gui::open_starttournamentwindow(), and the_gui.

00499 {
00500   the_gui.open_starttournamentwindow();
00501 }

Here is the call graph for this function:

void ControlWindow::next_game GtkWidget widget,
class ControlWindow cw_p
[static]
 

Definition at line 740 of file ControlWindow.cc.

References replay_arena.

00742 {
00743   replay_arena.change_game( 1, 0 );
00744 }

void ControlWindow::next_seq GtkWidget widget,
class ControlWindow cw_p
[static]
 

Definition at line 754 of file ControlWindow.cc.

References replay_arena.

00756 {
00757   replay_arena.change_game( 0, 1 );
00758 }

void ControlWindow::open_replay_filesel  ) 
 

Definition at line 524 of file ControlWindow.cc.

References _, destroy_filesel(), filesel, and gpointer.

Referenced by kill_and_open_filesel().

00525 {
00526   if( filesel == NULL )
00527     {
00528       filesel = gtk_file_selection_new( _("Choose a log file to replay") );
00529       gtk_signal_connect( GTK_OBJECT( filesel ), "destroy",
00530                           (GtkSignalFunc) ControlWindow::destroy_filesel,
00531                           (gpointer) this );
00532       gtk_signal_connect
00533         ( GTK_OBJECT( GTK_FILE_SELECTION( filesel )->cancel_button ), "clicked",
00534           (GtkSignalFunc) ControlWindow::destroy_filesel, (gpointer) this );
00535       gtk_signal_connect
00536         ( GTK_OBJECT( GTK_FILE_SELECTION( filesel )->ok_button ), "clicked",
00537           (GtkSignalFunc) ControlWindow::replay, (gpointer) this );
00538       gtk_widget_show( filesel );
00539     }
00540 }

Here is the call graph for this function:

void ControlWindow::options_clicked GtkWidget widget,
class ControlWindow cw_p
[static]
 

Definition at line 678 of file ControlWindow.cc.

References Options::open_optionswindow(), and the_opts.

00680 {
00681   the_opts.open_optionswindow();
00682 }

Here is the call graph for this function:

void ControlWindow::pause GtkWidget widget,
class ControlWindow cw_p
[static]
 

Definition at line 451 of file ControlWindow.cc.

References ArenaController::is_started(), the_arena, and the_arena_controller.

00452 {
00453   if( the_arena_controller.is_started() )
00454     the_arena.pause_game_toggle();
00455 }

Here is the call graph for this function:

void ControlWindow::prev_game GtkWidget widget,
class ControlWindow cw_p
[static]
 

Definition at line 747 of file ControlWindow.cc.

References replay_arena.

00749 {
00750   replay_arena.change_game( -1, 0 );
00751 }

void ControlWindow::prev_seq GtkWidget widget,
class ControlWindow cw_p
[static]
 

Definition at line 761 of file ControlWindow.cc.

References replay_arena.

00763 {
00764   replay_arena.change_game( 0, -1 );
00765 }

void ControlWindow::quit_rtb GtkWidget widget,
class ControlWindow cw_p
[static]
 

Definition at line 444 of file ControlWindow.cc.

References Quit().

00446 {
00447   Quit();
00448 }

Here is the call graph for this function:

void ControlWindow::remove_replay_widgets  ) 
 

Definition at line 164 of file ControlWindow.cc.

References clear_extra_widgets(), display_debug_widgets(), ArenaController::game_mode, and the_arena_controller.

Referenced by ControlWindow(), ArenaBase::interrupt_tournament(), and ArenaReplay::parse_this_interval().

00165 {
00166   if( the_arena_controller.game_mode == ArenaBase::DEBUG_MODE )
00167     display_debug_widgets();
00168   else
00169     clear_extra_widgets();
00170 }

Here is the call graph for this function:

void ControlWindow::replay GtkWidget widget,
class ControlWindow cw_p
[static]
 

Definition at line 629 of file ControlWindow.cc.

References destroy_filesel(), String::get_length(), ArenaController::replay_filename, ArenaController::start_replay_arena(), and the_arena_controller.

00631 {
00632   String filename =
00633     gtk_file_selection_get_filename
00634     ( GTK_FILE_SELECTION( cw_p->get_filesel() ) );
00635 
00636   destroy_filesel( cw_p->get_filesel(), cw_p );
00637 
00638   if( filename[filename.get_length() - 1] == '/' )  
00639     return;  // no file is selected
00640 
00641   the_arena_controller.replay_filename = filename;
00642   the_arena_controller.start_replay_arena();
00643 }

Here is the call graph for this function:

void ControlWindow::replay_tournament GtkWidget widget,
class ControlWindow cw_p
[static]
 

Definition at line 504 of file ControlWindow.cc.

References _, DialogFunction, List< T >::insert_last(), ArenaController::is_started(), kill_and_open_filesel(), NOT_STARTED, the_arena, and the_arena_controller.

00506 {
00507   if( the_arena_controller.is_started() &&
00508       ( the_arena.get_state() != NOT_STARTED &&
00509         the_arena.get_state() != FINISHED ) )
00510     {
00511       String info_text = _("This action will kill the current tournament.\n"
00512                            "Do you want to do that?");
00513       List<String> string_list;
00514       string_list.insert_last( new String( _("Yes") ) );
00515       string_list.insert_last( new String( _("No")  ) );
00516       Dialog( info_text, string_list,
00517               (DialogFunction) ControlWindow::kill_and_open_filesel );
00518     }
00519     else
00520       cw_p->open_replay_filesel();
00521 }

Here is the call graph for this function:

void ControlWindow::rewind_pressed GtkWidget widget,
class ControlWindow cw_p
[static]
 

Definition at line 692 of file ControlWindow.cc.

References replay_arena.

00694 {
00695   //  cout << "rewinding ... " << endl;
00696   replay_arena.change_speed( false, true );
00697 }

void ControlWindow::rewind_released GtkWidget widget,
class ControlWindow cw_p
[static]
 

Definition at line 700 of file ControlWindow.cc.

References replay_arena.

Referenced by display_replay_widgets().

00702 {
00703   //  cout << "until released" << endl;
00704   replay_arena.change_speed( false, false );
00705 }

void ControlWindow::score_window_toggle GtkWidget widget,
class ControlWindow cw_p
[static]
 

Definition at line 604 of file ControlWindow.cc.

References Gui::get_scorewindow_p(), ScoreWindow::get_window_p(), Gui::is_scorewindow_up(), and the_gui.

00606 {
00607   bool active = GTK_CHECK_MENU_ITEM( widget )->active;
00608 
00609   if( the_gui.is_scorewindow_up() )
00610     {
00611       if( active )
00612         the_gui.get_scorewindow_p()->
00613           show_window( the_gui.get_scorewindow_p()->get_window_p(),
00614                        the_gui.get_scorewindow_p() );
00615       else
00616         the_gui.get_scorewindow_p()->
00617           hide_window( the_gui.get_scorewindow_p()->get_window_p(),
00618                        NULL, the_gui.get_scorewindow_p() );
00619     }
00620 }

Here is the call graph for this function:

void ControlWindow::set_filesel GtkWidget fs  )  [inline]
 

Definition at line 128 of file ControlWindow.h.

00128 { filesel = fs; }

void ControlWindow::set_progress_time const double  time  ) 
 

Definition at line 775 of file ControlWindow.cc.

References current_replay_time_adjustment.

Referenced by ArenaReplay::step_forward(), and ArenaReplay::timeout_function().

00776 {
00777   gtk_adjustment_set_value( current_replay_time_adjustment, time );
00778 }

void ControlWindow::set_window_title const String text  ) 
 

Definition at line 430 of file ControlWindow.cc.

References String::chars(), and window_p.

Referenced by ControlWindow(), ArenaBase::set_state(), MessageWindow::show_all(), and MessageWindow::show_one_robot().

00431 {
00432   String title = text;
00433   gtk_window_set_title( GTK_WINDOW( window_p ), title.chars() );
00434 }

Here is the call graph for this function:

void ControlWindow::statistics_clicked GtkWidget widget,
class ControlWindow cw_p
[static]
 

Definition at line 685 of file ControlWindow.cc.

References Gui::open_statisticswindow(), and the_gui.

00687 {
00688   the_gui.open_statisticswindow();
00689 }

Here is the call graph for this function:

void ControlWindow::step GtkWidget widget,
gpointer  data
[static]
 

Definition at line 458 of file ControlWindow.cc.

References ArenaController::is_started(), the_arena, and the_arena_controller.

00459 {
00460   if( the_arena_controller.is_started() )
00461     the_arena.step_paused_game();
00462 }

Here is the call graph for this function:

void ControlWindow::step_backward GtkWidget widget,
class ControlWindow cw_p
[static]
 

Definition at line 732 of file ControlWindow.cc.

References replay_arena.

00734 {
00735   //  cout << "Stepping backward" << endl;
00736   replay_arena.step_forward_or_backward( false );
00737 }

void ControlWindow::step_forward GtkWidget widget,
class ControlWindow cw_p
[static]
 

Definition at line 724 of file ControlWindow.cc.

References replay_arena.

00726 {
00727   //  cout << "Stepping forward" << endl;
00728   replay_arena.step_forward_or_backward( true );  
00729 }


Field Documentation

GtkAdjustment* ControlWindow::current_replay_time_adjustment [private]
 

Definition at line 148 of file ControlWindow.h.

Referenced by change_time_limitations(), display_replay_widgets(), and set_progress_time().

GtkWidget* ControlWindow::debug_level [private]
 

Definition at line 136 of file ControlWindow.h.

Referenced by display_debug_widgets().

displayed_t ControlWindow::displayed [private]
 

Definition at line 150 of file ControlWindow.h.

Referenced by change_time_limitations(), clear_extra_widgets(), display_debug_widgets(), and display_replay_widgets().

GtkWidget* ControlWindow::extra_vbox [private]
 

Definition at line 141 of file ControlWindow.h.

Referenced by clear_extra_widgets(), ControlWindow(), display_debug_widgets(), and display_replay_widgets().

GtkWidget* ControlWindow::filesel [private]
 

Definition at line 137 of file ControlWindow.h.

Referenced by ControlWindow(), and open_replay_filesel().

GtkWidget* ControlWindow::show_arena_menu_item [private]
 

Definition at line 143 of file ControlWindow.h.

Referenced by ControlWindow(), and is_arenawindow_checked().

GtkWidget* ControlWindow::show_message_menu_item [private]
 

Definition at line 144 of file ControlWindow.h.

Referenced by ControlWindow(), and is_messagewindow_checked().

GtkWidget* ControlWindow::show_score_menu_item [private]
 

Definition at line 145 of file ControlWindow.h.

Referenced by ControlWindow(), and is_scorewindow_checked().

GtkWidget* ControlWindow::time_control [private]
 

Definition at line 147 of file ControlWindow.h.

Referenced by change_time_limitations(), and display_replay_widgets().

GtkWidget* ControlWindow::vseparator [private]
 

Definition at line 140 of file ControlWindow.h.

Referenced by clear_extra_widgets(), ControlWindow(), display_debug_widgets(), and display_replay_widgets().

GtkWidget* ControlWindow::window_hbox [private]
 

Definition at line 139 of file ControlWindow.h.

Referenced by ControlWindow(), display_debug_widgets(), and display_replay_widgets().

GtkWidget* ControlWindow::window_p [private]
 

Definition at line 135 of file ControlWindow.h.

Referenced by ControlWindow(), display_replay_widgets(), set_window_title(), and ~ControlWindow().


The documentation for this class was generated from the following files:
Generated on Fri Oct 15 15:49:48 2004 for Real Time Battle by  doxygen 1.3.9.1