]> git.lyx.org Git - lyx.git/blobdiff - src/Format.cpp
* InsetInclude{.cpp, h}:
[lyx.git] / src / Format.cpp
index ed3ae964c003ab5dc9aec5c78973704a3a2e2b55..5605dbb5569b662c2439ba131ce335bade4eefc0 100644 (file)
 #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;
 
@@ -241,6 +246,17 @@ void Formats::setViewer(string const & name, string const & command)
 }
 
 
+void Formats::setEditor(string const & name, string const & command)
+{
+       add(name);
+       FormatList::iterator it =
+               find_if(formatlist.begin(), formatlist.end(),
+                       FormatNamesEqual(name));
+       if (it != formatlist.end())
+               it->setEditor(command);
+}
+
+
 bool Formats::view(Buffer const & buffer, FileName const & filename,
                   string const & format_name) const
 {
@@ -322,6 +338,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())
@@ -334,6 +362,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))