diff options
Diffstat (limited to 'Project')
-rw-r--r-- | Project/ControlEditor.cpp | 48 | ||||
-rw-r--r-- | Project/ControlEditor.h | 3 | ||||
-rw-r--r-- | Project/ElementForm.cpp | 202 | ||||
-rw-r--r-- | Project/ElementForm.h | 60 | ||||
-rw-r--r-- | Project/ElementForm.wxcp | 1760 | ||||
-rw-r--r-- | Project/ElementFormBitmaps.cpp | 4 | ||||
-rw-r--r-- | Project/Exponential.cpp | 10 | ||||
-rw-r--r-- | Project/Exponential.h | 14 | ||||
-rw-r--r-- | Project/Limiter.cpp | 89 | ||||
-rw-r--r-- | Project/Limiter.h | 33 | ||||
-rw-r--r-- | Project/LimiterForm.cpp | 34 | ||||
-rw-r--r-- | Project/LimiterForm.h | 21 | ||||
-rw-r--r-- | Project/Multiplier.cpp | 48 | ||||
-rw-r--r-- | Project/Multiplier.h | 4 | ||||
-rw-r--r-- | Project/Project.mk | 38 | ||||
-rw-r--r-- | Project/Project.project | 10 | ||||
-rw-r--r-- | Project/Project.txt | 2 | ||||
-rw-r--r-- | Project/RateLimiter.cpp | 97 | ||||
-rw-r--r-- | Project/RateLimiter.h | 32 | ||||
-rw-r--r-- | Project/RateLimiterForm.cpp | 35 | ||||
-rw-r--r-- | Project/RateLimiterForm.h | 21 |
21 files changed, 2531 insertions, 34 deletions
diff --git a/Project/ControlEditor.cpp b/Project/ControlEditor.cpp index 3b6f8a5..475fdce 100644 --- a/Project/ControlEditor.cpp +++ b/Project/ControlEditor.cpp @@ -5,6 +5,9 @@ #include "TransferFunction.h" #include "ConnectionLine.h" #include "Sum.h" +#include "Multiplier.h" +#include "Limiter.h" +#include "RateLimiter.h" ControlElementButton::ControlElementButton(wxWindow* parent, wxString label, wxImage image, wxWindowID id) : wxWindow(parent, id) @@ -61,7 +64,7 @@ void ControlElementButton::OnPaint(wxPaintEvent& event) gc->DrawRectangle(m_borderSize / 2, m_borderSize / 2, m_buttonSize.GetWidth(), m_buttonSize.GetHeight()); } gc->DrawBitmap(gc->CreateBitmapFromImage(m_image), m_imagePosition.x, m_imagePosition.y, m_imageSize.GetWidth(), - m_imageSize.GetHeight()); + m_imageSize.GetHeight()); gc->SetFont(m_font, *wxBLACK); gc->DrawText(m_label, m_labelPosition.x, m_labelPosition.y); delete gc; @@ -96,8 +99,7 @@ void ControlElementButton::OnLeftClickUp(wxMouseEvent& event) event.Skip(); } -ControlEditor::ControlEditor(wxWindow* parent) - : ControlEditorBase(parent) +ControlEditor::ControlEditor(wxWindow* parent) : ControlEditorBase(parent) { BuildControlElementPanel(); m_glContext = new wxGLContext(m_glCanvas); @@ -116,8 +118,8 @@ void ControlEditor::BuildControlElementPanel() wxWrapSizer* wrapSizer = new wxWrapSizer(); m_panelControlElements->SetSizer(wrapSizer); - ControlElementButton* ioButton = new ControlElementButton( - m_panelControlElements, _("In/Out"), wxImage("..\\data\\images\\control\\io.png"), ID_IO); + ControlElementButton* ioButton = new ControlElementButton(m_panelControlElements, _("In/Out"), + wxImage("..\\data\\images\\control\\io.png"), ID_IO); wrapSizer->Add(ioButton, 0, wxALL, 5); ioButton->Bind(wxEVT_LEFT_DOWN, &ControlEditor::LeftClickDown, this); @@ -126,8 +128,8 @@ void ControlEditor::BuildControlElementPanel() wrapSizer->Add(tfButton, 0, wxALL, 5); tfButton->Bind(wxEVT_LEFT_DOWN, &ControlEditor::LeftClickDown, this); - ControlElementButton* sumButton = new ControlElementButton( - m_panelControlElements, _("Sum"), wxImage("..\\data\\images\\control\\sum.png"), ID_SUM); + ControlElementButton* sumButton = new ControlElementButton(m_panelControlElements, _("Sum"), + wxImage("..\\data\\images\\control\\sum.png"), ID_SUM); wrapSizer->Add(sumButton, 0, wxALL, 5); sumButton->Bind(wxEVT_LEFT_DOWN, &ControlEditor::LeftClickDown, this); @@ -151,8 +153,8 @@ void ControlEditor::BuildControlElementPanel() wrapSizer->Add(multButton, 0, wxALL, 5); multButton->Bind(wxEVT_LEFT_DOWN, &ControlEditor::LeftClickDown, this); - ControlElementButton* satButton = new ControlElementButton( - m_panelControlElements, _("Saturation"), wxImage("..\\data\\images\\control\\sat.png"), ID_SAT); + ControlElementButton* satButton = new ControlElementButton(m_panelControlElements, _("Saturation"), + wxImage("..\\data\\images\\control\\sat.png"), ID_SAT); wrapSizer->Add(satButton, 0, wxALL, 5); satButton->Bind(wxEVT_LEFT_DOWN, &ControlEditor::LeftClickDown, this); @@ -170,7 +172,7 @@ void ControlEditor::LeftClickDown(wxMouseEvent& event) void ControlEditor::SetViewport() { - glClearColor(1.0, 1.0, 1.0, 1.0); // White background. + glClearColor(1.0, 1.0, 1.0, 1.0); // White background. glClear(GL_COLOR_BUFFER_BIT); glDisable(GL_DEPTH_TEST); glDisable(GL_TEXTURE_2D); @@ -213,19 +215,25 @@ void ControlEditor::AddElement(ControlElementButtonID id) wxLogMessage("const"); } break; case ID_LIMITER: { - wxLogMessage("limiter"); + m_mode = MODE_INSERT; + Limiter* limiter = new Limiter(); + m_elementList.push_back(limiter); } break; case ID_GAIN: { wxLogMessage("gain"); } break; case ID_MULT: { - wxLogMessage("mult"); + m_mode = MODE_INSERT; + Multiplier* mult = new Multiplier(); + m_elementList.push_back(mult); } break; case ID_SAT: { wxLogMessage("sat"); } break; case ID_RATELIM: { - wxLogMessage("rateLim"); + m_mode = MODE_INSERT; + RateLimiter* rateLim = new RateLimiter(); + m_elementList.push_back(rateLim); } break; } } @@ -237,8 +245,8 @@ void ControlEditor::OnPaint(wxPaintEvent& event) SetViewport(); // Set GLCanvas scale and translation. - glScaled(m_camera->GetScale(), m_camera->GetScale(), 0.0); // Scale - glTranslated(m_camera->GetTranslation().m_x, m_camera->GetTranslation().m_y, 0.0); // Translation + glScaled(m_camera->GetScale(), m_camera->GetScale(), 0.0); // Scale + glTranslated(m_camera->GetTranslation().m_x, m_camera->GetTranslation().m_y, 0.0); // Translation for(auto it = m_connectionList.begin(), itEnd = m_connectionList.end(); it != itEnd; ++it) { ConnectionLine* line = *it; @@ -267,7 +275,7 @@ void ControlEditor::OnPaint(wxPaintEvent& event) glVertex2d(m_selectionRect.m_x + m_selectionRect.m_width, m_selectionRect.m_y); glEnd(); - glFlush(); // Sends all pending information directly to the GPU. + glFlush(); // Sends all pending information directly to the GPU. m_glCanvas->SwapBuffers(); event.Skip(); } @@ -484,7 +492,7 @@ void ControlEditor::OnMouseMotion(wxMouseEvent& event) switch(m_mode) { case MODE_INSERT: { - Element* newElement = *(m_elementList.end() - 1); // Get the last element in the list. + Element* newElement = *(m_elementList.end() - 1); // Get the last element in the list. newElement->Move(m_camera->ScreenToWorld(clickPoint)); redraw = true; } break; @@ -578,11 +586,11 @@ void ControlEditor::OnKeyDown(wxKeyEvent& event) char key = event.GetUnicodeKey(); if(key != WXK_NONE) { switch(key) { - case WXK_DELETE: // Delete selected elements. + case WXK_DELETE: // Delete selected elements. { DeleteSelectedElements(); } break; - case 'R': // Rotate the selected elements. + case 'R': // Rotate the selected elements. { RotateSelectedElements(event.GetModifiers() != wxMOD_SHIFT); } break; @@ -675,7 +683,7 @@ void ControlEditor::CheckConnections() for(auto it = m_connectionList.begin(); it != m_connectionList.end(); ++it) { ConnectionLine* cLine = *it; if(cLine->GetType() == ConnectionLine::ELEMENT_ELEMENT) { - if(cLine->GetParentList().size() < 2){ + if(cLine->GetParentList().size() < 2) { it = DeleteLineFromList(it); } } diff --git a/Project/ControlEditor.h b/Project/ControlEditor.h index c9f47f8..4713f1d 100644 --- a/Project/ControlEditor.h +++ b/Project/ControlEditor.h @@ -15,6 +15,9 @@ class ControlElement; class TransferFunction; class ConnectionLine; class Sum; +class Multiplier; +class Limiter; +class RateLimiter; enum ControlElementButtonID { ID_IO = 0, ID_TF, ID_SUM, ID_CONST, ID_LIMITER, ID_GAIN, ID_MULT, ID_SAT, ID_RATELIM }; diff --git a/Project/ElementForm.cpp b/Project/ElementForm.cpp index ea7a3d8..afb8f7e 100644 --- a/Project/ElementForm.cpp +++ b/Project/ElementForm.cpp @@ -2975,3 +2975,205 @@ SumFormBase::~SumFormBase() m_ButtonCancel->Disconnect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(SumFormBase::OnCancelClick), NULL, this); } + +LimiterFormBase::LimiterFormBase(wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style) + : wxDialog(parent, id, title, pos, size, style) +{ + if ( !bBitmapLoaded ) { + // We need to initialise the default bitmap handler + wxXmlResource::Get()->AddHandler(new wxBitmapXmlHandler); + wxC9EE9InitBitmapResources(); + bBitmapLoaded = true; + } + + wxBoxSizer* boxSizerLvl1_1 = new wxBoxSizer(wxVERTICAL); + this->SetSizer(boxSizerLvl1_1); + + m_notebook = new wxNotebook(this, wxID_ANY, wxDefaultPosition, wxDLG_UNIT(this, wxSize(-1,-1)), wxBK_DEFAULT); + m_notebook->SetName(wxT("m_notebook")); + + boxSizerLvl1_1->Add(m_notebook, 1, wxEXPAND, WXC_FROM_DIP(5)); + + m_panelGeneral = new wxPanel(m_notebook, wxID_ANY, wxDefaultPosition, wxDLG_UNIT(m_notebook, wxSize(-1,-1)), wxTAB_TRAVERSAL); + m_notebook->AddPage(m_panelGeneral, _("General"), false); + + wxBoxSizer* boxSizerLvl2_1 = new wxBoxSizer(wxVERTICAL); + m_panelGeneral->SetSizer(boxSizerLvl2_1); + + m_staticTextUpLimiter = new wxStaticText(m_panelGeneral, wxID_ANY, _("Upper limit"), wxDefaultPosition, wxDLG_UNIT(m_panelGeneral, wxSize(-1,-1)), 0); + + boxSizerLvl2_1->Add(m_staticTextUpLimiter, 0, wxLEFT|wxRIGHT|wxTOP|wxALIGN_CENTER_VERTICAL, WXC_FROM_DIP(5)); + + m_textCtrlUpLimit = new wxTextCtrl(m_panelGeneral, wxID_ANY, wxT(""), wxDefaultPosition, wxDLG_UNIT(m_panelGeneral, wxSize(-1,-1)), 0); + #if wxVERSION_NUMBER >= 3000 + m_textCtrlUpLimit->SetHint(wxT("")); + #endif + + boxSizerLvl2_1->Add(m_textCtrlUpLimit, 0, wxLEFT|wxRIGHT|wxBOTTOM|wxEXPAND|wxALIGN_CENTER_VERTICAL, WXC_FROM_DIP(5)); + m_textCtrlUpLimit->SetMinSize(wxSize(100,-1)); + + m_staticTextLowLimit = new wxStaticText(m_panelGeneral, wxID_ANY, _("Lower limit"), wxDefaultPosition, wxDLG_UNIT(m_panelGeneral, wxSize(-1,-1)), 0); + + boxSizerLvl2_1->Add(m_staticTextLowLimit, 0, wxLEFT|wxRIGHT|wxTOP|wxALIGN_CENTER_VERTICAL, WXC_FROM_DIP(5)); + + m_textCtrlLowLimit = new wxTextCtrl(m_panelGeneral, wxID_ANY, wxT(""), wxDefaultPosition, wxDLG_UNIT(m_panelGeneral, wxSize(-1,-1)), 0); + #if wxVERSION_NUMBER >= 3000 + m_textCtrlLowLimit->SetHint(wxT("")); + #endif + + boxSizerLvl2_1->Add(m_textCtrlLowLimit, 0, wxLEFT|wxRIGHT|wxBOTTOM|wxEXPAND|wxALIGN_CENTER_VERTICAL, WXC_FROM_DIP(5)); + m_textCtrlLowLimit->SetMinSize(wxSize(100,-1)); + + wxBoxSizer* boxSizerBottomButtons = new wxBoxSizer(wxHORIZONTAL); + + boxSizerLvl1_1->Add(boxSizerBottomButtons, 0, wxALL|wxEXPAND, WXC_FROM_DIP(5)); + + boxSizerBottomButtons->Add(0, 0, 1, wxALL, WXC_FROM_DIP(5)); + + m_buttonOK = new wxButton(this, wxID_ANY, _("OK"), wxDefaultPosition, wxDLG_UNIT(this, wxSize(-1,-1)), 0); + + boxSizerBottomButtons->Add(m_buttonOK, 0, wxALL|wxALIGN_RIGHT, WXC_FROM_DIP(5)); + + m_ButtonCancel = new wxButton(this, wxID_ANY, _("Cancel"), wxDefaultPosition, wxDLG_UNIT(this, wxSize(-1,-1)), 0); + + boxSizerBottomButtons->Add(m_ButtonCancel, 0, wxALL|wxALIGN_RIGHT, WXC_FROM_DIP(5)); + + + #if wxVERSION_NUMBER >= 2900 + if(!wxPersistenceManager::Get().Find(m_notebook)){ + wxPersistenceManager::Get().RegisterAndRestore(m_notebook); + } else { + wxPersistenceManager::Get().Restore(m_notebook); + } + #endif + + SetName(wxT("LimiterFormBase")); + SetSize(-1,-1); + if (GetSizer()) { + GetSizer()->Fit(this); + } + if(GetParent()) { + CentreOnParent(wxBOTH); + } else { + CentreOnScreen(wxBOTH); + } +#if wxVERSION_NUMBER >= 2900 + if(!wxPersistenceManager::Get().Find(this)) { + wxPersistenceManager::Get().RegisterAndRestore(this); + } else { + wxPersistenceManager::Get().Restore(this); + } +#endif + // Connect events + m_buttonOK->Connect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(LimiterFormBase::OnOKButtonClick), NULL, this); + m_ButtonCancel->Connect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(LimiterFormBase::OnCancelButtonClick), NULL, this); + +} + +LimiterFormBase::~LimiterFormBase() +{ + m_buttonOK->Disconnect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(LimiterFormBase::OnOKButtonClick), NULL, this); + m_ButtonCancel->Disconnect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(LimiterFormBase::OnCancelButtonClick), NULL, this); + +} + +RateLimiterFormBase::RateLimiterFormBase(wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style) + : wxDialog(parent, id, title, pos, size, style) +{ + if ( !bBitmapLoaded ) { + // We need to initialise the default bitmap handler + wxXmlResource::Get()->AddHandler(new wxBitmapXmlHandler); + wxC9EE9InitBitmapResources(); + bBitmapLoaded = true; + } + + wxBoxSizer* boxSizerLvl1_1 = new wxBoxSizer(wxVERTICAL); + this->SetSizer(boxSizerLvl1_1); + + m_notebook = new wxNotebook(this, wxID_ANY, wxDefaultPosition, wxDLG_UNIT(this, wxSize(-1,-1)), wxBK_DEFAULT); + m_notebook->SetName(wxT("m_notebook")); + + boxSizerLvl1_1->Add(m_notebook, 1, wxEXPAND, WXC_FROM_DIP(5)); + + m_panelGeneral = new wxPanel(m_notebook, wxID_ANY, wxDefaultPosition, wxDLG_UNIT(m_notebook, wxSize(-1,-1)), wxTAB_TRAVERSAL); + m_notebook->AddPage(m_panelGeneral, _("General"), false); + + wxBoxSizer* boxSizerLvl2_1 = new wxBoxSizer(wxVERTICAL); + m_panelGeneral->SetSizer(boxSizerLvl2_1); + + m_staticTextUpLimiter = new wxStaticText(m_panelGeneral, wxID_ANY, _("Upper limit"), wxDefaultPosition, wxDLG_UNIT(m_panelGeneral, wxSize(-1,-1)), 0); + + boxSizerLvl2_1->Add(m_staticTextUpLimiter, 0, wxLEFT|wxRIGHT|wxTOP|wxALIGN_CENTER_VERTICAL, WXC_FROM_DIP(5)); + + m_textCtrlUpLimit = new wxTextCtrl(m_panelGeneral, wxID_ANY, wxT(""), wxDefaultPosition, wxDLG_UNIT(m_panelGeneral, wxSize(-1,-1)), 0); + #if wxVERSION_NUMBER >= 3000 + m_textCtrlUpLimit->SetHint(wxT("")); + #endif + + boxSizerLvl2_1->Add(m_textCtrlUpLimit, 0, wxLEFT|wxRIGHT|wxBOTTOM|wxEXPAND|wxALIGN_CENTER_VERTICAL, WXC_FROM_DIP(5)); + m_textCtrlUpLimit->SetMinSize(wxSize(100,-1)); + + m_staticTextLowLimit = new wxStaticText(m_panelGeneral, wxID_ANY, _("Lower limit"), wxDefaultPosition, wxDLG_UNIT(m_panelGeneral, wxSize(-1,-1)), 0); + + boxSizerLvl2_1->Add(m_staticTextLowLimit, 0, wxLEFT|wxRIGHT|wxTOP|wxALIGN_CENTER_VERTICAL, WXC_FROM_DIP(5)); + + m_textCtrlLowLimit = new wxTextCtrl(m_panelGeneral, wxID_ANY, wxT(""), wxDefaultPosition, wxDLG_UNIT(m_panelGeneral, wxSize(-1,-1)), 0); + #if wxVERSION_NUMBER >= 3000 + m_textCtrlLowLimit->SetHint(wxT("")); + #endif + + boxSizerLvl2_1->Add(m_textCtrlLowLimit, 0, wxLEFT|wxRIGHT|wxBOTTOM|wxEXPAND|wxALIGN_CENTER_VERTICAL, WXC_FROM_DIP(5)); + m_textCtrlLowLimit->SetMinSize(wxSize(100,-1)); + + wxBoxSizer* boxSizerBottomButtons = new wxBoxSizer(wxHORIZONTAL); + + boxSizerLvl1_1->Add(boxSizerBottomButtons, 0, wxALL|wxEXPAND, WXC_FROM_DIP(5)); + + boxSizerBottomButtons->Add(0, 0, 1, wxALL, WXC_FROM_DIP(5)); + + m_buttonOK = new wxButton(this, wxID_ANY, _("OK"), wxDefaultPosition, wxDLG_UNIT(this, wxSize(-1,-1)), 0); + + boxSizerBottomButtons->Add(m_buttonOK, 0, wxALL|wxALIGN_RIGHT, WXC_FROM_DIP(5)); + + m_ButtonCancel = new wxButton(this, wxID_ANY, _("Cancel"), wxDefaultPosition, wxDLG_UNIT(this, wxSize(-1,-1)), 0); + + boxSizerBottomButtons->Add(m_ButtonCancel, 0, wxALL|wxALIGN_RIGHT, WXC_FROM_DIP(5)); + + + #if wxVERSION_NUMBER >= 2900 + if(!wxPersistenceManager::Get().Find(m_notebook)){ + wxPersistenceManager::Get().RegisterAndRestore(m_notebook); + } else { + wxPersistenceManager::Get().Restore(m_notebook); + } + #endif + + SetName(wxT("RateLimiterFormBase")); + SetSize(-1,-1); + if (GetSizer()) { + GetSizer()->Fit(this); + } + if(GetParent()) { + CentreOnParent(wxBOTH); + } else { + CentreOnScreen(wxBOTH); + } +#if wxVERSION_NUMBER >= 2900 + if(!wxPersistenceManager::Get().Find(this)) { + wxPersistenceManager::Get().RegisterAndRestore(this); + } else { + wxPersistenceManager::Get().Restore(this); + } +#endif + // Connect events + m_buttonOK->Connect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(RateLimiterFormBase::OnOKButtonClick), NULL, this); + m_ButtonCancel->Connect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(RateLimiterFormBase::OnCancelButtonClick), NULL, this); + +} + +RateLimiterFormBase::~RateLimiterFormBase() +{ + m_buttonOK->Disconnect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(RateLimiterFormBase::OnOKButtonClick), NULL, this); + m_ButtonCancel->Disconnect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(RateLimiterFormBase::OnCancelButtonClick), NULL, this); + +} diff --git a/Project/ElementForm.h b/Project/ElementForm.h index 2e5b235..300f1eb 100644 --- a/Project/ElementForm.h +++ b/Project/ElementForm.h @@ -827,4 +827,64 @@ public: virtual ~SumFormBase(); }; + +class LimiterFormBase : public wxDialog +{ +protected: + wxNotebook* m_notebook; + wxPanel* m_panelGeneral; + wxStaticText* m_staticTextUpLimiter; + wxTextCtrl* m_textCtrlUpLimit; + wxStaticText* m_staticTextLowLimit; + wxTextCtrl* m_textCtrlLowLimit; + wxButton* m_buttonOK; + wxButton* m_ButtonCancel; + +protected: + virtual void OnOKButtonClick(wxCommandEvent& event) { event.Skip(); } + virtual void OnCancelButtonClick(wxCommandEvent& event) { event.Skip(); } + +public: + wxStaticText* GetStaticTextUpLimiter() { return m_staticTextUpLimiter; } + wxTextCtrl* GetTextCtrlUpLimit() { return m_textCtrlUpLimit; } + wxStaticText* GetStaticTextLowLimit() { return m_staticTextLowLimit; } + wxTextCtrl* GetTextCtrlLowLimit() { return m_textCtrlLowLimit; } + wxPanel* GetPanelGeneral() { return m_panelGeneral; } + wxNotebook* GetNotebook() { return m_notebook; } + wxButton* GetButtonOK() { return m_buttonOK; } + wxButton* GetButtonCancel() { return m_ButtonCancel; } + LimiterFormBase(wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Limiter"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize(-1,-1), long style = wxDEFAULT_DIALOG_STYLE); + virtual ~LimiterFormBase(); +}; + + +class RateLimiterFormBase : public wxDialog +{ +protected: + wxNotebook* m_notebook; + wxPanel* m_panelGeneral; + wxStaticText* m_staticTextUpLimiter; + wxTextCtrl* m_textCtrlUpLimit; + wxStaticText* m_staticTextLowLimit; + wxTextCtrl* m_textCtrlLowLimit; + wxButton* m_buttonOK; + wxButton* m_ButtonCancel; + +protected: + virtual void OnOKButtonClick(wxCommandEvent& event) { event.Skip(); } + virtual void OnCancelButtonClick(wxCommandEvent& event) { event.Skip(); } + +public: + wxStaticText* GetStaticTextUpLimiter() { return m_staticTextUpLimiter; } + wxTextCtrl* GetTextCtrlUpLimit() { return m_textCtrlUpLimit; } + wxStaticText* GetStaticTextLowLimit() { return m_staticTextLowLimit; } + wxTextCtrl* GetTextCtrlLowLimit() { return m_textCtrlLowLimit; } + wxPanel* GetPanelGeneral() { return m_panelGeneral; } + wxNotebook* GetNotebook() { return m_notebook; } + wxButton* GetButtonOK() { return m_buttonOK; } + wxButton* GetButtonCancel() { return m_ButtonCancel; } + RateLimiterFormBase(wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Rate limiter"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize(-1,-1), long style = wxDEFAULT_DIALOG_STYLE); + virtual ~RateLimiterFormBase(); +}; + #endif diff --git a/Project/ElementForm.wxcp b/Project/ElementForm.wxcp index 385d30d..fd325cb 100644 --- a/Project/ElementForm.wxcp +++ b/Project/ElementForm.wxcp @@ -1,7 +1,7 @@ { "metadata": { "m_generatedFilesDir": ".", - "m_objCounter": 1654, + "m_objCounter": 1719, "m_includeFiles": [], "m_bitmapFunction": "wxC9EE9InitBitmapResources", "m_bitmapsFile": "ElementFormBitmaps.cpp", @@ -30930,5 +30930,1763 @@ }] }] }] + }, { + "m_type": 4421, + "proportion": 0, + "border": 5, + "gbSpan": "1,1", + "gbPosition": "0,0", + "m_styles": ["wxDEFAULT_DIALOG_STYLE"], + "m_sizerFlags": ["wxALL", "wxLEFT", "wxRIGHT", "wxTOP", "wxBOTTOM"], + "m_properties": [{ + "type": "string", + "m_label": "Size:", + "m_value": "-1,-1" + }, { + "type": "string", + "m_label": "Minimum Size:", + "m_value": "-1,-1" + }, { + "type": "string", + "m_label": "Name:", + "m_value": "LimiterFormBase" + }, { + "type": "multi-string", + "m_label": "Tooltip:", + "m_value": "" + }, { + "type": "colour", + "m_label": "Bg Colour:", + "colour": "<Default>" + }, { + "type": "colour", + "m_label": "Fg Colour:", + "colour": "<Default>" + }, { + "type": "font", + "m_label": "Font:", + "m_value": "" + }, { + "type": "bool", + "m_label": "Hidden", + "m_value": false + }, { + "type": "bool", + "m_label": "Disabled", + "m_value": false + }, { + "type": "bool", + "m_label": "Focused", + "m_value": false + }, { + "type": "string", + "m_label": "Class Name:", + "m_value": "" + }, { + "type": "string", + "m_label": "Include File:", + "m_value": "" + }, { + "type": "string", + "m_label": "Style:", + "m_value": "" + }, { + "type": "bool", + "m_label": "Enable Window Persistency:", + "m_value": true + }, { + "type": "string", + "m_label": "Title:", + "m_value": "Limiter" + }, { + "type": "virtualFolderPicker", + "m_label": "Virtual Folder:", + "m_path": "Project:wxcrafter:base" + }, { + "type": "choice", + "m_label": "Centre:", + "m_selection": 1, + "m_options": ["", "wxBOTH", "wxVERTICAL", "wxHORIZONTAL"] + }, { + "type": "string", + "m_label": "Inherited Class", + "m_value": "LimiterForm" + }, { + "type": "string", + "m_label": "File:", + "m_value": "LimiterForm" + }, { + "type": "string", + "m_label": "Class Decorator", + "m_value": "" + }, { + "type": "bitmapPicker", + "m_label": "Bitmap File (16x16) :", + "m_path": "" + }, { + "type": "bitmapPicker", + "m_label": "Bitmap File (32x32) :", + "m_path": "" + }, { + "type": "bitmapPicker", + "m_label": "Bitmap File (64x64) :", + "m_path": "" + }, { + "type": "bitmapPicker", + "m_label": "Bitmap File (128x128):", + "m_path": "" + }, { + "type": "bitmapPicker", + "m_label": "Bitmap File (256x256):", + "m_path": "" + }], + "m_events": [], + "m_children": [{ + "m_type": 4401, + "proportion": 1, + "border": 5, + "gbSpan": "1,1", + "gbPosition": "0,0", + "m_styles": [], + "m_sizerFlags": ["wxALL", "wxLEFT", "wxRIGHT", "wxTOP", "wxBOTTOM", "wxEXPAND"], + "m_properties": [{ + "type": "string", + "m_label": "Minimum Size:", + "m_value": "-1,-1" + }, { + "type": "string", + "m_label": "Name:", + "m_value": "boxSizerLvl1_1" + }, { + "type": "string", + "m_label": "Style:", + "m_value": "" + }, { + "type": "choice", + "m_label": "Orientation:", + "m_selection": 0, + "m_options": ["wxVERTICAL", "wxHORIZONTAL"] + }], + "m_events": [], + "m_children": [{ + "m_type": 4442, + "proportion": 1, + "border": 5, + "gbSpan": "1,1", + "gbPosition": "0,0", + "m_styles": ["wxBK_DEFAULT"], + "m_sizerFlags": ["wxEXPAND"], + "m_properties": [{ + "type": "winid", + "m_label": "ID:", + "m_winid": "wxID_ANY" + }, { + "type": "string", + "m_label": "Size:", + "m_value": "-1,-1" + }, { + "type": "string", + "m_label": "Minimum Size:", + "m_value": "-1,-1" + }, { + "type": "string", + "m_label": "Name:", + "m_value": "m_notebook" + }, { + "type": "multi-string", + "m_label": "Tooltip:", + "m_value": "" + }, { + "type": "colour", + "m_label": "Bg Colour:", + "colour": "<Default>" + }, { + "type": "colour", + "m_label": "Fg Colour:", + "colour": "<Default>" + }, { + "type": "font", + "m_label": "Font:", + "m_value": "" + }, { + "type": "bool", + "m_label": "Hidden", + "m_value": false + }, { + "type": "bool", + "m_label": "Disabled", + "m_value": false + }, { + "type": "bool", + "m_label": "Focused", + "m_value": false + }, { + "type": "string", + "m_label": "Class Name:", + "m_value": "" + }, { + "type": "string", + "m_label": "Include File:", + "m_value": "" + }, { + "type": "string", + "m_label": "Style:", + "m_value": "" + }], + "m_events": [], + "m_children": [{ + "m_type": 4441, + "proportion": 0, + "border": 5, + "gbSpan": "1,1", + "gbPosition": "0,0", + "m_styles": ["wxTAB_TRAVERSAL"], + "m_sizerFlags": ["wxALL", "wxLEFT", "wxRIGHT", "wxTOP", "wxBOTTOM"], + "m_properties": [{ + "type": "winid", + "m_label": "ID:", + "m_winid": "wxID_ANY" + }, { + "type": "string", + "m_label": "Size:", + "m_value": "-1,-1" + }, { + "type": "string", + "m_label": "Minimum Size:", + "m_value": "-1,-1" + }, { + "type": "string", + "m_label": "Name:", + "m_value": "m_panelGeneral" + }, { + "type": "multi-string", + "m_label": "Tooltip:", + "m_value": "" + }, { + "type": "colour", + "m_label": "Bg Colour:", + "colour": "<Default>" + }, { + "type": "colour", + "m_label": "Fg Colour:", + "colour": "<Default>" + }, { + "type": "font", + "m_label": "Font:", + "m_value": "" + }, { + "type": "bool", + "m_label": "Hidden", + "m_value": false + }, { + "type": "bool", + "m_label": "Disabled", + "m_value": false + }, { + "type": "bool", + "m_label": "Focused", + "m_value": false + }, { + "type": "string", + "m_label": "Class Name:", + "m_value": "" + }, { + "type": "string", + "m_label": "Include File:", + "m_value": "" + }, { + "type": "string", + "m_label": "Style:", + "m_value": "" + }, { + "type": "string", + "m_label": "Label:", + "m_value": "General" + }, { + "type": "bitmapPicker", + "m_label": "Bitmap File:", + "m_path": "" + }, { + "type": "bool", + "m_label": "Selected", + "m_value": false + }, { + "type": "bool", + "m_label": "Null Page", + "m_value": false + }], + "m_events": [], + "m_children": [{ + "m_type": 4401, + "proportion": 1, + "border": 5, + "gbSpan": "1,1", + "gbPosition": "0,0", + "m_styles": [], + "m_sizerFlags": ["wxALL", "wxLEFT", "wxRIGHT", "wxTOP", "wxBOTTOM", "wxEXPAND"], + "m_properties": [{ + "type": "string", + "m_label": "Minimum Size:", + "m_value": "-1,-1" + }, { + "type": "string", + "m_label": "Name:", + "m_value": "boxSizerLvl2_1" + }, { + "type": "string", + "m_label": "Style:", + "m_value": "" + }, { + "type": "choice", + "m_label": "Orientation:", + "m_selection": 0, + "m_options": ["wxVERTICAL", "wxHORIZONTAL"] + }], + "m_events": [], + "m_children": [{ + "m_type": 4405, + "proportion": 0, + "border": 5, + "gbSpan": "1,1", + "gbPosition": "0,0", + "m_styles": [], + "m_sizerFlags": ["wxLEFT", "wxRIGHT", "wxTOP", "wxALIGN_CENTER_VERTICAL"], + "m_properties": [{ + "type": "winid", + "m_label": "ID:", + "m_winid": "wxID_ANY" + }, { + "type": "string", + "m_label": "Size:", + "m_value": "-1,-1" + }, { + "type": "string", + "m_label": "Minimum Size:", + "m_value": "-1,-1" + }, { + "type": "string", + "m_label": "Name:", + "m_value": "m_staticTextUpLimiter" + }, { + "type": "multi-string", + "m_label": "Tooltip:", + "m_value": "" + }, { + "type": "colour", + "m_label": "Bg Colour:", + "colour": "<Default>" + }, { + "type": "colour", + "m_label": "Fg Colour:", + "colour": "<Default>" + }, { + "type": "font", + "m_label": "Font:", + "m_value": "" + }, { + "type": "bool", + "m_label": "Hidden", + "m_value": false + }, { + "type": "bool", + "m_label": "Disabled", + "m_value": false + }, { + "type": "bool", + "m_label": "Focused", + "m_value": false + }, { + "type": "string", + "m_label": "Class Name:", + "m_value": "" + }, { + "type": "string", + "m_label": "Include File:", + "m_value": "" + }, { + "type": "string", + "m_label": "Style:", + "m_value": "" + }, { + "type": "multi-string", + "m_label": "Label:", + "m_value": "Upper limit" + }, { + "type": "string", + "m_label": "Wrap:", + "m_value": "-1" + }], + "m_events": [], + "m_children": [] + }, { + "m_type": 4406, + "proportion": 0, + "border": 5, + "gbSpan": "1,1", + "gbPosition": "0,0", + "m_styles": [], + "m_sizerFlags": ["wxLEFT", "wxRIGHT", "wxBOTTOM", "wxEXPAND", "wxALIGN_CENTER_VERTICAL"], + "m_properties": [{ + "type": "winid", + "m_label": "ID:", + "m_winid": "wxID_ANY" + }, { + "type": "string", + "m_label": "Size:", + "m_value": "-1,-1" + }, { + "type": "string", + "m_label": "Minimum Size:", + "m_value": "100,-1" + }, { + "type": "string", + "m_label": "Name:", + "m_value": "m_textCtrlUpLimit" + }, { + "type": "multi-string", + "m_label": "Tooltip:", + "m_value": "" + }, { + "type": "colour", + "m_label": "Bg Colour:", + "colour": "<Default>" + }, { + "type": "colour", + "m_label": "Fg Colour:", + "colour": "<Default>" + }, { + "type": "font", + "m_label": "Font:", + "m_value": "" + }, { + "type": "bool", + "m_label": "Hidden", + "m_value": false + }, { + "type": "bool", + "m_label": "Disabled", + "m_value": false + }, { + "type": "bool", + "m_label": "Focused", + "m_value": false + }, { + "type": "string", + "m_label": "Class Name:", + "m_value": "" + }, { + "type": "string", + "m_label": "Include File:", + "m_value": "" + }, { + "type": "string", + "m_label": "Style:", + "m_value": "" + }, { + "type": "string", + "m_label": "Value:", + "m_value": "" + }, { + "type": "string", + "m_label": "Text Hint", + "m_value": "" + }, { + "type": "string", + "m_label": "Max Length:", + "m_value": "0" + }, { + "type": "bool", + "m_label": "Auto Complete Directories:", + "m_value": false + }, { + "type": "bool", + "m_label": "Auto Complete Files:", + "m_value": false + }], + "m_events": [], + "m_children": [] + }, { + "m_type": 4405, + "proportion": 0, + "border": 5, + "gbSpan": "1,1", + "gbPosition": "0,0", + "m_styles": [], + "m_sizerFlags": ["wxLEFT", "wxRIGHT", "wxTOP", "wxALIGN_CENTER_VERTICAL"], + "m_properties": [{ + "type": "winid", + "m_label": "ID:", + "m_winid": "wxID_ANY" + }, { + "type": "string", + "m_label": "Size:", + "m_value": "-1,-1" + }, { + "type": "string", + "m_label": "Minimum Size:", + "m_value": "-1,-1" + }, { + "type": "string", + "m_label": "Name:", + "m_value": "m_staticTextLowLimit" + }, { + "type": "multi-string", + "m_label": "Tooltip:", + "m_value": "" + }, { + "type": "colour", + "m_label": "Bg Colour:", + "colour": "<Default>" + }, { + "type": "colour", + "m_label": "Fg Colour:", + "colour": "<Default>" + }, { + "type": "font", + "m_label": "Font:", + "m_value": "" + }, { + "type": "bool", + "m_label": "Hidden", + "m_value": false + }, { + "type": "bool", + "m_label": "Disabled", + "m_value": false + }, { + "type": "bool", + "m_label": "Focused", + "m_value": false + }, { + "type": "string", + "m_label": "Class Name:", + "m_value": "" + }, { + "type": "string", + "m_label": "Include File:", + "m_value": "" + }, { + "type": "string", + "m_label": "Style:", + "m_value": "" + }, { + "type": "multi-string", + "m_label": "Label:", + "m_value": "Lower limit" + }, { + "type": "string", + "m_label": "Wrap:", + "m_value": "-1" + }], + "m_events": [], + "m_children": [] + }, { + "m_type": 4406, + "proportion": 0, + "border": 5, + "gbSpan": "1,1", + "gbPosition": "0,0", + "m_styles": [], + "m_sizerFlags": ["wxLEFT", "wxRIGHT", "wxBOTTOM", "wxEXPAND", "wxALIGN_CENTER_VERTICAL"], + "m_properties": [{ + "type": "winid", + "m_label": "ID:", + "m_winid": "wxID_ANY" + }, { + "type": "string", + "m_label": "Size:", + "m_value": "-1,-1" + }, { + "type": "string", + "m_label": "Minimum Size:", + "m_value": "100,-1" + }, { + "type": "string", + "m_label": "Name:", + "m_value": "m_textCtrlLowLimit" + }, { + "type": "multi-string", + "m_label": "Tooltip:", + "m_value": "" + }, { + "type": "colour", + "m_label": "Bg Colour:", + "colour": "<Default>" + }, { + "type": "colour", + "m_label": "Fg Colour:", + "colour": "<Default>" + }, { + "type": "font", + "m_label": "Font:", + "m_value": "" + }, { + "type": "bool", + "m_label": "Hidden", + "m_value": false + }, { + "type": "bool", + "m_label": "Disabled", + "m_value": false + }, { + "type": "bool", + "m_label": "Focused", + "m_value": false + }, { + "type": "string", + "m_label": "Class Name:", + "m_value": "" + }, { + "type": "string", + "m_label": "Include File:", + "m_value": "" + }, { + "type": "string", + "m_label": "Style:", + "m_value": "" + }, { + "type": "string", + "m_label": "Value:", + "m_value": "" + }, { + "type": "string", + "m_label": "Text Hint", + "m_value": "" + }, { + "type": "string", + "m_label": "Max Length:", + "m_value": "0" + }, { + "type": "bool", + "m_label": "Auto Complete Directories:", + "m_value": false + }, { + "type": "bool", + "m_label": "Auto Complete Files:", + "m_value": false + }], + "m_events": [], + "m_children": [] + }] + }] + }] + }, { + "m_type": 4401, + "proportion": 0, + "border": 5, + "gbSpan": "1,1", + "gbPosition": "0,0", + "m_styles": [], + "m_sizerFlags": ["wxALL", "wxLEFT", "wxRIGHT", "wxTOP", "wxBOTTOM", "wxEXPAND"], + "m_properties": [{ + "type": "string", + "m_label": "Minimum Size:", + "m_value": "-1,-1" + }, { + "type": "string", + "m_label": "Name:", + "m_value": "boxSizerBottomButtons" + }, { + "type": "string", + "m_label": "Style:", + "m_value": "" + }, { + "type": "choice", + "m_label": "Orientation:", + "m_selection": 1, + "m_options": ["wxVERTICAL", "wxHORIZONTAL"] + }], + "m_events": [], + "m_children": [{ + "m_type": 4454, + "proportion": 1, + "border": 5, + "gbSpan": "1,1", + "gbPosition": "0,0", + "m_styles": [], + "m_sizerFlags": ["wxALL", "wxLEFT", "wxRIGHT", "wxTOP", "wxBOTTOM"], + "m_properties": [{ + "type": "string", + "m_label": "Name:", + "m_value": "Spacer_1" + }, { + "type": "string", + "m_label": "Size:", + "m_value": "0,0" + }], + "m_events": [], + "m_children": [] + }, { + "m_type": 4400, + "proportion": 0, + "border": 5, + "gbSpan": "1,1", + "gbPosition": "0,0", + "m_styles": [], + "m_sizerFlags": ["wxALL", "wxLEFT", "wxRIGHT", "wxTOP", "wxBOTTOM", "wxALIGN_RIGHT"], + "m_properties": [{ + "type": "winid", + "m_label": "ID:", + "m_winid": "wxID_ANY" + }, { + "type": "string", + "m_label": "Size:", + "m_value": "-1,-1" + }, { + "type": "string", + "m_label": "Minimum Size:", + "m_value": "-1,-1" + }, { + "type": "string", + "m_label": "Name:", + "m_value": "m_buttonOK" + }, { + "type": "multi-string", + "m_label": "Tooltip:", + "m_value": "" + }, { + "type": "colour", + "m_label": "Bg Colour:", + "colour": "<Default>" + }, { + "type": "colour", + "m_label": "Fg Colour:", + "colour": "<Default>" + }, { + "type": "font", + "m_label": "Font:", + "m_value": "" + }, { + "type": "bool", + "m_label": "Hidden", + "m_value": false + }, { + "type": "bool", + "m_label": "Disabled", + "m_value": false + }, { + "type": "bool", + "m_label": "Focused", + "m_value": false + }, { + "type": "string", + "m_label": "Class Name:", + "m_value": "" + }, { + "type": "string", + "m_label": "Include File:", + "m_value": "" + }, { + "type": "string", + "m_label": "Style:", + "m_value": "" + }, { + "type": "string", + "m_label": "Label:", + "m_value": "OK" + }, { + "type": "bool", + "m_label": "Default Button", + "m_value": false + }, { + "type": "bitmapPicker", + "m_label": "Bitmap File:", + "m_path": "" + }, { + "type": "choice", + "m_label": "Direction", + "m_selection": 0, + "m_options": ["wxLEFT", "wxRIGHT", "wxTOP", "wxBOTTOM"] + }, { + "type": "string", + "m_label": "Margins:", + "m_value": "2,2" + }], + "m_events": [{ + "m_eventName": "wxEVT_COMMAND_BUTTON_CLICKED", + "m_eventClass": "wxCommandEvent", + "m_eventHandler": "wxCommandEventHandler", + "m_functionNameAndSignature": "OnOKButtonClick(wxCommandEvent& event)", + "m_description": "Process a wxEVT_COMMAND_BUTTON_CLICKED event, when the button is clicked.", + "m_noBody": false + }], + "m_children": [] + }, { + "m_type": 4400, + "proportion": 0, + "border": 5, + "gbSpan": "1,1", + "gbPosition": "0,0", + "m_styles": [], + "m_sizerFlags": ["wxALL", "wxLEFT", "wxRIGHT", "wxTOP", "wxBOTTOM", "wxALIGN_RIGHT"], + "m_properties": [{ + "type": "winid", + "m_label": "ID:", + "m_winid": "wxID_ANY" + }, { + "type": "string", + "m_label": "Size:", + "m_value": "-1,-1" + }, { + "type": "string", + "m_label": "Minimum Size:", + "m_value": "-1,-1" + }, { + "type": "string", + "m_label": "Name:", + "m_value": "m_ButtonCancel" + }, { + "type": "multi-string", + "m_label": "Tooltip:", + "m_value": "" + }, { + "type": "colour", + "m_label": "Bg Colour:", + "colour": "<Default>" + }, { + "type": "colour", + "m_label": "Fg Colour:", + "colour": "<Default>" + }, { + "type": "font", + "m_label": "Font:", + "m_value": "" + }, { + "type": "bool", + "m_label": "Hidden", + "m_value": false + }, { + "type": "bool", + "m_label": "Disabled", + "m_value": false + }, { + "type": "bool", + "m_label": "Focused", + "m_value": false + }, { + "type": "string", + "m_label": "Class Name:", + "m_value": "" + }, { + "type": "string", + "m_label": "Include File:", + "m_value": "" + }, { + "type": "string", + "m_label": "Style:", + "m_value": "" + }, { + "type": "string", + "m_label": "Label:", + "m_value": "Cancel" + }, { + "type": "bool", + "m_label": "Default Button", + "m_value": false + }, { + "type": "bitmapPicker", + "m_label": "Bitmap File:", + "m_path": "" + }, { + "type": "choice", + "m_label": "Direction", + "m_selection": 0, + "m_options": ["wxLEFT", "wxRIGHT", "wxTOP", "wxBOTTOM"] + }, { + "type": "string", + "m_label": "Margins:", + "m_value": "2,2" + }], + "m_events": [{ + "m_eventName": "wxEVT_COMMAND_BUTTON_CLICKED", + "m_eventClass": "wxCommandEvent", + "m_eventHandler": "wxCommandEventHandler", + "m_functionNameAndSignature": "OnCancelButtonClick(wxCommandEvent& event)", + "m_description": "Process a wxEVT_COMMAND_BUTTON_CLICKED event, when the button is clicked.", + "m_noBody": false + }], + "m_children": [] + }] + }] + }] + }, { + "m_type": 4421, + "proportion": 0, + "border": 5, + "gbSpan": "1,1", + "gbPosition": "0,0", + "m_styles": ["wxDEFAULT_DIALOG_STYLE"], + "m_sizerFlags": ["wxALL", "wxLEFT", "wxRIGHT", "wxTOP", "wxBOTTOM"], + "m_properties": [{ + "type": "string", + "m_label": "Size:", + "m_value": "-1,-1" + }, { + "type": "string", + "m_label": "Minimum Size:", + "m_value": "-1,-1" + }, { + "type": "string", + "m_label": "Name:", + "m_value": "RateLimiterFormBase" + }, { + "type": "multi-string", + "m_label": "Tooltip:", + "m_value": "" + }, { + "type": "colour", + "m_label": "Bg Colour:", + "colour": "<Default>" + }, { + "type": "colour", + "m_label": "Fg Colour:", + "colour": "<Default>" + }, { + "type": "font", + "m_label": "Font:", + "m_value": "" + }, { + "type": "bool", + "m_label": "Hidden", + "m_value": false + }, { + "type": "bool", + "m_label": "Disabled", + "m_value": false + }, { + "type": "bool", + "m_label": "Focused", + "m_value": false + }, { + "type": "string", + "m_label": "Class Name:", + "m_value": "" + }, { + "type": "string", + "m_label": "Include File:", + "m_value": "" + }, { + "type": "string", + "m_label": "Style:", + "m_value": "" + }, { + "type": "bool", + "m_label": "Enable Window Persistency:", + "m_value": true + }, { + "type": "string", + "m_label": "Title:", + "m_value": "Rate limiter" + }, { + "type": "virtualFolderPicker", + "m_label": "Virtual Folder:", + "m_path": "Project:wxcrafter:base" + }, { + "type": "choice", + "m_label": "Centre:", + "m_selection": 1, + "m_options": ["", "wxBOTH", "wxVERTICAL", "wxHORIZONTAL"] + }, { + "type": "string", + "m_label": "Inherited Class", + "m_value": "RateLimiterForm" + }, { + "type": "string", + "m_label": "File:", + "m_value": "RateLimiterForm" + }, { + "type": "string", + "m_label": "Class Decorator", + "m_value": "" + }, { + "type": "bitmapPicker", + "m_label": "Bitmap File (16x16) :", + "m_path": "" + }, { + "type": "bitmapPicker", + "m_label": "Bitmap File (32x32) :", + "m_path": "" + }, { + "type": "bitmapPicker", + "m_label": "Bitmap File (64x64) :", + "m_path": "" + }, { + "type": "bitmapPicker", + "m_label": "Bitmap File (128x128):", + "m_path": "" + }, { + "type": "bitmapPicker", + "m_label": "Bitmap File (256x256):", + "m_path": "" + }], + "m_events": [], + "m_children": [{ + "m_type": 4401, + "proportion": 1, + "border": 5, + "gbSpan": "1,1", + "gbPosition": "0,0", + "m_styles": [], + "m_sizerFlags": ["wxALL", "wxLEFT", "wxRIGHT", "wxTOP", "wxBOTTOM", "wxEXPAND"], + "m_properties": [{ + "type": "string", + "m_label": "Minimum Size:", + "m_value": "-1,-1" + }, { + "type": "string", + "m_label": "Name:", + "m_value": "boxSizerLvl1_1" + }, { + "type": "string", + "m_label": "Style:", + "m_value": "" + }, { + "type": "choice", + "m_label": "Orientation:", + "m_selection": 0, + "m_options": ["wxVERTICAL", "wxHORIZONTAL"] + }], + "m_events": [], + "m_children": [{ + "m_type": 4442, + "proportion": 1, + "border": 5, + "gbSpan": "1,1", + "gbPosition": "0,0", + "m_styles": ["wxBK_DEFAULT"], + "m_sizerFlags": ["wxEXPAND"], + "m_properties": [{ + "type": "winid", + "m_label": "ID:", + "m_winid": "wxID_ANY" + }, { + "type": "string", + "m_label": "Size:", + "m_value": "-1,-1" + }, { + "type": "string", + "m_label": "Minimum Size:", + "m_value": "-1,-1" + }, { + "type": "string", + "m_label": "Name:", + "m_value": "m_notebook" + }, { + "type": "multi-string", + "m_label": "Tooltip:", + "m_value": "" + }, { + "type": "colour", + "m_label": "Bg Colour:", + "colour": "<Default>" + }, { + "type": "colour", + "m_label": "Fg Colour:", + "colour": "<Default>" + }, { + "type": "font", + "m_label": "Font:", + "m_value": "" + }, { + "type": "bool", + "m_label": "Hidden", + "m_value": false + }, { + "type": "bool", + "m_label": "Disabled", + "m_value": false + }, { + "type": "bool", + "m_label": "Focused", + "m_value": false + }, { + "type": "string", + "m_label": "Class Name:", + "m_value": "" + }, { + "type": "string", + "m_label": "Include File:", + "m_value": "" + }, { + "type": "string", + "m_label": "Style:", + "m_value": "" + }], + "m_events": [], + "m_children": [{ + "m_type": 4441, + "proportion": 0, + "border": 5, + "gbSpan": "1,1", + "gbPosition": "0,0", + "m_styles": ["wxTAB_TRAVERSAL"], + "m_sizerFlags": ["wxALL", "wxLEFT", "wxRIGHT", "wxTOP", "wxBOTTOM"], + "m_properties": [{ + "type": "winid", + "m_label": "ID:", + "m_winid": "wxID_ANY" + }, { + "type": "string", + "m_label": "Size:", + "m_value": "-1,-1" + }, { + "type": "string", + "m_label": "Minimum Size:", + "m_value": "-1,-1" + }, { + "type": "string", + "m_label": "Name:", + "m_value": "m_panelGeneral" + }, { + "type": "multi-string", + "m_label": "Tooltip:", + "m_value": "" + }, { + "type": "colour", + "m_label": "Bg Colour:", + "colour": "<Default>" + }, { + "type": "colour", + "m_label": "Fg Colour:", + "colour": "<Default>" + }, { + "type": "font", + "m_label": "Font:", + "m_value": "" + }, { + "type": "bool", + "m_label": "Hidden", + "m_value": false + }, { + "type": "bool", + "m_label": "Disabled", + "m_value": false + }, { + "type": "bool", + "m_label": "Focused", + "m_value": false + }, { + "type": "string", + "m_label": "Class Name:", + "m_value": "" + }, { + "type": "string", + "m_label": "Include File:", + "m_value": "" + }, { + "type": "string", + "m_label": "Style:", + "m_value": "" + }, { + "type": "string", + "m_label": "Label:", + "m_value": "General" + }, { + "type": "bitmapPicker", + "m_label": "Bitmap File:", + "m_path": "" + }, { + "type": "bool", + "m_label": "Selected", + "m_value": false + }, { + "type": "bool", + "m_label": "Null Page", + "m_value": false + }], + "m_events": [], + "m_children": [{ + "m_type": 4401, + "proportion": 1, + "border": 5, + "gbSpan": "1,1", + "gbPosition": "0,0", + "m_styles": [], + "m_sizerFlags": ["wxALL", "wxLEFT", "wxRIGHT", "wxTOP", "wxBOTTOM", "wxEXPAND"], + "m_properties": [{ + "type": "string", + "m_label": "Minimum Size:", + "m_value": "-1,-1" + }, { + "type": "string", + "m_label": "Name:", + "m_value": "boxSizerLvl2_1" + }, { + "type": "string", + "m_label": "Style:", + "m_value": "" + }, { + "type": "choice", + "m_label": "Orientation:", + "m_selection": 0, + "m_options": ["wxVERTICAL", "wxHORIZONTAL"] + }], + "m_events": [], + "m_children": [{ + "m_type": 4405, + "proportion": 0, + "border": 5, + "gbSpan": "1,1", + "gbPosition": "0,0", + "m_styles": [], + "m_sizerFlags": ["wxLEFT", "wxRIGHT", "wxTOP", "wxALIGN_CENTER_VERTICAL"], + "m_properties": [{ + "type": "winid", + "m_label": "ID:", + "m_winid": "wxID_ANY" + }, { + "type": "string", + "m_label": "Size:", + "m_value": "-1,-1" + }, { + "type": "string", + "m_label": "Minimum Size:", + "m_value": "-1,-1" + }, { + "type": "string", + "m_label": "Name:", + "m_value": "m_staticTextUpLimiter" + }, { + "type": "multi-string", + "m_label": "Tooltip:", + "m_value": "" + }, { + "type": "colour", + "m_label": "Bg Colour:", + "colour": "<Default>" + }, { + "type": "colour", + "m_label": "Fg Colour:", + "colour": "<Default>" + }, { + "type": "font", + "m_label": "Font:", + "m_value": "" + }, { + "type": "bool", + "m_label": "Hidden", + "m_value": false + }, { + "type": "bool", + "m_label": "Disabled", + "m_value": false + }, { + "type": "bool", + "m_label": "Focused", + "m_value": false + }, { + "type": "string", + "m_label": "Class Name:", + "m_value": "" + }, { + "type": "string", + "m_label": "Include File:", + "m_value": "" + }, { + "type": "string", + "m_label": "Style:", + "m_value": "" + }, { + "type": "multi-string", + "m_label": "Label:", + "m_value": "Upper limit" + }, { + "type": "string", + "m_label": "Wrap:", + "m_value": "-1" + }], + "m_events": [], + "m_children": [] + }, { + "m_type": 4406, + "proportion": 0, + "border": 5, + "gbSpan": "1,1", + "gbPosition": "0,0", + "m_styles": [], + "m_sizerFlags": ["wxLEFT", "wxRIGHT", "wxBOTTOM", "wxEXPAND", "wxALIGN_CENTER_VERTICAL"], + "m_properties": [{ + "type": "winid", + "m_label": "ID:", + "m_winid": "wxID_ANY" + }, { + "type": "string", + "m_label": "Size:", + "m_value": "-1,-1" + }, { + "type": "string", + "m_label": "Minimum Size:", + "m_value": "100,-1" + }, { + "type": "string", + "m_label": "Name:", + "m_value": "m_textCtrlUpLimit" + }, { + "type": "multi-string", + "m_label": "Tooltip:", + "m_value": "" + }, { + "type": "colour", + "m_label": "Bg Colour:", + "colour": "<Default>" + }, { + "type": "colour", + "m_label": "Fg Colour:", + "colour": "<Default>" + }, { + "type": "font", + "m_label": "Font:", + "m_value": "" + }, { + "type": "bool", + "m_label": "Hidden", + "m_value": false + }, { + "type": "bool", + "m_label": "Disabled", + "m_value": false + }, { + "type": "bool", + "m_label": "Focused", + "m_value": false + }, { + "type": "string", + "m_label": "Class Name:", + "m_value": "" + }, { + "type": "string", + "m_label": "Include File:", + "m_value": "" + }, { + "type": "string", + "m_label": "Style:", + "m_value": "" + }, { + "type": "string", + "m_label": "Value:", + "m_value": "" + }, { + "type": "string", + "m_label": "Text Hint", + "m_value": "" + }, { + "type": "string", + "m_label": "Max Length:", + "m_value": "0" + }, { + "type": "bool", + "m_label": "Auto Complete Directories:", + "m_value": false + }, { + "type": "bool", + "m_label": "Auto Complete Files:", + "m_value": false + }], + "m_events": [], + "m_children": [] + }, { + "m_type": 4405, + "proportion": 0, + "border": 5, + "gbSpan": "1,1", + "gbPosition": "0,0", + "m_styles": [], + "m_sizerFlags": ["wxLEFT", "wxRIGHT", "wxTOP", "wxALIGN_CENTER_VERTICAL"], + "m_properties": [{ + "type": "winid", + "m_label": "ID:", + "m_winid": "wxID_ANY" + }, { + "type": "string", + "m_label": "Size:", + "m_value": "-1,-1" + }, { + "type": "string", + "m_label": "Minimum Size:", + "m_value": "-1,-1" + }, { + "type": "string", + "m_label": "Name:", + "m_value": "m_staticTextLowLimit" + }, { + "type": "multi-string", + "m_label": "Tooltip:", + "m_value": "" + }, { + "type": "colour", + "m_label": "Bg Colour:", + "colour": "<Default>" + }, { + "type": "colour", + "m_label": "Fg Colour:", + "colour": "<Default>" + }, { + "type": "font", + "m_label": "Font:", + "m_value": "" + }, { + "type": "bool", + "m_label": "Hidden", + "m_value": false + }, { + "type": "bool", + "m_label": "Disabled", + "m_value": false + }, { + "type": "bool", + "m_label": "Focused", + "m_value": false + }, { + "type": "string", + "m_label": "Class Name:", + "m_value": "" + }, { + "type": "string", + "m_label": "Include File:", + "m_value": "" + }, { + "type": "string", + "m_label": "Style:", + "m_value": "" + }, { + "type": "multi-string", + "m_label": "Label:", + "m_value": "Lower limit" + }, { + "type": "string", + "m_label": "Wrap:", + "m_value": "-1" + }], + "m_events": [], + "m_children": [] + }, { + "m_type": 4406, + "proportion": 0, + "border": 5, + "gbSpan": "1,1", + "gbPosition": "0,0", + "m_styles": [], + "m_sizerFlags": ["wxLEFT", "wxRIGHT", "wxBOTTOM", "wxEXPAND", "wxALIGN_CENTER_VERTICAL"], + "m_properties": [{ + "type": "winid", + "m_label": "ID:", + "m_winid": "wxID_ANY" + }, { + "type": "string", + "m_label": "Size:", + "m_value": "-1,-1" + }, { + "type": "string", + "m_label": "Minimum Size:", + "m_value": "100,-1" + }, { + "type": "string", + "m_label": "Name:", + "m_value": "m_textCtrlLowLimit" + }, { + "type": "multi-string", + "m_label": "Tooltip:", + "m_value": "" + }, { + "type": "colour", + "m_label": "Bg Colour:", + "colour": "<Default>" + }, { + "type": "colour", + "m_label": "Fg Colour:", + "colour": "<Default>" + }, { + "type": "font", + "m_label": "Font:", + "m_value": "" + }, { + "type": "bool", + "m_label": "Hidden", + "m_value": false + }, { + "type": "bool", + "m_label": "Disabled", + "m_value": false + }, { + "type": "bool", + "m_label": "Focused", + "m_value": false + }, { + "type": "string", + "m_label": "Class Name:", + "m_value": "" + }, { + "type": "string", + "m_label": "Include File:", + "m_value": "" + }, { + "type": "string", + "m_label": "Style:", + "m_value": "" + }, { + "type": "string", + "m_label": "Value:", + "m_value": "" + }, { + "type": "string", + "m_label": "Text Hint", + "m_value": "" + }, { + "type": "string", + "m_label": "Max Length:", + "m_value": "0" + }, { + "type": "bool", + "m_label": "Auto Complete Directories:", + "m_value": false + }, { + "type": "bool", + "m_label": "Auto Complete Files:", + "m_value": false + }], + "m_events": [], + "m_children": [] + }] + }] + }] + }, { + "m_type": 4401, + "proportion": 0, + "border": 5, + "gbSpan": "1,1", + "gbPosition": "0,0", + "m_styles": [], + "m_sizerFlags": ["wxALL", "wxLEFT", "wxRIGHT", "wxTOP", "wxBOTTOM", "wxEXPAND"], + "m_properties": [{ + "type": "string", + "m_label": "Minimum Size:", + "m_value": "-1,-1" + }, { + "type": "string", + "m_label": "Name:", + "m_value": "boxSizerBottomButtons" + }, { + "type": "string", + "m_label": "Style:", + "m_value": "" + }, { + "type": "choice", + "m_label": "Orientation:", + "m_selection": 1, + "m_options": ["wxVERTICAL", "wxHORIZONTAL"] + }], + "m_events": [], + "m_children": [{ + "m_type": 4454, + "proportion": 1, + "border": 5, + "gbSpan": "1,1", + "gbPosition": "0,0", + "m_styles": [], + "m_sizerFlags": ["wxALL", "wxLEFT", "wxRIGHT", "wxTOP", "wxBOTTOM"], + "m_properties": [{ + "type": "string", + "m_label": "Name:", + "m_value": "Spacer_1" + }, { + "type": "string", + "m_label": "Size:", + "m_value": "0,0" + }], + "m_events": [], + "m_children": [] + }, { + "m_type": 4400, + "proportion": 0, + "border": 5, + "gbSpan": "1,1", + "gbPosition": "0,0", + "m_styles": [], + "m_sizerFlags": ["wxALL", "wxLEFT", "wxRIGHT", "wxTOP", "wxBOTTOM", "wxALIGN_RIGHT"], + "m_properties": [{ + "type": "winid", + "m_label": "ID:", + "m_winid": "wxID_ANY" + }, { + "type": "string", + "m_label": "Size:", + "m_value": "-1,-1" + }, { + "type": "string", + "m_label": "Minimum Size:", + "m_value": "-1,-1" + }, { + "type": "string", + "m_label": "Name:", + "m_value": "m_buttonOK" + }, { + "type": "multi-string", + "m_label": "Tooltip:", + "m_value": "" + }, { + "type": "colour", + "m_label": "Bg Colour:", + "colour": "<Default>" + }, { + "type": "colour", + "m_label": "Fg Colour:", + "colour": "<Default>" + }, { + "type": "font", + "m_label": "Font:", + "m_value": "" + }, { + "type": "bool", + "m_label": "Hidden", + "m_value": false + }, { + "type": "bool", + "m_label": "Disabled", + "m_value": false + }, { + "type": "bool", + "m_label": "Focused", + "m_value": false + }, { + "type": "string", + "m_label": "Class Name:", + "m_value": "" + }, { + "type": "string", + "m_label": "Include File:", + "m_value": "" + }, { + "type": "string", + "m_label": "Style:", + "m_value": "" + }, { + "type": "string", + "m_label": "Label:", + "m_value": "OK" + }, { + "type": "bool", + "m_label": "Default Button", + "m_value": false + }, { + "type": "bitmapPicker", + "m_label": "Bitmap File:", + "m_path": "" + }, { + "type": "choice", + "m_label": "Direction", + "m_selection": 0, + "m_options": ["wxLEFT", "wxRIGHT", "wxTOP", "wxBOTTOM"] + }, { + "type": "string", + "m_label": "Margins:", + "m_value": "2,2" + }], + "m_events": [{ + "m_eventName": "wxEVT_COMMAND_BUTTON_CLICKED", + "m_eventClass": "wxCommandEvent", + "m_eventHandler": "wxCommandEventHandler", + "m_functionNameAndSignature": "OnOKButtonClick(wxCommandEvent& event)", + "m_description": "Process a wxEVT_COMMAND_BUTTON_CLICKED event, when the button is clicked.", + "m_noBody": false + }], + "m_children": [] + }, { + "m_type": 4400, + "proportion": 0, + "border": 5, + "gbSpan": "1,1", + "gbPosition": "0,0", + "m_styles": [], + "m_sizerFlags": ["wxALL", "wxLEFT", "wxRIGHT", "wxTOP", "wxBOTTOM", "wxALIGN_RIGHT"], + "m_properties": [{ + "type": "winid", + "m_label": "ID:", + "m_winid": "wxID_ANY" + }, { + "type": "string", + "m_label": "Size:", + "m_value": "-1,-1" + }, { + "type": "string", + "m_label": "Minimum Size:", + "m_value": "-1,-1" + }, { + "type": "string", + "m_label": "Name:", + "m_value": "m_ButtonCancel" + }, { + "type": "multi-string", + "m_label": "Tooltip:", + "m_value": "" + }, { + "type": "colour", + "m_label": "Bg Colour:", + "colour": "<Default>" + }, { + "type": "colour", + "m_label": "Fg Colour:", + "colour": "<Default>" + }, { + "type": "font", + "m_label": "Font:", + "m_value": "" + }, { + "type": "bool", + "m_label": "Hidden", + "m_value": false + }, { + "type": "bool", + "m_label": "Disabled", + "m_value": false + }, { + "type": "bool", + "m_label": "Focused", + "m_value": false + }, { + "type": "string", + "m_label": "Class Name:", + "m_value": "" + }, { + "type": "string", + "m_label": "Include File:", + "m_value": "" + }, { + "type": "string", + "m_label": "Style:", + "m_value": "" + }, { + "type": "string", + "m_label": "Label:", + "m_value": "Cancel" + }, { + "type": "bool", + "m_label": "Default Button", + "m_value": false + }, { + "type": "bitmapPicker", + "m_label": "Bitmap File:", + "m_path": "" + }, { + "type": "choice", + "m_label": "Direction", + "m_selection": 0, + "m_options": ["wxLEFT", "wxRIGHT", "wxTOP", "wxBOTTOM"] + }, { + "type": "string", + "m_label": "Margins:", + "m_value": "2,2" + }], + "m_events": [{ + "m_eventName": "wxEVT_COMMAND_BUTTON_CLICKED", + "m_eventClass": "wxCommandEvent", + "m_eventHandler": "wxCommandEventHandler", + "m_functionNameAndSignature": "OnCancelButtonClick(wxCommandEvent& event)", + "m_description": "Process a wxEVT_COMMAND_BUTTON_CLICKED event, when the button is clicked.", + "m_noBody": false + }], + "m_children": [] + }] + }] + }] }] }
\ No newline at end of file diff --git a/Project/ElementFormBitmaps.cpp b/Project/ElementFormBitmaps.cpp index 6d7225c..b955c05 100644 --- a/Project/ElementFormBitmaps.cpp +++ b/Project/ElementFormBitmaps.cpp @@ -44,6 +44,6 @@ void wxC9EE9InitBitmapResources() else wxFileSystem::AddHandler(new wxMemoryFSHandlerBase); } - XRC_ADD_FILE(wxT("XRC_resource/ElementFormBitmaps.cpp$C__Users_Thales_Documents_GitHub_PSP_Project_ElementFormBitmaps.xrc"), xml_res_file_0, xml_res_size_0, wxT("text/xml")); - wxXmlResource::Get()->Load(wxT("memory:XRC_resource/ElementFormBitmaps.cpp$C__Users_Thales_Documents_GitHub_PSP_Project_ElementFormBitmaps.xrc")); + XRC_ADD_FILE(wxT("XRC_resource/ElementFormBitmaps.cpp$C__Users_NDSE-69_Documents_GitHub_PSP_Project_ElementFormBitmaps.xrc"), xml_res_file_0, xml_res_size_0, wxT("text/xml")); + wxXmlResource::Get()->Load(wxT("memory:XRC_resource/ElementFormBitmaps.cpp$C__Users_NDSE-69_Documents_GitHub_PSP_Project_ElementFormBitmaps.xrc")); } diff --git a/Project/Exponential.cpp b/Project/Exponential.cpp new file mode 100644 index 0000000..8f2239f --- /dev/null +++ b/Project/Exponential.cpp @@ -0,0 +1,10 @@ +#include "Exponential.h" + +Exponential::Exponential() +{ +} + +Exponential::~Exponential() +{ +} + diff --git a/Project/Exponential.h b/Project/Exponential.h new file mode 100644 index 0000000..f22299a --- /dev/null +++ b/Project/Exponential.h @@ -0,0 +1,14 @@ +#ifndef EXPONENTIAL_H +#define EXPONENTIAL_H + +#include "ControlElement.h" + +class Exponential : ControlElement +{ +public: + Exponential(); + ~Exponential(); + +}; + +#endif // EXPONENTIAL_H diff --git a/Project/Limiter.cpp b/Project/Limiter.cpp new file mode 100644 index 0000000..f5e037c --- /dev/null +++ b/Project/Limiter.cpp @@ -0,0 +1,89 @@ +#include "Limiter.h" +#include "LimiterForm.h" + +Limiter::Limiter() : ControlElement() +{ + m_width = m_height = 36.0; + Node* nodeIn = new Node(m_position + wxPoint2DDouble(-18, 0), Node::NODE_IN, m_borderSize); + nodeIn->StartMove(m_position); + Node* nodeOut = new Node(m_position + wxPoint2DDouble(18, 0), Node::NODE_OUT, m_borderSize); + nodeOut->SetAngle(180.0); + nodeOut->StartMove(m_position); + m_nodeList.push_back(nodeIn); + m_nodeList.push_back(nodeOut); +} + +Limiter::~Limiter() {} +void Limiter::Draw(wxPoint2DDouble translation, double scale) const +{ + glLineWidth(1.0); + if(m_selected) { + glColor4dv(m_selectionColour.GetRGBA()); + double borderSize = (m_borderSize * 2.0 + 1.0) / scale; + DrawRectangle(m_position, m_width + borderSize, m_height + borderSize); + } + glColor4d(1.0, 1.0, 1.0, 1.0); + DrawRectangle(m_position, m_width, m_height); + glColor4d(0.0, 0.0, 0.0, 1.0); + DrawRectangle(m_position, m_width, m_height, GL_LINE_LOOP); + + // Plot symbol. + glLineWidth(2.0); + std::vector<wxPoint2DDouble> limSymbol; + limSymbol.push_back(m_position + wxPoint2DDouble(10, -10)); + limSymbol.push_back(m_position + wxPoint2DDouble(2, -10)); + limSymbol.push_back(m_position + wxPoint2DDouble(-2, 10)); + limSymbol.push_back(m_position + wxPoint2DDouble(-10, 10)); + glColor4d(0.0, 0.3, 1.0, 1.0); + DrawLine(limSymbol); + + glColor4d(0.0, 0.0, 0.0, 1.0); + DrawNodes(); +} + +bool Limiter::ShowForm(wxWindow* parent, Element* element) +{ + LimiterForm* limiter = new LimiterForm(parent, this); + if(limiter->ShowModal() == wxID_OK) { + limiter->Destroy(); + return true; + } + limiter->Destroy(); + return false; +} + +void Limiter::Rotate(bool clockwise) +{ + if(clockwise) + m_angle += 90.0; + else + m_angle -= 90.0; + if(m_angle >= 360.0) + m_angle = 0.0; + else if(m_angle < 0) + m_angle = 270.0; + + UpdatePoints(); + + for(auto it = m_nodeList.begin(), itEnd = m_nodeList.end(); it != itEnd; ++it) { + Node* node = *it; + node->Rotate(clockwise); + } +} + +void Limiter::UpdatePoints() +{ + if(m_angle == 0.0) { + m_nodeList[0]->SetPosition(m_position + wxPoint2DDouble(-18, 0)); + m_nodeList[1]->SetPosition(m_position + wxPoint2DDouble(18, 0)); + } else if(m_angle == 90.0) { + m_nodeList[0]->SetPosition(m_position + wxPoint2DDouble(0, -18)); + m_nodeList[1]->SetPosition(m_position + wxPoint2DDouble(0, 18)); + } else if(m_angle == 180.0) { + m_nodeList[0]->SetPosition(m_position + wxPoint2DDouble(18, 0)); + m_nodeList[1]->SetPosition(m_position + wxPoint2DDouble(-18, 0)); + } else if(m_angle == 270.0) { + m_nodeList[0]->SetPosition(m_position + wxPoint2DDouble(0, 18)); + m_nodeList[1]->SetPosition(m_position + wxPoint2DDouble(0, -18)); + } +} diff --git a/Project/Limiter.h b/Project/Limiter.h new file mode 100644 index 0000000..f79cd43 --- /dev/null +++ b/Project/Limiter.h @@ -0,0 +1,33 @@ +#ifndef LIMITER_H +#define LIMITER_H + +#include "ControlElement.h" + +class LimiterForm; + +class Limiter : public ControlElement +{ +public: + Limiter(); + ~Limiter(); + + virtual void Draw(wxPoint2DDouble translation, double scale) const; + virtual bool Contains(wxPoint2DDouble position) const { return m_rect.Contains(position); } + virtual bool Intersects(wxRect2DDouble rect) const { return m_rect.Intersects(rect); } + virtual bool ShowForm(wxWindow* parent, Element* element); + virtual void Rotate(bool clockwise = true); + + virtual void UpdatePoints(); + + double GetUpLimit() const { return m_upLimit; } + double GetLowLimit() const { return m_lowLimit; } + + void SetUpLimit(double upLimit) { m_upLimit = upLimit; } + void SetLowLimit(double lowLimit) { m_lowLimit = lowLimit; } + +protected: + double m_upLimit = 5.0; + double m_lowLimit = -5.0; +}; + +#endif // LIMITER_H diff --git a/Project/LimiterForm.cpp b/Project/LimiterForm.cpp new file mode 100644 index 0000000..dfbffb8 --- /dev/null +++ b/Project/LimiterForm.cpp @@ -0,0 +1,34 @@ +#include "LimiterForm.h" +#include "Limiter.h" + +LimiterForm::LimiterForm(wxWindow* parent, Limiter* limiter) : LimiterFormBase(parent) +{ + m_limiter = limiter; + m_parent = parent; + + m_textCtrlUpLimit->SetValue(m_limiter->StringFromDouble(m_limiter->GetUpLimit())); + m_textCtrlLowLimit->SetValue(m_limiter->StringFromDouble(m_limiter->GetLowLimit())); +} + +LimiterForm::~LimiterForm() {} +void LimiterForm::OnOKButtonClick(wxCommandEvent& event) +{ + if(ValidateData()) EndModal(wxID_OK); +} + +bool LimiterForm::ValidateData() +{ + double upLimit; + double lowLimit; + + if(!m_limiter->DoubleFromString(this, m_textCtrlUpLimit->GetValue(), upLimit, + _("Value entered incorrectly in the field \"Upper limit\"."))) + return false; + if(!m_limiter->DoubleFromString(this, m_textCtrlLowLimit->GetValue(), lowLimit, + _("Value entered incorrectly in the field \"Lower limit\"."))) + return false; + + m_limiter->SetUpLimit(upLimit); + m_limiter->SetLowLimit(lowLimit); + return true; +}
\ No newline at end of file diff --git a/Project/LimiterForm.h b/Project/LimiterForm.h new file mode 100644 index 0000000..f26ee9d --- /dev/null +++ b/Project/LimiterForm.h @@ -0,0 +1,21 @@ +#ifndef LIMITERFORM_H +#define LIMITERFORM_H +#include "ElementForm.h" + +class Limiter; + +class LimiterForm : public LimiterFormBase +{ + public: + LimiterForm(wxWindow* parent, Limiter* limiter); + virtual ~LimiterForm(); + virtual bool ValidateData(); + + protected: + virtual void OnCancelButtonClick(wxCommandEvent& event) { EndModal(wxID_CANCEL); } + virtual void OnOKButtonClick(wxCommandEvent& event); + + wxWindow* m_parent = NULL; + Limiter* m_limiter = NULL; +}; +#endif // LIMITERFORM_H diff --git a/Project/Multiplier.cpp b/Project/Multiplier.cpp index 3bdc418..2f91eab 100644 --- a/Project/Multiplier.cpp +++ b/Project/Multiplier.cpp @@ -3,12 +3,12 @@ Multiplier::Multiplier() : ControlElement() { m_width = m_height = 36.0; - Node* nodeIn1 = new Node(m_position + wxPoint2DDouble(-m_width / 2, 9 - m_height / 2), Node::NODE_IN, m_borderSize); + Node* nodeIn1 = new Node(m_position + wxPoint2DDouble(-18, -9), Node::NODE_IN, m_borderSize); nodeIn1->StartMove(m_position); Node* nodeIn2 = - new Node(m_position + wxPoint2DDouble(-m_width / 2, 27 - m_height / 2), Node::NODE_IN, m_borderSize); + new Node(m_position + wxPoint2DDouble(-18, 9), Node::NODE_IN, m_borderSize); nodeIn2->StartMove(m_position); - Node* nodeOut = new Node(m_position + wxPoint2DDouble(m_width / 2, 0), Node::NODE_OUT, m_borderSize); + Node* nodeOut = new Node(m_position + wxPoint2DDouble(18, 0), Node::NODE_OUT, m_borderSize); nodeOut->SetAngle(180.0); nodeOut->StartMove(m_position); m_nodeList.push_back(nodeIn1); @@ -20,9 +20,30 @@ Multiplier::~Multiplier() {} void Multiplier::Draw(wxPoint2DDouble translation, double scale) const { -} + glLineWidth(1.0); + if(m_selected) { + glColor4dv(m_selectionColour.GetRGBA()); + double borderSize = (m_borderSize * 2.0 + 1.0) / scale; + DrawRectangle(m_position, m_width + borderSize, m_height + borderSize); + } + glColor4d(1.0, 1.0, 1.0, 1.0); + DrawRectangle(m_position, m_width, m_height); + glColor4d(0.0, 0.0, 0.0, 1.0); + DrawRectangle(m_position, m_width, m_height, GL_LINE_LOOP); + + // Plot x. + glLineWidth(2.0); + std::vector<wxPoint2DDouble> xSymbol; + xSymbol.push_back(m_position + wxPoint2DDouble(-5, -5)); + xSymbol.push_back(m_position + wxPoint2DDouble(5, 5)); + xSymbol.push_back(m_position + wxPoint2DDouble(-5, 5)); + xSymbol.push_back(m_position + wxPoint2DDouble(5, -5)); + glColor4d(0.0, 0.3, 1.0, 1.0); + DrawLine(xSymbol, GL_LINES); -bool Multiplier::ShowForm(wxWindow* parent, Element* element) {} + glColor4d(0.0, 0.0, 0.0, 1.0); + DrawNodes(); +} void Multiplier::Rotate(bool clockwise) { @@ -45,4 +66,21 @@ void Multiplier::Rotate(bool clockwise) void Multiplier::UpdatePoints() { + if(m_angle == 0.0) { + m_nodeList[0]->SetPosition(m_position + wxPoint2DDouble(-18, -9)); + m_nodeList[1]->SetPosition(m_position + wxPoint2DDouble(-18, 9)); + m_nodeList[2]->SetPosition(m_position + wxPoint2DDouble(18, 0)); + } else if(m_angle == 90.0) { + m_nodeList[0]->SetPosition(m_position + wxPoint2DDouble(9, -18)); + m_nodeList[1]->SetPosition(m_position + wxPoint2DDouble(-9, -18)); + m_nodeList[2]->SetPosition(m_position + wxPoint2DDouble(0, 18)); + } else if(m_angle == 180.0) { + m_nodeList[0]->SetPosition(m_position + wxPoint2DDouble(18, 9)); + m_nodeList[1]->SetPosition(m_position + wxPoint2DDouble(18, -9)); + m_nodeList[2]->SetPosition(m_position + wxPoint2DDouble(-18, 0)); + } else if(m_angle == 270.0) { + m_nodeList[0]->SetPosition(m_position + wxPoint2DDouble(-9, 18)); + m_nodeList[1]->SetPosition(m_position + wxPoint2DDouble(9, 18)); + m_nodeList[2]->SetPosition(m_position + wxPoint2DDouble(0, -18)); + } } diff --git a/Project/Multiplier.h b/Project/Multiplier.h index 50dc38c..bce2694 100644 --- a/Project/Multiplier.h +++ b/Project/Multiplier.h @@ -12,9 +12,9 @@ class Multiplier : public ControlElement virtual void Draw(wxPoint2DDouble translation, double scale) const; virtual bool Contains(wxPoint2DDouble position) const { return m_rect.Contains(position); } virtual bool Intersects(wxRect2DDouble rect) const { return m_rect.Intersects(rect); } - virtual bool ShowForm(wxWindow* parent, Element* element); + virtual bool ShowForm(wxWindow* parent, Element* element) { return false; } virtual void Rotate(bool clockwise = true); - + virtual void UpdatePoints(); }; diff --git a/Project/Project.mk b/Project/Project.mk index 2575f37..15da6de 100644 --- a/Project/Project.mk +++ b/Project/Project.mk @@ -13,7 +13,7 @@ CurrentFileName := CurrentFilePath := CurrentFileFullPath := User :=NDSE-69 -Date :=24/03/2017 +Date :=29/03/2017 CodeLitePath :="C:/Program Files/CodeLite" LinkerName :=C:/TDM-GCC-64/bin/g++.exe SharedObjectLinkerName :=C:/TDM-GCC-64/bin/g++.exe -shared -fPIC @@ -68,8 +68,8 @@ Objects0=$(IntermediateDirectory)/main.cpp$(ObjectSuffix) $(IntermediateDirector $(IntermediateDirectory)/Camera.cpp$(ObjectSuffix) $(IntermediateDirectory)/MainFrameBitmaps.cpp$(ObjectSuffix) $(IntermediateDirectory)/WorkspaceBitmaps.cpp$(ObjectSuffix) $(IntermediateDirectory)/BusFormBitmaps.cpp$(ObjectSuffix) $(IntermediateDirectory)/ElementFormBitmaps.cpp$(ObjectSuffix) $(IntermediateDirectory)/ControlEditorBitmaps.cpp$(ObjectSuffix) $(IntermediateDirectory)/MainFrameBase.cpp$(ObjectSuffix) $(IntermediateDirectory)/WorkspaceBase.cpp$(ObjectSuffix) $(IntermediateDirectory)/ElementForm.cpp$(ObjectSuffix) $(IntermediateDirectory)/ControlEditorBase.cpp$(ObjectSuffix) \ $(IntermediateDirectory)/Bus.cpp$(ObjectSuffix) $(IntermediateDirectory)/Line.cpp$(ObjectSuffix) $(IntermediateDirectory)/Transformer.cpp$(ObjectSuffix) $(IntermediateDirectory)/Machines.cpp$(ObjectSuffix) $(IntermediateDirectory)/SyncGenerator.cpp$(ObjectSuffix) $(IntermediateDirectory)/IndMotor.cpp$(ObjectSuffix) $(IntermediateDirectory)/Branch.cpp$(ObjectSuffix) $(IntermediateDirectory)/SyncMotor.cpp$(ObjectSuffix) $(IntermediateDirectory)/Shunt.cpp$(ObjectSuffix) $(IntermediateDirectory)/Load.cpp$(ObjectSuffix) \ $(IntermediateDirectory)/Inductor.cpp$(ObjectSuffix) $(IntermediateDirectory)/Capacitor.cpp$(ObjectSuffix) $(IntermediateDirectory)/PowerElement.cpp$(ObjectSuffix) $(IntermediateDirectory)/ElectricCalculation.cpp$(ObjectSuffix) $(IntermediateDirectory)/PowerFlow.cpp$(ObjectSuffix) $(IntermediateDirectory)/Fault.cpp$(ObjectSuffix) $(IntermediateDirectory)/Text.cpp$(ObjectSuffix) $(IntermediateDirectory)/GraphicalElement.cpp$(ObjectSuffix) $(IntermediateDirectory)/ControlElement.cpp$(ObjectSuffix) $(IntermediateDirectory)/TransferFunction.cpp$(ObjectSuffix) \ - $(IntermediateDirectory)/ConnectionLine.cpp$(ObjectSuffix) $(IntermediateDirectory)/Sum.cpp$(ObjectSuffix) $(IntermediateDirectory)/Multiplier.cpp$(ObjectSuffix) $(IntermediateDirectory)/BusForm.cpp$(ObjectSuffix) $(IntermediateDirectory)/GeneratorStabForm.cpp$(ObjectSuffix) $(IntermediateDirectory)/LineForm.cpp$(ObjectSuffix) $(IntermediateDirectory)/SwitchingForm.cpp$(ObjectSuffix) $(IntermediateDirectory)/TransformerForm.cpp$(ObjectSuffix) $(IntermediateDirectory)/LoadForm.cpp$(ObjectSuffix) $(IntermediateDirectory)/ReactiveShuntElementForm.cpp$(ObjectSuffix) \ - $(IntermediateDirectory)/IndMotorForm.cpp$(ObjectSuffix) $(IntermediateDirectory)/SyncMachineForm.cpp$(ObjectSuffix) $(IntermediateDirectory)/TextForm.cpp$(ObjectSuffix) $(IntermediateDirectory)/TransferFunctionForm.cpp$(ObjectSuffix) $(IntermediateDirectory)/SumForm.cpp$(ObjectSuffix) + $(IntermediateDirectory)/ConnectionLine.cpp$(ObjectSuffix) $(IntermediateDirectory)/Sum.cpp$(ObjectSuffix) $(IntermediateDirectory)/Multiplier.cpp$(ObjectSuffix) $(IntermediateDirectory)/Limiter.cpp$(ObjectSuffix) $(IntermediateDirectory)/RateLimiter.cpp$(ObjectSuffix) $(IntermediateDirectory)/BusForm.cpp$(ObjectSuffix) $(IntermediateDirectory)/GeneratorStabForm.cpp$(ObjectSuffix) $(IntermediateDirectory)/LineForm.cpp$(ObjectSuffix) $(IntermediateDirectory)/SwitchingForm.cpp$(ObjectSuffix) $(IntermediateDirectory)/TransformerForm.cpp$(ObjectSuffix) \ + $(IntermediateDirectory)/LoadForm.cpp$(ObjectSuffix) $(IntermediateDirectory)/ReactiveShuntElementForm.cpp$(ObjectSuffix) $(IntermediateDirectory)/IndMotorForm.cpp$(ObjectSuffix) $(IntermediateDirectory)/SyncMachineForm.cpp$(ObjectSuffix) $(IntermediateDirectory)/TextForm.cpp$(ObjectSuffix) $(IntermediateDirectory)/TransferFunctionForm.cpp$(ObjectSuffix) $(IntermediateDirectory)/SumForm.cpp$(ObjectSuffix) $(IntermediateDirectory)/LimiterForm.cpp$(ObjectSuffix) $(IntermediateDirectory)/RateLimiterForm.cpp$(ObjectSuffix) @@ -438,6 +438,22 @@ $(IntermediateDirectory)/Multiplier.cpp$(DependSuffix): Multiplier.cpp $(IntermediateDirectory)/Multiplier.cpp$(PreprocessSuffix): Multiplier.cpp $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/Multiplier.cpp$(PreprocessSuffix) Multiplier.cpp +$(IntermediateDirectory)/Limiter.cpp$(ObjectSuffix): Limiter.cpp $(IntermediateDirectory)/Limiter.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "C:/Users/NDSE-69/Documents/GitHub/PSP/Project/Limiter.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/Limiter.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/Limiter.cpp$(DependSuffix): Limiter.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/Limiter.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/Limiter.cpp$(DependSuffix) -MM Limiter.cpp + +$(IntermediateDirectory)/Limiter.cpp$(PreprocessSuffix): Limiter.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/Limiter.cpp$(PreprocessSuffix) Limiter.cpp + +$(IntermediateDirectory)/RateLimiter.cpp$(ObjectSuffix): RateLimiter.cpp $(IntermediateDirectory)/RateLimiter.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "C:/Users/NDSE-69/Documents/GitHub/PSP/Project/RateLimiter.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/RateLimiter.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/RateLimiter.cpp$(DependSuffix): RateLimiter.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/RateLimiter.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/RateLimiter.cpp$(DependSuffix) -MM RateLimiter.cpp + +$(IntermediateDirectory)/RateLimiter.cpp$(PreprocessSuffix): RateLimiter.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/RateLimiter.cpp$(PreprocessSuffix) RateLimiter.cpp + $(IntermediateDirectory)/BusForm.cpp$(ObjectSuffix): BusForm.cpp $(IntermediateDirectory)/BusForm.cpp$(DependSuffix) $(CXX) $(IncludePCH) $(SourceSwitch) "C:/Users/NDSE-69/Documents/GitHub/PSP/Project/BusForm.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/BusForm.cpp$(ObjectSuffix) $(IncludePath) $(IntermediateDirectory)/BusForm.cpp$(DependSuffix): BusForm.cpp @@ -534,6 +550,22 @@ $(IntermediateDirectory)/SumForm.cpp$(DependSuffix): SumForm.cpp $(IntermediateDirectory)/SumForm.cpp$(PreprocessSuffix): SumForm.cpp $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/SumForm.cpp$(PreprocessSuffix) SumForm.cpp +$(IntermediateDirectory)/LimiterForm.cpp$(ObjectSuffix): LimiterForm.cpp $(IntermediateDirectory)/LimiterForm.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "C:/Users/NDSE-69/Documents/GitHub/PSP/Project/LimiterForm.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/LimiterForm.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/LimiterForm.cpp$(DependSuffix): LimiterForm.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/LimiterForm.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/LimiterForm.cpp$(DependSuffix) -MM LimiterForm.cpp + +$(IntermediateDirectory)/LimiterForm.cpp$(PreprocessSuffix): LimiterForm.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/LimiterForm.cpp$(PreprocessSuffix) LimiterForm.cpp + +$(IntermediateDirectory)/RateLimiterForm.cpp$(ObjectSuffix): RateLimiterForm.cpp $(IntermediateDirectory)/RateLimiterForm.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "C:/Users/NDSE-69/Documents/GitHub/PSP/Project/RateLimiterForm.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/RateLimiterForm.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/RateLimiterForm.cpp$(DependSuffix): RateLimiterForm.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/RateLimiterForm.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/RateLimiterForm.cpp$(DependSuffix) -MM RateLimiterForm.cpp + +$(IntermediateDirectory)/RateLimiterForm.cpp$(PreprocessSuffix): RateLimiterForm.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/RateLimiterForm.cpp$(PreprocessSuffix) RateLimiterForm.cpp + -include $(IntermediateDirectory)/*$(DependSuffix) ## diff --git a/Project/Project.project b/Project/Project.project index 50637d8..f7eb8d6 100644 --- a/Project/Project.project +++ b/Project/Project.project @@ -42,6 +42,9 @@ <File Name="ConnectionLine.cpp"/> <File Name="Sum.cpp"/> <File Name="Multiplier.cpp"/> + <File Name="Limiter.cpp"/> + <File Name="RateLimiter.cpp"/> + <File Name="Exponential.cpp"/> </VirtualDirectory> </VirtualDirectory> <VirtualDirectory Name="view"> @@ -71,6 +74,8 @@ <VirtualDirectory Name="control element form"> <File Name="TransferFunctionForm.cpp"/> <File Name="SumForm.cpp"/> + <File Name="LimiterForm.cpp"/> + <File Name="RateLimiterForm.cpp"/> </VirtualDirectory> </VirtualDirectory> <File Name="main.cpp"/> @@ -115,6 +120,9 @@ <File Name="ConnectionLine.h"/> <File Name="Sum.h"/> <File Name="Multiplier.h"/> + <File Name="Limiter.h"/> + <File Name="RateLimiter.h"/> + <File Name="Exponential.h"/> </VirtualDirectory> </VirtualDirectory> <VirtualDirectory Name="view"> @@ -144,6 +152,8 @@ <VirtualDirectory Name="control element form"> <File Name="TransferFunctionForm.h"/> <File Name="SumForm.h"/> + <File Name="LimiterForm.h"/> + <File Name="RateLimiterForm.h"/> </VirtualDirectory> </VirtualDirectory> </VirtualDirectory> diff --git a/Project/Project.txt b/Project/Project.txt index 3f5064d..f308127 100644 --- a/Project/Project.txt +++ b/Project/Project.txt @@ -1 +1 @@ -./Release/main.cpp.o ./Release/win_resources.rc.o ./Release/ElementDataObject.cpp.o ./Release/Element.cpp.o ./Release/ArtMetro.cpp.o ./Release/wxGLString.cpp.o ./Release/MainFrame.cpp.o ./Release/Workspace.cpp.o ./Release/FileHanding.cpp.o ./Release/ControlEditor.cpp.o ./Release/Camera.cpp.o ./Release/MainFrameBitmaps.cpp.o ./Release/WorkspaceBitmaps.cpp.o ./Release/BusFormBitmaps.cpp.o ./Release/ElementFormBitmaps.cpp.o ./Release/ControlEditorBitmaps.cpp.o ./Release/MainFrameBase.cpp.o ./Release/WorkspaceBase.cpp.o ./Release/ElementForm.cpp.o ./Release/ControlEditorBase.cpp.o ./Release/Bus.cpp.o ./Release/Line.cpp.o ./Release/Transformer.cpp.o ./Release/Machines.cpp.o ./Release/SyncGenerator.cpp.o ./Release/IndMotor.cpp.o ./Release/Branch.cpp.o ./Release/SyncMotor.cpp.o ./Release/Shunt.cpp.o ./Release/Load.cpp.o ./Release/Inductor.cpp.o ./Release/Capacitor.cpp.o ./Release/PowerElement.cpp.o ./Release/ElectricCalculation.cpp.o ./Release/PowerFlow.cpp.o ./Release/Fault.cpp.o ./Release/Text.cpp.o ./Release/GraphicalElement.cpp.o ./Release/ControlElement.cpp.o ./Release/TransferFunction.cpp.o ./Release/ConnectionLine.cpp.o ./Release/Sum.cpp.o ./Release/Multiplier.cpp.o ./Release/BusForm.cpp.o ./Release/GeneratorStabForm.cpp.o ./Release/LineForm.cpp.o ./Release/SwitchingForm.cpp.o ./Release/TransformerForm.cpp.o ./Release/LoadForm.cpp.o ./Release/ReactiveShuntElementForm.cpp.o ./Release/IndMotorForm.cpp.o ./Release/SyncMachineForm.cpp.o ./Release/TextForm.cpp.o ./Release/TransferFunctionForm.cpp.o ./Release/SumForm.cpp.o +./Release/main.cpp.o ./Release/win_resources.rc.o ./Release/ElementDataObject.cpp.o ./Release/Element.cpp.o ./Release/ArtMetro.cpp.o ./Release/wxGLString.cpp.o ./Release/MainFrame.cpp.o ./Release/Workspace.cpp.o ./Release/FileHanding.cpp.o ./Release/ControlEditor.cpp.o ./Release/Camera.cpp.o ./Release/MainFrameBitmaps.cpp.o ./Release/WorkspaceBitmaps.cpp.o ./Release/BusFormBitmaps.cpp.o ./Release/ElementFormBitmaps.cpp.o ./Release/ControlEditorBitmaps.cpp.o ./Release/MainFrameBase.cpp.o ./Release/WorkspaceBase.cpp.o ./Release/ElementForm.cpp.o ./Release/ControlEditorBase.cpp.o ./Release/Bus.cpp.o ./Release/Line.cpp.o ./Release/Transformer.cpp.o ./Release/Machines.cpp.o ./Release/SyncGenerator.cpp.o ./Release/IndMotor.cpp.o ./Release/Branch.cpp.o ./Release/SyncMotor.cpp.o ./Release/Shunt.cpp.o ./Release/Load.cpp.o ./Release/Inductor.cpp.o ./Release/Capacitor.cpp.o ./Release/PowerElement.cpp.o ./Release/ElectricCalculation.cpp.o ./Release/PowerFlow.cpp.o ./Release/Fault.cpp.o ./Release/Text.cpp.o ./Release/GraphicalElement.cpp.o ./Release/ControlElement.cpp.o ./Release/TransferFunction.cpp.o ./Release/ConnectionLine.cpp.o ./Release/Sum.cpp.o ./Release/Multiplier.cpp.o ./Release/Limiter.cpp.o ./Release/RateLimiter.cpp.o ./Release/BusForm.cpp.o ./Release/GeneratorStabForm.cpp.o ./Release/LineForm.cpp.o ./Release/SwitchingForm.cpp.o ./Release/TransformerForm.cpp.o ./Release/LoadForm.cpp.o ./Release/ReactiveShuntElementForm.cpp.o ./Release/IndMotorForm.cpp.o ./Release/SyncMachineForm.cpp.o ./Release/TextForm.cpp.o ./Release/TransferFunctionForm.cpp.o ./Release/SumForm.cpp.o ./Release/LimiterForm.cpp.o ./Release/RateLimiterForm.cpp.o diff --git a/Project/RateLimiter.cpp b/Project/RateLimiter.cpp new file mode 100644 index 0000000..a003e56 --- /dev/null +++ b/Project/RateLimiter.cpp @@ -0,0 +1,97 @@ +#include "RateLimiter.h" +#include "RateLimiterForm.h" + +RateLimiter::RateLimiter() : ControlElement() +{ + m_width = m_height = 36.0; + Node* nodeIn = new Node(m_position + wxPoint2DDouble(-18, 0), Node::NODE_IN, m_borderSize); + nodeIn->StartMove(m_position); + Node* nodeOut = new Node(m_position + wxPoint2DDouble(18, 0), Node::NODE_OUT, m_borderSize); + nodeOut->SetAngle(180.0); + nodeOut->StartMove(m_position); + m_nodeList.push_back(nodeIn); + m_nodeList.push_back(nodeOut); +} + +RateLimiter::~RateLimiter() +{ +} + +void RateLimiter::Draw(wxPoint2DDouble translation, double scale) const +{ + glLineWidth(1.0); + if(m_selected) { + glColor4dv(m_selectionColour.GetRGBA()); + double borderSize = (m_borderSize * 2.0 + 1.0) / scale; + DrawRectangle(m_position, m_width + borderSize, m_height + borderSize); + } + glColor4d(1.0, 1.0, 1.0, 1.0); + DrawRectangle(m_position, m_width, m_height); + glColor4d(0.0, 0.0, 0.0, 1.0); + DrawRectangle(m_position, m_width, m_height, GL_LINE_LOOP); + + // Plot symbol. + std::vector<wxPoint2DDouble> axis; + axis.push_back(m_position + wxPoint2DDouble(-10, 0)); + axis.push_back(m_position + wxPoint2DDouble(10, 0)); + axis.push_back(m_position + wxPoint2DDouble(0, -10)); + axis.push_back(m_position + wxPoint2DDouble(0, 10)); + DrawLine(axis, GL_LINES); + + glLineWidth(2.0); + std::vector<wxPoint2DDouble> limSymbol; + limSymbol.push_back(m_position + wxPoint2DDouble(7, -7)); + limSymbol.push_back(m_position + wxPoint2DDouble(-7, 7)); + glColor4d(0.0, 0.3, 1.0, 1.0); + DrawLine(limSymbol); + + glColor4d(0.0, 0.0, 0.0, 1.0); + DrawNodes(); +} + +bool RateLimiter::ShowForm(wxWindow* parent, Element* element) +{ + RateLimiterForm* form = new RateLimiterForm(parent, this); + if(form->ShowModal() == wxID_OK) { + form->Destroy(); + return true; + } + form->Destroy(); + return false; +} + +void RateLimiter::Rotate(bool clockwise) +{ + if(clockwise) + m_angle += 90.0; + else + m_angle -= 90.0; + if(m_angle >= 360.0) + m_angle = 0.0; + else if(m_angle < 0) + m_angle = 270.0; + + UpdatePoints(); + + for(auto it = m_nodeList.begin(), itEnd = m_nodeList.end(); it != itEnd; ++it) { + Node* node = *it; + node->Rotate(clockwise); + } +} + +void RateLimiter::UpdatePoints() +{ + if(m_angle == 0.0) { + m_nodeList[0]->SetPosition(m_position + wxPoint2DDouble(-18, 0)); + m_nodeList[1]->SetPosition(m_position + wxPoint2DDouble(18, 0)); + } else if(m_angle == 90.0) { + m_nodeList[0]->SetPosition(m_position + wxPoint2DDouble(0, -18)); + m_nodeList[1]->SetPosition(m_position + wxPoint2DDouble(0, 18)); + } else if(m_angle == 180.0) { + m_nodeList[0]->SetPosition(m_position + wxPoint2DDouble(18, 0)); + m_nodeList[1]->SetPosition(m_position + wxPoint2DDouble(-18, 0)); + } else if(m_angle == 270.0) { + m_nodeList[0]->SetPosition(m_position + wxPoint2DDouble(0, 18)); + m_nodeList[1]->SetPosition(m_position + wxPoint2DDouble(0, -18)); + } +} diff --git a/Project/RateLimiter.h b/Project/RateLimiter.h new file mode 100644 index 0000000..1d6d72e --- /dev/null +++ b/Project/RateLimiter.h @@ -0,0 +1,32 @@ +#ifndef RATELIMITER_H +#define RATELIMITER_H + +#include "ControlElement.h" + +class RateLimiterForm; + +class RateLimiter : public ControlElement +{ + public: + RateLimiter(); + ~RateLimiter(); + + virtual void Draw(wxPoint2DDouble translation, double scale) const; + virtual bool Contains(wxPoint2DDouble position) const { return m_rect.Contains(position); } + virtual bool Intersects(wxRect2DDouble rect) const { return m_rect.Intersects(rect); } + virtual bool ShowForm(wxWindow* parent, Element* element); + virtual void Rotate(bool clockwise = true); + + virtual void UpdatePoints(); + + double GetUpLimit() const { return m_upLimit; } + double GetLowLimit() const { return m_lowLimit; } + void SetUpLimit(double upLimit) { m_upLimit = upLimit; } + void SetLowLimit(double lowLimit) { m_lowLimit = lowLimit; } + + protected: + double m_upLimit = 5.0; + double m_lowLimit = -5.0; +}; + +#endif // RATELIMITER_H diff --git a/Project/RateLimiterForm.cpp b/Project/RateLimiterForm.cpp new file mode 100644 index 0000000..e0d11f2 --- /dev/null +++ b/Project/RateLimiterForm.cpp @@ -0,0 +1,35 @@ +#include "RateLimiterForm.h" +#include "RateLimiter.h" + +RateLimiterForm::RateLimiterForm(wxWindow* parent, RateLimiter* rateLimiter) : RateLimiterFormBase(parent) +{ + m_rateLimiter = rateLimiter; + m_parent = parent; + + m_textCtrlUpLimit->SetValue(m_rateLimiter->StringFromDouble(m_rateLimiter->GetUpLimit())); + m_textCtrlLowLimit->SetValue(m_rateLimiter->StringFromDouble(m_rateLimiter->GetLowLimit())); +} + +RateLimiterForm::~RateLimiterForm() {} +bool RateLimiterForm::ValidateData() +{ + double upLimit; + double lowLimit; + + if(!m_rateLimiter->DoubleFromString(this, m_textCtrlUpLimit->GetValue(), upLimit, + _("Value entered incorrectly in the field \"Upper limit\"."))) + return false; + if(!m_rateLimiter->DoubleFromString(this, m_textCtrlLowLimit->GetValue(), lowLimit, + _("Value entered incorrectly in the field \"Lower limit\"."))) + return false; + + m_rateLimiter->SetUpLimit(upLimit); + m_rateLimiter->SetLowLimit(lowLimit); + + return true; +} + +void RateLimiterForm::OnOKButtonClick(wxCommandEvent& event) +{ + if(ValidateData()) EndModal(wxID_OK); +} diff --git a/Project/RateLimiterForm.h b/Project/RateLimiterForm.h new file mode 100644 index 0000000..539504e --- /dev/null +++ b/Project/RateLimiterForm.h @@ -0,0 +1,21 @@ +#ifndef RATELIMITERFORM_H +#define RATELIMITERFORM_H +#include "ElementForm.h" + +class RateLimiter; + +class RateLimiterForm : public RateLimiterFormBase +{ + public: + RateLimiterForm(wxWindow* parent, RateLimiter* rateLimiter); + virtual ~RateLimiterForm(); + bool ValidateData(); + + protected: + virtual void OnCancelButtonClick(wxCommandEvent& event) {EndModal(wxID_OK);} + virtual void OnOKButtonClick(wxCommandEvent& event); + + wxWindow* m_parent = NULL; + RateLimiter* m_rateLimiter = NULL; +}; +#endif // RATELIMITERFORM_H |