]> Creatis software - crea.git/commitdiff
Feature #1711
authorDaniel Gonzalez <daniel.gonzalez@creatis.insa-lyon.fr>
Thu, 13 Dec 2012 16:05:23 +0000 (17:05 +0100)
committerDaniel Gonzalez <daniel.gonzalez@creatis.insa-lyon.fr>
Thu, 13 Dec 2012 16:05:23 +0000 (17:05 +0100)
CreaDevManager application implementation

- Setting up links highlighting

lib/creaDevManagerLib/wxCDMLibDescriptionPanel.cpp
lib/creaDevManagerLib/wxCDMLibDescriptionPanel.h
lib/creaDevManagerLib/wxCDMMainFrame.cpp
lib/creaDevManagerLib/wxCDMMainFrame.h
lib/creaDevManagerLib/wxCDMPackageManagerPanel.cpp
lib/creaDevManagerLib/wxCDMPackageManagerPanel.h

index 07f9cc153557c44250cb6d4ed375d95009df57f7..88d598bc6141a0cc585a30a426c198735bee3c95 100644 (file)
@@ -108,6 +108,8 @@ void wxCDMLibDescriptionPanel::CreateControls()
       std::string tt = "Name: " + libraries[i]->GetName() + "\n";
       tt += "Location: " + libraries[i]->GetPath();
       pLibrarylk->SetToolTip(crea::std2wx(tt.c_str()));
+      pLibrarylk->Connect(wxEVT_ENTER_WINDOW, (wxObjectEventFunction)(wxEventFunction)(wxMouseEventFunction)&wxCDMLibDescriptionPanel::OnMouseEnter,NULL,this);
+      pLibrarylk->Connect(wxEVT_LEAVE_WINDOW, (wxObjectEventFunction)(wxEventFunction)(wxMouseEventFunction)&wxCDMLibDescriptionPanel::OnMouseExit,NULL,this);
       propertiesPanelSizer -> Add(pLibrarylk, 0, wxALIGN_LEFT | wxALL, 5);
     }
 
@@ -216,3 +218,43 @@ void wxCDMLibDescriptionPanel::OnBtnOpenFolder(wxCommandEvent& event)
   std::cerr << "Event OnBtnOpenFolder not implemented" << std::endl;
   event.Skip();
 }
+
+void wxCDMLibDescriptionPanel::OnMouseEnter(wxMouseEvent& event)
+{
+  wxCommandEvent* newEvent = new wxCommandEvent(wxEVT_COMMAND_LIST_ITEM_SELECTED);
+  std::string LibName = crea::wx2std(((wxHyperlinkCtrl*)event.GetEventObject())->GetURL());
+  int lbId = 0;
+  std::vector<modelCDMLibrary*> libraries = this->lib->GetLibraries();
+  for (int i = 0; i < libraries.size(); i++)
+    {
+      if(libraries[i]->GetName() == LibName)
+        {
+          lbId = libraries[i]->GetId();
+          break;
+        }
+    }
+  newEvent->SetInt(lbId);
+  newEvent->SetId(0);
+  wxPostEvent(this->GetParent(), *newEvent);
+  event.Skip();
+}
+
+void wxCDMLibDescriptionPanel::OnMouseExit(wxMouseEvent& event)
+{
+  wxCommandEvent* newEvent = new wxCommandEvent(wxEVT_COMMAND_LIST_ITEM_DESELECTED);
+  std::string LibName = crea::wx2std(((wxHyperlinkCtrl*)event.GetEventObject())->GetURL());
+  int lbId = 0;
+  std::vector<modelCDMLibrary*> libraries = this->lib->GetLibraries();
+  for (int i = 0; i < libraries.size(); i++)
+    {
+      if(libraries[i]->GetName() == LibName)
+        {
+          lbId = libraries[i]->GetId();
+          break;
+        }
+    }
+  newEvent->SetInt(lbId);
+  newEvent->SetId(0);
+  wxPostEvent(this->GetParent(), *newEvent);
+  event.Skip();
+}
index b059a5cf441112a85c5b09157bffbbe91649ceff..17922decc8600fc127178906fc3a9b9035cf411e 100644 (file)
@@ -80,6 +80,9 @@ protected:
   void OnBtnReturn(wxCommandEvent& event);
   void OnBtnOpenFolder(wxCommandEvent& event);
 
