<property name="fill">True</property>
</packing>
</child>
+
+ <child>
+ <widget class="GtkStatusbar" id="statusbar1">
+ <property name="visible">True</property>
+ <property name="has_resize_grip">True</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
</widget>
</child>
</widget>
<property name="update_policy">GTK_UPDATE_ALWAYS</property>
<property name="snap_to_ticks">False</property>
<property name="wrap">False</property>
- <property name="adjustment">0 0 100 0.1 10 10</property>
+ <property name="adjustment">0 0 10000 0.1 10 10</property>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="update_policy">GTK_UPDATE_ALWAYS</property>
<property name="snap_to_ticks">False</property>
<property name="wrap">False</property>
- <property name="adjustment">0 0 100 0.1 10 10</property>
+ <property name="adjustment">0 0 10000 0.1 10 10</property>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="update_policy">GTK_UPDATE_ALWAYS</property>
<property name="snap_to_ticks">False</property>
<property name="wrap">False</property>
- <property name="adjustment">0 0 100 0.1 10 10</property>
+ <property name="adjustment">0 0 10000 0.1 10 10</property>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="update_policy">GTK_UPDATE_ALWAYS</property>
<property name="snap_to_ticks">False</property>
<property name="wrap">False</property>
- <property name="adjustment">0 0 100 0.1 10 10</property>
+ <property name="adjustment">0 0 10000 0.1 10 10</property>
</widget>
<packing>
<property name="left_attach">1</property>
virtual void update_logic_position();
virtual void get_in_logic_connect_position(int& _a, int& _b);
virtual void get_out_logic_connect_position(int& _a, int& _b);
+ virtual void set_out_connected(bool _o);
private:
int in_x, in_y, out_x, out_y;
+ bool out_connected;
std::vector<t_logic_connector> vec_connector;
Glib::RefPtr<Gdk::Pixbuf> imageN; // 0
Glib::RefPtr<Gdk::Pixbuf> imageS; // 1
*/
virtual void update_logic_position();
+ /**Funciones para no permitir mas de una conexion a la salida de las compuertas.
+ *En el caso de la compuerta NOT, tampoco puede tener mas de una conexion
+ *a la entrada.
+ */
+ virtual void set_out_connected(bool _o);
+ virtual void set_in_connected(bool _o);
+
/**Dibuja los conectores logicos del Item, AZUL == ENTRADA, ROJO == SALIDA.
*/
virtual void draw_connectors();
virtual void update_logic_position();
virtual void get_in_logic_connect_position(int& _a, int& _b);
virtual void get_out_logic_connect_position(int& _a, int& _b);
+ virtual void set_out_connected(bool _o);
+ virtual void set_in_connected(bool _o);
private:
int in_x, in_y, out_x, out_y;
- int cant_connections;
+ bool in_connected, out_connected;
std::vector<t_logic_connector> vec_connector;
Glib::RefPtr<Gdk::Pixbuf> imageN; // 0
Glib::RefPtr<Gdk::Pixbuf> imageS; // 1
virtual void update_logic_position();
virtual void get_in_logic_connect_position(int& _a, int& _b);
virtual void get_out_logic_connect_position(int& _a, int& _b);
+ virtual void set_out_connected(bool _o);
private:
int in_x, in_y, out_x, out_y;
+ bool out_connected;
std::vector<t_logic_connector> vec_connector;
Glib::RefPtr<Gdk::Pixbuf> imageN; // 0
Glib::RefPtr<Gdk::Pixbuf> imageS; // 1
///Borra las lineas que esten conectadas con el item de ID == _id.
void delete_line(int _id);
- ///Devuelve un puntero al item de transporte _id.
+ ///Devuelve un puntero al item logico cuyo ID es _id.
CItem *get_logic_item(int _id);
- ///Devuelve un puntero al item logico cuyo ID es _id.
+ ///Devuelve un puntero al item de transporte _id.
CItem *get_item(int _id);
///Actualiza las posiciones de los conectores logicos.
std::list<CItem *> *listaItems, *lista_logic_Items;
/** Listas de lineas que van de una compuerta a la entrada de un item y de la salida de un item a una compuerta
- lista_lineas_in = compuerta --> (entrada) item
- lista_lineas_out= compuerta --> (salida) item
+ lista_lineas_in = (salida) compuerta --> (entrada) item
+ lista_lineas_out= (entrada) compuerta --> (salida) item
*/
std::list<t_line> lista_lineas_in, lista_lineas_out;
And::And()
{
+ out_connected = false;
in_x = x;
in_y = y+16;
out_x = x+32;
{
if ((event->type == GDK_BUTTON_PRESS) && ( event->button == 1)) {
if ( CItem::logic_connect ) {
- CItem::gate_id = ID;
- WorkPlace::pointed = ID;
- }
+ if ( detect_click_position((int)event->x, (int)event->y ) == OUT && !out_connected) {
+ CItem::gate_id = ID;
+ WorkPlace::pointed = ID;
+ }
+ if ( detect_click_position((int)event->x, (int)event->y ) == IN ) {
+ CItem::gate_id = ID;
+ WorkPlace::pointed = ID;
+ }
+ }
list_pointed->push_back(name);
combo_entry->set_popdown_strings(*list_pointed);
combo_entry->get_entry()->set_text (name);
}
i++;
}
- //FIXME la and tiene n entradas y una salida!!!!!!!!!!!!!!!
- return true;// (cant_in == cant_out );
+ return true;
}
ConnectorType And::detect_click_position(int _a, int _b)
_a =out_x;
_b =out_y;
}
+
+void And::set_out_connected(bool _o)
+{
+ out_connected = _o;
+}
in_y = y+16;
out_x = x + 48;
out_y = y + 64;
+ capacidad = 100;
imageE = Gdk::Pixbuf::create_from_file(PACKAGE_DATA_DIR"/plaqui-constructor/pixmaps/tanque_e.png");
imageO = Gdk::Pixbuf::create_from_file(PACKAGE_DATA_DIR"/plaqui-constructor/pixmaps/tanque_o.png");
null = Gdk::Pixbuf::create_from_file(PACKAGE_DATA_DIR"/plaqui-constructor/pixmaps/tanque_null.png");
if (CItem::logic_connect && CItem::gate_id != -1) {
if ( detect_click_position((int)event->x, (int)event->y) == IN ){
tmp_line.logic_id = workplace->get_logic_item(CItem::gate_id)->get_id();
+ workplace->get_logic_item(CItem::gate_id)->set_out_connected(true);
tmp_line.store_id = ID;
workplace->lista_lineas_in.push_back(tmp_line);
workplace->queue_draw();
} else if (detect_click_position((int)event->x, (int)event->y) == OUT) {
+// if (dynamic_cast<Not *>(get_item(temp.logic_id)))
+ // get_logic_item(temp.logic_id)->set_in_connected(true);
tmp_line.logic_id = workplace->get_logic_item(CItem::gate_id)->get_id();
tmp_line.store_id = ID;
workplace->lista_lineas_out.push_back(tmp_line);
workplace->queue_draw();
}
+ CItem::gate_id = -1;
}
}
if (CItem::logic_connect && CItem::gate_id != -1) {
if ( detect_click_position((int)event->x, (int)event->y) == IN) {
tmp_line.logic_id = workplace->get_logic_item(CItem::gate_id)->get_id();
+ workplace->get_logic_item(CItem::gate_id)->set_out_connected(true);
tmp_line.store_id = ID;
workplace->lista_lineas_in.push_back(tmp_line);
workplace->queue_draw();
workplace->lista_lineas_out.push_back(tmp_line);
workplace->queue_draw();
}
+ CItem::gate_id = -1;
}
}
Glib::RefPtr<Gnome::Glade::Xml> ref;
ref = Gnome::Glade::Xml::create(PACKAGE_DATA_DIR"/plaqui-constructor/dialogs/constructor.glade", "item_pty_wnd");
ref->get_widget_derived("item_pty_wnd",property_wnd);
- caudal_max = 0.0;
+ caudal_max = 10.0;
is_union = true;
is_connected = false;
is_logic =false;
name = _name;
}
+void CItem::set_out_connected(bool _o)
+{
+}
+
+void CItem::set_in_connected(bool _o)
+{
+}
+
bool CItem::is_occupied_area(int _a, int _b)
{
if ( ( _a >= x ) && ( _a < x+image->get_width()) && (_b >= y) && (_b < y+image->get_height()) )
queue_draw();
}
}
-
Not::Not()
{
+ in_connected = out_connected = false;
in_x = x;
in_y = y+16;
out_x = x+32;
if ((event->type == GDK_BUTTON_PRESS) && ( event->button == 1)) {
if ( CItem::logic_connect ) {
- CItem::gate_id = ID;
- WorkPlace::pointed = ID;
+ if ( detect_click_position((int)event->x, (int)event->y ) == OUT && !out_connected ) {
+ CItem::gate_id = ID;
+ WorkPlace::pointed = ID;
+ }
+ if ( detect_click_position((int)event->x, (int)event->y ) == IN && !in_connected) {
+ CItem::gate_id = ID;
+ WorkPlace::pointed = ID;
+ }
}
list_pointed->push_back(name);
combo_entry->set_popdown_strings(*list_pointed);
_a =out_x;
_b =out_y;
}
+
+void Not::set_out_connected(bool _o)
+{
+ out_connected = _o;
+}
+
+void Not::set_in_connected(bool _o)
+{
+ in_connected = _o;
+}
Or::Or()
{
+ out_connected = false;
in_x = x;
in_y = y+16;
out_x = x+32;
{
if ((event->type == GDK_BUTTON_PRESS) && ( event->button == 1)) {
if ( CItem::logic_connect ) {
- CItem::gate_id = ID;
- WorkPlace::pointed = ID;
- workplace->queue_draw();
+ if ( detect_click_position((int)event->x, (int)event->y ) == OUT && !out_connected) {
+ CItem::gate_id = ID;
+ WorkPlace::pointed = ID;
+ }
+ if ( detect_click_position((int)event->x, (int)event->y ) == IN ) {
+ CItem::gate_id = ID;
+ WorkPlace::pointed = ID;
+ }
}
list_pointed->push_back(name);
combo_entry->set_popdown_strings(*list_pointed);
_a =out_x;
_b =out_y;
}
+
+void Or::set_out_connected(bool _o)
+{
+ out_connected = _o;
+}
in_y = y;
out_x = in_x;
out_y = y + 32;
+ entrega = 10.0;
imageE = Gdk::Pixbuf::create_from_file(PACKAGE_DATA_DIR"/plaqui-constructor/pixmaps/bomba_e.png");
imageO = Gdk::Pixbuf::create_from_file(PACKAGE_DATA_DIR"/plaqui-constructor/pixmaps/bomba_o.png");
null = Gdk::Pixbuf::create_from_file(PACKAGE_DATA_DIR"/plaqui-constructor/pixmaps/bomba_null.png");
if (CItem::logic_connect && CItem::gate_id != -1) {
if ( detect_click_position((int)event->x, (int)event->y) == IN) {
tmp_line.logic_id = workplace->get_logic_item(CItem::gate_id)->get_id();
+ workplace->get_logic_item(CItem::gate_id)->set_out_connected(true);
tmp_line.store_id = ID;
workplace->lista_lineas_in.push_back(tmp_line);
workplace->queue_draw();
workplace->lista_lineas_out.push_back(tmp_line);
workplace->queue_draw();
}
+ CItem::gate_id = -1;
}
}
#include "item.h"
#include "pump.h"
#include "exclusa.h"
+#include "not.h"
int WorkPlace::pointed = -1;
WorkPlace::WorkPlace(BaseObjectType* cobject, const Glib::RefPtr<Gnome::Glade::Xml> &refGlade):Gtk::Fixed(cobject)
{
gc = Gdk::GC::create(get_window());
- std::cout << "Aca" << std::endl;
Glib::RefPtr<Gdk::Colormap> colormap = gc->get_colormap();
color_in = Gdk::Color("red");
color_out = Gdk::Color("blue");
{
Gtk::Fixed::on_realize();
gc = Gdk::GC::create(get_window());
- std::cout << "Aca" << std::endl;
Glib::RefPtr<Gdk::Colormap> colormap = gc->get_colormap();
color_in = Gdk::Color("red");
color_out = Gdk::Color("blue");
y_offset = -15;
}
get_logic_item(temp.logic_id)->get_out_logic_connect_position(a, b);
+ get_logic_item(temp.logic_id)->set_out_connected(true);
get_item(temp.store_id)->get_in_logic_connect_position(w,z);
draw_line(a+x_offset, b+y_offset, w+item_x_offset, z+item_y_offset, color_in);
get_window()->draw_line(gc, a, b, a+x_offset, b+y_offset);
y_offset = 15;
}
get_item(temp.store_id)->get_out_logic_connect_position(w,z);
+ if (dynamic_cast<Not *>(get_logic_item(temp.logic_id)))
+ get_logic_item(temp.logic_id)->set_in_connected(true);
get_logic_item(temp.logic_id)->get_in_logic_connect_position(a, b);
draw_line(w+item_y_offset, z+item_y_offset, a+x_offset, b+y_offset,color_out);
get_window()->draw_line(gc, a, b, a+x_offset, b+y_offset);
void WorkPlace::delete_item(int _id)
{
delete_line(_id);
- CItem::logic_connect = false;
std::list<CItem*>::iterator i = listaItems->begin();
while ( i != listaItems->end() ){
CItem *temp = *i;
while ( i != lista_lineas_in.end() ){
if ( get_logic_item((*i).logic_id) != NULL)
if ( get_logic_item((*i).logic_id)->get_id() == _id) {
+ get_logic_item((*i).logic_id)->set_out_connected(false);
lista_lineas_in.erase(i);
i = lista_lineas_in.begin();
}
while ( j != lista_lineas_out.end() ){
if ( get_logic_item((*j).logic_id) != NULL )
if ( get_logic_item((*j).logic_id)->get_id() == _id ) {
+ if (dynamic_cast<Not *>(get_logic_item((*i).logic_id)))
+ get_logic_item((*j).logic_id)->set_in_connected(false);
lista_lineas_out.erase(j);
j = lista_lineas_out.begin();
}
get_window()->draw_line (gc, x1, y1, x1, y2);
get_window()->draw_line (gc, x1, y2, x2, y2);
}
-