21 #include <qpushbutton.h>
22 #include <qlineedit.h>
23 #include <qcombobox.h>
24 #include <qcheckbox.h>
32 Brush = QBrush(QPen::lightGray);
47 p->
Painter->setPen(QPen(QPen::darkGray,
Pen.width()+5));
50 p->
Painter->setPen(QPen(QPen::white,
Pen.width(),
Pen.style()));
51 p->
Painter->setBrush(QBrush::NoBrush);
54 p->
Painter->setPen(QPen(QPen::darkRed,2));
64 p->
Painter->setBrush(QBrush::NoBrush);
84 if(relative) {
cx +=
x;
cy += y; }
85 else {
cx = x-(
x2>>1);
cy = y-(
y2>>1); }
97 Name = QObject::tr(
"Ellipse");
98 BitmapFile = (
char *)
"ellipse";
100 if(getNewOne)
return new Ellipse();
107 Name = QObject::tr(
"filled Ellipse");
108 BitmapFile = (
char *)
"filledellipse";
110 if(getNewOne)
return new Ellipse(
true);
120 n = s.section(
' ',1,1);
122 if(!ok)
return false;
124 n = s.section(
' ',2,2);
126 if(!ok)
return false;
128 n = s.section(
' ',3,3);
130 if(!ok)
return false;
132 n = s.section(
' ',4,4);
134 if(!ok)
return false;
136 n = s.section(
' ',5,5);
140 if(!
Pen.color().isValid())
return false;
142 n = s.section(
' ',6,6);
143 Pen.setWidth(n.toInt(&ok));
144 if(!ok)
return false;
146 n = s.section(
' ',7,7);
147 Pen.setStyle((Qt::PenStyle)n.toInt(&ok));
148 if(!ok)
return false;
150 n = s.section(
' ',8,8);
153 if(!
Brush.color().isValid())
return false;
155 n = s.section(
' ',9,9);
156 Brush.setStyle((Qt::BrushStyle)n.toInt(&ok));
157 if(!ok)
return false;
159 n = s.section(
' ',10,10);
160 if(n.toInt(&ok) == 0)
filled =
false;
162 if(!ok)
return false;
171 QString::number(
cx) +
" " + QString::number(
cy) +
" " +
172 QString::number(
x2) +
" " + QString::number(
y2) +
" " +
173 Pen.color().name() +
" " + QString::number(
Pen.width()) +
" " +
174 QString::number(
Pen.style()) +
" " +
175 Brush.color().name() +
" " + QString::number(
Brush.style());
185 QString (
", QBrush (QColor (\"%1\"), %2)").
188 QString (
"new Area (%1, %2, %3, %4, "
189 "QPen (QColor (\"%5\"), %6, %7)%8)").
193 s =
"Ellips.append (" + s +
");";
201 float fCX = float(
cx), fCY = float(
cy);
202 float fX2 = float(
cx+
x2), fY2 = float(
cy+
y2);
205 if(fX < fCX-len)
return false;
206 if(fY < fCY-len)
return false;
207 if(fX > fX2+len)
return false;
208 if(fY > fY2+len)
return false;
211 if(fX < fCX+len)
State = 1;
212 else if(fX <= fX2-len) {
State = -1;
return false; }
213 if(fY < fCY+len)
State |= 2;
214 else if(fY <= fY2-len) {
State = -1;
return false; }
229 case 2:
x2 = x-
cx;
y2 -= y-
cy; cy = y;
231 case 3:
x2 -= x-
cx; cx =
x;
y2 -= y-
cy; cy = y;
244 QPainter *paintScale,
int,
int,
int gx,
int gy,
245 QPainter *p,
int x,
int y,
bool drawn)
255 else {
x2 = gx;
y2 = gy; }
258 p->setPen(Qt::SolidLine);
260 p->drawEllipse(
cx+13,
cy, 18, 12);
262 p->drawLine(
cx+14,
cy+7,
cx+20,
cy+1);
263 p->drawLine(
cx+25,
cy+2,
cx+18,
cy+9);
264 p->drawLine(
cx+29,
cy+4,
cx+23,
cy+10);
269 p->drawEllipse(
cx+13,
cy, 18, 12);
271 p->drawLine(
cx+14,
cy+7,
cx+20,
cy+1);
272 p->drawLine(
cx+25,
cy+2,
cx+18,
cy+9);
273 p->drawLine(
cx+29,
cy+4,
cx+23,
cy+10);
301 float fX2 = float(
x2);
302 float fY2 = float(
y2);
303 fX -= float(
cx) + fX2/2.0;
304 fY -= float(
cy) + fY2/2.0;
307 float a = 2.0 * fX / fX2; a *= a;
308 float b = 2.0 * fY / fY2; b *=
b;
314 float a1 = fX / (fX2/2.0 - w); a1 *= a1;
315 float a2 = fX / (fX2/2.0 + w); a2 *= a2;
316 float b1 = fY / (fY2/2.0 - w); b1 *=
b1;
317 float b2 = fY / (fY2/2.0 + w); b2 *= b2;
319 if(a1+b1 < 1.0)
return false;
320 if(a2+b2 > 1.0)
return false;
356 bool changed =
false;
367 if(d->exec() == QDialog::Rejected) {
372 if(
Pen.color() != d->
ColorButt->paletteBackgroundColor()) {
380 if(
Pen.style() != (Qt::PenStyle)(d->
StyleBox->currentItem()+1)) {
381 Pen.setStyle((Qt::PenStyle)(d->
StyleBox->currentItem()+1));