]> Creatis software - crea.git/commitdiff
Feature #1711
authorDaniel Gonzalez <daniel.gonzalez@creatis.insa-lyon.fr>
Wed, 16 Jan 2013 13:30:57 +0000 (14:30 +0100)
committerDaniel Gonzalez <daniel.gonzalez@creatis.insa-lyon.fr>
Wed, 16 Jan 2013 13:30:57 +0000 (14:30 +0100)
CreaDevManager application implementation

-"Open Cmakelists" buttons in help dialogs now working!

lib/creaDevManagerLib/wxCDMAppliHelpDialog.cpp
lib/creaDevManagerLib/wxCDMAppliHelpDialog.h
lib/creaDevManagerLib/wxCDMApplicationHelpDialog.cpp
lib/creaDevManagerLib/wxCDMBlackBoxHelpDialog.cpp
lib/creaDevManagerLib/wxCDMLibHelpDialog.cpp
lib/creaDevManagerLib/wxCDMLibraryHelpDialog.cpp
lib/creaDevManagerLib/wxCDMPackageHelpDialog.cpp

index e3d487e34213b7d8055bef31c7906fe562a66a14..a36338166f19b53e0e667ae0c1b736c8a7c3ab90 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)
@@ -104,6 +105,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 +125,47 @@ 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_LIST_ITEM_DESELECTED);
+
+  if(this->appli->GetCMakeLists() != NULL)
+    {
+      int CMId = this->appli->GetCMakeLists()->GetId();
+      newEvent->SetInt(CMId);
+      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_LIST_ITEM_SELECTED);
+
+  if(this->appli->GetCMakeLists() != NULL)
+    {
+      int CMId = this->appli->GetCMakeLists()->GetId();
+      newEvent->SetInt(CMId);
+      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_LIST_ITEM_DESELECTED);
+
+  if(this->appli->GetCMakeLists() != NULL)
+    {
+      int CMId = this->appli->GetCMakeLists()->GetId();
+      newEvent->SetInt(CMId);
+      newEvent->SetId(0);
+      wxPostEvent(this->GetParent(), *newEvent);
+    }
   event.Skip();
 }
 
index 4f60da9694502c96834d779657c6dda3f4a6617f..e788468aef8b7fb7de2cc668b7076103bd42603b 100644 (file)
@@ -77,8 +77,8 @@ protected:
 
   void OnEditCMake(wxCommandEvent& event);
 
-  void OnEditCMakeMouseEnter(wxMouseEvent& event);
-  void OnEditCMakeMouseExit(wxMouseEvent& event);
+  void OnCMakeListsEnter(wxMouseEvent& event);
+  void OnCMakeListsExit(wxMouseEvent& event);
 
   void OnDisableHelp(wxCommandEvent& event);
 };
index d9ff03a26a613f23c9c649a2643b24e1fd41a8a0..44c9b6bef02f3a5c947d9467592a4a725e7db32c 100644 (file)
@@ -37,6 +37,8 @@
 
 #include "creaDevManagerIds.h"
 
+#include "modelCDMAppli.h"
+
 BEGIN_EVENT_TABLE(wxCDMApplicationHelpDialog, wxDialog)
 EVT_BUTTON(ID_BUTTON_CANCEL, wxCDMApplicationHelpDialog::OnFinish)
 EVT_BUTTON(ID_BUTTON_OPENPROJECT, wxCDMApplicationHelpDialog::OnCMakeLists)
@@ -111,11 +113,15 @@ void wxCDMApplicationHelpDialog::CreateControls()
   );
   v_sizer1->Add(instruction, 0,wxEXPAND | wxALL, 5);
 
-  wxButton* editCMakePKGBtn = new wxButton(this, ID_BUTTON_EDIT_CMAKELISTSFILE, wxT("Open Application's directory CMakeLists file"));
-  wxButton* editCMakePRJBtn= new wxButton(this, ID_BUTTON_OPENPROJECT, wxT("Open Appli's directory CMakeLists file"));
+  wxButton* editCMakeApplicationBtn = new wxButton(this, ID_BUTTON_EDIT_CMAKELISTSFILE, wxT("Open Application's directory CMakeLists file"));
+  editCMakeApplicationBtn->Connect(wxEVT_ENTER_WINDOW, (wxObjectEventFunction)(wxEventFunction)(wxMouseEventFunction)&wxCDMApplicationHelpDialog::OnCMakeListsEnter,NULL,this);
+  editCMakeApplicationBtn->Connect(wxEVT_LEAVE_WINDOW, (wxObjectEventFunction)(wxEventFunction)(wxMouseEventFunction)&wxCDMApplicationHelpDialog::OnCMakeListsExit,NULL,this);
+  wxButton* editCMakeAppliBtn= new wxButton(this, ID_BUTTON_OPENPROJECT, wxT("Open Appli's directory CMakeLists file"));
+  editCMakeAppliBtn->Connect(wxEVT_ENTER_WINDOW, (wxObjectEventFunction)(wxEventFunction)(wxMouseEventFunction)&wxCDMApplicationHelpDialog::OnCMakeListsEnter,NULL,this);
+  editCMakeAppliBtn->Connect(wxEVT_LEAVE_WINDOW, (wxObjectEventFunction)(wxEventFunction)(wxMouseEventFunction)&wxCDMApplicationHelpDialog::OnCMakeListsExit,NULL,this);
 
