My Project  0.0.16
QUCS Mapping
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
diagramdialog.cpp
Go to the documentation of this file.
1 /***************************************************************************
2  diagramdialog.cpp
3  -------------------
4  begin : Sun Oct 5 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 #include "diagramdialog.h"
19 #include "qucs.h"
20 #include "schematic.h"
21 #include "rect3ddiagram.h"
22 
23 #include <math.h>
24 
25 #include <qvbox.h>
26 #include <qlayout.h>
27 #include <qhbuttongroup.h>
28 #include <qvbuttongroup.h>
29 #include <qhgroupbox.h>
30 #include <qpushbutton.h>
31 #include <qtabwidget.h>
32 #include <qlabel.h>
33 #include <qstringlist.h>
34 #include <qmessagebox.h>
35 #include <qptrlist.h>
36 #include <qvalidator.h>
37 #include <qcolordialog.h>
38 #include <qlineedit.h>
39 #include <qcheckbox.h>
40 #include <qslider.h>
41 #include <qcombobox.h>
42 #include <qlistview.h>
43 #include <qlistbox.h>
44 
45 
46 #define CROSS3D_SIZE 30
47 #define WIDGET3D_SIZE 2*CROSS3D_SIZE
48 // This widget class paints a small 3-dimensional coordinate cross.
49 class Cross3D : public QWidget {
50 public:
51  Cross3D(float rx_, float ry_, float rz_, QWidget *parent = 0)
52  : QWidget(parent) {
53  rotX = rx_;
54  rotY = ry_;
55  rotZ = rz_;
56  setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum);
57  setMinimumSize(WIDGET3D_SIZE, WIDGET3D_SIZE);
59  };
60  ~Cross3D() {};
61 
62  double rotX, rotY, rotZ; // in radians !!!!
63 
64 private:
65  void paintEvent(QPaintEvent*) {
66  QPainter Painter(this);
67  float cxx = cos(rotZ);
68  float cxy = sin(rotZ);
69  float cxz = sin(rotY);
70  float cyz = sin(rotX);
71  float cyy = cos(rotX);
72  float cyx = cyy * cxy + cyz * cxz * cxx;
73  cyy = cyy * cxx - cyz * cxz * cxy;
74  cyz *= cos(rotY);
75  cxx *= cos(rotY);
76  cxy *= cos(rotY);
77 
78  Painter.setPen(QPen(QPen::red,2));
79  Painter.drawLine(CROSS3D_SIZE, CROSS3D_SIZE,
80  int(CROSS3D_SIZE * (1.0+cxx)),
81  int(CROSS3D_SIZE * (1.0-cyx)));
82  Painter.setPen(QPen(QPen::green,2));
83  Painter.drawLine(CROSS3D_SIZE, CROSS3D_SIZE,
84  int(CROSS3D_SIZE * (1.0-cxy)),
85  int(CROSS3D_SIZE * (1.0-cyy)));
86  Painter.setPen(QPen(QPen::blue,2));
87  Painter.drawLine(CROSS3D_SIZE, CROSS3D_SIZE,
88  int(CROSS3D_SIZE * (1.0+cxz)),
89  int(CROSS3D_SIZE * (1.0+cyz)));
90  };
91 };
92 
93 
94 
95 // standard colors: blue, red, magenta, green, cyan, yellow, black
96 // (white is only a dummy)
97 static const QRgb DefaultColors[]
98  = {0x0000ff, 0xff0000, 0xff00ff, 0x00ff00, 0x00ffff, 0xffff00,
99  0xffffff, 0x000000};
100 
101 
102 DiagramDialog::DiagramDialog(Diagram *d, const QString& _DataSet,
103  QWidget *parent, Graph *currentGraph)
104  : QDialog(parent, 0, TRUE, Qt::WDestructiveClose)
105 {
106  Diag = d;
107  Graphs.setAutoDelete(true);
108  copyDiagramGraphs(); // make a copy of all graphs
109  defaultDataSet = _DataSet;
110  setCaption(tr("Edit Diagram Properties"));
111  changed = false;
112  transfer = false; // have changes be applied ? (used by "Cancel")
113  toTake = false; // double-clicked variable be inserted into graph list ?
114 
115  Expr.setPattern("[^\"]+");
116  Validator = new QRegExpValidator(Expr, this);
117  ValInteger = new QIntValidator(0, 360, this);
118  ValDouble = new QDoubleValidator(-1e200, 1e200, 6, this);
119 
120  QString NameY, NameZ;
121  if((Diag->Name == "Rect") || (Diag->Name == "Curve")) {
122  NameY = tr("left Axis");
123  NameZ = tr("right Axis");
124  }
125  else if(Diag->Name == "Polar") {
126  NameY = tr("y-Axis");
127  }
128  else if((Diag->Name == "Smith") || (Diag->Name == "ySmith")) {
129  NameY = tr("y-Axis");
130  }
131  else if(Diag->Name == "PS") {
132  NameY = tr("smith Axis");
133  NameZ = tr("polar Axis");
134  }
135  else if(Diag->Name == "SP") {
136  NameY = tr("polar Axis");
137  NameZ = tr("smith Axis");
138  }
139  else if(Diag->Name == "Rect3D") {
140  NameY = tr("y-Axis");
141  NameZ = tr("z-Axis");
142  }
143 
144 
145  all = new QVBoxLayout(this); // to provide neccessary size
146  QTabWidget *t = new QTabWidget(this);
147  all->addWidget(t);
148 
149  // ...........................................................
150  QVBox *Tab1 = new QVBox(this);
151  Tab1->setSpacing(5);
152 
153  Label4 = 0; // different types with same content
154  yrLabel = 0;
155  yAxisBox = 0;
156  Property2 = 0;
157  ColorButt = 0;
158  hideInvisible = 0;
159  rotationX = rotationY = rotationZ = 0;
160 
161  QVButtonGroup *InputGroup = new QVButtonGroup(tr("Graph Input"), Tab1);
162  GraphInput = new QLineEdit(InputGroup);
163  GraphInput->setValidator(Validator);
164  connect(GraphInput, SIGNAL(textChanged(const QString&)),
165  SLOT(slotResetToTake(const QString&)));
166  QHBox *Box2 = new QHBox(InputGroup);
167  Box2->setSpacing(5);
168 
169  if(Diag->Name == "Tab") {
170  Label1 = new QLabel(tr("Number Notation: "), Box2);
171  PropertyBox = new QComboBox(Box2);
172  PropertyBox->insertItem(tr("real/imaginary"));
173  PropertyBox->insertItem(tr("magnitude/angle (degree)"));
174  PropertyBox->insertItem(tr("magnitude/angle (radian)"));
175  PropertyBox->setCurrentItem(1);
176  connect(PropertyBox, SIGNAL(activated(int)), SLOT(slotSetNumMode(int)));
177  Box2->setStretchFactor(new QWidget(Box2), 5); // stretchable placeholder
178 
179  Label2 = new QLabel(tr("Precision:"), Box2);
180  Property2 = new QLineEdit(Box2);
181  Property2->setValidator(ValInteger);
182  Property2->setMaxLength(2);
183  Property2->setMaximumWidth(25);
184  Property2->setText("3");
185  }
186  else if(Diag->Name != "Truth") {
187  Label1 = new QLabel(tr("Color:"),Box2);
188  ColorButt = new QPushButton(" ",Box2);
189  ColorButt->setMinimumWidth(50);
190  ColorButt->setEnabled(false);
191  connect(ColorButt, SIGNAL(clicked()), SLOT(slotSetColor()));
192  Box2->setStretchFactor(new QWidget(Box2), 5); // stretchable placeholder
193 
194  Label3 = new QLabel(tr("Style:"),Box2);
195  Label3->setEnabled(false);
196  PropertyBox = new QComboBox(Box2);
197  PropertyBox->insertItem(tr("solid line"));
198  PropertyBox->insertItem(tr("dash line"));
199  PropertyBox->insertItem(tr("dot line"));
200  if(Diag->Name != "Time") {
201  PropertyBox->insertItem(tr("long dash line"));
202  PropertyBox->insertItem(tr("stars"));
203  PropertyBox->insertItem(tr("circles"));
204  PropertyBox->insertItem(tr("arrows"));
205  }
206  connect(PropertyBox, SIGNAL(activated(int)),
207  SLOT(slotSetGraphStyle(int)));
208  Box2->setStretchFactor(new QWidget(Box2), 5); // stretchable placeholder
209 
210  Label2 = new QLabel(tr("Thickness:"),Box2);
211  Property2 = new QLineEdit(Box2);
212  Property2->setValidator(ValInteger);
213  Property2->setMaximumWidth(25);
214  Property2->setMaxLength(2);
215  Property2->setText("0");
216 
217  if((Diag->Name=="Rect") || (Diag->Name=="PS") || (Diag->Name=="SP") ||
218  (Diag->Name=="Curve")) {
219  QHBox *Box3 = new QHBox(InputGroup);
220  Box3->setSpacing(5);
221 
222  Label4 = new QLabel(tr("y-Axis:"),Box3);
223  Label4->setEnabled(false);
224  yAxisBox = new QComboBox(Box3);
225  yAxisBox->insertItem(NameY);
226  yAxisBox->insertItem(NameZ);
227  yAxisBox->setEnabled(false);
228  connect(yAxisBox, SIGNAL(activated(int)), SLOT(slotSetYAxis(int)));
229  Box3->setStretchFactor(new QWidget(Box3), 5); // stretchable placeholder
230  }
231  }
232  if(Property2) {
233  connect(Property2, SIGNAL(textChanged(const QString&)),
234  SLOT(slotSetProp2(const QString&)));
235 
236  Label1->setEnabled(false);
237  PropertyBox->setEnabled(false);
238  Label2->setEnabled(false);
239  Property2->setEnabled(false);
240  }
241 
242  QHBox *Box1 = new QHBox(Tab1);
243  Box1->setSpacing(5);
244 
245  QVButtonGroup *DataGroup = new QVButtonGroup(tr("Dataset"), Box1);
246  ChooseData = new QComboBox(false, DataGroup);
247  ChooseData->setMinimumWidth(200);
248  connect(ChooseData, SIGNAL(activated(int)), SLOT(slotReadVars(int)));
249  ChooseVars = new QListView(DataGroup);
250  ChooseVars->addColumn(tr("Name"));
251  ChooseVars->addColumn(tr("Type"));
252  ChooseVars->addColumn(tr("Size"));
253  connect(ChooseVars, SIGNAL(doubleClicked(QListViewItem*)),
254  SLOT(slotTakeVar(QListViewItem*)));
255 
256 
257  QVButtonGroup *GraphGroup = new QVButtonGroup(tr("Graph"), Box1);
258  GraphList = new QListBox(GraphGroup);
259  connect(GraphList, SIGNAL(clicked(QListBoxItem*)),
260  SLOT(slotSelectGraph(QListBoxItem*)));
261  connect(GraphList, SIGNAL(doubleClicked(QListBoxItem*)),
262  SLOT(slotDeleteGraph()));
263  QPushButton *NewButt = new QPushButton(tr("New Graph"), GraphGroup);
264  connect(NewButt, SIGNAL(clicked()), SLOT(slotNewGraph()));
265  QPushButton *DelButt = new QPushButton(tr("Delete Graph"), GraphGroup);
266  connect(DelButt, SIGNAL(clicked()), SLOT(slotDeleteGraph()));
267 
268  t->addTab(Tab1, tr("Data"));
269 
270  // ...........................................................
271  int Row = 0;
272  if(Diag->Name.at(0) != 'T') { // not tabular or timing diagram
273  QWidget *Tab2 = new QWidget(t);
274  QGridLayout *gp = new QGridLayout(Tab2,13,3,5,5);
275 
276  gp->addMultiCellWidget(new QLabel(tr("x-Axis Label:"), Tab2), Row,Row,0,0);
277  xLabel = new QLineEdit(Tab2);
278  xLabel->setValidator(Validator);
279  gp->addMultiCellWidget(xLabel, Row,Row,1,2);
280  Row++;
281 
282  gp->addMultiCellWidget(
283  new QLabel(NameY+" "+tr("Label:"), Tab2), Row,Row,0,0);
284  ylLabel = new QLineEdit(Tab2);
285  ylLabel->setValidator(Validator);
286  gp->addMultiCellWidget(ylLabel, Row,Row,1,2);
287  Row++;
288 
289  if((Diag->Name != "Smith") && (Diag->Name != "Polar")) {
290  gp->addMultiCellWidget(
291  new QLabel(NameZ +" "+tr("Label:"), Tab2), Row,Row,0,0);
292  yrLabel = new QLineEdit(Tab2);
293  yrLabel->setValidator(Validator);
294  gp->addMultiCellWidget(yrLabel, Row,Row,1,2);
295  Row++;
296  }
297 
298  gp->addMultiCellWidget(new QLabel(
299  tr("<b>Label text</b>: Use LaTeX style for special characters, e.g. \\tau"),
300  Tab2), Row,Row,0,2);
301  Row++;
302 
303  if(Diag->Name != "Rect3D") {
304  GridOn = new QCheckBox(tr("show Grid"), Tab2);
305  gp->addMultiCellWidget(GridOn, Row,Row,0,2);
306  Row++;
307 
308  GridLabel1 = new QLabel(tr("Grid Color:"),Tab2);
309  gp->addMultiCellWidget(GridLabel1, Row,Row,0,0);
310  GridColorButt = new QPushButton(" ",Tab2);
311  connect(GridColorButt, SIGNAL(clicked()), SLOT(slotSetGridColor()));
312  gp->addMultiCellWidget(GridColorButt, Row,Row,1,2);
313  Row++;
314  GridColorButt->setPaletteBackgroundColor(Diag->GridPen.color());
315 
316  GridLabel2 = new QLabel(tr("Grid Style: "), Tab2);
317  gp->addMultiCellWidget(GridLabel2, Row,Row,0,0);
318  GridStyleBox = new QComboBox(Tab2);
319  GridStyleBox->insertItem(tr("solid line"));
320  GridStyleBox->insertItem(tr("dash line"));
321  GridStyleBox->insertItem(tr("dot line"));
322  GridStyleBox->insertItem(tr("dash dot line"));
323  GridStyleBox->insertItem(tr("dash dot dot line"));
324  gp->addMultiCellWidget(GridStyleBox, Row,Row,1,2);
325  Row++;
326  GridStyleBox->setCurrentItem(Diag->GridPen.style()-1);
327 
328  GridOn->setChecked(Diag->xAxis.GridOn);
329  if(!Diag->xAxis.GridOn) slotSetGridBox(QButton::Off);
330  connect(GridOn, SIGNAL(stateChanged(int)), SLOT(slotSetGridBox(int)));
331  }
332  else {
333  GridOn = 0;
334  GridColorButt = 0;
335  GridStyleBox = 0;
336  }
337 
338  // ...........................................................
339  xLabel->setText(Diag->xAxis.Label);
340  ylLabel->setText(Diag->yAxis.Label);
341  if(yrLabel) yrLabel->setText(Diag->zAxis.Label);
342 
343  if((Diag->Name.left(4) == "Rect") || (Diag->Name == "Curve")) {
344  GridLogX = new QCheckBox(tr("logarithmical X Axis Grid"), Tab2);
345  gp->addMultiCellWidget(GridLogX, Row,Row,0,2);
346  Row++;
347 
348  GridLogY = new QCheckBox(tr("logarithmical")+" "+NameY+" "+tr("Grid"), Tab2);
349  gp->addMultiCellWidget(GridLogY, Row,Row,0,2);
350  Row++;
351 
352  GridLogZ = new QCheckBox(tr("logarithmical")+" "+NameZ+" "+tr("Grid"), Tab2);
353  gp->addMultiCellWidget(GridLogZ, Row,Row,0,2);
354  Row++;
355 
356  // ...........................................................
357  // transfer the diagram properties to the dialog
358  GridLogX->setChecked(Diag->xAxis.log);
359  GridLogY->setChecked(Diag->yAxis.log);
360  GridLogZ->setChecked(Diag->zAxis.log);
361 
362 
363  if(Diag->Name == "Rect3D") {
364  hideInvisible = new QCheckBox(tr("hide invisible lines"), Tab2);
365  gp->addMultiCellWidget(hideInvisible, Row,Row,0,2);
366  Row++;
367 
368  QLabel *LabelRotX = new QLabel(tr("Rotation around x-Axis:"), Tab2);
369  LabelRotX->setPaletteForegroundColor(Qt::red);
370  gp->addWidget(LabelRotX, Row,0);
371  SliderRotX = new QSlider(0,360,20, ((Rect3DDiagram*)Diag)->rotX,
372  Qt::Horizontal, Tab2);
373  gp->addWidget(SliderRotX, Row,1);
374  connect(SliderRotX, SIGNAL(valueChanged(int)), SLOT(slotNewRotX(int)));
375  rotationX = new QLineEdit(Tab2);
376  rotationX->setValidator(ValInteger);
377  rotationX->setMaxLength(3);
378  rotationX->setMaximumWidth(40);
379  gp->addWidget(rotationX, Row,2);
380  connect(rotationX, SIGNAL(textChanged(const QString&)),
381  SLOT(slotEditRotX(const QString&)));
382  Row++;
383 
384  QLabel *LabelRotY = new QLabel(tr("Rotation around y-Axis:"), Tab2);
385  LabelRotY->setPaletteForegroundColor(Qt::green);
386  gp->addWidget(LabelRotY, Row,0);
387  SliderRotY = new QSlider(0,360,20, ((Rect3DDiagram*)Diag)->rotY,
388  Qt::Horizontal, Tab2);
389  gp->addWidget(SliderRotY, Row,1);
390  connect(SliderRotY, SIGNAL(valueChanged(int)), SLOT(slotNewRotY(int)));
391  rotationY = new QLineEdit(Tab2);
392  rotationY->setValidator(ValInteger);
393  rotationY->setMaxLength(3);
394  rotationY->setMaximumWidth(40);
395  gp->addWidget(rotationY, Row,2);
396  connect(rotationY, SIGNAL(textChanged(const QString&)),
397  SLOT(slotEditRotY(const QString&)));
398  Row++;
399 
400  QLabel *LabelRotZ = new QLabel(tr("Rotation around z-Axis:"), Tab2);
401  LabelRotZ->setPaletteForegroundColor(Qt::blue);
402  gp->addWidget(LabelRotZ, Row,0);
403  SliderRotZ = new QSlider(0,360,20, ((Rect3DDiagram*)Diag)->rotZ,
404  Qt::Horizontal, Tab2);
405  gp->addWidget(SliderRotZ, Row,1);
406  connect(SliderRotZ, SIGNAL(valueChanged(int)), SLOT(slotNewRotZ(int)));
407  rotationZ = new QLineEdit(Tab2);
408  rotationZ->setValidator(ValInteger);
409  rotationZ->setMaxLength(3);
410  rotationZ->setMaximumWidth(40);
411  gp->addWidget(rotationZ, Row,2);
412  connect(rotationZ, SIGNAL(textChanged(const QString&)),
413  SLOT(slotEditRotZ(const QString&)));
414  Row++;
415 
416  gp->addWidget(new QLabel(tr("2D-projection:"), Tab2), Row,0);
417  DiagCross = new Cross3D(((Rect3DDiagram*)Diag)->rotX,
418  ((Rect3DDiagram*)Diag)->rotY,
419  ((Rect3DDiagram*)Diag)->rotZ, Tab2);
420  gp->addWidget(DiagCross, Row,1);
421 
422  // transfer the diagram properties to the dialog
423  hideInvisible->setChecked(Diag->hideLines);
424  rotationX->setText(QString::number(((Rect3DDiagram*)Diag)->rotX));
425  rotationY->setText(QString::number(((Rect3DDiagram*)Diag)->rotY));
426  rotationZ->setText(QString::number(((Rect3DDiagram*)Diag)->rotZ));
427 
428  }
429  }
430  else GridLogX = GridLogY = GridLogZ = 0;
431 
432  t->addTab(Tab2, tr("Properties"));
433 
434  // ...........................................................
435  QVBox *Tab3 = new QVBox(this);
436  Tab1->setSpacing(5);
437 
438  QHGroupBox *axisX = new QHGroupBox(tr("x-Axis"), Tab3);
439 
440  QVBox *VBox1 = new QVBox(axisX);
441  VBox1->setStretchFactor(new QWidget(VBox1),5); // stretchable placeholder
442  manualX = new QCheckBox(tr("manual"), VBox1);
443  connect(manualX, SIGNAL(stateChanged(int)), SLOT(slotManualX(int)));
444 
445  QVBox *VBox2 = new QVBox(axisX);
446  new QLabel(tr("start"), VBox2);
447  startX = new QLineEdit(VBox2);
448  startX->setValidator(ValDouble);
449 
450  QVBox *VBox3 = new QVBox(axisX);
451  new QLabel(tr("step"), VBox3);
452  stepX = new QLineEdit(VBox3);
453  stepX->setValidator(ValDouble);
454 
455  QVBox *VBox4 = new QVBox(axisX);
456  new QLabel(tr("stop"), VBox4);
457  stopX = new QLineEdit(VBox4);
458  stopX->setValidator(ValDouble);
459 
460 
461  QHGroupBox *axisY;
462  axisY = new QHGroupBox(NameY, Tab3);
463 
464  QVBox *VBox5 = new QVBox(axisY);
465  VBox5->setStretchFactor(new QWidget(VBox5),5); // stretchable placeholder
466  manualY = new QCheckBox(tr("manual"), VBox5);
467  connect(manualY, SIGNAL(stateChanged(int)), SLOT(slotManualY(int)));
468 
469  QVBox *VBox6 = new QVBox(axisY);
470  new QLabel(tr("start"), VBox6);
471  startY = new QLineEdit(VBox6);
472  startY->setValidator(ValDouble);
473 
474  QVBox *VBox7 = new QVBox(axisY);
475  if((Diag->Name=="Smith") || (Diag->Name=="ySmith") || (Diag->Name=="PS"))
476  new QLabel(tr("number"), VBox7);
477  else new QLabel(tr("step"), VBox7);
478  stepY = new QLineEdit(VBox7);
479  stepY->setValidator(ValDouble);
480 
481  QVBox *VBox8 = new QVBox(axisY);
482  new QLabel(tr("stop"), VBox8);
483  stopY = new QLineEdit(VBox8);
484  stopY->setValidator(ValDouble);
485 
486 
487  QHGroupBox *axisZ;
488  axisZ = new QHGroupBox(NameZ, Tab3);
489 
490  QVBox *VBox9 = new QVBox(axisZ);
491  VBox9->setStretchFactor(new QWidget(VBox9),5); // stretchable placeholder
492  manualZ = new QCheckBox(tr("manual"), VBox9);
493  connect(manualZ, SIGNAL(stateChanged(int)), SLOT(slotManualZ(int)));
494 
495  QVBox *VBox10 = new QVBox(axisZ);
496  new QLabel(tr("start"), VBox10);
497  startZ = new QLineEdit(VBox10);
498  startZ->setValidator(ValDouble);
499 
500  QVBox *VBox11 = new QVBox(axisZ);
501  if(Diag->Name == "SP") new QLabel(tr("number"), VBox11);
502  else new QLabel(tr("step"), VBox11);
503  stepZ = new QLineEdit(VBox11);
504  stepZ->setValidator(ValDouble);
505 
506  QVBox *VBox12 = new QVBox(axisZ);
507  new QLabel(tr("stop"), VBox12);
508  stopZ = new QLineEdit(VBox12);
509  stopZ->setValidator(ValDouble);
510 
511 
512  Tab3->setStretchFactor(new QWidget(Tab3),5); // stretchable placeholder
513 
514  t->addTab(Tab3, tr("Limits"));
515 
516  // ...........................................................
517  // transfer the diagram properties to the dialog
518  if(Diag->xAxis.autoScale) slotManualX(QButton::Off);
519  else manualX->setChecked(true);
520  if(Diag->yAxis.autoScale) slotManualY(QButton::Off);
521  else manualY->setChecked(true);
522  if(Diag->zAxis.autoScale) slotManualZ(QButton::Off);
523  else manualZ->setChecked(true);
524 
525  Diag->calcLimits(); // inserts auto-scale values if not manual
526 
527  startX->setText(QString::number(Diag->xAxis.limit_min));
528  stepX->setText(QString::number(Diag->xAxis.step));
529  stopX->setText(QString::number(Diag->xAxis.limit_max));
530 
531  startY->setText(QString::number(Diag->yAxis.limit_min));
532  stepY->setText(QString::number(Diag->yAxis.step));
533  stopY->setText(QString::number(Diag->yAxis.limit_max));
534 
535  startZ->setText(QString::number(Diag->zAxis.limit_min));
536  stepZ->setText(QString::number(Diag->zAxis.step));
537  stopZ->setText(QString::number(Diag->zAxis.limit_max));
538 
539  if((Diag->Name == "Smith") || (Diag->Name == "ySmith") ||
540  (Diag->Name == "Polar")) {
541  axisZ->setEnabled(false);
542  }
543  if(Diag->Name.left(4) != "Rect") // cartesian 2D and 3D
544  if(Diag->Name != "Curve") {
545  axisX->setEnabled(false);
546  startY->setEnabled(false);
547  startZ->setEnabled(false);
548  }
549  }
550  else stepX = 0;
551 
552  connect(t, SIGNAL(currentChanged(QWidget*)), SLOT(slotChangeTab(QWidget*)));
553  // ...........................................................
554  QHBox *Butts = new QHBox(this);
555  Butts->setSpacing(5);
556  Butts->setMargin(5);
557  all->addWidget(Butts);
558 
559  QPushButton *OkButt = new QPushButton(tr("OK"), Butts);
560  connect(OkButt, SIGNAL(clicked()), SLOT(slotOK()));
561  QPushButton *ApplyButt = new QPushButton(tr("Apply"), Butts);
562  connect(ApplyButt, SIGNAL(clicked()), SLOT(slotApply()));
563  QPushButton *CancelButt = new QPushButton(tr("Cancel"), Butts);
564  connect(CancelButt, SIGNAL(clicked()), SLOT(slotCancel()));
565 
566  OkButt->setDefault(true);
567 
568 
569  // ...........................................................
570  // put all data files into ComboBox
571  QFileInfo Info(defaultDataSet);
572  QDir ProjDir(Info.dirPath());
573  QStringList Elements = ProjDir.entryList("*.dat", QDir::Files, QDir::Name);
574  QStringList::iterator it;
575  for(it = Elements.begin(); it != Elements.end(); ++it) {
576  ChooseData->insertItem((*it).left((*it).length()-4));
577  if((*it) == Info.fileName())
578  // default dataset should be the current
579  ChooseData->setCurrentItem(ChooseData->count()-1);
580  }
581  slotReadVars(0); // put variables into the ListView
582 
583  // ...........................................................
584  // put all graphs into the ListBox
585  Row = 0;
586  for(Graph *pg = Diag->Graphs.first(); pg != 0; pg = Diag->Graphs.next()) {
587  GraphList->insertItem(pg->Var);
588  if(pg == currentGraph) {
589  GraphList->setCurrentItem(Row); // select current graph
590  SelectGraph(currentGraph);
591  }
592  Row++;
593  }
594 
595  if(ColorButt)
596  if(!currentGraph)
597  ColorButt->setPaletteBackgroundColor
598  (QColor(DefaultColors[GraphList->count()]));
599 }
600 
602 {
603  delete all; // delete all widgets from heap
604  delete ValInteger;
605  delete ValDouble;
606  delete Validator;
607 }
608 
609 // --------------------------------------------------------------------------
610 void DiagramDialog::slotReadVars(int)
611 {
612  QFileInfo Info(defaultDataSet);
613  QString DocName = ChooseData->currentText()+".dat";
614 
615  QFile file(Info.dirPath() + QDir::separator() + DocName);
616  if(!file.open(IO_ReadOnly)) {
617  return;
618  }
619 
620  QString Line, tmp, Var;
621  // reading the file as a whole improves speed very much, also using
622  // a QByteArray rather than a QString
623  QByteArray FileString = file.readAll();
624  file.close();
625 
626  ChooseVars->clear();
627  int i=0, j=0;
628  i = FileString.find('<')+1;
629  if(i > 0)
630  do {
631  j = FileString.find('>', i);
632  for(int k=0;k<j-i;k++) Line[k]=FileString[k+i];
633  Line.truncate(j-i);
634  i = FileString.find('<', j)+1;
635 
636  Var = Line.section(' ', 1, 1).remove('>');
637  if(Var.at(0) == '_') continue;
638 
639  if(Line.left(3) == "dep") {
640  tmp = Line.section(' ', 2);
641  new QListViewItem(ChooseVars, Var, "dep", tmp.remove('>'));
642  }
643  else if(Line.left(5) == "indep") {
644  tmp = Line.section(' ', 2, 2);
645  new QListViewItem(ChooseVars, Var, "indep", tmp.remove('>'));
646  }
647  } while(i > 0);
648 }
649 
650 // ------------------------------------------------------------------------
651 // Inserts the double-clicked variable into the Graph Input Line at the
652 // cursor position. If the Graph Input is empty, then the variable is
653 // also inserted as graph.
654 void DiagramDialog::slotTakeVar(QListViewItem *Item)
655 {
656  GraphInput->blockSignals(true);
657  if(toTake) GraphInput->setText("");
658 
659  int i = GraphInput->cursorPosition();
660  QString s = GraphInput->text();
661  QString s1 = Item->text(0);
662  QFileInfo Info(defaultDataSet);
663  if(ChooseData->currentText() != Info.baseName(true))
664  s1 = ChooseData->currentText() + ":" + s1;
665  GraphInput->setText(s.left(i) + s1 + s.right(s.length()-i));
666 
667  if(s.isEmpty()) {
668  GraphList->insertItem(GraphInput->text());
669  GraphList->setSelected(GraphList->count()-1,true);
670 
671  Graph *g = new Graph(GraphInput->text()); // create a new graph
672 
673  if(Diag->Name != "Tab") {
674  if(Diag->Name != "Truth") {
675  g->Color = ColorButt->paletteBackgroundColor();
676  g->Thick = Property2->text().toInt();
677  ColorButt->setPaletteBackgroundColor(
678  QColor(DefaultColors[GraphList->count()]));
679  if(g->Var.right(3) == ".Vb") // harmonic balance output ?
680  if(PropertyBox->count() >= GRAPHSTYLE_ARROW)
681  PropertyBox->setCurrentItem(GRAPHSTYLE_ARROW);
682  g->Style = PropertyBox->currentItem();
683  if(yAxisBox) {
684  g->yAxisNo = yAxisBox->currentItem();
685  yAxisBox->setEnabled(true);
686  Label4->setEnabled(true);
687  }
688  else if(Diag->Name == "Rect3D") g->yAxisNo = 1;
689 
690  Label3->setEnabled(true);
691  ColorButt->setEnabled(true);
692  }
693  }
694  else {
695  g->Precision = Property2->text().toInt();
696  g->numMode = PropertyBox->currentItem();
697  }
698 
699  Graphs.append(g);
700  changed = true;
701  toTake = true;
702  }
703 
704  GraphInput->blockSignals(false);
705 
706  if(Property2) {
707  Label1->setEnabled(true);
708  PropertyBox->setEnabled(true);
709  Label2->setEnabled(true);
710  Property2->setEnabled(true);
711  }
712 }
713 
714 // --------------------------------------------------------------------------
715 // Is called if a graph text is clicked in the BistBox.
716 void DiagramDialog::slotSelectGraph(QListBoxItem *item)
717 {
718  if(item == 0) {
719  GraphList->clearSelection();
720  return;
721  }
722 
723  SelectGraph (Graphs.at (GraphList->index(item)));
724 }
725 
726 // --------------------------------------------------------------------------
727 // Puts the text of the selected graph into the line edit.
728 void DiagramDialog::SelectGraph(Graph *g)
729 {
730  GraphInput->blockSignals(true);
731  GraphInput->setText(g->Var);
732  GraphInput->blockSignals(false);
733 
734  if(Diag->Name != "Tab") {
735  if(Diag->Name != "Truth") {
736  Property2->setText(QString::number(g->Thick));
737  ColorButt->setPaletteBackgroundColor(g->Color);
738  PropertyBox->setCurrentItem(g->Style);
739  if(yAxisBox) {
740  yAxisBox->setCurrentItem(g->yAxisNo);
741  yAxisBox->setEnabled(true);
742  Label4->setEnabled(true);
743  }
744 
745  Label3->setEnabled(true);
746  ColorButt->setEnabled(true);
747  }
748  }
749  else {
750  Property2->setText(QString::number(g->Precision));
751  PropertyBox->setCurrentItem(g->numMode);
752  }
753  toTake = false;
754 
755  if(Property2) {
756  Label1->setEnabled(true);
757  PropertyBox->setEnabled(true);
758  Label2->setEnabled(true);
759  Property2->setEnabled(true);
760  }
761 }
762 
763 // --------------------------------------------------------------------------
764 // Is called when the 'delelte graph' button is pressed.
765 void DiagramDialog::slotDeleteGraph()
766 {
767  int i = GraphList->index(GraphList->selectedItem());
768  if(i < 0) return; // return, if no item selected
769 
770  GraphList->removeItem(i);
771  Graphs.remove(i);
772 
773  GraphInput->setText(""); // erase input line and back to default values
774  if(Diag->Name != "Tab") {
775  if(Diag->Name != "Truth") {
776  ColorButt->setPaletteBackgroundColor(
777  QColor(DefaultColors[GraphList->count()]));
778  Property2->setText("0");
779  if(yAxisBox) {
780  yAxisBox->setCurrentItem(0);
781  yAxisBox->setEnabled(false);
782  Label4->setEnabled(false);
783  }
784 
785  Label3->setEnabled(false);
786  ColorButt->setEnabled(false);
787  }
788  }
789  else Property2->setText("3");
790  changed = true;
791  toTake = false;
792 
793  if(Property2) {
794  PropertyBox->setCurrentItem(0);
795 
796  Label1->setEnabled(false);
797  PropertyBox->setEnabled(false);
798  Label2->setEnabled(false);
799  Property2->setEnabled(false);
800  }
801 }
802 
803 // --------------------------------------------------------------------------
804 void DiagramDialog::slotNewGraph()
805 {
806  if(GraphInput->text().isEmpty()) return;
807 
808  GraphList->insertItem(GraphInput->text());
809 
810  Graph *g = new Graph(GraphInput->text()); // create a new graph
811  if(Diag->Name != "Tab") {
812  if(Diag->Name != "Truth") {
813  g->Color = ColorButt->paletteBackgroundColor();
814  g->Thick = Property2->text().toInt();
815  g->Style = PropertyBox->currentItem();
816  if(yAxisBox) g->yAxisNo = yAxisBox->currentItem();
817  else if(Diag->Name == "Rect3D") g->yAxisNo = 1;
818  }
819  }
820  else {
821  g->Precision = Property2->text().toInt();
822  g->numMode = PropertyBox->currentItem();
823  }
824  Graphs.append(g);
825  changed = true;
826  toTake = false;
827 }
828 
829 // --------------------------------------------------------------------------
830 // Is called if "Ok" button is pressed.
831 void DiagramDialog::slotOK()
832 {
833  slotApply();
834  slotCancel();
835 }
836 
837 // --------------------------------------------------------------------------
838 // Is called if "Apply" button is pressed.
839 void DiagramDialog::slotApply()
840 {
841  if(Diag->Name.at(0) != 'T') { // not tabular or timing
842  if(Diag->xAxis.Label.isEmpty())
843  Diag->xAxis.Label = ""; // can be not 0 and empty!
844  if(xLabel->text().isEmpty()) xLabel->setText("");
845  if(Diag->xAxis.Label != xLabel->text()) {
846  Diag->xAxis.Label = xLabel->text();
847  changed = true;
848  }
849  if(Diag->yAxis.Label.isEmpty())
850  Diag->yAxis.Label = ""; // can be not 0 and empty!
851  if(ylLabel->text().isEmpty()) ylLabel->setText("");
852  if(Diag->yAxis.Label != ylLabel->text()) {
853  Diag->yAxis.Label = ylLabel->text();
854  changed = true;
855  }
856 
857  if(GridOn) if(Diag->xAxis.GridOn != GridOn->isChecked()) {
858  Diag->xAxis.GridOn = GridOn->isChecked();
859  Diag->yAxis.GridOn = GridOn->isChecked();
860  changed = true;
861  }
862  if(GridColorButt)
863  if(Diag->GridPen.color() != GridColorButt->paletteBackgroundColor()) {
864  Diag->GridPen.setColor(GridColorButt->paletteBackgroundColor());
865  changed = true;
866  }
867  if(GridStyleBox)
868  if(Diag->GridPen.style()!=(Qt::PenStyle)(GridStyleBox->currentItem()+1)) {
869  Diag->GridPen.setStyle((Qt::PenStyle)(GridStyleBox->currentItem()+1));
870  changed = true;
871  }
872  if((Diag->Name != "Smith") && (Diag->Name != "Polar")) {
873  if(Diag->zAxis.Label.isEmpty())
874  Diag->zAxis.Label = ""; // can be not 0 and empty!
875  if(yrLabel->text().isEmpty()) yrLabel->setText("");
876  if(Diag->zAxis.Label != yrLabel->text()) {
877  Diag->zAxis.Label = yrLabel->text();
878  changed = true;
879  }
880  }
881 
882  if(Diag->Name.left(4) == "Rect") {
883  if(Diag->xAxis.log != GridLogX->isChecked()) {
884  Diag->xAxis.log = GridLogX->isChecked();
885  changed = true;
886  }
887  if(Diag->yAxis.log != GridLogY->isChecked()) {
888  Diag->yAxis.log = GridLogY->isChecked();
889  changed = true;
890  }
891  if(Diag->zAxis.log != GridLogZ->isChecked()) {
892  Diag->zAxis.log = GridLogZ->isChecked();
893  changed = true;
894  }
895  }
896 
897  if((Diag->Name == "Smith") || (Diag->Name == "ySmith") ||
898  (Diag->Name == "PS"))
899  if(stopY->text().toDouble() < 1.0)
900  stopY->setText("1");
901 
902  if(Diag->Name == "SP")
903  if(stopZ->text().toDouble() < 1.0)
904  stopZ->setText("1");
905 
906  if(Diag->xAxis.autoScale == manualX->isChecked()) {
907  Diag->xAxis.autoScale = !(manualX->isChecked());
908  changed = true;
909  }
910 
911  // Use string compares for all floating point numbers, in
912  // order to avoid rounding problems.
913  if(QString::number(Diag->xAxis.limit_min) != startX->text()) {
914  Diag->xAxis.limit_min = startX->text().toDouble();
915  changed = true;
916  }
917  if(QString::number(Diag->xAxis.step) != stepX->text()) {
918  Diag->xAxis.step = stepX->text().toDouble();
919  changed = true;
920  }
921  if(QString::number(Diag->xAxis.limit_max) != stopX->text()) {
922  Diag->xAxis.limit_max = stopX->text().toDouble();
923  changed = true;
924  }
925  if(Diag->yAxis.autoScale == manualY->isChecked()) {
926  Diag->yAxis.autoScale = !(manualY->isChecked());
927  changed = true;
928  }
929  if(QString::number(Diag->yAxis.limit_min) != startY->text()) {
930  Diag->yAxis.limit_min = startY->text().toDouble();
931  changed = true;
932  }
933  if(QString::number(Diag->yAxis.step) != stepY->text()) {
934  Diag->yAxis.step = stepY->text().toDouble();
935  changed = true;
936  }
937  if(QString::number(Diag->yAxis.limit_max) != stopY->text()) {
938  Diag->yAxis.limit_max = stopY->text().toDouble();
939  changed = true;
940  }
941  if(Diag->zAxis.autoScale == manualZ->isChecked()) {
942  Diag->zAxis.autoScale = !(manualZ->isChecked());
943  changed = true;
944  }
945  if(QString::number(Diag->zAxis.limit_min) != startZ->text()) {
946  Diag->zAxis.limit_min = startZ->text().toDouble();
947  changed = true;
948  }
949  if(QString::number(Diag->zAxis.step) != stepZ->text()) {
950  Diag->zAxis.step = stepZ->text().toDouble();
951  changed = true;
952  }
953  if(QString::number(Diag->zAxis.limit_max) != stopZ->text()) {
954  Diag->zAxis.limit_max = stopZ->text().toDouble();
955  changed = true;
956  }
957 
958  // for "rect3D"
959  if(hideInvisible)
960  if(((Rect3DDiagram*)Diag)->hideLines != hideInvisible->isChecked()) {
961  ((Rect3DDiagram*)Diag)->hideLines = hideInvisible->isChecked();
962  changed = true;
963  }
964 
965  if(rotationX)
966  if(((Rect3DDiagram*)Diag)->rotX != rotationX->text().toInt()) {
967  ((Rect3DDiagram*)Diag)->rotX = rotationX->text().toInt();
968  changed = true;
969  }
970 
971  if(rotationY)
972  if(((Rect3DDiagram*)Diag)->rotY != rotationY->text().toInt()) {
973  ((Rect3DDiagram*)Diag)->rotY = rotationY->text().toInt();
974  changed = true;
975  }
976 
977  if(rotationZ)
978  if(((Rect3DDiagram*)Diag)->rotZ != rotationZ->text().toInt()) {
979  ((Rect3DDiagram*)Diag)->rotZ = rotationZ->text().toInt();
980  changed = true;
981  }
982 
983  } // of "if(Diag->Name != "Tab")"
984 
985  Diag->Graphs.clear(); // delete the graphs
986  Graphs.setAutoDelete(false);
987  for(Graph *pg = Graphs.first(); pg != 0; pg = Graphs.next())
988  Diag->Graphs.append(pg); // transfer the new graphs to diagram
989  Graphs.clear();
990  Graphs.setAutoDelete(true);
991 
992  Diag->loadGraphData(defaultDataSet);
993  ((Schematic*)parent())->viewport()->repaint();
995  if(changed) transfer = true; // changes have been applied ?
996 }
997 
998 
999 // --------------------------------------------------------------------------
1000 // Is called if "Cancel" button is pressed.
1001 void DiagramDialog::slotCancel()
1002 {
1003 // Diag->loadGraphData(defaultDataSet);
1004 // ((QucsView*)parent())->viewport()->repaint();
1005  if(transfer) done(QDialog::Accepted);
1006  else done(QDialog::Rejected);
1007 }
1008 
1009 //-----------------------------------------------------------------
1010 // To get really all close events (even <Escape> key).
1012 {
1013  slotCancel();
1014 }
1015 
1016 // --------------------------------------------------------------------------
1017 void DiagramDialog::slotSetColor()
1018 {
1019  QColor c = QColorDialog::getColor(ColorButt->paletteBackgroundColor(),this);
1020  if(!c.isValid()) return;
1021  ColorButt->setPaletteBackgroundColor(c);
1022 
1023  int i = GraphList->index(GraphList->selectedItem());
1024  if(i < 0) return; // return, if no item selected
1025 
1026  Graph *g = Graphs.at(i);
1027  g->Color = c;
1028  changed = true;
1029  toTake = false;
1030 }
1031 
1032 // --------------------------------------------------------------------------
1033 void DiagramDialog::slotSetGridColor()
1034 {
1035  QColor c = QColorDialog::getColor(
1036  GridColorButt->paletteBackgroundColor(),this);
1037  if(!c.isValid()) return;
1038  GridColorButt->setPaletteBackgroundColor(c);
1039  changed = true;
1040 }
1041 
1042 // --------------------------------------------------------------------------
1043 // Is set if the graph input line changes.
1044 void DiagramDialog::slotResetToTake(const QString& s)
1045 {
1046  int i = GraphList->index(GraphList->selectedItem());
1047  if(i < 0) return; // return, if no item selected
1048 
1049  Graph *g = Graphs.at(i);
1050  g->Var = s;
1051  GraphList->changeItem(s, i); // must done after the graph settings !!!
1052  changed = true;
1053  toTake = false;
1054 }
1055 
1056 // --------------------------------------------------------------------------
1057 // Is called if the user changes the graph thickness or the precision.
1058 void DiagramDialog::slotSetProp2(const QString& s)
1059 {
1060  int i = GraphList->index(GraphList->selectedItem());
1061  if(i < 0) return; // return, if no item selected
1062 
1063  Graph *g = Graphs.at(i);
1064  if(Diag->Name == "Tab") g->Precision = s.toInt();
1065  else g->Thick = s.toInt();
1066  changed = true;
1067  toTake = false;
1068 }
1069 
1070 // --------------------------------------------------------------------------
1071 // Is called if the user changes the number mode.
1072 void DiagramDialog::slotSetNumMode(int Mode)
1073 {
1074  int i = GraphList->index(GraphList->selectedItem());
1075  if(i < 0) return; // return, if no item selected
1076 
1077  Graph *g = Graphs.at(i);
1078  g->numMode = Mode;
1079  changed = true;
1080  toTake = false;
1081 }
1082 
1083 // --------------------------------------------------------------------------
1084 // Is called when the "show grid" checkbox is changed.
1085 void DiagramDialog::slotSetGridBox(int state)
1086 {
1087  if(state == QButton::On) {
1088  GridColorButt->setEnabled(true);
1089  GridStyleBox->setEnabled(true);
1090  GridLabel1->setEnabled(true);
1091  GridLabel2->setEnabled(true);
1092  }
1093  else {
1094  GridColorButt->setEnabled(false);
1095  GridStyleBox->setEnabled(false);
1096  GridLabel1->setEnabled(false);
1097  GridLabel2->setEnabled(false);
1098  }
1099 }
1100 
1101 // --------------------------------------------------------------------------
1102 // Is called if the user changes the graph style (combobox).
1103 void DiagramDialog::slotSetGraphStyle(int style)
1104 {
1105  int i = GraphList->index(GraphList->selectedItem());
1106  if(i < 0) return; // return, if no item selected
1107 
1108  Graph *g = Graphs.at(i);
1109  g->Style = style;
1110  changed = true;
1111  toTake = false;
1112 }
1113 
1114 // --------------------------------------------------------------------------
1115 // Makes a copy of all graphs in the diagram.
1117 {
1118  for(Graph *pg = Diag->Graphs.first(); pg != 0; pg = Diag->Graphs.next())
1119  Graphs.append(pg->sameNewOne());
1120 }
1121 
1122 // --------------------------------------------------------------------------
1123 // Is called if the combobox changes that defines which y axis uses the graph.
1124 void DiagramDialog::slotSetYAxis(int axis)
1125 {
1126  int i = GraphList->index(GraphList->selectedItem());
1127  if(i < 0) return; // return, if no item selected
1128 
1129  Graph *g = Graphs.at(i);
1130  g->yAxisNo = axis;
1131  changed = true;
1132  toTake = false;
1133 }
1134 
1135 // --------------------------------------------------------------------------
1136 void DiagramDialog::slotManualX(int state)
1137 {
1138  if(state == QButton::On) {
1139  if((Diag->Name.left(4) == "Rect") || (Diag->Name == "Curve"))
1140  startX->setEnabled(true);
1141  stopX->setEnabled(true);
1142  if(GridLogX) if(GridLogX->isChecked()) return;
1143  stepX->setEnabled(true);
1144  }
1145  else {
1146  startX->setEnabled(false);
1147  stepX->setEnabled(false);
1148  stopX->setEnabled(false);
1149  }
1150 }
1151 
1152 // --------------------------------------------------------------------------
1153 void DiagramDialog::slotManualY(int state)
1154 {
1155  if(state == QButton::On) {
1156  if((Diag->Name.left(4) == "Rect") || (Diag->Name == "Curve"))
1157  startY->setEnabled(true);
1158  stopY->setEnabled(true);
1159  if(GridLogY) if(GridLogY->isChecked()) return;
1160  stepY->setEnabled(true);
1161  }
1162  else {
1163  startY->setEnabled(false);
1164  stepY->setEnabled(false);
1165  stopY->setEnabled(false);
1166  }
1167 }
1168 
1169 // --------------------------------------------------------------------------
1170 void DiagramDialog::slotManualZ(int state)
1171 {
1172  if(state == QButton::On) {
1173  if((Diag->Name.left(4) == "Rect") || (Diag->Name == "Curve"))
1174  startZ->setEnabled(true);
1175  stopZ->setEnabled(true);
1176  if(GridLogZ) if(GridLogZ->isChecked()) return;
1177  stepZ->setEnabled(true);
1178  }
1179  else {
1180  startZ->setEnabled(false);
1181  stepZ->setEnabled(false);
1182  stopZ->setEnabled(false);
1183  }
1184 }
1185 
1186 // --------------------------------------------------------------------------
1187 // Is called if the current tab of the QTabWidget changes.
1188 void DiagramDialog::slotChangeTab(QWidget*)
1189 {
1190  if(stepX == 0) return; // defined ?
1191  if(GridLogX) {
1192  if(GridLogX->isChecked()) stepX->setEnabled(false);
1193  else if(manualX->isChecked()) stepX->setEnabled(true);
1194  }
1195  if(GridLogY) {
1196  if(GridLogY->isChecked()) stepY->setEnabled(false);
1197  else if(manualY->isChecked()) stepY->setEnabled(true);
1198  }
1199  if(GridLogZ) {
1200  if(GridLogZ->isChecked()) stepZ->setEnabled(false);
1201  else if(manualZ->isChecked()) stepZ->setEnabled(true);
1202  }
1203 }
1204 
1205 // --------------------------------------------------------------------------
1206 // Is called when the slider for rotation angle is changed.
1207 void DiagramDialog::slotNewRotX(int Value)
1208 {
1209  rotationX->setText(QString::number(Value));
1210  DiagCross->rotX = float(Value) * M_PI/180.0;
1211  DiagCross->update();
1212 }
1213 
1214 // --------------------------------------------------------------------------
1215 // Is called when the slider for rotation angle is changed.
1216 void DiagramDialog::slotNewRotY(int Value)
1217 {
1218  rotationY->setText(QString::number(Value));
1219  DiagCross->rotY = float(Value) * M_PI/180.0;
1220  DiagCross->update();
1221 }
1222 
1223 // --------------------------------------------------------------------------
1224 // Is called when the slider for rotation angle is changed.
1225 void DiagramDialog::slotNewRotZ(int Value)
1226 {
1227  rotationZ->setText(QString::number(Value));
1228  DiagCross->rotZ = float(Value) * M_PI/180.0;
1229  DiagCross->update();
1230 }
1231 
1232 // --------------------------------------------------------------------------
1233 // Is called when the number (text) for rotation angle is changed.
1234 void DiagramDialog::slotEditRotX(const QString& Text)
1235 {
1236  SliderRotX->setValue(Text.toInt());
1237  DiagCross->rotX = Text.toFloat() * M_PI/180.0;
1238  DiagCross->update();
1239 }
1240 
1241 // --------------------------------------------------------------------------
1242 // Is called when the number (text) for rotation angle is changed.
1243 void DiagramDialog::slotEditRotY(const QString& Text)
1244 {
1245  SliderRotY->setValue(Text.toInt());
1246  DiagCross->rotY = Text.toFloat() * M_PI/180.0;
1247  DiagCross->update();
1248 }
1249 
1250 // --------------------------------------------------------------------------
1251 // Is called when the number (text) for rotation angle is changed.
1252 void DiagramDialog::slotEditRotZ(const QString& Text)
1253 {
1254  SliderRotZ->setValue(Text.toInt());
1255  DiagCross->rotZ = Text.toFloat() * M_PI/180.0;
1256  DiagCross->update();
1257 }