]> Creatis software - crea.git/blobdiff - lib/creaDevManagerLib/wxCDMMainFrame.cpp
Feature #1711
[crea.git] / lib / creaDevManagerLib / wxCDMMainFrame.cpp
index 8cc4e785ecd029ae60195d10666b2a42c350b673..28d9a5d0e7860f3fe791adb9669577a4394a17eb 100755 (executable)
@@ -2,7 +2,7 @@
 # ---------------------------------------------------------------------
 #
 # Copyright (c) CREATIS (Centre de Recherche en Acquisition et Traitement de l'Image 
-#                        pour la Santé)
+#                        pour la Sant)
 # Authors : Eduardo Davila, Frederic Cervenansky, Claire Mouton
 # Previous Authors : Laurent Guigues, Jean-Pierre Roux
 # CreaTools website : www.creatis.insa-lyon.fr/site/fr/creatools_accueil
 #  The fact that you are presently reading this means that you have had
 #  knowledge of the CeCILL-B license and that you accept its terms.
 # ------------------------------------------------------------------------ 
-*/ 
+ */
 
 
 #include "wxCDMMainFrame.h"
 
+#include <iostream>
+
+#include <creaWx.h>
+#include "wx/treectrl.h"
+#include "CDMUtilities.h"
+
 #include "creaDevManagerIds.h"
 #include "wxCDMMainDescriptionPanel.h"
+#include "wxCDMProjectDescriptionPanel.h"
 #include "wxCDMProjectActionsPanel.h"
 #include "wxCDMNewProjectDialog.h"
 
 
-#include <iostream>
-
-
-
 BEGIN_EVENT_TABLE(wxCDMMainFrame, wxFrame)
