From 00b165c2083466dd465220fb1e8c28fc2e2882d1 Mon Sep 17 00:00:00 2001 From: KeyboardCombination Date: Sun, 11 Jun 2023 18:16:36 -0400 Subject: [PATCH] Update GUDButtonListener.cpp --- src/source/Listener/GUDButtonListener.cpp | 44 +++++++++++------------ 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/src/source/Listener/GUDButtonListener.cpp b/src/source/Listener/GUDButtonListener.cpp index 31df167..53dbd0d 100644 --- a/src/source/Listener/GUDButtonListener.cpp +++ b/src/source/Listener/GUDButtonListener.cpp @@ -7,12 +7,12 @@ void GUDButtonListener::onButton1MouseClick(BaseButtonInstance* button) { - SelectionService* getSelectionService = g_dataModel->getSelectionService(); - SoundService* getSoundService = g_dataModel->getSoundService(); + SelectionService* selectionService = g_dataModel->getSelectionService(); + SoundService* soundService = g_dataModel->getSoundService(); bool cont = false; - for(size_t i = 0; i < getSelectionService->getSelection().size(); i++) - if(getSelectionService->getSelection()[i]->canDelete) + for(size_t i = 0; i < selectionService->getSelection().size(); i++) + if(selectionService->getSelection()[i]->canDelete) { cont = true; break; @@ -21,19 +21,19 @@ void GUDButtonListener::onButton1MouseClick(BaseButtonInstance* button) if (cont) { if(button->disabled == false){ - getSoundService->playSound(getSoundService->findFirstChild("Ping")); + soundService->playSound(soundService->findFirstChild("Ping")); } if(button->name == "Duplicate") { std::vector newinst; - for(size_t i = 0; i < getSelectionService->getSelection().size(); i++) + for(size_t i = 0; i < selectionService->getSelection().size(); i++) { - if(getSelectionService->getSelection()[i]->canDelete) + if(selectionService->getSelection()[i]->canDelete) { - Instance* tempinst = getSelectionService->getSelection()[i]; + Instance* tempinst = selectionService->getSelection()[i]; - Instance* clonedInstance = getSelectionService->getSelection()[i]->clone(); + Instance* clonedInstance = selectionService->getSelection()[i]->clone(); if (clonedInstance->getClassName() == "PVInstance"){ PartInstance* Part = dynamic_cast(clonedInstance); @@ -43,35 +43,35 @@ void GUDButtonListener::onButton1MouseClick(BaseButtonInstance* button) newinst.push_back(clonedInstance); } } - getSelectionService->clearSelection(); - getSelectionService->addSelected(newinst); + selectionService->clearSelection(); + selectionService->addSelected(newinst); } else if(button->name == "Group") { - if (getSelectionService->getSelection().size() > 1){ + if (selectionService->getSelection().size() > 1){ GroupInstance * inst = new GroupInstance(); inst->setParent(g_dataModel->getWorkspace()); - for(size_t i = 0; i < getSelectionService->getSelection().size(); i++) + for(size_t i = 0; i < selectionService->getSelection().size(); i++) { - if(getSelectionService->getSelection()[i]->canDelete) + if(selectionService->getSelection()[i]->canDelete) { - getSelectionService->getSelection()[i]->setParent(inst); - if(PartInstance* part = dynamic_cast(getSelectionService->getSelection()[i])) + selectionService->getSelection()[i]->setParent(inst); + if(PartInstance* part = dynamic_cast(selectionService->getSelection()[i])) { inst->primaryPart = part; } } } - getSelectionService->clearSelection(); - getSelectionService->addSelected(inst); + selectionService->clearSelection(); + selectionService->addSelected(inst); } } else if(button->name == "UnGroup") { std::vector newinst; - for(size_t i = 0; i < getSelectionService->getSelection().size(); i++) + for(size_t i = 0; i < selectionService->getSelection().size(); i++) { - Instance* selection = getSelectionService->getSelection()[i]; + Instance* selection = selectionService->getSelection()[i]; if(GroupInstance* model = dynamic_cast(selection)) { @@ -81,8 +81,8 @@ void GUDButtonListener::onButton1MouseClick(BaseButtonInstance* button) model = NULL; } } - getSelectionService->clearSelection(); - getSelectionService->addSelected(newinst); + selectionService->clearSelection(); + selectionService->addSelected(newinst); } } } \ No newline at end of file