insilmaril@611
|
1 |
#include <typeinfo>
|
insilmaril@611
|
2 |
|
insilmaril@0
|
3 |
#include "ornamentedobj.h"
|
insilmaril@0
|
4 |
#include "texteditor.h"
|
insilmaril@0
|
5 |
#include "mapeditor.h"
|
insilmaril@0
|
6 |
#include "linkablemapobj.h"
|
insilmaril@0
|
7 |
|
insilmaril@0
|
8 |
extern TextEditor *textEditor;
|
insilmaril@0
|
9 |
extern FlagRowObj *systemFlagsDefault;
|
insilmaril@0
|
10 |
extern FlagRowObj *standardFlagsDefault;
|
insilmaril@0
|
11 |
|
insilmaril@0
|
12 |
|
insilmaril@0
|
13 |
/////////////////////////////////////////////////////////////////
|
insilmaril@0
|
14 |
// OrnamentedObj
|
insilmaril@0
|
15 |
/////////////////////////////////////////////////////////////////
|
insilmaril@0
|
16 |
|
insilmaril@0
|
17 |
OrnamentedObj::OrnamentedObj():LinkableMapObj()
|
insilmaril@0
|
18 |
{
|
insilmaril@0
|
19 |
// cout << "Const OrnamentedObj ()\n";
|
insilmaril@0
|
20 |
init ();
|
insilmaril@0
|
21 |
}
|
insilmaril@0
|
22 |
|
insilmaril@408
|
23 |
OrnamentedObj::OrnamentedObj(QGraphicsScene* s) :LinkableMapObj(s)
|
insilmaril@0
|
24 |
{
|
insilmaril@408
|
25 |
// cout << "Const OrnamentedObj (s)\n";
|
insilmaril@0
|
26 |
init ();
|
insilmaril@0
|
27 |
}
|
insilmaril@0
|
28 |
|
insilmaril@408
|
29 |
OrnamentedObj::OrnamentedObj (OrnamentedObj* lmo) : LinkableMapObj (lmo->scene)
|
insilmaril@0
|
30 |
{
|
insilmaril@0
|
31 |
copy (lmo);
|
insilmaril@0
|
32 |
}
|
insilmaril@0
|
33 |
|
insilmaril@0
|
34 |
OrnamentedObj::~OrnamentedObj()
|
insilmaril@0
|
35 |
{
|
insilmaril@442
|
36 |
delete heading;
|
insilmaril@442
|
37 |
delete systemFlags;
|
insilmaril@442
|
38 |
delete standardFlags;
|
insilmaril@442
|
39 |
delete frame;
|
insilmaril@0
|
40 |
}
|
insilmaril@0
|
41 |
|
insilmaril@0
|
42 |
|
insilmaril@0
|
43 |
void OrnamentedObj::init ()
|
insilmaril@0
|
44 |
{
|
insilmaril@408
|
45 |
heading = new HeadingObj(scene);
|
insilmaril@0
|
46 |
heading->move (absPos.x(), absPos.y());
|
insilmaril@0
|
47 |
|
insilmaril@0
|
48 |
note.setNote("");
|
insilmaril@0
|
49 |
note.setFontHint (textEditor->getFontHintDefault() );
|
insilmaril@417
|
50 |
isNoteInEditor=false;
|
insilmaril@0
|
51 |
|
insilmaril@408
|
52 |
systemFlags=new FlagRowObj(scene);
|
insilmaril@0
|
53 |
systemFlags->clone(systemFlagsDefault);
|
insilmaril@0
|
54 |
systemFlags->setName ("systemFlags");
|
insilmaril@0
|
55 |
|
insilmaril@408
|
56 |
standardFlags=new FlagRowObj(scene);
|
insilmaril@0
|
57 |
standardFlags->clone(standardFlagsDefault);
|
insilmaril@0
|
58 |
standardFlags->setName ("standardFlags");
|
insilmaril@243
|
59 |
|
insilmaril@628
|
60 |
attributes.clear();
|
insilmaril@628
|
61 |
|
insilmaril@442
|
62 |
frame = new FrameObj (scene);
|
insilmaril@442
|
63 |
|
insilmaril@243
|
64 |
hideExport=false;
|
insilmaril@260
|
65 |
hidden=false;
|
insilmaril@243
|
66 |
|
insilmaril@243
|
67 |
url="";
|
insilmaril@243
|
68 |
vymLink="";
|
insilmaril@243
|
69 |
|
insilmaril@0
|
70 |
}
|
insilmaril@0
|
71 |
|
insilmaril@0
|
72 |
void OrnamentedObj::copy (OrnamentedObj* other)
|
insilmaril@0
|
73 |
{
|
insilmaril@0
|
74 |
LinkableMapObj::copy(other);
|
insilmaril@0
|
75 |
heading->copy(other->heading);
|
insilmaril@243
|
76 |
setColor (other->heading->getColor());
|
insilmaril@0
|
77 |
|
insilmaril@0
|
78 |
note.copy (other->note);
|
insilmaril@0
|
79 |
systemFlags->copy (other->systemFlags);
|
insilmaril@0
|
80 |
standardFlags->copy (other->standardFlags);
|
insilmaril@0
|
81 |
|
insilmaril@227
|
82 |
ornamentsBBox=other->ornamentsBBox;
|
insilmaril@227
|
83 |
|
insilmaril@243
|
84 |
hideExport=other->hideExport;
|
insilmaril@243
|
85 |
url=other->url;
|
insilmaril@243
|
86 |
vymLink=other->vymLink;
|
insilmaril@0
|
87 |
}
|
insilmaril@0
|
88 |
|
insilmaril@0
|
89 |
QString OrnamentedObj::getHeading()
|
insilmaril@0
|
90 |
{
|
insilmaril@0
|
91 |
return heading->text();
|
insilmaril@0
|
92 |
}
|
insilmaril@0
|
93 |
|
insilmaril@0
|
94 |
void OrnamentedObj::setLinkColor()
|
insilmaril@0
|
95 |
{
|
insilmaril@398
|
96 |
if (mapEditor->getMapLinkColorHint()==HeadingColor)
|
insilmaril@0
|
97 |
LinkableMapObj::setLinkColor (heading->getColor());
|
insilmaril@0
|
98 |
else
|
insilmaril@398
|
99 |
LinkableMapObj::setLinkColor (mapEditor->getMapDefLinkColor());
|
insilmaril@0
|
100 |
}
|
insilmaril@0
|
101 |
|
insilmaril@243
|
102 |
void OrnamentedObj::setColor (QColor col)
|
insilmaril@243
|
103 |
{
|
insilmaril@243
|
104 |
heading->setColor(col);
|
insilmaril@243
|
105 |
setLinkColor();
|
insilmaril@243
|
106 |
}
|
insilmaril@243
|
107 |
|
insilmaril@0
|
108 |
QColor OrnamentedObj::getColor ()
|
insilmaril@0
|
109 |
{
|
insilmaril@0
|
110 |
return heading->getColor();
|
insilmaril@0
|
111 |
}
|
insilmaril@0
|
112 |
|
insilmaril@476
|
113 |
FrameObj::FrameType OrnamentedObj::getFrameType()
|
insilmaril@442
|
114 |
{
|
insilmaril@442
|
115 |
return frame->getFrameType();
|
insilmaril@442
|
116 |
}
|
insilmaril@442
|
117 |
|
insilmaril@476
|
118 |
QString OrnamentedObj::getFrameTypeName()
|
insilmaril@476
|
119 |
{
|
insilmaril@476
|
120 |
return frame->getFrameTypeName();
|
insilmaril@476
|
121 |
}
|
insilmaril@476
|
122 |
|
insilmaril@476
|
123 |
void OrnamentedObj::setFrameType(const FrameObj::FrameType &t)
|
insilmaril@442
|
124 |
{
|
insilmaril@442
|
125 |
frame->setFrameType(t);
|
insilmaril@476
|
126 |
if (t == FrameObj::NoFrame)
|
insilmaril@476
|
127 |
linkpos=LinkableMapObj::Bottom;
|
insilmaril@442
|
128 |
else
|
insilmaril@476
|
129 |
linkpos=LinkableMapObj::Middle;
|
insilmaril@442
|
130 |
|
insilmaril@442
|
131 |
calcBBoxSize();
|
insilmaril@442
|
132 |
positionBBox();
|
insilmaril@442
|
133 |
requestReposition();
|
insilmaril@442
|
134 |
}
|
insilmaril@442
|
135 |
|
insilmaril@442
|
136 |
void OrnamentedObj::setFrameType(const QString &t)
|
insilmaril@442
|
137 |
{
|
insilmaril@442
|
138 |
frame->setFrameType(t);
|
insilmaril@476
|
139 |
if (frame->getFrameType() == FrameObj::NoFrame)
|
insilmaril@476
|
140 |
linkpos=LinkableMapObj::Bottom;
|
insilmaril@442
|
141 |
else
|
insilmaril@476
|
142 |
linkpos=LinkableMapObj::Middle;
|
insilmaril@442
|
143 |
|
insilmaril@442
|
144 |
calcBBoxSize();
|
insilmaril@442
|
145 |
positionBBox();
|
insilmaril@442
|
146 |
requestReposition();
|
insilmaril@442
|
147 |
}
|
insilmaril@442
|
148 |
|
insilmaril@476
|
149 |
void OrnamentedObj::setFramePadding (const int &i)
|
insilmaril@476
|
150 |
{
|
insilmaril@476
|
151 |
frame->setPadding (i);
|
insilmaril@476
|
152 |
calcBBoxSize();
|
insilmaril@476
|
153 |
positionBBox();
|
insilmaril@476
|
154 |
requestReposition();
|
insilmaril@476
|
155 |
}
|
insilmaril@476
|
156 |
|
insilmaril@476
|
157 |
int OrnamentedObj::getFramePadding ()
|
insilmaril@476
|
158 |
{
|
insilmaril@476
|
159 |
return frame->getPadding();
|
insilmaril@476
|
160 |
}
|
insilmaril@476
|
161 |
|
insilmaril@476
|
162 |
void OrnamentedObj::setFrameBorderWidth (const int &i)
|
insilmaril@476
|
163 |
{
|
insilmaril@476
|
164 |
frame->setBorderWidth(i);
|
insilmaril@476
|
165 |
calcBBoxSize();
|
insilmaril@476
|
166 |
positionBBox();
|
insilmaril@476
|
167 |
requestReposition();
|
insilmaril@476
|
168 |
}
|
insilmaril@476
|
169 |
|
insilmaril@476
|
170 |
int OrnamentedObj::getFrameBorderWidth()
|
insilmaril@476
|
171 |
{
|
insilmaril@476
|
172 |
return frame->getBorderWidth();
|
insilmaril@476
|
173 |
}
|
insilmaril@476
|
174 |
|
insilmaril@442
|
175 |
void OrnamentedObj::setFramePenColor(QColor col)
|
insilmaril@442
|
176 |
{
|
insilmaril@442
|
177 |
frame->setPenColor (col);
|
insilmaril@442
|
178 |
}
|
insilmaril@442
|
179 |
|
insilmaril@442
|
180 |
QColor OrnamentedObj::getFramePenColor()
|
insilmaril@442
|
181 |
{
|
insilmaril@442
|
182 |
return frame->getPenColor ();
|
insilmaril@442
|
183 |
}
|
insilmaril@442
|
184 |
|
insilmaril@442
|
185 |
void OrnamentedObj::setFrameBrushColor(QColor col)
|
insilmaril@442
|
186 |
{
|
insilmaril@442
|
187 |
frame->setBrushColor (col);
|
insilmaril@442
|
188 |
}
|
insilmaril@442
|
189 |
|
insilmaril@442
|
190 |
QColor OrnamentedObj::getFrameBrushColor()
|
insilmaril@442
|
191 |
{
|
insilmaril@442
|
192 |
return frame->getBrushColor ();
|
insilmaril@442
|
193 |
}
|
insilmaril@0
|
194 |
|
insilmaril@177
|
195 |
void OrnamentedObj::positionContents()
|
insilmaril@0
|
196 |
{
|
insilmaril@476
|
197 |
double d=frame->getPadding()/2;
|
insilmaril@177
|
198 |
double x=absPos.x();
|
insilmaril@177
|
199 |
double y=absPos.y();
|
insilmaril@227
|
200 |
|
insilmaril@227
|
201 |
double ox,oy; // Offset due to padding
|
insilmaril@227
|
202 |
|
insilmaril@227
|
203 |
ox=leftPad + d;
|
insilmaril@227
|
204 |
oy=topPad + d;
|
insilmaril@227
|
205 |
|
insilmaril@227
|
206 |
systemFlags-> move (ox +x , oy + y );
|
insilmaril@0
|
207 |
|
insilmaril@0
|
208 |
// vertical align heading to bottom
|
insilmaril@227
|
209 |
heading->move (ox + x + systemFlags->getBBox().width(),
|
insilmaril@227
|
210 |
oy + y + ornamentsBBox.height() - heading->getHeight()
|
insilmaril@0
|
211 |
);
|
insilmaril@227
|
212 |
standardFlags->move (ox +x + heading->getWidth() + systemFlags->getBBox().width() , oy + y );
|
insilmaril@227
|
213 |
|
insilmaril@408
|
214 |
ornamentsBBox.moveTopLeft ( QPointF ((int)(ox+x),(int)(oy+y)));
|
insilmaril@408
|
215 |
clickBox.moveTopLeft (QPointF ((int)(ox + x), (int)(oy + y)));
|
insilmaril@177
|
216 |
}
|
insilmaril@0
|
217 |
|
insilmaril@177
|
218 |
void OrnamentedObj::move (double x, double y)
|
insilmaril@177
|
219 |
{
|
insilmaril@177
|
220 |
MapObj::move (x,y);
|
insilmaril@177
|
221 |
positionContents();
|
insilmaril@0
|
222 |
updateLink();
|
insilmaril@0
|
223 |
requestReposition();
|
insilmaril@0
|
224 |
}
|
insilmaril@0
|
225 |
|
insilmaril@408
|
226 |
void OrnamentedObj::move (QPointF p)
|
insilmaril@0
|
227 |
{
|
insilmaril@0
|
228 |
move (p.x(), p.y());
|
insilmaril@0
|
229 |
}
|
insilmaril@0
|
230 |
|
insilmaril@0
|
231 |
void OrnamentedObj::moveBy (double x, double y)
|
insilmaril@0
|
232 |
{
|
insilmaril@0
|
233 |
|
insilmaril@0
|
234 |
MapObj::moveBy (x,y);
|
insilmaril@0
|
235 |
frame->moveBy (x,y);
|
insilmaril@0
|
236 |
systemFlags->moveBy (x,y);
|
insilmaril@0
|
237 |
standardFlags->moveBy (x,y);
|
insilmaril@0
|
238 |
heading->moveBy (x,y);
|
insilmaril@0
|
239 |
updateLink();
|
insilmaril@0
|
240 |
requestReposition();
|
insilmaril@0
|
241 |
}
|
insilmaril@0
|
242 |
|
insilmaril@408
|
243 |
void OrnamentedObj::moveBy (QPointF p)
|
insilmaril@0
|
244 |
{
|
insilmaril@0
|
245 |
moveBy (p.x(), p.y());
|
insilmaril@0
|
246 |
}
|
insilmaril@0
|
247 |
|
insilmaril@0
|
248 |
void OrnamentedObj::move2RelPos(double x, double y)
|
insilmaril@0
|
249 |
{
|
insilmaril@408
|
250 |
setRelPos (QPointF((int)x,(int)y));
|
insilmaril@388
|
251 |
if (parObj)
|
insilmaril@388
|
252 |
{
|
insilmaril@408
|
253 |
QPointF p=parObj->getChildPos();
|
insilmaril@388
|
254 |
move (p.x()+x, p.y() +y);
|
insilmaril@388
|
255 |
}
|
insilmaril@0
|
256 |
}
|
insilmaril@0
|
257 |
|
insilmaril@408
|
258 |
void OrnamentedObj::move2RelPos(QPointF p)
|
insilmaril@0
|
259 |
{
|
insilmaril@218
|
260 |
move2RelPos (p.x(),p.y());
|
insilmaril@0
|
261 |
}
|
insilmaril@0
|
262 |
|
insilmaril@0
|
263 |
void OrnamentedObj::setNote(QString s)
|
insilmaril@0
|
264 |
{
|
insilmaril@0
|
265 |
note.setNote(s);
|
insilmaril@417
|
266 |
updateNoteFlag();
|
insilmaril@0
|
267 |
}
|
insilmaril@0
|
268 |
|
insilmaril@0
|
269 |
void OrnamentedObj::setNote(NoteObj n)
|
insilmaril@0
|
270 |
{
|
insilmaril@0
|
271 |
note=n;
|
insilmaril@417
|
272 |
updateNoteFlag();
|
insilmaril@0
|
273 |
}
|
insilmaril@0
|
274 |
|
insilmaril@0
|
275 |
QString OrnamentedObj::getNote()
|
insilmaril@0
|
276 |
{
|
insilmaril@0
|
277 |
return note.getNote();
|
insilmaril@0
|
278 |
}
|
insilmaril@0
|
279 |
|
insilmaril@613
|
280 |
QString OrnamentedObj::getNoteASCII(const QString &indent, const int &width)
|
insilmaril@613
|
281 |
{
|
insilmaril@663
|
282 |
return note.getNoteASCII(indent,width);
|
insilmaril@613
|
283 |
}
|
insilmaril@613
|
284 |
|
insilmaril@187
|
285 |
QString OrnamentedObj::getNoteASCII()
|
insilmaril@187
|
286 |
{
|
insilmaril@187
|
287 |
return note.getNoteASCII();
|
insilmaril@187
|
288 |
}
|
insilmaril@187
|
289 |
|
insilmaril@187
|
290 |
QString OrnamentedObj::getNoteOpenDoc()
|
insilmaril@187
|
291 |
{
|
insilmaril@187
|
292 |
return note.getNoteOpenDoc();
|
insilmaril@187
|
293 |
}
|
insilmaril@187
|
294 |
|
insilmaril@243
|
295 |
void OrnamentedObj::setURL(QString s)
|
insilmaril@243
|
296 |
{
|
insilmaril@243
|
297 |
url=s;
|
insilmaril@243
|
298 |
if (!url.isEmpty())
|
insilmaril@243
|
299 |
systemFlags->activate("url");
|
insilmaril@243
|
300 |
else
|
insilmaril@243
|
301 |
systemFlags->deactivate("url");
|
insilmaril@243
|
302 |
calcBBoxSize(); // recalculate bbox
|
insilmaril@243
|
303 |
positionBBox(); // rearrange contents
|
insilmaril@243
|
304 |
forceReposition();
|
insilmaril@243
|
305 |
}
|
insilmaril@243
|
306 |
|
insilmaril@243
|
307 |
QString OrnamentedObj::getURL()
|
insilmaril@243
|
308 |
{
|
insilmaril@243
|
309 |
return url;
|
insilmaril@243
|
310 |
}
|
insilmaril@243
|
311 |
|
insilmaril@243
|
312 |
void OrnamentedObj::setVymLink(QString s)
|
insilmaril@243
|
313 |
{
|
insilmaril@243
|
314 |
if (!s.isEmpty())
|
insilmaril@243
|
315 |
{
|
insilmaril@243
|
316 |
// We need the relative (from loading)
|
insilmaril@243
|
317 |
// or absolute path (from User event)
|
insilmaril@243
|
318 |
// and build the absolute path.
|
insilmaril@243
|
319 |
// Note: If we have relative, use path of
|
insilmaril@243
|
320 |
// current map to build absolute path
|
insilmaril@243
|
321 |
QDir d(s);
|
insilmaril@243
|
322 |
if (!d.path().startsWith ("/"))
|
insilmaril@243
|
323 |
{
|
insilmaril@243
|
324 |
QString p=mapEditor->getDestPath();
|
insilmaril@243
|
325 |
int i=p.findRev("/",-1);
|
insilmaril@243
|
326 |
d.setPath(p.left(i)+"/"+s);
|
insilmaril@243
|
327 |
d.convertToAbs();
|
insilmaril@243
|
328 |
}
|
insilmaril@243
|
329 |
vymLink=d.path();
|
insilmaril@243
|
330 |
systemFlags->activate("vymLink");
|
insilmaril@243
|
331 |
}
|
insilmaril@243
|
332 |
else
|
insilmaril@243
|
333 |
{
|
insilmaril@243
|
334 |
systemFlags->deactivate("vymLink");
|
insilmaril@243
|
335 |
vymLink="";
|
insilmaril@243
|
336 |
}
|
insilmaril@243
|
337 |
calcBBoxSize(); // recalculate bbox
|
insilmaril@243
|
338 |
positionBBox(); // rearrange contents
|
insilmaril@243
|
339 |
forceReposition();
|
insilmaril@243
|
340 |
}
|
insilmaril@243
|
341 |
|
insilmaril@243
|
342 |
QString OrnamentedObj::getVymLink()
|
insilmaril@243
|
343 |
{
|
insilmaril@243
|
344 |
return vymLink;
|
insilmaril@243
|
345 |
}
|
insilmaril@243
|
346 |
|
insilmaril@628
|
347 |
|
insilmaril@628
|
348 |
void OrnamentedObj::setAttributes (const QList <Attribute> &al)
|
insilmaril@628
|
349 |
{
|
insilmaril@628
|
350 |
attributes=al;
|
insilmaril@628
|
351 |
}
|
insilmaril@243
|
352 |
|
insilmaril@638
|
353 |
QList <Attribute> OrnamentedObj::getAttributes()
|
insilmaril@638
|
354 |
{
|
insilmaril@638
|
355 |
return attributes;
|
insilmaril@638
|
356 |
}
|
insilmaril@638
|
357 |
|
insilmaril@447
|
358 |
void OrnamentedObj::clearStandardFlags()
|
insilmaril@447
|
359 |
{
|
insilmaril@447
|
360 |
standardFlags->deactivateAll();
|
insilmaril@447
|
361 |
calcBBoxSize();
|
insilmaril@447
|
362 |
positionBBox();
|
insilmaril@447
|
363 |
move (absPos.x(), absPos.y() );
|
insilmaril@447
|
364 |
forceReposition();
|
insilmaril@447
|
365 |
}
|
insilmaril@447
|
366 |
|
insilmaril@103
|
367 |
void OrnamentedObj::toggleStandardFlag(QString f, bool exclusive)
|
insilmaril@0
|
368 |
{
|
insilmaril@103
|
369 |
standardFlags->toggle(f,exclusive);
|
insilmaril@0
|
370 |
calcBBoxSize();
|
insilmaril@0
|
371 |
positionBBox();
|
insilmaril@0
|
372 |
move (absPos.x(), absPos.y() );
|
insilmaril@0
|
373 |
forceReposition();
|
insilmaril@0
|
374 |
}
|
insilmaril@0
|
375 |
|
insilmaril@0
|
376 |
void OrnamentedObj::activateStandardFlag(QString f)
|
insilmaril@0
|
377 |
{
|
insilmaril@0
|
378 |
standardFlags->activate(f);
|
insilmaril@0
|
379 |
calcBBoxSize();
|
insilmaril@0
|
380 |
positionBBox();
|
insilmaril@0
|
381 |
move (absPos.x(), absPos.y() );
|
insilmaril@0
|
382 |
forceReposition();
|
insilmaril@0
|
383 |
}
|
insilmaril@0
|
384 |
|
insilmaril@366
|
385 |
void OrnamentedObj::deactivateStandardFlag(QString f)
|
insilmaril@366
|
386 |
{
|
insilmaril@366
|
387 |
standardFlags->deactivate(f);
|
insilmaril@366
|
388 |
calcBBoxSize();
|
insilmaril@366
|
389 |
positionBBox();
|
insilmaril@366
|
390 |
move (absPos.x(), absPos.y() );
|
insilmaril@366
|
391 |
forceReposition();
|
insilmaril@366
|
392 |
}
|
insilmaril@366
|
393 |
|
insilmaril@296
|
394 |
bool OrnamentedObj::isSetStandardFlag (QString f)
|
insilmaril@296
|
395 |
{
|
insilmaril@296
|
396 |
return standardFlags->isActive(f);
|
insilmaril@296
|
397 |
}
|
insilmaril@296
|
398 |
|
insilmaril@408
|
399 |
QString OrnamentedObj::getSystemFlagName(const QPointF &p)
|
insilmaril@0
|
400 |
{
|
insilmaril@0
|
401 |
return systemFlags->getFlagName(p);
|
insilmaril@0
|
402 |
}
|
insilmaril@0
|
403 |
|
insilmaril@236
|
404 |
bool OrnamentedObj::isActiveFlag (const QString & fname)
|
insilmaril@236
|
405 |
{
|
insilmaril@236
|
406 |
if (standardFlags->isActive (fname) ) return true;
|
insilmaril@236
|
407 |
return false;
|
insilmaril@236
|
408 |
}
|
insilmaril@236
|
409 |
|
insilmaril@417
|
410 |
void OrnamentedObj::getNoteFromTextEditor ()
|
insilmaril@417
|
411 |
{
|
insilmaril@417
|
412 |
note.setFilenameHint (textEditor->getFilename());
|
insilmaril@417
|
413 |
note.setFontHint (textEditor->getFontHint() );
|
insilmaril@417
|
414 |
setNote( textEditor->getText() );
|
insilmaril@417
|
415 |
}
|
insilmaril@417
|
416 |
|
insilmaril@0
|
417 |
void OrnamentedObj::updateNoteFlag()
|
insilmaril@0
|
418 |
{
|
insilmaril@417
|
419 |
bool noteEmpty;
|
insilmaril@417
|
420 |
if (isNoteInEditor)
|
insilmaril@417
|
421 |
noteEmpty=textEditor->isEmpty();
|
insilmaril@417
|
422 |
else
|
insilmaril@417
|
423 |
noteEmpty=note.isEmpty();
|
insilmaril@0
|
424 |
|
insilmaril@417
|
425 |
if (!noteEmpty)
|
insilmaril@417
|
426 |
{
|
insilmaril@417
|
427 |
if (systemFlags->isActive ("note")) return;
|
insilmaril@417
|
428 |
systemFlags->activate("note");
|
insilmaril@417
|
429 |
}
|
insilmaril@417
|
430 |
else
|
insilmaril@417
|
431 |
{
|
insilmaril@417
|
432 |
if (!systemFlags->isActive ("note")) return;
|
insilmaril@417
|
433 |
systemFlags->deactivate("note");
|
insilmaril@417
|
434 |
}
|
insilmaril@417
|
435 |
mapEditor->setChanged();
|
insilmaril@417
|
436 |
calcBBoxSize();
|
insilmaril@417
|
437 |
positionBBox();
|
insilmaril@417
|
438 |
move (absPos.x(), absPos.y() );
|
insilmaril@417
|
439 |
forceReposition();
|
insilmaril@0
|
440 |
|
insilmaril@417
|
441 |
}
|
insilmaril@0
|
442 |
|
insilmaril@366
|
443 |
void OrnamentedObj::updateFlagsToolbar()
|
insilmaril@366
|
444 |
{
|
insilmaril@366
|
445 |
standardFlags->updateToolbar();
|
insilmaril@366
|
446 |
}
|
insilmaril@366
|
447 |
|
insilmaril@243
|
448 |
void OrnamentedObj::setHideInExport(bool b)
|
insilmaril@243
|
449 |
{
|
insilmaril@260
|
450 |
if (parObj)
|
insilmaril@260
|
451 |
{
|
insilmaril@260
|
452 |
// Don't allow to MapCenter to be hidden
|
insilmaril@260
|
453 |
hideExport=b;
|
insilmaril@260
|
454 |
if (b)
|
insilmaril@260
|
455 |
systemFlags->activate("hideInExport");
|
insilmaril@260
|
456 |
else
|
insilmaril@260
|
457 |
systemFlags->deactivate("hideInExport");
|
insilmaril@260
|
458 |
calcBBoxSize();
|
insilmaril@260
|
459 |
positionBBox();
|
insilmaril@260
|
460 |
requestReposition();
|
insilmaril@260
|
461 |
}
|
insilmaril@243
|
462 |
}
|
insilmaril@243
|
463 |
|
insilmaril@243
|
464 |
bool OrnamentedObj::hideInExport()
|
insilmaril@243
|
465 |
{
|
insilmaril@243
|
466 |
return hideExport;
|
insilmaril@243
|
467 |
}
|
insilmaril@243
|
468 |
|
insilmaril@260
|
469 |
bool OrnamentedObj::isHidden()
|
insilmaril@260
|
470 |
{
|
insilmaril@260
|
471 |
return hidden;
|
insilmaril@260
|
472 |
}
|
insilmaril@260
|
473 |
|
insilmaril@628
|
474 |
QString OrnamentedObj::getOrnXMLAttr()
|
insilmaril@243
|
475 |
{
|
insilmaril@243
|
476 |
QString posAttr;
|
insilmaril@252
|
477 |
|
insilmaril@388
|
478 |
if (depth==0)
|
insilmaril@388
|
479 |
posAttr=
|
insilmaril@408
|
480 |
attribut("absPosX",QString().setNum(absPos.x())) +
|
insilmaril@408
|
481 |
attribut("absPosY",QString().setNum(absPos.y()));
|
insilmaril@243
|
482 |
else
|
insilmaril@252
|
483 |
{
|
insilmaril@395
|
484 |
if (depth==1 || typeid (*this)==typeid (FloatImageObj))
|
insilmaril@635
|
485 |
{
|
insilmaril@635
|
486 |
if (relPos.x()==0 && relPos.y()==0)
|
insilmaril@635
|
487 |
setRelPos();
|
insilmaril@388
|
488 |
posAttr=
|
insilmaril@408
|
489 |
attribut("relPosX",QString().setNum(relPos.x())) +
|
insilmaril@408
|
490 |
attribut("relPosY",QString().setNum(relPos.y()));
|
insilmaril@635
|
491 |
} else
|
insilmaril@252
|
492 |
posAttr="";
|
insilmaril@252
|
493 |
}
|
insilmaril@243
|
494 |
|
insilmaril@243
|
495 |
QString urlAttr;
|
insilmaril@243
|
496 |
if (!url.isEmpty())
|
insilmaril@243
|
497 |
urlAttr=attribut ("url",url);
|
insilmaril@243
|
498 |
|
insilmaril@243
|
499 |
QString vymLinkAttr;
|
insilmaril@243
|
500 |
if (!vymLink.isEmpty())
|
insilmaril@243
|
501 |
vymLinkAttr=attribut ("vymLink",convertToRel(mapEditor->getDestPath(),vymLink) );
|
insilmaril@243
|
502 |
|
insilmaril@243
|
503 |
QString hideExpAttr;
|
insilmaril@243
|
504 |
if (hideExport)
|
insilmaril@243
|
505 |
hideExpAttr= attribut("hideInExport","true");
|
insilmaril@243
|
506 |
else
|
insilmaril@243
|
507 |
hideExpAttr="";
|
insilmaril@243
|
508 |
|
insilmaril@243
|
509 |
return posAttr +urlAttr +vymLinkAttr +getLinkAttr() +hideExpAttr;
|
insilmaril@243
|
510 |
}
|
insilmaril@243
|
511 |
|