-  EVT_MENU(ID_MENU_NEW_PROJECT, wxCDMMainFrame::OnMenuNewProject)
-  EVT_MENU(ID_MENU_OPEN_PROJECT, wxCDMMainFrame::OnMenuOpenProject)
-  EVT_MENU(ID_MENU_OPEN_RECENT, wxCDMMainFrame::OnMenuOpenRecent)
-  EVT_MENU(ID_MENU_CLOSE_PROJECT, wxCDMMainFrame::OnMenuCloseProject)
-  EVT_MENU(ID_MENU_CLOSE_ALL_PROJECTS, wxCDMMainFrame::OnMenuCloseAllProjects)
-  EVT_MENU(ID_MENU_EXPORT_HIERARCHY, wxCDMMainFrame::OnMenuExportHierarchy)
-  EVT_MENU(ID_MENU_EXIT, wxCDMMainFrame::OnMenuExit)
-  EVT_MENU(ID_MENU_REFRESH_PROJECT, wxCDMMainFrame::OnMenuRefreshProject)
-  EVT_MENU(ID_MENU_CUT, wxCDMMainFrame::OnMenuMenuCut)
-  EVT_MENU(ID_MENU_COPY, wxCDMMainFrame::OnMenuMenuCopy)
-  EVT_MENU(ID_MENU_PASTE, wxCDMMainFrame::OnMenuMenuPaste)
-  EVT_MENU(ID_MENU_DELETE, wxCDMMainFrame::OnMenuMenuDelete)
-  EVT_MENU(ID_MENU_SELECT_ALL, wxCDMMainFrame::OnMenuSelectAll)
-  EVT_MENU(ID_MENU_SELECT_NONE, wxCDMMainFrame::OnMenuSelectNone)
-  EVT_MENU(ID_MENU_EVENT_LOG, wxCDMMainFrame::OnMenuEventLog)
-  EVT_MENU(ID_MENU_BBTK_GRAPHICAL_EDITOR, wxCDMMainFrame::OnMenuBBTKGraphicalEditor)
-  EVT_MENU(ID_MENU_MINITOOLS, wxCDMMainFrame::OnMenuMiniTools)
-  EVT_MENU(ID_MENU_CODE_EDITOR, wxCDMMainFrame::OnMenuCodeEditor)
-  EVT_MENU(ID_MENU_COMMAND_LINE, wxCDMMainFrame::OnMenuCommandLine)
-  EVT_MENU(ID_MENU_HELP, wxCDMMainFrame::OnMenuHelp)
-  EVT_MENU(ID_MENU_REPORT_BUG, wxCDMMainFrame::OnMenuReportBug)
-  EVT_MENU(ID_MENU_ABOUT_CREADEVMANAGER, wxCDMMainFrame::OnMenuAboutCreaDevManager)
-  EVT_MENU(ID_MENU_ABOUT_CREATIS, wxCDMMainFrame::OnMenuAboutCreatis)
-  EVT_BUTTON(ID_BUTTON_NEWPROJECT, wxCDMMainFrame::OnMenuNewProject)
-  EVT_BUTTON(ID_BUTTON_OPENPROJECT, wxCDMMainFrame::OnMenuOpenProject)
+EVT_MENU(ID_MENU_NEW_PROJECT, wxCDMMainFrame::OnMenuNewProject)
+EVT_MENU(ID_MENU_OPEN_PROJECT, wxCDMMainFrame::OnMenuOpenProject)
+EVT_MENU(ID_MENU_OPEN_RECENT, wxCDMMainFrame::OnMenuOpenRecent)
+EVT_MENU(ID_MENU_CLOSE_PROJECT, wxCDMMainFrame::OnMenuCloseProject)
+EVT_MENU(ID_MENU_CLOSE_ALL_PROJECTS, wxCDMMainFrame::OnMenuCloseAllProjects)
+EVT_MENU(ID_MENU_EXPORT_HIERARCHY, wxCDMMainFrame::OnMenuExportHierarchy)
+EVT_MENU(ID_MENU_EXIT, wxCDMMainFrame::OnMenuExit)
+EVT_MENU(ID_MENU_REFRESH_PROJECT, wxCDMMainFrame::OnMenuRefreshProject)
+EVT_MENU(ID_MENU_CUT, wxCDMMainFrame::OnMenuMenuCut)
+EVT_MENU(ID_MENU_COPY, wxCDMMainFrame::OnMenuMenuCopy)
+EVT_MENU(ID_MENU_PASTE, wxCDMMainFrame::OnMenuMenuPaste)
+EVT_MENU(ID_MENU_DELETE, wxCDMMainFrame::OnMenuMenuDelete)
+EVT_MENU(ID_MENU_SELECT_ALL, wxCDMMainFrame::OnMenuSelectAll)
+EVT_MENU(ID_MENU_SELECT_NONE, wxCDMMainFrame::OnMenuSelectNone)
+EVT_MENU(ID_MENU_EVENT_LOG, wxCDMMainFrame::OnMenuEventLog)
+EVT_MENU(ID_MENU_BBTK_GRAPHICAL_EDITOR, wxCDMMainFrame::OnMenuBBTKGraphicalEditor)
+EVT_MENU(ID_MENU_MINITOOLS, wxCDMMainFrame::OnMenuMiniTools)
+EVT_MENU(ID_MENU_CODE_EDITOR, wxCDMMainFrame::OnMenuCodeEditor)
+EVT_MENU(ID_MENU_COMMAND_LINE, wxCDMMainFrame::OnMenuCommandLine)
+EVT_MENU(ID_MENU_HELP, wxCDMMainFrame::OnMenuHelp)
+EVT_MENU(ID_MENU_REPORT_BUG, wxCDMMainFrame::OnMenuReportBug)
+EVT_MENU(ID_MENU_ABOUT_CREADEVMANAGER, wxCDMMainFrame::OnMenuAboutCreaDevManager)
+EVT_MENU(ID_MENU_ABOUT_CREATIS, wxCDMMainFrame::OnMenuAboutCreatis)
+EVT_BUTTON(ID_BUTTON_NEWPROJECT, wxCDMMainFrame::OnMenuNewProject)
+EVT_BUTTON(ID_BUTTON_OPENPROJECT, wxCDMMainFrame::OnMenuOpenProject)
+EVT_TREE_SEL_CHANGED(ID_TREE_PROJECTS, wxCDMMainFrame::OnTreeSelectionChanged)
 END_EVENT_TABLE()
 
 wxCDMMainFrame::wxCDMMainFrame(
-  wxWindow* parent,
-  wxWindowID id,
-  const wxString& caption,
-  const wxPoint& pos,
-  const wxSize& size,
-  long style
+    wxWindow* parent,
+    wxWindowID id,
+    const wxString& caption,
+    const wxPoint& pos,
+    const wxSize& size,
+    long style
 )
 {
   Create(parent, id, caption, pos, size, style);
@@ -84,12 +88,12 @@ wxCDMMainFrame::~wxCDMMainFrame()
 }
 
 bool wxCDMMainFrame::Create(
-  wxWindow* parent,
-  wxWindowID id,
-  const wxString& caption,
-  const wxPoint& pos,
-  const wxSize& size,
-  long style
+    wxWindow* parent,
+    wxWindowID id,
+    const wxString& caption,
+    const wxPoint& pos,
+    const wxSize& size,
+    long style
 )
 {
   wxFrame::Create(parent, id, caption, pos, size, style);
@@ -105,51 +109,51 @@ void wxCDMMainFrame::CreateMenus()
 
   //FileMenu
   menu_File = new wxMenu();
-  menu_File->Append(ID_MENU_NEW_PROJECT, wxString("&New Project..."));
-  menu_File->Append(ID_MENU_OPEN_PROJECT, wxString("&Open Project..."));
-  menu_File->Append(ID_MENU_OPEN_RECENT, wxString("Open &Recent"));
+  menu_File->Append(ID_MENU_NEW_PROJECT, wxT("&New Project..."));
+  menu_File->Append(ID_MENU_OPEN_PROJECT, wxT("&Open Project..."));
+  menu_File->Append(ID_MENU_OPEN_RECENT, wxT("Open &Recent"));
   menu_File->AppendSeparator();
-  menu_File->Append(ID_MENU_CLOSE_PROJECT, wxString("&Close Project"));
-  menu_File->Append(ID_MENU_CLOSE_ALL_PROJECTS, wxString("C&lose All Projects"));
+  menu_File->Append(ID_MENU_CLOSE_PROJECT, wxT("&Close Project"));
+  menu_File->Append(ID_MENU_CLOSE_ALL_PROJECTS, wxT("C&lose All Projects"));
   menu_File->AppendSeparator();
-  menu_File->Append(ID_MENU_EXPORT_HIERARCHY, wxString("&Export Project Hierarchy..."));
+  menu_File->Append(ID_MENU_EXPORT_HIERARCHY, wxT("&Export Project Hierarchy..."));
   menu_File->AppendSeparator();
-  menu_File->Append(ID_MENU_EXIT, wxString("E&xit"));
+  menu_File->Append(ID_MENU_EXIT, wxT("E&xit"));
 
-  menuBar->Append(menu_File, wxString("&File"));
+  menuBar->Append(menu_File, wxT("&File"));
 
   //EditMenu
   menu_Edit = new wxMenu();
-  menu_Edit->Append(ID_MENU_REFRESH_PROJECT, wxString("&Refresh Project"));
+  menu_Edit->Append(ID_MENU_REFRESH_PROJECT, wxT("&Refresh Project"));
   menu_Edit->AppendSeparator();
-  menu_Edit->Append(ID_MENU_CUT, wxString("Cu&t"));
-  menu_Edit->Append(ID_MENU_COPY, wxString("&Copy"));
-  menu_Edit->Append(ID_MENU_PASTE, wxString("&Paste"));
+  menu_Edit->Append(ID_MENU_CUT, wxT("Cu&t"));
+  menu_Edit->Append(ID_MENU_COPY, wxT("&Copy"));
+  menu_Edit->Append(ID_MENU_PASTE, wxT("&Paste"));
   menu_Edit->AppendSeparator();
-  menu_Edit->Append(ID_MENU_DELETE, wxString("&Delete"));
-  menu_Edit->Append(ID_MENU_SELECT_ALL, wxString("Select &All"));
-  menu_Edit->Append(ID_MENU_SELECT_NONE, wxString("Ca&ncel Selection"));
+  menu_Edit->Append(ID_MENU_DELETE, wxT("&Delete"));
+  menu_Edit->Append(ID_MENU_SELECT_ALL, wxT("Select &All"));
+  menu_Edit->Append(ID_MENU_SELECT_NONE, wxT("Ca&ncel Selection"));
 
-  menuBar->Append(menu_Edit, wxString("&Edit"));
+  menuBar->Append(menu_Edit, wxT("&Edit"));
 
   //ToolsMenu
   menu_Tools = new wxMenu();
-  menu_Tools->Append(ID_MENU_EVENT_LOG, wxString("Event &Log"));
-  menu_Tools->Append(ID_MENU_BBTK_GRAPHICAL_EDITOR, wxString("BBTK &Graphical Editor"));
-  menu_Tools->Append(ID_MENU_MINITOOLS, wxString("&MiniTools"));
-  menu_Tools->Append(ID_MENU_CODE_EDITOR, wxString("&Code Editor"));
-  menu_Tools->Append(ID_MENU_COMMAND_LINE, wxString("&Command Line"));
+  menu_Tools->Append(ID_MENU_EVENT_LOG, wxT("Event &Log"));
+  menu_Tools->Append(ID_MENU_BBTK_GRAPHICAL_EDITOR, wxT("BBTK &Graphical Editor"));
+  menu_Tools->Append(ID_MENU_MINITOOLS, wxT("&MiniTools"));
+  menu_Tools->Append(ID_MENU_CODE_EDITOR, wxT("&Code Editor"));
+  menu_Tools->Append(ID_MENU_COMMAND_LINE, wxT("&Command Line"));
 
-  menuBar->Append(menu_Tools, wxString("&Tools"));
+  menuBar->Append(menu_Tools, wxT("&Tools"));
 
   //HelpMenu
   menu_Help = new wxMenu();
-  menu_Help->Append(ID_MENU_HELP, wxString("&Help"));
-  menu_Help->Append(ID_MENU_REPORT_BUG, wxString("Report &Bug"));
-  menu_Help->Append(ID_MENU_ABOUT_CREADEVMANAGER, wxString("&About CreaDevManager"));
-  menu_Help->Append(ID_MENU_ABOUT_CREATIS, wxString("A&bout CREATIS"));
+  menu_Help->Append(ID_MENU_HELP, wxT("&Help"));
+  menu_Help->Append(ID_MENU_REPORT_BUG, wxT("Report &Bug"));
+  menu_Help->Append(ID_MENU_ABOUT_CREADEVMANAGER, wxT("&About CreaDevManager"));
+  menu_Help->Append(ID_MENU_ABOUT_CREATIS, wxT("A&bout CREATIS"));
 
-  menuBar->Append(menu_Help, wxString("&Help"));
+  menuBar->Append(menu_Help, wxT("&Help"));
 
   //Set Bar
   SetMenuBar(menuBar);
@@ -167,89 +171,203 @@ void wxCDMMainFrame::CreateControls()
 
 
   tree_Projects = new wxCDMProjectsTreeCtrl(
-    this,
-    ID_TREE_PROJECTS,
-    wxDefaultPosition,
-    wxSize(300,400),
-    wxTR_HAS_BUTTONS | wxTR_AQUA_BUTTONS
+      this,
+      ID_TREE_PROJECTS,
+      wxDefaultPosition,
+      wxSize(300,400),
+      wxTR_HAS_BUTTONS | wxTR_AQUA_BUTTONS
   );
   tree_Projects->SetMinSize(wxSize(200,200));
 
   panel_Properties = new wxCDMMainDescriptionPanel(
-    this,
-    ID_WINDOW_PROPERTIES,
-    wxString("Description Panel"),
-    wxDefaultPosition,
-    wxSize(300, 400),
-    0
+      this,
+      ID_WINDOW_PROPERTIES,
+      wxT("Description Panel"),
+      wxDefaultPosition,
+      wxSize(300, 400),
+      0
   );
 
 
 
-  panel_ProjectActions = new wxCDMProjectActionsPanel(
-    this,
-    ID_WINDOW_PROJ_ACTIONS,
-    wxString("Project Actions Panel"),
-    wxDefaultPosition,
-    wxSize(600,200),
-    0
-  );
-  panel_ProjectActions->SetMinSize(wxSize(500, 100));
 
-  auiManager.AddPane(tree_Projects, wxLEFT, wxString("Projects Tree"));
-  auiManager.AddPane(panel_ProjectActions, wxBOTTOM, wxString("Project Actions"));
-  auiManager.AddPane(panel_Properties, wxCENTER, wxString("Properties"));
+
+  auiManager.AddPane(tree_Projects, wxLEFT, wxT("Projects Tree"));
+  auiManager.AddPane(panel_Properties, wxCENTER, wxT("Properties"));
 
   auiManager.Update();
   auiManager.GetPane(tree_Projects).CloseButton(false).MaximizeButton(true);
-  auiManager.GetPane(panel_Properties).CloseButton(false);
 }
 
 //Event Handlers
 //File menu
 void wxCDMMainFrame::OnMenuNewProject(wxCommandEvent& event)
 {
+  std::string* result;
+
   wxCDMNewProjectDialog* dialog = new wxCDMNewProjectDialog(this);
   long userResponse;
   userResponse = dialog->ShowModal();
 
   if(userResponse == wxID_FORWARD)
-  {
-    //TODO createProject
-    std::cerr << "should create Project here" << std::endl;
-    //tree_Projects->BuildTree(this->model->GetActiveProjects());
-  }
+    {
+      //create project
+      if(this->model->GetProject() != NULL)
+        {
+          if(!this->model->CloseProject(result))
+            {
+              std::cout << "error closing project: " << *result << std::endl;
+              wxMessageBox(crea::std2wx(*result),_T("New Project - Error!"),wxOK | wxICON_ERROR);
+              event.Skip();
+              return;
+            }
+        }
+
+      if(!this->model->CreateProject(
+          crea::wx2std(dialog->GetProjectName()),
+          crea::wx2std(dialog->GetProjectLocation()),
+          result,
+          crea::wx2std(dialog->GetPackageAuthor()),
+          crea::wx2std(dialog->GetPackageDescription())
+      ))
+        {
+          std::cout << "error opening project: " << *result << std::endl;
+          wxMessageBox(crea::std2wx(*result),_T("New Project - Error!"),wxOK | wxICON_ERROR);
+          event.Skip();
+          return;
+        }
+
+      //populate tree control
+      tree_Projects->BuildTree(this->model->GetProject());
+      tree_Projects->SelectItem(this->model->GetProject()->GetId());
+
+      //change description panel
+      if(this->panel_Properties != NULL)
+        {
+          auiManager.DetachPane(this->panel_Properties);
+          this->panel_Properties->Destroy();
+        }
+
+      this->panel_Properties = new wxCDMProjectDescriptionPanel(
+          this,
+          this->model->GetProject(),
+          ID_WINDOW_PROPERTIES,
+          wxT("Description Panel"),
+          wxDefaultPosition,
+          wxSize(300, 400),
+          0);
+      //show projectactions panel
+      if(this->panel_ProjectActions != NULL)
+        {
+          auiManager.DetachPane(this->panel_Properties);
+          this->panel_ProjectActions->Destroy();
+        }
+
+      panel_ProjectActions = new wxCDMProjectActionsPanel(
+          this,
+          ID_WINDOW_PROJ_ACTIONS,
+          wxT("Project Actions Panel"),
+          wxDefaultPosition,
+          wxSize(600,200),
+          0
+      );
+      panel_ProjectActions->SetMinSize(wxSize(500, 100));
+
+
+      auiManager.AddPane(panel_Properties, wxCENTER, wxT("Properties"));
+      auiManager.AddPane(panel_ProjectActions, wxBOTTOM, wxT("Project Actions"));
+
+      auiManager.Update();
+
+      wxMessageBox(_T("New Project created!"),_T("New Project - Success!"), wxOK | wxICON_INFORMATION);
+    }
 
   event.Skip();
 }
 void wxCDMMainFrame::OnMenuOpenProject(wxCommandEvent& event)
 {
-  /*
+  std::string* result;
+
   long style = wxDD_DEFAULT_STYLE | wxDD_DIR_MUST_EXIST;
-  wxDirDialog* FD = new wxDirDialog(this, wxString("Select the project directory"), wxString(""), style);
-  long userResponse;
-  userResponse = FD->ShowModal();
+  wxDirDialog* FD = new wxDirDialog(this, wxT("Select the project directory"), wxT(""), style);
+  long userResponse = FD->ShowModal();
   if(userResponse == wxID_OK)
-  {
-    switch(this->controller->OpenProject(crea::wx2std (FD->GetPath())))
     {
-    case 1:
-      wxMessageBox( wxT("No project selected."), wxT("Open Project - Error"), wxICON_ERROR);
-      event.Skip();
-      break;
-    case 2:
-      wxMessageBox( wxString("Sources not found."), wxString("Open Project - Error"), wxICON_ERROR);
-      event.Skip();
-      break;
-    case 0:
-      break;
-    };
-
-    ((wxCreaDevManagerTreeCtrl*)tree_Projects)->BuildTree(controller->GetActiveProjects());
-
-    auiManager.Update();
-  }
-  */
+      std::string path = crea::wx2std (FD->GetPath());
+      FD -> Destroy();
+      FD = NULL;
+
+      std::cout << "Selection to open: " << path << std::endl;
+
+
+      //populate model
+      if(this->model->GetProject() != NULL)
+        {
+          std::cout << "Project not null, closing it" << std::endl;
+          if(!this->model->CloseProject(result))
+            {
+              std::cout << "error closing project: " << *result << std::endl;
+              wxMessageBox(crea::std2wx(result->c_str()),_T("New Project - Error!"),wxOK | wxICON_ERROR);
+              event.Skip();
+              return;
+            }
+        }
+
+      if (!this->model->OpenProject(path, result))
+        {
+          std::cout << "error opening project: " << *result << std::endl;
+          wxMessageBox( crea::std2wx(result->c_str()), wxT("Open Project - Error"), wxICON_ERROR);
+          event.Skip();
+          return;
+        };
+
+      std::cout << "building ui" << std::endl;
+
+
+      //populate tree control
+      tree_Projects->BuildTree(this->model->GetProject());
+      tree_Projects->SelectItem(this->model->GetProject()->GetId());
+
+      //change description panel
+      if(this->panel_Properties != NULL)
+        {
+          auiManager.DetachPane(this->panel_Properties);
+          this->panel_Properties->Destroy();
+        }
+
+      this->panel_Properties = new wxCDMProjectDescriptionPanel(
+          this,
+          this->model->GetProject(),
+          ID_WINDOW_PROPERTIES,
+          wxT("Description Panel"),
+          wxDefaultPosition,
+          wxSize(300, 400),
+          0
+      );
+
+      //change project's actions panel
+      if(this->panel_ProjectActions!= NULL)
+        {
+          auiManager.DetachPane(this->panel_ProjectActions);
+          this->panel_ProjectActions->Destroy();
+        }
+      panel_ProjectActions = new wxCDMProjectActionsPanel(
+          this,
+          ID_WINDOW_PROJ_ACTIONS,
+          wxT("Project Actions Panel"),
+          wxDefaultPosition,
+          wxSize(600,200),
+          0
+      );
+      panel_ProjectActions->SetMinSize(wxSize(500, 100));
+
+
+      auiManager.AddPane(panel_Properties, wxCENTER, wxT("Properties"));
+      auiManager.AddPane(panel_ProjectActions, wxBOTTOM, wxT("Project Actions"));
+
+      auiManager.Update();
+    }
+
   event.Skip();
 }
 void wxCDMMainFrame::OnMenuOpenRecent(wxCommandEvent& event)
