mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-22 10:00:33 +00:00
Herbert's patch supporting more graphics formats.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@3621 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
865b605078
commit
b3e376fefc
@ -6,6 +6,10 @@
|
||||
|
||||
* ui/default.ui: change Layout>LaTeX Preamble to Layout>Preamble.
|
||||
|
||||
2002-02-23 Herbert Voss <voss@perce.de>
|
||||
|
||||
* configure.m4: added converter stuff for different formats
|
||||
|
||||
2002-02-13 José Matos <jamatos@fep.up.pt>
|
||||
|
||||
* examples/linuxdoc_manpage.lyx: added
|
||||
|
@ -355,7 +355,7 @@ esac
|
||||
#### Search for image conversion ####
|
||||
SEARCH_PROG([for an Image -> EPS converter], TOEPS, convert pnmtops)
|
||||
case $TOEPS in
|
||||
convert) gif_to_eps="convert GIF:\$\$i EPS:\$\$o" png_to_eps="convert PNG:\$\$i EPS:\$\$o" jpg_to_eps="convert JPG:\$\$i EPS:\$\$o";;
|
||||
convert) bmp_to_eps="convert BMP:\$\$i EPS:\$\$o" fits_to_eps="convert FITS:\$\$i EPS:\$\$o" gif_to_eps="convert GIF:\$\$i EPS:\$\$o" jpg_to_eps="convert JPG:\$\$i EPS:\$\$o" pbm_to_eps="convert PBM:\$\$i EPS:\$\$o" pgm_to_eps="convert PGM:\$\$i EPS:\$\$o" png_to_eps="convert PNG:\$\$i EPS:\$\$o" ppm_to_eps="convert PPM:\$\$i EPS:\$\$o" sgi_to_eps="convert SGI:\$\$i EPS:\$\$o" xwd_to_eps="convert XWD:\$\$i EPS:\$\$o" ;;
|
||||
pnmtops) gif_to_eps="giftopnm \$\$i | pnmtops > \$\$o" png_to_eps="pngtopnm \$\$i | pnmtops >\$\$o" jpg_to_eps="jpegtopnm \$\$i | pnmtops >\$\$o";;
|
||||
esac
|
||||
|
||||
@ -452,11 +452,14 @@ cat >$outfile <<EOF
|
||||
\\Format text txt ASCII A
|
||||
\\Format textparagraph txt ASCII(paragraphs) ""
|
||||
\\Format docbook sgml DocBook B
|
||||
\\Format bmp bmp BMP ""
|
||||
\\Format dvi dvi DVI D
|
||||
\\Format eps eps EPS ""
|
||||
\\Format epsi epsi EPSI ""
|
||||
\\Format epsi epsi EPSI ""
|
||||
\\Format fax "" Fax ""
|
||||
\\Format fits fits FITS ""
|
||||
\\Format gif gif GIF ""
|
||||
\\Format grace agr GRACE ""
|
||||
\\Format html html HTML H
|
||||
\\Format jpg jpg JPEG ""
|
||||
\\Format latex tex LaTeX L
|
||||
@ -466,10 +469,17 @@ cat >$outfile <<EOF
|
||||
\\Format pdf pdf PDF P
|
||||
\\Format pdf2 pdf "PDF (pdflatex)" F
|
||||
\\Format pdf3 pdf "PDF (dvipdfm)" m
|
||||
\\Format pbm pbm PBM ""
|
||||
\\Format pgm pgm PGM ""
|
||||
\\Format png png PNG ""
|
||||
\\Format ppm ppm PPM ""
|
||||
\\Format ps ps Postscript t
|
||||
\\Format program "" Program ""
|
||||
\\Format sgi sgi SGI ""
|
||||
\\Format tgif tgif TGIF ""
|
||||
\\Format tiff tif TIFF ""
|
||||
\\Format xpm xpm XPM ""
|
||||
\\Format xwd xwd XWD ""
|
||||
\\Format word doc Word W
|
||||
|
||||
\\converter latex dvi "$latex_to_dvi" "latex"
|
||||
@ -492,9 +502,22 @@ cat >$outfile <<EOF
|
||||
\\converter html latex "$html_to_latex_command" ""
|
||||
\\converter word latex "$word_to_latex_command" ""
|
||||
|
||||
\\converter agr eps "xmgrace -hardcopy -hdevice EPS \$\$i" ""
|
||||
\\converter bmp eps "$bmp_to_eps" ""
|
||||
\\converter fits eps "$fits_to_eps" ""
|
||||
\\converter gif eps "$gif_to_eps" ""
|
||||
\\converter png eps "$png_to_eps" ""
|
||||
\\converter jpg eps "$jpg_to_eps" ""
|
||||
\\converter pbm eps "$pbm_to_eps" ""
|
||||
\\converter pgm eps "$pgm_to_eps" ""
|
||||
\\converter png eps "$png_to_eps" ""
|
||||
\\converter ppm eps "$ppm_to_eps" ""
|
||||
\\converter sgi eps "$sgi_to_eps" ""
|
||||
\\converter tgif eps "tgif -print -eps \$\$i" ""
|
||||
\\converter tiff eps "tiff2ps \$\$i > \$\$o" ""
|
||||
\\converter xwd eps "$xwd_to_eps" ""
|
||||
|
||||
\\converter tgif gif "tgif -print -gif \$\$i" ""
|
||||
\\converter tgif pdf "tgif -print -pdf \$\$i" ""
|
||||
|
||||
\\converter gif png "$gif_to_png" ""
|
||||
\\converter eps png "$eps_to_png" ""
|
||||
|
@ -21,6 +21,10 @@
|
||||
* os2_errortable.h:
|
||||
* nt_defines.h: moved from src/
|
||||
|
||||
2002-02-23 Herbert Voss <voss@perce.de>
|
||||
|
||||
* filetools.C: added more graphic formats
|
||||
|
||||
2002-02-18 Herbert Voss <voss@perce.de>
|
||||
|
||||
* filetools.C: (getExtFromContents) return the fileextension
|
||||
|
@ -966,16 +966,24 @@ string const GetExtension(string const & name)
|
||||
|
||||
// the different filetypes and what they contain in one of the first lines
|
||||
// (dots are any characters). (Herbert 20020131)
|
||||
// AGR Grace...
|
||||
// BMP BM...
|
||||
// EPS %!PS-Adobe-3.0 EPSF...
|
||||
// TGIF %TGIF...
|
||||
// FITS ...BITPIX...
|
||||
// GIF GIF...
|
||||
// GRACE Grace ...
|
||||
// JPG JFIF
|
||||
// PDF %PDF-...
|
||||
// PNG .PNG...
|
||||
// PBM P1... or P4 (B/W)
|
||||
// PGM P2... or P5 (Grayscale)
|
||||
// PPM P3... or P6 (color)
|
||||
// PS %!PS-Adobe-2.0 or 1.0, no "EPSF"!
|
||||
// SGI \001\332... (decimal 474)
|
||||
// TGIF %TGIF...
|
||||
// TIFF II... or MM...
|
||||
// XBM ... static char ...
|
||||
// XPM /* XPM */
|
||||
// XWD \000\000\000\151 (0x00006900)
|
||||
//
|
||||
// GZIP \037\213\010\010... http://www.ietf.org/rfc/rfc1952.txt
|
||||
// ZIP PK... http://www.halyava.ru/document/ind_arch.htm
|
||||
@ -996,33 +1004,63 @@ string const getExtFromContents(string const & filename) {
|
||||
int const max_count = 50; // Maximum strings to read
|
||||
int count = 0; // Counter of attempts.
|
||||
string str;
|
||||
bool zipChecked = false;
|
||||
bool firstLine = true;
|
||||
for (; count < max_count; ++count) {
|
||||
if (ifs.eof()) {
|
||||
lyxerr[Debug::GRAPHICS] << "filetools(getExtFromContents)"
|
||||
" End of file reached and it wasn't found to be a known Type!" << endl;
|
||||
lyxerr[Debug::GRAPHICS] << "filetools(getExtFromContents)\n"
|
||||
"\tEnd of file reached and it wasn't found a known Type!" << endl;
|
||||
break;
|
||||
}
|
||||
ifs >> str;
|
||||
if (!zipChecked) {
|
||||
if (firstLine) {
|
||||
// at first we check for a zipped file, because this information
|
||||
// is saved in the first bytes of the file!
|
||||
// also some graphic formats which save the information
|
||||
// in the first line, too.
|
||||
if (str.substr(0,4) == gzipStamp)
|
||||
return "gzip";
|
||||
else if (str.substr(0,2) == zipStamp)
|
||||
string const stamp = str.substr(0,2);
|
||||
if (stamp == zipStamp)
|
||||
return "zip";
|
||||
else if (str.substr(0,2) == compressStamp)
|
||||
else if (stamp == compressStamp)
|
||||
return "compress";
|
||||
zipChecked = true;
|
||||
// the graphics part
|
||||
else if (stamp == "BM")
|
||||
return "bmp";
|
||||
else if (str.at(0) == 'P') { // PBM family
|
||||
switch (str.at(1)) {
|
||||
case '1':
|
||||
case '4':
|
||||
return "pbm";
|
||||
break;
|
||||
case '2':
|
||||
case '5':
|
||||
return "pgm";
|
||||
break;
|
||||
case '3':
|
||||
case '6':
|
||||
return "ppm";
|
||||
break;
|
||||
default: ; // do nothing
|
||||
}
|
||||
}
|
||||
if (stamp == "\001\332")
|
||||
return "sgi";
|
||||
else if ((stamp == "II") || (stamp == "MM"))
|
||||
return "tiff";
|
||||
else if (str.substr(0,3) == "GIF")
|
||||
return "gif";
|
||||
else if ((str.at(3) == 'i') && (str.at(0) == '\000') &&
|
||||
(str.at(1) == '\000') && (str.at(2) == '\000'))
|
||||
return "xwd";
|
||||
firstLine = false;
|
||||
}
|
||||
if (contains(str,"EPSF")) // dummy, if we have wrong file
|
||||
return "eps"; // description like "%!PS-Adobe-2.0EPSF"
|
||||
else if (contains(str,"TGIF"))
|
||||
return "tgif";
|
||||
else if (contains(str,"GIF"))
|
||||
return "gif";
|
||||
else if (contains(str,"Grace"))
|
||||
return "grace";
|
||||
return "agr";
|
||||
else if (contains(str,"JFIF"))
|
||||
return "jpg";
|
||||
else if (contains(str,"%PDF"))
|
||||
@ -1039,6 +1077,8 @@ string const getExtFromContents(string const & filename) {
|
||||
return "xbm";
|
||||
else if (contains(str,"XPM"))
|
||||
return "xpm";
|
||||
else if (contains(str,"BITPIX"))
|
||||
return "fits";
|
||||
}
|
||||
lyxerr[Debug::GRAPHICS] << "filetools(getExtFromContents)\n"
|
||||
"\tCouldn't find a known Type!"
|
||||
|
Loading…
Reference in New Issue
Block a user