From c1aad656847602f7e4c7aead048f7465a76838d4 Mon Sep 17 00:00:00 2001 From: Thales Lima Oliveira Date: Sun, 4 Sep 2016 00:59:41 -0300 Subject: Inductor implemented --- Project/Workspace.cpp | 49 ++++++++++++++++++++++++++++--------------------- 1 file changed, 28 insertions(+), 21 deletions(-) (limited to 'Project/Workspace.cpp') 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; } -- cgit