-  v_sizer1->Add(editCMakePKGBtn, 0, wxEXPAND | wxLEFT | wxRIGHT, 15);
-  v_sizer1->Add(editCMakePRJBtn, 0, wxEXPAND | wxLEFT | wxRIGHT, 15);
+  v_sizer1->Add(editCMakeApplicationBtn, 0, wxEXPAND | wxLEFT | wxRIGHT, 15);
+  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);
 
@@ -132,22 +138,124 @@ void wxCDMApplicationHelpDialog::OnFinish(wxCommandEvent& event)
 
 void wxCDMApplicationHelpDialog::OnCMakeLists(wxCommandEvent& event)
 {
-  //TODO: implement method
-  std::cout << "OnCMakeLists not implemented yet." << std::endl;
-  event.Skip();
+  std::string* result;
+
+  if((int)((wxButton*)event.GetEventObject())->GetId() == (int)ID_BUTTON_EDIT_CMAKELISTSFILE)
+    {
+
+      if(!this->application->OpenCMakeListsFile(result))
+        wxMessageBox(crea::std2wx(*result),_T("Open CMakeLists File - Error!"),wxOK | wxICON_ERROR);
+
+      wxCommandEvent* newEvent = new wxCommandEvent(wxEVT_COMMAND_LIST_ITEM_DESELECTED);
+
+      if(this->application->GetCMakeLists() != NULL)
+        {
+          int CMId = this->application->GetCMakeLists()->GetId();
+          newEvent->SetInt(CMId);
+          newEvent->SetId(0);
+          wxPostEvent(this->GetParent(), *newEvent);
+        }
+    }
+  else if(((wxButton*)event.GetEventObject())->GetId() == ID_BUTTON_OPENPROJECT)
+    {
+      modelCDMIProjectTreeNode* node = this->application;
+      while (node != NULL && dynamic_cast<modelCDMAppli*>(node) == NULL)
+        {
+          node = node->GetParent();
+        }
+      if (node != NULL)
+        {
+          if(!((modelCDMAppli*)node)->OpenCMakeListsFile(result))
+            wxMessageBox(crea::std2wx(*result),_T("Open CMakeLists File - Error!"),wxOK | wxICON_ERROR);
+
+          wxCommandEvent* newEvent = new wxCommandEvent(wxEVT_COMMAND_LIST_ITEM_DESELECTED);
+
+          if(((modelCDMAppli*)node)->GetCMakeLists() != NULL)
+            {
+              int CMId = ((modelCDMAppli*)node)->GetCMakeLists()->GetId();
+              newEvent->SetInt(CMId);
+              newEvent->SetId(0);
+              wxPostEvent(this->GetParent(), *newEvent);
+            }
+        }
+      else
+        {
+          wxMessageBox(crea::std2wx("No project CMakeLists file was found."),_T("Open CMakeLists File - Error!"),wxOK | wxICON_ERROR);
+        }
+    }
 }
 
 void wxCDMApplicationHelpDialog::OnCMakeListsEnter(wxMouseEvent& event)
 {
-  //TODO: implement method
-  std::cout << "OnCMakeListsEnter not implemented yet." << std::endl;
+  if(((wxButton*)event.GetEventObject())->GetId() == ID_BUTTON_EDIT_CMAKELISTSFILE)
+    {
+      wxCommandEvent* newEvent = new wxCommandEvent(wxEVT_COMMAND_LIST_ITEM_SELECTED);
+
+      if(this->application->GetCMakeLists() != NULL)
+        {
+          int CMId = this->application->GetCMakeLists()->GetId();
+          newEvent->SetInt(CMId);
+          newEvent->SetId(0);
+          wxPostEvent(this->GetParent(), *newEvent);
+        }
+    }
+  else if(((wxButton*)event.GetEventObject())->GetId() == ID_BUTTON_OPENPROJECT)
+    {
+      modelCDMIProjectTreeNode* node = this->application;
+      while (node != NULL && dynamic_cast<modelCDMAppli*>(node) == NULL)
+        {
+          node = node->GetParent();
+        }
+      if (node != NULL)
+        {
+          wxCommandEvent* newEvent = new wxCommandEvent(wxEVT_COMMAND_LIST_ITEM_SELECTED);
+
+          if(((modelCDMAppli*)node)->GetCMakeLists() != NULL)
+            {
+              int CMId = ((modelCDMAppli*)node)->GetCMakeLists()->GetId();
+              newEvent->SetInt(CMId);
+              newEvent->SetId(0);
+              wxPostEvent(this->GetParent(), *newEvent);
+            }
+        }
+    }
   event.Skip();
 }
 
 void wxCDMApplicationHelpDialog::OnCMakeListsExit(wxMouseEvent& event)
 {
-  //TODO: implement method
-  std::cout << "OnCMakeListsExit not implemented yet." << std::endl;
+  if(((wxButton*)event.GetEventObject())->GetId() == ID_BUTTON_EDIT_CMAKELISTSFILE)
+    {
+      wxCommandEvent* newEvent = new wxCommandEvent(wxEVT_COMMAND_LIST_ITEM_DESELECTED);
+
+      if(this->application->GetCMakeLists() != NULL)
+        {
+          int CMId = this->application->GetCMakeLists()->GetId();
+          newEvent->SetInt(CMId);
+          newEvent->SetId(0);
+          wxPostEvent(this->GetParent(), *newEvent);
+        }
+    }
+  else if(((wxButton*)event.GetEventObject())->GetId() == ID_BUTTON_OPENPROJECT)
+    {
+      modelCDMIProjectTreeNode* node = this->application;
+      while (node != NULL && dynamic_cast<modelCDMAppli*>(node) == NULL)
+        {
+          node = node->GetParent();
+        }
+      if (node != NULL)
+        {
+          wxCommandEvent* newEvent = new wxCommandEvent(wxEVT_COMMAND_LIST_ITEM_DESELECTED);
+
+          if(((modelCDMAppli*)node)->GetCMakeLists() != NULL)
+            {
+              int CMId = ((modelCDMAppli*)node)->GetCMakeLists()->GetId();
+              newEvent->SetInt(CMId);
+              newEvent->SetId(0);
+              wxPostEvent(this->GetParent(), *newEvent);
+            }
+        }
+    }
   event.Skip();
 }
 
