HAL
netlist_relay.cpp
Go to the documentation of this file.
2 
4 #include "gui/gui_globals.h"
19 #include "hal_core/netlist/gate.h"
22 #include "hal_core/netlist/net.h"
23 
24 #include <QApplication>
25 #include <QColorDialog>
26 #include <QDebug>
27 #include <QInputDialog>
28 #include <functional>
29 
30 namespace hal
31 {
33  : QObject(parent), mModuleColorManager(new ModuleColorManager(this))
34  {
37  }
38 
40  {
42  }
43 
45  {
46  if (!gNetlist)
47  return; // no netlist -> no registered callbacks
48  gNetlist->get_event_handler()->unregister_callback("gui_netlist_handler");
49  gNetlist->get_event_handler()->unregister_callback("gui_module_handler");
50  gNetlist->get_event_handler()->unregister_callback("gui_gate_handler");
51  gNetlist->get_event_handler()->unregister_callback("gui_net_handler");
52  gNetlist->get_event_handler()->unregister_callback("gui_grouping_handler");
53  }
54 
56  {
58  "gui_netlist_handler",
59  std::function<void(NetlistEvent::event, Netlist*, u32)>(std::bind(&NetlistRelay::relayNetlistEvent, this, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3)));
60 
62  "gui_module_handler",
63  std::function<void(ModuleEvent::event, Module*, u32)>(std::bind(&NetlistRelay::relayModuleEvent, this, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3)));
64 
66  "gui_gate_handler", std::function<void(GateEvent::event, Gate*, u32)>(std::bind(&NetlistRelay::relayGateEvent, this, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3)));
67 
69  "gui_net_handler", std::function<void(NetEvent::event, Net*, u32)>(std::bind(&NetlistRelay::relayNetEvent, this, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3)));
70 
72  "gui_grouping_handler",
73  std::function<void(GroupingEvent::event, Grouping*, u32)>(std::bind(&NetlistRelay::relayGroupingEvent, this, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3)));
74  }
75 
76  void NetlistRelay::handleNetlistModified()
77  {
78  if (!mNotified)
79  {
80  mNotified = true;
82  }
83  }
84 
86  {
87  return mModuleColorManager->moduleColor(id);
88  }
89 
91  {
92  return mModuleColorManager;
93  }
94 
96  {
97  QString oldName;
98  QString prompt;
99  UserActionObject uao;
100 
102  {
103  Module* m = gNetlist->get_module_by_id(id);
104  assert(m);
105  oldName = QString::fromStdString(m->get_name());
106  prompt = "Change module name";
108  }
110  {
111  Gate* g = gNetlist->get_gate_by_id(id);
112  assert(g);
113  oldName = QString::fromStdString(g->get_name());
114  prompt = "Change gate name";
116  }
118  {
119  Net* n = gNetlist->get_net_by_id(id);
120  assert(n);
121  oldName = QString::fromStdString(n->get_name());
122  prompt = "Change net name";
124  }
125  else return;
126 
127  bool confirm;
128  QString newName =
129  QInputDialog::getText(nullptr, prompt, "New name:", QLineEdit::Normal,
130  oldName, &confirm);
131  if (confirm)
132  {
133  ActionRenameObject* act = new ActionRenameObject(newName);
134  act->setObject(uao);
135  act->exec();
136  }
137  }
138 
140  {
141  // NOT THREADSAFE
142 
143  Module* m = gNetlist->get_module_by_id(id);
144  assert(m);
145 
146  bool ok;
147  QString text = QInputDialog::getText(nullptr, "Change Module Type", "New Type", QLineEdit::Normal, QString::fromStdString(m->get_type()), &ok);
148 
149  if (ok)
150  {
151  ActionSetObjectType* act = new ActionSetObjectType(text);
153  act->exec();
154  }
155  }
156 
158  {
159  // NOT THREADSAFE
160 
161  Module* m = gNetlist->get_module_by_id(id);
162  assert(m);
163 
164  QColor color = QColorDialog::getColor();
165 
166  if (!color.isValid())
167  return;
168 
169  ActionSetObjectColor* act = new ActionSetObjectColor(color);
171  act->exec();
172  }
173 
175  {
176  // prepare set of content, find first (reference-) node
177  Node firstNode = node;
178  QSet<u32> gatIds;
179  QSet<u32> modIds;
180 
182  Q_ASSERT(context);
183 
184  // exclusive module view will update automatically if module elements get moved
185  bool specialUpdateRequired = !context->getExclusiveModuleId();
186 
187  if (node.isNull())
188  {
190  {
191  if (specialUpdateRequired && ! context->gates().contains(id))
192  specialUpdateRequired = false;
193  if (firstNode.isNull()) firstNode = Node(id,Node::Gate);
194  gatIds.insert(id);
195  }
196 
198  {
199  if (specialUpdateRequired && ! context->modules().contains(id))
200  specialUpdateRequired = false;
201  if (firstNode.isNull()) firstNode = Node(id,Node::Module);
202  modIds.insert(id);
203  }
204  }
205  else if (node.isModule())
206  modIds.insert(node.id());
207  else
208  gatIds.insert(node.id());
209  if (firstNode.isNull()) return; // nothing to move
210 
211  // find common parent, if nullptr top_level was selected => abort
212  std::unordered_set<Gate*> gatsContent;
213  for (u32 id : gatIds)
214  gatsContent.insert(gNetlist->get_gate_by_id(id));
215 
216  std::unordered_set<Module*> modsContent;
217  for (u32 id : modIds)
218  modsContent.insert(gNetlist->get_module_by_id(id));
219 
220  Module* parentModule = gui_utility::firstCommonAncestor(modsContent, gatsContent);
221  if (!parentModule) return;
222  QString parentName = QString::fromStdString(parentModule->get_name());
223 
224  ModuleDialog md({},"Move to module",false,nullptr,qApp->activeWindow());
225  if (md.exec() != QDialog::Accepted) return;
226 
227 
228  UserActionCompound* compound = new UserActionCompound;
229  compound->setUseCreatedObject();
230 
231  if (md.isNewModule())
232  {
233  bool ok;
234  QString name = QInputDialog::getText(nullptr, "",
235  "New module will be created under \"" + parentName + "\"\nModule Name:",
236  QLineEdit::Normal, "", &ok);
237  if (!ok || name.isEmpty()) return;
239  actNewModule->setParentId(parentModule->get_id());
240  compound->addAction(actNewModule);
241  compound->addAction(new ActionAddItemsToObject(modIds,gatIds));
242  }
243  else
244  {
245  u32 targetModuleId = md.selectedId();
246  ActionAddItemsToObject* actAddItems = new ActionAddItemsToObject(modIds,gatIds);
247  actAddItems->setObject(UserActionObject(targetModuleId,UserActionObjectType::Module));
248  compound->addAction(actAddItems);
249  specialUpdateRequired = false;
250  }
251 
252  // move module to position of first content node
253  const NodeBox* box = context->getLayouter()->boxes().boxForNode(firstNode);
254  if (box && (specialUpdateRequired || context->getExclusiveModuleId()))
255  {
256  ActionMoveNode* actMoveNode = new ActionMoveNode(context->id(), QPoint(box->x(),box->y()));
257  compound->addAction(actMoveNode);
258  }
259 
260  if (specialUpdateRequired)
261  {
262  context->setSpecialUpdate(true);
263  context->setScheduleRemove(modIds,gatIds);
264  }
265 
266  compound->exec();
267 
268  // update selection
270  gSelectionRelay->addModule(compound->object().id());
274  }
275 
277  {
278  // NOT THREADSAFE
279 
280  bool ok;
281  QString name = QInputDialog::getText(nullptr, "", "Module Name:", QLineEdit::Normal, "", &ok);
282 
283  if (!ok || name.isEmpty())
284  return;
285 
286  Module* m = gNetlist->get_module_by_id(id);
287 
288  if (!m)
289  return;
290 
292  act->setParentId(id);
293  act->exec();
294  }
295 
297  {
300 
302  if (ctx)
303  {
304  // module exclusively connected to context, so delete context too
308  compnd->addAction(delCtx);
309  compnd->addAction(delMod);
310  compnd->exec();
311  }
312  else
313  {
314  delMod->exec();
315  }
316  }
317 
319  {
320  mNotified = false;
321  }
322 
323  void NetlistRelay::relayNetlistEvent(NetlistEvent::event ev, Netlist* object, u32 associated_data)
324  {
325  if (!object)
326  return; // SHOULD NEVER BE REACHED
327 
328  if (object != gNetlist)
329  return;
330 
331  handleNetlistModified();
332 
333  if (dynamic_cast<PythonThread*>(QThread::currentThread()))
334  {
335  Q_EMIT signalThreadEvent(TetNetlist, (int)ev, object, associated_data);
336  qApp->processEvents();
337  return;
338  }
339 
340  switch (ev)
341  {
344 
345  Q_EMIT netlistIdChanged(object, associated_data);
346  break;
347  }
350 
352  break;
353  }
356 
358  break;
359  }
362 
364  break;
365  }
368 
369  Q_EMIT netlistMarkedGlobalVcc(object, associated_data);
370  break;
371  }
374 
375  Q_EMIT netlistMarkedGlobalGnd(object, associated_data);
376  break;
377  }
380 
381  Q_EMIT netlistUnmarkedGlobalVcc(object, associated_data);
382  break;
383  }
386 
387  Q_EMIT netlistUnmarkedGlobalGnd(object, associated_data);
388  break;
389  }
393 
394  Q_EMIT netlistMarkedGlobalInput(object, associated_data);
395  break;
396  }
400 
401  Q_EMIT netlistMarkedGlobalOutput(object, associated_data);
402  break;
403  }
407 
408  Q_EMIT netlistUnmarkedGlobalInput(object, associated_data);
409  break;
410  }
414 
415  Q_EMIT netlistUnmarkedGlobalOutput(object, associated_data);
416  break;
417  }
418  }
419  }
420 
421  void NetlistRelay::relayGroupingEvent(GroupingEvent::event ev, Grouping* grp, u32 associated_data)
422  {
423  if (!grp)
424  return; // SHOULD NEVER BE REACHED
425 
426  if (grp->get_netlist() != gNetlist)
427  return;
428 
429  handleNetlistModified();
430 
431  if (dynamic_cast<PythonThread*>(QThread::currentThread()))
432  {
433  Q_EMIT signalThreadEvent(TetGrouping, (int)ev, grp, associated_data);
434  qApp->processEvents();
435  return;
436  }
437 
438  switch (ev)
439  {
441  Q_EMIT groupingCreated(grp);
442  break;
444  Q_EMIT groupingRemoved(grp);
445  break;
448  break;
451  break;
453  Q_EMIT groupingGateAssigned(grp, associated_data);
454  break;
456  Q_EMIT groupingGateRemoved(grp, associated_data);
457  break;
459  Q_EMIT groupingNetAssigned(grp, associated_data);
460  break;
462  Q_EMIT groupingNetRemoved(grp, associated_data);
463  break;
465  Q_EMIT groupingModuleAssigned(grp, associated_data);
466  break;
468  Q_EMIT groupingModuleRemoved(grp, associated_data);
469  break;
470  }
471  }
472 
473  void NetlistRelay::relayModuleEvent(ModuleEvent::event ev, Module* mod, u32 associated_data)
474  {
475  if (!mod)
476  return; // SHOULD NEVER BE REACHED
477 
478  if (mod->get_netlist() != gNetlist)
479  return;
480 
481  handleNetlistModified();
482 
483  if (dynamic_cast<PythonThread*>(QThread::currentThread()))
484  {
485  Q_EMIT signalThreadEvent(TetModule, (int)ev, mod, associated_data);
486  qApp->processEvents();
487  return;
488  }
489 
490  switch (ev)
491  {
493  //< no associated_data
494 
495  // suppress actions if we receive this for the top module
496  if (mod->get_parent_module() != nullptr)
497  {
498  mModuleColorManager->setRandomColor(mod->get_id());
499  }
500 
502 
503  Q_EMIT moduleCreated(mod);
504  break;
505  }
507  //< no associated_data
508 
509  mModuleColorManager->removeColor(mod->get_id());
510 
512  gSelectionRelay->handleModuleRemoved(mod->get_id());
513 
514  Q_EMIT moduleRemoved(mod);
515  break;
516  }
518  //< no associated_data
519 
521 
523  break;
524  }
526  //< no associated_data
527 
529  break;
530  }
532  //< associated_data = id of added module
533 
534  gGraphContextManager->handleModuleSubmoduleAdded(mod, associated_data);
535 
536  Q_EMIT moduleSubmoduleAdded(mod, associated_data);
537  break;
538  }
540  //< associated_data = id of removed module
541 
542  gGraphContextManager->handleModuleSubmoduleRemoved(mod, associated_data);
543 
544  Q_EMIT moduleSubmoduleRemoved(mod, associated_data);
545  break;
546  }
548  //< associated_data = id of inserted gate
549 
550  gGraphContextManager->handleModuleGateAssigned(mod, associated_data);
551 
552  Q_EMIT moduleGateAssigned(mod, associated_data);
553  break;
554  }
556  //< associated_data = id of removed gate
557 
558  gGraphContextManager->handleModuleGateRemoved(mod, associated_data);
559 
560  Q_EMIT moduleGateRemoved(mod, associated_data);
561  break;
562  }
564  //< associated_data = [4LSB: type of action] [28HSB: id of pin group or pin]
565  PinEvent pev = (PinEvent) (associated_data&0xF);
566  u32 id = (associated_data >> 4);
567 
568  /* Dump pin event for debugging
569  std::cerr << "Pin Event <" << enum_to_string<PinEvent>(pev) << "> ID=" << id << "\n";
570  for (PinGroup<ModulePin>* pg : mod->get_pin_groups())
571  {
572  std::cerr << " " << pg->get_start_index() << " " << pg->get_name() << " [" << pg->get_id() << "]"
573  << (pg->is_ascending() ? " asc\n" : " desc\n");
574  for (ModulePin* pin : pg->get_pins())
575  std::cerr << " " << pg->get_index(pin).get() << " " << pin->get_name() << "\n";
576  }
577  std::cerr << "---------------------" << std::endl;
578  */
579 
581 
582  Q_EMIT modulePortsChanged(mod,pev,id);
583  break;
584  }
586  //< no associated_data
587 
589 
591  break;
592  }
594  //< associated_data = number of gates
595 
596  Q_EMIT moduleGatesAssignBegin(mod, associated_data);
597  break;
598  }
600  //< associated_data = number of gates
601 
602  Q_EMIT moduleGatesAssignEnd(mod, associated_data);
603  break;
604  }
606  //< associated_data = number of gates
607 
608  Q_EMIT moduleGatesRemoveBegin(mod, associated_data);
609  break;
610  }
612  //< associated_data = number of gates
613 
614  Q_EMIT moduleGatesRemoveEnd(mod, associated_data);
615  break;
616  }
617  }
618  }
619 
620  void NetlistRelay::relayGateEvent(GateEvent::event ev, Gate* gat, u32 associated_data)
621  {
622  UNUSED(associated_data);
623  if (!gat)
624  return; // SHOULD NEVER BE REACHED
625 
626  if (gat->get_netlist() != gNetlist)
627  return;
628 
629  handleNetlistModified();
630 
631  if (dynamic_cast<PythonThread*>(QThread::currentThread()))
632  {
633  Q_EMIT signalThreadEvent(TetGate, (int)ev, gat, associated_data);
634  qApp->processEvents();
635  return;
636  }
637 
638  switch (ev)
639  {
641  //< no associated_data
642 
643  Q_EMIT gateCreated(gat);
644  break;
645  }
647  //< no associated_data
648 
649  gSelectionRelay->handleGateRemoved(gat->get_id());
650 
652 
653  Q_EMIT gateRemoved(gat);
654  break;
655  }
657  //< no associated_data
658 
660 
661  Q_EMIT gateNameChanged(gat);
662  break;
663  }
665  //< no associated_data
666 
668  break;
669  }
671  //< no associated_data
672 
674  break;
675  }
676  default:
677  break;
678  }
679  }
680 
681  void NetlistRelay::relayNetEvent(NetEvent::event ev, Net* net, u32 associated_data)
682  {
683  if (!net)
684  return; // SHOULD NEVER BE REACHED
685 
686  if (net->get_netlist() != gNetlist)
687  return;
688 
689  handleNetlistModified();
690 
691  if (dynamic_cast<PythonThread*>(QThread::currentThread()))
692  {
693  Q_EMIT signalThreadEvent(TetNet, (int)ev, net, associated_data);
694  qApp->processEvents();
695  return;
696  }
697 
698  switch (ev)
699  {
701  //< no associated_data
702 
704 
706  break;
707  }
709  //< no associated_data
710 
713 
715  break;
716  }
718  //< no associated_data
719 
721 
723  break;
724  }
725  // FIXME add src_added, src_removed
726  // case NetEvent::event::src_changed:
727  // {
728  // //< no associated_data
729 
730  // gGraphContextManager->handle_net_source_changed(object);
731 
732  // Q_EMIT net_source_changed(object);
733  // break;
734  // }
736  //< associated_data = id of src gate
737 
738  gGraphContextManager->handleNetSourceAdded(net, associated_data);
739 
740  Q_EMIT netSourceAdded(net, associated_data);
741  break;
742  }
744  //< associated_data = id of src gate
745 
747 
748  Q_EMIT netSourceRemoved(net, associated_data);
749  break;
750  }
752  //< associated_data = id of dst gate
753 
755 
756  Q_EMIT netDestinationAdded(net, associated_data);
757  break;
758  }
760  //< associated_data = id of dst gate
761 
763 
764  Q_EMIT netDestinationRemoved(net, associated_data);
765  break;
766  }
767  }
768  }
769 
770  void NetlistRelay::handleThreadEvent(int type, int evt, void* object, u32 associated_data)
771  {
772  switch (type)
773  {
774  case TetNetlist:
775  // qDebug() << "Evt nlst" << evt << associated_data;
776  relayNetlistEvent((NetlistEvent::event)evt, static_cast<Netlist*>(object), associated_data);
777  break;
778  case TetModule:
779  // qDebug() << "Evt modu" << evt << static_cast<Module*>(object)->get_id() << associated_data;
780  relayModuleEvent((ModuleEvent::event)evt, static_cast<Module*>(object), associated_data);
781  break;
782  case TetGate:
783  // qDebug() << "Evt gate" << evt << static_cast<Gate*>(object)->get_id() << associated_data;
784  relayGateEvent((GateEvent::event)evt, static_cast<Gate*>(object), associated_data);
785  break;
786  case TetNet:
787  // qDebug() << "Evt net_" << evt << static_cast<Net*>(object)->get_id() << associated_data;
788  relayNetEvent((NetEvent::event)evt, static_cast<Net*>(object), associated_data);
789  break;
790  case TetGrouping:
791  // qDebug() << "Evt grup" << evt << static_cast<Grouping*>(object)->get_id() << associated_data;
792  relayGroupingEvent((GroupingEvent::event)evt, static_cast<Grouping*>(object), associated_data);
793  break;
794  }
795  }
796 
797  void NetlistRelay::dumpModuleRecursion(Module *m)
798  {
799  for (int i=0; i<m->get_submodule_depth(); i++)
800  std::cerr << " ";
801  std::cerr << "Mod " << m->get_id() << " <" << m->get_name() << ">\n";
802  for (Module* sm : m->get_submodules())
803  dumpModuleRecursion(sm);
804  }
805 
807  {
808  for (Module* m : gNetlist->get_modules())
809  mModuleColorManager->setRandomColor(m->get_id());
810  mColorSerializer.restore(mModuleColorManager);
811  }
812 
814  {
815  }
816 } // namespace hal
Adds an item to a module or grouping.
Assigns a new type to a module.
GraphTabWidget * getGraphTabWidget()
Get hal's graph tab widget.
ContextManagerWidget * getContextManagerWidget()
NETLIST_API void unregister_callback(const std::string &name)
NETLIST_API void register_callback(const std::string &name, std::function< void(NetlistEvent::event e, Netlist *netlist, u32 associated_data)> function)
static FileManager * get_instance()
void fileOpened(const QString &fileName)
@ boolean_function_changed
no associated_data
@ location_changed
no associated_data
@ removed
no associated_data
@ name_changed
no associated_data
@ created
no associated_data
Definition: gate.h:58
Logical container for modules, gates, and nets.
Definition: graph_context.h:55
void setSpecialUpdate(bool state)
u32 getExclusiveModuleId() const
const QSet< u32 > & gates() const
const QSet< u32 > & modules() const
void setScheduleRemove(const QSet< u32 > &mods, const QSet< u32 > &gats)
GraphLayouter * getLayouter() const
void handleModuleNameChanged(Module *m) const
void handleMarkedGlobalOutput(u32 mNetId)
void handleNetNameChanged(Net *n) const
void handleModuleTypeChanged(Module *m) const
GraphContext * getContextByExclusiveModuleId(u32 module_id) const
void handleMarkedGlobalInput(u32 mNetId)
void handleNetDestinationRemoved(Net *n, const u32 dst_gate_id) const
void handleGateRemoved(Gate *g) const
void handleModuleGateAssigned(Module *m, const u32 inserted_gate) const
void handleNetSourceRemoved(Net *n, const u32 src_gate_id) const
void handleUnmarkedGlobalOutput(u32 mNetId)
void handleUnmarkedGlobalInput(u32 mNetId)
void handleNetDestinationAdded(Net *n, const u32 dst_gate_id) const
void handleModuleCreated(Module *m) const
void handleModuleSubmoduleAdded(Module *m, const u32 added_module) const
void handleModulePortsChanged(Module *m, PinEvent pev, u32 pgid)
void handleModuleGateRemoved(Module *m, const u32 removed_gate)
void handleModuleSubmoduleRemoved(Module *m, const u32 removed_module)
void handleNetSourceAdded(Net *n, const u32 src_gate_id) const
void handleGateNameChanged(Gate *g) const
const NodeBoxes & boxes() const
@ net_assigned
associated_data = id of inserted net
@ module_removed
associated_data = id of removed module
@ color_changed
no associated_data
@ gate_assigned
associated_data = id of inserted gate
@ module_assigned
associated_data = id of inserted module
@ gate_removed
associated_data = id of removed gate
@ removed
no associated_data
@ net_removed
associated_data = id of removed net
@ name_changed
no associated_data
@ created
no associated_data
QColor moduleColor(u32 id) const
void restore(ModuleColorManager *mcm)
The ModuleDialog class opens a popup window for module selection.
Definition: module_dialog.h:63
bool isNewModule() const
Definition: module_dialog.h:87
u32 selectedId() const
Definition: module_dialog.h:80
@ gates_remove_end
associated_data = number of removed gates
@ gate_assigned
associated_data = id of inserted gate
@ gate_removed
associated_data = id of removed gate
@ pin_changed
associated_data = [4LSB: type of action] [28HSB: id of pin group or pin]
@ submodule_removed
associated_data = id of removed module
@ gates_assign_begin
associated_data = number of gates to assign
@ type_changed
no associated_data
@ gates_assign_end
associated_data = number of assigned gates
@ gates_remove_begin
associated_data = number of gates to remove
@ submodule_added
associated_data = id of added module
@ removed
no associated_data
@ parent_changed
no associated_data
@ name_changed
no associated_data
@ created
no associated_data
int get_submodule_depth() const
Definition: module.cpp:159
std::string get_name() const
Definition: module.cpp:87
std::vector< Module * > get_submodules(const std::function< bool(Module *)> &filter=nullptr, bool recursive=false) const
Definition: module.cpp:261
std::string get_type() const
Definition: module.cpp:106
u32 get_id() const
Definition: module.cpp:82
@ src_added
associated_data = id of src gate
@ dst_removed
associated_data = id of dst gate
@ src_removed
associated_data = id of src gate
@ dst_added
associated_data = id of dst gate
@ removed
no associated_data
@ name_changed
no associated_data
@ created
no associated_data
Definition: net.h:58
@ marked_global_gnd
associated_data = id of gate
@ unmarked_global_output
associated_data = id of net
@ id_changed
associated_data = old id
@ device_name_changed
no associated_data
@ unmarked_global_gnd
associated_data = id of gate
@ input_filename_changed
no associated_data
@ unmarked_global_vcc
associated_data = id of gate
@ marked_global_vcc
associated_data = id of gate
@ unmarked_global_input
associated_data = id of net
@ design_name_changed
no associated_data
@ marked_global_output
associated_data = id of net
@ marked_global_input
associated_data = id of net
Gate * get_gate_by_id(const u32 gate_id) const
Definition: netlist.cpp:193
const std::vector< Module * > & get_modules() const
Definition: netlist.cpp:624
Module * get_module_by_id(u32 module_id) const
Definition: netlist.cpp:613
Net * get_net_by_id(u32 net_id) const
Definition: netlist.cpp:353
EventHandler * get_event_handler() const
Definition: netlist.cpp:137
void addToModuleDialog(const Node &node=Node())
void netDestinationRemoved(Net *n, const u32 dst_gate_id) const
void groupingColorChanged(Grouping *grp) const
void moduleGatesAssignEnd(Module *m, u32 number_gates) const
void groupingCreated(Grouping *grp) const
void netlistUnmarkedGlobalOutput(Netlist *n, const u32 associated_data) const
void netlistDeviceNameChanged(Netlist *n) const
void addChildModuleDialog(const u32 id)
void netlistIdChanged(Netlist *n, const u32 associated_data) const
void netlistUnmarkedGlobalInput(Netlist *n, const u32 associated_data) const
void moduleGatesRemoveBegin(Module *m, u32 number_gates) const
void moduleTypeChanged(Module *m) const
void netCreated(Net *n) const
void registerNetlistCallbacks()
void netlistMarkedGlobalVcc(Netlist *n, const u32 associated_data) const
ModuleColorManager * getModuleColorManager() const
void groupingGateAssigned(Grouping *grp, u32 id) const
void deleteModule(const u32 id)
void changeModuleColorDialog(const u32 id)
void groupingModuleAssigned(Grouping *grp, u32 id) const
void netlistInputFilenameChanged(Netlist *n) const
void unregisterNetlistCallbacks()
void groupingModuleRemoved(Grouping *grp, u32 id) const
void changeElementNameDialog(ModuleItem::TreeItemType type, u32 id)
void netSourceAdded(Net *n, const u32 src_gate_id) const
void moduleGateRemoved(Module *m, const u32 removed_gate) const
void moduleGateAssigned(Module *m, const u32 assigned_gate) const
void netSourceRemoved(Net *n, const u32 src_gate_id) const
void netlistMarkedGlobalInput(Netlist *n, const u32 associated_data) const
void netRemoved(Net *n) const
void groupingRemoved(Grouping *grp) const
void netlistMarkedGlobalOutput(Netlist *n, const u32 associated_data) const
NetlistRelay(QObject *parent=nullptr)
void gateCreated(Gate *g) const
void groupingNetAssigned(Grouping *grp, u32 id) const
void netlistUnmarkedGlobalVcc(Netlist *n, const u32 associated_data) const
void netDestinationAdded(Net *n, const u32 dst_gate_id) const
void moduleSubmoduleRemoved(Module *m, const u32 removed_module) const
void groupingNameChanged(Grouping *grp) const
void moduleNameChanged(Module *m) const
void handleThreadEvent(int type, int evt, void *object, u32 associated_data)
void gateRemoved(Gate *g) const
void gateNameChanged(Gate *g) const
void moduleRemoved(Module *m) const
void moduleParentChanged(Module *m) const
void modulePortsChanged(Module *m, PinEvent pev, u32 pgid) const
void changeModuleTypeDialog(const u32 id)
void moduleSubmoduleAdded(Module *m, const u32 added_module) const
void groupingNetRemoved(Grouping *grp, u32 id) const
void moduleCreated(Module *m) const
void moduleGatesRemoveEnd(Module *m, u32 number_gates) const
void netlistDesignNameChanged(Netlist *n) const
void signalThreadEvent(int type, int evt, void *object, u32 associated_data)
void netlistMarkedGlobalGnd(Netlist *n, const u32 associated_data) const
void netlistUnmarkedGlobalGnd(Netlist *n, const u32 associated_data) const
void gateBooleanFunctionChanged(Gate *g) const
void gateLocationChanged(Gate *g) const
void groupingGateRemoved(Grouping *grp, u32 id) const
void moduleGatesAssignBegin(Module *m, u32 number_gates) const
void netNameChanged(Net *n) const
QColor getModuleColor(const u32 id)
The NodeBox class represents a node placed at a grid position within a hal view.
Definition: node_box.h:50
int x() const
x getter for X-grid position
Definition: node_box.h:93
int y() const
y getter for Y-grid position
Definition: node_box.h:99
NodeBox * boxForNode(const Node &n) const
boxForNode find NodeBox by node
Definition: node_box.h:200
The Node class object represents a module or a gate.
Definition: gui_def.h:61
bool isModule() const
isModule test wheter node is a module
Definition: gui_def.h:95
@ Module
Definition: gui_def.h:63
@ Gate
Definition: gui_def.h:63
bool isNull() const
isNull test for null-Node object typically returned from functions
Definition: gui_def.h:83
u32 id() const
id getter for ID information
Definition: gui_def.h:77
void setFocus(ItemType ftype, u32 fid, Subfocus sfoc=Subfocus::None, u32 sfinx=0)
void relaySelectionChanged(void *sender)
QList< u32 > selectedModulesList() const
void handleNetRemoved(const u32 id)
QList< u32 > selectedGatesList() const
void handleGateRemoved(const u32 id)
void handleModuleRemoved(const u32 id)
void addAction(UserAction *act)
virtual void setObject(const UserActionObject &obj)
Definition: user_action.cpp:32
virtual UserActionObject object() const
Definition: user_action.h:102
The UserActionObject class represents a single object used in UserAction.
#define UNUSED(expr)
Definition: defines.h:49
Module * firstCommonAncestor(std::unordered_set< Module * > modules, const std::unordered_set< Gate * > &gates)
Definition: netlist.cpp:34
ContentManager * gContentManager
Definition: plugin_gui.cpp:78
FileStatusManager * gFileStatusManager
Definition: plugin_gui.cpp:84
PinEvent
Definition: pin_event.h:42
GraphContextManager * gGraphContextManager
Definition: plugin_gui.cpp:85
SelectionRelay * gSelectionRelay
Definition: plugin_gui.cpp:83
Netlist * gNetlist
Definition: plugin_gui.cpp:80
n
Definition: test.py:6
quint32 u32
PinType type
Net * net
std::string name
bool isValid() const const
QColor getColor(const QColor &initial, QWidget *parent, const QString &title, QColorDialog::ColorDialogOptions options)
virtual int exec()
QString getText(QWidget *parent, const QString &title, const QString &label, QLineEdit::EchoMode mode, const QString &text, bool *ok, Qt::WindowFlags flags, Qt::InputMethodHints inputMethodHints)
Q_EMITQ_EMIT
QMetaObject::Connection connect(const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
bool contains(const T &value) const const
QSet::iterator insert(const T &value)
QString fromStdString(const std::string &str)
BlockingQueuedConnection
QThread * currentThread()