]> git.lyx.org Git - lyx.git/commitdiff
fix bug 2192
authorGeorg Baum <Georg.Baum@post.rwth-aachen.de>
Thu, 19 Jan 2006 21:18:25 +0000 (21:18 +0000)
committerGeorg Baum <Georg.Baum@post.rwth-aachen.de>
Thu, 19 Jan 2006 21:18:25 +0000 (21:18 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@10758 a592a061-630c-0410-9148-cb99ea01b6c8

src/ChangeLog
src/converter.C
src/graphics/ChangeLog
src/graphics/GraphicsCacheItem.C
src/graphics/GraphicsConverter.C
src/insets/ChangeLog
src/insets/insetgraphics.C

index cd425edf9314bea7ff158c903aacaa92bd74a729..df4234e1bb497bf505d0829e5f79c0f48d098454 100644 (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: 
index 4dec5fa2b31897250a0e570d5f5761bd2f51aba0..1d5b67c19700e6184a836709c0ff96499763cabf 100644 (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")) +
index c732bd3502ddb5606204b30c364e0f1e3d977487..00ec15395cf8d20677b8cf69f45c848f95836cf3 100644 (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.
index 1d031d8a71da2fb03db753a8bde33f09c8da7111..4c11ed6b9871ac4ff70273d5c13171c642f45387 100644 (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;
index 8508b2e082db2ea14f10e3dcd2af44ad7ec5684c..65c517db4601bf4f3e6eddd5a4b2373e23fc721e 100644 (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 + '.'
index 6190daeea7667f16e04b2b19200195334327e108..67523c444741df9c28e1fe35a412f62bf7841c9b 100644 (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):
index 60d3302c4ea84ede154dc8347556d191e22c0aae..e0ce2256ecd7aa08dbe2bbed92ac88818106692b 100644 (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);