]> Creatis software - bbtkGEditor.git/commitdiff
#3253 Select manual of boxes
authorEduardo DAVILA <davila@creatis.insa-lyon.fr>
Wed, 23 Nov 2022 08:19:04 +0000 (09:19 +0100)
committerEduardo DAVILA <davila@creatis.insa-lyon.fr>
Wed, 23 Nov 2022 08:19:04 +0000 (09:19 +0100)
lib/EditorGraphicBBS/bbsKernelEditorGraphic/GlobalConstants.h
lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/bbtkwxGUIEditorGraphicBBS.cxx
lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/bbtkwxGUIEditorGraphicBBS.h
lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxGEditorTabPanel.cxx
lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxGEditorTabPanel.h
lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxTabPanelsManager.cxx
lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxTabPanelsManager.h
lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxVtkSceneManager.cxx
lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxVtkSceneManager.h

index 4d03701cffdbc10a951fc2309a93b6babfb0ce02..42228af6939c8ab6f8f12108a3ae29f759cecf34 100644 (file)
@@ -235,6 +235,11 @@ namespace bbtk {
 
        const int ID_EDITPROPERTIES                                                                     =       1028;  // RaC 2nd HackFest
        const int ID_SHOWTREE                                                                   =       1029;  // CFT
+
+    //EED 2022-10-28
+    const int ID_BTNSELETBOXES              =   1032;
+
+
 }
 // namespace bbtk
 #endif
index be1251308d39ac6f686036eed696365a41c528f4..ed9d80c336f5ab73cfffbae33ad24a2dc8dabd7f 100644 (file)
@@ -161,8 +161,8 @@ void wxGUIEditorGraphicBBS::initToolbar()
        toolbar->AddTool(ID_CENTERVIEW, _T("Center view"), bmp_centerview,
                        wxNullBitmap, wxITEM_NORMAL, _T("Center view"), _T("Center view"));
        toolbar->AddSeparator();
-       toolbar->AddTool(ID_BTNBOX, _T("New Box"), bmp_box, wxNullBitmap,
-                       wxITEM_NORMAL, _T("New Box"), _T("Nex Box"));
+    toolbar->AddTool(ID_BTNBOX, _T("New Box"), bmp_box, wxNullBitmap,wxITEM_NORMAL, _T("New Box"), _T("Nex Box"));
+       toolbar->AddTool(ID_BTNSELETBOXES, _T("Select Boxes"), bmp_box, wxNullBitmap,wxITEM_NORMAL, _T("Select Boxes"), _T("Select Boxes"));
        toolbar->AddSeparator();
        toolbar->AddTool(ID_BTEXECUTABLEBOX, _T("Select as executable Box"),
                        bmp_executablebox, wxNullBitmap, wxITEM_NORMAL,
@@ -235,8 +235,8 @@ void wxGUIEditorGraphicBBS::initToolbar()
                        ID_CENTERVIEW,
                        wxEVT_COMMAND_TOOL_CLICKED,
                        wxCommandEventHandler(wxGUIEditorGraphicBBS::OnCenterViewActualDiagram));
-       Connect(ID_BTNBOX, wxEVT_COMMAND_TOOL_CLICKED,
-                       wxCommandEventHandler(wxGUIEditorGraphicBBS::OnClickBtnBox));
+       Connect(ID_BTNBOX, wxEVT_COMMAND_TOOL_CLICKED,wxCommandEventHandler(wxGUIEditorGraphicBBS::OnClickBtnBox));
+    Connect(ID_BTNSELETBOXES, wxEVT_COMMAND_TOOL_CLICKED , wxCommandEventHandler(wxGUIEditorGraphicBBS::OnClickBtnSelectBoxes) );
        Connect(
                        ID_BTEXECUTABLEBOX,
                        wxEVT_COMMAND_TOOL_CLICKED,
@@ -1195,6 +1195,14 @@ void wxGUIEditorGraphicBBS::OnClickBtnBox(wxCommandEvent& event)
        }// if bbDes
 }
 
+//=========================================================================
+//2022-10-28
+void wxGUIEditorGraphicBBS::OnClickBtnSelectBoxes(wxCommandEvent& event)
+{
+    std::string nameFilter = _pkgBrowser->GetNameFilter();
+    _tabsMgr->SelectBoxWithPossibleName( nameFilter );
+}
+
 //=========================================================================
 
 void wxGUIEditorGraphicBBS::OnClickBtnExecutableBox(wxCommandEvent& event) 
index 78a3f31267358507070ea5009591b6ddc6366961..d864b402b313284add911b422c2514112e16ae96 100644 (file)
@@ -170,6 +170,7 @@ namespace bbtk
                        void OnDeleteAllBoxesActualDiagram(wxCommandEvent& event);
                        void OnCenterViewActualDiagram(wxCommandEvent& event);
                        void OnClickBtnBox(wxCommandEvent& event);
+            void OnClickBtnSelectBoxes(wxCommandEvent& event);
                        void OnClickBtnComplexBox(wxCommandEvent& event);
                        void OnAddComplexBoxInput(wxCommandEvent& event);
                        void OnAddComplexBoxOutput(wxCommandEvent& event);
@@ -245,8 +246,8 @@ namespace bbtk
                        // RaC 2012 2nd HackFest
                        std::string                                             _currentBBGversion;
                        
