]> Creatis software - crea.git/blobdiff - lib/creaDevManagerLib/wxCDMAppliHelpDialog.cpp
Feature #1711 CreaDevManager application implementation
[crea.git] / lib / creaDevManagerLib / wxCDMAppliHelpDialog.cpp
index e3d487e34213b7d8055bef31c7906fe562a66a14..860abfdd87d533b1c5ecf1a3619aa2cd289a475d 100644 (file)
@@ -37,6 +37,7 @@
 
 #include "creaDevManagerIds.h"
 
+
 BEGIN_EVENT_TABLE(wxCDMAppliHelpDialog, wxDialog)
 EVT_BUTTON(ID_BUTTON_CANCEL, wxCDMAppliHelpDialog::OnFinish)
 EVT_BUTTON(ID_BUTTON_EDIT_CMAKELISTSFILE, wxCDMAppliHelpDialog::OnEditCMake)
@@ -93,9 +94,10 @@ void wxCDMAppliHelpDialog::CreateControls()
           "applications are useful when showing the projects' \"out of the box\" functionalities.\n"
           "\n"
           "In the application manager you can view a list of the available applications in the current project, as well as create "
-          "new applications. Remember that any application you make must be included in the appli's folder CMakeLists file. You can do that "
-          "by clicking on the \"Edit Appli's CMakeLists File\" button bellow or in the Application Manager the \"Edit CMakeLists file\" "
-          "button and include the desired applications at the end of the file.\n"
+          "new applications. Remember that any application you make must be included in the appli's folder CMakeLists file by using the "
+          "\"ADD_SUBDIRECTORY([applicationName])\" command. You can do that by clicking on the \"Edit Appli's CMakeLists File\" button "
+          "below or in the Application Manager the \"Edit CMakeLists file\" button and include the desired applications at the end of "
+          "the file.\n"
           "For a better understanding of how to use the applications please check the \"myFierceAppli\" application (which is shipped by "
           "default in every new project) and take a look at how it's included in the project."),
           wxDefaultPosition,
@@ -104,6 +106,11 @@ void wxCDMAppliHelpDialog::CreateControls()
   );
   v_sizer1->Add(instruction, 0,wxEXPAND | wxALL, 5);
 
+  wxButton* editCMakeAppliBtn = new wxButton(this, ID_BUTTON_EDIT_CMAKELISTSFILE, wxT("Edit Appli's CMakeLists File"));
+  editCMakeAppliBtn->Connect(wxEVT_ENTER_WINDOW, (wxObjectEventFunction)(wxEventFunction)(wxMouseEventFunction)&wxCDMAppliHelpDialog::OnCMakeListsEnter,NULL,this);
+  editCMakeAppliBtn->Connect(wxEVT_LEAVE_WINDOW, (wxObjectEventFunction)(wxEventFunction)(wxMouseEventFunction)&wxCDMAppliHelpDialog::OnCMakeListsExit,NULL,this);
+  v_sizer1->Add(editCMakeAppliBtn, 0, wxEXPAND | wxLEFT | wxRIGHT, 15);
+
   v_sizer1->Add(new wxCheckBox(this, ID_CHECKBOX_DISABLE_HELP, wxT("&Disable help")), 0, wxALIGN_RIGHT | wxRIGHT, 10);
 
   v_sizer1->Add(new wxButton(this, ID_BUTTON_CANCEL, wxT("Close")), 0, wxALIGN_RIGHT | wxRIGHT | wxBOTTOM | wxALIGN_CENTER_VERTICAL, 30);
@@ -119,23 +126,44 @@ void wxCDMAppliHelpDialog::OnFinish(wxCommandEvent& event)
 
 void wxCDMAppliHelpDialog::OnEditCMake(wxCommandEvent& event)
 {
-  //TODO: implement method
-  std::cout << "OnEditCMake not implemented yet." << std::endl;
-  event.Skip();
+  std::string* result;
+  if(!this->appli->OpenCMakeListsFile(result))
+    wxMessageBox(crea::std2wx(*result),_T("Open CMakeLists File - Error!"),wxOK | wxICON_ERROR);
+
+  wxCommandEvent* newEvent = new wxCommandEvent(wxEVT_COMMAND_LISTBOX_SELECTED);
+
+  if(this->appli->GetCMakeLists() != NULL)
+    {
+      newEvent->SetClientData(this->appli->GetCMakeLists());
+      newEvent->SetId(0);
+      wxPostEvent(this->GetParent(), *newEvent);
+    }
 }
 
 
-void wxCDMAppliHelpDialog::OnEditCMakeMouseEnter(wxMouseEvent& event)
+void wxCDMAppliHelpDialog::OnCMakeListsEnter(wxMouseEvent& event)
 {
-  //TODO: implement method
-  std::cout << "OnEditCMakeEnter not implemented yet." << std::endl;
+  wxCommandEvent* newEvent = new wxCommandEvent(wxEVT_COMMAND_LISTBOX_DOUBLECLICKED);
+
+  if(this->appli->GetCMakeLists() != NULL)
+    {
+      newEvent->SetClientData(this->appli->GetCMakeLists());
+      newEvent->SetId(0);
+      wxPostEvent(this->GetParent(), *newEvent);
+    }
   event.Skip();
 }
 
-void wxCDMAppliHelpDialog::OnEditCMakeMouseExit(wxMouseEvent& event)
+void wxCDMAppliHelpDialog::OnCMakeListsExit(wxMouseEvent& event)
 {
-  //TODO: implement method
-  std::cout << "OnEditCMakeExit not implemented yet." << std::endl;
+  wxCommandEvent* newEvent = new wxCommandEvent(wxEVT_COMMAND_LISTBOX_SELECTED);
+
+  if(this->appli->GetCMakeLists() != NULL)
+    {
+      newEvent->SetClientData(this->appli->GetCMakeLists());
+      newEvent->SetId(0);
+      wxPostEvent(this->GetParent(), *newEvent);
+    }
   event.Skip();
 }