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

-"Open H" and "Open Cxx" buttons in BlackBoxPanel now highlights the corresponding h and cxx files.

lib/creaDevManagerLib/modelCDMPackageSrc.cpp
lib/creaDevManagerLib/wxCDMBlackBoxDescriptionPanel.cpp
lib/creaDevManagerLib/wxCDMBlackBoxDescriptionPanel.h

index 44481877708dc5c62c1be8440ca7852709b09943..a5f3080c40ec171b0e5bf4337a6507c6073e0097 100644 (file)
@@ -238,13 +238,13 @@ modelCDMBlackBox* modelCDMPackageSrc::CreateBlackBox(
       if (cont)
         {
           std::string stdfileName = crea::wx2std(fileName);
-          header = new modelCDMFile(this, this->path + stdfileName, stdfileName, this->level+1);
+          header = new modelCDMFile(this, this->path + CDMUtilities::SLASH + stdfileName, stdfileName, this->level+1);
         }
       cont = dir.GetFirst(&fileName, crea::std2wx("bb"+package+bbName+".cxx"), wxDIR_FILES);
       if (cont)
         {
           std::string stdfileName = crea::wx2std(fileName);
-          source = new modelCDMFile(this, this->path + stdfileName, stdfileName, this->level+1);
+          source = new modelCDMFile(this, this->path + CDMUtilities::SLASH + stdfileName, stdfileName, this->level+1);
         }
     }
   //if source and header exist
index 6db4e2b2d0ef53ea0592d9a2c39f1996cbef58a8..d7a9c63aec0838ef3a2e1a402878acb13fe45cec 100644 (file)
@@ -176,9 +176,13 @@ void wxCDMBlackBoxDescriptionPanel::CreateControls()
   wxFlexGridSizer* actionsGridSizer = new wxFlexGridSizer(2, 2, 9, 15);
 
   wxButton* openHxxbt = new wxButton(actionsPanel, ID_BUTTON_OPEN_HXX, _T("A. Open .h"));
+  openHxxbt->Connect(wxEVT_ENTER_WINDOW, (wxObjectEventFunction)(wxEventFunction)(wxMouseEventFunction)&wxCDMBlackBoxDescriptionPanel::OnHxxMouseEnter,NULL,this);
+  openHxxbt->Connect(wxEVT_LEAVE_WINDOW, (wxObjectEventFunction)(wxEventFunction)(wxMouseEventFunction)&wxCDMBlackBoxDescriptionPanel::OnHxxMouseExit,NULL,this);
   openHxxbt->SetToolTip(wxT("Open the .h file in the default text editor."));
   actionsGridSizer->Add(openHxxbt, 1, wxALL | wxEXPAND, 5);
   wxButton* openCxxbt = new wxButton(actionsPanel, ID_BUTTON_OPEN_CXX, _T("B. Open .cxx"));
+  openCxxbt->Connect(wxEVT_ENTER_WINDOW, (wxObjectEventFunction)(wxEventFunction)(wxMouseEventFunction)&wxCDMBlackBoxDescriptionPanel::OnCxxMouseEnter,NULL,this);
+  openCxxbt->Connect(wxEVT_LEAVE_WINDOW, (wxObjectEventFunction)(wxEventFunction)(wxMouseEventFunction)&wxCDMBlackBoxDescriptionPanel::OnCxxMouseExit,NULL,this);
   openCxxbt->SetToolTip(wxT("Open the .cxx file in the default text editor."));
   actionsGridSizer->Add(openCxxbt, 1, wxALL | wxEXPAND, 5);
   wxButton* openFolderbt = new wxButton(actionsPanel, ID_BUTTON_OPEN_FOLDER, _T("C. Open Source Folder"));
@@ -208,18 +212,18 @@ void wxCDMBlackBoxDescriptionPanel::CreateControls()
 void wxCDMBlackBoxDescriptionPanel::OnBtnReturn(wxHyperlinkEvent& event)
 {
   std::vector<modelCDMIProjectTreeNode*> parents = this->blackBox->GetParents();
-    std::string parentURL = crea::wx2std(((wxHyperlinkCtrl*)event.GetEventObject())->GetURL());
-    //std::cout << parentURL << std::endl;
-    for (int i = 0; i < parents.size(); i++)
-      {
-        if (parents[i]->GetPath() == parentURL)
-          {
-            wxCommandEvent* newEvent = new wxCommandEvent(wxEVT_DISPLAY_CHANGED);
-            newEvent->SetInt(parents[i]->GetId());
-            newEvent->SetId(0);
-            wxPostEvent(this->GetParent(), *newEvent);
-          }
-      }
+  std::string parentURL = crea::wx2std(((wxHyperlinkCtrl*)event.GetEventObject())->GetURL());
+  //std::cout << parentURL << std::endl;
+  for (int i = 0; i < parents.size(); i++)
+    {
+      if (parents[i]->GetPath() == parentURL)
+        {
+          wxCommandEvent* newEvent = new wxCommandEvent(wxEVT_DISPLAY_CHANGED);
+          newEvent->SetInt(parents[i]->GetId());
+          newEvent->SetId(0);
+          wxPostEvent(this->GetParent(), *newEvent);
+        }
+    }
 
 }
 
