diff --git a/external/etk b/external/etk index 668f19ab..83a25600 160000 --- a/external/etk +++ b/external/etk @@ -1 +1 @@ -Subproject commit 668f19abbe82a4ccb078d64844e8974ac17ea87f +Subproject commit 83a25600f6254f755271c96c898a3892e86080fa diff --git a/sources/ewol/compositing/Compositing.cpp b/sources/ewol/compositing/Compositing.cpp index 605afeea..f2b297da 100644 --- a/sources/ewol/compositing/Compositing.cpp +++ b/sources/ewol/compositing/Compositing.cpp @@ -28,7 +28,7 @@ void ewol::Compositing::ResetMatrix(void) } -void ewol::Compositing::Tranlate(etk::Vector3D vect) +void ewol::Compositing::Translate(etk::Vector3D vect) { m_matrixApply *= etk::matrix::Translate(vect); } diff --git a/sources/ewol/compositing/Compositing.h b/sources/ewol/compositing/Compositing.h index d26a6282..1cb7a5fb 100644 --- a/sources/ewol/compositing/Compositing.h +++ b/sources/ewol/compositing/Compositing.h @@ -39,22 +39,22 @@ namespace ewol /** * @brief Reset to the eye matrix the openGL mouving system */ - void ResetMatrix(void); + virtual void ResetMatrix(void); /** * @brief Translate the current display of this element * @param[in] vect The translation vector to apply at the transformation matrix */ - void Tranlate(etk::Vector3D vect); + virtual void Translate(etk::Vector3D vect); /** * @brief Rotate the curent display of this element * @param[in] vect The rotation vector to apply at the transformation matrix */ - void Rotate(etk::Vector3D vect, float angle); + virtual void Rotate(etk::Vector3D vect, float angle); /** * @brief Scale the current diaplsy of this element * @param[in] vect The scaling vector to apply at the transformation matrix */ - void Scale(etk::Vector3D vect); + virtual void Scale(etk::Vector3D vect); }; }; diff --git a/sources/ewol/compositing/Draw.cpp b/sources/ewol/compositing/Drawing.cpp similarity index 98% rename from sources/ewol/compositing/Draw.cpp rename to sources/ewol/compositing/Drawing.cpp index f9a94f29..f97d0ecd 100644 --- a/sources/ewol/compositing/Draw.cpp +++ b/sources/ewol/compositing/Drawing.cpp @@ -7,7 +7,7 @@ */ #include -#include +#include #if 0 @@ -346,6 +346,12 @@ void ewol::Drawing::Clear(void) } +etk::Vector3D ewol::Drawing::GetPos(void) +{ + return m_position; +} + + void ewol::Drawing::SetPos(etk::Vector3D pos) { m_position = pos; @@ -364,7 +370,7 @@ void ewol::Drawing::SetColor(draw::Color color) } -void ewol::Drawing::SetColorBG(draw::Color color) +void ewol::Drawing::SetColorBg(draw::Color color) { m_colorBg = color; } diff --git a/sources/ewol/compositing/Draw.h b/sources/ewol/compositing/Drawing.h similarity index 96% rename from sources/ewol/compositing/Draw.h rename to sources/ewol/compositing/Drawing.h index 16f0fcb6..eb0c07d5 100644 --- a/sources/ewol/compositing/Draw.h +++ b/sources/ewol/compositing/Drawing.h @@ -82,6 +82,11 @@ namespace ewol * @brief Clear alll tre registered element in the current element */ void Clear(void); + /** + * @brief Get the current display position (sometime needed in the gui control) + * @return the current position. + */ + etk::Vector3D GetPos(void); /** * @brief Set position for the next text writen * @param[in] pos Position of the text (in 3D) @@ -101,7 +106,7 @@ namespace ewol * @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) */ - void SetColorBG(draw::Color color); + void SetColorBg(draw::Color color); /** * @brief Request a clipping area for the text (next draw only) * @param[in] pos Start position of the clipping diff --git a/sources/ewol/compositing/Text.cpp b/sources/ewol/compositing/Text.cpp index f31a7720..704838e5 100644 --- a/sources/ewol/compositing/Text.cpp +++ b/sources/ewol/compositing/Text.cpp @@ -134,6 +134,26 @@ void ewol::Text::Draw(void) m_GLprogram->UnUse(); } +void ewol::Text::Translate(etk::Vector3D vect) +{ + ewol::Compositing::Translate(vect); + m_vectorialDraw.Translate(vect); +} + + +void ewol::Text::Rotate(etk::Vector3D vect, float angle) +{ + ewol::Compositing::Rotate(vect, angle); + m_vectorialDraw.Rotate(vect, angle); +} + + +void ewol::Text::Scale(etk::Vector3D vect) +{ + ewol::Compositing::Scale(vect); + m_vectorialDraw.Scale(vect); +} + void ewol::Text::Clear(void) { @@ -161,6 +181,12 @@ void ewol::Text::Clear(void) } +etk::Vector3D ewol::Text::GetPos(void) +{ + return m_position; +} + + void ewol::Text::SetPos(etk::Vector3D pos) { m_position = pos; @@ -183,7 +209,7 @@ void ewol::Text::SetColor(draw::Color color) } -void ewol::Text::SetColorBG(draw::Color color) +void ewol::Text::SetColorBg(draw::Color color) { m_colorBg = color; m_vectorialDraw.SetColor(color); @@ -278,6 +304,45 @@ void ewol::Text::SetFontMode(ewol::font::mode_te mode) } +void ewol::Text::SetFontBold(bool status) +{ + if (true == status) { + // enable + if (m_mode == ewol::font::Regular) { + SetFontMode(ewol::font::Bold); + } else if (m_mode == ewol::font::Italic) { + SetFontMode(ewol::font::BoldItalic); + } + } else { + // disable + if (m_mode == ewol::font::Bold) { + SetFontMode(ewol::font::Regular); + } else if (m_mode == ewol::font::BoldItalic) { + SetFontMode(ewol::font::Italic); + } + } +} + +void ewol::Text::SetFontItalic(bool status) +{ + if (true == status) { + // enable + if (m_mode == ewol::font::Regular) { + SetFontMode(ewol::font::Italic); + } else if (m_mode == ewol::font::Bold) { + SetFontMode(ewol::font::BoldItalic); + } + } else { + // disable + if (m_mode == ewol::font::Italic) { + SetFontMode(ewol::font::Regular); + } else if (m_mode == ewol::font::BoldItalic) { + SetFontMode(ewol::font::Bold); + } + } +} + + void ewol::Text::SetKerningMode(bool newMode) { m_kerning = newMode; @@ -316,7 +381,7 @@ void ewol::Text::Print(const etk::UString& text, const etk::Vector(m_startTextpos, + (float)(m_position.y - m_font->GetHeight(m_mode)), + m_position.z) ); } else { currentId = stop; } - // Reset position : - SetPos(etk::Vector3D(m_startTextpos, - (float)(m_position.y - m_font->GetHeight(m_mode)), - m_position.z) ); } } } @@ -608,6 +674,14 @@ void ewol::Text::Print(const uniChar_t charcode) return; } +void ewol::Text::ForceLineReturn(void) +{ + // Reset position : + SetPos(etk::Vector3D(m_startTextpos, + (float)(m_position.y - m_font->GetHeight(m_mode)), + m_position.z) ); +} + void ewol::Text::SetTextAlignement(float startTextpos, float stopTextPos, aligneMode_te alignement) { diff --git a/sources/ewol/compositing/Text.h b/sources/ewol/compositing/Text.h index fde7d565..4f270a8d 100644 --- a/sources/ewol/compositing/Text.h +++ b/sources/ewol/compositing/Text.h @@ -11,7 +11,7 @@ #include #include -#include +#include #include #include @@ -97,7 +97,23 @@ namespace ewol * @brief generic destructor */ ~Text(void); - public : + public: + /** + * @brief Translate the current display of this element + * @param[in] vect The translation vector to apply at the transformation matrix + */ + virtual void Translate(etk::Vector3D vect); + /** + * @brief Rotate the curent display of this element + * @param[in] vect The rotation vector to apply at the transformation matrix + */ + virtual void Rotate(etk::Vector3D 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(etk::Vector3D vect); + public: /** * @brief Draw All the refistered text in the current element on openGL */ @@ -106,6 +122,11 @@ namespace ewol * @brief Clear alll tre registered element in the current element */ void Clear(void); + /** + * @brief Get the current display position (sometime needed in the gui control) + * @return the current position. + */ + etk::Vector3D GetPos(void); /** * @brief Set position for the next text writen * @param[in] pos Position of the text (in 3D) @@ -125,7 +146,7 @@ namespace ewol * @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) */ - void SetColorBG(draw::Color color); + void SetColorBg(draw::Color color); /** * @brief Request a clipping area for the text (next draw only) * @param[in] pos Start position of the clipping @@ -164,6 +185,16 @@ namespace ewol * @param[in] mode The font mode requested */ void SetFontMode(ewol::font::mode_te mode); + /** + * @brief Enable or disable the bold mode + * @param[in] status The new status for this display property + */ + void SetFontBold(bool status); + /** + * @brief Enable or disable the italic mode + * @param[in] status The new status for this display property + */ + 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. @@ -204,6 +235,10 @@ namespace ewol * @param[in] char that might be dispalyed */ 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 + */ + void ForceLineReturn(void); /** * @brief This generate the possibility to generate the big text property * @param[in] startTextpos The x text start position of the display. diff --git a/sources/ewol/widget/Button.cpp b/sources/ewol/widget/Button.cpp index 11e20b97..9ed0f45c 100644 --- a/sources/ewol/widget/Button.cpp +++ b/sources/ewol/widget/Button.cpp @@ -277,7 +277,7 @@ void ewol::Button::OnRegenerateDisplay(void) m_displayText.Clear(); m_displayText.SetClipping(drawClippingPos, drawClippingSize); m_displayText.Print(m_label); - m_displayText.Tranlate(tmpTextOrigin); + m_displayText.Translate(tmpTextOrigin); m_widgetProperty.m_insidePos = textPos; diff --git a/sources/file.mk b/sources/file.mk index b4f147cd..7f8d735a 100644 --- a/sources/file.mk +++ b/sources/file.mk @@ -29,7 +29,7 @@ FILE_LIST+= ewol/game/GameElement.cpp \ # Compositing FILE_LIST+= ewol/compositing/Compositing.cpp \ ewol/compositing/Text.cpp \ - ewol/compositing/Draw.cpp + ewol/compositing/Drawing.cpp # Object abstraction for OpenGl FILE_LIST+= ewol/oObject/OObject.cpp \