-                       NodeTreeC tree;
-                       wxVtkSceneManager *_sceneM;
+                       NodeTreeC                           tree;
+                       wxVtkSceneManager                   *_sceneM;
                protected:
 
 
index 34125b66cdc49ed8a74151931ffe5c70ad93c277..6c5dfe583a3647e5bf4b764c1262ac8f4950ef18 100644 (file)
@@ -606,6 +606,13 @@ printf("EED wxGEditorTabPanel::getUndoState This mecanisme is not working  ?????
                return( this->_fileName );
        }
 
+    //=========================================================================
+    // EED 2022-10-28
+    bool wxGEditorTabPanel::SelectBoxWithPossibleName(std::string nameFilter )
+    {
+        getSceneManager()->SelectBoxWithPossibleName( nameFilter );
+    }
+
 
 
 
index d687638569a6f3ed395d040ac42d549288ca8f6b..4519b55e839d7984c5a0458f2c2b7681217924da 100644 (file)
@@ -196,6 +196,8 @@ namespace bbtk
                std::string GetMessageKind();
         std::string GetMessageLevel();
 
+        bool SelectBoxWithPossibleName(std::string nameFilter );
+
        //=========================================================================
 
        private:
index 351551e1403b8dd319e165bd4b14396e67a7fd9b..ec69b81ae4b0523a5c462749855b3e5182fd7a0f 100644 (file)
@@ -435,7 +435,14 @@ namespace bbtk
     {
         return _parent->TryToOpenScriptApplication( packageName, boxType );
     }
-               
+       
+    //=========================================================================
+    // EED 2022-10-28
+    bool wxTabPanelsManager::SelectBoxWithPossibleName(std::string nameFilter )
+    {
+        _actual->SelectBoxWithPossibleName( nameFilter );
+    }
+
 }  // EO namespace bbtk
 
 // EOF
index 5e4428d50a432539a02b5c7eef271d268d4e2498..add57450778ddd1d77e2d48eae412fe7f42fe5b0 100644 (file)
@@ -156,7 +156,8 @@ namespace bbtk
            std::string GetCurrentTabPanelPath( ); //DFCH
            int  FindTab(std::string filename);
                bool TryToOpenScriptApplication(std::string packageName ,std::string boxType);
-
+        bool SelectBoxWithPossibleName(std::string nameFilter );
+        
        private:
 
        // Private Attributes
index 1d8dc2957e68a4d5a5dbbbba61394369b4d00623..f1a057f33b9626515c38b57aa274014fd5028bae 100644 (file)
@@ -3089,11 +3089,8 @@ std::vector< std::string> wxVtkSceneManager::GetExternalInputsNames()
 }
 
 //=========================================================================
-
-
-
-void wxVtkSceneManager::printAll(int com , int sta ){
-        
+void wxVtkSceneManager::printAll(int com , int sta )
+{
          int tmpState = sta ;
         if ( tmpState == NOTHING_HAPPENS ) {
             std::cout << "CONTROLER STATE---->NOTHING_HAPPENS\n" ;
@@ -3144,6 +3141,48 @@ void wxVtkSceneManager::printAll(int com , int sta ){
         
     }
 
+//=========================================================================
+//EED 2022-10-28
+void wxVtkSceneManager::SelectBoxWithPossibleName( std::string possibleName )
+{
+    UnSelectBlackBoxes();
+    std::map<int, GObjectController*>::iterator it;
+    GObjectController                           *desc;
+    int                                         type;
+    int                                         id;
+    int                                         pos;
+    std::string possibleNameAA = possibleName;
+    std::string boxNameBB;
+    int i,size;
+    size = possibleNameAA.length();
+    for (i=0;i<size;i++)
+    {
+        if ((possibleNameAA[i]>='A')&&(possibleNameAA[i]<='Z')) { possibleNameAA[i]=possibleNameAA[i]+32; }
+    } //for  i
+    for (it = _controllers.begin(); it != _controllers.end(); ++it)
+    {
+        desc    = it->second;
+        type    = desc->getGObjectType();
+        if ( type==GBLACKBOX)
+        {
+            boxNameBB = desc->getModel()->getBBTKType() +":"+ desc->getModel()->getBBTKName();
+            size=boxNameBB.length();
+            for (i=0;i<size;i++)
+            {
+                if ((boxNameBB[i]>='A')&&(boxNameBB[i]<='Z')) { boxNameBB[i]=boxNameBB[i]+32; }
+            } // for  i
+
+            pos=boxNameBB.find( possibleNameAA );
+            if  (pos>=0)
+            {
+                desc->getView()->setState(SELECTED);
+                id = desc->getModel()->getObjectId();
+                desc->getModel()->notifyObservers( id , ADD_TO_SELECTED );
+            } // if pos
+        } // if type == 1
+    } // for it
+    refresh();
+}
 
 } // EO namespace bbtk
 
index be2519ed5d5487c9525d0e68d656b91aa570a62f..592ace2948c7b52591af508705907aea53cb5dc8 100644 (file)
@@ -251,6 +251,10 @@ namespace bbtk
                void getCleanLine(std::stringstream &inputStream, std::string &line);
         // JGRR & CM
         void printAll( int com, int sta );
+        
+        //EED 2022-10-28
+        void SelectBoxWithPossibleName( std::string possibleName );
+
                std::vector<std::string> boxesDiagram;//CFT
        private:
         std::string                         _cbName;