[DEV] rewrite the _ at the compositing element

This commit is contained in:
Edouard DUPIN 2013-05-31 23:19:03 +02:00
parent 426403da3b
commit d3ee207699
15 changed files with 438 additions and 587 deletions

View File

@ -15,7 +15,7 @@
#undef __class__
#define __class__ "ewol::Area"
ewol::Area::Area(ivec2 size) :
ewol::Area::Area(const ivec2& _size) :
m_position(0.0, 0.0, 0.0),
m_color(draw::color::white),
m_GLprogram(NULL),
@ -27,7 +27,7 @@ ewol::Area::Area(ivec2 size) :
m_resource(NULL)
{
ewol::resource::Keep(m_resource);
m_resource->SetImageSize(size);
m_resource->SetImageSize(_size);
m_resource->Flush();
LoadProgram();
}
@ -98,26 +98,7 @@ void ewol::Area::Clear(void)
m_position = vec3(0.0, 0.0, 0.0);
}
vec3 ewol::Area::GetPos(void)
{
return m_position;
}
void ewol::Area::SetPos(vec3 pos)
{
m_position = pos;
}
void ewol::Area::SetRelPos(vec3 pos)
{
m_position += pos;
}
void ewol::Area::Print(ivec2 size)
void ewol::Area::Print(const ivec2& _size)
{
vec3 point(0,0,0);
vec2 tex(0,1);
@ -130,7 +111,7 @@ void ewol::Area::Print(ivec2 size)
tex.setValue(1,1);
point.setX(m_position.x() + size.x());
point.setX(m_position.x() + _size.x());
point.setY(m_position.y());
m_coord.PushBack(point);
m_coordTex.PushBack(tex);
@ -138,8 +119,8 @@ void ewol::Area::Print(ivec2 size)
tex.setValue(1,0);
point.setX(m_position.x() + size.x());
point.setY(m_position.y() + size.y());
point.setX(m_position.x() + _size.x());
point.setY(m_position.y() + _size.y());
m_coord.PushBack(point);
m_coordTex.PushBack(tex);
m_coordColor.PushBack(m_color);
@ -150,7 +131,7 @@ void ewol::Area::Print(ivec2 size)
tex.setValue(0,0);
point.setX(m_position.x());
point.setY(m_position.y() + size.y());
point.setY(m_position.y() + _size.y());
m_coord.PushBack(point);
m_coordTex.PushBack(tex);
m_coordColor.PushBack(m_color);

View File

@ -60,23 +60,24 @@ namespace ewol
* @brief Get the current display position (sometime needed in the gui control)
* @return the current position.
*/
vec3 GetPos(void);
const vec3& GetPos(void) { 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);
inline void SetPos(const vec2& _pos) { SetPos(vec3(_pos.x(),_pos.y())); };
void SetPos(const vec3& _pos) { m_position = _pos; };
inline void SetPos(const vec2& _pos) { SetPos(vec3(_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 vec3& _pos) { m_position += _pos; };
inline void SetRelPos(const vec2& _pos) { SetRelPos(vec3(_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
* @param[in] _size Size of the output image
*/
void Print(ivec2 size);
void Print(const ivec2& _size);
draw::Image& Get(void) { return m_resource->Get(); };
void Flush(void) { m_resource->Flush(); };

View File

@ -31,21 +31,21 @@ void ewol::Compositing::ResetMatrix(void)
}
void ewol::Compositing::Translate(vec3 vect)
void ewol::Compositing::Translate(const vec3& _vect)
{
m_matrixApply *= etk::matTranslate(vect);
m_matrixApply *= etk::matTranslate(_vect);
}
void ewol::Compositing::Rotate(vec3 vect, float angle)
void ewol::Compositing::Rotate(const vec3& _vect, float _angle)
{
m_matrixApply *= etk::matRotate(vect, angle);
m_matrixApply *= etk::matRotate(_vect, _angle);
}
void ewol::Compositing::Scale(vec3 vect)
void ewol::Compositing::Scale(const vec3& _vect)
{
m_matrixApply *= etk::matScale(vect);
m_matrixApply *= etk::matScale(_vect);
}
@ -55,7 +55,7 @@ void ewol::Compositing::Clear(void)
}
void ewol::Compositing::SetMatrix(const mat4& mat)
void ewol::Compositing::SetMatrix(const mat4& _mat)
{
m_matrixApply = mat;
m_matrixApply = _mat;
}

View File

@ -42,24 +42,24 @@ namespace ewol
virtual void ResetMatrix(void);
/**
* @brief Translate the current display of this element
* @param[in] vect The translation vector to apply at the transformation matrix
* @param[in] _vect The translation vector to apply at the transformation matrix
*/
virtual void Translate(vec3 vect);
virtual void Translate(const vec3& _vect);
/**
* @brief Rotate the curent display of this element
* @param[in] vect The rotation vector to apply at the transformation matrix
* @param[in] _vect The rotation vector to apply at the transformation matrix
*/
virtual void Rotate(vec3 vect, float angle);
virtual void Rotate(const vec3& _vect, float _angle);
/**
* @brief Scale the current diaplsy of this element
* @param[in] vect The scaling vector to apply at the transformation matrix
* @param[in] _vect The scaling vector to apply at the transformation matrix
*/
virtual void Scale(vec3 vect);
virtual void Scale(const vec3& _vect);
/**
* @brief set the transformation matrix
* @param[in] mat The new matrix.
* @param[in] _mat The new matrix.
*/
virtual void SetMatrix(const mat4& mat);
virtual void SetMatrix(const mat4& _mat);
};
};

View File

@ -257,23 +257,23 @@ void ewol::Drawing::GenerateTriangle(void)
m_coordColor.PushBack(m_tricolor[2]);
}
void ewol::Drawing::InternalSetColor(draw::Color& color)
void ewol::Drawing::InternalSetColor(const draw::Color& _color)
{
if (m_triElement < 1) {
m_tricolor[0] = color;
m_tricolor[0] = _color;
}
if (m_triElement < 2) {
m_tricolor[1] = color;
m_tricolor[1] = _color;
}
if (m_triElement < 3) {
m_tricolor[2] = color;
m_tricolor[2] = _color;
}
}
void ewol::Drawing::SetPoint(vec3 point)
void ewol::Drawing::SetPoint(const vec3& _point)
{
m_triangle[m_triElement] = point;
m_triangle[m_triElement] = _point;
m_triElement++;
if (m_triElement>=3) {
GenerateTriangle();
@ -332,7 +332,6 @@ void ewol::Drawing::Draw(void)
m_GLprogram->UnUse();
}
void ewol::Drawing::Clear(void)
{
// call upper class
@ -356,108 +355,64 @@ void ewol::Drawing::Clear(void)
}
}
vec3 ewol::Drawing::GetPos(void)
{
return m_position;
}
void ewol::Drawing::SetPos(vec3 pos)
{
m_position = pos;
}
void ewol::Drawing::SetRelPos(vec3 pos)
{
m_position += pos;
}
void ewol::Drawing::SetColor(draw::Color color)
{
m_color = color;
}
void ewol::Drawing::SetColorBg(draw::Color color)
{
m_colorBg = color;
}
void ewol::Drawing::SetClippingWidth(vec3 pos, vec3 width)
{
SetClipping(pos, pos+width);
}
void ewol::Drawing::SetClipping(vec3 pos, vec3 posEnd)
void ewol::Drawing::SetClipping(const vec3& _pos, const vec3& _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());
m_clippingPosStop.setX(posEnd.x());
if (_pos.x() <= _posEnd.x()) {
m_clippingPosStart.setX(_pos.x());
m_clippingPosStop.setX(_posEnd.x());
} else {
m_clippingPosStart.setX(posEnd.x());
m_clippingPosStop.setX(pos.x());
m_clippingPosStart.setX(_posEnd.x());
m_clippingPosStop.setX(_pos.x());
}
if (pos.y() <= posEnd.y()) {
m_clippingPosStart.setY(pos.y());
m_clippingPosStop.setY(posEnd.y());
if (_pos.y() <= _posEnd.y()) {
m_clippingPosStart.setY(_pos.y());
m_clippingPosStop.setY(_posEnd.y());
} else {
m_clippingPosStart.setY(posEnd.y());
m_clippingPosStop.setY(pos.y());
m_clippingPosStart.setY(_posEnd.y());
m_clippingPosStop.setY(_pos.y());
}
if (pos.z() <= posEnd.z()) {
m_clippingPosStart.setZ(pos.z());
m_clippingPosStop.setZ(posEnd.z());
if (_pos.z() <= _posEnd.z()) {
m_clippingPosStart.setZ(_pos.z());
m_clippingPosStop.setZ(_posEnd.z());
} else {
m_clippingPosStart.setZ(posEnd.z());
m_clippingPosStop.setZ(pos.z());
m_clippingPosStart.setZ(_posEnd.z());
m_clippingPosStop.setZ(_pos.z());
}
m_clippingEnable = true;
}
void ewol::Drawing::SetClippingMode(bool newMode)
void ewol::Drawing::SetThickness(float _thickness)
{
m_clippingEnable = newMode;
}
void ewol::Drawing::SetThickness(float thickness)
{
m_thickness = thickness;
m_thickness = _thickness;
// thickness must be positive
if (m_thickness < 0) {
m_thickness *= -1;
}
}
void ewol::Drawing::AddVertex(void)
{
InternalSetColor(m_color);
SetPoint(m_position);
}
void ewol::Drawing::LineTo(vec3 dest)
void ewol::Drawing::LineTo(const vec3& _dest)
{
ResetCount();
InternalSetColor(m_color);
//EWOL_DEBUG("DrawLine : " << m_position << " to " << dest);
if (m_position.x() == dest.x() && m_position.y() == dest.y() && m_position.z() == dest.z()) {
if (m_position.x() == _dest.x() && m_position.y() == _dest.y() && m_position.z() == _dest.z()) {
EWOL_WARNING("Try to draw an line width 0");
return;
}
//teta = tan-1(oposer/adjacent)
float teta = 0;
if (m_position.x() <= dest.x()) {
teta = atan((dest.y()-m_position.y())/(dest.x()-m_position.x()));
if (m_position.x() <= _dest.x()) {
teta = atan((_dest.y()-m_position.y())/(_dest.x()-m_position.x()));
} else {
teta = M_PI + atan((dest.y()-m_position.y())/(dest.x()-m_position.x()));
teta = M_PI + atan((_dest.y()-m_position.y())/(_dest.x()-m_position.x()));
}
if (teta < 0) {
teta += 2*M_PI;
@ -470,22 +425,16 @@ void ewol::Drawing::LineTo(vec3 dest)
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(vec3(_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(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()) );
// update the system position :
m_position = dest;
m_position = _dest;
}
void ewol::Drawing::LineRel(vec3 vect)
{
LineTo(m_position+vect);
}
void ewol::Drawing::Rectangle(vec3 dest)
void ewol::Drawing::Rectangle(const vec3& _dest)
{
ResetCount();
InternalSetColor(m_color);
@ -497,7 +446,7 @@ void ewol::Drawing::Rectangle(vec3 dest)
* yD *------*
*/
float dxA = m_position.x();
float dxB = dest.x();
float dxB = _dest.x();
if (dxA > dxB) {
// inverse order :
float tmp = dxA;
@ -505,7 +454,7 @@ void ewol::Drawing::Rectangle(vec3 dest)
dxB = tmp;
}
float dyC = m_position.y();
float dyD = dest.y();
float dyD = _dest.y();
if (dyC > dyD) {
// inverse order :
float tmp = dyC;
@ -539,31 +488,22 @@ void ewol::Drawing::Rectangle(vec3 dest)
SetPoint(vec3(dxA, dyD, 0) );
}
void ewol::Drawing::RectangleWidth(vec3 size)
{
Rectangle(m_position+size);
}
void ewol::Drawing::Cube(vec3 dest)
void ewol::Drawing::Cube(const vec3& _dest)
{
}
void ewol::Drawing::Circle(float radius, float angleStart, float angleStop)
void ewol::Drawing::Circle(float _radius, float _angleStart, float _angleStop)
{
ResetCount();
if (radius<0) {
radius *= -1;
if (_radius<0) {
_radius *= -1;
}
angleStop = angleStop-angleStart;
_angleStop = _angleStop-_angleStart;
int32_t nbOcurence = radius;
int32_t nbOcurence = _radius;
if (nbOcurence < 10)
{
nbOcurence = 10;
@ -577,17 +517,17 @@ void ewol::Drawing::Circle(float radius, float angleStart, float angleStop)
m_position.y(),
0) );
float angleOne = angleStart + (angleStop* iii / nbOcurence) ;
float offsety = sin(angleOne) * radius;
float offsetx = cos(angleOne) * radius;
float angleOne = _angleStart + (_angleStop* iii / nbOcurence) ;
float offsety = sin(angleOne) * _radius;
float offsetx = cos(angleOne) * _radius;
SetPoint(vec3(m_position.x() + offsetx,
m_position.y() + offsety,
0) );
float angleTwo = angleStart + (angleStop* (iii+1) / nbOcurence) ;
offsety = sin(angleTwo) * radius;
offsetx = cos(angleTwo) * radius;
float angleTwo = _angleStart + (_angleStop* (iii+1) / nbOcurence) ;
offsety = sin(angleTwo) * _radius;
offsetx = cos(angleTwo) * _radius;
SetPoint(vec3(m_position.x() + offsetx,
m_position.y() + offsety,
@ -603,17 +543,17 @@ void ewol::Drawing::Circle(float radius, float angleStart, float angleStop)
InternalSetColor(m_color);
for (int32_t iii=0; iii<nbOcurence; iii++) {
float angleOne = angleStart + (angleStop* iii / nbOcurence) ;
float offsetExty = sin(angleOne) * (radius+m_thickness/2);
float offsetExtx = cos(angleOne) * (radius+m_thickness/2);
float offsetInty = sin(angleOne) * (radius-m_thickness/2);
float offsetIntx = cos(angleOne) * (radius-m_thickness/2);
float angleOne = _angleStart + (_angleStop* iii / nbOcurence) ;
float offsetExty = sin(angleOne) * (_radius+m_thickness/2);
float offsetExtx = cos(angleOne) * (_radius+m_thickness/2);
float offsetInty = sin(angleOne) * (_radius-m_thickness/2);
float offsetIntx = cos(angleOne) * (_radius-m_thickness/2);
float angleTwo = angleStart + (angleStop* (iii+1) / nbOcurence );
float offsetExt2y = sin(angleTwo) * (radius+m_thickness/2);
float offsetExt2x = cos(angleTwo) * (radius+m_thickness/2);
float offsetInt2y = sin(angleTwo) * (radius-m_thickness/2);
float offsetInt2x = cos(angleTwo) * (radius-m_thickness/2);
float angleTwo = _angleStart + (_angleStop* (iii+1) / nbOcurence );
float offsetExt2y = sin(angleTwo) * (_radius+m_thickness/2);
float offsetExt2x = cos(angleTwo) * (_radius+m_thickness/2);
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));

View File

@ -69,14 +69,14 @@ namespace ewol
void ResetCount(void);
/**
* @brief Set the Color of the current triangle drawing
* @param[in] color Color to current dots generated
* @param[in] _color Color to current dots generated
*/
void InternalSetColor(draw::Color& color);
void InternalSetColor(const draw::Color& _color);
/**
* @brief internal add of the specific point
* @param[in] point The requeste dpoint to add
* @param[in] _point The requeste dpoint to add
*/
void SetPoint(vec3 point);
void SetPoint(const vec3& point);
public:
/**
@ -91,91 +91,93 @@ namespace ewol
* @brief Get the current display position (sometime needed in the gui control)
* @return the current position.
*/
vec3 GetPos(void);
const vec3& GetPos(void) { return m_position; };
/**
* @brief Set position for the next text writen
* @param[in] pos Position of the text (in 3D)
* @param[in] _pos Position of the text (in 3D)
*/
void SetPos(vec3 pos);
inline void SetPos(const vec2& pos) { SetPos(vec3(pos.x(), pos.y(), 0)); };
void SetPos(const vec3& _pos) { m_position = _pos; };
inline void SetPos(const vec2& _pos) { SetPos(vec3(_pos.x(), _pos.y(), 0)); };
/**
* @brief Set relative position for the next text writen
* @param[in] pos ofset apply of the text (in 3D)
* @param[in] _pos ofset apply of the text (in 3D)
*/
void SetRelPos(vec3 pos);
inline void SetRelPos(const vec2& pos) { SetRelPos(vec3(pos.x(), pos.y(), 0)); };
void SetRelPos(const vec3& _pos) { m_position += _pos; };
inline void SetRelPos(const vec2& _pos) { SetRelPos(vec3(_pos.x(), _pos.y(), 0)); };
/**
* @brief Set the Color of the current foreground font
* @param[in] color Color to set on foreground (for next print)
* @param[in] _color Color to set on foreground (for next print)
*/
void SetColor(draw::Color color);
void SetColor(const draw::Color& _color) { m_color = _color; };
/**
* @brief Set the background color of the font (for selected Text (not the global BG))
* @param[in] color Color to set on background (for next print)
* @param[in] _color Color to set on background (for next print)
*/
void SetColorBg(draw::Color color);
void SetColorBg(const draw::Color& _color) { m_colorBg = _color; };
/**
* @brief Request a clipping area for the text (next draw only)
* @param[in] pos Start position of the clipping
* @param[in] width Width size of the clipping
* @param[in]_ pos Start position of the clipping
* @param[in] _width Width size of the clipping
*/
void SetClippingWidth(vec3 pos, vec3 width);
void SetClippingWidth(const vec3& _pos, const vec3& _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)); };
/**
* @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
* @param[in] _pos Start position of the clipping
* @param[in] _posEnd End position of the clipping
*/
void SetClipping(vec3 pos, vec3 posEnd);
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)); };
/**
* @brief Enable/Disable the clipping (without lose the current clipping position)
* @brief newMode The new status of the clipping
* @brief _newMode The new status of the clipping
*/
void SetClippingMode(bool newMode);
void SetClippingMode(bool _newMode) { m_clippingEnable = _newMode; };
/**
* @brief Specify the line thickness for the next elements
* @param[in] thickness The thickness disired for the next print
* @param[in] _thickness The thickness disired for the next print
*/
void SetThickness(float thickness);
void SetThickness(float _thickness);
/**
* @brief Add a point reference at the current position (this is a vertex reference at the current position
*/
void AddVertex(void);
/**
* @brief Draw a line to a specific position
* @param[in] dest Position of the end of the line.
* @param[in] _dest Position of the end of the line.
*/
void LineTo(vec3 dest);
inline void LineTo(const vec2& dest) { LineTo(vec3(dest.x(), dest.y(), 0)); };
void LineTo(const vec3& _dest);
inline void LineTo(const vec2& _dest) { LineTo(vec3(_dest.x(), _dest.y(), 0)); };
/**
* @brief Relative drawing a line (spacial vector)
* @param[in] vect Vector of the curent line.
* @param[in] _vect Vector of the curent line.
*/
void LineRel(vec3 vect);
inline void LineRel(const vec2& vect) { LineRel(vec3(vect.x(), vect.y(), 0)); };
void LineRel(const vec3& _vect) { LineTo(m_position+_vect); };
inline void LineRel(const vec2& _vect) { LineRel(vec3(_vect.x(), _vect.y(), 0)); };
/**
* @brief Draw a 2D rectangle to the position requested.
* @param[in] dest Position the the end of the rectangle
* @param[in] _dest Position the the end of the rectangle
*/
void Rectangle(vec3 dest);
inline void Rectangle(const vec2& dest) { Rectangle(vec3(dest.x(), dest.y(), 0)); };
void Rectangle(const vec3& _dest);
inline void Rectangle(const vec2& _dest) { Rectangle(vec3(_dest.x(), _dest.y(), 0)); };
/**
* @brief Draw a 2D rectangle to the requested size.
* @param[in] width size of the rectangle
* @param[in] _size size of the rectangle
*/
void RectangleWidth(vec3 size);
inline void RectangleWidth(const vec2& size) { RectangleWidth(vec3(size.x(), size.y(), 0)); };
void RectangleWidth(const vec3& _size) { Rectangle(m_position+_size); };
inline void RectangleWidth(const vec2& _size) { RectangleWidth(vec3(_size.x(), _size.y(), 0)); };
/**
* @brief Draw a 3D rectangle to the position requested.
* @param[in] dest Position the the end of the rectangle
* @param[in] _dest Position the the end of the rectangle
*/
void Cube(vec3 dest);
void Cube(const vec3& _dest);
/**
* @brief Draw a 2D circle with the specify rafdius parameter.
* @param[in] radius Distence to the dorder
* @param[in] angleStart start angle of this circle ([0..2PI] otherwithe ==> disable)
* @param[in] angleStop stop angle of this circle ([0..2PI] otherwithe ==> disable)
* @param[in] _radius Distence to the dorder
* @param[in] _angleStart start angle of this circle ([0..2PI] otherwithe ==> disable)
* @param[in] _angleStop stop angle of this circle ([0..2PI] otherwithe ==> disable)
*/
void Circle(float radius, float angleStart = 0, float angleStop = 2*M_PI);
void Circle(float _radius, float _angleStart = 0, float _angleStop = 2*M_PI);
};
};

View File

@ -15,7 +15,7 @@
#undef __class__
#define __class__ "ewol::Image"
ewol::Image::Image(const etk::UString& imageName) :
ewol::Image::Image(const etk::UString& _imageName) :
m_position(0.0, 0.0, 0.0),
m_clippingPosStart(0.0, 0.0, 0.0),
m_clippingPosStop(0.0, 0.0, 0.0),
@ -31,7 +31,7 @@ ewol::Image::Image(const etk::UString& imageName) :
m_GLtexID(-1),
m_resource(NULL)
{
SetSource(imageName);
SetSource(_imageName);
LoadProgram();
}
@ -107,74 +107,37 @@ void ewol::Image::Clear(void)
m_angle = 0.0;
}
vec3 ewol::Image::GetPos(void)
{
return m_position;
}
void ewol::Image::SetPos(const vec3& pos)
{
m_position = pos;
}
void ewol::Image::SetRelPos(const vec3& pos)
{
m_position += pos;
}
void ewol::Image::SetColor(const draw::Color& color)
{
m_color = color;
}
void ewol::Image::SetClippingWidth(const vec3& pos, vec3 width)
{
SetClipping(pos, pos+width);
}
void ewol::Image::SetClipping(const vec3& pos, vec3 posEnd)
void ewol::Image::SetClipping(const vec3& _pos, vec3 _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());
m_clippingPosStop.setX(posEnd.x());
if (_pos.x() <= _posEnd.x()) {
m_clippingPosStart.setX(_pos.x());
m_clippingPosStop.setX(_posEnd.x());
} else {
m_clippingPosStart.setX(posEnd.x());
m_clippingPosStop.setX(pos.x());
m_clippingPosStart.setX(_posEnd.x());
m_clippingPosStop.setX(_pos.x());
}
if (pos.y() <= posEnd.y()) {
m_clippingPosStart.setY(pos.y());
m_clippingPosStop.setY(posEnd.y());
if (_pos.y() <= _posEnd.y()) {
m_clippingPosStart.setY(_pos.y());
m_clippingPosStop.setY(_posEnd.y());
} else {
m_clippingPosStart.setY(posEnd.y());
m_clippingPosStop.setY(pos.y());
m_clippingPosStart.setY(_posEnd.y());
m_clippingPosStop.setY(_pos.y());
}
if (pos.z() <= posEnd.z()) {
m_clippingPosStart.setZ(pos.z());
m_clippingPosStop.setZ(posEnd.z());
if (_pos.z() <= _posEnd.z()) {
m_clippingPosStart.setZ(_pos.z());
m_clippingPosStop.setZ(_posEnd.z());
} else {
m_clippingPosStart.setZ(posEnd.z());
m_clippingPosStop.setZ(pos.z());
m_clippingPosStart.setZ(_posEnd.z());
m_clippingPosStop.setZ(_pos.z());
}
m_clippingEnable = true;
}
void ewol::Image::SetClippingMode(bool newMode)
void ewol::Image::SetAngle(const vec3& _axes, float _angle)
{
m_clippingEnable = newMode;
}
void ewol::Image::SetAngle(const vec3& axes, float angle)
{
m_axes = axes;
m_angle = angle;
m_axes = _axes;
m_angle = _angle;
if( m_axes.x() == 0
&& m_axes.y() == 0
&& m_axes.z() == 0) {
@ -182,12 +145,7 @@ void ewol::Image::SetAngle(const vec3& axes, float angle)
}
}
void ewol::Image::Print(const ivec2& size)
{
Print(vec2(size.x(),size.y()));
}
void ewol::Image::Print(const vec2& size)
void ewol::Image::Print(const vec2& _size)
{
vec3 point(0,0,0);
vec2 tex(0,1);
@ -200,7 +158,7 @@ void ewol::Image::Print(const vec2& size)
tex.setValue(1,1);
point.setX(m_position.x() + size.x());
point.setX(m_position.x() + _size.x());
point.setY(m_position.y());
m_coord.PushBack(point);
m_coordTex.PushBack(tex);
@ -208,8 +166,8 @@ void ewol::Image::Print(const vec2& size)
tex.setValue(1,0);
point.setX(m_position.x() + size.x());
point.setY(m_position.y() + size.y());
point.setX(m_position.x() + _size.x());
point.setY(m_position.y() + _size.y());
m_coord.PushBack(point);
m_coordTex.PushBack(tex);
m_coordColor.PushBack(m_color);
@ -220,7 +178,7 @@ void ewol::Image::Print(const vec2& size)
tex.setValue(0,0);
point.setX(m_position.x());
point.setY(m_position.y() + size.y());
point.setY(m_position.y() + _size.y());
m_coord.PushBack(point);
m_coordTex.PushBack(tex);
m_coordColor.PushBack(m_color);
@ -233,19 +191,14 @@ void ewol::Image::Print(const vec2& size)
m_coordColor.PushBack(m_color);
}
void ewol::Image::PrintPart(const ivec2& size,
const vec2& sourcePosStart,
const vec2& sourcePosStop)
void ewol::Image::PrintPart(const ivec2& _size,
const vec2& _sourcePosStart,
const vec2& _sourcePosStop)
{
}
void ewol::Image::SetSource(const etk::UString& newFile, int32_t size)
{
SetSource(newFile, vec2(size,size));
}
void ewol::Image::SetSource(const etk::UString& newFile, const vec2& size)
void ewol::Image::SetSource(const etk::UString& _newFile, const vec2& _size)
{
Clear();
// remove old one
@ -253,11 +206,11 @@ void ewol::Image::SetSource(const etk::UString& newFile, const vec2& size)
ewol::resource::Release(m_resource);
m_resource = NULL;
}
ivec2 tmpSize(size.x(),size.y());
ivec2 tmpSize(_size.x(),_size.y());
// note that no image can be loaded...
if (newFile != "") {
if (_newFile != "") {
// link to new One
if (false == ewol::resource::Keep(newFile, m_resource, tmpSize)) {
if (false == ewol::resource::Keep(_newFile, m_resource, tmpSize)) {
EWOL_ERROR("Can not get Image resource");
}
}

View File

@ -46,9 +46,9 @@ namespace ewol
public:
/**
* @brief generic constructor
* @param[in] imageName Name of the file that might be loaded
* @param[in] _imageName Name of the file that might be loaded
*/
Image(const etk::UString& imageName="");
Image(const etk::UString& _imageName="");
/**
* @brief generic destructor
*/
@ -66,71 +66,71 @@ namespace ewol
* @brief Get the current display position (sometime needed in the gui control)
* @return the current position.
*/
vec3 GetPos(void);
const vec3& GetPos(void) { return m_position; };
/**
* @brief Set position for the next text writen
* @param[in] pos Position of the text (in 3D)
* @param[in] _pos Position of the text (in 3D)
*/
void SetPos(const vec3& pos);
inline void SetPos(const vec2& pos) { SetPos(vec3(pos.x(),pos.y(),0)); };
void SetPos(const vec3& _pos) { m_position = _pos; };
inline void SetPos(const vec2& _pos) { SetPos(vec3(_pos.x(),_pos.y(),0)); };
/**
* @brief Set relative position for the next text writen
* @param[in] pos ofset apply of the text (in 3D)
* @param[in] _pos ofset apply of the text (in 3D)
*/
void SetRelPos(const vec3& pos);
inline void SetRelPos(const vec2& pos) { SetRelPos(vec3(pos.x(),pos.y(),0)); };
void SetRelPos(const vec3& _pos) { m_position += _pos; };
inline void SetRelPos(const vec2& _pos) { SetRelPos(vec3(_pos.x(),_pos.y(),0)); };
/**
* @brief Set the Color of the current foreground font
* @param[in] color Color to set on foreground (for next print)
* @param[in] _color Color to set on foreground (for next print)
*/
void SetColor(const draw::Color& color);
void SetColor(const draw::Color& _color) { m_color = _color; };
/**
* @brief Request a clipping area for the text (next draw only)
* @param[in] pos Start position of the clipping
* @param[in] width Width size of the clipping
* @param[in] _pos Start position of the clipping
* @param[in] _width Width size of the clipping
*/
void SetClippingWidth(const vec3& pos, vec3 width);
inline void SetClippingWidth(const vec2& pos, const vec2& width) { SetClippingWidth(vec3(pos.x(),pos.y(),0), vec3(width.x(),width.y(),0)); };
void SetClippingWidth(const vec3& _pos, vec3 _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)); };
/**
* @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
* @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 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)); };
/**
* @brief Enable/Disable the clipping (without lose the current clipping position)
* @brief newMode The new status of the clipping
* @brief _newMode The new status of the clipping
*/
void SetClippingMode(bool newMode);
void SetClippingMode(bool _newMode) { m_clippingEnable = _newMode; };
/**
* @brief Set a unique rotation of this element (not set in the Rotate Generic system)
* @param[in] axes Rotation axes selection
* @param[in] angle Angle to set on this axes
* @param[in] _axes Rotation axes selection
* @param[in] _angle Angle to set on this axes
*/
void SetAngle(const vec3& axes, float angle);
void SetAngle(const vec3& _axes, float _angle);
/**
* @brief Add a compleate of the image to display with the requested size
* @param[in] size Size of the output image
* @param[in] _size Size of the output image
*/
void Print(const ivec2& size);
void Print(const vec2& size);
void Print(const ivec2& _size) { Print(vec2(_size.x(),_size.y())); };
void Print(const vec2& _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).
* @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 ivec2& size,
const vec2& sourcePosStart,
const vec2& sourcePosStop);
void PrintPart(const ivec2& _size,
const vec2& _sourcePosStart,
const vec2& _sourcePosStop);
/**
* @brief Change the image Source ==> can not be done to display 2 images at the same time ...
* @param[in] newFile New file of the Image
* @param[in] size for the image when Verctorial image loading is requested
* @param[in] _newFile New file of the Image
* @param[in] _size for the image when Verctorial image loading is requested
*/
void SetSource(const etk::UString& newFile, int32_t size=32);
void SetSource(const etk::UString& newFile, const vec2& size);
void SetSource(const etk::UString& _newFile, int32_t _size=32) { SetSource(_newFile, vec2(_size,_size)); };
void SetSource(const etk::UString& _newFile, const vec2& _size);
/**
* @brief Sometimes the user declare an image but not allocate the ressources all the time, this is to know it ..
* @return the validity od the resources.

View File

@ -43,7 +43,7 @@ ewol::Text::Text(void) :
}
ewol::Text::Text(etk::UString fontName, int32_t fontSize) :
ewol::Text::Text(const etk::UString& _fontName, int32_t _fontSize) :
m_position(0.0, 0.0, 0.0),
m_clippingPosStart(0.0, 0.0, 0.0),
m_clippingPosStop(0.0, 0.0, 0.0),
@ -69,7 +69,7 @@ ewol::Text::Text(etk::UString fontName, int32_t fontSize) :
m_cursorPos(-100),
m_font(NULL)
{
SetFont(fontName, fontSize);
SetFont(_fontName, _fontSize);
LoadProgram();
}
@ -98,7 +98,7 @@ void ewol::Text::LoadProgram(void)
}
}
void ewol::Text::Draw(const mat4& transformationMatrix, bool enableDepthTest)
void ewol::Text::Draw(const mat4& _transformationMatrix, bool _enableDepthTest)
{
// draw BG in any case:
@ -117,13 +117,13 @@ void ewol::Text::Draw(const mat4& transformationMatrix, bool enableDepthTest)
EWOL_ERROR("No shader ...");
return;
}
if (true==enableDepthTest) {
if (true==_enableDepthTest) {
ewol::openGL::Enable(ewol::openGL::FLAG_DEPTH_TEST);
}
// set Matrix : translation/positionMatrix
mat4 projMatrix = ewol::openGL::GetMatrix();
mat4 camMatrix = ewol::openGL::GetCameraMatrix();
mat4 tmpMatrix = projMatrix * camMatrix * transformationMatrix;
mat4 tmpMatrix = projMatrix * camMatrix * _transformationMatrix;
m_GLprogram->Use();
m_GLprogram->UniformMatrix4fv(m_GLMatrix, 1, tmpMatrix.m_mat);
// TextureID
@ -137,7 +137,7 @@ void ewol::Text::Draw(const mat4& transformationMatrix, bool enableDepthTest)
// Request the draw od the elements :
ewol::openGL::DrawArrays(GL_TRIANGLES, 0, m_coord.Size());
m_GLprogram->UnUse();
if (true==enableDepthTest) {
if (true==_enableDepthTest) {
ewol::openGL::Disable(ewol::openGL::FLAG_DEPTH_TEST);
}
}
@ -178,24 +178,24 @@ void ewol::Text::Draw(void)
m_GLprogram->UnUse();
}
void ewol::Text::Translate(vec3 vect)
void ewol::Text::Translate(const vec3& _vect)
{
ewol::Compositing::Translate(vect);
m_vectorialDraw.Translate(vect);
ewol::Compositing::Translate(_vect);
m_vectorialDraw.Translate(_vect);
}
void ewol::Text::Rotate(vec3 vect, float angle)
void ewol::Text::Rotate(const vec3& _vect, float _angle)
{
ewol::Compositing::Rotate(vect, angle);
m_vectorialDraw.Rotate(vect, angle);
ewol::Compositing::Rotate(_vect, _angle);
m_vectorialDraw.Rotate(_vect, _angle);
}
void ewol::Text::Scale(vec3 vect)
void ewol::Text::Scale(const vec3& _vect)
{
ewol::Compositing::Scale(vect);
m_vectorialDraw.Scale(vect);
ewol::Compositing::Scale(_vect);
m_vectorialDraw.Scale(_vect);
}
@ -237,14 +237,7 @@ void ewol::Text::Reset(void)
m_nbCharDisplayed = 0;
}
vec3 ewol::Text::GetPos(void)
{
return m_position;
}
void ewol::Text::SetPos(const vec3& pos)
void ewol::Text::SetPos(const vec3& _pos)
{
// check min max for display area
if (m_nbCharDisplayed != 0) {
@ -256,7 +249,7 @@ void ewol::Text::SetPos(const vec3& pos)
EWOL_VERBOSE("update size 2 " << m_sizeDisplayStart << " " << m_sizeDisplayStop);
}
// update position
m_position = pos;
m_position = _pos;
m_previousCharcode = 0;
m_vectorialDraw.SetPos(m_position);
// update min max of the display area:
@ -276,101 +269,78 @@ void ewol::Text::SetPos(const vec3& pos)
}
void ewol::Text::SetRelPos(const vec3& pos)
void ewol::Text::SetRelPos(const vec3& _pos)
{
m_position += pos;
m_position += _pos;
m_previousCharcode = 0;
m_vectorialDraw.SetPos(m_position);
}
void ewol::Text::SetColor(const draw::Color& color)
void ewol::Text::SetColorBg(const draw::Color& _color)
{
m_color = color;
m_colorBg = _color;
m_vectorialDraw.SetColor(_color);
}
void ewol::Text::SetColorBg(const draw::Color& color)
{
m_colorBg = color;
m_vectorialDraw.SetColor(color);
}
void ewol::Text::SetClippingWidth(const vec2& pos, const vec2& width)
{
SetClipping(pos, pos+width);
}
void ewol::Text::SetClippingWidth(const vec3& pos, const vec3& width)
{
SetClipping(pos, pos+width);
}
void ewol::Text::SetClipping(const vec2& pos, const vec2& posEnd)
{
SetClipping(vec3(pos.x(),pos.y(),-1), vec3(posEnd.x(),posEnd.y(),1) );
}
void ewol::Text::SetClipping(const vec3& pos, const vec3& posEnd)
void ewol::Text::SetClipping(const vec3& _pos, const vec3& _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());
m_clippingPosStop.setX(posEnd.x());
if (_pos.x() <= _posEnd.x()) {
m_clippingPosStart.setX(_pos.x());
m_clippingPosStop.setX(_posEnd.x());
} else {
m_clippingPosStart.setX(posEnd.x());
m_clippingPosStop.setX(pos.x());
m_clippingPosStart.setX(_posEnd.x());
m_clippingPosStop.setX(_pos.x());
}
if (pos.y() <= posEnd.y()) {
m_clippingPosStart.setY(pos.y());
m_clippingPosStop.setY(posEnd.y());
if (_pos.y() <= _posEnd.y()) {
m_clippingPosStart.setY(_pos.y());
m_clippingPosStop.setY(_posEnd.y());
} else {
m_clippingPosStart.setY(posEnd.y());
m_clippingPosStop.setY(pos.y());
m_clippingPosStart.setY(_posEnd.y());
m_clippingPosStop.setY(_pos.y());
}
if (pos.z() <= posEnd.z()) {
m_clippingPosStart.setZ(pos.z());
m_clippingPosStop.setZ(posEnd.z());
if (_pos.z() <= _posEnd.z()) {
m_clippingPosStart.setZ(_pos.z());
m_clippingPosStop.setZ(_posEnd.z());
} else {
m_clippingPosStart.setZ(posEnd.z());
m_clippingPosStop.setZ(pos.z());
m_clippingPosStart.setZ(_posEnd.z());
m_clippingPosStop.setZ(_pos.z());
}
m_clippingEnable = true;
//m_vectorialDraw.SetClipping(m_clippingPosStart, m_clippingPosStop);
}
void ewol::Text::SetClippingMode(bool newMode)
void ewol::Text::SetClippingMode(bool _newMode)
{
m_clippingEnable = newMode;
m_clippingEnable = _newMode;
//m_vectorialDraw.SetClippingMode(m_clippingEnable);
}
void ewol::Text::SetFontSize(int32_t fontSize)
void ewol::Text::SetFontSize(int32_t _fontSize)
{
// get old size
etk::UString fontName = "";
if (NULL != m_font) {
fontName = m_font->GetName();
}
SetFont(fontName, fontSize);
SetFont(fontName, _fontSize);
}
void ewol::Text::SetFontName(const etk::UString& fontName)
void ewol::Text::SetFontName(const etk::UString& _fontName)
{
// get old size
int32_t fontSize = -1;
if (NULL != m_font) {
fontSize = m_font->GetFontSize();
}
SetFont(fontName, fontSize);
SetFont(_fontName, fontSize);
}
void ewol::Text::SetFont(etk::UString fontName, int32_t fontSize)
void ewol::Text::SetFont(etk::UString _fontName, int32_t _fontSize)
{
Clear();
// remove old one
@ -378,25 +348,25 @@ void ewol::Text::SetFont(etk::UString fontName, int32_t fontSize)
ewol::resource::Release(m_font);
m_font = NULL;
}
if (fontSize <= 0) {
fontSize = ewol::config::FontGetDefaultSize();
if (_fontSize <= 0) {
_fontSize = ewol::config::FontGetDefaultSize();
}
if (fontName == "") {
fontName = ewol::config::FontGetDefaultName();
if (_fontName == "") {
_fontName = ewol::config::FontGetDefaultName();
}
fontName += ":";
fontName += fontSize;
_fontName += ":";
_fontName += _fontSize;
// link to new One
if (false == ewol::resource::Keep(fontName, m_font)) {
if (false == ewol::resource::Keep(_fontName, m_font)) {
EWOL_ERROR("Can not get font resource");
}
}
void ewol::Text::SetFontMode(ewol::font::mode_te mode)
void ewol::Text::SetFontMode(ewol::font::mode_te _mode)
{
if (NULL!=m_font) {
m_mode = m_font->GetWrappingMode(mode);
m_mode = m_font->GetWrappingMode(_mode);
}
}
@ -407,9 +377,9 @@ ewol::font::mode_te ewol::Text::GetFontMode(void)
}
void ewol::Text::SetFontBold(bool status)
void ewol::Text::SetFontBold(bool _status)
{
if (true == status) {
if (true == _status) {
// enable
if (m_mode == ewol::font::Regular) {
SetFontMode(ewol::font::Bold);
@ -426,9 +396,9 @@ void ewol::Text::SetFontBold(bool status)
}
}
void ewol::Text::SetFontItalic(bool status)
void ewol::Text::SetFontItalic(bool _status)
{
if (true == status) {
if (true == _status) {
// enable
if (m_mode == ewol::font::Regular) {
SetFontMode(ewol::font::Italic);
@ -446,30 +416,30 @@ void ewol::Text::SetFontItalic(bool status)
}
void ewol::Text::SetKerningMode(bool newMode)
void ewol::Text::SetKerningMode(bool _newMode)
{
m_kerning = newMode;
m_kerning = _newMode;
}
void ewol::Text::SetDistanceFieldMode(bool newMode)
void ewol::Text::SetDistanceFieldMode(bool _newMode)
{
m_distanceField = newMode;
m_distanceField = _newMode;
EWOL_TODO("The Distance field mode is not availlable for now ...");
}
void ewol::Text::Print(const etk::UString& text)
void ewol::Text::Print(const etk::UString& _text)
{
etk::Vector<TextDecoration> decorationEmpty;
Print(text, decorationEmpty);
Print(_text, decorationEmpty);
}
void ewol::Text::ParseHtmlNode(void* element2)
void ewol::Text::ParseHtmlNode(void* _element2)
{
// get the static real pointer
TiXmlNode* element = static_cast<TiXmlNode*>(element2);
TiXmlNode* element = static_cast<TiXmlNode*>(_element2);
if (NULL == element) {
EWOL_ERROR( "Error Input node does not existed ...");
}
@ -599,7 +569,7 @@ void ewol::Text::PrintHTML(const etk::UString& _text)
HtmlFlush();
}
void ewol::Text::Print(const etk::UString& text, const etk::Vector<TextDecoration>& decoration)
void ewol::Text::Print(const etk::UString& _text, const etk::Vector<TextDecoration>& _decoration)
{
if (m_font == NULL) {
EWOL_ERROR("Font Id is not corectly defined");
@ -618,12 +588,12 @@ void ewol::Text::Print(const etk::UString& text, const etk::Vector<TextDecoratio
}
}
// note this is faster when nothing is requested ...
for(int32_t iii=0; iii<text.Size(); iii++) {
for(int32_t iii=0; iii<_text.Size(); iii++) {
// check if ve have decoration
if (iii<decoration.Size()) {
tmpFg = decoration[iii].m_colorFg;
tmpBg = decoration[iii].m_colorBg;
SetFontMode(decoration[iii].m_mode);
if (iii<_decoration.Size()) {
tmpFg = _decoration[iii].m_colorFg;
tmpBg = _decoration[iii].m_colorBg;
SetFontMode(_decoration[iii].m_mode);
}
// if real display : ( not display is for size calculation)
if (true == m_needDisplay) {
@ -642,12 +612,12 @@ void ewol::Text::Print(const etk::UString& text, const etk::Vector<TextDecoratio
&& m_colorBg.a != 0) {
vec3 pos = m_position;
m_vectorialDraw.SetPos(pos);
Print(text[iii]);
Print(_text[iii]);
float fontHeigh = m_font->GetHeight(m_mode);
m_vectorialDraw.RectangleWidth(vec3(m_position.x()-pos.x(),fontHeigh,0.0f) );
m_nbCharDisplayed++;
} else {
Print(text[iii]);
Print(_text[iii]);
m_nbCharDisplayed++;
}
// display the cursor if needed (if it is at the other position...)
@ -671,8 +641,8 @@ void ewol::Text::Print(const etk::UString& text, const etk::Vector<TextDecoratio
int32_t stop;
int32_t space;
int32_t freeSpace;
while (currentId < text.Size()) {
bool needNoJustify = ExtrapolateLastId(text, currentId, stop, space, freeSpace);
while (currentId < _text.Size()) {
bool needNoJustify = ExtrapolateLastId(_text, currentId, stop, space, freeSpace);
float interpolation = basicSpaceWidth;
switch (m_alignement)
@ -710,13 +680,13 @@ void ewol::Text::Print(const etk::UString& text, const etk::Vector<TextDecoratio
SetColorBg(m_colorCursor);
PrintCursor(false);
}
for(int32_t iii=currentId; iii<stop && iii<text.Size(); iii++) {
for(int32_t iii=currentId; iii<stop && iii<_text.Size(); iii++) {
float fontHeigh = m_font->GetHeight(m_mode);
// Get specific decoration if provided
if (iii<decoration.Size()) {
tmpFg = decoration[iii].m_colorFg;
tmpBg = decoration[iii].m_colorBg;
SetFontMode(decoration[iii].m_mode);
if (iii<_decoration.Size()) {
tmpFg = _decoration[iii].m_colorFg;
tmpBg = _decoration[iii].m_colorBg;
SetFontMode(_decoration[iii].m_mode);
}
if (true == m_needDisplay) {
if( ( m_selectionStartPos-1<iii
@ -731,7 +701,7 @@ void ewol::Text::Print(const etk::UString& text, const etk::Vector<TextDecoratio
}
}
// special for the justify mode
if (text[iii] == (uniChar_t)' ') {
if (_text[iii] == etk::UniChar(' ')) {
//EWOL_DEBUG(" generateString : \" \"");
if( true == m_needDisplay
&& m_colorBg.a != 0) {
@ -751,11 +721,11 @@ void ewol::Text::Print(const etk::UString& text, const etk::Vector<TextDecoratio
&& m_colorBg.a != 0) {
vec3 pos = m_position;
m_vectorialDraw.SetPos(pos);
Print(text[iii]);
Print(_text[iii]);
m_vectorialDraw.RectangleWidth(vec3(m_position.x()-pos.x(),fontHeigh,0.0f) );
m_nbCharDisplayed++;
} else {
Print(text[iii]);
Print(_text[iii]);
m_nbCharDisplayed++;
}
}
@ -769,14 +739,14 @@ void ewol::Text::Print(const etk::UString& text, const etk::Vector<TextDecoratio
}
if (currentId == stop) {
currentId++;
} else if(text[stop] == (uniChar_t)' ') {
} else if(_text[stop] == etk::UniChar(' ')) {
currentId = stop+1;
// Reset position :
SetPos(vec3(m_startTextpos,
(float)(m_position.y() - m_font->GetHeight(m_mode)),
m_position.z()) );
m_nbCharDisplayed++;
} else if(text[stop] == (uniChar_t)'\n') {
} else if(_text[stop] == etk::UniChar('\n')) {
currentId = stop+1;
// Reset position :
SetPos(vec3(m_startTextpos,
@ -792,14 +762,14 @@ void ewol::Text::Print(const etk::UString& text, const etk::Vector<TextDecoratio
}
void ewol::Text::Print(const uniChar_t& charcode)
void ewol::Text::Print(const etk::UniChar& _charcode)
{
if (NULL==m_font) {
EWOL_ERROR("Font Id is not corectly defined");
return;
}
// get a pointer on the glyph property :
ewol::GlyphProperty * myGlyph = m_font->GetGlyphPointer(charcode, m_mode);
ewol::GlyphProperty * myGlyph = m_font->GetGlyphPointer(_charcode, m_mode);
if (NULL==myGlyph) {
EWOL_ERROR(" font does not really existed ...");
return;
@ -816,7 +786,7 @@ void ewol::Text::Print(const uniChar_t& charcode)
}
}
// 0x01 == 0x20 == ' ';
if (charcode != 0x01) {
if (_charcode != 0x01) {
/* Bitmap position
* xA xB
* yC *------*
@ -960,7 +930,7 @@ void ewol::Text::Print(const uniChar_t& charcode)
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);
// Register the previous character
m_previousCharcode = charcode;
m_previousCharcode = _charcode;
return;
}
@ -971,13 +941,13 @@ void ewol::Text::ForceLineReturn(void)
}
void ewol::Text::SetTextAlignement(float startTextpos, float stopTextPos, ewol::Text::aligneMode_te alignement)
void ewol::Text::SetTextAlignement(float _startTextpos, float _stopTextPos, ewol::Text::aligneMode_te _alignement)
{
m_startTextpos = startTextpos;
m_stopTextPos = stopTextPos+1;
m_alignement = alignement;
m_startTextpos = _startTextpos;
m_stopTextPos = _stopTextPos+1;
m_alignement = _alignement;
if (m_startTextpos >= m_stopTextPos) {
EWOL_ERROR("Request allignement with Borne position error : " << startTextpos << " => " << stopTextPos);
EWOL_ERROR("Request allignement with Borne position error : " << _startTextpos << " => " << _stopTextPos);
}
}
@ -994,7 +964,7 @@ void ewol::Text::DisableAlignement(void)
}
vec3 ewol::Text::CalculateSizeHTML(const etk::UString& text)
vec3 ewol::Text::CalculateSizeHTML(const etk::UString& _text)
{
// remove intermediate result
Reset();
@ -1004,7 +974,7 @@ vec3 ewol::Text::CalculateSizeHTML(const etk::UString& text)
SetPos(vec3(0,0,0) );
// same as print without the end display ...
PrintHTML(text);
PrintHTML(_text);
//EWOL_DEBUG(" 1 Start pos=" << m_sizeDisplayStart);
//EWOL_DEBUG(" 1 Stop pos=" << m_sizeDisplayStop);
@ -1026,27 +996,27 @@ vec3 ewol::Text::CalculateSizeHTML(const etk::UString& text)
m_sizeDisplayStop.z()-m_sizeDisplayStart.z());
}
vec3 ewol::Text::CalculateSizeDecorated(const etk::UString& text)
vec3 ewol::Text::CalculateSizeDecorated(const etk::UString& _text)
{
if (text.Size()==0) {
if (_text.Size()==0) {
return vec3(0,0,0);
}
etk::UString tmpData("<html><body>\n");
tmpData+=text;
tmpData+=_text;
tmpData+="\n</body></html>\n";
vec3 tmpVal = CalculateSizeHTML(tmpData);
return tmpVal;
}
vec3 ewol::Text::CalculateSize(const etk::UString& text)
vec3 ewol::Text::CalculateSize(const etk::UString& _text)
{
if (m_font == NULL) {
EWOL_ERROR("Font Id is not corectly defined");
return vec3(0,0,0);
}
vec3 outputSize(0, 0, 0);
for(int32_t iii=0; iii<text.Size(); iii++) {
vec3 tmpp = CalculateSize(text[iii]);
for(int32_t iii=0; iii<_text.Size(); iii++) {
vec3 tmpp = CalculateSize(_text[iii]);
if (outputSize.y() == 0) {
outputSize.setY(tmpp.y());
}
@ -1055,14 +1025,14 @@ vec3 ewol::Text::CalculateSize(const etk::UString& text)
return outputSize;
}
vec3 ewol::Text::CalculateSize(const uniChar_t charcode)
vec3 ewol::Text::CalculateSize(const etk::UniChar& _charcode)
{
if (m_font == NULL) {
EWOL_ERROR("Font Id is not corectly defined");
return vec3(0,0,0);
}
// get a pointer on the glyph property :
ewol::GlyphProperty * myGlyph = m_font->GetGlyphPointer(charcode, m_mode);
ewol::GlyphProperty * myGlyph = m_font->GetGlyphPointer(_charcode, m_mode);
int32_t fontHeigh = m_font->GetHeight(m_mode);
// Get the kerning ofset :
@ -1075,15 +1045,15 @@ vec3 ewol::Text::CalculateSize(const uniChar_t charcode)
(float)(fontHeigh),
(float)(0.0));
// Register the previous character
m_previousCharcode = charcode;
m_previousCharcode = _charcode;
return outputSize;
}
void ewol::Text::PrintCursor(bool isInsertMode)
void ewol::Text::PrintCursor(bool _isInsertMode)
{
int32_t fontHeigh = m_font->GetHeight(m_mode);
if (true == isInsertMode) {
if (true == _isInsertMode) {
m_vectorialDraw.RectangleWidth(vec3(20, fontHeigh, 0) );
} else {
m_vectorialDraw.SetThickness(2);
@ -1093,15 +1063,15 @@ void ewol::Text::PrintCursor(bool isInsertMode)
}
bool ewol::Text::ExtrapolateLastId(const etk::UString& text, const int32_t start, int32_t& stop, int32_t& space, int32_t& freeSpace)
bool ewol::Text::ExtrapolateLastId(const etk::UString& _text, const int32_t _start, int32_t& _stop, int32_t& _space, int32_t& _freeSpace)
{
// store previous :
uniChar_t storePrevious = m_previousCharcode;
etk::UniChar storePrevious = m_previousCharcode;
stop = text.Size();
space = 0;
_stop = _text.Size();
_space = 0;
int32_t lastSpacePosition = start;
int32_t lastSpacePosition = _start;
int32_t lastSpacefreeSize;
float endPos = m_position.x();
@ -1113,47 +1083,47 @@ bool ewol::Text::ExtrapolateLastId(const etk::UString& text, const int32_t start
stopPosition = m_startTextpos + 3999999999.0;
}
for (int32_t iii=start; iii<text.Size(); iii++) {
vec3 tmpSize = CalculateSize(text[iii]);
for (int32_t iii=_start; iii<_text.Size(); iii++) {
vec3 tmpSize = CalculateSize(_text[iii]);
// check oveflow :
if (endPos + tmpSize.x() > stopPosition) {
stop = iii;
_stop = iii;
break;
}
// save number of space :
if (text[iii] == (uniChar_t)' ') {
space++;
if (_text[iii] == etk::UniChar(' ')) {
_space++;
lastSpacePosition = iii;
lastSpacefreeSize = stopPosition - endPos;
} else if (text[iii] == (uniChar_t)'\n') {
stop = iii;
} else if (_text[iii] == etk::UniChar('\n')) {
_stop = iii;
endOfLine = true;
break;
}
// update local size :
endPos += tmpSize.x();
}
freeSpace = stopPosition - endPos;
_freeSpace = stopPosition - endPos;
// retore previous :
m_previousCharcode = storePrevious;
// need to align left or right ...
if(stop == text.Size()) {
if(_stop == _text.Size()) {
return true;
} else {
if (endOfLine) {
return true;
} else {
if (space == 0) {
if (_space == 0) {
return true;
}
stop = lastSpacePosition;
freeSpace = lastSpacefreeSize;
_stop = lastSpacePosition;
_freeSpace = lastSpacefreeSize;
return false;
}
}
}
void ewol::Text::HtmlAddData(etk::UString data)
void ewol::Text::HtmlAddData(const etk::UString& _data)
{
if( m_htmlCurrrentLine.Size()>0
&& m_htmlCurrrentLine[m_htmlCurrrentLine.Size()-1] != ' ') {
@ -1165,8 +1135,8 @@ void ewol::Text::HtmlAddData(etk::UString data)
m_htmlDecoration.PushBack(m_htmlDecoTmp);
}
}
m_htmlCurrrentLine += data;
for(int32_t iii=0; iii<data.Size() ; iii++) {
m_htmlCurrrentLine += _data;
for(int32_t iii=0; iii<_data.Size() ; iii++) {
m_htmlDecoration.PushBack(m_htmlDecoTmp);
}
}
@ -1188,24 +1158,24 @@ void ewol::Text::DisableCursor(void)
m_cursorPos = -100;
}
void ewol::Text::SetCursorPos(int32_t cursorPos)
void ewol::Text::SetCursorPos(int32_t _cursorPos)
{
m_selectionStartPos = cursorPos;
m_cursorPos = cursorPos;
m_selectionStartPos = _cursorPos;
m_cursorPos = _cursorPos;
}
void ewol::Text::SetCursorSelection(int32_t cursorPos, int32_t selectionStartPos)
void ewol::Text::SetCursorSelection(int32_t _cursorPos, int32_t _selectionStartPos)
{
m_selectionStartPos = selectionStartPos;
m_cursorPos = cursorPos;
m_selectionStartPos = _selectionStartPos;
m_cursorPos = _cursorPos;
}
void ewol::Text::SetSelectionColor(draw::Color color)
void ewol::Text::SetSelectionColor(const draw::Color& _color)
{
m_colorSelection = color;
m_colorSelection = _color;
}
void ewol::Text::SetCursorColor(draw::Color color)
void ewol::Text::SetCursorColor(const draw::Color& _color)
{
m_colorCursor = color;
m_colorCursor = _color;
}

View File

@ -99,27 +99,27 @@ namespace ewol
Text(void);
/**
* @brief generic constructor
* @param[in] fontName Name of the font that might be loaded
* @param[in] fontSize Size of the font that might be loaded
* @param[in] _fontName Name of the font that might be loaded
* @param[in] _fontSize Size of the font that might be loaded
*/
Text(etk::UString fontName, int32_t fontSize);
Text(const etk::UString& _fontName, int32_t _fontSize);
/**
* @brief generic destructor
*/
~Text(void);
public:
// Derived function
virtual void Translate(vec3 vect);
virtual void Translate(const vec3& _vect);
// Derived function
virtual void Rotate(vec3 vect, float angle);
virtual void Rotate(const vec3& _vect, float _angle);
// Derived function
virtual void Scale(vec3 vect);
virtual void Scale(const vec3& _vect);
public:
/**
* @brief Draw All the refistered text in the current element on openGL
*/
void Draw(void);
void Draw(const mat4& transformationMatrix, bool enableDepthTest=false);
void Draw(const mat4& _transformationMatrix, bool _enableDepthTest=false);
/**
* @brief Clear all the registered element in the current element
*/
@ -132,70 +132,70 @@ namespace ewol
* @brief Get the current display position (sometime needed in the gui control)
* @return the current position.
*/
vec3 GetPos(void);
const vec3& GetPos(void) { return m_position; };
/**
* @brief Set position for the next text writen
* @param[in] pos Position of the text (in 3D)
* @param[in] _pos Position of the text (in 3D)
*/
void SetPos(const vec3& pos);
inline void SetPos(const vec2& pos) { SetPos(vec3(pos.x(),pos.y(),0)); };
void SetPos(const vec3& _pos);
inline void SetPos(const vec2& _pos) { SetPos(vec3(_pos.x(),_pos.y(),0)); };
/**
* @brief Set relative position for the next text writen
* @param[in] pos ofset apply of the text (in 3D)
* @param[in] _pos ofset apply of the text (in 3D)
*/
void SetRelPos(const vec3& pos);
inline void SetRelPos(const vec2& pos) { SetRelPos(vec3(pos.x(),pos.y(),0)); };
void SetRelPos(const vec3& _pos);
inline void SetRelPos(const vec2& _pos) { SetRelPos(vec3(_pos.x(),_pos.y(),0)); };
/**
* @brief Set the Color of the current foreground font
* @param[in] color Color to set on foreground (for next print)
* @param[in] _color Color to set on foreground (for next print)
*/
void SetColor(const draw::Color& color);
void SetColor(const draw::Color& _color) { m_color = _color; };
/**
* @brief Set the background color of the font (for selected Text (not the global BG))
* @param[in] color Color to set on background (for next print)
* @param[in] _color Color to set on background (for next print)
*/
void SetColorBg(const draw::Color& color);
void SetColorBg(const draw::Color& _color);
/**
* @brief Request a clipping area for the text (next draw only)
* @param[in] pos Start position of the clipping
* @param[in] width Width size of the clipping
* @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 vec2& pos, const vec2& width);
void SetClippingWidth(const vec3& _pos, const vec3& _width) { SetClipping(_pos, _pos+_width); }
void SetClippingWidth(const vec2& _pos, const vec2& _width) { SetClipping(_pos, _pos+_width); };
/**
* @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
* @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 vec2& pos, const vec2& posEnd);
void SetClipping(const vec3& _pos, const vec3& _posEnd);
void SetClipping(const vec2& _pos, const vec2& _posEnd) { SetClipping(vec3(_pos.x(),_pos.y(),-1), vec3(_posEnd.x(),_posEnd.y(),1) ); };
/**
* @brief Enable/Disable the clipping (without lose the current clipping position)
* @brief newMode The new status of the clipping
* @brief _newMode The new status of the clipping
*/
// TODO : Rename SetClippingActivity
void SetClippingMode(bool newMode);
void SetClippingMode(bool _newMode);
/**
* @brief Specify the font size (this reset the internal element of the current text (system requirement)
* @param[in] fontSize New font size
* @param[in] _fontSize New font size
*/
void SetFontSize(int32_t fontSize);
void SetFontSize(int32_t _fontSize);
/**
* @brief Specify the font name (this reset the internal element of the current text (system requirement)
* @param[in] fontName Current name of the selected font
* @param[in] _fontName Current name of the selected font
*/
void SetFontName(const etk::UString& fontName);
void SetFontName(const etk::UString& _fontName);
/**
* @brief Specify the font property (this reset the internal element of the current text (system requirement)
* @param[in] fontName Current name of the selected font
* @param[in] fontSize New font size
*/
void SetFont(etk::UString fontName, int32_t fontSize);
void SetFont(etk::UString _fontName, int32_t _fontSize);
/**
* @brief Specify the font mode for the next @ref Print
* @param[in] mode The font mode requested
*/
void SetFontMode(ewol::font::mode_te mode);
void SetFontMode(ewol::font::mode_te _mode);
/**
* @brief Get the current font mode
* @return The font mode applied
@ -203,30 +203,30 @@ namespace ewol
ewol::font::mode_te GetFontMode(void);
/**
* @brief Enable or disable the bold mode
* @param[in] status The new status for this display property
* @param[in] _status The new status for this display property
*/
void SetFontBold(bool status);
void SetFontBold(bool _status);
/**
* @brief Enable or disable the italic mode
* @param[in] status The new status for this display property
* @param[in] _status The new status for this display property
*/
void SetFontItalic(bool status);
void SetFontItalic(bool _status);
/**
* @brief Set the activation of the Kerning for the display (if it existed)
* @param[in] newMode Enable/Diasable the kerning on this font.
* @param[in] _newMode Enable/Diasable the kerning on this font.
*/
void SetKerningMode(bool newMode);
void SetKerningMode(bool _newMode);
/**
* @brief Request the distance field mode for this text display
* @param[in] newMode Enable/Diasable the Distance Field on this font.
* @param[in] _newMode Enable/Diasable the Distance Field on this font.
* @todo : not implemented for now
*/
void SetDistanceFieldMode(bool newMode);
void SetDistanceFieldMode(bool _newMode);
/**
* @brief Display a compleat string in the current element.
* @param[in] text The string to display.
* @param[in] _text The string to display.
*/
void Print(const etk::UString& text);
void Print(const etk::UString& _text);
/**
* @brief Display a compleat string in the current element with the generic decoration specification. (basic html data)
* <pre>
@ -251,10 +251,10 @@ namespace ewol
* </justify>
* </pre>
* @note This is parsed with tiny xml, then be carfull that the XML is correct, and all balises are closed ... otherwite the display can not be done
* @param[in] text The string to display.
* @param[in] _text The string to display.
* @TODO : implementation not done ....
*/
void PrintDecorated(const etk::UString& text);
void PrintDecorated(const etk::UString& _text);
/**
* @brief Display a compleat string in the current element with the generic decoration specification. (basic html data)
* <pre>
@ -283,21 +283,21 @@ namespace ewol
* </html>
* </pre>
* @note This is parsed with tiny xml, then be carfull that the XML is correct, and all balises are closed ... otherwite the display can not be done
* @param[in] text The string to display.
* @param[in] _text The string to display.
* @TODO : implementation not done ....
*/
void PrintHTML(const etk::UString& text);
void PrintHTML(const etk::UString& _text);
/**
* @brief Display a compleat string in the current element whith specific decorations (advence mode).
* @param[in] text The string to display.
* @param[in] decoration The text decoration for the text that might be display (if the vector is smaller, the last parameter is get)
* @param[in] _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::UString& text, const etk::Vector<TextDecoration>& decoration);
void Print(const etk::UString& _text, const etk::Vector<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] char that might be dispalyed
* @param[in] _charcode Char that might be dispalyed
*/
void Print(const uniChar_t& charcode);
void Print(const uniChar_t& _charcode);
/**
* @brief This Generate the line return ==> it return to the alignement position start and at the correct line position ==> it might be use to not know the line height
*/
@ -305,18 +305,18 @@ namespace ewol
private:
/**
* @brief This parse a tinyXML node (void pointer to permit to hide tiny XML in include).
* @param[in] element the tynyXML element : TiXmlNode* .
* @param[in] _element the tynyXML element : TiXmlNode* .
*/
void ParseHtmlNode(void* element);
void ParseHtmlNode(void* _element);
public:
/**
* @brief This generate the possibility to generate the big text property
* @param[in] startTextpos The x text start position of the display.
* @param[in] stopTextPos The x text stop position of the display.
* @param[in] alignement mode of alignement for the Text.
* @param[in] _startTextpos The x text start position of the display.
* @param[in] _stopTextPos The x text stop position of the display.
* @param[in] _alignement mode of alignement for the Text.
* @note The text align in center change of line every display done (even if it was just a char)
*/
void SetTextAlignement(float startTextpos, float stopTextPos, ewol::Text::aligneMode_te alignement=ewol::Text::alignDisable);
void SetTextAlignement(float _startTextpos, float _stopTextPos, ewol::Text::aligneMode_te _alignement=ewol::Text::alignDisable);
/**
* @brief Disable the alignement system
*/
@ -328,45 +328,45 @@ namespace ewol
ewol::Text::aligneMode_te GetAlignement(void);
/**
* @brief Calculate a theoric text size
* @param[in] text The string to calculate dimention.
* @param[in] _text The string to calculate dimention.
* @return The theoric size used.
*/
vec3 CalculateSizeHTML(const etk::UString& text);
vec3 CalculateSizeHTML(const etk::UString& _text);
/**
* @brief Calculate a theoric text size
* @param[in] text The string to calculate dimention.
* @param[in] _text The string to calculate dimention.
* @return The theoric size used.
*/
vec3 CalculateSizeDecorated(const etk::UString& text);
vec3 CalculateSizeDecorated(const etk::UString& _text);
/**
* @brief Calculate a theoric text size
* @param[in] text The string to calculate dimention.
* @param[in] _text The string to calculate dimention.
* @return The theoric size used.
*/
vec3 CalculateSize(const etk::UString& text);
vec3 CalculateSize(const etk::UString& _text);
/**
* @brief Calculate a theoric charcode size
* @param[in] charcode The µUnicode value to calculate dimention.
* @param[in] _charcode The µUnicode value to calculate dimention.
* @return The theoric size used.
*/
vec3 CalculateSize(const uniChar_t charcode);
vec3 CalculateSize(const uniChar_t& _charcode);
/**
* @brief Draw a cursor at the specify position
* @param[in] isInsertMode True if the insert mode is activated
* @param[in] _isInsertMode True if the insert mode is activated
*/
void PrintCursor(bool isInsertMode);
void PrintCursor(bool _isInsertMode);
private:
/**
* @brief Calculate the element number that is the first out the alignement range
* (start at the specify ID, and use start pos with current one)
* @param[in] text The string that might be parsed.
* @param[in] start The first elemnt that might be used to calculate.
* @param[out] stop The last Id availlable in the current string.
* @param[out] space Number of space in the string.
* @parma[out] freespace This represent the number of pixel present in the right white space.
* @param[in] _text The string that might be parsed.
* @param[in] _start The first elemnt that might be used to calculate.
* @param[out] _stop The last Id availlable in the current string.
* @param[out] _space Number of space in the string.
* @parma[out] _freespace This represent the number of pixel present in the right white space.
* @return true if the rifht has free space that can be use for jystify (return false if we find \n
*/
bool ExtrapolateLastId(const etk::UString& text, const int32_t start, int32_t& stop, int32_t& space, int32_t& freeSpace);
bool ExtrapolateLastId(const etk::UString& _text, const int32_t _start, int32_t& _stop, int32_t& _space, int32_t& _freeSpace);
private:
// this section is reserved for HTML parsing and display:
etk::UString m_htmlCurrrentLine; //!< current line for HTML display
@ -374,9 +374,9 @@ namespace ewol
TextDecoration m_htmlDecoTmp; //!< current decoration
/**
* @brief add a line with the current m_htmlDecoTmp decoration
* @param[in] the cuurent data to add.
* @param[in] _data The cuurent data to add.
*/
void HtmlAddData(etk::UString data);
void HtmlAddData(const etk::UString& _data);
/**
* @brief Draw the current line
*/
@ -388,25 +388,25 @@ namespace ewol
void DisableCursor(void);
/**
* @brief Set a cursor at a specific position:
* @param[in] cursorPos id of the cursor position
* @param[in] _cursorPos id of the cursor position
*/
void SetCursorPos(int32_t cursorPos);
void SetCursorPos(int32_t _cursorPos);
/**
* @brief Set a cursor at a specific position with his associated selection:
* @param[in] cursorPos id of the cursor position
* @param[in] selectionStartPos id of the starting of the selection
* @param[in] _cursorPos id of the cursor position
* @param[in] _selectionStartPos id of the starting of the selection
*/
void SetCursorSelection(int32_t cursorPos, int32_t selectionStartPos);
void SetCursorSelection(int32_t _cursorPos, int32_t _selectionStartPos);
/**
* @brief Change the selection color
* @param[in] color New color for the Selection
* @param[in] _color New color for the Selection
*/
void SetSelectionColor(draw::Color color);
void SetSelectionColor(const draw::Color& _color);
/**
* @brief Change the cursor color
* @param[in] color New color for the Selection
* @param[in] _color New color for the Selection
*/
void SetCursorColor(draw::Color color);
void SetCursorColor(const draw::Color& _color);
};
};

