From 7aed88dbcf9d37a1f40c8cad115f055c4d69e7a9 Mon Sep 17 00:00:00 2001 From: Thales1330 Date: Thu, 29 Dec 2016 19:03:16 -0200 Subject: Parent/child optimization implemented And others bugfixes. --- Project/Element.cpp | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'Project/Element.cpp') diff --git a/Project/Element.cpp b/Project/Element.cpp index 4de5ebd..85280d6 100644 --- a/Project/Element.cpp +++ b/Project/Element.cpp @@ -456,6 +456,23 @@ void Element::ReplaceParent(Element* oldParent, Element* newParent) } } +void Element::AddChild(Element* child) { m_childList.push_back(child); } + +void Element::RemoveChild(Element* child) +{ + for(auto it = m_childList.begin(); it != m_childList.end(); ++it) { + Element* element = *it; + if(element == child) m_childList.erase(it--); + } +} + +void Element::ReplaceChild(Element* oldChild, Element* newChild) +{ + for(int i = 0; i < (int)m_childList.size(); i++) { + if(m_childList[i] == oldChild) m_childList[i] = newChild; + } +} + void OpenGLColour::SetRGBA(GLdouble red, GLdouble green, GLdouble blue, GLdouble alpha) { rgba[0] = red; -- cgit From a1932eec23589ed67d824873b37de3e83a09cd24 Mon Sep 17 00:00:00 2001 From: Thales1330 Date: Tue, 3 Jan 2017 19:03:12 -0200 Subject: Text element optimizated, but buggy Element/parent search buggy --- Project/Element.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'Project/Element.cpp') diff --git a/Project/Element.cpp b/Project/Element.cpp index 85280d6..f0812d1 100644 --- a/Project/Element.cpp +++ b/Project/Element.cpp @@ -300,15 +300,15 @@ void Element::SetOnline(bool online) void Element::GeneralMenuItens(wxMenu& menu) { wxMenuItem* clockItem = new wxMenuItem(&menu, ID_ROTATE_CLOCK, _("Rotate clockwise")); - clockItem->SetBitmap(wxImage("data\\images\\menu\\rotateClock16.png")); + clockItem->SetBitmap(wxImage("..\\data\\images\\menu\\rotateClock16.png")); menu.Append(clockItem); wxMenuItem* counterClockItem = new wxMenuItem(&menu, ID_ROTATE_COUNTERCLOCK, _("Rotate counter-clockwise")); - counterClockItem->SetBitmap(wxImage("data\\images\\menu\\rotateCounterClock16.png")); + counterClockItem->SetBitmap(wxImage("..\\data\\images\\menu\\rotateCounterClock16.png")); menu.Append(counterClockItem); wxMenuItem* deleteItem = new wxMenuItem(&menu, ID_DELETE, _("Delete")); - deleteItem->SetBitmap(wxImage("data\\images\\menu\\delete16.png")); + deleteItem->SetBitmap(wxImage("..\\data\\images\\menu\\delete16.png")); menu.Append(deleteItem); } @@ -462,7 +462,10 @@ void Element::RemoveChild(Element* child) { for(auto it = m_childList.begin(); it != m_childList.end(); ++it) { Element* element = *it; - if(element == child) m_childList.erase(it--); + if(element == child){ + m_childList.erase(it); + break; + } } } -- cgit From b6f96ca48bc156898df79deba63d270b393fb150 Mon Sep 17 00:00:00 2001 From: Thales1330 Date: Thu, 5 Jan 2017 19:31:28 -0200 Subject: Text bugs fixed --- Project/Element.cpp | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'Project/Element.cpp') diff --git a/Project/Element.cpp b/Project/Element.cpp index f0812d1..53eaa26 100644 --- a/Project/Element.cpp +++ b/Project/Element.cpp @@ -462,10 +462,7 @@ void Element::RemoveChild(Element* child) { for(auto it = m_childList.begin(); it != m_childList.end(); ++it) { Element* element = *it; - if(element == child){ - m_childList.erase(it); - break; - } + if(element == child) m_childList.erase(it--); } } -- cgit