From f4451b0dfa9bfa593ada3e9462570b6ca250f0d7 Mon Sep 17 00:00:00 2001 From: Daniel Gonzalez Date: Tue, 22 Jan 2013 17:51:47 +0100 Subject: [PATCH] Feature #1711 CreaDevManager application implementation - Changes for windows compatibility Application opens and creates projects. Tree selection multiselection error fixed. --- appli/creaDevManager/CMakeLists.txt | 31 +++++++ appli/creaDevManager/creaDevManager.cpp | 2 +- lib/creaDevManagerLib/wxCDMMainFrame.cpp | 81 +++++++++++++------ .../wxCDMPackageDescriptionPanel.cpp | 2 +- .../wxCDMProjectsTreeCtrl.cxx | 6 +- 5 files changed, 91 insertions(+), 31 deletions(-) diff --git a/appli/creaDevManager/CMakeLists.txt b/appli/creaDevManager/CMakeLists.txt index 0a5320a..2caa03c 100644 --- a/appli/creaDevManager/CMakeLists.txt +++ b/appli/creaDevManager/CMakeLists.txt @@ -72,8 +72,39 @@ SET ( ${EXE_NAME}_LINK_LIBRARIES CREA_ADD_EXECUTABLE( ${EXE_NAME} ) #============================================================================ +#==sets additional files===================================================== +IF(WIN32) + +# Build tree + CONFIGURE_FILE( + ${CMAKE_CURRENT_SOURCE_DIR}/about.html + ${EXECUTABLE_OUTPUT_PATH}/Debug/about.html + COPYONLY + ) + + CONFIGURE_FILE( + ${CMAKE_CURRENT_SOURCE_DIR}/about.html + ${EXECUTABLE_OUTPUT_PATH}/Release/about.html + COPYONLY + ) + + INSTALL( + PROGRAMS ${EXECUTABLE_OUTPUT_PATH}/Debug/about.html + DESTINATION bin + ) + +ELSE(WIN32) + CONFIGURE_FILE( ${CMAKE_CURRENT_SOURCE_DIR}/about.html ${EXECUTABLE_OUTPUT_PATH}/about.html @ONLY IMMEDIATE ) + +INSTALL( + FILES ${EXECUTABLE_OUTPUT_PATH}/about.html + DESTINATION bin + PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE + ) + +ENDIF(WIN32) diff --git a/appli/creaDevManager/creaDevManager.cpp b/appli/creaDevManager/creaDevManager.cpp index be7b25b..36c64ed 100644 --- a/appli/creaDevManager/creaDevManager.cpp +++ b/appli/creaDevManager/creaDevManager.cpp @@ -33,6 +33,7 @@ IMPLEMENT_APP(wxCreaDevManagerApp) wxCreaDevManagerApp::wxCreaDevManagerApp():wxApp() { + mainWindow = NULL; } bool wxCreaDevManagerApp::OnInit() @@ -49,7 +50,6 @@ bool wxCreaDevManagerApp::OnInit() int wxCreaDevManagerApp::OnExit() { - mainWindow->Destroy(); wxApp::OnExit(); std::cout << "Crea DevManager closed." << std::endl; return 0; diff --git a/lib/creaDevManagerLib/wxCDMMainFrame.cpp b/lib/creaDevManagerLib/wxCDMMainFrame.cpp index a5b1315..ad37e22 100755 --- a/lib/creaDevManagerLib/wxCDMMainFrame.cpp +++ b/lib/creaDevManagerLib/wxCDMMainFrame.cpp @@ -277,8 +277,8 @@ void wxCDMMainFrame::OnMenuNewProject(wxCommandEvent& event) //populate tree control tree_Projects->BuildTree(this->model->GetModelElements(),this->model->GetProject()); - tree_Projects->SelectItem(this->model->GetProject()->GetId(), false); - tree_Projects->SelectItem(this->model->GetProject()->GetId(), true); + tree_Projects->Unselect(); + tree_Projects->SelectItem(this->model->GetProject()->GetId()); //show project actions panel @@ -352,7 +352,7 @@ void wxCDMMainFrame::OnMenuOpenProject(wxCommandEvent& event) //populate tree control tree_Projects->BuildTree(this->model->GetModelElements(), this->model->GetProject()); - tree_Projects->SelectItem(this->model->GetProject()->GetId(), false); + tree_Projects->Unselect(); tree_Projects->SelectItem(this->model->GetProject()->GetId(), true); @@ -438,7 +438,7 @@ void wxCDMMainFrame::OnMenuExit(wxCommandEvent& event) { std::cout << "error closing project: " << *result << std::endl; } - tree_Projects->BuildTree(this->model->GetModelElements(), this->model->GetProject()); + if(this->panel_Properties != NULL) { auiManager.DetachPane(this->panel_Properties); @@ -446,6 +446,13 @@ void wxCDMMainFrame::OnMenuExit(wxCommandEvent& event) this->panel_Properties = NULL; } + if(this->tree_Projects != NULL) + { + auiManager.DetachPane(this->tree_Projects); + this->tree_Projects->Destroy(); + this->tree_Projects = NULL; + } + if(this->panel_ProjectActions != NULL) { auiManager.DetachPane(this->panel_ProjectActions); @@ -469,7 +476,7 @@ void wxCDMMainFrame::OnMenuRefreshProject(wxCommandEvent& event) this->tree_Projects->BuildTree(this->model->GetModelElements(), this->model->GetProject()); this->auiManager.Update(); - this->tree_Projects->SelectItem(this->model->GetProject()->GetId(), false); + this->tree_Projects->Unselect(); this->tree_Projects->SelectItem(this->model->GetProject()->GetId(), true); } event.Skip(); @@ -525,7 +532,42 @@ void wxCDMMainFrame::OnMenuAboutCreaDevManager(wxCommandEvent& event) html = new wxHtmlWindow(&dlg, wxID_ANY, wxDefaultPosition, wxSize(380, 160), wxHW_SCROLLBAR_NEVER); html -> SetBorders(0); - html -> LoadPage(wxT("about.html")); + + std::string content = "" + "" + "" + "" + " " + " " + " " + " " + " " + " " + "
" + "
" + " CREA Development Manager" + " " + "
" + "
" + "

