summaryrefslogtreecommitdiffstats
path: root/Project/MainFrame.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'Project/MainFrame.cpp')
-rw-r--r--Project/MainFrame.cpp74
1 files changed, 40 insertions, 34 deletions
diff --git a/Project/MainFrame.cpp b/Project/MainFrame.cpp
index df9fe52..bc1b584 100644
--- a/Project/MainFrame.cpp
+++ b/Project/MainFrame.cpp
@@ -11,13 +11,11 @@
#include "Inductor.h"
#include "Capacitor.h"
#include "FileHanding.h"
+#include "GeneralPropertiesForm.h"
+#include "SimulationsSettingsForm.h"
-MainFrame::MainFrame()
- : MainFrameBase(NULL)
-{
-}
-MainFrame::MainFrame(wxWindow* parent, wxLocale* locale)
- : MainFrameBase(parent)
+MainFrame::MainFrame() : MainFrameBase(NULL) {}
+MainFrame::MainFrame(wxWindow* parent, wxLocale* locale) : MainFrameBase(parent)
{
m_locale = locale;
@@ -27,8 +25,8 @@ MainFrame::~MainFrame()
{
// if(m_artMetro) delete m_artMetro;
if(m_addElementsMenu) {
- m_addElementsMenu->Disconnect(
- wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(MainFrame::OnAddElementsClick), NULL, this);
+ m_addElementsMenu->Disconnect(wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(MainFrame::OnAddElementsClick),
+ NULL, this);
delete m_addElementsMenu;
}
}
@@ -86,20 +84,21 @@ void MainFrame::CreateAddElementsMenu()
// busElement->SetBitmap(wxArtProvider::GetBitmap(wxART_WARNING));
wxMenuItem* lineElement =
new wxMenuItem(m_addElementsMenu, ID_ADDMENU_LINE, _("&Line\tL"), _("Adds a power line at the circuit"));
- wxMenuItem* transformerElement = new wxMenuItem(
- m_addElementsMenu, ID_ADDMENU_TRANSFORMER, _("&Transformer\tT"), _("Adds a transformer at the circuit"));
- wxMenuItem* generatorElement = new wxMenuItem(
- m_addElementsMenu, ID_ADDMENU_GENERATOR, _("&Generator\tG"), _("Adds a generator at the circuit"));
- wxMenuItem* indMotorElement = new wxMenuItem(
- m_addElementsMenu, ID_ADDMENU_INDMOTOR, _("&Induction motor\tI"), _("Adds an induction motor at the circuit"));
- wxMenuItem* syncCompElement = new wxMenuItem(m_addElementsMenu, ID_ADDMENU_SYNCCOMP,
- _("&Synchronous compensator \tK"), _("Adds an induction motor at the circuit"));
+ wxMenuItem* transformerElement = new wxMenuItem(m_addElementsMenu, ID_ADDMENU_TRANSFORMER, _("&Transformer\tT"),
+ _("Adds a transformer at the circuit"));
+ wxMenuItem* generatorElement = new wxMenuItem(m_addElementsMenu, ID_ADDMENU_GENERATOR, _("&Generator\tG"),
+ _("Adds a generator at the circuit"));
+ wxMenuItem* indMotorElement = new wxMenuItem(m_addElementsMenu, ID_ADDMENU_INDMOTOR, _("&Induction motor\tI"),
+ _("Adds an induction motor at the circuit"));
+ wxMenuItem* syncCompElement =
+ new wxMenuItem(m_addElementsMenu, ID_ADDMENU_SYNCCOMP, _("&Synchronous compensator \tK"),
+ _("Adds an induction motor at the circuit"));
wxMenuItem* loadElement =
new wxMenuItem(m_addElementsMenu, ID_ADDMENU_LOAD, _("&Load\tShift-L"), _("Adds a load at the circuit"));
- wxMenuItem* capacitorElement = new wxMenuItem(
- m_addElementsMenu, ID_ADDMENU_CAPACITOR, _("&Capacitor\tShift-C"), _("Adds a shunt capacitor at the circuit"));
- wxMenuItem* inductorElement = new wxMenuItem(
- m_addElementsMenu, ID_ADDMENU_INDUCTOR, _("&Inductor\tShift-I"), _("Adds a shunt inductor at the circuit"));
+ wxMenuItem* capacitorElement = new wxMenuItem(m_addElementsMenu, ID_ADDMENU_CAPACITOR, _("&Capacitor\tShift-C"),
+ _("Adds a shunt capacitor at the circuit"));
+ wxMenuItem* inductorElement = new wxMenuItem(m_addElementsMenu, ID_ADDMENU_INDUCTOR, _("&Inductor\tShift-I"),
+ _("Adds a shunt inductor at the circuit"));
m_addElementsMenu->Append(busElement);
m_addElementsMenu->Append(lineElement);
@@ -150,7 +149,6 @@ void MainFrame::OnDisableSolutionClick(wxRibbonButtonBarEvent& event)
}
void MainFrame::OnDragClick(wxRibbonButtonBarEvent& event) {}
-
void MainFrame::OnEnableSolutionClick(wxRibbonButtonBarEvent& event)
{
m_ribbonButtonBarContinuous->ToggleButton(ID_RIBBON_ENABLESOL, true);
@@ -158,7 +156,6 @@ void MainFrame::OnEnableSolutionClick(wxRibbonButtonBarEvent& event)
}
void MainFrame::OnExpImpClick(wxRibbonButtonBarEvent& event) {}
-
void MainFrame::OnFaultClick(wxRibbonButtonBarEvent& event)
{
if(Workspace* workspace = dynamic_cast<Workspace*>(m_auiNotebook->GetCurrentPage())) {
@@ -203,8 +200,8 @@ void MainFrame::OnMoveClick(wxRibbonButtonBarEvent& event)
void MainFrame::OnOpenClick(wxRibbonButtonBarEvent& event)
{
- wxFileDialog openFileDialog(
- this, _("Open PSP file"), "", "", "PSP files (*.psp)|*.psp", wxFD_OPEN | wxFD_FILE_MUST_EXIST);
+ wxFileDialog openFileDialog(this, _("Open PSP file"), "", "", "PSP files (*.psp)|*.psp",
+ wxFD_OPEN | wxFD_FILE_MUST_EXIST);
if(openFileDialog.ShowModal() == wxID_CANCEL) return;
wxFileName fileName(openFileDialog.GetPath());
@@ -227,8 +224,8 @@ void MainFrame::OnOpenClick(wxRibbonButtonBarEvent& event)
newWorkspace->SetJustOpened(true);
m_projectNumber++;
} else {
- wxMessageDialog msgDialog(
- this, _("It was not possible to open the selected file."), _("Error"), wxOK | wxCENTRE | wxICON_ERROR);
+ wxMessageDialog msgDialog(this, _("It was not possible to open the selected file."), _("Error"),
+ wxOK | wxCENTRE | wxICON_ERROR);
msgDialog.ShowModal();
delete newWorkspace;
}
@@ -244,7 +241,6 @@ void MainFrame::OnPowerFlowClick(wxRibbonButtonBarEvent& event)
}
}
-void MainFrame::OnProjectSettingsClick(wxRibbonButtonBarEvent& event) {}
void MainFrame::OnRedoClick(wxRibbonButtonBarEvent& event) {}
void MainFrame::OnResetVoltagesClick(wxRibbonButtonBarEvent& event) {}
void MainFrame::OnRunStabilityClick(wxRibbonButtonBarEvent& event)
@@ -268,8 +264,8 @@ void MainFrame::OnSaveAsClick(wxRibbonButtonBarEvent& event)
if(workspace) {
FileHanding fileHandling(workspace);
- wxFileDialog saveFileDialog(
- this, _("Save PSP file"), "", "", "PSP files (*.psp)|*.psp", wxFD_SAVE | wxFD_OVERWRITE_PROMPT);
+ wxFileDialog saveFileDialog(this, _("Save PSP file"), "", "", "PSP files (*.psp)|*.psp",
+ wxFD_SAVE | wxFD_OVERWRITE_PROMPT);
if(saveFileDialog.ShowModal() == wxID_CANCEL) return;
fileHandling.SaveProject(saveFileDialog.GetPath());
@@ -289,8 +285,8 @@ void MainFrame::OnSaveClick(wxRibbonButtonBarEvent& event)
if(workspace->GetSavedPath().IsOk()) {
fileHandling.SaveProject(workspace->GetSavedPath());
} else {
- wxFileDialog saveFileDialog(
- this, _("Save PSP file"), "", "", "PSP files (*.psp)|*.psp", wxFD_SAVE | wxFD_OVERWRITE_PROMPT);
+ wxFileDialog saveFileDialog(this, _("Save PSP file"), "", "", "PSP files (*.psp)|*.psp",
+ wxFD_SAVE | wxFD_OVERWRITE_PROMPT);
if(saveFileDialog.ShowModal() == wxID_CANCEL) return;
fileHandling.SaveProject(saveFileDialog.GetPath());
@@ -303,7 +299,6 @@ void MainFrame::OnSaveClick(wxRibbonButtonBarEvent& event)
}
void MainFrame::OnSnapshotClick(wxRibbonButtonBarEvent& event) {}
-void MainFrame::OnStabilitySettingsClick(wxRibbonButtonBarEvent& event) {}
void MainFrame::OnUndoClick(wxRibbonButtonBarEvent& event) {}
void MainFrame::OnAddElementsClick(wxCommandEvent& event)
{
@@ -317,8 +312,8 @@ void MainFrame::OnAddElementsClick(wxCommandEvent& event)
switch(event.GetId()) {
case ID_ADDMENU_BUS: {
- Bus* newBus = new Bus(
- wxPoint2DDouble(0, 0), wxString::Format(_("Bus %d"), workspace->GetElementNumber(ID_BUS)));
+ Bus* newBus = new Bus(wxPoint2DDouble(0, 0),
+ wxString::Format(_("Bus %d"), workspace->GetElementNumber(ID_BUS)));
workspace->IncrementElementNumber(ID_BUS);
elementList.push_back(newBus);
statusBarText = _("Insert Bus: Click to insert, ESC to cancel.");
@@ -426,3 +421,14 @@ void MainFrame::OnRotCounterClockClick(wxRibbonButtonBarEvent& event)
workspace->RotateSelectedElements(false);
}
}
+void MainFrame::OnGeneralSettingsClick(wxRibbonButtonBarEvent& event)
+{
+ GeneralPropertiesForm genPropForm(this);
+ genPropForm.ShowModal();
+}
+
+void MainFrame::OnSimulationSettingsClick(wxRibbonButtonBarEvent& event)
+{
+ SimulationsSettingsForm simulSettingsForm(this);
+ simulSettingsForm.ShowModal();
+}