[DEV] port for exml
This commit is contained in:
parent
12c2831a20
commit
8a159b8ca3
2
external/etk
vendored
2
external/etk
vendored
@ -1 +1 @@
|
|||||||
Subproject commit c90b9d1b3986f21cbd2a3f0a3ad8f12ab1df3bd1
|
Subproject commit 2cac9e69dd5c890ad403e62ecae5e48da2a6d027
|
2
external/parsersvg
vendored
2
external/parsersvg
vendored
@ -1 +1 @@
|
|||||||
Subproject commit 4c0e4fb83626a3ce7c494e2beb1e0733a42be25e
|
Subproject commit 7081b72812e2e9e9603bd2d37dae5acae5b2c827
|
@ -11,6 +11,7 @@
|
|||||||
#include <ewol/eObject/EObjectManager.h>
|
#include <ewol/eObject/EObjectManager.h>
|
||||||
#include <etk/os/FSNode.h>
|
#include <etk/os/FSNode.h>
|
||||||
#include <ewol/debug.h>
|
#include <ewol/debug.h>
|
||||||
|
#include <exml/Declaration.h>
|
||||||
|
|
||||||
class UserConfig : public ewol::EObject
|
class UserConfig : public ewol::EObject
|
||||||
{
|
{
|
||||||
@ -95,67 +96,43 @@ void ewol::userConfig::SetConfigName(const etk::UString& _fileName)
|
|||||||
|
|
||||||
bool ewol::userConfig::Load(void)
|
bool ewol::userConfig::Load(void)
|
||||||
{
|
{
|
||||||
etk::FSNode file(l_obj().FileName());
|
|
||||||
if (file.Exist()==false) {
|
|
||||||
EWOL_ERROR("Can not load the file : " << l_obj().FileName());
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
// allocate the document in the stack
|
// allocate the document in the stack
|
||||||
TiXmlDocument XmlDocument;
|
exml::Document doc;
|
||||||
int32_t fileSize = file.FileSize();
|
if (false == doc.Load(l_obj().FileName())) {
|
||||||
if (0==fileSize) {
|
EWOL_ERROR("Error occured when loading XML : " << l_obj().FileName());
|
||||||
EWOL_ERROR("This file is empty : " << file);
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (false == file.FileOpenRead()) {
|
if (0 == doc.Size() ) {
|
||||||
EWOL_ERROR("Can not open the file : " << file);
|
EWOL_ERROR("(l ?) No nodes in the xml file ... \"" << l_obj().FileName() << "\"");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
// allocate data
|
exml::Element* root = (exml::Element*)doc.GetNamed("config");
|
||||||
char * fileBuffer = new char[fileSize+5];
|
|
||||||
if (NULL == fileBuffer) {
|
|
||||||
EWOL_ERROR("Error Memory allocation size=" << fileSize);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
memset(fileBuffer, 0, (fileSize+5)*sizeof(char));
|
|
||||||
// load data from the file :
|
|
||||||
file.FileRead(fileBuffer, 1, fileSize);
|
|
||||||
// close the file:
|
|
||||||
file.FileClose();
|
|
||||||
// load the XML from the memory
|
|
||||||
XmlDocument.Parse((const char*)fileBuffer, 0, TIXML_ENCODING_UTF8);
|
|
||||||
|
|
||||||
TiXmlElement* root = XmlDocument.FirstChildElement("config");
|
|
||||||
if (NULL == root ) {
|
if (NULL == root ) {
|
||||||
EWOL_ERROR("(l ?) main node not find: \"config\" in \"" << file << "\"");
|
EWOL_ERROR("(l ?) main node not find: \"config\" in \"" << l_obj().FileName() << "\"");
|
||||||
if (NULL != fileBuffer) {
|
|
||||||
delete[] fileBuffer;
|
|
||||||
}
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
for(TiXmlNode * pNode = root->FirstChild();
|
for(int32_t iii=0; iii< root->Size(); iii++) {
|
||||||
NULL != pNode;
|
exml::Node* child = root->Get(iii);
|
||||||
pNode = pNode->NextSibling() ) {
|
if (child==NULL) {
|
||||||
if (pNode->Type()==TiXmlNode::TINYXML_COMMENT) {
|
continue;
|
||||||
|
}
|
||||||
|
if (!child->IsElement()) {
|
||||||
// nothing to do, just proceed to next step
|
// nothing to do, just proceed to next step
|
||||||
} else {
|
continue;
|
||||||
bool elementFound = false;
|
}
|
||||||
for (int32_t iii=0; iii<l_obj().List().Size() ; iii++) {
|
bool elementFound = false;
|
||||||
if (l_obj().List()[iii] != NULL) {
|
for (int32_t iii=0; iii<l_obj().List().Size() ; iii++) {
|
||||||
if (l_obj().List()[iii]->GetName() == pNode->Value()) {
|
if (l_obj().List()[iii] != NULL) {
|
||||||
l_obj().List()[iii]->LoadXML(pNode);
|
if (l_obj().List()[iii]->GetName() == child->GetValue()) {
|
||||||
elementFound = true;
|
l_obj().List()[iii]->LoadXML((exml::Element*)child);
|
||||||
break;
|
elementFound = true;
|
||||||
}
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (elementFound==false) {
|
|
||||||
EWOL_ERROR("(l "<<pNode->Row()<<") node not suported : \""<<pNode->Value());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
if (elementFound==false) {
|
||||||
if (NULL != fileBuffer) {
|
EWOL_ERROR("(l "<<child->Pos()<<") node not suported : \""<<child->GetValue());
|
||||||
delete[] fileBuffer;
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -174,31 +151,26 @@ bool ewol::userConfig::Save(void)
|
|||||||
if (true==etk::FSNodeExist(l_obj().FileName()) ) {
|
if (true==etk::FSNodeExist(l_obj().FileName()) ) {
|
||||||
etk::FSNodeMove(l_obj().FileName(),l_obj().FileName()+"-1");
|
etk::FSNodeMove(l_obj().FileName(),l_obj().FileName()+"-1");
|
||||||
}
|
}
|
||||||
// basic create file:
|
exml::Document doc;
|
||||||
etk::FSNode myNode(l_obj().FileName());
|
doc.Append(new exml::Declaration("1.0", "UTF-8", ""));
|
||||||
// create basic folders ...
|
exml::Element * ElementBase = new exml::Element("config");
|
||||||
myNode.Touch();
|
doc.Append(ElementBase);
|
||||||
etk::UString tmpCompleateName = myNode.GetFileSystemName();
|
|
||||||
// step 2 : save the file
|
|
||||||
TiXmlDocument doc;
|
|
||||||
TiXmlDeclaration * decl = new TiXmlDeclaration("1.0", "UTF-8", "");
|
|
||||||
doc.LinkEndChild(decl);
|
|
||||||
TiXmlElement * ElementBase = new TiXmlElement("config");
|
|
||||||
doc.LinkEndChild(ElementBase);
|
|
||||||
for (int32_t iii=0; iii<l_obj().List().Size() ; iii++) {
|
for (int32_t iii=0; iii<l_obj().List().Size() ; iii++) {
|
||||||
if (l_obj().List()[iii] != NULL) {
|
if (l_obj().List()[iii] == NULL) {
|
||||||
if (l_obj().List()[iii]->GetName().Size() != 0) {
|
continue;
|
||||||
TiXmlElement * element = new TiXmlElement(l_obj().List()[iii]->GetName().c_str());
|
}
|
||||||
if (NULL != element) {
|
if (l_obj().List()[iii]->GetName().Size() == 0) {
|
||||||
l_obj().List()[iii]->StoreXML(element);
|
continue;
|
||||||
ElementBase->LinkEndChild(element);
|
}
|
||||||
}
|
exml::Element* element = new exml::Element(l_obj().List()[iii]->GetName());
|
||||||
}
|
if (NULL != element) {
|
||||||
|
l_obj().List()[iii]->StoreXML(element);
|
||||||
|
ElementBase->Append(element);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//Save Document
|
//Save Document
|
||||||
doc.SaveFile( tmpCompleateName.c_str() );
|
doc.Store(l_obj().FileName());
|
||||||
EWOL_DEBUG("Save in file : " << tmpCompleateName);
|
EWOL_DEBUG("Save in file : " << l_obj().FileName());
|
||||||
// step 3 : Remove oldest save
|
// step 3 : Remove oldest save
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -6,8 +6,6 @@
|
|||||||
* @license BSD v3 (see license file)
|
* @license BSD v3 (see license file)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <tinyXML/tinyxml.h>
|
|
||||||
|
|
||||||
#include <ewol/debug.h>
|
#include <ewol/debug.h>
|
||||||
#include <ewol/compositing/Area.h>
|
#include <ewol/compositing/Area.h>
|
||||||
#include <ewol/config.h>
|
#include <ewol/config.h>
|
||||||
|
@ -6,8 +6,6 @@
|
|||||||
* @license BSD v3 (see license file)
|
* @license BSD v3 (see license file)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <tinyXML/tinyxml.h>
|
|
||||||
|
|
||||||
#include <ewol/debug.h>
|
#include <ewol/debug.h>
|
||||||
#include <ewol/compositing/Image.h>
|
#include <ewol/compositing/Image.h>
|
||||||
#include <ewol/config.h>
|
#include <ewol/config.h>
|
||||||
|
@ -6,8 +6,6 @@
|
|||||||
* @license BSD v3 (see license file)
|
* @license BSD v3 (see license file)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <tinyXML/tinyxml.h>
|
|
||||||
|
|
||||||
#include <etk/os/FSNode.h>
|
#include <etk/os/FSNode.h>
|
||||||
#include <ewol/debug.h>
|
#include <ewol/debug.h>
|
||||||
#include <ewol/compositing/Shaper.h>
|
#include <ewol/compositing/Shaper.h>
|
||||||
|
@ -6,8 +6,6 @@
|
|||||||
* @license BSD v3 (see license file)
|
* @license BSD v3 (see license file)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <tinyXML/tinyxml.h>
|
|
||||||
|
|
||||||
#include <ewol/debug.h>
|
#include <ewol/debug.h>
|
||||||
#include <ewol/compositing/Sprite.h>
|
#include <ewol/compositing/Sprite.h>
|
||||||
#include <ewol/config.h>
|
#include <ewol/config.h>
|
||||||
|
@ -6,8 +6,6 @@
|
|||||||
* @license BSD v3 (see license file)
|
* @license BSD v3 (see license file)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <tinyXML/tinyxml.h>
|
|
||||||
|
|
||||||
#include <ewol/debug.h>
|
#include <ewol/debug.h>
|
||||||
#include <ewol/compositing/Text.h>
|
#include <ewol/compositing/Text.h>
|
||||||
#include <ewol/config.h>
|
#include <ewol/config.h>
|
||||||
@ -436,41 +434,50 @@ void ewol::Text::Print(const etk::UString& _text)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void ewol::Text::ParseHtmlNode(void* _element2)
|
void ewol::Text::ParseHtmlNode(exml::Element* _element)
|
||||||
{
|
{
|
||||||
// get the static real pointer
|
// get the static real pointer
|
||||||
TiXmlNode* element = static_cast<TiXmlNode*>(_element2);
|
if (NULL == _element) {
|
||||||
if (NULL == element) {
|
|
||||||
EWOL_ERROR( "Error Input node does not existed ...");
|
EWOL_ERROR( "Error Input node does not existed ...");
|
||||||
}
|
}
|
||||||
for( TiXmlNode * child = element->FirstChild() ;
|
for(int32_t iii=0; iii< _element->Size(); iii++) {
|
||||||
NULL != child ;
|
exml::Node* child = _element->Get(iii);
|
||||||
child = child->NextSibling() ) {
|
if (child==NULL) {
|
||||||
if (child->Type()==TiXmlNode::TINYXML_COMMENT) {
|
continue;
|
||||||
|
}
|
||||||
|
if (child->GetType()==exml::typeComment) {
|
||||||
// nothing to do ...
|
// nothing to do ...
|
||||||
} else if (child->Type()==TiXmlNode::TINYXML_TEXT) {
|
} else if (child->GetType()==exml::typeText) {
|
||||||
HtmlAddData(child->Value() );
|
HtmlAddData(child->GetValue() );
|
||||||
EWOL_VERBOSE("XML Add : " << child->Value());
|
EWOL_VERBOSE("XML Add : " << child->GetValue());
|
||||||
} else if( !strcmp(child->Value(), "br")
|
} else if (child->GetType()!=exml::typeElement) {
|
||||||
|| !strcmp(child->Value(), "BR")) {
|
EWOL_ERROR("(l "<< child->Pos() << ") node not suported type : " << child->GetType() << " val=\""<< child->GetValue() << "\"" );
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
exml::Element* elem = (exml::Element*)child;
|
||||||
|
if (elem==NULL) {
|
||||||
|
EWOL_ERROR("Cast error ...");
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if(true==elem->GetValue().CompareNoCase("br")) {
|
||||||
HtmlFlush();
|
HtmlFlush();
|
||||||
EWOL_VERBOSE("XML flush & newLine");
|
EWOL_VERBOSE("XML flush & newLine");
|
||||||
ForceLineReturn();
|
ForceLineReturn();
|
||||||
} else if (!strcmp(child->Value(), "font")) {
|
} else if (true==elem->GetValue().CompareNoCase("font")) {
|
||||||
EWOL_VERBOSE("XML Font ...");
|
EWOL_VERBOSE("XML Font ...");
|
||||||
TextDecoration tmpDeco = m_htmlDecoTmp;
|
TextDecoration tmpDeco = m_htmlDecoTmp;
|
||||||
const char *colorValue = child->ToElement()->Attribute("color");
|
etk::UString colorValue = elem->GetAttribute("color");
|
||||||
if (NULL != colorValue) {
|
if (colorValue.Size()!=0) {
|
||||||
draw::ParseColor(colorValue, m_htmlDecoTmp.m_colorFg);
|
draw::ParseColor(colorValue.c_str(), m_htmlDecoTmp.m_colorFg);
|
||||||
}
|
}
|
||||||
colorValue = child->ToElement()->Attribute("colorBg");
|
colorValue = elem->GetAttribute("colorBg");
|
||||||
if (NULL != colorValue) {
|
if (colorValue.Size()!=0) {
|
||||||
draw::ParseColor(colorValue, m_htmlDecoTmp.m_colorBg);
|
draw::ParseColor(colorValue.c_str(), m_htmlDecoTmp.m_colorBg);
|
||||||
}
|
}
|
||||||
ParseHtmlNode(child);
|
ParseHtmlNode(elem);
|
||||||
m_htmlDecoTmp = tmpDeco;
|
m_htmlDecoTmp = tmpDeco;
|
||||||
} else if( !strcmp(child->Value(), "b")
|
} else if( true==elem->GetValue().CompareNoCase("b")
|
||||||
|| !strcmp(child->Value(), "bold")) {
|
|| true==elem->GetValue().CompareNoCase("bold")) {
|
||||||
EWOL_VERBOSE("XML bold ...");
|
EWOL_VERBOSE("XML bold ...");
|
||||||
TextDecoration tmpDeco = m_htmlDecoTmp;
|
TextDecoration tmpDeco = m_htmlDecoTmp;
|
||||||
if (m_htmlDecoTmp.m_mode == ewol::font::Regular) {
|
if (m_htmlDecoTmp.m_mode == ewol::font::Regular) {
|
||||||
@ -478,10 +485,10 @@ void ewol::Text::ParseHtmlNode(void* _element2)
|
|||||||
} else if (m_htmlDecoTmp.m_mode == ewol::font::Italic) {
|
} else if (m_htmlDecoTmp.m_mode == ewol::font::Italic) {
|
||||||
m_htmlDecoTmp.m_mode = ewol::font::BoldItalic;
|
m_htmlDecoTmp.m_mode = ewol::font::BoldItalic;
|
||||||
}
|
}
|
||||||
ParseHtmlNode(child);
|
ParseHtmlNode(elem);
|
||||||
m_htmlDecoTmp = tmpDeco;
|
m_htmlDecoTmp = tmpDeco;
|
||||||
} else if( !strcmp(child->Value(), "i")
|
} else if( true==elem->GetValue().CompareNoCase("i")
|
||||||
|| !strcmp(child->Value(), "italic")) {
|
|| true==elem->GetValue().CompareNoCase("italic")) {
|
||||||
EWOL_VERBOSE("XML italic ...");
|
EWOL_VERBOSE("XML italic ...");
|
||||||
TextDecoration tmpDeco = m_htmlDecoTmp;
|
TextDecoration tmpDeco = m_htmlDecoTmp;
|
||||||
if (m_htmlDecoTmp.m_mode == ewol::font::Regular) {
|
if (m_htmlDecoTmp.m_mode == ewol::font::Regular) {
|
||||||
@ -489,42 +496,42 @@ void ewol::Text::ParseHtmlNode(void* _element2)
|
|||||||
} else if (m_htmlDecoTmp.m_mode == ewol::font::Bold) {
|
} else if (m_htmlDecoTmp.m_mode == ewol::font::Bold) {
|
||||||
m_htmlDecoTmp.m_mode = ewol::font::BoldItalic;
|
m_htmlDecoTmp.m_mode = ewol::font::BoldItalic;
|
||||||
}
|
}
|
||||||
ParseHtmlNode(child);
|
ParseHtmlNode(elem);
|
||||||
m_htmlDecoTmp = tmpDeco;
|
m_htmlDecoTmp = tmpDeco;
|
||||||
} else if( !strcmp(child->Value(), "u")
|
} else if( true==elem->GetValue().CompareNoCase("u")
|
||||||
|| !strcmp(child->Value(), "underline")) {
|
|| true==elem->GetValue().CompareNoCase("underline")) {
|
||||||
EWOL_VERBOSE("XML underline ...");
|
EWOL_VERBOSE("XML underline ...");
|
||||||
ParseHtmlNode(child);
|
ParseHtmlNode(elem);
|
||||||
} else if( !strcmp(child->Value(), "p")
|
} else if( true==elem->GetValue().CompareNoCase("p")
|
||||||
|| !strcmp(child->Value(), "paragraph")) {
|
|| true==elem->GetValue().CompareNoCase("paragraph")) {
|
||||||
EWOL_VERBOSE("XML paragraph ...");
|
EWOL_VERBOSE("XML paragraph ...");
|
||||||
HtmlFlush();
|
HtmlFlush();
|
||||||
m_alignement = ewol::Text::alignLeft;
|
m_alignement = ewol::Text::alignLeft;
|
||||||
ForceLineReturn();
|
ForceLineReturn();
|
||||||
ParseHtmlNode(child);
|
ParseHtmlNode(elem);
|
||||||
ForceLineReturn();
|
ForceLineReturn();
|
||||||
} else if (!strcmp(child->Value(), "center")) {
|
} else if (true==elem->GetValue().CompareNoCase("center")) {
|
||||||
EWOL_VERBOSE("XML center ...");
|
EWOL_VERBOSE("XML center ...");
|
||||||
HtmlFlush();
|
HtmlFlush();
|
||||||
m_alignement = ewol::Text::alignCenter;
|
m_alignement = ewol::Text::alignCenter;
|
||||||
ParseHtmlNode(child);
|
ParseHtmlNode(elem);
|
||||||
} else if (!strcmp(child->Value(), "left")) {
|
} else if (true==elem->GetValue().CompareNoCase("left")) {
|
||||||
EWOL_VERBOSE("XML left ...");
|
EWOL_VERBOSE("XML left ...");
|
||||||
HtmlFlush();
|
HtmlFlush();
|
||||||
m_alignement = ewol::Text::alignLeft;
|
m_alignement = ewol::Text::alignLeft;
|
||||||
ParseHtmlNode(child);
|
ParseHtmlNode(elem);
|
||||||
} else if (!strcmp(child->Value(), "right")) {
|
} else if (true==elem->GetValue().CompareNoCase("right")) {
|
||||||
EWOL_VERBOSE("XML right ...");
|
EWOL_VERBOSE("XML right ...");
|
||||||
HtmlFlush();
|
HtmlFlush();
|
||||||
m_alignement = ewol::Text::alignRight;
|
m_alignement = ewol::Text::alignRight;
|
||||||
ParseHtmlNode(child);
|
ParseHtmlNode(elem);
|
||||||
} else if (!strcmp(child->Value(), "justify")) {
|
} else if (true==elem->GetValue().CompareNoCase("justify")) {
|
||||||
EWOL_VERBOSE("XML justify ...");
|
EWOL_VERBOSE("XML justify ...");
|
||||||
HtmlFlush();
|
HtmlFlush();
|
||||||
m_alignement = ewol::Text::alignJustify;
|
m_alignement = ewol::Text::alignJustify;
|
||||||
ParseHtmlNode(child);
|
ParseHtmlNode(elem);
|
||||||
} else {
|
} else {
|
||||||
EWOL_ERROR("(l "<< child->Row() << ") node not suported type : " << child->Type() << " val=\""<< child->Value() << "\"" );
|
EWOL_ERROR("(l "<< elem->Pos() << ") node not suported type : " << elem->GetType() << " val=\""<< elem->GetValue() << "\"" );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -540,27 +547,24 @@ void ewol::Text::PrintDecorated(const etk::UString& _text)
|
|||||||
|
|
||||||
void ewol::Text::PrintHTML(const etk::UString& _text)
|
void ewol::Text::PrintHTML(const etk::UString& _text)
|
||||||
{
|
{
|
||||||
TiXmlDocument XmlDocument;
|
exml::Document doc;
|
||||||
|
|
||||||
// reset parameter :
|
// reset parameter :
|
||||||
m_htmlDecoTmp.m_colorBg = draw::color::none;
|
m_htmlDecoTmp.m_colorBg = draw::color::none;
|
||||||
m_htmlDecoTmp.m_colorFg = draw::color::black;
|
m_htmlDecoTmp.m_colorFg = draw::color::black;
|
||||||
m_htmlDecoTmp.m_mode = ewol::font::Regular;
|
m_htmlDecoTmp.m_mode = ewol::font::Regular;
|
||||||
|
|
||||||
etk::Char tmpChar = _text.c_str();
|
if (false == doc.Parse(_text)) {
|
||||||
// load the XML from the memory
|
|
||||||
bool loadError = XmlDocument.Parse(tmpChar, 0, TIXML_ENCODING_UTF8);
|
|
||||||
if (false == loadError) {
|
|
||||||
EWOL_ERROR( "can not load XML: PARSING error: Decorated text ");
|
EWOL_ERROR( "can not load XML: PARSING error: Decorated text ");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
TiXmlElement* root = XmlDocument.FirstChildElement( "html" );
|
exml::Element* root = (exml::Element*)doc.GetNamed( "html" );
|
||||||
if (NULL == root) {
|
if (NULL == root) {
|
||||||
EWOL_ERROR( "can not load XML: main node not find: \"html\"");
|
EWOL_ERROR( "can not load XML: main node not find: \"html\"");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
TiXmlElement* bodyNode = root->FirstChildElement( "body" );
|
exml::Element* bodyNode = (exml::Element*)root->GetNamed( "body" );
|
||||||
if (NULL == root) {
|
if (NULL == root) {
|
||||||
EWOL_ERROR( "can not load XML: main node not find: \"body\"");
|
EWOL_ERROR( "can not load XML: main node not find: \"body\"");
|
||||||
return;
|
return;
|
||||||
|
@ -15,6 +15,7 @@
|
|||||||
#include <ewol/compositing/Compositing.h>
|
#include <ewol/compositing/Compositing.h>
|
||||||
#include <ewol/compositing/Drawing.h>
|
#include <ewol/compositing/Drawing.h>
|
||||||
#include <ewol/renderer/ResourceManager.h>
|
#include <ewol/renderer/ResourceManager.h>
|
||||||
|
#include <exml/exml.h>
|
||||||
|
|
||||||
namespace ewol
|
namespace ewol
|
||||||
{
|
{
|
||||||
@ -305,9 +306,9 @@ namespace ewol
|
|||||||
private:
|
private:
|
||||||
/**
|
/**
|
||||||
* @brief This parse a tinyXML node (void pointer to permit to hide tiny XML in include).
|
* @brief This parse a tinyXML node (void pointer to permit to hide tiny XML in include).
|
||||||
* @param[in] _element the tynyXML element : TiXmlNode* .
|
* @param[in] _element the exml element.
|
||||||
*/
|
*/
|
||||||
void ParseHtmlNode(void* _element);
|
void ParseHtmlNode(exml::Element* _element);
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
* @brief This generate the possibility to generate the big text property
|
* @brief This generate the possibility to generate the big text property
|
||||||
|
@ -269,7 +269,7 @@ void ewol::EObject::RegisterConfig(const char* _config, const char* _type, const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool ewol::EObject::LoadXML(TiXmlNode* _node)
|
bool ewol::EObject::LoadXML(exml::Element* _node)
|
||||||
{
|
{
|
||||||
if (NULL==_node) {
|
if (NULL==_node) {
|
||||||
return false;
|
return false;
|
||||||
@ -279,8 +279,9 @@ bool ewol::EObject::LoadXML(TiXmlNode* _node)
|
|||||||
if (m_listConfig[iii].GetConfig() == NULL) {
|
if (m_listConfig[iii].GetConfig() == NULL) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
const char* value = _node->ToElement()->Attribute(m_listConfig[iii].GetConfig());
|
etk::UString value = _node->GetAttribute(m_listConfig[iii].GetConfig());
|
||||||
if (NULL == value) {
|
// check existance :
|
||||||
|
if (value.Size()==0) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (false==SetConfig(ewol::EConfig(m_listConfig[iii].GetConfig(), value) ) ) {
|
if (false==SetConfig(ewol::EConfig(m_listConfig[iii].GetConfig(), value) ) ) {
|
||||||
@ -290,7 +291,7 @@ bool ewol::EObject::LoadXML(TiXmlNode* _node)
|
|||||||
return errorOccured;
|
return errorOccured;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ewol::EObject::StoreXML(TiXmlNode* _node) const
|
bool ewol::EObject::StoreXML(exml::Element* _node) const
|
||||||
{
|
{
|
||||||
if (NULL==_node) {
|
if (NULL==_node) {
|
||||||
return false;
|
return false;
|
||||||
@ -308,7 +309,7 @@ bool ewol::EObject::StoreXML(TiXmlNode* _node) const
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// add attribute ... ==> note : Add special element when '"' element detected ...
|
// add attribute ... ==> note : Add special element when '"' element detected ...
|
||||||
_node->ToElement()->SetAttribute(m_listConfig[iii].GetConfig(), value.c_str() );
|
_node->SetAttribute(m_listConfig[iii].GetConfig(), value);
|
||||||
}
|
}
|
||||||
return errorOccured;
|
return errorOccured;
|
||||||
}
|
}
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
#include <etk/types.h>
|
#include <etk/types.h>
|
||||||
#include <etk/UString.h>
|
#include <etk/UString.h>
|
||||||
#include <etk/Vector.h>
|
#include <etk/Vector.h>
|
||||||
#include <tinyXML/tinyxml.h>
|
#include <exml/exml.h>
|
||||||
namespace ewol {
|
namespace ewol {
|
||||||
// some class need to define element befor other ...
|
// some class need to define element befor other ...
|
||||||
class EObject;
|
class EObject;
|
||||||
@ -212,14 +212,14 @@ namespace ewol {
|
|||||||
* @return true : All has been done corectly.
|
* @return true : All has been done corectly.
|
||||||
* @return false : An error occured.
|
* @return false : An error occured.
|
||||||
*/
|
*/
|
||||||
virtual bool LoadXML(TiXmlNode* _node);
|
virtual bool LoadXML(exml::Element* _node);
|
||||||
/**
|
/**
|
||||||
* @brief Store properties in this XML node.
|
* @brief Store properties in this XML node.
|
||||||
* @param[in,out] _node Pointer on the tinyXML node.
|
* @param[in,out] _node Pointer on the tinyXML node.
|
||||||
* @return true : All has been done corectly.
|
* @return true : All has been done corectly.
|
||||||
* @return false : An error occured.
|
* @return false : An error occured.
|
||||||
*/
|
*/
|
||||||
virtual bool StoreXML(TiXmlNode* _node) const;
|
virtual bool StoreXML(exml::Element* _node) const;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -299,7 +299,7 @@ void guiInterface::SetTitle(etk::UString& title)
|
|||||||
|
|
||||||
#include <ewol/renderer/resources/image/ImageBMP.h>
|
#include <ewol/renderer/resources/image/ImageBMP.h>
|
||||||
#include <ewol/renderer/resources/image/ImagePNG.h>
|
#include <ewol/renderer/resources/image/ImagePNG.h>
|
||||||
#include <parserSVG/parserSVG.h>
|
#include <esvg/esvg.h>
|
||||||
|
|
||||||
void guiInterface::SetIcon(etk::UString inputFile)
|
void guiInterface::SetIcon(etk::UString inputFile)
|
||||||
{
|
{
|
||||||
@ -312,7 +312,7 @@ void guiInterface::SetIcon(etk::UString inputFile)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
} else if (true == inputFile.EndWith(".svg") ) {
|
} else if (true == inputFile.EndWith(".svg") ) {
|
||||||
svg::Parser m_element(inputFile);
|
esvg::Document m_element(inputFile);
|
||||||
if (false == m_element.IsLoadOk()) {
|
if (false == m_element.IsLoadOk()) {
|
||||||
EWOL_ERROR("Error To load SVG file " << inputFile );
|
EWOL_ERROR("Error To load SVG file " << inputFile );
|
||||||
return;
|
return;
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
#include <etk/types.h>
|
#include <etk/types.h>
|
||||||
#include <etk/os/FSNode.h>
|
#include <etk/os/FSNode.h>
|
||||||
|
|
||||||
#include <parserSVG/parserSVG.h>
|
#include <esvg/esvg.h>
|
||||||
|
|
||||||
#include <ewol/renderer/ResourceManager.h>
|
#include <ewol/renderer/ResourceManager.h>
|
||||||
#include <ewol/renderer/resources/Image.h>
|
#include <ewol/renderer/resources/Image.h>
|
||||||
@ -34,7 +34,7 @@ ewol::TextureFile::TextureFile(etk::UString genName, etk::UString tmpfileName, i
|
|||||||
EWOL_ERROR("Error To load BMP file " << tmpName );
|
EWOL_ERROR("Error To load BMP file " << tmpName );
|
||||||
}
|
}
|
||||||
} else if (true == tmpName.EndWith(".svg") ) {
|
} else if (true == tmpName.EndWith(".svg") ) {
|
||||||
svg::Parser m_element(tmpName);
|
esvg::Document m_element(tmpName);
|
||||||
if (false == m_element.IsLoadOk()) {
|
if (false == m_element.IsLoadOk()) {
|
||||||
EWOL_ERROR("Error To load SVG file " << tmpName );
|
EWOL_ERROR("Error To load SVG file " << tmpName );
|
||||||
} else {
|
} else {
|
||||||
|
@ -430,7 +430,7 @@ ewol::Widget* widget::Button::GetWidgetNamed(const etk::UString& _widgetName)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool widget::Button::LoadXML(TiXmlNode* _node)
|
bool widget::Button::LoadXML(exml::Element* _node)
|
||||||
{
|
{
|
||||||
if (NULL==_node) {
|
if (NULL==_node) {
|
||||||
return false;
|
return false;
|
||||||
@ -442,30 +442,32 @@ bool widget::Button::LoadXML(TiXmlNode* _node)
|
|||||||
SetSubWidgetToggle(NULL);
|
SetSubWidgetToggle(NULL);
|
||||||
|
|
||||||
// parse all the elements :
|
// parse all the elements :
|
||||||
for(TiXmlNode * pNode = _node->FirstChild() ;
|
for(int32_t iii=0; iii< _node->Size(); iii++) {
|
||||||
NULL != pNode ;
|
exml::Node* pNode = _node->Get(iii);
|
||||||
pNode = pNode->NextSibling() ) {
|
if (pNode==NULL) {
|
||||||
if (pNode->Type()==TiXmlNode::TINYXML_COMMENT) {
|
continue;
|
||||||
|
}
|
||||||
|
if (!pNode->IsElement()) {
|
||||||
// nothing to do, just proceed to next step
|
// nothing to do, just proceed to next step
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
etk::UString widgetName = pNode->Value();
|
etk::UString widgetName = pNode->GetValue();
|
||||||
if (ewol::widgetManager::Exist(widgetName) == false) {
|
if (ewol::widgetManager::Exist(widgetName) == false) {
|
||||||
EWOL_ERROR("(l "<<pNode->Row()<<") Unknown basic node=\"" << widgetName << "\" not in : [" << ewol::widgetManager::List() << "]" );
|
EWOL_ERROR("(l "<<pNode->Pos()<<") Unknown basic node=\"" << widgetName << "\" not in : [" << ewol::widgetManager::List() << "]" );
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
bool toogleMode=false;
|
bool toogleMode=false;
|
||||||
if (NULL != GetSubWidget()) {
|
if (NULL != GetSubWidget()) {
|
||||||
toogleMode=true;
|
toogleMode=true;
|
||||||
if (NULL != GetSubWidgetToggle()) {
|
if (NULL != GetSubWidgetToggle()) {
|
||||||
EWOL_ERROR("(l "<<pNode->Row()<<") " << __class__ << " Can only have one subWidget ??? node=\"" << widgetName << "\"" );
|
EWOL_ERROR("(l "<<pNode->Pos()<<") " << __class__ << " Can only have one subWidget ??? node=\"" << widgetName << "\"" );
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
EWOL_DEBUG("try to create subwidget : '" << widgetName << "'");
|
EWOL_DEBUG("try to create subwidget : '" << widgetName << "'");
|
||||||
ewol::Widget* tmpWidget = ewol::widgetManager::Create(widgetName);
|
ewol::Widget* tmpWidget = ewol::widgetManager::Create(widgetName);
|
||||||
if (tmpWidget == NULL) {
|
if (tmpWidget == NULL) {
|
||||||
EWOL_ERROR ("(l "<<pNode->Row()<<") Can not create the widget : \"" << widgetName << "\"");
|
EWOL_ERROR ("(l "<<pNode->Pos()<<") Can not create the widget : \"" << widgetName << "\"");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
// add widget :
|
// add widget :
|
||||||
@ -475,8 +477,8 @@ bool widget::Button::LoadXML(TiXmlNode* _node)
|
|||||||
SetToggleMode(true);
|
SetToggleMode(true);
|
||||||
SetSubWidgetToggle(tmpWidget);
|
SetSubWidgetToggle(tmpWidget);
|
||||||
}
|
}
|
||||||
if (false == tmpWidget->LoadXML(pNode)) {
|
if (false == tmpWidget->LoadXML((exml::Element*)pNode)) {
|
||||||
EWOL_ERROR ("(l "<<pNode->Row()<<") can not load widget properties : \"" << widgetName << "\"");
|
EWOL_ERROR ("(l "<<pNode->Pos()<<") can not load widget properties : \"" << widgetName << "\"");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -154,7 +154,7 @@ namespace widget {
|
|||||||
virtual void SystemDraw(const ewol::DrawProperty& _displayProp);
|
virtual void SystemDraw(const ewol::DrawProperty& _displayProp);
|
||||||
virtual bool OnEventInput(const ewol::EventInput& _event);
|
virtual bool OnEventInput(const ewol::EventInput& _event);
|
||||||
virtual bool OnEventEntry(const ewol::EventEntry& _event);
|
virtual bool OnEventEntry(const ewol::EventEntry& _event);
|
||||||
virtual bool LoadXML(TiXmlNode* _node);
|
virtual bool LoadXML(exml::Element* _node);
|
||||||
virtual ewol::Widget* GetWidgetNamed(const etk::UString& _widgetName);
|
virtual ewol::Widget* GetWidgetNamed(const etk::UString& _widgetName);
|
||||||
private: // derived function
|
private: // derived function
|
||||||
virtual void PeriodicCall(const ewol::EventTime& _event);
|
virtual void PeriodicCall(const ewol::EventTime& _event);
|
||||||
|
@ -41,57 +41,30 @@ widget::Composer::~Composer(void)
|
|||||||
|
|
||||||
bool widget::Composer::LoadFromFile(const etk::UString& _fileName)
|
bool widget::Composer::LoadFromFile(const etk::UString& _fileName)
|
||||||
{
|
{
|
||||||
// open the curent File
|
exml::Document doc;
|
||||||
etk::FSNode fileName(_fileName);
|
if (doc.Load(_fileName)==false) {
|
||||||
if (false == fileName.Exist()) {
|
EWOL_ERROR(" can not load file XML : " << _fileName);
|
||||||
EWOL_ERROR("[" << GetId() << "] {" << GetObjectType() << "} File Does not exist : " << fileName);
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
int32_t fileSize = fileName.FileSize();
|
exml::Element* root = (exml::Element*)doc.GetNamed("composer");
|
||||||
if (0==fileSize) {
|
if (NULL == root ) {
|
||||||
EWOL_ERROR("[" << GetId() << "] {" << GetObjectType() << "} This file is empty : " << fileName);
|
EWOL_ERROR("[" << GetId() << "] {" << GetObjectType() << "} (l ?) main node not find: \"composer\" ...");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (false == fileName.FileOpenRead()) {
|
// call upper class to parse his elements ...
|
||||||
EWOL_ERROR("[" << GetId() << "] {" << GetObjectType() << "} Can not open the file : " << fileName);
|
widget::Container::LoadXML(root);
|
||||||
return false;
|
|
||||||
}
|
|
||||||
// allocate data
|
|
||||||
char * fileBuffer = new char[fileSize+5];
|
|
||||||
if (NULL == fileBuffer) {
|
|
||||||
EWOL_ERROR("[" << GetId() << "] {" << GetObjectType() << "} Error Memory allocation size=" << fileSize);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
memset(fileBuffer, 0, (fileSize+5)*sizeof(char));
|
|
||||||
// load data from the file :
|
|
||||||
fileName.FileRead(fileBuffer, 1, fileSize);
|
|
||||||
// close the file:
|
|
||||||
fileName.FileClose();
|
|
||||||
|
|
||||||
bool ret = CommonLoadXML((const char*)fileBuffer);
|
return true;
|
||||||
|
|
||||||
if (NULL != fileBuffer) {
|
|
||||||
delete[] fileBuffer;
|
|
||||||
}
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool widget::Composer::LoadFromString(const etk::UString& composerXmlString)
|
bool widget::Composer::LoadFromString(const etk::UString& _composerXmlString)
|
||||||
{
|
{
|
||||||
etk::Char tmpData = composerXmlString.c_str();
|
exml::Document doc;
|
||||||
return CommonLoadXML(tmpData);
|
if (doc.Parse(_composerXmlString)==false) {
|
||||||
}
|
EWOL_ERROR(" can not load file XML string...");
|
||||||
|
|
||||||
bool widget::Composer::CommonLoadXML(const char* data)
|
|
||||||
{
|
|
||||||
if (NULL==data) {
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
TiXmlDocument XmlDocument;
|
exml::Element* root = (exml::Element*)doc.GetNamed("composer");
|
||||||
// load the XML from the memory
|
|
||||||
XmlDocument.Parse(data, 0, TIXML_ENCODING_UTF8);
|
|
||||||
|
|
||||||
TiXmlElement* root = XmlDocument.FirstChildElement("composer");
|
|
||||||
if (NULL == root ) {
|
if (NULL == root ) {
|
||||||
EWOL_ERROR("[" << GetId() << "] {" << GetObjectType() << "} (l ?) main node not find: \"composer\" ...");
|
EWOL_ERROR("[" << GetId() << "] {" << GetObjectType() << "} (l ?) main node not find: \"composer\" ...");
|
||||||
return false;
|
return false;
|
||||||
|
@ -81,14 +81,6 @@ namespace widget
|
|||||||
const char * _eventId,
|
const char * _eventId,
|
||||||
const char * _eventIdgenerated = NULL,
|
const char * _eventIdgenerated = NULL,
|
||||||
const etk::UString& _overloadData="");
|
const etk::UString& _overloadData="");
|
||||||
private:
|
|
||||||
/**
|
|
||||||
* @brief Load a composition with a file.
|
|
||||||
* @param[in] data pointer on the file data.
|
|
||||||
* @return true ==> all done OK.
|
|
||||||
* @return false ==> some error occured.
|
|
||||||
*/
|
|
||||||
bool CommonLoadXML(const char* data);
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -166,7 +166,7 @@ ewol::Widget* widget::Container::GetWidgetAtPos(const vec2& _pos)
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
bool widget::Container::LoadXML(TiXmlNode* _node)
|
bool widget::Container::LoadXML(exml::Element* _node)
|
||||||
{
|
{
|
||||||
if (NULL==_node) {
|
if (NULL==_node) {
|
||||||
return false;
|
return false;
|
||||||
@ -177,32 +177,34 @@ bool widget::Container::LoadXML(TiXmlNode* _node)
|
|||||||
SubWidgetRemoveDelayed();
|
SubWidgetRemoveDelayed();
|
||||||
|
|
||||||
// parse all the elements :
|
// parse all the elements :
|
||||||
for(TiXmlNode * pNode = _node->FirstChild() ;
|
for(int32_t iii=0; iii< _node->Size(); iii++) {
|
||||||
NULL != pNode ;
|
exml::Node* pNode = _node->Get(iii);
|
||||||
pNode = pNode->NextSibling() ) {
|
if (pNode==NULL) {
|
||||||
if (pNode->Type()==TiXmlNode::TINYXML_COMMENT) {
|
continue;
|
||||||
|
}
|
||||||
|
if (!pNode->IsElement()) {
|
||||||
// nothing to do, just proceed to next step
|
// nothing to do, just proceed to next step
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
etk::UString widgetName = pNode->Value();
|
etk::UString widgetName = pNode->GetValue();
|
||||||
if (ewol::widgetManager::Exist(widgetName) == false) {
|
if (ewol::widgetManager::Exist(widgetName) == false) {
|
||||||
EWOL_ERROR("(l "<<pNode->Row()<<") Unknown basic node=\"" << widgetName << "\" not in : [" << ewol::widgetManager::List() << "]" );
|
EWOL_ERROR("(l "<<pNode->Pos()<<") Unknown basic node=\"" << widgetName << "\" not in : [" << ewol::widgetManager::List() << "]" );
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (NULL != GetSubWidget()) {
|
if (NULL != GetSubWidget()) {
|
||||||
EWOL_ERROR("(l "<<pNode->Row()<<") " << __class__ << " Can only have one subWidget ??? node=\"" << widgetName << "\"" );
|
EWOL_ERROR("(l "<<pNode->Pos()<<") " << __class__ << " Can only have one subWidget ??? node=\"" << widgetName << "\"" );
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
EWOL_DEBUG("try to create subwidget : '" << widgetName << "'");
|
EWOL_DEBUG("try to create subwidget : '" << widgetName << "'");
|
||||||
ewol::Widget* tmpWidget = ewol::widgetManager::Create(widgetName);
|
ewol::Widget* tmpWidget = ewol::widgetManager::Create(widgetName);
|
||||||
if (tmpWidget == NULL) {
|
if (tmpWidget == NULL) {
|
||||||
EWOL_ERROR ("(l "<<pNode->Row()<<") Can not create the widget : \"" << widgetName << "\"");
|
EWOL_ERROR ("(l "<<pNode->Pos()<<") Can not create the widget : \"" << widgetName << "\"");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
// add widget :
|
// add widget :
|
||||||
SetSubWidget(tmpWidget);
|
SetSubWidget(tmpWidget);
|
||||||
if (false == tmpWidget->LoadXML(pNode)) {
|
if (false == tmpWidget->LoadXML((exml::Element*)pNode)) {
|
||||||
EWOL_ERROR ("(l "<<pNode->Row()<<") can not load widget properties : \"" << widgetName << "\"");
|
EWOL_ERROR ("(l "<<pNode->Pos()<<") can not load widget properties : \"" << widgetName << "\"");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -60,7 +60,7 @@ namespace widget
|
|||||||
virtual ewol::Widget* GetWidgetAtPos(const vec2& _pos);
|
virtual ewol::Widget* GetWidgetAtPos(const vec2& _pos);
|
||||||
virtual ewol::Widget* GetWidgetNamed(const etk::UString& _widgetName);
|
virtual ewol::Widget* GetWidgetNamed(const etk::UString& _widgetName);
|
||||||
virtual const char * const GetObjectType(void) { return "ewol::widget::Container"; };
|
virtual const char * const GetObjectType(void) { return "ewol::widget::Container"; };
|
||||||
virtual bool LoadXML(TiXmlNode* _node);
|
virtual bool LoadXML(exml::Element* _node);
|
||||||
virtual void SetOffset(const vec2& _newVal);
|
virtual void SetOffset(const vec2& _newVal);
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
@ -283,7 +283,7 @@ ewol::Widget* widget::ContainerN::GetWidgetAtPos(const vec2& _pos)
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
bool widget::ContainerN::LoadXML(TiXmlNode* _node)
|
bool widget::ContainerN::LoadXML(exml::Element* _node)
|
||||||
{
|
{
|
||||||
if (NULL==_node) {
|
if (NULL==_node) {
|
||||||
return false;
|
return false;
|
||||||
@ -293,35 +293,34 @@ bool widget::ContainerN::LoadXML(TiXmlNode* _node)
|
|||||||
// remove previous element :
|
// remove previous element :
|
||||||
SubWidgetRemoveAll();
|
SubWidgetRemoveAll();
|
||||||
|
|
||||||
const char *tmpAttributeValue = _node->ToElement()->Attribute("lock");
|
etk::UString tmpAttributeValue = _node->GetAttribute("lock");
|
||||||
if (NULL != tmpAttributeValue) {
|
if (tmpAttributeValue.Size()!=0) {
|
||||||
m_lockExpand = tmpAttributeValue;
|
m_lockExpand = tmpAttributeValue;
|
||||||
}
|
}
|
||||||
bool invertAdding=false;
|
bool invertAdding=false;
|
||||||
tmpAttributeValue = _node->ToElement()->Attribute("addmode");
|
tmpAttributeValue = _node->GetAttribute("addmode");
|
||||||
if (NULL != tmpAttributeValue) {
|
if(tmpAttributeValue.CompareNoCase("invert")) {
|
||||||
etk::UString val(tmpAttributeValue);
|
invertAdding=true;
|
||||||
if(val.CompareNoCase("invert")) {
|
|
||||||
invertAdding=true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
// parse all the elements :
|
// parse all the elements :
|
||||||
for(TiXmlNode * pNode = _node->FirstChild() ;
|
for(int32_t iii=0; iii< _node->Size(); iii++) {
|
||||||
NULL != pNode ;
|
exml::Node* pNode = _node->Get(iii);
|
||||||
pNode = pNode->NextSibling() ) {
|
if (pNode==NULL) {
|
||||||
if (pNode->Type()==TiXmlNode::TINYXML_COMMENT) {
|
continue;
|
||||||
|
}
|
||||||
|
if (!pNode->IsElement()) {
|
||||||
// nothing to do, just proceed to next step
|
// nothing to do, just proceed to next step
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
etk::UString widgetName = pNode->Value();
|
etk::UString widgetName = pNode->GetValue();
|
||||||
if (ewol::widgetManager::Exist(widgetName) == false) {
|
if (ewol::widgetManager::Exist(widgetName) == false) {
|
||||||
EWOL_ERROR("[" << GetId() << "] {" << GetObjectType() << "} (l "<<pNode->Row()<<") Unknown basic node=\"" << widgetName << "\" not in : [" << ewol::widgetManager::List() << "]" );
|
EWOL_ERROR("[" << GetId() << "] {" << GetObjectType() << "} (l "<<pNode->Pos()<<") Unknown basic node=\"" << widgetName << "\" not in : [" << ewol::widgetManager::List() << "]" );
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
EWOL_DEBUG("[" << GetId() << "] {" << GetObjectType() << "} load new element : \"" << widgetName << "\"");
|
EWOL_DEBUG("[" << GetId() << "] {" << GetObjectType() << "} load new element : \"" << widgetName << "\"");
|
||||||
ewol::Widget *subWidget = ewol::widgetManager::Create(widgetName);
|
ewol::Widget *subWidget = ewol::widgetManager::Create(widgetName);
|
||||||
if (subWidget == NULL) {
|
if (subWidget == NULL) {
|
||||||
EWOL_ERROR ("[" << GetId() << "] {" << GetObjectType() << "} (l "<<pNode->Row()<<") Can not create the widget : \"" << widgetName << "\"");
|
EWOL_ERROR ("[" << GetId() << "] {" << GetObjectType() << "} (l "<<pNode->Pos()<<") Can not create the widget : \"" << widgetName << "\"");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
// add sub element :
|
// add sub element :
|
||||||
@ -330,8 +329,8 @@ bool widget::ContainerN::LoadXML(TiXmlNode* _node)
|
|||||||
} else {
|
} else {
|
||||||
SubWidgetAddStart(subWidget);
|
SubWidgetAddStart(subWidget);
|
||||||
}
|
}
|
||||||
if (false == subWidget->LoadXML(pNode)) {
|
if (false == subWidget->LoadXML((exml::Element*)pNode)) {
|
||||||
EWOL_ERROR ("[" << GetId() << "] {" << GetObjectType() << "} (l "<<pNode->Row()<<") can not load widget properties : \"" << widgetName << "\"");
|
EWOL_ERROR ("[" << GetId() << "] {" << GetObjectType() << "} (l "<<pNode->Pos()<<") can not load widget properties : \"" << widgetName << "\"");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -85,7 +85,7 @@ namespace widget
|
|||||||
virtual ewol::Widget* GetWidgetAtPos(const vec2& _pos);
|
virtual ewol::Widget* GetWidgetAtPos(const vec2& _pos);
|
||||||
virtual ewol::Widget* GetWidgetNamed(const etk::UString& _widgetName);
|
virtual ewol::Widget* GetWidgetNamed(const etk::UString& _widgetName);
|
||||||
virtual const char * const GetObjectType(void) { return "Ewol::ContainerN"; };
|
virtual const char * const GetObjectType(void) { return "Ewol::ContainerN"; };
|
||||||
virtual bool LoadXML(TiXmlNode* _node);
|
virtual bool LoadXML(exml::Element* _node);
|
||||||
virtual void SetOffset(const vec2& _newVal);
|
virtual void SetOffset(const vec2& _newVal);
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
@ -174,7 +174,7 @@ bool widget::Image::OnEventInput(const ewol::EventInput& _event)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool widget::Image::LoadXML(TiXmlNode* _node)
|
bool widget::Image::LoadXML(exml::Element* _node)
|
||||||
{
|
{
|
||||||
if (NULL==_node) {
|
if (NULL==_node) {
|
||||||
return false;
|
return false;
|
||||||
@ -182,32 +182,32 @@ bool widget::Image::LoadXML(TiXmlNode* _node)
|
|||||||
ewol::Widget::LoadXML(_node);
|
ewol::Widget::LoadXML(_node);
|
||||||
// get internal data :
|
// get internal data :
|
||||||
|
|
||||||
const char *tmpAttributeValue = _node->ToElement()->Attribute("ratio");
|
etk::UString tmpAttributeValue = _node->GetAttribute("ratio");
|
||||||
if (NULL != tmpAttributeValue) {
|
if (tmpAttributeValue.Size()!=0) {
|
||||||
if (strcmp(tmpAttributeValue,"true")==0) {
|
if (tmpAttributeValue.CompareNoCase("true")==true) {
|
||||||
m_keepRatio = true;
|
m_keepRatio = true;
|
||||||
} else if (strcmp(tmpAttributeValue,"1")==0) {
|
} else if (tmpAttributeValue == "1") {
|
||||||
m_keepRatio = true;
|
m_keepRatio = true;
|
||||||
} else {
|
} else {
|
||||||
m_keepRatio = false;
|
m_keepRatio = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
tmpAttributeValue = _node->ToElement()->Attribute("size");
|
tmpAttributeValue = _node->GetAttribute("size");
|
||||||
if (NULL != tmpAttributeValue) {
|
if (tmpAttributeValue.Size()!=0) {
|
||||||
//EWOL_CRITICAL(" Parse SIZE : " << tmpAttributeValue);
|
//EWOL_CRITICAL(" Parse SIZE : " << tmpAttributeValue);
|
||||||
m_imageSize = tmpAttributeValue;
|
m_imageSize = tmpAttributeValue;
|
||||||
//EWOL_CRITICAL(" ==> " << m_imageSize);
|
//EWOL_CRITICAL(" ==> " << m_imageSize);
|
||||||
}
|
}
|
||||||
tmpAttributeValue = _node->ToElement()->Attribute("border");
|
tmpAttributeValue = _node->GetAttribute("border");
|
||||||
if (NULL != tmpAttributeValue) {
|
if (tmpAttributeValue.Size()!=0) {
|
||||||
m_border = tmpAttributeValue;
|
m_border = tmpAttributeValue;
|
||||||
}
|
}
|
||||||
//EWOL_DEBUG("Load label:" << node->ToElement()->GetText());
|
//EWOL_DEBUG("Load label:" << node->ToElement()->GetText());
|
||||||
if (_node->ToElement()->GetText() != NULL) {
|
if (_node->Size()!=0) {
|
||||||
SetFile(_node->ToElement()->GetText());
|
SetFile(_node->GetText());
|
||||||
} else {
|
} else {
|
||||||
tmpAttributeValue = _node->ToElement()->Attribute("src");
|
tmpAttributeValue = _node->GetAttribute("src");
|
||||||
if (NULL != tmpAttributeValue) {
|
if (tmpAttributeValue.Size()!=0) {
|
||||||
SetFile(tmpAttributeValue);
|
SetFile(tmpAttributeValue);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -116,7 +116,7 @@ namespace widget {
|
|||||||
virtual void CalculateMinMaxSize(void);
|
virtual void CalculateMinMaxSize(void);
|
||||||
virtual void OnRegenerateDisplay(void);
|
virtual void OnRegenerateDisplay(void);
|
||||||
virtual bool OnEventInput(const ewol::EventInput& _event);
|
virtual bool OnEventInput(const ewol::EventInput& _event);
|
||||||
virtual bool LoadXML(TiXmlNode* _node);
|
virtual bool LoadXML(exml::Element* _node);
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -135,7 +135,7 @@ bool widget::Label::OnEventInput(const ewol::EventInput& _event)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool widget::Label::LoadXML(TiXmlNode* _node)
|
bool widget::Label::LoadXML(exml::Element* _node)
|
||||||
{
|
{
|
||||||
if (NULL==_node) {
|
if (NULL==_node) {
|
||||||
return false;
|
return false;
|
||||||
@ -143,7 +143,7 @@ bool widget::Label::LoadXML(TiXmlNode* _node)
|
|||||||
ewol::Widget::LoadXML(_node);
|
ewol::Widget::LoadXML(_node);
|
||||||
// get internal data :
|
// get internal data :
|
||||||
// TODO : Unparse data type XML ...
|
// TODO : Unparse data type XML ...
|
||||||
EWOL_DEBUG("Load label:" << _node->ToElement()->GetText());
|
EWOL_DEBUG("Load label:" << _node->GetValue());
|
||||||
SetLabel(_node->ToElement()->GetText());
|
SetLabel(_node->GetValue());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -60,7 +60,7 @@ namespace widget {
|
|||||||
virtual void CalculateMinMaxSize(void);
|
virtual void CalculateMinMaxSize(void);
|
||||||
virtual void OnRegenerateDisplay(void);
|
virtual void OnRegenerateDisplay(void);
|
||||||
virtual bool OnEventInput(const ewol::EventInput& _event);
|
virtual bool OnEventInput(const ewol::EventInput& _event);
|
||||||
virtual bool LoadXML(TiXmlNode* _node);
|
virtual bool LoadXML(exml::Element* _node);
|
||||||
};
|
};
|
||||||
|
|
||||||
};
|
};
|
||||||
|
@ -178,7 +178,7 @@ void widget::Sizer::CalculateMinMaxSize(void)
|
|||||||
//EWOL_ERROR("[" << GetId() << "] {" << GetObjectType() << "} Result min size : " << m_minSize);
|
//EWOL_ERROR("[" << GetId() << "] {" << GetObjectType() << "} Result min size : " << m_minSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool widget::Sizer::LoadXML(TiXmlNode* _node)
|
bool widget::Sizer::LoadXML(exml::Element* _node)
|
||||||
{
|
{
|
||||||
if (NULL==_node) {
|
if (NULL==_node) {
|
||||||
return false;
|
return false;
|
||||||
@ -186,15 +186,14 @@ bool widget::Sizer::LoadXML(TiXmlNode* _node)
|
|||||||
// parse generic properties :
|
// parse generic properties :
|
||||||
widget::ContainerN::LoadXML(_node);
|
widget::ContainerN::LoadXML(_node);
|
||||||
|
|
||||||
const char* tmpAttributeValue = _node->ToElement()->Attribute("border");
|
etk::UString tmpAttributeValue = _node->GetAttribute("border");
|
||||||
if (NULL != tmpAttributeValue) {
|
if (tmpAttributeValue.Size()!=0) {
|
||||||
m_borderSize = tmpAttributeValue;
|
m_borderSize = tmpAttributeValue;
|
||||||
}
|
}
|
||||||
tmpAttributeValue = _node->ToElement()->Attribute("mode");
|
tmpAttributeValue = _node->GetAttribute("mode");
|
||||||
if (NULL != tmpAttributeValue) {
|
if (tmpAttributeValue.Size()!=0) {
|
||||||
etk::UString val(tmpAttributeValue);
|
if( tmpAttributeValue.CompareNoCase("vert")
|
||||||
if( val.CompareNoCase("vert")
|
|| tmpAttributeValue.CompareNoCase("vertical")) {
|
||||||
|| val.CompareNoCase("vertical")) {
|
|
||||||
m_mode = widget::Sizer::modeVert;
|
m_mode = widget::Sizer::modeVert;
|
||||||
} else {
|
} else {
|
||||||
m_mode = widget::Sizer::modeHori;
|
m_mode = widget::Sizer::modeHori;
|
||||||
|
@ -104,7 +104,7 @@ namespace widget {
|
|||||||
virtual const char * const GetObjectType(void) { return "ewol::widget::sizer"; };
|
virtual const char * const GetObjectType(void) { return "ewol::widget::sizer"; };
|
||||||
virtual void CalculateSize(const vec2& _availlable);
|
virtual void CalculateSize(const vec2& _availlable);
|
||||||
virtual void CalculateMinMaxSize(void);
|
virtual void CalculateMinMaxSize(void);
|
||||||
virtual bool LoadXML(TiXmlNode* _node);
|
virtual bool LoadXML(exml::Element* _node);
|
||||||
// overwrite the set fuction to start annimations ...
|
// overwrite the set fuction to start annimations ...
|
||||||
virtual int32_t SubWidgetAdd(ewol::Widget* _newWidget);
|
virtual int32_t SubWidgetAdd(ewol::Widget* _newWidget);
|
||||||
virtual int32_t SubWidgetAddStart(ewol::Widget* _newWidget);
|
virtual int32_t SubWidgetAddStart(ewol::Widget* _newWidget);
|
||||||
|
@ -729,7 +729,7 @@ ewol::cursorDisplay_te ewol::Widget::GetCursor(void)
|
|||||||
return m_cursorDisplay;
|
return m_cursorDisplay;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ewol::Widget::LoadXML(TiXmlNode* _node)
|
bool ewol::Widget::LoadXML(exml::Element* _node)
|
||||||
{
|
{
|
||||||
// Call EObject basic parser
|
// Call EObject basic parser
|
||||||
ewol::EObject::LoadXML(_node); // note : Load standard parameters (attribute in XML)
|
ewol::EObject::LoadXML(_node); // note : Load standard parameters (attribute in XML)
|
||||||
|
@ -616,7 +616,7 @@ namespace ewol {
|
|||||||
virtual ewol::cursorDisplay_te GetCursor(void);
|
virtual ewol::cursorDisplay_te GetCursor(void);
|
||||||
public: // Derived function
|
public: // Derived function
|
||||||
virtual void OnObjectRemove(ewol::EObject* _removeObject);
|
virtual void OnObjectRemove(ewol::EObject* _removeObject);
|
||||||
virtual bool LoadXML(TiXmlNode* _node);
|
virtual bool LoadXML(exml::Element* _node);
|
||||||
protected: // Derived function
|
protected: // Derived function
|
||||||
virtual bool OnSetConfig(const ewol::EConfig& _conf);
|
virtual bool OnSetConfig(const ewol::EConfig& _conf);
|
||||||
virtual bool OnGetConfig(const char* _config, etk::UString& _result) const;
|
virtual bool OnGetConfig(const char* _config, etk::UString& _result) const;
|
||||||
|
@ -13,7 +13,6 @@
|
|||||||
#include <ewol/debug.h>
|
#include <ewol/debug.h>
|
||||||
#include <etk/Vector.h>
|
#include <etk/Vector.h>
|
||||||
#include <ewol/widget/Widget.h>
|
#include <ewol/widget/Widget.h>
|
||||||
#include <tinyXML/tinyxml.h>
|
|
||||||
|
|
||||||
namespace ewol {
|
namespace ewol {
|
||||||
namespace widgetManager {
|
namespace widgetManager {
|
||||||
|
@ -139,7 +139,7 @@ def Create(target):
|
|||||||
#myModule.SetConfig(['Config.in','ConfigLinux.in'])
|
#myModule.SetConfig(['Config.in','ConfigLinux.in'])
|
||||||
|
|
||||||
# name of the dependency
|
# name of the dependency
|
||||||
myModule.AddModuleDepend(['etk', 'freetype', 'tinyxml', 'png', 'parsersvg', 'date'])
|
myModule.AddModuleDepend(['etk', 'freetype', 'png', 'esvg', 'date'])
|
||||||
|
|
||||||
#ifeq ("$(CONFIG_BUILD_BULLET)","y")
|
#ifeq ("$(CONFIG_BUILD_BULLET)","y")
|
||||||
#myModule.AddModuleDepend('bullet')
|
#myModule.AddModuleDepend('bullet')
|
||||||
|
Loading…
x
Reference in New Issue
Block a user