+  void OnMouseEnter(wxMouseEvent& event);
+  void OnMouseExit(wxMouseEvent& event);
+
 };
 
 #endif /* WXCDMLIBDESCRIPTIONPANEL_H_ */
index 7c2bf5aab6e418596b447b2172133b183ecd6f44..b2cc0f0b197402be28b0e0080e627d3f90be2d29 100755 (executable)
@@ -82,6 +82,8 @@ EVT_BUTTON(ID_BUTTON_NEWPROJECT, wxCDMMainFrame::OnMenuNewProject)
 EVT_BUTTON(ID_BUTTON_OPENPROJECT, wxCDMMainFrame::OnMenuOpenProject)
 EVT_TREE_SEL_CHANGING(ID_TREE_PROJECTS, wxCDMMainFrame::OnTreeSelectionChanged)
 EVT_COMMAND(wxID_ANY, wxEVT_DISPLAY_CHANGED, wxCDMMainFrame::OnCreationComplete)
+EVT_COMMAND(wxID_ANY, wxEVT_COMMAND_LIST_ITEM_SELECTED, wxCDMMainFrame::OnElementSelected)
+EVT_COMMAND(wxID_ANY, wxEVT_COMMAND_LIST_ITEM_DESELECTED, wxCDMMainFrame::OnElementDeselected)
 END_EVENT_TABLE()
 
 wxCDMMainFrame::wxCDMMainFrame(
@@ -850,12 +852,14 @@ void wxCDMMainFrame::OnCreationComplete(wxCommandEvent& event)
   case 0:
     //select out old one to generate selection event
     this->tree_Projects->SelectItem(event.GetInt(), true);
+    this->tree_Projects->Expand(event.GetInt());
     break;
   case 1:
     wxPanel* description = NULL;
     if(event.GetString() == wxT("manage_packages"))
       {
         this->tree_Projects->SelectItem(this->model->GetProject()->GetId(), false);
+        this->tree_Projects->Expand(this->model->GetProject()->GetId());
         description = new wxCDMPackageManagerPanel(
             this,
             this->model->GetProject(),
@@ -869,11 +873,13 @@ void wxCDMMainFrame::OnCreationComplete(wxCommandEvent& event)
     else if(event.GetString() == wxT("manage_libraries"))
       {
         this->tree_Projects->SelectItem(this->model->GetProject()->GetLib()->GetId(), true);
+        this->tree_Projects->Expand(this->model->GetProject()->GetLib()->GetId());
         break;
       }
     else if(event.GetString() == wxT("manage_applications"))
       {
         this->tree_Projects->SelectItem(this->model->GetProject()->GetAppli()->GetId(), true);
+        this->tree_Projects->Expand(this->model->GetProject()->GetAppli()->GetId());
         break;
       }
 
@@ -898,3 +904,20 @@ void wxCDMMainFrame::OnCreationComplete(wxCommandEvent& event)
   }
   event.Skip();
 }
+
+void wxCDMMainFrame::OnElementSelected(wxCommandEvent& event)
+{
+  //std::cout << "element " << event.GetInt() << std::endl;
+  this->tree_Projects->SetItemBold(event.GetInt(), true);
+  this->tree_Projects->SetItemTextColour(event.GetInt(), wxColour(0,0,255));
+  this->tree_Projects->UpdateWindowUI(wxUPDATE_UI_RECURSE);
+  auiManager.Update();
+}
+
+void wxCDMMainFrame::OnElementDeselected(wxCommandEvent& event)
+{
+  this->tree_Projects->SetItemBold(event.GetInt(), false);
+  this->tree_Projects->SetItemTextColour(event.GetInt(), wxColour(0,0,0));
+  this->tree_Projects->UpdateWindowUI(wxUPDATE_UI_RECURSE);
+  auiManager.Update();
+}
index 6a6b2420f974bcd7c44d35c6f27ad3ac3be2f16e..18f00a05aa8410de1a6fc6f4a8dcfa817db197d6 100755 (executable)
@@ -123,6 +123,10 @@ protected:
 
   //PropertiesPanel
   void OnCreationComplete(wxCommandEvent& event);
+
+  //Element higlighted
+  void OnElementSelected(wxCommandEvent& event);
+  void OnElementDeselected(wxCommandEvent& event);
 };
 
 #endif
