Qucs-GUI
0.0.19
|
00001 /*************************************************************************** 00002 element.h 00003 ----------- 00004 begin : Sat Sep 20 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 00037 #ifndef ELEMENT_H 00038 #define ELEMENT_H 00039 00040 #include <QPen> 00041 #include <QBrush> 00042 00043 class Node; 00044 class QPainter; 00045 class WireLabel; 00046 class Schematic; 00047 00048 struct Line { 00049 Line(int _x1, int _y1, int _x2, int _y2, QPen _style) 00050 : x1(_x1), y1(_y1), x2(_x2), y2(_y2), style(_style) {}; 00051 int x1, y1, x2, y2; 00052 QPen style; 00053 }; 00054 00055 struct Arc { 00056 Arc(int _x, int _y, int _w, int _h, int _angle, int _arclen, QPen _style) 00057 : x(_x), y(_y), w(_w), h(_h), angle(_angle), 00058 arclen(_arclen), style(_style) {}; 00059 int x, y, w, h, angle, arclen; 00060 QPen style; 00061 }; 00062 00063 struct Area { 00064 Area(int _x, int _y, int _w, int _h, QPen _Pen, 00065 QBrush _Brush = QBrush(Qt::NoBrush)) 00066 : x(_x), y(_y), w(_w), h(_h), Pen(_Pen), Brush(_Brush) {}; 00067 int x, y, w, h; 00068 QPen Pen; 00069 QBrush Brush; // filling style/color 00070 }; 00071 00072 struct Port { 00073 Port() {}; 00074 Port(int _x, int _y, bool _avail=true) : x(_x), y(_y), avail(_avail) { 00075 Type=""; Connection=0;}; 00076 int x, y; 00077 bool avail; 00078 QString Type; 00079 Node *Connection; 00080 }; 00081 00082 struct Text { 00083 Text(int _x, int _y, const QString& _s, QColor _Color = QColor(0,0,0), 00084 float _Size = 10.0, float _mCos=1.0, float _mSin=0.0) 00085 : x(_x), y(_y), s(_s), Color(_Color), Size(_Size), 00086 mSin(_mSin), mCos(_mCos) { over = under = false; }; 00087 int x, y; 00088 QString s; 00089 QColor Color; 00090 float Size, mSin, mCos; // font size and rotation coefficients 00091 bool over, under; // text attributes 00092 }; 00093 00094 struct Property { 00095 Property(const QString& _Name="", const QString& _Value="", 00096 bool _display=false, const QString& Desc="") 00097 : Name(_Name), Value(_Value), display(_display), Description(Desc) {}; 00098 QString Name, Value; 00099 bool display; // show on schematic or not ? 00100 QString Description; 00101 }; 00102 00103 00104 // valid values for Element.Type 00105 // The 4 least significant bits of each value are reserved for special 00106 // additionals !!! 00107 #define isDummyElement 0 00108 #define isSpecialMask -16 00109 00110 #define isComponent 0x30000 00111 #define isComponentText 0x30002 00112 #define isAnalogComponent 0x10000 00113 #define isDigitalComponent 0x20000 00114 00115 #define isGraph 0x0020 00116 #define isNode 0x0040 00117 #define isMarker 0x0080 00118 #define isWire 0x0100 00119 00120 #define isPainting 0x2000 00121 #define isPaintingResize 0x2001 00122 00123 #define isLabel 0x4000 00124 #define isHWireLabel 0x4020 00125 #define isVWireLabel 0x4040 00126 #define isNodeLabel 0x4080 00127 #define isMovingLabel 0x4001 00128 #define isHMovingLabel 0x4002 00129 #define isVMovingLabel 0x4004 00130 00131 #define isDiagram 0x8000 00132 #define isDiagramResize 0x8001 00133 #define isDiagramHScroll 0x8002 00134 #define isDiagramVScroll 0x8003 00135 00136 00142 class Element { 00143 public: 00144 Element(); 00145 virtual ~Element(); 00146 00147 virtual void paintScheme(Schematic *); 00148 virtual void paintScheme(QPainter *); 00149 virtual void setCenter(int, int, bool relative=false); 00150 virtual void getCenter(int&, int&); 00151 00152 bool isSelected; 00153 int Type; // whether it is Component, Wire, ... 00154 int cx, cy, x1, y1, x2, y2; // center and relative boundings 00155 }; 00156 00157 00162 class Conductor : public Element { 00163 public: 00164 WireLabel *Label; 00165 }; 00166 00167 #endif