Version 1.8.59: More fixes in undo/redo area
authorinsilmaril
Thu, 16 Nov 2006 10:07:11 +0000
changeset 398d42881c25fb6
parent 397 39aa64b24375
child 399 190b3a70fabc
Version 1.8.59: More fixes in undo/redo area
branchobj.cpp
demos/todo.vym
icons/cursor.xcf
lang/vym_de.ts
linkablemapobj.cpp
main.cpp
mainwindow.cpp
mapeditor.cpp
mapeditor.h
ornamentedobj.cpp
version.h
vym.pro
xml.cpp
     1.1 --- a/branchobj.cpp	Mon Oct 30 12:39:37 2006 +0000
     1.2 +++ b/branchobj.cpp	Thu Nov 16 10:07:11 2006 +0000
     1.3 @@ -389,7 +389,7 @@
     1.4  	// BranchObj can use color of heading
     1.5  
     1.6  	if (mapEditor)
     1.7 -		if (mapEditor->getLinkColorHint()==HeadingColor)
     1.8 +		if (mapEditor->getMapLinkColorHint()==HeadingColor)
     1.9  			LinkableMapObj::setLinkColor (heading->getColor() );
    1.10  		else	
    1.11  			LinkableMapObj::setLinkColor ();
     2.1 Binary file demos/todo.vym has changed
     3.1 Binary file icons/cursor.xcf has changed
     4.1 --- a/lang/vym_de.ts	Mon Oct 30 12:39:37 2006 +0000
     4.2 +++ b/lang/vym_de.ts	Thu Nov 16 10:07:11 2006 +0000
     4.3 @@ -420,7 +420,7 @@
     4.4      <message>
     4.5          <source>Current state</source>
     4.6          <comment>Current bar in history hwindow</comment>
     4.7 -        <translation>Aktuelle Zustand</translation>
     4.8 +        <translation>Aktueller Zustand</translation>
     4.9      </message>
    4.10  </context>
    4.11  <context>
     5.1 --- a/linkablemapobj.cpp	Mon Oct 30 12:39:37 2006 +0000
     5.2 +++ b/linkablemapobj.cpp	Thu Nov 16 10:07:11 2006 +0000
     5.3 @@ -201,7 +201,7 @@
     5.4  {
     5.5  	if (!mapEditor) return StyleUndef;
     5.6  
     5.7 -	LinkStyle ls=mapEditor->getLinkStyle();
     5.8 +	LinkStyle ls=mapEditor->getMapLinkStyle();
     5.9  	switch (ls)
    5.10  	{
    5.11  		case StyleLine: 
    5.12 @@ -354,7 +354,7 @@
    5.13  	// Overloaded in BranchObj and childs
    5.14  	// here only set default color
    5.15  	if (mapEditor)
    5.16 -		setLinkColor (mapEditor->getDefLinkColor());
    5.17 +		setLinkColor (mapEditor->getMapDefLinkColor());
    5.18  }
    5.19  
    5.20  void LinkableMapObj::setLinkColor(QColor col)
     6.1 --- a/main.cpp	Mon Oct 30 12:39:37 2006 +0000
     6.2 +++ b/main.cpp	Thu Nov 16 10:07:11 2006 +0000
     6.3 @@ -1,10 +1,5 @@
     6.4  #include <QApplication>
     6.5 -//#include <QPixmap>
     6.6 -//#include <QTranslator>
     6.7 -//#include <QDir>
     6.8 -//#include <QTextCodec>
     6.9  #include <q3network.h>
    6.10 -//#include <QActionGroup>
    6.11  
    6.12  #include "settings.h"
    6.13  #include "options.h"
     7.1 --- a/mainwindow.cpp	Mon Oct 30 12:39:37 2006 +0000
     7.2 +++ b/mainwindow.cpp	Thu Nov 16 10:07:11 2006 +0000
     7.3 @@ -1447,8 +1447,6 @@
     7.4  		branchAddContextMenu->addAction ( actionEditAddBranchAbove);
     7.5  		branchAddContextMenu->addAction ( actionEditAddBranchBelow );
     7.6  		branchAddContextMenu->addSeparator();	
     7.7 -		branchAddContextMenu->addAction ( actionEditLoadImage);
     7.8 -		branchAddContextMenu->addSeparator();	
     7.9  		branchAddContextMenu->addAction ( actionEditImportAdd );
    7.10  		branchAddContextMenu->addAction ( actionEditImportReplace );
    7.11  
    7.12 @@ -1465,11 +1463,12 @@
    7.13  	branchContextMenu->addSeparator();	
    7.14  	branchContextMenu->addAction ( actionFormatFrameNone );
    7.15  	branchContextMenu->addAction ( actionFormatFrameRectangle);
    7.16 +	branchContextMenu->addAction ( actionFormatHideLinkUnselected );
    7.17  
    7.18  	branchContextMenu->addSeparator();	
    7.19 +	branchContextMenu->addAction ( actionEditLoadImage);
    7.20  	branchContextMenu->addAction ( actionFormatIncludeImagesVer );
    7.21  	branchContextMenu->addAction ( actionFormatIncludeImagesHor );
    7.22 -	branchContextMenu->addAction ( actionFormatHideLinkUnselected );
    7.23  
    7.24  	// Submenu for Links (URLs, vymLinks)
    7.25  	branchLinksContextMenu =new QMenu (this);
    7.26 @@ -3003,42 +3002,42 @@
    7.27  void Main::formatLinkStyleLine()
    7.28  {
    7.29  	if (currentMapEditor())
    7.30 -		currentMapEditor()->setLinkStyle(StyleLine);
    7.31 +		currentMapEditor()->setMapLinkStyle("StyleLine");
    7.32  }
    7.33  
    7.34  void Main::formatLinkStyleParabel()
    7.35  {
    7.36  	if (currentMapEditor())
    7.37 -		currentMapEditor()->setLinkStyle(StyleParabel);
    7.38 +		currentMapEditor()->setMapLinkStyle("StyleParabel");
    7.39  }
    7.40  
    7.41  void Main::formatLinkStylePolyLine()
    7.42  {
    7.43  	if (currentMapEditor())
    7.44 -		currentMapEditor()->setLinkStyle(StylePolyLine);
    7.45 +		currentMapEditor()->setMapLinkStyle("StylePolyLine");
    7.46  }
    7.47  
    7.48  void Main::formatLinkStylePolyParabel()
    7.49  {
    7.50  	if (currentMapEditor())
    7.51 -		currentMapEditor()->setLinkStyle(StylePolyParabel);
    7.52 +		currentMapEditor()->setMapLinkStyle("StylePolyParabel");
    7.53  }
    7.54  
    7.55  void Main::formatSelectBackColor()
    7.56  {
    7.57  	if (currentMapEditor())
    7.58 -		currentMapEditor()->selectBackgroundColor();
    7.59 +		currentMapEditor()->selectMapBackgroundColor();
    7.60  }
    7.61  
    7.62  void Main::formatSelectLinkColor()
    7.63  {
    7.64  	if (currentMapEditor())
    7.65 -		currentMapEditor()->selectLinkColor();
    7.66 +		currentMapEditor()->selectMapLinkColor();
    7.67  }
    7.68  
    7.69  void Main::formatToggleLinkColorHint()
    7.70  {
    7.71 -	currentMapEditor()->toggleLinkColorHint();
    7.72 +	currentMapEditor()->toggleMapLinkColorHint();
    7.73  }
    7.74  
    7.75  void Main::formatFrameNone()
    7.76 @@ -3173,12 +3172,12 @@
    7.77  	actionViewToggleNoteEditor->setOn (textEditor->showWithMain());
    7.78  
    7.79  	QAction *a;
    7.80 -	if (me->getLinkColorHint()==HeadingColor) 
    7.81 +	if (me->getMapLinkColorHint()==HeadingColor) 
    7.82  		actionFormatLinkColorHint->setOn(true);
    7.83  	else	
    7.84  		actionFormatLinkColorHint->setOn(false);
    7.85  
    7.86 -	switch (me->getLinkStyle())
    7.87 +	switch (me->getMapLinkStyle())
    7.88  	{
    7.89  		case StyleLine: 
    7.90  			actionFormatLinkStyleLine->setOn(true);
    7.91 @@ -3197,9 +3196,9 @@
    7.92  	}	
    7.93  
    7.94  	QPixmap pix( 16, 16 );
    7.95 -    pix.fill( me->getBackgroundColor() );
    7.96 +    pix.fill( me->getMapBackgroundColor() );
    7.97      actionFormatBackColor->setIconSet( pix );
    7.98 -    pix.fill( me->getDefLinkColor() );
    7.99 +    pix.fill( me->getMapDefLinkColor() );
   7.100      actionFormatLinkColor->setIconSet( pix );
   7.101  
   7.102  	actionFileSave->setEnabled( me->isUnsaved() );
   7.103 @@ -3415,7 +3414,6 @@
   7.104  {
   7.105  	if (!currentMapEditor()) return;
   7.106  	currentMapEditor()->testFunction();
   7.107 -	
   7.108  }
   7.109  
   7.110  void Main::testCommand()
     8.1 --- a/mapeditor.cpp	Mon Oct 30 12:39:37 2006 +0000
     8.2 +++ b/mapeditor.cpp	Thu Nov 16 10:07:11 2006 +0000
     8.3 @@ -91,13 +91,18 @@
     8.4  	linkstyle=StylePolyParabel;
     8.5  
     8.6  	// Create bitmap cursors, platform dependant
     8.7 -	#if defined(Q_OS_MACX)
     8.8 -		handOpenCursor=QCursor ( QPixmap(iconPath+"cursorhandopen16.png"),1,1 );		
     8.9 -		pickColorCursor=QCursor ( QPixmap (iconPath+"cursorcolorpicker16.png"), 1,15 ); 
    8.10 -	#else
    8.11 -		handOpenCursor=QCursor (QPixmap(iconPath+"cursorhandopen.png"),1,1);		
    8.12 -		pickColorCursor=QCursor ( QPixmap(iconPath+"cursorcolorpicker.png"), 5,27 ); 
    8.13 -	#endif
    8.14 +	// FIXME should now work also on Mac...
    8.15 +	//#if defined(Q_OS_MACX)
    8.16 +	//	HandOpenCursor=QCursor ( QPixmap(iconPath+"cursorhandopen16.png"),1,1 );		
    8.17 +	//	PickColorCursor=QCursor ( QPixmap (iconPath+"cursorcolorpicker16.png"), 1,15 ); 
    8.18 +	//#else
    8.19 +		HandOpenCursor=QCursor (QPixmap(iconPath+"cursorhandopen.png"),1,1);		
    8.20 +		PickColorCursor=QCursor ( QPixmap(iconPath+"cursorcolorpicker.png"), 5,27 ); 
    8.21 +		CopyCursor=QCursor ( QPixmap(iconPath+"cursorcopy.png"), 5,5 ); 
    8.22 +		XLinkCursor=QCursor ( QPixmap(iconPath+"cursorxlink.png"), 5,27 ); 
    8.23 +	//#endif
    8.24 +
    8.25 +	setFocusPolicy (Qt::StrongFocus);
    8.26  
    8.27  	pickingColor=false;
    8.28  	drawingLink=false;
    8.29 @@ -122,7 +127,7 @@
    8.30  	fileName=tr("unnamed");
    8.31  	mapName="";
    8.32  
    8.33 -	stepsTotal=settings.readNumEntry("/mapeditor/stepsTotal",50);
    8.34 +	stepsTotal=settings.readNumEntry("/mapeditor/stepsTotal",100);
    8.35  	undoSet.setEntry ("/history/stepsTotal",QString::number(stepsTotal));
    8.36  	
    8.37  	// Initialize find routine
    8.38 @@ -162,11 +167,6 @@
    8.39  	//cout <<"Destructor MapEditor\n";
    8.40  }
    8.41  
    8.42 -QColor MapEditor::getBackgroundColor()
    8.43 -{
    8.44 -    return mapCanvas->backgroundColor();
    8.45 -}
    8.46 -
    8.47  MapCenterObj* MapEditor::getMapCenter()
    8.48  {
    8.49      return mapCenter;
    8.50 @@ -304,7 +304,7 @@
    8.51  		colhint=attribut("linkColorHint","HeadingColor");
    8.52  
    8.53  	QString mapAttr=attribut("version",__VYM_VERSION);
    8.54 -	if (!saveSel)
    8.55 +	if (!saveSel || saveSel==mapCenter)
    8.56  		mapAttr+= attribut("author",mapCenter->getAuthor()) +
    8.57  				  attribut("comment",mapCenter->getComment()) +
    8.58  			      attribut("date",mapCenter->getDate()) +
    8.59 @@ -324,7 +324,7 @@
    8.60  	FloatImageObj (mapCanvas).resetSaveCounter();
    8.61  
    8.62  	// Build xml recursivly
    8.63 -	if (!saveSel)
    8.64 +	if (!saveSel || typeid (*saveSel) == typeid (MapCenterObj))
    8.65  		// Save complete map, if saveSel not set
    8.66  		s+=mapCenter->saveToDir(tmpdir,prefix,writeflags,offset);
    8.67  	else
    8.68 @@ -338,6 +338,7 @@
    8.69  			
    8.70  		else if (selection && typeid(*selection)==typeid(BranchObj))
    8.71  			// Save selected branch is saved from mainwindow		//FIXME maybe use "subtree" above?
    8.72 +			// FIXME is this possible at all? BO is already above...
    8.73  			s+=((BranchObj*)selection)->saveToDir(tmpdir,prefix,offset);
    8.74  	}
    8.75  
    8.76 @@ -356,16 +357,6 @@
    8.77  	return s;
    8.78  }
    8.79  
    8.80 -void MapEditor::saveStateComplete(const QString &comment)
    8.81 -{
    8.82 -	// Save complete map, Undo will replace whole map
    8.83 -	saveState (CompleteMap,
    8.84 -		"", "",
    8.85 -		"", "", 
    8.86 -		comment, 
    8.87 -		mapCenter);
    8.88 -}
    8.89 -
    8.90  void MapEditor::saveStateChangingPart(LinkableMapObj *undoSel, LinkableMapObj* redoSel, const QString &rc, const QString &comment)
    8.91  {
    8.92  	// save the selected part of the map, Undo will replace part of map 
    8.93 @@ -382,7 +373,7 @@
    8.94  		
    8.95  
    8.96  	saveState (PartOfMap,
    8.97 -		undoSelection, "",
    8.98 +		undoSelection, "addMapReplace (\"PATH\")",
    8.99  		redoSelection, rc, 
   8.100  		comment, 
   8.101  		undoSel);
   8.102 @@ -397,7 +388,7 @@
   8.103  	}
   8.104  	QString undoSelection=redoSel->getParObj()->getSelectString();
   8.105  	QString redoSelection=redoSel->getSelectString();
   8.106 -	if (typeid(*redoSel) == typeid(BranchObj) && redoSel->getDepth()>1 ) 
   8.107 +	if (typeid(*redoSel) == typeid(BranchObj)  ) 
   8.108  	{
   8.109  		// save the selected branch of the map, Undo will insert part of map 
   8.110  		saveState (PartOfMap,
   8.111 @@ -405,15 +396,6 @@
   8.112  			redoSelection, "delete ()", 
   8.113  			comment, 
   8.114  			redoSel);
   8.115 -	} else if (typeid(*redoSel) == typeid(BranchObj) )
   8.116 -	{
   8.117 -		// save the selected mainbranch of the map, Undo will insert part of map 
   8.118 -		saveState (PartOfMap,
   8.119 -			undoSelection, QString("addMapInsert (\"PATH\",%1)").arg(((BranchObj*)redoSel)->getNum()),
   8.120 -			redoSelection, "delete ()", 
   8.121 -			comment, 
   8.122 -			redoSel);
   8.123 -		
   8.124  	}
   8.125  }
   8.126  
   8.127 @@ -467,7 +449,7 @@
   8.128  	curStep++;
   8.129  	if (curStep>stepsTotal) curStep=1;
   8.130  	
   8.131 -	QString backupXML;
   8.132 +	QString backupXML="";
   8.133  	QString bakMapName=QDir::convertSeparators (QString("history-%1").arg(curStep));
   8.134  	QString bakMapDir=QDir::convertSeparators (tmpMapDir +"/"+bakMapName);
   8.135  	QString bakMapPath=QDir::convertSeparators(bakMapDir+"/map.xml");
   8.136 @@ -478,9 +460,7 @@
   8.137  		makeSubDirs (bakMapDir);
   8.138  
   8.139  	// Save depending on how much needs to be saved	
   8.140 -	if (!saveSel)
   8.141 -		backupXML="";
   8.142 -	else 
   8.143 +	if (saveSel)
   8.144  		backupXML=saveToDir (bakMapDir,mapName+"-",false, QPoint (),saveSel);
   8.145  		
   8.146  	QString undoCommand="";
   8.147 @@ -492,10 +472,8 @@
   8.148  	{
   8.149  		undoCommand=undoCom;
   8.150  		undoCommand.replace ("PATH",bakMapPath);
   8.151 -	} else
   8.152 -	{
   8.153 -		undoCommand="undoMap (\""+bakMapPath+"\")";
   8.154  	}
   8.155 +
   8.156  	if (!backupXML.isEmpty())
   8.157  		// Write XML Data to disk
   8.158  		saveStringToDisk (QString(bakMapPath),backupXML);
   8.159 @@ -529,6 +507,7 @@
   8.160  	cout << "    undoSel="<<undoSelection.toStdString()<<endl;
   8.161  	cout << "    redoCom="<<redoCom.toStdString()<<endl;
   8.162  	cout << "    redoSel="<<redoSelection.toStdString()<<endl;
   8.163 +	if (saveSel) cout << "    saveSel="<<saveSel->getSelectString().ascii()<<endl;
   8.164  	cout << "    ---------------------------"<<endl;
   8.165  
   8.166  	historyWindow.update (undoSet);
   8.167 @@ -597,12 +576,12 @@
   8.168  					 typeid(*selection) != typeid(MapCenterObj)) )
   8.169  		{				  
   8.170  			api.setError (Aborted,"Type of selection is not a branch");
   8.171 -		} else if (api.checkParamCount(2))
   8.172 +		} else if (api.checkParamCount(1))
   8.173  		{
   8.174 -			s=api.parString (ok,0);	// selection
   8.175 -			t=api.parString (ok,1);	// path to map
   8.176 +			//s=api.parString (ok,0);	// selection
   8.177 +			t=api.parString (ok,0);	// path to map
   8.178  			if (QDir::isRelativePath(t)) t=QDir::convertSeparators (tmpMapDir + "/"+t);
   8.179 -			addMapReplaceInt(s,t);	
   8.180 +			addMapReplaceInt(selection->getSelectString(),t);	
   8.181  		}
   8.182  	} else if (com==QString("addMapInsert"))
   8.183  	{
   8.184 @@ -818,6 +797,62 @@
   8.185  		{	
   8.186  			paste();
   8.187  		}	
   8.188 +	} else if (com=="select")
   8.189 +	{
   8.190 +		if (api.checkParamCount(1))
   8.191 +		{
   8.192 +			s=api.parString(ok,0);
   8.193 +			if (ok) select (s);
   8.194 +		}	
   8.195 +	} else if (com=="setMapAuthor")
   8.196 +	{
   8.197 +		if (api.checkParamCount(1))
   8.198 +		{
   8.199 +			s=api.parString(ok,0);
   8.200 +			if (ok) setMapAuthor (s);
   8.201 +		}	
   8.202 +	} else if (com=="setMapComment")
   8.203 +	{
   8.204 +		if (api.checkParamCount(1))
   8.205 +		{
   8.206 +			s=api.parString(ok,0);
   8.207 +			if (ok) setMapComment(s);
   8.208 +		}	
   8.209 +	} else if (com=="setMapBackgroundColor")
   8.210 +	{
   8.211 +		if (!selection)
   8.212 +		{
   8.213 +			api.setError (Aborted,"Nothing selected");
   8.214 +		} else if ( (typeid(*selection) != typeid(BranchObj) && 
   8.215 +					 typeid(*selection) != typeid(MapCenterObj)) )
   8.216 +		{				  
   8.217 +			api.setError (Aborted,"Type of selection is not a branch");
   8.218 +		} else if (api.checkParamCount(1))
   8.219 +		{
   8.220 +			QColor c=api.parColor (ok,0);
   8.221 +			if (ok) setMapBackgroundColor (c);
   8.222 +		}	
   8.223 +	} else if (com=="setMapDefLinkColor")
   8.224 +	{
   8.225 +		if (!selection)
   8.226 +		{
   8.227 +			api.setError (Aborted,"Nothing selected");
   8.228 +		} else if ( (typeid(*selection) != typeid(BranchObj) && 
   8.229 +					 typeid(*selection) != typeid(MapCenterObj)) )
   8.230 +		{				  
   8.231 +			api.setError (Aborted,"Type of selection is not a branch");
   8.232 +		} else if (api.checkParamCount(1))
   8.233 +		{
   8.234 +			QColor c=api.parColor (ok,0);
   8.235 +			if (ok) setMapDefLinkColor (c);
   8.236 +		}	
   8.237 +	} else if (com=="setMapLinkStyle")
   8.238 +	{
   8.239 +		if (api.checkParamCount(1))
   8.240 +		{
   8.241 +			s=api.parString (ok,0);
   8.242 +			if (ok) setMapLinkStyle(s);
   8.243 +		}	
   8.244  	} else if (com=="setHeading")
   8.245  	{
   8.246  		if (!selection)
   8.247 @@ -915,20 +950,7 @@
   8.248  				bo->updateFlagsToolbar();
   8.249  			}	
   8.250  		}
   8.251 -	// Internal commands
   8.252 -	} else if (com==QString("undoMap"))
   8.253 -	{
   8.254 -		if (api.checkParamCount(1))
   8.255 -			addMapReplaceInt("",api.parString (ok,0));
   8.256 -	} else if (com=="select")
   8.257 -	{
   8.258 -		if (api.checkParamCount(1))
   8.259 -		{
   8.260 -			s=api.parString(ok,0);
   8.261 -			if (ok) select (s);
   8.262 -		}	
   8.263 -	}	
   8.264 -	else
   8.265 +	} else
   8.266  	{
   8.267  		api.setError (Aborted,"Unknown command");
   8.268  	}
   8.269 @@ -1126,9 +1148,6 @@
   8.270  {
   8.271  	int returnCode=0;
   8.272  
   8.273 -	// The SaveMode UndoCommand is not supported here
   8.274 -	if (savemode==UndoCommand) return 1;
   8.275 -
   8.276  	// Create mapName and fileDir
   8.277  	makeSubDirs (fileDir);
   8.278  	QString fname;
   8.279 @@ -2454,18 +2473,29 @@
   8.280  	}
   8.281  }
   8.282  
   8.283 -void MapEditor::selectBackgroundColor()
   8.284 +void MapEditor::selectMapBackgroundColor()
   8.285  {
   8.286  	QColor col = QColorDialog::getColor( mapCanvas->backgroundColor(), this );
   8.287  	if ( !col.isValid() ) return;
   8.288  	setBackgroundColor( col );
   8.289 -	//TODO undocomm
   8.290 -	saveStateComplete(QString("Set background color of map to %1").arg(col.name()));
   8.291  }
   8.292  
   8.293 -void MapEditor::setBackgroundColor(QColor c)
   8.294 +
   8.295 +void MapEditor::setMapBackgroundColor(QColor col)
   8.296  {
   8.297 -	mapCanvas->setBackgroundColor (c);
   8.298 +	QColor oldcol=mapCanvas->backgroundColor();
   8.299 +	saveState(
   8.300 +		selection,
   8.301 +		QString ("setMapBackgroundColor (%1)").arg(oldcol.name()),
   8.302 +		selection,
   8.303 +		QString ("setMapBackgroundColor (%1)").arg(col.name()),
   8.304 +		QString("Set background color of map to %1").arg(col.name()));
   8.305 +	mapCanvas->setBackgroundColor (col);
   8.306 +}
   8.307 +
   8.308 +QColor MapEditor::getMapBackgroundColor()
   8.309 +{
   8.310 +    return mapCanvas->backgroundColor();
   8.311  }
   8.312  
   8.313  QColor MapEditor::getCurrentHeadingColor()
   8.314 @@ -2492,12 +2522,13 @@
   8.315  			typeid(*selection) == typeid(MapCenterObj))
   8.316  		{
   8.317  			BranchObj *bo=(BranchObj*)selection;
   8.318 -			saveStateChangingPart(
   8.319 +			saveState(
   8.320  				selection, 
   8.321 +				QString ("colorItem (%1)").arg(bo->getColor().name()),
   8.322  				selection,
   8.323  				QString ("colorItem (%1)").arg(c.name()),
   8.324  				QString("Set color of %1 to %2").arg(getName(bo)).arg(c.name())
   8.325 -			);	//TODO with complete API: undoCommand
   8.326 +			);	
   8.327  			bo->setColor(c); // color branch
   8.328  		}    
   8.329  	}
   8.330 @@ -2918,9 +2949,8 @@
   8.331  	// Finally show dialog
   8.332  	if (dia.exec() == QDialog::Accepted)
   8.333  	{
   8.334 -		saveStateComplete("Edit info about map");	//TODO undoCommand
   8.335 -		mapCenter->setAuthor (dia.getAuthor() );
   8.336 -		mapCenter->setComment (dia.getComment() );
   8.337 +		setMapAuthor (dia.getAuthor() );
   8.338 +		setMapComment (dia.getComment() );
   8.339  	}
   8.340  }
   8.341  
   8.342 @@ -2938,11 +2968,48 @@
   8.343  			((BranchObj*)selection)->updateNoteFlag();
   8.344  }
   8.345  
   8.346 -void MapEditor::setLinkStyle (LinkStyle ls)
   8.347 +void MapEditor::setMapAuthor (const QString &s)
   8.348  {
   8.349 -	linkstyle=ls;
   8.350 -
   8.351 -	saveStateComplete("Set link style");	// TODO undoCommand
   8.352 +	saveState (
   8.353 +		selection,
   8.354 +		QString ("setMapAuthor (\"%1\")").arg(mapCenter->getAuthor()),
   8.355 +		selection,
   8.356 +		QString ("setMapAuthor (\"%1\")").arg(s),
   8.357 +		QString ("Set author of map to \"%1\"").arg(s)
   8.358 +	);
   8.359 +	mapCenter->setAuthor (s);
   8.360 +}
   8.361 +
   8.362 +void MapEditor::setMapComment (const QString &s)
   8.363 +{
   8.364 +	saveState (
   8.365 +		selection,
   8.366 +		QString ("setMapComment (\"%1\")").arg(mapCenter->getComment()),
   8.367 +		selection,
   8.368 +		QString ("setMapComment (\"%1\")").arg(s),
   8.369 +		QString ("Set comment of map")
   8.370 +	);
   8.371 +	mapCenter->setComment (s);
   8.372 +}
   8.373 +
   8.374 +void MapEditor::setMapLinkStyle (const QString & s)
   8.375 +{
   8.376 +	saveStateChangingPart (
   8.377 +		mapCenter,
   8.378 +		mapCenter,
   8.379 +		QString("setMapLinkStyle (\"%1\")").arg(s),
   8.380 +		QString("Set map link style (\"%1\")").arg(s)
   8.381 +	);	
   8.382 +
   8.383 +	if (s=="StyleLine")
   8.384 +		linkstyle=StyleLine;
   8.385 +	else if (s=="StyleParabel")
   8.386 +		linkstyle=StyleParabel;
   8.387 +	else if (s=="StylePolyLine")
   8.388 +		linkstyle=StylePolyLine;
   8.389 +	else	
   8.390 +		linkstyle=StylePolyParabel;
   8.391 +
   8.392  	BranchObj *bo;
   8.393  	bo=mapCenter->first();
   8.394  	bo=bo->next();
   8.395 @@ -2954,20 +3021,20 @@
   8.396  	mapCenter->reposition();
   8.397  }
   8.398  
   8.399 -LinkStyle MapEditor::getLinkStyle ()
   8.400 +LinkStyle MapEditor::getMapLinkStyle ()
   8.401  {
   8.402  	return linkstyle;
   8.403  }	
   8.404  
   8.405 -void MapEditor::setLinkColor(QColor c)
   8.406 +void MapEditor::setMapDefLinkColor(QColor c)
   8.407  {
   8.408  	defLinkColor=c;
   8.409  	updateActions();
   8.410  }
   8.411  
   8.412 -void MapEditor::setLinkColorHint()
   8.413 +void MapEditor::setMapLinkColorHintInt()
   8.414  {
   8.415 -	// called from setLinkColorHint(lch) or at end of parse
   8.416 +	// called from setMapLinkColorHint(lch) or at end of parse
   8.417  	BranchObj *bo;
   8.418  	bo=mapCenter->first();
   8.419  	while (bo) 
   8.420 @@ -2977,13 +3044,13 @@
   8.421  	}
   8.422  }
   8.423  
   8.424 -void MapEditor::setLinkColorHint(LinkColorHint lch)
   8.425 +void MapEditor::setMapLinkColorHint(LinkColorHint lch)
   8.426  {
   8.427  	linkcolorhint=lch;
   8.428 -	setLinkColorHint();
   8.429 +	setMapLinkColorHintInt();
   8.430  }
   8.431  
   8.432 -void MapEditor::toggleLinkColorHint()
   8.433 +void MapEditor::toggleMapLinkColorHint()
   8.434  {
   8.435  	if (linkcolorhint==HeadingColor)
   8.436  		linkcolorhint=DefaultColor;
   8.437 @@ -2998,42 +3065,48 @@
   8.438  	}
   8.439  }
   8.440  
   8.441 -LinkColorHint MapEditor::getLinkColorHint()
   8.442 +LinkColorHint MapEditor::getMapLinkColorHint()
   8.443  {
   8.444  	return linkcolorhint;
   8.445  }
   8.446  
   8.447 -QColor MapEditor::getDefLinkColor()
   8.448 +QColor MapEditor::getMapDefLinkColor()
   8.449  {
   8.450  	return defLinkColor;
   8.451  }
   8.452  
   8.453 -void MapEditor::setDefXLinkColor(QColor col)
   8.454 +void MapEditor::setMapDefXLinkColor(QColor col)
   8.455  {
   8.456  	defXLinkColor=col;
   8.457  }
   8.458  
   8.459 -QColor MapEditor::getDefXLinkColor()
   8.460 +QColor MapEditor::getMapDefXLinkColor()
   8.461  {
   8.462  	return defXLinkColor;
   8.463  }
   8.464  
   8.465 -void MapEditor::setDefXLinkWidth (int w)
   8.466 +void MapEditor::setMapDefXLinkWidth (int w)
   8.467  {
   8.468  	defXLinkWidth=w;
   8.469  }
   8.470  
   8.471 -int MapEditor::getDefXLinkWidth()
   8.472 +int MapEditor::getMapDefXLinkWidth()
   8.473  {
   8.474  	return defXLinkWidth;
   8.475  }
   8.476  
   8.477 -void MapEditor::selectLinkColor()
   8.478 +void MapEditor::selectMapLinkColor()
   8.479  {
   8.480  	QColor col = QColorDialog::getColor( defLinkColor, this );
   8.481  	if ( !col.isValid() ) return;
   8.482 -	setLinkColor( col );
   8.483 -	saveStateComplete(QString("Set link color to %1").arg(col.name()));	//TODO undoCommand
   8.484 +	saveState (
   8.485 +		selection,
   8.486 +		QString("setMapDefLinkColor (\"%1\")").arg(getMapDefLinkColor().name()),
   8.487 +		selection,
   8.488 +		QString("setMapDefLinkColor (\"%1\")").arg(col.name()),
   8.489 +		QString("Set link color to %1").arg(col.name())
   8.490 +	);
   8.491 +	setMapDefLinkColor( col );
   8.492  
   8.493  }
   8.494  
   8.495 @@ -3326,12 +3399,12 @@
   8.496  			{
   8.497  				if (dia.useSettingsGlobal() )
   8.498  				{
   8.499 -					setDefXLinkColor (xlo->getColor() );
   8.500 -					setDefXLinkWidth (xlo->getWidth() );
   8.501 +					setMapDefXLinkColor (xlo->getColor() );
   8.502 +					setMapDefXLinkWidth (xlo->getWidth() );
   8.503  				}
   8.504  				if (dia.deleteXLink())
   8.505  					((BranchObj*)selection)->deleteXLinkAt(i);
   8.506 -				saveStateComplete("Edit xLink");	//TODO undoCommand
   8.507 +				//saveStateComplete("Edit xLink");	//FIXME undoCommand
   8.508  			}
   8.509  		}	
   8.510  	}
   8.511 @@ -3459,6 +3532,34 @@
   8.512  	e->accept();
   8.513  }
   8.514  
   8.515 +void MapEditor::keyPressEvent(QKeyEvent* e)
   8.516 +{
   8.517 +	if (e->modifiers() && Qt::ControlModifier)
   8.518 +	{
   8.519 +		switch (mainWindow->getModMode())
   8.520 +		{
   8.521 +			case ModModeColor: 
   8.522 +				setCursor (PickColorCursor);
   8.523 +				break;
   8.524 +			case ModModeCopy: 
   8.525 +				setCursor (CopyCursor);
   8.526 +				break;
   8.527 +			case ModModeXLink: 
   8.528 +				setCursor (XLinkCursor);
   8.529 +				break;
   8.530 +			default :
   8.531 +				setCursor (Qt::ArrowCursor);
   8.532 +				break;
   8.533 +		} 
   8.534 +	}	
   8.535 +}
   8.536 +
   8.537 +void MapEditor::keyReleaseEvent(QKeyEvent* e)
   8.538 +{
   8.539 +	if (!(e->modifiers() && Qt::ControlModifier))
   8.540 +		setCursor (Qt::ArrowCursor);
   8.541 +}
   8.542 +
   8.543  void MapEditor::contentsMousePressEvent(QMouseEvent* e)
   8.544  {
   8.545  	// Ignore right clicks, these will go to context menus
   8.546 @@ -3510,7 +3611,7 @@
   8.547  		if (mainWindow->getModMode()==ModModeColor)
   8.548  		{
   8.549  				pickingColor=true;
   8.550 -				setCursor (pickColorCursor);
   8.551 +				setCursor (PickColorCursor);
   8.552  				return;
   8.553  		} 
   8.554  		if (mainWindow->getModMode()==ModModeXLink)
   8.555 @@ -3582,7 +3683,7 @@
   8.556  			movingObj_start=e->globalPos();
   8.557  			movingCont_start=QPoint (contentsX(), contentsY() );
   8.558  			movingVec=QPoint(0,0);
   8.559 -			setCursor(handOpenCursor);
   8.560 +			setCursor(HandOpenCursor);
   8.561  		} 
   8.562      } 
   8.563  }
   8.564 @@ -3629,7 +3730,7 @@
   8.565  				if (typeid(*fo) == typeid(FloatImageObj)) 
   8.566  				{
   8.567  					//TODO undocom
   8.568 -					saveStateComplete(QString("Relink %1 to %2").arg(getName(fo)).arg(getName(lmo) ) );
   8.569 +					//saveStateComplete(QString("Relink %1 to %2").arg(getName(fo)).arg(getName(lmo) ) );
   8.570  					FloatImageObj *fio=(FloatImageObj*)(fo);
   8.571  					((BranchObj*)(lmo))->addFloatImage (fio);
   8.572  					fio->unselect();
   8.573 @@ -3756,7 +3857,7 @@
   8.574  			tmpXLink->setEnd ( ((BranchObj*)(dst)) );
   8.575  			tmpXLink->updateXLink();
   8.576  			tmpXLink->activate();
   8.577 -			saveStateComplete(QString("Activate xLink from %1 to %2").arg(getName(tmpXLink->getBegin())).arg(getName(tmpXLink->getEnd())) );	//TODO undoCommand
   8.578 +			//saveStateComplete(QString("Activate xLink from %1 to %2").arg(getName(tmpXLink->getBegin())).arg(getName(tmpXLink->getEnd())) );	//FIXME undoCommand
   8.579  		} else
   8.580  		{
   8.581  			delete(tmpXLink);
   8.582 @@ -4064,7 +4165,7 @@
   8.583  		if (update) 
   8.584  		{
   8.585  			//FIXME saveState has to be called earlier for each of the drops...
   8.586 -			saveStateComplete("Drop Event");	//TODO undo Command
   8.587 +			//saveStateComplete("Drop Event");	//TODO undo Command
   8.588  			mapCenter->reposition();
   8.589  			adjustCanvasSize();
   8.590  			canvas()->update();
     9.1 --- a/mapeditor.h	Mon Oct 30 12:39:37 2006 +0000
     9.2 +++ b/mapeditor.h	Thu Nov 16 10:07:11 2006 +0000
     9.3 @@ -20,7 +20,6 @@
     9.4  public:
     9.5      MapEditor(QWidget* parent=0,  const char* name=0, Qt::WFlags f=0);
     9.6  	~MapEditor();
     9.7 -    QColor getBackgroundColor();
     9.8      MapCenterObj* getMapCenter();
     9.9  	Q3Canvas* getCanvas();
    9.10  	void adjustCanvasSize();// adjust canvas size to map and scrollview
    9.11 @@ -30,7 +29,6 @@
    9.12  	QString getName(LinkableMapObj*);	// Get e.g. heading or filename
    9.13  	void makeTmpDirs();		// create temporary directories
    9.14      QString saveToDir(const QString&,const QString &,bool, const QPoint &,LinkableMapObj*);
    9.15 -    void saveStateComplete       (const QString &);					
    9.16      void saveStateChangingPart (LinkableMapObj *, LinkableMapObj *, const QString &, const QString &);
    9.17      void saveStateRemovingPart (LinkableMapObj *, const QString &);
    9.18      void saveState(LinkableMapObj *, const QString &, LinkableMapObj *, const QString &, const QString &);
    9.19 @@ -121,8 +119,9 @@
    9.20      void selectRightBranch();
    9.21      void selectFirstBranch();
    9.22      void selectLastBranch();
    9.23 -    void selectBackgroundColor();
    9.24 -    void setBackgroundColor(QColor);
    9.25 +    void selectMapBackgroundColor();
    9.26 +    void setMapBackgroundColor(QColor);
    9.27 +    QColor getMapBackgroundColor();
    9.28      QColor getCurrentHeadingColor();
    9.29      void colorItem(QColor);
    9.30      void colorBranch(QColor);
    9.31 @@ -148,19 +147,21 @@
    9.32  	void editMapInfo();						// dialog to enter author, ...
    9.33  	void updateActions();					// update e.g. format buttons
    9.34  	void updateNoteFlag();					// when TextEditor changes
    9.35 -	void setLinkStyle (LinkStyle);			// Set style of link
    9.36 -	LinkStyle getLinkStyle ();				// requested in LMO
    9.37 -	void setLinkColor(QColor);				// default color of links
    9.38 -	void setLinkColorHint();				// color of links
    9.39 -	void setLinkColorHint(LinkColorHint);	// color of links
    9.40 -	LinkColorHint getLinkColorHint();
    9.41 -	QColor getDefLinkColor();
    9.42 -	void setDefXLinkColor(QColor);
    9.43 -	QColor getDefXLinkColor();
    9.44 -	void setDefXLinkWidth (int);
    9.45 -	int getDefXLinkWidth();
    9.46 -	void toggleLinkColorHint();				// after changing linkStyles
    9.47 -    void selectLinkColor();
    9.48 +	void setMapAuthor (const QString &);
    9.49 +	void setMapComment(const QString &);
    9.50 +	void setMapLinkStyle (const QString &);	// Set style of link
    9.51 +	LinkStyle getMapLinkStyle ();			// requested in LMO
    9.52 +	void setMapDefLinkColor(QColor);		// default color of links
    9.53 +	void setMapLinkColorHintInt();			// color of links
    9.54 +	void setMapLinkColorHint(LinkColorHint);// color of links
    9.55 +	LinkColorHint getMapLinkColorHint();
    9.56 +	QColor getMapDefLinkColor();
    9.57 +	void setMapDefXLinkColor(QColor);
    9.58 +	QColor getMapDefXLinkColor();
    9.59 +	void setMapDefXLinkWidth (int);
    9.60 +	int getMapDefXLinkWidth();
    9.61 +	void toggleMapLinkColorHint();			// after changing linkStyles
    9.62 +    void selectMapLinkColor();
    9.63      void toggleScroll();
    9.64      void unScrollAll();
    9.65  	void loadFloatImage ();
    9.66 @@ -183,6 +184,8 @@
    9.67  	void ensureSelectionVisible();		
    9.68  	virtual void updateViewCenter();	// needed for zooming
    9.69  	virtual void contentsContextMenuEvent ( QContextMenuEvent *e );
    9.70 +    virtual void keyPressEvent(QKeyEvent*);
    9.71 +    virtual void keyReleaseEvent(QKeyEvent*);
    9.72      virtual void contentsMousePressEvent(QMouseEvent*);
    9.73      virtual void contentsMouseReleaseEvent(QMouseEvent*);
    9.74      virtual void contentsMouseDoubleClickEvent(QMouseEvent*);
    9.75 @@ -203,8 +206,10 @@
    9.76  	LinkColorHint linkcolorhint;// use heading color or own color
    9.77  	LinkStyle linkstyle;		// default style for links
    9.78  
    9.79 -    QCursor handOpenCursor;		// cursor while moving canvas view
    9.80 -	QCursor pickColorCursor;	// cursor while picking color 
    9.81 +    QCursor HandOpenCursor;		// cursor while moving canvas view
    9.82 +	QCursor PickColorCursor;	// cursor while picking color 
    9.83 +	QCursor CopyCursor;			// cursor while picking color 
    9.84 +	QCursor XLinkCursor;		// cursor while picking color 
    9.85  	bool pickingColor;
    9.86  	bool drawingLink;			// true while creating a link
    9.87  	bool copyingObj;			// true while creating a link
    10.1 --- a/ornamentedobj.cpp	Mon Oct 30 12:39:37 2006 +0000
    10.2 +++ b/ornamentedobj.cpp	Thu Nov 16 10:07:11 2006 +0000
    10.3 @@ -86,10 +86,10 @@
    10.4  
    10.5  void OrnamentedObj::setLinkColor()
    10.6  {
    10.7 -	if (mapEditor->getLinkColorHint()==HeadingColor)
    10.8 +	if (mapEditor->getMapLinkColorHint()==HeadingColor)
    10.9  		LinkableMapObj::setLinkColor (heading->getColor());
   10.10  	else	
   10.11 -		LinkableMapObj::setLinkColor (mapEditor->getDefLinkColor());
   10.12 +		LinkableMapObj::setLinkColor (mapEditor->getMapDefLinkColor());
   10.13  }
   10.14  
   10.15  void OrnamentedObj::setColor (QColor col)
    11.1 --- a/version.h	Mon Oct 30 12:39:37 2006 +0000
    11.2 +++ b/version.h	Thu Nov 16 10:07:11 2006 +0000
    11.3 @@ -4,8 +4,8 @@
    11.4  #include <QString>
    11.5  
    11.6  #define __VYM "VYM"
    11.7 -#define __VYM_VERSION "1.8.58"
    11.8 -#define __BUILD_DATE "October 25, 2006"
    11.9 +#define __VYM_VERSION "1.8.59"
   11.10 +#define __BUILD_DATE "November 14, 2006"
   11.11  
   11.12  
   11.13  bool checkVersion(const QString &);
    12.1 --- a/vym.pro	Mon Oct 30 12:39:37 2006 +0000
    12.2 +++ b/vym.pro	Thu Nov 16 10:07:11 2006 +0000
    12.3 @@ -100,6 +100,7 @@
    12.4  QT += xml  
    12.5  
    12.6  TARGET  = vym
    12.7 +
    12.8  TRANSLATIONS += lang/vym_de.ts
    12.9  TRANSLATIONS += lang/vym_en.ts
   12.10  TRANSLATIONS += lang/vym_es.ts
    13.1 --- a/xml.cpp	Mon Oct 30 12:39:37 2006 +0000
    13.2 +++ b/xml.cpp	Thu Nov 16 10:07:11 2006 +0000
    13.3 @@ -74,7 +74,8 @@
    13.4  				mc->setVersion(atts.value( "version" ));
    13.5  
    13.6  		}
    13.7 -		if (loadMode==NewMap)
    13.8 +		if (loadMode==NewMap || 
    13.9 +			(loadMode==ImportReplace && me->getSelection()==mc))
   13.10  		{
   13.11  			if (!atts.value( "author").isEmpty() )
   13.12  			{
   13.13 @@ -92,37 +93,27 @@
   13.14  			if (!atts.value( "linkColorHint").isEmpty() ) 
   13.15  			{
   13.16  				if (atts.value("linkColorHint")=="HeadingColor")
   13.17 -					me->setLinkColorHint(HeadingColor);
   13.18 +					me->setMapLinkColorHint(HeadingColor);
   13.19  				else
   13.20 -					me->setLinkColorHint(DefaultColor);
   13.21 +					me->setMapLinkColorHint(DefaultColor);
   13.22  			}
   13.23  			if (!atts.value( "linkStyle").isEmpty() ) 
   13.24  			{
   13.25 -				QString s=atts.value("linkStyle");
   13.26 -				if (s=="StyleLine")
   13.27 -					me->setLinkStyle(StyleLine);
   13.28 -				else	
   13.29 -					if (s=="StyleParabel")
   13.30 -						me->setLinkStyle(StyleParabel);
   13.31 -					else	
   13.32 -						if (s=="StylePolyLine")
   13.33 -							me->setLinkStyle(StylePolyLine);
   13.34 -						else	
   13.35 -							me->setLinkStyle(StylePolyParabel);
   13.36 +				me->setMapLinkStyle(atts.value("linkStyle"));
   13.37  			}	
   13.38  			if (!atts.value( "linkColor").isEmpty() ) 
   13.39  			{
   13.40  				col.setNamedColor(atts.value("linkColor"));
   13.41 -				me->setLinkColor(col);
   13.42 +				me->setMapDefLinkColor(col);
   13.43  			}	
   13.44  			if (!atts.value( "defXLinkColor").isEmpty() ) 
   13.45  			{
   13.46  				col.setNamedColor(atts.value("defXLinkColor"));
   13.47 -				me->setDefXLinkColor(col);
   13.48 +				me->setMapDefXLinkColor(col);
   13.49  			}	
   13.50  			if (!atts.value( "defXLinkWidth").isEmpty() ) 
   13.51  			{
   13.52 -				me->setDefXLinkWidth(atts.value("defXLinkWidth").toInt ());
   13.53 +				me->setMapDefXLinkWidth(atts.value("defXLinkWidth").toInt ());
   13.54  			}	
   13.55  		}	
   13.56  	} else if ( eName == "select" && state == StateMap )