-bool Formats::View(Buffer const * buffer, string const & filename,
- string const & format_name) const
-{
- if (filename.empty())
- return false;
-
- Format const * format = GetFormat(format_name);
- if (format && format->viewer().empty() &&
- format->IsChildFormat())
- format = GetFormat(format->ParentFormat());
- if (!format || format->viewer().empty()) {
- WriteAlert(_("Can not view file"),
- _("No information for viewing ")
- + PrettyName(format_name));
- return false;
- }
-
- string command = format->viewer();
-
- if (format_name == "dvi" &&
- !lyxrc.view_dvi_paper_option.empty()) {
- command += " " + lyxrc.view_dvi_paper_option;
- string paper_size = converters.papersize(buffer);
- if (paper_size == "letter")
- paper_size = "us";
- command += " " + paper_size;
- if (buffer->params.orientation
- == BufferParams::ORIENTATION_LANDSCAPE)
- command += 'r';
- }
-
- command += " " + QuoteName(OnlyFilename((filename)));
-
- lyxerr[Debug::FILES] << "Executing command: " << command << endl;
- ShowMessage(buffer, _("Executing command:"), command);
-
- Path p(OnlyPath(filename));
- Systemcalls one;
- int const res = one.startscript(Systemcalls::SystemDontWait, command);
-
- if (res) {
- WriteAlert(_("Can not view file"),
- _("Error while executing"),
- command.substr(0, 50));
- return false;
+class ConverterEqual : public std::binary_function<string, string, bool> {
+public:
+ ConverterEqual(string const & from, string const & to)
+ : from_(from), to_(to) {}
+ bool operator()(Converter const & c) const {
+ return c.from == from_ && c.to == to_;