Creatis 2012 - Lyon, France

" + " " + " " + " " + " " + " " + "
" + "

Created by Daniel González - daniel.gonzalez@creatis.insa-lyon.fr

" + "
" + " " + "

This software is governed by the CeCILL-B license under French law and abiding by the rules of distribution of free software.

" + "
" + "
" + "
" + "" + "" + ; + + html -> SetPage(crea::std2wx(content)); html -> SetSize(html -> GetInternalRepresentation() -> GetWidth(), html -> GetInternalRepresentation() -> GetHeight()); @@ -760,24 +802,18 @@ void wxCDMMainFrame::OnTreeSelectionChanged(wxTreeEvent& event) } } - if(this->panel_Properties!= NULL) - this->panel_Properties->Hide(); - - auiManager.AddPane(description, wxAuiPaneInfo().Center().Name(wxT("panel_Properties")).Caption(wxT("")).BestSize(600,400).CloseButton(false)); - auiManager.Update(); - //delete old view if(this->panel_Properties!= NULL) { + this->panel_Properties->Hide(); auiManager.DetachPane(this->panel_Properties); this->panel_Properties->Destroy(); this->panel_Properties = NULL; } //set new view - + auiManager.AddPane(description, wxAuiPaneInfo().Center().Name(wxT("panel_Properties")).Caption(wxT("")).BestSize(600,400).CloseButton(false)); this->panel_Properties = description; - //auiManager.AddPane(panel_Properties, wxAuiPaneInfo().Center().Name(wxT("panel_Properties")).Caption(wxT("Properties")).BestSize(600,400).CloseButton(false)); auiManager.Update(); event.Skip(); } @@ -794,7 +830,7 @@ void wxCDMMainFrame::OnChangeView(wxCommandEvent& event) case 0: myItem = ((modelCDMIProjectTreeNode*)event.GetClientData()); //select out old one to generate selection event - this->tree_Projects->SelectItem(myItem->GetId(), false); + this->tree_Projects->Unselect(); this->tree_Projects->SelectItem(myItem->GetId(), true); this->tree_Projects->Expand(myItem->GetId()); break; @@ -802,8 +838,8 @@ void wxCDMMainFrame::OnChangeView(wxCommandEvent& event) 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()); + //this->tree_Projects->Expand(this->model->GetProject()->GetId()); + //this->tree_Projects->Unselect(); description = new wxCDMPackageManagerPanel( this, this->model->GetProject(), @@ -828,7 +864,6 @@ void wxCDMMainFrame::OnChangeView(wxCommandEvent& event) } else if(event.GetString() == wxT("blackbox")) { - this->tree_Projects->SelectItem(this->model->GetProject()->GetId(), false); modelCDMBlackBox* bb = (modelCDMBlackBox*)event.GetClientData(); description = new wxCDMBlackBoxDescriptionPanel( this, @@ -841,23 +876,19 @@ void wxCDMMainFrame::OnChangeView(wxCommandEvent& event) ); } - if(this->panel_Properties!= NULL) - this->panel_Properties->Hide(); - - auiManager.AddPane(description, wxAuiPaneInfo().Center().Name(wxT("panel_Properties")).Caption(wxT("")).BestSize(600,400).CloseButton(false)); - auiManager.Update(); - //delete old view if(this->panel_Properties!= NULL) { + this->panel_Properties->Hide(); auiManager.DetachPane(this->panel_Properties); this->panel_Properties->Destroy(); this->panel_Properties = NULL; } //set new view - + auiManager.AddPane(description, wxAuiPaneInfo().Center().Name(wxT("panel_Properties")).Caption(wxT("")).BestSize(600,400).CloseButton(false)); this->panel_Properties = description; auiManager.Update(); + break; } event.Skip(); diff --git a/lib/creaDevManagerLib/wxCDMPackageDescriptionPanel.cpp b/lib/creaDevManagerLib/wxCDMPackageDescriptionPanel.cpp index bb06283..2c8882e 100644 --- a/lib/creaDevManagerLib/wxCDMPackageDescriptionPanel.cpp +++ b/lib/creaDevManagerLib/wxCDMPackageDescriptionPanel.cpp @@ -357,7 +357,7 @@ void wxCDMPackageDescriptionPanel::OnLnkBlackBoxSelect(wxHyperlinkEvent& event) wxPostEvent(this->GetParent(), *newEvent); wxCommandEvent* newEvent1 = new wxCommandEvent(wxEVT_COMMAND_LISTBOX_SELECTED); - newEvent1->SetClientData(bb); + newEvent1->SetClientData(bb->GetHeaderFile()); newEvent1->SetId(0); wxPostEvent(this->GetParent(), *newEvent1); diff --git a/lib/creaDevManagerLib/wxCDMProjectsTreeCtrl.cxx b/lib/creaDevManagerLib/wxCDMProjectsTreeCtrl.cxx index e05fa97..3b47119 100755 --- a/lib/creaDevManagerLib/wxCDMProjectsTreeCtrl.cxx +++ b/lib/creaDevManagerLib/wxCDMProjectsTreeCtrl.cxx @@ -97,9 +97,7 @@ bool wxCDMProjectsTreeCtrl::Create( this->ID_PkIcon = images->Add(wxIcon(PkIcon20)); this->AssignImageList(images); - wxTreeItemId rootId = AddRoot(wxT("Root"), 0, 0); -/* - wxTreeItemId rootIndex = this->AddRoot(wxT("No Open Project"), this->ID_Cicon, this->ID_Cicon);*/ + wxTreeItemId rootIndex = this->AddRoot(wxT("No Open Project"), this->ID_Cicon, this->ID_Cicon); this->Update(); return TRUE; } @@ -125,7 +123,7 @@ void wxCDMProjectsTreeCtrl::BuildTree(std::map< wxTreeItemId, modelCDMIProjectTr } else { - wxTreeItemId rootIndex = this-> AddRoot(_("No Open Project")); + wxTreeItemId rootIndex = this-> AddRoot(_("No Open Project"), this->ID_Cicon, this->ID_Cicon); } } -- 2.47.1