[DEV] text code style corection

This commit is contained in:
Edouard DUPIN 2013-10-16 21:53:17 +02:00
parent a05707e55a
commit 739082cf36
3 changed files with 72 additions and 61 deletions

2
build

@ -1 +1 @@
Subproject commit f67512f49d91a95a30e60085a2bdc39b606c166c Subproject commit 2a0f8bdb02d2f5b117d4fa9bf994a752e8a1f4b2

View File

@ -53,7 +53,7 @@ void ewol::Text::loadProgram(void) {
// get the shader resource : // get the shader resource :
m_GLPosition = 0; m_GLPosition = 0;
m_GLprogram = ewol::Program::keep("DATA:text.prog"); m_GLprogram = ewol::Program::keep("DATA:text.prog");
if (NULL != m_GLprogram ) { if (m_GLprogram != NULL) {
m_GLPosition = m_GLprogram->getAttribute("EW_coord2d"); m_GLPosition = m_GLprogram->getAttribute("EW_coord2d");
m_GLColor = m_GLprogram->getAttribute("EW_color"); m_GLColor = m_GLprogram->getAttribute("EW_color");
m_GLtexture = m_GLprogram->getAttribute("EW_texture2d"); m_GLtexture = m_GLprogram->getAttribute("EW_texture2d");
@ -67,7 +67,7 @@ void ewol::Text::draw(const mat4& _transformationMatrix, bool _enableDepthTest)
// draw BG in any case: // draw BG in any case:
m_vectorialDraw.draw(); m_vectorialDraw.draw();
if (m_coord.size() <= 0 || NULL == m_font) { if (m_coord.size() <= 0 || m_font == NULL) {
// TODO : a remÚtre ... // TODO : a remÚtre ...
//EWOL_WARNING("Nothink to draw..."); //EWOL_WARNING("Nothink to draw...");
return; return;
@ -80,7 +80,7 @@ void ewol::Text::draw(const mat4& _transformationMatrix, bool _enableDepthTest)
EWOL_ERROR("No shader ..."); EWOL_ERROR("No shader ...");
return; return;
} }
if (true == _enableDepthTest) { if (_enableDepthTest == true) {
ewol::openGL::enable(ewol::openGL::FLAG_DEPTH_TEST); ewol::openGL::enable(ewol::openGL::FLAG_DEPTH_TEST);
} }
// set Matrix : translation/positionMatrix // set Matrix : translation/positionMatrix
@ -100,7 +100,7 @@ void ewol::Text::draw(const mat4& _transformationMatrix, bool _enableDepthTest)
// Request the draw od the elements : // Request the draw od the elements :
ewol::openGL::drawArrays(GL_TRIANGLES, 0, m_coord.size()); ewol::openGL::drawArrays(GL_TRIANGLES, 0, m_coord.size());
m_GLprogram->unUse(); m_GLprogram->unUse();
if (true == _enableDepthTest) { if (_enableDepthTest == true) {
ewol::openGL::disable(ewol::openGL::FLAG_DEPTH_TEST); ewol::openGL::disable(ewol::openGL::FLAG_DEPTH_TEST);
} }
} }
@ -110,7 +110,7 @@ void ewol::Text::draw(bool _disableDepthTest) {
// draw BG in any case: // draw BG in any case:
m_vectorialDraw.draw(); m_vectorialDraw.draw();
if (m_coord.size() <= 0 || NULL == m_font) { if (m_coord.size() <= 0 || m_font == NULL) {
// TODO : a remètre ... // TODO : a remètre ...
//EWOL_WARNING("Nothink to draw..."); //EWOL_WARNING("Nothink to draw...");
return; return;
@ -267,7 +267,7 @@ void ewol::Text::setClippingMode(bool _newMode) {
void ewol::Text::setFontSize(int32_t _fontSize) { void ewol::Text::setFontSize(int32_t _fontSize) {
// get old size // get old size
etk::UString fontName = ""; etk::UString fontName = "";
if (NULL != m_font) { if (m_font != NULL) {
fontName = m_font->getName(); fontName = m_font->getName();
} }
setFont(fontName, _fontSize); setFont(fontName, _fontSize);
@ -276,7 +276,7 @@ void ewol::Text::setFontSize(int32_t _fontSize) {
void ewol::Text::setFontName(const etk::UString& _fontName) { void ewol::Text::setFontName(const etk::UString& _fontName) {
// get old size // get old size
int32_t fontSize = -1; int32_t fontSize = -1;
if (NULL != m_font) { if (m_font != NULL) {
fontSize = m_font->getFontSize(); fontSize = m_font->getFontSize();
} }
setFont(_fontName, fontSize); setFont(_fontName, fontSize);
@ -296,7 +296,7 @@ void ewol::Text::setFont(etk::UString _fontName, int32_t _fontSize) {
_fontName += _fontSize; _fontName += _fontSize;
// link to new one // link to new one
m_font = ewol::TexturedFont::keep(_fontName); m_font = ewol::TexturedFont::keep(_fontName);
if (NULL == m_font) { if (m_font == NULL) {
EWOL_ERROR("Can not get font resource"); EWOL_ERROR("Can not get font resource");
m_font = previousFont; m_font = previousFont;
} else { } else {
@ -305,7 +305,7 @@ void ewol::Text::setFont(etk::UString _fontName, int32_t _fontSize) {
} }
void ewol::Text::setFontMode(ewol::font::mode_te _mode) { void ewol::Text::setFontMode(ewol::font::mode_te _mode) {
if (NULL!=m_font) { if (m_font != NULL) {
m_mode = m_font->getWrappingMode(_mode); m_mode = m_font->getWrappingMode(_mode);
} }
} }
@ -315,7 +315,7 @@ ewol::font::mode_te ewol::Text::getFontMode(void) {
} }
void ewol::Text::setFontBold(bool _status) { void ewol::Text::setFontBold(bool _status) {
if (true == _status) { if (_status == true) {
// enable // enable
if (m_mode == ewol::font::Regular) { if (m_mode == ewol::font::Regular) {
setFontMode(ewol::font::Bold); setFontMode(ewol::font::Bold);
@ -333,7 +333,7 @@ void ewol::Text::setFontBold(bool _status) {
} }
void ewol::Text::setFontItalic(bool _status) { void ewol::Text::setFontItalic(bool _status) {
if (true == _status) { if (_status == true) {
// enable // enable
if (m_mode == ewol::font::Regular) { if (m_mode == ewol::font::Regular) {
setFontMode(ewol::font::Italic); setFontMode(ewol::font::Italic);
@ -366,11 +366,10 @@ void ewol::Text::print(const etk::UString& _text) {
void ewol::Text::parseHtmlNode(exml::Element* _element) { void ewol::Text::parseHtmlNode(exml::Element* _element) {
// get the static real pointer // get the static real pointer
if (NULL == _element) { if (_element == NULL) {
EWOL_ERROR( "Error Input node does not existed ..."); EWOL_ERROR( "Error Input node does not existed ...");
} }
for(int32_t iii=0; iii< _element->size(); iii++) { for(int32_t iii=0; iii< _element->size(); iii++) {
if (_element->getType(iii) == exml::typeComment) { if (_element->getType(iii) == exml::typeComment) {
// nothing to do ... // nothing to do ...
} else if (_element->getType(iii) == exml::typeText) { } else if (_element->getType(iii) == exml::typeText) {
@ -387,11 +386,11 @@ void ewol::Text::parseHtmlNode(exml::Element* _element) {
EWOL_ERROR("Cast error ..."); EWOL_ERROR("Cast error ...");
continue; continue;
} }
if(true == elem->getValue().compareNoCase("br")) { if(elem->getValue().compareNoCase("br") == true) {
htmlFlush(); htmlFlush();
EWOL_VERBOSE("XML flush & newLine"); EWOL_VERBOSE("XML flush & newLine");
forceLineReturn(); forceLineReturn();
} else if (true == elem->getValue().compareNoCase("font")) { } else if (elem->getValue().compareNoCase("font") == true) {
EWOL_VERBOSE("XML Font ..."); EWOL_VERBOSE("XML Font ...");
TextDecoration tmpDeco = m_htmlDecoTmp; TextDecoration tmpDeco = m_htmlDecoTmp;
etk::UString colorValue = elem->getAttribute("color"); etk::UString colorValue = elem->getAttribute("color");
@ -400,8 +399,8 @@ void ewol::Text::parseHtmlNode(exml::Element* _element) {
m_htmlDecoTmp.m_colorBg = colorValue; m_htmlDecoTmp.m_colorBg = colorValue;
parseHtmlNode(elem); parseHtmlNode(elem);
m_htmlDecoTmp = tmpDeco; m_htmlDecoTmp = tmpDeco;
} else if( true == elem->getValue().compareNoCase("b") } else if( elem->getValue().compareNoCase("b") == true
|| true == elem->getValue().compareNoCase("bold")) { || elem->getValue().compareNoCase("bold") == true) {
EWOL_VERBOSE("XML bold ..."); EWOL_VERBOSE("XML bold ...");
TextDecoration tmpDeco = m_htmlDecoTmp; TextDecoration tmpDeco = m_htmlDecoTmp;
if (m_htmlDecoTmp.m_mode == ewol::font::Regular) { if (m_htmlDecoTmp.m_mode == ewol::font::Regular) {
@ -411,8 +410,8 @@ void ewol::Text::parseHtmlNode(exml::Element* _element) {
} }
parseHtmlNode(elem); parseHtmlNode(elem);
m_htmlDecoTmp = tmpDeco; m_htmlDecoTmp = tmpDeco;
} else if( true == elem->getValue().compareNoCase("i") } else if( elem->getValue().compareNoCase("i") == true
|| true == elem->getValue().compareNoCase("italic")) { || elem->getValue().compareNoCase("italic") == true) {
EWOL_VERBOSE("XML italic ..."); EWOL_VERBOSE("XML italic ...");
TextDecoration tmpDeco = m_htmlDecoTmp; TextDecoration tmpDeco = m_htmlDecoTmp;
if (m_htmlDecoTmp.m_mode == ewol::font::Regular) { if (m_htmlDecoTmp.m_mode == ewol::font::Regular) {
@ -422,34 +421,34 @@ void ewol::Text::parseHtmlNode(exml::Element* _element) {
} }
parseHtmlNode(elem); parseHtmlNode(elem);
m_htmlDecoTmp = tmpDeco; m_htmlDecoTmp = tmpDeco;
} else if( true == elem->getValue().compareNoCase("u") } else if( elem->getValue().compareNoCase("u") == true
|| true == elem->getValue().compareNoCase("underline")) { || elem->getValue().compareNoCase("underline") == true) {
EWOL_VERBOSE("XML underline ..."); EWOL_VERBOSE("XML underline ...");
parseHtmlNode(elem); parseHtmlNode(elem);
} else if( true == elem->getValue().compareNoCase("p") } else if( elem->getValue().compareNoCase("p") == true
|| true == elem->getValue().compareNoCase("paragraph")) { || elem->getValue().compareNoCase("paragraph") == true) {
EWOL_VERBOSE("XML paragraph ..."); EWOL_VERBOSE("XML paragraph ...");
htmlFlush(); htmlFlush();
m_alignement = ewol::Text::alignLeft; m_alignement = ewol::Text::alignLeft;
forceLineReturn(); forceLineReturn();
parseHtmlNode(elem); parseHtmlNode(elem);
forceLineReturn(); forceLineReturn();
} else if (true == elem->getValue().compareNoCase("center")) { } else if (elem->getValue().compareNoCase("center") == true) {
EWOL_VERBOSE("XML center ..."); EWOL_VERBOSE("XML center ...");
htmlFlush(); htmlFlush();
m_alignement = ewol::Text::alignCenter; m_alignement = ewol::Text::alignCenter;
parseHtmlNode(elem); parseHtmlNode(elem);
} else if (true == elem->getValue().compareNoCase("left")) { } else if (elem->getValue().compareNoCase("left") == true) {
EWOL_VERBOSE("XML left ..."); EWOL_VERBOSE("XML left ...");
htmlFlush(); htmlFlush();
m_alignement = ewol::Text::alignLeft; m_alignement = ewol::Text::alignLeft;
parseHtmlNode(elem); parseHtmlNode(elem);
} else if (true == elem->getValue().compareNoCase("right")) { } else if (elem->getValue().compareNoCase("right") == true) {
EWOL_VERBOSE("XML right ..."); EWOL_VERBOSE("XML right ...");
htmlFlush(); htmlFlush();
m_alignement = ewol::Text::alignRight; m_alignement = ewol::Text::alignRight;
parseHtmlNode(elem); parseHtmlNode(elem);
} else if (true == elem->getValue().compareNoCase("justify")) { } else if (elem->getValue().compareNoCase("justify") == true) {
EWOL_VERBOSE("XML justify ..."); EWOL_VERBOSE("XML justify ...");
htmlFlush(); htmlFlush();
m_alignement = ewol::Text::alignJustify; m_alignement = ewol::Text::alignJustify;
@ -476,19 +475,19 @@ void ewol::Text::printHTML(const etk::UString& _text) {
m_htmlDecoTmp.m_colorFg = etk::color::black; m_htmlDecoTmp.m_colorFg = etk::color::black;
m_htmlDecoTmp.m_mode = ewol::font::Regular; m_htmlDecoTmp.m_mode = ewol::font::Regular;
if (false == doc.parse(_text)) { if (doc.parse(_text) == false) {
EWOL_ERROR( "can not load XML: PARSING error: Decorated text "); EWOL_ERROR( "can not load XML: PARSING error: Decorated text ");
return; return;
} }
exml::Element* root = (exml::Element*)doc.getNamed( "html" ); exml::Element* root = (exml::Element*)doc.getNamed( "html" );
if (NULL == root) { if (root == NULL) {
EWOL_ERROR( "can not load XML: main node not find: \"html\""); EWOL_ERROR( "can not load XML: main node not find: \"html\"");
doc.display(); doc.display();
return; return;
} }
exml::Element* bodyNode = (exml::Element*)root->getNamed( "body" ); exml::Element* bodyNode = (exml::Element*)root->getNamed( "body" );
if (NULL == root) { if (root == NULL) {
EWOL_ERROR( "can not load XML: main node not find: \"body\""); EWOL_ERROR( "can not load XML: main node not find: \"body\"");
return; return;
} }
@ -506,7 +505,7 @@ void ewol::Text::print(const etk::UString& _text, const etk::Vector<TextDecorati
if (m_alignement == ewol::Text::alignDisable) { if (m_alignement == ewol::Text::alignDisable) {
//EWOL_DEBUG(" 1 print in not alligned mode : start=" << m_sizeDisplayStart << " stop=" << m_sizeDisplayStop << " pos=" << m_position); //EWOL_DEBUG(" 1 print in not alligned mode : start=" << m_sizeDisplayStart << " stop=" << m_sizeDisplayStop << " pos=" << m_position);
// display the cursor if needed (if it is at the start position...) // display the cursor if needed (if it is at the start position...)
if (true == m_needDisplay) { if (m_needDisplay == true) {
if (0 == m_cursorPos) { if (0 == m_cursorPos) {
m_vectorialDraw.setPos(m_position); m_vectorialDraw.setPos(m_position);
setColorBg(m_colorCursor); setColorBg(m_colorCursor);
@ -522,7 +521,7 @@ void ewol::Text::print(const etk::UString& _text, const etk::Vector<TextDecorati
setFontMode(_decoration[iii].m_mode); setFontMode(_decoration[iii].m_mode);
} }
// if real display : ( not display is for size calculation) // if real display : ( not display is for size calculation)
if (true == m_needDisplay) { if (m_needDisplay == true) {
if( ( m_selectionStartPos-1<iii if( ( m_selectionStartPos-1<iii
&& iii <= m_cursorPos-1) && iii <= m_cursorPos-1)
|| ( m_selectionStartPos-1 >= iii || ( m_selectionStartPos-1 >= iii
@ -534,7 +533,7 @@ void ewol::Text::print(const etk::UString& _text, const etk::Vector<TextDecorati
setColorBg(tmpBg); setColorBg(tmpBg);
} }
} }
if( true == m_needDisplay if( m_needDisplay == true
&& m_colorBg.a() != 0) { && m_colorBg.a() != 0) {
vec3 pos = m_position; vec3 pos = m_position;
m_vectorialDraw.setPos(pos); m_vectorialDraw.setPos(pos);
@ -547,7 +546,7 @@ void ewol::Text::print(const etk::UString& _text, const etk::Vector<TextDecorati
m_nbCharDisplayed++; m_nbCharDisplayed++;
} }
// display the cursor if needed (if it is at the other position...) // display the cursor if needed (if it is at the other position...)
if (true == m_needDisplay) { if (m_needDisplay == true) {
if (iii == m_cursorPos-1) { if (iii == m_cursorPos-1) {
m_vectorialDraw.setPos(m_position); m_vectorialDraw.setPos(m_position);
setColorBg(m_colorCursor); setColorBg(m_colorCursor);
@ -569,10 +568,8 @@ void ewol::Text::print(const etk::UString& _text, const etk::Vector<TextDecorati
int32_t freeSpace; int32_t freeSpace;
while (currentId < _text.size()) { while (currentId < _text.size()) {
bool needNoJustify = extrapolateLastId(_text, currentId, stop, space, freeSpace); bool needNoJustify = extrapolateLastId(_text, currentId, stop, space, freeSpace);
float interpolation = basicSpaceWidth; float interpolation = basicSpaceWidth;
switch (m_alignement) switch (m_alignement) {
{
case ewol::Text::alignJustify: case ewol::Text::alignJustify:
if (needNoJustify == false) { if (needNoJustify == false) {
interpolation += (float)freeSpace / (float)(space-1); interpolation += (float)freeSpace / (float)(space-1);
@ -600,8 +597,8 @@ void ewol::Text::print(const etk::UString& _text, const etk::Vector<TextDecorati
break; break;
} }
// display all the elements // display all the elements
if( true == m_needDisplay if( m_needDisplay == true
&& 0 == m_cursorPos) { && m_cursorPos == 0) {
m_vectorialDraw.setPos(m_position); m_vectorialDraw.setPos(m_position);
setColorBg(m_colorCursor); setColorBg(m_colorCursor);
printCursor(false); printCursor(false);
@ -614,7 +611,7 @@ void ewol::Text::print(const etk::UString& _text, const etk::Vector<TextDecorati
tmpBg = _decoration[iii].m_colorBg; tmpBg = _decoration[iii].m_colorBg;
setFontMode(_decoration[iii].m_mode); setFontMode(_decoration[iii].m_mode);
} }
if (true == m_needDisplay) { if (m_needDisplay == true) {
if( ( m_selectionStartPos-1<iii if( ( m_selectionStartPos-1<iii
&& iii <= m_cursorPos-1) && iii <= m_cursorPos-1)
|| ( m_selectionStartPos-1 >= iii || ( m_selectionStartPos-1 >= iii
@ -627,9 +624,9 @@ void ewol::Text::print(const etk::UString& _text, const etk::Vector<TextDecorati
} }
} }
// special for the justify mode // special for the justify mode
if (_text[iii] == etk::UniChar(' ')) { if (_text[iii] == etk::UniChar::Space) {
//EWOL_DEBUG(" generateString : \" \""); //EWOL_DEBUG(" generateString : \" \"");
if( true == m_needDisplay if( m_needDisplay == true
&& m_colorBg.a() != 0) { && m_colorBg.a() != 0) {
m_vectorialDraw.setPos(m_position); m_vectorialDraw.setPos(m_position);
} }
@ -637,13 +634,13 @@ void ewol::Text::print(const etk::UString& _text, const etk::Vector<TextDecorati
setPos(vec3(m_position.x() + interpolation, setPos(vec3(m_position.x() + interpolation,
m_position.y(), m_position.y(),
m_position.z()) ); m_position.z()) );
if( true == m_needDisplay if( m_needDisplay == true
&& m_colorBg.a() != 0) { && m_colorBg.a() != 0) {
m_vectorialDraw.rectangleWidth(vec3(interpolation,fontHeigh,0.0f) ); m_vectorialDraw.rectangleWidth(vec3(interpolation,fontHeigh,0.0f) );
} }
} else { } else {
//EWOL_DEBUG(" generateString : \"" << (char)text[iii] << "\""); //EWOL_DEBUG(" generateString : \"" << (char)text[iii] << "\"");
if( true == m_needDisplay if( m_needDisplay == true
&& m_colorBg.a() != 0) { && m_colorBg.a() != 0) {
vec3 pos = m_position; vec3 pos = m_position;
m_vectorialDraw.setPos(pos); m_vectorialDraw.setPos(pos);
@ -665,14 +662,14 @@ void ewol::Text::print(const etk::UString& _text, const etk::Vector<TextDecorati
} }
if (currentId == stop) { if (currentId == stop) {
currentId++; currentId++;
} else if(_text[stop] == etk::UniChar(' ')) { } else if(_text[stop] == etk::UniChar::Space) {
currentId = stop+1; currentId = stop+1;
// reset position : // reset position :
setPos(vec3(m_startTextpos, setPos(vec3(m_startTextpos,
(float)(m_position.y() - m_font->getHeight(m_mode)), (float)(m_position.y() - m_font->getHeight(m_mode)),
m_position.z()) ); m_position.z()) );
m_nbCharDisplayed++; m_nbCharDisplayed++;
} else if(_text[stop] == etk::UniChar('\n')) { } else if(_text[stop] == etk::UniChar::Return) {
currentId = stop+1; currentId = stop+1;
// reset position : // reset position :
setPos(vec3(m_startTextpos, setPos(vec3(m_startTextpos,
@ -731,14 +728,14 @@ void ewol::Text::print(const etk::UniChar& _charcode) {
// Clipping and drawing area // Clipping and drawing area
if( true == m_clippingEnable if( m_clippingEnable == true
&& ( dxB < m_clippingPosStart.x() && ( dxB < m_clippingPosStart.x()
|| dxA > m_clippingPosStop.x() || dxA > m_clippingPosStop.x()
|| dyC < m_clippingPosStart.y() || dyC < m_clippingPosStart.y()
|| dyD > m_clippingPosStop.y() ) ) { || dyD > m_clippingPosStop.y() ) ) {
// Nothing to diplay ... // Nothing to diplay ...
} else { } else {
if (true == m_clippingEnable) { if (m_clippingEnable == true) {
// generata positions... // generata positions...
float TexSizeX = tuB - tuA; float TexSizeX = tuB - tuA;
if (dxA < m_clippingPosStart.x()) { if (dxA < m_clippingPosStart.x()) {
@ -993,7 +990,7 @@ bool ewol::Text::extrapolateLastId(const etk::UString& _text,
bool endOfLine = false; bool endOfLine = false;
float stopPosition = m_stopTextPos; float stopPosition = m_stopTextPos;
if( false == m_needDisplay if( m_needDisplay == false
|| m_stopTextPos == m_startTextpos) { || m_stopTextPos == m_startTextpos) {
stopPosition = m_startTextpos + 3999999999.0; stopPosition = m_startTextpos + 3999999999.0;
} }
@ -1006,11 +1003,11 @@ bool ewol::Text::extrapolateLastId(const etk::UString& _text,
break; break;
} }
// save number of space : // save number of space :
if (_text[iii] == etk::UniChar(' ')) { if (_text[iii] == etk::UniChar::Space) {
_space++; _space++;
lastSpacePosition = iii; lastSpacePosition = iii;
lastSpacefreeSize = stopPosition - endPos; lastSpacefreeSize = stopPosition - endPos;
} else if (_text[iii] == etk::UniChar('\n')) { } else if (_text[iii] == etk::UniChar::Return) {
_stop = iii; _stop = iii;
endOfLine = true; endOfLine = true;
break; break;

View File

@ -46,7 +46,9 @@ namespace ewol {
private: private:
ewol::Drawing m_vectorialDraw; //!< This is used to draw background selection and other things ... ewol::Drawing m_vectorialDraw; //!< This is used to draw background selection and other things ...
public: public:
ewol::Drawing& getDrawing(void) { return m_vectorialDraw; }; ewol::Drawing& getDrawing(void) {
return m_vectorialDraw;
};
private: private:
int32_t m_nbCharDisplayed; //!< prevent some error in calculation size. int32_t m_nbCharDisplayed; //!< prevent some error in calculation size.
vec3 m_sizeDisplayStart; //!< The start windows of the display. vec3 m_sizeDisplayStart; //!< The start windows of the display.
@ -127,19 +129,25 @@ namespace ewol {
* @brief get the current display position (sometime needed in the gui control) * @brief get the current display position (sometime needed in the gui control)
* @return the current position. * @return the current position.
*/ */
const vec3& getPos(void) { return m_position; }; const vec3& getPos(void) {
return m_position;
};
/** /**
* @brief set position for the next text writen * @brief set position for the next text writen
* @param[in] _pos Position of the text (in 3D) * @param[in] _pos Position of the text (in 3D)
*/ */
void setPos(const vec3& _pos); void setPos(const vec3& _pos);
inline void setPos(const vec2& _pos) { setPos(vec3(_pos.x(),_pos.y(),0)); }; inline void setPos(const vec2& _pos) {
setPos(vec3(_pos.x(),_pos.y(),0));
};
/** /**
* @brief set relative position for the next text writen * @brief set relative position for the next text writen
* @param[in] _pos ofset apply of the text (in 3D) * @param[in] _pos ofset apply of the text (in 3D)
*/ */
void setRelPos(const vec3& _pos); void setRelPos(const vec3& _pos);
inline void setRelPos(const vec2& _pos) { setRelPos(vec3(_pos.x(),_pos.y(),0)); }; inline void setRelPos(const vec2& _pos) {
setRelPos(vec3(_pos.x(),_pos.y(),0));
};
/** /**
* @brief set the Color of the current foreground font * @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)
@ -155,15 +163,21 @@ namespace ewol {
* @param[in] _pos Start position of the clipping * @param[in] _pos Start position of the clipping
* @param[in] _width Width size of the clipping * @param[in] _width Width size of the clipping
*/ */
void setClippingWidth(const vec3& _pos, const vec3& _width) { setClipping(_pos, _pos+_width); } void setClippingWidth(const vec3& _pos, const vec3& _width) {
void setClippingWidth(const vec2& _pos, const vec2& _width) { setClipping(_pos, _pos+_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) * @brief Request a clipping area for the text (next draw only)
* @param[in] _pos Start position of the clipping * @param[in] _pos Start position of the clipping
* @param[in] _posEnd End position of the clipping * @param[in] _posEnd End position of the clipping
*/ */
void setClipping(const vec3& _pos, const vec3& _posEnd); void setClipping(const 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) ); }; 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 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