View File

@ -71,7 +71,7 @@ void informOneObjectIsRemoved(ewol::EObject* _object)
{
for (int32_t iii=0; iii<m_eObjectList.Size(); iii++) {
if (m_eObjectList[iii] != NULL) {
m_eObjectList[iii]->OnObjectRemove(object);
m_eObjectList[iii]->OnObjectRemove(_object);
}
}
for (int32_t iii=0; iii<m_eObjectAutoRemoveList.Size(); iii++) {

View File

@ -123,7 +123,8 @@ void ewol::Keyboard(bool _hide)
}
void ewol::SetTitle(const etk::UString& _title)
{
guiInterface::SetTitle(_title);
etk::UString title = _title;
guiInterface::SetTitle(title);
}
etk::UString ewol::GetVersion(void)

View File

@ -32,7 +32,7 @@ etk::CCout& ewol::keyEvent::operator <<(etk::CCout& _os, const ewol::keyEvent::s
} else {
_os << "[ERROR]";
}
return os;
return _os;
}
@ -103,7 +103,7 @@ etk::CCout& ewol::keyEvent::operator <<(etk::CCout& _os, const ewol::keyEvent::t
} else {
_os << "[ERROR]";
}
return os;
return _os;
}
static ewol::SpecialKey l_LocalKeyStatus;

View File

@ -558,7 +558,7 @@ bool widget::Button::OnGetConfig(const char* _config, etk::UString& _result) con
return true;
}
if (_config == configShaper) {
_result = m_shaper.GetSource();;
_result = m_shaper.GetSource();
return true;
}
return false;

View File

@ -75,7 +75,10 @@ void widget::PopUp::OnRegenerateDisplay(void)
vec2 padding = m_shaper.GetPadding();
if (NULL != m_subWidget) {
vec2 tmpSize = m_subWidget->GetSize();
vec2 tmpOrigin = m_subWidget->GetOrigin();
tmpSize.setMax(m_minSize);
vec2 tmpOrigin = m_origin + (m_size-tmpSize)/2.0f;
tmpOrigin = vec2ClipInt32(tmpOrigin);
m_shaper.SetOrigin(vec2ClipInt32(m_origin));
m_shaper.SetSize(vec2ClipInt32(m_size));
m_shaper.SetInsidePos(vec2ClipInt32(tmpOrigin-padding));