aboutsummaryrefslogtreecommitdiffstats
path: root/gui/basewindow.cc
diff options
context:
space:
mode:
authorMiodrag Milanovic <mmicko@gmail.com>2020-02-27 09:37:09 +0100
committerMiodrag Milanovic <mmicko@gmail.com>2020-02-27 09:37:09 +0100
commit3e95c57317c8cea5f40a546b8dff9d2b63211611 (patch)
treee7563e7a9103079a569abe3de68c15a78a252ef4 /gui/basewindow.cc
parentaffb12cc27ebf409eade062c4c59bb98569d8147 (diff)
downloadnextpnr-3e95c57317c8cea5f40a546b8dff9d2b63211611.tar.gz
nextpnr-3e95c57317c8cea5f40a546b8dff9d2b63211611.tar.bz2
nextpnr-3e95c57317c8cea5f40a546b8dff9d2b63211611.zip
Add SVG option to gui
Diffstat (limited to 'gui/basewindow.cc')
-rw-r--r--gui/basewindow.cc27
1 files changed, 27 insertions, 0 deletions
diff --git a/gui/basewindow.cc b/gui/basewindow.cc
index 7f767c58..91edc310 100644
--- a/gui/basewindow.cc
+++ b/gui/basewindow.cc
@@ -266,6 +266,11 @@ void BaseMainWindow::createMenusAndBars()
actionMovie->setChecked(false);
connect(actionMovie, &QAction::triggered, this, &BaseMainWindow::saveMovie);
+ actionSaveSVG = new QAction("Save SVG", this);
+ actionSaveSVG->setIcon(QIcon(":/icons/resources/save_svg.png"));
+ actionSaveSVG->setStatusTip("Saving a SVG");
+ connect(actionSaveSVG, &QAction::triggered, this, &BaseMainWindow::saveSVG);
+
// set initial state
fpgaView->enableDisableDecals(actionDisplayBel->isChecked(), actionDisplayWire->isChecked(),
actionDisplayPip->isChecked(), actionDisplayGroups->isChecked());
@@ -334,6 +339,7 @@ void BaseMainWindow::createMenusAndBars()
deviceViewToolBar->addSeparator();
deviceViewToolBar->addAction(actionScreenshot);
deviceViewToolBar->addAction(actionMovie);
+ deviceViewToolBar->addAction(actionSaveSVG);
// Add status bar with progress bar
statusBar = new QStatusBar();
@@ -416,6 +422,27 @@ void BaseMainWindow::saveMovie()
fpgaView->movieStop();
}
}
+
+void BaseMainWindow::saveSVG()
+{
+ QString fileName = QFileDialog::getSaveFileName(this, QString("Save SVG"), QString(), QString("*.svg"));
+ if (!fileName.isEmpty()) {
+ if (!fileName.endsWith(".svg"))
+ fileName += ".svg";
+ bool ok;
+ QString options =
+ QInputDialog::getText(this, "Save SVG", tr("Save options:"), QLineEdit::Normal, "scale=500", &ok);
+ if (ok) {
+ try {
+ ctx->writeSVG(fileName.toStdString(), options.toStdString());
+ log("Saving SVG successful.\n");
+ } catch (const log_execution_error_exception &ex) {
+ log("Saving SVG failed.\n");
+ }
+ }
+ }
+}
+
void BaseMainWindow::pack_finished(bool status)
{
disableActions();