21 #include <QPushButton>
48 p->
Painter->setPen(QPen(Qt::darkGray,
Pen.width()+5));
50 p->
Painter->setPen(QPen(Qt::white,
Pen.width(),
Pen.style()));
53 p->
Painter->setPen(QPen(Qt::darkRed,2));
79 if(relative) {
cx += x;
cy += y; }
80 else {
cx = x-(
x2>>1);
cy = y-(
y2>>1); }
92 Name = QObject::tr(
"Line");
93 BitmapFile = (
char *)
"line";
105 n = s.section(
' ',1,1);
107 if(!ok)
return false;
109 n = s.section(
' ',2,2);
111 if(!ok)
return false;
113 n = s.section(
' ',3,3);
115 if(!ok)
return false;
117 n = s.section(
' ',4,4);
119 if(!ok)
return false;
121 n = s.section(
' ',5,5);
125 if(!
Pen.color().isValid())
return false;
127 n = s.section(
' ',6,6);
128 Pen.setWidth(n.toInt(&ok));
129 if(!ok)
return false;
131 n = s.section(
' ',7,7);
132 Pen.setStyle((Qt::PenStyle)n.toInt(&ok));
133 if(!ok)
return false;
141 QString s =
Name+QString::number(
cx)+
" "+QString::number(
cy)+
" ";
142 s += QString::number(
x2)+
" "+QString::number(
y2)+
" ";
143 s +=
Pen.color().name()+
" "+QString::number(
Pen.width())+
" ";
144 s += QString::number(
Pen.style());
152 QString (
"new Line (%1, %2, %3, %4, QPen (QColor (\"%5\"), %6, %7))").
155 s =
"Lines.append (" + s +
");";
162 QString (
"{\"type\" : \"line\", "
163 "\"x1\" : %1, \"y1\" : %2, \"x2\" : %3, \"y2\" : %4, "
164 "\"color\" : \"%5\", \"thick\" : %6, \"style\" : \"%7\"},").
174 float fCX = float(
cx), fCY = float(
cy);
176 if(fX <= fCX+len)
if(fX >= fCX-len)
if(fY <= fCY+len)
if(fY >= fCY-len) {
183 if(fX <= fCX+len)
if(fX >= fCX-len)
if(fY <= fCY+len)
if(fY >= fCY-len) {
207 Schematic *paintScale,
int,
int,
int gx,
int gy,
218 else {
cx = gx;
cy = gy; }
274 float A = float(
x2)*fY - fX*float(
y2);
286 if(
x2 < 0) { _x1 =
cx+
x2; _x2 =
cx; }
287 else { _x1 =
cx; _x2 =
cx+
x2; }
289 if(
y2 < 0) { _y1 =
cy+
y2; _y2 =
cy; }
290 else { _y1 =
cy; _y2 =
cy+
y2; }
326 bool changed =
false;
333 if(d->exec() == QDialog::Rejected) {
338 if(
Pen.color() != d->
ColorButt->paletteBackgroundColor()) {
346 if(
Pen.style() != (d->
StyleBox->currentItem()+1)) {
347 Pen.setStyle((Qt::PenStyle)(d->
StyleBox->currentItem()+1));
void setCenter(int, int, bool relative=false)
void drawResizeRect(int, int)
void MouseMoving(Schematic *, int, int, int, int, Schematic *, int, int, bool)
bool getSelected(float, float, float)
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 paintScheme(Schematic *)
void paint(ViewPainter *)
void drawLine(int, int, int, int)
void Bounding(int &, int &, int &, int &)
GraphicLine(int cx_=0, int cy_=0, int x2_=0, int y2_=0, QPen Pen_=QPen(QColor()))
void getCenter(int &, int &)
static Element * info(QString &, char *&, bool getNewOne=false)
bool load(const QString &)
void MouseResizeMoving(int, int, Schematic *)
Superclass of all schematic drawing elements.
bool resizeTouched(float, float, float)