index dbd6e73d0495371d5ec3919ffdf69520b0db08d5..8ace0666d906a12b30979a340cc2efc46802aae9 100644 (file)
@@ -108,6 +108,8 @@ void wxCDMPackageManagerPanel::CreateControls()
       std::string tt = "Author: " + packages[i]->GetAuthors() + "\nDescription: " + packages[i]->GetDescription();
       pPackagelk->SetToolTip(crea::std2wx(tt));
       propertiesPanelSizer -> Add(pPackagelk, 0, wxALIGN_LEFT | wxALL, 5);
+      pPackagelk->Connect(wxEVT_ENTER_WINDOW, (wxObjectEventFunction)(wxEventFunction)(wxMouseEventFunction)&wxCDMPackageManagerPanel::OnMouseEnter,NULL,this);
+      pPackagelk->Connect(wxEVT_LEAVE_WINDOW, (wxObjectEventFunction)(wxEventFunction)(wxMouseEventFunction)&wxCDMPackageManagerPanel::OnMouseExit,NULL,this);
     }
 
   propertiesPanel->SetSizer(propertiesPanelSizer);
@@ -214,4 +216,45 @@ void wxCDMPackageManagerPanel::OnBtnEditCMakeLists(wxCommandEvent& event)
   event.Skip();
 }
 
+void wxCDMPackageManagerPanel::OnMouseEnter(wxMouseEvent& event)
+{
+  wxCommandEvent* newEvent = new wxCommandEvent(wxEVT_COMMAND_LIST_ITEM_SELECTED);
+  std::string PkgName = crea::wx2std(((wxHyperlinkCtrl*)event.GetEventObject())->GetURL());
+  int pkgId = 0;
+  std::vector<modelCDMPackage*> packages = this->project->GetPackages();
+  for (int i = 0; i < packages.size(); i++)
+    {
+      if(packages[i]->GetName() == PkgName)
+        {
+          pkgId = packages[i]->GetId();
+          break;
+        }
+    }
+  newEvent->SetInt(pkgId);
+  newEvent->SetId(0);
+  wxPostEvent(this->GetParent(), *newEvent);
+  event.Skip();
+}
+
+void wxCDMPackageManagerPanel::OnMouseExit(wxMouseEvent& event)
+{
+  wxCommandEvent* newEvent = new wxCommandEvent(wxEVT_COMMAND_LIST_ITEM_DESELECTED);
+  std::string PkgName = crea::wx2std(((wxHyperlinkCtrl*)event.GetEventObject())->GetURL());
+  int pkgId = 0;
+  std::vector<modelCDMPackage*> packages = this->project->GetPackages();
+      project->GetPackages();
+  for (int i = 0; i < packages.size(); i++)
+    {
+      if(packages[i]->GetName() == PkgName)
+        {
+          pkgId = packages[i]->GetId();
+          break;
+        }
+    }
+  newEvent->SetInt(pkgId);
+  newEvent->SetId(0);
+  wxPostEvent(this->GetParent(), *newEvent);
+  event.Skip();
+}
+
 
index aeb3edac6d66d57a944351521e41c214cc31fc05..349e0d80665b1901cdc10f3624c99ebdbb95a040 100644 (file)
@@ -38,6 +38,7 @@
 #include <creaWx.h>
 #include <wx/panel.h>
 #include <wx/hyperlink.h>
+#include <wx/event.h>
 
 #include "modelCDMProject.h"
 
@@ -80,6 +81,8 @@ protected:
   void OnBtnCreatePackage(wxCommandEvent& event);
   void OnBtnEditCMakeLists(wxCommandEvent& event);
 
+  void OnMouseEnter(wxMouseEvent& event);
+  void OnMouseExit(wxMouseEvent& event);
 };
 
 #endif /* WXCDMPACKAGEMANAGERPANEL_H_ */