From: caceres <> Date: Mon, 26 Mar 2012 12:19:03 +0000 (+0000) Subject: DFCH: MakeExecutableBox --- Make All selected executable. X-Git-Tag: v1_0_0~1 X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=commitdiff_plain;h=622a4096d40d4e6309f58099070935b647646abf;hp=09991540eea974c719f4d2a4accbe28734441c89;p=bbtkGEditor.git DFCH: MakeExecutableBox --- Make All selected executable. Changed: Iteration to take all selected boxes --- diff --git a/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxVtkSceneManager.cxx b/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxVtkSceneManager.cxx index c482711..b080d31 100644 --- a/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxVtkSceneManager.cxx +++ b/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxVtkSceneManager.cxx @@ -1141,26 +1141,27 @@ std::string wxVtkSceneManager::LineNumber(bool withLineNumber, int &value) { //DFCH bool wxVtkSceneManager::MakeBoxExecutable() { std::map selected = getSelectedObjects(); - - std::map::iterator it = selected.end(); - it--; - GObjectController* lastSelected = it->second; - //GObjectController* lastSelected = selected[selected.size()-1]; - if( lastSelected ) - { - vtkGObjectView* view = (vtkGObjectView*) lastSelected->getView(); - GBlackBoxModel *bbmodel = (GBlackBoxModel*) lastSelected->getModel(); - view->setState(HIGHLIGHTED); - if (bbmodel->isExecutable()) { - bbmodel->setExecutable(false); - } else { - bbmodel->setExecutable(true); + if( selected.empty() ) + return false; + bool ret = false; + std::map::iterator it; + for (it = selected.begin(); it != selected.end(); ++it) { + GObjectController* lastSelected = it->second; + if (lastSelected) { + vtkGObjectView* view = (vtkGObjectView*) lastSelected->getView(); + GBlackBoxModel *bbmodel = + (GBlackBoxModel*) lastSelected->getModel(); + view->setState(HIGHLIGHTED); + if (bbmodel->isExecutable()) { + bbmodel->setExecutable(false); + } else { + bbmodel->setExecutable(true); + } + bbmodel->notifyObservers(lastSelected->getId()); + ret = true; } - bbmodel->notifyObservers(lastSelected->getId()); - return true; } - else - return( false ); + return ret; } //DFCH