X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2FLyXSendto.C;h=2c95a3089b9a8782e0995ed59699723d46bc9042;hb=a858be7332e331e0244e4dba7b0931b6072ffd3d;hp=6c9058aee07bb5b23e83b81c8a2a58c6e3a3903b;hpb=27de1486ca34aaad446adb798d71a77d6f6304da;p=lyx.git diff --git a/src/LyXSendto.C b/src/LyXSendto.C index 6c9058aee0..2c95a3089b 100644 --- a/src/LyXSendto.C +++ b/src/LyXSendto.C @@ -5,21 +5,14 @@ #include "lyx_main.h" #include "lyxrc.h" #include "LString.h" -#include "filetools.h" -#include "pathstack.h" +#include "support/filetools.h" +#include "support/path.h" #include "buffer.h" #include "lyx_gui_misc.h" -#include "syscall.h" +#include "support/syscall.h" #include "gettext.h" #include "lyx_cb.h" -// $Id: LyXSendto.C,v 1.1 1999/09/27 18:44:36 larsbj Exp $ - -#if !defined(lint) && !defined(WITH_WARNINGS) -static char vcid[] = "$Id: LyXSendto.C,v 1.1 1999/09/27 18:44:36 larsbj Exp $"; -#endif /* lint */ - -/* Prototypes */ extern FD_form_sendto *fd_form_sendto; extern BufferView *current_view; extern int MakeDVIOutput(Buffer *buffer); @@ -30,6 +23,8 @@ extern bool MenuRunDvips(Buffer *buffer, bool wait); void MenuSendto() { + static int ow = -1, oh; + // do this only if the command is empty if (!fl_get_input(fd_form_sendto->input_cmd) && !lyxrc->custom_export_command.empty()) @@ -41,6 +36,11 @@ void MenuSendto() fl_show_form(fd_form_sendto->form_sendto, FL_PLACE_MOUSE | FL_FREE_SIZE, FL_FULLBORDER, _("Send Document to Command")); + if (ow < 0) { + ow = fd_form_sendto->form_sendto->w; + oh = fd_form_sendto->form_sendto->h; + } + fl_set_form_minsize(fd_form_sendto->form_sendto, ow, oh); } } @@ -49,7 +49,7 @@ void SendtoApplyCB(FL_OBJECT *, long) if (!current_view->available()) return; - LString command = fl_get_input(fd_form_sendto->input_cmd); + string command = fl_get_input(fd_form_sendto->input_cmd); if (command.empty()) return; Buffer *buffer = current_view->currentBuffer(); @@ -63,7 +63,7 @@ void SendtoApplyCB(FL_OBJECT *, long) } AllowInput(); } - LString ftypeext; + string ftypeext; if (fl_get_button(fd_form_sendto->radio_ftype_lyx)) ftypeext = ".lyx"; else if (fl_get_button(fd_form_sendto->radio_ftype_latex)) @@ -78,18 +78,18 @@ void SendtoApplyCB(FL_OBJECT *, long) return; } } - LString fname = SpaceLess(ChangeExtension(buffer->getFileName(), + string fname = SpaceLess(ChangeExtension(buffer->getFileName(), ftypeext, true)); - if (!command.contains("$$FName")) + if (!contains(command, "$$FName")) command = "( " + command + " ) <$$FName"; - command.subst("$$FName",fname); + subst(command, "$$FName",fname); command += " &"; // execute in background // push directorypath, if necessary - LString path = OnlyPath(buffer->getFileName()); + string path = OnlyPath(buffer->getFileName()); if (lyxrc->use_tempdir || (IsDirWriteable(path) < 1)){ path = buffer->tmppath; } - PathPush(path); + Path p(path); // save the .lyx file in tmp_dir if this filetype is requested if (fl_get_button(fd_form_sendto->radio_ftype_lyx)) buffer->writeFile(fname,true); @@ -101,7 +101,6 @@ void SendtoApplyCB(FL_OBJECT *, long) if (fl_get_button(fd_form_sendto->radio_ftype_ascii)) buffer->writeFileAscii(fname, lyxrc->ascii_linelen); Systemcalls one(Systemcalls::System, command); - PathPop(); } void SendtoCancelCB(FL_OBJECT *, long)