vymmodel.h
changeset 847 43268373032d
parent 845 b98c1793bb8b
child 848 e265f07f2173
     1.1 --- a/vymmodel.h	Fri Apr 09 14:24:04 2010 +0000
     1.2 +++ b/vymmodel.h	Wed Jun 09 13:14:08 2010 +0000
     1.3 @@ -21,6 +21,7 @@
     1.4  class BranchItem;
     1.5  class FindResultModel;
     1.6  class MapEditor;
     1.7 +class Link;
     1.8  class XLinkItem;
     1.9  
    1.10  class VymModel :  public TreeModel {		
    1.11 @@ -46,7 +47,7 @@
    1.12      void init();
    1.13  	void makeTmpDirectories();		//!< create temporary directories e.g. for history
    1.14  
    1.15 -	MapEditor* getMapEditor();			// FIXME-2 still necessary?
    1.16 +	MapEditor* getMapEditor();			
    1.17  	uint getID();						//! Return unique ID of model
    1.18  
    1.19  	bool isRepositionBlocked();		//!< While load or undo there is no need to update graphicsview
    1.20 @@ -83,7 +84,7 @@
    1.21      QString saveToDir (const QString &tmpdir, const QString &prefix, bool writeflags, const QPointF &offset, TreeItem *saveSel);
    1.22  
    1.23  	/*! Save all data in tree*/
    1.24 -	QString saveTreeToDir (const QString&,const QString&,const QPointF&);// Save data recursivly to tempdir
    1.25 +	QString saveTreeToDir (const QString&,const QString&,const QPointF&,QList <Link*> &tmpLinks);// Save data recursivly to tempdir
    1.26  
    1.27  
    1.28  	/*! \brief Sets filepath, filename and mapname
    1.29 @@ -110,17 +111,19 @@
    1.30  		The data is read from file. Depending on LoadMode the current
    1.31  		selection gets replaced by data or the data is appended.
    1.32  	*/	
    1.33 -    ErrorCode load (QString, const LoadMode &, const FileType& );	// newmap, import/replace selection
    1.34 +    ErrorCode loadMap  (
    1.35 +		QString,						//!< Path
    1.36 +		const LoadMode &lmode=NewMap,	//!< New map, replace or add to selection
    1.37 +		bool saveStateFlag=true,		//!< If called internally for history, don't save
    1.38 +		const FileType &ftype=VymMap,	//!< VymMap or FreeMind
    1.39 +		int pos=-1						//!< Optionally tell position where to add data
    1.40 +	);	
    1.41  
    1.42  public:
    1.43  	/*! \brief Save the map to file */
    1.44      ErrorCode save(const SaveMode &);	
    1.45  
    1.46  private:
    1.47 -    void addMapReplaceInt(const QString & undoSel, const QString & path);
    1.48 -    bool addMapInsertInt (const QString & path);
    1.49 -    bool addMapInsertInt (const QString & path, int pos);
    1.50 -
    1.51  	ImageItem* loadFloatImageInt (BranchItem *dst,QString);
    1.52  	void saveFloatImageInt (ImageItem*, const QString &, const QString &);
    1.53  public:	
    1.54 @@ -321,7 +324,9 @@
    1.55  	BranchItem* createMapCenter();				//!< Create MapCenter 
    1.56  	BranchItem* createBranch(BranchItem *dst);	//!< Create Branch
    1.57  	ImageItem* createImage(BranchItem *dst);	//!< Create image
    1.58 -	XLinkItem* createXLink(BranchItem *dst,bool createMO=false);	//!< Create XLink starting at dst
    1.59 +
    1.60 +public:	
    1.61 +	bool createLink(Link *l, bool createMO=false);			//!< Create XLink 
    1.62  
    1.63  	AttributeItem* addAttribute();
    1.64  	AttributeItem* addAttribute(AttributeItem* );
    1.65 @@ -366,15 +371,20 @@
    1.66  	bool relinkBranch (BranchItem* branch, BranchItem* dst, int pos =-1);	
    1.67  	bool relinkImage  (ImageItem* image, BranchItem* dst);	
    1.68  
    1.69 +private:
    1.70 +	bool cleaningUpLinks;				//!< True while cleaning up to avoid recursion
    1.71 +public:	
    1.72 +	void cleanupLinks();				//!< Delete orphaned XLinkItems
    1.73      void deleteSelection();				//!< Delete selection
    1.74 -	void deleteKeepChildren();			//!< remove branch, but keep children
    1.75 +	void deleteKeepChildren(bool saveStateFlag=true);	//!< remove branch, but keep children
    1.76 +public:	
    1.77  	void deleteChildren();				//!< keep branch, but remove children
    1.78  
    1.79  	TreeItem* deleteItem(TreeItem*);	//!< Delete item and return parent (if parent!= rootItem)
    1.80 +	void deleteLink (Link*);			//!< Remove Link and related LinkItems in TreeModel
    1.81  	void clearItem (TreeItem* ti);		//!< Remove all children of TreeItem ti
    1.82  	bool scrollBranch(BranchItem *);
    1.83  	bool unscrollBranch(BranchItem *);
    1.84 -public:	
    1.85      void toggleScroll();
    1.86      void unscrollChildren();
    1.87  	void emitExpandAll();
    1.88 @@ -406,7 +416,7 @@
    1.89  	QString getVymLink();					// return path to map
    1.90  	QStringList getVymLinks();				// return paths in subtree
    1.91  	void followXLink (int);
    1.92 -	void editXLink (int);
    1.93 +	void editXLink (int i=0);
    1.94  
    1.95  
    1.96  
    1.97 @@ -536,6 +546,7 @@
    1.98  	void startAnimation(BranchObj *bo, const QPointF &v);
    1.99  	void startAnimation(BranchObj *bo, const QPointF &start, const QPointF &dest);
   1.100  	void stopAnimation(MapObj *mo);
   1.101 +	void stopAllAnimation();
   1.102  
   1.103  ////////////////////////////////////////////
   1.104  // Network related 
   1.105 @@ -631,6 +642,7 @@
   1.106  	QString getSelectString ();
   1.107  	QString getSelectString (LinkableMapObj *lmo);
   1.108  	QString getSelectString (TreeItem *item);
   1.109 +	QString getSelectString (BranchItem *item);
   1.110  	
   1.111  	
   1.112  signals: