]> Creatis software - crea.git/blobdiff - lib/creaDevManagerLib/wxCDMMainFrame.cpp
Feature #1711
[crea.git] / lib / creaDevManagerLib / wxCDMMainFrame.cpp
index d60b3173dc21433c11ce50cb26bd9f6e56fec003..ad645b9bffed49b1505e2a134fb2f13c0161d243 100755 (executable)
@@ -216,6 +216,7 @@ void wxCDMMainFrame::OnMenuNewProject(wxCommandEvent& event)
 
   if(userResponse == wxID_FORWARD)
     {
+      //create project
       std::string* result;
       if(!this->model->CreateProject(
           crea::wx2std(dialog->GetProjectName()),
@@ -227,13 +228,12 @@ void wxCDMMainFrame::OnMenuNewProject(wxCommandEvent& event)
         {
           wxMessageBox(crea::std2wx(*result),_T("New Project - Error!"),wxOK | wxICON_ERROR);
         }
-      wxMessageBox(_T("New Project created!"),_T("New Project - Success!"), wxOK | wxICON_INFORMATION);
-
-      //TODO: populate model
-      //TODO: populate tree control
 
-      //tree_Projects->BuildTree(this->model->GetActiveProjects());
+      //populate tree control
+      tree_Projects->BuildTree(this->model->GetProject());
       auiManager.Update();
+
+      wxMessageBox(_T("New Project created!"),_T("New Project - Success!"), wxOK | wxICON_INFORMATION);
     }
 
   event.Skip();
@@ -242,24 +242,25 @@ void wxCDMMainFrame::OnMenuOpenProject(wxCommandEvent& event)
 {
   long style = wxDD_DEFAULT_STYLE | wxDD_DIR_MUST_EXIST;
   wxDirDialog* FD = new wxDirDialog(this, wxT("Select the project directory"), wxT(""), style);
-  long userResponse;
-  userResponse = FD->ShowModal();
+  long userResponse = FD->ShowModal();
   if(userResponse == wxID_OK)
     {
-      std::cout << "Selection to open: " << crea::wx2std (FD->GetPath()) << std::endl;
       std::string path = crea::wx2std (FD->GetPath());
+      FD -> Destroy();
+      FD = NULL;
+
+      std::cout << "Selection to open: " << path << std::endl;
 
+
+      //populate model
       std::string* result;
       if (!this->model->OpenProject(path, result))
         {
           wxMessageBox( crea::std2wx(result->c_str()), wxT("Open Project - Error"), wxICON_ERROR);
-          event.Skip();
         };
 
-      //TODO: populate model
-      //TODO: populate tree control
-
-      //((wxCreaDevManagerTreeCtrl*)tree_Projects)->BuildTree(controller->GetActiveProjects());
+      //populate tree control
+      tree_Projects->BuildTree(this->model->GetProject());
       auiManager.Update();
     }