Qucs-GUI  0.0.18
 All Data Structures 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 <Q3PtrList>
22 #include <QPen>
23 #include <QPoint>
24 #include <QWidget>
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(Schematic*);
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  // set the pointer scematic associated with the component
65  virtual void setSchematic (Schematic* p) { containingSchematic = p; }
66 
67  Q3PtrList<Line> Lines;
68  Q3PtrList<struct Arc> Arcs;
69  Q3PtrList<Area> Rects, Ellips;
70  Q3PtrList<Port> Ports;
71  Q3PtrList<Text> Texts;
72  Q3PtrList<Property> Props;
73 
74  #define COMP_IS_OPEN 0
75  #define COMP_IS_ACTIVE 1
76  #define COMP_IS_SHORTEN 2
77  int isActive; // should it be used in simulation or not ?
78  int tx, ty; // upper left corner of text (position)
79  bool showName;
80  QString Model, Name;
81  QString Description;
82 
83 protected:
84  virtual QString netlist();
85  virtual QString vhdlCode(int);
86  virtual QString verilogCode(int);
87 
88  int analyseLine(const QString&, int);
89  bool getIntegers(const QString&, int *i1=0, int *i2=0, int *i3=0,
90  int *i4=0, int *i5=0, int *i6=0);
91  bool getPen(const QString&, QPen&, int);
92  bool getBrush(const QString&, QBrush&, int);
93 
94  void copyComponent(Component*);
95  Property * getProperty(const QString&);
97 };
98 
99 
101 public:
103  virtual ~MultiViewComponent() {};
104 
105  void recreate(Schematic*);
106 
107 protected:
108  virtual void createSymbol() {};
109 };
110 
111 
113 public:
114  GateComponent();
115  QString netlist();
116  QString vhdlCode(int);
117  QString verilogCode(int);
118 
119 protected:
120  void createSymbol();
121 };
122 
123 // prototype of independent function
124 Component* getComponentFromName(QString& Line, Schematic* p=NULL);
125 
126 #endif
Q3PtrList< Line > Lines
Definition: component.h:67
virtual Component * newOne()
Definition: component.cpp:70
virtual ~MultiViewComponent()
Definition: component.h:103
Defines drawing elements for schematics.
QString save()
Definition: component.cpp:704
bool getBrush(const QString &, QBrush &, int)
Definition: component.cpp:1181
void createSymbol()
Definition: component.cpp:1437
void copyComponent(Component *)
Definition: component.cpp:1216
QString get_Verilog_Code(int)
Definition: component.cpp:660
Q3PtrList< struct Arc > Arcs
Definition: component.h:68
bool getSelected(int, int)
Definition: component.cpp:176
Q3PtrList< Area > Rects
Definition: component.h:69
int isActive
Definition: component.h:77
int tx
Definition: component.h:78
int analyseLine(const QString &, int)
Definition: component.cpp:915
int textSize(int &, int &)
Definition: component.cpp:86
void mirrorX()
Definition: component.cpp:490
void mirrorY()
Definition: component.cpp:552
virtual QString vhdlCode(int)
Definition: component.cpp:679
int ty
Definition: component.h:78
void entireBounds(int &, int &, int &, int &, float)
Definition: component.cpp:109
int rotated
Definition: component.h:61
QString vhdlCode(int)
Definition: component.cpp:1331
virtual ~Component()
Definition: component.h:36
Q3PtrList< Property > Props
Definition: component.h:72
virtual QString verilogCode(int)
Definition: component.cpp:654
Component * getComponentFromName(QString &Line, Schematic *p=NULL)
Definition: component.cpp:1532
virtual QString netlist()
Definition: component.cpp:617
virtual void setSchematic(Schematic *p)
Definition: component.h:65
bool getPen(const QString &, QPen &, int)
Definition: component.cpp:1156
Definition: element.h:48
Superclass of all schematic drawing elements.
Definition: element.h:142
void recreate(Schematic *)
Definition: component.cpp:1250
bool mirroredX
Definition: component.h:60
virtual QString getSubcircuitFile()
Definition: component.h:63
QString netlist()
Definition: component.cpp:1312
bool showName
Definition: component.h:79
void Bounding(int &, int &, int &, int &)
Definition: component.cpp:76
Q3PtrList< Port > Ports
Definition: component.h:70
void rotate()
Definition: component.cpp:390
bool load(const QString &)
Definition: component.cpp:754
void print(ViewPainter *, float)
Definition: component.cpp:376
QString Name
Definition: component.h:80
Q3PtrList< Text > Texts
Definition: component.h:71
int getTextSelected(int, int, float)
Definition: component.cpp:143
QString Model
Definition: component.h:80
Schematic * containingSchematic
Definition: component.h:96
QString Description
Definition: component.h:81
void getCenter(int &, int &)
Definition: component.cpp:136
void setCenter(int, int, bool relative=false)
Definition: component.cpp:129
void paintScheme(Schematic *)
Definition: component.cpp:319
Q3PtrList< Area > Ellips
Definition: component.h:69
virtual void createSymbol()
Definition: component.h:108
Property * getProperty(const QString &)
Definition: component.cpp:1206
QString getNetlist()
Definition: component.cpp:634
QString get_VHDL_Code(int)
Definition: component.cpp:685
virtual void recreate(Schematic *)
Definition: component.h:39
QString verilogCode(int)
Definition: component.cpp:1377
void paint(ViewPainter *)
Definition: component.cpp:187
bool getIntegers(const QString &, int *i1=0, int *i2=0, int *i3=0, int *i4=0, int *i5=0, int *i6=0)
Definition: component.cpp:1115