# HG changeset patch # User Chris Cannam # Date 1589375458 -3600 # Node ID 4c91c95e146a782f854a44429f8bfcc145d01350 # Parent da57ab54f0e8c7aaddfdc22f83249abadf0ccb21# Parent 83ae68de440101d8cd9c8b24fb571c458cec5281 Merge diff -r da57ab54f0e8 -r 4c91c95e146a framework/MainWindowBase.cpp --- 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) {