index 4d4ff43d68e5dcda8ac0afcd8c00e7d414b2f70e..480e9d04b817f73b5b275817e7921a85f774efd2 100644 (file)
@@ -37,6 +37,9 @@
 
 #include "creaDevManagerIds.h"
 
+#include "modelCDMProject.h"
+#include "modelCDMPackage.h"
+
 BEGIN_EVENT_TABLE(wxCDMBlackBoxHelpDialog, wxDialog)
 EVT_BUTTON(ID_BUTTON_CANCEL, wxCDMBlackBoxHelpDialog::OnFinish)
 EVT_BUTTON(ID_BUTTON_OPENPROJECT, wxCDMBlackBoxHelpDialog::OnCMakeLists)
@@ -113,11 +116,15 @@ void wxCDMBlackBoxHelpDialog::CreateControls()
   );
   v_sizer1->Add(instruction, 0,wxEXPAND | wxALL, 5);
 
-  wxButton* editCMakePKGBtn = new wxButton(this, ID_BUTTON_EDIT_CMAKELISTSFILE, wxT("Open Package's directory CMakeLists file"));
-  wxButton* editCMakePRJBtn= new wxButton(this, ID_BUTTON_OPENPROJECT, wxT("Open Project's directory CMakeLists file"));
+  wxButton* editCMakePkgBtn = new wxButton(this, ID_BUTTON_EDIT_CMAKELISTSFILE, wxT("Open Package's directory CMakeLists file"));
+  editCMakePkgBtn->Connect(wxEVT_ENTER_WINDOW, (wxObjectEventFunction)(wxEventFunction)(wxMouseEventFunction)&wxCDMBlackBoxHelpDialog::OnCMakeListsEnter,NULL,this);
+  editCMakePkgBtn->Connect(wxEVT_LEAVE_WINDOW, (wxObjectEventFunction)(wxEventFunction)(wxMouseEventFunction)&wxCDMBlackBoxHelpDialog::OnCMakeListsExit,NULL,this);
+  wxButton* editCMakePrjBtn= new wxButton(this, ID_BUTTON_OPENPROJECT, wxT("Open Project's directory CMakeLists file"));
+  editCMakePrjBtn->Connect(wxEVT_ENTER_WINDOW, (wxObjectEventFunction)(wxEventFunction)(wxMouseEventFunction)&wxCDMBlackBoxHelpDialog::OnCMakeListsEnter,NULL,this);
+  editCMakePrjBtn->Connect(wxEVT_LEAVE_WINDOW, (wxObjectEventFunction)(wxEventFunction)(wxMouseEventFunction)&wxCDMBlackBoxHelpDialog::OnCMakeListsExit,NULL,this);
 
-  v_sizer1->Add(editCMakePKGBtn, 0, wxEXPAND | wxLEFT | wxRIGHT, 15);
-  v_sizer1->Add(editCMakePRJBtn, 0, wxEXPAND | wxLEFT | wxRIGHT, 15);
+  v_sizer1->Add(editCMakePkgBtn, 0, wxEXPAND | wxLEFT | wxRIGHT, 15);
+  v_sizer1->Add(editCMakePrjBtn, 0, wxEXPAND | wxLEFT | wxRIGHT, 15);
 
   v_sizer1->Add(new wxCheckBox(this, ID_CHECKBOX_DISABLE_HELP, wxT("&Disable help")), 0, wxALIGN_RIGHT | wxRIGHT, 10);
 
