X-Git-Url: https://bilbo.iut-bm.univ-fcomte.fr/and/gitweb/blast.git/blobdiff_plain/abbc64cf04a35ab3549d5c516f44c7c5921baa63..HEAD:/GroupWidget.cpp diff --git a/GroupWidget.cpp b/GroupWidget.cpp index 1446a13..c530c2b 100644 --- a/GroupWidget.cpp +++ b/GroupWidget.cpp @@ -21,7 +21,7 @@ GroupWidget::GroupWidget(GroupWidget *_upperGroup, Dispatcher *_dispatcher, scene = new GroupScene(NULL, this, dispatcher, params, true); } else { - topGroup = true; + topGroup = false; scene = new GroupScene(upperGroup->getScene(), this, dispatcher, params, false); } @@ -41,7 +41,13 @@ GroupWidget::GroupWidget(GroupWidget *_upperGroup, Dispatcher *_dispatcher, } -GroupWidget::~GroupWidget(){} +GroupWidget::~GroupWidget(){ + static QString fctName = "GroupWidget::~GroupWidget()"; +#ifdef DEBUG_FCTNAME + cout << "call to " << qPrintable(fctName) << endl; +#endif + // delete scene; // TO DO: must check if it is needed +} void GroupWidget::changeConnectionMode(int mode) { /* @@ -79,7 +85,7 @@ void GroupWidget::enableGroupButton(bool b) { void GroupWidget::mousePressEvent(QMouseEvent *e) { - dispatcher->setCurrentGroupWidget(this); + dispatcher->setCurrentGroupWidget(Dispatcher::Design, this); QWidget::mousePressEvent(e); } @@ -95,6 +101,7 @@ void GroupWidget::focusInEvent(QFocusEvent *e) { void GroupWidget::closeEvent(QCloseEvent *e) { clearFocus(); focusNextChild(); + } @@ -147,46 +154,46 @@ void GroupWidget::createActions() { void GroupWidget::createToolbar() { toolbarEditMode = new QToolBar(tr("Mode")); toolbarAdd = new QToolBar(tr("Group")); - toolbarTools = new QToolBar(tr("Tools")); + //toolbarTools = new QToolBar(tr("Tools")); toolbarEditMode->addWidget(new QLabel("Mode")); - toolbarTools->addWidget(new QLabel("Tools")); + //toolbarTools->addWidget(new QLabel("Tools")); toolbarEditMode->addSeparator(); - toolbarTools->addSeparator(); + //toolbarTools->addSeparator(); toolbarEditMode->addWidget(butAddConnection); toolbarEditMode->addWidget(butEdit); - toolbarAdd->addAction(copyBlockAct); + //toolbarAdd->addAction(copyBlockAct); toolbarAdd->addAction(newEmptyGroupAct); toolbarAdd->addAction(newGroupAct); - toolbarTools->addAction(deleteAct); - toolbarTools->addAction(selectAllAct); - toolbarTools->addAction(unselectAllAct); + //toolbarTools->addAction(deleteAct); + //toolbarTools->addAction(selectAllAct); + //toolbarTools->addAction(unselectAllAct); layout->addWidget(toolbarEditMode,0,0); layout->addWidget(toolbarAdd,0,1); - layout->addWidget(toolbarTools,0,2); + //layout->addWidget(toolbarTools,0,2); } void GroupWidget::slotEdit() { - dispatcher->unselectAllItems(); + dispatcher->unselectAllItems(Dispatcher::Design); getScene()->setEditionMode(GroupScene::ItemEdition); updateBlockButton(); } void GroupWidget::slotCopyBlock() { - foreach (BoxItem *item, params->getCurrentScene()->getBlockItems()) { + foreach (BoxItem *item, params->getCurrentScene()->getBoxItems()) { if(item->isSelected()){ - dispatcher->duplicateBlock(item); + dispatcher->duplicateBoxItem(Dispatcher::Design, item); } } } void GroupWidget::slotAddConnection() { - dispatcher->unselectAllItems(); + dispatcher->unselectAllItems(Dispatcher::Design); getScene()->setEditionMode(GroupScene::AddConnection); updateBlockButton(); } @@ -222,29 +229,24 @@ void GroupWidget::updateBlockButton() { void GroupWidget::slotNewEmptyGroup() { - // creating the GroupBlock in graph model - GroupBlock* groupBlock = params->addGroupBlock(); - // creating the BlockItem in the inner scene - BoxItem* block = new BoxItem(groupBlock, dispatcher, params, scene->getGroupItem()); + dispatcher->addNewEmptyGroup(Dispatcher::Design, scene); - GroupWidget* child = dispatcher->createChildScene(this,block); - child->show(); } void GroupWidget::slotNewGroup() { - dispatcher->addNewFullGroup(); + dispatcher->addNewFullGroup(Dispatcher::Design ); } void GroupWidget::slotDeleteItems() { - foreach (BoxItem *item, scene->getBlockItems()) { + foreach (BoxItem *item, scene->getBoxItems()) { if(item->isSelected()){ - dispatcher->removeBlock(item); + dispatcher->removeBoxItem(Dispatcher::Design, item); } } foreach (ConnectionItem *item, scene->getConnectionItems()) { if(item->isSelected()){ - dispatcher->removeConnection(item); + dispatcher->removeConnection(Dispatcher::Design, item); } } }