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