]> Creatis software - crea.git/blobdiff - lib/creaDevManagerLib/wxCDMApplicationDescriptionPanel.cpp
Feature #1711
[crea.git] / lib / creaDevManagerLib / wxCDMApplicationDescriptionPanel.cpp
index 3e931b192360119a852300c7f2d6693ced52003b..03142d089ed3f8605605aad3eea653a8442443e6 100644 (file)
 
 #include "wxCDMApplicationDescriptionPanel.h"
 
+#include "wxCDMMainFrame.h"
+
 #include "creaDevManagerIds.h"
 #include "images/AIcon64.xpm"
 
 BEGIN_EVENT_TABLE(wxCDMApplicationDescriptionPanel, wxPanel)
+EVT_BUTTON(ID_BUTTON_PREV, wxCDMApplicationDescriptionPanel::OnBtnReturn)
 EVT_BUTTON(ID_BUTTON_CREATE_CLASS, wxCDMApplicationDescriptionPanel::OnBtnCreateClass)
 EVT_BUTTON(ID_BUTTON_CREATE_FOLDER, wxCDMApplicationDescriptionPanel::OnBtnCreateFolder)
 EVT_BUTTON(ID_BUTTON_EDIT_CMAKELISTSFILE, wxCDMApplicationDescriptionPanel::OnBtnEditCMakeLists)
