diff options
Diffstat (limited to 'Project')
-rw-r--r-- | Project/ControlEditor.cpp | 21 | ||||
-rw-r--r-- | Project/ControlEditor.h | 1 | ||||
-rw-r--r-- | Project/ElementForm.cpp | 82 | ||||
-rw-r--r-- | Project/ElementForm.h | 24 | ||||
-rw-r--r-- | Project/ElementForm.wxcp | 705 | ||||
-rw-r--r-- | Project/Project.mk | 22 | ||||
-rw-r--r-- | Project/Project.project | 4 | ||||
-rw-r--r-- | Project/Project.txt | 2 | ||||
-rw-r--r-- | Project/Sum.cpp | 76 | ||||
-rw-r--r-- | Project/Sum.h | 24 | ||||
-rw-r--r-- | Project/SumForm.cpp | 14 | ||||
-rw-r--r-- | Project/SumForm.h | 18 |
12 files changed, 980 insertions, 13 deletions
diff --git a/Project/ControlEditor.cpp b/Project/ControlEditor.cpp index 4e04fb1..3638a42 100644 --- a/Project/ControlEditor.cpp +++ b/Project/ControlEditor.cpp @@ -4,6 +4,7 @@ #include "ControlElement.h" #include "TransferFunction.h" #include "ConnectionLine.h" +#include "Sum.h" ControlElementButton::ControlElementButton(wxWindow* parent, wxString label, wxImage image, wxWindowID id) : wxWindow(parent, id) @@ -102,6 +103,7 @@ ControlEditor::ControlEditor(wxWindow* parent) m_glContext = new wxGLContext(m_glCanvas); m_camera = new Camera(); m_selectionRect = wxRect2DDouble(0, 0, 0, 0); + //m_camera->SetScale(1.2); } ControlEditor::~ControlEditor() { @@ -203,7 +205,9 @@ void ControlEditor::AddElement(ControlElementButtonID id) m_elementList.push_back(tf); } break; case ID_SUM: { - wxLogMessage("sum"); + m_mode = MODE_INSERT; + Sum* sum = new Sum(); + m_elementList.push_back(sum); } break; case ID_CONST: { wxLogMessage("const"); @@ -389,11 +393,12 @@ void ControlEditor::OnLeftClickUp(wxMouseEvent& event) if(m_mode == MODE_INSERT_LINE && !foundNode && it != (itEnd - 1)) { if(cLine->Contains(m_camera->ScreenToWorld(event.GetPosition()))) { ConnectionLine* iLine = *(m_connectionList.end() - 1); - cLine->AddChild(iLine); - iLine->SetParentLine(cLine); - iLine->UpdatePoints(); - m_mode = MODE_EDIT; - foundNode = true; + if(iLine->SetParentLine(cLine)) { + cLine->AddChild(iLine); + iLine->UpdatePoints(); + m_mode = MODE_EDIT; + foundNode = true; + } } } else if(m_mode == MODE_SELECTION_RECT) { if(cLine->Intersects(m_selectionRect)) { @@ -639,7 +644,6 @@ std::vector<ConnectionLine*>::iterator ControlEditor::DeleteLineFromList(std::ve auto childList = cLine->GetLineChildList(); for(auto itC = childList.begin(), itEndC = childList.end(); itC != itEndC; ++itC) { ConnectionLine* child = *itC; - //child->GetParentLine()->RemoveChild(child); Error for(auto itL = m_connectionList.begin(); itL != m_connectionList.end(); ++itL) { ConnectionLine* childOnList = *itL; if(childOnList == child) { @@ -647,12 +651,13 @@ std::vector<ConnectionLine*>::iterator ControlEditor::DeleteLineFromList(std::ve } } } - wxMessageBox(wxString::Format("%d", (int)cLine->GetChildList().size())); + // Remove auto parentList = cLine->GetParentList(); for(auto itP = parentList.begin(), itEnd = parentList.end(); itP != itEnd; ++itP) { Element* parent = *itP; if(parent) parent->RemoveChild(cLine); } + if(cLine->GetParentLine()) cLine->GetParentLine()->RemoveChild(cLine); // Free nodes auto nodeList = cLine->GetNodeList(); for(auto itN = nodeList.begin(), itEndN = nodeList.end(); itN != itEndN; ++itN) { diff --git a/Project/ControlEditor.h b/Project/ControlEditor.h index 8d499fc..fd74d55 100644 --- a/Project/ControlEditor.h +++ b/Project/ControlEditor.h @@ -14,6 +14,7 @@ class Element; class ControlElement; class TransferFunction; class ConnectionLine; +class Sum; 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 27a120c..a718f26 100644 --- a/Project/ElementForm.cpp +++ b/Project/ElementForm.cpp @@ -2886,3 +2886,85 @@ TransferFunctionFormBase::~TransferFunctionFormBase() m_ButtonCancel->Disconnect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(TransferFunctionFormBase::OnCancelClick), NULL, this); } + +SumFormBase::SumFormBase(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_staticTextSigns = new wxStaticText(m_panelGeneral, wxID_ANY, _("Signs"), wxDefaultPosition, wxDLG_UNIT(m_panelGeneral, wxSize(-1,-1)), 0); + + boxSizerLvl2_1->Add(m_staticTextSigns, 0, wxLEFT|wxRIGHT|wxTOP|wxALIGN_CENTER_VERTICAL, WXC_FROM_DIP(5)); + + m_textCtrlSigns = new wxTextCtrl(m_panelGeneral, wxID_ANY, wxT(""), wxDefaultPosition, wxDLG_UNIT(m_panelGeneral, wxSize(-1,-1)), 0); + #if wxVERSION_NUMBER >= 3000 + m_textCtrlSigns->SetHint(wxT("")); + #endif + + boxSizerLvl2_1->Add(m_textCtrlSigns, 0, wxLEFT|wxRIGHT|wxBOTTOM|wxEXPAND|wxALIGN_CENTER_VERTICAL, WXC_FROM_DIP(5)); + m_textCtrlSigns->SetMinSize(wxSize(300,-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("SumFormBase")); + 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 +} + +SumFormBase::~SumFormBase() +{ +} diff --git a/Project/ElementForm.h b/Project/ElementForm.h index f7c9ebb..ed9d0b8 100644 --- a/Project/ElementForm.h +++ b/Project/ElementForm.h @@ -801,4 +801,28 @@ public: virtual ~TransferFunctionFormBase(); }; + +class SumFormBase : public wxDialog +{ +protected: + wxNotebook* m_notebook; + wxPanel* m_panelGeneral; + wxStaticText* m_staticTextSigns; + wxTextCtrl* m_textCtrlSigns; + wxButton* m_buttonOK; + wxButton* m_ButtonCancel; + +protected: + +public: + wxStaticText* GetStaticTextSigns() { return m_staticTextSigns; } + wxTextCtrl* GetTextCtrlSigns() { return m_textCtrlSigns; } + wxPanel* GetPanelGeneral() { return m_panelGeneral; } + wxNotebook* GetNotebook() { return m_notebook; } + wxButton* GetButtonOK() { return m_buttonOK; } + wxButton* GetButtonCancel() { return m_ButtonCancel; } + SumFormBase(wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Sum"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize(-1,-1), long style = wxDEFAULT_DIALOG_STYLE); + virtual ~SumFormBase(); +}; + #endif diff --git a/Project/ElementForm.wxcp b/Project/ElementForm.wxcp index 8a4f50d..d7cc05a 100644 --- a/Project/ElementForm.wxcp +++ b/Project/ElementForm.wxcp @@ -1,7 +1,7 @@ { "metadata": { "m_generatedFilesDir": ".", - "m_objCounter": 1628, + "m_objCounter": 1654, "m_includeFiles": [], "m_bitmapFunction": "wxC9EE9InitBitmapResources", "m_bitmapsFile": "ElementFormBitmaps.cpp", @@ -30213,5 +30213,708 @@ }] }] }] + }, { + "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": "SumFormBase" + }, { + "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": "Sum" + }, { + "type": "virtualFolderPicker", + "m_label": "Virtual Folder:", + "m_path": "Project:wxcrafter" + }, { + "type": "choice", + "m_label": "Centre:", + "m_selection": 1, + "m_options": ["", "wxBOTH", "wxVERTICAL", "wxHORIZONTAL"] + }, { + "type": "string", + "m_label": "Inherited Class", + "m_value": "SumForm" + }, { + "type": "string", + "m_label": "File:", + "m_value": "SumForm" + }, { + "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_staticTextSigns" + }, { + "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": "Signs" + }, { + "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": "300,-1" + }, { + "type": "string", + "m_label": "Name:", + "m_value": "m_textCtrlSigns" + }, { + "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_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_children": [] + }] + }] + }] }] }
\ No newline at end of file diff --git a/Project/Project.mk b/Project/Project.mk index 0518120..81349c0 100644 --- a/Project/Project.mk +++ b/Project/Project.mk @@ -13,7 +13,7 @@ CurrentFileName := CurrentFilePath := CurrentFileFullPath := User :=Thales -Date :=06/03/2017 +Date :=07/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)/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)/ConnectionLine.cpp$(ObjectSuffix) $(IntermediateDirectory)/Sum.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) @@ -422,6 +422,14 @@ $(IntermediateDirectory)/ConnectionLine.cpp$(DependSuffix): ConnectionLine.cpp $(IntermediateDirectory)/ConnectionLine.cpp$(PreprocessSuffix): ConnectionLine.cpp $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/ConnectionLine.cpp$(PreprocessSuffix) ConnectionLine.cpp +$(IntermediateDirectory)/Sum.cpp$(ObjectSuffix): Sum.cpp $(IntermediateDirectory)/Sum.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "C:/Users/Thales/Documents/GitHub/PSP/Project/Sum.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/Sum.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/Sum.cpp$(DependSuffix): Sum.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/Sum.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/Sum.cpp$(DependSuffix) -MM Sum.cpp + +$(IntermediateDirectory)/Sum.cpp$(PreprocessSuffix): Sum.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/Sum.cpp$(PreprocessSuffix) Sum.cpp + $(IntermediateDirectory)/BusForm.cpp$(ObjectSuffix): BusForm.cpp $(IntermediateDirectory)/BusForm.cpp$(DependSuffix) $(CXX) $(IncludePCH) $(SourceSwitch) "C:/Users/Thales/Documents/GitHub/PSP/Project/BusForm.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/BusForm.cpp$(ObjectSuffix) $(IncludePath) $(IntermediateDirectory)/BusForm.cpp$(DependSuffix): BusForm.cpp @@ -510,6 +518,14 @@ $(IntermediateDirectory)/TransferFunctionForm.cpp$(DependSuffix): TransferFuncti $(IntermediateDirectory)/TransferFunctionForm.cpp$(PreprocessSuffix): TransferFunctionForm.cpp $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/TransferFunctionForm.cpp$(PreprocessSuffix) TransferFunctionForm.cpp +$(IntermediateDirectory)/SumForm.cpp$(ObjectSuffix): SumForm.cpp $(IntermediateDirectory)/SumForm.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "C:/Users/Thales/Documents/GitHub/PSP/Project/SumForm.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/SumForm.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/SumForm.cpp$(DependSuffix): SumForm.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/SumForm.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/SumForm.cpp$(DependSuffix) -MM SumForm.cpp + +$(IntermediateDirectory)/SumForm.cpp$(PreprocessSuffix): SumForm.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/SumForm.cpp$(PreprocessSuffix) SumForm.cpp + -include $(IntermediateDirectory)/*$(DependSuffix) ## diff --git a/Project/Project.project b/Project/Project.project index aef8589..d757970 100644 --- a/Project/Project.project +++ b/Project/Project.project @@ -40,6 +40,7 @@ <File Name="ControlElement.cpp"/> <File Name="TransferFunction.cpp"/> <File Name="ConnectionLine.cpp"/> + <File Name="Sum.cpp"/> </VirtualDirectory> </VirtualDirectory> <VirtualDirectory Name="view"> @@ -68,6 +69,7 @@ <File Name="Camera.cpp"/> <VirtualDirectory Name="control element form"> <File Name="TransferFunctionForm.cpp"/> + <File Name="SumForm.cpp"/> </VirtualDirectory> </VirtualDirectory> <File Name="main.cpp"/> @@ -110,6 +112,7 @@ <File Name="ControlElement.h"/> <File Name="TransferFunction.h"/> <File Name="ConnectionLine.h"/> + <File Name="Sum.h"/> </VirtualDirectory> </VirtualDirectory> <VirtualDirectory Name="view"> @@ -138,6 +141,7 @@ <File Name="Camera.h"/> <VirtualDirectory Name="control element form"> <File Name="TransferFunctionForm.h"/> + <File Name="SumForm.h"/> </VirtualDirectory> </VirtualDirectory> </VirtualDirectory> diff --git a/Project/Project.txt b/Project/Project.txt index ab4e960..83f4caa 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/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/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/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 diff --git a/Project/Sum.cpp b/Project/Sum.cpp new file mode 100644 index 0000000..e0951db --- /dev/null +++ b/Project/Sum.cpp @@ -0,0 +1,76 @@ +#include "Sum.h" +#include "SumForm.h" + +Sum::Sum() + : 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); + nodeIn1->StartMove(m_position); + Node* nodeIn2 = + new Node(m_position + wxPoint2DDouble(-m_width / 2, 27 - m_height / 2), 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); + nodeOut->SetAngle(180.0); + nodeOut->StartMove(m_position); + m_nodeList.push_back(nodeIn1); + m_nodeList.push_back(nodeIn2); + m_nodeList.push_back(nodeOut); + m_signalList.push_back(SIGNAL_POSITIVE); + m_signalList.push_back(SIGNAL_NEGATIVE); +} + +Sum::~Sum() {} + +void Sum::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 signals. + glLineWidth(2.0); + for(int i = 0; i < (int)m_nodeList.size() - 1; ++i) { + std::vector<wxPoint2DDouble> hLine; + hLine.push_back(m_nodeList[i]->GetPosition() + wxPoint2DDouble(6, 0)); + hLine.push_back(m_nodeList[i]->GetPosition() + wxPoint2DDouble(12, 0)); + DrawLine(hLine); + if(m_signalList[i] == SIGNAL_POSITIVE) { + std::vector<wxPoint2DDouble> vLine; + vLine.push_back(m_nodeList[i]->GetPosition() + wxPoint2DDouble(9, -3)); + vLine.push_back(m_nodeList[i]->GetPosition() + wxPoint2DDouble(9, 3)); + DrawLine(vLine); + } + } + + //Plot sigma. + std::vector<wxPoint2DDouble> sigma; + sigma.push_back(m_position + wxPoint2DDouble(10, 9)); + sigma.push_back(m_position + wxPoint2DDouble(0, 9)); + sigma.push_back(m_position + wxPoint2DDouble(6, 0)); + sigma.push_back(m_position + wxPoint2DDouble(0, -9)); + sigma.push_back(m_position + wxPoint2DDouble(10, -9)); + glColor4d(0.0, 0.3, 1.0, 1.0); + DrawLine(sigma); + + glColor4d(0.0, 0.0, 0.0, 1.0); + DrawNodes(); +} + +bool Sum::ShowForm(wxWindow* parent, Element* element) +{ + SumForm* sumForm = new SumForm(parent, this); + if(sumForm->ShowModal() == wxID_OK) { + sumForm->Destroy(); + return true; + } + sumForm->Destroy(); + return false; +} diff --git a/Project/Sum.h b/Project/Sum.h new file mode 100644 index 0000000..682effb --- /dev/null +++ b/Project/Sum.h @@ -0,0 +1,24 @@ +#ifndef SUM_H +#define SUM_H + +#include "ControlElement.h" + +class SumForm; + +class Sum : public ControlElement +{ +public: + enum Signal { SIGNAL_POSITIVE = 0, SIGNAL_NEGATIVE }; + Sum(); + ~Sum(); + + 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); + +protected: + std::vector<Signal> m_signalList; +}; + +#endif // SUM_H diff --git a/Project/SumForm.cpp b/Project/SumForm.cpp new file mode 100644 index 0000000..d257771 --- /dev/null +++ b/Project/SumForm.cpp @@ -0,0 +1,14 @@ +#include "SumForm.h" +#include "Sum.h" + +SumForm::SumForm(wxWindow* parent, Sum* sum) + : SumFormBase(parent) +{ + m_parent = parent; + m_sum = sum; +} + +SumForm::~SumForm() +{ +} + diff --git a/Project/SumForm.h b/Project/SumForm.h new file mode 100644 index 0000000..11d9a51 --- /dev/null +++ b/Project/SumForm.h @@ -0,0 +1,18 @@ +#ifndef SUMFORM_H +#define SUMFORM_H + +#include "ElementForm.h" + +class Sum; + +class SumForm : public SumFormBase +{ +public: + SumForm(wxWindow* parent, Sum* sum); + virtual ~SumForm(); + +protected: + wxWindow* m_parent = NULL; + Sum* m_sum = NULL; +}; +#endif // SUMFORM_H |