diff -r f0fe7c36ec5c -r 43268373032d vymmodel.h --- a/vymmodel.h Fri Apr 09 14:24:04 2010 +0000 +++ b/vymmodel.h Wed Jun 09 13:14:08 2010 +0000 @@ -21,6 +21,7 @@ class BranchItem; class FindResultModel; class MapEditor; +class Link; class XLinkItem; class VymModel : public TreeModel { @@ -46,7 +47,7 @@ void init(); void makeTmpDirectories(); //!< create temporary directories e.g. for history - MapEditor* getMapEditor(); // FIXME-2 still necessary? + MapEditor* getMapEditor(); uint getID(); //! Return unique ID of model bool isRepositionBlocked(); //!< While load or undo there is no need to update graphicsview @@ -83,7 +84,7 @@ QString saveToDir (const QString &tmpdir, const QString &prefix, bool writeflags, const QPointF &offset, TreeItem *saveSel); /*! Save all data in tree*/ - QString saveTreeToDir (const QString&,const QString&,const QPointF&);// Save data recursivly to tempdir + QString saveTreeToDir (const QString&,const QString&,const QPointF&,QList &tmpLinks);// Save data recursivly to tempdir /*! \brief Sets filepath, filename and mapname @@ -110,17 +111,19 @@ The data is read from file. Depending on LoadMode the current selection gets replaced by data or the data is appended. */ - ErrorCode load (QString, const LoadMode &, const FileType& ); // newmap, import/replace selection + ErrorCode loadMap ( + QString, //!< Path + const LoadMode &lmode=NewMap, //!< New map, replace or add to selection + bool saveStateFlag=true, //!< If called internally for history, don't save + const FileType &ftype=VymMap, //!< VymMap or FreeMind + int pos=-1 //!< Optionally tell position where to add data + ); public: /*! \brief Save the map to file */ ErrorCode save(const SaveMode &); private: - void addMapReplaceInt(const QString & undoSel, const QString & path); - bool addMapInsertInt (const QString & path); - bool addMapInsertInt (const QString & path, int pos); - ImageItem* loadFloatImageInt (BranchItem *dst,QString); void saveFloatImageInt (ImageItem*, const QString &, const QString &); public: @@ -321,7 +324,9 @@ BranchItem* createMapCenter(); //!< Create MapCenter BranchItem* createBranch(BranchItem *dst); //!< Create Branch ImageItem* createImage(BranchItem *dst); //!< Create image - XLinkItem* createXLink(BranchItem *dst,bool createMO=false); //!< Create XLink starting at dst + +public: + bool createLink(Link *l, bool createMO=false); //!< Create XLink AttributeItem* addAttribute(); AttributeItem* addAttribute(AttributeItem* ); @@ -366,15 +371,20 @@ bool relinkBranch (BranchItem* branch, BranchItem* dst, int pos =-1); bool relinkImage (ImageItem* image, BranchItem* dst); +private: + bool cleaningUpLinks; //!< True while cleaning up to avoid recursion +public: + void cleanupLinks(); //!< Delete orphaned XLinkItems void deleteSelection(); //!< Delete selection - void deleteKeepChildren(); //!< remove branch, but keep children + void deleteKeepChildren(bool saveStateFlag=true); //!< remove branch, but keep children +public: void deleteChildren(); //!< keep branch, but remove children TreeItem* deleteItem(TreeItem*); //!< Delete item and return parent (if parent!= rootItem) + void deleteLink (Link*); //!< Remove Link and related LinkItems in TreeModel void clearItem (TreeItem* ti); //!< Remove all children of TreeItem ti bool scrollBranch(BranchItem *); bool unscrollBranch(BranchItem *); -public: void toggleScroll(); void unscrollChildren(); void emitExpandAll(); @@ -406,7 +416,7 @@ QString getVymLink(); // return path to map QStringList getVymLinks(); // return paths in subtree void followXLink (int); - void editXLink (int); + void editXLink (int i=0); @@ -536,6 +546,7 @@ void startAnimation(BranchObj *bo, const QPointF &v); void startAnimation(BranchObj *bo, const QPointF &start, const QPointF &dest); void stopAnimation(MapObj *mo); + void stopAllAnimation(); //////////////////////////////////////////// // Network related @@ -631,6 +642,7 @@ QString getSelectString (); QString getSelectString (LinkableMapObj *lmo); QString getSelectString (TreeItem *item); + QString getSelectString (BranchItem *item); signals: