From da7e6972b6adbe688c541a49a6db2038767e0cc7 Mon Sep 17 00:00:00 2001 From: Eduardo DAVILA Date: Wed, 23 Nov 2022 09:19:04 +0100 Subject: [PATCH] #3253 Select manual of boxes --- .../bbsKernelEditorGraphic/GlobalConstants.h | 5 ++ .../bbtkwxGUIEditorGraphicBBS.cxx | 16 ++++-- .../bbtkwxGUIEditorGraphicBBS.h | 5 +- .../wxGEditorTabPanel.cxx | 7 +++ .../bbsWxGUIEditorGraphic/wxGEditorTabPanel.h | 2 + .../wxTabPanelsManager.cxx | 9 +++- .../wxTabPanelsManager.h | 3 +- .../wxVtkSceneManager.cxx | 49 +++++++++++++++++-- .../bbsWxGUIEditorGraphic/wxVtkSceneManager.h | 4 ++ 9 files changed, 87 insertions(+), 13 deletions(-) diff --git a/lib/EditorGraphicBBS/bbsKernelEditorGraphic/GlobalConstants.h b/lib/EditorGraphicBBS/bbsKernelEditorGraphic/GlobalConstants.h index 4d03701..42228af 100644 --- a/lib/EditorGraphicBBS/bbsKernelEditorGraphic/GlobalConstants.h +++ b/lib/EditorGraphicBBS/bbsKernelEditorGraphic/GlobalConstants.h @@ -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 diff --git a/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/bbtkwxGUIEditorGraphicBBS.cxx b/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/bbtkwxGUIEditorGraphicBBS.cxx index be12513..ed9d80c 100644 --- a/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/bbtkwxGUIEditorGraphicBBS.cxx +++ b/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/bbtkwxGUIEditorGraphicBBS.cxx @@ -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) diff --git a/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/bbtkwxGUIEditorGraphicBBS.h b/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/bbtkwxGUIEditorGraphicBBS.h index 78a3f31..d864b40 100644 --- a/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/bbtkwxGUIEditorGraphicBBS.h +++ b/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/bbtkwxGUIEditorGraphicBBS.h @@ -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: diff --git a/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxGEditorTabPanel.cxx b/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxGEditorTabPanel.cxx index 34125b6..6c5dfe5 100644 --- a/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxGEditorTabPanel.cxx +++ b/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxGEditorTabPanel.cxx @@ -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 ); + } + diff --git a/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxGEditorTabPanel.h b/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxGEditorTabPanel.h index d687638..4519b55 100644 --- a/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxGEditorTabPanel.h +++ b/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxGEditorTabPanel.h @@ -196,6 +196,8 @@ namespace bbtk std::string GetMessageKind(); std::string GetMessageLevel(); + bool SelectBoxWithPossibleName(std::string nameFilter ); + //========================================================================= private: diff --git a/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxTabPanelsManager.cxx b/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxTabPanelsManager.cxx index 351551e..ec69b81 100644 --- a/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxTabPanelsManager.cxx +++ b/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxTabPanelsManager.cxx @@ -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 diff --git a/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxTabPanelsManager.h b/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxTabPanelsManager.h index 5e4428d..add5745 100644 --- a/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxTabPanelsManager.h +++ b/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxTabPanelsManager.h @@ -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 diff --git a/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxVtkSceneManager.cxx b/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxVtkSceneManager.cxx index 1d8dc29..f1a057f 100644 --- a/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxVtkSceneManager.cxx +++ b/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxVtkSceneManager.cxx @@ -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::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='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='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 diff --git a/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxVtkSceneManager.h b/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxVtkSceneManager.h index be2519e..592ace2 100644 --- a/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxVtkSceneManager.h +++ b/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxVtkSceneManager.h @@ -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 boxesDiagram;//CFT private: std::string _cbName; -- 2.47.1