X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2FFormat.cpp;h=6bd5ecb8c8e13951f8ce83a94d2c9370914f37df;hb=4a75fe0310ac64a079edab0c07d8f8eebaf519c0;hp=6154d69689c39a2cd87be575c0723a2c389617df;hpb=9383f4c3c6f9cfab2d658701ba66e2b54cd68bea;p=lyx.git diff --git a/src/Format.cpp b/src/Format.cpp index 6154d69689..6bd5ecb8c8 100644 --- a/src/Format.cpp +++ b/src/Format.cpp @@ -25,23 +25,16 @@ #include "support/os.h" #include "support/Systemcall.h" +// FIXME: Q_WS_MACX is not available, it's in Qt +#ifdef USE_MACOSX_PACKAGING +#include "support/linkback/LinkBackProxy.h" +#endif + using namespace std; +using namespace lyx::support; namespace lyx { -using support::absolutePath; -using support::bformat; -using support::compare_ascii_no_case; -using support::contains; -using support::FileName; -using support::libScriptSearch; -using support::makeDisplayPath; -using support::onlyPath; -using support::quoteName; -using support::subst; -using support::Systemcall; -using support::token; - namespace Alert = frontend::Alert; namespace os = support::os; @@ -52,7 +45,7 @@ string const token_path_format("$$p"); string const token_socket_format("$$a"); -class FormatNamesEqual : public std::unary_function { +class FormatNamesEqual : public unary_function { public: FormatNamesEqual(string const & name) : name_(name) {} @@ -65,7 +58,7 @@ private: }; -class FormatExtensionsEqual : public std::unary_function { +class FormatExtensionsEqual : public unary_function { public: FormatExtensionsEqual(string const & extension) : extension_(extension) {} @@ -141,7 +134,7 @@ string Formats::getFormatFromFile(FileName const & filename) const return format; // try to find a format from the file extension. - string const ext = support::getExtension(filename.absFilename()); + string const ext = getExtension(filename.absFilename()); if (!ext.empty()) { // this is ambigous if two formats have the same extension, // but better than nothing @@ -291,13 +284,14 @@ bool Formats::view(Buffer const & buffer, FileName const & filename, if (format_name == "dvi" && !lyxrc.view_dvi_paper_option.empty()) { - command += ' ' + lyxrc.view_dvi_paper_option; - string paper_size = buffer.params().paperSizeName(); - if (paper_size == "letter") - paper_size = "us"; - command += ' ' + paper_size; - if (buffer.params().orientation == ORIENTATION_LANDSCAPE) - command += 'r'; + string paper_size = buffer.params().paperSizeName(BufferParams::XDVI); + if (!paper_size.empty()) { + command += ' ' + lyxrc.view_dvi_paper_option; + command += ' ' + paper_size; + if (buffer.params().orientation == ORIENTATION_LANDSCAPE && + buffer.params().papersize != PAPER_CUSTOM) + command += 'r'; + } } if (!contains(command, token_from_format)) @@ -333,6 +327,18 @@ bool Formats::edit(Buffer const & buffer, FileName const & filename, return false; } + // LinkBack files look like PDF, but have the .linkback extension + string const ext = getExtension(filename.absFilename()); + if (format_name == "pdf" && ext == "linkback") { +#ifdef USE_MACOSX_PACKAGING + return editLinkBackFile(filename.absFilename().c_str()); +#else + Alert::error(_("Cannot edit file"), + _("LinkBack files can only be edited on Apple Mac OSX.")); + return false; +#endif // USE_MACOSX_PACKAGING + } + Format const * format = getFormat(format_name); if (format && format->editor().empty() && format->isChildFormat()) @@ -345,6 +351,7 @@ bool Formats::edit(Buffer const & buffer, FileName const & filename, prettyName(format_name))); return false; } + // editor is 'auto' if (format->editor() == "auto") { if (os::autoOpenFile(filename.absFilename(), os::EDIT))