+
+ if (((wxCDMMainFrame*)this->GetParent())->isHelp())
+ {
+ wxCDMPackageHelpDialog* helpDialog = new wxCDMPackageHelpDialog(this->GetParent(), this->package, wxID_ANY);
+ helpDialog->Show(true);
+ }
+}
+
+void wxCDMPackageDescriptionPanel::OnBtnReturn(wxHyperlinkEvent& event)
+{
+ std::vector<modelCDMIProjectTreeNode*> parents = this->package->GetParents();
+ std::string parentURL = crea::wx2std(((wxHyperlinkCtrl*)event.GetEventObject())->GetURL());
+ //std::cout << parentURL << std::endl;
+ for (int i = 0; i < (int)(parents.size()); i++)
+ {
+ if (parents[i]->GetPath() == parentURL)
+ {
+ wxCommandEvent* newEvent = new wxCommandEvent(wxEVT_DISPLAY_CHANGED);
+ newEvent->SetClientData(parents[i]);
+ newEvent->SetId(0);
+ wxPostEvent(this->GetParent(), *newEvent);
+ }
+ }
+}
+
+void wxCDMPackageDescriptionPanel::OnBtnSetAuthor(wxCommandEvent& event)
+{
+ //get author from user
+ wxTextEntryDialog* authDlg = new wxTextEntryDialog(
+ this,
+ wxT("Enter the new authors name. Separate each author with a '/'."),
+ wxT("Change Package Author - creaDevManager"),
+ crea::std2wx(this->package->GetAuthors()),
+ wxTE_MULTILINE | wxOK | wxCANCEL
+ );
+
+ if (authDlg->ShowModal() == wxID_OK)
+ {
+ std::string authorsStr = crea::wx2std(authDlg->GetValue());
+ //check name
+ if(authorsStr.size() > 0)
+ {
+ std::string* result;
+ if(!this->package->SetAuthors(authorsStr, result))
+ wxMessageBox(crea::std2wx(*result),_T("Change Package Author - Error!"),wxOK | wxICON_ERROR);
+ }
+ this->authortc->SetLabel(crea::std2wx(this->package->GetAuthors()));
+ this->authortc->GetParent()->GetSizer()->RecalcSizes();
+ }
+
+}
+
+void wxCDMPackageDescriptionPanel::OnBtnSetVersion(wxCommandEvent& event)
+{
+ //get version
+ wxString versionWx = wxGetTextFromUser(
+ wxT("Enter the new version name"),
+ wxT("Change Package Version - creaDevManager"),
+ crea::std2wx(this->package->GetVersion())
+ );
+ //check name
+ std::vector<std::string> parts;
+ CDMUtilities::splitter::split(parts, crea::wx2std(versionWx), " .", CDMUtilities::splitter::no_empties);
+ if(parts.size() == 3)
+ {
+ std::string* result;
+ if(!this->package->SetVersion(crea::wx2std(versionWx), result))
+ wxMessageBox(crea::std2wx(*result),_T("Change Package Version - Error!"),wxOK | wxICON_ERROR);
+ }
+ else
+ {
+ wxMessageBox(crea::std2wx("The version format is incorrect, please follow the following format:\nX.Y.Z\nX: Major Version\nY: Minor Version\nZ: Build Version"),_T("Set Project Version - Error!"),wxOK | wxICON_ERROR);
+ }
+ this->versiontc->SetLabel(crea::std2wx(this->package->GetVersion()));
+}
+
+void wxCDMPackageDescriptionPanel::OnBtnSetDescription(wxCommandEvent& event)
+{
+ //get description from user
+ wxTextEntryDialog* descDlg = new wxTextEntryDialog(
+ this,
+ wxT("Edit the package description."),
+ wxT("Change Package Description - creaDevManager"),
+ crea::std2wx(this->package->GetDescription()),
+ wxTE_MULTILINE | wxOK | wxCANCEL
+ );
+
+ if (descDlg->ShowModal() == wxID_OK)
+ {
+ std::string descriptionStr = crea::wx2std(descDlg->GetValue());
+ //check desc
+ if(descriptionStr.size() > 0)
+ {
+ std::string* result;
+ if(!this->package->SetDescription(descriptionStr, result))
+ wxMessageBox(crea::std2wx(*result),_T("Change Package Description - Error!"),wxOK | wxICON_ERROR);
+ }
+ this->descriptiontc->SetLabel(crea::std2wx(this->package->GetDescription()));
+ this->descriptiontc->GetParent()->GetSizer()->RecalcSizes();
+ }
+}
+
+void wxCDMPackageDescriptionPanel::OnLnkBlackBoxSelect(wxHyperlinkEvent& event)
+{
+ modelCDMBlackBox* bb;
+ std::vector<modelCDMBlackBox*> bbs = this->package->GetSrc()->GetBlackBoxes();
+ for (int i = 0; i < (int)(bbs.size()); i++)
+ {
+ if(bbs[i]->GetName() == crea::wx2std(event.GetURL()))
+ {
+ bb = bbs[i];
+ break;
+ }
+ }
+
+ wxCommandEvent* newEvent = new wxCommandEvent(wxEVT_DISPLAY_CHANGED);
+ newEvent->SetClientData(bb);
+ newEvent->SetId(1);
+ newEvent->SetString(wxT("blackbox"));
+ wxPostEvent(this->GetParent(), *newEvent);
+
+ wxCommandEvent* newEvent1 = new wxCommandEvent(wxEVT_COMMAND_LISTBOX_SELECTED);
+ newEvent1->SetClientData(bb->GetHeaderFile());
+ newEvent1->SetId(0);
+ wxPostEvent(this->GetParent(), *newEvent1);
+