diff options
author | Thales Lima Oliveira <thaleslima.ufu@gmail.com> | 2016-09-04 00:59:41 -0300 |
---|---|---|
committer | Thales Lima Oliveira <thaleslima.ufu@gmail.com> | 2016-09-04 00:59:41 -0300 |
commit | c1aad656847602f7e4c7aead048f7465a76838d4 (patch) | |
tree | 2b69d1d0e98f50ed8113746c3c4a4d87d6be3b7e /Project/Workspace.cpp | |
parent | 726686c9b378f3a727ded52226b13a760cba1e6c (diff) | |
download | PSP.git-c1aad656847602f7e4c7aead048f7465a76838d4.tar.gz PSP.git-c1aad656847602f7e4c7aead048f7465a76838d4.tar.xz PSP.git-c1aad656847602f7e4c7aead048f7465a76838d4.zip |
Inductor implemented
Diffstat (limited to 'Project/Workspace.cpp')
-rw-r--r-- | Project/Workspace.cpp | 49 |
1 files changed, 28 insertions, 21 deletions
diff --git a/Project/Workspace.cpp b/Project/Workspace.cpp index e5b9e3f..79bb61c 100644 --- a/Project/Workspace.cpp +++ b/Project/Workspace.cpp @@ -8,6 +8,7 @@ #include "IndMotor.h" #include "SyncMotor.h" #include "Load.h" +#include "Inductor.h" // Camera Camera::Camera() @@ -572,13 +573,21 @@ void Workspace::OnKeyDown(wxKeyEvent& event) } } break; - case 'L': // Insert a power line. + case 'L': { if(m_mode != MODE_INSERT) { - Line* newLine = new Line(); - m_elementList.push_back(newLine); - m_mode = MODE_INSERT; - m_statusBar->SetStatusText(_("Insert Line: Click on two buses, ESC to cancel.")); + if(event.GetModifiers() == wxMOD_SHIFT) { // Insert a load. + Load* newLoad = new Load(); + m_elementList.push_back(newLoad); + m_mode = MODE_INSERT; + m_statusBar->SetStatusText(_("Insert Load: Click on a buses, ESC to cancel.")); + } + else { // Insert a power line. + Line* newLine = new Line(); + m_elementList.push_back(newLine); + m_mode = MODE_INSERT; + m_statusBar->SetStatusText(_("Insert Line: Click on two buses, ESC to cancel.")); + } Redraw(); } } @@ -605,13 +614,22 @@ void Workspace::OnKeyDown(wxKeyEvent& event) } } break; - case 'I': // Insert an induction motor. + case 'I': { if(m_mode != MODE_INSERT) { - IndMotor* newIndMotor = new IndMotor(); - m_elementList.push_back(newIndMotor); - m_mode = MODE_INSERT; - m_statusBar->SetStatusText(_("Insert Induction Motor: Click on a buses, ESC to cancel.")); + if(event.GetModifiers() == wxMOD_SHIFT) { // Insert an inductor. + Inductor* newInductor = new Inductor(); + m_elementList.push_back(newInductor); + m_mode = MODE_INSERT; + m_statusBar->SetStatusText(_("Insert Inductor: Click on a buses, ESC to cancel.")); + } + else // Insert an induction motor. + { + IndMotor* newIndMotor = new IndMotor(); + m_elementList.push_back(newIndMotor); + m_mode = MODE_INSERT; + m_statusBar->SetStatusText(_("Insert Induction Motor: Click on a buses, ESC to cancel.")); + } Redraw(); } } @@ -627,17 +645,6 @@ void Workspace::OnKeyDown(wxKeyEvent& event) } } break; - case 'C': // Insert a load. - { - if(m_mode != MODE_INSERT) { - Load* newLoad = new Load(); - m_elementList.push_back(newLoad); - m_mode = MODE_INSERT; - m_statusBar->SetStatusText(_("Insert Load: Click on a buses, ESC to cancel.")); - Redraw(); - } - } - break; default: break; } |