diff options
author | Thales1330 <thaleslima.ufu@gmail.com> | 2016-08-02 17:34:42 -0300 |
---|---|---|
committer | Thales1330 <thaleslima.ufu@gmail.com> | 2016-08-02 17:34:42 -0300 |
commit | 78aac544e1e77f5405260797cee4b94d7a0dfe32 (patch) | |
tree | 32a71352d3fe13f361f90f51d5389317fd4d7015 /Project/Workspace.h | |
parent | 0ac91e091e52cae5745b14d62f77f905e559cf92 (diff) | |
download | PSP.git-78aac544e1e77f5405260797cee4b94d7a0dfe32.tar.gz PSP.git-78aac544e1e77f5405260797cee4b94d7a0dfe32.tar.xz PSP.git-78aac544e1e77f5405260797cee4b94d7a0dfe32.zip |
Bus controllers under implementation
Events handler removed
Diffstat (limited to 'Project/Workspace.h')
-rw-r--r-- | Project/Workspace.h | 56 |
1 files changed, 33 insertions, 23 deletions
diff --git a/Project/Workspace.h b/Project/Workspace.h index ef837fb..e093105 100644 --- a/Project/Workspace.h +++ b/Project/Workspace.h @@ -5,69 +5,79 @@ #include <GL/glu.h> #include <wx/dcclient.h> #include <wx/msgdlg.h> +#include <wx/statusbr.h> #include "WorkspaceBase.h" -class MouseEventsHandler; +class Camera; class Element; -class Bus; - -//#include "MouseEventsHandler.h" -//#include "Bus.h" -class Camera; +enum WorkspaceMode +{ + MODE_EDIT = 0, + MODE_DRAG, + MODE_INSERT +}; class Workspace : public WorkspaceBase { protected: + virtual void OnLeftClickUp(wxMouseEvent& event); + virtual void OnScroll(wxMouseEvent& event); + virtual void OnMiddleDown(wxMouseEvent& event); + virtual void OnMiddleUp(wxMouseEvent& event); virtual void OnMouseMotion(wxMouseEvent& event); - virtual void OnKeyDown(wxKeyEvent& event) { event.Skip(); }; + virtual void OnKeyDown(wxKeyEvent& event); virtual void OnLeftClickDown(wxMouseEvent& event); virtual void OnPaint(wxPaintEvent& event); void SetViewport(); wxGLContext* m_glContext; + wxStatusBar* m_statusBar; + Camera* m_camera; wxString m_name; - bool m_insertMode = false; - bool m_dragMode = false; + //bool m_insertMode = false; + //bool m_dragMode = false; + WorkspaceMode m_mode = MODE_EDIT; std::vector<Element*> m_elementList; + + void UpdateStatusBar(); public: Workspace(); - Workspace(wxWindow* parent, wxString name = wxEmptyString); + Workspace(wxWindow* parent, wxString name = wxEmptyString, wxStatusBar* statusBar = NULL); ~Workspace(); - MouseEventsHandler* m_mouseEventsHandler; - Camera* m_camera; // why public? - wxString GetName() const { return m_name; } void SetName(wxString name) { m_name = name; } - void SetDragMode(bool dragMode = true) { this->m_dragMode = dragMode; } - void SetInsertMode(bool insertMode = true) { this->m_insertMode = insertMode; } - bool IsDragMode() const { return m_dragMode; } std::vector<Element*> GetElementList() { return m_elementList; } - bool IsInsertMode() const { return m_insertMode; } - void Redraw() { this->Refresh(); } + void Redraw() { m_glCanvas->Refresh(); } }; class Camera { - private: + protected: wxPoint2DDouble m_translation; + wxPoint2DDouble m_translationStartPt; double m_scale; + + wxPoint2DDouble m_mousePosition; public: Camera(); ~Camera(); - void SetScale(double scale) { this->m_scale = scale; } - void SetTranslation(const wxPoint2DDouble& translation) { this->m_translation = translation; } + void SetScale(wxPoint2DDouble screenPoint, double delta); + void SetTranslation(wxPoint2DDouble screenPoint); + void StartTranslation(wxPoint2DDouble startPoint) { this->m_translationStartPt = startPoint; } + void UpdateMousePosition(wxPoint2DDouble mousePosition) {this->m_mousePosition = mousePosition;} double GetScale() const { return m_scale; } - const wxPoint2DDouble GetTranslation() const { return m_translation; } - wxPoint2DDouble ScreenToWorld(wxPoint2DDouble screenCoords); + wxPoint2DDouble GetTranslation() const { return m_translation; } + wxPoint2DDouble GetMousePosition(bool worldCoords = true) const; + wxPoint2DDouble ScreenToWorld(wxPoint2DDouble screenCoords) const; }; #endif // WORKSPACE_H |