#include "images/PrIcon64.xpm"
BEGIN_EVENT_TABLE(wxCDMProjectDescriptionPanel, wxPanel)
-EVT_BUTTON(ID_BUTTON_CREATE_PACKAGE, wxCDMProjectDescriptionPanel::OnBtnCreatePackage)
-EVT_BUTTON(ID_BUTTON_CREATE_BLACKBOX, wxCDMProjectDescriptionPanel::OnBtnCreateBlackBox)
-EVT_BUTTON(ID_BUTTON_CREATE_LIBRARY, wxCDMProjectDescriptionPanel::OnBtnCreateLibrary)
-EVT_BUTTON(ID_BUTTON_CREATE_APPLICATION, wxCDMProjectDescriptionPanel::OnBtnCreateApplication)
+EVT_BUTTON(ID_BUTTON_GOTO_PACKAGE_MANAGER, wxCDMProjectDescriptionPanel::OnBtnManagePackages)
+EVT_BUTTON(ID_BUTTON_GOTO_LIB_MANAGER, wxCDMProjectDescriptionPanel::OnBtnManageLibraries)
+EVT_BUTTON(ID_BUTTON_GOTO_APPLI_MANAGER, wxCDMProjectDescriptionPanel::OnBtnManageApplications)
EVT_BUTTON(ID_BUTTON_EDIT_CMAKELISTSFILE, wxCDMProjectDescriptionPanel::OnBtnEditCMakeLists)
-EVT_COMMAND(wxID_ANY, wxEVT_DISPLAY_CHANGED, wxCDMProjectDescriptionPanel::OnCreationComplete)
+
END_EVENT_TABLE()
wxCDMProjectDescriptionPanel::wxCDMProjectDescriptionPanel(
wxFlexGridSizer* flexGridSizer = new wxFlexGridSizer(4, 2, 9, 15);
- wxStaticText *pVersion = new wxStaticText(this, -1, wxT("Version"));
- wxStaticText *pVersionDate = new wxStaticText(this, -1, wxT("Version Date"));
- wxStaticText *pSourceLocation = new wxStaticText(this, -1, wxT("Source Location"));
- wxStaticText *pBuildLocation = new wxStaticText(this, -1, wxT("Build Location"));
+ wxStaticText* pVersion = new wxStaticText(this, -1, wxT("Version"));
+ wxStaticText* pVersionDate = new wxStaticText(this, -1, wxT("Version Date"));
+ wxStaticText* pSourceLocation = new wxStaticText(this, -1, wxT("Source Location"));
+ wxStaticText* pBuildLocation = new wxStaticText(this, -1, wxT("Build Location"));
+
+ wxStaticText* pVersiontc = new wxStaticText(this, -1, crea::std2wx(this->project->GetVersion()));
+ wxStaticText* pVersionDatetc = new wxStaticText(this, -1, crea::std2wx(this->project->GetVersionDate()));
+ wxStaticText* pSourceLocationtc = new wxStaticText(this, -1, crea::std2wx(this->project->GetPath()));
+ wxStaticText* pBuildLocationtc = new wxStaticText(this, -1, crea::std2wx(this->project->GetBuildPath()));
+
+ wxButton* pVersionbt = new wxButton(this, ID_BUTTON_SET_VERSION, wxT("Set"));
+ wxButton* pBuildLocationbt = new wxButton(this, ID_BUTTON_SET_BUILD_PATH, wxT("Choose"));
- wxTextCtrl *pVersiontc = new wxTextCtrl(this, -1, crea::std2wx(this->project->GetVersion()));
- wxTextCtrl *pVersionDatetc = new wxTextCtrl(this, -1, crea::std2wx(this->project->GetVersionDate()));
- wxTextCtrl *pSourceLocationtc = new wxTextCtrl(this, -1, crea::std2wx(this->project->GetPath()));
- wxTextCtrl *pBuildLocationtc = new wxTextCtrl(this, -1, crea::std2wx(this->project->GetBuildPath()));
+ wxBoxSizer* pVersionsz = new wxBoxSizer(wxHORIZONTAL);
+ wxBoxSizer* pBuildLocationsz = new wxBoxSizer(wxHORIZONTAL);
+
+ pVersionsz->Add(pVersiontc, 0, wxALIGN_CENTER_VERTICAL, 0);
+ pVersionsz->Add(pVersionbt, 0, wxALIGN_CENTER | wxLEFT, 10);
+ pBuildLocationsz->Add(pBuildLocationtc, 0, wxALIGN_CENTER, 0);
+ pBuildLocationsz->Add(pBuildLocationbt, 0, wxALIGN_CENTER_VERTICAL | wxLEFT, 10);
flexGridSizer->Add(pVersion, 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
- flexGridSizer->Add(pVersiontc, 1, wxEXPAND);
+ flexGridSizer->Add(pVersionsz, 1, wxEXPAND);
flexGridSizer->Add(pVersionDate, 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
flexGridSizer->Add(pVersionDatetc, 1, wxEXPAND);
flexGridSizer->Add(pSourceLocation, 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
flexGridSizer->Add(pSourceLocationtc, 1, wxEXPAND);
flexGridSizer->Add(pBuildLocation, 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
- flexGridSizer->Add(pBuildLocationtc, 1, wxEXPAND);
+ flexGridSizer->Add(pBuildLocationsz, 1, wxEXPAND);
+
+ flexGridSizer->AddGrowableCol(1,1);
- propertiesBoxInnerSizer -> Add(flexGridSizer, 0, wxEXPAND);
- sizer -> Add(propertiesBoxInnerSizer, 1, wxEXPAND | wxALL, 20);
+ propertiesBoxInnerSizer -> Add(flexGridSizer, 0, wxALL | wxEXPAND, 5);
+ sizer -> Add(propertiesBoxInnerSizer, 0, wxEXPAND | wxALL, 10);
//Actions
wxStaticBox* actionsBox = new wxStaticBox(this, -1, _T("&Actions"));
- wxStaticBoxSizer* actionsBoxInnerSizer = new wxStaticBoxSizer(actionsBox, wxVERTICAL);
- sizer -> Add(actionsBoxInnerSizer, 1, wxEXPAND | wxALL, 20);
+ wxStaticBoxSizer* actionsBoxInnerSizer = new wxStaticBoxSizer(actionsBox, wxHORIZONTAL);
+ sizer -> Add(actionsBoxInnerSizer, 0, wxEXPAND | wxALL, 10);
- actionsBoxInnerSizer->Add(new wxButton(this, ID_BUTTON_CREATE_PACKAGE, _T("Create Package")), 0, wxEXPAND | wxRIGHT | wxLEFT, 20);
- actionsBoxInnerSizer->Add(new wxButton(this, ID_BUTTON_CREATE_BLACKBOX, _T("Create Black Box")), 0, wxEXPAND | wxRIGHT | wxLEFT, 20);
- actionsBoxInnerSizer->Add(new wxButton(this, ID_BUTTON_CREATE_LIBRARY, _T("Create Library")), 0, wxEXPAND | wxRIGHT | wxLEFT, 20);
- actionsBoxInnerSizer->Add(new wxButton(this, ID_BUTTON_CREATE_APPLICATION, _T("Create Application")), 0, wxEXPAND | wxRIGHT | wxLEFT, 20);
+ actionsBoxInnerSizer->Add(new wxButton(this, ID_BUTTON_GOTO_PACKAGE_MANAGER, _T("Package Manager")), 0, wxALL, 5);
+ //TODO: show only if there is a lib folder
+ actionsBoxInnerSizer->Add(new wxButton(this, ID_BUTTON_GOTO_LIB_MANAGER, _T("Library Manager")), 0, wxALL, 5);
+ //TODO: show only if there is a appli folder
+ actionsBoxInnerSizer->Add(new wxButton(this, ID_BUTTON_GOTO_APPLI_MANAGER, _T("Application Manager")), 0, wxALL, 5);
- actionsBoxInnerSizer->Add(new wxButton(this, ID_BUTTON_EDIT_CMAKELISTSFILE, _T("Edit CMakeLists File")), 0, wxEXPAND | wxRIGHT | wxLEFT, 20);
+ actionsBoxInnerSizer->Add(new wxButton(this, ID_BUTTON_EDIT_CMAKELISTSFILE, _T("Edit CMakeLists File")), 0, wxALL, 5);
//Assign sizer
actionsBoxInnerSizer->SetSizeHints(this);
sizer->SetSizeHints(this);
}
-void wxCDMProjectDescriptionPanel::OnBtnCreatePackage(wxCommandEvent& event)
-{
- std::string* result;
-
- wxCDMNewPackageDialog* dialog = new wxCDMNewPackageDialog(this);
- long userResponse;
- userResponse = dialog->ShowModal();
-
- if(userResponse == wxID_FORWARD)
- {
- modelCDMIProjectTreeNode* package = this->project->CreatePackage(
- crea::wx2std(dialog->GetPackageName()),
- result,
- crea::wx2std(dialog->GetPackageAuthor()),
- crea::wx2std(dialog->GetPackageAuthorEmail()),
- crea::wx2std(dialog->GetPackageDescription())
- );
- if(package == NULL)
- {
- std::cout << "error creating package: " << *result << std::endl;
- wxMessageBox(crea::std2wx(*result),_T("New Package - Error!"),wxOK | wxICON_ERROR);
- event.Skip();
- return;
- }
- wxMessageBox(crea::std2wx("Package successfully created."),_T("New Package - Success!"),wxOK | wxICON_INFORMATION);
-
- //refreshing tree and description
- //send event instead of calling parent to avoid crashing
-
- ((wxCDMMainFrame*)this->GetParent())->RefreshProject();
-
- wxCommandEvent* newEvent = new wxCommandEvent(wxEVT_DISPLAY_CHANGED);
- newEvent->SetInt(package->GetId());
- wxPostEvent(this->GetParent(), *newEvent);
- event.Skip();
- }
-
- event.Skip();
-}
-
-void wxCDMProjectDescriptionPanel::OnBtnCreateBlackBox(wxCommandEvent& event)
-{
- //TODO: implement method
- std::cerr << "Event OnBtnCreatePackage not implemented" << std::endl;
- event.Skip();
-}
void wxCDMProjectDescriptionPanel::OnBtnCreateLibrary(wxCommandEvent& event)
{
event.Skip();
}
-void wxCDMProjectDescriptionPanel::OnCreationComplete(wxCommandEvent& event)
+void
+wxCDMProjectDescriptionPanel::OnBtnManagePackages(wxCommandEvent& event)
+{
+ wxCommandEvent* newEvent = new wxCommandEvent(wxEVT_DISPLAY_CHANGED);
+ newEvent->SetId(1);
+ newEvent->SetString(wxT("manage_packages"));
+ newEvent->SetInt(this->project->GetId());
+ wxPostEvent(this->GetParent(), *newEvent);
+ event.Skip();
+}
+
+void
+wxCDMProjectDescriptionPanel::OnBtnManageLibraries(wxCommandEvent& event)
{
- std::cout << "catched" << std::endl;
+ wxCommandEvent* newEvent = new wxCommandEvent(wxEVT_DISPLAY_CHANGED);
+ newEvent->SetId(1);
+ newEvent->SetString(wxT("manage_libraries"));
+ //TODO: implement GetLib in project
+ //newEvent->SetInt(this->project->GetLib()->GetId());
+ wxPostEvent(this->GetParent(), *newEvent);
+ event.Skip();
+}
+void
+wxCDMProjectDescriptionPanel::OnBtnManageApplications(wxCommandEvent& event)
+{
+ wxCommandEvent* newEvent = new wxCommandEvent(wxEVT_DISPLAY_CHANGED);
+ newEvent->SetId(1);
+ newEvent->SetString(wxT("manage_applications"));
+ //TODO: implement GetAppli in project
+ //newEvent->SetInt(this->project->GetAppli->GetId());
+ wxPostEvent(this->GetParent(), *newEvent);
+ event.Skip();
}