diff options
author | Thales Lima Oliveira <thaleslima.ufu@gmail.com> | 2017-05-29 20:51:26 -0300 |
---|---|---|
committer | Thales Lima Oliveira <thaleslima.ufu@gmail.com> | 2017-05-29 20:51:26 -0300 |
commit | 73eacaf08f695bb3261f072d82ba9fe88366f1c1 (patch) | |
tree | 5d64d62de311841204f0235abada38191564b27e /Project/ControlEditor.cpp | |
parent | 41c6ab0cac47046db7b7a3faf360c60944fd39b5 (diff) | |
download | PSP.git-73eacaf08f695bb3261f072d82ba9fe88366f1c1.tar.gz PSP.git-73eacaf08f695bb3261f072d82ba9fe88366f1c1.tar.xz PSP.git-73eacaf08f695bb3261f072d82ba9fe88366f1c1.zip |
Unit data and control import bugs fixed
Diffstat (limited to 'Project/ControlEditor.cpp')
-rw-r--r-- | Project/ControlEditor.cpp | 27 |
1 files changed, 15 insertions, 12 deletions
diff --git a/Project/ControlEditor.cpp b/Project/ControlEditor.cpp index 4ee12ac..c86477d 100644 --- a/Project/ControlEditor.cpp +++ b/Project/ControlEditor.cpp @@ -735,18 +735,7 @@ void ControlEditor::OnImportClick(wxCommandEvent& event) msgDialog.ShowModal(); } - // Get the highest id number - int majorElementID = 0; - for(auto it = m_elementList.begin(), itEnd = m_elementList.end(); it != itEnd; ++it) { - ControlElement* element = *it; - if(element->GetID() > majorElementID) majorElementID = element->GetID(); - } - for(auto it = m_connectionList.begin(), itEnd = m_connectionList.end(); it != itEnd; ++it) { - ConnectionLine* line = *it; - if(line->GetID() > majorElementID) majorElementID = line->GetID(); - } - m_lastElementID = ++majorElementID; - + SetLastElementID(); Redraw(); event.Skip(); } @@ -860,3 +849,17 @@ void ControlEditor::ConsolidateTexts() m_firstDraw = false; } } + +void ControlEditor::SetLastElementID() +{ + int id = 0; + for(auto it = m_elementList.begin(), itEnd = m_elementList.end(); it != itEnd; ++it) { + int elementID = (*it)->GetID(); + if(id < elementID) id = elementID; + } + for(auto it = m_connectionList.begin(), itEnd = m_connectionList.end(); it != itEnd; ++it) { + int elementID = (*it)->GetID(); + if(id < elementID) id = elementID; + } + m_lastElementID = ++id; +} |