+EVT_BUTTON(ID_BUTTON_OPEN_FOLDER, wxCDMApplicationDescriptionPanel::OnBtnOpenFolder)
 END_EVENT_TABLE()
 
 wxCDMApplicationDescriptionPanel::wxCDMApplicationDescriptionPanel(
@@ -80,6 +84,11 @@ void wxCDMApplicationDescriptionPanel::CreateControls()
 {
   wxBoxSizer *sizer = new wxBoxSizer(wxVERTICAL);
 
+  //Link to return
+  wxButton* returnbt = new wxButton(this, ID_BUTTON_PREV, wxT("Return to project"));
+  returnbt->SetToolTip(wxT("Return to the active project description."));
+  sizer->Add(returnbt, 0, wxALIGN_CENTER | wxALL, 5);
+
   //Welcome
   sizer->Add(new wxStaticText(this, -1, _("Application")),0, wxALIGN_CENTER, 0);
 
@@ -90,44 +99,74 @@ void wxCDMApplicationDescriptionPanel::CreateControls()
   sizer->Add(new wxStaticText(this, -1, crea::std2wx(this->application->GetNameApplication())),0, wxALIGN_CENTER, 0);
 
   //Project Properties
-  wxStaticBox* propertiesBox = new wxStaticBox(this, -1, _T("&Properties"));
-  wxStaticBoxSizer* propertiesBoxInnerSizer = new wxStaticBoxSizer(propertiesBox, wxVERTICAL);
+  wxStaticBoxSizer* propertiesBox = new wxStaticBoxSizer(wxVERTICAL, this, wxT("&Properties"));
+  wxPanel* propertiesPanel = new wxPanel(this);
+  wxBoxSizer* propertiesPanelSizer = new wxBoxSizer(wxVERTICAL);
 
-  wxFlexGridSizer* flexGridSizer = new wxFlexGridSizer(4, 2, 9, 15);
+  wxFlexGridSizer* propertiesGridSizer = new wxFlexGridSizer(4, 2, 9, 15);
 
-  wxStaticText *pMainFile = new wxStaticText(this, -1, wxT("Main File"));
+  wxStaticText *pMainFile = new wxStaticText(propertiesPanel, -1, wxT("Main File"));
+  wxBoxSizer* pMainFilesz = new wxBoxSizer(wxHORIZONTAL);
+  wxStaticText* pMainFiletc = new wxStaticText(propertiesPanel, wxID_ANY, crea::std2wx(this->application->GetMainFile()));
+  wxButton* pMainFilebt = new wxButton(propertiesPanel, ID_BUTTON_SET_VERSION, wxT("Choose"));
+  pMainFilebt->SetToolTip(wxT("Choose the main file for the application."));
+  pMainFilesz->Add(pMainFiletc, 0, wxALIGN_CENTER_VERTICAL, 0);
+  pMainFilesz->Add(pMainFilebt, 0, wxALIGN_CENTER | wxLEFT, 10);
 
-  wxTextCtrl *pMainFiletc = new wxTextCtrl(this, -1, crea::std2wx(this->application->GetMainFile()));
+  propertiesGridSizer->Add(pMainFile, 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
+  propertiesGridSizer->Add(pMainFilesz, 1, wxEXPAND);
 
-  flexGridSizer->Add(pMainFile, 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
-  flexGridSizer->Add(pMainFiletc, 1, wxEXPAND);
+  propertiesGridSizer->AddGrowableCol(1,1);
 
-  propertiesBoxInnerSizer -> Add(flexGridSizer, 0, wxEXPAND);
-  sizer -> Add(propertiesBoxInnerSizer, 1, wxEXPAND | wxALL, 20);
+  propertiesPanelSizer->Add(propertiesGridSizer, 0, wxEXPAND);
+  propertiesPanel->SetSizer(propertiesPanelSizer);
+  propertiesPanelSizer->Fit(propertiesPanel);
+  propertiesBox->Add(propertiesPanel, 0, wxEXPAND);
+  sizer->Add(propertiesBox, 0, wxEXPAND | wxALL, 10);
 
   //Actions
-  wxStaticBox* actionsBox = new wxStaticBox(this, -1, _T("&Actions"));
-  wxStaticBoxSizer* actionsBoxInnerSizer = new wxStaticBoxSizer(actionsBox, wxVERTICAL);
-  sizer -> Add(actionsBoxInnerSizer, 1, wxEXPAND | wxALL, 20);
-
-  wxButton* createClassbt = new wxButton(this, ID_BUTTON_CREATE_CLASS, _T("Create Class"));
+  //actions StaticBoxSizer
+  wxStaticBoxSizer* actionsBox = new wxStaticBoxSizer(wxVERTICAL, this, wxT("&Actions"));
+  actionsBox->GetStaticBox()->SetToolTip(wxT("Create classes or edit them for this application, as well as editing the application's CMakeLists.txt file by selecting the desired action."));
+  //actions Panel
+  wxPanel* actionsPanel = new wxPanel(this);
+  //actions Sizer
+  wxBoxSizer* actionsPanelSizer = new wxBoxSizer(wxHORIZONTAL);
+
+  wxButton* createClassbt = new wxButton(actionsPanel, ID_BUTTON_CREATE_CLASS, _T("Create Class"));
   createClassbt->SetToolTip(wxT("Create a new Class (.h and .cxx files)."));
-  wxButton* createFolderbt = new wxButton(this, ID_BUTTON_CREATE_FOLDER, _T("Create Folder"));
+  wxButton* createFolderbt = new wxButton(actionsPanel, ID_BUTTON_CREATE_FOLDER, _T("Create Folder"));
   createFolderbt->SetToolTip(wxT("Create a new Folder inside the application folder."));
-  wxButton* editCMakebt = new wxButton(this, ID_BUTTON_EDIT_CMAKELISTSFILE, _T("Edit CMakeLists File"));
+  wxButton* editCMakebt = new wxButton(actionsPanel, ID_BUTTON_EDIT_CMAKELISTSFILE, _T("Edit CMakeLists File"));
   editCMakebt->SetToolTip(wxT("Edit the CMakeLists.txt file inside this application."));
+  wxButton* openFolderbt = new wxButton(actionsPanel, ID_BUTTON_OPEN_FOLDER, _T("Open Application Folder"));
+  openFolderbt->SetToolTip(wxT("Open the application folder in the file explorer."));
 
-  actionsBoxInnerSizer->Add(createClassbt, 0, wxEXPAND | wxRIGHT | wxLEFT, 20);
-  actionsBoxInnerSizer->Add(createFolderbt, 0, wxEXPAND | wxRIGHT | wxLEFT, 20);
-  actionsBoxInnerSizer->Add(editCMakebt, 0, wxEXPAND | wxRIGHT | wxLEFT, 20);
 
-  //Assign sizer
-  actionsBoxInnerSizer->SetSizeHints(this);
+  actionsPanelSizer->Add(createClassbt, 0, wxALL, 5);
+  actionsPanelSizer->Add(createFolderbt, 0, wxALL, 5);
+  actionsPanelSizer->Add(editCMakebt, 0, wxALL, 5);
+  actionsPanelSizer->Add(openFolderbt, 0, wxALL, 5);
 
+  //SetPanel sizer and box
+  actionsPanel->SetSizer(actionsPanelSizer);
+  actionsPanelSizer->Fit(actionsPanel);
+  actionsBox->Add(actionsPanel, 0, wxALL, 5);
+  sizer->Add(actionsBox, 0, wxEXPAND | wxALL, 10);
+
+  //Assign sizer
   SetSizer(sizer);
   sizer->SetSizeHints(this);
 }
 
+void wxCDMApplicationDescriptionPanel::OnBtnReturn(wxCommandEvent& event)
+{
+  wxCommandEvent* newEvent = new wxCommandEvent(wxEVT_DISPLAY_CHANGED);
+  newEvent->SetInt(((wxCDMMainFrame*)this->GetParent())->GetModel()->GetProject()->GetId());
+  newEvent->SetId(0);
+  wxPostEvent(this->GetParent(), *newEvent);
+}
+
 void wxCDMApplicationDescriptionPanel::OnBtnCreateClass(wxCommandEvent& event)
 {
   //TODO: implement method
@@ -148,3 +187,10 @@ void wxCDMApplicationDescriptionPanel::OnBtnEditCMakeLists(wxCommandEvent& event
   std::cerr << "Event OnBtnEditCMakeLists not implemented" << std::endl;
   event.Skip();
 }
+
+void wxCDMApplicationDescriptionPanel::OnBtnOpenFolder(wxCommandEvent& event)
+{
+  //TODO: implement method
+  std::cerr << "Event OnBtnOpenFolder not implemented" << std::endl;
+  event.Skip();
+}