Skip to content

Commit d043281

Browse files
committed
Bugfix: nodes moved to module must be removed from view if module gets added
1 parent 681327e commit d043281

File tree

1 file changed

+21
-9
lines changed

1 file changed

+21
-9
lines changed

plugins/gui/src/netlist_relay/netlist_relay.cpp

Lines changed: 21 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -180,16 +180,27 @@ namespace hal
180180
Node firstNode = node;
181181
QSet<u32> gatIds;
182182
QSet<u32> modIds;
183+
184+
GraphContext* context = gContentManager->getContextManagerWidget()->getCurrentContext();
185+
Q_ASSERT(context);
186+
187+
// exclusive module view will update automatically if module elements get moved
188+
bool specialUpdateRequired = !context->getExclusiveModuleId();
189+
183190
if (node.isNull())
184191
{
185192
for (u32 id : gSelectionRelay->selectedGatesList())
186193
{
194+
if (specialUpdateRequired && ! context->gates().contains(id))
195+
specialUpdateRequired = false;
187196
if (firstNode.isNull()) firstNode = Node(id,Node::Gate);
188197
gatIds.insert(id);
189198
}
190199

191200
for (u32 id : gSelectionRelay->selectedModulesList())
192201
{
202+
if (specialUpdateRequired && ! context->modules().contains(id))
203+
specialUpdateRequired = false;
193204
if (firstNode.isNull()) firstNode = Node(id,Node::Module);
194205
modIds.insert(id);
195206
}
@@ -240,16 +251,17 @@ namespace hal
240251
}
241252

242253
// move module to position of first content node
243-
GraphContext* context = gContentManager->getContextManagerWidget()->getCurrentContext();
244-
if (context)
254+
const NodeBox* box = context->getLayouter()->boxes().boxForNode(firstNode);
255+
if (box && (specialUpdateRequired || context->getExclusiveModuleId()))
245256
{
246-
const NodeBox* box = context->getLayouter()->boxes().boxForNode(firstNode);
247-
if (box)
248-
{
249-
ActionMoveNode* actMoveNode = new ActionMoveNode(context->id(),
250-
QPoint(box->x(),box->y()));
251-
compound->addAction(actMoveNode);
252-
}
257+
ActionMoveNode* actMoveNode = new ActionMoveNode(context->id(), QPoint(box->x(),box->y()));
258+
compound->addAction(actMoveNode);
259+
}
260+
261+
if (specialUpdateRequired)
262+
{
263+
context->setSpecialUpdate(true);
264+
context->setScheduleRemove(modIds,gatIds);
253265
}
254266

255267
compound->exec();

0 commit comments

Comments
 (0)