insilmaril@746
|
1 |
#include <iostream>
|
insilmaril@725
|
2 |
#include <QStringList>
|
insilmaril@725
|
3 |
|
insilmaril@750
|
4 |
#include "treeitem.h"
|
insilmaril@750
|
5 |
|
insilmaril@741
|
6 |
#include "branchobj.h"
|
insilmaril@750
|
7 |
#include "branchitem.h"
|
insilmaril@746
|
8 |
#include "vymmodel.h"
|
insilmaril@725
|
9 |
|
insilmaril@758
|
10 |
using namespace std;
|
insilmaril@758
|
11 |
|
insilmaril@758
|
12 |
|
insilmaril@725
|
13 |
TreeItem::TreeItem(const QList<QVariant> &data, TreeItem *parent)
|
insilmaril@725
|
14 |
{
|
insilmaril@756
|
15 |
init();
|
insilmaril@756
|
16 |
parentItem = parent;
|
insilmaril@756
|
17 |
itemData = data;
|
insilmaril@756
|
18 |
}
|
insilmaril@756
|
19 |
|
insilmaril@756
|
20 |
TreeItem::~TreeItem()
|
insilmaril@756
|
21 |
{
|
insilmaril@756
|
22 |
//cout << "Destructor TreeItem "<<getHeadingStd()<<endl;
|
insilmaril@756
|
23 |
TreeItem *ti;
|
insilmaril@756
|
24 |
while (!childItems.isEmpty())
|
insilmaril@756
|
25 |
{
|
insilmaril@756
|
26 |
ti=childItems.takeFirst();
|
insilmaril@756
|
27 |
switch (ti->getType() )
|
insilmaril@756
|
28 |
{
|
insilmaril@756
|
29 |
case TreeItem::MapCenter:
|
insilmaril@756
|
30 |
delete (MapCenterItem*)ti;
|
insilmaril@756
|
31 |
break;
|
insilmaril@756
|
32 |
case TreeItem::Branch:
|
insilmaril@756
|
33 |
delete (BranchItem*)ti;
|
insilmaril@756
|
34 |
break;
|
insilmaril@756
|
35 |
default:
|
insilmaril@756
|
36 |
delete ti;
|
insilmaril@756
|
37 |
break;
|
insilmaril@756
|
38 |
}
|
insilmaril@756
|
39 |
}
|
insilmaril@756
|
40 |
}
|
insilmaril@756
|
41 |
|
insilmaril@756
|
42 |
|
insilmaril@756
|
43 |
void TreeItem::init()
|
insilmaril@756
|
44 |
{
|
insilmaril@746
|
45 |
model=NULL;
|
insilmaril@746
|
46 |
|
insilmaril@756
|
47 |
parentItem = NULL;
|
insilmaril@756
|
48 |
itemData.clear();
|
insilmaril@756
|
49 |
lmo=NULL;
|
insilmaril@738
|
50 |
|
insilmaril@738
|
51 |
branchOffset=0;
|
insilmaril@741
|
52 |
branchCounter=0;
|
insilmaril@738
|
53 |
lastSelectedBranchNum=-1;
|
insilmaril@746
|
54 |
|
insilmaril@746
|
55 |
note.setNote("");
|
insilmaril@746
|
56 |
// note.setFontHint (textEditor->getFontHintDefault() ); //FIXME-2
|
insilmaril@746
|
57 |
// isNoteInEditor=false;
|
insilmaril@753
|
58 |
|
insilmaril@753
|
59 |
hidden=false;
|
insilmaril@754
|
60 |
|
insilmaril@754
|
61 |
// Reset ID
|
insilmaril@754
|
62 |
objID="";
|
insilmaril@754
|
63 |
|
insilmaril@754
|
64 |
|
insilmaril@725
|
65 |
}
|
insilmaril@725
|
66 |
|
insilmaril@746
|
67 |
QString TreeItem::saveToDir (const QString &tmpdir,const QString &prefix, const QPointF& offset)
|
insilmaril@746
|
68 |
{
|
insilmaril@755
|
69 |
cout << "TreeItem::saveToDir called directly for ("<<getHeadingStd()<<"), instead of inherited type...\n"; //FIXME-1 triggered on save
|
insilmaril@746
|
70 |
return QString();
|
insilmaril@746
|
71 |
}
|
insilmaril@746
|
72 |
|
insilmaril@746
|
73 |
|
insilmaril@746
|
74 |
/*
|
insilmaril@753
|
75 |
void TreeItem::copy (OrnamentedObj* other) //FIXME-2 probably need deep copy of branches and data!
|
insilmaril@746
|
76 |
|
insilmaril@746
|
77 |
{
|
insilmaril@746
|
78 |
note.copy (other->note);
|
insilmaril@746
|
79 |
model=other->model;
|
insilmaril@754
|
80 |
hideExport=officially
|
insilmaril@754
|
81 |
other->hideExport;
|
insilmaril@746
|
82 |
}
|
insilmaril@746
|
83 |
*/
|
insilmaril@746
|
84 |
|
insilmaril@746
|
85 |
void TreeItem::setModel (VymModel *m)
|
insilmaril@746
|
86 |
{
|
insilmaril@746
|
87 |
model=m;
|
insilmaril@746
|
88 |
}
|
insilmaril@746
|
89 |
|
insilmaril@746
|
90 |
VymModel* TreeItem::getModel ()
|
insilmaril@746
|
91 |
{
|
insilmaril@746
|
92 |
return model;
|
insilmaril@746
|
93 |
}
|
insilmaril@741
|
94 |
|
insilmaril@725
|
95 |
void TreeItem::appendChild(TreeItem *item)
|
insilmaril@725
|
96 |
{
|
insilmaril@725
|
97 |
childItems.append(item);
|
insilmaril@756
|
98 |
item->parentItem=this;
|
insilmaril@746
|
99 |
item->setModel (model);
|
insilmaril@741
|
100 |
|
insilmaril@741
|
101 |
if (item->type == Branch || item->type ==MapCenter)
|
insilmaril@738
|
102 |
{
|
insilmaril@741
|
103 |
if (branchCounter==0)
|
insilmaril@738
|
104 |
branchOffset=childItems.count()-1;
|
insilmaril@741
|
105 |
branchCounter++;
|
insilmaril@738
|
106 |
}
|
insilmaril@725
|
107 |
}
|
insilmaril@725
|
108 |
|
insilmaril@727
|
109 |
void TreeItem::removeChild(int row)
|
insilmaril@727
|
110 |
{
|
insilmaril@745
|
111 |
if (row<0 || row > childItems.size()-1)
|
insilmaril@745
|
112 |
qWarning ("TreeItem::removeChild tried to remove non existing item?!\n");
|
insilmaril@745
|
113 |
else
|
insilmaril@727
|
114 |
{
|
insilmaril@755
|
115 |
if (childItems.at(row)->isBranchLikeType())
|
insilmaril@755
|
116 |
branchCounter--;
|
insilmaril@755
|
117 |
childItems.removeAt (row);
|
insilmaril@745
|
118 |
}
|
insilmaril@727
|
119 |
}
|
insilmaril@727
|
120 |
|
insilmaril@725
|
121 |
TreeItem *TreeItem::child(int row)
|
insilmaril@725
|
122 |
{
|
insilmaril@725
|
123 |
return childItems.value(row);
|
insilmaril@725
|
124 |
}
|
insilmaril@725
|
125 |
|
insilmaril@725
|
126 |
int TreeItem::childCount() const
|
insilmaril@725
|
127 |
{
|
insilmaril@725
|
128 |
return childItems.count();
|
insilmaril@725
|
129 |
}
|
insilmaril@725
|
130 |
|
insilmaril@745
|
131 |
int TreeItem::childNumber() const
|
insilmaril@745
|
132 |
{
|
insilmaril@745
|
133 |
if (parentItem)
|
insilmaril@745
|
134 |
return parentItem->childItems.indexOf(const_cast<TreeItem*>(this));
|
insilmaril@745
|
135 |
|
insilmaril@745
|
136 |
return 0;
|
insilmaril@745
|
137 |
}
|
insilmaril@745
|
138 |
|
insilmaril@725
|
139 |
int TreeItem::columnCount() const
|
insilmaril@725
|
140 |
{
|
insilmaril@725
|
141 |
return itemData.count();
|
insilmaril@725
|
142 |
}
|
insilmaril@741
|
143 |
|
insilmaril@741
|
144 |
int TreeItem::branchCount() const
|
insilmaril@741
|
145 |
{
|
insilmaril@741
|
146 |
return branchCounter;
|
insilmaril@741
|
147 |
}
|
insilmaril@749
|
148 |
|
insilmaril@749
|
149 |
int TreeItem::imageCount() const
|
insilmaril@749
|
150 |
{
|
insilmaril@749
|
151 |
int imageCounter=0;
|
insilmaril@749
|
152 |
return imageCounter; // FIXME-1 imageCounter needs to be calculated...
|
insilmaril@749
|
153 |
}
|
insilmaril@749
|
154 |
|
insilmaril@749
|
155 |
int TreeItem::xlinkCount() const // FIXME-2 check if xlinks are stored in a different way (global to model?)
|
insilmaril@749
|
156 |
{
|
insilmaril@749
|
157 |
int xlinkCounter=0;
|
insilmaril@749
|
158 |
return xlinkCounter; // FIXME-1 xlinkCounter needs to be calculated...
|
insilmaril@749
|
159 |
}
|
insilmaril@749
|
160 |
|
insilmaril@727
|
161 |
int TreeItem::row() const
|
insilmaril@727
|
162 |
{
|
insilmaril@727
|
163 |
if (parentItem)
|
insilmaril@727
|
164 |
return parentItem->childItems.indexOf(const_cast<TreeItem*>(this));
|
insilmaril@727
|
165 |
|
insilmaril@727
|
166 |
return 0;
|
insilmaril@727
|
167 |
}
|
insilmaril@727
|
168 |
|
insilmaril@727
|
169 |
int TreeItem::column() const
|
insilmaril@727
|
170 |
{
|
insilmaril@727
|
171 |
return 0;
|
insilmaril@727
|
172 |
}
|
insilmaril@727
|
173 |
|
insilmaril@740
|
174 |
int TreeItem::depth()
|
insilmaril@740
|
175 |
{
|
insilmaril@755
|
176 |
int d=-2;
|
insilmaril@740
|
177 |
TreeItem *ti=this;
|
insilmaril@740
|
178 |
while (ti!=NULL)
|
insilmaril@740
|
179 |
{
|
insilmaril@740
|
180 |
ti=ti->parent();
|
insilmaril@740
|
181 |
d++;
|
insilmaril@740
|
182 |
}
|
insilmaril@740
|
183 |
return d;
|
insilmaril@740
|
184 |
}
|
insilmaril@740
|
185 |
|
insilmaril@727
|
186 |
TreeItem *TreeItem::parent()
|
insilmaril@727
|
187 |
{
|
insilmaril@727
|
188 |
return parentItem;
|
insilmaril@727
|
189 |
}
|
insilmaril@727
|
190 |
|
insilmaril@755
|
191 |
int TreeItem::childNum()
|
insilmaril@755
|
192 |
{
|
insilmaril@755
|
193 |
return parentItem->childItems.indexOf (this);
|
insilmaril@755
|
194 |
}
|
insilmaril@755
|
195 |
|
insilmaril@741
|
196 |
int TreeItem::num()
|
insilmaril@741
|
197 |
{
|
insilmaril@741
|
198 |
switch (type)
|
insilmaril@741
|
199 |
{
|
insilmaril@741
|
200 |
case Undefined: return -1;
|
insilmaril@741
|
201 |
case MapCenter: return parentItem->childItems.indexOf (this) - branchOffset;
|
insilmaril@741
|
202 |
case Branch: return parentItem->childItems.indexOf (this) - branchOffset;
|
insilmaril@746
|
203 |
case Image: return -1; // FIXME-2
|
insilmaril@741
|
204 |
default: return -1;
|
insilmaril@741
|
205 |
}
|
insilmaril@749
|
206 |
}
|
insilmaril@749
|
207 |
|
insilmaril@749
|
208 |
int TreeItem::num (TreeItem *item)
|
insilmaril@749
|
209 |
{
|
insilmaril@749
|
210 |
if (!item) return -1;
|
insilmaril@749
|
211 |
switch (item->getType())
|
insilmaril@749
|
212 |
{
|
insilmaril@749
|
213 |
case Undefined: return -1;
|
insilmaril@749
|
214 |
case MapCenter: return childItems.indexOf (this) - branchOffset;
|
insilmaril@749
|
215 |
case Branch: return childItems.indexOf (this) - branchOffset;
|
insilmaril@749
|
216 |
case Image: return -1; // FIXME-2
|
insilmaril@749
|
217 |
default: return -1;
|
insilmaril@749
|
218 |
}
|
insilmaril@741
|
219 |
}
|
insilmaril@725
|
220 |
|
insilmaril@725
|
221 |
QVariant TreeItem::data(int column) const
|
insilmaril@725
|
222 |
{
|
insilmaril@725
|
223 |
return itemData.value(column);
|
insilmaril@725
|
224 |
}
|
insilmaril@725
|
225 |
|
insilmaril@726
|
226 |
void TreeItem::setHeading (const QString s)
|
insilmaril@725
|
227 |
{
|
insilmaril@726
|
228 |
itemData[0]=s;
|
insilmaril@726
|
229 |
}
|
insilmaril@726
|
230 |
|
insilmaril@753
|
231 |
QString TreeItem::getHeading () const
|
insilmaril@726
|
232 |
{
|
insilmaril@726
|
233 |
return itemData[0].toString();
|
insilmaril@726
|
234 |
}
|
insilmaril@726
|
235 |
|
insilmaril@755
|
236 |
std::string TreeItem::getHeadingStd () const
|
insilmaril@753
|
237 |
{
|
insilmaril@753
|
238 |
return itemData[0].toString().toStdString();
|
insilmaril@753
|
239 |
}
|
insilmaril@753
|
240 |
|
insilmaril@758
|
241 |
void TreeItem::setHeadingColor (QColor color)
|
insilmaril@758
|
242 |
{
|
insilmaril@758
|
243 |
headingColor=color;
|
insilmaril@758
|
244 |
}
|
insilmaril@758
|
245 |
|
insilmaril@758
|
246 |
QColor TreeItem::getHeadingColor ()
|
insilmaril@758
|
247 |
{
|
insilmaril@758
|
248 |
return headingColor;
|
insilmaril@758
|
249 |
}
|
insilmaril@758
|
250 |
|
insilmaril@741
|
251 |
void TreeItem::setNote(const QString s)
|
insilmaril@741
|
252 |
{
|
insilmaril@746
|
253 |
note.setNote(s);
|
insilmaril@746
|
254 |
// updateNoteFlag(); FIXME-2 needed?
|
insilmaril@746
|
255 |
if (model)
|
insilmaril@753
|
256 |
model->emitNoteHasChanged (this);
|
insilmaril@746
|
257 |
}
|
insilmaril@746
|
258 |
|
insilmaril@746
|
259 |
void TreeItem::setNoteObj(const NoteObj &n, bool updateNoteEditor)
|
insilmaril@746
|
260 |
{
|
insilmaril@746
|
261 |
note=n;
|
insilmaril@746
|
262 |
// updateNoteFlag(); FIXME-2 needed?
|
insilmaril@746
|
263 |
if (model && updateNoteEditor)
|
insilmaril@753
|
264 |
model->emitNoteHasChanged (this);
|
insilmaril@741
|
265 |
}
|
insilmaril@741
|
266 |
|
insilmaril@741
|
267 |
QString TreeItem::getNote()
|
insilmaril@741
|
268 |
{
|
insilmaril@746
|
269 |
return note.getNote();
|
insilmaril@746
|
270 |
}
|
insilmaril@746
|
271 |
|
insilmaril@746
|
272 |
NoteObj TreeItem::getNoteObj()
|
insilmaril@746
|
273 |
{
|
insilmaril@746
|
274 |
return note;
|
insilmaril@746
|
275 |
}
|
insilmaril@746
|
276 |
|
insilmaril@746
|
277 |
QString TreeItem::getNoteASCII(const QString &indent, const int &width)
|
insilmaril@746
|
278 |
{
|
insilmaril@746
|
279 |
return note.getNoteASCII(indent,width);
|
insilmaril@746
|
280 |
}
|
insilmaril@746
|
281 |
|
insilmaril@746
|
282 |
QString TreeItem::getNoteASCII()
|
insilmaril@746
|
283 |
{
|
insilmaril@746
|
284 |
return note.getNoteASCII();
|
insilmaril@746
|
285 |
}
|
insilmaril@746
|
286 |
|
insilmaril@746
|
287 |
QString TreeItem::getNoteOpenDoc()
|
insilmaril@746
|
288 |
{
|
insilmaril@746
|
289 |
return note.getNoteOpenDoc();
|
insilmaril@741
|
290 |
}
|
insilmaril@741
|
291 |
|
insilmaril@726
|
292 |
void TreeItem::setType(const Type t)
|
insilmaril@726
|
293 |
{
|
insilmaril@726
|
294 |
type=t;
|
insilmaril@726
|
295 |
itemData[1]=getTypeName();
|
insilmaril@726
|
296 |
}
|
insilmaril@726
|
297 |
|
insilmaril@726
|
298 |
TreeItem::Type TreeItem::getType()
|
insilmaril@726
|
299 |
{
|
insilmaril@726
|
300 |
return type;
|
insilmaril@726
|
301 |
}
|
insilmaril@726
|
302 |
|
insilmaril@753
|
303 |
bool TreeItem::isBranchLikeType() const
|
insilmaril@753
|
304 |
{
|
insilmaril@753
|
305 |
if (type==Branch ||type==MapCenter) return true;
|
insilmaril@753
|
306 |
return false;
|
insilmaril@753
|
307 |
}
|
insilmaril@753
|
308 |
|
insilmaril@726
|
309 |
QString TreeItem::getTypeName()
|
insilmaril@726
|
310 |
{
|
insilmaril@726
|
311 |
switch (type)
|
insilmaril@726
|
312 |
{
|
insilmaril@726
|
313 |
case Undefined: return QString ("Undefined");
|
insilmaril@726
|
314 |
case MapCenter: return QString ("MapCenter");
|
insilmaril@726
|
315 |
case Branch: return QString ("Branch");
|
insilmaril@739
|
316 |
case Image: return QString ("Image");
|
insilmaril@726
|
317 |
default: return QString ("TreeItem::getTypeName no typename defined?!");
|
insilmaril@726
|
318 |
}
|
insilmaril@725
|
319 |
}
|
insilmaril@725
|
320 |
|
insilmaril@754
|
321 |
void TreeItem::setID (const QString &s)
|
insilmaril@754
|
322 |
{
|
insilmaril@754
|
323 |
objID=s;
|
insilmaril@754
|
324 |
}
|
insilmaril@754
|
325 |
|
insilmaril@754
|
326 |
QString TreeItem::getID()
|
insilmaril@754
|
327 |
{
|
insilmaril@754
|
328 |
return objID;
|
insilmaril@754
|
329 |
}
|
insilmaril@754
|
330 |
|
insilmaril@754
|
331 |
|
insilmaril@738
|
332 |
TreeItem* TreeItem::getChildNum(const int &n)
|
insilmaril@738
|
333 |
{
|
insilmaril@738
|
334 |
if (n>=0 && n<childItems.count() )
|
insilmaril@738
|
335 |
return childItems.at(n);
|
insilmaril@738
|
336 |
else
|
insilmaril@738
|
337 |
return NULL;
|
insilmaril@738
|
338 |
}
|
insilmaril@738
|
339 |
|
insilmaril@750
|
340 |
BranchItem* TreeItem::getFirstBranch()
|
insilmaril@738
|
341 |
{
|
insilmaril@741
|
342 |
if (branchCounter>0)
|
insilmaril@738
|
343 |
return getBranchNum (branchOffset);
|
insilmaril@738
|
344 |
else
|
insilmaril@738
|
345 |
return NULL;
|
insilmaril@738
|
346 |
}
|
insilmaril@738
|
347 |
|
insilmaril@750
|
348 |
BranchItem* TreeItem::getLastBranch()
|
insilmaril@738
|
349 |
{
|
insilmaril@741
|
350 |
if (branchCounter>0)
|
insilmaril@741
|
351 |
return getBranchNum (branchOffset + branchCounter-1);
|
insilmaril@738
|
352 |
else
|
insilmaril@738
|
353 |
return NULL;
|
insilmaril@738
|
354 |
}
|
insilmaril@738
|
355 |
|
insilmaril@738
|
356 |
|
insilmaril@750
|
357 |
BranchItem* TreeItem::getBranchNum(const int &n)
|
insilmaril@738
|
358 |
{
|
insilmaril@741
|
359 |
if (branchCounter>0)
|
insilmaril@750
|
360 |
return (BranchItem*)getChildNum (branchOffset + n);
|
insilmaril@738
|
361 |
else
|
insilmaril@738
|
362 |
return NULL;
|
insilmaril@738
|
363 |
}
|
insilmaril@738
|
364 |
|
insilmaril@750
|
365 |
BranchObj* TreeItem::getBranchObjNum(const int &n)
|
insilmaril@750
|
366 |
{
|
insilmaril@750
|
367 |
if (branchCounter>0)
|
insilmaril@750
|
368 |
{
|
insilmaril@750
|
369 |
return (BranchObj*)(getChildNum (branchOffset+n)->lmo);
|
insilmaril@750
|
370 |
} else
|
insilmaril@750
|
371 |
return NULL;
|
insilmaril@750
|
372 |
}
|
insilmaril@750
|
373 |
|
insilmaril@738
|
374 |
void TreeItem::setLastSelectedBranch()
|
insilmaril@738
|
375 |
{
|
insilmaril@738
|
376 |
if (parentItem)
|
insilmaril@738
|
377 |
parentItem->lastSelectedBranchNum=parentItem->childItems.indexOf(this);
|
insilmaril@738
|
378 |
}
|
insilmaril@738
|
379 |
|
insilmaril@754
|
380 |
TreeItem* TreeItem::findBySelectString (const QString &s) //FIXME-1
|
insilmaril@754
|
381 |
{
|
insilmaril@754
|
382 |
/*
|
insilmaril@754
|
383 |
LinkableMapObj *lmo=this;
|
insilmaril@754
|
384 |
QString part;
|
insilmaril@754
|
385 |
QString typ;
|
insilmaril@754
|
386 |
QString num;
|
insilmaril@754
|
387 |
while (!s.isEmpty() )
|
insilmaril@754
|
388 |
{
|
insilmaril@754
|
389 |
part=s.section(",",0,0);
|
insilmaril@754
|
390 |
typ=part.left (3);
|
insilmaril@754
|
391 |
num=part.right(part.length() - 3);
|
insilmaril@754
|
392 |
if (typ=="mc:")
|
insilmaril@754
|
393 |
{
|
insilmaril@754
|
394 |
if (depth>0)
|
insilmaril@754
|
395 |
return false; // in a subtree there is no center
|
insilmaril@754
|
396 |
else
|
insilmaril@754
|
397 |
break;
|
insilmaril@754
|
398 |
} else
|
insilmaril@754
|
399 |
if (typ=="bo:")
|
insilmaril@754
|
400 |
lmo=lmo->getTreeItem()->getBranchObjNum (num.toInt());
|
insilmaril@754
|
401 |
else
|
insilmaril@754
|
402 |
if (typ=="fi:")
|
insilmaril@754
|
403 |
lmo=((BranchObj*)lmo)->getFloatImageNum (num.toUInt());
|
insilmaril@754
|
404 |
if (!lmo) break;
|
insilmaril@754
|
405 |
|
insilmaril@754
|
406 |
if (s.contains(","))
|
insilmaril@754
|
407 |
s=s.right(s.length() - part.length() -1 );
|
insilmaril@754
|
408 |
else
|
insilmaril@754
|
409 |
break;
|
insilmaril@754
|
410 |
}
|
insilmaril@754
|
411 |
*/
|
insilmaril@754
|
412 |
return NULL;
|
insilmaril@754
|
413 |
}
|
insilmaril@754
|
414 |
|
insilmaril@754
|
415 |
void TreeItem::setLastSelectedBranch(int i)
|
insilmaril@754
|
416 |
{
|
insilmaril@754
|
417 |
lastSelectedBranchNum=i;
|
insilmaril@754
|
418 |
}
|
insilmaril@754
|
419 |
|
insilmaril@738
|
420 |
TreeItem* TreeItem::getLastSelectedBranch()
|
insilmaril@738
|
421 |
{
|
insilmaril@738
|
422 |
return getBranchNum (lastSelectedBranchNum);
|
insilmaril@738
|
423 |
}
|
insilmaril@738
|
424 |
|
insilmaril@753
|
425 |
|
insilmaril@753
|
426 |
void TreeItem::setHideTmp (HideTmpMode mode)
|
insilmaril@753
|
427 |
{
|
insilmaril@753
|
428 |
if (isBranchLikeType() )
|
insilmaril@753
|
429 |
((BranchItem*)this)->updateVisibility();
|
insilmaril@753
|
430 |
/*
|
insilmaril@753
|
431 |
if (type==Image)
|
insilmaril@753
|
432 |
//updateVisibility();
|
insilmaril@753
|
433 |
*/
|
insilmaril@753
|
434 |
|
insilmaril@753
|
435 |
/*
|
insilmaril@753
|
436 |
|
insilmaril@753
|
437 |
if (mode==HideExport && (hideExport || hasHiddenExportParent() ) )
|
insilmaril@753
|
438 |
{
|
insilmaril@753
|
439 |
// Hide stuff according to hideExport flag and parents
|
insilmaril@753
|
440 |
//setVisibility (false);
|
insilmaril@753
|
441 |
updateVisibility();
|
insilmaril@753
|
442 |
//FIXME-2 hidden=true;
|
insilmaril@753
|
443 |
}else
|
insilmaril@753
|
444 |
{
|
insilmaril@753
|
445 |
// Do not hide, but still take care of scrolled status
|
insilmaril@753
|
446 |
|
insilmaril@753
|
447 |
|
insilmaril@753
|
448 |
XXXXXXXX treeItem should be THIS
|
insilmaril@753
|
449 |
|
insilmaril@753
|
450 |
move visible to TreeItem???
|
insilmaril@753
|
451 |
|
insilmaril@753
|
452 |
BranchObj now has updateContents
|
insilmaril@753
|
453 |
|
insilmaril@753
|
454 |
maybe also start "bool TreeItem::branchlikeType"
|
insilmaril@753
|
455 |
|
insilmaril@753
|
456 |
|
insilmaril@753
|
457 |
|
insilmaril@753
|
458 |
if ( ((BranchItem*)treeItem)->hasScrolledParent((BranchItem*)treeItem))
|
insilmaril@753
|
459 |
setVisibility (false);
|
insilmaril@753
|
460 |
else
|
insilmaril@753
|
461 |
setVisibility (true);
|
insilmaril@753
|
462 |
//FIXME-2 hidden=false;
|
insilmaril@753
|
463 |
}
|
insilmaril@753
|
464 |
|
insilmaril@753
|
465 |
*/
|
insilmaril@753
|
466 |
// And take care of my children
|
insilmaril@753
|
467 |
for (int i=0; i<branchCount(); ++i)
|
insilmaril@753
|
468 |
getBranchNum(i)->setHideTmp (mode);
|
insilmaril@753
|
469 |
}
|
insilmaril@753
|
470 |
|
insilmaril@753
|
471 |
bool TreeItem::hasHiddenExportParent()
|
insilmaril@753
|
472 |
{
|
insilmaril@753
|
473 |
// Calls parents recursivly to
|
insilmaril@753
|
474 |
// find out, if we or parents are temp. hidden
|
insilmaril@753
|
475 |
|
insilmaril@753
|
476 |
if (hidden || hideExport) return true;
|
insilmaril@753
|
477 |
|
insilmaril@753
|
478 |
if (parentItem)
|
insilmaril@753
|
479 |
return parentItem->hasHiddenExportParent();
|
insilmaril@753
|
480 |
else
|
insilmaril@753
|
481 |
return false;
|
insilmaril@753
|
482 |
}
|
insilmaril@753
|
483 |
|
insilmaril@753
|
484 |
|
insilmaril@753
|
485 |
void TreeItem::setHideInExport(bool b)
|
insilmaril@753
|
486 |
{
|
insilmaril@753
|
487 |
if (isBranchLikeType() )
|
insilmaril@753
|
488 |
{
|
insilmaril@753
|
489 |
hideExport=b;
|
insilmaril@753
|
490 |
/* FIXME-1 call setVis and updateContentsSize...
|
insilmaril@753
|
491 |
if (b)
|
insilmaril@753
|
492 |
systemFlags->activate("hideInExport");
|
insilmaril@753
|
493 |
else
|
insilmaril@753
|
494 |
systemFlags->deactivate("hideInExport");
|
insilmaril@753
|
495 |
calcBBoxSize();
|
insilmaril@753
|
496 |
positionBBox();
|
insilmaril@753
|
497 |
requestReposition();
|
insilmaril@753
|
498 |
*/
|
insilmaril@753
|
499 |
}
|
insilmaril@753
|
500 |
}
|
insilmaril@753
|
501 |
|
insilmaril@753
|
502 |
bool TreeItem::hideInExport()
|
insilmaril@753
|
503 |
{
|
insilmaril@753
|
504 |
return hideExport;
|
insilmaril@753
|
505 |
}
|
insilmaril@753
|
506 |
|
insilmaril@753
|
507 |
bool TreeItem::isHidden()
|
insilmaril@753
|
508 |
{
|
insilmaril@753
|
509 |
return hidden;
|
insilmaril@753
|
510 |
}
|
insilmaril@753
|
511 |
|
insilmaril@753
|
512 |
|
insilmaril@746
|
513 |
LinkableMapObj* TreeItem::getLMO() // FIXME-3 VM should be unnecessary in the end
|
insilmaril@726
|
514 |
{
|
insilmaril@726
|
515 |
return lmo;
|
insilmaril@726
|
516 |
}
|
insilmaril@726
|
517 |
|
insilmaril@726
|
518 |
void TreeItem::setLMO(LinkableMapObj *l)
|
insilmaril@726
|
519 |
{
|
insilmaril@726
|
520 |
lmo=l;
|
insilmaril@726
|
521 |
}
|
insilmaril@726
|
522 |
|