summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThales Lima Oliveira <thaleslima.ufu@gmail.com>2020-07-08 22:09:59 -0300
committerThales Lima Oliveira <thaleslima.ufu@gmail.com>2020-07-08 22:09:59 -0300
commitcd3ba24483036cc5d86c4fe4de3cf3bcb57d5cd0 (patch)
tree5cdb39217d81d572fde4ad7c624b8cf97a8f053d
parentc38d051f2ca28bdd29716c8b1508309434accf05 (diff)
downloadPSP.git-cd3ba24483036cc5d86c4fe4de3cf3bcb57d5cd0.tar.gz
PSP.git-cd3ba24483036cc5d86c4fe4de3cf3bcb57d5cd0.tar.xz
PSP.git-cd3ba24483036cc5d86c4fe4de3cf3bcb57d5cd0.zip
Close project implemented
-rw-r--r--Project/MainFrame.cpp22
1 files changed, 20 insertions, 2 deletions
diff --git a/Project/MainFrame.cpp b/Project/MainFrame.cpp
index d695ad7..1a9c9a9 100644
--- a/Project/MainFrame.cpp
+++ b/Project/MainFrame.cpp
@@ -249,7 +249,25 @@ void MainFrame::OnChartsClick(wxRibbonButtonBarEvent& event)
}
}
-void MainFrame::OnCloseClick(wxRibbonButtonBarEvent& event) {}
+void MainFrame::OnCloseClick(wxRibbonButtonBarEvent& event)
+{
+ auto it = m_workspaceList.begin();
+ while (it != m_workspaceList.end()) {
+ if (*it == m_auiNotebook->GetCurrentPage()) {
+ if ((*it)->GetSharedGLContext() == m_sharedGLContext) m_sharedGLContext = nullptr;
+ m_workspaceList.erase(it);
+ m_auiNotebook->DeletePage(m_auiNotebook->GetPageIndex(m_auiNotebook->GetCurrentPage()));
+ break;
+ }
+ ++it;
+ }
+ if (!m_sharedGLContext && !m_workspaceList.empty()) {
+ m_sharedGLContext = m_workspaceList[0]->GetSharedGLContext();
+ }
+ else if (m_workspaceList.empty()) {
+ EnableCurrentProjectRibbon(false);
+ }
+}
void MainFrame::OnCopyClick(wxRibbonButtonBarEvent& event) {}
void MainFrame::OnDataReportClick(wxRibbonButtonBarEvent& event)
{
@@ -716,7 +734,7 @@ void MainFrame::OnNotebookPageChanged(wxAuiNotebookEvent& event)
void MainFrame::OnProjectSettingsClick(wxRibbonButtonBarEvent& event)
{
Workspace* workspace = static_cast<Workspace*>(m_auiNotebook->GetCurrentPage());
- if(workspace) {
+ if (workspace) {
ProjectPropertiesForm ppf(this, workspace);
ppf.ShowModal();
workspace->UpdateHeatMap();