]> Creatis software - crea.git/blobdiff - lib/creaDevManagerLib/wxCDMMainFrame.cpp
Feature #1711
[crea.git] / lib / creaDevManagerLib / wxCDMMainFrame.cpp
index ec9543bc16057308a599853452ceb08591332017..a5b1315fd05814df8c2c0494190141a88e33cedb 100755 (executable)
@@ -97,6 +97,13 @@ wxCDMMainFrame::wxCDMMainFrame(
     long style
 )
 {
+  this->menu_File = NULL;
+  this->menu_Edit = NULL;
+  this->menu_Tools = NULL;
+  this->menu_Help = NULL;
+  this->panel_Properties = NULL;
+  this->panel_ProjectActions = NULL;
+  this->tree_Projects = NULL;
   Create(parent, id, caption, pos, size, style);
 }
 
@@ -209,7 +216,7 @@ void wxCDMMainFrame::CreateControls()
       ID_TREE_PROJECTS,
       wxDefaultPosition,
       wxSize(200,400),
-      wxTR_HAS_BUTTONS | wxTR_AQUA_BUTTONS
+         wxTR_HAS_BUTTONS | wxTR_AQUA_BUTTONS
   );
 
   panel_Properties = new wxCDMMainDescriptionPanel(
@@ -221,19 +228,10 @@ void wxCDMMainFrame::CreateControls()
       0
   );
 
-
-
-
-
-
-
   auiManager.AddPane(panel_Properties, wxAuiPaneInfo().BestSize(600,400).CenterPane().Name(wxT("panel_Properties")).Caption(wxT("")).CloseButton(false));
   auiManager.AddPane(tree_Projects, wxAuiPaneInfo().Right().MinSize(300,300).BestSize(300,400).CloseButton(false).Name(wxT("tree_Projects")).Caption(wxT("Project Tree")).CloseButton(false));
-
-  wxString pers = auiManager.SavePerspective();
-
   auiManager.Update();
-  auiManager.LoadPerspective(pers,true);
+  //auiManager.LoadPerspective(pers,true);
   wxToolTip::Enable(true);
   wxToolTip::SetDelay(0);
 }
@@ -262,6 +260,7 @@ void wxCDMMainFrame::OnMenuNewProject(wxCommandEvent& event)
             }
         }
 
+
       if(!this->model->CreateProject(
           crea::wx2std(dialog->GetProjectName()),
           crea::wx2std(dialog->GetProjectLocation()),
@@ -438,26 +437,23 @@ void wxCDMMainFrame::OnMenuExit(wxCommandEvent& event)
   if(this->model->GetProject() != NULL && !this->model->CloseProject(result))
     {
       std::cout << "error closing project: " << *result << std::endl;
-      wxMessageBox( crea::std2wx(result->c_str()), wxT("Close Project - Error"), wxICON_ERROR);
     }
   tree_Projects->BuildTree(this->model->GetModelElements(), this->model->GetProject());
-
   if(this->panel_Properties != NULL)
     {
       auiManager.DetachPane(this->panel_Properties);
       this->panel_Properties->Destroy();
       this->panel_Properties = NULL;
     }
-
+  
   if(this->panel_ProjectActions != NULL)
     {
       auiManager.DetachPane(this->panel_ProjectActions);
       this->panel_ProjectActions->Destroy();
       this->panel_ProjectActions = NULL;
     }
-
+  
   Close();
-  event.Skip();
 }
 
 //Edit Menu
@@ -564,8 +560,10 @@ void wxCDMMainFrame::OnTreeSelectionChanged(wxTreeEvent& event)
       std::cout << "Tree Selection id: " << elementId << std::endl;
       //get element from model
       modelCDMIProjectTreeNode* element = this->model->GetModelElements()[elementId];
+         if (element == NULL)
+                 return;
       std::cout << "Tree Selection: " << element->GetName() << std::endl;
-
+               
       //TODO get element type
       //project
       modelCDMProject* elementProject = dynamic_cast<modelCDMProject*>(element);