]> git.llucax.com Git - z.facultad/75.42/plaqui.git/blob - Constructor/workplace.cpp
Se puede conectar de una manera bizarra una OR con un TANQUE
[z.facultad/75.42/plaqui.git] / Constructor / workplace.cpp
1 #include "workplace.h"
2 #include "item.h"
3
4 WorkPlace::WorkPlace( BaseObjectType* cobject, const Glib::RefPtr<Gnome::Glade::Xml> &refGlade):Gtk::Fixed(cobject)
5 {
6 }
7
8 WorkPlace::~WorkPlace()
9 {
10 }
11
12 bool WorkPlace::on_expose_event(GdkEventExpose *event)
13 {
14         int x, y;
15         for(x=0; x<get_width(); x+=32) 
16                 for (y=0; y<get_height();y+=32){
17                         get_window()->draw_point (get_style()->get_black_gc(), x,y);
18                         get_window()->draw_point (get_style()->get_black_gc(), x,y+1);
19                         get_window()->draw_point (get_style()->get_black_gc(), x,y-1);
20                         get_window()->draw_point (get_style()->get_black_gc(), x+1,y);
21                         get_window()->draw_point (get_style()->get_black_gc(), x-1,y);
22                 }
23                 
24         std::list<t_line>::iterator i = lista_lineas.begin();
25         while ( i != lista_lineas.end() ) {
26                 t_line temp = *i;
27                 get_window()->draw_line (get_style()->get_black_gc(), temp.logic->get_position_x(),temp.logic->get_position_y(), temp.store->get_position_x(),temp.store->get_position_y());
28                 i++;
29         }
30         return true;
31 }
32
33 void WorkPlace::delete_item(int _id)
34 {
35         std::list<CItem*>::iterator i = listaItems->begin();
36         while ( i != listaItems->end() ){
37         CItem *temp = *i;
38                 if ( temp->get_id() == _id ){
39                         listaItems->erase(i);
40                         delete temp;
41                         break;
42                 }
43                 i++;
44         }
45 }
46
47 CItem* WorkPlace::get_logic_item(int _id)
48 {
49         std::list<CItem *>::iterator i = lista_logic_Items->begin();
50         while ( i != lista_logic_Items->end() ){
51                 CItem *temp = *i;
52                 if ( temp->get_id() == _id ) 
53                         return temp;
54                 i++;
55         }
56         return NULL;
57 }