#include "wxCDMFolderDescriptionPanel.h"
#include "wxCDMMainFrame.h"
+#include "CDMUtilities.h"
#include "creaDevManagerIds.h"
#include "images/FdIcon64.xpm"
EVT_BUTTON(ID_BUTTON_PREV, wxCDMFolderDescriptionPanel::OnBtnReturn)
EVT_BUTTON(ID_BUTTON_OPEN_FOLDER, wxCDMFolderDescriptionPanel::OnBtnOpenInExplorer)
EVT_BUTTON(ID_BUTTON_EDIT_CMAKELISTSFILE, wxCDMFolderDescriptionPanel::OnBtnEditCMakeLists)
+EVT_BUTTON(ID_BUTTON_CREATE_FOLDER, wxCDMFolderDescriptionPanel::OnBtnCreateFolder)
END_EVENT_TABLE()
wxCDMFolderDescriptionPanel::wxCDMFolderDescriptionPanel(
actionsPanelSizer->Add(editCMakebt, 0, wxALL, 5);
}
+ wxButton* createFolderbt = new wxButton(actionsPanel, ID_BUTTON_CREATE_FOLDER, _T("Create Folder"));
+ createFolderbt->SetToolTip(wxT("Create a new folder inside this folder."));
+ actionsPanelSizer->Add(createFolderbt, 0, wxALL, 5);
+
actionsPanel->SetSizer(actionsPanelSizer);
actionsPanelSizer->Fit(actionsPanel);
actionsBox->Add(actionsPanel, 0, wxEXPAND);
void wxCDMFolderDescriptionPanel::OnBtnOpenInExplorer(wxCommandEvent& event)
{
std::string* result;
- if(!this->folder->OpenInFileExplorer(result))
- wxMessageBox(crea::std2wx(*result),_T("Open Folder - Error!"),wxOK | wxICON_ERROR);
+ if(!this->folder->OpenInFileExplorer(result))
+ wxMessageBox(crea::std2wx(*result),_T("Open Folder - Error!"),wxOK | wxICON_ERROR);
}
void wxCDMFolderDescriptionPanel::OnBtnEditCMakeLists(wxCommandEvent& event)
}
}
+void wxCDMFolderDescriptionPanel::OnBtnCreateFolder(wxCommandEvent& event)
+{
+ //get name
+ wxString folderName = wxGetTextFromUser(
+ wxT("Enter the name of the new folder:"),
+ wxT("Create Folder - creaDevManager")
+ );
+ //check name
+ std::vector<std::string> parts;
+ CDMUtilities::splitter::split(parts, crea::wx2std(folderName), " /\\\"", CDMUtilities::splitter::no_empties);
+ if(parts.size() > 0)
+ {
+ std::string* result;
+ modelCDMFolder* folderC = this->folder->CreateFolder(crea::wx2std(folderName), result);
+ if(folderC == NULL)
+ {
+ wxMessageBox(crea::std2wx(*result),_T("Create Folder - Error!"),wxOK | wxICON_ERROR);
+ return;
+ }
+ ((wxCDMMainFrame*)this->GetParent())->RefreshProject();
+ wxCommandEvent* newEvent = new wxCommandEvent(wxEVT_DISPLAY_CHANGED);
+ newEvent->SetInt(folderC->GetId());
+ wxPostEvent(this->GetParent(), *newEvent);
+ wxMessageBox(crea::std2wx("The folder was successfully created"),_T("Create Folder - Success"),wxOK | wxICON_INFORMATION);
+ }
+ else
+ {
+ wxMessageBox(crea::std2wx("No name specified"),_T("Create Folder - Error!"),wxOK | wxICON_ERROR);
+ }
+}
+
void wxCDMFolderDescriptionPanel::OnCMakeMouseEnter(wxMouseEvent& event)
{
wxCommandEvent* newEvent = new wxCommandEvent(wxEVT_COMMAND_LIST_ITEM_SELECTED);