[PORT] step 1
This commit is contained in:
parent
8cbbe2f94e
commit
6cb8885b43
@ -15,7 +15,7 @@ etk::Stream& ewol::operator <<(etk::Stream& _os, const ewol::DrawProperty& _obj)
|
||||
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_origin.setMax(_origin);
|
||||
m_size.setMin(_origin+_size);
|
||||
|
@ -38,10 +38,10 @@ namespace ewol {
|
||||
(0,0)
|
||||
*/
|
||||
public :
|
||||
ivec2 m_windowsSize; //!< Windows compleate size
|
||||
ivec2 m_origin; //!< Windows clipping upper widget (can not be <0)
|
||||
ivec2 m_size; //!< Windows clipping upper widget (can not be <0 and >m_windowsSize)
|
||||
void limit(const vec2& _origin, const vec2& _size);
|
||||
Vector2i m_windowsSize; //!< Windows compleate size
|
||||
Vector2i m_origin; //!< Windows clipping upper widget (can not be <0)
|
||||
Vector2i m_size; //!< Windows clipping upper widget (can not be <0 and >m_windowsSize)
|
||||
void limit(const Vector2f& _origin, const Vector2f& _size);
|
||||
};
|
||||
etk::Stream& operator <<(etk::Stream& _os, const ewol::DrawProperty& _obj);
|
||||
|
||||
|
@ -15,7 +15,7 @@ const int32_t ewol::compositing::Area::m_vboIdCoordText(1);
|
||||
const int32_t ewol::compositing::Area::m_vboIdColor(2);
|
||||
#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_color(etk::color::white),
|
||||
m_GLprogram(null),
|
||||
@ -31,7 +31,7 @@ ewol::compositing::Area::Area(const ivec2& _size) :
|
||||
// Create the VBO:
|
||||
m_VBO = gale::resource::VirtualBufferObject::create(NB_VBO);
|
||||
if (m_VBO == null) {
|
||||
EWOL_ERROR("can not instanciate VBO ...");
|
||||
Log.error("can not instanciate VBO ...");
|
||||
return;
|
||||
}
|
||||
// TO facilitate some debugs we add a name of the VBO:
|
||||
@ -66,7 +66,7 @@ void ewol::compositing::Area::draw(bool _disableDepthTest) {
|
||||
return;
|
||||
}
|
||||
if (m_GLprogram == null) {
|
||||
EWOL_ERROR("No shader ...");
|
||||
Log.error("No shader ...");
|
||||
return;
|
||||
}
|
||||
// set Matrix : translation/positionMatrix
|
||||
@ -92,12 +92,12 @@ void ewol::compositing::Area::clear() {
|
||||
// reset all VBOs:
|
||||
m_VBO->clear();
|
||||
// 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) {
|
||||
vec3 point(0,0,0);
|
||||
vec2 tex(0,1);
|
||||
void ewol::compositing::Area::print(const Vector2i& _size) {
|
||||
Vector3f point(0,0,0);
|
||||
Vector2f tex(0,1);
|
||||
point.setX(m_position.x());
|
||||
point.setY(m_position.y());
|
||||
m_VBO->pushOnBuffer(m_vboIdCoord, point);
|
||||
|
@ -17,7 +17,7 @@ namespace ewol {
|
||||
namespace compositing {
|
||||
class Area : public ewol::Compositing {
|
||||
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
|
||||
private:
|
||||
ememory::SharedPtr<gale::resource::Program> m_GLprogram; //!< pointer on the opengl display program
|
||||
@ -43,7 +43,7 @@ namespace ewol {
|
||||
* @brief generic constructor
|
||||
* @param[in] _size Basic size of the area.
|
||||
*/
|
||||
Area(const ivec2& _size);
|
||||
Area(const Vector2i& _size);
|
||||
/**
|
||||
* @brief generic destructor
|
||||
*/
|
||||
@ -61,34 +61,34 @@ namespace ewol {
|
||||
* @brief get the current display position (sometime needed in the gui control)
|
||||
* @return the current position.
|
||||
*/
|
||||
const vec3& getPos() {
|
||||
const Vector3f& getPos() {
|
||||
return m_position;
|
||||
};
|
||||
/**
|
||||
* @brief set position for the next text writen
|
||||
* @param[in] _pos Position of the text (in 3D)
|
||||
*/
|
||||
void setPos(const vec3& _pos) {
|
||||
void setPos(const Vector3f& _pos) {
|
||||
m_position = _pos;
|
||||
};
|
||||
inline void setPos(const vec2& _pos) {
|
||||
setPos(vec3(_pos.x(),_pos.y(),0));
|
||||
inline void setPos(const Vector2f& _pos) {
|
||||
setPos(Vector3f(_pos.x(),_pos.y(),0));
|
||||
};
|
||||
/**
|
||||
* @brief set relative position for the next text writen
|
||||
* @param[in] _pos ofset apply of the text (in 3D)
|
||||
*/
|
||||
void setRelPos(const vec3& _pos) {
|
||||
void setRelPos(const Vector3f& _pos) {
|
||||
m_position += _pos;
|
||||
};
|
||||
inline void setRelPos(const vec2& _pos) {
|
||||
setRelPos(vec3(_pos.x(),_pos.y(),0));
|
||||
inline void setRelPos(const Vector2f& _pos) {
|
||||
setRelPos(Vector3f(_pos.x(),_pos.y(),0));
|
||||
};
|
||||
/**
|
||||
* @brief add a compleate of the image to display with the requested size
|
||||
* @param[in] _size size of the output image
|
||||
*/
|
||||
void print(const ivec2& _size);
|
||||
void print(const Vector2i& _size);
|
||||
|
||||
egami::Image& get() {
|
||||
return m_resource->get();
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
||||
void ewol::Compositing::rotate(const vec3& _vect, float _angle) {
|
||||
void ewol::Compositing::rotate(const Vector3f& _vect, float _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);
|
||||
}
|
||||
|
||||
|
@ -38,17 +38,17 @@ namespace ewol {
|
||||
* @brief translate the current display of this element
|
||||
* @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
|
||||
* @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
|
||||
* @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
|
||||
* @param[in] _mat The new matrix.
|
||||
|
@ -17,7 +17,7 @@ const int32_t ewol::compositing::Drawing::m_vboIdColor(1);
|
||||
|
||||
#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) {
|
||||
return;
|
||||
@ -28,10 +28,10 @@ static void generatePolyGone(etk::Vector<vec2 > & input, etk::Vector<vec2 > & ou
|
||||
output.pushBack(input[iii]);
|
||||
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
|
||||
if (input.size() <0) {
|
||||
@ -39,17 +39,17 @@ static void SutherlandHodgman(etk::Vector<vec2 > & input, etk::Vector<vec2 > & o
|
||||
}
|
||||
//int32_t sizeInit=input.size();
|
||||
// last element :
|
||||
vec2 destPoint;
|
||||
vec2 lastElement = input[input.size()-1];
|
||||
Vector2f destPoint;
|
||||
Vector2f lastElement = input[input.size()-1];
|
||||
bool inside = true;
|
||||
if (lastElement.x < sx) {
|
||||
inside = false;
|
||||
}
|
||||
//EWOL_DEBUG("generate an crop : ");
|
||||
//Log.debug("generate an crop : ");
|
||||
for(int32_t iii=0; iii<input.size(); iii++) {
|
||||
if(input[iii].x < sx) {
|
||||
if(true == inside) {
|
||||
//EWOL_DEBUG("element IN == > OUT ");
|
||||
//Log.debug("element IN == > OUT ");
|
||||
//new point intersection ...
|
||||
//y=aaax+bbb
|
||||
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;
|
||||
output.pushBack(destPoint);
|
||||
} else {
|
||||
//EWOL_DEBUG("element OUT == > OUT ");
|
||||
//Log.debug("element OUT == > OUT ");
|
||||
}
|
||||
inside = false;
|
||||
} else {
|
||||
if(true == inside) {
|
||||
//EWOL_DEBUG("element IN == > IN ");
|
||||
//Log.debug("element IN == > IN ");
|
||||
output.pushBack(input[iii]);
|
||||
} else {
|
||||
//EWOL_DEBUG("element OUT == > IN ");
|
||||
//Log.debug("element OUT == > IN ");
|
||||
//new point intersection ...
|
||||
//y=aaax+bbb
|
||||
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;
|
||||
}
|
||||
|
||||
//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;
|
||||
output.clear();
|
||||
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++) {
|
||||
if(input[iii].y < sy) {
|
||||
if(true == inside) {
|
||||
//EWOL_DEBUG("element IN == > OUT ");
|
||||
//Log.debug("element IN == > OUT ");
|
||||
//new point intersection ...
|
||||
//x=aaay+bbb
|
||||
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;
|
||||
output.pushBack(destPoint);
|
||||
} else {
|
||||
//EWOL_DEBUG("element OUT == > OUT ");
|
||||
//Log.debug("element OUT == > OUT ");
|
||||
}
|
||||
inside = false;
|
||||
} else {
|
||||
if(true == inside) {
|
||||
//EWOL_DEBUG("element IN == > IN ");
|
||||
//Log.debug("element IN == > IN ");
|
||||
output.pushBack(input[iii]);
|
||||
} else {
|
||||
//EWOL_DEBUG("element OUT == > IN ");
|
||||
//Log.debug("element OUT == > IN ");
|
||||
//new point intersection ...
|
||||
//y=aaax+bbb
|
||||
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) {
|
||||
inside = false;
|
||||
}
|
||||
//EWOL_DEBUG("generate an crop : ");
|
||||
//Log.debug("generate an crop : ");
|
||||
for(int32_t iii=0; iii<input.size(); iii++) {
|
||||
if(input[iii].x > ex) {
|
||||
if(true == inside) {
|
||||
//EWOL_DEBUG("element IN == > OUT ");
|
||||
//Log.debug("element IN == > OUT ");
|
||||
//new point intersection ...
|
||||
//y=aaax+bbb
|
||||
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;
|
||||
output.pushBack(destPoint);
|
||||
} else {
|
||||
//EWOL_DEBUG("element OUT == > OUT ");
|
||||
//Log.debug("element OUT == > OUT ");
|
||||
}
|
||||
inside = false;
|
||||
} else {
|
||||
if(true == inside) {
|
||||
//EWOL_DEBUG("element IN == > IN ");
|
||||
//Log.debug("element IN == > IN ");
|
||||
output.pushBack(input[iii]);
|
||||
} else {
|
||||
//EWOL_DEBUG("element OUT == > IN ");
|
||||
//Log.debug("element OUT == > IN ");
|
||||
//new point intersection ...
|
||||
//y=aaax+bbb
|
||||
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++) {
|
||||
if(input[iii].y > ey) {
|
||||
if(true == inside) {
|
||||
//EWOL_DEBUG("element IN == > OUT ");
|
||||
//Log.debug("element IN == > OUT ");
|
||||
//new point intersection ...
|
||||
//x=aaay+bbb
|
||||
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;
|
||||
output.pushBack(destPoint);
|
||||
} else {
|
||||
//EWOL_DEBUG("element OUT == > OUT ");
|
||||
//Log.debug("element OUT == > OUT ");
|
||||
}
|
||||
inside = false;
|
||||
} else {
|
||||
if(true == inside) {
|
||||
//EWOL_DEBUG("element IN == > IN ");
|
||||
//Log.debug("element IN == > IN ");
|
||||
output.pushBack(input[iii]);
|
||||
} else {
|
||||
//EWOL_DEBUG("element OUT == > IN ");
|
||||
//Log.debug("element OUT == > IN ");
|
||||
//new point intersection ...
|
||||
//y=aaax+bbb
|
||||
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
|
||||
|
||||
@ -244,7 +244,7 @@ ewol::compositing::Drawing::Drawing() :
|
||||
// Create the VBO:
|
||||
m_VBO = gale::resource::VirtualBufferObject::create(NB_VBO);
|
||||
if (m_VBO == null) {
|
||||
EWOL_ERROR("can not instanciate VBO ...");
|
||||
Log.error("can not instanciate VBO ...");
|
||||
return;
|
||||
}
|
||||
// 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_triElement++;
|
||||
if (m_triElement >= 3) {
|
||||
@ -316,7 +316,7 @@ void ewol::compositing::Drawing::draw(bool _disableDepthTest) {
|
||||
return;
|
||||
}
|
||||
if (m_GLprogram == null) {
|
||||
EWOL_ERROR("No shader ...");
|
||||
Log.error("No shader ...");
|
||||
return;
|
||||
}
|
||||
// set Matrix : translation/positionMatrix
|
||||
@ -340,10 +340,10 @@ void ewol::compositing::Drawing::clear() {
|
||||
// reset Buffer :
|
||||
m_VBO->clear();
|
||||
// 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_clippingPosStop = vec3(0.0, 0.0, 0.0);
|
||||
m_clippingPosStart = Vector3f(0.0, 0.0, 0.0);
|
||||
m_clippingPosStop = Vector3f(0.0, 0.0, 0.0);
|
||||
m_clippingEnable = false;
|
||||
|
||||
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
|
||||
if (_pos.x() <= _posEnd.x()) {
|
||||
m_clippingPosStart.setX(_pos.x());
|
||||
@ -394,10 +394,10 @@ void ewol::compositing::Drawing::addVertex() {
|
||||
setPoint(m_position);
|
||||
}
|
||||
|
||||
void ewol::compositing::Drawing::lineTo(const vec3& _dest) {
|
||||
void ewol::compositing::Drawing::lineTo(const Vector3f& _dest) {
|
||||
resetCount();
|
||||
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()) {
|
||||
//EWOL_WARNING("Try to draw a line width 0");
|
||||
return;
|
||||
@ -414,21 +414,21 @@ void ewol::compositing::Drawing::lineTo(const vec3& _dest) {
|
||||
} else if (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 offsetx = cos(teta-M_PI/2) * (m_thickness/2);
|
||||
setPoint(vec3(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(vec3(_dest.x() + offsetx, _dest.y() + offsety, m_position.z()) );
|
||||
setPoint(Vector3f(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(Vector3f(_dest.x() + offsetx, _dest.y() + offsety, m_position.z()) );
|
||||
|
||||
setPoint(vec3(_dest.x() + offsetx, _dest.y() + offsety, _dest.z()) );
|
||||
setPoint(vec3(_dest.x() - offsetx, _dest.y() - offsety, _dest.z()) );
|
||||
setPoint(vec3(m_position.x() - offsetx, m_position.y() - offsety, _dest.z()) );
|
||||
setPoint(Vector3f(_dest.x() + offsetx, _dest.y() + offsety, _dest.z()) );
|
||||
setPoint(Vector3f(_dest.x() - offsetx, _dest.y() - offsety, _dest.z()) );
|
||||
setPoint(Vector3f(m_position.x() - offsetx, m_position.y() - offsety, _dest.z()) );
|
||||
// update the system position :
|
||||
m_position = _dest;
|
||||
}
|
||||
|
||||
void ewol::compositing::Drawing::rectangle(const vec3& _dest) {
|
||||
void ewol::compositing::Drawing::rectangle(const Vector3f& _dest) {
|
||||
resetCount();
|
||||
internalSetColor(m_color);
|
||||
/* Bitmap position
|
||||
@ -472,16 +472,16 @@ void ewol::compositing::Drawing::rectangle(const vec3& _dest) {
|
||||
|| dxA >= dxB) {
|
||||
return;
|
||||
}
|
||||
setPoint(vec3(dxA, dyD, 0) );
|
||||
setPoint(vec3(dxA, dyC, 0) );
|
||||
setPoint(vec3(dxB, dyC, 0) );
|
||||
setPoint(Vector3f(dxA, dyD, 0) );
|
||||
setPoint(Vector3f(dxA, dyC, 0) );
|
||||
setPoint(Vector3f(dxB, dyC, 0) );
|
||||
|
||||
setPoint(vec3(dxB, dyC, 0) );
|
||||
setPoint(vec3(dxB, dyD, 0) );
|
||||
setPoint(vec3(dxA, dyD, 0) );
|
||||
setPoint(Vector3f(dxB, dyC, 0) );
|
||||
setPoint(Vector3f(dxB, 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) {
|
||||
internalSetColor(m_colorBg);
|
||||
for (int32_t iii=0; iii<nbOcurence; iii++) {
|
||||
setPoint(vec3(m_position.x(),
|
||||
setPoint(Vector3f(m_position.x(),
|
||||
m_position.y(),
|
||||
0) );
|
||||
|
||||
@ -512,7 +512,7 @@ void ewol::compositing::Drawing::circle(float _radius, float _angleStart, float
|
||||
float offsety = sin(angleOne) * _radius;
|
||||
float offsetx = cos(angleOne) * _radius;
|
||||
|
||||
setPoint(vec3(m_position.x() + offsetx,
|
||||
setPoint(Vector3f(m_position.x() + offsetx,
|
||||
m_position.y() + offsety,
|
||||
0) );
|
||||
|
||||
@ -520,7 +520,7 @@ void ewol::compositing::Drawing::circle(float _radius, float _angleStart, float
|
||||
offsety = sin(angleTwo) * _radius;
|
||||
offsetx = cos(angleTwo) * _radius;
|
||||
|
||||
setPoint(vec3(m_position.x() + offsetx,
|
||||
setPoint(Vector3f(m_position.x() + offsetx,
|
||||
m_position.y() + offsety,
|
||||
0) );
|
||||
}
|
||||
@ -546,13 +546,13 @@ void ewol::compositing::Drawing::circle(float _radius, float _angleStart, float
|
||||
float offsetInt2y = sin(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(vec3(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() + offsetIntx, m_position.y() + offsetInty, 0));
|
||||
setPoint(Vector3f(m_position.x() + offsetExtx, m_position.y() + offsetExty, 0));
|
||||
setPoint(Vector3f(m_position.x() + offsetExt2x, m_position.y() + offsetExt2y, 0));
|
||||
|
||||
setPoint(vec3(m_position.x() + offsetExt2x, m_position.y() + offsetExt2y, 0));
|
||||
setPoint(vec3(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() + offsetExt2x, m_position.y() + offsetExt2y, 0));
|
||||
setPoint(Vector3f(m_position.x() + offsetInt2x, m_position.y() + offsetInt2y, 0));
|
||||
setPoint(Vector3f(m_position.x() + offsetIntx, m_position.y() + offsetInty, 0));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -16,9 +16,9 @@ namespace ewol {
|
||||
namespace compositing {
|
||||
class Drawing : public ewol::Compositing {
|
||||
private:
|
||||
vec3 m_position; //!< The current position to draw
|
||||
vec3 m_clippingPosStart; //!< Clipping start position
|
||||
vec3 m_clippingPosStop; //!< Clipping stop position
|
||||
Vector3f m_position; //!< The current position to draw
|
||||
Vector3f m_clippingPosStart; //!< Clipping start position
|
||||
Vector3f m_clippingPosStop; //!< Clipping stop position
|
||||
bool m_clippingEnable; //!< true if the clipping must be activated
|
||||
private:
|
||||
etk::Color<> m_color; //!< The text foreground color
|
||||
@ -53,7 +53,7 @@ namespace ewol {
|
||||
void unLoadProgram();
|
||||
float m_thickness; //!< when drawing line and other things
|
||||
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
|
||||
// internal API for the generation abstraction of triangles
|
||||
/**
|
||||
@ -73,7 +73,7 @@ namespace ewol {
|
||||
* @brief internal add of the specific point
|
||||
* @param[in] _point The requeste dpoint to add
|
||||
*/
|
||||
void setPoint(const vec3& point);
|
||||
void setPoint(const Vector3f& point);
|
||||
|
||||
public:
|
||||
/**
|
||||
@ -88,28 +88,28 @@ namespace ewol {
|
||||
* @brief get the current display position (sometime needed in the gui control)
|
||||
* @return the current position.
|
||||
*/
|
||||
const vec3& getPos() {
|
||||
const Vector3f& getPos() {
|
||||
return m_position;
|
||||
};
|
||||
/**
|
||||
* @brief set position for the next text writen
|
||||
* @param[in] _pos Position of the text (in 3D)
|
||||
*/
|
||||
void setPos(const vec3& _pos) {
|
||||
void setPos(const Vector3f& _pos) {
|
||||
m_position = _pos;
|
||||
};
|
||||
inline void setPos(const vec2& _pos) {
|
||||
setPos(vec3(_pos.x(), _pos.y(), 0));
|
||||
inline void setPos(const Vector2f& _pos) {
|
||||
setPos(Vector3f(_pos.x(), _pos.y(), 0));
|
||||
};
|
||||
/**
|
||||
* @brief set relative position for the next text writen
|
||||
* @param[in] _pos ofset apply of the text (in 3D)
|
||||
*/
|
||||
void setRelPos(const vec3& _pos) {
|
||||
void setRelPos(const Vector3f& _pos) {
|
||||
m_position += _pos;
|
||||
};
|
||||
inline void setRelPos(const vec2& _pos) {
|
||||
setRelPos(vec3(_pos.x(), _pos.y(), 0));
|
||||
inline void setRelPos(const Vector2f& _pos) {
|
||||
setRelPos(Vector3f(_pos.x(), _pos.y(), 0));
|
||||
};
|
||||
/**
|
||||
* @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] _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);
|
||||
};
|
||||
inline void setClippingWidth(const vec2& _pos, const vec2& _width) {
|
||||
setClippingWidth(vec3(_pos.x(),_pos.y(),-1), vec3(_width.x(),_width.y(), 2));
|
||||
inline void setClippingWidth(const Vector2f& _pos, const Vector2f& _width) {
|
||||
setClippingWidth(Vector3f(_pos.x(),_pos.y(),-1), Vector3f(_width.x(),_width.y(), 2));
|
||||
};
|
||||
/**
|
||||
* @brief Request a clipping area for the text (next draw only)
|
||||
* @param[in] _pos Start position of the clipping
|
||||
* @param[in] _posEnd End position of the clipping
|
||||
*/
|
||||
void setClipping(const vec3& _pos, const vec3& _posEnd);
|
||||
inline void setClipping(const vec2& _pos, const vec2& _posEnd) {
|
||||
setClipping(vec3(_pos.x(),_pos.y(),-1), vec3(_posEnd.x(),_posEnd.y(), 1));
|
||||
void setClipping(const Vector3f& _pos, const Vector3f& _posEnd);
|
||||
inline void setClipping(const Vector2f& _pos, const Vector2f& _posEnd) {
|
||||
setClipping(Vector3f(_pos.x(),_pos.y(),-1), Vector3f(_posEnd.x(),_posEnd.y(), 1));
|
||||
};
|
||||
/**
|
||||
* @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
|
||||
* @param[in] _dest Position of the end of the line.
|
||||
*/
|
||||
void lineTo(const vec3& _dest);
|
||||
inline void lineTo(const vec2& _dest) {
|
||||
lineTo(vec3(_dest.x(), _dest.y(), 0));
|
||||
void lineTo(const Vector3f& _dest);
|
||||
inline void lineTo(const Vector2f& _dest) {
|
||||
lineTo(Vector3f(_dest.x(), _dest.y(), 0));
|
||||
};
|
||||
/**
|
||||
* @brief Relative drawing a line (spacial vector)
|
||||
* @param[in] _vect Vector of the curent line.
|
||||
*/
|
||||
void lineRel(const vec3& _vect) {
|
||||
void lineRel(const Vector3f& _vect) {
|
||||
lineTo(m_position+_vect);
|
||||
};
|
||||
inline void lineRel(const vec2& _vect) {
|
||||
lineRel(vec3(_vect.x(), _vect.y(), 0));
|
||||
inline void lineRel(const Vector2f& _vect) {
|
||||
lineRel(Vector3f(_vect.x(), _vect.y(), 0));
|
||||
};
|
||||
/**
|
||||
* @brief draw a 2D rectangle to the position requested.
|
||||
* @param[in] _dest Position the the end of the rectangle
|
||||
*/
|
||||
void rectangle(const vec3& _dest);
|
||||
inline void rectangle(const vec2& _dest) {
|
||||
rectangle(vec3(_dest.x(), _dest.y(), 0));
|
||||
void rectangle(const Vector3f& _dest);
|
||||
inline void rectangle(const Vector2f& _dest) {
|
||||
rectangle(Vector3f(_dest.x(), _dest.y(), 0));
|
||||
};
|
||||
/**
|
||||
* @brief draw a 2D rectangle to the requested size.
|
||||
* @param[in] _size size of the rectangle
|
||||
*/
|
||||
void rectangleWidth(const vec3& _size) {
|
||||
void rectangleWidth(const Vector3f& _size) {
|
||||
rectangle(m_position+_size);
|
||||
};
|
||||
inline void rectangleWidth(const vec2& _size) {
|
||||
rectangleWidth(vec3(_size.x(), _size.y(), 0));
|
||||
inline void rectangleWidth(const Vector2f& _size) {
|
||||
rectangleWidth(Vector3f(_size.x(), _size.y(), 0));
|
||||
};
|
||||
/**
|
||||
* @brief draw a 3D rectangle to the position requested.
|
||||
* @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.
|
||||
* @param[in] _radius Distence to the dorder
|
||||
|
@ -40,7 +40,7 @@ ewol::compositing::Image::Image(const etk::Uri& _imageName,
|
||||
// Create the VBO:
|
||||
m_VBO = gale::resource::VirtualBufferObject::create(NB_VBO);
|
||||
if (m_VBO == null) {
|
||||
EWOL_ERROR("can not instanciate VBO ...");
|
||||
Log.error("can not instanciate VBO ...");
|
||||
return;
|
||||
}
|
||||
// TO facilitate some debugs we add a name of the VBO:
|
||||
@ -83,7 +83,7 @@ void ewol::compositing::Image::draw(bool _disableDepthTest) {
|
||||
return;
|
||||
}
|
||||
if (m_GLprogram == null) {
|
||||
EWOL_ERROR("No shader ...");
|
||||
Log.error("No shader ...");
|
||||
return;
|
||||
}
|
||||
//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());
|
||||
} else if (m_resource != null) {
|
||||
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());
|
||||
} else {
|
||||
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());
|
||||
}
|
||||
@ -127,15 +127,15 @@ void ewol::compositing::Image::clear() {
|
||||
// reset Buffer :
|
||||
m_VBO->clear();
|
||||
// reset temporal variables :
|
||||
m_position = vec3(0.0, 0.0, 0.0);
|
||||
m_clippingPosStart = vec3(0.0, 0.0, 0.0);
|
||||
m_clippingPosStop = vec3(0.0, 0.0, 0.0);
|
||||
m_position = Vector3f(0.0, 0.0, 0.0);
|
||||
m_clippingPosStart = Vector3f(0.0, 0.0, 0.0);
|
||||
m_clippingPosStop = Vector3f(0.0, 0.0, 0.0);
|
||||
m_clippingEnable = false;
|
||||
m_color = etk::color::white;
|
||||
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
|
||||
if (_pos.x() <= _posEnd.x()) {
|
||||
m_clippingPosStart.setX(_pos.x());
|
||||
@ -165,27 +165,27 @@ void ewol::compositing::Image::setAngle(float _angle) {
|
||||
m_angle = _angle;
|
||||
}
|
||||
|
||||
void ewol::compositing::Image::print(const vec2& _size) {
|
||||
printPart(_size, vec2(0,0), vec2(1.0,1.0));
|
||||
void ewol::compositing::Image::print(const Vector2f& _size) {
|
||||
printPart(_size, Vector2f(0,0), Vector2f(1.0,1.0));
|
||||
}
|
||||
|
||||
void ewol::compositing::Image::printPart(const vec2& _size,
|
||||
vec2 _sourcePosStart,
|
||||
vec2 _sourcePosStop) {
|
||||
void ewol::compositing::Image::printPart(const Vector2f& _size,
|
||||
Vector2f _sourcePosStart,
|
||||
Vector2f _sourcePosStop) {
|
||||
if (m_resource == null) {
|
||||
return;
|
||||
}
|
||||
vec2 openGLSize = vec2(m_resource->getOpenGlSize().x(), m_resource->getOpenGlSize().y());
|
||||
vec2 usefullSize = m_resource->getUsableSize();
|
||||
vec2 ratio = usefullSize/openGLSize;
|
||||
Vector2f openGLSize = Vector2f(m_resource->getOpenGlSize().x(), m_resource->getOpenGlSize().y());
|
||||
Vector2f usefullSize = m_resource->getUsableSize();
|
||||
Vector2f ratio = usefullSize/openGLSize;
|
||||
_sourcePosStart *= 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) {
|
||||
vec3 point = m_position;
|
||||
vec2 tex(_sourcePosStart.x(),_sourcePosStop.y());
|
||||
Vector3f point = m_position;
|
||||
Vector2f tex(_sourcePosStart.x(),_sourcePosStop.y());
|
||||
m_VBO->pushOnBuffer(m_vboIdCoord, point);
|
||||
m_VBO->pushOnBuffer(m_vboIdCoordTex, tex);
|
||||
m_VBO->pushOnBuffer(m_vboIdColor, m_color);
|
||||
@ -224,28 +224,28 @@ void ewol::compositing::Image::printPart(const vec2& _size,
|
||||
m_VBO->flush();
|
||||
return;
|
||||
}
|
||||
vec3 center = m_position + vec3(_size.x(),_size.y(),0)/2.0f;
|
||||
vec3 limitedSize(_size.x()*0.5f, _size.y()*0.5f, 0.0f);
|
||||
Vector3f center = m_position + Vector3f(_size.x(),_size.y(),0)/2.0f;
|
||||
Vector3f limitedSize(_size.x()*0.5f, _size.y()*0.5f, 0.0f);
|
||||
|
||||
vec3 point(0,0,0);
|
||||
vec2 tex(_sourcePosStart.x(),_sourcePosStop.y());
|
||||
Vector3f point(0,0,0);
|
||||
Vector2f tex(_sourcePosStart.x(),_sourcePosStop.y());
|
||||
|
||||
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_vboIdCoordTex, tex);
|
||||
m_VBO->pushOnBuffer(m_vboIdColor, m_color);
|
||||
|
||||
tex.setValue(_sourcePosStop.x(),_sourcePosStop.y());
|
||||
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_vboIdCoordTex, tex);
|
||||
m_VBO->pushOnBuffer(m_vboIdColor, m_color);
|
||||
|
||||
tex.setValue(_sourcePosStop.x(),_sourcePosStart.y());
|
||||
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_vboIdCoordTex, tex);
|
||||
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());
|
||||
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_vboIdCoordTex, tex);
|
||||
m_VBO->pushOnBuffer(m_vboIdColor, m_color);
|
||||
|
||||
tex.setValue(_sourcePosStart.x(),_sourcePosStop.y());
|
||||
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_vboIdCoordTex, tex);
|
||||
m_VBO->pushOnBuffer(m_vboIdColor, m_color);
|
||||
@ -271,7 +271,7 @@ void ewol::compositing::Image::printPart(const vec2& _size,
|
||||
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();
|
||||
if ( m_filename == _uri
|
||||
&& m_requestSize == _size) {
|
||||
@ -286,19 +286,19 @@ void ewol::compositing::Image::setSource(const etk::Uri& _uri, const vec2& _size
|
||||
m_resource.reset();
|
||||
m_resourceDF.reset();
|
||||
m_resourceImage.reset();
|
||||
ivec2 tmpSize(_size.x(),_size.y());
|
||||
Vector2i tmpSize(_size.x(),_size.y());
|
||||
// note that no image can be loaded...
|
||||
if (_uri.isEmpty() == false) {
|
||||
// link to new one
|
||||
if (m_distanceFieldMode == false) {
|
||||
m_resource = ewol::resource::TextureFile::create(m_filename, tmpSize);
|
||||
if (m_resource == null) {
|
||||
EWOL_ERROR("Can not get Image resource");
|
||||
Log.error("Can not get Image resource");
|
||||
}
|
||||
} else {
|
||||
m_resourceDF = ewol::resource::ImageDF::create(m_filename, tmpSize);
|
||||
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
|
||||
&& m_resourceDF == null
|
||||
&& m_resourceImage == null) {
|
||||
return vec2(0,0);
|
||||
return Vector2f(0,0);
|
||||
}
|
||||
if (m_resource != null) {
|
||||
return m_resource->getRealSize();
|
||||
@ -348,7 +348,7 @@ vec2 ewol::compositing::Image::getRealSize() {
|
||||
if (m_resourceImage != null) {
|
||||
return m_resourceImage->getUsableSize();
|
||||
}
|
||||
return vec2(0,0);
|
||||
return Vector2f(0,0);
|
||||
}
|
||||
|
||||
|
||||
|
@ -18,10 +18,10 @@ namespace ewol {
|
||||
static const int32_t sizeAuto;
|
||||
private:
|
||||
etk::Uri m_filename;
|
||||
ivec2 m_requestSize;
|
||||
vec3 m_position; //!< The current position to draw
|
||||
vec3 m_clippingPosStart; //!< Clipping start position
|
||||
vec3 m_clippingPosStop; //!< Clipping stop position
|
||||
Vector2i m_requestSize;
|
||||
Vector3f m_position; //!< The current position to draw
|
||||
Vector3f m_clippingPosStart; //!< Clipping start position
|
||||
Vector3f m_clippingPosStop; //!< Clipping stop position
|
||||
bool m_clippingEnable; //!< true if the clipping must be activated
|
||||
private:
|
||||
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)
|
||||
* @return the current position.
|
||||
*/
|
||||
const vec3& getPos() {
|
||||
const Vector3f& getPos() {
|
||||
return m_position;
|
||||
};
|
||||
/**
|
||||
* @brief set position for the next text writen
|
||||
* @param[in] _pos Position of the text (in 3D)
|
||||
*/
|
||||
void setPos(const vec3& _pos) {
|
||||
void setPos(const Vector3f& _pos) {
|
||||
m_position = _pos;
|
||||
};
|
||||
inline void setPos(const vec2& _pos) {
|
||||
setPos(vec3(_pos.x(),_pos.y(),0));
|
||||
inline void setPos(const Vector2f& _pos) {
|
||||
setPos(Vector3f(_pos.x(),_pos.y(),0));
|
||||
};
|
||||
/**
|
||||
* @brief set relative position for the next text writen
|
||||
* @param[in] _pos ofset apply of the text (in 3D)
|
||||
*/
|
||||
void setRelPos(const vec3& _pos) {
|
||||
void setRelPos(const Vector3f& _pos) {
|
||||
m_position += _pos;
|
||||
};
|
||||
inline void setRelPos(const vec2& _pos) {
|
||||
setRelPos(vec3(_pos.x(),_pos.y(),0));
|
||||
inline void setRelPos(const Vector2f& _pos) {
|
||||
setRelPos(Vector3f(_pos.x(),_pos.y(),0));
|
||||
};
|
||||
/**
|
||||
* @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] _width Width size of the clipping
|
||||
*/
|
||||
void setClippingWidth(const vec3& _pos, vec3 _width) {
|
||||
void setClippingWidth(const Vector3f& _pos, Vector3f _width) {
|
||||
setClipping(_pos, _pos+_width);
|
||||
};
|
||||
inline void setClippingWidth(const vec2& _pos, const vec2& _width) {
|
||||
setClippingWidth(vec3(_pos.x(),_pos.y(),0), vec3(_width.x(),_width.y(),0));
|
||||
inline void setClippingWidth(const Vector2f& _pos, const Vector2f& _width) {
|
||||
setClippingWidth(Vector3f(_pos.x(),_pos.y(),0), Vector3f(_width.x(),_width.y(),0));
|
||||
};
|
||||
/**
|
||||
* @brief Request a clipping area for the text (next draw only)
|
||||
* @param[in] _pos Start position of the clipping
|
||||
* @param[in] _posEnd End position of the clipping
|
||||
*/
|
||||
void setClipping(const vec3& _pos, vec3 _posEnd);
|
||||
inline void setClipping(const vec2& _pos, const vec2& _posEnd) {
|
||||
setClipping(vec3(_pos.x(),_pos.y(),0), vec3(_posEnd.x(),_posEnd.y(),0));
|
||||
void setClipping(const Vector3f& _pos, Vector3f _posEnd);
|
||||
inline void setClipping(const Vector2f& _pos, const Vector2f& _posEnd) {
|
||||
setClipping(Vector3f(_pos.x(),_pos.y(),0), Vector3f(_posEnd.x(),_posEnd.y(),0));
|
||||
};
|
||||
/**
|
||||
* @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
|
||||
* @param[in] _size size of the output image
|
||||
*/
|
||||
void print(const ivec2& _size) {
|
||||
print(vec2(_size.x(),_size.y()));
|
||||
void print(const Vector2i& _size) {
|
||||
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
|
||||
* @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] _sourcePosStop Stop position in the image [0..1] (can be bigger but this repeate the image).
|
||||
*/
|
||||
void printPart(const vec2& _size,
|
||||
vec2 _sourcePosStart,
|
||||
vec2 _sourcePosStop);
|
||||
void printPart(const Vector2f& _size,
|
||||
Vector2f _sourcePosStart,
|
||||
Vector2f _sourcePosStop);
|
||||
/**
|
||||
* @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] _size for the image when Verctorial image loading is requested
|
||||
*/
|
||||
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);
|
||||
/**
|
||||
* @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)
|
||||
* @return tre image registered size
|
||||
*/
|
||||
vec2 getRealSize();
|
||||
Vector2f getRealSize();
|
||||
public:
|
||||
/**
|
||||
* @brief Set render mode of the image
|
||||
|
@ -50,7 +50,7 @@ ewol::compositing::Shaper::Shaper(const etk::Uri& _uri) :
|
||||
// Create the VBO:
|
||||
m_VBO = gale::resource::VirtualBufferObject::create(NB_VBO);
|
||||
if (m_VBO == null) {
|
||||
EWOL_ERROR("can not instanciate VBO ...");
|
||||
Log.error("can not instanciate VBO ...");
|
||||
return;
|
||||
}
|
||||
// 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() {
|
||||
if (m_uri.isEmpty() == true) {
|
||||
EWOL_DEBUG("no Shaper set for loading resources ...");
|
||||
Log.debug("no Shaper set for loading resources ...");
|
||||
return;
|
||||
}
|
||||
m_config = ewol::resource::ConfigFile::create(m_uri.get());
|
||||
@ -116,9 +116,9 @@ void ewol::compositing::Shaper::loadProgram() {
|
||||
etk::Uri tmpUri = m_uri;
|
||||
tmpUri.setPath(m_uri.getPath().getParent() / basicShaderFile);
|
||||
tmpFilename = tmpUri.get();
|
||||
EWOL_DEBUG("Shaper try load shader : '" << tmpFilename << "' with base : '" << basicShaderFile << "'");
|
||||
Log.debug("Shaper try load shader : '" << tmpFilename << "' with base : '" << basicShaderFile << "'");
|
||||
} else {
|
||||
EWOL_DEBUG("Shaper try load shader : '" << tmpFilename << "'");
|
||||
Log.debug("Shaper try load shader : '" << tmpFilename << "'");
|
||||
}
|
||||
// get the shader resource :
|
||||
m_GLPosition = 0;
|
||||
@ -144,11 +144,11 @@ void ewol::compositing::Shaper::loadProgram() {
|
||||
etk::Uri tmpUri = m_uri;
|
||||
tmpUri.setPath(m_uri.getPath().getParent() / basicImageFile);
|
||||
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 {
|
||||
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);
|
||||
}
|
||||
}
|
||||
@ -160,18 +160,18 @@ void ewol::compositing::Shaper::loadProgram() {
|
||||
etk::Uri tmpUri = m_uri;
|
||||
tmpUri.setPath(m_uri.getPath().getParent() / basicColorFile);
|
||||
tmpFilename = tmpUri.get();
|
||||
EWOL_DEBUG("Shaper try load colorFile : '" << tmpFilename << "' with base : '" << basicColorFile << "'");
|
||||
Log.debug("Shaper try load colorFile : '" << tmpFilename << "' with base : '" << basicColorFile << "'");
|
||||
} else {
|
||||
EWOL_DEBUG("Shaper try load colorFile : '" << tmpFilename << "'");
|
||||
Log.debug("Shaper try load colorFile : '" << tmpFilename << "'");
|
||||
}
|
||||
m_colorProperty = ewol::resource::ColorFile::create(tmpFilename);
|
||||
if ( m_GLprogram != null
|
||||
&& m_colorProperty != null) {
|
||||
etk::Vector<etk::String> listColor = m_colorProperty->getColors();
|
||||
List<etk::String> listColor = m_colorProperty->getColors();
|
||||
for (auto tmpColor : listColor) {
|
||||
int32_t glId = m_GLprogram->getUniform(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;
|
||||
}
|
||||
if (m_GLprogram == null) {
|
||||
EWOL_ERROR("No shader ...");
|
||||
Log.error("No shader ...");
|
||||
return;
|
||||
}
|
||||
if (m_VBO->bufferSize(m_vboIdCoord) <= 0) {
|
||||
@ -218,10 +218,10 @@ void ewol::compositing::Shaper::draw(bool _disableDepthTest) {
|
||||
|
||||
void ewol::compositing::Shaper::clear() {
|
||||
// nothing to do ...
|
||||
m_propertySize = vec2(0,0);
|
||||
m_propertyOrigin = vec2(0,0);
|
||||
m_propertyInsidePosition = vec2(0,0);
|
||||
m_propertyInsideSize = vec2(0,0);
|
||||
m_propertySize = Vector2f(0,0);
|
||||
m_propertyOrigin = Vector2f(0,0);
|
||||
m_propertyInsidePosition = Vector2f(0,0);
|
||||
m_propertyInsideSize = Vector2f(0,0);
|
||||
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) {
|
||||
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 :
|
||||
if (m_stateTransition >= 1.0) {
|
||||
m_stateOld = m_stateNew;
|
||||
@ -255,7 +255,7 @@ bool ewol::compositing::Shaper::periodicCall(const ewol::event::Time& _event) {
|
||||
m_stateNew = m_nextStatusRequested;
|
||||
m_nextStatusRequested = -1;
|
||||
m_stateTransition = 0.0;
|
||||
EWOL_VERBOSE(" ##### START ##### ");
|
||||
Log.verbose(" ##### START ##### ");
|
||||
} else {
|
||||
m_nextStatusRequested = -1;
|
||||
// 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();
|
||||
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;
|
||||
}
|
||||
@ -310,97 +310,97 @@ void ewol::compositing::Shaper::addVertexLine(float _yTop,
|
||||
|
||||
m_nbVertexToDisplay++;
|
||||
if (_displayOutside == true) {
|
||||
m_VBO->pushOnBuffer(m_vboIdCoord, vec2(_x1, _yButtom));
|
||||
m_VBO->pushOnBuffer(m_vboIdPos, vec2(_table[0],_yValButtom));
|
||||
m_VBO->pushOnBuffer(m_vboIdCoord, Vector2f(_x1, _yButtom));
|
||||
m_VBO->pushOnBuffer(m_vboIdPos, Vector2f(_table[0],_yValButtom));
|
||||
m_nbVertexToDisplay++;
|
||||
} else {
|
||||
m_VBO->pushOnBuffer(m_vboIdCoord, vec2(_x2, _yButtom));
|
||||
m_VBO->pushOnBuffer(m_vboIdPos, vec2(_table[1],_yValButtom));
|
||||
m_VBO->pushOnBuffer(m_vboIdCoord, Vector2f(_x2, _yButtom));
|
||||
m_VBO->pushOnBuffer(m_vboIdPos, Vector2f(_table[1],_yValButtom));
|
||||
m_nbVertexToDisplay++;
|
||||
}
|
||||
}
|
||||
|
||||
if (_displayOutside == true) {
|
||||
// A
|
||||
m_VBO->pushOnBuffer(m_vboIdCoord, vec2(_x1, _yButtom));
|
||||
m_VBO->pushOnBuffer(m_vboIdPos, vec2(_table[0],_yValButtom));
|
||||
m_VBO->pushOnBuffer(m_vboIdCoord, Vector2f(_x1, _yButtom));
|
||||
m_VBO->pushOnBuffer(m_vboIdPos, Vector2f(_table[0],_yValButtom));
|
||||
m_nbVertexToDisplay++;
|
||||
m_VBO->pushOnBuffer(m_vboIdCoord, vec2(_x1, _yTop));
|
||||
m_VBO->pushOnBuffer(m_vboIdPos, vec2(_table[0],_yValTop));
|
||||
m_VBO->pushOnBuffer(m_vboIdCoord, Vector2f(_x1, _yTop));
|
||||
m_VBO->pushOnBuffer(m_vboIdPos, Vector2f(_table[0],_yValTop));
|
||||
m_nbVertexToDisplay++;
|
||||
m_VBO->pushOnBuffer(m_vboIdCoord, vec2(_x2, _yButtom));
|
||||
m_VBO->pushOnBuffer(m_vboIdPos, vec2(_table[1],_yValButtom));
|
||||
m_VBO->pushOnBuffer(m_vboIdCoord, Vector2f(_x2, _yButtom));
|
||||
m_VBO->pushOnBuffer(m_vboIdPos, Vector2f(_table[1],_yValButtom));
|
||||
m_nbVertexToDisplay++;
|
||||
// B
|
||||
m_VBO->pushOnBuffer(m_vboIdCoord, vec2(_x2, _yTop));
|
||||
m_VBO->pushOnBuffer(m_vboIdPos, vec2(_table[1],_yValTop));
|
||||
m_VBO->pushOnBuffer(m_vboIdCoord, Vector2f(_x2, _yTop));
|
||||
m_VBO->pushOnBuffer(m_vboIdPos, Vector2f(_table[1],_yValTop));
|
||||
m_nbVertexToDisplay++;
|
||||
|
||||
// C
|
||||
m_VBO->pushOnBuffer(m_vboIdCoord, vec2(_x3, _yButtom));
|
||||
m_VBO->pushOnBuffer(m_vboIdPos, vec2(_table[2],_yValButtom));
|
||||
m_VBO->pushOnBuffer(m_vboIdCoord, Vector2f(_x3, _yButtom));
|
||||
m_VBO->pushOnBuffer(m_vboIdPos, Vector2f(_table[2],_yValButtom));
|
||||
m_nbVertexToDisplay++;
|
||||
} else {
|
||||
// C
|
||||
m_VBO->pushOnBuffer(m_vboIdCoord, vec2(_x2, _yButtom));
|
||||
m_VBO->pushOnBuffer(m_vboIdPos, vec2(_table[1],_yValButtom));
|
||||
m_VBO->pushOnBuffer(m_vboIdCoord, Vector2f(_x2, _yButtom));
|
||||
m_VBO->pushOnBuffer(m_vboIdPos, Vector2f(_table[1],_yValButtom));
|
||||
m_nbVertexToDisplay++;
|
||||
m_VBO->pushOnBuffer(m_vboIdCoord, vec2(_x2, _yTop));
|
||||
m_VBO->pushOnBuffer(m_vboIdPos, vec2(_table[1],_yValTop));
|
||||
m_VBO->pushOnBuffer(m_vboIdCoord, Vector2f(_x2, _yTop));
|
||||
m_VBO->pushOnBuffer(m_vboIdPos, Vector2f(_table[1],_yValTop));
|
||||
m_nbVertexToDisplay++;
|
||||
m_VBO->pushOnBuffer(m_vboIdCoord, vec2(_x3, _yButtom));
|
||||
m_VBO->pushOnBuffer(m_vboIdPos, vec2(_table[2],_yValButtom));
|
||||
m_VBO->pushOnBuffer(m_vboIdCoord, Vector2f(_x3, _yButtom));
|
||||
m_VBO->pushOnBuffer(m_vboIdPos, Vector2f(_table[2],_yValButtom));
|
||||
m_nbVertexToDisplay++;
|
||||
}
|
||||
// D
|
||||
m_VBO->pushOnBuffer(m_vboIdCoord, vec2(_x3, _yTop));
|
||||
m_VBO->pushOnBuffer(m_vboIdPos, vec2(_table[2],_yValTop));
|
||||
m_VBO->pushOnBuffer(m_vboIdCoord, Vector2f(_x3, _yTop));
|
||||
m_VBO->pushOnBuffer(m_vboIdPos, Vector2f(_table[2],_yValTop));
|
||||
m_nbVertexToDisplay++;
|
||||
|
||||
// E
|
||||
m_VBO->pushOnBuffer(m_vboIdCoord, vec2(_x4, _yButtom));
|
||||
m_VBO->pushOnBuffer(m_vboIdPos, vec2(_table[3],_yValButtom));
|
||||
m_VBO->pushOnBuffer(m_vboIdCoord, Vector2f(_x4, _yButtom));
|
||||
m_VBO->pushOnBuffer(m_vboIdPos, Vector2f(_table[3],_yValButtom));
|
||||
m_nbVertexToDisplay++;
|
||||
// F
|
||||
m_VBO->pushOnBuffer(m_vboIdCoord, vec2(_x4, _yTop));
|
||||
m_VBO->pushOnBuffer(m_vboIdPos, vec2(_table[3],_yValTop));
|
||||
m_VBO->pushOnBuffer(m_vboIdCoord, Vector2f(_x4, _yTop));
|
||||
m_VBO->pushOnBuffer(m_vboIdPos, Vector2f(_table[3],_yValTop));
|
||||
m_nbVertexToDisplay++;
|
||||
|
||||
// G
|
||||
m_VBO->pushOnBuffer(m_vboIdCoord, vec2(_x5, _yButtom));
|
||||
m_VBO->pushOnBuffer(m_vboIdPos, vec2(_table[4],_yValButtom));
|
||||
m_VBO->pushOnBuffer(m_vboIdCoord, Vector2f(_x5, _yButtom));
|
||||
m_VBO->pushOnBuffer(m_vboIdPos, Vector2f(_table[4],_yValButtom));
|
||||
m_nbVertexToDisplay++;
|
||||
// H
|
||||
m_VBO->pushOnBuffer(m_vboIdCoord, vec2(_x5, _yTop));
|
||||
m_VBO->pushOnBuffer(m_vboIdPos, vec2(_table[4],_yValTop));
|
||||
m_VBO->pushOnBuffer(m_vboIdCoord, Vector2f(_x5, _yTop));
|
||||
m_VBO->pushOnBuffer(m_vboIdPos, Vector2f(_table[4],_yValTop));
|
||||
m_nbVertexToDisplay++;
|
||||
|
||||
// I
|
||||
m_VBO->pushOnBuffer(m_vboIdCoord, vec2(_x6, _yButtom));
|
||||
m_VBO->pushOnBuffer(m_vboIdPos, vec2(_table[5],_yValButtom));
|
||||
m_VBO->pushOnBuffer(m_vboIdCoord, Vector2f(_x6, _yButtom));
|
||||
m_VBO->pushOnBuffer(m_vboIdPos, Vector2f(_table[5],_yValButtom));
|
||||
m_nbVertexToDisplay++;
|
||||
// J
|
||||
m_VBO->pushOnBuffer(m_vboIdCoord, vec2(_x6, _yTop));
|
||||
m_VBO->pushOnBuffer(m_vboIdPos, vec2(_table[5],_yValTop));
|
||||
m_VBO->pushOnBuffer(m_vboIdCoord, Vector2f(_x6, _yTop));
|
||||
m_VBO->pushOnBuffer(m_vboIdPos, Vector2f(_table[5],_yValTop));
|
||||
m_nbVertexToDisplay++;
|
||||
|
||||
// K
|
||||
m_VBO->pushOnBuffer(m_vboIdCoord, vec2(_x7, _yButtom));
|
||||
m_VBO->pushOnBuffer(m_vboIdPos, vec2(_table[6],_yValButtom));
|
||||
m_VBO->pushOnBuffer(m_vboIdCoord, Vector2f(_x7, _yButtom));
|
||||
m_VBO->pushOnBuffer(m_vboIdPos, Vector2f(_table[6],_yValButtom));
|
||||
m_nbVertexToDisplay++;
|
||||
// L
|
||||
m_VBO->pushOnBuffer(m_vboIdCoord, vec2(_x7, _yTop));
|
||||
m_VBO->pushOnBuffer(m_vboIdPos, vec2(_table[6],_yValTop));
|
||||
m_VBO->pushOnBuffer(m_vboIdCoord, Vector2f(_x7, _yTop));
|
||||
m_VBO->pushOnBuffer(m_vboIdPos, Vector2f(_table[6],_yValTop));
|
||||
m_nbVertexToDisplay++;
|
||||
|
||||
if (_displayOutside == true) {
|
||||
// M
|
||||
m_VBO->pushOnBuffer(m_vboIdCoord, vec2(_x8, _yButtom));
|
||||
m_VBO->pushOnBuffer(m_vboIdPos, vec2(_table[7],_yValButtom));
|
||||
m_VBO->pushOnBuffer(m_vboIdCoord, Vector2f(_x8, _yButtom));
|
||||
m_VBO->pushOnBuffer(m_vboIdPos, Vector2f(_table[7],_yValButtom));
|
||||
m_nbVertexToDisplay++;
|
||||
// N
|
||||
m_VBO->pushOnBuffer(m_vboIdCoord, vec2(_x8, _yTop));
|
||||
m_VBO->pushOnBuffer(m_vboIdPos, vec2(_table[7],_yValTop));
|
||||
m_VBO->pushOnBuffer(m_vboIdCoord, Vector2f(_x8, _yTop));
|
||||
m_VBO->pushOnBuffer(m_vboIdPos, Vector2f(_table[7],_yValTop));
|
||||
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 }
|
||||
};
|
||||
|
||||
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();
|
||||
ewol::Padding borderTmp = getBorder();
|
||||
ewol::Padding paddingIn = getPaddingIn();
|
||||
@ -490,9 +490,9 @@ void ewol::compositing::Shaper::setShape(const vec2& _origin, const vec2& _size,
|
||||
|
||||
#endif
|
||||
/*
|
||||
EWOL_ERROR(" enveloppe = " << enveloppe);
|
||||
EWOL_ERROR(" border = " << border);
|
||||
EWOL_ERROR(" inside = " << inside);
|
||||
Log.error(" enveloppe = " << enveloppe);
|
||||
Log.error(" border = " << border);
|
||||
Log.error(" inside = " << inside);
|
||||
*/
|
||||
int32_t mode = 0;
|
||||
bool displayOutside = false;
|
||||
|
@ -54,7 +54,7 @@ namespace ewol {
|
||||
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_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_GLStateOld; //!< openGL id on the element (old 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)
|
||||
// internal needed data :
|
||||
int32_t m_nextStatusRequested; //!< when status is changing, this represent the next step of it
|
||||
vec2 m_propertyOrigin; //!< widget origin
|
||||
vec2 m_propertySize; //!< widget size
|
||||
vec2 m_propertyInsidePosition; //!< internal subwidget position
|
||||
vec2 m_propertyInsideSize; //!< internal subwidget size
|
||||
Vector2f m_propertyOrigin; //!< widget origin
|
||||
Vector2f m_propertySize; //!< widget size
|
||||
Vector2f m_propertyInsidePosition; //!< internal subwidget position
|
||||
Vector2f m_propertyInsideSize; //!< internal subwidget size
|
||||
int32_t m_stateActivate; //!< Activate state of the element
|
||||
int32_t m_stateOld; //!< previous state
|
||||
int32_t m_stateNew; //!< destination state
|
||||
@ -75,7 +75,7 @@ namespace ewol {
|
||||
int32_t m_nbVertexToDisplay;
|
||||
// color management theme:
|
||||
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:
|
||||
static const int32_t m_vboIdCoord;
|
||||
static const int32_t m_vboIdPos;
|
||||
@ -224,11 +224,11 @@ namespace ewol {
|
||||
* @param[in] _insidePos Positin 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
|
||||
void setShape(const vec2& _origin, const vec2& _size) {
|
||||
void setShape(const Vector2f& _origin, const Vector2f& _size) {
|
||||
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:
|
||||
/**
|
||||
|
@ -10,12 +10,12 @@
|
||||
#include <etk/typeInfo.hpp>
|
||||
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),
|
||||
m_nbSprite(_nbSprite),
|
||||
m_unitarySpriteSize(0,0) {
|
||||
/*
|
||||
vec2 imageSize = getRealSize();
|
||||
Vector2f imageSize = getRealSize();
|
||||
m_unitarySpriteSize.setValue(imageSize.x()/(float)m_nbSprite.x(),
|
||||
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
|
||||
|| _spriteID.y()<0
|
||||
|| _spriteID.x() >= m_nbSprite.x()
|
||||
|| _spriteID.y() >= m_nbSprite.y()) {
|
||||
return;
|
||||
}
|
||||
printPart(vec2(_size.x(),_size.y()),
|
||||
vec2((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()));
|
||||
printPart(Vector2f(_size.x(),_size.y()),
|
||||
Vector2f((float)(_spriteID.x() )*m_unitarySpriteSize.x(), (float)(_spriteID.y() )*m_unitarySpriteSize.y()),
|
||||
Vector2f((float)(_spriteID.x()+1)*m_unitarySpriteSize.x(), (float)(_spriteID.y()+1)*m_unitarySpriteSize.y()));
|
||||
}
|
||||
|
||||
|
||||
|
@ -12,17 +12,17 @@ namespace ewol {
|
||||
namespace compositing {
|
||||
class Sprite : public ewol::compositing::Image {
|
||||
protected:
|
||||
ivec2 m_nbSprite; //!< number of sprite in vertical and horizontal
|
||||
vec2 m_unitarySpriteSize; //!< size of a unique sprite
|
||||
Vector2i m_nbSprite; //!< number of sprite in vertical and horizontal
|
||||
Vector2f m_unitarySpriteSize; //!< size of a unique sprite
|
||||
public:
|
||||
Sprite(const etk::String& _imageName,
|
||||
const ivec2& _nbSprite,
|
||||
const Vector2i& _nbSprite,
|
||||
int32_t _size=ewol::compositing::Image::sizeAuto);
|
||||
virtual ~Sprite() {};
|
||||
void printSprite(const ivec2& _spriteID, const vec2& _size) {
|
||||
printSprite(_spriteID, vec3(_size.x(), _size.y(),0));
|
||||
void printSprite(const Vector2i& _spriteID, const Vector2f& _size) {
|
||||
printSprite(_spriteID, Vector3f(_size.x(), _size.y(),0));
|
||||
};
|
||||
void printSprite(const ivec2& _spriteID, const vec3& _size);
|
||||
void printSprite(const Vector2i& _spriteID, const Vector3f& _size);
|
||||
};
|
||||
}
|
||||
}
|
||||
|
@ -37,7 +37,7 @@ void ewol::compositing::Text::drawMT(const mat4& _transformationMatrix, bool _en
|
||||
return;
|
||||
}
|
||||
if (m_GLprogram == null) {
|
||||
EWOL_ERROR("No shader ...");
|
||||
Log.error("No shader ...");
|
||||
return;
|
||||
}
|
||||
if (_enableDepthTest == true) {
|
||||
@ -81,7 +81,7 @@ void ewol::compositing::Text::drawD(bool _disableDepthTest) {
|
||||
return;
|
||||
}
|
||||
if (m_GLprogram == null) {
|
||||
EWOL_ERROR("No shader ...");
|
||||
Log.error("No shader ...");
|
||||
return;
|
||||
}
|
||||
// set Matrix : translation/positionMatrix
|
||||
@ -158,11 +158,11 @@ void ewol::compositing::Text::setFont(etk::String _fontName, int32_t _fontSize)
|
||||
}
|
||||
_fontName += ":";
|
||||
_fontName += etk::toString(_fontSize);
|
||||
EWOL_VERBOSE("plop : " << _fontName << " size=" << _fontSize << " result :" << _fontName);
|
||||
Log.verbose("plop : " << _fontName << " size=" << _fontSize << " result :" << _fontName);
|
||||
// link to new one
|
||||
m_font = ewol::resource::TexturedFont::create(_fontName);
|
||||
if (m_font == null) {
|
||||
EWOL_ERROR("Can not get font resource");
|
||||
Log.error("Can not get font resource");
|
||||
m_font = previousFont;
|
||||
}
|
||||
}
|
||||
@ -177,7 +177,7 @@ void ewol::compositing::Text::printChar(const char32_t& _charcode) {
|
||||
// get a pointer on the glyph property :
|
||||
ewol::GlyphProperty* myGlyph = getGlyphPointer(_charcode);
|
||||
if (null == myGlyph) {
|
||||
EWOL_ERROR(" font does not really existed ...");
|
||||
Log.error(" font does not really existed ...");
|
||||
return;
|
||||
}
|
||||
int32_t fontSize = getSize();
|
||||
@ -188,7 +188,7 @@ void ewol::compositing::Text::printChar(const char32_t& _charcode) {
|
||||
if (m_kerning == true) {
|
||||
kerningOffset = myGlyph->kerningGet(m_previousCharcode);
|
||||
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 == ' ';
|
||||
@ -271,7 +271,7 @@ void ewol::compositing::Text::printChar(const char32_t& _charcode) {
|
||||
* 3------2
|
||||
*/
|
||||
if (m_needDisplay == true) {
|
||||
vec3 bitmapDrawPos[4];
|
||||
Vector3f bitmapDrawPos[4];
|
||||
bitmapDrawPos[0].setValue((int32_t)dxA, (int32_t)dyC, 0);
|
||||
bitmapDrawPos[1].setValue((int32_t)dxB, (int32_t)dyC, 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
|
||||
*/
|
||||
vec2 texturePos[4];
|
||||
Vector2f texturePos[4];
|
||||
texturePos[0].setValue(tuA+m_mode, tvC);
|
||||
texturePos[1].setValue(tuB+m_mode, tvC);
|
||||
texturePos[2].setValue(tuB+m_mode, tvD);
|
||||
@ -332,9 +332,9 @@ void ewol::compositing::Text::printChar(const char32_t& _charcode) {
|
||||
}
|
||||
}
|
||||
// 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);
|
||||
//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
|
||||
m_previousCharcode = _charcode;
|
||||
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 :
|
||||
ewol::GlyphProperty * myGlyph = getGlyphPointer(_charcode);
|
||||
int32_t fontHeigh = getHeight();
|
||||
@ -352,7 +352,7 @@ vec3 ewol::compositing::Text::calculateSizeChar(const char32_t& _charcode) {
|
||||
} else {
|
||||
EWOL_WARNING("no Glyph... in font : " << m_font->getName());
|
||||
}
|
||||
return vec3((float)(0.2),
|
||||
return Vector3f((float)(0.2),
|
||||
(float)(fontHeigh),
|
||||
(float)(0.0));
|
||||
}
|
||||
@ -362,7 +362,7 @@ vec3 ewol::compositing::Text::calculateSizeChar(const char32_t& _charcode) {
|
||||
kerningOffset = myGlyph->kerningGet(m_previousCharcode);
|
||||
}
|
||||
|
||||
vec3 outputSize((float)(myGlyph->m_advance.x() + kerningOffset),
|
||||
Vector3f outputSize((float)(myGlyph->m_advance.x() + kerningOffset),
|
||||
(float)(fontHeigh),
|
||||
(float)(0.0));
|
||||
// Register the previous character
|
||||
|
@ -49,7 +49,7 @@ namespace ewol {
|
||||
virtual void setFont(etk::String _fontName, int32_t _fontSize);
|
||||
virtual void setFontMode(enum ewol::font::mode _mode);
|
||||
virtual void printChar(const char32_t& _charcode);
|
||||
virtual vec3 calculateSizeChar(const char32_t& _charcode);
|
||||
virtual Vector3f calculateSizeChar(const char32_t& _charcode);
|
||||
};
|
||||
}
|
||||
}
|
||||
|
@ -49,7 +49,7 @@ ewol::compositing::TextBase::TextBase(const etk::String& _shaderName, bool _load
|
||||
// Create the VBO:
|
||||
m_VBO = gale::resource::VirtualBufferObject::create(NB_VBO);
|
||||
if (m_VBO == null) {
|
||||
EWOL_ERROR("can not instanciate VBO ...");
|
||||
Log.error("can not instanciate VBO ...");
|
||||
return;
|
||||
}
|
||||
// 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_GLtextHeight = m_GLprogram->getUniform("EW_texHeight");
|
||||
} else {
|
||||
EWOL_ERROR("Can not load the program => create previous one...");
|
||||
Log.error("Can not load the program => create previous one...");
|
||||
m_GLprogram = old;
|
||||
old = null;
|
||||
}
|
||||
}
|
||||
|
||||
void ewol::compositing::TextBase::translate(const vec3& _vect) {
|
||||
void ewol::compositing::TextBase::translate(const Vector3f& _vect) {
|
||||
ewol::Compositing::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);
|
||||
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);
|
||||
m_vectorialDraw.scale(_vect);
|
||||
}
|
||||
@ -108,9 +108,9 @@ void ewol::compositing::TextBase::clear() {
|
||||
}
|
||||
|
||||
void ewol::compositing::TextBase::reset() {
|
||||
m_position = vec3(0,0,0);
|
||||
m_clippingPosStart = vec3(0,0,0);
|
||||
m_clippingPosStop = vec3(0,0,0);
|
||||
m_position = Vector3f(0,0,0);
|
||||
m_clippingPosStart = Vector3f(0,0,0);
|
||||
m_clippingPosStop = Vector3f(0,0,0);
|
||||
m_sizeDisplayStart = m_position;
|
||||
m_sizeDisplayStop = m_position;
|
||||
m_nbCharDisplayed = 0;
|
||||
@ -130,15 +130,15 @@ void ewol::compositing::TextBase::reset() {
|
||||
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
|
||||
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.setY(etk::max(m_position.y(), m_sizeDisplayStop.y()));
|
||||
m_sizeDisplayStart.setX(etk::min(m_position.x(), m_sizeDisplayStart.x()));
|
||||
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
|
||||
m_position = _pos;
|
||||
@ -149,18 +149,18 @@ void ewol::compositing::TextBase::setPos(const vec3& _pos) {
|
||||
m_sizeDisplayStart = m_position;
|
||||
m_sizeDisplayStop = m_position;
|
||||
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 {
|
||||
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.setY(etk::max(m_position.y(), m_sizeDisplayStop.y()));
|
||||
m_sizeDisplayStart.setX(etk::min(m_position.x(), m_sizeDisplayStart.x()));
|
||||
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_previousCharcode = 0;
|
||||
m_vectorialDraw.setPos(m_position);
|
||||
@ -171,7 +171,7 @@ void ewol::compositing::TextBase::setColorBg(const etk::Color<>& _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
|
||||
if (_pos.x() <= _posEnd.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) {
|
||||
etk::Vector<TextDecoration> decorationEmpty;
|
||||
List<TextDecoration> decorationEmpty;
|
||||
print(_text, decorationEmpty);
|
||||
}
|
||||
|
||||
void ewol::compositing::TextBase::print(const etk::String& _text) {
|
||||
etk::Vector<TextDecoration> decorationEmpty;
|
||||
List<TextDecoration> 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) {
|
||||
// get the static real pointer
|
||||
if (_element.exist() == false) {
|
||||
EWOL_ERROR( "Error Input node does not existed ...");
|
||||
Log.error( "Error Input node does not existed ...");
|
||||
return;
|
||||
}
|
||||
for(auto it : _element.nodes) {
|
||||
@ -266,23 +266,23 @@ void ewol::compositing::TextBase::parseHtmlNode(const exml::Element& _element) {
|
||||
continue;
|
||||
} else if (it.isText() == true) {
|
||||
htmlAddData(etk::toUString(it.getValue()));
|
||||
EWOL_VERBOSE("XML add : " << it.getValue());
|
||||
Log.verbose("XML add : " << it.getValue());
|
||||
continue;
|
||||
} 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;
|
||||
}
|
||||
exml::Element elem = it.toElement();
|
||||
if (elem.exist() == false) {
|
||||
EWOL_ERROR("Cast error ...");
|
||||
Log.error("Cast error ...");
|
||||
continue;
|
||||
}
|
||||
if(etk::compare_no_case(elem.getValue(), "br") == true) {
|
||||
htmlFlush();
|
||||
EWOL_VERBOSE("XML flush & newLine");
|
||||
Log.verbose("XML flush & newLine");
|
||||
forceLineReturn();
|
||||
} else if (etk::compare_no_case(elem.getValue(), "font") == true) {
|
||||
EWOL_VERBOSE("XML Font ...");
|
||||
Log.verbose("XML Font ...");
|
||||
TextDecoration tmpDeco = m_htmlDecoTmp;
|
||||
etk::String colorValue = elem.attributes["color"];
|
||||
if (colorValue.size() != 0) {
|
||||
@ -296,7 +296,7 @@ void ewol::compositing::TextBase::parseHtmlNode(const exml::Element& _element) {
|
||||
m_htmlDecoTmp = tmpDeco;
|
||||
} else if( etk::compare_no_case(elem.getValue(), "b") == true
|
||||
|| etk::compare_no_case(elem.getValue(), "bold") == true) {
|
||||
EWOL_VERBOSE("XML bold ...");
|
||||
Log.verbose("XML bold ...");
|
||||
TextDecoration tmpDeco = m_htmlDecoTmp;
|
||||
if (m_htmlDecoTmp.m_mode == ewol::font::Regular) {
|
||||
m_htmlDecoTmp.m_mode = ewol::font::Bold;
|
||||
@ -307,7 +307,7 @@ void ewol::compositing::TextBase::parseHtmlNode(const exml::Element& _element) {
|
||||
m_htmlDecoTmp = tmpDeco;
|
||||
} else if( etk::compare_no_case(elem.getValue(), "i") == true
|
||||
|| etk::compare_no_case(elem.getValue(), "italic") == true) {
|
||||
EWOL_VERBOSE("XML italic ...");
|
||||
Log.verbose("XML italic ...");
|
||||
TextDecoration tmpDeco = m_htmlDecoTmp;
|
||||
if (m_htmlDecoTmp.m_mode == ewol::font::Regular) {
|
||||
m_htmlDecoTmp.m_mode = ewol::font::Italic;
|
||||
@ -318,38 +318,38 @@ void ewol::compositing::TextBase::parseHtmlNode(const exml::Element& _element) {
|
||||
m_htmlDecoTmp = tmpDeco;
|
||||
} else if( etk::compare_no_case(elem.getValue(), "u") == true
|
||||
|| etk::compare_no_case(elem.getValue(), "underline") == true) {
|
||||
EWOL_VERBOSE("XML underline ...");
|
||||
Log.verbose("XML underline ...");
|
||||
parseHtmlNode(elem);
|
||||
} else if( etk::compare_no_case(elem.getValue(), "p") == true
|
||||
|| etk::compare_no_case(elem.getValue(), "paragraph") == true) {
|
||||
EWOL_VERBOSE("XML paragraph ...");
|
||||
Log.verbose("XML paragraph ...");
|
||||
htmlFlush();
|
||||
m_alignement = alignLeft;
|
||||
forceLineReturn();
|
||||
parseHtmlNode(elem);
|
||||
forceLineReturn();
|
||||
} else if (etk::compare_no_case(elem.getValue(), "center") == true) {
|
||||
EWOL_VERBOSE("XML center ...");
|
||||
Log.verbose("XML center ...");
|
||||
htmlFlush();
|
||||
m_alignement = alignCenter;
|
||||
parseHtmlNode(elem);
|
||||
} else if (etk::compare_no_case(elem.getValue(), "left") == true) {
|
||||
EWOL_VERBOSE("XML left ...");
|
||||
Log.verbose("XML left ...");
|
||||
htmlFlush();
|
||||
m_alignement = alignLeft;
|
||||
parseHtmlNode(elem);
|
||||
} else if (etk::compare_no_case(elem.getValue(), "right") == true) {
|
||||
EWOL_VERBOSE("XML right ...");
|
||||
Log.verbose("XML right ...");
|
||||
htmlFlush();
|
||||
m_alignement = alignRight;
|
||||
parseHtmlNode(elem);
|
||||
} else if (etk::compare_no_case(elem.getValue(), "justify") == true) {
|
||||
EWOL_VERBOSE("XML justify ...");
|
||||
Log.verbose("XML justify ...");
|
||||
htmlFlush();
|
||||
m_alignement = alignJustify;
|
||||
parseHtmlNode(elem);
|
||||
} 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");
|
||||
tmpData += _text;
|
||||
tmpData += "\n</body>\n</html>\n";
|
||||
//EWOL_DEBUG("plop : " << tmpData);
|
||||
//Log.debug("plop : " << tmpData);
|
||||
printHTML(tmpData);
|
||||
}
|
||||
|
||||
@ -366,7 +366,7 @@ void ewol::compositing::TextBase::printDecorated(const etk::UString& _text) {
|
||||
etk::UString tmpData(U"<html>\n<body>\n");
|
||||
tmpData += _text;
|
||||
tmpData += U"\n</body>\n</html>\n";
|
||||
//EWOL_DEBUG("plop : " << tmpData);
|
||||
//Log.debug("plop : " << tmpData);
|
||||
printHTML(tmpData);
|
||||
}
|
||||
|
||||
@ -379,19 +379,19 @@ void ewol::compositing::TextBase::printHTML(const etk::String& _text) {
|
||||
m_htmlDecoTmp.m_mode = ewol::font::Regular;
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
exml::Element root = doc.nodes["html"];
|
||||
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();
|
||||
return;
|
||||
}
|
||||
exml::Element bodyNode = root.nodes["body"];
|
||||
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;
|
||||
}
|
||||
parseHtmlNode(bodyNode);
|
||||
@ -407,30 +407,30 @@ void ewol::compositing::TextBase::printHTML(const etk::UString& _text) {
|
||||
m_htmlDecoTmp.m_mode = ewol::font::Regular;
|
||||
// TODO : Create an instance of xml parser to manage etk::UString...
|
||||
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;
|
||||
}
|
||||
|
||||
exml::Element root = doc.nodes["html"];
|
||||
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();
|
||||
return;
|
||||
}
|
||||
exml::Element bodyNode = root.nodes["body"];
|
||||
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;
|
||||
}
|
||||
parseHtmlNode(bodyNode);
|
||||
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<> tmpBg(m_colorBg);
|
||||
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...)
|
||||
if (m_needDisplay == true) {
|
||||
if (0 == m_cursorPos) {
|
||||
@ -462,11 +462,11 @@ void ewol::compositing::TextBase::print(const etk::String& _text, const etk::Vec
|
||||
}
|
||||
if( m_needDisplay == true
|
||||
&& m_colorBg.a() != 0) {
|
||||
vec3 pos = m_position;
|
||||
Vector3f pos = m_position;
|
||||
m_vectorialDraw.setPos(pos);
|
||||
printChar(_text[iii]);
|
||||
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++;
|
||||
} else {
|
||||
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 {
|
||||
//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 :
|
||||
if (m_stopTextPos < m_position.x()) {
|
||||
forceLineReturn();
|
||||
@ -509,7 +509,7 @@ void ewol::compositing::TextBase::print(const etk::String& _text, const etk::Vec
|
||||
case alignRight:
|
||||
if (m_needDisplay == true) {
|
||||
// Move the first char at the right :
|
||||
setPos(vec3(m_position.x() + freeSpace,
|
||||
setPos(Vector3f(m_position.x() + freeSpace,
|
||||
m_position.y(),
|
||||
m_position.z()) );
|
||||
}
|
||||
@ -517,7 +517,7 @@ void ewol::compositing::TextBase::print(const etk::String& _text, const etk::Vec
|
||||
case alignCenter:
|
||||
if (m_needDisplay == true) {
|
||||
// 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.z()) );
|
||||
}
|
||||
@ -552,27 +552,27 @@ void ewol::compositing::TextBase::print(const etk::String& _text, const etk::Vec
|
||||
}
|
||||
// special for the justify mode
|
||||
if ((char32_t)_text[iii] == u32char::Space) {
|
||||
//EWOL_DEBUG(" generateString : \" \"");
|
||||
//Log.debug(" generateString : \" \"");
|
||||
if( m_needDisplay == true
|
||||
&& m_colorBg.a() != 0) {
|
||||
m_vectorialDraw.setPos(m_position);
|
||||
}
|
||||
// Must generate a dynamic space :
|
||||
setPos(vec3(m_position.x() + interpolation,
|
||||
setPos(Vector3f(m_position.x() + interpolation,
|
||||
m_position.y(),
|
||||
m_position.z()) );
|
||||
if( m_needDisplay == true
|
||||
&& m_colorBg.a() != 0) {
|
||||
m_vectorialDraw.rectangleWidth(vec3(interpolation,fontHeigh,0.0f) );
|
||||
m_vectorialDraw.rectangleWidth(Vector3f(interpolation,fontHeigh,0.0f) );
|
||||
}
|
||||
} else {
|
||||
//EWOL_DEBUG(" generateString : \"" << (char)text[iii] << "\"");
|
||||
//Log.debug(" generateString : \"" << (char)text[iii] << "\"");
|
||||
if( m_needDisplay == true
|
||||
&& m_colorBg.a() != 0) {
|
||||
vec3 pos = m_position;
|
||||
Vector3f pos = m_position;
|
||||
m_vectorialDraw.setPos(pos);
|
||||
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++;
|
||||
} else {
|
||||
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) {
|
||||
currentId = stop+1;
|
||||
// reset position :
|
||||
setPos(vec3(m_startTextpos,
|
||||
setPos(Vector3f(m_startTextpos,
|
||||
(float)(m_position.y() - getHeight()),
|
||||
m_position.z()) );
|
||||
m_nbCharDisplayed++;
|
||||
} else if((char32_t)_text[stop] == u32char::Return) {
|
||||
currentId = stop+1;
|
||||
// reset position :
|
||||
setPos(vec3(m_startTextpos,
|
||||
setPos(Vector3f(m_startTextpos,
|
||||
(float)(m_position.y() - getHeight()),
|
||||
m_position.z()) );
|
||||
m_nbCharDisplayed++;
|
||||
@ -607,15 +607,15 @@ void ewol::compositing::TextBase::print(const etk::String& _text, const etk::Vec
|
||||
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<> tmpBg(m_colorBg);
|
||||
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...)
|
||||
if (m_needDisplay == true) {
|
||||
if (0 == m_cursorPos) {
|
||||
@ -647,11 +647,11 @@ void ewol::compositing::TextBase::print(const etk::UString& _text, const etk::Ve
|
||||
}
|
||||
if( m_needDisplay == true
|
||||
&& m_colorBg.a() != 0) {
|
||||
vec3 pos = m_position;
|
||||
Vector3f pos = m_position;
|
||||
m_vectorialDraw.setPos(pos);
|
||||
printChar(_text[iii]);
|
||||
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++;
|
||||
} else {
|
||||
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 {
|
||||
//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 :
|
||||
if (m_stopTextPos < m_position.x()) {
|
||||
forceLineReturn();
|
||||
@ -694,7 +694,7 @@ void ewol::compositing::TextBase::print(const etk::UString& _text, const etk::Ve
|
||||
case alignRight:
|
||||
if (m_needDisplay == true) {
|
||||
// Move the first char at the right :
|
||||
setPos(vec3(m_position.x() + freeSpace,
|
||||
setPos(Vector3f(m_position.x() + freeSpace,
|
||||
m_position.y(),
|
||||
m_position.z()) );
|
||||
}
|
||||
@ -702,7 +702,7 @@ void ewol::compositing::TextBase::print(const etk::UString& _text, const etk::Ve
|
||||
case alignCenter:
|
||||
if (m_needDisplay == true) {
|
||||
// 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.z()) );
|
||||
}
|
||||
@ -737,27 +737,27 @@ void ewol::compositing::TextBase::print(const etk::UString& _text, const etk::Ve
|
||||
}
|
||||
// special for the justify mode
|
||||
if ((char32_t)_text[iii] == u32char::Space) {
|
||||
//EWOL_DEBUG(" generateString : \" \"");
|
||||
//Log.debug(" generateString : \" \"");
|
||||
if( m_needDisplay == true
|
||||
&& m_colorBg.a() != 0) {
|
||||
m_vectorialDraw.setPos(m_position);
|
||||
}
|
||||
// Must generate a dynamic space :
|
||||
setPos(vec3(m_position.x() + interpolation,
|
||||
setPos(Vector3f(m_position.x() + interpolation,
|
||||
m_position.y(),
|
||||
m_position.z()) );
|
||||
if( m_needDisplay == true
|
||||
&& m_colorBg.a() != 0) {
|
||||
m_vectorialDraw.rectangleWidth(vec3(interpolation,fontHeigh,0.0f) );
|
||||
m_vectorialDraw.rectangleWidth(Vector3f(interpolation,fontHeigh,0.0f) );
|
||||
}
|
||||
} else {
|
||||
//EWOL_DEBUG(" generateString : \"" << (char)text[iii] << "\"");
|
||||
//Log.debug(" generateString : \"" << (char)text[iii] << "\"");
|
||||
if( m_needDisplay == true
|
||||
&& m_colorBg.a() != 0) {
|
||||
vec3 pos = m_position;
|
||||
Vector3f pos = m_position;
|
||||
m_vectorialDraw.setPos(pos);
|
||||
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++;
|
||||
} else {
|
||||
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) {
|
||||
currentId = stop+1;
|
||||
// reset position :
|
||||
setPos(vec3(m_startTextpos,
|
||||
setPos(Vector3f(m_startTextpos,
|
||||
(float)(m_position.y() - getHeight()),
|
||||
m_position.z()) );
|
||||
m_nbCharDisplayed++;
|
||||
} else if(_text[stop] == u32char::Return) {
|
||||
currentId = stop+1;
|
||||
// reset position :
|
||||
setPos(vec3(m_startTextpos,
|
||||
setPos(Vector3f(m_startTextpos,
|
||||
(float)(m_position.y() - getHeight()),
|
||||
m_position.z()) );
|
||||
m_nbCharDisplayed++;
|
||||
@ -792,7 +792,7 @@ void ewol::compositing::TextBase::print(const etk::UString& _text, const etk::Ve
|
||||
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() {
|
||||
// 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) {
|
||||
@ -810,7 +810,7 @@ void ewol::compositing::TextBase::setTextAlignement(float _startTextpos, float _
|
||||
m_alignement = _alignement;
|
||||
if (m_startTextpos >= m_stopTextPos) {
|
||||
// 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;
|
||||
}
|
||||
|
||||
vec3 ewol::compositing::TextBase::calculateSizeHTML(const etk::String& _text) {
|
||||
Vector3f ewol::compositing::TextBase::calculateSizeHTML(const etk::String& _text) {
|
||||
// remove intermediate result
|
||||
reset();
|
||||
//EWOL_DEBUG(" 0 size for=\n" << text);
|
||||
//Log.debug(" 0 size for=\n" << text);
|
||||
// disable display system
|
||||
m_needDisplay = false;
|
||||
|
||||
setPos(vec3(0,0,0) );
|
||||
setPos(Vector3f(0,0,0) );
|
||||
// same as print without the end display ...
|
||||
printHTML(_text);
|
||||
//EWOL_DEBUG(" 1 Start pos=" << m_sizeDisplayStart);
|
||||
//EWOL_DEBUG(" 1 Stop pos=" << m_sizeDisplayStop);
|
||||
//Log.debug(" 1 Start pos=" << m_sizeDisplayStart);
|
||||
//Log.debug(" 1 Stop pos=" << m_sizeDisplayStop);
|
||||
|
||||
// get the last elements
|
||||
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()) ,
|
||||
0);
|
||||
|
||||
//EWOL_DEBUG(" 2 Start pos=" << m_sizeDisplayStart);
|
||||
//EWOL_DEBUG(" 2 Stop pos=" << m_sizeDisplayStop);
|
||||
//Log.debug(" 2 Start pos=" << m_sizeDisplayStart);
|
||||
//Log.debug(" 2 Stop pos=" << m_sizeDisplayStop);
|
||||
// set back the display system
|
||||
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.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
|
||||
reset();
|
||||
//EWOL_DEBUG(" 0 size for=\n" << text);
|
||||
//Log.debug(" 0 size for=\n" << text);
|
||||
// disable display system
|
||||
m_needDisplay = false;
|
||||
|
||||
setPos(vec3(0,0,0) );
|
||||
setPos(Vector3f(0,0,0) );
|
||||
// same as print without the end display ...
|
||||
printHTML(_text);
|
||||
//EWOL_DEBUG(" 1 Start pos=" << m_sizeDisplayStart);
|
||||
//EWOL_DEBUG(" 1 Stop pos=" << m_sizeDisplayStop);
|
||||
//Log.debug(" 1 Start pos=" << m_sizeDisplayStart);
|
||||
//Log.debug(" 1 Stop pos=" << m_sizeDisplayStop);
|
||||
|
||||
// get the last elements
|
||||
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()) ,
|
||||
0);
|
||||
|
||||
//EWOL_DEBUG(" 2 Start pos=" << m_sizeDisplayStart);
|
||||
//EWOL_DEBUG(" 2 Stop pos=" << m_sizeDisplayStop);
|
||||
//Log.debug(" 2 Start pos=" << m_sizeDisplayStart);
|
||||
//Log.debug(" 2 Stop pos=" << m_sizeDisplayStop);
|
||||
// set back the display system
|
||||
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.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) {
|
||||
return vec3(0,0,0);
|
||||
return Vector3f(0,0,0);
|
||||
}
|
||||
etk::String tmpData("<html><body>\n");
|
||||
tmpData+=_text;
|
||||
tmpData+="\n</body></html>\n";
|
||||
vec3 tmpVal = calculateSizeHTML(tmpData);
|
||||
Vector3f tmpVal = calculateSizeHTML(tmpData);
|
||||
return tmpVal;
|
||||
}
|
||||
|
||||
vec3 ewol::compositing::TextBase::calculateSizeDecorated(const etk::UString& _text) {
|
||||
Vector3f ewol::compositing::TextBase::calculateSizeDecorated(const etk::UString& _text) {
|
||||
if (_text.size() == 0) {
|
||||
return vec3(0,0,0);
|
||||
return Vector3f(0,0,0);
|
||||
}
|
||||
etk::UString tmpData(U"<html><body>\n");
|
||||
tmpData += _text;
|
||||
tmpData += U"\n</body></html>\n";
|
||||
vec3 tmpVal = calculateSizeHTML(tmpData);
|
||||
Vector3f tmpVal = calculateSizeHTML(tmpData);
|
||||
return tmpVal;
|
||||
}
|
||||
|
||||
vec3 ewol::compositing::TextBase::calculateSize(const etk::String& _text) {
|
||||
vec3 outputSize(0, 0, 0);
|
||||
Vector3f ewol::compositing::TextBase::calculateSize(const etk::String& _text) {
|
||||
Vector3f outputSize(0, 0, 0);
|
||||
for(auto element : _text) {
|
||||
vec3 tmpp = calculateSize(element);
|
||||
Vector3f tmpp = calculateSize(element);
|
||||
if (outputSize.y() == 0) {
|
||||
outputSize.setY(tmpp.y());
|
||||
}
|
||||
@ -918,10 +918,10 @@ vec3 ewol::compositing::TextBase::calculateSize(const etk::String& _text) {
|
||||
return outputSize;
|
||||
}
|
||||
|
||||
vec3 ewol::compositing::TextBase::calculateSize(const etk::UString& _text) {
|
||||
vec3 outputSize(0, 0, 0);
|
||||
Vector3f ewol::compositing::TextBase::calculateSize(const etk::UString& _text) {
|
||||
Vector3f outputSize(0, 0, 0);
|
||||
for(auto element : _text) {
|
||||
vec3 tmpp = calculateSize(element);
|
||||
Vector3f tmpp = calculateSize(element);
|
||||
if (outputSize.y() == 0) {
|
||||
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) {
|
||||
int32_t fontHeigh = getHeight();
|
||||
if (true == _isInsertMode) {
|
||||
m_vectorialDraw.rectangleWidth(vec3(_cursorSize, fontHeigh, 0) );
|
||||
m_vectorialDraw.rectangleWidth(Vector3f(_cursorSize, fontHeigh, 0) );
|
||||
} else {
|
||||
m_vectorialDraw.setThickness(2);
|
||||
m_vectorialDraw.lineRel( vec3(0, fontHeigh, 0) );
|
||||
m_vectorialDraw.lineRel( Vector3f(0, fontHeigh, 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++) {
|
||||
vec3 tmpSize = calculateSize(_text[iii]);
|
||||
Vector3f tmpSize = calculateSize(_text[iii]);
|
||||
// check oveflow :
|
||||
if (endPos + tmpSize.x() > stopPosition) {
|
||||
_stop = iii;
|
||||
@ -1028,7 +1028,7 @@ bool ewol::compositing::TextBase::extrapolateLastId(const etk::UString& _text,
|
||||
}
|
||||
|
||||
for (size_t iii=_start; iii<_text.size(); iii++) {
|
||||
vec3 tmpSize = calculateSize(_text[iii]);
|
||||
Vector3f tmpSize = calculateSize(_text[iii]);
|
||||
// check oveflow :
|
||||
if (endPos + tmpSize.x() > stopPosition) {
|
||||
_stop = iii;
|
||||
|
@ -49,12 +49,12 @@ namespace ewol {
|
||||
};
|
||||
protected:
|
||||
int32_t m_nbCharDisplayed; //!< prevent some error in calculation size.
|
||||
vec3 m_sizeDisplayStart; //!< The start windows of the display.
|
||||
vec3 m_sizeDisplayStop; //!< The end windows of the display.
|
||||
Vector3f m_sizeDisplayStart; //!< The start 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.
|
||||
vec3 m_position; //!< The current position to draw
|
||||
vec3 m_clippingPosStart; //!< Clipping start position
|
||||
vec3 m_clippingPosStop; //!< Clipping stop position
|
||||
Vector3f m_position; //!< The current position to draw
|
||||
Vector3f m_clippingPosStart; //!< Clipping start position
|
||||
Vector3f m_clippingPosStop; //!< Clipping stop position
|
||||
bool m_clippingEnable; //!< true if the clipping must be activated
|
||||
protected:
|
||||
etk::Color<float,4> m_defaultColorFg; //!< The text foreground color
|
||||
@ -105,9 +105,9 @@ namespace ewol {
|
||||
*/
|
||||
virtual ~TextBase();
|
||||
public: // Derived function
|
||||
void translate(const vec3& _vect);
|
||||
void rotate(const vec3& _vect, float _angle);
|
||||
void scale(const vec3& _vect);
|
||||
void translate(const Vector3f& _vect);
|
||||
void rotate(const Vector3f& _vect, float _angle);
|
||||
void scale(const Vector3f& _vect);
|
||||
public:
|
||||
/**
|
||||
* @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)
|
||||
* @return the current position.
|
||||
*/
|
||||
const vec3& getPos() {
|
||||
const Vector3f& getPos() {
|
||||
return m_position;
|
||||
};
|
||||
/**
|
||||
* @brief set position for the next text writen
|
||||
* @param[in] _pos Position of the text (in 3D)
|
||||
*/
|
||||
void setPos(const vec3& _pos);
|
||||
void setPos(const Vector3f& _pos);
|
||||
//! @previous
|
||||
inline void setPos(const vec2& _pos) {
|
||||
setPos(vec3(_pos.x(),_pos.y(),0));
|
||||
inline void setPos(const Vector2f& _pos) {
|
||||
setPos(Vector3f(_pos.x(),_pos.y(),0));
|
||||
};
|
||||
/**
|
||||
* @brief set relative position for the next text writen
|
||||
* @param[in] _pos ofset apply of the text (in 3D)
|
||||
*/
|
||||
void setRelPos(const vec3& _pos);
|
||||
void setRelPos(const Vector3f& _pos);
|
||||
//! @previous
|
||||
inline void setRelPos(const vec2& _pos) {
|
||||
setRelPos(vec3(_pos.x(),_pos.y(),0));
|
||||
inline void setRelPos(const Vector2f& _pos) {
|
||||
setRelPos(Vector3f(_pos.x(),_pos.y(),0));
|
||||
};
|
||||
/**
|
||||
* @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] _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);
|
||||
}
|
||||
//! @previous
|
||||
void setClippingWidth(const vec2& _pos, const vec2& _width) {
|
||||
void setClippingWidth(const Vector2f& _pos, const Vector2f& _width) {
|
||||
setClipping(_pos, _pos+_width);
|
||||
};
|
||||
/**
|
||||
@ -201,10 +201,10 @@ namespace ewol {
|
||||
* @param[in] _pos Start 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
|
||||
void setClipping(const vec2& _pos, const vec2& _posEnd) {
|
||||
setClipping(vec3(_pos.x(),_pos.y(),-1), vec3(_posEnd.x(),_posEnd.y(),1) );
|
||||
void setClipping(const Vector2f& _pos, const Vector2f& _posEnd) {
|
||||
setClipping(Vector3f(_pos.x(),_pos.y(),-1), Vector3f(_posEnd.x(),_posEnd.y(),1) );
|
||||
};
|
||||
/**
|
||||
* @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] _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
|
||||
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)
|
||||
* @param[in] _charcode Char that might be dispalyed
|
||||
@ -379,36 +379,36 @@ namespace ewol {
|
||||
* @param[in] _text The string to calculate dimention.
|
||||
* @return The theoric size used.
|
||||
*/
|
||||
vec3 calculateSizeHTML(const etk::String& _text);
|
||||
Vector3f calculateSizeHTML(const etk::String& _text);
|
||||
//! @previous
|
||||
vec3 calculateSizeHTML(const etk::UString& _text);
|
||||
Vector3f calculateSizeHTML(const etk::UString& _text);
|
||||
/**
|
||||
* @brief calculate a theoric text size
|
||||
* @param[in] _text The string to calculate dimention.
|
||||
* @return The theoric size used.
|
||||
*/
|
||||
vec3 calculateSizeDecorated(const etk::String& _text);
|
||||
Vector3f calculateSizeDecorated(const etk::String& _text);
|
||||
//! @previous
|
||||
vec3 calculateSizeDecorated(const etk::UString& _text);
|
||||
Vector3f calculateSizeDecorated(const etk::UString& _text);
|
||||
/**
|
||||
* @brief calculate a theoric text size
|
||||
* @param[in] _text The string to calculate dimention.
|
||||
* @return The theoric size used.
|
||||
*/
|
||||
vec3 calculateSize(const etk::String& _text);
|
||||
Vector3f calculateSize(const etk::String& _text);
|
||||
//! @previous
|
||||
vec3 calculateSize(const etk::UString& _text);
|
||||
Vector3f calculateSize(const etk::UString& _text);
|
||||
/**
|
||||
* @brief calculate a theoric charcode size
|
||||
* @param[in] _charcode The Unicode value to calculate dimention.
|
||||
* @return The theoric size used.
|
||||
*/
|
||||
inline vec3 calculateSize(const char32_t& _charcode) {
|
||||
inline Vector3f calculateSize(const char32_t& _charcode) {
|
||||
return calculateSizeChar(_charcode);
|
||||
};
|
||||
protected:
|
||||
//! @previous
|
||||
virtual vec3 calculateSizeChar(const char32_t& _charcode) = 0;
|
||||
virtual Vector3f calculateSizeChar(const char32_t& _charcode) = 0;
|
||||
public:
|
||||
/**
|
||||
* @brief draw a cursor at the specify position
|
||||
@ -434,7 +434,7 @@ namespace ewol {
|
||||
protected:
|
||||
// this section is reserved for HTML parsing and 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
|
||||
/**
|
||||
* @brief add a line with the current m_htmlDecoTmp decoration
|
||||
|
@ -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());
|
||||
if (m_fontDF != null) {
|
||||
setFontSize(m_fontDF->getSize(minSize));
|
||||
@ -44,7 +44,7 @@ void ewol::compositing::TextDF::drawMT(const mat4& _transformationMatrix, bool _
|
||||
return;
|
||||
}
|
||||
if (m_GLprogram == null) {
|
||||
EWOL_ERROR("No shader ...");
|
||||
Log.error("No shader ...");
|
||||
return;
|
||||
}
|
||||
if (_enableDepthTest == true) {
|
||||
@ -88,7 +88,7 @@ void ewol::compositing::TextDF::drawD(bool _disableDepthTest) {
|
||||
return;
|
||||
}
|
||||
if (m_GLprogram == null) {
|
||||
EWOL_ERROR("No shader ...");
|
||||
Log.error("No shader ...");
|
||||
return;
|
||||
}
|
||||
// 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) {
|
||||
clear();
|
||||
EWOL_VERBOSE("Set font Size: " << _fontSize);
|
||||
Log.verbose("Set font Size: " << _fontSize);
|
||||
if (_fontSize <= 1) {
|
||||
m_size = ewol::getContext().getFontDefault().getSize();
|
||||
} else {
|
||||
@ -152,11 +152,11 @@ void ewol::compositing::TextDF::setFontName(const etk::String& _fontName) {
|
||||
} else {
|
||||
fontName = _fontName;
|
||||
}
|
||||
EWOL_VERBOSE("Set font name: '" << fontName << "'");
|
||||
Log.verbose("Set font name: '" << fontName << "'");
|
||||
// link to new one
|
||||
m_fontDF = ewol::resource::DistanceFieldFont::create(fontName);
|
||||
if (m_fontDF == null) {
|
||||
EWOL_ERROR("Can not get find resource");
|
||||
Log.error("Can not get find resource");
|
||||
m_fontDF = previousFont;
|
||||
}
|
||||
}
|
||||
@ -178,7 +178,7 @@ void ewol::compositing::TextDF::printChar(const char32_t& _charcode) {
|
||||
// get a pointer on the glyph property :
|
||||
ewol::GlyphProperty* myGlyph = getGlyphPointer(_charcode);
|
||||
if (null == myGlyph) {
|
||||
EWOL_ERROR(" font does not really existed ...");
|
||||
Log.error(" font does not really existed ...");
|
||||
return;
|
||||
}
|
||||
float fontSize = getSize();
|
||||
@ -191,7 +191,7 @@ void ewol::compositing::TextDF::printChar(const char32_t& _charcode) {
|
||||
if (true == m_kerning) {
|
||||
kerningOffset = myGlyph->kerningGet(m_previousCharcode);
|
||||
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 == ' ';
|
||||
@ -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 dyD = dyC - myGlyph->m_sizeTexture.y() * factorDisplay;
|
||||
#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 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);
|
||||
@ -235,13 +235,13 @@ void ewol::compositing::TextDF::printChar(const char32_t& _charcode) {
|
||||
float tvC = myGlyph->m_texturePosStart.y();
|
||||
float tvD = tvC + myGlyph->m_texturePosSize.y();
|
||||
/*
|
||||
vec3 drawingPos = m_vectorialDraw.getPos();
|
||||
Vector3f drawingPos = m_vectorialDraw.getPos();
|
||||
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.rectangle(vec2(dxB, dyD));
|
||||
m_vectorialDraw.rectangle(Vector2f(dxB, dyD));
|
||||
|
||||
m_vectorialDraw.setPos(drawingPos);
|
||||
m_vectorialDraw.setColor(backColor);
|
||||
@ -306,7 +306,7 @@ void ewol::compositing::TextDF::printChar(const char32_t& _charcode) {
|
||||
* 3------2
|
||||
*/
|
||||
if (m_needDisplay == true) {
|
||||
vec3 bitmapDrawPos[4];
|
||||
Vector3f bitmapDrawPos[4];
|
||||
bitmapDrawPos[0].setValue(dxA+italicMove, dyC, 0);
|
||||
bitmapDrawPos[1].setValue(dxB+italicMove, dyC, 0);
|
||||
bitmapDrawPos[2].setValue(dxB, dyD, 0);
|
||||
@ -317,7 +317,7 @@ void ewol::compositing::TextDF::printChar(const char32_t& _charcode) {
|
||||
* | |
|
||||
* 3------2
|
||||
*/
|
||||
vec2 texturePos[4];
|
||||
Vector2f texturePos[4];
|
||||
texturePos[0].setValue(tuA+m_mode, tvC);
|
||||
texturePos[1].setValue(tuB+m_mode, tvC);
|
||||
texturePos[2].setValue(tuB+m_mode, tvD);
|
||||
@ -375,9 +375,9 @@ void ewol::compositing::TextDF::printChar(const char32_t& _charcode) {
|
||||
}
|
||||
}
|
||||
// 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);
|
||||
//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
|
||||
m_previousCharcode = _charcode;
|
||||
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 :
|
||||
ewol::GlyphProperty * myGlyph = getGlyphPointer(_charcode);
|
||||
int32_t fontHeigh = getHeight();
|
||||
@ -396,7 +396,7 @@ vec3 ewol::compositing::TextDF::calculateSizeChar(const char32_t& _charcode) {
|
||||
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)(0.0));
|
||||
// Register the previous character
|
||||
|
@ -39,7 +39,7 @@ namespace ewol {
|
||||
* @note special for Distance field mode.
|
||||
* @param[in] _size request dimention.
|
||||
*/
|
||||
void updateSizeToRender(const vec2& _size);
|
||||
void updateSizeToRender(const Vector2f& _size);
|
||||
public:
|
||||
virtual void drawD(bool _disableDepthTest);
|
||||
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 setFontMode(enum ewol::font::mode _mode);
|
||||
virtual void printChar(const char32_t& _charcode);
|
||||
virtual vec3 calculateSizeChar(const char32_t& _charcode);
|
||||
virtual Vector3f calculateSizeChar(const char32_t& _charcode);
|
||||
};
|
||||
}
|
||||
}
|
||||
|
@ -28,16 +28,16 @@ ewol::context::ConfigFont::~ConfigFont() {
|
||||
void ewol::context::ConfigFont::set(const etk::String& _fontName, int32_t _size) {
|
||||
m_name = _fontName;
|
||||
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) {
|
||||
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) {
|
||||
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)");
|
||||
}
|
||||
|
||||
|
@ -37,7 +37,7 @@ ewol::Context& ewol::getContext() {
|
||||
gale::Context& context = gale::getContext();
|
||||
ememory::SharedPtr<gale::Application> appl = context.getApplication();
|
||||
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));
|
||||
@ -66,7 +66,7 @@ void ewol::Context::inputEventUnGrabPointer() {
|
||||
|
||||
|
||||
void ewol::Context::onCreate(gale::Context& _context) {
|
||||
EWOL_INFO(" == > Ewol system create (BEGIN)");
|
||||
Log.info(" == > Ewol system create (BEGIN)");
|
||||
// Add basic ewol translation:
|
||||
etranslate::addPath("ewol", "DATA:///translate/ewol/?lib=ewol");
|
||||
etranslate::autoDetectLanguage();
|
||||
@ -77,11 +77,11 @@ void ewol::Context::onCreate(gale::Context& _context) {
|
||||
for(int32_t iii = 0; iii < _context.getCmd().size() ; ++iii) {
|
||||
if ( _context.getCmd().get(iii) == "-h"
|
||||
|| _context.getCmd().get(iii) == "--help") {
|
||||
EWOL_PRINT("ewol - help : ");
|
||||
EWOL_PRINT(" " << etk::getApplicationName() << " [options]");
|
||||
EWOL_PRINT(" -h/--help: Display this help");
|
||||
EWOL_PRINT(" example:");
|
||||
EWOL_PRINT(" " << etk::getApplicationName() << " --help");
|
||||
Log.print("ewol - help : ");
|
||||
Log.print(" " << etk::getApplicationName() << " [options]");
|
||||
Log.print(" -h/--help: Display this help");
|
||||
Log.print(" example:");
|
||||
Log.print(" " << etk::getApplicationName() << " --help");
|
||||
// this is a global help system does not remove it
|
||||
continue;
|
||||
} else {
|
||||
@ -91,7 +91,7 @@ void ewol::Context::onCreate(gale::Context& _context) {
|
||||
--iii;
|
||||
}
|
||||
|
||||
EWOL_INFO("EWOL v:" << ewol::getVersion());
|
||||
Log.info("EWOL v:" << ewol::getVersion());
|
||||
// force a recalculation
|
||||
/*
|
||||
requestUpdateSize();
|
||||
@ -105,40 +105,40 @@ void ewol::Context::onCreate(gale::Context& _context) {
|
||||
*/
|
||||
ememory::SharedPtr<ewol::context::Application> appl = m_application;
|
||||
if (appl == null) {
|
||||
EWOL_ERROR(" == > Create without application");
|
||||
Log.error(" == > Create without application");
|
||||
return;
|
||||
}
|
||||
appl->onCreate(*this);
|
||||
EWOL_INFO(" == > Ewol system create (END)");
|
||||
Log.info(" == > Ewol system create (END)");
|
||||
}
|
||||
|
||||
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;
|
||||
if (appl == null) {
|
||||
// TODO : Request exit of the application .... with error ...
|
||||
return;
|
||||
}
|
||||
appl->onStart(*this);
|
||||
EWOL_INFO(" == > Ewol system start (END)");
|
||||
Log.info(" == > Ewol system start (END)");
|
||||
}
|
||||
|
||||
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;
|
||||
if (appl == null) {
|
||||
return;
|
||||
}
|
||||
appl->onResume(*this);
|
||||
EWOL_INFO(" == > Ewol system resume (END)");
|
||||
Log.info(" == > Ewol system resume (END)");
|
||||
}
|
||||
|
||||
void ewol::Context::onRegenerateDisplay(gale::Context& _context) {
|
||||
//EWOL_INFO("REGENERATE_DISPLAY");
|
||||
//Log.info("REGENERATE_DISPLAY");
|
||||
// check if the user selected a windows
|
||||
ewol::widget::WindowsShared window = m_windowsCurrent;
|
||||
if (window == null) {
|
||||
EWOL_DEBUG("No windows ...");
|
||||
Log.debug("No windows ...");
|
||||
return;
|
||||
}
|
||||
// Redraw all needed elements
|
||||
@ -150,7 +150,7 @@ void ewol::Context::onRegenerateDisplay(gale::Context& _context) {
|
||||
}
|
||||
|
||||
void ewol::Context::onDraw(gale::Context& _context) {
|
||||
//EWOL_INFO("DRAW");
|
||||
//Log.info("DRAW");
|
||||
// clean internal data...
|
||||
m_objectManager.cleanInternalRemoved();
|
||||
// real draw...
|
||||
@ -162,27 +162,27 @@ void ewol::Context::onDraw(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;
|
||||
if (appl == null) {
|
||||
return;
|
||||
}
|
||||
appl->onPause(*this);
|
||||
EWOL_INFO(" == > Ewol system pause (END)");
|
||||
Log.info(" == > Ewol system pause (END)");
|
||||
}
|
||||
|
||||
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;
|
||||
if (appl == null) {
|
||||
return;
|
||||
}
|
||||
appl->onStop(*this);
|
||||
EWOL_INFO(" == > Ewol system stop (END)");
|
||||
Log.info(" == > Ewol system stop (END)");
|
||||
}
|
||||
|
||||
void ewol::Context::onDestroy(gale::Context& _context) {
|
||||
EWOL_INFO(" == > Ewol system destroy (BEGIN)");
|
||||
Log.info(" == > Ewol system destroy (BEGIN)");
|
||||
// Remove current windows
|
||||
m_windowsCurrent.reset();
|
||||
// clean all widget and sub widget with their resources:
|
||||
@ -195,44 +195,44 @@ void ewol::Context::onDestroy(gale::Context& _context) {
|
||||
}
|
||||
// internal clean elements
|
||||
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();
|
||||
// now All must be removed !!!
|
||||
m_objectManager.unInit();
|
||||
EWOL_INFO(" == > Ewol system destroy (END)");
|
||||
Log.info(" == > Ewol system destroy (END)");
|
||||
}
|
||||
|
||||
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;
|
||||
if (appl == null) {
|
||||
exit(0);
|
||||
return;
|
||||
}
|
||||
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,
|
||||
int32_t _pointerID,
|
||||
const vec2& _pos,
|
||||
const Vector2f& _pos,
|
||||
gale::key::status _state) {
|
||||
switch (_state) {
|
||||
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);
|
||||
break;
|
||||
case gale::key::status::down:
|
||||
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);
|
||||
break;
|
||||
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);
|
||||
break;
|
||||
default:
|
||||
EWOL_DEBUG("Unknow state : " << _state);
|
||||
Log.debug("Unknow state : " << _state);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -240,7 +240,7 @@ void ewol::Context::onKeyboard(const gale::key::Special& _special,
|
||||
enum gale::key::keyboard _type,
|
||||
char32_t _value,
|
||||
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...
|
||||
m_input.setLastKeyboardSpecial(_special);
|
||||
if (m_windowsCurrent == null) {
|
||||
@ -264,7 +264,7 @@ void ewol::Context::onKeyboard(const gale::key::Special& _special,
|
||||
return;
|
||||
}
|
||||
// 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
|
||||
|| ( repeate == true
|
||||
&& tmpWidget->getKeyboardRepeat() == true) ) {
|
||||
@ -294,7 +294,7 @@ void ewol::Context::onKeyboard(const gale::key::Special& _special,
|
||||
tmpWidget->systemEventEntry(tmpEntryEvent);
|
||||
}
|
||||
} 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() {
|
||||
case eSystemMessage::msgResize:
|
||||
//EWOL_DEBUG("Receive MSG : THREAD_RESIZE");
|
||||
//Log.debug("Receive MSG : THREAD_RESIZE");
|
||||
m_windowsSize = data->dimention;
|
||||
ewol::Dimension::setPixelWindowsSize(m_windowsSize);
|
||||
forceRedrawAll();
|
||||
@ -325,7 +325,7 @@ ewol::Context::Context(ewol::context::Application* _application) :
|
||||
m_windowsCurrent(null),
|
||||
m_initStepId(0) {
|
||||
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) {
|
||||
EWOL_INFO("set New windows");
|
||||
Log.info("set New windows");
|
||||
// remove current focus :
|
||||
m_widgetManager.focusSetDefault(null);
|
||||
m_widgetManager.focusRelease();
|
||||
@ -366,8 +366,8 @@ void ewol::Context::setWindows(const ewol::widget::WindowsShared& _windows) {
|
||||
ewol::widget::WindowsShared ewol::Context::getWindows() {
|
||||
return m_windowsCurrent;
|
||||
};
|
||||
void ewol::Context::onResize(const ivec2& _size) {
|
||||
EWOL_VERBOSE("Resize: " << _size);
|
||||
void ewol::Context::onResize(const Vector2i& _size) {
|
||||
Log.verbose("Resize: " << _size);
|
||||
forceRedrawAll();
|
||||
}
|
||||
|
||||
@ -375,8 +375,8 @@ void ewol::Context::forceRedrawAll() {
|
||||
if (m_windowsCurrent == null) {
|
||||
return;
|
||||
}
|
||||
ivec2 size = getSize();
|
||||
m_windowsCurrent->setSize(vec2(size.x(), size.y()));
|
||||
Vector2i size = getSize();
|
||||
m_windowsCurrent->setSize(Vector2f(size.x(), size.y()));
|
||||
m_windowsCurrent->onChangeSize();
|
||||
}
|
||||
|
||||
|
@ -73,7 +73,7 @@ namespace ewol {
|
||||
void onKillDemand(gale::Context& _context) override;
|
||||
void onPointer(enum gale::key::type _type,
|
||||
int32_t _pointerID,
|
||||
const vec2& _pos,
|
||||
const Vector2f& _pos,
|
||||
gale::key::status _state) override;
|
||||
void onKeyboard(const gale::key::Special& _special,
|
||||
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
|
||||
*/
|
||||
void inputEventUnGrabPointer();
|
||||
void onResize(const ivec2& _size) override;
|
||||
void onResize(const Vector2i& _size) override;
|
||||
public:
|
||||
/**
|
||||
* @brief This is the only one things the User might done in his main();
|
||||
|
@ -39,7 +39,7 @@ bool ewol::context::InputManager::localEventInput(enum gale::key::type _type,
|
||||
ewol::WidgetShared _destWidget,
|
||||
int32_t _IdInput,
|
||||
enum gale::key::status _status,
|
||||
vec2 _pos) {
|
||||
Vector2f _pos) {
|
||||
if (_destWidget != null) {
|
||||
if ( _type == gale::key::type::mouse
|
||||
|| _type == gale::key::type::finger) {
|
||||
@ -74,7 +74,7 @@ void ewol::context::InputManager::cleanElement(InputPoperty *_eventTable,
|
||||
if (_eventTable == null) {
|
||||
return;
|
||||
}
|
||||
//EWOL_INFO("CleanElement[" << idInput << "] = @" << (int64_t)eventTable);
|
||||
//Log.info("CleanElement[" << idInput << "] = @" << (int64_t)eventTable);
|
||||
_eventTable[_idInput].isUsed = false;
|
||||
_eventTable[_idInput].destinationInputId = 0;
|
||||
_eventTable[_idInput].lastTimeEvent.reset();
|
||||
@ -127,14 +127,14 @@ void ewol::context::InputManager::grabPointer(ewol::WidgetShared _widget) {
|
||||
m_grabWidget = _widget;
|
||||
/* TODO :
|
||||
m_context.grabPointerEvents(true, _widget->getOrigin()
|
||||
+ ivec2(_widget->getSize().x()/2.0f,
|
||||
+ Vector2i(_widget->getSize().x()/2.0f,
|
||||
_widget->getSize().y()/2.0f) );
|
||||
*/
|
||||
}
|
||||
|
||||
void ewol::context::InputManager::unGrabPointer() {
|
||||
m_grabWidget.reset();
|
||||
// TODO: m_context.grabPointerEvents(false, vec2(0,0));
|
||||
// TODO: m_context.grabPointerEvents(false, Vector2f(0,0));
|
||||
}
|
||||
|
||||
void ewol::context::InputManager::newLayerSet() {
|
||||
@ -151,18 +151,18 @@ ewol::context::InputManager::InputManager(ewol::Context& _context) :
|
||||
m_grabWidget(),
|
||||
m_context(_context) {
|
||||
setDpi(200);
|
||||
EWOL_INFO("Init (start)");
|
||||
Log.info("Init (start)");
|
||||
for(int32_t iii=0; iii<MAX_MANAGE_INPUT; iii++) {
|
||||
// remove the property of this input ...
|
||||
cleanElement(m_eventInputSaved, iii);
|
||||
cleanElement(m_eventMouseSaved, iii);
|
||||
}
|
||||
EWOL_INFO("Init (end)");
|
||||
Log.info("Init (end)");
|
||||
}
|
||||
|
||||
ewol::context::InputManager::~InputManager() {
|
||||
EWOL_INFO("Un-Init (start)");
|
||||
EWOL_INFO("Un-Init (end)");
|
||||
Log.info("Un-Init (start)");
|
||||
Log.info("Un-Init (end)");
|
||||
}
|
||||
|
||||
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 ...
|
||||
void ewol::context::InputManager::motion(enum gale::key::type _type,
|
||||
int _pointerID,
|
||||
vec2 _pos) {
|
||||
Vector2f _pos) {
|
||||
EVENT_DEBUG("motion event : " << _type << " " << _pointerID << " " << _pos);
|
||||
if (MAX_MANAGE_INPUT <= _pointerID) {
|
||||
// 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) {
|
||||
eventTable = m_eventInputSaved;
|
||||
} else {
|
||||
EWOL_ERROR("Unknown type of event");
|
||||
Log.error("Unknown type of event");
|
||||
return;
|
||||
}
|
||||
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,
|
||||
int _pointerID,
|
||||
bool _isDown,
|
||||
vec2 _pos) {
|
||||
Vector2f _pos) {
|
||||
if (_pointerID >= MAX_MANAGE_INPUT) {
|
||||
// reject pointer == > out of IDs...
|
||||
return;
|
||||
@ -334,7 +334,7 @@ void ewol::context::InputManager::state(enum gale::key::type _type,
|
||||
eventTable = m_eventInputSaved;
|
||||
localLimit = m_eventInputLimit;
|
||||
} else {
|
||||
EWOL_ERROR("Unknown type of event");
|
||||
Log.error("Unknown type of event");
|
||||
return;
|
||||
}
|
||||
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();
|
||||
if(eventTable[_pointerID].isUsed == false) {
|
||||
// bad case ... ???
|
||||
EWOL_DEBUG("Up event without previous down ... ");
|
||||
Log.debug("Up event without previous down ... ");
|
||||
// Mark it un-used :
|
||||
eventTable[_pointerID].isUsed = false;
|
||||
// revove the widget ...
|
||||
|
@ -20,10 +20,10 @@ namespace ewol {
|
||||
int32_t destinationInputId;
|
||||
echrono::Clock lastTimeEvent;
|
||||
ewol::WidgetWeak curentWidgetEvent;
|
||||
vec2 origin;
|
||||
vec2 size;
|
||||
vec2 downStart;
|
||||
vec2 posEvent;
|
||||
Vector2f origin;
|
||||
Vector2f size;
|
||||
Vector2f downStart;
|
||||
Vector2f posEvent;
|
||||
bool isDown;
|
||||
bool isInside;
|
||||
int32_t nbClickEvent; // 0 .. 1 .. 2 .. 3
|
||||
@ -65,7 +65,7 @@ namespace ewol {
|
||||
ewol::WidgetShared _destWidget,
|
||||
int32_t _IdInput,
|
||||
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
|
||||
* This function find the next input id unused on the specifiic widget
|
||||
@ -86,8 +86,8 @@ namespace ewol {
|
||||
void setDpi(int32_t _newDPI);
|
||||
|
||||
// note if id<0 == > the it was finger event ...
|
||||
void motion(enum gale::key::type _type, int _pointerID, vec2 _pos );
|
||||
void state(enum gale::key::type _type, int _pointerID, bool _isDown, vec2 _pos);
|
||||
void motion(enum gale::key::type _type, int _pointerID, Vector2f _pos );
|
||||
void state(enum gale::key::type _type, int _pointerID, bool _isDown, Vector2f _pos);
|
||||
public:
|
||||
/**
|
||||
* @brief a new layer on the windows is set == > might remove all the property of the current element ...
|
||||
|
@ -14,13 +14,13 @@ namespace ewol {
|
||||
enum gale::key::type m_type;
|
||||
enum gale::key::status m_status;
|
||||
uint8_t m_inputId;
|
||||
vec2 m_pos;
|
||||
Vector2f m_pos;
|
||||
gale::key::Special m_specialKey; //!< input key status (prevent change in time..)
|
||||
public:
|
||||
Input(enum gale::key::type _type,
|
||||
enum gale::key::status _status,
|
||||
uint8_t _id,
|
||||
const vec2& _pos,
|
||||
const Vector2f& _pos,
|
||||
gale::key::Special _specialKey):
|
||||
m_type(_type),
|
||||
m_status(_status),
|
||||
@ -47,10 +47,10 @@ namespace ewol {
|
||||
inline const uint8_t& getId() const {
|
||||
return m_inputId;
|
||||
};
|
||||
void setPos(const vec2& _pos) {
|
||||
void setPos(const Vector2f& _pos) {
|
||||
m_pos = _pos;
|
||||
};
|
||||
inline const vec2& getPos() const {
|
||||
inline const Vector2f& getPos() const {
|
||||
return m_pos;
|
||||
};
|
||||
void setSpecialKey(const gale::key::Special& _specialKey) {
|
||||
@ -73,7 +73,7 @@ namespace ewol {
|
||||
InputSystem(enum gale::key::type _type,
|
||||
enum gale::key::status _status,
|
||||
uint8_t _id,
|
||||
const vec2& _pos,
|
||||
const Vector2f& _pos,
|
||||
ewol::WidgetShared _dest,
|
||||
int32_t _realIdEvent,
|
||||
gale::key::Special _specialKey) :
|
||||
|
@ -56,24 +56,24 @@ enum ewol::gravity ewol::stringToGravity(const etk::String& _obj) {
|
||||
}
|
||||
return ewol::gravity_center;
|
||||
}
|
||||
vec2 ewol::gravityGenerateDelta(const enum ewol::gravity _gravity, const vec2& _deltas) {
|
||||
vec2 out(0.0f,0.0f);
|
||||
Vector2f ewol::gravityGenerateDelta(const enum ewol::gravity _gravity, const Vector2f& _deltas) {
|
||||
Vector2f out(0.0f,0.0f);
|
||||
if (_deltas.x() > 0.0001f) {
|
||||
if ((uint32_t(_gravity) & uint32_t(ewol::gravity_left)) != 0) {
|
||||
// nothing to do
|
||||
} 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 {
|
||||
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 ((uint32_t(_gravity) & uint32_t(ewol::gravity_buttom)) != 0) {
|
||||
// nothing to do
|
||||
} 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 {
|
||||
out += vec2(0.0f, int32_t(_deltas.y()*0.5f));
|
||||
out += Vector2f(0.0f, int32_t(_deltas.y()*0.5f));
|
||||
}
|
||||
}
|
||||
return out;
|
||||
|
@ -27,5 +27,5 @@ namespace ewol {
|
||||
etk::Stream& operator <<(etk::Stream& _os, const enum ewol::gravity _obj);
|
||||
etk::String gravityToString(const enum ewol::gravity _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);
|
||||
}
|
||||
|
@ -17,7 +17,7 @@ ewol::object::Manager::Manager(ewol::Context& _context) :
|
||||
periodicCall(this, "periodic", "Call every time system render"),
|
||||
m_applWakeUpTime(0),
|
||||
m_lastPeriodicCallTime(0) {
|
||||
EWOL_DEBUG(" == > init Object-Manager");
|
||||
Log.debug(" == > init Object-Manager");
|
||||
periodicCall.setPeriodic(true);
|
||||
// set the basic time properties :
|
||||
m_applWakeUpTime = echrono::Clock::now();
|
||||
@ -29,31 +29,31 @@ ewol::object::Manager::~Manager() {
|
||||
m_workerList.clear();
|
||||
bool hasError = false;
|
||||
if (m_eObjectList.size()!=0) {
|
||||
EWOL_ERROR("Must not have anymore eObject !!!");
|
||||
Log.error("Must not have anymore eObject !!!");
|
||||
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();
|
||||
}
|
||||
|
||||
void ewol::object::Manager::displayListObject() {
|
||||
ethread::RecursiveLock lock(m_mutex);
|
||||
EWOL_INFO("List loaded object : ");
|
||||
Log.info("List loaded object : ");
|
||||
for (auto &it : m_eObjectList) {
|
||||
ewol::ObjectShared element = it.lock();
|
||||
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() {
|
||||
ethread::RecursiveLock lock(m_mutex);
|
||||
EWOL_DEBUG(" == > Un-Init Object-Manager");
|
||||
Log.debug(" == > Un-Init Object-Manager");
|
||||
if (m_workerList.size() > 0) {
|
||||
EWOL_DEBUG(" == > Remove all workers");
|
||||
Log.debug(" == > Remove all workers");
|
||||
m_workerList.clear();
|
||||
}
|
||||
for (auto &it : m_eObjectList) {
|
||||
@ -63,7 +63,7 @@ void ewol::object::Manager::unInit() {
|
||||
}
|
||||
}
|
||||
if (m_eObjectList.size() != 0) {
|
||||
EWOL_ERROR("Have " << m_eObjectList.size() << " active Object");
|
||||
Log.error("Have " << m_eObjectList.size() << " active Object");
|
||||
}
|
||||
m_eObjectList.clear();
|
||||
}
|
||||
@ -71,7 +71,7 @@ void ewol::object::Manager::unInit() {
|
||||
void ewol::object::Manager::add(const ewol::ObjectShared& _object) {
|
||||
ethread::RecursiveLock lock(m_mutex);
|
||||
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);
|
||||
}
|
||||
@ -85,7 +85,7 @@ int32_t ewol::object::Manager::getNumberObject() {
|
||||
void ewol::object::Manager::cleanInternalRemoved() {
|
||||
ethread::RecursiveLock lock(m_mutex);
|
||||
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());
|
||||
while (it != m_eObjectList.end()) {
|
||||
if (it->expired() == true) {
|
||||
@ -95,7 +95,7 @@ void ewol::object::Manager::cleanInternalRemoved() {
|
||||
}
|
||||
}
|
||||
if (m_eObjectList.size() != nbObject) {
|
||||
EWOL_VERBOSE(" remove " << nbObject - m_eObjectList.size() << " deprecated objects");
|
||||
Log.verbose(" remove " << nbObject - m_eObjectList.size() << " deprecated objects");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -20,7 +20,7 @@ namespace ewol {
|
||||
protected:
|
||||
ethread::MutexRecursive m_mutex;
|
||||
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;
|
||||
public:
|
||||
Manager(Context& _context);
|
||||
@ -66,7 +66,7 @@ namespace ewol {
|
||||
*/
|
||||
ewol::ObjectShared getObjectNamed(const etk::String& _name);
|
||||
private:
|
||||
etk::Vector<ewol::ObjectShared> m_workerList;
|
||||
List<ewol::ObjectShared> m_workerList;
|
||||
public:
|
||||
/**
|
||||
* @brief Add a worker on the system list.
|
||||
|
@ -18,11 +18,11 @@ void ewol::Object::autoDestroy() {
|
||||
EWOL_WARNING("try to auto destroy inside a constructor");
|
||||
return;
|
||||
}
|
||||
EWOL_VERBOSE("Destroy object: [" << getId() << "] type:" << getObjectType());
|
||||
Log.verbose("Destroy object: [" << getId() << "] type:" << getObjectType());
|
||||
ewol::ObjectShared parent = m_parent.lock();
|
||||
// TODO : set a signal to do this ...
|
||||
if (parent != null) {
|
||||
EWOL_VERBOSE("Destroy object: Call parrent");
|
||||
Log.verbose("Destroy object: Call parrent");
|
||||
parent->requestDestroyFromChild(sharedFromThis());
|
||||
}
|
||||
//if no parent ==> noting to do ...
|
||||
@ -34,8 +34,8 @@ bool ewol::Object::objectHasBeenCorectlyInit() {
|
||||
}
|
||||
|
||||
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 ...");
|
||||
EWOL_CRITICAL("Call From Child with no effects ==> must implement : requestDestroyFromChild(...)");
|
||||
Log.info("requestDestroyFromChild(...) is called when an object reference as a parent have a child that request quto-destroy ...");
|
||||
Log.critical("Call From Child with no effects ==> must implement : requestDestroyFromChild(...)");
|
||||
}
|
||||
|
||||
void ewol::Object::destroy() {
|
||||
@ -63,11 +63,11 @@ ewol::Object::Object() :
|
||||
m_isResource(false) {
|
||||
// note this is nearly atomic ... (but it is enough)
|
||||
m_uniqueId = m_valUID++;
|
||||
EWOL_DEBUG("new Object : [" << m_uniqueId << "]");
|
||||
Log.debug("new Object : [" << m_uniqueId << "]");
|
||||
}
|
||||
|
||||
ewol::Object::~Object() {
|
||||
EWOL_DEBUG("delete Object : [" << m_uniqueId << "] : " << getTypeDescription());
|
||||
Log.debug("delete Object : [" << m_uniqueId << "] : " << getTypeDescription());
|
||||
m_uniqueId = -1;
|
||||
}
|
||||
|
||||
@ -87,7 +87,7 @@ const char * const ewol::Object::getObjectType() const {
|
||||
|
||||
void ewol::Object::addObjectType(const char* _type) {
|
||||
if (_type == null) {
|
||||
EWOL_ERROR(" try to add a type with no value...");
|
||||
Log.error(" try to add a type with no value...");
|
||||
return;
|
||||
}
|
||||
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_VERBOSE("check if name : " << _objectName << " ?= " << propertyName.get());
|
||||
Log.verbose("check if name : " << _objectName << " ?= " << propertyName.get());
|
||||
if (_objectName == propertyName.get()) {
|
||||
return sharedFromThis();
|
||||
}
|
||||
|
@ -38,17 +38,17 @@ template<class TYPE_OBJECT, class TYPE_VAL, class ... TYPE> static void baseInit
|
||||
eproperty::Property* prop(null);
|
||||
eproperty::PropertyType<TYPE_VAL>* propType(null);
|
||||
if (_object == null) {
|
||||
EWOL_ERROR("EMPTY pointer");
|
||||
Log.error("EMPTY pointer");
|
||||
return;
|
||||
}
|
||||
prop = _object->properties.getRaw(_name);
|
||||
if (prop == null) {
|
||||
EWOL_ERROR("property does not exit ... '" << _name << "'");
|
||||
Log.error("property does not exit ... '" << _name << "'");
|
||||
goto exit_on_error;
|
||||
}
|
||||
propType = dynamic_cast<eproperty::PropertyType<TYPE_VAL>*>(prop);
|
||||
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;
|
||||
}
|
||||
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) { \
|
||||
ememory::SharedPtr<className> object(ETK_NEW(className)); \
|
||||
if (object == null) { \
|
||||
EWOL_ERROR("Factory error"); \
|
||||
Log.error("Factory error"); \
|
||||
return null; \
|
||||
} \
|
||||
baseInit(object, _all... ); \
|
||||
object->init(); \
|
||||
if (object->objectHasBeenCorectlyInit() == false) { \
|
||||
EWOL_CRITICAL("Object Is not correctly init : " << #className ); \
|
||||
Log.critical("Object Is not correctly init : " << #className ); \
|
||||
} \
|
||||
return object; \
|
||||
} \
|
||||
static ememory::SharedPtr<className> createXml(const exml::Element& _node) { \
|
||||
ememory::SharedPtr<className> object(ETK_NEW(className)); \
|
||||
if (object == null) { \
|
||||
EWOL_ERROR("Factory error"); \
|
||||
Log.error("Factory error"); \
|
||||
return null; \
|
||||
} \
|
||||
object->loadXMLAttributes(_node); \
|
||||
object->init(); \
|
||||
if (object->objectHasBeenCorectlyInit() == false) { \
|
||||
EWOL_CRITICAL("Object Is not correctly init : " << #className ); \
|
||||
Log.critical("Object Is not correctly init : " << #className ); \
|
||||
} \
|
||||
return object; \
|
||||
}
|
||||
@ -95,7 +95,7 @@ exit_on_error:
|
||||
if (object2 != null) { \
|
||||
object = ememory::dynamicPointerCast<className>(object2); \
|
||||
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; \
|
||||
} \
|
||||
} \
|
||||
@ -104,13 +104,13 @@ exit_on_error:
|
||||
} \
|
||||
object = ememory::SharedPtr<className>(ETK_NEW(className)); \
|
||||
if (object == null) { \
|
||||
EWOL_ERROR("Factory error"); \
|
||||
Log.error("Factory error"); \
|
||||
return null; \
|
||||
} \
|
||||
baseInit(object, "name", etk::String(uniqueName), _all... ); \
|
||||
object->init(); \
|
||||
if (object->objectHasBeenCorectlyInit() == false) { \
|
||||
EWOL_CRITICAL("Object Is not correctly init : " << #className ); \
|
||||
Log.critical("Object Is not correctly init : " << #className ); \
|
||||
} \
|
||||
return object; \
|
||||
}
|
||||
@ -186,7 +186,7 @@ namespace ewol {
|
||||
*/
|
||||
virtual void removeParent();
|
||||
private:
|
||||
etk::Vector<const char*> m_listType;
|
||||
List<const char*> m_listType;
|
||||
public:
|
||||
/**
|
||||
* @brief get the current Object type of the Object
|
||||
@ -306,7 +306,7 @@ namespace ewol {
|
||||
if (myObject != null) { \
|
||||
myObject->_event.connect(_shared_ptr, _func, ##__VA_ARGS__); \
|
||||
} 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)
|
||||
};
|
||||
@ -321,7 +321,7 @@ namespace ewol {
|
||||
if (myObject != null) { \
|
||||
myObject->_event.connect(_obj, _func, ##__VA_ARGS__); \
|
||||
} 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)
|
||||
|
||||
@ -333,7 +333,7 @@ namespace ewol {
|
||||
if (myObject != null) { \
|
||||
myObject->_event.connect(_obj, _func, ##__VA_ARGS__); \
|
||||
} 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)
|
||||
|
||||
|
@ -22,9 +22,9 @@ ewol::resource::ColorFile::ColorFile() :
|
||||
void ewol::resource::ColorFile::init(const etk::Uri& _uri) {
|
||||
ethread::RecursiveLock lock(m_mutex);
|
||||
gale::Resource::init(_uri.get());
|
||||
EWOL_DEBUG("CF : load \"" << _uri << "\"");
|
||||
Log.debug("CF : load \"" << _uri << "\"");
|
||||
reload();
|
||||
EWOL_DEBUG("List of all color : " << m_list.getKeys());
|
||||
Log.debug("List of all color : " << m_list.getKeys());
|
||||
}
|
||||
|
||||
ewol::resource::ColorFile::~ColorFile() {
|
||||
@ -42,12 +42,12 @@ void ewol::resource::ColorFile::reload() {
|
||||
// open and read all json elements:
|
||||
ejson::Document doc;
|
||||
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;
|
||||
}
|
||||
ejson::Array baseArray = doc["color"].toArray();
|
||||
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();
|
||||
return;
|
||||
}
|
||||
@ -55,22 +55,22 @@ void ewol::resource::ColorFile::reload() {
|
||||
for (const auto it : baseArray) {
|
||||
ejson::Object tmpObj = it.toObject();
|
||||
if (tmpObj.exist() == false) {
|
||||
EWOL_ERROR(" can not get object in 'color' : " << it);
|
||||
Log.error(" can not get object in 'color' : " << it);
|
||||
findError = true;
|
||||
continue;
|
||||
}
|
||||
etk::String name = tmpObj["name"].toString().get();
|
||||
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) {
|
||||
EWOL_ERROR("Drop an empty name");
|
||||
Log.error("Drop an empty name");
|
||||
findError = true;
|
||||
continue;
|
||||
}
|
||||
m_list.add(name, etk::Color<float>(color));
|
||||
}
|
||||
if (findError == true) {
|
||||
EWOL_ERROR("pb in parsing file:" << m_name);
|
||||
Log.error("pb in parsing file:" << m_name);
|
||||
doc.display();
|
||||
}
|
||||
}
|
||||
|
@ -62,7 +62,7 @@ namespace ewol {
|
||||
* @brief Get All color name
|
||||
* @return list of all color existing
|
||||
*/
|
||||
etk::Vector<etk::String> getColors() const {
|
||||
List<etk::String> getColors() const {
|
||||
return m_list.getKeys();
|
||||
}
|
||||
public: // herited function:
|
||||
|
@ -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,
|
||||
bool _updateDepthBuffer,
|
||||
bool _depthtest) {
|
||||
@ -45,7 +45,7 @@ void ewol::resource::Colored3DObject::draw(const etk::Vector<vec3>& _vertices,
|
||||
return;
|
||||
}
|
||||
if (m_GLprogram == null) {
|
||||
EWOL_ERROR("No shader ...");
|
||||
Log.error("No shader ...");
|
||||
return;
|
||||
}
|
||||
if (true == _depthtest) {
|
||||
@ -54,7 +54,7 @@ void ewol::resource::Colored3DObject::draw(const etk::Vector<vec3>& _vertices,
|
||||
glDepthMask(GL_FALSE);
|
||||
}
|
||||
}
|
||||
//EWOL_DEBUG(" display " << m_coord.size() << " elements" );
|
||||
//Log.debug(" display " << m_coord.size() << " elements" );
|
||||
m_GLprogram->use();
|
||||
// set Matrix: translation/positionMatrix
|
||||
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,
|
||||
mat4& _transformationMatrix,
|
||||
bool _updateDepthBuffer,
|
||||
@ -88,7 +88,7 @@ void ewol::resource::Colored3DObject::draw(const etk::Vector<vec3>& _vertices,
|
||||
return;
|
||||
}
|
||||
if (m_GLprogram == null) {
|
||||
EWOL_ERROR("No shader ...");
|
||||
Log.error("No shader ...");
|
||||
return;
|
||||
}
|
||||
if (true == _depthtest) {
|
||||
@ -97,7 +97,7 @@ void ewol::resource::Colored3DObject::draw(const etk::Vector<vec3>& _vertices,
|
||||
glDepthMask(GL_FALSE);
|
||||
}
|
||||
}
|
||||
//EWOL_DEBUG(" display " << m_coord.size() << " elements" );
|
||||
//Log.debug(" display " << m_coord.size() << " elements" );
|
||||
m_GLprogram->use();
|
||||
// set Matrix: translation/positionMatrix
|
||||
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,
|
||||
mat4& _transformationMatrix,
|
||||
bool _updateDepthBuffer,
|
||||
@ -128,7 +128,7 @@ void ewol::resource::Colored3DObject::drawLine(etk::Vector<vec3>& _vertices,
|
||||
return;
|
||||
}
|
||||
if (m_GLprogram == null) {
|
||||
EWOL_ERROR("No shader ...");
|
||||
Log.error("No shader ...");
|
||||
return;
|
||||
}
|
||||
if (true == _depthtest) {
|
||||
@ -137,7 +137,7 @@ void ewol::resource::Colored3DObject::drawLine(etk::Vector<vec3>& _vertices,
|
||||
glDepthMask(GL_FALSE);
|
||||
}
|
||||
}
|
||||
//EWOL_DEBUG(" display " << m_coord.size() << " elements" );
|
||||
//Log.debug(" display " << m_coord.size() << " elements" );
|
||||
m_GLprogram->use();
|
||||
// set Matrix: translation/positionMatrix
|
||||
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,
|
||||
const vec3& _max,
|
||||
void ewol::resource::Colored3DObject::drawCubeLine(const Vector3f& _min,
|
||||
const Vector3f& _max,
|
||||
const etk::Color<float>& _color,
|
||||
mat4& _transformationMatrix,
|
||||
bool _updateDepthBuffer,
|
||||
bool _depthtest) {
|
||||
etk::Vector<vec3> vertices;
|
||||
vertices.pushBack(vec3(_min.x(), _min.y(),_min.z()));
|
||||
vertices.pushBack(vec3(_max.x(), _min.y(),_min.z()));
|
||||
List<Vector3f> vertices;
|
||||
vertices.pushBack(Vector3f(_min.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(vec3(_max.x(), _min.y(),_max.z()));
|
||||
vertices.pushBack(Vector3f(_max.x(), _min.y(),_min.z()));
|
||||
vertices.pushBack(Vector3f(_max.x(), _min.y(),_max.z()));
|
||||
|
||||
vertices.pushBack(vec3(_max.x(), _min.y(),_max.z()));
|
||||
vertices.pushBack(vec3(_min.x(), _min.y(),_max.z()));
|
||||
vertices.pushBack(Vector3f(_max.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(vec3(_min.x(), _min.y(),_min.z()));
|
||||
vertices.pushBack(Vector3f(_min.x(), _min.y(),_max.z()));
|
||||
vertices.pushBack(Vector3f(_min.x(), _min.y(),_min.z()));
|
||||
|
||||
|
||||
vertices.pushBack(vec3(_min.x(), _max.y(),_min.z()));
|
||||
vertices.pushBack(vec3(_max.x(), _max.y(),_min.z()));
|
||||
vertices.pushBack(Vector3f(_min.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(vec3(_max.x(), _max.y(),_max.z()));
|
||||
vertices.pushBack(Vector3f(_max.x(), _max.y(),_min.z()));
|
||||
vertices.pushBack(Vector3f(_max.x(), _max.y(),_max.z()));
|
||||
|
||||
vertices.pushBack(vec3(_max.x(), _max.y(),_max.z()));
|
||||
vertices.pushBack(vec3(_min.x(), _max.y(),_max.z()));
|
||||
vertices.pushBack(Vector3f(_max.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(vec3(_min.x(), _max.y(),_min.z()));
|
||||
vertices.pushBack(Vector3f(_min.x(), _max.y(),_max.z()));
|
||||
vertices.pushBack(Vector3f(_min.x(), _max.y(),_min.z()));
|
||||
|
||||
|
||||
vertices.pushBack(vec3(_min.x(), _min.y(),_min.z()));
|
||||
vertices.pushBack(vec3(_min.x(), _max.y(),_min.z()));
|
||||
vertices.pushBack(Vector3f(_min.x(), _min.y(),_min.z()));
|
||||
vertices.pushBack(Vector3f(_min.x(), _max.y(),_min.z()));
|
||||
|
||||
vertices.pushBack(vec3(_max.x(), _min.y(),_min.z()));
|
||||
vertices.pushBack(vec3(_max.x(), _max.y(),_min.z()));
|
||||
vertices.pushBack(Vector3f(_max.x(), _min.y(),_min.z()));
|
||||
vertices.pushBack(Vector3f(_max.x(), _max.y(),_min.z()));
|
||||
|
||||
vertices.pushBack(vec3(_max.x(), _min.y(),_max.z()));
|
||||
vertices.pushBack(vec3(_max.x(), _max.y(),_max.z()));
|
||||
vertices.pushBack(Vector3f(_max.x(), _min.y(),_max.z()));
|
||||
vertices.pushBack(Vector3f(_max.x(), _max.y(),_max.z()));
|
||||
|
||||
vertices.pushBack(vec3(_min.x(), _min.y(),_max.z()));
|
||||
vertices.pushBack(vec3(_min.x(), _max.y(),_max.z()));
|
||||
vertices.pushBack(Vector3f(_min.x(), _min.y(),_max.z()));
|
||||
vertices.pushBack(Vector3f(_min.x(), _max.y(),_max.z()));
|
||||
|
||||
drawLine(vertices, _color, _transformationMatrix, _updateDepthBuffer, _depthtest);
|
||||
}
|
||||
|
||||
void ewol::resource::Colored3DObject::drawSquare(const vec3& _size,
|
||||
void ewol::resource::Colored3DObject::drawSquare(const Vector3f& _size,
|
||||
mat4& _transformationMatrix,
|
||||
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,
|
||||
6,0,2, 5,1,4, 4,1,0,
|
||||
7,3,1, 7,1,5, 5,4,7,
|
||||
7,4,6, 7,2,3, 7,6,2};
|
||||
vec3 vertices[8]={ vec3(_size[0],_size[1],_size[2]),
|
||||
vec3(-_size[0],_size[1],_size[2]),
|
||||
vec3(_size[0],-_size[1],_size[2]),
|
||||
vec3(-_size[0],-_size[1],_size[2]),
|
||||
vec3(_size[0],_size[1],-_size[2]),
|
||||
vec3(-_size[0],_size[1],-_size[2]),
|
||||
vec3(_size[0],-_size[1],-_size[2]),
|
||||
vec3(-_size[0],-_size[1],-_size[2])};
|
||||
Vector3f vertices[8]={ Vector3f(_size[0],_size[1],_size[2]),
|
||||
Vector3f(-_size[0],_size[1],_size[2]),
|
||||
Vector3f(_size[0],-_size[1],_size[2]),
|
||||
Vector3f(-_size[0],-_size[1],_size[2]),
|
||||
Vector3f(_size[0],_size[1],-_size[2]),
|
||||
Vector3f(-_size[0],_size[1],-_size[2]),
|
||||
Vector3f(_size[0],-_size[1],-_size[2]),
|
||||
Vector3f(-_size[0],-_size[1],-_size[2])};
|
||||
tmpVertices.clear();
|
||||
for (int32_t iii=0 ; iii<36 ; iii+=3) {
|
||||
// normal calculation :
|
||||
@ -241,7 +241,7 @@ void ewol::resource::Colored3DObject::drawSphere(float _radius,
|
||||
int _longs,
|
||||
mat4& _transformationMatrix,
|
||||
const etk::Color<float>& _tmpColor) {
|
||||
etk::Vector<vec3> tmpVertices;
|
||||
List<Vector3f> tmpVertices;
|
||||
for(int32_t iii=0; iii<=_lats; ++iii) {
|
||||
float lat0 = M_PI * (-0.5f + float(iii - 1) / _lats);
|
||||
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 x = cos(lng);
|
||||
float y = sin(lng);
|
||||
vec3 v1 = vec3(x * zr1, y * zr1, z1);
|
||||
vec3 v4 = vec3(x * zr0, y * zr0, z0);
|
||||
Vector3f v1 = Vector3f(x * zr1, y * zr1, z1);
|
||||
Vector3f v4 = Vector3f(x * zr0, y * zr0, z0);
|
||||
|
||||
lng = 2 * M_PI * float(jjj) / _longs;
|
||||
x = cos(lng);
|
||||
y = sin(lng);
|
||||
vec3 v2 = vec3(x * zr1, y * zr1, z1);
|
||||
vec3 v3 = vec3(x * zr0, y * zr0, z0);
|
||||
Vector3f v2 = Vector3f(x * zr1, y * zr1, z1);
|
||||
Vector3f v3 = Vector3f(x * zr0, y * zr0, z0);
|
||||
|
||||
tmpVertices.pushBack(v1);
|
||||
tmpVertices.pushBack(v2);
|
||||
@ -281,7 +281,7 @@ void ewol::resource::Colored3DObject::drawCylinder(float _radius,
|
||||
int _longs,
|
||||
mat4& _transformationMatrix,
|
||||
const etk::Color<float>& _tmpColor) {
|
||||
etk::Vector<vec3> tmpVertices;
|
||||
List<Vector3f> tmpVertices;
|
||||
// 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 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 y = sin(lng)*_radius;
|
||||
vec3 v2 = vec3(x, y, z);
|
||||
Vector3f v2 = Vector3f(x, y, z);
|
||||
|
||||
lng = 2.0f * M_PI * float(jjj) / _longs;
|
||||
x = cos(lng)*_radius;
|
||||
y = sin(lng)*_radius;
|
||||
vec3 v3 = vec3(x, y, z);
|
||||
Vector3f v3 = Vector3f(x, y, z);
|
||||
tmpVertices.pushBack(v1);
|
||||
tmpVertices.pushBack(v3);
|
||||
tmpVertices.pushBack(v2);
|
||||
@ -311,14 +311,14 @@ void ewol::resource::Colored3DObject::drawCylinder(float _radius,
|
||||
|
||||
float x = cos(lng)*_radius;
|
||||
float y = sin(lng)*_radius;
|
||||
vec3 v2 = vec3(x, y, z);
|
||||
vec3 v2b = vec3(x, y, -z);
|
||||
Vector3f v2 = Vector3f(x, y, z);
|
||||
Vector3f v2b = Vector3f(x, y, -z);
|
||||
|
||||
lng = 2.0f * M_PI * float(jjj) / _longs;
|
||||
x = cos(lng)*_radius;
|
||||
y = sin(lng)*_radius;
|
||||
vec3 v3 = vec3(x, y, z);
|
||||
vec3 v3b = vec3(x, y, -z);
|
||||
Vector3f v3 = Vector3f(x, y, z);
|
||||
Vector3f v3b = Vector3f(x, y, -z);
|
||||
|
||||
tmpVertices.pushBack(v2);
|
||||
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 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 y = sin(lng)*_radius;
|
||||
vec3 v2 = vec3(x, y, z);
|
||||
Vector3f v2 = Vector3f(x, y, z);
|
||||
|
||||
lng = 2.0f * M_PI * float(jjj) / _longs;
|
||||
x = cos(lng)*_radius;
|
||||
y = sin(lng)*_radius;
|
||||
vec3 v3 = vec3(x, y, z);
|
||||
Vector3f v3 = Vector3f(x, y, z);
|
||||
tmpVertices.pushBack(v1);
|
||||
tmpVertices.pushBack(v2);
|
||||
tmpVertices.pushBack(v3);
|
||||
@ -355,7 +355,7 @@ void ewol::resource::Colored3DObject::drawCapsule(float _radius,
|
||||
int _longs,
|
||||
mat4& _transformationMatrix,
|
||||
const etk::Color<float>& _tmpColor) {
|
||||
etk::Vector<vec3> tmpVertices;
|
||||
List<Vector3f> tmpVertices;
|
||||
_lats = int32_t(_lats / 2)*2;
|
||||
|
||||
// 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 x = cos(lng);
|
||||
float y = sin(lng);
|
||||
vec3 v1 = vec3(x * zr1, y * zr1, z1+offset);
|
||||
vec3 v4 = vec3(x * zr0, y * zr0, z0+offset);
|
||||
Vector3f v1 = Vector3f(x * zr1, y * zr1, z1+offset);
|
||||
Vector3f v4 = Vector3f(x * zr0, y * zr0, z0+offset);
|
||||
|
||||
lng = 2 * M_PI * float(jjj) / _longs;
|
||||
x = cos(lng);
|
||||
y = sin(lng);
|
||||
vec3 v2 = vec3(x * zr1, y * zr1, z1+offset);
|
||||
vec3 v3 = vec3(x * zr0, y * zr0, z0+offset);
|
||||
Vector3f v2 = Vector3f(x * zr1, y * zr1, z1+offset);
|
||||
Vector3f v3 = Vector3f(x * zr0, y * zr0, z0+offset);
|
||||
tmpVertices.pushBack(v1);
|
||||
tmpVertices.pushBack(v2);
|
||||
tmpVertices.pushBack(v3);
|
||||
@ -398,14 +398,14 @@ void ewol::resource::Colored3DObject::drawCapsule(float _radius,
|
||||
|
||||
float x = cos(lng)*_radius;
|
||||
float y = sin(lng)*_radius;
|
||||
vec3 v2 = vec3(x, y, z);
|
||||
vec3 v2b = vec3(x, y, -z);
|
||||
Vector3f v2 = Vector3f(x, y, z);
|
||||
Vector3f v2b = Vector3f(x, y, -z);
|
||||
|
||||
lng = 2.0f * M_PI * float(jjj) / _longs;
|
||||
x = cos(lng)*_radius;
|
||||
y = sin(lng)*_radius;
|
||||
vec3 v3 = vec3(x, y, z);
|
||||
vec3 v3b = vec3(x, y, -z);
|
||||
Vector3f v3 = Vector3f(x, y, z);
|
||||
Vector3f v3b = Vector3f(x, y, -z);
|
||||
|
||||
tmpVertices.pushBack(v2);
|
||||
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 x = cos(lng);
|
||||
float y = sin(lng);
|
||||
vec3 v1 = vec3(x * zr1, y * zr1, z1+offset);
|
||||
vec3 v4 = vec3(x * zr0, y * zr0, z0+offset);
|
||||
Vector3f v1 = Vector3f(x * zr1, y * zr1, z1+offset);
|
||||
Vector3f v4 = Vector3f(x * zr0, y * zr0, z0+offset);
|
||||
|
||||
lng = 2 * M_PI * float(jjj) / _longs;
|
||||
x = cos(lng);
|
||||
y = sin(lng);
|
||||
vec3 v2 = vec3(x * zr1, y * zr1, z1+offset);
|
||||
vec3 v3 = vec3(x * zr0, y * zr0, z0+offset);
|
||||
Vector3f v2 = Vector3f(x * zr1, y * zr1, z1+offset);
|
||||
Vector3f v3 = Vector3f(x * zr0, y * zr0, z0+offset);
|
||||
tmpVertices.pushBack(v1);
|
||||
tmpVertices.pushBack(v2);
|
||||
tmpVertices.pushBack(v3);
|
||||
@ -456,20 +456,20 @@ void ewol::resource::Colored3DObject::drawCone(float _radius,
|
||||
int _longs,
|
||||
mat4& _transformationMatrix,
|
||||
const etk::Color<float>& _tmpColor) {
|
||||
etk::Vector<vec3> tmpVertices;
|
||||
List<Vector3f> tmpVertices;
|
||||
// center to border (TOP)
|
||||
for(int32_t jjj=0; jjj<_longs; ++jjj) {
|
||||
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 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;
|
||||
x = cos(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(v3);
|
||||
tmpVertices.pushBack(v2);
|
||||
@ -478,16 +478,16 @@ void ewol::resource::Colored3DObject::drawCone(float _radius,
|
||||
for(int32_t jjj=0; jjj<_longs; ++jjj) {
|
||||
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 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;
|
||||
x = cos(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(v2);
|
||||
tmpVertices.pushBack(v3);
|
||||
@ -495,20 +495,20 @@ void ewol::resource::Colored3DObject::drawCone(float _radius,
|
||||
draw(tmpVertices, _tmpColor, _transformationMatrix);
|
||||
}
|
||||
|
||||
void ewol::resource::Colored3DObject::drawTriangles(const etk::Vector<vec3>& _vertex,
|
||||
const etk::Vector<uint32_t>& _indice,
|
||||
void ewol::resource::Colored3DObject::drawTriangles(const List<Vector3f>& _vertex,
|
||||
const List<uint32_t>& _indice,
|
||||
mat4& _transformationMatrix,
|
||||
const etk::Color<float>& _tmpColor,
|
||||
const vec3& _offset) {
|
||||
etk::Vector<vec3> tmpVertices;
|
||||
const Vector3f& _offset) {
|
||||
List<Vector3f> tmpVertices;
|
||||
for (size_t iii=0; iii<_indice.size()/3; ++iii) {
|
||||
tmpVertices.pushBack(_vertex[_indice[iii*3 + 0]]+_offset);
|
||||
tmpVertices.pushBack(_vertex[_indice[iii*3 + 1]]+_offset);
|
||||
tmpVertices.pushBack(_vertex[_indice[iii*3 + 2]]+_offset);
|
||||
//EWOL_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(" indices " << _indice[iii*3 + 0] << " " << _indice[iii*3 + 1] << " " << _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);
|
||||
}
|
||||
|
||||
|
@ -30,28 +30,28 @@ namespace ewol {
|
||||
DECLARE_RESOURCE_FACTORY(Colored3DObject);
|
||||
virtual ~Colored3DObject();
|
||||
public:
|
||||
virtual void draw(const etk::Vector<vec3>& _vertices,
|
||||
virtual void draw(const List<Vector3f>& _vertices,
|
||||
const etk::Color<float>& _color,
|
||||
bool _updateDepthBuffer=true,
|
||||
bool _depthtest=true);
|
||||
virtual void draw(const etk::Vector<vec3>& _vertices,
|
||||
virtual void draw(const List<Vector3f>& _vertices,
|
||||
const etk::Color<float>& _color,
|
||||
mat4& _transformationMatrix,
|
||||
bool _updateDepthBuffer=true,
|
||||
bool _depthtest=true);
|
||||
virtual void drawLine(etk::Vector<vec3>& _vertices,
|
||||
virtual void drawLine(List<Vector3f>& _vertices,
|
||||
const etk::Color<float>& _color,
|
||||
mat4& _transformationMatrix,
|
||||
bool _updateDepthBuffer=true,
|
||||
bool _depthtest=true);
|
||||
virtual void drawCubeLine(const vec3& _min,
|
||||
const vec3& _max,
|
||||
virtual void drawCubeLine(const Vector3f& _min,
|
||||
const Vector3f& _max,
|
||||
const etk::Color<float>& _color,
|
||||
mat4& _transformationMatrix,
|
||||
bool _updateDepthBuffer=true,
|
||||
bool _depthtest=true);
|
||||
public:
|
||||
void drawSquare(const vec3& _size,
|
||||
void drawSquare(const Vector3f& _size,
|
||||
mat4& _transformationMatrix,
|
||||
const etk::Color<float>& _tmpColor);
|
||||
void drawSphere(float _radius,
|
||||
@ -77,11 +77,11 @@ namespace ewol {
|
||||
int _longs,
|
||||
mat4& _transformationMatrix,
|
||||
const etk::Color<float>& _tmpColor);
|
||||
void drawTriangles(const etk::Vector<vec3>& _vertex,
|
||||
const etk::Vector<uint32_t>& _indice,
|
||||
void drawTriangles(const List<Vector3f>& _vertex,
|
||||
const List<uint32_t>& _indice,
|
||||
mat4& _transformationMatrix,
|
||||
const etk::Color<float>& _tmpColor,
|
||||
const vec3& _offset=vec3(0,0,0.1));
|
||||
const Vector3f& _offset=Vector3f(0,0,0.1));
|
||||
};
|
||||
};
|
||||
};
|
||||
|
@ -24,7 +24,7 @@ ewol::resource::ConfigFile::ConfigFile() :
|
||||
void ewol::resource::ConfigFile::init(const etk::Uri& _uri) {
|
||||
ethread::RecursiveLock lock(m_mutex);
|
||||
gale::Resource::init(_uri.get());
|
||||
EWOL_DEBUG("SFP : load \"" << _uri << "\"");
|
||||
Log.debug("SFP : load \"" << _uri << "\"");
|
||||
reload();
|
||||
}
|
||||
|
||||
|
@ -43,8 +43,8 @@ ewol::resource::DistanceFieldFont::DistanceFieldFont() :
|
||||
* // out contain: {"DATA:///font", "DATA:///font?lib=ewol"}
|
||||
* @example[stop]
|
||||
*/
|
||||
static etk::Vector<etk::Uri> explodeMultiplePath(const etk::Uri& _uri) {
|
||||
etk::Vector<etk::Uri> out;
|
||||
static List<etk::Uri> explodeMultiplePath(const etk::Uri& _uri) {
|
||||
List<etk::Uri> out;
|
||||
out.pushBack(_uri);
|
||||
if (_uri.getQuery().exist("lib") == true) {
|
||||
etk::Uri tmp = _uri;
|
||||
@ -58,7 +58,7 @@ void ewol::resource::DistanceFieldFont::init(const etk::String& _fontName) {
|
||||
ethread::RecursiveLock lock(m_mutex);
|
||||
ewol::resource::Texture::init(_fontName);
|
||||
etk::String localName = _fontName;
|
||||
etk::Vector<etk::Uri> folderList;
|
||||
List<etk::Uri> folderList;
|
||||
if (ewol::getContext().getFontDefault().getUseExternal() == true) {
|
||||
#if defined(__TARGET_OS__Android)
|
||||
folderList.pushBack(etk::Path("/system/fonts"));
|
||||
@ -71,52 +71,52 @@ void ewol::resource::DistanceFieldFont::init(const etk::String& _fontName) {
|
||||
folderList.pushBack(it);
|
||||
}
|
||||
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, ';');
|
||||
EWOL_INFO("try to find font named : " << split << " in: " << output);
|
||||
//EWOL_CRITICAL("parse string : " << split);
|
||||
List<etk::String> split = etk::split(localName, ';');
|
||||
Log.info("try to find font named : " << split << " in: " << output);
|
||||
//Log.critical("parse string : " << split);
|
||||
bool hasFindAFont = false;
|
||||
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++) {
|
||||
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)
|
||||
|| 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]+"r"+".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];
|
||||
hasFindAFont=true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (hasFindAFont == true) {
|
||||
EWOL_INFO(" find this font : '" << split[jjj] << "'");
|
||||
Log.info(" find this font : '" << split[jjj] << "'");
|
||||
break;
|
||||
} 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) {
|
||||
EWOL_INFO(" find this font : '" << folderList[folderID] << "'");
|
||||
Log.info(" find this font : '" << folderList[folderID] << "'");
|
||||
break;
|
||||
} 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) {
|
||||
EWOL_ERROR("can not load FONT name : '" << _fontName << "'" );
|
||||
Log.error("can not load FONT name : '" << _fontName << "'" );
|
||||
m_font = null;
|
||||
return;
|
||||
}
|
||||
EWOL_INFO("Load FONT name : '" << m_fileName << "'");
|
||||
Log.info("Load FONT name : '" << m_fileName << "'");
|
||||
m_font = ewol::resource::FontFreeType::create(m_fileName);
|
||||
if (m_font == null) {
|
||||
EWOL_ERROR("Pb Loading FONT name : '" << m_fileName << "'" );
|
||||
Log.error("Pb Loading FONT name : '" << m_fileName << "'" );
|
||||
}
|
||||
|
||||
// set the bassic charset:
|
||||
@ -125,14 +125,14 @@ void ewol::resource::DistanceFieldFont::init(const etk::String& _fontName) {
|
||||
return;
|
||||
}
|
||||
if (importFromFile() == true) {
|
||||
EWOL_INFO("GET distance field from previous file");
|
||||
Log.info("GET distance field from previous file");
|
||||
flush();
|
||||
return;
|
||||
}
|
||||
|
||||
m_sizeRatio = ((float)SIZE_GENERATION) / ((float)m_font->getHeight(SIZE_GENERATION));
|
||||
// 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
|
||||
m_data.clear(etk::Color<>(0x00000000));
|
||||
// add error glyph
|
||||
@ -143,7 +143,7 @@ void ewol::resource::DistanceFieldFont::init(const etk::String& _fontName) {
|
||||
}
|
||||
flush();
|
||||
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.png");
|
||||
}
|
||||
@ -162,17 +162,17 @@ float ewol::resource::DistanceFieldFont::getDisplayRatio(float _size) {
|
||||
|
||||
|
||||
void ewol::resource::DistanceFieldFont::generateDistanceField(const egami::ImageMono& _input, egami::Image& _output) {
|
||||
EWOL_INFO("Generate Distance field font [START]");
|
||||
EWOL_INFO(" _input.getSize()=" << _input.getSize());
|
||||
Log.info("Generate Distance field font [START]");
|
||||
Log.info(" _input.getSize()=" << _input.getSize());
|
||||
ethread::RecursiveLock lock(m_mutex);
|
||||
int32_t size = _input.getSize().x() * _input.getSize().y();
|
||||
etk::Vector<short> xdist;
|
||||
etk::Vector<short> ydist;
|
||||
etk::Vector<double> gx;
|
||||
etk::Vector<double> gy;
|
||||
etk::Vector<double> data;
|
||||
etk::Vector<double> outside;
|
||||
etk::Vector<double> inside;
|
||||
List<short> xdist;
|
||||
List<short> ydist;
|
||||
List<double> gx;
|
||||
List<double> gy;
|
||||
List<double> data;
|
||||
List<double> outside;
|
||||
List<double> inside;
|
||||
xdist.resize(size, 0);
|
||||
ydist.resize(size, 0);
|
||||
gx.resize(size, 0.0);
|
||||
@ -180,13 +180,13 @@ void ewol::resource::DistanceFieldFont::generateDistanceField(const egami::Image
|
||||
data.resize(size, 0.0);
|
||||
outside.resize(size, 0.0);
|
||||
inside.resize(size, 0.0);
|
||||
EWOL_INFO(" size=" << size);
|
||||
Log.info(" size=" << size);
|
||||
// Convert img into double (data)
|
||||
double img_min = 255, img_max = -255;
|
||||
for (int32_t yyy = 0; yyy < _input.getSize().y(); ++yyy) {
|
||||
for (int32_t xxx = 0; xxx < _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;
|
||||
if (v > img_max) {
|
||||
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 xxx = 0; xxx < _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)
|
||||
@ -228,7 +228,7 @@ void ewol::resource::DistanceFieldFont::generateDistanceField(const egami::Image
|
||||
inside[iii] = 0.0;
|
||||
}
|
||||
}
|
||||
EWOL_INFO(" _output=" << _output);
|
||||
Log.info(" _output=" << _output);
|
||||
_output.resize(_input.getSize(), etk::Color<>(0));
|
||||
_output.clear(etk::Color<>(0));
|
||||
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];
|
||||
// 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) {
|
||||
@ -260,30 +260,30 @@ bool ewol::resource::DistanceFieldFont::addGlyph(const char32_t& _val) {
|
||||
GlyphProperty tmpchar;
|
||||
tmpchar.m_UVal = _val;
|
||||
egami::ImageMono imageGlyphRaw;
|
||||
egami::Image imageGlyphDistanceField(ivec2(32,32), egami::colorType::RGBA8);
|
||||
EWOL_DEBUG("Generate Glyph : " << _val);
|
||||
egami::Image imageGlyphDistanceField(Vector2i(32,32), egami::colorType::RGBA8);
|
||||
Log.debug("Generate Glyph : " << _val);
|
||||
|
||||
if (m_font->getGlyphProperty(SIZE_GENERATION, tmpchar) == true) {
|
||||
//EWOL_DEBUG("load char: '" << _val << "'=" << _val);
|
||||
//Log.debug("load char: '" << _val << "'=" << _val);
|
||||
hasChange = true;
|
||||
// change line if needed ...
|
||||
if (m_lastGlyphPos.x() + tmpchar.m_sizeTexture.x()+m_borderSize*2.0 > m_data.getSize().x()) {
|
||||
m_lastGlyphPos.setX(1);
|
||||
m_lastGlyphPos += ivec2(0, m_lastRawHeigh);
|
||||
m_lastGlyphPos += Vector2i(0, m_lastRawHeigh);
|
||||
m_lastRawHeigh = 0;
|
||||
}
|
||||
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);
|
||||
EWOL_VERBOSE("resize " << m_data.getSize() << " => " << size);
|
||||
Log.verbose("resize " << m_data.getSize() << " => " << size);
|
||||
m_data.resize(size, etk::Color<>(0));
|
||||
// change the coordonate on the element in the texture
|
||||
for (size_t jjj = 0; jjj < m_listElement.size(); ++jjj) {
|
||||
m_listElement[jjj].m_texturePosStart *= vec2(1.0f, 0.5f);
|
||||
m_listElement[jjj].m_texturePosSize *= vec2(1.0f, 0.5f);
|
||||
m_listElement[jjj].m_texturePosStart *= Vector2f(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() );
|
||||
// draw the glyph
|
||||
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);
|
||||
|
||||
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 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)
|
||||
// update the Bitmap position drawing :
|
||||
m_lastGlyphPos += ivec2(imageGlyphRaw.getSize().x()+1, 0);
|
||||
m_lastGlyphPos += Vector2i(imageGlyphRaw.getSize().x()+1, 0);
|
||||
} else {
|
||||
EWOL_WARNING("Did not find char : '" << _val << "'=" << _val);
|
||||
tmpchar.setNotExist();
|
||||
@ -328,7 +328,7 @@ bool ewol::resource::DistanceFieldFont::addGlyph(const char32_t& _val) {
|
||||
}
|
||||
if (hasChange == true) {
|
||||
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.png");
|
||||
}
|
||||
@ -343,11 +343,11 @@ int32_t ewol::resource::DistanceFieldFont::getIndex(char32_t _charcode) {
|
||||
return _charcode - 0x1F;
|
||||
} else {
|
||||
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) {
|
||||
//EWOL_DEBUG("search : '" << charcode << "'");
|
||||
//Log.debug("search : '" << charcode << "'");
|
||||
if ((m_listElement)[iii].exist()) {
|
||||
//EWOL_DEBUG("return " << iii);
|
||||
//Log.debug("return " << iii);
|
||||
return iii;
|
||||
} else {
|
||||
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) {
|
||||
ethread::RecursiveLock lock(m_mutex);
|
||||
EWOL_VERBOSE("getGlyphPointer : " << uint32_t(_charcode));
|
||||
Log.verbose("getGlyphPointer : " << uint32_t(_charcode));
|
||||
int32_t index = getIndex(_charcode);
|
||||
if( index < 0
|
||||
|| (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) {
|
||||
return &((m_listElement)[0]);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
//EWOL_ERROR(" index=" << index);
|
||||
//EWOL_ERROR(" m_UVal=" << m_listElement[_displayMode][index].m_UVal);
|
||||
//EWOL_ERROR(" m_glyphIndex=" << m_listElement[_displayMode][index].m_glyphIndex);
|
||||
//EWOL_ERROR(" m_advance=" << m_listElement[_displayMode][index].m_advance);
|
||||
//EWOL_ERROR(" m_bearing=" << m_listElement[_displayMode][index].m_bearing);
|
||||
//Log.error(" index=" << index);
|
||||
//Log.error(" m_UVal=" << m_listElement[_displayMode][index].m_UVal);
|
||||
//Log.error(" m_glyphIndex=" << m_listElement[_displayMode][index].m_glyphIndex);
|
||||
//Log.error(" m_advance=" << m_listElement[_displayMode][index].m_advance);
|
||||
//Log.error(" m_bearing=" << m_listElement[_displayMode][index].m_bearing);
|
||||
return &((m_listElement)[index]);
|
||||
}
|
||||
|
||||
void ewol::resource::DistanceFieldFont::exportOnFile() {
|
||||
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::Array tmpList;
|
||||
for (size_t iii=0; iii<m_listElement.size(); ++iii) {
|
||||
@ -423,11 +423,11 @@ bool ewol::resource::DistanceFieldFont::importFromFile() {
|
||||
etk::Uri tmpUriBmp = m_fileName;
|
||||
tmpUriBmp.setScheme("CACHE");
|
||||
tmpUriBmp.setPath(m_fileName.getPath() + ".png");
|
||||
EWOL_DEBUG("IMPORT: DistanceFieldFont : file : '" << tmpUriJson << "'");
|
||||
Log.debug("IMPORT: DistanceFieldFont : file : '" << tmpUriJson << "'");
|
||||
// test file existance:
|
||||
if ( etk::uri::exist(tmpUriJson) == 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;
|
||||
}
|
||||
ejson::Document doc;
|
||||
@ -446,7 +446,7 @@ bool ewol::resource::DistanceFieldFont::importFromFile() {
|
||||
m_textureBorderSize = doc["m_textureBorderSize"].toString().get("0,0");
|
||||
ejson::Array tmpList = doc["m_listElement"].toArray();
|
||||
if (tmpList.exist() == false) {
|
||||
EWOL_ERROR("null pointer array");
|
||||
Log.error("null pointer array");
|
||||
return false;
|
||||
}
|
||||
m_listElement.clear();
|
||||
|
@ -20,10 +20,10 @@ namespace ewol {
|
||||
// == > Bold is a little more complicated (maybe with the bordersize)
|
||||
ememory::SharedPtr<ewol::resource::FontBase> m_font;
|
||||
public:
|
||||
etk::Vector<GlyphProperty> m_listElement;
|
||||
List<GlyphProperty> m_listElement;
|
||||
private:
|
||||
// for the texture generation :
|
||||
ivec2 m_lastGlyphPos;
|
||||
Vector2i m_lastGlyphPos;
|
||||
int32_t m_lastRawHeigh;
|
||||
protected:
|
||||
DistanceFieldFont();
|
||||
@ -80,12 +80,12 @@ namespace ewol {
|
||||
void generateDistanceField(const egami::ImageMono& _input, egami::Image& _output);
|
||||
private:
|
||||
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:
|
||||
float getPixelBorderSize() {
|
||||
return m_borderSize;
|
||||
}
|
||||
const vec2& getTextureBorderSize() {
|
||||
const Vector2f& getTextureBorderSize() {
|
||||
return m_textureBorderSize;
|
||||
}
|
||||
public:
|
||||
|
@ -23,7 +23,7 @@ static int32_t l_countLoaded=0;
|
||||
static FT_Library library;
|
||||
|
||||
void ewol::resource::freeTypeInit() {
|
||||
EWOL_DEBUG(" == > init Font-Manager");
|
||||
Log.debug(" == > init Font-Manager");
|
||||
l_countLoaded++;
|
||||
if (l_countLoaded>1) {
|
||||
// already loaded ...
|
||||
@ -31,12 +31,12 @@ void ewol::resource::freeTypeInit() {
|
||||
}
|
||||
int32_t error = FT_Init_FreeType( &library );
|
||||
if(0 != error) {
|
||||
EWOL_CRITICAL(" when loading FreeType Librairy ...");
|
||||
Log.critical(" when loading FreeType Librairy ...");
|
||||
}
|
||||
}
|
||||
|
||||
void ewol::resource::freeTypeUnInit() {
|
||||
EWOL_DEBUG(" == > Un-Init Font-Manager");
|
||||
Log.debug(" == > Un-Init Font-Manager");
|
||||
l_countLoaded--;
|
||||
if (l_countLoaded>0) {
|
||||
// already needed ...
|
||||
@ -45,7 +45,7 @@ void ewol::resource::freeTypeUnInit() {
|
||||
int32_t error = FT_Done_FreeType( library );
|
||||
library = null;
|
||||
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);
|
||||
auto fileIO = etk::uri::get(_uri);
|
||||
if (fileIO == null) {
|
||||
EWOL_ERROR("File Does not exist : " << _uri);
|
||||
Log.error("File Does not exist : " << _uri);
|
||||
return;
|
||||
}
|
||||
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;
|
||||
}
|
||||
m_FileBuffer = fileIO->readAll<FT_Byte>();
|
||||
@ -73,12 +73,12 @@ void ewol::resource::FontFreeType::init(const etk::Uri& _uri) {
|
||||
// load Face ...
|
||||
int32_t error = FT_New_Memory_Face(library, &m_FileBuffer[0], m_FileBuffer.size(), 0, &m_fftFace );
|
||||
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) {
|
||||
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 {
|
||||
// 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;
|
||||
//display();
|
||||
}
|
||||
@ -92,13 +92,13 @@ ewol::resource::FontFreeType::~FontFreeType() {
|
||||
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);
|
||||
if (m_init == false) {
|
||||
return vec2(0,0);
|
||||
return Vector2f(0,0);
|
||||
}
|
||||
// TODO : ...
|
||||
vec2 outputSize(0,0);
|
||||
Vector2f outputSize(0,0);
|
||||
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
|
||||
int32_t error = FT_Set_Char_Size(m_fftFace, _fontSize<<6, _fontSize<<6, fontQuality, fontQuality);
|
||||
if (0!=error ) {
|
||||
EWOL_ERROR("FT_Set_Char_Size == > error in settings ...");
|
||||
Log.error("FT_Set_Char_Size == > error in settings ...");
|
||||
return false;
|
||||
}
|
||||
// a small shortcut
|
||||
@ -134,13 +134,13 @@ bool ewol::resource::FontFreeType::getGlyphProperty(int32_t _fontSize, ewol::Gly
|
||||
glyph_index, // glyph index
|
||||
FT_LOAD_DEFAULT );
|
||||
if (0!=error ) {
|
||||
EWOL_ERROR("FT_Load_Glyph specify Glyph");
|
||||
Log.error("FT_Load_Glyph specify Glyph");
|
||||
return false;
|
||||
}
|
||||
// convert to an anti-aliased bitmap
|
||||
error = FT_Render_Glyph(slot, FT_RENDER_MODE_NORMAL );
|
||||
if (0!=error) {
|
||||
EWOL_ERROR("FT_Render_Glyph");
|
||||
Log.error("FT_Render_Glyph");
|
||||
return false;
|
||||
}
|
||||
// set properties :
|
||||
@ -154,7 +154,7 @@ bool ewol::resource::FontFreeType::getGlyphProperty(int32_t _fontSize, ewol::Gly
|
||||
|
||||
bool ewol::resource::FontFreeType::drawGlyph(egami::Image& _imageOut,
|
||||
int32_t _fontSize,
|
||||
ivec2 _glyphPosition,
|
||||
Vector2i _glyphPosition,
|
||||
ewol::GlyphProperty& _property,
|
||||
int8_t _posInImage) {
|
||||
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
|
||||
int32_t error = FT_Set_Char_Size(m_fftFace, _fontSize<<6, _fontSize<<6, fontQuality, fontQuality);
|
||||
if (0!=error ) {
|
||||
EWOL_ERROR("FT_Set_Char_Size == > error in settings ...");
|
||||
Log.error("FT_Set_Char_Size == > error in settings ...");
|
||||
return false;
|
||||
}
|
||||
// a small shortcut
|
||||
@ -177,20 +177,20 @@ bool ewol::resource::FontFreeType::drawGlyph(egami::Image& _imageOut,
|
||||
_property.m_glyphIndex, // glyph index
|
||||
FT_LOAD_DEFAULT );
|
||||
if (0!=error ) {
|
||||
EWOL_ERROR("FT_Load_Glyph specify Glyph");
|
||||
Log.error("FT_Load_Glyph specify Glyph");
|
||||
return false;
|
||||
}
|
||||
// convert to an anti-aliased bitmap
|
||||
error = FT_Render_Glyph(slot, FT_RENDER_MODE_NORMAL );
|
||||
if (0!=error) {
|
||||
EWOL_ERROR("FT_Render_Glyph");
|
||||
Log.error("FT_Render_Glyph");
|
||||
return false;
|
||||
}
|
||||
// draw it on the output Image :
|
||||
etk::Color<> tlpppp(0xFF, 0xFF, 0xFF, 0x00);
|
||||
for(size_t jjj=0; jjj < slot->bitmap.rows;jjj++) {
|
||||
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];
|
||||
// set only alpha :
|
||||
switch(_posInImage) {
|
||||
@ -209,7 +209,7 @@ bool ewol::resource::FontFreeType::drawGlyph(egami::Image& _imageOut,
|
||||
break;
|
||||
}
|
||||
// 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;
|
||||
@ -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
|
||||
int32_t error = FT_Set_Char_Size(m_fftFace, _fontSize<<6, _fontSize<<6, fontQuality, fontQuality);
|
||||
if (0!=error ) {
|
||||
EWOL_ERROR("FT_Set_Char_Size == > error in settings ...");
|
||||
Log.error("FT_Set_Char_Size == > error in settings ...");
|
||||
return false;
|
||||
}
|
||||
// a small shortcut
|
||||
@ -239,36 +239,36 @@ bool ewol::resource::FontFreeType::drawGlyph(egami::ImageMono& _imageOut,
|
||||
_property.m_glyphIndex, // glyph index
|
||||
FT_LOAD_DEFAULT );
|
||||
if (0!=error ) {
|
||||
EWOL_ERROR("FT_Load_Glyph specify Glyph");
|
||||
Log.error("FT_Load_Glyph specify Glyph");
|
||||
return false;
|
||||
}
|
||||
// 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 ...
|
||||
if (0!=error) {
|
||||
EWOL_ERROR("FT_Render_Glyph");
|
||||
Log.error("FT_Render_Glyph");
|
||||
return false;
|
||||
}
|
||||
// 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 iii=0; iii < slot->bitmap.width; iii++){
|
||||
uint8_t valueColor = slot->bitmap.buffer[iii + slot->bitmap.width*jjj];
|
||||
// real set of color
|
||||
_imageOut.set(ivec2(_borderSize+iii, _borderSize+jjj), valueColor );
|
||||
_imageOut.set(Vector2i(_borderSize+iii, _borderSize+jjj), valueColor );
|
||||
}
|
||||
}
|
||||
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);
|
||||
if(m_init == false) {
|
||||
return;
|
||||
}
|
||||
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)
|
||||
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
|
||||
int32_t error = FT_Set_Char_Size(m_fftFace, fontSize<<6, fontSize<<6, fontQuality, fontQuality);
|
||||
if (0!=error ) {
|
||||
EWOL_ERROR("FT_Set_Char_Size == > error in settings ...");
|
||||
Log.error("FT_Set_Char_Size == > error in settings ...");
|
||||
return;
|
||||
}
|
||||
// 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) {
|
||||
listGlyph[iii].kerningAdd(listGlyph[kkk].m_UVal,
|
||||
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) {
|
||||
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) {
|
||||
EWOL_INFO(" flags = FT_FACE_FLAG_SCALABLE (enable)");
|
||||
Log.info(" flags = FT_FACE_FLAG_SCALABLE (enable)");
|
||||
} 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) {
|
||||
EWOL_INFO(" flags = FT_FACE_FLAG_FIXED_SIZES (enable)");
|
||||
Log.info(" flags = FT_FACE_FLAG_FIXED_SIZES (enable)");
|
||||
} 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) {
|
||||
EWOL_INFO(" flags = FT_FACE_FLAG_FIXED_WIDTH (enable)");
|
||||
Log.info(" flags = FT_FACE_FLAG_FIXED_WIDTH (enable)");
|
||||
} 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) {
|
||||
EWOL_INFO(" flags = FT_FACE_FLAG_SFNT (enable)");
|
||||
Log.info(" flags = FT_FACE_FLAG_SFNT (enable)");
|
||||
} 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) {
|
||||
EWOL_INFO(" flags = FT_FACE_FLAG_HORIZONTAL (enable)");
|
||||
Log.info(" flags = FT_FACE_FLAG_HORIZONTAL (enable)");
|
||||
} 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) {
|
||||
EWOL_INFO(" flags = FT_FACE_FLAG_VERTICAL (enable)");
|
||||
Log.info(" flags = FT_FACE_FLAG_VERTICAL (enable)");
|
||||
} 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) {
|
||||
EWOL_INFO(" flags = FT_FACE_FLAG_KERNING (enable)");
|
||||
Log.info(" flags = FT_FACE_FLAG_KERNING (enable)");
|
||||
} else {
|
||||
EWOL_DEBUG(" flags = FT_FACE_FLAG_KERNING (disable)");
|
||||
Log.debug(" flags = FT_FACE_FLAG_KERNING (disable)");
|
||||
}
|
||||
/* Deprecated flag
|
||||
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 {
|
||||
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) {
|
||||
EWOL_INFO(" flags = FT_FACE_FLAG_MULTIPLE_MASTERS (enable)");
|
||||
Log.info(" flags = FT_FACE_FLAG_MULTIPLE_MASTERS (enable)");
|
||||
} 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) {
|
||||
EWOL_INFO(" flags = FT_FACE_FLAG_GLYPH_NAMES (enable)");
|
||||
Log.info(" flags = FT_FACE_FLAG_GLYPH_NAMES (enable)");
|
||||
} 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) {
|
||||
EWOL_INFO(" flags = FT_FACE_FLAG_EXTERNAL_STREAM (enable)");
|
||||
Log.info(" flags = FT_FACE_FLAG_EXTERNAL_STREAM (enable)");
|
||||
} 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) {
|
||||
EWOL_INFO(" flags = FT_FACE_FLAG_HINTER (enable)");
|
||||
Log.info(" flags = FT_FACE_FLAG_HINTER (enable)");
|
||||
} 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) {
|
||||
EWOL_INFO(" flags = FT_FACE_FLAG_CID_KEYED (enable)");
|
||||
Log.info(" flags = FT_FACE_FLAG_CID_KEYED (enable)");
|
||||
} 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) {
|
||||
EWOL_INFO(" flags = FT_FACE_FLAG_TRICKY (enable)");
|
||||
Log.info(" flags = FT_FACE_FLAG_TRICKY (enable)");
|
||||
} 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);
|
||||
EWOL_INFO(" num of fixed sizes = " << m_fftFace->num_fixed_sizes);
|
||||
//EWOL_INFO(" Availlable sizes = " << (int)m_fftFace->available_sizes);
|
||||
Log.info(" unit per EM = " << m_fftFace->units_per_EM);
|
||||
Log.info(" num of fixed sizes = " << m_fftFace->num_fixed_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);
|
||||
}
|
||||
|
@ -20,7 +20,7 @@ namespace ewol {
|
||||
// show : http://www.freetype.org/freetype2/docs/tutorial/step2.html
|
||||
class FontFreeType : public ewol::resource::FontBase {
|
||||
private:
|
||||
etk::Vector<FT_Byte> m_FileBuffer;
|
||||
List<FT_Byte> m_FileBuffer;
|
||||
int32_t m_FileSize;
|
||||
FT_Face m_fftFace;
|
||||
bool m_init;
|
||||
@ -38,7 +38,7 @@ namespace ewol {
|
||||
|
||||
bool drawGlyph(egami::Image& _imageOut,
|
||||
int32_t _fontSize,
|
||||
ivec2 _glyphPosition,
|
||||
Vector2i _glyphPosition,
|
||||
ewol::GlyphProperty& _property,
|
||||
int8_t _posInImage);
|
||||
|
||||
@ -47,12 +47,12 @@ namespace ewol {
|
||||
ewol::GlyphProperty& _property,
|
||||
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);
|
||||
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 freeTypeUnInit();
|
||||
|
@ -25,16 +25,16 @@ void ewol::resource::ImageDF::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);
|
||||
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);
|
||||
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();
|
||||
m_realImageSize = vec2(tmp.x(), tmp.y());
|
||||
Vector2i tmp = m_data.getSize();
|
||||
m_realImageSize = Vector2f(tmp.x(), tmp.y());
|
||||
// distance field Generation
|
||||
// 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);
|
||||
for (size_t yyy = 0; yyy < tmp.y(); ++yyy) {
|
||||
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);
|
||||
@ -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) {
|
||||
ethread::RecursiveLock lock(m_mutex);
|
||||
int32_t size = _input.getSize().x() * _input.getSize().y();
|
||||
etk::Vector<short> xdist;
|
||||
etk::Vector<short> ydist;
|
||||
etk::Vector<double> gx;
|
||||
etk::Vector<double> gy;
|
||||
etk::Vector<double> data;
|
||||
etk::Vector<double> outside;
|
||||
etk::Vector<double> inside;
|
||||
List<short> xdist;
|
||||
List<short> ydist;
|
||||
List<double> gx;
|
||||
List<double> gy;
|
||||
List<double> data;
|
||||
List<double> outside;
|
||||
List<double> inside;
|
||||
xdist.resize(size, 0);
|
||||
ydist.resize(size, 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 xxx = 0; xxx < _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;
|
||||
if (v > img_max) {
|
||||
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 xxx = 0; xxx < _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];
|
||||
// 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;
|
||||
}
|
||||
EWOL_CRITICAL("impossible CASE.... request P2 of " << _value);
|
||||
Log.critical("impossible CASE.... request P2 of " << _value);
|
||||
return val;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
ememory::SharedPtr<ewol::resource::ImageDF> ewol::resource::ImageDF::create(const etk::Uri& _uri, ivec2 _size) {
|
||||
EWOL_VERBOSE("KEEP: TextureFile: '" << _uri << "' size=" << _size);
|
||||
ememory::SharedPtr<ewol::resource::ImageDF> ewol::resource::ImageDF::create(const etk::Uri& _uri, Vector2i _size) {
|
||||
Log.verbose("KEEP: TextureFile: '" << _uri << "' size=" << _size);
|
||||
if (_uri.isEmpty() == true) {
|
||||
ememory::SharedPtr<ewol::resource::ImageDF> object(ETK_NEW(ewol::resource::ImageDF));
|
||||
if (object == null) {
|
||||
EWOL_ERROR("allocation error of a resource : ??TEX??");
|
||||
Log.error("allocation error of a resource : ??TEX??");
|
||||
return null;
|
||||
}
|
||||
object->init();
|
||||
@ -174,23 +174,23 @@ ememory::SharedPtr<ewol::resource::ImageDF> ewol::resource::ImageDF::create(cons
|
||||
}
|
||||
if (_size.x() == 0) {
|
||||
_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) {
|
||||
_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;
|
||||
if (etk::toLower(_uri.getPath().getExtention()) != "svg") {
|
||||
_size = ivec2(-1,-1);
|
||||
_size = Vector2i(-1,-1);
|
||||
}
|
||||
#ifdef __TARGET_OS__MacOs
|
||||
EWOL_ERROR("TODO : remove this strange hack");
|
||||
_size = ivec2(64,64);
|
||||
Log.error("TODO : remove this strange hack");
|
||||
_size = Vector2i(64,64);
|
||||
#endif
|
||||
if ( _size.x() > 0
|
||||
&& _size.y() > 0) {
|
||||
EWOL_VERBOSE(" == > specific size : " << _size);
|
||||
Log.verbose(" == > specific size : " << _size);
|
||||
#ifdef __TARGET_OS__Android
|
||||
_size.setValue(nextP2(_size.x()), nextP2(_size.y()));
|
||||
#endif
|
||||
@ -198,24 +198,24 @@ ememory::SharedPtr<ewol::resource::ImageDF> ewol::resource::ImageDF::create(cons
|
||||
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<gale::Resource> object2 = getManager().localKeep("DF__" + tmpFilename.getString());
|
||||
if (object2 != null) {
|
||||
object = ememory::dynamicPointerCast<ewol::resource::ImageDF>(object2);
|
||||
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;
|
||||
}
|
||||
}
|
||||
if (object != null) {
|
||||
return object;
|
||||
}
|
||||
EWOL_INFO("CREATE: ImageDF: '" << tmpFilename << "' size=" << _size);
|
||||
Log.info("CREATE: ImageDF: '" << tmpFilename << "' size=" << _size);
|
||||
// need to crate a new one ...
|
||||
object = ememory::SharedPtr<ewol::resource::ImageDF>(ETK_NEW(ewol::resource::ImageDF));
|
||||
if (object == null) {
|
||||
EWOL_ERROR("allocation error of a resource : " << _uri);
|
||||
Log.error("allocation error of a resource : " << _uri);
|
||||
return null;
|
||||
}
|
||||
object->init("DF__" + tmpFilename.getString(), _uri, _size);
|
||||
|
@ -14,11 +14,11 @@ namespace ewol {
|
||||
namespace resource {
|
||||
class ImageDF : public ewol::resource::Texture {
|
||||
protected:
|
||||
vec2 m_realImageSize;
|
||||
Vector2f m_realImageSize;
|
||||
protected:
|
||||
ImageDF();
|
||||
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:
|
||||
virtual ~ImageDF() { };
|
||||
protected:
|
||||
@ -29,7 +29,7 @@ namespace ewol {
|
||||
*/
|
||||
void generateDistanceField(const egami::ImageMono& _input, egami::Image& _output);
|
||||
public:
|
||||
const vec2& getRealSize() {
|
||||
const Vector2f& getRealSize() {
|
||||
return m_realImageSize;
|
||||
};
|
||||
public:
|
||||
@ -40,7 +40,7 @@ namespace ewol {
|
||||
* @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.
|
||||
*/
|
||||
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));
|
||||
};
|
||||
};
|
||||
};
|
||||
|
@ -28,7 +28,7 @@ static int32_t nextP2(int32_t _value) {
|
||||
}
|
||||
val *=2;
|
||||
}
|
||||
EWOL_CRITICAL("impossible CASE....");
|
||||
Log.critical("impossible CASE....");
|
||||
return val;
|
||||
}
|
||||
|
||||
@ -44,7 +44,7 @@ ewol::resource::Texture::Texture() :
|
||||
#ifdef EWOL_USE_FBO
|
||||
m_texPboId(0),
|
||||
#endif
|
||||
m_data(ivec2(32,32),egami::colorType::RGBA8),
|
||||
m_data(Vector2i(32,32),egami::colorType::RGBA8),
|
||||
m_realImageSize(1,1),
|
||||
m_lastSize(1,1),
|
||||
m_loaded(false),
|
||||
@ -71,12 +71,12 @@ void ewol::resource::Texture::setFilterMode(enum ewol::resource::TextureFilter _
|
||||
#include <egami/egami.hpp>
|
||||
|
||||
bool ewol::resource::Texture::updateContext() {
|
||||
EWOL_VERBOSE("updateContext [START]");
|
||||
Log.verbose("updateContext [START]");
|
||||
if (false) {
|
||||
echrono::Steady tic = echrono::Steady::now();
|
||||
gale::openGL::flush();
|
||||
echrono::Steady toc = echrono::Steady::now();
|
||||
EWOL_VERBOSE(" updateContext [FLUSH] ==> " << (toc - tic));
|
||||
Log.verbose(" updateContext [FLUSH] ==> " << (toc - tic));
|
||||
}
|
||||
ethread::RecursiveLock lock(m_mutex, true);
|
||||
echrono::Steady tic = echrono::Steady::now();
|
||||
@ -112,7 +112,7 @@ bool ewol::resource::Texture::updateContext() {
|
||||
case egami::colorType::unsignedInt32:
|
||||
case egami::colorType::float32:
|
||||
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;
|
||||
}
|
||||
if (m_loaded == true) {
|
||||
@ -129,22 +129,22 @@ bool ewol::resource::Texture::updateContext() {
|
||||
glGenTextures(1, &m_texId);
|
||||
|
||||
#ifdef EWOL_USE_FBO
|
||||
EWOL_ERROR("CREATE PBO");
|
||||
Log.error("CREATE PBO");
|
||||
glGenBuffers(1, &m_texPboId);
|
||||
EWOL_ERROR("CREATE PBO 1");
|
||||
Log.error("CREATE PBO 1");
|
||||
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);
|
||||
EWOL_ERROR("CREATE PBO 3");
|
||||
Log.error("CREATE PBO 3");
|
||||
glBindBuffer(GL_PIXEL_UNPACK_BUFFER, 0);
|
||||
EWOL_ERROR("CREATE PBO 4 (done)");
|
||||
Log.error("CREATE PBO 4 (done)");
|
||||
#endif
|
||||
m_lastSize = m_data.getSize();
|
||||
m_lastTypeObject = typeObject;
|
||||
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 {
|
||||
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 :
|
||||
// TODO : check error ???
|
||||
@ -167,7 +167,7 @@ bool ewol::resource::Texture::updateContext() {
|
||||
}
|
||||
//glPixelStorei(GL_UNPACK_ALIGNMENT,1);
|
||||
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");
|
||||
#if defined(__TARGET_OS__Android) \
|
||||
|| defined(__TARGET_OS__IOs)
|
||||
@ -175,11 +175,11 @@ bool ewol::resource::Texture::updateContext() {
|
||||
if (m_loaded == false) {
|
||||
// 1: Create the square 2 texture:
|
||||
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) {
|
||||
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:
|
||||
#ifdef EWOL_USE_FBO
|
||||
glBindBuffer(GL_PIXEL_UNPACK_BUFFER, m_texPboId);
|
||||
@ -236,7 +236,7 @@ bool ewol::resource::Texture::updateContext() {
|
||||
sizeObject, // type
|
||||
(void*)((char*)m_data.getTextureDataPointer()) );
|
||||
echrono::Steady toc2 = echrono::Steady::now();
|
||||
EWOL_INFO(" updateContext [STOP] ==> " << (toc2 - tic1));
|
||||
Log.info(" updateContext [STOP] ==> " << (toc2 - tic1));
|
||||
#endif
|
||||
#else
|
||||
// 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
|
||||
m_loaded = true;
|
||||
echrono::Steady toc = echrono::Steady::now();
|
||||
//EWOL_ERROR(" updateContext [STOP] ==> " << (toc - toc1));
|
||||
//Log.error(" updateContext [STOP] ==> " << (toc - toc1));
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -273,7 +273,7 @@ void ewol::resource::Texture::removeContext() {
|
||||
ethread::RecursiveLock lock(m_mutex);
|
||||
if (m_loaded == true) {
|
||||
// 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
|
||||
glDeleteTextures(1, &m_texId);
|
||||
m_loaded = false;
|
||||
@ -289,31 +289,31 @@ void ewol::resource::Texture::removeContextToLate() {
|
||||
void ewol::resource::Texture::flush() {
|
||||
ethread::RecursiveLock lock(m_mutex);
|
||||
// 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()));
|
||||
}
|
||||
|
||||
void ewol::resource::Texture::setImageSize(ivec2 _newSize) {
|
||||
void ewol::resource::Texture::setImageSize(Vector2i _newSize) {
|
||||
ethread::RecursiveLock lock(m_mutex);
|
||||
_newSize.setValue( nextP2(_newSize.x()), nextP2(_newSize.y()) );
|
||||
m_data.resize(_newSize);
|
||||
}
|
||||
|
||||
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);
|
||||
if (_image.exist() == false) {
|
||||
EWOL_ERROR("ERROR when loading the image : [raw data]");
|
||||
Log.error("ERROR when loading the image : [raw data]");
|
||||
return;
|
||||
}
|
||||
EWOL_DEBUG(" size=" << _image.getSize());
|
||||
Log.debug(" size=" << _image.getSize());
|
||||
etk::swap(m_data, _image);
|
||||
ivec2 tmp = m_data.getSize();
|
||||
m_realImageSize = vec2(tmp.x(), tmp.y());
|
||||
vec2 compatibilityHWSize = vec2(nextP2(tmp.x()), nextP2(tmp.y()));
|
||||
Vector2i tmp = m_data.getSize();
|
||||
m_realImageSize = Vector2f(tmp.x(), tmp.y());
|
||||
Vector2f compatibilityHWSize = Vector2f(nextP2(tmp.x()), nextP2(tmp.y()));
|
||||
if (m_realImageSize != compatibilityHWSize) {
|
||||
EWOL_VERBOSE("RESIZE Image for HArwareCompatibility:" << m_realImageSize << " => " << compatibilityHWSize);
|
||||
m_data.resize(ivec2(compatibilityHWSize.x(),compatibilityHWSize.y()));
|
||||
Log.verbose("RESIZE Image for HArwareCompatibility:" << m_realImageSize << " => " << compatibilityHWSize);
|
||||
m_data.resize(Vector2i(compatibilityHWSize.x(),compatibilityHWSize.y()));
|
||||
}
|
||||
flush();
|
||||
}
|
||||
|
@ -27,9 +27,9 @@ namespace ewol {
|
||||
// openGl Context propoerties :
|
||||
egami::Image m_data;
|
||||
//! 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
|
||||
vec2 m_realImageSize;
|
||||
Vector2f m_realImageSize;
|
||||
// internal state of the openGl system :
|
||||
bool m_loaded;
|
||||
int32_t m_lastTypeObject;
|
||||
@ -60,7 +60,7 @@ namespace ewol {
|
||||
virtual ~Texture();
|
||||
public:
|
||||
// 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 ...
|
||||
inline egami::Image& get() {
|
||||
return m_data;
|
||||
@ -76,10 +76,10 @@ namespace ewol {
|
||||
bool updateContext();
|
||||
void removeContext();
|
||||
void removeContextToLate();
|
||||
const ivec2& getOpenGlSize() const {
|
||||
const Vector2i& getOpenGlSize() const {
|
||||
return m_data.getSize();
|
||||
};
|
||||
const vec2& getUsableSize() const {
|
||||
const Vector2f& getUsableSize() const {
|
||||
return m_realImageSize;
|
||||
};
|
||||
uint32_t getRendererId() const {
|
||||
|
@ -14,8 +14,8 @@
|
||||
#include <etk/typeInfo.hpp>
|
||||
ETK_DECLARE_TYPE(ewol::resource::TextureFile);
|
||||
|
||||
const ivec2 ewol::resource::TextureFile::sizeAuto(-1,-1);
|
||||
const ivec2 ewol::resource::TextureFile::sizeDefault(0,0);
|
||||
const Vector2i ewol::resource::TextureFile::sizeAuto(-1,-1);
|
||||
const Vector2i ewol::resource::TextureFile::sizeDefault(0,0);
|
||||
|
||||
/**
|
||||
* @brief get the next power 2 if the input
|
||||
@ -30,7 +30,7 @@ static int32_t nextP2(int32_t _value) {
|
||||
}
|
||||
val *=2;
|
||||
}
|
||||
EWOL_CRITICAL("impossible CASE.... request P2 of " << _value);
|
||||
Log.critical("impossible CASE.... request P2 of " << _value);
|
||||
return val;
|
||||
}
|
||||
|
||||
@ -45,10 +45,10 @@ void ewol::resource::TextureFile::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);
|
||||
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);
|
||||
set(etk::move(tmp));
|
||||
//m_lastSize = m_realImageSize;
|
||||
@ -58,12 +58,12 @@ void ewol::resource::TextureFile::init(etk::String _genName, const etk::Uri& _ur
|
||||
#endif
|
||||
}
|
||||
|
||||
ememory::SharedPtr<ewol::resource::TextureFile> ewol::resource::TextureFile::create(const etk::Uri& _uri, ivec2 _size, ivec2 _sizeRegister) {
|
||||
EWOL_VERBOSE("KEEP: TextureFile: '" << _uri << "' size=" << _size << " sizeRegister=" << _sizeRegister);
|
||||
ememory::SharedPtr<ewol::resource::TextureFile> ewol::resource::TextureFile::create(const etk::Uri& _uri, Vector2i _size, Vector2i _sizeRegister) {
|
||||
Log.verbose("KEEP: TextureFile: '" << _uri << "' size=" << _size << " sizeRegister=" << _sizeRegister);
|
||||
if (_uri.isEmpty() == true) {
|
||||
ememory::SharedPtr<ewol::resource::TextureFile> object(ETK_NEW(ewol::resource::TextureFile));
|
||||
if (object == null) {
|
||||
EWOL_ERROR("allocation error of a resource : ??TEX??");
|
||||
Log.error("allocation error of a resource : ??TEX??");
|
||||
return null;
|
||||
}
|
||||
object->init();
|
||||
@ -72,18 +72,18 @@ ememory::SharedPtr<ewol::resource::TextureFile> ewol::resource::TextureFile::cre
|
||||
}
|
||||
if (_size.x() == 0) {
|
||||
_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) {
|
||||
_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;
|
||||
if (etk::toLower(_uri.getPath().getExtention()) != "svg") {
|
||||
_size = ewol::resource::TextureFile::sizeAuto;
|
||||
}
|
||||
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()));
|
||||
if (_sizeRegister != ewol::resource::TextureFile::sizeAuto) {
|
||||
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<gale::Resource> object2 = getManager().localKeep(tmpFilename.getString());
|
||||
if (object2 != null) {
|
||||
object = ememory::dynamicPointerCast<ewol::resource::TextureFile>(object2);
|
||||
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;
|
||||
}
|
||||
}
|
||||
if (object != null) {
|
||||
return object;
|
||||
}
|
||||
EWOL_DEBUG("CREATE: TextureFile: '" << tmpFilename << "' size=" << _size);
|
||||
Log.debug("CREATE: TextureFile: '" << tmpFilename << "' size=" << _size);
|
||||
// need to crate a new one ...
|
||||
object = ememory::SharedPtr<ewol::resource::TextureFile>(ETK_NEW(ewol::resource::TextureFile));
|
||||
if (object == null) {
|
||||
EWOL_ERROR("allocation error of a resource : " << _uri);
|
||||
Log.error("allocation error of a resource : " << _uri);
|
||||
return null;
|
||||
}
|
||||
object->init(tmpFilename.getString(), _uri, _size);
|
||||
|
@ -17,16 +17,16 @@ namespace ewol {
|
||||
namespace resource {
|
||||
class TextureFile : public ewol::resource::Texture {
|
||||
public:
|
||||
static const ivec2 sizeAuto;
|
||||
static const ivec2 sizeDefault;
|
||||
static const Vector2i sizeAuto;
|
||||
static const Vector2i sizeDefault;
|
||||
protected:
|
||||
TextureFile();
|
||||
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:
|
||||
virtual ~TextureFile() { };
|
||||
public:
|
||||
const vec2& getRealSize() {
|
||||
const Vector2f& getRealSize() {
|
||||
return m_realImageSize;
|
||||
};
|
||||
public:
|
||||
@ -39,8 +39,8 @@ namespace ewol {
|
||||
* @return pointer on the resource or null if an error occured.
|
||||
*/
|
||||
static ememory::SharedPtr<ewol::resource::TextureFile> create(const etk::Uri& _filename,
|
||||
ivec2 _size=ewol::resource::TextureFile::sizeAuto,
|
||||
ivec2 _sizeRegister=ewol::resource::TextureFile::sizeAuto);
|
||||
Vector2i _size=ewol::resource::TextureFile::sizeAuto,
|
||||
Vector2i _sizeRegister=ewol::resource::TextureFile::sizeAuto);
|
||||
};
|
||||
};
|
||||
};
|
||||
|
@ -52,8 +52,8 @@ ewol::resource::TexturedFont::TexturedFont():
|
||||
* // out contain: {"DATA:///font", "DATA:///font?lib=ewol"}
|
||||
* @example[stop]
|
||||
*/
|
||||
static etk::Vector<etk::Uri> explodeMultiplePath(const etk::Uri& _uri) {
|
||||
etk::Vector<etk::Uri> out;
|
||||
static List<etk::Uri> explodeMultiplePath(const etk::Uri& _uri) {
|
||||
List<etk::Uri> out;
|
||||
out.pushBack(_uri);
|
||||
if (_uri.getQuery().exist("lib") == true) {
|
||||
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) {
|
||||
ethread::RecursiveLock lock(m_mutex);
|
||||
ewol::resource::Texture::init(_fontName);
|
||||
EWOL_DEBUG("Load font : '" << _fontName << "'" );
|
||||
Log.debug("Load font : '" << _fontName << "'" );
|
||||
|
||||
m_font[0] = null;
|
||||
m_font[1] = null;
|
||||
@ -95,23 +95,23 @@ void ewol::resource::TexturedFont::init(const etk::String& _fontName) {
|
||||
|
||||
if (tmpPos == null) {
|
||||
m_size = 1;
|
||||
EWOL_CRITICAL("Can not parse the font name: '" << _fontName << "' ??? ':' " );
|
||||
Log.critical("Can not parse the font name: '" << _fontName << "' ??? ':' " );
|
||||
return;
|
||||
} else {
|
||||
if (sscanf(tmpPos+1, "%d", &tmpSize)!=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;
|
||||
}
|
||||
}
|
||||
etk::String localName(_fontName, 0, (tmpPos - tmpData));
|
||||
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;
|
||||
}
|
||||
m_size = tmpSize;
|
||||
|
||||
etk::Vector<etk::Uri> folderList;
|
||||
List<etk::Uri> folderList;
|
||||
if (ewol::getContext().getFontDefault().getUseExternal() == true) {
|
||||
#if defined(__TARGET_OS__Android)
|
||||
folderList.pushBack(etk::Path("/system/fonts"));
|
||||
@ -124,24 +124,24 @@ void ewol::resource::TexturedFont::init(const etk::String& _fontName) {
|
||||
folderList.pushBack(it);
|
||||
}
|
||||
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, ';');
|
||||
EWOL_DEBUG("try to find font named : " << split << " in: " << output);
|
||||
//EWOL_CRITICAL("parse string : " << split);
|
||||
List<etk::String> split = etk::split(localName, ';');
|
||||
Log.debug("try to find font named : " << split << " in: " << output);
|
||||
//Log.critical("parse string : " << split);
|
||||
bool hasFindAFont = false;
|
||||
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++) {
|
||||
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
|
||||
|| 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]+"bold"+".ttf", false) == true
|
||||
|| etk::end_with(nameFolder, split[jjj]+"bd"+".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];
|
||||
hasFindAFont = 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]+"light"+".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];
|
||||
hasFindAFont = 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]+"bi"+".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];
|
||||
hasFindAFont = 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]+"r"+".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];
|
||||
hasFindAFont = true;
|
||||
}
|
||||
}
|
||||
if (hasFindAFont == true) {
|
||||
EWOL_DEBUG(" find this font : '" << split[jjj] << "'");
|
||||
Log.debug(" find this font : '" << split[jjj] << "'");
|
||||
break;
|
||||
} 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) {
|
||||
EWOL_DEBUG(" find this font : '" << folderList[folderID] << "'");
|
||||
Log.debug(" find this font : '" << folderList[folderID] << "'");
|
||||
break;
|
||||
} 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 :
|
||||
@ -197,7 +197,7 @@ void ewol::resource::TexturedFont::init(const etk::String& _fontName) {
|
||||
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
|
||||
for(int32_t iii=3; iii >= 0; iii--) {
|
||||
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++) {
|
||||
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;
|
||||
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]);
|
||||
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++) {
|
||||
@ -227,7 +227,7 @@ void ewol::resource::TexturedFont::init(const etk::String& _fontName) {
|
||||
}
|
||||
m_height[iiiFontId] = m_font[iiiFontId]->getHeight(m_size);
|
||||
// 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
|
||||
m_data.clear(etk::Color<>(0x00000000));
|
||||
}
|
||||
@ -235,15 +235,15 @@ void ewol::resource::TexturedFont::init(const etk::String& _fontName) {
|
||||
addGlyph(0);
|
||||
// by default we set only the first AINSI char availlable
|
||||
for (int32_t iii=0x20; iii<0x7F; iii++) {
|
||||
EWOL_VERBOSE("Add clyph :" << iii);
|
||||
Log.verbose("Add clyph :" << iii);
|
||||
addGlyph(iii);
|
||||
}
|
||||
flush();
|
||||
EWOL_DEBUG("Wrapping properties : ");
|
||||
EWOL_DEBUG(" " << ewol::font::Regular << " == >" << getWrappingMode(ewol::font::Regular));
|
||||
EWOL_DEBUG(" " << ewol::font::Italic << " == >" << getWrappingMode(ewol::font::Italic));
|
||||
EWOL_DEBUG(" " << ewol::font::Bold << " == >" << getWrappingMode(ewol::font::Bold));
|
||||
EWOL_DEBUG(" " << ewol::font::BoldItalic << " == >" << getWrappingMode(ewol::font::BoldItalic));
|
||||
Log.debug("Wrapping properties : ");
|
||||
Log.debug(" " << ewol::font::Regular << " == >" << getWrappingMode(ewol::font::Regular));
|
||||
Log.debug(" " << ewol::font::Italic << " == >" << getWrappingMode(ewol::font::Italic));
|
||||
Log.debug(" " << ewol::font::Bold << " == >" << getWrappingMode(ewol::font::Bold));
|
||||
Log.debug(" " << ewol::font::BoldItalic << " == >" << getWrappingMode(ewol::font::BoldItalic));
|
||||
}
|
||||
|
||||
ewol::resource::TexturedFont::~TexturedFont() {
|
||||
@ -263,24 +263,24 @@ bool ewol::resource::TexturedFont::addGlyph(const char32_t& _val) {
|
||||
tmpchar.m_UVal = _val;
|
||||
|
||||
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;
|
||||
// change line if needed ...
|
||||
if (m_lastGlyphPos[iii].x()+tmpchar.m_sizeTexture.x()+3 > m_data.getSize().x()) {
|
||||
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;
|
||||
}
|
||||
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);
|
||||
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...
|
||||
for (size_t kkk=0; kkk<4 ; kkk++) {
|
||||
// change the coordonate on the element in the texture
|
||||
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_texturePosSize *= vec2(1.0f, 0.5f);
|
||||
m_listElement[kkk][jjj].m_texturePosStart *= Vector2f(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)
|
||||
// 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 {
|
||||
EWOL_WARNING("Did not find char : '" << _val << "'=" << _val);
|
||||
tmpchar.setNotExist();
|
||||
@ -328,11 +328,11 @@ int32_t ewol::resource::TexturedFont::getIndex(char32_t _charcode, const enum ew
|
||||
return _charcode - 0x1F;
|
||||
} else {
|
||||
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) {
|
||||
//EWOL_DEBUG("search : '" << charcode << "'");
|
||||
//Log.debug("search : '" << charcode << "'");
|
||||
if ((m_listElement[_displayMode])[iii].exist()) {
|
||||
//EWOL_DEBUG("return " << iii);
|
||||
//Log.debug("return " << iii);
|
||||
return iii;
|
||||
} else {
|
||||
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) {
|
||||
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);
|
||||
if( index < 0
|
||||
|| (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) {
|
||||
return &((m_listElement[_displayMode])[0]);
|
||||
}
|
||||
return &m_emptyGlyph;
|
||||
}
|
||||
//EWOL_ERROR(" index=" << index);
|
||||
//EWOL_ERROR(" m_UVal=" << m_listElement[_displayMode][index].m_UVal);
|
||||
//EWOL_ERROR(" m_glyphIndex=" << m_listElement[_displayMode][index].m_glyphIndex);
|
||||
//EWOL_ERROR(" m_advance=" << m_listElement[_displayMode][index].m_advance);
|
||||
//EWOL_ERROR(" m_bearing=" << m_listElement[_displayMode][index].m_bearing);
|
||||
//Log.error(" index=" << index);
|
||||
//Log.error(" m_UVal=" << m_listElement[_displayMode][index].m_UVal);
|
||||
//Log.error(" m_glyphIndex=" << m_listElement[_displayMode][index].m_glyphIndex);
|
||||
//Log.error(" m_advance=" << m_listElement[_displayMode][index].m_advance);
|
||||
//Log.error(" m_bearing=" << m_listElement[_displayMode][index].m_bearing);
|
||||
return &((m_listElement[_displayMode])[index]);
|
||||
}
|
||||
|
||||
|
@ -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
|
||||
public:
|
||||
GlyphProperty m_emptyGlyph;
|
||||
etk::Vector<GlyphProperty> m_listElement[4];
|
||||
List<GlyphProperty> m_listElement[4];
|
||||
private:
|
||||
// for the texture generation :
|
||||
ivec2 m_lastGlyphPos[4];
|
||||
Vector2i m_lastGlyphPos[4];
|
||||
int32_t m_lastRawHeigh[4];
|
||||
protected:
|
||||
TexturedFont();
|
||||
|
@ -32,7 +32,7 @@ namespace ewol {
|
||||
|
||||
virtual bool drawGlyph(egami::Image& _imageOut,
|
||||
int32_t _fontSize,
|
||||
ivec2 _glyphPosition,
|
||||
Vector2i _glyphPosition,
|
||||
ewol::GlyphProperty& _property,
|
||||
int8_t _posInImage) = 0;
|
||||
|
||||
@ -41,12 +41,12 @@ namespace ewol {
|
||||
ewol::GlyphProperty& _property,
|
||||
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 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() {};
|
||||
};
|
||||
|
@ -52,13 +52,13 @@ namespace ewol {
|
||||
bool m_exist;
|
||||
public:
|
||||
int32_t m_glyphIndex; //!< Glyph index in the system
|
||||
ivec2 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)
|
||||
ivec2 m_advance; //!< space use in the display for this specific char
|
||||
vec2 m_texturePosStart; //!< Texture normalized position (START)
|
||||
vec2 m_texturePosSize; //!< Texture normalized position (SIZE)
|
||||
Vector2i m_sizeTexture; //!< size of the element to display
|
||||
Vector2i 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_advance; //!< space use in the display for this specific char
|
||||
Vector2f m_texturePosStart; //!< Texture normalized position (START)
|
||||
Vector2f m_texturePosSize; //!< Texture normalized position (SIZE)
|
||||
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:
|
||||
GlyphProperty() :
|
||||
m_UVal(0),
|
||||
|
@ -43,7 +43,7 @@ namespace ewol {
|
||||
float m_value; //!< kerning real offset
|
||||
public:
|
||||
/**
|
||||
* @brief Simple constructor that allow to allocate the etk::Vector element
|
||||
* @brief Simple constructor that allow to allocate the List element
|
||||
*/
|
||||
Kerning() :
|
||||
m_UVal(0),
|
||||
|
@ -16,7 +16,7 @@
|
||||
void ewol::tools::message::create(enum ewol::tools::message::type _type, const etk::String& _message) {
|
||||
ewol::widget::StdPopUpShared tmpPopUp = widget::StdPopUp::create();
|
||||
if (tmpPopUp == null) {
|
||||
EWOL_ERROR("Can not create a simple pop-up");
|
||||
Log.error("Can not create a simple pop-up");
|
||||
return;
|
||||
}
|
||||
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::widget::WindowsShared windows = context.getWindows();
|
||||
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;
|
||||
}
|
||||
windows->popUpWidgetPush(tmpPopUp);
|
||||
|
@ -61,9 +61,9 @@ ewol::widget::Button::~Button() {
|
||||
void ewol::widget::Button::onChangeSize() {
|
||||
ewol::Padding padding = m_shaper.getPadding();
|
||||
ewol::Padding ret = onChangeSizePadded(padding);
|
||||
//EWOL_DEBUG(" configuring : origin=" << origin << " size=" << subElementSize << "");
|
||||
m_selectableAreaPos = vec2(ret.xLeft(), ret.yButtom());
|
||||
m_selectableAreaSize = m_size - (m_selectableAreaPos + vec2(ret.xRight(), ret.yTop()));
|
||||
//Log.debug(" configuring : origin=" << origin << " size=" << subElementSize << "");
|
||||
m_selectableAreaPos = Vector2f(ret.xLeft(), ret.yButtom());
|
||||
m_selectableAreaSize = m_size - (m_selectableAreaPos + Vector2f(ret.xRight(), ret.yTop()));
|
||||
}
|
||||
|
||||
|
||||
@ -83,15 +83,15 @@ void ewol::widget::Button::onRegenerateDisplay() {
|
||||
return;
|
||||
}
|
||||
ewol::Padding padding = m_shaper.getPadding();
|
||||
m_shaper.setShape(vec2(0,0),
|
||||
m_shaper.setShape(Vector2f(0,0),
|
||||
m_size,
|
||||
vec2ClipInt32(m_selectableAreaPos+vec2(padding.xLeft(),padding.yButtom()) ),
|
||||
vec2ClipInt32(m_selectableAreaSize-vec2(padding.x(),padding.y()) ) );
|
||||
//EWOL_ERROR("pos=" << m_origin << " size=" << m_size);
|
||||
Vector2fClipInt32(m_selectableAreaPos+Vector2f(padding.xLeft(),padding.yButtom()) ),
|
||||
Vector2fClipInt32(m_selectableAreaSize-Vector2f(padding.x(),padding.y()) ) );
|
||||
//Log.error("pos=" << m_origin << " size=" << m_size);
|
||||
}
|
||||
|
||||
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 :
|
||||
if(ewol::widget::Button::lockAccess == *propertyLock) {
|
||||
return false;
|
||||
@ -101,7 +101,7 @@ bool ewol::widget::Button::onEventInput(const ewol::event::Input& _event) {
|
||||
m_mouseHover = false;
|
||||
m_buttonPressed = false;
|
||||
} else {
|
||||
vec2 relativePos = relativePosition(_event.getPos());
|
||||
Vector2f relativePos = relativePosition(_event.getPos());
|
||||
// prevent error from ouside the button
|
||||
if( relativePos.x() < m_selectableAreaPos.x()
|
||||
|| relativePos.y() < m_selectableAreaPos.y()
|
||||
@ -113,17 +113,17 @@ bool ewol::widget::Button::onEventInput(const ewol::event::Input& _event) {
|
||||
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 (_event.getId() == 1) {
|
||||
if(_event.getStatus() == gale::key::status::down) {
|
||||
EWOL_VERBOSE(*propertyName << " : Generate event : " << signalDown);
|
||||
Log.verbose(*propertyName << " : Generate event : " << signalDown);
|
||||
signalDown.emit();
|
||||
m_buttonPressed = true;
|
||||
markToRedraw();
|
||||
}
|
||||
if(_event.getStatus() == gale::key::status::up) {
|
||||
EWOL_VERBOSE(*propertyName << " : Generate event : " << signalUp);
|
||||
Log.verbose(*propertyName << " : Generate event : " << signalUp);
|
||||
signalUp.emit();
|
||||
m_buttonPressed = false;
|
||||
markToRedraw();
|
||||
@ -138,14 +138,14 @@ bool ewol::widget::Button::onEventInput(const ewol::event::Input& _event) {
|
||||
} else {
|
||||
// inverse value :
|
||||
propertyValue.set((*propertyValue)?false:true);
|
||||
EWOL_VERBOSE(*propertyName << " : Generate event : " << signalPressed);
|
||||
Log.verbose(*propertyName << " : Generate event : " << signalPressed);
|
||||
signalPressed.emit();
|
||||
EWOL_VERBOSE(*propertyName << " : Generate event : " << signalValue << " val=" << *propertyValue );
|
||||
Log.verbose(*propertyName << " : Generate event : " << signalValue << " val=" << *propertyValue );
|
||||
signalValue.emit(*propertyValue);
|
||||
if( *propertyToggleMode == false
|
||||
&& *propertyValue == true) {
|
||||
propertyValue.set(false);
|
||||
EWOL_VERBOSE(*propertyName << " : Generate event : " << signalValue << " val=" << *propertyValue);
|
||||
Log.verbose(*propertyName << " : Generate event : " << signalValue << " val=" << *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) {
|
||||
//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
|
||||
&& _event.getStatus() == gale::key::status::down
|
||||
&& _event.getChar() == '\r') {
|
||||
@ -171,7 +171,7 @@ bool ewol::widget::Button::onEventEntry(const ewol::event::Entry& _event) {
|
||||
|
||||
void ewol::widget::Button::onLostFocus() {
|
||||
m_buttonPressed = false;
|
||||
EWOL_VERBOSE(propertyName.get() << " : Remove Focus ...");
|
||||
Log.verbose(propertyName.get() << " : Remove Focus ...");
|
||||
CheckStatus();
|
||||
}
|
||||
|
||||
|
@ -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_buttonPressed; //!< Flag to know if the button is curently pressed.
|
||||
// hover area :
|
||||
vec2 m_selectableAreaPos; //!< Start position of the events
|
||||
vec2 m_selectableAreaSize; //!< size of the event positions
|
||||
Vector2f m_selectableAreaPos; //!< Start position of the events
|
||||
Vector2f m_selectableAreaSize; //!< size of the event positions
|
||||
private:
|
||||
/**
|
||||
* @brief internal system to change the property of the current status
|
||||
|
@ -47,7 +47,7 @@ ewol::widget::ButtonColor::~ButtonColor() {
|
||||
void ewol::widget::ButtonColor::calculateMinMaxSize() {
|
||||
ewol::Padding padding = m_shaper.getPadding();
|
||||
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.setY(padding.y()*2 + minSize.y() );
|
||||
markToRedraw();
|
||||
@ -65,7 +65,7 @@ void ewol::widget::ButtonColor::onRegenerateDisplay() {
|
||||
if (needRedraw() == false) {
|
||||
return;
|
||||
}
|
||||
EWOL_DEBUG("redraw");
|
||||
Log.debug("redraw");
|
||||
m_text.clear();
|
||||
m_shaper.clear();
|
||||
|
||||
@ -73,13 +73,13 @@ void ewol::widget::ButtonColor::onRegenerateDisplay() {
|
||||
|
||||
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,
|
||||
0);
|
||||
// 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,
|
||||
0);
|
||||
|
||||
@ -91,9 +91,9 @@ void ewol::widget::ButtonColor::onRegenerateDisplay() {
|
||||
if (propertyFill->y() == true) {
|
||||
localSize.setY(m_size.y());
|
||||
}
|
||||
tmpOrigin += vec3(padding.xLeft(), padding.yButtom(), 0);
|
||||
tmpTextOrigin += vec3(padding.xLeft(), padding.yButtom(), 0);
|
||||
localSize -= ivec2(padding.x(), padding.y());
|
||||
tmpOrigin += Vector3f(padding.xLeft(), padding.yButtom(), 0);
|
||||
tmpTextOrigin += Vector3f(padding.xLeft(), padding.yButtom(), 0);
|
||||
localSize -= Vector2i(padding.x(), padding.y());
|
||||
|
||||
// clean the element
|
||||
m_text.reset();
|
||||
@ -115,13 +115,13 @@ void ewol::widget::ButtonColor::onRegenerateDisplay() {
|
||||
}
|
||||
|
||||
// selection area :
|
||||
m_selectableAreaPos = vec2(tmpOrigin.x()-padding.xLeft(), tmpOrigin.y()-padding.yButtom());
|
||||
m_selectableAreaSize = localSize + vec2(padding.x(),padding.y());
|
||||
vec3 tmpp = m_text.calculateSize(label);
|
||||
m_selectableAreaPos = Vector2f(tmpOrigin.x()-padding.xLeft(), tmpOrigin.y()-padding.yButtom());
|
||||
m_selectableAreaSize = localSize + Vector2f(padding.x(),padding.y());
|
||||
Vector3f tmpp = m_text.calculateSize(label);
|
||||
m_shaper.setShape(m_selectableAreaPos,
|
||||
m_selectableAreaSize,
|
||||
vec2(tmpTextOrigin.x(), tmpTextOrigin.y()),
|
||||
vec2(tmpp.x(), tmpp.y()));
|
||||
Vector2f(tmpTextOrigin.x(), tmpTextOrigin.y()),
|
||||
Vector2f(tmpp.x(), tmpp.y()));
|
||||
}
|
||||
|
||||
|
||||
@ -131,7 +131,7 @@ bool ewol::widget::ButtonColor::onEventInput(const ewol::event::Input& _event) {
|
||||
m_mouseHover = false;
|
||||
m_buttonPressed = false;
|
||||
} else {
|
||||
vec2 relativePos = relativePosition(_event.getPos());
|
||||
Vector2f relativePos = relativePosition(_event.getPos());
|
||||
// prevent error from ouside the button
|
||||
if( relativePos.x() < m_selectableAreaPos.x()
|
||||
|| relativePos.y() < m_selectableAreaPos.y()
|
||||
@ -144,7 +144,7 @@ bool ewol::widget::ButtonColor::onEventInput(const ewol::event::Input& _event) {
|
||||
}
|
||||
}
|
||||
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 (1 == _event.getId()) {
|
||||
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 :
|
||||
m_widgetContextMenu = ewol::widget::ContextMenu::create();
|
||||
if (m_widgetContextMenu == null) {
|
||||
EWOL_ERROR("Allocation Error");
|
||||
Log.error("Allocation Error");
|
||||
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);
|
||||
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);
|
||||
ewol::widget::WindowsShared currentWindows = getWindows();
|
||||
if (currentWindows == null) {
|
||||
EWOL_ERROR("Can not get the curent Windows...");
|
||||
Log.error("Can not get the curent Windows...");
|
||||
m_widgetContextMenu.reset();
|
||||
} else {
|
||||
currentWindows->popUpWidgetPush(m_widgetContextMenu);
|
||||
|
@ -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_buttonPressed; //!< Flag to know if the button is curently pressed.
|
||||
// hover area :
|
||||
vec2 m_selectableAreaPos; //!< Start position of the events
|
||||
vec2 m_selectableAreaSize; //!< size of the event positions
|
||||
Vector2f m_selectableAreaPos; //!< Start position of the events
|
||||
Vector2f m_selectableAreaSize; //!< size of the event positions
|
||||
protected:
|
||||
/**
|
||||
* @brief Main constructor.
|
||||
|
@ -59,9 +59,9 @@ void ewol::widget::CheckBox::onChangeSize() {
|
||||
float boxSize = m_shaper.getConfigNumber(m_shaperIdSize);
|
||||
padding.setXLeft(padding.xLeft()*2.0f + boxSize);
|
||||
ewol::Padding ret = onChangeSizePadded(padding);
|
||||
EWOL_DEBUG(" configuring : padding=" << padding << " boxSize=" << boxSize << "");
|
||||
m_selectableAreaPos = vec2(ret.xLeft()/*-boxSize*/, ret.yButtom());
|
||||
m_selectableAreaSize = m_size - (m_selectableAreaPos + vec2(ret.xRight(), ret.yTop()));
|
||||
Log.debug(" configuring : padding=" << padding << " boxSize=" << boxSize << "");
|
||||
m_selectableAreaPos = Vector2f(ret.xLeft()/*-boxSize*/, ret.yButtom());
|
||||
m_selectableAreaSize = m_size - (m_selectableAreaPos + Vector2f(ret.xRight(), ret.yTop()));
|
||||
}
|
||||
|
||||
void ewol::widget::CheckBox::calculateMinMaxSize() {
|
||||
@ -88,20 +88,20 @@ void ewol::widget::CheckBox::onRegenerateDisplay() {
|
||||
float boxSize = m_shaper.getConfigNumber(m_shaperIdSize);
|
||||
float boxInside = m_shaper.getConfigNumber(m_shaperIdSizeInsize);
|
||||
m_shaper.clear();
|
||||
EWOL_DEBUG(" configuring : boxSize=" << boxSize << " boxInside=" << boxInside << "");
|
||||
vec2 origin(m_selectableAreaPos + vec2(0, (m_selectableAreaSize.y() - (boxSize+padding.y()))*0.5f));
|
||||
vec2 size = vec2(boxSize+padding.x(), boxSize+padding.y());
|
||||
Log.debug(" configuring : boxSize=" << boxSize << " boxInside=" << boxInside << "");
|
||||
Vector2f origin(m_selectableAreaPos + Vector2f(0, (m_selectableAreaSize.y() - (boxSize+padding.y()))*0.5f));
|
||||
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);
|
||||
vec2 size2 = vec2(boxInside+padding.x(), boxInside+padding.y());
|
||||
m_shaper.setShape(vec2ClipInt32(origin),
|
||||
vec2ClipInt32(size),
|
||||
vec2ClipInt32(origin2+vec2(padding.xLeft(),padding.yButtom()) ),
|
||||
vec2ClipInt32(size2-vec2(padding.x(),padding.y()) ));
|
||||
Vector2f origin2 = m_selectableAreaPos + Vector2f((boxSize-boxInside)*0.5f, (m_selectableAreaSize.y() - (boxInside+padding.y()))*0.5f);
|
||||
Vector2f size2 = Vector2f(boxInside+padding.x(), boxInside+padding.y());
|
||||
m_shaper.setShape(Vector2fClipInt32(origin),
|
||||
Vector2fClipInt32(size),
|
||||
Vector2fClipInt32(origin2+Vector2f(padding.xLeft(),padding.yButtom()) ),
|
||||
Vector2fClipInt32(size2-Vector2f(padding.x(),padding.y()) ));
|
||||
}
|
||||
|
||||
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;
|
||||
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_buttonPressed = false;
|
||||
} else {
|
||||
vec2 relativePos = relativePosition(_event.getPos());
|
||||
Vector2f relativePos = relativePosition(_event.getPos());
|
||||
// prevent error from ouside the button
|
||||
if( relativePos.x() < m_selectableAreaPos.x()
|
||||
|| relativePos.y() < m_selectableAreaPos.y()
|
||||
@ -122,17 +122,17 @@ bool ewol::widget::CheckBox::onEventInput(const ewol::event::Input& _event) {
|
||||
}
|
||||
}
|
||||
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 (_event.getId() == 1) {
|
||||
if(gale::key::status::down == _event.getStatus()) {
|
||||
EWOL_VERBOSE(*propertyName << " : Generate event : " << signalDown);
|
||||
Log.verbose(*propertyName << " : Generate event : " << signalDown);
|
||||
signalDown.emit();
|
||||
m_buttonPressed = true;
|
||||
markToRedraw();
|
||||
}
|
||||
if(gale::key::status::up == _event.getStatus()) {
|
||||
EWOL_VERBOSE(*propertyName << " : Generate event : " << signalUp);
|
||||
Log.verbose(*propertyName << " : Generate event : " << signalUp);
|
||||
signalUp.emit();
|
||||
m_buttonPressed = false;
|
||||
markToRedraw();
|
||||
@ -140,9 +140,9 @@ bool ewol::widget::CheckBox::onEventInput(const ewol::event::Input& _event) {
|
||||
if(gale::key::status::pressSingle == _event.getStatus()) {
|
||||
// inverse value :
|
||||
propertyValue.set((*propertyValue)?false:true);
|
||||
EWOL_VERBOSE(*propertyName << " : Generate event : " << signalPressed);
|
||||
Log.verbose(*propertyName << " : Generate event : " << signalPressed);
|
||||
signalPressed.emit();
|
||||
EWOL_VERBOSE(*propertyName << " : Generate event : " << signalValue << " val=" << propertyValue );
|
||||
Log.verbose(*propertyName << " : Generate event : " << signalValue << " val=" << propertyValue );
|
||||
signalValue.emit(*propertyValue);
|
||||
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) {
|
||||
//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
|
||||
&& _event.getStatus() == gale::key::status::down
|
||||
&& _event.getChar() == '\r') {
|
||||
|
@ -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_buttonPressed; //!< Flag to know if the button is curently pressed.
|
||||
// hover area :
|
||||
vec2 m_selectableAreaPos; //!< Start position of the events
|
||||
vec2 m_selectableAreaSize; //!< size of the event positions
|
||||
Vector2f m_selectableAreaPos; //!< Start position of the events
|
||||
Vector2f m_selectableAreaSize; //!< size of the event positions
|
||||
// shaper ids:
|
||||
int32_t m_shaperIdSize;
|
||||
int32_t m_shaperIdSizeInsize;
|
||||
|
@ -51,7 +51,7 @@ static etk::Color<> s_listColor[NB_BAND_COLOR+1] = {
|
||||
void ewol::widget::ColorBar::onChangePropertyValue() {
|
||||
propertyValue.getDirect().setA(0xFF);
|
||||
// estimate the cursor position:
|
||||
EWOL_TODO("Later when really needed ...");
|
||||
Log.todo("Later when really needed ...");
|
||||
}
|
||||
|
||||
void ewol::widget::ColorBar::onDraw() {
|
||||
@ -89,13 +89,13 @@ void ewol::widget::ColorBar::onRegenerateDisplay() {
|
||||
* ********
|
||||
*/
|
||||
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.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.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();
|
||||
/* Step 2 :
|
||||
* ********
|
||||
@ -105,13 +105,13 @@ void ewol::widget::ColorBar::onRegenerateDisplay() {
|
||||
*
|
||||
*/
|
||||
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.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.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();
|
||||
/* Step 3 :
|
||||
*
|
||||
@ -121,13 +121,13 @@ void ewol::widget::ColorBar::onRegenerateDisplay() {
|
||||
* ********
|
||||
*/
|
||||
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.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.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();
|
||||
/* Step 4 :
|
||||
* ********
|
||||
@ -137,13 +137,13 @@ void ewol::widget::ColorBar::onRegenerateDisplay() {
|
||||
*
|
||||
*/
|
||||
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.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.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();
|
||||
}
|
||||
if (m_currentUserPos.y() > 0.5) {
|
||||
@ -151,15 +151,15 @@ void ewol::widget::ColorBar::onRegenerateDisplay() {
|
||||
} else {
|
||||
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.circle(3.0);
|
||||
}
|
||||
|
||||
|
||||
bool ewol::widget::ColorBar::onEventInput(const ewol::event::Input& _event) {
|
||||
vec2 relativePos = relativePosition(_event.getPos());
|
||||
//EWOL_DEBUG("Event on BT ...");
|
||||
Vector2f relativePos = relativePosition(_event.getPos());
|
||||
//Log.debug("Event on BT ...");
|
||||
if (1 == _event.getId()) {
|
||||
relativePos.setValue( etk::avg(0.0f, m_size.x(),relativePos.x()),
|
||||
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() );
|
||||
markToRedraw();
|
||||
// == > 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));
|
||||
float localPos = relativePos.x() - (m_size.x()/6) * bandID;
|
||||
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;
|
||||
if (s_listColor[bandID].r() == s_listColor[bandID+1].r()) {
|
||||
estimateColor.setR(s_listColor[bandID].r());
|
||||
|
@ -30,7 +30,7 @@ namespace ewol {
|
||||
virtual ~ColorBar();
|
||||
private:
|
||||
ewol::compositing::Drawing m_draw; //!< Compositing drawing element
|
||||
vec2 m_currentUserPos;
|
||||
Vector2f m_currentUserPos;
|
||||
protected:
|
||||
void onDraw() override;
|
||||
public:
|
||||
|
@ -23,7 +23,7 @@ ewol::widget::Composer::Composer() :
|
||||
ewol::WidgetShared ewol::widget::composerGenerateFile(const etk::Uri& _uri, uint64_t _id) {
|
||||
etk::String tmpData;
|
||||
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 ewol::widget::composerGenerateString(tmpData, _id);
|
||||
@ -41,12 +41,12 @@ ewol::WidgetShared ewol::widget::composerGenerateString(const etk::String& _data
|
||||
tmpData.replace("{ID}", etk::toString(_id));
|
||||
}
|
||||
if (doc.parse(tmpData) == false) {
|
||||
EWOL_ERROR(" can not load file XML string...");
|
||||
Log.error(" can not load file XML string...");
|
||||
return null;
|
||||
}
|
||||
exml::Element root = doc.toElement();
|
||||
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;
|
||||
}
|
||||
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();
|
||||
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;
|
||||
}
|
||||
etk::String widgetName = pNode.getValue();
|
||||
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;
|
||||
}
|
||||
EWOL_DEBUG("try to create subwidget : '" << widgetName << "'");
|
||||
Log.debug("try to create subwidget : '" << widgetName << "'");
|
||||
ewol::WidgetShared tmpWidget = widgetManager.create(widgetName);
|
||||
if (tmpWidget == null) {
|
||||
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) {
|
||||
etk::String tmpData;
|
||||
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 loadFromString(tmpData, _id);
|
||||
@ -95,7 +95,7 @@ bool ewol::widget::Composer::loadFromString(const etk::String& _composerXmlStrin
|
||||
tmpData.replace("{ID}", etk::toString(_id));
|
||||
}
|
||||
if (doc.parse(tmpData) == false) {
|
||||
EWOL_ERROR(" can not load file XML string...");
|
||||
Log.error(" can not load file XML string...");
|
||||
return false;
|
||||
}
|
||||
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:
|
||||
root = doc.toElement();
|
||||
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;
|
||||
}
|
||||
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;
|
||||
}
|
||||
}
|
||||
@ -116,7 +116,7 @@ bool ewol::widget::Composer::loadFromString(const etk::String& _composerXmlStrin
|
||||
if (m_subWidget == null) {
|
||||
EWOL_WARNING("Load data from composer and have no under Widget after loading");
|
||||
if (_composerXmlString.size() != 0) {
|
||||
EWOL_ERROR("Error Loading XML data : " << _composerXmlString);
|
||||
Log.error("Error Loading XML data : " << _composerXmlString);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@ -127,26 +127,26 @@ bool ewol::widget::Composer::loadFromString(const etk::String& _composerXmlStrin
|
||||
void ewol::widget::Composer::requestDestroyFromChild(const ewol::ObjectShared& _child) {
|
||||
ewol::widget::Container::requestDestroyFromChild(_child);
|
||||
if (*propertyRemoveIfUnderRemove == true) {
|
||||
EWOL_DEBUG("Child widget remove ==> auto-remove");
|
||||
Log.debug("Child widget remove ==> auto-remove");
|
||||
autoDestroy();
|
||||
}
|
||||
}
|
||||
|
||||
void ewol::widget::Composer::onChangePropertySubFile() {
|
||||
EWOL_INFO("Load compositing form external file : " << propertySubFile);
|
||||
Log.info("Load compositing form external file : " << propertySubFile);
|
||||
if (*propertySubFile == "") {
|
||||
// remove all elements:
|
||||
subWidgetRemove();
|
||||
return;
|
||||
}
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
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) {
|
||||
return false;
|
||||
}
|
||||
@ -154,9 +154,9 @@ bool ewol::widget::Composer::loadXML(const exml::Element& _node) {
|
||||
ewol::Widget::loadXML(_node);
|
||||
// parse all the elements:
|
||||
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();
|
||||
//EWOL_VERBOSE("[" << getId() << "] t=" << getObjectType() << " Load XML (stop)");
|
||||
//Log.verbose("[" << getId() << "] t=" << getObjectType() << " Load XML (stop)");
|
||||
return true;
|
||||
}
|
@ -90,10 +90,10 @@ void ewol::widget::Container::systemDraw(const ewol::DrawProperty& _displayProp)
|
||||
if (m_subWidget != null) {
|
||||
ewol::DrawProperty prop = _displayProp;
|
||||
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);
|
||||
} else {
|
||||
EWOL_INFO("[" << getId() << "] ++++++ : [null]");
|
||||
Log.info("[" << getId() << "] ++++++ : [null]");
|
||||
}
|
||||
}
|
||||
|
||||
@ -105,9 +105,9 @@ void ewol::widget::Container::onChangeSize() {
|
||||
if (m_subWidget == null) {
|
||||
return;
|
||||
}
|
||||
vec2 origin = m_origin+m_offset;
|
||||
vec2 minSize = m_subWidget->getCalculateMinSize();
|
||||
bvec2 expand = m_subWidget->propertyExpand.get();
|
||||
Vector2f origin = m_origin+m_offset;
|
||||
Vector2f minSize = m_subWidget->getCalculateMinSize();
|
||||
Vector2b expand = m_subWidget->propertyExpand.get();
|
||||
origin += ewol::gravityGenerateDelta(propertyGravity.get(), minSize - m_size);
|
||||
m_subWidget->setOrigin(origin);
|
||||
m_subWidget->setSize(m_size);
|
||||
@ -120,10 +120,10 @@ void ewol::widget::Container::calculateMinMaxSize() {
|
||||
// call sub classes
|
||||
if (m_subWidget != null) {
|
||||
m_subWidget->calculateMinMaxSize();
|
||||
vec2 min = m_subWidget->getCalculateMinSize();
|
||||
Vector2f min = m_subWidget->getCalculateMinSize();
|
||||
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() {
|
||||
@ -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 (m_subWidget != null) {
|
||||
return m_subWidget->getWidgetAtPos(_pos);
|
||||
@ -157,16 +157,16 @@ bool ewol::widget::Container::loadXML(const exml::Element& _node) {
|
||||
continue;
|
||||
}
|
||||
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) {
|
||||
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;
|
||||
}
|
||||
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;
|
||||
}
|
||||
EWOL_DEBUG("try to create subwidget : '" << widgetName << "'");
|
||||
Log.debug("try to create subwidget : '" << widgetName << "'");
|
||||
ewol::WidgetShared tmpWidget = getWidgetManager().create(widgetName, pNode);
|
||||
if (tmpWidget == null) {
|
||||
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;
|
||||
}
|
||||
|
||||
void ewol::widget::Container::setOffset(const vec2& _newVal) {
|
||||
void ewol::widget::Container::setOffset(const Vector2f& _newVal) {
|
||||
if (m_offset != _newVal) {
|
||||
ewol::Widget::setOffset(_newVal);
|
||||
// recalculate the new sise and position of sub widget ...
|
||||
|
@ -62,10 +62,10 @@ namespace ewol {
|
||||
void onRegenerateDisplay() override;
|
||||
void onChangeSize() 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;
|
||||
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 drawWidgetTree(int32_t _level=0) override;
|
||||
};
|
||||
|
@ -26,7 +26,7 @@ void ewol::widget::Container2::setSubWidget(ewol::WidgetShared _newWidget, int32
|
||||
subWidgetRemove(_idWidget);
|
||||
m_subWidget[_idWidget] = _newWidget;
|
||||
if (m_subWidget[_idWidget] != null) {
|
||||
EWOL_VERBOSE("Add widget : " << _idWidget);
|
||||
Log.verbose("Add widget : " << _idWidget);
|
||||
m_subWidget[_idWidget]->setParent(sharedFromThis());
|
||||
}
|
||||
markToRedraw();
|
||||
@ -59,7 +59,7 @@ void ewol::widget::Container2::subWidgetReplace(const ewol::WidgetShared& _oldWi
|
||||
|
||||
void ewol::widget::Container2::subWidgetRemove(int32_t _idWidget) {
|
||||
if (m_subWidget[_idWidget] != null) {
|
||||
EWOL_VERBOSE("Remove widget : " << _idWidget);
|
||||
Log.verbose("Remove widget : " << _idWidget);
|
||||
m_subWidget[_idWidget]->removeParent();
|
||||
m_subWidget[_idWidget].reset();
|
||||
markToRedraw();
|
||||
@ -70,7 +70,7 @@ void ewol::widget::Container2::subWidgetRemove(int32_t _idWidget) {
|
||||
void ewol::widget::Container2::subWidgetUnLink(int32_t _idWidget) {
|
||||
if (m_subWidget[_idWidget] != null) {
|
||||
m_subWidget[_idWidget]->removeParent();
|
||||
EWOL_VERBOSE("Unlink widget : " << _idWidget);
|
||||
Log.verbose("Unlink widget : " << _idWidget);
|
||||
}
|
||||
m_subWidget[_idWidget].reset();
|
||||
}
|
||||
@ -99,38 +99,38 @@ void ewol::widget::Container2::systemDraw(const ewol::DrawProperty& _displayProp
|
||||
}
|
||||
ewol::Widget::systemDraw(_displayProp);
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
ewol::Padding ewol::widget::Container2::onChangeSizePadded(const ewol::Padding& _padding) {
|
||||
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:
|
||||
vec2 subElementSize = m_minSize;
|
||||
Vector2f subElementSize = m_minSize;
|
||||
if (propertyFill->x() == true) {
|
||||
subElementSize.setX(m_size.x());
|
||||
}
|
||||
if (propertyFill->y() == true) {
|
||||
subElementSize.setY(m_size.y());
|
||||
}
|
||||
vec2 delta = ewol::gravityGenerateDelta(propertyGravity, m_size - subElementSize);
|
||||
vec2 origin = delta + vec2(_padding.xLeft(), _padding.yButtom());
|
||||
subElementSize -= vec2(_padding.x(), _padding.y());
|
||||
Vector2f delta = ewol::gravityGenerateDelta(propertyGravity, m_size - subElementSize);
|
||||
Vector2f origin = delta + Vector2f(_padding.xLeft(), _padding.yButtom());
|
||||
subElementSize -= Vector2f(_padding.x(), _padding.y());
|
||||
for (size_t iii = 0; iii < 2; ++iii) {
|
||||
if (m_subWidget[iii] != null) {
|
||||
vec2 origin2 = origin+m_offset;
|
||||
vec2 minSize = m_subWidget[iii]->getCalculateMinSize();
|
||||
//bvec2 expand = m_subWidget[iii]->propertyExpand.get();
|
||||
Vector2f origin2 = origin+m_offset;
|
||||
Vector2f minSize = m_subWidget[iii]->getCalculateMinSize();
|
||||
//Vector2b expand = m_subWidget[iii]->propertyExpand.get();
|
||||
origin2 += ewol::gravityGenerateDelta(propertyGravity, minSize - localAvaillable);
|
||||
m_subWidget[iii]->setOrigin(m_origin + origin);
|
||||
m_subWidget[iii]->setSize(subElementSize);
|
||||
m_subWidget[iii]->onChangeSize();
|
||||
}
|
||||
}
|
||||
vec2 selectableAreaPos = origin-vec2(_padding.xLeft(), _padding.yButtom());
|
||||
vec2 selectableAreaEndPos = m_size - (selectableAreaPos + subElementSize + vec2(_padding.x(), _padding.y()));
|
||||
Vector2f selectableAreaPos = origin-Vector2f(_padding.xLeft(), _padding.yButtom());
|
||||
Vector2f selectableAreaEndPos = m_size - (selectableAreaPos + subElementSize + Vector2f(_padding.x(), _padding.y()));
|
||||
markToRedraw();
|
||||
return ewol::Padding(selectableAreaPos.x(),
|
||||
selectableAreaEndPos.y(),
|
||||
@ -140,17 +140,17 @@ ewol::Padding ewol::widget::Container2::onChangeSizePadded(const ewol::Padding&
|
||||
|
||||
void ewol::widget::Container2::calculateMinMaxSizePadded(const ewol::Padding& _padding) {
|
||||
// call main class
|
||||
m_minSize = vec2(0,0);
|
||||
m_minSize = Vector2f(0,0);
|
||||
// call sub classes
|
||||
for (size_t iii = 0; iii < 2; ++iii) {
|
||||
if (m_subWidget[iii] != null) {
|
||||
m_subWidget[iii]->calculateMinMaxSize();
|
||||
vec2 min = m_subWidget[iii]->getCalculateMinSize();
|
||||
Vector2f min = m_subWidget[iii]->getCalculateMinSize();
|
||||
m_minSize.setMax(min);
|
||||
}
|
||||
}
|
||||
// add padding :
|
||||
m_minSize += vec2(_padding.x(), _padding.y());
|
||||
m_minSize += Vector2f(_padding.x(), _padding.y());
|
||||
// verify the min max of the min size ...
|
||||
checkMinSize();
|
||||
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 (m_subWidget[m_idWidgetDisplayed] != null) {
|
||||
return m_subWidget[m_idWidgetDisplayed]->getWidgetAtPos(_pos);
|
||||
@ -180,10 +180,10 @@ bool ewol::widget::Container2::loadXML(const exml::Element& _node) {
|
||||
ewol::Widget::loadXML(_node);
|
||||
// remove previous element :
|
||||
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:
|
||||
for(const auto it : _node.nodes) {
|
||||
EWOL_VERBOSE(" node: " << it);
|
||||
Log.verbose(" node: " << it);
|
||||
exml::Element pNode = it.toElement();
|
||||
if (pNode.exist() == false) {
|
||||
// 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();
|
||||
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;
|
||||
}
|
||||
bool toogleMode=false;
|
||||
if (getSubWidget() != null) {
|
||||
toogleMode=true;
|
||||
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;
|
||||
}
|
||||
}
|
||||
EWOL_DEBUG("try to create subwidget : '" << widgetName << "'");
|
||||
Log.debug("try to create subwidget : '" << widgetName << "'");
|
||||
ewol::WidgetShared tmpWidget = getWidgetManager().create(widgetName, pNode);
|
||||
if (tmpWidget == null) {
|
||||
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;
|
||||
}
|
||||
|
||||
void ewol::widget::Container2::setOffset(const vec2& _newVal) {
|
||||
void ewol::widget::Container2::setOffset(const Vector2f& _newVal) {
|
||||
if (m_offset != _newVal) {
|
||||
ewol::Widget::setOffset(_newVal);
|
||||
// recalculate the new sise and position of sub widget ...
|
||||
|
@ -166,7 +166,7 @@ namespace ewol {
|
||||
}
|
||||
ewol::ObjectShared getSubObjectNamed(const etk::String& _objectName) 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 drawWidgetTree(int32_t _level=0) override;
|
||||
};
|
||||
|
@ -14,7 +14,7 @@ ETK_DECLARE_TYPE(ewol::widget::ContainerN);
|
||||
|
||||
ewol::widget::ContainerN::ContainerN() :
|
||||
propertyLockExpand(this, "lock",
|
||||
vec2(false,false),
|
||||
Vector2f(false,false),
|
||||
"Lock the subwidget expand",
|
||||
&ewol::widget::ContainerN::onChangePropertyLockExpand),
|
||||
m_subExpend(false,false) {
|
||||
@ -27,8 +27,8 @@ ewol::widget::ContainerN::~ContainerN() {
|
||||
}
|
||||
|
||||
|
||||
bvec2 ewol::widget::ContainerN::canExpand() {
|
||||
bvec2 res = propertyExpand.get();
|
||||
Vector2b ewol::widget::ContainerN::canExpand() {
|
||||
Vector2b res = propertyExpand.get();
|
||||
if (propertyLockExpand->x() == false) {
|
||||
if (m_subExpend.x() == true) {
|
||||
res.setX(true);
|
||||
@ -39,7 +39,7 @@ bvec2 ewol::widget::ContainerN::canExpand() {
|
||||
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;
|
||||
}
|
||||
|
||||
@ -73,7 +73,7 @@ void ewol::widget::ContainerN::subWidgetReplace(ewol::WidgetShared _oldWidget,
|
||||
|
||||
int32_t ewol::widget::ContainerN::subWidgetAdd(ewol::WidgetShared _newWidget) {
|
||||
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;
|
||||
}
|
||||
_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) {
|
||||
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;
|
||||
}
|
||||
if (_newWidget != null) {
|
||||
@ -179,7 +179,7 @@ void ewol::widget::ContainerN::systemDraw(const ewol::DrawProperty& _displayProp
|
||||
prop.limit(m_origin, m_size);
|
||||
for (int64_t iii = m_subWidget.size()-1; iii>=0; --iii) {
|
||||
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);
|
||||
}
|
||||
}
|
||||
@ -200,23 +200,23 @@ void ewol::widget::ContainerN::calculateMinMaxSize() {
|
||||
m_subExpend.setValue(false, false);
|
||||
m_minSize.setValue(0,0);
|
||||
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) {
|
||||
if (it != null) {
|
||||
it->calculateMinMaxSize();
|
||||
bvec2 subExpendProp = it->canExpand();
|
||||
Vector2b subExpendProp = it->canExpand();
|
||||
if (true == subExpendProp.x()) {
|
||||
m_subExpend.setX(true);
|
||||
}
|
||||
if (true == subExpendProp.y()) {
|
||||
m_subExpend.setY(true);
|
||||
}
|
||||
vec2 tmpSize = it->getCalculateMinSize();
|
||||
Vector2f tmpSize = it->getCalculateMinSize();
|
||||
m_minSize.setValue( etk::max(tmpSize.x(), m_minSize.x()),
|
||||
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() {
|
||||
@ -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) {
|
||||
return null;
|
||||
}
|
||||
// for all element in the sizer ...
|
||||
for (auto &it : m_subWidget) {
|
||||
if (it != null) {
|
||||
vec2 tmpSize = it->getSize();
|
||||
vec2 tmpOrigin = it->getOrigin();
|
||||
Vector2f tmpSize = it->getSize();
|
||||
Vector2f tmpOrigin = it->getOrigin();
|
||||
if( (tmpOrigin.x() <= _pos.x() && tmpOrigin.x() + tmpSize.x() >= _pos.x())
|
||||
&& (tmpOrigin.y() <= _pos.y() && tmpOrigin.y() + tmpSize.y() >= _pos.y()) )
|
||||
{
|
||||
@ -277,12 +277,12 @@ bool ewol::widget::ContainerN::loadXML(const exml::Element& _node) {
|
||||
continue;
|
||||
}
|
||||
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) {
|
||||
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;
|
||||
}
|
||||
EWOL_DEBUG("[" << getId() << "] {" << getObjectType() << "} load new element : '" << widgetName << "'");
|
||||
Log.debug("[" << getId() << "] {" << getObjectType() << "} load new element : '" << widgetName << "'");
|
||||
ewol::WidgetShared subWidget = getWidgetManager().create(widgetName, pNode);
|
||||
if (subWidget == null) {
|
||||
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);
|
||||
}
|
||||
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;
|
||||
}
|
||||
}
|
||||
@ -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) {
|
||||
ewol::Widget::setOffset(_newVal);
|
||||
// recalculate the new sise and position of sub widget ...
|
||||
|
@ -20,9 +20,9 @@ namespace ewol {
|
||||
*/
|
||||
class ContainerN : public ewol::Widget {
|
||||
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:
|
||||
etk::Vector<ewol::WidgetShared> m_subWidget;
|
||||
List<ewol::WidgetShared> m_subWidget;
|
||||
protected:
|
||||
/**
|
||||
* @brief Constructor
|
||||
@ -34,9 +34,9 @@ namespace ewol {
|
||||
*/
|
||||
virtual ~ContainerN();
|
||||
protected:
|
||||
bvec2 m_subExpend; //!< reference of the sub element expention requested.
|
||||
Vector2b m_subExpend; //!< reference of the sub element expention requested.
|
||||
// herited function
|
||||
virtual bvec2 canExpand() override;
|
||||
virtual Vector2b canExpand() override;
|
||||
public:
|
||||
/**
|
||||
* @brief remove all sub element from the widget.
|
||||
@ -92,10 +92,10 @@ namespace ewol {
|
||||
void onRegenerateDisplay() override;
|
||||
void onChangeSize() 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;
|
||||
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 drawWidgetTree(int32_t _level=0) override;
|
||||
protected:
|
||||
|
@ -22,7 +22,7 @@ ewol::widget::ContextMenu::ContextMenu():
|
||||
"the display name for config file",
|
||||
&ewol::widget::ContextMenu::onChangePropertyShape),
|
||||
propertyArrowPos(this, "arrow-position",
|
||||
vec2(0,0),
|
||||
Vector2f(0,0),
|
||||
"Position of the arrow in the pop-up",
|
||||
&ewol::widget::ContextMenu::onChangePropertyArrowPos),
|
||||
propertyArrawBorder(this, "arrow-mode",
|
||||
@ -59,12 +59,12 @@ void ewol::widget::ContextMenu::onChangeSize() {
|
||||
markToRedraw();
|
||||
// pop-up fill all the display :
|
||||
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) {
|
||||
return;
|
||||
}
|
||||
vec2 subWidgetSize(0,0);
|
||||
vec2 subWidgetOrigin(0,0);
|
||||
Vector2f subWidgetSize(0,0);
|
||||
Vector2f subWidgetOrigin(0,0);
|
||||
subWidgetSize = m_subWidget->getCalculateMinSize();
|
||||
if (m_subWidget->canExpand().x() == true) {
|
||||
subWidgetSize.setX(m_size.x());
|
||||
@ -115,7 +115,7 @@ void ewol::widget::ContextMenu::onChangeSize() {
|
||||
}
|
||||
break;
|
||||
}
|
||||
EWOL_VERBOSE(" == > sub origin=" << subWidgetOrigin << " size=" << subWidgetSize);
|
||||
Log.verbose(" == > sub origin=" << subWidgetOrigin << " size=" << subWidgetSize);
|
||||
m_subWidget->setOrigin(subWidgetOrigin);
|
||||
m_subWidget->setSize(subWidgetSize);
|
||||
m_subWidget->onChangeSize();
|
||||
@ -127,8 +127,8 @@ void ewol::widget::ContextMenu::calculateMinMaxSize() {
|
||||
ewol::widget::Container::calculateMinMaxSize();
|
||||
// add padding of the display
|
||||
ewol::Padding padding = m_shaper.getPadding();
|
||||
m_minSize += vec2(padding.x(), padding.y());
|
||||
//EWOL_DEBUG("CalculateMinSize=>>" << m_minSize);
|
||||
m_minSize += Vector2f(padding.x(), padding.y());
|
||||
//Log.debug("CalculateMinSize=>>" << m_minSize);
|
||||
markToRedraw();
|
||||
}
|
||||
|
||||
@ -152,57 +152,57 @@ void ewol::widget::ContextMenu::onRegenerateDisplay() {
|
||||
if (m_subWidget == null) {
|
||||
return;
|
||||
}
|
||||
vec2 tmpSize = m_subWidget->getSize();
|
||||
vec2 tmpOrigin = m_subWidget->getOrigin();
|
||||
Vector2f tmpSize = m_subWidget->getSize();
|
||||
Vector2f tmpOrigin = m_subWidget->getOrigin();
|
||||
|
||||
// display border ...
|
||||
m_compositing.setColor(m_colorBorder);
|
||||
switch (propertyArrawBorder) {
|
||||
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();
|
||||
if (propertyArrowPos->x() <= tmpOrigin.x() ) {
|
||||
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.setPos(vec3(propertyArrowPos->x(), propertyArrowPos->y()-laking, 0.0f) );
|
||||
m_compositing.setPos(Vector3f(propertyArrowPos->x(), propertyArrowPos->y()-laking, 0.0f) );
|
||||
m_compositing.addVertex();
|
||||
} else {
|
||||
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.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();
|
||||
}
|
||||
break;
|
||||
case markButtom:
|
||||
m_compositing.setPos(vec3(propertyArrowPos->x(), propertyArrowPos->y(), 0) );
|
||||
m_compositing.setPos(Vector3f(propertyArrowPos->x(), propertyArrowPos->y(), 0) );
|
||||
m_compositing.addVertex();
|
||||
if (propertyArrowPos->x() <= tmpOrigin.x() ) {
|
||||
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.setPos(vec3(propertyArrowPos->x(), propertyArrowPos->y()+laking, 0.0f) );
|
||||
m_compositing.setPos(Vector3f(propertyArrowPos->x(), propertyArrowPos->y()+laking, 0.0f) );
|
||||
m_compositing.addVertex();
|
||||
} else {
|
||||
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.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();
|
||||
}
|
||||
break;
|
||||
default:
|
||||
case markRight:
|
||||
case markLeft:
|
||||
EWOL_TODO("later");
|
||||
Log.todo("later");
|
||||
break;
|
||||
}
|
||||
|
||||
vec2 shaperOrigin = tmpOrigin-vec2(padding.xLeft(), padding.yButtom());
|
||||
vec2 shaperSize = tmpSize+vec2(padding.x(), padding.y());
|
||||
m_shaper.setShape(vec2ClipInt32(shaperOrigin),
|
||||
vec2ClipInt32(shaperSize));
|
||||
Vector2f shaperOrigin = tmpOrigin-Vector2f(padding.xLeft(), padding.yButtom());
|
||||
Vector2f shaperSize = tmpSize+Vector2f(padding.x(), padding.y());
|
||||
m_shaper.setShape(Vector2fClipInt32(shaperOrigin),
|
||||
Vector2fClipInt32(shaperSize));
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
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);
|
||||
if (val != null) {
|
||||
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();
|
||||
vec2 globalSize = windows->getSize();
|
||||
Vector2f globalSize = windows->getSize();
|
||||
// TODO : Support left and right
|
||||
float upperSize = globalSize.y() - (_origin.y() + _size.y());
|
||||
float underSize = _origin.y();
|
||||
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);
|
||||
} 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);
|
||||
}
|
||||
}
|
||||
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);
|
||||
propertyArrowPos.set(_arrowPos);
|
||||
}
|
||||
|
@ -32,7 +32,7 @@ namespace ewol {
|
||||
};
|
||||
public: // properties
|
||||
eproperty::Value<etk::Uri> propertyShape; //!< shape of the widget.
|
||||
eproperty::Value<vec2> propertyArrowPos;
|
||||
eproperty::Value<Vector2f> propertyArrowPos;
|
||||
eproperty::List<enum markPosition> propertyArrawBorder;
|
||||
protected:
|
||||
ContextMenu();
|
||||
@ -50,8 +50,8 @@ namespace ewol {
|
||||
|
||||
float m_offset;
|
||||
public:
|
||||
void setPositionMarkAuto(const vec2& _origin, const vec2& _size);
|
||||
void setPositionMark(enum markPosition _position, const vec2& _arrowPos);
|
||||
void setPositionMarkAuto(const Vector2f& _origin, const Vector2f& _size);
|
||||
void setPositionMark(enum markPosition _position, const Vector2f& _arrowPos);
|
||||
protected:
|
||||
void onDraw() override;
|
||||
public:
|
||||
@ -59,7 +59,7 @@ namespace ewol {
|
||||
bool onEventInput(const ewol::event::Input& _event) override;
|
||||
void onChangeSize() override;
|
||||
void calculateMinMaxSize() override;
|
||||
ewol::WidgetShared getWidgetAtPos(const vec2& _pos) override;
|
||||
ewol::WidgetShared getWidgetAtPos(const Vector2f& _pos) override;
|
||||
protected:
|
||||
virtual void onChangePropertyArrowPos();
|
||||
virtual void onChangePropertyArrawBorder();
|
||||
|
@ -61,7 +61,7 @@ void ewol::widget::Entry::init() {
|
||||
|
||||
m_regex.compile(propertyRegex.get());
|
||||
if (m_regex.getStatus() == false) {
|
||||
EWOL_ERROR("can not parse regex for : " << propertyRegex);
|
||||
Log.error("can not parse regex for : " << propertyRegex);
|
||||
}
|
||||
markToRedraw();
|
||||
|
||||
@ -104,9 +104,9 @@ void ewol::widget::Entry::calculateMinMaxSize() {
|
||||
// get generic padding
|
||||
ewol::Padding padding = m_shaper.getPadding();
|
||||
int32_t minHeight = m_text.calculateSize(char32_t('A')).y();
|
||||
vec2 minimumSizeBase(20, minHeight);
|
||||
Vector2f minimumSizeBase(20, minHeight);
|
||||
// add padding :
|
||||
minimumSizeBase += vec2(padding.x(), padding.y());
|
||||
minimumSizeBase += Vector2f(padding.x(), padding.y());
|
||||
m_minSize.setMax(minimumSizeBase);
|
||||
// verify the min max of the min size ...
|
||||
checkMinSize();
|
||||
@ -132,7 +132,7 @@ void ewol::widget::Entry::onRegenerateDisplay() {
|
||||
updateTextPosition();
|
||||
ewol::Padding padding = m_shaper.getPadding();
|
||||
|
||||
vec2 tmpSizeShaper = m_minSize;
|
||||
Vector2f tmpSizeShaper = m_minSize;
|
||||
if (propertyFill->x() == true) {
|
||||
tmpSizeShaper.setX(m_size.x());
|
||||
}
|
||||
@ -140,23 +140,23 @@ void ewol::widget::Entry::onRegenerateDisplay() {
|
||||
tmpSizeShaper.setY(m_size.y());
|
||||
}
|
||||
|
||||
vec2 tmpOriginShaper = (m_size - tmpSizeShaper) / 2.0f;
|
||||
vec2 tmpSizeText = tmpSizeShaper - vec2(padding.x(), padding.y());
|
||||
vec2 tmpOriginText = (m_size - tmpSizeText) / 2.0f;
|
||||
Vector2f tmpOriginShaper = (m_size - tmpSizeShaper) / 2.0f;
|
||||
Vector2f tmpSizeText = tmpSizeShaper - Vector2f(padding.x(), padding.y());
|
||||
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 ...
|
||||
int32_t minHeight = m_text.calculateSize(char32_t('A')).y();
|
||||
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:
|
||||
tmpSizeShaper = vec2ClipInt32(tmpSizeShaper);
|
||||
tmpOriginShaper = vec2ClipInt32(tmpOriginShaper);
|
||||
tmpSizeText = vec2ClipInt32(tmpSizeText);
|
||||
tmpOriginText = vec2ClipInt32(tmpOriginText);
|
||||
tmpSizeShaper = Vector2fClipInt32(tmpSizeShaper);
|
||||
tmpOriginShaper = Vector2fClipInt32(tmpOriginShaper);
|
||||
tmpSizeText = Vector2fClipInt32(tmpSizeText);
|
||||
tmpOriginText = Vector2fClipInt32(tmpOriginText);
|
||||
|
||||
m_text.reset();
|
||||
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) {
|
||||
m_text.setCursorSelection(m_displayCursorPos, m_displayCursorPosSelection);
|
||||
} 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();
|
||||
|
||||
vec2 relPos = relativePosition(_pos);
|
||||
Vector2f relPos = relativePosition(_pos);
|
||||
relPos.setX(relPos.x()-m_displayStartPosition - padding.xLeft());
|
||||
// try to find the new cursor position :
|
||||
etk::String tmpDisplay = etk::String(propertyValue, 0, m_displayStartPosition);
|
||||
int32_t displayHidenSize = m_text.calculateSize(tmpDisplay).x();
|
||||
//EWOL_DEBUG("hidenSize : " << displayHidenSize);
|
||||
//Log.debug("hidenSize : " << displayHidenSize);
|
||||
int32_t newCursorPosition = -1;
|
||||
int32_t tmpTextOriginX = padding.xLeft();
|
||||
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;
|
||||
}
|
||||
} 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) {
|
||||
EWOL_INFO("Reject data for entry : '" << _event.getChar() << "'");
|
||||
Log.info("Reject data for entry : '" << _event.getChar() << "'");
|
||||
} else {
|
||||
etk::String newData = propertyValue;
|
||||
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 (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;
|
||||
}
|
||||
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;
|
||||
}
|
||||
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;
|
||||
}
|
||||
*/
|
||||
@ -525,7 +525,7 @@ void ewol::widget::Entry::updateTextPosition() {
|
||||
int32_t pixelCursorPos = m_text.calculateSize(tmpDisplay).x();
|
||||
// check if the Cussor is visible at 10px nearest the border :
|
||||
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) {
|
||||
// set the cursor on le left
|
||||
m_displayStartPosition = etk::min(-pixelCursorPos+10, 0);
|
||||
@ -582,14 +582,14 @@ void ewol::widget::Entry::onChangePropertyValue() {
|
||||
etk::String newData = propertyValue.get();
|
||||
if ((int64_t)newData.size() > 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 ...
|
||||
setInternalValue(newData);
|
||||
if (newData == propertyValue.get()) {
|
||||
m_displayCursorPos = propertyValue->size();
|
||||
m_displayCursorPosSelection = m_displayCursorPos;
|
||||
EWOL_VERBOSE("Set : '" << newData << "'");
|
||||
Log.verbose("Set : '" << newData << "'");
|
||||
}
|
||||
markToRedraw();
|
||||
}
|
||||
@ -601,7 +601,7 @@ void ewol::widget::Entry::onChangePropertyMaxCharacter() {
|
||||
void ewol::widget::Entry::onChangePropertyRegex() {
|
||||
m_regex.compile(propertyRegex.get());
|
||||
if (m_regex.getStatus() == false) {
|
||||
EWOL_ERROR("can not parse regex for : " << propertyRegex);
|
||||
Log.error("can not parse regex for : " << propertyRegex);
|
||||
}
|
||||
markToRedraw();
|
||||
}
|
||||
|
@ -92,7 +92,7 @@ namespace ewol {
|
||||
* @param[in] _pos Absolute position of the event
|
||||
* @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:
|
||||
/**
|
||||
* @brief Copy the selected data on the specify clipboard
|
||||
|
@ -21,18 +21,18 @@ ewol::widget::Gird::Gird() :
|
||||
}
|
||||
|
||||
ewol::widget::Gird::~Gird() {
|
||||
EWOL_DEBUG("[" << getId() << "]={" << getObjectType() << "} Gird : destroy");
|
||||
Log.debug("[" << getId() << "]={" << getObjectType() << "} Gird : destroy");
|
||||
subWidgetRemoveAll();
|
||||
}
|
||||
|
||||
void ewol::widget::Gird::setBorderSize(const ivec2& _newBorderSize) {
|
||||
void ewol::widget::Gird::setBorderSize(const Vector2i& _newBorderSize) {
|
||||
m_borderSize = _newBorderSize;
|
||||
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);
|
||||
}
|
||||
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);
|
||||
}
|
||||
markToRedraw();
|
||||
@ -40,15 +40,15 @@ void ewol::widget::Gird::setBorderSize(const ivec2& _newBorderSize) {
|
||||
}
|
||||
|
||||
void ewol::widget::Gird::onChangeSize() {
|
||||
//EWOL_DEBUG("Update size");
|
||||
//Log.debug("Update size");
|
||||
m_size -= m_borderSize*2;
|
||||
|
||||
for (size_t iii=0; iii<m_subWidget.size(); iii++) {
|
||||
if (m_subWidget[iii].widget != null) {
|
||||
//calculate the origin :
|
||||
vec2 tmpOrigin = m_origin + m_borderSize;
|
||||
Vector2f tmpOrigin = m_origin + m_borderSize;
|
||||
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;
|
||||
@ -62,18 +62,18 @@ void ewol::widget::Gird::onChangeSize() {
|
||||
} else {
|
||||
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 :
|
||||
m_subWidget[iii].widget->setOrigin(vec2ClipInt32(tmpOrigin));
|
||||
m_subWidget[iii].widget->setOrigin(Vector2fClipInt32(tmpOrigin));
|
||||
// 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_size += m_borderSize*2;
|
||||
EWOL_DEBUG("Calculate size : " << m_size);
|
||||
Log.debug("Calculate size : " << m_size);
|
||||
markToRedraw();
|
||||
}
|
||||
|
||||
@ -83,7 +83,7 @@ void ewol::widget::Gird::calculateMinMaxSize() {
|
||||
m_sizeCol[iii] = 0;
|
||||
}
|
||||
}
|
||||
//EWOL_DEBUG("Update minimum size");
|
||||
//Log.debug("Update minimum size");
|
||||
m_minSize = propertyMinSize->getPixel();
|
||||
m_maxSize = propertyMaxSize->getPixel();
|
||||
m_uniformSizeRow = 0;
|
||||
@ -96,8 +96,8 @@ void ewol::widget::Gird::calculateMinMaxSize() {
|
||||
}
|
||||
if (m_subWidget[iii].widget != null) {
|
||||
m_subWidget[iii].widget->calculateMinMaxSize();
|
||||
vec2 tmpSize = m_subWidget[iii].widget->getCalculateMinSize();
|
||||
EWOL_DEBUG(" [" << iii << "] subWidgetMinSize=" << tmpSize);
|
||||
Vector2f tmpSize = m_subWidget[iii].widget->getCalculateMinSize();
|
||||
Log.debug(" [" << iii << "] subWidgetMinSize=" << tmpSize);
|
||||
// for all we get the max size :
|
||||
m_uniformSizeRow = etk::max((int32_t)tmpSize.y(), m_uniformSizeRow);
|
||||
// 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++ ){
|
||||
tmpSizeWidth += abs(m_sizeCol[iii]);
|
||||
}
|
||||
EWOL_DEBUG(" tmpSizeWidth=" << tmpSizeWidth);
|
||||
EWOL_DEBUG(" m_uniformSizeRow=" << m_uniformSizeRow);
|
||||
m_minSize += ivec2(tmpSizeWidth, (lastLineID+1)*m_uniformSizeRow);
|
||||
Log.debug(" tmpSizeWidth=" << tmpSizeWidth);
|
||||
Log.debug(" m_uniformSizeRow=" << 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) {
|
||||
@ -134,7 +134,7 @@ void ewol::widget::Gird::setColNumber(int32_t _colNumber) {
|
||||
m_subWidget[iii].widget.reset();
|
||||
// no remove, this element is removed with the function onObjectRemove == > it does not exist anymore ...
|
||||
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 {
|
||||
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) {
|
||||
m_sizeCol[_colId] = _size;
|
||||
} 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 "
|
||||
<< m_sizeCol.size() << " colomn");
|
||||
}
|
||||
@ -174,7 +174,7 @@ int32_t ewol::widget::Gird::getColSize(int32_t _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;
|
||||
}
|
||||
|
||||
@ -219,7 +219,7 @@ void ewol::widget::Gird::subWidgetAdd(int32_t _colId, int32_t _rowId, ewol::Widg
|
||||
if (m_tmpWidget != null) {
|
||||
m_tmpWidget.reset();
|
||||
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;
|
||||
}
|
||||
}
|
||||
@ -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) {
|
||||
return null;
|
||||
}
|
||||
@ -313,8 +313,8 @@ ewol::WidgetShared ewol::widget::Gird::getWidgetAtPos(const vec2& _pos) {
|
||||
if (it.widget == null) {
|
||||
continue;
|
||||
}
|
||||
vec2 tmpSize = it.widget->getSize();
|
||||
vec2 tmpOrigin = it.widget->getOrigin();
|
||||
Vector2f tmpSize = it.widget->getSize();
|
||||
Vector2f tmpOrigin = it.widget->getOrigin();
|
||||
if( (tmpOrigin.x() <= _pos.x() && tmpOrigin.x() + tmpSize.x() >= _pos.x())
|
||||
&& (tmpOrigin.y() <= _pos.y() && tmpOrigin.y() + tmpSize.y() >= _pos.y()) ) {
|
||||
ewol::WidgetShared tmpWidget = it.widget->getWidgetAtPos(_pos);
|
||||
|
@ -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_uniformSizeRow;
|
||||
etk::Vector<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<int32_t> m_sizeCol; //!< size of all colomn (if set (otherwise 0))
|
||||
List<GirdProperties> m_subWidget; //!< all sub widget are contained in this element
|
||||
ewol::WidgetShared m_tmpWidget; //!< use when replace a widget ...
|
||||
bool m_gavityButtom;
|
||||
protected:
|
||||
@ -121,24 +121,24 @@ namespace ewol {
|
||||
virtual void subWidgetUnLink(int32_t _colId, int32_t _rowId);
|
||||
private:
|
||||
// TODO : property
|
||||
ivec2 m_borderSize; //!< Border size needed for all the display
|
||||
Vector2i m_borderSize; //!< Border size needed for all the display
|
||||
public:
|
||||
/**
|
||||
* @brief set the current border size of the current element:
|
||||
* @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:
|
||||
* @return the border size (0 if not used)
|
||||
*/
|
||||
const ivec2& getBorderSize() {
|
||||
const Vector2i& getBorderSize() {
|
||||
return m_borderSize;
|
||||
};
|
||||
public:
|
||||
virtual void systemDraw(const ewol::DrawProperty& _displayProp) 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 calculateMinMaxSize() override;
|
||||
};
|
||||
|
@ -16,18 +16,18 @@ ETK_DECLARE_TYPE(ewol::widget::Image);
|
||||
ewol::widget::Image::Image() :
|
||||
signalPressed(this, "pressed", "Image is pressed"),
|
||||
propertySource(this, "src", "", "Image source path", &ewol::widget::Image::onChangePropertySource),
|
||||
propertyBorder(this, "border", vec2(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),
|
||||
propertyBorder(this, "border", Vector2f(0,0), "Border 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),
|
||||
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),
|
||||
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),
|
||||
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", 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),
|
||||
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),
|
||||
m_colorProperty(null),
|
||||
m_colorId(-1) {
|
||||
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"));
|
||||
if (m_colorProperty != null) {
|
||||
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) {
|
||||
EWOL_VERBOSE("Set Image : " << _uri << " border=" << _border);
|
||||
Log.verbose("Set Image : " << _uri << " border=" << _border);
|
||||
propertyBorder.set(_border);
|
||||
propertySource.set(_uri);
|
||||
}
|
||||
@ -72,16 +72,16 @@ void ewol::widget::Image::onRegenerateDisplay() {
|
||||
m_compositing.setColor(m_colorProperty->get(m_colorId));
|
||||
}
|
||||
// Calculate the new position and size:
|
||||
vec2 imageBoder = propertyBorder->getPixel();
|
||||
vec2 origin = imageBoder;
|
||||
Vector2f imageBoder = propertyBorder->getPixel();
|
||||
Vector2f origin = imageBoder;
|
||||
imageBoder *= 2.0f;
|
||||
vec2 imageRealSize = m_imageRenderSize - imageBoder;
|
||||
vec2 imageRealSizeMax = m_size - imageBoder;
|
||||
Vector2f imageRealSize = m_imageRenderSize - imageBoder;
|
||||
Vector2f imageRealSizeMax = m_size - imageBoder;
|
||||
|
||||
vec2 ratioSizeDisplayRequested = *propertyPosStop - *propertyPosStart;
|
||||
Vector2f ratioSizeDisplayRequested = *propertyPosStop - *propertyPosStart;
|
||||
//imageRealSizeMax *= ratioSizeDisplayRequested;
|
||||
|
||||
vec2 delta = ewol::gravityGenerateDelta(*propertyGravity, m_size-m_imageRenderSize);
|
||||
Vector2f delta = ewol::gravityGenerateDelta(*propertyGravity, m_size-m_imageRenderSize);
|
||||
if (propertyFill->x() == true) {
|
||||
imageRealSize.setX(imageRealSizeMax.x());
|
||||
delta.setX(0.0);
|
||||
@ -93,7 +93,7 @@ void ewol::widget::Image::onRegenerateDisplay() {
|
||||
origin += delta;
|
||||
|
||||
if (*propertyKeepRatio == true) {
|
||||
vec2 tmpSize = m_compositing.getRealSize();
|
||||
Vector2f tmpSize = m_compositing.getRealSize();
|
||||
//float ratio = tmpSize.x() / tmpSize.y();
|
||||
float ratio = (tmpSize.x()*ratioSizeDisplayRequested.x()) / (tmpSize.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) {
|
||||
float oldX = imageRealSize.x();
|
||||
imageRealSize.setX(imageRealSize.y()*ratio);
|
||||
origin += vec2((oldX - imageRealSize.x()) * 0.5f, 0);
|
||||
origin += Vector2f((oldX - imageRealSize.x()) * 0.5f, 0);
|
||||
} else {
|
||||
float oldY = imageRealSize.y();
|
||||
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) {
|
||||
m_compositing.setPos(origin);
|
||||
} else {
|
||||
m_compositing.setPos(ivec2(origin));
|
||||
m_compositing.setPos(Vector2i(origin));
|
||||
}
|
||||
m_compositing.printPart(imageRealSize, *propertyPosStart, *propertyPosStop);
|
||||
EWOL_DEBUG("Paint Image at : " << origin << " size=" << imageRealSize);
|
||||
EWOL_DEBUG("Paint Image :" << *propertySource << " realsize=" << m_compositing.getRealSize() << " origin=" << origin << " size=" << imageRealSize);
|
||||
EWOL_DEBUG(" start=" << *propertyPosStart << " stop=" << *propertyPosStop);
|
||||
Log.debug("Paint Image at : " << origin << " size=" << imageRealSize);
|
||||
Log.debug("Paint Image :" << *propertySource << " realsize=" << m_compositing.getRealSize() << " origin=" << origin << " size=" << imageRealSize);
|
||||
Log.debug(" start=" << *propertyPosStart << " stop=" << *propertyPosStop);
|
||||
}
|
||||
|
||||
void ewol::widget::Image::calculateMinMaxSize() {
|
||||
EWOL_DEBUG("calculate min size: border=" << propertyBorder << " size=" << propertyImageSize << " min-size=" << propertyMinSize);
|
||||
vec2 imageBoder = propertyBorder->getPixel()*2.0f;
|
||||
vec2 imageSize = propertyImageSize->getPixel();
|
||||
vec2 size = propertyMinSize->getPixel();
|
||||
EWOL_DEBUG(" ==> border=" << imageBoder << " size=" << imageSize << " min-size=" << size);
|
||||
if (imageSize != vec2(0,0)) {
|
||||
Log.debug("calculate min size: border=" << propertyBorder << " size=" << propertyImageSize << " min-size=" << propertyMinSize);
|
||||
Vector2f imageBoder = propertyBorder->getPixel()*2.0f;
|
||||
Vector2f imageSize = propertyImageSize->getPixel();
|
||||
Vector2f size = propertyMinSize->getPixel();
|
||||
Log.debug(" ==> border=" << imageBoder << " size=" << imageSize << " min-size=" << size);
|
||||
if (imageSize != Vector2f(0,0)) {
|
||||
m_minSize = imageBoder+imageSize;
|
||||
m_maxSize = m_minSize;
|
||||
} else {
|
||||
vec2 imageSizeReal = m_compositing.getRealSize();
|
||||
EWOL_VERBOSE(" Real Size = " << imageSizeReal);
|
||||
vec2 min1 = imageBoder+propertyMinSize->getPixel();
|
||||
Vector2f imageSizeReal = m_compositing.getRealSize();
|
||||
Log.verbose(" Real Size = " << imageSizeReal);
|
||||
Vector2f min1 = imageBoder+propertyMinSize->getPixel();
|
||||
m_minSize = imageBoder+imageSizeReal;
|
||||
EWOL_VERBOSE(" set max : " << m_minSize << " min1=" << min1);
|
||||
Log.verbose(" set max : " << m_minSize << " min1=" << min1);
|
||||
m_minSize.setMax(min1);
|
||||
EWOL_VERBOSE(" result : " << m_minSize);
|
||||
Log.verbose(" result : " << m_minSize);
|
||||
m_maxSize = imageBoder+propertyMaxSize->getPixel();
|
||||
m_minSize.setMin(m_maxSize);
|
||||
}
|
||||
m_imageRenderSize = m_minSize;
|
||||
m_minSize.setMax(size);
|
||||
m_maxSize.setMax(m_minSize);
|
||||
EWOL_DEBUG("set widget min=" << m_minSize << " max=" << m_maxSize << " with real Image size=" << 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();
|
||||
}
|
||||
|
||||
|
||||
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(gale::key::status::pressSingle == _event.getStatus()) {
|
||||
signalPressed.emit();
|
||||
@ -181,9 +181,9 @@ bool ewol::widget::Image::loadXML(const exml::Element& _node) {
|
||||
}
|
||||
tmpAttributeValue = _node.attributes["size"];
|
||||
if (tmpAttributeValue.size() != 0) {
|
||||
//EWOL_CRITICAL(" Parse SIZE : " << tmpAttributeValue);
|
||||
//Log.critical(" Parse SIZE : " << tmpAttributeValue);
|
||||
propertyImageSize.setDirect(tmpAttributeValue);
|
||||
//EWOL_CRITICAL(" == > " << propertyImageSize);
|
||||
//Log.critical(" == > " << propertyImageSize);
|
||||
}
|
||||
tmpAttributeValue = _node.attributes["border"];
|
||||
if (tmpAttributeValue.size() != 0) {
|
||||
@ -193,7 +193,7 @@ bool ewol::widget::Image::loadXML(const exml::Element& _node) {
|
||||
if (tmpAttributeValue.size() != 0) {
|
||||
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) {
|
||||
propertySource.set(_node.getText());
|
||||
} else {
|
||||
@ -208,14 +208,14 @@ bool ewol::widget::Image::loadXML(const exml::Element& _node) {
|
||||
void ewol::widget::Image::onChangePropertySource() {
|
||||
markToRedraw();
|
||||
requestUpdateSize();
|
||||
EWOL_VERBOSE("Set sources : " << *propertySource << " size=" << *propertyImageSize);
|
||||
Log.verbose("Set sources : " << *propertySource << " size=" << *propertyImageSize);
|
||||
m_compositing.setSource(*propertySource, propertyImageSize->getPixel());
|
||||
}
|
||||
|
||||
void ewol::widget::Image::onChangePropertyImageSize() {
|
||||
markToRedraw();
|
||||
requestUpdateSize();
|
||||
EWOL_VERBOSE("Set sources : " << *propertySource << " size=" << *propertyImageSize);
|
||||
Log.verbose("Set sources : " << *propertySource << " size=" << *propertyImageSize);
|
||||
m_compositing.setSource(*propertySource, propertyImageSize->getPixel());
|
||||
}
|
||||
|
||||
|
@ -29,8 +29,8 @@ namespace ewol {
|
||||
eproperty::Value<gale::Dimension> propertyBorder; //!< 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::Range<vec2> 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> propertyPosStart; //!< 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> 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
|
||||
@ -62,7 +62,7 @@ namespace ewol {
|
||||
*/
|
||||
void setCustumSource(const egami::Image& _image);
|
||||
protected:
|
||||
vec2 m_imageRenderSize; //!< size of the image when we render it
|
||||
Vector2f m_imageRenderSize; //!< size of the image when we render it
|
||||
protected:
|
||||
void onDraw() override;
|
||||
public:
|
||||
|
@ -105,7 +105,7 @@ bool ewol::widget::Joystick::onEventInput(const ewol::event::Input& _event) {
|
||||
if( gale::key::status::down == typeEvent
|
||||
|| gale::key::status::move == typeEvent) {
|
||||
// get local relative position
|
||||
vec2 relativePos = relativePosition(pos);
|
||||
Vector2f relativePos = relativePosition(pos);
|
||||
float sizeElement = m_size.x*m_ratio;
|
||||
// calculate the position of the cursor...
|
||||
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);
|
||||
}
|
||||
//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;
|
||||
} else if( gale::key::status::up == typeEvent) {
|
||||
if( true == m_lock
|
||||
@ -163,7 +163,7 @@ void ewol::widget::Joystick::ratio(float _newRatio) {
|
||||
_newRatio = 1;
|
||||
}
|
||||
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
|
||||
m_background = _imageNameInData;
|
||||
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) {
|
||||
// TODO : check if it existed
|
||||
m_foreground = imageNameInData;
|
||||
EWOL_INFO("Set default Joystick Foreground at " << m_foreground);
|
||||
Log.info("Set default Joystick Foreground at " << m_foreground);
|
||||
}
|
||||
|
||||
|
||||
|
@ -26,7 +26,7 @@ namespace ewol {
|
||||
// Event list of properties
|
||||
esignal::Signal<> signalEnable;
|
||||
esignal::Signal<> signalDisable;
|
||||
esignal::Signal<vec2> signalMove;
|
||||
esignal::Signal<Vector2f> signalMove;
|
||||
public:
|
||||
enum joystickMode {
|
||||
modeNormal,
|
||||
@ -35,7 +35,7 @@ namespace ewol {
|
||||
private:
|
||||
etk::Color<> m_colorFg; //!< Forground 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_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
|
||||
|
@ -53,19 +53,19 @@ void ewol::widget::Label::init() {
|
||||
|
||||
|
||||
void ewol::widget::Label::calculateMinMaxSize() {
|
||||
vec2 tmpMax = propertyMaxSize->getPixel();
|
||||
vec2 tmpMin = propertyMinSize->getPixel();
|
||||
//EWOL_DEBUG("[" << getId() << "] {" << getObjectType() << "} tmpMax : " << tmpMax);
|
||||
Vector2f tmpMax = propertyMaxSize->getPixel();
|
||||
Vector2f tmpMin = propertyMinSize->getPixel();
|
||||
//Log.debug("[" << getId() << "] {" << getObjectType() << "} tmpMax : " << tmpMax);
|
||||
if (tmpMax.x() <= 999999) {
|
||||
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);
|
||||
//EWOL_DEBUG("[" << getId() << "] {" << getObjectType() << "} minSize : " << minSize);
|
||||
Vector3f minSize = m_text.calculateSizeDecorated(m_value);
|
||||
//Log.debug("[" << getId() << "] {" << getObjectType() << "} minSize : " << minSize);
|
||||
|
||||
m_minSize.setX(etk::avg(tmpMin.x(), 4 + minSize.x(), tmpMax.x()));
|
||||
m_minSize.setY(etk::avg(tmpMin.y(), 4 + minSize.y(), tmpMax.y()));
|
||||
EWOL_VERBOSE("[" << getId() << "] {" << getObjectType() << "} Result min size : " << tmpMin << " < " << m_minSize << " < " << tmpMax);
|
||||
Log.verbose("[" << getId() << "] {" << getObjectType() << "} Result min size : " << tmpMin << " < " << m_minSize << " < " << tmpMax);
|
||||
}
|
||||
|
||||
void ewol::widget::Label::onDraw() {
|
||||
@ -79,21 +79,21 @@ void ewol::widget::Label::onRegenerateDisplay() {
|
||||
m_text.clear();
|
||||
int32_t paddingSize = 2;
|
||||
|
||||
vec2 tmpMax = propertyMaxSize->getPixel();
|
||||
Vector2f tmpMax = propertyMaxSize->getPixel();
|
||||
// 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.setY(etk::max(minSize.y(), m_minSize.y()));
|
||||
if (tmpMax.x() <= 999999) {
|
||||
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 :
|
||||
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,
|
||||
0);
|
||||
|
||||
@ -105,15 +105,15 @@ void ewol::widget::Label::onRegenerateDisplay() {
|
||||
localSize.setY(m_size.y());
|
||||
tmpTextOrigin.setY(m_size.y() - 2*paddingSize - curentTextSize.y());
|
||||
}
|
||||
tmpTextOrigin += vec3(paddingSize, paddingSize, 0);
|
||||
localSize -= vec2(2*paddingSize,2*paddingSize);
|
||||
tmpTextOrigin += Vector3f(paddingSize, paddingSize, 0);
|
||||
localSize -= Vector2f(2*paddingSize,2*paddingSize);
|
||||
|
||||
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);
|
||||
vec3 drawClippingSize((m_size.x() - paddingSize),
|
||||
Vector3f drawClippingPos(paddingSize, paddingSize, -0.5);
|
||||
Vector3f drawClippingSize((m_size.x() - paddingSize),
|
||||
(m_size.y() - paddingSize),
|
||||
1);
|
||||
|
||||
@ -127,14 +127,14 @@ void ewol::widget::Label::onRegenerateDisplay() {
|
||||
m_text.setDefaultColorBg(m_colorProperty->get(m_colorDefaultBgText));
|
||||
}
|
||||
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.setClipping(drawClippingPos, drawClippingSize);
|
||||
m_text.printDecorated(m_value);
|
||||
}
|
||||
|
||||
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 (gale::key::status::pressSingle == _event.getStatus()) {
|
||||
// nothing to do ...
|
||||
@ -151,7 +151,7 @@ bool ewol::widget::Label::loadXML(const exml::Element& _node) {
|
||||
}
|
||||
ewol::Widget::loadXML(_node);
|
||||
// get internal data :
|
||||
EWOL_DEBUG("Load label:" << _node.getText());
|
||||
Log.debug("Load label:" << _node.getText());
|
||||
propertyValue.set(_node.getText());
|
||||
return true;
|
||||
}
|
||||
|
@ -15,10 +15,10 @@ 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) {
|
||||
return null;
|
||||
}
|
||||
@ -27,8 +27,8 @@ ewol::WidgetShared ewol::widget::Layer::getWidgetAtPos(const vec2& _pos) {
|
||||
if (it == null) {
|
||||
continue;
|
||||
}
|
||||
vec2 tmpSize = it->getSize();
|
||||
vec2 tmpOrigin = it->getOrigin();
|
||||
Vector2f tmpSize = it->getSize();
|
||||
Vector2f tmpOrigin = it->getOrigin();
|
||||
if( (tmpOrigin.x() <= _pos.x() && tmpOrigin.x() + tmpSize.x() >= _pos.x())
|
||||
&& (tmpOrigin.y() <= _pos.y() && tmpOrigin.y() + tmpSize.y() >= _pos.y()) ) {
|
||||
ewol::WidgetShared tmpWidget = it->getWidgetAtPos(_pos);
|
||||
|
@ -31,7 +31,7 @@ namespace ewol {
|
||||
*/
|
||||
virtual ~Layer();
|
||||
public:
|
||||
ewol::WidgetShared getWidgetAtPos(const vec2& _pos) override;
|
||||
ewol::WidgetShared getWidgetAtPos(const Vector2f& _pos) override;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
@ -23,7 +23,7 @@ ewol::widget::List::List() {
|
||||
#endif
|
||||
m_nbVisibleRaw = 0;
|
||||
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) {
|
||||
EWOL_DEBUG("Set Raw visible : " << _id);
|
||||
Log.debug("Set Raw visible : " << _id);
|
||||
if (_id<0) {
|
||||
return;
|
||||
}
|
||||
@ -72,14 +72,14 @@ void ewol::widget::List::setRawVisible(int32_t _id) {
|
||||
m_displayStartRaw = _id - m_nbVisibleRaw + 2;
|
||||
}
|
||||
}
|
||||
ivec2 matrixSize = getMatrixSize();
|
||||
Vector2i matrixSize = getMatrixSize();
|
||||
if (m_displayStartRaw > matrixSize.y()) {
|
||||
m_displayStartRaw = matrixSize.y()-2;
|
||||
}
|
||||
if (m_displayStartRaw<0) {
|
||||
m_displayStartRaw = 0;
|
||||
}
|
||||
EWOL_DEBUG("Set start raw : " << m_displayStartRaw);
|
||||
Log.debug("Set start raw : " << m_displayStartRaw);
|
||||
markToRedraw();
|
||||
}
|
||||
*/
|
||||
@ -110,15 +110,15 @@ void ewol::widget::List::onRegenerateDisplay() {
|
||||
// -------------------------------------------------------
|
||||
// -- Calculate the size of each element
|
||||
// -------------------------------------------------------
|
||||
ivec2 matrixSize = getMatrixSize();
|
||||
Vector2i matrixSize = getMatrixSize();
|
||||
m_listSizeX.clear();
|
||||
m_listSizeX.resize(matrixSize.x(), 0);
|
||||
m_listSizeY.clear();
|
||||
m_listSizeY.resize(matrixSize.y(), 0);
|
||||
for (int_t yyy=0; yyy<matrixSize.y(); ++yyy) {
|
||||
for (int_t xxx=0; xxx<matrixSize.x(); ++xxx) {
|
||||
ivec2 pos(xxx, yyy);
|
||||
vec2 elementSize = calculateElementSize(pos);
|
||||
Vector2i pos(xxx, yyy);
|
||||
Vector2f elementSize = calculateElementSize(pos);
|
||||
if (elementSize.x() > m_listSizeX[xxx]) {
|
||||
m_listSizeX[xxx] = elementSize.x();
|
||||
}
|
||||
@ -165,8 +165,8 @@ void ewol::widget::List::onRegenerateDisplay() {
|
||||
// -------------------------------------------------------
|
||||
// -- Calculate the start position size of each element
|
||||
// -------------------------------------------------------
|
||||
etk::Vector<int32_t> listStartPosX;
|
||||
etk::Vector<int32_t> listStartPosY;
|
||||
List<int32_t> listStartPosX;
|
||||
List<int32_t> listStartPosY;
|
||||
int32_t lastPositionX = 0;
|
||||
for (auto &size: m_listSizeX) {
|
||||
listStartPosX.pushBack(lastPositionX);
|
||||
@ -180,7 +180,7 @@ void ewol::widget::List::onRegenerateDisplay() {
|
||||
// -------------------------------------------------------
|
||||
// -- Update the scroolBar
|
||||
// -------------------------------------------------------
|
||||
m_maxSize = ivec2(lastPositionX, lastPositionY);
|
||||
m_maxSize = Vector2i(lastPositionX, lastPositionY);
|
||||
// -------------------------------------------------------
|
||||
// -- Clean the background
|
||||
// -------------------------------------------------------
|
||||
@ -200,7 +200,7 @@ void ewol::widget::List::onRegenerateDisplay() {
|
||||
}
|
||||
for (int_t xxx=0; xxx<matrixSize.x(); ++xxx) {
|
||||
float startXposition = -m_originScrooled.x() + listStartPosX[xxx];
|
||||
//EWOL_ERROR("display start: " << startXposition);
|
||||
//Log.error("display start: " << startXposition);
|
||||
if (startXposition + m_listSizeX[xxx] < 0) {
|
||||
// ==> element out of range ==> nothing to display
|
||||
continue;
|
||||
@ -209,9 +209,9 @@ void ewol::widget::List::onRegenerateDisplay() {
|
||||
// ==> element out of range ==> nothing to display
|
||||
break;
|
||||
}
|
||||
drawElement(ivec2(xxx, yyy),
|
||||
vec2(startXposition, startYposition),
|
||||
vec2(m_listSizeX[xxx], m_listSizeY[yyy]));
|
||||
drawElement(Vector2i(xxx, yyy),
|
||||
Vector2f(startXposition, startYposition),
|
||||
Vector2f(m_listSizeX[xxx], m_listSizeY[yyy]));
|
||||
}
|
||||
}
|
||||
// -------------------------------------------------------
|
||||
@ -221,16 +221,16 @@ void ewol::widget::List::onRegenerateDisplay() {
|
||||
}
|
||||
}
|
||||
|
||||
ivec2 ewol::widget::List::getMatrixSize() const {
|
||||
return ivec2(1,0);
|
||||
Vector2i ewol::widget::List::getMatrixSize() const {
|
||||
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"));
|
||||
etk::String myTextToWrite = getData(ListRole::Text, _pos).getSafeString();
|
||||
vec3 textSize = tmpText->calculateSize(myTextToWrite);
|
||||
ivec2 count = getMatrixSize();
|
||||
return vec2(textSize.x(),
|
||||
Vector3f textSize = tmpText->calculateSize(myTextToWrite);
|
||||
Vector2i count = getMatrixSize();
|
||||
return Vector2f(textSize.x(),
|
||||
textSize.y() + m_paddingSizeY*3
|
||||
);
|
||||
}
|
||||
@ -240,12 +240,12 @@ void ewol::widget::List::drawBackground() {
|
||||
if (BGOObjects != null) {
|
||||
etk::Color<> basicBG = getBasicBG();
|
||||
BGOObjects->setColor(basicBG);
|
||||
BGOObjects->setPos(vec3(0, 0, 0) );
|
||||
BGOObjects->setPos(Vector3f(0, 0, 0) );
|
||||
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::Color<> fg = getData(ListRole::FgColor, _pos).getSafeColor();
|
||||
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"));
|
||||
if (BGOObjects != null) {
|
||||
BGOObjects->setColor(bg);
|
||||
BGOObjects->setPos(vec3(_start.x(), _start.y(), 0) );
|
||||
BGOObjects->setPos(Vector3f(_start.x(), _start.y(), 0) );
|
||||
BGOObjects->rectangleWidth(_size);
|
||||
}
|
||||
}
|
||||
@ -263,14 +263,14 @@ void ewol::widget::List::drawElement(const ivec2& _pos, const vec2& _start, cons
|
||||
if (tmpText != null) {
|
||||
int32_t displayPositionY = _start.y() + m_paddingSizeY;
|
||||
tmpText->setColor(fg);
|
||||
tmpText->setPos(vec3(_start.x() + m_paddingSizeX, displayPositionY, 0) );
|
||||
tmpText->setPos(Vector3f(_start.x() + m_paddingSizeX, displayPositionY, 0) );
|
||||
tmpText->print(myTextToWrite);;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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) {
|
||||
keepFocus();
|
||||
// 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) {
|
||||
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
|
||||
ivec2 pos{0,0};
|
||||
Vector2i pos{0,0};
|
||||
float_t offsetY = 0;
|
||||
for (size_t iii=0; iii<m_listSizeY.size()-1; iii++) {
|
||||
int32_t previous = offsetY;
|
||||
@ -314,7 +314,7 @@ bool ewol::widget::List::onEventInput(const ewol::event::Input& _event) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
vec2 posInternalMouse = relativePos - vec2(offsetX, offsetY);
|
||||
Vector2f posInternalMouse = relativePos - Vector2f(offsetX, offsetY);
|
||||
bool isUsed = onItemEvent(_event, pos, posInternalMouse);
|
||||
if (isUsed == true) {
|
||||
// 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() {
|
||||
EWOL_DEBUG("Ewol::List get focus");
|
||||
Log.debug("Ewol::List get focus");
|
||||
}
|
||||
|
||||
void ewol::widget::List::onLostFocus() {
|
||||
EWOL_DEBUG("Ewol::List Lost focus");
|
||||
Log.debug("Ewol::List Lost focus");
|
||||
}
|
||||
|
@ -45,9 +45,9 @@ namespace ewol {
|
||||
void calculateMinMaxSize() override;
|
||||
// drawing capabilities ....
|
||||
protected:
|
||||
etk::Vector<ememory::SharedPtr<ewol::Compositing>> m_listOObject; //!< generic element to display...
|
||||
etk::Vector<int32_t> m_listSizeX; //!< size of every colomns
|
||||
etk::Vector<int32_t> m_listSizeY; //!< size of every rows
|
||||
List<ememory::SharedPtr<ewol::Compositing>> m_listOObject; //!< generic element to display...
|
||||
List<int32_t> m_listSizeX; //!< size of every colomns
|
||||
List<int32_t> m_listSizeY; //!< size of every rows
|
||||
protected:
|
||||
etk::Map<etk::String, ememory::SharedPtr<ewol::Compositing>> m_compositingElements;
|
||||
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
|
||||
* @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) {
|
||||
case ListRole::Text:
|
||||
return "";
|
||||
@ -95,7 +95,7 @@ namespace ewol {
|
||||
* @param[in] _pos Position of colomn and Raw 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.
|
||||
* @param[in] _pos Position of colomn and Raw of the element.
|
||||
@ -103,13 +103,13 @@ namespace ewol {
|
||||
* @param[in] _size Render raw size
|
||||
* @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
|
||||
*/
|
||||
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;
|
||||
}
|
||||
/**
|
||||
|
@ -87,7 +87,7 @@ void ewol::widget::ListFileSystem::regenerateView() {
|
||||
flags |= etk::path::LIST_FILE;
|
||||
}
|
||||
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:
|
||||
etk::algorithm::quickSort(m_list, localSort);
|
||||
// request a redraw ...
|
||||
@ -117,7 +117,7 @@ void ewol::widget::ListFileSystem::setSelect(const etk::Path& _data) {
|
||||
markToRedraw();
|
||||
}
|
||||
|
||||
ivec2 ewol::widget::ListFileSystem::getMatrixSize() const {
|
||||
Vector2i ewol::widget::ListFileSystem::getMatrixSize() const {
|
||||
int32_t offset = 0;
|
||||
if (*propertyShowFolder == true) {
|
||||
if (propertyPath.get() == "/") {
|
||||
@ -126,10 +126,10 @@ ivec2 ewol::widget::ListFileSystem::getMatrixSize() const {
|
||||
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) {
|
||||
case ListRole::Text:
|
||||
{
|
||||
@ -149,7 +149,7 @@ fluorine::Variant ewol::widget::ListFileSystem::getData(int32_t _role, const ive
|
||||
}
|
||||
if( _pos.y()-offset >= 0
|
||||
&& _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();
|
||||
}
|
||||
}
|
||||
@ -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,
|
||||
const ivec2& _pos,
|
||||
const vec2& _mousePosition) {
|
||||
const Vector2i& _pos,
|
||||
const Vector2f& _mousePosition) {
|
||||
int32_t offset = 0;
|
||||
if (*propertyShowFolder == true) {
|
||||
if (*propertyPath == "/") {
|
||||
@ -181,7 +181,7 @@ bool ewol::widget::ListFileSystem::onItemEvent(const ewol::event::Input& _event,
|
||||
}
|
||||
if ( _event.getStatus() == gale::key::status::pressSingle
|
||||
|| _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 (_pos.y() > (int32_t)m_list.size()+offset ) {
|
||||
m_selectedLine = -1;
|
||||
|
@ -43,11 +43,11 @@ namespace ewol {
|
||||
int32_t m_colorIdBackgroundSelected; //!< Color of line selected.
|
||||
protected:
|
||||
etk::Color<> getBasicBG() override;
|
||||
ivec2 getMatrixSize() const override;
|
||||
fluorine::Variant getData(int32_t _role, const ivec2& _pos) override;
|
||||
bool onItemEvent(const ewol::event::Input& _event, const ivec2& _pos, const vec2& _mousePosition) override;
|
||||
Vector2i getMatrixSize() const override;
|
||||
fluorine::Variant getData(int32_t _role, const Vector2i& _pos) override;
|
||||
bool onItemEvent(const ewol::event::Input& _event, const Vector2i& _pos, const Vector2f& _mousePosition) override;
|
||||
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.
|
||||
*/
|
||||
|
@ -37,7 +37,7 @@ ewol::widget::Manager::Manager() :
|
||||
m_creatorList(0, false),
|
||||
m_creatorListXml(0, false),
|
||||
m_haveRedraw(true) {
|
||||
EWOL_DEBUG(" == > init Widget-Manager");
|
||||
Log.debug(" == > init Widget-Manager");
|
||||
|
||||
ewol::widget::Button::createManagerWidget(*this);
|
||||
ewol::widget::ButtonColor::createManagerWidget(*this);
|
||||
@ -63,8 +63,8 @@ ewol::widget::Manager::Manager() :
|
||||
}
|
||||
|
||||
ewol::widget::Manager::~Manager() {
|
||||
EWOL_DEBUG(" == > Un-Init Widget-Manager");
|
||||
EWOL_INFO("Realease all FOCUS");
|
||||
Log.debug(" == > Un-Init Widget-Manager");
|
||||
Log.info("Realease all FOCUS");
|
||||
focusSetDefault(null);
|
||||
focusRelease();
|
||||
|
||||
@ -80,7 +80,7 @@ void ewol::widget::Manager::focusKeep(ewol::WidgetShared _newWidget) {
|
||||
// nothing to do ...
|
||||
return;
|
||||
}
|
||||
EWOL_DEBUG("focusKeep=" << _newWidget->getId() );
|
||||
Log.debug("focusKeep=" << _newWidget->getId() );
|
||||
//elog::displayBacktrace();
|
||||
auto focusWidgetCurrent = m_focusWidgetCurrent.lock();
|
||||
if (_newWidget == focusWidgetCurrent) {
|
||||
@ -88,17 +88,17 @@ void ewol::widget::Manager::focusKeep(ewol::WidgetShared _newWidget) {
|
||||
return;
|
||||
}
|
||||
if (focusWidgetCurrent != null) {
|
||||
EWOL_DEBUG("Rm focus on WidgetID=" << focusWidgetCurrent->getId() );
|
||||
Log.debug("Rm focus on WidgetID=" << focusWidgetCurrent->getId() );
|
||||
focusWidgetCurrent->rmFocus();
|
||||
focusWidgetCurrent.reset();
|
||||
}
|
||||
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;
|
||||
}
|
||||
m_focusWidgetCurrent = _newWidget;
|
||||
if (_newWidget != null) {
|
||||
EWOL_DEBUG("Set focus on WidgetID=" << _newWidget->getId() );
|
||||
Log.debug("Set focus on WidgetID=" << _newWidget->getId() );
|
||||
_newWidget->setFocus();
|
||||
}
|
||||
}
|
||||
@ -106,19 +106,19 @@ void ewol::widget::Manager::focusKeep(ewol::WidgetShared _newWidget) {
|
||||
void ewol::widget::Manager::focusSetDefault(ewol::WidgetShared _newWidget) {
|
||||
if( _newWidget != null
|
||||
&& _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;
|
||||
}
|
||||
ewol::WidgetShared focusWidgetDefault = m_focusWidgetDefault.lock();
|
||||
ewol::WidgetShared focusWidgetCurrent = m_focusWidgetCurrent.lock();
|
||||
if (focusWidgetDefault == focusWidgetCurrent) {
|
||||
if (focusWidgetCurrent != null) {
|
||||
EWOL_DEBUG("Rm focus on WidgetID=" << focusWidgetCurrent->getId() );
|
||||
Log.debug("Rm focus on WidgetID=" << focusWidgetCurrent->getId() );
|
||||
focusWidgetCurrent->rmFocus();
|
||||
}
|
||||
m_focusWidgetCurrent = _newWidget;
|
||||
if (_newWidget != null) {
|
||||
EWOL_DEBUG("Set focus on WidgetID=" << _newWidget->getId() );
|
||||
Log.debug("Set focus on WidgetID=" << _newWidget->getId() );
|
||||
_newWidget->setFocus();
|
||||
}
|
||||
}
|
||||
@ -133,13 +133,13 @@ void ewol::widget::Manager::focusRelease() {
|
||||
return;
|
||||
}
|
||||
if (focusWidgetCurrent != null) {
|
||||
EWOL_DEBUG("Rm focus on WidgetID=" << focusWidgetCurrent->getId() );
|
||||
Log.debug("Rm focus on WidgetID=" << focusWidgetCurrent->getId() );
|
||||
focusWidgetCurrent->rmFocus();
|
||||
}
|
||||
m_focusWidgetCurrent = m_focusWidgetDefault;
|
||||
focusWidgetCurrent = m_focusWidgetCurrent.lock();
|
||||
if (focusWidgetCurrent != null) {
|
||||
EWOL_DEBUG("Set focus on WidgetID=" << focusWidgetCurrent->getId() );
|
||||
Log.debug("Set focus on WidgetID=" << focusWidgetCurrent->getId() );
|
||||
focusWidgetCurrent->setFocus();
|
||||
}
|
||||
}
|
||||
@ -198,7 +198,7 @@ void ewol::widget::Manager::addWidgetCreator(const etk::String& _name,
|
||||
if (find == true) {
|
||||
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_creatorListXml.set(nameLower, _pointerXml);
|
||||
}
|
||||
|
@ -20,7 +20,7 @@ ewol::widget::Menu::Menu() :
|
||||
signalSelect(this, "select", "") {
|
||||
addObjectType("ewol::widget::Menu");
|
||||
m_staticId = 666;
|
||||
propertyLockExpand.setDirect(bvec2(true,true));
|
||||
propertyLockExpand.setDirect(Vector2b(true,true));
|
||||
}
|
||||
|
||||
ewol::widget::Menu::~Menu() {
|
||||
@ -33,16 +33,16 @@ void ewol::widget::Menu::subWidgetRemoveAll() {
|
||||
}
|
||||
|
||||
int32_t ewol::widget::Menu::subWidgetAdd(ewol::WidgetShared _newWidget) {
|
||||
EWOL_ERROR("Not availlable");
|
||||
Log.error("Not availlable");
|
||||
return -1;
|
||||
}
|
||||
|
||||
void ewol::widget::Menu::subWidgetRemove(ewol::WidgetShared _newWidget) {
|
||||
EWOL_ERROR("Not availlable");
|
||||
Log.error("Not availlable");
|
||||
}
|
||||
|
||||
void ewol::widget::Menu::subWidgetUnLink(ewol::WidgetShared _newWidget) {
|
||||
EWOL_ERROR("Not availlable");
|
||||
Log.error("Not availlable");
|
||||
}
|
||||
|
||||
void ewol::widget::Menu::clear() {
|
||||
@ -84,7 +84,7 @@ int32_t ewol::widget::Menu::add(int32_t _parent,
|
||||
if (tmpObject.m_parentId == -1) {
|
||||
ewol::widget::ButtonShared myButton = ewol::widget::Button::create();
|
||||
if (myButton == null) {
|
||||
EWOL_ERROR("Allocation button error");
|
||||
Log.error("Allocation button error");
|
||||
return tmpObject.m_localId;
|
||||
}
|
||||
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) {
|
||||
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) {
|
||||
ewol::widget::SpacerShared mySpacer = ewol::widget::Spacer::create();
|
||||
if (mySpacer == null) {
|
||||
EWOL_ERROR("Allocation spacer error");
|
||||
Log.error("Allocation spacer error");
|
||||
return tmpObject.m_localId;
|
||||
}
|
||||
mySpacer->propertyExpand.set(bvec2(true,true));
|
||||
mySpacer->propertyFill.set(bvec2(true,true));
|
||||
mySpacer->propertyMinSize.set(gale::Dimension(vec2(2,0), gale::distance::pixel));
|
||||
mySpacer->propertyMaxSize.set(gale::Dimension(vec2(2,10000), gale::distance::pixel));
|
||||
mySpacer->propertyExpand.set(Vector2b(true,true));
|
||||
mySpacer->propertyFill.set(Vector2b(true,true));
|
||||
mySpacer->propertyMinSize.set(gale::Dimension(Vector2f(2,0), gale::distance::pixel));
|
||||
mySpacer->propertyMaxSize.set(gale::Dimension(Vector2f(2,10000), gale::distance::pixel));
|
||||
mySpacer->propertyColor.set(etk::Color<>(0,0,0,0xFF));
|
||||
// add it in the widget list
|
||||
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 ...
|
||||
if (it.m_message.size() > 0) {
|
||||
EWOL_DEBUG("Menu == > generate Event");
|
||||
Log.debug("Menu == > generate Event");
|
||||
// Send a multicast event ...
|
||||
signalSelect.emit(it.m_message);
|
||||
ewol::widget::ContextMenuShared tmpContext = m_widgetContextMenu.lock();
|
||||
if (tmpContext != null) {
|
||||
EWOL_DEBUG("Mark the menu to remove ...");
|
||||
Log.debug("Mark the menu to remove ...");
|
||||
tmpContext->destroy();
|
||||
}
|
||||
return;
|
||||
}
|
||||
EWOL_DEBUG("Menu == > load Sub Menu");
|
||||
Log.debug("Menu == > load Sub Menu");
|
||||
bool findChild = false;
|
||||
for (auto &it2 : m_listElement) {
|
||||
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();
|
||||
m_widgetContextMenu = tmpContext;
|
||||
if (tmpContext == null) {
|
||||
EWOL_ERROR("Allocation Error");
|
||||
Log.error("Allocation Error");
|
||||
return;
|
||||
}
|
||||
// get the button widget:
|
||||
vec2 newPosition;
|
||||
Vector2f newPosition;
|
||||
ewol::WidgetShared eventFromWidget = ememory::dynamicPointerCast<ewol::Widget>(caller);
|
||||
if (eventFromWidget != null) {
|
||||
vec2 tmpOri = eventFromWidget->getOrigin();
|
||||
vec2 tmpSize = eventFromWidget->getSize();
|
||||
Vector2f tmpOri = eventFromWidget->getOrigin();
|
||||
Vector2f tmpSize = eventFromWidget->getSize();
|
||||
// calculate the correct position
|
||||
newPosition.setValue(tmpOri.x() + tmpSize.x()/2,
|
||||
tmpOri.y() );
|
||||
@ -198,8 +198,8 @@ void ewol::widget::Menu::onButtonPressed(ewol::widget::ButtonWeak _button) {
|
||||
mySizer = ewol::widget::Sizer::create();
|
||||
if (mySizer != null) {
|
||||
mySizer->propertyMode.set(widget::Sizer::modeVert);
|
||||
mySizer->propertyLockExpand.set(vec2(true,true));
|
||||
mySizer->propertyFill.set(vec2(true,true));
|
||||
mySizer->propertyLockExpand.set(Vector2f(true,true));
|
||||
mySizer->propertyFill.set(Vector2f(true,true));
|
||||
// set it in the pop-up-system:
|
||||
tmpContext->setSubWidget(mySizer);
|
||||
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 == "") {
|
||||
ewol::widget::SpacerShared mySpacer = ewol::widget::Spacer::create();
|
||||
if (mySpacer == null) {
|
||||
EWOL_ERROR("Allocation spacer error");
|
||||
Log.error("Allocation spacer error");
|
||||
continue;
|
||||
}
|
||||
mySpacer->propertyExpand.set(bvec2(true,true));
|
||||
mySpacer->propertyFill.set(bvec2(true,true));
|
||||
mySpacer->propertyMinSize.set(gale::Dimension(vec2(0,2), gale::distance::pixel));
|
||||
mySpacer->propertyMaxSize.set(gale::Dimension(vec2(10000,2), gale::distance::pixel));
|
||||
mySpacer->propertyExpand.set(Vector2b(true,true));
|
||||
mySpacer->propertyFill.set(Vector2b(true,true));
|
||||
mySpacer->propertyMinSize.set(gale::Dimension(Vector2f(0,2), gale::distance::pixel));
|
||||
mySpacer->propertyMaxSize.set(gale::Dimension(Vector2f(10000,2), gale::distance::pixel));
|
||||
mySpacer->propertyColor.set(etk::Color<>(0,0,0,0xFF));
|
||||
// add it in the widget list
|
||||
mySizer->subWidgetAdd(mySpacer);
|
||||
} else {
|
||||
myButton = ewol::widget::Button::create();
|
||||
if (myButton == null) {
|
||||
EWOL_ERROR("Allocation Error");
|
||||
Log.error("Allocation Error");
|
||||
continue;
|
||||
}
|
||||
myButton->propertyExpand.set(bvec2(true,true));
|
||||
myButton->propertyFill.set(bvec2(true,true));
|
||||
myButton->propertyExpand.set(Vector2b(true,true));
|
||||
myButton->propertyFill.set(Vector2b(true,true));
|
||||
// set callback
|
||||
myButton->signalPressed.connect(sharedFromThis(), &ewol::widget::Menu::onButtonPressed, ewol::widget::ButtonWeak(myButton));
|
||||
// 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();
|
||||
if (tmpLabel != null) {
|
||||
tmpLabel->propertyValue.set(etk::String("<left>") + m_listElement[iii].m_label + "</left>\n");
|
||||
tmpLabel->propertyExpand.set(bvec2(true,false));
|
||||
tmpLabel->propertyFill.set(bvec2(true,true));
|
||||
tmpLabel->propertyExpand.set(Vector2b(true,false));
|
||||
tmpLabel->propertyFill.set(Vector2b(true,true));
|
||||
myButton->setSubWidget(tmpLabel);
|
||||
}
|
||||
}
|
||||
@ -277,7 +277,7 @@ void ewol::widget::Menu::onButtonPressed(ewol::widget::ButtonWeak _button) {
|
||||
}
|
||||
ewol::widget::WindowsShared currentWindows = getWindows();
|
||||
if (currentWindows == null) {
|
||||
EWOL_ERROR("Can not get the curent Windows...");
|
||||
Log.error("Can not get the curent Windows...");
|
||||
} else {
|
||||
currentWindows->popUpWidgetPush(tmpContext);
|
||||
}
|
||||
@ -299,7 +299,7 @@ bool ewol::widget::Menu::loadXML(const exml::Element& _node) {
|
||||
continue;
|
||||
}
|
||||
etk::String widgetName = pNode.getValue();
|
||||
EWOL_INFO("Get node : " << pNode);
|
||||
Log.info("Get node : " << pNode);
|
||||
if (widgetName == "elem") {
|
||||
// <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"]);
|
||||
@ -317,13 +317,13 @@ bool ewol::widget::Menu::loadXML(const exml::Element& _node) {
|
||||
} else if (widgetName2 == "separator") {
|
||||
addSpacer(idMenu);
|
||||
} 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") {
|
||||
addSpacer();
|
||||
} 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;
|
||||
|
@ -45,7 +45,7 @@ namespace ewol {
|
||||
void subWidgetUnLink(ewol::WidgetShared _newWidget) override;
|
||||
bool loadXML(const exml::Element& _node) override;
|
||||
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 ...
|
||||
ewol::widget::ContextMenuWeak m_widgetContextMenu;
|
||||
int32_t get(const etk::String& _label);
|
||||
|
@ -21,7 +21,7 @@ ewol::widget::PopUp::PopUp() :
|
||||
"The shaper properties",
|
||||
&ewol::widget::PopUp::onChangePropertyShape),
|
||||
propertyLockExpand(this, "lock",
|
||||
bvec2(true,true),
|
||||
Vector2b(true,true),
|
||||
"Lock expand contamination",
|
||||
&ewol::widget::PopUp::onChangePropertyLockExpand),
|
||||
propertyCloseOutEvent(this, "out-click-remove",
|
||||
@ -33,10 +33,10 @@ ewol::widget::PopUp::PopUp() :
|
||||
|
||||
void ewol::widget::PopUp::init() {
|
||||
ewol::widget::Container::init();
|
||||
propertyFill.set(bvec2(false,false));
|
||||
propertyFill.set(Vector2b(false,false));
|
||||
propertyShape.notifyChange();
|
||||
propertyMinSize.set(gale::Dimension(vec2(80,80),gale::distance::pourcent));
|
||||
propertyExpand.set(bvec2(false, false));
|
||||
propertyMinSize.set(gale::Dimension(Vector2f(80,80),gale::distance::pourcent));
|
||||
propertyExpand.set(Vector2b(false, false));
|
||||
}
|
||||
ewol::widget::PopUp::~PopUp() {
|
||||
|
||||
@ -48,7 +48,7 @@ void ewol::widget::PopUp::onChangeSize() {
|
||||
return;
|
||||
}
|
||||
ewol::Padding padding = m_shaper.getPadding();
|
||||
vec2 subWidgetSize = m_subWidget->getCalculateMinSize();
|
||||
Vector2f subWidgetSize = m_subWidget->getCalculateMinSize();
|
||||
if (m_subWidget->canExpand().x() == true) {
|
||||
if (propertyLockExpand->x() == true) {
|
||||
subWidgetSize.setX(m_minSize.x());
|
||||
@ -66,11 +66,11 @@ void ewol::widget::PopUp::onChangeSize() {
|
||||
// limit the size of the element :
|
||||
//subWidgetSize.setMin(m_minSize);
|
||||
// posiition at a int32_t pos :
|
||||
subWidgetSize = vec2ClipInt32(subWidgetSize);
|
||||
subWidgetSize = Vector2fClipInt32(subWidgetSize);
|
||||
|
||||
// set config to the Sub-widget
|
||||
vec2 subWidgetOrigin = m_origin + (m_size-subWidgetSize)/2.0f;
|
||||
subWidgetOrigin = vec2ClipInt32(subWidgetOrigin);
|
||||
Vector2f subWidgetOrigin = m_origin + (m_size-subWidgetSize)/2.0f;
|
||||
subWidgetOrigin = Vector2fClipInt32(subWidgetOrigin);
|
||||
|
||||
m_subWidget->setOrigin(subWidgetOrigin);
|
||||
m_subWidget->setSize(subWidgetSize);
|
||||
@ -102,9 +102,9 @@ void ewol::widget::PopUp::onRegenerateDisplay() {
|
||||
if (needRedraw() == true) {
|
||||
m_shaper.clear();
|
||||
ewol::Padding padding = m_shaper.getPadding();
|
||||
vec2 tmpSize(0,0);
|
||||
bvec2 expand = canExpand();
|
||||
bvec2 fill = canFill();
|
||||
Vector2f tmpSize(0,0);
|
||||
Vector2b expand = canExpand();
|
||||
Vector2b fill = canFill();
|
||||
if (fill.x() == true) {
|
||||
tmpSize.setX(m_size.x()-padding.x());
|
||||
}
|
||||
@ -112,14 +112,14 @@ void ewol::widget::PopUp::onRegenerateDisplay() {
|
||||
tmpSize.setY(m_size.y()-padding.y());
|
||||
}
|
||||
if (m_subWidget != null) {
|
||||
vec2 tmpSize = m_subWidget->getSize();
|
||||
Vector2f tmpSize = m_subWidget->getSize();
|
||||
}
|
||||
tmpSize.setMax(m_minSize);
|
||||
vec2 tmpOrigin = (m_size-tmpSize)/2.0f;
|
||||
m_shaper.setShape(vec2(0,0),
|
||||
vec2ClipInt32(m_size),
|
||||
vec2ClipInt32(tmpOrigin-vec2(padding.xLeft(), padding.yButtom())),
|
||||
vec2ClipInt32(tmpSize + vec2(padding.x(), padding.y())));
|
||||
Vector2f tmpOrigin = (m_size-tmpSize)/2.0f;
|
||||
m_shaper.setShape(Vector2f(0,0),
|
||||
Vector2fClipInt32(m_size),
|
||||
Vector2fClipInt32(tmpOrigin-Vector2f(padding.xLeft(), padding.yButtom())),
|
||||
Vector2fClipInt32(tmpSize + Vector2f(padding.x(), padding.y())));
|
||||
}
|
||||
// SUBwIDGET GENERATION ...
|
||||
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);
|
||||
if (val != null) {
|
||||
return val;
|
||||
@ -157,16 +157,16 @@ bool ewol::widget::PopUp::onEventInput(const ewol::event::Input& _event) {
|
||||
return false;
|
||||
}
|
||||
ewol::Padding padding = m_shaper.getPadding();
|
||||
vec2 tmpSize(0,0);
|
||||
Vector2f tmpSize(0,0);
|
||||
if (m_subWidget != null) {
|
||||
vec2 tmpSize = m_subWidget->getSize();
|
||||
Vector2f tmpSize = m_subWidget->getSize();
|
||||
}
|
||||
tmpSize.setMax(m_minSize);
|
||||
vec2 tmpOrigin = (m_size-tmpSize)/2.0f;
|
||||
Vector2f tmpOrigin = (m_size-tmpSize)/2.0f;
|
||||
|
||||
tmpOrigin -= vec2(padding.xLeft(), padding.yButtom());
|
||||
tmpSize += vec2(padding.x(), padding.y());
|
||||
vec2 pos = relativePosition(_event.getPos());
|
||||
tmpOrigin -= Vector2f(padding.xLeft(), padding.yButtom());
|
||||
tmpSize += Vector2f(padding.x(), padding.y());
|
||||
Vector2f pos = relativePosition(_event.getPos());
|
||||
if( pos.x() < tmpOrigin.x()
|
||||
|| pos.y() < tmpOrigin.y()
|
||||
|| pos.x() > tmpOrigin.x()+tmpSize.x()
|
||||
|
@ -24,7 +24,7 @@ namespace ewol {
|
||||
class PopUp : public ewol::widget::Container {
|
||||
public: // properties
|
||||
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
|
||||
protected:
|
||||
/**
|
||||
@ -48,7 +48,7 @@ namespace ewol {
|
||||
void onRegenerateDisplay() override;
|
||||
void onChangeSize() override;
|
||||
bool onEventInput(const ewol::event::Input& _event) override;
|
||||
ewol::WidgetShared getWidgetAtPos(const vec2& _pos) override;
|
||||
ewol::WidgetShared getWidgetAtPos(const Vector2f& _pos) override;
|
||||
protected:
|
||||
virtual void onChangePropertyShape();
|
||||
virtual void onChangePropertyLockExpand();
|
||||
|
@ -43,7 +43,7 @@ ewol::widget::ProgressBar::~ProgressBar() {
|
||||
}
|
||||
|
||||
void ewol::widget::ProgressBar::calculateMinMaxSize() {
|
||||
vec2 tmpMin = propertyMinSize->getPixel();
|
||||
Vector2f tmpMin = propertyMinSize->getPixel();
|
||||
m_minSize.setValue( etk::max(tmpMin.x(), 40.0f),
|
||||
etk::max(tmpMin.y(), dotRadius*2.0f) );
|
||||
markToRedraw();
|
||||
@ -67,11 +67,11 @@ void ewol::widget::ProgressBar::onRegenerateDisplay() {
|
||||
int32_t tmpOriginX = 5;
|
||||
int32_t tmpOriginY = 5;
|
||||
m_draw.setColor(propertyTextColorBgOn);
|
||||
m_draw.setPos(vec3(tmpOriginX, tmpOriginY, 0) );
|
||||
m_draw.rectangleWidth(vec3(tmpSizeX*propertyValue, tmpSizeY, 0) );
|
||||
m_draw.setPos(Vector3f(tmpOriginX, tmpOriginY, 0) );
|
||||
m_draw.rectangleWidth(Vector3f(tmpSizeX*propertyValue, tmpSizeY, 0) );
|
||||
m_draw.setColor(propertyTextColorBgOff);
|
||||
m_draw.setPos(vec3(tmpOriginX+tmpSizeX*propertyValue, tmpOriginY, 0) );
|
||||
m_draw.rectangleWidth(vec3(tmpSizeX*(1.0-propertyValue), tmpSizeY, 0) );
|
||||
m_draw.setPos(Vector3f(tmpOriginX+tmpSizeX*propertyValue, tmpOriginY, 0) );
|
||||
m_draw.rectangleWidth(Vector3f(tmpSizeX*(1.0-propertyValue), tmpSizeY, 0) );
|
||||
|
||||
// TODO : Create a better progress Bar ...
|
||||
//m_draw.setColor(propertyTextColorFg);
|
||||
|
@ -14,7 +14,7 @@ ETK_DECLARE_TYPE(ewol::widget::Scroll);
|
||||
|
||||
ewol::widget::Scroll::Scroll() :
|
||||
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",
|
||||
&ewol::widget::Scroll::onChangePropertyLimit),
|
||||
propertyShapeVert(this, "shape-vert",
|
||||
@ -70,15 +70,15 @@ void ewol::widget::Scroll::onChangeSize() {
|
||||
return;
|
||||
}
|
||||
// remove the bar if hover
|
||||
vec2 basicSize = m_size;
|
||||
Vector2f basicSize = m_size;
|
||||
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;
|
||||
vec2 minSize = m_subWidget->getCalculateMinSize();
|
||||
bvec2 expand = m_subWidget->propertyExpand.get();
|
||||
Vector2f origin = m_origin+m_offset;
|
||||
Vector2f minSize = m_subWidget->getCalculateMinSize();
|
||||
Vector2b expand = m_subWidget->propertyExpand.get();
|
||||
//The gravity is not set on the sub element ==> special use of the widget
|
||||
//origin += ewol::gravityGenerateDelta(propertyGravity.get(), minSize - m_size);
|
||||
if ( expand.x() == true
|
||||
@ -91,14 +91,14 @@ void ewol::widget::Scroll::onChangeSize() {
|
||||
}
|
||||
m_subWidget->setSize(minSize);
|
||||
if (*propertyGravity == ewol::gravity_top) {
|
||||
origin += vec2(0.0f, basicSize.y()-minSize.y());
|
||||
origin += Vector2f(0.0f, basicSize.y()-minSize.y());
|
||||
if (*propertyHover == false) {
|
||||
origin += vec2(0,SCROLL_BAR_SPACE);
|
||||
origin += Vector2f(0,SCROLL_BAR_SPACE);
|
||||
}
|
||||
} else if (*propertyGravity == ewol::gravity_buttom) {
|
||||
// nothing to do ... origin +=
|
||||
} else {
|
||||
EWOL_ERROR(" Not manage other gravity ...");
|
||||
Log.error(" Not manage other gravity ...");
|
||||
}
|
||||
m_subWidget->setOrigin(origin);
|
||||
m_subWidget->onChangeSize();
|
||||
@ -130,12 +130,12 @@ void ewol::widget::Scroll::onDraw() {
|
||||
m_shaperV.draw();
|
||||
/*
|
||||
ewol::compositing::Drawing draw;
|
||||
draw.setPos(vec2(10,10));
|
||||
draw.setPos(Vector2f(10,10));
|
||||
draw.setColor(etk::color::orange);
|
||||
draw.rectangleWidth(vec2(25,25));
|
||||
draw.setPos(m_size - vec2(35,35));
|
||||
draw.rectangleWidth(Vector2f(25,25));
|
||||
draw.setPos(m_size - Vector2f(35,35));
|
||||
draw.setColor(etk::color::green);
|
||||
draw.rectangleWidth(vec2(25,25));
|
||||
draw.rectangleWidth(Vector2f(25,25));
|
||||
draw.draw();
|
||||
*/
|
||||
}
|
||||
@ -154,8 +154,8 @@ void ewol::widget::Scroll::onRegenerateDisplay() {
|
||||
m_shaperV.clear();
|
||||
ewol::Padding paddingVert = m_shaperV.getPadding();
|
||||
ewol::Padding paddingHori = m_shaperH.getPadding();
|
||||
vec2 scrollOffset(0,0);
|
||||
vec2 scrollSize(0,0);
|
||||
Vector2f scrollOffset(0,0);
|
||||
Vector2f scrollSize(0,0);
|
||||
if (m_subWidget != null) {
|
||||
scrollOffset = m_subWidget->getOffset();
|
||||
scrollSize = m_subWidget->getSize();
|
||||
@ -167,10 +167,10 @@ void ewol::widget::Scroll::onRegenerateDisplay() {
|
||||
float originScrollBar = scrollOffset.y() / (scrollSize.y()-m_size.y()*propertyLimit->y());
|
||||
originScrollBar = etk::avg(0.0f, originScrollBar, 1.0f);
|
||||
originScrollBar *= (m_size.y()-lenScrollBar);
|
||||
m_shaperV.setShape(vec2(m_size.x() - paddingVert.x(), 0),
|
||||
vec2(paddingVert.x(), m_size.y()),
|
||||
vec2(m_size.x() - paddingVert.xRight(), m_size.y() - originScrollBar - lenScrollBar),
|
||||
vec2(0, lenScrollBar));
|
||||
m_shaperV.setShape(Vector2f(m_size.x() - paddingVert.x(), 0),
|
||||
Vector2f(paddingVert.x(), m_size.y()),
|
||||
Vector2f(m_size.x() - paddingVert.xRight(), m_size.y() - originScrollBar - lenScrollBar),
|
||||
Vector2f(0, lenScrollBar));
|
||||
}
|
||||
if( m_size.x() < scrollSize.x()
|
||||
|| scrollOffset.x() != 0) {
|
||||
@ -179,24 +179,24 @@ void ewol::widget::Scroll::onRegenerateDisplay() {
|
||||
float originScrollBar = scrollOffset.x() / (scrollSize.x()-m_size.x()*propertyLimit->x());
|
||||
originScrollBar = etk::avg(0.0f, originScrollBar, 1.0f);
|
||||
originScrollBar *= (m_size.x()-paddingHori.xRight()-lenScrollBar);
|
||||
m_shaperH.setShape(vec2(0, 0),
|
||||
vec2(m_size.x()-paddingVert.x(), paddingHori.y()),
|
||||
vec2(originScrollBar, paddingHori.yButtom()),
|
||||
vec2(lenScrollBar, 0));
|
||||
m_shaperH.setShape(Vector2f(0, 0),
|
||||
Vector2f(m_size.x()-paddingVert.x(), paddingHori.y()),
|
||||
Vector2f(originScrollBar, paddingHori.yButtom()),
|
||||
Vector2f(lenScrollBar, 0));
|
||||
}
|
||||
}
|
||||
|
||||
bool ewol::widget::Scroll::onEventInput(const ewol::event::Input& _event) {
|
||||
//ewol::event::Input _event = event;
|
||||
//_event.setType(gale::key::type::finger);
|
||||
vec2 relativePos = relativePosition(_event.getPos());
|
||||
vec2 scrollOffset(0,0);
|
||||
vec2 scrollSize(0,0);
|
||||
Vector2f relativePos = relativePosition(_event.getPos());
|
||||
Vector2f scrollOffset(0,0);
|
||||
Vector2f scrollSize(0,0);
|
||||
if (m_subWidget != null) {
|
||||
scrollOffset = m_subWidget->getOffset();
|
||||
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());
|
||||
if( _event.getType() == gale::key::type::mouse
|
||||
&& ( m_highSpeedType == gale::key::type::unknow
|
||||
@ -242,7 +242,7 @@ bool ewol::widget::Scroll::onEventInput(const ewol::event::Input& _event) {
|
||||
return false;
|
||||
} else if( _event.getId() == 4
|
||||
&& _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()) {
|
||||
scrollOffset.setY(scrollOffset.y()-m_pixelScrolling);
|
||||
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
|
||||
&& _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()) {
|
||||
scrollOffset.setY(scrollOffset.y()+m_pixelScrolling);
|
||||
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::finger == m_highSpeedType ) ) {
|
||||
if (1 == _event.getId()) {
|
||||
EWOL_VERBOSE("event: " << _event);
|
||||
Log.verbose("event: " << _event);
|
||||
if (gale::key::status::down == _event.getStatus()) {
|
||||
m_highSpeedMode = speedModeInit;
|
||||
m_highSpeedType = gale::key::type::finger;
|
||||
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;
|
||||
} else if (gale::key::status::upAfter == _event.getStatus()) {
|
||||
m_highSpeedMode = speedModeDisable;
|
||||
m_highSpeedType = gale::key::type::unknow;
|
||||
EWOL_VERBOSE("SCROOL == > DISABLE");
|
||||
Log.verbose("SCROOL == > DISABLE");
|
||||
markToRedraw();
|
||||
return true;
|
||||
} else if ( m_highSpeedMode == speedModeInit
|
||||
@ -379,14 +379,14 @@ bool ewol::widget::Scroll::onEventInput(const ewol::event::Input& _event) {
|
||||
// the scrooling can start :
|
||||
// select the direction :
|
||||
m_highSpeedMode = speedModeEnableFinger;
|
||||
EWOL_VERBOSE("SCROOL == > ENABLE");
|
||||
Log.verbose("SCROOL == > ENABLE");
|
||||
markToRedraw();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
if ( m_highSpeedMode == speedModeEnableFinger
|
||||
&& 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);
|
||||
if (propertyLimit->x() != 0.0f) {
|
||||
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:
|
||||
m_highSpeedStartPos = relativePos;
|
||||
EWOL_VERBOSE("SCROOL == > MOVE " << scrollOffset);
|
||||
Log.verbose("SCROOL == > MOVE " << scrollOffset);
|
||||
markToRedraw();
|
||||
if (m_subWidget != null) {
|
||||
m_subWidget->setOffset(scrollOffset);
|
||||
@ -412,7 +412,7 @@ bool ewol::widget::Scroll::onEventInput(const ewol::event::Input& _event) {
|
||||
&& gale::key::status::leave == _event.getStatus()) {
|
||||
m_highSpeedMode = speedModeDisable;
|
||||
m_highSpeedType = gale::key::type::unknow;
|
||||
EWOL_VERBOSE("SCROOL == > DISABLE");
|
||||
Log.verbose("SCROOL == > DISABLE");
|
||||
markToRedraw();
|
||||
return true;
|
||||
}
|
||||
@ -420,7 +420,7 @@ bool ewol::widget::Scroll::onEventInput(const ewol::event::Input& _event) {
|
||||
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);
|
||||
if (tmpWidget != null) {
|
||||
return tmpWidget;
|
||||
|
@ -19,7 +19,7 @@ namespace ewol {
|
||||
using ScrollWeak = ememory::WeakPtr<ewol::widget::Scroll>;
|
||||
class Scroll : public ewol::widget::Container {
|
||||
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> propertyShapeHori; //!< Horizontal shaper name
|
||||
eproperty::Value<bool> propertyHover; //!< Horizontal shaper name
|
||||
@ -37,7 +37,7 @@ namespace ewol {
|
||||
ewol::compositing::Shaper m_shaperV; //!< Compositing theme Vertical.
|
||||
private:
|
||||
float m_pixelScrolling;
|
||||
vec2 m_highSpeedStartPos;
|
||||
Vector2f m_highSpeedStartPos;
|
||||
enum highSpeedMode m_highSpeedMode;
|
||||
int32_t m_highSpeedButton;
|
||||
enum gale::key::type m_highSpeedType;
|
||||
@ -53,7 +53,7 @@ namespace ewol {
|
||||
void onRegenerateDisplay() override;
|
||||
bool onEventInput(const ewol::event::Input& _event) override;
|
||||
void systemDraw(const ewol::DrawProperty& _displayProp) override;
|
||||
ewol::WidgetShared getWidgetAtPos(const vec2& _pos) override;
|
||||
ewol::WidgetShared getWidgetAtPos(const Vector2f& _pos) override;
|
||||
protected:
|
||||
void onDraw() override;
|
||||
protected:
|
||||
|
@ -46,7 +46,7 @@ ewol::widget::Select::~Select() {
|
||||
void ewol::widget::Select::onChangePropertyValue() {
|
||||
markToRedraw();
|
||||
if (m_widgetEntry == null) {
|
||||
EWOL_ERROR("Can not acces at entry ...");
|
||||
Log.error("Can not acces at entry ...");
|
||||
return;
|
||||
}
|
||||
for (auto &it : m_listElement) {
|
||||
@ -64,7 +64,7 @@ void ewol::widget::Select::onChangePropertyValue() {
|
||||
|
||||
void ewol::widget::Select::optionSelectDefault() {
|
||||
if (m_widgetEntry == null) {
|
||||
EWOL_ERROR("Can not acces at entry ...");
|
||||
Log.error("Can not acces at entry ...");
|
||||
return;
|
||||
}
|
||||
for (auto &it : m_listElement) {
|
||||
@ -81,7 +81,7 @@ void ewol::widget::Select::optionSelectDefault() {
|
||||
void ewol::widget::Select::optionRemove(int32_t _value) {
|
||||
for (auto it=m_listElement.begin(); it != m_listElement.end(); ++it) {
|
||||
if (_value == it->m_value) {
|
||||
EWOL_DEBUG("remove element: " << _value);
|
||||
Log.debug("remove element: " << _value);
|
||||
m_listElement.erase(it);
|
||||
break;
|
||||
}
|
||||
@ -97,7 +97,7 @@ void ewol::widget::Select::optionClear() {
|
||||
void ewol::widget::Select::optionAdd(int32_t _value, etk::String _data) {
|
||||
for (auto &it : m_listElement) {
|
||||
if (_value == it.m_value) {
|
||||
EWOL_DEBUG("replace element: " << _value << " with: '" << _data << "'");
|
||||
Log.debug("replace element: " << _value << " with: '" << _data << "'");
|
||||
it.m_name = _data;
|
||||
}
|
||||
}
|
||||
@ -120,7 +120,7 @@ bool ewol::widget::Select::loadXML(const exml::Element& _node) {
|
||||
continue;
|
||||
}
|
||||
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;
|
||||
}
|
||||
etk::String valId = pNode.attributes["id"];
|
||||
@ -152,7 +152,7 @@ void ewol::widget::Select::updateGui() {
|
||||
}
|
||||
|
||||
void ewol::widget::Select::onCallbackLabelPressed(int32_t _value) {
|
||||
EWOL_VERBOSE("User select:" << _value);
|
||||
Log.verbose("User select:" << _value);
|
||||
propertyValue.set(_value);
|
||||
}
|
||||
|
||||
@ -160,7 +160,7 @@ void ewol::widget::Select::onCallbackOpenMenu() {
|
||||
// create a context menu:
|
||||
ewol::widget::ContextMenuShared tmpContext = ewol::widget::ContextMenu::create();
|
||||
if (tmpContext == null) {
|
||||
EWOL_ERROR("Allocation Error");
|
||||
Log.error("Allocation Error");
|
||||
return;
|
||||
}
|
||||
// auto-select mark position:
|
||||
@ -168,18 +168,18 @@ void ewol::widget::Select::onCallbackOpenMenu() {
|
||||
ewol::widget::SizerShared mySizer;
|
||||
mySizer = ewol::widget::Sizer::create();
|
||||
if (mySizer == null) {
|
||||
EWOL_ERROR("Allocation Error or sizer");
|
||||
Log.error("Allocation Error or sizer");
|
||||
return;
|
||||
}
|
||||
mySizer->propertyMode.set(widget::Sizer::modeVert);
|
||||
mySizer->propertyLockExpand.set(vec2(true,true));
|
||||
mySizer->propertyFill.set(vec2(true,true));
|
||||
mySizer->propertyLockExpand.set(Vector2f(true,true));
|
||||
mySizer->propertyFill.set(Vector2f(true,true));
|
||||
// set it in the pop-up-system:
|
||||
tmpContext->setSubWidget(mySizer);
|
||||
for (auto &it : m_listElement) {
|
||||
ewol::widget::LabelShared myLabel = ewol::widget::Label::create();
|
||||
if (myLabel == null) {
|
||||
EWOL_ERROR("Allocation Error");
|
||||
Log.error("Allocation Error");
|
||||
continue;
|
||||
}
|
||||
if (it.m_selected == true) {
|
||||
@ -187,8 +187,8 @@ void ewol::widget::Select::onCallbackOpenMenu() {
|
||||
} else {
|
||||
myLabel->propertyValue.set(it.m_name);
|
||||
}
|
||||
myLabel->propertyExpand.set(bvec2(true,true));
|
||||
myLabel->propertyFill.set(bvec2(true,true));
|
||||
myLabel->propertyExpand.set(Vector2b(true,true));
|
||||
myLabel->propertyFill.set(Vector2b(true,true));
|
||||
// set callback
|
||||
myLabel->signalPressed.connect(sharedFromThis(), &ewol::widget::Select::onCallbackLabelPressed, it.m_value);
|
||||
myLabel->signalPressed.connect(tmpContext, &ewol::widget::ContextMenu::destroy);
|
||||
@ -197,7 +197,7 @@ void ewol::widget::Select::onCallbackOpenMenu() {
|
||||
}
|
||||
ewol::widget::WindowsShared currentWindows = getWindows();
|
||||
if (currentWindows == null) {
|
||||
EWOL_ERROR("Can not get the curent Windows...");
|
||||
Log.error("Can not get the curent Windows...");
|
||||
} else {
|
||||
currentWindows->popUpWidgetPush(tmpContext);
|
||||
}
|
||||
|
@ -42,11 +42,11 @@ namespace ewol {
|
||||
etk::String m_name;
|
||||
bool m_selected;
|
||||
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(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:
|
||||
void optionSelectDefault();
|
||||
void optionRemove(int32_t _value);
|
||||
|
@ -17,7 +17,7 @@ ewol::widget::Sizer::Sizer() :
|
||||
"The display mode",
|
||||
&ewol::widget::Sizer::onChangePropertyMode),
|
||||
propertyBorderSize(this, "border",
|
||||
vec2(0,0),
|
||||
Vector2f(0,0),
|
||||
"The sizer border size",
|
||||
&ewol::widget::Sizer::onChangePropertyBorderSize),
|
||||
propertyAnimation(this, "annimation",
|
||||
@ -37,37 +37,37 @@ 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() {
|
||||
ewol::Widget::onChangeSize();
|
||||
vec2 tmpBorderSize = propertyBorderSize->getPixel();
|
||||
EWOL_VERBOSE("[" << getId() << "] update size : " << m_size << " nbElement : " << m_subWidget.size() << " borderSize=" << tmpBorderSize << " from border=" << propertyBorderSize);
|
||||
vec2 localWidgetSize = m_size - tmpBorderSize*2.0f;
|
||||
Vector2f tmpBorderSize = propertyBorderSize->getPixel();
|
||||
Log.verbose("[" << getId() << "] update size : " << m_size << " nbElement : " << m_subWidget.size() << " borderSize=" << tmpBorderSize << " from border=" << propertyBorderSize);
|
||||
Vector2f localWidgetSize = m_size - tmpBorderSize*2.0f;
|
||||
// -1- calculate min-size and expand requested:
|
||||
vec2 minSize(0.0f, 0.0f);
|
||||
ivec2 nbWidgetExpand(0,0);
|
||||
Vector2f minSize(0.0f, 0.0f);
|
||||
Vector2i nbWidgetExpand(0,0);
|
||||
for (auto &it : m_subWidget) {
|
||||
if (it == null) {
|
||||
continue;
|
||||
}
|
||||
vec2 tmpSize = it->getCalculateMinSize();
|
||||
Vector2f tmpSize = it->getCalculateMinSize();
|
||||
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());
|
||||
} else {
|
||||
minSize = vec2(minSize.x() + tmpSize.x(),
|
||||
minSize = Vector2f(minSize.x() + tmpSize.x(),
|
||||
etk::max(minSize.y(), tmpSize.y()));
|
||||
}
|
||||
bvec2 expand = it->canExpand();
|
||||
nbWidgetExpand += ivec2(expand.x()==true?1:0,
|
||||
Vector2b expand = it->canExpand();
|
||||
nbWidgetExpand += Vector2i(expand.x()==true?1:0,
|
||||
expand.y()==true?1:0);
|
||||
}
|
||||
// -2- Calculate the size to add at every elements...
|
||||
float deltaExpandSize = 0.0f;
|
||||
if (nbWidgetExpand != ivec2(0,0)) {
|
||||
if (nbWidgetExpand != Vector2i(0,0)) {
|
||||
if (*propertyMode == ewol::widget::Sizer::modeVert) {
|
||||
deltaExpandSize = (localWidgetSize.y() - minSize.y()) / float(nbWidgetExpand.y());
|
||||
} else {
|
||||
@ -97,8 +97,8 @@ void ewol::widget::Sizer::onChangeSize() {
|
||||
if (it == null) {
|
||||
continue;
|
||||
}
|
||||
vec2 tmpSizeMin = it->getSize();
|
||||
vec2 tmpSizeMax = it->getCalculateMaxSize();
|
||||
Vector2f tmpSizeMin = it->getSize();
|
||||
Vector2f tmpSizeMax = it->getCalculateMaxSize();
|
||||
// Now update his size his size in X and the curent sizer size in Y:
|
||||
if (*propertyMode == ewol::widget::Sizer::modeVert) {
|
||||
if (it->canExpand().y() == true) {
|
||||
@ -152,14 +152,14 @@ void ewol::widget::Sizer::onChangeSize() {
|
||||
if (it->canExpand().x() == false) {
|
||||
continue;
|
||||
}
|
||||
vec2 tmpSizeMin = it->getSize();
|
||||
Vector2f tmpSizeMin = it->getSize();
|
||||
tmpSizeMin.setX(etk::avg(tmpSizeMin.x(), localWidgetSize.x(), it->getCalculateMaxSize().x()));
|
||||
it->setSize(tmpSizeMin);
|
||||
} else {
|
||||
if (it->canExpand().y() == false) {
|
||||
continue;
|
||||
}
|
||||
vec2 tmpSizeMin = it->getSize();
|
||||
Vector2f tmpSizeMin = it->getSize();
|
||||
tmpSizeMin.setY(etk::avg(tmpSizeMin.y(), localWidgetSize.y(), it->getCalculateMaxSize().y()));
|
||||
it->setSize(tmpSizeMin);
|
||||
}
|
||||
@ -169,38 +169,38 @@ void ewol::widget::Sizer::onChangeSize() {
|
||||
if (it == null) {
|
||||
continue;
|
||||
}
|
||||
it->setSize(vec2ClipInt32(it->getSize()));
|
||||
it->setSize(Vector2fClipInt32(it->getSize()));
|
||||
}
|
||||
// -7- get under Size
|
||||
vec2 underSize(0,0);
|
||||
Vector2f underSize(0,0);
|
||||
for (auto &it : m_subWidget) {
|
||||
if (it == null) {
|
||||
continue;
|
||||
}
|
||||
vec2 size = it->getSize();
|
||||
Vector2f size = it->getSize();
|
||||
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()));
|
||||
} else {
|
||||
underSize += vec2(size.x(), 0.0f);
|
||||
underSize += Vector2f(size.x(), 0.0f);
|
||||
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:
|
||||
vec2 tmpOrigin = m_origin + tmpBorderSize + ewol::gravityGenerateDelta(propertyGravity, deltas);
|
||||
Vector2f tmpOrigin = m_origin + tmpBorderSize + ewol::gravityGenerateDelta(propertyGravity, deltas);
|
||||
// -9- Set sub widget origin:
|
||||
for (auto &it : m_subWidget) {
|
||||
if (it == null) {
|
||||
continue;
|
||||
}
|
||||
vec2 origin;
|
||||
vec2 size = it->getSize();
|
||||
Vector2f origin;
|
||||
Vector2f size = it->getSize();
|
||||
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 {
|
||||
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);
|
||||
if (*propertyMode == ewol::widget::Sizer::modeVert) {
|
||||
@ -220,11 +220,11 @@ void ewol::widget::Sizer::onChangeSize() {
|
||||
}
|
||||
|
||||
void ewol::widget::Sizer::calculateMinMaxSize() {
|
||||
EWOL_VERBOSE("[" << getId() << "] update minimum size");
|
||||
Log.verbose("[" << getId() << "] update minimum size");
|
||||
m_subExpend.setValue(false, false);
|
||||
m_minSize = propertyMinSize->getPixel();
|
||||
vec2 tmpBorderSize = propertyBorderSize->getPixel();
|
||||
EWOL_VERBOSE("[" << getId() << "] {" << getObjectType() << "} set min size : " << m_minSize);
|
||||
Vector2f tmpBorderSize = propertyBorderSize->getPixel();
|
||||
Log.verbose("[" << getId() << "] {" << getObjectType() << "} set min size : " << m_minSize);
|
||||
for (auto &it : m_subWidget) {
|
||||
if (it == null) {
|
||||
continue;
|
||||
@ -236,9 +236,9 @@ void ewol::widget::Sizer::calculateMinMaxSize() {
|
||||
if (it->canExpand().y() == true) {
|
||||
m_subExpend.setY(true);
|
||||
}
|
||||
vec2 tmpSize = it->getCalculateMinSize();
|
||||
EWOL_VERBOSE("[" << getId() << "] NewMinSize=" << tmpSize);
|
||||
EWOL_VERBOSE("[" << getId() << "] {" << getObjectType() << "} Get minSize="<< tmpSize);
|
||||
Vector2f tmpSize = it->getCalculateMinSize();
|
||||
Log.verbose("[" << getId() << "] NewMinSize=" << tmpSize);
|
||||
Log.verbose("[" << getId() << "] {" << getObjectType() << "} Get minSize="<< tmpSize);
|
||||
if (*propertyMode == ewol::widget::Sizer::modeVert) {
|
||||
m_minSize.setY(m_minSize.y() + tmpSize.y());
|
||||
if (tmpSize.x()>m_minSize.x()) {
|
||||
@ -252,7 +252,7 @@ void ewol::widget::Sizer::calculateMinMaxSize() {
|
||||
}
|
||||
}
|
||||
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) {
|
||||
|
@ -47,7 +47,7 @@ ewol::widget::Slider::~Slider() {
|
||||
}
|
||||
|
||||
void ewol::widget::Slider::calculateMinMaxSize() {
|
||||
vec2 minTmp = propertyMinSize->getPixel();
|
||||
Vector2f minTmp = propertyMinSize->getPixel();
|
||||
m_minSize.setValue(etk::max(minTmp.x(), 40.0f),
|
||||
etk::max(minTmp.y(), dotRadius*2.0f) );
|
||||
markToRedraw();
|
||||
@ -66,13 +66,13 @@ void ewol::widget::Slider::onRegenerateDisplay() {
|
||||
m_draw.setColor(m_textColorFg);
|
||||
// draw a line :
|
||||
m_draw.setThickness(1);
|
||||
m_draw.setPos(vec3(dotRadius, m_size.y()/2, 0) );
|
||||
m_draw.lineTo(vec3(m_size.x()-dotRadius, m_size.y()/2, 0) );
|
||||
m_draw.setPos(Vector3f(dotRadius, m_size.y()/2, 0) );
|
||||
m_draw.lineTo(Vector3f(m_size.x()-dotRadius, m_size.y()/2, 0) );
|
||||
m_draw.setThickness(0);
|
||||
|
||||
etk::Color<> borderDot = m_textColorFg;
|
||||
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.circle(dotRadius);
|
||||
m_draw.setColorBg(m_textColorFg);
|
||||
@ -80,17 +80,17 @@ void ewol::widget::Slider::onRegenerateDisplay() {
|
||||
}
|
||||
|
||||
bool ewol::widget::Slider::onEventInput(const ewol::event::Input& _event) {
|
||||
vec2 relativePos = relativePosition(_event.getPos());
|
||||
//EWOL_DEBUG("Event on Slider ..." << _event);
|
||||
Vector2f relativePos = relativePosition(_event.getPos());
|
||||
//Log.debug("Event on Slider ..." << _event);
|
||||
if (1 == _event.getId()) {
|
||||
if( gale::key::status::pressSingle == _event.getStatus()
|
||||
|| gale::key::status::move == _event.getStatus()) {
|
||||
// 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;
|
||||
updateValue(*propertyMinimum + (float)(relativePos.x() - dotRadius) / (m_size.x()-2*dotRadius) * (*propertyMaximum-*propertyMinimum));
|
||||
if (oldValue != *propertyValue) {
|
||||
EWOL_VERBOSE(" new value : " << *propertyValue << " in [" << *propertyMinimum << ".." << *propertyMaximum << "]");
|
||||
Log.verbose(" new value : " << *propertyValue << " in [" << *propertyMinimum << ".." << *propertyMaximum << "]");
|
||||
signalChange.emit(*propertyValue);
|
||||
}
|
||||
return true;
|
||||
|
@ -17,7 +17,7 @@ ewol::widget::Spacer::Spacer() :
|
||||
"background of the spacer",
|
||||
&ewol::widget::Spacer::onChangePropertyColor) {
|
||||
addObjectType("ewol::widget::Spacer");
|
||||
propertyMinSize.setDirectCheck(gale::Dimension(vec2(10,10)));
|
||||
propertyMinSize.setDirectCheck(gale::Dimension(Vector2f(10,10)));
|
||||
propertyCanFocus.setDirectCheck(true);
|
||||
}
|
||||
|
||||
@ -40,8 +40,8 @@ void ewol::widget::Spacer::onRegenerateDisplay() {
|
||||
return;
|
||||
}
|
||||
m_draw.setColor(propertyColor);
|
||||
m_draw.setPos(vec3(0, 0, 0) );
|
||||
m_draw.rectangleWidth(vec3(m_size.x(), m_size.y(),0) );
|
||||
m_draw.setPos(Vector3f(0, 0, 0) );
|
||||
m_draw.rectangleWidth(Vector3f(m_size.x(), m_size.y(),0) );
|
||||
}
|
||||
|
||||
void ewol::widget::Spacer::onChangePropertyColor() {
|
||||
|
@ -37,7 +37,7 @@ namespace ewol {
|
||||
private:
|
||||
ewol::compositing::Drawing m_draw; //!< Compositing drawing element
|
||||
public:
|
||||
ewol::WidgetShared getWidgetAtPos(const vec2& _pos) override {
|
||||
ewol::WidgetShared getWidgetAtPos(const Vector2f& _pos) override {
|
||||
return null;
|
||||
};
|
||||
void onRegenerateDisplay() override;
|
||||
|
@ -48,7 +48,7 @@ ewol::widget::Spin::~Spin() {
|
||||
void ewol::widget::Spin::onChangePropertyValue() {
|
||||
markToRedraw();
|
||||
if (m_widgetEntry == null) {
|
||||
EWOL_ERROR("Can not acces at entry ...");
|
||||
Log.error("Can not acces at entry ...");
|
||||
return;
|
||||
}
|
||||
checkValue(*propertyValue);
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user