[DEBUG] remove some basic bug

This commit is contained in:
Edouard DUPIN 2013-12-29 20:56:44 +01:00
parent f9ec8d0f12
commit 7bf47a6c12
15 changed files with 116 additions and 67 deletions

2
external/egami vendored

@ -1 +1 @@
Subproject commit 0da224d3e4c49445352258cc9247a98a6214e5f8
Subproject commit 20ac6565ca545f15249fc9d492e2aed175624fad

2
external/ege vendored

@ -1 +1 @@
Subproject commit 8f291a74be65fa6a543a734c4fd0c2375a36aecf
Subproject commit e23442beb1bec4fef48b9d7bb3aff8119a2909fd

2
external/ejson vendored

@ -1 +1 @@
Subproject commit 39dfd1793b0873a8bcb973b6e126d9eb35bd1d0e
Subproject commit fbf39d9ac20b7666f907154b58c8f7872bb1e271

2
external/esvg vendored

@ -1 +1 @@
Subproject commit 05790483276c1340e623b0050fa8acefcd8a5bc7
Subproject commit f24b85275216f3a072a1e8c1bec33f3eabd10de7

2
external/exml vendored

@ -1 +1 @@
Subproject commit f8526c27e002c5c9d87b328fb7f776423aff2a73
Subproject commit a420811f5928bf2a972aace1df8898079dc43abf

2
monk

@ -1 +1 @@
Subproject commit 999a8a98bfc4075871b46ac29994c08b05f311de
Subproject commit 3ce578dac170394152c12478d24f8fbc7e8b01f1

View File

