mapeditor.cpp
changeset 447 72afe12da1c8
parent 445 0796c5592f00
child 450 beb875135811
     1.1 --- a/mapeditor.cpp	Tue Apr 10 13:22:51 2007 +0000
     1.2 +++ b/mapeditor.cpp	Tue Apr 10 13:22:52 2007 +0000
     1.3 @@ -434,7 +434,7 @@
     1.4  
     1.5  	// Split string s into command and parameters
     1.6  	parser.parseAtom (atom);
     1.7 -	QString com=parser.command();
     1.8 +	QString com=parser.getCommand();
     1.9  	
    1.10  	// External commands
    1.11  	if (com=="addBranch")
    1.12 @@ -508,6 +508,19 @@
    1.13  				addMapInsertInt(t,y);	
    1.14  			}
    1.15  		}
    1.16 +	} else if (com=="clearFlags")
    1.17 +	{
    1.18 +		if (xelection.isEmpty() )
    1.19 +		{
    1.20 +			parser.setError (Aborted,"Nothing selected");
    1.21 +		} else if (! selb )
    1.22 +		{				  
    1.23 +			parser.setError (Aborted,"Type of selection is not a branch");
    1.24 +		} else if (parser.checkParamCount(0))
    1.25 +		{
    1.26 +			selb->clearStandardFlags();	
    1.27 +			selb->updateFlagsToolbar();
    1.28 +		}
    1.29  	} else if (com=="colorBranch")
    1.30  	{
    1.31  		if (xelection.isEmpty())
    1.32 @@ -957,6 +970,23 @@
    1.33  			if (ok) 
    1.34  				setFrameType (s);
    1.35  		}
    1.36 +	} else if (com=="toggleFlag")
    1.37 +	{
    1.38 +		if (xelection.isEmpty() )
    1.39 +		{
    1.40 +			parser.setError (Aborted,"Nothing selected");
    1.41 +		} else if (! selb )
    1.42 +		{				  
    1.43 +			parser.setError (Aborted,"Type of selection is not a branch");
    1.44 +		} else if (parser.checkParamCount(1))
    1.45 +		{
    1.46 +			s=parser.parString(ok,0);
    1.47 +			if (ok) 
    1.48 +			{
    1.49 +				selb->toggleStandardFlag(s);	
    1.50 +				selb->updateFlagsToolbar();
    1.51 +			}	
    1.52 +		}
    1.53  	} else if (com=="unscroll")
    1.54  	{
    1.55  		if (xelection.isEmpty() )
    1.56 @@ -1006,11 +1036,10 @@
    1.57  
    1.58  void MapEditor::runScript (QString script)
    1.59  {
    1.60 -	// FIXME "atomize" script, currently each line holds one atom
    1.61 -
    1.62  	parser.setScript (script);
    1.63  	parser.runScript();
    1.64 -
    1.65 +	while (parser.next() ) 
    1.66 +		parseAtom(parser.getAtom());
    1.67  }
    1.68  
    1.69  bool MapEditor::isDefault()