[DEV] exml update and tested

This commit is contained in:
Edouard DUPIN 2013-06-26 23:20:24 +02:00
parent 8a159b8ca3
commit da97bea5df
12 changed files with 39 additions and 48 deletions

2
external/etk vendored

@ -1 +1 @@
Subproject commit 2cac9e69dd5c890ad403e62ecae5e48da2a6d027 Subproject commit d2099c51e917243edd4bb808f66a32e9df69aa30

2
external/parsersvg vendored

@ -1 +1 @@
Subproject commit 7081b72812e2e9e9603bd2d37dae5acae5b2c827 Subproject commit 18832b2305675e930e775332a7c3ba6f1aa8eaa4

View File

@ -112,19 +112,16 @@ bool ewol::userConfig::Load(void)
return false; return false;
} }
for(int32_t iii=0; iii< root->Size(); iii++) { for(int32_t iii=0; iii< root->Size(); iii++) {
exml::Node* child = root->Get(iii); exml::Element* child = root->GetElement(iii);
if (child==NULL) { if (child==NULL) {
continue; // other than element is trash here
}
if (!child->IsElement()) {
// nothing to do, just proceed to next step
continue; continue;
} }
bool elementFound = false; bool elementFound = false;
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() == child->GetValue()) { if (l_obj().List()[iii]->GetName() == child->GetValue()) {
l_obj().List()[iii]->LoadXML((exml::Element*)child); l_obj().List()[iii]->LoadXML(child);
elementFound = true; elementFound = true;
break; break;
} }

View File

@ -402,7 +402,7 @@ void ewol::Drawing::LineTo(const vec3& _dest)
{ {
ResetCount(); ResetCount();
InternalSetColor(m_color); InternalSetColor(m_color);
EWOL_DEBUG("DrawLine : " << m_position << " to " << _dest); EWOL_VERBOSE("DrawLine : " << m_position << " to " << _dest);
if (m_position.x() == _dest.x() && m_position.y() == _dest.y() && m_position.z() == _dest.z()) { if (m_position.x() == _dest.x() && m_position.y() == _dest.y() && m_position.z() == _dest.z()) {
EWOL_WARNING("Try to draw an line width 0"); EWOL_WARNING("Try to draw an line width 0");
return; return;

View File

@ -10,6 +10,10 @@
#include <ewol/compositing/Text.h> #include <ewol/compositing/Text.h>
#include <ewol/config.h> #include <ewol/config.h>
#undef __class__
#define __class__ "ewol::Text"
ewol::Text::Text(void) : ewol::Text::Text(void) :
m_position(0.0, 0.0, 0.0), m_position(0.0, 0.0, 0.0),
m_clippingPosStart(0.0, 0.0, 0.0), m_clippingPosStart(0.0, 0.0, 0.0),
@ -441,20 +445,19 @@ void ewol::Text::ParseHtmlNode(exml::Element* _element)
EWOL_ERROR( "Error Input node does not existed ..."); EWOL_ERROR( "Error Input node does not existed ...");
} }
for(int32_t iii=0; iii< _element->Size(); iii++) { for(int32_t iii=0; iii< _element->Size(); iii++) {
exml::Node* child = _element->Get(iii);
if (child==NULL) { if (_element->GetType(iii)==exml::typeComment) {
continue;
}
if (child->GetType()==exml::typeComment) {
// nothing to do ... // nothing to do ...
} else if (child->GetType()==exml::typeText) { } else if (_element->GetType(iii)==exml::typeText) {
exml::Node* child = _element->GetNode(iii);
HtmlAddData(child->GetValue() ); HtmlAddData(child->GetValue() );
EWOL_VERBOSE("XML Add : " << child->GetValue()); EWOL_VERBOSE("XML Add : " << child->GetValue());
} else if (child->GetType()!=exml::typeElement) { continue;
EWOL_ERROR("(l "<< child->Pos() << ") node not suported type : " << child->GetType() << " val=\""<< child->GetValue() << "\"" ); } else if (_element->GetType(iii)!=exml::typeElement) {
EWOL_ERROR("(l "<< _element->GetNode(iii)->Pos() << ") node not suported type : " << _element->GetType(iii) << " val=\""<< _element->GetNode(iii)->GetValue() << "\"" );
continue; continue;
} }
exml::Element* elem = (exml::Element*)child; exml::Element* elem = _element->GetElement(iii);
if (elem==NULL) { if (elem==NULL) {
EWOL_ERROR("Cast error ..."); EWOL_ERROR("Cast error ...");
continue; continue;
@ -538,9 +541,9 @@ void ewol::Text::ParseHtmlNode(exml::Element* _element)
void ewol::Text::PrintDecorated(const etk::UString& _text) void ewol::Text::PrintDecorated(const etk::UString& _text)
{ {
etk::UString tmpData("<html><body>\n"); etk::UString tmpData("<html>\n<body>\n");
tmpData+=_text; tmpData+=_text;
tmpData+="\n</body></html>\n"; tmpData+="\n</body>\n</html>\n";
//EWOL_DEBUG("plop : " << tmpData); //EWOL_DEBUG("plop : " << tmpData);
PrintHTML(tmpData); PrintHTML(tmpData);
} }
@ -562,6 +565,7 @@ void ewol::Text::PrintHTML(const etk::UString& _text)
exml::Element* root = (exml::Element*)doc.GetNamed( "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\"");
doc.Display();
return; return;
} }
exml::Element* bodyNode = (exml::Element*)root->GetNamed( "body" ); exml::Element* bodyNode = (exml::Element*)root->GetNamed( "body" );

View File

@ -443,12 +443,9 @@ bool widget::Button::LoadXML(exml::Element* _node)
// parse all the elements : // parse all the elements :
for(int32_t iii=0; iii< _node->Size(); iii++) { for(int32_t iii=0; iii< _node->Size(); iii++) {
exml::Node* pNode = _node->Get(iii); exml::Element* pNode = _node->GetElement(iii);
if (pNode==NULL) { if (pNode==NULL) {
continue; // trash here all that is not element
}
if (!pNode->IsElement()) {
// nothing to do, just proceed to next step
continue; continue;
} }
etk::UString widgetName = pNode->GetValue(); etk::UString widgetName = pNode->GetValue();
@ -477,7 +474,7 @@ bool widget::Button::LoadXML(exml::Element* _node)
SetToggleMode(true); SetToggleMode(true);
SetSubWidgetToggle(tmpWidget); SetSubWidgetToggle(tmpWidget);
} }
if (false == tmpWidget->LoadXML((exml::Element*)pNode)) { if (false == tmpWidget->LoadXML(pNode)) {
EWOL_ERROR ("(l "<<pNode->Pos()<<") can not load widget properties : \"" << widgetName << "\""); EWOL_ERROR ("(l "<<pNode->Pos()<<") can not load widget properties : \"" << widgetName << "\"");
return false; return false;
} }

View File

@ -178,12 +178,9 @@ bool widget::Container::LoadXML(exml::Element* _node)
// parse all the elements : // parse all the elements :
for(int32_t iii=0; iii< _node->Size(); iii++) { for(int32_t iii=0; iii< _node->Size(); iii++) {
exml::Node* pNode = _node->Get(iii); exml::Element* pNode = _node->GetElement(iii);
if (pNode==NULL) { if (pNode==NULL) {
continue; // trash here all that is not element
}
if (!pNode->IsElement()) {
// nothing to do, just proceed to next step
continue; continue;
} }
etk::UString widgetName = pNode->GetValue(); etk::UString widgetName = pNode->GetValue();
@ -203,7 +200,7 @@ bool widget::Container::LoadXML(exml::Element* _node)
} }
// add widget : // add widget :
SetSubWidget(tmpWidget); SetSubWidget(tmpWidget);
if (false == tmpWidget->LoadXML((exml::Element*)pNode)) { if (false == tmpWidget->LoadXML(pNode)) {
EWOL_ERROR ("(l "<<pNode->Pos()<<") can not load widget properties : \"" << widgetName << "\""); EWOL_ERROR ("(l "<<pNode->Pos()<<") can not load widget properties : \"" << widgetName << "\"");
return false; return false;
} }

View File

@ -304,12 +304,9 @@ bool widget::ContainerN::LoadXML(exml::Element* _node)
} }
// parse all the elements : // parse all the elements :
for(int32_t iii=0; iii< _node->Size(); iii++) { for(int32_t iii=0; iii< _node->Size(); iii++) {
exml::Node* pNode = _node->Get(iii); exml::Element* pNode = _node->GetElement(iii);
if (pNode==NULL) { if (pNode==NULL) {
continue; // trash here all that is not element
}
if (!pNode->IsElement()) {
// nothing to do, just proceed to next step
continue; continue;
} }
etk::UString widgetName = pNode->GetValue(); etk::UString widgetName = pNode->GetValue();
@ -329,7 +326,7 @@ bool widget::ContainerN::LoadXML(exml::Element* _node)
} else { } else {
SubWidgetAddStart(subWidget); SubWidgetAddStart(subWidget);
} }
if (false == subWidget->LoadXML((exml::Element*)pNode)) { if (false == subWidget->LoadXML(pNode)) {
EWOL_ERROR ("[" << GetId() << "] {" << GetObjectType() << "} (l "<<pNode->Pos()<<") can not load widget properties : \"" << widgetName << "\""); EWOL_ERROR ("[" << GetId() << "] {" << GetObjectType() << "} (l "<<pNode->Pos()<<") can not load widget properties : \"" << widgetName << "\"");
return false; return false;
} }

View File

@ -142,8 +142,7 @@ bool widget::Label::LoadXML(exml::Element* _node)
} }
ewol::Widget::LoadXML(_node); ewol::Widget::LoadXML(_node);
// get internal data : // get internal data :
// TODO : Unparse data type XML ... EWOL_DEBUG("Load label:" << _node->GetText());
EWOL_DEBUG("Load label:" << _node->GetValue()); SetLabel(_node->GetText());
SetLabel(_node->GetValue());
return true; return true;
} }

