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);
26 Glib::RefPtr<Gdk::GC> gc = get_style()->get_black_gc();
28 color.set_rgb(255,0,0);
29 gc->set_rgb_bg_color(color);
30 get_style()->set_black(color);
32 std::list<t_line>::iterator i = lista_lineas_in.begin();
33 while ( i != lista_lineas_in.end() ) {
35 if ( get_item(temp.store_id) != NULL && get_logic_item(temp.logic_id) != NULL ) {
36 get_item(temp.store_id)->get_in_logic_connect_position(w,z);
37 get_logic_item(temp.logic_id)->get_out_logic_connect_position(a, b);
38 get_window()->draw_line (get_style()->get_black_gc(), a, b, w,z);
42 i = lista_lineas_out.begin();
43 while ( i != lista_lineas_out.end() ) {
45 if ( get_item(temp.store_id) != NULL && get_logic_item(temp.logic_id) != NULL ) {
46 get_item(temp.store_id)->get_out_logic_connect_position(w,z);
47 get_logic_item(temp.logic_id)->get_in_logic_connect_position(a, b);
48 get_window()->draw_line (get_style()->get_black_gc(), a, b, w, z);
55 void WorkPlace::delete_item(int _id)
58 CItem::logic_connect = false;
59 std::list<CItem*>::iterator i = listaItems->begin();
60 while ( i != listaItems->end() ){
62 if ( temp->get_id() == _id ){
70 i = lista_logic_Items->begin();
71 while ( i != lista_logic_Items->end() ){
73 if ( temp->get_id() == _id ){
75 lista_logic_Items->erase(i);
84 CItem* WorkPlace::get_logic_item(int _id)
86 std::list<CItem *>::iterator i = lista_logic_Items->begin();
87 while ( i != lista_logic_Items->end() ){
88 if ( (*i)->get_id() == _id )
95 CItem *WorkPlace::get_item(int _id)
97 std::list<CItem *>::iterator i = listaItems->begin();
98 while ( i != listaItems->end() ){
99 if ( (*i)->get_id() == _id )
107 void WorkPlace::delete_line(int _id)
109 std::list<t_line>::iterator i = lista_lineas_in.begin();
110 while ( i != lista_lineas_in.end() ){
111 if (get_item( (*i).store_id ) != NULL)
112 if ( get_item( (*i).store_id )->get_id() == _id ) {
113 lista_lineas_in.erase(i);
114 i = lista_lineas_in.begin();
119 i = lista_lineas_in.begin();
120 while ( i != lista_lineas_in.end() ){
121 if ( get_logic_item((*i).logic_id) != NULL)
122 if ( get_logic_item((*i).logic_id)->get_id() == _id) {
123 lista_lineas_in.erase(i);
124 i = lista_lineas_in.begin();
129 std::list<t_line>::iterator j = lista_lineas_out.begin();
130 while ( j != lista_lineas_out.end() ){
131 if ( get_item((*j).store_id) != NULL )
132 if ( get_item((*j).store_id)->get_id() == _id ) {
133 lista_lineas_out.erase(j);
134 j = lista_lineas_out.begin();
139 j = lista_lineas_out.begin();
140 while ( j != lista_lineas_out.end() ){
141 if ( get_logic_item((*j).logic_id) != NULL )
142 if ( get_logic_item((*j).logic_id)->get_id() == _id ) {
143 lista_lineas_out.erase(j);
144 j = lista_lineas_out.begin();
150 void WorkPlace::update_logic_position()
152 std::list<CItem*>::iterator i = listaItems->begin();
153 while ( i != listaItems->end() ){
154 (*i)->update_logic_position();
157 i = lista_logic_Items->begin();
158 while ( i != lista_logic_Items->end() ){
159 (*i)->update_logic_position();