26 #include "components/component.h"
42 for(pn =
Nodes->first(); pn != 0; pn =
Nodes->next())
43 if(pn->
cx == x)
if(pn->
cy == y) {
58 if(pw->y1 > y)
continue;
59 if(pw->y2 < y)
continue;
61 else if(pw->y1 == y) {
62 if(pw->x1 > x)
continue;
63 if(pw->x2 < x)
continue;
79 if(pn->getSelected(x, y))
99 for(pn =
Nodes->first(); pn != 0; pn =
Nodes->next())
100 if(pn->
cx == w->
x1)
if(pn->
cy == w->
y1)
break;
111 for(
Wire *ptr2 =
Wires->first(); ptr2 != 0; ptr2 =
Wires->next()) {
112 if(ptr2->x1 == w->
x1) {
113 if(ptr2->y1 > w->
y1)
continue;
114 if(ptr2->y2 < w->
y1)
continue;
117 if(ptr2->y2 >= w->
y2) {
123 if(ptr2->Port2->Connections.count() == 1) {
125 w->
Port1 = ptr2->Port1;
127 w->
Label = ptr2->Label;
131 ptr2->Port1->Connections.append(w);
132 Nodes->removeRef(ptr2->Port2);
133 Wires->removeRef(ptr2);
138 w->
Port1 = ptr2->Port2;
145 else if(ptr2->y1 == w->
y1) {
146 if(ptr2->x1 > w->
x1)
continue;
147 if(ptr2->x2 < w->
x1)
continue;
150 if(ptr2->x2 >= w->
x2) {
157 if(ptr2->Port2->Connections.count() == 1) {
159 w->
Port1 = ptr2->Port1;
161 w->
Label = ptr2->Label;
165 ptr2->Port1->Connections.append(w);
166 Nodes->removeRef(ptr2->Port2);
167 Wires->removeRef(ptr2);
172 w->
Port1 = ptr2->Port2;
225 Wires->removeRef(pw);
228 if(pw->
x2 >= w->
x2) {
241 Wires->removeRef(pw);
281 Wires->removeRef(pw);
284 if(pw->
y2 >= w->
y2) {
297 Wires->removeRef(pw);
318 for(pn =
Nodes->first(); pn != 0; pn =
Nodes->next())
319 if(pn->
cx == w->
x2)
if(pn->
cy == w->
y2)
break;
330 for(
Wire *ptr2 =
Wires->first(); ptr2 != 0; ptr2 =
Wires->next()) {
331 if(ptr2->x1 == w->
x2) {
332 if(ptr2->y1 > w->
y2)
continue;
333 if(ptr2->y2 < w->
y2)
continue;
339 if(ptr2->Port1->Connections.count() == 1) {
341 w->
Label = ptr2->Label;
345 w->
Port2 = ptr2->Port2;
347 ptr2->Port2->Connections.append(w);
348 Nodes->removeRef(ptr2->Port1);
349 Wires->removeRef(ptr2);
354 w->
Port2 = ptr2->Port1;
360 else if(ptr2->y1 == w->
y2) {
361 if(ptr2->x1 > w->
x2)
continue;
362 if(ptr2->x2 < w->
x2)
continue;
368 if(ptr2->Port1->Connections.count() == 1) {
370 w->
Label = ptr2->Label;
374 w->
Port2 = ptr2->Port2;
376 ptr2->Port2->Connections.append(w);
377 Nodes->removeRef(ptr2->Port1);
378 Wires->removeRef(ptr2);
383 w->
Port2 = ptr2->Port1;
430 Wires->removeRef(pw);
444 Wires->removeRef(pw);
479 Wires->removeRef(pw);
493 Wires->removeRef(pw);
517 if(w->
x1 > w->
x2) { tmp = w->
x1; w->
x1 = w->
x2; w->
x2 = tmp; }
519 if(w->
y1 > w->
y2) { tmp = w->
y1; w->
y1 = w->
y2; w->
y2 = tmp; }
525 if(tmp == 0)
return 3;
526 if(tmp > 1) con |= 2;
536 if(tmp == 0)
return 3;
537 if(tmp > 1) con |= 1;
546 if(con > 255) con = ((con >> 1) & 1) | ((con << 1) & 2);
560 for(pw =
Wires->current(); pw != 0; pw =
Wires->next())
561 for(pn =
Nodes->first(); pn != 0; ) {
562 if(pn->
cx == pw->
x1) {
563 if(pn->
cy <= pw->
y1) { pn =
Nodes->next();
continue; }
564 if(pn->
cy >= pw->
y2) { pn =
Nodes->next();
continue; }
566 else if(pn->
cy == pw->
y1) {
567 if(pn->
cx <= pw->
x1) { pn =
Nodes->next();
continue; }
568 if(pn->
cx >= pw->
x2) { pn =
Nodes->next();
continue; }
570 else { pn =
Nodes->next();
continue; }
586 Nodes->removeRef(pn);
593 Nodes->removeRef(pn2);
602 Wires->removeRef(nw);
607 if(n1 == 1)
if(n2 == 1)
continue;
610 if((pw->
x1 != pn->
cx) || (pw->
y1 != pn->
cy)) {
626 if (
Wires->containsRef (w))
644 if(((
Wire*)pe)->Port1 == pn) pn = ((
Wire*)pe)->Port2;
645 else pn = ((
Wire*)pe)->Port1;
646 if(pn == pn_1st)
break;
654 if(pw->getSelected(x, y))
675 Wires->append(newWire);
697 if(e1->
x1 == e2->
x2)
if(e1->
y1 == e2->
y2) {
698 e3 = e1; e1 = e2; e2 = e3;
719 Wires->removeRef(e2);
757 int Schematic::copyWires(
int& x1,
int& y1,
int& x2,
int& y2,
758 QPtrList<Element> *ElementCache)
764 for(pw =
Wires->first(); pw != 0; )
766 if(pw->
x1 < x1) x1 = pw->
x1;
767 if(pw->
x2 > x2) x2 = pw->
x2;
768 if(pw->
y1 < y1) y1 = pw->
y1;
769 if(pw->
y2 > y2) y2 = pw->
y2;
772 ElementCache->append(pw);
778 ElementCache->append(pn->
Label);
788 ElementCache->append(pn->
Label);
800 pw =
Wires->current();
802 else pw =
Wires->next();
819 if(pd->getSelected(x, y)) {
822 for(
Graph *pg = pd->Graphs.first(); pg != 0; pg = pd->Graphs.next()) {
823 n = pg->getSelected(x-pd->cx, pd->cy-y);
826 pg->Markers.append(pm);
842 for(pm = (
Marker*)Elements->first(); pm!=0; pm = (
Marker*)Elements->next()) {
857 for(pm = (
Marker*)Elements->first(); pm!=0; pm = (
Marker*)Elements->next()) {
878 int n,
x = int(fX), y = int(fY);
892 if(flag) { pl->
isSelected ^= flag;
return pl; }
897 if(pe_1st == 0) pe_1st = pl;
905 if(flag) { pw->
isSelected ^= flag;
return pw; }
910 if(pe_1st == 0) pe_1st = pw;
915 if(flag) { pl->
isSelected ^= flag;
return pl; }
920 if(pe_1st == 0) pe_1st = pl;
927 if(pc->getSelected(x, y)) {
928 if(flag) { pc->
isSelected ^= flag;
return pc; }
930 pe_sel->isSelected =
false;
933 if(pe_1st == 0) pe_1st = pc;
934 if(pc->isSelected) pe_sel = pc;
937 n = pc->getTextSelected(x, y, Corr);
940 if(index) *index =
n;
950 for(pg = pd->Graphs.first(); pg != 0; pg = pd->Graphs.next())
953 if(pm->getSelected(x-pd->cx, y-pd->cy)) {
954 if(flag) { pm->isSelected ^= flag;
return pm; }
956 pe_sel->isSelected =
false;
959 if(pe_1st == 0) pe_1st = pm;
960 if(pm->isSelected) pe_sel = pm;
965 if(pd->resizeTouched(fX, fY, Corr))
971 if(pd->getSelected(x, y)) {
972 if(pd->Name[0] ==
'T') {
973 if(pd->Name[1] ==
'i') {
975 if(x < pd->
cx+pd->xAxis.numGraphs)
continue;
989 for(pg = pd->Graphs.first(); pg != 0; pg = pd->Graphs.next())
991 if(flag) { pg->
isSelected ^= flag;
return pg; }
996 if(pe_1st == 0) pe_1st = pg;
1001 if(flag) { pd->
isSelected ^= flag;
return pd; }
1003 pe_sel->isSelected =
false;
1006 if(pe_1st == 0) pe_1st = pd;
1007 if(pd->isSelected) pe_sel = pd;
1014 if(pp->resizeTouched(fX, fY, Corr))
1020 if(pp->getSelected(fX, fY, Corr)) {
1021 if(flag) { pp->isSelected ^= flag;
return pp; }
1023 pe_sel->isSelected =
false;
1026 if(pe_1st == 0) pe_1st = pp;
1027 if(pp->isSelected) pe_sel = pp;
1040 if(e != pc) pc->isSelected =
false;
1054 if(e != pd) pd->isSelected =
false;
1057 for(
Graph *pg = pd->Graphs.first(); pg != 0; pg = pd->Graphs.next()) {
1058 if(e != pg) pg->isSelected =
false;
1061 for(
Marker *pm = pg->Markers.first(); pm != 0; pm = pg->Markers.next())
1062 if(e != pm) pm->isSelected =
false;
1069 if(e != pp) pp->isSelected =
false;
1077 int cx1, cy1, cx2, cy2;
1080 cx1 = (x1 < x2) ? x1 : x2; cx2 = (x1 > x2) ? x1 : x2;
1081 cy1 = (y1 < y2) ? y1 : y2; cy2 = (y1 > y2) ? y1 : y2;
1087 pc->Bounding(cx1, cy1, cx2, cy2);
1088 if(cx1 >= x1)
if(cx2 <= x2)
if(cy1 >= y1)
if(cy2 <= y2) {
1089 pc->isSelected =
true; z++;
1092 if(pc->isSelected &= flag) z++;
1097 for(pw =
Wires->first(); pw != 0; pw =
Wires->next()) {
1098 if(pw->
x1 >= x1)
if(pw->
x2 <= x2)
if(pw->
y1 >= y1)
if(pw->
y2 <= y2) {
1108 for(pw =
Wires->first(); pw != 0; pw =
Wires->next()) {
1111 if(pl->
x1 >= x1)
if((pl->
x1+pl->
x2) <= x2)
1112 if(pl->
y1 >= y1)
if((pl->
y1+pl->
y2) <= y2) {
1125 if(pl->
x1 >= x1)
if((pl->
x1+pl->
x2) <= x2)
1126 if((pl->
y1-pl->
y2) >= y1)
if(pl->
y1 <= y2) {
1138 for(
Graph *pg = pd->Graphs.first(); pg != 0; pg = pd->Graphs.next()) {
1139 if(pg->isSelected &= flag) z++;
1142 for(
Marker *pm = pg->Markers.first(); pm!=0; pm = pg->Markers.next()) {
1143 pm->Bounding(cx1, cy1, cx2, cy2);
1144 if(cx1 >= x1)
if(cx2 <= x2)
if(cy1 >= y1)
if(cy2 <= y2) {
1145 pm->isSelected =
true; z++;
1148 if(pm->isSelected &= flag) z++;
1153 pd->Bounding(cx1, cy1, cx2, cy2);
1154 if(cx1 >= x1)
if(cx2 <= x2)
if(cy1 >= y1)
if(cy2 <= y2) {
1155 pd->isSelected =
true; z++;
1158 if(pd->isSelected &= flag) z++;
1163 pp->Bounding(cx1, cy1, cx2, cy2);
1164 if(cx1 >= x1)
if(cx2 <= x2)
if(cy1 >= y1)
if(cy2 <= y2) {
1165 pp->isSelected =
true; z++;
1168 if(pp->isSelected &= flag) z++;
1179 for(
Graph *pg = pd->Graphs.first(); pg != 0; pg = pd->Graphs.next())
1180 for(
Marker *pm = pg->Markers.first(); pm!=0; pm = pg->Markers.next())
1181 pm->isSelected =
true;
1209 long mask = 1, invMask = 3;
1213 if(pn2 == pn) pn2 = pw->
Port2;
1216 if((pn2->
State & (8+4)) == 0) {
1241 if(pw->
Port1 != pn) {
1270 p->insert(pos, pw2);
1277 if(pw2->
Port1 != pn2) {
1318 for(pp = pc->
Ports.first(); pp!=0; pp = pc->
Ports.next()) {
1329 for(pw =
Wires->first(); pw != 0; ) {
1331 p->append(pw->
Label);
1341 pw =
Wires->current();
1343 else pw =
Wires->next();
1351 for(i=0; i<count; i++) {
1352 for(pp = pc->
Ports.first(); pp!=0; pp = pc->
Ports.next())
1359 for(pe = (
Element*)pc; pe != 0; pe = p->next())
1363 for(pw = (
Wire*)pe; pw != 0; pw = (
Wire*)p->next())
1373 for(pn =
Nodes->first(); pn!=0; ) {
1377 pn =
Nodes->current();
1388 p->append(pn->
Label);
1391 pn =
Nodes->current();
1401 for(pn =
Nodes->first(); pn != 0; pn =
Nodes->next())
1403 p->append(pn->
Label);
1408 if(ppa->isSelected) {
1417 for(pd =
Diagrams->first(); pd != 0; )
1425 for(
Marker *pm = pg->Markers.first(); pm != 0; )
1426 if(pm->isSelected) {
1430 pm = pg->Markers.current();
1432 else pm = pg->Markers.next();
1441 bool Schematic::copyComps2WiresPaints(
int& x1,
int& y1,
int& x2,
int& y2,
1442 QPtrList<Element> *ElementCache)
1449 copyComponents2(x1, y1, x2, y2, ElementCache);
1450 copyWires(x1, y1, x2, y2, ElementCache);
1453 if(y1 == INT_MAX)
return false;
1459 int Schematic::copyElements(
int& x1,
int& y1,
int& x2,
int& y2,
1460 QPtrList<Element> *ElementCache)
1462 int bx1, by1, bx2, by2;
1463 Wires->setAutoDelete(
false);
1471 int number = copyComponents(x1, y1, x2, y2, ElementCache);
1472 number += copyWires(x1, y1, x2, y2, ElementCache);
1474 Wires->setAutoDelete(
true);
1479 if(pd->isSelected) {
1480 pd->Bounding(bx1, by1, bx2, by2);
1481 if(bx1 < x1) x1 = bx1;
1482 if(bx2 > x2) x2 = bx2;
1483 if(by1 < y1) y1 = by1;
1484 if(by2 > y2) y2 = by2;
1485 ElementCache->append(pd);
1490 if(pp->isSelected) {
1491 pp->Bounding(bx1, by1, bx2, by2);
1492 if(bx1 < x1) x1 = bx1;
1493 if(bx2 > x2) x2 = bx2;
1494 if(by1 < y1) y1 = by1;
1495 if(by2 > y2) y2 = by2;
1496 ElementCache->append(pp);
1529 pw =
Wires->current();
1532 else pw =
Wires->next();
1552 bool wasGraphDeleted =
false;
1556 for(
Marker *pm = pg->Markers.first(); pm != 0; )
1557 if(pm->isSelected) {
1558 pg->Markers.remove();
1559 pm = pg->Markers.current();
1562 else pm = pg->Markers.next();
1564 if(pg->isSelected) {
1566 pg = pd->
Graphs.current();
1567 sel = wasGraphDeleted =
true;
1569 else pg = pd->
Graphs.next();
1580 if(pp->
Name.at(0) !=
'.') {
1600 int bx1, by1, bx2, by2, *bx=0, *by=0, *ax=0, *ay=0;
1601 QPtrList<Element> ElementCache;
1602 int count = copyElements(x1, y1, x2, y2, &ElementCache);
1603 if(count < 1)
return false;
1653 for(
Element *pe = ElementCache.last(); pe != 0; pe = ElementCache.prev())
1660 pc->
setCenter(x1-((*bx)+(*ax))/y2, y1-((*by)+(*ay))/y2,
true);
1670 pw->
setCenter(x1-((*bx)+(*ax))/y2, y1-((*by)+(*ay))/y2,
true);
1683 bx2 = bx1 + ((
Diagram*)pe)->x2;
1684 by1 = by2 - ((
Diagram*)pe)->y2;
1685 ((
Diagram*)pe)->setCenter(x1-((*bx)+(*ax))/y2, y1-((*by)+(*ay))/y2,
true);
1689 ((
Painting*)pe)->Bounding(bx1, by1, bx2, by2);
1690 ((
Painting*)pe)->setCenter(x1-((*bx)+(*ax))/y2, y1-((*by)+(*ay))/y2,
true);
1700 bx1 = pw->
x1; by1 = pw->
y1;
1701 bx2 = pw->
x2; by2 = pw->
y2;
1703 ((
WireLabel*)pe)->cx += x1-((*bx)+(*ax))/y2;
1704 ((
WireLabel*)pe)->cy += y1-((*by)+(*ay))/y2;
1711 ElementCache.clear();
1712 if(count < 2)
return false;
1722 int bx1, by1, bx2, by2;
1723 QPtrList<Element> ElementCache;
1724 int count = copyElements(x1, y1, x2, y2, &ElementCache);
1725 if(count < 1)
return false;
1738 for(
int i = count-1;
i>0;
i--) {
1739 pe = ElementCache.first();
1740 for(
int j=0; j<
i; j++) {
1742 pe=ElementCache.next();
1745 ElementCache.replace(j+1, ElementCache.prev());
1746 ElementCache.replace(j, pe);
1747 pe = ElementCache.next();
1752 ElementCache.getLast()->
getCenter(x2, y2);
1753 ElementCache.getFirst()->getCenter(x1, y1);
1757 if(count > 1) dx = (x2-x1)/(count-1);
1760 for(pe = ElementCache.last(); pe != 0; pe = ElementCache.prev()) {
1772 x1 = pw->
x2 - pw->
x1;
1773 pw->
x1 = x - (x1 >> 1);
1774 pw->
x2 = pw->
x1 + x1;
1776 else pw->
x1 = pw->
x2 =
x;
1782 pe->
cx = x - (pe->
x2 >> 1);
1797 x1 = pw->
x2 - pw->
x1;
1798 pe->
cx += x - (x1 >> 1) - pw->
x1;
1800 else pe->
cx += x - pw->
x1;
1811 ElementCache.clear();
1812 if(count < 2)
return false;
1822 int bx1, by1, bx2, by2;
1823 QPtrList<Element> ElementCache;
1824 int count = copyElements(x1, y1, x2, y2, &ElementCache);
1825 if(count < 1)
return false;
1830 for(
int i = count-1;
i>0;
i--) {
1831 pe = ElementCache.first();
1832 for(
int j=0; j<
i; j++) {
1834 pe=ElementCache.next();
1837 ElementCache.replace(j+1, ElementCache.prev());
1838 ElementCache.replace(j, pe);
1839 pe = ElementCache.next();
1844 ElementCache.getLast()->
getCenter(x2, y2);
1845 ElementCache.getFirst()->getCenter(x1, y1);
1849 if(count > 1) dy = (y2-y1)/(count-1);
1852 for(pe = ElementCache.last(); pe != 0; pe = ElementCache.prev()) {
1865 y1 = pw->
y2 - pw->
y1;
1866 pw->
y1 = y - (y1 >> 1);
1867 pw->
y2 = pe->
y1 + y1;
1874 pe->
cy = y + (pe->
y2 >> 1);
1888 y1 = pw->
y2 - pw->
y1;
1889 pe->
cy += y - (y1 >> 1) - pw->
y1;
1891 else pe->
cy += y - pw->
y1;
1902 ElementCache.clear();
1903 if(count < 2)
return false;
1905 setChanged(
true,
true);
1922 if(pp->
Name !=
"Num")
return;
1926 QString cSign = c->
Model;
1930 if(pc->
Model == cSign)
1931 if(pc->
Props.getFirst()->Value ==
s)
break;
1936 s = QString::number(n);
1939 if(pc->
Model == cSign)
1940 if(pc->
Props.getFirst()->Value ==
s)
break;
1948 void Schematic::insertComponentNodes(
Component *
c,
bool noOptimize)
1952 for(pp = c->
Ports.first(); pp != 0; pp = c->
Ports.next())
1955 if(noOptimize)
return;
1959 QPtrList<Element> *pL;
1962 for(pp = c->
Ports.next(); pp != 0; pp = c->
Ports.next()) {
1966 if(((
Wire*)pe)->Port1 == pn) pL = &(((
Wire*)pe)->Port2->Connections);
1967 else pL = &(((
Wire*)pe)->Port1->Connections);
1969 for(pe1 = pL->first(); pe1!=0; pe1 = pL->next())
1983 insertComponentNodes(c, noOptimize);
1987 if(c->
Model ==
"GND") {
2003 int PortCount = Comp->
Ports.count();
2009 for(pp = Comp->
Ports.first(); pp != 0; pp = Comp->
Ports.next())
2018 int x = Comp->
tx, y = Comp->
ty;
2019 int x1 = Comp->
x1, x2 = Comp->
x2, y1 = Comp->
y1, y2 = Comp->
y2;
2020 QString tmp = Comp->
Name;
2031 Comp->
tx =
x; Comp->
ty = y;
2037 for(pp = Comp->
Ports.first(); pp != 0; pp = Comp->
Ports.next()) {
2044 if((--PortCount) < 1)
break;
2046 for( ; PortCount > 0; PortCount--) {
2058 insertComponentNodes(c,
false);
2062 int max=1, len = c->
Name.length(), z;
2063 if(c->
Name.isEmpty()) {
2065 if(c->
Model ==
"GND") {
2079 if(pc->Name.left(len) == c->
Name) {
2080 s = pc->Name.right(pc->Name.length()-len);
2082 if(ok)
if(z >= max) max = z + 1;
2084 c->
Name += QString::number(max);
2094 bool changed =
false;
2095 int cx1, cy1, cx2, cy2, a;
2097 cx1 = (x1 < x2) ? x1 : x2; cx2 = (x1 > x2) ? x1 : x2;
2098 cy1 = (y1 < y2) ? y1 : y2; cy2 = (y1 > y2) ? y1 : y2;
2104 pc->Bounding(cx1, cy1, cx2, cy2);
2105 if(cx1 >= x1)
if(cx2 <= x2)
if(cy1 >= y1)
if(cy2 <= y2) {
2106 a = pc->isActive - 1;
2108 if(pc->Ports.count() > 1) {
2116 if(pc->Model ==
"GND")
2117 oneLabel(pc->Ports.getFirst()->Connection);
2129 int x1, y1, x2, y2, a;
2131 pc->Bounding(x1, y1, x2, y2);
2132 if(x >= x1)
if(x <= x2)
if(y >= y1)
if(y <= y2) {
2133 a = pc->isActive - 1;
2135 if(pc->Ports.count() > 1) {
2143 if(pc->Model ==
"GND")
2144 oneLabel(pc->Ports.getFirst()->Connection);
2159 if(pc->isSelected) {
2160 a = pc->isActive - 1;
2162 if(pc->Ports.count() > 1) {
2170 if(pc->Model ==
"GND")
2171 oneLabel(pc->Ports.getFirst()->Connection);
2186 QPtrList<WireLabel> LabelCache;
2188 for(pp = pc->
Ports.first(); pp!=0; pp = pc->
Ports.next()) {
2194 LabelCache.append(pl);
2195 pl->
cx = pp->
x + pc->
cx;
2196 pl->
cy = pp->
y + pc->
cy;
2208 for(pp = pc->
Ports.first(); pp!=0; pp = pc->
Ports.next())
2211 for(pl = LabelCache.first(); pl != 0; pl = LabelCache.next())
2221 a = pc->cx + pc->tx;
2222 if(x_ < a)
continue;
2223 b = pc->cy + pc->ty;
2224 if(y_ < b)
continue;
2226 pc->textSize(dx, dy);
2227 if(x_ > a+dx)
continue;
2228 if(y_ > b+dy)
continue;
2244 if(!pc->isSelected)
continue;
2245 if(pc->Model !=
"Sub")
2246 if(pc->Model !=
"VHDL")
2247 if(pc->Model !=
"Verilog")
continue;
2249 if(sub != 0)
return 0;
2260 if(pc->getSelected(x, y))
2273 for(pn = c->
Ports.first(); pn!=0; pn = c->
Ports.next())
2290 int Schematic::copyComponents(
int& x1,
int& y1,
int& x2,
int& y2,
2291 QPtrList<Element> *ElementCache)
2294 int bx1, by1, bx2, by2, count=0;
2299 if(bx1 < x1) x1 = bx1;
2300 if(bx2 > x2) x2 = bx2;
2301 if(by1 < y1) y1 = by1;
2302 if(by2 > y2) y2 = by2;
2305 ElementCache->append(pc);
2308 for(pp = pc->
Ports.first(); pp != 0; pp = pc->
Ports.next())
2331 void Schematic::copyComponents2(
int& x1,
int& y1,
int& x2,
int& y2,
2332 QPtrList<Element> *ElementCache)
2339 if(pc->
cx < x1) x1 = pc->
cx;
2340 if(pc->
cx > x2) x2 = pc->
cx;
2341 if(pc->
cy < y1) y1 = pc->
cy;
2342 if(pc->
cy > y2) y2 = pc->
cy;
2344 ElementCache->append(pc);
2347 for(pp = pc->
Ports.first(); pp != 0; pp = pc->
Ports.next())
2380 QPtrList<Node> Cons;
2382 for(pn =
Nodes->first(); pn!=0; pn =
Nodes->next())
2387 for(pn = Cons.first(); pn!=0; pn = Cons.next()) {
2415 else pNode = pw->
Port2;
2417 if(pNode->
y1)
continue;
2444 for(pn =
Nodes->first(); pn != 0; pn =
Nodes->next())
2445 if(pn->
cx == x)
if(pn->
cy == y)
break;
2474 QPtrList<Node> Cons;
2476 for(pn =
Nodes->first(); pn!=0; pn =
Nodes->next())
2481 for(pn = Cons.first(); pn!=0; pn = Cons.next())
2482 if(pn->
Label)
return pn;
2487 if(((
Component*)pe)->Model ==
"GND")
return pe;
2492 if(pw->
Label)
return pw;
2495 else pNode = pw->
Port2;
2497 if(pNode->
y1)
continue;
2534 QPtrList<Element> *ElementCache)
2541 if(pl->
x1 < x1) x1 = pl->
x1;
2542 if(pl->
y1-pl->
y2 < y1) y1 = pl->
y1-pl->
y2;
2543 if(pl->
x1+pl->
x2 > x2) x2 = pl->
x1+pl->
x2;
2544 if(pl->
y1 > y2) y2 = pl->
y1;
2545 ElementCache->append(pl);
2552 if(pl->
x1 < x1) x1 = pl->
x1;
2553 if(pl->
y1-pl->
y2 < y1) y1 = pl->
y1-pl->
y2;
2554 if(pl->
x1+pl->
x2 > x2) x2 = pl->
x1+pl->
x2;
2555 if(pl->
y1 > y2) y2 = pl->
y1;
2556 ElementCache->append(pl);
2572 float Corr = 5.0 /
Scale;
2575 if(pp->getSelected(fX, fY, Corr))
2583 QPtrList<Element> *ElementCache)
2586 int bx1, by1, bx2, by2;
2591 if(bx1 < x1) x1 = bx1;
2592 if(bx2 > x2) x2 = bx2;
2593 if(by1 < y1) y1 = by1;
2594 if(by2 > y2) y2 = by2;
2596 ElementCache->append(pp);