Qucs-GUI
0.0.18
Main Page
Related Pages
Data Structures
Files
File List
Globals
All
Data Structures
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Pages
qucs
components
equation.cpp
Go to the documentation of this file.
1
/***************************************************************************
2
equation.cpp - description
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
#include <QtGui>
18
#include "
equation.h
"
19
#include "
main.h
"
20
21
22
Equation::Equation
()
23
{
24
Type
=
isComponent
;
// Analogue and digital component.
25
Description
= QObject::tr(
"equation"
);
26
27
QFont f =
QucsSettings
.
font
;
28
f.setWeight(QFont::Light);
29
f.setPointSizeFloat(12.0);
30
QFontMetrics metrics(f);
31
QSize r = metrics.size(0, QObject::tr(
"Equation"
));
32
int
xb = r.width() >> 1;
33
int
yb = r.height() >> 1;
34
35
Lines
.append(
new
Line
(-xb, -yb, -xb, yb,QPen(Qt::darkBlue,2)));
36
Lines
.append(
new
Line
(-xb, yb, xb+3,yb,QPen(Qt::darkBlue,2)));
37
Texts
.append(
new
Text
(-xb+4, -yb-3, QObject::tr(
"Equation"
),
38
QColor(0,0,0), 12.0));
39
40
x1
= -xb-3;
y1
= -yb-5;
41
x2
= xb+9;
y2
= yb+3;
42
43
tx
=
x1
+4;
44
ty
=
y2
+4;
45
Model
=
"Eqn"
;
46
Name
=
"Eqn"
;
47
48
Props
.append(
new
Property
(
"y"
,
"1"
,
true
));
49
Props
.append(
new
Property
(
"Export"
,
"yes"
,
false
,
50
QObject::tr(
"put result into dataset"
)+
" [yes, no]"
));
51
}
52
53
Equation::~Equation
()
54
{
55
}
56
57
// -------------------------------------------------------
58
QString
Equation::verilogCode
(
int
)
59
{
60
QString s;
61
// output all equations
62
for
(
Property
*pr =
Props
.first(); pr != 0; pr =
Props
.next())
63
if
(pr->Name !=
"Export"
)
64
s +=
" real "
+pr->Name+
"; initial "
+pr->Name+
" = "
+pr->Value+
";\n"
;
65
return
s;
66
}
67
68
// -------------------------------------------------------
69
QString
Equation::vhdlCode
(
int
)
70
{
71
QString s;
72
// output all equations
73
for
(
Property
*pr =
Props
.first(); pr != 0; pr =
Props
.next())
74
if
(pr->Name !=
"Export"
)
75
s +=
" constant "
+pr->Name+
" : time := "
+pr->Value+
";\n"
;
76
return
s;
77
}
78
79
Component
*
Equation::newOne
()
80
{
81
return
new
Equation
();
82
}
83
84
Element
*
Equation::info
(QString& Name,
char
* &BitmapFile,
bool
getNewOne)
85
{
86
Name = QObject::tr(
"Equation"
);
87
BitmapFile = (
char
*)
""
;
88
89
if
(getNewOne)
return
new
Equation
();
90
return
0;
91
}
Component::Lines
Q3PtrList< Line > Lines
Definition:
component.h:67
equation.h
Element::Type
int Type
Definition:
element.h:152
Element::y1
int y1
Definition:
element.h:153
tQucsSettings::font
QFont font
Definition:
main.h:46
Equation::Equation
Equation()
Definition:
equation.cpp:22
QucsSettings
tQucsSettings QucsSettings
Definition:
main.cpp:52
Component::tx
int tx
Definition:
component.h:78
Element::y2
int y2
Definition:
element.h:153
Element::x1
int x1
Definition:
element.h:153
Equation::verilogCode
QString verilogCode(int)
Definition:
equation.cpp:58
main.h
Definitions and declarations for the main application.
Component::ty
int ty
Definition:
component.h:78
Equation::vhdlCode
QString vhdlCode(int)
Definition:
equation.cpp:69
Component::Props
Q3PtrList< Property > Props
Definition:
component.h:72
Property
Definition:
element.h:94
Text
Definition:
element.h:82
Component
Definition:
component.h:33
Line
Definition:
element.h:48
Element
Superclass of all schematic drawing elements.
Definition:
element.h:142
Equation::~Equation
~Equation()
Definition:
equation.cpp:53
Component::Name
QString Name
Definition:
component.h:80
Component::Texts
Q3PtrList< Text > Texts
Definition:
component.h:71
Component::Model
QString Model
Definition:
component.h:80
Component::Description
QString Description
Definition:
component.h:81
Equation::info
static Element * info(QString &, char *&, bool getNewOne=false)
Definition:
equation.cpp:84
isComponent
#define isComponent
Definition:
element.h:110
Equation::newOne
Component * newOne()
Definition:
equation.cpp:79
Element::x2
int x2
Definition:
element.h:153
Generated on Mon Sep 1 2014 20:05:19 for Qucs-GUI by
1.8.6