#include "creaDevManagerIds.h"
#include "wxCDMMainDescriptionPanel.h"
+#include "wxCDMProjectDescriptionPanel.h"
#include "wxCDMProjectActionsPanel.h"
#include "wxCDMNewProjectDialog.h"
- panel_ProjectActions = new wxCDMProjectActionsPanel(
- this,
- ID_WINDOW_PROJ_ACTIONS,
- wxT("Project Actions Panel"),
- wxDefaultPosition,
- wxSize(600,200),
- 0
- );
- panel_ProjectActions->SetMinSize(wxSize(500, 100));
+
auiManager.AddPane(tree_Projects, wxLEFT, wxT("Projects Tree"));
- auiManager.AddPane(panel_ProjectActions, wxBOTTOM, wxT("Project Actions"));
auiManager.AddPane(panel_Properties, wxCENTER, wxT("Properties"));
auiManager.Update();
auiManager.GetPane(tree_Projects).CloseButton(false).MaximizeButton(true);
- auiManager.GetPane(panel_Properties).CloseButton(false);
}
//Event Handlers
//File menu
void wxCDMMainFrame::OnMenuNewProject(wxCommandEvent& event)
{
+ std::string* result;
+
wxCDMNewProjectDialog* dialog = new wxCDMNewProjectDialog(this);
long userResponse;
userResponse = dialog->ShowModal();
if(userResponse == wxID_FORWARD)
{
//create project
- std::string* result;
+ if(this->model->GetProject() != NULL)
+ {
+ if(!this->model->CloseProject(result))
+ {
+ std::cout << "error closing project: " << *result << std::endl;
+ wxMessageBox(crea::std2wx(*result),_T("New Project - Error!"),wxOK | wxICON_ERROR);
+ event.Skip();
+ return;
+ }
+ }
+
if(!this->model->CreateProject(
crea::wx2std(dialog->GetProjectName()),
crea::wx2std(dialog->GetProjectLocation()),
crea::wx2std(dialog->GetPackageDescription())
))
{
+ std::cout << "error opening project: " << *result << std::endl;
wxMessageBox(crea::std2wx(*result),_T("New Project - Error!"),wxOK | wxICON_ERROR);
event.Skip();
return;
//populate tree control
tree_Projects->BuildTree(this->model->GetProject());
tree_Projects->SelectItem(this->model->GetProject()->GetId());
- //TODO: change description panel
- //TODO: change project's actions panel
+
+ //change description panel
+ if(this->panel_Properties != NULL)
+ {
+ auiManager.DetachPane(this->panel_Properties);
+ this->panel_Properties->Destroy();
+ }
+
+ this->panel_Properties = new wxCDMProjectDescriptionPanel(
+ this,
+ this->model->GetProject(),
+ ID_WINDOW_PROPERTIES,
+ wxT("Description Panel"),
+ wxDefaultPosition,
+ wxSize(300, 400),
+ 0);
+ //show projectactions panel
+ if(this->panel_ProjectActions != NULL)
+ {
+ auiManager.DetachPane(this->panel_Properties);
+ this->panel_ProjectActions->Destroy();
+ }
+
+ panel_ProjectActions = new wxCDMProjectActionsPanel(
+ this,
+ ID_WINDOW_PROJ_ACTIONS,
+ wxT("Project Actions Panel"),
+ wxDefaultPosition,
+ wxSize(600,200),
+ 0
+ );
+ panel_ProjectActions->SetMinSize(wxSize(500, 100));
+
+
+ auiManager.AddPane(panel_Properties, wxCENTER, wxT("Properties"));
+ auiManager.AddPane(panel_ProjectActions, wxBOTTOM, wxT("Project Actions"));
+
auiManager.Update();
wxMessageBox(_T("New Project created!"),_T("New Project - Success!"), wxOK | wxICON_INFORMATION);
}
void wxCDMMainFrame::OnMenuOpenProject(wxCommandEvent& event)
{
+ std::string* result;
+
long style = wxDD_DEFAULT_STYLE | wxDD_DIR_MUST_EXIST;
wxDirDialog* FD = new wxDirDialog(this, wxT("Select the project directory"), wxT(""), style);
long userResponse = FD->ShowModal();
//populate model
- std::string* result;
+ if(this->model->GetProject() != NULL)
+ {
+ std::cout << "Project not null, closing it" << std::endl;
+ if(!this->model->CloseProject(result))
+ {
+ std::cout << "error closing project: " << *result << std::endl;
+ wxMessageBox(crea::std2wx(result->c_str()),_T("New Project - Error!"),wxOK | wxICON_ERROR);
+ event.Skip();
+ return;
+ }
+ }
+
if (!this->model->OpenProject(path, result))
{
+ std::cout << "error opening project: " << *result << std::endl;
wxMessageBox( crea::std2wx(result->c_str()), wxT("Open Project - Error"), wxICON_ERROR);
+ event.Skip();
+ return;
};
+ std::cout << "building ui" << std::endl;
+
+
//populate tree control
tree_Projects->BuildTree(this->model->GetProject());
tree_Projects->SelectItem(this->model->GetProject()->GetId());
+
+ //change description panel
+ if(this->panel_Properties != NULL)
+ {
+ auiManager.DetachPane(this->panel_Properties);
+ this->panel_Properties->Destroy();
+ }
+
+ this->panel_Properties = new wxCDMProjectDescriptionPanel(
+ this,
+ this->model->GetProject(),
+ ID_WINDOW_PROPERTIES,
+ wxT("Description Panel"),
+ wxDefaultPosition,
+ wxSize(300, 400),
+ 0
+ );
+
+ //change project's actions panel
+ if(this->panel_ProjectActions!= NULL)
+ {
+ auiManager.DetachPane(this->panel_ProjectActions);
+ this->panel_ProjectActions->Destroy();
+ }
+ panel_ProjectActions = new wxCDMProjectActionsPanel(
+ this,
+ ID_WINDOW_PROJ_ACTIONS,
+ wxT("Project Actions Panel"),
+ wxDefaultPosition,
+ wxSize(600,200),
+ 0
+ );
+ panel_ProjectActions->SetMinSize(wxSize(500, 100));
+
+
+ auiManager.AddPane(panel_Properties, wxCENTER, wxT("Properties"));
+ auiManager.AddPane(panel_ProjectActions, wxBOTTOM, wxT("Project Actions"));
+
auiManager.Update();
}
std::string* result;
if(!this->model->CloseProject(result))
{
+ std::cout << "error closing project: " << *result << std::endl;
wxMessageBox( crea::std2wx(result->c_str()), wxT("Close Project - Error"), wxICON_ERROR);
}
+ tree_Projects->BuildTree(this->model->GetProject());
+
+ if(this->panel_Properties != NULL)
+ {
+ auiManager.DetachPane(this->panel_Properties);
+ this->panel_Properties->Destroy();
+ }
+ if(this->panel_ProjectActions != NULL)
+ {
+ auiManager.DetachPane(this->panel_ProjectActions);
+ this->panel_ProjectActions->Destroy();
+ }
+
+ this->panel_Properties = new wxCDMMainDescriptionPanel(
+ this,
+ ID_WINDOW_PROPERTIES,
+ wxT("Description Panel"),
+ wxDefaultPosition,
+ wxSize(300, 400),
+ 0
+ );
+
+ auiManager.AddPane(panel_Properties, wxCENTER, wxT("Properties"));
+
+ auiManager.Update();
event.Skip();
}
void wxCDMMainFrame::OnMenuCloseAllProjects(wxCommandEvent& event)