@@ -166,70 +166,6 @@ namespace hal
166166 context->setDirty (false );
167167 }
168168
169- void GraphGraphicsView::handleMoveAction (u32 moduleId)
170- {
171- ActionAddItemsToObject* act = new ActionAddItemsToObject (gSelectionRelay ->selectedModules (),
172- gSelectionRelay ->selectedGates ());
173- act->setObject (UserActionObject (moduleId,UserActionObjectType::Module));
174- act->exec ();
175- gSelectionRelay ->clear ();
176- gSelectionRelay ->addModule (moduleId);
177- gSelectionRelay ->setFocus (SelectionRelay::ItemType::Module,moduleId);
178- gSelectionRelay ->relaySelectionChanged (this );
179- gContentManager ->getGraphTabWidget ()->ensureSelectionVisible ();
180- }
181-
182- void GraphGraphicsView::handleMoveNewAction ()
183- {
184- std::unordered_set<Gate*> gate_objs;
185- std::unordered_set<Module*> module_objs;
186- for (const auto & id : gSelectionRelay ->selectedGatesList ())
187- {
188- gate_objs.insert (gNetlist ->get_gate_by_id (id));
189- }
190- for (const auto & id : gSelectionRelay ->selectedModulesList ())
191- {
192- module_objs.insert (gNetlist ->get_module_by_id (id));
193- }
194- Module* parent = gui_utility::firstCommonAncestor (module_objs, gate_objs);
195- QString parent_name = QString::fromStdString (parent->get_name ());
196- bool ok;
197- QString name = QInputDialog::getText (nullptr , " " , " New module will be created under \" " + parent_name + " \"\n Module Name:" , QLineEdit::Normal, " " , &ok);
198- if (!ok || name.isEmpty ())
199- return ;
200-
201- ActionCreateObject* actNewModule = new ActionCreateObject (UserActionObjectType::Module, name);
202- actNewModule->setParentId (parent->get_id ());
203-
204- UserActionCompound* compound = new UserActionCompound;
205- compound->setUseCreatedObject ();
206- compound->addAction (actNewModule);
207- compound->addAction (new ActionAddItemsToObject (gSelectionRelay ->selectedModules (),
208- gSelectionRelay ->selectedGates ()));
209- if (mItem && (mItem ->itemType ()==ItemType::Gate || mItem ->itemType ()==ItemType::Module))
210- {
211- Node nd (mItem ->id (),mItem ->itemType ()==ItemType::Gate ? Node::Gate : Node::Module);
212- const NodeBox* box = mGraphWidget ->getContext ()->getLayouter ()->boxes ().boxForNode (nd);
213- if (box)
214- {
215- ActionMoveNode* actMoveNode = new ActionMoveNode (mGraphWidget ->getContext ()->id (),
216- QPoint (box->x (),box->y ()));
217- compound->addAction (actMoveNode);
218- }
219- }
220-
221- GraphContext* context = mGraphWidget ->getContext ();
222- context->setSpecialUpdate (true );
223- context->setScheduleRemove (gSelectionRelay ->selectedModules (),gSelectionRelay ->selectedGates ());
224-
225- compound->exec ();
226- gSelectionRelay ->clear ();
227- gSelectionRelay ->addModule (compound->object ().id ());
228- gSelectionRelay ->setFocus (SelectionRelay::ItemType::Module,compound->object ().id ());
229- gSelectionRelay ->relaySelectionChanged (this );
230- gContentManager ->getGraphTabWidget ()->ensureSelectionVisible ();
231- }
232-
233169 void GraphGraphicsView::adjustMinScale ()
234170 {
235171 if (!scene ())
@@ -689,14 +625,6 @@ namespace hal
689625 data.setValue (Node (mItem ->id (), isGate ? Node::NodeType::Gate : Node::NodeType::Module));
690626 action->setData (data);
691627 connect (action, &QAction::triggered, this , &GraphGraphicsView::handleAddCommentAction);
692-
693- // only allow move actions on anything that is not the top module
694- Module* m = isModule ? gNetlist ->get_module_by_id (mItem ->id ()) : nullptr ;
695- if (!(isModule && m == gNetlist ->get_top_module ()))
696- {
697- action = context_menu.addAction (" Move to module …" );
698- connect (action, &QAction::triggered, this , &GraphGraphicsView::handleModuleDialog);
699- }
700628 }
701629 }
702630 else
@@ -1310,44 +1238,6 @@ namespace hal
13101238 act->exec ();
13111239 }
13121240
1313- void GraphGraphicsView::handleModuleDialog ()
1314- {
1315- QSet<u32 > exclude_ids;
1316- QList<u32 > modules = gSelectionRelay ->selectedModulesList ();
1317- QList<u32 > gates = gSelectionRelay ->selectedGatesList ();
1318-
1319- for (u32 gid : gates)
1320- {
1321- Gate* g = gNetlist ->get_gate_by_id (gid);
1322- if (!g)
1323- continue ;
1324- exclude_ids.insert (g->get_module ()->get_id ());
1325- }
1326-
1327- for (u32 mid : modules)
1328- {
1329- exclude_ids.insert (mid);
1330- Module* m = gNetlist ->get_module_by_id (mid);
1331- if (!m)
1332- continue ;
1333- Module* pm = m->get_parent_module ();
1334- if (pm)
1335- exclude_ids.insert (pm->get_id ());
1336- for (Module* sm : m->get_submodules (nullptr , true ))
1337- exclude_ids.insert (sm->get_id ());
1338- }
1339-
1340- AddToModuleReceiver* receiver = new AddToModuleReceiver (this );
1341- ModuleDialog md (exclude_ids, " Move to module" , false , receiver, this );
1342- if (md.exec () != QDialog::Accepted) return ;
1343- if (md.isNewModule ())
1344- {
1345- handleMoveNewAction ();
1346- return ;
1347- }
1348- handleMoveAction (md.selectedId ());
1349- }
1350-
13511241 void GraphGraphicsView::handleSelectOutputs ()
13521242 {
13531243 auto context = mGraphWidget ->getContext ();
0 commit comments