1.1 --- a/branchitem.cpp Tue Apr 07 16:15:53 2009 +0000
1.2 +++ b/branchitem.cpp Mon Apr 20 10:42:05 2009 +0000
1.3 @@ -249,6 +249,59 @@
1.4 }
1.5 }
1.6
1.7 +TreeItem* BranchItem::findMapItem (QPointF p, TreeItem* excludeLMO)
1.8 +{
1.9 + // Search branches
1.10 + TreeItem *ti;
1.11 + for (int i=0; i<branchCount(); ++i)
1.12 + {
1.13 + ti=getBranchNum(i)->findMapItem(p, excludeLMO);
1.14 + if (ti != NULL) return ti;
1.15 + }
1.16 +
1.17 +
1.18 + // Search myself
1.19 + if (getBranchObj()->isInClickBox (p) && (this != excludeLMO) && getBranchObj()->isVisibleObj() )
1.20 + return this;
1.21 +
1.22 +/* FIXME-2 // Search float images
1.23 + for (int i=0; i<floatimage.size(); ++i )
1.24 + if (floatimage.at(i)->isInClickBox(p) &&
1.25 + (floatimage.at(i) != excludeLMO) &&
1.26 + floatimage.at(i)->getParObj()!= excludeLMO &&
1.27 + floatimage.at(i)->isVisibleObj()
1.28 + ) return floatimage.at(i)->getTreeItem();
1.29 +*/
1.30 + return NULL;
1.31 +}
1.32 +
1.33 +TreeItem* BranchItem::findID (QString sid)
1.34 +{
1.35 + // Search branches
1.36 + TreeItem *ti;
1.37 + for (int i=0; i<branchCount(); ++i)
1.38 + {
1.39 + ti=getBranchNum(i)->findID (sid);
1.40 + if (ti != NULL) return ti;
1.41 + }
1.42 +
1.43 + // Search myself
1.44 + if (sid==objID) return this;
1.45 +
1.46 +
1.47 +/*
1.48 + // Search float images
1.49 + for (int i=0; i<floatimage.size(); ++i )
1.50 + if (floatimage.at(i)->inBox(p) &&
1.51 + (floatimage.at(i) != excludeLMO) &&
1.52 + floatimage.at(i)->getParObj()!= excludeLMO &&
1.53 + floatimage.at(i)->isVisibleObj()
1.54 + ) return floatimage.at(i);
1.55 +*/
1.56 + return NULL;
1.57 +}
1.58 +
1.59 +
1.60 BranchObj* BranchItem::getBranchObj() // FIXME-3 only for transition BO->BI
1.61 {
1.62 return (BranchObj*)lmo;
2.1 --- a/branchitem.h Tue Apr 07 16:15:53 2009 +0000
2.2 +++ b/branchitem.h Mon Apr 20 10:42:05 2009 +0000
2.3 @@ -34,9 +34,10 @@
2.4 virtual void tmpUnscroll(); // unscroll scrolled parents temporary e.g. during "find" process
2.5 virtual void resetTmpUnscroll(); // scroll all tmp scrolled parents again e.g. when unselecting
2.6
2.7 + TreeItem* findMapItem (QPointF,TreeItem*); //! search map for branches or images
2.8 + virtual TreeItem* findID (QString sid); //! search map for object with ID string
2.9 +
2.10 BranchObj* getBranchObj();
2.11 -
2.12 -
2.13 };
2.14
2.15 #endif
3.1 --- a/branchobj.cpp Tue Apr 07 16:15:53 2009 +0000
3.2 +++ b/branchobj.cpp Mon Apr 20 10:42:05 2009 +0000
3.3 @@ -424,58 +424,6 @@
3.4 }
3.5 }
3.6
3.7 -LinkableMapObj* BranchObj::findMapObj(QPointF p, LinkableMapObj* excludeLMO)
3.8 -{
3.9 - // Search branches
3.10 - LinkableMapObj *lmo;
3.11 - for (int i=0; i<treeItem->branchCount(); ++i)
3.12 - {
3.13 - lmo=treeItem->getBranchObjNum(i)->findMapObj(p, excludeLMO);
3.14 - if (lmo != NULL) return lmo;
3.15 - }
3.16 -
3.17 -
3.18 - // Search myself
3.19 - if (inBox (p,clickBox) && (this != excludeLMO) && isVisibleObj() )
3.20 - return this;
3.21 -
3.22 - // Search float images
3.23 - for (int i=0; i<floatimage.size(); ++i )
3.24 - if (inBox(p,floatimage.at(i)->getClickBox()) &&
3.25 - (floatimage.at(i) != excludeLMO) &&
3.26 - floatimage.at(i)->getParObj()!= excludeLMO &&
3.27 - floatimage.at(i)->isVisibleObj()
3.28 - ) return floatimage.at(i);
3.29 -
3.30 - return NULL;
3.31 -}
3.32 -
3.33 -LinkableMapObj* BranchObj::findID (QString sid)
3.34 -{
3.35 - // Search branches
3.36 - LinkableMapObj *lmo;
3.37 - for (int i=0; i<treeItem->branchCount(); ++i)
3.38 - {
3.39 - lmo=treeItem->getBranchObjNum(i)->findID (sid);
3.40 - if (lmo != NULL) return lmo;
3.41 - }
3.42 -
3.43 - // Search myself
3.44 - if (sid==objID) return this;
3.45 -
3.46 -
3.47 -/*
3.48 - // Search float images
3.49 - for (int i=0; i<floatimage.size(); ++i )
3.50 - if (floatimage.at(i)->inBox(p) &&
3.51 - (floatimage.at(i) != excludeLMO) &&
3.52 - floatimage.at(i)->getParObj()!= excludeLMO &&
3.53 - floatimage.at(i)->isVisibleObj()
3.54 - ) return floatimage.at(i);
3.55 -*/
3.56 - return NULL;
3.57 -}
3.58 -
3.59 void BranchObj::updateHeading()
3.60 {
3.61 if (!treeItem)
3.62 @@ -743,7 +691,6 @@
3.63 BranchObj* BranchObj::addBranch()
3.64 {
3.65 BranchObj* newbo=new BranchObj(scene,this);
3.66 - //FIXME-1 branch.append (newbo);
3.67 newbo->setParObj(this);
3.68 newbo->setDefAttr(NewBranch);
3.69 /* FIXME-2 treeItem not set yet!!!
4.1 --- a/branchobj.h Tue Apr 07 16:15:53 2009 +0000
4.2 +++ b/branchobj.h Mon Apr 20 10:42:05 2009 +0000
4.3 @@ -45,8 +45,7 @@
4.4 virtual void positionBBox();
4.5 virtual void calcBBoxSize();
4.6 virtual void setDockPos();
4.7 - virtual LinkableMapObj* findMapObj(QPointF,LinkableMapObj*); // find MapObj
4.8 - virtual LinkableMapObj* findID (QString sid); // find Obj by ID string
4.9 +
4.10 virtual void updateHeading ();
4.11
4.12 virtual QString saveToDir (const QString&,const QString&, const QPointF&);// Save data recursivly to tempdir
5.1 --- a/flagrowobj.cpp Tue Apr 07 16:15:53 2009 +0000
5.2 +++ b/flagrowobj.cpp Mon Apr 20 10:42:05 2009 +0000
5.3 @@ -110,9 +110,9 @@
5.4
5.5 QString FlagRowObj::getFlagName (const QPointF &p)
5.6 {
5.7 - if (!inBox (p,clickBox)) return "";
5.8 + if (!isInBox (p,clickBox)) return "";
5.9 for (int i=0; i<flag.size(); ++i)
5.10 - if (inBox (p,flag.at(i)->getClickBox ())) return flag.at(i)->getName();
5.11 + if (isInBox (p,flag.at(i)->getClickBox ())) return flag.at(i)->getName();
5.12 return "";
5.13
5.14
6.1 --- a/geometry.cpp Tue Apr 07 16:15:53 2009 +0000
6.2 +++ b/geometry.cpp Mon Apr 20 10:42:05 2009 +0000
6.3 @@ -37,7 +37,7 @@
6.4 return n;
6.5 }
6.6
6.7 -bool inBox(const QPointF &p, const QRectF &box)
6.8 +bool isInBox(const QPointF &p, const QRectF &box)
6.9 {
6.10 if (p.x() >= box.left() && p.x() <= box.right()
6.11 && p.y() <= box.bottom() && p.y() >= box.top() )
7.1 --- a/geometry.h Tue Apr 07 16:15:53 2009 +0000
7.2 +++ b/geometry.h Mon Apr 20 10:42:05 2009 +0000
7.3 @@ -6,7 +6,7 @@
7.4 #include <QPolygonF>
7.5
7.6 QRectF addBBox(QRectF r1, QRectF r2);
7.7 -bool inBox(const QPointF &p, const QRectF &box);
7.8 +bool isInBox(const QPointF &p, const QRectF &box);
7.9
7.10 QPointF normalize (const QPointF &p);
7.11
8.1 --- a/linkablemapobj.cpp Tue Apr 07 16:15:53 2009 +0000
8.2 +++ b/linkablemapobj.cpp Mon Apr 20 10:42:05 2009 +0000
8.3 @@ -60,7 +60,6 @@
8.4 model=NULL;
8.5
8.6 depth=-1;
8.7 - mapEditor=NULL;
8.8 childObj=NULL;
8.9 parObj=NULL;
8.10 parObjTmpBuf=NULL;
8.11 @@ -98,9 +97,6 @@
8.12 useRelPos=false;
8.13 useOrientation=true;
8.14
8.15 - // Reset ID
8.16 - objID="";
8.17 -
8.18 // Crossreference to treemodel
8.19 treeItem=NULL;
8.20 }
8.21 @@ -114,7 +110,6 @@
8.22 setLinkColor (other->linkcolor);
8.23 relPos=other->relPos;
8.24 useOrientation=other->useOrientation;
8.25 - objID=other->objID;
8.26 treeItem=other->treeItem;
8.27 }
8.28
8.29 @@ -146,7 +141,6 @@
8.30 void LinkableMapObj::setParObj(LinkableMapObj* o)
8.31 {
8.32 parObj=o;
8.33 - mapEditor=parObj->getMapEditor();
8.34 model=parObj->getModel();
8.35 }
8.36
8.37 @@ -334,16 +328,6 @@
8.38 return linkpos;
8.39 }
8.40
8.41 -void LinkableMapObj::setID (const QString &s)
8.42 -{
8.43 - objID=s;
8.44 -}
8.45 -
8.46 -QString LinkableMapObj::getID()
8.47 -{
8.48 - return objID;
8.49 -}
8.50 -
8.51 void LinkableMapObj::setLinkColor()
8.52 {
8.53 // Overloaded in BranchObj and children
8.54 @@ -580,7 +564,7 @@
8.55 return parObj;
8.56 }
8.57
8.58 -LinkableMapObj* LinkableMapObj::findObjBySelect (QString s) // FIXME-2 port to TreeItem...
8.59 +LinkableMapObj* LinkableMapObj::findObjBySelect (QString s) // FIXME-0 already in VM???
8.60 {
8.61 LinkableMapObj *lmo=this;
8.62 QString part;
8.63 @@ -642,17 +626,6 @@
8.64 return depth;
8.65 }
8.66
8.67 -void LinkableMapObj::setMapEditor (MapEditor *me)
8.68 -{
8.69 - mapEditor=me;
8.70 - model=mapEditor->getModel();
8.71 -}
8.72 -
8.73 -MapEditor* LinkableMapObj::getMapEditor ()
8.74 -{
8.75 - return mapEditor;
8.76 -}
8.77 -
8.78 QPointF LinkableMapObj::getRandPos()
8.79 {
8.80 // Choose a random position with given distance to parent:
9.1 --- a/linkablemapobj.h Tue Apr 07 16:15:53 2009 +0000
9.2 +++ b/linkablemapobj.h Mon Apr 20 10:42:05 2009 +0000
9.3 @@ -9,7 +9,6 @@
9.4
9.5 #define MAX_DEPTH 999
9.6
9.7 -class MapEditor;
9.8 class VymModel;
9.9
9.10
9.11 @@ -87,9 +86,6 @@
9.12 void setLinkPos (Position);
9.13 Position getLinkPos ();
9.14
9.15 - virtual void setID (const QString &s);
9.16 - virtual QString getID ();
9.17 -
9.18 virtual void setLinkColor(); // sets color according to colorhint, overloaded
9.19 virtual void setLinkColor(QColor);
9.20 QColor getLinkColor();
9.21 @@ -106,8 +102,6 @@
9.22 QPointF getParPos(); // returns pos where parents dock
9.23 Orientation getOrientation(); // get orientation
9.24 virtual int getDepth(); // return depth
9.25 - virtual void setMapEditor(MapEditor*); // set MapEditor (needed in LMO::updateNoteFlag) FIXME not needed
9.26 - virtual MapEditor* getMapEditor(); // get MapEditor (usually from parent); FIXME not needed
9.27 virtual QPointF getRandPos(); // make randomised position
9.28
9.29 virtual void reposition();
9.30 @@ -128,9 +122,6 @@
9.31 QPointF childPos;
9.32 QPointF parPos;
9.33 bool link2ParPos; // While moving around, sometimes link to parent
9.34 - MapEditor* mapEditor; // for and toggleScroll(), get default styles FIXME should not be needed with model available
9.35 - // and mapEditor->updateActions()
9.36 - // and mapEditor->updateSelection()
9.37
9.38 VymModel* model;
9.39 Orientation orientation;
9.40 @@ -168,8 +159,6 @@
9.41 bool useRelPos;
9.42 bool useOrientation;
9.43
9.44 - QString objID; // id set during load/save currently used for xLinks
9.45 -
9.46 TreeItem *treeItem; // Crossrefence to treemodel
9.47 };
9.48 #endif
10.1 --- a/mainwindow.cpp Tue Apr 07 16:15:53 2009 +0000
10.2 +++ b/mainwindow.cpp Mon Apr 20 10:42:05 2009 +0000
10.3 @@ -3465,27 +3465,19 @@
10.4 if (m) m->updateNoteFlag();
10.5 }
10.6
10.7 -/*
10.8 -void Main::updateNoteInEditor (VymModel *model, const NoteObj ¬e)
10.9 -{
10.10 - if (model&& model==currentModel() )
10.11 - {
10.12 - textEditor->setNote (note);
10.13 - }
10.14 -}
10.15 -*/
10.16 -
10.17 void Main::updateNoteEditor(QModelIndex index )
10.18 {
10.19 + TreeItem *ti=((VymModel*)sender())->getItem(index);
10.20 + /*
10.21 cout << "Main::updateNoteEditor model="<<sender();
10.22 - TreeItem *ti=((VymModel*)sender())->getItem(index);
10.23 - cout << " item="<<ti->getHeading().toStdString()<<" ("<<ti<<")"<<endl;
10.24 + cout << " item="<<ti->headingStd()<<" ("<<ti<<")"<<endl;
10.25 + */
10.26 textEditor->setNote (ti->getNoteObj() );
10.27 }
10.28
10.29 void Main::changeSelection (VymModel *model, const QItemSelection &newsel, const QItemSelection &oldsel)
10.30 {
10.31 - //branchPropertyWindow->setModel (model ); //FIXME-1 this used to be called from BranchObj::select()
10.32 + //branchPropertyWindow->setModel (model ); //FIXME-2 this used to be called from BranchObj::select()
10.33
10.34 if (model && model==currentModel() )
10.35 {
10.36 @@ -3507,9 +3499,7 @@
10.37 } else
10.38 textEditor->setNote(NoteObj() );
10.39 } else
10.40 - {
10.41 textEditor->setInactive();
10.42 - }
10.43
10.44 // Show URL and link in statusbar // FIXME-2
10.45 /*
10.46 @@ -3524,7 +3514,6 @@
10.47 // Update Toolbar // FIXME-1, was so far in BranchObj
10.48 //updateFlagsToolbar();
10.49
10.50 - // Update actions
10.51 updateActions();
10.52 }
10.53 }
11.1 --- a/mainwindow.h Tue Apr 07 16:15:53 2009 +0000
11.2 +++ b/mainwindow.h Mon Apr 20 10:42:05 2009 +0000
11.3 @@ -215,7 +215,6 @@
11.4 public slots:
11.5 void windowToggleSmoothPixmap();
11.6 void updateNoteFlag();
11.7 -// void updateNoteInEditor (VymModel *model, const NoteObj ¬e);
11.8 void updateNoteEditor (QModelIndex index);
11.9 void changeSelection (VymModel *model,const QItemSelection &newSel, const QItemSelection &delSel);
11.10
12.1 --- a/mapcenterobj.cpp Tue Apr 07 16:15:53 2009 +0000
12.2 +++ b/mapcenterobj.cpp Mon Apr 20 10:42:05 2009 +0000
12.3 @@ -3,8 +3,6 @@
12.4 #include "floatimageobj.h"
12.5 #include "geometry.h"
12.6 #include "mapcenterobj.h"
12.7 -#include "mapeditor.h"
12.8 -
12.9
12.10 /////////////////////////////////////////////////////////////////
12.11 // MapCenterObj
12.12 @@ -113,6 +111,7 @@
12.13
12.14 LinkableMapObj* MapCenterObj::findMapObj(QPointF p, LinkableMapObj *excludeLMO)
12.15 {
12.16 + /* FIXME-1 should not be necessary
12.17 LinkableMapObj *lmo;
12.18
12.19 // Search through child branches
12.20 @@ -129,6 +128,7 @@
12.21 if (inBox(p,floatimage.at(i)->getClickBox()) && (floatimage.at(i) != excludeLMO) && floatimage.at(i)->getParObj()!= excludeLMO) return floatimage.at(i);
12.22
12.23 // nothing found
12.24 + */
12.25 return NULL;
12.26 }
12.27
12.28 @@ -144,19 +144,21 @@
12.29 attribut("y2",QString().setNum(absPos.y()+height()-offset.y()));
12.30
12.31 // Providing an ID for a branch makes export to XHTML easier
12.32 + /* FIXME-3
12.33 QString idAttr;
12.34 if (treeItem->xlinkCount()>0)
12.35 idAttr=attribut ("id",mapEditor->getModel()->getSelectString(this)); //TODO directly access model
12.36
12.37 else
12.38 idAttr="";
12.39 + */
12.40
12.41 QString linkAttr=getLinkAttr();
12.42
12.43 s=beginElement ("mapcenter"
12.44 +getOrnXMLAttr()
12.45 +areaAttr
12.46 - +idAttr
12.47 +// +idAttr
12.48 +getIncludeImageAttr() );
12.49 incIndent();
12.50 if (heading->getColor()!=QColor("black"))
13.1 --- a/mapeditor.cpp Tue Apr 07 16:15:53 2009 +0000
13.2 +++ b/mapeditor.cpp Mon Apr 20 10:42:05 2009 +0000
13.3 @@ -279,6 +279,22 @@
13.4 }
13.5 }
13.6
13.7 +TreeItem* MapEditor::findMapItem (QPointF p,TreeItem *exclude)
13.8 +{
13.9 + // Start with mapcenter, no images allowed at rootItem
13.10 + int i=0;
13.11 + BranchItem *bi=model->getRootItem()->getFirstBranch();
13.12 + TreeItem *found=NULL;
13.13 + while (bi)
13.14 + {
13.15 + found=bi->findMapItem (p, exclude);
13.16 + if (found) return found;
13.17 + i++;
13.18 + bi=model->getRootItem()->getBranchNum(i);
13.19 + }
13.20 + return NULL;
13.21 +}
13.22 +
13.23 AttributeTable* MapEditor::attributeTable()
13.24 {
13.25 return attrTable;
13.26 @@ -405,7 +421,9 @@
13.27 // mouseEvent, we don't need to close here.
13.28
13.29 QPointF p = mapToScene(e->pos());
13.30 - LinkableMapObj* lmo=model->findMapObj(p, NULL);
13.31 + TreeItem *ti=findMapItem (p, NULL);
13.32 + LinkableMapObj* lmo=NULL;
13.33 + if (ti) lmo=ti->getLMO(); //FIXME-2 get rid of lmo...
13.34
13.35 if (lmo)
13.36 { // MapObj was found
13.37 @@ -487,7 +505,9 @@
13.38 }
13.39
13.40 QPointF p = mapToScene(e->pos());
13.41 - LinkableMapObj* lmo=model->findMapObj(p, NULL);
13.42 + TreeItem *ti=findMapItem (p, NULL);
13.43 + LinkableMapObj* lmo=NULL;
13.44 + if (ti) lmo=ti->getLMO(); //FIXME-2 get rid of lmo...
13.45
13.46 e->accept();
13.47
13.48 @@ -629,7 +649,10 @@
13.49 void MapEditor::mouseMoveEvent(QMouseEvent* e)
13.50 {
13.51 QPointF p = mapToScene(e->pos());
13.52 - LinkableMapObj *lmosel=model->getSelectedLMO();
13.53 + TreeItem *seli=model->getSelectedItem();
13.54 + LinkableMapObj* lmosel=NULL; //FIXME-2 get rid of lmosel
13.55 + if (seli)
13.56 + lmosel=seli->getLMO();
13.57
13.58 // Move the selected MapObj
13.59 if ( lmosel && movingObj)
13.60 @@ -649,7 +672,9 @@
13.61 // of selection back to absPos)
13.62
13.63 // Check if we could link
13.64 - LinkableMapObj* lmo=model->findMapObj(p, lmosel);
13.65 + TreeItem *dsti=findMapItem (p, seli);
13.66 + LinkableMapObj* dst=NULL;
13.67 + if (dsti) dst=dsti->getLMO(); //FIXME-2 get rid of lmo...
13.68
13.69
13.70 FloatObj *fio=model->getSelectedFloatImage();
13.71 @@ -662,15 +687,15 @@
13.72
13.73 // Relink float to new mapcenter or branch, if shift is pressed
13.74 // Only relink, if selection really has a new parent
13.75 - if ( (e->modifiers()==Qt::ShiftModifier) && lmo &&
13.76 - ( (typeid(*lmo)==typeid(BranchObj)) ||
13.77 - (typeid(*lmo)==typeid(MapCenterObj)) ) &&
13.78 - ( lmo != fio->getParObj())
13.79 + if ( (e->modifiers()==Qt::ShiftModifier) && dst &&
13.80 + ( (typeid(*dst)==typeid(BranchObj)) ||
13.81 + (typeid(*dst)==typeid(MapCenterObj)) ) &&
13.82 + ( dst != fio->getParObj())
13.83 )
13.84 {
13.85 if (typeid(*fio) == typeid(FloatImageObj) &&
13.86 - ( (typeid(*lmo)==typeid(BranchObj) ||
13.87 - typeid(*lmo)==typeid(MapCenterObj)) ))
13.88 + ( (typeid(*dst)==typeid(BranchObj) ||
13.89 + typeid(*dst)==typeid(MapCenterObj)) ))
13.90 {
13.91
13.92 // Also save the move which was done so far
13.93 @@ -685,7 +710,7 @@
13.94 fio->getParObj()->requestReposition();
13.95 model->reposition();
13.96
13.97 - model->linkFloatImageTo (model->getSelectString(lmo));
13.98 + model->linkFloatImageTo (model->getSelectString(dst));
13.99 //movingObj=lmosel;
13.100 //movingObj_orgRelPos=lmosel->getRelPos();
13.101
13.102 @@ -694,7 +719,7 @@
13.103 }
13.104 } else
13.105 { // selection != a FloatObj
13.106 - if (lmosel->getDepth()==0)
13.107 + if (lmosel->getDepth()==0) //FIXME-1 also moved mapcenters could be linked, but not working here...
13.108 {
13.109 // Move MapCenter
13.110 if (e->buttons()== Qt::LeftButton && e->modifiers()==Qt::ShiftModifier)
13.111 @@ -722,20 +747,17 @@
13.112 }
13.113
13.114 // Maybe we can relink temporary?
13.115 - if (lmo && (lmo!=lmosel) && model->getSelectedBranchObj() &&
13.116 - (typeid(*lmo)==typeid(BranchObj) ||
13.117 - typeid(*lmo)==typeid(MapCenterObj)) )
13.118 -
13.119 + if (dsti && (dst!=lmosel) && seli->isBranchLikeType() && dsti->isBranchLikeType() )
13.120 {
13.121 if (e->modifiers()==Qt::ControlModifier)
13.122 {
13.123 - // Special case: CTRL to link below lmo
13.124 - lmosel->setParObjTmp (lmo,p,+1);
13.125 + // Special case: CTRL to link below dst
13.126 + lmosel->setParObjTmp (dst,p,+1);
13.127 }
13.128 else if (e->modifiers()==Qt::ShiftModifier)
13.129 - lmosel->setParObjTmp (lmo,p,-1);
13.130 + lmosel->setParObjTmp (dst,p,-1);
13.131 else
13.132 - lmosel->setParObjTmp (lmo,p,0);
13.133 + lmosel->setParObjTmp (dst,p,0);
13.134 } else
13.135 {
13.136 lmosel->unsetParObjTmp();
13.137 @@ -775,16 +797,22 @@
13.138 void MapEditor::mouseReleaseEvent(QMouseEvent* e)
13.139 {
13.140 QPointF p = mapToScene(e->pos());
13.141 - LinkableMapObj *dst;
13.142 - LinkableMapObj *lmosel=model->getSelectedLMO();
13.143 + TreeItem *dsti=findMapItem(p, NULL);
13.144 + LinkableMapObj* dst=NULL;
13.145 + if (dsti) dst=dsti->getLMO(); //FIXME-2 get rid of dst...
13.146 +
13.147 + TreeItem *seli=model->getSelectedItem();
13.148 + LinkableMapObj *lmosel=seli->getLMO(); // FIXME-2 get rid of lmosel
13.149 +
13.150 +
13.151 +
13.152 // Have we been picking color?
13.153 if (pickingColor)
13.154 {
13.155 pickingColor=false;
13.156 setCursor (Qt::ArrowCursor);
13.157 // Check if we are over another branch
13.158 - dst=model->findMapObj(p, NULL);
13.159 - if (dst && lmosel)
13.160 + if (dsti && lmosel)
13.161 {
13.162 if (e->state() & Qt::ShiftModifier)
13.163 model->colorBranch (((BranchObj*)dst)->getColor());
13.164 @@ -799,8 +827,7 @@
13.165 {
13.166 drawingLink=false;
13.167 // Check if we are over another branch
13.168 - dst=model->findMapObj(p, NULL);
13.169 - if (dst && lmosel)
13.170 + if (dsti && lmosel && dsti->isBranchLikeType() )
13.171 {
13.172 tmpXLink->setEnd ( ((BranchObj*)(dst)) );
13.173 tmpXLink->updateXLink();
13.174 @@ -815,8 +842,13 @@
13.175 }
13.176
13.177 // Have we been moving something?
13.178 - if ( lmosel && movingObj )
13.179 + if ( seli && movingObj )
13.180 {
13.181 + if (dsti==seli)
13.182 + {
13.183 + dsti=NULL;
13.184 + dst=NULL;
13.185 + }
13.186 FloatImageObj *fo=model->getSelectedFloatImage();
13.187 if(fo)
13.188 {
13.189 @@ -836,10 +868,12 @@
13.190
13.191 // Check if we are over another branch, but ignore
13.192 // any found LMOs, which are FloatObjs
13.193 - dst=model->findMapObj(mapToScene(e->pos() ), lmosel);
13.194
13.195 - if (dst && (typeid(*dst)!=typeid(BranchObj) && typeid(*dst)!=typeid(MapCenterObj)))
13.196 + if (dsti && (!dsti->isBranchLikeType() ))
13.197 + {
13.198 dst=NULL;
13.199 + dsti=NULL;
13.200 + }
13.201
13.202 BranchItem *bi=model->getSelectedBranchItem();
13.203 if (bi && bi->depth()==0)
13.204 @@ -858,7 +892,7 @@
13.205 }
13.206 }
13.207
13.208 - if (model->selectionType() == TreeItem::Branch )
13.209 + if (seli->getType() == TreeItem::Branch )
13.210 { // A branch was moved
13.211
13.212 // save the position in case we link to mapcenter
13.213 @@ -871,7 +905,7 @@
13.214 QString preSelStr=model->getSelectString(lmosel);
13.215
13.216 copyingObj=false;
13.217 - if (dst )
13.218 + if (dsti )
13.219 {
13.220 // We have a destination, relink to that
13.221
13.222 @@ -923,6 +957,7 @@
13.223
13.224 if (lmosel->getDepth()==1)
13.225 {
13.226 + cout << "ME::releaseMouse d=1\n"; // FIXME_1 better use depth
13.227 // The select string might be different _after_ moving around.
13.228 // Therefor reposition and then use string of old selection, too
13.229 model->reposition();
13.230 @@ -979,10 +1014,10 @@
13.231 if (e->button() == Qt::LeftButton )
13.232 {
13.233 QPointF p = mapToScene(e->pos());
13.234 - LinkableMapObj *lmo=model->findMapObj(p, NULL);
13.235 - if (lmo) { // MapObj was found
13.236 + TreeItem *ti=findMapItem (p, NULL);
13.237 + if (ti) { // MapObj was found
13.238 // First select the MapObj than edit heading
13.239 - model->select (lmo);
13.240 + model->select (ti);
13.241 editHeading();
13.242 }
13.243 }
14.1 --- a/mapeditor.h Tue Apr 07 16:15:53 2009 +0000
14.2 +++ b/mapeditor.h Mon Apr 20 10:42:05 2009 +0000
14.3 @@ -26,8 +26,8 @@
14.4 void setAntiAlias (bool); //!< Set or unset antialiasing
14.5 void setSmoothPixmap(bool); //!< Set or unset smoothing of pixmaps
14.6 public:
14.7 - void toggleStandardFlag(QString);
14.8 -
14.9 + void toggleStandardFlag(QString); //FIXME-2 still needed?
14.10 + TreeItem *findMapItem (QPointF p,TreeItem *exclude); //! find item in map at position p. Ignore item exclude
14.11
14.12 AttributeTable* attributeTable();
14.13 void testFunction1(); // just testing new stuff
15.1 --- a/mapobj.cpp Tue Apr 07 16:15:53 2009 +0000
15.2 +++ b/mapobj.cpp Mon Apr 20 10:42:05 2009 +0000
15.3 @@ -1,3 +1,4 @@
15.4 +#include "geometry.h"
15.5 #include "mapobj.h"
15.6 #include "misc.h"
15.7
15.8 @@ -112,6 +113,10 @@
15.9 return clickBox;
15.10 }
15.11
15.12 +bool MapObj::isInClickBox (const QPointF &p)
15.13 +{
15.14 + return isInBox (p,clickBox);
15.15 +}
15.16
15.17 QSizeF MapObj::getSize()
15.18 {
16.1 --- a/mapobj.h Tue Apr 07 16:15:53 2009 +0000
16.2 +++ b/mapobj.h Mon Apr 20 10:42:05 2009 +0000
16.3 @@ -38,6 +38,7 @@
16.4 virtual void moveBy (double x,double y); // move to relative Position
16.5 virtual QRectF getBBox(); // returns bounding box
16.6 virtual QRectF getClickBox(); // returns box to click
16.7 + virtual bool isInClickBox (const QPointF &p); //! Checks if p is in clickBox
16.8 virtual QSizeF getSize(); // returns size of bounding box
16.9 virtual bool isVisibleObj();
16.10 virtual void setVisibility(bool);
17.1 --- a/treeitem.cpp Tue Apr 07 16:15:53 2009 +0000
17.2 +++ b/treeitem.cpp Mon Apr 20 10:42:05 2009 +0000
17.3 @@ -26,6 +26,11 @@
17.4 // isNoteInEditor=false;
17.5
17.6 hidden=false;
17.7 +
17.8 + // Reset ID
17.9 + objID="";
17.10 +
17.11 +
17.12 }
17.13
17.14 TreeItem::~TreeItem()
17.15 @@ -46,7 +51,8 @@
17.16 {
17.17 note.copy (other->note);
17.18 model=other->model;
17.19 - hideExport=other->hideExport;
17.20 + hideExport=officially
17.21 + other->hideExport;
17.22 }
17.23 */
17.24
17.25 @@ -269,6 +275,17 @@
17.26 }
17.27 }
17.28
17.29 +void TreeItem::setID (const QString &s)
17.30 +{
17.31 + objID=s;
17.32 +}
17.33 +
17.34 +QString TreeItem::getID()
17.35 +{
17.36 + return objID;
17.37 +}
17.38 +
17.39 +
17.40 TreeItem* TreeItem::getChildNum(const int &n)
17.41 {
17.42 if (n>=0 && n<childItems.count() )
17.43 @@ -317,6 +334,46 @@
17.44 parentItem->lastSelectedBranchNum=parentItem->childItems.indexOf(this);
17.45 }
17.46
17.47 +TreeItem* TreeItem::findBySelectString (const QString &s) //FIXME-1
17.48 +{
17.49 +/*
17.50 + LinkableMapObj *lmo=this;
17.51 + QString part;
17.52 + QString typ;
17.53 + QString num;
17.54 + while (!s.isEmpty() )
17.55 + {
17.56 + part=s.section(",",0,0);
17.57 + typ=part.left (3);
17.58 + num=part.right(part.length() - 3);
17.59 + if (typ=="mc:")
17.60 + {
17.61 + if (depth>0)
17.62 + return false; // in a subtree there is no center
17.63 + else
17.64 + break;
17.65 + } else
17.66 + if (typ=="bo:")
17.67 + lmo=lmo->getTreeItem()->getBranchObjNum (num.toInt());
17.68 + else
17.69 + if (typ=="fi:")
17.70 + lmo=((BranchObj*)lmo)->getFloatImageNum (num.toUInt());
17.71 + if (!lmo) break;
17.72 +
17.73 + if (s.contains(","))
17.74 + s=s.right(s.length() - part.length() -1 );
17.75 + else
17.76 + break;
17.77 + }
17.78 + */
17.79 + return NULL;
17.80 +}
17.81 +
17.82 +void TreeItem::setLastSelectedBranch(int i)
17.83 +{
17.84 + lastSelectedBranchNum=i;
17.85 +}
17.86 +
17.87 TreeItem* TreeItem::getLastSelectedBranch()
17.88 {
17.89 return getBranchNum (lastSelectedBranchNum);
18.1 --- a/treeitem.h Tue Apr 07 16:15:53 2009 +0000
18.2 +++ b/treeitem.h Mon Apr 20 10:42:05 2009 +0000
18.3 @@ -76,14 +76,22 @@
18.4 bool isBranchLikeType() const;
18.5 QString getTypeName ();
18.6
18.7 +protected:
18.8 + QString objID; //! id set during load/save currently used for xLinks
18.9 +public:
18.10 + virtual void setID (const QString &s);
18.11 + virtual QString getID ();
18.12 +
18.13 // Navigation and selection
18.14 TreeItem* getChildNum(const int &n);
18.15 BranchItem* getFirstBranch();
18.16 BranchItem* getLastBranch();
18.17 BranchItem* getBranchNum(const int &n);
18.18 BranchObj* getBranchObjNum(const int &n);
18.19 - void setLastSelectedBranch();
18.20 + void setLastSelectedBranch(); //! Set myself as last selected in parent
18.21 + void setLastSelectedBranch(int i); //! Set last selected branch directly
18.22 TreeItem* getLastSelectedBranch();
18.23 + TreeItem* findBySelectString (const QString &);
18.24
18.25 virtual void setHideTmp (HideTmpMode);
18.26 virtual bool hasHiddenExportParent ();
19.1 --- a/treemodel.cpp Tue Apr 07 16:15:53 2009 +0000
19.2 +++ b/treemodel.cpp Mon Apr 20 10:42:05 2009 +0000
19.3 @@ -208,6 +208,11 @@
19.4 return rootItem;
19.5 }
19.6
19.7 +TreeItem *TreeModel::getRootItem()
19.8 +{
19.9 + return rootItem;
19.10 +}
19.11 +
19.12 QModelIndex TreeModel::index (TreeItem* ti)
19.13 {
19.14 return createIndex (ti->row(),ti->column(),ti);
20.1 --- a/treemodel.h Tue Apr 07 16:15:53 2009 +0000
20.2 +++ b/treemodel.h Mon Apr 20 10:42:05 2009 +0000
20.3 @@ -36,8 +36,10 @@
20.4 const QModelIndex & parent = QModelIndex() );
20.5
20.6 TreeItem* getItem (const QModelIndex &index) const;
20.7 + TreeItem* getRootItem();
20.8 QModelIndex index (TreeItem* ti);
20.9
20.10 +
20.11 protected:
20.12 TreeItem *rootItem;
20.13 };
21.1 --- a/version.h Tue Apr 07 16:15:53 2009 +0000
21.2 +++ b/version.h Mon Apr 20 10:42:05 2009 +0000
21.3 @@ -7,7 +7,7 @@
21.4 #define __VYM_VERSION "1.13.0"
21.5 //#define __VYM_CODENAME "Codename: RC-1"
21.6 #define __VYM_CODENAME "Codename: development version"
21.7 -#define __VYM_BUILD_DATE "2009-04-07"
21.8 +#define __VYM_BUILD_DATE "2009-04-20"
21.9
21.10
21.11 bool checkVersion(const QString &);
22.1 --- a/vymmodel.cpp Tue Apr 07 16:15:53 2009 +0000
22.2 +++ b/vymmodel.cpp Mon Apr 20 10:42:05 2009 +0000
22.3 @@ -72,11 +72,7 @@
22.4 {
22.5 selModel->clearSelection();
22.6
22.7 - // Remove stuff
22.8 - while (!mapCenters.isEmpty()) // FIXME-2 VM needs to be in treemodel only...
22.9 - delete mapCenters.takeFirst();
22.10 -
22.11 - QModelIndex ri=index(rootItem);
22.12 + //QModelIndex ri=index(rootItem);
22.13 //removeRows (0, rowCount(ri),ri); // FIXME-2 here should be at least a beginRemoveRows...
22.14 }
22.15
22.16 @@ -273,12 +269,12 @@
22.17 return s;
22.18 }
22.19
22.20 -QString VymModel::saveTreeToDir (const QString &tmpdir,const QString &prefix, int verbose, const QPointF &offset)
22.21 +QString VymModel::saveTreeToDir (const QString &tmpdir,const QString &prefix, int verbose, const QPointF &offset) // FIXME-4 verbose not needed (used to write icons)
22.22 {
22.23 QString s;
22.24
22.25 - for (int i=0; i<mapCenters.count(); i++)
22.26 - s+=mapCenters.at(i)->saveToDir (tmpdir,prefix,verbose,offset);
22.27 + for (int i=0; i<rootItem->branchCount(); i++) // FIXME-0 remove mapCenters
22.28 + s+=((MapCenterItem*)rootItem->getBranchNum(i))->saveToDir (tmpdir,prefix,offset);
22.29 return s;
22.30 }
22.31
22.32 @@ -1405,21 +1401,8 @@
22.33 return mapScene;
22.34 }
22.35
22.36 -LinkableMapObj* VymModel::findMapObj(QPointF p, LinkableMapObj *excludeLMO)
22.37 -{
22.38 - LinkableMapObj *lmo;
22.39 -
22.40 - for (int i=0;i<mapCenters.count(); i++)
22.41 - {
22.42 - lmo=mapCenters.at(i)->findMapObj (p,excludeLMO);
22.43 - if (lmo) return lmo;
22.44 - }
22.45 - return NULL;
22.46 -}
22.47 -
22.48 -LinkableMapObj* VymModel::findObjBySelect(const QString &s)
22.49 -{
22.50 - LinkableMapObj *lmo;
22.51 +TreeItem* VymModel::findBySelectString(const QString &s)
22.52 +{
22.53 if (!s.isEmpty() )
22.54 {
22.55 QString part;
22.56 @@ -1428,25 +1411,26 @@
22.57 part=s.section(",",0,0);
22.58 typ=part.left (2);
22.59 num=part.right(part.length() - 3);
22.60 - if (typ=="mc" && num.toInt()>=0 && num.toInt() <mapCenters.count() )
22.61 - return mapCenters.at(num.toInt() );
22.62 + if (typ=="mc" && num.toInt()>=0 && num.toInt() <rootItem->branchCount() )
22.63 + return rootItem->getBranchNum (num.toInt() );
22.64 }
22.65
22.66 - for (int i=0; i<mapCenters.count(); i++)
22.67 + TreeItem *ti;
22.68 + for (int i=0; i<rootItem->branchCount(); i++)
22.69 {
22.70 - lmo=mapCenters.at(i)->findObjBySelect(s);
22.71 - if (lmo) return lmo;
22.72 + ti=rootItem->getBranchNum(i)->findBySelectString(s);
22.73 + if (ti) return ti;
22.74 }
22.75 return NULL;
22.76 }
22.77
22.78 -LinkableMapObj* VymModel::findID (const QString &s)
22.79 -{
22.80 - LinkableMapObj *lmo;
22.81 - for (int i=0; i<mapCenters.count(); i++)
22.82 +TreeItem* VymModel::findID (const QString &s)
22.83 +{
22.84 + TreeItem *ti;
22.85 + for (int i=0; i<rootItem->branchCount(); i++)
22.86 {
22.87 - lmo=mapCenters.at(i)->findID (s);
22.88 - if (lmo) return lmo;
22.89 + ti=rootItem->getBranchNum(i)->findID (s);
22.90 + if (ti) return ti;
22.91 }
22.92 return NULL;
22.93 }
22.94 @@ -1466,7 +1450,6 @@
22.95 QString ("setMapAuthor (\"%1\")").arg(s),
22.96 QString ("Set author of map to \"%1\"").arg(s)
22.97 );
22.98 -
22.99 author=s;
22.100 }
22.101
22.102 @@ -1482,7 +1465,6 @@
22.103 QString ("setMapComment (\"%1\")").arg(s),
22.104 QString ("Set comment of map")
22.105 );
22.106 -
22.107 comment=s;
22.108 }
22.109
22.110 @@ -1509,7 +1491,6 @@
22.111 next(cur,prev,d);
22.112 }
22.113 return c;
22.114 -
22.115 }
22.116
22.117 void VymModel::setHeading(const QString &s)
22.118 @@ -1600,8 +1581,6 @@
22.119 EOFind=false;
22.120 }
22.121
22.122 -
22.123 -
22.124 void VymModel::setScene (QGraphicsScene *s)
22.125 {
22.126 mapScene=s; // FIXME-2 VM should not be necessary anymore, move all occurences to MapEditor
22.127 @@ -1662,26 +1641,25 @@
22.128 */
22.129 }
22.130
22.131 -void VymModel::linkFloatImageTo(const QString &dstString)
22.132 +void VymModel::linkFloatImageTo(const QString &dstString) // FIXME-2
22.133 {
22.134 FloatImageObj *fio=selection.getFloatImage();
22.135 if (fio)
22.136 {
22.137 - BranchObj *dst=(BranchObj*)findObjBySelect(dstString);
22.138 - if (dst && (typeid(*dst)==typeid (BranchObj) ||
22.139 - typeid(*dst)==typeid (MapCenterObj)))
22.140 + TreeItem *dst=findBySelectString (dstString);
22.141 + if (dst && dst->isBranchLikeType() )
22.142 {
22.143 - LinkableMapObj *dstPar=dst->getParObj();
22.144 + TreeItem *dstPar=dst->parent();
22.145 QString parString=getSelectString(dstPar);
22.146 QString fioPreSelectString=getSelectString(fio);
22.147 QString fioPreParentSelectString=getSelectString (fio->getParObj());
22.148 - ((BranchObj*)dst)->addFloatImage (fio);
22.149 - selection.unselect();
22.150 - ((BranchObj*)(fio->getParObj()))->removeFloatImage (fio);
22.151 + // FIXME-2 ((BranchObj*)dst)->addFloatImage (fio);
22.152 + unselect();
22.153 + // ((BranchObj*)(fio->getParObj()))->removeFloatImage (fio);
22.154 fio=((BranchObj*)dst)->getLastFloatImage();
22.155 fio->setRelPos();
22.156 fio->reposition();
22.157 - selection.select(fio);
22.158 + // select (fio);
22.159 saveState(
22.160 getSelectString(fio),
22.161 QString("linkTo (\"%1\")").arg(fioPreParentSelectString),
22.162 @@ -2105,14 +2083,13 @@
22.163
22.164 // Create MapObj
22.165 MapCenterObj *mapCenter = new MapCenterObj(mapScene,this);
22.166 - mapCenter->setMapEditor(mapEditor); //FIXME-3 VM needed to get defLinkStyle, mapLinkColorHint ... for later added objects
22.167 + //mapCenter->setMapEditor(mapEditor); //FIXME-3 VM needed to get defLinkStyle, mapLinkColorHint ... for later added objects
22.168 mapCenter->setTreeItem (mci); // TreeItem needs to exist before setVisibility
22.169 mci->setLMO (mapCenter);
22.170 mapCenter->updateHeading();
22.171 mapCenter->move (absPos);
22.172 mapCenter->setVisibility (true);
22.173 //mapCenter->setHeading (QApplication::translate("Heading of mapcenter in new map", "New map"));
22.174 - mapCenters.append(mapCenter); //FIXME-1 get rid of mapCenters...
22.175 // Testing
22.176 /*
22.177 qWarning ("MW::insertRow a");
22.178 @@ -2134,19 +2111,15 @@
22.179 {
22.180 mapCenters.removeAt (i);
22.181 delete (mco);
22.182 - if (i>0) return mapCenters.at(i-1); // Return previous MCO
22.183 + if (i>0) return rootItem->getBranchNum(i-1); // Return previous MCO
22.184 }
22.185 */
22.186 return NULL;
22.187 }
22.188
22.189 -MapCenterObj* VymModel::getLastMapCenter()
22.190 -{
22.191 - if (mapCenters.size()>0)
22.192 - return mapCenters.last();
22.193 - else
22.194 - return NULL;
22.195 -
22.196 +MapCenterObj* VymModel::getLastMapCenter() // FIXME-3 still needed?
22.197 +{
22.198 + return (MapCenterObj*)rootItem->getLastBranch();
22.199 }
22.200
22.201
22.202 @@ -3942,8 +3915,10 @@
22.203 void VymModel::registerEditor(QWidget *me)
22.204 {
22.205 mapEditor=(MapEditor*)me;
22.206 - for (int i=0; i<mapCenters.count(); i++)
22.207 - mapCenters.at(i)->setMapEditor(mapEditor);
22.208 + /* FIXME-3
22.209 + for (int i=0; i<rootItem->branchCount(); i++)
22.210 + rootItem->getBranchNum(i)->setMapEditor(mapEditor);
22.211 + */
22.212 }
22.213
22.214 void VymModel::unregisterEditor(QWidget *)
22.215 @@ -3975,16 +3950,18 @@
22.216 */
22.217 }
22.218
22.219 -void VymModel::updateRelPositions()
22.220 -{
22.221 - for (int i=0; i<mapCenters.count(); i++)
22.222 - mapCenters.at(i)->updateRelPositions();
22.223 +void VymModel::updateRelPositions() //FIXME-2 VM should have no need to updateRelPos
22.224 +{
22.225 + cout << "VM::updateRelPos...\n";
22.226 + for (int i=0; i<rootItem->branchCount(); i++)
22.227 + ((MapCenterObj*)rootItem->getBranchObjNum(i))->updateRelPositions();
22.228 }
22.229
22.230 -void VymModel::reposition() //FIXME-2 get rid of mapCenters...
22.231 -{
22.232 - for (int i=0;i<mapCenters.count(); i++)
22.233 - mapCenters.at(i)->reposition(); // for positioning heading
22.234 +void VymModel::reposition() //FIXME-2 VM should have no need to reposition, this is done in views???
22.235 +{
22.236 + cout << "VM::reposition ...\n";
22.237 + for (int i=0;i<rootItem->branchCount(); i++)
22.238 + rootItem->getBranchObjNum(i)->reposition(); // for positioning heading
22.239 }
22.240
22.241 QPolygonF VymModel::shape(BranchObj *bo)
22.242 @@ -4028,18 +4005,18 @@
22.243 // Move all branches and MapCenters away from lmo
22.244 // to avoid collisions
22.245
22.246 + /*
22.247 QPolygonF pA;
22.248 QPolygonF pB;
22.249
22.250 BranchObj *boA=(BranchObj*)lmo;
22.251 BranchObj *boB;
22.252 - for (int i=0; i<mapCenters.count(); i++)
22.253 + for (int i=0; i<rootItem->branchCount(); i++)
22.254 {
22.255 - boB=mapCenters.at(i);
22.256 + boB=rootItem->getBranchNum(i);
22.257 pA=shape (boA);
22.258 pB=shape (boB);
22.259 PolygonCollisionResult r = PolygonCollision(pA, pB, QPoint(0,0));
22.260 - /*
22.261 cout <<"------->"
22.262 <<"="<<r.intersect
22.263 <<" ("<<qPrintable(boA->getHeading() )<<")"
22.264 @@ -4047,8 +4024,8 @@
22.265 <<") willIntersect"
22.266 <<r.willIntersect
22.267 <<" minT="<<r.minTranslation<<endl<<endl;
22.268 + }
22.269 */
22.270 - }
22.271 }
22.272
22.273 QPixmap VymModel::getPixmap()
22.274 @@ -4603,11 +4580,13 @@
22.275 }
22.276
22.277
22.278 -QRectF VymModel::getTotalBBox()
22.279 +QRectF VymModel::getTotalBBox() //FIXME-2
22.280 {
22.281 QRectF r;
22.282 - for (int i=0;i<mapCenters.count(); i++)
22.283 - r=addBBox (mapCenters.at(i)->getTotalBBox(), r);
22.284 +/*
22.285 + for (int i=0;i<rootItem->branchCount(); i++)
22.286 + r=addBBox (rootItem->getBranchNum(i)->getTotalBBox(), r);
22.287 +*/
22.288 return r;
22.289 }
22.290
22.291 @@ -4648,13 +4627,11 @@
22.292
22.293 bool VymModel::select (const QString &s)
22.294 {
22.295 - LinkableMapObj *lmo=findObjBySelect(s);
22.296 -
22.297 - // Finally select the found object
22.298 - if (lmo)
22.299 + TreeItem *ti=findBySelectString(s);
22.300 + if (ti)
22.301 {
22.302 unselect();
22.303 - select (lmo);
22.304 + select (ti);
22.305 return true;
22.306 }
22.307 return false;
22.308 @@ -4677,7 +4654,6 @@
22.309 QModelIndex ix=index(ti);
22.310 selModel->select (ix,QItemSelectionModel::ClearAndSelect );
22.311 ti->setLastSelectedBranch();
22.312 - //updateSelection(oldsel); //FIXME-3 needed?
22.313 return true;
22.314 }
22.315 return false;
22.316 @@ -4960,12 +4936,12 @@
22.317 // left of center
22.318 if (type == TreeItem::Branch )
22.319 {
22.320 + cout << "VM::selLeft\n";
22.321 selectLastSelectedBranch();
22.322 return;
22.323 }
22.324 }
22.325 }
22.326 - updateSelection (oldsel);
22.327 }
22.328 }
22.329
22.330 @@ -5001,12 +4977,12 @@
22.331 if (type == TreeItem::Branch ||
22.332 type == TreeItem::Image)
22.333 {
22.334 + cout << "VM::selRight\n";
22.335 QModelIndex ix=index(selbi->parent());
22.336 selModel->select (ix,QItemSelectionModel::ClearAndSelect );
22.337 }
22.338 }
22.339 }
22.340 - updateSelection (oldsel);
22.341 }
22.342 }
22.343
23.1 --- a/vymmodel.h Tue Apr 07 16:15:53 2009 +0000
23.2 +++ b/vymmodel.h Mon Apr 20 10:42:05 2009 +0000
23.3 @@ -14,6 +14,7 @@
23.4
23.5 class BranchItem;
23.6 class MapCenterItem;
23.7 +class MapEditor;
23.8
23.9 class VymModel : public TreeModel {
23.10 Q_OBJECT
23.11 @@ -23,7 +24,6 @@
23.12 ////////////////////////////////////////////
23.13 private:
23.14 QGraphicsScene *mapScene;
23.15 - QList <MapCenterObj*> mapCenters;
23.16 QString version; //!< version string saved in vym file
23.17 QString author;
23.18 QString comment;
23.19 @@ -36,7 +36,7 @@
23.20 void init();
23.21 void makeTmpDirectories(); //!< create temporary directories e.g. for history
23.22
23.23 - MapEditor* getMapEditor(); // FIXME not necessary
23.24 + MapEditor* getMapEditor(); // FIXME-2 still necessary?
23.25
23.26 bool isRepositionBlocked(); //!< While load or undo there is no need to update graphicsview
23.27
23.28 @@ -220,9 +220,8 @@
23.29 void setScene(QGraphicsScene *s);
23.30 QGraphicsScene *getScene();
23.31
23.32 - LinkableMapObj* findMapObj(QPointF,LinkableMapObj*); // find MapObj
23.33 - LinkableMapObj* findObjBySelect (const QString &s); // find MapObj by select string
23.34 - LinkableMapObj* findID (const QString &s); // find MapObj by previously set ID
23.35 + TreeItem* findBySelectString (const QString &s);
23.36 + TreeItem* findID (const QString &s); // find MapObj by previously set ID
23.37
23.38
23.39 ////////////////////////////////////////////
23.40 @@ -555,7 +554,7 @@
23.41
23.42 void ensureSelectionVisible(); //!< Show selection in all views
23.43
23.44 -// void selectInt(LinkableMapObj*);
23.45 +// void selectInt(LinkableMapObj*); //FIXME-4
23.46
23.47 private:
23.48 void selectNextBranchInt(); // Increment number of branch
24.1 --- a/xml-vym.cpp Tue Apr 07 16:15:53 2009 +0000
24.2 +++ b/xml-vym.cpp Mon Apr 20 10:42:05 2009 +0000
24.3 @@ -287,6 +287,7 @@
24.4 case StateBranch:
24.5 model->selectParent();
24.6 lastBranchItem=model->getSelectedBranchItem();
24.7 + lastBranchItem->setLastSelectedBranch (0); // Reset last selected to first child branch
24.8 break;
24.9 case StateHtml:
24.10 htmldata+="</"+eName+">";
24.11 @@ -441,7 +442,7 @@
24.12 }
24.13 }
24.14 if (!a.value( "id").isEmpty() )
24.15 - lastOO->setID (a.value ("id"));
24.16 + lastBranchItem->setID (a.value ("id"));
24.17 if (!a.value( "url").isEmpty() )
24.18 lastOO->setURL (a.value ("url"));
24.19 if (!a.value( "vymLink").isEmpty() )
24.20 @@ -582,22 +583,25 @@
24.21 {
24.22 if (!a.value( "endBranch").isEmpty() )
24.23 {
24.24 - LinkableMapObj *lmo=model->findObjBySelect (a.value( "beginBranch"));
24.25 - if (lmo && typeid (*lmo)==typeid (BranchObj))
24.26 + TreeItem *ti=model->findBySelectString (a.value( "beginBranch"));
24.27 + if (ti && ti->isBranchLikeType())
24.28 {
24.29 + /* FIXME-2 xLinks
24.30 xlo->setBegin ((BranchObj*)lmo);
24.31 - lmo=model->findObjBySelect (a.value( "endBranch"));
24.32 + lmo=model->findBySelectString (a.value( "endBranch"));
24.33 if (lmo && typeid (*lmo)==typeid (BranchObj))
24.34 {
24.35 xlo->setEnd ((BranchObj*)(lmo));
24.36 xlo->activate();
24.37 success=true;
24.38 }
24.39 + */
24.40 }
24.41 }
24.42 }
24.43
24.44 // object ID is used starting in version 1.8.76
24.45 + /* FIXME-2 xLinks
24.46 if (!a.value( "beginID").isEmpty() )
24.47 {
24.48 if (!a.value( "endID").isEmpty() )
24.49 @@ -616,6 +620,7 @@
24.50 }
24.51 }
24.52 }
24.53 + */
24.54 if (!success) delete (xlo);
24.55 return true; // xLinks can only be established at the "end branch", return true
24.56 }