Mercurial > hg > svapp
diff framework/MainWindowBase.cpp @ 764:4c91c95e146a
Merge
author | Chris Cannam |
---|---|
date | Wed, 13 May 2020 14:10:58 +0100 |
parents | da57ab54f0e8 83ae68de4401 |
children | cf4e0f3c2406 |
line wrap: on
line diff
--- a/framework/MainWindowBase.cpp Wed May 13 14:10:47 2020 +0100 +++ b/framework/MainWindowBase.cpp Wed May 13 14:10:58 2020 +0100 @@ -59,6 +59,7 @@ #include "data/fileio/BZipFileDevice.h" #include "data/fileio/FileSource.h" #include "data/fileio/AudioFileReaderFactory.h" +#include "data/fileio/TextTest.h" #include "rdf/RDFImporter.h" #include "rdf/RDFExporter.h" @@ -1516,7 +1517,20 @@ } else if ((status = openPlaylist(source, mode)) != FileOpenFailed) { return status; } else if (!canImportLayer) { - return FileOpenWrongMode; + // We already checked whether the file is RDF: we know + // it's not. But if it's another format that might be + // supported as a layer, reply that we can't open a layer + // here - otherwise assume it's an unknown file format + if (ImageLayer::isImageFileSupported(source.getLocation())) { + return FileOpenWrongMode; + } + if (extension == "mid" || extension == "midi") { + return FileOpenWrongMode; + } + if (TextTest::isApparentTextDocument(source)) { + return FileOpenWrongMode; + } + return FileOpenFailed; } else if ((status = openImage(source)) != FileOpenFailed) { return status; } else if ((status = openLayer(source)) != FileOpenFailed) { @@ -2057,7 +2071,7 @@ // We don't put the image file in Recent Files - cerr << "openImage: trying location \"" << source.getLocation() << "\" in image layer" << endl; + SVCERR << "openImage: trying location \"" << source.getLocation() << "\" in image layer" << endl; if (!il->addImage(m_viewManager->getGlobalCentreFrame(), source.getLocation())) { if (newLayer) {