diff main/MainWindow.cpp @ 1462:f5180edc5dda 3.0-integration

Merge
author Chris Cannam <cannam@all-day-breakfast.com>
date Tue, 03 Jan 2017 14:34:46 +0000
parents 0a145f215a45 8ca62b402846
children f5c828d1f3e2
line wrap: on
line diff
--- a/main/MainWindow.cpp	Tue Jan 03 14:32:53 2017 +0000
+++ b/main/MainWindow.cpp	Tue Jan 03 14:34:46 2017 +0000
@@ -2867,14 +2867,9 @@
     Pane *pane = m_paneStack->getCurrentPane();
     if (!pane) return;
     
-//!!!    QString path = getSaveFileName(FileFinder::ImageFile);
-//    if (path == "") return;
-//    if (QFileInfo(path).suffix() == "") path += ".png";
     QString path = getSaveFileName(FileFinder::ImageFile);
     if (path == "") return;
-    if (QFileInfo(path).suffix() == "") path += ".svg";
-
-    bool scalable = true; //!!!
+    if (QFileInfo(path).suffix() == "") path += ".png";
     
     bool haveSelection = m_viewManager && !m_viewManager->getSelections().empty();
 
@@ -2910,7 +2905,7 @@
     settings.beginGroup("MainWindow");
     int deflt = settings.value("lastimageexportregion", 0).toInt();
     if (deflt == 2 && !haveSelection) deflt = 1;
-    if (deflt == 0 && !scalable && total.width() > 32767) deflt = 1;
+    if (deflt == 0 && total.width() > 32767) deflt = 1;
 
     ListInputDialog *lid = new ListInputDialog
         (this, tr("Select region to export"),
@@ -2920,7 +2915,7 @@
     if (!haveSelection) {
         lid->setItemAvailability(2, false);
     }
-    if (!scalable && total.width() > 32767) { // appears to be limit of a QImage
+    if (total.width() > 32767) { // appears to be limit of a QImage
         lid->setItemAvailability(0, false);
         lid->setFootnote(tr("Note: the whole pane is too wide to be exported as a single image."));
     }
@@ -2933,47 +2928,25 @@
 
     settings.setValue("lastimageexportregion", deflt);
 
-    if (scalable) {
-
-        bool result = false;
-        
-        if (item == items[0]) {
-            result = pane->renderToSvgFile(path );
-        } else if (item == items[1]) {
-            result = pane->renderPartToSvgFile(path,
-                                               pane->getFirstVisibleFrame(),
-                                               pane->getLastVisibleFrame());
-        } else if (haveSelection) {
-            result = pane->renderPartToSvgFile(path, sf0, sf1);
-        }
-
-        if (!result) {
-            QMessageBox::critical(this, tr("Failed to save SVG file"),
-                                  tr("Failed to save SVG file %1").arg(path));
-        }
-
-    } else {
-        
-        QImage *image = 0;
-
-        if (item == items[0]) {
-            image = pane->renderToNewImage();
-        } else if (item == items[1]) {
-            image = pane->renderPartToNewImage(pane->getFirstVisibleFrame(),
-                                               pane->getLastVisibleFrame());
-        } else if (haveSelection) {
-            image = pane->renderPartToNewImage(sf0, sf1);
-        }
-
-        if (!image) return;
-
-        if (!image->save(path, "PNG")) {
-            QMessageBox::critical(this, tr("Failed to save image file"),
-                                  tr("Failed to save image file %1").arg(path));
-        }
+    QImage *image = 0;
     
-        delete image;
+    if (item == items[0]) {
+        image = pane->renderToNewImage();
+    } else if (item == items[1]) {
+        image = pane->renderPartToNewImage(pane->getFirstVisibleFrame(),
+                                           pane->getLastVisibleFrame());
+    } else if (haveSelection) {
+        image = pane->renderPartToNewImage(sf0, sf1);
     }
+    
+    if (!image) return;
+    
+    if (!image->save(path, "PNG")) {
+        QMessageBox::critical(this, tr("Failed to save image file"),
+                              tr("Failed to save image file %1").arg(path));
+    }
+    
+    delete image;
 }
 
 void