@@ -259,7 +377,37 @@ void wxCDMMainFrame::OnMenuOpenRecent(wxCommandEvent& event)
 }
 void wxCDMMainFrame::OnMenuCloseProject(wxCommandEvent& event)
 {
-  std::cerr << "Event OnMenuCloseProject not implemented" << std::endl;
+  std::string* result;
+  if(!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->GetProject());
+
+  if(this->panel_Properties != NULL)
+    {
+      auiManager.DetachPane(this->panel_Properties);
+      this->panel_Properties->Destroy();
+    }
+  if(this->panel_ProjectActions != NULL)
+    {
+      auiManager.DetachPane(this->panel_ProjectActions);
+      this->panel_ProjectActions->Destroy();
+    }
+
+  this->panel_Properties = new wxCDMMainDescriptionPanel(
+      this,
+      ID_WINDOW_PROPERTIES,
+      wxT("Description Panel"),
+      wxDefaultPosition,
+      wxSize(300, 400),
+      0
+  );
+
+  auiManager.AddPane(panel_Properties, wxCENTER, wxT("Properties"));
+
+  auiManager.Update();
   event.Skip();
 }
 void wxCDMMainFrame::OnMenuCloseAllProjects(wxCommandEvent& event)
@@ -282,7 +430,12 @@ void wxCDMMainFrame::OnMenuExit(wxCommandEvent& event)
 //Edit Menu
 void wxCDMMainFrame::OnMenuRefreshProject(wxCommandEvent& event)
 {
-  std::cerr << "Event OnMenuRefreshProject not implemented" << std::endl;
+  std::string* result;
+  if(!model->RefreshProject(result))
+    {
+      wxMessageBox( crea::std2wx(result->c_str()), wxT("Refresh Project - Error"), wxICON_ERROR);
+    }
+  //TODO: Show possible problems in CMakeLists files
   event.Skip();
 }
 void wxCDMMainFrame::OnMenuMenuCut(wxCommandEvent& event)
@@ -364,3 +517,9 @@ void wxCDMMainFrame::OnMenuAboutCreatis(wxCommandEvent& event)
   std::cerr << "Event OnMenuAboutCreatis not implemented" << std::endl;
   event.Skip();
 }
+
+void wxCDMMainFrame::OnTreeSelectionChanged(wxTreeEvent& event)
+{
+  std::cerr << "Event OnTreeSelectionChange not implemented" << std::endl;
+  event.Skip();
+}