]> git.lyx.org Git - lyx.git/blobdiff - src/LyXSendto.C
citation patch from Angus
[lyx.git] / src / LyXSendto.C
index 80baa6b0319b45639b4db8b6fd927443ea285e12..1c007a81a3aad4c45e417817b2e3511bdcf56068 100644 (file)
@@ -11,7 +11,9 @@
 #include "lyx_gui_misc.h"
 #include "support/syscall.h"
 #include "gettext.h"
-#include "lyx_cb.h"
+//#include "lyx_cb.h"
+#include "bufferview_funcs.h"
+#include "exporter.h"
 
 extern FD_form_sendto * fd_form_sendto;
 extern BufferView * current_view;
@@ -23,7 +25,8 @@ extern bool CreatePostscript(Buffer * buffer, bool wait);
 
 void MenuSendto()
 {
-    static int ow = -1, oh;
+    static int ow = -1;
+    static int oh;
 
     // do this only if the command is empty
     if (!fl_get_input(fd_form_sendto->input_cmd) &&
@@ -54,16 +57,18 @@ void SendtoApplyCB(FL_OBJECT *, long)
     if (command.empty())
         return;
     Buffer * buffer = current_view->buffer();
+#ifndef NEW_EXPORT
     if (fl_get_button(fd_form_sendto->radio_ftype_dvi) ||
         fl_get_button(fd_form_sendto->radio_ftype_ps)) {
-        ProhibitInput();
+        ProhibitInput(current_view);
         // Generate dvi file and check if there are errors in the .lyx file
         if (MakeLaTeXOutput(buffer) > 0) {
-            AllowInput();
+            AllowInput(current_view);
             return;
         }
-        AllowInput();
+        AllowInput(current_view);
     }
+#endif
     string ftypeext;
     if (fl_get_button(fd_form_sendto->radio_ftype_lyx))
         ftypeext = ".lyx";
@@ -74,13 +79,20 @@ void SendtoApplyCB(FL_OBJECT *, long)
     else if (fl_get_button(fd_form_sendto->radio_ftype_ascii))
         ftypeext = ".txt";
     else {
+#ifdef NEW_EXPORT
+       ftypeext = ".ps";
+       if (!Exporter::Export(buffer, "ps", true))
+               return;
+#else
         ftypeext = ".ps_tmp";
         if (!CreatePostscript(buffer, true)) {
            return;
        }
+#endif
     }
 
-    string fname = ChangeExtension(buffer->getLatexName(), ftypeext, true);
+    string fname = OnlyFilename(ChangeExtension(buffer->getLatexName(),
+                                               ftypeext));
     if (!contains(command, "$$FName"))
         command = "( " + command + " ) <$$FName";
     command = subst(command, "$$FName", fname);