Qucs-GUI  0.0.19
/home/travis/build/Qucs/qucs/qucs/qucs/components/component.h
Go to the documentation of this file.
00001 /***************************************************************************
00002                                component.h
00003                               -------------
00004     begin                : Sat Aug 23 2003
00005     copyright            : (C) 2003 by Michael Margraf
00006     email                : michael.margraf@alumni.tu-berlin.de
00007  ***************************************************************************/
00008 
00009 /***************************************************************************
00010  *                                                                         *
00011  *   This program is free software; you can redistribute it and/or modify  *
00012  *   it under the terms of the GNU General Public License as published by  *
00013  *   the Free Software Foundation; either version 2 of the License, or     *
00014  *   (at your option) any later version.                                   *
00015  *                                                                         *
00016  ***************************************************************************/
00017 
00018 #ifndef COMPONENT_H
00019 #define COMPONENT_H
00020 
00021 #include <Q3PtrList>
00022 
00023 #include "element.h"
00024 
00025 class Schematic;
00026 class ViewPainter;
00027 class QString;
00028 class QPen;
00029 
00030 
00031 class Component : public Element {
00032 public:
00033   Component();
00034   virtual ~Component() {};
00035 
00036   virtual Component* newOne();
00037   virtual void recreate(Schematic*) {};
00038   QString getNetlist();
00039   QString get_VHDL_Code(int);
00040   QString get_Verilog_Code(int);
00041   void    paint(ViewPainter*);
00042   void    paintScheme(Schematic*);
00043   void    print(ViewPainter*, float);
00044   void    setCenter(int, int, bool relative=false);
00045   void    getCenter(int&, int&);
00046   int     textSize(int&, int&);
00047   void    Bounding(int&, int&, int&, int&);
00048   void    entireBounds(int&, int&, int&, int&, float);
00049   bool    getSelected(int, int);
00050   int     getTextSelected(int, int, float);
00051   void    rotate();
00052   void    mirrorX();  // mirror about X axis
00053   void    mirrorY();  // mirror about Y axis
00054   QString save();
00055   bool    load(const QString&);
00056 
00057   // to hold track of the component appearance for saving and copying
00058   bool mirroredX;   // is it mirrored about X axis or not
00059   int  rotated;     // rotation angle divided by 90 degrees
00060 
00061   virtual QString getSubcircuitFile() { return ""; }
00062   // set the pointer scematic associated with the component
00063   virtual void setSchematic (Schematic* p) { containingSchematic = p; }
00064   virtual Schematic* getSchematic () {return containingSchematic; }
00065 
00066   QList<Line *>     Lines;
00067   QList<struct Arc *>      Arcs;
00068   QList<Area *>     Rects;
00069   QList<Area *>     Ellips;
00070   QList<Port *>     Ports;
00071   QList<Text *>     Texts;
00072   Q3PtrList<Property> Props;
00073 
00074   #define COMP_IS_OPEN    0
00075   #define COMP_IS_ACTIVE  1
00076   #define COMP_IS_SHORTEN 2
00077   int  isActive; // should it be used in simulation or not ?
00078   int  tx, ty;   // upper left corner of text (position)
00079   bool showName;
00080   QString  Model, Name;
00081   QString  Description;
00082 
00083 protected:
00084   virtual QString netlist();
00085   virtual QString vhdlCode(int);
00086   virtual QString verilogCode(int);
00087 
00088   int  analyseLine(const QString&, int);
00089   bool getIntegers(const QString&, int *i1=0, int *i2=0, int *i3=0,
00090                    int *i4=0, int *i5=0, int *i6=0);
00091   bool getPen(const QString&, QPen&, int);
00092   bool getBrush(const QString&, QBrush&, int);
00093 
00094   void copyComponent(Component*);
00095   Property * getProperty(const QString&);
00096   Schematic* containingSchematic;
00097 };
00098 
00099 
00100 class MultiViewComponent : public Component {
00101 public:
00102   MultiViewComponent() {};
00103   virtual ~MultiViewComponent() {};
00104 
00105   void recreate(Schematic*);
00106 
00107 protected:
00108   virtual void createSymbol() {};
00109 };
00110 
00111 
00112 class GateComponent : public MultiViewComponent {
00113 public:
00114   GateComponent();
00115   QString netlist();
00116   QString vhdlCode(int);
00117   QString verilogCode(int);
00118 
00119 protected:
00120   void createSymbol();
00121 };
00122 
00123 // prototype of independent function
00124 Component* getComponentFromName(QString& Line, Schematic* p=NULL);
00125 
00126 #endif
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines