Commit Graph

299 Commits

Author SHA1 Message Date
Julien Rioux
35b580fb30 lyxpreview: Simplify the color handling.
Let's have this in trunk for testing. The real difference maker
when it comes to color is whether we use dvipng or ghostscript.

For dvipng:

  - The color info is passed as command-line arguments.

  - The tightpage option is not necessary, and since it adds
    ps specials to the output, we shouldn't use it.

For ghostscript:

  - The color info needs to be in the latex file.

  - The foreground color is set for each preview inset.

  - The background color is set by \pagecolor in the preamble,
    which is understood by pdflatex, but ignored in dvips mode.
    Thus dvips is handled with a ps special.

  - The tightpage option is necessary to crop the images.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@39797 a592a061-630c-0410-9148-cb99ea01b6c8
2011-10-03 16:43:33 +00:00
Julien Rioux
873f0f4297 lyxpreview: Simplify the handling of lilypond-book.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@39796 a592a061-630c-0410-9148-cb99ea01b6c8
2011-10-03 16:35:29 +00:00
Julien Rioux
13b1277cd2 lyxpreview: Handle bibtex-generated references and bibliography.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@39795 a592a061-630c-0410-9148-cb99ea01b6c8
2011-10-03 16:35:27 +00:00
Julien Rioux
2645d57d89 * lyxpreview_tool.py : Allow to look for commands with arguments.
For example, find_exe(["bibtex -min-crossrefs=7"]) should search for
bibtex and if it is found, return the string "bibtex -min-crossrefs=7".

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@39794 a592a061-630c-0410-9148-cb99ea01b6c8
2011-10-03 16:35:25 +00:00
Enrico Forestieri
e75302bbce Fix another thinko from r38243.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@39773 a592a061-630c-0410-9148-cb99ea01b6c8
2011-09-27 07:28:12 +00:00
Enrico Forestieri
968ab69e88 Fix the following problem with Python 2.4:
Traceback (most recent call last):
  File "/opt/src/lyx-devel/lib/scripts/lyxpreview2bitmap.py", line 535, in ?
    exit(main(sys.argv)[0])
TypeError: 'str' object is not callable



git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@39769 a592a061-630c-0410-9148-cb99ea01b6c8
2011-09-26 15:57:17 +00:00
Enrico Forestieri
a55f54b903 Let lyxpreview2bitmap.py also work on Windows when the PyWin extension modules
are not installed.


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@39741 a592a061-630c-0410-9148-cb99ea01b6c8
2011-09-24 01:27:40 +00:00
Tommaso Cucinotta
71ebf846bb Adding the script missing from last commit.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@39707 a592a061-630c-0410-9148-cb99ea01b6c8
2011-09-19 00:37:15 +00:00
Tommaso Cucinotta
b4f97b61cf Added support for natively zipped file formats that do not need decompression for being handled by converters
(e.g., compressed dia, odg, sxd, ...). These need to be marked via the "zipped=native" flag in the RC file.
The old 'dia' configuration is automatically updated (it used to be hardcoded in the code, now it is handled
via the flag).
See also http://www.mail-archive.com/lyx-devel@lists.lyx.org/msg170974.html


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@39705 a592a061-630c-0410-9148-cb99ea01b6c8
2011-09-19 00:12:09 +00:00
Enrico Forestieri
40d4d94b01 Also include in the archive the files referenced in ERT in the document body.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@39692 a592a061-630c-0410-9148-cb99ea01b6c8
2011-09-16 14:40:40 +00:00
Enrico Forestieri
45aa989efc Use the normalized path for checking whether it has already been gathered.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@39691 a592a061-630c-0410-9148-cb99ea01b6c8
2011-09-16 12:03:54 +00:00
Enrico Forestieri
517cfe9266 Check whether the filename is really a file. Also protect against recursive
inclusions.


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@39690 a592a061-630c-0410-9148-cb99ea01b6c8
2011-09-16 10:07:56 +00:00
Julien Rioux
a55ef8346a Allow to assign several extension to a given file format (#4798).
Additionnal extensions are separated by commas (,) in lyxrc
preference files, while spaces are ignored, e.g. "jpg, jpeg".

Preference lyxrc file format incremented to 2.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@39670 a592a061-630c-0410-9148-cb99ea01b6c8
2011-09-13 20:42:23 +00:00
Julien Rioux
0fb13b648c * prefs2prefs.py : Use a list of [format, conversions] pair.
Use a list of [int, list of functions] pair, representing
      - int: the format number, and
      - list of functions: what needs to be done to the file to
                           update it to the given format number.

    This matches what is done in lyx2lyx and helps keeping track of
    format numbers and their corresponding conversion routines.

    Also, add another sanity check.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@39668 a592a061-630c-0410-9148-cb99ea01b6c8
2011-09-12 20:43:06 +00:00
Julien Rioux
ba02c43178 * prefs2prefs.py : Error when both -l and -p are given, update usage.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@39667 a592a061-630c-0410-9148-cb99ea01b6c8
2011-09-12 20:42:53 +00:00
Julien Rioux
603be7fe2f * prefs2prefs.py : Don't choke on empty input file.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@39666 a592a061-630c-0410-9148-cb99ea01b6c8
2011-09-12 20:42:40 +00:00
Julien Rioux
454598b928 * layout2layout.py : Don't choke on empty input file.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@39665 a592a061-630c-0410-9148-cb99ea01b6c8
2011-09-12 20:42:22 +00:00
Julien Rioux
45280f6bb5 Refine the lyxpreview legacy conversion (the ghostscript one).
- Break up steps 1, 2 and 3 from the legacy preview mechanism.
    These are really separate steps.

      1) Add color info, run latex
      2) Run dvips
      3) Run ghostscript

  - In the case of pdf output, skip step 2 and go directly to step 3.
  - Make sure that we fall back to the legacy conversion whenever we can.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@39661 a592a061-630c-0410-9148-cb99ea01b6c8
