started doxygen documentation
authorinsilmaril
Wed, 25 Apr 2007 16:02:54 +0000
changeset 4738b9cfc26638c
parent 472 83a3be747ad9
child 474 d9add21ee9d3
started doxygen documentation
linkablemapobj.cpp
linkablemapobj.h
main.cpp
mainwindow.cpp
mainwindow.h
mapeditor.cpp
mapeditor.h
     1.1 --- a/linkablemapobj.cpp	Wed Apr 25 16:02:54 2007 +0000
     1.2 +++ b/linkablemapobj.cpp	Wed Apr 25 16:02:54 2007 +0000
     1.3 @@ -35,16 +35,16 @@
     1.4  {
     1.5  	switch (style)
     1.6  	{
     1.7 -		case StyleLine:
     1.8 +		case Line:
     1.9  			delete (l);
    1.10  			break;
    1.11 -		case StyleParabel:
    1.12 +		case Parabel:
    1.13  			while (!segment.isEmpty()) delete segment.takeFirst();
    1.14  			break;
    1.15 -		case StylePolyLine:
    1.16 +		case PolyLine:
    1.17  			delete (p);
    1.18  			break;
    1.19 -		case StylePolyParabel:
    1.20 +		case PolyParabel:
    1.21  			delete (p);
    1.22  			break;
    1.23  		default:
    1.24 @@ -63,11 +63,11 @@
    1.25      childPos=QPointF(0,0);
    1.26  	link2ParPos=false;
    1.27      l=NULL;
    1.28 -    orientation=OrientUndef;
    1.29 +    orientation=UndefinedOrientation;
    1.30      linkwidth=20;		
    1.31  	thickness_start=8;
    1.32 -    style=StyleUndef;
    1.33 -	linkpos=LinkBottom;
    1.34 +    style=UndefinedStyle;
    1.35 +	linkpos=Bottom;
    1.36      arcsegs=13;
    1.37      
    1.38  // TODO instead of linkcolor pen.color() could be used	all around
    1.39 @@ -181,37 +181,37 @@
    1.40  	return rightPad;
    1.41  }
    1.42  
    1.43 -LinkStyle LinkableMapObj::getDefLinkStyle ()
    1.44 +LinkableMapObj::Style LinkableMapObj::getDefLinkStyle ()
    1.45  {
    1.46 -	if (mapEditor==0) return StyleUndef;
    1.47 -	LinkStyle ls=mapEditor->getMapLinkStyle();
    1.48 +	if (mapEditor==0) return UndefinedStyle;
    1.49 +	Style ls=mapEditor->getMapLinkStyle();
    1.50  	switch (ls)
    1.51  	{
    1.52 -		case StyleLine: 
    1.53 +		case Line: 
    1.54  			return ls;
    1.55  			break;
    1.56 -		case StyleParabel:
    1.57 +		case Parabel:
    1.58  			return ls;
    1.59  			break;
    1.60 -		case StylePolyLine:	
    1.61 +		case PolyLine:	
    1.62  			if (depth>1)
    1.63 -				return StyleLine;
    1.64 +				return Line;
    1.65  			else	
    1.66  				return ls;
    1.67  			break;
    1.68 -		case StylePolyParabel:	
    1.69 +		case PolyParabel:	
    1.70  			if (depth>1)
    1.71 -				return StyleParabel;
    1.72 +				return Parabel;
    1.73  			else	
    1.74  				return ls;
    1.75  			break;
    1.76  		default: 
    1.77  			break;	
    1.78  	}	
    1.79 -	return StyleUndef;
    1.80 +	return UndefinedStyle;
    1.81  }
    1.82  
    1.83 -void LinkableMapObj::setLinkStyle(LinkStyle newstyle)
    1.84 +void LinkableMapObj::setLinkStyle(Style newstyle)
    1.85  {
    1.86  	//if (newstyle=style) return;
    1.87  	delLink();
    1.88 @@ -223,10 +223,10 @@
    1.89  		QGraphicsLineItem *cl;
    1.90  		switch (style)
    1.91  		{
    1.92 -			case StyleUndef:
    1.93 +			case UndefinedStyle:
    1.94  				bottomline->hide();
    1.95  				break;
    1.96 -			case StyleLine: 
    1.97 +			case Line: 
    1.98  				l = scene->addLine(QLineF(1,1,1,1),pen);
    1.99  				l->setZValue(Z_LINK);
   1.100  				if (visible)
   1.101 @@ -234,7 +234,7 @@
   1.102  				else
   1.103  					l->hide();
   1.104  				break;
   1.105 -			case StyleParabel:
   1.106 +			case Parabel:
   1.107  				for (int i=0;i<arcsegs;i++)
   1.108  				{
   1.109  					cl = scene->addLine(QLineF(i*5,0,i*10,100),pen);
   1.110 @@ -247,7 +247,7 @@
   1.111  				}
   1.112  				pa0.resize (arcsegs+1);
   1.113  				break;
   1.114 -			case StylePolyLine:	
   1.115 +			case PolyLine:	
   1.116  				p =scene->addPolygon(QPolygonF(),pen,linkcolor);
   1.117  				p->setZValue(Z_LINK);
   1.118  				if (visible)
   1.119 @@ -256,7 +256,7 @@
   1.120  					p->hide();
   1.121  				pa0.resize (3);
   1.122  				break;
   1.123 -			case StylePolyParabel:	
   1.124 +			case PolyParabel:	
   1.125  				p = scene->addPolygon(QPolygonF(),pen,linkcolor);
   1.126  				p->setZValue(Z_LINK);
   1.127  				if (visible)
   1.128 @@ -273,7 +273,7 @@
   1.129  	} 
   1.130  }
   1.131  
   1.132 -LinkStyle LinkableMapObj::getLinkStyle()
   1.133 +LinkableMapObj::Style LinkableMapObj::getLinkStyle()
   1.134  {
   1.135  	return style;
   1.136  }
   1.137 @@ -290,12 +290,12 @@
   1.138  	return hideLinkUnselected;
   1.139  }
   1.140  
   1.141 -void LinkableMapObj::setLinkPos(LinkPos lp)
   1.142 +void LinkableMapObj::setLinkPos(Position lp)
   1.143  {
   1.144  	linkpos=lp;
   1.145  }
   1.146  
   1.147 -LinkPos LinkableMapObj::getLinkPos()
   1.148 +LinkableMapObj::Position LinkableMapObj::getLinkPos()
   1.149  {
   1.150  	return linkpos;
   1.151  }
   1.152 @@ -316,17 +316,17 @@
   1.153      bottomline->setPen( pen );
   1.154  	switch (style)
   1.155  	{
   1.156 -		case StyleLine:
   1.157 +		case Line:
   1.158  			l->setPen( pen);
   1.159  			break;	
   1.160 -		case StyleParabel:	
   1.161 +		case Parabel:	
   1.162  			for (int i=0; i<segment.size(); ++i)
   1.163  				segment.at(i)->setPen( pen);
   1.164  			break;
   1.165 -		case StylePolyLine:
   1.166 +		case PolyLine:
   1.167  			p->setBrush( QBrush(col));
   1.168  			break;
   1.169 -		case StylePolyParabel:	
   1.170 +		case PolyParabel:	
   1.171  			p->setBrush( QBrush(col));
   1.172  			break;
   1.173  		default:
   1.174 @@ -353,17 +353,17 @@
   1.175  		bottomline->show();
   1.176  		switch (style)
   1.177  		{
   1.178 -			case StyleLine:
   1.179 +			case Line:
   1.180  				if (l) l->show();
   1.181  				break;
   1.182 -			case StyleParabel:	
   1.183 +			case Parabel:	
   1.184  				for (int i=0; i<segment.size(); ++i)
   1.185  					segment.at(i)->show();
   1.186  				break;	
   1.187 -			case StylePolyLine:
   1.188 +			case PolyLine:
   1.189  				if (p) p->show();
   1.190  				break;
   1.191 -			case StylePolyParabel:	
   1.192 +			case PolyParabel:	
   1.193  				if (p) p->show();
   1.194  				break;
   1.195  			default:
   1.196 @@ -374,17 +374,17 @@
   1.197  		bottomline->hide();
   1.198  		switch (style)
   1.199  		{
   1.200 -			case StyleLine:
   1.201 +			case Line:
   1.202  				if (l) l->hide();
   1.203  				break;
   1.204 -			case StyleParabel:	
   1.205 +			case Parabel:	
   1.206  				for (int i=0; i<segment.size(); ++i)
   1.207  					segment.at(i)->hide();
   1.208  				break;	
   1.209 -			case StylePolyLine:
   1.210 +			case PolyLine:
   1.211  				if (p) p->hide();
   1.212  				break;
   1.213 -			case StylePolyParabel:	
   1.214 +			case PolyParabel:	
   1.215  				if (p) p->hide();
   1.216  				break;
   1.217  			default:
   1.218 @@ -395,25 +395,25 @@
   1.219  
   1.220  void LinkableMapObj::setOrientation()
   1.221  {
   1.222 -	LinkOrient orientOld=orientation;
   1.223 +	Orientation orientOld=orientation;
   1.224  
   1.225  	if (!parObj) 
   1.226  	{
   1.227 -		orientation=OrientUndef;
   1.228 +		orientation=UndefinedOrientation;
   1.229  		return;
   1.230  	}
   1.231  		
   1.232      // Set orientation, first look for orientation of parent
   1.233 -    if (parObj->getOrientation() != OrientUndef ) 
   1.234 +    if (parObj->getOrientation() != UndefinedOrientation ) 
   1.235  		// use the orientation of the parent:
   1.236  		orientation=parObj->getOrientation();
   1.237      else
   1.238      {
   1.239  		// calc orientation depending on position rel to parent
   1.240  		if (absPos.x() < QPointF(parObj->getChildPos() ).x() )
   1.241 -			orientation=OrientLeftOfCenter; 
   1.242 +			orientation=LeftOfCenter; 
   1.243  		else
   1.244 -			orientation=OrientRightOfCenter;
   1.245 +			orientation=RightOfCenter;
   1.246      }
   1.247  	if (orientOld!=orientation) requestReposition();
   1.248  }
   1.249 @@ -434,14 +434,14 @@
   1.250  
   1.251  	// updateLink is called from move, but called from constructor we don't
   1.252  	// have parents yet...
   1.253 -	if (style==StyleUndef) return;	
   1.254 +	if (style==UndefinedStyle) return;	
   1.255  
   1.256  	switch (linkpos)
   1.257  	{
   1.258 -		case LinkMiddle:
   1.259 +		case Middle:
   1.260  			bottomlineY=bbox.top() + bbox.height()/2;	// draw link to middle (of frame)
   1.261  			break;
   1.262 -		case LinkBottom:
   1.263 +		case Bottom:
   1.264  			bottomlineY=bbox.bottom()-1;	// draw link to bottom of box
   1.265  			break;
   1.266  	}
   1.267 @@ -484,14 +484,14 @@
   1.268      // Draw the link
   1.269  	switch (style)
   1.270  	{
   1.271 -		case StyleLine:
   1.272 +		case Line:
   1.273  			//l->prepareGeometryChange();
   1.274  			l->setLine( QLine(qRound (parPos.x()),
   1.275  				qRound(parPos.y()),
   1.276  				qRound(p2x),
   1.277  				qRound(p2y) ));
   1.278  			break;	
   1.279 -		case StyleParabel:	
   1.280 +		case Parabel:	
   1.281  			parabel (pa0, p1x,p1y,p2x,p2y);
   1.282  			for (int i=0; i<segment.size(); ++i)
   1.283  			{
   1.284 @@ -499,7 +499,7 @@
   1.285  				segment.at(i)->setLine(QLineF( pa0.at(i).x(), pa0.at(i).y(),pa0.at(i+1).x(),pa0.at(i+1).y()));
   1.286  			}	
   1.287  			break;
   1.288 -		case StylePolyLine:
   1.289 +		case PolyLine:
   1.290  			pa0.clear();
   1.291  			pa0<<QPointF (qRound(p2x+tp.x()), qRound(p2y+tp.y()));
   1.292  			pa0<<QPointF (qRound(p2x-tp.x()), qRound(p2y-tp.y()));
   1.293 @@ -507,7 +507,7 @@
   1.294  			//p->prepareGeometryChange();
   1.295  			p->setPolygon(QPolygonF (pa0));
   1.296  			break;
   1.297 -		case StylePolyParabel:	
   1.298 +		case PolyParabel:	
   1.299  			parabel (pa1, p1x,p1y,p2x+tp.x(),p2y+tp.y());
   1.300  			parabel (pa2, p1x,p1y,p2x-tp.x(),p2y-tp.y());
   1.301  			pa0.clear();
   1.302 @@ -585,7 +585,7 @@
   1.303  	}	
   1.304  }
   1.305  
   1.306 -LinkOrient LinkableMapObj::getOrientation()
   1.307 +LinkableMapObj::Orientation LinkableMapObj::getOrientation()
   1.308  {
   1.309      return orientation;
   1.310  }
   1.311 @@ -656,6 +656,8 @@
   1.312  
   1.313  void LinkableMapObj::select()
   1.314  {
   1.315 +	// select and unselect are still needed to
   1.316 +	// handle hiding of links
   1.317      selected=true;
   1.318  	setVisibility (visible);
   1.319  }
   1.320 @@ -705,3 +707,4 @@
   1.321  		return attribut ("hideLink","false");
   1.322  	
   1.323  }
   1.324 +
     2.1 --- a/linkablemapobj.h	Wed Apr 25 16:02:54 2007 +0000
     2.2 +++ b/linkablemapobj.h	Wed Apr 25 16:02:54 2007 +0000
     2.3 @@ -1,6 +1,7 @@
     2.4  #ifndef LINKABLEMAPOBJ_H
     2.5  #define LINKABLEMAPOBJ_H
     2.6  
     2.7 +#include "animpoint.h"
     2.8  #include "noteobj.h"
     2.9  #include "headingobj.h"
    2.10  #include "flagrowobj.h"
    2.11 @@ -8,20 +9,43 @@
    2.12  
    2.13  #define MAX_DEPTH 999
    2.14  
    2.15 -enum LinkOrient {OrientUndef,OrientLeftOfCenter, OrientRightOfCenter};
    2.16 -enum LinkStyle {
    2.17 -	StyleUndef,
    2.18 -	StyleLine, 
    2.19 -	StyleParabel, 
    2.20 -	StylePolyLine,
    2.21 -	StylePolyParabel
    2.22 -};
    2.23 -enum LinkPos {LinkMiddle,LinkBottom};
    2.24 -enum LinkColorHint {DefaultColor,HeadingColor};
    2.25 +
    2.26 +/*! \brief This class adds links to MapObj 
    2.27 +
    2.28 +The links are connecting the branches (BranchObj) and images (FloatImageObj) in the map.
    2.29 +*/
    2.30  
    2.31  class LinkableMapObj:public QObject, public MapObj {
    2.32  	Q_OBJECT
    2.33  public:
    2.34 +	/*! Orientation of an object dependd on the position relative to the parent */
    2.35 +	enum Orientation {
    2.36 +		UndefinedOrientation, //!< Undefined
    2.37 +		LeftOfCenter,			//!< Object is left of center
    2.38 +		RightOfCenter			//!< Object is right of center
    2.39 +	};
    2.40 +
    2.41 +	/*! Various drawing styles for links */
    2.42 +	enum Style {
    2.43 +		UndefinedStyle,	//!< Undefined
    2.44 +		Line,			//!< Straight line
    2.45 +		Parabel,		//!< Parabel
    2.46 +		PolyLine,		//!< Polygon (thick line)
    2.47 +		PolyParabel		//!< Thick parabel
    2.48 +	};
    2.49 +
    2.50 +	/*! Vertical position of link in object */
    2.51 +	enum Position {
    2.52 +		Middle, //!< Link is drawn in the middle of object
    2.53 +		Bottom  //!< Link is drawn at bottom of object
    2.54 +	};
    2.55 +
    2.56 +	/*! Hint if link should use the default link color or the color of heading */
    2.57 +	enum ColorHint {
    2.58 +		DefaultColor,	//!< Link uses the default color
    2.59 +		HeadingColor	//!< Link uses the color of heading
    2.60 +	};
    2.61 +
    2.62      LinkableMapObj ();
    2.63      LinkableMapObj (QGraphicsScene*);
    2.64      LinkableMapObj (LinkableMapObj*);
    2.65 @@ -45,13 +69,13 @@
    2.66  	virtual qreal getTopPad();
    2.67  	virtual qreal getLeftPad();
    2.68  	virtual qreal getRightPad();
    2.69 -	LinkStyle getDefLinkStyle();
    2.70 -    void setLinkStyle(LinkStyle);            
    2.71 -	LinkStyle getLinkStyle();
    2.72 +	Style getDefLinkStyle();
    2.73 +    void setLinkStyle(Style);            
    2.74 +	Style getLinkStyle();
    2.75  	void setHideLinkUnselected(bool);
    2.76  	bool getHideLinkUnselected();
    2.77 -	void setLinkPos (LinkPos);
    2.78 -	LinkPos getLinkPos ();
    2.79 +	void setLinkPos (Position);
    2.80 +	Position getLinkPos ();
    2.81  
    2.82  	virtual void setLinkColor();					// sets color according to colorhint, overloaded
    2.83  	virtual void setLinkColor(QColor);
    2.84 @@ -67,7 +91,7 @@
    2.85  	virtual void setDockPos()=0;				// sets childPos and parPos
    2.86      QPointF getChildPos();					// returns pos where childs dock
    2.87      QPointF getParPos();						// returns pos where parents dock
    2.88 -    LinkOrient getOrientation();			// get orientation
    2.89 +    Orientation getOrientation();			// get orientation
    2.90      virtual int getDepth();					// return depth
    2.91  	virtual void setMapEditor(MapEditor*);	// set MapEditor (needed in LMO::updateNoteFlag)
    2.92  	virtual MapEditor* getMapEditor();		// get MapEditor (usually from parent);
    2.93 @@ -99,7 +123,7 @@
    2.94  	MapEditor* mapEditor;			// for and toggleScroll(), get default styles
    2.95  									// and mapEditor->updateActions()
    2.96  									// and mapEditor->updateSelection()
    2.97 -    LinkOrient orientation;     
    2.98 +    Orientation orientation;     
    2.99      qreal linkwidth;				// width of a link
   2.100      int depth;						// depth: undef=-1 mapCenter=0 branch=1..n
   2.101  	QRectF bboxTotal;				// bounding box including childs
   2.102 @@ -110,8 +134,8 @@
   2.103      qreal bottomlineY;              // vertical offset of dockpos to pos
   2.104  
   2.105  	int thickness_start;			// for StylePoly*	
   2.106 -    LinkStyle style;				// Current style
   2.107 -	LinkPos linkpos;				// Link at bottom of object or middle of height
   2.108 +    Style style;					// Current style
   2.109 +	Position linkpos;				// Link at bottom of object or middle of height
   2.110      QColor linkcolor;               // Link color
   2.111  	QPen pen;
   2.112      QGraphicsLineItem* l;           // line style
   2.113 @@ -129,7 +153,8 @@
   2.114  	qreal topPad, botPad,
   2.115  		leftPad, rightPad;          // padding within bbox
   2.116  
   2.117 -	QPointF relPos;					// position relative to childPos of parent
   2.118 +	QPointF	 relPos;				// position relative to childPos of parent
   2.119 +	//AnimPoint relPos;				// position relative to childPos of parent
   2.120  	bool useRelPos;
   2.121  	bool useOrientation;
   2.122  };
     3.1 --- a/main.cpp	Wed Apr 25 16:02:54 2007 +0000
     3.2 +++ b/main.cpp	Wed Apr 25 16:02:54 2007 +0000
     3.3 @@ -12,6 +12,7 @@
     3.4  QString vymName;
     3.5  QString vymVersion;
     3.6  QString vymBuildDate;
     3.7 +QString vymCodeName;
     3.8  
     3.9  Main *mainWindow;				// used in BranchObj::select()								
    3.10  QString tmpVymDir;				// All temp files go there, created in mainwindow
    3.11 @@ -22,6 +23,7 @@
    3.12  QString iconPath;				// Pointing to icons used for toolbars
    3.13  QString flagsPath;				// Pointing to flags
    3.14  bool clipboardEmpty;			
    3.15 +bool debug;						// global debugging flag
    3.16  FlagRowObj *systemFlagsDefault;	// used to copy from in LinkableMapObj
    3.17  FlagRowObj *standardFlagsDefault;
    3.18  
    3.19 @@ -42,15 +44,17 @@
    3.20  	vymName=__VYM_NAME;
    3.21  	vymVersion=__VYM_VERSION;
    3.22  	vymBuildDate=__VYM_BUILD_DATE;
    3.23 +	vymCodeName=__VYM_CODENAME;
    3.24  
    3.25  
    3.26  	// Reading and initializing options commandline options
    3.27 -	options.add ("version", SwitchOption, "v","version");
    3.28 -	options.add ("local", SwitchOption, "l", "local");
    3.29 -	options.add ("help", SwitchOption, "h", "help");
    3.30 -	options.add ("quit", SwitchOption, "q", "quit");
    3.31 -	options.add ("run", StringOption, "r", "run");
    3.32 -	options.add ("test", StringOption, "t", "test");
    3.33 +	options.add ("debug", Option::Switch, "d", "debug");
    3.34 +	options.add ("version", Option::Switch, "v","version");
    3.35 +	options.add ("local", Option::Switch, "l", "local");
    3.36 +	options.add ("help", Option::Switch, "h", "help");
    3.37 +	options.add ("quit", Option::Switch, "q", "quit");
    3.38 +	options.add ("run", Option::String, "r", "run");
    3.39 +	options.add ("test", Option::String, "t", "test");
    3.40  	options.setHelpText (
    3.41  		"VYM - View Your Mind\n"
    3.42  		"--------------------\n\n"
    3.43 @@ -64,11 +68,14 @@
    3.44  		return 1;
    3.45  	}
    3.46  
    3.47 +	debug=options.isOn ("debug");
    3.48 +
    3.49  	if (options.isOn ("version"))
    3.50  	{
    3.51 -		cout << "vym version "<<__VYM_VERSION
    3.52 -			<<"  (c) 2004-2006 Uwe Drechsel - "
    3.53 -			<<__VYM_BUILD_DATE<<endl;
    3.54 +		cout << "vym version "<<__VYM_VERSION 
    3.55 +			<<"  (c) 2004-2007 Uwe Drechsel - "
    3.56 +			<<__VYM_BUILD_DATE 
    3.57 +			<<"  "<<__VYM_CODENAME<<endl;
    3.58  			
    3.59  		return 0;	
    3.60  	}		
     4.1 --- a/mainwindow.cpp	Wed Apr 25 16:02:54 2007 +0000
     4.2 +++ b/mainwindow.cpp	Wed Apr 25 16:02:54 2007 +0000
     4.3 @@ -98,6 +98,9 @@
     4.4  	// Initialize properties window
     4.5  	branchPropertyWindow = new BranchPropertyWindow();
     4.6  	branchPropertyWindow->move (20,20);
     4.7 +	branchPropertyWindow->resize (settings.value( "/branchpropertywindow/geometry/size",QSize (150,100)).toSize());
     4.8 +	branchPropertyWindow->move   (settings.value( "/branchpropertywindow/geometry/pos", QPoint(20,20)).toPoint());
     4.9 +
    4.10  
    4.11  	// Initialize script editor
    4.12  	scriptEditor = new SimpleScriptEditor();
    4.13 @@ -201,12 +204,12 @@
    4.14  	settings.setValue( "/mapeditor/editmode/useFlagGroups",actionSettingsUseFlagGroups->isOn() );
    4.15  	settings.setValue( "/export/useHideExport",actionSettingsUseHideExport->isOn() );
    4.16  
    4.17 -	//FIXME save branchPropWindow settings
    4.18 -	//FIXME save scriptEditor settings
    4.19 +	//TODO save scriptEditor settings
    4.20  
    4.21  	// call the destructors
    4.22  	delete textEditor;
    4.23  	delete historyWindow;
    4.24 +	delete branchPropertyWindow;
    4.25  
    4.26  	// Remove temporary directory
    4.27  	removeDir (QDir(tmpVymDir));
    4.28 @@ -361,7 +364,7 @@
    4.29  
    4.30      a = new QAction( QPixmap(iconPath+"fileclose.png"), tr( "&Close Map","File menu" ), this);
    4.31  	a->setStatusTip (tr( "Close Map" ) );
    4.32 -	a->setShortcut (Qt::ALT + Qt::Key_C );			//Close map
    4.33 +	a->setShortcut (Qt::CTRL + Qt::Key_W );			//Close map
    4.34  	fileMenu->addAction (a);
    4.35      connect( a, SIGNAL( triggered() ), this, SLOT( fileCloseMap() ) );
    4.36  
    4.37 @@ -580,10 +583,10 @@
    4.38  	addAction (alt);
    4.39  	actionListBranches.append(actionEditToggleScroll);
    4.40  	
    4.41 -    a = new QAction( tr( "Unscroll all scrolled branches","Edit menu" ), this);
    4.42 -	a->setStatusTip (tr( "Unscroll all" ));
    4.43 +    a = new QAction( tr( "Unscroll childs","Edit menu" ), this);
    4.44 +	a->setStatusTip (tr( "Unscroll all scrolled branches in selected subtree" ));
    4.45  	editMenu->addAction (a);
    4.46 -    connect( a, SIGNAL( triggered() ), this, SLOT( editUnScrollAll() ) );
    4.47 +    connect( a, SIGNAL( triggered() ), this, SLOT( editUnscrollChilds() ) );
    4.48  	
    4.49  	editMenu->addSeparator();
    4.50  
    4.51 @@ -785,13 +788,13 @@
    4.52      connect( a, SIGNAL( triggered() ), this, SLOT( editLoadImage() ) );
    4.53  	actionEditLoadImage=a;
    4.54  
    4.55 -    a = new QAction( tr( "Property Dialog","Dialog to edit properties of selection" )+QString ("..."), this);
    4.56 +    a = new QAction( tr( "Property window","Dialog to edit properties of selection" )+QString ("..."), this);
    4.57  	a->setStatusTip (tr( "Set properties for selection" ));
    4.58  	a->setShortcut ( Qt::CTRL + Qt::Key_I );		//Property window
    4.59  	a->setShortcutContext (Qt::WindowShortcut);
    4.60  	addAction (a);
    4.61 -    connect( a, SIGNAL( triggered() ), this, SLOT( showPropertyDialog() ) );
    4.62 -	actionTogglePropertyDialog=a;
    4.63 +    connect( a, SIGNAL( triggered() ), this, SLOT( windowToggleProperty() ) );
    4.64 +	actionTogglePropertyWindow=a;
    4.65  }
    4.66  
    4.67  // Format Actions
    4.68 @@ -869,18 +872,6 @@
    4.69  	formatMenu->addAction (a);
    4.70  	actionFormatLinkStylePolyParabel=a;
    4.71  	
    4.72 -    a = new QAction( tr( "Include images vertically","Branch attribute" ),  this);
    4.73 -	a->setStatusTip ( tr ("Include top and bottom position of images into branch"));
    4.74 -	a->setToggleAction(true);
    4.75 -    connect( a, SIGNAL( triggered() ), this, SLOT( formatIncludeImagesVer() ) );
    4.76 -	actionFormatIncludeImagesVer=a;
    4.77 -
    4.78 -    a = new QAction( tr( "Include images horizontally","Branch attribute" ),  this);
    4.79 -	a->setStatusTip ( tr ("Include left and right position of images into branch"));
    4.80 -	a->setToggleAction(true);
    4.81 -    connect( a, SIGNAL( triggered() ), this, SLOT( formatIncludeImagesHor() ) );
    4.82 -	actionFormatIncludeImagesHor=a;
    4.83 -
    4.84      a = new QAction( tr( "Hide link if object is not selected","Branch attribute" ), this);
    4.85  	a->setStatusTip (tr( "Hide link" ));
    4.86  	a->setToggleAction(true);
    4.87 @@ -974,7 +965,7 @@
    4.88      connect( a, SIGNAL( triggered() ), this, SLOT(windowToggleHistory() ) );
    4.89  	actionViewToggleHistoryWindow=a;
    4.90  
    4.91 -	viewMenu->addAction (actionTogglePropertyDialog );
    4.92 +	viewMenu->addAction (actionTogglePropertyWindow);
    4.93  
    4.94      a = new QAction(tr( "Antialiasing","View action" ),this );
    4.95  	a->setStatusTip ( tr( "Antialiasing" ));
    4.96 @@ -992,13 +983,13 @@
    4.97      connect( a, SIGNAL( triggered() ), this, SLOT(windowToggleSmoothPixmap() ) );
    4.98  	actionViewToggleSmoothPixmapTransform=a;
    4.99  
   4.100 -    a = new QAction(tr( "Next Window","View action" ), this);
   4.101 +    a = new QAction(tr( "Next Map","View action" ), this);
   4.102  	a->setStatusTip (a->text());
   4.103  	a->setShortcut (Qt::ALT + Qt::Key_N );
   4.104  	viewMenu->addAction (a);
   4.105      connect( a, SIGNAL( triggered() ), this, SLOT(windowNextEditor() ) );
   4.106  
   4.107 -    a = new QAction (tr( "Previous Window","View action" ), this );
   4.108 +    a = new QAction (tr( "Previous Map","View action" ), this );
   4.109  	a->setStatusTip (a->text());
   4.110  	a->setShortcut (Qt::ALT + Qt::Key_P );
   4.111  	viewMenu->addAction (a);
   4.112 @@ -1375,12 +1366,34 @@
   4.113      connect( a, SIGNAL( triggered() ), this, SLOT( settingsURL() ) );
   4.114  	settingsMenu->addAction (a);
   4.115  
   4.116 -    a = new QAction( tr( "Set path for macros","Settings action"), this);
   4.117 +    a = new QAction( tr( "Set path for macros","Settings action")+"...", this);
   4.118      a->setStatusTip( tr( "Set path for macros"));
   4.119      connect( a, SIGNAL( triggered() ), this, SLOT( settingsMacroDir() ) );
   4.120  	settingsMenu->addAction (a);
   4.121  
   4.122 +    a = new QAction( tr( "Set number of undo levels","Settings action")+"...", this);
   4.123 +    a->setStatusTip( tr( "Set number of undo levels"));
   4.124 +    connect( a, SIGNAL( triggered() ), this, SLOT( settingsUndoLevels() ) );
   4.125 +	settingsMenu->addAction (a);
   4.126 +
   4.127  	settingsMenu->addSeparator();
   4.128 +
   4.129 +    a = new QAction( tr( "Autosave","Settings action"), this);
   4.130 +    a->setStatusTip( tr( "Autosave"));
   4.131 +	a->setToggleAction(true);
   4.132 +	a->setOn ( settings.value ("/mapeditor/autosave/use",true).toBool());
   4.133 +    connect( a, SIGNAL( triggered() ), this, SLOT( settingsAutosaveToggle() ) );
   4.134 +	settingsMenu->addAction (a);
   4.135 +	actionSettingsAutosaveToggle=a;
   4.136 +
   4.137 +    a = new QAction( tr( "Autosave time","Settings action")+"...", this);
   4.138 +    a->setStatusTip( tr( "Autosave time"));
   4.139 +    connect( a, SIGNAL( triggered() ), this, SLOT( settingsAutosaveTime() ) );
   4.140 +	settingsMenu->addAction (a);
   4.141 +	actionSettingsAutosaveTime=a;
   4.142 +
   4.143 +	settingsMenu->addSeparator();
   4.144 +
   4.145      a = new QAction( tr( "Edit branch after adding it","Settings action" ), this );
   4.146      a->setStatusTip( tr( "Edit branch after adding it" ));
   4.147  	a->setToggleAction(true);
   4.148 @@ -1472,7 +1485,7 @@
   4.149  
   4.150  	// Context Menu for branch or mapcenter
   4.151  	branchContextMenu =new QMenu (this);
   4.152 -	branchContextMenu->addAction (actionTogglePropertyDialog);
   4.153 +	branchContextMenu->addAction (actionTogglePropertyWindow);
   4.154  	branchContextMenu->addSeparator();	
   4.155  
   4.156  		// Submenu "Add"
   4.157 @@ -1498,14 +1511,12 @@
   4.158  
   4.159  	branchContextMenu->addSeparator();	
   4.160  	branchContextMenu->addAction ( actionEditLoadImage);
   4.161 -	branchContextMenu->addAction ( actionFormatIncludeImagesVer );
   4.162 -	branchContextMenu->addAction ( actionFormatIncludeImagesHor );
   4.163  
   4.164  	// Submenu for Links (URLs, vymLinks)
   4.165  	branchLinksContextMenu =new QMenu (this);
   4.166  
   4.167  		branchContextMenu->addSeparator();	
   4.168 -		branchLinksContextMenu=branchContextMenu->addMenu(tr("URLs and vymLinks","Context menu name"));	
   4.169 +		branchLinksContextMenu=branchContextMenu->addMenu(tr("References (URLs, vymLinks, ...)","Context menu name"));	
   4.170  		branchLinksContextMenu->addAction ( actionEditOpenURL );
   4.171  		branchLinksContextMenu->addAction ( actionEditOpenURLTab );
   4.172  		branchLinksContextMenu->addAction ( actionEditOpenMultipleURLTabs );
   4.173 @@ -1677,9 +1688,8 @@
   4.174  {
   4.175  	// Unselect all possibly selected objects
   4.176  	// (Important to update note editor)
   4.177 -	int i;
   4.178  	MapEditor *me;
   4.179 -	for (i=0;i<=tabWidget->count() -1;i++)
   4.180 +	for (int i=0;i<=tabWidget->count() -1;i++)
   4.181  	{
   4.182  		
   4.183  		me=(MapEditor*)tabWidget->page(i);
   4.184 @@ -1972,7 +1982,7 @@
   4.185  	setupRecentMapsMenu();
   4.186  }
   4.187  
   4.188 -void Main::fileSave(const SaveMode &savemode)
   4.189 +void Main::fileSave(MapEditor *me, const SaveMode &savemode)
   4.190  {
   4.191  	// tmp dir for zipping 
   4.192  	QString tmpMapDir;
   4.193 @@ -1982,13 +1992,12 @@
   4.194  	
   4.195  	QString safeFilePath;
   4.196  
   4.197 -	bool saveZipped=currentMapEditor()->saveZipped();
   4.198 -
   4.199 -	MapEditor *	me=currentMapEditor();
   4.200 +	bool saveZipped=me->saveZipped();
   4.201 +
   4.202  	if (me)
   4.203  	{
   4.204  		QString fn=me->getFilePath();
   4.205 -		// filename=unnamed, filepath="" in constructor...
   4.206 +		// filename=unnamed, filepath="" in constructor of mapEditor
   4.207  		if ( !fn.isEmpty() ) 
   4.208  		{	
   4.209  			// We have a filepath, go on saving			
   4.210 @@ -2067,6 +2076,8 @@
   4.211  			// We have  no filepath yet,
   4.212  			// call fileSaveAs() now, this will call fileSave() 
   4.213  			// again.
   4.214 +			// First switch to editor
   4.215 +			tabWidget->setCurrentWidget (me);
   4.216  			fileSaveAs(savemode);
   4.217  		}
   4.218      }
   4.219 @@ -2089,7 +2100,12 @@
   4.220  
   4.221  void Main::fileSave()
   4.222  {
   4.223 -	fileSave (CompleteMap);
   4.224 +	fileSave (currentMapEditor(), CompleteMap);
   4.225 +}
   4.226 +
   4.227 +void Main::fileSave(MapEditor *me)
   4.228 +{
   4.229 +	fileSave (me,CompleteMap);
   4.230  }
   4.231  
   4.232  void Main::fileSaveAs(const SaveMode& savemode)
   4.233 @@ -2145,7 +2161,7 @@
   4.234  
   4.235  			// Save now
   4.236  			currentMapEditor()->setFilePath(fn);
   4.237 -			fileSave(savemode);
   4.238 +			fileSave(currentMapEditor(), savemode);
   4.239  
   4.240  			// Set name of tab
   4.241  			if (savemode==CompleteMap)
   4.242 @@ -2415,7 +2431,7 @@
   4.243  			{
   4.244  				case QMessageBox::Yes:
   4.245  					// save and close
   4.246 -					fileSave(CompleteMap);
   4.247 +					fileSave(currentMapEditor(), CompleteMap);
   4.248  					break;
   4.249  				case QMessageBox::No:
   4.250  				// close  without saving
   4.251 @@ -2466,7 +2482,7 @@
   4.252  			switch( mb.exec() ) {
   4.253  				case QMessageBox::Yes:
   4.254  					// save (the changed editors) and exit
   4.255 -					fileSave(CompleteMap);
   4.256 +					fileSave(currentMapEditor(), CompleteMap);
   4.257  					break;
   4.258  				case QMessageBox::No:
   4.259  					// exit without saving
   4.260 @@ -2846,7 +2862,7 @@
   4.261  	}	
   4.262  }
   4.263  
   4.264 -void Main::editUnScrollAll()
   4.265 +void Main::editUnscrollChilds()
   4.266  {
   4.267  	if (currentMapEditor())
   4.268  		currentMapEditor()->unscrollChilds();	
   4.269 @@ -3124,18 +3140,6 @@
   4.270  }
   4.271  
   4.272  
   4.273 -void Main::formatIncludeImagesVer()
   4.274 -{
   4.275 -	if (currentMapEditor())
   4.276 -		currentMapEditor()->setIncludeImagesVer(actionFormatIncludeImagesVer->isOn());
   4.277 -}
   4.278 -
   4.279 -void Main::formatIncludeImagesHor()
   4.280 -{
   4.281 -	if (currentMapEditor())
   4.282 -		currentMapEditor()->setIncludeImagesHor(actionFormatIncludeImagesHor->isOn());
   4.283 -}
   4.284 -
   4.285  void Main::formatHideLinkUnselected()	//FIXME get rid of this with imagepropertydialog
   4.286  {
   4.287  	if (currentMapEditor())
   4.288 @@ -3213,6 +3217,39 @@
   4.289  		settings.setValue ("/macros/macroDir",dir.path());
   4.290  }
   4.291  
   4.292 +void Main::settingsUndoLevels()
   4.293 +{
   4.294 +	bool ok;
   4.295 +	int i = QInputDialog::getInteger(
   4.296 +		this, 
   4.297 +		tr("QInputDialog::getInteger()"),
   4.298 +	    tr("Number of undo/redo levels:"), settings.value("/mapeditor/stepsTotal").toInt(), 0, 1000, 1, &ok);
   4.299 +	if (ok)
   4.300 +	{
   4.301 +		settings.setValue ("/mapeditor/stepsTotal",i);
   4.302 +		QMessageBox::information( this, tr( "VYM -Information:" ),
   4.303 +		   tr("Settings have been changed. The next map opened will have \"%1\" undo/redo levels").arg(i)); 
   4.304 +   }	
   4.305 +}
   4.306 +
   4.307 +void Main::settingsAutosaveToggle()
   4.308 +{
   4.309 +	settings.setValue ("/mapeditor/autosave/used",actionSettingsAutosaveToggle->isOn() );
   4.310 +}
   4.311 +
   4.312 +void Main::settingsAutosaveTime()
   4.313 +{
   4.314 +	bool ok;
   4.315 +	int i = QInputDialog::getInteger(
   4.316 +		this, 
   4.317 +		tr("QInputDialog::getInteger()"),
   4.318 +	    tr("Number of seconds before autosave:"), settings.value("/mapeditor/autosave/ms").toInt() / 1000, 10, 10000, 1, &ok);
   4.319 +	if (ok)
   4.320 +	{
   4.321 +		settings.setValue ("/mapeditor/autosave/ms",i * 1000);
   4.322 +    }	
   4.323 +}
   4.324 +
   4.325  void Main::settingsToggleDelKey()
   4.326  {
   4.327  	if (actionSettingsUseDelKey->isOn())
   4.328 @@ -3241,6 +3278,27 @@
   4.329  
   4.330  }
   4.331  
   4.332 +void Main::windowToggleProperty()
   4.333 +{
   4.334 +	if (branchPropertyWindow->isVisible())
   4.335 +		branchPropertyWindow->hide();
   4.336 +	else	
   4.337 +		branchPropertyWindow->show();
   4.338 +	if(currentMapEditor())
   4.339 +	{
   4.340 +		LinkableMapObj *sel=currentMapEditor()->getSelection();
   4.341 +		if (sel && (typeid(*sel) == typeid(BranchObj) ||
   4.342 +		           typeid(*sel) == typeid(MapCenterObj)))
   4.343 +		{
   4.344 +			branchPropertyWindow->setMapEditor(currentMapEditor());
   4.345 +			branchPropertyWindow->setBranch((BranchObj*)sel);
   4.346 +			return;
   4.347 +		}
   4.348 +		
   4.349 +	}	
   4.350 +	branchPropertyWindow->setBranch(NULL);
   4.351 +}
   4.352 +
   4.353  void Main::windowToggleAntiAlias()
   4.354  {
   4.355  	bool b=actionViewToggleAntiAlias->isOn();
   4.356 @@ -3293,23 +3351,23 @@
   4.357  	actionViewToggleNoteEditor->setOn (textEditor->showWithMain());
   4.358  	actionViewToggleHistoryWindow->setOn (historyWindow->showWithMain());
   4.359  
   4.360 -	if (me->getMapLinkColorHint()==HeadingColor) 
   4.361 +	if (me->getMapLinkColorHint()==LinkableMapObj::HeadingColor) 
   4.362  		actionFormatLinkColorHint->setOn(true);
   4.363  	else	
   4.364  		actionFormatLinkColorHint->setOn(false);
   4.365  
   4.366  	switch (me->getMapLinkStyle())
   4.367  	{
   4.368 -		case StyleLine: 
   4.369 +		case LinkableMapObj::Line: 
   4.370  			actionFormatLinkStyleLine->setOn(true);
   4.371  			break;
   4.372 -		case StyleParabel:
   4.373 +		case LinkableMapObj::Parabel:
   4.374  			actionFormatLinkStyleParabel->setOn(true);
   4.375  			break;
   4.376 -		case StylePolyLine:	
   4.377 +		case LinkableMapObj::PolyLine:	
   4.378  			actionFormatLinkStylePolyLine->setOn(true);
   4.379  			break;
   4.380 -		case StylePolyParabel:	
   4.381 +		case LinkableMapObj::PolyParabel:	
   4.382  			actionFormatLinkStylePolyParabel->setOn(true);
   4.383  			break;
   4.384  		default:
   4.385 @@ -3419,10 +3477,6 @@
   4.386  			for (int i=0; i<actionListBranches.size(); ++i)	
   4.387  				actionListBranches.at(i)->setEnabled(true);
   4.388  			actionEditDelete->setEnabled (true);
   4.389 -			actionFormatIncludeImagesVer->setOn
   4.390 -				( ((BranchObj*)selection)->getIncludeImagesVer());
   4.391 -			actionFormatIncludeImagesHor->setOn
   4.392 -				( ((BranchObj*)selection)->getIncludeImagesHor());
   4.393  			actionFormatHideLinkUnselected->setOn
   4.394  				(selection->getHideLinkUnselected());
   4.395  		}
   4.396 @@ -3469,7 +3523,7 @@
   4.397  	}	
   4.398  }
   4.399  
   4.400 -ModMode Main::getModMode()
   4.401 +Main::ModMode Main::getModMode()
   4.402  {
   4.403  	if (actionModModeColor->isOn()) return ModModeColor;
   4.404  	if (actionModModeCopy->isOn()) return ModModeCopy;
   4.405 @@ -3517,24 +3571,6 @@
   4.406  		currentMapEditor()->runScript (script);
   4.407  }
   4.408  
   4.409 -void Main::showPropertyDialog()
   4.410 -{
   4.411 -	if(currentMapEditor())
   4.412 -	{
   4.413 -		LinkableMapObj *sel=currentMapEditor()->getSelection();
   4.414 -		if (sel && (typeid(*sel) == typeid(BranchObj) ||
   4.415 -		           typeid(*sel) == typeid(MapCenterObj)))
   4.416 -		{
   4.417 -			branchPropertyWindow->show();
   4.418 -			branchPropertyWindow->setMapEditor(currentMapEditor());
   4.419 -			branchPropertyWindow->setBranch((BranchObj*)sel);
   4.420 -			return;
   4.421 -		}
   4.422 -		
   4.423 -	}	
   4.424 -	branchPropertyWindow->setBranch(NULL);
   4.425 -}
   4.426 -
   4.427  void Main::windowNextEditor()
   4.428  {
   4.429  	if (tabWidget->currentPageIndex() < tabWidget->count())
     5.1 --- a/mainwindow.h	Wed Apr 25 16:02:54 2007 +0000
     5.2 +++ b/mainwindow.h	Wed Apr 25 16:02:54 2007 +0000
     5.3 @@ -12,13 +12,19 @@
     5.4  #include "texteditor.h"
     5.5  #include "xml.h"
     5.6  
     5.7 -enum ModMode {ModModeNone,ModModeColor,ModModeCopy,ModModeXLink};
     5.8 -
     5.9  class Main : public QMainWindow 
    5.10  {
    5.11      Q_OBJECT
    5.12  
    5.13  public:
    5.14 +	/*! Modifier modes are used when CTRL together with a mouse button is pressed */
    5.15 +	enum ModMode {
    5.16 +		ModModeNone,	//!< Unused
    5.17 +		ModModeColor,	//!< Pick color from object
    5.18 +		ModModeCopy,	//!< Copy object
    5.19 +		ModModeXLink	//!< Create a XLink (XLinkObj) from selected object
    5.20 +		};
    5.21 +
    5.22      Main(QWidget* parent=0, const char* name=0, Qt::WFlags f=0);
    5.23      ~Main();
    5.24  	void loadCmdLine();
    5.25 @@ -58,8 +64,11 @@
    5.26      void fileLoad();
    5.27  	void fileLoadRecent();
    5.28  	void addRecentMap (const QString &);
    5.29 -    void fileSave(const SaveMode & );
    5.30 +    void fileSave(MapEditor*, const SaveMode & );
    5.31      void fileSave();
    5.32 +public slots:	
    5.33 +    void fileSave(MapEditor *);	// autosave from MapEditor
    5.34 +private slots:	
    5.35      void fileSaveAs(const SaveMode &);
    5.36      void fileSaveAs();
    5.37      void fileImportKDEBookmarks();
    5.38 @@ -114,7 +123,7 @@
    5.39      void editMoveUp();	
    5.40      void editMoveDown();	
    5.41      void editToggleScroll();
    5.42 -    void editUnScrollAll();
    5.43 +    void editUnscrollChilds();
    5.44      void editNewBranch();
    5.45      void editNewBranchBefore();
    5.46      void editNewBranchAbove();
    5.47 @@ -150,8 +159,6 @@
    5.48      void formatSelectLinkColor();
    5.49      void formatSelectSelectionColor();
    5.50      void formatToggleLinkColorHint();
    5.51 -	void formatIncludeImagesVer();
    5.52 -	void formatIncludeImagesHor();
    5.53  	void formatHideLinkUnselected();
    5.54  
    5.55      void viewZoomReset();
    5.56 @@ -163,9 +170,13 @@
    5.57  	bool settingsURL();
    5.58  	void settingsMacroDir();
    5.59  	void settingsToggleDelKey();
    5.60 +	void settingsUndoLevels();
    5.61 +	void settingsAutosaveToggle();
    5.62 +	void settingsAutosaveTime();
    5.63  
    5.64  	void windowToggleNoteEditor();
    5.65  	void windowToggleHistory();
    5.66 +	void windowToggleProperty();
    5.67  	void updateHistory(SimpleSettings &);
    5.68  	void windowToggleAntiAlias();
    5.69  	void windowToggleSmoothPixmap();
    5.70 @@ -180,7 +191,6 @@
    5.71  	void runScript(const QString &);
    5.72  
    5.73  private slots:
    5.74 -	void showPropertyDialog();
    5.75  	void windowNextEditor();
    5.76  	void windowPreviousEditor();
    5.77  	void windowShowNoteEditor();
    5.78 @@ -196,6 +206,7 @@
    5.79      void helpAboutQT();
    5.80  
    5.81  	void callMacro ();
    5.82 +
    5.83  private:
    5.84  	QTabWidget *tabWidget;
    5.85  	FindWindow *findWindow;
    5.86 @@ -269,8 +280,6 @@
    5.87  	QAction* actionFormatBackImage;
    5.88  	QAction* actionFormatLinkColor;
    5.89  	QAction* actionFormatSelectionColor;
    5.90 -	QAction *actionFormatIncludeImagesVer;
    5.91 -	QAction *actionFormatIncludeImagesHor;
    5.92  
    5.93  	QActionGroup* actionGroupModModes;
    5.94  	QAction* actionModModeColor;
    5.95 @@ -279,7 +288,7 @@
    5.96  
    5.97  	QActionGroup *actionGroupFormatFrameTypes;
    5.98  
    5.99 -	QAction *actionTogglePropertyDialog;
   5.100 +	QAction *actionTogglePropertyWindow;
   5.101  
   5.102  	QActionGroup *actionGroupFormatLinkStyles;
   5.103  	QAction *actionFormatLinkStyleLine;
   5.104 @@ -299,6 +308,8 @@
   5.105  	QAction* actionSettingsUseDelKey;
   5.106  	QAction* actionSettingsUseFlagGroups;
   5.107  	QAction* actionSettingsUseHideExport;
   5.108 +	QAction* actionSettingsAutosaveToggle;
   5.109 +	QAction* actionSettingsAutosaveTime;
   5.110  };
   5.111  
   5.112  
     6.1 --- a/mapeditor.cpp	Wed Apr 25 16:02:54 2007 +0000
     6.2 +++ b/mapeditor.cpp	Wed Apr 25 16:02:54 2007 +0000
     6.3 @@ -27,6 +27,7 @@
     6.4  extern QString tmpVymDir;
     6.5  extern QString clipboardDir;
     6.6  extern bool clipboardEmpty;
     6.7 +extern bool debug;
     6.8  extern FlagRowObj *standardFlagsDefault;
     6.9  
    6.10  extern QMenu* branchContextMenu;
    6.11 @@ -55,7 +56,7 @@
    6.12  ///////////////////////////////////////////////////////////////////////
    6.13  ///////////////////////////////////////////////////////////////////////
    6.14  MapEditor::MapEditor( QWidget* parent) :
    6.15 -  QGraphicsView(parent)
    6.16 +  QGraphicsView(parent)  
    6.17  {
    6.18  	//cout << "Constructor ME "<<this<<endl;
    6.19  	mapNum++;
    6.20 @@ -79,8 +80,8 @@
    6.21  
    6.22  	defLinkColor=QColor (0,0,255);
    6.23  	defXLinkColor=QColor (180,180,180);
    6.24 -	linkcolorhint=DefaultColor;
    6.25 -	linkstyle=StylePolyParabel;
    6.26 +	linkcolorhint=LinkableMapObj::DefaultColor;
    6.27 +	linkstyle=LinkableMapObj::PolyParabel;
    6.28  
    6.29  	// Create bitmap cursors, platform dependant
    6.30  	HandOpenCursor=QCursor (QPixmap(iconPath+"cursorhandopen.png"),1,1);		
    6.31 @@ -125,7 +126,7 @@
    6.32  	blockReposition=false;
    6.33  	blockSaveState=false;
    6.34  
    6.35 -	hidemode=HideNone;
    6.36 +	hidemode=BranchObj::HideNone;
    6.37  
    6.38  	// Create temporary files
    6.39  	makeTmpDirs();
    6.40 @@ -134,11 +135,19 @@
    6.41  
    6.42  	mapCenter->reposition();	//	for positioning heading
    6.43  
    6.44 +	// TODO animations
    6.45 +	animObjList.clear();
    6.46 +	//timerId = startTimer(100);  
    6.47 +
    6.48 +	// autosave
    6.49 +	autosaveTimer=new QTimer (this);
    6.50 +	connect(autosaveTimer, SIGNAL(timeout()), this, SLOT(autosave()));
    6.51  }
    6.52  
    6.53  MapEditor::~MapEditor()
    6.54  {
    6.55  	//cout <<"Destructor MapEditor\n";
    6.56 +	autosaveTimer->stop();
    6.57  }
    6.58  
    6.59  MapCenterObj* MapEditor::getMapCenter()
    6.60 @@ -156,6 +165,11 @@
    6.61  	return blockReposition;
    6.62  }
    6.63  
    6.64 +void MapEditor::setSaveStateBlocked(bool b)
    6.65 +{
    6.66 +	blockSaveState=b;
    6.67 +}
    6.68 +
    6.69  QString MapEditor::getName (const LinkableMapObj *lmo)
    6.70  {
    6.71  	QString s;
    6.72 @@ -197,13 +211,13 @@
    6.73  	QString ls;
    6.74  	switch (linkstyle)
    6.75  	{
    6.76 -		case StyleLine: 
    6.77 +		case LinkableMapObj::Line: 
    6.78  			ls="StyleLine";
    6.79  			break;
    6.80 -		case StyleParabel:
    6.81 +		case LinkableMapObj::Parabel:
    6.82  			ls="StyleParabel";
    6.83  			break;
    6.84 -		case StylePolyLine:	
    6.85 +		case LinkableMapObj::PolyLine:	
    6.86  			ls="StylePolyLine";
    6.87  			break;
    6.88  		default:
    6.89 @@ -213,7 +227,7 @@
    6.90  
    6.91  	QString s="<?xml version=\"1.0\" encoding=\"utf-8\"?><!DOCTYPE vymmap>\n";
    6.92  	QString colhint="";
    6.93 -	if (linkcolorhint==HeadingColor) 
    6.94 +	if (linkcolorhint==LinkableMapObj::HeadingColor) 
    6.95  		colhint=attribut("linkColorHint","HeadingColor");
    6.96  
    6.97  	QString mapAttr=attribut("version",vymVersion);
    6.98 @@ -349,7 +363,7 @@
    6.99  
   6.100  	/* TODO remove after testing
   6.101  	*/
   6.102 -	cout << "ME::saveState()  "<<endl;
   6.103 +	if (debug) cout << "ME::saveState() for  "<<mapName.ascii()<<endl;
   6.104  	
   6.105  	int undosAvail=undoSet.readNumEntry ("/history/undosAvail",0);
   6.106  	int redosAvail=undoSet.readNumEntry ("/history/redosAvail",0);
   6.107 @@ -404,21 +418,23 @@
   6.108  	undoSet.setEntry (QString("/history/version"),vymVersion);
   6.109  	undoSet.writeSettings(histPath);
   6.110  
   6.111 -	/* TODO remove after testing
   6.112 -	*/
   6.113 -	//cout << "          into="<< histPath.toStdString()<<endl;
   6.114 -	cout << "    stepsTotal="<<stepsTotal<<
   6.115 -	", undosAvail="<<undosAvail<<
   6.116 -	", redosAvail="<<redosAvail<<
   6.117 -	", curStep="<<curStep<<endl;
   6.118 -	cout << "    ---------------------------"<<endl;
   6.119 -	cout << "    comment="<<comment.toStdString()<<endl;
   6.120 -	cout << "    undoCom="<<undoCommand.toStdString()<<endl;
   6.121 -	cout << "    undoSel="<<undoSelection.toStdString()<<endl;
   6.122 -	cout << "    redoCom="<<redoCom.toStdString()<<endl;
   6.123 -	cout << "    redoSel="<<redoSelection.toStdString()<<endl;
   6.124 -	if (saveSel) cout << "    saveSel="<<saveSel->getSelectString().ascii()<<endl;
   6.125 -	cout << "    ---------------------------"<<endl;
   6.126 +	if (debug)
   6.127 +	{
   6.128 +		// TODO remove after testing
   6.129 +		//cout << "          into="<< histPath.toStdString()<<endl;
   6.130 +		cout << "    stepsTotal="<<stepsTotal<<
   6.131 +		", undosAvail="<<undosAvail<<
   6.132 +		", redosAvail="<<redosAvail<<
   6.133 +		", curStep="<<curStep<<endl;
   6.134 +		cout << "    ---------------------------"<<endl;
   6.135 +		cout << "    comment="<<comment.toStdString()<<endl;
   6.136 +		cout << "    undoCom="<<undoCommand.toStdString()<<endl;
   6.137 +		cout << "    undoSel="<<undoSelection.toStdString()<<endl;
   6.138 +		cout << "    redoCom="<<redoCom.toStdString()<<endl;
   6.139 +		cout << "    redoSel="<<redoSelection.toStdString()<<endl;
   6.140 +		if (saveSel) cout << "    saveSel="<<saveSel->getSelectString().ascii()<<endl;
   6.141 +		cout << "    ---------------------------"<<endl;
   6.142 +	}
   6.143  
   6.144  	mainWindow->updateHistory (undoSet);
   6.145  	setChanged();
   6.146 @@ -761,7 +777,7 @@
   6.147  			parser.setError (Aborted,"Type of selection is not a branch");
   6.148  		} else if (parser.checkParamCount(0))
   6.149  		{	
   6.150 -			if (!scrollBranch ())	
   6.151 +			if (!scrollBranch (selb))	
   6.152  				parser.setError (Aborted,"Could not scroll branch");
   6.153  		}	
   6.154  	} else if (com=="select")
   6.155 @@ -803,6 +819,17 @@
   6.156  			selectInt (fio);	
   6.157  				
   6.158  		}	
   6.159 +	} else if (com=="setFrameType")
   6.160 +	{
   6.161 +		if ( xelection.type()!=Branch && xelection.type()!= MapCenter && xelection.type()!=FloatImage)
   6.162 +		{
   6.163 +			parser.setError (Aborted,"Type of selection does not allow setting frame type");
   6.164 +		}
   6.165 +		else if (parser.checkParamCount(1))
   6.166 +		{
   6.167 +			s=parser.parString(ok,0);
   6.168 +			if (ok) setFrameType (s);
   6.169 +		}	
   6.170  	} else if (com=="setMapAuthor")
   6.171  	{
   6.172  		if (parser.checkParamCount(1))
   6.173 @@ -869,17 +896,16 @@
   6.174  		if (xelection.isEmpty() )
   6.175  		{
   6.176  			parser.setError (Aborted,"Nothing selected");
   6.177 -		} else if (! selb)
   6.178 +		} else if (xelection.type()!=Branch && xelection.type() != MapCenter &&xelection.type()!=FloatImage)
   6.179  		{				  
   6.180  			parser.setError (Aborted,"Type of selection is not a branch or floatimage");
   6.181 -			//FIXME selb is never a floatimage!!
   6.182  		} else if (parser.checkParamCount(1))
   6.183  		{
   6.184  			b=parser.parBool(ok,0);
   6.185  			if (ok) setHideExport (b);
   6.186  		}
   6.187  	} else if (com=="setIncludeImagesHorizontally")
   6.188 -	{
   6.189 +	{ 
   6.190  		if (xelection.isEmpty() )
   6.191  		{
   6.192  			parser.setError (Aborted,"Nothing selected");
   6.193 @@ -996,9 +1022,21 @@
   6.194  			parser.setError (Aborted,"Type of selection is not a branch");
   6.195  		} else if (parser.checkParamCount(0))
   6.196  		{	
   6.197 -			if (!unscrollBranch ())	
   6.198 +			if (!unscrollBranch (selb))	
   6.199  				parser.setError (Aborted,"Could not unscroll branch");
   6.200  		}	
   6.201 +	} else if (com=="unscrollChilds")
   6.202 +	{
   6.203 +		if (xelection.isEmpty() )
   6.204 +		{
   6.205 +			parser.setError (Aborted,"Nothing selected");
   6.206 +		} else if (! selb )
   6.207 +		{				  
   6.208 +			parser.setError (Aborted,"Type of selection is not a branch");
   6.209 +		} else if (parser.checkParamCount(0))
   6.210 +		{	
   6.211 +			unscrollChilds ();
   6.212 +		}	
   6.213  	} else if (com=="unsetFlag")
   6.214  	{
   6.215  		if (xelection.isEmpty() )
   6.216 @@ -1058,10 +1096,13 @@
   6.217  
   6.218  void MapEditor::setChanged()
   6.219  {
   6.220 +	if (!mapChanged)
   6.221 +		autosaveTimer->start(settings.value("/mapeditor/autosave/ms/",300000).toInt());
   6.222  	mapChanged=true;
   6.223  	mapDefault=false;
   6.224  	mapUnsaved=true;
   6.225  	findReset();
   6.226 +
   6.227  }
   6.228  
   6.229  void MapEditor::closeMap()
   6.230 @@ -1168,7 +1209,9 @@
   6.231  		err=aborted;	
   6.232  	} else
   6.233  	{
   6.234 +		bool blockSaveStateOrg=blockSaveState;
   6.235  		blockReposition=true;
   6.236 +		blockSaveState=true;
   6.237  		QXmlInputSource source( file);
   6.238  		QXmlSimpleReader reader;
   6.239  		reader.setContentHandler( &handler );
   6.240 @@ -1177,10 +1220,9 @@
   6.241  		handler.setTmpDir (filePath.left(filePath.findRev("/",-1)));	// needed to load files with rel. path
   6.242  		handler.setInputFile (file.name());
   6.243  		handler.setLoadMode (lmode);
   6.244 -		blockSaveState=true;
   6.245  		bool ok = reader.parse( source );
   6.246  		blockReposition=false;
   6.247 -		blockSaveState=false;
   6.248 +		blockSaveState=blockSaveStateOrg;
   6.249  		file.close();
   6.250  		if ( ok ) 
   6.251  		{
   6.252 @@ -1191,6 +1233,7 @@
   6.253  				mapDefault=false;
   6.254  				mapChanged=false;
   6.255  				mapUnsaved=false;
   6.256 +				autosaveTimer->stop();
   6.257  			}
   6.258  		} else 
   6.259  		{
   6.260 @@ -1224,7 +1267,8 @@
   6.261  	if (savemode==CompleteMap || xelection.isEmpty())
   6.262  		saveFile=saveToDir (fileDir,mapName+"-",true,QPointF(),NULL);
   6.263  	else	
   6.264 -		saveFile=saveToDir (fileDir,mapName+"-",true,QPointF(),xelection.getBranch());	//FIXME check selected FIO
   6.265 +		//save () FIXME check FIO
   6.266 +		saveFile=saveToDir (fileDir,mapName+"-",true,QPointF(),xelection.getBranch());	
   6.267  
   6.268  	if (!saveStringToDisk(fileDir+fname,saveFile))
   6.269  		return 1;
   6.270 @@ -1233,6 +1277,7 @@
   6.271  	{
   6.272  		mapChanged=false;
   6.273  		mapUnsaved=false;
   6.274 +		autosaveTimer->stop();
   6.275  		updateActions();
   6.276  	}
   6.277  
   6.278 @@ -1373,7 +1418,7 @@
   6.279  	return pix;
   6.280  }
   6.281  
   6.282 -void MapEditor::setHideTmpMode (HideTmpMode mode)
   6.283 +void MapEditor::setHideTmpMode (BranchObj::HideTmpMode mode)
   6.284  {
   6.285  	hidemode=mode;
   6.286  	mapCenter->setHideTmp (hidemode);
   6.287 @@ -1381,7 +1426,7 @@
   6.288  	scene()->update();
   6.289  }
   6.290  
   6.291 -HideTmpMode MapEditor::getHideTmpMode()
   6.292 +BranchObj::HideTmpMode MapEditor::getHideTmpMode()
   6.293  {
   6.294  	return hidemode;
   6.295  }
   6.296 @@ -1399,9 +1444,9 @@
   6.297  	// should be called before and after exports
   6.298  	// depending on the settings
   6.299  	if (b && settings.value("/export/useHideExport","yes")=="yes")
   6.300 -		setHideTmpMode (HideExport);
   6.301 +		setHideTmpMode (BranchObj::HideExport);
   6.302  	else	
   6.303 -		setHideTmpMode (HideNone);
   6.304 +		setHideTmpMode (BranchObj::HideNone);
   6.305  }
   6.306  
   6.307  void MapEditor::exportImage(QString fn, QString format)
   6.308 @@ -1496,14 +1541,16 @@
   6.309  
   6.310  void MapEditor::redo()
   6.311  {
   6.312 -	blockSaveState=true;
   6.313 -	
   6.314  	// Restore variables
   6.315  	int curStep=undoSet.readNumEntry (QString("/history/curStep"));
   6.316  	int undosAvail=undoSet.readNumEntry (QString("/history/undosAvail"));
   6.317  	int redosAvail=undoSet.readNumEntry (QString("/history/redosAvail"));
   6.318  	// Can we undo at all?
   6.319  	if (redosAvail<1) return;
   6.320 +
   6.321 +	bool blockSaveStateOrg=blockSaveState;
   6.322 +	blockSaveState=true;
   6.323 +	
   6.324  	redosAvail--;
   6.325  
   6.326  	if (undosAvail<stepsTotal) undosAvail++;
   6.327 @@ -1524,19 +1571,20 @@
   6.328  	// Find out current undo directory
   6.329  	QString bakMapDir=QDir::convertSeparators (QString(tmpMapDir+"/undo-%1").arg(curStep));
   6.330  
   6.331 -/* TODO remove testing
   6.332 -*/
   6.333 -	cout << "ME::redo() begin\n";
   6.334 -	cout << "    undosAvail="<<undosAvail<<endl;
   6.335 -	cout << "    redosAvail="<<redosAvail<<endl;
   6.336 -	cout << "       curStep="<<curStep<<endl;
   6.337 -	cout << "    ---------------------------"<<endl;
   6.338 -	cout << "    comment="<<comment.toStdString()<<endl;
   6.339 -	cout << "    undoCom="<<undoCommand.toStdString()<<endl;
   6.340 -	cout << "    undoSel="<<undoSelection.toStdString()<<endl;
   6.341 -	cout << "    redoCom="<<redoCommand.toStdString()<<endl;
   6.342 -	cout << "    redoSel="<<redoSelection.toStdString()<<endl;
   6.343 -	cout << "    ---------------------------"<<endl<<endl;
   6.344 +	if (debug)
   6.345 +	{
   6.346 +		cout << "ME::redo() begin\n";
   6.347 +		cout << "    undosAvail="<<undosAvail<<endl;
   6.348 +		cout << "    redosAvail="<<redosAvail<<endl;
   6.349 +		cout << "       curStep="<<curStep<<endl;
   6.350 +		cout << "    ---------------------------"<<endl;
   6.351 +		cout << "    comment="<<comment.toStdString()<<endl;
   6.352 +		cout << "    undoCom="<<undoCommand.toStdString()<<endl;
   6.353 +		cout << "    undoSel="<<undoSelection.toStdString()<<endl;
   6.354 +		cout << "    redoCom="<<redoCommand.toStdString()<<endl;
   6.355 +		cout << "    redoSel="<<redoSelection.toStdString()<<endl;
   6.356 +		cout << "    ---------------------------"<<endl<<endl;
   6.357 +	}
   6.358  
   6.359  	// select  object before redo
   6.360  	if (!redoSelection.isEmpty())
   6.361 @@ -1546,7 +1594,7 @@
   6.362  	parseAtom (redoCommand);
   6.363  	mapCenter->reposition();
   6.364  
   6.365 -	blockSaveState=false;
   6.366 +	blockSaveState=blockSaveStateOrg;
   6.367  
   6.368  	undoSet.setEntry ("/history/undosAvail",QString::number(undosAvail));
   6.369  	undoSet.setEntry ("/history/redosAvail",QString::number(redosAvail));
   6.370 @@ -1577,8 +1625,6 @@
   6.371  
   6.372  void MapEditor::undo()
   6.373  {
   6.374 -	blockSaveState=true;
   6.375 -	
   6.376  	// Restore variables
   6.377  	int curStep=undoSet.readNumEntry (QString("/history/curStep"));
   6.378  	int undosAvail=undoSet.readNumEntry (QString("/history/undosAvail"));
   6.379 @@ -1587,6 +1633,9 @@
   6.380  	// Can we undo at all?
   6.381  	if (undosAvail<1) return;
   6.382  
   6.383 +	bool blockSaveStateOrg=blockSaveState;
   6.384 +	blockSaveState=true;
   6.385 +	
   6.386  	QString undoCommand=  undoSet.readEntry (QString("/history/step-%1/undoCommand").arg(curStep));
   6.387  	QString undoSelection=undoSet.readEntry (QString("/history/step-%1/undoSelection").arg(curStep));
   6.388  	QString redoCommand=  undoSet.readEntry (QString("/history/step-%1/redoCommand").arg(curStep));
   6.389 @@ -1605,19 +1654,20 @@
   6.390  	if (!undoSelection.isEmpty())
   6.391  		select (undoSelection);
   6.392  
   6.393 -/* TODO testing
   6.394 -*/	
   6.395 -	cout << "ME::undo() begin\n";
   6.396 -	cout << "    undosAvail="<<undosAvail<<endl;
   6.397 -	cout << "    redosAvail="<<redosAvail<<endl;
   6.398 -	cout << "       curStep="<<curStep<<endl;
   6.399 -	cout << "    ---------------------------"<<endl;
   6.400 -	cout << "    comment="<<comment.toStdString()<<endl;
   6.401 -	cout << "    undoCom="<<undoCommand.toStdString()<<endl;
   6.402 -	cout << "    undoSel="<<undoSelection.toStdString()<<endl;
   6.403 -	cout << "    redoCom="<<redoCommand.toStdString()<<endl;
   6.404 -	cout << "    redoSel="<<redoSelection.toStdString()<<endl;
   6.405 -	cout << "    ---------------------------"<<endl<<endl;
   6.406 +	if (debug)
   6.407 +	{
   6.408 +		cout << "ME::undo() begin\n";
   6.409 +		cout << "    undosAvail="<<undosAvail<<endl;
   6.410 +		cout << "    redosAvail="<<redosAvail<<endl;
   6.411 +		cout << "       curStep="<<curStep<<endl;
   6.412 +		cout << "    ---------------------------"<<endl;
   6.413 +		cout << "    comment="<<comment.toStdString()<<endl;
   6.414 +		cout << "    undoCom="<<undoCommand.toStdString()<<endl;
   6.415 +		cout << "    undoSel="<<undoSelection.toStdString()<<endl;
   6.416 +		cout << "    redoCom="<<redoCommand.toStdString()<<endl;
   6.417 +		cout << "    redoSel="<<redoSelection.toStdString()<<endl;
   6.418 +		cout << "    ---------------------------"<<endl<<endl;
   6.419 +	}	
   6.420  	parseAtom (undoCommand);
   6.421  	mapCenter->reposition();
   6.422  
   6.423 @@ -1627,7 +1677,7 @@
   6.424  
   6.425  	redosAvail++;
   6.426  
   6.427 -	blockSaveState=false;
   6.428 +	blockSaveState=blockSaveStateOrg;
   6.429  /* TODO remove testing
   6.430  	cout << "ME::undo() end\n";
   6.431  	cout << "    undosAvail="<<undosAvail<<endl;
   6.432 @@ -1808,7 +1858,7 @@
   6.433  			s, "move "+ps, 
   6.434  			s, "move "+qpointfToString (QPointF (x,y)), 
   6.435  			QString("Move %1 to  %2").arg(getName(sel)).arg(ps));
   6.436 -		sel->move(x,y);	// FIXME	xelection not moved automagically...
   6.437 +		sel->move(x,y);
   6.438  		mapCenter->reposition();
   6.439  		xelection.update();
   6.440  	}
   6.441 @@ -1841,11 +1891,8 @@
   6.442  	{
   6.443  		if (!bo->canMoveBranchUp()) return;
   6.444  		par=(BranchObj*)(bo->getParObj());
   6.445 -		xelection.unselect();		// FIXME needed?
   6.446 -		bo=par->moveBranchUp (bo);	// bo will be the one below selection
   6.447 -		xelection.reselect();
   6.448 -		//saveState (selection,"moveBranchDown ()",bo,"moveBranchUp ()",QString("Move up %1").arg(getName(bo)));
   6.449 -		saveState (bo,"moveBranchDown ()",bo,"moveBranchUp ()",QString("Move up %1").arg(getName(bo)));
   6.450 +		BranchObj *obo=par->moveBranchUp (bo);	// bo will be the one below selection
   6.451 +		saveState (bo->getSelectString(),"moveBranchDown ()",obo->getSelectString(),"moveBranchUp ()",QString("Move up %1").arg(getName(bo)));
   6.452  		mapCenter->reposition();
   6.453  		scene()->update();
   6.454  		xelection.update();
   6.455 @@ -1861,11 +1908,8 @@
   6.456  	{
   6.457  		if (!bo->canMoveBranchDown()) return;
   6.458  		par=(BranchObj*)(bo->getParObj());
   6.459 -		xelection.unselect();		// FIXME needed?
   6.460 -		bo=par->moveBranchDown(bo);	// bo will be the one above selection
   6.461 -		xelection.reselect();
   6.462 -		//saveState(selection,"moveBranchUp ()",bo,"moveBranchDown ()",QString("Move down %1").arg(getName(bo)));
   6.463 -		saveState(bo,"moveBranchUp ()",bo,"moveBranchDown ()",QString("Move down %1").arg(getName(bo)));
   6.464 +		BranchObj *obo=par->moveBranchDown(bo);	// bo will be the one above selection
   6.465 +		saveState(bo->getSelectString(),"moveBranchUp ()",obo->getSelectString(),"moveBranchDown ()",QString("Move down %1").arg(getName(bo)));
   6.466  		mapCenter->reposition();
   6.467  		scene()->update();
   6.468  		xelection.update();
   6.469 @@ -2209,7 +2253,7 @@
   6.470  			} else
   6.471  			{
   6.472  				// Special case, look at orientation
   6.473 -				if (xelection.single()->getOrientation()==OrientRightOfCenter)
   6.474 +				if (xelection.single()->getOrientation()==LinkableMapObj::RightOfCenter)
   6.475  					num=QString ("%1").arg(num.toUInt()+1);
   6.476  				else	
   6.477  					num=QString ("%1").arg(num.toUInt()-1);
   6.478 @@ -2291,7 +2335,7 @@
   6.479  			} else
   6.480  			{
   6.481  				// Special case, look at orientation
   6.482 -				if (xelection.single()->getOrientation()==OrientRightOfCenter)
   6.483 +				if (xelection.single()->getOrientation()==LinkableMapObj::RightOfCenter)
   6.484  					num=QString ("%1").arg(num.toInt()-1);
   6.485  				else	
   6.486  					num=QString ("%1").arg(num.toInt()+1);
   6.487 @@ -2325,7 +2369,7 @@
   6.488  	BranchObj *bo=xelection.getBranch();
   6.489  	if (bo && xelection.type()==Branch)
   6.490  	{
   6.491 -		if (bo->getOrientation()==OrientRightOfCenter)
   6.492 +		if (bo->getOrientation()==LinkableMapObj::RightOfCenter)
   6.493  			selectPrevBranchInt();
   6.494  		else
   6.495  			if (bo->getDepth()==1)
   6.496 @@ -2339,7 +2383,7 @@
   6.497  {
   6.498  	BranchObj *bo=xelection.getBranch();
   6.499  	if (bo && xelection.type()==Branch)
   6.500 -		if (bo->getOrientation()==OrientRightOfCenter)
   6.501 +		if (bo->getOrientation()==LinkableMapObj::RightOfCenter)
   6.502  			selectNextBranchInt();
   6.503  		else
   6.504  			if (bo->getDepth()==1)
   6.505 @@ -2363,7 +2407,7 @@
   6.506  			if (bo)
   6.507  			{
   6.508  				// Workaround for reselecting on left and right side
   6.509 -				if (bo->getOrientation()==OrientRightOfCenter)
   6.510 +				if (bo->getOrientation()==LinkableMapObj::RightOfCenter)
   6.511  					bo=par->getLastBranch();
   6.512  				if (bo)
   6.513  				{
   6.514 @@ -2376,7 +2420,7 @@
   6.515  		} else
   6.516  		{
   6.517  			par=(BranchObj*)(sel->getParObj());
   6.518 -			if (sel->getOrientation()==OrientRightOfCenter)
   6.519 +			if (sel->getOrientation()==LinkableMapObj::RightOfCenter)
   6.520  			{
   6.521  				if (xelection.type() == Branch ||
   6.522  					xelection.type() == FloatImage)
   6.523 @@ -2416,7 +2460,7 @@
   6.524  			if (bo)
   6.525  			{
   6.526  				// Workaround for reselecting on left and right side
   6.527 -				if (bo->getOrientation()==OrientLeftOfCenter)
   6.528 +				if (bo->getOrientation()==LinkableMapObj::LeftOfCenter)
   6.529  					bo=par->getFirstBranch();
   6.530  				if (bo)
   6.531  				{
   6.532 @@ -2428,7 +2472,7 @@
   6.533  		} else
   6.534  		{
   6.535  			par=(BranchObj*)(xelection.single()->getParObj());
   6.536 -			if (xelection.single()->getOrientation()==OrientLeftOfCenter)
   6.537 +			if (xelection.single()->getOrientation()==LinkableMapObj::LeftOfCenter)
   6.538  			{
   6.539  				if (xelection.type() == Branch ||
   6.540  					xelection.type() == FloatImage)
   6.541 @@ -3025,13 +3069,13 @@
   6.542  	);	
   6.543  
   6.544  	if (s=="StyleLine")
   6.545 -		linkstyle=StyleLine;
   6.546 +		linkstyle=LinkableMapObj::Line;
   6.547  	else if (s=="StyleParabel")
   6.548 -		linkstyle=StyleParabel;
   6.549 +		linkstyle=LinkableMapObj::Parabel;
   6.550  	else if (s=="StylePolyLine")
   6.551 -		linkstyle=StylePolyLine;
   6.552 +		linkstyle=LinkableMapObj::PolyLine;
   6.553  	else	
   6.554 -		linkstyle=StylePolyParabel;
   6.555 +		linkstyle=LinkableMapObj::PolyParabel;
   6.556  
   6.557  	BranchObj *bo;
   6.558  	bo=mapCenter->first();
   6.559 @@ -3044,7 +3088,7 @@
   6.560  	mapCenter->reposition();
   6.561  }
   6.562  
   6.563 -LinkStyle MapEditor::getMapLinkStyle ()
   6.564 +LinkableMapObj::Style MapEditor::getMapLinkStyle ()
   6.565  {
   6.566  	return linkstyle;
   6.567  }	
   6.568 @@ -3067,7 +3111,7 @@
   6.569  	}
   6.570  }
   6.571  
   6.572 -void MapEditor::setMapLinkColorHint(LinkColorHint lch)
   6.573 +void MapEditor::setMapLinkColorHint(LinkableMapObj::ColorHint lch)
   6.574  {
   6.575  	linkcolorhint=lch;
   6.576  	setMapLinkColorHintInt();
   6.577 @@ -3075,10 +3119,10 @@
   6.578  
   6.579  void MapEditor::toggleMapLinkColorHint()
   6.580  {
   6.581 -	if (linkcolorhint==HeadingColor)
   6.582 -		linkcolorhint=DefaultColor;
   6.583 +	if (linkcolorhint==LinkableMapObj::HeadingColor)
   6.584 +		linkcolorhint=LinkableMapObj::DefaultColor;
   6.585  	else	
   6.586 -		linkcolorhint=HeadingColor;
   6.587 +		linkcolorhint=LinkableMapObj::HeadingColor;
   6.588  	BranchObj *bo;
   6.589  	bo=mapCenter->first();
   6.590  	while (bo) 
   6.591 @@ -3088,7 +3132,7 @@
   6.592  	}
   6.593  }
   6.594  
   6.595 -LinkColorHint MapEditor::getMapLinkColorHint()
   6.596 +LinkableMapObj::ColorHint MapEditor::getMapLinkColorHint()
   6.597  {
   6.598  	return linkcolorhint;
   6.599  }
   6.600 @@ -3162,9 +3206,8 @@
   6.601  	return xelection.getColor();
   6.602  }
   6.603  
   6.604 -bool MapEditor::scrollBranch()
   6.605 +bool MapEditor::scrollBranch(BranchObj *bo)
   6.606  {
   6.607 -	BranchObj *bo=xelection.getBranch();
   6.608  	if (bo)
   6.609  	{
   6.610  		if (bo->isScrolled()) return false;
   6.611 @@ -3187,9 +3230,8 @@
   6.612  	return false;
   6.613  }
   6.614  
   6.615 -bool MapEditor::unscrollBranch()
   6.616 +bool MapEditor::unscrollBranch(BranchObj *bo)
   6.617  {
   6.618 -	BranchObj *bo=xelection.getBranch();
   6.619  	if (bo)
   6.620  	{
   6.621  		if (!bo->isScrolled()) return false;
   6.622 @@ -3218,13 +3260,13 @@
   6.623  	if (xelection.type()==Branch )
   6.624  	{
   6.625  		if (bo->isScrolled())
   6.626 -			unscrollBranch ();
   6.627 +			unscrollBranch (bo);
   6.628  		else
   6.629 -			scrollBranch ();
   6.630 +			scrollBranch (bo);
   6.631  	}
   6.632  }
   6.633  
   6.634 -void MapEditor::unscrollChilds() // FIXME saveState missing
   6.635 +void MapEditor::unscrollChilds() 
   6.636  {
   6.637  	BranchObj *bo=xelection.getBranch();
   6.638  	if (bo)
   6.639 @@ -3232,7 +3274,7 @@
   6.640  		bo->first();
   6.641  		while (bo) 
   6.642  		{
   6.643 -			if (bo->isScrolled()) bo->toggleScroll();
   6.644 +			if (bo->isScrolled()) unscrollBranch (bo);
   6.645  			bo=bo->next();
   6.646  		}
   6.647  	}	
   6.648 @@ -3351,40 +3393,79 @@
   6.649  	}
   6.650  }
   6.651  
   6.652 -void MapEditor::setFrameType(const FrameType &t)	// FIXME missing saveState
   6.653 +void MapEditor::setFrameType(const FrameObj::FrameType &t)
   6.654  {
   6.655  	BranchObj *bo=xelection.getBranch();
   6.656  	if (bo)
   6.657  	{
   6.658 +		QString s=bo->getFrameTypeName();
   6.659  		bo->setFrameType (t);
   6.660 +		saveState (bo, QString("setFrameType (\"%1\")").arg(s),
   6.661 +			bo, QString ("setFrameType (\"%1\")").arg(bo->getFrameTypeName()),QString ("set type of frame to %1").arg(s));
   6.662  		mapCenter->reposition();
   6.663  		bo->updateLink();
   6.664  	}
   6.665  }
   6.666  
   6.667 -void MapEditor::setFrameType(const QString &s)	// FIXME missing saveState
   6.668 +void MapEditor::setFrameType(const QString &s)	
   6.669  {
   6.670  	BranchObj *bo=xelection.getBranch();
   6.671  	if (bo)
   6.672  	{
   6.673 +		saveState (bo, QString("setFrameType (\"%1\")").arg(bo->getFrameTypeName()),
   6.674 +			bo, QString ("setFrameType (\"%1\")").arg(s),QString ("set type of frame to %1").arg(s));
   6.675  		bo->setFrameType (s);
   6.676  		mapCenter->reposition();
   6.677  		bo->updateLink();
   6.678  	}
   6.679  }
   6.680  
   6.681 -void MapEditor::setFramePenColor(const QColor &c)	// FIXME missing saveState
   6.682 +void MapEditor::setFramePenColor(const QColor &c)	
   6.683  {
   6.684  	BranchObj *bo=xelection.getBranch();
   6.685  	if (bo)
   6.686 +	{
   6.687 +		saveState (bo, QString("setFramePenColor (\"%1\")").arg(bo->getFramePenColor().name() ),
   6.688 +			bo, QString ("setFramePenColor (\"%1\")").arg(c.name() ),QString ("set pen color of frame to %1").arg(c.name() ));
   6.689  		bo->setFramePenColor (c);
   6.690 +	}	
   6.691  }
   6.692  
   6.693 -void MapEditor::setFrameBrushColor(const QColor &c)	// FIXME missing saveState
   6.694 +void MapEditor::setFrameBrushColor(const QColor &c)	
   6.695  {
   6.696  	BranchObj *bo=xelection.getBranch();
   6.697  	if (bo)
   6.698 +	{
   6.699 +		saveState (bo, QString("setFrameBrushColor (\"%1\")").arg(bo->getFrameBrushColor().name() ),
   6.700 +			bo, QString ("setFrameBrushColor (\"%1\")").arg(c.name() ),QString ("set brush color of frame to %1").arg(c.name() ));
   6.701  		bo->setFrameBrushColor (c);
   6.702 +	}	
   6.703 +}
   6.704 +
   6.705 +void MapEditor::setFramePadding (const int &)
   6.706 +{
   6.707 +	BranchObj *bo=xelection.getBranch();
   6.708 +	/*
   6.709 +	if (bo)
   6.710 +	{
   6.711 +		saveState (bo, QString("setFrameBrushColor (\"%1\")").arg(bo->getFrameBrushColor().name() ),
   6.712 +			bo, QString ("setFrameBrushColor (\"%1\")").arg(c.name() ),QString ("set brush color of frame to %1").arg(c.name() ));
   6.713 +		bo->setFrameBrushColor (c);
   6.714 +	}	
   6.715 +	*/
   6.716 +}
   6.717 +
   6.718 +void MapEditor::setFrameBorderWidth(const int &)
   6.719 +{
   6.720 +	BranchObj *bo=xelection.getBranch();
   6.721 +	/*
   6.722 +	if (bo)
   6.723 +	{
   6.724 +		saveState (bo, QString("setFrameBrushColor (\"%1\")").arg(bo->getFrameBrushColor().name() ),
   6.725 +			bo, QString ("setFrameBrushColor (\"%1\")").arg(c.name() ),QString ("set brush color of frame to %1").arg(c.name() ));
   6.726 +		bo->setFrameBrushColor (c);
   6.727 +	}	
   6.728 +	*/
   6.729  }
   6.730  
   6.731  void MapEditor::setIncludeImagesVer(bool b)	
   6.732 @@ -3550,6 +3631,8 @@
   6.733  {
   6.734  	// This is the playground
   6.735  
   6.736 +	BranchObj *bo=xelection.getBranch();
   6.737 +	if (bo) animObjList.append( bo );
   6.738  	
   6.739  /*
   6.740  	WarningDialog dia;
   6.741 @@ -3636,13 +3719,13 @@
   6.742  	{
   6.743  		switch (mainWindow->getModMode())
   6.744  		{
   6.745 -			case ModModeColor: 
   6.746 +			case Main::ModModeColor: 
   6.747  				setCursor (PickColorCursor);
   6.748  				break;
   6.749 -			case ModModeCopy: 
   6.750 +			case Main::ModModeCopy: 
   6.751  				setCursor (CopyCursor);
   6.752  				break;
   6.753 -			case ModModeXLink: 
   6.754 +			case Main::ModModeXLink: 
   6.755  				setCursor (XLinkCursor);
   6.756  				break;
   6.757  			default :
   6.758 @@ -3706,13 +3789,13 @@
   6.759  	// No system flag clicked, take care of modmodes (CTRL-Click)
   6.760  	if (e->state() & Qt::ControlModifier)
   6.761  	{
   6.762 -		if (mainWindow->getModMode()==ModModeColor)
   6.763 +		if (mainWindow->getModMode()==Main::ModModeColor)
   6.764  		{
   6.765  				pickingColor=true;
   6.766  				setCursor (PickColorCursor);
   6.767  				return;
   6.768  		} 
   6.769 -		if (mainWindow->getModMode()==ModModeXLink)
   6.770 +		if (mainWindow->getModMode()==Main::ModModeXLink)
   6.771  		{	
   6.772  			BranchObj *bo_begin=NULL;
   6.773  			if (lmo)
   6.774 @@ -3754,7 +3837,7 @@
   6.775  
   6.776  			// If modMode==copy, then we want to "move" the _new_ object around
   6.777  			// then we need the offset from p to the _old_ selection, because of tmp
   6.778 -			if (mainWindow->getModMode()==ModModeCopy &&
   6.779 +			if (mainWindow->getModMode()==Main::ModModeCopy &&
   6.780  				e->state() & Qt::ControlModifier)
   6.781  			{
   6.782  				if (xelection.type()==Branch)
   6.783 @@ -3801,7 +3884,7 @@
   6.784      if ( lmosel && movingObj) 
   6.785      {	
   6.786  		// reset cursor if we are moving and don't copy
   6.787 -		if (mainWindow->getModMode()!=ModModeCopy)
   6.788 +		if (mainWindow->getModMode()!=Main::ModModeCopy)
   6.789  			setCursor (Qt::ArrowCursor);
   6.790  
   6.791  		// To avoid jumping of the sceneView, only 
   6.792 @@ -3878,7 +3961,7 @@
   6.793  				} else
   6.794  				{
   6.795  					// Move ordinary branch
   6.796 -					if (lmosel->getOrientation() == OrientLeftOfCenter)
   6.797 +					if (lmosel->getOrientation() == LinkableMapObj::LeftOfCenter)
   6.798  						// Add width of bbox here, otherwise alignRelTo will cause jumping around
   6.799  						lmosel->move(p.x() -movingObj_start.x()+lmosel->getBBox().width(), 
   6.800  							p.y()-movingObj_start.y() +lmosel->getTopPad() );		
   6.801 @@ -3958,7 +4041,7 @@
   6.802  	}
   6.803  
   6.804  	// Have we been drawing a link?
   6.805 -	if (drawingLink)
   6.806 +	if (drawingLink)	//FIXME savestate missing
   6.807  	{
   6.808  		drawingLink=false;
   6.809  		// Check if we are over another branch
   6.810 @@ -3968,7 +4051,7 @@
   6.811  			tmpXLink->setEnd ( ((BranchObj*)(dst)) );
   6.812  			tmpXLink->updateXLink();
   6.813  			tmpXLink->activate();
   6.814 -			//saveStateComplete(QString("Activate xLink from %1 to %2").arg(getName(tmpXLink->getBegin())).arg(getName(tmpXLink->getEnd())) );	//FIXME undoCommand
   6.815 +			//saveStateComplete(QString("Activate xLink from %1 to %2").arg(getName(tmpXLink->getBegin())).arg(getName(tmpXLink->getEnd())) );	
   6.816  		} else
   6.817  		{
   6.818  			delete(tmpXLink);
   6.819 @@ -4187,8 +4270,28 @@
   6.820  	event->acceptProposedAction();
   6.821  }
   6.822  
   6.823 -/*
   6.824 -void MapEditor::contentsDropEvent(QDropEvent *event) 
   6.825 +void MapEditor::timerEvent(QTimerEvent *event)  //FIXME testing
   6.826 +{
   6.827 +    Q_UNUSED(event);
   6.828 +
   6.829 +	cout << "ME::timerEvent\n";
   6.830 +
   6.831 +	for (int i=0; i<animObjList.size(); ++i)
   6.832 +	{
   6.833 +		animObjList.at(i)->animate();
   6.834 +		((BranchObj*)animObjList.at(i))->move2RelPos (((BranchObj*)animObjList.at(i))->getRelPos() );
   6.835 +	}
   6.836 +	mapCenter->reposition();
   6.837 +}
   6.838 +
   6.839 +void MapEditor::autosave()
   6.840 +{
   6.841 +	if (mapUnsaved &&mapChanged && settings.value ("/mapeditor/autosave/used",true).toBool() )
   6.842 +		mainWindow->fileSave (this);
   6.843 +}
   6.844 +
   6.845 +
   6.846 +/*FIXME not needed? void MapEditor::contentsDropEvent(QDropEvent *event) 
   6.847  {
   6.848  
   6.849  		} else if (event->provides("application/x-moz-file-promise-url") && 
   6.850 @@ -4256,12 +4359,9 @@
   6.851  	BranchObj *bo=xelection.getBranch();
   6.852  	if (bo)
   6.853    {
   6.854 -    //FIXME XXX saveStateChangingPart(selection,QString("Add floatimage to %1").arg(getName(bo)));
   6.855 -    //QString fn=fd->selectedFile();
   6.856 -    //lastImageDir=fn.left(fn.findRev ("/"));
   6.857  	FloatImageObj *fio=bo->addFloatImage();
   6.858      fio->load(img);
   6.859 -    fio->setOriginalFilename("Image added by Drag and Drop");
   6.860 +    fio->setOriginalFilename("Image added by Drag and Drop");	// FIXME savestate
   6.861      mapCenter->reposition();
   6.862      scene()->update();
   6.863    }
     7.1 --- a/mapeditor.h	Wed Apr 25 16:02:54 2007 +0000
     7.2 +++ b/mapeditor.h	Wed Apr 25 16:02:54 2007 +0000
     7.3 @@ -8,10 +8,13 @@
     7.4  #include "file.h"
     7.5  #include "misc.h"
     7.6  #include "parser.h"
     7.7 +#include "ornamentedobj.h"
     7.8  #include "selection.h"
     7.9  #include "settings.h"
    7.10  
    7.11  
    7.12 +/*! \brief Main widget in vym to display and edit the map */
    7.13 +
    7.14  class MapEditor : public QGraphicsView, public xmlObj {
    7.15      Q_OBJECT
    7.16  
    7.17 @@ -21,6 +24,8 @@
    7.18      MapCenterObj* getMapCenter();
    7.19  	QGraphicsScene * getScene();
    7.20  	bool isRepositionBlocked(); // block while load or undo
    7.21 +	bool isSaveStateBlocked();	// block while undo/redo or while running scripts
    7.22 +	void setSaveStateBlocked(bool);
    7.23  	
    7.24  private:
    7.25  	QString getName(const LinkableMapObj*);	// Get e.g. heading or filename
    7.26 @@ -59,8 +64,8 @@
    7.27  	void setSmoothPixmap(bool);
    7.28  private:
    7.29      QPixmap getPixmap();
    7.30 -	void setHideTmpMode (HideTmpMode);	// temporary hide stuff
    7.31 -	HideTmpMode getHideTmpMode();		// temporary hide stuff
    7.32 +	void setHideTmpMode (BranchObj::HideTmpMode);	// temporary hide stuff
    7.33 +	BranchObj::HideTmpMode getHideTmpMode();		// temporary hide stuff
    7.34  public:
    7.35  	void setExportMode (bool);			// temporary hide stuff during export
    7.36      void exportImage (QString fn);			// export as PNG	
    7.37 @@ -152,11 +157,11 @@
    7.38  	void setMapAuthor (const QString &);
    7.39  	void setMapComment(const QString &);
    7.40  	void setMapLinkStyle (const QString &);	// Set style of link
    7.41 -	LinkStyle getMapLinkStyle ();			// requested in LMO
    7.42 +	LinkableMapObj::Style getMapLinkStyle ();	// requested in LMO
    7.43  	void setMapDefLinkColor(QColor);		// default color of links
    7.44  	void setMapLinkColorHintInt();			// color of links
    7.45 -	void setMapLinkColorHint(LinkColorHint);// color of links
    7.46 -	LinkColorHint getMapLinkColorHint();
    7.47 +	void setMapLinkColorHint(LinkableMapObj::ColorHint);// color of links
    7.48 +	LinkableMapObj::ColorHint getMapLinkColorHint();
    7.49  	QColor getMapDefLinkColor();
    7.50  	void setMapDefXLinkColor(QColor);
    7.51  	QColor getMapDefXLinkColor();
    7.52 @@ -170,8 +175,8 @@
    7.53  public:	
    7.54      void setSelectionColor(QColor);
    7.55      QColor getSelectionColor();
    7.56 -	bool scrollBranch();
    7.57 -	bool unscrollBranch();
    7.58 +	bool scrollBranch(BranchObj*);
    7.59 +	bool unscrollBranch(BranchObj*);
    7.60      void toggleScroll();
    7.61      void unscrollChilds();
    7.62  private:	
    7.63 @@ -182,10 +187,12 @@
    7.64  	void saveFloatImageInt (FloatImageObj*, const QString &, const QString &);
    7.65  public:	
    7.66  	void saveFloatImage ();
    7.67 -	void setFrameType(const FrameType &);
    7.68 +	void setFrameType(const FrameObj::FrameType &);
    7.69  	void setFrameType(const QString &);
    7.70  	void setFramePenColor (const QColor &);
    7.71  	void setFrameBrushColor (const QColor &);
    7.72 +	void setFramePadding (const int &);
    7.73 +	void setFrameBorderWidth (const int &);
    7.74  	void setIncludeImagesVer(bool);
    7.75  	void setIncludeImagesHor(bool);
    7.76  	void setHideLinkUnselected (bool);
    7.77 @@ -204,18 +211,25 @@
    7.78      virtual void keyPressEvent(QKeyEvent*);
    7.79      virtual void keyReleaseEvent(QKeyEvent*);
    7.80      virtual void mousePressEvent(QMouseEvent*);
    7.81 +    virtual void mouseMoveEvent(QMouseEvent*);
    7.82      virtual void mouseReleaseEvent(QMouseEvent*);
    7.83      virtual void mouseDoubleClickEvent(QMouseEvent*);
    7.84 -    virtual void mouseMoveEvent(QMouseEvent*);
    7.85 +    virtual void resizeEvent( QResizeEvent * );
    7.86  
    7.87  	void dragEnterEvent (QDragEnterEvent *);
    7.88  	void dragMoveEvent (QDragMoveEvent *);
    7.89  	void dragLeaveEvent (QDragLeaveEvent *);
    7.90  	void dropEvent (QDropEvent *);
    7.91  
    7.92 +	void timerEvent(QTimerEvent *event);
    7.93 +
    7.94 +private slots:	
    7.95 +	void autosave ();
    7.96 +
    7.97  private:
    7.98  	QGraphicsScene *mapScene;
    7.99      MapCenterObj* mapCenter;
   7.100 +	QTimer *autosaveTimer;
   7.101  
   7.102  	bool adjustCanvasRequested;	// collect requests until end of user event
   7.103  	BranchObj *editingBO;		// entering Text into BO
   7.104 @@ -223,8 +237,8 @@
   7.105  	QColor defLinkColor;		// default color for links
   7.106  	QColor defXLinkColor;		// default color for xlinks
   7.107  	int defXLinkWidth;			// default width for xlinks
   7.108 -	LinkColorHint linkcolorhint;// use heading color or own color
   7.109 -	LinkStyle linkstyle;		// default style for links
   7.110 +	LinkableMapObj::ColorHint linkcolorhint;// use heading color or own color
   7.111 +	LinkableMapObj::Style linkstyle;		// default style for links
   7.112  
   7.113      QCursor HandOpenCursor;		// cursor while moving canvas view
   7.114  	QCursor PickColorCursor;	// cursor while picking color 
   7.115 @@ -273,9 +287,10 @@
   7.116  	bool EOFind;				// true, if search failed
   7.117  
   7.118  	QPoint exportOffset;		// set before export, used in save
   7.119 -	HideTmpMode hidemode;			// true while exporting to hide some stuff
   7.120 -	
   7.121 -    void resizeEvent( QResizeEvent * );
   7.122 +	BranchObj::HideTmpMode hidemode;	// true while exporting to hide some stuff
   7.123 +
   7.124 +	int timerId;				// animation timer
   7.125 +	QList <MapObj*> animObjList;// list with animated objects
   7.126  };
   7.127  #endif
   7.128