+2003-12-10 Angus Leeming <leeming@lyx.org>
+
+ * insetert.C (string2params): clean-up using the new lyxlex interface.
+
+ * insetexternal.C: ensure that InsetExternalParams has a default
+ template, 'RasterImage'.
+
2003-12-10 Angus Leeming <leeming@lyx.org>
* insetnote.[Ch]: change the storage type of InsetNoteParams::type
#include "frontends/Alert.h"
#include "frontends/LyXView.h"
-#include "support/tostr.h"
+#include "support/std_sstream.h"
using lyx::pos_type;
-using lyx::support::split;
-using lyx::support::strToInt;
-
using std::endl;
using std::min;
-using std::string;
+
using std::auto_ptr;
+using std::istringstream;
using std::ostream;
+using std::ostringstream;
+using std::string;
void InsetERT::init()
void InsetERTMailer::string2params(string const & in,
- InsetCollapsable::InsetCollapsable::CollapseStatus & status)
+ InsetCollapsable::CollapseStatus & status)
{
status = InsetCollapsable::Collapsed;
- string name;
- string body = split(in, name, ' ');
+ istringstream data(in);
+ LyXLex lex(0,0);
+ lex.setStream(data);
- if (body.empty())
+ string name;
+ lex >> name;
+ if (name != name_) {
+ lyxerr << "InsetERTMailer::string2params(" << in << ")\n"
+ << "Missing identifier \"" << name_ << '"' << std::endl;
return;
+ }
- status = static_cast<InsetCollapsable::CollapseStatus>(strToInt(body));
+ int s;
+ lex >> s;
+ if (lex)
+ status = static_cast<InsetCollapsable::CollapseStatus>(s);
}
string const
InsetERTMailer::params2string(InsetCollapsable::CollapseStatus status)
{
- return name_ + ' ' + tostr(status);
+ ostringstream data;
+ data << name_ << ' ' << status;
+ return data.str();
}
external::DisplayType const defaultDisplayType = external::NoDisplay;
-unsigned int defaultLyxScale = 100;
+unsigned int const defaultLyxScale = 100;
+
+string const defaultTemplateName = "RasterImage";
} // namespace anon
InsetExternalParams::InsetExternalParams()
: display(defaultDisplayType),
- lyxscale(defaultLyxScale)
+ lyxscale(defaultLyxScale),
+ templatename_(defaultTemplateName)
{}
}
if (!found_end)
- lex.printError("ExternalInset::read: Missing \\end_inset.");
+ lex.printError("ExternalInsetParams::read: Missing \\end_inset.");
// This is a trick to make sure that the data are self-consistent.
settemplate(templatename_);