]> Creatis software - bbtkGEditor.git/blobdiff - lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/bbtkwxGUIEditorGraphicBBS.cxx
2396 bbGEditor Feature New Normal Feature Show Tree 2014-06-18 15:29
[bbtkGEditor.git] / lib / EditorGraphicBBS / bbsWxGUIEditorGraphic / bbtkwxGUIEditorGraphicBBS.cxx
index c764296793200dfb68f9b2edfe258c903cf9121a..c53529c0af34e17f98e8303549d020368382666f 100644 (file)
@@ -141,6 +141,7 @@ void wxGUIEditorGraphicBBS::initToolbar() {
        wxBitmap bmp_undo(undo_xpm);
        wxBitmap bmp_redo(redo_xpm);
        wxBitmap bmp_editProperties(editProperties_xpm);
+       wxBitmap bmp_showTree(showTree_xpm);
        wxToolBar *toolbar = new wxToolBar(this, wxID_ANY);
 
        //Adds a tool btn to the toolbar
@@ -192,6 +193,8 @@ void wxGUIEditorGraphicBBS::initToolbar() {
        toolbar->AddSeparator();
        toolbar->AddTool(ID_EDITPROPERTIES, _T("Edit diagram properties"),bmp_editProperties, wxNullBitmap, wxITEM_NORMAL,      _T("Edit diagram properties"), _T("Edit diagram properties"));
        toolbar->EnableTool(ID_EDITPROPERTIES, false);
+
+       toolbar->AddTool(ID_SHOWTREE, _T("Show tree"),bmp_showTree, wxNullBitmap, wxITEM_NORMAL,        _T("Show tree"), _T("Show tree"));
        
        toolbar->EnableTool(ID_UNDO, false);
        toolbar->EnableTool(ID_REDO, false);
@@ -238,6 +241,7 @@ void wxGUIEditorGraphicBBS::initToolbar() {
        Connect(ID_REDO,wxEVT_COMMAND_TOOL_CLICKED,     wxCommandEventHandler(wxGUIEditorGraphicBBS::OnRedo));
        Connect(ID_CHANGENAME, wxEVT_COMMAND_RIGHT_CLICK, wxCommandEventHandler(wxGUIEditorGraphicBBS::OnChangeName));
        Connect(ID_EDITPROPERTIES,wxEVT_COMMAND_TOOL_CLICKED, wxCommandEventHandler(wxGUIEditorGraphicBBS::OnEditDiagramProperties));
+       Connect(ID_SHOWTREE,wxEVT_COMMAND_TOOL_CLICKED, wxCommandEventHandler(wxGUIEditorGraphicBBS::OnShowTree));
 
 }
 //=========================================================================
@@ -453,6 +457,7 @@ void wxGUIEditorGraphicBBS::displayBlackBoxInfo(std::string packageName, std::st
 {
        if (_actualPkgBrowserPkgName != packageName || _actualPkgBrowserBoxName != boxName) 
        {
+
                _actualPkgBrowserPkgName = packageName;
                _actualPkgBrowserBoxName = boxName;
 
@@ -463,30 +468,24 @@ void wxGUIEditorGraphicBBS::displayBlackBoxInfo(std::string packageName, std::st
                BlackBoxDescriptor::Pointer descriptor;
 
                std::map< std::string, BlackBoxDescriptor::Pointer> mapDesc;
-               k                       = _pkgBrowser->GetFactory()->GetPackage(packageName);
+               k                       = _pkgBrowser->GetFactory()->GetPackage(_actualPkgBrowserPkgName);
                mapDesc         = k->GetDescriptorMap();                
-               descriptor      = mapDesc[boxName];
-               std::vector<std::string> temp;
-               descriptor->GetBoxesInside(tree,temp,1);
-
-
+               descriptor      = mapDesc[_actualPkgBrowserBoxName];
+/*
+               tree.treeTour(0);               
 
-/*CFT
-               for(int i = 0 ; i < temp.size() ; i++){
-                                       std::cout<< "  "<< temp[i] << std::endl;
-               }       
+               tree.deleteTree();
 
+               descriptor->GetBoxesInside(tree, 0);
 
-               if(temp.size()>=1){
-                               std::cout<< "CAJAS # " << (temp.size()- 3) << std::endl;                        
-                               for(int i = 0 ; i < temp.size()-1 ; i++){
-                                       if(i<3){std::cout<< "  "<< temp[i] << std::endl;}
-                                       else{std::cout<< i+1 << "  "<< temp[i] << " " <<temp[i+1] << std::endl;}
-                               }       
-                       }               
-               if (temp.size()==0){
-                               std::cout<< " Not Complex " << std::endl;
-                       }
+               //tree.treeTour(0);
+               //std::vector<std::string> boxesDiagram = _sceneM->boxesDiagram;
+               //for(int i=0;i<boxesDiagram.size();i++){
+               //      std::cout<<"caja: "<<boxesDiagram[i]<<std::endl;
+               //}             
+               
+               _actualPkgBrowserPkgName = "";
+               _actualPkgBrowserBoxName = "";
 */
                /*
                Package::Pointer k;
@@ -627,6 +626,35 @@ void wxGUIEditorGraphicBBS::OnRedo(wxCommandEvent& event) {
 
 void wxGUIEditorGraphicBBS::OnChangeName(wxCommandEvent& event){
 }
+//=========================================================================
+
+void wxGUIEditorGraphicBBS::OnShowTree(wxCommandEvent& event){
+               std::cout <<  "wxGUIEditorGraphicBBS::OnShowTree"<<std::endl;
+if (_actualPkgBrowserPkgName !="" || _actualPkgBrowserBoxName != "") 
+       {
+               Package::Pointer k;
+//EED          ComplexBlackBoxDescriptor::Pointer descriptor;
+               BlackBoxDescriptor::Pointer descriptor;
+
+               std::map< std::string, BlackBoxDescriptor::Pointer> mapDesc;
+               k                       = _pkgBrowser->GetFactory()->GetPackage(_actualPkgBrowserPkgName);
+               mapDesc         = k->GetDescriptorMap();                
+               descriptor      = mapDesc[_actualPkgBrowserBoxName];
+
+               tree.treeTour(0);               
+
+               tree.deleteTree();
+
+               descriptor->GetBoxesInside(tree, 0);
+               
+               _actualPkgBrowserPkgName = "";
+               _actualPkgBrowserBoxName = "";
+       }
+else
+       {
+               std::cout<<"Select a Box"<<std::endl;
+       }
+}
 
 //=========================================================================
 
@@ -1085,6 +1113,7 @@ void wxGUIEditorGraphicBBS::OnOpenDiagram(wxCommandEvent& event)
 //=========================================================================
 void wxGUIEditorGraphicBBS::OnClickBtnBox(wxCommandEvent& event) 
 {
+       std::cout<<"wxGUIEditorGraphicBBS::OnClickBtnBox"<<std::endl;
        BlackBoxDescriptor *bbDes = _pkgBrowser->GetActualSelected();
        if (bbDes != NULL) {
                std::string typeName = bbDes->GetTypeName();
@@ -1121,6 +1150,7 @@ void wxGUIEditorGraphicBBS::OnClickBtnExecutableBox(wxCommandEvent& event)
 //=========================================================================
 void wxGUIEditorGraphicBBS::OnClickBtnComplexBox(wxCommandEvent& event) 
 {
+       std::cout<<"wxGUIEditorGraphicBBS::OnClickBtnComplexBox"<<std::endl;
        wxToolBar* toolbar = GetToolBar();
        bool temp = toolbar->GetToolState(ID_BTNCOMPLEXBOX);
        if (temp) {
@@ -1372,6 +1402,16 @@ void wxGUIEditorGraphicBBS::setCurrentDiagramCategory(std::string category)
        _tabsMgr->SetCategory(category);
 }
 
+//=========================================================================
+void wxGUIEditorGraphicBBS::setCurrentDiagramMessageKind(std::string kind){
+       _tabsMgr->SetMessageKind(kind); 
+}
+
+//=========================================================================
+void wxGUIEditorGraphicBBS::setCurrentDiagramMessageLevel(std::string level){
+       _tabsMgr->SetMessageLevel(level);       
+}
+
 //=========================================================================
 std::string wxGUIEditorGraphicBBS::getCurrentDiagramDescription()
 {
@@ -1390,7 +1430,16 @@ std::string wxGUIEditorGraphicBBS::getCurrentDiagramCategory()
        return _tabsMgr->GetCategory();
 }
 
-       
+//=========================================================================
+std::string wxGUIEditorGraphicBBS::getCurrentDiagramMessageKind(){
+       return _tabsMgr->GetMessageKind();
+}
+
+//=========================================================================
+std::string wxGUIEditorGraphicBBS::getCurrentDiagramMessageLevel(){
+       return _tabsMgr->GetMessageLevel();
+}
+
 //=========================================================================
 bool wxGUIEditorGraphicBBS::isCurrentDiagramComplexBox()
 {