Bugfix: no undo for deleted mapcenters release-1-12-maintained
authorinsilmaril
Thu Jul 30 07:40:05 2009 +0000 (2009-07-30)
branchrelease-1-12-maintained
changeset 7498449ef9eccd
parent 73 41937601b3b8
child 75 dbb2a175f7b5
Bugfix: no undo for deleted mapcenters
mapeditor.cpp
mapeditor.h
selection.cpp
tex/vym.changelog
version.h
xml-vym.cpp
     1.1 --- a/mapeditor.cpp	Mon Jul 27 12:53:19 2009 +0000
     1.2 +++ b/mapeditor.cpp	Thu Jul 30 07:40:05 2009 +0000
     1.3 @@ -249,7 +249,9 @@
     1.4  		
     1.5  		s=(((BranchObj*)lmo)->getHeading());
     1.6  		if (s=="") s="unnamed";
     1.7 -		return QString("branch (%1)").arg(s);
     1.8 +		if ((typeid(*lmo) == typeid(BranchObj) ) )
     1.9 +			return QString("branch (%1)").arg(s);
    1.10 +		return QString("mapcenter (%1)").arg(s);
    1.11  	}	
    1.12  	if ((typeid(*lmo) == typeid(FloatImageObj) ))
    1.13  		return QString ("floatimage [%1]").arg(((FloatImageObj*)lmo)->getOriginalFilename());
    1.14 @@ -321,12 +323,15 @@
    1.15  	FloatImageObj (mapScene).resetSaveCounter();
    1.16  
    1.17  	// Build xml recursivly
    1.18 -	if (!saveSel || typeid (*saveSel) == typeid (MapCenterObj))
    1.19 +	if (!saveSel )
    1.20  		// Save complete map, if saveSel not set
    1.21  		s+=model->saveToDir(tmpdir,prefix,writeflags,offset);
    1.22  	else
    1.23  	{
    1.24 -		if ( typeid(*saveSel) == typeid(BranchObj) )
    1.25 +		if ( typeid (*saveSel) == typeid (MapCenterObj))
    1.26 +			// Save Subtree
    1.27 +			s+=((MapCenterObj*)saveSel)->saveToDir(tmpdir,prefix,0,offset);
    1.28 +		else if ( typeid(*saveSel) == typeid(BranchObj) )
    1.29  			// Save Subtree
    1.30  			s+=((BranchObj*)saveSel)->saveToDir(tmpdir,prefix,offset);
    1.31  		else 
    1.32 @@ -471,10 +476,12 @@
    1.33  		qWarning ("MapEditor::saveStateRemovingPart  no redoSel given!");
    1.34  		return;
    1.35  	}
    1.36 -	QString undoSelection=model->getSelectString (redoSel->getParObj());
    1.37 +	
    1.38 +	QString undoSelection;
    1.39  	QString redoSelection=model->getSelectString(redoSel);
    1.40  	if (typeid(*redoSel) == typeid(BranchObj)  ) 
    1.41  	{
    1.42 +		undoSelection=model->getSelectString (redoSel->getParObj());
    1.43  		// save the selected branch of the map, Undo will insert part of map 
    1.44  		saveState (PartOfMap,
    1.45  			undoSelection, QString("addMapInsert (\"PATH\",%1)").arg(((BranchObj*)redoSel)->getNum()),
    1.46 @@ -482,6 +489,16 @@
    1.47  			comment, 
    1.48  			redoSel);
    1.49  	}
    1.50 +	if (typeid(*redoSel) == typeid(MapCenterObj)  ) 
    1.51 +	{
    1.52 +		undoSelection.clear();
    1.53 +		// save the selected branch of the map, Undo will insert part of map 
    1.54 +		saveState (PartOfMap,
    1.55 +			undoSelection, QString("addMapInsert (\"PATH\")"),
    1.56 +			redoSelection, "delete ()", 
    1.57 +			comment, 
    1.58 +			redoSel);
    1.59 +	}
    1.60  }
    1.61  
    1.62  
    1.63 @@ -611,21 +628,26 @@
    1.64  	/////////////////////////////////////////////////////////////////////
    1.65  	} else if (com==QString("addMapInsert"))
    1.66  	{
    1.67 -		if (xelection.isEmpty())
    1.68 +		if (parser.parCount()==2)
    1.69  		{
    1.70 -			parser.setError (Aborted,"Nothing selected");
    1.71 -		} else if (! selb )
    1.72 -		{				  
    1.73 -			parser.setError (Aborted,"Type of selection is not a branch");
    1.74 -		} else 
    1.75 -		{	
    1.76 -			if (parser.checkParCount(2))
    1.77 +			if (xelection.isEmpty())
    1.78 +			{
    1.79 +				parser.setError (Aborted,"Nothing selected");
    1.80 +			} else if (! selb )
    1.81 +			{				  
    1.82 +				parser.setError (Aborted,"Type of selection is not a branch");
    1.83 +			} else
    1.84  			{
    1.85  				t=parser.parString (ok,0);	// path to map
    1.86  				n=parser.parInt(ok,1);		// position
    1.87  				if (QDir::isRelativePath(t)) t=(tmpMapDir + "/"+t);
    1.88 -				addMapInsertInt(t,n);	
    1.89 +				addMapInsertInt(t,n);
    1.90  			}
    1.91 +		} else if (parser.parCount ()==1)
    1.92 +		{
    1.93 +			t=parser.parString (ok,0);	// path to map
    1.94 +			if (QDir::isRelativePath(t)) t=(tmpMapDir + "/"+t);
    1.95 +			addMapInsertInt(t);	
    1.96  		}
    1.97  	/////////////////////////////////////////////////////////////////////
    1.98  	} else if (com=="clearFlags")
    1.99 @@ -2312,8 +2334,7 @@
   1.100  	QString bakMapDir(QString(tmpMapDir+"/undo-%1").arg(curStep));
   1.101  
   1.102  	// select  object before undo
   1.103 -	if (!undoSelection.isEmpty())
   1.104 -		select (undoSelection);
   1.105 +	select (undoSelection);
   1.106  
   1.107  	if (debug)
   1.108  	{
   1.109 @@ -2430,40 +2451,56 @@
   1.110  		QMessageBox::critical( 0, tr( "Critical Error" ), tr("Could not read %1").arg(path));
   1.111  }
   1.112  
   1.113 -void MapEditor::addMapInsertInt (const QString &path, int pos)
   1.114 +bool MapEditor::addMapInsertInt (const QString &path)
   1.115 +{
   1.116 +	QString pathDir=path.left(path.findRev("/"));
   1.117 +	QDir d(pathDir);
   1.118 +	QFile file (path);
   1.119 +
   1.120 +	if (d.exists() )
   1.121 +	{
   1.122 +		// We need to parse saved XML data
   1.123 +		parseVYMHandler handler;
   1.124 +		QXmlInputSource source( file);
   1.125 +		QXmlSimpleReader reader;
   1.126 +		reader.setContentHandler( &handler );
   1.127 +		reader.setErrorHandler( &handler );
   1.128 +		handler.setModel (model);
   1.129 +		handler.setTmpDir ( pathDir );	// needed to load files with rel. path
   1.130 +		handler.setLoadMode (ImportAdd);
   1.131 +		blockReposition=true;
   1.132 +		bool ok = reader.parse( source );
   1.133 +		blockReposition=false;
   1.134 +		if ( ok ) return true;	
   1.135 +
   1.136 +		// This should never ever happen
   1.137 +		QMessageBox::critical( 0, tr( "Critical Parse Error while reading %1").arg(path),
   1.138 +								handler.errorProtocol());
   1.139 +	} else	
   1.140 +		QMessageBox::critical( 0, tr( "Critical Error" ), tr("Could not read %1").arg(path));
   1.141 +	return false;	
   1.142 +}
   1.143 +
   1.144 +bool MapEditor::addMapInsertInt (const QString &path, int pos)
   1.145  {
   1.146  	BranchObj *sel=xelection.getBranch();
   1.147  	if (sel)
   1.148  	{
   1.149 -		QString pathDir=path.left(path.findRev("/"));
   1.150 -		QDir d(pathDir);
   1.151 -		QFile file (path);
   1.152 -
   1.153 -		if (d.exists() )
   1.154 +		if (addMapInsertInt (path))
   1.155  		{
   1.156 -			// We need to parse saved XML data
   1.157 -			parseVYMHandler handler;
   1.158 -			QXmlInputSource source( file);
   1.159 -			QXmlSimpleReader reader;
   1.160 -			reader.setContentHandler( &handler );
   1.161 -			reader.setErrorHandler( &handler );
   1.162 -			handler.setModel (model);
   1.163 -			handler.setTmpDir ( pathDir );	// needed to load files with rel. path
   1.164 -			handler.setLoadMode (ImportAdd);
   1.165 -			blockReposition=true;
   1.166 -			bool ok = reader.parse( source );
   1.167 -			blockReposition=false;
   1.168 -			if (! ok ) 
   1.169 -			{	
   1.170 -				// This should never ever happen
   1.171 -				QMessageBox::critical( 0, tr( "Critical Parse Error while reading %1").arg(path),
   1.172 -										handler.errorProtocol());
   1.173 +			{
   1.174 +				if (sel->getDepth()>0)
   1.175 +					sel->getLastBranch()->linkTo (sel,pos);
   1.176  			}
   1.177 -			if (sel->getDepth()>0)
   1.178 -				sel->getLastBranch()->linkTo (sel,pos);
   1.179 +			return true;
   1.180  		} else	
   1.181 +		{
   1.182  			QMessageBox::critical( 0, tr( "Critical Error" ), tr("Could not read %1").arg(path));
   1.183 +			return false;
   1.184 +		}	
   1.185  	}		
   1.186 +	qWarning ("ME::addMapInsertInt nothing selected");
   1.187 +	return false;
   1.188  }
   1.189  
   1.190  void MapEditor::pasteNoSave(const int &n)
   1.191 @@ -2828,11 +2865,8 @@
   1.192  	BranchObj *bo = xelection.getBranch();
   1.193  	if (bo && xelection.type()==Selection::MapCenter)
   1.194  	{
   1.195 -	//	BranchObj* par=(BranchObj*)(bo->getParObj());
   1.196  		xelection.unselect();
   1.197 -	/* FIXME Note:  does saveStateRemovingPart work for MCO? (No parent!)
   1.198  		saveStateRemovingPart (bo, QString ("Delete %1").arg(getName(bo)));
   1.199 -		*/
   1.200  		bo=model->removeMapCenter ((MapCenterObj*)bo);
   1.201  		if (bo) 
   1.202  		{
   1.203 @@ -2852,7 +2886,6 @@
   1.204  		xelection.select (par);
   1.205  		ensureSelectionVisible();
   1.206  		model->reposition();
   1.207 -//		xelection.update();
   1.208  		xelection.update();
   1.209  		return;
   1.210  	}
     2.1 --- a/mapeditor.h	Mon Jul 27 12:53:19 2009 +0000
     2.2 +++ b/mapeditor.h	Thu Jul 30 07:40:05 2009 +0000
     2.3 @@ -1,88 +1,278 @@
     2.4  #ifndef MAPEDITOR_H
     2.5  #define MAPEDITOR_H
     2.6  
     2.7 -#include <qcanvas.h>
     2.8 -#include <qlineedit.h>
     2.9 -#include <qcursor.h>
    2.10 -#include <qfiledialog.h>
    2.11 -#include <qevent.h>
    2.12 -#include <qprocess.h>
    2.13 +#include <QGraphicsView>
    2.14 +#include <QtNetwork>
    2.15  
    2.16 -#include "mapcenterobj.h"
    2.17 +#include "attribute.h"
    2.18 +#include "file.h"
    2.19  #include "misc.h"
    2.20 +#include "parser.h"
    2.21 +#include "ornamentedobj.h"
    2.22 +#include "selection.h"
    2.23 +#include "settings.h"
    2.24 +#include "vymmodel.h"
    2.25  
    2.26 -class MapEditor : public QCanvasView , public xmlObj {
    2.27 +class VymModel;
    2.28 +class Selection;
    2.29 +
    2.30 +/*! \brief Main widget in vym to display and edit a map */
    2.31 +
    2.32 +class MapEditor : public QGraphicsView, public XMLObj {
    2.33      Q_OBJECT
    2.34  
    2.35  public:
    2.36 -    MapEditor(QWidget* parent=0, bool interactive=false, const char* name=0, WFlags f=0);
    2.37 +    /*! \brief State of the mapeditor 
    2.38 +		
    2.39 +		While a heading is edited, the state has to change, so
    2.40 +		that e.g. no other object might get selected. This is done
    2.41 +		in Main by calling setStateEditHeading
    2.42 +	*/
    2.43 +	enum State {
    2.44 +		Idle,			//!< Idle, waiting for user event
    2.45 +		EditHeading		//!< Editing heading (dont't select another branch now)
    2.46 +	};
    2.47 +    /*! \brief Networking states
    2.48 +		
    2.49 +		In Network modus we want to switch of saveState, autosave, ...
    2.50 +	*/
    2.51 +	enum NetState {
    2.52 +		Offline,			//!< Offline
    2.53 +		Client,				//!< I am the client and connected to server
    2.54 +		Server				//!< I am the server
    2.55 +	};
    2.56 +    MapEditor(QWidget* parent=0);
    2.57  	~MapEditor();
    2.58 -    QColor color();
    2.59 -    QColor backgroundColor();
    2.60 -    MapCenterObj* getMapCenter();
    2.61 -	QCanvas* getCanvas();
    2.62 -	void adjustCanvasSize();// adjust canvas size to map and scrollview
    2.63 -	bool blockReposition(); // block while load or undo
    2.64 +	VymModel* getModel();
    2.65 +	QGraphicsScene * getScene();
    2.66 +	State getState();					//!< Return State of MapEditor
    2.67 +	void setStateEditHeading (bool);	//!< If set to true, State will change to EditHeading
    2.68 +	bool isRepositionBlocked(); //!< While load or undo there is no need to update graphicsview
    2.69 +	bool isSaveStateBlocked();			//!< block while undo/redo or while running scripts
    2.70 +	void setSaveStateBlocked(bool);		//!< block saving the undo/redo state
    2.71 +	bool isSelectBlocked();		//!< true, if no change of selection is possible, e.g. while editing the heading of abranch
    2.72  	
    2.73 +protected:
    2.74 +	/*! \brief Get name of object
    2.75 +	  
    2.76 +	  Returns heading of a branch or name of an object for use in comment
    2.77 +	  of undo/redo history
    2.78 +	*/ 
    2.79 +	QString getName(const LinkableMapObj*);	// Get e.g. heading or filename
    2.80 +	void makeTmpDirs();		// create temporary directories
    2.81 +
    2.82 +	/*! This function saves all information of the map to disc.
    2.83 +	    saveToDir also calls the functions for all BranchObj and other objects in the map.
    2.84 +		The structure of the map itself is returned as QString and passed back to Main, 
    2.85 +		where saveToDir is called initially
    2.86 +	*/	
    2.87 +    QString saveToDir (const QString &tmpdir, const QString &prefix, bool writeflags, const QPointF &offset, LinkableMapObj *saveSel);
    2.88 +
    2.89 +	/*! \brief Get directory, where current step in history is save
    2.90 +
    2.91 +		saveState creates a directory for each step in history. This function returns the
    2.92 +		path of the current directory
    2.93 +	*/
    2.94 +	QString getHistoryDir();
    2.95 +
    2.96 +	/*! \brief Save the current changes in map 
    2.97 +
    2.98 +		Two commands and selections are saved:
    2.99 +
   2.100 +			- undocommand and undoselection to undo the change
   2.101 +			- redocommand and redoselection to redo the action after an undo
   2.102 +
   2.103 +		Additionally a comment is logged. 
   2.104 +
   2.105 +	*/	
   2.106 +    void saveState(
   2.107 +		const SaveMode& savemode, 
   2.108 +		const QString &undoSelection, 
   2.109 +		const QString &undoCommand, 
   2.110 +		const QString &redoSelection, 
   2.111 +		const QString &redoCommand, 
   2.112 +		const QString &comment, 
   2.113 +		LinkableMapObj *saveSelection);
   2.114 +	/*! Overloaded for convenience */
   2.115 +    void saveStateChangingPart(
   2.116 +		LinkableMapObj *undoSelection, 
   2.117 +		LinkableMapObj* redoSelection, 
   2.118 +		const QString &redoCommand, 
   2.119 +		const QString &comment);
   2.120 +	/*! Overloaded for convenience */
   2.121 +    void saveStateRemovingPart(
   2.122 +		LinkableMapObj *redoSelection, 
   2.123 +		const QString &comment);
   2.124 +	/*! Overloaded for convenience */
   2.125 +    void saveState(
   2.126 +		LinkableMapObj *undoSelection, 
   2.127 +		const QString &undoCommand, 
   2.128 +		LinkableMapObj *redoSelection, 
   2.129 +		const QString &redoCommand, 
   2.130 +		const QString &comment); 
   2.131 +	/*! Overloaded for convenience */
   2.132 +    void saveState(
   2.133 +		const QString &undoSelection, 
   2.134 +		const QString &undoCommand, 
   2.135 +		const QString &redoSelection, 
   2.136 +		const QString &redoCommand, 
   2.137 +		const QString &comment) ;
   2.138 +    void saveState(
   2.139 +		const QString &undoCommand, 
   2.140 +		const QString &redoCommand, 
   2.141 +		const QString &comment) ;
   2.142 +
   2.143 +public:	
   2.144 +
   2.145 +	/* \brief Process one command and its parameters */
   2.146 +    void parseAtom (const QString &atom);	
   2.147 +
   2.148 +	/* \brief Runs the script */
   2.149 +	void runScript (QString script);
   2.150  private:
   2.151 -	void makeTmpDirs();		// create temporary directories
   2.152 -	void delTmpDirs();		// delete temporary directories
   2.153 -	void makeSubDirs(const QString&);		
   2.154 -							// create subdirs in dir
   2.155 -    QString saveToDir(const QString&,const QString &,bool, const QPoint
   2.156 -	&,SaveMode);
   2.157 -    void saveState();		// save actual state to backup
   2.158 -    void saveState(const SaveMode&, LinkableMapObj *);
   2.159 -
   2.160 -private slots:
   2.161 -    void finishedLineEditNoSave();
   2.162 +    void addFloatImageInt(const QPixmap &img);
   2.163  
   2.164  public:
   2.165 -	bool isDefault();		// false, if map was changed once
   2.166 -    bool isUnsaved();		// save necessary
   2.167 -    bool hasChanged();		// undo possible
   2.168 -	void setChanged();		// called from NoteEditor via LMO
   2.169 -	void closeMap();
   2.170 -	void setFilePath (QString);	
   2.171 -	void setFilePath (QString,QString);	
   2.172 -	QString getFilePath ();	// Full path e.g. "/home/tux/map.xml"
   2.173 -	QString getFileName ();	// e.g. "map.xml"
   2.174 -	QString getMapName ();	// e.g. "map"
   2.175 -	QString getDestPath (); // e.g. "/home/tux/map.vym"
   2.176 -    int load (QString&, const LoadMode &);	// newmap, import/replace selection
   2.177 -    int save(const SaveMode &);	// Save map 
   2.178 -	void setZipped(bool);		// save map zipped
   2.179 -	bool saveZipped();			// 1 if file will be saved zipped
   2.180 -    void print();				// print canvas
   2.181 +	bool isDefault();		//!< true, if map is still the empty default map
   2.182 +    bool hasChanged();		//!< true, if something has changed and is not saved yet
   2.183 +	void setChanged();		//!< called from TextEditor via LinkableMapObj
   2.184 +	void closeMap();		//!< Closes the map
   2.185 +
   2.186 +	/*! \brief Sets filepath, filename and mapname
   2.187 +
   2.188 +	     If the filepath is "/home/tux/map.xml", then the filename will be set
   2.189 +		 to map.xml. The destname is needed for vymLinks, pointing to another map. 
   2.190 +		 The destname holds the real name of the file, after it has been compressed, e.g. "map.vym"
   2.191 +	*/	 
   2.192 +
   2.193 +	/*! \brief Set File path
   2.194 +
   2.195 +	     The destname is needed to construct the references between maps
   2.196 +	*/	 
   2.197 +	void setFilePath (QString filepath,QString destname);	
   2.198 +	void setFilePath (QString);	//!< Overloaded for convenience
   2.199 +	QString getFilePath ();	//!< Full path e.g. "/home/tux/map.xml"
   2.200 +	QString getFileName ();	//!< e.g. "map.xml"
   2.201 +	QString getMapName ();	//!< e.g. "map"
   2.202 +	QString getDestPath (); //!< e.g. "/home/tux/map.vym"
   2.203 +
   2.204 +	/*! \brief Load map
   2.205 +
   2.206 +		The data is read from file. Depending on LoadMode the current
   2.207 +		selection gets replaced by data or the data is appended.
   2.208 +	*/	
   2.209 +    ErrorCode load (QString, const LoadMode &, const FileType& );	// newmap, import/replace selection
   2.210 +public:
   2.211 +	/*! \brief Save the map to file */
   2.212 +    ErrorCode save(const SaveMode &);	
   2.213 +	/* FIXME no needed any longer
   2.214 +	void setZipped(bool);		//!< Set or unset compression of map with zip save map zipped
   2.215 +	bool saveZipped();			//!< True, if file will be saved zipped
   2.216 +	*/
   2.217 +    void print();				//!< Print the map
   2.218 +	void setAntiAlias (bool);	//!< Set or unset antialiasing
   2.219 +	void setSmoothPixmap(bool); //!< Set or unset smoothing of pixmaps
   2.220  private:
   2.221      QPixmap getPixmap();
   2.222 +	void setHideTmpMode (HideTmpMode);	// temporary hide stuff
   2.223 +	HideTmpMode getHideTmpMode();		// temporary hide stuff
   2.224  public:
   2.225 -    void exportImage (QString fn);		// export as PNG	
   2.226 -    void exportImage (QString fn, int);	// export in given format
   2.227 -    void exportASCII();
   2.228 -    void exportXML(const QString&);		// export to directory
   2.229 -    void clear();		// clear map
   2.230 -    void undo();		// undo last action
   2.231 -    void copy();		// copy branch to clipboard
   2.232 +	/*! Set or unset temporary hiding of objects during export  */
   2.233 +	void setExportMode (bool);
   2.234 +
   2.235 +	/*! Export as ASCII text to file */
   2.236 +	void exportASCII (QString fname="",bool askForName=true);  
   2.237 +
   2.238 +	/*! Save as image */
   2.239 +    void exportImage (QString fname="",bool askForName=true,QString format="PNG");
   2.240 +
   2.241 +    /*! Export as OpenOfficeOrg presentation */
   2.242 +    void exportOOPresentation(const QString &,const QString &);	
   2.243 +
   2.244 +	/*! Export as XHTML to directory */
   2.245 +    void exportXHTML(const QString& dir="", bool askForName=true);	
   2.246 +
   2.247 +	/*! Export as XTML to directory */
   2.248 +    void exportXML(QString dir="", bool askForName=true);
   2.249 +
   2.250 +    void clear();						//!< Clear map
   2.251 +    void copy();						//!< Copy to clipboard
   2.252 +    void redo();						//!< Redo last action
   2.253 +	bool isRedoAvailable();				//!< True, if redo is available
   2.254 +    void undo();						//!< Undo last action
   2.255 +	bool isUndoAvailable();				//!< True, if undo is available
   2.256 +	void gotoHistoryStep (int);			//!< Goto a specifig step in history
   2.257  private:	
   2.258 -    LinkableMapObj* pasteNoSave();		// paste clipboard to branch
   2.259 -    LinkableMapObj* pasteAtNoSave(int);	// paste clipboard to branch at position i
   2.260 -    void cutNoSave();	// cut to clipboard
   2.261 +    void addMapReplaceInt(const QString & undoSel, const QString & path);
   2.262 +    bool addMapInsertInt (const QString & path);
   2.263 +    bool addMapInsertInt (const QString & path, int pos);
   2.264 +    void pasteNoSave(const int &n);		//!< paste clipboard to branch
   2.265  public:	
   2.266 -    void paste();		// paste clipboard to branch and backup
   2.267 -    void cut();			// cut to clipboard and backup
   2.268 -    void moveBranchUp();
   2.269 -    void moveBranchDown();
   2.270 -    void editHeading();
   2.271 -    void addNewBranch(int);			// pos allows to add above/below selection
   2.272 -    void deleteSelection();
   2.273 -	LinkableMapObj* getSelection();	// returns selection
   2.274 -	bool select(QString );			// Select 
   2.275 -	void unselect();				// before changing current noteedit
   2.276 -	void reselect();				// after  changing current noteedit
   2.277 +    void paste();		//!< Paste clipboard to branch and backup
   2.278 +    void cut();			//!< Cut to clipboard (and copy)
   2.279 +	/*! \brief Move absolutly
   2.280 +
   2.281 +		Move absolutly to (x,y).
   2.282 +	*/	
   2.283 +    void move    (const double &x, const double &y);
   2.284 +	/*! \brief Move relativly
   2.285 +
   2.286 +		Move relativly to (x,y).
   2.287 +	*/	
   2.288 +    void moveRel (const double &x, const double &y);
   2.289 +    void moveBranchUp();	//!< Move branch up
   2.290 +    void moveBranchDown();	//!< Move branch down
   2.291 +	void sortChildren();	//!< Sort children lexically
   2.292  private:	
   2.293 -	void selectNextBranch();		// Increment number of branch
   2.294 -	void selectPrevBranch();		// Decrement number of branch
   2.295 +	void linkTo(const QString &);
   2.296 +public:	
   2.297 +	QString getHeading (bool &ok,QPoint &p); //!< Get heading, ok if selection is branch
   2.298 +	void setHeading(const QString &);		//!< Set heading of branch	
   2.299 +private:
   2.300 +	void setHeadingInt(const QString &);
   2.301 +	void setVymLinkInt(const QString &);	// Set vymLink for selection
   2.302 +	/*! \brief Add new mapcenter
   2.303 +
   2.304 +	    Disclaimer: Still experimental, not fully supported.
   2.305 +	*/	
   2.306 +public:	
   2.307 +    BranchObj* addMapCenter();		
   2.308 +
   2.309 +	/*! \brief Add new branch
   2.310 +
   2.311 +		Depending on num the new branch is created
   2.312 +
   2.313 +		-3 above selection as child of selections parent
   2.314 +		-2 as child of selection
   2.315 +		-1 below selection as child of selections parent
   2.316 +		0..n	insert at a specific position in selections parent
   2.317 +		(needed for free relinking)
   2.318 +	*/	
   2.319 +private:	
   2.320 +    BranchObj* addNewBranchInt(int);		// pos allows to add above/below selection
   2.321 +public:	
   2.322 +	/*! \Add new branch
   2.323 +		
   2.324 +		Depending on num the new branch is created
   2.325 +		-1 above selection
   2.326 +		 0 as child of selection
   2.327 +		 1 below selection
   2.328 +	*/
   2.329 +    BranchObj* addNewBranch(int pos);		
   2.330 +    BranchObj* addNewBranchBefore();		//!< Insert branch between selection and its parent
   2.331 +    void deleteSelection();					//!< Delete selection
   2.332 +	LinkableMapObj* getSelection();			//!< Returns selection
   2.333 +	BranchObj* getSelectedBranch();			// returns selected branch or NULL
   2.334 +	FloatImageObj* getSelectedFloatImage();	// returns selected branch or NULL
   2.335 +	void unselect();						// before changing current noteedit
   2.336 +	void reselect();						// after  changing current noteedit
   2.337 +	bool select(const QString &);			// Select by string
   2.338 +	bool select(LinkableMapObj *lmo);		// Select by pointer
   2.339 +	QString getSelectString();
   2.340 +private:	
   2.341 +	void selectInt(LinkableMapObj*);	
   2.342 +	void selectNextBranchInt();		// Increment number of branch
   2.343 +	void selectPrevBranchInt();		// Decrement number of branch
   2.344  public:	
   2.345      void selectUpperBranch();
   2.346      void selectLowerBranch();
   2.347 @@ -90,108 +280,215 @@
   2.348      void selectRightBranch();
   2.349      void selectFirstBranch();
   2.350      void selectLastBranch();
   2.351 -    void setColor(QColor);
   2.352 -    void selectBackgroundColor();
   2.353 -    void setBackgroundColor(QColor);
   2.354 -    QColor pickColor();
   2.355 -    void colorItem();
   2.356 -    void colorBranch();
   2.357 +    void selectMapBackgroundImage();
   2.358 +    void setMapBackgroundImage(const QString &);
   2.359 +    void selectMapBackgroundColor();
   2.360 +    void setMapBackgroundColor(QColor);
   2.361 +    QColor getMapBackgroundColor();
   2.362 +    QColor getCurrentHeadingColor();
   2.363 +    void colorBranch(QColor);
   2.364 +    void colorSubtree(QColor);
   2.365  	void toggleStandardFlag(QString);
   2.366 -	virtual void setViewCenter();			// needed for zooming
   2.367      BranchObj* findText(QString,bool);		// Find object
   2.368      void findReset();						// Reset Find 
   2.369 -	void openURL();							// open URL in external browser
   2.370 -	void editURL();							// edit the URL
   2.371 +	void setURL(const QString &);			// set  URL
   2.372 +	void editURL();							// edit URL
   2.373 +	void editLocalURL();					// edit URL to local file
   2.374 +	QString getURL();						// returns URL of selection or ""
   2.375 +	QStringList getURLs();					// returns URLs of subtree
   2.376  	void editHeading2URL();					// copy heading to URL
   2.377  	void editBugzilla2URL();				// create URL to Bugzilla
   2.378 +	void editFATE2URL();					// create URL to FATE
   2.379  	void editVymLink();						// edit link to another map
   2.380  	void deleteVymLink();					// delete link to another map
   2.381  	QString getVymLink();					// return path to map
   2.382 +	QStringList getVymLinks();				// return paths in subtree
   2.383 +	void setHideExport(bool);				// toggle the export flag
   2.384 +	void toggleHideExport();				// toggle the export flag
   2.385 +	void deleteKeepChilds();				// remove but keep childs
   2.386 +	void deleteChilds();					// remove childs
   2.387  	void editMapInfo();						// dialog to enter author, ...
   2.388 +	void ensureSelectionVisible();		
   2.389 +	void updateSelection();					// update geometry of selection
   2.390  	void updateActions();					// update e.g. format buttons
   2.391 -	void setLinkStyle (LinkStyle);			// Set style of link
   2.392 -	LinkStyle getLinkStyle ();				// requested in LMO
   2.393 -	void setLinkColor(QColor);				// default color of links
   2.394 -	void setLinkColorHint();				// color of links
   2.395 -	void setLinkColorHint(LinkColorHint);	// color of links
   2.396 -	LinkColorHint getLinkColorHint();
   2.397 -	QColor getDefLinkColor();
   2.398 -	void toggleLinkColorHint();				// after changing linkStyles
   2.399 -    void selectLinkColor();
   2.400 +	void updateNoteFlag();					// when TextEditor changes
   2.401 +	void setMapAuthor (const QString &);
   2.402 +	void setMapComment(const QString &);
   2.403 +	void setMapLinkStyle (const QString &);	// Set style of link
   2.404 +	LinkableMapObj::Style getMapLinkStyle ();	// requested in LMO
   2.405 +	void setMapDefLinkColor(QColor);		// default color of links
   2.406 +	void setMapLinkColorHintInt();			// color of links
   2.407 +	void setMapLinkColorHint(LinkableMapObj::ColorHint);// color of links
   2.408 +	LinkableMapObj::ColorHint getMapLinkColorHint();
   2.409 +	QColor getMapDefLinkColor();
   2.410 +	void setMapDefXLinkColor(QColor);
   2.411 +	QColor getMapDefXLinkColor();
   2.412 +	void setMapDefXLinkWidth (int);
   2.413 +	int getMapDefXLinkWidth();
   2.414 +	void toggleMapLinkColorHint();			// after changing linkStyles
   2.415 +    void selectMapLinkColor();
   2.416 +    void selectMapSelectionColor();
   2.417 +private:	
   2.418 +    void setSelectionColorInt(QColor);
   2.419 +public:	
   2.420 +    void setSelectionColor(QColor);
   2.421 +    QColor getSelectionColor();
   2.422 +	bool scrollBranch(BranchObj*);
   2.423 +	bool unscrollBranch(BranchObj*);
   2.424      void toggleScroll();
   2.425 -    void unScrollAll();
   2.426 +    void unscrollChilds();
   2.427 +private:	
   2.428 +	FloatImageObj* loadFloatImageInt (QString);
   2.429 +public:	
   2.430  	void loadFloatImage ();
   2.431 -	void saveFloatImage (int);
   2.432 -	void toggleFloatExport();
   2.433 -	void setFrame(const FrameType &);
   2.434  private:	
   2.435 -    void importDir(BranchObj *,QDir);
   2.436 +	void saveFloatImageInt (FloatImageObj*, const QString &, const QString &);
   2.437 +public:	
   2.438 +	void saveFloatImage ();
   2.439 +	void setFrameType(const FrameObj::FrameType &);
   2.440 +	void setFrameType(const QString &);
   2.441 +	void setFramePenColor (const QColor &);
   2.442 +	void setFrameBrushColor (const QColor &);
   2.443 +	void setFramePadding (const int &);
   2.444 +	void setFrameBorderWidth (const int &);
   2.445 +	void setIncludeImagesVer(bool);
   2.446 +	void setIncludeImagesHor(bool);
   2.447 +	void setHideLinkUnselected (bool);
   2.448 +	bool getHideLinkUnselected ();
   2.449 +private:	
   2.450 +    void importDirInt(BranchObj *,QDir);
   2.451 +    void importDirInt(const QString&);
   2.452  public:	
   2.453      void importDir();
   2.454 -    void testFunction();				// FIXME just testing
   2.455 +	void followXLink (int);
   2.456 +	void editXLink (int);
   2.457 +	AttributeTable* attributeTable();
   2.458 +    void testFunction1();					// just testing new stuff
   2.459 +    void testFunction2();					// just testing new stuff
   2.460 +											// set /mainwindo/showTestMenu=true...
   2.461  
   2.462  protected:
   2.463 -	void ensureSelectionVisible();		
   2.464 -	virtual void updateViewCenter();	// needed for zooming
   2.465 -	virtual void contentsContextMenuEvent ( QContextMenuEvent *e );
   2.466 -    virtual void contentsMousePressEvent(QMouseEvent*);
   2.467 -    virtual void contentsMouseReleaseEvent(QMouseEvent*);
   2.468 -    virtual void contentsMouseDoubleClickEvent(QMouseEvent*);
   2.469 -    virtual void contentsMouseMoveEvent(QMouseEvent*);
   2.470 +	virtual void contextMenuEvent ( QContextMenuEvent *e );
   2.471 +    virtual void keyPressEvent(QKeyEvent*);
   2.472 +    virtual void keyReleaseEvent(QKeyEvent*);
   2.473 +    virtual void mousePressEvent(QMouseEvent*);
   2.474 +    virtual void mouseMoveEvent(QMouseEvent*);
   2.475 +    virtual void mouseReleaseEvent(QMouseEvent*);
   2.476 +    virtual void mouseDoubleClickEvent(QMouseEvent*);
   2.477 +    virtual void resizeEvent( QResizeEvent * );
   2.478 +
   2.479 +	void dragEnterEvent (QDragEnterEvent *);
   2.480 +	void dragMoveEvent (QDragMoveEvent *);
   2.481 +	void dragLeaveEvent (QDragLeaveEvent *);
   2.482 +	void dropEvent (QDropEvent *);
   2.483 +
   2.484 +
   2.485 +protected:
   2.486 +	void sendSelection();
   2.487 +
   2.488 +public:
   2.489 +	void newServer();
   2.490 +	void connectToServer();
   2.491 +
   2.492 +private slots:	
   2.493 +	void newClient();
   2.494 +	void sendData(const QString &s);
   2.495 +	void readData();
   2.496 +	void displayNetworkError (QAbstractSocket::SocketError);
   2.497 +
   2.498 +	void autosave ();
   2.499 +	void fileChanged();
   2.500  
   2.501  private:
   2.502 -    QCanvas* mapCanvas;
   2.503 -    MapCenterObj* mapCenter;
   2.504 +	State state;				// State of MapEditor
   2.505 +	QGraphicsScene *mapScene;
   2.506 +	VymModel *model;					// Vym Map, includding several mapCenters
   2.507 +	QTimer *autosaveTimer;
   2.508 +	QTimer *fileChangedTimer;
   2.509 +	QDateTime fileChangedTime;
   2.510  
   2.511  	bool adjustCanvasRequested;	// collect requests until end of user event
   2.512  	BranchObj *editingBO;		// entering Text into BO
   2.513 -    QLineEdit* lineedit;
   2.514  
   2.515 -    QColor actColor;			// actual color
   2.516 -	QColor deflinkcolor;		// default color for links
   2.517 -	LinkColorHint linkcolorhint;// use heading color or own color
   2.518 -	LinkStyle linkstyle;		// default style for links
   2.519 +	QColor defLinkColor;		// default color for links
   2.520 +	QColor defXLinkColor;		// default color for xlinks
   2.521 +	int defXLinkWidth;			// default width for xlinks
   2.522 +	LinkableMapObj::ColorHint linkcolorhint;// use heading color or own color
   2.523 +	LinkableMapObj::Style linkstyle;		// default style for links
   2.524  
   2.525 -    QCursor handOpenCursor;		// cursor while moving canvas view
   2.526 -	QCursor pickColorCursor;	// cursor while picking color 
   2.527 -	bool pickingColor;			// true while picking Color CTRL-LeftButton
   2.528 -	
   2.529 -    LinkableMapObj* selection;		// select a LinkableMapObj
   2.530 -    LinkableMapObj* selectionLast;	// last selection 
   2.531 +    QCursor HandOpenCursor;		// cursor while moving canvas view
   2.532 +	QCursor PickColorCursor;	// cursor while picking color 
   2.533 +	QCursor CopyCursor;			// cursor while picking color 
   2.534 +	QCursor XLinkCursor;		// cursor while picking color 
   2.535 +	bool pickingColor;
   2.536 +	bool drawingLink;			// true while creating a link
   2.537 +	bool copyingObj;			// true while creating a link
   2.538 +	XLinkObj* tmpXLink;
   2.539 +
   2.540 +	Selection xelection;	
   2.541 +
   2.542 +	QString latestSelection;		// select string of latest added object
   2.543 +
   2.544      MapObj* movingObj;				// moving a MapObj
   2.545 -    QPoint movingObj_start;			// rel. pos of mouse to absPos 
   2.546 -    QPoint movingCont_start;		// inital pos of moving Content or
   2.547 -    QPoint movingVec;				// how far has Content moved
   2.548 -	QPoint movingCenter;			// used when zooming
   2.549 +	MapObj* linkingObj_src;			// part of a link
   2.550 +    QPointF movingObj_orgPos;		// org. pos of mouse before move
   2.551 +    QPointF movingObj_orgRelPos;	// org. relative pos of mouse before move
   2.552 +    QPointF movingObj_start;		// rel. pos of mouse to absPos 
   2.553 +    QPointF movingCont_start;		// inital pos of moving Content or
   2.554 +    QPointF movingVec;				// how far has Content moved
   2.555 +
   2.556 +	QPointF contextMenuPos;					// position where context event was triggered
   2.557 +
   2.558      QPrinter* printer;				// Printing
   2.559  
   2.560      bool mapDefault;				// Flag if map is untouched
   2.561      bool mapChanged;				// Flag if undo is possible
   2.562  	bool mapUnsaved;				// Flag if map should be saved
   2.563 -    QString backupXML;				// backup (XML) for undo
   2.564 -	LinkableMapObj* undoSelection;	// replace this LMO with vympart from backup
   2.565 -									// if != NULL
   2.566 +
   2.567 +	Parser parser;				// Parser stuff for scripting
   2.568 +
   2.569 +	AttributeTable *attrTable;
   2.570  
   2.571  	bool printFrame;			// Print frame around map
   2.572  	bool printFooter;			// Print footer below map
   2.573  
   2.574  	bool zipped;				// should map be zipped
   2.575 +	static	int mapNum;			// unique number for Editor
   2.576 +	FileType fileType;			// type of file, e.g. vym, freemind...
   2.577  	QString fileName;			// short name of file (for tab)
   2.578  	QString filePath;			// path to file which will be saved
   2.579  	QString fileDir;			// dir where file is saved
   2.580  	QString destPath;			// path to .vym file (needed for vymlinks)
   2.581  	QString mapName;			// fileName without ".vym"
   2.582 -	QString lastImageDir;		// save dir for adding images
   2.583  
   2.584 -	bool isInteractive;			// non interactive don't need tmpdirs
   2.585 -	QString bakMapDir;			// tmp directory with data for undo
   2.586 -	bool blockreposition;		// block while load or undo
   2.587 +	QString tmpMapDir;			// tmp directory with undo history
   2.588 +	QString histPath;			// Path to history file
   2.589 +	SimpleSettings undoSet;		// undo/redo commands, saved in histPath
   2.590 +	int stepsTotal;				// total number of steps (undos+redos) 
   2.591 +	int curStep;				// Current step in history (ring buffer)
   2.592 +	int curClipboard;			// number of history step, which is the current clipboard
   2.593 +	int redosAvail;				// Available number of redo steps
   2.594 +	int undosAvail;				// Available number of undo steps
   2.595 +	bool blockReposition;		// block while load or undo
   2.596 +	bool blockSaveState;		// block while load or undo
   2.597  
   2.598  	BranchObj* itFind;			// next object in find process
   2.599  	bool EOFind;				// true, if search failed
   2.600  
   2.601  	QPoint exportOffset;		// set before export, used in save
   2.602 -    void resizeEvent( QResizeEvent * );
   2.603 +	HideTmpMode hidemode;	// true while exporting to hide some stuff
   2.604 +
   2.605 +	// Network connections **Experimental**
   2.606 +	NetState netstate;			// offline, client, server
   2.607 +	QTcpServer *tcpServer;		// Act as server in conference mode (experimental)
   2.608 +	QList <QTcpSocket*> clientList;		// List of connected clients
   2.609 +	quint16 sendCounter;		// Increased with every sent command
   2.610 +
   2.611 +	QTcpSocket	*clientSocket;	// socket of this client
   2.612 +	QString server;				// server address of this client
   2.613 +	int port;					// server port of this client
   2.614 +	void displayClientError(QAbstractSocket::SocketError socketError);
   2.615 +
   2.616  };
   2.617  #endif
   2.618  
     3.1 --- a/selection.cpp	Mon Jul 27 12:53:19 2009 +0000
     3.2 +++ b/selection.cpp	Thu Jul 30 07:40:05 2009 +0000
     3.3 @@ -1,39 +1,129 @@
     3.4 +#include <typeinfo>
     3.5 +
     3.6  #include "selection.h"
     3.7  
     3.8 +#include "mainwindow.h"
     3.9 +#include "mapeditor.h"
    3.10 +#include "vymmodel.h"
    3.11 +
    3.12 +
    3.13 +
    3.14 +extern Main *mainWindow;
    3.15  
    3.16  Selection::Selection()
    3.17  {
    3.18 -}
    3.19 -
    3.20 -Selection::Selection(const Selection &other)
    3.21 -{
    3.22 +	color= QColor(255,255,0);
    3.23  }
    3.24  
    3.25  Selection::~Selection()
    3.26  {
    3.27  }
    3.28  
    3.29 -void Selection::init()
    3.30 +void Selection::setModel (VymModel *m)
    3.31  {
    3.32 -	selectList.setAutoDelete(true);
    3.33 +	model=m;
    3.34 +	scene=model->getScene();
    3.35  }
    3.36  
    3.37  void Selection::copy(const Selection &other)
    3.38  {
    3.39 +	selectList=other.selectList;
    3.40 +	lastSelectList=other.lastSelectList;
    3.41  }
    3.42  
    3.43  void Selection::clear()
    3.44  {
    3.45 -	selectList.clear();
    3.46 +	unselect();
    3.47 +	lastSelectList.clear();
    3.48  }
    3.49  
    3.50 -bool Selection::select(LinkableMapObj *lmo)
    3.51 +void Selection::update()
    3.52  {
    3.53 -	return false;
    3.54 +	QRectF bbox;
    3.55 +	int w=0;
    3.56 +	for (int i=0; i< selectList.count(); ++i) 
    3.57 +	{
    3.58 +		bbox=selectList.at(i)->getBBox();
    3.59 +		selboxList.at(i)->setRect (
    3.60 +			bbox.x()-w,bbox.y()-w, 
    3.61 +			bbox.width()+2*w, bbox.height()+2*w);
    3.62 +		selboxList.at(i)->setPen (color);	
    3.63 +		selboxList.at(i)->setBrush (color);	
    3.64 +	}	
    3.65  }
    3.66  
    3.67 -void Selection::unselect(LinkableMapObj *lmo)
    3.68 +void Selection::setColor (QColor col)
    3.69  {
    3.70 +	color=col;
    3.71 +	update();
    3.72 +}
    3.73 +
    3.74 +QColor Selection::getColor ()
    3.75 +{
    3.76 +	return color;
    3.77 +}
    3.78 +
    3.79 +bool Selection::select(LinkableMapObj *lmo)	// TODO no multiselections yet
    3.80 +{
    3.81 +	if (!selectList.isEmpty()) unselect();
    3.82 +	selectList.append (lmo);
    3.83 +	QGraphicsRectItem *sb = scene->addRect(
    3.84 +		QRectF(0,0,0,0), 
    3.85 +		QPen(color),
    3.86 +		color);
    3.87 +	sb->setZValue(Z_SELBOX);
    3.88 +	sb->show();
    3.89 +	selboxList.append (sb);
    3.90 +	lmo->select();
    3.91 +	update();
    3.92 +	mainWindow->updateSatellites (model->getMapEditor() );	
    3.93 +	return true;
    3.94 +}
    3.95 +
    3.96 +bool Selection::select (const QString &s)	// TODO no multiselections yet
    3.97 +{
    3.98 +	if (s.isEmpty())
    3.99 +	{
   3.100 +		unselect();
   3.101 +		return true;
   3.102 +	}
   3.103 +
   3.104 +	LinkableMapObj *lmo=model->findObjBySelect(s);
   3.105 +
   3.106 +	// Finally select the found object
   3.107 +	if (lmo)
   3.108 +	{
   3.109 +		unselect();
   3.110 +		select (lmo);
   3.111 +		return true;
   3.112 +	} 
   3.113 +	return false;
   3.114 +
   3.115 +}
   3.116 +
   3.117 +bool Selection::reselect ()	// TODO no multiselections yet
   3.118 +{
   3.119 +	if (!lastSelectList.isEmpty())
   3.120 +	{
   3.121 +		select (lastSelectList.first());
   3.122 +		return true;
   3.123 +	}
   3.124 +	return false;
   3.125 +
   3.126 +}
   3.127 +
   3.128 +void Selection::unselect()
   3.129 +{
   3.130 +	if (!selectList.isEmpty() )
   3.131 +	{
   3.132 +		for (int i=0; i< selectList.count(); ++i) 
   3.133 +			selectList.at(i)->unselect();
   3.134 +		lastSelectList=selectList;
   3.135 +		selectList.clear();
   3.136 +		while (!selboxList.isEmpty() )
   3.137 +			delete selboxList.takeFirst();
   3.138 +
   3.139 +	}	
   3.140  }
   3.141  
   3.142  bool Selection::isEmpty()
   3.143 @@ -45,3 +135,66 @@
   3.144  {
   3.145  	return selectList.count();
   3.146  }
   3.147 +
   3.148 +Selection::Type Selection::type() // TODO no multiselections yet
   3.149 +{
   3.150 +	if (!selectList.isEmpty())
   3.151 +	{
   3.152 +		LinkableMapObj *sel=selectList.first();
   3.153 +		if (typeid (*sel)==typeid (BranchObj)) return Branch;
   3.154 +		if (typeid (*sel)==typeid (MapCenterObj)) return MapCenter;
   3.155 +		if (typeid (*sel)==typeid (FloatImageObj)) return FloatImage;
   3.156 +	}
   3.157 +	return Undefined;
   3.158 +}
   3.159 +
   3.160 +LinkableMapObj* Selection::first()
   3.161 +{
   3.162 +	if (!selectList.isEmpty())
   3.163 +		return selectList.first();
   3.164 +	else	
   3.165 +		return NULL;
   3.166 +}
   3.167 +
   3.168 +LinkableMapObj* Selection::single()
   3.169 +{
   3.170 +	if (selectList.count() == 1)
   3.171 +		return selectList.first();
   3.172 +	else	
   3.173 +		return NULL;
   3.174 +}
   3.175 +
   3.176 +BranchObj* Selection::getBranch()
   3.177 +{
   3.178 +	if (!selectList.isEmpty())
   3.179 +	{
   3.180 +		LinkableMapObj *sel=selectList.first();
   3.181 +		if (typeid (*sel)==typeid (BranchObj) ||
   3.182 +		    typeid (*sel)==typeid (MapCenterObj)) 
   3.183 +			return (BranchObj*)sel;
   3.184 +	}
   3.185 +		return NULL;
   3.186 +}
   3.187 +
   3.188 +FloatImageObj* Selection::getFloatImage()
   3.189 +{
   3.190 +	if (!selectList.isEmpty())
   3.191 +	{
   3.192 +		LinkableMapObj *sel=selectList.first();
   3.193 +		if (typeid (*sel)==typeid (FloatImageObj)) 
   3.194 +			return (FloatImageObj*)sel;
   3.195 +	}
   3.196 +		return NULL;
   3.197 +}
   3.198 +
   3.199 +QString Selection::getSelectString()// TODO no multiselections yet
   3.200 +{
   3.201 +	if (selectList.count()==1)
   3.202 +	{
   3.203 +		return model->getSelectString (selectList.first() );
   3.204 +	}
   3.205 +	else
   3.206 +		return"";
   3.207 +}
   3.208 +
   3.209 +
     4.1 --- a/tex/vym.changelog	Mon Jul 27 12:53:19 2009 +0000
     4.2 +++ b/tex/vym.changelog	Thu Jul 30 07:40:05 2009 +0000
     4.3 @@ -1,3 +1,9 @@
     4.4 +-------------------------------------------------------------------
     4.5 +Wed Jul 29 17:31:16 CEST 2009 - uwedr@suse.de
     4.6 +
     4.7 +- Version: 1.12.4
     4.8 +- Bugfix: No undo for deleted mapCenters.
     4.9 +
    4.10  -------------------------------------------------------------------
    4.11  Fri Jul 24 10:50:50 CEST 2009 - uwedr@suse.de
    4.12  
     5.1 --- a/version.h	Mon Jul 27 12:53:19 2009 +0000
     5.2 +++ b/version.h	Thu Jul 30 07:40:05 2009 +0000
     5.3 @@ -7,7 +7,7 @@
     5.4  #define __VYM_VERSION "1.12.3"
     5.5  #define __VYM_CODENAME "Maintenance Update "
     5.6  //#define __VYM_CODENAME "Codename: development version"
     5.7 -#define __VYM_BUILD_DATE "2009-07-24"
     5.8 +#define __VYM_BUILD_DATE "2009-07-29"
     5.9  
    5.10  
    5.11  bool checkVersion(const QString &);
     6.1 --- a/xml-vym.cpp	Mon Jul 27 12:53:19 2009 +0000
     6.2 +++ b/xml-vym.cpp	Thu Jul 30 07:40:05 2009 +0000
     6.3 @@ -60,7 +60,7 @@
     6.4  		<<">  state="<<state 
     6.5  		<<"  laststate="<<stateStack.last()
     6.6  		<<"   loadMode="<<loadMode
     6.7 -		<<"       line="<<QXmlDefaultHandler::lineNumber()
     6.8 +		//<<"       line="<<QXmlDefaultHandler::lineNumber()
     6.9  		<<endl;
    6.10  	*/	
    6.11  	stateStack.append (state);	
    6.12 @@ -150,18 +150,23 @@
    6.13  			// Treat the found mapcenter as a branch 
    6.14  			// in an existing map
    6.15  			LinkableMapObj* lmo=model->getSelection();
    6.16 -			if (lmo && ((typeid(*lmo) == typeid(BranchObj) ) 
    6.17 -			        ||  typeid(*lmo) == typeid(MapCenterObj) ) )
    6.18 +			if (lmo)
    6.19  			{
    6.20 -				lastBranch=(BranchObj*)lmo;
    6.21 -				if (loadMode==ImportAdd)
    6.22 +				if ( (typeid(*lmo) == typeid(BranchObj) ) 
    6.23 +						||  typeid(*lmo) == typeid(MapCenterObj) ) 
    6.24  				{
    6.25 -					lastBranch->addBranch();
    6.26 -					lastBranch=lastBranch->getLastBranch();
    6.27 -				} else
    6.28 -					lastBranch->clear();
    6.29 +					lastBranch=(BranchObj*)lmo;
    6.30 +					if (loadMode==ImportAdd)
    6.31 +					{
    6.32 +						lastBranch->addBranch();
    6.33 +						lastBranch=lastBranch->getLastBranch();
    6.34 +					} else
    6.35 +						lastBranch->clear();
    6.36 +				}	
    6.37  			} else
    6.38 -				return false;
    6.39 +				// Add mapCenter without parent
    6.40 +				lastBranch=model->addMapCenter();
    6.41 +			
    6.42  		}
    6.43  		readBranchAttr (atts);
    6.44  	} else if ( 
    6.45 @@ -426,7 +431,7 @@
    6.46  					return false;   // Couldn't read relPos
    6.47  			}           
    6.48  		}           
    6.49 -		if (!a.value( "absPosX").isEmpty() && loadMode==NewMap ) 
    6.50 +		if (!a.value( "absPosX").isEmpty() ) 
    6.51  		{
    6.52  			if (!a.value( "absPosY").isEmpty() ) 
    6.53  			{