23 #include <QPushButton>
26 #include <Q3PointArray>
54 int x1_, y1_, x2_, y2_, x3_, y3_;
56 p->
Painter->setPen(QPen(Qt::darkGray,
Pen.width()+5));
61 p->
Painter->setPen(QPen(Qt::white,
Pen.width(),
Pen.style()));
63 p->
Painter->setPen(QPen(Qt::white,
Pen.width(), Qt::SolidLine));
69 p->
Painter->setPen(QPen(Qt::white,
Pen.width(),
Pen.style()));
72 p->
Painter->setPen(QPen(Qt::white,
Pen.width(), Qt::SolidLine));
73 p->
Painter->setBrush(Qt::white);
77 Points.setPoints(3, x1_, y1_, x2_, y2_, x3_, y3_);
78 p->
Painter->drawConvexPolygon(Points);
79 p->
Painter->setBrush(Qt::NoBrush);
82 p->
Painter->setPen(QPen(Qt::darkRed,2));
89 p->
Painter->setPen(QPen(
Pen.color(),
Pen.width(), Qt::SolidLine));
99 Points.setPoints(3, x1_, y1_, x2_, y2_, x3_, y3_);
100 p->
Painter->drawConvexPolygon(Points);
101 p->
Painter->setBrush(Qt::NoBrush);
124 if(relative) {
cx += x;
cy += y; }
125 else {
cx = x-(
x2>>1);
cy = y-(
y2>>1); }
137 Name = QObject::tr(
"Arrow");
138 BitmapFile = (
char *)
"arrow";
140 if(getNewOne)
return new Arrow();
150 n = s.section(
' ',1,1);
152 if(!ok)
return false;
154 n = s.section(
' ',2,2);
156 if(!ok)
return false;
158 n = s.section(
' ',3,3);
160 if(!ok)
return false;
162 n = s.section(
' ',4,4);
164 if(!ok)
return false;
166 n = s.section(
' ',5,5);
168 if(!ok)
return false;
170 n = s.section(
' ',6,6);
171 Width = n.toDouble(&ok);
172 if(!ok)
return false;
174 n = s.section(
' ',7,7);
178 if(!
Pen.color().isValid())
return false;
180 n = s.section(
' ',8,8);
181 Pen.setWidth(n.toInt(&ok));
182 if(!ok)
return false;
184 n = s.section(
' ',9,9);
185 Pen.setStyle((Qt::PenStyle)n.toInt(&ok));
186 if(!ok)
return false;
188 n = s.section(
' ',10,10);
190 Style = n.toInt(&ok);
191 if(!ok)
return false;
203 QString s =
Name+QString::number(
cx)+
" "+QString::number(
cy)+
" ";
204 s += QString::number(
x2)+
" "+QString::number(
y2)+
" ";
205 s += QString::number(
int(
Height))+
" "+QString::number(
int(
Width))+
" ";
206 s +=
Pen.color().name()+
" "+QString::number(
Pen.width())+
" ";
207 s += QString::number(
Pen.style()) +
" " + QString::number(
Style);
216 QString (
"new Line (%1, %2, %3, %4, QPen (QColor (\"%5\"), %6, %7))").
219 s =
"Lines.append (" + s +
");";
227 QString(
"{\"type\" : \"arrow\", "
228 "\"x1\" : %1, \"y1\" : %2, \"x2\" : %3, \"y2\" : %4, "
229 "\"color\" : \"%5\", \"thick\" : %6, \"style\" : \"%7\"},").
239 float fCX = float(
cx),fCY = float(
cy);
240 if(fX < fCX+len)
if(fX > fCX-len)
if(fY < fCY+len)
if(fY > fCY-len) {
247 if(fX < fCX+len)
if(fX > fCX-len)
if(fY < fCY+len)
if(fY > fCY-len) {
271 double phi = atan2(
double(
y2),
double(
x2));
286 Schematic *paintScale,
int,
int,
int gx,
int gy,
300 else {
cx = gx;
cy = gy; }
360 A = float(
x2)*fY - fX*float(
y2);
367 xn = float(
xp1-
x2); fX -= float(
x2);
368 yn = float(
yp1-y2); fY -= float(y2);
392 if(A <= w*w*(xn*xn + yn*yn))
420 if(A <= w*w*(xn*xn + yn*yn))
429 if(
x2 < 0) { _x1 =
cx+
x2; _x2 =
cx; }
430 else { _x1 =
cx; _x2 =
cx+
x2; }
432 if(
y2 < 0) { _y1 =
cy+
y2; _y2 =
cy; }
433 else { _y1 =
cy; _y2 =
cy+
y2; }
481 bool changed =
false;
491 if(d->exec() == QDialog::Rejected) {
504 if(
Pen.color() != d->
ColorButt->paletteBackgroundColor()) {
void drawResizeRect(int, int)
bool load(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 MouseResizeMoving(int, int, Schematic *)
void map(int, int, int &, int &)
void paint(ViewPainter *)
void paintScheme(Schematic *)
void drawLine(int, int, int, int)
void Bounding(int &, int &, int &, int &)
void setCenter(int, int, bool relative=false)
QComboBox * ArrowStyleBox
void MouseMoving(Schematic *, int, int, int, int, Schematic *, int, int, bool)
Superclass of all schematic drawing elements.
void getCenter(int &, int &)
bool getSelected(float, float, float)
void SetComboBox(Qt::PenStyle)
static Element * info(QString &, char *&, bool getNewOne=false)
bool resizeTouched(float, float, float)