mirror of https://github.com/KLayout/klayout.git
Merge pull request #1303 from KLayout/issue-1302
Implemented solution for issue #1302 (Select filter is not applied in…
This commit is contained in:
commit
f413635deb
|
|
@ -2700,7 +2700,26 @@ PartialService::partial_select (const db::DBox &box, lay::Editable::SelectionMod
|
|||
|
||||
} else {
|
||||
|
||||
PartialShapeFinder finder (box.is_point (), m_top_level_sel, db::ShapeIterator::All);
|
||||
int shape_flags = 0;
|
||||
if (edt::polygons_enabled ()) {
|
||||
shape_flags |= db::ShapeIterator::Polygons;
|
||||
}
|
||||
if (edt::paths_enabled ()) {
|
||||
// Note: points, edges and edge pairs don't have seperate entires, so
|
||||
// we count them as paths here
|
||||
shape_flags |= db::ShapeIterator::Paths;
|
||||
shape_flags |= db::ShapeIterator::Edges;
|
||||
shape_flags |= db::ShapeIterator::EdgePairs;
|
||||
shape_flags |= db::ShapeIterator::Points;
|
||||
}
|
||||
if (edt::boxes_enabled ()) {
|
||||
shape_flags |= db::ShapeIterator::Boxes;
|
||||
}
|
||||
if (edt::texts_enabled ()) {
|
||||
shape_flags |= db::ShapeIterator::Texts;
|
||||
}
|
||||
|
||||
PartialShapeFinder finder (box.is_point (), m_top_level_sel, db::ShapeIterator::flags_type (shape_flags));
|
||||
finder.find (view (), search_box);
|
||||
|
||||
// We must make sure that guiding shapes are only selected alone. The first selected object will
|
||||
|
|
@ -2750,7 +2769,7 @@ PartialService::partial_select (const db::DBox &box, lay::Editable::SelectionMod
|
|||
}
|
||||
|
||||
// check, if there is a selected instance inside the box - in this case, we do not do a new selection
|
||||
if (! box.is_point ()) {
|
||||
if (! box.is_point () && edt::instances_enabled ()) {
|
||||
|
||||
lay::InstFinder inst_finder (box.is_point (), m_top_level_sel, true /*full arrays*/, true /*enclose*/, 0 /*no excludes*/, true /*visible layers*/);
|
||||
inst_finder.find (view (), search_box);
|
||||
|
|
|
|||
|
|
@ -287,6 +287,24 @@ static tl::RegisteredClass<lay::PluginDeclaration> config_decl5 (
|
|||
"edt::Service(CellInstances)"
|
||||
);
|
||||
|
||||
template <class Service>
|
||||
bool is_enabled ()
|
||||
{
|
||||
for (auto p = tl::Registrar<lay::PluginDeclaration>::begin (); p != tl::Registrar<lay::PluginDeclaration>::end (); ++p) {
|
||||
auto pd = dynamic_cast<const edt::PluginDeclaration<Service> *> (p.operator-> ());
|
||||
if (pd) {
|
||||
return pd->editable_enabled ();
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool polygons_enabled () { return is_enabled<edt::PolygonService> (); }
|
||||
bool paths_enabled () { return is_enabled<edt::PathService> (); }
|
||||
bool boxes_enabled () { return is_enabled<edt::BoxService> (); }
|
||||
bool texts_enabled () { return is_enabled<edt::TextService> (); }
|
||||
bool instances_enabled () { return is_enabled<edt::InstService> (); }
|
||||
|
||||
class MainPluginDeclaration
|
||||
: public lay::PluginDeclaration
|
||||
{
|
||||
|
|
|
|||
|
|
@ -46,6 +46,17 @@ namespace edt
|
|||
// .. nothing yet ..
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Returns a value indicating whether polygons are enabled in the "Select" menu
|
||||
*/
|
||||
bool polygons_enabled ();
|
||||
|
||||
// other types ...
|
||||
bool paths_enabled ();
|
||||
bool boxes_enabled ();
|
||||
bool texts_enabled ();
|
||||
bool instances_enabled ();
|
||||
|
||||
/**
|
||||
* @brief Commits the current configuration for the recently used configuration list
|
||||
*/
|
||||
|
|
|
|||
Loading…
Reference in New Issue