24 const QString& nameStr_)
35 QSize r = metrics.size(0,
nameStr);
37 y1 = -((r.height() + 8) >> 1);
52 p->
Painter->setPen(QPen(Qt::red,1));
56 int Unit = int(8.0 * p->
Scale);
57 x1 = -r.width() - Unit;
58 y1 = -((r.height() + Unit) >> 1);
60 y2 = r.height() + Unit;
62 QMatrix wm = p->
Painter->worldMatrix();
63 QMatrix Mat(1.0, 0.0, 0.0, 1.0, p->
DX +
float(
cx) * p->
Scale,
65 p->
Painter->setWorldMatrix(Mat);
68 tx = x1 + (Unit >> 1);
69 ty =
y1 + (Unit >> 1);
83 tmp =
x1; x1 =
y1;
y1 = tmp;
94 p->
Painter->setWorldXForm(
false);
99 x1 = int(
float(x1) / p->
Scale);
104 p->
Painter->setPen(Qt::lightGray);
108 p->
Painter->setPen(QPen(Qt::darkGray,3));
131 if(relative) {
cx += x;
cy += y; }
132 else {
cx = x;
cy = y; }
141 n = s.section(
' ',1,1);
143 if(!ok)
return false;
145 n = s.section(
' ',2,2);
147 if(!ok)
return false;
152 n = s.section(
' ',4,4);
153 if(n.isEmpty())
return true;
154 Angel = n.toInt(&ok);
155 if(!ok)
return false;
163 QString s =
Name+QString::number(
cx)+
" "+QString::number(
cy)+
" ";
172 QString (
"new Port (%1, %2)").
174 s =
"Ports.append (" + s +
"); /* " +
nameStr +
" */";
180 QString s = QString (
"{\"type\" : \"portsymbol\", "
181 "\"x\" : %1, \"y\" : %2},").arg(
cx).arg(
cy);
189 if(
int(fX) <
cx+
x1)
return false;
190 if(
int(fY) <
cy+
y1)
return false;
191 if(
int(fX) >
cx+
x1+
x2)
return false;
192 if(
int(fY) >
cy+
y1+
y2)
return false;
void setCenter(int, int, bool relative=false)
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)
PortSymbol(int cx_=0, int cy_=0, const QString &numberStr_="1", const QString &nameStr_="")
void paintScheme(Schematic *)
bool load(const QString &)
void Bounding(int &, int &, int &, int &)
void getCenter(int &, int &)
bool getSelected(float, float, float)
Definitions and declarations for the main application.
void drawRoundRect(int, int, int, int)
void drawRect(int, int, int, int)
void paint(ViewPainter *)
void drawEllipse(int, int, int, int)