@@ -134,23 +141,152 @@ void wxCDMBlackBoxHelpDialog::OnFinish(wxCommandEvent& event)
 
 void wxCDMBlackBoxHelpDialog::OnCMakeLists(wxCommandEvent& event)
 {
-  //TODO: implement method
-  std::cout << "OnCMakeLists not implemented yet." << std::endl;
-  event.Skip();
+  std::string* result;
+
+  if((int)((wxButton*)event.GetEventObject())->GetId() == (int)ID_BUTTON_EDIT_CMAKELISTSFILE)
+    {
+      modelCDMIProjectTreeNode* node = this->blackBox;
+      while (node != NULL && dynamic_cast<modelCDMPackage*>(node) == NULL)
+        {
+          node = node->GetParent();
+        }
+      if (node != NULL)
+        {
+          if(!((modelCDMPackage*)node)->OpenCMakeListsFile(result))
+            wxMessageBox(crea::std2wx(*result),_T("Open CMakeLists File - Error!"),wxOK | wxICON_ERROR);
+
+          wxCommandEvent* newEvent = new wxCommandEvent(wxEVT_COMMAND_LIST_ITEM_DESELECTED);
+
+          if(((modelCDMPackage*)node)->GetCMakeLists() != NULL)
+            {
+              int CMId = ((modelCDMPackage*)node)->GetCMakeLists()->GetId();
+              newEvent->SetInt(CMId);
+              newEvent->SetId(0);
+              wxPostEvent(this->GetParent(), *newEvent);
+            }
+        }
+      else
+        {
+          wxMessageBox(crea::std2wx("No project CMakeLists file was found."),_T("Open CMakeLists File - Error!"),wxOK | wxICON_ERROR);
+        }
+    }
+  else if(((wxButton*)event.GetEventObject())->GetId() == ID_BUTTON_OPENPROJECT)
+    {
+      modelCDMIProjectTreeNode* node = this->blackBox;
+      while (node != NULL && dynamic_cast<modelCDMProject*>(node) == NULL)
+        {
+          node = node->GetParent();
+        }
+      if (node != NULL)
+        {
+          if(!((modelCDMProject*)node)->OpenCMakeListsFile(result))
+            wxMessageBox(crea::std2wx(*result),_T("Open CMakeLists File - Error!"),wxOK | wxICON_ERROR);
+
+          wxCommandEvent* newEvent = new wxCommandEvent(wxEVT_COMMAND_LIST_ITEM_DESELECTED);
+
+          if(((modelCDMProject*)node)->GetCMakeLists() != NULL)
+            {
+              int CMId = ((modelCDMProject*)node)->GetCMakeLists()->GetId();
+              newEvent->SetInt(CMId);
+              newEvent->SetId(0);
+              wxPostEvent(this->GetParent(), *newEvent);
+            }
+        }
+      else
+        {
+          wxMessageBox(crea::std2wx("No project CMakeLists file was found."),_T("Open CMakeLists File - Error!"),wxOK | wxICON_ERROR);
+        }
+    }
 }
 
 void wxCDMBlackBoxHelpDialog::OnCMakeListsEnter(wxMouseEvent& event)
 {
-  //TODO: implement method
-  std::cout << "OnCMakeListsEnter not implemented yet." << std::endl;
+  if(((wxButton*)event.GetEventObject())->GetId() == ID_BUTTON_EDIT_CMAKELISTSFILE)
+    {
+      modelCDMIProjectTreeNode* node = this->blackBox;
+      while (node != NULL && dynamic_cast<modelCDMPackage*>(node) == NULL)
+        {
+          node = node->GetParent();
+        }
+      if (node != NULL)
+        {
+          wxCommandEvent* newEvent = new wxCommandEvent(wxEVT_COMMAND_LIST_ITEM_SELECTED);
+
+          if(((modelCDMPackage*)node)->GetCMakeLists() != NULL)
+            {
+              int CMId = ((modelCDMPackage*)node)->GetCMakeLists()->GetId();
+              newEvent->SetInt(CMId);
+              newEvent->SetId(0);
+              wxPostEvent(this->GetParent(), *newEvent);
+            }
+        }
+    }
+  else if(((wxButton*)event.GetEventObject())->GetId() == ID_BUTTON_OPENPROJECT)
+    {
+      modelCDMIProjectTreeNode* node = this->blackBox;
+      while (node != NULL && dynamic_cast<modelCDMProject*>(node) == NULL)
+        {
+          node = node->GetParent();
+        }
+      if (node != NULL)
+        {
+          wxCommandEvent* newEvent = new wxCommandEvent(wxEVT_COMMAND_LIST_ITEM_SELECTED);
+
+          if(((modelCDMProject*)node)->GetCMakeLists() != NULL)
+            {
+              int CMId = ((modelCDMProject*)node)->GetCMakeLists()->GetId();
+              newEvent->SetInt(CMId);
+              newEvent->SetId(0);
+              wxPostEvent(this->GetParent(), *newEvent);
+            }
+        }
+    }
   event.Skip();
 }
 
 void wxCDMBlackBoxHelpDialog::OnCMakeListsExit(wxMouseEvent& event)
 {
-  //TODO: implement method
-  std::cout << "OnCMakeListsExit not implemented yet." << std::endl;
-  event.Skip();
+  if(((wxButton*)event.GetEventObject())->GetId() == ID_BUTTON_EDIT_CMAKELISTSFILE)
+      {
+        modelCDMIProjectTreeNode* node = this->blackBox;
+        while (node != NULL && dynamic_cast<modelCDMPackage*>(node) == NULL)
+          {
+            node = node->GetParent();
+          }
+        if (node != NULL)
+          {
+            wxCommandEvent* newEvent = new wxCommandEvent(wxEVT_COMMAND_LIST_ITEM_DESELECTED);
+
+            if(((modelCDMPackage*)node)->GetCMakeLists() != NULL)
+              {
+                int CMId = ((modelCDMPackage*)node)->GetCMakeLists()->GetId();
+                newEvent->SetInt(CMId);
+                newEvent->SetId(0);
+                wxPostEvent(this->GetParent(), *newEvent);
+              }
+          }
+      }
+    else if(((wxButton*)event.GetEventObject())->GetId() == ID_BUTTON_OPENPROJECT)
+      {
+        modelCDMIProjectTreeNode* node = this->blackBox;
+        while (node != NULL && dynamic_cast<modelCDMProject*>(node) == NULL)
+          {
+            node = node->GetParent();
+          }
+        if (node != NULL)
+          {
+            wxCommandEvent* newEvent = new wxCommandEvent(wxEVT_COMMAND_LIST_ITEM_DESELECTED);
+
+            if(((modelCDMProject*)node)->GetCMakeLists() != NULL)
+              {
+                int CMId = ((modelCDMProject*)node)->GetCMakeLists()->GetId();
+                newEvent->SetInt(CMId);
+                newEvent->SetId(0);
+                wxPostEvent(this->GetParent(), *newEvent);
+              }
+          }
+      }
+    event.Skip();
 }
 
 void wxCDMBlackBoxHelpDialog::OnDisableHelp(wxCommandEvent& event)
