diff --git a/jni/widgetDrawer.cpp b/jni/widgetDrawer.cpp index 42be9a4..884e3a0 100644 --- a/jni/widgetDrawer.cpp +++ b/jni/widgetDrawer.cpp @@ -27,6 +27,7 @@ #include #include +#include "tinyXML/tinyxml.h" #include #include @@ -398,4 +399,71 @@ void widgetDrawer::SetColorOnSelected(color_ts newColor) } } MarkToReedraw(); -} \ No newline at end of file +} + + +void widgetDrawer::Load(etk::UString fileName) +{ + DRAW_TODO("LATER ... "); +} +/* + + + + + + + + + +*/ +void widgetDrawer::Save(etk::UString fileName) +{ + TiXmlDocument doc; + TiXmlDeclaration * decl = new TiXmlDeclaration( "1.0", "UTF-8", "" ); + doc.LinkEndChild( decl ); + TiXmlElement * mastertElement = new TiXmlElement( "e2d" ); + mastertElement->SetAttribute( "version", "0.1" ); + doc.LinkEndChild( mastertElement ); + + TiXmlElement * element = new TiXmlElement( "element" ); + element->SetAttribute( "name", "???" ); + mastertElement->LinkEndChild( element ); + + for(int32_t iii=0; iiiSetAttribute( "id", iii ); + elementDot->SetAttribute( "x", m_dotList[iii].x ); + elementDot->SetAttribute( "y", m_dotList[iii].y ); + element->LinkEndChild( elementDot ); + } + for(int32_t iii=0; iiiSetAttribute( "id1", m_linkList[iii].dot[0] ); + char colorText[256]; + sprintf(colorText, "#%02X%02X%02X%02X", + (uint8_t)(m_linkList[iii].color[0].red * 0xFF), + (uint8_t)(m_linkList[iii].color[0].green * 0xFF), + (uint8_t)(m_linkList[iii].color[0].blue * 0xFF), + (uint8_t)(m_linkList[iii].color[0].alpha * 0xFF)); + elementDot->SetAttribute( "color1", colorText ); + elementDot->SetAttribute( "id2", m_linkList[iii].dot[1] ); + sprintf(colorText, "#%02X%02X%02X%02X", + (uint8_t)(m_linkList[iii].color[1].red * 0xFF), + (uint8_t)(m_linkList[iii].color[1].green * 0xFF), + (uint8_t)(m_linkList[iii].color[1].blue * 0xFF), + (uint8_t)(m_linkList[iii].color[1].alpha * 0xFF)); + elementDot->SetAttribute( "color2", colorText ); + elementDot->SetAttribute( "id3", m_linkList[iii].dot[2] ); + sprintf(colorText, "#%02X%02X%02X%02X", + (uint8_t)(m_linkList[iii].color[2].red * 0xFF), + (uint8_t)(m_linkList[iii].color[2].green * 0xFF), + (uint8_t)(m_linkList[iii].color[2].blue * 0xFF), + (uint8_t)(m_linkList[iii].color[2].alpha * 0xFF)); + elementDot->SetAttribute( "color3", colorText ); + element->LinkEndChild( elementDot ); + } +} + diff --git a/jni/widgetDrawer.h b/jni/widgetDrawer.h index da35a33..2859af9 100644 --- a/jni/widgetDrawer.h +++ b/jni/widgetDrawer.h @@ -98,6 +98,8 @@ class widgetDrawer :public ewol::Widget int32_t GetNearestPoint(coord2D_ts pos); etkFloat_t QuadDistance(coord2D_ts aaa, coord2D_ts bbb); bool DotIsSelected(int32_t dotId); + void Load(etk::UString fileName); + void Save(etk::UString fileName); }; #endif