]> Creatis software - crea.git/commitdiff
Feature #1711
authorDaniel Gonzalez <daniel@daniel.laptop>
Tue, 27 Nov 2012 09:53:38 +0000 (10:53 +0100)
committerDaniel Gonzalez <daniel@daniel.laptop>
Tue, 27 Nov 2012 09:53:38 +0000 (10:53 +0100)
CreaDevManager application implementation

Project description panel created

lib/creaDevManagerLib/modelCDMMain.cpp
lib/creaDevManagerLib/wxCDMMainFrame.cpp
lib/creaDevManagerLib/wxCDMMainFrame.h
lib/creaDevManagerLib/wxCDMProjectDescriptionPanel.cpp [new file with mode: 0644]
lib/creaDevManagerLib/wxCDMProjectDescriptionPanel.h [new file with mode: 0644]

index 25331dc7c1d1403dda1ee3cddbf04ad81a348438..b3c381ff12064be15f6dd7a4661a4a4b3c8819f1 100644 (file)
@@ -133,6 +133,11 @@ bool modelCDMMain::CreateProject(
   //std::cout << "executing " << add << std::endl;
   system(add.c_str());
 
+  if(this->project != NULL)
+    {
+      if (!CloseProject(result))
+        return false;
+    }
 
   this->project = new modelCDMProject(nomDirectory);
 
@@ -216,6 +221,12 @@ bool modelCDMMain::OpenProject(
   //if is source folder
   if(isSource)
     {
+      if(this->project != NULL)
+        {
+          if (!CloseProject(result))
+            return false;
+        }
+
       std::cout << "Project sources at: " << pathSource << std::endl;
       if(isBinary)
         {
@@ -240,14 +251,32 @@ bool modelCDMMain::RefreshProject(
     std::string*& result
 )
 {
-  //TODO: recreate the project using the project's path
-  return true;
+  //recreate the project using the project's path
+  if (this->project != NULL)
+    {
+      return this->project->Refresh(result);
+    }
+  else
+    {
+      result = new std::string("There is no open project.");
+      return false;
+    }
 }
 
 bool modelCDMMain::CloseProject(
     std::string*& result
 )
 {
-  //TODO: delete the project tree and leave it as NULL
-  return true;
+  //delete the project tree and leave it as NULL
+  if (this->project != NULL)
+    {
+      delete this->project;
+      this->project = NULL;
+      return true;
+    }
+  else
+    {
+      result = new std::string("There is no open project.");
+      return false;
+    }
 }
index ad645b9bffed49b1505e2a134fb2f13c0161d243..775cfc75938dad5e5ee90cd1a3b63eed99d0cac0 100755 (executable)
@@ -31,6 +31,7 @@
 #include <iostream>
 
 #include <creaWx.h>
+#include "wx/treectrl.h"
 #include "CDMUtilities.h"
 
 #include "creaDevManagerIds.h"
@@ -65,6 +66,7 @@ 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(
@@ -224,13 +226,18 @@ void wxCDMMainFrame::OnMenuNewProject(wxCommandEvent& event)
           result,
           crea::wx2std(dialog->GetPackageAuthor()),
           crea::wx2std(dialog->GetPackageDescription())
-          ))
+      ))
         {
           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());
+      //TODO: change description panel
+      //TODO: change project's actions panel
       auiManager.Update();
 
       wxMessageBox(_T("New Project created!"),_T("New Project - Success!"), wxOK | wxICON_INFORMATION);
@@ -261,6 +268,7 @@ void wxCDMMainFrame::OnMenuOpenProject(wxCommandEvent& event)
 
       //populate tree control
       tree_Projects->BuildTree(this->model->GetProject());
+      tree_Projects->SelectItem(this->model->GetProject()->GetId());
       auiManager.Update();
     }
 
@@ -273,7 +281,11 @@ 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))
+    {
+      wxMessageBox( crea::std2wx(result->c_str()), wxT("Close Project - Error"), wxICON_ERROR);
+    }
   event.Skip();
 }
 void wxCDMMainFrame::OnMenuCloseAllProjects(wxCommandEvent& event)
@@ -296,7 +308,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)
@@ -378,3 +395,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();
+}
index e2505ebb25fb5d08683d51d628e472c5fc3a4c50..ff957d5d3c4d7d9c356bebaa42f747e715446b88 100755 (executable)
@@ -31,6 +31,7 @@
 
 #include <creaWx.h>
 #include <wx/aui/aui.h>
+#include <wx/treectrl.h>
 #include "wxCDMProjectsTreeCtrl.h"
 #include "modelCDMMain.h"
 
@@ -112,6 +113,9 @@ protected:
   void OnMenuReportBug(wxCommandEvent& event);
   void OnMenuAboutCreaDevManager(wxCommandEvent& event);
   void OnMenuAboutCreatis(wxCommandEvent& event);
