]> Creatis software - bbtkGEditor.git/commitdiff
DFCH: MakeExecutableBox --- Make All selected executable.
authorcaceres <>
Mon, 26 Mar 2012 12:19:03 +0000 (12:19 +0000)
committercaceres <>
Mon, 26 Mar 2012 12:19:03 +0000 (12:19 +0000)
Changed: Iteration to take all selected boxes

lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxVtkSceneManager.cxx

index c482711cc67ee0e3547f57ded274ce4408b2443c..b080d31f1933b9544d03025e4e07760b8579206f 100644 (file)
@@ -1141,26 +1141,27 @@ std::string wxVtkSceneManager::LineNumber(bool withLineNumber, int &value) {
 //DFCH
 bool wxVtkSceneManager::MakeBoxExecutable() {
        std::map<int, GObjectController*> selected = getSelectedObjects();
-
-       std::map<int, GObjectController*>::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<int, GObjectController*>::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