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 ){
69 i = lista_logic_Items->begin();
70 while ( i != lista_logic_Items->end() ){
72 if ( temp->get_id() == _id ){
73 lista_logic_Items->erase(i);
82 CItem* WorkPlace::get_logic_item(int _id)
84 std::list<CItem *>::iterator i = lista_logic_Items->begin();
85 while ( i != lista_logic_Items->end() ){
86 if ( (*i)->get_id() == _id )
93 CItem *WorkPlace::get_item(int _id)
95 std::list<CItem *>::iterator i = listaItems->begin();
96 while ( i != listaItems->end() ){
97 if ( (*i)->get_id() == _id )
105 void WorkPlace::delete_line(int _id)
107 std::list<t_line>::iterator i = lista_lineas_in.begin();
108 while ( i != lista_lineas_in.end() ){
109 if (get_item( (*i).store_id ) != NULL)
110 if ( get_item( (*i).store_id )->get_id() == _id ) {
111 lista_lineas_in.erase(i);
112 i = lista_lineas_in.begin();
117 i = lista_lineas_in.begin();
118 while ( i != lista_lineas_in.end() ){
119 if ( get_logic_item((*i).logic_id) != NULL)
120 if ( get_logic_item((*i).logic_id)->get_id() == _id) {
121 lista_lineas_in.erase(i);
122 i = lista_lineas_in.begin();
127 std::list<t_line>::iterator j = lista_lineas_out.begin();
128 while ( j != lista_lineas_out.end() ){
129 if ( get_item((*j).store_id) != NULL )
130 if ( get_item((*j).store_id)->get_id() == _id ) {
131 lista_lineas_out.erase(j);
132 j = lista_lineas_out.begin();
137 j = lista_lineas_out.begin();
138 while ( j != lista_lineas_out.end() ){
139 if ( get_logic_item((*j).logic_id) != NULL )
140 if ( get_logic_item((*j).logic_id)->get_id() == _id ) {
141 lista_lineas_out.erase(j);
142 j = lista_lineas_out.begin();
148 void WorkPlace::update_logic_position()
150 std::list<CItem*>::iterator i = listaItems->begin();
151 while ( i != listaItems->end() ){
152 (*i)->update_logic_position();
155 i = lista_logic_Items->begin();
156 while ( i != lista_logic_Items->end() ){
157 (*i)->update_logic_position();