</child>
<child>
- <widget class="GtkCombo" id="combo1">
+ <widget class="GtkCombo" id="combo_entry">
<property name="visible">True</property>
<property name="value_in_list">False</property>
<property name="allow_empty">True</property>
<property name="enable_arrows_always">False</property>
<child internal-child="entry">
- <widget class="GtkEntry" id="combo_entry">
+ <widget class="GtkEntry" id="entry">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="editable">True</property>
#include <gtkmm/scrolledwindow.h>
#include <gtkmm/checkbutton.h>
#include <gtkmm/fileselection.h>
-#include <gtkmm/entry.h>
+#include <gtkmm/combo.h>
#include "workplace.h"
#include "item.h"
#include "splitter.h"
Gtk::ImageMenuItem *main_menu_quit,*main_menu_new, *edit_menu_del, *edit_menu_delete_all, *main_menu_save, *main_menu_open;
Gtk::CheckButton *chk_btn_logica;
Gtk::FileSelection *file_selection, *file_open_selection;
- Gtk::Entry *combo_entry;
+ Gtk::Combo *combo_entry;
Gtk::Dialog *dlg_connect;
Gtk::Label *dlg_label;
Glib::RefPtr<Gdk::Pixbuf> ico_canio, ico_y, ico_codo, ico_tanque, ico_bomba, ico_exclusa, ico_drain, ico_and, ico_or, ico_not;
Glib::RefPtr<Gdk::Pixbuf> ico_last;
std::list<Gtk::TargetEntry> listTargets;
std::list<CItem *> listaItems, lista_logic_Items;
+ std::list<Glib::ustring> list_pointed;
WorkPlace *workplace;
bool logica;
bool can_drop(CItem *, int , int);
WorkPlace *workplace;
///Puntero al cuadro de texto de la ventana principal
- Gtk::Entry *combo_entry;
+ Gtk::Combo *combo_entry;
///Puntero a la lista de items
std::list<CItem *> *listaItems;
std::vector<Connector> connect_vec;
void set_img_actual(int i) { imgActual = i; }
+
+ ///Puntero al cuadro de texo de la ventana principal.
+ std::list<Glib::ustring> *list_pointed;
protected:
///Indica el numero que le corresponde a la imagen actual del item.
int imgActual;
Glib::RefPtr<Gdk::GC> gc;
+ Gdk::Color blue, red;
+
///Nombre del item
Glib::ustring name;
///Puntero a la ventana de propiedades del item
ItemPtyWnd *property_wnd;
- Gdk::Color blue, red;
-
///Posicion del item en el area de trabajo
int x, y;
CItem::gate_id = ID;
WorkPlace::pointed = ID;
}
- combo_entry->set_text(name);
-
+ list_pointed->push_back(name);
+ combo_entry->set_popdown_strings(*list_pointed);
+ combo_entry->get_entry()->set_text (name);
+ workplace->queue_draw();
}
if ((event->type == GDK_BUTTON_PRESS) && ( event->button == 2)){
GdkEventExpose e;
t_line tmp_line;
if ((event->type == GDK_BUTTON_PRESS) && ( event->button == 1)) {
- combo_entry->set_text(name);
+ list_pointed->push_back(name);
+ combo_entry->set_popdown_strings(*list_pointed);
+ combo_entry->get_entry()->set_text (name);
WorkPlace::pointed = ID;
if (CItem::logic_connect && CItem::gate_id != -1) {
if ( detect_click_position((int)event->x, (int)event->y) == IN ){
{
switch (imgActual) {
case 1:
- in_x = x + image->get_width();
+ in_x = x + image->get_width()-5;
in_y = y + 16;
out_x = x+16;
out_y = y + image->get_height();
break;
case 0:
- in_x = x;
+ in_x = x+5;
in_y = y+16;
out_x = x + image->get_width() -16;
out_y = y + image->get_height();
bool Conduct::on_button_press_event(GdkEventButton *event)
{
if ((event->type == GDK_BUTTON_PRESS) && ( event->button == 1)) {
- combo_entry->set_text(name);
+ list_pointed->push_back(name);
+ combo_entry->set_popdown_strings(*list_pointed);
WorkPlace::pointed = ID;
+ combo_entry->get_entry()->set_text (name);
+ workplace->queue_draw();
}
if ((event->type == GDK_BUTTON_PRESS) && ( event->button ==2)){
current->workplace= workplace;
//Apunto a la lista.
current->combo_entry = combo_entry;
+ //Apunto a la lista de apuntados
+ current->list_pointed = &list_pointed;
//Apunto a la listaItems.
current->listaItems = &listaItems;
//Apunto a la lista de items logicos
CItem * temp = NULL;
std::list<CItem *>::iterator i = listaItems.begin();
while ( i !=listaItems.end() ) {
- if ( (*i)->get_name() == combo_entry->get_text() ) {
+ if ( (*i)->get_name() == combo_entry->get_entry()->get_text() ) {
temp = *i;
break;
}
i++;
}
+ i = lista_logic_Items.begin();
+ while ( i !=lista_logic_Items.end() ) {
+ if ( (*i)->get_name() == combo_entry->get_entry()->get_text() ) {
+ temp = *i;
+ break;
+ }
+ i++;
+ }
if ( temp != NULL )
workplace->get_window()->draw_rectangle(workplace->get_style()->get_black_gc(), false , temp->get_position_x()-5, temp->get_position_y()-5,
temp->get_image()->get_width()+10, temp->get_image()->get_height()+10);
if ( can_drop(a, i*32, j*32) ) {
workplace->put(*a, i*32, j*32);
//Apunto al workplace
- a->workplace= workplace;
+ a->workplace = workplace;
//Apunto a la lista.
a->combo_entry = combo_entry;
+ //Apunto a la lista de apuntados
+ a->list_pointed = &list_pointed;
//Apunto a la listaItems.
a->listaItems = &listaItems;
//Apunto a la lista de items logicos
bool Drain::on_button_press_event(GdkEventButton *event)
{
if ((event->type == GDK_BUTTON_PRESS) && ( event->button == 1)) {
- combo_entry->set_text(name);
+ list_pointed->push_back(name);
+ combo_entry->set_popdown_strings(*list_pointed);
+ combo_entry->get_entry()->set_text (name);
+ workplace->queue_draw();
WorkPlace::pointed = ID;
}
{
t_line tmp_line;
if ((event->type == GDK_BUTTON_PRESS) && ( event->button == 1)) {
- combo_entry->set_text(name);
+ list_pointed->push_back(name);
+ combo_entry->set_popdown_strings(*list_pointed);
+ combo_entry->get_entry()->set_text (name);
WorkPlace::pointed = ID;
if (CItem::logic_connect && CItem::gate_id != -1) {
if ( detect_click_position((int)event->x, (int)event->y) == IN) {
{
switch (imgActual) {
case 1:
- in_x = x + image->get_width();
- in_y = y + image->get_height()/2;
- out_x = x;
- out_y = in_y;
+ in_x = x + image->get_width()-5;
+ in_y = y + image->get_height()/2-5;
+ out_x = x+5;
+ out_y = in_y+10;
break;
case 0:
in_x = x + image->get_width()/2;
CItem::gate_id = ID;
WorkPlace::pointed = ID;
}
- combo_entry->set_text(name);
+ list_pointed->push_back(name);
+ combo_entry->set_popdown_strings(*list_pointed);
+ combo_entry->get_entry()->set_text (name);
+ workplace->queue_draw();
}
if ((event->type == GDK_BUTTON_PRESS) && ( event->button == 2)){
if ( CItem::logic_connect ) {
CItem::gate_id = ID;
WorkPlace::pointed = ID;
+ workplace->queue_draw();
}
- combo_entry->set_text(name);
+ list_pointed->push_back(name);
+ combo_entry->set_popdown_strings(*list_pointed);
+ combo_entry->get_entry()->set_text (name);
}
if ((event->type == GDK_BUTTON_PRESS) && ( event->button == 2)){
{
t_line tmp_line;
if ((event->type == GDK_BUTTON_PRESS) && ( event->button == 1)) {
- combo_entry->set_text(name);
+ list_pointed->push_back(name);
+ combo_entry->set_popdown_strings(*list_pointed);
+ combo_entry->get_entry()->set_text (name);
WorkPlace::pointed = ID;
if (CItem::logic_connect && CItem::gate_id != -1) {
if ( detect_click_position((int)event->x, (int)event->y) == IN) {
bool Splitter::on_button_press_event(GdkEventButton *event)
{
if ((event->type == GDK_BUTTON_PRESS) && ( event->button == 1)) {
- combo_entry->set_text(name);
+ list_pointed->push_back(name);
+ combo_entry->set_popdown_strings(*list_pointed);
+ combo_entry->get_entry()->set_text (name);
+ workplace->queue_draw();
WorkPlace::pointed = ID;
}
bool Union::on_button_press_event(GdkEventButton *event)
{
if ((event->type == GDK_BUTTON_PRESS) && ( event->button == 1)) {
- combo_entry->set_text(name);
+ list_pointed->push_back(name);
+ combo_entry->set_popdown_strings(*list_pointed);
+ combo_entry->get_entry()->set_text (name);
+ workplace->queue_draw();
WorkPlace::pointed = ID;
}
if ( *logica ) {
std::list<CItem *>::iterator j = listaItems->begin();
while ( j != listaItems->end() ) {
+ (*j)->update_logic_position();
(*j)->draw_connectors();
j++;
}
get_window()->draw_line (get_style()->get_black_gc(), x1, y1, x1, y2);
get_window()->draw_line (get_style()->get_black_gc(), x1, y2, x2, y2);
}
-