View File

@ -98,7 +98,7 @@ int32_t widget::Menu::Add(int32_t parent, etk::UString label, etk::UString image
" <image src=\"" + tmpObject->m_image + "\" size=\"8,8mm\"/>\n" " <image src=\"" + tmpObject->m_image + "\" size=\"8,8mm\"/>\n"
" <label>" + label + "</label>\n" " <label>" + label + "</label>\n"
" </sizer>\n" " </sizer>\n"
"</composer\n")); "</composer>\n"));
} else { } else {
myButton->SetSubWidget( new widget::Label(label) ); myButton->SetSubWidget( new widget::Label(label) );
} }
@ -219,7 +219,7 @@ void widget::Menu::OnReceiveMessage(const ewol::EMessage& _msg)
" </sizer>\n" " </sizer>\n"
"</composer>\n")); "</composer>\n"));
} else { } else {
widget::Label* tmpLabel = new widget::Label(etk::UString("<left>") + m_listElement[jjj]->m_label + "</left>"); widget::Label* tmpLabel = new widget::Label(etk::UString("<left>") + m_listElement[jjj]->m_label + "</left>\n");
if (NULL != tmpLabel) { if (NULL != tmpLabel) {
tmpLabel->SetExpand(bvec2(true,false)); tmpLabel->SetExpand(bvec2(true,false));
tmpLabel->SetFill(bvec2(true,true)); tmpLabel->SetFill(bvec2(true,true));

View File

@ -154,7 +154,7 @@ widget::FileChooser::FileChooser(void)
" <image src=\"THEME:GUI:Load.svg\" expand=\"true\" size=\"8,8mm\"/>\n" " <image src=\"THEME:GUI:Load.svg\" expand=\"true\" size=\"8,8mm\"/>\n"
" <label>Validate</label>\n" " <label>Validate</label>\n"
" </sizer>\n" " </sizer>\n"
"</composer\n")); "</composer>\n"));
m_widgetValidate->RegisterOnEvent(this, widget::Button::eventPressed, ewolEventFileChooserValidate); m_widgetValidate->RegisterOnEvent(this, widget::Button::eventPressed, ewolEventFileChooserValidate);
mySizerHori->SubWidgetAdd(m_widgetValidate); mySizerHori->SubWidgetAdd(m_widgetValidate);
} }
@ -169,7 +169,7 @@ widget::FileChooser::FileChooser(void)
" <image src=\"THEME:GUI:Remove.svg\" expand=\"true\" size=\"8,8mm\"/>\n" " <image src=\"THEME:GUI:Remove.svg\" expand=\"true\" size=\"8,8mm\"/>\n"
" <label>Cancel</label>\n" " <label>Cancel</label>\n"
" </sizer>\n" " </sizer>\n"
"</composer\n")); "</composer>\n"));
m_widgetCancel->RegisterOnEvent(this, widget::Button::eventPressed, ewolEventFileChooserCancel); m_widgetCancel->RegisterOnEvent(this, widget::Button::eventPressed, ewolEventFileChooserCancel);
mySizerHori->SubWidgetAdd(m_widgetCancel); mySizerHori->SubWidgetAdd(m_widgetCancel);
} }

