26 #include <qlineedit.h>
27 #include <qtextedit.h>
28 #include <qpushbutton.h>
37 Color = QColor(0,0,0);
52 QWMatrix wm = p->
Painter->worldMatrix();
53 QWMatrix Mat(1.0, 0.0, 0.0, 1.0, p->
DX +
float(
cx) * p->
Scale,
55 p->
Painter->setWorldMatrix(Mat);
58 int Size =
Font.pointSize();
73 p->
Painter->setPen(QPen(QPen::darkGray,3));
74 p->
Painter->drawRect(-3, -2, w+6, h+5);
77 Font.setPointSize(Size);
79 p->
Painter->setWorldXForm(
false);
88 QWMatrix wm = p->worldMatrix();
89 QWMatrix Mat (wm.m11(), 0.0, 0.0, wm.m22(),
90 wm.dx() + double(
cx) * wm.m11(),
91 wm.dy() + double(
cy) * wm.m22());
92 p->setWorldMatrix(Mat);
94 p->drawRect(0, 0,
x2,
y2);
96 p->setWorldMatrix(wm);
110 if(relative) {
cx +=
x;
cy += y; }
111 else {
cx = x-(
x2>>1);
cy = y-(
y2>>1); }
123 Name = QObject::tr(
"Text");
124 BitmapFile = (
char *)
"text";
136 n = s.section(
' ',1,1);
138 if(!ok)
return false;
140 n = s.section(
' ',2,2);
142 if(!ok)
return false;
144 n = s.section(
' ',3,3);
145 Font.setPointSize(n.toInt(&ok));
146 if(!ok)
return false;
148 n = s.section(
' ',4,4);
149 Color.setNamedColor(n);
150 if(!
Color.isValid())
return false;
152 n = s.section(
' ',5,5);
153 Angle = n.toInt(&ok);
154 if(!ok)
return false;
156 Text = s.mid(s.find(
'"')+1);
158 if(
Text.isEmpty())
return false;
161 QFontMetrics metrics(
Font);
162 QSize r = metrics.size(0,
Text);
176 QString
s =
Name+QString::number(
cx)+
" "+QString::number(
cy)+
" "
177 + QString::number(
Font.pointSize())+
" "+
Color.name()+
" "
178 + QString::number(
Angle) +
" \""+t+
"\"";
189 QString (
"new Text (%1, %2, \"%3\", QColor (\"%4\"), %5, %6, %7)").
193 s =
"Texts.append (" + s +
");";
201 QPainter*,
int,
int,
int gx,
int gy,
202 QPainter *p,
int x,
int y,
bool drawn)
204 p->setPen(Qt::SolidLine);
206 p->drawLine(
x1+15,
y1+15,
x1+20,
y1);
207 p->drawLine(
x1+26,
y1+15,
x1+21,
y1);
208 p->drawLine(
x1+17,
y1+8,
x1+23,
y1+8);
212 p->drawLine(
x1+15,
y1+15,
x1+20,
y1);
213 p->drawLine(
x1+26,
y1+15,
x1+21,
y1);
214 p->drawLine(
x1+17,
y1+8,
x1+23,
y1+8);
232 float sine =
sin(phi), cosine =
cos(phi);
236 int _x = int( fX*cosine - fY*sine );
237 int _y = int( fY*cosine + fX*sine );
239 if(_x >= 0)
if(_y >= 0)
if(_x <=
x2)
if(_y <=
y2)
249 double sine =
sin(phi), cosine =
cos(phi);
250 int dx = int(
double(
y2) * sine );
251 int dy = int(
double(
y2) * cosine );
252 xmin = dx; xmax =
cx;
253 ymin = dy; ymax =
cy;
254 if(xmin < 0) xmin +=
cx;
255 else { xmax += xmin; xmin =
cx; }
256 if(ymin < 0) ymin +=
cy;
257 else { ymax += ymin; ymin =
cy; }
259 int x =
cx + int(
double(
x2) * cosine );
260 if(xmax < x) xmax =
x;
261 else if(xmin > x) xmin =
x;
263 if(xmax < x) xmax =
x;
264 else if(xmin > x) xmin =
x;
266 int y =
cy - int(
double(
x2) * sine );
267 if(ymax < y) ymax = y;
268 else if(ymin > y) ymin = y;
270 if(ymax < y) ymax = y;
271 else if(ymin > y) ymin = y;
302 bool changed =
false;
306 d->
TextSize->setText(QString::number(
Font.pointSize()));
308 QString _Text =
Text;
310 d->
text->setText(_Text);
312 if(d->exec() == QDialog::Rejected) {
321 f.setPointSize(d->
TextSize->text().toInt());
326 int tmp = d->
Angle->text().toInt();
340 QSize
s = m.size(0,
Text);