diff -r 1e51ba080947 -r 700553af9ca5 vymmodel.cpp --- a/vymmodel.cpp Tue Jan 15 13:06:59 2008 +0000 +++ b/vymmodel.cpp Tue Jan 15 13:06:59 2008 +0000 @@ -101,89 +101,6 @@ return NULL; } -// Only as long as we dont have Model/View yet -LinkableMapObj* VymModel::getSelection() -{ - return mapEditor->getSelection(); -} -BranchObj* VymModel::getSelectedBranch() -{ - return mapEditor->getSelectedBranch(); -} - -bool VymModel::select (const QString &s) -{ - LinkableMapObj *lmo=model->findObjBySelect(s); - -/* - // Finally select the found object - if (lmo) - { - xelection.unselect(); - xelection.select(lmo); - xelection.update(); - ensureSelectionVisible(); - sendSelection (); - return true; - } - return false; -*/ -} - -QString VymModel::getSelectString (LinkableMapObj *lmo) -{ - QString s; - if (!lmo) return s; - if (typeid(*lmo)==typeid(BranchObj) || - typeid(*lmo)==typeid(MapCenterObj) ) - { - LinkableMapObj *par=lmo->getParObj(); - if (par) - { - if (lmo->getDepth() ==1) - // Mainbranch, return - s= "bo:" + QString("%1").arg(((BranchObj*)lmo)->getNum()); - else - // Branch, call myself recursively - s= getSelectString(par) + ",bo:" + QString("%1").arg(((BranchObj*)lmo)->getNum()); - } else - { - // MapCenter - int i=mapCenters.indexOf ((MapCenterObj*)lmo); - if (i>=0) s=QString("mc:%1").arg(i); - } - } - return s; - -} - -/* FIXME copied from MCO, still needed? -void VymModel::move (double x, double y) -{ - BranchObj::move(x,y); -} - -void VymModel::moveBy (double x, double y) -{ - BranchObj::moveBy(x,y); -} - -void VymModel::moveAll (double x, double y) -{ - // Get rel. position - double dx=x-absPos.x(); - double dy=y-absPos.y(); - - // Move myself and branches - moveAllBy (dx,dy); -} - -void VymModel::moveAllBy (double dx, double dy) -{ - // Move myself and childs - BranchObj::moveBy(dx,dy); -} -*/ BranchObj* VymModel::first() { if (mapCenters.count()>0) @@ -212,45 +129,6 @@ return mapCenters.at(i); } return NULL; - -} - - /* FIXME copied from MCO, still needed? -void VymModel::updateLink() -{ - // set childPos to middle of MapCenterObj - childPos.setX( clickBox.topLeft().x() + (int)(clickBox.width())/2 ); - childPos.setY( clickBox.topLeft().y() + (int)(clickBox.height())/2 ); - parPos=childPos; - for (int i=0; iupdateLink(); -} - -*/ -void VymModel::updateRelPositions() -{ - for (int i=0; iupdateRelPositions(); -} - -void VymModel::reposition() -{ - for (int i=0;ireposition(); // for positioning heading -} - -void VymModel::setHideTmp (HideTmpMode mode) -{ - for (int i=0;isetHideTmp (mode); -} - -QRectF VymModel::getTotalBBox() -{ - QRectF r; - for (int i=0;igetTotalBBox(), r); - return r; } LinkableMapObj* VymModel::findMapObj(QPointF p, LinkableMapObj *excludeLMO) @@ -274,7 +152,7 @@ QString typ; QString num; part=s.section(",",0,0); - typ=part.left (3); + typ=part.left (2); num=part.right(part.length() - 3); if (typ=="mc" && num.toInt()>=0 && num.toInt() updateLink(); +} + +*/ +void VymModel::updateRelPositions() +{ + for (int i=0; iupdateRelPositions(); +} + +void VymModel::reposition() +{ + for (int i=0;ireposition(); // for positioning heading +} + + + +////////////////////////////////////////////// +// Selection related +////////////////////////////////////////////// + + +// Only as long as we dont have Model/View yet +LinkableMapObj* VymModel::getSelection() +{ + return mapEditor->getSelection(); +} +BranchObj* VymModel::getSelectedBranch() +{ + return mapEditor->getSelectedBranch(); +} + + +bool VymModel::select (const QString &s) +{ + return mapEditor->select (s); +} + +QString VymModel::getSelectString (LinkableMapObj *lmo) +{ + QString s; + if (!lmo) return s; + if (typeid(*lmo)==typeid(BranchObj) || + typeid(*lmo)==typeid(MapCenterObj) ) + { + LinkableMapObj *par=lmo->getParObj(); + if (par) + { + if (lmo->getDepth() ==1) + // Mainbranch, return + s= "bo:" + QString("%1").arg(((BranchObj*)lmo)->getNum()); + else + // Branch, call myself recursively + s= getSelectString(par) + ",bo:" + QString("%1").arg(((BranchObj*)lmo)->getNum()); + } else + { + // MapCenter + int i=mapCenters.indexOf ((MapCenterObj*)lmo); + if (i>=0) s=QString("mc:%1").arg(i); + } + } + return s; + +} + + +void VymModel::setHideTmp (HideTmpMode mode) +{ + for (int i=0;isetHideTmp (mode); +} + +QRectF VymModel::getTotalBBox() +{ + QRectF r; + for (int i=0;igetTotalBBox(), r); + return r; +} +