From 05525745c0b0d189484da3c45f95356d7558e2cf Mon Sep 17 00:00:00 2001 From: Thales1330 Date: Thu, 18 Aug 2016 19:10:04 -0300 Subject: Line improvements, context menu implemented Line still under construction, contex menu base implemented --- Project/Element.h | 29 ++++++++++++++++++++++++----- 1 file changed, 24 insertions(+), 5 deletions(-) (limited to 'Project/Element.h') diff --git a/Project/Element.h b/Project/Element.h index 1287bc4..eb89640 100644 --- a/Project/Element.h +++ b/Project/Element.h @@ -3,6 +3,7 @@ #include #include +#include #include enum PickboxID @@ -16,6 +17,17 @@ enum PickboxID ID_PB_LEFT_TOP }; +enum ContextMenuID +{ + ID_EDIT_BUS = 0, + ID_EDIT_LINE, + + ID_LINE_ADD_NODE, + ID_LINE_REMOVE_NODE, + + ID_ROTATE +}; + class Element { public: @@ -51,10 +63,12 @@ class Element virtual wxCursor GetBestPickboxCursor() const = 0; // General methods - virtual void AddPoint(wxPoint2DDouble point){}; + virtual bool GetContextMenu(wxMenu& menu) { return false; } + virtual void AddPoint(wxPoint2DDouble point) {} virtual void StartMove(wxPoint2DDouble position); virtual void Move(wxPoint2DDouble position); virtual void MoveNode(Element* parent, wxPoint2DDouble position){}; + virtual void RotateNode(Element* parent) {} virtual wxPoint2DDouble GetSwitchPoint(Element* parent, wxPoint2DDouble parentPoint, wxPoint2DDouble secondPoint) const; @@ -63,17 +77,21 @@ class Element double scale, double offsetX = 0.0, double offsetY = 0.0) const; + virtual wxPoint2DDouble WorldToScreen(wxPoint2DDouble position, + wxPoint2DDouble translation, + double scale, + double offsetX = 0.0, + double offsetY = 0.0) const; virtual void DrawCircle(wxPoint2DDouble position, double radius, int numSegments, GLenum mode = GL_LINE_LOOP) const; virtual void DrawRectangle(wxPoint2DDouble position, double width, double height, GLenum mode = GL_QUADS) const; virtual void DrawRectangle(wxPoint2DDouble* points, GLenum mode = GL_QUADS) const; virtual void DrawLine(std::vector points, GLenum mode = GL_LINE_STRIP) const; virtual void DrawPickbox(wxPoint2DDouble position) const; virtual wxPoint2DDouble RotateAtPosition(wxPoint2DDouble pointToRotate, double angle, bool degrees = true) const; - - virtual std::vector GetParentList() const { return m_parentList; } - virtual wxPoint2DDouble GetMoveStartPosition() const { return m_moveStartPt; } - virtual wxPoint2DDouble GetMovePosition() const { return m_movePos; } + virtual std::vector GetParentList() const { return m_parentList; } + virtual wxPoint2DDouble GetMoveStartPosition() const { return m_moveStartPt; } + virtual wxPoint2DDouble GetMovePosition() const { return m_movePos; } protected: std::vector m_parentList; @@ -83,6 +101,7 @@ class Element double m_height = 0.0; double m_angle = 0.0; double m_borderSize = 2.0; + double m_rotationAngle = 45.0; bool m_selected = false; bool m_dragging = false; -- cgit