# HG changeset patch
# User insilmaril
# Date 1122490592 0
# Node ID 9079931da6c3cde9271b5bf944c283d62ae7e5d8
# Parent  88d2a027ef14f3f99bc4601b3e12bf3eb623af7c
1.7.2 fixed undo to select the right object before undoCommand

diff -r 88d2a027ef14 -r 9079931da6c3 api.cpp
--- a/api.cpp	Mon Jul 25 20:35:01 2005 +0000
+++ b/api.cpp	Wed Jul 27 18:56:32 2005 +0000
@@ -29,12 +29,39 @@
 		com=re.cap(1);
 
 	// Get parameters
+	paramList.clear();
 	re.setPattern ("\\((.*)\\)");
 	pos=re.search (s);
 	if (pos>=0)
 	{
 		QString s=re.cap(1);
-		paramList=QStringList::split(",",s);
+		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);
+		}	
 	}	
 }
 
@@ -70,9 +97,10 @@
 	if (paramList.count()!=expected)
 	{
 		errorString=QString("expected %1 parameters, but got %2").arg(expected).arg(paramList.count());
-		return false;
-	} 
-	return true;
+		noErr=false;
+	} else 
+		noErr=true;
+	return noErr;	
 }
 
 bool API::checkParamIsInt(const uint &index)
@@ -81,17 +109,18 @@
 	if (index > paramList.count())
 	{
 		errorString =QString("Parameter index %1 is outside of parameter list").arg(index);
-		return false;
+		noErr=false;
 	} else
 	{
 		paramList[index].toInt (&ok, 10);
 		if (!ok)
 		{
 			errorString=QString("Parameter %1 is not an integer").arg(index);
-			return false;
-		}
-		return true;
+			noErr=false;
+		} else
+			noErr=true;
 	}	
+	return noErr;
 }
 
 int API::parInt (bool &ok,const uint &index)