24 #include <Q3GridLayout>
25 #include <Q3VBoxLayout>
31 #include <Q3HGroupBox>
34 #include <QFileDialog>
40 : QDialog(d, 0, TRUE, Qt::WDestructiveClose)
43 setCaption(tr(
"Edit Component Properties"));
48 all =
new Q3VBoxLayout(
this);
50 QWidget *myParent =
this;
51 ValInteger =
new QIntValidator(1, 1000000,
this);
53 Expr.setPattern(
"[^\"=]*");
55 Expr.setPattern(
"[^\"]*");
57 Expr.setPattern(
"[\\w_]+");
69 QTabWidget *t =
new QTabWidget(
this);
72 QWidget *Tab1 =
new QWidget(t);
73 t->addTab(Tab1, tr(
"Sweep"));
74 Q3GridLayout *gp =
new Q3GridLayout(Tab1, 9,3,5,5);
82 checkParam =
new QCheckBox(tr(
"display in schematic"), Tab1);
84 textSim =
new QLabel(tr(
"Simulation:"), Tab1);
90 checkSim =
new QCheckBox(tr(
"display in schematic"), Tab1);
106 gp->addWidget(
new QLabel(tr(
"Sweep Parameter:"), Tab1), row,0);
110 textType =
new QLabel(tr(
"Type:"), Tab1);
114 comboType->insertItem(tr(
"logarithmic"));
119 checkType =
new QCheckBox(tr(
"display in schematic"), Tab1);
128 checkValues =
new QCheckBox(tr(
"display in schematic"), Tab1);
131 textStart =
new QLabel(tr(
"Start:"), Tab1);
137 checkStart =
new QCheckBox(tr(
"display in schematic"), Tab1);
140 textStop =
new QLabel(tr(
"Stop:"), Tab1);
146 checkStop =
new QCheckBox(tr(
"display in schematic"), Tab1);
149 textStep =
new QLabel(tr(
"Step:"), Tab1);
162 checkNumber =
new QCheckBox(tr(
"display in schematic"), Tab1);
170 if(pc->
Model[0] ==
'.')
216 connect(
editStart, SIGNAL(textChanged(
const QString&)),
218 connect(
editStop, SIGNAL(textChanged(
const QString&)),
220 connect(
editStep, SIGNAL(textChanged(
const QString&)),
222 connect(
editNumber, SIGNAL(textChanged(
const QString&)),
234 QWidget *Tab2 =
new QWidget(t);
235 t->addTab(Tab2, tr(
"Properties"));
236 gp1 =
new Q3GridLayout(Tab2, 9,2,5,5);
240 gp1 =
new Q3GridLayout(0, 9,2,5,5);
246 gp1->addMultiCellWidget(
new QLabel(
Comp->
Description, myParent), 0,0,0,1);
248 Q3HBox *h5 =
new Q3HBox(myParent);
250 gp1->addWidget(h5, 1,0);
251 new QLabel(tr(
"Name:"), h5);
256 showName =
new QCheckBox(tr(
"display in schematic"), myParent);
259 Q3HGroupBox *PropertyBox =
new Q3HGroupBox(tr(
"Properties"), myParent);
260 gp1->addMultiCellWidget(PropertyBox, 2,2,0,1);
262 prop =
new Q3ListView(PropertyBox);
263 prop->setMinimumSize(200, 150);
264 prop->addColumn(tr(
"Name"));
265 prop->addColumn(tr(
"Value"));
266 prop->addColumn(tr(
"display"));
267 prop->addColumn(tr(
"Description"));
268 prop->setSorting(-1);
270 Q3VBox *v1 =
new Q3VBox(PropertyBox);
273 Name =
new QLabel(v1);
283 edit =
new QLineEdit(v1);
284 edit->setMinimumWidth(150);
291 connect(
ComboEdit, SIGNAL(activated(
const QString&)),
294 Q3HBox *h3 =
new Q3HBox(v1);
295 h3->setStretchFactor(
new QWidget(h3),5);
296 EditButt =
new QPushButton(tr(
"Edit"),h3);
298 EditButt->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
300 BrowseButt =
new QPushButton(tr(
"Browse"),h3);
302 BrowseButt->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
305 disp =
new QCheckBox(tr(
"display in schematic"), v1);
308 v1->setStretchFactor(
new QWidget(v1),5);
310 Q3HBox *h4 =
new Q3HBox(v1);
312 ButtAdd =
new QPushButton(tr(
"Add"),h4);
314 ButtRem =
new QPushButton(tr(
"Remove"),h4);
320 Q3HBox *h2 =
new Q3HBox(
this);
323 connect(
new QPushButton(tr(
"OK"),h2), SIGNAL(clicked()),
325 connect(
new QPushButton(tr(
"Apply"),h2), SIGNAL(clicked()),
327 connect(
new QPushButton(tr(
"Cancel"),h2), SIGNAL(clicked()),
337 if((tmp > 0) || (tmp < -6))
tx_Dist = 0;
339 if((tmp > 0) || (tmp < -6))
ty_Dist = 0;
344 if(p->display) s = tr(
"yes");
346 new Q3ListViewItem(
prop, p->Name, p->Value, s, p->Description);
349 if(
prop->childCount() > 0) {
350 prop->setCurrentItem(
prop->firstChild());
354 connect(
prop, SIGNAL(clicked(Q3ListViewItem*)),
372 if(item == 0)
return;
373 item->setSelected(
true);
375 if(item->text(2) == tr(
"yes"))
disp->setChecked(
true);
376 else disp->setChecked(
false);
378 if(item->text(0) ==
"File") {
387 QString PropDesc = item->text(3);
388 if(PropDesc.isEmpty()) {
395 edit->setText(item->text(1));
397 edit->setShown(
true);
408 Name->setText(item->text(0));
409 edit->setText(item->text(1));
417 int b = PropDesc.find(
'[');
418 int e = PropDesc.findRev(
']');
420 QString str = PropDesc.mid(b+1, e-b-1);
421 str.replace( QRegExp(
"[^a-zA-Z0-9_,]"),
"" );
422 List = List.split(
',',str);
426 while(metrics.width(PropDesc) > 270) {
427 if (PropDesc.findRev(
' ') != -1)
428 PropDesc = PropDesc.left(PropDesc.findRev(
' ', -1)) +
"....";
430 PropDesc = PropDesc.left(PropDesc.length()-5) +
"....";
434 if(List.count() >= 1) {
438 for(
int i=
ComboEdit->count()-1; i>=0; i--)
439 if(item->text(1) ==
ComboEdit->text(i)) {
443 edit->setShown(
false);
447 edit->setShown(
true);
459 prop->currentItem()->setText(1, Text);
462 Q3ListViewItem *item =
prop->currentItem()->itemBelow();
463 if(item == 0)
return;
465 prop->setSelected(item,
true);
473 Q3ListViewItem *item =
prop->currentItem();
479 if(item->text(1) !=
edit->text())
480 item->setText(1,
edit->text());
483 if(item->text(0) !=
NameEdit->text()) {
490 item = item->itemBelow();
496 prop->setSelected(item,
true);
497 prop->ensureItemVisible(item);
505 Q3ListViewItem *item =
prop->currentItem();
506 if(item->text(0) !=
NameEdit->text()) {
521 Q3ListViewItem *item =
prop->currentItem();
522 if(item == 0)
return;
525 if(State) ButtonState = tr(
"yes");
526 else ButtonState = tr(
"no");
528 if(item->text(2) != ButtonState) {
529 item->setText(2, ButtonState);
602 case 1: tmp =
"log";
break;
603 case 2: tmp =
"list";
break;
604 case 3: tmp =
"const";
break;
605 default: tmp =
"lin";
break;
607 if(pp->
Value != tmp) {
679 if((pp->
Value != tmp) || (pp->
Name !=
"Values")) {
689 Q3ListViewItem *item =
prop->firstChild();
692 item =
prop->currentItem();
693 if(item->text(1) !=
edit->text())
694 item->setText(1,
edit->text());
696 if(item->text(0) !=
NameEdit->text())
701 for(item =
prop->firstChild(); item != 0; item = item->itemBelow()) {
702 display = (item->text(2) == tr(
"yes"));
708 if(pp->
Value != item->text(1)) {
709 pp->
Value = item->text(1);
712 if(pp->
Name != item->text(0)) {
713 pp->
Name = item->text(0);
720 Property(item->text(0), item->text(1), display, item->text(3)));
747 Doc->viewport()->repaint();
754 QString s = QFileDialog::getOpenFileName (
758 tr(
"All Files")+
" (*.*);;"
759 + tr(
"Touchstone files") +
" (*.s?p);;"
760 + tr(
"CSV files") +
" (*.csv);;"
761 + tr(
"SPICE files") +
" (*.cir *.spi);;"
762 + tr(
"VHDL files") +
" (*.vhdl *.vhd);;"
763 + tr(
"Verilog files")+
" (*.v)" );
772 prop->currentItem()->setText(1, s);
786 Q3ListViewItem *item;
788 for(item =
prop->firstChild(); item != 0; item = item->itemBelow())
789 if(item->text(0) ==
NameEdit->text()) {
790 prop->setSelected(item,
true);
795 item =
prop->selectedItem();
796 if(item == 0) item =
prop->lastItem();
798 QString s = tr(
"no");
799 if(
disp->isChecked()) s = tr(
"yes");
801 prop->setSelected(
new Q3ListViewItem(
prop, item,
810 if(
prop->childCount() < 3)
return;
811 Q3ListViewItem *item =
prop->selectedItem();
812 if(item == 0)
return;
814 Q3ListViewItem *next_item = item->itemBelow();
815 if(next_item == 0) next_item = item->itemAbove();
816 prop->takeItem(item);
829 editValues->text().section(
';', 0, 0).stripWhiteSpace());
831 editValues->text().section(
';', -1, -1).stripWhiteSpace());
853 textStep->setText(tr(
"Points per decade:"));
892 if(y == 0.0) y = x / 10.0;
893 if(x == 0.0) x = y * 10.0;
894 if(y == 0.0) { y = 1.0; x = 10.0; }
895 x =
editNumber->text().toDouble() / log10(fabs(x / y));
896 Unit = QString::number(x);
903 x = (x - y) / (
editNumber->text().toDouble() - 1.0);
907 str2num(step, x, Unit, Factor);
911 Unit = QString::number(x) +
" " + Unit;
931 str2num(Step, y, Unit, Factor);
934 x = log10(fabs(x)) * y;
943 str2num(Step, y, Unit, Factor);
950 editNumber->setText(QString::number(floor(x + 1.0)));
void slotSimTypeChange(int)
void str2num(const QString &s_, double &Number, QString &Unit, double &Factor)
void slotNumberChanged(const QString &)
tQucsSettings QucsSettings
int textSize(int &, int &)
void slotStepChanged(const QString &)
Definitions and declarations for the main application.
ComponentDialog(Component *, Schematic *)
Q3PtrList< Component > * Components
QIntValidator * ValInteger
Q3PtrList< Property > Props
QString num2str(double Num)
void slotApplyChange(const QString &Text)
void editFile(const QString &)
void slotSelectProperty(Q3ListViewItem *item)
void recreateComponent(Component *)
void slotApplyState(int State)