Aligned net browser config with net tracer.

This commit is contained in:
Matthias Koefferlein 2019-04-27 00:30:45 +02:00
parent c613ddb633
commit dc3f200119
8 changed files with 708 additions and 337 deletions

View File

@ -13,29 +13,29 @@
<property name="windowTitle">
<string>Netlist Database Browser</string>
</property>
<layout class="QVBoxLayout">
<property name="spacing">
<number>6</number>
</property>
<property name="margin">
<number>9</number>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QGroupBox" name="groupBox">
<property name="title">
<string>Netlist Browser</string>
<string>Net Browser</string>
</property>
<layout class="QGridLayout">
<property name="margin">
<property name="leftMargin">
<number>9</number>
</property>
<property name="topMargin">
<number>9</number>
</property>
<property name="rightMargin">
<number>9</number>
</property>
<property name="bottomMargin">
<number>9</number>
</property>
<property name="spacing">
<number>6</number>
</property>
<item row="2" column="3">
<widget class="QLineEdit" name="le_max_markers"/>
</item>
<item row="1" column="2">
<item row="0" column="2">
<spacer>
<property name="orientation">
<enum>Qt::Horizontal</enum>
@ -51,14 +51,7 @@
</property>
</spacer>
</item>
<item row="1" column="0">
<widget class="QLabel" name="textLabel1_2">
<property name="text">
<string>Window </string>
</property>
</widget>
</item>
<item row="1" column="1">
<item row="0" column="1">
<widget class="QComboBox" name="cbx_window">
<item>
<property name="text">
@ -67,83 +60,78 @@
</item>
<item>
<property name="text">
<string>Fit context cell</string>
<string>Fit net with margin ..</string>
</property>
</item>
<item>
<property name="text">
<string>Fit marker with margin ..</string>
<string>Center net</string>
</property>
</item>
<item>
<property name="text">
<string>Center marker</string>
</property>
</item>
<item>
<property name="text">
<string>Center marker with size ..</string>
</property>
</item>
</widget>
</item>
<item row="0" column="1" colspan="4">
<widget class="QComboBox" name="cbx_context">
<item>
<property name="text">
<string>Any Cell</string>
</property>
</item>
<item>
<property name="text">
<string>Netlist Top Circuit</string>
</property>
</item>
<item>
<property name="text">
<string>Current Cell</string>
</property>
</item>
<item>
<property name="text">
<string>Current or Any Cell</string>
</property>
</item>
<item>
<property name="text">
<string>Net's Circuit</string>
<string>Center net with size ..</string>
</property>
</item>
</widget>
</item>
<item row="1" column="3">
<widget class="QLineEdit" name="le_window">
<property name="enabled">
<bool>false</bool>
</property>
</widget>
</item>
<item row="2" column="0" colspan="2">
<widget class="QLabel" name="label_2">
<property name="text">
<string>Maximum number of shapes to show for net</string>
<widget class="QLineEdit" name="le_max_markers">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="textLabel1_3">
<widget class="QLabel" name="textLabel1_2">
<property name="text">
<string>Context</string>
<string>Window </string>
</property>
</widget>
</item>
<item row="1" column="4">
<item row="0" column="4">
<widget class="QLabel" name="textLabel2">
<property name="text">
<string>µm</string>
</property>
</widget>
</item>
<item row="0" column="3">
<widget class="QLineEdit" name="le_window">
<property name="enabled">
<bool>false</bool>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item row="0" column="5" rowspan="2">
<spacer>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="1" column="0" colspan="3">
<widget class="QLabel" name="label_2">
<property name="text">
<string>Maximum number of shapes highlighted</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>

View File

