diff options
author | Thales Lima Oliveira <thaleslima.ufu@gmail.com> | 2017-04-01 17:43:54 -0300 |
---|---|---|
committer | Thales Lima Oliveira <thaleslima.ufu@gmail.com> | 2017-04-01 17:43:54 -0300 |
commit | afb0e6e08d3911b7387799f5c465fd59ca26a484 (patch) | |
tree | 7b9b24d512813837c64d6cc9b2e005cd9791b5e6 /Project | |
parent | a684d5c9c9dd131060b5a36d7c7844ae197fcfd1 (diff) | |
download | PSP.git-afb0e6e08d3911b7387799f5c465fd59ca26a484.tar.gz PSP.git-afb0e6e08d3911b7387799f5c465fd59ca26a484.tar.xz PSP.git-afb0e6e08d3911b7387799f5c465fd59ca26a484.zip |
Constant implemented
Missing: gain and io
Diffstat (limited to 'Project')
-rw-r--r-- | Project/Constant.cpp | 104 | ||||
-rw-r--r-- | Project/Constant.h | 34 | ||||
-rw-r--r-- | Project/ConstantForm.cpp | 27 | ||||
-rw-r--r-- | Project/ConstantForm.h | 21 | ||||
-rw-r--r-- | Project/ControlEditor.cpp | 7 | ||||
-rw-r--r-- | Project/ControlEditor.h | 1 | ||||
-rw-r--r-- | Project/ElementForm.cpp | 194 | ||||
-rw-r--r-- | Project/ElementForm.h | 58 | ||||
-rw-r--r-- | Project/ElementForm.wxcp | 739 | ||||
-rw-r--r-- | Project/Exponential.cpp | 26 | ||||
-rw-r--r-- | Project/Exponential.h | 9 | ||||
-rw-r--r-- | Project/ExponentialForm.cpp | 44 | ||||
-rw-r--r-- | Project/ExponentialForm.h | 21 | ||||
-rw-r--r-- | Project/Project.mk | 32 | ||||
-rw-r--r-- | Project/Project.project | 6 | ||||
-rw-r--r-- | Project/Project.txt | 2 | ||||
-rw-r--r-- | Project/TransferFunctionForm.cpp | 12 |
17 files changed, 1307 insertions, 30 deletions
diff --git a/Project/Constant.cpp b/Project/Constant.cpp new file mode 100644 index 0000000..77a129e --- /dev/null +++ b/Project/Constant.cpp @@ -0,0 +1,104 @@ +#include "Constant.h" +#include "ConstantForm.h" + +Constant::Constant() : ControlElement() +{ + SetValue(m_value); + m_angle = 180.0; + Node* nodeOut = new Node(m_position + wxPoint2DDouble(m_width / 2, 0), Node::NODE_OUT, m_borderSize); + nodeOut->SetAngle(180.0); + nodeOut->StartMove(m_position); + m_nodeList.push_back(nodeOut); +} + +Constant::~Constant() {} +void Constant::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 number. + glEnable(GL_TEXTURE_2D); + glColor4d(0.0, 0.0, 0.0, 1.0); + m_glStringValue->bind(); + m_glStringValue->render(m_position.m_x, m_position.m_y); + glDisable(GL_TEXTURE_2D); + + glColor4d(0.0, 0.0, 0.0, 1.0); + DrawNodes(); +} + +bool Constant::ShowForm(wxWindow* parent, Element* element) +{ + ConstantForm* form = new ConstantForm(parent, this); + if(form->ShowModal() == wxID_OK) { + form->Destroy(); + return true; + } + form->Destroy(); + return false; +} + +void Constant::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 Constant::UpdatePoints() +{ + if(m_nodeList.size() != 0) { + if(m_angle == 0.0) { + m_nodeList[0]->SetPosition(m_position + wxPoint2DDouble(-m_width / 2, 0)); + } else if(m_angle == 90.0) { + m_nodeList[0]->SetPosition(m_position + wxPoint2DDouble(0, -m_height / 2)); + } else if(m_angle == 180.0) { + m_nodeList[0]->SetPosition(m_position + wxPoint2DDouble(m_width / 2, 0)); + } else if(m_angle == 270.0) { + m_nodeList[0]->SetPosition(m_position + wxPoint2DDouble(0, m_height / 2)); + } + } +} + +void Constant::SetValue(double value) +{ + m_value = value; + wxString text = StringFromDouble(m_value); + + wxFont font(m_fontSize, wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL); + wxScreenDC dc; + + if(m_glStringValue) { + delete m_glStringValue; + m_glStringValue = NULL; + } + m_glStringValue = new wxGLString(text); + m_glStringValue->setFont(font); + m_glStringValue->consolidate(&dc); + + m_width = m_glStringValue->getWidth() + 6 + 2 * m_borderSize; + m_height = m_glStringValue->getheight() + 6 + 2 * m_borderSize; + + UpdatePoints(); +}
\ No newline at end of file diff --git a/Project/Constant.h b/Project/Constant.h new file mode 100644 index 0000000..b193a7a --- /dev/null +++ b/Project/Constant.h @@ -0,0 +1,34 @@ +#ifndef CONSTANT_H +#define CONSTANT_H + +#include "ControlElement.h" + +#include <wx/dcscreen.h> +#include "wxGLString.h" + +class ConstantForm; + +class Constant : public ControlElement +{ + public: + Constant(); + ~Constant(); + + 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 SetValue(double value); + virtual double GetValue() const { return m_value; } + virtual void UpdatePoints(); + + protected: + double m_value = 1.0; + + wxGLString* m_glStringValue = NULL; + int m_fontSize = 10; +}; + +#endif // CONSTANT_H diff --git a/Project/ConstantForm.cpp b/Project/ConstantForm.cpp new file mode 100644 index 0000000..c769919 --- /dev/null +++ b/Project/ConstantForm.cpp @@ -0,0 +1,27 @@ +#include "ConstantForm.h" +#include "Constant.h" + +ConstantForm::ConstantForm(wxWindow* parent, Constant* constant) : ConstantFormBase(parent) +{ + m_parent = parent; + m_constant = constant; + + m_textCtrlValue->SetValue(m_constant->StringFromDouble(m_constant->GetValue())); +} + +ConstantForm::~ConstantForm() {} +void ConstantForm::OnOKButtonClick(wxCommandEvent& event) +{ + if(ValidateData()) EndModal(wxID_OK); +} + +bool ConstantForm::ValidateData() +{ + double value; + if(!m_constant->DoubleFromString(this, m_textCtrlValue->GetValue(), value, + _("Value entered incorrectly in the field \"Value\"."))) + return false; + + m_constant->SetValue(value); + return true; +} diff --git a/Project/ConstantForm.h b/Project/ConstantForm.h new file mode 100644 index 0000000..ca7a44a --- /dev/null +++ b/Project/ConstantForm.h @@ -0,0 +1,21 @@ +#ifndef CONSTANTFORM_H +#define CONSTANTFORM_H +#include "ElementForm.h" + +class Constant; + +class ConstantForm : public ConstantFormBase +{ + public: + ConstantForm(wxWindow* parent, Constant* constant); + virtual ~ConstantForm(); + virtual bool ValidateData(); + + protected: + virtual void OnCancelButtonClick(wxCommandEvent& event) { EndModal(wxID_CANCEL); } + virtual void OnOKButtonClick(wxCommandEvent& event); + + wxWindow* m_parent = NULL; + Constant* m_constant = NULL; +}; +#endif // CONSTANTFORM_H diff --git a/Project/ControlEditor.cpp b/Project/ControlEditor.cpp index e34c36f..7a49694 100644 --- a/Project/ControlEditor.cpp +++ b/Project/ControlEditor.cpp @@ -9,6 +9,7 @@ #include "Limiter.h" #include "RateLimiter.h" #include "Exponential.h" +#include "Constant.h" ControlElementButton::ControlElementButton(wxWindow* parent, wxString label, wxImage image, wxWindowID id) : wxWindow(parent, id) @@ -106,7 +107,7 @@ ControlEditor::ControlEditor(wxWindow* parent) : ControlEditorBase(parent) m_glContext = new wxGLContext(m_glCanvas); m_camera = new Camera(); m_selectionRect = wxRect2DDouble(0, 0, 0, 0); - // m_camera->SetScale(1.2); + m_camera->SetScale(1.2); } ControlEditor::~ControlEditor() { @@ -213,7 +214,9 @@ void ControlEditor::AddElement(ControlElementButtonID id) m_elementList.push_back(sum); } break; case ID_CONST: { - wxLogMessage("const"); + m_mode = MODE_INSERT; + Constant* constant = new Constant(); + m_elementList.push_back(constant); } break; case ID_LIMITER: { m_mode = MODE_INSERT; diff --git a/Project/ControlEditor.h b/Project/ControlEditor.h index da3d567..4a7397c 100644 --- a/Project/ControlEditor.h +++ b/Project/ControlEditor.h @@ -19,6 +19,7 @@ class Multiplier; class Limiter; class RateLimiter; class Exponential; +class Constant; enum ControlElementButtonID { ID_IO = 0, ID_TF, ID_SUM, ID_CONST, ID_LIMITER, ID_GAIN, ID_MULT, ID_EXP, ID_RATELIM }; diff --git a/Project/ElementForm.cpp b/Project/ElementForm.cpp index afb8f7e..b474e1c 100644 --- a/Project/ElementForm.cpp +++ b/Project/ElementForm.cpp @@ -3177,3 +3177,197 @@ RateLimiterFormBase::~RateLimiterFormBase() m_ButtonCancel->Disconnect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(RateLimiterFormBase::OnCancelButtonClick), NULL, this); } + +ExponentialFormBase::ExponentialFormBase(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_staticTextExp = new wxStaticText(m_panelGeneral, wxID_ANY, _("y = A.eB.x"), wxDefaultPosition, wxDLG_UNIT(m_panelGeneral, wxSize(-1,-1)), wxALIGN_CENTRE); + + boxSizerLvl2_1->Add(m_staticTextExp, 1, wxLEFT|wxRIGHT|wxTOP|wxEXPAND|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, WXC_FROM_DIP(5)); + + m_staticTextAValue = new wxStaticText(m_panelGeneral, wxID_ANY, _("A value"), wxDefaultPosition, wxDLG_UNIT(m_panelGeneral, wxSize(-1,-1)), 0); + + boxSizerLvl2_1->Add(m_staticTextAValue, 0, wxLEFT|wxRIGHT|wxTOP|wxALIGN_CENTER_VERTICAL, WXC_FROM_DIP(5)); + + m_textCtrlAValue = new wxTextCtrl(m_panelGeneral, wxID_ANY, wxT(""), wxDefaultPosition, wxDLG_UNIT(m_panelGeneral, wxSize(-1,-1)), 0); + #if wxVERSION_NUMBER >= 3000 + m_textCtrlAValue->SetHint(wxT("")); + #endif + + boxSizerLvl2_1->Add(m_textCtrlAValue, 0, wxLEFT|wxRIGHT|wxBOTTOM|wxEXPAND|wxALIGN_CENTER_VERTICAL, WXC_FROM_DIP(5)); + m_textCtrlAValue->SetMinSize(wxSize(100,-1)); + + m_staticTextBValue = new wxStaticText(m_panelGeneral, wxID_ANY, _("B value"), wxDefaultPosition, wxDLG_UNIT(m_panelGeneral, wxSize(-1,-1)), 0); + + boxSizerLvl2_1->Add(m_staticTextBValue, 0, wxLEFT|wxRIGHT|wxTOP|wxALIGN_CENTER_VERTICAL, WXC_FROM_DIP(5)); + + m_textCtrlBValue = new wxTextCtrl(m_panelGeneral, wxID_ANY, wxT(""), wxDefaultPosition, wxDLG_UNIT(m_panelGeneral, wxSize(-1,-1)), 0); + #if wxVERSION_NUMBER >= 3000 + m_textCtrlBValue->SetHint(wxT("")); + #endif + + boxSizerLvl2_1->Add(m_textCtrlBValue, 0, wxLEFT|wxRIGHT|wxBOTTOM|wxEXPAND|wxALIGN_CENTER_VERTICAL, WXC_FROM_DIP(5)); + m_textCtrlBValue->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("ExponentialFormBase")); + 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(ExponentialFormBase::OnOKButtonClick), NULL, this); + m_buttonCancel->Connect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(ExponentialFormBase::OnCancelButtonClick), NULL, this); + +} + +ExponentialFormBase::~ExponentialFormBase() +{ + m_buttonOK->Disconnect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(ExponentialFormBase::OnOKButtonClick), NULL, this); + m_buttonCancel->Disconnect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(ExponentialFormBase::OnCancelButtonClick), NULL, this); + +} + +ConstantFormBase::ConstantFormBase(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_staticTextValue = new wxStaticText(m_panelGeneral, wxID_ANY, _("A value"), wxDefaultPosition, wxDLG_UNIT(m_panelGeneral, wxSize(-1,-1)), 0); + + boxSizerLvl2_1->Add(m_staticTextValue, 0, wxLEFT|wxRIGHT|wxTOP|wxALIGN_CENTER_VERTICAL, WXC_FROM_DIP(5)); + + m_textCtrlValue = new wxTextCtrl(m_panelGeneral, wxID_ANY, wxT(""), wxDefaultPosition, wxDLG_UNIT(m_panelGeneral, wxSize(-1,-1)), 0); + #if wxVERSION_NUMBER >= 3000 + m_textCtrlValue->SetHint(wxT("")); + #endif + + boxSizerLvl2_1->Add(m_textCtrlValue, 0, wxLEFT|wxRIGHT|wxBOTTOM|wxEXPAND|wxALIGN_CENTER_VERTICAL, WXC_FROM_DIP(5)); + m_textCtrlValue->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("ConstantFormBase")); + 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(ConstantFormBase::OnOKButtonClick), NULL, this); + m_buttonCancel->Connect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(ConstantFormBase::OnCancelButtonClick), NULL, this); + +} + +ConstantFormBase::~ConstantFormBase() +{ + m_buttonOK->Disconnect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(ConstantFormBase::OnOKButtonClick), NULL, this); + m_buttonCancel->Disconnect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(ConstantFormBase::OnCancelButtonClick), NULL, this); + +} diff --git a/Project/ElementForm.h b/Project/ElementForm.h index 300f1eb..17aacd4 100644 --- a/Project/ElementForm.h +++ b/Project/ElementForm.h @@ -887,4 +887,62 @@ public: virtual ~RateLimiterFormBase(); }; + +class ExponentialFormBase : public wxDialog +{ +protected: + wxNotebook* m_notebook; + wxPanel* m_panelGeneral; + wxStaticText* m_staticTextExp; + wxStaticText* m_staticTextAValue; + wxTextCtrl* m_textCtrlAValue; + wxStaticText* m_staticTextBValue; + wxTextCtrl* m_textCtrlBValue; + wxButton* m_buttonOK; + wxButton* m_buttonCancel; + +protected: + virtual void OnOKButtonClick(wxCommandEvent& event) { event.Skip(); } + virtual void OnCancelButtonClick(wxCommandEvent& event) { event.Skip(); } + +public: + wxStaticText* GetStaticTextExp() { return m_staticTextExp; } + wxStaticText* GetStaticTextAValue() { return m_staticTextAValue; } + wxTextCtrl* GetTextCtrlAValue() { return m_textCtrlAValue; } + wxStaticText* GetStaticTextBValue() { return m_staticTextBValue; } + wxTextCtrl* GetTextCtrlBValue() { return m_textCtrlBValue; } + wxPanel* GetPanelGeneral() { return m_panelGeneral; } + wxNotebook* GetNotebook() { return m_notebook; } + wxButton* GetButtonOK() { return m_buttonOK; } + wxButton* GetButtonCancel() { return m_buttonCancel; } + ExponentialFormBase(wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Exponential"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize(-1,-1), long style = wxDEFAULT_DIALOG_STYLE); + virtual ~ExponentialFormBase(); +}; + + +class ConstantFormBase : public wxDialog +{ +protected: + wxNotebook* m_notebook; + wxPanel* m_panelGeneral; + wxStaticText* m_staticTextValue; + wxTextCtrl* m_textCtrlValue; + wxButton* m_buttonOK; + wxButton* m_buttonCancel; + +protected: + virtual void OnOKButtonClick(wxCommandEvent& event) { event.Skip(); } + virtual void OnCancelButtonClick(wxCommandEvent& event) { event.Skip(); } + +public: + wxStaticText* GetStaticTextValue() { return m_staticTextValue; } + wxTextCtrl* GetTextCtrlValue() { return m_textCtrlValue; } + wxPanel* GetPanelGeneral() { return m_panelGeneral; } + wxNotebook* GetNotebook() { return m_notebook; } + wxButton* GetButtonOK() { return m_buttonOK; } + wxButton* GetButtonCancel() { return m_buttonCancel; } + ConstantFormBase(wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Constant"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize(-1,-1), long style = wxDEFAULT_DIALOG_STYLE); + virtual ~ConstantFormBase(); +}; + #endif diff --git a/Project/ElementForm.wxcp b/Project/ElementForm.wxcp index d521904..f0c8d61 100644 --- a/Project/ElementForm.wxcp +++ b/Project/ElementForm.wxcp @@ -1,7 +1,7 @@ { "metadata": { "m_generatedFilesDir": ".", - "m_objCounter": 1747, + "m_objCounter": 1775, "m_includeFiles": [], "m_bitmapFunction": "wxC9EE9InitBitmapResources", "m_bitmapsFile": "ElementFormBitmaps.cpp", @@ -32755,7 +32755,7 @@ }, { "type": "string", "m_label": "Title:", - "m_value": "Rate limiter" + "m_value": "Exponential" }, { "type": "virtualFolderPicker", "m_label": "Virtual Folder:", @@ -33003,12 +33003,12 @@ "m_events": [], "m_children": [{ "m_type": 4405, - "proportion": 0, + "proportion": 1, "border": 5, "gbSpan": "1,1", "gbPosition": "0,0", "m_styles": ["wxALIGN_CENTRE"], - "m_sizerFlags": ["wxLEFT", "wxRIGHT", "wxTOP", "wxEXPAND", "wxALIGN_CENTER_VERTICAL"], + "m_sizerFlags": ["wxLEFT", "wxRIGHT", "wxTOP", "wxEXPAND", "wxALIGN_CENTER_HORIZONTAL", "wxALIGN_CENTER_VERTICAL"], "m_properties": [{ "type": "winid", "m_label": "ID:", @@ -33040,7 +33040,7 @@ }, { "type": "font", "m_label": "Font:", - "m_value": "wxSYS_DEFAULT_GUI_FONT,normal,bold,normal" + "m_value": "" }, { "type": "bool", "m_label": "Hidden", @@ -33099,7 +33099,7 @@ }, { "type": "string", "m_label": "Name:", - "m_value": "m_staticTextUpLimiter" + "m_value": "m_staticTextAValue" }, { "type": "multi-string", "m_label": "Tooltip:", @@ -33143,7 +33143,7 @@ }, { "type": "multi-string", "m_label": "Label:", - "m_value": "Upper limit" + "m_value": "A value" }, { "type": "string", "m_label": "Wrap:", @@ -33174,7 +33174,7 @@ }, { "type": "string", "m_label": "Name:", - "m_value": "m_textCtrlUpLimit" + "m_value": "m_textCtrlAValue" }, { "type": "multi-string", "m_label": "Tooltip:", @@ -33261,7 +33261,7 @@ }, { "type": "string", "m_label": "Name:", - "m_value": "m_staticTextLowLimit" + "m_value": "m_staticTextBValue" }, { "type": "multi-string", "m_label": "Tooltip:", @@ -33305,7 +33305,7 @@ }, { "type": "multi-string", "m_label": "Label:", - "m_value": "Lower limit" + "m_value": "B value" }, { "type": "string", "m_label": "Wrap:", @@ -33336,7 +33336,724 @@ }, { "type": "string", "m_label": "Name:", - "m_value": "m_textCtrlLowLimit" + "m_value": "m_textCtrlBValue" + }, { + "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": "ConstantFormBase" + }, { + "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": "Constant" + }, { + "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": "ConstantForm" + }, { + "type": "string", + "m_label": "File:", + "m_value": "ConstantForm" + }, { + "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_staticTextValue" + }, { + "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": "A value" + }, { + "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_textCtrlValue" }, { "type": "multi-string", "m_label": "Tooltip:", diff --git a/Project/Exponential.cpp b/Project/Exponential.cpp index dc18a90..18fef19 100644 --- a/Project/Exponential.cpp +++ b/Project/Exponential.cpp @@ -1,4 +1,5 @@ #include "Exponential.h" +#include "ExponentialForm.h" Exponential::Exponential() { @@ -12,10 +13,7 @@ Exponential::Exponential() m_nodeList.push_back(nodeOut); } -Exponential::~Exponential() -{ -} - +Exponential::~Exponential() {} void Exponential::Draw(wxPoint2DDouble translation, double scale) const { glLineWidth(1.0); @@ -36,7 +34,7 @@ void Exponential::Draw(wxPoint2DDouble translation, double scale) const axis.push_back(m_position + wxPoint2DDouble(-13, -13)); axis.push_back(m_position + wxPoint2DDouble(-13, 13)); DrawLine(axis, GL_LINES); - + glLineWidth(2.0); std::vector<wxPoint2DDouble> expSymbol; expSymbol.push_back(m_position + wxPoint2DDouble(-13, 13)); @@ -57,6 +55,12 @@ void Exponential::Draw(wxPoint2DDouble translation, double scale) const bool Exponential::ShowForm(wxWindow* parent, Element* element) { + ExponentialForm* form = new ExponentialForm(parent, this); + if(form->ShowModal() == wxID_OK) { + form->Destroy(); + return true; + } + form->Destroy(); return false; } @@ -95,3 +99,15 @@ void Exponential::UpdatePoints() m_nodeList[1]->SetPosition(m_position + wxPoint2DDouble(0, -18)); } } + +double Exponential::GetValues(double& aValue, double& bValue) +{ + aValue = m_aValue; + bValue = m_bValue; +} + +void Exponential::SetValues(double aValue, double bValue) +{ + m_aValue = aValue; + m_bValue = bValue; +} diff --git a/Project/Exponential.h b/Project/Exponential.h index c8117c0..d1744f5 100644 --- a/Project/Exponential.h +++ b/Project/Exponential.h @@ -3,6 +3,8 @@ #include "ControlElement.h" +class ExponentialForm; + class Exponential : public ControlElement { public: @@ -16,6 +18,13 @@ public: virtual void Rotate(bool clockwise = true); virtual void UpdatePoints(); + + virtual double GetValues(double& aValue, double &bValue); + virtual void SetValues(double aValue, double bValue); + +protected: + double m_aValue = 0.001; + double m_bValue = 5.0; }; diff --git a/Project/ExponentialForm.cpp b/Project/ExponentialForm.cpp new file mode 100644 index 0000000..a2b487a --- /dev/null +++ b/Project/ExponentialForm.cpp @@ -0,0 +1,44 @@ +#include "ExponentialForm.h" +#include "Exponential.h" + +ExponentialForm::ExponentialForm(wxWindow* parent, Exponential* exponential) : ExponentialFormBase(parent) +{ + wxString expSymbol = wxString::FromUTF8("\xF0\x9D\x91\x92"); + wxString superscriptCapitalB = wxString::FromUTF8("\xE1\xB4\xAE"); + wxString superscriptSmallX = wxString::FromUTF8("\xCB\xA3"); + m_staticTextExp->SetLabel("y = A" + expSymbol + superscriptCapitalB + superscriptSmallX); + + wxFont font = wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT); + font.SetPointSize(14); + m_staticTextExp->SetFont(font); + + m_parent = parent; + m_exponential = exponential; + + double a, b; + m_exponential->GetValues(a, b); + m_textCtrlAValue->SetValue(m_exponential->StringFromDouble(a)); + m_textCtrlBValue->SetValue(m_exponential->StringFromDouble(b)); + + SetInitialSize(); + Layout(); +} + +ExponentialForm::~ExponentialForm() {} +void ExponentialForm::OnOKButtonClick(wxCommandEvent& event) +{ + if(ValidateData()) EndModal(wxID_OK); +} + +bool ExponentialForm::ValidateData() +{ + double a, b; + if(!m_exponential->DoubleFromString(this, m_textCtrlAValue->GetValue(), a, + _("Value entered incorrectly in the field \"A value\"."))) + return false; + if(!m_exponential->DoubleFromString(this, m_textCtrlBValue->GetValue(), b, + _("Value entered incorrectly in the field \"B value\"."))) + return false; + m_exponential->SetValues(a, b); + return true; +} diff --git a/Project/ExponentialForm.h b/Project/ExponentialForm.h new file mode 100644 index 0000000..c53ef9f --- /dev/null +++ b/Project/ExponentialForm.h @@ -0,0 +1,21 @@ +#ifndef EXPONENTIALFORM_H +#define EXPONENTIALFORM_H +#include "ElementForm.h" + +class Exponential; + +class ExponentialForm : public ExponentialFormBase +{ + public: + ExponentialForm(wxWindow* parent, Exponential* exponential); + virtual ~ExponentialForm(); + virtual bool ValidateData(); + + protected: + virtual void OnCancelButtonClick(wxCommandEvent& event) { EndModal(wxID_CANCEL); } + virtual void OnOKButtonClick(wxCommandEvent& event); + + wxWindow* m_parent = NULL; + Exponential* m_exponential = NULL; +}; +#endif // EXPONENTIALFORM_H diff --git a/Project/Project.mk b/Project/Project.mk index 7272baa..ae6aceb 100644 --- a/Project/Project.mk +++ b/Project/Project.mk @@ -13,7 +13,7 @@ CurrentFileName := CurrentFilePath := CurrentFileFullPath := User :=NDSE-69 -Date :=31/03/2017 +Date :=01/04/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,9 +68,9 @@ 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)/Limiter.cpp$(ObjectSuffix) $(IntermediateDirectory)/RateLimiter.cpp$(ObjectSuffix) $(IntermediateDirectory)/Exponential.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) \ - + $(IntermediateDirectory)/ConnectionLine.cpp$(ObjectSuffix) $(IntermediateDirectory)/Sum.cpp$(ObjectSuffix) $(IntermediateDirectory)/Multiplier.cpp$(ObjectSuffix) $(IntermediateDirectory)/Limiter.cpp$(ObjectSuffix) $(IntermediateDirectory)/RateLimiter.cpp$(ObjectSuffix) $(IntermediateDirectory)/Exponential.cpp$(ObjectSuffix) $(IntermediateDirectory)/Constant.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) $(IntermediateDirectory)/ExponentialForm.cpp$(ObjectSuffix) $(IntermediateDirectory)/ConstantForm.cpp$(ObjectSuffix) @@ -463,6 +463,14 @@ $(IntermediateDirectory)/Exponential.cpp$(DependSuffix): Exponential.cpp $(IntermediateDirectory)/Exponential.cpp$(PreprocessSuffix): Exponential.cpp $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/Exponential.cpp$(PreprocessSuffix) Exponential.cpp +$(IntermediateDirectory)/Constant.cpp$(ObjectSuffix): Constant.cpp $(IntermediateDirectory)/Constant.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "C:/Users/NDSE-69/Documents/GitHub/PSP/Project/Constant.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/Constant.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/Constant.cpp$(DependSuffix): Constant.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/Constant.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/Constant.cpp$(DependSuffix) -MM Constant.cpp + +$(IntermediateDirectory)/Constant.cpp$(PreprocessSuffix): Constant.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/Constant.cpp$(PreprocessSuffix) Constant.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 @@ -575,6 +583,22 @@ $(IntermediateDirectory)/RateLimiterForm.cpp$(DependSuffix): RateLimiterForm.cpp $(IntermediateDirectory)/RateLimiterForm.cpp$(PreprocessSuffix): RateLimiterForm.cpp $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/RateLimiterForm.cpp$(PreprocessSuffix) RateLimiterForm.cpp +$(IntermediateDirectory)/ExponentialForm.cpp$(ObjectSuffix): ExponentialForm.cpp $(IntermediateDirectory)/ExponentialForm.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "C:/Users/NDSE-69/Documents/GitHub/PSP/Project/ExponentialForm.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/ExponentialForm.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/ExponentialForm.cpp$(DependSuffix): ExponentialForm.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/ExponentialForm.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/ExponentialForm.cpp$(DependSuffix) -MM ExponentialForm.cpp + +$(IntermediateDirectory)/ExponentialForm.cpp$(PreprocessSuffix): ExponentialForm.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/ExponentialForm.cpp$(PreprocessSuffix) ExponentialForm.cpp + +$(IntermediateDirectory)/ConstantForm.cpp$(ObjectSuffix): ConstantForm.cpp $(IntermediateDirectory)/ConstantForm.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "C:/Users/NDSE-69/Documents/GitHub/PSP/Project/ConstantForm.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/ConstantForm.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/ConstantForm.cpp$(DependSuffix): ConstantForm.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/ConstantForm.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/ConstantForm.cpp$(DependSuffix) -MM ConstantForm.cpp + +$(IntermediateDirectory)/ConstantForm.cpp$(PreprocessSuffix): ConstantForm.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/ConstantForm.cpp$(PreprocessSuffix) ConstantForm.cpp + -include $(IntermediateDirectory)/*$(DependSuffix) ## diff --git a/Project/Project.project b/Project/Project.project index f7eb8d6..3c97ad7 100644 --- a/Project/Project.project +++ b/Project/Project.project @@ -45,6 +45,7 @@ <File Name="Limiter.cpp"/> <File Name="RateLimiter.cpp"/> <File Name="Exponential.cpp"/> + <File Name="Constant.cpp"/> </VirtualDirectory> </VirtualDirectory> <VirtualDirectory Name="view"> @@ -76,6 +77,8 @@ <File Name="SumForm.cpp"/> <File Name="LimiterForm.cpp"/> <File Name="RateLimiterForm.cpp"/> + <File Name="ExponentialForm.cpp"/> + <File Name="ConstantForm.cpp"/> </VirtualDirectory> </VirtualDirectory> <File Name="main.cpp"/> @@ -123,6 +126,7 @@ <File Name="Limiter.h"/> <File Name="RateLimiter.h"/> <File Name="Exponential.h"/> + <File Name="Constant.h"/> </VirtualDirectory> </VirtualDirectory> <VirtualDirectory Name="view"> @@ -154,6 +158,8 @@ <File Name="SumForm.h"/> <File Name="LimiterForm.h"/> <File Name="RateLimiterForm.h"/> + <File Name="ExponentialForm.h"/> + <File Name="ConstantForm.h"/> </VirtualDirectory> </VirtualDirectory> </VirtualDirectory> diff --git a/Project/Project.txt b/Project/Project.txt index b780dc5..6706672 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/Limiter.cpp.o ./Release/RateLimiter.cpp.o ./Release/Exponential.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 +./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/Exponential.cpp.o ./Release/Constant.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 ./Release/ExponentialForm.cpp.o ./Release/ConstantForm.cpp.o diff --git a/Project/TransferFunctionForm.cpp b/Project/TransferFunctionForm.cpp index 5814339..d71b28b 100644 --- a/Project/TransferFunctionForm.cpp +++ b/Project/TransferFunctionForm.cpp @@ -10,9 +10,7 @@ TransferFunctionForm::TransferFunctionForm(wxWindow* parent, TransferFunction* t } TransferFunctionForm::~TransferFunctionForm() {} - void TransferFunctionForm::OnCancelClick(wxCommandEvent& event) { EndModal(wxID_CANCEL); } - void TransferFunctionForm::OnOKClick(wxCommandEvent& event) { if(ValidateData()) EndModal(wxID_OK); @@ -51,10 +49,10 @@ bool TransferFunctionForm::ValidateData() while(num != "") { wxString rest; wxString strValue = num.BeforeFirst(' ', &rest); - num = rest; + num = rest; double value = 0; - if(!m_tf->DoubleFromString( - this, strValue, value, _("Value entered incorrectly in the field \"Numerator parameters\"."))) + if(!m_tf->DoubleFromString(this, strValue, value, + _("Value entered incorrectly in the field \"Numerator parameters\"."))) return false; numerator.push_back(value); } @@ -66,8 +64,8 @@ bool TransferFunctionForm::ValidateData() wxString strValue = den.BeforeFirst(' ', &rest); den = rest; double value = 0; - if(!m_tf->DoubleFromString( - this, strValue, value, _("Value entered incorrectly in the field \"Denominator parameters\"."))) + if(!m_tf->DoubleFromString(this, strValue, value, + _("Value entered incorrectly in the field \"Denominator parameters\"."))) return false; denominator.push_back(value); } |