00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #ifndef GUI_FLTK_H
00024 #define GUI_FLTK_H
00025
00026 #include <FL/Fl.h>
00027 #include <FL/Fl_Window.h>
00028 #include <FL/Fl_Gl_Window.h>
00029 #include <FL/Fl_Multiline_Input.h>
00030 #include <FL/Fl_Text_Editor.h>
00031 #include <FL/Fl_Text_Display.h>
00032 #include <FL/Fl_Menu.h>
00033 #include <FL/Fl_Menu_Bar.h>
00034 #include <FL/Fl_Menu_Item.h>
00035 #include <FL/Fl_PNG_Image.h>
00036 #include <FL/Fl_GIF_Image.h>
00037 #include <FL/Fl_Box.h>
00038 #include <FL/Fl_Button.h>
00039 #include <FL/Fl_Value_Output.h>
00040
00041 #include "module_map.h"
00042 #include "module_log.h"
00043 #include "module_net.h"
00044 #include "module_conf_ConfigFile.h"
00045 #include "module_parser.h"
00046
00049 class GUI_GL_Window : public Fl_Gl_Window
00050 {
00051 public:
00052 GUI_GL_Window( int x, int y, int width, int height, char* title );
00053
00054 float set_zoom( float new_zoom );
00055 float get_zoom( void );
00056
00057 void set_view( double x1, double x2, double y1, double y2 );
00058 void reset_view( void );
00059
00060 private:
00061 double ROBOTER_BREITE;
00062 double ROBOTER_LAENGE;
00063 double ROBOTER_MITTE_Y;
00064 double ROBOTER_MITTE_X;
00065
00066 float zoom;
00067
00068 double x1;
00069 double x2;
00070 double y1;
00071 double y2;
00072
00073 unsigned long difftime_msec( timeval time1, timeval time2 );
00074 unsigned int load_raw_texture( const char* filename, int width, int height );
00075
00076 module_map* map;
00077 module_conf* mod_conf;
00078
00079 double draw_factor_x;
00080 double draw_factor_y;
00081 double decay_e;
00082
00083 double decay_lambda;
00084
00085 void draw( void );
00086 };
00087
00090 class GUI_Window : public Fl_Window
00091 {
00092 public:
00093 GUI_Window(int width, int height, char* title);
00094 virtual ~GUI_Window( void );
00095
00096 private:
00097
00098 GUI_GL_Window* gl_win;
00099
00100 Fl_Text_Display* text_out;
00101 Fl_Text_Buffer* text_out_buffer;
00102 Fl_Text_Editor* text_in;
00103 Fl_Text_Buffer* text_in_buffer;
00104
00105 Fl_Menu_Bar* menu;
00106
00107 Fl_GIF_Image* img_conn_on;
00108 Fl_GIF_Image* img_conn_off;
00109 Fl_Box* conn_state;
00110
00111 Fl_Button* btn_send;
00112 Fl_Button* btn_anima;
00113 Fl_Button* btn_halt;
00114
00115 Fl_Value_Output* battery_voltage;
00116 Fl_Value_Output* robot_sigma_x;
00117 Fl_Value_Output* robot_sigma_y;
00118 Fl_Value_Output* robot_sigma_z;
00119 Fl_Value_Output* robot_sigma_angle;
00120
00121 module_net* mod_net;
00122 module_conf* mod_conf;
00123 module_parser* mod_parser;
00124 module_log* mod_log;
00125 module_map* mod_map;
00126
00127
00128 unsigned char MSG_START_PHASE_1;
00129 unsigned char MSG_START_PHASE_2;
00130 unsigned char MSG_PREPARE;
00131 unsigned char MSG_CODE;
00132 unsigned char MSG_ABORT;
00133
00134 net_msg_hdr old_hdr;
00135
00136
00137 bool waiting_for_params;
00138
00139 bool waiting_for_execution;
00140
00141
00142
00145 vector<saved_net_msg> buffered_messages;
00146
00147
00148
00149
00150
00151
00152
00153
00154
00155
00156
00157
00158
00159
00160
00161 static void cb_file_quit( Fl_Widget*, void* );
00162 static void cb_file_connect( Fl_Widget*, void* );
00163 static void cb_help_info( Fl_Widget*, void* );
00164 static void cb_cmd_anima( Fl_Widget*, void* );
00165 static void cb_cmd_reanima( Fl_Widget*, void* );
00166 static void cb_cmd_inanima( Fl_Widget*, void* );
00167 static void cb_cmd_abort( Fl_Widget*, void* );
00168 static void cb_cmd_send_code( Fl_Widget*, void* );
00169 static void cb_diag_dump_map( Fl_Widget*, void* );
00170
00171 static void cb_debug_map( Fl_Widget*, void* );
00172 static void cb_debug_obstacles( Fl_Widget*, void* );
00173
00174 static void cb_check_net_msg( void* );
00175 static void cb_ping( void* );
00176 static void cb_redraw_gl_window( void* );
00177 static void cb_check_errors( void* );
00178 };
00179
00180 #endif