Merge branch 'master' into pymod

This commit is contained in:
Matthias Koefferlein
2018-09-01 09:37:08 +02:00
122 changed files with 3082 additions and 587 deletions
+12
View File
@@ -164,6 +164,18 @@ Class<lay::DMarker> decl_Marker ("lay", "Marker",
"@brief Returns a value indicating whether the marker has a specific frame color\n"
"The set method has been added in version 0.20.\n"
) +
gsi::method ("dismissable=", &lay::DMarker::set_dismissable,
"@brief Sets a value indicating whether the marker can be hidden\n"
"@args flag\n"
"Dismissable markers can be hidden setting \"View/Show Markers\" to \"off\". "
"The default setting is \"false\" meaning the marker can't be hidden.\n"
"\n"
"This attribute has been introduced in version 0.25.4."
) +
gsi::method ("dismissable?", &lay::DMarker::get_dismissable,
"@brief Gets a value indicating whether the marker can be hidden\n"
"See \\dismissable= for a description of this predicate."
) +
gsi::method ("line_width=", &lay::DMarker::set_line_width,
"@brief Sets the line width of the marker\n"
"@args width\n"
+25
View File
@@ -258,6 +258,31 @@ LayoutHandle::set_save_options (const db::SaveLayoutOptions &options, bool valid
m_save_options_valid = valid;
}
void
LayoutHandle::update_save_options (db::SaveLayoutOptions &options)
{
for (tl::Registrar<lay::PluginDeclaration>::iterator cls = tl::Registrar<lay::PluginDeclaration>::begin (); cls != tl::Registrar<lay::PluginDeclaration>::end (); ++cls) {
const lay::StreamWriterPluginDeclaration *decl = dynamic_cast <const lay::StreamWriterPluginDeclaration *> (&*cls);
if (! decl) {
continue;
}
std::auto_ptr<db::FormatSpecificWriterOptions> specific_options;
if (options.get_options (decl->format_name ())) {
specific_options.reset (options.get_options (decl->format_name ())->clone ());
} else {
specific_options.reset (decl->create_specific_options ());
}
if (specific_options.get ()) {
decl->initialize_options_from_layout_handle (specific_options.get (), *this);
options.set_options (specific_options.release ());
}
}
}
void
LayoutHandle::save_as (const std::string &fn, tl::OutputStream::OutputStreamMode om, const db::SaveLayoutOptions &options, bool update)
{
+9
View File
@@ -234,6 +234,15 @@ public:
return m_save_options;
}
/**
* @brief Updates the given save options with attributes from this cell view
*
* Some formats will initialize attributes from the cell view and the layout's
* metadata (example: libname of GDS2). This method will update the options
* if the layout provides attributes for initializing the latter.
*/
void update_save_options (db::SaveLayoutOptions &options);
/**
* @brief Gets a flag indicating whether the save options are valid
*
+14 -2
View File
@@ -625,6 +625,18 @@ ReplaceCellOptionsDialog::~ReplaceCellOptionsDialog ()
mp_ui = 0;
}
static std::pair<bool, db::cell_index_type>
find_cell_by_display_name (const db::Layout &layout, const std::string &cn)
{
for (db::Layout::const_iterator c = layout.begin (); c != layout.end (); ++c) {
if (layout.display_name (c->cell_index ()) == cn) {
return std::make_pair (true, c->cell_index ());
}
}
return std::make_pair (false, 0);
}
bool
ReplaceCellOptionsDialog::exec_dialog (const lay::CellView &cv, int &replace_mode, db::cell_index_type &cell_index)
{
@@ -647,7 +659,7 @@ ReplaceCellOptionsDialog::exec_dialog (const lay::CellView &cv, int &replace_mod
}
std::string cn = tl::to_string (mp_ui->cell_selection_cbx->lineEdit ()->text ());
std::pair<bool, db::cell_index_type> cc = cv->layout ().cell_by_name (cn.c_str ());
std::pair<bool, db::cell_index_type> cc = find_cell_by_display_name (cv->layout (), cn.c_str ());
cell_index = cc.second;
return cc.first;
@@ -665,7 +677,7 @@ BEGIN_PROTECTED;
lay::CellTreeModel *model = dynamic_cast<lay::CellTreeModel *> (mp_ui->cell_selection_cbx->model ());
if (model) {
std::string cn = tl::to_string (mp_ui->cell_selection_cbx->lineEdit ()->text ());
std::pair<bool, db::cell_index_type> cc = model->layout ()->cell_by_name (cn.c_str ());
std::pair<bool, db::cell_index_type> cc = find_cell_by_display_name (*model->layout (), cn.c_str ());
if (! cc.first) {
throw tl::Exception (tl::to_string (QObject::tr ("Not a valid cell name: ")) + cn);
}
@@ -555,6 +555,7 @@ DitherPatternInfo::operator< (const DitherPatternInfo &d) const
return m_order_index < d.m_order_index;
}
// TODO including a scaling algorithm in this formula, or give more resolution to the dither
QBitmap
DitherPatternInfo::get_bitmap (int width, int height) const
{
+33 -8
View File
@@ -200,16 +200,29 @@ LCPDitherPalette::create_pixmap_for (LCPActiveLabel *b, int n)
const unsigned int h = 24;
const unsigned int w = 24;
QImage image (w, h, QImage::Format_RGB32);
image.fill (color0.rgb ());
#if QT_VERSION > 0x050000
unsigned int dpr = devicePixelRatio ();
#else
unsigned int dpr = 1;
#endif
QBitmap bitmap = pattern.pattern (n).get_bitmap (w, h);
QImage image (w * dpr, h * dpr, QImage::Format_RGB32);
image.fill (color0.rgb ());
#if QT_VERSION > 0x050000
image.setDevicePixelRatio (dpr);
#endif
// TODO include a scaling algorithm in get_bitmap, because it looks small in highDPI screens
QBitmap bitmap = pattern.pattern (n).get_bitmap (w * dpr, h * dpr);
QPainter painter (&image);
painter.setPen (QPen (color1));
painter.setBackgroundMode (Qt::TransparentMode);
painter.drawPixmap (0, 0, bitmap);
painter.drawPixmap (0, 0, w, h, bitmap);
QPixmap pixmap = QPixmap::fromImage (image); // Qt 4.6.0 workaround
#if QT_VERSION > 0x050000
pixmap.setDevicePixelRatio (dpr);
#endif
b->setPixmap (pixmap);
}
@@ -629,16 +642,28 @@ LCPStylePalette::create_pixmap_for_line_style (LCPActiveLabel *b, int n)
const unsigned int h = 14;
const unsigned int w = 24;
QImage image (w, h, QImage::Format_RGB32);
image.fill (color0.rgb ());
#if QT_VERSION > 0x050000
unsigned int dpr = devicePixelRatio ();
#else
unsigned int dpr = 1;
#endif
QBitmap bitmap = styles.style (n).get_bitmap (w, h);
QImage image (dpr * w, dpr * h, QImage::Format_RGB32);
image.fill (color0.rgb ());
#if QT_VERSION > 0x050000
image.setDevicePixelRatio (dpr);
#endif
QBitmap bitmap = styles.style (n).get_bitmap (dpr * w, dpr * h);
QPainter painter (&image);
painter.setPen (QPen (color1));
painter.setBackgroundMode (Qt::TransparentMode);
painter.drawPixmap (0, 0, bitmap);
painter.drawPixmap (0, 0, w, h, bitmap);
QPixmap pixmap = QPixmap::fromImage (image); // Qt 4.6.0 workaround
#if QT_VERSION > 0x050000
pixmap.setDevicePixelRatio (dpr);
#endif
b->setPixmap (pixmap);
}
-2
View File
@@ -291,8 +291,6 @@ LayoutCanvas::LayoutCanvas (QWidget *parent, lay::LayoutView *view, const char *
{
#if QT_VERSION > 0x050000
m_dpr = devicePixelRatio ();
#else
m_dpr = 1;
#endif
// The gamma value used for subsampling: something between 1.8 and 2.2.
+18 -1
View File
@@ -384,6 +384,7 @@ LayoutView::init (db::Manager *mgr, lay::PluginRoot *root, QWidget * /*parent*/)
m_apply_text_trans = true;
m_default_text_size = 0.1;
m_text_font = 0;
m_show_markers = true;
m_no_stipples = false;
m_stipple_offset = true;
m_fit_new_cell = true;
@@ -1155,6 +1156,13 @@ LayoutView::configure (const std::string &name, const std::string &value)
apply_text_trans (flag);
return true;
} else if (name == cfg_markers_visible) {
bool flag;
tl::from_string (value, flag);
mp_canvas->set_dismiss_view_objects (! flag);
return true;
} else if (name == cfg_no_stipple) {
bool flag;
@@ -4923,7 +4931,16 @@ LayoutView::no_stipples (bool f)
}
}
void
void
LayoutView::show_markers (bool f)
{
if (m_show_markers != f) {
m_show_markers = f;
mp_canvas->update_image ();
}
}
void
LayoutView::text_color (QColor c)
{
if (m_text_color != c) {
+14
View File
@@ -1062,6 +1062,19 @@ public:
return m_default_text_size;
}
/**
* @brief Show or hide markers
*/
void show_markers (bool f);
/**
* @brief "show_markers" property getter
*/
bool show_markers () const
{
return m_show_markers;
}
/**
* @brief Don't show stipples
*/
@@ -2671,6 +2684,7 @@ private:
bool m_apply_text_trans;
double m_default_text_size;
unsigned int m_text_font;
bool m_show_markers;
bool m_no_stipples;
bool m_stipple_offset;
@@ -819,9 +819,22 @@ LayoutViewConfigPage4::update ()
}
}
#if QT_VERSION > 0x050000
unsigned int dpr = 1; //devicePixelRatio ();
#else
unsigned int dpr = 1;
#endif
QFontMetrics fm (font (), this);
QRect rt (fm.boundingRect (QString::fromUtf8 ("AA")));
QPixmap pxmp (rt.width () + 10, rt.height () + 10);
const unsigned int h = rt.height () + 10;
const unsigned int w = rt.width () + 10;
QPixmap pxmp (w * dpr, h * dpr);
#if QT_VERSION > 0x050000
pxmp.setDevicePixelRatio (dpr);
#endif
QPainter pxpainter (&pxmp);
pxpainter.setPen (QPen (palette ().color (QPalette::Active, QPalette::Text)));
@@ -1159,29 +1172,29 @@ LayoutViewConfigPage6::update ()
const unsigned int h = rt.height () + 10;
const unsigned int w = rt.width () + 10;
unsigned int color0 = palette ().color (QPalette::Active, QPalette::Button).rgb();
unsigned int color1 = palette ().color (QPalette::Active, QPalette::Dark).rgb();
QColor color0 = palette ().color (QPalette::Active, QPalette::Button);
QColor color1 = palette ().color (QPalette::Active, QPalette::Dark);
QImage image (w, h, QImage::Format_RGB32);
if (s >= 0) {
const uint32_t * const *dp = m_pattern.pattern ((unsigned int) s).pattern ();
for (unsigned int l = 0; l < h; ++l, ++dp) {
uint32_t m = **dp;
if (l == 0 || l == h - 1) {
m |= ((1 << w) - 1);
} else {
m |= ((1 << (w - 1)) | 1);
}
color_t *pt = (color_t *) image.scanLine (h - 1 - l);
for (unsigned int b = 0; b < w; ++b) {
*pt++ = (m & 1) ? color1 : color0;
m >>= 1;
}
}
}
#if QT_VERSION > 0x050000
unsigned int dpr = 1; //devicePixelRatio ();
#else
unsigned int dpr = 1;
#endif
QImage image (w * dpr, h * dpr, QImage::Format_RGB32);
#if QT_VERSION > 0x050000
image.setDevicePixelRatio (dpr);
#endif
image.fill (color0.rgb ());
// copying code from layLayerToolbox.cc
QBitmap bitmap = m_pattern.pattern ((unsigned int) s).get_bitmap (w * dpr, h * dpr);
QPainter painter (&image);
painter.setPen (QPen (color1));
painter.setBackgroundMode (Qt::TransparentMode);
painter.drawPixmap (0, 0, w, h, bitmap);
QPixmap pxmp = QPixmap::fromImage (image); // Qt 4.6.0 workaround
QPainter pxpainter (&pxmp);
pxpainter.setPen (QPen (palette ().color (QPalette::Active, QPalette::Text)));
QRect r (0, 0, pxmp.width () - 1, pxmp.height () - 1);
@@ -1189,6 +1202,10 @@ LayoutViewConfigPage6::update ()
pxpainter.setFont (font ());
pxpainter.drawText (r, Qt::AlignHCenter | Qt::AlignVCenter | Qt::TextSingleLine, text);
#if QT_VERSION > 0x050000
pxmp.setDevicePixelRatio (dpr);
#endif
(mp_ui->*(cfg6_buttons [i]))->setIconSize (pxmp.size ());
(mp_ui->*(cfg6_buttons [i]))->setIcon (QIcon (pxmp));
@@ -1366,16 +1383,28 @@ LayoutViewConfigPage6a::update ()
const unsigned int h = 26;
const unsigned int w = 26;
QImage image (w, h, QImage::Format_RGB32);
image.fill (color0.rgb ());
#if QT_VERSION > 0x050000
unsigned int dpr = 1; //devicePixelRatio ();
#else
unsigned int dpr = 1;
#endif
QBitmap bitmap = m_style.style (s).get_bitmap (w, h);
QImage image (w * dpr, h * dpr, QImage::Format_RGB32);
image.fill (color0.rgb ());
#if QT_VERSION > 0x050000
image.setDevicePixelRatio (dpr);
#endif
QBitmap bitmap = m_style.style (s).get_bitmap (w * dpr, h * dpr);
QPainter painter (&image);
painter.setPen (QPen (color1));
painter.setBackgroundMode (Qt::TransparentMode);
painter.drawPixmap (0, 0, bitmap);
painter.drawPixmap (0, 0, w, h, bitmap);
QPixmap pixmap = QPixmap::fromImage (image); // Qt 4.6.0 workaround
#if QT_VERSION > 0x050000
pixmap.setDevicePixelRatio (dpr);
#endif
b->setIconSize (pixmap.size ());
b->setIcon (QIcon (pixmap));
@@ -1510,6 +1539,7 @@ public:
options.push_back (std::pair<std::string, std::string> (cfg_stipple_offset, "true"));
options.push_back (std::pair<std::string, std::string> (cfg_line_style_palette, lay::LineStylePalette ().to_string ()));
options.push_back (std::pair<std::string, std::string> (cfg_no_stipple, "false"));
options.push_back (std::pair<std::string, std::string> (cfg_markers_visible, "true"));
}
virtual std::vector<std::pair <std::string, ConfigPage *> > config_pages (QWidget *parent) const
+1 -1
View File
@@ -270,7 +270,7 @@ MarkerBase::set_line_style (int line_style)
}
}
void
void
MarkerBase::get_bitmaps (const Viewport & /*vp*/, ViewObjectCanvas &canvas, lay::CanvasPlane *&fill, lay::CanvasPlane *&contour, lay::CanvasPlane *&vertex, lay::CanvasPlane *&text)
{
double resolution = canvas.resolution ();
+81 -40
View File
@@ -665,13 +665,11 @@ need_draw_box (const db::Layout *layout, const db::Cell &cell,
return int (cell.hierarchy_levels ()) + level >= to_level;
}
void
RedrawThreadWorker::draw_boxes (bool drawing_context, db::cell_index_type ci, const db::CplxTrans &trans, const db::Box &vp, int level)
void
RedrawThreadWorker::draw_boxes (bool drawing_context, db::cell_index_type ci, const db::CplxTrans &trans, const std::vector<db::Box> &redraw_regions, int level)
{
lay::Renderer &r = *mp_renderer;
// do not draw, if there is nothing to draw
if (mp_layout->cells () <= ci || vp.empty ()) {
if (mp_layout->cells () <= ci || redraw_regions.empty ()) {
return;
}
@@ -685,6 +683,17 @@ RedrawThreadWorker::draw_boxes (bool drawing_context, db::cell_index_type ci, co
return;
}
for (std::vector<db::Box>::const_iterator b = redraw_regions.begin (); b != redraw_regions.end (); ++b) {
draw_boxes (drawing_context, ci, trans, *b, level);
}
}
void
RedrawThreadWorker::draw_boxes (bool drawing_context, db::cell_index_type ci, const db::CplxTrans &trans, const db::Box &redraw_box, int level)
{
lay::Renderer &r = *mp_renderer;
const db::Cell &cell = mp_layout->cell (ci);
// For small bboxes, the cell outline can be reduced ..
db::Box bbox = cell.bbox ();
@@ -714,19 +723,19 @@ RedrawThreadWorker::draw_boxes (bool drawing_context, db::cell_index_type ci, co
} else {
db::box_convert <db::CellInst> bc (*mp_layout);
// create a set of boxes to look into
db::Coord aw = db::coord_traits<db::Coord>::rounded (m_abstract_mode_width / mp_layout->dbu ());
std::vector<db::Box> vv;
if (level == 1 && m_abstract_mode_width > 0 && bbox.width () > db::Box::distance_type (aw * 2) && bbox.height () > db::Box::distance_type (aw * 2)) {
vv.reserve (4);
vv.push_back (vp & db::Box (bbox.left (), bbox.bottom (), bbox.left () + aw, bbox.top ()));
vv.push_back (vp & db::Box (bbox.right () - aw, bbox.bottom (), bbox.right (), bbox.top ()));
vv.push_back (vp & db::Box (bbox.left () + aw, bbox.bottom (), bbox.right () - aw, bbox.bottom () + aw));
vv.push_back (vp & db::Box (bbox.left () + aw, bbox.top () - aw, bbox.right () - aw, bbox.top ()));
vv.push_back (redraw_box & db::Box (bbox.left (), bbox.bottom (), bbox.left () + aw, bbox.top ()));
vv.push_back (redraw_box & db::Box (bbox.right () - aw, bbox.bottom (), bbox.right (), bbox.top ()));
vv.push_back (redraw_box & db::Box (bbox.left () + aw, bbox.bottom (), bbox.right () - aw, bbox.bottom () + aw));
vv.push_back (redraw_box & db::Box (bbox.left () + aw, bbox.top () - aw, bbox.right () - aw, bbox.top ()));
} else {
vv.reserve (1);
vv.push_back (vp);
vv.push_back (redraw_box);
}
// dive down into the hierarchy ..
@@ -737,7 +746,7 @@ RedrawThreadWorker::draw_boxes (bool drawing_context, db::cell_index_type ci, co
bool anything = false;
db::cell_index_type last_ci = std::numeric_limits<db::cell_index_type>::max ();
db::Cell::touching_iterator inst = cell.begin_touching (*v);
db::Cell::touching_iterator inst = cell.begin_touching (*v);
while (! inst.at_end ()) {
const db::CellInstArray &cell_inst = inst->cell_inst ();
@@ -746,7 +755,7 @@ RedrawThreadWorker::draw_boxes (bool drawing_context, db::cell_index_type ci, co
db::Box new_cell_box = mp_layout->cell (new_ci).bbox ();
if (last_ci != new_ci) {
// Hint: don't use any_cell_box on partially visible cells because that will degrade performance
// Hint: don't use any_cell_box on partially visible cells because that will degrade performance
if (new_cell_box.inside (*v)) {
last_ci = new_ci;
anything = any_cell_box (new_ci, m_to_level - (level + 1));
@@ -758,7 +767,7 @@ RedrawThreadWorker::draw_boxes (bool drawing_context, db::cell_index_type ci, co
if (anything) {
db::Vector a, b;
unsigned long amax, bmax;
unsigned long amax, bmax;
bool simplify = false;
if (cell_inst.is_regular_array (a, b, amax, bmax)) {
@@ -768,8 +777,8 @@ RedrawThreadWorker::draw_boxes (bool drawing_context, db::cell_index_type ci, co
} else {
inst_box = trans * new_cell_box;
}
if (((a.x () == 0 && b.y () == 0) || (a.y () == 0 && b.x () == 0)) &&
inst_box.width () < 1.5 && inst_box.height () < 1.5 &&
if (((a.x () == 0 && b.y () == 0) || (a.y () == 0 && b.x () == 0)) &&
inst_box.width () < 1.5 && inst_box.height () < 1.5 &&
(amax <= 1 || trans.ctrans (a.length ()) < 1.5) &&
(bmax <= 1 || trans.ctrans (b.length ()) < 1.5)) {
simplify = true;
@@ -781,7 +790,7 @@ RedrawThreadWorker::draw_boxes (bool drawing_context, db::cell_index_type ci, co
// The array can be simplified if there are levels below to draw
if (need_draw_box (mp_layout, mp_layout->cell (new_ci), level + 1, m_to_level, m_hidden_cells, m_cv_index)) {
db::box_convert <db::CellInst> bc (*mp_layout);
unsigned int plane_group = 2;
@@ -801,8 +810,8 @@ RedrawThreadWorker::draw_boxes (bool drawing_context, db::cell_index_type ci, co
// The array (or single instance) must be iterated instance
// by instance
for (db::CellInstArray::iterator p = cell_inst.begin_touching (*v, bc); ! p.at_end (); ++p) {
test_snapshot (0);
test_snapshot (0);
db::ICplxTrans t (cell_inst.complex_trans (*p));
db::Box new_vp = db::Box (t.inverted () * *v);
draw_boxes (drawing_context, new_ci, trans * t, new_vp, level + 1);
@@ -814,7 +823,7 @@ RedrawThreadWorker::draw_boxes (bool drawing_context, db::cell_index_type ci, co
}
++inst;
}
}
@@ -828,7 +837,7 @@ RedrawThreadWorker::draw_boxes (bool drawing_context, db::cell_index_type ci, co
}
void
RedrawThreadWorker::draw_box_properties (bool drawing_context, db::cell_index_type ci, const db::CplxTrans &trans, const db::Box &vp, int level)
RedrawThreadWorker::draw_box_properties (bool drawing_context, db::cell_index_type ci, const db::CplxTrans &trans, const std::vector<db::Box> &vp, int level)
{
if (! m_text_visible) {
return;
@@ -838,7 +847,7 @@ RedrawThreadWorker::draw_box_properties (bool drawing_context, db::cell_index_ty
}
void
RedrawThreadWorker::draw_box_properties (bool drawing_context, db::cell_index_type ci, const db::CplxTrans &trans, const db::Box &vp, int level, db::properties_id_type prop_id)
RedrawThreadWorker::draw_box_properties (bool drawing_context, db::cell_index_type ci, const db::CplxTrans &trans, const std::vector<db::Box> &vp, int level, db::properties_id_type prop_id)
{
// do not draw, if there is nothing to draw
if (mp_layout->cells () <= ci || vp.empty ()) {
@@ -855,6 +864,16 @@ RedrawThreadWorker::draw_box_properties (bool drawing_context, db::cell_index_ty
return;
}
for (std::vector<db::Box>::const_iterator b = vp.begin (); b != vp.end (); ++b) {
draw_box_properties (drawing_context, ci, trans, *b, level, prop_id);
}
}
void
RedrawThreadWorker::draw_box_properties (bool drawing_context, db::cell_index_type ci, const db::CplxTrans &trans, const db::Box &vp, int level, db::properties_id_type prop_id)
{
const db::Cell &cell = mp_layout->cell (ci);
// For small bboxes, the cell outline can be reduced ..
db::Box bbox = cell.bbox ();
@@ -1193,14 +1212,12 @@ RedrawThreadWorker::search_regions (const db::Box &cell_bbox, const db::Box &vp,
}
void
RedrawThreadWorker::draw_text_layer (bool drawing_context, db::cell_index_type ci, const db::CplxTrans &trans, const db::Box &vp, int level)
RedrawThreadWorker::draw_text_layer (bool drawing_context, db::cell_index_type ci, const db::CplxTrans &trans, const std::vector<db::Box> &vp, int level)
{
if (! m_text_visible) {
return;
}
lay::Renderer &r = *mp_renderer;
unsigned int plane_group = 2;
if (drawing_context) {
plane_group = 0;
@@ -1214,8 +1231,6 @@ RedrawThreadWorker::draw_text_layer (bool drawing_context, db::cell_index_type c
text = m_planes[2 + plane_group * (planes_per_layer / 3)];
vertex = m_planes[3 + plane_group * (planes_per_layer / 3)];
test_snapshot (0);
// do not draw, if there is nothing to draw
if (mp_layout->cells () <= ci || vp.empty ()) {
return;
@@ -1224,7 +1239,18 @@ RedrawThreadWorker::draw_text_layer (bool drawing_context, db::cell_index_type c
return;
}
for (std::vector<db::Box>::const_iterator b = vp.begin (); b != vp.end (); ++b) {
draw_text_layer (drawing_context, ci, trans, *b, level, fill, frame, vertex, text);
}
}
void
RedrawThreadWorker::draw_text_layer (bool drawing_context, db::cell_index_type ci, const db::CplxTrans &trans, const db::Box &vp, int level, CanvasPlane *fill, CanvasPlane *frame, CanvasPlane *vertex, CanvasPlane *text)
{
test_snapshot (0);
const db::Cell &cell = mp_layout->cell (ci);
lay::Renderer &r = *mp_renderer;
// For small bboxes, the cell outline can be reduced ..
db::Box bbox = cell.bbox (m_layer);
@@ -1422,7 +1448,7 @@ RedrawThreadWorker::draw_text_layer (bool drawing_context, db::cell_index_type c
db::ICplxTrans t (cell_inst.complex_trans (*p));
db::Box new_vp = db::Box (t.inverted () * *v);
draw_text_layer (drawing_context, new_ci, trans * t, new_vp, level + 1);
draw_text_layer (drawing_context, new_ci, trans * t, new_vp, level + 1, fill, frame, vertex, text);
}
@@ -1751,11 +1777,9 @@ private:
};
void
RedrawThreadWorker::draw_layer (int from_level, int to_level, db::cell_index_type ci, const db::CplxTrans &trans, const db::Box &vp, int level,
RedrawThreadWorker::draw_layer (int from_level, int to_level, db::cell_index_type ci, const db::CplxTrans &trans, const std::vector<db::Box> &vp, int level,
lay::CanvasPlane *fill, lay::CanvasPlane *frame, lay::CanvasPlane *vertex, lay::CanvasPlane *text, const UpdateSnapshotCallback *update_snapshot)
{
test_snapshot (update_snapshot);
// do not draw, if there is nothing to draw
if (mp_layout->cells () <= ci || vp.empty ()) {
return;
@@ -1764,6 +1788,17 @@ RedrawThreadWorker::draw_layer (int from_level, int to_level, db::cell_index_typ
return;
}
for (std::vector<db::Box>::const_iterator b = vp.begin (); b != vp.end (); ++b) {
draw_layer (from_level, to_level, ci, trans, *b, level, fill, frame, vertex, text, update_snapshot);
}
}
void
RedrawThreadWorker::draw_layer (int from_level, int to_level, db::cell_index_type ci, const db::CplxTrans &trans, const db::Box &vp, int level,
lay::CanvasPlane *fill, lay::CanvasPlane *frame, lay::CanvasPlane *vertex, lay::CanvasPlane *text, const UpdateSnapshotCallback *update_snapshot)
{
test_snapshot (update_snapshot);
const db::Cell &cell = mp_layout->cell (ci);
db::Box bbox = cell.bbox (m_layer);
db::Box cell_bbox = cell.bbox ();
@@ -1891,7 +1926,7 @@ RedrawThreadWorker::draw_layer (int from_level, int to_level, db::cell_index_typ
}
void
RedrawThreadWorker::draw_layer (bool drawing_context, db::cell_index_type ci, const db::CplxTrans &trans, const db::Box &vp, int level)
RedrawThreadWorker::draw_layer (bool drawing_context, db::cell_index_type ci, const db::CplxTrans &trans, const std::vector<db::Box> &redraw_regions, int level)
{
if (drawing_context) {
@@ -1904,7 +1939,7 @@ RedrawThreadWorker::draw_layer (bool drawing_context, db::cell_index_type ci, co
text = m_planes[2 + plane_group * (planes_per_layer / 3)];
vertex = m_planes[3 + plane_group * (planes_per_layer / 3)];
draw_layer (m_from_level, m_to_level, ci, trans, vp, level, fill, frame, vertex, text, 0);
draw_layer (m_from_level, m_to_level, ci, trans, redraw_regions, level, fill, frame, vertex, text, 0);
}
@@ -1919,7 +1954,7 @@ RedrawThreadWorker::draw_layer (bool drawing_context, db::cell_index_type ci, co
text = m_planes[2 + plane_group * (planes_per_layer / 3)];
vertex = m_planes[3 + plane_group * (planes_per_layer / 3)];
draw_layer (m_from_level, m_to_level, ci, trans, vp, level, fill, frame, vertex, text, 0);
draw_layer (m_from_level, m_to_level, ci, trans, redraw_regions, level, fill, frame, vertex, text, 0);
}
@@ -1934,7 +1969,7 @@ RedrawThreadWorker::draw_layer (bool drawing_context, db::cell_index_type ci, co
text = m_planes[2 + plane_group * (planes_per_layer / 3)];
vertex = m_planes[3 + plane_group * (planes_per_layer / 3)];
draw_layer (m_from_level, 1, ci, trans, vp, level, fill, frame, vertex, text, 0);
draw_layer (m_from_level, 1, ci, trans, redraw_regions, level, fill, frame, vertex, text, 0);
}
@@ -1947,7 +1982,7 @@ RedrawThreadWorker::draw_layer (bool drawing_context, db::cell_index_type ci, co
text = m_planes[2 + plane_group * (planes_per_layer / 3)];
vertex = m_planes[3 + plane_group * (planes_per_layer / 3)];
draw_layer (1, m_to_level, ci, trans, vp, level, fill, frame, vertex, text, 0);
draw_layer (1, m_to_level, ci, trans, redraw_regions, level, fill, frame, vertex, text, 0);
}
@@ -1990,7 +2025,7 @@ RedrawThreadWorker::cell_var_cached (db::cell_index_type ci, const db::CplxTrans
}
void
RedrawThreadWorker::iterate_variants (const std::vector <db::Box> &redraw_regions, db::cell_index_type ci, db::CplxTrans trans, void (RedrawThreadWorker::*what) (bool, db::cell_index_type, const db::CplxTrans &, const db::Box &, int))
RedrawThreadWorker::iterate_variants (const std::vector <db::Box> &redraw_regions, db::cell_index_type ci, db::CplxTrans trans, void (RedrawThreadWorker::*what) (bool, db::cell_index_type, const db::CplxTrans &, const std::vector<db::Box> &, int))
{
// save current state
int from_level = m_from_level;
@@ -2050,7 +2085,7 @@ RedrawThreadWorker::iterate_variants (const std::vector <db::Box> &redraw_region
}
void
RedrawThreadWorker::iterate_variants_rec (const std::vector <db::Box> &redraw_regions, db::cell_index_type ci, const db::CplxTrans &trans, int level, void (RedrawThreadWorker::*what) (bool, db::cell_index_type, const db::CplxTrans &, const db::Box &, int), bool drawing_context)
RedrawThreadWorker::iterate_variants_rec (const std::vector <db::Box> &redraw_regions, db::cell_index_type ci, const db::CplxTrans &trans, int level, void (RedrawThreadWorker::*what) (bool, db::cell_index_type, const db::CplxTrans &, const std::vector<db::Box> &, int), bool drawing_context)
{
db::Cell::parent_inst_iterator p = mp_layout->cell (ci).begin_parent_insts ();
int context_path_length = int (m_cellviews [m_cv_index].specific_path ().size ());
@@ -2092,19 +2127,25 @@ RedrawThreadWorker::iterate_variants_rec (const std::vector <db::Box> &redraw_re
} else {
std::vector<db::Box> actual_regions;
actual_regions.reserve (redraw_regions.size ());
for (std::vector<db::Box>::const_iterator rr = redraw_regions.begin (); rr != redraw_regions.end (); ++rr) {
db::Coord lim = std::numeric_limits<db::Coord>::max ();
db::DBox world (trans * db::Box (db::Point (-lim, -lim), db::Point (lim, lim)));
db::Box vp = db::Box (trans.inverted () * (world & db::DBox (*rr)));
vp &= mp_layout->cell (ci).bbox (); // this avoids problems when accessing designs through very large viewports
if (! vp.empty ()) {
(this->*what) (drawing_context, ci, trans, vp, level);
actual_regions.push_back (vp);
}
}
if (! actual_regions.empty ()) {
(this->*what) (drawing_context, ci, trans, actual_regions, level);
}
}
}
+12 -8
View File
@@ -175,20 +175,24 @@ protected:
void perform_task (tl::Task *task);
private:
void draw_layer (bool drawing_context, db::cell_index_type ci, const db::CplxTrans &trans, const db::Box &vp, int level);
void draw_layer (int from_level, int to_level, db::cell_index_type ci, const db::CplxTrans &trans, const db::Box &vp, int level, lay::CanvasPlane *fill, lay::CanvasPlane *frame, lay::CanvasPlane *vertex, lay::CanvasPlane *text, const UpdateSnapshotCallback *update_snapshot);
void draw_layer (bool drawing_context, db::cell_index_type ci, const db::CplxTrans &trans, const std::vector <db::Box> &redraw_regions, int level);
void draw_layer (int from_level, int to_level, db::cell_index_type ci, const db::CplxTrans &trans, const std::vector <db::Box> &redraw_regions, int level, lay::CanvasPlane *fill, lay::CanvasPlane *frame, lay::CanvasPlane *vertex, lay::CanvasPlane *text, const UpdateSnapshotCallback *update_snapshot);
void draw_layer (int from_level, int to_level, db::cell_index_type ci, const db::CplxTrans &trans, const db::Box &redraw_box, int level, lay::CanvasPlane *fill, lay::CanvasPlane *frame, lay::CanvasPlane *vertex, lay::CanvasPlane *text, const UpdateSnapshotCallback *update_snapshot);
void draw_layer_wo_cache (int from_level, int to_level, db::cell_index_type ci, const db::CplxTrans &trans, const std::vector<db::Box> &vv, int level, lay::CanvasPlane *fill, lay::CanvasPlane *frame, lay::CanvasPlane *vertex, lay::CanvasPlane *text, const UpdateSnapshotCallback *update_snapshot);
void draw_text_layer (bool drawing_context, db::cell_index_type ci, const db::CplxTrans &trans, const db::Box &box, int level);
void draw_boxes (bool drawing_context, db::cell_index_type ci, const db::CplxTrans &trans, const db::Box &box, int level);
void draw_box_properties (bool drawing_context, db::cell_index_type ci, const db::CplxTrans &trans, const db::Box &box, int level);
void draw_box_properties (bool drawing_context, db::cell_index_type ci, const db::CplxTrans &trans, const db::Box &box, int level, db::properties_id_type prop_id);
void draw_text_layer (bool drawing_context, db::cell_index_type ci, const db::CplxTrans &trans, const std::vector <db::Box> &redraw_regions, int level);
void draw_text_layer (bool drawing_context, db::cell_index_type ci, const db::CplxTrans &trans, const db::Box &redraw_region, int level, lay::CanvasPlane *fill, lay::CanvasPlane *frame, lay::CanvasPlane *vertex, lay::CanvasPlane *text);
void draw_boxes (bool drawing_context, db::cell_index_type ci, const db::CplxTrans &trans, const std::vector <db::Box> &redraw_regions, int level);
void draw_boxes (bool drawing_context, db::cell_index_type ci, const db::CplxTrans &trans, const db::Box &redraw_region, int level);
void draw_box_properties (bool drawing_context, db::cell_index_type ci, const db::CplxTrans &trans, const std::vector <db::Box> &redraw_regions, int level);
void draw_box_properties (bool drawing_context, db::cell_index_type ci, const db::CplxTrans &trans, const std::vector <db::Box> &redraw_regions, int level, db::properties_id_type prop_id);
void draw_box_properties (bool drawing_context, db::cell_index_type ci, const db::CplxTrans &trans, const db::Box &redraw_box, int level, db::properties_id_type prop_id);
void draw_cell (bool drawing_context, int level, const db::CplxTrans &trans, const db::Box &box, const std::string &txt);
void draw_cell_properties (bool drawing_context, int level, const db::CplxTrans &trans, const db::Box &box, db::properties_id_type prop_id);
void draw_cell_shapes (const db::CplxTrans &trans, const db::Cell &cell, const db::Box &vp, lay::CanvasPlane *fill, lay::CanvasPlane *frame, lay::CanvasPlane *vertex, lay::CanvasPlane *text);
void test_snapshot (const UpdateSnapshotCallback *update_snapshot);
void transfer ();
void iterate_variants (const std::vector <db::Box> &redraw_regions, db::cell_index_type ci, db::CplxTrans trans, void (RedrawThreadWorker::*what) (bool, db::cell_index_type ci, const db::CplxTrans &, const db::Box &, int level));
void iterate_variants_rec (const std::vector <db::Box> &redraw_regions, db::cell_index_type ci, const db::CplxTrans &trans, int level, void (RedrawThreadWorker::*what) (bool, db::cell_index_type ci, const db::CplxTrans &, const db::Box &, int level), bool spread);
void iterate_variants (const std::vector <db::Box> &redraw_regions, db::cell_index_type ci, db::CplxTrans trans, void (RedrawThreadWorker::*what) (bool, db::cell_index_type ci, const db::CplxTrans &, const std::vector <db::Box> &, int level));
void iterate_variants_rec (const std::vector <db::Box> &redraw_regions, db::cell_index_type ci, const db::CplxTrans &trans, int level, void (RedrawThreadWorker::*what) (bool, db::cell_index_type ci, const db::CplxTrans &, const std::vector <db::Box> &, int level), bool spread);
bool cell_var_cached (db::cell_index_type ci, const db::CplxTrans &trans);
bool drop_cell (const db::Cell &cell, const db::CplxTrans &trans);
std::vector<db::Box> search_regions (const db::Box &cell_bbox, const db::Box &vp, int level);
+22 -2
View File
@@ -165,7 +165,7 @@ BackgroundViewObject::z_order (int z)
// ViewObject implementation
ViewObject::ViewObject (ViewObjectWidget *widget, bool _static)
: mp_widget (widget), m_static (_static), m_visible (true)
: mp_widget (widget), m_static (_static), m_visible (true), m_dismissable (false)
{
if (widget) {
widget->m_objects.push_back (this);
@@ -178,6 +178,15 @@ ViewObject::~ViewObject ()
redraw ();
}
void
ViewObject::set_dismissable (bool dismissable)
{
if (m_dismissable != dismissable) {
m_dismissable = dismissable;
redraw ();
}
}
void
ViewObject::visible (bool vis)
{
@@ -251,6 +260,7 @@ ViewService::set_cursor (lay::Cursor::cursor_shape cursor)
ViewObjectWidget::ViewObjectWidget (QWidget *parent, const char *name)
: QWidget (parent),
m_view_objects_dismissed (false),
m_needs_update_static (false),
m_needs_update_bg (false),
mp_active_service (0),
@@ -888,7 +898,7 @@ ViewObjectWidget::do_render (const lay::Viewport &vp, lay::ViewObjectCanvas &can
}
for (object_iterator obj = begin_objects (); obj != end_objects (); ++obj) {
if (obj->m_static == st && obj->is_visible ()) {
if (obj->m_static == st && obj->is_visible () && (! m_view_objects_dismissed || ! obj->get_dismissable ())) {
BEGIN_PROTECTED_SILENT
obj->render (vp, canvas);
END_PROTECTED_SILENT
@@ -963,6 +973,16 @@ ViewObjectWidget::touch_bg ()
}
}
void
ViewObjectWidget::set_dismiss_view_objects (bool dismiss)
{
if (dismiss != m_view_objects_dismissed) {
m_view_objects_dismissed = dismiss;
touch ();
update ();
}
}
void
ViewObjectWidget::objects_changed ()
{
+34
View File
@@ -513,6 +513,23 @@ public:
return const_cast<ViewObjectWidget *> (mp_widget.get());
}
/**
* @brief Gets a value indicating whether the marker can be dismissed (made invisible)
*
* Markers with this flag set to true can be hidden by using ViewObjectCanvas::show_markers.
*/
bool get_dismissable () const
{
return m_dismissable;
}
/**
* @brief Sets a value indicating whether the marker can be dismissed (made invisible)
*
* See \\get_dismissable for details.
*/
void set_dismissable (bool f);
/**
* @brief Set the visibility state of the view object
*
@@ -561,6 +578,7 @@ private:
tl::weak_ptr<ViewObjectWidget> mp_widget;
bool m_static;
bool m_visible;
bool m_dismissable;
};
/**
@@ -905,6 +923,21 @@ public:
*/
void set_default_cursor (lay::Cursor::cursor_shape cursor);
/**
* @brief Sets a value indicating whether dismissable view objects shall be drawn or not
*
* Markers with dismissable = false are always drawn. The default value is "false".
*/
void set_dismiss_view_objects (bool dismissed);
/**
* @brief Gets a value indicating whether dismissable markers shall be drawn or not
*/
bool dismiss_view_objects () const
{
return m_view_objects_dismissed;
}
protected:
/**
* @brief Qt focus event handler
@@ -985,6 +1018,7 @@ private:
tl::weak_collection<lay::BackgroundViewObject> m_background_objects;
std::list<lay::ViewService *> m_services;
std::list<ViewService *> m_grabbed;
bool m_view_objects_dismissed;
bool m_needs_update_static;
bool m_needs_update_bg;
lay::ViewService *mp_active_service;
+2
View File
@@ -70,6 +70,8 @@ static const std::string cfg_sel_line_style ("sel-line-style");
static const std::string cfg_sel_transient_mode ("sel-transient-mode");
static const std::string cfg_sel_inside_pcells_mode ("sel-inside-pcells-mode");
static const std::string cfg_markers_visible ("markers-visible");
static const std::string cfg_min_inst_label_size ("min-inst-label-size");
static const std::string cfg_cell_box_text_font ("inst-label-font");
static const std::string cfg_cell_box_text_transform ("inst-label-transform");
@@ -2177,36 +2177,42 @@ MarkerBrowserPage::do_update_markers ()
mp_markers.push_back (new lay::DMarker (mp_view));
mp_markers.back ()->set (trans * polygon_value->value ());
mp_markers.back ()->set_dismissable (true);
m_markers_bbox += trans * polygon_value->value ().box ();
} else if (edge_pair_value) {
mp_markers.push_back (new lay::DMarker (mp_view));
mp_markers.back ()->set (trans * edge_pair_value->value ());
mp_markers.back ()->set_dismissable (true);
m_markers_bbox += trans * db::DBox (edge_pair_value->value ().bbox ());
} else if (edge_value) {
mp_markers.push_back (new lay::DMarker (mp_view));
mp_markers.back ()->set (trans * edge_value->value ());
mp_markers.back ()->set_dismissable (true);
m_markers_bbox += trans * db::DBox (edge_value->value ().bbox ());
} else if (box_value) {
mp_markers.push_back (new lay::DMarker (mp_view));
mp_markers.back ()->set (trans * box_value->value ());
mp_markers.back ()->set_dismissable (true);
m_markers_bbox += trans * box_value->value ();
} else if (text_value) {
mp_markers.push_back (new lay::DMarker (mp_view));
mp_markers.back ()->set (trans * text_value->value ());
mp_markers.back ()->set_dismissable (true);
m_markers_bbox += trans * text_value->value ().box ();
} else if (path_value) {
mp_markers.push_back (new lay::DMarker (mp_view));
mp_markers.back ()->set (trans * path_value->value ());
mp_markers.back ()->set_dismissable (true);
m_markers_bbox += trans * path_value->value ().box ();
}