This patch works along the same lines of Richards fix for the citation 
stuff. This should have been done with the InsetCommandParams changhes, 
but I was not aware that there was other code fiddling mailer strings. 
This is tested and goes in now.


Georg
Index: src/mathed/InsetMathCommand.C
===================================================================
--- src/mathed/InsetMathCommand.C	(Revision 17737)
+++ src/mathed/InsetMathCommand.C	(Arbeitskopie)
@@ -79,15 +79,4 @@ docstring const CommandInset::screenLabe
 	return name_;
 }
 
-
-string const CommandInset::createDialogStr(string const & name) const
-{
-	odocstringstream os;
-	os << from_ascii(name + " LatexCommand ");
-	WriteStream ws(os);
-	write(ws);
-	return to_utf8(os.str()) + "\n\\end_inset\n\n";
-}
-
-
 } // namespace lyx
Index: src/mathed/InsetMathCommand.h
===================================================================
--- src/mathed/InsetMathCommand.h	(Revision 17737)
+++ src/mathed/InsetMathCommand.h	(Arbeitskopie)
@@ -38,8 +38,6 @@ public:
 	// void infoize(odocstream & os) const;
 	///
 	virtual docstring const screenLabel() const;
-	/// generate something that will be understood by the Dialogs.
-	std::string const createDialogStr(std::string const & name) const;
 	///
 	docstring const & commandname() const { return name_; }
 private:
Index: src/mathed/MathFactory.C
===================================================================
--- src/mathed/MathFactory.C	(Revision 17737)
+++ src/mathed/MathFactory.C	(Arbeitskopie)
@@ -56,6 +56,8 @@
 
 #include "debug.h"
 
+#include "insets/insetcommand.h"
+
 #include "support/filetools.h" // LibFileSearch
 #include "support/lstrings.h"
 
@@ -405,20 +407,17 @@ MathAtom createInsetMath(docstring const
 bool createInsetMath_fromDialogStr(docstring const & str, MathArray & ar)
 {
 	// An example str:
-	// "ref LatexCommand \\ref{sec:Title}\n\\end_inset\n\n";
+	// "ref LatexCommand ref\nreference \"sec:Title\"\n\\end_inset\n\n";
 	docstring name;
 	docstring body = split(str, name, ' ');
 
 	if (name != "ref" )
 		return false;
 
-	// body comes with a head "LatexCommand " and a
-	// tail "\nend_inset\n\n". Strip them off.
-	docstring trimmed;
-	body = split(body, trimmed, ' ');
-	split(body, trimmed, '\n');
-
-	mathed_parse_cell(ar, trimmed);
+	InsetCommandParams icp("ref");
+	// FIXME UNICODE
+	InsetCommandMailer::string2params("ref", to_utf8(str), icp);
+	mathed_parse_cell(ar, icp.getCommand());
 	if (ar.size() != 1)
 		return false;
 
Index: src/mathed/InsetMathRef.C
===================================================================
--- src/mathed/InsetMathRef.C	(Revision 17737)
+++ src/mathed/InsetMathRef.C	(Arbeitskopie)
@@ -26,6 +26,8 @@
 #include "outputparams.h"
 #include "sgml.h"
 
+#include "insets/insetcommand.h"
+
 
 namespace lyx {
 
@@ -171,6 +173,16 @@ int RefInset::docbook(Buffer const & buf
 }
 
 
+string const RefInset::createDialogStr(string const & name) const
+{
+	InsetCommandParams icp(to_ascii(commandname()));
+	icp["reference"] = asString(cell(0));
+	if (!cell(1).empty())
+		icp["name"] = asString(cell(1));
+	return InsetCommandMailer::params2string(name, icp);
+}
+
+
 RefInset::ref_type_info RefInset::types[] = {
 	{ from_ascii("ref"),       from_ascii(N_("Standard")),              from_ascii(N_("Ref: "))},
 	{ from_ascii("eqref"),     from_ascii(N_("Equation")),              from_ascii(N_("EqRef: "))},
Index: src/mathed/InsetMathRef.h
===================================================================
--- src/mathed/InsetMathRef.h	(Revision 17737)
+++ src/mathed/InsetMathRef.h	(Arbeitskopie)
@@ -39,6 +39,8 @@ public:
 
 	/// docbook output
 	int docbook(Buffer const & buf, odocstream & os, OutputParams const &) const;
+	/// generate something that will be understood by the Dialogs.
+	std::string const createDialogStr(std::string const & name) const;
 
 	struct ref_type_info {
 		///

Reply via email to