View File

@ -80,7 +80,7 @@ widget::Parameter::Parameter(void) :
" <image src=\"THEME:GUI:Save.svg\" expand=\"true\" size=\"8,8mm\"/>\n" " <image src=\"THEME:GUI:Save.svg\" expand=\"true\" size=\"8,8mm\"/>\n"
" <label>Save</label>\n" " <label>Save</label>\n"
" </sizer>\n" " </sizer>\n"
"</composer\n")); "</composer llll>\n"));
tmpButton->RegisterOnEvent(this, widget::Button::eventPressed, ewolEventParameterSave); tmpButton->RegisterOnEvent(this, widget::Button::eventPressed, ewolEventParameterSave);
mySizerHori->SubWidgetAdd(tmpButton); mySizerHori->SubWidgetAdd(tmpButton);
} }
@ -105,7 +105,7 @@ widget::Parameter::Parameter(void) :
" <image src=\"THEME:GUI:Remove.svg\" expand=\"true\" size=\"8,8mm\"/>\n" " <image src=\"THEME:GUI:Remove.svg\" expand=\"true\" size=\"8,8mm\"/>\n"
" <label>Close</label>\n" " <label>Close</label>\n"
" </sizer>\n" " </sizer>\n"
"</composer\n")); "</composer>\n"));
tmpButton->RegisterOnEvent(this, widget::Button::eventPressed, ewolEventParameterClose); tmpButton->RegisterOnEvent(this, widget::Button::eventPressed, ewolEventParameterClose);
mySizerHori->SubWidgetAdd(tmpButton); mySizerHori->SubWidgetAdd(tmpButton);
} }