21 #include <qpushbutton.h>
22 #include <qlineedit.h>
23 #include <qcombobox.h>
24 #include <qcheckbox.h>
31 Brush = QBrush(QPen::lightGray);
46 p->
Painter->setPen(QPen(QPen::darkGray,
Pen.width()+5));
49 p->
Painter->setPen(QPen(QPen::white,
Pen.width(),
Pen.style()));
50 p->
Painter->setBrush(QBrush::NoBrush);
53 p->
Painter->setPen(QPen(QPen::darkRed,2));
63 p->
Painter->setBrush(QBrush::NoBrush);
83 if(relative) {
cx +=
x;
cy += y; }
84 else {
cx = x-(
x2>>1);
cy = y-(
y2>>1); }
96 Name = QObject::tr(
"Rectangle");
97 BitmapFile = (
char *)
"rectangle";
106 Name = QObject::tr(
"filled Rectangle");
107 BitmapFile = (
char *)
"filledrect";
109 if(getNewOne)
return new Rectangle(
true);
119 n = s.section(
' ',1,1);
121 if(!ok)
return false;
123 n = s.section(
' ',2,2);
125 if(!ok)
return false;
127 n = s.section(
' ',3,3);
129 if(!ok)
return false;
131 n = s.section(
' ',4,4);
133 if(!ok)
return false;
135 n = s.section(
' ',5,5);
139 if(!
Pen.color().isValid())
return false;
141 n = s.section(
' ',6,6);
142 Pen.setWidth(n.toInt(&ok));
143 if(!ok)
return false;
145 n = s.section(
' ',7,7);
146 Pen.setStyle((Qt::PenStyle)n.toInt(&ok));
147 if(!ok)
return false;
149 n = s.section(
' ',8,8);
152 if(!
Brush.color().isValid())
return false;
154 n = s.section(
' ',9,9);
155 Brush.setStyle((Qt::BrushStyle)n.toInt(&ok));
156 if(!ok)
return false;
158 n = s.section(
' ',10,10);
159 if(n.toInt(&ok) == 0)
filled =
false;
161 if(!ok)
return false;
170 QString::number(
cx) +
" " + QString::number(
cy) +
" " +
171 QString::number(
x2) +
" " + QString::number(
y2) +
" " +
172 Pen.color().name() +
" " + QString::number(
Pen.width()) +
" " +
173 QString::number(
Pen.style()) +
" " +
174 Brush.color().name() +
" " + QString::number(
Brush.style());
184 QString (
", QBrush (QColor (\"%1\"), %2)").
187 QString (
"new Area (%1, %2, %3, %4, "
188 "QPen (QColor (\"%5\"), %6, %7)%8)").
192 s =
"Rects.append (" + s +
");";
200 float fCX = float(
cx), fCY = float(
cy);
201 float fX2 = float(
cx+
x2), fY2 = float(
cy+
y2);
204 if(fX < fCX-len)
return false;
205 if(fY < fCY-len)
return false;
206 if(fX > fX2+len)
return false;
207 if(fY > fY2+len)
return false;
210 if(fX < fCX+len)
State = 1;
211 else if(fX < fX2-len) {
State = -1;
return false; }
212 if(fY < fCY+len)
State |= 2;
213 else if(fY < fY2-len) {
State = -1;
return false; }
228 case 2:
x2 = x-
cx;
y2 -= y-
cy; cy = y;
230 case 3:
x2 -= x-
cx; cx =
x;
y2 -= y-
cy; cy = y;
243 QPainter *paintScale,
int,
int,
int gx,
int gy,
244 QPainter *p,
int x,
int y,
bool drawn)
254 else {
x2 = gx;
y2 = gy; }
257 p->setPen(Qt::SolidLine);
259 p->drawRect(
cx+13,
cy, 18, 12);
261 p->drawLine(
cx+14,
cy+6,
cx+19,
cy+1);
262 p->drawLine(
cx+26,
cy+1,
cx+17,
cy+10);
263 p->drawLine(
cx+29,
cy+5,
cx+24,
cy+10);
268 p->drawRect(
cx+13,
cy, 18, 12);
270 p->drawLine(
cx+14,
cy+6,
cx+19,
cy+1);
271 p->drawLine(
cx+26,
cy+1,
cx+17,
cy+10);
272 p->drawLine(
cx+29,
cy+5,
cx+24,
cy+10);
301 if(
int(fX) >
cx+
x2)
return false;
302 if(
int(fY) >
cy+
y2)
return false;
303 if(
int(fX) <
cx)
return false;
304 if(
int(fY) <
cy)
return false;
309 float fX2 = float(
x2);
310 float fY2 = float(
y2);
312 if(fX > fX2+w)
return false;
313 if(fY > fY2+w)
return false;
314 if(fX < -w)
return false;
315 if(fY < -w)
return false;
318 if(fX < fX2-w)
if(fX > w)
if(fY < fY2-w)
if(fY > w)
355 bool changed =
false;
366 if(d->exec() == QDialog::Rejected) {
371 if(
Pen.color() != d->
ColorButt->paletteBackgroundColor()) {
379 if(
Pen.style() != (Qt::PenStyle)(d->
StyleBox->currentItem()+1)) {
380 Pen.setStyle((Qt::PenStyle)(d->
StyleBox->currentItem()+1));