fixed import into empty map
authorinsilmaril
Tue, 14 Jun 2005 09:41:37 +0000
changeset 1064083860dd82e
parent 105 67a91e28b30f
child 107 4afcc3383157
fixed import into empty map
api.cpp
branchobj.cpp
demos/todo.vym
exportxhtmldialog.ui
linkablemapobj.cpp
linkablemapobj.h
mainwindow.cpp
mapeditor.cpp
mapeditor.h
misc.h
tex/vym.changelog
tex/vym.tex
texteditor.cpp
texteditor.h
version.h
xlinkobj.cpp
xml.cpp
     1.1 --- a/api.cpp	Mon Jun 06 20:27:42 2005 +0000
     1.2 +++ b/api.cpp	Tue Jun 14 09:41:37 2005 +0000
     1.3 @@ -12,7 +12,7 @@
     1.4  
     1.5  	// Get command
     1.6  	re.setPattern ("(.*)\\s");
     1.7 -	re.setMinimal (false);
     1.8 +	re.setMinimal (true);
     1.9  	pos=re.search (s);
    1.10  	if (pos>=0)
    1.11  		command=re.cap(1);
     2.1 --- a/branchobj.cpp	Mon Jun 06 20:27:42 2005 +0000
     2.2 +++ b/branchobj.cpp	Tue Jun 14 09:41:37 2005 +0000
     2.3 @@ -1293,7 +1293,11 @@
     2.4  
     2.5  	// set Text in Editor	
     2.6  	textEditor->setText(note.getNote() );
     2.7 -	textEditor->setFilename(note.getFilenameHint() );
     2.8 +	QString fnh=note.getFilenameHint();
     2.9 +	if (fnh!="")
    2.10 +		textEditor->setFilenameHint(note.getFilenameHint() );
    2.11 +	else	
    2.12 +		textEditor->setFilenameHint(getHeading() );
    2.13  	textEditor->setFontHint (note.getFontHint() );
    2.14  	connect (textEditor, SIGNAL (textHasChanged() ), this, SLOT (updateNoteFlag() ) ); 
    2.15  	connect (textEditor, SIGNAL (fontSizeHasChanged() ), this, SLOT (updateNoteFlag() ) ); 
     3.1 Binary file demos/todo.vym has changed
     4.1 --- a/exportxhtmldialog.ui	Mon Jun 06 20:27:42 2005 +0000
     4.2 +++ b/exportxhtmldialog.ui	Tue Jun 14 09:41:37 2005 +0000
     4.3 @@ -273,15 +273,15 @@
     4.4          </widget>
     4.5          <widget class="QGroupBox">
     4.6              <property name="name">
     4.7 -                <cstring>groupBox1</cstring>
     4.8 +                <cstring>groupBox2</cstring>
     4.9              </property>
    4.10              <property name="title">
    4.11 -                <string>Scripts</string>
    4.12 +                <string>groupBox2</string>
    4.13              </property>
    4.14          </widget>
    4.15          <widget class="QLayoutWidget">
    4.16              <property name="name">
    4.17 -                <cstring>layout34</cstring>
    4.18 +                <cstring>layout6</cstring>
    4.19              </property>
    4.20              <grid>
    4.21                  <property name="name">
    4.22 @@ -309,25 +309,9 @@
    4.23                          <set>AlignVCenter|AlignRight</set>
    4.24                      </property>
    4.25                  </widget>
    4.26 -                <widget class="QPushButton" row="1" column="2">
    4.27 +                <widget class="QLineEdit" row="0" column="1">
    4.28                      <property name="name">
    4.29 -                        <cstring>browsePostExportButton</cstring>
    4.30 -                    </property>
    4.31 -                    <property name="sizePolicy">
    4.32 -                        <sizepolicy>
    4.33 -                            <hsizetype>0</hsizetype>
    4.34 -                            <vsizetype>0</vsizetype>
    4.35 -                            <horstretch>0</horstretch>
    4.36 -                            <verstretch>0</verstretch>
    4.37 -                        </sizepolicy>
    4.38 -                    </property>
    4.39 -                    <property name="text">
    4.40 -                        <string>Browse</string>
    4.41 -                    </property>
    4.42 -                </widget>
    4.43 -                <widget class="QLineEdit" row="1" column="1">
    4.44 -                    <property name="name">
    4.45 -                        <cstring>lineEditPostScript</cstring>
    4.46 +                        <cstring>lineEditPreScript</cstring>
    4.47                      </property>
    4.48                  </widget>
    4.49                  <widget class="QPushButton" row="0" column="2">
    4.50 @@ -346,11 +330,6 @@
    4.51                          <string>Browse</string>
    4.52                      </property>
    4.53                  </widget>
    4.54 -                <widget class="QLineEdit" row="0" column="1">
    4.55 -                    <property name="name">
    4.56 -                        <cstring>lineEditPreScript</cstring>
    4.57 -                    </property>
    4.58 -                </widget>
    4.59                  <widget class="QLabel" row="0" column="0">
    4.60                      <property name="name">
    4.61                          <cstring>textLabel1_3</cstring>
    4.62 @@ -370,6 +349,27 @@
    4.63                          <set>AlignVCenter|AlignRight</set>
    4.64                      </property>
    4.65                  </widget>
    4.66 +                <widget class="QLineEdit" row="1" column="1">
    4.67 +                    <property name="name">
    4.68 +                        <cstring>lineEditPostScript</cstring>
    4.69 +                    </property>
    4.70 +                </widget>
    4.71 +                <widget class="QPushButton" row="1" column="2">
    4.72 +                    <property name="name">
    4.73 +                        <cstring>browsePostExportButton</cstring>
    4.74 +                    </property>
    4.75 +                    <property name="sizePolicy">
    4.76 +                        <sizepolicy>
    4.77 +                            <hsizetype>0</hsizetype>
    4.78 +                            <vsizetype>0</vsizetype>
    4.79 +                            <horstretch>0</horstretch>
    4.80 +                            <verstretch>0</verstretch>
    4.81 +                        </sizepolicy>
    4.82 +                    </property>
    4.83 +                    <property name="text">
    4.84 +                        <string>Browse</string>
    4.85 +                    </property>
    4.86 +                </widget>
    4.87              </grid>
    4.88          </widget>
    4.89          <spacer>
    4.90 @@ -385,7 +385,7 @@
    4.91              <property name="sizeHint">
    4.92                  <size>
    4.93                      <width>20</width>
    4.94 -                    <height>90</height>
    4.95 +                    <height>40</height>
    4.96                  </size>
    4.97              </property>
    4.98          </spacer>
     5.1 --- a/linkablemapobj.cpp	Mon Jun 06 20:27:42 2005 +0000
     5.2 +++ b/linkablemapobj.cpp	Tue Jun 14 09:41:37 2005 +0000
     5.3 @@ -525,7 +525,7 @@
     5.4      return parObj;
     5.5  }
     5.6  
     5.7 -LinkableMapObj* LinkableMapObj::findObj (QString s)
     5.8 +LinkableMapObj* LinkableMapObj::findObjBySelect (QString s)
     5.9  {
    5.10  	LinkableMapObj *lmo=this;
    5.11  	QString part;
     6.1 --- a/linkablemapobj.h	Mon Jun 06 20:27:42 2005 +0000
     6.2 +++ b/linkablemapobj.h	Tue Jun 14 09:41:37 2005 +0000
     6.3 @@ -51,7 +51,7 @@
     6.4  											// redraw link with given style
     6.5      LinkableMapObj* getChildObj();			// returns pointer to fromObj
     6.6      LinkableMapObj* getParObj();			// returns pointer to toObj
     6.7 -    virtual LinkableMapObj* findObj(QString s);	// find obj by selectstring
     6.8 +    virtual LinkableMapObj* findObjBySelect(QString s);	// find obj by selectstring
     6.9      QPoint getChildPos();					// returns pos where childs dock
    6.10      QPoint getParPos();						// returns pos where parents dock
    6.11      QPoint getRelPos();						// get position relative to parent (or (0,0))
     7.1 --- a/mainwindow.cpp	Mon Jun 06 20:27:42 2005 +0000
     7.2 +++ b/mainwindow.cpp	Tue Jun 14 09:41:37 2005 +0000
     7.3 @@ -967,7 +967,7 @@
     7.4  
     7.5      a = new QAction( tr( "Export as ASCII (still experimental)" ), QPixmap(), tr( "Export (ASCII)" ), 0, this, "exportASCII" );
     7.6      connect( a, SIGNAL( activated() ), this, SLOT( fileExportASCII() ) );
     7.7 -	// FIXME deactivated, doesn't work with QRichtext anyway
     7.8 +	// TODO deactivated, doesn't work with QRichtext anyway
     7.9  	//   a->addTo( exportMenu );
    7.10  
    7.11  	a = new QAction( tr( "Export XML" ), QPixmap(), tr( "Export XML" ),  0, this, "exportXML" );
    7.12 @@ -1313,8 +1313,7 @@
    7.13  						{
    7.14  							for ( QStringList::Iterator it = flist.begin(); it != flist.end(); ++it ) 
    7.15  								*it=tmpMapDir + "/" + *it;
    7.16 -							// FIXME	
    7.17 -							// Multiple entries, load all (but only the first one into this ME)
    7.18 +							// FIXME Multiple entries, load all (but only the first one into this ME)
    7.19  							//mainWindow->fileLoadFromTmp (flist);
    7.20  							//returnCode=1;	// Silently forget this attempt to load
    7.21  							qWarning ("MainWindow::load (fn)  multimap found...");
    7.22 @@ -1333,11 +1332,19 @@
    7.23  			}
    7.24  		}
    7.25  
    7.26 +
    7.27 +		// Save existing filename
    7.28 +		QString fn_org=me->getFilePath();
    7.29 +
    7.30  		// Finally load map into mapEditor
    7.31  		me->setFilePath (mapfile,fn);
    7.32  		if (me->load(mapfile,lmode))
    7.33  			err=aborted;
    7.34  
    7.35 +		// Restore old (maybe empty) filepath, if this is an import
    7.36 +		if (lmode!=NewMap)
    7.37 +			me->setFilePath (fn_org);
    7.38 +			
    7.39  		// Delete tmpDir
    7.40  		system ( "rm -rf "+tmpMapDir);
    7.41  
     8.1 --- a/mapeditor.cpp	Mon Jun 06 20:27:42 2005 +0000
     8.2 +++ b/mapeditor.cpp	Tue Jun 14 09:41:37 2005 +0000
     8.3 @@ -341,7 +341,6 @@
     8.4      mapChanged=false;
     8.5  	mapDefault=true;
     8.6  	mapUnsaved=false;
     8.7 -	undoSelection=NULL;
     8.8  	
     8.9  	zipped=true;
    8.10  	filePath="";
    8.11 @@ -468,8 +467,7 @@
    8.12  	char tmpdir[]="/tmp/vym-XXXXXX";	
    8.13  	bakMapDir=mkdtemp(tmpdir);
    8.14  	makeSubDirs(bakMapDir);
    8.15 -	// FIXME set permissions
    8.16 -	// and maybe use QT method for portability
    8.17 +	// FIXME set permissions and maybe use QT method for portability
    8.18  }
    8.19  
    8.20  void MapEditor::delTmpDirs()
    8.21 @@ -487,7 +485,7 @@
    8.22  }
    8.23  
    8.24  
    8.25 -QString MapEditor::saveToDir(const QString &tmpdir, const QString &prefix, bool writeflags, const QPoint &offset, SaveMode savemode)
    8.26 +QString MapEditor::saveToDir(const QString &tmpdir, const QString &prefix, bool writeflags, const QPoint &offset, LinkableMapObj *saveSelection)
    8.27  {
    8.28  	// tmpdir		temporary directory to which data will be writte
    8.29  	// prefix		mapname, which will be appended to images etc.
    8.30 @@ -521,7 +519,7 @@
    8.31  		colhint=attribut("linkColorHint","HeadingColor");
    8.32  
    8.33  	QString mapAttr=attribut("version",__VYM_VERSION__);
    8.34 -	if (savemode==CompleteMap)
    8.35 +	if (!saveSelection)
    8.36  		mapAttr+= attribut("author",mapCenter->getAuthor()) +
    8.37  				  attribut("comment",mapCenter->getComment()) +
    8.38  			      attribut("date",mapCenter->getDate()) +
    8.39 @@ -538,15 +536,15 @@
    8.40  	standardFlagsDefault->resetUsedCounter();
    8.41  	
    8.42  	// Build xml recursivly
    8.43 -	if (savemode==CompleteMap)
    8.44 +	if (!saveSelection)
    8.45  		s+=mapCenter->saveToDir(tmpdir,prefix,writeflags,offset);
    8.46  	else
    8.47  	{
    8.48 -		if ( undoSelection &&
    8.49 -			typeid(*undoSelection) == typeid(BranchObj) )
    8.50 -			s+=((BranchObj*)(undoSelection))->saveToDir(tmpdir,prefix,offset);
    8.51 +		if ( typeid(*saveSelection) == typeid(BranchObj) )
    8.52 +			s+=((BranchObj*)(saveSelection))->saveToDir(tmpdir,prefix,offset);
    8.53  		else	
    8.54  			if (selection && typeid(*selection)==typeid(BranchObj))
    8.55 +				// This is used if selected branch is saved from mainwindow
    8.56  				s+=((BranchObj*)(selection))->saveToDir(tmpdir,prefix,offset);
    8.57  	}
    8.58  
    8.59 @@ -554,7 +552,7 @@
    8.60  	s+=settings.getXMLData (destPath);
    8.61  
    8.62  	// Save selection
    8.63 -	if (selection) 
    8.64 +	if (selection && !saveSelection) 
    8.65  		s+=valueElement("select",selection->getSelectString());
    8.66  
    8.67  	decIndent();
    8.68 @@ -567,44 +565,76 @@
    8.69  
    8.70  void MapEditor::saveState()
    8.71  {
    8.72 -	saveState (CompleteMap,NULL);
    8.73 +	saveState (CompleteMap,NULL,"");
    8.74  }
    8.75  
    8.76 -void MapEditor::saveState(const SaveMode &mode, LinkableMapObj *part)
    8.77 +void MapEditor::saveState(LinkableMapObj *undoSel)
    8.78  {
    8.79 -	saveState (mode,part,"");
    8.80 +	saveState (PartOfMap,undoSel,"");
    8.81  }
    8.82  
    8.83 -void MapEditor::saveState(const SaveMode &mode, LinkableMapObj *part, const QString &undoCom)
    8.84 +void MapEditor::saveState(const QString & c)
    8.85  {
    8.86 -	// all binary data is saved in bakMapDir (created in Constructor)
    8.87 -	// the xml data itself is kept in memory in backupXML
    8.88 -	// 
    8.89 -	// For faster write/read of data, a part of the map can be
    8.90 -	// written. Then the undoSelection will mark the part of the
    8.91 -	// map which should be replaced if an undo is wanted later.
    8.92 -
    8.93 -	if (mode==PartOfMap && part && (typeid(*part) == typeid (BranchObj) ) ) 
    8.94 +	saveState (UndoCommand,NULL,c);
    8.95 +}
    8.96 +
    8.97 +void MapEditor::saveState(const SaveMode &savemode, LinkableMapObj *undoSel, const QString &undoCom)
    8.98 +{
    8.99 +	if (savemode==UndoCommand)
   8.100  	{
   8.101 -		// So far we only test undoCommands for BranchObjs
   8.102  		undoCommand=undoCom;
   8.103 -		if (undoCommand!="")
   8.104 -		{
   8.105 -			undoSelection=part;
   8.106 -		} else
   8.107 -		{
   8.108 -			// Writing a vympart only is useful for BranchObj
   8.109 -			undoSelection=part;
   8.110 -			backupXML=saveToDir (bakMapDir,mapName+"-",false, QPoint (),PartOfMap);
   8.111 -		}
   8.112 -	} else	
   8.113 +		backupXML="";
   8.114 +	}	
   8.115 +	else if (savemode==PartOfMap && undoSel)
   8.116  	{
   8.117 -		undoCommand="";
   8.118 -		undoSelection=NULL;
   8.119 -		backupXML=saveToDir (bakMapDir,mapName+"-",false, QPoint (),CompleteMap);
   8.120 +		undoCommand="undoPart (\""+undoSel->getSelectString()+"\")";
   8.121 +		backupXML=saveToDir (bakMapDir,mapName+"-",false, QPoint (),undoSel);
   8.122 +	} else
   8.123 +	{
   8.124 +		undoCommand="undoMap ()";
   8.125 +		backupXML=saveToDir (bakMapDir,mapName+"-",false, QPoint (),NULL);
   8.126 +	}
   8.127 +	/* FIXME testing
   8.128 +	cout << "ME::saveState()\n";
   8.129 +	cout << "  undoCom="<<undoCommand<<endl;
   8.130 +	*/
   8.131 +}
   8.132 +
   8.133 +void MapEditor::parseAtom(const QString &s)
   8.134 +{
   8.135 +	API api;
   8.136 +	QString c,p,p0;
   8.137 +	api.parseCommand (s,c,p);
   8.138 +	api.getString(p,p0);
   8.139 +	/* FIXME testing
   8.140 +	cout <<"ME::parseAtom  s="<<s<<endl;
   8.141 +	cout <<"ME::parseAtom  c="<<c<<endl;
   8.142 +	cout <<"ME::parseAtom  p="<<p<<endl;
   8.143 +	*/
   8.144 +
   8.145 +	// External commands
   8.146 +	if (c==QString("moveBranchUp"))
   8.147 +		moveBranchUp();
   8.148 +	else if (c=="moveBranchDown")
   8.149 +		moveBranchDown();
   8.150 +	else if (c=="setHeading")
   8.151 +		setHeading (p0);
   8.152 +	// Internal commands, used for undo etc.	
   8.153 +	else if (c==QString("undoMap"))
   8.154 +		undoXML("");
   8.155 +	else if (c==QString("undoPart"))
   8.156 +		undoXML(p0);
   8.157 +	else if (c=="select")
   8.158 +		select (p0);
   8.159 +	else
   8.160 +	{
   8.161 +		cout << "MapEditor::parseAtom: Error!\n";
   8.162 +		cout << "  Command unknown: \""<<c<<"\""<<endl;
   8.163 +		cout << "     Used in atom: \""<<s<<"\""<<endl;
   8.164  	}	
   8.165  }
   8.166  
   8.167 +
   8.168  void MapEditor::finishedLineEditNoSave()
   8.169  {
   8.170  	// This is called by finishedLineEdit or any MapEditor method,
   8.171 @@ -675,20 +705,28 @@
   8.172  
   8.173  void MapEditor::setFilePath(QString fname, QString destname)
   8.174  {
   8.175 -	filePath=fname;
   8.176 -	fileName=fname;
   8.177 -	destPath=destname;
   8.178 -
   8.179 -	// If fname is not an absolute path, complete it
   8.180 -	filePath=QDir(fname).absPath();
   8.181 -	fileDir=filePath.left (1+filePath.findRev ("/"));
   8.182 -
   8.183 -	// Set short name, too. Search from behind:
   8.184 -	int i=fileName.findRev("/");
   8.185 -	if (i>=0) fileName=fileName.remove (0,i+1);
   8.186 -
   8.187 -	// Forget the .vym (or .xml) for name of map
   8.188 -	mapName=fileName.left(fileName.findRev(".",-1,true) );
   8.189 +	if (fname.isEmpty())
   8.190 +	{
   8.191 +		filePath="";
   8.192 +		fileName="";
   8.193 +		destPath="";
   8.194 +	} else
   8.195 +	{
   8.196 +		filePath=fname;		// becomes absolute path
   8.197 +		fileName=fname;		// gets stripped of path
   8.198 +		destPath=destname;	// needed for vymlinks
   8.199 +
   8.200 +		// If fname is not an absolute path, complete it
   8.201 +		filePath=QDir(fname).absPath();
   8.202 +		fileDir=filePath.left (1+filePath.findRev ("/"));
   8.203 +
   8.204 +		// Set short name, too. Search from behind:
   8.205 +		int i=fileName.findRev("/");
   8.206 +		if (i>=0) fileName=fileName.remove (0,i+1);
   8.207 +
   8.208 +		// Forget the .vym (or .xml) for name of map
   8.209 +		mapName=fileName.left(fileName.findRev(".",-1,true) );
   8.210 +	}
   8.211  }
   8.212  
   8.213  QString MapEditor::getFilePath()
   8.214 @@ -728,7 +766,7 @@
   8.215  	} else
   8.216  	{
   8.217  		setChanged();
   8.218 -		saveState(PartOfMap,selection);
   8.219 +		saveState(selection);
   8.220  	}	
   8.221  	
   8.222      
   8.223 @@ -785,6 +823,9 @@
   8.224  
   8.225  	int returnCode=0;
   8.226  
   8.227 +	// The SaveMode UndoCommand is not supported here
   8.228 +	if (savemode==UndoCommand) return 1;
   8.229 +
   8.230  	// Create mapName and fileDir
   8.231  	makeSubDirs (fileDir);
   8.232  	QString fname;
   8.233 @@ -807,7 +848,10 @@
   8.234  	file.close();
   8.235  
   8.236  	QString saveFile;
   8.237 -	saveFile=saveToDir (fileDir,mapName+"-",true,QPoint(),savemode);
   8.238 +	if (savemode==CompleteMap || selection==NULL)
   8.239 +		saveFile=saveToDir (fileDir,mapName+"-",true,QPoint(),NULL);
   8.240 +	else	
   8.241 +		saveFile=saveToDir (fileDir,mapName+"-",true,QPoint(),selection);
   8.242  
   8.243  	file.setName ( fileDir  + fname);
   8.244  	if ( !file.open( IO_WriteOnly ) )
   8.245 @@ -1073,7 +1117,7 @@
   8.246  	makeSubDirs (dir);
   8.247  
   8.248  	// write to directory
   8.249 -	QString saveFile=saveToDir (dir,mapName+"-",true,mapCenter->getTotalBBox().topLeft() ,CompleteMap);
   8.250 +	QString saveFile=saveToDir (dir,mapName+"-",true,mapCenter->getTotalBBox().topLeft() ,NULL);
   8.251  	QFile file;
   8.252  
   8.253  	file.setName ( dir + "/"+mapName+".xml");
   8.254 @@ -1105,82 +1149,6 @@
   8.255  	mapCenter->clear();
   8.256  }
   8.257  
   8.258 -void MapEditor::undo()
   8.259 -{
   8.260 -	QDir d;
   8.261 -	d.setPath(bakMapDir);
   8.262 -	if (d.exists() )
   8.263 -	{
   8.264 -		// Finish open lineEdits
   8.265 -		if (lineedit) finishedLineEditNoSave();
   8.266 -
   8.267 -		if (selection) 
   8.268 -		{
   8.269 -			selection->unselect();
   8.270 -			selection=NULL;
   8.271 -		}	
   8.272 -		
   8.273 -		if (undoCommand!="" && undoSelection)
   8.274 -		{
   8.275 -			// We don't need to parse XML backup, but
   8.276 -			// do the undoCommand
   8.277 -			selection=undoSelection;
   8.278 -			selection->select();
   8.279 -			parseTest (undoCommand);
   8.280 -
   8.281 -		} else
   8.282 -		{
   8.283 -			// We need to parse saved XML data
   8.284 -			mapBuilderHandler handler;
   8.285 -			QXmlInputSource source;
   8.286 -			source.setData(backupXML);
   8.287 -			QXmlSimpleReader reader;
   8.288 -			reader.setContentHandler( &handler );
   8.289 -			reader.setErrorHandler( &handler );
   8.290 -			handler.setMapEditor( this );
   8.291 -			handler.setTmpDir ( bakMapDir );	// needed to load files with rel. path
   8.292 -			if (undoSelection)
   8.293 -			{
   8.294 -				selection=undoSelection;
   8.295 -				selection->select();
   8.296 -				handler.setLoadMode (ImportReplace);
   8.297 -
   8.298 -			} else	
   8.299 -			{
   8.300 -				mapCenter->clear();
   8.301 -				handler.setLoadMode (NewMap);
   8.302 -			}	
   8.303 -			blockreposition=true;
   8.304 -			bool ok = reader.parse( source );
   8.305 -			blockreposition=false;
   8.306 -			if ( ok ) 
   8.307 -				mapCenter->reposition();
   8.308 -				
   8.309 -			else 
   8.310 -			{	
   8.311 -				// This should never ever happen
   8.312 -				QMessageBox::critical( 0, tr( "Critical Parse Error by reading backupFile" ),
   8.313 -									   tr( handler.errorProtocol() )+" in "+backupXML );
   8.314 -			}
   8.315 -		} // restoring saved version	
   8.316 -
   8.317 -		// Undo not longer available now
   8.318 -		actionEditUndo->setEnabled (false);
   8.319 -		undoSelection=false;
   8.320 -		mapChanged=false;
   8.321 -		return;
   8.322 -	} else	
   8.323 -	{
   8.324 -		QMessageBox::critical( 0, tr( "Critical Error" ),
   8.325 -			"Temporary directory " +bakMapDir + 
   8.326 -			tr (" used for undo is gone. \n"
   8.327 -			"I will create a new one, but at the moment no undo is available.\n"
   8.328 -			"Maybe you want to reload your original data.\n\n"
   8.329 -			"Sorry for any inconveniences.") );
   8.330 -		makeTmpDirs();	
   8.331 -	}							
   8.332 -}
   8.333 -
   8.334  void MapEditor::copy()
   8.335  {
   8.336  	// Finish open lineEdits
   8.337 @@ -1244,6 +1212,72 @@
   8.338  	}	    
   8.339  }
   8.340  
   8.341 +void MapEditor::undo()
   8.342 +{
   8.343 +	// Finish open lineEdits
   8.344 +	if (lineedit) finishedLineEditNoSave();
   8.345 +
   8.346 +	// Unselect
   8.347 +	if (selection) 
   8.348 +	{
   8.349 +		selection->unselect();
   8.350 +		selection=NULL;
   8.351 +	}	
   8.352 +		
   8.353 +	parseAtom (undoCommand);
   8.354 +	mapCenter->reposition();
   8.355 +
   8.356 +	// Undo not longer available now
   8.357 +	actionEditUndo->setEnabled (false);
   8.358 +	mapChanged=false;
   8.359 +
   8.360 +}
   8.361 +
   8.362 +void MapEditor::undoXML(const QString &undoSel)
   8.363 +{
   8.364 +	QDir d;
   8.365 +	d.setPath(bakMapDir);
   8.366 +	if (d.exists() )
   8.367 +	{
   8.368 +		// We need to parse saved XML data
   8.369 +		mapBuilderHandler handler;
   8.370 +		QXmlInputSource source;
   8.371 +		source.setData(backupXML);
   8.372 +		QXmlSimpleReader reader;
   8.373 +		reader.setContentHandler( &handler );
   8.374 +		reader.setErrorHandler( &handler );
   8.375 +		handler.setMapEditor( this );
   8.376 +		handler.setTmpDir ( bakMapDir );	// needed to load files with rel. path
   8.377 +		if (undoSel.isEmpty())
   8.378 +		{
   8.379 +			mapCenter->clear();
   8.380 +			handler.setLoadMode (NewMap);
   8.381 +		} else	
   8.382 +		{
   8.383 +			select (undoSel);
   8.384 +			handler.setLoadMode (ImportReplace);
   8.385 +		}	
   8.386 +		blockreposition=true;
   8.387 +		bool ok = reader.parse( source );
   8.388 +		blockreposition=false;
   8.389 +		if (! ok ) 
   8.390 +		{	
   8.391 +			// This should never ever happen
   8.392 +			QMessageBox::critical( 0, tr( "Critical Parse Error by reading backupFile" ),
   8.393 +								   tr( handler.errorProtocol() )+" in "+backupXML );
   8.394 +		}
   8.395 +	} else	
   8.396 +	{
   8.397 +		QMessageBox::critical( 0, tr( "Critical Error" ),
   8.398 +			"Temporary directory " +bakMapDir + 
   8.399 +			tr (" used for undo is gone. \n"
   8.400 +			"I will create a new one, but at the moment no undo is available.\n"
   8.401 +			"Maybe you want to reload your original data.\n\n"
   8.402 +			"Sorry for any inconveniences.") );
   8.403 +		makeTmpDirs();	
   8.404 +	}							
   8.405 +}
   8.406 +
   8.407  LinkableMapObj* MapEditor::pasteNoSave()
   8.408  {
   8.409  	// Finish open lineEdits
   8.410 @@ -1309,7 +1343,7 @@
   8.411  void MapEditor::paste()
   8.412  {   
   8.413  	setChanged();
   8.414 -	saveState(PartOfMap,selection);
   8.415 +	saveState(selection);
   8.416  	pasteNoSave();
   8.417  	mapCenter->reposition();
   8.418  	adjustCanvasSize();
   8.419 @@ -1318,7 +1352,7 @@
   8.420  void MapEditor::cut()
   8.421  {
   8.422  	setChanged();
   8.423 -	saveState(PartOfMap,selection->getParObj());
   8.424 +	saveState(selection->getParObj());
   8.425  	copy();
   8.426  	cutNoSave();
   8.427  	mapCenter->reposition();
   8.428 @@ -1335,7 +1369,7 @@
   8.429  	if (typeid(*selection) == typeid(BranchObj)  ) 
   8.430  	{
   8.431  		setChanged();
   8.432 -		saveState(PartOfMap,selection,"moveBranchDown ()");
   8.433 +		saveState("moveBranchDown ()");
   8.434  		bo=(BranchObj*)(selection);
   8.435  		par=(BranchObj*)(bo->getParObj());
   8.436  		selection->unselect();
   8.437 @@ -1356,7 +1390,7 @@
   8.438  	if (typeid(*selection) == typeid(BranchObj)  ) 
   8.439  	{
   8.440  		setChanged();
   8.441 -		saveState(PartOfMap,selection,"moveBranchUp ()");
   8.442 +		saveState("moveBranchUp ()");
   8.443  		bo=(BranchObj*)(selection);
   8.444  		par=(BranchObj*)(bo->getParObj());
   8.445  		selection->unselect(); 
   8.446 @@ -1377,7 +1411,7 @@
   8.447  		  typeid(*selection) == typeid(MapCenterObj) ) ) 
   8.448  	{
   8.449  		setChanged();
   8.450 -		saveState(PartOfMap,selection);
   8.451 +		saveState("setHeading (\""+((BranchObj*)(selection))->getHeading()+"\")");
   8.452  
   8.453  		ensureSelectionVisible();
   8.454  		editingBO=(BranchObj*)(selection);
   8.455 @@ -1395,6 +1429,20 @@
   8.456  	}				
   8.457  }
   8.458  
   8.459 +void MapEditor::setHeading(const QString &s)
   8.460 +{
   8.461 +	// Internal function, no saveState needed
   8.462 +	if (selection  &&  
   8.463 +		 (typeid(*selection) == typeid(BranchObj) || 
   8.464 +		  typeid(*selection) == typeid(MapCenterObj) ) ) 
   8.465 +	{
   8.466 +		((BranchObj*)(selection))->setHeading(s);
   8.467 +		mapCenter->reposition();
   8.468 +		adjustCanvasSize();
   8.469 +		ensureSelectionVisible();
   8.470 +	}
   8.471 +}
   8.472 +
   8.473  void MapEditor::addNewBranch(int pos)
   8.474  {
   8.475  	// Finish open lineEdits
   8.476 @@ -1405,7 +1453,7 @@
   8.477  		  typeid(*selection) == typeid(MapCenterObj) ) ) 
   8.478  	{
   8.479  		setChanged();
   8.480 -		saveState(PartOfMap,selection);
   8.481 +		saveState(selection);
   8.482  
   8.483  		BranchObj* bo1 = (BranchObj*) (selection);
   8.484  		bool wasScrolled=false;
   8.485 @@ -1471,7 +1519,7 @@
   8.486  		 (typeid(*selection) == typeid(BranchObj) ) )
   8.487  	{
   8.488  		setChanged();
   8.489 -		saveState(PartOfMap,selection);
   8.490 +		saveState(selection);
   8.491  
   8.492  		BranchObj* bo1 = (BranchObj*) (selection);
   8.493  		bool wasScrolled=false;
   8.494 @@ -1520,7 +1568,7 @@
   8.495  	if (selection  && typeid(*selection) ==typeid(BranchObj) ) 
   8.496  	{
   8.497  		setChanged();
   8.498 -		saveState(PartOfMap,selection->getParObj());
   8.499 +		saveState(selection->getParObj());
   8.500  		BranchObj* bo=dynamic_cast <BranchObj*> (selection);
   8.501  		BranchObj* par=(BranchObj*)(bo->getParObj());
   8.502  		bo->unselect();
   8.503 @@ -1535,7 +1583,7 @@
   8.504  	if (selection  && typeid(*selection) ==typeid(FloatImageObj) ) 
   8.505  	{
   8.506  		setChanged();
   8.507 -		saveState(PartOfMap,selection->getParObj());
   8.508 +		saveState(selection->getParObj());
   8.509  		FloatImageObj* fio=dynamic_cast <FloatImageObj*> (selection);
   8.510  		BranchObj* par=(BranchObj*)(fio->getParObj());
   8.511  		fio->unselect();
   8.512 @@ -1556,7 +1604,7 @@
   8.513  
   8.514  bool MapEditor::select (const QString &s)
   8.515  {
   8.516 -	LinkableMapObj *lmo=mapCenter->findObj(s);
   8.517 +	LinkableMapObj *lmo=mapCenter->findObjBySelect(s);
   8.518  
   8.519  	// Finally select the found object
   8.520  	if (lmo)
   8.521 @@ -2006,7 +2054,7 @@
   8.522  			typeid(*selection) == typeid(MapCenterObj))
   8.523  		{
   8.524  			setChanged();
   8.525 -			saveState(PartOfMap,selection);
   8.526 +			saveState(selection);
   8.527  			BranchObj *bo=(BranchObj*)(selection);
   8.528  			bo->setColor(actColor, false); // color links, color childs
   8.529  		}    
   8.530 @@ -2021,7 +2069,7 @@
   8.531  			typeid(*selection) == typeid(MapCenterObj))
   8.532  		{
   8.533  			setChanged();
   8.534 -			saveState(PartOfMap,selection);
   8.535 +			saveState(selection);
   8.536  			BranchObj *bo=(BranchObj*)(selection);
   8.537  			bo->setColor(actColor, true); // color links, color childs
   8.538  		}    
   8.539 @@ -2034,7 +2082,7 @@
   8.540  	if (selection)
   8.541  	{
   8.542  		setChanged();
   8.543 -		saveState(PartOfMap,selection);	
   8.544 +		saveState(selection);	
   8.545  		((BranchObj*)(selection))->toggleStandardFlag (f,actionSettingsUseFlagGroups);
   8.546  	}	
   8.547  }
   8.548 @@ -2234,7 +2282,7 @@
   8.549  	if (selection && (typeid(*selection) == typeid(BranchObj) ))
   8.550  	{		
   8.551  		setChanged();
   8.552 -		saveState(PartOfMap,selection->getParObj());
   8.553 +		saveState(selection->getParObj());
   8.554  		QString sel=selection->getSelectString();
   8.555  		BranchObj* bo=(BranchObj*)(selection);
   8.556  		BranchObj* par=(BranchObj*)(bo->getParObj());
   8.557 @@ -2250,7 +2298,7 @@
   8.558  	if (selection && (typeid(*selection) == typeid(BranchObj) ))
   8.559  	{		
   8.560  		setChanged();
   8.561 -		saveState(PartOfMap,selection->getParObj());
   8.562 +		saveState(selection->getParObj());
   8.563  		((BranchObj*)(selection))->removeChilds();
   8.564  		mapCenter->reposition();
   8.565  	}	
   8.566 @@ -2555,7 +2603,7 @@
   8.567  		if (bo->countBranches()==0) return;
   8.568  		if (bo->getDepth()==0) return;
   8.569  		setChanged();
   8.570 -		saveState(PartOfMap,selection);
   8.571 +		saveState(selection);
   8.572  		bo->toggleScroll();
   8.573  		adjustCanvasSize();
   8.574  		canvas()->update();
   8.575 @@ -2595,7 +2643,7 @@
   8.576  		if ( fd->exec() == QDialog::Accepted )
   8.577  		{
   8.578  			setChanged();
   8.579 -			saveState(PartOfMap,selection);
   8.580 +			saveState(selection);
   8.581  			QString fn=fd->selectedFile();
   8.582  			lastImageDir=fn.left(fn.findRev ("/"));
   8.583  			bo->addFloatImage();
   8.584 @@ -2816,25 +2864,10 @@
   8.585  		(typeid(*selection) == typeid(BranchObj)) )
   8.586  	{
   8.587  		QString s=((BranchObj*)(selection))->getHeading();
   8.588 -		parseTest (s);
   8.589 +		parseAtom(s);
   8.590  	}
   8.591  }
   8.592  
   8.593 -void MapEditor::parseTest(const QString &s)
   8.594 -{
   8.595 -	API api;
   8.596 -	QString c,p,p0;
   8.597 -	api.parseCommand (s,c,p);
   8.598 -	if (c==QString("moveBranchUp"))
   8.599 -		moveBranchUp();
   8.600 -	else if (c=="moveBranchDown")
   8.601 -		moveBranchDown();
   8.602 -	else if (c=="select")
   8.603 -		select (p);
   8.604 -	else
   8.605 -		cout << "Don't know about command \""<<s<<"\".\n";
   8.606 -}
   8.607 -
   8.608  void MapEditor::ensureSelectionVisible()
   8.609  {
   8.610  	if (selection)
   8.611 @@ -3109,7 +3142,7 @@
   8.612  				{
   8.613  					// depth==1, mainbranch
   8.614  					setChanged();
   8.615 -					saveState(PartOfMap,lmosel);
   8.616 +					saveState(lmosel);
   8.617  					lmosel->move(p.x() -movingObj_start.x(), p.y()-movingObj_start.y() );		
   8.618  				} else
   8.619  				{
   8.620 @@ -3326,7 +3359,7 @@
   8.621  			selection=lmo;
   8.622  			selection->select();
   8.623  			setChanged();
   8.624 -			saveState(PartOfMap,selection);
   8.625 +			saveState(selection);
   8.626  			editHeading();
   8.627  		}
   8.628  	}
     9.1 --- a/mapeditor.h	Mon Jun 06 20:27:42 2005 +0000
     9.2 +++ b/mapeditor.h	Tue Jun 14 09:41:37 2005 +0000
     9.3 @@ -29,11 +29,12 @@
     9.4  	void delTmpDirs();		// delete temporary directories
     9.5  	void makeSubDirs(const QString&);		
     9.6  							// create subdirs in dir
     9.7 -    QString saveToDir(const QString&,const QString &,bool, const QPoint
     9.8 -	&,SaveMode);
     9.9 +    QString saveToDir(const QString&,const QString &,bool, const QPoint &,LinkableMapObj*);
    9.10      void saveState();		// save actual state to backup
    9.11 -    void saveState(const SaveMode&, LinkableMapObj *);
    9.12 +    void saveState(LinkableMapObj *);
    9.13 +    void saveState(const QString &);
    9.14      void saveState(const SaveMode&, LinkableMapObj *, const QString &);
    9.15 +    void parseAtom(const QString &);	
    9.16  
    9.17  private slots:
    9.18      void finishedLineEditNoSave();
    9.19 @@ -63,9 +64,10 @@
    9.20      void exportASCII();
    9.21      void exportXML(const QString&);		// export to directory
    9.22      void clear();		// clear map
    9.23 +    void copy();		// copy branch to clipboard
    9.24      void undo();		// undo last action
    9.25 -    void copy();		// copy branch to clipboard
    9.26  private:	
    9.27 +    void undoXML(const QString &);	// undo by replacing with saved data
    9.28      LinkableMapObj* pasteNoSave();		// paste clipboard to branch
    9.29      void cutNoSave();	// cut to clipboard
    9.30  public:	
    9.31 @@ -73,7 +75,10 @@
    9.32      void cut();			// cut to clipboard and backup
    9.33      void moveBranchUp();
    9.34      void moveBranchDown();
    9.35 -    void editHeading();
    9.36 +    void editHeading();					// Start editing heading 
    9.37 +private:
    9.38 +	void setHeading(const QString &);	// Just set the heading for selection
    9.39 +public:	
    9.40      void addNewBranch(int);			// pos allows to add above/below selection
    9.41      void addNewBranchHere();		// insert and make selection its
    9.42      void deleteSelection();
    9.43 @@ -138,7 +143,6 @@
    9.44  	void followXLink (int);
    9.45  	void editXLink (int);
    9.46      void testFunction();				// FIXME just testing
    9.47 -    void parseTest(const QString &);	// FIXME just testing
    9.48  
    9.49  protected:
    9.50  	void ensureSelectionVisible();		
    9.51 @@ -185,7 +189,6 @@
    9.52      bool mapChanged;				// Flag if undo is possible
    9.53  	bool mapUnsaved;				// Flag if map should be saved
    9.54      QString backupXML;				// backup (XML) for undo
    9.55 -	LinkableMapObj* undoSelection;	// replace this LMO with vympart from backup
    9.56  	QString undoCommand;			// FIXME testing
    9.57  									// if != NULL
    9.58  
    10.1 --- a/misc.h	Mon Jun 06 20:27:42 2005 +0000
    10.2 +++ b/misc.h	Tue Jun 14 09:41:37 2005 +0000
    10.3 @@ -15,7 +15,7 @@
    10.4  #define Z_TEXT   100
    10.5  
    10.6  enum LoadMode {NewMap,ImportAdd,ImportReplace};
    10.7 -enum SaveMode {PartOfMap,CompleteMap};
    10.8 +enum SaveMode {PartOfMap,CompleteMap,UndoCommand};
    10.9  
   10.10  /////////////////////////////////////////////////////////////////////////////
   10.11  extern ostream &operator<< (ostream &stream, QPoint const &p);
    11.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    11.2 +++ b/tex/vym.changelog	Tue Jun 14 09:41:37 2005 +0000
    11.3 @@ -0,0 +1,4 @@
    11.4 +-------------------------------------------------------------------
    11.5 +Tue Jun 14 11:43:44 CEST 2005
    11.6 +
    11.7 +- Bugfix: Importing map into new map now has correct (empty) filename 
    12.1 --- a/tex/vym.tex	Mon Jun 06 20:27:42 2005 +0000
    12.2 +++ b/tex/vym.tex	Tue Jun 14 09:41:37 2005 +0000
    12.3 @@ -751,6 +751,9 @@
    12.4  \begin{longtable}{|lcp{8cm}l|} \hline
    12.5  Version	&	&	Comment								& Date	\\ \hline \hline \endhead
    12.6  	\hline \endfoot
    12.7 +1.6.8	& - &	Dramatic in speedup in some operations 
    12.8 +				(e.g. move branch up/down) due to extended 
    12.9 +				undo engine							& 2005-06-07 \\ 
   12.10  1.6.7	& - &	Changed default pdf-reader for Mac OSX & 2005-05-27 \\ 
   12.11  		& - &	Bugfix: xLinks stopped working in 1.6.6			&\\
   12.12  		& - &	Bugfix: drawing error when using modModeCopy    &\\
   12.13 @@ -805,7 +808,7 @@
   12.14        	& -	&	z-plane of floatimages can be set (manually only)& \\
   12.15  		& - &	Bugfix: Wrong ordering of branches, if mainbranch is
   12.16  				exactly left of center& \\
   12.17 -1.4.7 	& -	&	New Export to HTML by Thomas Schraitle.	& 2004-09.24 \\
   12.18 +1.4.7 	& -	&	New Export to XHTML by Thomas Schraitle.	& 2004-09-24 \\
   12.19  		& - &	Bugfix: vymLink&	\\
   12.20  		& - &	Bugfix: spaces and dots in filenames	& \\
   12.21  		& - &	Bugfix: Error message if xsltproc is not installed& \\
    13.1 --- a/texteditor.cpp	Mon Jun 06 20:27:42 2005 +0000
    13.2 +++ b/texteditor.cpp	Tue Jun 14 09:41:37 2005 +0000
    13.3 @@ -114,6 +114,7 @@
    13.4  		actionSettingsFonthintDefault->setOn (false);
    13.5  		e->setCurrentFont (varFont);
    13.6  	}	
    13.7 +	filenameHint="";
    13.8  }
    13.9  
   13.10  
   13.11 @@ -206,6 +207,16 @@
   13.12  	return filename;
   13.13  }
   13.14  
   13.15 +void TextEditor::setFilenameHint(const QString &fnh)
   13.16 +{
   13.17 +	filenameHint=fnh;
   13.18 +}
   13.19 +
   13.20 +QString TextEditor::getFilenameHint()
   13.21 +{
   13.22 +	return filenameHint;
   13.23 +}
   13.24 +
   13.25  bool TextEditor::findText(const QString &t, const bool &cs)
   13.26  {
   13.27  	bool wo=false;	// word matches
   13.28 @@ -693,8 +704,16 @@
   13.29  void TextEditor::textExportAsASCII()
   13.30  {
   13.31  	QString text = textConvertToASCII( e->text());
   13.32 -    QString fn = QFileDialog::getSaveFileName( QString::null, "VYM Note (ASCII) (*.txt);;All files (*)",
   13.33 -					       this,"export note dialog",tr("Export Note to single file (ASCII)") );
   13.34 +	QString fn,s;
   13.35 +	if (!filenameHint.isEmpty())
   13.36 +	{
   13.37 +		if (!filenameHint.contains (".txt"))
   13.38 +			s=filenameHint+".txt";
   13.39 +		else	
   13.40 +			s=filenameHint;
   13.41 +	} else	
   13.42 +		s=QString::null;
   13.43 +	fn = QFileDialog::getSaveFileName( s, "VYM Note (ASCII) (*.txt);;All files (*)", this,"export note dialog",tr("Export Note to single file (ASCII)") );
   13.44  	int ret=-1;
   13.45  
   13.46      if ( !fn.isEmpty() ) 
    14.1 --- a/texteditor.h	Mon Jun 06 20:27:42 2005 +0000
    14.2 +++ b/texteditor.h	Tue Jun 14 09:41:37 2005 +0000
    14.3 @@ -24,6 +24,8 @@
    14.4  	QString getFontHintDefault();
    14.5  	void setFilename (const QString&);
    14.6  	QString getFilename ();
    14.7 +	void setFilenameHint (const QString&);
    14.8 +	QString getFilenameHint ();
    14.9  	bool findText(const QString &, const bool &); // find Text 
   14.10  
   14.11  protected:
   14.12 @@ -79,6 +81,7 @@
   14.13      QTextEdit *e;
   14.14  	QPoint lastPos;			// save last position of window
   14.15      QString filename;
   14.16 +    QString filenameHint;
   14.17  
   14.18  	QBrush emptyPaper;		// setting the background color
   14.19  	QBrush filledPaper;		// depending on the state
   14.20 @@ -116,8 +119,6 @@
   14.21  	*actionAlignCenter,
   14.22  	*actionAlignRight,
   14.23  	*actionAlignJustify;
   14.24 -
   14.25 -
   14.26  };
   14.27  
   14.28  #endif
    15.1 --- a/version.h	Mon Jun 06 20:27:42 2005 +0000
    15.2 +++ b/version.h	Tue Jun 14 09:41:37 2005 +0000
    15.3 @@ -2,6 +2,6 @@
    15.4  #define VERSION_H
    15.5  
    15.6  #define __VYM_VERSION__ "1.6.8"
    15.7 -#define __BUILD_DATE__ "June 06, 2005"
    15.8 +#define __BUILD_DATE__ "June 14, 2005"
    15.9  
   15.10  #endif
    16.1 --- a/xlinkobj.cpp	Mon Jun 06 20:27:42 2005 +0000
    16.2 +++ b/xlinkobj.cpp	Tue Jun 14 09:41:37 2005 +0000
    16.3 @@ -53,7 +53,7 @@
    16.4  
    16.5  void XLinkObj::copy (XLinkObj* other)
    16.6  {
    16.7 -	// FIXME copy not used yet
    16.8 +	// TODO copy not used yet
    16.9  	MapObj::copy (other);
   16.10  	setVisibility (other->visible);
   16.11  	beginBranch=other->beginBranch;
   16.12 @@ -271,11 +271,8 @@
   16.13  	if (beginBranch && endBranch &&xLinkState==activeXLink)
   16.14  	{
   16.15  		if (beginBranch==endBranch && xLinkState)
   16.16 -		{
   16.17 -			//FIXME testing
   16.18 -			//cout << "   identical ends: "<<beginBranch->getSelectString()<<endl;
   16.19  			s="";
   16.20 -		} else
   16.21 +		else
   16.22  		{
   16.23  			QString colAttr=attribut ("color",color.name());
   16.24  			QString widAttr=attribut ("width",QString().setNum(width,10));
    17.1 --- a/xml.cpp	Mon Jun 06 20:27:42 2005 +0000
    17.2 +++ b/xml.cpp	Tue Jun 14 09:41:37 2005 +0000
    17.3 @@ -540,11 +540,11 @@
    17.4  	{
    17.5  		if (!a.value( "endBranch").isEmpty() ) 
    17.6  		{
    17.7 -			LinkableMapObj *lmo=mc->findObj (a.value( "beginBranch"));
    17.8 +			LinkableMapObj *lmo=mc->findObjBySelect (a.value( "beginBranch"));
    17.9  			if (lmo && typeid (*lmo)==typeid (BranchObj))
   17.10  			{
   17.11  				xlo->setBegin ((BranchObj*)(lmo));
   17.12 -				lmo=mc->findObj (a.value( "endBranch"));
   17.13 +				lmo=mc->findObjBySelect (a.value( "endBranch"));
   17.14  				if (lmo && typeid (*lmo)==typeid (BranchObj))
   17.15  				{
   17.16  					xlo->setEnd ((BranchObj*)(lmo));