diff options
author | Tomi Korpipaa <tomi.korpipaa@qt.io> | 2019-01-30 08:55:17 +0200 |
---|---|---|
committer | Tomi Korpipää <tomi.korpipaa@qt.io> | 2019-01-30 11:32:10 +0000 |
commit | 410cd933be319f0f79e63aac368636e0988291c3 (patch) | |
tree | b486e461115e6f1387fcf362b18c15dcf93dfccf | |
parent | 9b3f171a0256936452c23834539594ce8b3ed70e (diff) |
Convert text elide property to enum
Elide has option for None, Left, Middle, and Right.
Converting the original boolean to support those.
Task-number: QT3DS-2707
Change-Id: I82afd0da38fd3f59a70d1c09e79fc99e0351eb5b
Reviewed-by: Mahmoud Badri <mahmoud.badri@qt.io>
Reviewed-by: Miikka Heikkinen <miikka.heikkinen@qt.io>
7 files changed, 43 insertions, 6 deletions
diff --git a/src/Authoring/QT3DSDM/Systems/Qt3DSDMComposerTypeDefinitions.h b/src/Authoring/QT3DSDM/Systems/Qt3DSDMComposerTypeDefinitions.h index 1b23b0cb..832e76ff 100644 --- a/src/Authoring/QT3DSDM/Systems/Qt3DSDMComposerTypeDefinitions.h +++ b/src/Authoring/QT3DSDM/Systems/Qt3DSDMComposerTypeDefinitions.h @@ -286,7 +286,7 @@ class IPropertySystem; HANDLE_COMPOSER_PROPERTY(dropshadowvertalign, m_DropShadowVerticalAlignment, TDataStrPtr, L"Bottom") \ HANDLE_COMPOSER_PROPERTY(wordwrap, m_WordWrap, TDataStrPtr, L"WrapWord") \ HANDLE_COMPOSER_PROPERTY(boundingbox, m_BoundingBox, SFloat2, SFloat2(0, 0)) \ - HANDLE_COMPOSER_PROPERTY(elide, m_Elide, bool, false) \ + HANDLE_COMPOSER_PROPERTY(elide, m_Elide, TDataStrPtr, L"ElideNone") \ HANDLE_COMPOSER_PROPERTY(enableacceleratedfont, m_EnableAcceleratedFont, bool, false) \ HANDLE_COMPOSER_PROPERTY_DUPLICATE(controlledproperty, m_ControlledProperty, TDataStrPtr, L"") diff --git a/src/Runtime/Source/Qt3DSRuntimeRender/GraphObjects/Qt3DSRenderText.cpp b/src/Runtime/Source/Qt3DSRuntimeRender/GraphObjects/Qt3DSRenderText.cpp index 00456bf3..8b44e00f 100644 --- a/src/Runtime/Source/Qt3DSRuntimeRender/GraphObjects/Qt3DSRenderText.cpp +++ b/src/Runtime/Source/Qt3DSRuntimeRender/GraphObjects/Qt3DSRenderText.cpp @@ -46,7 +46,7 @@ STextRenderInfo::STextRenderInfo() , m_DropShadowVerticalAlignment(TextVerticalAlignment::Bottom) , m_WordWrap(TextWordWrap::WrapWord) , m_BoundingBox(QT3DSVec2(0 ,0)) - , m_Elide(false) + , m_Elide(TextElide::ElideNone) , m_ScaleX(0) , m_ScaleY(0) , m_EnableAcceleratedFont(false) diff --git a/src/Runtime/Source/Qt3DSRuntimeRender/Include/Qt3DSRenderTextTypes.h b/src/Runtime/Source/Qt3DSRuntimeRender/Include/Qt3DSRenderTextTypes.h index ff5a5c26..72ea9c15 100644 --- a/src/Runtime/Source/Qt3DSRuntimeRender/Include/Qt3DSRenderTextTypes.h +++ b/src/Runtime/Source/Qt3DSRuntimeRender/Include/Qt3DSRenderTextTypes.h @@ -69,6 +69,16 @@ namespace render { }; }; + struct TextElide + { + enum Enum { + ElideNone = 0, + ElideLeft, + ElideMiddle, + ElideRight, + }; + }; + struct STextDimensions { QT3DSU32 m_TextWidth; @@ -170,7 +180,7 @@ namespace render { TextVerticalAlignment::Enum m_DropShadowVerticalAlignment; // To be removed in 2.x (when UIP version is next updated) TextWordWrap::Enum m_WordWrap; QT3DSVec2 m_BoundingBox; - bool m_Elide; + TextElide::Enum m_Elide; QT3DSF32 m_ScaleX; // Pixel scale in X QT3DSF32 m_ScaleY; // Pixel scale in Y diff --git a/src/Runtime/Source/Qt3DSRuntimeRender/Include/Qt3DSRenderUIPSharedTranslation.h b/src/Runtime/Source/Qt3DSRuntimeRender/Include/Qt3DSRenderUIPSharedTranslation.h index cf2fd378..22b2f909 100644 --- a/src/Runtime/Source/Qt3DSRuntimeRender/Include/Qt3DSRenderUIPSharedTranslation.h +++ b/src/Runtime/Source/Qt3DSRuntimeRender/Include/Qt3DSRenderUIPSharedTranslation.h @@ -106,6 +106,12 @@ namespace render { }; template <> + struct SEnumParseMap<TextElide::Enum> + { + static SEnumNameMap *GetMap(); + }; + + template <> struct SEnumParseMap<AAModeValues::Enum> { static SEnumNameMap *GetMap(); @@ -452,7 +458,7 @@ namespace render { HANDLE_QT3DS_RENDER_ENUM_PROPERTY(Text, DropShadowVerticalAlignment, TextDirty) \ HANDLE_QT3DS_RENDER_ENUM_PROPERTY(Text, WordWrap, TextDirty) \ HANDLE_QT3DS_RENDER_REAL_VEC2_PROPERTY(Text, BoundingBox, TextDirty) \ - HANDLE_QT3DS_RENDER_PROPERTY(Text, Elide, TextDirty) \ + HANDLE_QT3DS_RENDER_ENUM_PROPERTY(Text, Elide, TextDirty) \ HANDLE_QT3DS_RENDER_COLOR_VEC3_PROPERTY(Text, TextColor, Dirty) \ HANDLE_QT3DS_RENDER_COLOR_PROPERTY(Text, TextColor, Dirty) \ HANDLE_QT3DS_RENDER_PROPERTY(Text, EnableAcceleratedFont, Dirty) diff --git a/src/Runtime/Source/Qt3DSRuntimeRender/Source/Qt3DSRenderTextTextureCache.cpp b/src/Runtime/Source/Qt3DSRuntimeRender/Source/Qt3DSRenderTextTextureCache.cpp index 1b799b96..304e64b6 100644 --- a/src/Runtime/Source/Qt3DSRuntimeRender/Source/Qt3DSRenderTextTextureCache.cpp +++ b/src/Runtime/Source/Qt3DSRuntimeRender/Source/Qt3DSRenderTextTextureCache.cpp @@ -60,7 +60,7 @@ struct hash<STextRenderInfo> retval = retval ^ hash<float>()(inInfo.m_DropShadowOffsetY); retval = retval ^ hash<float>()(inInfo.m_BoundingBox.x); retval = retval ^ hash<float>()(inInfo.m_BoundingBox.y); - retval = retval ^ hash<bool>()(inInfo.m_Elide); + retval = retval ^ hash<int>()(static_cast<int>(inInfo.m_Elide)); retval = retval ^ hash<int>()(static_cast<int>(inInfo.m_DropShadowHorizontalAlignment)); // To be removed in 2.x (when UIP version is next updated) retval = retval ^ hash<int>()(static_cast<int>(inInfo.m_DropShadowVerticalAlignment)); // To be removed in 2.x (when UIP version is next updated) retval = retval ^ hash<int>()(static_cast<int>(inInfo.m_WordWrap)); diff --git a/src/Runtime/Source/Qt3DSRuntimeRender/Source/Qt3DSRenderUIPSharedTranslation.cpp b/src/Runtime/Source/Qt3DSRuntimeRender/Source/Qt3DSRenderUIPSharedTranslation.cpp index f82a1853..a0594933 100644 --- a/src/Runtime/Source/Qt3DSRuntimeRender/Source/Qt3DSRenderUIPSharedTranslation.cpp +++ b/src/Runtime/Source/Qt3DSRuntimeRender/Source/Qt3DSRenderUIPSharedTranslation.cpp @@ -58,6 +58,10 @@ namespace render { #define WCHAR_T_Top L"Top" #define WCHAR_T_Middle L"Middle" #define WCHAR_T_Bottom L"Bottom" +#define WCHAR_T_ElideNone L"ElideNone" +#define WCHAR_T_ElideLeft L"ElideLeft" +#define WCHAR_T_ElideMiddle L"ElideMiddle" +#define WCHAR_T_ElideRight L"ElideRight" #define WCHAR_T_2x L"2x" #define WCHAR_T_4x L"4x" #define WCHAR_T_8x L"8x" @@ -137,6 +141,10 @@ namespace render { #define CHAR_T_Top "Top" #define CHAR_T_Middle "Middle" #define CHAR_T_Bottom "Bottom" +#define CHAR_T_ElideNone "ElideNone" +#define CHAR_T_ElideLeft "ElideLeft" +#define CHAR_T_ElideMiddle "ElideMiddle" +#define CHAR_T_ElideRight "ElideRight" #define CHAR_T_2x "2x" #define CHAR_T_4x "4x" #define CHAR_T_8x "8x" @@ -253,6 +261,14 @@ namespace render { { (QT3DSU32)-1, NULL }, }; + SEnumNameMap g_TextElideMap[] = { + DEFINE_NAME_MAP_ENTRY(TextElide::ElideNone, ElideNone), + DEFINE_NAME_MAP_ENTRY(TextElide::ElideLeft, ElideLeft), + DEFINE_NAME_MAP_ENTRY(TextElide::ElideMiddle, ElideMiddle), + DEFINE_NAME_MAP_ENTRY(TextElide::ElideRight, ElideRight), + { (QT3DSU32)-1, NULL }, + }; + SEnumNameMap g_ProgressiveAAValuesMap[] = { DEFINE_NAME_MAP_ENTRY(AAModeValues::NoAA, None), DEFINE_NAME_MAP_ENTRY(AAModeValues::SSAA, SSAA), @@ -397,6 +413,11 @@ namespace render { return g_TextWordWrapMap; } + SEnumNameMap *SEnumParseMap<TextElide::Enum>::GetMap() + { + return g_TextElideMap; + } + SEnumNameMap *SEnumParseMap<AAModeValues::Enum>::GetMap() { return g_ProgressiveAAValuesMap; } SEnumNameMap *SEnumParseMap<LayerBlendTypes::Enum>::GetMap() { return g_LayerBlendTypesMap; } diff --git a/src/Runtime/res/DataModelMetadata/en-us/MetaData.xml b/src/Runtime/res/DataModelMetadata/en-us/MetaData.xml index cf5d44b8..992b9164 100644 --- a/src/Runtime/res/DataModelMetadata/en-us/MetaData.xml +++ b/src/Runtime/res/DataModelMetadata/en-us/MetaData.xml @@ -455,7 +455,7 @@ <Property name="tracking" formalName="Tracking" description="Tracking" /> <Property name="boundingbox" formalName="Text Area" description="Fixed size text area. If not set,\ntext area grows with text." type="Float2" default="0 0" /> <Property name="wordwrap" formalName="Word Wrapping" description="Word wrapping. Has effect only if fixed size\ntext area is used.\nClip: Cut text if it does not fit.\nWrapWord: Wrap between words, if possible.\nWrapAnywhere: Wrap even in the middle\nof words." list="Clip:WrapWord:WrapAnywhere" default="WrapWord" /> - <Property name="elide" formalName="Eliding" description="Elide text that does not fit the\ntext area. Has effect only if\nfixed text area is defined." type="Boolean" default="False" /> + <Property name="elide" formalName="Eliding" description="Elide text that does not fit the\ntext area. Has effect only if\nfixed text area is defined." list="ElideNone:ElideLeft:ElideMiddle:ElideRight" default="ElideNone" /> <Property name="dropshadow" formalName="Drop-Shadow" description="Add a drop-shadow to the text.\nThe shadow is a darker shade of the given color." type="Boolean" default="False" /> <Property name="dropshadowstrength" formalName="Shadow Darkness" description="Darkness of the shadow in percents.\n100 is black, 0 is the same color as the text." min="0" max="100" type="Float" default="80" /> <Property name="dropshadowoffsetx" formalName="Horizontal Offset" description="Horizontal offset of the shadow.\nIt is relative to the font size." min="-100" max="100" type="Float" default="0"/> |