+
+  //Tree
+  void OnTreeSelectionChanged(wxTreeEvent& event);
 };
 
 #endif
diff --git a/lib/creaDevManagerLib/wxCDMProjectDescriptionPanel.cpp b/lib/creaDevManagerLib/wxCDMProjectDescriptionPanel.cpp
new file mode 100644 (file)
index 0000000..0fadfeb
--- /dev/null
@@ -0,0 +1,66 @@
+/*
+# ---------------------------------------------------------------------
+#
+# Copyright (c) CREATIS (Centre de Recherche en Acquisition et Traitement de l'Image
+#                        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
+#
+#  This software is governed by the CeCILL-B license under French law and
+#  abiding by the rules of distribution of free software. You can  use,
+#  modify and/ or redistribute the software under the terms of the CeCILL-B
+#  license as circulated by CEA, CNRS and INRIA at the following URL
+#  http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
+#  or in the file LICENSE.txt.
+#
+#  As a counterpart to the access to the source code and  rights to copy,
+#  modify and redistribute granted by the license, users are provided only
+#  with a limited warranty  and the software's author,  the holder of the
+#  economic rights,  and the successive licensors  have only  limited
+#  liability.
+#
+#  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.
+# ------------------------------------------------------------------------
+*/
+
+/*
+ * wxCDMProjectDescriptionPanel.cpp
+ *
+ *  Created on: Nov 27, 2012
+ *      Author: Daniel Felipe Gonzalez Obando
+ */
+
+#include "wxCDMProjectDescriptionPanel.h"
+
+wxCDMProjectDescriptionPanel::wxCDMProjectDescriptionPanel(
+    wxWindow* parent,
+    wxWindowID id,
+    const wxString&
+    caption,
+    const wxPoint& pos,
+    const wxSize& size,
+    long style
+)
+{
+}
+
+wxCDMProjectDescriptionPanel::~wxCDMProjectDescriptionPanel()
+{
+}
+
+bool wxCDMProjectDescriptionPanel::Create(
+    wxWindow* parent,
+    wxWindowID id,
+    const wxString& caption,
+    const wxPoint& pos,
+    const wxSize& size,
+    long style
+)
+{
+}
+
+void wxCDMProjectDescriptionPanel::CreateControls()
+{
+}
diff --git a/lib/creaDevManagerLib/wxCDMProjectDescriptionPanel.h b/lib/creaDevManagerLib/wxCDMProjectDescriptionPanel.h
new file mode 100644 (file)
index 0000000..e91dca0
--- /dev/null
@@ -0,0 +1,70 @@
+/*
+# ---------------------------------------------------------------------
+#
+# Copyright (c) CREATIS (Centre de Recherche en Acquisition et Traitement de l'Image
+#                        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
+#
+#  This software is governed by the CeCILL-B license under French law and
+#  abiding by the rules of distribution of free software. You can  use,
+#  modify and/ or redistribute the software under the terms of the CeCILL-B
+#  license as circulated by CEA, CNRS and INRIA at the following URL
+#  http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
+#  or in the file LICENSE.txt.
+#
+#  As a counterpart to the access to the source code and  rights to copy,
+#  modify and redistribute granted by the license, users are provided only
+#  with a limited warranty  and the software's author,  the holder of the
+#  economic rights,  and the successive licensors  have only  limited
+#  liability.
+#
+#  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.
+# ------------------------------------------------------------------------
+ */
+
+/*
+ * wxCDMProjectDescriptionPanel.h
+ *
+ *  Created on: Nov 27, 2012
+ *      Author: Daniel Felipe Gonzalez Obando
+ */
+
+#ifndef WXCDMPROJECTDESCRIPTIONPANEL_H_
+#define WXCDMPROJECTDESCRIPTIONPANEL_H_
+
+#include <creaWx.h>
+#include <wx/panel.h>
+
+class wxCDMProjectDescriptionPanel : public wxPanel
+{
+public:
+  wxCDMProjectDescriptionPanel(
+      wxWindow* parent,
+      wxWindowID id = -1,
+      const wxString& caption = _("Description Frame"),
+      const wxPoint& pos = wxDefaultPosition,
+      const wxSize& size = wxDefaultSize,
+      long style = wxDEFAULT_FRAME_STYLE
+  );
+
+  ~wxCDMProjectDescriptionPanel();
+
+  bool Create(
+      wxWindow* parent,
+      wxWindowID id = -1,
+      const wxString& caption = _("Description Frame"),
+      const wxPoint& pos = wxDefaultPosition,
+      const wxSize& size = wxDefaultSize,
+      long style = wxDEFAULT_FRAME_STYLE
+  );
+
+  void CreateControls();
+
+  //handlers
+protected:
+};
+
+#endif /* WXCDMPROJECTDESCRIPTIONPANEL_H_ */