mirror of
https://git.lyx.org/repos/lyx.git
synced 2025-01-11 03:03:06 +00:00
Fix dialog interaction with InsetMathRef (leftover from changed
InsetCommandParams) * src/mathed/InsetMathCommand.[Ch] (CommandInset::createDialogStr): Move to InsetMathRef, since it is no longer generic. * src/mathed/MathFactory.C (createInsetMath_fromDialogStr): Use InsetCommandMailer instead of manual parsing. This ensures that the syntax is correct. * src/mathed/InsetMathRef.[Ch] (InsetMathRef::createDialogStr): Moved here from InsetMathCommand, but use InsetCommandMailer. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@17738 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
b59c6f48a5
commit
ea1a4a886c
@ -79,15 +79,4 @@ docstring const CommandInset::screenLabel() const
|
||||
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
|
||||
|
@ -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:
|
||||
|
@ -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, odocstream & os,
|
||||
}
|
||||
|
||||
|
||||
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: "))},
|
||||
|
@ -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 {
|
||||
///
|
||||
|
@ -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 & s)
|
||||
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;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user