29 #include <QPushButton>
38 Color = QColor(0,0,0);
56 QMatrix wm = p->
Painter->worldMatrix();
57 QMatrix Mat(1.0, 0.0, 0.0, 1.0, p->
DX +
float(
cx) * p->
Scale,
59 p->
Painter->setWorldMatrix(Mat);
62 int Size =
Font.pointSize();
77 p->
Painter->setPen(QPen(Qt::darkGray,3));
78 p->
Painter->drawRect(-3, -2, w+6, h+5);
81 Font.setPointSize(Size);
83 p->
Painter->setWorldXForm(
false);
118 if(relative) {
cx += x;
cy += y; }
119 else {
cx = x-(
x2>>1);
cy = y-(
y2>>1); }
131 Name = QObject::tr(
"Text");
132 BitmapFile = (
char *)
"text";
144 n = s.section(
' ',1,1);
146 if(!ok)
return false;
148 n = s.section(
' ',2,2);
150 if(!ok)
return false;
152 n = s.section(
' ',3,3);
153 Font.setPointSize(n.toInt(&ok));
154 if(!ok)
return false;
156 n = s.section(
' ',4,4);
157 Color.setNamedColor(n);
158 if(!
Color.isValid())
return false;
160 n = s.section(
' ',5,5);
161 Angle = n.toInt(&ok);
162 if(!ok)
return false;
164 Text = s.mid(s.find(
'"')+1);
166 if(
Text.isEmpty())
return false;
170 QSize r = metrics.size(0,
Text);
184 QString s =
Name+QString::number(
cx)+
" "+QString::number(
cy)+
" "
185 + QString::number(
Font.pointSize())+
" "+
Color.name()+
" "
186 + QString::number(
Angle) +
" \""+t+
"\"";
197 QString (
"new Text (%1, %2, \"%3\", QColor (\"%4\"), %5, %6, %7)").
198 arg(
cx).arg(
cy).arg(t).
201 s =
"Texts.append (" + s +
");";
211 QString (
"{\"type\" : \"graphictext\", "
212 "\"x\" : %1, \"y\" : %2, \"s\" : \"%3\", "
213 "\"color\" : \"%4\", \"size\" : %5, \"cos\" : %6, \"sin\" : %7},").
214 arg(
cx).arg(
cy).arg(t).
255 float sine = sin(phi), cosine = cos(phi);
259 int _x = int( fX*cosine - fY*sine );
260 int _y = int( fY*cosine + fX*sine );
262 if(_x >= 0)
if(_y >= 0)
if(_x <=
x2)
if(_y <=
y2)
272 double sine = sin(phi), cosine = cos(phi);
273 int dx = int(
double(
y2) * sine );
274 int dy = int(
double(
y2) * cosine );
275 xmin = dx; xmax =
cx;
276 ymin = dy; ymax =
cy;
277 if(xmin < 0) xmin +=
cx;
278 else { xmax += xmin; xmin =
cx; }
279 if(ymin < 0) ymin +=
cy;
280 else { ymax += ymin; ymin =
cy; }
282 int x =
cx + int(
double(
x2) * cosine );
283 if(xmax < x) xmax = x;
284 else if(xmin > x) xmin = x;
286 if(xmax < x) xmax = x;
287 else if(xmin > x) xmin = x;
289 int y =
cy - int(
double(
x2) * sine );
290 if(ymax < y) ymax = y;
291 else if(ymin > y) ymin = y;
293 if(ymax < y) ymax = y;
294 else if(ymin > y) ymin = y;
325 bool changed =
false;
329 d->
TextSize->setText(QString::number(
Font.pointSize()));
331 QString _Text =
Text;
333 d->
text->setText(_Text);
335 if(d->exec() == QDialog::Rejected) {
344 f.setPointSize(d->
TextSize->text().toInt());
349 int tmp = d->
Angle->text().toInt();
363 QSize s = m.size(0,
Text);
bool getSelected(float, float, float)
bool load(const QString &)
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 MouseMoving(Schematic *, int, int, int, int, Schematic *, int, int, bool)
tQucsSettings QucsSettings
void convert2Unicode(QString &Text)
Definitions and declarations for the main application.
void setCenter(int, int, bool relative=false)
void Bounding(int &, int &, int &, int &)
void encode_String(const QString &Input, QString &Output)
int drawTextMapped(const QString &, int, int, int *Height=0)
void getCenter(int &, int &)
Superclass of all schematic drawing elements.
void convert2ASCII(QString &Text)
void decode_String(QString &Output)
void paint(ViewPainter *)
static Element * info(QString &, char *&, bool getNewOne=false)