[DEV] correct shaper error in button and add checker of peridic call
This commit is contained in:
parent
3fc18f8e1d
commit
0cab58d32f
@ -100,7 +100,7 @@ void ewol::compositing::Shaper::loadProgram() {
|
||||
m_confIdPaddingIn[shaperPosRight] = m_config->request("padding-in-right");
|
||||
m_confIdPaddingIn[shaperPosTop] = m_config->request("padding-in-top");
|
||||
m_confIdPaddingIn[shaperPosButtom] = m_config->request("padding-in-buttom");
|
||||
m_confIdChangeTime = m_config->request("ChangeTime");
|
||||
m_confIdChangeTime = m_config->request("change-time");
|
||||
m_confProgramFile = m_config->request("program");
|
||||
m_confImageFile = m_config->request("image");
|
||||
m_confColorFile = m_config->request("color");
|
||||
@ -229,7 +229,7 @@ bool ewol::compositing::Shaper::changeStatusIn(int32_t _newStatusId) {
|
||||
}
|
||||
|
||||
bool ewol::compositing::Shaper::periodicCall(const ewol::event::Time& _event) {
|
||||
//EWOL_DEBUG("call=" << _event);
|
||||
EWOL_VERBOSE("call=" << _event << "state transition=" << m_stateTransition << " speedTime=" << m_config->getNumber(m_confIdChangeTime));
|
||||
// start :
|
||||
if (m_stateTransition >= 1.0) {
|
||||
m_stateOld = m_stateNew;
|
||||
@ -238,7 +238,7 @@ bool ewol::compositing::Shaper::periodicCall(const ewol::event::Time& _event) {
|
||||
m_stateNew = m_nextStatusRequested;
|
||||
m_nextStatusRequested = -1;
|
||||
m_stateTransition = 0.0;
|
||||
//EWOL_DEBUG(" ##### START ##### ");
|
||||
EWOL_VERBOSE(" ##### START ##### ");
|
||||
} else {
|
||||
m_nextStatusRequested = -1;
|
||||
// disable periodic call ...
|
||||
@ -261,7 +261,7 @@ bool ewol::compositing::Shaper::periodicCall(const ewol::event::Time& _event) {
|
||||
m_stateTransition += _event.getDeltaCall() / timeRelativity;
|
||||
//m_stateTransition += _event.getDeltaCall();
|
||||
m_stateTransition = std::avg(0.0f, m_stateTransition, 1.0f);
|
||||
//EWOL_DEBUG("relative=" << timeRelativity << " Transition : " << m_stateTransition);
|
||||
EWOL_VERBOSE("relative=" << timeRelativity << " Transition : " << m_stateTransition);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -300,7 +300,6 @@ void ewol::Context::requestUpdateSize() {
|
||||
}
|
||||
|
||||
void ewol::Context::onPeriod(int64_t _time) {
|
||||
EWOL_ERROR("_time=" << _time);
|
||||
m_objectManager.timeCall(_time);
|
||||
}
|
||||
|
||||
|
@ -73,6 +73,30 @@ namespace ewol {
|
||||
m_callerListInCallback.push_back(std::make_pair(std::weak_ptr<void>(_obj), _function));
|
||||
}
|
||||
}
|
||||
/**
|
||||
* @brief Check if an object is registered in the Signal
|
||||
* @param[in] _obj shared pointer on the object
|
||||
* @return true The object is connected at this signal.
|
||||
* @return false The object is NOT connected on this signal.
|
||||
*/
|
||||
bool isRegistered(std::shared_ptr<void> _obj) {
|
||||
if (_obj == nullptr) {
|
||||
return false;
|
||||
}
|
||||
for (auto &it : m_callerList) {
|
||||
std::shared_ptr<void> obj = it.first.lock();
|
||||
if (obj == _obj) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
for (auto &it : m_callerListInCallback) {
|
||||
std::shared_ptr<void> obj = it.first.lock();
|
||||
if (obj == _obj) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
/**
|
||||
* @brief remove link on the signal.
|
||||
* @param[in] _obj shared pointer on the removing object
|
||||
|
@ -205,7 +205,6 @@ void ewol::widget::Button::changeStatusIn(int32_t _newStatusId) {
|
||||
|
||||
|
||||
void ewol::widget::Button::periodicCall(const ewol::event::Time& _event) {
|
||||
EWOL_INFO("periodic : " << _event);
|
||||
if (false == m_shaper->periodicCall(_event) ) {
|
||||
periodicCallDisable();
|
||||
}
|
||||
|
@ -313,10 +313,17 @@ void ewol::Widget::systemDraw(const ewol::DrawProperty& _displayProp) {
|
||||
}
|
||||
|
||||
void ewol::Widget::periodicCallDisable() {
|
||||
EWOL_VERBOSE("Perodic call disable " << getName());
|
||||
getObjectManager().periodicCall.release(shared_from_this());
|
||||
}
|
||||
|
||||
void ewol::Widget::periodicCallEnable() {
|
||||
if (getObjectManager().periodicCall.isRegistered(shared_from_this()) == true) {
|
||||
EWOL_VERBOSE("Perodic call enable " << getName() << " ==> rejected");
|
||||
return;
|
||||
} else {
|
||||
EWOL_VERBOSE("Perodic call enable " << getName());
|
||||
}
|
||||
getObjectManager().periodicCall.bind(shared_from_this(), &ewol::Widget::periodicCall);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user