bool Format::formatSorter(Format const * lhs, Format const * rhs)
{
- return compare_locale(_(lhs->prettyname()), _(rhs->prettyname())) < 0;
+ return compare_locale(translateIfPossible(lhs->prettyname()),
+ translateIfPossible(rhs->prettyname())) < 0;
}
bool operator<(Format const & a, Format const & b)
{
- return compare_locale(_(a.prettyname()), _(b.prettyname())) < 0;
+ return compare_locale(translateIfPossible(a.prettyname()),
+ translateIfPossible(b.prettyname())) < 0;
}
-Format::Format(string const & n, string const & e, string const & p,
+Format::Format(string const & n, string const & e, docstring const & p,
string const & s, string const & v, string const & ed,
string const & m, int flags)
: name_(n), prettyname_(p), shortcut_(s), viewer_(v),
map<string, ZippedInfo>::iterator it = zipped_.find(fname);
if (it != zipped_.end() && it->second.timestamp == timestamp)
return it->second.zipped;
+ // FIXME perf: This very expensive function is called on startup on each
+ // file whic is going to be parsed, and also on svgz icons. Maybe there is a
+ // quicker way to check whether a file is zipped? I.e. for icons we
+ // probably just need to check the extension (svgz vs svg).
string const & format = getFormatFromFile(filename);
bool zipped = (format == "gzip" || format == "zip");
zipped_.insert(make_pair(fname, ZippedInfo(zipped, timestamp)));
void Formats::add(string const & name)
{
if (!getFormat(name))
- add(name, name, name, string(), string(), string(),
+ add(name, name, from_utf8(name), string(), string(), string(),
string(), Format::document);
}
void Formats::add(string const & name, string const & extensions,
- string const & prettyname, string const & shortcut,
+ docstring const & prettyname, string const & shortcut,
string const & viewer, string const & editor,
string const & mime, int flags)
{
{
Format const * format = getFormat(name);
if (format)
- return from_utf8(format->prettyname());
+ return format->prettyname();
else
return from_utf8(name);
}
f.addPair(OutputParams::XML, "docbook-xml");
f.addPair(OutputParams::HTML, "xhtml");
f.addPair(OutputParams::TEXT, "text");
+ f.addPair(OutputParams::LYX, "lyx");
return f;
}