summaryrefslogtreecommitdiffstats
path: root/Project/MainFrame.cpp
diff options
context:
space:
mode:
authorThales Lima Oliveira <thaleslima.ufu@gmail.com>2017-01-05 19:37:42 -0200
committerGitHub <noreply@github.com>2017-01-05 19:37:42 -0200
commit9df133274802731220546d1f9383c213193c8413 (patch)
tree9c6e2fa2a45d6c6c4c14d8711b2b89066bfb37d7 /Project/MainFrame.cpp
parentc5343c718cf80620c2fc7452a4315f7ddb9e5826 (diff)
parentb6f96ca48bc156898df79deba63d270b393fb150 (diff)
downloadPSP.git-9df133274802731220546d1f9383c213193c8413.tar.gz
PSP.git-9df133274802731220546d1f9383c213193c8413.tar.xz
PSP.git-9df133274802731220546d1f9383c213193c8413.zip
Merge pull request #5 from Thales1330/opt/element-parent-search
Opt element parent search
Diffstat (limited to 'Project/MainFrame.cpp')
-rw-r--r--Project/MainFrame.cpp24
1 files changed, 11 insertions, 13 deletions
diff --git a/Project/MainFrame.cpp b/Project/MainFrame.cpp
index 78b4fcd..76c7b6f 100644
--- a/Project/MainFrame.cpp
+++ b/Project/MainFrame.cpp
@@ -127,7 +127,6 @@ void MainFrame::OnNewClick(wxRibbonButtonBarEvent& event)
m_ribbonButtonBarContinuous->ToggleButton(ID_RIBBON_ENABLESOL, false);
m_auiNotebook->AddPage(newWorkspace, newWorkspace->GetName(), true);
- newWorkspace->Layout();
newWorkspace->Redraw();
m_projectNumber++;
}
@@ -140,7 +139,7 @@ void MainFrame::OnCopyClick(wxRibbonButtonBarEvent& event) {}
void MainFrame::OnDataReportClick(wxRibbonButtonBarEvent& event) {}
void MainFrame::OnDeleteClick(wxRibbonButtonBarEvent& event)
{
- Workspace* workspace = (Workspace*)m_auiNotebook->GetCurrentPage();
+ Workspace* workspace = static_cast<Workspace*>(m_auiNotebook->GetCurrentPage());
if(workspace) {
workspace->DeleteSelectedElements();
}
@@ -162,14 +161,14 @@ void MainFrame::OnExpImpClick(wxRibbonButtonBarEvent& event) {}
void MainFrame::OnFaultClick(wxRibbonButtonBarEvent& event) {}
void MainFrame::OnFitClick(wxRibbonButtonBarEvent& event)
{
- Workspace* workspace = (Workspace*)m_auiNotebook->GetCurrentPage();
+ Workspace* workspace = static_cast<Workspace*>(m_auiNotebook->GetCurrentPage());
if(workspace) {
workspace->Fit();
}
}
void MainFrame::OnMoveClick(wxRibbonButtonBarEvent& event)
{
- Workspace* workspace = (Workspace*)m_auiNotebook->GetCurrentPage();
+ Workspace* workspace = static_cast<Workspace*>(m_auiNotebook->GetCurrentPage());
if(workspace) {
auto elementList = workspace->GetElementList();
// Calculate the average position of selected elements.
@@ -214,8 +213,9 @@ void MainFrame::OnOpenClick(wxRibbonButtonBarEvent& event)
m_ribbonButtonBarContinuous->ToggleButton(ID_RIBBON_ENABLESOL, false);
m_auiNotebook->AddPage(newWorkspace, newWorkspace->GetName(), true);
- newWorkspace->Layout();
+ m_auiNotebook->Layout();
newWorkspace->Redraw();
+ newWorkspace->SetJustOpened(true);
m_projectNumber++;
} else {
// TODO: fail message.
@@ -227,7 +227,7 @@ void MainFrame::OnPSPGuideClick(wxRibbonButtonBarEvent& event) {}
void MainFrame::OnPasteClick(wxRibbonButtonBarEvent& event) {}
void MainFrame::OnPowerFlowClick(wxRibbonButtonBarEvent& event)
{
- Workspace* workspace = (Workspace*)m_auiNotebook->GetCurrentPage();
+ Workspace* workspace = static_cast<Workspace*>(m_auiNotebook->GetCurrentPage());
if(workspace) {
workspace->RunPowerFlow();
}
@@ -239,7 +239,7 @@ void MainFrame::OnRunStabilityClick(wxRibbonButtonBarEvent& event) {}
void MainFrame::OnSCPowerClick(wxRibbonButtonBarEvent& event) {}
void MainFrame::OnSaveAsClick(wxRibbonButtonBarEvent& event)
{
- Workspace* workspace = (Workspace*)m_auiNotebook->GetCurrentPage();
+ Workspace* workspace = static_cast<Workspace*>(m_auiNotebook->GetCurrentPage());
if(workspace) {
FileHanding fileHandling(workspace);
@@ -257,7 +257,7 @@ void MainFrame::OnSaveAsClick(wxRibbonButtonBarEvent& event)
void MainFrame::OnSaveClick(wxRibbonButtonBarEvent& event)
{
- Workspace* workspace = (Workspace*)m_auiNotebook->GetCurrentPage();
+ Workspace* workspace = static_cast<Workspace*>(m_auiNotebook->GetCurrentPage());
if(workspace) {
FileHanding fileHandling(workspace);
@@ -282,7 +282,7 @@ void MainFrame::OnStabilitySettingsClick(wxRibbonButtonBarEvent& event) {}
void MainFrame::OnUndoClick(wxRibbonButtonBarEvent& event) {}
void MainFrame::OnAddElementsClick(wxCommandEvent& event)
{
- Workspace* workspace = (Workspace*)m_auiNotebook->GetCurrentPage();
+ Workspace* workspace = static_cast<Workspace*>(m_auiNotebook->GetCurrentPage());
if(workspace) {
if(workspace->GetWorkspaceMode() != MODE_INSERT) {
@@ -374,14 +374,12 @@ void MainFrame::OnAddElementsClick(wxCommandEvent& event)
void MainFrame::NotebookPageClosed(wxAuiNotebookEvent& event)
{
if(m_auiNotebook->GetPageCount() == 0) EnableCurrentProjectRibbon(false);
- // Memory leak?
}
void MainFrame::NotebookPageClosing(wxAuiNotebookEvent& event)
{
auto it = m_workspaceList.begin();
while(it != m_workspaceList.end()) {
if(*it == m_auiNotebook->GetCurrentPage()) {
- // delete *it; //Memory leak?
m_workspaceList.erase(it);
break;
}
@@ -391,14 +389,14 @@ void MainFrame::NotebookPageClosing(wxAuiNotebookEvent& event)
}
void MainFrame::OnRotClockClick(wxRibbonButtonBarEvent& event)
{
- Workspace* workspace = (Workspace*)m_auiNotebook->GetCurrentPage();
+ Workspace* workspace = static_cast<Workspace*>(m_auiNotebook->GetCurrentPage());
if(workspace) {
workspace->RotateSelectedElements();
}
}
void MainFrame::OnRotCounterClockClick(wxRibbonButtonBarEvent& event)
{
- Workspace* workspace = (Workspace*)m_auiNotebook->GetCurrentPage();
+ Workspace* workspace = static_cast<Workspace*>(m_auiNotebook->GetCurrentPage());
if(workspace) {
workspace->RotateSelectedElements(false);
}