X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=lib%2FcreaDevManagerLib%2FwxCDMPackageManagerPanel.cpp;h=d7a28be83fcd02f4e64d4289fc6c4b9ddf67fa99;hb=dd9de710df141a074f10d0cab27b217425ecab20;hp=543ac596fc53364f088baf6d3161d0649b21c828;hpb=e6d99bba438e086b10239a42492532ff194edb88;p=crea.git diff --git a/lib/creaDevManagerLib/wxCDMPackageManagerPanel.cpp b/lib/creaDevManagerLib/wxCDMPackageManagerPanel.cpp index 543ac59..d7a28be 100644 --- a/lib/creaDevManagerLib/wxCDMPackageManagerPanel.cpp +++ b/lib/creaDevManagerLib/wxCDMPackageManagerPanel.cpp @@ -49,6 +49,7 @@ EVT_BUTTON(ID_BUTTON_CREATE_PACKAGE, wxCDMPackageManagerPanel::OnBtnCreatePackag EVT_COMMAND(wxID_ANY, wxEVT_COMMAND_TOOL_CLICKED, wxCDMPackageManagerPanel::OnBtnCreatePackage) EVT_BUTTON(ID_BUTTON_EDIT_CMAKELISTSFILE, wxCDMPackageManagerPanel::OnBtnEditCMakeLists) EVT_COMMAND(wxID_ANY, wxEVT_COMMAND_TOOL_ENTER, wxCDMPackageManagerPanel::OnBtnEditCMakeLists) +EVT_CHECKBOX(ID_CHECK_INCLUDE_PACKAGE, wxCDMPackageManagerPanel::OnChBPackageChange) END_EVENT_TABLE() wxCDMPackageManagerPanel::wxCDMPackageManagerPanel( @@ -81,6 +82,9 @@ bool wxCDMPackageManagerPanel::Create( wxPanel::Create(parent, id, pos, size, style); this->project = project; CreateControls(); + // this part makes the scrollbars show up + this->FitInside(); // ask the sizer about the needed size + this->SetScrollRate(5, 5); return TRUE; } @@ -111,22 +115,54 @@ void wxCDMPackageManagerPanel::CreateControls() wxStaticBoxSizer* propertiesBox = new wxStaticBoxSizer(wxVERTICAL, this, wxT("A&vailable Packages")); propertiesBox->GetStaticBox()->SetToolTip(wxT("Select any of the available packages to see its details or modify them. Remember that black boxes are created inside packages, any of these packages is available.")); wxPanel* propertiesPanel = new wxPanel(this); - wxBoxSizer* propertiesPanelSizer = new wxBoxSizer(wxVERTICAL); std::vector packages = this->project->GetPackages(); + wxFlexGridSizer* propertiesGridSizer = new wxFlexGridSizer(packages.size()+1, 3, 9, 5); + + wxStaticText* ChBTitle = new wxStaticText(propertiesPanel, wxID_ANY, wxT("Include in\nCMake"), wxDefaultPosition, wxDefaultSize, wxALIGN_CENTRE_HORIZONTAL); + wxStaticText* LkTitle = new wxStaticText(propertiesPanel, wxID_ANY, wxT("Package Name"), wxDefaultPosition, wxDefaultSize, wxALIGN_CENTRE_HORIZONTAL); + wxStaticText* HlpTitle = new wxStaticText(propertiesPanel, wxID_ANY, wxT("Help"), wxDefaultPosition, wxDefaultSize, wxALIGN_CENTRE_HORIZONTAL); + + propertiesGridSizer -> Add(ChBTitle, 0, wxEXPAND | wxALL, 5); + propertiesGridSizer -> Add(LkTitle, 0, wxEXPAND | wxALL, 5); + propertiesGridSizer -> Add(HlpTitle, 0, wxEXPAND | wxALL, 5); + for (int i = 0; i < (int)(packages.size()); i++) { - wxHyperlinkCtrl* pPackagelk = new wxHyperlinkCtrl(propertiesPanel,ID_LINK_SELECT_PACKAGE, crea::std2wx(packages[i]->GetName().c_str()), crea::std2wx(packages[i]->GetName().c_str()), wxDefaultPosition, wxDefaultSize, wxHL_DEFAULT_STYLE); - pPackagelk->SetWindowStyle(wxALIGN_LEFT | wxNO_BORDER); - std::string tt = "Author: " + packages[i]->GetAuthors() + "\nDescription: " + packages[i]->GetDescription(); + //checkbox for cmake inclusion + wxCheckBox* pPackageChB = new wxCheckBox(propertiesPanel, ID_CHECK_INCLUDE_PACKAGE, wxT(""), wxDefaultPosition, wxDefaultSize, wxALIGN_RIGHT); + pPackageChB->SetName(crea::std2wx(packages[i]->GetName())); + std::string tt = "if this box is checked the the " + packages[i]->GetName() + " package is included in the project compilation."; + pPackageChB->SetToolTip(crea::std2wx(tt)); + pPackageChB->SetValue(this->project->IsPackageIncluded(packages[i]->GetName())); + propertiesGridSizer -> Add(pPackageChB, 0, wxEXPAND | wxALIGN_CENTER); + + //link to package with description + wxHyperlinkCtrl* pPackagelk = new wxHyperlinkCtrl(propertiesPanel, ID_LINK_SELECT_PACKAGE, crea::std2wx(packages[i]->GetName().c_str()), crea::std2wx(packages[i]->GetName().c_str()), wxDefaultPosition, wxDefaultSize, wxHL_DEFAULT_STYLE); + pPackagelk->SetWindowStyle(wxALIGN_LEFT | wxNO_BORDER); + tt = "Name: " + packages[i]->GetName() + "\n"; + tt += "Location: " + packages[i]->GetPath(); pPackagelk->SetToolTip(crea::std2wx(tt)); - propertiesPanelSizer -> Add(pPackagelk, 0, wxEXPAND | 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); + propertiesGridSizer -> Add(pPackagelk, 0, wxEXPAND); + + //help icon + wxButton* pPackageHlp = new wxButton(propertiesPanel, wxID_ANY, wxT("?"), wxDefaultPosition, wxDefaultSize, wxBU_EXACTFIT); + pPackageHlp->Enable(false); + tt = "When this package is included in the CMakeLists file, the\nfollowing line is included in the CMakeList.txt file in the\nproject folder:\n" + "ADD_SUBDIRECTORY(" + packages[i]->GetName() + ")"; + pPackageHlp->SetToolTip(crea::std2wx(tt)); + + propertiesGridSizer -> Add(pPackageHlp, 0, wxEXPAND | wxALIGN_CENTER); } - propertiesPanel->SetSizer(propertiesPanelSizer); - propertiesPanelSizer->Fit(propertiesPanel); + propertiesGridSizer->AddGrowableCol(1,1); + + propertiesPanel->SetSizer(propertiesGridSizer); + propertiesGridSizer->Fit(propertiesPanel); + + propertiesBox->Add(propertiesPanel, 1, wxALL | wxEXPAND, 5); sizer -> Add(propertiesBox, 0, wxEXPAND | wxALL, 10); @@ -142,7 +178,7 @@ void wxCDMPackageManagerPanel::CreateControls() wxButton* createPkgbt = new wxButton(actionsPanel, ID_BUTTON_CREATE_PACKAGE, _T("A. Create Package")); createPkgbt->SetToolTip(wxT("Create a new package for this project.")); actionsGridSizer->Add(createPkgbt, 1, wxALL | wxEXPAND, 5); - wxButton* editCMakebt = new wxButton(actionsPanel, ID_BUTTON_EDIT_CMAKELISTSFILE, _T("B. 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)&wxCDMPackageManagerPanel::OnCMakeMouseEnter,NULL,this); editCMakebt->Connect(wxEVT_LEAVE_WINDOW, (wxObjectEventFunction)(wxEventFunction)(wxMouseEventFunction)&wxCDMPackageManagerPanel::OnCMakeMouseExit,NULL,this); @@ -181,6 +217,14 @@ void wxCDMPackageManagerPanel::OnBtnReturn(wxHyperlinkEvent& event) wxPostEvent(this->GetParent(), *newEvent); } +void wxCDMPackageManagerPanel::OnChBPackageChange(wxCommandEvent& event) +{ + this->project->SetPackageInclude( + crea::wx2std(((wxCheckBox*)event.GetEventObject())->GetName()), + ((wxCheckBox*)event.GetEventObject())->GetValue() + ); +} + void wxCDMPackageManagerPanel::OnLnkPackageSelect(wxHyperlinkEvent& event) { modelCDMPackage* thePackage = NULL;