X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=lib%2FcreaDevManagerLib%2FwxCDMLibDescriptionPanel.cpp;h=5a7147055ab8222ab49db8ee700b3b7c913c3d5f;hb=175a81477d0476f53162766202df7be421afe3aa;hp=4cb283744c80979fa5d7cd8e5d8d9bc1b1f38d9b;hpb=72a6140565ccd0905f822c7bf17ea471762a9301;p=crea.git diff --git a/lib/creaDevManagerLib/wxCDMLibDescriptionPanel.cpp b/lib/creaDevManagerLib/wxCDMLibDescriptionPanel.cpp index 4cb2837..5a71470 100644 --- a/lib/creaDevManagerLib/wxCDMLibDescriptionPanel.cpp +++ b/lib/creaDevManagerLib/wxCDMLibDescriptionPanel.cpp @@ -47,6 +47,7 @@ EVT_HYPERLINK(ID_LINK_SELECT_LIBRARY, wxCDMLibDescriptionPanel::OnLnkLibrarySele EVT_BUTTON(ID_BUTTON_CREATE_LIBRARY, wxCDMLibDescriptionPanel::OnBtnCreateLibrary) EVT_BUTTON(ID_BUTTON_EDIT_CMAKELISTSFILE, wxCDMLibDescriptionPanel::OnBtnEditCMakeLists) EVT_BUTTON(ID_BUTTON_OPEN_FOLDER, wxCDMLibDescriptionPanel::OnBtnOpenFolder) +EVT_CHECKBOX(ID_CHECK_INCLUDE_LIBRARY, wxCDMLibDescriptionPanel::OnChBLibraryChange) END_EVENT_TABLE() wxCDMLibDescriptionPanel::wxCDMLibDescriptionPanel( @@ -79,6 +80,9 @@ bool wxCDMLibDescriptionPanel::Create( wxPanel::Create(parent, id, pos, size, style); this->lib = lib; CreateControls(); + // this part makes the scrollbars show up + this->FitInside(); // ask the sizer about the needed size + this->SetScrollRate(5, 5); return TRUE; } @@ -91,14 +95,15 @@ void wxCDMLibDescriptionPanel::CreateControls() std::vector parents = this->lib->GetParents(); for (int i = 0; i < (int)(parents.size()); i++) { - wxHyperlinkCtrl* returnLnk = new wxHyperlinkCtrl(this, ID_BUTTON_PREV, crea::std2wx(parents[parents.size()-1-i]->GetName()), crea::std2wx(parents[parents.size()-1-i]->GetPath())); - returnLnk->SetToolTip(crea::std2wx("Return to " + parents[parents.size()-1-i]->GetName() + ".")); + wxHyperlinkCtrl* returnLnk = new wxHyperlinkCtrl(this, ID_BUTTON_PREV, crea::std2wx(parents[parents.size()-1-i]->GetName()), crea::std2wx(parents[parents.size()-1-i]->GetPath()), wxDefaultPosition, wxDefaultSize, wxHL_DEFAULT_STYLE); + returnLnk->SetWindowStyle(wxNO_BORDER); + returnLnk->SetToolTip(crea::std2wx("Return to " + parents[parents.size()-1-i]->GetName() + ".")); linksSizer->Add(returnLnk, 0, wxALIGN_CENTER_VERTICAL | wxLEFT | wxRIGHT, 5); - if (i < (int)(parents.size())-1) - { - linksSizer->Add(new wxStaticText(this,wxID_ANY, wxT("/")), 0, wxALIGN_CENTER, 0); - } + linksSizer->Add(new wxStaticText(this,wxID_ANY, wxT("/")), 0, wxALIGN_CENTER, 0); } + + linksSizer->Add(new wxStaticText(this, wxID_ANY, crea::std2wx(this->lib->GetName())), 0, wxALIGN_CENTER, 0); + sizer->Add(linksSizer, 0, wxALIGN_CENTER | wxALL, 5); //Header @@ -117,23 +122,47 @@ void wxCDMLibDescriptionPanel::CreateControls() wxStaticBoxSizer* propertiesBox = new wxStaticBoxSizer(wxVERTICAL, this, wxT("A&vailable Libraries")); propertiesBox->GetStaticBox()->SetToolTip(wxT("Select any of the available libraries to see its details or modify them.")); wxPanel* propertiesPanel = new wxPanel(this); - wxBoxSizer* propertiesPanelSizer = new wxBoxSizer(wxVERTICAL); std::vector libraries = this->lib->GetLibraries(); + wxFlexGridSizer* propertiesGridSizer = new wxFlexGridSizer(libraries.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("Library 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)(libraries.size()); i++) { - wxHyperlinkCtrl* pLibrarylk = new wxHyperlinkCtrl(propertiesPanel, ID_LINK_SELECT_LIBRARY, crea::std2wx(libraries[i]->GetName().c_str()), crea::std2wx(libraries[i]->GetName().c_str())); - pLibrarylk->SetWindowStyle(wxALIGN_LEFT); - std::string tt = "Name: " + libraries[i]->GetName() + "\n"; + //checkbox for cmake inclusion + wxCheckBox* pLibraryChB = new wxCheckBox(propertiesPanel, ID_CHECK_INCLUDE_LIBRARY, wxT(""), wxDefaultPosition, wxDefaultSize, wxALIGN_RIGHT); + pLibraryChB->SetName(crea::std2wx(libraries[i]->GetName())); + std::string tt = "if this box is checked the the " + libraries[i]->GetName() + " library is included in the project compilation."; + pLibraryChB->SetToolTip(crea::std2wx(tt)); + pLibraryChB->SetValue(this->lib->IsLibraryIncluded(libraries[i]->GetName())); + propertiesGridSizer -> Add(pLibraryChB, 0, wxEXPAND | wxALIGN_CENTER); + + //link to library with description + wxHyperlinkCtrl* pLibrarylk = new wxHyperlinkCtrl(propertiesPanel, ID_LINK_SELECT_LIBRARY, crea::std2wx(libraries[i]->GetName().c_str()), crea::std2wx(libraries[i]->GetName().c_str()), wxDefaultPosition, wxDefaultSize, wxHL_DEFAULT_STYLE); + pLibrarylk->SetWindowStyle(wxALIGN_LEFT | wxNO_BORDER); + tt = "Name: " + libraries[i]->GetName() + "\n"; tt += "Location: " + libraries[i]->GetPath(); - pLibrarylk->SetToolTip(crea::std2wx(tt.c_str())); + pLibrarylk->SetToolTip(crea::std2wx(tt)); 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, wxEXPAND | wxALL, 5); + propertiesGridSizer -> Add(pLibrarylk, 0, wxEXPAND); + + //help icon + wxButton* pLibraryHlp = new wxButton(propertiesPanel, wxID_ANY, wxT("?"), wxDefaultPosition, wxDefaultSize, wxBU_EXACTFIT); + propertiesGridSizer -> Add(pLibraryHlp, 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); @@ -149,12 +178,12 @@ void wxCDMLibDescriptionPanel::CreateControls() wxButton* createLibrarybt = new wxButton(actionsPanel, ID_BUTTON_CREATE_LIBRARY, _T("A. Create Library")); createLibrarybt->SetToolTip(wxT("Create a new library for this project.")); actionsGridSizer->Add(createLibrarybt, 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("Open the system default text editor to edit the Lib's CMakeLists.txt file.")); editCMakebt->Connect(wxEVT_ENTER_WINDOW, (wxObjectEventFunction)(wxEventFunction)(wxMouseEventFunction)&wxCDMLibDescriptionPanel::OnCMakeMouseEnter,NULL,this); editCMakebt->Connect(wxEVT_LEAVE_WINDOW, (wxObjectEventFunction)(wxEventFunction)(wxMouseEventFunction)&wxCDMLibDescriptionPanel::OnCMakeMouseExit,NULL,this); actionsGridSizer->Add(editCMakebt, 1, wxALL | wxEXPAND, 5); - wxButton* openFolderbt = new wxButton(actionsPanel, ID_BUTTON_OPEN_FOLDER, _T("C. Open Libraries Folder")); + wxButton* openFolderbt = new wxButton(actionsPanel, ID_BUTTON_OPEN_FOLDER, _T("Open Libraries Folder")); openFolderbt->SetToolTip(wxT("Open the lib folder in the file explorer.")); actionsGridSizer->Add(openFolderbt, 1, wxALL | wxEXPAND, 5); @@ -228,6 +257,14 @@ void wxCDMLibDescriptionPanel::OnBtnEditCMakeLists(wxCommandEvent& event) } } +void wxCDMLibDescriptionPanel::OnChBLibraryChange(wxCommandEvent& event) +{ + this->lib->SetLibraryInclude( + crea::wx2std(((wxCheckBox*)event.GetEventObject())->GetName()), + ((wxCheckBox*)event.GetEventObject())->GetValue() + ); +} + void wxCDMLibDescriptionPanel::OnLnkLibrarySelect(wxHyperlinkEvent& event) { modelCDMLibrary* theLibrary = NULL;