mapeditor.cpp
changeset 445 0796c5592f00
parent 442 dfbc371b7280
child 447 72afe12da1c8
     1.1 --- a/mapeditor.cpp	Sat Mar 31 09:28:30 2007 +0000
     1.2 +++ b/mapeditor.cpp	Mon Apr 09 15:42:21 2007 +0000
     1.3 @@ -523,6 +523,7 @@
     1.4  		}	
     1.5  	} else if (com=="colorSubtree")
     1.6  	{
     1.7 +		cout << "atom="<< atom.ascii()<<endl;
     1.8  		if (xelection.isEmpty())
     1.9  		{
    1.10  			parser.setError (Aborted,"Nothing selected");
    1.11 @@ -942,6 +943,20 @@
    1.12  				selb->updateFlagsToolbar();
    1.13  			}	
    1.14  		}
    1.15 +	} else if (com=="setFrameType")
    1.16 +	{
    1.17 +		if (xelection.isEmpty() )
    1.18 +		{
    1.19 +			parser.setError (Aborted,"Nothing selected");
    1.20 +		} else if (! selb )
    1.21 +		{				  
    1.22 +			parser.setError (Aborted,"Type of selection is not a branch");
    1.23 +		} else if (parser.checkParamCount(1))
    1.24 +		{
    1.25 +			s=parser.parString(ok,0);
    1.26 +			if (ok) 
    1.27 +				setFrameType (s);
    1.28 +		}
    1.29  	} else if (com=="unscroll")
    1.30  	{
    1.31  		if (xelection.isEmpty() )
    1.32 @@ -991,23 +1006,10 @@
    1.33  
    1.34  void MapEditor::runScript (QString script)
    1.35  {
    1.36 -	// TODO "atomize" script, currently each line holds one atom
    1.37 -
    1.38 -	QStringList list=script.split("\n");
    1.39 -	QString l;
    1.40 -	int pos;
    1.41 -	for (int i=0; i<list.size(); i++)
    1.42 -	{
    1.43 -		l=list.at(i);
    1.44 -
    1.45 -		// Ignore comments
    1.46 -		pos=l.indexOf ("#");
    1.47 -		if (pos>=0) l.truncate (pos);
    1.48 -
    1.49 -		// Try to ignore empty lines
    1.50 -		if (l.contains (QRegExp ("\\w")))
    1.51 -			parseAtom (l);
    1.52 -	}
    1.53 +	// FIXME "atomize" script, currently each line holds one atom
    1.54 +
    1.55 +	parser.setScript (script);
    1.56 +	parser.runScript();
    1.57  
    1.58  }
    1.59  
    1.60 @@ -2513,9 +2515,9 @@
    1.61  	QColor oldcol=mapScene->backgroundBrush().color();
    1.62  	saveState(
    1.63  		mapCenter,
    1.64 -		QString ("setMapBackgroundColor (%1)").arg(oldcol.name()),
    1.65 +		QString ("setMapBackgroundColor (\"%1\")").arg(oldcol.name()),
    1.66  		mapCenter,
    1.67 -		QString ("setMapBackgroundColor (%1)").arg(col.name()),
    1.68 +		QString ("setMapBackgroundColor (\"%1\")").arg(col.name()),
    1.69  		QString("Set background color of map to %1").arg(col.name()));
    1.70  	mapScene->setBackgroundBrush(col);
    1.71  }
    1.72 @@ -2541,9 +2543,9 @@
    1.73  	{
    1.74  		saveState(
    1.75  			bo, 
    1.76 -			QString ("colorBranch (%1)").arg(bo->getColor().name()),
    1.77 +			QString ("colorBranch (\"%1\")").arg(bo->getColor().name()),
    1.78  			bo,
    1.79 -			QString ("colorBranch (%1)").arg(c.name()),
    1.80 +			QString ("colorBranch (\"%1\")").arg(c.name()),
    1.81  			QString("Set color of %1 to %2").arg(getName(bo)).arg(c.name())
    1.82  		);	
    1.83  		bo->setColor(c); // color branch
    1.84 @@ -2558,7 +2560,7 @@
    1.85  		saveStateChangingPart(
    1.86  			bo, 
    1.87  			bo,
    1.88 -			QString ("colorSubtree (%1)").arg(c.name()),
    1.89 +			QString ("colorSubtree (\"%1\")").arg(c.name()),
    1.90  			QString ("Set color of %1 and childs to %2").arg(getName(bo)).arg(c.name())
    1.91  		);	
    1.92  		bo->setColorSubtree (c); // color links, color childs
    1.93 @@ -3336,6 +3338,17 @@
    1.94  	}
    1.95  }
    1.96  
    1.97 +void MapEditor::setFrameType(const QString &s)	// FIXME missing saveState
    1.98 +{
    1.99 +	BranchObj *bo=xelection.getBranch();
   1.100 +	if (bo)
   1.101 +	{
   1.102 +		bo->setFrameType (s);
   1.103 +		mapCenter->reposition();
   1.104 +		bo->updateLink();
   1.105 +	}
   1.106 +}
   1.107 +
   1.108  void MapEditor::setFramePenColor(const QColor &c)	// FIXME missing saveState
   1.109  {
   1.110  	BranchObj *bo=xelection.getBranch();