index 85e83aa8a550c2ee7d38046823f5ada89988ac8e..c6601ffcfb838c548f9bc5a60d2a610b7b94019f 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,47 @@ 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_LIST_ITEM_DESELECTED);
+
+  if(this->lib->GetCMakeLists() != NULL)
+    {
+      int CMId = this->lib->GetCMakeLists()->GetId();
+      newEvent->SetInt(CMId);
+      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_LIST_ITEM_SELECTED);
+
+  if(this->lib->GetCMakeLists() != NULL)
+    {
+      int CMId = this->lib->GetCMakeLists()->GetId();
+      newEvent->SetInt(CMId);
+      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_LIST_ITEM_DESELECTED);
+
+  if(this->lib->GetCMakeLists() != NULL)
+    {
+      int CMId = this->lib->GetCMakeLists()->GetId();
+      newEvent->SetInt(CMId);
+      newEvent->SetId(0);
+      wxPostEvent(this->GetParent(), *newEvent);
+    }
   event.Skip();
 }
 
index 455b55935f7b20bbed87cde23c27fb5bc72397a0..9f01d42119468804a36ce74698a9245544377e36 100644 (file)
@@ -37,6 +37,8 @@
 
 #include "creaDevManagerIds.h"
 
+#include "modelCDMLib.h"
+
 BEGIN_EVENT_TABLE(wxCDMLibraryHelpDialog, wxDialog)
 EVT_BUTTON(ID_BUTTON_CANCEL, wxCDMLibraryHelpDialog::OnFinish)
 EVT_BUTTON(ID_BUTTON_OPENPROJECT, wxCDMLibraryHelpDialog::OnCMakeLists)
@@ -111,11 +113,15 @@ void wxCDMLibraryHelpDialog::CreateControls()
   );
   v_sizer1->Add(instruction, 0,wxEXPAND | wxALL, 5);
 
-  wxButton* editCMakePKGBtn = new wxButton(this, ID_BUTTON_EDIT_CMAKELISTSFILE, wxT("Open Library's directory CMakeLists file"));
-  wxButton* editCMakePRJBtn= new wxButton(this, ID_BUTTON_OPENPROJECT, wxT("Open Lib's directory CMakeLists file"));
+  wxButton* editCMakeLibraryBtn = new wxButton(this, ID_BUTTON_EDIT_CMAKELISTSFILE, wxT("Open Library's directory CMakeLists file"));
+  editCMakeLibraryBtn->Connect(wxEVT_ENTER_WINDOW, (wxObjectEventFunction)(wxEventFunction)(wxMouseEventFunction)&wxCDMLibraryHelpDialog::OnCMakeListsEnter,NULL,this);
+  editCMakeLibraryBtn->Connect(wxEVT_LEAVE_WINDOW, (wxObjectEventFunction)(wxEventFunction)(wxMouseEventFunction)&wxCDMLibraryHelpDialog::OnCMakeListsExit,NULL,this);
+  wxButton* editCMakeLibBtn= new wxButton(this, ID_BUTTON_OPENPROJECT, wxT("Open Lib's directory CMakeLists file"));
+  editCMakeLibBtn->Connect(wxEVT_ENTER_WINDOW, (wxObjectEventFunction)(wxEventFunction)(wxMouseEventFunction)&wxCDMLibraryHelpDialog::OnCMakeListsEnter,NULL,this);
+  editCMakeLibBtn->Connect(wxEVT_LEAVE_WINDOW, (wxObjectEventFunction)(wxEventFunction)(wxMouseEventFunction)&wxCDMLibraryHelpDialog::OnCMakeListsExit,NULL,this);
 
