diff --git a/src/buddies/src/bd/bdReaderOptions.cc b/src/buddies/src/bd/bdReaderOptions.cc
index 3d3b9f75e..448febe1f 100644
--- a/src/buddies/src/bd/bdReaderOptions.cc
+++ b/src/buddies/src/bd/bdReaderOptions.cc
@@ -647,7 +647,7 @@ GenericReaderOptions::add_options (tl::CommandLineOptions &cmd)
"* 1: produce LEF geometry always and ignore FOREIGN\n"
"* 2: Never produce LEF geometry and assume FOREIGN always\n"
"\n"
- "In case of FOREIGN macros in mode 1 or always in mode 2, the '--" + m_long_prefix + "lefdef-lef-layouts' option is available to specify "
+ "In case of FOREIGN macros in mode 0 or always in mode 2, the '--" + m_long_prefix + "lefdef-lef-layouts' option is available to specify "
"external layout files for providing the LEF macro layouts.\n"
)
<< tl::arg (group +
diff --git a/src/doc/doc/manual/drc_runsets.xml b/src/doc/doc/manual/drc_runsets.xml
index 7642c4c16..4e3274524 100644
--- a/src/doc/doc/manual/drc_runsets.xml
+++ b/src/doc/doc/manual/drc_runsets.xml
@@ -444,8 +444,7 @@ output(w, "width violations")
| (or),
- (not),
^ (xor),
- + (xor),
- join
+ + (join),
Sizing:
size,
diff --git a/src/klayout_main/klayout_main/klayout.cc b/src/klayout_main/klayout_main/klayout.cc
index f813f404b..f8ea6924d 100644
--- a/src/klayout_main/klayout_main/klayout.cc
+++ b/src/klayout_main/klayout_main/klayout.cc
@@ -87,6 +87,8 @@ FORCE_LINK_GSI_QTUITOOLS
#include
#include
+#include
+#include
#include
int klayout_main (int &argc, char **argv);
@@ -202,6 +204,74 @@ void custom_message_handler(QtMsgType type, const char *msg)
static int klayout_main_cont (int &argc, char **argv);
+namespace {
+
+class LogFileWriter
+ : public tl::Channel
+{
+public:
+ static std::unique_ptr m_os;
+
+ LogFileWriter (int min_verbosity, const std::string &prefix)
+ : m_min_verbosity (min_verbosity), m_prefix (prefix), m_new_line (true)
+ { }
+
+ static bool open (const std::string &path)
+ {
+ m_os.reset (new std::ofstream (path));
+ return m_os->good ();
+ }
+
+ void puts (const char *s)
+ {
+ if (m_os && tl::verbosity () >= m_min_verbosity) {
+ m_os->write (s, strlen (s));
+ }
+ }
+
+ void endl ()
+ {
+ puts ("\n");
+ m_new_line = true;
+ }
+
+ void end ()
+ {
+ if (m_os && tl::verbosity () >= m_min_verbosity) {
+ m_os->flush ();
+ }
+ }
+
+ void begin ()
+ {
+ if (m_new_line) {
+ puts (m_prefix.c_str ());
+ m_new_line = false;
+ }
+ }
+
+ void yield () { }
+
+private:
+ int m_min_verbosity;
+ std::string m_prefix;
+ bool m_new_line;
+};
+
+std::unique_ptr LogFileWriter::m_os;
+
+}
+
+static void set_log_file (const std::string &log_file)
+{
+ if (LogFileWriter::open (log_file)) {
+ tl::info.add (new LogFileWriter (0, std::string ()), true);
+ tl::log.add (new LogFileWriter (10, std::string ()), true);
+ tl::warn.add (new LogFileWriter (0, std::string ("Warning: ")), true);
+ tl::error.add (new LogFileWriter (0, std::string ("ERROR: ")), true);
+ }
+}
+
/**
* @brief The basic entry point
* Note that by definition, klayout_main receives arguments in UTF-8
@@ -229,7 +299,7 @@ klayout_main (int &argc, char **argv)
about_text += prg_about_text;
lay::Version::set_about_text (about_text.c_str ());
- // Capture the shortcut command line arguments and the verbosity settings
+ // Capture the shortcut command line arguments, log file and the verbosity settings
// for early errors and warnings
for (int i = 1; i < argc; ++i) {
@@ -244,6 +314,10 @@ klayout_main (int &argc, char **argv)
tl::info << lay::ApplicationBase::usage () << tl::noendl;
return 0;
+ } else if (argv [i] == std::string ("-k") && (i + 1) < argc) {
+
+ set_log_file (argv [++i]);
+
} else if (argv [i] == std::string ("-d") && (i + 1) < argc) {
int v = 0;
diff --git a/src/lay/lay/layApplication.cc b/src/lay/lay/layApplication.cc
index 1b008fb7a..b3fb02ce6 100644
--- a/src/lay/lay/layApplication.cc
+++ b/src/lay/lay/layApplication.cc
@@ -317,6 +317,11 @@ ApplicationBase::parse_cmd (int &argc, char **argv)
}
tl::verbosity (v);
+ } else if (a == "-k" && (i + 1) < argc) {
+
+ // ignored (handled earlier)
+ ++i;
+
} else if (a == "-l" && (i + 1) < argc) {
m_layer_props_file = args [++i];
@@ -1055,6 +1060,7 @@ ApplicationBase::usage ()
r += tl::to_string (QObject::tr (" -i Disable undo buffering (less memory requirements)")) + "\n";
r += tl::to_string (QObject::tr (" -ni Enable undo buffering (default, overrides previous -i option)")) + "\n";
r += tl::to_string (QObject::tr (" -j Add the given path to the macro project paths")) + "\n";
+ r += tl::to_string (QObject::tr (" -k Write log to the given file plus stdout/stderr")) + "\n";
r += tl::to_string (QObject::tr (" -l Use layer properties file")) + "\n";
r += tl::to_string (QObject::tr (" -lx With -l: add other layers as well")) + "\n";
r += tl::to_string (QObject::tr (" -lf With -l: use the lyp file as it is (no expansion to multiple layouts)")) + "\n";
diff --git a/src/lay/lay/layMainWindow.cc b/src/lay/lay/layMainWindow.cc
index 8e80edf82..52138e745 100644
--- a/src/lay/lay/layMainWindow.cc
+++ b/src/lay/lay/layMainWindow.cc
@@ -4333,7 +4333,8 @@ public:
menu_entries.push_back (lay::menu_item ("cm_reset_window_state", "reset_window_state", at, tl::to_string (QObject::tr ("Restore Window")))),
menu_entries.push_back (lay::separator ("selection_group", at));
menu_entries.push_back (lay::config_menu_item ("transient_selection", at, tl::to_string (QObject::tr ("Highlight Object Under Mouse")), cfg_sel_transient_mode, "?"));
- menu_entries.push_back (lay::config_menu_item ("mouse_tracking", at, tl::to_string (QObject::tr ("Mouse tracking")), cfg_tracking_cursor_enabled, "?"));
+ menu_entries.push_back (lay::config_menu_item ("mouse_tracking", at, tl::to_string (QObject::tr ("Mouse Tracking")), cfg_tracking_cursor_enabled, "?"));
+ menu_entries.push_back (lay::config_menu_item ("crosshair_cursor", at, tl::to_string (QObject::tr ("Crosshair Cursor")), cfg_crosshair_cursor_enabled, "?"));
at = "help_menu.end";
menu_entries.push_back (lay::menu_item ("cm_show_all_tips", "show_all_tips", at, tl::to_string (QObject::tr ("Show All Tips"))));
diff --git a/src/laybasic/laybasic/layLayoutViewBase.cc b/src/laybasic/laybasic/layLayoutViewBase.cc
index 9f4fa5b47..ff7cec227 100644
--- a/src/laybasic/laybasic/layLayoutViewBase.cc
+++ b/src/laybasic/laybasic/layLayoutViewBase.cc
@@ -741,6 +741,10 @@ LayoutViewBase::configure (const std::string &name, const std::string &value)
return true;
}
+ if (mp_tracker && mp_tracker->configure (name, value)) {
+ return true;
+ }
+
if (name == cfg_default_lyp_file) {
m_def_lyp_file = value;
@@ -3693,6 +3697,9 @@ LayoutViewBase::refresh ()
// Issue a "tick" to execute all other pending tasks
timer ();
+
+ // Update the view ops as this is not always guaranteed (issue #1512)
+ set_view_ops ();
}
void
diff --git a/src/laybasic/laybasic/layLayoutViewConfig.cc b/src/laybasic/laybasic/layLayoutViewConfig.cc
index a21e172e4..519458b67 100644
--- a/src/laybasic/laybasic/layLayoutViewConfig.cc
+++ b/src/laybasic/laybasic/layLayoutViewConfig.cc
@@ -72,11 +72,15 @@ public:
options.push_back (std::pair (cfg_sel_line_width, "1"));
options.push_back (std::pair (cfg_sel_vertex_size, "3"));
options.push_back (std::pair (cfg_sel_dither_pattern, "1"));
+ options.push_back (std::pair (cfg_sel_line_style, "0"));
options.push_back (std::pair (cfg_sel_halo, "true"));
options.push_back (std::pair (cfg_sel_transient_mode, "true"));
options.push_back (std::pair (cfg_sel_inside_pcells_mode, "false"));
options.push_back (std::pair (cfg_tracking_cursor_enabled, "true"));
options.push_back (std::pair (cfg_tracking_cursor_color, cc.to_string (tl::Color ())));
+ options.push_back (std::pair (cfg_crosshair_cursor_color, cc.to_string (tl::Color ())));
+ options.push_back (std::pair (cfg_crosshair_cursor_line_style, "0"));
+ options.push_back (std::pair (cfg_crosshair_cursor_enabled, "false"));
options.push_back (std::pair (cfg_background_color, cc.to_string (tl::Color ())));
options.push_back (std::pair (cfg_ctx_color, cc.to_string (tl::Color ())));
options.push_back (std::pair (cfg_ctx_dimming, "50"));
diff --git a/src/laybasic/laybasic/layLineStyles.cc b/src/laybasic/laybasic/layLineStyles.cc
index a4a3856f8..06667092b 100644
--- a/src/laybasic/laybasic/layLineStyles.cc
+++ b/src/laybasic/laybasic/layLineStyles.cc
@@ -175,31 +175,38 @@ LineStyleInfo::is_bit_set (unsigned int n) const
#if defined(HAVE_QT)
QBitmap
-LineStyleInfo::get_bitmap (int width, int height) const
+LineStyleInfo::get_bitmap (int w, int h, int fw) const
{
- if (height < 0) {
- height = 5;
- }
- if (width < 0) {
- width = 34;
- }
-
+ unsigned int height = h < 0 ? 5 : (unsigned int) h;
+ unsigned int width = w < 0 ? 34 : (unsigned int) w;
+ unsigned int frame_width = fw <= 0 ? 1 : (unsigned int) fw;
unsigned int stride = (width + 7) / 8;
unsigned char *data = new unsigned char[stride * height];
memset (data, 0x00, size_t (stride * height));
- for (unsigned int i = 0; i < (unsigned int)(height - 2); ++i) {
- if (is_bit_set (i)) {
- data [(height - 2 - i) * stride] |= 0x01;
- data [(height - 2 - i) * stride + (width - 1) / 8] |= (1 << ((width - 1) % 8));
+ unsigned int hv = height - 2 * frame_width;
+
+ for (unsigned int i = 0; i < hv; ++i) {
+ if (is_bit_set (i / frame_width + 1)) {
+ unsigned int y = height - 1 - frame_width - i;
+ for (unsigned int x = 0; x < frame_width; ++x) {
+ data [y * stride + x / 8] |= (1 << (x % 8));
+ }
+ for (unsigned int x = width - frame_width; x < width; ++x) {
+ data [y * stride + x / 8] |= (1 << (x % 8));
+ }
}
}
- for (unsigned int i = 1; i < (unsigned int)(width - 1); ++i) {
- if (is_bit_set (i)) {
- data [stride + i / 8] |= (1 << (i % 8));
- data [(height - 2) * stride + i / 8] |= (1 << (i % 8));
+ for (unsigned int i = 0; i < width; ++i) {
+ if (is_bit_set (i / frame_width)) {
+ for (unsigned int y = 0; y < frame_width; ++y) {
+ data [y * stride + i / 8] |= (1 << (i % 8));
+ }
+ for (unsigned int y = height - frame_width; y < height; ++y) {
+ data [y * stride + i / 8] |= (1 << (i % 8));
+ }
}
}
diff --git a/src/laybasic/laybasic/layLineStyles.h b/src/laybasic/laybasic/layLineStyles.h
index b29dbcb6e..b2317d574 100644
--- a/src/laybasic/laybasic/layLineStyles.h
+++ b/src/laybasic/laybasic/layLineStyles.h
@@ -150,8 +150,9 @@ public:
*
* @param width The desired width (-1 for default)
* @param height The desired height (-1 for default)
+ * @param The intended frame width in pixels
*/
- QBitmap get_bitmap (int width = -1, int height = -1) const;
+ QBitmap get_bitmap (int width = -1, int height = -1, int frame_width = 1) const;
#endif
/**
diff --git a/src/laybasic/laybasic/layMouseTracker.cc b/src/laybasic/laybasic/layMouseTracker.cc
index 818088d8f..93b9930fb 100644
--- a/src/laybasic/laybasic/layMouseTracker.cc
+++ b/src/laybasic/laybasic/layMouseTracker.cc
@@ -24,20 +24,69 @@
#include "layMouseTracker.h"
#include "layLayoutCanvas.h"
#include "layLayoutViewBase.h"
+#include "layConverters.h"
+#include "laybasicConfig.h"
namespace lay
{
MouseTracker::MouseTracker (lay::LayoutViewBase *view)
- : lay::ViewService (view->canvas ()), mp_view (view)
+ : lay::ViewService (view->canvas ()), mp_view (view),
+ m_cursor_color (tl::Color ()), m_cursor_line_style (0), m_cursor_enabled (false)
{
ui ()->grab_mouse (this, false);
}
+bool
+MouseTracker::leave_event (bool)
+{
+ mp_markers.clear ();
+ return false;
+}
+
+bool
+MouseTracker::configure (const std::string &name, const std::string &value)
+{
+ if (name == cfg_crosshair_cursor_color) {
+
+ tl::Color color;
+ lay::ColorConverter ().from_string (value, color);
+
+ // Change the color
+ if (lay::test_and_set (m_cursor_color, color)) {
+ mp_markers.clear ();
+ }
+
+ } else if (name == cfg_crosshair_cursor_line_style) {
+
+ int dp = 0;
+ tl::from_string (value, dp);
+
+ // Change the vertex_size
+ if (lay::test_and_set (m_cursor_line_style, dp)) {
+ mp_markers.clear ();
+ }
+
+ } else if (name == cfg_crosshair_cursor_enabled) {
+
+ bool f = m_cursor_enabled;
+ tl::from_string (value, f);
+ if (f != m_cursor_enabled) {
+ m_cursor_enabled = f;
+ mp_markers.clear ();
+ }
+
+ }
+
+ return false; // not taken
+}
+
bool
MouseTracker::mouse_move_event (const db::DPoint &p, unsigned int /*buttons*/, bool prio)
{
- if (prio) {
+ // NOTE: by catching events with low prio, the tracking position was already set by consumers
+ // with high prio
+ if (! prio) {
// NOTE: because the tracker grabs first and grabbers are registered first gets served last, the
// tracker will receive the event after all other mouse grabbers have been served and had their
@@ -50,6 +99,24 @@ MouseTracker::mouse_move_event (const db::DPoint &p, unsigned int /*buttons*/, b
mp_view->current_pos (tp.x (), tp.y ());
+ mp_markers.clear ();
+
+ if (m_cursor_enabled) {
+
+ double max_coord = 1e30; // big enough I guess
+
+ mp_markers.push_back (new lay::DMarker (mp_view));
+ mp_markers.back ()->set_line_style (m_cursor_line_style);
+ mp_markers.back ()->set_color (m_cursor_color);
+ mp_markers.back ()->set (db::DEdge (db::DPoint (tp.x (), -max_coord), db::DPoint (tp.x (), max_coord)));
+
+ mp_markers.push_back (new lay::DMarker (mp_view));
+ mp_markers.back ()->set_line_style (m_cursor_line_style);
+ mp_markers.back ()->set_color (m_cursor_color);
+ mp_markers.back ()->set (db::DEdge (db::DPoint (-max_coord, tp.y ()), db::DPoint (max_coord, tp.y ())));
+
+ }
+
}
return false;
diff --git a/src/laybasic/laybasic/layMouseTracker.h b/src/laybasic/laybasic/layMouseTracker.h
index 0fe26f5a9..b2ecbb27b 100644
--- a/src/laybasic/laybasic/layMouseTracker.h
+++ b/src/laybasic/laybasic/layMouseTracker.h
@@ -25,6 +25,8 @@
#define HDR_layMouseTracker
#include "layViewObject.h"
+#include "layMarker.h"
+#include "tlObject.h"
class QMouseEvent;
@@ -38,10 +40,17 @@ class MouseTracker
{
public:
MouseTracker (lay::LayoutViewBase *view);
+
virtual bool mouse_move_event (const db::DPoint &p, unsigned int buttons, bool prio);
+ bool leave_event (bool prio);
+ bool configure (const std::string &name, const std::string &value);
private:
lay::LayoutViewBase *mp_view;
+ tl::shared_collection mp_markers;
+ tl::Color m_cursor_color;
+ int m_cursor_line_style;
+ bool m_cursor_enabled;
};
}
diff --git a/src/laybasic/laybasic/layMove.h b/src/laybasic/laybasic/layMove.h
index a51884d6c..bed2a18cb 100644
--- a/src/laybasic/laybasic/layMove.h
+++ b/src/laybasic/laybasic/layMove.h
@@ -41,7 +41,7 @@ public:
MoveService (lay::LayoutViewBase *view);
~MoveService ();
- virtual bool configure (const std::string &name, const std::string &value);
+ bool configure (const std::string &name, const std::string &value);
bool begin_move (db::Transaction *transaction = 0, bool transient_selection = false);
private:
diff --git a/src/laybasic/laybasic/laybasicConfig.h b/src/laybasic/laybasic/laybasicConfig.h
index 5731b82be..ba148ee60 100644
--- a/src/laybasic/laybasic/laybasicConfig.h
+++ b/src/laybasic/laybasic/laybasicConfig.h
@@ -77,6 +77,9 @@ static const std::string cfg_sel_inside_pcells_mode ("sel-inside-pcells-mode");
static const std::string cfg_tracking_cursor_color ("tracking-cursor-color");
static const std::string cfg_tracking_cursor_enabled ("tracking-cursor-enabled");
+static const std::string cfg_crosshair_cursor_color ("crosshair-cursor-color");
+static const std::string cfg_crosshair_cursor_line_style ("crosshair-cursor-line-style");
+static const std::string cfg_crosshair_cursor_enabled ("crosshair-cursor-enabled");
static const std::string cfg_markers_visible ("markers-visible");
diff --git a/src/layui/layui/LayoutViewConfigPage2d.ui b/src/layui/layui/LayoutViewConfigPage2d.ui
index 0a9fc17f5..ad779f091 100644
--- a/src/layui/layui/LayoutViewConfigPage2d.ui
+++ b/src/layui/layui/LayoutViewConfigPage2d.ui
@@ -6,8 +6,8 @@
0
0
- 608
- 318
+ 696
+ 420
@@ -120,6 +120,62 @@
+ -
+
+
+ Crosshair cursor
+
+
+ true
+
+
+
-
+
+
+ Cursor color
+
+
+
+ -
+
+
+ Qt::Horizontal
+
+
+
+ 508
+ 31
+
+
+
+
+ -
+
+
+ The color in which the rulers are drawn
+
+
+
+
+
+
+ -
+
+
+ Line style
+
+
+
+ -
+
+
+
+
+
+
+
+
+
-
@@ -142,6 +198,11 @@
QPushButton
+
+ lay::LineStyleSelectionButton
+ QPushButton
+
+
color_pb
diff --git a/src/layui/layui/layLayoutViewConfigPages.cc b/src/layui/layui/layLayoutViewConfigPages.cc
index d8e2ccb4e..ac7070ca5 100644
--- a/src/layui/layui/layLayoutViewConfigPages.cc
+++ b/src/layui/layui/layLayoutViewConfigPages.cc
@@ -424,9 +424,21 @@ LayoutViewConfigPage2d::setup (lay::Dispatcher *root)
root->config_get (cfg_tracking_cursor_color, color, lay::ColorConverter ());
mp_ui->color_pb->set_color (color);
- bool enabled = 0;
+ bool enabled = false;
root->config_get (cfg_tracking_cursor_enabled, enabled);
mp_ui->tracking_cb->setChecked (enabled);
+
+ color = QColor ();
+ root->config_get (cfg_crosshair_cursor_color, color, lay::ColorConverter ());
+ mp_ui->color_chc->set_color (color);
+
+ int line_style = 0;
+ root->config_get (cfg_crosshair_cursor_line_style, line_style);
+ mp_ui->line_style_chc->set_line_style (line_style);
+
+ enabled = false;
+ root->config_get (cfg_crosshair_cursor_enabled, enabled);
+ mp_ui->crosshair_cursor_cb->setChecked (enabled);
}
void
@@ -435,6 +447,9 @@ LayoutViewConfigPage2d::commit (lay::Dispatcher *root)
lay::ColorConverter cc;
root->config_set (cfg_tracking_cursor_color, mp_ui->color_pb->get_color (), cc);
root->config_set (cfg_tracking_cursor_enabled, mp_ui->tracking_cb->isChecked ());
+ root->config_set (cfg_crosshair_cursor_color, mp_ui->color_chc->get_color (), cc);
+ root->config_set (cfg_crosshair_cursor_line_style, mp_ui->line_style_chc->line_style ());
+ root->config_set (cfg_crosshair_cursor_enabled, mp_ui->crosshair_cursor_cb->isChecked ());
}
// ------------------------------------------------------------
diff --git a/src/layui/layui/layWidgets.cc b/src/layui/layui/layWidgets.cc
index 2a9272412..06c6807dc 100644
--- a/src/layui/layui/layWidgets.cc
+++ b/src/layui/layui/layWidgets.cc
@@ -46,6 +46,7 @@
#include "tlInternational.h"
#include "laySelectStippleForm.h"
+#include "laySelectLineStyleForm.h"
#include
@@ -246,6 +247,199 @@ DitherPatternSelectionButton::update_menu ()
} catch (...) { }
}
+// -------------------------------------------------------------
+// LineStyleSelectionButton implementation
+
+LineStyleSelectionButton::LineStyleSelectionButton (QWidget *parent)
+ : QPushButton (parent), mp_view (0), m_line_style (-1)
+{
+ setMenu (new QMenu (this));
+ update_pattern ();
+ connect (menu (), SIGNAL (aboutToShow ()), this, SLOT (menu_about_to_show ()));
+}
+
+LineStyleSelectionButton::~LineStyleSelectionButton ()
+{
+ // .. nothing yet ..
+}
+
+void
+LineStyleSelectionButton::set_view (lay::LayoutViewBase *view)
+{
+ if (view != mp_view) {
+ mp_view = view;
+ update_menu ();
+ }
+}
+
+void
+LineStyleSelectionButton::set_line_style (int ls)
+{
+ if (ls != m_line_style) {
+ m_line_style = ls;
+ update_pattern ();
+ }
+}
+
+int
+LineStyleSelectionButton::line_style () const
+{
+ return m_line_style;
+}
+
+void
+LineStyleSelectionButton::menu_selected ()
+{
+ QAction *action = dynamic_cast (sender ());
+ if (action) {
+
+ m_line_style = action->data ().toInt ();
+ update_pattern ();
+ emit (line_style_changed (m_line_style));
+
+ }
+}
+
+void
+LineStyleSelectionButton::browse_selected ()
+{
+ if (mp_view) {
+
+ SelectLineStyleForm styles_form (0, mp_view->line_styles (), true);
+ styles_form.set_selected (m_line_style);
+
+ if (styles_form.exec ()) {
+
+ m_line_style = styles_form.selected ();
+ update_pattern ();
+ emit (line_style_changed (m_line_style));
+
+ }
+
+ } else {
+
+ // Use the default (non-custom) pattern if no view is set.
+ lay::LineStyles default_pattern;
+
+ SelectLineStyleForm styles_form (0, default_pattern, true);
+ styles_form.set_selected (m_line_style);
+
+ if (styles_form.exec ()) {
+
+ m_line_style = styles_form.selected ();
+ update_pattern ();
+ emit (line_style_changed (m_line_style));
+
+ }
+
+ }
+}
+
+void
+LineStyleSelectionButton::update_pattern ()
+{
+ QPushButton::setText (QString::fromUtf8 (" "));
+
+ QString text = QString::fromUtf8 ("XXXXXXX");
+ QFontMetrics fm (font (), this);
+ QRect rt (fm.boundingRect (text)); // dummy text to be compliant with the other color button
+
+ QPushButton::setIconSize (QSize (rt.width (), rt.height ()));
+
+#if QT_VERSION >= 0x050000
+ double dpr = devicePixelRatio ();
+#else
+ double dpr = 1.0;
+#endif
+
+ if (m_line_style < 0) {
+
+ QPixmap pixmap (rt.width () * dpr, rt.height () * dpr);
+#if QT_VERSION >= 0x050000
+ pixmap.setDevicePixelRatio (dpr);
+#endif
+ pixmap.fill (QColor (0, 0, 0, 0));
+
+ QPainter pxpainter (&pixmap);
+ pxpainter.setFont (font ());
+ QColor text_color = palette ().color (QPalette::Active, QPalette::Text);
+ pxpainter.setPen (QPen (text_color));
+
+ QRectF r (0, 0, rt.width () - pxpainter.pen ().widthF (), rt.height () - pxpainter.pen ().widthF ());
+ pxpainter.drawText (r, Qt::AlignHCenter | Qt::AlignVCenter | Qt::TextSingleLine, QObject::tr ("None"));
+
+ QPushButton::setIcon (QIcon (pixmap));
+
+ } else {
+
+ const lay::LineStyleInfo *dp_info;
+ if (mp_view) {
+ dp_info = & mp_view->line_styles ().style ((unsigned int) m_line_style);
+ } else {
+ static lay::LineStyles default_pattern;
+ dp_info = & default_pattern.style ((unsigned int) m_line_style);
+ }
+
+ QPushButton::setIcon (dp_info->get_bitmap (rt.width () * dpr, rt.height () * dpr, dpr));
+
+ }
+}
+
+void
+LineStyleSelectionButton::menu_about_to_show ()
+{
+ update_menu ();
+}
+
+void
+LineStyleSelectionButton::update_menu ()
+{
+ menu ()->clear ();
+ menu ()->addAction (QObject::tr ("None"), this, SLOT (menu_selected ()))->setData (-1);
+ menu ()->addAction (QObject::tr ("Choose ..."), this, SLOT (browse_selected ()));
+ menu ()->addSeparator ();
+
+ // from_string might throw an exception ...
+ try {
+
+ lay::LineStyles patterns;
+
+ std::string s;
+ if (lay::Dispatcher::instance ()) {
+ lay::Dispatcher::instance ()->config_get (cfg_line_style_palette, s);
+ }
+ lay::LineStylePalette palette = lay::LineStylePalette::default_palette ();
+ if (! s.empty ()) {
+ palette.from_string (s);
+ }
+
+ // fill the list of stipple palette items
+ for (unsigned int i = 0; i < palette.styles (); ++i) {
+
+ unsigned int n = palette.style_by_index (i);
+ if (int (n) < std::distance (patterns.begin (), patterns.end ())) {
+
+#if QT_VERSION > 0x050000
+ double dpr = devicePixelRatio ();
+#else
+ double dpr = 1.0;
+#endif
+
+ lay::LineStyleInfo info = patterns.begin () [n];
+
+ std::string name (info.name ());
+ if (name.empty ()) {
+ name = tl::sprintf ("#%d", n);
+ }
+
+ menu ()->addAction (QIcon (info.get_bitmap (16, 8)), tl::to_qstring (name), this, SLOT (menu_selected ()))->setData (n);
+
+ }
+ }
+
+ } catch (...) { }
+}
+
// -------------------------------------------------------------
// CellViewSelectionComboBox implementation
diff --git a/src/layui/layui/layWidgets.h b/src/layui/layui/layWidgets.h
index adfa708b6..787d171e5 100644
--- a/src/layui/layui/layWidgets.h
+++ b/src/layui/layui/layWidgets.h
@@ -115,6 +115,68 @@ private:
void update_menu ();
};
+/**
+ * @brief A selection button for dither pattern
+ */
+class LAYUI_PUBLIC LineStyleSelectionButton
+ : public QPushButton
+{
+Q_OBJECT
+
+public:
+ /**
+ * @brief Constructor
+ */
+ LineStyleSelectionButton (QWidget *parent);
+
+ /**
+ * @brief Destructor
+ */
+ ~LineStyleSelectionButton ();
+
+ /**
+ * @brief Associate with a view
+ *
+ * This method is required to select the proper dither pattern
+ */
+ void set_view (lay::LayoutViewBase *view);
+
+ /**
+ * @brief Set the line style index
+ */
+ void set_line_style (int ls);
+
+ /**
+ * @brief Get the line style index
+ */
+ int line_style () const;
+
+ /**
+ * @brief Override setText
+ */
+ void setText (const QString &) { }
+
+ /**
+ * @brief Override setPixmap
+ */
+ void setPixmap (const QPixmap &) { }
+
+signals:
+ void line_style_changed (int);
+
+private slots:
+ void browse_selected ();
+ void menu_selected ();
+ void menu_about_to_show ();
+
+private:
+ lay::LayoutViewBase *mp_view;
+ int m_line_style;
+
+ void update_pattern ();
+ void update_menu ();
+};
+
/**
* @brief A library selection combo box
*
diff --git a/src/plugins/streamers/lefdef/db_plugin/dbLEFDEFImporter.cc b/src/plugins/streamers/lefdef/db_plugin/dbLEFDEFImporter.cc
index 88c48749f..14cc5eef0 100644
--- a/src/plugins/streamers/lefdef/db_plugin/dbLEFDEFImporter.cc
+++ b/src/plugins/streamers/lefdef/db_plugin/dbLEFDEFImporter.cc
@@ -228,12 +228,12 @@ RuleBasedViaGenerator::create_cell (LEFDEFReaderState &reader, Layout &layout, d
std::set dl;
- dl = reader.open_layer (layout, m_bottom_layer, ViaGeometry, mask_bottom, via_box.enlarged (m_be));
+ dl = reader.open_layer (layout, m_bottom_layer, ViaGeometry, mask_bottom);
for (std::set::const_iterator l = dl.begin (); l != dl.end (); ++l) {
cell.shapes (*l).insert (db::Polygon (via_box.enlarged (m_be).moved (m_bo)));
}
- dl = reader.open_layer (layout, m_top_layer, ViaGeometry, mask_top, via_box.enlarged (m_te));
+ dl = reader.open_layer (layout, m_top_layer, ViaGeometry, mask_top);
for (std::set::const_iterator l = dl.begin (); l != dl.end (); ++l) {
cell.shapes (*l).insert (db::Polygon (via_box.enlarged (m_te).moved (m_to)));
}
@@ -1372,9 +1372,12 @@ LEFDEFReaderState::open_layer (db::Layout &layout, const std::string &n, LayerPu
if (mask > 0) {
tl::warn << tl::to_string (tr (" Mask ")) << mask << tl::noendl;
}
+// not printing via size - too confusing?
+#if 0
if (via_size != db::DVector ()) {
tl::warn << tl::to_string (tr (" Via size ")) << via_size.to_string () << tl::noendl;
}
+#endif
tl::warn << tl::to_string (tr (" - layer is ignored"));
}