1.1 --- a/branchitem.cpp Tue May 26 11:24:51 2009 +0000
1.2 +++ b/branchitem.cpp Wed Jun 03 20:37:17 2009 +0000
1.3 @@ -61,22 +61,24 @@
1.4 else
1.5 scrolledAttr="";
1.6
1.7 - /*
1.8 - // save area, if not scrolled // FIXME-3 not needed if HTML is rewritten...
1.9 + // save area, if not scrolled // FIXME-5 not needed if HTML is rewritten...
1.10 // also we should check if _any_ of parents is scrolled
1.11 QString areaAttr;
1.12 - if (!((BranchObj*)(parObj))->isScrolled() )
1.13 + if (lmo && parentItem->isBranchLikeType() && !((BranchItem*)parentItem)->isScrolled() )
1.14 {
1.15 + qreal x=lmo->getAbsPos().x();
1.16 + qreal y=lmo->getAbsPos().y();
1.17 areaAttr=
1.18 - attribut("x1",QString().setNum(absPos.x()-offset.x())) +
1.19 - attribut("y1",QString().setNum(absPos.y()-offset.y())) +
1.20 - attribut("x2",QString().setNum(absPos.x()+width()-offset.x())) +
1.21 - attribut("y2",QString().setNum(absPos.y()+height()-offset.y()));
1.22 + attribut("x1",QString().setNum(x-offset.x())) +
1.23 + attribut("y1",QString().setNum(y-offset.y())) +
1.24 + attribut("x2",QString().setNum(x+lmo->width()-offset.x())) +
1.25 + attribut("y2",QString().setNum(y+lmo->height()-offset.y()));
1.26
1.27 } else
1.28 areaAttr="";
1.29
1.30 - // Providing an ID for a branch makes export to XHTML easier
1.31 + /*
1.32 + // FIXME-3 Providing an ID for a branch makes export to XHTML easier
1.33 QString idAttr;
1.34 if (countXLinks()>0)
1.35 idAttr=attribut ("id",model->getSelectString(this)); //TODO directly access model
1.36 @@ -104,8 +106,8 @@
1.37 s+=valueElement("heading", getHeading(),
1.38 attribut ("textColor",QColor( bo->getColor()).name()));
1.39
1.40 -/*
1.41 - // Save frame
1.42 +/*
1.43 + // Save frame //FIXME-2
1.44 if (frame->getFrameType()!=FrameObj::NoFrame)
1.45 s+=frame->saveToDir ();
1.46 */
1.47 @@ -255,7 +257,7 @@
1.48 if (this !=start && scrolled) return true;
1.49
1.50 BranchItem* bi=(BranchItem*)parentItem;
1.51 - if (bi)
1.52 + if (bi && bi->isBranchLikeType() )
1.53 return bi->hasScrolledParent(start);
1.54 else
1.55 return false;
1.56 @@ -264,30 +266,32 @@
1.57 void BranchItem::tmpUnscroll()
1.58 {
1.59 // Unscroll parent (recursivly)
1.60 - BranchItem * bi=(BranchItem*)parentItem;
1.61 - if (bi) bi->tmpUnscroll();
1.62 + BranchItem * pi=(BranchItem*)parentItem;
1.63 + if (pi && pi->isBranchLikeType() ) pi->tmpUnscroll();
1.64
1.65 // Unscroll myself
1.66 if (scrolled)
1.67 {
1.68 tmpUnscrolled=true;
1.69 - // FIXME-1 systemFlags->activate("tmpUnscrolledright");
1.70 + systemFlags.activate("system-tmpUnscrolledRight");
1.71 toggleScroll();
1.72 + model->emitDataHasChanged (this);
1.73 }
1.74 }
1.75
1.76 void BranchItem::resetTmpUnscroll()
1.77 {
1.78 // Unscroll parent (recursivly)
1.79 - BranchItem * bi=(BranchItem*)parentItem;
1.80 - if (bi) bi->resetTmpUnscroll();
1.81 + BranchItem * pi=(BranchItem*)parentItem;
1.82 + if (pi && pi->isBranchLikeType() ) pi->resetTmpUnscroll();
1.83
1.84 // Unscroll myself
1.85 if (tmpUnscrolled)
1.86 {
1.87 tmpUnscrolled=false;
1.88 - // FIXME-1 systemFlags->deactivate("tmpUnscrolledright");
1.89 + systemFlags.deactivate("system-tmpUnscrolledRight");
1.90 toggleScroll();
1.91 + model->emitDataHasChanged (this);
1.92 }
1.93 }
1.94
1.95 @@ -361,51 +365,29 @@
1.96 BranchObj* BranchItem::createMapObj(QGraphicsScene *scene)
1.97 {
1.98 BranchObj *newbo;
1.99 - cout << "BI::createMO "<<getHeadingStd()<<" pI="<<parentItem<<" rI="<<rootItem<<endl;
1.100 + newbo=new BranchObj(scene);
1.101 + newbo->setTreeItem (this);
1.102 + lmo=newbo;
1.103 +
1.104 if (parentItem==rootItem)
1.105 {
1.106 - // Initialize MapCenterObj, order of things is important...
1.107 - cout << "BI::createMO (MCO) "<<getHeadingStd()<<endl;
1.108 - MapCenterObj* mco=new MapCenterObj(scene);
1.109 - newbo=mco;
1.110 - lmo=mco;
1.111 newbo->setParObj(NULL);
1.112 - newbo->setTreeItem (this);
1.113 - newbo->setDefAttr(BranchObj::NewBranch);
1.114 + newbo->setFrameType (FrameObj::Rectangle);
1.115 } else
1.116 {
1.117 - // Initialize BranchObj, order of things is important...
1.118 - cout << "BI::createMO (BO) "<<getHeadingStd()<<endl;
1.119 - newbo=new BranchObj(scene);
1.120 - lmo=newbo;
1.121 - BranchObj* parbo=(BranchObj*)(parentItem->getLMO());
1.122 - newbo->setParObj(parbo);
1.123 - newbo->setTreeItem (this);
1.124 - newbo->setDefAttr(BranchObj::NewBranch);
1.125 -
1.126 - if (parentItem->isBranchLikeType())
1.127 - {
1.128 - // Set visibility depending on parents
1.129 - if (((BranchItem*)parentItem)->scrolled || !parbo->isVisibleObj() )
1.130 - {
1.131 - if (parentItem && parentItem->isBranchLikeType())
1.132 - cout <<" scrolled="<<((BranchItem*)parentItem)->scrolled<<endl;
1.133 - if (parbo)
1.134 - cout <<" par->vis="<<parbo->isVisibleObj()<<endl;
1.135 - newbo->setVisibility (false);
1.136 - }
1.137 - } else
1.138 - cout <<" pI=no branch!\n";
1.139 -
1.140 + newbo->setParObj(parentItem->getLMO() );
1.141 + // Set visibility depending on parents
1.142 + if (((BranchItem*)parentItem)->scrolled || !parentItem->getLMO()->isVisibleObj() )
1.143 + newbo->setVisibility (false);
1.144 }
1.145 + newbo->setDefAttr(BranchObj::NewBranch);
1.146 initLMO();
1.147
1.148 if (!getHeading().isEmpty() )
1.149 {
1.150 - ((BranchObj*)lmo)->updateData(); //FIXME-3 maybe better model->emitDataHasChanged()?
1.151 - ((BranchObj*)lmo)->setColor (headingColor);
1.152 + newbo->updateData(); //FIXME-3 maybe better model->emitDataHasChanged()?
1.153 + newbo->setColor (headingColor);
1.154 }
1.155 -
1.156
1.157 //newbo->updateLink(); //FIXME-3
1.158
2.1 --- a/branchobj.cpp Tue May 26 11:24:51 2009 +0000
2.2 +++ b/branchobj.cpp Wed Jun 03 20:37:17 2009 +0000
2.3 @@ -130,13 +130,14 @@
2.4 // m is position of mouse pointer
2.5 // offset 0: default 1: below lmo -1 above lmo (if possible)
2.6
2.7 -
2.8 + BranchItem *pi=(BranchItem*)(lmo->getTreeItem()->parent());
2.9 + int pi_depth=pi->depth();
2.10 BranchObj* o=(BranchObj*)(lmo);
2.11 if (!parObjTmpBuf)
2.12 parObjTmpBuf=parObj;
2.13
2.14 // ignore mapcenter and mainbranch
2.15 - if (treeItem->depth()<2) off=0;
2.16 + if (pi_depth<2) off=0;
2.17 if (off==0)
2.18 link2ParPos=false;
2.19 else
2.20 @@ -385,24 +386,36 @@
2.21
2.22 void BranchObj::setDockPos()
2.23 {
2.24 - // Sets childpos and parpos depending on orientation
2.25 - if (getOrientation()==LinkableMapObj::LeftOfCenter )
2.26 - {
2.27 - childPos=QPointF (
2.28 - ornamentsBBox.bottomLeft().x(),
2.29 - bottomlineY);
2.30 - parPos=QPointF (
2.31 - ornamentsBBox.bottomRight().x(),
2.32 - bottomlineY);
2.33 - } else
2.34 - {
2.35 - childPos=QPointF (
2.36 - ornamentsBBox.bottomRight().x(),
2.37 - bottomlineY);
2.38 - parPos=QPointF (
2.39 - ornamentsBBox.bottomLeft().x(),
2.40 - bottomlineY);
2.41 - }
2.42 + if (treeItem->getType()==TreeItem::MapCenter)
2.43 + {
2.44 + // set childPos to middle of MapCenterObj
2.45 + childPos.setX( clickBox.topLeft().x() + clickBox.width()/2 );
2.46 + childPos.setY( clickBox.topLeft().y() + clickBox.height()/2 );
2.47 + parPos=childPos;
2.48 + for (int i=0; i<treeItem->branchCount(); ++i)
2.49 + treeItem->getBranchObjNum(i)->updateLink();
2.50 +
2.51 + } else
2.52 + {
2.53 + // Sets childpos and parpos depending on orientation
2.54 + if (getOrientation()==LinkableMapObj::LeftOfCenter )
2.55 + {
2.56 + childPos=QPointF (
2.57 + ornamentsBBox.bottomLeft().x(),
2.58 + bottomlineY);
2.59 + parPos=QPointF (
2.60 + ornamentsBBox.bottomRight().x(),
2.61 + bottomlineY);
2.62 + } else
2.63 + {
2.64 + childPos=QPointF (
2.65 + ornamentsBBox.bottomRight().x(),
2.66 + bottomlineY);
2.67 + parPos=QPointF (
2.68 + ornamentsBBox.bottomLeft().x(),
2.69 + bottomlineY);
2.70 + }
2.71 + }
2.72 }
2.73
2.74 void BranchObj::updateData()
3.1 Binary file demos/vym-projectplan.vym has changed
4.1 --- a/editxlinkdialog.ui Tue May 26 11:24:51 2009 +0000
4.2 +++ b/editxlinkdialog.ui Wed Jun 03 20:37:17 2009 +0000
4.3 @@ -234,7 +234,6 @@
4.4 <pixmapfunction>qPixmapFromMimeSource</pixmapfunction>
4.5 <includes>
4.6 <include location="local" >xlinkobj.h</include>
4.7 - <include location="local" >mapcenterobj.h</include>
4.8 <include location="local" >linkablemapobj.h</include>
4.9 </includes>
4.10 <resources/>
5.1 --- a/exports.h Tue May 26 11:24:51 2009 +0000
5.2 +++ b/exports.h Wed Jun 03 20:37:17 2009 +0000
5.3 @@ -5,7 +5,6 @@
5.4 #include <qstring.h>
5.5 #include <iostream>
5.6
5.7 -#include "mapcenterobj.h"
5.8 #include "settings.h"
5.9 #include "vymmodel.h"
5.10
6.1 --- a/imports.cpp Tue May 26 11:24:51 2009 +0000
6.2 +++ b/imports.cpp Wed Jun 03 20:37:17 2009 +0000
6.3 @@ -34,11 +34,6 @@
6.4 inputFile=p;
6.5 }
6.6
6.7 -void ImportBase::setMapCenter(MapCenterObj *mc)
6.8 -{
6.9 - mapCenter=mc;
6.10 -}
6.11 -
6.12 bool ImportBase::transform()
6.13 {
6.14 return true;
7.1 --- a/imports.h Tue May 26 11:24:51 2009 +0000
7.2 +++ b/imports.h Wed Jun 03 20:37:17 2009 +0000
7.3 @@ -5,7 +5,6 @@
7.4 #include <qstring.h>
7.5 #include <iostream>
7.6
7.7 -#include "mapcenterobj.h"
7.8 #include "settings.h"
7.9
7.10
7.11 @@ -18,14 +17,12 @@
7.12 virtual ~ImportBase();
7.13 virtual void setDir(const QString &);
7.14 virtual void setFile(const QString &);
7.15 - virtual void setMapCenter (MapCenterObj*);
7.16 virtual bool transform();
7.17 virtual QString getTransformedFile();
7.18 protected:
7.19 QDir tmpDir;
7.20 QString inputDir;
7.21 QString inputFile;
7.22 - MapCenterObj *mapCenter;
7.23 QString transformedFile;
7.24
7.25 };
8.1 --- a/linkablemapobj.cpp Tue May 26 11:24:51 2009 +0000
8.2 +++ b/linkablemapobj.cpp Wed Jun 03 20:37:17 2009 +0000
8.3 @@ -447,6 +447,19 @@
8.4
8.5 // updateLink is called from move, but called from constructor we don't
8.6 // have parents yet...
8.7 +
8.8 + if (!parObj)
8.9 + {
8.10 + // If I am a mapcenter, set childPos to middle of MapCenterObj
8.11 + childPos.setX( clickBox.topLeft().x() + clickBox.width()/2 );
8.12 + childPos.setY( clickBox.topLeft().y() + clickBox.height()/2 );
8.13 + parPos=childPos;
8.14 + // Redraw links to children
8.15 + for (int i=0; i<treeItem->branchCount(); ++i)
8.16 + treeItem->getBranchObjNum(i)->updateLink();
8.17 + return;
8.18 + }
8.19 +
8.20 if (style==UndefinedStyle) return;
8.21
8.22 switch (linkpos)
9.1 --- a/mainwindow.cpp Tue May 26 11:24:51 2009 +0000
9.2 +++ b/mainwindow.cpp Wed Jun 03 20:37:17 2009 +0000
9.3 @@ -1131,7 +1131,7 @@
9.4 setupFlag (flag,tb,"system-scrolledright",tr("subtree is scrolled","SystemFlag"));
9.5
9.6 flag->load(QPixmap(flagsPath+"flag-tmpUnscrolled-right.png"));
9.7 - setupFlag (flag,tb,"system-tmpUnscrolledright",tr("subtree is temporary scrolled","SystemFlag"));
9.8 + setupFlag (flag,tb,"system-tmpUnscrolledRight",tr("subtree is temporary scrolled","SystemFlag"));
9.9
9.10 flag->load(QPixmap(flagsPath+"flag-hideexport.png"));
9.11 setupFlag (flag,tb,"system-hideInExport",tr("Hide object in exported maps","SystemFlag"));
9.12 @@ -2770,22 +2770,21 @@
9.13 VymModel *m=currentModel();
9.14 if (m)
9.15 {
9.16 - BranchItem *bi=m->createBranch();
9.17 -
9.18 - if (bi)
9.19 + BranchItem *bi=m->addNewBranch();
9.20 + if (!bi) return;
9.21 +
9.22 + if (actionSettingsAutoEditNewBranch->isOn()
9.23 + && !actionSettingsAutoSelectNewBranch->isOn() )
9.24 + prevSelection=m->getSelectString();
9.25 + else
9.26 + prevSelection=QString();
9.27 +
9.28 + if (actionSettingsAutoSelectNewBranch->isOn()
9.29 + || actionSettingsAutoEditNewBranch->isOn())
9.30 + {
9.31 m->select (bi);
9.32 - else
9.33 - return;
9.34 -
9.35 - if (actionSettingsAutoEditNewBranch->isOn())
9.36 - {
9.37 - currentMapEditor()->editHeading();
9.38 - return;
9.39 - }
9.40 - if (!prevSelection.isEmpty())
9.41 - {
9.42 - m->select(prevSelection);
9.43 - prevSelection="";
9.44 + if (actionSettingsAutoEditNewBranch->isOn())
9.45 + currentMapEditor()->editHeading();
9.46 }
9.47 }
9.48 }
10.1 --- a/mapcenterobj.cpp Tue May 26 11:24:51 2009 +0000
10.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
10.3 @@ -1,73 +0,0 @@
10.4 -#include <QDateTime>
10.5 -
10.6 -#include "floatimageobj.h"
10.7 -#include "geometry.h"
10.8 -#include "mapcenterobj.h"
10.9 -
10.10 -/////////////////////////////////////////////////////////////////
10.11 -// MapCenterObj
10.12 -/////////////////////////////////////////////////////////////////
10.13 -MapCenterObj::MapCenterObj() : BranchObj ()
10.14 -{
10.15 -// cout << "Const MapCenterObj\n";
10.16 - init();
10.17 -}
10.18 -
10.19 -MapCenterObj::MapCenterObj(QGraphicsScene* s) : BranchObj (s)
10.20 -{
10.21 -// cout << "Const MapCenterObj canvas="<<s<<"\n";
10.22 - init();
10.23 -}
10.24 -
10.25 -MapCenterObj::~MapCenterObj()
10.26 -{
10.27 -// cout << "Destr MapCenterObj\n";
10.28 - clear();
10.29 -}
10.30 -
10.31 -void MapCenterObj::clear()
10.32 -{
10.33 - BranchObj::clear();
10.34 -}
10.35 -
10.36 -void MapCenterObj::init ()
10.37 -{
10.38 - BranchObj::init();
10.39 - orientation=LinkableMapObj::UndefinedOrientation;
10.40 -
10.41 - // TODO this should be done in TextObj later...
10.42 - //QFont font ("Sans Serif,16,-1,5,50,0,0,0,0,0");
10.43 - //heading->setFont(font);
10.44 - //FIXME-2 no treeitem yet: setDefAttr(MovedBranch); and already in BI::createMapObj ?!?
10.45 -
10.46 - frame->setFrameType (FrameObj::Rectangle);
10.47 -}
10.48 -
10.49 -
10.50 -void MapCenterObj::updateLink()
10.51 -{
10.52 - // set childPos to middle of MapCenterObj
10.53 - childPos.setX( clickBox.topLeft().x() + (int)(clickBox.width())/2 );
10.54 - childPos.setY( clickBox.topLeft().y() + (int)(clickBox.height())/2 );
10.55 - parPos=childPos;
10.56 - for (int i=0; i<treeItem->branchCount(); ++i)
10.57 - treeItem->getBranchObjNum(i)->updateLink();
10.58 -}
10.59 -
10.60 -void MapCenterObj::updateRelPositions()
10.61 -{
10.62 - if (repositionRequest) unsetAllRepositionRequests();
10.63 -
10.64 - // update relative Positions of branches and floats
10.65 - for (int i=0; i<treeItem->branchCount(); ++i)
10.66 - {
10.67 - treeItem->getBranchObjNum(i)->setRelPos();
10.68 - treeItem->getBranchObjNum(i)->setOrientation();
10.69 - }
10.70 -
10.71 - for (int i=0; i<floatimage.size(); ++i)
10.72 - floatimage.at(i)->setRelPos();
10.73 -
10.74 - if (repositionRequest) reposition();
10.75 -}
10.76 -
11.1 --- a/mapcenterobj.h Tue May 26 11:24:51 2009 +0000
11.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
11.3 @@ -1,25 +0,0 @@
11.4 -#ifndef MAPCENTEROBJ_H
11.5 -#define MAPCENTEROBJ_H
11.6 -
11.7 -
11.8 -#include <QDate>
11.9 -
11.10 -#include "branchobj.h"
11.11 -
11.12 -
11.13 -class VymModel;
11.14 -
11.15 -/*! \brief The center of the map is a special branch. */
11.16 -
11.17 -/////////////////////////////////////////////////////////////////////////////
11.18 -class MapCenterObj:public BranchObj {
11.19 -public:
11.20 - MapCenterObj ();
11.21 - MapCenterObj (QGraphicsScene *);
11.22 - ~MapCenterObj ();
11.23 - void clear();
11.24 - void init();
11.25 - virtual void updateLink();
11.26 - virtual void updateRelPositions();
11.27 -};
11.28 -#endif
12.1 --- a/mapeditor.cpp Tue May 26 11:24:51 2009 +0000
12.2 +++ b/mapeditor.cpp Wed Jun 03 20:37:17 2009 +0000
12.3 @@ -858,7 +858,7 @@
12.4 fio->move (p.x() -movingObj_start.x(), p.y()-movingObj_start.y() );
12.5 fio->setRelPos();
12.6 fio->updateLink(); //no need for reposition, if we update link here
12.7 - model->updateSelection(); // position has changed
12.8 + model->emitSelectionChanged(); // position has changed
12.9
12.10 // Relink float to new mapcenter or branch, if shift is pressed
12.11 // Only relink, if selection really has a new parent
12.12 @@ -1147,7 +1147,7 @@
12.13 model->reposition();
12.14 }
12.15 }
12.16 - model->updateSelection(); //FIXME-3 needed? at least not after pos of selection has changed...
12.17 + model->emitSelectionChanged(); //FIXME-3 needed? at least not after pos of selection has changed...
12.18 // Finally resize scene, if needed
12.19 scene()->update();
12.20 movingObj=NULL;
12.21 @@ -1236,7 +1236,7 @@
12.22 // Workaround to avoid adding empty branches
12.23 if (!uris.at(i).toString().isEmpty())
12.24 {
12.25 - bi=model->createBranch();
12.26 + bi=model->addNewBranch();
12.27 if (bi)
12.28 {
12.29 /* FIXME-2
12.30 @@ -1270,8 +1270,40 @@
12.31 event->acceptProposedAction();
12.32 }
12.33
12.34 -void MapEditor::updateSelection(const QItemSelection &newsel,const QItemSelection &)
12.35 +void MapEditor::updateSelection(const QItemSelection &newsel,const QItemSelection &oldsel)
12.36 {
12.37 + // Take care to tmp scroll/unscroll
12.38 + if (!oldsel.isEmpty())
12.39 + {
12.40 + QModelIndex ix=oldsel.indexes().first();
12.41 + if (ix.isValid() )
12.42 + {
12.43 + TreeItem *ti= static_cast<TreeItem*>(ix.internalPointer());
12.44 + if (ti && ti->isBranchLikeType() )
12.45 + {
12.46 + BranchItem *bi=(BranchItem*)ti;
12.47 + bi->resetTmpUnscroll();
12.48 + }
12.49 + }
12.50 + }
12.51 +
12.52 + if (!newsel.isEmpty())
12.53 + {
12.54 + QModelIndex ix=newsel.indexes().first();
12.55 + if (ix.isValid() )
12.56 + {
12.57 + // Temporary unscroll if necessary
12.58 + TreeItem *ti= static_cast<TreeItem*>(ix.internalPointer());
12.59 + if (ti->isBranchLikeType() )
12.60 + {
12.61 + BranchItem *bi=(BranchItem*)ti;
12.62 + if (bi->hasScrolledParent(bi) )
12.63 + bi->tmpUnscroll();
12.64 + }
12.65 + scrollTo (ix);
12.66 + }
12.67 + }
12.68 +
12.69 // Reduce rectangles
12.70 while (newsel.indexes().count() < selboxList.count() )
12.71 delete selboxList.takeFirst();
12.72 @@ -1309,6 +1341,8 @@
12.73 sb->setBrush (selectionColor);
12.74 i++;
12.75 }
12.76 +
12.77 + scene()->update();
12.78 }
12.79
12.80 void MapEditor::updateData (const QModelIndex &sel)
13.1 --- a/mapeditor.h Tue May 26 11:24:51 2009 +0000
13.2 +++ b/mapeditor.h Wed Jun 03 20:37:17 2009 +0000
13.3 @@ -10,6 +10,7 @@
13.4 #include "ornamentedobj.h"
13.5 #include "settings.h"
13.6 #include "vymmodel.h"
13.7 +#include "xlinkobj.h"
13.8
13.9
13.10 /*! \brief Main widget in vym to display and edit a map */
14.1 --- a/mapitem.cpp Tue May 26 11:24:51 2009 +0000
14.2 +++ b/mapitem.cpp Wed Jun 03 20:37:17 2009 +0000
14.3 @@ -30,6 +30,11 @@
14.4 if (lmo) lmo->move (p);
14.5 }
14.6
14.7 +void MapItem::setPositionMode (PositionMode mode)
14.8 +{
14.9 + posMode=mode;
14.10 +}
14.11 +
14.12 LinkableMapObj* MapItem::getLMO()
14.13 {
14.14 return lmo;
15.1 --- a/mapitem.h Tue May 26 11:24:51 2009 +0000
15.2 +++ b/mapitem.h Wed Jun 03 20:37:17 2009 +0000
15.3 @@ -17,8 +17,9 @@
15.4
15.5 class MapItem: public XMLObj
15.6 {
15.7 +public:
15.8 + enum PositionMode {Unused,Absolute,Relative};
15.9 protected:
15.10 - enum PositionMode {Unused,Absolute,Relative};
15.11 QPointF pos;
15.12 PositionMode posMode;
15.13
15.14 @@ -31,6 +32,10 @@
15.15 /*! Used to save absolute position while map is not in QGraphicsView */
15.16 virtual void setAbsPos(const QPointF&);
15.17
15.18 + /*! Tell object to use e.g. absolute positioning for mapcenter.
15.19 + Defaulst is MapItem::Unused */
15.20 + void setPositionMode (PositionMode mode);
15.21 +
15.22 protected:
15.23 LinkableMapObj *lmo;
15.24 public:
16.1 --- a/version.h Tue May 26 11:24:51 2009 +0000
16.2 +++ b/version.h Wed Jun 03 20:37:17 2009 +0000
16.3 @@ -7,7 +7,7 @@
16.4 #define __VYM_VERSION "1.13.0"
16.5 //#define __VYM_CODENAME "Codename: RC-1"
16.6 #define __VYM_CODENAME "Codename: development version, not for production!"
16.7 -#define __VYM_BUILD_DATE "2009-05-26"
16.8 +#define __VYM_BUILD_DATE "2009-06-03"
16.9
16.10
16.11 bool checkVersion(const QString &);
17.1 --- a/vym.pro Tue May 26 11:24:51 2009 +0000
17.2 +++ b/vym.pro Wed Jun 03 20:37:17 2009 +0000
17.3 @@ -63,7 +63,6 @@
17.4 imports.h \
17.5 linkablemapobj.h \
17.6 mainwindow.h \
17.7 - mapcenterobj.h \
17.8 mapeditor.h \
17.9 mapitem.h \
17.10 mapobj.h \
17.11 @@ -124,7 +123,6 @@
17.12 linkablemapobj.cpp \
17.13 main.cpp \
17.14 mainwindow.cpp \
17.15 - mapcenterobj.cpp \
17.16 mapeditor.cpp \
17.17 mapitem.cpp \
17.18 mapobj.cpp \
18.1 --- a/vymmodel.cpp Tue May 26 11:24:51 2009 +0000
18.2 +++ b/vymmodel.cpp Wed Jun 03 20:37:17 2009 +0000
18.3 @@ -11,7 +11,6 @@
18.4 #include "file.h"
18.5 #include "geometry.h" // for addBBox
18.6 #include "mainwindow.h"
18.7 -#include "mapcenterobj.h"
18.8 #include "misc.h"
18.9 #include "parser.h"
18.10
18.11 @@ -463,7 +462,7 @@
18.12 if ( ok )
18.13 {
18.14 reposition(); // FIXME-2 VM reposition the view instead...
18.15 - updateSelection();
18.16 + emitSelectionChanged();
18.17 if (lmode==NewMap)
18.18 {
18.19 mapDefault=false;
18.20 @@ -701,9 +700,9 @@
18.21 */
18.22 }
18.23
18.24 -FloatImageObj* VymModel::loadFloatImageInt (QString fn)
18.25 -{
18.26 - TreeItem *fi=createImage();
18.27 +FloatImageObj* VymModel::loadFloatImageInt (BranchItem *dst,QString fn)
18.28 +{
18.29 + TreeItem *fi=createImage(dst);
18.30 if (fi)
18.31 {
18.32 FloatImageObj *fio= ((FloatImageObj*)fi->getLMO());
18.33 @@ -714,14 +713,13 @@
18.34 return NULL;
18.35 }
18.36
18.37 -void VymModel::loadFloatImage () // FIXME-2
18.38 -{
18.39 -/*
18.40 - BranchObj *bo=getSelectedBranch();
18.41 - if (bo)
18.42 +void VymModel::loadFloatImage ()
18.43 +{
18.44 + BranchItem *selbi=getSelectedBranchItem();
18.45 + if (selbi)
18.46 {
18.47
18.48 - Q3FileDialog *fd=new Q3FileDialog( NULL);
18.49 + Q3FileDialog *fd=new Q3FileDialog( NULL); // FIXME-4 get rid of Q3FileDialog
18.50 fd->setMode (Q3FileDialog::ExistingFiles);
18.51 fd->addFilter (QString (tr("Images") + " (*.png *.bmp *.xbm *.jpg *.png *.xpm *.gif *.pnm)"));
18.52 ImagePreview *p =new ImagePreview (fd);
18.53 @@ -741,24 +739,26 @@
18.54 for (int j=0; j<fd->selectedFiles().count(); j++)
18.55 {
18.56 s=fd->selectedFiles().at(j);
18.57 - fio=loadFloatImageInt (s);
18.58 + fio=loadFloatImageInt (selbi,s);
18.59 + //FIXME-1 savestate for loadImage missing
18.60 + /*
18.61 if (fio)
18.62 saveState(
18.63 (LinkableMapObj*)fio,
18.64 "delete ()",
18.65 - bo,
18.66 + selbi,
18.67 QString ("loadImage (%1)").arg(s ),
18.68 - QString("Add image %1 to %2").arg(s).arg(getObjectName(bo))
18.69 + QString("Add image %1 to %2").arg(s).arg(getObjectName(selbi))
18.70 );
18.71 else
18.72 // TODO loadFIO error handling
18.73 qWarning ("Failed to load "+s);
18.74 + */
18.75 }
18.76 }
18.77 delete (p);
18.78 delete (fd);
18.79 }
18.80 -*/
18.81 }
18.82
18.83 void VymModel::saveFloatImageInt (FloatImageObj *fio, const QString &type, const QString &fn)
18.84 @@ -1179,7 +1179,7 @@
18.85
18.86 mainWindow->updateHistory (undoSet);
18.87 updateActions();
18.88 - updateSelection();
18.89 + emitSelectionChanged();
18.90 }
18.91
18.92 bool VymModel::isUndoAvailable()
18.93 @@ -1509,7 +1509,7 @@
18.94 emitDataHasChanged ( selbi); //FIXME-3 maybe emit signal from TreeItem?
18.95
18.96 reposition();
18.97 - updateSelection();
18.98 + emitSelectionChanged();
18.99 }
18.100 }
18.101
18.102 @@ -1829,7 +1829,7 @@
18.103 );
18.104 updateActions();
18.105 reposition();
18.106 - // updateSelection();
18.107 + // emitSelectionChanged();
18.108 // FIXME-3 VM needed? scene()->update();
18.109 }
18.110 }
18.111 @@ -1960,25 +1960,22 @@
18.112 BranchItem* VymModel::createMapCenter()
18.113 {
18.114 BranchItem *newbi=addMapCenter (QPointF (0,0) );
18.115 - select (newbi);
18.116 return newbi;
18.117 }
18.118
18.119 -BranchItem* VymModel::createBranch()
18.120 -{
18.121 - BranchItem *selbi=getSelectedBranchItem();
18.122 - if (selbi)
18.123 - return addNewBranchInt (selbi,-2);
18.124 +BranchItem* VymModel::createBranch(BranchItem *dst)
18.125 +{
18.126 + if (dst)
18.127 + return addNewBranchInt (dst,-2);
18.128 else
18.129 return NULL;
18.130 }
18.131
18.132 -TreeItem* VymModel::createImage() //FIXME-1
18.133 +TreeItem* VymModel::createImage(BranchItem *dst) //FIXME-1
18.134 {
18.135 return NULL;
18.136 /*
18.137 - BranchObj *bo=getSelectedBranch();
18.138 - if (bo)
18.139 + if (dst)
18.140 {
18.141 FloatImageObj *newfio=bo->addFloatImage(); // FIXME-1 VM Old model, merge with below
18.142
18.143 @@ -2017,6 +2014,7 @@
18.144 }
18.145
18.146 BranchItem* VymModel::addMapCenter(QPointF absPos) //FIXME-2 absPos not used in context menu?!
18.147 +// createMapCenter could then probably be merged with createBranch
18.148 {
18.149
18.150 // Create TreeItem
18.151 @@ -2037,12 +2035,13 @@
18.152 emit (layoutChanged() );
18.153
18.154 // Create MapObj
18.155 + newbi->setPositionMode (MapItem::Absolute);
18.156 newbi->createMapObj(mapScene);
18.157
18.158 return newbi;
18.159 }
18.160
18.161 -BranchItem* VymModel::addNewBranchInt(BranchItem *dst,int num) //FIXME-4 simplify...
18.162 +BranchItem* VymModel::addNewBranchInt(BranchItem *dst,int num)
18.163 {
18.164 // Depending on pos:
18.165 // -3 insert in children of parent above selection
18.166 @@ -2086,7 +2085,6 @@
18.167 // new branch in order to tmp unscroll parent...
18.168 newbi->createMapObj(mapScene);
18.169 reposition();
18.170 - select (newbi);
18.171 return newbi;
18.172 }
18.173
18.174 @@ -2103,7 +2101,6 @@
18.175 {
18.176 // FIXME-3 setCursor (Qt::ArrowCursor); //Still needed?
18.177
18.178 -
18.179 newbi=addNewBranchInt (selbi,pos-2);
18.180
18.181 if (newbi)
18.182 @@ -2116,7 +2113,7 @@
18.183 QString ("Add new branch to %1").arg(getObjectName(selbi)));
18.184
18.185 reposition();
18.186 - // updateSelection(); FIXME-3
18.187 + // emitSelectionChanged(); FIXME-3
18.188 latestAddedItem=newbi;
18.189 // In Network mode, the client needs to know where the new branch is,
18.190 // so we have to pass on this information via saveState.
18.191 @@ -2156,10 +2153,9 @@
18.192 QString ("Add branch before %1").arg(getObjectName(selbi)));
18.193
18.194 // FIXME-3 needed? reposition();
18.195 - // updateSelection(); FIXME-3
18.196 + // emitSelectionChanged(); FIXME-3
18.197 }
18.198 }
18.199 - //FIXME-3 needed? latestSelectionString=selection.getSelectString();
18.200 return newbi;
18.201 }
18.202
18.203 @@ -2250,43 +2246,46 @@
18.204 */
18.205 }
18.206
18.207 -void VymModel::deleteKeepChildren() //FIXME-2 VM still missing
18.208 -
18.209 -{
18.210 -/*
18.211 - BranchObj *bo=getSelectedBranch();
18.212 - BranchObj *par;
18.213 - if (bo)
18.214 +void VymModel::deleteKeepChildren()
18.215 +
18.216 +{
18.217 + BranchItem *selbi=getSelectedBranchItem();
18.218 + BranchItem *pi;
18.219 + if (selbi)
18.220 {
18.221 - par=(BranchObj*)(bo->getParObj());
18.222 -
18.223 // Don't use this on mapcenter
18.224 - if (!par) return;
18.225 -
18.226 + if (selbi->depth()<2) return;
18.227 +
18.228 + pi=(BranchItem*)(selbi->parent());
18.229 // Check if we have childs at all to keep
18.230 - if (bo->getTreeItem()->branchCount()==0)
18.231 + if (selbi->branchCount()==0)
18.232 {
18.233 deleteSelection();
18.234 return;
18.235 }
18.236
18.237 - QPointF p=bo->getRelPos();
18.238 + QPointF p;
18.239 + if (selbi->getLMO()) p=selbi->getLMO()->getRelPos();
18.240 saveStateChangingPart(
18.241 - bo->getParObj(),
18.242 - bo,
18.243 + pi,
18.244 + selbi,
18.245 "deleteKeepChildren ()",
18.246 - QString("Remove %1 and keep its children").arg(getObjectName(bo))
18.247 + QString("Remove %1 and keep its children").arg(getObjectName(selbi))
18.248 );
18.249
18.250 - QString sel=getSelectString(bo);
18.251 + QString sel=getSelectString(selbi);
18.252 unselect();
18.253 - par->removeBranchHere(bo);
18.254 + //FIXME-0 missing in VM pi->removeBranchHere(selbi);
18.255 reposition();
18.256 select (sel);
18.257 - getSelectedBranch()->move2RelPos (p);
18.258 - reposition();
18.259 + BranchObj *bo=getSelectedBranchObj();
18.260 + if (bo)
18.261 + {
18.262 + bo->move2RelPos (p);
18.263 + reposition();
18.264 + }
18.265 }
18.266 -*/}
18.267 +}
18.268
18.269 void VymModel::deleteChildren()
18.270
18.271 @@ -2332,7 +2331,7 @@
18.272 QString ("%1 %2").arg(r).arg(getObjectName(bi))
18.273 );
18.274 emitDataHasChanged(bi);
18.275 - updateSelection();
18.276 + emitSelectionChanged();
18.277 mapScene->update(); //Needed for _quick_ update, even in 1.13.x //FIXME-3 force update via signal...
18.278 return true;
18.279 }
18.280 @@ -2360,7 +2359,7 @@
18.281 );
18.282 bi->toggleScroll();
18.283 emitDataHasChanged(bi);
18.284 - updateSelection();
18.285 + emitSelectionChanged();
18.286
18.287 mapScene->update(); //Needed for _quick_ update, even in 1.13.x //FIXME-3 force update via signal...
18.288 return true;
18.289 @@ -2427,7 +2426,7 @@
18.290 QString("Toggling standard flag \"%1\" of %2").arg(name).arg(getObjectName(bi)));
18.291 bi->toggleStandardFlag (name, master);
18.292 reposition();
18.293 - updateSelection();
18.294 + emitSelectionChanged();
18.295 }
18.296 }
18.297
18.298 @@ -2617,7 +2616,7 @@
18.299 bi->setVymLink(s);
18.300 reposition();
18.301 updateActions();
18.302 - //updateSelection();
18.303 + //emitSelectionChanged();
18.304 }
18.305 }
18.306
18.307 @@ -3034,7 +3033,7 @@
18.308 if (ok)
18.309 {
18.310 selb->linkTo ((BranchObj*)(dst),n);
18.311 - updateSelection();
18.312 + emitSelectionChanged();
18.313 }
18.314 } else if (typid(*dst) == typid(MapCenterObj) )
18.315 {
18.316 @@ -3047,7 +3046,7 @@
18.317 if (ok)
18.318 {
18.319 selbi->move (x,y);
18.320 - updateSelection();
18.321 + emitSelectionChanged();
18.322 }
18.323 }
18.324 }
18.325 @@ -3082,7 +3081,7 @@
18.326 } else if (parser.checkParCount(1))
18.327 {
18.328 s=parser.parString(ok,0);
18.329 - if (ok) loadFloatImageInt (s);
18.330 + if (ok) loadFloatImageInt (selbi,s);
18.331 }
18.332 /////////////////////////////////////////////////////////////////////
18.333 } else if (com=="moveUp")
18.334 @@ -3859,16 +3858,36 @@
18.335 else
18.336 selti->setNote (textEditor->getText());
18.337 emitDataHasChanged(selti);
18.338 - updateSelection();
18.339 + emitSelectionChanged();
18.340
18.341 }
18.342 }
18.343
18.344 void VymModel::updateRelPositions() //FIXME-3 VM should have no need to updateRelPos
18.345 {
18.346 - //cout << "VM::updateRelPos...\n";
18.347 + cout << "VM::updateRelPos...\n";
18.348 + /* FIXME-3 ???
18.349 for (int i=0; i<rootItem->branchCount(); i++)
18.350 ((MapCenterObj*)rootItem->getBranchObjNum(i))->updateRelPositions();
18.351 + */
18.352 + /*
18.353 + void MapCenterObj::updateRelPositions()
18.354 + {
18.355 + if (repositionRequest) unsetAllRepositionRequests();
18.356 +
18.357 + // update relative Positions of branches and floats
18.358 + for (int i=0; i<treeItem->branchCount(); ++i)
18.359 + {
18.360 + treeItem->getBranchObjNum(i)->setRelPos();
18.361 + treeItem->getBranchObjNum(i)->setOrientation();
18.362 + }
18.363 +
18.364 + for (int i=0; i<floatimage.size(); ++i)
18.365 + floatimage.at(i)->setRelPos();
18.366 +
18.367 + if (repositionRequest) reposition();
18.368 + }
18.369 + */
18.370 }
18.371
18.372 void VymModel::reposition() //FIXME-3 VM should have no need to reposition, this is done in views???
18.373 @@ -4201,7 +4220,7 @@
18.374 QString("Move %1 to %2").arg(getObjectName(bo)).arg(ps));
18.375 bo->move(x,y);
18.376 reposition();
18.377 - updateSelection();
18.378 + emitSelectionChanged();
18.379 }
18.380 }
18.381 */
18.382 @@ -4232,7 +4251,7 @@
18.383 ((OrnamentedObj*)bo)->move2RelPos (x,y);
18.384 reposition();
18.385 bo->updateLink();
18.386 - updateSelection();
18.387 + emitSelectionChanged();
18.388 }
18.389 }
18.390 */
18.391 @@ -4455,17 +4474,21 @@
18.392 }
18.393 */
18.394
18.395 -void VymModel::updateSelection(const QItemSelection &newsel)
18.396 +void VymModel::updateSelection (const QItemSelection &newsel,const QItemSelection &oldsel) //FIXME-4 connected but not used so far
18.397 +{
18.398 +}
18.399 +
18.400 +void VymModel::emitSelectionChanged(const QItemSelection &newsel)
18.401 {
18.402 emit (selectionChanged(newsel,newsel)); // needed e.g. to update geometry in editor
18.403 emitShowSelection();
18.404 sendSelection();
18.405 }
18.406
18.407 -void VymModel::updateSelection()
18.408 +void VymModel::emitSelectionChanged()
18.409 {
18.410 QItemSelection newsel=selModel->selection();
18.411 - updateSelection (newsel);
18.412 + emitSelectionChanged (newsel);
18.413 }
18.414
18.415 void VymModel::setSelectionColor(QColor col)
18.416 @@ -4610,7 +4633,7 @@
18.417 {
18.418 if (selection.select(lmo))
18.419 {
18.420 - //updateSelection();
18.421 + //emitSelectionChanged();
18.422 }
18.423 }
18.424
18.425 @@ -4618,7 +4641,7 @@
18.426 {
18.427 if (selection.select(lmo))
18.428 {
18.429 - //updateSelection();
18.430 + //emitSelectionChanged();
18.431 }
18.432 }
18.433 */
18.434 @@ -4840,7 +4863,7 @@
18.435 TreeItem *ti2=par->getFirstBranch();
18.436 if (ti2) {
18.437 select(ti2);
18.438 - updateSelection();
18.439 + emitSelectionChanged();
18.440 }
18.441 }
18.442 }
18.443 @@ -4855,7 +4878,7 @@
18.444 TreeItem *ti2=par->getLastBranch();
18.445 if (ti2) {
18.446 select(ti2);
18.447 - updateSelection();
18.448 + emitSelectionChanged();
18.449 }
18.450 }
18.451 }
18.452 @@ -4879,7 +4902,7 @@
18.453 par=ti->parent();
18.454 if (!par) return;
18.455 select(par);
18.456 - updateSelection();
18.457 + emitSelectionChanged();
18.458 }
18.459 }
18.460
18.461 @@ -4955,11 +4978,7 @@
18.462
18.463 QString VymModel::getSelectString ()
18.464 {
18.465 - LinkableMapObj *lmo=getSelectedLMO();
18.466 - if (lmo)
18.467 - return getSelectString(lmo);
18.468 - else
18.469 - return QString();
18.470 + return getSelectString (getSelectedItem());
18.471 }
18.472
18.473 QString VymModel::getSelectString (LinkableMapObj *lmo) // FIXME-2 VM needs to use TreeModel. Port all calls to this funtion to the one using TreeItem below...
19.1 --- a/vymmodel.h Tue May 26 11:24:51 2009 +0000
19.2 +++ b/vymmodel.h Wed Jun 03 20:37:17 2009 +0000
19.3 @@ -5,7 +5,7 @@
19.4 #include <QtNetwork>
19.5
19.6 #include "file.h"
19.7 -#include "mapcenterobj.h"
19.8 +#include "floatimageobj.h"
19.9 #include "mapeditor.h"
19.10 #include "parser.h"
19.11 #include "treeitem.h"
19.12 @@ -107,7 +107,7 @@
19.13 void addMapReplaceInt(const QString & undoSel, const QString & path);
19.14 void addMapInsertInt (const QString & path, int pos);
19.15
19.16 - FloatImageObj* loadFloatImageInt (QString);
19.17 + FloatImageObj* loadFloatImageInt (BranchItem *dst,QString);
19.18 void saveFloatImageInt (FloatImageObj*, const QString &, const QString &);
19.19 public:
19.20 void loadFloatImage ();
19.21 @@ -280,9 +280,9 @@
19.22 void sortChildren(); //!< Sort children lexically
19.23
19.24 // The create methods are used to quickly parse a XML file
19.25 - BranchItem* createMapCenter(); //!< Create and select MapCenter // FIXME-3 maybe join this also with createBranch
19.26 - BranchItem* createBranch(); //!< Create and select Branch
19.27 - TreeItem* createImage(); //!< Create and select image
19.28 + BranchItem* createMapCenter(); //!< Create MapCenter
19.29 + BranchItem* createBranch(BranchItem *dst); //!< Create Branch
19.30 + TreeItem* createImage(BranchItem *dst); //!< Create image
19.31
19.32 /*! \brief Add new mapcenter
19.33
19.34 @@ -313,7 +313,7 @@
19.35 0 as child of selection
19.36 1 below selection
19.37 */
19.38 - BranchItem* addNewBranch(int pos);
19.39 + BranchItem* addNewBranch(int pos=0);
19.40 BranchItem* addNewBranchBefore(); //!< Insert branch between selection and its parent
19.41 /*! \brief Relink a branch to a new destination dst
19.42 Relinks branch to dst at branch position pos. There is no saveState
19.43 @@ -539,9 +539,6 @@
19.44 private:
19.45 TreeItem *latestAddedItem; // latest added object, reset on setChanged()
19.46
19.47 -signals:
19.48 - void selectionChanged(const QItemSelection &, const QItemSelection &);
19.49 -
19.50 public:
19.51 void setSelectionModel(QItemSelectionModel *); // Set common selectionModel
19.52 QItemSelectionModel* getSelectionModel();
19.53 @@ -591,14 +588,15 @@
19.54 QString getSelectString (TreeItem *item);
19.55
19.56
19.57 - /*
19.58 +signals:
19.59 + void selectionChanged(const QItemSelection &newsel, const QItemSelection &oldsel);
19.60 +
19.61 public slots:
19.62 - void changeSelection (const QItemSelection &newSel, const QItemSelection &delSel);
19.63 - */
19.64 + void updateSelection (const QItemSelection &newSel, const QItemSelection &delSel);
19.65
19.66 public:
19.67 - void updateSelection(const QItemSelection &oldsel);
19.68 - void updateSelection();
19.69 + void emitSelectionChanged(const QItemSelection &oldsel);
19.70 + void emitSelectionChanged();
19.71 void selectMapLinkColor();
19.72 void selectMapSelectionColor();
19.73 private:
20.1 --- a/vymview.cpp Tue May 26 11:24:51 2009 +0000
20.2 +++ b/vymview.cpp Wed Jun 03 20:37:17 2009 +0000
20.3 @@ -35,6 +35,10 @@
20.4 mapEditor,SLOT (updateSelection(const QItemSelection &,const QItemSelection &)));
20.5
20.6 connect (
20.7 + selModel, SIGNAL (selectionChanged(const QItemSelection &, const QItemSelection &)),
20.8 + model,SLOT (updateSelection(const QItemSelection &,const QItemSelection &)));
20.9 +
20.10 + connect (
20.11 model, SIGNAL (dataChanged(const QModelIndex &, const QModelIndex &)),
20.12 mapEditor,SLOT (updateData(const QModelIndex &) ) );
20.13
20.14 @@ -102,7 +106,7 @@
20.15 {
20.16 // Notify mainwindow to update satellites like NoteEditor, if needed (model==currenModel...)
20.17 mainWindow->changeSelection (model,newsel,oldsel); // FIXME-3 maybe connect VymModel <-> MainWindow directly?
20.18 - showSelection();
20.19 + //showSelection();
20.20 }
20.21
20.22 void VymView::expandAll()
21.1 --- a/xml-base.h Tue May 26 11:24:51 2009 +0000
21.2 +++ b/xml-base.h Wed Jun 03 20:37:17 2009 +0000
21.3 @@ -6,7 +6,6 @@
21.4 #include <QXmlAttributes>
21.5
21.6 #include "file.h"
21.7 -#include "mapcenterobj.h"
21.8 #include "mapeditor.h"
21.9 #include "vymmodel.h"
21.10
22.1 --- a/xml-freemind.cpp Tue May 26 11:24:51 2009 +0000
22.2 +++ b/xml-freemind.cpp Wed Jun 03 20:37:17 2009 +0000
22.3 @@ -78,7 +78,7 @@
22.4
22.5 //cout <<"model="<<model<<" first="<<model->first()<<endl;
22.6
22.7 - lastBranchItem=model->createBranch();
22.8 + lastBranchItem=model->createBranch(lastBranchItem);
22.9
22.10 //FIXME-3 lastBranch->move2RelPos (200,0);
22.11 lastBranchItem->setHeading (" ");
22.12 @@ -96,7 +96,7 @@
22.13 lastBranchItem=model->getSelectedBranchItem();
22.14 if (lastBranchItem)
22.15 {
22.16 - lastBranchItem=model->createBranch();
22.17 + lastBranchItem=model->createBranch(lastBranchItem);
22.18 readNodeAttr (atts);
22.19 }
22.20 } else if (atts.value ("POSITION")=="right")
22.21 @@ -105,7 +105,7 @@
22.22 lastBranchItem=model->getSelectedBranchItem();
22.23 if (lastBranchItem)
22.24 {
22.25 - lastBranchItem=model->createBranch();
22.26 + lastBranchItem=model->createBranch(lastBranchItem);
22.27 readNodeAttr (atts);
22.28 }
22.29 }
22.30 @@ -113,7 +113,7 @@
22.31 {
22.32 if (state!=StateMap)
22.33 {
22.34 - lastBranchItem=model->createBranch();
22.35 + lastBranchItem=model->createBranch(lastBranchItem);
22.36 }
22.37 readNodeAttr (atts);
22.38 }
23.1 --- a/xml-vym.cpp Tue May 26 11:24:51 2009 +0000
23.2 +++ b/xml-vym.cpp Wed Jun 03 20:37:17 2009 +0000
23.3 @@ -151,8 +151,7 @@
23.4 lastBranchItem=bi;
23.5 if (loadMode==ImportAdd)
23.6 {
23.7 - model->createBranch();
23.8 - lastBranchItem=model->getSelectedBranchItem();
23.9 + lastBranchItem=model->createBranch(lastBranchItem);
23.10 } //else
23.11 //FIXME-3 lastBranch->clear();
23.12 } else
23.13 @@ -212,8 +211,7 @@
23.14 state=StateBranch;
23.15 if (loadMode==ImportAdd)
23.16 {
23.17 - model->createBranch();
23.18 - lastBranchItem=model->getSelectedBranchItem();
23.19 + lastBranchItem=model->createBranch(lastBranchItem);
23.20
23.21 } else
23.22 //FIXME-2 lastBranch->clear();
23.23 @@ -229,7 +227,7 @@
23.24 } else if ( eName == "branch" && state == StateMapCenter)
23.25 {
23.26 state=StateBranch;
23.27 - lastBranchItem=model->createBranch();
23.28 + lastBranchItem=model->createBranch(lastBranchItem);
23.29 readBranchAttr (atts);
23.30 } else if ( eName == "htmlnote" && state == StateBranch)
23.31 {
23.32 @@ -249,7 +247,7 @@
23.33 if (!readXLinkAttr (atts)) return false;
23.34 } else if ( eName == "branch" && state == StateBranch )
23.35 {
23.36 - lastBranchItem=model->createBranch();
23.37 + lastBranchItem=model->createBranch(lastBranchItem);
23.38 readBranchAttr (atts);
23.39 } else if ( eName == "html" && state == StateHtmlNote )
23.40 {
23.41 @@ -285,13 +283,13 @@
23.42 case StateMapCenter:
23.43 model->selectParent();
23.44 model->emitDataHasChanged (lastBranchItem);
23.45 - lastBranchItem=model->getSelectedBranchItem();
23.46 + lastBranchItem=(BranchItem*)(lastBranchItem->parent());
23.47 lastBranchItem->setLastSelectedBranch (0); // Reset last selected to first child branch
23.48 break;
23.49 case StateBranch:
23.50 model->selectParent();
23.51 model->emitDataHasChanged (lastBranchItem);
23.52 - lastBranchItem=model->getSelectedBranchItem();
23.53 + lastBranchItem=(BranchItem*)(lastBranchItem->parent());
23.54 lastBranchItem->setLastSelectedBranch (0); // Reset last selected to first child branch
23.55 break;
23.56 case StateHtml:
23.57 @@ -341,7 +339,7 @@
23.58 htmldata+=ch_org;
23.59 break;
23.60 case StateHeading:
23.61 - model->setHeading(ch_simplified);
23.62 + lastBranchItem->setHeading(ch_simplified);
23.63 break;
23.64 default:
23.65 return false;