4 int WorkPlace::pointed = -1;
6 WorkPlace::WorkPlace( BaseObjectType* cobject, const Glib::RefPtr<Gnome::Glade::Xml> &refGlade):Gtk::Fixed(cobject)
10 WorkPlace::~WorkPlace()
14 bool WorkPlace::on_expose_event(GdkEventExpose *event)
17 for(x=0; x<get_width(); x+=32)
18 for (y=0; y<get_height();y+=32){
19 get_window()->draw_point (get_style()->get_black_gc(), x,y);
20 get_window()->draw_point (get_style()->get_black_gc(), x,y+1);
21 get_window()->draw_point (get_style()->get_black_gc(), x,y-1);
22 get_window()->draw_point (get_style()->get_black_gc(), x+1,y);
23 get_window()->draw_point (get_style()->get_black_gc(), x-1,y);
27 std::list<CItem *>::iterator j = listaItems->begin();
28 while ( j != listaItems->end() ) {
29 (*j)->draw_connectors();
35 std::list<t_line>::iterator i = lista_lineas_in.begin();
36 while ( i != lista_lineas_in.end() ) {
38 if ( get_item(temp.store_id) != NULL && get_logic_item(temp.logic_id) != NULL ) {
39 get_item(temp.store_id)->get_in_logic_connect_position(w,z);
40 get_logic_item(temp.logic_id)->get_out_logic_connect_position(a, b);
45 i = lista_lineas_out.begin();
46 while ( i != lista_lineas_out.end() ) {
48 if ( get_item(temp.store_id) != NULL && get_logic_item(temp.logic_id) != NULL ) {
49 get_item(temp.store_id)->get_out_logic_connect_position(w,z);
50 get_logic_item(temp.logic_id)->get_in_logic_connect_position(a, b);
51 draw_line(w, z, a, b);
58 void WorkPlace::delete_item(int _id)
61 CItem::logic_connect = false;
62 std::list<CItem*>::iterator i = listaItems->begin();
63 while ( i != listaItems->end() ){
65 if ( temp->get_id() == _id ){
72 i = lista_logic_Items->begin();
73 while ( i != lista_logic_Items->end() ){
75 if ( temp->get_id() == _id ){
76 lista_logic_Items->erase(i);
85 CItem* WorkPlace::get_logic_item(int _id)
87 std::list<CItem *>::iterator i = lista_logic_Items->begin();
88 while ( i != lista_logic_Items->end() ){
89 if ( (*i)->get_id() == _id )
96 CItem *WorkPlace::get_item(int _id)
98 std::list<CItem *>::iterator i = listaItems->begin();
99 while ( i != listaItems->end() ){
100 if ( (*i)->get_id() == _id )
108 void WorkPlace::delete_line(int _id)
110 std::list<t_line>::iterator i = lista_lineas_in.begin();
111 while ( i != lista_lineas_in.end() ){
112 if (get_item( (*i).store_id ) != NULL)
113 if ( get_item( (*i).store_id )->get_id() == _id ) {
114 lista_lineas_in.erase(i);
115 i = lista_lineas_in.begin();
120 i = lista_lineas_in.begin();
121 while ( i != lista_lineas_in.end() ){
122 if ( get_logic_item((*i).logic_id) != NULL)
123 if ( get_logic_item((*i).logic_id)->get_id() == _id) {
124 lista_lineas_in.erase(i);
125 i = lista_lineas_in.begin();
130 std::list<t_line>::iterator j = lista_lineas_out.begin();
131 while ( j != lista_lineas_out.end() ){
132 if ( get_item((*j).store_id) != NULL )
133 if ( get_item((*j).store_id)->get_id() == _id ) {
134 lista_lineas_out.erase(j);
135 j = lista_lineas_out.begin();
140 j = lista_lineas_out.begin();
141 while ( j != lista_lineas_out.end() ){
142 if ( get_logic_item((*j).logic_id) != NULL )
143 if ( get_logic_item((*j).logic_id)->get_id() == _id ) {
144 lista_lineas_out.erase(j);
145 j = lista_lineas_out.begin();
151 void WorkPlace::update_logic_position()
153 std::list<CItem*>::iterator i = listaItems->begin();
154 while ( i != listaItems->end() ){
155 (*i)->update_logic_position();
158 i = lista_logic_Items->begin();
159 while ( i != lista_logic_Items->end() ){
160 (*i)->update_logic_position();
165 void WorkPlace::draw_line(int x1, int y1, int x2, int y2)
167 get_window()->draw_line (get_style()->get_black_gc(), x1, y1, x1, y2);
168 get_window()->draw_line (get_style()->get_black_gc(), x1, y2, x2, y2);