# HG changeset patch # User insilmaril # Date 1200402419 0 # Node ID 700553af9ca54bd7df210cf706ab0c8ad4d4bf92 # Parent 1e51ba080947b0552cbd8365036fa4dce60bc4bd more changes for multiple mapCenters diff -r 1e51ba080947 -r 700553af9ca5 demos/vym-projectplan.vym Binary file demos/vym-projectplan.vym has changed diff -r 1e51ba080947 -r 700553af9ca5 mapeditor.cpp --- a/mapeditor.cpp Tue Jan 15 13:06:59 2008 +0000 +++ b/mapeditor.cpp Tue Jan 15 13:06:59 2008 +0000 @@ -2685,18 +2685,13 @@ bool MapEditor::select (const QString &s) { - LinkableMapObj *lmo=model->findObjBySelect(s); - - // Finally select the found object - if (lmo) + if (xelection.select(s)) { - xelection.unselect(); - xelection.select(lmo); xelection.update(); ensureSelectionVisible(); sendSelection (); return true; - } + } return false; } @@ -4258,9 +4253,8 @@ void MapEditor::testFunction2() { - cout << "Selection (org): "<getSelectString(xelection.getBranch()).ascii()<addMapCenter(); + xelection.select (model->addMapCenter()); + ensureSelectionVisible(); /* // Toggle hidemode @@ -4269,14 +4263,6 @@ else setHideTmpMode (HideExport); */ -/* - LinkableMapObj *lmo=xelection.getBranch(); - if (lmo) - { - cout << "LMO::id="<getID().ascii()<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; +} + diff -r 1e51ba080947 -r 700553af9ca5 vymmodel.h --- a/vymmodel.h Tue Jan 15 13:06:59 2008 +0000 +++ b/vymmodel.h Tue Jan 15 13:06:59 2008 +0000 @@ -28,31 +28,30 @@ QGraphicsScene *getScene(); MapCenterObj* addMapCenter(); MapCenterObj* removeMapCenter(MapCenterObj *mco); - LinkableMapObj* getSelection(); - BranchObj* getSelectedBranch(); - bool select (const QString &s); - QString getSelectString (LinkableMapObj *lmo); - /* - void move (double,double); // FIXME needed at all? - void moveBy (double,double); // FIXME needed at all? - void moveAll (double,double); // FIXME needed at all? - void moveAllBy (double,double); // FIXME needed at all? - */ + BranchObj* first(); // FIXME replaced by ModelIndex later BranchObj* next(BranchObj *bo); // FIXME replaced by ModelIndex later -/* - void updateLink(); -*/ + LinkableMapObj* findMapObj(QPointF,LinkableMapObj*); // find MapObj + LinkableMapObj* findObjBySelect (const QString &s); // find MapObj by select string + LinkableMapObj* findID (const QString &s); // find MapObj by previously set ID + QString saveToDir (const QString&,const QString&,int, const QPointF&);// Save data recursivly to tempdir + + +////////////////////////////////////////// View related + // void updateLink(); FIXME needed? void updateRelPositions(); QRectF getTotalBBox(); void reposition(); //!< Call reposition for all MCOs void setHideTmp (HideTmpMode mode); - LinkableMapObj* findMapObj(QPointF,LinkableMapObj*); // find MapObj - LinkableMapObj* findObjBySelect (const QString &s); // find MapObj by select string - LinkableMapObj* findID (const QString &s); // find MapObj by previously set ID - QString saveToDir (const QString&,const QString&,int, const QPointF&);// Save data recursivly to tempdir + +////////////////////////////////////////// Selection related + LinkableMapObj* getSelection(); + BranchObj* getSelectedBranch(); + bool select (const QString &s); + QString getSelectString (LinkableMapObj *lmo); + private: QGraphicsScene *mapScene; MapEditor *mapEditor; diff -r 1e51ba080947 -r 700553af9ca5 xml-freemind.cpp --- a/xml-freemind.cpp Tue Jan 15 13:06:59 2008 +0000 +++ b/xml-freemind.cpp Tue Jan 15 13:06:59 2008 +0000 @@ -26,7 +26,6 @@ laststate = StateInit; stateStack.clear(); stateStack.append(StateInit); - branchDepth=0; isVymPart=false; return true; } diff -r 1e51ba080947 -r 700553af9ca5 xml-vym.cpp --- a/xml-vym.cpp Tue Jan 15 13:06:59 2008 +0000 +++ b/xml-vym.cpp Tue Jan 15 13:06:59 2008 +0000 @@ -34,7 +34,6 @@ laststate = StateInit; stateStack.clear(); stateStack.append(StateInit); - branchDepth=0; htmldata=""; isVymPart=false; return true; @@ -221,7 +220,6 @@ } else lastBranch->clear(); - branchDepth=1; readBranchAttr (atts); } else if (eName=="floatimage") { @@ -234,7 +232,6 @@ } else if ( eName == "branch" && state == StateMapCenter) { state=StateBranch; - branchDepth=1; lastBranch->addBranch(); lastBranch=lastBranch->getLastBranch(); readBranchAttr (atts); @@ -258,7 +255,6 @@ { lastBranch->addBranch(); lastBranch=lastBranch->getLastBranch(); - branchDepth++; readBranchAttr (atts); } else if ( eName == "html" && state == StateHtmlNote ) { @@ -425,7 +421,7 @@ return false; // Couldn't read relPos } } - if (!a.value( "absPosX").isEmpty() && loadMode==NewMap && branchDepth<2) + if (!a.value( "absPosX").isEmpty() && loadMode==NewMap ) { if (!a.value( "absPosY").isEmpty() ) {