Skip to content

Commit 20ccd37

Browse files
committed
gui: handle bterm selection controls correctly
Previously the control for pins only affect visibility but not selection. Pins were not selectable unless route or via were too. Fixes #7973 Signed-off-by: Matt Liberty <[email protected]>
1 parent 72a6f31 commit 20ccd37

File tree

3 files changed

+28
-13
lines changed

3 files changed

+28
-13
lines changed

src/gui/src/layoutViewer.cpp

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -634,19 +634,23 @@ std::pair<LayoutViewer::Edge, bool> LayoutViewer::searchNearestEdge(
634634

635635
const bool routing_visible = options_->areRoutingSegmentsVisible();
636636
const bool vias_visible = options_->areRoutingViasVisible();
637-
if (routing_visible || vias_visible) {
637+
const bool io_pins_visible = options_->areIOPinsVisible();
638+
if (routing_visible || vias_visible || io_pins_visible) {
638639
auto box_shapes = search_.searchBoxShapes(block_,
639640
layer,
640641
search_line.xMin(),
641642
search_line.yMin(),
642643
search_line.xMax(),
643644
search_line.yMax(),
644645
shape_limit);
645-
for (const auto& [box, is_via, net] : box_shapes) {
646-
if (!routing_visible && !is_via) {
646+
for (const auto& [box, type, net] : box_shapes) {
647+
if (!routing_visible && type == Search::WIRE) {
647648
continue;
648649
}
649-
if (!vias_visible && is_via) {
650+
if (!vias_visible && type == Search::VIA) {
651+
continue;
652+
}
653+
if (!io_pins_visible && type == Search::BTERM) {
650654
continue;
651655
}
652656
if (isNetVisible(net)) {
@@ -855,7 +859,8 @@ void LayoutViewer::selectAt(odb::Rect region, std::vector<Selected>& selections)
855859

856860
const bool routing_visible = options_->areRoutingSegmentsVisible();
857861
const bool vias_visible = options_->areRoutingViasVisible();
858-
if (routing_visible || vias_visible) {
862+
const bool io_pins_visible = options_->areIOPinsVisible();
863+
if (routing_visible || vias_visible || io_pins_visible) {
859864
auto box_shapes = search_.searchBoxShapes(block_,
860865
layer,
861866
region.xMin(),
@@ -864,11 +869,14 @@ void LayoutViewer::selectAt(odb::Rect region, std::vector<Selected>& selections)
864869
region.yMax(),
865870
shape_limit);
866871

867-
for (auto& [box, is_via, net] : box_shapes) {
868-
if (!routing_visible && !is_via) {
872+
for (auto& [box, type, net] : box_shapes) {
873+
if (!routing_visible && type == Search::WIRE) {
874+
continue;
875+
}
876+
if (!vias_visible && type == Search::VIA) {
869877
continue;
870878
}
871-
if (!vias_visible && is_via) {
879+
if (!io_pins_visible && type == Search::BTERM) {
872880
continue;
873881
}
874882
if (isNetVisible(net) && options_->isNetSelectable(net)) {

src/gui/src/search.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,7 @@ void Search::updateShapes(odb::dbBlock* block)
272272
continue;
273273
}
274274
odb::dbTechLayer* layer = box->getTechLayer();
275-
net_shapes[layer].emplace_back(box->getBox(), false, term->getNet());
275+
net_shapes[layer].emplace_back(box->getBox(), BTERM, term->getNet());
276276
}
277277
}
278278
}
@@ -406,14 +406,14 @@ void Search::addVia(
406406
for (odb::dbBox* box : via->getBoxes()) {
407407
odb::Rect bbox = box->getBox();
408408
bbox.moveDelta(x, y);
409-
tree_shapes[box->getTechLayer()].emplace_back(bbox, true, net);
409+
tree_shapes[box->getTechLayer()].emplace_back(bbox, VIA, net);
410410
}
411411
} else {
412412
odb::dbVia* via = shape->getVia();
413413
for (odb::dbBox* box : via->getBoxes()) {
414414
odb::Rect bbox = box->getBox();
415415
bbox.moveDelta(x, y);
416-
tree_shapes[box->getTechLayer()].emplace_back(bbox, true, net);
416+
tree_shapes[box->getTechLayer()].emplace_back(bbox, VIA, net);
417417
}
418418
}
419419
}
@@ -462,7 +462,7 @@ void Search::addNet(
462462
if (s.isVia()) {
463463
addVia(net, &s, itr._prev_x, itr._prev_y, tree_shapes);
464464
} else {
465-
tree_shapes[s.getTechLayer()].emplace_back(s.getBox(), false, net);
465+
tree_shapes[s.getTechLayer()].emplace_back(s.getBox(), WIRE, net);
466466
}
467467
}
468468
}

src/gui/src/search.h

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,13 +39,20 @@ class Search : public QObject, public odb::dbBlockCallBackObj
3939
class PolygonIntersectPredicate;
4040

4141
public:
42+
enum RouteBoxType
43+
{
44+
WIRE,
45+
VIA,
46+
BTERM
47+
};
48+
4249
template <typename T>
4350
using LayerMap = std::map<odb::dbTechLayer*, T>;
4451

4552
template <typename T>
4653
using RectValue = std::pair<odb::Rect, T>;
4754
template <typename T>
48-
using RouteBoxValue = std::tuple<odb::Rect, bool, T>;
55+
using RouteBoxValue = std::tuple<odb::Rect, RouteBoxType, T>;
4956
template <typename T>
5057
using SNetValue = std::tuple<odb::dbSBox*, odb::Polygon, T>;
5158
template <typename T>

0 commit comments

Comments
 (0)