34 #include <Q3DragObject>
35 #include <Q3PaintDeviceMetrics>
40 #include <QTextStream>
41 #include <QDragLeaveEvent>
45 #include <QDragEnterEvent>
46 #include <QDragMoveEvent>
48 #include <QMouseEvent>
50 #include <QWheelEvent>
97 UndoStack.append(
new QString(
" i\n</>\n</>\n</>\n</>\n"));
98 UndoSymbol.append(
new QString(
" i\n</>\n</>\n</>\n</>\n"));
106 QObject::tr(
"untitled"));
120 setVScrollBarMode(Q3ScrollView::AlwaysOn);
121 setHScrollBarMode(Q3ScrollView::AlwaysOn);
123 viewport()->setMouseTracking(
true);
124 viewport()->setAcceptDrops(
true);
138 connect(
this, SIGNAL(horizontalSliderReleased()),
139 viewport(), SLOT(update()));
140 connect(
this, SIGNAL(verticalSliderReleased()),
141 viewport(), SLOT(update()));
144 connect(
this, SIGNAL(horizontalSliderPressed()),
App, SLOT(slotHideEdit()));
145 connect(
this, SIGNAL(verticalSliderPressed()),
App, SLOT(slotHideEdit()));
167 int h = 30*((countPort-1)/2) + 10;
171 new GraphicLine(-20, -h, 40, 0, QPen(Qt::darkBlue,2)));
173 new GraphicLine( 20, -h, 0,2*h, QPen(Qt::darkBlue,2)));
175 new GraphicLine(-20, h, 40, 0, QPen(Qt::darkBlue,2)));
177 new GraphicLine(-20, -h, 0,2*h, QPen(Qt::darkBlue,2)));
179 unsigned int i=0, y = 10-h;
183 new GraphicLine(-30, y, 10, 0, QPen(Qt::darkBlue,2)));
186 if(i == countPort)
break;
189 new GraphicLine( 20, y, 10, 0, QPen(Qt::darkBlue,2)));
204 if (
DocName.right(4) ==
".sym") {
206 App->
symEdit->setStatusTip(tr(
"Edits the Text"));
207 App->
symEdit->setWhatsThis(tr(
"Edit Text\n\nEdits the text file"));
210 App->
symEdit->setMenuText(tr(
"Edit Schematic"));
211 App->
symEdit->setStatusTip(tr(
"Edits the schematic"));
212 App->
symEdit->setWhatsThis(tr(
"Edit Schematic\n\nEdits the schematic"));
216 App->
symEdit->setMenuText(tr(
"Edit Circuit Symbol"));
217 App->
symEdit->setStatusTip(tr(
"Edits the symbol for this schematic"));
219 tr(
"Edit Circuit Symbol\n\nEdits the symbol for this schematic"));
237 else App->
undo->setEnabled(
false);
239 else App->
redo->setEnabled(
false);
250 else App->
undo->setEnabled(
false);
252 else App->
redo->setEnabled(
false);
266 QString base = Info.baseName (
true);
267 QString ext = Info.extension (
false);
336 case 1: xall = 1020; yall = 765;
break;
337 case 2: xall = 765; yall = 1020;
break;
338 case 3: xall = 1530; yall = 1020;
break;
339 case 4: xall = 1020; yall = 1530;
break;
340 case 5: xall = 2295; yall = 1530;
break;
341 case 6: xall = 1530; yall = 2295;
break;
342 case 7: xall = 1414; yall = 1054;
break;
343 case 8: xall = 1054; yall = 1414;
break;
344 default:
return false;
357 p->
Painter->setPen(QPen(Qt::darkGray,1));
360 int x1_, y1_, x2_, y2_;
361 p->
map(xall, yall, x1_, y1_);
362 x2_ = int(xall * p->
Scale) + 1;
363 y2_ = int(yall * p->
Scale) + 1;
364 p->
Painter->drawRect(x1_, y1_, -x2_, -y2_);
365 p->
Painter->drawRect(x1_-d, y1_-d, 2*d-x2_, 2*d-y2_);
368 int step = xall / ((xall+127) / 255);
369 for(z=step; z<=xall-step; z+=step) {
370 p->
map(z, 0, x2_, y2_);
371 p->
Painter->drawLine(x2_, y2_, x2_, y2_+d);
372 p->
Painter->drawLine(x2_, y1_-d, x2_, y1_);
374 char Letter[2] =
"1";
375 for(z=step/2+5; z<xall; z+=step) {
377 p->
map(z, yall+3, x2_, y2_);
378 p->
Painter->drawText(x2_, y2_-d, 0, 0, Qt::TextDontClip, Letter);
382 step = yall / ((yall+127) / 255);
383 for(z=step; z<=yall-step; z+=step) {
384 p->
map(0, z, x2_, y2_);
385 p->
Painter->drawLine(x2_, y2_, x2_+d, y2_);
386 p->
Painter->drawLine(x1_-d, y2_, x1_, y2_);
389 for(z=step/2+5; z<yall; z+=step) {
391 p->
map(xall+5, z, x2_, y2_);
392 p->
Painter->drawText(x2_-d, y2_, 0, 0, Qt::TextDontClip, Letter);
397 p->
map(xall-340, yall-3, x1_, y1_);
398 p->
map(xall-3, yall-3, x2_, y2_);
401 d = int(6.0 * p->
Scale);
402 z = int(200.0 * p->
Scale);
404 p->
Painter->drawLine(x1_, y1_, x2_, y1_);
409 p->
Painter->drawLine(x1_, y1_, x2_, y1_);
412 p->
Painter->drawRect(x2_, y2_, x1_-x2_-1, y1_-y2_-1);
423 paintGrid(&Painter, contentsX(), contentsY(),
424 visibleWidth(), visibleHeight());
435 pw->Label->paint(&Painter);
439 for(pn =
Nodes->first(); pn != 0; pn =
Nodes->next()) {
455 for(pn =
Nodes->first(); pn != 0; pn =
Nodes->next()) {
456 if(pn->
Name.isEmpty())
continue;
460 if(z & 1) x -= Painter.
Painter->fontMetrics().width(pn->
Name);
467 Painter.
Painter->setPen(Qt::darkGreen);
469 Painter.
Painter->setPen(Qt::blue);
482 QPainter painter2(viewport());
488 painter2.setCompositionMode(QPainter::RasterOp_SourceAndNotDestination);
490 Painter.
Painter->setCompositionMode(QPainter::RasterOp_SourceAndNotDestination);
494 painter2.drawRect(p.
x1, p.
y1, p.
x2, p.
y2);
500 painter2.drawLine(p.
x1, p.
y1, p.
x2, p.
y2);
506 painter2.drawEllipse(p.
x1, p.
y1, p.
x2, p.
y2);
512 painter2.drawArc(p.
x1, p.
y1, p.
x2, p.
y2, p.
a, p.
b);
517 Painter.
Painter->setPen(Qt::DotLine);
521 painter2.translate(p.
x1, p.
y1);
524 painter2.scale(p.
x1,p.
y1);
537 viewport()->update();
556 float x = float(Event->pos().x())/
Scale +
float(
ViewX1);
557 float y = float(Event->pos().y())/
Scale +
float(
ViewY1);
559 if(Event->button() != Qt::LeftButton)
591 Q3PaintDeviceMetrics pmetrics(Painter->device());
592 float printerDpiX = (float)pmetrics.logicalDpiX();
593 float printerDpiY = (float)pmetrics.logicalDpiY();
594 float printerW = (float)pmetrics.width();
595 float printerH = (float)pmetrics.height();
596 QPainter pa(viewport());
597 Q3PaintDeviceMetrics smetrics(pa.device());
598 float screenDpiX = (float)smetrics.logicalDpiX();
599 float screenDpiY = (float)smetrics.logicalDpiY();
600 float PrintScale = 0.5;
602 int marginX = (int)(40 * printerDpiX / screenDpiX);
603 int marginY = (int)(40 * printerDpiY / screenDpiY);
607 float ScaleX = float((printerW - 2*marginX) /
609 float ScaleY = float((printerH - 2*marginY) /
615 ScaleX = ((float)(printerW - 2*marginX) /
616 (float)(xall * printerDpiX)) * screenDpiX;
617 ScaleY = ((float)(printerH - 2*marginY) /
618 (float)(yall * printerDpiY)) * screenDpiY;
633 if(
UsedX1 > 0) StartX = 0;
634 if(
UsedY1 > 0) StartY = 0;
637 float PrintRatio = printerDpiX / screenDpiX;
638 QFont oldFont = Painter->font();
639 QFont printFont = Painter->font();
641 printFont.setPointSizeF(printFont.pointSizeF()/PrintRatio);
642 Painter->setFont(printFont);
644 p.
init(Painter, PrintScale * PrintRatio,
645 -StartX, -StartY, -marginX, -marginY,
646 PrintScale, PrintRatio);
653 Painter->setFont(oldFont);
662 if(pc->isSelected || printAll) {
663 selected = pc->isSelected;
664 pc->isSelected =
false;
668 pc->print(p, (
float)screenDpiX / (
float)printerDpiX);
670 pc->isSelected = selected;
674 if(pw->isSelected || printAll) {
675 selected = pw->isSelected;
676 pw->isSelected =
false;
678 pw->isSelected = selected;
681 if(pw->Label->isSelected || printAll) {
682 selected = pw->Label->isSelected;
683 pw->Label->isSelected =
false;
685 pw->Label->isSelected = selected;
691 for(pe = pn->Connections.first(); pe != 0; pe = pn->Connections.next())
697 if(pn->Label->isSelected || printAll) {
699 pn->Label->isSelected =
false;
701 pn->Label->isSelected = selected;
706 if(pp->isSelected || printAll) {
707 selected = pp->isSelected;
708 pp->isSelected =
false;
710 pp->isSelected = selected;
716 if(pd->isSelected || printAll) {
718 for(pg = pd->Graphs.first(); pg != 0; pg = pd->Graphs.next()) {
727 selected = pd->isSelected;
728 pd->isSelected =
false;
730 pd->isSelected = selected;
733 for(pg = pd->Graphs.first(); pg != 0; pg = pd->Graphs.next()) {
753 viewport()->setHidden(
true);
758 viewport()->setHidden(
false);
760 viewport()->update();
770 scrollBy(
int(s *
float(contentsX()+visibleWidth()/2)),
771 int(s *
float(contentsY()+visibleHeight()/2)) );
788 float xScale = float(visibleWidth()) / float(
UsedX2-
UsedX1+80);
789 float yScale = float(visibleHeight()) / float(
UsedY2-
UsedY1+80);
790 if(xScale > yScale) xScale = yScale;
818 if(x2==0)
if(y2==0)
if(x1==0)
if(y1==0) x2 = y2 = 800;
824 resizeContents(x2-x1+80, y2-y1+80);
825 viewport()->update();
860 if(x<0) x -= (
GridX >> 1) - 1;
861 else x +=
GridX >> 1;
864 if(y<0) y -= (
GridY >> 1) - 1;
865 else y +=
GridY >> 1;
874 p->
Painter->setPen(QPen(Qt::black,0));
877 p->
Painter->drawLine(-3+dx, dy, 4+dx, dy);
878 p->
Painter->drawLine( dx,-3+dy, dx, 4+dy);
885 if(x1<0) x1 -=
GridX - 1;
887 x1 -= x1 % (
GridX << 1);
889 if(y1<0) y1 -=
GridY - 1;
891 y1 -= y1 % (
GridY << 1);
893 float X, Y, Y0, DX, DY;
895 Y = Y0 = float(y1)*
Scale + p->
DY;
896 x1 = X > 0.0 ? int(X + 0.5) : int(X - 0.5);
897 y1 = Y > 0.0 ? int(Y + 0.5) : int(Y - 0.5);
900 int xEnd = x1 + Width;
901 int yEnd = y1 + Height;
904 while(DX <= 8.0) DX *= 1.5;
905 while(DY <= 8.0) DY *= 1.5;
909 y1 = Y > 0.0 ? int(Y + 0.5) : int(Y - 0.5);
913 y1 = Y > 0.0 ? int(Y + 0.5) : int(Y - 0.5);
916 x1 = X > 0.0 ? int(X + 0.5) : int(X - 0.5);
925 Font.setPointSizeFloat(
Scale *
float(Font.pointSize()) );
926 QFontMetrics metrics(Font);
927 return (
Scale /
float(metrics.lineSpacing()));
958 if(x1 < xmin) xmin = x1;
959 if(x2 > xmax) xmax = x2;
960 if(y1 < ymin) ymin = y1;
961 if(y2 > ymax) ymax = y2;
965 for(pw =
Wires->first(); pw != 0; pw =
Wires->next()) {
966 if(pw->
x1 < xmin) xmin = pw->
x1;
967 if(pw->
x2 > xmax) xmax = pw->
x2;
968 if(pw->
y1 < ymin) ymin = pw->
y1;
969 if(pw->
y2 > ymax) ymax = pw->
y2;
973 if(pl->
x1 < xmin) xmin = pl->
x1;
974 if((pl->
x1+pl->
x2) > xmax) xmax = pl->
x1 + pl->
x2;
975 if(pl->
y1 > ymax) ymax = pl->
y1;
976 if((pl->
y1-pl->
y2) < ymin) ymin = pl->
y1 - pl->
y2;
984 if(pl->
x1 < xmin) xmin = pl->
x1;
985 if((pl->
x1+pl->
x2) > xmax) xmax = pl->
x1 + pl->
x2;
986 if(pl->
y1 > ymax) ymax = pl->
y1;
987 if((pl->
y1-pl->
y2) < ymin) ymin = pl->
y1 - pl->
y2;
994 if(x1 < xmin) xmin = x1;
995 if(x2 > xmax) xmax = x2;
996 if(y1 < ymin) ymin = y1;
997 if(y2 > ymax) ymax = y2;
1001 for(
Marker *pm = pg->Markers.first(); pm!=0; pm = pg->Markers.next()) {
1002 pm->Bounding(x1, y1, x2, y2);
1003 if(x1 < xmin) xmin = x1;
1004 if(x2 > xmax) xmax = x2;
1005 if(y1 < ymin) ymin = y1;
1006 if(y2 > ymax) ymax = y2;
1013 if(x1 < xmin) xmin = x1;
1014 if(x2 > xmax) xmax = x2;
1015 if(y1 < ymin) ymin = y1;
1016 if(y2 > ymax) ymax = y2;
1024 Wires->setAutoDelete(
false);
1027 int x1=INT_MAX, y1=INT_MAX;
1028 int x2=INT_MIN, y2=INT_MIN;
1029 Q3PtrList<Element> ElementCache;
1032 copyWires(x1, y1, x2, y2, &ElementCache);
1034 if(y1 == INT_MAX)
return false;
1036 Wires->setAutoDelete(
true);
1049 for(
Element *pe = ElementCache.first(); pe != 0; pe = ElementCache.next())
1063 pw->
x1 = pw->
y1 - y1 + x1;
1064 pw->
y1 = x1 - x2 + y1;
1066 pw->
x2 = pw->
y2 - y1 + x1;
1067 pw->
y2 = x1 - x2 + y1;
1071 pl->
cx = pl->
cy - y1 + x1;
1072 pl->
cy = x1 - x2 + y1;
1084 pl->
x1 = pl->
y1 - y1 + x1;
1085 pl->
y1 = x1 - x2 + y1;
1091 pl->
x1 = pl->
y1 - y1 + x1;
1092 pl->
y1 = x1 - x2 + y1;
1095 pl->
cx = pl->
cy - y1 + x1;
1096 pl->
cy = x1 - x2 + y1;
1110 ElementCache.clear();
1121 Wires->setAutoDelete(
false);
1125 Q3PtrList<Element> ElementCache;
1128 Wires->setAutoDelete(
true);
1141 for(
Element *pe = ElementCache.first(); pe != 0; pe = ElementCache.next())
1153 pw->
y1 = y1 - pw->
y1;
1154 pw->
y2 = y1 - pw->
y2;
1156 if(pl) pl->
cy = y1 - pl->
cy;
1162 pl->
y1 = y1 - pl->
y1;
1167 pl->
y1 = y1 - pl->
y1;
1168 pl->
cy = y1 - pl->
cy;
1181 ElementCache.clear();
1190 Wires->setAutoDelete(
false);
1194 Q3PtrList<Element> ElementCache;
1197 Wires->setAutoDelete(
true);
1209 for(
Element *pe = ElementCache.first(); pe != 0; pe = ElementCache.next())
1221 pw->
x1 = x1 - pw->
x1;
1222 pw->
x2 = x1 - pw->
x2;
1224 if(pl) pl->
cx = x1 - pl->
cx;
1230 pl->
x1 = x1 - pl->
x1;
1235 pl->
x1 = x1 - pl->
x1;
1236 pl->
cx = x1 - pl->
cx;
1249 ElementCache.clear();
1260 pd->loadGraphData(Info.dirPath()+QDir::separator()+
DataSet);
1291 lastSaved = QDateTime::currentDateTime();
1330 p->replace(1,1,
' ');
1331 ps->replace(1,1,
'i');
1336 p->replace(1,1,
' ');
1337 ps->replace(1,1,
'i');
1376 if(pp->
Name ==
".PortSym ")
1383 QString Suffix = Info.extension (
false);
1386 if (Suffix ==
"vhd" || Suffix ==
"vhdl") {
1387 QStringList::iterator it;
1388 QStringList Names, GNames, GTypes, GDefs;
1393 QString Name = Info.dirPath() + QDir::separator() +
DataDisplay;
1403 Names = QStringList::split(
",",VInfo.
PortNames);
1406 if(pp->
Name ==
".ID ") {
1409 id->Parameter.clear();
1410 GNames = QStringList::split(
",",VInfo.
GenNames);
1411 GTypes = QStringList::split(
",",VInfo.
GenTypes);
1412 GDefs = QStringList::split(
",",VInfo.
GenDefs);
1413 for(Number = 1, it = GNames.begin(); it != GNames.end(); ++it) {
1416 *it+
"="+GDefs[Number-1],
1417 tr(
"generic")+
" "+QString::number(Number),
1423 for(Number = 1, it = Names.begin(); it != Names.end(); ++it, Number++) {
1426 Str = QString::number(Number);
1429 if(pp->
Name ==
".PortSym ")
1430 if(((
PortSymbol*)pp)->numberStr == Str)
break;
1441 else if (Suffix ==
"v") {
1443 QStringList::iterator it;
1449 QString Name = Info.dirPath() + QDir::separator() +
DataDisplay;
1459 Names = QStringList::split(
",",VInfo.
PortNames);
1462 if(pp->
Name ==
".ID ") {
1465 id->Parameter.clear();
1468 for(Number = 1, it = Names.begin(); it != Names.end(); ++it, Number++) {
1471 Str = QString::number(Number);
1474 if(pp->
Name ==
".PortSym ")
1475 if(((
PortSymbol*)pp)->numberStr == Str)
break;
1486 else if (Suffix ==
"va") {
1488 QStringList::iterator it;
1494 QString Name = Info.dirPath() + QDir::separator() +
DataDisplay;
1504 Names = QStringList::split(
",",VInfo.
PortNames);
1507 if(pp->
Name ==
".ID ") {
1510 id->Parameter.clear();
1513 for(Number = 1, it = Names.begin(); it != Names.end(); ++it, Number++) {
1516 Str = QString::number(Number);
1519 if(pp->
Name ==
".PortSym ")
1520 if(((
PortSymbol*)pp)->numberStr == Str)
break;
1536 if(pc->Model ==
"Port")
1540 Str = pc->Props.getFirst()->Value;
1544 if(pp->
Name ==
".PortSym ")
1546 if(((
PortSymbol*)pp)->numberStr == Str)
break;
1565 if(pp->
Name ==
".PortSym ")
1588 else App->
undo->setEnabled(
false);
1590 else App->
redo->setEnabled(
false);
1592 if(ps->at(1) ==
'i')
1611 else App->
undo->setEnabled(
false);
1613 else App->
redo->setEnabled(
false);
1615 if(ps->at(1) ==
'i') {
1620 else if(
UndoSymbol.current()->at(1) ==
'i') {
1641 else App->
undo->setEnabled(
false);
1643 else App->
redo->setEnabled(
false);
1645 if(ps->at(1) ==
'i')
1664 else App->
undo->setEnabled(
false);
1666 else App->
redo->setEnabled(
false);
1668 if(ps->at(1) ==
'i') {
1673 else if(
UndoSymbol.current()->at(1) ==
'i') {
1691 Q3PtrList<WireLabel> LabelCache;
1696 if(pc->isSelected) {
1699 for(pp = pc->Ports.first(); pp != 0; pp = pc->Ports.next())
1714 pc->isSelected =
false;
1719 for(pl = LabelCache.first(); pl != 0; pl = LabelCache.next()) {
1728 Wires->setAutoDelete(
false);
1734 if(pw->isSelected) {
1737 if(pw->Port1->Label) {
1738 if(pw->Port1->Connections.count() < 2) {
1739 pLabel = pw->Port1->Label;
1740 pw->Port1->Label = 0;
1743 else if(pw->Port2->Label) {
1744 if(pw->Port2->Connections.count() < 2) {
1745 pLabel = pw->Port2->Label;
1746 pw->Port2->Label = 0;
1756 pw->isSelected =
false;
1776 Wires->setAutoDelete(
true);
1781 if(pn->Label->isSelected) {
1782 setOnGrid(pn->Label->x1, pn->Label->y1);
1783 pn->Label->isSelected =
false;
1789 if(pd->isSelected) {
1791 pd->isSelected =
false;
1795 for(
Graph *pg = pd->Graphs.first(); pg != 0; pg = pd->Graphs.next())
1797 for(
Marker *pm = pg->Markers.first(); pm != 0; pm = pg->Markers.next())
1798 if(pm->isSelected) {
1799 x = pm->x1 + pd->cx;
1800 y = pm->y1 + pd->cy;
1802 pm->x1 = x - pd->cx;
1803 pm->y1 = y - pd->cy;
1804 pm->isSelected =
false;
1811 if(pa->isSelected) {
1813 pa->isSelected =
false;
1853 int delta = Event->delta() >> 1;
1856 if((Event->state() & Qt::ShiftModifier) ||
1857 (Event->orientation() == Qt::Horizontal)) {
1858 if(delta > 0) {
if(
scrollLeft(delta)) scrollBy(-delta, 0); }
1859 else {
if(
scrollRight(delta)) scrollBy(-delta, 0); }
1860 viewport()->update();
1864 else if(Event->state() & Qt::ControlModifier) {
1866 if(delta < 0) Scaling = float(delta)/-60.0/1.1;
1867 else Scaling = 1.1*60.0/float(delta);
1870 scrollBy(
int(Scaling *
float(Event->pos().x())),
1871 int(Scaling *
float(Event->pos().y())) );
1875 if(delta > 0) {
if(
scrollUp(delta)) scrollBy(0, -delta); }
1876 else {
if(
scrollDown(delta)) scrollBy(0, -delta); }
1877 viewport()->update();
1891 diff = contentsY() - step;
1893 resizeContents(contentsWidth(), contentsHeight()-diff);
1901 if(step < diff) diff = step;
1902 resizeContents(contentsWidth(), contentsHeight()-diff);
1916 diff = contentsHeight() - contentsY()-visibleHeight() + step;
1918 resizeContents(contentsWidth(), contentsHeight()-diff);
1926 if(step > diff) diff = step;
1927 resizeContents(contentsWidth(), contentsHeight()+diff);
1942 diff = contentsX() - step;
1944 resizeContents(contentsWidth()-diff, contentsHeight());
1952 if(step < diff) diff = step;
1953 resizeContents(contentsWidth()-diff, contentsHeight());
1967 diff = contentsWidth() - contentsX()-visibleWidth() + step;
1969 resizeContents(contentsWidth()-diff, contentsHeight());
1977 if(step > diff) diff = step;
1978 resizeContents(contentsWidth()+diff, contentsHeight());
1991 scrollUp(verticalScrollBar()->lineStep());
1992 viewport()->update();
2001 scrollDown(-verticalScrollBar()->lineStep());
2002 viewport()->update();
2011 scrollLeft(horizontalScrollBar()->lineStep());
2012 viewport()->update();
2022 viewport()->update();
2038 Q3UriDrag::decode(Event, List);
2046 for(
unsigned int i=0; i < List.count(); i++)
2047 App->
gotoPage(QDir::convertSeparators(Q3UriDrag::uriToLocalFile(List.at(i))));
2054 QMouseEvent e(QEvent::MouseButtonPress, Event->pos(),
2055 Qt::LeftButton, Qt::NoButton);
2077 if(Event->provides(
"text/uri-list"))
2078 if(Q3UriDrag::canDecode(Event)) {
2085 if(Event->provides(
"text/plain")) {
2087 if(Q3TextDrag::decode(Event, s))
2088 if(s.left(15) ==
"QucsComponent:<") {
2101 if(Event->format(1) == 0) {
2104 if(Event->provides(
"application/x-qabstractitemmodeldatalist")) {
2129 QPainter painter(viewport());
2148 QMouseEvent e(QEvent::MouseMove, Event->pos(), Qt::NoButton, Qt::NoButton);
2163 int x1,y1,x2,y2,d1,d2,d3,d4;
2164 pc->entireBounds(x1,y1,x2,y2,this->
textCorr());
2166 d1 = std::min(x1,x2);
2167 if (d1<xmin) xmin = d1;
2168 d2 = std::max(x2,x1);
2169 if (d2>xmax) xmax = d2;
2170 d3 = std::min(y1,y2);
2171 if (d3<ymin) ymin = d3;
2172 d4 = std::max(y2,y1);
2173 if (d4>ymax) ymax = d4;
2178 pw->getCenter(xc,yc);
2180 if (xc<xmin) xmin = xc;
2181 if (xc>xmax) xmax = xc;
2182 if (yc<ymin) ymin = yc;
2183 if (yc>ymax) ymax = yc;
2188 int x1,y1,x2,y2,d1,d2,d3,d4;
2189 pd->Bounding(x1,y1,x2,y2);
2191 d1 = std::min(x1,x2);
2192 if (d1<xmin) xmin = d1;
2193 d2 = std::max(x2,x1);
2194 if (d2>xmax) xmax = d2;
2195 d3 = std::min(y1,y2);
2196 if (d3<ymin) ymin = d3;
2197 d4 = std::max(y2,y1);
2198 if (d4>ymax) ymax = d4;
2202 int x1,y1,x2,y2,d1,d2,d3,d4;
2203 pp->Bounding(x1,y1,x2,y2);
2205 d1 = std::min(x1,x2);
2206 if (d1<xmin) xmin = d1;
2207 d2 = std::max(x2,x1);
2208 if (d2>xmax) xmax = d2;
2209 d3 = std::min(y1,y2);
2210 if (d3<ymin) ymin = d3;
2211 d4 = std::max(y2,y1);
2212 if (d4>ymax) ymax = d4;
2215 w = abs(xmax - xmin);
2216 h = abs(ymax - ymin);
2229 if (pc->isSelected) {
2230 int x1,y1,x2,y2,d1,d2,d3,d4;
2231 pc->entireBounds(x1,y1,x2,y2,this->
textCorr());
2232 d1 = std::min(x1,x2);
2233 if (d1<xmin) xmin = d1;
2234 d2 = std::max(x2,x1);
2235 if (d2>xmax) xmax = d2;
2236 d3 = std::min(y1,y2);
2237 if (d3<ymin) ymin = d3;
2238 d4 = std::max(y2,y1);
2239 if (d4>ymax) ymax = d4;
2245 if (pw->isSelected) {
2247 pw->getCenter(xc,yc);
2249 if (xc<xmin) xmin = xc;
2250 if (xc>xmax) xmax = xc;
2251 if (yc<ymin) ymin = yc;
2252 if (yc>ymax) ymax = yc;
2260 if (pd->isSelected) {
2261 int x1,y1,x2,y2,d1,d2,d3,d4;
2262 pd->Bounding(x1,y1,x2,y2);
2264 d1 = std::min(x1,x2);
2265 if (d1<xmin) xmin = d1;
2266 d2 = std::max(x2,x1);
2267 if (d2>xmax) xmax = d2;
2268 d3 = std::min(y1,y2);
2269 if (d3<ymin) ymin = d3;
2270 d4 = std::max(y2,y1);
2271 if (d4>ymax) ymax = d4;
2277 if (pp->isSelected) {
2278 int x1,y1,x2,y2,d1,d2,d3,d4;
2279 pp->Bounding(x1,y1,x2,y2);
2280 d1 = std::min(x1,x2);
2281 if (d1<xmin) xmin = d1;
2282 d2 = std::max(x2,x1);
2283 if (d2>xmax) xmax = d2;
2284 d3 = std::min(y1,y2);
2285 if (d3<ymin) ymin = d3;
2286 d4 = std::max(y2,y1);
2287 if (d4>ymax) ymax = d4;
2291 wsel = abs(xmax - xmin);
2292 hsel = abs(ymax - ymin);
Q3PtrList< Marker > Markers
void contentsMouseMoveEvent(QMouseEvent *)
void deleteComp(Component *)
void MPressElement(Schematic *, QMouseEvent *, float, float)
Q3PtrList< Painting > DocPaints
void updateSpiceNameHash(void)
Definition of the TextDoc class.
const char * smallsave_xpm[]
bool gotoPage(const QString &)
void PostPaintEvent(PE pe, int x1=0, int y1=0, int x2=0, int y2=0, int a=0, int b=0, bool PaintOnViewport=false)
void(MouseActions::* MouseMoveAction)(Schematic *, QMouseEvent *)
void MMoveElement(Schematic *, QMouseEvent *)
Q3PtrList< Component > SymbolComps
void paint(ViewPainter *)
void map(int, int, int &, int &)
tQucsSettings QucsSettings
void(MouseActions::* MousePressAction)(Schematic *, QMouseEvent *, float, float)
Q3PtrList< Wire > SymbolWires
Component * getComponentFromName(QString &Line, Schematic *p)
QString createSymbolUndoString(char)
void drawLine(int, int, int, int)
bool paste(QTextStream *, Q3PtrList< Element > *)
QString createClipboardFile()
void contentsMouseReleaseEvent(QMouseEvent *)
void setOnGrid(int &, int &)
void copyPaintings(int &, int &, int &, int &, Q3PtrList< Element > *)
void contentsWheelEvent(QWheelEvent *)
int copyWires(int &, int &, int &, int &, Q3PtrList< Element > *)
QucsDoc * getDoc(int No=-1)
bool createSubcircuitSymbol()
QucsDoc * findDoc(QString, int *Pos=0)
void insertRawComponent(Component *, bool noOptimize=true)
#define isDigitalComponent
void enlargeView(int, int, int, int)
Q3PtrList< Diagram > * Diagrams
Definitions and declarations for the main application.
bool copyComps2WiresPaints(int &, int &, int &, int &, Q3PtrList< Element > *)
void paint(ViewPainter *)
void contentsMousePressEvent(QMouseEvent *)
void entireBounds(int &, int &, int &, int &, float)
void setPainter(Schematic *)
void print(QPrinter *, QPainter *, bool, bool)
Q3PtrList< Component > * Components
void printCursorPosition(int, int)
int drawText(const QString &, int, int, int *Height=0)
Q3PtrList< Diagram > DocDiags
void drawContents(QPainter *, int, int, int, int)
Q3PtrList< Element > Connections
QString createUndoString(char)
Q3PtrList< Node > * Nodes
Q3PtrList< Graph > Graphs
void Bounding(int &, int &, int &, int &)
bool pasteFromClipboard(QTextStream *, Q3PtrList< Element > *)
void paintGrid(ViewPainter *, int, int, int, int)
virtual void getCenter(int &, int &)
void drawArc(int, int, int, int, int, int)
QList< PostedPaintEvent > PostedPaintEvents
void(MouseActions::* MouseReleaseAction)(Schematic *, QMouseEvent *)
#define isAnalogComponent
bool sizeOfFrame(int &, int &)
QString copySelected(bool)
Q3PtrList< Node > SymbolNodes
void drawRect(int, int, int, int)
Superclass of all schematic drawing elements.
bool rebuildSymbol(QString *)
void getSelAreaWidthAndHeight(int &wsel, int &hsel, int &xmin_sel_, int &ymin_sel_)
void paintSchToViewpainter(ViewPainter *p, bool printAll, bool toImage, int screenDpiX=96, int printerDpiX=300)
void paintFrame(ViewPainter *)
int copyComponents(int &, int &, int &, int &, Q3PtrList< Element > *)
void MPressWire2(Schematic *, QMouseEvent *, float, float)
MouseActions::MPressWire2 Is called if ending point of wire is pressed.
Q3PtrList< Diagram > SymbolDiags
Schematic(QucsApp *, const QString &)
void contentsDragMoveEvent(QDragMoveEvent *)
void MReleasePaste(Schematic *, QMouseEvent *)
Q3PtrList< Painting > SymbolPaints
void copyLabels(int &, int &, int &, int &, Q3PtrList< Element > *)
Q3PtrList< QString > UndoSymbol
void(MouseActions::* MouseDoubleClickAction)(Schematic *, QMouseEvent *)
The TextDoc class definition.
void contentsDragEnterEvent(QDragEnterEvent *)
void contentsMouseDoubleClickEvent(QMouseEvent *)
Q3PtrList< Wire > DocWires
void setCenter(int, int, bool relative=false)
void init(QPainter *, float, int, int, int, int, float FontScale_=0.0, float PrintScale_=1.0)
void sizeOfAll(int &, int &, int &, int &)
void rightPressMenu(Schematic *, QMouseEvent *, float, float)
Q3PtrList< QString > UndoStack
void contentsDropEvent(QDropEvent *)
void setName(const QString &)
Q3PtrList< Node > DocNodes
Q3PtrList< Painting > * Paintings
Q3PtrList< Wire > * Wires
virtual void Bounding(int &, int &, int &, int &)
void getSchWidthAndHeight(int &w, int &h, int &xmin_, int &ymin_)
void updateSchNameHash(void)
void drawEllipse(int, int, int, int)
void slotSelectComponent(QListWidgetItem *)
virtual void setCenter(int, int, bool relative=false)
void setChanged(bool, bool fillStack=false, char Op='*')
void insertNodeLabel(WireLabel *)
Q3PtrList< Component > DocComps
void contentsDragLeaveEvent(QDragLeaveEvent *)