-  v_sizer1->Add(editCMakePKGBtn, 0, wxEXPAND | wxLEFT | wxRIGHT, 15);
-  v_sizer1->Add(editCMakePRJBtn, 0, wxEXPAND | wxLEFT | wxRIGHT, 15);
+  v_sizer1->Add(editCMakeLibraryBtn, 0, wxEXPAND | wxLEFT | wxRIGHT, 15);
+  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);
 
@@ -132,23 +138,125 @@ void wxCDMLibraryHelpDialog::OnFinish(wxCommandEvent& event)
 
 void wxCDMLibraryHelpDialog::OnCMakeLists(wxCommandEvent& event)
 {
-  //TODO: implement method
-  std::cout << "OnCMakeLists not implemented yet." << std::endl;
-  event.Skip();
+  std::string* result;
+
+  if((int)((wxButton*)event.GetEventObject())->GetId() == (int)ID_BUTTON_EDIT_CMAKELISTSFILE)
+    {
+
+      if(!this->library->OpenCMakeListsFile(result))
+        wxMessageBox(crea::std2wx(*result),_T("Open CMakeLists File - Error!"),wxOK | wxICON_ERROR);
+
+      wxCommandEvent* newEvent = new wxCommandEvent(wxEVT_COMMAND_LIST_ITEM_DESELECTED);
+
+      if(this->library->GetCMakeLists() != NULL)
+        {
+          int CMId = this->library->GetCMakeLists()->GetId();
+          newEvent->SetInt(CMId);
+          newEvent->SetId(0);
+          wxPostEvent(this->GetParent(), *newEvent);
+        }
+    }
+  else if(((wxButton*)event.GetEventObject())->GetId() == ID_BUTTON_OPENPROJECT)
+    {
+      modelCDMIProjectTreeNode* node = this->library;
+      while (node != NULL && dynamic_cast<modelCDMLib*>(node) == NULL)
+        {
+          node = node->GetParent();
+        }
+      if (node != NULL)
+        {
+          if(!((modelCDMLib*)node)->OpenCMakeListsFile(result))
+            wxMessageBox(crea::std2wx(*result),_T("Open CMakeLists File - Error!"),wxOK | wxICON_ERROR);
+
+          wxCommandEvent* newEvent = new wxCommandEvent(wxEVT_COMMAND_LIST_ITEM_DESELECTED);
+
+          if(((modelCDMLib*)node)->GetCMakeLists() != NULL)
+            {
+              int CMId = ((modelCDMLib*)node)->GetCMakeLists()->GetId();
+              newEvent->SetInt(CMId);
+              newEvent->SetId(0);
+              wxPostEvent(this->GetParent(), *newEvent);
+            }
+        }
+      else
+        {
+          wxMessageBox(crea::std2wx("No project CMakeLists file was found."),_T("Open CMakeLists File - Error!"),wxOK | wxICON_ERROR);
+        }
+    }
 }
 
 void wxCDMLibraryHelpDialog::OnCMakeListsEnter(wxMouseEvent& event)
 {
-  //TODO: implement method
-  std::cout << "OnCMakeListsEnter not implemented yet." << std::endl;
+  if(((wxButton*)event.GetEventObject())->GetId() == ID_BUTTON_EDIT_CMAKELISTSFILE)
+    {
+      wxCommandEvent* newEvent = new wxCommandEvent(wxEVT_COMMAND_LIST_ITEM_SELECTED);
+
+      if(this->library->GetCMakeLists() != NULL)
+        {
+          int CMId = this->library->GetCMakeLists()->GetId();
+          newEvent->SetInt(CMId);
+          newEvent->SetId(0);
+          wxPostEvent(this->GetParent(), *newEvent);
+        }
+    }
+  else if(((wxButton*)event.GetEventObject())->GetId() == ID_BUTTON_OPENPROJECT)
+    {
+      modelCDMIProjectTreeNode* node = this->library;
+      while (node != NULL && dynamic_cast<modelCDMLib*>(node) == NULL)
+        {
+          node = node->GetParent();
+        }
+      if (node != NULL)
+        {
+          wxCommandEvent* newEvent = new wxCommandEvent(wxEVT_COMMAND_LIST_ITEM_SELECTED);
+
+          if(((modelCDMLib*)node)->GetCMakeLists() != NULL)
+            {
+              int CMId = ((modelCDMLib*)node)->GetCMakeLists()->GetId();
+              newEvent->SetInt(CMId);
+              newEvent->SetId(0);
+              wxPostEvent(this->GetParent(), *newEvent);
+            }
+        }
+    }
   event.Skip();
 }
 
 void wxCDMLibraryHelpDialog::OnCMakeListsExit(wxMouseEvent& event)
 {
-  //TODO: implement method
-  std::cout << "OnCMakeListsExit not implemented yet." << std::endl;
-  event.Skip();
+  if(((wxButton*)event.GetEventObject())->GetId() == ID_BUTTON_EDIT_CMAKELISTSFILE)
+      {
+        wxCommandEvent* newEvent = new wxCommandEvent(wxEVT_COMMAND_LIST_ITEM_DESELECTED);
+
+        if(this->library->GetCMakeLists() != NULL)
+          {
+            int CMId = this->library->GetCMakeLists()->GetId();
+            newEvent->SetInt(CMId);
+            newEvent->SetId(0);
+            wxPostEvent(this->GetParent(), *newEvent);
+          }
+      }
+    else if(((wxButton*)event.GetEventObject())->GetId() == ID_BUTTON_OPENPROJECT)
+      {
+        modelCDMIProjectTreeNode* node = this->library;
+        while (node != NULL && dynamic_cast<modelCDMLib*>(node) == NULL)
+          {
+            node = node->GetParent();
+          }
+        if (node != NULL)
+          {
+            wxCommandEvent* newEvent = new wxCommandEvent(wxEVT_COMMAND_LIST_ITEM_DESELECTED);
+
+            if(((modelCDMLib*)node)->GetCMakeLists() != NULL)
+              {
+                int CMId = ((modelCDMLib*)node)->GetCMakeLists()->GetId();
+                newEvent->SetInt(CMId);
+                newEvent->SetId(0);
+                wxPostEvent(this->GetParent(), *newEvent);
+              }
+          }
+      }
+    event.Skip();
 }
 
 void wxCDMLibraryHelpDialog::OnDisableHelp(wxCommandEvent& event)
