summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Project/Transformer.cpp6
-rw-r--r--Project/Workspace.cpp17
2 files changed, 20 insertions, 3 deletions
diff --git a/Project/Transformer.cpp b/Project/Transformer.cpp
index 3cd0b6e..de92bea 100644
--- a/Project/Transformer.cpp
+++ b/Project/Transformer.cpp
@@ -88,9 +88,9 @@ void Transformer::Draw(wxPoint2DDouble translation, double scale) const
// Draw nodes selection.
if(m_pointList.size() > 0) {
- DrawCircle(m_pointList[0], 5.0 + m_borderSize, 10, GL_POLYGON);
+ DrawCircle(m_pointList[0], 5.0 + m_borderSize / scale, 10, GL_POLYGON);
if(m_inserted) {
- DrawCircle(m_pointList[m_pointList.size() - 1], 5.0 + m_borderSize, 10, GL_POLYGON);
+ DrawCircle(m_pointList[m_pointList.size() - 1], 5.0 + m_borderSize / scale, 10, GL_POLYGON);
}
}
}
@@ -228,7 +228,6 @@ void Transformer::RemoveParent(Element* parent)
for(int i = 0; i < 2; i++) {
if(parent == m_parentList[i]) {
m_parentList[i] = NULL;
- m_parentList[i] = NULL;
UpdateSwitchesPosition();
}
}
@@ -359,6 +358,7 @@ void Transformer::RotateNode(Element* parent)
bool Transformer::GetContextMenu(wxMenu& menu)
{
menu.Append(ID_EDIT_TRANSFORMER, _("Edit tranformer"));
+ menu.Append(ID_ROTATE, _("Rotate"));
menu.Append(ID_DELETE, _("Delete"));
return true;
}
diff --git a/Project/Workspace.cpp b/Project/Workspace.cpp
index 5408327..d515683 100644
--- a/Project/Workspace.cpp
+++ b/Project/Workspace.cpp
@@ -4,6 +4,7 @@
#include "Bus.h"
#include "Line.h"
#include "Transformer.h"
+#include "Generator.h"
// Camera
Camera::Camera()
@@ -590,6 +591,17 @@ void Workspace::OnKeyDown(wxKeyEvent& event)
}
}
break;
+ case 'G': // Insert a generator.
+ {
+ if(m_mode != MODE_INSERT) {
+ Generator* newGenerator = new Generator();
+ m_elementList.push_back(newGenerator);
+ m_mode = MODE_INSERT;
+ m_statusBar->SetStatusText(_("Insert Generator: Click on a buses, ESC to cancel."));
+ Redraw();
+ }
+ }
+ break;
default:
break;
}
@@ -649,6 +661,11 @@ void Workspace::OnPopupClick(wxCommandEvent& event)
wxMessageBox("Edit line!");
}
break;
+ case ID_EDIT_TRANSFORMER:
+ {
+ wxMessageBox("Edit transformer!");
+ }
+ break;
case ID_LINE_ADD_NODE:
{
Line* line = (Line*)element;