From: Daniel Gonzalez Date: Fri, 14 Dec 2012 15:59:26 +0000 (+0100) Subject: Feature #1711 X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=commitdiff_plain;h=fa7a450d70363d66912675f9de918e7c8bb012b6;p=crea.git Feature #1711 CreaDevManager application implementation - Setting up links highlighting in Project and Package Descriptions. - Open Folder in Lib implemented - Open CMakeLists file in Lib implemented --- diff --git a/lib/creaDevManagerLib/modelCDMLib.cpp b/lib/creaDevManagerLib/modelCDMLib.cpp index 21f2167..2403351 100644 --- a/lib/creaDevManagerLib/modelCDMLib.cpp +++ b/lib/creaDevManagerLib/modelCDMLib.cpp @@ -161,16 +161,17 @@ modelCDMLibrary* modelCDMLib::CreateLibrary( bool modelCDMLib::OpenCMakeListsFile(std::string*& result) { - //TODO: implement method - return true; + if (!CDMUtilities::openTextEditor(this->CMakeLists->GetPath())) + return true; + else + { + result = new std::string("Couldn't open CMakeLists file."); + return false; + } } const bool modelCDMLib::Refresh(std::string*& result) { - //TODO: implement method - - - this->type = wxDIR_DIRS; this->name = "lib"; this->level = level; diff --git a/lib/creaDevManagerLib/wxCDMLibDescriptionPanel.cpp b/lib/creaDevManagerLib/wxCDMLibDescriptionPanel.cpp index 313a720..524e64f 100644 --- a/lib/creaDevManagerLib/wxCDMLibDescriptionPanel.cpp +++ b/lib/creaDevManagerLib/wxCDMLibDescriptionPanel.cpp @@ -179,9 +179,9 @@ void wxCDMLibDescriptionPanel::OnBtnCreateLibrary(wxCommandEvent& event) void wxCDMLibDescriptionPanel::OnBtnEditCMakeLists(wxCommandEvent& event) { - //TODO: implement method - std::cerr << "Event OnBtnEditCMakeLists not implemented" << std::endl; - event.Skip(); + std::string* result; + if(!this->lib->OpenCMakeListsFile(result)) + wxMessageBox(crea::std2wx(*result),_T("Open CMakeLists File - Error!"),wxOK | wxICON_ERROR); } void wxCDMLibDescriptionPanel::OnLnkLibrarySelect(wxHyperlinkEvent& event) @@ -219,9 +219,9 @@ void wxCDMLibDescriptionPanel::OnBtnReturn(wxCommandEvent& event) void wxCDMLibDescriptionPanel::OnBtnOpenFolder(wxCommandEvent& event) { - //TODO: implement method - std::cerr << "Event OnBtnOpenFolder not implemented" << std::endl; - event.Skip(); + std::string* result; + if(!this->lib->OpenInFileExplorer(result)) + wxMessageBox(crea::std2wx(*result),_T("Open Folder - Error!"),wxOK | wxICON_ERROR); } void wxCDMLibDescriptionPanel::OnMouseEnter(wxMouseEvent& event) diff --git a/lib/creaDevManagerLib/wxCDMMainFrame.cpp b/lib/creaDevManagerLib/wxCDMMainFrame.cpp index b2cc0f0..1484059 100755 --- a/lib/creaDevManagerLib/wxCDMMainFrame.cpp +++ b/lib/creaDevManagerLib/wxCDMMainFrame.cpp @@ -224,7 +224,7 @@ void wxCDMMainFrame::CreateControls() auiManager.AddPane(panel_Properties, wxAuiPaneInfo().BestSize(600,400).CenterPane().Name(wxT("panel_Properties")).Caption(wxT("")).CloseButton(false)); - auiManager.AddPane(tree_Projects, wxAuiPaneInfo().Left().MinSize(300,300).BestSize(300,400).CloseButton(false).Name(wxT("tree_Projects")).Caption(wxT("Project Tree")).CloseButton(false)); + auiManager.AddPane(tree_Projects, wxAuiPaneInfo().Right().MinSize(300,300).BestSize(300,400).CloseButton(false).Name(wxT("tree_Projects")).Caption(wxT("Project Tree")).CloseButton(false)); wxString pers = auiManager.SavePerspective(); diff --git a/lib/creaDevManagerLib/wxCDMPackageDescriptionPanel.cpp b/lib/creaDevManagerLib/wxCDMPackageDescriptionPanel.cpp index d6271ba..d32ed86 100644 --- a/lib/creaDevManagerLib/wxCDMPackageDescriptionPanel.cpp +++ b/lib/creaDevManagerLib/wxCDMPackageDescriptionPanel.cpp @@ -240,6 +240,17 @@ void wxCDMPackageDescriptionPanel::OnBtnEditCMakeLists(wxCommandEvent& event) { //TODO: implement method std::cerr << "Event OnBtnEditCMakeLists not implemented" << std::endl; + + 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); + } + event.Skip(); } diff --git a/lib/creaDevManagerLib/wxCDMProjectDescriptionPanel.cpp b/lib/creaDevManagerLib/wxCDMProjectDescriptionPanel.cpp index e49e289..4f60890 100644 --- a/lib/creaDevManagerLib/wxCDMProjectDescriptionPanel.cpp +++ b/lib/creaDevManagerLib/wxCDMProjectDescriptionPanel.cpp @@ -177,6 +177,8 @@ void wxCDMProjectDescriptionPanel::CreateControls() { wxButton* libMgrbt = new wxButton(actionsPanel, ID_BUTTON_GOTO_LIB_MANAGER, _T("Library Manager")); libMgrbt->SetToolTip(wxT("Find the current available libraries into this project. You can also create new Libraries in this section as well as edit the lib folder's CMakeLists.txt file.")); + libMgrbt->Connect(wxEVT_ENTER_WINDOW, (wxObjectEventFunction)(wxEventFunction)(wxMouseEventFunction)&wxCDMProjectDescriptionPanel::OnLibMouseEnter,NULL,this); + libMgrbt->Connect(wxEVT_LEAVE_WINDOW, (wxObjectEventFunction)(wxEventFunction)(wxMouseEventFunction)&wxCDMProjectDescriptionPanel::OnLibMouseExit,NULL,this); actionsPanelSizer->Add(libMgrbt, 0, wxALL, 5); } // appli manager @@ -185,11 +187,15 @@ void wxCDMProjectDescriptionPanel::CreateControls() { wxButton* appliMgrbt = new wxButton(actionsPanel, ID_BUTTON_GOTO_APPLI_MANAGER, _T("Application Manager")); appliMgrbt->SetToolTip(wxT("Find the current available applications into this project. You can also create new Applications in this section as well as edit the appli folder's CMakeLists.txt file.")); + appliMgrbt->Connect(wxEVT_ENTER_WINDOW, (wxObjectEventFunction)(wxEventFunction)(wxMouseEventFunction)&wxCDMProjectDescriptionPanel::OnAppliMouseEnter,NULL,this); + appliMgrbt->Connect(wxEVT_LEAVE_WINDOW, (wxObjectEventFunction)(wxEventFunction)(wxMouseEventFunction)&wxCDMProjectDescriptionPanel::OnAppliMouseExit,NULL,this); actionsPanelSizer->Add(appliMgrbt, 0, wxALL, 5); } // edit CMakeLists file wxButton* editCMakebt = new wxButton(actionsPanel, ID_BUTTON_EDIT_CMAKELISTSFILE, _T("Edit CMakeLists File")); editCMakebt->SetToolTip(wxT("Edit the CMakeLists.txt file of this project.")); + editCMakebt->Connect(wxEVT_ENTER_WINDOW, (wxObjectEventFunction)(wxEventFunction)(wxMouseEventFunction)&wxCDMProjectDescriptionPanel::OnCMakeMouseEnter,NULL,this); + editCMakebt->Connect(wxEVT_LEAVE_WINDOW, (wxObjectEventFunction)(wxEventFunction)(wxMouseEventFunction)&wxCDMProjectDescriptionPanel::OnCMakeMouseExit,NULL,this); actionsPanelSizer->Add(editCMakebt, 0, wxALL, 5); //SetPanel sizer and box @@ -220,6 +226,17 @@ void wxCDMProjectDescriptionPanel::OnBtnManageLibraries(wxCommandEvent& event) newEvent->SetId(1); newEvent->SetString(wxT("manage_libraries")); wxPostEvent(this->GetParent(), *newEvent); + + wxCommandEvent* newEvent1 = new wxCommandEvent(wxEVT_COMMAND_LIST_ITEM_DESELECTED); + + if(this->project->GetLib() != NULL) + { + int CMId = this->project->GetLib()->GetId(); + newEvent1->SetInt(CMId); + newEvent1->SetId(0); + wxPostEvent(this->GetParent(), *newEvent1); + } + event.Skip(); } @@ -229,6 +246,17 @@ void wxCDMProjectDescriptionPanel::OnBtnManageApplications(wxCommandEvent& event newEvent->SetId(1); newEvent->SetString(wxT("manage_applications")); wxPostEvent(this->GetParent(), *newEvent); + + wxCommandEvent* newEvent1 = new wxCommandEvent(wxEVT_COMMAND_LIST_ITEM_DESELECTED); + + if(this->project->GetAppli() != NULL) + { + int CMId = this->project->GetAppli()->GetId(); + newEvent1->SetInt(CMId); + newEvent1->SetId(0); + wxPostEvent(this->GetParent(), *newEvent1); + } + event.Skip(); } @@ -237,6 +265,16 @@ void wxCDMProjectDescriptionPanel::OnBtnEditCMakeLists(wxCommandEvent& event) std::string* result; if(!this->project->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->project->GetCMakeLists() != NULL) + { + int CMId = this->project->GetCMakeLists()->GetId(); + newEvent->SetInt(CMId); + newEvent->SetId(0); + wxPostEvent(this->GetParent(), *newEvent); + } } void @@ -257,11 +295,10 @@ wxCDMProjectDescriptionPanel::OnBtnOpenFolder(wxCommandEvent& event) { std::string* result; if(!this->project->OpenInFileExplorer(result)) - wxMessageBox(crea::std2wx(*result),_T("Open File - Error!"),wxOK | wxICON_ERROR); + wxMessageBox(crea::std2wx(*result),_T("Open Folder - Error!"),wxOK | wxICON_ERROR); } -void -wxCDMProjectDescriptionPanel::OnBtnSetVersion(wxCommandEvent& event) +void wxCDMProjectDescriptionPanel::OnBtnSetVersion(wxCommandEvent& event) { //TODO: implement method std::cerr << "Event OnBtnSetVersion not implemented" << std::endl; @@ -290,3 +327,87 @@ wxCDMProjectDescriptionPanel::OnBtnSetVersion(wxCommandEvent& event) this->versionDatetc->SetLabel(crea::std2wx(this->project->GetVersionDate())); } + +void wxCDMProjectDescriptionPanel::OnCMakeMouseEnter(wxMouseEvent& event) +{ + wxCommandEvent* newEvent = new wxCommandEvent(wxEVT_COMMAND_LIST_ITEM_SELECTED); + + if(this->project->GetCMakeLists() != NULL) + { + int CMId = this->project->GetCMakeLists()->GetId(); + newEvent->SetInt(CMId); + newEvent->SetId(0); + wxPostEvent(this->GetParent(), *newEvent); + } + event.Skip(); +} + +void wxCDMProjectDescriptionPanel::OnCMakeMouseExit(wxMouseEvent& event) +{ + wxCommandEvent* newEvent = new wxCommandEvent(wxEVT_COMMAND_LIST_ITEM_DESELECTED); + + if(this->project->GetCMakeLists() != NULL) + { + int CMId = this->project->GetCMakeLists()->GetId(); + newEvent->SetInt(CMId); + newEvent->SetId(0); + wxPostEvent(this->GetParent(), *newEvent); + } + event.Skip(); +} + +void wxCDMProjectDescriptionPanel::OnAppliMouseEnter(wxMouseEvent& event) +{ + wxCommandEvent* newEvent = new wxCommandEvent(wxEVT_COMMAND_LIST_ITEM_SELECTED); + std::cout << "entra appli " << this->project->GetAppli()->GetCMakeLists(); + if(this->project->GetAppli() != NULL) + { + int AppId = this->project->GetAppli()->GetId(); + newEvent->SetInt(AppId); + newEvent->SetId(0); + wxPostEvent(this->GetParent(), *newEvent); + } + event.Skip(); +} + +void wxCDMProjectDescriptionPanel::OnAppliMouseExit(wxMouseEvent& event) +{ + wxCommandEvent* newEvent = new wxCommandEvent(wxEVT_COMMAND_LIST_ITEM_DESELECTED); + + if(this->project->GetAppli() != NULL) + { + int AppId = this->project->GetAppli()->GetId(); + newEvent->SetInt(AppId); + newEvent->SetId(0); + wxPostEvent(this->GetParent(), *newEvent); + } + event.Skip(); +} + +void wxCDMProjectDescriptionPanel::OnLibMouseEnter(wxMouseEvent& event) +{ + wxCommandEvent* newEvent = new wxCommandEvent(wxEVT_COMMAND_LIST_ITEM_SELECTED); + + if(this->project->GetLib() != NULL) + { + int LbId = this->project->GetLib()->GetId(); + newEvent->SetInt(LbId); + newEvent->SetId(0); + wxPostEvent(this->GetParent(), *newEvent); + } + event.Skip(); +} + +void wxCDMProjectDescriptionPanel::OnLibMouseExit(wxMouseEvent& event) +{ + wxCommandEvent* newEvent = new wxCommandEvent(wxEVT_COMMAND_LIST_ITEM_DESELECTED); + + if(this->project->GetLib() != NULL) + { + int LbId = this->project->GetLib()->GetId(); + newEvent->SetInt(LbId); + newEvent->SetId(0); + wxPostEvent(this->GetParent(), *newEvent); + } + event.Skip(); +} diff --git a/lib/creaDevManagerLib/wxCDMProjectDescriptionPanel.h b/lib/creaDevManagerLib/wxCDMProjectDescriptionPanel.h index 0ac8771..06c12bd 100644 --- a/lib/creaDevManagerLib/wxCDMProjectDescriptionPanel.h +++ b/lib/creaDevManagerLib/wxCDMProjectDescriptionPanel.h @@ -84,6 +84,13 @@ protected: void OnBtnSetBuildPath(wxCommandEvent& event); void OnBtnOpenFolder(wxCommandEvent& event); void OnBtnSetVersion(wxCommandEvent& event); + + void OnCMakeMouseEnter(wxMouseEvent& event); + void OnCMakeMouseExit(wxMouseEvent& event); + void OnAppliMouseEnter(wxMouseEvent& event); + void OnAppliMouseExit(wxMouseEvent& event); + void OnLibMouseEnter(wxMouseEvent& event); + void OnLibMouseExit(wxMouseEvent& event); }; #endif /* WXCDMPROJECTDESCRIPTIONPANEL_H_ */