index 0a30fa55f8bccd6eaf3f08564b88f30bae83841a..c7b468eeb2739b27a3887660c2949d3548d655a2 100644 (file)
 
 #include "creaDevManagerIds.h"
 
+#include "modelCDMProject.h"
+
 BEGIN_EVENT_TABLE(wxCDMPackageHelpDialog, wxDialog)
+EVT_BUTTON(ID_BUTTON_OPENPROJECT, wxCDMPackageHelpDialog::OnCMakeLists)
+EVT_BUTTON(ID_BUTTON_EDIT_CMAKELISTSFILE, wxCDMPackageHelpDialog::OnCMakeLists)
 EVT_BUTTON(ID_BUTTON_CANCEL, wxCDMPackageHelpDialog::OnFinish)
 EVT_CHECKBOX(ID_CHECKBOX_DISABLE_HELP, wxCDMPackageHelpDialog::OnDisableHelp)
 END_EVENT_TABLE()
@@ -105,11 +109,15 @@ void wxCDMPackageHelpDialog::CreateControls()
   );
   v_sizer1->Add(instruction, 0,wxEXPAND | wxALL, 5);
 
-  wxButton* editCMakePKGBtn = new wxButton(this, ID_BUTTON_EDIT_CMAKELISTSFILE, wxT("Open Package's directory CMakeLists file"));
-  wxButton* editCMakePRJBtn= new wxButton(this, ID_BUTTON_OPENPROJECT, wxT("Open Project's directory CMakeLists file"));
+  wxButton* editCMakePkgBtn = new wxButton(this, ID_BUTTON_EDIT_CMAKELISTSFILE, wxT("Open Package's directory CMakeLists file"));
+  editCMakePkgBtn->Connect(wxEVT_ENTER_WINDOW, (wxObjectEventFunction)(wxEventFunction)(wxMouseEventFunction)&wxCDMPackageHelpDialog::OnCMakeListsEnter,NULL,this);
+  editCMakePkgBtn->Connect(wxEVT_LEAVE_WINDOW, (wxObjectEventFunction)(wxEventFunction)(wxMouseEventFunction)&wxCDMPackageHelpDialog::OnCMakeListsExit,NULL,this);
+  wxButton* editCMakePrjBtn= new wxButton(this, ID_BUTTON_OPENPROJECT, wxT("Open Project's directory CMakeLists file"));
+  editCMakePrjBtn->Connect(wxEVT_ENTER_WINDOW, (wxObjectEventFunction)(wxEventFunction)(wxMouseEventFunction)&wxCDMPackageHelpDialog::OnCMakeListsEnter,NULL,this);
+  editCMakePrjBtn->Connect(wxEVT_LEAVE_WINDOW, (wxObjectEventFunction)(wxEventFunction)(wxMouseEventFunction)&wxCDMPackageHelpDialog::OnCMakeListsExit,NULL,this);
 
-  v_sizer1->Add(editCMakePKGBtn, 0, wxEXPAND | wxLEFT | wxRIGHT, 15);
-  v_sizer1->Add(editCMakePRJBtn, 0, wxEXPAND | wxLEFT | wxRIGHT, 15);
+  v_sizer1->Add(editCMakePkgBtn, 0, wxEXPAND | wxLEFT | wxRIGHT, 15);
+  v_sizer1->Add(editCMakePrjBtn, 0, wxEXPAND | wxLEFT | wxRIGHT, 15);
 
   v_sizer1->Add(new wxCheckBox(this, ID_CHECKBOX_DISABLE_HELP, wxT("&Disable help")), 0, wxALIGN_RIGHT | wxRIGHT, 10);
 
@@ -119,6 +127,129 @@ void wxCDMPackageHelpDialog::CreateControls()
   //v_sizer1->RecalcSizes();
 }
 