2011-09-11 18:23:41 +00:00
Julien Rioux
bb55234cac Better error and progress messages for lyxpreview.
Introduce --debug and --verbose flags to control output. Also, use the
python subprocess module to capture stderr from external commands, thus
bumping the python requirement to version 2.4 or later.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@39660 a592a061-630c-0410-9148-cb99ea01b6c8
2011-09-11 18:23:29 +00:00
Julien Rioux
81420e405f Merge the preview mechanism for japanese with the standard one.
- Japanese is now handled by passing the option --latex=platex
    to the standard lyxpreview script. This is done in PreviewLoader.
  - Remove obsoleted file lyxpreview-platex2bitmap.py and the
    corresponding lines in the configure script.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@39659 a592a061-630c-0410-9148-cb99ea01b6c8
2011-09-11 18:23:15 +00:00
Julien Rioux
10868c31ac Merge the preview mechanism for lilypond-book with the standard one.
- Handle the preprocessing in the main lyxpreview script with the
    command-line arguments --lilypond and --lilypond-book=exe.
  - Remove the obsoleted file lyxpreview-lytex2bitmap.py and the
    corresponding lines in configure.py.

Fix for the japanese preview still to come.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@39658 a592a061-630c-0410-9148-cb99ea01b6c8
2011-09-11 18:22:59 +00:00
Julien Rioux
2bd747fad4 Add command-line arguments to lyxpreview2bitmap.py
Add command-line arguments in a standard unix fashion, using getopt.

    Usage: ./lyxpreview2bitmap.py <options> <input file>

    Options:
      -h, --help:    Show this help screen and exit
      --dpi=<res>:   Resolution per inch (default: 128)
      --png, --ppm:  Select the output format (default: png)
      --fg=<color>:  Foreground color (default: black, ie '000000')
      --bg=<color>:  Background color (default: white, ie 'ffffff')
      --latex=<exe>: Specify the executable for latex (default: latex)

    The colors are hexadecimal strings, eg 'faf0e6'.

