]> git.llucax.com Git - z.facultad/75.42/plaqui.git/blobdiff - Constructor/src/item.cpp
Varios cambios:
[z.facultad/75.42/plaqui.git] / Constructor / src / item.cpp
index c64a1400abad0fa3051edcc18304b6e0ed0873fb..b4bf5416138a5dd90b39fc44c92ed5cd47c22e7f 100644 (file)
-# Doxyfile 1.3.4
-
-#---------------------------------------------------------------------------
-# Project related configuration options
-#---------------------------------------------------------------------------
-PROJECT_NAME           = 
-PROJECT_NUMBER         = 
-OUTPUT_DIRECTORY       = 
-OUTPUT_LANGUAGE        = English
-USE_WINDOWS_ENCODING   = NO
-BRIEF_MEMBER_DESC      = YES
-REPEAT_BRIEF           = YES
-ALWAYS_DETAILED_SEC    = NO
-INLINE_INHERITED_MEMB  = NO
-FULL_PATH_NAMES        = NO
-STRIP_FROM_PATH        = 
-SHORT_NAMES            = NO
-JAVADOC_AUTOBRIEF      = NO
-MULTILINE_CPP_IS_BRIEF = NO
-DETAILS_AT_TOP         = NO
-INHERIT_DOCS           = YES
-DISTRIBUTE_GROUP_DOC   = NO
-TAB_SIZE               = 8
-ALIASES                = 
-OPTIMIZE_OUTPUT_FOR_C  = NO
-OPTIMIZE_OUTPUT_JAVA   = NO
-SUBGROUPING            = YES
-#---------------------------------------------------------------------------
-# Build related configuration options
-#---------------------------------------------------------------------------
-EXTRACT_ALL            = NO
-EXTRACT_PRIVATE        = NO
-EXTRACT_STATIC         = NO
-EXTRACT_LOCAL_CLASSES  = YES
-HIDE_UNDOC_MEMBERS     = NO
-HIDE_UNDOC_CLASSES     = NO
-HIDE_FRIEND_COMPOUNDS  = NO
-HIDE_IN_BODY_DOCS      = NO
-INTERNAL_DOCS          = NO
-CASE_SENSE_NAMES       = YES
-HIDE_SCOPE_NAMES       = NO
-SHOW_INCLUDE_FILES     = YES
-INLINE_INFO            = YES
-SORT_MEMBER_DOCS       = YES
-GENERATE_TODOLIST      = YES
-GENERATE_TESTLIST      = YES
-GENERATE_BUGLIST       = YES
-GENERATE_DEPRECATEDLIST= YES
-ENABLED_SECTIONS       = 
-MAX_INITIALIZER_LINES  = 30
-SHOW_USED_FILES        = YES
-#---------------------------------------------------------------------------
-# configuration options related to warning and progress messages
-#---------------------------------------------------------------------------
-QUIET                  = NO
-WARNINGS               = YES
-WARN_IF_UNDOCUMENTED   = YES
-WARN_IF_DOC_ERROR      = YES
-WARN_FORMAT            = "$file:$line: $text"
-WARN_LOGFILE           = 
-#---------------------------------------------------------------------------
-# configuration options related to the input files
-#---------------------------------------------------------------------------
-INPUT                  = 
-FILE_PATTERNS          = 
-RECURSIVE              = NO
-EXCLUDE                = 
-EXCLUDE_SYMLINKS       = NO
-EXCLUDE_PATTERNS       = 
-EXAMPLE_PATH           = 
-EXAMPLE_PATTERNS       = 
-EXAMPLE_RECURSIVE      = NO
-IMAGE_PATH             = 
-INPUT_FILTER           = 
-FILTER_SOURCE_FILES    = NO
-#---------------------------------------------------------------------------
-# configuration options related to source browsing
-#---------------------------------------------------------------------------
-SOURCE_BROWSER         = NO
-INLINE_SOURCES         = NO
-STRIP_CODE_COMMENTS    = YES
-REFERENCED_BY_RELATION = YES
-REFERENCES_RELATION    = YES
-VERBATIM_HEADERS       = YES
-#---------------------------------------------------------------------------
-# configuration options related to the alphabetical class index
-#---------------------------------------------------------------------------
-ALPHABETICAL_INDEX     = NO
-COLS_IN_ALPHA_INDEX    = 5
-IGNORE_PREFIX          = 
-#---------------------------------------------------------------------------
-# configuration options related to the HTML output
-#---------------------------------------------------------------------------
-GENERATE_HTML          = YES
-HTML_OUTPUT            = html
-HTML_FILE_EXTENSION    = .html
-HTML_HEADER            = 
-HTML_FOOTER            = 
-HTML_STYLESHEET        = 
-HTML_ALIGN_MEMBERS     = YES
-GENERATE_HTMLHELP      = NO
-CHM_FILE               = 
-HHC_LOCATION           = 
-GENERATE_CHI           = NO
-BINARY_TOC             = NO
-TOC_EXPAND             = NO
-DISABLE_INDEX          = NO
-ENUM_VALUES_PER_LINE   = 4
-GENERATE_TREEVIEW      = NO
-TREEVIEW_WIDTH         = 250
-#---------------------------------------------------------------------------
-# configuration options related to the LaTeX output
-#---------------------------------------------------------------------------
-GENERATE_LATEX         = YES
-LATEX_OUTPUT           = latex
-LATEX_CMD_NAME         = latex
-MAKEINDEX_CMD_NAME     = makeindex
-COMPACT_LATEX          = NO
-PAPER_TYPE             = a4wide
-EXTRA_PACKAGES         = 
-LATEX_HEADER           = 
-PDF_HYPERLINKS         = NO
-USE_PDFLATEX           = NO
-LATEX_BATCHMODE        = NO
-LATEX_HIDE_INDICES     = NO
-#---------------------------------------------------------------------------
-# configuration options related to the RTF output
-#---------------------------------------------------------------------------
-GENERATE_RTF           = NO
-RTF_OUTPUT             = rtf
-COMPACT_RTF            = NO
-RTF_HYPERLINKS         = NO
-RTF_STYLESHEET_FILE    = 
-RTF_EXTENSIONS_FILE    = 
-#---------------------------------------------------------------------------
-# configuration options related to the man page output
-#---------------------------------------------------------------------------
-GENERATE_MAN           = NO
-MAN_OUTPUT             = man
-MAN_EXTENSION          = .3
-MAN_LINKS              = NO
-#---------------------------------------------------------------------------
-# configuration options related to the XML output
-#---------------------------------------------------------------------------
-GENERATE_XML           = NO
-XML_OUTPUT             = xml
-XML_SCHEMA             = 
-XML_DTD                = 
-#---------------------------------------------------------------------------
-# configuration options for the AutoGen Definitions output
-#---------------------------------------------------------------------------
-GENERATE_AUTOGEN_DEF   = NO
-#---------------------------------------------------------------------------
-# configuration options related to the Perl module output
-#---------------------------------------------------------------------------
-GENERATE_PERLMOD       = NO
-PERLMOD_LATEX          = NO
-PERLMOD_PRETTY         = YES
-PERLMOD_MAKEVAR_PREFIX = 
-#---------------------------------------------------------------------------
-# Configuration options related to the preprocessor   
-#---------------------------------------------------------------------------
-ENABLE_PREPROCESSING   = YES
-MACRO_EXPANSION        = NO
-EXPAND_ONLY_PREDEF     = NO
-SEARCH_INCLUDES        = YES
-INCLUDE_PATH           = 
-INCLUDE_FILE_PATTERNS  = 
-PREDEFINED             = 
-EXPAND_AS_DEFINED      = 
-SKIP_FUNCTION_MACROS   = YES
-#---------------------------------------------------------------------------
-# Configuration::addtions related to external references   
-#---------------------------------------------------------------------------
-TAGFILES               = 
-GENERATE_TAGFILE       = 
-ALLEXTERNALS           = NO
-EXTERNAL_GROUPS        = YES
-PERL_PATH              = /usr/bin/perl
-#---------------------------------------------------------------------------
-# Configuration options related to the dot tool   
-#---------------------------------------------------------------------------
-CLASS_DIAGRAMS         = YES
-HIDE_UNDOC_RELATIONS   = YES
-HAVE_DOT               = NO
-CLASS_GRAPH            = YES
-COLLABORATION_GRAPH    = YES
-UML_LOOK               = NO
-TEMPLATE_RELATIONS     = NO
-INCLUDE_GRAPH          = YES
-INCLUDED_BY_GRAPH      = YES
-CALL_GRAPH             = NO
-GRAPHICAL_HIERARCHY    = YES
-DOT_IMAGE_FORMAT       = png
-DOT_PATH               = 
-DOTFILE_DIRS           = 
-MAX_DOT_GRAPH_WIDTH    = 1024
-MAX_DOT_GRAPH_HEIGHT   = 1024
-MAX_DOT_GRAPH_DEPTH    = 0
-GENERATE_LEGEND        = YES
-DOT_CLEANUP            = YES
-#---------------------------------------------------------------------------
-# Configuration::addtions related to the search engine   
-#---------------------------------------------------------------------------
-SEARCHENGINE           = NO
+#include "item.h"
+
+bool CItem::logic_connect = false;
+int CItem::gate_id = -1;
+
+
+CItem::CItem(const char *filename):Gtk::DrawingArea()
+{
+       image = Gdk::Pixbuf::create_from_file(filename);
+       set_size_request(image->get_width(), image->get_height());
+}
+
+CItem::CItem()
+{
+       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;
+       is_union = true;
+       is_connected = false;
+       is_logic =false;
+       property_wnd->item = this;
+       menu_image_propiedades.set(Gtk::Stock::PREFERENCES, Gtk::ICON_SIZE_MENU);
+       menu_image_delete.set(Gtk::Stock::CANCEL, Gtk::ICON_SIZE_MENU);
+       menu_image_rotar.set(Gtk::Stock::REFRESH, Gtk::ICON_SIZE_MENU);
+       menu_image_linea.set(Gtk::Stock::CONVERT, Gtk::ICON_SIZE_MENU);
+       menulist = menu_popup.items();
+    menulist.push_back( Gtk::Menu_Helpers::ImageMenuElem("Propiedades",menu_image_propiedades, SigC::slot(*this, &CItem::on_menu_popup_propiedades) ) );
+    menulist.push_back( Gtk::Menu_Helpers::ImageMenuElem("Rotar", menu_image_rotar ,SigC::slot(*this, &CItem::on_menu_popup_rotar) ) );
+    menulist.push_back( Gtk::Menu_Helpers::ImageMenuElem("Eliminar", menu_image_delete,SigC::slot(*this, &CItem::on_menu_popup_eliminar) ) ) ;
+       menu_popup.accelerate(*this);
+}
+
+CItem::~CItem()
+{
+       std::cout << "Item Die" << std::endl;
+}
+
+bool CItem::on_expose_event(GdkEventExpose* event)
+{
+       image->render_to_drawable ( get_window(),  get_style()->get_black_gc(), 0,  0,  0,  0,  image->get_width() ,image->get_height() , 
+                                                                                                                               Gdk::RGB_DITHER_NONE, 0, 0);
+
+       // XXX Esto no deberia ser necesario! en todo caso devolves false en
+       // vez de true para que siga llamando a los otros handlers :)
+       //Gtk::DrawingArea::on_expose_event(event);
+       return true;
+}
+
+void CItem::on_menu_popup_propiedades()
+{
+}
+
+void CItem::on_menu_popup_rotar()
+{
+}
+
+void CItem::on_menu_popup_eliminar()
+{
+       workplace->delete_item(ID);
+}
+
+void CItem::on_menu_popup_conectar()
+{
+}
+
+int CItem::get_position_x()
+{
+       return x;
+}
+
+int CItem::get_position_y()
+{
+       return y;
+}
+
+int CItem::get_id()
+{
+       return ID;
+}
+
+double CItem::get_caudal()
+{
+       return caudal_max;
+}
+
+
+Glib::ustring CItem::get_name()
+{
+       return name;
+}
+
+Glib::ustring CItem::get_other_name(int _id)
+{
+       std::list<CItem *>::iterator i = listaItems->begin();
+       while ( i != listaItems->end() ) {
+               if ( (*i)->get_id() == _id ) 
+                       return (*i)->get_name();
+               i++;
+       }
+       return name;
+}
+
+int CItem::get_img_actual()
+{
+       return imgActual;
+}
+
+void CItem::set_position(int _x, int _y)
+{
+       this->x = _x;
+       this->y = _y;
+}
+
+void CItem::set_id(int _id)
+{
+       ID = _id;
+}
+
+void CItem::set_caudal(double _caudal)
+{
+        caudal_max = _caudal;
+}
+
+void CItem::set_name(Glib::ustring _name)
+{
+       name = _name;
+}
+
+bool CItem::is_occupied_area(int _a, int _b)
+{      
+       if ( ( _a >= x ) && ( _a < x+image->get_width()) && (_b >= y) && (_b < y+image->get_height()) )  
+                       return true;
+               else return false;
+}
+
+ConnectorType CItem::is_other_connection_area(int _a, int _b, CItem **_item)
+{
+       ConnectorType temp2;
+       std::list<CItem *>::iterator i = listaItems->begin();
+       while ( i != listaItems->end() ) {
+               CItem *temp = *i;
+               if (temp != this) 
+                       if ( (temp2 = temp->get_connector_type(_a,_b)) != UNDEF ) {
+                               *_item = temp;
+                               return temp2;
+                       }
+               i++;
+       }
+       return UNDEF;
+}
+ConnectorType CItem::get_connector_type( int _a, int _b )
+{
+       return UNDEF;
+}
+void CItem::set_default_connector()
+{
+}
+
+void CItem::get_in_logic_connect_position(int& _a, int& _b)
+{
+       _a = x;
+       _b = y;
+}
+
+void CItem::get_out_logic_connect_position(int& _a, int& _b)
+{
+       _a = x;
+       _b = y;
+}
+
+void CItem::update_logic_position()
+{
+}