27 #include <QApplication>
28 #include <QColorDialog>
30 #include <QInputDialog>
61 "gui_netlist_handler",
62 std::function<
void(
NetlistEvent::event,
Netlist*,
u32)>(std::bind(&NetlistRelay::relayNetlistEvent,
this, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3)));
66 std::function<
void(
ModuleEvent::event,
Module*,
u32)>(std::bind(&NetlistRelay::relayModuleEvent,
this, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3)));
69 "gui_gate_handler", std::function<
void(
GateEvent::event,
Gate*,
u32)>(std::bind(&NetlistRelay::relayGateEvent,
this, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3)));
72 "gui_net_handler", std::function<
void(
NetEvent::event,
Net*,
u32)>(std::bind(&NetlistRelay::relayNetEvent,
this, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3)));
75 "gui_grouping_handler",
76 std::function<
void(
GroupingEvent::event,
Grouping*,
u32)>(std::bind(&NetlistRelay::relayGroupingEvent,
this, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3)));
79 void NetlistRelay::handleNetlistModified()
95 return mModuleColorManager;
109 prompt =
"Change module name";
117 prompt =
"Change gate name";
125 prompt =
"Change net name";
180 Node firstNode = node;
194 if (specialUpdateRequired && ! context->
gates().
contains(
id))
195 specialUpdateRequired =
false;
203 specialUpdateRequired =
false;
212 if (firstNode.
isNull())
return;
215 std::unordered_set<Gate*> gatsContent;
216 for (
u32 id : gatIds)
219 std::unordered_set<Module*> modsContent;
220 for (
u32 id : modIds)
224 if (!parentModule)
return;
227 ModuleDialog md({},
"Move to module",
false,
nullptr,qApp->activeWindow());
238 "New module will be created under \"" + parentName +
"\"\nModule Name:",
240 if (!ok ||
name.isEmpty())
return;
252 specialUpdateRequired =
false;
263 if (specialUpdateRequired)
286 if (!ok ||
name.isEmpty())
334 handleNetlistModified();
339 qApp->processEvents();
432 handleNetlistModified();
437 qApp->processEvents();
484 handleNetlistModified();
489 qApp->processEvents();
499 if (mod->get_parent_module() !=
nullptr)
569 u32 id = (associated_data >> 4);
619 handleNetlistModified();
624 qApp->processEvents();
679 handleNetlistModified();
684 qApp->processEvents();
787 void NetlistRelay::dumpModuleRecursion(
Module *m)
791 std::cerr <<
"Mod " << m->
get_id() <<
" <" << m->
get_name() <<
">\n";
793 dumpModuleRecursion(sm);
800 mColorSerializer.
restore(mModuleColorManager);
Adds an item to a module or grouping.
void setParentId(u32 pid)
Assigns a new type to a module.
GraphTabWidget * getGraphTabWidget()
Get hal's graph tab widget.
ContextManagerWidget * getContextManagerWidget()
GraphContext * getCurrentContext()
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
Logical container for modules, gates, and nets.
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 handleNetCreated(Net *n) const
void handleNetNameChanged(Net *n) const
void handleModuleTypeChanged(Module *m) const
void handleNetRemoved(Net *n) 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
void handleModuleRemoved(Module *m)
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
QColor setRandomColor(u32 id)
void restore(ModuleColorManager *mcm)
The ModuleDialog class opens a popup window for module selection.
@ 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
std::string get_name() const
std::vector< Module * > get_submodules(const std::function< bool(Module *)> &filter=nullptr, bool recursive=false) const
std::string get_type() const
@ 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
@ 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
const std::vector< Module * > & get_modules() const
Module * get_module_by_id(u32 module_id) const
Net * get_net_by_id(u32 net_id) const
EventHandler * get_event_handler() const
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 debugHandleFileClosed()
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 debugHandleFileOpened()
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.
int x() const
x getter for X-grid position
int y() const
y getter for Y-grid position
NodeBox * boxForNode(const Node &n) const
boxForNode find NodeBox by node
The Node class object represents a module or a gate.
bool isModule() const
isModule test wheter node is a module
bool isNull() const
isNull test for null-Node object typically returned from functions
u32 id() const
id getter for ID information
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)
void setUseCreatedObject()
virtual void setObject(const UserActionObject &obj)
virtual UserActionObject object() const
The UserActionObject class represents a single object used in UserAction.
Module * firstCommonAncestor(std::unordered_set< Module * > modules, const std::unordered_set< Gate * > &gates)
ContentManager * gContentManager
FileStatusManager * gFileStatusManager
GraphContextManager * gGraphContextManager
SelectionRelay * gSelectionRelay
bool isValid() const const
QColor getColor(const QColor &initial, QWidget *parent, const QString &title, QColorDialog::ColorDialogOptions options)
QString getText(QWidget *parent, const QString &title, const QString &label, QLineEdit::EchoMode mode, const QString &text, bool *ok, Qt::WindowFlags flags, Qt::InputMethodHints inputMethodHints)
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)
QThread * currentThread()