diff --git a/src/laybasic/laybasic/NetExportDialog.ui b/src/laybasic/laybasic/NetExportDialog.ui
new file mode 100644
index 000000000..c21cb805b
--- /dev/null
+++ b/src/laybasic/laybasic/NetExportDialog.ui
@@ -0,0 +1,234 @@
+
+
+ NetExportDialog
+
+
+
+ 0
+ 0
+ 531
+ 321
+
+
+
+ Export Net Options
+
+
+ -
+
+
+ -
+
+
+ Produce cells for devices
+
+
+
+ -
+
+
+ Produce cells for circuits
+
+
+
+ -
+
+
+ -
+
+
+ Qt::Horizontal
+
+
+ QSizePolicy::Fixed
+
+
+
+ 10
+ 20
+
+
+
+
+ -
+
+
+ Qt::Horizontal
+
+
+ QSizePolicy::Fixed
+
+
+
+ 10
+ 20
+
+
+
+
+ -
+
+
+ Net cell name prefix
+
+
+
+ -
+
+
+ -
+
+
+ If this options is selected, each device will be represented by one cell made from the device name and the given prefix. Otherwise, device parts are exported as shapes inside the net.
+
+
+ true
+
+
+
+ -
+
+
+ QDialogButtonBox::Cancel|QDialogButtonBox::Ok
+
+
+
+ -
+
+
+ Qt::Vertical
+
+
+
+ 10
+ 29
+
+
+
+
+ -
+
+
+ Cell name prefix
+
+
+
+ -
+
+
+ Cell name prefix
+
+
+
+ -
+
+
+ Qt::Vertical
+
+
+ QSizePolicy::Fixed
+
+
+
+ 20
+ 10
+
+
+
+
+ -
+
+
+ If this option is selected, the subcircuits on a net are represented by individual cells. Otherwise the net is exported as a whole into a single cell (flattened).
+
+
+ true
+
+
+
+ -
+
+
+ Qt::Vertical
+
+
+ QSizePolicy::Fixed
+
+
+
+ 20
+ 10
+
+
+
+
+
+
+
+
+
+ produce_circuit_cells_cb
+ clicked(bool)
+ circuit_cell_prefix
+ setEnabled(bool)
+
+
+ 91
+ 72
+
+
+ 266
+ 100
+
+
+
+
+ produce_device_cells_cb
+ clicked(bool)
+ device_cell_prefix
+ setEnabled(bool)
+
+
+ 98
+ 176
+
+
+ 317
+ 204
+
+
+
+
+ buttonBox
+ accepted()
+ NetExportDialog
+ accept()
+
+
+ 381
+ 284
+
+
+ 368
+ 299
+
+
+
+
+ buttonBox
+ rejected()
+ NetExportDialog
+ reject()
+
+
+ 461
+ 285
+
+
+ 442
+ 298
+
+
+
+
+
diff --git a/src/laybasic/laybasic/NetlistBrowserPage.ui b/src/laybasic/laybasic/NetlistBrowserPage.ui
index e6a06b5be..25de5ddbb 100644
--- a/src/laybasic/laybasic/NetlistBrowserPage.ui
+++ b/src/laybasic/laybasic/NetlistBrowserPage.ui
@@ -236,7 +236,7 @@
true
- true
+ false
@@ -302,6 +302,16 @@
Case Sensitive
+
+
+ Export All
+
+
+
+
+ Export Selected Nets
+
+
diff --git a/src/laybasic/laybasic/layNetExportDialog.cc b/src/laybasic/laybasic/layNetExportDialog.cc
new file mode 100644
index 000000000..7a8da60c9
--- /dev/null
+++ b/src/laybasic/laybasic/layNetExportDialog.cc
@@ -0,0 +1,152 @@
+
+/*
+
+ KLayout Layout Viewer
+ Copyright (C) 2006-2019 Matthias Koefferlein
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+
+*/
+
+#include "layNetExportDialog.h"
+#include "layPlugin.h"
+
+#include "ui_NetExportDialog.h"
+
+#include
+
+namespace lay
+{
+
+extern std::string cfg_l2ndb_net_cell_prefix;
+extern std::string cfg_l2ndb_circuit_cell_prefix;
+extern std::string cfg_l2ndb_produce_circuit_cells;
+extern std::string cfg_l2ndb_device_cell_prefix;
+extern std::string cfg_l2ndb_produce_device_cells;
+
+
+NetExportDialog::NetExportDialog (QWidget *parent)
+ : QDialog (parent)
+{
+ ui = new Ui::NetExportDialog ();
+ ui->setupUi (this);
+}
+
+NetExportDialog::~NetExportDialog ()
+{
+ delete ui;
+ ui = 0;
+}
+
+void
+NetExportDialog::set_net_prefix (const std::string &net_prefix)
+{
+ ui->net_cell_prefix->setText (tl::to_qstring (net_prefix));
+}
+
+std::string
+NetExportDialog::net_prefix ()
+{
+ return tl::to_string (ui->net_cell_prefix->text ());
+}
+
+void
+NetExportDialog::set_produce_circuit_cells (bool f)
+{
+ ui->circuit_cell_prefix->setEnabled (f);
+ ui->produce_circuit_cells_cb->setChecked (f);
+}
+
+bool
+NetExportDialog::produce_circuit_cells ()
+{
+ return ui->produce_circuit_cells_cb->isChecked ();
+}
+
+void
+NetExportDialog::set_circuit_cell_prefix (const std::string &cell_prefix)
+{
+ ui->circuit_cell_prefix->setText (tl::to_qstring (cell_prefix));
+}
+
+std::string
+NetExportDialog::circuit_cell_prefix ()
+{
+ return tl::to_string (ui->circuit_cell_prefix->text ());
+}
+
+void
+NetExportDialog::set_produce_device_cells (bool f)
+{
+ ui->device_cell_prefix->setEnabled (f);
+ ui->produce_device_cells_cb->setChecked (f);
+}
+
+bool
+NetExportDialog::produce_device_cells ()
+{
+ return ui->produce_device_cells_cb->isChecked ();
+}
+
+void
+NetExportDialog::set_device_cell_prefix (const std::string &cell_prefix)
+{
+ ui->device_cell_prefix->setText (tl::to_qstring (cell_prefix));
+}
+
+std::string
+NetExportDialog::device_cell_prefix ()
+{
+ return tl::to_string (ui->device_cell_prefix->text ());
+}
+
+int
+NetExportDialog::exec (lay::PluginRoot *plugin_root)
+{
+ std::string v;
+ plugin_root->config_get (cfg_l2ndb_net_cell_prefix, v);
+ set_net_prefix (v);
+
+ bool f = false;
+ plugin_root->config_get (cfg_l2ndb_produce_circuit_cells, f);
+ set_produce_circuit_cells (f);
+
+ v.clear ();
+ plugin_root->config_get (cfg_l2ndb_circuit_cell_prefix, v);
+ set_circuit_cell_prefix (v);
+
+ f = false;
+ plugin_root->config_get (cfg_l2ndb_produce_device_cells, f);
+ set_produce_device_cells (f);
+
+ v.clear ();
+ plugin_root->config_get (cfg_l2ndb_device_cell_prefix, v);
+ set_device_cell_prefix (v);
+
+ int ret = QDialog::exec ();
+ if (ret) {
+
+ plugin_root->config_set (cfg_l2ndb_net_cell_prefix, net_prefix ());
+ plugin_root->config_set (cfg_l2ndb_produce_circuit_cells, tl::to_string (produce_circuit_cells ()));
+ plugin_root->config_set (cfg_l2ndb_circuit_cell_prefix, circuit_cell_prefix ());
+ plugin_root->config_set (cfg_l2ndb_produce_device_cells, tl::to_string (produce_device_cells ()));
+ plugin_root->config_set (cfg_l2ndb_device_cell_prefix, device_cell_prefix ());
+
+ }
+
+ return ret;
+}
+
+}
diff --git a/src/laybasic/laybasic/layNetExportDialog.h b/src/laybasic/laybasic/layNetExportDialog.h
new file mode 100644
index 000000000..ab296445b
--- /dev/null
+++ b/src/laybasic/laybasic/layNetExportDialog.h
@@ -0,0 +1,80 @@
+
+/*
+
+ KLayout Layout Viewer
+ Copyright (C) 2006-2019 Matthias Koefferlein
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+
+*/
+
+
+#ifndef HDR_layNetExportDialog
+#define HDR_layNetExportDialog
+
+#include "ui_NetExportDialog.h"
+
+#include "dbLayoutToNetlist.h"
+#include "tlObjectCollection.h"
+
+#include
+
+namespace Ui
+{
+ class NetExportDialog;
+}
+
+namespace lay
+{
+
+class PluginRoot;
+
+/**
+ * @brief A dialog showing the details of a net
+ */
+class NetExportDialog
+ : public QDialog
+{
+ Q_OBJECT
+
+public:
+ NetExportDialog (QWidget *parent);
+ ~NetExportDialog ();
+
+ void set_net_prefix (const std::string &net_prefix);
+ std::string net_prefix ();
+
+ void set_produce_circuit_cells (bool f);
+ bool produce_circuit_cells ();
+
+ void set_circuit_cell_prefix (const std::string &net_prefix);
+ std::string circuit_cell_prefix ();
+
+ void set_produce_device_cells (bool f);
+ bool produce_device_cells ();
+
+ void set_device_cell_prefix (const std::string &net_prefix);
+ std::string device_cell_prefix ();
+
+ int exec (lay::PluginRoot *mp_plugin_root);
+
+private:
+ Ui::NetExportDialog *ui;
+};
+
+}
+
+#endif
+
diff --git a/src/laybasic/laybasic/layNetlistBrowser.cc b/src/laybasic/laybasic/layNetlistBrowser.cc
index 313c22be4..cebce2f33 100644
--- a/src/laybasic/laybasic/layNetlistBrowser.cc
+++ b/src/laybasic/laybasic/layNetlistBrowser.cc
@@ -50,6 +50,11 @@ extern const std::string cfg_l2ndb_window_dim ("l2ndb-window-dim");
extern const std::string cfg_l2ndb_max_shapes_highlighted ("l2ndb-max-shapes-highlighted");
extern const std::string cfg_l2ndb_show_all ("l2ndb-show-all");
extern const std::string cfg_l2ndb_window_state ("l2ndb-window-state");
+extern const std::string cfg_l2ndb_net_cell_prefix ("l2ndb-net-cell-prefix");
+extern const std::string cfg_l2ndb_circuit_cell_prefix ("l2ndb-circuit-cell-prefix");
+extern const std::string cfg_l2ndb_produce_circuit_cells ("l2ndb-produce-circuit-cells");
+extern const std::string cfg_l2ndb_device_cell_prefix ("l2ndb-device-cell-prefix");
+extern const std::string cfg_l2ndb_produce_device_cells ("l2ndb-produce-device-cells");
// ------------------------------------------------------------
@@ -335,6 +340,11 @@ public:
options.push_back (std::pair (cfg_l2ndb_marker_intensity, "50"));
options.push_back (std::pair (cfg_l2ndb_show_all, "true"));
options.push_back (std::pair (cfg_l2ndb_window_state, ""));
+ options.push_back (std::pair (cfg_l2ndb_net_cell_prefix, "NET_"));
+ options.push_back (std::pair (cfg_l2ndb_produce_circuit_cells, "false"));
+ options.push_back (std::pair (cfg_l2ndb_circuit_cell_prefix, "CIRCUIT_"));
+ options.push_back (std::pair (cfg_l2ndb_produce_device_cells, "false"));
+ options.push_back (std::pair (cfg_l2ndb_device_cell_prefix, "DEVICE_"));
}
virtual std::vector > config_pages (QWidget *parent) const
diff --git a/src/laybasic/laybasic/layNetlistBrowserPage.cc b/src/laybasic/laybasic/layNetlistBrowserPage.cc
index 48fcc670f..344dadc1e 100644
--- a/src/laybasic/laybasic/layNetlistBrowserPage.cc
+++ b/src/laybasic/laybasic/layNetlistBrowserPage.cc
@@ -27,6 +27,7 @@
#include "layLayoutView.h"
#include "layMarker.h"
#include "layNetInfoDialog.h"
+#include "layNetExportDialog.h"
#include "tlProgress.h"
#include "dbLayoutToNetlist.h"
#include "dbNetlistDeviceClasses.h"
@@ -1766,6 +1767,11 @@ NetlistBrowserPage::NetlistBrowserPage (QWidget * /*parent*/)
sep->setSeparator (true);
directory_tree->addAction (sep);
directory_tree->addAction (color_action);
+ sep = new QAction (directory_tree);
+ sep->setSeparator (true);
+ directory_tree->addAction (sep);
+ directory_tree->addAction (actionExportSelected);
+ directory_tree->addAction (actionExportAll);
lay::HTMLItemDelegate *delegate;
@@ -1798,6 +1804,9 @@ NetlistBrowserPage::NetlistBrowserPage (QWidget * /*parent*/)
connect (forward, SIGNAL (clicked ()), this, SLOT (navigate_forward ()));
connect (backward, SIGNAL (clicked ()), this, SLOT (navigate_back ()));
+ connect (actionExportAll, SIGNAL (triggered ()), this, SLOT (export_all ()));
+ connect (actionExportSelected, SIGNAL (triggered ()), this, SLOT (export_selected ()));
+
forward->setEnabled (false);
backward->setEnabled (false);
}
@@ -2481,5 +2490,23 @@ NetlistBrowserPage::clear_markers ()
mp_markers.clear ();
}
+void
+NetlistBrowserPage::export_all ()
+{
+ std::auto_ptr dialog (new lay::NetExportDialog (this));
+ if (dialog->exec (mp_plugin_root)) {
+ // @@@
+ }
+}
+
+void
+NetlistBrowserPage::export_selected ()
+{
+ std::auto_ptr dialog (new lay::NetExportDialog (this));
+ if (dialog->exec (mp_plugin_root)) {
+ // @@@
+ }
+}
+
}
diff --git a/src/laybasic/laybasic/layNetlistBrowserPage.h b/src/laybasic/laybasic/layNetlistBrowserPage.h
index 3ac871105..d9dcceba2 100644
--- a/src/laybasic/laybasic/layNetlistBrowserPage.h
+++ b/src/laybasic/laybasic/layNetlistBrowserPage.h
@@ -307,6 +307,10 @@ public:
*/
void update_highlights ();
+public slots:
+ void export_all ();
+ void export_selected ();
+
private slots:
void show_all_clicked ();
void info_button_pressed ();
diff --git a/src/laybasic/laybasic/laybasic.pro b/src/laybasic/laybasic/laybasic.pro
index d8e1a4659..d15d0f0da 100644
--- a/src/laybasic/laybasic/laybasic.pro
+++ b/src/laybasic/laybasic/laybasic.pro
@@ -70,7 +70,8 @@ FORMS = \
NetlistBrowserConfigPage.ui \
NetlistBrowserConfigPage2.ui \
NetlistBrowserDialog.ui \
- NetInfoDialog.ui
+ NetInfoDialog.ui \
+ NetExportDialog.ui
RESOURCES = \
laybasicResources.qrc
@@ -169,7 +170,8 @@ SOURCES = \
layNetlistBrowserDialog.cc \
layNetlistBrowserPage.cc \
layItemDelegates.cc \
- layNetInfoDialog.cc
+ layNetInfoDialog.cc \
+ layNetExportDialog.cc
HEADERS = \
gtf.h \
@@ -260,7 +262,8 @@ HEADERS = \
layNetlistBrowserDialog.h \
layNetlistBrowserPage.h \
layItemDelegates.h \
- layNetInfoDialog.h
+ layNetInfoDialog.h \
+ layNetExportDialog.h
INCLUDEPATH += $$TL_INC $$GSI_INC $$DB_INC $$RDB_INC
DEPENDPATH += $$TL_INC $$GSI_INC $$DB_INC $$RDB_INC