mirror of
https://github.com/ra3xdh/qucs_s
synced 2025-03-28 21:13:26 +00:00
*** empty log message ***
This commit is contained in:
parent
22b9d0106d
commit
01a241e5d0
@ -1,3 +1,9 @@
|
||||
2004-01-10 Michael Margraf
|
||||
|
||||
* diagrams can be resized
|
||||
* tabular diagrams can show more than one variable
|
||||
* a simple help system can now be started from help system
|
||||
|
||||
2003-11-29 Stefan Jahn <stefan@lkcc.org>
|
||||
|
||||
* configure.ac: Added a LANGUAGEDIR path for translations.
|
||||
|
@ -115,6 +115,9 @@ unset BIN_PATH
|
||||
LANG_PATH="$prefix/share/qucs/lang/"
|
||||
AC_DEFINE_UNQUOTED([LANGUAGEDIR], ["$LANG_PATH"], [Where the language files go.])
|
||||
unset LANG_PATH
|
||||
DOC_PATH="$prefix/share/qucs/docs/en/"
|
||||
AC_DEFINE_UNQUOTED([DOCDIR], ["$DOC_PATH"], [Where the documentation files go.])
|
||||
unset DOC_PATH
|
||||
|
||||
# Add here all your Makefiles. This are created by configure.
|
||||
AC_CONFIG_FILES([Makefile
|
||||
@ -123,7 +126,8 @@ AC_CONFIG_FILES([Makefile
|
||||
qucs/sim/Makefile
|
||||
qucs/components/Makefile
|
||||
qucs/diagrams/Makefile
|
||||
qucs/paintings/Makefile])
|
||||
qucs/paintings/Makefile
|
||||
qucs/docs/en/Makefile])
|
||||
AC_OUTPUT
|
||||
|
||||
dnl Print results.
|
||||
|
@ -1,4 +1,5 @@
|
||||
####### kdevelop will overwrite this part!!! (begin)##########
|
||||
|
||||
SUBDIRS = en
|
||||
|
||||
####### kdevelop will overwrite this part!!! (end)############
|
||||
|
@ -1,4 +1,6 @@
|
||||
####### kdevelop will overwrite this part!!! (begin)##########
|
||||
|
||||
|
||||
EXTRA_DIST = qucsmain.png start.html select.png index.html
|
||||
|
||||
####### kdevelop will overwrite this part!!! (end)############
|
||||
|
26
qucs-help/docs/en/index.html
Executable file
26
qucs-help/docs/en/index.html
Executable file
@ -0,0 +1,26 @@
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<meta http-equiv=Content-Type content="text/html; charset=iso-8859-1">
|
||||
<meta name="Author" content="Michael Margraf">
|
||||
<title>Qucs - Help Index</title>
|
||||
</head>
|
||||
|
||||
|
||||
|
||||
<body>
|
||||
<a name="top" id="top"></a>
|
||||
|
||||
<center><h3>
|
||||
- Qucs -<br>
|
||||
Qt universal circuit simulator<br>
|
||||
</h3>
|
||||
<h1>
|
||||
Help Index<br><br>
|
||||
</h1></center>
|
||||
|
||||
<a href="start.html">Getting Started</a><br>
|
||||
<a href="short.html">Short Description of Functions</a><br>
|
||||
|
||||
</body>
|
||||
</html>
|
BIN
qucs-help/docs/en/paste.png
Normal file
BIN
qucs-help/docs/en/paste.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 708 B |
BIN
qucs-help/docs/en/qucsmain.png
Normal file
BIN
qucs-help/docs/en/qucsmain.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 27 KiB |
BIN
qucs-help/docs/en/select.png
Normal file
BIN
qucs-help/docs/en/select.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 543 B |
95
qucs-help/docs/en/short.html
Normal file
95
qucs-help/docs/en/short.html
Normal file
@ -0,0 +1,95 @@
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<meta http-equiv=Content-Type content="text/html; charset=iso-8859-1">
|
||||
<meta name="Author" content="Michael Margraf">
|
||||
<title>Qucs - Short Description</title>
|
||||
</head>
|
||||
|
||||
|
||||
|
||||
<body>
|
||||
<a name="top" id="top"></a>
|
||||
|
||||
<center><h3>
|
||||
- Qucs -<br>
|
||||
Qt universal circuit simulator<br>
|
||||
</h3>
|
||||
<h1>
|
||||
Short Description of Functions<br><br>
|
||||
</h1></center>
|
||||
|
||||
|
||||
<h3><img src="select.png"> "Select"-Mode</h3>
|
||||
(Menu: Edit->Select)<br>
|
||||
<table border=2>
|
||||
<tr><td>left mouse button</td>
|
||||
<td>Selects the element below the mouse cursor. If several components are placed
|
||||
there you can clicking several times in order to select the wanted one.<br>
|
||||
Keeping the mouse button pressed, you can move the component below the mouse cursor and
|
||||
all selected ones.<br>
|
||||
Keeping the mouse button pressed without any element below it opens a rectangle. After
|
||||
releasing the mouse button, all elements within this rectangle are selected.<br>
|
||||
A selected diagram can be resized by pressing the left mouse button over one of its
|
||||
corners and moving by keeping the button pressed.</td>
|
||||
</tr>
|
||||
<tr><td>left mouse button + Ctrl Button</td>
|
||||
<td>Allows more than one element to be selected, i.e. selecting an element does not
|
||||
deselect the others. Clicking on a selected element deselects it. This mode is also valid
|
||||
for selecting by opening a rectangle (see item before).</td>
|
||||
</tr>
|
||||
<tr><td>right mouse button</td>
|
||||
<td>Clicking on a wire selects a single straight line instead of the complete line.</td>
|
||||
</tr>
|
||||
<tr><td>double-click right mouse button</td>
|
||||
<td>Opens a dialog to edit the element properties (The labels of wires, the parameters of
|
||||
components, etc.).</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
|
||||
<br><br>
|
||||
<h3>"Insert Component"-Mode</h3>
|
||||
(Click on a component/diagram in the left area)<br>
|
||||
<table border=2>
|
||||
<tr><td>left mouse button</td>
|
||||
<td>Place a new instance of the component onto the schematic.</td>
|
||||
</tr>
|
||||
<tr><td>right mouse button</td>
|
||||
<td>Rotate the component. (Has no effect on diagrams.)</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
|
||||
<br><br>
|
||||
<h3><img src="wire.png"> "Wire"-Mode</h3>
|
||||
(Menu: Insert->Wire)<br>
|
||||
<table border=2>
|
||||
<tr><td>left mouse button</td>
|
||||
<td>Sets the starting/ending point of the wire.</td>
|
||||
</tr>
|
||||
<tr><td>right mouse button</td>
|
||||
<td>Changes the direction of the wire corner (first left/right or first up/down).</td>
|
||||
</tr>
|
||||
<tr><td>double-click right mouse button</td>
|
||||
<td>Ends a wire without being on a wire or a port.</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
|
||||
<br><br>
|
||||
<h3><img src="paste.png"> "Paste"-Mode</h3>
|
||||
(Menu: Edit->Paste)<br>
|
||||
<table border=2>
|
||||
<tr><td>left mouse button</td>
|
||||
<td>Place the elements onto the schematic (from the clipboard).</td>
|
||||
</tr>
|
||||
<tr><td>right mouse button</td>
|
||||
<td>Rotate the elements.</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
|
||||
<br><a href="#top">back to the top</a>
|
||||
</body>
|
||||
</html>
|
93
qucs-help/docs/en/start.html
Executable file
93
qucs-help/docs/en/start.html
Executable file
@ -0,0 +1,93 @@
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<meta http-equiv=Content-Type content="text/html; charset=iso-8859-1">
|
||||
<meta name="Author" content="Michael Margraf">
|
||||
<title>Qucs - Getting Started</title>
|
||||
</head>
|
||||
|
||||
|
||||
|
||||
<body>
|
||||
<a name="top" id="top"></a>
|
||||
|
||||
<center><h3>
|
||||
- Qucs -<br>
|
||||
Qt universal circuit simulator<br>
|
||||
</h3>
|
||||
<h1>
|
||||
Getting Started<br><br>
|
||||
</h1></center>
|
||||
|
||||
|
||||
Qucs (speak: kju:ks) is a circuit simulator with graphical user interface. It is able to
|
||||
perform many different kinds of simulation (e.g. DC, s parameter).
|
||||
This document should give you a short description on how to use Qucs.
|
||||
<br><br>
|
||||
When you start Qucs the first time, it creates the directory ".qucs" within your home
|
||||
directory. Every file is saved into this directory or into one of its subdirectories.
|
||||
After Qucs has been loaded, one sees the main window looking simular like the one in
|
||||
figure 1. On the right side, there is the working area (6) containing the schematics,
|
||||
data displays and so on. Using the tabular bar (5) above this area, you can quickly
|
||||
switch to every document currently open. On the left side of the Qucs main window, there
|
||||
is another area (1), whose content depend on the status of the above-lying tabular bar:
|
||||
"Projects" (2), "Content" (3) and "Components" (4). After running Qucs, the "Projects"
|
||||
(2) tab is activated. As it is the first time you started this program, the area is empty
|
||||
because you haven't yet any project. Press the "New" button right above the area (1) and
|
||||
a dialog opens. Enter the name for your first project, e.g. "firstProject" and press
|
||||
the "Ok" button. Qucs creates a project directory into the ~/.qucs directory, for this example
|
||||
"firstProject_prj". Every file belonging to this new project will be saved within this
|
||||
directory. The new project is immediately opend (as can be read on the window title bar)
|
||||
and the tabular bar is switched to "Content" (3), where the content of the currently
|
||||
opened project is displayed. You do not yet have any document, so press save button on
|
||||
the toolbar (or use the main menu: File->Save) in order to save the untitled document
|
||||
that still fills the working area (6). You will be ask for the name of your new document.
|
||||
Enter "firstSchematic" and press the "Ok" button.
|
||||
<br><br>
|
||||
|
||||
<center>
|
||||
<img src="qucsmain.png"><br>Figure 1 - Qucs main window<br><br>
|
||||
</center>
|
||||
|
||||
<br>
|
||||
Now we want to make a simple DC simulation, i.e. we want to analyse the circuit in figure
|
||||
(1). Activate the "Components" tab ( (4) in figure 1). There, you see a combo box where
|
||||
you can choose a component group and, below, the components of the chosen component group.
|
||||
Choose "lumped components" and press on the first symbol: "Resistor". Moving the mouse cursor
|
||||
into the working area (6) you are carrying a drawing of a resistor symbol. Pressing the right
|
||||
mouse button rotates the symbol, pressing the left mouse button places the component onto
|
||||
the schematic. Repeat this process for all components shown in figure 1. The voltage source
|
||||
can be found in the "sources" component class, the ground symbol can be taken from "lumped
|
||||
components" class or from the toolbar, the wanted simulation is defined by the big
|
||||
simulation blocks found in the "simulations" component class. To edit the parameters
|
||||
of the second resistor, double-click on it. A dialog opens where you can change the
|
||||
resistance. Enter "100 Ohm" into the edit field on the right side and press enter.
|
||||
<br><br>
|
||||
To connect the components, press the wire toolbar button (or use the main menu: Insert->Wire).
|
||||
Move the cursor onto an open port (marked by the small red circles). Clicking on it starts
|
||||
the wire. Now move to the end point and click again. The components are now connected. If you
|
||||
want to change the corner direction of the wire, click on the right mouse button before
|
||||
setting the end point. You can also end a wire without pressing on an open port or on a wire:
|
||||
Just double-click the left mouse button.
|
||||
<br><br>
|
||||
Last but not least, you must label the node where you want Qucs to caculate the voltage.
|
||||
Press on the label toolbar button (or use the menu: Insert->Wire Label). Now click on the
|
||||
chosen wire. A dialog opens and you can enter the node name. Type "divide" and click the "Ok"
|
||||
button. Now the circuit should look like the one in figure 1.
|
||||
<br><br>
|
||||
To start the simulation press the simulate toolbar button (or use the menu:
|
||||
Simulation->Simulate). A window opens and shows the progress. After finishing the simulation
|
||||
successfully, the data display is opened. Normally, all this happens so fast that you only
|
||||
see a short flickering. Now you have to place a diagram to see the simulation results. On the
|
||||
left side the "diagrams" component class has already chosen automatically. Press on the
|
||||
"Tabular" item, move to the working area and place it by clicking the left mouse button.
|
||||
A dialog opens where you can choose what should be displayed by the new diagram. In the left
|
||||
area you see the node name you have defined: "divide". Double-click on it and it will be
|
||||
transfered to the right area. Leave the dialog by clicking the "Ok" button. Now you see the
|
||||
simulation result: 0.666667 volts. Wonderful, give yourself a clap on the shoulder!
|
||||
<br>
|
||||
|
||||
|
||||
<br><a href="#top">back to the top</a>
|
||||
</body>
|
||||
</html>
|
BIN
qucs-help/docs/en/wire.png
Normal file
BIN
qucs-help/docs/en/wire.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 263 B |
@ -54,7 +54,6 @@ TRANSFILES = $(TRANSLATIONS:.ts=.qm)
|
||||
|
||||
%.qm: %.ts
|
||||
$(LRELEASE) $<
|
||||
|
||||
# installation of translations
|
||||
langdatadir = ${prefix}/share/qucs/lang
|
||||
langdata_DATA = $(TRANSFILES)
|
||||
|
@ -160,7 +160,7 @@ void ComponentDialog::slotApplyChange(const QString& Text)
|
||||
// -------------------------------------------------------------------------
|
||||
void ComponentDialog::slotApplyProperty()
|
||||
{
|
||||
prop->currentItem()->setText(1, edit->text());
|
||||
prop->currentItem()->setText(1, edit->text()); // apply edit line
|
||||
|
||||
QListViewItem *item = prop->currentItem()->itemBelow();
|
||||
if(item == 0) {
|
||||
@ -194,6 +194,8 @@ void ComponentDialog::slotApplyInput()
|
||||
QListViewItem *item = prop->firstChild();
|
||||
if(item == 0) return;
|
||||
|
||||
prop->currentItem()->setText(1, edit->text()); // apply edit line to current item
|
||||
|
||||
bool display;
|
||||
// take all the new property values
|
||||
for(Property *pp = Comp->Props.first(); pp!=0; pp = Comp->Props.next()) {
|
||||
@ -207,7 +209,7 @@ void ComponentDialog::slotApplyInput()
|
||||
pp->display = display;
|
||||
changed = true;
|
||||
}
|
||||
|
||||
|
||||
item = item->itemBelow(); // next item
|
||||
}
|
||||
}
|
||||
|
@ -104,6 +104,11 @@ void Diagram::paint(QPainter *p)
|
||||
if(isSelected) {
|
||||
p->setPen(QPen(QPen::darkGray,3));
|
||||
p->drawRoundRect(cx-5, cy-y2-5, x2+10, y2+10);
|
||||
p->setPen(QPen(QPen::darkRed,2));
|
||||
p->drawRect(cx, cy-y2, 10, 10); // markers for changing the size
|
||||
p->drawRect(cx, cy-10, 10, 10);
|
||||
p->drawRect(cx+x2-10, cy-y2, 10, 10);
|
||||
p->drawRect(cx+x2-10, cy-10, 10, 10);
|
||||
}
|
||||
}
|
||||
|
||||
@ -132,6 +137,37 @@ void Diagram::Bounding(int& _x1, int& _y1, int& _x2, int& _y2)
|
||||
_y2 = cy;
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------
|
||||
// Checks if the resize area was clicked. If so return "true" and sets x1/y1 and x2/y2
|
||||
// to the border coordinates to draw a rectangle.
|
||||
bool Diagram::ResizeTouched(int& MAx1, int& MAy1, int& MAx2, int& MAy2)
|
||||
{
|
||||
int _x1, _y1, _x2, _y2;
|
||||
|
||||
if(MAx1 < cx+10) {
|
||||
_x2 = -x2;
|
||||
_x1 = cx-_x2;
|
||||
}
|
||||
else {
|
||||
if(MAx1 <= cx+x2-10) return false;
|
||||
_x2 = x2;
|
||||
_x1 = cx;
|
||||
}
|
||||
if(MAy1 > cy-10) {
|
||||
_y2 = y2;
|
||||
_y1 = cy-_y2;
|
||||
}
|
||||
else {
|
||||
if(MAy1 >= cy-y2+10) return false;
|
||||
_y2 = -y2;
|
||||
_y1 = cy;
|
||||
}
|
||||
|
||||
MAx1 = _x1; MAy1 = _y1;
|
||||
MAx2 = _x2; MAy2 = _y2;
|
||||
return true;
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------------
|
||||
void Diagram::loadGraphData(const QString& defaultDataSet)
|
||||
{
|
||||
@ -140,8 +176,6 @@ void Diagram::loadGraphData(const QString& defaultDataSet)
|
||||
|
||||
for(Graph *pg = Graphs.first(); pg != 0; pg = Graphs.next())
|
||||
loadVarData(defaultDataSet); // load data and determine max and min values
|
||||
//QMessageBox::critical(0, "Error", QString::number(xmin)+" "+QString::number(xmax)+" * "+QString::number(ymin)+" "+QString::number(ymax));
|
||||
//QMessageBox::critical(0, "Error", Name);
|
||||
|
||||
calcDiagram();
|
||||
|
||||
@ -149,6 +183,15 @@ void Diagram::loadGraphData(const QString& defaultDataSet)
|
||||
calcData(pg); // calculate graph coordinates
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------------
|
||||
void Diagram::updateGraphData()
|
||||
{
|
||||
calcDiagram();
|
||||
|
||||
for(Graph *pg = Graphs.first(); pg != 0; pg = Graphs.next())
|
||||
calcData(pg); // calculate graph coordinates
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------------
|
||||
bool Diagram::loadVarData(const QString& fileName)
|
||||
{
|
||||
|
@ -42,9 +42,11 @@ public:
|
||||
virtual void setCenter(int x, int y, bool relative=false);
|
||||
void paint(QPainter *p);
|
||||
void Bounding(int& _x1, int& _y1, int& _x2, int& _y2);
|
||||
bool ResizeTouched(int& MAx1, int& MAy1, int& MAx2, int& MAy2);
|
||||
QString save();
|
||||
bool load(const QString& Line, QTextStream *stream);
|
||||
|
||||
void updateGraphData();
|
||||
void loadGraphData(const QString& defaultDataSet);
|
||||
bool loadVarData(const QString& fileName);
|
||||
int loadIndepVarData(const QString& var, const QString& fileName);
|
||||
|
@ -71,7 +71,7 @@ void RectDiagram::calcDiagram()
|
||||
z += GridX;
|
||||
}
|
||||
Texts.append(new Text(0, -15, QString::number(xmin)));
|
||||
Texts.append(new Text(z, -15, QString::number(xmax)));
|
||||
Texts.append(new Text(x2, -15, QString::number(xmax)));
|
||||
|
||||
z=y2-GridY;
|
||||
while(z >= 0) {
|
||||
@ -86,7 +86,7 @@ void RectDiagram::calcDiagram()
|
||||
Lines.append(new Line(0, y2, 0, 0, QPen(QPen::black,1)));
|
||||
|
||||
Texts.append(new Text(-20, y2, QString::number(ymax)));
|
||||
Texts.append(new Text(-20, 0, QString::number(ymin)));
|
||||
Texts.append(new Text(-20, 0, QString::number(ymin)));
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------
|
||||
|
@ -54,18 +54,88 @@ void TabDiagram::calcDiagram()
|
||||
Lines.append(new Line(x2, y2, x2, 0, QPen(QPen::black,1)));
|
||||
Lines.append(new Line(0, 0, x2, 0, QPen(QPen::black,1)));
|
||||
|
||||
Graph *g = Graphs.getFirst();
|
||||
Graph *g = Graphs.first();
|
||||
if(g == 0) return;
|
||||
|
||||
int y = y2-30;
|
||||
Texts.append(new Text( 4, y2-13, g->IndepVar));
|
||||
Texts.append(new Text(84, y2-13, g->Line));
|
||||
QWidget w;
|
||||
QPainter p(&w);
|
||||
p.setFont(QFont("Helvetica",12, QFont::Light));
|
||||
QString Str;
|
||||
QRect r;
|
||||
int colWidth=0, x=8, y = y2-30;
|
||||
|
||||
// ................................................
|
||||
Str = g->IndepVar;
|
||||
r = p.boundingRect(0,0,0,0,Qt::AlignAuto,Str); // get width of text
|
||||
if(r.width() > colWidth) {
|
||||
colWidth = r.width();
|
||||
if((x+colWidth) >= x2) { // enough space for text ?
|
||||
Lines.append(new Line(x2-6, y2-4, x2+7, y2-4, QPen(QPen::red,2))); // mark lack of space
|
||||
Lines.append(new Line(x2, y2-7, x2+6, y2-4, QPen(QPen::red,2))); // with a small arrow
|
||||
Lines.append(new Line(x2, y2-1, x2+6, y2-4, QPen(QPen::red,2)));
|
||||
return;
|
||||
}
|
||||
}
|
||||
Texts.append(new Text( 4, y2-13, Str)); // write independent variable
|
||||
|
||||
for(cPoint *cp = g->cPoints.first(); cp != 0; cp = g->cPoints.next()) {
|
||||
Texts.append(new Text( 4, y, QString::number(cp->x)));
|
||||
Texts.append(new Text(84, y, QString::number(cp->yr)+"/"+QString::number(cp->yi)));
|
||||
Str = QString::number(cp->x);
|
||||
r = p.boundingRect(0,0,0,0,Qt::AlignAuto,Str); // get width of text
|
||||
if(r.width() > colWidth) {
|
||||
colWidth = r.width();
|
||||
if((x+colWidth) >= x2) { // enough space for text ?
|
||||
Lines.append(new Line(x2-6, y-4, x2+7, y-4, QPen(QPen::red,2))); // mark lack of space
|
||||
Lines.append(new Line(x2, y-7, x2+6, y-4, QPen(QPen::red,2))); // with a small arrow
|
||||
Lines.append(new Line(x2, y-1, x2+6, y-4, QPen(QPen::red,2)));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
Texts.append(new Text( x, y, Str));
|
||||
y -= 14;
|
||||
if(y < 0) break;
|
||||
}
|
||||
x += colWidth+10;
|
||||
Lines.append(new Line(x-8, y2, x-8, 0, QPen(QPen::black,2)));
|
||||
|
||||
// ................................................
|
||||
for(; g!=0; g = Graphs.next()) { // write all dependent variables
|
||||
int y = y2-30;
|
||||
colWidth = 0;
|
||||
|
||||
Str = g->Line;
|
||||
r = p.boundingRect(0,0,0,0,Qt::AlignAuto,Str); // get width of text
|
||||
if(r.width() > colWidth) {
|
||||
colWidth = r.width();
|
||||
if((x+colWidth) >= x2) { // enough space for text ?
|
||||
Lines.append(new Line(x2-6, y2-4, x2+7, y2-4, QPen(QPen::red,2))); // mark lack of space
|
||||
Lines.append(new Line(x2, y2-7, x2+6, y2-4, QPen(QPen::red,2))); // with a small arrow
|
||||
Lines.append(new Line(x2, y2-1, x2+6, y2-4, QPen(QPen::red,2)));
|
||||
return;
|
||||
}
|
||||
}
|
||||
Texts.append(new Text(x, y2-13, Str));
|
||||
|
||||
for(cPoint *cp = g->cPoints.first(); cp != 0; cp = g->cPoints.next()) {
|
||||
Str = QString::number(cp->yr)+"/"+QString::number(cp->yi);
|
||||
r = p.boundingRect(0,0,0,0,Qt::AlignAuto,Str); // get width of text
|
||||
if(r.width() > colWidth) {
|
||||
colWidth = r.width();
|
||||
if((x+colWidth) >= x2) { // enough space for text ?
|
||||
Lines.append(new Line(x2-6, y-4, x2+7, y-4, QPen(QPen::red,2))); // mark lack of space
|
||||
Lines.append(new Line(x2, y-7, x2+6, y-4, QPen(QPen::red,2))); // with a small arrow
|
||||
Lines.append(new Line(x2, y-1, x2+6, y-4, QPen(QPen::red,2)));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
Texts.append(new Text(x, y, Str));
|
||||
y -= 14;
|
||||
if(y < 0) break;
|
||||
}
|
||||
x += colWidth+10;
|
||||
Lines.append(new Line(x-8, y2, x-8, 0, QPen(QPen::black,1)));
|
||||
}
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------
|
||||
|
67
qucs/helpdialog.cpp
Normal file
67
qucs/helpdialog.cpp
Normal file
@ -0,0 +1,67 @@
|
||||
/***************************************************************************
|
||||
helpdialog.cpp - description
|
||||
-------------------
|
||||
begin : Sun Jan 11 2004
|
||||
copyright : (C) 2004 by Michael Margraf
|
||||
email : margraf@mwt.ee.tu-berlin.de
|
||||
***************************************************************************/
|
||||
|
||||
/***************************************************************************
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation; either version 2 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
***************************************************************************/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include "helpdialog.h"
|
||||
|
||||
#include <qpushbutton.h>
|
||||
#include <qlayout.h>
|
||||
#include <qhbox.h>
|
||||
|
||||
|
||||
HelpDialog::HelpDialog(const QString& page, QWidget *parent, const char *name )
|
||||
: QDialog(parent, name, Qt::WDestructiveClose)
|
||||
{
|
||||
setCaption(tr("Qucs Help System"));
|
||||
|
||||
QVBoxLayout *v = new QVBoxLayout(this);
|
||||
v->setSpacing(5);
|
||||
|
||||
text = new QTextBrowser(this);
|
||||
text->setMinimumSize(600,300);
|
||||
v->addWidget(text);
|
||||
text->setSource(DOCDIR +page);
|
||||
|
||||
QHBox *h = new QHBox(this);
|
||||
h->setSpacing(5);
|
||||
v->addWidget(h);
|
||||
QWidget *st = new QWidget(h); // stretchable placeholder
|
||||
h->setStretchFactor(st,5);
|
||||
|
||||
QPushButton *ButtIndex = new QPushButton(tr("Help Index"),h);
|
||||
connect(ButtIndex, SIGNAL(clicked()), SLOT(slotGotoIndex()));
|
||||
QPushButton *ButtClose = new QPushButton(tr("Close"),h);
|
||||
connect(ButtClose, SIGNAL(clicked()), SLOT(slotClose()));
|
||||
ButtClose->setFocus();
|
||||
}
|
||||
|
||||
HelpDialog::~HelpDialog()
|
||||
{
|
||||
}
|
||||
|
||||
void HelpDialog::slotGotoIndex()
|
||||
{
|
||||
text->setSource(DOCDIR "index.html");
|
||||
}
|
||||
|
||||
void HelpDialog::slotClose()
|
||||
{
|
||||
done(0); // close and delete (because of WDestructiveClose)
|
||||
}
|
43
qucs/helpdialog.h
Normal file
43
qucs/helpdialog.h
Normal file
@ -0,0 +1,43 @@
|
||||
/***************************************************************************
|
||||
helpdialog.h - description
|
||||
-------------------
|
||||
begin : Sun Jan 11 2004
|
||||
copyright : (C) 2004 by Michael Margraf
|
||||
email : margraf@mwt.ee.tu-berlin.de
|
||||
***************************************************************************/
|
||||
|
||||
/***************************************************************************
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation; either version 2 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
***************************************************************************/
|
||||
|
||||
#ifndef HELPDIALOG_H
|
||||
#define HELPDIALOG_H
|
||||
|
||||
#include <qdialog.h>
|
||||
#include <qtextbrowser.h>
|
||||
|
||||
|
||||
/**
|
||||
*@author Michael Margraf
|
||||
*/
|
||||
|
||||
class HelpDialog : public QDialog {
|
||||
Q_OBJECT
|
||||
public:
|
||||
HelpDialog(const QString& page, QWidget *parent=0, const char *name=0);
|
||||
~HelpDialog();
|
||||
|
||||
private slots:
|
||||
void slotGotoIndex();
|
||||
void slotClose();
|
||||
|
||||
private:
|
||||
QTextBrowser *text;
|
||||
};
|
||||
|
||||
#endif
|
@ -28,6 +28,7 @@
|
||||
#include "messagebox.h"
|
||||
#include "fileshowdialog.h"
|
||||
#include "paintings/paintings.h"
|
||||
#include "helpdialog.h"
|
||||
|
||||
#include <qaccel.h>
|
||||
#include <qimage.h>
|
||||
@ -317,6 +318,16 @@ void QucsApp::initActions()
|
||||
viewStatusBar->setWhatsThis(tr("Statusbar\n\nEnables/disables the statusbar"));
|
||||
connect(viewStatusBar, SIGNAL(toggled(bool)), this, SLOT(slotViewStatusBar(bool)));
|
||||
|
||||
helpIndex = new QAction(tr("Help Index"), tr("Help Index..."), 0, this);
|
||||
helpIndex->setStatusTip(tr("Index of Qucs Help"));
|
||||
helpIndex->setWhatsThis(tr("Help Index\n\nIndex of intern Qucs help"));
|
||||
connect(helpIndex, SIGNAL(activated()), this, SLOT(slotHelpIndex()));
|
||||
|
||||
helpGetStart = new QAction(tr("Getting Started"), tr("Getting Started..."), 0, this);
|
||||
helpGetStart->setStatusTip(tr("Getting Started with Qucs"));
|
||||
helpGetStart->setWhatsThis(tr("Getting Started\n\nShort introduction into Qucs"));
|
||||
connect(helpGetStart, SIGNAL(activated()), this, SLOT(slotGettingStarted()));
|
||||
|
||||
helpAboutApp = new QAction(tr("About"), tr("&About Qucs..."), 0, this);
|
||||
helpAboutApp->setStatusTip(tr("About the application"));
|
||||
helpAboutApp->setWhatsThis(tr("About\n\nAbout the application"));
|
||||
@ -398,6 +409,9 @@ void QucsApp::initMenuBar()
|
||||
viewStatusBar->addTo(viewMenu);
|
||||
|
||||
helpMenu=new QPopupMenu(); // menuBar entry helpMenu
|
||||
helpIndex->addTo(helpMenu);
|
||||
helpGetStart->addTo(helpMenu);
|
||||
helpMenu->insertSeparator();
|
||||
helpAboutApp->addTo(helpMenu);
|
||||
helpAboutQt->addTo(helpMenu);
|
||||
|
||||
@ -992,6 +1006,20 @@ void QucsApp::slotViewStatusBar(bool toggle)
|
||||
statusBar()->message(tr("Ready."));
|
||||
}
|
||||
|
||||
// ###################################################################################
|
||||
void QucsApp::slotHelpIndex()
|
||||
{
|
||||
HelpDialog *d = new HelpDialog("index.html",this);
|
||||
d->show();
|
||||
}
|
||||
|
||||
// ###################################################################################
|
||||
void QucsApp::slotGettingStarted()
|
||||
{
|
||||
HelpDialog *d = new HelpDialog("start.html",this);
|
||||
d->show();
|
||||
}
|
||||
|
||||
// ###################################################################################
|
||||
void QucsApp::slotHelpAbout()
|
||||
{
|
||||
@ -1337,8 +1365,10 @@ int QucsApp::testFile(const QString& DocName)
|
||||
}
|
||||
|
||||
QString s = VERSION;
|
||||
s.remove('.');
|
||||
Line = Line.mid(16, Line.length()-17);
|
||||
if(Line != s) { // wrong version number ?
|
||||
Line.remove('.');
|
||||
if(Line > s) { // wrong version number ? (only backward compatible)
|
||||
file.close();
|
||||
return -4;
|
||||
}
|
||||
@ -1775,14 +1805,21 @@ void QucsApp::slotInsertLabel(bool on)
|
||||
void QucsApp::slotSelect(bool on)
|
||||
{
|
||||
if(!on) {
|
||||
if(!view->movingElements.isEmpty()) // elements are moving ?
|
||||
view->endElementMoving(); // place them
|
||||
else if(view->MouseMoveAction == &QucsView::MMoveSelect) { // do not disturb diagram resize
|
||||
activeAction->blockSignals(true); // do not call toggle slot
|
||||
activeAction->setOn(true); // set back select on
|
||||
activeAction->blockSignals(false);
|
||||
return;
|
||||
}
|
||||
|
||||
view->MouseMoveAction = &QucsView::MouseDoNothing;
|
||||
view->MousePressAction = &QucsView::MouseDoNothing;
|
||||
view->MouseReleaseAction = &QucsView::MouseDoNothing;
|
||||
view->MouseDoubleClickAction = &QucsView::MouseDoNothing;
|
||||
activeAction = 0; // no action active
|
||||
|
||||
if(!view->movingElements.isEmpty()) // elements are moving ?
|
||||
view->endElementMoving(); // place them
|
||||
return;
|
||||
}
|
||||
if(activeAction) {
|
||||
|
@ -95,8 +95,10 @@ class QucsApp : public QMainWindow
|
||||
void slotViewToolBar(bool toggle); // toggle the toolbar
|
||||
void slotViewStatusBar(bool toggle); // toggle the statusbar
|
||||
|
||||
void slotHelpAbout(); // shows an about dialog
|
||||
void slotHelpAboutQt(); // shows the standard about dialog for Qt
|
||||
void slotHelpIndex(); // shows a HTML docu: Help Index
|
||||
void slotGettingStarted(); // shows a HTML docu: Getting started
|
||||
void slotHelpAbout(); // shows an about dialog
|
||||
void slotHelpAboutQt(); // shows the standard about dialog for Qt
|
||||
|
||||
void slotIntoHierarchy();
|
||||
void slotPopHierarchy();
|
||||
@ -159,7 +161,7 @@ class QucsApp : public QMainWindow
|
||||
QAction *select, *editRotate, *editMirror, *editMirrorY, *intoH, *popH, *editActivate, *wire;
|
||||
QAction *editDelete, *simulate, *dpl_sch, *selectAll, *showMsg, *showNet;
|
||||
QAction *viewToolBar, *viewStatusBar;
|
||||
QAction *helpAboutApp, *helpAboutQt;
|
||||
QAction *helpAboutApp, *helpAboutQt, *helpIndex, *helpGetStart;
|
||||
|
||||
QAction *activeAction; // pointer to the action selected by the user
|
||||
|
||||
|
@ -2100,8 +2100,10 @@ bool QucsDoc::load()
|
||||
}
|
||||
|
||||
QString s = VERSION;
|
||||
s.remove('.');
|
||||
Line = Line.mid(16, Line.length()-17);
|
||||
if(Line != s) { // wrong version number ?
|
||||
Line.remove('.');
|
||||
if(Line > s) { // wrong version number ? (only backward compatible)
|
||||
file.close();
|
||||
QMessageBox::critical(0, QObject::tr("Error"), QObject::tr("Wrong document version: ")+Line);
|
||||
return false;
|
||||
|
@ -25,6 +25,7 @@
|
||||
#include <qmessagebox.h>
|
||||
|
||||
#include <limits.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
|
||||
//QucsView::QucsView(QWidget *parent, const char *name, WFlags f) : QScrollView(parent,name,f)
|
||||
@ -48,6 +49,7 @@ QucsView::QucsView(QWidget *parent) : QScrollView(parent)
|
||||
selComp = 0; // no component is selected
|
||||
selDiag = 0; // no diagram is selected
|
||||
selPaint = 0; // no painting is selected
|
||||
isMoveEqual = false; // mouse cursor move x and y the same way
|
||||
|
||||
Docs.setAutoDelete(true);
|
||||
|
||||
@ -280,6 +282,7 @@ void QucsView::MMoveDiagram(QMouseEvent *Event)
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------
|
||||
// Paints a rectangle to select elements within it.
|
||||
void QucsView::MMoveSelect(QMouseEvent *Event)
|
||||
{
|
||||
QucsDoc *d = Docs.current();
|
||||
@ -290,6 +293,9 @@ void QucsView::MMoveSelect(QMouseEvent *Event)
|
||||
drawn = true;
|
||||
MAx2 = int(Event->pos().x()/d->Scale) + d->ViewX1 - MAx1;
|
||||
MAy2 = int(Event->pos().y()/d->Scale) + d->ViewY1 - MAy1;
|
||||
if(isMoveEqual) // x and y size must be equal ?
|
||||
if(abs(MAx2) > abs(MAy2)) { if(MAx2<0) MAx2 = -abs(MAy2); else MAx2 = abs(MAy2); }
|
||||
else { if(MAy2<0) MAy2 = -abs(MAx2); else MAy2 = abs(MAx2); }
|
||||
painter.drawRect(MAx1, MAy1, MAx2, MAy2); // paint new rectangle
|
||||
}
|
||||
|
||||
@ -318,10 +324,10 @@ void QucsView::MMoveMoving(QMouseEvent *Event)
|
||||
if(pe->Type == isWire) {
|
||||
pw = (Wire*)pe; // connecting wires are only moved with one node
|
||||
|
||||
if(int(pw->Port1) > 3) { pw->x1 += MAx1; pw->y1 += MAy1; }
|
||||
if(int(pw->Port1) > 3) { pw->x1 += MAx1; pw->y1 += MAy1; pw->nx += MAx1; pw->ny += MAy1; }
|
||||
else {
|
||||
if(int(pw->Port1) & 1) pw->x1 += MAx1;
|
||||
if(int(pw->Port1) & 2) pw->y1 += MAy1;
|
||||
if(int(pw->Port1) & 1) { pw->x1 += MAx1; pw->nx += MAx1; }
|
||||
if(int(pw->Port1) & 2) { pw->y1 += MAy1; pw->ny += MAy1; }
|
||||
}
|
||||
|
||||
if(int(pw->Port2) > 3) { pw->x2 += MAx1; pw->y2 += MAy1; }
|
||||
@ -329,9 +335,12 @@ void QucsView::MMoveMoving(QMouseEvent *Event)
|
||||
if(int(pw->Port2) & 1) pw->x2 += MAx1;
|
||||
if(int(pw->Port2) & 2) pw->y2 += MAy1;
|
||||
}
|
||||
|
||||
int l = pw->x2-pw->x1+pw->y2-pw->y1;
|
||||
if(pw->delta > l) pw->delta = l-4; // root of node label must lie on wire
|
||||
}
|
||||
else pe->setCenter(MAx1, MAy1, true);
|
||||
|
||||
|
||||
pe->paintScheme(&painter);
|
||||
}
|
||||
|
||||
@ -368,13 +377,16 @@ void QucsView::MMoveMoving2(QMouseEvent *Event)
|
||||
if(pe->Type == isWire) {
|
||||
pw = (Wire*)pe; // connecting wires are not moved completely
|
||||
|
||||
if(int(pw->Port1) > 3) { pw->x1 += MAx1; pw->y1 += MAy1; }
|
||||
else { if(int(pw->Port1) & 1) pw->x1 += MAx1;
|
||||
if(int(pw->Port1) & 2) pw->y1 += MAy1; }
|
||||
if(int(pw->Port1) > 3) { pw->x1 += MAx1; pw->y1 += MAy1; pw->nx += MAx1; pw->ny += MAy1; }
|
||||
else { if(int(pw->Port1) & 1) { pw->x1 += MAx1; pw->nx += MAx1; }
|
||||
if(int(pw->Port1) & 2) { pw->y1 += MAy1; pw->ny += MAy1; } }
|
||||
|
||||
if(int(pw->Port2) > 3) { pw->x2 += MAx1; pw->y2 += MAy1; }
|
||||
else { if(int(pw->Port2) & 1) pw->x2 += MAx1;
|
||||
if(int(pw->Port2) & 2) pw->y2 += MAy1; }
|
||||
|
||||
int l = pw->x2-pw->x1+pw->y2-pw->y1;
|
||||
if(pw->delta > l) pw->delta = l-4; // root of node label must lie on wire
|
||||
}
|
||||
else pe->setCenter(MAx1, MAy1, true);
|
||||
|
||||
@ -471,14 +483,28 @@ void QucsView::MPressSelect(QMouseEvent *Event)
|
||||
viewport()->repaint();
|
||||
if(Event->button() != Qt::LeftButton) return;
|
||||
if(focusElement == 0) {
|
||||
MAx2 = 0; // if not clicking on a component => open a rectangle
|
||||
MAx2 = 0; // if not clicking on an element => open a rectangle
|
||||
MAy2 = 0;
|
||||
MouseReleaseAction = &QucsView::MReleaseSelect2;
|
||||
MouseMoveAction = &QucsView::MMoveSelect;
|
||||
MousePressAction = &QucsView::MouseDoNothing;
|
||||
MouseDoubleClickAction = &QucsView::MouseDoNothing;
|
||||
}
|
||||
else { // component could be moved
|
||||
else { // element could be moved
|
||||
|
||||
if(focusElement->Type == isDiagram) // resize diagram ?
|
||||
if(((Diagram*)focusElement)->ResizeTouched(MAx1, MAy1, MAx2, MAy2)) {
|
||||
if(((Diagram*)focusElement)->Name == "Polar") isMoveEqual = true; // diagram must be square
|
||||
else if(((Diagram*)focusElement)->Name == "Smith") isMoveEqual = true;
|
||||
|
||||
Docs.current()->setOnGrid(MAx1, MAy1);
|
||||
MouseReleaseAction = &QucsView::MReleaseResizeDiagram;
|
||||
MouseMoveAction = &QucsView::MMoveSelect;
|
||||
MousePressAction = &QucsView::MouseDoNothing;
|
||||
MouseDoubleClickAction = &QucsView::MouseDoNothing;
|
||||
return;
|
||||
}
|
||||
|
||||
Docs.current()->setOnGrid(MAx1, MAy1);
|
||||
MouseMoveAction = &QucsView::MMoveMoving;
|
||||
MousePressAction = &QucsView::MouseDoNothing;
|
||||
@ -635,14 +661,15 @@ void QucsView::MPressComponent(QMouseEvent *Event)
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------
|
||||
void QucsView::MPressDiagram(QMouseEvent *)
|
||||
void QucsView::MPressDiagram(QMouseEvent *Event)
|
||||
{
|
||||
QucsDoc *d = Docs.current();
|
||||
QPainter painter(viewport());
|
||||
setPainter(&painter, d);
|
||||
|
||||
if(selDiag == 0) return;
|
||||
|
||||
if(Event->button() != Qt::LeftButton) return;
|
||||
|
||||
DiagramDialog *dia = new DiagramDialog(selDiag, d->DataSet);
|
||||
if(dia->exec() == QDialog::Rejected) { // don't insert a diagram if dialog canceled
|
||||
delete dia;
|
||||
@ -857,6 +884,40 @@ void QucsView::MReleaseMoving(QMouseEvent *Event)
|
||||
MouseDoubleClickAction = &QucsView::MDoubleClickSelect;
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------
|
||||
void QucsView::MReleaseResizeDiagram(QMouseEvent *Event)
|
||||
{
|
||||
if(Event->button() != Qt::LeftButton) return;
|
||||
|
||||
if(MAx2 < 0) { // resize diagram
|
||||
focusElement->x2 = -MAx2;
|
||||
focusElement->cx = MAx1+MAx2;
|
||||
}
|
||||
else {
|
||||
focusElement->x2 = MAx2;
|
||||
focusElement->cx = MAx1;
|
||||
}
|
||||
if(MAy2 < 0) {
|
||||
focusElement->y2 = -MAy2;
|
||||
focusElement->cy = MAy1;
|
||||
}
|
||||
else {
|
||||
focusElement->y2 = MAy2;
|
||||
focusElement->cy = MAy1+MAy2;
|
||||
}
|
||||
((Diagram*)focusElement)->updateGraphData();
|
||||
isMoveEqual = false;
|
||||
Docs.current()->setChanged(true);
|
||||
|
||||
MouseMoveAction = &QucsView::MouseDoNothing;
|
||||
MousePressAction = &QucsView::MPressSelect;
|
||||
MouseReleaseAction = &QucsView::MReleaseSelect;
|
||||
MouseDoubleClickAction = &QucsView::MDoubleClickSelect;
|
||||
|
||||
viewport()->repaint();
|
||||
drawn = false;
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------
|
||||
void QucsView::endElementMoving()
|
||||
{
|
||||
@ -989,16 +1050,13 @@ void QucsView::contentsMouseDoubleClickEvent(QMouseEvent *Event)
|
||||
// -----------------------------------------------------------
|
||||
void QucsView::MDoubleClickSelect(QMouseEvent *Event)
|
||||
{
|
||||
if(focusElement == 0) { // if no component was double clicked, try the wires
|
||||
MPressLabel(Event);
|
||||
return;
|
||||
}
|
||||
|
||||
if(focusElement == 0) return; // if no component was double clicked, try the wires
|
||||
|
||||
Component *c;
|
||||
Diagram *dia;
|
||||
ComponentDialog *d;
|
||||
DiagramDialog *ddia;
|
||||
|
||||
|
||||
switch(focusElement->Type) {
|
||||
case isComponent: c = (Component*)focusElement;
|
||||
if(c->Sign == "GND") return;
|
||||
@ -1009,7 +1067,7 @@ void QucsView::MDoubleClickSelect(QMouseEvent *Event)
|
||||
Docs.current()->Comps.take();
|
||||
x1 = Docs.current()->getComponentPos(c); // for ports and power sources
|
||||
Docs.current()->Comps.insert(x1, c); // insert at appropriate position
|
||||
|
||||
|
||||
Docs.current()->setChanged(true);
|
||||
c->entireBounds(x1,y1,x2,y2);
|
||||
enlargeView(x1,y1,x2,y2);
|
||||
@ -1024,6 +1082,9 @@ void QucsView::MDoubleClickSelect(QMouseEvent *Event)
|
||||
delete ddia;
|
||||
break;
|
||||
|
||||
case isWire: MPressLabel(Event);
|
||||
break;
|
||||
|
||||
case isPainting: if( ((Painting*)focusElement)->Dialog() )
|
||||
Docs.current()->setChanged(true);
|
||||
break;
|
||||
|
@ -113,6 +113,7 @@ public:
|
||||
void MReleaseSelect2(QMouseEvent *Event);
|
||||
void MReleaseActivate(QMouseEvent *Event);
|
||||
void MReleaseMoving(QMouseEvent *Event);
|
||||
void MReleaseResizeDiagram(QMouseEvent *Event);
|
||||
void MReleasePaste(QMouseEvent *);
|
||||
void (QucsView::*MouseReleaseAction) (QMouseEvent*); // pointer to current mouse release button method
|
||||
|
||||
@ -125,6 +126,7 @@ signals:
|
||||
|
||||
private:
|
||||
int MAx1, MAy1,MAx2, MAy2, MAx3, MAy3; // cache for mouse movements
|
||||
bool isMoveEqual;
|
||||
Element *focusElement;
|
||||
};
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user