From: Daniel Gonzalez Date: Wed, 16 Jan 2013 14:23:02 +0000 (+0100) Subject: Feature #1711 X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=commitdiff_plain;h=40c574d86b82c2afc5a351f1ad96cc0254008306;p=crea.git Feature #1711 CreaDevManager application implementation -"Open H" and "Open Cxx" buttons in BlackBoxPanel now highlights the corresponding h and cxx files. --- diff --git a/lib/creaDevManagerLib/modelCDMPackageSrc.cpp b/lib/creaDevManagerLib/modelCDMPackageSrc.cpp index 4448187..a5f3080 100644 --- a/lib/creaDevManagerLib/modelCDMPackageSrc.cpp +++ b/lib/creaDevManagerLib/modelCDMPackageSrc.cpp @@ -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 diff --git a/lib/creaDevManagerLib/wxCDMBlackBoxDescriptionPanel.cpp b/lib/creaDevManagerLib/wxCDMBlackBoxDescriptionPanel.cpp index 6db4e2b..d7a9c63 100644 --- a/lib/creaDevManagerLib/wxCDMBlackBoxDescriptionPanel.cpp +++ b/lib/creaDevManagerLib/wxCDMBlackBoxDescriptionPanel.cpp @@ -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 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(); +} diff --git a/lib/creaDevManagerLib/wxCDMBlackBoxDescriptionPanel.h b/lib/creaDevManagerLib/wxCDMBlackBoxDescriptionPanel.h index 27c8dab..4eeef1a 100644 --- a/lib/creaDevManagerLib/wxCDMBlackBoxDescriptionPanel.h +++ b/lib/creaDevManagerLib/wxCDMBlackBoxDescriptionPanel.h @@ -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_ */