]> git.lyx.org Git - lyx.git/blobdiff - src/LyXSendto.C
small changes to ButtonController usage
[lyx.git] / src / LyXSendto.C
index c5134608fce29fa3e3c793e638fcec30a06311fb..8deb0ad0367217a77ecc67753935027891f97901 100644 (file)
@@ -11,7 +11,8 @@
 #include "lyx_gui_misc.h"
 #include "support/syscall.h"
 #include "gettext.h"
-#include "lyx_cb.h"
+//#include "lyx_cb.h"
+#include "bufferview_funcs.h"
 
 extern FD_form_sendto * fd_form_sendto;
 extern BufferView * current_view;
@@ -23,13 +24,14 @@ 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) &&
-        !lyxrc->custom_export_command.empty())
+        !lyxrc.custom_export_command.empty())
         fl_set_input(fd_form_sendto->input_cmd,
-                     lyxrc->custom_export_command.c_str());
+                     lyxrc.custom_export_command.c_str());
     if (fd_form_sendto->form_sendto->visible) {
         fl_raise_form(fd_form_sendto->form_sendto);
     } else {  
@@ -44,6 +46,7 @@ void MenuSendto()
     }
 }
 
+
 void SendtoApplyCB(FL_OBJECT *, long)
 {
     if (!current_view->available())
@@ -55,13 +58,13 @@ void SendtoApplyCB(FL_OBJECT *, long)
     Buffer * buffer = current_view->buffer();
     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);
     }
     string ftypeext;
     if (fl_get_button(fd_form_sendto->radio_ftype_lyx))
@@ -79,14 +82,15 @@ void SendtoApplyCB(FL_OBJECT *, long)
        }
     }
 
-    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);
     command += " &"; // execute in background
     // push directorypath, if necessary 
     string path = OnlyPath(buffer->fileName());
-    if (lyxrc->use_tempdir || (IsDirWriteable(path) < 1)){
+    if (lyxrc.use_tempdir || (IsDirWriteable(path) < 1)){
         path = buffer->tmppath;
     }
     Path p(path);
@@ -99,16 +103,18 @@ void SendtoApplyCB(FL_OBJECT *, long)
         buffer->makeLaTeXFile(fname, path, false);
     // create the .txt file in tmp_dir if this filetype is requested
     if (fl_get_button(fd_form_sendto->radio_ftype_ascii))
-        buffer->writeFileAscii(fname, lyxrc->ascii_linelen);
+        buffer->writeFileAscii(fname, lyxrc.ascii_linelen);
     Systemcalls one(Systemcalls::System, command);    
 }
 
+
 void SendtoCancelCB(FL_OBJECT *, long)
 {
     fl_hide_form(fd_form_sendto->form_sendto);
 }
 
-void SendtoOKCB(FL_OBJECT *ob, long data)
+
+void SendtoOKCB(FL_OBJECT * ob, long data)
 {
     SendtoCancelCB(ob, data);
     SendtoApplyCB(ob, data);