My Project  0.0.16
QUCS Mapping
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
component.h
Go to the documentation of this file.
1 /***************************************************************************
2  component.h
3  -------------
4  begin : Sat Aug 23 2003
5  copyright : (C) 2003 by Michael Margraf
6  email : michael.margraf@alumni.tu-berlin.de
7  ***************************************************************************/
8 
9 /***************************************************************************
10  * *
11  * This program is free software; you can redistribute it and/or modify *
12  * it under the terms of the GNU General Public License as published by *
13  * the Free Software Foundation; either version 2 of the License, or *
14  * (at your option) any later version. *
15  * *
16  ***************************************************************************/
17 
18 #ifndef COMPONENT_H
19 #define COMPONENT_H
20 
21 #include <qptrlist.h>
22 #include <qpen.h>
23 #include <qpoint.h>
24 #include <qwidget.h>
25 
26 #include "element.h"
27 
28 class Schematic;
29 class ViewPainter;
30 class QString;
31 
32 
33 class Component : public Element {
34 public:
35  Component();
36  virtual ~Component() {};
37 
38  virtual Component* newOne();
39  virtual void recreate(Schematic*) {};
40  QString getNetlist();
41  QString get_VHDL_Code(int);
42  QString get_Verilog_Code(int);
43  void paint(ViewPainter*);
44  void paintScheme(QPainter*);
45  void print(ViewPainter*, float);
46  void setCenter(int, int, bool relative=false);
47  void getCenter(int&, int&);
48  int textSize(int&, int&);
49  void Bounding(int&, int&, int&, int&);
50  void entireBounds(int&, int&, int&, int&, float);
51  bool getSelected(int, int);
52  int getTextSelected(int, int, float);
53  void rotate();
54  void mirrorX(); // mirror about X axis
55  void mirrorY(); // mirror about Y axis
56  QString save();
57  bool load(const QString&);
58 
59  // to hold track of the component appearance for saving and copying
60  bool mirroredX; // is it mirrored about X axis or not
61  int rotated; // rotation angle divided by 90 degrees
62 
63  virtual QString getSubcircuitFile() { return ""; }
64 
65  QPtrList<Line> Lines;
66  QPtrList<struct Arc> Arcs;
67  QPtrList<Area> Rects, Ellips;
68  QPtrList<Port> Ports;
69  QPtrList<Text> Texts;
70  QPtrList<Property> Props;
71 
72  #define COMP_IS_OPEN 0
73  #define COMP_IS_ACTIVE 1
74  #define COMP_IS_SHORTEN 2
75  int isActive; // should it be used in simulation or not ?
76  int tx, ty; // upper left corner of text (position)
77  bool showName;
78  QString Model, Name;
79  QString Description;
80 
81 protected:
82  virtual QString netlist();
83  virtual QString vhdlCode(int);
84  virtual QString verilogCode(int);
85 
86  int analyseLine(const QString&, int);
87  bool getIntegers(const QString&, int *i1=0, int *i2=0, int *i3=0,
88  int *i4=0, int *i5=0, int *i6=0);
89  bool getPen(const QString&, QPen&, int);
90  bool getBrush(const QString&, QBrush&, int);
91 
92  void copyComponent(Component*);
93  Property * getProperty(const QString&);
94 };
95 
96 
97 class MultiViewComponent : public Component {
98 public:
100  virtual ~MultiViewComponent() {};
101 
102  void recreate(Schematic*);
103 
104 protected:
105  virtual void createSymbol() {};
106 };
107 
108 
110 public:
111  GateComponent();
112  QString netlist();
113  QString vhdlCode(int);
114  QString verilogCode(int);
115 
116 protected:
117  void createSymbol();
118 };
119 
120 // prototype of independent function
122 
123 #endif