1.1 --- a/branchitem.cpp Wed May 20 15:40:14 2009 +0000
1.2 +++ b/branchitem.cpp Tue May 26 11:23:44 2009 +0000
1.3 @@ -84,7 +84,13 @@
1.4 idAttr="";
1.5
1.6 */
1.7 - s=beginElement ("branch"
1.8 + QString elementName;
1.9 + if (parentItem==rootItem)
1.10 + elementName="mapcenter";
1.11 + else
1.12 + elementName="branch";
1.13 +
1.14 + s=beginElement (elementName
1.15 +getAttr()
1.16 // +getOrnXMLAttr()
1.17 +scrolledAttr
1.18 @@ -146,7 +152,7 @@
1.19 */
1.20
1.21 decIndent();
1.22 - s+=endElement ("branch");
1.23 + s+=endElement (elementName);
1.24 return s;
1.25 }
1.26
1.27 @@ -337,6 +343,15 @@
1.28 return NULL;
1.29 }
1.30
1.31 +void BranchItem::updateStyles()
1.32 +{
1.33 + // FIXME-5 compare also MapItem::initLMO...
1.34 +
1.35 + if (lmo)
1.36 + {
1.37 + lmo->setParObj (parentItem->getLMO() );
1.38 + }
1.39 +}
1.40
1.41 BranchObj* BranchItem::getBranchObj() // FIXME-3 only for transition BO->BI
1.42 {
1.43 @@ -345,22 +360,50 @@
1.44
1.45 BranchObj* BranchItem::createMapObj(QGraphicsScene *scene)
1.46 {
1.47 + BranchObj *newbo;
1.48 + cout << "BI::createMO "<<getHeadingStd()<<" pI="<<parentItem<<" rI="<<rootItem<<endl;
1.49 + if (parentItem==rootItem)
1.50 + {
1.51 + // Initialize MapCenterObj, order of things is important...
1.52 + cout << "BI::createMO (MCO) "<<getHeadingStd()<<endl;
1.53 + MapCenterObj* mco=new MapCenterObj(scene);
1.54 + newbo=mco;
1.55 + lmo=mco;
1.56 + newbo->setParObj(NULL);
1.57 + newbo->setTreeItem (this);
1.58 + newbo->setDefAttr(BranchObj::NewBranch);
1.59 + } else
1.60 + {
1.61 // Initialize BranchObj, order of things is important...
1.62 - BranchObj* newbo=new BranchObj(scene);
1.63 - lmo=newbo;
1.64 - BranchObj* parbo=(BranchObj*)(parentItem->getLMO());
1.65 - newbo->setParObj(parbo);
1.66 - newbo->setTreeItem (this);
1.67 - newbo->setDefAttr(BranchObj::NewBranch);
1.68 - if (((BranchItem*)parentItem)->scrolled || !parbo->isVisibleObj() )
1.69 - newbo->setVisibility (false);
1.70 -
1.71 + cout << "BI::createMO (BO) "<<getHeadingStd()<<endl;
1.72 + newbo=new BranchObj(scene);
1.73 + lmo=newbo;
1.74 + BranchObj* parbo=(BranchObj*)(parentItem->getLMO());
1.75 + newbo->setParObj(parbo);
1.76 + newbo->setTreeItem (this);
1.77 + newbo->setDefAttr(BranchObj::NewBranch);
1.78 +
1.79 + if (parentItem->isBranchLikeType())
1.80 + {
1.81 + // Set visibility depending on parents
1.82 + if (((BranchItem*)parentItem)->scrolled || !parbo->isVisibleObj() )
1.83 + {
1.84 + if (parentItem && parentItem->isBranchLikeType())
1.85 + cout <<" scrolled="<<((BranchItem*)parentItem)->scrolled<<endl;
1.86 + if (parbo)
1.87 + cout <<" par->vis="<<parbo->isVisibleObj()<<endl;
1.88 + newbo->setVisibility (false);
1.89 + }
1.90 + } else
1.91 + cout <<" pI=no branch!\n";
1.92 +
1.93 + }
1.94 initLMO();
1.95
1.96 if (!getHeading().isEmpty() )
1.97 {
1.98 - newbo->updateData(); //FIXME-3 maybe better model->emitDataHasChanged()?
1.99 - newbo->setColor (headingColor);
1.100 + ((BranchObj*)lmo)->updateData(); //FIXME-3 maybe better model->emitDataHasChanged()?
1.101 + ((BranchObj*)lmo)->setColor (headingColor);
1.102 }
1.103
1.104