+ this->actualTreeItem.Unset();
+ tree_Projects->SelectItem(this->model->GetProject()->GetId().GetWxId(), true);
+ //wxMessageBox(wxT("ProjectSelected") ,_T("New Project - Success!"),wxOK | wxICON_ERROR);
+ }
+}
+void wxCDMMainFrame::OnMenuOpenRecent(wxCommandEvent& event)
+{
+ std::string* result;
+
+ //((wxMenuItem*)(event.GetEventObject()))->GetItemLabel();
+
+ std::string path = "";
+ wxConfigBase* pConfig = wxConfigBase::Get();
+ if(event.GetId() == ID_MENU_OPEN_RECENT1)
+ path = crea::wx2std (pConfig->Read(wxT("RECENT1"),wxT("")));
+ else if(event.GetId() == ID_MENU_OPEN_RECENT2)
+ path = crea::wx2std (pConfig->Read(wxT("RECENT2"),wxT("")));
+ else if(event.GetId() == ID_MENU_OPEN_RECENT3)
+ path = crea::wx2std (pConfig->Read(wxT("RECENT3"),wxT("")));
+ else if(event.GetId() == ID_MENU_OPEN_RECENT4)
+ path = crea::wx2std (pConfig->Read(wxT("RECENT4"),wxT("")));
+ else if(event.GetId() == ID_MENU_OPEN_RECENT5)
+ path = crea::wx2std (pConfig->Read(wxT("RECENT5"),wxT("")));
+
+ std::cout << "Selection to open: " << path << std::endl;
+ std::cout.flush();
+
+
+ //populate model
+ 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->panel_Properties != NULL)
+ {
+ auiManager.DetachPane(this->panel_Properties);
+ this->panel_Properties->Hide();
+ }
+ if(this->panel_ProjectActions != NULL)
+ {
+ auiManager.DetachPane(this->panel_ProjectActions);
+ this->panel_ProjectActions->Hide();
+ }
+ }
+
+ 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;
+ };
+
+ //update recently open projects
+ if(pConfig->Read(wxT("RECENT1"),wxT("")) != crea::std2wx(this->model->GetProject()->GetPath()))
+ {
+ pConfig->Write(wxT("RECENT5"), pConfig->Read(wxT("RECENT4"),wxT("")));
+ pConfig->Write(wxT("RECENT4"), pConfig->Read(wxT("RECENT3"),wxT("")));
+ pConfig->Write(wxT("RECENT3"), pConfig->Read(wxT("RECENT2"),wxT("")));
+ pConfig->Write(wxT("RECENT2"), pConfig->Read(wxT("RECENT1"),wxT("")));
+ pConfig->Write(wxT("RECENT1"), crea::std2wx(this->model->GetProject()->GetPath()));
+ }
+
+ std::cout << "building ui" << std::endl;
+
+ //populate tree control
+ tree_Projects->BuildTree(this->model->GetModelElements(), this->model->GetProject());
+ tree_Projects->Unselect();
+ this->actualTreeItem.Unset();
+ tree_Projects->SelectItem(this->model->GetProject()->GetId().GetWxId(), true);
+
+
+ //change project's actions panel
+ if(this->panel_ProjectActions!= NULL)
+ {
+ auiManager.DetachPane(this->panel_ProjectActions);
+ this->panel_ProjectActions->Destroy();
+ this->panel_ProjectActions = NULL;