21 #include <qpushbutton.h>
22 #include <qlineedit.h>
23 #include <qcombobox.h>
48 p->
Painter->setPen(QPen(QPen::darkGray,
Pen.width()+5));
50 p->
Painter->setPen(QPen(QPen::white,
Pen.width(),
Pen.style()));
53 p->
Painter->setPen(QPen(QPen::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 +
");";
163 float fCX = float(
cx), fCY = float(
cy);
165 if(fX <= fCX+len)
if(fX >= fCX-len)
if(fY <= fCY+len)
if(fY >= fCY-len) {
172 if(fX <= fCX+len)
if(fX >= fCX-len)
if(fY <= fCY+len)
if(fY >= fCY-len) {
196 QPainter *paintScale,
int,
int,
int gx,
int gy,
197 QPainter *p,
int x,
int y,
bool drawn)
205 paintScale->drawLine(cx, cy, cx+
x2, cy+
y2);
207 else {
cx = gx;
cy = gy; }
210 p->setPen(Qt::SolidLine);
212 p->drawLine(
x1+27,
y1,
x1+15,
y1+12);
213 p->drawLine(
x1+25,
y1-2,
x1+29,
y1+2);
214 p->drawLine(
x1+13,
y1+10,
x1+17,
y1+14);
218 p->drawLine(
x1+27,
y1,
x1+15,
y1+12);
219 p->drawLine(
x1+25,
y1-2,
x1+29,
y1+2);
220 p->drawLine(
x1+13,
y1+10,
x1+17,
y1+14);
263 float A = float(
x2)*fY - fX*float(
y2);
275 if(
x2 < 0) { _x1 =
cx+
x2; _x2 =
cx; }
276 else { _x1 =
cx; _x2 =
cx+
x2; }
278 if(
y2 < 0) { _y1 =
cy+
y2; _y2 =
cy; }
279 else { _y1 =
cy; _y2 =
cy+
y2; }
315 bool changed =
false;
322 if(d->exec() == QDialog::Rejected) {
327 if(
Pen.color() != d->
ColorButt->paletteBackgroundColor()) {
335 if(
Pen.style() != (d->
StyleBox->currentItem()+1)) {
336 Pen.setStyle((Qt::PenStyle)(d->
StyleBox->currentItem()+1));