00001 #ifndef __EDITOR 00002 #define __EDITOR 00003 #include <list> 00004 #include <vector> 00005 #include "complex.h" 00006 #include "buttons_editor.h" 00007 #include "objects_editor.h" 00008 00011 class canvas_group 00012 { 00014 objekt_group* can; 00016 int active; 00018 int diff; 00020 int size; 00021 public: 00022 canvas_group(); 00023 ~canvas_group(); 00025 void draw(); 00027 void change(list<objekt*>&); 00029 void get_o(list<objekt*>&); 00031 void rem_obj(objekt*); 00033 void add_obj(objekt*); 00035 void raise_step(objekt*); 00037 void raise_top(objekt*); 00039 void lower_step(objekt*); 00041 void lower_bottom(objekt*); 00043 void backward(); 00045 void forward(); 00047 void overwrite(int position); 00050 objekt* get_pointed_object(complex); 00053 objekt* get_pointed_object_concrete(complex); 00054 }; 00055 00057 class arrow //arrows at the edge of selection in order to scale the selection 00058 { 00060 complex top_left; 00062 complex bottom_right; 00063 public: 00065 void set_coords(complex tl, complex br); 00068 void draw(bool rotate); 00070 bool test_hit(complex cursor); 00071 }; 00072 00074 class selection_group : public objekt_group //contains actually selected objects 00075 { 00077 arrow* arrows; 00079 void draw_arrows(); 00080 public: 00082 bool rotating; 00083 selection_group(); 00084 ~selection_group(); 00086 void draw_selection(float); 00088 int test_arrow_hit(complex); //test whether a user drags scaling arrows 00090 complex get_scaling_middle(int); //returns centre around which we perform scaling 00092 complex get_arrow_coords(int); 00094 float get_scaling_multiplier(int,complex); //returns multiplicator for scaling selection 00095 }; 00096 00098 struct snapshot_rectangle 00099 { 00101 int startx; 00103 int starty; 00105 int endx; 00107 int endy; 00108 snapshot_rectangle(); 00110 void draw(); 00111 }; 00112 00114 class view 00115 { 00116 private: 00117 int arrow_persist_scaling; 00118 public: 00120 vector<complex> action; 00122 float zoom; 00124 float last_red; 00126 float last_green; 00128 float last_blue; 00129 view(); 00130 ~view(); 00132 complex from; 00134 complex to; 00136 complex from_pom; 00138 complex cursor; 00140 complex camera_position; 00142 toolbarx toolbar; 00144 color_toolbarx color_toolbar; 00146 snapshot_rectangle png_image_coords; 00148 selection_group selection; 00149 /***/ 00150 objekt_group selection_pom; 00152 canvas_group canvas; 00153 00155 bool init(); 00157 void update(); 00159 void shutdown(); 00162 void change_color(float r, float g, float b); 00165 void change_color_absolutely(float r, float g, float b); 00166 private: 00168 void draw_cursor(); 00170 void mouse_click(complex screen_pos); //bude volana po kliknuti mysou niekde v aplikacii 00172 void mouse_drag(complex from, complex to); 00174 void render(); 00176 void tidy_up(); 00177 }; 00178 00179 #endif