@ -283,11 +283,10 @@ bool ewol::Object::loadXML(exml::Element* _node) {
if (m_listConfig[iii].getConfig() == NULL) {
continue;
}
std::string value = _node->getAttribute(m_listConfig[iii].getConfig());
// check existance :
if (value.size() == 0) {
if (_node->existAttribute(m_listConfig[iii].getConfig()) == false) {
continue;
}
std::string value = _node->getAttribute(m_listConfig[iii].getConfig());
if (false == setConfig(ewol::object::Config(m_listConfig[iii].getConfig(), value) ) ) {
errorOccured = false;
}

View File

@ -83,6 +83,7 @@ ewol::widget::Button::~Button(void) {
void ewol::widget::Button::setShaperName(const std::string& _shaperName) {
EWOL_WARNING("set shaper name : '" << _shaperName << "'");
m_shaper.setSource(_shaperName);
markToRedraw();
}

View File

@ -16,6 +16,7 @@
#define __class__ "Label"
const char * const ewol::widget::Label::eventPressed = "pressed";
const char* const ewol::widget::Label::configValue = "value";
static ewol::Widget* create(void) {
return new ewol::widget::Label();
@ -30,10 +31,12 @@ ewol::widget::Label::Label(std::string _newLabel) {
m_label = _newLabel;
addEventId(eventPressed);
setCanHaveFocus(false);
registerConfig(configValue, "string", NULL, "displayed value string"); // TODO : do not store in attibute...
}
void ewol::widget::Label::calculateMinMaxSize(void) {
vec2 tmpMax = m_userMaxSize.getPixel();
vec2 tmpMin = m_userMinSize.getPixel();
//EWOL_DEBUG("[" << getId() << "] {" << getObjectType() << "} tmpMax : " << tmpMax);
if (tmpMax.x() <= 999999) {
m_text.setTextAlignement(0, tmpMax.x()-4, ewol::compositing::Text::alignLeft);
@ -42,9 +45,9 @@ void ewol::widget::Label::calculateMinMaxSize(void) {
vec3 minSize = m_text.calculateSizeDecorated(m_label);
//EWOL_DEBUG("[" << getId() << "] {" << getObjectType() << "} minSize : " << minSize);
m_minSize.setX(etk_min(4 + minSize.x(), tmpMax.x()));
m_minSize.setY(etk_min(4 + minSize.y(), tmpMax.y()));
//EWOL_ERROR("[" << getId() << "] {" << getObjectType() << "} Result min size : " << m_minSize);
m_minSize.setX(etk_avg(tmpMin.x(), 4 + minSize.x(), tmpMax.x()));
m_minSize.setY(etk_avg(tmpMin.y(), 4 + minSize.y(), tmpMax.y()));
EWOL_VERBOSE("[" << getId() << "] {" << getObjectType() << "} Result min size : " << tmpMin << " < " << m_minSize << " < " << tmpMax);
}
void ewol::widget::Label::setLabel(const std::string& _newLabel) {
@ -53,7 +56,7 @@ void ewol::widget::Label::setLabel(const std::string& _newLabel) {
requestUpdateSize();
}
std::string ewol::widget::Label::getLabel(void) {
std::string ewol::widget::Label::getLabel(void) const {
return m_label;
}
@ -62,52 +65,57 @@ void ewol::widget::Label::onDraw(void) {
}
void ewol::widget::Label::onRegenerateDisplay(void) {
if (true == needRedraw()) {
m_text.clear();
int32_t paddingSize = 2;
vec2 tmpMax = m_userMaxSize.getPixel();
// to know the size of one line :
vec3 minSize = m_text.calculateSize(char32_t('A'));
if (tmpMax.x() <= 999999) {
m_text.setTextAlignement(0, tmpMax.x()-2*paddingSize, ewol::compositing::Text::alignLeft);
}
vec3 curentTextSize = m_text.calculateSizeDecorated(m_label);
ivec2 localSize = m_minSize;
// no change for the text orogin :
vec3 tmpTextOrigin((m_size.x() - m_minSize.x()) / 2.0,
(m_size.y() - m_minSize.y()) / 2.0,
0);
if (true == m_userFill.x()) {
localSize.setX(m_size.x());
tmpTextOrigin.setX(0);
}
if (true == m_userFill.y()) {
localSize.setY(m_size.y());
tmpTextOrigin.setY(m_size.y() - 2*paddingSize - curentTextSize.y());
}
tmpTextOrigin += vec3(paddingSize, paddingSize, 0);
localSize -= vec2(2*paddingSize,2*paddingSize);
tmpTextOrigin.setY( tmpTextOrigin.y() + (m_minSize.y()-2*paddingSize) - minSize.y());
vec2 textPos(tmpTextOrigin.x(), tmpTextOrigin.y());
vec3 drawClippingPos(paddingSize, paddingSize, -0.5);
vec3 drawClippingSize((m_size.x() - paddingSize),
(m_size.y() - paddingSize),
1);
// clean the element
m_text.reset();
m_text.setPos(tmpTextOrigin);
m_text.setTextAlignement(tmpTextOrigin.x(), tmpTextOrigin.x()+localSize.x(), ewol::compositing::Text::alignLeft);
m_text.setClipping(drawClippingPos, drawClippingSize);
m_text.printDecorated(m_label);
if (needRedraw() == false) {
return;
}
m_text.clear();
int32_t paddingSize = 2;
vec2 tmpMax = m_userMaxSize.getPixel();
// to know the size of one line :
vec3 minSize = m_text.calculateSize(char32_t('A'));
minSize.setX(etk_max(minSize.x(), m_minSize.x()));
minSize.setY(etk_max(minSize.y(), m_minSize.y()));
if (tmpMax.x() <= 999999) {
m_text.setTextAlignement(0, tmpMax.x()-2*paddingSize, ewol::compositing::Text::alignLeft);
}
vec3 curentTextSize = m_text.calculateSizeDecorated(m_label);
ivec2 localSize = m_minSize;
// no change for the text orogin :
vec3 tmpTextOrigin((m_size.x() - m_minSize.x()) / 2.0,
(m_size.y() - m_minSize.y()) / 2.0,
0);
if (true == m_userFill.x()) {
localSize.setX(m_size.x());
tmpTextOrigin.setX(0);
}
if (true == m_userFill.y()) {
localSize.setY(m_size.y());
tmpTextOrigin.setY(m_size.y() - 2*paddingSize - curentTextSize.y());
}
tmpTextOrigin += vec3(paddingSize, paddingSize, 0);
localSize -= vec2(2*paddingSize,2*paddingSize);
tmpTextOrigin.setY( tmpTextOrigin.y() + (m_minSize.y()-2*paddingSize) - minSize.y());
vec2 textPos(tmpTextOrigin.x(), tmpTextOrigin.y());
vec3 drawClippingPos(paddingSize, paddingSize, -0.5);
vec3 drawClippingSize((m_size.x() - paddingSize),
(m_size.y() - paddingSize),
1);
// clean the element
m_text.reset();
m_text.setPos(tmpTextOrigin);
EWOL_VERBOSE("[" << getId() << "] {" << m_label << "} display at pos : " << tmpTextOrigin);
m_text.setTextAlignement(tmpTextOrigin.x(), tmpTextOrigin.x()+localSize.x(), ewol::compositing::Text::alignLeft);
m_text.setClipping(drawClippingPos, drawClippingSize);
m_text.printDecorated(m_label);
}
bool ewol::widget::Label::onEventInput(const ewol::event::Input& _event) {
@ -133,3 +141,27 @@ bool ewol::widget::Label::loadXML(exml::Element* _node) {
return true;
}
bool ewol::widget::Label::onSetConfig(const ewol::object::Config& _conf) {
if (true == ewol::Widget::onSetConfig(_conf)) {
return true;
}
if (_conf.getConfig() == configValue) {
setLabel(_conf.getData());
return true;
}
return false;
}
bool ewol::widget::Label::onGetConfig(const char* _config, std::string& _result) const {
if (true == ewol::Widget::onGetConfig(_config, _result)) {
return true;
}
if (_config == configValue) {
_result = getLabel();
return true;
}
return false;
}

View File

@ -24,6 +24,8 @@ namespace ewol {
public:
// Event list of properties
static const char * const eventPressed;
// Config list of properties
static const char* const configValue;
/**
* @brief Main call of recording the widget on the List of "widget named creator"
*/
@ -48,6 +50,7 @@ namespace ewol {
* @param[in] _newLabel The displayed decorated text.
*/
void setLabel(const std::string& _newLabel);
//! @previous
inline void setValue(const std::string& _newLabel) {
setLabel(_newLabel);
};
@ -55,12 +58,15 @@ namespace ewol {
* @brief get the current displayed label
* @return The displayed decorated text.
*/
std::string getLabel(void);
inline std::string getValue(void) {
std::string getLabel(void) const;
//! @previous
inline std::string getValue(void) const {
return getLabel();
};
protected: // Derived function
virtual void onDraw(void);
virtual bool onSetConfig(const ewol::object::Config& _conf);
virtual bool onGetConfig(const char* _config, std::string& _result) const;
public: // Derived function
virtual void calculateMinMaxSize(void);
virtual void onRegenerateDisplay(void);

View File

View File

View File

@ -58,7 +58,7 @@ enum ewol::widget::Sizer::displayMode ewol::widget::Sizer::getMode(void) {
void ewol::widget::Sizer::calculateSize(const vec2& _availlable) {
ewol::Widget::calculateSize(_availlable);
vec2 tmpBorderSize = m_borderSize.getPixel();
//EWOL_DEBUG("[" << getId() << "] update size : " << _availlable << " nbElement : " << m_subWidget.size() << " borderSize=" << tmpBorderSize << " from border=" << m_borderSize);
EWOL_VERBOSE("[" << getId() << "] update size : " << _availlable << " nbElement : " << m_subWidget.size() << " borderSize=" << tmpBorderSize << " from border=" << m_borderSize);
m_size -= tmpBorderSize*2;
// calculate unExpandable size :
float unexpandableSize=0.0;
@ -102,7 +102,7 @@ void ewol::widget::Sizer::calculateSize(const vec2& _availlable) {
if (NULL != m_subWidget[iii]) {
vec2 tmpSize = m_subWidget[iii]->getCalculateMinSize();
// set the origin :
//EWOL_DEBUG("[" << getId() << "] set iii=" << iii << " ORIGIN : " << tmpOrigin << " & offset=" << m_offset);
EWOL_VERBOSE("[" << getId() << "] set iii=" << iii << " ORIGIN : " << tmpOrigin << " & offset=" << m_offset);
m_subWidget[iii]->setOrigin(vec2ClipInt32(tmpOrigin+m_offset));
// Now update his size his size in X and the curent sizer size in Y:
if (m_mode == ewol::widget::Sizer::modeVert) {
@ -129,11 +129,11 @@ void ewol::widget::Sizer::calculateSize(const vec2& _availlable) {
}
void ewol::widget::Sizer::calculateMinMaxSize(void) {
//EWOL_DEBUG("[" << getId() << "] update minimum size");
EWOL_VERBOSE("[" << getId() << "] update minimum size");
m_subExpend.setValue(false, false);
m_minSize = m_userMinSize.getPixel();
vec2 tmpBorderSize = m_borderSize.getPixel();
//EWOL_ERROR("[" << getId() << "] {" << getObjectType() << "} set min size : " << m_minSize);
EWOL_VERBOSE("[" << getId() << "] {" << getObjectType() << "} set min size : " << m_minSize);
m_minSize += tmpBorderSize*2;
for (int32_t iii=0; iii<m_subWidget.size(); iii++) {
if (NULL != m_subWidget[iii]) {
@ -145,8 +145,8 @@ void ewol::widget::Sizer::calculateMinMaxSize(void) {
m_subExpend.setY(true);
}
vec2 tmpSize = m_subWidget[iii]->getCalculateMinSize();
//EWOL_DEBUG("[" << getId() << "] NewMinSize=" << tmpSize);
//EWOL_DEBUG("[" << getId() << "] {" << getObjectType() << "} Get minSize[" << iii << "] "<< tmpSize);
EWOL_VERBOSE("[" << getId() << "] NewMinSize=" << tmpSize);
EWOL_VERBOSE("[" << getId() << "] {" << getObjectType() << "} Get minSize[" << iii << "] "<< tmpSize);
if (m_mode == ewol::widget::Sizer::modeVert) {
m_minSize.setY(m_minSize.y() + tmpSize.y());
if (tmpSize.x()>m_minSize.x()) {

View File

@ -28,6 +28,7 @@ const char* const ewol::widget::WSlider::eventStartSlide = "ewol-widget-wslider-
const char* const ewol::widget::WSlider::eventStopSlide = "ewol-widget-wslider-event-stop-slide";
// Config list of properties
const char* const ewol::widget::WSlider::configMode = "mode";
const char* const ewol::widget::WSlider::configSpeed = "speed";
static ewol::Widget* create(void) {
return new ewol::widget::WSlider();
@ -49,6 +50,7 @@ ewol::widget::WSlider::WSlider(void) :
addEventId(eventStopSlide);
// add configuration
registerConfig(configMode, "list", "vert;hori", "Transition mode of the slider");
registerConfig(configSpeed, "float", NULL, "Transition speed of the slider");
}
ewol::widget::WSlider::~WSlider(void) {
@ -283,6 +285,10 @@ bool ewol::widget::WSlider::onSetConfig(const ewol::object::Config& _conf) {
setTransitionMode(tmpTransition);
return true;
}
if (_conf.getConfig() == configSpeed) {
setTransitionSpeed(std::stof(_conf.getData()));
return true;
}
return false;
}
@ -302,6 +308,10 @@ bool ewol::widget::WSlider::onGetConfig(const char* _config, std::string& _resul
}
return true;
}
if (_config == configMode) {
_result = std::to_string(getTransitionSpeed());
return true;
}
return false;
}

View File

@ -28,6 +28,7 @@ namespace ewol {
// Config list of properties
// TODO : remove the dynamic transition and set this in annimation ...
static const char* const configMode;
static const char* const configSpeed;
enum sladingMode {
sladingTransitionVert,
sladingTransitionHori,
@ -77,7 +78,7 @@ namespace ewol {
* @brief get transition speed element.
* @return number of second needed to do the transition.
*/
float getTransitionSpeed(void) {
float getTransitionSpeed(void) const {
return m_transitionSpeed;
};
private: