# HG changeset patch
# User insilmaril
# Date 1173136971 0
# Node ID f867269ab8a1d6ed19dd9b2bad0d22d9335f3dc4
# Parent  c2ffbc9b832dc535eeca2d3b2891d99b122d99ba
1.8.69 Some more scripting functionality (for testing)

diff -r c2ffbc9b832d -r f867269ab8a1 api.cpp
--- a/api.cpp	Sat Feb 24 12:32:53 2007 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,215 +0,0 @@
-#include "api.h"
-
-#include <qregexp.h>
-
-API::API()
-{
-	initCommand();
-}
-
-void API::initCommand()
-{
-	com="";
-	paramList.clear();
-	resetError();
-}
-
-void API::parseInput (const QString &s)
-{
-	initCommand();
-	input=s;
-	QRegExp re;
-	int pos;
-
-	// Get command
-	re.setPattern ("(.*)\\s");
-	re.setMinimal (true);
-	pos=re.search (s);
-	if (pos>=0)
-		com=re.cap(1);
-
-	// Get parameters
-	paramList.clear();
-	re.setPattern ("\\((.*)\\)");
-	pos=re.search (s);
-	if (pos>=0)
-	{
-		QString s=re.cap(1);
-		QString a;
-		bool inquote=false;
-		pos=0;
-		if (!s.isEmpty())
-		{
-			while (pos<s.length())
-			{
-				if (s.at(pos)=='\"') 
-				{
-					if (inquote)
-						inquote=false;
-					else	
-						inquote=true;
-				}
-
-				if (s.at(pos)==',' && !inquote)
-				{
-					a=s.left(pos);
-					paramList.append(a);
-					s=s.right(s.length()-pos-1);
-					pos=0;
-				} else
-					pos++;
-				
-			}
-			paramList.append (s);
-		}	
-	}	
-}
-
-QString API::command()
-{
-	return com;
-}
-
-QStringList API::parameters()
-{
-	return paramList;
-}
-
-int API::paramCount()
-{
-	return paramList.count();
-}
-
-
-QString API::errorMessage()
-{
-	QString l;
-	switch (errLevel)
-	{
-		case NoError: l="No Error";
-		case Warning: l="Warning";
-		case Aborted: l="Aborted";
-	}
-	return QString ("Error Level: %1\n    Command: %2\nDescription: %3")
-		.arg(l).arg(com).arg(errDescription);
-}
-
-QString API::errorDescription()
-{
-	return errDescription;
-}
-
-ErrorLevel API::errorLevel()
-{
-	return errLevel;
-}
-
-void API::setError(ErrorLevel level, const QString &description)
-{
-	errDescription=description;
-	errLevel=level;
-}
-
-void API::resetError ()
-{
-	errMessage="";
-	errDescription="";
-	errLevel=NoError;
-}
-
-
-bool API::checkParamCount (QList <int> plist)
-{
-	QStringList expList;
-	QString expected;
-	for (int i=0; i<plist.count();i++)
-	{
-		if (checkParamCount (plist[i])) 
-		{
-			resetError();
-			return true;
-		}
-		expList.append(QString().setNum(plist[i]));
-	}	
-	expected=expList.join(",");	
-	errDescription=QString("Wrong number of parameters: Expected %1, but found %2").arg(expected).arg(paramList.count());
-	return false;
-}
-
-bool API::checkParamCount (const int &expected)
-{
-	if (paramList.count()!=expected)
-	{
-		errLevel=Aborted;
-		errDescription=QString("Wrong number of parameters: Expected %1, but found %2").arg(expected).arg(paramList.count());
-		return false;
-	} 
-	return true;	
-}
-
-bool API::checkParamIsInt(const int &index)
-{
-	bool ok;
-	if (index > paramList.count())
-	{
-		errLevel=Aborted;
-		errDescription=QString("Parameter index %1 is outside of parameter list").arg(index);
-		return false;
-	} else
-	{
-		paramList[index].toInt (&ok, 10);
-		if (!ok)
-		{
-			errLevel=Aborted;
-			errDescription=QString("Parameter %1 is not an integer").arg(index);
-			return false;
-		} 
-	}	
-	return true;
-}
-
-int API::parInt (bool &ok,const uint &index)
-{
-	if (checkParamIsInt (index))
-		return paramList[index].toInt (&ok, 10);
-	ok=false;
-	return 0;
-}
-
-QString API::parString (bool &ok,const int &index)
-{
-	// return the string at index, this could be also stored in
-	// a variable later
-	QString r;
-	QRegExp re("\"(.*)\"");
-	int pos=re.search (paramList[index]);
-	if (pos>=0)
-		r=re.cap (1);
-	else	
-		r="";
-	ok=true;
-	return r;
-}
-
-bool API::parBool (bool &ok,const int &index)
-{
-	// return the bool at index, this could be also stored in
-	// a variable later
-	QString r;
-	ok=true;
-	QString p=paramList[index];
-	if (p=="true" || p=="1")
-		return true;
-	else if	(p=="false" || p=="0")
-		return false;
-	ok=false;
-	return ok;
-}
-
-QColor API::parColor(bool &ok,const int &index)
-{
-	// return the QColor at index
-	ok=true;
-	return QColor (paramList[index]);
-}
-
diff -r c2ffbc9b832d -r f867269ab8a1 api.h
--- a/api.h	Sat Feb 24 12:32:53 2007 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,39 +0,0 @@
-#ifndef API_H
-#define API_H
-
-#include <QColor>
-#include <QStringList>
-
-enum ErrorLevel {NoError,Warning,Aborted};
-
-class API
-{
-public:
-	API();
-	void initCommand();
-	void parseInput (const QString &input);
-	QString command();
-	QStringList parameters();
-	int paramCount();
-	QString errorMessage();
-	QString errorDescription();
-	ErrorLevel errorLevel();
-	void setError (ErrorLevel level,const QString &description);
-	void resetError();
-	bool checkParamCount (QList <int> plist);
-	bool checkParamCount (const int &index);
-	bool checkParamIsInt (const int &index);
-	int parInt (bool &,const uint &index);
-	QString parString(bool &ok,const int &index);
-	bool parBool (bool &ok, const int &index);
-	QColor parColor (bool &ok, const int &index);
-private:
-	QString input;
-	QString com;
-	QStringList paramList;
-	QString errMessage;
-	QString errDescription;
-	ErrorLevel errLevel;
-};
-
-#endif
diff -r c2ffbc9b832d -r f867269ab8a1 exports.cpp
--- a/exports.cpp	Sat Feb 24 12:32:53 2007 +0000
+++ b/exports.cpp	Mon Mar 05 23:22:51 2007 +0000
@@ -166,12 +166,11 @@
 	if (mapCenter) me=mapCenter->getMapEditor();
 	if (me)
 	{
-		cout << "starting KDE export\n";
 		WarningDialog dia;
 		dia.showCancelButton (true);
 		dia.setText(QObject::tr("Exporting the %1 bookmarks will overwrite\nyour existing bookmarks file.").arg("KDE"));
 		dia.setCaption(QObject::tr("Warning: Overwriting %1 bookmarks").arg("KDE"));
-		dia.setShowAgainName("/vym/warnings/overwriteKDEBookmarks");
+		dia.setShowAgainName("/exports/KDE/overwriteKDEBookmarks");
 		if (dia.exec()==QDialog::Accepted)
 		{
 			me->exportXML(tmpDir.path());
@@ -180,11 +179,9 @@
 			p.setInputFile (tmpDir.path()+"/"+me->getMapName()+".xml");
 			p.setOutputFile (tmpDir.home().path()+"/.kde/share/apps/konqueror/bookmarks.xml");
 			p.setXSLFile (vymBaseDir.path()+"/styles/vym2kdebookmarks.xsl");
-			cout << "Trying to call vym2kde\n";
 			p.process();
 
 			QString ub=vymBaseDir.path()+"/scripts/update-bookmarks";
-			cout << "Trying to call "<<ub.ascii()<<endl;
 			QProcess *proc= new QProcess ;
 			proc->start( ub);
 			if (!proc->waitForStarted())
diff -r c2ffbc9b832d -r f867269ab8a1 mainwindow.cpp
--- a/mainwindow.cpp	Sat Feb 24 12:32:53 2007 +0000
+++ b/mainwindow.cpp	Mon Mar 05 23:22:51 2007 +0000
@@ -98,6 +98,13 @@
 	branchPropertyWindow = new BranchPropertyWindow();
 	branchPropertyWindow->move (20,20);
 
+	// Initialize script editor
+	scriptEditor = new SimpleScriptEditor();
+	scriptEditor->move (50,50);
+
+	connect( scriptEditor, SIGNAL( runScript ( QString ) ), 
+		this, SLOT( runScript( QString ) ) );
+	
 	// Initialize some settings, which are platform dependant
 	QString p,s;
 
@@ -187,6 +194,9 @@
 	settings.setValue( "/mapeditor/editmode/useFlagGroups",actionSettingsUseFlagGroups->isOn() );
 	settings.setValue( "/export/useHideExport",actionSettingsUseHideExport->isOn() );
 
+	//FIXME save branchPropWindow settings
+	//FIXME save scriptEditor settings
+
 	// call the destructors
 	delete (textEditor);
 	delete historyWindow;
@@ -3419,6 +3429,14 @@
 	actionViewToggleNoteEditor->setOn (false);
 }
 
+void Main::runScript (QString script)
+{
+	if (currentMapEditor())
+		currentMapEditor()->runScript (script);
+		
+	
+}
+
 void Main::showPropertyDialog()
 {
 	if(currentMapEditor())
@@ -3464,10 +3482,13 @@
 void Main::testCommand()
 {
 	if (!currentMapEditor()) return;
+	scriptEditor->show();
+	/*
 	bool ok;
 	QString com = QInputDialog::getText(
 			vymName, "Enter Command:", QLineEdit::Normal,"command", &ok, this );
 	if (ok) currentMapEditor()->parseAtom(com);
+	*/
 }
 
 void Main::helpDoc()
diff -r c2ffbc9b832d -r f867269ab8a1 mainwindow.h
--- a/mainwindow.h	Sat Feb 24 12:32:53 2007 +0000
+++ b/mainwindow.h	Mon Mar 05 23:22:51 2007 +0000
@@ -8,6 +8,7 @@
 #include "findwindow.h"
 #include "historywindow.h"
 #include "mapeditor.h"
+#include "simplescripteditor.h"
 #include "texteditor.h"
 #include "xml.h"
 
@@ -173,6 +174,7 @@
 	bool useFlagGroups();
 
 private slots:
+	void runScript(QString);
 	void showPropertyDialog();
 	void windowNextEditor();
 	void windowPreviousEditor();
@@ -201,6 +203,7 @@
 	HistoryWindow *historyWindow;
 
 	BranchPropertyWindow *branchPropertyWindow;
+	SimpleScriptEditor *scriptEditor;
 
 	QList <QAction*> actionListBranches;
 
diff -r c2ffbc9b832d -r f867269ab8a1 mapeditor.cpp
--- a/mapeditor.cpp	Sat Feb 24 12:32:53 2007 +0000
+++ b/mapeditor.cpp	Mon Mar 05 23:22:51 2007 +0000
@@ -8,7 +8,7 @@
 
 #include "version.h"
 
-#include "api.h"
+#include "parser.h"
 #include "editxlinkdialog.h"
 #include "exports.h"
 #include "extrainfodialog.h"
@@ -427,35 +427,34 @@
 void MapEditor::parseAtom(const QString &atom)
 {
 	BranchObj *selb=xelection.getBranch();
-	API api;
 	QString s,t;
 	int x,y;
 	bool b,ok;
 
 	// Split string s into command and parameters
-	api.parseInput (atom);
-	QString com=api.command();
+	parser.parseAtom (atom);
+	QString com=parser.command();
 	
 	// External commands
 	if (com=="addBranch")
 	{
 		if (xelection.isEmpty())
 		{
-			api.setError (Aborted,"Nothing selected");
+			parser.setError (Aborted,"Nothing selected");
 		} else if (! selb )
 		{				  
-			api.setError (Aborted,"Type of selection is not a branch");
+			parser.setError (Aborted,"Type of selection is not a branch");
 		} else 
 		{	
 			QList <int> pl;
 			pl << 0 <<1;
-			if (api.checkParamCount(pl))
+			if (parser.checkParamCount(pl))
 			{
-				if (api.paramCount()==0)
+				if (parser.paramCount()==0)
 					addNewBranchInt (-2);
 				else
 				{
-					y=api.parInt (ok,0);
+					y=parser.parInt (ok,0);
 					if (ok ) addNewBranchInt (y);
 				}
 			}
@@ -464,13 +463,13 @@
 	{
 		if (xelection.isEmpty())
 		{
-			api.setError (Aborted,"Nothing selected");
+			parser.setError (Aborted,"Nothing selected");
 		} else if (! selb )
 		{				  
-			api.setError (Aborted,"Type of selection is not a branch");
+			parser.setError (Aborted,"Type of selection is not a branch");
 		} else 
 		{	
-			if (api.paramCount()==0)
+			if (parser.paramCount()==0)
 			{
 				addNewBranchBefore ();
 			}	
@@ -479,31 +478,31 @@
 	{
 		if (xelection.isEmpty())
 		{
-			api.setError (Aborted,"Nothing selected");
+			parser.setError (Aborted,"Nothing selected");
 		} else if (! selb )
 		{				  
-			api.setError (Aborted,"Type of selection is not a branch");
-		} else if (api.checkParamCount(1))
+			parser.setError (Aborted,"Type of selection is not a branch");
+		} else if (parser.checkParamCount(1))
 		{
-			//s=api.parString (ok,0);	// selection
-			t=api.parString (ok,0);	// path to map
+			//s=parser.parString (ok,0);	// selection
+			t=parser.parString (ok,0);	// path to map
 			if (QDir::isRelativePath(t)) t=QDir::convertSeparators (tmpMapDir + "/"+t);
 			addMapReplaceInt(selb->getSelectString(),t);	
 		}
-	} else if (com==QString("addMapInsert"))
+	} else if (com==QString("addMparsernsert"))
 	{
 		if (xelection.isEmpty())
 		{
-			api.setError (Aborted,"Nothing selected");
+			parser.setError (Aborted,"Nothing selected");
 		} else if (! selb )
 		{				  
-			api.setError (Aborted,"Type of selection is not a branch");
+			parser.setError (Aborted,"Type of selection is not a branch");
 		} else 
 		{	
-			if (api.checkParamCount(2))
+			if (parser.checkParamCount(2))
 			{
-				t=api.parString (ok,0);	// path to map
-				y=api.parInt(ok,1);		// position
+				t=parser.parString (ok,0);	// path to map
+				y=parser.parInt(ok,1);		// position
 				if (QDir::isRelativePath(t)) t=QDir::convertSeparators (tmpMapDir + "/"+t);
 				addMapInsertInt(t,y);	
 			}
@@ -512,39 +511,39 @@
 	{
 		if (xelection.isEmpty())
 		{
-			api.setError (Aborted,"Nothing selected");
+			parser.setError (Aborted,"Nothing selected");
 		} else if (! selb )
 		{				  
-			api.setError (Aborted,"Type of selection is not a branch");
-		} else if (api.checkParamCount(1))
+			parser.setError (Aborted,"Type of selection is not a branch");
+		} else if (parser.checkParamCount(1))
 		{	
-			QColor c=api.parColor (ok,0);
+			QColor c=parser.parColor (ok,0);
 			if (ok) colorBranch (c);
 		}	
 	} else if (com=="colorSubtree")
 	{
 		if (xelection.isEmpty())
 		{
-			api.setError (Aborted,"Nothing selected");
+			parser.setError (Aborted,"Nothing selected");
 		} else if (! selb )
 		{				  
-			api.setError (Aborted,"Type of selection is not a branch");
-		} else if (api.checkParamCount(1))
+			parser.setError (Aborted,"Type of selection is not a branch");
+		} else if (parser.checkParamCount(1))
 		{	
-			QColor c=api.parColor (ok,0);
+			QColor c=parser.parColor (ok,0);
 			if (ok) colorSubtree (c);
 		}	
 	} else if (com=="cut")
 	{
 		if (xelection.isEmpty())
 		{
-			api.setError (Aborted,"Nothing selected");
+			parser.setError (Aborted,"Nothing selected");
 		} else if ( xelection.type()!=Branch  && 
 					xelection.type()!=MapCenter  &&
 					xelection.type()!=FloatImage )
 		{				  
-			api.setError (Aborted,"Type of selection is not a branch or floatimage");
-		} else if (api.checkParamCount(0))
+			parser.setError (Aborted,"Type of selection is not a branch or floatimage");
+		} else if (parser.checkParamCount(0))
 		{	
 			cut();
 		}	
@@ -552,11 +551,11 @@
 	{
 		if (xelection.isEmpty())
 		{
-			api.setError (Aborted,"Nothing selected");
+			parser.setError (Aborted,"Nothing selected");
 		} else if (! selb )
 		{
-			api.setError (Aborted,"Type of selection is not a branch");
-		} else if (api.checkParamCount(0))
+			parser.setError (Aborted,"Type of selection is not a branch");
+		} else if (parser.checkParamCount(0))
 		{	
 			deleteSelection();
 		}	
@@ -564,11 +563,11 @@
 	{
 		if (xelection.isEmpty())
 		{
-			api.setError (Aborted,"Nothing selected");
+			parser.setError (Aborted,"Nothing selected");
 		} else if (! selb )
 		{
-			api.setError (Aborted,"Type of selection is not a branch");
-		} else if (api.checkParamCount(0))
+			parser.setError (Aborted,"Type of selection is not a branch");
+		} else if (parser.checkParamCount(0))
 		{	
 			deleteKeepChilds();
 		}	
@@ -576,11 +575,11 @@
 	{
 		if (xelection.isEmpty())
 		{
-			api.setError (Aborted,"Nothing selected");
+			parser.setError (Aborted,"Nothing selected");
 		} else if (! selb)
 		{
-			api.setError (Aborted,"Type of selection is not a branch");
-		} else if (api.checkParamCount(0))
+			parser.setError (Aborted,"Type of selection is not a branch");
+		} else if (parser.checkParamCount(0))
 		{	
 			deleteChilds();
 		}	
@@ -588,32 +587,32 @@
 	{
 		if (xelection.isEmpty())
 		{
-			api.setError (Aborted,"Nothing selected");
+			parser.setError (Aborted,"Nothing selected");
 		} else if ( selb)
 		{
-			if (api.checkParamCount(4))
+			if (parser.checkParamCount(4))
 			{
 				// 0	selectstring of parent
 				// 1	num in parent (for branches)
 				// 2,3	x,y of mainbranch or mapcenter
-				s=api.parString(ok,0);
+				s=parser.parString(ok,0);
 				LinkableMapObj *dst=mapCenter->findObjBySelect (s);
 				if (dst)
 				{	
 					if (typeid(*dst) == typeid(BranchObj) ) 
 					{
 						// Get number in parent
-						x=api.parInt (ok,1);
+						x=parser.parInt (ok,1);
 						if (ok)
 							selb->linkTo ((BranchObj*)(dst),x);
 					} else if (typeid(*dst) == typeid(MapCenterObj) ) 
 					{
 						selb->linkTo ((BranchObj*)(dst),-1);
 						// Get coordinates of mainbranch
-						x=api.parInt (ok,2);
+						x=parser.parInt (ok,2);
 						if (ok)
 						{
-							y=api.parInt (ok,3);
+							y=parser.parInt (ok,3);
 							if (ok) selb->move (x,y);
 						}
 					}	
@@ -621,10 +620,10 @@
 			}	
 		} else if ( xelection.type() == FloatImage) 
 		{
-			if (api.checkParamCount(1))
+			if (parser.checkParamCount(1))
 			{
 				// 0	selectstring of parent
-				s=api.parString(ok,0);
+				s=parser.parString(ok,0);
 				LinkableMapObj *dst=mapCenter->findObjBySelect (s);
 				if (dst)
 				{	
@@ -632,19 +631,32 @@
 						typeid(*dst) == typeid(MapCenterObj)) 
 						linkTo (dst->getSelectString());
 				} else	
-					api.setError (Aborted,"Destination is not a branch");
+					parser.setError (Aborted,"Destination is not a branch");
 			}		
 		} else
-			api.setError (Aborted,"Type of selection is not a floatimage or branch");
+			parser.setError (Aborted,"Type of selection is not a floatimage or branch");
+	} else if (com=="loadImage")
+	{
+		if (xelection.isEmpty())
+		{
+			parser.setError (Aborted,"Nothing selected");
+		} else if (! selb )
+		{				  
+			parser.setError (Aborted,"Type of selection is not a branch");
+		} else if (parser.checkParamCount(1))
+		{
+			s=parser.parString(ok,0);
+			if (ok) loadFloatImageInt (s);
+		}	
 	} else if (com=="moveBranchUp")
 	{
 		if (xelection.isEmpty() )
 		{
-			api.setError (Aborted,"Nothing selected");
+			parser.setError (Aborted,"Nothing selected");
 		} else if (! selb )
 		{				  
-			api.setError (Aborted,"Type of selection is not a branch");
-		} else if (api.checkParamCount(0))
+			parser.setError (Aborted,"Type of selection is not a branch");
+		} else if (parser.checkParamCount(0))
 		{
 			moveBranchUp();
 		}	
@@ -652,11 +664,11 @@
 	{
 		if (xelection.isEmpty() )
 		{
-			api.setError (Aborted,"Nothing selected");
+			parser.setError (Aborted,"Nothing selected");
 		} else if (! selb )
 		{				  
-			api.setError (Aborted,"Type of selection is not a branch");
-		} else if (api.checkParamCount(0))
+			parser.setError (Aborted,"Type of selection is not a branch");
+		} else if (parser.checkParamCount(0))
 		{
 			moveBranchDown();
 		}	
@@ -664,18 +676,18 @@
 	{
 		if (xelection.isEmpty() )
 		{
-			api.setError (Aborted,"Nothing selected");
+			parser.setError (Aborted,"Nothing selected");
 		} else if ( xelection.type()!=Branch  && 
 					xelection.type()!=MapCenter  &&
 					xelection.type()!=FloatImage )
 		{				  
-			api.setError (Aborted,"Type of selection is not a branch or floatimage");
-		} else if (api.checkParamCount(2))
+			parser.setError (Aborted,"Type of selection is not a branch or floatimage");
+		} else if (parser.checkParamCount(2))
 		{	
-			x=api.parInt (ok,0);
+			x=parser.parInt (ok,0);
 			if (ok)
 			{
-				y=api.parInt (ok,1);
+				y=parser.parInt (ok,1);
 				if (ok) move (x,y);
 			}
 		}	
@@ -683,18 +695,18 @@
 	{
 		if (xelection.isEmpty() )
 		{
-			api.setError (Aborted,"Nothing selected");
+			parser.setError (Aborted,"Nothing selected");
 		} else if ( xelection.type()!=Branch  && 
 					xelection.type()!=MapCenter  &&
 					xelection.type()!=FloatImage )
 		{				  
-			api.setError (Aborted,"Type of selection is not a branch or floatimage");
-		} else if (api.checkParamCount(2))
+			parser.setError (Aborted,"Type of selection is not a branch or floatimage");
+		} else if (parser.checkParamCount(2))
 		{	
-			x=api.parInt (ok,0);
+			x=parser.parInt (ok,0);
 			if (ok)
 			{
-				y=api.parInt (ok,1);
+				y=parser.parInt (ok,1);
 				if (ok) moveRel (x,y);
 			}
 		}	
@@ -702,11 +714,11 @@
 	{
 		if (xelection.isEmpty() )
 		{
-			api.setError (Aborted,"Nothing selected");
+			parser.setError (Aborted,"Nothing selected");
 		} else if (! selb )
 		{				  
-			api.setError (Aborted,"Type of selection is not a branch");
-		} else if (api.checkParamCount(0))
+			parser.setError (Aborted,"Type of selection is not a branch");
+		} else if (parser.checkParamCount(0))
 		{	
 			paste();
 		}	
@@ -714,80 +726,96 @@
 	{
 		if (xelection.isEmpty() )
 		{
-			api.setError (Aborted,"Nothing selected");
+			parser.setError (Aborted,"Nothing selected");
 		} else if (! selb )
 		{				  
-			api.setError (Aborted,"Type of selection is not a branch");
-		} else if (api.checkParamCount(0))
+			parser.setError (Aborted,"Type of selection is not a branch");
+		} else if (parser.checkParamCount(0))
 		{	
 			if (!scrollBranch ())	
-				api.setError (Aborted,"Could not scroll branch");
+				parser.setError (Aborted,"Could not scroll branch");
 		}	
 	} else if (com=="select")
 	{
-		if (api.checkParamCount(1))
+		if (parser.checkParamCount(1))
 		{
-			s=api.parString(ok,0);
+			s=parser.parString(ok,0);
 			if (ok) select (s);
 		}	
+	} else if (com=="selectLastBranch")
+	{
+		if (xelection.isEmpty() )
+		{
+			parser.setError (Aborted,"Nothing selected");
+		} else if (! selb )
+		{				  
+			parser.setError (Aborted,"Type of selection is not a branch");
+		} else if (parser.checkParamCount(0))
+		{	
+			BranchObj *bo=selb->getLastBranch();
+			if (!bo)
+				parser.setError (Aborted,"Could not select last branch");
+			selectInt (bo);	
+				
+		}	
 	} else if (com=="setMapAuthor")
 	{
-		if (api.checkParamCount(1))
+		if (parser.checkParamCount(1))
 		{
-			s=api.parString(ok,0);
+			s=parser.parString(ok,0);
 			if (ok) setMapAuthor (s);
 		}	
 	} else if (com=="setMapComment")
 	{
-		if (api.checkParamCount(1))
+		if (parser.checkParamCount(1))
 		{
-			s=api.parString(ok,0);
+			s=parser.parString(ok,0);
 			if (ok) setMapComment(s);
 		}	
 	} else if (com=="setMapBackgroundColor")
 	{
 		if (xelection.isEmpty() )
 		{
-			api.setError (Aborted,"Nothing selected");
+			parser.setError (Aborted,"Nothing selected");
 		} else if (! xelection.getBranch() )
 		{				  
-			api.setError (Aborted,"Type of selection is not a branch");
-		} else if (api.checkParamCount(1))
+			parser.setError (Aborted,"Type of selection is not a branch");
+		} else if (parser.checkParamCount(1))
 		{
-			QColor c=api.parColor (ok,0);
+			QColor c=parser.parColor (ok,0);
 			if (ok) setMapBackgroundColor (c);
 		}	
 	} else if (com=="setMapDefLinkColor")
 	{
 		if (xelection.isEmpty() )
 		{
-			api.setError (Aborted,"Nothing selected");
+			parser.setError (Aborted,"Nothing selected");
 		} else if (! selb )
 		{				  
-			api.setError (Aborted,"Type of selection is not a branch");
-		} else if (api.checkParamCount(1))
+			parser.setError (Aborted,"Type of selection is not a branch");
+		} else if (parser.checkParamCount(1))
 		{
-			QColor c=api.parColor (ok,0);
+			QColor c=parser.parColor (ok,0);
 			if (ok) setMapDefLinkColor (c);
 		}	
 	} else if (com=="setMapLinkStyle")
 	{
-		if (api.checkParamCount(1))
+		if (parser.checkParamCount(1))
 		{
-			s=api.parString (ok,0);
+			s=parser.parString (ok,0);
 			if (ok) setMapLinkStyle(s);
 		}	
 	} else if (com=="setHeading")
 	{
 		if (xelection.isEmpty() )
 		{
-			api.setError (Aborted,"Nothing selected");
+			parser.setError (Aborted,"Nothing selected");
 		} else if (! selb )
 		{				  
-			api.setError (Aborted,"Type of selection is not a branch");
-		} else if (api.checkParamCount(1))
+			parser.setError (Aborted,"Type of selection is not a branch");
+		} else if (parser.checkParamCount(1))
 		{
-			s=api.parString (ok,0);
+			s=parser.parString (ok,0);
 			if (ok) 
 				setHeading (s);
 		}	
@@ -795,39 +823,39 @@
 	{
 		if (xelection.isEmpty() )
 		{
-			api.setError (Aborted,"Nothing selected");
+			parser.setError (Aborted,"Nothing selected");
 		} else if (! selb)
 		{				  
-			api.setError (Aborted,"Type of selection is not a branch or floatimage");
-		} else if (api.checkParamCount(1))
+			parser.setError (Aborted,"Type of selection is not a branch or floatimage");
+		} else if (parser.checkParamCount(1))
 		{
-			b=api.parBool(ok,0);
+			b=parser.parBool(ok,0);
 			if (ok) setHideExport (b);
 		}
 	} else if (com=="setURL")
 	{
 		if (xelection.isEmpty() )
 		{
-			api.setError (Aborted,"Nothing selected");
+			parser.setError (Aborted,"Nothing selected");
 		} else if (! selb )
 		{				  
-			api.setError (Aborted,"Type of selection is not a branch");
-		} else if (api.checkParamCount(1))
+			parser.setError (Aborted,"Type of selection is not a branch");
+		} else if (parser.checkParamCount(1))
 		{
-			s=api.parString (ok,0);
+			s=parser.parString (ok,0);
 			if (ok) setURLInt(s);
 		}	
 	} else if (com=="setVymLink")
 	{
 		if (xelection.isEmpty() )
 		{
-			api.setError (Aborted,"Nothing selected");
+			parser.setError (Aborted,"Nothing selected");
 		} else if (! selb )
 		{				  
-			api.setError (Aborted,"Type of selection is not a branch");
-		} else if (api.checkParamCount(1))
+			parser.setError (Aborted,"Type of selection is not a branch");
+		} else if (parser.checkParamCount(1))
 		{
-			s=api.parString (ok,0);
+			s=parser.parString (ok,0);
 			if (ok) setVymLinkInt(s);
 		}	
 	}
@@ -835,13 +863,13 @@
 	{
 		if (xelection.isEmpty() )
 		{
-			api.setError (Aborted,"Nothing selected");
+			parser.setError (Aborted,"Nothing selected");
 		} else if (! selb )
 		{				  
-			api.setError (Aborted,"Type of selection is not a branch");
-		} else if (api.checkParamCount(1))
+			parser.setError (Aborted,"Type of selection is not a branch");
+		} else if (parser.checkParamCount(1))
 		{
-			s=api.parString(ok,0);
+			s=parser.parString(ok,0);
 			if (ok) 
 			{
 				selb->activateStandardFlag(s);
@@ -852,26 +880,26 @@
 	{
 		if (xelection.isEmpty() )
 		{
-			api.setError (Aborted,"Nothing selected");
+			parser.setError (Aborted,"Nothing selected");
 		} else if (! selb )
 		{				  
-			api.setError (Aborted,"Type of selection is not a branch");
-		} else if (api.checkParamCount(0))
+			parser.setError (Aborted,"Type of selection is not a branch");
+		} else if (parser.checkParamCount(0))
 		{	
 			if (!unscrollBranch ())	
-				api.setError (Aborted,"Could not unscroll branch");
+				parser.setError (Aborted,"Could not unscroll branch");
 		}	
 	} else if (com=="unsetFlag")
 	{
 		if (xelection.isEmpty() )
 		{
-			api.setError (Aborted,"Nothing selected");
+			parser.setError (Aborted,"Nothing selected");
 		} else if (! selb )
 		{				  
-			api.setError (Aborted,"Type of selection is not a branch");
-		} else if (api.checkParamCount(1))
+			parser.setError (Aborted,"Type of selection is not a branch");
+		} else if (parser.checkParamCount(1))
 		{
-			s=api.parString(ok,0);
+			s=parser.parString(ok,0);
 			if (ok) 
 			{
 				selb->deactivateStandardFlag(s);
@@ -879,19 +907,43 @@
 			}	
 		}
 	} else
-		api.setError (Aborted,"Unknown command");
+		parser.setError (Aborted,"Unknown command");
 
 	// Any errors?
-	if (api.errorLevel()==NoError)
+	if (parser.errorLevel()==NoError)
+	{
 		setChanged();
+		mapCenter->reposition();
+	}	
 	else	
 	{
 		// TODO Error handling
 		qWarning("MapEditor::parseAtom: Error!");
-		qWarning(api.errorMessage());
+		qWarning(parser.errorMessage());
 	} 
 }
 
+void MapEditor::runScript (QString script)
+{
+	// TODO "atomize" script, currently each line holds one atom
+
+	QStringList list=script.split("\n");
+	QString l;
+	int pos;
+	for (int i=0; i<list.size(); i++)
+	{
+		l=list.at(i);
+
+		// Ignore comments
+		pos=l.indexOf ("#");
+		if (pos>=0) l.truncate (pos);
+
+		// Try to ignore empty lines
+		if (l.contains (QRegExp ("\\w")))
+			parseAtom (l);
+	}
+
+}
 
 bool MapEditor::isDefault()
 {
@@ -3017,6 +3069,21 @@
 	}	
 }
 
+FloatImageObj* MapEditor::loadFloatImageInt (QString fn)
+{
+	BranchObj *bo=xelection.getBranch();
+	if (bo)
+	{
+		FloatImageObj *fio;
+		bo->addFloatImage();
+		fio=bo->getLastFloatImage();
+		fio->load(fn);
+		mapCenter->reposition();
+		scene()->update();
+		return fio;
+	}
+	return NULL;
+}	
 
 void MapEditor::loadFloatImage ()
 {
@@ -3035,34 +3102,28 @@
 		fd->setDir (lastImageDir);
 		fd->show();
 
-		QString fn;
 		if ( fd->exec() == QDialog::Accepted )
 		{
 			// FIXME loadFIO in QT4 use:	lastImageDir=fd->directory();
 			lastImageDir=QDir (fd->dirPath());
-			QStringList flist = fd->selectedFiles();
-			QStringList::Iterator it = flist.begin();
+			QString s;
 			FloatImageObj *fio;
-			while( it != flist.end() ) 
+			for (int j=0; j<fd->selectedFiles().count(); j++)
 			{
-				fn = *it;
-				bo->addFloatImage();
-				fio=bo->getLastFloatImage();
-				fio->load(*it);
-				// FIXME loadFIO check if load of fio was successful
-				saveState(
-					(LinkableMapObj*)fio,
-					"delete ()",
-					bo, 
-					QString ("loadFloatImage (%1)").arg(*it),
-					QString("Add floatimage %1 to %2").arg(*it).arg(getName(bo))
-				);
-				bo->getLastFloatImage()->setOriginalFilename(fn);
-				++it;
+				s=fd->selectedFiles().at(j);
+				fio=loadFloatImageInt (s);
+				if (fio)
+					saveState(
+						(LinkableMapObj*)fio,
+						"delete ()",
+						bo, 
+						QString ("loadImage (%1)").arg(s ),
+						QString("Add image %1 to %2").arg(s).arg(getName(bo))
+					);
+				else
+					// FIXME loadFIO error handling
+					qWarning ("Failed to load "+s);
 			}
-
-			mapCenter->reposition();
-			scene()->update();
 		}
 		delete (p);
 		delete (fd);
@@ -3269,16 +3330,19 @@
 {
 	// This is the playground
 
+	
+/*
 	WarningDialog dia;
 	dia.showCancelButton (true);
 	dia.setText("This is a longer \nWarning");
 	dia.setCaption("Warning: Flux problem");
-	dia.setShowAgainName("/warnings/mapeditor");
+	dia.setShowAgainName("mapeditor/testDialog");
 	if (dia.exec()==QDialog::Accepted)
 		cout << "accepted!\n";
 	else	
 		cout << "canceled!\n";
 	return;
+*/
 
 /* TODO Hide hidden stuff temporary, maybe add this as regular function somewhere
 	if (hidemode==HideNone)
diff -r c2ffbc9b832d -r f867269ab8a1 mapeditor.h
--- a/mapeditor.h	Sat Feb 24 12:32:53 2007 +0000
+++ b/mapeditor.h	Mon Mar 05 23:22:51 2007 +0000
@@ -7,6 +7,7 @@
 #include "mapcenterobj.h"
 #include "file.h"
 #include "misc.h"
+#include "parser.h"
 #include "selection.h"
 #include "settings.h"
 
@@ -31,7 +32,8 @@
     void saveState(const QString &, const QString &, const QString &, const QString &, const QString &);
     void saveState(const SaveMode&, const QString &, const QString &, const QString &, const QString &, const QString &, LinkableMapObj *);
 public:	
-    void parseAtom(const QString &);	
+    void parseAtom (const QString &);	
+	void runScript (QString);
 private:
     void addFloatImageInt(const QPixmap &img);
 
@@ -162,6 +164,9 @@
 	bool unscrollBranch();
     void toggleScroll();
     void unscrollChilds();
+private:	
+	FloatImageObj* loadFloatImageInt (QString);
+public:	
 	void loadFloatImage ();
 	void saveFloatImage ();
 	void setFrame(const FrameType &);
@@ -229,6 +234,8 @@
     bool mapChanged;				// Flag if undo is possible
 	bool mapUnsaved;				// Flag if map should be saved
 
+	Parser parser;				// Parser stuff for scripting
+
 	bool printFrame;			// Print frame around map
 	bool printFooter;			// Print footer below map
 
diff -r c2ffbc9b832d -r f867269ab8a1 parser.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/parser.cpp	Mon Mar 05 23:22:51 2007 +0000
@@ -0,0 +1,234 @@
+#include "parser.h"
+
+#include <QRegExp>
+#include <iostream>
+
+using namespace std;
+
+Parser::Parser()
+{
+	initCommand();
+}
+
+void Parser::initCommand()
+{
+	com="";
+	paramList.clear();
+	resetError();
+}
+
+void Parser::parseAtom (const QString &s)
+{
+	initCommand();
+	input=s;
+	QRegExp re;
+	int pos;
+
+	// Get command
+	re.setPattern ("\\b(.*)(\\s|\\()");
+	re.setMinimal (true);
+	pos=re.search (s);
+	if (pos>=0)
+		com=re.cap(1);
+
+	// Get parameters
+	paramList.clear();
+	re.setPattern ("\\((.*)\\)");
+	pos=re.search (s);
+	//cout << "  s="<<s.ascii()<<endl;
+	//cout << "com="<<com.ascii()<<"  pos="<<pos<<endl<<endl;
+	if (pos>=0)
+	{
+		QString s=re.cap(1);
+		QString a;
+		bool inquote=false;
+		pos=0;
+		if (!s.isEmpty())
+		{
+			while (pos<s.length())
+			{
+				if (s.at(pos)=='\"') 
+				{
+					if (inquote)
+						inquote=false;
+					else	
+						inquote=true;
+				}
+
+				if (s.at(pos)==',' && !inquote)
+				{
+					a=s.left(pos);
+					paramList.append(a);
+					s=s.right(s.length()-pos-1);
+					pos=0;
+				} else
+					pos++;
+				
+			}
+			paramList.append (s);
+		}	
+	}	
+}
+
+QString Parser::command()
+{
+	return com;
+}
+
+QStringList Parser::parameters()
+{
+	return paramList;
+}
+
+int Parser::paramCount()
+{
+	return paramList.count();
+}
+
+
+QString Parser::errorMessage()
+{
+	QString l;
+	switch (errLevel)
+	{
+		case NoError: l="No Error";
+		case Warning: l="Warning";
+		case Aborted: l="Aborted";
+	}
+	return QString ("Error Level: %1\n    Command: %2\nDescription: %3")
+		.arg(l).arg(com).arg(errDescription);
+}
+
+QString Parser::errorDescription()
+{
+	return errDescription;
+}
+
+ErrorLevel Parser::errorLevel()
+{
+	return errLevel;
+}
+
+void Parser::setError(ErrorLevel level, const QString &description)
+{
+	errDescription=description;
+	errLevel=level;
+}
+
+void Parser::resetError ()
+{
+	errMessage="";
+	errDescription="";
+	errLevel=NoError;
+}
+
+
+bool Parser::checkParamCount (QList <int> plist)
+{
+	QStringList expList;
+	QString expected;
+	for (int i=0; i<plist.count();i++)
+	{
+		if (checkParamCount (plist[i])) 
+		{
+			resetError();
+			return true;
+		}
+		expList.append(QString().setNum(plist[i]));
+	}	
+	expected=expList.join(",");	
+	errDescription=QString("Wrong number of parameters: Expected %1, but found %2").arg(expected).arg(paramList.count());
+	return false;
+}
+
+bool Parser::checkParamCount (const int &expected)
+{
+	if (paramList.count()!=expected)
+	{
+		errLevel=Aborted;
+		errDescription=QString("Wrong number of parameters: Expected %1, but found %2").arg(expected).arg(paramList.count());
+		return false;
+	} 
+	return true;	
+}
+
+bool Parser::checkParamIsInt(const int &index)
+{
+	bool ok;
+	if (index > paramList.count())
+	{
+		errLevel=Aborted;
+		errDescription=QString("Parameter index %1 is outside of parameter list").arg(index);
+		return false;
+	} else
+	{
+		paramList[index].toInt (&ok, 10);
+		if (!ok)
+		{
+			errLevel=Aborted;
+			errDescription=QString("Parameter %1 is not an integer").arg(index);
+			return false;
+		} 
+	}	
+	return true;
+}
+
+int Parser::parInt (bool &ok,const uint &index)
+{
+	if (checkParamIsInt (index))
+		return paramList[index].toInt (&ok, 10);
+	ok=false;
+	return 0;
+}
+
+QString Parser::parString (bool &ok,const int &index)
+{
+	// return the string at index, this could be also stored in
+	// a variable later
+	QString r;
+	QRegExp re("\"(.*)\"");
+	int pos=re.search (paramList[index]);
+	if (pos>=0)
+		r=re.cap (1);
+	else	
+		r="";
+	ok=true;
+	return r;
+}
+
+bool Parser::parBool (bool &ok,const int &index)
+{
+	// return the bool at index, this could be also stored in
+	// a variable later
+	QString r;
+	ok=true;
+	QString p=paramList[index];
+	if (p=="true" || p=="1")
+		return true;
+	else if	(p=="false" || p=="0")
+		return false;
+	ok=false;
+	return ok;
+}
+
+QColor Parser::parColor(bool &ok,const int &index)
+{
+	// return the QColor at index
+	ok=true;
+	return QColor (paramList[index]);
+}
+
+void Parser::setScript(const QString &s)
+{
+	script=s;
+}	
+
+QString Parser::getScript()
+{
+	return script;
+}	
+
+void Parser::startScript()
+{
+}	
+
diff -r c2ffbc9b832d -r f867269ab8a1 parser.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/parser.h	Mon Mar 05 23:22:51 2007 +0000
@@ -0,0 +1,49 @@
+#ifndef PARSER_H
+#define PARSER_H
+
+#include <QColor>
+#include <QStringList>
+
+enum ErrorLevel {NoError,Warning,Aborted};
+
+class Parser
+{
+public:
+	Parser();
+	void parseAtom (const QString &input);
+	QString command();
+	QStringList parameters();
+	int paramCount();
+	QString errorMessage();
+	QString errorDescription();
+	ErrorLevel errorLevel();
+	void setError (ErrorLevel level,const QString &description);
+	void resetError();
+	bool checkParamCount (QList <int> plist);
+	bool checkParamCount (const int &index);
+	bool checkParamIsInt (const int &index);
+	int parInt (bool &,const uint &index);
+	QString parString(bool &ok,const int &index);
+	bool parBool (bool &ok, const int &index);
+	QColor parColor (bool &ok, const int &index);
+
+	void setScript (const QString &);
+	QString getScript();
+	void startScript();
+	bool next();
+
+
+private:
+	void initCommand();
+
+	QString input;
+	QString com;
+	QStringList paramList;
+	QString script;
+
+	QString errMessage;
+	QString errDescription;
+	ErrorLevel errLevel;
+};
+
+#endif
diff -r c2ffbc9b832d -r f867269ab8a1 simplescripteditor.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/simplescripteditor.cpp	Mon Mar 05 23:22:51 2007 +0000
@@ -0,0 +1,109 @@
+#include "simplescripteditor.h"
+
+
+#include <QFileDialog>
+#include <QMessageBox>
+#include <QTextStream>
+
+
+extern QString vymName;
+
+SimpleScriptEditor::SimpleScriptEditor (QWidget *parent):QDialog(parent)
+{
+	ui.setupUi (this);
+
+	connect ( ui.loadButton, SIGNAL (clicked() ), this, SLOT (loadScriptClicked() ));
+	connect ( ui.saveButton, SIGNAL (clicked() ), this, SLOT (saveScriptClicked() ));
+	connect ( ui.runButton,  SIGNAL (clicked() ), this, SLOT (runScriptClicked() ));
+}
+
+
+void SimpleScriptEditor::saveScript()
+{
+	QFile f( filename );
+	if ( !f.open( QIODevice::WriteOnly ) ) 
+	{
+		return;
+	}
+
+	QTextStream t( &f );
+	t << ui.editor->text();
+	f.close();
+}
+
+void SimpleScriptEditor::saveScriptClicked()
+{
+	QString fn = QFileDialog::getSaveFileName( 
+		this, 
+		QString (vymName + " - " +tr("Save script")),
+		QString (),
+		"VYM script (HTML) (*.vys);;All files (*)",
+		0,
+		QFileDialog::DontConfirmOverwrite);
+		
+    if ( !fn.isEmpty() ) 
+	{
+		QFile file (fn);
+		if (file.exists())
+		{
+			QMessageBox mb( vymName,
+				tr("The file %1\nexists already.\nDo you want to overwrite it?","dialog 'save as'").arg(fn),
+			QMessageBox::Warning,
+			QMessageBox::Yes | QMessageBox::Default,
+			QMessageBox::Cancel | QMessageBox::Escape,
+			Qt::NoButton );
+			mb.setButtonText( QMessageBox::Yes, tr("Overwrite") );
+			mb.setButtonText( QMessageBox::No, tr("Cancel"));
+			switch( mb.exec() ) 
+			{
+				case QMessageBox::Yes:
+					// save 
+					filename = fn;
+					saveScript();
+					return;
+				case QMessageBox::Cancel:
+					// do nothing
+					return;
+			}
+		} 
+		filename=fn;
+		saveScript();
+    }
+}
+
+void SimpleScriptEditor::loadScriptClicked()
+{
+	QFileDialog *fd=new QFileDialog( this);
+	QStringList types;
+	types<< "VYM scripts (*.vys)" <<
+	        "All         (*)" ;
+	fd->setFilters (types);
+	fd->setDirectory (QDir().current());
+	fd->setCaption (vymName + " - " + tr("Load script"));
+	fd->show();
+	QString fn;
+	if ( fd->exec() == QDialog::Accepted )
+		fn = fd->selectedFile();
+
+	if ( !fn.isEmpty() )
+	{
+		QFile f( fn );
+		if ( !f.open( QIODevice::ReadOnly ) )
+		{
+			QMessageBox::warning(0, 
+				tr("Error"),
+				tr("Couldn't open %1.\n").arg(fn));
+			return;
+		}	
+
+		QTextStream ts( &f );
+		ui.editor->setText( ts.read() );
+		f.close();
+	}
+
+}
+
+void SimpleScriptEditor::runScriptClicked()
+{
+	emit runScript (ui.editor->text() );
+}
diff -r c2ffbc9b832d -r f867269ab8a1 simplescripteditor.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/simplescripteditor.h	Mon Mar 05 23:22:51 2007 +0000
@@ -0,0 +1,28 @@
+#ifndef SIMPLESCRIPTEDITOR_H
+#define SIMPLESCRIPTEDITOR_H
+
+#include "ui_simplescripteditor.h"
+
+class SimpleScriptEditor:public QDialog
+{
+    Q_OBJECT
+
+public:
+    SimpleScriptEditor (QWidget* parent = 0);
+	void saveScript ();
+
+public slots:
+	void saveScriptClicked();
+	void loadScriptClicked();
+	void runScriptClicked();
+
+signals:
+	void runScript (QString);
+	
+private:
+    Ui::SimpleScriptEditor ui;
+	QString filename;
+};
+
+
+#endif 
diff -r c2ffbc9b832d -r f867269ab8a1 simplescripteditor.ui
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/simplescripteditor.ui	Mon Mar 05 23:22:51 2007 +0000
@@ -0,0 +1,97 @@
+<ui version="4.0" >
+ <class>SimpleScriptEditor</class>
+ <widget class="QDialog" name="SimpleScriptEditor" >
+  <property name="geometry" >
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>551</width>
+    <height>407</height>
+   </rect>
+  </property>
+  <property name="windowTitle" >
+   <string>Simple Script Editor</string>
+  </property>
+  <layout class="QHBoxLayout" >
+   <property name="margin" >
+    <number>9</number>
+   </property>
+   <property name="spacing" >
+    <number>6</number>
+   </property>
+   <item>
+    <widget class="QTextEdit" name="editor" />
+   </item>
+   <item>
+    <layout class="QVBoxLayout" >
+     <property name="margin" >
+      <number>0</number>
+     </property>
+     <property name="spacing" >
+      <number>6</number>
+     </property>
+     <item>
+      <widget class="QPushButton" name="runButton" >
+       <property name="text" >
+        <string>Run</string>
+       </property>
+      </widget>
+     </item>
+     <item>
+      <widget class="QPushButton" name="loadButton" >
+       <property name="text" >
+        <string>Load</string>
+       </property>
+      </widget>
+     </item>
+     <item>
+      <widget class="QPushButton" name="saveButton" >
+       <property name="text" >
+        <string>Save</string>
+       </property>
+      </widget>
+     </item>
+     <item>
+      <spacer>
+       <property name="orientation" >
+        <enum>Qt::Vertical</enum>
+       </property>
+       <property name="sizeHint" >
+        <size>
+         <width>20</width>
+         <height>40</height>
+        </size>
+       </property>
+      </spacer>
+     </item>
+     <item>
+      <widget class="QPushButton" name="closeButton" >
+       <property name="text" >
+        <string>Close</string>
+       </property>
+      </widget>
+     </item>
+    </layout>
+   </item>
+  </layout>
+ </widget>
+ <resources/>
+ <connections>
+  <connection>
+   <sender>closeButton</sender>
+   <signal>clicked()</signal>
+   <receiver>SimpleScriptEditor</receiver>
+   <slot>accept()</slot>
+   <hints>
+    <hint type="sourcelabel" >
+     <x>519</x>
+     <y>390</y>
+    </hint>
+    <hint type="destinationlabel" >
+     <x>-25</x>
+     <y>-275</y>
+    </hint>
+   </hints>
+  </connection>
+ </connections>
+</ui>
diff -r c2ffbc9b832d -r f867269ab8a1 tex/vym.changelog
--- a/tex/vym.changelog	Sat Feb 24 12:32:53 2007 +0000
+++ b/tex/vym.changelog	Mon Mar 05 23:22:51 2007 +0000
@@ -1,3 +1,9 @@
+-------------------------------------------------------------------
+Mon Mar  5 22:10:26 CET 2007 - uwe
+
+- Version: 1.8.69
+- Feature: Simple Editor for scripts
+
 -------------------------------------------------------------------
 Tue Feb 20 22:16:09 CET 2007 - uwe
 
diff -r c2ffbc9b832d -r f867269ab8a1 version.h
--- a/version.h	Sat Feb 24 12:32:53 2007 +0000
+++ b/version.h	Mon Mar 05 23:22:51 2007 +0000
@@ -4,8 +4,8 @@
 #include <QString>
 
 #define __VYM_NAME "VYM"
-#define __VYM_VERSION "1.8.68"
-#define __VYM_BUILD_DATE "February 20, 2007"
+#define __VYM_VERSION "1.8.69"
+#define __VYM_BUILD_DATE "March 05, 2007"
 
 
 bool checkVersion(const QString &);
diff -r c2ffbc9b832d -r f867269ab8a1 vym.pro
--- a/vym.pro	Sat Feb 24 12:32:53 2007 +0000
+++ b/vym.pro	Mon Mar 05 23:22:51 2007 +0000
@@ -1,7 +1,7 @@
 TEMPLATE	= app
 LANGUAGE	= C++
 
-CONFIG	+= qt warn_on release
+CONFIG	+= qt warn_on release debug
 CONFIG += x86 ppc
 ICON =icons/vym.icns
 
@@ -9,7 +9,6 @@
 
 HEADERS	+= \	
 	aboutdialog.h \
-	api.h \
 	branchobj.h \
 	branchpropwindow.h\
 	editxlinkdialog.h \
@@ -38,9 +37,11 @@
 	noteobj.h \
 	options.h \
 	ornamentedobj.h \
+	parser.h \
 	process.h \
 	showtextdialog.h\
 	selection.h \
+	simplescripteditor.h\
 	texteditor.h \
 	version.h \
 	xml.h \
@@ -50,7 +51,6 @@
 
 SOURCES	+= \
 	aboutdialog.cpp \
-	api.cpp \
 	branchobj.cpp \
 	branchpropwindow.cpp \
 	editxlinkdialog.cpp \
@@ -80,8 +80,10 @@
 	noteobj.cpp \
 	options.cpp \
 	ornamentedobj.cpp \
+	parser.cpp \
 	process.cpp \
 	showtextdialog.cpp \
+	simplescripteditor.cpp \
 	selection.cpp \
 	texteditor.cpp \
 	version.cpp \
@@ -96,6 +98,7 @@
 	extrainfodialog.ui \
 	editxlinkdialog.ui \
 	historywindow.ui \
+	simplescripteditor.ui \
 	showtextdialog.ui \
 	warningdialog.ui
 
diff -r c2ffbc9b832d -r f867269ab8a1 warningdialog.cpp
--- a/warningdialog.cpp	Sat Feb 24 12:32:53 2007 +0000
+++ b/warningdialog.cpp	Mon Mar 05 23:22:51 2007 +0000
@@ -1,6 +1,8 @@
 #include "warningdialog.h"
+#include "settings.h"
 
 extern QString iconPath;
+extern Settings settings;
 
 WarningDialog::WarningDialog(QWidget* parent):QDialog (parent)
 {
@@ -9,12 +11,30 @@
 	ui.okButton->setText(tr("Proceed"));
 	/*
 	ui.warningSign->setPixmap (QPixmap(iconPath + "icons/vym.png"));
+	*/
 	ui.showAgainBox->setText (tr("Show this message again"));
-	*/
 	useShowAgain=false;
 	ui.showAgainBox->hide();
 }
 
+int WarningDialog::exec()
+{
+	int result; 
+	if (settings.value ("/warningDialog/"+showAgainName+"/showAgain",true).toBool()  )
+	{
+		result=QDialog::exec();
+		if (result==QDialog::Accepted )
+		{
+			settings.setValue ("/warningDialog/"+showAgainName+"/value",result);
+			settings.setValue ("/warningDialog/"+showAgainName+"/showAgain",ui.showAgainBox->isChecked() );
+		}
+	} else
+	{
+		result=settings.value ("/warningDialog/"+showAgainName+"/value",0).toInt();
+	}
+	return result;
+}
+
 void WarningDialog::showCancelButton (bool b)
 {
 	if (b)
@@ -27,11 +47,9 @@
 
 void WarningDialog::setShowAgainName (const QString &s) //FIXME not implemented yet
 {
-/*
 	showAgainName=s;
 	useShowAgain=true;
 	ui.showAgainBox->show();
-*/	
 }
 
 void WarningDialog::setText (const QString &s)