From: Daniel Gonzalez Date: Thu, 13 Dec 2012 16:05:23 +0000 (+0100) Subject: Feature #1711 X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=commitdiff_plain;h=036496dbec6fb28a616b9fa5b4d5b80f72fb040f;p=crea.git Feature #1711 CreaDevManager application implementation - Setting up links highlighting --- diff --git a/lib/creaDevManagerLib/wxCDMLibDescriptionPanel.cpp b/lib/creaDevManagerLib/wxCDMLibDescriptionPanel.cpp index 07f9cc1..88d598b 100644 --- a/lib/creaDevManagerLib/wxCDMLibDescriptionPanel.cpp +++ b/lib/creaDevManagerLib/wxCDMLibDescriptionPanel.cpp @@ -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 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 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(); +} diff --git a/lib/creaDevManagerLib/wxCDMLibDescriptionPanel.h b/lib/creaDevManagerLib/wxCDMLibDescriptionPanel.h index b059a5c..17922de 100644 --- a/lib/creaDevManagerLib/wxCDMLibDescriptionPanel.h +++ b/lib/creaDevManagerLib/wxCDMLibDescriptionPanel.h @@ -80,6 +80,9 @@ protected: void OnBtnReturn(wxCommandEvent& event); void OnBtnOpenFolder(wxCommandEvent& event); + void OnMouseEnter(wxMouseEvent& event); + void OnMouseExit(wxMouseEvent& event); + }; #endif /* WXCDMLIBDESCRIPTIONPANEL_H_ */ diff --git a/lib/creaDevManagerLib/wxCDMMainFrame.cpp b/lib/creaDevManagerLib/wxCDMMainFrame.cpp index 7c2bf5a..b2cc0f0 100755 --- a/lib/creaDevManagerLib/wxCDMMainFrame.cpp +++ b/lib/creaDevManagerLib/wxCDMMainFrame.cpp @@ -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(); +} diff --git a/lib/creaDevManagerLib/wxCDMMainFrame.h b/lib/creaDevManagerLib/wxCDMMainFrame.h index 6a6b242..18f00a0 100755 --- a/lib/creaDevManagerLib/wxCDMMainFrame.h +++ b/lib/creaDevManagerLib/wxCDMMainFrame.h @@ -123,6 +123,10 @@ protected: //PropertiesPanel void OnCreationComplete(wxCommandEvent& event); + + //Element higlighted + void OnElementSelected(wxCommandEvent& event); + void OnElementDeselected(wxCommandEvent& event); }; #endif diff --git a/lib/creaDevManagerLib/wxCDMPackageManagerPanel.cpp b/lib/creaDevManagerLib/wxCDMPackageManagerPanel.cpp index dbd6e73..8ace066 100644 --- a/lib/creaDevManagerLib/wxCDMPackageManagerPanel.cpp +++ b/lib/creaDevManagerLib/wxCDMPackageManagerPanel.cpp @@ -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 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 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(); +} + diff --git a/lib/creaDevManagerLib/wxCDMPackageManagerPanel.h b/lib/creaDevManagerLib/wxCDMPackageManagerPanel.h index aeb3eda..349e0d8 100644 --- a/lib/creaDevManagerLib/wxCDMPackageManagerPanel.h +++ b/lib/creaDevManagerLib/wxCDMPackageManagerPanel.h @@ -38,6 +38,7 @@ #include #include #include +#include #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_ */