[DEV] update some interface
This commit is contained in:
parent
ad0018be8d
commit
ea4515f63c
@ -257,7 +257,10 @@ bool ewol::compositing::Shaper::periodicCall(const ewol::event::Time& _event) {
|
|||||||
m_nextStatusRequested = -1;
|
m_nextStatusRequested = -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
float timeRelativity = m_config->getNumber(m_confIdChangeTime) / 1000.0;
|
float timeRelativity = 0.0f;
|
||||||
|
if (m_config != nullptr) {
|
||||||
|
timeRelativity = m_config->getNumber(m_confIdChangeTime) / 1000.0;
|
||||||
|
}
|
||||||
m_stateTransition += _event.getDeltaCall() / timeRelativity;
|
m_stateTransition += _event.getDeltaCall() / timeRelativity;
|
||||||
//m_stateTransition += _event.getDeltaCall();
|
//m_stateTransition += _event.getDeltaCall();
|
||||||
m_stateTransition = std::avg(0.0f, m_stateTransition, 1.0f);
|
m_stateTransition = std::avg(0.0f, m_stateTransition, 1.0f);
|
||||||
@ -471,10 +474,11 @@ void ewol::compositing::Shaper::setShape(const vec2& _origin, const vec2& _size,
|
|||||||
EWOL_ERROR(" inside = " << inside);
|
EWOL_ERROR(" inside = " << inside);
|
||||||
*/
|
*/
|
||||||
int32_t mode = 0;
|
int32_t mode = 0;
|
||||||
|
bool displayOutside = false;
|
||||||
if (m_config != nullptr) {
|
if (m_config != nullptr) {
|
||||||
mode = m_config->getNumber(m_confIdMode);
|
mode = m_config->getNumber(m_confIdMode);
|
||||||
|
displayOutside = m_config->getBoolean(m_confIdDisplayOutside);
|
||||||
}
|
}
|
||||||
bool displayOutside = m_config->getBoolean(m_confIdDisplayOutside);
|
|
||||||
m_nbVertexToDisplay = 0;
|
m_nbVertexToDisplay = 0;
|
||||||
if (displayOutside == true) {
|
if (displayOutside == true) {
|
||||||
addVertexLine(enveloppe.yTop(), border.yTop(),
|
addVertexLine(enveloppe.yTop(), border.yTop(),
|
||||||
|
@ -106,33 +106,40 @@ void ewol::Context::onCreate(gale::Context& _context) {
|
|||||||
#endif
|
#endif
|
||||||
*/
|
*/
|
||||||
EWOL_INFO(" == > Ewol system init (END)");
|
EWOL_INFO(" == > Ewol system init (END)");
|
||||||
if (m_application == nullptr) {
|
std::shared_ptr<ewol::context::Application> appl = m_application;
|
||||||
|
if (appl == nullptr) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
m_application->onCreate(*this);
|
appl->onCreate(*this);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ewol::Context::onStart(gale::Context& _context) {
|
void ewol::Context::onStart(gale::Context& _context) {
|
||||||
if (m_application == nullptr) {
|
std::shared_ptr<ewol::context::Application> appl = m_application;
|
||||||
|
if (appl == nullptr) {
|
||||||
// TODO : Request exit of the application .... with error ...
|
// TODO : Request exit of the application .... with error ...
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
m_application->onStart(*this);
|
appl->onStart(*this);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ewol::Context::onResume(gale::Context& _context) {
|
void ewol::Context::onResume(gale::Context& _context) {
|
||||||
m_application->onResume(*this);
|
std::shared_ptr<ewol::context::Application> appl = m_application;
|
||||||
|
if (appl == nullptr) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
appl->onResume(*this);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ewol::Context::onRegenerateDisplay(gale::Context& _context) {
|
void ewol::Context::onRegenerateDisplay(gale::Context& _context) {
|
||||||
//EWOL_INFO("REGENERATE_DISPLAY");
|
//EWOL_INFO("REGENERATE_DISPLAY");
|
||||||
// check if the user selected a windows
|
// check if the user selected a windows
|
||||||
if (m_windowsCurrent == nullptr) {
|
std::shared_ptr<ewol::widget::Windows> window = m_windowsCurrent;
|
||||||
|
if (window == nullptr) {
|
||||||
EWOL_INFO("No windows ...");
|
EWOL_INFO("No windows ...");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// Redraw all needed elements
|
// Redraw all needed elements
|
||||||
m_windowsCurrent->onRegenerateDisplay();
|
window->onRegenerateDisplay();
|
||||||
if (m_widgetManager.isDrawingNeeded() == true) {
|
if (m_widgetManager.isDrawingNeeded() == true) {
|
||||||
markDrawingIsNeeded();
|
markDrawingIsNeeded();
|
||||||
}
|
}
|
||||||
@ -144,18 +151,27 @@ void ewol::Context::onDraw(gale::Context& _context) {
|
|||||||
// clean internal data...
|
// clean internal data...
|
||||||
m_objectManager.cleanInternalRemoved();
|
m_objectManager.cleanInternalRemoved();
|
||||||
// real draw...
|
// real draw...
|
||||||
if (m_windowsCurrent == nullptr) {
|
std::shared_ptr<ewol::widget::Windows> window = m_windowsCurrent;
|
||||||
|
if (window == nullptr) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
m_windowsCurrent->sysDraw();
|
window->sysDraw();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ewol::Context::onPause(gale::Context& _context) {
|
void ewol::Context::onPause(gale::Context& _context) {
|
||||||
m_application->onPause(*this);
|
std::shared_ptr<ewol::context::Application> appl = m_application;
|
||||||
|
if (appl == nullptr) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
appl->onPause(*this);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ewol::Context::onStop(gale::Context& _context) {
|
void ewol::Context::onStop(gale::Context& _context) {
|
||||||
m_application->onStop(*this);
|
std::shared_ptr<ewol::context::Application> appl = m_application;
|
||||||
|
if (appl == nullptr) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
appl->onStop(*this);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ewol::Context::onDestroy(gale::Context& _context) {
|
void ewol::Context::onDestroy(gale::Context& _context) {
|
||||||
@ -164,9 +180,12 @@ void ewol::Context::onDestroy(gale::Context& _context) {
|
|||||||
m_windowsCurrent.reset();
|
m_windowsCurrent.reset();
|
||||||
// clean all widget and sub widget with their resources:
|
// clean all widget and sub widget with their resources:
|
||||||
m_objectManager.cleanInternalRemoved();
|
m_objectManager.cleanInternalRemoved();
|
||||||
// call application to uninit
|
std::shared_ptr<ewol::context::Application> appl = m_application;
|
||||||
m_application->onDestroy(*this);
|
if (appl != nullptr) {
|
||||||
m_application.reset();
|
// call application to uninit
|
||||||
|
appl->onDestroy(*this);
|
||||||
|
m_application.reset();
|
||||||
|
}
|
||||||
// internal clean elements
|
// internal clean elements
|
||||||
m_objectManager.cleanInternalRemoved();
|
m_objectManager.cleanInternalRemoved();
|
||||||
EWOL_INFO("List of all widget of this context must be equal at 0 ==> otherwise some remove is missing");
|
EWOL_INFO("List of all widget of this context must be equal at 0 ==> otherwise some remove is missing");
|
||||||
|
@ -53,8 +53,12 @@ ewol::resource::Texture::~Texture() {
|
|||||||
}
|
}
|
||||||
#include <egami/wrapperBMP.h>
|
#include <egami/wrapperBMP.h>
|
||||||
|
|
||||||
void ewol::resource::Texture::updateContext() {
|
bool ewol::resource::Texture::updateContext() {
|
||||||
std11::unique_lock<std11::recursive_mutex> lock(m_mutex);
|
std11::unique_lock<std11::recursive_mutex> lock(m_mutex, std11::defer_lock);
|
||||||
|
if (lock.try_lock() == false) {
|
||||||
|
//Lock error ==> try later ...
|
||||||
|
return false;
|
||||||
|
}
|
||||||
if (false == m_loaded) {
|
if (false == m_loaded) {
|
||||||
// Request a new texture at openGl :
|
// Request a new texture at openGl :
|
||||||
glGenTextures(1, &m_texId);
|
glGenTextures(1, &m_texId);
|
||||||
@ -85,6 +89,7 @@ void ewol::resource::Texture::updateContext() {
|
|||||||
m_data.getTextureDataPointer() );
|
m_data.getTextureDataPointer() );
|
||||||
// now the data is loaded
|
// now the data is loaded
|
||||||
m_loaded = true;
|
m_loaded = true;
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ewol::resource::Texture::removeContext() {
|
void ewol::resource::Texture::removeContext() {
|
||||||
|
@ -42,7 +42,7 @@ namespace ewol {
|
|||||||
};
|
};
|
||||||
// flush the data to send it at the openGl system
|
// flush the data to send it at the openGl system
|
||||||
void flush();
|
void flush();
|
||||||
void updateContext();
|
bool updateContext();
|
||||||
void removeContext();
|
void removeContext();
|
||||||
void removeContextToLate();
|
void removeContextToLate();
|
||||||
const ivec2& getOpenGlSize() const {
|
const ivec2& getOpenGlSize() const {
|
||||||
|
@ -26,7 +26,8 @@ ewol::widget::Image::Image() :
|
|||||||
m_keepRatio(*this, "ratio", true, "Keep ratio of the image"),
|
m_keepRatio(*this, "ratio", true, "Keep ratio of the image"),
|
||||||
m_posStart(*this, "part-start", vec2(0.0f, 0.0f), vec2(0.0f, 0.0f), vec2(1.0f, 1.0f), "Start display position in the image"),
|
m_posStart(*this, "part-start", vec2(0.0f, 0.0f), vec2(0.0f, 0.0f), vec2(1.0f, 1.0f), "Start display position in the image"),
|
||||||
m_posStop(*this, "part-stop", vec2(1.0f, 1.0f), vec2(0.0f, 0.0f), vec2(1.0f, 1.0f), "Start display position in the image"),
|
m_posStop(*this, "part-stop", vec2(1.0f, 1.0f), vec2(0.0f, 0.0f), vec2(1.0f, 1.0f), "Start display position in the image"),
|
||||||
m_distanceFieldMode(*this, "distance-field", false, "Distance field mode") {
|
m_distanceFieldMode(*this, "distance-field", false, "Distance field mode"),
|
||||||
|
m_smooth(*this, "smooth", true, "Smooth display of the image") {
|
||||||
addObjectType("ewol::widget::Image");
|
addObjectType("ewol::widget::Image");
|
||||||
m_colorProperty = ewol::resource::ColorFile::create("THEME:COLOR:Image.json");
|
m_colorProperty = ewol::resource::ColorFile::create("THEME:COLOR:Image.json");
|
||||||
if (m_colorProperty != nullptr) {
|
if (m_colorProperty != nullptr) {
|
||||||
@ -65,7 +66,7 @@ void ewol::widget::Image::onRegenerateDisplay() {
|
|||||||
vec2 imageBoder = m_border->getPixel();
|
vec2 imageBoder = m_border->getPixel();
|
||||||
vec2 origin = imageBoder;
|
vec2 origin = imageBoder;
|
||||||
imageBoder *= 2.0f;
|
imageBoder *= 2.0f;
|
||||||
vec2 imageRealSize = m_minSize - imageBoder;
|
vec2 imageRealSize = m_realllll - imageBoder;
|
||||||
vec2 imageRealSizeMax = m_size - imageBoder;
|
vec2 imageRealSizeMax = m_size - imageBoder;
|
||||||
|
|
||||||
vec2 ratioSizeDisplayRequested = m_posStop.get() - m_posStart.get();
|
vec2 ratioSizeDisplayRequested = m_posStop.get() - m_posStart.get();
|
||||||
@ -101,7 +102,11 @@ void ewol::widget::Image::onRegenerateDisplay() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// set the somposition properties :
|
// set the somposition properties :
|
||||||
m_compositing.setPos(origin);
|
if (m_smooth.get() == true) {
|
||||||
|
m_compositing.setPos(origin);
|
||||||
|
} else {
|
||||||
|
m_compositing.setPos(ivec2(origin));
|
||||||
|
}
|
||||||
m_compositing.printPart(imageRealSize, m_posStart, m_posStop);
|
m_compositing.printPart(imageRealSize, m_posStart, m_posStop);
|
||||||
//EWOL_DEBUG("Paint Image at : " << origin << " size=" << imageRealSize << " origin=" << origin);
|
//EWOL_DEBUG("Paint Image at : " << origin << " size=" << imageRealSize << " origin=" << origin);
|
||||||
EWOL_VERBOSE("Paint Image :" << m_fileName << " realsize=" << m_compositing.getRealSize() << " size=" << imageRealSize);
|
EWOL_VERBOSE("Paint Image :" << m_fileName << " realsize=" << m_compositing.getRealSize() << " size=" << imageRealSize);
|
||||||
@ -111,6 +116,7 @@ void ewol::widget::Image::onRegenerateDisplay() {
|
|||||||
void ewol::widget::Image::calculateMinMaxSize() {
|
void ewol::widget::Image::calculateMinMaxSize() {
|
||||||
vec2 imageBoder = m_border->getPixel()*2.0f;
|
vec2 imageBoder = m_border->getPixel()*2.0f;
|
||||||
vec2 imageSize = m_imageSize->getPixel();
|
vec2 imageSize = m_imageSize->getPixel();
|
||||||
|
vec2 size = m_userMinSize->getPixel();
|
||||||
if (imageSize!=vec2(0,0)) {
|
if (imageSize!=vec2(0,0)) {
|
||||||
m_minSize = imageBoder+imageSize;
|
m_minSize = imageBoder+imageSize;
|
||||||
m_maxSize = m_minSize;
|
m_maxSize = m_minSize;
|
||||||
@ -124,6 +130,9 @@ void ewol::widget::Image::calculateMinMaxSize() {
|
|||||||
m_maxSize = imageBoder+m_userMaxSize->getPixel();
|
m_maxSize = imageBoder+m_userMaxSize->getPixel();
|
||||||
m_minSize.setMin(m_maxSize);
|
m_minSize.setMin(m_maxSize);
|
||||||
}
|
}
|
||||||
|
m_realllll = m_minSize;
|
||||||
|
m_minSize.setMax(size);
|
||||||
|
m_maxSize.setMax(m_minSize);
|
||||||
//EWOL_DEBUG("set widget min=" << m_minSize << " max=" << m_maxSize << " with real Image size=" << imageSizeReal);
|
//EWOL_DEBUG("set widget min=" << m_minSize << " max=" << m_maxSize << " with real Image size=" << imageSizeReal);
|
||||||
markToRedraw();
|
markToRedraw();
|
||||||
}
|
}
|
||||||
@ -167,6 +176,10 @@ bool ewol::widget::Image::loadXML(const std::shared_ptr<const exml::Element>& _n
|
|||||||
if (tmpAttributeValue.size() != 0) {
|
if (tmpAttributeValue.size() != 0) {
|
||||||
m_border = tmpAttributeValue;
|
m_border = tmpAttributeValue;
|
||||||
}
|
}
|
||||||
|
tmpAttributeValue = _node->getAttribute("smooth");
|
||||||
|
if (tmpAttributeValue.size() != 0) {
|
||||||
|
m_smooth = etk::string_to_bool(tmpAttributeValue);
|
||||||
|
}
|
||||||
//EWOL_DEBUG("Load label:" << node->ToElement()->getText());
|
//EWOL_DEBUG("Load label:" << node->ToElement()->getText());
|
||||||
if (_node->size() != 0) {
|
if (_node->size() != 0) {
|
||||||
setFile(_node->getText());
|
setFile(_node->getText());
|
||||||
@ -195,5 +208,7 @@ void ewol::widget::Image::onParameterChangeValue(const ewol::parameter::Ref& _pa
|
|||||||
requestUpdateSize();
|
requestUpdateSize();
|
||||||
} else if (_paramPointer == m_distanceFieldMode) {
|
} else if (_paramPointer == m_distanceFieldMode) {
|
||||||
markToRedraw();
|
markToRedraw();
|
||||||
|
} else if (_paramPointer == m_smooth) {
|
||||||
|
markToRedraw();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -84,6 +84,7 @@ namespace ewol {
|
|||||||
};
|
};
|
||||||
protected:
|
protected:
|
||||||
ewol::parameter::Value<gale::Dimension> m_imageSize; //!< border to add at the image.
|
ewol::parameter::Value<gale::Dimension> m_imageSize; //!< border to add at the image.
|
||||||
|
vec2 m_realllll;
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
* @brief set tge Border size around the image
|
* @brief set tge Border size around the image
|
||||||
@ -142,7 +143,7 @@ namespace ewol {
|
|||||||
vec2 getStopPos() const {
|
vec2 getStopPos() const {
|
||||||
return m_posStop;
|
return m_posStop;
|
||||||
};
|
};
|
||||||
public:
|
protected:
|
||||||
ewol::parameter::Value<bool> m_distanceFieldMode; //!< to have a parameter
|
ewol::parameter::Value<bool> m_distanceFieldMode; //!< to have a parameter
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
@ -159,6 +160,23 @@ namespace ewol {
|
|||||||
bool getDistanceField() const {
|
bool getDistanceField() const {
|
||||||
return m_compositing.getDistanceFieldMode();
|
return m_compositing.getDistanceFieldMode();
|
||||||
}
|
}
|
||||||
|
protected:
|
||||||
|
ewol::parameter::Value<bool> m_smooth; //!< display is done in the pixed approximation if false
|
||||||
|
public:
|
||||||
|
/**
|
||||||
|
* @brief Set smooth rendering mode
|
||||||
|
* @param[in] _value enable smooting of the display
|
||||||
|
*/
|
||||||
|
void setSmooth(bool _value) {
|
||||||
|
m_smooth.set(_value);
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* @brief Get smooth rendering mode
|
||||||
|
* @return Status of the smooting render mode.
|
||||||
|
*/
|
||||||
|
bool getSmooth() const {
|
||||||
|
return m_smooth;
|
||||||
|
}
|
||||||
protected: // Derived function
|
protected: // Derived function
|
||||||
virtual void onDraw();
|
virtual void onDraw();
|
||||||
virtual void onParameterChangeValue(const ewol::parameter::Ref& _paramPointer);
|
virtual void onParameterChangeValue(const ewol::parameter::Ref& _paramPointer);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user