Skip to content

Commit a1d6ff9

Browse files
author
Matthias Koefferlein
committed
Selectability follows visibility
1 parent 6746dad commit a1d6ff9

File tree

3 files changed

+37
-10
lines changed

3 files changed

+37
-10
lines changed

src/edt/edt/edtService.cc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1159,6 +1159,8 @@ Service::transient_select (const db::DPoint &pos)
11591159
if (m_cell_inst_service) {
11601160

11611161
lay::InstFinder finder (true, view ()->is_editable () && m_top_level_sel, view ()->is_editable () /*full arrays in editable mode*/, true /*enclose instances*/, &m_previous_selection, true /*visible layers only*/);
1162+
finder.consider_ghost_cells (view ()->ghost_cells_visible ());
1163+
finder.consider_normal_cells (view ()->cell_box_visible ());
11621164

11631165
// go through all transform variants
11641166
std::set< std::pair<db::DCplxTrans, int> > variants = view ()->cv_transform_variants_with_empty ();
@@ -1493,6 +1495,8 @@ Service::select (const db::DBox &box, lay::Editable::SelectionMode mode)
14931495
} else if (m_cell_inst_service) {
14941496

14951497
lay::InstFinder finder (box.is_point (), view ()->is_editable () && m_top_level_sel, view ()->is_editable () /*full arrays in editable mode*/, true /*enclose_inst*/, exclude, true /*only visible layers*/);
1498+
finder.consider_ghost_cells (view ()->ghost_cells_visible ());
1499+
finder.consider_normal_cells (view ()->cell_box_visible ());
14961500

14971501
// go through all cell views
14981502
std::set< std::pair<db::DCplxTrans, int> > variants = view ()->cv_transform_variants_with_empty ();

src/laybasic/laybasic/layFinder.cc

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -721,6 +721,8 @@ InstFinder::InstFinder (bool point_mode, bool top_level_sel, bool full_arrays, b
721721
m_full_arrays (full_arrays),
722722
m_enclose_insts (enclose_inst),
723723
m_visible_layers (visible_layers),
724+
m_consider_ghost_cells (true),
725+
m_consider_normal_cells (true),
724726
mp_view (0),
725727
mp_progress (0)
726728
{
@@ -805,6 +807,12 @@ InstFinder::checkpoint ()
805807
}
806808
}
807809

810+
bool
811+
InstFinder::consider_cell (const db::Cell &cell) const
812+
{
813+
return cell.is_ghost_cell () ? m_consider_ghost_cells : m_consider_normal_cells;
814+
}
815+
808816
void
809817
InstFinder::visit_cell (const db::Cell &cell, const db::Box &search_box, const db::Box & /*scan_box*/, const db::DCplxTrans &vp, const db::ICplxTrans &t, int level)
810818
{
@@ -818,15 +826,18 @@ InstFinder::visit_cell (const db::Cell &cell, const db::Box &search_box, const d
818826
++*mp_progress;
819827

820828
// look for instances to check here ..
821-
db::Cell::touching_iterator inst = cell.begin_touching (search_box);
822-
while (! inst.at_end ()) {
829+
for (db::Cell::touching_iterator inst = cell.begin_touching (search_box); ! inst.at_end (); ++inst) {
823830

824831
const db::CellInstArray &cell_inst = inst->cell_inst ();
825832
const db::Cell &inst_cell = layout ().cell (cell_inst.object ().cell_index ());
826833

827834
++*mp_progress;
828835

829-
// just consider the instances exactly at the last level of
836+
if (! consider_cell (inst_cell)) {
837+
continue;
838+
}
839+
840+
// just consider the instances exactly at the last level of
830841
// hierarchy (this is where the boxes are drawn) or of cells that
831842
// are hidden.
832843
if (level == max_level () - 1 || inst_cell.is_proxy () || inst_cell.is_ghost_cell () || mp_view->is_cell_hidden (inst_cell.cell_index (), m_cv_index)) {
@@ -887,29 +898,30 @@ InstFinder::visit_cell (const db::Cell &cell, const db::Box &search_box, const d
887898

888899
}
889900

890-
++inst;
891-
892901
}
893902

894903
} else {
895904

896905
// look for instances to check here ..
897-
db::Cell::touching_iterator inst = cell.begin_touching (search_box);
898-
while (! inst.at_end ()) {
906+
for (db::Cell::touching_iterator inst = cell.begin_touching (search_box); ! inst.at_end (); ++inst) {
899907

900908
checkpoint ();
901909

902910
const db::CellInstArray &cell_inst = inst->cell_inst ();
903911
const db::Cell &inst_cell = layout ().cell (cell_inst.object ().cell_index ());
904912

913+
if (! consider_cell (inst_cell)) {
914+
continue;
915+
}
916+
905917
// just consider the instances exactly at the last level of
906918
// hierarchy (this is where the boxes are drawn) or if of cells that
907919
// are hidden.
908920
if (level == max_level () - 1 || inst_cell.is_proxy () || inst_cell.is_ghost_cell () || mp_view->is_cell_hidden (inst_cell.cell_index (), m_cv_index)) {
909921

910922
db::box_convert <db::CellInst, false> bc (layout ());
911923
for (db::CellInstArray::iterator p = cell_inst.begin_touching (search_box, bc); ! p.at_end (); ++p) {
912-
924+
913925
checkpoint ();
914926

915927
bool match = false;
@@ -1000,8 +1012,6 @@ InstFinder::visit_cell (const db::Cell &cell, const db::Box &search_box, const d
10001012

10011013
}
10021014

1003-
++inst;
1004-
10051015
}
10061016

10071017
}

src/laybasic/laybasic/layFinder.h

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -343,7 +343,17 @@ class LAYBASIC_PUBLIC InstFinder
343343

344344
bool find (LayoutViewBase *view, unsigned int cv_index, const db::DCplxTrans &trans, const db::DBox &region_mu);
345345
bool find (LayoutViewBase *view, const db::DBox &region_mu);
346+
347+
void consider_ghost_cells (bool f)
348+
{
349+
m_consider_ghost_cells = f;
350+
}
346351

352+
void consider_normal_cells (bool f)
353+
{
354+
m_consider_normal_cells = f;
355+
}
356+
347357
iterator begin () const
348358
{
349359
return m_founds.begin ();
@@ -360,6 +370,7 @@ class LAYBASIC_PUBLIC InstFinder
360370
virtual void visit_cell (const db::Cell &cell, const db::Box &hit_box, const db::Box &scan_box, const db::DCplxTrans &vp, const db::ICplxTrans &t, int level);
361371

362372
bool find_internal (LayoutViewBase *view, unsigned int cv_index, const db::DCplxTrans &trans_mu, const db::DBox &region_mu);
373+
bool consider_cell (const db::Cell &cell) const;
363374

364375
unsigned int m_cv_index;
365376
db::cell_index_type m_topcell;
@@ -369,6 +380,8 @@ class LAYBASIC_PUBLIC InstFinder
369380
bool m_full_arrays;
370381
bool m_enclose_insts;
371382
bool m_visible_layers;
383+
bool m_consider_ghost_cells;
384+
bool m_consider_normal_cells;
372385
std::vector<int> m_visible_layer_indexes;
373386
LayoutViewBase *mp_view;
374387
tl::AbsoluteProgress *mp_progress;

0 commit comments

Comments
 (0)