+2004-03-28 Angus Leeming <leeming@lyx.org>
+
+ * lfuns.h:
+ * LyXAction.C (init): new LFUN_PRINT.
+
+ * lyxfunc.C (getStatus, dispatch): handle LFUN_PRINT.
+
2004-03-27 Angus Leeming <leeming@lyx.org>
* lfuns.h:
- * LyXAction.C (init): new LFUN_EXPORT_CUSTOM
+ * LyXAction.C (init): new LFUN_EXPORT_CUSTOM.
* lyxfunc.C (getStatus, dispatch): handle LFUN_EXPORT_CUSTOM.
{ LFUN_ENDBUFSEL, "buffer-end-select", ReadOnly },
{ LFUN_EXPORT, "buffer-export", ReadOnly },
{ LFUN_EXPORT_CUSTOM, "buffer-export-custom", ReadOnly },
+ { LFUN_PRINT, "buffer-print", ReadOnly },
{ LFUN_IMPORT, "buffer-import", NoBuffer },
{ LFUN_MENUNEW, "buffer-new", NoBuffer },
{ LFUN_MENUNEWTMPLT,"buffer-new-template", NoBuffer },
+2004-03-28 Angus Leeming <leeming@lyx.org>
+
+ * Dialogs.h (showPrint): removed.
+
+ * guiapi.[Ch] (gui_ShowPrint): removed.
+
2004-03-27 Angus Leeming <leeming@lyx.org>
* Dialogs.h (showSendto): removed.
void showPreamble();
///
void showPreferences();
- ///
- void showPrint();
/// bring up the spellchecker
void showSpellchecker();
//@}
+2004-03-28 Angus Leeming <leeming@lyx.org>
+
+ * ControlPrint.[Ch]: converted to the dialog-based scheme.
+
2004-03-27 Angus Leeming <leeming@lyx.org>
* ControlSendto.[Ch]: converted to the dialog-based scheme.
#include "ControlPrint.h"
-#include "ViewBase.h"
#include "ButtonController.h"
+#include "helper_funcs.h"
#include "buffer.h"
#include "bufferparams.h"
+#include "funcrequest.h"
#include "gettext.h"
-#include "helper_funcs.h"
#include "PrinterParams.h"
-#include "exporter.h"
-
-#include "frontends/Alert.h"
#include "support/tostr.h"
#include "support/filetools.h"
#include "support/globbing.h"
-#include "support/path.h"
-#include "support/systemcall.h"
-#include "debug.h"
-
-using lyx::support::bformat;
using lyx::support::ChangeExtension;
using lyx::support::FileFilterList;
-using lyx::support::IsDirWriteable;
-using lyx::support::MakeAbsPath;
-using lyx::support::MakeDisplayPath;
-using lyx::support::Path;
-using lyx::support::QuoteName;
-using lyx::support::Systemcall;
-
-using std::endl;
-using std::string;
+using std::string;
-ControlPrint::ControlPrint(LyXView & lv, Dialogs & d)
- : ControlDialogBD(lv, d),
+ControlPrint::ControlPrint(Dialog & parent)
+ : Dialog::Controller(parent),
params_(0)
{}
-PrinterParams & ControlPrint::params() const
-{
- BOOST_ASSERT(params_);
- return *params_;
-}
-
-
-void ControlPrint::setParams()
+bool ControlPrint::initialiseParams(std::string const &)
{
- if (params_) delete params_;
-
/// get global printer parameters
- string const name = ChangeExtension(buffer()->fileName(),
+ string const name = ChangeExtension(kernel().buffer().fileName(),
lyxrc.print_file_extension);
- params_ = new PrinterParams (PrinterParams::PRINTER,
- lyxrc.printer, name);
+ params_.reset(new PrinterParams (PrinterParams::PRINTER,
+ lyxrc.printer, name));
- bc().valid(); // so that the user can press Ok
+ dialog().bc().valid(); // so that the user can press Ok
+ return true;
}
void ControlPrint::clearParams()
{
- if (params_) {
- delete params_;
- params_ = 0;
- }
+ params_.reset();
}
-string const ControlPrint::browse(string const & in_name) const
+PrinterParams & ControlPrint::params() const
{
- return browseRelFile(in_name, buffer().filePath(),
- _("Print to file"),
- FileFilterList("PostScript files (*.ps)"),
- true);
+ BOOST_ASSERT(params_.get());
+ return *params_;
}
-namespace {
-
-void showPrintError(string const & name)
+string const ControlPrint::browse(string const & in_name) const
{
- string str = bformat(_("Could not print the document %1$s.\n"
- "Check that your printer is set up correctly."),
- MakeDisplayPath(name, 50));
- Alert::error(_("Print document failed"), str);
-}
-
+ return browseRelFile(in_name, kernel().buffer().filePath(),
+ _("Print to file"),
+ FileFilterList("PostScript files (*.ps)"),
+ true);
}
/// print the current buffer
-void ControlPrint::apply()
+void ControlPrint::dispatchParams()
{
- if (!bufferIsAvailable())
- return;
-
- view().apply();
-
PrinterParams const pp = params();
string command(lyxrc.print_command + ' ');
command += lyxrc.print_extra_options + ' ';
}
- command += buffer()->params().dvips_options() + ' ';
-
- if (!Exporter::Export(buffer(), "dvi", true)) {
- showPrintError(buffer()->fileName());
- return;
- }
-
- // Push directory path.
- string const path = buffer()->temppath();
- Path p(path);
-
- // there are three cases here:
- // 1. we print to a file
- // 2. we print directly to a printer
- // 3. we print using a spool command (print to file first)
- Systemcall one;
- int res = 0;
- string const dviname = ChangeExtension(buffer()->getLatexName(true), "dvi");
- switch (pp.target) {
- case PrinterParams::PRINTER:
- if (!lyxrc.print_spool_command.empty()) {
- // case 3: print using a spool
- string const psname = ChangeExtension(dviname, ".ps");
- command += lyxrc.print_to_file
- + QuoteName(psname)
- + ' '
- + QuoteName(dviname);
-
- string command2 = lyxrc.print_spool_command + ' ';
- if (!pp.printer_name.empty()) {
- command2 += lyxrc.print_spool_printerprefix
- + pp.printer_name
- + ' ';
- }
- command2 += QuoteName(psname);
- // First run dvips.
- // If successful, then spool command
- res = one.startscript(Systemcall::Wait, command);
- if (res == 0)
- res = one.startscript(Systemcall::DontWait,
- command2);
- } else {
- // case 2: print directly to a printer
- res = one.startscript(Systemcall::DontWait,
- command + QuoteName(dviname));
- }
- break;
-
- case PrinterParams::FILE:
- // case 1: print to a file
- command += lyxrc.print_to_file
- + QuoteName(MakeAbsPath(pp.file_name, path))
- + ' '
- + QuoteName(dviname);
- res = one.startscript(Systemcall::DontWait, command);
- break;
- }
+ command += kernel().buffer().params().dvips_options() + ' ';
- lyxerr[Debug::LATEX] << "ControlPrint::apply(): print command = \""
- << command << '"' << endl;
+ string const target = (pp.target == PrinterParams::PRINTER) ?
+ "printer" : "file";
+
+ string const target_name = (pp.target == PrinterParams::PRINTER) ?
+ (pp.printer_name.empty() ? "default" : pp.printer_name) :
+ pp.file_name;
- if (res != 0)
- showPrintError(buffer()->fileName());
+ string const data = target + " " + target_name + " " + command;
+ kernel().dispatch(FuncRequest(LFUN_PRINT, data));
}
#ifndef CONTROLPRINT_H
#define CONTROLPRINT_H
-
-#include "ControlDialog_impl.h"
-
+#include "Dialog.h"
+#include <boost/scoped_ptr.hpp>
class PrinterParams;
/** A controller for Print dialogs.
*/
-class ControlPrint : public ControlDialogBD {
+class ControlPrint : public Dialog::Controller {
public:
///
- ControlPrint(LyXView &, Dialogs &);
+ ControlPrint(Dialog &);
+ ///
+ virtual bool initialiseParams(std::string const & data);
+ ///
+ virtual void clearParams();
+ ///
+ virtual void dispatchParams();
+ ///
+ virtual bool isBufferDependent() const { return true; }
/// Browse for a file
std::string const browse(std::string const &) const;
///
PrinterParams & params() const;
private:
- /// Get changed parameters and Dispatch them to the kernel.
- virtual void apply();
- /// set the params before show or update.
- virtual void setParams();
- /// clean-up on hide.
- virtual void clearParams();
-
///
- PrinterParams * params_;
+ boost::scoped_ptr<PrinterParams> params_;
};
#endif // CONTROLPRINT_H
+2004-03-28 Angus Leeming <leeming@lyx.org>
+
+ * Dialogs.C (build): added print dialog.
+
2004-03-27 Angus Leeming <leeming@lyx.org>
* Dialogs.C (build): added box, fidreplace, log, sendto, vspace
#include "ControlMath.h"
#include "ControlNote.h"
#include "ControlParagraph.h"
+#include "ControlPrint.h"
#include "ControlRef.h"
#include "ControlSearch.h"
#include "ControlSendto.h"
#include "FormMathsStyle.h"
#include "FormNote.h"
#include "FormParagraph.h"
+#include "FormPrint.h"
#include "FormRef.h"
#include "FormSearch.h"
#include "FormSendto.h"
"mathgreek", "mathmisc", "mathdots", "mathbigoperators", "mathamsmisc",
"mathamsarrows", "mathamsrelations", "mathamsnegatedrelations",
"mathamsoperators", "mathdelimiter", "mathmatrix", "mathspace", "mathstyle",
-"box", "note", "paragraph", "ref", "sendto", "tabular", "tabularcreate", "texinfo",
+"box", "note", "paragraph", "print", "ref", "sendto", "tabular", "tabularcreate",
#ifdef HAVE_LIBAIKSAURUS
"thesaurus",
#endif
-"toc", "url", "vspace", "wrap" };
+"texinfo", "toc", "url", "vspace", "wrap" };
char const * const * const end_dialognames =
dialognames + (sizeof(dialognames) / sizeof(char *));
dialog->setController(new ControlParagraph(*dialog));
dialog->setView(new FormParagraph(*dialog));
dialog->bc().bp(new OkApplyCancelReadOnlyPolicy);
+ } else if (name == "print") {
+ dialog->setController(new ControlPrint(*dialog));
+ dialog->setView(new FormPrint(*dialog));
+ dialog->bc().bp(new OkApplyCancelPolicy);
} else if (name == "ref") {
dialog->setController(new ControlRef(*dialog));
dialog->setView(new FormRef(*dialog));
}
-void gui_ShowPrint(Dialogs & d)
-{
- d.showPrint();
-}
-
-
void gui_ShowSpellchecker(Dialogs & d)
{
d.showSpellchecker();
void gui_ShowDocument(Dialogs &);
void gui_ShowPreamble(Dialogs &);
void gui_ShowPreferences(Dialogs &);
-void gui_ShowPrint(Dialogs &);
void gui_ShowSpellchecker(Dialogs &);
} // extern "C"
+2004-03-28 Angus Leeming <leeming@lyx.org>
+
+ * Dialogs.C (build): added print dialog.
+ * Dialogs2.C (showPrint): removed.
+
+ * QPrint.[Ch]: converted to the Dialog-based scheme.
+
2004-03-27 Angus Leeming <leeming@lyx.org>
- * Dialogs.C (build): added sendto, dialog.
+ * Dialogs.C (build): added sendto dialog.
* Dialogs2.C (showSendto): removed.
* QSendto.[Ch]: converted to the Dialog-based scheme.
#include "ControlMath.h"
#include "ControlNote.h"
#include "ControlParagraph.h"
+#include "ControlPrint.h"
#include "ControlRef.h"
#include "ControlSearch.h"
#include "ControlSendto.h"
#include "QMath.h"
#include "QNote.h"
#include "QParagraph.h"
+#include "QPrint.h"
#include "QRef.h"
#include "QSearch.h"
#include "QSendto.h"
"aboutlyx", "bibitem", "bibtex", "box", "branch", "changes", "character",
"citation", "error", "errorlist", "ert", "external", "file", "findreplace",
"float", "graphics", "include", "index", "label", "log", "mathpanel",
-"mathdelimiter", "mathmatrix",
-"note", "paragraph", "ref", "sendto", "tabular", "tabularcreate", "texinfo",
+"mathdelimiter", "mathmatrix", "note", "paragraph", "print", "ref", "sendto",
+"tabular", "tabularcreate", "texinfo",
#ifdef HAVE_LIBAIKSAURUS
"thesaurus",
dialog->setController(new ControlParagraph(*dialog));
dialog->setView(new QParagraph(*dialog));
dialog->bc().bp(new OkApplyCancelReadOnlyPolicy);
+ } else if (name == "print") {
+ dialog->setController(new ControlPrint(*dialog));
+ dialog->setView(new QPrint(*dialog));
+ dialog->bc().bp(new OkApplyCancelPolicy);
} else if (name == "ref") {
dialog->setController(new ControlRef(*dialog));
dialog->setView(new QRef(*dialog));
#include "ButtonController.h"
#include "ControlDocument.h"
-#include "ControlPrint.h"
#include "ControlSpellchecker.h"
#include "QDocument.h"
#undef signals
#include "QPrefs.h"
#include "QPrefsDialog.h"
-#include "QPrint.h"
-#include "QLPrintDialog.h"
#include "QSpellchecker.h"
#include "QSpellcheckerDialog.h"
typedef GUI<ControlPrefs, QPrefs, OkApplyCancelPolicy, Qt2BC>
PrefsDialog;
-typedef GUI<ControlPrint, QPrint, OkApplyCancelPolicy, Qt2BC>
-PrintDialog;
-
typedef GUI<ControlSpellchecker, QSpellchecker, NoRepeatedApplyReadOnlyPolicy, Qt2BC>
SpellcheckerDialog;
DocumentDialog document;
PrefsDialog prefs;
- PrintDialog print;
SpellcheckerDialog spellchecker;
};
Dialogs::Impl::Impl(LyXView & lv, Dialogs & d)
: document(lv, d),
prefs(lv, d),
- print(lv, d),
spellchecker(lv, d)
{}
}
-void Dialogs::showPrint()
-{
- pimpl_->print.controller().show();
-}
-
-
void Dialogs::showSpellchecker()
{
pimpl_->spellchecker.controller().show();
#include <qpushbutton.h>
-typedef Qt2CB<ControlPrint, Qt2DB<QLPrintDialog> > base_class;
+typedef QController<ControlPrint, QView<QLPrintDialog> > base_class;
-QPrint::QPrint()
- : base_class(_("LyX: Print Document"))
+QPrint::QPrint(Dialog & parent)
+ : base_class(parent, _("LyX: Print Document"))
{
}
#ifndef QPRINT_H
#define QPRINT_H
-
-#include "Qt2Base.h"
+#include "QDialogView.h"
class ControlPrint;
class QLPrintDialog;
///
class QPrint
- : public Qt2CB<ControlPrint, Qt2DB<QLPrintDialog> >
+ : public QController<ControlPrint, QView<QLPrintDialog> >
{
public:
///
friend class QLPrintDialog;
///
- QPrint();
+ QPrint(Dialog &);
private:
/// Apply changes
virtual void apply();
+2004-03-28 Angus Leeming <leeming@lyx.org>
+
+ * Dialogs.C (build): added print dialog.
+ * Dialogs2.C (showPrint): removed.
+
+ * FormPrint.[Ch]:
+ * forms/form_print.fd: converted to the Dialog-based scheme.
+
2004-03-27 Angus Leeming <leeming@lyx.org>
* Dialogs.C (build): added sendto, dialog.
#include "ControlMath.h"
#include "ControlNote.h"
#include "ControlParagraph.h"
+#include "ControlPrint.h"
#include "ControlRef.h"
#include "ControlSearch.h"
#include "ControlSendto.h"
#include "FormMathsStyle.h"
#include "FormNote.h"
#include "FormParagraph.h"
+#include "FormPrint.h"
#include "FormRef.h"
#include "FormTabular.h"
#include "FormTexinfo.h"
"mathgreek", "mathmisc", "mathdots", "mathbigoperators", "mathamsmisc",
"mathamsarrows", "mathamsrelations", "mathamsnegatedrelations",
"mathamsoperators", "mathdelimiter", "mathmatrix", "mathspace", "mathstyle",
-"note", "paragraph", "ref", "sendto", "tabular", "tabularcreate", "texinfo",
+"note", "paragraph", "print", "ref", "sendto", "tabular", "tabularcreate",
#ifdef HAVE_LIBAIKSAURUS
"thesaurus",
#endif
-"toc", "url", "vspace", "wrap" };
+"texinfo", "toc", "url", "vspace", "wrap" };
char const * const * const end_dialognames =
dialognames + (sizeof(dialognames) / sizeof(char *));
dialog->setController(new ControlParagraph(*dialog));
dialog->setView(new FormParagraph(*dialog));
dialog->bc().bp(new OkApplyCancelReadOnlyPolicy);
+ } else if (name == "print") {
+ dialog->setController(new ControlPrint(*dialog));
+ dialog->setView(new FormPrint(*dialog));
+ dialog->bc().bp(new OkApplyCancelPolicy);
} else if (name == "ref") {
dialog->setController(new ControlRef(*dialog));
dialog->setView(new FormRef(*dialog));
#include "FormColorpicker.h"
#include "forms/form_preferences.h"
-#include "ControlPrint.h"
-#include "FormPrint.h"
-#include "forms/form_print.h"
-
#include "ControlSpellchecker.h"
#include "FormSpellchecker.h"
#include "forms/form_spellchecker.h"
typedef GUI<ControlPrefs, FormPreferences, OkApplyCancelPolicy, xformsBC>
PreferencesDialog;
-typedef GUI<ControlPrint, FormPrint, OkApplyCancelPolicy, xformsBC>
-PrintDialog;
-
typedef GUI<ControlSpellchecker, FormSpellchecker, NoRepeatedApplyReadOnlyPolicy, xformsBC>
SpellcheckerDialog;
DocumentDialog document;
PreambleDialog preamble;
PreferencesDialog preferences;
- PrintDialog print;
SpellcheckerDialog spellchecker;
};
: document(lv, d),
preamble(lv, d),
preferences(lv, d),
- print(lv, d),
spellchecker(lv, d)
{}
}
-void Dialogs::showPrint()
-{
- pimpl_->print.controller().show();
-}
-
-
void Dialogs::showSpellchecker()
{
pimpl_->spellchecker.controller().show();
using std::string;
-typedef FormCB<ControlPrint, FormDB<FD_print> > base_class;
+typedef FormController<ControlPrint, FormView<FD_print> > base_class;
-FormPrint::FormPrint()
- : base_class(_("Print Document"))
+FormPrint::FormPrint(Dialog & parent)
+ : base_class(parent, _("Print Document"))
{}
#ifndef FORMPRINT_H
#define FORMPRINT_H
-
-
-#include "FormBase.h"
+#include "FormDialogView.h"
#include "RadioButtonGroup.h"
class ControlPrint;
/** This class provides an XForms implementation of the FormPrint Dialog.
The print dialog allows users to print their documents.
*/
-class FormPrint : public FormCB<ControlPrint, FormDB<FD_print> > {
+class FormPrint
+ : public FormController<ControlPrint, FormView<FD_print> > {
public:
///
- FormPrint();
+ FormPrint(Dialog &);
private:
/// Apply from dialog
virtual void apply();
resize: FL_RESIZE_X
gravity: FL_West FL_East
name: input_printer
-callback: C_FormBaseInputCB
+callback: C_FormDialogView_InputCB
argument: 0
--------------------
resize: FL_RESIZE_X
gravity: FL_West FL_East
name: input_file
-callback: C_FormBaseInputCB
+callback: C_FormDialogView_InputCB
argument: 0
--------------------
resize: FL_RESIZE_NONE
gravity: FL_SouthEast FL_SouthEast
name: button_close
-callback: C_FormBaseCancelCB
+callback: C_FormDialogView_CancelCB
argument: 0
--------------------
resize: FL_RESIZE_X
gravity: FL_West FL_NoGravity
name: input_from_page
-callback: C_FormBaseInputCB
+callback: C_FormDialogView_InputCB
argument: 0
--------------------
resize: FL_RESIZE_NONE
gravity: FL_NoGravity FL_NoGravity
name: check_sorted_copies
-callback: C_FormBaseInputCB
+callback: C_FormDialogView_InputCB
argument: 0
--------------------
resize: FL_RESIZE_X
gravity: FL_NoGravity FL_NoGravity
name: input_to_page
-callback: C_FormBaseInputCB
+callback: C_FormDialogView_InputCB
argument: 0
--------------------
resize: FL_RESIZE_NONE
gravity: FL_West FL_West
name: button_browse
-callback: C_FormBaseInputCB
+callback: C_FormDialogView_InputCB
argument: 0
--------------------
resize: FL_RESIZE_NONE
gravity: FL_West FL_West
name: check_reverse_order
-callback: C_FormBaseInputCB
+callback: C_FormDialogView_InputCB
argument: 0
--------------------
resize: FL_RESIZE_X
gravity: FL_West FL_NoGravity
name: counter_copies
-callback: C_FormBaseInputCB
+callback: C_FormDialogView_InputCB
argument: 0
bounds: 1 1000000
precision: 0
resize: FL_RESIZE_NONE
gravity: FL_SouthEast FL_SouthEast
name: button_ok
-callback: C_FormBaseOKCB
+callback: C_FormDialogView_OKCB
argument: 0
--------------------
resize: FL_RESIZE_NONE
gravity: FL_SouthEast FL_SouthEast
name: button_apply
-callback: C_FormBaseApplyCB
+callback: C_FormDialogView_ApplyCB
argument: 0
--------------------
resize: FL_RESIZE_NONE
gravity: FL_West FL_West
name: check_odd_pages
-callback: C_FormBaseInputCB
+callback: C_FormDialogView_InputCB
argument: 0
--------------------
resize: FL_RESIZE_NONE
gravity: FL_West FL_West
name: check_even_pages
-callback: C_FormBaseInputCB
+callback: C_FormDialogView_InputCB
argument: 0
--------------------
resize: FL_RESIZE_NONE
gravity: FL_West FL_West
name: radio_printer
-callback: C_FormBaseInputCB
+callback: C_FormDialogView_InputCB
argument: 0
--------------------
resize: FL_RESIZE_NONE
gravity: FL_West FL_West
name: radio_file
-callback: C_FormBaseInputCB
+callback: C_FormDialogView_InputCB
argument: 0
--------------------
resize: FL_RESIZE_NONE
gravity: FL_West FL_West
name: radio_all_pages
-callback: C_FormBaseInputCB
+callback: C_FormDialogView_InputCB
argument: 0
--------------------
resize: FL_RESIZE_NONE
gravity: FL_West FL_West
name: radio_from_to
-callback: C_FormBaseInputCB
+callback: C_FormDialogView_InputCB
argument: 0
--------------------
LFUN_WORD_REPLACE,
// 255
LFUN_EXPORT_CUSTOM,
+ LFUN_PRINT,
LFUN_LASTACTION // end of the table
};
#include "support/filetools.h"
#include "support/forkedcontr.h"
#include "support/globbing.h"
+#include "support/lstrings.h"
#include "support/path.h"
#include "support/path_defines.h"
#include "support/systemcall.h"
using lyx::support::MakeAbsPath;
using lyx::support::MakeDisplayPath;
using lyx::support::Path;
+using lyx::support::QuoteName;
using lyx::support::rtrim;
using lyx::support::split;
using lyx::support::strToInt;
case LFUN_KMAP_TOGGLE:
case LFUN_REPEAT:
case LFUN_EXPORT_CUSTOM:
+ case LFUN_PRINT:
case LFUN_SEQUENCE:
case LFUN_SAVEPREFERENCES:
case LFUN_SCREEN_FONT_UPDATE:
return buf.isClean();
}
+void showPrintError(string const & name)
+{
+ string str = bformat(_("Could not print the document %1$s.\n"
+ "Check that your printer is set up correctly."),
+ MakeDisplayPath(name, 50));
+ Alert::error(_("Print document failed"), str);
+}
+
} //namespace anon
break;
}
+ case LFUN_PRINT: {
+ string target;
+ string target_name;
+ string command = split(split(argument, target, ' '),
+ target_name, ' ');
+
+ if (target.empty()
+ || target_name.empty()
+ || command.empty()) {
+ lyxerr << "Unable to parse \""
+ << argument << '"' << std::endl;
+ break;
+ }
+ if (target != "printer" && target != "file") {
+ lyxerr << "Unrecognized target \""
+ << target << '"' << std::endl;
+ break;
+ }
+
+ Buffer * buffer = owner->buffer();
+
+ if (!Exporter::Export(buffer, "dvi", true)) {
+ showPrintError(buffer->fileName());
+ break;
+ }
+
+ // Push directory path.
+ string const path = buffer->temppath();
+ Path p(path);
+
+ // there are three cases here:
+ // 1. we print to a file
+ // 2. we print directly to a printer
+ // 3. we print using a spool command (print to file first)
+ Systemcall one;
+ int res = 0;
+ string const dviname =
+ ChangeExtension(buffer->getLatexName(true),
+ "dvi");
+
+ if (target == "printer") {
+ if (!lyxrc.print_spool_command.empty()) {
+ // case 3: print using a spool
+ string const psname =
+ ChangeExtension(dviname,".ps");
+ command += lyxrc.print_to_file
+ + QuoteName(psname)
+ + ' '
+ + QuoteName(dviname);
+
+ string command2 =
+ lyxrc.print_spool_command +' ';
+ if (target_name != "default") {
+ command2 += lyxrc.print_spool_printerprefix
+ + target_name
+ + ' ';
+ }
+ command2 += QuoteName(psname);
+ // First run dvips.
+ // If successful, then spool command
+ res = one.startscript(
+ Systemcall::Wait,
+ command);
+
+ if (res == 0)
+ res = one.startscript(
+ Systemcall::DontWait,
+ command2);
+ } else {
+ // case 2: print directly to a printer
+ res = one.startscript(
+ Systemcall::DontWait,
+ command + QuoteName(dviname));
+ }
+
+ } else {
+ // case 1: print to a file
+ command += lyxrc.print_to_file
+ + QuoteName(MakeAbsPath(target_name,
+ path))
+ + ' '
+ + QuoteName(dviname);
+ res = one.startscript(Systemcall::DontWait,
+ command);
+ }
+
+ if (res != 0)
+ showPrintError(buffer->fileName());
+ break;
+ }
+
case LFUN_IMPORT:
doImport(argument);
break;
owner->getDialogs().showPreamble();
else if (name == "preferences")
owner->getDialogs().showPreferences();
- else if (name == "print")
- owner->getDialogs().showPrint();
else if (name == "spellchecker")
owner->getDialogs().showSpellchecker();