]> Creatis software - crea.git/blobdiff - lib/creaDevManagerLib/wxCDMProjectActionsPanel.cpp
Feature #1711
[crea.git] / lib / creaDevManagerLib / wxCDMProjectActionsPanel.cpp
index 67e449727dffc407dd7e0df0b00a572c06359ee7..5c92a7965377ae8960c00136bece7cd22cb0aebb 100755 (executable)
@@ -1,16 +1,49 @@
+/*
+# ---------------------------------------------------------------------
+#
+# Copyright (c) CREATIS (Centre de Recherche en Acquisition et Traitement de l'Image 
+#                        pour la Sant�)
+# # Authors : Eduardo Davila, Frederic Cervenansky, Claire Mouton
+#
+#  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.
+# ------------------------------------------------------------------------ 
+ */
+
+
 /*
  * wxCDMProjectActionsPanel.cpp
  *
  *  Created on: 25/10/2012
- *      Author: daniel
+ *      Author: Daniel Felipe Gonzalez Obando
  */
 
 #include "wxCDMProjectActionsPanel.h"
 
+#include "creaDevManagerIds.h"
 
+BEGIN_EVENT_TABLE(wxCDMProjectActionsPanel, wxPanel)
+EVT_BUTTON(ID_BUTTON_BUILD_PROJECT, wxCDMProjectActionsPanel::OnBtnBuildProject)
+EVT_BUTTON(ID_BUTTON_CONFIGURE_BUILD, wxCDMProjectActionsPanel::OnBtnConfigureBuild)
+EVT_BUTTON(ID_BUTTON_CONNECT_PROJECT, wxCDMProjectActionsPanel::OnBtnConnectProject)
+END_EVENT_TABLE()
 
 wxCDMProjectActionsPanel::wxCDMProjectActionsPanel(
     wxWindow* parent,
+    modelCDMProject* project,
     wxWindowID id,
     const wxString& caption,
     const wxPoint& pos,
@@ -19,6 +52,7 @@ wxCDMProjectActionsPanel::wxCDMProjectActionsPanel(
 )
 {
   wxCDMProjectActionsPanel::Create(parent,id,caption,pos,size,style);
+  this->project = project;
 }
 
 wxCDMProjectActionsPanel::~wxCDMProjectActionsPanel()
@@ -45,8 +79,49 @@ bool wxCDMProjectActionsPanel::Create(
 
 void wxCDMProjectActionsPanel::CreateControls()
 {
-  this->GetSizer()->Add(new wxButton(this, -1, _T("Action 1")), 0, wxALL, 5);
-  this->GetSizer()->Add(new wxButton(this, -1, _T("Action 2")), 0, wxALL, 5);
-  this->GetSizer()->Add(new wxButton(this, -1, _T("Action 3")), 0, wxALL, 5);
-  this->GetSizer()->Add(new wxButton(this, -1, _T("Action 4")), 0, wxALL, 5);
+  wxButton* configurebt = new wxButton(this, ID_BUTTON_CONFIGURE_BUILD, _T("1. Configure Project"));
+  configurebt->SetToolTip(wxT("This is the first step in order to execute the project. Make sure you have selected the desired Build location."));
+  wxButton* compilebt = new wxButton(this, ID_BUTTON_BUILD_PROJECT, _T("2. Compile Project"));
+  compilebt->SetToolTip(wxT("This step should be done after configuring the project. This will create the executables."));
+  wxButton* plugbt = new wxButton(this, ID_BUTTON_CONNECT_PROJECT, _T("3. Plug Packages (BBTK)"));
+  plugbt->SetToolTip(wxT("This step should be done after compiling the project. This will allow to use the boxes in this project to be available in the bbEditor."));
+  this->GetSizer()->Add(configurebt, 0, wxALL, 5);
+  this->GetSizer()->Add(compilebt, 0, wxALL, 5);
+  this->GetSizer()->Add(plugbt, 0, wxALL, 5);
+}
+
+//configure project
+void wxCDMProjectActionsPanel::OnBtnConfigureBuild(wxCommandEvent& event)
+{
+  std::string* result;
+  if(!this->project->ConfigureBuild(result))
+    {
+      wxMessageBox(crea::std2wx(result->c_str()), wxT("Project Configuration - Error!"));
+      return;
+    }
+  wxMessageBox(crea::std2wx("The configuration was executed successfully."), wxT("Project Configuration"));
+}
+
+//compile project
+void wxCDMProjectActionsPanel::OnBtnBuildProject(wxCommandEvent& event)
+{
+  std::string* result;
+  if(!this->project->Build(result))
+    {
+      wxMessageBox(crea::std2wx(result->c_str()), wxT("Project Compilation - Error!"));
+      return;
+    }
+  wxMessageBox(crea::std2wx("The compilation was executed successfully. Please check the \"building.log\" file located in the build folder to check the compilation result."), wxT("Project Compilation"));
+}
+
+//plug packages
+void wxCDMProjectActionsPanel::OnBtnConnectProject(wxCommandEvent& event)
+{
+  std::string* result;
+  if(!this->project->Connect(result))
+      {
+        wxMessageBox(crea::std2wx(result->c_str()), wxT("Plug Packages - Error!"));
+        return;
+      }
+    wxMessageBox(crea::std2wx("The connection was executed successfully. Please check the \"plugging.log\" file located in the build folder to check the compilation result."), wxT("Plug Package"));
 }