@@ -309,6 +313,18 @@ void wxCDMBlackBoxDescriptionPanel::OnBtnOpenCxx(wxCommandEvent& event)
   std::string* result;
   if(!this->blackBox->OpenCxx(result))
     wxMessageBox(crea::std2wx(*result),_T("Open Source File - Error!"),wxOK | wxICON_ERROR);
+
+  wxCommandEvent* newEvent = new wxCommandEvent(wxEVT_COMMAND_LIST_ITEM_DESELECTED);
+
+  if(this->blackBox->GetSourceFile() != NULL)
+    {
+      int CMId = this->blackBox->GetSourceFile()->GetId();
+      newEvent->SetInt(CMId);
+      newEvent->SetId(0);
+      wxPostEvent(this->GetParent(), *newEvent);
+    }
+
+  event.Skip();
 }
 
 void wxCDMBlackBoxDescriptionPanel::OnBtnOpenHxx(wxCommandEvent& event)
@@ -316,6 +332,18 @@ void wxCDMBlackBoxDescriptionPanel::OnBtnOpenHxx(wxCommandEvent& event)
   std::string* result;
   if(!this->blackBox->OpenHxx(result))
     wxMessageBox(crea::std2wx(*result),_T("Open Header File - Error!"),wxOK | wxICON_ERROR);
+
+  wxCommandEvent* newEvent = new wxCommandEvent(wxEVT_COMMAND_LIST_ITEM_DESELECTED);
+
+  if(this->blackBox->GetHeaderFile() != NULL)
+    {
+      int CMId = this->blackBox->GetHeaderFile()->GetId();
+      newEvent->SetInt(CMId);
+      newEvent->SetId(0);
+      wxPostEvent(this->GetParent(), *newEvent);
+    }
+
+  event.Skip();
 }
 
 void wxCDMBlackBoxDescriptionPanel::OnBtnOpenFolder(wxCommandEvent& event)
@@ -324,3 +352,59 @@ void wxCDMBlackBoxDescriptionPanel::OnBtnOpenFolder(wxCommandEvent& event)
   if(!this->blackBox->OpenInFileExplorer(result))
     wxMessageBox(crea::std2wx(*result),_T("Open Folder - Error!"),wxOK | wxICON_ERROR);
 }
+
+void wxCDMBlackBoxDescriptionPanel::OnCxxMouseEnter(wxMouseEvent& event)
+{
+  wxCommandEvent* newEvent = new wxCommandEvent(wxEVT_COMMAND_LIST_ITEM_SELECTED);
+
+  if(this->blackBox->GetSourceFile() != NULL)
+    {
+      int CMId = this->blackBox->GetSourceFile()->GetId();
+      newEvent->SetInt(CMId);
+      newEvent->SetId(0);
+      wxPostEvent(this->GetParent(), *newEvent);
+    }
+  event.Skip();
+}
+
+void wxCDMBlackBoxDescriptionPanel::OnCxxMouseExit(wxMouseEvent& event)
+{
+  wxCommandEvent* newEvent = new wxCommandEvent(wxEVT_COMMAND_LIST_ITEM_DESELECTED);
+
+  if(this->blackBox->GetSourceFile() != NULL)
+    {
+      int CMId = this->blackBox->GetSourceFile()->GetId();
+      newEvent->SetInt(CMId);
+      newEvent->SetId(0);
+      wxPostEvent(this->GetParent(), *newEvent);
+    }
+  event.Skip();
+}
+
+void wxCDMBlackBoxDescriptionPanel::OnHxxMouseEnter(wxMouseEvent& event)
+{
+  wxCommandEvent* newEvent = new wxCommandEvent(wxEVT_COMMAND_LIST_ITEM_SELECTED);
+
+  if(this->blackBox->GetHeaderFile() != NULL)
+    {
+      int CMId = this->blackBox->GetHeaderFile()->GetId();
+      newEvent->SetInt(CMId);
+      newEvent->SetId(0);
+      wxPostEvent(this->GetParent(), *newEvent);
+    }
+  event.Skip();
+}
+
+void wxCDMBlackBoxDescriptionPanel::OnHxxMouseExit(wxMouseEvent& event)
+{
+  wxCommandEvent* newEvent = new wxCommandEvent(wxEVT_COMMAND_LIST_ITEM_DESELECTED);
+
+  if(this->blackBox->GetHeaderFile() != NULL)
+    {
+      int CMId = this->blackBox->GetHeaderFile()->GetId();
+      newEvent->SetInt(CMId);
+      newEvent->SetId(0);
+      wxPostEvent(this->GetParent(), *newEvent);
+    }
+  event.Skip();
+}
index 27c8dab2bc959f789120abacedb0781087cd29e4..4eeef1ab0853e39b20de5aa07bf1deeb08a72b5f 100644 (file)
@@ -85,6 +85,12 @@ protected:
   void OnBtnOpenHxx(wxCommandEvent& event);
   void OnBtnOpenFolder(wxCommandEvent& event);
 
+  void OnCxxMouseEnter(wxMouseEvent& event);
+  void OnCxxMouseExit(wxMouseEvent& event);
+  void OnHxxMouseEnter(wxMouseEvent& event);
+  void OnHxxMouseExit(wxMouseEvent& event);
+
+
 };
 
 #endif /* WXCDMBLACKBOXDESCRIPTIONPANEL_H_ */