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)->update_logic_position();
30 (*j)->draw_connectors();
36 std::list<t_line>::iterator i = lista_lineas_in.begin();
37 while ( i != lista_lineas_in.end() ) {
39 if ( get_item(temp.store_id) != NULL && get_logic_item(temp.logic_id) != NULL ) {
40 get_item(temp.store_id)->get_in_logic_connect_position(w,z);
41 get_logic_item(temp.logic_id)->get_out_logic_connect_position(a, b);
46 i = lista_lineas_out.begin();
47 while ( i != lista_lineas_out.end() ) {
49 if ( get_item(temp.store_id) != NULL && get_logic_item(temp.logic_id) != NULL ) {
50 get_item(temp.store_id)->get_out_logic_connect_position(w,z);
51 get_logic_item(temp.logic_id)->get_in_logic_connect_position(a, b);
52 draw_line(w, z, a, b);
59 void WorkPlace::delete_item(int _id)
62 CItem::logic_connect = false;
63 std::list<CItem*>::iterator i = listaItems->begin();
64 while ( i != listaItems->end() ){
66 if ( temp->get_id() == _id ){
73 i = lista_logic_Items->begin();
74 while ( i != lista_logic_Items->end() ){
76 if ( temp->get_id() == _id ){
77 lista_logic_Items->erase(i);
86 CItem* WorkPlace::get_logic_item(int _id)
88 std::list<CItem *>::iterator i = lista_logic_Items->begin();
89 while ( i != lista_logic_Items->end() ){
90 if ( (*i)->get_id() == _id )
97 CItem *WorkPlace::get_item(int _id)
99 std::list<CItem *>::iterator i = listaItems->begin();
100 while ( i != listaItems->end() ){
101 if ( (*i)->get_id() == _id )
109 void WorkPlace::delete_line(int _id)
111 std::list<t_line>::iterator i = lista_lineas_in.begin();
112 while ( i != lista_lineas_in.end() ){
113 if (get_item( (*i).store_id ) != NULL)
114 if ( get_item( (*i).store_id )->get_id() == _id ) {
115 lista_lineas_in.erase(i);
116 i = lista_lineas_in.begin();
121 i = lista_lineas_in.begin();
122 while ( i != lista_lineas_in.end() ){
123 if ( get_logic_item((*i).logic_id) != NULL)
124 if ( get_logic_item((*i).logic_id)->get_id() == _id) {
125 lista_lineas_in.erase(i);
126 i = lista_lineas_in.begin();
131 std::list<t_line>::iterator j = lista_lineas_out.begin();
132 while ( j != lista_lineas_out.end() ){
133 if ( get_item((*j).store_id) != NULL )
134 if ( get_item((*j).store_id)->get_id() == _id ) {
135 lista_lineas_out.erase(j);
136 j = lista_lineas_out.begin();
141 j = lista_lineas_out.begin();
142 while ( j != lista_lineas_out.end() ){
143 if ( get_logic_item((*j).logic_id) != NULL )
144 if ( get_logic_item((*j).logic_id)->get_id() == _id ) {
145 lista_lineas_out.erase(j);
146 j = lista_lineas_out.begin();
152 void WorkPlace::update_logic_position()
154 std::list<CItem*>::iterator i = listaItems->begin();
155 while ( i != listaItems->end() ){
156 (*i)->update_logic_position();
159 i = lista_logic_Items->begin();
160 while ( i != lista_logic_Items->end() ){
161 (*i)->update_logic_position();
166 void WorkPlace::draw_line(int x1, int y1, int x2, int y2)
168 get_window()->draw_line (get_style()->get_black_gc(), x1, y1, x1, y2);
169 get_window()->draw_line (get_style()->get_black_gc(), x1, y2, x2, y2);