[PORT] step 1

This commit is contained in:
Edouard DUPIN 2021-02-22 22:08:08 +01:00
parent 8cbbe2f94e
commit 6cb8885b43
117 changed files with 1772 additions and 1772 deletions

View File

@ -15,7 +15,7 @@ etk::Stream& ewol::operator <<(etk::Stream& _os, const ewol::DrawProperty& _obj)
return _os; return _os;
} }
void ewol::DrawProperty::limit(const vec2& _origin, const vec2& _size) { void ewol::DrawProperty::limit(const Vector2f& _origin, const Vector2f& _size) {
m_size += m_origin; m_size += m_origin;
m_origin.setMax(_origin); m_origin.setMax(_origin);
m_size.setMin(_origin+_size); m_size.setMin(_origin+_size);

View File

@ -38,10 +38,10 @@ namespace ewol {
(0,0) (0,0)
*/ */
public : public :
ivec2 m_windowsSize; //!< Windows compleate size Vector2i m_windowsSize; //!< Windows compleate size
ivec2 m_origin; //!< Windows clipping upper widget (can not be <0) Vector2i m_origin; //!< Windows clipping upper widget (can not be <0)
ivec2 m_size; //!< Windows clipping upper widget (can not be <0 and >m_windowsSize) Vector2i m_size; //!< Windows clipping upper widget (can not be <0 and >m_windowsSize)
void limit(const vec2& _origin, const vec2& _size); void limit(const Vector2f& _origin, const Vector2f& _size);
}; };
etk::Stream& operator <<(etk::Stream& _os, const ewol::DrawProperty& _obj); etk::Stream& operator <<(etk::Stream& _os, const ewol::DrawProperty& _obj);

View File

@ -15,7 +15,7 @@ const int32_t ewol::compositing::Area::m_vboIdCoordText(1);
const int32_t ewol::compositing::Area::m_vboIdColor(2); const int32_t ewol::compositing::Area::m_vboIdColor(2);
#define NB_VBO (3) #define NB_VBO (3)
ewol::compositing::Area::Area(const ivec2& _size) : ewol::compositing::Area::Area(const Vector2i& _size) :
m_position(0.0, 0.0, 0.0), m_position(0.0, 0.0, 0.0),
m_color(etk::color::white), m_color(etk::color::white),
m_GLprogram(null), m_GLprogram(null),
@ -31,7 +31,7 @@ ewol::compositing::Area::Area(const ivec2& _size) :
// Create the VBO: // Create the VBO:
m_VBO = gale::resource::VirtualBufferObject::create(NB_VBO); m_VBO = gale::resource::VirtualBufferObject::create(NB_VBO);
if (m_VBO == null) { if (m_VBO == null) {
EWOL_ERROR("can not instanciate VBO ..."); Log.error("can not instanciate VBO ...");
return; return;
} }
// TO facilitate some debugs we add a name of the VBO: // TO facilitate some debugs we add a name of the VBO:
@ -66,7 +66,7 @@ void ewol::compositing::Area::draw(bool _disableDepthTest) {
return; return;
} }
if (m_GLprogram == null) { if (m_GLprogram == null) {
EWOL_ERROR("No shader ..."); Log.error("No shader ...");
return; return;
} }
// set Matrix : translation/positionMatrix // set Matrix : translation/positionMatrix
@ -92,12 +92,12 @@ void ewol::compositing::Area::clear() {
// reset all VBOs: // reset all VBOs:
m_VBO->clear(); m_VBO->clear();
// reset temporal variables : // reset temporal variables :
m_position = vec3(0.0, 0.0, 0.0); m_position = Vector3f(0.0, 0.0, 0.0);
} }
void ewol::compositing::Area::print(const ivec2& _size) { void ewol::compositing::Area::print(const Vector2i& _size) {
vec3 point(0,0,0); Vector3f point(0,0,0);
vec2 tex(0,1); Vector2f tex(0,1);
point.setX(m_position.x()); point.setX(m_position.x());
point.setY(m_position.y()); point.setY(m_position.y());
m_VBO->pushOnBuffer(m_vboIdCoord, point); m_VBO->pushOnBuffer(m_vboIdCoord, point);

View File

@ -17,7 +17,7 @@ namespace ewol {
namespace compositing { namespace compositing {
class Area : public ewol::Compositing { class Area : public ewol::Compositing {
private: private:
vec3 m_position; //!< The current position to draw Vector3f m_position; //!< The current position to draw
etk::Color<float,4> m_color; //!< The text foreground color etk::Color<float,4> m_color; //!< The text foreground color
private: private:
ememory::SharedPtr<gale::resource::Program> m_GLprogram; //!< pointer on the opengl display program ememory::SharedPtr<gale::resource::Program> m_GLprogram; //!< pointer on the opengl display program
@ -43,7 +43,7 @@ namespace ewol {
* @brief generic constructor * @brief generic constructor
* @param[in] _size Basic size of the area. * @param[in] _size Basic size of the area.
*/ */
Area(const ivec2& _size); Area(const Vector2i& _size);
/** /**
* @brief generic destructor * @brief generic destructor
*/ */
@ -61,34 +61,34 @@ namespace ewol {
* @brief get the current display position (sometime needed in the gui control) * @brief get the current display position (sometime needed in the gui control)
* @return the current position. * @return the current position.
*/ */
const vec3& getPos() { const Vector3f& getPos() {
return m_position; return m_position;
}; };
/** /**
* @brief set position for the next text writen * @brief set position for the next text writen
* @param[in] _pos Position of the text (in 3D) * @param[in] _pos Position of the text (in 3D)
*/ */
void setPos(const vec3& _pos) { void setPos(const Vector3f& _pos) {
m_position = _pos; m_position = _pos;
}; };
inline void setPos(const vec2& _pos) { inline void setPos(const Vector2f& _pos) {
setPos(vec3(_pos.x(),_pos.y(),0)); setPos(Vector3f(_pos.x(),_pos.y(),0));
}; };
/** /**
* @brief set relative position for the next text writen * @brief set relative position for the next text writen
* @param[in] _pos ofset apply of the text (in 3D) * @param[in] _pos ofset apply of the text (in 3D)
*/ */
void setRelPos(const vec3& _pos) { void setRelPos(const Vector3f& _pos) {
m_position += _pos; m_position += _pos;
}; };
inline void setRelPos(const vec2& _pos) { inline void setRelPos(const Vector2f& _pos) {
setRelPos(vec3(_pos.x(),_pos.y(),0)); setRelPos(Vector3f(_pos.x(),_pos.y(),0));
}; };
/** /**
* @brief add a compleate of the image to display with the requested size * @brief add a compleate of the image to display with the requested size
* @param[in] _size size of the output image * @param[in] _size size of the output image
*/ */
void print(const ivec2& _size); void print(const Vector2i& _size);
egami::Image& get() { egami::Image& get() {
return m_resource->get(); return m_resource->get();

View File

@ -22,17 +22,17 @@ void ewol::Compositing::resetMatrix() {
} }
void ewol::Compositing::translate(const vec3& _vect) { void ewol::Compositing::translate(const Vector3f& _vect) {
m_matrixApply *= etk::matTranslate(_vect); m_matrixApply *= etk::matTranslate(_vect);
} }
void ewol::Compositing::rotate(const vec3& _vect, float _angle) { void ewol::Compositing::rotate(const Vector3f& _vect, float _angle) {
m_matrixApply *= etk::matRotate(_vect, _angle); m_matrixApply *= etk::matRotate(_vect, _angle);
} }
void ewol::Compositing::scale(const vec3& _vect) { void ewol::Compositing::scale(const Vector3f& _vect) {
m_matrixApply *= etk::matScale(_vect); m_matrixApply *= etk::matScale(_vect);
} }

View File

@ -38,17 +38,17 @@ namespace ewol {
* @brief translate the current display of this element * @brief translate the current display of this element
* @param[in] _vect The translation vector to apply at the transformation matrix * @param[in] _vect The translation vector to apply at the transformation matrix
*/ */
virtual void translate(const vec3& _vect); virtual void translate(const Vector3f& _vect);
/** /**
* @brief rotate the curent display of this element * @brief rotate the curent display of this element
* @param[in] _vect The rotation vector to apply at the transformation matrix * @param[in] _vect The rotation vector to apply at the transformation matrix
*/ */
virtual void rotate(const vec3& _vect, float _angle); virtual void rotate(const Vector3f& _vect, float _angle);
/** /**
* @brief scale the current diaplsy of this element * @brief scale the current diaplsy of this element
* @param[in] _vect The scaling vector to apply at the transformation matrix * @param[in] _vect The scaling vector to apply at the transformation matrix
*/ */
virtual void scale(const vec3& _vect); virtual void scale(const Vector3f& _vect);
/** /**
* @brief set the transformation matrix * @brief set the transformation matrix
* @param[in] _mat The new matrix. * @param[in] _mat The new matrix.

View File

@ -17,7 +17,7 @@ const int32_t ewol::compositing::Drawing::m_vboIdColor(1);
#if 0 #if 0
static void generatePolyGone(etk::Vector<vec2 > & input, etk::Vector<vec2 > & output ) static void generatePolyGone(List<Vector2f > & input, List<Vector2f > & output )
{ {
if (input.size()<3) { if (input.size()<3) {
return; return;
@ -28,10 +28,10 @@ static void generatePolyGone(etk::Vector<vec2 > & input, etk::Vector<vec2 > & ou
output.pushBack(input[iii]); output.pushBack(input[iii]);
output.pushBack(input[iii+1]); output.pushBack(input[iii+1]);
} }
//EWOL_DEBUG("generate Plygone : " << input.size() << " == > " << output.size() ); //Log.debug("generate Plygone : " << input.size() << " == > " << output.size() );
} }
static void SutherlandHodgman(etk::Vector<vec2 > & input, etk::Vector<vec2 > & output, float sx, float sy, float ex, float ey) static void SutherlandHodgman(List<Vector2f > & input, List<Vector2f > & output, float sx, float sy, float ex, float ey)
{ {
// with Sutherland-Hodgman-Algorithm // with Sutherland-Hodgman-Algorithm
if (input.size() <0) { if (input.size() <0) {
@ -39,17 +39,17 @@ static void SutherlandHodgman(etk::Vector<vec2 > & input, etk::Vector<vec2 > & o
} }
//int32_t sizeInit=input.size(); //int32_t sizeInit=input.size();
// last element : // last element :
vec2 destPoint; Vector2f destPoint;
vec2 lastElement = input[input.size()-1]; Vector2f lastElement = input[input.size()-1];
bool inside = true; bool inside = true;
if (lastElement.x < sx) { if (lastElement.x < sx) {
inside = false; inside = false;
} }
//EWOL_DEBUG("generate an crop : "); //Log.debug("generate an crop : ");
for(int32_t iii=0; iii<input.size(); iii++) { for(int32_t iii=0; iii<input.size(); iii++) {
if(input[iii].x < sx) { if(input[iii].x < sx) {
if(true == inside) { if(true == inside) {
//EWOL_DEBUG("element IN == > OUT "); //Log.debug("element IN == > OUT ");
//new point intersection ... //new point intersection ...
//y=aaax+bbb //y=aaax+bbb
float aaa = (lastElement.y-input[iii].y) / (lastElement.x-input[iii].x); float aaa = (lastElement.y-input[iii].y) / (lastElement.x-input[iii].x);
@ -58,15 +58,15 @@ static void SutherlandHodgman(etk::Vector<vec2 > & input, etk::Vector<vec2 > & o
destPoint.x = sx; destPoint.x = sx;
output.pushBack(destPoint); output.pushBack(destPoint);
} else { } else {
//EWOL_DEBUG("element OUT == > OUT "); //Log.debug("element OUT == > OUT ");
} }
inside = false; inside = false;
} else { } else {
if(true == inside) { if(true == inside) {
//EWOL_DEBUG("element IN == > IN "); //Log.debug("element IN == > IN ");
output.pushBack(input[iii]); output.pushBack(input[iii]);
} else { } else {
//EWOL_DEBUG("element OUT == > IN "); //Log.debug("element OUT == > IN ");
//new point intersection ... //new point intersection ...
//y=aaax+bbb //y=aaax+bbb
float aaa = (lastElement.y-input[iii].y) / (lastElement.x-input[iii].x); float aaa = (lastElement.y-input[iii].y) / (lastElement.x-input[iii].x);
@ -83,7 +83,7 @@ static void SutherlandHodgman(etk::Vector<vec2 > & input, etk::Vector<vec2 > & o
lastElement.y = input[iii].y; lastElement.y = input[iii].y;
} }
//EWOL_DEBUG("generate an crop on element : " << sizeInit << " == > " << output.size() << "intermediate (1)"); //Log.debug("generate an crop on element : " << sizeInit << " == > " << output.size() << "intermediate (1)");
input = output; input = output;
output.clear(); output.clear();
lastElement = input[input.size()-1]; lastElement = input[input.size()-1];
@ -94,7 +94,7 @@ static void SutherlandHodgman(etk::Vector<vec2 > & input, etk::Vector<vec2 > & o
for(int32_t iii=0; iii<input.size(); iii++) { for(int32_t iii=0; iii<input.size(); iii++) {
if(input[iii].y < sy) { if(input[iii].y < sy) {
if(true == inside) { if(true == inside) {
//EWOL_DEBUG("element IN == > OUT "); //Log.debug("element IN == > OUT ");
//new point intersection ... //new point intersection ...
//x=aaay+bbb //x=aaay+bbb
float aaa = (lastElement.x-input[iii].x) / (lastElement.y-input[iii].y); float aaa = (lastElement.x-input[iii].x) / (lastElement.y-input[iii].y);
@ -103,15 +103,15 @@ static void SutherlandHodgman(etk::Vector<vec2 > & input, etk::Vector<vec2 > & o
destPoint.x = sy*aaa + bbb; destPoint.x = sy*aaa + bbb;
output.pushBack(destPoint); output.pushBack(destPoint);
} else { } else {
//EWOL_DEBUG("element OUT == > OUT "); //Log.debug("element OUT == > OUT ");
} }
inside = false; inside = false;
} else { } else {
if(true == inside) { if(true == inside) {
//EWOL_DEBUG("element IN == > IN "); //Log.debug("element IN == > IN ");
output.pushBack(input[iii]); output.pushBack(input[iii]);
} else { } else {
//EWOL_DEBUG("element OUT == > IN "); //Log.debug("element OUT == > IN ");
//new point intersection ... //new point intersection ...
//y=aaax+bbb //y=aaax+bbb
float aaa = (lastElement.x-input[iii].x) / (lastElement.y-input[iii].y); float aaa = (lastElement.x-input[iii].x) / (lastElement.y-input[iii].y);
@ -135,11 +135,11 @@ static void SutherlandHodgman(etk::Vector<vec2 > & input, etk::Vector<vec2 > & o
if (lastElement.x > ex) { if (lastElement.x > ex) {
inside = false; inside = false;
} }
//EWOL_DEBUG("generate an crop : "); //Log.debug("generate an crop : ");
for(int32_t iii=0; iii<input.size(); iii++) { for(int32_t iii=0; iii<input.size(); iii++) {
if(input[iii].x > ex) { if(input[iii].x > ex) {
if(true == inside) { if(true == inside) {
//EWOL_DEBUG("element IN == > OUT "); //Log.debug("element IN == > OUT ");
//new point intersection ... //new point intersection ...
//y=aaax+bbb //y=aaax+bbb
float aaa = (lastElement.y-input[iii].y) / (lastElement.x-input[iii].x); float aaa = (lastElement.y-input[iii].y) / (lastElement.x-input[iii].x);
@ -148,15 +148,15 @@ static void SutherlandHodgman(etk::Vector<vec2 > & input, etk::Vector<vec2 > & o
destPoint.x = ex; destPoint.x = ex;
output.pushBack(destPoint); output.pushBack(destPoint);
} else { } else {
//EWOL_DEBUG("element OUT == > OUT "); //Log.debug("element OUT == > OUT ");
} }
inside = false; inside = false;
} else { } else {
if(true == inside) { if(true == inside) {
//EWOL_DEBUG("element IN == > IN "); //Log.debug("element IN == > IN ");
output.pushBack(input[iii]); output.pushBack(input[iii]);
} else { } else {
//EWOL_DEBUG("element OUT == > IN "); //Log.debug("element OUT == > IN ");
//new point intersection ... //new point intersection ...
//y=aaax+bbb //y=aaax+bbb
float aaa = (lastElement.y-input[iii].y) / (lastElement.x-input[iii].x); float aaa = (lastElement.y-input[iii].y) / (lastElement.x-input[iii].x);
@ -183,7 +183,7 @@ static void SutherlandHodgman(etk::Vector<vec2 > & input, etk::Vector<vec2 > & o
for(int32_t iii=0; iii<input.size(); iii++) { for(int32_t iii=0; iii<input.size(); iii++) {
if(input[iii].y > ey) { if(input[iii].y > ey) {
if(true == inside) { if(true == inside) {
//EWOL_DEBUG("element IN == > OUT "); //Log.debug("element IN == > OUT ");
//new point intersection ... //new point intersection ...
//x=aaay+bbb //x=aaay+bbb
float aaa = (lastElement.x-input[iii].x) / (lastElement.y-input[iii].y); float aaa = (lastElement.x-input[iii].x) / (lastElement.y-input[iii].y);
@ -192,15 +192,15 @@ static void SutherlandHodgman(etk::Vector<vec2 > & input, etk::Vector<vec2 > & o
destPoint.x = ey*aaa + bbb; destPoint.x = ey*aaa + bbb;
output.pushBack(destPoint); output.pushBack(destPoint);
} else { } else {
//EWOL_DEBUG("element OUT == > OUT "); //Log.debug("element OUT == > OUT ");
} }
inside = false; inside = false;
} else { } else {
if(true == inside) { if(true == inside) {
//EWOL_DEBUG("element IN == > IN "); //Log.debug("element IN == > IN ");
output.pushBack(input[iii]); output.pushBack(input[iii]);
} else { } else {
//EWOL_DEBUG("element OUT == > IN "); //Log.debug("element OUT == > IN ");
//new point intersection ... //new point intersection ...
//y=aaax+bbb //y=aaax+bbb
float aaa = (lastElement.x-input[iii].x) / (lastElement.y-input[iii].y); float aaa = (lastElement.x-input[iii].x) / (lastElement.y-input[iii].y);
@ -218,7 +218,7 @@ static void SutherlandHodgman(etk::Vector<vec2 > & input, etk::Vector<vec2 > & o
} }
//EWOL_DEBUG("generate an crop on element : " << sizeInit << " == > " << output.size() ); //Log.debug("generate an crop on element : " << sizeInit << " == > " << output.size() );
} }
#endif #endif
@ -244,7 +244,7 @@ ewol::compositing::Drawing::Drawing() :
// Create the VBO: // Create the VBO:
m_VBO = gale::resource::VirtualBufferObject::create(NB_VBO); m_VBO = gale::resource::VirtualBufferObject::create(NB_VBO);
if (m_VBO == null) { if (m_VBO == null) {
EWOL_ERROR("can not instanciate VBO ..."); Log.error("can not instanciate VBO ...");
return; return;
} }
// TO facilitate some debugs we add a name of the VBO: // TO facilitate some debugs we add a name of the VBO:
@ -278,7 +278,7 @@ void ewol::compositing::Drawing::internalSetColor(const etk::Color<>& _color) {
} }
} }
void ewol::compositing::Drawing::setPoint(const vec3& _point) { void ewol::compositing::Drawing::setPoint(const Vector3f& _point) {
m_triangle[m_triElement] = _point; m_triangle[m_triElement] = _point;
m_triElement++; m_triElement++;
if (m_triElement >= 3) { if (m_triElement >= 3) {
@ -316,7 +316,7 @@ void ewol::compositing::Drawing::draw(bool _disableDepthTest) {
return; return;
} }
if (m_GLprogram == null) { if (m_GLprogram == null) {
EWOL_ERROR("No shader ..."); Log.error("No shader ...");
return; return;
} }
// set Matrix : translation/positionMatrix // set Matrix : translation/positionMatrix
@ -340,10 +340,10 @@ void ewol::compositing::Drawing::clear() {
// reset Buffer : // reset Buffer :
m_VBO->clear(); m_VBO->clear();
// reset temporal variables : // reset temporal variables :
m_position = vec3(0.0, 0.0, 0.0); m_position = Vector3f(0.0, 0.0, 0.0);
m_clippingPosStart = vec3(0.0, 0.0, 0.0); m_clippingPosStart = Vector3f(0.0, 0.0, 0.0);
m_clippingPosStop = vec3(0.0, 0.0, 0.0); m_clippingPosStop = Vector3f(0.0, 0.0, 0.0);
m_clippingEnable = false; m_clippingEnable = false;
m_color = etk::color::black; m_color = etk::color::black;
@ -355,7 +355,7 @@ void ewol::compositing::Drawing::clear() {
} }
} }
void ewol::compositing::Drawing::setClipping(const vec3& _pos, const vec3& _posEnd) { void ewol::compositing::Drawing::setClipping(const Vector3f& _pos, const Vector3f& _posEnd) {
// note the internal system all time request to have a bounding all time in the same order // note the internal system all time request to have a bounding all time in the same order
if (_pos.x() <= _posEnd.x()) { if (_pos.x() <= _posEnd.x()) {
m_clippingPosStart.setX(_pos.x()); m_clippingPosStart.setX(_pos.x());
@ -394,10 +394,10 @@ void ewol::compositing::Drawing::addVertex() {
setPoint(m_position); setPoint(m_position);
} }
void ewol::compositing::Drawing::lineTo(const vec3& _dest) { void ewol::compositing::Drawing::lineTo(const Vector3f& _dest) {
resetCount(); resetCount();
internalSetColor(m_color); internalSetColor(m_color);
//EWOL_VERBOSE("DrawLine : " << m_position << " to " << _dest); //Log.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 a line width 0"); //EWOL_WARNING("Try to draw a line width 0");
return; return;
@ -414,21 +414,21 @@ void ewol::compositing::Drawing::lineTo(const vec3& _dest) {
} else if (teta > 2*M_PI) { } else if (teta > 2*M_PI) {
teta -= 2*M_PI; teta -= 2*M_PI;
} }
//EWOL_DEBUG("teta = " << (teta*180/(M_PI)) << " deg." ); //Log.debug("teta = " << (teta*180/(M_PI)) << " deg." );
float offsety = sin(teta-M_PI/2) * (m_thickness/2); float offsety = sin(teta-M_PI/2) * (m_thickness/2);
float offsetx = cos(teta-M_PI/2) * (m_thickness/2); float offsetx = cos(teta-M_PI/2) * (m_thickness/2);
setPoint(vec3(m_position.x() - offsetx, m_position.y() - offsety, m_position.z()) ); setPoint(Vector3f(m_position.x() - offsetx, m_position.y() - offsety, m_position.z()) );
setPoint(vec3(m_position.x() + offsetx, m_position.y() + offsety, m_position.z()) ); setPoint(Vector3f(m_position.x() + offsetx, m_position.y() + offsety, m_position.z()) );
setPoint(vec3(_dest.x() + offsetx, _dest.y() + offsety, m_position.z()) ); setPoint(Vector3f(_dest.x() + offsetx, _dest.y() + offsety, m_position.z()) );
setPoint(vec3(_dest.x() + offsetx, _dest.y() + offsety, _dest.z()) ); setPoint(Vector3f(_dest.x() + offsetx, _dest.y() + offsety, _dest.z()) );
setPoint(vec3(_dest.x() - offsetx, _dest.y() - offsety, _dest.z()) ); setPoint(Vector3f(_dest.x() - offsetx, _dest.y() - offsety, _dest.z()) );
setPoint(vec3(m_position.x() - offsetx, m_position.y() - offsety, _dest.z()) ); setPoint(Vector3f(m_position.x() - offsetx, m_position.y() - offsety, _dest.z()) );
// update the system position : // update the system position :
m_position = _dest; m_position = _dest;
} }
void ewol::compositing::Drawing::rectangle(const vec3& _dest) { void ewol::compositing::Drawing::rectangle(const Vector3f& _dest) {
resetCount(); resetCount();
internalSetColor(m_color); internalSetColor(m_color);
/* Bitmap position /* Bitmap position
@ -472,16 +472,16 @@ void ewol::compositing::Drawing::rectangle(const vec3& _dest) {
|| dxA >= dxB) { || dxA >= dxB) {
return; return;
} }
setPoint(vec3(dxA, dyD, 0) ); setPoint(Vector3f(dxA, dyD, 0) );
setPoint(vec3(dxA, dyC, 0) ); setPoint(Vector3f(dxA, dyC, 0) );
setPoint(vec3(dxB, dyC, 0) ); setPoint(Vector3f(dxB, dyC, 0) );
setPoint(vec3(dxB, dyC, 0) ); setPoint(Vector3f(dxB, dyC, 0) );
setPoint(vec3(dxB, dyD, 0) ); setPoint(Vector3f(dxB, dyD, 0) );
setPoint(vec3(dxA, dyD, 0) ); setPoint(Vector3f(dxA, dyD, 0) );
} }
void ewol::compositing::Drawing::cube(const vec3& _dest) { void ewol::compositing::Drawing::cube(const Vector3f& _dest) {
} }
@ -504,7 +504,7 @@ void ewol::compositing::Drawing::circle(float _radius, float _angleStart, float
if (m_colorBg.a()!=0) { if (m_colorBg.a()!=0) {
internalSetColor(m_colorBg); internalSetColor(m_colorBg);
for (int32_t iii=0; iii<nbOcurence; iii++) { for (int32_t iii=0; iii<nbOcurence; iii++) {
setPoint(vec3(m_position.x(), setPoint(Vector3f(m_position.x(),
m_position.y(), m_position.y(),
0) ); 0) );
@ -512,7 +512,7 @@ void ewol::compositing::Drawing::circle(float _radius, float _angleStart, float
float offsety = sin(angleOne) * _radius; float offsety = sin(angleOne) * _radius;
float offsetx = cos(angleOne) * _radius; float offsetx = cos(angleOne) * _radius;
setPoint(vec3(m_position.x() + offsetx, setPoint(Vector3f(m_position.x() + offsetx,
m_position.y() + offsety, m_position.y() + offsety,
0) ); 0) );
@ -520,7 +520,7 @@ void ewol::compositing::Drawing::circle(float _radius, float _angleStart, float
offsety = sin(angleTwo) * _radius; offsety = sin(angleTwo) * _radius;
offsetx = cos(angleTwo) * _radius; offsetx = cos(angleTwo) * _radius;
setPoint(vec3(m_position.x() + offsetx, setPoint(Vector3f(m_position.x() + offsetx,
m_position.y() + offsety, m_position.y() + offsety,
0) ); 0) );
} }
@ -546,13 +546,13 @@ void ewol::compositing::Drawing::circle(float _radius, float _angleStart, float
float offsetInt2y = sin(angleTwo) * (_radius-m_thickness/2); float offsetInt2y = sin(angleTwo) * (_radius-m_thickness/2);
float offsetInt2x = cos(angleTwo) * (_radius-m_thickness/2); float offsetInt2x = cos(angleTwo) * (_radius-m_thickness/2);
setPoint(vec3(m_position.x() + offsetIntx, m_position.y() + offsetInty, 0)); setPoint(Vector3f(m_position.x() + offsetIntx, m_position.y() + offsetInty, 0));
setPoint(vec3(m_position.x() + offsetExtx, m_position.y() + offsetExty, 0)); setPoint(Vector3f(m_position.x() + offsetExtx, m_position.y() + offsetExty, 0));
setPoint(vec3(m_position.x() + offsetExt2x, m_position.y() + offsetExt2y, 0)); setPoint(Vector3f(m_position.x() + offsetExt2x, m_position.y() + offsetExt2y, 0));
setPoint(vec3(m_position.x() + offsetExt2x, m_position.y() + offsetExt2y, 0)); setPoint(Vector3f(m_position.x() + offsetExt2x, m_position.y() + offsetExt2y, 0));
setPoint(vec3(m_position.x() + offsetInt2x, m_position.y() + offsetInt2y, 0)); setPoint(Vector3f(m_position.x() + offsetInt2x, m_position.y() + offsetInt2y, 0));
setPoint(vec3(m_position.x() + offsetIntx, m_position.y() + offsetInty, 0)); setPoint(Vector3f(m_position.x() + offsetIntx, m_position.y() + offsetInty, 0));
} }
} }

View File

@ -16,9 +16,9 @@ namespace ewol {
namespace compositing { namespace compositing {
class Drawing : public ewol::Compositing { class Drawing : public ewol::Compositing {
private: private:
vec3 m_position; //!< The current position to draw Vector3f m_position; //!< The current position to draw
vec3 m_clippingPosStart; //!< Clipping start position Vector3f m_clippingPosStart; //!< Clipping start position
vec3 m_clippingPosStop; //!< Clipping stop position Vector3f m_clippingPosStop; //!< Clipping stop position
bool m_clippingEnable; //!< true if the clipping must be activated bool m_clippingEnable; //!< true if the clipping must be activated
private: private:
etk::Color<> m_color; //!< The text foreground color etk::Color<> m_color; //!< The text foreground color
@ -53,7 +53,7 @@ namespace ewol {
void unLoadProgram(); void unLoadProgram();
float m_thickness; //!< when drawing line and other things float m_thickness; //!< when drawing line and other things
int32_t m_triElement; //!< special counter of the single dot generated int32_t m_triElement; //!< special counter of the single dot generated
vec3 m_triangle[3]; //!< Register every system with a combinaison of tiangle Vector3f m_triangle[3]; //!< Register every system with a combinaison of tiangle
etk::Color<float,4> m_tricolor[3]; //!< Register every the associated color foreground etk::Color<float,4> m_tricolor[3]; //!< Register every the associated color foreground
// internal API for the generation abstraction of triangles // internal API for the generation abstraction of triangles
/** /**
@ -73,7 +73,7 @@ namespace ewol {
* @brief internal add of the specific point * @brief internal add of the specific point
* @param[in] _point The requeste dpoint to add * @param[in] _point The requeste dpoint to add
*/ */
void setPoint(const vec3& point); void setPoint(const Vector3f& point);
public: public:
/** /**
@ -88,28 +88,28 @@ namespace ewol {
* @brief get the current display position (sometime needed in the gui control) * @brief get the current display position (sometime needed in the gui control)
* @return the current position. * @return the current position.
*/ */
const vec3& getPos() { const Vector3f& getPos() {
return m_position; return m_position;
}; };
/** /**
* @brief set position for the next text writen * @brief set position for the next text writen
* @param[in] _pos Position of the text (in 3D) * @param[in] _pos Position of the text (in 3D)
*/ */
void setPos(const vec3& _pos) { void setPos(const Vector3f& _pos) {
m_position = _pos; m_position = _pos;
}; };
inline void setPos(const vec2& _pos) { inline void setPos(const Vector2f& _pos) {
setPos(vec3(_pos.x(), _pos.y(), 0)); setPos(Vector3f(_pos.x(), _pos.y(), 0));
}; };
/** /**
* @brief set relative position for the next text writen * @brief set relative position for the next text writen
* @param[in] _pos ofset apply of the text (in 3D) * @param[in] _pos ofset apply of the text (in 3D)
*/ */
void setRelPos(const vec3& _pos) { void setRelPos(const Vector3f& _pos) {
m_position += _pos; m_position += _pos;
}; };
inline void setRelPos(const vec2& _pos) { inline void setRelPos(const Vector2f& _pos) {
setRelPos(vec3(_pos.x(), _pos.y(), 0)); setRelPos(Vector3f(_pos.x(), _pos.y(), 0));
}; };
/** /**
* @brief set the Color of the current foreground font * @brief set the Color of the current foreground font
@ -144,20 +144,20 @@ namespace ewol {
* @param[in]_ pos Start position of the clipping * @param[in]_ pos Start position of the clipping
* @param[in] _width Width size of the clipping * @param[in] _width Width size of the clipping
*/ */
void setClippingWidth(const vec3& _pos, const vec3& _width) { void setClippingWidth(const Vector3f& _pos, const Vector3f& _width) {
setClipping(_pos, _pos+_width); setClipping(_pos, _pos+_width);
}; };
inline void setClippingWidth(const vec2& _pos, const vec2& _width) { inline void setClippingWidth(const Vector2f& _pos, const Vector2f& _width) {
setClippingWidth(vec3(_pos.x(),_pos.y(),-1), vec3(_width.x(),_width.y(), 2)); setClippingWidth(Vector3f(_pos.x(),_pos.y(),-1), Vector3f(_width.x(),_width.y(), 2));
}; };
/** /**
* @brief Request a clipping area for the text (next draw only) * @brief Request a clipping area for the text (next draw only)
* @param[in] _pos Start position of the clipping * @param[in] _pos Start position of the clipping
* @param[in] _posEnd End position of the clipping * @param[in] _posEnd End position of the clipping
*/ */
void setClipping(const vec3& _pos, const vec3& _posEnd); void setClipping(const Vector3f& _pos, const Vector3f& _posEnd);
inline void setClipping(const vec2& _pos, const vec2& _posEnd) { inline void setClipping(const Vector2f& _pos, const Vector2f& _posEnd) {
setClipping(vec3(_pos.x(),_pos.y(),-1), vec3(_posEnd.x(),_posEnd.y(), 1)); setClipping(Vector3f(_pos.x(),_pos.y(),-1), Vector3f(_posEnd.x(),_posEnd.y(), 1));
}; };
/** /**
* @brief enable/Disable the clipping (without lose the current clipping position) * @brief enable/Disable the clipping (without lose the current clipping position)
@ -179,43 +179,43 @@ namespace ewol {
* @brief draw a line to a specific position * @brief draw a line to a specific position
* @param[in] _dest Position of the end of the line. * @param[in] _dest Position of the end of the line.
*/ */
void lineTo(const vec3& _dest); void lineTo(const Vector3f& _dest);
inline void lineTo(const vec2& _dest) { inline void lineTo(const Vector2f& _dest) {
lineTo(vec3(_dest.x(), _dest.y(), 0)); lineTo(Vector3f(_dest.x(), _dest.y(), 0));
}; };
/** /**
* @brief Relative drawing a line (spacial vector) * @brief Relative drawing a line (spacial vector)
* @param[in] _vect Vector of the curent line. * @param[in] _vect Vector of the curent line.
*/ */
void lineRel(const vec3& _vect) { void lineRel(const Vector3f& _vect) {
lineTo(m_position+_vect); lineTo(m_position+_vect);
}; };
inline void lineRel(const vec2& _vect) { inline void lineRel(const Vector2f& _vect) {
lineRel(vec3(_vect.x(), _vect.y(), 0)); lineRel(Vector3f(_vect.x(), _vect.y(), 0));
}; };
/** /**
* @brief draw a 2D rectangle to the position requested. * @brief draw a 2D rectangle to the position requested.
* @param[in] _dest Position the the end of the rectangle * @param[in] _dest Position the the end of the rectangle
*/ */
void rectangle(const vec3& _dest); void rectangle(const Vector3f& _dest);
inline void rectangle(const vec2& _dest) { inline void rectangle(const Vector2f& _dest) {
rectangle(vec3(_dest.x(), _dest.y(), 0)); rectangle(Vector3f(_dest.x(), _dest.y(), 0));
}; };
/** /**
* @brief draw a 2D rectangle to the requested size. * @brief draw a 2D rectangle to the requested size.
* @param[in] _size size of the rectangle * @param[in] _size size of the rectangle
*/ */
void rectangleWidth(const vec3& _size) { void rectangleWidth(const Vector3f& _size) {
rectangle(m_position+_size); rectangle(m_position+_size);
}; };
inline void rectangleWidth(const vec2& _size) { inline void rectangleWidth(const Vector2f& _size) {
rectangleWidth(vec3(_size.x(), _size.y(), 0)); rectangleWidth(Vector3f(_size.x(), _size.y(), 0));
}; };
/** /**
* @brief draw a 3D rectangle to the position requested. * @brief draw a 3D rectangle to the position requested.
* @param[in] _dest Position the the end of the rectangle * @param[in] _dest Position the the end of the rectangle
*/ */
void cube(const vec3& _dest); void cube(const Vector3f& _dest);
/** /**
* @brief draw a 2D circle with the specify rafdius parameter. * @brief draw a 2D circle with the specify rafdius parameter.
* @param[in] _radius Distence to the dorder * @param[in] _radius Distence to the dorder

View File

@ -40,7 +40,7 @@ ewol::compositing::Image::Image(const etk::Uri& _imageName,
// Create the VBO: // Create the VBO:
m_VBO = gale::resource::VirtualBufferObject::create(NB_VBO); m_VBO = gale::resource::VirtualBufferObject::create(NB_VBO);
if (m_VBO == null) { if (m_VBO == null) {
EWOL_ERROR("can not instanciate VBO ..."); Log.error("can not instanciate VBO ...");
return; return;
} }
// TO facilitate some debugs we add a name of the VBO: // TO facilitate some debugs we add a name of the VBO:
@ -83,7 +83,7 @@ void ewol::compositing::Image::draw(bool _disableDepthTest) {
return; return;
} }
if (m_GLprogram == null) { if (m_GLprogram == null) {
EWOL_ERROR("No shader ..."); Log.error("No shader ...");
return; return;
} }
//EWOL_WARNING("Display image : " << m_VBO->bufferSize(m_vboIdCoord)); //EWOL_WARNING("Display image : " << m_VBO->bufferSize(m_vboIdCoord));
@ -101,12 +101,12 @@ void ewol::compositing::Image::draw(bool _disableDepthTest) {
m_GLprogram->setTexture0(m_GLtexID, m_resourceImage->getRendererId()); m_GLprogram->setTexture0(m_GLtexID, m_resourceImage->getRendererId());
} else if (m_resource != null) { } else if (m_resource != null) {
if (m_distanceFieldMode == true) { if (m_distanceFieldMode == true) {
EWOL_ERROR("FONT type error Request distance field and display normal ..."); Log.error("FONT type error Request distance field and display normal ...");
} }
m_GLprogram->setTexture0(m_GLtexID, m_resource->getRendererId()); m_GLprogram->setTexture0(m_GLtexID, m_resource->getRendererId());
} else { } else {
if (m_distanceFieldMode == false) { if (m_distanceFieldMode == false) {
EWOL_ERROR("FONT type error Request normal and display distance field ..."); Log.error("FONT type error Request normal and display distance field ...");
} }
m_GLprogram->setTexture0(m_GLtexID, m_resourceDF->getRendererId()); m_GLprogram->setTexture0(m_GLtexID, m_resourceDF->getRendererId());
} }
@ -127,15 +127,15 @@ void ewol::compositing::Image::clear() {
// reset Buffer : // reset Buffer :
m_VBO->clear(); m_VBO->clear();
// reset temporal variables : // reset temporal variables :
m_position = vec3(0.0, 0.0, 0.0); m_position = Vector3f(0.0, 0.0, 0.0);
m_clippingPosStart = vec3(0.0, 0.0, 0.0); m_clippingPosStart = Vector3f(0.0, 0.0, 0.0);
m_clippingPosStop = vec3(0.0, 0.0, 0.0); m_clippingPosStop = Vector3f(0.0, 0.0, 0.0);
m_clippingEnable = false; m_clippingEnable = false;
m_color = etk::color::white; m_color = etk::color::white;
m_angle = 0.0; m_angle = 0.0;
} }
void ewol::compositing::Image::setClipping(const vec3& _pos, vec3 _posEnd) { void ewol::compositing::Image::setClipping(const Vector3f& _pos, Vector3f _posEnd) {
// note the internal system all time request to have a bounding all time in the same order // note the internal system all time request to have a bounding all time in the same order
if (_pos.x() <= _posEnd.x()) { if (_pos.x() <= _posEnd.x()) {
m_clippingPosStart.setX(_pos.x()); m_clippingPosStart.setX(_pos.x());
@ -165,27 +165,27 @@ void ewol::compositing::Image::setAngle(float _angle) {
m_angle = _angle; m_angle = _angle;
} }
void ewol::compositing::Image::print(const vec2& _size) { void ewol::compositing::Image::print(const Vector2f& _size) {
printPart(_size, vec2(0,0), vec2(1.0,1.0)); printPart(_size, Vector2f(0,0), Vector2f(1.0,1.0));
} }
void ewol::compositing::Image::printPart(const vec2& _size, void ewol::compositing::Image::printPart(const Vector2f& _size,
vec2 _sourcePosStart, Vector2f _sourcePosStart,
vec2 _sourcePosStop) { Vector2f _sourcePosStop) {
if (m_resource == null) { if (m_resource == null) {
return; return;
} }
vec2 openGLSize = vec2(m_resource->getOpenGlSize().x(), m_resource->getOpenGlSize().y()); Vector2f openGLSize = Vector2f(m_resource->getOpenGlSize().x(), m_resource->getOpenGlSize().y());
vec2 usefullSize = m_resource->getUsableSize(); Vector2f usefullSize = m_resource->getUsableSize();
vec2 ratio = usefullSize/openGLSize; Vector2f ratio = usefullSize/openGLSize;
_sourcePosStart *= ratio; _sourcePosStart *= ratio;
_sourcePosStop *= ratio; _sourcePosStop *= ratio;
EWOL_VERBOSE(" openGLSize=" << openGLSize << " usableSize=" << usefullSize << " start=" << _sourcePosStart << " stop=" << _sourcePosStop); Log.verbose(" openGLSize=" << openGLSize << " usableSize=" << usefullSize << " start=" << _sourcePosStart << " stop=" << _sourcePosStop);
//EWOL_ERROR("Debug image " << m_filename << " ==> " << m_position << " " << _size << " " << _sourcePosStart << " " << _sourcePosStop); //Log.error("Debug image " << m_filename << " ==> " << m_position << " " << _size << " " << _sourcePosStart << " " << _sourcePosStop);
if (m_angle == 0.0f) { if (m_angle == 0.0f) {
vec3 point = m_position; Vector3f point = m_position;
vec2 tex(_sourcePosStart.x(),_sourcePosStop.y()); Vector2f tex(_sourcePosStart.x(),_sourcePosStop.y());
m_VBO->pushOnBuffer(m_vboIdCoord, point); m_VBO->pushOnBuffer(m_vboIdCoord, point);
m_VBO->pushOnBuffer(m_vboIdCoordTex, tex); m_VBO->pushOnBuffer(m_vboIdCoordTex, tex);
m_VBO->pushOnBuffer(m_vboIdColor, m_color); m_VBO->pushOnBuffer(m_vboIdColor, m_color);
@ -224,28 +224,28 @@ void ewol::compositing::Image::printPart(const vec2& _size,
m_VBO->flush(); m_VBO->flush();
return; return;
} }
vec3 center = m_position + vec3(_size.x(),_size.y(),0)/2.0f; Vector3f center = m_position + Vector3f(_size.x(),_size.y(),0)/2.0f;
vec3 limitedSize(_size.x()*0.5f, _size.y()*0.5f, 0.0f); Vector3f limitedSize(_size.x()*0.5f, _size.y()*0.5f, 0.0f);
vec3 point(0,0,0); Vector3f point(0,0,0);
vec2 tex(_sourcePosStart.x(),_sourcePosStop.y()); Vector2f tex(_sourcePosStart.x(),_sourcePosStop.y());
point.setValue(-limitedSize.x(), -limitedSize.y(), 0); point.setValue(-limitedSize.x(), -limitedSize.y(), 0);
point = point.rotate(vec3(0,0,1), m_angle) + center; point = point.rotate(Vector3f(0,0,1), m_angle) + center;
m_VBO->pushOnBuffer(m_vboIdCoord, point); m_VBO->pushOnBuffer(m_vboIdCoord, point);
m_VBO->pushOnBuffer(m_vboIdCoordTex, tex); m_VBO->pushOnBuffer(m_vboIdCoordTex, tex);
m_VBO->pushOnBuffer(m_vboIdColor, m_color); m_VBO->pushOnBuffer(m_vboIdColor, m_color);
tex.setValue(_sourcePosStop.x(),_sourcePosStop.y()); tex.setValue(_sourcePosStop.x(),_sourcePosStop.y());
point.setValue(limitedSize.x(), -limitedSize.y(), 0); point.setValue(limitedSize.x(), -limitedSize.y(), 0);
point = point.rotate(vec3(0,0,1), m_angle) + center; point = point.rotate(Vector3f(0,0,1), m_angle) + center;
m_VBO->pushOnBuffer(m_vboIdCoord, point); m_VBO->pushOnBuffer(m_vboIdCoord, point);
m_VBO->pushOnBuffer(m_vboIdCoordTex, tex); m_VBO->pushOnBuffer(m_vboIdCoordTex, tex);
m_VBO->pushOnBuffer(m_vboIdColor, m_color); m_VBO->pushOnBuffer(m_vboIdColor, m_color);
tex.setValue(_sourcePosStop.x(),_sourcePosStart.y()); tex.setValue(_sourcePosStop.x(),_sourcePosStart.y());
point.setValue(limitedSize.x(), limitedSize.y(), 0); point.setValue(limitedSize.x(), limitedSize.y(), 0);
point = point.rotate(vec3(0,0,1), m_angle) + center; point = point.rotate(Vector3f(0,0,1), m_angle) + center;
m_VBO->pushOnBuffer(m_vboIdCoord, point); m_VBO->pushOnBuffer(m_vboIdCoord, point);
m_VBO->pushOnBuffer(m_vboIdCoordTex, tex); m_VBO->pushOnBuffer(m_vboIdCoordTex, tex);
m_VBO->pushOnBuffer(m_vboIdColor, m_color); m_VBO->pushOnBuffer(m_vboIdColor, m_color);
@ -256,14 +256,14 @@ void ewol::compositing::Image::printPart(const vec2& _size,
tex.setValue(_sourcePosStart.x(),_sourcePosStart.y()); tex.setValue(_sourcePosStart.x(),_sourcePosStart.y());
point.setValue(-limitedSize.x(), limitedSize.y(), 0); point.setValue(-limitedSize.x(), limitedSize.y(), 0);
point = point.rotate(vec3(0,0,1), m_angle) + center; point = point.rotate(Vector3f(0,0,1), m_angle) + center;
m_VBO->pushOnBuffer(m_vboIdCoord, point); m_VBO->pushOnBuffer(m_vboIdCoord, point);
m_VBO->pushOnBuffer(m_vboIdCoordTex, tex); m_VBO->pushOnBuffer(m_vboIdCoordTex, tex);
m_VBO->pushOnBuffer(m_vboIdColor, m_color); m_VBO->pushOnBuffer(m_vboIdColor, m_color);
tex.setValue(_sourcePosStart.x(),_sourcePosStop.y()); tex.setValue(_sourcePosStart.x(),_sourcePosStop.y());
point.setValue(-limitedSize.x(), -limitedSize.y(), 0); point.setValue(-limitedSize.x(), -limitedSize.y(), 0);
point = point.rotate(vec3(0,0,1), m_angle) + center; point = point.rotate(Vector3f(0,0,1), m_angle) + center;
m_VBO->pushOnBuffer(m_vboIdCoord, point); m_VBO->pushOnBuffer(m_vboIdCoord, point);
m_VBO->pushOnBuffer(m_vboIdCoordTex, tex); m_VBO->pushOnBuffer(m_vboIdCoordTex, tex);
m_VBO->pushOnBuffer(m_vboIdColor, m_color); m_VBO->pushOnBuffer(m_vboIdColor, m_color);
@ -271,7 +271,7 @@ void ewol::compositing::Image::printPart(const vec2& _size,
m_VBO->flush(); m_VBO->flush();
} }
void ewol::compositing::Image::setSource(const etk::Uri& _uri, const vec2& _size) { void ewol::compositing::Image::setSource(const etk::Uri& _uri, const Vector2f& _size) {
clear(); clear();
if ( m_filename == _uri if ( m_filename == _uri
&& m_requestSize == _size) { && m_requestSize == _size) {
@ -286,19 +286,19 @@ void ewol::compositing::Image::setSource(const etk::Uri& _uri, const vec2& _size
m_resource.reset(); m_resource.reset();
m_resourceDF.reset(); m_resourceDF.reset();
m_resourceImage.reset(); m_resourceImage.reset();
ivec2 tmpSize(_size.x(),_size.y()); Vector2i tmpSize(_size.x(),_size.y());
// note that no image can be loaded... // note that no image can be loaded...
if (_uri.isEmpty() == false) { if (_uri.isEmpty() == false) {
// link to new one // link to new one
if (m_distanceFieldMode == false) { if (m_distanceFieldMode == false) {
m_resource = ewol::resource::TextureFile::create(m_filename, tmpSize); m_resource = ewol::resource::TextureFile::create(m_filename, tmpSize);
if (m_resource == null) { if (m_resource == null) {
EWOL_ERROR("Can not get Image resource"); Log.error("Can not get Image resource");
} }
} else { } else {
m_resourceDF = ewol::resource::ImageDF::create(m_filename, tmpSize); m_resourceDF = ewol::resource::ImageDF::create(m_filename, tmpSize);
if (m_resourceDF == null) { if (m_resourceDF == null) {
EWOL_ERROR("Can not get Image resource DF"); Log.error("Can not get Image resource DF");
} }
} }
} }
@ -333,11 +333,11 @@ bool ewol::compositing::Image::hasSources() {
} }
vec2 ewol::compositing::Image::getRealSize() { Vector2f ewol::compositing::Image::getRealSize() {
if ( m_resource == null if ( m_resource == null
&& m_resourceDF == null && m_resourceDF == null
&& m_resourceImage == null) { && m_resourceImage == null) {
return vec2(0,0); return Vector2f(0,0);
} }
if (m_resource != null) { if (m_resource != null) {
return m_resource->getRealSize(); return m_resource->getRealSize();
@ -348,7 +348,7 @@ vec2 ewol::compositing::Image::getRealSize() {
if (m_resourceImage != null) { if (m_resourceImage != null) {
return m_resourceImage->getUsableSize(); return m_resourceImage->getUsableSize();
} }
return vec2(0,0); return Vector2f(0,0);
} }

View File

@ -18,10 +18,10 @@ namespace ewol {
static const int32_t sizeAuto; static const int32_t sizeAuto;
private: private:
etk::Uri m_filename; etk::Uri m_filename;
ivec2 m_requestSize; Vector2i m_requestSize;
vec3 m_position; //!< The current position to draw Vector3f m_position; //!< The current position to draw
vec3 m_clippingPosStart; //!< Clipping start position Vector3f m_clippingPosStart; //!< Clipping start position
vec3 m_clippingPosStop; //!< Clipping stop position Vector3f m_clippingPosStop; //!< Clipping stop position
bool m_clippingEnable; //!< true if the clipping must be activated bool m_clippingEnable; //!< true if the clipping must be activated
private: private:
etk::Color<float,4> m_color; //!< The text foreground color etk::Color<float,4> m_color; //!< The text foreground color
@ -75,28 +75,28 @@ namespace ewol {
* @brief get the current display position (sometime needed in the gui control) * @brief get the current display position (sometime needed in the gui control)
* @return the current position. * @return the current position.
*/ */
const vec3& getPos() { const Vector3f& getPos() {
return m_position; return m_position;
}; };
/** /**
* @brief set position for the next text writen * @brief set position for the next text writen
* @param[in] _pos Position of the text (in 3D) * @param[in] _pos Position of the text (in 3D)
*/ */
void setPos(const vec3& _pos) { void setPos(const Vector3f& _pos) {
m_position = _pos; m_position = _pos;
}; };
inline void setPos(const vec2& _pos) { inline void setPos(const Vector2f& _pos) {
setPos(vec3(_pos.x(),_pos.y(),0)); setPos(Vector3f(_pos.x(),_pos.y(),0));
}; };
/** /**
* @brief set relative position for the next text writen * @brief set relative position for the next text writen
* @param[in] _pos ofset apply of the text (in 3D) * @param[in] _pos ofset apply of the text (in 3D)
*/ */
void setRelPos(const vec3& _pos) { void setRelPos(const Vector3f& _pos) {
m_position += _pos; m_position += _pos;
}; };
inline void setRelPos(const vec2& _pos) { inline void setRelPos(const Vector2f& _pos) {
setRelPos(vec3(_pos.x(),_pos.y(),0)); setRelPos(Vector3f(_pos.x(),_pos.y(),0));
}; };
/** /**
* @brief set the Color of the current foreground font * @brief set the Color of the current foreground font
@ -110,20 +110,20 @@ namespace ewol {
* @param[in] _pos Start position of the clipping * @param[in] _pos Start position of the clipping
* @param[in] _width Width size of the clipping * @param[in] _width Width size of the clipping
*/ */
void setClippingWidth(const vec3& _pos, vec3 _width) { void setClippingWidth(const Vector3f& _pos, Vector3f _width) {
setClipping(_pos, _pos+_width); setClipping(_pos, _pos+_width);
}; };
inline void setClippingWidth(const vec2& _pos, const vec2& _width) { inline void setClippingWidth(const Vector2f& _pos, const Vector2f& _width) {
setClippingWidth(vec3(_pos.x(),_pos.y(),0), vec3(_width.x(),_width.y(),0)); setClippingWidth(Vector3f(_pos.x(),_pos.y(),0), Vector3f(_width.x(),_width.y(),0));
}; };
/** /**
* @brief Request a clipping area for the text (next draw only) * @brief Request a clipping area for the text (next draw only)
* @param[in] _pos Start position of the clipping * @param[in] _pos Start position of the clipping
* @param[in] _posEnd End position of the clipping * @param[in] _posEnd End position of the clipping
*/ */
void setClipping(const vec3& _pos, vec3 _posEnd); void setClipping(const Vector3f& _pos, Vector3f _posEnd);
inline void setClipping(const vec2& _pos, const vec2& _posEnd) { inline void setClipping(const Vector2f& _pos, const Vector2f& _posEnd) {
setClipping(vec3(_pos.x(),_pos.y(),0), vec3(_posEnd.x(),_posEnd.y(),0)); setClipping(Vector3f(_pos.x(),_pos.y(),0), Vector3f(_posEnd.x(),_posEnd.y(),0));
}; };
/** /**
* @brief enable/Disable the clipping (without lose the current clipping position) * @brief enable/Disable the clipping (without lose the current clipping position)
@ -141,28 +141,28 @@ namespace ewol {
* @brief add a compleate of the image to display with the requested size * @brief add a compleate of the image to display with the requested size
* @param[in] _size size of the output image * @param[in] _size size of the output image
*/ */
void print(const ivec2& _size) { void print(const Vector2i& _size) {
print(vec2(_size.x(),_size.y())); print(Vector2f(_size.x(),_size.y()));
}; };
void print(const vec2& _size); void print(const Vector2f& _size);
/** /**
* @brief add a part of the image to display with the requested size * @brief add a part of the image to display with the requested size
* @param[in] _size size of the output image * @param[in] _size size of the output image
* @param[in] _sourcePosStart Start position in the image [0..1] (can be bigger but this repeate the image). * @param[in] _sourcePosStart Start position in the image [0..1] (can be bigger but this repeate the image).
* @param[in] _sourcePosStop Stop position in the image [0..1] (can be bigger but this repeate the image). * @param[in] _sourcePosStop Stop position in the image [0..1] (can be bigger but this repeate the image).
*/ */
void printPart(const vec2& _size, void printPart(const Vector2f& _size,
vec2 _sourcePosStart, Vector2f _sourcePosStart,
vec2 _sourcePosStop); Vector2f _sourcePosStop);
/** /**
* @brief change the image Source == > can not be done to display 2 images at the same time ... * @brief change the image Source == > can not be done to display 2 images at the same time ...
* @param[in] _uri New file of the Image * @param[in] _uri New file of the Image
* @param[in] _size for the image when Verctorial image loading is requested * @param[in] _size for the image when Verctorial image loading is requested
*/ */
void setSource(const etk::Uri& _uri, int32_t _size=32) { void setSource(const etk::Uri& _uri, int32_t _size=32) {
setSource(_uri, vec2(_size,_size)); setSource(_uri, Vector2f(_size,_size));
}; };
void setSource(const etk::Uri& _uri, const vec2& _size); void setSource(const etk::Uri& _uri, const Vector2f& _size);
void setSource(egami::Image _image); void setSource(egami::Image _image);
/** /**
* @brief Sometimes the user declare an image but not allocate the ressources all the time, this is to know it .. * @brief Sometimes the user declare an image but not allocate the ressources all the time, this is to know it ..
@ -173,7 +173,7 @@ namespace ewol {
* @brief get the source image registered size in the file (<0 when multiple size image) * @brief get the source image registered size in the file (<0 when multiple size image)
* @return tre image registered size * @return tre image registered size
*/ */
vec2 getRealSize(); Vector2f getRealSize();
public: public:
/** /**
* @brief Set render mode of the image * @brief Set render mode of the image

View File

@ -50,7 +50,7 @@ ewol::compositing::Shaper::Shaper(const etk::Uri& _uri) :
// Create the VBO: // Create the VBO:
m_VBO = gale::resource::VirtualBufferObject::create(NB_VBO); m_VBO = gale::resource::VirtualBufferObject::create(NB_VBO);
if (m_VBO == null) { if (m_VBO == null) {
EWOL_ERROR("can not instanciate VBO ..."); Log.error("can not instanciate VBO ...");
return; return;
} }
// TO facilitate some debugs we add a name of the VBO: // TO facilitate some debugs we add a name of the VBO:
@ -84,7 +84,7 @@ void ewol::compositing::Shaper::unLoadProgram() {
void ewol::compositing::Shaper::loadProgram() { void ewol::compositing::Shaper::loadProgram() {
if (m_uri.isEmpty() == true) { if (m_uri.isEmpty() == true) {
EWOL_DEBUG("no Shaper set for loading resources ..."); Log.debug("no Shaper set for loading resources ...");
return; return;
} }
m_config = ewol::resource::ConfigFile::create(m_uri.get()); m_config = ewol::resource::ConfigFile::create(m_uri.get());
@ -116,9 +116,9 @@ void ewol::compositing::Shaper::loadProgram() {
etk::Uri tmpUri = m_uri; etk::Uri tmpUri = m_uri;
tmpUri.setPath(m_uri.getPath().getParent() / basicShaderFile); tmpUri.setPath(m_uri.getPath().getParent() / basicShaderFile);
tmpFilename = tmpUri.get(); tmpFilename = tmpUri.get();
EWOL_DEBUG("Shaper try load shader : '" << tmpFilename << "' with base : '" << basicShaderFile << "'"); Log.debug("Shaper try load shader : '" << tmpFilename << "' with base : '" << basicShaderFile << "'");
} else { } else {
EWOL_DEBUG("Shaper try load shader : '" << tmpFilename << "'"); Log.debug("Shaper try load shader : '" << tmpFilename << "'");
} }
// get the shader resource : // get the shader resource :
m_GLPosition = 0; m_GLPosition = 0;
@ -144,11 +144,11 @@ void ewol::compositing::Shaper::loadProgram() {
etk::Uri tmpUri = m_uri; etk::Uri tmpUri = m_uri;
tmpUri.setPath(m_uri.getPath().getParent() / basicImageFile); tmpUri.setPath(m_uri.getPath().getParent() / basicImageFile);
tmpFilename = tmpUri.get(); tmpFilename = tmpUri.get();
EWOL_DEBUG("Shaper try load shaper image : '" << tmpFilename << "' with base : '" << basicImageFile << "'"); Log.debug("Shaper try load shaper image : '" << tmpFilename << "' with base : '" << basicImageFile << "'");
} else { } else {
EWOL_DEBUG("Shaper try load shaper image : '" << tmpFilename << "'"); Log.debug("Shaper try load shaper image : '" << tmpFilename << "'");
} }
ivec2 size(64,64); Vector2i size(64,64);
m_resourceTexture = ewol::resource::TextureFile::create(tmpFilename, size); m_resourceTexture = ewol::resource::TextureFile::create(tmpFilename, size);
} }
} }
@ -160,18 +160,18 @@ void ewol::compositing::Shaper::loadProgram() {
etk::Uri tmpUri = m_uri; etk::Uri tmpUri = m_uri;
tmpUri.setPath(m_uri.getPath().getParent() / basicColorFile); tmpUri.setPath(m_uri.getPath().getParent() / basicColorFile);
tmpFilename = tmpUri.get(); tmpFilename = tmpUri.get();
EWOL_DEBUG("Shaper try load colorFile : '" << tmpFilename << "' with base : '" << basicColorFile << "'"); Log.debug("Shaper try load colorFile : '" << tmpFilename << "' with base : '" << basicColorFile << "'");
} else { } else {
EWOL_DEBUG("Shaper try load colorFile : '" << tmpFilename << "'"); Log.debug("Shaper try load colorFile : '" << tmpFilename << "'");
} }
m_colorProperty = ewol::resource::ColorFile::create(tmpFilename); m_colorProperty = ewol::resource::ColorFile::create(tmpFilename);
if ( m_GLprogram != null if ( m_GLprogram != null
&& m_colorProperty != null) { && m_colorProperty != null) {
etk::Vector<etk::String> listColor = m_colorProperty->getColors(); List<etk::String> listColor = m_colorProperty->getColors();
for (auto tmpColor : listColor) { for (auto tmpColor : listColor) {
int32_t glId = m_GLprogram->getUniform(tmpColor); int32_t glId = m_GLprogram->getUniform(tmpColor);
int32_t colorID = m_colorProperty->request(tmpColor); int32_t colorID = m_colorProperty->request(tmpColor);
m_listAssiciatedId.pushBack(ivec2(glId, colorID)); m_listAssiciatedId.pushBack(Vector2i(glId, colorID));
} }
} }
} }
@ -183,7 +183,7 @@ void ewol::compositing::Shaper::draw(bool _disableDepthTest) {
return; return;
} }
if (m_GLprogram == null) { if (m_GLprogram == null) {
EWOL_ERROR("No shader ..."); Log.error("No shader ...");
return; return;
} }
if (m_VBO->bufferSize(m_vboIdCoord) <= 0) { if (m_VBO->bufferSize(m_vboIdCoord) <= 0) {
@ -218,10 +218,10 @@ void ewol::compositing::Shaper::draw(bool _disableDepthTest) {
void ewol::compositing::Shaper::clear() { void ewol::compositing::Shaper::clear() {
// nothing to do ... // nothing to do ...
m_propertySize = vec2(0,0); m_propertySize = Vector2f(0,0);
m_propertyOrigin = vec2(0,0); m_propertyOrigin = Vector2f(0,0);
m_propertyInsidePosition = vec2(0,0); m_propertyInsidePosition = Vector2f(0,0);
m_propertyInsideSize = vec2(0,0); m_propertyInsideSize = Vector2f(0,0);
m_VBO->clear(); m_VBO->clear();
} }
@ -246,7 +246,7 @@ bool ewol::compositing::Shaper::changeStatusIn(int32_t _newStatusId) {
} }
bool ewol::compositing::Shaper::periodicCall(const ewol::event::Time& _event) { bool ewol::compositing::Shaper::periodicCall(const ewol::event::Time& _event) {
EWOL_VERBOSE("call=" << _event << "state transition=" << m_stateTransition << " speedTime=" << m_config->getNumber(m_confIdChangeTime)); Log.verbose("call=" << _event << "state transition=" << m_stateTransition << " speedTime=" << m_config->getNumber(m_confIdChangeTime));
// start : // start :
if (m_stateTransition >= 1.0) { if (m_stateTransition >= 1.0) {
m_stateOld = m_stateNew; m_stateOld = m_stateNew;
@ -255,7 +255,7 @@ bool ewol::compositing::Shaper::periodicCall(const ewol::event::Time& _event) {
m_stateNew = m_nextStatusRequested; m_stateNew = m_nextStatusRequested;
m_nextStatusRequested = -1; m_nextStatusRequested = -1;
m_stateTransition = 0.0; m_stateTransition = 0.0;
EWOL_VERBOSE(" ##### START ##### "); Log.verbose(" ##### START ##### ");
} else { } else {
m_nextStatusRequested = -1; m_nextStatusRequested = -1;
// disable periodic call ... // disable periodic call ...
@ -281,7 +281,7 @@ bool ewol::compositing::Shaper::periodicCall(const ewol::event::Time& _event) {
m_stateTransition += _event.getDeltaCall() / timeRelativity; m_stateTransition += _event.getDeltaCall() / timeRelativity;
//m_stateTransition += _event.getDeltaCall(); //m_stateTransition += _event.getDeltaCall();
m_stateTransition = etk::avg(0.0f, m_stateTransition, 1.0f); m_stateTransition = etk::avg(0.0f, m_stateTransition, 1.0f);
EWOL_VERBOSE("relative=" << timeRelativity << " Transition : " << m_stateTransition); Log.verbose("relative=" << timeRelativity << " Transition : " << m_stateTransition);
} }
return true; return true;
} }
@ -310,97 +310,97 @@ void ewol::compositing::Shaper::addVertexLine(float _yTop,
m_nbVertexToDisplay++; m_nbVertexToDisplay++;
if (_displayOutside == true) { if (_displayOutside == true) {
m_VBO->pushOnBuffer(m_vboIdCoord, vec2(_x1, _yButtom)); m_VBO->pushOnBuffer(m_vboIdCoord, Vector2f(_x1, _yButtom));
m_VBO->pushOnBuffer(m_vboIdPos, vec2(_table[0],_yValButtom)); m_VBO->pushOnBuffer(m_vboIdPos, Vector2f(_table[0],_yValButtom));
m_nbVertexToDisplay++; m_nbVertexToDisplay++;
} else { } else {
m_VBO->pushOnBuffer(m_vboIdCoord, vec2(_x2, _yButtom)); m_VBO->pushOnBuffer(m_vboIdCoord, Vector2f(_x2, _yButtom));
m_VBO->pushOnBuffer(m_vboIdPos, vec2(_table[1],_yValButtom)); m_VBO->pushOnBuffer(m_vboIdPos, Vector2f(_table[1],_yValButtom));
m_nbVertexToDisplay++; m_nbVertexToDisplay++;
} }
} }
if (_displayOutside == true) { if (_displayOutside == true) {
// A // A
m_VBO->pushOnBuffer(m_vboIdCoord, vec2(_x1, _yButtom)); m_VBO->pushOnBuffer(m_vboIdCoord, Vector2f(_x1, _yButtom));
m_VBO->pushOnBuffer(m_vboIdPos, vec2(_table[0],_yValButtom)); m_VBO->pushOnBuffer(m_vboIdPos, Vector2f(_table[0],_yValButtom));
m_nbVertexToDisplay++; m_nbVertexToDisplay++;
m_VBO->pushOnBuffer(m_vboIdCoord, vec2(_x1, _yTop)); m_VBO->pushOnBuffer(m_vboIdCoord, Vector2f(_x1, _yTop));
m_VBO->pushOnBuffer(m_vboIdPos, vec2(_table[0],_yValTop)); m_VBO->pushOnBuffer(m_vboIdPos, Vector2f(_table[0],_yValTop));
m_nbVertexToDisplay++; m_nbVertexToDisplay++;
m_VBO->pushOnBuffer(m_vboIdCoord, vec2(_x2, _yButtom)); m_VBO->pushOnBuffer(m_vboIdCoord, Vector2f(_x2, _yButtom));
m_VBO->pushOnBuffer(m_vboIdPos, vec2(_table[1],_yValButtom)); m_VBO->pushOnBuffer(m_vboIdPos, Vector2f(_table[1],_yValButtom));
m_nbVertexToDisplay++; m_nbVertexToDisplay++;
// B // B
m_VBO->pushOnBuffer(m_vboIdCoord, vec2(_x2, _yTop)); m_VBO->pushOnBuffer(m_vboIdCoord, Vector2f(_x2, _yTop));
m_VBO->pushOnBuffer(m_vboIdPos, vec2(_table[1],_yValTop)); m_VBO->pushOnBuffer(m_vboIdPos, Vector2f(_table[1],_yValTop));
m_nbVertexToDisplay++; m_nbVertexToDisplay++;
// C // C
m_VBO->pushOnBuffer(m_vboIdCoord, vec2(_x3, _yButtom)); m_VBO->pushOnBuffer(m_vboIdCoord, Vector2f(_x3, _yButtom));
m_VBO->pushOnBuffer(m_vboIdPos, vec2(_table[2],_yValButtom)); m_VBO->pushOnBuffer(m_vboIdPos, Vector2f(_table[2],_yValButtom));
m_nbVertexToDisplay++; m_nbVertexToDisplay++;
} else { } else {
// C // C
m_VBO->pushOnBuffer(m_vboIdCoord, vec2(_x2, _yButtom)); m_VBO->pushOnBuffer(m_vboIdCoord, Vector2f(_x2, _yButtom));
m_VBO->pushOnBuffer(m_vboIdPos, vec2(_table[1],_yValButtom)); m_VBO->pushOnBuffer(m_vboIdPos, Vector2f(_table[1],_yValButtom));
m_nbVertexToDisplay++; m_nbVertexToDisplay++;
m_VBO->pushOnBuffer(m_vboIdCoord, vec2(_x2, _yTop)); m_VBO->pushOnBuffer(m_vboIdCoord, Vector2f(_x2, _yTop));
m_VBO->pushOnBuffer(m_vboIdPos, vec2(_table[1],_yValTop)); m_VBO->pushOnBuffer(m_vboIdPos, Vector2f(_table[1],_yValTop));
m_nbVertexToDisplay++; m_nbVertexToDisplay++;
m_VBO->pushOnBuffer(m_vboIdCoord, vec2(_x3, _yButtom)); m_VBO->pushOnBuffer(m_vboIdCoord, Vector2f(_x3, _yButtom));
m_VBO->pushOnBuffer(m_vboIdPos, vec2(_table[2],_yValButtom)); m_VBO->pushOnBuffer(m_vboIdPos, Vector2f(_table[2],_yValButtom));
m_nbVertexToDisplay++; m_nbVertexToDisplay++;
} }
// D // D
m_VBO->pushOnBuffer(m_vboIdCoord, vec2(_x3, _yTop)); m_VBO->pushOnBuffer(m_vboIdCoord, Vector2f(_x3, _yTop));
m_VBO->pushOnBuffer(m_vboIdPos, vec2(_table[2],_yValTop)); m_VBO->pushOnBuffer(m_vboIdPos, Vector2f(_table[2],_yValTop));
m_nbVertexToDisplay++; m_nbVertexToDisplay++;
// E // E
m_VBO->pushOnBuffer(m_vboIdCoord, vec2(_x4, _yButtom)); m_VBO->pushOnBuffer(m_vboIdCoord, Vector2f(_x4, _yButtom));
m_VBO->pushOnBuffer(m_vboIdPos, vec2(_table[3],_yValButtom)); m_VBO->pushOnBuffer(m_vboIdPos, Vector2f(_table[3],_yValButtom));
m_nbVertexToDisplay++; m_nbVertexToDisplay++;
// F // F
m_VBO->pushOnBuffer(m_vboIdCoord, vec2(_x4, _yTop)); m_VBO->pushOnBuffer(m_vboIdCoord, Vector2f(_x4, _yTop));
m_VBO->pushOnBuffer(m_vboIdPos, vec2(_table[3],_yValTop)); m_VBO->pushOnBuffer(m_vboIdPos, Vector2f(_table[3],_yValTop));
m_nbVertexToDisplay++; m_nbVertexToDisplay++;
// G // G
m_VBO->pushOnBuffer(m_vboIdCoord, vec2(_x5, _yButtom)); m_VBO->pushOnBuffer(m_vboIdCoord, Vector2f(_x5, _yButtom));
m_VBO->pushOnBuffer(m_vboIdPos, vec2(_table[4],_yValButtom)); m_VBO->pushOnBuffer(m_vboIdPos, Vector2f(_table[4],_yValButtom));
m_nbVertexToDisplay++; m_nbVertexToDisplay++;
// H // H
m_VBO->pushOnBuffer(m_vboIdCoord, vec2(_x5, _yTop)); m_VBO->pushOnBuffer(m_vboIdCoord, Vector2f(_x5, _yTop));
m_VBO->pushOnBuffer(m_vboIdPos, vec2(_table[4],_yValTop)); m_VBO->pushOnBuffer(m_vboIdPos, Vector2f(_table[4],_yValTop));
m_nbVertexToDisplay++; m_nbVertexToDisplay++;
// I // I
m_VBO->pushOnBuffer(m_vboIdCoord, vec2(_x6, _yButtom)); m_VBO->pushOnBuffer(m_vboIdCoord, Vector2f(_x6, _yButtom));
m_VBO->pushOnBuffer(m_vboIdPos, vec2(_table[5],_yValButtom)); m_VBO->pushOnBuffer(m_vboIdPos, Vector2f(_table[5],_yValButtom));
m_nbVertexToDisplay++; m_nbVertexToDisplay++;
// J // J
m_VBO->pushOnBuffer(m_vboIdCoord, vec2(_x6, _yTop)); m_VBO->pushOnBuffer(m_vboIdCoord, Vector2f(_x6, _yTop));
m_VBO->pushOnBuffer(m_vboIdPos, vec2(_table[5],_yValTop)); m_VBO->pushOnBuffer(m_vboIdPos, Vector2f(_table[5],_yValTop));
m_nbVertexToDisplay++; m_nbVertexToDisplay++;
// K // K
m_VBO->pushOnBuffer(m_vboIdCoord, vec2(_x7, _yButtom)); m_VBO->pushOnBuffer(m_vboIdCoord, Vector2f(_x7, _yButtom));
m_VBO->pushOnBuffer(m_vboIdPos, vec2(_table[6],_yValButtom)); m_VBO->pushOnBuffer(m_vboIdPos, Vector2f(_table[6],_yValButtom));
m_nbVertexToDisplay++; m_nbVertexToDisplay++;
// L // L
m_VBO->pushOnBuffer(m_vboIdCoord, vec2(_x7, _yTop)); m_VBO->pushOnBuffer(m_vboIdCoord, Vector2f(_x7, _yTop));
m_VBO->pushOnBuffer(m_vboIdPos, vec2(_table[6],_yValTop)); m_VBO->pushOnBuffer(m_vboIdPos, Vector2f(_table[6],_yValTop));
m_nbVertexToDisplay++; m_nbVertexToDisplay++;
if (_displayOutside == true) { if (_displayOutside == true) {
// M // M
m_VBO->pushOnBuffer(m_vboIdCoord, vec2(_x8, _yButtom)); m_VBO->pushOnBuffer(m_vboIdCoord, Vector2f(_x8, _yButtom));
m_VBO->pushOnBuffer(m_vboIdPos, vec2(_table[7],_yValButtom)); m_VBO->pushOnBuffer(m_vboIdPos, Vector2f(_table[7],_yValButtom));
m_nbVertexToDisplay++; m_nbVertexToDisplay++;
// N // N
m_VBO->pushOnBuffer(m_vboIdCoord, vec2(_x8, _yTop)); m_VBO->pushOnBuffer(m_vboIdCoord, Vector2f(_x8, _yTop));
m_VBO->pushOnBuffer(m_vboIdPos, vec2(_table[7],_yValTop)); m_VBO->pushOnBuffer(m_vboIdPos, Vector2f(_table[7],_yValTop));
m_nbVertexToDisplay++; m_nbVertexToDisplay++;
} }
} }
@ -451,7 +451,7 @@ const float modeDisplay[][8] = {
{ 1.0f, 1.0f, -1.0f, -1.0f, -1.0f, -1.0f, 1.0f, 1.0f } { 1.0f, 1.0f, -1.0f, -1.0f, -1.0f, -1.0f, 1.0f, 1.0f }
}; };
void ewol::compositing::Shaper::setShape(const vec2& _origin, const vec2& _size, const vec2& _insidePos, const vec2& _insideSize) { void ewol::compositing::Shaper::setShape(const Vector2f& _origin, const Vector2f& _size, const Vector2f& _insidePos, const Vector2f& _insideSize) {
m_VBO->clear(); m_VBO->clear();
ewol::Padding borderTmp = getBorder(); ewol::Padding borderTmp = getBorder();
ewol::Padding paddingIn = getPaddingIn(); ewol::Padding paddingIn = getPaddingIn();
@ -490,9 +490,9 @@ void ewol::compositing::Shaper::setShape(const vec2& _origin, const vec2& _size,
#endif #endif
/* /*
EWOL_ERROR(" enveloppe = " << enveloppe); Log.error(" enveloppe = " << enveloppe);
EWOL_ERROR(" border = " << border); Log.error(" border = " << border);
EWOL_ERROR(" inside = " << inside); Log.error(" inside = " << inside);
*/ */
int32_t mode = 0; int32_t mode = 0;
bool displayOutside = false; bool displayOutside = false;

View File

@ -54,7 +54,7 @@ namespace ewol {
ememory::SharedPtr<gale::resource::Program> m_GLprogram; //!< pointer on the opengl display program ememory::SharedPtr<gale::resource::Program> m_GLprogram; //!< pointer on the opengl display program
int32_t m_GLPosition; //!< openGL id on the element (vertex buffer) int32_t m_GLPosition; //!< openGL id on the element (vertex buffer)
int32_t m_GLMatrix; //!< openGL id on the element (transformation matrix) int32_t m_GLMatrix; //!< openGL id on the element (transformation matrix)
int32_t m_GLPropertyPos; //!< openGL id on the element (simple ratio position in the widget : ____/-----\_____ on vec2(X,Y)) int32_t m_GLPropertyPos; //!< openGL id on the element (simple ratio position in the widget : ____/-----\_____ on Vector2f(X,Y))
int32_t m_GLStateActivate; //!< openGL id on the element (activate state displayed) int32_t m_GLStateActivate; //!< openGL id on the element (activate state displayed)
int32_t m_GLStateOld; //!< openGL id on the element (old state displayed) int32_t m_GLStateOld; //!< openGL id on the element (old state displayed)
int32_t m_GLStateNew; //!< openGL id on the element (new state displayed) int32_t m_GLStateNew; //!< openGL id on the element (new state displayed)
@ -64,10 +64,10 @@ namespace ewol {
ememory::SharedPtr<ewol::resource::TextureFile> m_resourceTexture; //!< texture resources (for the image) ememory::SharedPtr<ewol::resource::TextureFile> m_resourceTexture; //!< texture resources (for the image)
// internal needed data : // internal needed data :
int32_t m_nextStatusRequested; //!< when status is changing, this represent the next step of it int32_t m_nextStatusRequested; //!< when status is changing, this represent the next step of it
vec2 m_propertyOrigin; //!< widget origin Vector2f m_propertyOrigin; //!< widget origin
vec2 m_propertySize; //!< widget size Vector2f m_propertySize; //!< widget size
vec2 m_propertyInsidePosition; //!< internal subwidget position Vector2f m_propertyInsidePosition; //!< internal subwidget position
vec2 m_propertyInsideSize; //!< internal subwidget size Vector2f m_propertyInsideSize; //!< internal subwidget size
int32_t m_stateActivate; //!< Activate state of the element int32_t m_stateActivate; //!< Activate state of the element
int32_t m_stateOld; //!< previous state int32_t m_stateOld; //!< previous state
int32_t m_stateNew; //!< destination state int32_t m_stateNew; //!< destination state
@ -75,7 +75,7 @@ namespace ewol {
int32_t m_nbVertexToDisplay; int32_t m_nbVertexToDisplay;
// color management theme: // color management theme:
ememory::SharedPtr<ewol::resource::ColorFile> m_colorProperty; //!< input resource for color management ememory::SharedPtr<ewol::resource::ColorFile> m_colorProperty; //!< input resource for color management
etk::Vector<ivec2> m_listAssiciatedId; //!< Corellation ID between ColorProperty (Y) and OpenGL Program (X) List<Vector2i> m_listAssiciatedId; //!< Corellation ID between ColorProperty (Y) and OpenGL Program (X)
protected: protected:
static const int32_t m_vboIdCoord; static const int32_t m_vboIdCoord;
static const int32_t m_vboIdPos; static const int32_t m_vboIdPos;
@ -224,11 +224,11 @@ namespace ewol {
* @param[in] _insidePos Positin of the internal data * @param[in] _insidePos Positin of the internal data
* @param[in] _insideSize Size of the internal data * @param[in] _insideSize Size of the internal data
*/ */
void setShape(const vec2& _origin, const vec2& _size, const vec2& _insidePos, const vec2& _insideSize); void setShape(const Vector2f& _origin, const Vector2f& _size, const Vector2f& _insidePos, const Vector2f& _insideSize);
// @previous // @previous
void setShape(const vec2& _origin, const vec2& _size) { void setShape(const Vector2f& _origin, const Vector2f& _size) {
ewol::Padding tmp = getPadding(); ewol::Padding tmp = getPadding();
setShape(_origin, _size, _origin+vec2(tmp.xLeft(), tmp.yButtom()), _size - vec2(tmp.x(), tmp.y())); setShape(_origin, _size, _origin+Vector2f(tmp.xLeft(), tmp.yButtom()), _size - Vector2f(tmp.x(), tmp.y()));
} }
public: public:
/** /**

View File

@ -10,12 +10,12 @@
#include <etk/typeInfo.hpp> #include <etk/typeInfo.hpp>
ETK_DECLARE_TYPE(ewol::compositing::Sprite); ETK_DECLARE_TYPE(ewol::compositing::Sprite);
ewol::compositing::Sprite::Sprite(const etk::String& _imageName, const ivec2& _nbSprite, int32_t _size) : ewol::compositing::Sprite::Sprite(const etk::String& _imageName, const Vector2i& _nbSprite, int32_t _size) :
ewol::compositing::Image(_imageName, false, _size), ewol::compositing::Image(_imageName, false, _size),
m_nbSprite(_nbSprite), m_nbSprite(_nbSprite),
m_unitarySpriteSize(0,0) { m_unitarySpriteSize(0,0) {
/* /*
vec2 imageSize = getRealSize(); Vector2f imageSize = getRealSize();
m_unitarySpriteSize.setValue(imageSize.x()/(float)m_nbSprite.x(), m_unitarySpriteSize.setValue(imageSize.x()/(float)m_nbSprite.x(),
imageSize.y()/(float)m_nbSprite.y()); imageSize.y()/(float)m_nbSprite.y());
*/ */
@ -24,16 +24,16 @@ ewol::compositing::Sprite::Sprite(const etk::String& _imageName, const ivec2& _n
} }
void ewol::compositing::Sprite::printSprite(const ivec2& _spriteID, const vec3& _size) { void ewol::compositing::Sprite::printSprite(const Vector2i& _spriteID, const Vector3f& _size) {
if( _spriteID.x()<0 if( _spriteID.x()<0
|| _spriteID.y()<0 || _spriteID.y()<0
|| _spriteID.x() >= m_nbSprite.x() || _spriteID.x() >= m_nbSprite.x()
|| _spriteID.y() >= m_nbSprite.y()) { || _spriteID.y() >= m_nbSprite.y()) {
return; return;
} }
printPart(vec2(_size.x(),_size.y()), printPart(Vector2f(_size.x(),_size.y()),
vec2((float)(_spriteID.x() )*m_unitarySpriteSize.x(), (float)(_spriteID.y() )*m_unitarySpriteSize.y()), Vector2f((float)(_spriteID.x() )*m_unitarySpriteSize.x(), (float)(_spriteID.y() )*m_unitarySpriteSize.y()),
vec2((float)(_spriteID.x()+1)*m_unitarySpriteSize.x(), (float)(_spriteID.y()+1)*m_unitarySpriteSize.y())); Vector2f((float)(_spriteID.x()+1)*m_unitarySpriteSize.x(), (float)(_spriteID.y()+1)*m_unitarySpriteSize.y()));
} }

View File

@ -12,17 +12,17 @@ namespace ewol {
namespace compositing { namespace compositing {
class Sprite : public ewol::compositing::Image { class Sprite : public ewol::compositing::Image {
protected: protected:
ivec2 m_nbSprite; //!< number of sprite in vertical and horizontal Vector2i m_nbSprite; //!< number of sprite in vertical and horizontal
vec2 m_unitarySpriteSize; //!< size of a unique sprite Vector2f m_unitarySpriteSize; //!< size of a unique sprite
public: public:
Sprite(const etk::String& _imageName, Sprite(const etk::String& _imageName,
const ivec2& _nbSprite, const Vector2i& _nbSprite,
int32_t _size=ewol::compositing::Image::sizeAuto); int32_t _size=ewol::compositing::Image::sizeAuto);
virtual ~Sprite() {}; virtual ~Sprite() {};
void printSprite(const ivec2& _spriteID, const vec2& _size) { void printSprite(const Vector2i& _spriteID, const Vector2f& _size) {
printSprite(_spriteID, vec3(_size.x(), _size.y(),0)); printSprite(_spriteID, Vector3f(_size.x(), _size.y(),0));
}; };
void printSprite(const ivec2& _spriteID, const vec3& _size); void printSprite(const Vector2i& _spriteID, const Vector3f& _size);
}; };
} }
} }

View File

@ -37,7 +37,7 @@ void ewol::compositing::Text::drawMT(const mat4& _transformationMatrix, bool _en
return; return;
} }
if (m_GLprogram == null) { if (m_GLprogram == null) {
EWOL_ERROR("No shader ..."); Log.error("No shader ...");
return; return;
} }
if (_enableDepthTest == true) { if (_enableDepthTest == true) {
@ -81,7 +81,7 @@ void ewol::compositing::Text::drawD(bool _disableDepthTest) {
return; return;
} }
if (m_GLprogram == null) { if (m_GLprogram == null) {
EWOL_ERROR("No shader ..."); Log.error("No shader ...");
return; return;
} }
// set Matrix : translation/positionMatrix // set Matrix : translation/positionMatrix
@ -158,11 +158,11 @@ void ewol::compositing::Text::setFont(etk::String _fontName, int32_t _fontSize)
} }
_fontName += ":"; _fontName += ":";
_fontName += etk::toString(_fontSize); _fontName += etk::toString(_fontSize);
EWOL_VERBOSE("plop : " << _fontName << " size=" << _fontSize << " result :" << _fontName); Log.verbose("plop : " << _fontName << " size=" << _fontSize << " result :" << _fontName);
// link to new one // link to new one
m_font = ewol::resource::TexturedFont::create(_fontName); m_font = ewol::resource::TexturedFont::create(_fontName);
if (m_font == null) { if (m_font == null) {
EWOL_ERROR("Can not get font resource"); Log.error("Can not get font resource");
m_font = previousFont; m_font = previousFont;
} }
} }
@ -177,7 +177,7 @@ void ewol::compositing::Text::printChar(const char32_t& _charcode) {
// get a pointer on the glyph property : // get a pointer on the glyph property :
ewol::GlyphProperty* myGlyph = getGlyphPointer(_charcode); ewol::GlyphProperty* myGlyph = getGlyphPointer(_charcode);
if (null == myGlyph) { if (null == myGlyph) {
EWOL_ERROR(" font does not really existed ..."); Log.error(" font does not really existed ...");
return; return;
} }
int32_t fontSize = getSize(); int32_t fontSize = getSize();
@ -188,7 +188,7 @@ void ewol::compositing::Text::printChar(const char32_t& _charcode) {
if (m_kerning == true) { if (m_kerning == true) {
kerningOffset = myGlyph->kerningGet(m_previousCharcode); kerningOffset = myGlyph->kerningGet(m_previousCharcode);
if (kerningOffset != 0) { if (kerningOffset != 0) {
//EWOL_DEBUG("Kerning between : '" << m_previousCharcode << "'&'" << myGlyph->m_UVal << "' value : " << kerningOffset); //Log.debug("Kerning between : '" << m_previousCharcode << "'&'" << myGlyph->m_UVal << "' value : " << kerningOffset);
} }
} }
// 0x01 == 0x20 == ' '; // 0x01 == 0x20 == ' ';
@ -271,7 +271,7 @@ void ewol::compositing::Text::printChar(const char32_t& _charcode) {
* 3------2 * 3------2
*/ */
if (m_needDisplay == true) { if (m_needDisplay == true) {
vec3 bitmapDrawPos[4]; Vector3f bitmapDrawPos[4];
bitmapDrawPos[0].setValue((int32_t)dxA, (int32_t)dyC, 0); bitmapDrawPos[0].setValue((int32_t)dxA, (int32_t)dyC, 0);
bitmapDrawPos[1].setValue((int32_t)dxB, (int32_t)dyC, 0); bitmapDrawPos[1].setValue((int32_t)dxB, (int32_t)dyC, 0);
bitmapDrawPos[2].setValue((int32_t)dxB, (int32_t)dyD, 0); bitmapDrawPos[2].setValue((int32_t)dxB, (int32_t)dyD, 0);
@ -282,7 +282,7 @@ void ewol::compositing::Text::printChar(const char32_t& _charcode) {
* | | * | |
* 3------2 * 3------2
*/ */
vec2 texturePos[4]; Vector2f texturePos[4];
texturePos[0].setValue(tuA+m_mode, tvC); texturePos[0].setValue(tuA+m_mode, tvC);
texturePos[1].setValue(tuB+m_mode, tvC); texturePos[1].setValue(tuB+m_mode, tvC);
texturePos[2].setValue(tuB+m_mode, tvD); texturePos[2].setValue(tuB+m_mode, tvD);
@ -332,9 +332,9 @@ void ewol::compositing::Text::printChar(const char32_t& _charcode) {
} }
} }
// move the position : // move the position :
//EWOL_DEBUG(" 5 pos=" << m_position << " advance=" << myGlyph->m_advance.x() << " kerningOffset=" << kerningOffset); //Log.debug(" 5 pos=" << m_position << " advance=" << myGlyph->m_advance.x() << " kerningOffset=" << kerningOffset);
m_position.setX(m_position.x() + myGlyph->m_advance.x() + kerningOffset); m_position.setX(m_position.x() + myGlyph->m_advance.x() + kerningOffset);
//EWOL_DEBUG(" 6 print '" << charcode << "' : start=" << m_sizeDisplayStart << " stop=" << m_sizeDisplayStop << " pos=" << m_position); //Log.debug(" 6 print '" << charcode << "' : start=" << m_sizeDisplayStart << " stop=" << m_sizeDisplayStop << " pos=" << m_position);
// Register the previous character // Register the previous character
m_previousCharcode = _charcode; m_previousCharcode = _charcode;
m_VBO->flush(); m_VBO->flush();
@ -342,7 +342,7 @@ void ewol::compositing::Text::printChar(const char32_t& _charcode) {
} }
vec3 ewol::compositing::Text::calculateSizeChar(const char32_t& _charcode) { Vector3f ewol::compositing::Text::calculateSizeChar(const char32_t& _charcode) {
// get a pointer on the glyph property : // get a pointer on the glyph property :
ewol::GlyphProperty * myGlyph = getGlyphPointer(_charcode); ewol::GlyphProperty * myGlyph = getGlyphPointer(_charcode);
int32_t fontHeigh = getHeight(); int32_t fontHeigh = getHeight();
@ -352,7 +352,7 @@ vec3 ewol::compositing::Text::calculateSizeChar(const char32_t& _charcode) {
} else { } else {
EWOL_WARNING("no Glyph... in font : " << m_font->getName()); EWOL_WARNING("no Glyph... in font : " << m_font->getName());
} }
return vec3((float)(0.2), return Vector3f((float)(0.2),
(float)(fontHeigh), (float)(fontHeigh),
(float)(0.0)); (float)(0.0));
} }
@ -362,7 +362,7 @@ vec3 ewol::compositing::Text::calculateSizeChar(const char32_t& _charcode) {
kerningOffset = myGlyph->kerningGet(m_previousCharcode); kerningOffset = myGlyph->kerningGet(m_previousCharcode);
} }
vec3 outputSize((float)(myGlyph->m_advance.x() + kerningOffset), Vector3f outputSize((float)(myGlyph->m_advance.x() + kerningOffset),
(float)(fontHeigh), (float)(fontHeigh),
(float)(0.0)); (float)(0.0));
// Register the previous character // Register the previous character

View File

@ -49,7 +49,7 @@ namespace ewol {
virtual void setFont(etk::String _fontName, int32_t _fontSize); virtual void setFont(etk::String _fontName, int32_t _fontSize);
virtual void setFontMode(enum ewol::font::mode _mode); virtual void setFontMode(enum ewol::font::mode _mode);
virtual void printChar(const char32_t& _charcode); virtual void printChar(const char32_t& _charcode);
virtual vec3 calculateSizeChar(const char32_t& _charcode); virtual Vector3f calculateSizeChar(const char32_t& _charcode);
}; };
} }
} }

View File

@ -49,7 +49,7 @@ ewol::compositing::TextBase::TextBase(const etk::String& _shaderName, bool _load
// Create the VBO: // Create the VBO:
m_VBO = gale::resource::VirtualBufferObject::create(NB_VBO); m_VBO = gale::resource::VirtualBufferObject::create(NB_VBO);
if (m_VBO == null) { if (m_VBO == null) {
EWOL_ERROR("can not instanciate VBO ..."); Log.error("can not instanciate VBO ...");
return; return;
} }
// TO facilitate some debugs we add a name of the VBO: // TO facilitate some debugs we add a name of the VBO:
@ -75,23 +75,23 @@ void ewol::compositing::TextBase::loadProgram(const etk::String& _shaderName) {
m_GLtextWidth = m_GLprogram->getUniform("EW_texWidth"); m_GLtextWidth = m_GLprogram->getUniform("EW_texWidth");
m_GLtextHeight = m_GLprogram->getUniform("EW_texHeight"); m_GLtextHeight = m_GLprogram->getUniform("EW_texHeight");
} else { } else {
EWOL_ERROR("Can not load the program => create previous one..."); Log.error("Can not load the program => create previous one...");
m_GLprogram = old; m_GLprogram = old;
old = null; old = null;
} }
} }
void ewol::compositing::TextBase::translate(const vec3& _vect) { void ewol::compositing::TextBase::translate(const Vector3f& _vect) {
ewol::Compositing::translate(_vect); ewol::Compositing::translate(_vect);
m_vectorialDraw.translate(_vect); m_vectorialDraw.translate(_vect);
} }
void ewol::compositing::TextBase::rotate(const vec3& _vect, float _angle) { void ewol::compositing::TextBase::rotate(const Vector3f& _vect, float _angle) {
ewol::Compositing::rotate(_vect, _angle); ewol::Compositing::rotate(_vect, _angle);
m_vectorialDraw.rotate(_vect, _angle); m_vectorialDraw.rotate(_vect, _angle);
} }
void ewol::compositing::TextBase::scale(const vec3& _vect) { void ewol::compositing::TextBase::scale(const Vector3f& _vect) {
ewol::Compositing::scale(_vect); ewol::Compositing::scale(_vect);
m_vectorialDraw.scale(_vect); m_vectorialDraw.scale(_vect);
} }
@ -108,9 +108,9 @@ void ewol::compositing::TextBase::clear() {
} }
void ewol::compositing::TextBase::reset() { void ewol::compositing::TextBase::reset() {
m_position = vec3(0,0,0); m_position = Vector3f(0,0,0);
m_clippingPosStart = vec3(0,0,0); m_clippingPosStart = Vector3f(0,0,0);
m_clippingPosStop = vec3(0,0,0); m_clippingPosStop = Vector3f(0,0,0);
m_sizeDisplayStart = m_position; m_sizeDisplayStart = m_position;
m_sizeDisplayStop = m_position; m_sizeDisplayStop = m_position;
m_nbCharDisplayed = 0; m_nbCharDisplayed = 0;
@ -130,15 +130,15 @@ void ewol::compositing::TextBase::reset() {
m_nbCharDisplayed = 0; m_nbCharDisplayed = 0;
} }
void ewol::compositing::TextBase::setPos(const vec3& _pos) { void ewol::compositing::TextBase::setPos(const Vector3f& _pos) {
// check min max for display area // check min max for display area
if (m_nbCharDisplayed != 0) { if (m_nbCharDisplayed != 0) {
EWOL_VERBOSE("update size 1 " << m_sizeDisplayStart << " " << m_sizeDisplayStop); Log.verbose("update size 1 " << m_sizeDisplayStart << " " << m_sizeDisplayStop);
m_sizeDisplayStop.setX(etk::max(m_position.x(), m_sizeDisplayStop.x())); m_sizeDisplayStop.setX(etk::max(m_position.x(), m_sizeDisplayStop.x()));
m_sizeDisplayStop.setY(etk::max(m_position.y(), m_sizeDisplayStop.y())); m_sizeDisplayStop.setY(etk::max(m_position.y(), m_sizeDisplayStop.y()));
m_sizeDisplayStart.setX(etk::min(m_position.x(), m_sizeDisplayStart.x())); m_sizeDisplayStart.setX(etk::min(m_position.x(), m_sizeDisplayStart.x()));
m_sizeDisplayStart.setY(etk::min(m_position.y(), m_sizeDisplayStart.y())); m_sizeDisplayStart.setY(etk::min(m_position.y(), m_sizeDisplayStart.y()));
EWOL_VERBOSE("update size 2 " << m_sizeDisplayStart << " " << m_sizeDisplayStop); Log.verbose("update size 2 " << m_sizeDisplayStart << " " << m_sizeDisplayStop);
} }
// update position // update position
m_position = _pos; m_position = _pos;
@ -149,18 +149,18 @@ void ewol::compositing::TextBase::setPos(const vec3& _pos) {
m_sizeDisplayStart = m_position; m_sizeDisplayStart = m_position;
m_sizeDisplayStop = m_position; m_sizeDisplayStop = m_position;
m_sizeDisplayStop.setY( m_sizeDisplayStop.y()+ getHeight()); m_sizeDisplayStop.setY( m_sizeDisplayStop.y()+ getHeight());
EWOL_VERBOSE("update size 0 " << m_sizeDisplayStart << " " << m_sizeDisplayStop); Log.verbose("update size 0 " << m_sizeDisplayStart << " " << m_sizeDisplayStop);
} else { } else {
EWOL_VERBOSE("update size 3 " << m_sizeDisplayStart << " " << m_sizeDisplayStop); Log.verbose("update size 3 " << m_sizeDisplayStart << " " << m_sizeDisplayStop);
m_sizeDisplayStop.setX(etk::max(m_position.x(), m_sizeDisplayStop.x())); m_sizeDisplayStop.setX(etk::max(m_position.x(), m_sizeDisplayStop.x()));
m_sizeDisplayStop.setY(etk::max(m_position.y(), m_sizeDisplayStop.y())); m_sizeDisplayStop.setY(etk::max(m_position.y(), m_sizeDisplayStop.y()));
m_sizeDisplayStart.setX(etk::min(m_position.x(), m_sizeDisplayStart.x())); m_sizeDisplayStart.setX(etk::min(m_position.x(), m_sizeDisplayStart.x()));
m_sizeDisplayStart.setY(etk::min(m_position.y(), m_sizeDisplayStart.y())); m_sizeDisplayStart.setY(etk::min(m_position.y(), m_sizeDisplayStart.y()));
EWOL_VERBOSE("update size 4 " << m_sizeDisplayStart << " " << m_sizeDisplayStop); Log.verbose("update size 4 " << m_sizeDisplayStart << " " << m_sizeDisplayStop);
} }
} }
void ewol::compositing::TextBase::setRelPos(const vec3& _pos) { void ewol::compositing::TextBase::setRelPos(const Vector3f& _pos) {
m_position += _pos; m_position += _pos;
m_previousCharcode = 0; m_previousCharcode = 0;
m_vectorialDraw.setPos(m_position); m_vectorialDraw.setPos(m_position);
@ -171,7 +171,7 @@ void ewol::compositing::TextBase::setColorBg(const etk::Color<>& _color) {
m_vectorialDraw.setColor(_color); m_vectorialDraw.setColor(_color);
} }
void ewol::compositing::TextBase::setClipping(const vec3& _pos, const vec3& _posEnd) { void ewol::compositing::TextBase::setClipping(const Vector3f& _pos, const Vector3f& _posEnd) {
// note the internal system all time request to have a bounding all time in the same order // note the internal system all time request to have a bounding all time in the same order
if (_pos.x() <= _posEnd.x()) { if (_pos.x() <= _posEnd.x()) {
m_clippingPosStart.setX(_pos.x()); m_clippingPosStart.setX(_pos.x());
@ -244,12 +244,12 @@ void ewol::compositing::TextBase::setKerningMode(bool _newMode) {
} }
void ewol::compositing::TextBase::print(const etk::UString& _text) { void ewol::compositing::TextBase::print(const etk::UString& _text) {
etk::Vector<TextDecoration> decorationEmpty; List<TextDecoration> decorationEmpty;
print(_text, decorationEmpty); print(_text, decorationEmpty);
} }
void ewol::compositing::TextBase::print(const etk::String& _text) { void ewol::compositing::TextBase::print(const etk::String& _text) {
etk::Vector<TextDecoration> decorationEmpty; List<TextDecoration> decorationEmpty;
print(_text, decorationEmpty); print(_text, decorationEmpty);
} }
@ -257,7 +257,7 @@ void ewol::compositing::TextBase::print(const etk::String& _text) {
void ewol::compositing::TextBase::parseHtmlNode(const exml::Element& _element) { void ewol::compositing::TextBase::parseHtmlNode(const exml::Element& _element) {
// get the static real pointer // get the static real pointer
if (_element.exist() == false) { if (_element.exist() == false) {
EWOL_ERROR( "Error Input node does not existed ..."); Log.error( "Error Input node does not existed ...");
return; return;
} }
for(auto it : _element.nodes) { for(auto it : _element.nodes) {
@ -266,23 +266,23 @@ void ewol::compositing::TextBase::parseHtmlNode(const exml::Element& _element) {
continue; continue;
} else if (it.isText() == true) { } else if (it.isText() == true) {
htmlAddData(etk::toUString(it.getValue())); htmlAddData(etk::toUString(it.getValue()));
EWOL_VERBOSE("XML add : " << it.getValue()); Log.verbose("XML add : " << it.getValue());
continue; continue;
} else if (it.isElement() == false) { } else if (it.isElement() == false) {
EWOL_ERROR("(l "<< it.getPos() << ") node not suported type : " << it.getType() << " val='"<< it.getValue() << "'" ); Log.error("(l "<< it.getPos() << ") node not suported type : " << it.getType() << " val='"<< it.getValue() << "'" );
continue; continue;
} }
exml::Element elem = it.toElement(); exml::Element elem = it.toElement();
if (elem.exist() == false) { if (elem.exist() == false) {
EWOL_ERROR("Cast error ..."); Log.error("Cast error ...");
continue; continue;
} }
if(etk::compare_no_case(elem.getValue(), "br") == true) { if(etk::compare_no_case(elem.getValue(), "br") == true) {
htmlFlush(); htmlFlush();
EWOL_VERBOSE("XML flush & newLine"); Log.verbose("XML flush & newLine");
forceLineReturn(); forceLineReturn();
} else if (etk::compare_no_case(elem.getValue(), "font") == true) { } else if (etk::compare_no_case(elem.getValue(), "font") == true) {
EWOL_VERBOSE("XML Font ..."); Log.verbose("XML Font ...");
TextDecoration tmpDeco = m_htmlDecoTmp; TextDecoration tmpDeco = m_htmlDecoTmp;
etk::String colorValue = elem.attributes["color"]; etk::String colorValue = elem.attributes["color"];
if (colorValue.size() != 0) { if (colorValue.size() != 0) {
@ -296,7 +296,7 @@ void ewol::compositing::TextBase::parseHtmlNode(const exml::Element& _element) {
m_htmlDecoTmp = tmpDeco; m_htmlDecoTmp = tmpDeco;
} else if( etk::compare_no_case(elem.getValue(), "b") == true } else if( etk::compare_no_case(elem.getValue(), "b") == true
|| etk::compare_no_case(elem.getValue(), "bold") == true) { || etk::compare_no_case(elem.getValue(), "bold") == true) {
EWOL_VERBOSE("XML bold ..."); Log.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) {
m_htmlDecoTmp.m_mode = ewol::font::Bold; m_htmlDecoTmp.m_mode = ewol::font::Bold;
@ -307,7 +307,7 @@ void ewol::compositing::TextBase::parseHtmlNode(const exml::Element& _element) {
m_htmlDecoTmp = tmpDeco; m_htmlDecoTmp = tmpDeco;
} else if( etk::compare_no_case(elem.getValue(), "i") == true } else if( etk::compare_no_case(elem.getValue(), "i") == true
|| etk::compare_no_case(elem.getValue(), "italic") == true) { || etk::compare_no_case(elem.getValue(), "italic") == true) {
EWOL_VERBOSE("XML italic ..."); Log.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) {
m_htmlDecoTmp.m_mode = ewol::font::Italic; m_htmlDecoTmp.m_mode = ewol::font::Italic;
@ -318,38 +318,38 @@ void ewol::compositing::TextBase::parseHtmlNode(const exml::Element& _element) {
m_htmlDecoTmp = tmpDeco; m_htmlDecoTmp = tmpDeco;
} else if( etk::compare_no_case(elem.getValue(), "u") == true } else if( etk::compare_no_case(elem.getValue(), "u") == true
|| etk::compare_no_case(elem.getValue(), "underline") == true) { || etk::compare_no_case(elem.getValue(), "underline") == true) {
EWOL_VERBOSE("XML underline ..."); Log.verbose("XML underline ...");
parseHtmlNode(elem); parseHtmlNode(elem);
} else if( etk::compare_no_case(elem.getValue(), "p") == true } else if( etk::compare_no_case(elem.getValue(), "p") == true
|| etk::compare_no_case(elem.getValue(), "paragraph") == true) { || etk::compare_no_case(elem.getValue(), "paragraph") == true) {
EWOL_VERBOSE("XML paragraph ..."); Log.verbose("XML paragraph ...");
htmlFlush(); htmlFlush();
m_alignement = alignLeft; m_alignement = alignLeft;
forceLineReturn(); forceLineReturn();
parseHtmlNode(elem); parseHtmlNode(elem);
forceLineReturn(); forceLineReturn();
} else if (etk::compare_no_case(elem.getValue(), "center") == true) { } else if (etk::compare_no_case(elem.getValue(), "center") == true) {
EWOL_VERBOSE("XML center ..."); Log.verbose("XML center ...");
htmlFlush(); htmlFlush();
m_alignement = alignCenter; m_alignement = alignCenter;
parseHtmlNode(elem); parseHtmlNode(elem);
} else if (etk::compare_no_case(elem.getValue(), "left") == true) { } else if (etk::compare_no_case(elem.getValue(), "left") == true) {
EWOL_VERBOSE("XML left ..."); Log.verbose("XML left ...");
htmlFlush(); htmlFlush();
m_alignement = alignLeft; m_alignement = alignLeft;
parseHtmlNode(elem); parseHtmlNode(elem);
} else if (etk::compare_no_case(elem.getValue(), "right") == true) { } else if (etk::compare_no_case(elem.getValue(), "right") == true) {
EWOL_VERBOSE("XML right ..."); Log.verbose("XML right ...");
htmlFlush(); htmlFlush();
m_alignement = alignRight; m_alignement = alignRight;
parseHtmlNode(elem); parseHtmlNode(elem);
} else if (etk::compare_no_case(elem.getValue(), "justify") == true) { } else if (etk::compare_no_case(elem.getValue(), "justify") == true) {
EWOL_VERBOSE("XML justify ..."); Log.verbose("XML justify ...");
htmlFlush(); htmlFlush();
m_alignement = alignJustify; m_alignement = alignJustify;
parseHtmlNode(elem); parseHtmlNode(elem);
} else { } else {
EWOL_ERROR("(l "<< elem.getPos() << ") node not suported type: " << elem.getType() << " val='"<< elem.getValue() << "'" ); Log.error("(l "<< elem.getPos() << ") node not suported type: " << elem.getType() << " val='"<< elem.getValue() << "'" );
} }
} }
} }
@ -358,7 +358,7 @@ void ewol::compositing::TextBase::printDecorated(const etk::String& _text) {
etk::String tmpData("<html>\n<body>\n"); etk::String tmpData("<html>\n<body>\n");
tmpData += _text; tmpData += _text;
tmpData += "\n</body>\n</html>\n"; tmpData += "\n</body>\n</html>\n";
//EWOL_DEBUG("plop : " << tmpData); //Log.debug("plop : " << tmpData);
printHTML(tmpData); printHTML(tmpData);
} }
@ -366,7 +366,7 @@ void ewol::compositing::TextBase::printDecorated(const etk::UString& _text) {
etk::UString tmpData(U"<html>\n<body>\n"); etk::UString tmpData(U"<html>\n<body>\n");
tmpData += _text; tmpData += _text;
tmpData += U"\n</body>\n</html>\n"; tmpData += U"\n</body>\n</html>\n";
//EWOL_DEBUG("plop : " << tmpData); //Log.debug("plop : " << tmpData);
printHTML(tmpData); printHTML(tmpData);
} }
@ -379,19 +379,19 @@ void ewol::compositing::TextBase::printHTML(const etk::String& _text) {
m_htmlDecoTmp.m_mode = ewol::font::Regular; m_htmlDecoTmp.m_mode = ewol::font::Regular;
if (doc.parse(_text) == false) { if (doc.parse(_text) == false) {
EWOL_ERROR( "can not load XML: PARSING error: Decorated text "); Log.error( "can not load XML: PARSING error: Decorated text ");
return; return;
} }
exml::Element root = doc.nodes["html"]; exml::Element root = doc.nodes["html"];
if (root.exist() == false) { if (root.exist() == false) {
EWOL_ERROR( "can not load XML: main node not find: 'html'"); Log.error( "can not load XML: main node not find: 'html'");
doc.display(); doc.display();
return; return;
} }
exml::Element bodyNode = root.nodes["body"]; exml::Element bodyNode = root.nodes["body"];
if (root.exist() == false) { if (root.exist() == false) {
EWOL_ERROR( "can not load XML: main node not find: 'body'"); Log.error( "can not load XML: main node not find: 'body'");
return; return;
} }
parseHtmlNode(bodyNode); parseHtmlNode(bodyNode);
@ -407,30 +407,30 @@ void ewol::compositing::TextBase::printHTML(const etk::UString& _text) {
m_htmlDecoTmp.m_mode = ewol::font::Regular; m_htmlDecoTmp.m_mode = ewol::font::Regular;
// TODO : Create an instance of xml parser to manage etk::UString... // TODO : Create an instance of xml parser to manage etk::UString...
if (doc.parse(etk::toString(_text)) == false) { if (doc.parse(etk::toString(_text)) == false) {
EWOL_ERROR( "can not load XML: PARSING error: Decorated text "); Log.error( "can not load XML: PARSING error: Decorated text ");
return; return;
} }
exml::Element root = doc.nodes["html"]; exml::Element root = doc.nodes["html"];
if (root.exist() == false) { if (root.exist() == false) {
EWOL_ERROR( "can not load XML: main node not find: 'html'"); Log.error( "can not load XML: main node not find: 'html'");
doc.display(); doc.display();
return; return;
} }
exml::Element bodyNode = root.nodes["body"]; exml::Element bodyNode = root.nodes["body"];
if (root.exist() == false) { if (root.exist() == false) {
EWOL_ERROR( "can not load XML: main node not find: 'body'"); Log.error( "can not load XML: main node not find: 'body'");
return; return;
} }
parseHtmlNode(bodyNode); parseHtmlNode(bodyNode);
htmlFlush(); htmlFlush();
} }
void ewol::compositing::TextBase::print(const etk::String& _text, const etk::Vector<TextDecoration>& _decoration) { void ewol::compositing::TextBase::print(const etk::String& _text, const List<TextDecoration>& _decoration) {
etk::Color<> tmpFg(m_color); etk::Color<> tmpFg(m_color);
etk::Color<> tmpBg(m_colorBg); etk::Color<> tmpBg(m_colorBg);
if (m_alignement == alignDisable) { if (m_alignement == alignDisable) {
//EWOL_DEBUG(" 1 print in not alligned mode : start=" << m_sizeDisplayStart << " stop=" << m_sizeDisplayStop << " pos=" << m_position); //Log.debug(" 1 print in not alligned mode : start=" << m_sizeDisplayStart << " stop=" << m_sizeDisplayStop << " pos=" << m_position);
// display the cursor if needed (if it is at the start position...) // display the cursor if needed (if it is at the start position...)
if (m_needDisplay == true) { if (m_needDisplay == true) {
if (0 == m_cursorPos) { if (0 == m_cursorPos) {
@ -462,11 +462,11 @@ void ewol::compositing::TextBase::print(const etk::String& _text, const etk::Vec
} }
if( m_needDisplay == true if( m_needDisplay == true
&& m_colorBg.a() != 0) { && m_colorBg.a() != 0) {
vec3 pos = m_position; Vector3f pos = m_position;
m_vectorialDraw.setPos(pos); m_vectorialDraw.setPos(pos);
printChar(_text[iii]); printChar(_text[iii]);
float fontHeigh = getHeight(); float fontHeigh = getHeight();
m_vectorialDraw.rectangleWidth(vec3(m_position.x()-pos.x(),fontHeigh,0.0f) ); m_vectorialDraw.rectangleWidth(Vector3f(m_position.x()-pos.x(),fontHeigh,0.0f) );
m_nbCharDisplayed++; m_nbCharDisplayed++;
} else { } else {
printChar(_text[iii]); printChar(_text[iii]);
@ -481,9 +481,9 @@ void ewol::compositing::TextBase::print(const etk::String& _text, const etk::Vec
} }
} }
} }
//EWOL_DEBUG(" 2 print in not alligned mode : start=" << m_sizeDisplayStart << " stop=" << m_sizeDisplayStop << " pos=" << m_position); //Log.debug(" 2 print in not alligned mode : start=" << m_sizeDisplayStart << " stop=" << m_sizeDisplayStop << " pos=" << m_position);
} else { } else {
//EWOL_DEBUG(" 3 print in not alligned mode : start=" << m_sizeDisplayStart << " stop=" << m_sizeDisplayStop << " pos=" << m_position); //Log.debug(" 3 print in not alligned mode : start=" << m_sizeDisplayStart << " stop=" << m_sizeDisplayStop << " pos=" << m_position);
// special start case at the right of the endpoint : // special start case at the right of the endpoint :
if (m_stopTextPos < m_position.x()) { if (m_stopTextPos < m_position.x()) {
forceLineReturn(); forceLineReturn();
@ -509,7 +509,7 @@ void ewol::compositing::TextBase::print(const etk::String& _text, const etk::Vec
case alignRight: case alignRight:
if (m_needDisplay == true) { if (m_needDisplay == true) {
// Move the first char at the right : // Move the first char at the right :
setPos(vec3(m_position.x() + freeSpace, setPos(Vector3f(m_position.x() + freeSpace,
m_position.y(), m_position.y(),
m_position.z()) ); m_position.z()) );
} }
@ -517,7 +517,7 @@ void ewol::compositing::TextBase::print(const etk::String& _text, const etk::Vec
case alignCenter: case alignCenter:
if (m_needDisplay == true) { if (m_needDisplay == true) {
// Move the first char at the right : // Move the first char at the right :
setPos(vec3(m_position.x() + freeSpace/2, setPos(Vector3f(m_position.x() + freeSpace/2,
m_position.y(), m_position.y(),
m_position.z()) ); m_position.z()) );
} }
@ -552,27 +552,27 @@ void ewol::compositing::TextBase::print(const etk::String& _text, const etk::Vec
} }
// special for the justify mode // special for the justify mode
if ((char32_t)_text[iii] == u32char::Space) { if ((char32_t)_text[iii] == u32char::Space) {
//EWOL_DEBUG(" generateString : \" \""); //Log.debug(" generateString : \" \"");
if( m_needDisplay == true if( m_needDisplay == true
&& m_colorBg.a() != 0) { && m_colorBg.a() != 0) {
m_vectorialDraw.setPos(m_position); m_vectorialDraw.setPos(m_position);
} }
// Must generate a dynamic space : // Must generate a dynamic space :
setPos(vec3(m_position.x() + interpolation, setPos(Vector3f(m_position.x() + interpolation,
m_position.y(), m_position.y(),
m_position.z()) ); m_position.z()) );
if( m_needDisplay == true if( m_needDisplay == true
&& m_colorBg.a() != 0) { && m_colorBg.a() != 0) {
m_vectorialDraw.rectangleWidth(vec3(interpolation,fontHeigh,0.0f) ); m_vectorialDraw.rectangleWidth(Vector3f(interpolation,fontHeigh,0.0f) );
} }
} else { } else {
//EWOL_DEBUG(" generateString : \"" << (char)text[iii] << "\""); //Log.debug(" generateString : \"" << (char)text[iii] << "\"");
if( m_needDisplay == true if( m_needDisplay == true
&& m_colorBg.a() != 0) { && m_colorBg.a() != 0) {
vec3 pos = m_position; Vector3f pos = m_position;
m_vectorialDraw.setPos(pos); m_vectorialDraw.setPos(pos);
printChar(_text[iii]); printChar(_text[iii]);
m_vectorialDraw.rectangleWidth(vec3(m_position.x()-pos.x(),fontHeigh,0.0f) ); m_vectorialDraw.rectangleWidth(Vector3f(m_position.x()-pos.x(),fontHeigh,0.0f) );
m_nbCharDisplayed++; m_nbCharDisplayed++;
} else { } else {
printChar(_text[iii]); printChar(_text[iii]);
@ -592,14 +592,14 @@ void ewol::compositing::TextBase::print(const etk::String& _text, const etk::Vec
} else if((char32_t)_text[stop] == u32char::Space) { } else if((char32_t)_text[stop] == u32char::Space) {
currentId = stop+1; currentId = stop+1;
// reset position : // reset position :
setPos(vec3(m_startTextpos, setPos(Vector3f(m_startTextpos,
(float)(m_position.y() - getHeight()), (float)(m_position.y() - getHeight()),
m_position.z()) ); m_position.z()) );
m_nbCharDisplayed++; m_nbCharDisplayed++;
} else if((char32_t)_text[stop] == u32char::Return) { } else if((char32_t)_text[stop] == u32char::Return) {
currentId = stop+1; currentId = stop+1;
// reset position : // reset position :
setPos(vec3(m_startTextpos, setPos(Vector3f(m_startTextpos,
(float)(m_position.y() - getHeight()), (float)(m_position.y() - getHeight()),
m_position.z()) ); m_position.z()) );
m_nbCharDisplayed++; m_nbCharDisplayed++;
@ -607,15 +607,15 @@ void ewol::compositing::TextBase::print(const etk::String& _text, const etk::Vec
currentId = stop; currentId = stop;
} }
} }
//EWOL_DEBUG(" 4 print in not alligned mode : start=" << m_sizeDisplayStart << " stop=" << m_sizeDisplayStop << " pos=" << m_position); //Log.debug(" 4 print in not alligned mode : start=" << m_sizeDisplayStart << " stop=" << m_sizeDisplayStop << " pos=" << m_position);
} }
} }
void ewol::compositing::TextBase::print(const etk::UString& _text, const etk::Vector<TextDecoration>& _decoration) { void ewol::compositing::TextBase::print(const etk::UString& _text, const List<TextDecoration>& _decoration) {
etk::Color<> tmpFg(m_color); etk::Color<> tmpFg(m_color);
etk::Color<> tmpBg(m_colorBg); etk::Color<> tmpBg(m_colorBg);
if (m_alignement == alignDisable) { if (m_alignement == alignDisable) {
//EWOL_DEBUG(" 1 print in not alligned mode : start=" << m_sizeDisplayStart << " stop=" << m_sizeDisplayStop << " pos=" << m_position); //Log.debug(" 1 print in not alligned mode : start=" << m_sizeDisplayStart << " stop=" << m_sizeDisplayStop << " pos=" << m_position);
// display the cursor if needed (if it is at the start position...) // display the cursor if needed (if it is at the start position...)
if (m_needDisplay == true) { if (m_needDisplay == true) {
if (0 == m_cursorPos) { if (0 == m_cursorPos) {
@ -647,11 +647,11 @@ void ewol::compositing::TextBase::print(const etk::UString& _text, const etk::Ve
} }
if( m_needDisplay == true if( m_needDisplay == true
&& m_colorBg.a() != 0) { && m_colorBg.a() != 0) {
vec3 pos = m_position; Vector3f pos = m_position;
m_vectorialDraw.setPos(pos); m_vectorialDraw.setPos(pos);
printChar(_text[iii]); printChar(_text[iii]);
float fontHeigh = getHeight(); float fontHeigh = getHeight();
m_vectorialDraw.rectangleWidth(vec3(m_position.x()-pos.x(),fontHeigh,0.0f) ); m_vectorialDraw.rectangleWidth(Vector3f(m_position.x()-pos.x(),fontHeigh,0.0f) );
m_nbCharDisplayed++; m_nbCharDisplayed++;
} else { } else {
printChar(_text[iii]); printChar(_text[iii]);
@ -666,9 +666,9 @@ void ewol::compositing::TextBase::print(const etk::UString& _text, const etk::Ve
} }
} }
} }
//EWOL_DEBUG(" 2 print in not alligned mode : start=" << m_sizeDisplayStart << " stop=" << m_sizeDisplayStop << " pos=" << m_position); //Log.debug(" 2 print in not alligned mode : start=" << m_sizeDisplayStart << " stop=" << m_sizeDisplayStop << " pos=" << m_position);
} else { } else {
//EWOL_DEBUG(" 3 print in not alligned mode : start=" << m_sizeDisplayStart << " stop=" << m_sizeDisplayStop << " pos=" << m_position); //Log.debug(" 3 print in not alligned mode : start=" << m_sizeDisplayStart << " stop=" << m_sizeDisplayStop << " pos=" << m_position);
// special start case at the right of the endpoint : // special start case at the right of the endpoint :
if (m_stopTextPos < m_position.x()) { if (m_stopTextPos < m_position.x()) {
forceLineReturn(); forceLineReturn();
@ -694,7 +694,7 @@ void ewol::compositing::TextBase::print(const etk::UString& _text, const etk::Ve
case alignRight: case alignRight:
if (m_needDisplay == true) { if (m_needDisplay == true) {
// Move the first char at the right : // Move the first char at the right :
setPos(vec3(m_position.x() + freeSpace, setPos(Vector3f(m_position.x() + freeSpace,
m_position.y(), m_position.y(),
m_position.z()) ); m_position.z()) );
} }
@ -702,7 +702,7 @@ void ewol::compositing::TextBase::print(const etk::UString& _text, const etk::Ve
case alignCenter: case alignCenter:
if (m_needDisplay == true) { if (m_needDisplay == true) {
// Move the first char at the right : // Move the first char at the right :
setPos(vec3(m_position.x() + freeSpace/2, setPos(Vector3f(m_position.x() + freeSpace/2,
m_position.y(), m_position.y(),
m_position.z()) ); m_position.z()) );
} }
@ -737,27 +737,27 @@ void ewol::compositing::TextBase::print(const etk::UString& _text, const etk::Ve
} }
// special for the justify mode // special for the justify mode
if ((char32_t)_text[iii] == u32char::Space) { if ((char32_t)_text[iii] == u32char::Space) {
//EWOL_DEBUG(" generateString : \" \""); //Log.debug(" generateString : \" \"");
if( m_needDisplay == true if( m_needDisplay == true
&& m_colorBg.a() != 0) { && m_colorBg.a() != 0) {
m_vectorialDraw.setPos(m_position); m_vectorialDraw.setPos(m_position);
} }
// Must generate a dynamic space : // Must generate a dynamic space :
setPos(vec3(m_position.x() + interpolation, setPos(Vector3f(m_position.x() + interpolation,
m_position.y(), m_position.y(),
m_position.z()) ); m_position.z()) );
if( m_needDisplay == true if( m_needDisplay == true
&& m_colorBg.a() != 0) { && m_colorBg.a() != 0) {
m_vectorialDraw.rectangleWidth(vec3(interpolation,fontHeigh,0.0f) ); m_vectorialDraw.rectangleWidth(Vector3f(interpolation,fontHeigh,0.0f) );
} }
} else { } else {
//EWOL_DEBUG(" generateString : \"" << (char)text[iii] << "\""); //Log.debug(" generateString : \"" << (char)text[iii] << "\"");
if( m_needDisplay == true if( m_needDisplay == true
&& m_colorBg.a() != 0) { && m_colorBg.a() != 0) {
vec3 pos = m_position; Vector3f pos = m_position;
m_vectorialDraw.setPos(pos); m_vectorialDraw.setPos(pos);
printChar(_text[iii]); printChar(_text[iii]);
m_vectorialDraw.rectangleWidth(vec3(m_position.x()-pos.x(),fontHeigh,0.0f) ); m_vectorialDraw.rectangleWidth(Vector3f(m_position.x()-pos.x(),fontHeigh,0.0f) );
m_nbCharDisplayed++; m_nbCharDisplayed++;
} else { } else {
printChar(_text[iii]); printChar(_text[iii]);
@ -777,14 +777,14 @@ void ewol::compositing::TextBase::print(const etk::UString& _text, const etk::Ve
} else if(_text[stop] == u32char::Space) { } else if(_text[stop] == u32char::Space) {
currentId = stop+1; currentId = stop+1;
// reset position : // reset position :
setPos(vec3(m_startTextpos, setPos(Vector3f(m_startTextpos,
(float)(m_position.y() - getHeight()), (float)(m_position.y() - getHeight()),
m_position.z()) ); m_position.z()) );
m_nbCharDisplayed++; m_nbCharDisplayed++;
} else if(_text[stop] == u32char::Return) { } else if(_text[stop] == u32char::Return) {
currentId = stop+1; currentId = stop+1;
// reset position : // reset position :
setPos(vec3(m_startTextpos, setPos(Vector3f(m_startTextpos,
(float)(m_position.y() - getHeight()), (float)(m_position.y() - getHeight()),
m_position.z()) ); m_position.z()) );
m_nbCharDisplayed++; m_nbCharDisplayed++;
@ -792,7 +792,7 @@ void ewol::compositing::TextBase::print(const etk::UString& _text, const etk::Ve
currentId = stop; currentId = stop;
} }
} }
//EWOL_DEBUG(" 4 print in not alligned mode : start=" << m_sizeDisplayStart << " stop=" << m_sizeDisplayStop << " pos=" << m_position); //Log.debug(" 4 print in not alligned mode : start=" << m_sizeDisplayStart << " stop=" << m_sizeDisplayStop << " pos=" << m_position);
} }
} }
@ -801,7 +801,7 @@ void ewol::compositing::TextBase::print(const etk::UString& _text, const etk::Ve
void ewol::compositing::TextBase::forceLineReturn() { void ewol::compositing::TextBase::forceLineReturn() {
// reset position : // reset position :
setPos(vec3(m_startTextpos, m_position.y() - getHeight(), 0) ); setPos(Vector3f(m_startTextpos, m_position.y() - getHeight(), 0) );
} }
void ewol::compositing::TextBase::setTextAlignement(float _startTextpos, float _stopTextPos, enum ewol::compositing::aligneMode _alignement) { void ewol::compositing::TextBase::setTextAlignement(float _startTextpos, float _stopTextPos, enum ewol::compositing::aligneMode _alignement) {
@ -810,7 +810,7 @@ void ewol::compositing::TextBase::setTextAlignement(float _startTextpos, float _
m_alignement = _alignement; m_alignement = _alignement;
if (m_startTextpos >= m_stopTextPos) { if (m_startTextpos >= m_stopTextPos) {
// TODO: understand why this flush ... // TODO: understand why this flush ...
EWOL_VERBOSE("Request allignement with Borne position error : " << _startTextpos << " => " << _stopTextPos); Log.verbose("Request allignement with Borne position error : " << _startTextpos << " => " << _stopTextPos);
} }
} }
@ -822,18 +822,18 @@ void ewol::compositing::TextBase::disableAlignement() {
m_alignement = alignDisable; m_alignement = alignDisable;
} }
vec3 ewol::compositing::TextBase::calculateSizeHTML(const etk::String& _text) { Vector3f ewol::compositing::TextBase::calculateSizeHTML(const etk::String& _text) {
// remove intermediate result // remove intermediate result
reset(); reset();
//EWOL_DEBUG(" 0 size for=\n" << text); //Log.debug(" 0 size for=\n" << text);
// disable display system // disable display system
m_needDisplay = false; m_needDisplay = false;
setPos(vec3(0,0,0) ); setPos(Vector3f(0,0,0) );
// same as print without the end display ... // same as print without the end display ...
printHTML(_text); printHTML(_text);
//EWOL_DEBUG(" 1 Start pos=" << m_sizeDisplayStart); //Log.debug(" 1 Start pos=" << m_sizeDisplayStart);
//EWOL_DEBUG(" 1 Stop pos=" << m_sizeDisplayStop); //Log.debug(" 1 Stop pos=" << m_sizeDisplayStop);
// get the last elements // get the last elements
m_sizeDisplayStop.setValue(etk::max(m_position.x(), m_sizeDisplayStop.x()) , m_sizeDisplayStop.setValue(etk::max(m_position.x(), m_sizeDisplayStop.x()) ,
@ -843,28 +843,28 @@ vec3 ewol::compositing::TextBase::calculateSizeHTML(const etk::String& _text) {
etk::min(m_position.y(), m_sizeDisplayStart.y()) , etk::min(m_position.y(), m_sizeDisplayStart.y()) ,
0); 0);
//EWOL_DEBUG(" 2 Start pos=" << m_sizeDisplayStart); //Log.debug(" 2 Start pos=" << m_sizeDisplayStart);
//EWOL_DEBUG(" 2 Stop pos=" << m_sizeDisplayStop); //Log.debug(" 2 Stop pos=" << m_sizeDisplayStop);
// set back the display system // set back the display system
m_needDisplay = true; m_needDisplay = true;
return vec3( m_sizeDisplayStop.x()-m_sizeDisplayStart.x(), return Vector3f( m_sizeDisplayStop.x()-m_sizeDisplayStart.x(),
m_sizeDisplayStop.y()-m_sizeDisplayStart.y(), m_sizeDisplayStop.y()-m_sizeDisplayStart.y(),
m_sizeDisplayStop.z()-m_sizeDisplayStart.z()); m_sizeDisplayStop.z()-m_sizeDisplayStart.z());
} }
vec3 ewol::compositing::TextBase::calculateSizeHTML(const etk::UString& _text) { Vector3f ewol::compositing::TextBase::calculateSizeHTML(const etk::UString& _text) {
// remove intermediate result // remove intermediate result
reset(); reset();
//EWOL_DEBUG(" 0 size for=\n" << text); //Log.debug(" 0 size for=\n" << text);
// disable display system // disable display system
m_needDisplay = false; m_needDisplay = false;
setPos(vec3(0,0,0) ); setPos(Vector3f(0,0,0) );
// same as print without the end display ... // same as print without the end display ...
printHTML(_text); printHTML(_text);
//EWOL_DEBUG(" 1 Start pos=" << m_sizeDisplayStart); //Log.debug(" 1 Start pos=" << m_sizeDisplayStart);
//EWOL_DEBUG(" 1 Stop pos=" << m_sizeDisplayStop); //Log.debug(" 1 Stop pos=" << m_sizeDisplayStop);
// get the last elements // get the last elements
m_sizeDisplayStop.setValue(etk::max(m_position.x(), m_sizeDisplayStop.x()) , m_sizeDisplayStop.setValue(etk::max(m_position.x(), m_sizeDisplayStop.x()) ,
@ -874,42 +874,42 @@ vec3 ewol::compositing::TextBase::calculateSizeHTML(const etk::UString& _text) {
etk::min(m_position.y(), m_sizeDisplayStart.y()) , etk::min(m_position.y(), m_sizeDisplayStart.y()) ,
0); 0);
//EWOL_DEBUG(" 2 Start pos=" << m_sizeDisplayStart); //Log.debug(" 2 Start pos=" << m_sizeDisplayStart);
//EWOL_DEBUG(" 2 Stop pos=" << m_sizeDisplayStop); //Log.debug(" 2 Stop pos=" << m_sizeDisplayStop);
// set back the display system // set back the display system
m_needDisplay = true; m_needDisplay = true;
return vec3( m_sizeDisplayStop.x()-m_sizeDisplayStart.x(), return Vector3f( m_sizeDisplayStop.x()-m_sizeDisplayStart.x(),
m_sizeDisplayStop.y()-m_sizeDisplayStart.y(), m_sizeDisplayStop.y()-m_sizeDisplayStart.y(),
m_sizeDisplayStop.z()-m_sizeDisplayStart.z()); m_sizeDisplayStop.z()-m_sizeDisplayStart.z());
} }
vec3 ewol::compositing::TextBase::calculateSizeDecorated(const etk::String& _text) { Vector3f ewol::compositing::TextBase::calculateSizeDecorated(const etk::String& _text) {
if (_text.size() == 0) { if (_text.size() == 0) {
return vec3(0,0,0); return Vector3f(0,0,0);
} }
etk::String tmpData("<html><body>\n"); etk::String tmpData("<html><body>\n");
tmpData+=_text; tmpData+=_text;
tmpData+="\n</body></html>\n"; tmpData+="\n</body></html>\n";
vec3 tmpVal = calculateSizeHTML(tmpData); Vector3f tmpVal = calculateSizeHTML(tmpData);
return tmpVal; return tmpVal;
} }
vec3 ewol::compositing::TextBase::calculateSizeDecorated(const etk::UString& _text) { Vector3f ewol::compositing::TextBase::calculateSizeDecorated(const etk::UString& _text) {
if (_text.size() == 0) { if (_text.size() == 0) {
return vec3(0,0,0); return Vector3f(0,0,0);
} }
etk::UString tmpData(U"<html><body>\n"); etk::UString tmpData(U"<html><body>\n");
tmpData += _text; tmpData += _text;
tmpData += U"\n</body></html>\n"; tmpData += U"\n</body></html>\n";
vec3 tmpVal = calculateSizeHTML(tmpData); Vector3f tmpVal = calculateSizeHTML(tmpData);
return tmpVal; return tmpVal;
} }
vec3 ewol::compositing::TextBase::calculateSize(const etk::String& _text) { Vector3f ewol::compositing::TextBase::calculateSize(const etk::String& _text) {
vec3 outputSize(0, 0, 0); Vector3f outputSize(0, 0, 0);
for(auto element : _text) { for(auto element : _text) {
vec3 tmpp = calculateSize(element); Vector3f tmpp = calculateSize(element);
if (outputSize.y() == 0) { if (outputSize.y() == 0) {
outputSize.setY(tmpp.y()); outputSize.setY(tmpp.y());
} }
@ -918,10 +918,10 @@ vec3 ewol::compositing::TextBase::calculateSize(const etk::String& _text) {
return outputSize; return outputSize;
} }
vec3 ewol::compositing::TextBase::calculateSize(const etk::UString& _text) { Vector3f ewol::compositing::TextBase::calculateSize(const etk::UString& _text) {
vec3 outputSize(0, 0, 0); Vector3f outputSize(0, 0, 0);
for(auto element : _text) { for(auto element : _text) {
vec3 tmpp = calculateSize(element); Vector3f tmpp = calculateSize(element);
if (outputSize.y() == 0) { if (outputSize.y() == 0) {
outputSize.setY(tmpp.y()); outputSize.setY(tmpp.y());
} }
@ -933,10 +933,10 @@ vec3 ewol::compositing::TextBase::calculateSize(const etk::UString& _text) {
void ewol::compositing::TextBase::printCursor(bool _isInsertMode, float _cursorSize) { void ewol::compositing::TextBase::printCursor(bool _isInsertMode, float _cursorSize) {
int32_t fontHeigh = getHeight(); int32_t fontHeigh = getHeight();
if (true == _isInsertMode) { if (true == _isInsertMode) {
m_vectorialDraw.rectangleWidth(vec3(_cursorSize, fontHeigh, 0) ); m_vectorialDraw.rectangleWidth(Vector3f(_cursorSize, fontHeigh, 0) );
} else { } else {
m_vectorialDraw.setThickness(2); m_vectorialDraw.setThickness(2);
m_vectorialDraw.lineRel( vec3(0, fontHeigh, 0) ); m_vectorialDraw.lineRel( Vector3f(0, fontHeigh, 0) );
m_vectorialDraw.setThickness(0); m_vectorialDraw.setThickness(0);
} }
} }
@ -965,7 +965,7 @@ bool ewol::compositing::TextBase::extrapolateLastId(const etk::String& _text,
} }
for (size_t iii=_start; iii<_text.size(); iii++) { for (size_t iii=_start; iii<_text.size(); iii++) {
vec3 tmpSize = calculateSize(_text[iii]); Vector3f tmpSize = calculateSize(_text[iii]);
// check oveflow : // check oveflow :
if (endPos + tmpSize.x() > stopPosition) { if (endPos + tmpSize.x() > stopPosition) {
_stop = iii; _stop = iii;
@ -1028,7 +1028,7 @@ bool ewol::compositing::TextBase::extrapolateLastId(const etk::UString& _text,
} }
for (size_t iii=_start; iii<_text.size(); iii++) { for (size_t iii=_start; iii<_text.size(); iii++) {
vec3 tmpSize = calculateSize(_text[iii]); Vector3f tmpSize = calculateSize(_text[iii]);
// check oveflow : // check oveflow :
if (endPos + tmpSize.x() > stopPosition) { if (endPos + tmpSize.x() > stopPosition) {
_stop = iii; _stop = iii;

View File

@ -49,12 +49,12 @@ namespace ewol {
}; };
protected: protected:
int32_t m_nbCharDisplayed; //!< prevent some error in calculation size. int32_t m_nbCharDisplayed; //!< prevent some error in calculation size.
vec3 m_sizeDisplayStart; //!< The start windows of the display. Vector3f m_sizeDisplayStart; //!< The start windows of the display.
vec3 m_sizeDisplayStop; //!< The end windows of the display. Vector3f m_sizeDisplayStop; //!< The end windows of the display.
bool m_needDisplay; //!< This just need the display and not the size rendering. bool m_needDisplay; //!< This just need the display and not the size rendering.
vec3 m_position; //!< The current position to draw Vector3f m_position; //!< The current position to draw
vec3 m_clippingPosStart; //!< Clipping start position Vector3f m_clippingPosStart; //!< Clipping start position
vec3 m_clippingPosStop; //!< Clipping stop position Vector3f m_clippingPosStop; //!< Clipping stop position
bool m_clippingEnable; //!< true if the clipping must be activated bool m_clippingEnable; //!< true if the clipping must be activated
protected: protected:
etk::Color<float,4> m_defaultColorFg; //!< The text foreground color etk::Color<float,4> m_defaultColorFg; //!< The text foreground color
@ -105,9 +105,9 @@ namespace ewol {
*/ */
virtual ~TextBase(); virtual ~TextBase();
public: // Derived function public: // Derived function
void translate(const vec3& _vect); void translate(const Vector3f& _vect);
void rotate(const vec3& _vect, float _angle); void rotate(const Vector3f& _vect, float _angle);
void scale(const vec3& _vect); void scale(const Vector3f& _vect);
public: public:
/** /**
* @brief draw All the refistered text in the current element on openGL * @brief draw All the refistered text in the current element on openGL
@ -137,26 +137,26 @@ namespace ewol {
* @brief get the current display position (sometime needed in the gui control) * @brief get the current display position (sometime needed in the gui control)
* @return the current position. * @return the current position.
*/ */
const vec3& getPos() { const Vector3f& getPos() {
return m_position; return m_position;
}; };
/** /**
* @brief set position for the next text writen * @brief set position for the next text writen
* @param[in] _pos Position of the text (in 3D) * @param[in] _pos Position of the text (in 3D)
*/ */
void setPos(const vec3& _pos); void setPos(const Vector3f& _pos);
//! @previous //! @previous
inline void setPos(const vec2& _pos) { inline void setPos(const Vector2f& _pos) {
setPos(vec3(_pos.x(),_pos.y(),0)); setPos(Vector3f(_pos.x(),_pos.y(),0));
}; };
/** /**
* @brief set relative position for the next text writen * @brief set relative position for the next text writen
* @param[in] _pos ofset apply of the text (in 3D) * @param[in] _pos ofset apply of the text (in 3D)
*/ */
void setRelPos(const vec3& _pos); void setRelPos(const Vector3f& _pos);
//! @previous //! @previous
inline void setRelPos(const vec2& _pos) { inline void setRelPos(const Vector2f& _pos) {
setRelPos(vec3(_pos.x(),_pos.y(),0)); setRelPos(Vector3f(_pos.x(),_pos.y(),0));
}; };
/** /**
* @brief set the default background color of the font (when reset, set this value ...) * @brief set the default background color of the font (when reset, set this value ...)
@ -189,11 +189,11 @@ namespace ewol {
* @param[in] _pos Start position of the clipping * @param[in] _pos Start position of the clipping
* @param[in] _width Width size of the clipping * @param[in] _width Width size of the clipping
*/ */
void setClippingWidth(const vec3& _pos, const vec3& _width) { void setClippingWidth(const Vector3f& _pos, const Vector3f& _width) {
setClipping(_pos, _pos+_width); setClipping(_pos, _pos+_width);
} }
//! @previous //! @previous
void setClippingWidth(const vec2& _pos, const vec2& _width) { void setClippingWidth(const Vector2f& _pos, const Vector2f& _width) {
setClipping(_pos, _pos+_width); setClipping(_pos, _pos+_width);
}; };
/** /**
@ -201,10 +201,10 @@ namespace ewol {
* @param[in] _pos Start position of the clipping * @param[in] _pos Start position of the clipping
* @param[in] _posEnd End position of the clipping * @param[in] _posEnd End position of the clipping
*/ */
void setClipping(const vec3& _pos, const vec3& _posEnd); void setClipping(const Vector3f& _pos, const Vector3f& _posEnd);
//! @previous //! @previous
void setClipping(const vec2& _pos, const vec2& _posEnd) { void setClipping(const Vector2f& _pos, const Vector2f& _posEnd) {
setClipping(vec3(_pos.x(),_pos.y(),-1), vec3(_posEnd.x(),_posEnd.y(),1) ); setClipping(Vector3f(_pos.x(),_pos.y(),-1), Vector3f(_posEnd.x(),_posEnd.y(),1) );
}; };
/** /**
* @brief enable/Disable the clipping (without lose the current clipping position) * @brief enable/Disable the clipping (without lose the current clipping position)
@ -338,9 +338,9 @@ namespace ewol {
* @param[in] _text The string to display. * @param[in] _text The string to display.
* @param[in] _decoration The text decoration for the text that might be display (if the vector is smaller, the last parameter is get) * @param[in] _decoration The text decoration for the text that might be display (if the vector is smaller, the last parameter is get)
*/ */
void print(const etk::String& _text, const etk::Vector<TextDecoration>& _decoration); void print(const etk::String& _text, const List<TextDecoration>& _decoration);
//! @previous //! @previous
void print(const etk::UString& _text, const etk::Vector<TextDecoration>& _decoration); void print(const etk::UString& _text, const List<TextDecoration>& _decoration);
/** /**
* @brief display the current char in the current element (note that the kerning is availlable if the position is not changed) * @brief display the current char in the current element (note that the kerning is availlable if the position is not changed)
* @param[in] _charcode Char that might be dispalyed * @param[in] _charcode Char that might be dispalyed
@ -379,36 +379,36 @@ namespace ewol {
* @param[in] _text The string to calculate dimention. * @param[in] _text The string to calculate dimention.
* @return The theoric size used. * @return The theoric size used.
*/ */
vec3 calculateSizeHTML(const etk::String& _text); Vector3f calculateSizeHTML(const etk::String& _text);
//! @previous //! @previous
vec3 calculateSizeHTML(const etk::UString& _text); Vector3f calculateSizeHTML(const etk::UString& _text);
/** /**
* @brief calculate a theoric text size * @brief calculate a theoric text size
* @param[in] _text The string to calculate dimention. * @param[in] _text The string to calculate dimention.
* @return The theoric size used. * @return The theoric size used.
*/ */
vec3 calculateSizeDecorated(const etk::String& _text); Vector3f calculateSizeDecorated(const etk::String& _text);
//! @previous //! @previous
vec3 calculateSizeDecorated(const etk::UString& _text); Vector3f calculateSizeDecorated(const etk::UString& _text);
/** /**
* @brief calculate a theoric text size * @brief calculate a theoric text size
* @param[in] _text The string to calculate dimention. * @param[in] _text The string to calculate dimention.
* @return The theoric size used. * @return The theoric size used.
*/ */
vec3 calculateSize(const etk::String& _text); Vector3f calculateSize(const etk::String& _text);
//! @previous //! @previous
vec3 calculateSize(const etk::UString& _text); Vector3f calculateSize(const etk::UString& _text);
/** /**
* @brief calculate a theoric charcode size * @brief calculate a theoric charcode size
* @param[in] _charcode The Unicode value to calculate dimention. * @param[in] _charcode The Unicode value to calculate dimention.
* @return The theoric size used. * @return The theoric size used.
*/ */
inline vec3 calculateSize(const char32_t& _charcode) { inline Vector3f calculateSize(const char32_t& _charcode) {
return calculateSizeChar(_charcode); return calculateSizeChar(_charcode);
}; };
protected: protected:
//! @previous //! @previous
virtual vec3 calculateSizeChar(const char32_t& _charcode) = 0; virtual Vector3f calculateSizeChar(const char32_t& _charcode) = 0;
public: public:
/** /**
* @brief draw a cursor at the specify position * @brief draw a cursor at the specify position
@ -434,7 +434,7 @@ namespace ewol {
protected: protected:
// this section is reserved for HTML parsing and display: // this section is reserved for HTML parsing and display:
etk::UString m_htmlCurrrentLine; //!< current line for HTML display etk::UString m_htmlCurrrentLine; //!< current line for HTML display
etk::Vector<TextDecoration> m_htmlDecoration; //!< current decoration for the HTML display List<TextDecoration> m_htmlDecoration; //!< current decoration for the HTML display
TextDecoration m_htmlDecoTmp; //!< current decoration TextDecoration m_htmlDecoTmp; //!< current decoration
/** /**
* @brief add a line with the current m_htmlDecoTmp decoration * @brief add a line with the current m_htmlDecoTmp decoration

View File

@ -24,7 +24,7 @@ ewol::compositing::TextDF::~TextDF() {
} }
void ewol::compositing::TextDF::updateSizeToRender(const vec2& _size) { void ewol::compositing::TextDF::updateSizeToRender(const Vector2f& _size) {
float minSize = etk::min(_size.x(), _size.y()); float minSize = etk::min(_size.x(), _size.y());
if (m_fontDF != null) { if (m_fontDF != null) {
setFontSize(m_fontDF->getSize(minSize)); setFontSize(m_fontDF->getSize(minSize));
@ -44,7 +44,7 @@ void ewol::compositing::TextDF::drawMT(const mat4& _transformationMatrix, bool _
return; return;
} }
if (m_GLprogram == null) { if (m_GLprogram == null) {
EWOL_ERROR("No shader ..."); Log.error("No shader ...");
return; return;
} }
if (_enableDepthTest == true) { if (_enableDepthTest == true) {
@ -88,7 +88,7 @@ void ewol::compositing::TextDF::drawD(bool _disableDepthTest) {
return; return;
} }
if (m_GLprogram == null) { if (m_GLprogram == null) {
EWOL_ERROR("No shader ..."); Log.error("No shader ...");
return; return;
} }
// set Matrix: translation/positionMatrix // set Matrix: translation/positionMatrix
@ -134,7 +134,7 @@ ewol::GlyphProperty * ewol::compositing::TextDF::getGlyphPointer(char32_t _charc
void ewol::compositing::TextDF::setFontSize(int32_t _fontSize) { void ewol::compositing::TextDF::setFontSize(int32_t _fontSize) {
clear(); clear();
EWOL_VERBOSE("Set font Size: " << _fontSize); Log.verbose("Set font Size: " << _fontSize);
if (_fontSize <= 1) { if (_fontSize <= 1) {
m_size = ewol::getContext().getFontDefault().getSize(); m_size = ewol::getContext().getFontDefault().getSize();
} else { } else {
@ -152,11 +152,11 @@ void ewol::compositing::TextDF::setFontName(const etk::String& _fontName) {
} else { } else {
fontName = _fontName; fontName = _fontName;
} }
EWOL_VERBOSE("Set font name: '" << fontName << "'"); Log.verbose("Set font name: '" << fontName << "'");
// link to new one // link to new one
m_fontDF = ewol::resource::DistanceFieldFont::create(fontName); m_fontDF = ewol::resource::DistanceFieldFont::create(fontName);
if (m_fontDF == null) { if (m_fontDF == null) {
EWOL_ERROR("Can not get find resource"); Log.error("Can not get find resource");
m_fontDF = previousFont; m_fontDF = previousFont;
} }
} }
@ -178,7 +178,7 @@ void ewol::compositing::TextDF::printChar(const char32_t& _charcode) {
// get a pointer on the glyph property : // get a pointer on the glyph property :
ewol::GlyphProperty* myGlyph = getGlyphPointer(_charcode); ewol::GlyphProperty* myGlyph = getGlyphPointer(_charcode);
if (null == myGlyph) { if (null == myGlyph) {
EWOL_ERROR(" font does not really existed ..."); Log.error(" font does not really existed ...");
return; return;
} }
float fontSize = getSize(); float fontSize = getSize();
@ -191,7 +191,7 @@ void ewol::compositing::TextDF::printChar(const char32_t& _charcode) {
if (true == m_kerning) { if (true == m_kerning) {
kerningOffset = myGlyph->kerningGet(m_previousCharcode); kerningOffset = myGlyph->kerningGet(m_previousCharcode);
if (kerningOffset != 0) { if (kerningOffset != 0) {
//EWOL_DEBUG("Kerning between : '" << m_previousCharcode << "'&'" << myGlyph->m_UVal << "' value : " << kerningOffset); //Log.debug("Kerning between : '" << m_previousCharcode << "'&'" << myGlyph->m_UVal << "' value : " << kerningOffset);
} }
} }
// 0x01 == 0x20 == ' '; // 0x01 == 0x20 == ' ';
@ -223,7 +223,7 @@ void ewol::compositing::TextDF::printChar(const char32_t& _charcode) {
float dyC = m_position.y() + (myGlyph->m_bearing.y() + fontHeigh - fontSize) * factorDisplay; float dyC = m_position.y() + (myGlyph->m_bearing.y() + fontHeigh - fontSize) * factorDisplay;
float dyD = dyC - myGlyph->m_sizeTexture.y() * factorDisplay; float dyD = dyC - myGlyph->m_sizeTexture.y() * factorDisplay;
#else #else
//EWOL_DEBUG(" plop : fontHeigh" << fontHeigh << " fontSize=" << fontSize); //Log.debug(" plop : fontHeigh" << fontHeigh << " fontSize=" << fontSize);
float dxA = m_position.x() + ((float)myGlyph->m_bearing.x() + kerningOffset - (float)m_fontDF->getPixelBorderSize()*0.5f) * factorDisplay; float dxA = m_position.x() + ((float)myGlyph->m_bearing.x() + kerningOffset - (float)m_fontDF->getPixelBorderSize()*0.5f) * factorDisplay;
float dxB = dxA + ((float)myGlyph->m_sizeTexture.x() + (float)m_fontDF->getPixelBorderSize()) * factorDisplay; float dxB = dxA + ((float)myGlyph->m_sizeTexture.x() + (float)m_fontDF->getPixelBorderSize()) * factorDisplay;
float dyC = m_position.y() + (fontHeigh - fontSize + ((float)myGlyph->m_bearing.y() + (float)m_fontDF->getPixelBorderSize()*0.5f) * factorDisplay); float dyC = m_position.y() + (fontHeigh - fontSize + ((float)myGlyph->m_bearing.y() + (float)m_fontDF->getPixelBorderSize()*0.5f) * factorDisplay);
@ -235,13 +235,13 @@ void ewol::compositing::TextDF::printChar(const char32_t& _charcode) {
float tvC = myGlyph->m_texturePosStart.y(); float tvC = myGlyph->m_texturePosStart.y();
float tvD = tvC + myGlyph->m_texturePosSize.y(); float tvD = tvC + myGlyph->m_texturePosSize.y();
/* /*
vec3 drawingPos = m_vectorialDraw.getPos(); Vector3f drawingPos = m_vectorialDraw.getPos();
etk::Color<> backColor = m_vectorialDraw.getColor(); etk::Color<> backColor = m_vectorialDraw.getColor();
m_vectorialDraw.setPos(vec2(dxA, dyC)); m_vectorialDraw.setPos(Vector2f(dxA, dyC));
m_vectorialDraw.setColor(etk::Color<>(0.0,1.0,0.0,1.0)); m_vectorialDraw.setColor(etk::Color<>(0.0,1.0,0.0,1.0));
m_vectorialDraw.rectangle(vec2(dxB, dyD)); m_vectorialDraw.rectangle(Vector2f(dxB, dyD));
m_vectorialDraw.setPos(drawingPos); m_vectorialDraw.setPos(drawingPos);
m_vectorialDraw.setColor(backColor); m_vectorialDraw.setColor(backColor);
@ -306,7 +306,7 @@ void ewol::compositing::TextDF::printChar(const char32_t& _charcode) {
* 3------2 * 3------2
*/ */
if (m_needDisplay == true) { if (m_needDisplay == true) {
vec3 bitmapDrawPos[4]; Vector3f bitmapDrawPos[4];
bitmapDrawPos[0].setValue(dxA+italicMove, dyC, 0); bitmapDrawPos[0].setValue(dxA+italicMove, dyC, 0);
bitmapDrawPos[1].setValue(dxB+italicMove, dyC, 0); bitmapDrawPos[1].setValue(dxB+italicMove, dyC, 0);
bitmapDrawPos[2].setValue(dxB, dyD, 0); bitmapDrawPos[2].setValue(dxB, dyD, 0);
@ -317,7 +317,7 @@ void ewol::compositing::TextDF::printChar(const char32_t& _charcode) {
* | | * | |
* 3------2 * 3------2
*/ */
vec2 texturePos[4]; Vector2f texturePos[4];
texturePos[0].setValue(tuA+m_mode, tvC); texturePos[0].setValue(tuA+m_mode, tvC);
texturePos[1].setValue(tuB+m_mode, tvC); texturePos[1].setValue(tuB+m_mode, tvC);
texturePos[2].setValue(tuB+m_mode, tvD); texturePos[2].setValue(tuB+m_mode, tvD);
@ -375,9 +375,9 @@ void ewol::compositing::TextDF::printChar(const char32_t& _charcode) {
} }
} }
// move the position : // move the position :
//EWOL_DEBUG(" 5 pos=" << m_position << " advance=" << myGlyph->m_advance.x() << " kerningOffset=" << kerningOffset); //Log.debug(" 5 pos=" << m_position << " advance=" << myGlyph->m_advance.x() << " kerningOffset=" << kerningOffset);
m_position.setX(m_position.x() + (myGlyph->m_advance.x() + kerningOffset) * factorDisplay); m_position.setX(m_position.x() + (myGlyph->m_advance.x() + kerningOffset) * factorDisplay);
//EWOL_DEBUG(" 6 print '" << charcode << "' : start=" << m_sizeDisplayStart << " stop=" << m_sizeDisplayStop << " pos=" << m_position); //Log.debug(" 6 print '" << charcode << "' : start=" << m_sizeDisplayStart << " stop=" << m_sizeDisplayStop << " pos=" << m_position);
// Register the previous character // Register the previous character
m_previousCharcode = _charcode; m_previousCharcode = _charcode;
m_VBO->flush(); m_VBO->flush();
@ -385,7 +385,7 @@ void ewol::compositing::TextDF::printChar(const char32_t& _charcode) {
} }
vec3 ewol::compositing::TextDF::calculateSizeChar(const char32_t& _charcode) { Vector3f ewol::compositing::TextDF::calculateSizeChar(const char32_t& _charcode) {
// get a pointer on the glyph property : // get a pointer on the glyph property :
ewol::GlyphProperty * myGlyph = getGlyphPointer(_charcode); ewol::GlyphProperty * myGlyph = getGlyphPointer(_charcode);
int32_t fontHeigh = getHeight(); int32_t fontHeigh = getHeight();
@ -396,7 +396,7 @@ vec3 ewol::compositing::TextDF::calculateSizeChar(const char32_t& _charcode) {
kerningOffset = myGlyph->kerningGet(m_previousCharcode); kerningOffset = myGlyph->kerningGet(m_previousCharcode);
} }
vec3 outputSize((float)(myGlyph->m_advance.x() + kerningOffset)*m_fontDF->getDisplayRatio(getSize()), Vector3f outputSize((float)(myGlyph->m_advance.x() + kerningOffset)*m_fontDF->getDisplayRatio(getSize()),
(float)(fontHeigh), (float)(fontHeigh),
(float)(0.0)); (float)(0.0));
// Register the previous character // Register the previous character

View File

@ -39,7 +39,7 @@ namespace ewol {
* @note special for Distance field mode. * @note special for Distance field mode.
* @param[in] _size request dimention. * @param[in] _size request dimention.
*/ */
void updateSizeToRender(const vec2& _size); void updateSizeToRender(const Vector2f& _size);
public: public:
virtual void drawD(bool _disableDepthTest); virtual void drawD(bool _disableDepthTest);
virtual void drawMT(const mat4& _transformationMatrix, bool _enableDepthTest); virtual void drawMT(const mat4& _transformationMatrix, bool _enableDepthTest);
@ -62,7 +62,7 @@ namespace ewol {
virtual void setFont(etk::String _fontName, int32_t _fontSize); virtual void setFont(etk::String _fontName, int32_t _fontSize);
virtual void setFontMode(enum ewol::font::mode _mode); virtual void setFontMode(enum ewol::font::mode _mode);
virtual void printChar(const char32_t& _charcode); virtual void printChar(const char32_t& _charcode);
virtual vec3 calculateSizeChar(const char32_t& _charcode); virtual Vector3f calculateSizeChar(const char32_t& _charcode);
}; };
} }
} }

View File

@ -28,16 +28,16 @@ ewol::context::ConfigFont::~ConfigFont() {
void ewol::context::ConfigFont::set(const etk::String& _fontName, int32_t _size) { void ewol::context::ConfigFont::set(const etk::String& _fontName, int32_t _size) {
m_name = _fontName; m_name = _fontName;
m_size = _size; m_size = _size;
EWOL_DEBUG("Set default Font : '" << m_name << "' size=" << m_size); Log.debug("Set default Font : '" << m_name << "' size=" << m_size);
} }
void ewol::context::ConfigFont::setSize(int32_t _size) { void ewol::context::ConfigFont::setSize(int32_t _size) {
m_size = _size; m_size = _size;
EWOL_DEBUG("Set default Font : '" << m_name << "' size=" << m_size << " (change size only)"); Log.debug("Set default Font : '" << m_name << "' size=" << m_size << " (change size only)");
} }
void ewol::context::ConfigFont::setName(const etk::String& _fontName) { void ewol::context::ConfigFont::setName(const etk::String& _fontName) {
m_name = _fontName; m_name = _fontName;
EWOL_DEBUG("Set default Font : '" << m_name << "' size=" << m_size << " (change name only)"); Log.debug("Set default Font : '" << m_name << "' size=" << m_size << " (change name only)");
} }

View File

@ -37,7 +37,7 @@ ewol::Context& ewol::getContext() {
gale::Context& context = gale::getContext(); gale::Context& context = gale::getContext();
ememory::SharedPtr<gale::Application> appl = context.getApplication(); ememory::SharedPtr<gale::Application> appl = context.getApplication();
if (appl == null) { if (appl == null) {
EWOL_CRITICAL("[CRITICAL] try acces at an empty GALE application (can not get Context)"); Log.critical("[CRITICAL] try acces at an empty GALE application (can not get Context)");
// ??? // ???
} }
return *(ememory::staticPointerCast<ewol::Context>(appl)); return *(ememory::staticPointerCast<ewol::Context>(appl));
@ -66,7 +66,7 @@ void ewol::Context::inputEventUnGrabPointer() {
void ewol::Context::onCreate(gale::Context& _context) { void ewol::Context::onCreate(gale::Context& _context) {
EWOL_INFO(" == > Ewol system create (BEGIN)"); Log.info(" == > Ewol system create (BEGIN)");
// Add basic ewol translation: // Add basic ewol translation:
etranslate::addPath("ewol", "DATA:///translate/ewol/?lib=ewol"); etranslate::addPath("ewol", "DATA:///translate/ewol/?lib=ewol");
etranslate::autoDetectLanguage(); etranslate::autoDetectLanguage();
@ -77,11 +77,11 @@ void ewol::Context::onCreate(gale::Context& _context) {
for(int32_t iii = 0; iii < _context.getCmd().size() ; ++iii) { for(int32_t iii = 0; iii < _context.getCmd().size() ; ++iii) {
if ( _context.getCmd().get(iii) == "-h" if ( _context.getCmd().get(iii) == "-h"
|| _context.getCmd().get(iii) == "--help") { || _context.getCmd().get(iii) == "--help") {
EWOL_PRINT("ewol - help : "); Log.print("ewol - help : ");
EWOL_PRINT(" " << etk::getApplicationName() << " [options]"); Log.print(" " << etk::getApplicationName() << " [options]");
EWOL_PRINT(" -h/--help: Display this help"); Log.print(" -h/--help: Display this help");
EWOL_PRINT(" example:"); Log.print(" example:");
EWOL_PRINT(" " << etk::getApplicationName() << " --help"); Log.print(" " << etk::getApplicationName() << " --help");
// this is a global help system does not remove it // this is a global help system does not remove it
continue; continue;
} else { } else {
@ -91,7 +91,7 @@ void ewol::Context::onCreate(gale::Context& _context) {
--iii; --iii;
} }
EWOL_INFO("EWOL v:" << ewol::getVersion()); Log.info("EWOL v:" << ewol::getVersion());
// force a recalculation // force a recalculation
/* /*
requestUpdateSize(); requestUpdateSize();
@ -105,40 +105,40 @@ void ewol::Context::onCreate(gale::Context& _context) {
*/ */
ememory::SharedPtr<ewol::context::Application> appl = m_application; ememory::SharedPtr<ewol::context::Application> appl = m_application;
if (appl == null) { if (appl == null) {
EWOL_ERROR(" == > Create without application"); Log.error(" == > Create without application");
return; return;
} }
appl->onCreate(*this); appl->onCreate(*this);
EWOL_INFO(" == > Ewol system create (END)"); Log.info(" == > Ewol system create (END)");
} }
void ewol::Context::onStart(gale::Context& _context) { void ewol::Context::onStart(gale::Context& _context) {
EWOL_INFO(" == > Ewol system start (BEGIN)"); Log.info(" == > Ewol system start (BEGIN)");
ememory::SharedPtr<ewol::context::Application> appl = m_application; ememory::SharedPtr<ewol::context::Application> appl = m_application;
if (appl == null) { if (appl == null) {
// TODO : Request exit of the application .... with error ... // TODO : Request exit of the application .... with error ...
return; return;
} }
appl->onStart(*this); appl->onStart(*this);
EWOL_INFO(" == > Ewol system start (END)"); Log.info(" == > Ewol system start (END)");
} }
void ewol::Context::onResume(gale::Context& _context) { void ewol::Context::onResume(gale::Context& _context) {
EWOL_INFO(" == > Ewol system resume (BEGIN)"); Log.info(" == > Ewol system resume (BEGIN)");
ememory::SharedPtr<ewol::context::Application> appl = m_application; ememory::SharedPtr<ewol::context::Application> appl = m_application;
if (appl == null) { if (appl == null) {
return; return;
} }
appl->onResume(*this); appl->onResume(*this);
EWOL_INFO(" == > Ewol system resume (END)"); Log.info(" == > Ewol system resume (END)");
} }
void ewol::Context::onRegenerateDisplay(gale::Context& _context) { void ewol::Context::onRegenerateDisplay(gale::Context& _context) {
//EWOL_INFO("REGENERATE_DISPLAY"); //Log.info("REGENERATE_DISPLAY");
// check if the user selected a windows // check if the user selected a windows
ewol::widget::WindowsShared window = m_windowsCurrent; ewol::widget::WindowsShared window = m_windowsCurrent;
if (window == null) { if (window == null) {
EWOL_DEBUG("No windows ..."); Log.debug("No windows ...");
return; return;
} }
// Redraw all needed elements // Redraw all needed elements
@ -150,7 +150,7 @@ void ewol::Context::onRegenerateDisplay(gale::Context& _context) {
} }
void ewol::Context::onDraw(gale::Context& _context) { void ewol::Context::onDraw(gale::Context& _context) {
//EWOL_INFO("DRAW"); //Log.info("DRAW");
// clean internal data... // clean internal data...
m_objectManager.cleanInternalRemoved(); m_objectManager.cleanInternalRemoved();
// real draw... // real draw...
@ -162,27 +162,27 @@ void ewol::Context::onDraw(gale::Context& _context) {
} }
void ewol::Context::onPause(gale::Context& _context) { void ewol::Context::onPause(gale::Context& _context) {
EWOL_INFO(" == > Ewol system pause (BEGIN)"); Log.info(" == > Ewol system pause (BEGIN)");
ememory::SharedPtr<ewol::context::Application> appl = m_application; ememory::SharedPtr<ewol::context::Application> appl = m_application;
if (appl == null) { if (appl == null) {
return; return;
} }
appl->onPause(*this); appl->onPause(*this);
EWOL_INFO(" == > Ewol system pause (END)"); Log.info(" == > Ewol system pause (END)");
} }
void ewol::Context::onStop(gale::Context& _context) { void ewol::Context::onStop(gale::Context& _context) {
EWOL_INFO(" == > Ewol system stop (BEGIN)"); Log.info(" == > Ewol system stop (BEGIN)");
ememory::SharedPtr<ewol::context::Application> appl = m_application; ememory::SharedPtr<ewol::context::Application> appl = m_application;
if (appl == null) { if (appl == null) {
return; return;
} }
appl->onStop(*this); appl->onStop(*this);
EWOL_INFO(" == > Ewol system stop (END)"); Log.info(" == > Ewol system stop (END)");
} }
void ewol::Context::onDestroy(gale::Context& _context) { void ewol::Context::onDestroy(gale::Context& _context) {
EWOL_INFO(" == > Ewol system destroy (BEGIN)"); Log.info(" == > Ewol system destroy (BEGIN)");
// Remove current windows // Remove current windows
m_windowsCurrent.reset(); m_windowsCurrent.reset();
// clean all widget and sub widget with their resources: // clean all widget and sub widget with their resources:
@ -195,44 +195,44 @@ void ewol::Context::onDestroy(gale::Context& _context) {
} }
// 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"); Log.info("List of all widget of this context must be equal at 0 ==> otherwise some remove is missing");
m_objectManager.displayListObject(); m_objectManager.displayListObject();
// now All must be removed !!! // now All must be removed !!!
m_objectManager.unInit(); m_objectManager.unInit();
EWOL_INFO(" == > Ewol system destroy (END)"); Log.info(" == > Ewol system destroy (END)");
} }
void ewol::Context::onKillDemand(gale::Context& _context) { void ewol::Context::onKillDemand(gale::Context& _context) {
EWOL_INFO(" == > User demand a destroy (BEGIN)"); Log.info(" == > User demand a destroy (BEGIN)");
ememory::SharedPtr<ewol::context::Application> appl = m_application; ememory::SharedPtr<ewol::context::Application> appl = m_application;
if (appl == null) { if (appl == null) {
exit(0); exit(0);
return; return;
} }
appl->onKillDemand(*this); appl->onKillDemand(*this);
EWOL_INFO(" == > User demand a destroy (END)"); Log.info(" == > User demand a destroy (END)");
} }
void ewol::Context::onPointer(enum gale::key::type _type, void ewol::Context::onPointer(enum gale::key::type _type,
int32_t _pointerID, int32_t _pointerID,
const vec2& _pos, const Vector2f& _pos,
gale::key::status _state) { gale::key::status _state) {
switch (_state) { switch (_state) {
case gale::key::status::move: case gale::key::status::move:
//EWOL_DEBUG("Receive MSG : THREAD_INPUT_MOTION"); //Log.debug("Receive MSG : THREAD_INPUT_MOTION");
m_input.motion(_type, _pointerID, _pos); m_input.motion(_type, _pointerID, _pos);
break; break;
case gale::key::status::down: case gale::key::status::down:
case gale::key::status::downRepeate: case gale::key::status::downRepeate:
//EWOL_DEBUG("Receive MSG : THREAD_INPUT_STATE"); //Log.debug("Receive MSG : THREAD_INPUT_STATE");
m_input.state(_type, _pointerID, true, _pos); m_input.state(_type, _pointerID, true, _pos);
break; break;
case gale::key::status::up: case gale::key::status::up:
//EWOL_DEBUG("Receive MSG : THREAD_INPUT_STATE"); //Log.debug("Receive MSG : THREAD_INPUT_STATE");
m_input.state(_type, _pointerID, false, _pos); m_input.state(_type, _pointerID, false, _pos);
break; break;
default: default:
EWOL_DEBUG("Unknow state : " << _state); Log.debug("Unknow state : " << _state);
break; break;
} }
} }
@ -240,7 +240,7 @@ void ewol::Context::onKeyboard(const gale::key::Special& _special,
enum gale::key::keyboard _type, enum gale::key::keyboard _type,
char32_t _value, char32_t _value,
gale::key::status _state) { gale::key::status _state) {
EWOL_VERBOSE("event {" << _special << "} " << _type << " " << _value << " " << _state); Log.verbose("event {" << _special << "} " << _type << " " << _value << " " << _state);
// store the keyboard special key status for mouse event... // store the keyboard special key status for mouse event...
m_input.setLastKeyboardSpecial(_special); m_input.setLastKeyboardSpecial(_special);
if (m_windowsCurrent == null) { if (m_windowsCurrent == null) {
@ -264,7 +264,7 @@ void ewol::Context::onKeyboard(const gale::key::Special& _special,
return; return;
} }
// check if the widget allow repeating key events. // check if the widget allow repeating key events.
//EWOL_INFO("repeating test :" << repeate << " widget=" << tmpWidget->getKeyboardRepeate() << " state=" << isDown); //Log.info("repeating test :" << repeate << " widget=" << tmpWidget->getKeyboardRepeate() << " state=" << isDown);
if( repeate == false if( repeate == false
|| ( repeate == true || ( repeate == true
&& tmpWidget->getKeyboardRepeat() == true) ) { && tmpWidget->getKeyboardRepeat() == true) ) {
@ -294,7 +294,7 @@ void ewol::Context::onKeyboard(const gale::key::Special& _special,
tmpWidget->systemEventEntry(tmpEntryEvent); tmpWidget->systemEventEntry(tmpEntryEvent);
} }
} else { } else {
EWOL_DEBUG("remove Repeate key ..."); Log.debug("remove Repeate key ...");
} }
} }
} }
@ -302,7 +302,7 @@ void ewol::Context::onKeyboard(const gale::key::Special& _special,
/* /*
void ewol::Context::processEvents() { void ewol::Context::processEvents() {
case eSystemMessage::msgResize: case eSystemMessage::msgResize:
//EWOL_DEBUG("Receive MSG : THREAD_RESIZE"); //Log.debug("Receive MSG : THREAD_RESIZE");
m_windowsSize = data->dimention; m_windowsSize = data->dimention;
ewol::Dimension::setPixelWindowsSize(m_windowsSize); ewol::Dimension::setPixelWindowsSize(m_windowsSize);
forceRedrawAll(); forceRedrawAll();
@ -325,7 +325,7 @@ ewol::Context::Context(ewol::context::Application* _application) :
m_windowsCurrent(null), m_windowsCurrent(null),
m_initStepId(0) { m_initStepId(0) {
if (m_application == null) { if (m_application == null) {
EWOL_CRITICAL("Can not start context with no Application ==> rtfm ..."); Log.critical("Can not start context with no Application ==> rtfm ...");
} }
} }
@ -347,7 +347,7 @@ void ewol::Context::resetIOEvent() {
} }
void ewol::Context::setWindows(const ewol::widget::WindowsShared& _windows) { void ewol::Context::setWindows(const ewol::widget::WindowsShared& _windows) {
EWOL_INFO("set New windows"); Log.info("set New windows");
// remove current focus : // remove current focus :
m_widgetManager.focusSetDefault(null); m_widgetManager.focusSetDefault(null);
m_widgetManager.focusRelease(); m_widgetManager.focusRelease();
@ -366,8 +366,8 @@ void ewol::Context::setWindows(const ewol::widget::WindowsShared& _windows) {
ewol::widget::WindowsShared ewol::Context::getWindows() { ewol::widget::WindowsShared ewol::Context::getWindows() {
return m_windowsCurrent; return m_windowsCurrent;
}; };
void ewol::Context::onResize(const ivec2& _size) { void ewol::Context::onResize(const Vector2i& _size) {
EWOL_VERBOSE("Resize: " << _size); Log.verbose("Resize: " << _size);
forceRedrawAll(); forceRedrawAll();
} }
@ -375,8 +375,8 @@ void ewol::Context::forceRedrawAll() {
if (m_windowsCurrent == null) { if (m_windowsCurrent == null) {
return; return;
} }
ivec2 size = getSize(); Vector2i size = getSize();
m_windowsCurrent->setSize(vec2(size.x(), size.y())); m_windowsCurrent->setSize(Vector2f(size.x(), size.y()));
m_windowsCurrent->onChangeSize(); m_windowsCurrent->onChangeSize();
} }

View File

@ -73,7 +73,7 @@ namespace ewol {
void onKillDemand(gale::Context& _context) override; void onKillDemand(gale::Context& _context) override;
void onPointer(enum gale::key::type _type, void onPointer(enum gale::key::type _type,
int32_t _pointerID, int32_t _pointerID,
const vec2& _pos, const Vector2f& _pos,
gale::key::status _state) override; gale::key::status _state) override;
void onKeyboard(const gale::key::Special& _special, void onKeyboard(const gale::key::Special& _special,
enum gale::key::keyboard _type, enum gale::key::keyboard _type,
@ -119,7 +119,7 @@ namespace ewol {
* @brief This fonction un-lock the pointer properties to move in relative instead of absolute * @brief This fonction un-lock the pointer properties to move in relative instead of absolute
*/ */
void inputEventUnGrabPointer(); void inputEventUnGrabPointer();
void onResize(const ivec2& _size) override; void onResize(const Vector2i& _size) override;
public: public:
/** /**
* @brief This is the only one things the User might done in his main(); * @brief This is the only one things the User might done in his main();

View File

@ -39,7 +39,7 @@ bool ewol::context::InputManager::localEventInput(enum gale::key::type _type,
ewol::WidgetShared _destWidget, ewol::WidgetShared _destWidget,
int32_t _IdInput, int32_t _IdInput,
enum gale::key::status _status, enum gale::key::status _status,
vec2 _pos) { Vector2f _pos) {
if (_destWidget != null) { if (_destWidget != null) {
if ( _type == gale::key::type::mouse if ( _type == gale::key::type::mouse
|| _type == gale::key::type::finger) { || _type == gale::key::type::finger) {
@ -74,7 +74,7 @@ void ewol::context::InputManager::cleanElement(InputPoperty *_eventTable,
if (_eventTable == null) { if (_eventTable == null) {
return; return;
} }
//EWOL_INFO("CleanElement[" << idInput << "] = @" << (int64_t)eventTable); //Log.info("CleanElement[" << idInput << "] = @" << (int64_t)eventTable);
_eventTable[_idInput].isUsed = false; _eventTable[_idInput].isUsed = false;
_eventTable[_idInput].destinationInputId = 0; _eventTable[_idInput].destinationInputId = 0;
_eventTable[_idInput].lastTimeEvent.reset(); _eventTable[_idInput].lastTimeEvent.reset();
@ -127,14 +127,14 @@ void ewol::context::InputManager::grabPointer(ewol::WidgetShared _widget) {
m_grabWidget = _widget; m_grabWidget = _widget;
/* TODO : /* TODO :
m_context.grabPointerEvents(true, _widget->getOrigin() m_context.grabPointerEvents(true, _widget->getOrigin()
+ ivec2(_widget->getSize().x()/2.0f, + Vector2i(_widget->getSize().x()/2.0f,
_widget->getSize().y()/2.0f) ); _widget->getSize().y()/2.0f) );
*/ */
} }
void ewol::context::InputManager::unGrabPointer() { void ewol::context::InputManager::unGrabPointer() {
m_grabWidget.reset(); m_grabWidget.reset();
// TODO: m_context.grabPointerEvents(false, vec2(0,0)); // TODO: m_context.grabPointerEvents(false, Vector2f(0,0));
} }
void ewol::context::InputManager::newLayerSet() { void ewol::context::InputManager::newLayerSet() {
@ -151,18 +151,18 @@ ewol::context::InputManager::InputManager(ewol::Context& _context) :
m_grabWidget(), m_grabWidget(),
m_context(_context) { m_context(_context) {
setDpi(200); setDpi(200);
EWOL_INFO("Init (start)"); Log.info("Init (start)");
for(int32_t iii=0; iii<MAX_MANAGE_INPUT; iii++) { for(int32_t iii=0; iii<MAX_MANAGE_INPUT; iii++) {
// remove the property of this input ... // remove the property of this input ...
cleanElement(m_eventInputSaved, iii); cleanElement(m_eventInputSaved, iii);
cleanElement(m_eventMouseSaved, iii); cleanElement(m_eventMouseSaved, iii);
} }
EWOL_INFO("Init (end)"); Log.info("Init (end)");
} }
ewol::context::InputManager::~InputManager() { ewol::context::InputManager::~InputManager() {
EWOL_INFO("Un-Init (start)"); Log.info("Un-Init (start)");
EWOL_INFO("Un-Init (end)"); Log.info("Un-Init (end)");
} }
int32_t ewol::context::InputManager::localGetDestinationId(enum gale::key::type _type, int32_t ewol::context::InputManager::localGetDestinationId(enum gale::key::type _type,
@ -188,7 +188,7 @@ int32_t ewol::context::InputManager::localGetDestinationId(enum gale::key::type
// note if id<0 == > the it was finger event ... // note if id<0 == > the it was finger event ...
void ewol::context::InputManager::motion(enum gale::key::type _type, void ewol::context::InputManager::motion(enum gale::key::type _type,
int _pointerID, int _pointerID,
vec2 _pos) { Vector2f _pos) {
EVENT_DEBUG("motion event : " << _type << " " << _pointerID << " " << _pos); EVENT_DEBUG("motion event : " << _type << " " << _pointerID << " " << _pos);
if (MAX_MANAGE_INPUT <= _pointerID) { if (MAX_MANAGE_INPUT <= _pointerID) {
// reject pointer == > out of IDs... // reject pointer == > out of IDs...
@ -200,7 +200,7 @@ void ewol::context::InputManager::motion(enum gale::key::type _type,
} else if (_type == gale::key::type::finger) { } else if (_type == gale::key::type::finger) {
eventTable = m_eventInputSaved; eventTable = m_eventInputSaved;
} else { } else {
EWOL_ERROR("Unknown type of event"); Log.error("Unknown type of event");
return; return;
} }
if( _pointerID > MAX_MANAGE_INPUT if( _pointerID > MAX_MANAGE_INPUT
@ -318,7 +318,7 @@ void ewol::context::InputManager::motion(enum gale::key::type _type,
void ewol::context::InputManager::state(enum gale::key::type _type, void ewol::context::InputManager::state(enum gale::key::type _type,
int _pointerID, int _pointerID,
bool _isDown, bool _isDown,
vec2 _pos) { Vector2f _pos) {
if (_pointerID >= MAX_MANAGE_INPUT) { if (_pointerID >= MAX_MANAGE_INPUT) {
// reject pointer == > out of IDs... // reject pointer == > out of IDs...
return; return;
@ -334,7 +334,7 @@ void ewol::context::InputManager::state(enum gale::key::type _type,
eventTable = m_eventInputSaved; eventTable = m_eventInputSaved;
localLimit = m_eventInputLimit; localLimit = m_eventInputLimit;
} else { } else {
EWOL_ERROR("Unknown type of event"); Log.error("Unknown type of event");
return; return;
} }
if( _pointerID > MAX_MANAGE_INPUT if( _pointerID > MAX_MANAGE_INPUT
@ -425,7 +425,7 @@ void ewol::context::InputManager::state(enum gale::key::type _type,
ewol::WidgetShared tmpWidget = eventTable[_pointerID].curentWidgetEvent.lock(); ewol::WidgetShared tmpWidget = eventTable[_pointerID].curentWidgetEvent.lock();
if(eventTable[_pointerID].isUsed == false) { if(eventTable[_pointerID].isUsed == false) {
// bad case ... ??? // bad case ... ???
EWOL_DEBUG("Up event without previous down ... "); Log.debug("Up event without previous down ... ");
// Mark it un-used : // Mark it un-used :
eventTable[_pointerID].isUsed = false; eventTable[_pointerID].isUsed = false;
// revove the widget ... // revove the widget ...

View File

@ -20,10 +20,10 @@ namespace ewol {
int32_t destinationInputId; int32_t destinationInputId;
echrono::Clock lastTimeEvent; echrono::Clock lastTimeEvent;
ewol::WidgetWeak curentWidgetEvent; ewol::WidgetWeak curentWidgetEvent;
vec2 origin; Vector2f origin;
vec2 size; Vector2f size;
vec2 downStart; Vector2f downStart;
vec2 posEvent; Vector2f posEvent;
bool isDown; bool isDown;
bool isInside; bool isInside;
int32_t nbClickEvent; // 0 .. 1 .. 2 .. 3 int32_t nbClickEvent; // 0 .. 1 .. 2 .. 3
@ -65,7 +65,7 @@ namespace ewol {
ewol::WidgetShared _destWidget, ewol::WidgetShared _destWidget,
int32_t _IdInput, int32_t _IdInput,
enum gale::key::status _typeEvent, enum gale::key::status _typeEvent,
vec2 _pos); Vector2f _pos);
/** /**
* @brief convert the system event id in the correct EWOL id depending of the system management mode * @brief convert the system event id in the correct EWOL id depending of the system management mode
* This function find the next input id unused on the specifiic widget * This function find the next input id unused on the specifiic widget
@ -86,8 +86,8 @@ namespace ewol {
void setDpi(int32_t _newDPI); void setDpi(int32_t _newDPI);
// note if id<0 == > the it was finger event ... // note if id<0 == > the it was finger event ...
void motion(enum gale::key::type _type, int _pointerID, vec2 _pos ); void motion(enum gale::key::type _type, int _pointerID, Vector2f _pos );
void state(enum gale::key::type _type, int _pointerID, bool _isDown, vec2 _pos); void state(enum gale::key::type _type, int _pointerID, bool _isDown, Vector2f _pos);
public: public:
/** /**
* @brief a new layer on the windows is set == > might remove all the property of the current element ... * @brief a new layer on the windows is set == > might remove all the property of the current element ...

View File

@ -14,13 +14,13 @@ namespace ewol {
enum gale::key::type m_type; enum gale::key::type m_type;
enum gale::key::status m_status; enum gale::key::status m_status;
uint8_t m_inputId; uint8_t m_inputId;
vec2 m_pos; Vector2f m_pos;
gale::key::Special m_specialKey; //!< input key status (prevent change in time..) gale::key::Special m_specialKey; //!< input key status (prevent change in time..)
public: public:
Input(enum gale::key::type _type, Input(enum gale::key::type _type,
enum gale::key::status _status, enum gale::key::status _status,
uint8_t _id, uint8_t _id,
const vec2& _pos, const Vector2f& _pos,
gale::key::Special _specialKey): gale::key::Special _specialKey):
m_type(_type), m_type(_type),
m_status(_status), m_status(_status),
@ -47,10 +47,10 @@ namespace ewol {
inline const uint8_t& getId() const { inline const uint8_t& getId() const {
return m_inputId; return m_inputId;
}; };
void setPos(const vec2& _pos) { void setPos(const Vector2f& _pos) {
m_pos = _pos; m_pos = _pos;
}; };
inline const vec2& getPos() const { inline const Vector2f& getPos() const {
return m_pos; return m_pos;
}; };
void setSpecialKey(const gale::key::Special& _specialKey) { void setSpecialKey(const gale::key::Special& _specialKey) {
@ -73,7 +73,7 @@ namespace ewol {
InputSystem(enum gale::key::type _type, InputSystem(enum gale::key::type _type,
enum gale::key::status _status, enum gale::key::status _status,
uint8_t _id, uint8_t _id,
const vec2& _pos, const Vector2f& _pos,
ewol::WidgetShared _dest, ewol::WidgetShared _dest,
int32_t _realIdEvent, int32_t _realIdEvent,
gale::key::Special _specialKey) : gale::key::Special _specialKey) :

View File

@ -56,24 +56,24 @@ enum ewol::gravity ewol::stringToGravity(const etk::String& _obj) {
} }
return ewol::gravity_center; return ewol::gravity_center;
} }
vec2 ewol::gravityGenerateDelta(const enum ewol::gravity _gravity, const vec2& _deltas) { Vector2f ewol::gravityGenerateDelta(const enum ewol::gravity _gravity, const Vector2f& _deltas) {
vec2 out(0.0f,0.0f); Vector2f out(0.0f,0.0f);
if (_deltas.x() > 0.0001f) { if (_deltas.x() > 0.0001f) {
if ((uint32_t(_gravity) & uint32_t(ewol::gravity_left)) != 0) { if ((uint32_t(_gravity) & uint32_t(ewol::gravity_left)) != 0) {
// nothing to do // nothing to do
} else if ((uint32_t(_gravity) & uint32_t(ewol::gravity_right)) != 0) { } else if ((uint32_t(_gravity) & uint32_t(ewol::gravity_right)) != 0) {
out = vec2(int32_t(_deltas.x()), 0.0f); out = Vector2f(int32_t(_deltas.x()), 0.0f);
} else { } else {
out = vec2(int32_t(_deltas.x()*0.5f), 0.0f); out = Vector2f(int32_t(_deltas.x()*0.5f), 0.0f);
} }
} }
if (_deltas.y() > 0.0001f) { if (_deltas.y() > 0.0001f) {
if ((uint32_t(_gravity) & uint32_t(ewol::gravity_buttom)) != 0) { if ((uint32_t(_gravity) & uint32_t(ewol::gravity_buttom)) != 0) {
// nothing to do // nothing to do
} else if ((uint32_t(_gravity) & uint32_t(ewol::gravity_top)) != 0) { } else if ((uint32_t(_gravity) & uint32_t(ewol::gravity_top)) != 0) {
out += vec2(0.0f, int32_t(_deltas.y())); out += Vector2f(0.0f, int32_t(_deltas.y()));
} else { } else {
out += vec2(0.0f, int32_t(_deltas.y()*0.5f)); out += Vector2f(0.0f, int32_t(_deltas.y()*0.5f));
} }
} }
return out; return out;

View File

@ -27,5 +27,5 @@ namespace ewol {
etk::Stream& operator <<(etk::Stream& _os, const enum ewol::gravity _obj); etk::Stream& operator <<(etk::Stream& _os, const enum ewol::gravity _obj);
etk::String gravityToString(const enum ewol::gravity _obj); etk::String gravityToString(const enum ewol::gravity _obj);
enum ewol::gravity stringToGravity(const etk::String& _obj); enum ewol::gravity stringToGravity(const etk::String& _obj);
vec2 gravityGenerateDelta(const enum ewol::gravity _gravity, const vec2& _deltas); Vector2f gravityGenerateDelta(const enum ewol::gravity _gravity, const Vector2f& _deltas);
} }

View File

@ -17,7 +17,7 @@ ewol::object::Manager::Manager(ewol::Context& _context) :
periodicCall(this, "periodic", "Call every time system render"), periodicCall(this, "periodic", "Call every time system render"),
m_applWakeUpTime(0), m_applWakeUpTime(0),
m_lastPeriodicCallTime(0) { m_lastPeriodicCallTime(0) {
EWOL_DEBUG(" == > init Object-Manager"); Log.debug(" == > init Object-Manager");
periodicCall.setPeriodic(true); periodicCall.setPeriodic(true);
// set the basic time properties : // set the basic time properties :
m_applWakeUpTime = echrono::Clock::now(); m_applWakeUpTime = echrono::Clock::now();
@ -29,31 +29,31 @@ ewol::object::Manager::~Manager() {
m_workerList.clear(); m_workerList.clear();
bool hasError = false; bool hasError = false;
if (m_eObjectList.size()!=0) { if (m_eObjectList.size()!=0) {
EWOL_ERROR("Must not have anymore eObject !!!"); Log.error("Must not have anymore eObject !!!");
hasError = true; hasError = true;
} }
if (hasError == true) { if (hasError == true) {
EWOL_ERROR("Check if the function UnInit has been called !!!"); Log.error("Check if the function UnInit has been called !!!");
} }
displayListObject(); displayListObject();
} }
void ewol::object::Manager::displayListObject() { void ewol::object::Manager::displayListObject() {
ethread::RecursiveLock lock(m_mutex); ethread::RecursiveLock lock(m_mutex);
EWOL_INFO("List loaded object : "); Log.info("List loaded object : ");
for (auto &it : m_eObjectList) { for (auto &it : m_eObjectList) {
ewol::ObjectShared element = it.lock(); ewol::ObjectShared element = it.lock();
if (element != null) { if (element != null) {
EWOL_INFO(" [" << element->getId() << "] ref=" << element.useCount()-1 << " name='" << element->propertyName.get() << "' type=" << element->getObjectType()); Log.info(" [" << element->getId() << "] ref=" << element.useCount()-1 << " name='" << element->propertyName.get() << "' type=" << element->getObjectType());
} }
} }
} }
void ewol::object::Manager::unInit() { void ewol::object::Manager::unInit() {
ethread::RecursiveLock lock(m_mutex); ethread::RecursiveLock lock(m_mutex);
EWOL_DEBUG(" == > Un-Init Object-Manager"); Log.debug(" == > Un-Init Object-Manager");
if (m_workerList.size() > 0) { if (m_workerList.size() > 0) {
EWOL_DEBUG(" == > Remove all workers"); Log.debug(" == > Remove all workers");
m_workerList.clear(); m_workerList.clear();
} }
for (auto &it : m_eObjectList) { for (auto &it : m_eObjectList) {
@ -63,7 +63,7 @@ void ewol::object::Manager::unInit() {
} }
} }
if (m_eObjectList.size() != 0) { if (m_eObjectList.size() != 0) {
EWOL_ERROR("Have " << m_eObjectList.size() << " active Object"); Log.error("Have " << m_eObjectList.size() << " active Object");
} }
m_eObjectList.clear(); m_eObjectList.clear();
} }
@ -71,7 +71,7 @@ void ewol::object::Manager::unInit() {
void ewol::object::Manager::add(const ewol::ObjectShared& _object) { void ewol::object::Manager::add(const ewol::ObjectShared& _object) {
ethread::RecursiveLock lock(m_mutex); ethread::RecursiveLock lock(m_mutex);
if (_object == null) { if (_object == null) {
EWOL_ERROR("try to add an inexistant Object in manager"); Log.error("try to add an inexistant Object in manager");
} }
m_eObjectList.pushBack(_object); m_eObjectList.pushBack(_object);
} }
@ -85,7 +85,7 @@ int32_t ewol::object::Manager::getNumberObject() {
void ewol::object::Manager::cleanInternalRemoved() { void ewol::object::Manager::cleanInternalRemoved() {
ethread::RecursiveLock lock(m_mutex); ethread::RecursiveLock lock(m_mutex);
size_t nbObject = m_eObjectList.size(); size_t nbObject = m_eObjectList.size();
EWOL_VERBOSE("Clean Object List (if needed) : " << m_eObjectList.size() << " elements"); Log.verbose("Clean Object List (if needed) : " << m_eObjectList.size() << " elements");
auto it(m_eObjectList.begin()); auto it(m_eObjectList.begin());
while (it != m_eObjectList.end()) { while (it != m_eObjectList.end()) {
if (it->expired() == true) { if (it->expired() == true) {
@ -95,7 +95,7 @@ void ewol::object::Manager::cleanInternalRemoved() {
} }
} }
if (m_eObjectList.size() != nbObject) { if (m_eObjectList.size() != nbObject) {
EWOL_VERBOSE(" remove " << nbObject - m_eObjectList.size() << " deprecated objects"); Log.verbose(" remove " << nbObject - m_eObjectList.size() << " deprecated objects");
} }
} }

View File

@ -20,7 +20,7 @@ namespace ewol {
protected: protected:
ethread::MutexRecursive m_mutex; ethread::MutexRecursive m_mutex;
private: private:
etk::Vector<ewol::ObjectWeak> m_eObjectList; // all widget allocated == > all time increment ... never removed ... List<ewol::ObjectWeak> m_eObjectList; // all widget allocated == > all time increment ... never removed ...
Context& m_context; Context& m_context;
public: public:
Manager(Context& _context); Manager(Context& _context);
@ -66,7 +66,7 @@ namespace ewol {
*/ */
ewol::ObjectShared getObjectNamed(const etk::String& _name); ewol::ObjectShared getObjectNamed(const etk::String& _name);
private: private:
etk::Vector<ewol::ObjectShared> m_workerList; List<ewol::ObjectShared> m_workerList;
public: public:
/** /**
* @brief Add a worker on the system list. * @brief Add a worker on the system list.

View File

@ -18,11 +18,11 @@ void ewol::Object::autoDestroy() {
EWOL_WARNING("try to auto destroy inside a constructor"); EWOL_WARNING("try to auto destroy inside a constructor");
return; return;
} }
EWOL_VERBOSE("Destroy object: [" << getId() << "] type:" << getObjectType()); Log.verbose("Destroy object: [" << getId() << "] type:" << getObjectType());
ewol::ObjectShared parent = m_parent.lock(); ewol::ObjectShared parent = m_parent.lock();
// TODO : set a signal to do this ... // TODO : set a signal to do this ...
if (parent != null) { if (parent != null) {
EWOL_VERBOSE("Destroy object: Call parrent"); Log.verbose("Destroy object: Call parrent");
parent->requestDestroyFromChild(sharedFromThis()); parent->requestDestroyFromChild(sharedFromThis());
} }
//if no parent ==> noting to do ... //if no parent ==> noting to do ...
@ -34,8 +34,8 @@ bool ewol::Object::objectHasBeenCorectlyInit() {
} }
void ewol::Object::requestDestroyFromChild(const ewol::ObjectShared& _child) { void ewol::Object::requestDestroyFromChild(const ewol::ObjectShared& _child) {
EWOL_INFO("requestDestroyFromChild(...) is called when an object reference as a parent have a child that request quto-destroy ..."); Log.info("requestDestroyFromChild(...) is called when an object reference as a parent have a child that request quto-destroy ...");
EWOL_CRITICAL("Call From Child with no effects ==> must implement : requestDestroyFromChild(...)"); Log.critical("Call From Child with no effects ==> must implement : requestDestroyFromChild(...)");
} }
void ewol::Object::destroy() { void ewol::Object::destroy() {
@ -63,11 +63,11 @@ ewol::Object::Object() :
m_isResource(false) { m_isResource(false) {
// note this is nearly atomic ... (but it is enough) // note this is nearly atomic ... (but it is enough)
m_uniqueId = m_valUID++; m_uniqueId = m_valUID++;
EWOL_DEBUG("new Object : [" << m_uniqueId << "]"); Log.debug("new Object : [" << m_uniqueId << "]");
} }
ewol::Object::~Object() { ewol::Object::~Object() {
EWOL_DEBUG("delete Object : [" << m_uniqueId << "] : " << getTypeDescription()); Log.debug("delete Object : [" << m_uniqueId << "] : " << getTypeDescription());
m_uniqueId = -1; m_uniqueId = -1;
} }
@ -87,7 +87,7 @@ const char * const ewol::Object::getObjectType() const {
void ewol::Object::addObjectType(const char* _type) { void ewol::Object::addObjectType(const char* _type) {
if (_type == null) { if (_type == null) {
EWOL_ERROR(" try to add a type with no value..."); Log.error(" try to add a type with no value...");
return; return;
} }
m_listType.pushBack(_type); m_listType.pushBack(_type);
@ -168,7 +168,7 @@ ewol::ObjectShared ewol::Object::getObjectNamed(const etk::String& _objectName)
} }
ewol::ObjectShared ewol::Object::getSubObjectNamed(const etk::String& _objectName) { ewol::ObjectShared ewol::Object::getSubObjectNamed(const etk::String& _objectName) {
EWOL_VERBOSE("check if name : " << _objectName << " ?= " << propertyName.get()); Log.verbose("check if name : " << _objectName << " ?= " << propertyName.get());
if (_objectName == propertyName.get()) { if (_objectName == propertyName.get()) {
return sharedFromThis(); return sharedFromThis();
} }

View File

@ -38,17 +38,17 @@ template<class TYPE_OBJECT, class TYPE_VAL, class ... TYPE> static void baseInit
eproperty::Property* prop(null); eproperty::Property* prop(null);
eproperty::PropertyType<TYPE_VAL>* propType(null); eproperty::PropertyType<TYPE_VAL>* propType(null);
if (_object == null) { if (_object == null) {
EWOL_ERROR("EMPTY pointer"); Log.error("EMPTY pointer");
return; return;
} }
prop = _object->properties.getRaw(_name); prop = _object->properties.getRaw(_name);
if (prop == null) { if (prop == null) {
EWOL_ERROR("property does not exit ... '" << _name << "'"); Log.error("property does not exit ... '" << _name << "'");
goto exit_on_error; goto exit_on_error;
} }
propType = dynamic_cast<eproperty::PropertyType<TYPE_VAL>*>(prop); propType = dynamic_cast<eproperty::PropertyType<TYPE_VAL>*>(prop);
if (propType == null) { if (propType == null) {
EWOL_ERROR("property does not cast in requested type ... '" << _name << "' require type : " << /*typeid(_val).name()*/ "?TODO?" << "' instead of '" << prop->getType() << "'"); Log.error("property does not cast in requested type ... '" << _name << "' require type : " << /*typeid(_val).name()*/ "?TODO?" << "' instead of '" << prop->getType() << "'");
goto exit_on_error; goto exit_on_error;
} }
propType->setDirectCheck(_val); propType->setDirectCheck(_val);
@ -64,26 +64,26 @@ exit_on_error:
template<class ... EWOL_FACTORY_CREATE_TYPE> static ememory::SharedPtr<className> create(const EWOL_FACTORY_CREATE_TYPE& ... _all) { \ template<class ... EWOL_FACTORY_CREATE_TYPE> static ememory::SharedPtr<className> create(const EWOL_FACTORY_CREATE_TYPE& ... _all) { \
ememory::SharedPtr<className> object(ETK_NEW(className)); \ ememory::SharedPtr<className> object(ETK_NEW(className)); \
if (object == null) { \ if (object == null) { \
EWOL_ERROR("Factory error"); \ Log.error("Factory error"); \
return null; \ return null; \
} \ } \
baseInit(object, _all... ); \ baseInit(object, _all... ); \
object->init(); \ object->init(); \
if (object->objectHasBeenCorectlyInit() == false) { \ if (object->objectHasBeenCorectlyInit() == false) { \
EWOL_CRITICAL("Object Is not correctly init : " << #className ); \ Log.critical("Object Is not correctly init : " << #className ); \
} \ } \
return object; \ return object; \
} \ } \
static ememory::SharedPtr<className> createXml(const exml::Element& _node) { \ static ememory::SharedPtr<className> createXml(const exml::Element& _node) { \
ememory::SharedPtr<className> object(ETK_NEW(className)); \ ememory::SharedPtr<className> object(ETK_NEW(className)); \
if (object == null) { \ if (object == null) { \
EWOL_ERROR("Factory error"); \ Log.error("Factory error"); \
return null; \ return null; \
} \ } \
object->loadXMLAttributes(_node); \ object->loadXMLAttributes(_node); \
object->init(); \ object->init(); \
if (object->objectHasBeenCorectlyInit() == false) { \ if (object->objectHasBeenCorectlyInit() == false) { \
EWOL_CRITICAL("Object Is not correctly init : " << #className ); \ Log.critical("Object Is not correctly init : " << #className ); \
} \ } \
return object; \ return object; \
} }
@ -95,7 +95,7 @@ exit_on_error:
if (object2 != null) { \ if (object2 != null) { \
object = ememory::dynamicPointerCast<className>(object2); \ object = ememory::dynamicPointerCast<className>(object2); \
if (object == null) { \ if (object == null) { \
EWOL_CRITICAL("Request object element: '" << uniqueName << "' With the wrong type (dynamic cast error)"); \ Log.critical("Request object element: '" << uniqueName << "' With the wrong type (dynamic cast error)"); \
return null; \ return null; \
} \ } \
} \ } \
@ -104,13 +104,13 @@ exit_on_error:
} \ } \
object = ememory::SharedPtr<className>(ETK_NEW(className)); \ object = ememory::SharedPtr<className>(ETK_NEW(className)); \
if (object == null) { \ if (object == null) { \
EWOL_ERROR("Factory error"); \ Log.error("Factory error"); \
return null; \ return null; \
} \ } \
baseInit(object, "name", etk::String(uniqueName), _all... ); \ baseInit(object, "name", etk::String(uniqueName), _all... ); \
object->init(); \ object->init(); \
if (object->objectHasBeenCorectlyInit() == false) { \ if (object->objectHasBeenCorectlyInit() == false) { \
EWOL_CRITICAL("Object Is not correctly init : " << #className ); \ Log.critical("Object Is not correctly init : " << #className ); \
} \ } \
return object; \ return object; \
} }
@ -186,7 +186,7 @@ namespace ewol {
*/ */
virtual void removeParent(); virtual void removeParent();
private: private:
etk::Vector<const char*> m_listType; List<const char*> m_listType;
public: public:
/** /**
* @brief get the current Object type of the Object * @brief get the current Object type of the Object
@ -306,7 +306,7 @@ namespace ewol {
if (myObject != null) { \ if (myObject != null) { \
myObject->_event.connect(_shared_ptr, _func, ##__VA_ARGS__); \ myObject->_event.connect(_shared_ptr, _func, ##__VA_ARGS__); \
} else { \ } else { \
EWOL_ERROR("object named='" << _name << "' not exit or can not be cast in : " << #_type); \ Log.error("object named='" << _name << "' not exit or can not be cast in : " << #_type); \
} \ } \
} while (false) } while (false)
}; };
@ -321,7 +321,7 @@ namespace ewol {
if (myObject != null) { \ if (myObject != null) { \
myObject->_event.connect(_obj, _func, ##__VA_ARGS__); \ myObject->_event.connect(_obj, _func, ##__VA_ARGS__); \
} else { \ } else { \
EWOL_ERROR("object named='" << _name << "' not exit or can not be cast in : " << #_type); \ Log.error("object named='" << _name << "' not exit or can not be cast in : " << #_type); \
} \ } \
} while (false) } while (false)
@ -333,7 +333,7 @@ namespace ewol {
if (myObject != null) { \ if (myObject != null) { \
myObject->_event.connect(_obj, _func, ##__VA_ARGS__); \ myObject->_event.connect(_obj, _func, ##__VA_ARGS__); \
} else { \ } else { \
EWOL_ERROR("object named='" << _name << "' not exit or can not be cast in : " << #_type); \ Log.error("object named='" << _name << "' not exit or can not be cast in : " << #_type); \
} \ } \
} while (false) } while (false)

View File

@ -22,9 +22,9 @@ ewol::resource::ColorFile::ColorFile() :
void ewol::resource::ColorFile::init(const etk::Uri& _uri) { void ewol::resource::ColorFile::init(const etk::Uri& _uri) {
ethread::RecursiveLock lock(m_mutex); ethread::RecursiveLock lock(m_mutex);
gale::Resource::init(_uri.get()); gale::Resource::init(_uri.get());
EWOL_DEBUG("CF : load \"" << _uri << "\""); Log.debug("CF : load \"" << _uri << "\"");
reload(); reload();
EWOL_DEBUG("List of all color : " << m_list.getKeys()); Log.debug("List of all color : " << m_list.getKeys());
} }
ewol::resource::ColorFile::~ColorFile() { ewol::resource::ColorFile::~ColorFile() {
@ -42,12 +42,12 @@ void ewol::resource::ColorFile::reload() {
// open and read all json elements: // open and read all json elements:
ejson::Document doc; ejson::Document doc;
if (doc.load(etk::Uri(m_name)) == false) { if (doc.load(etk::Uri(m_name)) == false) {
EWOL_ERROR("Can not load file : '" << m_name << "'"); Log.error("Can not load file : '" << m_name << "'");
return; return;
} }
ejson::Array baseArray = doc["color"].toArray(); ejson::Array baseArray = doc["color"].toArray();
if (baseArray.exist() == false) { if (baseArray.exist() == false) {
EWOL_ERROR("Can not get basic array : 'color' in file:" << m_name); Log.error("Can not get basic array : 'color' in file:" << m_name);
doc.display(); doc.display();
return; return;
} }
@ -55,22 +55,22 @@ void ewol::resource::ColorFile::reload() {
for (const auto it : baseArray) { for (const auto it : baseArray) {
ejson::Object tmpObj = it.toObject(); ejson::Object tmpObj = it.toObject();
if (tmpObj.exist() == false) { if (tmpObj.exist() == false) {
EWOL_ERROR(" can not get object in 'color' : " << it); Log.error(" can not get object in 'color' : " << it);
findError = true; findError = true;
continue; continue;
} }
etk::String name = tmpObj["name"].toString().get(); etk::String name = tmpObj["name"].toString().get();
etk::String color = tmpObj["color"].toString().get(m_errorColor.getHexString()); etk::String color = tmpObj["color"].toString().get(m_errorColor.getHexString());
EWOL_DEBUG("find new color : '" << name << "' color='" << color << "'"); Log.debug("find new color : '" << name << "' color='" << color << "'");
if (name.size() == 0) { if (name.size() == 0) {
EWOL_ERROR("Drop an empty name"); Log.error("Drop an empty name");
findError = true; findError = true;
continue; continue;
} }
m_list.add(name, etk::Color<float>(color)); m_list.add(name, etk::Color<float>(color));
} }
if (findError == true) { if (findError == true) {
EWOL_ERROR("pb in parsing file:" << m_name); Log.error("pb in parsing file:" << m_name);
doc.display(); doc.display();
} }
} }

View File

@ -62,7 +62,7 @@ namespace ewol {
* @brief Get All color name * @brief Get All color name
* @return list of all color existing * @return list of all color existing
*/ */
etk::Vector<etk::String> getColors() const { List<etk::String> getColors() const {
return m_list.getKeys(); return m_list.getKeys();
} }
public: // herited function: public: // herited function:

View File

@ -37,7 +37,7 @@ ewol::resource::Colored3DObject::~Colored3DObject() {
} }
void ewol::resource::Colored3DObject::draw(const etk::Vector<vec3>& _vertices, void ewol::resource::Colored3DObject::draw(const List<Vector3f>& _vertices,
const etk::Color<float>& _color, const etk::Color<float>& _color,
bool _updateDepthBuffer, bool _updateDepthBuffer,
bool _depthtest) { bool _depthtest) {
@ -45,7 +45,7 @@ void ewol::resource::Colored3DObject::draw(const etk::Vector<vec3>& _vertices,
return; return;
} }
if (m_GLprogram == null) { if (m_GLprogram == null) {
EWOL_ERROR("No shader ..."); Log.error("No shader ...");
return; return;
} }
if (true == _depthtest) { if (true == _depthtest) {
@ -54,7 +54,7 @@ void ewol::resource::Colored3DObject::draw(const etk::Vector<vec3>& _vertices,
glDepthMask(GL_FALSE); glDepthMask(GL_FALSE);
} }
} }
//EWOL_DEBUG(" display " << m_coord.size() << " elements" ); //Log.debug(" display " << m_coord.size() << " elements" );
m_GLprogram->use(); m_GLprogram->use();
// set Matrix: translation/positionMatrix // set Matrix: translation/positionMatrix
mat4 projMatrix = gale::openGL::getMatrix(); mat4 projMatrix = gale::openGL::getMatrix();
@ -79,7 +79,7 @@ void ewol::resource::Colored3DObject::draw(const etk::Vector<vec3>& _vertices,
} }
} }
void ewol::resource::Colored3DObject::draw(const etk::Vector<vec3>& _vertices, void ewol::resource::Colored3DObject::draw(const List<Vector3f>& _vertices,
const etk::Color<float>& _color, const etk::Color<float>& _color,
mat4& _transformationMatrix, mat4& _transformationMatrix,
bool _updateDepthBuffer, bool _updateDepthBuffer,
@ -88,7 +88,7 @@ void ewol::resource::Colored3DObject::draw(const etk::Vector<vec3>& _vertices,
return; return;
} }
if (m_GLprogram == null) { if (m_GLprogram == null) {
EWOL_ERROR("No shader ..."); Log.error("No shader ...");
return; return;
} }
if (true == _depthtest) { if (true == _depthtest) {
@ -97,7 +97,7 @@ void ewol::resource::Colored3DObject::draw(const etk::Vector<vec3>& _vertices,
glDepthMask(GL_FALSE); glDepthMask(GL_FALSE);
} }
} }
//EWOL_DEBUG(" display " << m_coord.size() << " elements" ); //Log.debug(" display " << m_coord.size() << " elements" );
m_GLprogram->use(); m_GLprogram->use();
// set Matrix: translation/positionMatrix // set Matrix: translation/positionMatrix
mat4 projMatrix = gale::openGL::getMatrix(); mat4 projMatrix = gale::openGL::getMatrix();
@ -119,7 +119,7 @@ void ewol::resource::Colored3DObject::draw(const etk::Vector<vec3>& _vertices,
} }
} }
void ewol::resource::Colored3DObject::drawLine(etk::Vector<vec3>& _vertices, void ewol::resource::Colored3DObject::drawLine(List<Vector3f>& _vertices,
const etk::Color<float>& _color, const etk::Color<float>& _color,
mat4& _transformationMatrix, mat4& _transformationMatrix,
bool _updateDepthBuffer, bool _updateDepthBuffer,
@ -128,7 +128,7 @@ void ewol::resource::Colored3DObject::drawLine(etk::Vector<vec3>& _vertices,
return; return;
} }
if (m_GLprogram == null) { if (m_GLprogram == null) {
EWOL_ERROR("No shader ..."); Log.error("No shader ...");
return; return;
} }
if (true == _depthtest) { if (true == _depthtest) {
@ -137,7 +137,7 @@ void ewol::resource::Colored3DObject::drawLine(etk::Vector<vec3>& _vertices,
glDepthMask(GL_FALSE); glDepthMask(GL_FALSE);
} }
} }
//EWOL_DEBUG(" display " << m_coord.size() << " elements" ); //Log.debug(" display " << m_coord.size() << " elements" );
m_GLprogram->use(); m_GLprogram->use();
// set Matrix: translation/positionMatrix // set Matrix: translation/positionMatrix
mat4 projMatrix = gale::openGL::getMatrix(); mat4 projMatrix = gale::openGL::getMatrix();
@ -160,70 +160,70 @@ void ewol::resource::Colored3DObject::drawLine(etk::Vector<vec3>& _vertices,
} }
void ewol::resource::Colored3DObject::drawCubeLine(const vec3& _min, void ewol::resource::Colored3DObject::drawCubeLine(const Vector3f& _min,
const vec3& _max, const Vector3f& _max,
const etk::Color<float>& _color, const etk::Color<float>& _color,
mat4& _transformationMatrix, mat4& _transformationMatrix,
bool _updateDepthBuffer, bool _updateDepthBuffer,
bool _depthtest) { bool _depthtest) {
etk::Vector<vec3> vertices; List<Vector3f> vertices;
vertices.pushBack(vec3(_min.x(), _min.y(),_min.z())); vertices.pushBack(Vector3f(_min.x(), _min.y(),_min.z()));
vertices.pushBack(vec3(_max.x(), _min.y(),_min.z())); vertices.pushBack(Vector3f(_max.x(), _min.y(),_min.z()));
vertices.pushBack(vec3(_max.x(), _min.y(),_min.z())); vertices.pushBack(Vector3f(_max.x(), _min.y(),_min.z()));
vertices.pushBack(vec3(_max.x(), _min.y(),_max.z())); vertices.pushBack(Vector3f(_max.x(), _min.y(),_max.z()));
vertices.pushBack(vec3(_max.x(), _min.y(),_max.z())); vertices.pushBack(Vector3f(_max.x(), _min.y(),_max.z()));
vertices.pushBack(vec3(_min.x(), _min.y(),_max.z())); vertices.pushBack(Vector3f(_min.x(), _min.y(),_max.z()));
vertices.pushBack(vec3(_min.x(), _min.y(),_max.z())); vertices.pushBack(Vector3f(_min.x(), _min.y(),_max.z()));
vertices.pushBack(vec3(_min.x(), _min.y(),_min.z())); vertices.pushBack(Vector3f(_min.x(), _min.y(),_min.z()));
vertices.pushBack(vec3(_min.x(), _max.y(),_min.z())); vertices.pushBack(Vector3f(_min.x(), _max.y(),_min.z()));
vertices.pushBack(vec3(_max.x(), _max.y(),_min.z())); vertices.pushBack(Vector3f(_max.x(), _max.y(),_min.z()));
vertices.pushBack(vec3(_max.x(), _max.y(),_min.z())); vertices.pushBack(Vector3f(_max.x(), _max.y(),_min.z()));
vertices.pushBack(vec3(_max.x(), _max.y(),_max.z())); vertices.pushBack(Vector3f(_max.x(), _max.y(),_max.z()));
vertices.pushBack(vec3(_max.x(), _max.y(),_max.z())); vertices.pushBack(Vector3f(_max.x(), _max.y(),_max.z()));
vertices.pushBack(vec3(_min.x(), _max.y(),_max.z())); vertices.pushBack(Vector3f(_min.x(), _max.y(),_max.z()));
vertices.pushBack(vec3(_min.x(), _max.y(),_max.z())); vertices.pushBack(Vector3f(_min.x(), _max.y(),_max.z()));
vertices.pushBack(vec3(_min.x(), _max.y(),_min.z())); vertices.pushBack(Vector3f(_min.x(), _max.y(),_min.z()));
vertices.pushBack(vec3(_min.x(), _min.y(),_min.z())); vertices.pushBack(Vector3f(_min.x(), _min.y(),_min.z()));
vertices.pushBack(vec3(_min.x(), _max.y(),_min.z())); vertices.pushBack(Vector3f(_min.x(), _max.y(),_min.z()));
vertices.pushBack(vec3(_max.x(), _min.y(),_min.z())); vertices.pushBack(Vector3f(_max.x(), _min.y(),_min.z()));
vertices.pushBack(vec3(_max.x(), _max.y(),_min.z())); vertices.pushBack(Vector3f(_max.x(), _max.y(),_min.z()));
vertices.pushBack(vec3(_max.x(), _min.y(),_max.z())); vertices.pushBack(Vector3f(_max.x(), _min.y(),_max.z()));
vertices.pushBack(vec3(_max.x(), _max.y(),_max.z())); vertices.pushBack(Vector3f(_max.x(), _max.y(),_max.z()));
vertices.pushBack(vec3(_min.x(), _min.y(),_max.z())); vertices.pushBack(Vector3f(_min.x(), _min.y(),_max.z()));
vertices.pushBack(vec3(_min.x(), _max.y(),_max.z())); vertices.pushBack(Vector3f(_min.x(), _max.y(),_max.z()));
drawLine(vertices, _color, _transformationMatrix, _updateDepthBuffer, _depthtest); drawLine(vertices, _color, _transformationMatrix, _updateDepthBuffer, _depthtest);
} }
void ewol::resource::Colored3DObject::drawSquare(const vec3& _size, void ewol::resource::Colored3DObject::drawSquare(const Vector3f& _size,
mat4& _transformationMatrix, mat4& _transformationMatrix,
const etk::Color<float>& _tmpColor) { const etk::Color<float>& _tmpColor) {
etk::Vector<vec3> tmpVertices; List<Vector3f> tmpVertices;
static int indices[36] = { 0,1,2, 3,2,1, 4,0,6, static int indices[36] = { 0,1,2, 3,2,1, 4,0,6,
6,0,2, 5,1,4, 4,1,0, 6,0,2, 5,1,4, 4,1,0,
7,3,1, 7,1,5, 5,4,7, 7,3,1, 7,1,5, 5,4,7,
7,4,6, 7,2,3, 7,6,2}; 7,4,6, 7,2,3, 7,6,2};
vec3 vertices[8]={ vec3(_size[0],_size[1],_size[2]), Vector3f vertices[8]={ Vector3f(_size[0],_size[1],_size[2]),
vec3(-_size[0],_size[1],_size[2]), Vector3f(-_size[0],_size[1],_size[2]),
vec3(_size[0],-_size[1],_size[2]), Vector3f(_size[0],-_size[1],_size[2]),
vec3(-_size[0],-_size[1],_size[2]), Vector3f(-_size[0],-_size[1],_size[2]),
vec3(_size[0],_size[1],-_size[2]), Vector3f(_size[0],_size[1],-_size[2]),
vec3(-_size[0],_size[1],-_size[2]), Vector3f(-_size[0],_size[1],-_size[2]),
vec3(_size[0],-_size[1],-_size[2]), Vector3f(_size[0],-_size[1],-_size[2]),
vec3(-_size[0],-_size[1],-_size[2])}; Vector3f(-_size[0],-_size[1],-_size[2])};
tmpVertices.clear(); tmpVertices.clear();
for (int32_t iii=0 ; iii<36 ; iii+=3) { for (int32_t iii=0 ; iii<36 ; iii+=3) {
// normal calculation : // normal calculation :
@ -241,7 +241,7 @@ void ewol::resource::Colored3DObject::drawSphere(float _radius,
int _longs, int _longs,
mat4& _transformationMatrix, mat4& _transformationMatrix,
const etk::Color<float>& _tmpColor) { const etk::Color<float>& _tmpColor) {
etk::Vector<vec3> tmpVertices; List<Vector3f> tmpVertices;
for(int32_t iii=0; iii<=_lats; ++iii) { for(int32_t iii=0; iii<=_lats; ++iii) {
float lat0 = M_PI * (-0.5f + float(iii - 1) / _lats); float lat0 = M_PI * (-0.5f + float(iii - 1) / _lats);
float z0 = _radius*sin(lat0); float z0 = _radius*sin(lat0);
@ -255,14 +255,14 @@ void ewol::resource::Colored3DObject::drawSphere(float _radius,
float lng = 2.0f * M_PI * float(jjj - 1) / _longs; float lng = 2.0f * M_PI * float(jjj - 1) / _longs;
float x = cos(lng); float x = cos(lng);
float y = sin(lng); float y = sin(lng);
vec3 v1 = vec3(x * zr1, y * zr1, z1); Vector3f v1 = Vector3f(x * zr1, y * zr1, z1);
vec3 v4 = vec3(x * zr0, y * zr0, z0); Vector3f v4 = Vector3f(x * zr0, y * zr0, z0);
lng = 2 * M_PI * float(jjj) / _longs; lng = 2 * M_PI * float(jjj) / _longs;
x = cos(lng); x = cos(lng);
y = sin(lng); y = sin(lng);
vec3 v2 = vec3(x * zr1, y * zr1, z1); Vector3f v2 = Vector3f(x * zr1, y * zr1, z1);
vec3 v3 = vec3(x * zr0, y * zr0, z0); Vector3f v3 = Vector3f(x * zr0, y * zr0, z0);
tmpVertices.pushBack(v1); tmpVertices.pushBack(v1);
tmpVertices.pushBack(v2); tmpVertices.pushBack(v2);
@ -281,7 +281,7 @@ void ewol::resource::Colored3DObject::drawCylinder(float _radius,
int _longs, int _longs,
mat4& _transformationMatrix, mat4& _transformationMatrix,
const etk::Color<float>& _tmpColor) { const etk::Color<float>& _tmpColor) {
etk::Vector<vec3> tmpVertices; List<Vector3f> tmpVertices;
// center to border (TOP) // center to border (TOP)
// center to border (TOP) // center to border (TOP)
@ -289,16 +289,16 @@ void ewol::resource::Colored3DObject::drawCylinder(float _radius,
float lng = 2.0f * M_PI * float(jjj - 1) / _longs; float lng = 2.0f * M_PI * float(jjj - 1) / _longs;
float z = _size*0.5f; float z = _size*0.5f;
vec3 v1 = vec3(0.0f, 0.0f, z); Vector3f v1 = Vector3f(0.0f, 0.0f, z);
float x = cos(lng)*_radius; float x = cos(lng)*_radius;
float y = sin(lng)*_radius; float y = sin(lng)*_radius;
vec3 v2 = vec3(x, y, z); Vector3f v2 = Vector3f(x, y, z);
lng = 2.0f * M_PI * float(jjj) / _longs; lng = 2.0f * M_PI * float(jjj) / _longs;
x = cos(lng)*_radius; x = cos(lng)*_radius;
y = sin(lng)*_radius; y = sin(lng)*_radius;
vec3 v3 = vec3(x, y, z); Vector3f v3 = Vector3f(x, y, z);
tmpVertices.pushBack(v1); tmpVertices.pushBack(v1);
tmpVertices.pushBack(v3); tmpVertices.pushBack(v3);
tmpVertices.pushBack(v2); tmpVertices.pushBack(v2);
@ -311,14 +311,14 @@ void ewol::resource::Colored3DObject::drawCylinder(float _radius,
float x = cos(lng)*_radius; float x = cos(lng)*_radius;
float y = sin(lng)*_radius; float y = sin(lng)*_radius;
vec3 v2 = vec3(x, y, z); Vector3f v2 = Vector3f(x, y, z);
vec3 v2b = vec3(x, y, -z); Vector3f v2b = Vector3f(x, y, -z);
lng = 2.0f * M_PI * float(jjj) / _longs; lng = 2.0f * M_PI * float(jjj) / _longs;
x = cos(lng)*_radius; x = cos(lng)*_radius;
y = sin(lng)*_radius; y = sin(lng)*_radius;
vec3 v3 = vec3(x, y, z); Vector3f v3 = Vector3f(x, y, z);
vec3 v3b = vec3(x, y, -z); Vector3f v3b = Vector3f(x, y, -z);
tmpVertices.pushBack(v2); tmpVertices.pushBack(v2);
tmpVertices.pushBack(v3); tmpVertices.pushBack(v3);
@ -333,16 +333,16 @@ void ewol::resource::Colored3DObject::drawCylinder(float _radius,
float lng = 2.0f * M_PI * float(jjj - 1) / _longs; float lng = 2.0f * M_PI * float(jjj - 1) / _longs;
float z = _size*-0.5f; float z = _size*-0.5f;
vec3 v1 = vec3(0.0f, 0.0f, z); Vector3f v1 = Vector3f(0.0f, 0.0f, z);
float x = cos(lng)*_radius; float x = cos(lng)*_radius;
float y = sin(lng)*_radius; float y = sin(lng)*_radius;
vec3 v2 = vec3(x, y, z); Vector3f v2 = Vector3f(x, y, z);
lng = 2.0f * M_PI * float(jjj) / _longs; lng = 2.0f * M_PI * float(jjj) / _longs;
x = cos(lng)*_radius; x = cos(lng)*_radius;
y = sin(lng)*_radius; y = sin(lng)*_radius;
vec3 v3 = vec3(x, y, z); Vector3f v3 = Vector3f(x, y, z);
tmpVertices.pushBack(v1); tmpVertices.pushBack(v1);
tmpVertices.pushBack(v2); tmpVertices.pushBack(v2);
tmpVertices.pushBack(v3); tmpVertices.pushBack(v3);
@ -355,7 +355,7 @@ void ewol::resource::Colored3DObject::drawCapsule(float _radius,
int _longs, int _longs,
mat4& _transformationMatrix, mat4& _transformationMatrix,
const etk::Color<float>& _tmpColor) { const etk::Color<float>& _tmpColor) {
etk::Vector<vec3> tmpVertices; List<Vector3f> tmpVertices;
_lats = int32_t(_lats / 2)*2; _lats = int32_t(_lats / 2)*2;
// center to border (TOP) // center to border (TOP)
@ -373,14 +373,14 @@ void ewol::resource::Colored3DObject::drawCapsule(float _radius,
float lng = 2.0f * M_PI * float(jjj - 1) / _longs; float lng = 2.0f * M_PI * float(jjj - 1) / _longs;
float x = cos(lng); float x = cos(lng);
float y = sin(lng); float y = sin(lng);
vec3 v1 = vec3(x * zr1, y * zr1, z1+offset); Vector3f v1 = Vector3f(x * zr1, y * zr1, z1+offset);
vec3 v4 = vec3(x * zr0, y * zr0, z0+offset); Vector3f v4 = Vector3f(x * zr0, y * zr0, z0+offset);
lng = 2 * M_PI * float(jjj) / _longs; lng = 2 * M_PI * float(jjj) / _longs;
x = cos(lng); x = cos(lng);
y = sin(lng); y = sin(lng);
vec3 v2 = vec3(x * zr1, y * zr1, z1+offset); Vector3f v2 = Vector3f(x * zr1, y * zr1, z1+offset);
vec3 v3 = vec3(x * zr0, y * zr0, z0+offset); Vector3f v3 = Vector3f(x * zr0, y * zr0, z0+offset);
tmpVertices.pushBack(v1); tmpVertices.pushBack(v1);
tmpVertices.pushBack(v2); tmpVertices.pushBack(v2);
tmpVertices.pushBack(v3); tmpVertices.pushBack(v3);
@ -398,14 +398,14 @@ void ewol::resource::Colored3DObject::drawCapsule(float _radius,
float x = cos(lng)*_radius; float x = cos(lng)*_radius;
float y = sin(lng)*_radius; float y = sin(lng)*_radius;
vec3 v2 = vec3(x, y, z); Vector3f v2 = Vector3f(x, y, z);
vec3 v2b = vec3(x, y, -z); Vector3f v2b = Vector3f(x, y, -z);
lng = 2.0f * M_PI * float(jjj) / _longs; lng = 2.0f * M_PI * float(jjj) / _longs;
x = cos(lng)*_radius; x = cos(lng)*_radius;
y = sin(lng)*_radius; y = sin(lng)*_radius;
vec3 v3 = vec3(x, y, z); Vector3f v3 = Vector3f(x, y, z);
vec3 v3b = vec3(x, y, -z); Vector3f v3b = Vector3f(x, y, -z);
tmpVertices.pushBack(v2); tmpVertices.pushBack(v2);
tmpVertices.pushBack(v3); tmpVertices.pushBack(v3);
@ -430,14 +430,14 @@ void ewol::resource::Colored3DObject::drawCapsule(float _radius,
float lng = 2.0f * M_PI * float(jjj - 1) / _longs; float lng = 2.0f * M_PI * float(jjj - 1) / _longs;
float x = cos(lng); float x = cos(lng);
float y = sin(lng); float y = sin(lng);
vec3 v1 = vec3(x * zr1, y * zr1, z1+offset); Vector3f v1 = Vector3f(x * zr1, y * zr1, z1+offset);
vec3 v4 = vec3(x * zr0, y * zr0, z0+offset); Vector3f v4 = Vector3f(x * zr0, y * zr0, z0+offset);
lng = 2 * M_PI * float(jjj) / _longs; lng = 2 * M_PI * float(jjj) / _longs;
x = cos(lng); x = cos(lng);
y = sin(lng); y = sin(lng);
vec3 v2 = vec3(x * zr1, y * zr1, z1+offset); Vector3f v2 = Vector3f(x * zr1, y * zr1, z1+offset);
vec3 v3 = vec3(x * zr0, y * zr0, z0+offset); Vector3f v3 = Vector3f(x * zr0, y * zr0, z0+offset);
tmpVertices.pushBack(v1); tmpVertices.pushBack(v1);
tmpVertices.pushBack(v2); tmpVertices.pushBack(v2);
tmpVertices.pushBack(v3); tmpVertices.pushBack(v3);
@ -456,20 +456,20 @@ void ewol::resource::Colored3DObject::drawCone(float _radius,
int _longs, int _longs,
mat4& _transformationMatrix, mat4& _transformationMatrix,
const etk::Color<float>& _tmpColor) { const etk::Color<float>& _tmpColor) {
etk::Vector<vec3> tmpVertices; List<Vector3f> tmpVertices;
// center to border (TOP) // center to border (TOP)
for(int32_t jjj=0; jjj<_longs; ++jjj) { for(int32_t jjj=0; jjj<_longs; ++jjj) {
float lng = 2.0f * M_PI * float(jjj - 1) / _longs; float lng = 2.0f * M_PI * float(jjj - 1) / _longs;
vec3 v1 = vec3(0.0f, 0.0f, -_size/2); Vector3f v1 = Vector3f(0.0f, 0.0f, -_size/2);
float x = cos(lng)*_radius; float x = cos(lng)*_radius;
float y = sin(lng)*_radius; float y = sin(lng)*_radius;
vec3 v2 = vec3(x, y, _size/2); Vector3f v2 = Vector3f(x, y, _size/2);
lng = 2.0f * M_PI * float(jjj) / _longs; lng = 2.0f * M_PI * float(jjj) / _longs;
x = cos(lng)*_radius; x = cos(lng)*_radius;
y = sin(lng)*_radius; y = sin(lng)*_radius;
vec3 v3 = vec3(x, y, _size/2); Vector3f v3 = Vector3f(x, y, _size/2);
tmpVertices.pushBack(v1); tmpVertices.pushBack(v1);
tmpVertices.pushBack(v3); tmpVertices.pushBack(v3);
tmpVertices.pushBack(v2); tmpVertices.pushBack(v2);
@ -478,16 +478,16 @@ void ewol::resource::Colored3DObject::drawCone(float _radius,
for(int32_t jjj=0; jjj<_longs; ++jjj) { for(int32_t jjj=0; jjj<_longs; ++jjj) {
float lng = 2.0f * M_PI * float(jjj - 1) / _longs; float lng = 2.0f * M_PI * float(jjj - 1) / _longs;
vec3 v1 = vec3(0.0f, 0.0f, _size/2); Vector3f v1 = Vector3f(0.0f, 0.0f, _size/2);
float x = cos(lng)*_radius; float x = cos(lng)*_radius;
float y = sin(lng)*_radius; float y = sin(lng)*_radius;
vec3 v2 = vec3(x, y, _size/2); Vector3f v2 = Vector3f(x, y, _size/2);
lng = 2.0f * M_PI * float(jjj) / _longs; lng = 2.0f * M_PI * float(jjj) / _longs;
x = cos(lng)*_radius; x = cos(lng)*_radius;
y = sin(lng)*_radius; y = sin(lng)*_radius;
vec3 v3 = vec3(x, y, _size/2); Vector3f v3 = Vector3f(x, y, _size/2);
tmpVertices.pushBack(v1); tmpVertices.pushBack(v1);
tmpVertices.pushBack(v2); tmpVertices.pushBack(v2);
tmpVertices.pushBack(v3); tmpVertices.pushBack(v3);
@ -495,20 +495,20 @@ void ewol::resource::Colored3DObject::drawCone(float _radius,
draw(tmpVertices, _tmpColor, _transformationMatrix); draw(tmpVertices, _tmpColor, _transformationMatrix);
} }
void ewol::resource::Colored3DObject::drawTriangles(const etk::Vector<vec3>& _vertex, void ewol::resource::Colored3DObject::drawTriangles(const List<Vector3f>& _vertex,
const etk::Vector<uint32_t>& _indice, const List<uint32_t>& _indice,
mat4& _transformationMatrix, mat4& _transformationMatrix,
const etk::Color<float>& _tmpColor, const etk::Color<float>& _tmpColor,
const vec3& _offset) { const Vector3f& _offset) {
etk::Vector<vec3> tmpVertices; List<Vector3f> tmpVertices;
for (size_t iii=0; iii<_indice.size()/3; ++iii) { for (size_t iii=0; iii<_indice.size()/3; ++iii) {
tmpVertices.pushBack(_vertex[_indice[iii*3 + 0]]+_offset); tmpVertices.pushBack(_vertex[_indice[iii*3 + 0]]+_offset);
tmpVertices.pushBack(_vertex[_indice[iii*3 + 1]]+_offset); tmpVertices.pushBack(_vertex[_indice[iii*3 + 1]]+_offset);
tmpVertices.pushBack(_vertex[_indice[iii*3 + 2]]+_offset); tmpVertices.pushBack(_vertex[_indice[iii*3 + 2]]+_offset);
//EWOL_INFO(" indices " << _indice[iii*3 + 0] << " " << _indice[iii*3 + 1] << " " << _indice[iii*3 + 2]); //Log.info(" indices " << _indice[iii*3 + 0] << " " << _indice[iii*3 + 1] << " " << _indice[iii*3 + 2]);
//EWOL_INFO(" triangle " << _vertex[_indice[iii*3 + 0]] << " " << _vertex[_indice[iii*3 + 1]] << " " << _vertex[_indice[iii*3 + 2]]); //Log.info(" triangle " << _vertex[_indice[iii*3 + 0]] << " " << _vertex[_indice[iii*3 + 1]] << " " << _vertex[_indice[iii*3 + 2]]);
} }
//EWOL_INFO("display " << tmpVertices.size() << " vertices form " << _indice.size()); //Log.info("display " << tmpVertices.size() << " vertices form " << _indice.size());
draw(tmpVertices, _tmpColor, _transformationMatrix); draw(tmpVertices, _tmpColor, _transformationMatrix);
} }

View File

@ -30,28 +30,28 @@ namespace ewol {
DECLARE_RESOURCE_FACTORY(Colored3DObject); DECLARE_RESOURCE_FACTORY(Colored3DObject);
virtual ~Colored3DObject(); virtual ~Colored3DObject();
public: public:
virtual void draw(const etk::Vector<vec3>& _vertices, virtual void draw(const List<Vector3f>& _vertices,
const etk::Color<float>& _color, const etk::Color<float>& _color,
bool _updateDepthBuffer=true, bool _updateDepthBuffer=true,
bool _depthtest=true); bool _depthtest=true);
virtual void draw(const etk::Vector<vec3>& _vertices, virtual void draw(const List<Vector3f>& _vertices,
const etk::Color<float>& _color, const etk::Color<float>& _color,
mat4& _transformationMatrix, mat4& _transformationMatrix,
bool _updateDepthBuffer=true, bool _updateDepthBuffer=true,
bool _depthtest=true); bool _depthtest=true);
virtual void drawLine(etk::Vector<vec3>& _vertices, virtual void drawLine(List<Vector3f>& _vertices,
const etk::Color<float>& _color, const etk::Color<float>& _color,
mat4& _transformationMatrix, mat4& _transformationMatrix,
bool _updateDepthBuffer=true, bool _updateDepthBuffer=true,
bool _depthtest=true); bool _depthtest=true);
virtual void drawCubeLine(const vec3& _min, virtual void drawCubeLine(const Vector3f& _min,
const vec3& _max, const Vector3f& _max,
const etk::Color<float>& _color, const etk::Color<float>& _color,
mat4& _transformationMatrix, mat4& _transformationMatrix,
bool _updateDepthBuffer=true, bool _updateDepthBuffer=true,
bool _depthtest=true); bool _depthtest=true);
public: public:
void drawSquare(const vec3& _size, void drawSquare(const Vector3f& _size,
mat4& _transformationMatrix, mat4& _transformationMatrix,
const etk::Color<float>& _tmpColor); const etk::Color<float>& _tmpColor);
void drawSphere(float _radius, void drawSphere(float _radius,
@ -77,11 +77,11 @@ namespace ewol {
int _longs, int _longs,
mat4& _transformationMatrix, mat4& _transformationMatrix,
const etk::Color<float>& _tmpColor); const etk::Color<float>& _tmpColor);
void drawTriangles(const etk::Vector<vec3>& _vertex, void drawTriangles(const List<Vector3f>& _vertex,
const etk::Vector<uint32_t>& _indice, const List<uint32_t>& _indice,
mat4& _transformationMatrix, mat4& _transformationMatrix,
const etk::Color<float>& _tmpColor, const etk::Color<float>& _tmpColor,
const vec3& _offset=vec3(0,0,0.1)); const Vector3f& _offset=Vector3f(0,0,0.1));
}; };
}; };
}; };

View File

@ -24,7 +24,7 @@ ewol::resource::ConfigFile::ConfigFile() :
void ewol::resource::ConfigFile::init(const etk::Uri& _uri) { void ewol::resource::ConfigFile::init(const etk::Uri& _uri) {
ethread::RecursiveLock lock(m_mutex); ethread::RecursiveLock lock(m_mutex);
gale::Resource::init(_uri.get()); gale::Resource::init(_uri.get());
EWOL_DEBUG("SFP : load \"" << _uri << "\""); Log.debug("SFP : load \"" << _uri << "\"");
reload(); reload();
} }

View File

@ -43,8 +43,8 @@ ewol::resource::DistanceFieldFont::DistanceFieldFont() :
* // out contain: {"DATA:///font", "DATA:///font?lib=ewol"} * // out contain: {"DATA:///font", "DATA:///font?lib=ewol"}
* @example[stop] * @example[stop]
*/ */
static etk::Vector<etk::Uri> explodeMultiplePath(const etk::Uri& _uri) { static List<etk::Uri> explodeMultiplePath(const etk::Uri& _uri) {
etk::Vector<etk::Uri> out; List<etk::Uri> out;
out.pushBack(_uri); out.pushBack(_uri);
if (_uri.getQuery().exist("lib") == true) { if (_uri.getQuery().exist("lib") == true) {
etk::Uri tmp = _uri; etk::Uri tmp = _uri;
@ -58,7 +58,7 @@ void ewol::resource::DistanceFieldFont::init(const etk::String& _fontName) {
ethread::RecursiveLock lock(m_mutex); ethread::RecursiveLock lock(m_mutex);
ewol::resource::Texture::init(_fontName); ewol::resource::Texture::init(_fontName);
etk::String localName = _fontName; etk::String localName = _fontName;
etk::Vector<etk::Uri> folderList; List<etk::Uri> folderList;
if (ewol::getContext().getFontDefault().getUseExternal() == true) { if (ewol::getContext().getFontDefault().getUseExternal() == true) {
#if defined(__TARGET_OS__Android) #if defined(__TARGET_OS__Android)
folderList.pushBack(etk::Path("/system/fonts")); folderList.pushBack(etk::Path("/system/fonts"));
@ -71,52 +71,52 @@ void ewol::resource::DistanceFieldFont::init(const etk::String& _fontName) {
folderList.pushBack(it); folderList.pushBack(it);
} }
for (size_t folderID = 0; folderID < folderList.size() ; folderID++) { for (size_t folderID = 0; folderID < folderList.size() ; folderID++) {
etk::Vector<etk::Uri> output = etk::uri::listRecursive(folderList[folderID]); List<etk::Uri> output = etk::uri::listRecursive(folderList[folderID]);
etk::Vector<etk::String> split = etk::split(localName, ';'); List<etk::String> split = etk::split(localName, ';');
EWOL_INFO("try to find font named : " << split << " in: " << output); Log.info("try to find font named : " << split << " in: " << output);
//EWOL_CRITICAL("parse string : " << split); //Log.critical("parse string : " << split);
bool hasFindAFont = false; bool hasFindAFont = false;
for (size_t jjj=0; jjj<split.size(); jjj++) { for (size_t jjj=0; jjj<split.size(); jjj++) {
EWOL_INFO(" try with : '" << split[jjj] << "'"); Log.info(" try with : '" << split[jjj] << "'");
for (size_t iii=0; iii<output.size(); iii++) { for (size_t iii=0; iii<output.size(); iii++) {
etk::String nameFolder = output[iii].getPath().getString(); etk::String nameFolder = output[iii].getPath().getString();
//EWOL_DEBUG(" file : " << output[iii]); //Log.debug(" file : " << output[iii]);
if( true == etk::end_with(nameFolder, split[jjj]+"-"+"regular"+".ttf", false) if( true == etk::end_with(nameFolder, split[jjj]+"-"+"regular"+".ttf", false)
|| true == etk::end_with(nameFolder, split[jjj]+"-"+"r"+".ttf", false) || true == etk::end_with(nameFolder, split[jjj]+"-"+"r"+".ttf", false)
|| true == etk::end_with(nameFolder, split[jjj]+"regular"+".ttf", false) || true == etk::end_with(nameFolder, split[jjj]+"regular"+".ttf", false)
|| true == etk::end_with(nameFolder, split[jjj]+"r"+".ttf", false) || true == etk::end_with(nameFolder, split[jjj]+"r"+".ttf", false)
|| true == etk::end_with(nameFolder, split[jjj]+".ttf", false)) { || true == etk::end_with(nameFolder, split[jjj]+".ttf", false)) {
EWOL_INFO(" find Font [Regular] : " << output[iii]); Log.info(" find Font [Regular] : " << output[iii]);
m_fileName = output[iii]; m_fileName = output[iii];
hasFindAFont=true; hasFindAFont=true;
break; break;
} }
} }
if (hasFindAFont == true) { if (hasFindAFont == true) {
EWOL_INFO(" find this font : '" << split[jjj] << "'"); Log.info(" find this font : '" << split[jjj] << "'");
break; break;
} else if (jjj == split.size()-1) { } else if (jjj == split.size()-1) {
EWOL_ERROR("Find NO font in the LIST ... " << split); Log.error("Find NO font in the LIST ... " << split);
} }
} }
if (hasFindAFont == true) { if (hasFindAFont == true) {
EWOL_INFO(" find this font : '" << folderList[folderID] << "'"); Log.info(" find this font : '" << folderList[folderID] << "'");
break; break;
} else if (folderID == folderList.size()-1) { } else if (folderID == folderList.size()-1) {
EWOL_ERROR("Find NO font in the LIST ... " << folderList); Log.error("Find NO font in the LIST ... " << folderList);
} }
} }
if (m_fileName.isEmpty() == true) { if (m_fileName.isEmpty() == true) {
EWOL_ERROR("can not load FONT name : '" << _fontName << "'" ); Log.error("can not load FONT name : '" << _fontName << "'" );
m_font = null; m_font = null;
return; return;
} }
EWOL_INFO("Load FONT name : '" << m_fileName << "'"); Log.info("Load FONT name : '" << m_fileName << "'");
m_font = ewol::resource::FontFreeType::create(m_fileName); m_font = ewol::resource::FontFreeType::create(m_fileName);
if (m_font == null) { if (m_font == null) {
EWOL_ERROR("Pb Loading FONT name : '" << m_fileName << "'" ); Log.error("Pb Loading FONT name : '" << m_fileName << "'" );
} }
// set the bassic charset: // set the bassic charset:
@ -125,14 +125,14 @@ void ewol::resource::DistanceFieldFont::init(const etk::String& _fontName) {
return; return;
} }
if (importFromFile() == true) { if (importFromFile() == true) {
EWOL_INFO("GET distance field from previous file"); Log.info("GET distance field from previous file");
flush(); flush();
return; return;
} }
m_sizeRatio = ((float)SIZE_GENERATION) / ((float)m_font->getHeight(SIZE_GENERATION)); m_sizeRatio = ((float)SIZE_GENERATION) / ((float)m_font->getHeight(SIZE_GENERATION));
// TODO : basic font use 512 is better ... == > maybe estimate it with the dpi ??? // TODO : basic font use 512 is better ... == > maybe estimate it with the dpi ???
setImageSize(ivec2(512,32)); setImageSize(Vector2i(512,32));
// now we can acces directly on the image // now we can acces directly on the image
m_data.clear(etk::Color<>(0x00000000)); m_data.clear(etk::Color<>(0x00000000));
// add error glyph // add error glyph
@ -143,7 +143,7 @@ void ewol::resource::DistanceFieldFont::init(const etk::String& _fontName) {
} }
flush(); flush();
if (true) { if (true) {
EWOL_ERROR("Save in cache the loaded data ..... "); Log.error("Save in cache the loaded data ..... ");
egami::store(m_data, "CACHE:///fileFont.bmp"); // ==> for debug test only ... egami::store(m_data, "CACHE:///fileFont.bmp"); // ==> for debug test only ...
egami::store(m_data, "CACHE:///fileFont.png"); egami::store(m_data, "CACHE:///fileFont.png");
} }
@ -162,17 +162,17 @@ float ewol::resource::DistanceFieldFont::getDisplayRatio(float _size) {
void ewol::resource::DistanceFieldFont::generateDistanceField(const egami::ImageMono& _input, egami::Image& _output) { void ewol::resource::DistanceFieldFont::generateDistanceField(const egami::ImageMono& _input, egami::Image& _output) {
EWOL_INFO("Generate Distance field font [START]"); Log.info("Generate Distance field font [START]");
EWOL_INFO(" _input.getSize()=" << _input.getSize()); Log.info(" _input.getSize()=" << _input.getSize());
ethread::RecursiveLock lock(m_mutex); ethread::RecursiveLock lock(m_mutex);
int32_t size = _input.getSize().x() * _input.getSize().y(); int32_t size = _input.getSize().x() * _input.getSize().y();
etk::Vector<short> xdist; List<short> xdist;
etk::Vector<short> ydist; List<short> ydist;
etk::Vector<double> gx; List<double> gx;
etk::Vector<double> gy; List<double> gy;
etk::Vector<double> data; List<double> data;
etk::Vector<double> outside; List<double> outside;
etk::Vector<double> inside; List<double> inside;
xdist.resize(size, 0); xdist.resize(size, 0);
ydist.resize(size, 0); ydist.resize(size, 0);
gx.resize(size, 0.0); gx.resize(size, 0.0);
@ -180,13 +180,13 @@ void ewol::resource::DistanceFieldFont::generateDistanceField(const egami::Image
data.resize(size, 0.0); data.resize(size, 0.0);
outside.resize(size, 0.0); outside.resize(size, 0.0);
inside.resize(size, 0.0); inside.resize(size, 0.0);
EWOL_INFO(" size=" << size); Log.info(" size=" << size);
// Convert img into double (data) // Convert img into double (data)
double img_min = 255, img_max = -255; double img_min = 255, img_max = -255;
for (int32_t yyy = 0; yyy < _input.getSize().y(); ++yyy) { for (int32_t yyy = 0; yyy < _input.getSize().y(); ++yyy) {
for (int32_t xxx = 0; xxx < _input.getSize().x(); ++xxx) { for (int32_t xxx = 0; xxx < _input.getSize().x(); ++xxx) {
int32_t iii = yyy * _input.getSize().x() + xxx; int32_t iii = yyy * _input.getSize().x() + xxx;
double v = _input.get(ivec2(xxx, yyy)); double v = _input.get(Vector2i(xxx, yyy));
data[iii] = v; data[iii] = v;
if (v > img_max) { if (v > img_max) {
img_max = v; img_max = v;
@ -200,7 +200,7 @@ void ewol::resource::DistanceFieldFont::generateDistanceField(const egami::Image
for (int32_t yyy = 0; yyy < _input.getSize().y(); ++yyy) { for (int32_t yyy = 0; yyy < _input.getSize().y(); ++yyy) {
for (int32_t xxx = 0; xxx < _input.getSize().x(); ++xxx) { for (int32_t xxx = 0; xxx < _input.getSize().x(); ++xxx) {
int32_t iii = yyy * _input.getSize().x() + xxx; int32_t iii = yyy * _input.getSize().x() + xxx;
data[iii] = (_input.get(ivec2(xxx, yyy))-img_min)/img_max; data[iii] = (_input.get(Vector2i(xxx, yyy))-img_min)/img_max;
} }
} }
// Compute outside = edtaa3(bitmap); % Transform background (0's) // Compute outside = edtaa3(bitmap); % Transform background (0's)
@ -228,7 +228,7 @@ void ewol::resource::DistanceFieldFont::generateDistanceField(const egami::Image
inside[iii] = 0.0; inside[iii] = 0.0;
} }
} }
EWOL_INFO(" _output=" << _output); Log.info(" _output=" << _output);
_output.resize(_input.getSize(), etk::Color<>(0)); _output.resize(_input.getSize(), etk::Color<>(0));
_output.clear(etk::Color<>(0)); _output.clear(etk::Color<>(0));
for (int32_t xxx = 0; xxx < _output.getSize().x(); ++xxx) { for (int32_t xxx = 0; xxx < _output.getSize().x(); ++xxx) {
@ -244,10 +244,10 @@ void ewol::resource::DistanceFieldFont::generateDistanceField(const egami::Image
} }
uint8_t val = 255 - (unsigned char) outside[iii]; uint8_t val = 255 - (unsigned char) outside[iii];
// TODO : Remove multiple size of the map ... // TODO : Remove multiple size of the map ...
_output.set(ivec2(xxx, yyy), etk::Color<>((int32_t)val,(int32_t)val,(int32_t)val,255)); _output.set(Vector2i(xxx, yyy), etk::Color<>((int32_t)val,(int32_t)val,(int32_t)val,255));
} }
} }
EWOL_INFO(" _output=" << _output); Log.info(" _output=" << _output);
} }
bool ewol::resource::DistanceFieldFont::addGlyph(const char32_t& _val) { bool ewol::resource::DistanceFieldFont::addGlyph(const char32_t& _val) {
@ -260,30 +260,30 @@ bool ewol::resource::DistanceFieldFont::addGlyph(const char32_t& _val) {
GlyphProperty tmpchar; GlyphProperty tmpchar;
tmpchar.m_UVal = _val; tmpchar.m_UVal = _val;
egami::ImageMono imageGlyphRaw; egami::ImageMono imageGlyphRaw;
egami::Image imageGlyphDistanceField(ivec2(32,32), egami::colorType::RGBA8); egami::Image imageGlyphDistanceField(Vector2i(32,32), egami::colorType::RGBA8);
EWOL_DEBUG("Generate Glyph : " << _val); Log.debug("Generate Glyph : " << _val);
if (m_font->getGlyphProperty(SIZE_GENERATION, tmpchar) == true) { if (m_font->getGlyphProperty(SIZE_GENERATION, tmpchar) == true) {
//EWOL_DEBUG("load char: '" << _val << "'=" << _val); //Log.debug("load char: '" << _val << "'=" << _val);
hasChange = true; hasChange = true;
// change line if needed ... // change line if needed ...
if (m_lastGlyphPos.x() + tmpchar.m_sizeTexture.x()+m_borderSize*2.0 > m_data.getSize().x()) { if (m_lastGlyphPos.x() + tmpchar.m_sizeTexture.x()+m_borderSize*2.0 > m_data.getSize().x()) {
m_lastGlyphPos.setX(1); m_lastGlyphPos.setX(1);
m_lastGlyphPos += ivec2(0, m_lastRawHeigh); m_lastGlyphPos += Vector2i(0, m_lastRawHeigh);
m_lastRawHeigh = 0; m_lastRawHeigh = 0;
} }
while(m_lastGlyphPos.y()+tmpchar.m_sizeTexture.y()+m_borderSize*2.0 > m_data.getSize().y()) { while(m_lastGlyphPos.y()+tmpchar.m_sizeTexture.y()+m_borderSize*2.0 > m_data.getSize().y()) {
ivec2 size = m_data.getSize(); Vector2i size = m_data.getSize();
size.setY(size.y()*2); size.setY(size.y()*2);
EWOL_VERBOSE("resize " << m_data.getSize() << " => " << size); Log.verbose("resize " << m_data.getSize() << " => " << size);
m_data.resize(size, etk::Color<>(0)); m_data.resize(size, etk::Color<>(0));
// change the coordonate on the element in the texture // change the coordonate on the element in the texture
for (size_t jjj = 0; jjj < m_listElement.size(); ++jjj) { for (size_t jjj = 0; jjj < m_listElement.size(); ++jjj) {
m_listElement[jjj].m_texturePosStart *= vec2(1.0f, 0.5f); m_listElement[jjj].m_texturePosStart *= Vector2f(1.0f, 0.5f);
m_listElement[jjj].m_texturePosSize *= vec2(1.0f, 0.5f); m_listElement[jjj].m_texturePosSize *= Vector2f(1.0f, 0.5f);
} }
} }
m_textureBorderSize = vec2(m_borderSize/(float)m_data.getSize().x(), m_textureBorderSize = Vector2f(m_borderSize/(float)m_data.getSize().x(),
m_borderSize/(float)m_data.getSize().y() ); m_borderSize/(float)m_data.getSize().y() );
// draw the glyph // draw the glyph
m_font->drawGlyph(imageGlyphRaw, SIZE_GENERATION, tmpchar, m_borderSize); m_font->drawGlyph(imageGlyphRaw, SIZE_GENERATION, tmpchar, m_borderSize);
@ -291,10 +291,10 @@ bool ewol::resource::DistanceFieldFont::addGlyph(const char32_t& _val) {
generateDistanceField(imageGlyphRaw, imageGlyphDistanceField); generateDistanceField(imageGlyphRaw, imageGlyphDistanceField);
if (_val == 100) { if (_val == 100) {
EWOL_DEBUG("print char: " << _val << " size=" << imageGlyphDistanceField.getSize()); Log.debug("print char: " << _val << " size=" << imageGlyphDistanceField.getSize());
for (int32_t yyy = 0; yyy < imageGlyphDistanceField.getSize().y(); ++yyy) { for (int32_t yyy = 0; yyy < imageGlyphDistanceField.getSize().y(); ++yyy) {
for (int32_t xxx = 0; xxx < imageGlyphDistanceField.getSize().x(); ++xxx) { for (int32_t xxx = 0; xxx < imageGlyphDistanceField.getSize().x(); ++xxx) {
EWOL_PRINT((int)(imageGlyphDistanceField.get(ivec2(xxx, yyy)).r()) << " "); Log.print((int)(imageGlyphDistanceField.get(Vector2i(xxx, yyy)).r()) << " ");
} }
} }
} }
@ -314,7 +314,7 @@ bool ewol::resource::DistanceFieldFont::addGlyph(const char32_t& _val) {
} }
// note : +1 is for the overlapping of the glyph (Part 3) // note : +1 is for the overlapping of the glyph (Part 3)
// update the Bitmap position drawing : // update the Bitmap position drawing :
m_lastGlyphPos += ivec2(imageGlyphRaw.getSize().x()+1, 0); m_lastGlyphPos += Vector2i(imageGlyphRaw.getSize().x()+1, 0);
} else { } else {
EWOL_WARNING("Did not find char : '" << _val << "'=" << _val); EWOL_WARNING("Did not find char : '" << _val << "'=" << _val);
tmpchar.setNotExist(); tmpchar.setNotExist();
@ -328,7 +328,7 @@ bool ewol::resource::DistanceFieldFont::addGlyph(const char32_t& _val) {
} }
if (hasChange == true) { if (hasChange == true) {
flush(); flush();
//EWOL_ERROR("Save in cache the loaded data ..... "); //Log.error("Save in cache the loaded data ..... ");
//egami::store(m_data, "CACHE:///fileFont.bmp"); // ==> for debug test only ... //egami::store(m_data, "CACHE:///fileFont.bmp"); // ==> for debug test only ...
//egami::store(m_data, "CACHE:///fileFont.png"); //egami::store(m_data, "CACHE:///fileFont.png");
} }
@ -343,11 +343,11 @@ int32_t ewol::resource::DistanceFieldFont::getIndex(char32_t _charcode) {
return _charcode - 0x1F; return _charcode - 0x1F;
} else { } else {
for (size_t iii=0x80-0x20; iii < m_listElement.size(); iii++) { for (size_t iii=0x80-0x20; iii < m_listElement.size(); iii++) {
//EWOL_DEBUG("search : '" << charcode << "' =?= '" << (m_listElement[displayMode])[iii].m_UVal << "'"); //Log.debug("search : '" << charcode << "' =?= '" << (m_listElement[displayMode])[iii].m_UVal << "'");
if (_charcode == (m_listElement)[iii].m_UVal) { if (_charcode == (m_listElement)[iii].m_UVal) {
//EWOL_DEBUG("search : '" << charcode << "'"); //Log.debug("search : '" << charcode << "'");
if ((m_listElement)[iii].exist()) { if ((m_listElement)[iii].exist()) {
//EWOL_DEBUG("return " << iii); //Log.debug("return " << iii);
return iii; return iii;
} else { } else {
return 0; return 0;
@ -364,27 +364,27 @@ int32_t ewol::resource::DistanceFieldFont::getIndex(char32_t _charcode) {
ewol::GlyphProperty* ewol::resource::DistanceFieldFont::getGlyphPointer(const char32_t& _charcode) { ewol::GlyphProperty* ewol::resource::DistanceFieldFont::getGlyphPointer(const char32_t& _charcode) {
ethread::RecursiveLock lock(m_mutex); ethread::RecursiveLock lock(m_mutex);
EWOL_VERBOSE("getGlyphPointer : " << uint32_t(_charcode)); Log.verbose("getGlyphPointer : " << uint32_t(_charcode));
int32_t index = getIndex(_charcode); int32_t index = getIndex(_charcode);
if( index < 0 if( index < 0
|| (size_t)index >= m_listElement.size() ) { || (size_t)index >= m_listElement.size() ) {
EWOL_ERROR(" Try to get glyph index inexistant ... == > return the index 0 ... id=" << index); Log.error(" Try to get glyph index inexistant ... == > return the index 0 ... id=" << index);
if (m_listElement.size() > 0) { if (m_listElement.size() > 0) {
return &((m_listElement)[0]); return &((m_listElement)[0]);
} }
return null; return null;
} }
//EWOL_ERROR(" index=" << index); //Log.error(" index=" << index);
//EWOL_ERROR(" m_UVal=" << m_listElement[_displayMode][index].m_UVal); //Log.error(" m_UVal=" << m_listElement[_displayMode][index].m_UVal);
//EWOL_ERROR(" m_glyphIndex=" << m_listElement[_displayMode][index].m_glyphIndex); //Log.error(" m_glyphIndex=" << m_listElement[_displayMode][index].m_glyphIndex);
//EWOL_ERROR(" m_advance=" << m_listElement[_displayMode][index].m_advance); //Log.error(" m_advance=" << m_listElement[_displayMode][index].m_advance);
//EWOL_ERROR(" m_bearing=" << m_listElement[_displayMode][index].m_bearing); //Log.error(" m_bearing=" << m_listElement[_displayMode][index].m_bearing);
return &((m_listElement)[index]); return &((m_listElement)[index]);
} }
void ewol::resource::DistanceFieldFont::exportOnFile() { void ewol::resource::DistanceFieldFont::exportOnFile() {
ethread::RecursiveLock lock(m_mutex); ethread::RecursiveLock lock(m_mutex);
EWOL_DEBUG("EXPORT: DistanceFieldFont : file : '" << m_fileName << ".json'"); Log.debug("EXPORT: DistanceFieldFont : file : '" << m_fileName << ".json'");
ejson::Document doc; ejson::Document doc;
ejson::Array tmpList; ejson::Array tmpList;
for (size_t iii=0; iii<m_listElement.size(); ++iii) { for (size_t iii=0; iii<m_listElement.size(); ++iii) {
@ -423,11 +423,11 @@ bool ewol::resource::DistanceFieldFont::importFromFile() {
etk::Uri tmpUriBmp = m_fileName; etk::Uri tmpUriBmp = m_fileName;
tmpUriBmp.setScheme("CACHE"); tmpUriBmp.setScheme("CACHE");
tmpUriBmp.setPath(m_fileName.getPath() + ".png"); tmpUriBmp.setPath(m_fileName.getPath() + ".png");
EWOL_DEBUG("IMPORT: DistanceFieldFont : file : '" << tmpUriJson << "'"); Log.debug("IMPORT: DistanceFieldFont : file : '" << tmpUriJson << "'");
// test file existance: // test file existance:
if ( etk::uri::exist(tmpUriJson) == false if ( etk::uri::exist(tmpUriJson) == false
|| etk::uri::exist(tmpUriBmp) == false) { || etk::uri::exist(tmpUriBmp) == false) {
EWOL_DEBUG("Does not import file for distance field system"); Log.debug("Does not import file for distance field system");
return false; return false;
} }
ejson::Document doc; ejson::Document doc;
@ -446,7 +446,7 @@ bool ewol::resource::DistanceFieldFont::importFromFile() {
m_textureBorderSize = doc["m_textureBorderSize"].toString().get("0,0"); m_textureBorderSize = doc["m_textureBorderSize"].toString().get("0,0");
ejson::Array tmpList = doc["m_listElement"].toArray(); ejson::Array tmpList = doc["m_listElement"].toArray();
if (tmpList.exist() == false) { if (tmpList.exist() == false) {
EWOL_ERROR("null pointer array"); Log.error("null pointer array");
return false; return false;
} }
m_listElement.clear(); m_listElement.clear();

View File

@ -20,10 +20,10 @@ namespace ewol {
// == > Bold is a little more complicated (maybe with the bordersize) // == > Bold is a little more complicated (maybe with the bordersize)
ememory::SharedPtr<ewol::resource::FontBase> m_font; ememory::SharedPtr<ewol::resource::FontBase> m_font;
public: public:
etk::Vector<GlyphProperty> m_listElement; List<GlyphProperty> m_listElement;
private: private:
// for the texture generation : // for the texture generation :
ivec2 m_lastGlyphPos; Vector2i m_lastGlyphPos;
int32_t m_lastRawHeigh; int32_t m_lastRawHeigh;
protected: protected:
DistanceFieldFont(); DistanceFieldFont();
@ -80,12 +80,12 @@ namespace ewol {
void generateDistanceField(const egami::ImageMono& _input, egami::Image& _output); void generateDistanceField(const egami::ImageMono& _input, egami::Image& _output);
private: private:
float m_borderSize; //!< number of pixel added on the border of a glyph float m_borderSize; //!< number of pixel added on the border of a glyph
vec2 m_textureBorderSize; //!< Transformed the border size in the texture dimention Vector2f m_textureBorderSize; //!< Transformed the border size in the texture dimention
public: public:
float getPixelBorderSize() { float getPixelBorderSize() {
return m_borderSize; return m_borderSize;
} }
const vec2& getTextureBorderSize() { const Vector2f& getTextureBorderSize() {
return m_textureBorderSize; return m_textureBorderSize;
} }
public: public:

View File

@ -23,7 +23,7 @@ static int32_t l_countLoaded=0;
static FT_Library library; static FT_Library library;
void ewol::resource::freeTypeInit() { void ewol::resource::freeTypeInit() {
EWOL_DEBUG(" == > init Font-Manager"); Log.debug(" == > init Font-Manager");
l_countLoaded++; l_countLoaded++;
if (l_countLoaded>1) { if (l_countLoaded>1) {
// already loaded ... // already loaded ...
@ -31,12 +31,12 @@ void ewol::resource::freeTypeInit() {
} }
int32_t error = FT_Init_FreeType( &library ); int32_t error = FT_Init_FreeType( &library );
if(0 != error) { if(0 != error) {
EWOL_CRITICAL(" when loading FreeType Librairy ..."); Log.critical(" when loading FreeType Librairy ...");
} }
} }
void ewol::resource::freeTypeUnInit() { void ewol::resource::freeTypeUnInit() {
EWOL_DEBUG(" == > Un-Init Font-Manager"); Log.debug(" == > Un-Init Font-Manager");
l_countLoaded--; l_countLoaded--;
if (l_countLoaded>0) { if (l_countLoaded>0) {
// already needed ... // already needed ...
@ -45,7 +45,7 @@ void ewol::resource::freeTypeUnInit() {
int32_t error = FT_Done_FreeType( library ); int32_t error = FT_Done_FreeType( library );
library = null; library = null;
if(0 != error) { if(0 != error) {
EWOL_CRITICAL(" when Un-loading FreeType Librairy ..."); Log.critical(" when Un-loading FreeType Librairy ...");
} }
} }
@ -60,11 +60,11 @@ void ewol::resource::FontFreeType::init(const etk::Uri& _uri) {
ewol::resource::FontBase::init(_uri); ewol::resource::FontBase::init(_uri);
auto fileIO = etk::uri::get(_uri); auto fileIO = etk::uri::get(_uri);
if (fileIO == null) { if (fileIO == null) {
EWOL_ERROR("File Does not exist : " << _uri); Log.error("File Does not exist : " << _uri);
return; return;
} }
if (fileIO->open(etk::io::OpenMode::Read) == false) { if (fileIO->open(etk::io::OpenMode::Read) == false) {
EWOL_ERROR("Can not open the file : " << _uri); Log.error("Can not open the file : " << _uri);
return; return;
} }
m_FileBuffer = fileIO->readAll<FT_Byte>(); m_FileBuffer = fileIO->readAll<FT_Byte>();
@ -73,12 +73,12 @@ void ewol::resource::FontFreeType::init(const etk::Uri& _uri) {
// load Face ... // load Face ...
int32_t error = FT_New_Memory_Face(library, &m_FileBuffer[0], m_FileBuffer.size(), 0, &m_fftFace ); int32_t error = FT_New_Memory_Face(library, &m_FileBuffer[0], m_FileBuffer.size(), 0, &m_fftFace );
if( FT_Err_Unknown_File_Format == error) { if( FT_Err_Unknown_File_Format == error) {
EWOL_ERROR("... the font file could be opened and read, but it appears ... that its font format is unsupported"); Log.error("... the font file could be opened and read, but it appears ... that its font format is unsupported");
} else if (0 != error) { } else if (0 != error) {
EWOL_ERROR("... another error code means that the font file could not ... be opened or read, or simply that it is broken..."); Log.error("... another error code means that the font file could not ... be opened or read, or simply that it is broken...");
} else { } else {
// all OK // all OK
EWOL_DEBUG("load font : \"" << _uri << "\" glyph count = " << (int)m_fftFace->num_glyphs); Log.debug("load font : \"" << _uri << "\" glyph count = " << (int)m_fftFace->num_glyphs);
m_init = true; m_init = true;
//display(); //display();
} }
@ -92,13 +92,13 @@ ewol::resource::FontFreeType::~FontFreeType() {
FT_Done_Face(m_fftFace); FT_Done_Face(m_fftFace);
} }
vec2 ewol::resource::FontFreeType::getSize(int32_t _fontSize, const etk::String& _unicodeString) { Vector2f ewol::resource::FontFreeType::getSize(int32_t _fontSize, const etk::String& _unicodeString) {
ethread::RecursiveLock lock(m_mutex); ethread::RecursiveLock lock(m_mutex);
if (m_init == false) { if (m_init == false) {
return vec2(0,0); return Vector2f(0,0);
} }
// TODO : ... // TODO : ...
vec2 outputSize(0,0); Vector2f outputSize(0,0);
return outputSize; return outputSize;
} }
@ -122,7 +122,7 @@ bool ewol::resource::FontFreeType::getGlyphProperty(int32_t _fontSize, ewol::Gly
// note tha <<6 == *64 corespond with the 1/64th of points calculation of freetype // note tha <<6 == *64 corespond with the 1/64th of points calculation of freetype
int32_t error = FT_Set_Char_Size(m_fftFace, _fontSize<<6, _fontSize<<6, fontQuality, fontQuality); int32_t error = FT_Set_Char_Size(m_fftFace, _fontSize<<6, _fontSize<<6, fontQuality, fontQuality);
if (0!=error ) { if (0!=error ) {
EWOL_ERROR("FT_Set_Char_Size == > error in settings ..."); Log.error("FT_Set_Char_Size == > error in settings ...");
return false; return false;
} }
// a small shortcut // a small shortcut
@ -134,13 +134,13 @@ bool ewol::resource::FontFreeType::getGlyphProperty(int32_t _fontSize, ewol::Gly
glyph_index, // glyph index glyph_index, // glyph index
FT_LOAD_DEFAULT ); FT_LOAD_DEFAULT );
if (0!=error ) { if (0!=error ) {
EWOL_ERROR("FT_Load_Glyph specify Glyph"); Log.error("FT_Load_Glyph specify Glyph");
return false; return false;
} }
// convert to an anti-aliased bitmap // convert to an anti-aliased bitmap
error = FT_Render_Glyph(slot, FT_RENDER_MODE_NORMAL ); error = FT_Render_Glyph(slot, FT_RENDER_MODE_NORMAL );
if (0!=error) { if (0!=error) {
EWOL_ERROR("FT_Render_Glyph"); Log.error("FT_Render_Glyph");
return false; return false;
} }
// set properties : // set properties :
@ -154,7 +154,7 @@ bool ewol::resource::FontFreeType::getGlyphProperty(int32_t _fontSize, ewol::Gly
bool ewol::resource::FontFreeType::drawGlyph(egami::Image& _imageOut, bool ewol::resource::FontFreeType::drawGlyph(egami::Image& _imageOut,
int32_t _fontSize, int32_t _fontSize,
ivec2 _glyphPosition, Vector2i _glyphPosition,
ewol::GlyphProperty& _property, ewol::GlyphProperty& _property,
int8_t _posInImage) { int8_t _posInImage) {
ethread::RecursiveLock lock(m_mutex); ethread::RecursiveLock lock(m_mutex);
@ -167,7 +167,7 @@ bool ewol::resource::FontFreeType::drawGlyph(egami::Image& _imageOut,
// note tha <<6 == *64 corespond with the 1/64th of points calculation of freetype // note tha <<6 == *64 corespond with the 1/64th of points calculation of freetype
int32_t error = FT_Set_Char_Size(m_fftFace, _fontSize<<6, _fontSize<<6, fontQuality, fontQuality); int32_t error = FT_Set_Char_Size(m_fftFace, _fontSize<<6, _fontSize<<6, fontQuality, fontQuality);
if (0!=error ) { if (0!=error ) {
EWOL_ERROR("FT_Set_Char_Size == > error in settings ..."); Log.error("FT_Set_Char_Size == > error in settings ...");
return false; return false;
} }
// a small shortcut // a small shortcut
@ -177,20 +177,20 @@ bool ewol::resource::FontFreeType::drawGlyph(egami::Image& _imageOut,
_property.m_glyphIndex, // glyph index _property.m_glyphIndex, // glyph index
FT_LOAD_DEFAULT ); FT_LOAD_DEFAULT );
if (0!=error ) { if (0!=error ) {
EWOL_ERROR("FT_Load_Glyph specify Glyph"); Log.error("FT_Load_Glyph specify Glyph");
return false; return false;
} }
// convert to an anti-aliased bitmap // convert to an anti-aliased bitmap
error = FT_Render_Glyph(slot, FT_RENDER_MODE_NORMAL ); error = FT_Render_Glyph(slot, FT_RENDER_MODE_NORMAL );
if (0!=error) { if (0!=error) {
EWOL_ERROR("FT_Render_Glyph"); Log.error("FT_Render_Glyph");
return false; return false;
} }
// draw it on the output Image : // draw it on the output Image :
etk::Color<> tlpppp(0xFF, 0xFF, 0xFF, 0x00); etk::Color<> tlpppp(0xFF, 0xFF, 0xFF, 0x00);
for(size_t jjj=0; jjj < slot->bitmap.rows;jjj++) { for(size_t jjj=0; jjj < slot->bitmap.rows;jjj++) {
for(size_t iii=0; iii < slot->bitmap.width; iii++){ for(size_t iii=0; iii < slot->bitmap.width; iii++){
tlpppp = _imageOut.get(ivec2(_glyphPosition.x()+iii, _glyphPosition.y()+jjj)); tlpppp = _imageOut.get(Vector2i(_glyphPosition.x()+iii, _glyphPosition.y()+jjj));
uint8_t valueColor = slot->bitmap.buffer[iii + slot->bitmap.width*jjj]; uint8_t valueColor = slot->bitmap.buffer[iii + slot->bitmap.width*jjj];
// set only alpha : // set only alpha :
switch(_posInImage) { switch(_posInImage) {
@ -209,7 +209,7 @@ bool ewol::resource::FontFreeType::drawGlyph(egami::Image& _imageOut,
break; break;
} }
// real set of color // real set of color
_imageOut.set(ivec2(_glyphPosition.x()+iii, _glyphPosition.y()+jjj), tlpppp ); _imageOut.set(Vector2i(_glyphPosition.x()+iii, _glyphPosition.y()+jjj), tlpppp );
} }
} }
return true; return true;
@ -229,7 +229,7 @@ bool ewol::resource::FontFreeType::drawGlyph(egami::ImageMono& _imageOut,
// note tha <<6 == *64 corespond with the 1/64th of points calculation of freetype // note tha <<6 == *64 corespond with the 1/64th of points calculation of freetype
int32_t error = FT_Set_Char_Size(m_fftFace, _fontSize<<6, _fontSize<<6, fontQuality, fontQuality); int32_t error = FT_Set_Char_Size(m_fftFace, _fontSize<<6, _fontSize<<6, fontQuality, fontQuality);
if (0!=error ) { if (0!=error ) {
EWOL_ERROR("FT_Set_Char_Size == > error in settings ..."); Log.error("FT_Set_Char_Size == > error in settings ...");
return false; return false;
} }
// a small shortcut // a small shortcut
@ -239,36 +239,36 @@ bool ewol::resource::FontFreeType::drawGlyph(egami::ImageMono& _imageOut,
_property.m_glyphIndex, // glyph index _property.m_glyphIndex, // glyph index
FT_LOAD_DEFAULT ); FT_LOAD_DEFAULT );
if (0!=error ) { if (0!=error ) {
EWOL_ERROR("FT_Load_Glyph specify Glyph"); Log.error("FT_Load_Glyph specify Glyph");
return false; return false;
} }
// convert to an anti-aliased bitmap // convert to an anti-aliased bitmap
error = FT_Render_Glyph(slot, FT_RENDER_MODE_NORMAL ); // TODO : set FT_RENDER_MODE_MONO ==> 1 bit value ==> faster generation ... error = FT_Render_Glyph(slot, FT_RENDER_MODE_NORMAL ); // TODO : set FT_RENDER_MODE_MONO ==> 1 bit value ==> faster generation ...
if (0!=error) { if (0!=error) {
EWOL_ERROR("FT_Render_Glyph"); Log.error("FT_Render_Glyph");
return false; return false;
} }
// resize output image : // resize output image :
_imageOut.resize(ivec2(slot->bitmap.width+2*_borderSize, slot->bitmap.rows+2*_borderSize), 0); _imageOut.resize(Vector2i(slot->bitmap.width+2*_borderSize, slot->bitmap.rows+2*_borderSize), 0);
for(size_t jjj=0; jjj < slot->bitmap.rows;jjj++) { for(size_t jjj=0; jjj < slot->bitmap.rows;jjj++) {
for(size_t iii=0; iii < slot->bitmap.width; iii++){ for(size_t iii=0; iii < slot->bitmap.width; iii++){
uint8_t valueColor = slot->bitmap.buffer[iii + slot->bitmap.width*jjj]; uint8_t valueColor = slot->bitmap.buffer[iii + slot->bitmap.width*jjj];
// real set of color // real set of color
_imageOut.set(ivec2(_borderSize+iii, _borderSize+jjj), valueColor ); _imageOut.set(Vector2i(_borderSize+iii, _borderSize+jjj), valueColor );
} }
} }
return true; return true;
} }
void ewol::resource::FontFreeType::generateKerning(int32_t fontSize, etk::Vector<ewol::GlyphProperty>& listGlyph) { void ewol::resource::FontFreeType::generateKerning(int32_t fontSize, List<ewol::GlyphProperty>& listGlyph) {
ethread::RecursiveLock lock(m_mutex); ethread::RecursiveLock lock(m_mutex);
if(m_init == false) { if(m_init == false) {
return; return;
} }
if ((FT_FACE_FLAG_KERNING & m_fftFace->face_flags) == 0) { if ((FT_FACE_FLAG_KERNING & m_fftFace->face_flags) == 0) {
EWOL_INFO("No kerning generation (disable) in the font"); Log.info("No kerning generation (disable) in the font");
} }
// 300dpi (hight quality) 96 dpi (normal quality) // 300dpi (hight quality) 96 dpi (normal quality)
int32_t fontQuality = 96; int32_t fontQuality = 96;
@ -276,7 +276,7 @@ void ewol::resource::FontFreeType::generateKerning(int32_t fontSize, etk::Vector
// note tha <<6 == *64 corespond with the 1/64th of points calculation of freetype // note tha <<6 == *64 corespond with the 1/64th of points calculation of freetype
int32_t error = FT_Set_Char_Size(m_fftFace, fontSize<<6, fontSize<<6, fontQuality, fontQuality); int32_t error = FT_Set_Char_Size(m_fftFace, fontSize<<6, fontSize<<6, fontQuality, fontQuality);
if (0!=error ) { if (0!=error ) {
EWOL_ERROR("FT_Set_Char_Size == > error in settings ..."); Log.error("FT_Set_Char_Size == > error in settings ...");
return; return;
} }
// For all the kerning element we get the kerning value : // For all the kerning element we get the kerning value :
@ -289,7 +289,7 @@ void ewol::resource::FontFreeType::generateKerning(int32_t fontSize, etk::Vector
if (kerning.x != 0) { if (kerning.x != 0) {
listGlyph[iii].kerningAdd(listGlyph[kkk].m_UVal, listGlyph[iii].kerningAdd(listGlyph[kkk].m_UVal,
kerning.x/32.0f ); kerning.x/32.0f );
//EWOL_DEBUG("Kerning between : '" << (char)listGlyph[iii].m_UVal << "'&'" << (char)listGlyph[kkk].m_UVal << "' value : " << kerning.x << " => " << (kerning.x/64.0f)); //Log.debug("Kerning between : '" << (char)listGlyph[iii].m_UVal << "'&'" << (char)listGlyph[kkk].m_UVal << "' value : " << kerning.x << " => " << (kerning.x/64.0f));
} }
} }
} }
@ -301,84 +301,84 @@ void ewol::resource::FontFreeType::display() {
if(m_init == false) { if(m_init == false) {
return; return;
} }
EWOL_INFO(" number of glyph = " << (int)m_fftFace->num_glyphs); Log.info(" number of glyph = " << (int)m_fftFace->num_glyphs);
if ((FT_FACE_FLAG_SCALABLE & m_fftFace->face_flags) != 0) { if ((FT_FACE_FLAG_SCALABLE & m_fftFace->face_flags) != 0) {
EWOL_INFO(" flags = FT_FACE_FLAG_SCALABLE (enable)"); Log.info(" flags = FT_FACE_FLAG_SCALABLE (enable)");
} else { } else {
EWOL_DEBUG(" flags = FT_FACE_FLAG_SCALABLE (disable)"); Log.debug(" flags = FT_FACE_FLAG_SCALABLE (disable)");
} }
if ((FT_FACE_FLAG_FIXED_SIZES & m_fftFace->face_flags) != 0) { if ((FT_FACE_FLAG_FIXED_SIZES & m_fftFace->face_flags) != 0) {
EWOL_INFO(" flags = FT_FACE_FLAG_FIXED_SIZES (enable)"); Log.info(" flags = FT_FACE_FLAG_FIXED_SIZES (enable)");
} else { } else {
EWOL_DEBUG(" flags = FT_FACE_FLAG_FIXED_SIZES (disable)"); Log.debug(" flags = FT_FACE_FLAG_FIXED_SIZES (disable)");
} }
if ((FT_FACE_FLAG_FIXED_WIDTH & m_fftFace->face_flags) != 0) { if ((FT_FACE_FLAG_FIXED_WIDTH & m_fftFace->face_flags) != 0) {
EWOL_INFO(" flags = FT_FACE_FLAG_FIXED_WIDTH (enable)"); Log.info(" flags = FT_FACE_FLAG_FIXED_WIDTH (enable)");
} else { } else {
EWOL_DEBUG(" flags = FT_FACE_FLAG_FIXED_WIDTH (disable)"); Log.debug(" flags = FT_FACE_FLAG_FIXED_WIDTH (disable)");
} }
if ((FT_FACE_FLAG_SFNT & m_fftFace->face_flags) != 0) { if ((FT_FACE_FLAG_SFNT & m_fftFace->face_flags) != 0) {
EWOL_INFO(" flags = FT_FACE_FLAG_SFNT (enable)"); Log.info(" flags = FT_FACE_FLAG_SFNT (enable)");
} else { } else {
EWOL_DEBUG(" flags = FT_FACE_FLAG_SFNT (disable)"); Log.debug(" flags = FT_FACE_FLAG_SFNT (disable)");
} }
if ((FT_FACE_FLAG_HORIZONTAL & m_fftFace->face_flags) != 0) { if ((FT_FACE_FLAG_HORIZONTAL & m_fftFace->face_flags) != 0) {
EWOL_INFO(" flags = FT_FACE_FLAG_HORIZONTAL (enable)"); Log.info(" flags = FT_FACE_FLAG_HORIZONTAL (enable)");
} else { } else {
EWOL_DEBUG(" flags = FT_FACE_FLAG_HORIZONTAL (disable)"); Log.debug(" flags = FT_FACE_FLAG_HORIZONTAL (disable)");
} }
if ((FT_FACE_FLAG_VERTICAL & m_fftFace->face_flags) != 0) { if ((FT_FACE_FLAG_VERTICAL & m_fftFace->face_flags) != 0) {
EWOL_INFO(" flags = FT_FACE_FLAG_VERTICAL (enable)"); Log.info(" flags = FT_FACE_FLAG_VERTICAL (enable)");
} else { } else {
EWOL_DEBUG(" flags = FT_FACE_FLAG_VERTICAL (disable)"); Log.debug(" flags = FT_FACE_FLAG_VERTICAL (disable)");
} }
if ((FT_FACE_FLAG_KERNING & m_fftFace->face_flags) != 0) { if ((FT_FACE_FLAG_KERNING & m_fftFace->face_flags) != 0) {
EWOL_INFO(" flags = FT_FACE_FLAG_KERNING (enable)"); Log.info(" flags = FT_FACE_FLAG_KERNING (enable)");
} else { } else {
EWOL_DEBUG(" flags = FT_FACE_FLAG_KERNING (disable)"); Log.debug(" flags = FT_FACE_FLAG_KERNING (disable)");
} }
/* Deprecated flag /* Deprecated flag
if ((FT_FACE_FLAG_FAST_GLYPHS & face->face_flags) != 0) { if ((FT_FACE_FLAG_FAST_GLYPHS & face->face_flags) != 0) {
EWOL_INFO(" flags = FT_FACE_FLAG_FAST_GLYPHS (enable)"); Log.info(" flags = FT_FACE_FLAG_FAST_GLYPHS (enable)");
} else { } else {
EWOL_DEBUG(" flags = FT_FACE_FLAG_FAST_GLYPHS (disable)"); Log.debug(" flags = FT_FACE_FLAG_FAST_GLYPHS (disable)");
} }
*/ */
if ((FT_FACE_FLAG_MULTIPLE_MASTERS & m_fftFace->face_flags) != 0) { if ((FT_FACE_FLAG_MULTIPLE_MASTERS & m_fftFace->face_flags) != 0) {
EWOL_INFO(" flags = FT_FACE_FLAG_MULTIPLE_MASTERS (enable)"); Log.info(" flags = FT_FACE_FLAG_MULTIPLE_MASTERS (enable)");
} else { } else {
EWOL_DEBUG(" flags = FT_FACE_FLAG_MULTIPLE_MASTERS (disable)"); Log.debug(" flags = FT_FACE_FLAG_MULTIPLE_MASTERS (disable)");
} }
if ((FT_FACE_FLAG_GLYPH_NAMES & m_fftFace->face_flags) != 0) { if ((FT_FACE_FLAG_GLYPH_NAMES & m_fftFace->face_flags) != 0) {
EWOL_INFO(" flags = FT_FACE_FLAG_GLYPH_NAMES (enable)"); Log.info(" flags = FT_FACE_FLAG_GLYPH_NAMES (enable)");
} else { } else {
EWOL_DEBUG(" flags = FT_FACE_FLAG_GLYPH_NAMES (disable)"); Log.debug(" flags = FT_FACE_FLAG_GLYPH_NAMES (disable)");
} }
if ((FT_FACE_FLAG_EXTERNAL_STREAM & m_fftFace->face_flags) != 0) { if ((FT_FACE_FLAG_EXTERNAL_STREAM & m_fftFace->face_flags) != 0) {
EWOL_INFO(" flags = FT_FACE_FLAG_EXTERNAL_STREAM (enable)"); Log.info(" flags = FT_FACE_FLAG_EXTERNAL_STREAM (enable)");
} else { } else {
EWOL_DEBUG(" flags = FT_FACE_FLAG_EXTERNAL_STREAM (disable)"); Log.debug(" flags = FT_FACE_FLAG_EXTERNAL_STREAM (disable)");
} }
if ((FT_FACE_FLAG_HINTER & m_fftFace->face_flags) != 0) { if ((FT_FACE_FLAG_HINTER & m_fftFace->face_flags) != 0) {
EWOL_INFO(" flags = FT_FACE_FLAG_HINTER (enable)"); Log.info(" flags = FT_FACE_FLAG_HINTER (enable)");
} else { } else {
EWOL_DEBUG(" flags = FT_FACE_FLAG_HINTER (disable)"); Log.debug(" flags = FT_FACE_FLAG_HINTER (disable)");
} }
if ((FT_FACE_FLAG_CID_KEYED & m_fftFace->face_flags) != 0) { if ((FT_FACE_FLAG_CID_KEYED & m_fftFace->face_flags) != 0) {
EWOL_INFO(" flags = FT_FACE_FLAG_CID_KEYED (enable)"); Log.info(" flags = FT_FACE_FLAG_CID_KEYED (enable)");
} else { } else {
EWOL_DEBUG(" flags = FT_FACE_FLAG_CID_KEYED (disable)"); Log.debug(" flags = FT_FACE_FLAG_CID_KEYED (disable)");
} }
/* /*
if ((FT_FACE_FLAG_TRICKY & m_fftFace->face_flags) != 0) { if ((FT_FACE_FLAG_TRICKY & m_fftFace->face_flags) != 0) {
EWOL_INFO(" flags = FT_FACE_FLAG_TRICKY (enable)"); Log.info(" flags = FT_FACE_FLAG_TRICKY (enable)");
} else { } else {
EWOL_DEBUG(" flags = FT_FACE_FLAG_TRICKY (disable)"); Log.debug(" flags = FT_FACE_FLAG_TRICKY (disable)");
} }
*/ */
EWOL_INFO(" unit per EM = " << m_fftFace->units_per_EM); Log.info(" unit per EM = " << m_fftFace->units_per_EM);
EWOL_INFO(" num of fixed sizes = " << m_fftFace->num_fixed_sizes); Log.info(" num of fixed sizes = " << m_fftFace->num_fixed_sizes);
//EWOL_INFO(" Availlable sizes = " << (int)m_fftFace->available_sizes); //Log.info(" Availlable sizes = " << (int)m_fftFace->available_sizes);
//EWOL_INFO(" Current size = " << (int)m_fftFace->size); //Log.info(" Current size = " << (int)m_fftFace->size);
} }

View File

@ -20,7 +20,7 @@ namespace ewol {
// show : http://www.freetype.org/freetype2/docs/tutorial/step2.html // show : http://www.freetype.org/freetype2/docs/tutorial/step2.html
class FontFreeType : public ewol::resource::FontBase { class FontFreeType : public ewol::resource::FontBase {
private: private:
etk::Vector<FT_Byte> m_FileBuffer; List<FT_Byte> m_FileBuffer;
int32_t m_FileSize; int32_t m_FileSize;
FT_Face m_fftFace; FT_Face m_fftFace;
bool m_init; bool m_init;
@ -38,7 +38,7 @@ namespace ewol {
bool drawGlyph(egami::Image& _imageOut, bool drawGlyph(egami::Image& _imageOut,
int32_t _fontSize, int32_t _fontSize,
ivec2 _glyphPosition, Vector2i _glyphPosition,
ewol::GlyphProperty& _property, ewol::GlyphProperty& _property,
int8_t _posInImage); int8_t _posInImage);
@ -47,12 +47,12 @@ namespace ewol {
ewol::GlyphProperty& _property, ewol::GlyphProperty& _property,
int32_t _borderSize = 0); int32_t _borderSize = 0);
vec2 getSize(int32_t _fontSize, const etk::String& _unicodeString); Vector2f getSize(int32_t _fontSize, const etk::String& _unicodeString);
int32_t getHeight(int32_t _fontSize); int32_t getHeight(int32_t _fontSize);
float getSizeWithHeight(float _fontHeight); float getSizeWithHeight(float _fontHeight);
void generateKerning(int32_t _fontSize, etk::Vector<ewol::GlyphProperty>& _listGlyph); void generateKerning(int32_t _fontSize, List<ewol::GlyphProperty>& _listGlyph);
}; };
void freeTypeInit(); void freeTypeInit();
void freeTypeUnInit(); void freeTypeUnInit();

View File

@ -25,16 +25,16 @@ void ewol::resource::ImageDF::init() {
ewol::resource::Texture::init(); ewol::resource::Texture::init();
} }
void ewol::resource::ImageDF::init(etk::String _genName, const etk::Uri& _uri, const ivec2& _size) { void ewol::resource::ImageDF::init(etk::String _genName, const etk::Uri& _uri, const Vector2i& _size) {
ethread::RecursiveLock lock(m_mutex); ethread::RecursiveLock lock(m_mutex);
ewol::resource::Texture::init(_genName); ewol::resource::Texture::init(_genName);
EWOL_DEBUG("create a new resource::Image : _genName=" << _genName << " _uri=" << _uri << " size=" << _size); Log.debug("create a new resource::Image : _genName=" << _genName << " _uri=" << _uri << " size=" << _size);
m_data = egami::load(_uri, _size); m_data = egami::load(_uri, _size);
if (m_data.exist() == false) { if (m_data.exist() == false) {
EWOL_ERROR("ERROR when loading the image : " << _uri); Log.error("ERROR when loading the image : " << _uri);
} }
ivec2 tmp = m_data.getSize(); Vector2i tmp = m_data.getSize();
m_realImageSize = vec2(tmp.x(), tmp.y()); m_realImageSize = Vector2f(tmp.x(), tmp.y());
// distance field Generation // distance field Generation
// TODO : if it is not a .edf ==> generate dynamicly ... // TODO : if it is not a .edf ==> generate dynamicly ...
/* /*
@ -42,7 +42,7 @@ void ewol::resource::ImageDF::init(etk::String _genName, const etk::Uri& _uri, c
input.resize(tmp); input.resize(tmp);
for (size_t yyy = 0; yyy < tmp.y(); ++yyy) { for (size_t yyy = 0; yyy < tmp.y(); ++yyy) {
for (size_t xxx = 0; xxx < tmp.x(); ++xxx) { for (size_t xxx = 0; xxx < tmp.x(); ++xxx) {
input.set(ivec2(xxx, yyy), m_data.get(ivec2(xxx, yyy)).a() ); input.set(Vector2i(xxx, yyy), m_data.get(Vector2i(xxx, yyy)).a() );
} }
} }
generateDistanceField(input, m_data); generateDistanceField(input, m_data);
@ -54,13 +54,13 @@ void ewol::resource::ImageDF::init(etk::String _genName, const etk::Uri& _uri, c
void ewol::resource::ImageDF::generateDistanceField(const egami::ImageMono& _input, egami::Image& _output) { void ewol::resource::ImageDF::generateDistanceField(const egami::ImageMono& _input, egami::Image& _output) {
ethread::RecursiveLock lock(m_mutex); ethread::RecursiveLock lock(m_mutex);
int32_t size = _input.getSize().x() * _input.getSize().y(); int32_t size = _input.getSize().x() * _input.getSize().y();
etk::Vector<short> xdist; List<short> xdist;
etk::Vector<short> ydist; List<short> ydist;
etk::Vector<double> gx; List<double> gx;
etk::Vector<double> gy; List<double> gy;
etk::Vector<double> data; List<double> data;
etk::Vector<double> outside; List<double> outside;
etk::Vector<double> inside; List<double> inside;
xdist.resize(size, 0); xdist.resize(size, 0);
ydist.resize(size, 0); ydist.resize(size, 0);
gx.resize(size, 0.0); gx.resize(size, 0.0);
@ -73,7 +73,7 @@ void ewol::resource::ImageDF::generateDistanceField(const egami::ImageMono& _inp
for (int32_t yyy = 0; yyy < _input.getSize().y(); ++yyy) { for (int32_t yyy = 0; yyy < _input.getSize().y(); ++yyy) {
for (int32_t xxx = 0; xxx < _input.getSize().x(); ++xxx) { for (int32_t xxx = 0; xxx < _input.getSize().x(); ++xxx) {
int32_t iii = yyy * _input.getSize().x() + xxx; int32_t iii = yyy * _input.getSize().x() + xxx;
double v = _input.get(ivec2(xxx, yyy)); double v = _input.get(Vector2i(xxx, yyy));
data[iii] = v; data[iii] = v;
if (v > img_max) { if (v > img_max) {
img_max = v; img_max = v;
@ -87,7 +87,7 @@ void ewol::resource::ImageDF::generateDistanceField(const egami::ImageMono& _inp
for (int32_t yyy = 0; yyy < _input.getSize().y(); ++yyy) { for (int32_t yyy = 0; yyy < _input.getSize().y(); ++yyy) {
for (int32_t xxx = 0; xxx < _input.getSize().x(); ++xxx) { for (int32_t xxx = 0; xxx < _input.getSize().x(); ++xxx) {
int32_t iii = yyy * _input.getSize().x() + xxx; int32_t iii = yyy * _input.getSize().x() + xxx;
data[iii] = (_input.get(ivec2(xxx, yyy))-img_min)/img_max; data[iii] = (_input.get(Vector2i(xxx, yyy))-img_min)/img_max;
} }
} }
@ -133,7 +133,7 @@ void ewol::resource::ImageDF::generateDistanceField(const egami::ImageMono& _inp
} }
uint8_t val = 255 - (unsigned char) outside[iii]; uint8_t val = 255 - (unsigned char) outside[iii];
// TODO : Remove multiple size of the map ... // TODO : Remove multiple size of the map ...
_output.set(ivec2(xxx, yyy), etk::Color<>((int32_t)val,(int32_t)val,(int32_t)val,255)); _output.set(Vector2i(xxx, yyy), etk::Color<>((int32_t)val,(int32_t)val,(int32_t)val,255));
} }
} }
} }
@ -153,19 +153,19 @@ static int32_t nextP2(int32_t _value) {
} }
val *=2; val *=2;
} }
EWOL_CRITICAL("impossible CASE.... request P2 of " << _value); Log.critical("impossible CASE.... request P2 of " << _value);
return val; return val;
} }
#endif #endif
ememory::SharedPtr<ewol::resource::ImageDF> ewol::resource::ImageDF::create(const etk::Uri& _uri, ivec2 _size) { ememory::SharedPtr<ewol::resource::ImageDF> ewol::resource::ImageDF::create(const etk::Uri& _uri, Vector2i _size) {
EWOL_VERBOSE("KEEP: TextureFile: '" << _uri << "' size=" << _size); Log.verbose("KEEP: TextureFile: '" << _uri << "' size=" << _size);
if (_uri.isEmpty() == true) { if (_uri.isEmpty() == true) {
ememory::SharedPtr<ewol::resource::ImageDF> object(ETK_NEW(ewol::resource::ImageDF)); ememory::SharedPtr<ewol::resource::ImageDF> object(ETK_NEW(ewol::resource::ImageDF));
if (object == null) { if (object == null) {
EWOL_ERROR("allocation error of a resource : ??TEX??"); Log.error("allocation error of a resource : ??TEX??");
return null; return null;
} }
object->init(); object->init();
@ -174,23 +174,23 @@ ememory::SharedPtr<ewol::resource::ImageDF> ewol::resource::ImageDF::create(cons
} }
if (_size.x() == 0) { if (_size.x() == 0) {
_size.setX(-1); _size.setX(-1);
//EWOL_ERROR("Error Request the image size.x() =0 ???"); //Log.error("Error Request the image size.x() =0 ???");
} }
if (_size.y() == 0) { if (_size.y() == 0) {
_size.setY(-1); _size.setY(-1);
//EWOL_ERROR("Error Request the image size.y() =0 ???"); //Log.error("Error Request the image size.y() =0 ???");
} }
etk::Uri tmpFilename = _uri; etk::Uri tmpFilename = _uri;
if (etk::toLower(_uri.getPath().getExtention()) != "svg") { if (etk::toLower(_uri.getPath().getExtention()) != "svg") {
_size = ivec2(-1,-1); _size = Vector2i(-1,-1);
} }
#ifdef __TARGET_OS__MacOs #ifdef __TARGET_OS__MacOs
EWOL_ERROR("TODO : remove this strange hack"); Log.error("TODO : remove this strange hack");
_size = ivec2(64,64); _size = Vector2i(64,64);
#endif #endif
if ( _size.x() > 0 if ( _size.x() > 0
&& _size.y() > 0) { && _size.y() > 0) {
EWOL_VERBOSE(" == > specific size : " << _size); Log.verbose(" == > specific size : " << _size);
#ifdef __TARGET_OS__Android #ifdef __TARGET_OS__Android
_size.setValue(nextP2(_size.x()), nextP2(_size.y())); _size.setValue(nextP2(_size.x()), nextP2(_size.y()));
#endif #endif
@ -198,24 +198,24 @@ ememory::SharedPtr<ewol::resource::ImageDF> ewol::resource::ImageDF::create(cons
tmpFilename.getQuery().set("y", etk::toString(_size.y())); tmpFilename.getQuery().set("y", etk::toString(_size.y()));
} }
EWOL_VERBOSE("KEEP: TextureFile: '" << tmpFilename << "' new size=" << _size); Log.verbose("KEEP: TextureFile: '" << tmpFilename << "' new size=" << _size);
ememory::SharedPtr<ewol::resource::ImageDF> object = null; ememory::SharedPtr<ewol::resource::ImageDF> object = null;
ememory::SharedPtr<gale::Resource> object2 = getManager().localKeep("DF__" + tmpFilename.getString()); ememory::SharedPtr<gale::Resource> object2 = getManager().localKeep("DF__" + tmpFilename.getString());
if (object2 != null) { if (object2 != null) {
object = ememory::dynamicPointerCast<ewol::resource::ImageDF>(object2); object = ememory::dynamicPointerCast<ewol::resource::ImageDF>(object2);
if (object == null) { if (object == null) {
EWOL_CRITICAL("Request resource file : '" << tmpFilename << "' With the wrong type (dynamic cast error)"); Log.critical("Request resource file : '" << tmpFilename << "' With the wrong type (dynamic cast error)");
return null; return null;
} }
} }
if (object != null) { if (object != null) {
return object; return object;
} }
EWOL_INFO("CREATE: ImageDF: '" << tmpFilename << "' size=" << _size); Log.info("CREATE: ImageDF: '" << tmpFilename << "' size=" << _size);
// need to crate a new one ... // need to crate a new one ...
object = ememory::SharedPtr<ewol::resource::ImageDF>(ETK_NEW(ewol::resource::ImageDF)); object = ememory::SharedPtr<ewol::resource::ImageDF>(ETK_NEW(ewol::resource::ImageDF));
if (object == null) { if (object == null) {
EWOL_ERROR("allocation error of a resource : " << _uri); Log.error("allocation error of a resource : " << _uri);
return null; return null;
} }
object->init("DF__" + tmpFilename.getString(), _uri, _size); object->init("DF__" + tmpFilename.getString(), _uri, _size);

View File

@ -14,11 +14,11 @@ namespace ewol {
namespace resource { namespace resource {
class ImageDF : public ewol::resource::Texture { class ImageDF : public ewol::resource::Texture {
protected: protected:
vec2 m_realImageSize; Vector2f m_realImageSize;
protected: protected:
ImageDF(); ImageDF();
void init(); void init();
void init(etk::String _genName, const etk::Uri& _uri, const ivec2& _size); void init(etk::String _genName, const etk::Uri& _uri, const Vector2i& _size);
public: public:
virtual ~ImageDF() { }; virtual ~ImageDF() { };
protected: protected:
@ -29,7 +29,7 @@ namespace ewol {
*/ */
void generateDistanceField(const egami::ImageMono& _input, egami::Image& _output); void generateDistanceField(const egami::ImageMono& _input, egami::Image& _output);
public: public:
const vec2& getRealSize() { const Vector2f& getRealSize() {
return m_realImageSize; return m_realImageSize;
}; };
public: public:
@ -40,7 +40,7 @@ namespace ewol {
* @param[in] _requested size of the image (usefull when loading .svg to automatic rescale) * @param[in] _requested size of the image (usefull when loading .svg to automatic rescale)
* @return pointer on the resource or null if an error occured. * @return pointer on the resource or null if an error occured.
*/ */
static ememory::SharedPtr<ewol::resource::ImageDF> create(const etk::Uri& _uri, ivec2 _size=ivec2(-1,-1)); static ememory::SharedPtr<ewol::resource::ImageDF> create(const etk::Uri& _uri, Vector2i _size=Vector2i(-1,-1));
}; };
}; };
}; };

View File

@ -28,7 +28,7 @@ static int32_t nextP2(int32_t _value) {
} }
val *=2; val *=2;
} }
EWOL_CRITICAL("impossible CASE...."); Log.critical("impossible CASE....");
return val; return val;
} }
@ -44,7 +44,7 @@ ewol::resource::Texture::Texture() :
#ifdef EWOL_USE_FBO #ifdef EWOL_USE_FBO
m_texPboId(0), m_texPboId(0),
#endif #endif
m_data(ivec2(32,32),egami::colorType::RGBA8), m_data(Vector2i(32,32),egami::colorType::RGBA8),
m_realImageSize(1,1), m_realImageSize(1,1),
m_lastSize(1,1), m_lastSize(1,1),
m_loaded(false), m_loaded(false),
@ -71,12 +71,12 @@ void ewol::resource::Texture::setFilterMode(enum ewol::resource::TextureFilter _
#include <egami/egami.hpp> #include <egami/egami.hpp>
bool ewol::resource::Texture::updateContext() { bool ewol::resource::Texture::updateContext() {
EWOL_VERBOSE("updateContext [START]"); Log.verbose("updateContext [START]");
if (false) { if (false) {
echrono::Steady tic = echrono::Steady::now(); echrono::Steady tic = echrono::Steady::now();
gale::openGL::flush(); gale::openGL::flush();
echrono::Steady toc = echrono::Steady::now(); echrono::Steady toc = echrono::Steady::now();
EWOL_VERBOSE(" updateContext [FLUSH] ==> " << (toc - tic)); Log.verbose(" updateContext [FLUSH] ==> " << (toc - tic));
} }
ethread::RecursiveLock lock(m_mutex, true); ethread::RecursiveLock lock(m_mutex, true);
echrono::Steady tic = echrono::Steady::now(); echrono::Steady tic = echrono::Steady::now();
@ -112,7 +112,7 @@ bool ewol::resource::Texture::updateContext() {
case egami::colorType::unsignedInt32: case egami::colorType::unsignedInt32:
case egami::colorType::float32: case egami::colorType::float32:
case egami::colorType::float64: case egami::colorType::float64:
EWOL_ERROR("Not manage the type " << m_data.getType() << " for texture"); Log.error("Not manage the type " << m_data.getType() << " for texture");
break; break;
} }
if (m_loaded == true) { if (m_loaded == true) {
@ -129,22 +129,22 @@ bool ewol::resource::Texture::updateContext() {
glGenTextures(1, &m_texId); glGenTextures(1, &m_texId);
#ifdef EWOL_USE_FBO #ifdef EWOL_USE_FBO
EWOL_ERROR("CREATE PBO"); Log.error("CREATE PBO");
glGenBuffers(1, &m_texPboId); glGenBuffers(1, &m_texPboId);
EWOL_ERROR("CREATE PBO 1"); Log.error("CREATE PBO 1");
glBindBuffer(GL_PIXEL_UNPACK_BUFFER, m_texPboId); glBindBuffer(GL_PIXEL_UNPACK_BUFFER, m_texPboId);
EWOL_ERROR("CREATE PBO 2"); Log.error("CREATE PBO 2");
glBufferData(GL_PIXEL_UNPACK_BUFFER, m_data.getGPUSize().x()*m_data.getGPUSize().y()*sizeByte, 0, GL_STREAM_DRAW); glBufferData(GL_PIXEL_UNPACK_BUFFER, m_data.getGPUSize().x()*m_data.getGPUSize().y()*sizeByte, 0, GL_STREAM_DRAW);
EWOL_ERROR("CREATE PBO 3"); Log.error("CREATE PBO 3");
glBindBuffer(GL_PIXEL_UNPACK_BUFFER, 0); glBindBuffer(GL_PIXEL_UNPACK_BUFFER, 0);
EWOL_ERROR("CREATE PBO 4 (done)"); Log.error("CREATE PBO 4 (done)");
#endif #endif
m_lastSize = m_data.getSize(); m_lastSize = m_data.getSize();
m_lastTypeObject = typeObject; m_lastTypeObject = typeObject;
m_lastSizeObject = sizeObject; m_lastSizeObject = sizeObject;
EWOL_DEBUG("TEXTURE: add [" << getId() << "]=" << m_data.getSize() << "=>" << m_data.getGPUSize() << " OGl_Id=" << m_texId << " type=" << m_data.getType()); Log.debug("TEXTURE: add [" << getId() << "]=" << m_data.getSize() << "=>" << m_data.getGPUSize() << " OGl_Id=" << m_texId << " type=" << m_data.getType());
} else { } else {
EWOL_DEBUG("TEXTURE: update [" << getId() << "]=" << m_data.getSize() << "=>" << m_data.getGPUSize() << " OGl_Id=" << m_texId << " type=" << m_data.getType()); Log.debug("TEXTURE: update [" << getId() << "]=" << m_data.getSize() << "=>" << m_data.getGPUSize() << " OGl_Id=" << m_texId << " type=" << m_data.getType());
} }
// in all case we set the texture properties : // in all case we set the texture properties :
// TODO : check error ??? // TODO : check error ???
@ -167,7 +167,7 @@ bool ewol::resource::Texture::updateContext() {
} }
//glPixelStorei(GL_UNPACK_ALIGNMENT,1); //glPixelStorei(GL_UNPACK_ALIGNMENT,1);
echrono::Steady toc1 = echrono::Steady::now(); echrono::Steady toc1 = echrono::Steady::now();
EWOL_VERBOSE(" BIND ==> " << (toc1 - tic)); Log.verbose(" BIND ==> " << (toc1 - tic));
//egami::store(m_data, etk::String("~/texture_") + etk::toString(getId()) + ".bmp"); //egami::store(m_data, etk::String("~/texture_") + etk::toString(getId()) + ".bmp");
#if defined(__TARGET_OS__Android) \ #if defined(__TARGET_OS__Android) \
|| defined(__TARGET_OS__IOs) || defined(__TARGET_OS__IOs)
@ -175,11 +175,11 @@ bool ewol::resource::Texture::updateContext() {
if (m_loaded == false) { if (m_loaded == false) {
// 1: Create the square 2 texture: // 1: Create the square 2 texture:
int32_t bufferSize = m_data.getGPUSize().x() * m_data.getGPUSize().y() * 8; int32_t bufferSize = m_data.getGPUSize().x() * m_data.getGPUSize().y() * 8;
static etk::Vector<float> tmpData; static List<float> tmpData;
if (tmpData.size() < bufferSize) { if (tmpData.size() < bufferSize) {
tmpData.resize(bufferSize, 0.0f); tmpData.resize(bufferSize, 0.0f);
} }
EWOL_DEBUG(" CREATE texture ==> " << m_data.getGPUSize()); Log.debug(" CREATE texture ==> " << m_data.getGPUSize());
// 2 create a new empty texture: // 2 create a new empty texture:
#ifdef EWOL_USE_FBO #ifdef EWOL_USE_FBO
glBindBuffer(GL_PIXEL_UNPACK_BUFFER, m_texPboId); glBindBuffer(GL_PIXEL_UNPACK_BUFFER, m_texPboId);
@ -236,7 +236,7 @@ bool ewol::resource::Texture::updateContext() {
sizeObject, // type sizeObject, // type
(void*)((char*)m_data.getTextureDataPointer()) ); (void*)((char*)m_data.getTextureDataPointer()) );
echrono::Steady toc2 = echrono::Steady::now(); echrono::Steady toc2 = echrono::Steady::now();
EWOL_INFO(" updateContext [STOP] ==> " << (toc2 - tic1)); Log.info(" updateContext [STOP] ==> " << (toc2 - tic1));
#endif #endif
#else #else
// This is the normal case ==> set the image and after set just the update of the data // This is the normal case ==> set the image and after set just the update of the data
@ -265,7 +265,7 @@ bool ewol::resource::Texture::updateContext() {
// now the data is loaded // now the data is loaded
m_loaded = true; m_loaded = true;
echrono::Steady toc = echrono::Steady::now(); echrono::Steady toc = echrono::Steady::now();
//EWOL_ERROR(" updateContext [STOP] ==> " << (toc - toc1)); //Log.error(" updateContext [STOP] ==> " << (toc - toc1));
return true; return true;
} }
@ -273,7 +273,7 @@ void ewol::resource::Texture::removeContext() {
ethread::RecursiveLock lock(m_mutex); ethread::RecursiveLock lock(m_mutex);
if (m_loaded == true) { if (m_loaded == true) {
// Request remove texture ... // Request remove texture ...
EWOL_DEBUG("TEXTURE: Rm [" << getId() << "] texId=" << m_texId); Log.debug("TEXTURE: Rm [" << getId() << "] texId=" << m_texId);
// TODO: Check if we are in the correct thread // TODO: Check if we are in the correct thread
glDeleteTextures(1, &m_texId); glDeleteTextures(1, &m_texId);
m_loaded = false; m_loaded = false;
@ -289,31 +289,31 @@ void ewol::resource::Texture::removeContextToLate() {
void ewol::resource::Texture::flush() { void ewol::resource::Texture::flush() {
ethread::RecursiveLock lock(m_mutex); ethread::RecursiveLock lock(m_mutex);
// request to the manager to be call at the next update ... // request to the manager to be call at the next update ...
EWOL_VERBOSE("Request UPDATE of Element"); Log.verbose("Request UPDATE of Element");
getManager().update(ememory::dynamicPointerCast<gale::Resource>(sharedFromThis())); getManager().update(ememory::dynamicPointerCast<gale::Resource>(sharedFromThis()));
} }
void ewol::resource::Texture::setImageSize(ivec2 _newSize) { void ewol::resource::Texture::setImageSize(Vector2i _newSize) {
ethread::RecursiveLock lock(m_mutex); ethread::RecursiveLock lock(m_mutex);
_newSize.setValue( nextP2(_newSize.x()), nextP2(_newSize.y()) ); _newSize.setValue( nextP2(_newSize.x()), nextP2(_newSize.y()) );
m_data.resize(_newSize); m_data.resize(_newSize);
} }
void ewol::resource::Texture::set(egami::Image _image) { void ewol::resource::Texture::set(egami::Image _image) {
EWOL_DEBUG("Set a new image in a texture:"); Log.debug("Set a new image in a texture:");
ethread::RecursiveLock lock(m_mutex); ethread::RecursiveLock lock(m_mutex);
if (_image.exist() == false) { if (_image.exist() == false) {
EWOL_ERROR("ERROR when loading the image : [raw data]"); Log.error("ERROR when loading the image : [raw data]");
return; return;
} }
EWOL_DEBUG(" size=" << _image.getSize()); Log.debug(" size=" << _image.getSize());
etk::swap(m_data, _image); etk::swap(m_data, _image);
ivec2 tmp = m_data.getSize(); Vector2i tmp = m_data.getSize();
m_realImageSize = vec2(tmp.x(), tmp.y()); m_realImageSize = Vector2f(tmp.x(), tmp.y());
vec2 compatibilityHWSize = vec2(nextP2(tmp.x()), nextP2(tmp.y())); Vector2f compatibilityHWSize = Vector2f(nextP2(tmp.x()), nextP2(tmp.y()));
if (m_realImageSize != compatibilityHWSize) { if (m_realImageSize != compatibilityHWSize) {
EWOL_VERBOSE("RESIZE Image for HArwareCompatibility:" << m_realImageSize << " => " << compatibilityHWSize); Log.verbose("RESIZE Image for HArwareCompatibility:" << m_realImageSize << " => " << compatibilityHWSize);
m_data.resize(ivec2(compatibilityHWSize.x(),compatibilityHWSize.y())); m_data.resize(Vector2i(compatibilityHWSize.x(),compatibilityHWSize.y()));
} }
flush(); flush();
} }

View File

@ -27,9 +27,9 @@ namespace ewol {
// openGl Context propoerties : // openGl Context propoerties :
egami::Image m_data; egami::Image m_data;
//! Last loaded size in the system openGL //! Last loaded size in the system openGL
vec2 m_lastSize; Vector2f m_lastSize;
//! some image are not square == > we need to sqared it to prevent some openGl api error the the displayable size is not all the time 0.0 -> 1.0 //! some image are not square == > we need to sqared it to prevent some openGl api error the the displayable size is not all the time 0.0 -> 1.0
vec2 m_realImageSize; Vector2f m_realImageSize;
// internal state of the openGl system : // internal state of the openGl system :
bool m_loaded; bool m_loaded;
int32_t m_lastTypeObject; int32_t m_lastTypeObject;
@ -60,7 +60,7 @@ namespace ewol {
virtual ~Texture(); virtual ~Texture();
public: public:
// You must set the size here, because it will be set in multiple of pow(2) // You must set the size here, because it will be set in multiple of pow(2)
void setImageSize(ivec2 _newSize); void setImageSize(Vector2i _newSize);
// Get the reference on this image to draw nomething on it ... // Get the reference on this image to draw nomething on it ...
inline egami::Image& get() { inline egami::Image& get() {
return m_data; return m_data;
@ -76,10 +76,10 @@ namespace ewol {
bool updateContext(); bool updateContext();
void removeContext(); void removeContext();
void removeContextToLate(); void removeContextToLate();
const ivec2& getOpenGlSize() const { const Vector2i& getOpenGlSize() const {
return m_data.getSize(); return m_data.getSize();
}; };
const vec2& getUsableSize() const { const Vector2f& getUsableSize() const {
return m_realImageSize; return m_realImageSize;
}; };
uint32_t getRendererId() const { uint32_t getRendererId() const {

View File

@ -14,8 +14,8 @@
#include <etk/typeInfo.hpp> #include <etk/typeInfo.hpp>
ETK_DECLARE_TYPE(ewol::resource::TextureFile); ETK_DECLARE_TYPE(ewol::resource::TextureFile);
const ivec2 ewol::resource::TextureFile::sizeAuto(-1,-1); const Vector2i ewol::resource::TextureFile::sizeAuto(-1,-1);
const ivec2 ewol::resource::TextureFile::sizeDefault(0,0); const Vector2i ewol::resource::TextureFile::sizeDefault(0,0);
/** /**
* @brief get the next power 2 if the input * @brief get the next power 2 if the input
@ -30,7 +30,7 @@ static int32_t nextP2(int32_t _value) {
} }
val *=2; val *=2;
} }
EWOL_CRITICAL("impossible CASE.... request P2 of " << _value); Log.critical("impossible CASE.... request P2 of " << _value);
return val; return val;
} }
@ -45,10 +45,10 @@ void ewol::resource::TextureFile::init() {
ewol::resource::Texture::init(); ewol::resource::Texture::init();
} }
void ewol::resource::TextureFile::init(etk::String _genName, const etk::Uri& _uri, const ivec2& _size) { void ewol::resource::TextureFile::init(etk::String _genName, const etk::Uri& _uri, const Vector2i& _size) {
ethread::RecursiveLock lock(m_mutex); ethread::RecursiveLock lock(m_mutex);
ewol::resource::Texture::init(_genName); ewol::resource::Texture::init(_genName);
EWOL_DEBUG("create a new resource::Image : _genName=" << _genName << " _uri=" << _uri << " size=" << _size); Log.debug("create a new resource::Image : _genName=" << _genName << " _uri=" << _uri << " size=" << _size);
egami::Image tmp = egami::load(_uri, _size); egami::Image tmp = egami::load(_uri, _size);
set(etk::move(tmp)); set(etk::move(tmp));
//m_lastSize = m_realImageSize; //m_lastSize = m_realImageSize;
@ -58,12 +58,12 @@ void ewol::resource::TextureFile::init(etk::String _genName, const etk::Uri& _ur
#endif #endif
} }
ememory::SharedPtr<ewol::resource::TextureFile> ewol::resource::TextureFile::create(const etk::Uri& _uri, ivec2 _size, ivec2 _sizeRegister) { ememory::SharedPtr<ewol::resource::TextureFile> ewol::resource::TextureFile::create(const etk::Uri& _uri, Vector2i _size, Vector2i _sizeRegister) {
EWOL_VERBOSE("KEEP: TextureFile: '" << _uri << "' size=" << _size << " sizeRegister=" << _sizeRegister); Log.verbose("KEEP: TextureFile: '" << _uri << "' size=" << _size << " sizeRegister=" << _sizeRegister);
if (_uri.isEmpty() == true) { if (_uri.isEmpty() == true) {
ememory::SharedPtr<ewol::resource::TextureFile> object(ETK_NEW(ewol::resource::TextureFile)); ememory::SharedPtr<ewol::resource::TextureFile> object(ETK_NEW(ewol::resource::TextureFile));
if (object == null) { if (object == null) {
EWOL_ERROR("allocation error of a resource : ??TEX??"); Log.error("allocation error of a resource : ??TEX??");
return null; return null;
} }
object->init(); object->init();
@ -72,18 +72,18 @@ ememory::SharedPtr<ewol::resource::TextureFile> ewol::resource::TextureFile::cre
} }
if (_size.x() == 0) { if (_size.x() == 0) {
_size.setX(-1); _size.setX(-1);
//EWOL_ERROR("Error Request the image size.x() =0 ???"); //Log.error("Error Request the image size.x() =0 ???");
} }
if (_size.y() == 0) { if (_size.y() == 0) {
_size.setY(-1); _size.setY(-1);
//EWOL_ERROR("Error Request the image size.y() =0 ???"); //Log.error("Error Request the image size.y() =0 ???");
} }
etk::Uri tmpFilename = _uri; etk::Uri tmpFilename = _uri;
if (etk::toLower(_uri.getPath().getExtention()) != "svg") { if (etk::toLower(_uri.getPath().getExtention()) != "svg") {
_size = ewol::resource::TextureFile::sizeAuto; _size = ewol::resource::TextureFile::sizeAuto;
} }
if (_size.x()>0 && _size.y()>0) { if (_size.x()>0 && _size.y()>0) {
EWOL_VERBOSE(" == > specific size : " << _size); Log.verbose(" == > specific size : " << _size);
_size.setValue(nextP2(_size.x()), nextP2(_size.y())); _size.setValue(nextP2(_size.x()), nextP2(_size.y()));
if (_sizeRegister != ewol::resource::TextureFile::sizeAuto) { if (_sizeRegister != ewol::resource::TextureFile::sizeAuto) {
if (_sizeRegister != ewol::resource::TextureFile::sizeDefault) { if (_sizeRegister != ewol::resource::TextureFile::sizeDefault) {
@ -93,24 +93,24 @@ ememory::SharedPtr<ewol::resource::TextureFile> ewol::resource::TextureFile::cre
} }
} }
EWOL_VERBOSE("KEEP: TextureFile: '" << tmpFilename << "' new size=" << _size); Log.verbose("KEEP: TextureFile: '" << tmpFilename << "' new size=" << _size);
ememory::SharedPtr<ewol::resource::TextureFile> object = null; ememory::SharedPtr<ewol::resource::TextureFile> object = null;
ememory::SharedPtr<gale::Resource> object2 = getManager().localKeep(tmpFilename.getString()); ememory::SharedPtr<gale::Resource> object2 = getManager().localKeep(tmpFilename.getString());
if (object2 != null) { if (object2 != null) {
object = ememory::dynamicPointerCast<ewol::resource::TextureFile>(object2); object = ememory::dynamicPointerCast<ewol::resource::TextureFile>(object2);
if (object == null) { if (object == null) {
EWOL_CRITICAL("Request resource file : '" << tmpFilename << "' With the wrong type (dynamic cast error)"); Log.critical("Request resource file : '" << tmpFilename << "' With the wrong type (dynamic cast error)");
return null; return null;
} }
} }
if (object != null) { if (object != null) {
return object; return object;
} }
EWOL_DEBUG("CREATE: TextureFile: '" << tmpFilename << "' size=" << _size); Log.debug("CREATE: TextureFile: '" << tmpFilename << "' size=" << _size);
// need to crate a new one ... // need to crate a new one ...
object = ememory::SharedPtr<ewol::resource::TextureFile>(ETK_NEW(ewol::resource::TextureFile)); object = ememory::SharedPtr<ewol::resource::TextureFile>(ETK_NEW(ewol::resource::TextureFile));
if (object == null) { if (object == null) {
EWOL_ERROR("allocation error of a resource : " << _uri); Log.error("allocation error of a resource : " << _uri);
return null; return null;
} }
object->init(tmpFilename.getString(), _uri, _size); object->init(tmpFilename.getString(), _uri, _size);

View File

@ -17,16 +17,16 @@ namespace ewol {
namespace resource { namespace resource {
class TextureFile : public ewol::resource::Texture { class TextureFile : public ewol::resource::Texture {
public: public:
static const ivec2 sizeAuto; static const Vector2i sizeAuto;
static const ivec2 sizeDefault; static const Vector2i sizeDefault;
protected: protected:
TextureFile(); TextureFile();
void init(); void init();
void init(etk::String _genName, const etk::Uri& _uri, const ivec2& _size); void init(etk::String _genName, const etk::Uri& _uri, const Vector2i& _size);
public: public:
virtual ~TextureFile() { }; virtual ~TextureFile() { };
public: public:
const vec2& getRealSize() { const Vector2f& getRealSize() {
return m_realImageSize; return m_realImageSize;
}; };
public: public:
@ -39,8 +39,8 @@ namespace ewol {
* @return pointer on the resource or null if an error occured. * @return pointer on the resource or null if an error occured.
*/ */
static ememory::SharedPtr<ewol::resource::TextureFile> create(const etk::Uri& _filename, static ememory::SharedPtr<ewol::resource::TextureFile> create(const etk::Uri& _filename,
ivec2 _size=ewol::resource::TextureFile::sizeAuto, Vector2i _size=ewol::resource::TextureFile::sizeAuto,
ivec2 _sizeRegister=ewol::resource::TextureFile::sizeAuto); Vector2i _sizeRegister=ewol::resource::TextureFile::sizeAuto);
}; };
}; };
}; };

View File

@ -52,8 +52,8 @@ ewol::resource::TexturedFont::TexturedFont():
* // out contain: {"DATA:///font", "DATA:///font?lib=ewol"} * // out contain: {"DATA:///font", "DATA:///font?lib=ewol"}
* @example[stop] * @example[stop]
*/ */
static etk::Vector<etk::Uri> explodeMultiplePath(const etk::Uri& _uri) { static List<etk::Uri> explodeMultiplePath(const etk::Uri& _uri) {
etk::Vector<etk::Uri> out; List<etk::Uri> out;
out.pushBack(_uri); out.pushBack(_uri);
if (_uri.getQuery().exist("lib") == true) { if (_uri.getQuery().exist("lib") == true) {
etk::Uri tmp = _uri; etk::Uri tmp = _uri;
@ -66,7 +66,7 @@ static etk::Vector<etk::Uri> explodeMultiplePath(const etk::Uri& _uri) {
void ewol::resource::TexturedFont::init(const etk::String& _fontName) { void ewol::resource::TexturedFont::init(const etk::String& _fontName) {
ethread::RecursiveLock lock(m_mutex); ethread::RecursiveLock lock(m_mutex);
ewol::resource::Texture::init(_fontName); ewol::resource::Texture::init(_fontName);
EWOL_DEBUG("Load font : '" << _fontName << "'" ); Log.debug("Load font : '" << _fontName << "'" );
m_font[0] = null; m_font[0] = null;
m_font[1] = null; m_font[1] = null;
@ -95,23 +95,23 @@ void ewol::resource::TexturedFont::init(const etk::String& _fontName) {
if (tmpPos == null) { if (tmpPos == null) {
m_size = 1; m_size = 1;
EWOL_CRITICAL("Can not parse the font name: '" << _fontName << "' ??? ':' " ); Log.critical("Can not parse the font name: '" << _fontName << "' ??? ':' " );
return; return;
} else { } else {
if (sscanf(tmpPos+1, "%d", &tmpSize)!=1) { if (sscanf(tmpPos+1, "%d", &tmpSize)!=1) {
m_size = 1; m_size = 1;
EWOL_CRITICAL("Can not parse the font name: '" << _fontName << "' == > size ???"); Log.critical("Can not parse the font name: '" << _fontName << "' == > size ???");
return; return;
} }
} }
etk::String localName(_fontName, 0, (tmpPos - tmpData)); etk::String localName(_fontName, 0, (tmpPos - tmpData));
if (tmpSize>400) { if (tmpSize>400) {
EWOL_ERROR("Font size too big ==> limit at 400 when exxeed ==> error: " << tmpSize << "==>30"); Log.error("Font size too big ==> limit at 400 when exxeed ==> error: " << tmpSize << "==>30");
tmpSize = 30; tmpSize = 30;
} }
m_size = tmpSize; m_size = tmpSize;
etk::Vector<etk::Uri> folderList; List<etk::Uri> folderList;
if (ewol::getContext().getFontDefault().getUseExternal() == true) { if (ewol::getContext().getFontDefault().getUseExternal() == true) {
#if defined(__TARGET_OS__Android) #if defined(__TARGET_OS__Android)
folderList.pushBack(etk::Path("/system/fonts")); folderList.pushBack(etk::Path("/system/fonts"));
@ -124,24 +124,24 @@ void ewol::resource::TexturedFont::init(const etk::String& _fontName) {
folderList.pushBack(it); folderList.pushBack(it);
} }
for (size_t folderID = 0; folderID < folderList.size() ; folderID++) { for (size_t folderID = 0; folderID < folderList.size() ; folderID++) {
etk::Vector<etk::Uri> output = etk::uri::listRecursive(folderList[folderID]); List<etk::Uri> output = etk::uri::listRecursive(folderList[folderID]);
etk::Vector<etk::String> split = etk::split(localName, ';'); List<etk::String> split = etk::split(localName, ';');
EWOL_DEBUG("try to find font named : " << split << " in: " << output); Log.debug("try to find font named : " << split << " in: " << output);
//EWOL_CRITICAL("parse string : " << split); //Log.critical("parse string : " << split);
bool hasFindAFont = false; bool hasFindAFont = false;
for (size_t jjj=0; jjj<split.size(); jjj++) { for (size_t jjj=0; jjj<split.size(); jjj++) {
EWOL_DEBUG(" try with : '" << split[jjj] << "'"); Log.debug(" try with : '" << split[jjj] << "'");
for (size_t iii=0; iii<output.size(); iii++) { for (size_t iii=0; iii<output.size(); iii++) {
etk::String nameFolder = output[iii].getPath().getString(); etk::String nameFolder = output[iii].getPath().getString();
//EWOL_DEBUG(" file : " << output[iii]); //Log.debug(" file : " << output[iii]);
if( etk::end_with(nameFolder, split[jjj]+"-"+"bold"+".ttf", false) == true if( etk::end_with(nameFolder, split[jjj]+"-"+"bold"+".ttf", false) == true
|| etk::end_with(nameFolder, split[jjj]+"-"+"b"+".ttf", false) == true || etk::end_with(nameFolder, split[jjj]+"-"+"b"+".ttf", false) == true
|| etk::end_with(nameFolder, split[jjj]+"-"+"bd"+".ttf", false) == true || etk::end_with(nameFolder, split[jjj]+"-"+"bd"+".ttf", false) == true
|| etk::end_with(nameFolder, split[jjj]+"bold"+".ttf", false) == true || etk::end_with(nameFolder, split[jjj]+"bold"+".ttf", false) == true
|| etk::end_with(nameFolder, split[jjj]+"bd"+".ttf", false) == true || etk::end_with(nameFolder, split[jjj]+"bd"+".ttf", false) == true
|| etk::end_with(nameFolder, split[jjj]+"b"+".ttf", false) == true) { || etk::end_with(nameFolder, split[jjj]+"b"+".ttf", false) == true) {
EWOL_DEBUG(" find Font [Bold] : " << output[iii]); Log.debug(" find Font [Bold] : " << output[iii]);
m_fileName[ewol::font::Bold] = output[iii]; m_fileName[ewol::font::Bold] = output[iii];
hasFindAFont = true; hasFindAFont = true;
} else if( etk::end_with(nameFolder, split[jjj]+"-"+"oblique"+".ttf", false) == true } else if( etk::end_with(nameFolder, split[jjj]+"-"+"oblique"+".ttf", false) == true
@ -152,7 +152,7 @@ void ewol::resource::TexturedFont::init(const etk::String& _fontName) {
|| etk::end_with(nameFolder, split[jjj]+"italic"+".ttf", false) == true || etk::end_with(nameFolder, split[jjj]+"italic"+".ttf", false) == true
|| etk::end_with(nameFolder, split[jjj]+"light"+".ttf", false) == true || etk::end_with(nameFolder, split[jjj]+"light"+".ttf", false) == true
|| etk::end_with(nameFolder, split[jjj]+"i"+".ttf", false) == true) { || etk::end_with(nameFolder, split[jjj]+"i"+".ttf", false) == true) {
EWOL_DEBUG(" find Font [Italic] : " << output[iii]); Log.debug(" find Font [Italic] : " << output[iii]);
m_fileName[ewol::font::Italic] = output[iii]; m_fileName[ewol::font::Italic] = output[iii];
hasFindAFont = true; hasFindAFont = true;
} else if( etk::end_with(nameFolder, split[jjj]+"-"+"bolditalic"+".ttf", false) == true } else if( etk::end_with(nameFolder, split[jjj]+"-"+"bolditalic"+".ttf", false) == true
@ -163,7 +163,7 @@ void ewol::resource::TexturedFont::init(const etk::String& _fontName) {
|| etk::end_with(nameFolder, split[jjj]+"boldoblique"+".ttf", false) == true || etk::end_with(nameFolder, split[jjj]+"boldoblique"+".ttf", false) == true
|| etk::end_with(nameFolder, split[jjj]+"bi"+".ttf", false) == true || etk::end_with(nameFolder, split[jjj]+"bi"+".ttf", false) == true
|| etk::end_with(nameFolder, split[jjj]+"z"+".ttf", false) == true) { || etk::end_with(nameFolder, split[jjj]+"z"+".ttf", false) == true) {
EWOL_DEBUG(" find Font [Bold-Italic] : " << output[iii]); Log.debug(" find Font [Bold-Italic] : " << output[iii]);
m_fileName[ewol::font::BoldItalic] = output[iii]; m_fileName[ewol::font::BoldItalic] = output[iii];
hasFindAFont = true; hasFindAFont = true;
} else if( etk::end_with(nameFolder, split[jjj]+"-"+"regular"+".ttf", false) == true } else if( etk::end_with(nameFolder, split[jjj]+"-"+"regular"+".ttf", false) == true
@ -171,23 +171,23 @@ void ewol::resource::TexturedFont::init(const etk::String& _fontName) {
|| etk::end_with(nameFolder, split[jjj]+"regular"+".ttf", false) == true || etk::end_with(nameFolder, split[jjj]+"regular"+".ttf", false) == true
|| etk::end_with(nameFolder, split[jjj]+"r"+".ttf", false) == true || etk::end_with(nameFolder, split[jjj]+"r"+".ttf", false) == true
|| etk::end_with(nameFolder, split[jjj]+".ttf", false) == true) { || etk::end_with(nameFolder, split[jjj]+".ttf", false) == true) {
EWOL_DEBUG(" find Font [Regular] : " << output[iii]); Log.debug(" find Font [Regular] : " << output[iii]);
m_fileName[ewol::font::Regular] = output[iii]; m_fileName[ewol::font::Regular] = output[iii];
hasFindAFont = true; hasFindAFont = true;
} }
} }
if (hasFindAFont == true) { if (hasFindAFont == true) {
EWOL_DEBUG(" find this font : '" << split[jjj] << "'"); Log.debug(" find this font : '" << split[jjj] << "'");
break; break;
} else if (jjj == split.size()-1) { } else if (jjj == split.size()-1) {
EWOL_DEBUG("Find NO font in the LIST ... " << split); Log.debug("Find NO font in the LIST ... " << split);
} }
} }
if (hasFindAFont == true) { if (hasFindAFont == true) {
EWOL_DEBUG(" find this font : '" << folderList[folderID] << "'"); Log.debug(" find this font : '" << folderList[folderID] << "'");
break; break;
} else if (folderID == folderList.size()-1) { } else if (folderID == folderList.size()-1) {
EWOL_ERROR("Find NO font in the LIST ... " << folderList); Log.error("Find NO font in the LIST ... " << folderList);
} }
} }
// try to find the reference mode : // try to find the reference mode :
@ -197,7 +197,7 @@ void ewol::resource::TexturedFont::init(const etk::String& _fontName) {
refMode = (enum ewol::font::mode)iii; refMode = (enum ewol::font::mode)iii;
} }
} }
EWOL_DEBUG(" set reference mode : " << refMode); Log.debug(" set reference mode : " << refMode);
// generate the wrapping on the preventing error // generate the wrapping on the preventing error
for(int32_t iii=3; iii >= 0; iii--) { for(int32_t iii=3; iii >= 0; iii--) {
if (m_fileName[iii].isEmpty() == false) { if (m_fileName[iii].isEmpty() == false) {
@ -209,14 +209,14 @@ void ewol::resource::TexturedFont::init(const etk::String& _fontName) {
for (int32_t iiiFontId=0; iiiFontId<4 ; iiiFontId++) { for (int32_t iiiFontId=0; iiiFontId<4 ; iiiFontId++) {
if (m_fileName[iiiFontId].isEmpty() == true) { if (m_fileName[iiiFontId].isEmpty() == true) {
EWOL_DEBUG("can not load FONT [" << iiiFontId << "] name : \"" << m_fileName[iiiFontId] << "\" == > size=" << m_size ); Log.debug("can not load FONT [" << iiiFontId << "] name : \"" << m_fileName[iiiFontId] << "\" == > size=" << m_size );
m_font[iiiFontId] = null; m_font[iiiFontId] = null;
continue; continue;
} }
EWOL_DEBUG("Load FONT [" << iiiFontId << "] name : \"" << m_fileName[iiiFontId] << "\" == > size=" << m_size); Log.debug("Load FONT [" << iiiFontId << "] name : \"" << m_fileName[iiiFontId] << "\" == > size=" << m_size);
m_font[iiiFontId] = ewol::resource::FontFreeType::create(m_fileName[iiiFontId]); m_font[iiiFontId] = ewol::resource::FontFreeType::create(m_fileName[iiiFontId]);
if (m_font[iiiFontId] == null) { if (m_font[iiiFontId] == null) {
EWOL_DEBUG("error in loading FONT [" << iiiFontId << "] name : \"" << m_fileName[iiiFontId] << "\" == > size=" << m_size ); Log.debug("error in loading FONT [" << iiiFontId << "] name : \"" << m_fileName[iiiFontId] << "\" == > size=" << m_size );
} }
} }
for (int32_t iiiFontId=0; iiiFontId<4 ; iiiFontId++) { for (int32_t iiiFontId=0; iiiFontId<4 ; iiiFontId++) {
@ -227,7 +227,7 @@ void ewol::resource::TexturedFont::init(const etk::String& _fontName) {
} }
m_height[iiiFontId] = m_font[iiiFontId]->getHeight(m_size); m_height[iiiFontId] = m_font[iiiFontId]->getHeight(m_size);
// TODO : basic font use 512 is better ... == > maybe estimate it with the dpi ??? // TODO : basic font use 512 is better ... == > maybe estimate it with the dpi ???
setImageSize(ivec2(256,32)); setImageSize(Vector2i(256,32));
// now we can acces directly on the image // now we can acces directly on the image
m_data.clear(etk::Color<>(0x00000000)); m_data.clear(etk::Color<>(0x00000000));
} }
@ -235,15 +235,15 @@ void ewol::resource::TexturedFont::init(const etk::String& _fontName) {
addGlyph(0); addGlyph(0);
// by default we set only the first AINSI char availlable // by default we set only the first AINSI char availlable
for (int32_t iii=0x20; iii<0x7F; iii++) { for (int32_t iii=0x20; iii<0x7F; iii++) {
EWOL_VERBOSE("Add clyph :" << iii); Log.verbose("Add clyph :" << iii);
addGlyph(iii); addGlyph(iii);
} }
flush(); flush();
EWOL_DEBUG("Wrapping properties : "); Log.debug("Wrapping properties : ");
EWOL_DEBUG(" " << ewol::font::Regular << " == >" << getWrappingMode(ewol::font::Regular)); Log.debug(" " << ewol::font::Regular << " == >" << getWrappingMode(ewol::font::Regular));
EWOL_DEBUG(" " << ewol::font::Italic << " == >" << getWrappingMode(ewol::font::Italic)); Log.debug(" " << ewol::font::Italic << " == >" << getWrappingMode(ewol::font::Italic));
EWOL_DEBUG(" " << ewol::font::Bold << " == >" << getWrappingMode(ewol::font::Bold)); Log.debug(" " << ewol::font::Bold << " == >" << getWrappingMode(ewol::font::Bold));
EWOL_DEBUG(" " << ewol::font::BoldItalic << " == >" << getWrappingMode(ewol::font::BoldItalic)); Log.debug(" " << ewol::font::BoldItalic << " == >" << getWrappingMode(ewol::font::BoldItalic));
} }
ewol::resource::TexturedFont::~TexturedFont() { ewol::resource::TexturedFont::~TexturedFont() {
@ -263,24 +263,24 @@ bool ewol::resource::TexturedFont::addGlyph(const char32_t& _val) {
tmpchar.m_UVal = _val; tmpchar.m_UVal = _val;
if (m_font[iii]->getGlyphProperty(m_size, tmpchar) == true) { if (m_font[iii]->getGlyphProperty(m_size, tmpchar) == true) {
//EWOL_DEBUG("load char : '" << _val << "'=" << _val.get()); //Log.debug("load char : '" << _val << "'=" << _val.get());
hasChange = true; hasChange = true;
// change line if needed ... // change line if needed ...
if (m_lastGlyphPos[iii].x()+tmpchar.m_sizeTexture.x()+3 > m_data.getSize().x()) { if (m_lastGlyphPos[iii].x()+tmpchar.m_sizeTexture.x()+3 > m_data.getSize().x()) {
m_lastGlyphPos[iii].setX(1); m_lastGlyphPos[iii].setX(1);
m_lastGlyphPos[iii] += ivec2(0, m_lastRawHeigh[iii]); m_lastGlyphPos[iii] += Vector2i(0, m_lastRawHeigh[iii]);
m_lastRawHeigh[iii] = 0; m_lastRawHeigh[iii] = 0;
} }
while(m_lastGlyphPos[iii].y()+tmpchar.m_sizeTexture.y()+3 > m_data.getSize().y()) { while(m_lastGlyphPos[iii].y()+tmpchar.m_sizeTexture.y()+3 > m_data.getSize().y()) {
ivec2 size = m_data.getSize(); Vector2i size = m_data.getSize();
size.setY(size.y()*2); size.setY(size.y()*2);
m_data.resize(size, etk::Color<>(0)); m_data.resize(size, etk::Color<>(0));
// note : need to rework all the lyer due to the fact that the texture is used by the faur type... // note : need to rework all the lyer due to the fact that the texture is used by the faur type...
for (size_t kkk=0; kkk<4 ; kkk++) { for (size_t kkk=0; kkk<4 ; kkk++) {
// change the coordonate on the element in the texture // change the coordonate on the element in the texture
for (size_t jjj=0 ; jjj<m_listElement[kkk].size() ; ++jjj) { for (size_t jjj=0 ; jjj<m_listElement[kkk].size() ; ++jjj) {
m_listElement[kkk][jjj].m_texturePosStart *= vec2(1.0f, 0.5f); m_listElement[kkk][jjj].m_texturePosStart *= Vector2f(1.0f, 0.5f);
m_listElement[kkk][jjj].m_texturePosSize *= vec2(1.0f, 0.5f); m_listElement[kkk][jjj].m_texturePosSize *= Vector2f(1.0f, 0.5f);
} }
} }
} }
@ -299,7 +299,7 @@ bool ewol::resource::TexturedFont::addGlyph(const char32_t& _val) {
} }
// note : +1 is for the overlapping of the glyph (Part 3) // note : +1 is for the overlapping of the glyph (Part 3)
// update the Bitmap position drawing : // update the Bitmap position drawing :
m_lastGlyphPos[iii] += ivec2(tmpchar.m_sizeTexture.x()+1, 0); m_lastGlyphPos[iii] += Vector2i(tmpchar.m_sizeTexture.x()+1, 0);
} else { } else {
EWOL_WARNING("Did not find char : '" << _val << "'=" << _val); EWOL_WARNING("Did not find char : '" << _val << "'=" << _val);
tmpchar.setNotExist(); tmpchar.setNotExist();
@ -328,11 +328,11 @@ int32_t ewol::resource::TexturedFont::getIndex(char32_t _charcode, const enum ew
return _charcode - 0x1F; return _charcode - 0x1F;
} else { } else {
for (size_t iii=0x80-0x20; iii < m_listElement[_displayMode].size(); iii++) { for (size_t iii=0x80-0x20; iii < m_listElement[_displayMode].size(); iii++) {
//EWOL_DEBUG("search : '" << charcode << "' =?= '" << (m_listElement[displayMode])[iii].m_UVal << "'"); //Log.debug("search : '" << charcode << "' =?= '" << (m_listElement[displayMode])[iii].m_UVal << "'");
if (_charcode == (m_listElement[_displayMode])[iii].m_UVal) { if (_charcode == (m_listElement[_displayMode])[iii].m_UVal) {
//EWOL_DEBUG("search : '" << charcode << "'"); //Log.debug("search : '" << charcode << "'");
if ((m_listElement[_displayMode])[iii].exist()) { if ((m_listElement[_displayMode])[iii].exist()) {
//EWOL_DEBUG("return " << iii); //Log.debug("return " << iii);
return iii; return iii;
} else { } else {
return 0; return 0;
@ -349,21 +349,21 @@ int32_t ewol::resource::TexturedFont::getIndex(char32_t _charcode, const enum ew
ewol::GlyphProperty* ewol::resource::TexturedFont::getGlyphPointer(const char32_t& _charcode, const enum ewol::font::mode _displayMode) { ewol::GlyphProperty* ewol::resource::TexturedFont::getGlyphPointer(const char32_t& _charcode, const enum ewol::font::mode _displayMode) {
ethread::RecursiveLock lock(m_mutex); ethread::RecursiveLock lock(m_mutex);
//EWOL_DEBUG("Get glyph property for mode: " << _displayMode << " == > wrapping index : " << m_modeWraping[_displayMode]); //Log.debug("Get glyph property for mode: " << _displayMode << " == > wrapping index : " << m_modeWraping[_displayMode]);
int32_t index = getIndex(_charcode, _displayMode); int32_t index = getIndex(_charcode, _displayMode);
if( index < 0 if( index < 0
|| (size_t)index >= m_listElement[_displayMode].size() ) { || (size_t)index >= m_listElement[_displayMode].size() ) {
EWOL_ERROR(" Try to get glyph index inexistant ... == > return the index 0 ... id=" << index); Log.error(" Try to get glyph index inexistant ... == > return the index 0 ... id=" << index);
if (m_listElement[_displayMode].size() > 0) { if (m_listElement[_displayMode].size() > 0) {
return &((m_listElement[_displayMode])[0]); return &((m_listElement[_displayMode])[0]);
} }
return &m_emptyGlyph; return &m_emptyGlyph;
} }
//EWOL_ERROR(" index=" << index); //Log.error(" index=" << index);
//EWOL_ERROR(" m_UVal=" << m_listElement[_displayMode][index].m_UVal); //Log.error(" m_UVal=" << m_listElement[_displayMode][index].m_UVal);
//EWOL_ERROR(" m_glyphIndex=" << m_listElement[_displayMode][index].m_glyphIndex); //Log.error(" m_glyphIndex=" << m_listElement[_displayMode][index].m_glyphIndex);
//EWOL_ERROR(" m_advance=" << m_listElement[_displayMode][index].m_advance); //Log.error(" m_advance=" << m_listElement[_displayMode][index].m_advance);
//EWOL_ERROR(" m_bearing=" << m_listElement[_displayMode][index].m_bearing); //Log.error(" m_bearing=" << m_listElement[_displayMode][index].m_bearing);
return &((m_listElement[_displayMode])[index]); return &((m_listElement[_displayMode])[index]);
} }

View File

@ -35,10 +35,10 @@ namespace ewol {
enum ewol::font::mode m_modeWraping[4]; //!< This is a wrapping mode to prevent the fact that no font is define for a specific mode enum ewol::font::mode m_modeWraping[4]; //!< This is a wrapping mode to prevent the fact that no font is define for a specific mode
public: public:
GlyphProperty m_emptyGlyph; GlyphProperty m_emptyGlyph;
etk::Vector<GlyphProperty> m_listElement[4]; List<GlyphProperty> m_listElement[4];
private: private:
// for the texture generation : // for the texture generation :
ivec2 m_lastGlyphPos[4]; Vector2i m_lastGlyphPos[4];
int32_t m_lastRawHeigh[4]; int32_t m_lastRawHeigh[4];
protected: protected:
TexturedFont(); TexturedFont();

View File

@ -32,7 +32,7 @@ namespace ewol {
virtual bool drawGlyph(egami::Image& _imageOut, virtual bool drawGlyph(egami::Image& _imageOut,
int32_t _fontSize, int32_t _fontSize,
ivec2 _glyphPosition, Vector2i _glyphPosition,
ewol::GlyphProperty& _property, ewol::GlyphProperty& _property,
int8_t _posInImage) = 0; int8_t _posInImage) = 0;
@ -41,12 +41,12 @@ namespace ewol {
ewol::GlyphProperty& _property, ewol::GlyphProperty& _property,
int32_t _borderSize = 0) = 0; int32_t _borderSize = 0) = 0;
virtual vec2 getSize(int32_t _fontSize, const etk::String& _unicodeString) = 0; virtual Vector2f getSize(int32_t _fontSize, const etk::String& _unicodeString) = 0;
virtual float getSizeWithHeight(float _fontHeight) = 0; virtual float getSizeWithHeight(float _fontHeight) = 0;
virtual int32_t getHeight(int32_t _fontSize) = 0; virtual int32_t getHeight(int32_t _fontSize) = 0;
virtual void generateKerning(int32_t _fontSize, etk::Vector<ewol::GlyphProperty>& _listGlyph) { }; virtual void generateKerning(int32_t _fontSize, List<ewol::GlyphProperty>& _listGlyph) { };
virtual void display() {}; virtual void display() {};
}; };

View File

@ -52,13 +52,13 @@ namespace ewol {
bool m_exist; bool m_exist;
public: public:
int32_t m_glyphIndex; //!< Glyph index in the system int32_t m_glyphIndex; //!< Glyph index in the system
ivec2 m_sizeTexture; //!< size of the element to display Vector2i m_sizeTexture; //!< size of the element to display
ivec2 m_bearing; //!< offset to display the data (can be negatif id the texture sise is bigger than the theoric places in the string) Vector2i m_bearing; //!< offset to display the data (can be negatif id the texture sise is bigger than the theoric places in the string)
ivec2 m_advance; //!< space use in the display for this specific char Vector2i m_advance; //!< space use in the display for this specific char
vec2 m_texturePosStart; //!< Texture normalized position (START) Vector2f m_texturePosStart; //!< Texture normalized position (START)
vec2 m_texturePosSize; //!< Texture normalized position (SIZE) Vector2f m_texturePosSize; //!< Texture normalized position (SIZE)
private: private:
etk::Vector<ewol::Kerning> m_kerning; //!< kerning values of link of all elements List<ewol::Kerning> m_kerning; //!< kerning values of link of all elements
public: public:
GlyphProperty() : GlyphProperty() :
m_UVal(0), m_UVal(0),

View File

@ -43,7 +43,7 @@ namespace ewol {
float m_value; //!< kerning real offset float m_value; //!< kerning real offset
public: public:
/** /**
* @brief Simple constructor that allow to allocate the etk::Vector element * @brief Simple constructor that allow to allocate the List element
*/ */
Kerning() : Kerning() :
m_UVal(0), m_UVal(0),

View File

@ -16,7 +16,7 @@
void ewol::tools::message::create(enum ewol::tools::message::type _type, const etk::String& _message) { void ewol::tools::message::create(enum ewol::tools::message::type _type, const etk::String& _message) {
ewol::widget::StdPopUpShared tmpPopUp = widget::StdPopUp::create(); ewol::widget::StdPopUpShared tmpPopUp = widget::StdPopUp::create();
if (tmpPopUp == null) { if (tmpPopUp == null) {
EWOL_ERROR("Can not create a simple pop-up"); Log.error("Can not create a simple pop-up");
return; return;
} }
switch(_type) { switch(_type) {
@ -40,7 +40,7 @@ void ewol::tools::message::create(enum ewol::tools::message::type _type, const e
ewol::Context& context = ewol::getContext(); ewol::Context& context = ewol::getContext();
ewol::widget::WindowsShared windows = context.getWindows(); ewol::widget::WindowsShared windows = context.getWindows();
if (windows == null) { if (windows == null) {
EWOL_ERROR("can not get the current windows ... ==> can not display message : " << _message); Log.error("can not get the current windows ... ==> can not display message : " << _message);
return; return;
} }
windows->popUpWidgetPush(tmpPopUp); windows->popUpWidgetPush(tmpPopUp);

View File

@ -61,9 +61,9 @@ ewol::widget::Button::~Button() {
void ewol::widget::Button::onChangeSize() { void ewol::widget::Button::onChangeSize() {
ewol::Padding padding = m_shaper.getPadding(); ewol::Padding padding = m_shaper.getPadding();
ewol::Padding ret = onChangeSizePadded(padding); ewol::Padding ret = onChangeSizePadded(padding);
//EWOL_DEBUG(" configuring : origin=" << origin << " size=" << subElementSize << ""); //Log.debug(" configuring : origin=" << origin << " size=" << subElementSize << "");
m_selectableAreaPos = vec2(ret.xLeft(), ret.yButtom()); m_selectableAreaPos = Vector2f(ret.xLeft(), ret.yButtom());
m_selectableAreaSize = m_size - (m_selectableAreaPos + vec2(ret.xRight(), ret.yTop())); m_selectableAreaSize = m_size - (m_selectableAreaPos + Vector2f(ret.xRight(), ret.yTop()));
} }
@ -83,15 +83,15 @@ void ewol::widget::Button::onRegenerateDisplay() {
return; return;
} }
ewol::Padding padding = m_shaper.getPadding(); ewol::Padding padding = m_shaper.getPadding();
m_shaper.setShape(vec2(0,0), m_shaper.setShape(Vector2f(0,0),
m_size, m_size,
vec2ClipInt32(m_selectableAreaPos+vec2(padding.xLeft(),padding.yButtom()) ), Vector2fClipInt32(m_selectableAreaPos+Vector2f(padding.xLeft(),padding.yButtom()) ),
vec2ClipInt32(m_selectableAreaSize-vec2(padding.x(),padding.y()) ) ); Vector2fClipInt32(m_selectableAreaSize-Vector2f(padding.x(),padding.y()) ) );
//EWOL_ERROR("pos=" << m_origin << " size=" << m_size); //Log.error("pos=" << m_origin << " size=" << m_size);
} }
bool ewol::widget::Button::onEventInput(const ewol::event::Input& _event) { bool ewol::widget::Button::onEventInput(const ewol::event::Input& _event) {
EWOL_VERBOSE("Event on BT : " << _event); Log.verbose("Event on BT : " << _event);
// disable event in the lock access mode : // disable event in the lock access mode :
if(ewol::widget::Button::lockAccess == *propertyLock) { if(ewol::widget::Button::lockAccess == *propertyLock) {
return false; return false;
@ -101,7 +101,7 @@ bool ewol::widget::Button::onEventInput(const ewol::event::Input& _event) {
m_mouseHover = false; m_mouseHover = false;
m_buttonPressed = false; m_buttonPressed = false;
} else { } else {
vec2 relativePos = relativePosition(_event.getPos()); Vector2f relativePos = relativePosition(_event.getPos());
// prevent error from ouside the button // prevent error from ouside the button
if( relativePos.x() < m_selectableAreaPos.x() if( relativePos.x() < m_selectableAreaPos.x()
|| relativePos.y() < m_selectableAreaPos.y() || relativePos.y() < m_selectableAreaPos.y()
@ -113,17 +113,17 @@ bool ewol::widget::Button::onEventInput(const ewol::event::Input& _event) {
m_mouseHover = true; m_mouseHover = true;
} }
} }
EWOL_VERBOSE("Event on BT ... mouse hover : " << m_mouseHover); Log.verbose("Event on BT ... mouse hover : " << m_mouseHover);
if (m_mouseHover == true) { if (m_mouseHover == true) {
if (_event.getId() == 1) { if (_event.getId() == 1) {
if(_event.getStatus() == gale::key::status::down) { if(_event.getStatus() == gale::key::status::down) {
EWOL_VERBOSE(*propertyName << " : Generate event : " << signalDown); Log.verbose(*propertyName << " : Generate event : " << signalDown);
signalDown.emit(); signalDown.emit();
m_buttonPressed = true; m_buttonPressed = true;
markToRedraw(); markToRedraw();
} }
if(_event.getStatus() == gale::key::status::up) { if(_event.getStatus() == gale::key::status::up) {
EWOL_VERBOSE(*propertyName << " : Generate event : " << signalUp); Log.verbose(*propertyName << " : Generate event : " << signalUp);
signalUp.emit(); signalUp.emit();
m_buttonPressed = false; m_buttonPressed = false;
markToRedraw(); markToRedraw();
@ -138,14 +138,14 @@ bool ewol::widget::Button::onEventInput(const ewol::event::Input& _event) {
} else { } else {
// inverse value : // inverse value :
propertyValue.set((*propertyValue)?false:true); propertyValue.set((*propertyValue)?false:true);
EWOL_VERBOSE(*propertyName << " : Generate event : " << signalPressed); Log.verbose(*propertyName << " : Generate event : " << signalPressed);
signalPressed.emit(); signalPressed.emit();
EWOL_VERBOSE(*propertyName << " : Generate event : " << signalValue << " val=" << *propertyValue ); Log.verbose(*propertyName << " : Generate event : " << signalValue << " val=" << *propertyValue );
signalValue.emit(*propertyValue); signalValue.emit(*propertyValue);
if( *propertyToggleMode == false if( *propertyToggleMode == false
&& *propertyValue == true) { && *propertyValue == true) {
propertyValue.set(false); propertyValue.set(false);
EWOL_VERBOSE(*propertyName << " : Generate event : " << signalValue << " val=" << *propertyValue); Log.verbose(*propertyName << " : Generate event : " << signalValue << " val=" << *propertyValue);
signalValue.emit(*propertyValue); signalValue.emit(*propertyValue);
} }
} }
@ -159,7 +159,7 @@ bool ewol::widget::Button::onEventInput(const ewol::event::Input& _event) {
bool ewol::widget::Button::onEventEntry(const ewol::event::Entry& _event) { bool ewol::widget::Button::onEventEntry(const ewol::event::Entry& _event) {
//EWOL_DEBUG("BT PRESSED : \"" << UTF8_data << "\" size=" << strlen(UTF8_data)); //Log.debug("BT PRESSED : \"" << UTF8_data << "\" size=" << strlen(UTF8_data));
if( _event.getType() == gale::key::keyboard::character if( _event.getType() == gale::key::keyboard::character
&& _event.getStatus() == gale::key::status::down && _event.getStatus() == gale::key::status::down
&& _event.getChar() == '\r') { && _event.getChar() == '\r') {
@ -171,7 +171,7 @@ bool ewol::widget::Button::onEventEntry(const ewol::event::Entry& _event) {
void ewol::widget::Button::onLostFocus() { void ewol::widget::Button::onLostFocus() {
m_buttonPressed = false; m_buttonPressed = false;
EWOL_VERBOSE(propertyName.get() << " : Remove Focus ..."); Log.verbose(propertyName.get() << " : Remove Focus ...");
CheckStatus(); CheckStatus();
} }

View File

@ -65,8 +65,8 @@ namespace ewol {
bool m_mouseHover; //!< Flag to know where the mouse is (inside the displayed widget (if not fill)). bool m_mouseHover; //!< Flag to know where the mouse is (inside the displayed widget (if not fill)).
bool m_buttonPressed; //!< Flag to know if the button is curently pressed. bool m_buttonPressed; //!< Flag to know if the button is curently pressed.
// hover area : // hover area :
vec2 m_selectableAreaPos; //!< Start position of the events Vector2f m_selectableAreaPos; //!< Start position of the events
vec2 m_selectableAreaSize; //!< size of the event positions Vector2f m_selectableAreaSize; //!< size of the event positions
private: private:
/** /**
* @brief internal system to change the property of the current status * @brief internal system to change the property of the current status

View File

@ -47,7 +47,7 @@ ewol::widget::ButtonColor::~ButtonColor() {
void ewol::widget::ButtonColor::calculateMinMaxSize() { void ewol::widget::ButtonColor::calculateMinMaxSize() {
ewol::Padding padding = m_shaper.getPadding(); ewol::Padding padding = m_shaper.getPadding();
etk::String label = propertyValue.getString(); etk::String label = propertyValue.getString();
vec3 minSize = m_text.calculateSize(label); Vector3f minSize = m_text.calculateSize(label);
m_minSize.setX(padding.x()*2 + minSize.x() + 7); m_minSize.setX(padding.x()*2 + minSize.x() + 7);
m_minSize.setY(padding.y()*2 + minSize.y() ); m_minSize.setY(padding.y()*2 + minSize.y() );
markToRedraw(); markToRedraw();
@ -65,7 +65,7 @@ void ewol::widget::ButtonColor::onRegenerateDisplay() {
if (needRedraw() == false) { if (needRedraw() == false) {
return; return;
} }
EWOL_DEBUG("redraw"); Log.debug("redraw");
m_text.clear(); m_text.clear();
m_shaper.clear(); m_shaper.clear();
@ -73,13 +73,13 @@ void ewol::widget::ButtonColor::onRegenerateDisplay() {
etk::String label = propertyValue.getString(); etk::String label = propertyValue.getString();
ivec2 localSize = m_minSize; Vector2i localSize = m_minSize;
vec3 tmpOrigin((m_size.x() - m_minSize.x()) / 2.0, Vector3f tmpOrigin((m_size.x() - m_minSize.x()) / 2.0,
(m_size.y() - m_minSize.y()) / 2.0, (m_size.y() - m_minSize.y()) / 2.0,
0); 0);
// no change for the text orogin : // no change for the text orogin :
vec3 tmpTextOrigin((m_size.x() - m_minSize.x()) / 2.0, Vector3f tmpTextOrigin((m_size.x() - m_minSize.x()) / 2.0,
(m_size.y() - m_minSize.y()) / 2.0, (m_size.y() - m_minSize.y()) / 2.0,
0); 0);
@ -91,9 +91,9 @@ void ewol::widget::ButtonColor::onRegenerateDisplay() {
if (propertyFill->y() == true) { if (propertyFill->y() == true) {
localSize.setY(m_size.y()); localSize.setY(m_size.y());
} }
tmpOrigin += vec3(padding.xLeft(), padding.yButtom(), 0); tmpOrigin += Vector3f(padding.xLeft(), padding.yButtom(), 0);
tmpTextOrigin += vec3(padding.xLeft(), padding.yButtom(), 0); tmpTextOrigin += Vector3f(padding.xLeft(), padding.yButtom(), 0);
localSize -= ivec2(padding.x(), padding.y()); localSize -= Vector2i(padding.x(), padding.y());
// clean the element // clean the element
m_text.reset(); m_text.reset();
@ -115,13 +115,13 @@ void ewol::widget::ButtonColor::onRegenerateDisplay() {
} }
// selection area : // selection area :
m_selectableAreaPos = vec2(tmpOrigin.x()-padding.xLeft(), tmpOrigin.y()-padding.yButtom()); m_selectableAreaPos = Vector2f(tmpOrigin.x()-padding.xLeft(), tmpOrigin.y()-padding.yButtom());
m_selectableAreaSize = localSize + vec2(padding.x(),padding.y()); m_selectableAreaSize = localSize + Vector2f(padding.x(),padding.y());
vec3 tmpp = m_text.calculateSize(label); Vector3f tmpp = m_text.calculateSize(label);
m_shaper.setShape(m_selectableAreaPos, m_shaper.setShape(m_selectableAreaPos,
m_selectableAreaSize, m_selectableAreaSize,
vec2(tmpTextOrigin.x(), tmpTextOrigin.y()), Vector2f(tmpTextOrigin.x(), tmpTextOrigin.y()),
vec2(tmpp.x(), tmpp.y())); Vector2f(tmpp.x(), tmpp.y()));
} }
@ -131,7 +131,7 @@ bool ewol::widget::ButtonColor::onEventInput(const ewol::event::Input& _event) {
m_mouseHover = false; m_mouseHover = false;
m_buttonPressed = false; m_buttonPressed = false;
} else { } else {
vec2 relativePos = relativePosition(_event.getPos()); Vector2f relativePos = relativePosition(_event.getPos());
// prevent error from ouside the button // prevent error from ouside the button
if( relativePos.x() < m_selectableAreaPos.x() if( relativePos.x() < m_selectableAreaPos.x()
|| relativePos.y() < m_selectableAreaPos.y() || relativePos.y() < m_selectableAreaPos.y()
@ -144,7 +144,7 @@ bool ewol::widget::ButtonColor::onEventInput(const ewol::event::Input& _event) {
} }
} }
bool previousPressed = m_buttonPressed; bool previousPressed = m_buttonPressed;
//EWOL_DEBUG("Event on BT ... mouse position : " << m_mouseHover); //Log.debug("Event on BT ... mouse position : " << m_mouseHover);
if (true == m_mouseHover) { if (true == m_mouseHover) {
if (1 == _event.getId()) { if (1 == _event.getId()) {
if(gale::key::status::down == _event.getStatus()) { if(gale::key::status::down == _event.getStatus()) {
@ -161,10 +161,10 @@ bool ewol::widget::ButtonColor::onEventInput(const ewol::event::Input& _event) {
// create a context menu : // create a context menu :
m_widgetContextMenu = ewol::widget::ContextMenu::create(); m_widgetContextMenu = ewol::widget::ContextMenu::create();
if (m_widgetContextMenu == null) { if (m_widgetContextMenu == null) {
EWOL_ERROR("Allocation Error"); Log.error("Allocation Error");
return true; return true;
} }
vec2 tmpPos = m_origin + m_selectableAreaPos + m_selectableAreaSize; Vector2f tmpPos = m_origin + m_selectableAreaPos + m_selectableAreaSize;
tmpPos.setX( tmpPos.x() - m_minSize.x()/2.0); tmpPos.setX( tmpPos.x() - m_minSize.x()/2.0);
m_widgetContextMenu->setPositionMark(ewol::widget::ContextMenu::markButtom, tmpPos ); m_widgetContextMenu->setPositionMark(ewol::widget::ContextMenu::markButtom, tmpPos );
@ -175,7 +175,7 @@ bool ewol::widget::ButtonColor::onEventInput(const ewol::event::Input& _event) {
myColorChooser->signalChange.connect(sharedFromThis(), &ewol::widget::ButtonColor::onCallbackColorChange); myColorChooser->signalChange.connect(sharedFromThis(), &ewol::widget::ButtonColor::onCallbackColorChange);
ewol::widget::WindowsShared currentWindows = getWindows(); ewol::widget::WindowsShared currentWindows = getWindows();
if (currentWindows == null) { if (currentWindows == null) {
EWOL_ERROR("Can not get the curent Windows..."); Log.error("Can not get the curent Windows...");
m_widgetContextMenu.reset(); m_widgetContextMenu.reset();
} else { } else {
currentWindows->popUpWidgetPush(m_widgetContextMenu); currentWindows->popUpWidgetPush(m_widgetContextMenu);

View File

@ -33,8 +33,8 @@ namespace ewol {
bool m_mouseHover; //!< Flag to know where the mouse is (inside the displayed widget (if not fill)). bool m_mouseHover; //!< Flag to know where the mouse is (inside the displayed widget (if not fill)).
bool m_buttonPressed; //!< Flag to know if the button is curently pressed. bool m_buttonPressed; //!< Flag to know if the button is curently pressed.
// hover area : // hover area :
vec2 m_selectableAreaPos; //!< Start position of the events Vector2f m_selectableAreaPos; //!< Start position of the events
vec2 m_selectableAreaSize; //!< size of the event positions Vector2f m_selectableAreaSize; //!< size of the event positions
protected: protected:
/** /**
* @brief Main constructor. * @brief Main constructor.

View File

@ -59,9 +59,9 @@ void ewol::widget::CheckBox::onChangeSize() {
float boxSize = m_shaper.getConfigNumber(m_shaperIdSize); float boxSize = m_shaper.getConfigNumber(m_shaperIdSize);
padding.setXLeft(padding.xLeft()*2.0f + boxSize); padding.setXLeft(padding.xLeft()*2.0f + boxSize);
ewol::Padding ret = onChangeSizePadded(padding); ewol::Padding ret = onChangeSizePadded(padding);
EWOL_DEBUG(" configuring : padding=" << padding << " boxSize=" << boxSize << ""); Log.debug(" configuring : padding=" << padding << " boxSize=" << boxSize << "");
m_selectableAreaPos = vec2(ret.xLeft()/*-boxSize*/, ret.yButtom()); m_selectableAreaPos = Vector2f(ret.xLeft()/*-boxSize*/, ret.yButtom());
m_selectableAreaSize = m_size - (m_selectableAreaPos + vec2(ret.xRight(), ret.yTop())); m_selectableAreaSize = m_size - (m_selectableAreaPos + Vector2f(ret.xRight(), ret.yTop()));
} }
void ewol::widget::CheckBox::calculateMinMaxSize() { void ewol::widget::CheckBox::calculateMinMaxSize() {
@ -88,20 +88,20 @@ void ewol::widget::CheckBox::onRegenerateDisplay() {
float boxSize = m_shaper.getConfigNumber(m_shaperIdSize); float boxSize = m_shaper.getConfigNumber(m_shaperIdSize);
float boxInside = m_shaper.getConfigNumber(m_shaperIdSizeInsize); float boxInside = m_shaper.getConfigNumber(m_shaperIdSizeInsize);
m_shaper.clear(); m_shaper.clear();
EWOL_DEBUG(" configuring : boxSize=" << boxSize << " boxInside=" << boxInside << ""); Log.debug(" configuring : boxSize=" << boxSize << " boxInside=" << boxInside << "");
vec2 origin(m_selectableAreaPos + vec2(0, (m_selectableAreaSize.y() - (boxSize+padding.y()))*0.5f)); Vector2f origin(m_selectableAreaPos + Vector2f(0, (m_selectableAreaSize.y() - (boxSize+padding.y()))*0.5f));
vec2 size = vec2(boxSize+padding.x(), boxSize+padding.y()); Vector2f size = Vector2f(boxSize+padding.x(), boxSize+padding.y());
vec2 origin2 = m_selectableAreaPos + vec2((boxSize-boxInside)*0.5f, (m_selectableAreaSize.y() - (boxInside+padding.y()))*0.5f); Vector2f origin2 = m_selectableAreaPos + Vector2f((boxSize-boxInside)*0.5f, (m_selectableAreaSize.y() - (boxInside+padding.y()))*0.5f);
vec2 size2 = vec2(boxInside+padding.x(), boxInside+padding.y()); Vector2f size2 = Vector2f(boxInside+padding.x(), boxInside+padding.y());
m_shaper.setShape(vec2ClipInt32(origin), m_shaper.setShape(Vector2fClipInt32(origin),
vec2ClipInt32(size), Vector2fClipInt32(size),
vec2ClipInt32(origin2+vec2(padding.xLeft(),padding.yButtom()) ), Vector2fClipInt32(origin2+Vector2f(padding.xLeft(),padding.yButtom()) ),
vec2ClipInt32(size2-vec2(padding.x(),padding.y()) )); Vector2fClipInt32(size2-Vector2f(padding.x(),padding.y()) ));
} }
bool ewol::widget::CheckBox::onEventInput(const ewol::event::Input& _event) { bool ewol::widget::CheckBox::onEventInput(const ewol::event::Input& _event) {
EWOL_VERBOSE("Event on BT : " << _event); Log.verbose("Event on BT : " << _event);
bool previousHoverState = m_mouseHover; bool previousHoverState = m_mouseHover;
if( gale::key::status::leave == _event.getStatus() if( gale::key::status::leave == _event.getStatus()
@ -109,7 +109,7 @@ bool ewol::widget::CheckBox::onEventInput(const ewol::event::Input& _event) {
m_mouseHover = false; m_mouseHover = false;
m_buttonPressed = false; m_buttonPressed = false;
} else { } else {
vec2 relativePos = relativePosition(_event.getPos()); Vector2f relativePos = relativePosition(_event.getPos());
// prevent error from ouside the button // prevent error from ouside the button
if( relativePos.x() < m_selectableAreaPos.x() if( relativePos.x() < m_selectableAreaPos.x()
|| relativePos.y() < m_selectableAreaPos.y() || relativePos.y() < m_selectableAreaPos.y()
@ -122,17 +122,17 @@ bool ewol::widget::CheckBox::onEventInput(const ewol::event::Input& _event) {
} }
} }
bool previousPressed = m_buttonPressed; bool previousPressed = m_buttonPressed;
EWOL_VERBOSE("Event on BT ... mouse hover : " << m_mouseHover); Log.verbose("Event on BT ... mouse hover : " << m_mouseHover);
if (m_mouseHover == true) { if (m_mouseHover == true) {
if (_event.getId() == 1) { if (_event.getId() == 1) {
if(gale::key::status::down == _event.getStatus()) { if(gale::key::status::down == _event.getStatus()) {
EWOL_VERBOSE(*propertyName << " : Generate event : " << signalDown); Log.verbose(*propertyName << " : Generate event : " << signalDown);
signalDown.emit(); signalDown.emit();
m_buttonPressed = true; m_buttonPressed = true;
markToRedraw(); markToRedraw();
} }
if(gale::key::status::up == _event.getStatus()) { if(gale::key::status::up == _event.getStatus()) {
EWOL_VERBOSE(*propertyName << " : Generate event : " << signalUp); Log.verbose(*propertyName << " : Generate event : " << signalUp);
signalUp.emit(); signalUp.emit();
m_buttonPressed = false; m_buttonPressed = false;
markToRedraw(); markToRedraw();
@ -140,9 +140,9 @@ bool ewol::widget::CheckBox::onEventInput(const ewol::event::Input& _event) {
if(gale::key::status::pressSingle == _event.getStatus()) { if(gale::key::status::pressSingle == _event.getStatus()) {
// inverse value : // inverse value :
propertyValue.set((*propertyValue)?false:true); propertyValue.set((*propertyValue)?false:true);
EWOL_VERBOSE(*propertyName << " : Generate event : " << signalPressed); Log.verbose(*propertyName << " : Generate event : " << signalPressed);
signalPressed.emit(); signalPressed.emit();
EWOL_VERBOSE(*propertyName << " : Generate event : " << signalValue << " val=" << propertyValue ); Log.verbose(*propertyName << " : Generate event : " << signalValue << " val=" << propertyValue );
signalValue.emit(*propertyValue); signalValue.emit(*propertyValue);
markToRedraw(); markToRedraw();
} }
@ -157,7 +157,7 @@ bool ewol::widget::CheckBox::onEventInput(const ewol::event::Input& _event) {
bool ewol::widget::CheckBox::onEventEntry(const ewol::event::Entry& _event) { bool ewol::widget::CheckBox::onEventEntry(const ewol::event::Entry& _event) {
//EWOL_DEBUG("BT PRESSED : \"" << UTF8_data << "\" size=" << strlen(UTF8_data)); //Log.debug("BT PRESSED : \"" << UTF8_data << "\" size=" << strlen(UTF8_data));
if( _event.getType() == gale::key::keyboard::character if( _event.getType() == gale::key::keyboard::character
&& _event.getStatus() == gale::key::status::down && _event.getStatus() == gale::key::status::down
&& _event.getChar() == '\r') { && _event.getChar() == '\r') {

View File

@ -33,8 +33,8 @@ namespace ewol {
bool m_mouseHover; //!< Flag to know where the mouse is (inside the displayed widget (if not fill)). bool m_mouseHover; //!< Flag to know where the mouse is (inside the displayed widget (if not fill)).
bool m_buttonPressed; //!< Flag to know if the button is curently pressed. bool m_buttonPressed; //!< Flag to know if the button is curently pressed.
// hover area : // hover area :
vec2 m_selectableAreaPos; //!< Start position of the events Vector2f m_selectableAreaPos; //!< Start position of the events
vec2 m_selectableAreaSize; //!< size of the event positions Vector2f m_selectableAreaSize; //!< size of the event positions
// shaper ids: // shaper ids:
int32_t m_shaperIdSize; int32_t m_shaperIdSize;
int32_t m_shaperIdSizeInsize; int32_t m_shaperIdSizeInsize;

View File

@ -51,7 +51,7 @@ static etk::Color<> s_listColor[NB_BAND_COLOR+1] = {
void ewol::widget::ColorBar::onChangePropertyValue() { void ewol::widget::ColorBar::onChangePropertyValue() {
propertyValue.getDirect().setA(0xFF); propertyValue.getDirect().setA(0xFF);
// estimate the cursor position: // estimate the cursor position:
EWOL_TODO("Later when really needed ..."); Log.todo("Later when really needed ...");
} }
void ewol::widget::ColorBar::onDraw() { void ewol::widget::ColorBar::onDraw() {
@ -89,13 +89,13 @@ void ewol::widget::ColorBar::onRegenerateDisplay() {
* ******** * ********
*/ */
m_draw.setColor(s_listColorWhite); m_draw.setColor(s_listColorWhite);
m_draw.setPos(vec3(tmpOriginX + (iii)*(tmpSizeX/NB_BAND_COLOR), tmpOriginY, 0) ); m_draw.setPos(Vector3f(tmpOriginX + (iii)*(tmpSizeX/NB_BAND_COLOR), tmpOriginY, 0) );
m_draw.addVertex(); m_draw.addVertex();
m_draw.setColor(s_listColor[iii+1]); m_draw.setColor(s_listColor[iii+1]);
m_draw.setPos(vec3(tmpOriginX + (iii+1)*(tmpSizeX/NB_BAND_COLOR), tmpOriginY+tmpSizeY/2, 0) ); m_draw.setPos(Vector3f(tmpOriginX + (iii+1)*(tmpSizeX/NB_BAND_COLOR), tmpOriginY+tmpSizeY/2, 0) );
m_draw.addVertex(); m_draw.addVertex();
m_draw.setColor(s_listColor[iii]); m_draw.setColor(s_listColor[iii]);
m_draw.setPos(vec3(tmpOriginX + iii*(tmpSizeX/NB_BAND_COLOR), tmpOriginY+tmpSizeY/2, 0) ); m_draw.setPos(Vector3f(tmpOriginX + iii*(tmpSizeX/NB_BAND_COLOR), tmpOriginY+tmpSizeY/2, 0) );
m_draw.addVertex(); m_draw.addVertex();
/* Step 2 : /* Step 2 :
* ******** * ********
@ -105,13 +105,13 @@ void ewol::widget::ColorBar::onRegenerateDisplay() {
* *
*/ */
m_draw.setColor(s_listColorWhite); m_draw.setColor(s_listColorWhite);
m_draw.setPos(vec3(tmpOriginX + iii*(tmpSizeX/NB_BAND_COLOR), tmpOriginY, 0) ); m_draw.setPos(Vector3f(tmpOriginX + iii*(tmpSizeX/NB_BAND_COLOR), tmpOriginY, 0) );
m_draw.addVertex(); m_draw.addVertex();
m_draw.setColor(s_listColorWhite); m_draw.setColor(s_listColorWhite);
m_draw.setPos(vec3(tmpOriginX + (iii+1)*(tmpSizeX/NB_BAND_COLOR), tmpOriginY, 0) ); m_draw.setPos(Vector3f(tmpOriginX + (iii+1)*(tmpSizeX/NB_BAND_COLOR), tmpOriginY, 0) );
m_draw.addVertex(); m_draw.addVertex();
m_draw.setColor(s_listColor[iii+1]); m_draw.setColor(s_listColor[iii+1]);
m_draw.setPos(vec3(tmpOriginX + (iii+1)*(tmpSizeX/NB_BAND_COLOR), tmpOriginY+tmpSizeY/2, 0) ); m_draw.setPos(Vector3f(tmpOriginX + (iii+1)*(tmpSizeX/NB_BAND_COLOR), tmpOriginY+tmpSizeY/2, 0) );
m_draw.addVertex(); m_draw.addVertex();
/* Step 3 : /* Step 3 :
* *
@ -121,13 +121,13 @@ void ewol::widget::ColorBar::onRegenerateDisplay() {
* ******** * ********
*/ */
m_draw.setColor(s_listColor[iii]); m_draw.setColor(s_listColor[iii]);
m_draw.setPos(vec3(tmpOriginX + iii*(tmpSizeX/NB_BAND_COLOR), tmpOriginY+tmpSizeY/2, 0)); m_draw.setPos(Vector3f(tmpOriginX + iii*(tmpSizeX/NB_BAND_COLOR), tmpOriginY+tmpSizeY/2, 0));
m_draw.addVertex(); m_draw.addVertex();
m_draw.setColor(s_listColorBlack); m_draw.setColor(s_listColorBlack);
m_draw.setPos(vec3(tmpOriginX + (iii+1)*(tmpSizeX/NB_BAND_COLOR), tmpOriginY+tmpSizeY, 0)); m_draw.setPos(Vector3f(tmpOriginX + (iii+1)*(tmpSizeX/NB_BAND_COLOR), tmpOriginY+tmpSizeY, 0));
m_draw.addVertex(); m_draw.addVertex();
m_draw.setColor(s_listColorBlack); m_draw.setColor(s_listColorBlack);
m_draw.setPos(vec3(tmpOriginX + iii*(tmpSizeX/NB_BAND_COLOR), tmpOriginY+tmpSizeY, 0)); m_draw.setPos(Vector3f(tmpOriginX + iii*(tmpSizeX/NB_BAND_COLOR), tmpOriginY+tmpSizeY, 0));
m_draw.addVertex(); m_draw.addVertex();
/* Step 4 : /* Step 4 :
* ******** * ********
@ -137,13 +137,13 @@ void ewol::widget::ColorBar::onRegenerateDisplay() {
* *
*/ */
m_draw.setColor(s_listColor[iii]); m_draw.setColor(s_listColor[iii]);
m_draw.setPos(vec3(tmpOriginX + iii*(tmpSizeX/NB_BAND_COLOR), tmpOriginY+tmpSizeY/2, 0)); m_draw.setPos(Vector3f(tmpOriginX + iii*(tmpSizeX/NB_BAND_COLOR), tmpOriginY+tmpSizeY/2, 0));
m_draw.addVertex(); m_draw.addVertex();
m_draw.setColor(s_listColor[iii+1]); m_draw.setColor(s_listColor[iii+1]);
m_draw.setPos(vec3(tmpOriginX + (iii+1)*(tmpSizeX/NB_BAND_COLOR), tmpOriginY+tmpSizeY/2, 0)); m_draw.setPos(Vector3f(tmpOriginX + (iii+1)*(tmpSizeX/NB_BAND_COLOR), tmpOriginY+tmpSizeY/2, 0));
m_draw.addVertex(); m_draw.addVertex();
m_draw.setColor(s_listColorBlack); m_draw.setColor(s_listColorBlack);
m_draw.setPos(vec3(tmpOriginX + (iii+1)*(tmpSizeX/NB_BAND_COLOR), tmpOriginY+tmpSizeY, 0)); m_draw.setPos(Vector3f(tmpOriginX + (iii+1)*(tmpSizeX/NB_BAND_COLOR), tmpOriginY+tmpSizeY, 0));
m_draw.addVertex(); m_draw.addVertex();
} }
if (m_currentUserPos.y() > 0.5) { if (m_currentUserPos.y() > 0.5) {
@ -151,15 +151,15 @@ void ewol::widget::ColorBar::onRegenerateDisplay() {
} else { } else {
m_draw.setColor(etk::color::black); m_draw.setColor(etk::color::black);
} }
m_draw.setPos(vec3(m_currentUserPos.x()*m_size.x(), m_currentUserPos.y()*m_size.y(), 0) ); m_draw.setPos(Vector3f(m_currentUserPos.x()*m_size.x(), m_currentUserPos.y()*m_size.y(), 0) );
m_draw.setThickness(1); m_draw.setThickness(1);
m_draw.circle(3.0); m_draw.circle(3.0);
} }
bool ewol::widget::ColorBar::onEventInput(const ewol::event::Input& _event) { bool ewol::widget::ColorBar::onEventInput(const ewol::event::Input& _event) {
vec2 relativePos = relativePosition(_event.getPos()); Vector2f relativePos = relativePosition(_event.getPos());
//EWOL_DEBUG("Event on BT ..."); //Log.debug("Event on BT ...");
if (1 == _event.getId()) { if (1 == _event.getId()) {
relativePos.setValue( etk::avg(0.0f, m_size.x(),relativePos.x()), relativePos.setValue( etk::avg(0.0f, m_size.x(),relativePos.x()),
etk::avg(0.0f, m_size.y(),relativePos.y()) ); etk::avg(0.0f, m_size.y(),relativePos.y()) );
@ -170,11 +170,11 @@ bool ewol::widget::ColorBar::onEventInput(const ewol::event::Input& _event) {
relativePos.y()/m_size.y() ); relativePos.y()/m_size.y() );
markToRedraw(); markToRedraw();
// == > try to estimate color // == > try to estimate color
EWOL_VERBOSE("event on (" << relativePos.x() << "," << relativePos.y() << ")"); Log.verbose("event on (" << relativePos.x() << "," << relativePos.y() << ")");
int32_t bandID = (int32_t)(relativePos.x()/(m_size.x()/6)); int32_t bandID = (int32_t)(relativePos.x()/(m_size.x()/6));
float localPos = relativePos.x() - (m_size.x()/6) * bandID; float localPos = relativePos.x() - (m_size.x()/6) * bandID;
float poroportionnalPos = localPos/(m_size.x()/6); float poroportionnalPos = localPos/(m_size.x()/6);
EWOL_VERBOSE("bandId=" << bandID << " relative pos=" << localPos); Log.verbose("bandId=" << bandID << " relative pos=" << localPos);
etk::Color<> estimateColor = etk::color::white; etk::Color<> estimateColor = etk::color::white;
if (s_listColor[bandID].r() == s_listColor[bandID+1].r()) { if (s_listColor[bandID].r() == s_listColor[bandID+1].r()) {
estimateColor.setR(s_listColor[bandID].r()); estimateColor.setR(s_listColor[bandID].r());

View File

@ -30,7 +30,7 @@ namespace ewol {
virtual ~ColorBar(); virtual ~ColorBar();
private: private:
ewol::compositing::Drawing m_draw; //!< Compositing drawing element ewol::compositing::Drawing m_draw; //!< Compositing drawing element
vec2 m_currentUserPos; Vector2f m_currentUserPos;
protected: protected:
void onDraw() override; void onDraw() override;
public: public:

View File

@ -23,7 +23,7 @@ ewol::widget::Composer::Composer() :
ewol::WidgetShared ewol::widget::composerGenerateFile(const etk::Uri& _uri, uint64_t _id) { ewol::WidgetShared ewol::widget::composerGenerateFile(const etk::Uri& _uri, uint64_t _id) {
etk::String tmpData; etk::String tmpData;
if (etk::uri::readAll(_uri, tmpData) == false) { if (etk::uri::readAll(_uri, tmpData) == false) {
EWOL_ERROR("Can not read the file: " << _uri); Log.error("Can not read the file: " << _uri);
return null; return null;
} }
return ewol::widget::composerGenerateString(tmpData, _id); return ewol::widget::composerGenerateString(tmpData, _id);
@ -41,12 +41,12 @@ ewol::WidgetShared ewol::widget::composerGenerateString(const etk::String& _data
tmpData.replace("{ID}", etk::toString(_id)); tmpData.replace("{ID}", etk::toString(_id));
} }
if (doc.parse(tmpData) == false) { if (doc.parse(tmpData) == false) {
EWOL_ERROR(" can not load file XML string..."); Log.error(" can not load file XML string...");
return null; return null;
} }
exml::Element root = doc.toElement(); exml::Element root = doc.toElement();
if (root.nodes.size() == 0) { if (root.nodes.size() == 0) {
EWOL_ERROR(" (l ?) No node in the XML file/string."); Log.error(" (l ?) No node in the XML file/string.");
return null; return null;
} }
if (root.nodes.size() > 1) { if (root.nodes.size() > 1) {
@ -54,15 +54,15 @@ ewol::WidgetShared ewol::widget::composerGenerateString(const etk::String& _data
} }
exml::Element pNode = root.nodes[0].toElement(); exml::Element pNode = root.nodes[0].toElement();
if (pNode.exist() == false) { if (pNode.exist() == false) {
EWOL_ERROR(" (l ?) No node in the XML file/string. {2}"); Log.error(" (l ?) No node in the XML file/string. {2}");
return null; return null;
} }
etk::String widgetName = pNode.getValue(); etk::String widgetName = pNode.getValue();
if (widgetManager.exist(widgetName) == false) { if (widgetManager.exist(widgetName) == false) {
EWOL_ERROR("(l " << pNode.getPos() << ") Unknown basic node='" << widgetName << "' not in : [" << widgetManager.list() << "]" ); Log.error("(l " << pNode.getPos() << ") Unknown basic node='" << widgetName << "' not in : [" << widgetManager.list() << "]" );
return null; return null;
} }
EWOL_DEBUG("try to create subwidget : '" << widgetName << "'"); Log.debug("try to create subwidget : '" << widgetName << "'");
ewol::WidgetShared tmpWidget = widgetManager.create(widgetName); ewol::WidgetShared tmpWidget = widgetManager.create(widgetName);
if (tmpWidget == null) { if (tmpWidget == null) {
EWOL_ERROR ("(l " << pNode.getPos() << ") Can not create the widget : '" << widgetName << "'"); EWOL_ERROR ("(l " << pNode.getPos() << ") Can not create the widget : '" << widgetName << "'");
@ -81,7 +81,7 @@ ewol::widget::Composer::~Composer() {
bool ewol::widget::Composer::loadFromFile(const etk::Uri& _uri, uint64_t _id) { bool ewol::widget::Composer::loadFromFile(const etk::Uri& _uri, uint64_t _id) {
etk::String tmpData; etk::String tmpData;
if (etk::uri::readAll(_uri, tmpData) == false) { if (etk::uri::readAll(_uri, tmpData) == false) {
EWOL_ERROR("Can not read the file: " << _uri); Log.error("Can not read the file: " << _uri);
return false; return false;
} }
return loadFromString(tmpData, _id); return loadFromString(tmpData, _id);
@ -95,7 +95,7 @@ bool ewol::widget::Composer::loadFromString(const etk::String& _composerXmlStrin
tmpData.replace("{ID}", etk::toString(_id)); tmpData.replace("{ID}", etk::toString(_id));
} }
if (doc.parse(tmpData) == false) { if (doc.parse(tmpData) == false) {
EWOL_ERROR(" can not load file XML string..."); Log.error(" can not load file XML string...");
return false; return false;
} }
exml::Element root = doc.nodes["composer"]; exml::Element root = doc.nodes["composer"];
@ -103,11 +103,11 @@ bool ewol::widget::Composer::loadFromString(const etk::String& _composerXmlStrin
// Maybe a multiple node XML for internal config: // Maybe a multiple node XML for internal config:
root = doc.toElement(); root = doc.toElement();
if (root.exist() == false) { if (root.exist() == false) {
EWOL_ERROR("[" << getId() << "] {" << getObjectType() << "} (l ?) main node not find: 'composer' ..."); Log.error("[" << getId() << "] {" << getObjectType() << "} (l ?) main node not find: 'composer' ...");
return false; return false;
} }
if (root.nodes.size() == 0) { if (root.nodes.size() == 0) {
EWOL_ERROR("[" << getId() << "] {" << getObjectType() << "} (l ?) no node in the Container XML element."); Log.error("[" << getId() << "] {" << getObjectType() << "} (l ?) no node in the Container XML element.");
return false; return false;
} }
} }
@ -116,7 +116,7 @@ bool ewol::widget::Composer::loadFromString(const etk::String& _composerXmlStrin
if (m_subWidget == null) { if (m_subWidget == null) {
EWOL_WARNING("Load data from composer and have no under Widget after loading"); EWOL_WARNING("Load data from composer and have no under Widget after loading");
if (_composerXmlString.size() != 0) { if (_composerXmlString.size() != 0) {
EWOL_ERROR("Error Loading XML data : " << _composerXmlString); Log.error("Error Loading XML data : " << _composerXmlString);
return false; return false;
} }
} }
@ -127,26 +127,26 @@ bool ewol::widget::Composer::loadFromString(const etk::String& _composerXmlStrin
void ewol::widget::Composer::requestDestroyFromChild(const ewol::ObjectShared& _child) { void ewol::widget::Composer::requestDestroyFromChild(const ewol::ObjectShared& _child) {
ewol::widget::Container::requestDestroyFromChild(_child); ewol::widget::Container::requestDestroyFromChild(_child);
if (*propertyRemoveIfUnderRemove == true) { if (*propertyRemoveIfUnderRemove == true) {
EWOL_DEBUG("Child widget remove ==> auto-remove"); Log.debug("Child widget remove ==> auto-remove");
autoDestroy(); autoDestroy();
} }
} }
void ewol::widget::Composer::onChangePropertySubFile() { void ewol::widget::Composer::onChangePropertySubFile() {
EWOL_INFO("Load compositing form external file : " << propertySubFile); Log.info("Load compositing form external file : " << propertySubFile);
if (*propertySubFile == "") { if (*propertySubFile == "") {
// remove all elements: // remove all elements:
subWidgetRemove(); subWidgetRemove();
return; return;
} }
if (loadFromFile(*propertySubFile, getId()) == false) { if (loadFromFile(*propertySubFile, getId()) == false) {
EWOL_ERROR("Can not load Player GUI from file ... " << propertySubFile); Log.error("Can not load Player GUI from file ... " << propertySubFile);
return; return;
} }
} }
bool ewol::widget::Composer::loadXML(const exml::Element& _node) { bool ewol::widget::Composer::loadXML(const exml::Element& _node) {
//EWOL_VERBOSE("[" << getId() << "] t=" << getObjectType() << " Load XML (start)"); //Log.verbose("[" << getId() << "] t=" << getObjectType() << " Load XML (start)");
if (_node.exist() == false) { if (_node.exist() == false) {
return false; return false;
} }
@ -154,9 +154,9 @@ bool ewol::widget::Composer::loadXML(const exml::Element& _node) {
ewol::Widget::loadXML(_node); ewol::Widget::loadXML(_node);
// parse all the elements: // parse all the elements:
if (_node.nodes.size() != 0) { if (_node.nodes.size() != 0) {
EWOL_ERROR("a composer Node Can not have Sub-element in XML ==> must be done in an external file and load it with attribute: 'sub-file'"); Log.error("a composer Node Can not have Sub-element in XML ==> must be done in an external file and load it with attribute: 'sub-file'");
} }
//drawWidgetTree(); //drawWidgetTree();
//EWOL_VERBOSE("[" << getId() << "] t=" << getObjectType() << " Load XML (stop)"); //Log.verbose("[" << getId() << "] t=" << getObjectType() << " Load XML (stop)");
return true; return true;
} }

View File

@ -90,10 +90,10 @@ void ewol::widget::Container::systemDraw(const ewol::DrawProperty& _displayProp)
if (m_subWidget != null) { if (m_subWidget != null) {
ewol::DrawProperty prop = _displayProp; ewol::DrawProperty prop = _displayProp;
prop.limit(m_origin, m_size); prop.limit(m_origin, m_size);
//EWOL_INFO("Draw : [" << propertyName << "] t=" << getObjectType() << " o=" << m_origin << " s=" << m_size); //Log.info("Draw : [" << propertyName << "] t=" << getObjectType() << " o=" << m_origin << " s=" << m_size);
m_subWidget->systemDraw(prop); m_subWidget->systemDraw(prop);
} else { } else {
EWOL_INFO("[" << getId() << "] ++++++ : [null]"); Log.info("[" << getId() << "] ++++++ : [null]");
} }
} }
@ -105,9 +105,9 @@ void ewol::widget::Container::onChangeSize() {
if (m_subWidget == null) { if (m_subWidget == null) {
return; return;
} }
vec2 origin = m_origin+m_offset; Vector2f origin = m_origin+m_offset;
vec2 minSize = m_subWidget->getCalculateMinSize(); Vector2f minSize = m_subWidget->getCalculateMinSize();
bvec2 expand = m_subWidget->propertyExpand.get(); Vector2b expand = m_subWidget->propertyExpand.get();
origin += ewol::gravityGenerateDelta(propertyGravity.get(), minSize - m_size); origin += ewol::gravityGenerateDelta(propertyGravity.get(), minSize - m_size);
m_subWidget->setOrigin(origin); m_subWidget->setOrigin(origin);
m_subWidget->setSize(m_size); m_subWidget->setSize(m_size);
@ -120,10 +120,10 @@ void ewol::widget::Container::calculateMinMaxSize() {
// call sub classes // call sub classes
if (m_subWidget != null) { if (m_subWidget != null) {
m_subWidget->calculateMinMaxSize(); m_subWidget->calculateMinMaxSize();
vec2 min = m_subWidget->getCalculateMinSize(); Vector2f min = m_subWidget->getCalculateMinSize();
m_minSize.setMax(min); m_minSize.setMax(min);
} }
//EWOL_ERROR("[" << getId() << "] Result min size : " << m_minSize); //Log.error("[" << getId() << "] Result min size : " << m_minSize);
} }
void ewol::widget::Container::onRegenerateDisplay() { void ewol::widget::Container::onRegenerateDisplay() {
@ -132,7 +132,7 @@ void ewol::widget::Container::onRegenerateDisplay() {
} }
} }
ewol::WidgetShared ewol::widget::Container::getWidgetAtPos(const vec2& _pos) { ewol::WidgetShared ewol::widget::Container::getWidgetAtPos(const Vector2f& _pos) {
if (propertyHide.get() == false) { if (propertyHide.get() == false) {
if (m_subWidget != null) { if (m_subWidget != null) {
return m_subWidget->getWidgetAtPos(_pos); return m_subWidget->getWidgetAtPos(_pos);
@ -157,16 +157,16 @@ bool ewol::widget::Container::loadXML(const exml::Element& _node) {
continue; continue;
} }
etk::String widgetName = pNode.getValue(); etk::String widgetName = pNode.getValue();
EWOL_VERBOSE("[" << getId() << "] t=" << getObjectType() << " Load node name : '" << widgetName << "'"); Log.verbose("[" << getId() << "] t=" << getObjectType() << " Load node name : '" << widgetName << "'");
if (getWidgetManager().exist(widgetName) == false) { if (getWidgetManager().exist(widgetName) == false) {
EWOL_ERROR("(l " << pNode.getPos() << ") Unknown basic node='" << widgetName << "' not in : [" << getWidgetManager().list() << "]" ); Log.error("(l " << pNode.getPos() << ") Unknown basic node='" << widgetName << "' not in : [" << getWidgetManager().list() << "]" );
continue; continue;
} }
if (getSubWidget() != null) { if (getSubWidget() != null) {
EWOL_ERROR("(l " << pNode.getPos() << ") Can only have one subWidget ??? node='" << widgetName << "'" ); Log.error("(l " << pNode.getPos() << ") Can only have one subWidget ??? node='" << widgetName << "'" );
continue; continue;
} }
EWOL_DEBUG("try to create subwidget : '" << widgetName << "'"); Log.debug("try to create subwidget : '" << widgetName << "'");
ewol::WidgetShared tmpWidget = getWidgetManager().create(widgetName, pNode); ewol::WidgetShared tmpWidget = getWidgetManager().create(widgetName, pNode);
if (tmpWidget == null) { if (tmpWidget == null) {
EWOL_ERROR ("(l " << pNode.getPos() << ") Can not create the widget : '" << widgetName << "'"); EWOL_ERROR ("(l " << pNode.getPos() << ") Can not create the widget : '" << widgetName << "'");
@ -186,7 +186,7 @@ bool ewol::widget::Container::loadXML(const exml::Element& _node) {
return true; return true;
} }
void ewol::widget::Container::setOffset(const vec2& _newVal) { void ewol::widget::Container::setOffset(const Vector2f& _newVal) {
if (m_offset != _newVal) { if (m_offset != _newVal) {
ewol::Widget::setOffset(_newVal); ewol::Widget::setOffset(_newVal);
// recalculate the new sise and position of sub widget ... // recalculate the new sise and position of sub widget ...

View File

@ -62,10 +62,10 @@ namespace ewol {
void onRegenerateDisplay() override; void onRegenerateDisplay() override;
void onChangeSize() override; void onChangeSize() override;
void calculateMinMaxSize() override; void calculateMinMaxSize() override;
ewol::WidgetShared getWidgetAtPos(const vec2& _pos) override; ewol::WidgetShared getWidgetAtPos(const Vector2f& _pos) override;
ewol::ObjectShared getSubObjectNamed(const etk::String& _objectName) override; ewol::ObjectShared getSubObjectNamed(const etk::String& _objectName) override;
bool loadXML(const exml::Element& _node) override; bool loadXML(const exml::Element& _node) override;
void setOffset(const vec2& _newVal) override; void setOffset(const Vector2f& _newVal) override;
void requestDestroyFromChild(const ewol::ObjectShared& _child) override; void requestDestroyFromChild(const ewol::ObjectShared& _child) override;
void drawWidgetTree(int32_t _level=0) override; void drawWidgetTree(int32_t _level=0) override;
}; };

View File

@ -26,7 +26,7 @@ void ewol::widget::Container2::setSubWidget(ewol::WidgetShared _newWidget, int32
subWidgetRemove(_idWidget); subWidgetRemove(_idWidget);
m_subWidget[_idWidget] = _newWidget; m_subWidget[_idWidget] = _newWidget;
if (m_subWidget[_idWidget] != null) { if (m_subWidget[_idWidget] != null) {
EWOL_VERBOSE("Add widget : " << _idWidget); Log.verbose("Add widget : " << _idWidget);
m_subWidget[_idWidget]->setParent(sharedFromThis()); m_subWidget[_idWidget]->setParent(sharedFromThis());
} }
markToRedraw(); markToRedraw();
@ -59,7 +59,7 @@ void ewol::widget::Container2::subWidgetReplace(const ewol::WidgetShared& _oldWi
void ewol::widget::Container2::subWidgetRemove(int32_t _idWidget) { void ewol::widget::Container2::subWidgetRemove(int32_t _idWidget) {
if (m_subWidget[_idWidget] != null) { if (m_subWidget[_idWidget] != null) {
EWOL_VERBOSE("Remove widget : " << _idWidget); Log.verbose("Remove widget : " << _idWidget);
m_subWidget[_idWidget]->removeParent(); m_subWidget[_idWidget]->removeParent();
m_subWidget[_idWidget].reset(); m_subWidget[_idWidget].reset();
markToRedraw(); markToRedraw();
@ -70,7 +70,7 @@ void ewol::widget::Container2::subWidgetRemove(int32_t _idWidget) {
void ewol::widget::Container2::subWidgetUnLink(int32_t _idWidget) { void ewol::widget::Container2::subWidgetUnLink(int32_t _idWidget) {
if (m_subWidget[_idWidget] != null) { if (m_subWidget[_idWidget] != null) {
m_subWidget[_idWidget]->removeParent(); m_subWidget[_idWidget]->removeParent();
EWOL_VERBOSE("Unlink widget : " << _idWidget); Log.verbose("Unlink widget : " << _idWidget);
} }
m_subWidget[_idWidget].reset(); m_subWidget[_idWidget].reset();
} }
@ -99,38 +99,38 @@ void ewol::widget::Container2::systemDraw(const ewol::DrawProperty& _displayProp
} }
ewol::Widget::systemDraw(_displayProp); ewol::Widget::systemDraw(_displayProp);
if (m_subWidget[m_idWidgetDisplayed] != null) { if (m_subWidget[m_idWidgetDisplayed] != null) {
//EWOL_INFO("Draw : [" << propertyName << "] t=" << getObjectType() << " o=" << m_origin << " s=" << m_size); //Log.info("Draw : [" << propertyName << "] t=" << getObjectType() << " o=" << m_origin << " s=" << m_size);
m_subWidget[m_idWidgetDisplayed]->systemDraw(_displayProp); m_subWidget[m_idWidgetDisplayed]->systemDraw(_displayProp);
} }
} }
ewol::Padding ewol::widget::Container2::onChangeSizePadded(const ewol::Padding& _padding) { ewol::Padding ewol::widget::Container2::onChangeSizePadded(const ewol::Padding& _padding) {
ewol::Widget::onChangeSize(); ewol::Widget::onChangeSize();
vec2 localAvaillable = m_size - vec2(_padding.x(), _padding.y()); Vector2f localAvaillable = m_size - Vector2f(_padding.x(), _padding.y());
// Checkin the filling properties == > for the subElements: // Checkin the filling properties == > for the subElements:
vec2 subElementSize = m_minSize; Vector2f subElementSize = m_minSize;
if (propertyFill->x() == true) { if (propertyFill->x() == true) {
subElementSize.setX(m_size.x()); subElementSize.setX(m_size.x());
} }
if (propertyFill->y() == true) { if (propertyFill->y() == true) {
subElementSize.setY(m_size.y()); subElementSize.setY(m_size.y());
} }
vec2 delta = ewol::gravityGenerateDelta(propertyGravity, m_size - subElementSize); Vector2f delta = ewol::gravityGenerateDelta(propertyGravity, m_size - subElementSize);
vec2 origin = delta + vec2(_padding.xLeft(), _padding.yButtom()); Vector2f origin = delta + Vector2f(_padding.xLeft(), _padding.yButtom());
subElementSize -= vec2(_padding.x(), _padding.y()); subElementSize -= Vector2f(_padding.x(), _padding.y());
for (size_t iii = 0; iii < 2; ++iii) { for (size_t iii = 0; iii < 2; ++iii) {
if (m_subWidget[iii] != null) { if (m_subWidget[iii] != null) {
vec2 origin2 = origin+m_offset; Vector2f origin2 = origin+m_offset;
vec2 minSize = m_subWidget[iii]->getCalculateMinSize(); Vector2f minSize = m_subWidget[iii]->getCalculateMinSize();
//bvec2 expand = m_subWidget[iii]->propertyExpand.get(); //Vector2b expand = m_subWidget[iii]->propertyExpand.get();
origin2 += ewol::gravityGenerateDelta(propertyGravity, minSize - localAvaillable); origin2 += ewol::gravityGenerateDelta(propertyGravity, minSize - localAvaillable);
m_subWidget[iii]->setOrigin(m_origin + origin); m_subWidget[iii]->setOrigin(m_origin + origin);
m_subWidget[iii]->setSize(subElementSize); m_subWidget[iii]->setSize(subElementSize);
m_subWidget[iii]->onChangeSize(); m_subWidget[iii]->onChangeSize();
} }
} }
vec2 selectableAreaPos = origin-vec2(_padding.xLeft(), _padding.yButtom()); Vector2f selectableAreaPos = origin-Vector2f(_padding.xLeft(), _padding.yButtom());
vec2 selectableAreaEndPos = m_size - (selectableAreaPos + subElementSize + vec2(_padding.x(), _padding.y())); Vector2f selectableAreaEndPos = m_size - (selectableAreaPos + subElementSize + Vector2f(_padding.x(), _padding.y()));
markToRedraw(); markToRedraw();
return ewol::Padding(selectableAreaPos.x(), return ewol::Padding(selectableAreaPos.x(),
selectableAreaEndPos.y(), selectableAreaEndPos.y(),
@ -140,17 +140,17 @@ ewol::Padding ewol::widget::Container2::onChangeSizePadded(const ewol::Padding&
void ewol::widget::Container2::calculateMinMaxSizePadded(const ewol::Padding& _padding) { void ewol::widget::Container2::calculateMinMaxSizePadded(const ewol::Padding& _padding) {
// call main class // call main class
m_minSize = vec2(0,0); m_minSize = Vector2f(0,0);
// call sub classes // call sub classes
for (size_t iii = 0; iii < 2; ++iii) { for (size_t iii = 0; iii < 2; ++iii) {
if (m_subWidget[iii] != null) { if (m_subWidget[iii] != null) {
m_subWidget[iii]->calculateMinMaxSize(); m_subWidget[iii]->calculateMinMaxSize();
vec2 min = m_subWidget[iii]->getCalculateMinSize(); Vector2f min = m_subWidget[iii]->getCalculateMinSize();
m_minSize.setMax(min); m_minSize.setMax(min);
} }
} }
// add padding : // add padding :
m_minSize += vec2(_padding.x(), _padding.y()); m_minSize += Vector2f(_padding.x(), _padding.y());
// verify the min max of the min size ... // verify the min max of the min size ...
checkMinSize(); checkMinSize();
markToRedraw(); markToRedraw();
@ -162,7 +162,7 @@ void ewol::widget::Container2::onRegenerateDisplay() {
} }
} }
/* /*
ewol::WidgetShared ewol::widget::Container2::getWidgetAtPos(const vec2& _pos) { ewol::WidgetShared ewol::widget::Container2::getWidgetAtPos(const Vector2f& _pos) {
if (isHide() == false) { if (isHide() == false) {
if (m_subWidget[m_idWidgetDisplayed] != null) { if (m_subWidget[m_idWidgetDisplayed] != null) {
return m_subWidget[m_idWidgetDisplayed]->getWidgetAtPos(_pos); return m_subWidget[m_idWidgetDisplayed]->getWidgetAtPos(_pos);
@ -180,10 +180,10 @@ bool ewol::widget::Container2::loadXML(const exml::Element& _node) {
ewol::Widget::loadXML(_node); ewol::Widget::loadXML(_node);
// remove previous element : // remove previous element :
subWidgetRemove(); subWidgetRemove();
EWOL_VERBOSE("Create en element 2 ... with nodes.size()=" << _node.nodes.size()); Log.verbose("Create en element 2 ... with nodes.size()=" << _node.nodes.size());
// parse all the elements: // parse all the elements:
for(const auto it : _node.nodes) { for(const auto it : _node.nodes) {
EWOL_VERBOSE(" node: " << it); Log.verbose(" node: " << it);
exml::Element pNode = it.toElement(); exml::Element pNode = it.toElement();
if (pNode.exist() == false) { if (pNode.exist() == false) {
// trash here all that is not element // trash here all that is not element
@ -191,18 +191,18 @@ bool ewol::widget::Container2::loadXML(const exml::Element& _node) {
} }
etk::String widgetName = pNode.getValue(); etk::String widgetName = pNode.getValue();
if (getWidgetManager().exist(widgetName) == false) { if (getWidgetManager().exist(widgetName) == false) {
EWOL_ERROR("(l " << pNode.getPos() << ") Unknown basic node='" << widgetName << "' not in: [" << getWidgetManager().list() << "]" ); Log.error("(l " << pNode.getPos() << ") Unknown basic node='" << widgetName << "' not in: [" << getWidgetManager().list() << "]" );
continue; continue;
} }
bool toogleMode=false; bool toogleMode=false;
if (getSubWidget() != null) { if (getSubWidget() != null) {
toogleMode=true; toogleMode=true;
if (getSubWidgetToggle() != null) { if (getSubWidgetToggle() != null) {
EWOL_ERROR("(l " << pNode.getPos() << ") Can only have one subWidget ??? node='" << widgetName << "'" ); Log.error("(l " << pNode.getPos() << ") Can only have one subWidget ??? node='" << widgetName << "'" );
continue; continue;
} }
} }
EWOL_DEBUG("try to create subwidget : '" << widgetName << "'"); Log.debug("try to create subwidget : '" << widgetName << "'");
ewol::WidgetShared tmpWidget = getWidgetManager().create(widgetName, pNode); ewol::WidgetShared tmpWidget = getWidgetManager().create(widgetName, pNode);
if (tmpWidget == null) { if (tmpWidget == null) {
EWOL_ERROR ("(l " << pNode.getPos() << ") Can not create the widget: '" << widgetName << "'"); EWOL_ERROR ("(l " << pNode.getPos() << ") Can not create the widget: '" << widgetName << "'");
@ -222,7 +222,7 @@ bool ewol::widget::Container2::loadXML(const exml::Element& _node) {
return true; return true;
} }
void ewol::widget::Container2::setOffset(const vec2& _newVal) { void ewol::widget::Container2::setOffset(const Vector2f& _newVal) {
if (m_offset != _newVal) { if (m_offset != _newVal) {
ewol::Widget::setOffset(_newVal); ewol::Widget::setOffset(_newVal);
// recalculate the new sise and position of sub widget ... // recalculate the new sise and position of sub widget ...

View File

@ -166,7 +166,7 @@ namespace ewol {
} }
ewol::ObjectShared getSubObjectNamed(const etk::String& _objectName) override; ewol::ObjectShared getSubObjectNamed(const etk::String& _objectName) override;
bool loadXML(const exml::Element& _node) override; bool loadXML(const exml::Element& _node) override;
void setOffset(const vec2& _newVal) override; void setOffset(const Vector2f& _newVal) override;
void requestDestroyFromChild(const ewol::ObjectShared& _child) override; void requestDestroyFromChild(const ewol::ObjectShared& _child) override;
void drawWidgetTree(int32_t _level=0) override; void drawWidgetTree(int32_t _level=0) override;
}; };

View File

@ -14,7 +14,7 @@ ETK_DECLARE_TYPE(ewol::widget::ContainerN);
ewol::widget::ContainerN::ContainerN() : ewol::widget::ContainerN::ContainerN() :
propertyLockExpand(this, "lock", propertyLockExpand(this, "lock",
vec2(false,false), Vector2f(false,false),
"Lock the subwidget expand", "Lock the subwidget expand",
&ewol::widget::ContainerN::onChangePropertyLockExpand), &ewol::widget::ContainerN::onChangePropertyLockExpand),
m_subExpend(false,false) { m_subExpend(false,false) {
@ -27,8 +27,8 @@ ewol::widget::ContainerN::~ContainerN() {
} }
bvec2 ewol::widget::ContainerN::canExpand() { Vector2b ewol::widget::ContainerN::canExpand() {
bvec2 res = propertyExpand.get(); Vector2b res = propertyExpand.get();
if (propertyLockExpand->x() == false) { if (propertyLockExpand->x() == false) {
if (m_subExpend.x() == true) { if (m_subExpend.x() == true) {
res.setX(true); res.setX(true);
@ -39,7 +39,7 @@ bvec2 ewol::widget::ContainerN::canExpand() {
res.setY(true); res.setY(true);
} }
} }
//EWOL_DEBUG("Expend check : user=" << m_userExpand << " lock=" << propertyLockExpand << " sub=" << m_subExpend << " res=" << res); //Log.debug("Expend check : user=" << m_userExpand << " lock=" << propertyLockExpand << " sub=" << m_subExpend << " res=" << res);
return res; return res;
} }
@ -73,7 +73,7 @@ void ewol::widget::ContainerN::subWidgetReplace(ewol::WidgetShared _oldWidget,
int32_t ewol::widget::ContainerN::subWidgetAdd(ewol::WidgetShared _newWidget) { int32_t ewol::widget::ContainerN::subWidgetAdd(ewol::WidgetShared _newWidget) {
if (_newWidget == null) { if (_newWidget == null) {
EWOL_ERROR("[" << getId() << "] {" << getObjectType() << "} Try to add An empty Widget ... "); Log.error("[" << getId() << "] {" << getObjectType() << "} Try to add An empty Widget ... ");
return -1; return -1;
} }
_newWidget->setParent(sharedFromThis()); _newWidget->setParent(sharedFromThis());
@ -86,7 +86,7 @@ int32_t ewol::widget::ContainerN::subWidgetAdd(ewol::WidgetShared _newWidget) {
int32_t ewol::widget::ContainerN::subWidgetAddStart(ewol::WidgetShared _newWidget) { int32_t ewol::widget::ContainerN::subWidgetAddStart(ewol::WidgetShared _newWidget) {
if (_newWidget == null) { if (_newWidget == null) {
EWOL_ERROR("[" << getId() << "] {" << getObjectType() << "} Try to add start An empty Widget ... "); Log.error("[" << getId() << "] {" << getObjectType() << "} Try to add start An empty Widget ... ");
return -1; return -1;
} }
if (_newWidget != null) { if (_newWidget != null) {
@ -179,7 +179,7 @@ void ewol::widget::ContainerN::systemDraw(const ewol::DrawProperty& _displayProp
prop.limit(m_origin, m_size); prop.limit(m_origin, m_size);
for (int64_t iii = m_subWidget.size()-1; iii>=0; --iii) { for (int64_t iii = m_subWidget.size()-1; iii>=0; --iii) {
if (m_subWidget[iii] != null) { if (m_subWidget[iii] != null) {
//EWOL_INFO(" ***** : [" << (*it)->propertyName << "] t=" << (*it)->getObjectType() << " o=" << (*it)->m_origin << " s=" << (*it)->m_size); //Log.info(" ***** : [" << (*it)->propertyName << "] t=" << (*it)->getObjectType() << " o=" << (*it)->m_origin << " s=" << (*it)->m_size);
m_subWidget[iii]->systemDraw(prop); m_subWidget[iii]->systemDraw(prop);
} }
} }
@ -200,23 +200,23 @@ void ewol::widget::ContainerN::calculateMinMaxSize() {
m_subExpend.setValue(false, false); m_subExpend.setValue(false, false);
m_minSize.setValue(0,0); m_minSize.setValue(0,0);
m_maxSize.setValue(ULTIMATE_MAX_SIZE,ULTIMATE_MAX_SIZE); m_maxSize.setValue(ULTIMATE_MAX_SIZE,ULTIMATE_MAX_SIZE);
//EWOL_ERROR("[" << getId() << "] {" << getObjectType() << "} set min size : " << m_minSize); //Log.error("[" << getId() << "] {" << getObjectType() << "} set min size : " << m_minSize);
for (auto &it : m_subWidget) { for (auto &it : m_subWidget) {
if (it != null) { if (it != null) {
it->calculateMinMaxSize(); it->calculateMinMaxSize();
bvec2 subExpendProp = it->canExpand(); Vector2b subExpendProp = it->canExpand();
if (true == subExpendProp.x()) { if (true == subExpendProp.x()) {
m_subExpend.setX(true); m_subExpend.setX(true);
} }
if (true == subExpendProp.y()) { if (true == subExpendProp.y()) {
m_subExpend.setY(true); m_subExpend.setY(true);
} }
vec2 tmpSize = it->getCalculateMinSize(); Vector2f tmpSize = it->getCalculateMinSize();
m_minSize.setValue( etk::max(tmpSize.x(), m_minSize.x()), m_minSize.setValue( etk::max(tmpSize.x(), m_minSize.x()),
etk::max(tmpSize.y(), m_minSize.y()) ); etk::max(tmpSize.y(), m_minSize.y()) );
} }
} }
//EWOL_ERROR("[" << getId() << "] {" << getObjectType() << "} Result min size : " << m_minSize); //Log.error("[" << getId() << "] {" << getObjectType() << "} Result min size : " << m_minSize);
} }
void ewol::widget::ContainerN::onRegenerateDisplay() { void ewol::widget::ContainerN::onRegenerateDisplay() {
@ -227,15 +227,15 @@ void ewol::widget::ContainerN::onRegenerateDisplay() {
} }
} }
ewol::WidgetShared ewol::widget::ContainerN::getWidgetAtPos(const vec2& _pos) { ewol::WidgetShared ewol::widget::ContainerN::getWidgetAtPos(const Vector2f& _pos) {
if (*propertyHide == true) { if (*propertyHide == true) {
return null; return null;
} }
// for all element in the sizer ... // for all element in the sizer ...
for (auto &it : m_subWidget) { for (auto &it : m_subWidget) {
if (it != null) { if (it != null) {
vec2 tmpSize = it->getSize(); Vector2f tmpSize = it->getSize();
vec2 tmpOrigin = it->getOrigin(); Vector2f tmpOrigin = it->getOrigin();
if( (tmpOrigin.x() <= _pos.x() && tmpOrigin.x() + tmpSize.x() >= _pos.x()) if( (tmpOrigin.x() <= _pos.x() && tmpOrigin.x() + tmpSize.x() >= _pos.x())
&& (tmpOrigin.y() <= _pos.y() && tmpOrigin.y() + tmpSize.y() >= _pos.y()) ) && (tmpOrigin.y() <= _pos.y() && tmpOrigin.y() + tmpSize.y() >= _pos.y()) )
{ {
@ -277,12 +277,12 @@ bool ewol::widget::ContainerN::loadXML(const exml::Element& _node) {
continue; continue;
} }
etk::String widgetName = pNode.getValue(); etk::String widgetName = pNode.getValue();
EWOL_VERBOSE(" t=" << getObjectType() << " Load node name : '" << widgetName << "'"); Log.verbose(" t=" << getObjectType() << " Load node name : '" << widgetName << "'");
if (getWidgetManager().exist(widgetName) == false) { if (getWidgetManager().exist(widgetName) == false) {
EWOL_ERROR("[" << getId() << "] {" << getObjectType() << "} (l " << pNode.getPos() << ") Unknown basic node='" << widgetName << "' not in : [" << getWidgetManager().list() << "]" ); Log.error("[" << getId() << "] {" << getObjectType() << "} (l " << pNode.getPos() << ") Unknown basic node='" << widgetName << "' not in : [" << getWidgetManager().list() << "]" );
continue; continue;
} }
EWOL_DEBUG("[" << getId() << "] {" << getObjectType() << "} load new element : '" << widgetName << "'"); Log.debug("[" << getId() << "] {" << getObjectType() << "} load new element : '" << widgetName << "'");
ewol::WidgetShared subWidget = getWidgetManager().create(widgetName, pNode); ewol::WidgetShared subWidget = getWidgetManager().create(widgetName, pNode);
if (subWidget == null) { if (subWidget == null) {
EWOL_ERROR ("[" << getId() << "] {" << getObjectType() << "} (l " << pNode.getPos() << ") Can not create the widget : '" << widgetName << "'"); EWOL_ERROR ("[" << getId() << "] {" << getObjectType() << "} (l " << pNode.getPos() << ") Can not create the widget : '" << widgetName << "'");
@ -295,7 +295,7 @@ bool ewol::widget::ContainerN::loadXML(const exml::Element& _node) {
subWidgetAddStart(subWidget); subWidgetAddStart(subWidget);
} }
if (subWidget->loadXML(pNode) == false) { if (subWidget->loadXML(pNode) == false) {
EWOL_ERROR("[" << getId() << "] {" << getObjectType() << "} (l " << pNode.getPos() << ") can not load widget properties : '" << widgetName << "'"); Log.error("[" << getId() << "] {" << getObjectType() << "} (l " << pNode.getPos() << ") can not load widget properties : '" << widgetName << "'");
return false; return false;
} }
} }
@ -303,7 +303,7 @@ bool ewol::widget::ContainerN::loadXML(const exml::Element& _node) {
} }
void ewol::widget::ContainerN::setOffset(const vec2& _newVal) { void ewol::widget::ContainerN::setOffset(const Vector2f& _newVal) {
if (m_offset != _newVal) { if (m_offset != _newVal) {
ewol::Widget::setOffset(_newVal); ewol::Widget::setOffset(_newVal);
// recalculate the new sise and position of sub widget ... // recalculate the new sise and position of sub widget ...

View File

@ -20,9 +20,9 @@ namespace ewol {
*/ */
class ContainerN : public ewol::Widget { class ContainerN : public ewol::Widget {
public: // properties: public: // properties:
eproperty::Value<bvec2> propertyLockExpand; //!< Lock the expend of the sub widget to this one == > this permit to limit bigger subWidget eproperty::Value<Vector2b> propertyLockExpand; //!< Lock the expend of the sub widget to this one == > this permit to limit bigger subWidget
protected: protected:
etk::Vector<ewol::WidgetShared> m_subWidget; List<ewol::WidgetShared> m_subWidget;
protected: protected:
/** /**
* @brief Constructor * @brief Constructor
@ -34,9 +34,9 @@ namespace ewol {
*/ */
virtual ~ContainerN(); virtual ~ContainerN();
protected: protected:
bvec2 m_subExpend; //!< reference of the sub element expention requested. Vector2b m_subExpend; //!< reference of the sub element expention requested.
// herited function // herited function
virtual bvec2 canExpand() override; virtual Vector2b canExpand() override;
public: public:
/** /**
* @brief remove all sub element from the widget. * @brief remove all sub element from the widget.
@ -92,10 +92,10 @@ namespace ewol {
void onRegenerateDisplay() override; void onRegenerateDisplay() override;
void onChangeSize() override; void onChangeSize() override;
void calculateMinMaxSize() override; void calculateMinMaxSize() override;
ewol::WidgetShared getWidgetAtPos(const vec2& _pos) override; ewol::WidgetShared getWidgetAtPos(const Vector2f& _pos) override;
ewol::ObjectShared getSubObjectNamed(const etk::String& _objectName) override; ewol::ObjectShared getSubObjectNamed(const etk::String& _objectName) override;
bool loadXML(const exml::Element& _node) override; bool loadXML(const exml::Element& _node) override;
void setOffset(const vec2& _newVal) override; void setOffset(const Vector2f& _newVal) override;
void requestDestroyFromChild(const ewol::ObjectShared& _child) override; void requestDestroyFromChild(const ewol::ObjectShared& _child) override;
void drawWidgetTree(int32_t _level=0) override; void drawWidgetTree(int32_t _level=0) override;
protected: protected:

View File

@ -22,7 +22,7 @@ ewol::widget::ContextMenu::ContextMenu():
"the display name for config file", "the display name for config file",
&ewol::widget::ContextMenu::onChangePropertyShape), &ewol::widget::ContextMenu::onChangePropertyShape),
propertyArrowPos(this, "arrow-position", propertyArrowPos(this, "arrow-position",
vec2(0,0), Vector2f(0,0),
"Position of the arrow in the pop-up", "Position of the arrow in the pop-up",
&ewol::widget::ContextMenu::onChangePropertyArrowPos), &ewol::widget::ContextMenu::onChangePropertyArrowPos),
propertyArrawBorder(this, "arrow-mode", propertyArrawBorder(this, "arrow-mode",
@ -59,12 +59,12 @@ void ewol::widget::ContextMenu::onChangeSize() {
markToRedraw(); markToRedraw();
// pop-up fill all the display : // pop-up fill all the display :
ewol::Padding padding = m_shaper.getPadding(); ewol::Padding padding = m_shaper.getPadding();
EWOL_VERBOSE("our origin=" << m_origin << " size=" << m_size); Log.verbose("our origin=" << m_origin << " size=" << m_size);
if (m_subWidget == null) { if (m_subWidget == null) {
return; return;
} }
vec2 subWidgetSize(0,0); Vector2f subWidgetSize(0,0);
vec2 subWidgetOrigin(0,0); Vector2f subWidgetOrigin(0,0);
subWidgetSize = m_subWidget->getCalculateMinSize(); subWidgetSize = m_subWidget->getCalculateMinSize();
if (m_subWidget->canExpand().x() == true) { if (m_subWidget->canExpand().x() == true) {
subWidgetSize.setX(m_size.x()); subWidgetSize.setX(m_size.x());
@ -115,7 +115,7 @@ void ewol::widget::ContextMenu::onChangeSize() {
} }
break; break;
} }
EWOL_VERBOSE(" == > sub origin=" << subWidgetOrigin << " size=" << subWidgetSize); Log.verbose(" == > sub origin=" << subWidgetOrigin << " size=" << subWidgetSize);
m_subWidget->setOrigin(subWidgetOrigin); m_subWidget->setOrigin(subWidgetOrigin);
m_subWidget->setSize(subWidgetSize); m_subWidget->setSize(subWidgetSize);
m_subWidget->onChangeSize(); m_subWidget->onChangeSize();
@ -127,8 +127,8 @@ void ewol::widget::ContextMenu::calculateMinMaxSize() {
ewol::widget::Container::calculateMinMaxSize(); ewol::widget::Container::calculateMinMaxSize();
// add padding of the display // add padding of the display
ewol::Padding padding = m_shaper.getPadding(); ewol::Padding padding = m_shaper.getPadding();
m_minSize += vec2(padding.x(), padding.y()); m_minSize += Vector2f(padding.x(), padding.y());
//EWOL_DEBUG("CalculateMinSize=>>" << m_minSize); //Log.debug("CalculateMinSize=>>" << m_minSize);
markToRedraw(); markToRedraw();
} }
@ -152,57 +152,57 @@ void ewol::widget::ContextMenu::onRegenerateDisplay() {
if (m_subWidget == null) { if (m_subWidget == null) {
return; return;
} }
vec2 tmpSize = m_subWidget->getSize(); Vector2f tmpSize = m_subWidget->getSize();
vec2 tmpOrigin = m_subWidget->getOrigin(); Vector2f tmpOrigin = m_subWidget->getOrigin();
// display border ... // display border ...
m_compositing.setColor(m_colorBorder); m_compositing.setColor(m_colorBorder);
switch (propertyArrawBorder) { switch (propertyArrawBorder) {
case markTop: case markTop:
m_compositing.setPos(vec3(propertyArrowPos->x(), propertyArrowPos->y(), 0.0f) ); m_compositing.setPos(Vector3f(propertyArrowPos->x(), propertyArrowPos->y(), 0.0f) );
m_compositing.addVertex(); m_compositing.addVertex();
if (propertyArrowPos->x() <= tmpOrigin.x() ) { if (propertyArrowPos->x() <= tmpOrigin.x() ) {
float laking = m_offset - padding.yTop(); float laking = m_offset - padding.yTop();
m_compositing.setPos(vec3(propertyArrowPos->x()+laking, propertyArrowPos->y()-laking, 0.0f) ); m_compositing.setPos(Vector3f(propertyArrowPos->x()+laking, propertyArrowPos->y()-laking, 0.0f) );
m_compositing.addVertex(); m_compositing.addVertex();
m_compositing.setPos(vec3(propertyArrowPos->x(), propertyArrowPos->y()-laking, 0.0f) ); m_compositing.setPos(Vector3f(propertyArrowPos->x(), propertyArrowPos->y()-laking, 0.0f) );
m_compositing.addVertex(); m_compositing.addVertex();
} else { } else {
float laking = m_offset - padding.yTop(); float laking = m_offset - padding.yTop();
m_compositing.setPos(vec3(propertyArrowPos->x()+laking, propertyArrowPos->y()-laking, 0.0f) ); m_compositing.setPos(Vector3f(propertyArrowPos->x()+laking, propertyArrowPos->y()-laking, 0.0f) );
m_compositing.addVertex(); m_compositing.addVertex();
m_compositing.setPos(vec3(propertyArrowPos->x()-laking, propertyArrowPos->y()-laking, 0.0f) ); m_compositing.setPos(Vector3f(propertyArrowPos->x()-laking, propertyArrowPos->y()-laking, 0.0f) );
m_compositing.addVertex(); m_compositing.addVertex();
} }
break; break;
case markButtom: case markButtom:
m_compositing.setPos(vec3(propertyArrowPos->x(), propertyArrowPos->y(), 0) ); m_compositing.setPos(Vector3f(propertyArrowPos->x(), propertyArrowPos->y(), 0) );
m_compositing.addVertex(); m_compositing.addVertex();
if (propertyArrowPos->x() <= tmpOrigin.x() ) { if (propertyArrowPos->x() <= tmpOrigin.x() ) {
int32_t laking = m_offset - padding.yTop(); int32_t laking = m_offset - padding.yTop();
m_compositing.setPos(vec3(propertyArrowPos->x()+laking, propertyArrowPos->y()+laking, 0.0f) ); m_compositing.setPos(Vector3f(propertyArrowPos->x()+laking, propertyArrowPos->y()+laking, 0.0f) );
m_compositing.addVertex(); m_compositing.addVertex();
m_compositing.setPos(vec3(propertyArrowPos->x(), propertyArrowPos->y()+laking, 0.0f) ); m_compositing.setPos(Vector3f(propertyArrowPos->x(), propertyArrowPos->y()+laking, 0.0f) );
m_compositing.addVertex(); m_compositing.addVertex();
} else { } else {
int32_t laking = m_offset - padding.yTop(); int32_t laking = m_offset - padding.yTop();
m_compositing.setPos(vec3(propertyArrowPos->x()+laking, propertyArrowPos->y()+laking, 0.0f) ); m_compositing.setPos(Vector3f(propertyArrowPos->x()+laking, propertyArrowPos->y()+laking, 0.0f) );
m_compositing.addVertex(); m_compositing.addVertex();
m_compositing.setPos(vec3(propertyArrowPos->x()-laking, propertyArrowPos->y()+laking, 0.0f) ); m_compositing.setPos(Vector3f(propertyArrowPos->x()-laking, propertyArrowPos->y()+laking, 0.0f) );
m_compositing.addVertex(); m_compositing.addVertex();
} }
break; break;
default: default:
case markRight: case markRight:
case markLeft: case markLeft:
EWOL_TODO("later"); Log.todo("later");
break; break;
} }
vec2 shaperOrigin = tmpOrigin-vec2(padding.xLeft(), padding.yButtom()); Vector2f shaperOrigin = tmpOrigin-Vector2f(padding.xLeft(), padding.yButtom());
vec2 shaperSize = tmpSize+vec2(padding.x(), padding.y()); Vector2f shaperSize = tmpSize+Vector2f(padding.x(), padding.y());
m_shaper.setShape(vec2ClipInt32(shaperOrigin), m_shaper.setShape(Vector2fClipInt32(shaperOrigin),
vec2ClipInt32(shaperSize)); Vector2fClipInt32(shaperSize));
} }
bool ewol::widget::ContextMenu::onEventInput(const ewol::event::Input& _event) { bool ewol::widget::ContextMenu::onEventInput(const ewol::event::Input& _event) {
@ -224,7 +224,7 @@ bool ewol::widget::ContextMenu::onEventInput(const ewol::event::Input& _event) {
return false; return false;
} }
ewol::WidgetShared ewol::widget::ContextMenu::getWidgetAtPos(const vec2& _pos) { ewol::WidgetShared ewol::widget::ContextMenu::getWidgetAtPos(const Vector2f& _pos) {
ewol::WidgetShared val = ewol::widget::Container::getWidgetAtPos(_pos); ewol::WidgetShared val = ewol::widget::Container::getWidgetAtPos(_pos);
if (val != null) { if (val != null) {
return val; return val;
@ -246,21 +246,21 @@ void ewol::widget::ContextMenu::onChangePropertyShape() {
} }
void ewol::widget::ContextMenu::setPositionMarkAuto(const vec2& _origin, const vec2& _size) { void ewol::widget::ContextMenu::setPositionMarkAuto(const Vector2f& _origin, const Vector2f& _size) {
ewol::widget::WindowsShared windows = getWindows(); ewol::widget::WindowsShared windows = getWindows();
vec2 globalSize = windows->getSize(); Vector2f globalSize = windows->getSize();
// TODO : Support left and right // TODO : Support left and right
float upperSize = globalSize.y() - (_origin.y() + _size.y()); float upperSize = globalSize.y() - (_origin.y() + _size.y());
float underSize = _origin.y(); float underSize = _origin.y();
if (underSize >= upperSize) { if (underSize >= upperSize) {
vec2 pos = _origin + _size - vec2(_size.x()*0.5f, 0.0f); Vector2f pos = _origin + _size - Vector2f(_size.x()*0.5f, 0.0f);
setPositionMark(ewol::widget::ContextMenu::markButtom, pos); setPositionMark(ewol::widget::ContextMenu::markButtom, pos);
} else { } else {
vec2 pos = _origin + vec2(_size.x()*0.5f, 0.0f); Vector2f pos = _origin + Vector2f(_size.x()*0.5f, 0.0f);
setPositionMark(ewol::widget::ContextMenu::markTop, pos); setPositionMark(ewol::widget::ContextMenu::markTop, pos);
} }
} }
void ewol::widget::ContextMenu::setPositionMark(enum markPosition _position, const vec2& _arrowPos) { void ewol::widget::ContextMenu::setPositionMark(enum markPosition _position, const Vector2f& _arrowPos) {
propertyArrawBorder.set(_position); propertyArrawBorder.set(_position);
propertyArrowPos.set(_arrowPos); propertyArrowPos.set(_arrowPos);
} }

View File

@ -32,7 +32,7 @@ namespace ewol {
}; };
public: // properties public: // properties
eproperty::Value<etk::Uri> propertyShape; //!< shape of the widget. eproperty::Value<etk::Uri> propertyShape; //!< shape of the widget.
eproperty::Value<vec2> propertyArrowPos; eproperty::Value<Vector2f> propertyArrowPos;
eproperty::List<enum markPosition> propertyArrawBorder; eproperty::List<enum markPosition> propertyArrawBorder;
protected: protected:
ContextMenu(); ContextMenu();
@ -50,8 +50,8 @@ namespace ewol {
float m_offset; float m_offset;
public: public:
void setPositionMarkAuto(const vec2& _origin, const vec2& _size); void setPositionMarkAuto(const Vector2f& _origin, const Vector2f& _size);
void setPositionMark(enum markPosition _position, const vec2& _arrowPos); void setPositionMark(enum markPosition _position, const Vector2f& _arrowPos);
protected: protected:
void onDraw() override; void onDraw() override;
public: public:
@ -59,7 +59,7 @@ namespace ewol {
bool onEventInput(const ewol::event::Input& _event) override; bool onEventInput(const ewol::event::Input& _event) override;
void onChangeSize() override; void onChangeSize() override;
void calculateMinMaxSize() override; void calculateMinMaxSize() override;
ewol::WidgetShared getWidgetAtPos(const vec2& _pos) override; ewol::WidgetShared getWidgetAtPos(const Vector2f& _pos) override;
protected: protected:
virtual void onChangePropertyArrowPos(); virtual void onChangePropertyArrowPos();
virtual void onChangePropertyArrawBorder(); virtual void onChangePropertyArrawBorder();

View File

@ -61,7 +61,7 @@ void ewol::widget::Entry::init() {
m_regex.compile(propertyRegex.get()); m_regex.compile(propertyRegex.get());
if (m_regex.getStatus() == false) { if (m_regex.getStatus() == false) {
EWOL_ERROR("can not parse regex for : " << propertyRegex); Log.error("can not parse regex for : " << propertyRegex);
} }
markToRedraw(); markToRedraw();
@ -104,9 +104,9 @@ void ewol::widget::Entry::calculateMinMaxSize() {
// get generic padding // get generic padding
ewol::Padding padding = m_shaper.getPadding(); ewol::Padding padding = m_shaper.getPadding();
int32_t minHeight = m_text.calculateSize(char32_t('A')).y(); int32_t minHeight = m_text.calculateSize(char32_t('A')).y();
vec2 minimumSizeBase(20, minHeight); Vector2f minimumSizeBase(20, minHeight);
// add padding : // add padding :
minimumSizeBase += vec2(padding.x(), padding.y()); minimumSizeBase += Vector2f(padding.x(), padding.y());
m_minSize.setMax(minimumSizeBase); m_minSize.setMax(minimumSizeBase);
// verify the min max of the min size ... // verify the min max of the min size ...
checkMinSize(); checkMinSize();
@ -132,7 +132,7 @@ void ewol::widget::Entry::onRegenerateDisplay() {
updateTextPosition(); updateTextPosition();
ewol::Padding padding = m_shaper.getPadding(); ewol::Padding padding = m_shaper.getPadding();
vec2 tmpSizeShaper = m_minSize; Vector2f tmpSizeShaper = m_minSize;
if (propertyFill->x() == true) { if (propertyFill->x() == true) {
tmpSizeShaper.setX(m_size.x()); tmpSizeShaper.setX(m_size.x());
} }
@ -140,23 +140,23 @@ void ewol::widget::Entry::onRegenerateDisplay() {
tmpSizeShaper.setY(m_size.y()); tmpSizeShaper.setY(m_size.y());
} }
vec2 tmpOriginShaper = (m_size - tmpSizeShaper) / 2.0f; Vector2f tmpOriginShaper = (m_size - tmpSizeShaper) / 2.0f;
vec2 tmpSizeText = tmpSizeShaper - vec2(padding.x(), padding.y()); Vector2f tmpSizeText = tmpSizeShaper - Vector2f(padding.x(), padding.y());
vec2 tmpOriginText = (m_size - tmpSizeText) / 2.0f; Vector2f tmpOriginText = (m_size - tmpSizeText) / 2.0f;
// sometimes, the user define an height bigger than the real size needed == > in this case we need to center the text in the shaper ... // sometimes, the user define an height bigger than the real size needed == > in this case we need to center the text in the shaper ...
int32_t minHeight = m_text.calculateSize(char32_t('A')).y(); int32_t minHeight = m_text.calculateSize(char32_t('A')).y();
if (tmpSizeText.y() > minHeight) { if (tmpSizeText.y() > minHeight) {
tmpOriginText += vec2(0,(tmpSizeText.y()-minHeight)/2.0f); tmpOriginText += Vector2f(0,(tmpSizeText.y()-minHeight)/2.0f);
} }
// fix all the position in the int32_t class: // fix all the position in the int32_t class:
tmpSizeShaper = vec2ClipInt32(tmpSizeShaper); tmpSizeShaper = Vector2fClipInt32(tmpSizeShaper);
tmpOriginShaper = vec2ClipInt32(tmpOriginShaper); tmpOriginShaper = Vector2fClipInt32(tmpOriginShaper);
tmpSizeText = vec2ClipInt32(tmpSizeText); tmpSizeText = Vector2fClipInt32(tmpSizeText);
tmpOriginText = vec2ClipInt32(tmpOriginText); tmpOriginText = Vector2fClipInt32(tmpOriginText);
m_text.reset(); m_text.reset();
m_text.setClippingWidth(tmpOriginText, tmpSizeText); m_text.setClippingWidth(tmpOriginText, tmpSizeText);
m_text.setPos(tmpOriginText+vec2(m_displayStartPosition,0)); m_text.setPos(tmpOriginText+Vector2f(m_displayStartPosition,0));
if (m_displayCursorPosSelection != m_displayCursorPos) { if (m_displayCursorPosSelection != m_displayCursorPos) {
m_text.setCursorSelection(m_displayCursorPos, m_displayCursorPosSelection); m_text.setCursorSelection(m_displayCursorPos, m_displayCursorPosSelection);
} else { } else {
@ -183,15 +183,15 @@ void ewol::widget::Entry::onRegenerateDisplay() {
} }
void ewol::widget::Entry::updateCursorPosition(const vec2& _pos, bool _selection) { void ewol::widget::Entry::updateCursorPosition(const Vector2f& _pos, bool _selection) {
ewol::Padding padding = m_shaper.getPadding(); ewol::Padding padding = m_shaper.getPadding();
vec2 relPos = relativePosition(_pos); Vector2f relPos = relativePosition(_pos);
relPos.setX(relPos.x()-m_displayStartPosition - padding.xLeft()); relPos.setX(relPos.x()-m_displayStartPosition - padding.xLeft());
// try to find the new cursor position : // try to find the new cursor position :
etk::String tmpDisplay = etk::String(propertyValue, 0, m_displayStartPosition); etk::String tmpDisplay = etk::String(propertyValue, 0, m_displayStartPosition);
int32_t displayHidenSize = m_text.calculateSize(tmpDisplay).x(); int32_t displayHidenSize = m_text.calculateSize(tmpDisplay).x();
//EWOL_DEBUG("hidenSize : " << displayHidenSize); //Log.debug("hidenSize : " << displayHidenSize);
int32_t newCursorPosition = -1; int32_t newCursorPosition = -1;
int32_t tmpTextOriginX = padding.xLeft(); int32_t tmpTextOriginX = padding.xLeft();
for (size_t iii=0; iii<propertyValue->size(); iii++) { for (size_t iii=0; iii<propertyValue->size(); iii++) {
@ -375,9 +375,9 @@ bool ewol::widget::Entry::onEventEntry(const ewol::event::Entry& _event) {
m_displayCursorPosSelection = m_displayCursorPos; m_displayCursorPosSelection = m_displayCursorPos;
} }
} else if(_event.getChar() >= 20) { } else if(_event.getChar() >= 20) {
EWOL_ERROR("get data: '" << _event.getChar() << "' = '" << u32char::convertToUtf8(_event.getChar()) << "'"); Log.error("get data: '" << _event.getChar() << "' = '" << u32char::convertToUtf8(_event.getChar()) << "'");
if ((int64_t)propertyValue->size() > propertyMaxCharacter) { if ((int64_t)propertyValue->size() > propertyMaxCharacter) {
EWOL_INFO("Reject data for entry : '" << _event.getChar() << "'"); Log.info("Reject data for entry : '" << _event.getChar() << "'");
} else { } else {
etk::String newData = propertyValue; etk::String newData = propertyValue;
etk::String inputData = u32char::convertToUtf8(_event.getChar()); etk::String inputData = u32char::convertToUtf8(_event.getChar());
@ -427,15 +427,15 @@ void ewol::widget::Entry::setInternalValue(const etk::String& _newData) {
if (_newData.size()>0) { if (_newData.size()>0) {
/* /*
if (m_regex.parse(_newData, 0, _newData.size()) == false) { if (m_regex.parse(_newData, 0, _newData.size()) == false) {
EWOL_INFO("The input data does not match with the regExp '" << _newData << "' Regex='" << propertyRegex << "'" ); Log.info("The input data does not match with the regExp '" << _newData << "' Regex='" << propertyRegex << "'" );
return; return;
} }
if (m_regex.start() != 0) { if (m_regex.start() != 0) {
EWOL_INFO("The input data does not match with the regExp '" << _newData << "' Regex='" << propertyRegex << "' (start position error)" ); Log.info("The input data does not match with the regExp '" << _newData << "' Regex='" << propertyRegex << "' (start position error)" );
return; return;
} }
if (m_regex.stop() != _newData.size()) { if (m_regex.stop() != _newData.size()) {
EWOL_INFO("The input data does not match with the regExp '" << _newData << "' Regex='" << propertyRegex << "' (stop position error)" ); Log.info("The input data does not match with the regExp '" << _newData << "' Regex='" << propertyRegex << "' (stop position error)" );
return; return;
} }
*/ */
@ -525,7 +525,7 @@ void ewol::widget::Entry::updateTextPosition() {
int32_t pixelCursorPos = m_text.calculateSize(tmpDisplay).x(); int32_t pixelCursorPos = m_text.calculateSize(tmpDisplay).x();
// check if the Cussor is visible at 10px nearest the border : // check if the Cussor is visible at 10px nearest the border :
int32_t tmp1 = pixelCursorPos+m_displayStartPosition; int32_t tmp1 = pixelCursorPos+m_displayStartPosition;
EWOL_DEBUG("cursorPos=" << pixelCursorPos << "px maxSize=" << tmpUserSize << "px tmp1=" << tmp1); Log.debug("cursorPos=" << pixelCursorPos << "px maxSize=" << tmpUserSize << "px tmp1=" << tmp1);
if (tmp1<10) { if (tmp1<10) {
// set the cursor on le left // set the cursor on le left
m_displayStartPosition = etk::min(-pixelCursorPos+10, 0); m_displayStartPosition = etk::min(-pixelCursorPos+10, 0);
@ -582,14 +582,14 @@ void ewol::widget::Entry::onChangePropertyValue() {
etk::String newData = propertyValue.get(); etk::String newData = propertyValue.get();
if ((int64_t)newData.size() > propertyMaxCharacter) { if ((int64_t)newData.size() > propertyMaxCharacter) {
newData = etk::String(newData, 0, propertyMaxCharacter); newData = etk::String(newData, 0, propertyMaxCharacter);
EWOL_DEBUG("Limit entry set of data... " << etk::String(newData, propertyMaxCharacter)); Log.debug("Limit entry set of data... " << etk::String(newData, propertyMaxCharacter));
} }
// set the value with the check of the RegExp ... // set the value with the check of the RegExp ...
setInternalValue(newData); setInternalValue(newData);
if (newData == propertyValue.get()) { if (newData == propertyValue.get()) {
m_displayCursorPos = propertyValue->size(); m_displayCursorPos = propertyValue->size();
m_displayCursorPosSelection = m_displayCursorPos; m_displayCursorPosSelection = m_displayCursorPos;
EWOL_VERBOSE("Set : '" << newData << "'"); Log.verbose("Set : '" << newData << "'");
} }
markToRedraw(); markToRedraw();
} }
@ -601,7 +601,7 @@ void ewol::widget::Entry::onChangePropertyMaxCharacter() {
void ewol::widget::Entry::onChangePropertyRegex() { void ewol::widget::Entry::onChangePropertyRegex() {
m_regex.compile(propertyRegex.get()); m_regex.compile(propertyRegex.get());
if (m_regex.getStatus() == false) { if (m_regex.getStatus() == false) {
EWOL_ERROR("can not parse regex for : " << propertyRegex); Log.error("can not parse regex for : " << propertyRegex);
} }
markToRedraw(); markToRedraw();
} }

View File

@ -92,7 +92,7 @@ namespace ewol {
* @param[in] _pos Absolute position of the event * @param[in] _pos Absolute position of the event
* @note The display is automaticly requested when change apear. * @note The display is automaticly requested when change apear.
*/ */
virtual void updateCursorPosition(const vec2& _pos, bool _Selection=false); virtual void updateCursorPosition(const Vector2f& _pos, bool _Selection=false);
public: public:
/** /**
* @brief Copy the selected data on the specify clipboard * @brief Copy the selected data on the specify clipboard

View File

@ -21,18 +21,18 @@ ewol::widget::Gird::Gird() :
} }
ewol::widget::Gird::~Gird() { ewol::widget::Gird::~Gird() {
EWOL_DEBUG("[" << getId() << "]={" << getObjectType() << "} Gird : destroy"); Log.debug("[" << getId() << "]={" << getObjectType() << "} Gird : destroy");
subWidgetRemoveAll(); subWidgetRemoveAll();
} }
void ewol::widget::Gird::setBorderSize(const ivec2& _newBorderSize) { void ewol::widget::Gird::setBorderSize(const Vector2i& _newBorderSize) {
m_borderSize = _newBorderSize; m_borderSize = _newBorderSize;
if (m_borderSize.x() < 0) { if (m_borderSize.x() < 0) {
EWOL_ERROR("Try to set a border size <0 on x : " << m_borderSize.x() << " == > restore to 0"); Log.error("Try to set a border size <0 on x : " << m_borderSize.x() << " == > restore to 0");
m_borderSize.setX(0); m_borderSize.setX(0);
} }
if (m_borderSize.y() < 0) { if (m_borderSize.y() < 0) {
EWOL_ERROR("Try to set a border size <0 on y : " << m_borderSize.y() << " == > restore to 0"); Log.error("Try to set a border size <0 on y : " << m_borderSize.y() << " == > restore to 0");
m_borderSize.setY(0); m_borderSize.setY(0);
} }
markToRedraw(); markToRedraw();
@ -40,15 +40,15 @@ void ewol::widget::Gird::setBorderSize(const ivec2& _newBorderSize) {
} }
void ewol::widget::Gird::onChangeSize() { void ewol::widget::Gird::onChangeSize() {
//EWOL_DEBUG("Update size"); //Log.debug("Update size");
m_size -= m_borderSize*2; m_size -= m_borderSize*2;
for (size_t iii=0; iii<m_subWidget.size(); iii++) { for (size_t iii=0; iii<m_subWidget.size(); iii++) {
if (m_subWidget[iii].widget != null) { if (m_subWidget[iii].widget != null) {
//calculate the origin : //calculate the origin :
vec2 tmpOrigin = m_origin + m_borderSize; Vector2f tmpOrigin = m_origin + m_borderSize;
if (false == m_gavityButtom) { if (false == m_gavityButtom) {
tmpOrigin += vec2(0, m_size.y()-m_borderSize.y()); tmpOrigin += Vector2f(0, m_size.y()-m_borderSize.y());
} }
int32_t tmpSizeWidth = 0; int32_t tmpSizeWidth = 0;
@ -62,18 +62,18 @@ void ewol::widget::Gird::onChangeSize() {
} else { } else {
addingPos = -(m_subWidget[iii].row+1)*m_uniformSizeRow; addingPos = -(m_subWidget[iii].row+1)*m_uniformSizeRow;
} }
tmpOrigin += vec2(tmpSizeWidth, addingPos); tmpOrigin += Vector2f(tmpSizeWidth, addingPos);
EWOL_DEBUG(" [" << iii << "] set subwidget origin=" <<tmpOrigin << " size=" << ivec2(abs(m_sizeCol[m_subWidget[iii].col]), m_uniformSizeRow) ); Log.debug(" [" << iii << "] set subwidget origin=" <<tmpOrigin << " size=" << Vector2i(abs(m_sizeCol[m_subWidget[iii].col]), m_uniformSizeRow) );
// set the origin : // set the origin :
m_subWidget[iii].widget->setOrigin(vec2ClipInt32(tmpOrigin)); m_subWidget[iii].widget->setOrigin(Vector2fClipInt32(tmpOrigin));
// all time set oll the space . // all time set oll the space .
m_subWidget[iii].widget->setSize(vec2ClipInt32(vec2(abs(m_sizeCol[m_subWidget[iii].col]), m_uniformSizeRow))); m_subWidget[iii].widget->setSize(Vector2fClipInt32(Vector2f(abs(m_sizeCol[m_subWidget[iii].col]), m_uniformSizeRow)));
m_subWidget[iii].widget->onChangeSize(); m_subWidget[iii].widget->onChangeSize();
} }
} }
m_size += m_borderSize*2; m_size += m_borderSize*2;
EWOL_DEBUG("Calculate size : " << m_size); Log.debug("Calculate size : " << m_size);
markToRedraw(); markToRedraw();
} }
@ -83,7 +83,7 @@ void ewol::widget::Gird::calculateMinMaxSize() {
m_sizeCol[iii] = 0; m_sizeCol[iii] = 0;
} }
} }
//EWOL_DEBUG("Update minimum size"); //Log.debug("Update minimum size");
m_minSize = propertyMinSize->getPixel(); m_minSize = propertyMinSize->getPixel();
m_maxSize = propertyMaxSize->getPixel(); m_maxSize = propertyMaxSize->getPixel();
m_uniformSizeRow = 0; m_uniformSizeRow = 0;
@ -96,8 +96,8 @@ void ewol::widget::Gird::calculateMinMaxSize() {
} }
if (m_subWidget[iii].widget != null) { if (m_subWidget[iii].widget != null) {
m_subWidget[iii].widget->calculateMinMaxSize(); m_subWidget[iii].widget->calculateMinMaxSize();
vec2 tmpSize = m_subWidget[iii].widget->getCalculateMinSize(); Vector2f tmpSize = m_subWidget[iii].widget->getCalculateMinSize();
EWOL_DEBUG(" [" << iii << "] subWidgetMinSize=" << tmpSize); Log.debug(" [" << iii << "] subWidgetMinSize=" << tmpSize);
// for all we get the max size : // for all we get the max size :
m_uniformSizeRow = etk::max((int32_t)tmpSize.y(), m_uniformSizeRow); m_uniformSizeRow = etk::max((int32_t)tmpSize.y(), m_uniformSizeRow);
// for the colomn size : We set the autamatic value in negative : // for the colomn size : We set the autamatic value in negative :
@ -114,13 +114,13 @@ void ewol::widget::Gird::calculateMinMaxSize() {
for (size_t iii=0; iii<m_sizeCol.size(); iii++ ){ for (size_t iii=0; iii<m_sizeCol.size(); iii++ ){
tmpSizeWidth += abs(m_sizeCol[iii]); tmpSizeWidth += abs(m_sizeCol[iii]);
} }
EWOL_DEBUG(" tmpSizeWidth=" << tmpSizeWidth); Log.debug(" tmpSizeWidth=" << tmpSizeWidth);
EWOL_DEBUG(" m_uniformSizeRow=" << m_uniformSizeRow); Log.debug(" m_uniformSizeRow=" << m_uniformSizeRow);
m_minSize += ivec2(tmpSizeWidth, (lastLineID+1)*m_uniformSizeRow); m_minSize += Vector2i(tmpSizeWidth, (lastLineID+1)*m_uniformSizeRow);
EWOL_DEBUG("Calculate min size : " << m_minSize); Log.debug("Calculate min size : " << m_minSize);
//EWOL_DEBUG("Vert Result : expand="<< m_userExpand << " minSize="<< m_minSize); //Log.debug("Vert Result : expand="<< m_userExpand << " minSize="<< m_minSize);
} }
void ewol::widget::Gird::setColNumber(int32_t _colNumber) { void ewol::widget::Gird::setColNumber(int32_t _colNumber) {
@ -134,7 +134,7 @@ void ewol::widget::Gird::setColNumber(int32_t _colNumber) {
m_subWidget[iii].widget.reset(); m_subWidget[iii].widget.reset();
// no remove, this element is removed with the function onObjectRemove == > it does not exist anymore ... // no remove, this element is removed with the function onObjectRemove == > it does not exist anymore ...
if (errorControl == m_subWidget.size()) { if (errorControl == m_subWidget.size()) {
EWOL_CRITICAL("[" << getId() << "] The number of element might have been reduced ... == > it is not the case ==> the herited class must call the \"OnObjectRemove\" function..."); Log.critical("[" << getId() << "] The number of element might have been reduced ... == > it is not the case ==> the herited class must call the \"OnObjectRemove\" function...");
} }
} else { } else {
EWOL_WARNING("[" << getId() << "] Must not have null pointer on the subWidget list ..."); EWOL_WARNING("[" << getId() << "] Must not have null pointer on the subWidget list ...");
@ -157,7 +157,7 @@ void ewol::widget::Gird::setColSize(int32_t _colId, int32_t _size) {
if ((int64_t)m_sizeCol.size() > _colId) { if ((int64_t)m_sizeCol.size() > _colId) {
m_sizeCol[_colId] = _size; m_sizeCol[_colId] = _size;
} else { } else {
EWOL_ERROR("Can not set the Colomn size : " << _colId+1 Log.error("Can not set the Colomn size : " << _colId+1
<< " at " << _size << "px we have " << " at " << _size << "px we have "
<< m_sizeCol.size() << " colomn"); << m_sizeCol.size() << " colomn");
} }
@ -174,7 +174,7 @@ int32_t ewol::widget::Gird::getColSize(int32_t _colId) {
} }
return m_sizeCol[_colId]; return m_sizeCol[_colId];
} }
EWOL_ERROR("Can not get the Colomn size : " << _colId+1 << " we have "<< m_sizeCol.size() << " colomn"); Log.error("Can not get the Colomn size : " << _colId+1 << " we have "<< m_sizeCol.size() << " colomn");
return 0; return 0;
} }
@ -219,7 +219,7 @@ void ewol::widget::Gird::subWidgetAdd(int32_t _colId, int32_t _rowId, ewol::Widg
if (m_tmpWidget != null) { if (m_tmpWidget != null) {
m_tmpWidget.reset(); m_tmpWidget.reset();
if (m_tmpWidget != null) { if (m_tmpWidget != null) {
EWOL_CRITICAL("[" << getId() << "] Error while replacing a widget ... == > never call when free"); Log.critical("[" << getId() << "] Error while replacing a widget ... == > never call when free");
m_tmpWidget = null; m_tmpWidget = null;
} }
} }
@ -304,7 +304,7 @@ void ewol::widget::Gird::onRegenerateDisplay() {
} }
} }
ewol::WidgetShared ewol::widget::Gird::getWidgetAtPos(const vec2& _pos) { ewol::WidgetShared ewol::widget::Gird::getWidgetAtPos(const Vector2f& _pos) {
if (*propertyHide == true) { if (*propertyHide == true) {
return null; return null;
} }
@ -313,8 +313,8 @@ ewol::WidgetShared ewol::widget::Gird::getWidgetAtPos(const vec2& _pos) {
if (it.widget == null) { if (it.widget == null) {
continue; continue;
} }
vec2 tmpSize = it.widget->getSize(); Vector2f tmpSize = it.widget->getSize();
vec2 tmpOrigin = it.widget->getOrigin(); Vector2f tmpOrigin = it.widget->getOrigin();
if( (tmpOrigin.x() <= _pos.x() && tmpOrigin.x() + tmpSize.x() >= _pos.x()) if( (tmpOrigin.x() <= _pos.x() && tmpOrigin.x() + tmpSize.x() >= _pos.x())
&& (tmpOrigin.y() <= _pos.y() && tmpOrigin.y() + tmpSize.y() >= _pos.y()) ) { && (tmpOrigin.y() <= _pos.y() && tmpOrigin.y() + tmpSize.y() >= _pos.y()) ) {
ewol::WidgetShared tmpWidget = it.widget->getWidgetAtPos(_pos); ewol::WidgetShared tmpWidget = it.widget->getWidgetAtPos(_pos);

View File

@ -29,8 +29,8 @@ namespace ewol {
}; };
int32_t m_sizeRow; //!< size of all lines (row) (if set (otherwise 0)) == > we have a only one size ==> multiple size will have no use ... int32_t m_sizeRow; //!< size of all lines (row) (if set (otherwise 0)) == > we have a only one size ==> multiple size will have no use ...
int32_t m_uniformSizeRow; int32_t m_uniformSizeRow;
etk::Vector<int32_t> m_sizeCol; //!< size of all colomn (if set (otherwise 0)) List<int32_t> m_sizeCol; //!< size of all colomn (if set (otherwise 0))
etk::Vector<GirdProperties> m_subWidget; //!< all sub widget are contained in this element List<GirdProperties> m_subWidget; //!< all sub widget are contained in this element
ewol::WidgetShared m_tmpWidget; //!< use when replace a widget ... ewol::WidgetShared m_tmpWidget; //!< use when replace a widget ...
bool m_gavityButtom; bool m_gavityButtom;
protected: protected:
@ -121,24 +121,24 @@ namespace ewol {
virtual void subWidgetUnLink(int32_t _colId, int32_t _rowId); virtual void subWidgetUnLink(int32_t _colId, int32_t _rowId);
private: private:
// TODO : property // TODO : property
ivec2 m_borderSize; //!< Border size needed for all the display Vector2i m_borderSize; //!< Border size needed for all the display
public: public:
/** /**
* @brief set the current border size of the current element: * @brief set the current border size of the current element:
* @param[in] _newBorderSize The border size to set (0 if not used) * @param[in] _newBorderSize The border size to set (0 if not used)
*/ */
void setBorderSize(const ivec2& _newBorderSize); void setBorderSize(const Vector2i& _newBorderSize);
/** /**
* @brief get the current border size of the current element: * @brief get the current border size of the current element:
* @return the border size (0 if not used) * @return the border size (0 if not used)
*/ */
const ivec2& getBorderSize() { const Vector2i& getBorderSize() {
return m_borderSize; return m_borderSize;
}; };
public: public:
virtual void systemDraw(const ewol::DrawProperty& _displayProp) override; virtual void systemDraw(const ewol::DrawProperty& _displayProp) override;
virtual void onRegenerateDisplay() override; virtual void onRegenerateDisplay() override;
virtual ewol::WidgetShared getWidgetAtPos(const vec2& pos) override; virtual ewol::WidgetShared getWidgetAtPos(const Vector2f& pos) override;
virtual void onChangeSize() override; virtual void onChangeSize() override;
virtual void calculateMinMaxSize() override; virtual void calculateMinMaxSize() override;
}; };

View File

@ -16,18 +16,18 @@ ETK_DECLARE_TYPE(ewol::widget::Image);
ewol::widget::Image::Image() : ewol::widget::Image::Image() :
signalPressed(this, "pressed", "Image is pressed"), signalPressed(this, "pressed", "Image is pressed"),
propertySource(this, "src", "", "Image source path", &ewol::widget::Image::onChangePropertySource), propertySource(this, "src", "", "Image source path", &ewol::widget::Image::onChangePropertySource),
propertyBorder(this, "border", vec2(0,0), "Border of the image", &ewol::widget::Image::onChangePropertyGlobalSize), propertyBorder(this, "border", Vector2f(0,0), "Border of the image", &ewol::widget::Image::onChangePropertyGlobalSize),
propertyImageSize(this, "size", vec2(0,0), "Basic display size of the image", &ewol::widget::Image::onChangePropertyGlobalSize), propertyImageSize(this, "size", Vector2f(0,0), "Basic display size of the image", &ewol::widget::Image::onChangePropertyGlobalSize),
propertyKeepRatio(this, "ratio", true, "Keep ratio of the image", &ewol::widget::Image::onChangePropertyGlobalSize), propertyKeepRatio(this, "ratio", true, "Keep ratio of the image", &ewol::widget::Image::onChangePropertyGlobalSize),
propertyPosStart(this, "part-start", vec2(0.0f, 0.0f), vec2(0.0f, 0.0f), vec2(1.0f, 1.0f), "Start display position in the image", &ewol::widget::Image::onChangePropertyGlobalSize), propertyPosStart(this, "part-start", Vector2f(0.0f, 0.0f), Vector2f(0.0f, 0.0f), Vector2f(1.0f, 1.0f), "Start display position in the image", &ewol::widget::Image::onChangePropertyGlobalSize),
propertyPosStop(this, "part-stop", vec2(1.0f, 1.0f), vec2(0.0f, 0.0f), vec2(1.0f, 1.0f), "Start display position in the image", &ewol::widget::Image::onChangePropertyGlobalSize), propertyPosStop(this, "part-stop", Vector2f(1.0f, 1.0f), Vector2f(0.0f, 0.0f), Vector2f(1.0f, 1.0f), "Start display position in the image", &ewol::widget::Image::onChangePropertyGlobalSize),
propertyDistanceFieldMode(this, "distance-field", false, "Distance field mode", &ewol::widget::Image::onChangePropertyDistanceFieldMode), propertyDistanceFieldMode(this, "distance-field", false, "Distance field mode", &ewol::widget::Image::onChangePropertyDistanceFieldMode),
propertySmooth(this, "smooth", true, "Smooth display of the image", &ewol::widget::Image::onChangePropertySmooth), propertySmooth(this, "smooth", true, "Smooth display of the image", &ewol::widget::Image::onChangePropertySmooth),
propertyUseThemeColor(this, "use-theme-color", false, "use the theme color to display images", &ewol::widget::Image::onChangePropertyUseThemeColor), propertyUseThemeColor(this, "use-theme-color", false, "use the theme color to display images", &ewol::widget::Image::onChangePropertyUseThemeColor),
m_colorProperty(null), m_colorProperty(null),
m_colorId(-1) { m_colorId(-1) {
addObjectType("ewol::widget::Image"); addObjectType("ewol::widget::Image");
m_imageRenderSize = vec2(0,0); m_imageRenderSize = Vector2f(0,0);
m_colorProperty = ewol::resource::ColorFile::create(etk::Uri("THEME_COLOR:///Image.json?lib=ewol")); m_colorProperty = ewol::resource::ColorFile::create(etk::Uri("THEME_COLOR:///Image.json?lib=ewol"));
if (m_colorProperty != null) { if (m_colorProperty != null) {
m_colorId = m_colorProperty->request("foreground"); m_colorId = m_colorProperty->request("foreground");
@ -45,7 +45,7 @@ void ewol::widget::Image::init() {
} }
void ewol::widget::Image::set(const etk::Uri& _uri, const gale::Dimension& _border) { void ewol::widget::Image::set(const etk::Uri& _uri, const gale::Dimension& _border) {
EWOL_VERBOSE("Set Image : " << _uri << " border=" << _border); Log.verbose("Set Image : " << _uri << " border=" << _border);
propertyBorder.set(_border); propertyBorder.set(_border);
propertySource.set(_uri); propertySource.set(_uri);
} }
@ -72,16 +72,16 @@ void ewol::widget::Image::onRegenerateDisplay() {
m_compositing.setColor(m_colorProperty->get(m_colorId)); m_compositing.setColor(m_colorProperty->get(m_colorId));
} }
// Calculate the new position and size: // Calculate the new position and size:
vec2 imageBoder = propertyBorder->getPixel(); Vector2f imageBoder = propertyBorder->getPixel();
vec2 origin = imageBoder; Vector2f origin = imageBoder;
imageBoder *= 2.0f; imageBoder *= 2.0f;
vec2 imageRealSize = m_imageRenderSize - imageBoder; Vector2f imageRealSize = m_imageRenderSize - imageBoder;
vec2 imageRealSizeMax = m_size - imageBoder; Vector2f imageRealSizeMax = m_size - imageBoder;
vec2 ratioSizeDisplayRequested = *propertyPosStop - *propertyPosStart; Vector2f ratioSizeDisplayRequested = *propertyPosStop - *propertyPosStart;
//imageRealSizeMax *= ratioSizeDisplayRequested; //imageRealSizeMax *= ratioSizeDisplayRequested;
vec2 delta = ewol::gravityGenerateDelta(*propertyGravity, m_size-m_imageRenderSize); Vector2f delta = ewol::gravityGenerateDelta(*propertyGravity, m_size-m_imageRenderSize);
if (propertyFill->x() == true) { if (propertyFill->x() == true) {
imageRealSize.setX(imageRealSizeMax.x()); imageRealSize.setX(imageRealSizeMax.x());
delta.setX(0.0); delta.setX(0.0);
@ -93,7 +93,7 @@ void ewol::widget::Image::onRegenerateDisplay() {
origin += delta; origin += delta;
if (*propertyKeepRatio == true) { if (*propertyKeepRatio == true) {
vec2 tmpSize = m_compositing.getRealSize(); Vector2f tmpSize = m_compositing.getRealSize();
//float ratio = tmpSize.x() / tmpSize.y(); //float ratio = tmpSize.x() / tmpSize.y();
float ratio = (tmpSize.x()*ratioSizeDisplayRequested.x()) / (tmpSize.y() * ratioSizeDisplayRequested.y()); float ratio = (tmpSize.x()*ratioSizeDisplayRequested.x()) / (tmpSize.y() * ratioSizeDisplayRequested.y());
//float ratioCurrent = (imageRealSize.x()*ratioSizeDisplayRequested.x()) / (imageRealSize.y() * ratioSizeDisplayRequested.y()); //float ratioCurrent = (imageRealSize.x()*ratioSizeDisplayRequested.x()) / (imageRealSize.y() * ratioSizeDisplayRequested.y());
@ -103,11 +103,11 @@ void ewol::widget::Image::onRegenerateDisplay() {
} else if (ratio < ratioCurrent) { } else if (ratio < ratioCurrent) {
float oldX = imageRealSize.x(); float oldX = imageRealSize.x();
imageRealSize.setX(imageRealSize.y()*ratio); imageRealSize.setX(imageRealSize.y()*ratio);
origin += vec2((oldX - imageRealSize.x()) * 0.5f, 0); origin += Vector2f((oldX - imageRealSize.x()) * 0.5f, 0);
} else { } else {
float oldY = imageRealSize.y(); float oldY = imageRealSize.y();
imageRealSize.setY(imageRealSize.x()/ratio); imageRealSize.setY(imageRealSize.x()/ratio);
origin += vec2(0, (oldY - imageRealSize.y()) * 0.5f); origin += Vector2f(0, (oldY - imageRealSize.y()) * 0.5f);
} }
} }
@ -115,44 +115,44 @@ void ewol::widget::Image::onRegenerateDisplay() {
if (*propertySmooth == true) { if (*propertySmooth == true) {
m_compositing.setPos(origin); m_compositing.setPos(origin);
} else { } else {
m_compositing.setPos(ivec2(origin)); m_compositing.setPos(Vector2i(origin));
} }
m_compositing.printPart(imageRealSize, *propertyPosStart, *propertyPosStop); m_compositing.printPart(imageRealSize, *propertyPosStart, *propertyPosStop);
EWOL_DEBUG("Paint Image at : " << origin << " size=" << imageRealSize); Log.debug("Paint Image at : " << origin << " size=" << imageRealSize);
EWOL_DEBUG("Paint Image :" << *propertySource << " realsize=" << m_compositing.getRealSize() << " origin=" << origin << " size=" << imageRealSize); Log.debug("Paint Image :" << *propertySource << " realsize=" << m_compositing.getRealSize() << " origin=" << origin << " size=" << imageRealSize);
EWOL_DEBUG(" start=" << *propertyPosStart << " stop=" << *propertyPosStop); Log.debug(" start=" << *propertyPosStart << " stop=" << *propertyPosStop);
} }
void ewol::widget::Image::calculateMinMaxSize() { void ewol::widget::Image::calculateMinMaxSize() {
EWOL_DEBUG("calculate min size: border=" << propertyBorder << " size=" << propertyImageSize << " min-size=" << propertyMinSize); Log.debug("calculate min size: border=" << propertyBorder << " size=" << propertyImageSize << " min-size=" << propertyMinSize);
vec2 imageBoder = propertyBorder->getPixel()*2.0f; Vector2f imageBoder = propertyBorder->getPixel()*2.0f;
vec2 imageSize = propertyImageSize->getPixel(); Vector2f imageSize = propertyImageSize->getPixel();
vec2 size = propertyMinSize->getPixel(); Vector2f size = propertyMinSize->getPixel();
EWOL_DEBUG(" ==> border=" << imageBoder << " size=" << imageSize << " min-size=" << size); Log.debug(" ==> border=" << imageBoder << " size=" << imageSize << " min-size=" << size);
if (imageSize != vec2(0,0)) { if (imageSize != Vector2f(0,0)) {
m_minSize = imageBoder+imageSize; m_minSize = imageBoder+imageSize;
m_maxSize = m_minSize; m_maxSize = m_minSize;
} else { } else {
vec2 imageSizeReal = m_compositing.getRealSize(); Vector2f imageSizeReal = m_compositing.getRealSize();
EWOL_VERBOSE(" Real Size = " << imageSizeReal); Log.verbose(" Real Size = " << imageSizeReal);
vec2 min1 = imageBoder+propertyMinSize->getPixel(); Vector2f min1 = imageBoder+propertyMinSize->getPixel();
m_minSize = imageBoder+imageSizeReal; m_minSize = imageBoder+imageSizeReal;
EWOL_VERBOSE(" set max : " << m_minSize << " min1=" << min1); Log.verbose(" set max : " << m_minSize << " min1=" << min1);
m_minSize.setMax(min1); m_minSize.setMax(min1);
EWOL_VERBOSE(" result : " << m_minSize); Log.verbose(" result : " << m_minSize);
m_maxSize = imageBoder+propertyMaxSize->getPixel(); m_maxSize = imageBoder+propertyMaxSize->getPixel();
m_minSize.setMin(m_maxSize); m_minSize.setMin(m_maxSize);
} }
m_imageRenderSize = m_minSize; m_imageRenderSize = m_minSize;
m_minSize.setMax(size); m_minSize.setMax(size);
m_maxSize.setMax(m_minSize); m_maxSize.setMax(m_minSize);
EWOL_DEBUG("set widget min=" << m_minSize << " max=" << m_maxSize << " with real Image size=" << m_imageRenderSize << " img size=" << imageSize << " " << propertyImageSize); Log.debug("set widget min=" << m_minSize << " max=" << m_maxSize << " with real Image size=" << m_imageRenderSize << " img size=" << imageSize << " " << propertyImageSize);
markToRedraw(); markToRedraw();
} }
bool ewol::widget::Image::onEventInput(const ewol::event::Input& _event) { bool ewol::widget::Image::onEventInput(const ewol::event::Input& _event) {
//EWOL_DEBUG("Event on BT ..."); //Log.debug("Event on BT ...");
if (_event.getId() == 1) { if (_event.getId() == 1) {
if(gale::key::status::pressSingle == _event.getStatus()) { if(gale::key::status::pressSingle == _event.getStatus()) {
signalPressed.emit(); signalPressed.emit();
@ -181,9 +181,9 @@ bool ewol::widget::Image::loadXML(const exml::Element& _node) {
} }
tmpAttributeValue = _node.attributes["size"]; tmpAttributeValue = _node.attributes["size"];
if (tmpAttributeValue.size() != 0) { if (tmpAttributeValue.size() != 0) {
//EWOL_CRITICAL(" Parse SIZE : " << tmpAttributeValue); //Log.critical(" Parse SIZE : " << tmpAttributeValue);
propertyImageSize.setDirect(tmpAttributeValue); propertyImageSize.setDirect(tmpAttributeValue);
//EWOL_CRITICAL(" == > " << propertyImageSize); //Log.critical(" == > " << propertyImageSize);
} }
tmpAttributeValue = _node.attributes["border"]; tmpAttributeValue = _node.attributes["border"];
if (tmpAttributeValue.size() != 0) { if (tmpAttributeValue.size() != 0) {
@ -193,7 +193,7 @@ bool ewol::widget::Image::loadXML(const exml::Element& _node) {
if (tmpAttributeValue.size() != 0) { if (tmpAttributeValue.size() != 0) {
propertySmooth.setDirect(etk::string_to_bool(tmpAttributeValue)); propertySmooth.setDirect(etk::string_to_bool(tmpAttributeValue));
} }
//EWOL_DEBUG("Load label:" << node->ToElement()->getText()); //Log.debug("Load label:" << node->ToElement()->getText());
if (_node.nodes.size() != 0) { if (_node.nodes.size() != 0) {
propertySource.set(_node.getText()); propertySource.set(_node.getText());
} else { } else {
@ -208,14 +208,14 @@ bool ewol::widget::Image::loadXML(const exml::Element& _node) {
void ewol::widget::Image::onChangePropertySource() { void ewol::widget::Image::onChangePropertySource() {
markToRedraw(); markToRedraw();
requestUpdateSize(); requestUpdateSize();
EWOL_VERBOSE("Set sources : " << *propertySource << " size=" << *propertyImageSize); Log.verbose("Set sources : " << *propertySource << " size=" << *propertyImageSize);
m_compositing.setSource(*propertySource, propertyImageSize->getPixel()); m_compositing.setSource(*propertySource, propertyImageSize->getPixel());
} }
void ewol::widget::Image::onChangePropertyImageSize() { void ewol::widget::Image::onChangePropertyImageSize() {
markToRedraw(); markToRedraw();
requestUpdateSize(); requestUpdateSize();
EWOL_VERBOSE("Set sources : " << *propertySource << " size=" << *propertyImageSize); Log.verbose("Set sources : " << *propertySource << " size=" << *propertyImageSize);
m_compositing.setSource(*propertySource, propertyImageSize->getPixel()); m_compositing.setSource(*propertySource, propertyImageSize->getPixel());
} }

View File

@ -29,8 +29,8 @@ namespace ewol {
eproperty::Value<gale::Dimension> propertyBorder; //!< border to add at the image. eproperty::Value<gale::Dimension> propertyBorder; //!< border to add at the image.
eproperty::Value<gale::Dimension> propertyImageSize; //!< border to add at the image. eproperty::Value<gale::Dimension> propertyImageSize; //!< border to add at the image.
eproperty::Value<bool> propertyKeepRatio; //!< keep the image ratio between width and hight eproperty::Value<bool> propertyKeepRatio; //!< keep the image ratio between width and hight
eproperty::Range<vec2> propertyPosStart; //!< position in the image to start the sisplay (when we want not to display all the image) eproperty::Range<Vector2f> propertyPosStart; //!< position in the image to start the sisplay (when we want not to display all the image)
eproperty::Range<vec2> propertyPosStop; //!< position in the image to start the sisplay (when we want not to display all the image) eproperty::Range<Vector2f> propertyPosStop; //!< position in the image to start the sisplay (when we want not to display all the image)
eproperty::Value<bool> propertyDistanceFieldMode; //!< to have a parameter eproperty::Value<bool> propertyDistanceFieldMode; //!< to have a parameter
eproperty::Value<bool> propertySmooth; //!< display is done in the pixed approximation if false eproperty::Value<bool> propertySmooth; //!< display is done in the pixed approximation if false
eproperty::Value<bool> propertyUseThemeColor; //!< Use the themo color management ("THEME_COLOR:///Image.json?lib=ewol") default false eproperty::Value<bool> propertyUseThemeColor; //!< Use the themo color management ("THEME_COLOR:///Image.json?lib=ewol") default false
@ -62,7 +62,7 @@ namespace ewol {
*/ */
void setCustumSource(const egami::Image& _image); void setCustumSource(const egami::Image& _image);
protected: protected:
vec2 m_imageRenderSize; //!< size of the image when we render it Vector2f m_imageRenderSize; //!< size of the image when we render it
protected: protected:
void onDraw() override; void onDraw() override;
public: public:

View File

@ -105,7 +105,7 @@ bool ewol::widget::Joystick::onEventInput(const ewol::event::Input& _event) {
if( gale::key::status::down == typeEvent if( gale::key::status::down == typeEvent
|| gale::key::status::move == typeEvent) { || gale::key::status::move == typeEvent) {
// get local relative position // get local relative position
vec2 relativePos = relativePosition(pos); Vector2f relativePos = relativePosition(pos);
float sizeElement = m_size.x*m_ratio; float sizeElement = m_size.x*m_ratio;
// calculate the position of the cursor... // calculate the position of the cursor...
m_displayPos.x = (relativePos.x-sizeElement)/(m_size.x-sizeElement*2)*2.0 - 1.0; m_displayPos.x = (relativePos.x-sizeElement)/(m_size.x-sizeElement*2)*2.0 - 1.0;
@ -135,7 +135,7 @@ bool ewol::widget::Joystick::onEventInput(const ewol::event::Input& _event) {
signalMove.emit(m_angle+M_PI/2); signalMove.emit(m_angle+M_PI/2);
} }
//teta += M_PI/2; //teta += M_PI/2;
//EWOL_DEBUG("TETA = " << (m_angle*180/M_PI) << " deg distance = " << m_distance); //Log.debug("TETA = " << (m_angle*180/M_PI) << " deg distance = " << m_distance);
return true; return true;
} else if( gale::key::status::up == typeEvent) { } else if( gale::key::status::up == typeEvent) {
if( true == m_lock if( true == m_lock
@ -163,7 +163,7 @@ void ewol::widget::Joystick::ratio(float _newRatio) {
_newRatio = 1; _newRatio = 1;
} }
m_ratio = _newRatio; m_ratio = _newRatio;
EWOL_INFO("Set default Joystick ratio at " << m_ratio); Log.info("Set default Joystick ratio at " << m_ratio);
} }
@ -171,14 +171,14 @@ void ewol::widget::Joystick::background(etk::String _imageNameInData, bool _disp
// TODO : check if it existed // TODO : check if it existed
m_background = _imageNameInData; m_background = _imageNameInData;
m_displayBackground = _display; m_displayBackground = _display;
EWOL_INFO("Set default Joystick background at " << m_background << " display it=" << m_displayBackground); Log.info("Set default Joystick background at " << m_background << " display it=" << m_displayBackground);
} }
void ewol::widget::Joystick::foreground(etk::String imageNameInData) { void ewol::widget::Joystick::foreground(etk::String imageNameInData) {
// TODO : check if it existed // TODO : check if it existed
m_foreground = imageNameInData; m_foreground = imageNameInData;
EWOL_INFO("Set default Joystick Foreground at " << m_foreground); Log.info("Set default Joystick Foreground at " << m_foreground);
} }

View File

@ -26,7 +26,7 @@ namespace ewol {
// Event list of properties // Event list of properties
esignal::Signal<> signalEnable; esignal::Signal<> signalEnable;
esignal::Signal<> signalDisable; esignal::Signal<> signalDisable;
esignal::Signal<vec2> signalMove; esignal::Signal<Vector2f> signalMove;
public: public:
enum joystickMode { enum joystickMode {
modeNormal, modeNormal,
@ -35,7 +35,7 @@ namespace ewol {
private: private:
etk::Color<> m_colorFg; //!< Forground color etk::Color<> m_colorFg; //!< Forground color
etk::Color<> m_colorBg; //!< Background color etk::Color<> m_colorBg; //!< Background color
vec2 m_displayPos; //!< direction of the cursor ... Vector2f m_displayPos; //!< direction of the cursor ...
float m_distance; //!< dintance from the center float m_distance; //!< dintance from the center
float m_angle; //!< angle of the arraw (if < 0 : No arraw...) 0 is the TOP ... float m_angle; //!< angle of the arraw (if < 0 : No arraw...) 0 is the TOP ...
bool m_lock; //!< flag to mark the lock when the cursor is free when we are outside the circle bool m_lock; //!< flag to mark the lock when the cursor is free when we are outside the circle

View File

@ -53,19 +53,19 @@ void ewol::widget::Label::init() {
void ewol::widget::Label::calculateMinMaxSize() { void ewol::widget::Label::calculateMinMaxSize() {
vec2 tmpMax = propertyMaxSize->getPixel(); Vector2f tmpMax = propertyMaxSize->getPixel();
vec2 tmpMin = propertyMinSize->getPixel(); Vector2f tmpMin = propertyMinSize->getPixel();
//EWOL_DEBUG("[" << getId() << "] {" << getObjectType() << "} tmpMax : " << tmpMax); //Log.debug("[" << getId() << "] {" << getObjectType() << "} tmpMax : " << tmpMax);
if (tmpMax.x() <= 999999) { if (tmpMax.x() <= 999999) {
m_text.setTextAlignement(0, tmpMax.x()-4, ewol::compositing::alignLeft); m_text.setTextAlignement(0, tmpMax.x()-4, ewol::compositing::alignLeft);
//EWOL_DEBUG("[" << getId() << "] {" << getObjectType() << "} forcez Alignement "); //Log.debug("[" << getId() << "] {" << getObjectType() << "} forcez Alignement ");
} }
vec3 minSize = m_text.calculateSizeDecorated(m_value); Vector3f minSize = m_text.calculateSizeDecorated(m_value);
//EWOL_DEBUG("[" << getId() << "] {" << getObjectType() << "} minSize : " << minSize); //Log.debug("[" << getId() << "] {" << getObjectType() << "} minSize : " << minSize);
m_minSize.setX(etk::avg(tmpMin.x(), 4 + minSize.x(), tmpMax.x())); m_minSize.setX(etk::avg(tmpMin.x(), 4 + minSize.x(), tmpMax.x()));
m_minSize.setY(etk::avg(tmpMin.y(), 4 + minSize.y(), tmpMax.y())); m_minSize.setY(etk::avg(tmpMin.y(), 4 + minSize.y(), tmpMax.y()));
EWOL_VERBOSE("[" << getId() << "] {" << getObjectType() << "} Result min size : " << tmpMin << " < " << m_minSize << " < " << tmpMax); Log.verbose("[" << getId() << "] {" << getObjectType() << "} Result min size : " << tmpMin << " < " << m_minSize << " < " << tmpMax);
} }
void ewol::widget::Label::onDraw() { void ewol::widget::Label::onDraw() {
@ -79,21 +79,21 @@ void ewol::widget::Label::onRegenerateDisplay() {
m_text.clear(); m_text.clear();
int32_t paddingSize = 2; int32_t paddingSize = 2;
vec2 tmpMax = propertyMaxSize->getPixel(); Vector2f tmpMax = propertyMaxSize->getPixel();
// to know the size of one line : // to know the size of one line :
vec3 minSize = m_text.calculateSize(char32_t('A')); Vector3f minSize = m_text.calculateSize(char32_t('A'));
//minSize.setX(etk::max(minSize.x(), m_minSize.x())); //minSize.setX(etk::max(minSize.x(), m_minSize.x()));
//minSize.setY(etk::max(minSize.y(), m_minSize.y())); //minSize.setY(etk::max(minSize.y(), m_minSize.y()));
if (tmpMax.x() <= 999999) { if (tmpMax.x() <= 999999) {
m_text.setTextAlignement(0, tmpMax.x()-2*paddingSize, ewol::compositing::alignLeft); m_text.setTextAlignement(0, tmpMax.x()-2*paddingSize, ewol::compositing::alignLeft);
} }
vec3 curentTextSize = m_text.calculateSizeDecorated(m_value); Vector3f curentTextSize = m_text.calculateSizeDecorated(m_value);
ivec2 localSize = m_minSize; Vector2i localSize = m_minSize;
// no change for the text orogin : // no change for the text orogin :
vec3 tmpTextOrigin((m_size.x() - m_minSize.x()) / 2.0, Vector3f tmpTextOrigin((m_size.x() - m_minSize.x()) / 2.0,
(m_size.y() - m_minSize.y()) / 2.0, (m_size.y() - m_minSize.y()) / 2.0,
0); 0);
@ -105,15 +105,15 @@ void ewol::widget::Label::onRegenerateDisplay() {
localSize.setY(m_size.y()); localSize.setY(m_size.y());
tmpTextOrigin.setY(m_size.y() - 2*paddingSize - curentTextSize.y()); tmpTextOrigin.setY(m_size.y() - 2*paddingSize - curentTextSize.y());
} }
tmpTextOrigin += vec3(paddingSize, paddingSize, 0); tmpTextOrigin += Vector3f(paddingSize, paddingSize, 0);
localSize -= vec2(2*paddingSize,2*paddingSize); localSize -= Vector2f(2*paddingSize,2*paddingSize);
tmpTextOrigin.setY( tmpTextOrigin.y() + (m_minSize.y()-2*paddingSize) - minSize.y()); tmpTextOrigin.setY( tmpTextOrigin.y() + (m_minSize.y()-2*paddingSize) - minSize.y());
vec2 textPos(tmpTextOrigin.x(), tmpTextOrigin.y()); Vector2f textPos(tmpTextOrigin.x(), tmpTextOrigin.y());
vec3 drawClippingPos(paddingSize, paddingSize, -0.5); Vector3f drawClippingPos(paddingSize, paddingSize, -0.5);
vec3 drawClippingSize((m_size.x() - paddingSize), Vector3f drawClippingSize((m_size.x() - paddingSize),
(m_size.y() - paddingSize), (m_size.y() - paddingSize),
1); 1);
@ -127,14 +127,14 @@ void ewol::widget::Label::onRegenerateDisplay() {
m_text.setDefaultColorBg(m_colorProperty->get(m_colorDefaultBgText)); m_text.setDefaultColorBg(m_colorProperty->get(m_colorDefaultBgText));
} }
m_text.setPos(tmpTextOrigin); m_text.setPos(tmpTextOrigin);
EWOL_VERBOSE("[" << getId() << "] {" << m_value << "} display at pos : " << tmpTextOrigin); Log.verbose("[" << getId() << "] {" << m_value << "} display at pos : " << tmpTextOrigin);
m_text.setTextAlignement(tmpTextOrigin.x(), tmpTextOrigin.x()+localSize.x(), ewol::compositing::alignLeft); m_text.setTextAlignement(tmpTextOrigin.x(), tmpTextOrigin.x()+localSize.x(), ewol::compositing::alignLeft);
m_text.setClipping(drawClippingPos, drawClippingSize); m_text.setClipping(drawClippingPos, drawClippingSize);
m_text.printDecorated(m_value); m_text.printDecorated(m_value);
} }
bool ewol::widget::Label::onEventInput(const ewol::event::Input& _event) { bool ewol::widget::Label::onEventInput(const ewol::event::Input& _event) {
//EWOL_DEBUG("Event on Label ..."); //Log.debug("Event on Label ...");
if (_event.getId() == 1) { if (_event.getId() == 1) {
if (gale::key::status::pressSingle == _event.getStatus()) { if (gale::key::status::pressSingle == _event.getStatus()) {
// nothing to do ... // nothing to do ...
@ -151,7 +151,7 @@ bool ewol::widget::Label::loadXML(const exml::Element& _node) {
} }
ewol::Widget::loadXML(_node); ewol::Widget::loadXML(_node);
// get internal data : // get internal data :
EWOL_DEBUG("Load label:" << _node.getText()); Log.debug("Load label:" << _node.getText());
propertyValue.set(_node.getText()); propertyValue.set(_node.getText());
return true; return true;
} }

View File

@ -15,10 +15,10 @@ ewol::widget::Layer::Layer() {
} }
ewol::widget::Layer::~Layer() { ewol::widget::Layer::~Layer() {
EWOL_DEBUG("[" << getId() << "] Layer : destroy"); Log.debug("[" << getId() << "] Layer : destroy");
} }
ewol::WidgetShared ewol::widget::Layer::getWidgetAtPos(const vec2& _pos) { ewol::WidgetShared ewol::widget::Layer::getWidgetAtPos(const Vector2f& _pos) {
if (*propertyHide == true) { if (*propertyHide == true) {
return null; return null;
} }
@ -27,8 +27,8 @@ ewol::WidgetShared ewol::widget::Layer::getWidgetAtPos(const vec2& _pos) {
if (it == null) { if (it == null) {
continue; continue;
} }
vec2 tmpSize = it->getSize(); Vector2f tmpSize = it->getSize();
vec2 tmpOrigin = it->getOrigin(); Vector2f tmpOrigin = it->getOrigin();
if( (tmpOrigin.x() <= _pos.x() && tmpOrigin.x() + tmpSize.x() >= _pos.x()) if( (tmpOrigin.x() <= _pos.x() && tmpOrigin.x() + tmpSize.x() >= _pos.x())
&& (tmpOrigin.y() <= _pos.y() && tmpOrigin.y() + tmpSize.y() >= _pos.y()) ) { && (tmpOrigin.y() <= _pos.y() && tmpOrigin.y() + tmpSize.y() >= _pos.y()) ) {
ewol::WidgetShared tmpWidget = it->getWidgetAtPos(_pos); ewol::WidgetShared tmpWidget = it->getWidgetAtPos(_pos);

View File

@ -31,7 +31,7 @@ namespace ewol {
*/ */
virtual ~Layer(); virtual ~Layer();
public: public:
ewol::WidgetShared getWidgetAtPos(const vec2& _pos) override; ewol::WidgetShared getWidgetAtPos(const Vector2f& _pos) override;
}; };
}; };
}; };

View File

@ -23,7 +23,7 @@ ewol::widget::List::List() {
#endif #endif
m_nbVisibleRaw = 0; m_nbVisibleRaw = 0;
propertyCanFocus.setDirectCheck(true); propertyCanFocus.setDirectCheck(true);
m_limitScrolling = vec2(1, 0.5); m_limitScrolling = Vector2f(1, 0.5);
} }
@ -57,7 +57,7 @@ ememory::SharedPtr<ewol::Compositing> ewol::widget::List::getComposeElemnent(con
} }
/* /*
void ewol::widget::List::setRawVisible(int32_t _id) { void ewol::widget::List::setRawVisible(int32_t _id) {
EWOL_DEBUG("Set Raw visible : " << _id); Log.debug("Set Raw visible : " << _id);
if (_id<0) { if (_id<0) {
return; return;
} }
@ -72,14 +72,14 @@ void ewol::widget::List::setRawVisible(int32_t _id) {
m_displayStartRaw = _id - m_nbVisibleRaw + 2; m_displayStartRaw = _id - m_nbVisibleRaw + 2;
} }
} }
ivec2 matrixSize = getMatrixSize(); Vector2i matrixSize = getMatrixSize();
if (m_displayStartRaw > matrixSize.y()) { if (m_displayStartRaw > matrixSize.y()) {
m_displayStartRaw = matrixSize.y()-2; m_displayStartRaw = matrixSize.y()-2;
} }
if (m_displayStartRaw<0) { if (m_displayStartRaw<0) {
m_displayStartRaw = 0; m_displayStartRaw = 0;
} }
EWOL_DEBUG("Set start raw : " << m_displayStartRaw); Log.debug("Set start raw : " << m_displayStartRaw);
markToRedraw(); markToRedraw();
} }
*/ */
@ -110,15 +110,15 @@ void ewol::widget::List::onRegenerateDisplay() {
// ------------------------------------------------------- // -------------------------------------------------------
// -- Calculate the size of each element // -- Calculate the size of each element
// ------------------------------------------------------- // -------------------------------------------------------
ivec2 matrixSize = getMatrixSize(); Vector2i matrixSize = getMatrixSize();
m_listSizeX.clear(); m_listSizeX.clear();
m_listSizeX.resize(matrixSize.x(), 0); m_listSizeX.resize(matrixSize.x(), 0);
m_listSizeY.clear(); m_listSizeY.clear();
m_listSizeY.resize(matrixSize.y(), 0); m_listSizeY.resize(matrixSize.y(), 0);
for (int_t yyy=0; yyy<matrixSize.y(); ++yyy) { for (int_t yyy=0; yyy<matrixSize.y(); ++yyy) {
for (int_t xxx=0; xxx<matrixSize.x(); ++xxx) { for (int_t xxx=0; xxx<matrixSize.x(); ++xxx) {
ivec2 pos(xxx, yyy); Vector2i pos(xxx, yyy);
vec2 elementSize = calculateElementSize(pos); Vector2f elementSize = calculateElementSize(pos);
if (elementSize.x() > m_listSizeX[xxx]) { if (elementSize.x() > m_listSizeX[xxx]) {
m_listSizeX[xxx] = elementSize.x(); m_listSizeX[xxx] = elementSize.x();
} }
@ -165,8 +165,8 @@ void ewol::widget::List::onRegenerateDisplay() {
// ------------------------------------------------------- // -------------------------------------------------------
// -- Calculate the start position size of each element // -- Calculate the start position size of each element
// ------------------------------------------------------- // -------------------------------------------------------
etk::Vector<int32_t> listStartPosX; List<int32_t> listStartPosX;
etk::Vector<int32_t> listStartPosY; List<int32_t> listStartPosY;
int32_t lastPositionX = 0; int32_t lastPositionX = 0;
for (auto &size: m_listSizeX) { for (auto &size: m_listSizeX) {
listStartPosX.pushBack(lastPositionX); listStartPosX.pushBack(lastPositionX);
@ -180,7 +180,7 @@ void ewol::widget::List::onRegenerateDisplay() {
// ------------------------------------------------------- // -------------------------------------------------------
// -- Update the scroolBar // -- Update the scroolBar
// ------------------------------------------------------- // -------------------------------------------------------
m_maxSize = ivec2(lastPositionX, lastPositionY); m_maxSize = Vector2i(lastPositionX, lastPositionY);
// ------------------------------------------------------- // -------------------------------------------------------
// -- Clean the background // -- Clean the background
// ------------------------------------------------------- // -------------------------------------------------------
@ -200,7 +200,7 @@ void ewol::widget::List::onRegenerateDisplay() {
} }
for (int_t xxx=0; xxx<matrixSize.x(); ++xxx) { for (int_t xxx=0; xxx<matrixSize.x(); ++xxx) {
float startXposition = -m_originScrooled.x() + listStartPosX[xxx]; float startXposition = -m_originScrooled.x() + listStartPosX[xxx];
//EWOL_ERROR("display start: " << startXposition); //Log.error("display start: " << startXposition);
if (startXposition + m_listSizeX[xxx] < 0) { if (startXposition + m_listSizeX[xxx] < 0) {
// ==> element out of range ==> nothing to display // ==> element out of range ==> nothing to display
continue; continue;
@ -209,9 +209,9 @@ void ewol::widget::List::onRegenerateDisplay() {
// ==> element out of range ==> nothing to display // ==> element out of range ==> nothing to display
break; break;
} }
drawElement(ivec2(xxx, yyy), drawElement(Vector2i(xxx, yyy),
vec2(startXposition, startYposition), Vector2f(startXposition, startYposition),
vec2(m_listSizeX[xxx], m_listSizeY[yyy])); Vector2f(m_listSizeX[xxx], m_listSizeY[yyy]));
} }
} }
// ------------------------------------------------------- // -------------------------------------------------------
@ -221,16 +221,16 @@ void ewol::widget::List::onRegenerateDisplay() {
} }
} }
ivec2 ewol::widget::List::getMatrixSize() const { Vector2i ewol::widget::List::getMatrixSize() const {
return ivec2(1,0); return Vector2i(1,0);
} }
vec2 ewol::widget::List::calculateElementSize(const ivec2& _pos) { Vector2f ewol::widget::List::calculateElementSize(const Vector2i& _pos) {
auto tmpText = ememory::staticPointerCast<ewol::compositing::Text>(getComposeElemnent("text")); auto tmpText = ememory::staticPointerCast<ewol::compositing::Text>(getComposeElemnent("text"));
etk::String myTextToWrite = getData(ListRole::Text, _pos).getSafeString(); etk::String myTextToWrite = getData(ListRole::Text, _pos).getSafeString();
vec3 textSize = tmpText->calculateSize(myTextToWrite); Vector3f textSize = tmpText->calculateSize(myTextToWrite);
ivec2 count = getMatrixSize(); Vector2i count = getMatrixSize();
return vec2(textSize.x(), return Vector2f(textSize.x(),
textSize.y() + m_paddingSizeY*3 textSize.y() + m_paddingSizeY*3
); );
} }
@ -240,12 +240,12 @@ void ewol::widget::List::drawBackground() {
if (BGOObjects != null) { if (BGOObjects != null) {
etk::Color<> basicBG = getBasicBG(); etk::Color<> basicBG = getBasicBG();
BGOObjects->setColor(basicBG); BGOObjects->setColor(basicBG);
BGOObjects->setPos(vec3(0, 0, 0) ); BGOObjects->setPos(Vector3f(0, 0, 0) );
BGOObjects->rectangleWidth(m_size); BGOObjects->rectangleWidth(m_size);
} }
} }
void ewol::widget::List::drawElement(const ivec2& _pos, const vec2& _start, const vec2& _size) { void ewol::widget::List::drawElement(const Vector2i& _pos, const Vector2f& _start, const Vector2f& _size) {
etk::String myTextToWrite = getData(ListRole::Text, _pos).getSafeString(); etk::String myTextToWrite = getData(ListRole::Text, _pos).getSafeString();
etk::Color<> fg = getData(ListRole::FgColor, _pos).getSafeColor(); etk::Color<> fg = getData(ListRole::FgColor, _pos).getSafeColor();
auto backgroundVariant = getData(ListRole::BgColor, _pos); auto backgroundVariant = getData(ListRole::BgColor, _pos);
@ -254,7 +254,7 @@ void ewol::widget::List::drawElement(const ivec2& _pos, const vec2& _start, cons
auto BGOObjects = ememory::staticPointerCast<ewol::compositing::Drawing>(getComposeElemnent("drawing")); auto BGOObjects = ememory::staticPointerCast<ewol::compositing::Drawing>(getComposeElemnent("drawing"));
if (BGOObjects != null) { if (BGOObjects != null) {
BGOObjects->setColor(bg); BGOObjects->setColor(bg);
BGOObjects->setPos(vec3(_start.x(), _start.y(), 0) ); BGOObjects->setPos(Vector3f(_start.x(), _start.y(), 0) );
BGOObjects->rectangleWidth(_size); BGOObjects->rectangleWidth(_size);
} }
} }
@ -263,14 +263,14 @@ void ewol::widget::List::drawElement(const ivec2& _pos, const vec2& _start, cons
if (tmpText != null) { if (tmpText != null) {
int32_t displayPositionY = _start.y() + m_paddingSizeY; int32_t displayPositionY = _start.y() + m_paddingSizeY;
tmpText->setColor(fg); tmpText->setColor(fg);
tmpText->setPos(vec3(_start.x() + m_paddingSizeX, displayPositionY, 0) ); tmpText->setPos(Vector3f(_start.x() + m_paddingSizeX, displayPositionY, 0) );
tmpText->print(myTextToWrite);; tmpText->print(myTextToWrite);;
} }
} }
} }
bool ewol::widget::List::onEventInput(const ewol::event::Input& _event) { bool ewol::widget::List::onEventInput(const ewol::event::Input& _event) {
vec2 relativePos = relativePosition(_event.getPos()); Vector2f relativePos = relativePosition(_event.getPos());
if (WidgetScrolled::onEventInput(_event) == true) { if (WidgetScrolled::onEventInput(_event) == true) {
keepFocus(); keepFocus();
// nothing to do ... done on upper widet ... // nothing to do ... done on upper widet ...
@ -279,9 +279,9 @@ bool ewol::widget::List::onEventInput(const ewol::event::Input& _event) {
if (m_listSizeY.size() == 0) { if (m_listSizeY.size() == 0) {
return false; return false;
} }
relativePos = vec2(relativePos.x(),m_size.y() - relativePos.y()) + m_originScrooled; relativePos = Vector2f(relativePos.x(),m_size.y() - relativePos.y()) + m_originScrooled;
// Find the colomn and the row // Find the colomn and the row
ivec2 pos{0,0}; Vector2i pos{0,0};
float_t offsetY = 0; float_t offsetY = 0;
for (size_t iii=0; iii<m_listSizeY.size()-1; iii++) { for (size_t iii=0; iii<m_listSizeY.size()-1; iii++) {
int32_t previous = offsetY; int32_t previous = offsetY;
@ -314,7 +314,7 @@ bool ewol::widget::List::onEventInput(const ewol::event::Input& _event) {
break; break;
} }
} }
vec2 posInternalMouse = relativePos - vec2(offsetX, offsetY); Vector2f posInternalMouse = relativePos - Vector2f(offsetX, offsetY);
bool isUsed = onItemEvent(_event, pos, posInternalMouse); bool isUsed = onItemEvent(_event, pos, posInternalMouse);
if (isUsed == true) { if (isUsed == true) {
// TODO : this generate bugs ... I did not understand why .. // TODO : this generate bugs ... I did not understand why ..
@ -324,9 +324,9 @@ bool ewol::widget::List::onEventInput(const ewol::event::Input& _event) {
} }
void ewol::widget::List::onGetFocus() { void ewol::widget::List::onGetFocus() {
EWOL_DEBUG("Ewol::List get focus"); Log.debug("Ewol::List get focus");
} }
void ewol::widget::List::onLostFocus() { void ewol::widget::List::onLostFocus() {
EWOL_DEBUG("Ewol::List Lost focus"); Log.debug("Ewol::List Lost focus");
} }

View File

@ -45,9 +45,9 @@ namespace ewol {
void calculateMinMaxSize() override; void calculateMinMaxSize() override;
// drawing capabilities .... // drawing capabilities ....
protected: protected:
etk::Vector<ememory::SharedPtr<ewol::Compositing>> m_listOObject; //!< generic element to display... List<ememory::SharedPtr<ewol::Compositing>> m_listOObject; //!< generic element to display...
etk::Vector<int32_t> m_listSizeX; //!< size of every colomns List<int32_t> m_listSizeX; //!< size of every colomns
etk::Vector<int32_t> m_listSizeY; //!< size of every rows List<int32_t> m_listSizeY; //!< size of every rows
protected: protected:
etk::Map<etk::String, ememory::SharedPtr<ewol::Compositing>> m_compositingElements; etk::Map<etk::String, ememory::SharedPtr<ewol::Compositing>> m_compositingElements;
void addComposeElemnent(const etk::String& _name, const ememory::SharedPtr<ewol::Compositing>& _element); void addComposeElemnent(const etk::String& _name, const ememory::SharedPtr<ewol::Compositing>& _element);
@ -73,9 +73,9 @@ namespace ewol {
* @brief Get the number of colomn and row availlable in the list * @brief Get the number of colomn and row availlable in the list
* @return Number of colomn and row * @return Number of colomn and row
*/ */
virtual ivec2 getMatrixSize() const; virtual Vector2i getMatrixSize() const;
virtual fluorine::Variant getData(int32_t _role, const ivec2& _pos) { virtual fluorine::Variant getData(int32_t _role, const Vector2i& _pos) {
switch (_role) { switch (_role) {
case ListRole::Text: case ListRole::Text:
return ""; return "";
@ -95,7 +95,7 @@ namespace ewol {
* @param[in] _pos Position of colomn and Raw of the element. * @param[in] _pos Position of colomn and Raw of the element.
* @return The estimate size of the element. * @return The estimate size of the element.
*/ */
virtual vec2 calculateElementSize(const ivec2& _pos); virtual Vector2f calculateElementSize(const Vector2i& _pos);
/** /**
* @brief Draw an element in the specific size and position. * @brief Draw an element in the specific size and position.
* @param[in] _pos Position of colomn and Raw of the element. * @param[in] _pos Position of colomn and Raw of the element.
@ -103,13 +103,13 @@ namespace ewol {
* @param[in] _size Render raw size * @param[in] _size Render raw size
* @return The estimate size of the element. * @return The estimate size of the element.
*/ */
virtual void drawElement(const ivec2& _pos, const vec2& _start, const vec2& _size); virtual void drawElement(const Vector2i& _pos, const Vector2f& _start, const Vector2f& _size);
/** /**
* @brief Draw the background * @brief Draw the background
*/ */
virtual void drawBackground(); virtual void drawBackground();
virtual bool onItemEvent(const ewol::event::Input& _event, const ivec2& _pos, const vec2& _mousePosition) { virtual bool onItemEvent(const ewol::event::Input& _event, const Vector2i& _pos, const Vector2f& _mousePosition) {
return false; return false;
} }
/** /**

View File

@ -87,7 +87,7 @@ void ewol::widget::ListFileSystem::regenerateView() {
flags |= etk::path::LIST_FILE; flags |= etk::path::LIST_FILE;
} }
m_list = etk::path::list(*propertyPath, flags); m_list = etk::path::list(*propertyPath, flags);
EWOL_ERROR("Lsit of element: " << m_list.size() ); Log.error("Lsit of element: " << m_list.size() );
// Sort the list: // Sort the list:
etk::algorithm::quickSort(m_list, localSort); etk::algorithm::quickSort(m_list, localSort);
// request a redraw ... // request a redraw ...
@ -117,7 +117,7 @@ void ewol::widget::ListFileSystem::setSelect(const etk::Path& _data) {
markToRedraw(); markToRedraw();
} }
ivec2 ewol::widget::ListFileSystem::getMatrixSize() const { Vector2i ewol::widget::ListFileSystem::getMatrixSize() const {
int32_t offset = 0; int32_t offset = 0;
if (*propertyShowFolder == true) { if (*propertyShowFolder == true) {
if (propertyPath.get() == "/") { if (propertyPath.get() == "/") {
@ -126,10 +126,10 @@ ivec2 ewol::widget::ListFileSystem::getMatrixSize() const {
offset = 2; offset = 2;
} }
} }
return ivec2(1, m_list.size() + offset); return Vector2i(1, m_list.size() + offset);
} }
fluorine::Variant ewol::widget::ListFileSystem::getData(int32_t _role, const ivec2& _pos) { fluorine::Variant ewol::widget::ListFileSystem::getData(int32_t _role, const Vector2i& _pos) {
switch (_role) { switch (_role) {
case ListRole::Text: case ListRole::Text:
{ {
@ -149,7 +149,7 @@ fluorine::Variant ewol::widget::ListFileSystem::getData(int32_t _role, const ive
} }
if( _pos.y()-offset >= 0 if( _pos.y()-offset >= 0
&& _pos.y()-offset < (int32_t)m_list.size()) { && _pos.y()-offset < (int32_t)m_list.size()) {
EWOL_VERBOSE("get filename for : '" << m_list[_pos.y()-offset] << ":'" << m_list[_pos.y()-offset].getFileName() << "'"); Log.verbose("get filename for : '" << m_list[_pos.y()-offset] << ":'" << m_list[_pos.y()-offset].getFileName() << "'");
return m_list[_pos.y()-offset].getFileName(); return m_list[_pos.y()-offset].getFileName();
} }
} }
@ -169,8 +169,8 @@ fluorine::Variant ewol::widget::ListFileSystem::getData(int32_t _role, const ive
} }
bool ewol::widget::ListFileSystem::onItemEvent(const ewol::event::Input& _event, bool ewol::widget::ListFileSystem::onItemEvent(const ewol::event::Input& _event,
const ivec2& _pos, const Vector2i& _pos,
const vec2& _mousePosition) { const Vector2f& _mousePosition) {
int32_t offset = 0; int32_t offset = 0;
if (*propertyShowFolder == true) { if (*propertyShowFolder == true) {
if (*propertyPath == "/") { if (*propertyPath == "/") {
@ -181,7 +181,7 @@ bool ewol::widget::ListFileSystem::onItemEvent(const ewol::event::Input& _event,
} }
if ( _event.getStatus() == gale::key::status::pressSingle if ( _event.getStatus() == gale::key::status::pressSingle
|| _event.getStatus() == gale::key::status::pressDouble) { || _event.getStatus() == gale::key::status::pressDouble) {
EWOL_VERBOSE("Event on List : IdInput=" << _event.getId() << " _pos=" << _pos ); Log.verbose("Event on List : IdInput=" << _event.getId() << " _pos=" << _pos );
if (1 == _event.getId()) { if (1 == _event.getId()) {
if (_pos.y() > (int32_t)m_list.size()+offset ) { if (_pos.y() > (int32_t)m_list.size()+offset ) {
m_selectedLine = -1; m_selectedLine = -1;

View File

@ -43,11 +43,11 @@ namespace ewol {
int32_t m_colorIdBackgroundSelected; //!< Color of line selected. int32_t m_colorIdBackgroundSelected; //!< Color of line selected.
protected: protected:
etk::Color<> getBasicBG() override; etk::Color<> getBasicBG() override;
ivec2 getMatrixSize() const override; Vector2i getMatrixSize() const override;
fluorine::Variant getData(int32_t _role, const ivec2& _pos) override; fluorine::Variant getData(int32_t _role, const Vector2i& _pos) override;
bool onItemEvent(const ewol::event::Input& _event, const ivec2& _pos, const vec2& _mousePosition) override; bool onItemEvent(const ewol::event::Input& _event, const Vector2i& _pos, const Vector2f& _mousePosition) override;
protected: protected:
etk::Vector<etk::Path> m_list; //!< List of all element in the path. (they are filtered) List<etk::Path> m_list; //!< List of all element in the path. (they are filtered)
/** /**
* @brief Clean the list of element. * @brief Clean the list of element.
*/ */

View File

@ -37,7 +37,7 @@ ewol::widget::Manager::Manager() :
m_creatorList(0, false), m_creatorList(0, false),
m_creatorListXml(0, false), m_creatorListXml(0, false),
m_haveRedraw(true) { m_haveRedraw(true) {
EWOL_DEBUG(" == > init Widget-Manager"); Log.debug(" == > init Widget-Manager");
ewol::widget::Button::createManagerWidget(*this); ewol::widget::Button::createManagerWidget(*this);
ewol::widget::ButtonColor::createManagerWidget(*this); ewol::widget::ButtonColor::createManagerWidget(*this);
@ -63,8 +63,8 @@ ewol::widget::Manager::Manager() :
} }
ewol::widget::Manager::~Manager() { ewol::widget::Manager::~Manager() {
EWOL_DEBUG(" == > Un-Init Widget-Manager"); Log.debug(" == > Un-Init Widget-Manager");
EWOL_INFO("Realease all FOCUS"); Log.info("Realease all FOCUS");
focusSetDefault(null); focusSetDefault(null);
focusRelease(); focusRelease();
@ -80,7 +80,7 @@ void ewol::widget::Manager::focusKeep(ewol::WidgetShared _newWidget) {
// nothing to do ... // nothing to do ...
return; return;
} }
EWOL_DEBUG("focusKeep=" << _newWidget->getId() ); Log.debug("focusKeep=" << _newWidget->getId() );
//elog::displayBacktrace(); //elog::displayBacktrace();
auto focusWidgetCurrent = m_focusWidgetCurrent.lock(); auto focusWidgetCurrent = m_focusWidgetCurrent.lock();
if (_newWidget == focusWidgetCurrent) { if (_newWidget == focusWidgetCurrent) {
@ -88,17 +88,17 @@ void ewol::widget::Manager::focusKeep(ewol::WidgetShared _newWidget) {
return; return;
} }
if (focusWidgetCurrent != null) { if (focusWidgetCurrent != null) {
EWOL_DEBUG("Rm focus on WidgetID=" << focusWidgetCurrent->getId() ); Log.debug("Rm focus on WidgetID=" << focusWidgetCurrent->getId() );
focusWidgetCurrent->rmFocus(); focusWidgetCurrent->rmFocus();
focusWidgetCurrent.reset(); focusWidgetCurrent.reset();
} }
if (_newWidget->propertyCanFocus.get() == false) { if (_newWidget->propertyCanFocus.get() == false) {
EWOL_DEBUG("Widget can not have focus, id=" << _newWidget->getId() ); Log.debug("Widget can not have focus, id=" << _newWidget->getId() );
return; return;
} }
m_focusWidgetCurrent = _newWidget; m_focusWidgetCurrent = _newWidget;
if (_newWidget != null) { if (_newWidget != null) {
EWOL_DEBUG("Set focus on WidgetID=" << _newWidget->getId() ); Log.debug("Set focus on WidgetID=" << _newWidget->getId() );
_newWidget->setFocus(); _newWidget->setFocus();
} }
} }
@ -106,19 +106,19 @@ void ewol::widget::Manager::focusKeep(ewol::WidgetShared _newWidget) {
void ewol::widget::Manager::focusSetDefault(ewol::WidgetShared _newWidget) { void ewol::widget::Manager::focusSetDefault(ewol::WidgetShared _newWidget) {
if( _newWidget != null if( _newWidget != null
&& _newWidget->propertyCanFocus.get() == false) { && _newWidget->propertyCanFocus.get() == false) {
EWOL_VERBOSE("Widget can not have focus, id=" << _newWidget->getId() ); Log.verbose("Widget can not have focus, id=" << _newWidget->getId() );
return; return;
} }
ewol::WidgetShared focusWidgetDefault = m_focusWidgetDefault.lock(); ewol::WidgetShared focusWidgetDefault = m_focusWidgetDefault.lock();
ewol::WidgetShared focusWidgetCurrent = m_focusWidgetCurrent.lock(); ewol::WidgetShared focusWidgetCurrent = m_focusWidgetCurrent.lock();
if (focusWidgetDefault == focusWidgetCurrent) { if (focusWidgetDefault == focusWidgetCurrent) {
if (focusWidgetCurrent != null) { if (focusWidgetCurrent != null) {
EWOL_DEBUG("Rm focus on WidgetID=" << focusWidgetCurrent->getId() ); Log.debug("Rm focus on WidgetID=" << focusWidgetCurrent->getId() );
focusWidgetCurrent->rmFocus(); focusWidgetCurrent->rmFocus();
} }
m_focusWidgetCurrent = _newWidget; m_focusWidgetCurrent = _newWidget;
if (_newWidget != null) { if (_newWidget != null) {
EWOL_DEBUG("Set focus on WidgetID=" << _newWidget->getId() ); Log.debug("Set focus on WidgetID=" << _newWidget->getId() );
_newWidget->setFocus(); _newWidget->setFocus();
} }
} }
@ -133,13 +133,13 @@ void ewol::widget::Manager::focusRelease() {
return; return;
} }
if (focusWidgetCurrent != null) { if (focusWidgetCurrent != null) {
EWOL_DEBUG("Rm focus on WidgetID=" << focusWidgetCurrent->getId() ); Log.debug("Rm focus on WidgetID=" << focusWidgetCurrent->getId() );
focusWidgetCurrent->rmFocus(); focusWidgetCurrent->rmFocus();
} }
m_focusWidgetCurrent = m_focusWidgetDefault; m_focusWidgetCurrent = m_focusWidgetDefault;
focusWidgetCurrent = m_focusWidgetCurrent.lock(); focusWidgetCurrent = m_focusWidgetCurrent.lock();
if (focusWidgetCurrent != null) { if (focusWidgetCurrent != null) {
EWOL_DEBUG("Set focus on WidgetID=" << focusWidgetCurrent->getId() ); Log.debug("Set focus on WidgetID=" << focusWidgetCurrent->getId() );
focusWidgetCurrent->setFocus(); focusWidgetCurrent->setFocus();
} }
} }
@ -198,7 +198,7 @@ void ewol::widget::Manager::addWidgetCreator(const etk::String& _name,
if (find == true) { if (find == true) {
return; return;
} }
EWOL_INFO("Add Creator of a specify widget : " << nameLower); Log.info("Add Creator of a specify widget : " << nameLower);
m_creatorList.set(nameLower, _pointer); m_creatorList.set(nameLower, _pointer);
m_creatorListXml.set(nameLower, _pointerXml); m_creatorListXml.set(nameLower, _pointerXml);
} }

View File

@ -20,7 +20,7 @@ ewol::widget::Menu::Menu() :
signalSelect(this, "select", "") { signalSelect(this, "select", "") {
addObjectType("ewol::widget::Menu"); addObjectType("ewol::widget::Menu");
m_staticId = 666; m_staticId = 666;
propertyLockExpand.setDirect(bvec2(true,true)); propertyLockExpand.setDirect(Vector2b(true,true));
} }
ewol::widget::Menu::~Menu() { ewol::widget::Menu::~Menu() {
@ -33,16 +33,16 @@ void ewol::widget::Menu::subWidgetRemoveAll() {
} }
int32_t ewol::widget::Menu::subWidgetAdd(ewol::WidgetShared _newWidget) { int32_t ewol::widget::Menu::subWidgetAdd(ewol::WidgetShared _newWidget) {
EWOL_ERROR("Not availlable"); Log.error("Not availlable");
return -1; return -1;
} }
void ewol::widget::Menu::subWidgetRemove(ewol::WidgetShared _newWidget) { void ewol::widget::Menu::subWidgetRemove(ewol::WidgetShared _newWidget) {
EWOL_ERROR("Not availlable"); Log.error("Not availlable");
} }
void ewol::widget::Menu::subWidgetUnLink(ewol::WidgetShared _newWidget) { void ewol::widget::Menu::subWidgetUnLink(ewol::WidgetShared _newWidget) {
EWOL_ERROR("Not availlable"); Log.error("Not availlable");
} }
void ewol::widget::Menu::clear() { void ewol::widget::Menu::clear() {
@ -84,7 +84,7 @@ int32_t ewol::widget::Menu::add(int32_t _parent,
if (tmpObject.m_parentId == -1) { if (tmpObject.m_parentId == -1) {
ewol::widget::ButtonShared myButton = ewol::widget::Button::create(); ewol::widget::ButtonShared myButton = ewol::widget::Button::create();
if (myButton == null) { if (myButton == null) {
EWOL_ERROR("Allocation button error"); Log.error("Allocation button error");
return tmpObject.m_localId; return tmpObject.m_localId;
} }
if (tmpObject.m_image.size()!=0) { if (tmpObject.m_image.size()!=0) {
@ -113,7 +113,7 @@ int32_t ewol::widget::Menu::add(int32_t _parent,
} }
void ewol::widget::Menu::remove(int32_t _id) { void ewol::widget::Menu::remove(int32_t _id) {
EWOL_TODO("NOT remove..."); Log.todo("NOT remove...");
} }
@ -127,13 +127,13 @@ int32_t ewol::widget::Menu::addSpacer(int32_t _parent) {
if (tmpObject.m_parentId == -1) { if (tmpObject.m_parentId == -1) {
ewol::widget::SpacerShared mySpacer = ewol::widget::Spacer::create(); ewol::widget::SpacerShared mySpacer = ewol::widget::Spacer::create();
if (mySpacer == null) { if (mySpacer == null) {
EWOL_ERROR("Allocation spacer error"); Log.error("Allocation spacer error");
return tmpObject.m_localId; return tmpObject.m_localId;
} }
mySpacer->propertyExpand.set(bvec2(true,true)); mySpacer->propertyExpand.set(Vector2b(true,true));
mySpacer->propertyFill.set(bvec2(true,true)); mySpacer->propertyFill.set(Vector2b(true,true));
mySpacer->propertyMinSize.set(gale::Dimension(vec2(2,0), gale::distance::pixel)); mySpacer->propertyMinSize.set(gale::Dimension(Vector2f(2,0), gale::distance::pixel));
mySpacer->propertyMaxSize.set(gale::Dimension(vec2(2,10000), gale::distance::pixel)); mySpacer->propertyMaxSize.set(gale::Dimension(Vector2f(2,10000), gale::distance::pixel));
mySpacer->propertyColor.set(etk::Color<>(0,0,0,0xFF)); mySpacer->propertyColor.set(etk::Color<>(0,0,0,0xFF));
// add it in the widget list // add it in the widget list
ewol::widget::Sizer::subWidgetAdd(mySpacer); ewol::widget::Sizer::subWidgetAdd(mySpacer);
@ -153,17 +153,17 @@ void ewol::widget::Menu::onButtonPressed(ewol::widget::ButtonWeak _button) {
} }
// 2 posible case (have a message or have a child ... // 2 posible case (have a message or have a child ...
if (it.m_message.size() > 0) { if (it.m_message.size() > 0) {
EWOL_DEBUG("Menu == > generate Event"); Log.debug("Menu == > generate Event");
// Send a multicast event ... // Send a multicast event ...
signalSelect.emit(it.m_message); signalSelect.emit(it.m_message);
ewol::widget::ContextMenuShared tmpContext = m_widgetContextMenu.lock(); ewol::widget::ContextMenuShared tmpContext = m_widgetContextMenu.lock();
if (tmpContext != null) { if (tmpContext != null) {
EWOL_DEBUG("Mark the menu to remove ..."); Log.debug("Mark the menu to remove ...");
tmpContext->destroy(); tmpContext->destroy();
} }
return; return;
} }
EWOL_DEBUG("Menu == > load Sub Menu"); Log.debug("Menu == > load Sub Menu");
bool findChild = false; bool findChild = false;
for (auto &it2 : m_listElement) { for (auto &it2 : m_listElement) {
if (it.m_localId == it2.m_parentId) { if (it.m_localId == it2.m_parentId) {
@ -179,15 +179,15 @@ void ewol::widget::Menu::onButtonPressed(ewol::widget::ButtonWeak _button) {
ewol::widget::ContextMenuShared tmpContext = ewol::widget::ContextMenu::create(); ewol::widget::ContextMenuShared tmpContext = ewol::widget::ContextMenu::create();
m_widgetContextMenu = tmpContext; m_widgetContextMenu = tmpContext;
if (tmpContext == null) { if (tmpContext == null) {
EWOL_ERROR("Allocation Error"); Log.error("Allocation Error");
return; return;
} }
// get the button widget: // get the button widget:
vec2 newPosition; Vector2f newPosition;
ewol::WidgetShared eventFromWidget = ememory::dynamicPointerCast<ewol::Widget>(caller); ewol::WidgetShared eventFromWidget = ememory::dynamicPointerCast<ewol::Widget>(caller);
if (eventFromWidget != null) { if (eventFromWidget != null) {
vec2 tmpOri = eventFromWidget->getOrigin(); Vector2f tmpOri = eventFromWidget->getOrigin();
vec2 tmpSize = eventFromWidget->getSize(); Vector2f tmpSize = eventFromWidget->getSize();
// calculate the correct position // calculate the correct position
newPosition.setValue(tmpOri.x() + tmpSize.x()/2, newPosition.setValue(tmpOri.x() + tmpSize.x()/2,
tmpOri.y() ); tmpOri.y() );
@ -198,8 +198,8 @@ void ewol::widget::Menu::onButtonPressed(ewol::widget::ButtonWeak _button) {
mySizer = ewol::widget::Sizer::create(); mySizer = ewol::widget::Sizer::create();
if (mySizer != null) { if (mySizer != null) {
mySizer->propertyMode.set(widget::Sizer::modeVert); mySizer->propertyMode.set(widget::Sizer::modeVert);
mySizer->propertyLockExpand.set(vec2(true,true)); mySizer->propertyLockExpand.set(Vector2f(true,true));
mySizer->propertyFill.set(vec2(true,true)); mySizer->propertyFill.set(Vector2f(true,true));
// set it in the pop-up-system: // set it in the pop-up-system:
tmpContext->setSubWidget(mySizer); tmpContext->setSubWidget(mySizer);
bool menuHaveImage = false; bool menuHaveImage = false;
@ -219,24 +219,24 @@ void ewol::widget::Menu::onButtonPressed(ewol::widget::ButtonWeak _button) {
if (m_listElement[iii].m_message == "" && m_listElement[iii].m_label == "") { if (m_listElement[iii].m_message == "" && m_listElement[iii].m_label == "") {
ewol::widget::SpacerShared mySpacer = ewol::widget::Spacer::create(); ewol::widget::SpacerShared mySpacer = ewol::widget::Spacer::create();
if (mySpacer == null) { if (mySpacer == null) {
EWOL_ERROR("Allocation spacer error"); Log.error("Allocation spacer error");
continue; continue;
} }
mySpacer->propertyExpand.set(bvec2(true,true)); mySpacer->propertyExpand.set(Vector2b(true,true));
mySpacer->propertyFill.set(bvec2(true,true)); mySpacer->propertyFill.set(Vector2b(true,true));
mySpacer->propertyMinSize.set(gale::Dimension(vec2(0,2), gale::distance::pixel)); mySpacer->propertyMinSize.set(gale::Dimension(Vector2f(0,2), gale::distance::pixel));
mySpacer->propertyMaxSize.set(gale::Dimension(vec2(10000,2), gale::distance::pixel)); mySpacer->propertyMaxSize.set(gale::Dimension(Vector2f(10000,2), gale::distance::pixel));
mySpacer->propertyColor.set(etk::Color<>(0,0,0,0xFF)); mySpacer->propertyColor.set(etk::Color<>(0,0,0,0xFF));
// add it in the widget list // add it in the widget list
mySizer->subWidgetAdd(mySpacer); mySizer->subWidgetAdd(mySpacer);
} else { } else {
myButton = ewol::widget::Button::create(); myButton = ewol::widget::Button::create();
if (myButton == null) { if (myButton == null) {
EWOL_ERROR("Allocation Error"); Log.error("Allocation Error");
continue; continue;
} }
myButton->propertyExpand.set(bvec2(true,true)); myButton->propertyExpand.set(Vector2b(true,true));
myButton->propertyFill.set(bvec2(true,true)); myButton->propertyFill.set(Vector2b(true,true));
// set callback // set callback
myButton->signalPressed.connect(sharedFromThis(), &ewol::widget::Menu::onButtonPressed, ewol::widget::ButtonWeak(myButton)); myButton->signalPressed.connect(sharedFromThis(), &ewol::widget::Menu::onButtonPressed, ewol::widget::ButtonWeak(myButton));
// add it in the widget list // add it in the widget list
@ -265,8 +265,8 @@ void ewol::widget::Menu::onButtonPressed(ewol::widget::ButtonWeak _button) {
ewol::widget::LabelShared tmpLabel = widget::Label::create(); ewol::widget::LabelShared tmpLabel = widget::Label::create();
if (tmpLabel != null) { if (tmpLabel != null) {
tmpLabel->propertyValue.set(etk::String("<left>") + m_listElement[iii].m_label + "</left>\n"); tmpLabel->propertyValue.set(etk::String("<left>") + m_listElement[iii].m_label + "</left>\n");
tmpLabel->propertyExpand.set(bvec2(true,false)); tmpLabel->propertyExpand.set(Vector2b(true,false));
tmpLabel->propertyFill.set(bvec2(true,true)); tmpLabel->propertyFill.set(Vector2b(true,true));
myButton->setSubWidget(tmpLabel); myButton->setSubWidget(tmpLabel);
} }
} }
@ -277,7 +277,7 @@ void ewol::widget::Menu::onButtonPressed(ewol::widget::ButtonWeak _button) {
} }
ewol::widget::WindowsShared currentWindows = getWindows(); ewol::widget::WindowsShared currentWindows = getWindows();
if (currentWindows == null) { if (currentWindows == null) {
EWOL_ERROR("Can not get the curent Windows..."); Log.error("Can not get the curent Windows...");
} else { } else {
currentWindows->popUpWidgetPush(tmpContext); currentWindows->popUpWidgetPush(tmpContext);
} }
@ -299,7 +299,7 @@ bool ewol::widget::Menu::loadXML(const exml::Element& _node) {
continue; continue;
} }
etk::String widgetName = pNode.getValue(); etk::String widgetName = pNode.getValue();
EWOL_INFO("Get node : " << pNode); Log.info("Get node : " << pNode);
if (widgetName == "elem") { if (widgetName == "elem") {
// <elem title="_T{Title of the button}" image="DATA:///List.svg" event="menu:exit"> // <elem title="_T{Title of the button}" image="DATA:///List.svg" event="menu:exit">
int32_t idMenu = addTitle(pNode.attributes["title"], pNode.attributes["image"], pNode.attributes["event"]); int32_t idMenu = addTitle(pNode.attributes["title"], pNode.attributes["image"], pNode.attributes["event"]);
@ -317,13 +317,13 @@ bool ewol::widget::Menu::loadXML(const exml::Element& _node) {
} else if (widgetName2 == "separator") { } else if (widgetName2 == "separator") {
addSpacer(idMenu); addSpacer(idMenu);
} else { } else {
EWOL_ERROR("[" << getId() << "] {" << getObjectType() << "} (l " << pNode2.getPos() << ") Unknown basic node='" << widgetName2 << "' not in : [elem,separator]" ); Log.error("[" << getId() << "] {" << getObjectType() << "} (l " << pNode2.getPos() << ") Unknown basic node='" << widgetName2 << "' not in : [elem,separator]" );
} }
} }
} else if (widgetName == "separator") { } else if (widgetName == "separator") {
addSpacer(); addSpacer();
} else { } else {
EWOL_ERROR("[" << getId() << "] {" << getObjectType() << "} (l " << pNode.getPos() << ") Unknown basic node='" << widgetName << "' not in : [elem,separator]" ); Log.error("[" << getId() << "] {" << getObjectType() << "} (l " << pNode.getPos() << ") Unknown basic node='" << widgetName << "' not in : [elem,separator]" );
} }
} }
return true; return true;

View File

@ -45,7 +45,7 @@ namespace ewol {
void subWidgetUnLink(ewol::WidgetShared _newWidget) override; void subWidgetUnLink(ewol::WidgetShared _newWidget) override;
bool loadXML(const exml::Element& _node) override; bool loadXML(const exml::Element& _node) override;
private: private:
etk::Vector<ewol::widget::MenuElement> m_listElement; List<ewol::widget::MenuElement> m_listElement;
int32_t m_staticId; // unique ID for every element of the menu ... int32_t m_staticId; // unique ID for every element of the menu ...
ewol::widget::ContextMenuWeak m_widgetContextMenu; ewol::widget::ContextMenuWeak m_widgetContextMenu;
int32_t get(const etk::String& _label); int32_t get(const etk::String& _label);

View File

@ -21,7 +21,7 @@ ewol::widget::PopUp::PopUp() :
"The shaper properties", "The shaper properties",
&ewol::widget::PopUp::onChangePropertyShape), &ewol::widget::PopUp::onChangePropertyShape),
propertyLockExpand(this, "lock", propertyLockExpand(this, "lock",
bvec2(true,true), Vector2b(true,true),
"Lock expand contamination", "Lock expand contamination",
&ewol::widget::PopUp::onChangePropertyLockExpand), &ewol::widget::PopUp::onChangePropertyLockExpand),
propertyCloseOutEvent(this, "out-click-remove", propertyCloseOutEvent(this, "out-click-remove",
@ -33,10 +33,10 @@ ewol::widget::PopUp::PopUp() :
void ewol::widget::PopUp::init() { void ewol::widget::PopUp::init() {
ewol::widget::Container::init(); ewol::widget::Container::init();
propertyFill.set(bvec2(false,false)); propertyFill.set(Vector2b(false,false));
propertyShape.notifyChange(); propertyShape.notifyChange();
propertyMinSize.set(gale::Dimension(vec2(80,80),gale::distance::pourcent)); propertyMinSize.set(gale::Dimension(Vector2f(80,80),gale::distance::pourcent));
propertyExpand.set(bvec2(false, false)); propertyExpand.set(Vector2b(false, false));
} }
ewol::widget::PopUp::~PopUp() { ewol::widget::PopUp::~PopUp() {
@ -48,7 +48,7 @@ void ewol::widget::PopUp::onChangeSize() {
return; return;
} }
ewol::Padding padding = m_shaper.getPadding(); ewol::Padding padding = m_shaper.getPadding();
vec2 subWidgetSize = m_subWidget->getCalculateMinSize(); Vector2f subWidgetSize = m_subWidget->getCalculateMinSize();
if (m_subWidget->canExpand().x() == true) { if (m_subWidget->canExpand().x() == true) {
if (propertyLockExpand->x() == true) { if (propertyLockExpand->x() == true) {
subWidgetSize.setX(m_minSize.x()); subWidgetSize.setX(m_minSize.x());
@ -66,11 +66,11 @@ void ewol::widget::PopUp::onChangeSize() {
// limit the size of the element : // limit the size of the element :
//subWidgetSize.setMin(m_minSize); //subWidgetSize.setMin(m_minSize);
// posiition at a int32_t pos : // posiition at a int32_t pos :
subWidgetSize = vec2ClipInt32(subWidgetSize); subWidgetSize = Vector2fClipInt32(subWidgetSize);
// set config to the Sub-widget // set config to the Sub-widget
vec2 subWidgetOrigin = m_origin + (m_size-subWidgetSize)/2.0f; Vector2f subWidgetOrigin = m_origin + (m_size-subWidgetSize)/2.0f;
subWidgetOrigin = vec2ClipInt32(subWidgetOrigin); subWidgetOrigin = Vector2fClipInt32(subWidgetOrigin);
m_subWidget->setOrigin(subWidgetOrigin); m_subWidget->setOrigin(subWidgetOrigin);
m_subWidget->setSize(subWidgetSize); m_subWidget->setSize(subWidgetSize);
@ -102,9 +102,9 @@ void ewol::widget::PopUp::onRegenerateDisplay() {
if (needRedraw() == true) { if (needRedraw() == true) {
m_shaper.clear(); m_shaper.clear();
ewol::Padding padding = m_shaper.getPadding(); ewol::Padding padding = m_shaper.getPadding();
vec2 tmpSize(0,0); Vector2f tmpSize(0,0);
bvec2 expand = canExpand(); Vector2b expand = canExpand();
bvec2 fill = canFill(); Vector2b fill = canFill();
if (fill.x() == true) { if (fill.x() == true) {
tmpSize.setX(m_size.x()-padding.x()); tmpSize.setX(m_size.x()-padding.x());
} }
@ -112,14 +112,14 @@ void ewol::widget::PopUp::onRegenerateDisplay() {
tmpSize.setY(m_size.y()-padding.y()); tmpSize.setY(m_size.y()-padding.y());
} }
if (m_subWidget != null) { if (m_subWidget != null) {
vec2 tmpSize = m_subWidget->getSize(); Vector2f tmpSize = m_subWidget->getSize();
} }
tmpSize.setMax(m_minSize); tmpSize.setMax(m_minSize);
vec2 tmpOrigin = (m_size-tmpSize)/2.0f; Vector2f tmpOrigin = (m_size-tmpSize)/2.0f;
m_shaper.setShape(vec2(0,0), m_shaper.setShape(Vector2f(0,0),
vec2ClipInt32(m_size), Vector2fClipInt32(m_size),
vec2ClipInt32(tmpOrigin-vec2(padding.xLeft(), padding.yButtom())), Vector2fClipInt32(tmpOrigin-Vector2f(padding.xLeft(), padding.yButtom())),
vec2ClipInt32(tmpSize + vec2(padding.x(), padding.y()))); Vector2fClipInt32(tmpSize + Vector2f(padding.x(), padding.y())));
} }
// SUBwIDGET GENERATION ... // SUBwIDGET GENERATION ...
if (m_subWidget != null) { if (m_subWidget != null) {
@ -127,7 +127,7 @@ void ewol::widget::PopUp::onRegenerateDisplay() {
} }
} }
ewol::WidgetShared ewol::widget::PopUp::getWidgetAtPos(const vec2& _pos) { ewol::WidgetShared ewol::widget::PopUp::getWidgetAtPos(const Vector2f& _pos) {
ewol::WidgetShared val = ewol::widget::Container::getWidgetAtPos(_pos); ewol::WidgetShared val = ewol::widget::Container::getWidgetAtPos(_pos);
if (val != null) { if (val != null) {
return val; return val;
@ -157,16 +157,16 @@ bool ewol::widget::PopUp::onEventInput(const ewol::event::Input& _event) {
return false; return false;
} }
ewol::Padding padding = m_shaper.getPadding(); ewol::Padding padding = m_shaper.getPadding();
vec2 tmpSize(0,0); Vector2f tmpSize(0,0);
if (m_subWidget != null) { if (m_subWidget != null) {
vec2 tmpSize = m_subWidget->getSize(); Vector2f tmpSize = m_subWidget->getSize();
} }
tmpSize.setMax(m_minSize); tmpSize.setMax(m_minSize);
vec2 tmpOrigin = (m_size-tmpSize)/2.0f; Vector2f tmpOrigin = (m_size-tmpSize)/2.0f;
tmpOrigin -= vec2(padding.xLeft(), padding.yButtom()); tmpOrigin -= Vector2f(padding.xLeft(), padding.yButtom());
tmpSize += vec2(padding.x(), padding.y()); tmpSize += Vector2f(padding.x(), padding.y());
vec2 pos = relativePosition(_event.getPos()); Vector2f pos = relativePosition(_event.getPos());
if( pos.x() < tmpOrigin.x() if( pos.x() < tmpOrigin.x()
|| pos.y() < tmpOrigin.y() || pos.y() < tmpOrigin.y()
|| pos.x() > tmpOrigin.x()+tmpSize.x() || pos.x() > tmpOrigin.x()+tmpSize.x()

View File

@ -24,7 +24,7 @@ namespace ewol {
class PopUp : public ewol::widget::Container { class PopUp : public ewol::widget::Container {
public: // properties public: // properties
eproperty::Value<etk::Uri> propertyShape; //!< Compositing theme. eproperty::Value<etk::Uri> propertyShape; //!< Compositing theme.
eproperty::Value<bvec2> propertyLockExpand; //!< Lock the expend of the sub widget to this one == > this permit to limit bigger subWidget eproperty::Value<Vector2b> propertyLockExpand; //!< Lock the expend of the sub widget to this one == > this permit to limit bigger subWidget
eproperty::Value<bool> propertyCloseOutEvent; //!< ratio progression of a sliding eproperty::Value<bool> propertyCloseOutEvent; //!< ratio progression of a sliding
protected: protected:
/** /**
@ -48,7 +48,7 @@ namespace ewol {
void onRegenerateDisplay() override; void onRegenerateDisplay() override;
void onChangeSize() override; void onChangeSize() override;
bool onEventInput(const ewol::event::Input& _event) override; bool onEventInput(const ewol::event::Input& _event) override;
ewol::WidgetShared getWidgetAtPos(const vec2& _pos) override; ewol::WidgetShared getWidgetAtPos(const Vector2f& _pos) override;
protected: protected:
virtual void onChangePropertyShape(); virtual void onChangePropertyShape();
virtual void onChangePropertyLockExpand(); virtual void onChangePropertyLockExpand();

View File

@ -43,7 +43,7 @@ ewol::widget::ProgressBar::~ProgressBar() {
} }
void ewol::widget::ProgressBar::calculateMinMaxSize() { void ewol::widget::ProgressBar::calculateMinMaxSize() {
vec2 tmpMin = propertyMinSize->getPixel(); Vector2f tmpMin = propertyMinSize->getPixel();
m_minSize.setValue( etk::max(tmpMin.x(), 40.0f), m_minSize.setValue( etk::max(tmpMin.x(), 40.0f),
etk::max(tmpMin.y(), dotRadius*2.0f) ); etk::max(tmpMin.y(), dotRadius*2.0f) );
markToRedraw(); markToRedraw();
@ -67,11 +67,11 @@ void ewol::widget::ProgressBar::onRegenerateDisplay() {
int32_t tmpOriginX = 5; int32_t tmpOriginX = 5;
int32_t tmpOriginY = 5; int32_t tmpOriginY = 5;
m_draw.setColor(propertyTextColorBgOn); m_draw.setColor(propertyTextColorBgOn);
m_draw.setPos(vec3(tmpOriginX, tmpOriginY, 0) ); m_draw.setPos(Vector3f(tmpOriginX, tmpOriginY, 0) );
m_draw.rectangleWidth(vec3(tmpSizeX*propertyValue, tmpSizeY, 0) ); m_draw.rectangleWidth(Vector3f(tmpSizeX*propertyValue, tmpSizeY, 0) );
m_draw.setColor(propertyTextColorBgOff); m_draw.setColor(propertyTextColorBgOff);
m_draw.setPos(vec3(tmpOriginX+tmpSizeX*propertyValue, tmpOriginY, 0) ); m_draw.setPos(Vector3f(tmpOriginX+tmpSizeX*propertyValue, tmpOriginY, 0) );
m_draw.rectangleWidth(vec3(tmpSizeX*(1.0-propertyValue), tmpSizeY, 0) ); m_draw.rectangleWidth(Vector3f(tmpSizeX*(1.0-propertyValue), tmpSizeY, 0) );
// TODO : Create a better progress Bar ... // TODO : Create a better progress Bar ...
//m_draw.setColor(propertyTextColorFg); //m_draw.setColor(propertyTextColorFg);

View File

@ -14,7 +14,7 @@ ETK_DECLARE_TYPE(ewol::widget::Scroll);
ewol::widget::Scroll::Scroll() : ewol::widget::Scroll::Scroll() :
propertyLimit(this, "limit", propertyLimit(this, "limit",
vec2(0.15,0.5), vec2(0.0,0.0), vec2(1.0,1.0), Vector2f(0.15,0.5), Vector2f(0.0,0.0), Vector2f(1.0,1.0),
"Limit the scroll maximum position [0..1]% represent the free space in the scoll when arrive at the end", "Limit the scroll maximum position [0..1]% represent the free space in the scoll when arrive at the end",
&ewol::widget::Scroll::onChangePropertyLimit), &ewol::widget::Scroll::onChangePropertyLimit),
propertyShapeVert(this, "shape-vert", propertyShapeVert(this, "shape-vert",
@ -70,15 +70,15 @@ void ewol::widget::Scroll::onChangeSize() {
return; return;
} }
// remove the bar if hover // remove the bar if hover
vec2 basicSize = m_size; Vector2f basicSize = m_size;
if (*propertyHover == false) { if (*propertyHover == false) {
basicSize -= vec2(SCROLL_BAR_SPACE,SCROLL_BAR_SPACE); basicSize -= Vector2f(SCROLL_BAR_SPACE,SCROLL_BAR_SPACE);
} }
vec2 origin = m_origin+m_offset; Vector2f origin = m_origin+m_offset;
vec2 minSize = m_subWidget->getCalculateMinSize(); Vector2f minSize = m_subWidget->getCalculateMinSize();
bvec2 expand = m_subWidget->propertyExpand.get(); Vector2b expand = m_subWidget->propertyExpand.get();
//The gravity is not set on the sub element ==> special use of the widget //The gravity is not set on the sub element ==> special use of the widget
//origin += ewol::gravityGenerateDelta(propertyGravity.get(), minSize - m_size); //origin += ewol::gravityGenerateDelta(propertyGravity.get(), minSize - m_size);
if ( expand.x() == true if ( expand.x() == true
@ -91,14 +91,14 @@ void ewol::widget::Scroll::onChangeSize() {
} }
m_subWidget->setSize(minSize); m_subWidget->setSize(minSize);
if (*propertyGravity == ewol::gravity_top) { if (*propertyGravity == ewol::gravity_top) {
origin += vec2(0.0f, basicSize.y()-minSize.y()); origin += Vector2f(0.0f, basicSize.y()-minSize.y());
if (*propertyHover == false) { if (*propertyHover == false) {
origin += vec2(0,SCROLL_BAR_SPACE); origin += Vector2f(0,SCROLL_BAR_SPACE);
} }
} else if (*propertyGravity == ewol::gravity_buttom) { } else if (*propertyGravity == ewol::gravity_buttom) {
// nothing to do ... origin += // nothing to do ... origin +=
} else { } else {
EWOL_ERROR(" Not manage other gravity ..."); Log.error(" Not manage other gravity ...");
} }
m_subWidget->setOrigin(origin); m_subWidget->setOrigin(origin);
m_subWidget->onChangeSize(); m_subWidget->onChangeSize();
@ -130,12 +130,12 @@ void ewol::widget::Scroll::onDraw() {
m_shaperV.draw(); m_shaperV.draw();
/* /*
ewol::compositing::Drawing draw; ewol::compositing::Drawing draw;
draw.setPos(vec2(10,10)); draw.setPos(Vector2f(10,10));
draw.setColor(etk::color::orange); draw.setColor(etk::color::orange);
draw.rectangleWidth(vec2(25,25)); draw.rectangleWidth(Vector2f(25,25));
draw.setPos(m_size - vec2(35,35)); draw.setPos(m_size - Vector2f(35,35));
draw.setColor(etk::color::green); draw.setColor(etk::color::green);
draw.rectangleWidth(vec2(25,25)); draw.rectangleWidth(Vector2f(25,25));
draw.draw(); draw.draw();
*/ */
} }
@ -154,8 +154,8 @@ void ewol::widget::Scroll::onRegenerateDisplay() {
m_shaperV.clear(); m_shaperV.clear();
ewol::Padding paddingVert = m_shaperV.getPadding(); ewol::Padding paddingVert = m_shaperV.getPadding();
ewol::Padding paddingHori = m_shaperH.getPadding(); ewol::Padding paddingHori = m_shaperH.getPadding();
vec2 scrollOffset(0,0); Vector2f scrollOffset(0,0);
vec2 scrollSize(0,0); Vector2f scrollSize(0,0);
if (m_subWidget != null) { if (m_subWidget != null) {
scrollOffset = m_subWidget->getOffset(); scrollOffset = m_subWidget->getOffset();
scrollSize = m_subWidget->getSize(); scrollSize = m_subWidget->getSize();
@ -167,10 +167,10 @@ void ewol::widget::Scroll::onRegenerateDisplay() {
float originScrollBar = scrollOffset.y() / (scrollSize.y()-m_size.y()*propertyLimit->y()); float originScrollBar = scrollOffset.y() / (scrollSize.y()-m_size.y()*propertyLimit->y());
originScrollBar = etk::avg(0.0f, originScrollBar, 1.0f); originScrollBar = etk::avg(0.0f, originScrollBar, 1.0f);
originScrollBar *= (m_size.y()-lenScrollBar); originScrollBar *= (m_size.y()-lenScrollBar);
m_shaperV.setShape(vec2(m_size.x() - paddingVert.x(), 0), m_shaperV.setShape(Vector2f(m_size.x() - paddingVert.x(), 0),
vec2(paddingVert.x(), m_size.y()), Vector2f(paddingVert.x(), m_size.y()),
vec2(m_size.x() - paddingVert.xRight(), m_size.y() - originScrollBar - lenScrollBar), Vector2f(m_size.x() - paddingVert.xRight(), m_size.y() - originScrollBar - lenScrollBar),
vec2(0, lenScrollBar)); Vector2f(0, lenScrollBar));
} }
if( m_size.x() < scrollSize.x() if( m_size.x() < scrollSize.x()
|| scrollOffset.x() != 0) { || scrollOffset.x() != 0) {
@ -179,24 +179,24 @@ void ewol::widget::Scroll::onRegenerateDisplay() {
float originScrollBar = scrollOffset.x() / (scrollSize.x()-m_size.x()*propertyLimit->x()); float originScrollBar = scrollOffset.x() / (scrollSize.x()-m_size.x()*propertyLimit->x());
originScrollBar = etk::avg(0.0f, originScrollBar, 1.0f); originScrollBar = etk::avg(0.0f, originScrollBar, 1.0f);
originScrollBar *= (m_size.x()-paddingHori.xRight()-lenScrollBar); originScrollBar *= (m_size.x()-paddingHori.xRight()-lenScrollBar);
m_shaperH.setShape(vec2(0, 0), m_shaperH.setShape(Vector2f(0, 0),
vec2(m_size.x()-paddingVert.x(), paddingHori.y()), Vector2f(m_size.x()-paddingVert.x(), paddingHori.y()),
vec2(originScrollBar, paddingHori.yButtom()), Vector2f(originScrollBar, paddingHori.yButtom()),
vec2(lenScrollBar, 0)); Vector2f(lenScrollBar, 0));
} }
} }
bool ewol::widget::Scroll::onEventInput(const ewol::event::Input& _event) { bool ewol::widget::Scroll::onEventInput(const ewol::event::Input& _event) {
//ewol::event::Input _event = event; //ewol::event::Input _event = event;
//_event.setType(gale::key::type::finger); //_event.setType(gale::key::type::finger);
vec2 relativePos = relativePosition(_event.getPos()); Vector2f relativePos = relativePosition(_event.getPos());
vec2 scrollOffset(0,0); Vector2f scrollOffset(0,0);
vec2 scrollSize(0,0); Vector2f scrollSize(0,0);
if (m_subWidget != null) { if (m_subWidget != null) {
scrollOffset = m_subWidget->getOffset(); scrollOffset = m_subWidget->getOffset();
scrollSize = m_subWidget->getSize(); scrollSize = m_subWidget->getSize();
} }
EWOL_VERBOSE("Get Event on scroll : " << _event); Log.verbose("Get Event on scroll : " << _event);
relativePos.setY(m_size.y() - relativePos.y()); relativePos.setY(m_size.y() - relativePos.y());
if( _event.getType() == gale::key::type::mouse if( _event.getType() == gale::key::type::mouse
&& ( m_highSpeedType == gale::key::type::unknow && ( m_highSpeedType == gale::key::type::unknow
@ -242,7 +242,7 @@ bool ewol::widget::Scroll::onEventInput(const ewol::event::Input& _event) {
return false; return false;
} else if( _event.getId() == 4 } else if( _event.getId() == 4
&& _event.getStatus() == gale::key::status::up) { && _event.getStatus() == gale::key::status::up) {
EWOL_VERBOSE(" mode UP " << m_size.y() << "<" << scrollSize.y()); Log.verbose(" mode UP " << m_size.y() << "<" << scrollSize.y());
if(m_size.y() < scrollSize.y()) { if(m_size.y() < scrollSize.y()) {
scrollOffset.setY(scrollOffset.y()-m_pixelScrolling); scrollOffset.setY(scrollOffset.y()-m_pixelScrolling);
scrollOffset.setY(etk::avg(0.0f, scrollOffset.y(), (scrollSize.y() - m_size.y()*propertyLimit->y()))); scrollOffset.setY(etk::avg(0.0f, scrollOffset.y(), (scrollSize.y() - m_size.y()*propertyLimit->y())));
@ -254,7 +254,7 @@ bool ewol::widget::Scroll::onEventInput(const ewol::event::Input& _event) {
} }
} else if( _event.getId() == 5 } else if( _event.getId() == 5
&& _event.getStatus() == gale::key::status::up) { && _event.getStatus() == gale::key::status::up) {
EWOL_VERBOSE(" mode DOWN " << m_size.y() << "<" << scrollSize.y()); Log.verbose(" mode DOWN " << m_size.y() << "<" << scrollSize.y());
if(m_size.y() < scrollSize.y()) { if(m_size.y() < scrollSize.y()) {
scrollOffset.setY(scrollOffset.y()+m_pixelScrolling); scrollOffset.setY(scrollOffset.y()+m_pixelScrolling);
scrollOffset.setY(etk::avg(0.0f, scrollOffset.y(), (scrollSize.y() - m_size.y()*propertyLimit->y()))); scrollOffset.setY(etk::avg(0.0f, scrollOffset.y(), (scrollSize.y() - m_size.y()*propertyLimit->y())));
@ -358,17 +358,17 @@ bool ewol::widget::Scroll::onEventInput(const ewol::event::Input& _event) {
&& ( gale::key::type::unknow == m_highSpeedType && ( gale::key::type::unknow == m_highSpeedType
|| gale::key::type::finger == m_highSpeedType ) ) { || gale::key::type::finger == m_highSpeedType ) ) {
if (1 == _event.getId()) { if (1 == _event.getId()) {
EWOL_VERBOSE("event: " << _event); Log.verbose("event: " << _event);
if (gale::key::status::down == _event.getStatus()) { if (gale::key::status::down == _event.getStatus()) {
m_highSpeedMode = speedModeInit; m_highSpeedMode = speedModeInit;
m_highSpeedType = gale::key::type::finger; m_highSpeedType = gale::key::type::finger;
m_highSpeedStartPos.setValue(relativePos.x(), relativePos.y()); m_highSpeedStartPos.setValue(relativePos.x(), relativePos.y());
EWOL_VERBOSE("SCROOL == > INIT pos=" << m_highSpeedStartPos << " && curent scrollOffset=" << scrollOffset); Log.verbose("SCROOL == > INIT pos=" << m_highSpeedStartPos << " && curent scrollOffset=" << scrollOffset);
return true; return true;
} else if (gale::key::status::upAfter == _event.getStatus()) { } else if (gale::key::status::upAfter == _event.getStatus()) {
m_highSpeedMode = speedModeDisable; m_highSpeedMode = speedModeDisable;
m_highSpeedType = gale::key::type::unknow; m_highSpeedType = gale::key::type::unknow;
EWOL_VERBOSE("SCROOL == > DISABLE"); Log.verbose("SCROOL == > DISABLE");
markToRedraw(); markToRedraw();
return true; return true;
} else if ( m_highSpeedMode == speedModeInit } else if ( m_highSpeedMode == speedModeInit
@ -379,14 +379,14 @@ bool ewol::widget::Scroll::onEventInput(const ewol::event::Input& _event) {
// the scrooling can start : // the scrooling can start :
// select the direction : // select the direction :
m_highSpeedMode = speedModeEnableFinger; m_highSpeedMode = speedModeEnableFinger;
EWOL_VERBOSE("SCROOL == > ENABLE"); Log.verbose("SCROOL == > ENABLE");
markToRedraw(); markToRedraw();
} }
return true; return true;
} }
if ( m_highSpeedMode == speedModeEnableFinger if ( m_highSpeedMode == speedModeEnableFinger
&& gale::key::status::move == _event.getStatus()) { && gale::key::status::move == _event.getStatus()) {
EWOL_VERBOSE("SCROOL == > INIT scrollOffset=" << scrollOffset.y() << " relativePos=" << relativePos.y() << " m_highSpeedStartPos=" << m_highSpeedStartPos.y()); Log.verbose("SCROOL == > INIT scrollOffset=" << scrollOffset.y() << " relativePos=" << relativePos.y() << " m_highSpeedStartPos=" << m_highSpeedStartPos.y());
//scrollOffset.x = (int32_t)(scrollSize.x * x / m_size.x); //scrollOffset.x = (int32_t)(scrollSize.x * x / m_size.x);
if (propertyLimit->x() != 0.0f) { if (propertyLimit->x() != 0.0f) {
scrollOffset.setX(scrollOffset.x() + (relativePos.x() - m_highSpeedStartPos.x())); scrollOffset.setX(scrollOffset.x() + (relativePos.x() - m_highSpeedStartPos.x()));
@ -398,7 +398,7 @@ bool ewol::widget::Scroll::onEventInput(const ewol::event::Input& _event) {
} }
// update current position: // update current position:
m_highSpeedStartPos = relativePos; m_highSpeedStartPos = relativePos;
EWOL_VERBOSE("SCROOL == > MOVE " << scrollOffset); Log.verbose("SCROOL == > MOVE " << scrollOffset);
markToRedraw(); markToRedraw();
if (m_subWidget != null) { if (m_subWidget != null) {
m_subWidget->setOffset(scrollOffset); m_subWidget->setOffset(scrollOffset);
@ -412,7 +412,7 @@ bool ewol::widget::Scroll::onEventInput(const ewol::event::Input& _event) {
&& gale::key::status::leave == _event.getStatus()) { && gale::key::status::leave == _event.getStatus()) {
m_highSpeedMode = speedModeDisable; m_highSpeedMode = speedModeDisable;
m_highSpeedType = gale::key::type::unknow; m_highSpeedType = gale::key::type::unknow;
EWOL_VERBOSE("SCROOL == > DISABLE"); Log.verbose("SCROOL == > DISABLE");
markToRedraw(); markToRedraw();
return true; return true;
} }
@ -420,7 +420,7 @@ bool ewol::widget::Scroll::onEventInput(const ewol::event::Input& _event) {
return false; return false;
} }
ewol::WidgetShared ewol::widget::Scroll::getWidgetAtPos(const vec2& _pos) { ewol::WidgetShared ewol::widget::Scroll::getWidgetAtPos(const Vector2f& _pos) {
ewol::WidgetShared tmpWidget = ewol::widget::Container::getWidgetAtPos(_pos); ewol::WidgetShared tmpWidget = ewol::widget::Container::getWidgetAtPos(_pos);
if (tmpWidget != null) { if (tmpWidget != null) {
return tmpWidget; return tmpWidget;

View File

@ -19,7 +19,7 @@ namespace ewol {
using ScrollWeak = ememory::WeakPtr<ewol::widget::Scroll>; using ScrollWeak = ememory::WeakPtr<ewol::widget::Scroll>;
class Scroll : public ewol::widget::Container { class Scroll : public ewol::widget::Container {
public: // properties public: // properties
eproperty::Range<vec2> propertyLimit; //!< Set the limitation of the ratio in the sreen eproperty::Range<Vector2f> propertyLimit; //!< Set the limitation of the ratio in the sreen
eproperty::Value<etk::Uri> propertyShapeVert; //!< Vertical shaper name eproperty::Value<etk::Uri> propertyShapeVert; //!< Vertical shaper name
eproperty::Value<etk::Uri> propertyShapeHori; //!< Horizontal shaper name eproperty::Value<etk::Uri> propertyShapeHori; //!< Horizontal shaper name
eproperty::Value<bool> propertyHover; //!< Horizontal shaper name eproperty::Value<bool> propertyHover; //!< Horizontal shaper name
@ -37,7 +37,7 @@ namespace ewol {
ewol::compositing::Shaper m_shaperV; //!< Compositing theme Vertical. ewol::compositing::Shaper m_shaperV; //!< Compositing theme Vertical.
private: private:
float m_pixelScrolling; float m_pixelScrolling;
vec2 m_highSpeedStartPos; Vector2f m_highSpeedStartPos;
enum highSpeedMode m_highSpeedMode; enum highSpeedMode m_highSpeedMode;
int32_t m_highSpeedButton; int32_t m_highSpeedButton;
enum gale::key::type m_highSpeedType; enum gale::key::type m_highSpeedType;
@ -53,7 +53,7 @@ namespace ewol {
void onRegenerateDisplay() override; void onRegenerateDisplay() override;
bool onEventInput(const ewol::event::Input& _event) override; bool onEventInput(const ewol::event::Input& _event) override;
void systemDraw(const ewol::DrawProperty& _displayProp) override; void systemDraw(const ewol::DrawProperty& _displayProp) override;
ewol::WidgetShared getWidgetAtPos(const vec2& _pos) override; ewol::WidgetShared getWidgetAtPos(const Vector2f& _pos) override;
protected: protected:
void onDraw() override; void onDraw() override;
protected: protected:

View File

@ -46,7 +46,7 @@ ewol::widget::Select::~Select() {
void ewol::widget::Select::onChangePropertyValue() { void ewol::widget::Select::onChangePropertyValue() {
markToRedraw(); markToRedraw();
if (m_widgetEntry == null) { if (m_widgetEntry == null) {
EWOL_ERROR("Can not acces at entry ..."); Log.error("Can not acces at entry ...");
return; return;
} }
for (auto &it : m_listElement) { for (auto &it : m_listElement) {
@ -64,7 +64,7 @@ void ewol::widget::Select::onChangePropertyValue() {
void ewol::widget::Select::optionSelectDefault() { void ewol::widget::Select::optionSelectDefault() {
if (m_widgetEntry == null) { if (m_widgetEntry == null) {
EWOL_ERROR("Can not acces at entry ..."); Log.error("Can not acces at entry ...");
return; return;
} }
for (auto &it : m_listElement) { for (auto &it : m_listElement) {
@ -81,7 +81,7 @@ void ewol::widget::Select::optionSelectDefault() {
void ewol::widget::Select::optionRemove(int32_t _value) { void ewol::widget::Select::optionRemove(int32_t _value) {
for (auto it=m_listElement.begin(); it != m_listElement.end(); ++it) { for (auto it=m_listElement.begin(); it != m_listElement.end(); ++it) {
if (_value == it->m_value) { if (_value == it->m_value) {
EWOL_DEBUG("remove element: " << _value); Log.debug("remove element: " << _value);
m_listElement.erase(it); m_listElement.erase(it);
break; break;
} }
@ -97,7 +97,7 @@ void ewol::widget::Select::optionClear() {
void ewol::widget::Select::optionAdd(int32_t _value, etk::String _data) { void ewol::widget::Select::optionAdd(int32_t _value, etk::String _data) {
for (auto &it : m_listElement) { for (auto &it : m_listElement) {
if (_value == it.m_value) { if (_value == it.m_value) {
EWOL_DEBUG("replace element: " << _value << " with: '" << _data << "'"); Log.debug("replace element: " << _value << " with: '" << _data << "'");
it.m_name = _data; it.m_name = _data;
} }
} }
@ -120,7 +120,7 @@ bool ewol::widget::Select::loadXML(const exml::Element& _node) {
continue; continue;
} }
if (pNode.getValue() != "option") { if (pNode.getValue() != "option") {
EWOL_ERROR("(l " << pNode.getPos() << ") Unknown basic node='" << pNode.getValue() << "' not in : [option]" ); Log.error("(l " << pNode.getPos() << ") Unknown basic node='" << pNode.getValue() << "' not in : [option]" );
continue; continue;
} }
etk::String valId = pNode.attributes["id"]; etk::String valId = pNode.attributes["id"];
@ -152,7 +152,7 @@ void ewol::widget::Select::updateGui() {
} }
void ewol::widget::Select::onCallbackLabelPressed(int32_t _value) { void ewol::widget::Select::onCallbackLabelPressed(int32_t _value) {
EWOL_VERBOSE("User select:" << _value); Log.verbose("User select:" << _value);
propertyValue.set(_value); propertyValue.set(_value);
} }
@ -160,7 +160,7 @@ void ewol::widget::Select::onCallbackOpenMenu() {
// create a context menu: // create a context menu:
ewol::widget::ContextMenuShared tmpContext = ewol::widget::ContextMenu::create(); ewol::widget::ContextMenuShared tmpContext = ewol::widget::ContextMenu::create();
if (tmpContext == null) { if (tmpContext == null) {
EWOL_ERROR("Allocation Error"); Log.error("Allocation Error");
return; return;
} }
// auto-select mark position: // auto-select mark position:
@ -168,18 +168,18 @@ void ewol::widget::Select::onCallbackOpenMenu() {
ewol::widget::SizerShared mySizer; ewol::widget::SizerShared mySizer;
mySizer = ewol::widget::Sizer::create(); mySizer = ewol::widget::Sizer::create();
if (mySizer == null) { if (mySizer == null) {
EWOL_ERROR("Allocation Error or sizer"); Log.error("Allocation Error or sizer");
return; return;
} }
mySizer->propertyMode.set(widget::Sizer::modeVert); mySizer->propertyMode.set(widget::Sizer::modeVert);
mySizer->propertyLockExpand.set(vec2(true,true)); mySizer->propertyLockExpand.set(Vector2f(true,true));
mySizer->propertyFill.set(vec2(true,true)); mySizer->propertyFill.set(Vector2f(true,true));
// set it in the pop-up-system: // set it in the pop-up-system:
tmpContext->setSubWidget(mySizer); tmpContext->setSubWidget(mySizer);
for (auto &it : m_listElement) { for (auto &it : m_listElement) {
ewol::widget::LabelShared myLabel = ewol::widget::Label::create(); ewol::widget::LabelShared myLabel = ewol::widget::Label::create();
if (myLabel == null) { if (myLabel == null) {
EWOL_ERROR("Allocation Error"); Log.error("Allocation Error");
continue; continue;
} }
if (it.m_selected == true) { if (it.m_selected == true) {
@ -187,8 +187,8 @@ void ewol::widget::Select::onCallbackOpenMenu() {
} else { } else {
myLabel->propertyValue.set(it.m_name); myLabel->propertyValue.set(it.m_name);
} }
myLabel->propertyExpand.set(bvec2(true,true)); myLabel->propertyExpand.set(Vector2b(true,true));
myLabel->propertyFill.set(bvec2(true,true)); myLabel->propertyFill.set(Vector2b(true,true));
// set callback // set callback
myLabel->signalPressed.connect(sharedFromThis(), &ewol::widget::Select::onCallbackLabelPressed, it.m_value); myLabel->signalPressed.connect(sharedFromThis(), &ewol::widget::Select::onCallbackLabelPressed, it.m_value);
myLabel->signalPressed.connect(tmpContext, &ewol::widget::ContextMenu::destroy); myLabel->signalPressed.connect(tmpContext, &ewol::widget::ContextMenu::destroy);
@ -197,7 +197,7 @@ void ewol::widget::Select::onCallbackOpenMenu() {
} }
ewol::widget::WindowsShared currentWindows = getWindows(); ewol::widget::WindowsShared currentWindows = getWindows();
if (currentWindows == null) { if (currentWindows == null) {
EWOL_ERROR("Can not get the curent Windows..."); Log.error("Can not get the curent Windows...");
} else { } else {
currentWindows->popUpWidgetPush(tmpContext); currentWindows->popUpWidgetPush(tmpContext);
} }

View File

@ -42,11 +42,11 @@ namespace ewol {
etk::String m_name; etk::String m_name;
bool m_selected; bool m_selected;
public: public:
// TODO: Remove this: due to the fact my etk::Vector is not full implemented // TODO: Remove this: due to the fact my List is not full implemented
Element() {} Element() {}
Element(int32_t _value, etk::String _name, bool _selected=false); Element(int32_t _value, etk::String _name, bool _selected=false);
}; };
etk::Vector<ewol::widget::Select::Element> m_listElement; List<ewol::widget::Select::Element> m_listElement;
public: public:
void optionSelectDefault(); void optionSelectDefault();
void optionRemove(int32_t _value); void optionRemove(int32_t _value);

View File

@ -17,7 +17,7 @@ ewol::widget::Sizer::Sizer() :
"The display mode", "The display mode",
&ewol::widget::Sizer::onChangePropertyMode), &ewol::widget::Sizer::onChangePropertyMode),
propertyBorderSize(this, "border", propertyBorderSize(this, "border",
vec2(0,0), Vector2f(0,0),
"The sizer border size", "The sizer border size",
&ewol::widget::Sizer::onChangePropertyBorderSize), &ewol::widget::Sizer::onChangePropertyBorderSize),
propertyAnimation(this, "annimation", propertyAnimation(this, "annimation",
@ -37,37 +37,37 @@ ewol::widget::Sizer::Sizer() :
} }
ewol::widget::Sizer::~Sizer() { ewol::widget::Sizer::~Sizer() {
//EWOL_DEBUG("[" << getId() << "]={" << getObjectType() << "} sizer : destroy (mode=" << (propertyMode == ewol::widget::Sizer::modeVert?"Vert":"Hori") << ")"); //Log.debug("[" << getId() << "]={" << getObjectType() << "} sizer : destroy (mode=" << (propertyMode == ewol::widget::Sizer::modeVert?"Vert":"Hori") << ")");
} }
void ewol::widget::Sizer::onChangeSize() { void ewol::widget::Sizer::onChangeSize() {
ewol::Widget::onChangeSize(); ewol::Widget::onChangeSize();
vec2 tmpBorderSize = propertyBorderSize->getPixel(); Vector2f tmpBorderSize = propertyBorderSize->getPixel();
EWOL_VERBOSE("[" << getId() << "] update size : " << m_size << " nbElement : " << m_subWidget.size() << " borderSize=" << tmpBorderSize << " from border=" << propertyBorderSize); Log.verbose("[" << getId() << "] update size : " << m_size << " nbElement : " << m_subWidget.size() << " borderSize=" << tmpBorderSize << " from border=" << propertyBorderSize);
vec2 localWidgetSize = m_size - tmpBorderSize*2.0f; Vector2f localWidgetSize = m_size - tmpBorderSize*2.0f;
// -1- calculate min-size and expand requested: // -1- calculate min-size and expand requested:
vec2 minSize(0.0f, 0.0f); Vector2f minSize(0.0f, 0.0f);
ivec2 nbWidgetExpand(0,0); Vector2i nbWidgetExpand(0,0);
for (auto &it : m_subWidget) { for (auto &it : m_subWidget) {
if (it == null) { if (it == null) {
continue; continue;
} }
vec2 tmpSize = it->getCalculateMinSize(); Vector2f tmpSize = it->getCalculateMinSize();
if (*propertyMode == ewol::widget::Sizer::modeVert) { if (*propertyMode == ewol::widget::Sizer::modeVert) {
minSize = vec2(etk::max(minSize.x(), tmpSize.x()), minSize = Vector2f(etk::max(minSize.x(), tmpSize.x()),
minSize.y() + tmpSize.y()); minSize.y() + tmpSize.y());
} else { } else {
minSize = vec2(minSize.x() + tmpSize.x(), minSize = Vector2f(minSize.x() + tmpSize.x(),
etk::max(minSize.y(), tmpSize.y())); etk::max(minSize.y(), tmpSize.y()));
} }
bvec2 expand = it->canExpand(); Vector2b expand = it->canExpand();
nbWidgetExpand += ivec2(expand.x()==true?1:0, nbWidgetExpand += Vector2i(expand.x()==true?1:0,
expand.y()==true?1:0); expand.y()==true?1:0);
} }
// -2- Calculate the size to add at every elements... // -2- Calculate the size to add at every elements...
float deltaExpandSize = 0.0f; float deltaExpandSize = 0.0f;
if (nbWidgetExpand != ivec2(0,0)) { if (nbWidgetExpand != Vector2i(0,0)) {
if (*propertyMode == ewol::widget::Sizer::modeVert) { if (*propertyMode == ewol::widget::Sizer::modeVert) {
deltaExpandSize = (localWidgetSize.y() - minSize.y()) / float(nbWidgetExpand.y()); deltaExpandSize = (localWidgetSize.y() - minSize.y()) / float(nbWidgetExpand.y());
} else { } else {
@ -97,8 +97,8 @@ void ewol::widget::Sizer::onChangeSize() {
if (it == null) { if (it == null) {
continue; continue;
} }
vec2 tmpSizeMin = it->getSize(); Vector2f tmpSizeMin = it->getSize();
vec2 tmpSizeMax = it->getCalculateMaxSize(); Vector2f tmpSizeMax = it->getCalculateMaxSize();
// Now update his size his size in X and the curent sizer size in Y: // Now update his size his size in X and the curent sizer size in Y:
if (*propertyMode == ewol::widget::Sizer::modeVert) { if (*propertyMode == ewol::widget::Sizer::modeVert) {
if (it->canExpand().y() == true) { if (it->canExpand().y() == true) {
@ -152,14 +152,14 @@ void ewol::widget::Sizer::onChangeSize() {
if (it->canExpand().x() == false) { if (it->canExpand().x() == false) {
continue; continue;
} }
vec2 tmpSizeMin = it->getSize(); Vector2f tmpSizeMin = it->getSize();
tmpSizeMin.setX(etk::avg(tmpSizeMin.x(), localWidgetSize.x(), it->getCalculateMaxSize().x())); tmpSizeMin.setX(etk::avg(tmpSizeMin.x(), localWidgetSize.x(), it->getCalculateMaxSize().x()));
it->setSize(tmpSizeMin); it->setSize(tmpSizeMin);
} else { } else {
if (it->canExpand().y() == false) { if (it->canExpand().y() == false) {
continue; continue;
} }
vec2 tmpSizeMin = it->getSize(); Vector2f tmpSizeMin = it->getSize();
tmpSizeMin.setY(etk::avg(tmpSizeMin.y(), localWidgetSize.y(), it->getCalculateMaxSize().y())); tmpSizeMin.setY(etk::avg(tmpSizeMin.y(), localWidgetSize.y(), it->getCalculateMaxSize().y()));
it->setSize(tmpSizeMin); it->setSize(tmpSizeMin);
} }
@ -169,38 +169,38 @@ void ewol::widget::Sizer::onChangeSize() {
if (it == null) { if (it == null) {
continue; continue;
} }
it->setSize(vec2ClipInt32(it->getSize())); it->setSize(Vector2fClipInt32(it->getSize()));
} }
// -7- get under Size // -7- get under Size
vec2 underSize(0,0); Vector2f underSize(0,0);
for (auto &it : m_subWidget) { for (auto &it : m_subWidget) {
if (it == null) { if (it == null) {
continue; continue;
} }
vec2 size = it->getSize(); Vector2f size = it->getSize();
if (*propertyMode == ewol::widget::Sizer::modeVert) { if (*propertyMode == ewol::widget::Sizer::modeVert) {
underSize += vec2(0.0f, size.y()); underSize += Vector2f(0.0f, size.y());
underSize.setX(etk::max(underSize.x(), size.x())); underSize.setX(etk::max(underSize.x(), size.x()));
} else { } else {
underSize += vec2(size.x(), 0.0f); underSize += Vector2f(size.x(), 0.0f);
underSize.setY(etk::max(underSize.y(), size.y())); underSize.setY(etk::max(underSize.y(), size.y()));
} }
} }
vec2 deltas = localWidgetSize - underSize; Vector2f deltas = localWidgetSize - underSize;
// -8- Calculate the local origin, depending of the gravity: // -8- Calculate the local origin, depending of the gravity:
vec2 tmpOrigin = m_origin + tmpBorderSize + ewol::gravityGenerateDelta(propertyGravity, deltas); Vector2f tmpOrigin = m_origin + tmpBorderSize + ewol::gravityGenerateDelta(propertyGravity, deltas);
// -9- Set sub widget origin: // -9- Set sub widget origin:
for (auto &it : m_subWidget) { for (auto &it : m_subWidget) {
if (it == null) { if (it == null) {
continue; continue;
} }
vec2 origin; Vector2f origin;
vec2 size = it->getSize(); Vector2f size = it->getSize();
if (*propertyMode == ewol::widget::Sizer::modeVert) { if (*propertyMode == ewol::widget::Sizer::modeVert) {
origin = vec2ClipInt32(tmpOrigin+m_offset + ewol::gravityGenerateDelta(propertyGravity, vec2(underSize.x()-size.x(),0.0f))); origin = Vector2fClipInt32(tmpOrigin+m_offset + ewol::gravityGenerateDelta(propertyGravity, Vector2f(underSize.x()-size.x(),0.0f)));
} else { } else {
origin = vec2ClipInt32(tmpOrigin+m_offset + ewol::gravityGenerateDelta(propertyGravity, vec2(0.0f, underSize.y()-size.y()))); origin = Vector2fClipInt32(tmpOrigin+m_offset + ewol::gravityGenerateDelta(propertyGravity, Vector2f(0.0f, underSize.y()-size.y())));
} }
it->setOrigin(origin); it->setOrigin(origin);
if (*propertyMode == ewol::widget::Sizer::modeVert) { if (*propertyMode == ewol::widget::Sizer::modeVert) {
@ -220,11 +220,11 @@ void ewol::widget::Sizer::onChangeSize() {
} }
void ewol::widget::Sizer::calculateMinMaxSize() { void ewol::widget::Sizer::calculateMinMaxSize() {
EWOL_VERBOSE("[" << getId() << "] update minimum size"); Log.verbose("[" << getId() << "] update minimum size");
m_subExpend.setValue(false, false); m_subExpend.setValue(false, false);
m_minSize = propertyMinSize->getPixel(); m_minSize = propertyMinSize->getPixel();
vec2 tmpBorderSize = propertyBorderSize->getPixel(); Vector2f tmpBorderSize = propertyBorderSize->getPixel();
EWOL_VERBOSE("[" << getId() << "] {" << getObjectType() << "} set min size : " << m_minSize); Log.verbose("[" << getId() << "] {" << getObjectType() << "} set min size : " << m_minSize);
for (auto &it : m_subWidget) { for (auto &it : m_subWidget) {
if (it == null) { if (it == null) {
continue; continue;
@ -236,9 +236,9 @@ void ewol::widget::Sizer::calculateMinMaxSize() {
if (it->canExpand().y() == true) { if (it->canExpand().y() == true) {
m_subExpend.setY(true); m_subExpend.setY(true);
} }
vec2 tmpSize = it->getCalculateMinSize(); Vector2f tmpSize = it->getCalculateMinSize();
EWOL_VERBOSE("[" << getId() << "] NewMinSize=" << tmpSize); Log.verbose("[" << getId() << "] NewMinSize=" << tmpSize);
EWOL_VERBOSE("[" << getId() << "] {" << getObjectType() << "} Get minSize="<< tmpSize); Log.verbose("[" << getId() << "] {" << getObjectType() << "} Get minSize="<< tmpSize);
if (*propertyMode == ewol::widget::Sizer::modeVert) { if (*propertyMode == ewol::widget::Sizer::modeVert) {
m_minSize.setY(m_minSize.y() + tmpSize.y()); m_minSize.setY(m_minSize.y() + tmpSize.y());
if (tmpSize.x()>m_minSize.x()) { if (tmpSize.x()>m_minSize.x()) {
@ -252,7 +252,7 @@ void ewol::widget::Sizer::calculateMinMaxSize() {
} }
} }
m_minSize += tmpBorderSize*2; m_minSize += tmpBorderSize*2;
//EWOL_ERROR("[" << getId() << "] {" << getObjectType() << "} Result min size : " << m_minSize); //Log.error("[" << getId() << "] {" << getObjectType() << "} Result min size : " << m_minSize);
} }
int32_t ewol::widget::Sizer::subWidgetAdd(ewol::WidgetShared _newWidget) { int32_t ewol::widget::Sizer::subWidgetAdd(ewol::WidgetShared _newWidget) {

View File

@ -47,7 +47,7 @@ ewol::widget::Slider::~Slider() {
} }
void ewol::widget::Slider::calculateMinMaxSize() { void ewol::widget::Slider::calculateMinMaxSize() {
vec2 minTmp = propertyMinSize->getPixel(); Vector2f minTmp = propertyMinSize->getPixel();
m_minSize.setValue(etk::max(minTmp.x(), 40.0f), m_minSize.setValue(etk::max(minTmp.x(), 40.0f),
etk::max(minTmp.y(), dotRadius*2.0f) ); etk::max(minTmp.y(), dotRadius*2.0f) );
markToRedraw(); markToRedraw();
@ -66,13 +66,13 @@ void ewol::widget::Slider::onRegenerateDisplay() {
m_draw.setColor(m_textColorFg); m_draw.setColor(m_textColorFg);
// draw a line : // draw a line :
m_draw.setThickness(1); m_draw.setThickness(1);
m_draw.setPos(vec3(dotRadius, m_size.y()/2, 0) ); m_draw.setPos(Vector3f(dotRadius, m_size.y()/2, 0) );
m_draw.lineTo(vec3(m_size.x()-dotRadius, m_size.y()/2, 0) ); m_draw.lineTo(Vector3f(m_size.x()-dotRadius, m_size.y()/2, 0) );
m_draw.setThickness(0); m_draw.setThickness(0);
etk::Color<> borderDot = m_textColorFg; etk::Color<> borderDot = m_textColorFg;
borderDot.setA(borderDot.a()/2); borderDot.setA(borderDot.a()/2);
m_draw.setPos(vec3(4+((propertyValue-propertyMinimum)/(propertyMaximum-propertyMinimum))*(m_size.x()-2*dotRadius), m_size.y()/2, 0) ); m_draw.setPos(Vector3f(4+((propertyValue-propertyMinimum)/(propertyMaximum-propertyMinimum))*(m_size.x()-2*dotRadius), m_size.y()/2, 0) );
m_draw.setColorBg(borderDot); m_draw.setColorBg(borderDot);
m_draw.circle(dotRadius); m_draw.circle(dotRadius);
m_draw.setColorBg(m_textColorFg); m_draw.setColorBg(m_textColorFg);
@ -80,17 +80,17 @@ void ewol::widget::Slider::onRegenerateDisplay() {
} }
bool ewol::widget::Slider::onEventInput(const ewol::event::Input& _event) { bool ewol::widget::Slider::onEventInput(const ewol::event::Input& _event) {
vec2 relativePos = relativePosition(_event.getPos()); Vector2f relativePos = relativePosition(_event.getPos());
//EWOL_DEBUG("Event on Slider ..." << _event); //Log.debug("Event on Slider ..." << _event);
if (1 == _event.getId()) { if (1 == _event.getId()) {
if( gale::key::status::pressSingle == _event.getStatus() if( gale::key::status::pressSingle == _event.getStatus()
|| gale::key::status::move == _event.getStatus()) { || gale::key::status::move == _event.getStatus()) {
// get the new position : // get the new position :
EWOL_VERBOSE("Event on Slider (" << relativePos.x() << "," << relativePos.y() << ")"); Log.verbose("Event on Slider (" << relativePos.x() << "," << relativePos.y() << ")");
float oldValue = *propertyValue; float oldValue = *propertyValue;
updateValue(*propertyMinimum + (float)(relativePos.x() - dotRadius) / (m_size.x()-2*dotRadius) * (*propertyMaximum-*propertyMinimum)); updateValue(*propertyMinimum + (float)(relativePos.x() - dotRadius) / (m_size.x()-2*dotRadius) * (*propertyMaximum-*propertyMinimum));
if (oldValue != *propertyValue) { if (oldValue != *propertyValue) {
EWOL_VERBOSE(" new value : " << *propertyValue << " in [" << *propertyMinimum << ".." << *propertyMaximum << "]"); Log.verbose(" new value : " << *propertyValue << " in [" << *propertyMinimum << ".." << *propertyMaximum << "]");
signalChange.emit(*propertyValue); signalChange.emit(*propertyValue);
} }
return true; return true;

View File

@ -17,7 +17,7 @@ ewol::widget::Spacer::Spacer() :
"background of the spacer", "background of the spacer",
&ewol::widget::Spacer::onChangePropertyColor) { &ewol::widget::Spacer::onChangePropertyColor) {
addObjectType("ewol::widget::Spacer"); addObjectType("ewol::widget::Spacer");
propertyMinSize.setDirectCheck(gale::Dimension(vec2(10,10))); propertyMinSize.setDirectCheck(gale::Dimension(Vector2f(10,10)));
propertyCanFocus.setDirectCheck(true); propertyCanFocus.setDirectCheck(true);
} }
@ -40,8 +40,8 @@ void ewol::widget::Spacer::onRegenerateDisplay() {
return; return;
} }
m_draw.setColor(propertyColor); m_draw.setColor(propertyColor);
m_draw.setPos(vec3(0, 0, 0) ); m_draw.setPos(Vector3f(0, 0, 0) );
m_draw.rectangleWidth(vec3(m_size.x(), m_size.y(),0) ); m_draw.rectangleWidth(Vector3f(m_size.x(), m_size.y(),0) );
} }
void ewol::widget::Spacer::onChangePropertyColor() { void ewol::widget::Spacer::onChangePropertyColor() {

View File

@ -37,7 +37,7 @@ namespace ewol {
private: private:
ewol::compositing::Drawing m_draw; //!< Compositing drawing element ewol::compositing::Drawing m_draw; //!< Compositing drawing element
public: public:
ewol::WidgetShared getWidgetAtPos(const vec2& _pos) override { ewol::WidgetShared getWidgetAtPos(const Vector2f& _pos) override {
return null; return null;
}; };
void onRegenerateDisplay() override; void onRegenerateDisplay() override;

View File

@ -48,7 +48,7 @@ ewol::widget::Spin::~Spin() {
void ewol::widget::Spin::onChangePropertyValue() { void ewol::widget::Spin::onChangePropertyValue() {
markToRedraw(); markToRedraw();
if (m_widgetEntry == null) { if (m_widgetEntry == null) {
EWOL_ERROR("Can not acces at entry ..."); Log.error("Can not acces at entry ...");
return; return;
} }
checkValue(*propertyValue); checkValue(*propertyValue);

Some files were not shown because too many files have changed in this diff Show More