]> Creatis software - crea.git/blobdiff - lib/creaDevManagerLib/wxCDMLibHelpDialog.cpp
Feature #1711
[crea.git] / lib / creaDevManagerLib / wxCDMLibHelpDialog.cpp
index 85e83aa8a550c2ee7d38046823f5ada89988ac8e..351406aa736dc101307c85fa59386ef9eeee2a08 100644 (file)
@@ -104,6 +104,11 @@ void wxCDMLibHelpDialog::CreateControls()
   );
   v_sizer1->Add(instruction, 0,wxEXPAND | wxALL, 5);
 
+  wxButton* editCMakeLibBtn = new wxButton(this, ID_BUTTON_EDIT_CMAKELISTSFILE, wxT("Edit Lib's CMakeLists File"));
+  editCMakeLibBtn->Connect(wxEVT_ENTER_WINDOW, (wxObjectEventFunction)(wxEventFunction)(wxMouseEventFunction)&wxCDMLibHelpDialog::OnEditCMakeMouseEnter,NULL,this);
+  editCMakeLibBtn->Connect(wxEVT_LEAVE_WINDOW, (wxObjectEventFunction)(wxEventFunction)(wxMouseEventFunction)&wxCDMLibHelpDialog::OnEditCMakeMouseExit,NULL,this);
+  v_sizer1->Add(editCMakeLibBtn, 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 +124,44 @@ void wxCDMLibHelpDialog::OnFinish(wxCommandEvent& event)
 
 void wxCDMLibHelpDialog::OnEditCMake(wxCommandEvent& event)
 {
-  //TODO: implement method
-  std::cout << "OnEditCMake not implemented yet." << std::endl;
-  event.Skip();
+  std::string* result;
+  if(!this->lib->OpenCMakeListsFile(result))
+    wxMessageBox(crea::std2wx(*result),_T("Open CMakeLists File - Error!"),wxOK | wxICON_ERROR);
+
+  wxCommandEvent* newEvent = new wxCommandEvent(wxEVT_COMMAND_LISTBOX_SELECTED);
+
+  if(this->lib->GetCMakeLists() != NULL)
+    {
+      newEvent->SetClientData(this->lib->GetCMakeLists());
+      newEvent->SetId(0);
+      wxPostEvent(this->GetParent(), *newEvent);
+    }
 }
 
 
 void wxCDMLibHelpDialog::OnEditCMakeMouseEnter(wxMouseEvent& event)
 {
-  //TODO: implement method
-  std::cout << "OnEditCMakeEnter not implemented yet." << std::endl;
+  wxCommandEvent* newEvent = new wxCommandEvent(wxEVT_COMMAND_LISTBOX_DOUBLECLICKED);
+
+  if(this->lib->GetCMakeLists() != NULL)
+    {
+      newEvent->SetClientData(this->lib->GetCMakeLists());
+      newEvent->SetId(0);
+      wxPostEvent(this->GetParent(), *newEvent);
+    }
   event.Skip();
 }
 
 void wxCDMLibHelpDialog::OnEditCMakeMouseExit(wxMouseEvent& event)
 {
-  //TODO: implement method
-  std::cout << "OnEditCMakeExit not implemented yet." << std::endl;
+  wxCommandEvent* newEvent = new wxCommandEvent(wxEVT_COMMAND_LISTBOX_SELECTED);
+
+  if(this->lib->GetCMakeLists() != NULL)
+    {
+      newEvent->SetClientData(this->lib->GetCMakeLists());
+      newEvent->SetId(0);
+      wxPostEvent(this->GetParent(), *newEvent);
+    }
   event.Skip();
 }