The changes to PreviewLoader.cpp break the preview of lilypond-book
and japanese files, but they will be handled in the next commits.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@39657 a592a061-630c-0410-9148-cb99ea01b6c8
2011-09-11 18:22:43 +00:00
Julien Rioux
675f233f34 Some clean up of the lyxpreview code.
Move some common variables to lyxpreview_tools. Otherwise,
add a few variable names, making it easier to track things.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@39656 a592a061-630c-0410-9148-cb99ea01b6c8
2011-09-11 18:22:29 +00:00
Julien Rioux
2dfa11904f Stylictic-only changes to lyxpreview.
Whitespace and line endings only, in preparation for some serious work.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@39655 a592a061-630c-0410-9148-cb99ea01b6c8
2011-09-11 18:22:12 +00:00
Jean-Marc Lasgouttes
7fc83acb5e Add possibility to export the R code from a sweave-enabled document
(patch from yihui, part of #7555)
http://www.lyx.org/trac/ticket/7555#comment:18

This adds the new format "R/S code" with extension .R and a converter from .Rnw.



git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@39509 a592a061-630c-0410-9148-cb99ea01b6c8
2011-08-23 10:33:42 +00:00
Jean-Marc Lasgouttes
c9d9bde0b2 Sweave support cleanup (patch from yihui, see #7555)
http://www.lyx.org/trac/ticket/7555

This part is a simple cleanup:

 * rename variables to start with a dot
 * reset encoding after running sweave
 * improve on-screen display of code chunks



git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@39506 a592a061-630c-0410-9148-cb99ea01b6c8
2011-08-23 09:52:21 +00:00
Jean-Marc Lasgouttes
ebb85745a9 When Sweave.sty is not available to LaTeX, copy it in the temp directory instead of using the stylepath argument of Sweave(). This is better under windows, where the path to Sweave.sty may contain spaces.
Add Yihui Xie as co-author.


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@39140 a592a061-630c-0410-9148-cb99ea01b6c8
2011-06-20 10:59:23 +00:00
Jean-Marc Lasgouttes
ddd76c6b15 Tentative fix for bug #7545. Please test.
The problem is with sweave when the temp file path contains spaces. This patch adds some postprocessing that removes the reference to the temp dir.


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@39070 a592a061-630c-0410-9148-cb99ea01b6c8
2011-06-15 15:51:02 +00:00
Jean-Marc Lasgouttes
c820e4f8e2 Better fix for #7551. We can now handle several dots in the file name.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@39068 a592a061-630c-0410-9148-cb99ea01b6c8
2011-06-15 14:51:50 +00:00
Julien Rioux
dd8ed95a0c Fix bug #7610 (wrong latex flavor flag set by pref2pref).
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@38976 a592a061-630c-0410-9148-cb99ea01b6c8
2011-06-07 15:11:18 +00:00
Julien Rioux
54b626b8e0 Fix part of bug #7609 (PDF (pdflatex) no more directly
listed in file->export menu). Do not remove customized
document formats from the export menu.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@38975 a592a061-630c-0410-9148-cb99ea01b6c8
2011-06-07 15:01:00 +00:00
Jean-Marc Lasgouttes
7854cc96ed Fix bug #7552: Use of expression() in plot R command fails
This is dur to the use of the null device, which causes problems. Note that, as a consequence, a Rplots.pdf file is created in the document directory.


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@38896 a592a061-630c-0410-9148-cb99ea01b6c8
2011-05-31 10:44:11 +00:00
Jean-Marc Lasgouttes
dc217ed08c Fix bug #7551: Inclusion "." in filename creates LaTeX error sweave graphic generation
This is different from the fix proposed in bug #7555, because we have to catter for dots in temp dir path.


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@38895 a592a061-630c-0410-9148-cb99ea01b6c8
2011-05-31 10:37:09 +00:00
Enrico Forestieri
5e52eb2dc2 Don't write a comma if not needed.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@38710 a592a061-630c-0410-9148-cb99ea01b6c8
2011-05-11 17:11:08 +00:00
Enrico Forestieri
cc472f5d69 There's no reason to leave in place the 10pt option, as it may not be the
default option. Also account for the fact that babel may be switched off.


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@38708 a592a061-630c-0410-9148-cb99ea01b6c8
2011-05-11 14:33:49 +00:00
Enrico Forestieri
b44fe8b74b Fix bug #2200 (The size of previewed images should be independent of the latex font size)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@38701 a592a061-630c-0410-9148-cb99ea01b6c8
2011-05-11 11:48:20 +00:00
Peter Kümmel
897edc10c0 cmake: move CMakeLists.txt into source dir (multiple steps)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@38691 a592a061-630c-0410-9148-cb99ea01b6c8
2011-05-10 17:44:41 +00:00
Enrico Forestieri
5791d41544 MikTeX's kpsewhich doesn't mention "kpathsea emulation" anymore.
On Cygwin, the most reliable way to tell what is the right path
separator to use is a direct check.


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@38646 a592a061-630c-0410-9148-cb99ea01b6c8
2011-05-08 21:09:38 +00:00
Enrico Forestieri
1880933a87 Fix correct operation of lyxpak.py when using the '-t' or '-z' switches.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@38416 a592a061-630c-0410-9148-cb99ea01b6c8
2011-04-16 16:22:58 +00:00
Richard Heck
4c24976164 Try to catch CopyStyle of a Flex inset, which we need to convert to the new
Flex:* format. We can't do this perfectly, but we can do so when it's done
within a single file.

Failure to do this (which mistake had been made before) was the root cause of
the problem reported by Enrico with IEEE.



git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@38391 a592a061-630c-0410-9148-cb99ea01b6c8
2011-04-15 02:50:45 +00:00
Richard Heck
bcdb0dfcce prefs2prefs for #6966, per Pavel's suggestion.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@38377 a592a061-630c-0410-9148-cb99ea01b6c8
2011-04-14 18:31:39 +00:00
Jean-Marc Lasgouttes
0a65e96ed3 Improvements to lyx sweave support
- use a null device to avoid the extra Rplots.pdf file created by Sweave
- use directly setwd() instead of in the preamble of the module
- add lots of comments.

This finally fixes ticket #6623.


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@38359 a592a061-630c-0410-9148-cb99ea01b6c8
2011-04-13 10:04:20 +00:00
Pavel Sanda
f9f7c4a4bd Mostly documentation for the pythonic part of instant preview.
Patch from Ale.
http://www.mail-archive.com/lyx-devel@lists.lyx.org/msg167220.html


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@38256 a592a061-630c-0410-9148-cb99ea01b6c8
2011-04-05 14:54:38 +00:00
Julien Rioux
adf6faf4d4 revert r37696 and apply a fallback mechanism to pdflatex
when latex fails with a preview. Fixes bug #7303 (IP fails with hyperref).
Patch by Ale with suggestions from Enrico

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@38243 a592a061-630c-0410-9148-cb99ea01b6c8
2011-04-04 14:33:45 +00:00
Julien Rioux
9abb85aa72 fix regex after r38119 and r38120
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@38141 a592a061-630c-0410-9148-cb99ea01b6c8
2011-03-30 00:24:15 +00:00
Jürgen Spitzmüller
9071f82080 * lyxpreview-lytex2bitmap.py: port color changes from lyxpreview2bitmap.py
Why do we need two separate files actually? The difference of these two files is minimal.
Couldn't we introduce a further option for "lytex" mode in lyxpreview2bitmap.py instead?
This would significantly lower the maintenance burden.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@38120 a592a061-630c-0410-9148-cb99ea01b6c8
2011-03-29 10:09:41 +00:00
Jürgen Spitzmüller
fe76628b9e * lyxpreview2bitmap.py: color pdf also with XeTeX.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@38119 a592a061-630c-0410-9148-cb99ea01b6c8
2011-03-29 10:01:49 +00:00
Richard Heck
ebe6c9287f Fix bug #7080.
- Have InsetFlex::layoutName() report "Flex:" + the inset name.
- Do some layout2layout work so that user insets that do not have
  the "Flex:" prefix get it.

Note that this will break some CopyStyle stuff, but we do not have any
decent way to do that, so users will have to make that change for
themselves. I guess we should add that to the release notes.


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@38112 a592a061-630c-0410-9148-cb99ea01b6c8
2011-03-28 23:11:54 +00:00
Richard Heck
dc18fcea6f These should all be case insensitive.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@38111 a592a061-630c-0410-9148-cb99ea01b6c8
2011-03-28 22:44:17 +00:00
Richard Heck
a72642a174 Remove obsolete layout tags.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@38096 a592a061-630c-0410-9148-cb99ea01b6c8
2011-03-28 15:11:57 +00:00