summaryrefslogtreecommitdiffstats
path: root/Project/MainFrame.cpp
diff options
context:
space:
mode:
authorThales Lima Oliveira <thaleslima.ufu@gmail.com>2018-04-03 22:06:26 -0300
committerThales Lima Oliveira <thaleslima.ufu@gmail.com>2018-04-03 22:06:26 -0300
commitaef98fb30666fd86cbbafc8bd748e4815d3c819b (patch)
tree5ee58837c00eb62122798841a02409aaef0ce9bc /Project/MainFrame.cpp
parent15d73e75d8f8a30c5d89f61bff05af4caf6202b1 (diff)
downloadPSP.git-aef98fb30666fd86cbbafc8bd748e4815d3c819b.tar.gz
PSP.git-aef98fb30666fd86cbbafc8bd748e4815d3c819b.tar.xz
PSP.git-aef98fb30666fd86cbbafc8bd748e4815d3c819b.zip
.PWF parse implemented, some electrical data set too
Diffstat (limited to 'Project/MainFrame.cpp')
-rw-r--r--Project/MainFrame.cpp78
1 files changed, 33 insertions, 45 deletions
diff --git a/Project/MainFrame.cpp b/Project/MainFrame.cpp
index 649db8e..7d129b4 100644
--- a/Project/MainFrame.cpp
+++ b/Project/MainFrame.cpp
@@ -15,26 +15,26 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
-#include "MainFrame.h"
-#include "artProvider/ArtMetro.h"
-#include "Workspace.h"
+#include "AboutForm.h"
#include "Bus.h"
-#include "Line.h"
-#include "Transformer.h"
-#include "SyncGenerator.h"
-#include "IndMotor.h"
-#include "SyncMotor.h"
-#include "Load.h"
-#include "Inductor.h"
#include "Capacitor.h"
-#include "FileHanding.h"
-#include "GeneralPropertiesForm.h"
-#include "SimulationsSettingsForm.h"
-#include "PropertiesData.h"
#include "ChartView.h"
#include "DataReport.h"
-#include "AboutForm.h"
+#include "FileHanding.h"
+#include "GeneralPropertiesForm.h"
#include "ImportForm.h"
+#include "IndMotor.h"
+#include "Inductor.h"
+#include "Line.h"
+#include "Load.h"
+#include "MainFrame.h"
+#include "PropertiesData.h"
+#include "SimulationsSettingsForm.h"
+#include "SyncGenerator.h"
+#include "SyncMotor.h"
+#include "Transformer.h"
+#include "Workspace.h"
+#include "artProvider/ArtMetro.h"
MainFrame::MainFrame() : MainFrameBase(NULL) {}
MainFrame::MainFrame(wxWindow* parent, wxLocale* locale, PropertiesData* initProperties, wxString openPath)
@@ -167,8 +167,8 @@ void MainFrame::OnNewClick(wxRibbonButtonBarEvent& event)
{
EnableCurrentProjectRibbon();
- Workspace* newWorkspace =
- new Workspace(this, wxString::Format(_("New project %d"), m_projectNumber), this->GetStatusBar(), m_sharedGLContext);
+ Workspace* newWorkspace = new Workspace(this, wxString::Format(_("New project %d"), m_projectNumber),
+ this->GetStatusBar(), m_sharedGLContext);
if(!m_sharedGLContext) m_sharedGLContext = newWorkspace->GetOpenGLContext();
m_workspaceList.push_back(newWorkspace);
@@ -215,9 +215,7 @@ void MainFrame::OnDataReportClick(wxRibbonButtonBarEvent& event)
void MainFrame::OnDeleteClick(wxRibbonButtonBarEvent& event)
{
Workspace* workspace = static_cast<Workspace*>(m_auiNotebook->GetCurrentPage());
- if(workspace) {
- workspace->DeleteSelectedElements();
- }
+ if(workspace) { workspace->DeleteSelectedElements(); }
}
void MainFrame::OnDisableSolutionClick(wxRibbonButtonBarEvent& event)
{
@@ -239,20 +237,16 @@ void MainFrame::OnEnableSolutionClick(wxRibbonButtonBarEvent& event)
m_ribbonButtonBarContinuous->ToggleButton(ID_RIBBON_DISABLESOL, false);
}
-//void MainFrame::OnExpImpClick(wxRibbonButtonBarEvent& event) {}
+// void MainFrame::OnExpImpClick(wxRibbonButtonBarEvent& event) {}
void MainFrame::OnFaultClick(wxRibbonButtonBarEvent& event)
{
- if(Workspace* workspace = dynamic_cast<Workspace*>(m_auiNotebook->GetCurrentPage())) {
- workspace->RunFault();
- }
+ if(Workspace* workspace = dynamic_cast<Workspace*>(m_auiNotebook->GetCurrentPage())) { workspace->RunFault(); }
}
void MainFrame::OnFitClick(wxRibbonButtonBarEvent& event)
{
Workspace* workspace = static_cast<Workspace*>(m_auiNotebook->GetCurrentPage());
- if(workspace) {
- workspace->Fit();
- }
+ if(workspace) { workspace->Fit(); }
}
void MainFrame::OnMoveClick(wxRibbonButtonBarEvent& event)
@@ -274,9 +268,7 @@ void MainFrame::OnMoveClick(wxRibbonButtonBarEvent& event)
// Set the move position to the average of selected elements.
for(auto it = elementList.begin(), itEnd = elementList.end(); it != itEnd; ++it) {
Element* element = *it;
- if(element->IsSelected()) {
- element->StartMove(averagePos);
- }
+ if(element->IsSelected()) { element->StartMove(averagePos); }
}
workspace->SetWorkspaceMode(Workspace::MODE_MOVE_ELEMENT);
}
@@ -321,9 +313,7 @@ void MainFrame::OnPasteClick(wxRibbonButtonBarEvent& event) {}
void MainFrame::OnPowerFlowClick(wxRibbonButtonBarEvent& event)
{
Workspace* workspace = static_cast<Workspace*>(m_auiNotebook->GetCurrentPage());
- if(workspace) {
- workspace->RunPowerFlow();
- }
+ if(workspace) { workspace->RunPowerFlow(); }
}
void MainFrame::OnRedoClick(wxRibbonButtonBarEvent& event) {}
@@ -331,17 +321,13 @@ void MainFrame::OnResetVoltagesClick(wxRibbonButtonBarEvent& event) {}
void MainFrame::OnRunStabilityClick(wxRibbonButtonBarEvent& event)
{
Workspace* workspace = static_cast<Workspace*>(m_auiNotebook->GetCurrentPage());
- if(workspace) {
- workspace->RunStability();
- }
+ if(workspace) { workspace->RunStability(); }
}
void MainFrame::OnSCPowerClick(wxRibbonButtonBarEvent& event)
{
Workspace* workspace = static_cast<Workspace*>(m_auiNotebook->GetCurrentPage());
- if(workspace) {
- workspace->RunSCPower();
- }
+ if(workspace) { workspace->RunSCPower(); }
}
void MainFrame::OnSaveAsClick(wxRibbonButtonBarEvent& event)
@@ -485,8 +471,14 @@ void MainFrame::OnImportClick(wxRibbonButtonBarEvent& event)
ImportForm importForm(this, impWorkspace);
if(importForm.ShowModal() == wxID_OK) {
// Import file(s)
+ EnableCurrentProjectRibbon();
+
if(!m_sharedGLContext) m_sharedGLContext = impWorkspace->GetOpenGLContext();
m_workspaceList.push_back(impWorkspace);
+
+ m_ribbonButtonBarContinuous->ToggleButton(ID_RIBBON_DISABLESOL, true);
+ m_ribbonButtonBarContinuous->ToggleButton(ID_RIBBON_ENABLESOL, false);
+
m_auiNotebook->AddPage(impWorkspace, impWorkspace->GetName(), true);
m_auiNotebook->Layout();
impWorkspace->Redraw();
@@ -521,17 +513,13 @@ void MainFrame::NotebookPageClosing(wxAuiNotebookEvent& event)
void MainFrame::OnRotClockClick(wxRibbonButtonBarEvent& event)
{
Workspace* workspace = static_cast<Workspace*>(m_auiNotebook->GetCurrentPage());
- if(workspace) {
- workspace->RotateSelectedElements();
- }
+ if(workspace) { workspace->RotateSelectedElements(); }
}
void MainFrame::OnRotCounterClockClick(wxRibbonButtonBarEvent& event)
{
Workspace* workspace = static_cast<Workspace*>(m_auiNotebook->GetCurrentPage());
- if(workspace) {
- workspace->RotateSelectedElements(false);
- }
+ if(workspace) { workspace->RotateSelectedElements(false); }
}
void MainFrame::OnGeneralSettingsClick(wxRibbonButtonBarEvent& event)