insilmaril@749
|
1 |
#include "mapcenteritem.h"
|
insilmaril@749
|
2 |
#include "mapcenterobj.h"
|
insilmaril@749
|
3 |
|
insilmaril@749
|
4 |
#include <iostream>
|
insilmaril@749
|
5 |
using namespace std;
|
insilmaril@749
|
6 |
|
insilmaril@749
|
7 |
MapCenterItem::MapCenterItem(const QList<QVariant> &data, TreeItem *parent):BranchItem (data,parent)
|
insilmaril@749
|
8 |
{
|
insilmaril@749
|
9 |
scrolled=false;
|
insilmaril@749
|
10 |
tmpUnscrolled=false;
|
insilmaril@749
|
11 |
}
|
insilmaril@749
|
12 |
|
insilmaril@749
|
13 |
MapCenterItem::~MapCenterItem()
|
insilmaril@749
|
14 |
{
|
insilmaril@749
|
15 |
cout << "Destr. MapCenterItem\n";
|
insilmaril@749
|
16 |
qDeleteAll(childItems);
|
insilmaril@749
|
17 |
}
|
insilmaril@749
|
18 |
|
insilmaril@749
|
19 |
QString MapCenterItem::saveToDir (const QString &tmpdir,const QString &prefix, const QPointF& offset)
|
insilmaril@749
|
20 |
{
|
insilmaril@749
|
21 |
// Cloudy stuff can be hidden during exports
|
insilmaril@749
|
22 |
if (hidden) return QString();
|
insilmaril@749
|
23 |
|
insilmaril@749
|
24 |
QString s,a;
|
insilmaril@749
|
25 |
BranchObj *bo=(BranchObj*)lmo;
|
insilmaril@749
|
26 |
|
insilmaril@749
|
27 |
/* FIXME-1
|
insilmaril@749
|
28 |
// Update of note is usually done while unselecting a branch
|
insilmaril@749
|
29 |
if (isNoteInEditor) getNoteFromTextEditor();
|
insilmaril@749
|
30 |
|
insilmaril@749
|
31 |
QString scrolledAttr;
|
insilmaril@749
|
32 |
if (scrolled)
|
insilmaril@749
|
33 |
scrolledAttr=attribut ("scrolled","yes");
|
insilmaril@749
|
34 |
else
|
insilmaril@749
|
35 |
scrolledAttr="";
|
insilmaril@749
|
36 |
|
insilmaril@749
|
37 |
// save area, if not scrolled
|
insilmaril@749
|
38 |
QString areaAttr;
|
insilmaril@749
|
39 |
if (!((BranchObj*)(parObj))->isScrolled() )
|
insilmaril@749
|
40 |
{
|
insilmaril@749
|
41 |
areaAttr=
|
insilmaril@749
|
42 |
attribut("x1",QString().setNum(absPos.x()-offset.x())) +
|
insilmaril@749
|
43 |
attribut("y1",QString().setNum(absPos.y()-offset.y())) +
|
insilmaril@749
|
44 |
attribut("x2",QString().setNum(absPos.x()+width()-offset.x())) +
|
insilmaril@749
|
45 |
attribut("y2",QString().setNum(absPos.y()+height()-offset.y()));
|
insilmaril@749
|
46 |
|
insilmaril@749
|
47 |
} else
|
insilmaril@749
|
48 |
areaAttr="";
|
insilmaril@749
|
49 |
|
insilmaril@749
|
50 |
// Providing an ID for a branch makes export to XHTML easier
|
insilmaril@749
|
51 |
QString idAttr;
|
insilmaril@749
|
52 |
if (countXLinks()>0)
|
insilmaril@749
|
53 |
idAttr=attribut ("id",model->getSelectString(this)); //TODO directly access model
|
insilmaril@749
|
54 |
else
|
insilmaril@749
|
55 |
idAttr="";
|
insilmaril@749
|
56 |
|
insilmaril@749
|
57 |
*/
|
insilmaril@749
|
58 |
s=beginElement ("branch"
|
insilmaril@749
|
59 |
// +getOrnXMLAttr()
|
insilmaril@749
|
60 |
// +scrolledAttr
|
insilmaril@749
|
61 |
// +areaAttr
|
insilmaril@749
|
62 |
// +idAttr
|
insilmaril@749
|
63 |
// +getIncludeImageAttr()
|
insilmaril@749
|
64 |
);
|
insilmaril@749
|
65 |
incIndent();
|
insilmaril@749
|
66 |
|
insilmaril@749
|
67 |
// save heading
|
insilmaril@749
|
68 |
s+=valueElement("heading", getHeading(),
|
insilmaril@749
|
69 |
attribut ("textColor",QColor( bo->getColor()).name()));
|
insilmaril@749
|
70 |
|
insilmaril@749
|
71 |
/*
|
insilmaril@749
|
72 |
// Save frame
|
insilmaril@749
|
73 |
if (frame->getFrameType()!=FrameObj::NoFrame)
|
insilmaril@749
|
74 |
s+=frame->saveToDir ();
|
insilmaril@749
|
75 |
|
insilmaril@749
|
76 |
// save names of flags set
|
insilmaril@749
|
77 |
s+=standardFlags->saveToDir(tmpdir,prefix,0);
|
insilmaril@749
|
78 |
|
insilmaril@749
|
79 |
// Save FloatImages
|
insilmaril@749
|
80 |
for (int i=0; i<floatimage.size(); ++i)
|
insilmaril@749
|
81 |
s+=floatimage.at(i)->saveToDir (tmpdir,prefix);
|
insilmaril@749
|
82 |
*/
|
insilmaril@749
|
83 |
|
insilmaril@749
|
84 |
// save note
|
insilmaril@749
|
85 |
if (!note.isEmpty() )
|
insilmaril@749
|
86 |
s+=note.saveToDir();
|
insilmaril@749
|
87 |
|
insilmaril@749
|
88 |
// Save branches
|
insilmaril@749
|
89 |
TreeItem *ti=getFirstBranch();
|
insilmaril@749
|
90 |
TreeItem *last=getLastBranch();
|
insilmaril@749
|
91 |
while (ti && ti!=last)
|
insilmaril@749
|
92 |
s+=ti->saveToDir(tmpdir,prefix,offset);
|
insilmaril@749
|
93 |
|
insilmaril@749
|
94 |
/*
|
insilmaril@749
|
95 |
// Save XLinks
|
insilmaril@749
|
96 |
QString ol; // old link
|
insilmaril@749
|
97 |
QString cl; // current link
|
insilmaril@749
|
98 |
for (int i=0; i<xlink.size(); ++i)
|
insilmaril@749
|
99 |
{
|
insilmaril@749
|
100 |
cl=xlink.at(i)->saveToDir();
|
insilmaril@749
|
101 |
if (cl!=ol)
|
insilmaril@749
|
102 |
{
|
insilmaril@749
|
103 |
s+=cl;
|
insilmaril@749
|
104 |
ol=cl;
|
insilmaril@749
|
105 |
} else
|
insilmaril@749
|
106 |
{
|
insilmaril@749
|
107 |
qWarning (QString("Ignoring of duplicate xLink in %1").arg(getHeading()));
|
insilmaril@749
|
108 |
}
|
insilmaril@749
|
109 |
}
|
insilmaril@749
|
110 |
*/
|
insilmaril@749
|
111 |
|
insilmaril@749
|
112 |
decIndent();
|
insilmaril@749
|
113 |
s+=endElement ("branch");
|
insilmaril@749
|
114 |
return s;
|
insilmaril@749
|
115 |
}
|
insilmaril@749
|
116 |
|
insilmaril@749
|
117 |
|
insilmaril@749
|
118 |
|