@ -1,146 +1,460 @@
<ui version="4.0" >
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>NetlistBrowserConfigPage2</class>
<widget class="QFrame" name="NetlistBrowserConfigPage2" >
<property name="geometry" >
<widget class="QFrame" name="NetlistBrowserConfigPage2">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>571</width>
<height>174</height>
<height>331</height>
</rect>
</property>
<property name="windowTitle" >
<property name="windowTitle">
<string>Netlist Browser</string>
</property>
<layout class="QVBoxLayout" >
<property name="margin" >
<number>9</number>
</property>
<property name="spacing" >
<number>6</number>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QGroupBox" name="groupBox_2" >
<property name="title" >
<widget class="QGroupBox" name="groupBox_2">
<property name="title">
<string>Net Appearance</string>
</property>
<layout class="QGridLayout" >
<property name="margin" >
<layout class="QGridLayout">
<property name="leftMargin">
<number>9</number>
</property>
<property name="spacing" >
<property name="topMargin">
<number>9</number>
</property>
<property name="rightMargin">
<number>9</number>
</property>
<property name="bottomMargin">
<number>9</number>
</property>
<property name="spacing">
<number>6</number>
</property>
<item row="2" column="1" colspan="2" >
<widget class="QCheckBox" name="halo_cb" >
<property name="text" >
<string>With halo</string>
<item row="0" column="0">
<widget class="QLabel" name="label_6">
<property name="text">
<string>By default, the original layer's style is used for the highlighted net.
This style can be overridden by specifying a color, stipple, line width etc.
Leave those fields empty to use the original style.
With &quot;original color&quot;, the color intensity adjustment allows increasing or decreasing the
brightness of the color used.</string>
</property>
<property name="tristate" >
<bool>true</bool>
<property name="wordWrap">
<bool>false</bool>
</property>
</widget>
</item>
<item row="1" column="4" >
<widget class="QLineEdit" name="vs_le" />
</item>
<item row="0" column="4" >
<widget class="QLineEdit" name="lw_le" />
</item>
<item row="1" column="5" >
<widget class="QLabel" name="label_5" >
<property name="text" >
<string>pixel</string>
</property>
</widget>
</item>
<item row="0" column="6" >
<item row="1" column="0">
<spacer>
<property name="orientation" >
<enum>Qt::Horizontal</enum>
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" >
<size>
<width>71</width>
<height>31</height>
</size>
</property>
</spacer>
</item>
<item row="0" column="5" >
<widget class="QLabel" name="textLabel2_2" >
<property name="sizePolicy" >
<sizepolicy>
<hsizetype>0</hsizetype>
<vsizetype>0</vsizetype>
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text" >
<string>pixel</string>
</property>
</widget>
</item>
<item row="0" column="3" >
<widget class="QLabel" name="textLabel1_4" >
<property name="text" >
<string>Line width</string>
</property>
</widget>
</item>
<item row="0" column="2" >
<spacer>
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType" >
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" >
<property name="sizeHint" stdset="0">
<size>
<width>41</width>
<height>31</height>
<width>556</width>
<height>16</height>
</size>
</property>
</spacer>
</item>
<item row="1" column="3" >
<widget class="QLabel" name="vs_lbl" >
<property name="text" >
<string>Vertex size</string>
<item row="3" column="0">
<widget class="QFrame" name="frame_2">
<property name="frameShape">
<enum>QFrame::NoFrame</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<layout class="QGridLayout" name="_2">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<property name="spacing">
<number>6</number>
</property>
<item row="0" column="0" colspan="6">
<widget class="QLabel" name="label_3">
<property name="text">
<string>Net highlighting</string>
</property>
</widget>
</item>
<item row="3" column="0">
<spacer>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>16</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="1" column="0">
<spacer>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>16</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="1" column="2">
<widget class="QLabel" name="label_9">
<property name="text">
<string>or</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item row="1" column="4">
<widget class="QLabel" name="label_4">
<property name="text">
<string>% intensity increase</string>
</property>
</widget>
</item>
<item row="1" column="5">
<spacer>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>201</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="3" column="3" colspan="3">
<widget class="QFrame" name="frame_3">
<property name="frameShape">
<enum>QFrame::NoFrame</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<layout class="QHBoxLayout" name="_3">
<property name="spacing">
<number>6</number>
</property>
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="QToolButton" name="cc0">
<property name="text">
<string>...</string>
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="cc1">
<property name="text">
<string>...</string>
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="cc2">
<property name="text">
<string>...</string>
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="cc3">
<property name="text">
<string>...</string>
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="cc4">
<property name="text">
<string>...</string>
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="cc5">
<property name="text">
<string>...</string>
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="cc6">
<property name="text">
<string>...</string>
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="cc7">
<property name="text">
<string>...</string>
</property>
</widget>
</item>
<item>
<spacer>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</item>
<item row="3" column="1" colspan="2">
<widget class="QCheckBox" name="cycle_colors_cb">
<property name="text">
<string>Auto-color with palette</string>
</property>
</widget>
</item>
<item row="2" column="0" colspan="6">
<widget class="QLabel" name="label_8">
<property name="text">
<string>Net coloring</string>
</property>
</widget>
</item>
<item row="1" column="3">
<widget class="QSpinBox" name="brightness_sb">
<property name="minimum">
<number>-100</number>
</property>
<property name="maximum">
<number>100</number>
</property>
<property name="singleStep">
<number>10</number>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="lay::ColorButton" name="color_pb">
<property name="sizePolicy">
<sizepolicy hsizetype="Ignored" vsizetype="Ignored">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="toolTip">
<string>The color in which the rulers are drawn</string>
</property>
<property name="text">
<string/>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="0" column="1" >
<widget class="lay::ColorButton" name="color_pb" >
<property name="toolTip" >
<string>The color in which the nets are drawn</string>
<item row="2" column="0">
<widget class="QFrame" name="frame">
<property name="frameShape">
<enum>QFrame::NoFrame</enum>
</property>
<property name="text" >
<string/>
</property>
</widget>
</item>
<item row="0" column="0" >
<widget class="QLabel" name="textLabel3_2" >
<property name="text" >
<string>Net color</string>
</property>
</widget>
</item>
<item row="1" column="0" >
<widget class="QLabel" name="label" >
<property name="text" >
<string>Stipple</string>
</property>
</widget>
</item>
<item row="1" column="1" >
<widget class="lay::DitherPatternSelectionButton" name="stipple_pb" >
<property name="text" >
<string/>
<property name="frameShadow">
<enum>QFrame::Plain</enum>
</property>
<layout class="QGridLayout" name="_4">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<property name="spacing">
<number>6</number>
</property>
<item row="2" column="3">
<widget class="QLabel" name="vs_lbl">
<property name="text">
<string>Vertex size</string>
</property>
</widget>
</item>
<item row="0" column="3" rowspan="2">
<widget class="QLabel" name="textLabel1_4">
<property name="text">
<string>Line width</string>
</property>
</widget>
</item>
<item row="2" column="5">
<widget class="QLabel" name="label_5">
<property name="text">
<string>pixel</string>
</property>
</widget>
</item>
<item row="0" column="6" rowspan="3">
<spacer>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>71</width>
<height>31</height>
</size>
</property>
</spacer>
</item>
<item row="2" column="4">
<widget class="QLineEdit" name="vs_le">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item row="0" column="4" rowspan="2">
<widget class="QLineEdit" name="lw_le">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item row="3" column="0" colspan="7">
<spacer>
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>590</width>
<height>16</height>
</size>
</property>
</spacer>
</item>
<item row="0" column="1" rowspan="2">
<widget class="lay::DitherPatternSelectionButton" name="stipple_pb">
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="0" column="0" rowspan="2">
<widget class="QLabel" name="label">
<property name="text">
<string>Stipple </string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QCheckBox" name="halo_cb">
<property name="text">
<string/>
</property>
<property name="tristate">
<bool>true</bool>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_7">
<property name="text">
<string>Halo</string>
</property>
</widget>
</item>
<item row="0" column="5" rowspan="2">
<widget class="QLabel" name="textLabel2_2">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>pixel</string>
</property>
</widget>
</item>
<item row="0" column="2" rowspan="3">
<spacer>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>16</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</item>
</layout>
@ -148,7 +462,7 @@
</item>
</layout>
</widget>
<layoutdefault spacing="6" margin="11" />
<layoutdefault spacing="6" margin="11"/>
<customwidgets>
<customwidget>
<class>lay::DitherPatternSelectionButton</class>

