mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-25 05:55:34 +00:00
Converter patch from Dekel, Preference patch from Angus, menu patch from Rob
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@1212 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
0c978e6a3f
commit
0a16442310
58
ChangeLog
58
ChangeLog
@ -1,3 +1,59 @@
|
||||
2000-11-13 Jean-Marc Lasgouttes <Jean-Marc.Lasgouttes@inria.fr>
|
||||
|
||||
* src/converter.C: add "using" directive.
|
||||
|
||||
* src/frontends/xforms/FormPreferences.C: add "using" directive.
|
||||
(compare_converter): add "int" as return type.
|
||||
|
||||
* src/frontends/xforms/Color.C: comment out FL_LIGHTER_COL1 here
|
||||
too.
|
||||
|
||||
2000-11-11 Angus Leeming <a.leeming@ic.ac.uk>
|
||||
|
||||
* src/lyx_gui.C (create_forms): map the xform colours, should a
|
||||
mapping exist. Ie, call XformColor::read().
|
||||
|
||||
* src/frontends/xforms/Color.[Ch] renamed struct RGB as RGBColor
|
||||
and struct HSV as HSVColor.
|
||||
(XformColor::read, XformColor::write) : new methods that
|
||||
input/output any changes to the cform GUI colors.
|
||||
|
||||
* src/frontends/xforms/Dialogs.C: FORMS_H_LOCATION no longer
|
||||
included.
|
||||
|
||||
* src/frontends/xforms/FormPreferences.C Lots of little changes
|
||||
associated with the changed name of the RGB and HSV structs. Can
|
||||
now save changes to xforms GUI to file. Commented out
|
||||
FL_LIGHTER_COL1 to allow compilation with xforms 0.88. It isn't
|
||||
used currently anyway.
|
||||
|
||||
2000-11-11 Dekel Tsur <dekelts@tau.ac.il>
|
||||
|
||||
* src/converter.C: A lot of changes:
|
||||
- It is no longer possible to choose between two or more ways to
|
||||
export to some format (the new code uses only the shortest path).
|
||||
However, it is still possible to choose between pdflatex/ps2pdf
|
||||
for creating a PDF file, by defining two PDF formats: pdf & pdf2.
|
||||
- Added several methods that makes the FormPreferences code simpler.
|
||||
- Changed the tokens $$FName and $$OutName to $$i and $$o.
|
||||
|
||||
* src/exporter.C (Export): lyxrc.use_pdf is set before
|
||||
makeLaTeXFile is called. This works but not very nice.
|
||||
|
||||
* src/frontends/xforms/FormPreferences.C: The formats/converters
|
||||
tabs are now fully functional.
|
||||
|
||||
* src/buffer.C (getTocList): Add numbers to the captions.
|
||||
|
||||
* lib/lyxrc.example: Removed fax section
|
||||
|
||||
* src/support/rename.C (rename): Delete the old file if lyx::copy
|
||||
is called.
|
||||
|
||||
2000-11-13 Rob Lahaye <lahaye@postech.edu>
|
||||
|
||||
* lib/ui/default.ui: minor polishing.
|
||||
|
||||
2000-11-10 Jean-Marc Lasgouttes <Jean-Marc.Lasgouttes@inria.fr>
|
||||
|
||||
* src/frontends/xforms/Color.C: include <algorithm> and <cmath>
|
||||
@ -105,7 +161,7 @@
|
||||
|
||||
2000-11-08 Dekel Tsur <dekelts@tau.ac.il>
|
||||
|
||||
* src/frontends/xforms/FormParagraph.C (updateLanguage): Check
|
||||
* src/frontends/xforms/FormPreferences.C (updateLanguage): Check
|
||||
iterators to prevent crash.
|
||||
|
||||
2000-11-08 Angus Leeming <a.leeming@ic.ac.uk>
|
||||
|
85
lib/configure
vendored
85
lib/configure
vendored
@ -222,7 +222,7 @@ if test -z "$tex_to_lyx_command" ; then
|
||||
fi
|
||||
|
||||
PATH=${save_PATH}
|
||||
test $tex_to_lyx_command = "reLyX" && tex_to_lyx_command="reLyX -f \$\$FName"
|
||||
test $tex_to_lyx_command = "reLyX" && tex_to_lyx_command="reLyX -f \$\$i"
|
||||
|
||||
echo $ac_n "checking for a Noweb -> LyX converter""... $ac_c"
|
||||
echo "$ac_t""(noweb2lyx)"
|
||||
@ -258,7 +258,7 @@ if test -z "$literate_to_lyx_command" ; then
|
||||
literate_to_lyx_command=none
|
||||
fi
|
||||
|
||||
test $literate_to_lyx_command = "noweb2lyx" && literate_to_lyx_command="noweb2lyx \$\$FName \$\$OutName"
|
||||
test $literate_to_lyx_command = "noweb2lyx" && literate_to_lyx_command="noweb2lyx \$\$i \$\$o"
|
||||
|
||||
# Search something to process a literate document
|
||||
echo $ac_n "checking for a Noweb -> LaTeX converter""... $ac_c"
|
||||
@ -295,7 +295,7 @@ if test -z "$literate_to_tex_command" ; then
|
||||
literate_to_tex_command=none
|
||||
fi
|
||||
|
||||
test $literate_to_tex_command = "noweave" && literate_to_tex_command="noweave -delay -index \$\$FName > \$\$OutName"
|
||||
test $literate_to_tex_command = "noweave" && literate_to_tex_command="noweave -delay -index \$\$i > \$\$o"
|
||||
|
||||
echo $ac_n "checking for a HTML -> Latex converter""... $ac_c"
|
||||
echo "$ac_t""(html2latex)"
|
||||
@ -331,7 +331,7 @@ if test -z "$html_to_latex_command" ; then
|
||||
html_to_latex_command=none
|
||||
fi
|
||||
|
||||
test $html_to_latex_command = "html2latex" && html_to_latex_command="html2latex \$\$FName"
|
||||
test $html_to_latex_command = "html2latex" && html_to_latex_command="html2latex \$\$i"
|
||||
|
||||
echo $ac_n "checking for a MSWord -> Latex converter""... $ac_c"
|
||||
echo "$ac_t""(wvCleanLatex word2x)"
|
||||
@ -367,8 +367,8 @@ if test -z "$word_to_latex_command" ; then
|
||||
word_to_latex_command=none
|
||||
fi
|
||||
|
||||
test $word_to_latex_command = "wvCleanLatex" && word_to_latex_command="wvCleanLatex \$\$FName \$\$OutName"
|
||||
test $word_to_latex_command = "word2x" && word_to_latex_command="word2x -f latex \$\$FName"
|
||||
test $word_to_latex_command = "wvCleanLatex" && word_to_latex_command="wvCleanLatex \$\$i \$\$o"
|
||||
test $word_to_latex_command = "word2x" && word_to_latex_command="word2x -f latex \$\$i"
|
||||
|
||||
echo $ac_n "checking for Image converter""... $ac_c"
|
||||
echo "$ac_t""(convert)"
|
||||
@ -404,7 +404,7 @@ if test -z "$image_command" ; then
|
||||
image_command=none
|
||||
fi
|
||||
|
||||
test $image_command = "convert" && image_command="convert \$\$FName \$\$OutName"
|
||||
test $image_command = "convert" && image_command="convert \$\$i \$\$o"
|
||||
|
||||
# Search for a Postscript interpreter
|
||||
echo $ac_n "checking for a Postscript interpreter""... $ac_c"
|
||||
@ -621,7 +621,7 @@ 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"
|
||||
test $ps_to_pdf_command = "ps2pdf" && ps_to_pdf_command="ps2pdf \$\$i"
|
||||
|
||||
# Search for a program to convert dvi to ps
|
||||
echo $ac_n "checking for a DVI to PS converter""... $ac_c"
|
||||
@ -658,7 +658,7 @@ if test -z "$dvi_to_ps_command" ; then
|
||||
dvi_to_ps_command=none
|
||||
fi
|
||||
|
||||
test $dvi_to_ps_command = "dvips" && dvi_to_ps_command="dvips -o \$\$OutName \$\$FName"
|
||||
test $dvi_to_ps_command = "dvips" && dvi_to_ps_command="dvips -o \$\$o \$\$i"
|
||||
|
||||
# Search a *roff program (used to translate tables in ASCII export)
|
||||
echo $ac_n "checking for a *roff formatter""... $ac_c"
|
||||
@ -809,7 +809,7 @@ if test -z "$fax_command" ; then
|
||||
fax_command=none
|
||||
fi
|
||||
|
||||
test $fax_command = "ksendfax" && fax_command="ksendfax \$\$FName"
|
||||
test $fax_command = "ksendfax" && fax_command="ksendfax \$\$i"
|
||||
|
||||
# Search for LinuxDoc support
|
||||
echo $ac_n "checking for SGML-tools 1.x (LinuxDoc)""... $ac_c"
|
||||
@ -854,10 +854,10 @@ fi
|
||||
|
||||
case $LINUXDOC in
|
||||
sgml2lyx)
|
||||
linuxdoc_to_latex_command="sgml2latex \$\$FName"
|
||||
linuxdoc_to_dvi_command="sgml2latex -o dvi \$\$FName"
|
||||
linuxdoc_to_html_command="sgml2html \$\$FName"
|
||||
linuxdoc_to_lyx_command="sgml2lyx \$\$FName";;
|
||||
linuxdoc_to_latex_command="sgml2latex \$\$i"
|
||||
linuxdoc_to_dvi_command="sgml2latex -o dvi \$\$i"
|
||||
linuxdoc_to_html_command="sgml2html \$\$i"
|
||||
linuxdoc_to_lyx_command="sgml2lyx \$\$i";;
|
||||
none)
|
||||
linuxdoc_to_latex_command="none"
|
||||
linuxdoc_to_dvi_command="none"
|
||||
@ -908,11 +908,11 @@ fi
|
||||
|
||||
case $DOCBOOK in
|
||||
sgmltools)
|
||||
docbook_to_dvi_command="sgmltools -b dvi \$\$FName"
|
||||
docbook_to_html_command="sgmltools -b html \$\$FName";;
|
||||
docbook_to_dvi_command="sgmltools -b dvi \$\$i"
|
||||
docbook_to_html_command="sgmltools -b html \$\$i";;
|
||||
db2dvi)
|
||||
docbook_to_dvi_command="db2dvi \$\$FName"
|
||||
docbook_to_html_command="db2html \$\$FName";;
|
||||
docbook_to_dvi_command="db2dvi \$\$i"
|
||||
docbook_to_html_command="db2html \$\$i";;
|
||||
none)
|
||||
docbook_to_dvi_command="none"
|
||||
docbook_to_html_command="none";;
|
||||
@ -997,9 +997,9 @@ fi
|
||||
|
||||
latex_to_html_command=$TOHTML
|
||||
case $TOHTML in
|
||||
tth) latex_to_html_command="tth -t -e2 -L\$\$BaseName < \$\$FName > \$\$OutName";;
|
||||
latex2html) latex_to_html_command="latex2html -no_subdir -split 0 -show_section_numbers \$\$FName";;
|
||||
hevea) latex_to_html_command="hevea -s \$\$FName";;
|
||||
tth) latex_to_html_command="tth -t -e2 -L\$\$b < \$\$i > \$\$o";;
|
||||
latex2html) latex_to_html_command="latex2html -no_subdir -split 0 -show_section_numbers \$\$i";;
|
||||
hevea) latex_to_html_command="hevea -s \$\$i";;
|
||||
esac
|
||||
|
||||
#### Explore the LaTeX configuration
|
||||
@ -1085,23 +1085,30 @@ cat >lyxrc.defaults <<EOF
|
||||
# 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
|
||||
# override the values given here.
|
||||
\\Format latex tex LaTeX L
|
||||
\\Format dvi dvi DVI D
|
||||
\\Format ps ps Postscript t
|
||||
\\Format pdf pdf PDF P
|
||||
\\Format html html HTML H
|
||||
\\Format text txt ASCII A
|
||||
\\Format word doc Word W
|
||||
\\Format literate nw NoWeb N
|
||||
\\Format linuxdoc sgml LinuxDoc x
|
||||
\\Format text txt ASCII A
|
||||
\\Format textparagraph txt ASCII(paragraphs) ""
|
||||
\\Format docbook sgml DocBook B
|
||||
\\Format program "" Program ""
|
||||
\\Format dvi dvi DVI D
|
||||
\\Format eps eps EPS ""
|
||||
\\Format fax "" Fax ""
|
||||
\\Format gif gif GIF ""
|
||||
\\Format html html HTML H
|
||||
\\Format jpg jpg JPEG ""
|
||||
\\Format latex tex LaTeX L
|
||||
\\Format linuxdoc sgml LinuxDoc x
|
||||
\\Format lyx lyx LyX ""
|
||||
\\Format literate nw NoWeb N
|
||||
\\Format pdf pdf PDF P
|
||||
\\Format pdf2 pdf "PDF (pdflatex)" F
|
||||
\\Format png png PNG ""
|
||||
\\Format ps ps Postscript t
|
||||
\\Format program "" Program ""
|
||||
\\Format word doc Word W
|
||||
|
||||
\\converter latex dvi "$LATEX" "latex,disable=linuxdoc&docbook"
|
||||
\\converter latex pdf "$PDFLATEX" "latex,disable=linuxdoc&docbook"
|
||||
\\converter latex html "$latex_to_html_command"
|
||||
"originaldir,needaux,disable=linuxdoc&docbook"
|
||||
|
||||
\\converter latex dvi "$LATEX \$\$i" "latex"
|
||||
\\converter latex pdf2 "$PDFLATEX \$\$i" "latex"
|
||||
\\converter latex html "$latex_to_html_command" "originaldir,needaux"
|
||||
\\converter literate latex "$literate_to_tex_command" ""
|
||||
\\converter dvi ps "$dvi_to_ps_command" ""
|
||||
\\converter ps pdf "$ps_to_pdf_command" ""
|
||||
@ -1113,10 +1120,10 @@ cat >lyxrc.defaults <<EOF
|
||||
\\converter docbook dvi "$docbook_to_dvi_command" ""
|
||||
\\converter docbook html "$docbook_to_html_command" ""
|
||||
|
||||
\\converter latex lyx "$tex_to_lyx_command" "importer"
|
||||
\\converter literate lyx "$literate_to_lyx_command" "importer"
|
||||
\\converter html latex "$html_to_latex_command" "importer"
|
||||
\\converter word latex "$word_to_latex_command" "importer"
|
||||
\\converter latex lyx "$tex_to_lyx_command" ""
|
||||
\\converter literate lyx "$literate_to_lyx_command" ""
|
||||
\\converter html latex "$html_to_latex_command" ""
|
||||
\\converter word latex "$word_to_latex_command" ""
|
||||
|
||||
\converter gif eps "$image_command" ""
|
||||
\converter png eps "$image_command" ""
|
||||
|
@ -184,24 +184,24 @@ save_PATH=${PATH}
|
||||
PATH=${PATH}:./reLyX/
|
||||
SEARCH_PROG([for a LaTeX -> LyX converter],tex_to_lyx_command,reLyX)
|
||||
PATH=${save_PATH}
|
||||
test $tex_to_lyx_command = "reLyX" && tex_to_lyx_command="reLyX -f \$\$FName"
|
||||
test $tex_to_lyx_command = "reLyX" && tex_to_lyx_command="reLyX -f \$\$i"
|
||||
|
||||
SEARCH_PROG([for a Noweb -> LyX converter],literate_to_lyx_command,noweb2lyx)
|
||||
test $literate_to_lyx_command = "noweb2lyx" && literate_to_lyx_command="noweb2lyx \$\$FName \$\$OutName"
|
||||
test $literate_to_lyx_command = "noweb2lyx" && literate_to_lyx_command="noweb2lyx \$\$i \$\$o"
|
||||
|
||||
# Search something to process a literate document
|
||||
SEARCH_PROG([for a Noweb -> LaTeX converter],literate_to_tex_command,noweave)
|
||||
test $literate_to_tex_command = "noweave" && literate_to_tex_command="noweave -delay -index \$\$FName > \$\$OutName"
|
||||
test $literate_to_tex_command = "noweave" && literate_to_tex_command="noweave -delay -index \$\$i > \$\$o"
|
||||
|
||||
SEARCH_PROG([for a HTML -> Latex converter],html_to_latex_command,html2latex)
|
||||
test $html_to_latex_command = "html2latex" && html_to_latex_command="html2latex \$\$FName"
|
||||
test $html_to_latex_command = "html2latex" && html_to_latex_command="html2latex \$\$i"
|
||||
|
||||
SEARCH_PROG([for a MSWord -> Latex converter],word_to_latex_command,wvCleanLatex word2x)
|
||||
test $word_to_latex_command = "wvCleanLatex" && word_to_latex_command="wvCleanLatex \$\$FName \$\$OutName"
|
||||
test $word_to_latex_command = "word2x" && word_to_latex_command="word2x -f latex \$\$FName"
|
||||
test $word_to_latex_command = "wvCleanLatex" && word_to_latex_command="wvCleanLatex \$\$i \$\$o"
|
||||
test $word_to_latex_command = "word2x" && word_to_latex_command="word2x -f latex \$\$i"
|
||||
|
||||
SEARCH_PROG([for Image converter],image_command,convert)
|
||||
test $image_command = "convert" && image_command="convert \$\$FName \$\$OutName"
|
||||
test $image_command = "convert" && image_command="convert \$\$i \$\$o"
|
||||
|
||||
# Search for a Postscript interpreter
|
||||
SEARCH_PROG([for a Postscript interpreter],GS, gs)
|
||||
@ -220,11 +220,11 @@ 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"
|
||||
test $ps_to_pdf_command = "ps2pdf" && ps_to_pdf_command="ps2pdf \$\$i"
|
||||
|
||||
# Search for a program to convert dvi to ps
|
||||
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"
|
||||
test $dvi_to_ps_command = "dvips" && dvi_to_ps_command="dvips -o \$\$o \$\$i"
|
||||
|
||||
# Search a *roff program (used to translate tables in ASCII export)
|
||||
SEARCH_PROG([for a *roff formatter],ROFF,groff nroff)
|
||||
@ -254,7 +254,7 @@ dnl fi
|
||||
|
||||
# Search a GUI Fax program
|
||||
SEARCH_PROG([for a fax program], fax_command, ksendfax)
|
||||
test $fax_command = "ksendfax" && fax_command="ksendfax \$\$FName"
|
||||
test $fax_command = "ksendfax" && fax_command="ksendfax \$\$i"
|
||||
|
||||
# Search for LinuxDoc support
|
||||
SEARCH_PROG([for SGML-tools 1.x (LinuxDoc)], LINUXDOC, sgml2lyx)
|
||||
@ -266,10 +266,10 @@ fi
|
||||
|
||||
case $LINUXDOC in
|
||||
sgml2lyx)
|
||||
linuxdoc_to_latex_command="sgml2latex \$\$FName"
|
||||
linuxdoc_to_dvi_command="sgml2latex -o dvi \$\$FName"
|
||||
linuxdoc_to_html_command="sgml2html \$\$FName"
|
||||
linuxdoc_to_lyx_command="sgml2lyx \$\$FName";;
|
||||
linuxdoc_to_latex_command="sgml2latex \$\$i"
|
||||
linuxdoc_to_dvi_command="sgml2latex -o dvi \$\$i"
|
||||
linuxdoc_to_html_command="sgml2html \$\$i"
|
||||
linuxdoc_to_lyx_command="sgml2lyx \$\$i";;
|
||||
none)
|
||||
linuxdoc_to_latex_command="none"
|
||||
linuxdoc_to_dvi_command="none"
|
||||
@ -287,11 +287,11 @@ fi
|
||||
|
||||
case $DOCBOOK in
|
||||
sgmltools)
|
||||
docbook_to_dvi_command="sgmltools -b dvi \$\$FName"
|
||||
docbook_to_html_command="sgmltools -b html \$\$FName";;
|
||||
docbook_to_dvi_command="sgmltools -b dvi \$\$i"
|
||||
docbook_to_html_command="sgmltools -b html \$\$i";;
|
||||
db2dvi)
|
||||
docbook_to_dvi_command="db2dvi \$\$FName"
|
||||
docbook_to_html_command="db2html \$\$FName";;
|
||||
docbook_to_dvi_command="db2dvi \$\$i"
|
||||
docbook_to_html_command="db2html \$\$i";;
|
||||
none)
|
||||
docbook_to_dvi_command="none"
|
||||
docbook_to_html_command="none";;
|
||||
@ -310,9 +310,9 @@ esac
|
||||
SEARCH_PROG([for a LaTeX -> HTML converter], TOHTML, tth latex2html hevea)
|
||||
latex_to_html_command=$TOHTML
|
||||
case $TOHTML in
|
||||
tth) latex_to_html_command="tth -t -e2 -L\$\$BaseName < \$\$FName > \$\$OutName";;
|
||||
latex2html) latex_to_html_command="latex2html -no_subdir -split 0 -show_section_numbers \$\$FName";;
|
||||
hevea) latex_to_html_command="hevea -s \$\$FName";;
|
||||
tth) latex_to_html_command="tth -t -e2 -L\$\$b < \$\$i > \$\$o";;
|
||||
latex2html) latex_to_html_command="latex2html -no_subdir -split 0 -show_section_numbers \$\$i";;
|
||||
hevea) latex_to_html_command="hevea -s \$\$i";;
|
||||
esac
|
||||
|
||||
#### Explore the LaTeX configuration
|
||||
@ -386,23 +386,30 @@ cat >lyxrc.defaults <<EOF
|
||||
# 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
|
||||
# override the values given here.
|
||||
\\Format latex tex LaTeX L
|
||||
\\Format dvi dvi DVI D
|
||||
\\Format ps ps Postscript t
|
||||
\\Format pdf pdf PDF P
|
||||
\\Format html html HTML H
|
||||
\\Format text txt ASCII A
|
||||
\\Format word doc Word W
|
||||
\\Format literate nw NoWeb N
|
||||
\\Format linuxdoc sgml LinuxDoc x
|
||||
\\Format text txt ASCII A
|
||||
\\Format textparagraph txt ASCII(paragraphs) ""
|
||||
\\Format docbook sgml DocBook B
|
||||
\\Format program "" Program ""
|
||||
\\Format dvi dvi DVI D
|
||||
\\Format eps eps EPS ""
|
||||
\\Format fax "" Fax ""
|
||||
\\Format gif gif GIF ""
|
||||
\\Format html html HTML H
|
||||
\\Format jpg jpg JPEG ""
|
||||
\\Format latex tex LaTeX L
|
||||
\\Format linuxdoc sgml LinuxDoc x
|
||||
\\Format lyx lyx LyX ""
|
||||
\\Format literate nw NoWeb N
|
||||
\\Format pdf pdf PDF P
|
||||
\\Format pdf2 pdf "PDF (pdflatex)" F
|
||||
\\Format png png PNG ""
|
||||
\\Format ps ps Postscript t
|
||||
\\Format program "" Program ""
|
||||
\\Format word doc Word W
|
||||
|
||||
\\converter latex dvi "$LATEX" "latex,disable=linuxdoc&docbook"
|
||||
\\converter latex pdf "$PDFLATEX" "latex,disable=linuxdoc&docbook"
|
||||
\\converter latex html "$latex_to_html_command"
|
||||
"originaldir,needaux,disable=linuxdoc&docbook"
|
||||
|
||||
\\converter latex dvi "$LATEX \$\$i" "latex"
|
||||
\\converter latex pdf2 "$PDFLATEX \$\$i" "latex"
|
||||
\\converter latex html "$latex_to_html_command" "originaldir,needaux"
|
||||
\\converter literate latex "$literate_to_tex_command" ""
|
||||
\\converter dvi ps "$dvi_to_ps_command" ""
|
||||
\\converter ps pdf "$ps_to_pdf_command" ""
|
||||
@ -414,10 +421,10 @@ cat >lyxrc.defaults <<EOF
|
||||
\\converter docbook dvi "$docbook_to_dvi_command" ""
|
||||
\\converter docbook html "$docbook_to_html_command" ""
|
||||
|
||||
\\converter latex lyx "$tex_to_lyx_command" "importer"
|
||||
\\converter literate lyx "$literate_to_lyx_command" "importer"
|
||||
\\converter html latex "$html_to_latex_command" "importer"
|
||||
\\converter word latex "$word_to_latex_command" "importer"
|
||||
\\converter latex lyx "$tex_to_lyx_command" ""
|
||||
\\converter literate lyx "$literate_to_lyx_command" ""
|
||||
\\converter html latex "$html_to_latex_command" ""
|
||||
\\converter word latex "$word_to_latex_command" ""
|
||||
|
||||
\converter gif eps "$image_command" ""
|
||||
\converter png eps "$image_command" ""
|
||||
|
@ -340,13 +340,12 @@
|
||||
# The converter command has 4 arguments: The source format, the target format,
|
||||
# the command, and additional flags.
|
||||
# For example, the following defines a DVI->Postscript converter:
|
||||
#\converter dvi ps "dvips -o $$OutName $$FName" ""
|
||||
# The variable name $$FName is replaced with the name of the source file,
|
||||
# and $$OutName is replaced with the name of the target file.
|
||||
#\converter dvi ps "dvips -o $$o $$i" ""
|
||||
# The variable name $$i is replaced with the name of the source file,
|
||||
# and $$o is replaced with the name of the target file.
|
||||
# The flags argument is a list of comma separated flags.
|
||||
# Known flags are
|
||||
# - * : copy the previously defined flags
|
||||
# - importer : The converter is used for importing.
|
||||
# - latex : The converter is latex or its derivatives (pdflatex).
|
||||
# - originaldir : The converter must be invoked in the directory of the lyx
|
||||
# file and not in the temporary directory. This is needed for tex->html
|
||||
@ -354,26 +353,24 @@
|
||||
# - needaux : The converted uses the .aux file, so we need to call latex
|
||||
# before running the converter.
|
||||
# - resultdir=dir : The converter put all the files in dir.
|
||||
# Using "resultdir" is same as "resultdir=$$Basename".
|
||||
# Using "resultdir" is same as "resultdir=$$b".
|
||||
# Note: When exporting, the whole directory will be moved from the temporary
|
||||
# directory to the target directory.
|
||||
# - resultfile=file : Name of main file in the result directory, for example
|
||||
# "index.html" or "$$BaseName.html"
|
||||
# "index.html" or "$$b.html"
|
||||
# If "resultfile" is omitted, the name of this file is assumed to be
|
||||
# "index.format"
|
||||
# - parselog=filtername : filtername is a name of a filter command that takes
|
||||
# the converter error log (from stderr), and converts it to a fake latex .log
|
||||
# file.
|
||||
# - disable=backends : A list of & seperated backend in which the converter
|
||||
# should not be used.
|
||||
# For example:
|
||||
#\converter latex html "latex2html -split 0 $$FName"
|
||||
# "originaldir,needaux,resultdir,disable=linuxdoc&docbook"
|
||||
#\converter latex html "latex2html -split 0 $$i"
|
||||
# "originaldir,needaux,resultdir"
|
||||
#
|
||||
# For literate programming, use something like
|
||||
#\converter literate latex "noweave -delay -index $$FName >$$OutName"
|
||||
#\converter literate latex "noweave -delay -index $$i >$$o"
|
||||
# "parselog=listerrors g"
|
||||
#\converter literate program "build-script $$FName"
|
||||
#\converter literate program "build-script $$i"
|
||||
# "originaldir,parselog=listerrors g"
|
||||
|
||||
# The format command is used to define file formats. It has 4 arguments:
|
||||
@ -459,28 +456,6 @@
|
||||
# Default is "".
|
||||
#\backupdir_path "~/Desktop/Trash/"
|
||||
|
||||
|
||||
#
|
||||
# FAX SECTION #############################################################
|
||||
#
|
||||
|
||||
# In the following, the <$$something> strings are substituted by
|
||||
# reasonable values by LyX. The 's are important as there may be spaces in
|
||||
# the string. The default is auto-detected.
|
||||
# This one is what is used with HylaFax:
|
||||
#\fax_command "sendfax -n -h '$$Host' -c '$$Comment' -x '$$Enterprise' -d '$$Name'@'$$Phone' '$$FName'"
|
||||
# Use this for the efax-command:
|
||||
#\fax_command "faxsend '$$Phone' '$$FName'"
|
||||
|
||||
# This is the name of your phone book. It's per default situated in ~/.lyx/,
|
||||
# but you can override that with an absolute path.
|
||||
#\phone_book phonebook
|
||||
|
||||
# This is how to call an external FAX-program instead of the built-in.
|
||||
# You may also insert $$FName to reference the PostScript file.
|
||||
#\fax_program "myfaxprg '$$FName'"
|
||||
#\fax_program tkhylafax
|
||||
|
||||
#
|
||||
# ASCII EXPORT SECTION ###################################################
|
||||
#
|
||||
|
@ -45,11 +45,11 @@ Menuset
|
||||
Item "Close|C" "buffer-close"
|
||||
Item "Save|S" "buffer-write"
|
||||
Item "Save As...|A" "buffer-write-as"
|
||||
Item "Revert to saved|R" "buffer-reload"
|
||||
Item "Revert to saved|d" "buffer-reload"
|
||||
Submenu "Version control|V" "file_vc"
|
||||
Separator
|
||||
Submenu "Import|m" "file_import"
|
||||
Submenu "Insert|I" "file_insert"
|
||||
Submenu "Import|I" "file_import"
|
||||
Submenu "Insert|r" "file_insert"
|
||||
Separator
|
||||
Submenu "Export|E" "file_export"
|
||||
Item "Print...|P" "buffer-print"
|
||||
@ -70,8 +70,6 @@ Menuset
|
||||
End
|
||||
|
||||
Menu "file_import"
|
||||
Item "Ascii text as lines...|A" "buffer-import text"
|
||||
Item "Ascii text as paragraphs...|p" "buffer-import textparagraph"
|
||||
ImportFormats
|
||||
End
|
||||
|
||||
@ -98,23 +96,23 @@ Menuset
|
||||
|
||||
Menu "edit"
|
||||
Item "Undo|U" "undo"
|
||||
Item "Redo|R" "redo"
|
||||
Item "Redo|d" "redo"
|
||||
Separator
|
||||
Item "Cut|C" "cut"
|
||||
Item "Copy|o" "copy"
|
||||
Item "Paste|P" "paste"
|
||||
Item "Paste|a" "paste"
|
||||
Submenu "Paste external selection|x" "edit_paste"
|
||||
Separator
|
||||
Item "Find & Replace...|F" "find-replace"
|
||||
Separator
|
||||
Submenu "Tabular|T" "edit_tabular"
|
||||
Submenu "Floats & Insets|I" "edit_floats"
|
||||
Separator
|
||||
Item "Spellchecker...|S" "spellchecker"
|
||||
Item "Check TeX|h" "buffer-chktex"
|
||||
Item "Remove all Error boxes|E" "error-remove-all"
|
||||
Separator
|
||||
Item "Preferences...|n" "dialog-preferences"
|
||||
Item "Reconfigure|g" "reconfigure"
|
||||
Item "Preferences...|P" "dialog-preferences"
|
||||
Item "Reconfigure|R" "reconfigure"
|
||||
End
|
||||
|
||||
Menu "edit_paste"
|
||||
@ -158,7 +156,7 @@ Menuset
|
||||
# INSERT MENU
|
||||
#
|
||||
Menu "insert"
|
||||
Item "Math text|M" "math-mode"
|
||||
Item "Math text|t" "math-mode"
|
||||
Item "Math display|d" "math-display"
|
||||
Item "Math panel...|p" "math-panel"
|
||||
Separator
|
||||
@ -167,17 +165,17 @@ Menuset
|
||||
Item "Cross reference...|r" "reference-insert"
|
||||
Item "Label...|L" "label-insert"
|
||||
Item "Footnote|F" "footnote-insert"
|
||||
Item "Marginal note|n" "marginpar-insert"
|
||||
Item "Index entry...|x" "index-insert"
|
||||
Item "Marginal note|M" "marginpar-insert"
|
||||
Item "Index entry...|I" "index-insert"
|
||||
Item "Index entry of last word|w" "index-insert-last"
|
||||
Item "URL...|U" "url-insert"
|
||||
Item "Note...|o" "note-insert"
|
||||
Item "Note...|N" "note-insert"
|
||||
Separator
|
||||
Item "Figure...|g" "figure-insert"
|
||||
Item "Tabular...|T" "dialog-tabular-insert"
|
||||
Item "Tabular...|b" "dialog-tabular-insert"
|
||||
Submenu "Floats|a" "insert_floats"
|
||||
Separator
|
||||
Submenu "Lists & TOC|i" "insert_toc"
|
||||
Submenu "Lists & TOC|O" "insert_toc"
|
||||
End
|
||||
|
||||
Menu "insert_special"
|
||||
|
@ -11,6 +11,7 @@ src/credits.C
|
||||
src/credits_form.C
|
||||
src/CutAndPaste.C
|
||||
src/exporter.C
|
||||
src/ext_l10n.h
|
||||
src/filedlg.C
|
||||
src/FontLoader.C
|
||||
src/form1.C
|
||||
|
@ -25,6 +25,7 @@
|
||||
#include "bufferlist.h"
|
||||
#include "converter.h"
|
||||
#include "exporter.h"
|
||||
#include "importer.h"
|
||||
#include "support/filetools.h"
|
||||
#include "support/lyxfunctional.h"
|
||||
|
||||
@ -199,11 +200,6 @@ Menu & Menu::read(LyXLex & lex)
|
||||
return *this;
|
||||
}
|
||||
|
||||
struct compare_formatpair {
|
||||
bool operator()(FormatPair const & a, FormatPair const & b) {
|
||||
return a.format->prettyname < b.format->prettyname;
|
||||
}
|
||||
};
|
||||
|
||||
void Menu::checkShortcuts() const
|
||||
{
|
||||
@ -273,66 +269,45 @@ void Menu::expand(Menu & tomenu, Buffer * buf) const
|
||||
}
|
||||
break;
|
||||
|
||||
case MenuItem::ImportFormats:
|
||||
case MenuItem::ViewFormats:
|
||||
case MenuItem::UpdateFormats:
|
||||
case MenuItem::ExportFormats: {
|
||||
vector<FormatPair> names;
|
||||
vector<Format const *> formats;
|
||||
kb_action action;
|
||||
if ((*cit).kind() == MenuItem::ViewFormats) {
|
||||
names = Exporter::GetExportableFormats(buf, true);
|
||||
switch ((*cit).kind()) {
|
||||
case MenuItem::ImportFormats:
|
||||
formats = Importer::GetImportableFormats();
|
||||
action = LFUN_IMPORT;
|
||||
break;
|
||||
case MenuItem::ViewFormats:
|
||||
formats = Exporter::GetExportableFormats(buf, true);
|
||||
action = LFUN_PREVIEW;
|
||||
} else if ((*cit).kind() == MenuItem::UpdateFormats) {
|
||||
names = Exporter::GetExportableFormats(buf, true);
|
||||
break;
|
||||
case MenuItem::UpdateFormats:
|
||||
formats = Exporter::GetExportableFormats(buf, true);
|
||||
action = LFUN_UPDATE;
|
||||
} else {
|
||||
names = Exporter::GetExportableFormats(buf, false);
|
||||
break;
|
||||
default:
|
||||
formats = Exporter::GetExportableFormats(buf, false);
|
||||
action = LFUN_EXPORT;
|
||||
}
|
||||
sort(names.begin(), names.end(), compare_formatpair());
|
||||
sort(formats.begin(), formats.end());
|
||||
|
||||
for (vector<FormatPair>::const_iterator fit = names.begin();
|
||||
fit != names.end() ; ++fit) {
|
||||
if ((*fit).format->dummy())
|
||||
for (vector<Format const *>::const_iterator fit = formats.begin();
|
||||
fit != formats.end() ; ++fit) {
|
||||
if ((*fit)->dummy())
|
||||
continue;
|
||||
string fmt = (*fit).format->name;
|
||||
string label = (*fit).format->prettyname;
|
||||
bool same_before =
|
||||
fit != names.begin() &&
|
||||
(*fit).format == (*(fit-1)).format;
|
||||
bool same_after =
|
||||
fit+1 != names.end() &&
|
||||
(*fit).format == (*(fit+1)).format;
|
||||
if ((*fit).from &&
|
||||
(same_before || same_after)) {
|
||||
fmt += ":" + (*fit).from->name;
|
||||
string head;
|
||||
split((*fit).command, head, ' ');
|
||||
label += _(" (using ") + head + ")";
|
||||
if (!(*fit).format->shortcut.empty() &&
|
||||
!same_before)
|
||||
label += "|" + (*fit).format->shortcut;
|
||||
} else if (!(*fit).format->shortcut.empty())
|
||||
label += "|" + (*fit).format->shortcut;
|
||||
int action2 = lyxaction.getPseudoAction(action, fmt);
|
||||
tomenu.add(MenuItem(MenuItem::Command,
|
||||
label, action2));
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case MenuItem::ImportFormats: {
|
||||
vector<FormatPair> names = Converter::GetReachableTo("lyx");
|
||||
sort(names.begin(), names.end(), compare_formatpair());
|
||||
|
||||
for (vector<FormatPair>::const_iterator fit = names.begin();
|
||||
fit != names.end() ; ++fit) {
|
||||
if ((*fit).format->dummy())
|
||||
continue;
|
||||
string fmt = (*fit).format->name;
|
||||
string label = (*fit).format->prettyname;
|
||||
if (!(*fit).format->shortcut.empty())
|
||||
label += "|" + (*fit).format->shortcut;
|
||||
int action2 = lyxaction.getPseudoAction(LFUN_IMPORT, fmt);
|
||||
string label = (*fit)->prettyname();
|
||||
if ((*cit).kind() == MenuItem::ImportFormats)
|
||||
if ((*fit)->name() == "text")
|
||||
label = _("Ascii text as lines");
|
||||
else if ((*fit)->name() == "textparagraph")
|
||||
label = _("Ascii text as paragraphs");
|
||||
if (!(*fit)->shortcut().empty())
|
||||
label += "|" + (*fit)->shortcut();
|
||||
int action2 = lyxaction.
|
||||
getPseudoAction(action, (*fit)->name());
|
||||
tomenu.add(MenuItem(MenuItem::Command,
|
||||
label, action2));
|
||||
}
|
||||
|
@ -3547,6 +3547,9 @@ vector<string> const Buffer::getLabelList()
|
||||
|
||||
vector<vector<Buffer::TocItem> > const Buffer::getTocList()
|
||||
{
|
||||
int figs = 0;
|
||||
int tables = 0;
|
||||
int algs = 0;
|
||||
vector<vector<TocItem> > l(4);
|
||||
LyXParagraph * par = paragraph;
|
||||
while (par) {
|
||||
@ -3562,13 +3565,19 @@ vector<vector<Buffer::TocItem> > const Buffer::getTocList()
|
||||
switch (par->footnotekind) {
|
||||
case LyXParagraph::FIG:
|
||||
case LyXParagraph::WIDE_FIG:
|
||||
tmp.str = tostr(++figs) + ". "
|
||||
+ tmp.str;
|
||||
l[TOC_LOF].push_back(tmp);
|
||||
break;
|
||||
case LyXParagraph::TAB:
|
||||
case LyXParagraph::WIDE_TAB:
|
||||
tmp.str = tostr(++tables) + ". "
|
||||
+ tmp.str;
|
||||
l[TOC_LOT].push_back(tmp);
|
||||
break;
|
||||
case LyXParagraph::ALGORITHM:
|
||||
tmp.str = tostr(++algs) + ". "
|
||||
+ tmp.str;
|
||||
l[TOC_LOA].push_back(tmp);
|
||||
break;
|
||||
case LyXParagraph::FOOTNOTE:
|
||||
|
745
src/converter.C
745
src/converter.C
File diff suppressed because it is too large
Load Diff
277
src/converter.h
277
src/converter.h
@ -16,58 +16,142 @@
|
||||
#pragma interface
|
||||
#endif
|
||||
|
||||
#include <map>
|
||||
#include <vector>
|
||||
#include <queue>
|
||||
#include "LString.h"
|
||||
#include "support/lstrings.h"
|
||||
|
||||
class Buffer;
|
||||
|
||||
///
|
||||
class Format {
|
||||
public:
|
||||
///
|
||||
Format() {}
|
||||
///
|
||||
Format(string const & n, string const & e, string const & p,
|
||||
string const & s, string const & v) :
|
||||
name(n), extension(e), prettyname(p), shortcut(s),
|
||||
viewer(v) {};
|
||||
///
|
||||
string name;
|
||||
///
|
||||
string extension;
|
||||
///
|
||||
string prettyname;
|
||||
///
|
||||
string shortcut;
|
||||
///
|
||||
string viewer;
|
||||
name_(n), extension_(e), prettyname_(p), shortcut_(s),
|
||||
viewer_(v) {};
|
||||
///
|
||||
bool dummy() const;
|
||||
///
|
||||
string const getname() const {
|
||||
return name;
|
||||
bool IsChildFormat() const;
|
||||
///
|
||||
string const ParentFormat() const;
|
||||
///
|
||||
string const & name() const {
|
||||
return name_;
|
||||
}
|
||||
///
|
||||
string const getprettyname() const {
|
||||
return prettyname;
|
||||
string const & extension() const {
|
||||
return extension_;
|
||||
}
|
||||
///
|
||||
string const & prettyname() const {
|
||||
return prettyname_;
|
||||
}
|
||||
///
|
||||
string const & shortcut() const {
|
||||
return shortcut_;
|
||||
}
|
||||
///
|
||||
string const & viewer() const {
|
||||
return viewer_;
|
||||
}
|
||||
///
|
||||
void setViewer(string const & v) {
|
||||
viewer_ = v;
|
||||
}
|
||||
friend bool operator<(Format const & a, Format const & b) {
|
||||
return compare_no_case(a.prettyname(),b.prettyname()) < 0;
|
||||
}
|
||||
private:
|
||||
string name_;
|
||||
///
|
||||
string extension_;
|
||||
///
|
||||
string prettyname_;
|
||||
///
|
||||
string shortcut_;
|
||||
///
|
||||
string viewer_;
|
||||
};
|
||||
|
||||
|
||||
///
|
||||
struct Command {
|
||||
class Formats {
|
||||
public:
|
||||
///
|
||||
typedef std::vector<Format> FormatList;
|
||||
///
|
||||
Command(Format const * f, Format const * t, string const & c)
|
||||
: from(f), to(t), command(c), importer(false),
|
||||
typedef FormatList::const_iterator const_iterator;
|
||||
///
|
||||
Format const & Get(int i) const {
|
||||
return formatlist[i];
|
||||
}
|
||||
///
|
||||
Format const * GetFormat(string const & name) const;
|
||||
///
|
||||
int GetNumber(string const & name) const;
|
||||
///
|
||||
void Add(string const & name);
|
||||
///
|
||||
void Add(string const & name, string const & extension,
|
||||
string const & prettyname, string const & shortcut);
|
||||
///
|
||||
void Delete(string const & name);
|
||||
///
|
||||
void Sort();
|
||||
///
|
||||
void SetViewer(string const & name, string const & command);
|
||||
///
|
||||
bool View(Buffer const * buffer, string const & filename,
|
||||
string const & format_name) const;
|
||||
///
|
||||
string const PrettyName(string const & name) const;
|
||||
///
|
||||
string const Extension(string const & name) const;
|
||||
///
|
||||
const_iterator begin() const {
|
||||
return formatlist.begin();
|
||||
}
|
||||
///
|
||||
const_iterator end() const {
|
||||
return formatlist.end();
|
||||
}
|
||||
///
|
||||
FormatList::size_type size() const {
|
||||
return formatlist.size();
|
||||
}
|
||||
private:
|
||||
///
|
||||
FormatList formatlist;
|
||||
};
|
||||
|
||||
///////////////////////////////////////////////////////////////////////
|
||||
|
||||
///
|
||||
class Converter {
|
||||
public:
|
||||
///
|
||||
Converter(string const & f, string const & t, string const & c,
|
||||
string const & l)
|
||||
: from(f), to(t), command(c), flags(l), From(0), To(0),
|
||||
latex(false), original_dir(false), need_aux(false) {}
|
||||
///
|
||||
Format const * from;
|
||||
void ReadFlags();
|
||||
///
|
||||
Format const * to;
|
||||
string from;
|
||||
///
|
||||
string to;
|
||||
///
|
||||
string command;
|
||||
/// The converter is used for importing
|
||||
bool importer;
|
||||
///
|
||||
string flags;
|
||||
///
|
||||
Format const * From;
|
||||
///
|
||||
Format const * To;
|
||||
|
||||
/// The converter is latex or its derivatives
|
||||
bool latex;
|
||||
/// Do we need to run the converter in the original directory?
|
||||
@ -82,123 +166,104 @@ struct Command {
|
||||
string result_file;
|
||||
/// Command to convert the program output to a LaTeX log file format
|
||||
string parselog;
|
||||
/// Backends in which the converter is not used
|
||||
std::vector<string> disable;
|
||||
};
|
||||
|
||||
/// Used by the BFS algorithm
|
||||
bool visited;
|
||||
/// Used by the BFS algorithm
|
||||
std::vector<Command>::iterator previous;
|
||||
|
||||
///
|
||||
class Converters {
|
||||
public:
|
||||
typedef std::vector<Converter> ConverterList;
|
||||
///
|
||||
std::pair<string, string> const getFromToPrettyname() const {
|
||||
return std::pair<string, string>(from->prettyname,
|
||||
to->prettyname);
|
||||
typedef ConverterList::const_iterator const_iterator;
|
||||
///
|
||||
typedef std::vector<int> EdgePath;
|
||||
///
|
||||
Converter const & Get(int i) const {
|
||||
return converterlist[i];
|
||||
}
|
||||
};
|
||||
|
||||
class FormatPair {
|
||||
public:
|
||||
///
|
||||
Format const * format;
|
||||
Converter const * GetConverter(string const & from, string const & to);
|
||||
///
|
||||
Format const * from;
|
||||
int GetNumber(string const & from, string const & to);
|
||||
///
|
||||
string command;
|
||||
///
|
||||
FormatPair(Format const * f1, Format const * f2, string c)
|
||||
: format(f1), from(f2), command(c) {}
|
||||
};
|
||||
|
||||
///
|
||||
class Formats {
|
||||
public:
|
||||
///
|
||||
typedef std::map<string, Format> FormatList;
|
||||
///
|
||||
void Add(string const & name);
|
||||
///
|
||||
void Add(string const & name, string const & extension,
|
||||
string const & prettyname, string const & shortcut);
|
||||
///
|
||||
void SetViewer(string const & name, string const & command);
|
||||
///
|
||||
bool View(Buffer const * buffer, string const & filename,
|
||||
string const & format_name);
|
||||
///
|
||||
Format * GetFormat(string const & name);
|
||||
///
|
||||
string const PrettyName(string const & name);
|
||||
///
|
||||
string const Extension(string const & name);
|
||||
///
|
||||
std::vector<Format> const GetAllFormats() const;
|
||||
private:
|
||||
///
|
||||
FormatList formats;
|
||||
};
|
||||
|
||||
///
|
||||
class Converter {
|
||||
public:
|
||||
///
|
||||
static
|
||||
void Add(string const & from, string const & to,
|
||||
string const & command, string const & flags);
|
||||
//
|
||||
void Delete(string const & from, string const & to);
|
||||
///
|
||||
static
|
||||
std::vector<FormatPair> const GetReachableTo(string const & target);
|
||||
void Sort();
|
||||
///
|
||||
static
|
||||
std::vector<FormatPair> const
|
||||
GetReachable(string const & from, bool only_viewable);
|
||||
std::vector<Format const *> const
|
||||
GetReachableTo(string const & target, bool clear_visited);
|
||||
///
|
||||
std::vector<Format const *> const
|
||||
GetReachable(string const & from, bool only_viewable,
|
||||
bool clear_visited);
|
||||
///
|
||||
static
|
||||
bool IsReachable(string const & from, string const & to);
|
||||
///
|
||||
static
|
||||
EdgePath const GetPath(string const & from, string const & to);
|
||||
///
|
||||
bool UsePdflatex(EdgePath const & path);
|
||||
///
|
||||
bool Convert(Buffer const * buffer,
|
||||
string const & from_file, string const & to_file_base,
|
||||
string const & from_format, string const & to_format,
|
||||
string const & using_format, string & to_file);
|
||||
string & to_file);
|
||||
///
|
||||
static
|
||||
bool Convert(Buffer const * buffer,
|
||||
string const & from_file, string const & to_file_base,
|
||||
string const & from_format, string const & to_format,
|
||||
string const & using_format = string());
|
||||
string const & from_format, string const & to_format);
|
||||
///
|
||||
static
|
||||
string const SplitFormat(string const & str, string & format);
|
||||
///
|
||||
static
|
||||
string const dvi_papersize(Buffer const * buffer);
|
||||
///
|
||||
static
|
||||
string const dvips_options(Buffer const * buffer);
|
||||
///
|
||||
static
|
||||
void init();
|
||||
void Update(Formats const & formats);
|
||||
///
|
||||
static
|
||||
std::vector<Command> const GetAllCommands();
|
||||
void UpdateLast(Formats const & formats);
|
||||
///
|
||||
void BuildGraph();
|
||||
///
|
||||
bool FormatIsUsed(string const & format);
|
||||
///
|
||||
const_iterator begin() const {
|
||||
return converterlist.begin();
|
||||
}
|
||||
const_iterator end() const {
|
||||
return converterlist.end();
|
||||
}
|
||||
private:
|
||||
///
|
||||
static
|
||||
bool scanLog(Buffer const * buffer, string const & command,
|
||||
string const & filename);
|
||||
///
|
||||
static
|
||||
bool runLaTeX(Buffer const * buffer, string const & command);
|
||||
///
|
||||
static
|
||||
std::vector<Command> commands;
|
||||
ConverterList converterlist;
|
||||
///
|
||||
string latex_command;
|
||||
///
|
||||
struct Vertex {
|
||||
std::vector<int> in_vertices;
|
||||
std::vector<int> out_vertices;
|
||||
std::vector<int> out_edges;
|
||||
};
|
||||
///
|
||||
static
|
||||
string latex_command;
|
||||
std::vector<Vertex> vertices;
|
||||
///
|
||||
std::vector<bool> visited;
|
||||
///
|
||||
std::queue<int> Q;
|
||||
///
|
||||
int BFS_init(string const & start, bool clear_visited = true);
|
||||
};
|
||||
|
||||
extern Formats formats;
|
||||
extern Formats system_formats;
|
||||
extern Converters converters;
|
||||
|
||||
extern Formats system_formats;
|
||||
extern Converters system_converters;
|
||||
|
||||
#endif
|
||||
|
@ -14,24 +14,43 @@
|
||||
#pragma implementation
|
||||
#endif
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
#include "exporter.h"
|
||||
#include "buffer.h"
|
||||
#include "lyx_cb.h" //ShowMessage()
|
||||
#include "support/filetools.h"
|
||||
#include "lyxrc.h"
|
||||
#include "converter.h"
|
||||
#include "lyx_gui_misc.h" //WriteAlert
|
||||
|
||||
using std::vector;
|
||||
using std::find;
|
||||
|
||||
bool Exporter::Export(Buffer * buffer, string const & format0,
|
||||
bool Exporter::Export(Buffer * buffer, string const & format,
|
||||
bool put_in_tempdir, string & result_file)
|
||||
{
|
||||
string format;
|
||||
string using_format = Converter::SplitFormat(format0, format);
|
||||
|
||||
string backend_format = (format == "text")
|
||||
? format : BufferFormat(buffer);
|
||||
bool only_backend = backend_format == format;
|
||||
string backend_format;
|
||||
vector<string> backends = Backends(buffer);
|
||||
if (find(backends.begin(), backends.end(), format) == backends.end()) {
|
||||
for (vector<string>::const_iterator it = backends.begin();
|
||||
it != backends.end(); ++it) {
|
||||
Converters::EdgePath p =
|
||||
converters.GetPath(*it, format);
|
||||
if (!p.empty()) {
|
||||
lyxrc.pdf_mode = converters.UsePdflatex(p);
|
||||
backend_format = *it;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (backend_format.empty()) {
|
||||
WriteAlert(_("Can not export file"),
|
||||
_("No information for exporting to ")
|
||||
+ formats.PrettyName(format));
|
||||
return false;
|
||||
}
|
||||
} else
|
||||
backend_format = format;
|
||||
|
||||
string filename = buffer->getLatexName(false);
|
||||
if (!buffer->tmppath.empty())
|
||||
@ -49,7 +68,7 @@ bool Exporter::Export(Buffer * buffer, string const & format0,
|
||||
else if (buffer->isDocBook())
|
||||
buffer->makeDocBookFile(filename, true);
|
||||
// LaTeX backend
|
||||
else if (only_backend)
|
||||
else if (backend_format == format)
|
||||
buffer->makeLaTeXFile(filename, string(), true);
|
||||
else
|
||||
buffer->makeLaTeXFile(filename, buffer->filepath, false);
|
||||
@ -57,9 +76,8 @@ bool Exporter::Export(Buffer * buffer, string const & format0,
|
||||
string outfile_base = (put_in_tempdir)
|
||||
? filename : buffer->getLatexName(false);
|
||||
|
||||
if (!Converter::Convert(buffer, filename, outfile_base,
|
||||
backend_format, format, using_format,
|
||||
result_file))
|
||||
if (!converters.Convert(buffer, filename, outfile_base,
|
||||
backend_format, format, result_file))
|
||||
return false;
|
||||
|
||||
if (!put_in_tempdir)
|
||||
@ -78,32 +96,38 @@ bool Exporter::Export(Buffer * buffer, string const & format,
|
||||
return Export(buffer, format, put_in_tempdir, result_file);
|
||||
}
|
||||
|
||||
bool Exporter::Preview(Buffer * buffer, string const & format0)
|
||||
bool Exporter::Preview(Buffer * buffer, string const & format)
|
||||
{
|
||||
string result_file;
|
||||
if (!Export(buffer, format0, true, result_file))
|
||||
if (!Export(buffer, format, true, result_file))
|
||||
return false;
|
||||
string format;
|
||||
Converter::SplitFormat(format0, format);
|
||||
return formats.View(buffer, result_file, format);
|
||||
}
|
||||
|
||||
|
||||
bool Exporter::IsExportable(Buffer const * buffer, string const & format)
|
||||
{
|
||||
return format == "text" ||
|
||||
Converter::IsReachable(BufferFormat(buffer), format);
|
||||
vector<string> backends = Backends(buffer);
|
||||
for (vector<string>::const_iterator it = backends.begin();
|
||||
it != backends.end(); ++it)
|
||||
if (converters.IsReachable(*it, format))
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
vector<FormatPair> const
|
||||
vector<Format const *> const
|
||||
Exporter::GetExportableFormats(Buffer const * buffer, bool only_viewable)
|
||||
{
|
||||
vector<FormatPair> result =
|
||||
Converter::GetReachable(BufferFormat(buffer), only_viewable);
|
||||
Format * format = formats.GetFormat("text");
|
||||
if (format && (!only_viewable || !format->viewer.empty()))
|
||||
result.push_back(FormatPair(format , 0, ""));
|
||||
vector<string> backends = Backends(buffer);
|
||||
vector<Format const *> result =
|
||||
converters.GetReachable(backends[0], only_viewable, true);
|
||||
for (vector<string>::const_iterator it = backends.begin() + 1;
|
||||
it != backends.end(); ++it) {
|
||||
vector<Format const *> r =
|
||||
converters.GetReachable(*it, only_viewable, false);
|
||||
result.insert(result.end(), r.begin(), r.end());
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@ -119,3 +143,11 @@ string const Exporter::BufferFormat(Buffer const * buffer)
|
||||
else
|
||||
return "latex";
|
||||
}
|
||||
|
||||
vector<string> const Exporter::Backends(Buffer const * buffer)
|
||||
{
|
||||
vector<string> v;
|
||||
v.push_back(BufferFormat(buffer));
|
||||
v.push_back("text");
|
||||
return v;
|
||||
}
|
||||
|
@ -20,7 +20,7 @@
|
||||
#include "LString.h"
|
||||
|
||||
class Buffer;
|
||||
class FormatPair;
|
||||
class Format;
|
||||
|
||||
class Exporter {
|
||||
public:
|
||||
@ -40,12 +40,14 @@ public:
|
||||
bool IsExportable(Buffer const * buffer, string const & format);
|
||||
///
|
||||
static
|
||||
std::vector<FormatPair> const
|
||||
std::vector<Format const *> const
|
||||
GetExportableFormats(Buffer const * buffer, bool only_viewable);
|
||||
///
|
||||
|
||||
///
|
||||
private:
|
||||
static
|
||||
string const BufferFormat(Buffer const * buffer);
|
||||
///
|
||||
static
|
||||
std::vector<string> const Backends(Buffer const * buffer);
|
||||
};
|
||||
#endif
|
||||
|
@ -103,7 +103,7 @@ bool printBuffer(Buffer * buffer, PrinterParams const & pp)
|
||||
command += lyxrc.print_extra_options + ' ';
|
||||
}
|
||||
|
||||
command += Converter::dvips_options(buffer) + ' ';
|
||||
command += converters.dvips_options(buffer) + ' ';
|
||||
|
||||
if (!Exporter::Export(buffer, "dvi", true))
|
||||
return false;
|
||||
|
@ -10,6 +10,7 @@
|
||||
*======================================================*/
|
||||
|
||||
#include <config.h>
|
||||
#include FORMS_H_LOCATION
|
||||
|
||||
#ifdef __GNUG_
|
||||
#pragma implementation
|
||||
@ -17,14 +18,17 @@
|
||||
|
||||
#include <algorithm> // max
|
||||
#include <cmath> // floor
|
||||
#include <fstream> // ofstream
|
||||
#include "Color.h"
|
||||
#include "lyxlex.h"
|
||||
|
||||
using std::max;
|
||||
using std::min;
|
||||
using std::ofstream;
|
||||
|
||||
static int const nohue = -1;
|
||||
|
||||
RGB::RGB( HSV const & hsv )
|
||||
RGBColor::RGBColor( HSVColor const & hsv )
|
||||
{
|
||||
double h = hsv.h;
|
||||
double s = hsv.s;
|
||||
@ -91,7 +95,7 @@ RGB::RGB( HSV const & hsv )
|
||||
}
|
||||
|
||||
|
||||
HSV::HSV( RGB const & rgb )
|
||||
HSVColor::HSVColor( RGBColor const & rgb )
|
||||
{
|
||||
// r, g, b lie in the range 0-1, not 0-255.
|
||||
double r = rgb.r / 255.0;
|
||||
@ -128,3 +132,91 @@ HSV::HSV( RGB const & rgb )
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// sorted by hand to prevent LyXLex from complaining on read().
|
||||
static
|
||||
keyword_item xformTags[] = {
|
||||
// { "\\gui_active_tab", FL_LIGHTER_COL1 },
|
||||
{ "\\gui_background", FL_COL1 },
|
||||
{ "\\gui_buttonbottom", FL_BOTTOM_BCOL },
|
||||
{ "\\gui_buttonleft", FL_LEFT_BCOL },
|
||||
{ "\\gui_buttonright", FL_RIGHT_BCOL },
|
||||
{ "\\gui_buttontop", FL_TOP_BCOL },
|
||||
{ "\\gui_inactive", FL_INACTIVE },
|
||||
{ "\\gui_push_button", FL_YELLOW },
|
||||
{ "\\gui_selected", FL_MCOL },
|
||||
{ "\\gui_text", FL_BLACK }
|
||||
};
|
||||
|
||||
|
||||
static const int xformCount = sizeof(xformTags) / sizeof(keyword_item);
|
||||
|
||||
|
||||
bool XformColor::read(string const & filename)
|
||||
{
|
||||
LyXLex lexrc( xformTags, xformCount );
|
||||
if( !lexrc.setFile( filename ) )
|
||||
return false;
|
||||
|
||||
while( lexrc.IsOK() ) {
|
||||
int le = lexrc.lex();
|
||||
|
||||
switch( le ) {
|
||||
case LyXLex::LEX_UNDEF:
|
||||
lexrc.printError("Unknown tag `$$Token'");
|
||||
continue;
|
||||
case LyXLex::LEX_FEOF:
|
||||
continue;
|
||||
default: break;
|
||||
}
|
||||
|
||||
RGBColor col;
|
||||
|
||||
if( !lexrc.next() ) break;
|
||||
col.r = lexrc.GetInteger();
|
||||
|
||||
if( !lexrc.next() ) break;
|
||||
col.g = lexrc.GetInteger();
|
||||
|
||||
if( !lexrc.next() ) break;
|
||||
col.b = lexrc.GetInteger();
|
||||
|
||||
fl_mapcolor(le, col.r, col.g, col.b);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool XformColor::write(string const & filename)
|
||||
{
|
||||
ofstream os(filename.c_str());
|
||||
if (!os)
|
||||
return false;
|
||||
|
||||
os << "### This file is part of\n"
|
||||
<< "### ========================================================\n"
|
||||
<< "### LyX, The Document Processor\n"
|
||||
<< "###\n"
|
||||
<< "### Copyright 1995 Matthias Ettrich\n"
|
||||
<< "### Copyright 1995-2000 The LyX Team.\n"
|
||||
<< "###\n"
|
||||
<< "### ========================================================\n"
|
||||
<< "\n"
|
||||
<< "# This file is written by LyX, if you want to make your own\n"
|
||||
<< "# modifications you should do them from inside LyX and save\n"
|
||||
<< "\n";
|
||||
|
||||
for( int i = 0; i < xformCount; ++i ) {
|
||||
string tag = xformTags[i].tag;
|
||||
int colorID = xformTags[i].code;
|
||||
RGBColor color;
|
||||
|
||||
fl_getmcolor(colorID, &color.r, &color.g, &color.b);
|
||||
|
||||
os << tag + " "
|
||||
<< color.r << " " << color.g << " " << color.b << "\n";
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -12,7 +12,7 @@
|
||||
#ifndef COLOR_H
|
||||
#define COLOR_H
|
||||
|
||||
#include<utility> // for pair
|
||||
#include <utility> // for pair
|
||||
|
||||
#ifdef __GNUG_
|
||||
#pragma interface
|
||||
@ -20,47 +20,49 @@
|
||||
|
||||
#include "LString.h"
|
||||
|
||||
class HSV;
|
||||
class RGB;
|
||||
class HSVColor;
|
||||
class RGBColor;
|
||||
|
||||
struct HSV {
|
||||
struct HSVColor {
|
||||
double h;
|
||||
double s;
|
||||
double v;
|
||||
HSV() : h(0.0), s(0.0), v(0.0) {}
|
||||
HSV(double hue, double sat, double val) : h(hue), s(sat), v(val) {}
|
||||
HSV( RGB const & );
|
||||
HSVColor() : h(0.0), s(0.0), v(0.0) {}
|
||||
HSVColor(double hue, double sat, double val) : h(hue), s(sat), v(val) {}
|
||||
HSVColor( RGBColor const & );
|
||||
};
|
||||
|
||||
struct RGB {
|
||||
struct RGBColor {
|
||||
int r;
|
||||
int g;
|
||||
int b;
|
||||
RGB() : r(0), g(0), b(0) {}
|
||||
RGB(int red, int green, int blue) : r(red), g(green), b(blue) {}
|
||||
RGB( HSV const & );
|
||||
RGBColor() : r(0), g(0), b(0) {}
|
||||
RGBColor(int red, int green, int blue) : r(red), g(green), b(blue) {}
|
||||
RGBColor( HSVColor const & );
|
||||
};
|
||||
|
||||
typedef std::pair<string, RGB> X11Color;
|
||||
typedef std::pair<string, RGBColor> X11Color;
|
||||
|
||||
/// struct holding xform-specific colors
|
||||
struct XFormColor {
|
||||
struct XformColor {
|
||||
string name;
|
||||
int colorID;
|
||||
RGB col;
|
||||
XFormColor() : colorID(0) {}
|
||||
RGBColor col;
|
||||
XformColor() : colorID(0) {}
|
||||
string const getname() { return name; }
|
||||
static bool read( string const & );
|
||||
static bool write( string const & );
|
||||
};
|
||||
|
||||
inline
|
||||
bool operator==(RGB const & c1, RGB const & c2)
|
||||
bool operator==(RGBColor const & c1, RGBColor const & c2)
|
||||
{
|
||||
return (c1.r == c2.r && c1.g == c2.g && c1.b == c2.b);
|
||||
}
|
||||
|
||||
|
||||
inline
|
||||
bool operator!=(RGB const & c1, RGB const & c2)
|
||||
bool operator!=(RGBColor const & c1, RGBColor const & c2)
|
||||
{
|
||||
return !(c1 == c2);
|
||||
}
|
||||
|
@ -1,5 +1,15 @@
|
||||
/* This file is part of
|
||||
* ======================================================
|
||||
*
|
||||
* LyX, The Document Processor
|
||||
*
|
||||
* Copyright 1995 Matthias Ettrich
|
||||
* Copyright 1995-2000 The LyX Team.
|
||||
*
|
||||
* ======================================================
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
#include FORMS_H_LOCATION
|
||||
|
||||
#include "Dialogs.h"
|
||||
#include "FormCitation.h"
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -46,6 +46,7 @@ struct FD_form_printer;
|
||||
struct FD_form_screen_fonts;
|
||||
struct FD_form_spellchecker;
|
||||
|
||||
|
||||
/** This class provides an XForms implementation of the FormPreferences Dialog.
|
||||
The preferences dialog allows users to set/save their preferences.
|
||||
*/
|
||||
@ -88,7 +89,7 @@ private:
|
||||
*/
|
||||
|
||||
///
|
||||
void applyColors() const;
|
||||
void applyColors(); // not const as modifies modifiedXformPrefs.
|
||||
///
|
||||
void applyConverters() const;
|
||||
///
|
||||
@ -224,6 +225,8 @@ private:
|
||||
///
|
||||
bool ColorsBrowserX11() const;
|
||||
///
|
||||
bool ColorsBrowseDatabase() const;
|
||||
///
|
||||
bool ColorsDatabase() const;
|
||||
///
|
||||
void ColorsLoadBrowserLyX();
|
||||
@ -234,30 +237,30 @@ private:
|
||||
///
|
||||
bool ColorsRGB() const;
|
||||
///
|
||||
int ColorsSearchEntry(RGB const &) const;
|
||||
int ColorsSearchEntry(RGBColor const &) const;
|
||||
|
||||
///
|
||||
bool ConvertersAdd();
|
||||
///
|
||||
bool ConvertersBrowser();
|
||||
///
|
||||
void ConvertersClear() const;
|
||||
///
|
||||
bool ConvertersContainFormat( Format const &) const;
|
||||
void ConvertersUpdateBrowser();
|
||||
///
|
||||
bool ConvertersDelete();
|
||||
///
|
||||
bool ConvertersInput();
|
||||
///
|
||||
bool ConvertersSetCommand( Command & ) const;
|
||||
string const ConverterGetFrom() const;
|
||||
///
|
||||
void ConvertersUpdateChoices();
|
||||
string const ConverterGetTo() const;
|
||||
///
|
||||
void ConvertersUpdateChoices() const;
|
||||
|
||||
bool FormatsAdd();
|
||||
///
|
||||
bool FormatsBrowser();
|
||||
///
|
||||
void FormatsClear() const;
|
||||
void FormatsUpdateBrowser();
|
||||
///
|
||||
bool FormatsDelete();
|
||||
///
|
||||
@ -347,22 +350,21 @@ private:
|
||||
///
|
||||
Combox * combo_kbmap_2;
|
||||
|
||||
/// A vector of Formats, to be manipulated in the Format browser.
|
||||
std::vector<Format> formats_vec;
|
||||
/// A vector of Commands, to be manipulated in the Converter browser.
|
||||
std::vector<Command> commands_vec;
|
||||
/// A vector of RGB colors and associated name.
|
||||
static std::vector<X11Color> colorDB;
|
||||
/// A vector of xform RGB colors and associated name.
|
||||
static std::vector<XFormColor> xformColorDB;
|
||||
static std::vector<XformColor> xformColorDB;
|
||||
/** A collection of kmap files.
|
||||
First entry is the file name, full path.
|
||||
Second entry is the shorthand, as appears in the fl_choice.
|
||||
Eg, system_lyxdir/kbd/american2.kmap, american2
|
||||
*/
|
||||
static std::pair<std::vector<string>, std::vector<string> > dirlist;
|
||||
///
|
||||
/** Flag whether a warning has been posted to the text window.
|
||||
If so, don't redraw the window when the mouse leaves an object. */
|
||||
bool warningPosted;
|
||||
/// Flag whether Xforms colors have been changed since last file save.
|
||||
bool modifiedXformPrefs;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
100
src/importer.C
100
src/importer.C
@ -14,6 +14,8 @@
|
||||
#pragma implementation
|
||||
#endif
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
#include "importer.h"
|
||||
#include "converter.h"
|
||||
#include "LyXView.h"
|
||||
@ -21,12 +23,16 @@
|
||||
#include "minibuffer.h"
|
||||
#include "bufferlist.h"
|
||||
#include "support/filetools.h"
|
||||
#include "lyx_gui_misc.h" //WriteAlert
|
||||
|
||||
using std::vector;
|
||||
using std::find;
|
||||
|
||||
extern BufferList bufferlist;
|
||||
extern void InsertAsciiFile(BufferView *, string const &, bool);
|
||||
|
||||
|
||||
void Importer::Import(LyXView * lv, string const & filename,
|
||||
bool Importer::Import(LyXView * lv, string const & filename,
|
||||
string const & format)
|
||||
{
|
||||
string displaypath = MakeDisplayPath(filename);
|
||||
@ -34,36 +40,80 @@ void Importer::Import(LyXView * lv, string const & filename,
|
||||
|
||||
string lyxfile = ChangeExtension(filename, ".lyx");
|
||||
|
||||
bool result = true;
|
||||
if (format == "text" || format == "textparagraph") {
|
||||
lv->view()->buffer(bufferlist.newFile(lyxfile, string(), true));
|
||||
bool as_paragraphs = format == "textparagraph";
|
||||
InsertAsciiFile(lv->view(), filename, as_paragraphs);
|
||||
lv->getLyXFunc()->Dispatch(LFUN_MARK_OFF);
|
||||
} else {
|
||||
result = Converter::Convert(0, filename, filename, format, "lyx");
|
||||
if (result) {
|
||||
Buffer * buffer = bufferlist.loadLyXFile(lyxfile);
|
||||
if (buffer)
|
||||
lv->view()->buffer(buffer);
|
||||
else
|
||||
result = false;
|
||||
string loader_format;
|
||||
vector<string> loaders = Loaders();
|
||||
if (find(loaders.begin(), loaders.end(), format) == loaders.end()) {
|
||||
for (vector<string>::const_iterator it = loaders.begin();
|
||||
it != loaders.end(); ++it) {
|
||||
if (converters.IsReachable(format, *it)) {
|
||||
if (!converters.Convert(0, filename, filename,
|
||||
format, *it))
|
||||
return false;
|
||||
loader_format = *it;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (loader_format.empty()) {
|
||||
WriteAlert(_("Can not import file"),
|
||||
_("No information for importing from ")
|
||||
+ formats.PrettyName(format));
|
||||
return false;
|
||||
}
|
||||
} else
|
||||
loader_format = format;
|
||||
|
||||
|
||||
if (loader_format == "lyx") {
|
||||
Buffer * buffer = bufferlist.loadLyXFile(lyxfile);
|
||||
if (buffer)
|
||||
lv->view()->buffer(buffer);
|
||||
} else {
|
||||
lv->view()->buffer(bufferlist.newFile(lyxfile, string(), true));
|
||||
bool as_paragraphs = loader_format == "textparagraph";
|
||||
string filename2 = (loader_format == format) ? filename
|
||||
: ChangeExtension(filename,
|
||||
formats.Extension(loader_format));
|
||||
InsertAsciiFile(lv->view(), filename2, as_paragraphs);
|
||||
lv->getLyXFunc()->Dispatch(LFUN_MARK_OFF);
|
||||
}
|
||||
|
||||
// we are done
|
||||
if (result)
|
||||
lv->getMiniBuffer()->Set(displaypath, _("imported."));
|
||||
else
|
||||
lv->getMiniBuffer()->Set(displaypath, _(": import failed."));
|
||||
|
||||
lv->getMiniBuffer()->Set(displaypath, _("imported."));
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
#if 0
|
||||
bool Importer::IsImportable(string const & format)
|
||||
{
|
||||
if (format == "text" || format == "textparagraph")
|
||||
return true;
|
||||
else
|
||||
return Converter::IsReachable(format, "lyx");
|
||||
vector<string> loaders = Loaders();
|
||||
for (vector<string>::const_iterator it = loaders.begin();
|
||||
it != loaders.end(); ++it)
|
||||
if (converters.IsReachable(format, *it))
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
|
||||
vector<Format const *> const Importer::GetImportableFormats()
|
||||
{
|
||||
vector<string> loaders = Loaders();
|
||||
vector<Format const *> result =
|
||||
converters.GetReachableTo(loaders[0], true);
|
||||
for (vector<string>::const_iterator it = loaders.begin() + 1;
|
||||
it != loaders.end(); ++it) {
|
||||
vector<Format const *> r =
|
||||
converters.GetReachableTo(*it, false);
|
||||
result.insert(result.end(), r.begin(), r.end());
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
vector<string> const Importer::Loaders()
|
||||
{
|
||||
vector<string> v;
|
||||
v.push_back("lyx");
|
||||
v.push_back("text");
|
||||
v.push_back("textparagraph");
|
||||
return v;
|
||||
}
|
||||
|
@ -16,17 +16,29 @@
|
||||
#pragma interface
|
||||
#endif
|
||||
|
||||
#include <vector>
|
||||
#include "LString.h"
|
||||
|
||||
class LyXView;
|
||||
class Format;
|
||||
|
||||
class Importer {
|
||||
public:
|
||||
///
|
||||
static
|
||||
void Import(LyXView * lv, string const & filename,
|
||||
bool Import(LyXView * lv, string const & filename,
|
||||
string const & format);
|
||||
#if 0
|
||||
///
|
||||
static
|
||||
bool IsImportable(string const & format);
|
||||
#endif
|
||||
///
|
||||
static
|
||||
std::vector<Format const *> const GetImportableFormats();
|
||||
private:
|
||||
///
|
||||
static
|
||||
std::vector<string> const Loaders();
|
||||
};
|
||||
#endif
|
||||
|
@ -657,13 +657,13 @@ int InsetGraphics::Latex(Buffer const *buf, ostream & os,
|
||||
|
||||
// How do we decide to what format should we export?
|
||||
string extension = GetExtension(params.filename);
|
||||
//if (pdf) {
|
||||
if (lyxrc.pdf_mode) {
|
||||
if (extension != "jpg")
|
||||
Converter::Convert(buf,
|
||||
converters.Convert(buf,
|
||||
params.filename, params.filename,
|
||||
extension, "png");
|
||||
//} else
|
||||
Converter::Convert(buf, params.filename, params.filename,
|
||||
} else
|
||||
converters.Convert(buf, params.filename, params.filename,
|
||||
extension, "eps");
|
||||
|
||||
return 1;
|
||||
|
@ -42,6 +42,7 @@
|
||||
#include "language.h"
|
||||
#include "ColorHandler.h"
|
||||
#include "frontends/GUIRunTime.h"
|
||||
#include "frontends/xforms/Color.h"
|
||||
|
||||
using std::endl;
|
||||
|
||||
@ -58,6 +59,7 @@ extern LyXServer * lyxserver;
|
||||
extern bool finished; // flag, that we are quitting the program
|
||||
extern BufferList bufferlist;
|
||||
extern GUIRunTime guiruntime;
|
||||
extern string user_lyxdir;
|
||||
|
||||
FL_CMD_OPT cmdopt[] =
|
||||
{
|
||||
@ -368,6 +370,13 @@ void LyXGUI::create_forms()
|
||||
fl_set_form_atclose(fd_latex_log->LaTeXLog,
|
||||
CancelCloseBoxCB, 0);
|
||||
|
||||
// This is probably as good a time as any to map the xform colours,
|
||||
// should a mapping exist.
|
||||
{
|
||||
string filename = user_lyxdir + "/preferences.xform";
|
||||
XformColor::read( filename );
|
||||
}
|
||||
|
||||
// Show the main & title form
|
||||
int main_placement = FL_PLACE_CENTER | FL_FREE_SIZE;
|
||||
int title_placement = FL_PLACE_CENTER;
|
||||
|
@ -401,6 +401,7 @@ void LyX::init(int */*argc*/, char **argv, bool gui)
|
||||
ReadRcFile("lyxrc.defaults");
|
||||
system_lyxrc = lyxrc;
|
||||
system_formats = formats;
|
||||
system_converters = converters;
|
||||
|
||||
// If there is a preferences file we read that instead
|
||||
// of the old lyxrc file.
|
||||
@ -408,7 +409,8 @@ void LyX::init(int */*argc*/, char **argv, bool gui)
|
||||
ReadRcFile("lyxrc");
|
||||
|
||||
/// Init Converter
|
||||
Converter::init();
|
||||
converters.Update(formats);
|
||||
converters.BuildGraph();
|
||||
|
||||
// Read encodings
|
||||
ReadEncodingsFile("encodings");
|
||||
|
@ -351,9 +351,6 @@ LyXFunc::func_status LyXFunc::getStatus(int ac) const
|
||||
!Exporter::IsExportable(buf, argument);
|
||||
break;
|
||||
#endif
|
||||
case LFUN_IMPORT:
|
||||
disable = !Importer::IsImportable(argument);
|
||||
break;
|
||||
case LFUN_UNDO:
|
||||
disable = buf->undostack.empty();
|
||||
break;
|
||||
@ -3156,8 +3153,7 @@ void LyXFunc::doImport(string const & argument)
|
||||
AddPath(system_lyxdir, "examples"));
|
||||
string text = _("Select ") + formats.PrettyName(format)
|
||||
+ _(" file to import");
|
||||
string format2 = (format == "textparagraph") ? "text" : format;
|
||||
string extension = "*." + formats.Extension(format2);
|
||||
string extension = "*." + formats.Extension(format);
|
||||
filename = fileDlg.Select(text, initpath, extension);
|
||||
AllowInput(owner->view());
|
||||
|
||||
|
98
src/lyxrc.C
98
src/lyxrc.C
@ -859,7 +859,10 @@ int LyXRC::read(string const & filename)
|
||||
command = lexrc.GetString();
|
||||
if (lexrc.next())
|
||||
flags = lexrc.GetString();
|
||||
Converter::Add(from, to, command, flags);
|
||||
if (command.empty() || command == "none")
|
||||
converters.Delete(from, to);
|
||||
else
|
||||
converters.Add(from, to, command, flags);
|
||||
break;
|
||||
}
|
||||
case RC_VIEWER: {
|
||||
@ -881,7 +884,16 @@ int LyXRC::read(string const & filename)
|
||||
prettyname = lexrc.GetString();
|
||||
if (lexrc.next())
|
||||
shortcut = lexrc.GetString();
|
||||
formats.Add(format, extension, prettyname, shortcut);
|
||||
if (prettyname.empty()) {
|
||||
if (converters.FormatIsUsed(format))
|
||||
lyxerr << "Can't delete format "
|
||||
<< format << endl;
|
||||
else
|
||||
formats.Delete(format);
|
||||
|
||||
} else
|
||||
formats.Add(format, extension, prettyname,
|
||||
shortcut);
|
||||
break;
|
||||
}
|
||||
case RC_DEFAULT_LANGUAGE:
|
||||
@ -1475,39 +1487,65 @@ void LyXRC::output(ostream & os) const
|
||||
<< "# FORMATS SECTION ##########################\n"
|
||||
<< "#\n\n";
|
||||
|
||||
case RC_FORMAT: {
|
||||
vector<Format> formats_vec = formats.GetAllFormats();
|
||||
vector<Format> sys_formats_vec = system_formats.GetAllFormats();
|
||||
for (vector<Format>::const_iterator it = formats_vec.begin();
|
||||
it != formats_vec.end(); ++it) {
|
||||
Format const * format = system_formats.GetFormat(it->name);
|
||||
if (!format || format->extension != it->extension ||
|
||||
format->prettyname != it->prettyname ||
|
||||
format->shortcut != it->shortcut)
|
||||
os << "\\format \"" << it->name << "\" \""
|
||||
<< it->extension << "\" \""
|
||||
<< it->prettyname << "\" \""
|
||||
<< it->shortcut << "\"\n";
|
||||
case RC_FORMAT:
|
||||
// Look for deleted formats
|
||||
for (Formats::const_iterator cit = formats.begin();
|
||||
cit != formats.end(); ++cit) {
|
||||
Format const * format =
|
||||
system_formats.GetFormat(cit->name());
|
||||
if (!format ||
|
||||
format->extension() != cit->extension() ||
|
||||
format->prettyname() != cit->prettyname() ||
|
||||
format->shortcut() != cit->shortcut())
|
||||
os << "\\format \"" << cit->name() << "\" \""
|
||||
<< cit->extension() << "\" \""
|
||||
<< cit->prettyname() << "\" \""
|
||||
<< cit->shortcut() << "\"\n";
|
||||
}
|
||||
|
||||
for (vector<Format>::const_iterator it = sys_formats_vec.begin();
|
||||
it != sys_formats_vec.end(); ++it)
|
||||
if (!formats.GetFormat(it->name))
|
||||
os << "\\format \"" << it->name
|
||||
// New/modifed formats
|
||||
for (Formats::const_iterator cit = system_formats.begin();
|
||||
cit != system_formats.end(); ++cit)
|
||||
if (!formats.GetFormat(cit->name()))
|
||||
os << "\\format \"" << cit->name()
|
||||
<< "\" \"\" \"\" \"\"\n";
|
||||
}
|
||||
case RC_VIEWER: {
|
||||
vector<Format> formats_vec = formats.GetAllFormats();
|
||||
for (vector<Format>::const_iterator it = formats_vec.begin();
|
||||
it != formats_vec.end(); ++it) {
|
||||
Format const * format = system_formats.GetFormat(it->name);
|
||||
if ((!format || format->viewer != it->viewer) &&
|
||||
(format || !it->viewer.empty()))
|
||||
os << "\\viewer \"" << it->name << "\" \""
|
||||
<< it->viewer << "\"\n";
|
||||
case RC_VIEWER:
|
||||
for (Formats::const_iterator cit = formats.begin();
|
||||
cit != formats.end(); ++cit) {
|
||||
Format const * format =
|
||||
system_formats.GetFormat(cit->name());
|
||||
if ((!format || format->viewer() != cit->viewer()) &&
|
||||
(format || !cit->viewer().empty()))
|
||||
os << "\\viewer \"" << cit->name() << "\" \""
|
||||
<< cit->viewer() << "\"\n";
|
||||
}
|
||||
}
|
||||
|
||||
os << "\n#\n"
|
||||
<< "# CONVERTERS SECTION ##########################\n"
|
||||
<< "#\n\n";
|
||||
|
||||
case RC_CONVERTER:
|
||||
// Look for new converters
|
||||
for (Converters::const_iterator cit = converters.begin();
|
||||
cit != converters.end(); ++cit) {
|
||||
Converter const * converter =
|
||||
system_converters.GetConverter(cit->from,
|
||||
cit->to);
|
||||
if (!converter ||
|
||||
converter->command != cit->command ||
|
||||
converter->flags != cit->flags)
|
||||
os << "\\converter \"" << cit->from << "\" \""
|
||||
<< cit->to << "\" \""
|
||||
<< cit->command << "\" \""
|
||||
<< cit->flags << "\"\n";
|
||||
}
|
||||
|
||||
// New/modifed converters
|
||||
for (Converters::const_iterator cit = system_converters.begin();
|
||||
cit != system_converters.end(); ++cit)
|
||||
if (!converters.GetConverter(cit->from, cit->to))
|
||||
os << "\\converter \"" << cit->from
|
||||
<< "\" \"" << cit->to << "\" \"\" \"\"\n";
|
||||
}
|
||||
os.flush();
|
||||
}
|
||||
|
@ -7,6 +7,10 @@
|
||||
bool lyx::rename(string const & from, string const & to)
|
||||
{
|
||||
if (::rename(from.c_str(), to.c_str()) == -1)
|
||||
return lyx::copy(from, to);
|
||||
if (lyx::copy(from, to)) {
|
||||
lyx::unlink(from);
|
||||
return true;
|
||||
} else
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user