mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-25 22:06:15 +00:00
export patch from Dekel
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@1001 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
2fa9fa22c4
commit
83882f6d92
29
ChangeLog
29
ChangeLog
@ -1,3 +1,32 @@
|
|||||||
|
2000-09-04 Dekel Tsur <dekel@math.tau.ac.il>
|
||||||
|
|
||||||
|
* src/converter.C (add_options): New function.
|
||||||
|
(SetViewer): Change $$FName into '$$FName'.
|
||||||
|
(View): Add options when running xdvi
|
||||||
|
(Add): Change $$FName into '$$FName'. Same for $$BaseName/$$OutName.
|
||||||
|
(Convert): The 3rd parameter is now the desired filename. Converts
|
||||||
|
calls to lyx::rename if necessary.
|
||||||
|
Add options when running dvips.
|
||||||
|
(dvi_papersize,dvips_options): New methods.
|
||||||
|
|
||||||
|
* src/exporter.C (Export): Use getLatexName() instead of fileName().
|
||||||
|
|
||||||
|
* src/frontends/Liason.C (printBuffer): Removed duplicate code by
|
||||||
|
using a call to Converter::dvips_options.
|
||||||
|
Fixed to work with nex export code.
|
||||||
|
|
||||||
|
* src/support/copy.C
|
||||||
|
* src/support/rename.C: New files
|
||||||
|
|
||||||
|
* src/support/syscall.h
|
||||||
|
* src/support/syscall.C: Added Starttype SystemDontWait.
|
||||||
|
|
||||||
|
* lib/ui/default.ui: Changed to work with new export code
|
||||||
|
|
||||||
|
* lib/configure.m4: Changed to work with new export code
|
||||||
|
|
||||||
|
* src/encoding.C: Changed latex name for iso8859_7 encoding.
|
||||||
|
|
||||||
2000-09-04 Angus Leeming <a.leeming@ic.ac.uk> +
|
2000-09-04 Angus Leeming <a.leeming@ic.ac.uk> +
|
||||||
|
|
||||||
* src/frontends/xforms/Menubar_pimpl.C: added two using directives
|
* src/frontends/xforms/Menubar_pimpl.C: added two using directives
|
||||||
|
167
lib/configure
vendored
167
lib/configure
vendored
@ -335,7 +335,7 @@ fi
|
|||||||
# Search for a program to preview pdf
|
# Search for a program to preview pdf
|
||||||
echo $ac_n "checking for a PDF preview""... $ac_c"
|
echo $ac_n "checking for a PDF preview""... $ac_c"
|
||||||
echo "$ac_t""(xpdf acroread gv ghostview)"
|
echo "$ac_t""(xpdf acroread gv ghostview)"
|
||||||
PDFVIEWER=
|
PDF_VIEWER=
|
||||||
for ac_prog in xpdf acroread gv ghostview
|
for ac_prog in xpdf acroread gv ghostview
|
||||||
do
|
do
|
||||||
# Extract the first word of "$ac_prog", so it can be a program name with args.
|
# Extract the first word of "$ac_prog", so it can be a program name with args.
|
||||||
@ -346,33 +346,33 @@ if test -n "$ac_word"; then
|
|||||||
for ac_dir in $PATH; do
|
for ac_dir in $PATH; do
|
||||||
test -z "$ac_dir" && ac_dir=.
|
test -z "$ac_dir" && ac_dir=.
|
||||||
if test -x $ac_dir/$ac_word; then
|
if test -x $ac_dir/$ac_word; then
|
||||||
PDFVIEWER="$ac_prog"
|
PDF_VIEWER="$ac_prog"
|
||||||
break
|
break
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
IFS="$ac_save_ifs"
|
IFS="$ac_save_ifs"
|
||||||
|
|
||||||
if test -n "$PDFVIEWER"; then
|
if test -n "$PDF_VIEWER"; then
|
||||||
ac_result=yes
|
ac_result=yes
|
||||||
else
|
else
|
||||||
ac_result=no
|
ac_result=no
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "$ac_t""$ac_result"
|
echo "$ac_t""$ac_result"
|
||||||
test -n "$PDFVIEWER" && break
|
test -n "$PDF_VIEWER" && break
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
if test -z "$PDFVIEWER" ; then
|
if test -z "$PDF_VIEWER" ; then
|
||||||
PDFVIEWER=none
|
PDF_VIEWER=none
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
# Search for a program to convert pdf to ps
|
# Search something to preview dvi
|
||||||
echo $ac_n "checking for a PDF to PS converter""... $ac_c"
|
echo $ac_n "checking for a DVI previewer""... $ac_c"
|
||||||
echo "$ac_t""(pdf2ps pdftops)"
|
echo "$ac_t""(xdvi)"
|
||||||
PDFPS=
|
DVI_VIEWER=
|
||||||
for ac_prog in pdf2ps pdftops
|
for ac_prog in xdvi
|
||||||
do
|
do
|
||||||
# Extract the first word of "$ac_prog", so it can be a program name with args.
|
# Extract the first word of "$ac_prog", so it can be a program name with args.
|
||||||
set dummy $ac_prog ; ac_word=$2
|
set dummy $ac_prog ; ac_word=$2
|
||||||
@ -382,32 +382,105 @@ if test -n "$ac_word"; then
|
|||||||
for ac_dir in $PATH; do
|
for ac_dir in $PATH; do
|
||||||
test -z "$ac_dir" && ac_dir=.
|
test -z "$ac_dir" && ac_dir=.
|
||||||
if test -x $ac_dir/$ac_word; then
|
if test -x $ac_dir/$ac_word; then
|
||||||
PDFPS="$ac_prog"
|
DVI_VIEWER="$ac_prog"
|
||||||
break
|
break
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
IFS="$ac_save_ifs"
|
IFS="$ac_save_ifs"
|
||||||
|
|
||||||
if test -n "$PDFPS"; then
|
if test -n "$DVI_VIEWER"; then
|
||||||
ac_result=yes
|
ac_result=yes
|
||||||
else
|
else
|
||||||
ac_result=no
|
ac_result=no
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "$ac_t""$ac_result"
|
echo "$ac_t""$ac_result"
|
||||||
test -n "$PDFPS" && break
|
test -n "$DVI_VIEWER" && break
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
if test -z "$PDFPS" ; then
|
if test -z "$DVI_VIEWER" ; then
|
||||||
PDFPS=none
|
DVI_VIEWER=none
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
# Search something to preview html
|
||||||
|
echo $ac_n "checking for a HTML previewer""... $ac_c"
|
||||||
|
echo "$ac_t""(netscape)"
|
||||||
|
HTML_VIEWER=
|
||||||
|
for ac_prog in netscape
|
||||||
|
do
|
||||||
|
# Extract the first word of "$ac_prog", so it can be a program name with args.
|
||||||
|
set dummy $ac_prog ; ac_word=$2
|
||||||
|
if test -n "$ac_word"; then
|
||||||
|
echo $ac_n "+checking for \"$ac_word\"""... $ac_c"
|
||||||
|
IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
|
||||||
|
for ac_dir in $PATH; do
|
||||||
|
test -z "$ac_dir" && ac_dir=.
|
||||||
|
if test -x $ac_dir/$ac_word; then
|
||||||
|
HTML_VIEWER="$ac_prog"
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
IFS="$ac_save_ifs"
|
||||||
|
|
||||||
|
if test -n "$HTML_VIEWER"; then
|
||||||
|
ac_result=yes
|
||||||
|
else
|
||||||
|
ac_result=no
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "$ac_t""$ac_result"
|
||||||
|
test -n "$HTML_VIEWER" && break
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
if test -z "$HTML_VIEWER" ; then
|
||||||
|
HTML_VIEWER=none
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
# Search for a program to convert ps to pdf
|
||||||
|
echo $ac_n "checking for a PS to PDF converter""... $ac_c"
|
||||||
|
echo "$ac_t""(ps2pdf)"
|
||||||
|
ps_to_pdf_command=
|
||||||
|
for ac_prog in ps2pdf
|
||||||
|
do
|
||||||
|
# Extract the first word of "$ac_prog", so it can be a program name with args.
|
||||||
|
set dummy $ac_prog ; ac_word=$2
|
||||||
|
if test -n "$ac_word"; then
|
||||||
|
echo $ac_n "+checking for \"$ac_word\"""... $ac_c"
|
||||||
|
IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
|
||||||
|
for ac_dir in $PATH; do
|
||||||
|
test -z "$ac_dir" && ac_dir=.
|
||||||
|
if test -x $ac_dir/$ac_word; then
|
||||||
|
ps_to_pdf_command="$ac_prog"
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
IFS="$ac_save_ifs"
|
||||||
|
|
||||||
|
if test -n "$ps_to_pdf_command"; then
|
||||||
|
ac_result=yes
|
||||||
|
else
|
||||||
|
ac_result=no
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "$ac_t""$ac_result"
|
||||||
|
test -n "$ps_to_pdf_command" && break
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
if test -z "$ps_to_pdf_command" ; then
|
||||||
|
ps_to_pdf_command=none
|
||||||
|
fi
|
||||||
|
|
||||||
|
test $ps_to_pdf_command = "ps2pdf" && ps_to_pdf_command="ps2pdf \$\$FName"
|
||||||
|
|
||||||
# Search for a program to convert dvi to ps
|
# Search for a program to convert dvi to ps
|
||||||
echo $ac_n "checking for a DVI to PS converter""... $ac_c"
|
echo $ac_n "checking for a DVI to PS converter""... $ac_c"
|
||||||
echo "$ac_t""(dvips)"
|
echo "$ac_t""(dvips)"
|
||||||
DVIPS=
|
dvi_to_ps_command=
|
||||||
for ac_prog in dvips
|
for ac_prog in dvips
|
||||||
do
|
do
|
||||||
# Extract the first word of "$ac_prog", so it can be a program name with args.
|
# Extract the first word of "$ac_prog", so it can be a program name with args.
|
||||||
@ -418,27 +491,28 @@ if test -n "$ac_word"; then
|
|||||||
for ac_dir in $PATH; do
|
for ac_dir in $PATH; do
|
||||||
test -z "$ac_dir" && ac_dir=.
|
test -z "$ac_dir" && ac_dir=.
|
||||||
if test -x $ac_dir/$ac_word; then
|
if test -x $ac_dir/$ac_word; then
|
||||||
DVIPS="$ac_prog"
|
dvi_to_ps_command="$ac_prog"
|
||||||
break
|
break
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
IFS="$ac_save_ifs"
|
IFS="$ac_save_ifs"
|
||||||
|
|
||||||
if test -n "$DVIPS"; then
|
if test -n "$dvi_to_ps_command"; then
|
||||||
ac_result=yes
|
ac_result=yes
|
||||||
else
|
else
|
||||||
ac_result=no
|
ac_result=no
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "$ac_t""$ac_result"
|
echo "$ac_t""$ac_result"
|
||||||
test -n "$DVIPS" && break
|
test -n "$dvi_to_ps_command" && break
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
if test -z "$DVIPS" ; then
|
if test -z "$dvi_to_ps_command" ; then
|
||||||
DVIPS=none
|
dvi_to_ps_command=none
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
test $dvi_to_ps_command = "dvips" && dvi_to_ps_command="dvips -o \$\$OutName \$\$FName"
|
||||||
|
|
||||||
# Search a *roff program (used to translate tables in ASCII export)
|
# Search a *roff program (used to translate tables in ASCII export)
|
||||||
echo $ac_n "checking for a *roff formatter""... $ac_c"
|
echo $ac_n "checking for a *roff formatter""... $ac_c"
|
||||||
@ -641,8 +715,8 @@ fi
|
|||||||
|
|
||||||
case $LINUXDOC in
|
case $LINUXDOC in
|
||||||
sgml2lyx)
|
sgml2lyx)
|
||||||
linuxdoc_to_latex_command="sgml2latex"
|
linuxdoc_to_latex_command="sgml2latex \$\$FName"
|
||||||
linuxdoc_to_html_command="sgml2html '\$\$FName'"
|
linuxdoc_to_html_command="sgml2html \$\$FName"
|
||||||
linuxdoc_to_lyx_command="sgml2lyx";;
|
linuxdoc_to_lyx_command="sgml2lyx";;
|
||||||
none)
|
none)
|
||||||
linuxdoc_to_latex_command="none"
|
linuxdoc_to_latex_command="none"
|
||||||
@ -693,11 +767,11 @@ fi
|
|||||||
|
|
||||||
case $DOCBOOK in
|
case $DOCBOOK in
|
||||||
sgmltools)
|
sgmltools)
|
||||||
docbook_to_dvi_command="sgmltools -b dvi"
|
docbook_to_dvi_command="sgmltools -b dvi \$\$FName"
|
||||||
docbook_to_html_command="sgmltools -b html '\$\$FName'";;
|
docbook_to_html_command="sgmltools -b html \$\$FName";;
|
||||||
db2dvi)
|
db2dvi)
|
||||||
docbook_to_dvi_command="db2dvi"
|
docbook_to_dvi_command="db2dvi \$\$FName"
|
||||||
docbook_to_html_command="db2html '\$\$FName'";;
|
docbook_to_html_command="db2html \$\$FName";;
|
||||||
none)
|
none)
|
||||||
docbook_to_dvi_command="none"
|
docbook_to_dvi_command="none"
|
||||||
docbook_to_html_command="none";;
|
docbook_to_html_command="none";;
|
||||||
@ -781,10 +855,11 @@ if test -z "$TOHTML" ; then
|
|||||||
TOHTML=none
|
TOHTML=none
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
latex_to_html_command = $TOHTML
|
||||||
case $TOHTML in
|
case $TOHTML in
|
||||||
tth) html_command="tth -t < '\$\$FName' > '\$\$OutName'";;
|
tth) latex_to_html_command="tth -t < \$\$FName > \$\$OutName";;
|
||||||
latex2html) html_command="latex2html -no_subdir -split 0 -show_section_numbers '\$\$FName'";;
|
latex2html) latex_to_html_command="latex2html -no_subdir -split 0 -show_section_numbers \$\$FName";;
|
||||||
hevea) html_command="hevea -s '\$\$FName'";;
|
hevea) latex_to_html_command="hevea -s \$\$FName";;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
#### Explore the LaTeX configuration
|
#### Explore the LaTeX configuration
|
||||||
@ -870,27 +945,31 @@ cat >lyxrc.defaults <<EOF
|
|||||||
# want to customize LyX, make a copy of the file LYXDIR/lyxrc as
|
# want to customize LyX, make a copy of the file LYXDIR/lyxrc as
|
||||||
# ~/.lyx/lyxrc and edit this file instead. Any setting in lyxrc will
|
# ~/.lyx/lyxrc and edit this file instead. Any setting in lyxrc will
|
||||||
# override the values given here.
|
# override the values given here.
|
||||||
\\latex_command "$LATEX"
|
\\converter tex dvi "$LATEX" noflags
|
||||||
\\pdflatex_command "$PDFLATEX"
|
\\converter tex pdf "$PDFLATEX" noflags
|
||||||
\\view_pdf_command "$PDFVIEWER"
|
\\converter dvi ps "$dvi_to_ps_command" noflags
|
||||||
\\pdf_to_ps_command "$PDFPS"
|
\\converter ps pdf "$ps_to_pdf_command" noflags
|
||||||
\\dvi_to_ps_command "$DVIPS"
|
\\converter sgml tex "$linuxdoc_to_latex_command" noflags
|
||||||
|
\\converter sgml html "$linuxdoc_to_html_command" noflags
|
||||||
|
\\converter docbook dvi "$docbook_to_dvi_command" noflags
|
||||||
|
\\converter docbook html "$docbook_to_html_command" noflags
|
||||||
|
\\converter tex html "$latex_to_html_command" noflags
|
||||||
|
|
||||||
|
\\viewer dvi "$DVI_VIEWER"
|
||||||
|
\\viewer html "$HTML_VIEWER"
|
||||||
|
\\viewer pdf "$PDF_VIEWER"
|
||||||
|
\\viewer ps "$GHOSTVIEW -swap"
|
||||||
|
\\viewer pspic "$GHOSTVIEW"
|
||||||
|
|
||||||
\\relyx_command "$RELYX"
|
\\relyx_command "$RELYX"
|
||||||
|
\\linuxdoc_to_lyx_command "$linuxdoc_to_lyx_command"
|
||||||
\\literate_command "$LITERATE"
|
\\literate_command "$LITERATE"
|
||||||
\\literate_extension "$LITERATE_EXT"
|
\\literate_extension "$LITERATE_EXT"
|
||||||
\\ps_command "$GS"
|
\\ps_command "$GS"
|
||||||
\\view_ps_command "$GHOSTVIEW -swap"
|
|
||||||
\\view_pspic_command "$GHOSTVIEW"
|
|
||||||
\\ascii_roff_command "$ascii_roff_command"
|
\\ascii_roff_command "$ascii_roff_command"
|
||||||
\\chktex_command "$chktex_command"
|
\\chktex_command "$chktex_command"
|
||||||
\\spell_command "$SPELL"
|
\\spell_command "$SPELL"
|
||||||
\\fax_command "$fax_command"
|
\\fax_command "$fax_command"
|
||||||
\\linuxdoc_to_latex_command "$linuxdoc_to_latex_command"
|
|
||||||
\\linuxdoc_to_html_command "$linuxdoc_to_html_command"
|
|
||||||
\\linuxdoc_to_lyx_command "$linuxdoc_to_lyx_command"
|
|
||||||
\\docbook_to_dvi_command "$docbook_to_dvi_command"
|
|
||||||
\\docbook_to_html_command "$docbook_to_html_command"
|
|
||||||
\\html_command "$html_command"
|
|
||||||
\\print_spool_command "$print_spool_command"
|
\\print_spool_command "$print_spool_command"
|
||||||
\\print_spool_printerprefix "$print_spool_printerprefix"
|
\\print_spool_printerprefix "$print_spool_printerprefix"
|
||||||
\\font_encoding "$chk_fontenc"
|
\\font_encoding "$chk_fontenc"
|
||||||
|
@ -196,13 +196,21 @@ SEARCH_PROG([for a Postscript interpreter],GS, gs)
|
|||||||
SEARCH_PROG([for a Postscript previewer],GHOSTVIEW,gv ghostview)
|
SEARCH_PROG([for a Postscript previewer],GHOSTVIEW,gv ghostview)
|
||||||
|
|
||||||
# Search for a program to preview pdf
|
# Search for a program to preview pdf
|
||||||
SEARCH_PROG([for a PDF preview],PDFVIEWER,xpdf acroread gv ghostview)
|
SEARCH_PROG([for a PDF preview],PDF_VIEWER,xpdf acroread gv ghostview)
|
||||||
|
|
||||||
# Search for a program to convert pdf to ps
|
# Search something to preview dvi
|
||||||
SEARCH_PROG([for a PDF to PS converter],PDFPS,pdf2ps pdftops)
|
SEARCH_PROG([for a DVI previewer],DVI_VIEWER, xdvi)
|
||||||
|
|
||||||
|
# Search something to preview html
|
||||||
|
SEARCH_PROG([for a HTML previewer],HTML_VIEWER, netscape)
|
||||||
|
|
||||||
|
# Search for a program to convert ps to pdf
|
||||||
|
SEARCH_PROG([for a PS to PDF converter],ps_to_pdf_command,ps2pdf)
|
||||||
|
test $ps_to_pdf_command = "ps2pdf" && ps_to_pdf_command="ps2pdf \$\$FName"
|
||||||
|
|
||||||
# Search for a program to convert dvi to ps
|
# Search for a program to convert dvi to ps
|
||||||
SEARCH_PROG([for a DVI to PS converter],DVIPS,dvips)
|
SEARCH_PROG([for a DVI to PS converter],dvi_to_ps_command,dvips)
|
||||||
|
test $dvi_to_ps_command = "dvips" && dvi_to_ps_command="dvips -o \$\$OutName \$\$FName"
|
||||||
|
|
||||||
# Search a *roff program (used to translate tables in ASCII export)
|
# Search a *roff program (used to translate tables in ASCII export)
|
||||||
SEARCH_PROG([for a *roff formatter],ROFF,groff nroff)
|
SEARCH_PROG([for a *roff formatter],ROFF,groff nroff)
|
||||||
@ -240,8 +248,8 @@ fi
|
|||||||
|
|
||||||
case $LINUXDOC in
|
case $LINUXDOC in
|
||||||
sgml2lyx)
|
sgml2lyx)
|
||||||
linuxdoc_to_latex_command="sgml2latex"
|
linuxdoc_to_latex_command="sgml2latex \$\$FName"
|
||||||
linuxdoc_to_html_command="sgml2html '\$\$FName'"
|
linuxdoc_to_html_command="sgml2html \$\$FName"
|
||||||
linuxdoc_to_lyx_command="sgml2lyx";;
|
linuxdoc_to_lyx_command="sgml2lyx";;
|
||||||
none)
|
none)
|
||||||
linuxdoc_to_latex_command="none"
|
linuxdoc_to_latex_command="none"
|
||||||
@ -259,11 +267,11 @@ fi
|
|||||||
|
|
||||||
case $DOCBOOK in
|
case $DOCBOOK in
|
||||||
sgmltools)
|
sgmltools)
|
||||||
docbook_to_dvi_command="sgmltools -b dvi"
|
docbook_to_dvi_command="sgmltools -b dvi \$\$FName"
|
||||||
docbook_to_html_command="sgmltools -b html '\$\$FName'";;
|
docbook_to_html_command="sgmltools -b html \$\$FName";;
|
||||||
db2dvi)
|
db2dvi)
|
||||||
docbook_to_dvi_command="db2dvi"
|
docbook_to_dvi_command="db2dvi \$\$FName"
|
||||||
docbook_to_html_command="db2html '\$\$FName'";;
|
docbook_to_html_command="db2html \$\$FName";;
|
||||||
none)
|
none)
|
||||||
docbook_to_dvi_command="none"
|
docbook_to_dvi_command="none"
|
||||||
docbook_to_html_command="none";;
|
docbook_to_html_command="none";;
|
||||||
@ -281,10 +289,11 @@ esac
|
|||||||
|
|
||||||
# Search for a latex to html converter
|
# Search for a latex to html converter
|
||||||
SEARCH_PROG([for an HTML converter], TOHTML, tth latex2html hevea)
|
SEARCH_PROG([for an HTML converter], TOHTML, tth latex2html hevea)
|
||||||
|
latex_to_html_command = $TOHTML
|
||||||
case $TOHTML in
|
case $TOHTML in
|
||||||
tth) html_command="tth -t < '\$\$FName' > '\$\$OutName'";;
|
tth) latex_to_html_command="tth -t < \$\$FName > \$\$OutName";;
|
||||||
latex2html) html_command="latex2html -no_subdir -split 0 -show_section_numbers '\$\$FName'";;
|
latex2html) latex_to_html_command="latex2html -no_subdir -split 0 -show_section_numbers \$\$FName";;
|
||||||
hevea) html_command="hevea -s '\$\$FName'";;
|
hevea) latex_to_html_command="hevea -s \$\$FName";;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
#### Explore the LaTeX configuration
|
#### Explore the LaTeX configuration
|
||||||
@ -358,27 +367,31 @@ cat >lyxrc.defaults <<EOF
|
|||||||
# want to customize LyX, make a copy of the file LYXDIR/lyxrc as
|
# want to customize LyX, make a copy of the file LYXDIR/lyxrc as
|
||||||
# ~/.lyx/lyxrc and edit this file instead. Any setting in lyxrc will
|
# ~/.lyx/lyxrc and edit this file instead. Any setting in lyxrc will
|
||||||
# override the values given here.
|
# override the values given here.
|
||||||
\\latex_command "$LATEX"
|
\\converter tex dvi "$LATEX" noflags
|
||||||
\\pdflatex_command "$PDFLATEX"
|
\\converter tex pdf "$PDFLATEX" noflags
|
||||||
\\view_pdf_command "$PDFVIEWER"
|
\\converter dvi ps "$dvi_to_ps_command" noflags
|
||||||
\\pdf_to_ps_command "$PDFPS"
|
\\converter ps pdf "$ps_to_pdf_command" noflags
|
||||||
\\dvi_to_ps_command "$DVIPS"
|
\\converter sgml tex "$linuxdoc_to_latex_command" noflags
|
||||||
|
\\converter sgml html "$linuxdoc_to_html_command" noflags
|
||||||
|
\\converter docbook dvi "$docbook_to_dvi_command" noflags
|
||||||
|
\\converter docbook html "$docbook_to_html_command" noflags
|
||||||
|
\\converter tex html "$latex_to_html_command" noflags
|
||||||
|
|
||||||
|
\\viewer dvi "$DVI_VIEWER"
|
||||||
|
\\viewer html "$HTML_VIEWER"
|
||||||
|
\\viewer pdf "$PDF_VIEWER"
|
||||||
|
\\viewer ps "$GHOSTVIEW -swap"
|
||||||
|
\\viewer pspic "$GHOSTVIEW"
|
||||||
|
|
||||||
\\relyx_command "$RELYX"
|
\\relyx_command "$RELYX"
|
||||||
|
\\linuxdoc_to_lyx_command "$linuxdoc_to_lyx_command"
|
||||||
\\literate_command "$LITERATE"
|
\\literate_command "$LITERATE"
|
||||||
\\literate_extension "$LITERATE_EXT"
|
\\literate_extension "$LITERATE_EXT"
|
||||||
\\ps_command "$GS"
|
\\ps_command "$GS"
|
||||||
\\view_ps_command "$GHOSTVIEW -swap"
|
|
||||||
\\view_pspic_command "$GHOSTVIEW"
|
|
||||||
\\ascii_roff_command "$ascii_roff_command"
|
\\ascii_roff_command "$ascii_roff_command"
|
||||||
\\chktex_command "$chktex_command"
|
\\chktex_command "$chktex_command"
|
||||||
\\spell_command "$SPELL"
|
\\spell_command "$SPELL"
|
||||||
\\fax_command "$fax_command"
|
\\fax_command "$fax_command"
|
||||||
\\linuxdoc_to_latex_command "$linuxdoc_to_latex_command"
|
|
||||||
\\linuxdoc_to_html_command "$linuxdoc_to_html_command"
|
|
||||||
\\linuxdoc_to_lyx_command "$linuxdoc_to_lyx_command"
|
|
||||||
\\docbook_to_dvi_command "$docbook_to_dvi_command"
|
|
||||||
\\docbook_to_html_command "$docbook_to_html_command"
|
|
||||||
\\html_command "$html_command"
|
|
||||||
\\print_spool_command "$print_spool_command"
|
\\print_spool_command "$print_spool_command"
|
||||||
\\print_spool_printerprefix "$print_spool_printerprefix"
|
\\print_spool_printerprefix "$print_spool_printerprefix"
|
||||||
\\font_encoding "$chk_fontenc"
|
\\font_encoding "$chk_fontenc"
|
||||||
|
@ -34,11 +34,11 @@ Menuset
|
|||||||
Item "Save As|A" "buffer-write-as"
|
Item "Save As|A" "buffer-write-as"
|
||||||
Item "Revert to saved|R" "buffer-reload"
|
Item "Revert to saved|R" "buffer-reload"
|
||||||
Separator
|
Separator
|
||||||
Item "View dvi|d" "buffer-view"
|
Item "View dvi|d" "buffer-view dvi"
|
||||||
Item "View Postscript|w" "buffer-view-ps"
|
Item "View Postscript|w" "buffer-view ps"
|
||||||
Submenu "View" "view"
|
Submenu "View" "view"
|
||||||
Item "Update dvi|v" "buffer-typeset"
|
Item "Update dvi|v" "buffer-update dvi"
|
||||||
Item "Update Postscript|U" "buffer-typeset-ps"
|
Item "Update Postscript|U" "buffer-update ps"
|
||||||
Submenu "Update" "update"
|
Submenu "Update" "update"
|
||||||
OptItem "Build program|B" "build-program"
|
OptItem "Build program|B" "build-program"
|
||||||
Separator
|
Separator
|
||||||
@ -81,14 +81,14 @@ Menuset
|
|||||||
|
|
||||||
Menu "export"
|
Menu "export"
|
||||||
ExportFormats
|
ExportFormats
|
||||||
OptItem "as LaTeX|L" "buffer-export latex"
|
# OptItem "as LaTeX|L" "buffer-export latex"
|
||||||
OptItem "as LinuxDoc|L" "buffer-export linuxdoc"
|
# OptItem "as LinuxDoc|L" "buffer-export linuxdoc"
|
||||||
OptItem "as DocBook|B" "buffer-export docbook"
|
# OptItem "as DocBook|B" "buffer-export docbook"
|
||||||
Item "as DVI|D" "buffer-export dvi"
|
# Item "as DVI|D" "buffer-export dvi"
|
||||||
# Item "as Postscript|P" "buffer-export postscript"
|
# Item "as Postscript|P" "buffer-export postscript"
|
||||||
Item "as Ascii|A" "buffer-export ascii"
|
# Item "as Ascii|A" "buffer-export ascii"
|
||||||
Item "as HTML|H" "buffer-export html"
|
# Item "as HTML|H" "buffer-export html"
|
||||||
OptItem "Custom...|C" "buffer-export custom"
|
# OptItem "Custom...|C" "buffer-export custom"
|
||||||
End
|
End
|
||||||
|
|
||||||
Menu "edit"
|
Menu "edit"
|
||||||
|
@ -22,6 +22,11 @@
|
|||||||
// only to get access to NEW_INSETS and NEW_TABULAR
|
// only to get access to NEW_INSETS and NEW_TABULAR
|
||||||
#include "lyxparagraph.h"
|
#include "lyxparagraph.h"
|
||||||
#endif
|
#endif
|
||||||
|
#if 1
|
||||||
|
// only to get access to NEW_EXPORT
|
||||||
|
#include "exporter.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
using std::ostream;
|
using std::ostream;
|
||||||
using std::endl;
|
using std::endl;
|
||||||
|
188
src/converter.C
188
src/converter.C
@ -15,30 +15,25 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <queue>
|
#include <queue>
|
||||||
#include <stack>
|
#include <algorithm> // sort()
|
||||||
#include <algorithm>
|
|
||||||
#include <stdio.h>
|
|
||||||
|
|
||||||
#include "converter.h"
|
#include "converter.h"
|
||||||
#include "lyxrc.h"
|
#include "lyxrc.h"
|
||||||
#include "support/syscall.h"
|
#include "support/syscall.h"
|
||||||
#include "support/path.h"
|
#include "support/path.h"
|
||||||
#include "debug.h"
|
|
||||||
#include "buffer.h"
|
#include "buffer.h"
|
||||||
|
|
||||||
#include "bufferview_funcs.h"
|
#include "bufferview_funcs.h"
|
||||||
#include "LaTeX.h"
|
#include "LaTeX.h"
|
||||||
#include "LyXView.h"
|
#include "LyXView.h"
|
||||||
#include "minibuffer.h"
|
#include "minibuffer.h"
|
||||||
#include "lyx_gui_misc.h"
|
#include "lyx_gui_misc.h"
|
||||||
#include "lyx_cb.h"
|
#include "lyx_cb.h" // ShowMessage()
|
||||||
|
|
||||||
using std::map;
|
using std::map;
|
||||||
using std::vector;
|
using std::vector;
|
||||||
using std::queue;
|
using std::queue;
|
||||||
using std::pair;
|
using std::pair;
|
||||||
using std::sort;
|
using std::sort;
|
||||||
using std::stack;
|
|
||||||
using std::endl;
|
using std::endl;
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////////
|
||||||
@ -46,6 +41,14 @@ using std::endl;
|
|||||||
map<string, Format> Formats::formats;
|
map<string, Format> Formats::formats;
|
||||||
vector<Command> Converter::commands;
|
vector<Command> Converter::commands;
|
||||||
|
|
||||||
|
inline
|
||||||
|
string add_options(string const & command, string const & options)
|
||||||
|
{
|
||||||
|
string head;
|
||||||
|
string tail = split(command, head, ' ');
|
||||||
|
return head + ' ' + options + ' ' + tail;
|
||||||
|
}
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
Format::Format(string const & n)
|
Format::Format(string const & n)
|
||||||
@ -83,17 +86,17 @@ void Formats::Add(string const & name)
|
|||||||
|
|
||||||
void Formats::SetViewer(string const & name, string const & command)
|
void Formats::SetViewer(string const & name, string const & command)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
string command2 = subst(command, "$$FName", "'$$FName'");
|
||||||
|
if (!contains(command,"$$FName"))
|
||||||
|
command2 += " '$$FName'";
|
||||||
|
|
||||||
Add(name);
|
Add(name);
|
||||||
Format * f = GetFormat(name);
|
GetFormat(name)->viewer = command2;
|
||||||
if (!f->viewer.empty())
|
|
||||||
lyxerr << "Error: a viewer for " << name
|
|
||||||
<< " is already defined!" << endl;
|
|
||||||
else
|
|
||||||
f->viewer = command;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool Formats::View(string const & filename)
|
bool Formats::View(Buffer * buffer, string const & filename)
|
||||||
{
|
{
|
||||||
string extension = GetExtension(filename);
|
string extension = GetExtension(filename);
|
||||||
Format * format = GetFormat(extension);
|
Format * format = GetFormat(extension);
|
||||||
@ -105,30 +108,24 @@ bool Formats::View(string const & filename)
|
|||||||
}
|
}
|
||||||
|
|
||||||
string command = format->viewer;
|
string command = format->viewer;
|
||||||
|
|
||||||
|
if (extension == "dvi" &&
|
||||||
|
!lyxrc.view_dvi_paper_option.empty()) {
|
||||||
|
string options = lyxrc.view_dvi_paper_option;
|
||||||
|
options += " " + Converter::dvi_papersize(buffer);
|
||||||
|
if (buffer->params.orientation
|
||||||
|
== BufferParams::ORIENTATION_LANDSCAPE)
|
||||||
|
options += 'r';
|
||||||
|
command = add_options(command, options);
|
||||||
|
}
|
||||||
|
|
||||||
|
string command2 = subst(command, "$$FName", OnlyFilename(filename));
|
||||||
|
lyxerr << "Executing command: " << command2 << endl;
|
||||||
|
ShowMessage(buffer, _("Executing command:"), command2);
|
||||||
|
|
||||||
command = subst(command, "$$FName", filename);
|
command = subst(command, "$$FName", filename);
|
||||||
#ifndef __EMX__
|
|
||||||
command += " &";
|
|
||||||
#else
|
|
||||||
// OS/2 cmd.exe has another use for '&'
|
|
||||||
// This is not NLS safe, but it's OK, I think.
|
|
||||||
string sh = OnlyFilename(GetEnvPath("EMXSHELL"));
|
|
||||||
if (sh.empty()) {
|
|
||||||
// COMSPEC is set, unless user unsets
|
|
||||||
sh = OnlyFilename(GetEnvPath("COMSPEC"));
|
|
||||||
if (sh.empty())
|
|
||||||
sh = "cmd.exe";
|
|
||||||
}
|
|
||||||
sh = lowercase(sh);
|
|
||||||
if (contains(sh, "cmd.exe")
|
|
||||||
|| contains(sh, "4os2.exe"))
|
|
||||||
command = "start /min/n " + command;
|
|
||||||
else
|
|
||||||
command += " &";
|
|
||||||
#endif
|
|
||||||
lyxerr << "Executing command: " << command << endl;
|
|
||||||
//ShowMessage(buffer, _("Executing command:"), command);
|
|
||||||
Systemcalls one;
|
Systemcalls one;
|
||||||
int res = one.startscript(Systemcalls::System, command);
|
int res = one.startscript(Systemcalls::SystemDontWait, command);
|
||||||
|
|
||||||
if (res) {
|
if (res) {
|
||||||
WriteAlert(_("Can not view file"),
|
WriteAlert(_("Can not view file"),
|
||||||
@ -149,6 +146,7 @@ Format * Formats::GetFormat(string const & name)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
string const Formats::PrettyName(string const & name)
|
string const Formats::PrettyName(string const & name)
|
||||||
{
|
{
|
||||||
string format;
|
string format;
|
||||||
@ -162,20 +160,26 @@ string const Formats::PrettyName(string const & name)
|
|||||||
|
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
void Converter::Add(string const & from, string const & to,
|
void Converter::Add(string const & from, string const & to,
|
||||||
string const & command, string const & flags)
|
string const & command, string const & flags)
|
||||||
{
|
{
|
||||||
for (vector<Command>::const_iterator cit = commands.begin();
|
if (command == "none")
|
||||||
cit != commands.end(); ++cit)
|
return;
|
||||||
if ((*cit).from == from && (*cit).to == to) {
|
|
||||||
lyxerr << "Error: Convertor from " << from
|
bool original_dir = flags == "origdir";
|
||||||
<< " to " << to
|
string command2 =
|
||||||
<< " already exists!" << endl;
|
subst(command, "$$FName", "'$$FName'");
|
||||||
|
command2 = subst(command2, "$$BaseName", "'$$BaseName'");
|
||||||
|
command2 = subst(command2, "$$OutName", "'$$OutName'");
|
||||||
|
|
||||||
|
for (vector<Command>::iterator it = commands.begin();
|
||||||
|
it != commands.end(); ++it)
|
||||||
|
if ((*it).from == from && (*it).to == to) {
|
||||||
|
*it = Command(from, to, command2, original_dir);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
bool original_dir = flags == "origdir";
|
commands.push_back(Command(from, to, command2, original_dir));
|
||||||
commands.push_back(Command(from, to, command, original_dir));
|
|
||||||
|
|
||||||
Formats::Add(from);
|
Formats::Add(from);
|
||||||
Formats::Add(to);
|
Formats::Add(to);
|
||||||
++Formats::GetFormat(to)->in_degree;
|
++Formats::GetFormat(to)->in_degree;
|
||||||
@ -232,15 +236,16 @@ Converter::GetReachable(string const & from, bool only_viewable)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool Converter::convert(Buffer * buffer, string const & from_file,
|
bool Converter::Convert(Buffer * buffer, string const & from_file,
|
||||||
string const & to_format)
|
string const & to_file, string const & using_format)
|
||||||
|
|
||||||
{
|
{
|
||||||
string format;
|
|
||||||
string using_format = SplitFormat(to_format, format);
|
|
||||||
string from_format = GetExtension(from_file);
|
string from_format = GetExtension(from_file);
|
||||||
if (from_format == format)
|
string to_format = GetExtension(to_file);
|
||||||
return true;
|
if (from_format == to_format)
|
||||||
|
if (from_file != to_file)
|
||||||
|
return lyx::rename(from_file.c_str(), to_file.c_str());
|
||||||
|
else
|
||||||
|
return true;
|
||||||
|
|
||||||
queue< vector<Command>::iterator > Q;
|
queue< vector<Command>::iterator > Q;
|
||||||
for (vector<Command>::iterator it = commands.begin();
|
for (vector<Command>::iterator it = commands.begin();
|
||||||
@ -262,7 +267,7 @@ bool Converter::convert(Buffer * buffer, string const & from_file,
|
|||||||
vector<Command>::iterator it;
|
vector<Command>::iterator it;
|
||||||
while (!Q.empty()) {
|
while (!Q.empty()) {
|
||||||
it = Q.front();
|
it = Q.front();
|
||||||
if ((*it).to == format &&
|
if ((*it).to == to_format &&
|
||||||
(using_format.empty() || using_format == (*it).from)) {
|
(using_format.empty() || using_format == (*it).from)) {
|
||||||
found = true;
|
found = true;
|
||||||
break;
|
break;
|
||||||
@ -285,19 +290,18 @@ bool Converter::convert(Buffer * buffer, string const & from_file,
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
stack< vector<Command>::iterator > S;
|
vector< vector<Command>::iterator > S;
|
||||||
while (it != commands.end()) {
|
while (it != commands.end()) {
|
||||||
S.push(it);
|
S.push_back(it);
|
||||||
it = (*it).previous;
|
it = (*it).previous;
|
||||||
}
|
}
|
||||||
|
|
||||||
//Path p(OnlyPath(buffer->fileName()));
|
|
||||||
Path p(OnlyPath(from_file));
|
Path p(OnlyPath(from_file));
|
||||||
|
|
||||||
string basename = ChangeExtension(from_file, "");
|
string basename = ChangeExtension(from_file, "");
|
||||||
while (!S.empty()) {
|
for (vector< vector<Command>::iterator >::reverse_iterator rit =
|
||||||
it = S.top();
|
S.rbegin(); rit != S.rend(); ++rit) {
|
||||||
S.pop();
|
it = *rit;
|
||||||
lyxerr << "Converting from "
|
lyxerr << "Converting from "
|
||||||
<< (*it).from << " to " << (*it).to << endl;
|
<< (*it).from << " to " << (*it).to << endl;
|
||||||
|
|
||||||
@ -316,6 +320,11 @@ bool Converter::convert(Buffer * buffer, string const & from_file,
|
|||||||
command = subst(command, "$$FName", infile);
|
command = subst(command, "$$FName", infile);
|
||||||
command = subst(command, "$$BaseName", basename);
|
command = subst(command, "$$BaseName", basename);
|
||||||
command = subst(command, "$$OutName", outfile);
|
command = subst(command, "$$OutName", outfile);
|
||||||
|
|
||||||
|
if ((*it).from == "dvi" && (*it).to == "ps")
|
||||||
|
command = add_options(command,
|
||||||
|
dvips_options(buffer));
|
||||||
|
|
||||||
lyxerr << "Calling " << command << endl;
|
lyxerr << "Calling " << command << endl;
|
||||||
ShowMessage(buffer, _("Executing command:"), command);
|
ShowMessage(buffer, _("Executing command:"), command);
|
||||||
|
|
||||||
@ -335,6 +344,14 @@ bool Converter::convert(Buffer * buffer, string const & from_file,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
string result_file = ChangeExtension(from_file, to_format);
|
||||||
|
if (result_file != to_file)
|
||||||
|
if ((*it).from == "tex" &&
|
||||||
|
( (*it).to == "dvi" || (*it).to == "pdf") )
|
||||||
|
return lyx::copy(result_file.c_str(), to_file.c_str());
|
||||||
|
else
|
||||||
|
return lyx::rename(result_file.c_str(), to_file.c_str());
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -408,3 +425,56 @@ bool Converter::runLaTeX(Buffer * buffer, string const & command)
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
string Converter::dvi_papersize(Buffer * buffer)
|
||||||
|
{
|
||||||
|
char real_papersize = buffer->params.papersize;
|
||||||
|
if (real_papersize == BufferParams::PAPER_DEFAULT)
|
||||||
|
real_papersize = lyxrc.default_papersize;
|
||||||
|
|
||||||
|
switch (real_papersize) {
|
||||||
|
case BufferParams::PAPER_A3PAPER:
|
||||||
|
return "a3";
|
||||||
|
case BufferParams::PAPER_A4PAPER:
|
||||||
|
return "a4";
|
||||||
|
case BufferParams::PAPER_A5PAPER:
|
||||||
|
return "a5";
|
||||||
|
case BufferParams::PAPER_B5PAPER:
|
||||||
|
return "b5";
|
||||||
|
case BufferParams::PAPER_EXECUTIVEPAPER:
|
||||||
|
return "foolscap";
|
||||||
|
case BufferParams::PAPER_LEGALPAPER:
|
||||||
|
return "legal";
|
||||||
|
case BufferParams::PAPER_USLETTER:
|
||||||
|
default:
|
||||||
|
return "us";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
string Converter::dvips_options(Buffer * buffer)
|
||||||
|
{
|
||||||
|
string result;
|
||||||
|
if (buffer->params.use_geometry
|
||||||
|
&& buffer->params.papersize2 == BufferParams::VM_PAPER_CUSTOM
|
||||||
|
&& !lyxrc.print_paper_dimension_flag.empty()
|
||||||
|
&& !buffer->params.paperwidth.empty()
|
||||||
|
&& !buffer->params.paperheight.empty()) {
|
||||||
|
// using a custom papersize
|
||||||
|
result = lyxrc.print_paper_dimension_flag;
|
||||||
|
result += ' ' + buffer->params.paperwidth;
|
||||||
|
result += ',' + buffer->params.paperheight;
|
||||||
|
} else {
|
||||||
|
string paper_option = dvi_papersize(buffer);
|
||||||
|
if (paper_option != "letter" ||
|
||||||
|
buffer->params.orientation != BufferParams::ORIENTATION_LANDSCAPE) {
|
||||||
|
// dvips won't accept -t letter -t landscape. In all other
|
||||||
|
// cases, include the paper size explicitly.
|
||||||
|
result = lyxrc.print_paper_flag;
|
||||||
|
result += ' ' + paper_option;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (buffer->params.orientation == BufferParams::ORIENTATION_LANDSCAPE)
|
||||||
|
result += ' ' + lyxrc.print_landscape_flag;
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
@ -70,7 +70,7 @@ public:
|
|||||||
void SetViewer(string const & name, string const & command);
|
void SetViewer(string const & name, string const & command);
|
||||||
///
|
///
|
||||||
static
|
static
|
||||||
bool View(string const & filename);
|
bool View(Buffer * buffer, string const & filename);
|
||||||
///
|
///
|
||||||
static
|
static
|
||||||
Format * GetFormat(string const & name);
|
Format * GetFormat(string const & name);
|
||||||
@ -97,11 +97,16 @@ public:
|
|||||||
bool only_viewable = false);
|
bool only_viewable = false);
|
||||||
///
|
///
|
||||||
static
|
static
|
||||||
bool convert(Buffer * buffer, string const & from_file,
|
bool Convert(Buffer * buffer, string const & from_file,
|
||||||
string const & to_format);
|
string const & to_file, string const & using_format);
|
||||||
///
|
|
||||||
static
|
static
|
||||||
string const SplitFormat(string const & str, string & format);
|
string const SplitFormat(string const & str, string & format);
|
||||||
|
///
|
||||||
|
static
|
||||||
|
string dvi_papersize(Buffer * buffer);
|
||||||
|
///
|
||||||
|
static
|
||||||
|
string dvips_options(Buffer * buffer);
|
||||||
private:
|
private:
|
||||||
///
|
///
|
||||||
static
|
static
|
||||||
|
@ -462,7 +462,7 @@ Encoding iso8859_2("latin2",tab_iso8859_2);
|
|||||||
Encoding iso8859_3("latin3",tab_iso8859_3);
|
Encoding iso8859_3("latin3",tab_iso8859_3);
|
||||||
Encoding iso8859_4("latin4",tab_iso8859_4);
|
Encoding iso8859_4("latin4",tab_iso8859_4);
|
||||||
Encoding iso8859_6("unknown",tab_iso8859_6_16);
|
Encoding iso8859_6("unknown",tab_iso8859_6_16);
|
||||||
Encoding iso8859_7("unknown",tab_iso8859_7);
|
Encoding iso8859_7("iso-8859-7",tab_iso8859_7);
|
||||||
Encoding iso8859_9("latin5",tab_iso8859_9);
|
Encoding iso8859_9("latin5",tab_iso8859_9);
|
||||||
Encoding cp1255("cp1255",tab_cp1255);
|
Encoding cp1255("cp1255",tab_cp1255);
|
||||||
Encoding koi8("koi8-r",tab_koi8);
|
Encoding koi8("koi8-r",tab_koi8);
|
||||||
|
@ -14,15 +14,11 @@
|
|||||||
#pragma implementation
|
#pragma implementation
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <algorithm>
|
|
||||||
#include <stdio.h>
|
|
||||||
|
|
||||||
#include "exporter.h"
|
#include "exporter.h"
|
||||||
#include "converter.h"
|
#include "converter.h"
|
||||||
|
|
||||||
#include "buffer.h"
|
#include "buffer.h"
|
||||||
#include "lyx_cb.h"
|
#include "lyx_cb.h" //ShowMessage()
|
||||||
#include "support/path.h"
|
#include "support/filetools.h"
|
||||||
|
|
||||||
using std::vector;
|
using std::vector;
|
||||||
using std::pair;
|
using std::pair;
|
||||||
@ -33,39 +29,34 @@ bool Exporter::Export(Buffer * buffer, string const & format0,
|
|||||||
string format;
|
string format;
|
||||||
string using_format = Converter::SplitFormat(format0, format);
|
string using_format = Converter::SplitFormat(format0, format);
|
||||||
|
|
||||||
string filename = buffer->fileName();
|
|
||||||
string backend_format = BufferExtension(buffer);
|
string backend_format = BufferExtension(buffer);
|
||||||
bool only_backend = backend_format == format;
|
bool only_backend = backend_format == format;
|
||||||
|
|
||||||
//string file = buffer->getLatexName(true);
|
string filename = buffer->getLatexName(false);
|
||||||
string file = filename;
|
|
||||||
if (!buffer->tmppath.empty())
|
if (!buffer->tmppath.empty())
|
||||||
file = AddName(buffer->tmppath, file);
|
filename = AddName(buffer->tmppath, filename);
|
||||||
file = ChangeExtension(file, backend_format);
|
filename = ChangeExtension(filename, backend_format);
|
||||||
|
|
||||||
if (buffer->isLinuxDoc())
|
if (buffer->isLinuxDoc())
|
||||||
buffer->makeLinuxDocFile(file, only_backend);
|
buffer->makeLinuxDocFile(filename, only_backend);
|
||||||
else if (only_backend)
|
else if (only_backend)
|
||||||
buffer->makeLaTeXFile(file, string(), true);
|
buffer->makeLaTeXFile(filename, string(), true);
|
||||||
else
|
else
|
||||||
buffer->makeLaTeXFile(file, buffer->filepath, false);
|
buffer->makeLaTeXFile(filename, buffer->filepath, false);
|
||||||
|
|
||||||
bool return_value = Converter::convert(buffer, file, format0);
|
string outfile = (put_in_tempdir)
|
||||||
if (!return_value)
|
? ChangeExtension(filename, format)
|
||||||
|
: ChangeExtension(buffer->getLatexName(false), format);
|
||||||
|
|
||||||
|
if (!Converter::Convert(buffer, filename, outfile, using_format))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (!put_in_tempdir) {
|
if (!put_in_tempdir)
|
||||||
file = ChangeExtension(file, format);
|
|
||||||
string outfile = ChangeExtension(filename, format);
|
|
||||||
if (file != outfile)
|
|
||||||
rename(file.c_str(), outfile.c_str());
|
|
||||||
|
|
||||||
ShowMessage(buffer,
|
ShowMessage(buffer,
|
||||||
_("Document exported as ")
|
_("Document exported as ")
|
||||||
+ Formats::PrettyName(format)
|
+ Formats::PrettyName(format)
|
||||||
+ _(" to file `")
|
+ _(" to file `")
|
||||||
+ MakeDisplayPath(outfile) +'\'');
|
+ MakeDisplayPath(outfile) +'\'');
|
||||||
}
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -78,11 +69,11 @@ bool Exporter::Preview(Buffer * buffer, string const & format0)
|
|||||||
string format;
|
string format;
|
||||||
Converter::SplitFormat(format0, format);
|
Converter::SplitFormat(format0, format);
|
||||||
|
|
||||||
string filename = buffer->fileName();
|
string filename = buffer->getLatexName(false);
|
||||||
if (!buffer->tmppath.empty())
|
if (!buffer->tmppath.empty())
|
||||||
filename = AddName(buffer->tmppath, filename);
|
filename = AddName(buffer->tmppath, filename);
|
||||||
filename = ChangeExtension(filename, format);
|
filename = ChangeExtension(filename, format);
|
||||||
return Formats::View(filename);
|
return Formats::View(buffer, filename);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -25,12 +25,15 @@
|
|||||||
#include "support/filetools.h"
|
#include "support/filetools.h"
|
||||||
#include "support/path.h"
|
#include "support/path.h"
|
||||||
#include "exporter.h"
|
#include "exporter.h"
|
||||||
|
#include "converter.h"
|
||||||
#include "minibuffer.h"
|
#include "minibuffer.h"
|
||||||
|
#include "support/syscall.h"
|
||||||
|
|
||||||
extern LyXRC lyxrc;
|
extern LyXRC lyxrc;
|
||||||
|
#ifndef NEW_EXPORT
|
||||||
extern bool RunScript(Buffer * buffer, bool wait, string const & command,
|
extern bool RunScript(Buffer * buffer, bool wait, string const & command,
|
||||||
string const & orgname = string(), bool need_shell=true);
|
string const & orgname = string(), bool need_shell=true);
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef CXX_WORKING_NAMESPACES
|
#ifdef CXX_WORKING_NAMESPACES
|
||||||
namespace Liason
|
namespace Liason
|
||||||
@ -48,7 +51,9 @@ PrinterParams getPrinterParams(Buffer * buffer)
|
|||||||
|
|
||||||
bool printBuffer(Buffer * buffer, PrinterParams const & pp)
|
bool printBuffer(Buffer * buffer, PrinterParams const & pp)
|
||||||
{
|
{
|
||||||
|
#ifndef NEW_EXPORT
|
||||||
bool result(false);
|
bool result(false);
|
||||||
|
#endif
|
||||||
string command(lyxrc.print_command + ' ');
|
string command(lyxrc.print_command + ' ');
|
||||||
|
|
||||||
if (pp.target == PrinterParams::PRINTER
|
if (pp.target == PrinterParams::PRINTER
|
||||||
@ -88,12 +93,6 @@ bool printBuffer(Buffer * buffer, PrinterParams const & pp)
|
|||||||
command += lyxrc.print_reverse_flag + ' ';
|
command += lyxrc.print_reverse_flag + ' ';
|
||||||
}
|
}
|
||||||
|
|
||||||
BufferParams params(buffer->params);
|
|
||||||
if (params.orientation
|
|
||||||
== BufferParams::ORIENTATION_LANDSCAPE) {
|
|
||||||
command += lyxrc.print_landscape_flag + ' ';
|
|
||||||
}
|
|
||||||
|
|
||||||
if (1 < pp.count_copies) {
|
if (1 < pp.count_copies) {
|
||||||
if (pp.unsorted_copies) {
|
if (pp.unsorted_copies) {
|
||||||
command += lyxrc.print_copies_flag;
|
command += lyxrc.print_copies_flag;
|
||||||
@ -109,57 +108,63 @@ bool printBuffer(Buffer * buffer, PrinterParams const & pp)
|
|||||||
command += lyxrc.print_extra_options + ' ';
|
command += lyxrc.print_extra_options + ' ';
|
||||||
}
|
}
|
||||||
|
|
||||||
char real_papersize = params.papersize;
|
command += Converter::dvips_options(buffer) + ' ';
|
||||||
if (real_papersize == BufferParams::PAPER_DEFAULT) {
|
|
||||||
real_papersize = lyxrc.default_papersize;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (params.use_geometry
|
#ifdef NEW_EXPORT
|
||||||
&& params.papersize2 == BufferParams::VM_PAPER_CUSTOM
|
if (!Exporter::Export(buffer, "dvi", true))
|
||||||
&& !lyxrc.print_paper_dimension_flag.empty()
|
return false;
|
||||||
&& !params.paperwidth.empty()
|
|
||||||
&& !params.paperheight.empty()) {
|
|
||||||
// using a custom papersize
|
|
||||||
command += lyxrc.print_paper_dimension_flag + ' ';
|
|
||||||
command += params.paperwidth + ',';
|
|
||||||
command += params.paperheight + ' ';
|
|
||||||
} else if (!lyxrc.print_paper_flag.empty()
|
|
||||||
&& (real_papersize != BufferParams::PAPER_USLETTER
|
|
||||||
|| params.orientation
|
|
||||||
== BufferParams::ORIENTATION_PORTRAIT)) {
|
|
||||||
// There's a problem with US Letter + landscape
|
|
||||||
string paper;
|
|
||||||
switch (real_papersize) {
|
|
||||||
case BufferParams::PAPER_USLETTER:
|
|
||||||
paper = "letter";
|
|
||||||
break;
|
|
||||||
case BufferParams::PAPER_A3PAPER:
|
|
||||||
paper = "a3";
|
|
||||||
break;
|
|
||||||
case BufferParams::PAPER_A4PAPER:
|
|
||||||
paper = "a4";
|
|
||||||
break;
|
|
||||||
case BufferParams::PAPER_A5PAPER:
|
|
||||||
paper = "a5";
|
|
||||||
break;
|
|
||||||
case BufferParams::PAPER_B5PAPER:
|
|
||||||
paper = "b5";
|
|
||||||
break;
|
|
||||||
case BufferParams::PAPER_EXECUTIVEPAPER:
|
|
||||||
paper = "foolscap";
|
|
||||||
break;
|
|
||||||
case BufferParams::PAPER_LEGALPAPER:
|
|
||||||
paper = "legal";
|
|
||||||
break;
|
|
||||||
default: /* If nothing else fits, keep empty value */
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
if (!paper.empty()) {
|
|
||||||
command += lyxrc.print_paper_flag + ' ';
|
|
||||||
command += paper + ' ';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
// Push directory path.
|
||||||
|
string path = OnlyPath(buffer->fileName());
|
||||||
|
if (lyxrc.use_tempdir || (IsDirWriteable(path) < 1)) {
|
||||||
|
path = buffer->tmppath;
|
||||||
|
}
|
||||||
|
Path p(path);
|
||||||
|
|
||||||
|
// there are three cases here:
|
||||||
|
// 1. we print to a file
|
||||||
|
// 2. we print direct to a printer
|
||||||
|
// 3. we print using a spool command (print to file first)
|
||||||
|
Systemcalls one;
|
||||||
|
int res = 0;
|
||||||
|
string dviname = ChangeExtension(buffer->getLatexName(true), "dvi");
|
||||||
|
switch (pp.target) {
|
||||||
|
case PrinterParams::PRINTER:
|
||||||
|
if (!lyxrc.print_spool_command.empty()) {
|
||||||
|
// case 3
|
||||||
|
string psname = ChangeExtension(dviname, ".ps");
|
||||||
|
command += lyxrc.print_to_file
|
||||||
|
+ QuoteName(psname) + ' ';
|
||||||
|
command += 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
|
||||||
|
lyxerr << "command1 = " << command << endl;
|
||||||
|
lyxerr << "command2 = " << command2 << endl;
|
||||||
|
res = one.startscript(Systemcalls::System, command);
|
||||||
|
if (res == 0)
|
||||||
|
res = one.startscript(Systemcalls::SystemDontWait,
|
||||||
|
command2);
|
||||||
|
} else
|
||||||
|
// case 2
|
||||||
|
res = one.startscript(Systemcalls::SystemDontWait, command);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case PrinterParams::FILE:
|
||||||
|
// case 1
|
||||||
|
command += lyxrc.print_to_file
|
||||||
|
+ QuoteName(MakeAbsPath(pp.file_name, path));
|
||||||
|
command += ' ' + QuoteName(dviname);
|
||||||
|
lyxerr << "command1 = " << command << endl;
|
||||||
|
res = one.startscript(Systemcalls::SystemDontWait, command);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return res == 0;
|
||||||
|
#else
|
||||||
// Push directory path if necessary.
|
// Push directory path if necessary.
|
||||||
// PS file should go where the source file is unless it's a
|
// PS file should go where the source file is unless it's a
|
||||||
// read-only directory in which case we write it to tmpdir.
|
// read-only directory in which case we write it to tmpdir.
|
||||||
@ -172,7 +177,6 @@ bool printBuffer(Buffer * buffer, PrinterParams const & pp)
|
|||||||
}
|
}
|
||||||
Path p(path);
|
Path p(path);
|
||||||
|
|
||||||
#ifndef NEW_EXPORT
|
|
||||||
// there are three cases here:
|
// there are three cases here:
|
||||||
// 1. we print to a file
|
// 1. we print to a file
|
||||||
// 2. we print direct to a printer
|
// 2. we print direct to a printer
|
||||||
@ -209,8 +213,8 @@ bool printBuffer(Buffer * buffer, PrinterParams const & pp)
|
|||||||
result = RunScript(buffer, false, command);
|
result = RunScript(buffer, false, command);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
return result;
|
return result;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void setMinibuffer(LyXView * lv, char const * msg)
|
void setMinibuffer(LyXView * lv, char const * msg)
|
||||||
|
@ -1122,9 +1122,6 @@ int LyXRC::read(string const & filename)
|
|||||||
command = lexrc.GetString();
|
command = lexrc.GetString();
|
||||||
if (lexrc.next())
|
if (lexrc.next())
|
||||||
flags = lexrc.GetString();
|
flags = lexrc.GetString();
|
||||||
command = subst(command, "$$FName", "'$$FName'");
|
|
||||||
command = subst(command, "$$BaseName", "'$$BaseName'");
|
|
||||||
command = subst(command, "$$OutName", "'$$OutName'");
|
|
||||||
Converter::Add(from, to, command, flags);
|
Converter::Add(from, to, command, flags);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -1135,7 +1132,6 @@ int LyXRC::read(string const & filename)
|
|||||||
format = lexrc.GetString();
|
format = lexrc.GetString();
|
||||||
if (lexrc.next())
|
if (lexrc.next())
|
||||||
command = lexrc.GetString();
|
command = lexrc.GetString();
|
||||||
command = subst(command, "$$FName", "'$$FName'");
|
|
||||||
Formats::SetViewer(format, command);
|
Formats::SetViewer(format, command);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -33,6 +33,7 @@ libsupport_la_SOURCES = \
|
|||||||
abort.C \
|
abort.C \
|
||||||
block.h \
|
block.h \
|
||||||
chdir.C \
|
chdir.C \
|
||||||
|
copy.C \
|
||||||
date.C \
|
date.C \
|
||||||
filetools.C \
|
filetools.C \
|
||||||
filetools.h \
|
filetools.h \
|
||||||
@ -50,6 +51,7 @@ libsupport_la_SOURCES = \
|
|||||||
path.C \
|
path.C \
|
||||||
path.h \
|
path.h \
|
||||||
putenv.C \
|
putenv.C \
|
||||||
|
rename.C \
|
||||||
$(REGEX) syscall.C \
|
$(REGEX) syscall.C \
|
||||||
syscall.h \
|
syscall.h \
|
||||||
syscontr.C \
|
syscontr.C \
|
||||||
|
15
src/support/copy.C
Normal file
15
src/support/copy.C
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
#include <config.h>
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
#include "support/lyxlib.h"
|
||||||
|
#include "LString.h"
|
||||||
|
#include "support/syscall.h"
|
||||||
|
#include "support/filetools.h"
|
||||||
|
|
||||||
|
bool lyx::copy(char const * from, char const * to)
|
||||||
|
{
|
||||||
|
string command = "cp " + QuoteName(from) + " " + QuoteName(to);
|
||||||
|
return Systemcalls().startscript(Systemcalls::System,
|
||||||
|
command) == 0;
|
||||||
|
}
|
@ -26,6 +26,10 @@ namespace lyx {
|
|||||||
char * getcwd(char * buffer, size_t size);
|
char * getcwd(char * buffer, size_t size);
|
||||||
///
|
///
|
||||||
int chdir(char const * name);
|
int chdir(char const * name);
|
||||||
|
/// Returns false it it fails
|
||||||
|
bool rename(char const * from, char const * to);
|
||||||
|
/// Returns false it it fails
|
||||||
|
bool copy(char const * from, char const * to);
|
||||||
/// generates a checksum
|
/// generates a checksum
|
||||||
unsigned long sum(char const * file);
|
unsigned long sum(char const * file);
|
||||||
/// returns a date string (not used currently)
|
/// returns a date string (not used currently)
|
||||||
@ -48,6 +52,10 @@ struct lyx {
|
|||||||
static char * getcwd(char * buffer, size_t size);
|
static char * getcwd(char * buffer, size_t size);
|
||||||
///
|
///
|
||||||
static int chdir(char const * name);
|
static int chdir(char const * name);
|
||||||
|
/// Returns false it it fails
|
||||||
|
static bool rename(char const * from, char const * to);
|
||||||
|
/// Returns false it it fails
|
||||||
|
static bool copy(char const * from, char const * to);
|
||||||
/// generates a checksum
|
/// generates a checksum
|
||||||
static unsigned long sum(char const * file);
|
static unsigned long sum(char const * file);
|
||||||
/// returns a date string (not used currently)
|
/// returns a date string (not used currently)
|
||||||
|
10
src/support/rename.C
Normal file
10
src/support/rename.C
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
#include <config.h>
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
#include "support/lyxlib.h"
|
||||||
|
|
||||||
|
bool lyx::rename(char const * from, char const * to)
|
||||||
|
{
|
||||||
|
return ::rename(from, to) != -1;
|
||||||
|
}
|
@ -50,6 +50,7 @@ int Systemcalls::startscript() {
|
|||||||
retval = 0;
|
retval = 0;
|
||||||
switch (start) {
|
switch (start) {
|
||||||
case System:
|
case System:
|
||||||
|
case SystemDontWait:
|
||||||
retval = system(command.c_str());
|
retval = system(command.c_str());
|
||||||
callback();
|
callback();
|
||||||
break;
|
break;
|
||||||
@ -193,6 +194,29 @@ int Systemcalls::startscript(Starttype how, string const & what,
|
|||||||
cbk = cback;
|
cbk = cback;
|
||||||
pid = static_cast<pid_t>(0); // yet no child
|
pid = static_cast<pid_t>(0); // yet no child
|
||||||
retval = 0;
|
retval = 0;
|
||||||
|
|
||||||
|
if (how == SystemDontWait) {
|
||||||
|
#ifndef __EMX__
|
||||||
|
command += " &";
|
||||||
|
#else
|
||||||
|
// OS/2 cmd.exe has another use for '&'
|
||||||
|
// This is not NLS safe, but it's OK, I think.
|
||||||
|
string sh = OnlyFilename(GetEnvPath("EMXSHELL"));
|
||||||
|
if (sh.empty()) {
|
||||||
|
// COMSPEC is set, unless user unsets
|
||||||
|
sh = OnlyFilename(GetEnvPath("COMSPEC"));
|
||||||
|
if (sh.empty())
|
||||||
|
sh = "cmd.exe";
|
||||||
|
}
|
||||||
|
sh = lowercase(sh);
|
||||||
|
if (contains(sh, "cmd.exe")
|
||||||
|
|| contains(sh, "4os2.exe"))
|
||||||
|
command = "start /min/n " + command;
|
||||||
|
else
|
||||||
|
command += " &";
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
return startscript();
|
return startscript();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -32,6 +32,7 @@ public:
|
|||||||
///
|
///
|
||||||
enum Starttype {
|
enum Starttype {
|
||||||
System, // Uses system() which uses /bin/sh
|
System, // Uses system() which uses /bin/sh
|
||||||
|
SystemDontWait, // Uses system() which uses /bin/sh
|
||||||
Wait, // Uses fork() and execvp()
|
Wait, // Uses fork() and execvp()
|
||||||
DontWait // Uses fork() and execvp()
|
DontWait // Uses fork() and execvp()
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user