summaryrefslogtreecommitdiffstats
path: root/Project/MainFrame.cpp
diff options
context:
space:
mode:
authorThales Lima Oliveira <thaleslima.ufu@gmail.com>2019-07-24 00:02:49 -0300
committerGitHub <noreply@github.com>2019-07-24 00:02:49 -0300
commit4f434e4a1cccce69e4b680e4734df52244d3a30b (patch)
tree54886abf6d62d9341377d535e52b36016b602107 /Project/MainFrame.cpp
parent8357c081eb75147bb8f94d8b6e367d88ea3898ed (diff)
parent0ca6710a7e003952e1212c8e32ebb2e7c008d508 (diff)
downloadPSP.git-4f434e4a1cccce69e4b680e4734df52244d3a30b.tar.gz
PSP.git-4f434e4a1cccce69e4b680e4734df52244d3a30b.tar.xz
PSP.git-4f434e4a1cccce69e4b680e4734df52244d3a30b.zip
Merge pull request #51 from Thales1330/wip/induction-motor
Newton bug fixed
Diffstat (limited to 'Project/MainFrame.cpp')
-rw-r--r--Project/MainFrame.cpp39
1 files changed, 37 insertions, 2 deletions
diff --git a/Project/MainFrame.cpp b/Project/MainFrame.cpp
index 5e81c89..249a612 100644
--- a/Project/MainFrame.cpp
+++ b/Project/MainFrame.cpp
@@ -34,6 +34,7 @@
#include "SyncGenerator.h"
#include "SyncMotor.h"
#include "Transformer.h"
+#include "StabilityEventList.h"
#include "Workspace.h"
#include "artProvider/ArtMetro.h"
@@ -78,6 +79,11 @@ MainFrame::~MainFrame()
NULL, this);
delete m_addElementsMenu;
}
+ if(m_stabilityMenu) {
+ m_stabilityMenu->Disconnect(wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(MainFrame::OnStabilityMenuClick),
+ NULL, this);
+ delete m_stabilityMenu;
+ }
if(m_locale) delete m_locale;
if(m_generalProperties) delete m_generalProperties;
}
@@ -86,7 +92,7 @@ void MainFrame::Init()
{
this->SetSize(800, 600);
- CreateAddElementsMenu();
+ CreateDropdownMenus();
EnableCurrentProjectRibbon(false);
@@ -129,7 +135,7 @@ void MainFrame::EnableCurrentProjectRibbon(bool enable)
m_ribbonButtonBarSimulations->EnableButton(ID_RIBBON_FREQRESP, enable);
}
-void MainFrame::CreateAddElementsMenu()
+void MainFrame::CreateDropdownMenus()
{
m_addElementsMenu = new wxMenu();
@@ -156,6 +162,8 @@ void MainFrame::CreateAddElementsMenu()
wxMenuItem* harmCurrentElement =
new wxMenuItem(m_addElementsMenu, ID_ADDMENU_HARMCURRENT, _("&Harmonic current\tShift-H"),
_("Adds a harmonic current source at the circuit"));
+ wxMenuItem* textElement =
+ new wxMenuItem(m_addElementsMenu, ID_ADDMENU_TEXT, _("&Text\tA"), _("Adds a linked text element"));
m_addElementsMenu->Append(busElement);
m_addElementsMenu->Append(lineElement);
@@ -167,8 +175,17 @@ void MainFrame::CreateAddElementsMenu()
m_addElementsMenu->Append(capacitorElement);
m_addElementsMenu->Append(inductorElement);
m_addElementsMenu->Append(harmCurrentElement);
+ m_addElementsMenu->Append(textElement);
m_addElementsMenu->Bind(wxEVT_COMMAND_MENU_SELECTED, &MainFrame::OnAddElementsClick, this);
+
+ m_stabilityMenu = new wxMenu();
+
+ wxMenuItem* stabilityList = new wxMenuItem(m_stabilityMenu, ID_STABMENU_LIST, _("&Stability event list"),
+ _("Show the stability event list"));
+ m_stabilityMenu->Append(stabilityList);
+
+ m_stabilityMenu->Bind(wxEVT_COMMAND_MENU_SELECTED, &MainFrame::OnStabilityMenuClick, this);
}
void MainFrame::OnNewClick(wxRibbonButtonBarEvent& event)
@@ -565,3 +582,21 @@ void MainFrame::OnHarmDistortionsClick(wxRibbonButtonBarEvent& event)
Workspace* workspace = static_cast<Workspace*>(m_auiNotebook->GetCurrentPage());
if(workspace) { workspace->RunHarmonicDistortion(); }
}
+
+void MainFrame::OnStabilityDropdown(wxRibbonButtonBarEvent& event) { event.PopupMenu(m_stabilityMenu); }
+
+void MainFrame::OnStabilityMenuClick(wxCommandEvent& event)
+{
+ Workspace* workspace = static_cast<Workspace*>(m_auiNotebook->GetCurrentPage());
+
+ if(workspace) {
+ auto elementList = workspace->GetElementList();
+
+ switch(event.GetId()) {
+ case ID_STABMENU_LIST: {
+ StabilityEventList stabEventList(this, elementList);
+ stabEventList.ShowModal();
+ } break;
+ }
+ }
+}