View File

@ -28,60 +28,28 @@
#include <set>
#include <QColorDialog>
#include <QPainter>
namespace lay
{
// ------------------------------------------------------------
// Declaration of the configuration options
std::string cfg_l2ndb_context_mode ("l2n-context-mode");
std::string cfg_l2ndb_show_all ("l2n-show-all");
std::string cfg_l2ndb_window_state ("l2n-window-state");
std::string cfg_l2ndb_window_mode ("l2n-window-mode");
std::string cfg_l2ndb_window_dim ("l2n-window-dim");
std::string cfg_l2ndb_max_marker_count ("l2n-max-marker-count");
std::string cfg_l2ndb_highlight_color ("l2n-highlight-color");
std::string cfg_l2ndb_highlight_line_width ("l2n-highlight-line-width");
std::string cfg_l2ndb_highlight_vertex_size ("l2n-highlight-vertex-size");
std::string cfg_l2ndb_highlight_halo ("l2n-highlight-halo");
std::string cfg_l2ndb_highlight_dither_pattern ("l2n-highlight-dither-pattern");
// ------------------------------------------------------------
static struct {
lay::NetlistBrowserConfig::net_context_mode_type mode;
const char *string;
} context_modes [] = {
{ lay::NetlistBrowserConfig::AnyCell, "any-cell" },
{ lay::NetlistBrowserConfig::NetlistTop, "netlist-top" },
{ lay::NetlistBrowserConfig::Current, "current-cell" },
{ lay::NetlistBrowserConfig::CurrentOrAny, "current-or-any-cell" },
{ lay::NetlistBrowserConfig::Local, "local-cell" },
};
void
NetlistBrowserContextModeConverter::from_string (const std::string &value, lay::NetlistBrowserConfig::net_context_mode_type &mode)
{
for (unsigned int i = 0; i < sizeof (context_modes) / sizeof (context_modes [0]); ++i) {
if (value == context_modes [i].string) {
mode = context_modes [i].mode;
return;
}
}
throw tl::Exception (tl::to_string (QObject::tr ("Invalid marker database browser context mode: ")) + value);
}
std::string
NetlistBrowserContextModeConverter::to_string (lay::NetlistBrowserConfig::net_context_mode_type mode)
{
for (unsigned int i = 0; i < sizeof (context_modes) / sizeof (context_modes [0]); ++i) {
if (mode == context_modes [i].mode) {
return context_modes [i].string;
}
}
return "";
}
extern const std::string cfg_l2ndb_marker_color ("l2ndb-marker-color");
extern const std::string cfg_l2ndb_marker_cycle_colors ("l2ndb-marker-cycle-colors");
extern const std::string cfg_l2ndb_marker_cycle_colors_enabled ("l2ndb-marker-cycle-colors-enabled");
extern const std::string cfg_l2ndb_marker_dither_pattern ("l2ndb-marker-dither-pattern");
extern const std::string cfg_l2ndb_marker_line_width ("l2ndb-marker-line-width");
extern const std::string cfg_l2ndb_marker_vertex_size ("l2ndb-marker-vertex-size");
extern const std::string cfg_l2ndb_marker_halo ("l2ndb-marker-halo");
extern const std::string cfg_l2ndb_marker_intensity ("l2ndb-marker-intensity");
extern const std::string cfg_l2ndb_window_mode ("l2ndb-window-mode");
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");
// ------------------------------------------------------------
@ -90,8 +58,7 @@ static struct {
const char *string;
} window_modes [] = {
{ lay::NetlistBrowserConfig::DontChange, "dont-change" },
{ lay::NetlistBrowserConfig::FitCell, "fit-cell" },
{ lay::NetlistBrowserConfig::FitNet, "fit-net" },
{ lay::NetlistBrowserConfig::FitNet, "fit-net" },
{ lay::NetlistBrowserConfig::Center, "center" },
{ lay::NetlistBrowserConfig::CenterSize, "center-size" }
};
@ -105,7 +72,7 @@ NetlistBrowserWindowModeConverter::from_string (const std::string &value, lay::N
return;
}
}
throw tl::Exception (tl::to_string (QObject::tr ("Invalid marker database browser window mode: ")) + value);
throw tl::Exception (tl::to_string (QObject::tr ("Invalid net tracer window mode: ")) + value);
}
std::string
@ -119,9 +86,7 @@ NetlistBrowserWindowModeConverter::to_string (lay::NetlistBrowserConfig::net_win
return "";
}
// ------------------------------------------------------------
// Implementation of NetlistBrowserConfigPage
NetlistBrowserConfigPage::NetlistBrowserConfigPage (QWidget *parent)
: lay::ConfigPage (parent)
@ -134,11 +99,6 @@ NetlistBrowserConfigPage::NetlistBrowserConfigPage (QWidget *parent)
void
NetlistBrowserConfigPage::setup (lay::PluginRoot *root)
{
// context mode
lay::NetlistBrowserConfig::net_context_mode_type cmode = lay::NetlistBrowserConfig::NetlistTop;
root->config_get (cfg_l2ndb_context_mode, cmode, NetlistBrowserContextModeConverter ());
cbx_context->setCurrentIndex (int (cmode));
// window mode
lay::NetlistBrowserConfig::net_window_type wmode = lay::NetlistBrowserConfig::FitNet;
root->config_get (cfg_l2ndb_window_mode, wmode, NetlistBrowserWindowModeConverter ());
@ -149,9 +109,9 @@ NetlistBrowserConfigPage::setup (lay::PluginRoot *root)
root->config_get (cfg_l2ndb_window_dim, wdim);
le_window->setText (tl::to_qstring (tl::to_string (wdim)));
// max. marker count
unsigned int max_marker_count = 1000;
root->config_get (cfg_l2ndb_max_marker_count, max_marker_count);
// max. shapes highlighted
unsigned int max_marker_count = 10000;
root->config_get (cfg_l2ndb_max_shapes_highlighted, max_marker_count);
le_max_markers->setText (tl::to_qstring (tl::to_string (max_marker_count)));
// enable controls
@ -170,35 +130,95 @@ NetlistBrowserConfigPage::commit (lay::PluginRoot *root)
double dim = 1.0;
tl::from_string (tl::to_string (le_window->text ()), dim);
unsigned int max_markers_count = 1000;
tl::from_string (tl::to_string (le_max_markers->text ()), max_markers_count);
unsigned int max_shapes_highlighted = 10000;
tl::from_string (tl::to_string (le_max_markers->text ()), max_shapes_highlighted);
root->config_set (cfg_l2ndb_context_mode, lay::NetlistBrowserConfig::net_context_mode_type (cbx_context->currentIndex ()), NetlistBrowserContextModeConverter ());
root->config_set (cfg_l2ndb_window_mode, lay::NetlistBrowserConfig::net_window_type (cbx_window->currentIndex ()), NetlistBrowserWindowModeConverter ());
root->config_set (cfg_l2ndb_window_dim, dim);
root->config_set (cfg_l2ndb_max_marker_count, max_markers_count);
root->config_set (cfg_l2ndb_max_shapes_highlighted, max_shapes_highlighted);
}
// ------------------------------------------------------------
// Implementation of NetlistBrowserConfigPage2
static QToolButton * (Ui::NetlistBrowserConfigPage2::*cc_buttons []) = {
&Ui::NetlistBrowserConfigPage2::cc0,
&Ui::NetlistBrowserConfigPage2::cc1,
&Ui::NetlistBrowserConfigPage2::cc2,
&Ui::NetlistBrowserConfigPage2::cc3,
&Ui::NetlistBrowserConfigPage2::cc4,
&Ui::NetlistBrowserConfigPage2::cc5,
&Ui::NetlistBrowserConfigPage2::cc6,
&Ui::NetlistBrowserConfigPage2::cc7
};
NetlistBrowserConfigPage2::NetlistBrowserConfigPage2 (QWidget *parent)
: lay::ConfigPage (parent)
{
Ui::NetlistBrowserConfigPage2::setupUi (this);
for (unsigned int i = 0; i < sizeof (cc_buttons) / sizeof (cc_buttons [0]); ++i) {
connect (this->*(cc_buttons [i]), SIGNAL (clicked ()), this, SLOT (color_button_clicked ()));
}
}
void
NetlistBrowserConfigPage2::color_button_clicked ()
{
for (unsigned int i = 0; i < sizeof (cc_buttons) / sizeof (cc_buttons [0]); ++i) {
if (sender () == this->*(cc_buttons [i])) {
QColor c;
if (m_palette.colors () > i) {
c = QColorDialog::getColor (m_palette.color_by_index (i));
} else {
c = QColorDialog::getColor ();
}
if (c.isValid ()) {
m_palette.set_color (i, c.rgb ());
update_colors ();
}
break;
}
}
}
void
NetlistBrowserConfigPage2::setup (lay::PluginRoot *root)
{
bool cycle_enabled = false;
root->config_get (cfg_l2ndb_marker_cycle_colors_enabled, cycle_enabled);
cycle_colors_cb->setChecked (cycle_enabled);
std::string cc;
root->config_get (cfg_l2ndb_marker_cycle_colors, cc);
try {
m_palette.from_string (cc, true);
} catch (...) {
}
while (m_palette.colors () < sizeof (cc_buttons) / sizeof (cc_buttons [0])) {
m_palette.set_color (int (m_palette.colors ()), 0);
}
update_colors ();
// marker color
QColor color;
root->config_get (cfg_l2ndb_highlight_color, color, lay::ColorConverter ());
root->config_get (cfg_l2ndb_marker_color, color, lay::ColorConverter ());
color_pb->set_color (color);
// brightness offset
int brightness = 0;
root->config_get (cfg_l2ndb_marker_intensity, brightness);
brightness_sb->setValue (brightness);
// marker line width
int lw = 0;
root->config_get (cfg_l2ndb_highlight_line_width, lw);
root->config_get (cfg_l2ndb_marker_line_width, lw);
if (lw < 0) {
lw_le->setText (QString ());
} else {
@ -207,7 +227,7 @@ NetlistBrowserConfigPage2::setup (lay::PluginRoot *root)
// marker vertex size
int vs = 0;
root->config_get (cfg_l2ndb_highlight_vertex_size, vs);
root->config_get (cfg_l2ndb_marker_vertex_size, vs);
if (vs < 0) {
vs_le->setText (QString ());
} else {
@ -216,50 +236,81 @@ NetlistBrowserConfigPage2::setup (lay::PluginRoot *root)
// stipple pattern
int dp = 0;
root->config_get (cfg_l2ndb_highlight_dither_pattern, dp);
root->config_get (cfg_l2ndb_marker_dither_pattern, dp);
stipple_pb->set_dither_pattern (dp);
// halo
int halo = 0;
root->config_get (cfg_l2ndb_highlight_halo, halo);
root->config_get (cfg_l2ndb_marker_halo, halo);
halo_cb->setCheckState (halo < 0 ? Qt::PartiallyChecked : (halo ? Qt::Checked : Qt::Unchecked));
}
void
NetlistBrowserConfigPage2::update_colors ()
{
for (unsigned int i = 0; i < sizeof (cc_buttons) / sizeof (cc_buttons [0]); ++i) {
QColor color;
if (i < m_palette.colors ()) {
color = QColor (m_palette.color_by_index (i));
}
QFontMetrics fm (font (), this);
QRect rt (fm.boundingRect (QString::fromUtf8 ("AA")));
QPixmap pxmp (rt.width () + 10, rt.height () + 10);
QPainter pxpainter (&pxmp);
pxpainter.setPen (QPen (palette ().color (QPalette::Active, QPalette::Text)));
pxpainter.setBrush (QBrush (color));
QRect r (0, 0, pxmp.width () - 1, pxmp.height () - 1);
pxpainter.drawRect (r);
(this->*(cc_buttons [i]))->setIconSize (pxmp.size ());
(this->*(cc_buttons [i]))->setIcon (QIcon (pxmp));
}
}
void
NetlistBrowserConfigPage2::commit (lay::PluginRoot *root)
{
QColor color (color_pb->get_color ());
root->config_set (cfg_l2ndb_highlight_color, color, lay::ColorConverter ());
root->config_set (cfg_l2ndb_marker_cycle_colors_enabled, cycle_colors_cb->isChecked ());
root->config_set (cfg_l2ndb_marker_cycle_colors, m_palette.to_string ());
QColor color = color_pb->get_color ();
root->config_set (cfg_l2ndb_marker_color, color, lay::ColorConverter ());
if (lw_le->text ().isEmpty ()) {
root->config_set (cfg_l2ndb_highlight_line_width, -1);
root->config_set (cfg_l2ndb_marker_line_width, -1);
} else {
try {
int s;
tl::from_string (tl::to_string (lw_le->text ()), s);
root->config_set (cfg_l2ndb_highlight_line_width, s);
root->config_set (cfg_l2ndb_marker_line_width, s);
} catch (...) { }
}
if (vs_le->text ().isEmpty ()) {
root->config_set (cfg_l2ndb_highlight_vertex_size, -1);
root->config_set (cfg_l2ndb_marker_vertex_size, -1);
} else {
try {
int s;
tl::from_string (tl::to_string (vs_le->text ()), s);
root->config_set (cfg_l2ndb_highlight_vertex_size, s);
root->config_set (cfg_l2ndb_marker_vertex_size, s);
} catch (...) { }
}
root->config_set (cfg_l2ndb_highlight_dither_pattern, stipple_pb->dither_pattern ());
root->config_set (cfg_l2ndb_marker_dither_pattern, stipple_pb->dither_pattern ());
if (halo_cb->checkState () == Qt::PartiallyChecked) {
root->config_set (cfg_l2ndb_highlight_halo, -1);
root->config_set (cfg_l2ndb_marker_halo, -1);
} else if (halo_cb->checkState () == Qt::Unchecked) {
root->config_set (cfg_l2ndb_highlight_halo, 0);
root->config_set (cfg_l2ndb_marker_halo, 0);
} else if (halo_cb->checkState () == Qt::Checked) {
root->config_set (cfg_l2ndb_highlight_halo, 1);
root->config_set (cfg_l2ndb_marker_halo, 1);
}
root->config_set (cfg_l2ndb_marker_intensity, brightness_sb->value ());
}
// ------------------------------------------------------------
@ -271,16 +322,19 @@ class NetlistBrowserPluginDeclaration
public:
virtual void get_options (std::vector < std::pair<std::string, std::string> > &options) const
{
options.push_back (std::pair<std::string, std::string> (cfg_l2ndb_context_mode, "netlist-top"));
options.push_back (std::pair<std::string, std::string> (cfg_l2ndb_window_mode, "fit-net"));
options.push_back (std::pair<std::string, std::string> (cfg_l2ndb_window_state, ""));
options.push_back (std::pair<std::string, std::string> (cfg_l2ndb_window_dim, "1.0"));
options.push_back (std::pair<std::string, std::string> (cfg_l2ndb_max_marker_count, "1000"));
options.push_back (std::pair<std::string, std::string> (cfg_l2ndb_highlight_color, lay::ColorConverter ().to_string (QColor ())));
options.push_back (std::pair<std::string, std::string> (cfg_l2ndb_highlight_line_width, "-1"));
options.push_back (std::pair<std::string, std::string> (cfg_l2ndb_highlight_vertex_size, "-1"));
options.push_back (std::pair<std::string, std::string> (cfg_l2ndb_highlight_halo, "-1"));
options.push_back (std::pair<std::string, std::string> (cfg_l2ndb_highlight_dither_pattern, "-1"));
options.push_back (std::pair<std::string, std::string> (cfg_l2ndb_max_shapes_highlighted, "10000"));
options.push_back (std::pair<std::string, std::string> (cfg_l2ndb_marker_color, lay::ColorConverter ().to_string (QColor ())));
options.push_back (std::pair<std::string, std::string> (cfg_l2ndb_marker_cycle_colors_enabled, "false"));
options.push_back (std::pair<std::string, std::string> (cfg_l2ndb_marker_cycle_colors, "255,0,0 0,255,0 0,0,255 255,255,0 255,0,255 0,255,255 160,80,255 255,160,0"));
options.push_back (std::pair<std::string, std::string> (cfg_l2ndb_marker_line_width, "-1"));
options.push_back (std::pair<std::string, std::string> (cfg_l2ndb_marker_vertex_size, "-1"));
options.push_back (std::pair<std::string, std::string> (cfg_l2ndb_marker_halo, "-1"));
options.push_back (std::pair<std::string, std::string> (cfg_l2ndb_marker_dither_pattern, "-1"));
options.push_back (std::pair<std::string, std::string> (cfg_l2ndb_marker_intensity, "50"));
options.push_back (std::pair<std::string, std::string> (cfg_l2ndb_show_all, "true"));
options.push_back (std::pair<std::string, std::string> (cfg_l2ndb_window_state, ""));
}
virtual std::vector<std::pair <std::string, lay::ConfigPage *> > config_pages (QWidget *parent) const

View File

@ -25,6 +25,7 @@
#define HDR_layNetlistBrowser
#include "layPlugin.h"
#include "layColorPalette.h"
#include "ui_NetlistBrowserConfigPage.h"
#include "ui_NetlistBrowserConfigPage2.h"
@ -37,8 +38,7 @@ namespace lay
struct NetlistBrowserConfig
{
enum net_context_mode_type { AnyCell = 0, NetlistTop, Current, CurrentOrAny, Local };
enum net_window_type { DontChange = 0, FitCell, FitNet, Center, CenterSize };
enum net_window_type { DontChange = 0, FitNet, Center, CenterSize };
};
class NetlistBrowserConfigPage
@ -68,13 +68,14 @@ public:
virtual void setup (lay::PluginRoot *root);
virtual void commit (lay::PluginRoot *root);
};
class NetlistBrowserContextModeConverter
{
public:
void from_string (const std::string &value, lay::NetlistBrowserConfig::net_context_mode_type &mode);
std::string to_string (lay::NetlistBrowserConfig::net_context_mode_type mode);
public slots:
void color_button_clicked ();
private:
void update_colors ();
lay::ColorPalette m_palette;
};
class NetlistBrowserWindowModeConverter

View File

@ -40,29 +40,32 @@
namespace lay
{
extern std::string cfg_l2ndb_context_mode;
extern std::string cfg_l2ndb_show_all;
extern std::string cfg_l2ndb_window_state;
extern std::string cfg_l2ndb_window_mode;
extern std::string cfg_l2ndb_window_dim;
extern std::string cfg_l2ndb_max_marker_count;
extern std::string cfg_l2ndb_highlight_color;
extern std::string cfg_l2ndb_highlight_line_width;
extern std::string cfg_l2ndb_highlight_vertex_size;
extern std::string cfg_l2ndb_highlight_halo;
extern std::string cfg_l2ndb_highlight_dither_pattern;
extern const std::string cfg_l2ndb_marker_color;
extern const std::string cfg_l2ndb_marker_cycle_colors;
extern const std::string cfg_l2ndb_marker_cycle_colors_enabled;
extern const std::string cfg_l2ndb_marker_dither_pattern;
extern const std::string cfg_l2ndb_marker_line_width;
extern const std::string cfg_l2ndb_marker_vertex_size;
extern const std::string cfg_l2ndb_marker_halo;
extern const std::string cfg_l2ndb_marker_intensity;
extern const std::string cfg_l2ndb_window_mode;
extern const std::string cfg_l2ndb_window_dim;
extern const std::string cfg_l2ndb_max_shapes_highlighted;
extern const std::string cfg_l2ndb_show_all;
extern const std::string cfg_l2ndb_window_state;
NetlistBrowserDialog::NetlistBrowserDialog (lay::PluginRoot *root, lay::LayoutView *vw)
: lay::Browser (root, vw),
Ui::NetlistBrowserDialog (),
m_context (lay::NetlistBrowserConfig::AnyCell),
m_window (lay::NetlistBrowserConfig::FitNet),
m_window_dim (0.0),
m_max_shape_count (0),
m_auto_color_enabled (false),
m_marker_line_width (-1),
m_marker_vertex_size (-1),
m_marker_halo (-1),
m_marker_dither_pattern (-1),
m_marker_intensity (0),
m_cv_index (-1),
m_l2n_index (-1)
{
@ -288,13 +291,7 @@ NetlistBrowserDialog::configure (const std::string &name, const std::string &val
bool taken = true;
bool show_all = browser_frame->show_all ();
if (name == cfg_l2ndb_context_mode) {
NetlistBrowserConfig::net_context_mode_type context = m_context;
NetlistBrowserContextModeConverter ().from_string (value, context);
need_update = lay::test_and_set (m_context, context);
} else if (name == cfg_l2ndb_show_all) {
if (name == cfg_l2ndb_show_all) {
tl::from_string (value, show_all);
@ -313,63 +310,69 @@ NetlistBrowserDialog::configure (const std::string &name, const std::string &val
need_update = true;
}
} else if (name == cfg_l2ndb_max_marker_count) {
} else if (name == cfg_l2ndb_max_shapes_highlighted) {
unsigned int mc = 0;
tl::from_string (value, mc);
need_update = lay::test_and_set (m_max_shape_count, mc);
} else if (name == cfg_l2ndb_highlight_color) {
} else if (name == cfg_l2ndb_marker_color) {
QColor color;
if (! value.empty ()) {
lay::ColorConverter ().from_string (value, color);
}
if (color != m_marker_color) {
m_marker_color = color;
need_update = true;
}
need_update = lay::test_and_set (m_marker_color, color);
} else if (name == cfg_l2ndb_highlight_line_width) {
} else if (name == cfg_l2ndb_marker_cycle_colors) {
lay::ColorPalette colors;
colors.from_string (value, true);
need_update = lay::test_and_set (m_auto_colors, colors);
} else if (name == cfg_l2ndb_marker_cycle_colors) {
bool f = false;
tl::from_string (value, f);
need_update = lay::test_and_set (m_auto_color_enabled, f);
} else if (name == cfg_l2ndb_marker_line_width) {
int lw = 0;
tl::from_string (value, lw);
if (lw != m_marker_line_width) {
m_marker_line_width = lw;
need_update = true;
}
need_update = lay::test_and_set (m_marker_line_width, lw);
} else if (name == cfg_l2ndb_highlight_vertex_size) {
} else if (name == cfg_l2ndb_marker_vertex_size) {
int vs = 0;
tl::from_string (value, vs);
if (vs != m_marker_vertex_size) {
m_marker_vertex_size = vs;
need_update = true;
}
need_update = lay::test_and_set (m_marker_vertex_size, vs);
} else if (name == cfg_l2ndb_highlight_halo) {
} else if (name == cfg_l2ndb_marker_halo) {
int halo = 0;
tl::from_string (value, halo);
if (halo != m_marker_halo) {
m_marker_halo = halo;
need_update = true;
}
need_update = lay::test_and_set (m_marker_halo, halo);
} else if (name == cfg_l2ndb_highlight_dither_pattern) {
} else if (name == cfg_l2ndb_marker_dither_pattern) {
int dp = 0;
tl::from_string (value, dp);
if (dp != m_marker_dither_pattern) {
m_marker_dither_pattern = dp;
need_update = true;
}
need_update = lay::test_and_set (m_marker_dither_pattern, dp);
} else if (name == cfg_l2ndb_marker_intensity) {
int bo = 0;
tl::from_string (value, bo);
need_update = lay::test_and_set (m_marker_intensity, bo);
} else {
taken = false;
@ -377,8 +380,8 @@ NetlistBrowserDialog::configure (const std::string &name, const std::string &val
if (active () && need_update) {
browser_frame->set_max_shape_count (m_max_shape_count);
browser_frame->set_window (m_window, m_window_dim, m_context);
browser_frame->set_highlight_style (m_marker_color, m_marker_line_width, m_marker_vertex_size, m_marker_halo, m_marker_dither_pattern);
browser_frame->set_window (m_window, m_window_dim);
browser_frame->set_highlight_style (m_marker_color, m_marker_line_width, m_marker_vertex_size, m_marker_halo, m_marker_dither_pattern, m_marker_intensity, m_auto_color_enabled ? &m_auto_colors : 0);
}
browser_frame->show_all (show_all);
@ -522,8 +525,8 @@ NetlistBrowserDialog::update_content ()
browser_frame->enable_updates (false); // Avoid building the internal lists several times ...
browser_frame->set_l2ndb (l2ndb);
browser_frame->set_max_shape_count (m_max_shape_count);
browser_frame->set_highlight_style (m_marker_color, m_marker_line_width, m_marker_vertex_size, m_marker_halo, m_marker_dither_pattern);
browser_frame->set_window (m_window, m_window_dim, m_context);
browser_frame->set_highlight_style (m_marker_color, m_marker_line_width, m_marker_vertex_size, m_marker_halo, m_marker_dither_pattern, m_marker_intensity, m_auto_color_enabled ? &m_auto_colors : 0);
browser_frame->set_window (m_window, m_window_dim);
browser_frame->set_view (view (), m_cv_index);
browser_frame->enable_updates (true);

View File

@ -27,6 +27,7 @@
#include "ui_NetlistBrowserDialog.h"
#include "layBrowser.h"
#include "layNetlistBrowser.h"
#include "layColorPalette.h"
namespace lay
{
@ -69,15 +70,17 @@ public slots:
void configure_clicked ();
private:
lay::NetlistBrowserConfig::net_context_mode_type m_context;
lay::NetlistBrowserConfig::net_window_type m_window;
double m_window_dim;
unsigned int m_max_shape_count;
QColor m_marker_color;
lay::ColorPalette m_auto_colors;
bool m_auto_color_enabled;
int m_marker_line_width;
int m_marker_vertex_size;
int m_marker_halo;
int m_marker_dither_pattern;
int m_marker_intensity;
std::string m_layout_name;
int m_cv_index;
std::string m_l2ndb_name;

View File

@ -1265,7 +1265,6 @@ NetlistBrowserModel::subcircuit_index (const db::SubCircuit *sub_circuit) const
NetlistBrowserPage::NetlistBrowserPage (QWidget * /*parent*/)
: m_show_all (true),
m_context (lay::NetlistBrowserConfig::NetlistTop),
m_window (lay::NetlistBrowserConfig::FitNet),
m_window_dim (0.0),
m_max_shape_count (1000),
@ -1273,6 +1272,8 @@ NetlistBrowserPage::NetlistBrowserPage (QWidget * /*parent*/)
m_marker_vertex_size (-1),
m_marker_halo (-1),
m_marker_dither_pattern (-1),
m_marker_intensity (0),
m_auto_colors_enabled (false),
mp_view (0),
m_cv_index (0),
mp_plugin_root (0),
@ -1313,7 +1314,7 @@ NetlistBrowserPage::NetlistBrowserPage (QWidget * /*parent*/)
NetlistBrowserPage::~NetlistBrowserPage ()
{
// @@@
// .. nothing yet ..
}
void
@ -1323,13 +1324,18 @@ NetlistBrowserPage::set_plugin_root (lay::PluginRoot *pr)
}
void
NetlistBrowserPage::set_highlight_style (QColor color, int line_width, int vertex_size, int halo, int dither_pattern)
NetlistBrowserPage::set_highlight_style (QColor color, int line_width, int vertex_size, int halo, int dither_pattern, int marker_intensity, const lay::ColorPalette *auto_colors)
{
m_marker_color = color;
m_marker_line_width = line_width;
m_marker_vertex_size = vertex_size;
m_marker_halo = halo;
m_marker_dither_pattern = dither_pattern;
m_marker_intensity = marker_intensity;
m_auto_colors_enabled = (auto_colors != 0);
if (auto_colors) {
m_auto_colors = *auto_colors;
}
update_highlights ();
}
@ -1342,12 +1348,11 @@ NetlistBrowserPage::set_view (lay::LayoutView *view, unsigned int cv_index)
}
void
NetlistBrowserPage::set_window (lay::NetlistBrowserConfig::net_window_type window, double window_dim, lay::NetlistBrowserConfig::net_context_mode_type context)
NetlistBrowserPage::set_window (lay::NetlistBrowserConfig::net_window_type window, double window_dim)
{
if (window != m_window || window_dim != m_window_dim || context != m_context) {
if (window != m_window || window_dim != m_window_dim) {
m_window = window;
m_window_dim = window_dim;
m_context = context;
}
}

View File

@ -26,6 +26,7 @@
#include "ui_NetlistBrowserPage.h"
#include "layNetlistBrowser.h"
#include "layColorPalette.h"
#include "laybasicCommon.h"
#include "dbBox.h"
#include "dbLayoutToNetlist.h"
@ -203,7 +204,7 @@ public:
/**
* @brief Set the window type and window dimensions
*/
void set_window (lay::NetlistBrowserConfig::net_window_type window_type, double window_dim, lay::NetlistBrowserConfig::net_context_mode_type context);
void set_window (lay::NetlistBrowserConfig::net_window_type window_type, double window_dim);
/**
* @brief Update the net highlights
@ -227,7 +228,7 @@ public:
* @param halo The halo flag or -1 for default
* @param dither_pattern The dither pattern index of -1 to take the default
*/
void set_highlight_style (QColor color, int line_width, int vertex_size, int halo, int dither_pattern);
void set_highlight_style (QColor color, int line_width, int vertex_size, int halo, int dither_pattern, int marker_intensity, const lay::ColorPalette *auto_colors);
/**
* @brief Gets a value indicating whether all items in the netlist tree are shown (specifically for cross-reference DBs)
@ -260,7 +261,6 @@ private slots:
private:
bool m_show_all;
QAction *m_show_all_action;
NetlistBrowserConfig::net_context_mode_type m_context;
NetlistBrowserConfig::net_window_type m_window;
double m_window_dim;
size_t m_max_shape_count;
@ -269,6 +269,9 @@ private:
int m_marker_vertex_size;
int m_marker_halo;
int m_marker_dither_pattern;
int m_marker_intensity;
lay::ColorPalette m_auto_colors;
bool m_auto_colors_enabled;
lay::LayoutView *mp_view;
unsigned int m_cv_index;
lay::PluginRoot *mp_plugin_root;