00001 #ifndef _BUTTONS_EDITOR 00002 #define _BUTTONS_EDITOR 00003 00004 #include "exa-font.h" 00005 #include <list> 00006 #include <vector> 00007 #include "complex.h" 00008 #include "editor.h" 00009 #include "objects_editor.h" 00010 00011 class button; 00012 class view; 00013 00015 class color_button 00016 { 00018 float red; 00020 float green; 00022 float blue; 00024 complex top_left; 00026 complex bottom_right; 00027 public: 00028 color_button(float,float,float,complex,complex); 00030 bool test_hit(complex); 00032 void draw(); 00034 void get_rgb(float&,float&,float&); 00035 }; 00036 00038 class color_toolbarx 00039 { 00041 list<color_button*> colors; 00042 public: 00043 color_toolbarx(); 00044 ~color_toolbarx(); 00046 bool check_toolbar(complex screen_pos,float&,float&,float&); 00048 void draw_toolbar(); 00049 }; 00050 00052 class toolbarx 00053 { 00055 vector<button*> buttons; 00057 exaGLFont text; 00058 public: 00059 toolbarx(); 00060 ~toolbarx(); 00062 int active_button; 00065 void do_action(vector<complex>& p, view* v); 00067 int check_toolbar(complex screen_pos); 00069 void draw_toolbar(); 00071 void check_button_tooltips(complex screen_pos); 00073 void draw_tooltip(complex screen_pos, const char *s); 00075 void erase_resize_points_memory(); 00077 bool is_making_snapshot(); 00078 }; 00079 00081 class button 00082 { 00084 GLuint image; 00085 public: 00087 complex top_left; 00089 complex bottom_right; 00090 button(complex tl, complex br, const char* s); 00092 virtual const char* get_name()=0; 00094 virtual void do_action(vector<complex>& p,view* v)=0; 00096 virtual void draw(); 00098 bool is_being_pointed(complex screen_pos); 00099 virtual ~button(); 00100 }; 00101 00103 class select_button : public button 00104 { 00105 public: 00106 select_button(complex tl, complex br, const char* s): button(tl,br,s) {} 00108 const char* get_name() { return "select";} 00110 virtual void do_action(vector<complex>& p, view* v); 00111 }; 00112 00114 class makegroup_button : public button 00115 { 00116 public: 00117 makegroup_button(complex tl, complex br, const char* s): button(tl,br,s) {} 00119 const char* get_name() { return "make group";} 00121 virtual void do_action(vector<complex>& p, view* v); 00122 }; 00123 00125 class copy_button : public button 00126 { 00127 public: 00128 copy_button(complex tl, complex br, const char* s): button(tl,br,s) {} 00130 const char* get_name() { return "make copy";} 00132 virtual void do_action(vector<complex>& p, view* v); 00133 }; 00134 00136 class remove_button : public button 00137 { 00138 public: 00139 remove_button(complex tl, complex br, const char* s): button(tl,br,s) {} 00141 const char* get_name() { return "remove selected objects";} 00143 virtual void do_action(vector<complex>& p, view* v); 00144 }; 00145 00147 class destroygroup_button : public button 00148 { 00149 public: 00150 destroygroup_button(complex tl, complex br, const char* s): button(tl,br,s) {} 00152 const char* get_name() { return "destroy group";} 00154 virtual void do_action(vector<complex>& p, view* v); 00155 }; 00156 00159 class polygon_button : public button 00160 { 00161 public: 00162 polygon_button(complex tl, complex br, const char* s): button(tl,br,s) {} 00164 const char* get_name() { return "draw polygon";} 00166 virtual void do_action(vector<complex>& p, view* v); 00167 }; 00168 00170 class line_button : public button 00171 { 00172 public: 00173 line_button(complex tl, complex br, const char* s): button(tl,br,s) {} 00175 const char* get_name() { return "draw line";} 00177 virtual void do_action(vector<complex>& p, view* v); 00178 }; 00179 00181 class circle_button : public button 00182 { 00183 public: 00184 circle_button(complex tl, complex br, const char* s): button(tl,br,s) {} 00186 const char* get_name() { return "draw circle";} 00188 virtual void do_action(vector<complex>& p, view* v); 00189 }; 00190 00192 class rectangle_button : public button 00193 { 00194 public: 00195 rectangle_button(complex tl, complex br, const char* s): button(tl,br,s) {} 00197 const char* get_name() { return "draw rectangular";} 00199 virtual void do_action(vector<complex>& p, view* v); 00200 }; 00201 00203 class ellipse_button : public button 00204 { 00205 public: 00206 ellipse_button(complex tl, complex br, const char* s): button(tl,br,s) {} 00208 const char* get_name() { return "draw ellipse";} 00210 virtual void do_action(vector<complex>& p, view* v); 00211 }; 00212 00214 class ellipse_circle_button : public button 00215 { 00216 public: 00217 ellipse_circle_button(complex tl, complex br, const char* s): button(tl,br,s) {} 00219 const char* get_name() { return "draw circle";} 00221 virtual void do_action(vector<complex>& p, view* v); 00222 }; 00223 00225 class star_button : public button 00226 { 00227 public: 00228 star_button(complex tl, complex br, const char* s): button(tl,br,s) {} 00230 const char* get_name() { return "draw star";} 00232 virtual void do_action(vector<complex>& p, view* v); 00233 }; 00234 00236 class raise_step_button : public button 00237 { 00238 public: 00239 raise_step_button(complex tl, complex br, const char* s): button(tl,br,s) {} 00241 const char* get_name() { return "raise selection one layer";} 00243 virtual void do_action(vector<complex>& p, view* v); 00244 }; 00245 00247 class lower_step_button : public button 00248 { 00249 public: 00250 lower_step_button(complex tl, complex br, const char* s): button(tl,br,s) {} 00252 const char* get_name() { return "lower selection one layer";} 00254 virtual void do_action(vector<complex>& p, view* v); 00255 }; 00256 00258 class raise_top_button : public button 00259 { 00260 public: 00261 raise_top_button(complex tl, complex br, const char* s): button(tl,br,s) {} 00263 const char* get_name() { return "raise selection to top";} 00265 virtual void do_action(vector<complex>& p, view* v); 00266 }; 00267 00269 class lower_bottom_button : public button 00270 { 00271 public: 00272 lower_bottom_button(complex tl, complex br, const char* s): button(tl,br,s) {} 00274 const char* get_name() { return "lower selection to bottom";} 00276 virtual void do_action(vector<complex>& p, view* v); 00277 }; 00278 00280 class backward_button : public button 00281 { 00282 public: 00283 backward_button(complex tl, complex br, const char* s): button(tl,br,s) {} 00285 const char* get_name() { return "backward";} 00287 virtual void do_action(vector<complex>& p, view* v); 00288 }; 00289 00291 class forward_button : public button 00292 { 00293 public: 00294 forward_button(complex tl, complex br, const char* s): button(tl,br,s) {} 00296 const char* get_name() { return "forward";} 00298 virtual void do_action(vector<complex>& p, view* v); 00299 }; 00300 00302 class screen_shot_button : public button 00303 { 00304 public: 00305 screen_shot_button(complex tl, complex br, const char* s): button(tl,br,s) {} 00307 const char* get_name() { return "save image in png format";} 00309 virtual void do_action(vector<complex>& p, view* v); 00311 bool exaScreenshot(int startx, int starty, int endx, int endy, int*x, int*y, int*bytes, char**d); 00312 }; 00313 00315 class move_points_button : public button 00316 { 00318 poly_objekt* po; 00320 complex* point; 00322 bool persist_moving; 00323 public: 00324 move_points_button(complex tl, complex br, const char* s): button(tl,br,s) {po=0;persist_moving=false;} 00326 const char* get_name() { return "move nodes of objects";} 00328 virtual void do_action(vector<complex>& p, view* v); 00330 void erase_resize_points_memory(); 00331 }; 00332 00333 #endif