+void wxCDMPackageHelpDialog::OnCMakeLists(wxCommandEvent& event)
+{
+  std::string* result;
+
+  if((int)((wxButton*)event.GetEventObject())->GetId() == (int)ID_BUTTON_EDIT_CMAKELISTSFILE)
+    {
+
+      if(!this->package->OpenCMakeListsFile(result))
+        wxMessageBox(crea::std2wx(*result),_T("Open CMakeLists File - Error!"),wxOK | wxICON_ERROR);
+
+      wxCommandEvent* newEvent = new wxCommandEvent(wxEVT_COMMAND_LIST_ITEM_DESELECTED);
+
+      if(this->package->GetCMakeLists() != NULL)
+        {
+          int CMId = this->package->GetCMakeLists()->GetId();
+          newEvent->SetInt(CMId);
+          newEvent->SetId(0);
+          wxPostEvent(this->GetParent(), *newEvent);
+        }
+    }
+  else if(((wxButton*)event.GetEventObject())->GetId() == ID_BUTTON_OPENPROJECT)
+    {
+      modelCDMIProjectTreeNode* node = this->package;
+      while (node != NULL && dynamic_cast<modelCDMProject*>(node) == NULL)
+        {
+          node = node->GetParent();
+        }
+      if (node != NULL)
+        {
+          if(!((modelCDMProject*)node)->OpenCMakeListsFile(result))
+            wxMessageBox(crea::std2wx(*result),_T("Open CMakeLists File - Error!"),wxOK | wxICON_ERROR);
+
+          wxCommandEvent* newEvent = new wxCommandEvent(wxEVT_COMMAND_LIST_ITEM_DESELECTED);
+
+          if(((modelCDMProject*)node)->GetCMakeLists() != NULL)
+            {
+              int CMId = ((modelCDMProject*)node)->GetCMakeLists()->GetId();
+              newEvent->SetInt(CMId);
+              newEvent->SetId(0);
+              wxPostEvent(this->GetParent(), *newEvent);
+            }
+        }
+      else
+        {
+          wxMessageBox(crea::std2wx("No project CMakeLists file was found."),_T("Open CMakeLists File - Error!"),wxOK | wxICON_ERROR);
+        }
+    }
+}
+
+void wxCDMPackageHelpDialog::OnCMakeListsEnter(wxMouseEvent& event)
+{
+  if(((wxButton*)event.GetEventObject())->GetId() == ID_BUTTON_EDIT_CMAKELISTSFILE)
+    {
+      wxCommandEvent* newEvent = new wxCommandEvent(wxEVT_COMMAND_LIST_ITEM_SELECTED);
+
+      if(this->package->GetCMakeLists() != NULL)
+        {
+          int CMId = this->package->GetCMakeLists()->GetId();
+          newEvent->SetInt(CMId);
+          newEvent->SetId(0);
+          wxPostEvent(this->GetParent(), *newEvent);
+        }
+    }
+  else if(((wxButton*)event.GetEventObject())->GetId() == ID_BUTTON_OPENPROJECT)
+    {
+      modelCDMIProjectTreeNode* node = this->package;
+      while (node != NULL && dynamic_cast<modelCDMProject*>(node) == NULL)
+        {
+          node = node->GetParent();
+        }
+      if (node != NULL)
+        {
+          wxCommandEvent* newEvent = new wxCommandEvent(wxEVT_COMMAND_LIST_ITEM_SELECTED);
+
+          if(((modelCDMProject*)node)->GetCMakeLists() != NULL)
+            {
+              int CMId = ((modelCDMProject*)node)->GetCMakeLists()->GetId();
+              newEvent->SetInt(CMId);
+              newEvent->SetId(0);
+              wxPostEvent(this->GetParent(), *newEvent);
+            }
+        }
+    }
+  event.Skip();
+}
+
+void wxCDMPackageHelpDialog::OnCMakeListsExit(wxMouseEvent& event)
+{
+  if(((wxButton*)event.GetEventObject())->GetId() == ID_BUTTON_EDIT_CMAKELISTSFILE)
+    {
+      wxCommandEvent* newEvent = new wxCommandEvent(wxEVT_COMMAND_LIST_ITEM_DESELECTED);
+
+      if(this->package->GetCMakeLists() != NULL)
+        {
+          int CMId = this->package->GetCMakeLists()->GetId();
+          newEvent->SetInt(CMId);
+          newEvent->SetId(0);
+          wxPostEvent(this->GetParent(), *newEvent);
+        }
+    }
+  else if(((wxButton*)event.GetEventObject())->GetId() == ID_BUTTON_OPENPROJECT)
+    {
+      modelCDMIProjectTreeNode* node = this->package;
+      while (node != NULL && dynamic_cast<modelCDMProject*>(node) == NULL)
+        {
+          node = node->GetParent();
+        }
+      if (node != NULL)
+        {
+          wxCommandEvent* newEvent = new wxCommandEvent(wxEVT_COMMAND_LIST_ITEM_DESELECTED);
+
+          if(((modelCDMProject*)node)->GetCMakeLists() != NULL)
+            {
+              int CMId = ((modelCDMProject*)node)->GetCMakeLists()->GetId();
+              newEvent->SetInt(CMId);
+              newEvent->SetId(0);
+              wxPostEvent(this->GetParent(), *newEvent);
+            }
+        }
+    }
+  event.Skip();
+}
+
 void wxCDMPackageHelpDialog::OnFinish(wxCommandEvent& event)
 {
   this->EndDialog(wxID_CANCEL);