fix bug 2192

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@10758 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Georg Baum 2006-01-19 21:18:25 +00:00
parent 2486c96b8d
commit 0a7ebf229c
7 changed files with 30 additions and 8 deletions

View File

@ -1,3 +1,7 @@
2006-01-11 Georg Baum <Georg.Baum@post.rwth-aachen.de>
* converter.C (convert): handle unknown formats
2006-01-19 Jean-Marc Lasgouttes <lasgouttes@lyx.org>
* cursor.C (goUpDown): comment out some debug messages.
@ -38,7 +42,7 @@
* rowpainter.C (paintPar): always repaint the row with the
cursor in it
2006-01-01 Lars Gullik Bjønnes <larsbj@gullik.net>
2006-01-01 Lars Gullik Bjønnes <larsbj@gullik.net>
* MenuBackend.h:
* bufferlist.h:

View File

@ -294,7 +294,9 @@ bool Converters::convert(Buffer const * buffer,
if (try_default) {
// if no special converter defined, then we take the
// default one from ImageMagic.
string const from_ext = formats.extension(from_format);
string const from_ext = from_format.empty() ?
GetExtension(from_file) :
formats.extension(from_format);
string const command =
"sh " +
QuoteName(LibFileSearch("scripts", "convertDefault.sh")) +

View File

@ -1,3 +1,9 @@
2006-01-11 Georg Baum <Georg.Baum@post.rwth-aachen.de>
* GraphicsCacheItem.C (convertToDisplayFormat): handle unknown
formats
* GraphicsConverter.C (Impl, build_script): ditto
2005-11-02 Angus Leeming <leeming@lyx.org>
* GraphicsCacheItem.C: trivial fix to a MSVS warning.

View File

@ -335,8 +335,10 @@ string const findTargetFormat(string const & from)
typedef lyx::graphics::Image::FormatList FormatList;
FormatList const formats = lyx::graphics::Image::loadableFormats();
// There must be a format to load from.
BOOST_ASSERT(!formats.empty());
// Use the standard converter if we don't know the format to load
// from.
if (!formats.empty())
return string("ppm");
// First ascertain if we can load directly with no conversion
FormatList::const_iterator it = formats.begin();
@ -408,7 +410,6 @@ void CacheItem::Impl::convertToDisplayFormat()
setStatus(ErrorConverting);
lyxerr[Debug::GRAPHICS]
<< "\tCould not determine file format." << endl;
return;
}
lyxerr[Debug::GRAPHICS]
<< "\n\tThe file contains " << from << " format data." << endl;

View File

@ -169,8 +169,8 @@ Converter::Impl::Impl(string const & from_file, string const & to_file_base,
script_command_ =
"sh " +
QuoteName(LibFileSearch("scripts", "convertDefault.sh")) +
' ' +
QuoteName(from_format + ':' + from_file) +
' ' +
QuoteName((from_format.empty() ? "" : from_format + ':') + from_file) +
' ' +
QuoteName(to_format + ':' + to_file_);
@ -283,6 +283,9 @@ bool build_script(string const & from_file,
lyxerr[Debug::GRAPHICS] << "build_script ... ";
typedef Converters::EdgePath EdgePath;
if (from_format.empty())
return false;
// we do not use ChangeExtension because this is a basename
// which may nevertheless contain a '.'
string const to_file = to_file_base + '.'

View File

@ -1,3 +1,8 @@
2006-01-11 Georg Baum <Georg.Baum@post.rwth-aachen.de>
* insetgraphics.C (findTargetFormat): document
* insetgraphics.C (prepareFile): handle unknown formats
2006-01-10 Jean-Marc Lasgouttes <lasgouttes@lyx.org>
* insettext.C (getLabelList):

View File

@ -128,6 +128,8 @@ string const RemoveExtension(string const & filename)
}
/// Find the most suitable image format for images in \p format
/// Note that \p format may be unknown (i. e. an empty string)
string findTargetFormat(string const & format, OutputParams const & runparams)
{
// Are we using latex or pdflatex?
@ -661,7 +663,6 @@ string const InsetGraphics::prepareFile(Buffer const & buf,
if (from.empty()) {
lyxerr[Debug::GRAPHICS]
<< "\tCould not get file format." << endl;
return orig_file;
}
string const to = findTargetFormat(from, runparams);
string const ext = formats.extension(to);