From dadd22bfe1f1dd2bf8f5a4dda19b03bad5123754 Mon Sep 17 00:00:00 2001 From: Edouard DUPIN Date: Tue, 14 Aug 2012 16:12:03 +0200 Subject: [PATCH] change the color_ts in a better class anc rename VectorType in Vector --- Sources/libetk/etk/Color.cpp | 838 ++++++++-------- Sources/libetk/etk/Color.h | 344 ++++--- Sources/libetk/etk/File.cpp | 16 +- Sources/libetk/etk/RegExp.cpp | 16 +- Sources/libetk/etk/RegExp.h | 50 +- Sources/libetk/etk/Stream.h | 5 - Sources/libetk/etk/Types.h | 36 +- Sources/libetk/etk/UString.cpp | 20 +- Sources/libetk/etk/UString.h | 22 +- Sources/libetk/etk/Vector.h | 915 +++++++++++++----- Sources/libetk/etk/VectorType.h | 687 ------------- Sources/libetk/etk/tool.cpp | 32 +- Sources/libetk/etk/tool.h | 3 +- Sources/libetk/etk/unicode.cpp | 22 +- Sources/libetk/etk/unicode.h | 36 +- Sources/libewol/ewol/Audio/audio.cpp | 6 +- Sources/libewol/ewol/EObject.cpp | 2 +- Sources/libewol/ewol/EObject.h | 6 +- Sources/libewol/ewol/EObjectManager.cpp | 4 +- Sources/libewol/ewol/Font.h | 16 +- Sources/libewol/ewol/FontFreeType.cpp | 38 +- Sources/libewol/ewol/Game/GameElementLua.cpp | 18 +- Sources/libewol/ewol/Game/SceneElement.h | 8 +- Sources/libewol/ewol/OObject.h | 3 +- Sources/libewol/ewol/OObject/2DColored.cpp | 21 +- Sources/libewol/ewol/OObject/2DColored.h | 10 +- Sources/libewol/ewol/OObject/2DText.cpp | 7 +- Sources/libewol/ewol/OObject/2DText.h | 8 +- .../libewol/ewol/OObject/2DTextColored.cpp | 10 +- Sources/libewol/ewol/OObject/2DTextColored.h | 10 +- Sources/libewol/ewol/OObject/2DTextured.cpp | 4 +- Sources/libewol/ewol/OObject/2DTextured.h | 10 +- Sources/libewol/ewol/OObject/Sprite.cpp | 8 +- Sources/libewol/ewol/OObject/Sprite.h | 10 +- Sources/libewol/ewol/ShortCutManager.cpp | 2 +- Sources/libewol/ewol/Texture.cpp | 2 +- Sources/libewol/ewol/Widget.h | 2 +- Sources/libewol/ewol/WidgetManager.cpp | 4 +- Sources/libewol/ewol/WidgetManager.h | 2 +- Sources/libewol/ewol/Windows.h | 4 +- Sources/libewol/ewol/base/MainThread.cpp | 15 +- Sources/libewol/ewol/base/guiX11.cpp | 8 +- Sources/libewol/ewol/threadMsg.h | 2 +- Sources/libewol/ewol/widget/Button.cpp | 4 +- Sources/libewol/ewol/widget/Button.h | 8 +- Sources/libewol/ewol/widget/ButtonColor.cpp | 30 +- Sources/libewol/ewol/widget/ButtonColor.h | 10 +- Sources/libewol/ewol/widget/ButtonImage.cpp | 8 +- Sources/libewol/ewol/widget/ButtonImage.h | 14 +- Sources/libewol/ewol/widget/CheckBox.cpp | 4 +- Sources/libewol/ewol/widget/CheckBox.h | 4 +- Sources/libewol/ewol/widget/ColorBar.cpp | 34 +- Sources/libewol/ewol/widget/ColorBar.h | 6 +- Sources/libewol/ewol/widget/ContextMenu.cpp | 4 +- Sources/libewol/ewol/widget/ContextMenu.h | 4 +- Sources/libewol/ewol/widget/Drawable.h | 2 +- Sources/libewol/ewol/widget/Entry.cpp | 4 +- Sources/libewol/ewol/widget/Entry.h | 4 +- Sources/libewol/ewol/widget/Image.cpp | 2 +- Sources/libewol/ewol/widget/Image.h | 2 +- Sources/libewol/ewol/widget/Joystick.cpp | 4 +- Sources/libewol/ewol/widget/Joystick.h | 4 +- Sources/libewol/ewol/widget/Label.cpp | 2 +- Sources/libewol/ewol/widget/Label.h | 2 +- Sources/libewol/ewol/widget/Layer.cpp | 2 +- Sources/libewol/ewol/widget/Layer.h | 2 +- Sources/libewol/ewol/widget/List.cpp | 8 +- Sources/libewol/ewol/widget/List.h | 10 +- .../libewol/ewol/widget/ListFileSystem.cpp | 16 +- Sources/libewol/ewol/widget/ListFileSystem.h | 8 +- Sources/libewol/ewol/widget/Menu.h | 2 +- Sources/libewol/ewol/widget/PopUp.cpp | 6 +- Sources/libewol/ewol/widget/PopUp.h | 6 +- Sources/libewol/ewol/widget/ProgressBar.cpp | 9 +- Sources/libewol/ewol/widget/ProgressBar.h | 8 +- Sources/libewol/ewol/widget/SizerHori.cpp | 2 +- Sources/libewol/ewol/widget/SizerHori.h | 2 +- Sources/libewol/ewol/widget/SizerVert.cpp | 2 +- Sources/libewol/ewol/widget/SizerVert.h | 2 +- Sources/libewol/ewol/widget/Slider.cpp | 8 +- Sources/libewol/ewol/widget/Slider.h | 6 +- Sources/libewol/ewol/widget/Spacer.h | 4 +- Sources/libewol/ewol/widget/WSlider.cpp | 2 +- Sources/libewol/ewol/widget/WSlider.h | 2 +- Sources/libewol/ewol/widget/WidgetScrolled.h | 2 +- .../libewol/ewol/widgetMeta/ColorChooser.cpp | 23 +- .../libewol/ewol/widgetMeta/ColorChooser.h | 6 +- .../libewol/ewol/widgetMeta/FileChooser.cpp | 6 +- Sources/libewol/ewol/widgetMeta/Parameter.cpp | 4 +- .../libewol/ewol/widgetMeta/ParameterList.cpp | 4 +- .../libewol/ewol/widgetMeta/ParameterList.h | 4 +- Sources/libewol/ewol/widgetMeta/StdPopUp.cpp | 2 +- Sources/libparsersvg | 2 +- 93 files changed, 1674 insertions(+), 1924 deletions(-) delete mode 100644 Sources/libetk/etk/VectorType.h diff --git a/Sources/libetk/etk/Color.cpp b/Sources/libetk/etk/Color.cpp index a5400466..8af53007 100644 --- a/Sources/libetk/etk/Color.cpp +++ b/Sources/libetk/etk/Color.cpp @@ -25,350 +25,394 @@ #include #include #include +#include -const color_ts etk::color::color_none(0x00000000); -const color_ts etk::color::color_AliceBlue(0xF0F8FFFF); -const color_ts etk::color::color_AntiqueWhite(0xFAEBD7FF); -const color_ts etk::color::color_Aqua(0x00FFFFFF); -const color_ts etk::color::color_Aquamarine(0x7FFFD4FF); -const color_ts etk::color::color_Azure(0xF0FFFFFF); -const color_ts etk::color::color_Beige(0xF5F5DCFF); -const color_ts etk::color::color_Bisque(0xFFE4C4FF); -const color_ts etk::color::color_Black(0x000000FF); -const color_ts etk::color::color_BlanchedAlmond(0xFFEBCDFF); -const color_ts etk::color::color_Blue(0x0000FFFF); -const color_ts etk::color::color_BlueViolet(0x8A2BE2FF); -const color_ts etk::color::color_Brown(0xA52A2AFF); -const color_ts etk::color::color_BurlyWood(0xDEB887FF); -const color_ts etk::color::color_CadetBlue(0x5F9EA0FF); -const color_ts etk::color::color_Chartreuse(0x7FFF00FF); -const color_ts etk::color::color_Chocolate(0xD2691EFF); -const color_ts etk::color::color_Coral(0xFF7F50FF); -const color_ts etk::color::color_CornflowerBlue(0x6495EDFF); -const color_ts etk::color::color_Cornsilk(0xFFF8DCFF); -const color_ts etk::color::color_Crimson(0xDC143CFF); -const color_ts etk::color::color_Cyan(0x00FFFFFF); -const color_ts etk::color::color_DarkBlue(0x00008BFF); -const color_ts etk::color::color_DarkCyan(0x008B8BFF); -const color_ts etk::color::color_DarkGoldenRod(0xB8860BFF); -const color_ts etk::color::color_DarkGray(0xA9A9A9FF); -const color_ts etk::color::color_DarkGrey(0xA9A9A9FF); -const color_ts etk::color::color_DarkGreen(0x006400FF); -const color_ts etk::color::color_DarkKhaki(0xBDB76BFF); -const color_ts etk::color::color_DarkMagenta(0x8B008BFF); -const color_ts etk::color::color_DarkOliveGreen(0x556B2FFF); -const color_ts etk::color::color_Darkorange(0xFF8C00FF); -const color_ts etk::color::color_DarkOrchid(0x9932CCFF); -const color_ts etk::color::color_DarkRed(0x8B0000FF); -const color_ts etk::color::color_DarkSalmon(0xE9967AFF); -const color_ts etk::color::color_DarkSeaGreen(0x8FBC8FFF); -const color_ts etk::color::color_DarkSlateBlue(0x483D8BFF); -const color_ts etk::color::color_DarkSlateGray(0x2F4F4FFF); -const color_ts etk::color::color_DarkSlateGrey(0x2F4F4FFF); -const color_ts etk::color::color_DarkTurquoise(0x00CED1FF); -const color_ts etk::color::color_DarkViolet(0x9400D3FF); -const color_ts etk::color::color_DeepPink(0xFF1493FF); -const color_ts etk::color::color_DeepSkyBlue(0x00BFFFFF); -const color_ts etk::color::color_DimGray(0x696969FF); -const color_ts etk::color::color_DimGrey(0x696969FF); -const color_ts etk::color::color_DodgerBlue(0x1E90FFFF); -const color_ts etk::color::color_FireBrick(0xB22222FF); -const color_ts etk::color::color_FloralWhite(0xFFFAF0FF); -const color_ts etk::color::color_ForestGreen(0x228B22FF); -const color_ts etk::color::color_Fuchsia(0xFF00FFFF); -const color_ts etk::color::color_Gainsboro(0xDCDCDCFF); -const color_ts etk::color::color_GhostWhite(0xF8F8FFFF); -const color_ts etk::color::color_Gold(0xFFD700FF); -const color_ts etk::color::color_GoldenRod(0xDAA520FF); -const color_ts etk::color::color_Gray(0x808080FF); -const color_ts etk::color::color_Grey(0x808080FF); -const color_ts etk::color::color_Green(0x008000FF); -const color_ts etk::color::color_GreenYellow(0xADFF2FFF); -const color_ts etk::color::color_HoneyDew(0xF0FFF0FF); -const color_ts etk::color::color_HotPink(0xFF69B4FF); -const color_ts etk::color::color_IndianRed (0xCD5C5CFF); -const color_ts etk::color::color_Indigo (0x4B0082FF); -const color_ts etk::color::color_Ivory(0xFFFFF0FF); -const color_ts etk::color::color_Khaki(0xF0E68CFF); -const color_ts etk::color::color_Lavender(0xE6E6FAFF); -const color_ts etk::color::color_LavenderBlush(0xFFF0F5FF); -const color_ts etk::color::color_LawnGreen(0x7CFC00FF); -const color_ts etk::color::color_LemonChiffon(0xFFFACDFF); -const color_ts etk::color::color_LightBlue(0xADD8E6FF); -const color_ts etk::color::color_LightCoral(0xF08080FF); -const color_ts etk::color::color_LightCyan(0xE0FFFFFF); -const color_ts etk::color::color_LightGoldenRodYellow(0xFAFAD2FF); -const color_ts etk::color::color_LightGray(0xD3D3D3FF); -const color_ts etk::color::color_LightGrey(0xD3D3D3FF); -const color_ts etk::color::color_LightGreen(0x90EE90FF); -const color_ts etk::color::color_LightPink(0xFFB6C1FF); -const color_ts etk::color::color_LightSalmon(0xFFA07AFF); -const color_ts etk::color::color_LightSeaGreen(0x20B2AAFF); -const color_ts etk::color::color_LightSkyBlue(0x87CEFAFF); -const color_ts etk::color::color_LightSlateGray(0x778899FF); -const color_ts etk::color::color_LightSlateGrey(0x778899FF); -const color_ts etk::color::color_LightSteelBlue(0xB0C4DEFF); -const color_ts etk::color::color_LightYellow(0xFFFFE0FF); -const color_ts etk::color::color_Lime(0x00FF00FF); -const color_ts etk::color::color_LimeGreen(0x32CD32FF); -const color_ts etk::color::color_Linen(0xFAF0E6FF); -const color_ts etk::color::color_Magenta(0xFF00FFFF); -const color_ts etk::color::color_Maroon(0x800000FF); -const color_ts etk::color::color_MediumAquaMarine(0x66CDAAFF); -const color_ts etk::color::color_MediumBlue(0x0000CDFF); -const color_ts etk::color::color_MediumOrchid(0xBA55D3FF); -const color_ts etk::color::color_MediumPurple(0x9370D8FF); -const color_ts etk::color::color_MediumSeaGreen(0x3CB371FF); -const color_ts etk::color::color_MediumSlateBlue(0x7B68EEFF); -const color_ts etk::color::color_MediumSpringGreen(0x00FA9AFF); -const color_ts etk::color::color_MediumTurquoise(0x48D1CCFF); -const color_ts etk::color::color_MediumVioletRed(0xC71585FF); -const color_ts etk::color::color_MidnightBlue(0x191970FF); -const color_ts etk::color::color_MintCream(0xF5FFFAFF); -const color_ts etk::color::color_MistyRose(0xFFE4E1FF); -const color_ts etk::color::color_Moccasin(0xFFE4B5FF); -const color_ts etk::color::color_NavajoWhite(0xFFDEADFF); -const color_ts etk::color::color_Navy(0x000080FF); -const color_ts etk::color::color_OldLace(0xFDF5E6FF); -const color_ts etk::color::color_Olive(0x808000FF); -const color_ts etk::color::color_OliveDrab(0x6B8E23FF); -const color_ts etk::color::color_Orange(0xFFA500FF); -const color_ts etk::color::color_OrangeRed(0xFF4500FF); -const color_ts etk::color::color_Orchid(0xDA70D6FF); -const color_ts etk::color::color_PaleGoldenRod(0xEEE8AAFF); -const color_ts etk::color::color_PaleGreen(0x98FB98FF); -const color_ts etk::color::color_PaleTurquoise(0xAFEEEEFF); -const color_ts etk::color::color_PaleVioletRed(0xD87093FF); -const color_ts etk::color::color_PapayaWhip(0xFFEFD5FF); -const color_ts etk::color::color_PeachPuff(0xFFDAB9FF); -const color_ts etk::color::color_Peru(0xCD853FFF); -const color_ts etk::color::color_Pink(0xFFC0CBFF); -const color_ts etk::color::color_Plum(0xDDA0DDFF); -const color_ts etk::color::color_PowderBlue(0xB0E0E6FF); -const color_ts etk::color::color_Purple(0x800080FF); -const color_ts etk::color::color_Red(0xFF0000FF); -const color_ts etk::color::color_RosyBrown(0xBC8F8FFF); -const color_ts etk::color::color_RoyalBlue(0x4169E1FF); -const color_ts etk::color::color_SaddleBrown(0x8B4513FF); -const color_ts etk::color::color_Salmon(0xFA8072FF); -const color_ts etk::color::color_SandyBrown(0xF4A460FF); -const color_ts etk::color::color_SeaGreen(0x2E8B57FF); -const color_ts etk::color::color_SeaShell(0xFFF5EEFF); -const color_ts etk::color::color_Sienna(0xA0522DFF); -const color_ts etk::color::color_Silver(0xC0C0C0FF); -const color_ts etk::color::color_SkyBlue(0x87CEEBFF); -const color_ts etk::color::color_SlateBlue(0x6A5ACDFF); -const color_ts etk::color::color_SlateGray(0x708090FF); -const color_ts etk::color::color_SlateGrey(0x708090FF); -const color_ts etk::color::color_Snow(0xFFFAFAFF); -const color_ts etk::color::color_SpringGreen(0x00FF7FFF); -const color_ts etk::color::color_SteelBlue(0x4682B4FF); -const color_ts etk::color::color_Tan(0xD2B48CFF); -const color_ts etk::color::color_Teal(0x008080FF); -const color_ts etk::color::color_Thistle(0xD8BFD8FF); -const color_ts etk::color::color_Tomato(0xFF6347FF); -const color_ts etk::color::color_Turquoise(0x40E0D0FF); -const color_ts etk::color::color_Violet(0xEE82EEFF); -const color_ts etk::color::color_Wheat(0xF5DEB3FF); -const color_ts etk::color::color_White(0xFFFFFFFF); -const color_ts etk::color::color_WhiteSmoke(0xF5F5F5FF); -const color_ts etk::color::color_Yellow(0xFFFF00FF); -const color_ts etk::color::color_YellowGreen(0x9ACD32FF); +const etk::Color etk::color::none((uint32_t)0x00000000); +const etk::Color etk::color::aliceBlue((uint32_t)0xF0F8FFFF); +const etk::Color etk::color::antiqueWhite((uint32_t)0xFAEBD7FF); +const etk::Color etk::color::aqua((uint32_t)0x00FFFFFF); +const etk::Color etk::color::aquamarine((uint32_t)0x7FFFD4FF); +const etk::Color etk::color::azure((uint32_t)0xF0FFFFFF); +const etk::Color etk::color::beige((uint32_t)0xF5F5DCFF); +const etk::Color etk::color::bisque((uint32_t)0xFFE4C4FF); +const etk::Color etk::color::black((uint32_t)0x000000FF); +const etk::Color etk::color::blanchedAlmond((uint32_t)0xFFEBCDFF); +const etk::Color etk::color::blue((uint32_t)0x0000FFFF); +const etk::Color etk::color::blueViolet((uint32_t)0x8A2BE2FF); +const etk::Color etk::color::brown((uint32_t)0xA52A2AFF); +const etk::Color etk::color::burlyWood((uint32_t)0xDEB887FF); +const etk::Color etk::color::cadetBlue((uint32_t)0x5F9EA0FF); +const etk::Color etk::color::chartreuse((uint32_t)0x7FFF00FF); +const etk::Color etk::color::chocolate((uint32_t)0xD2691EFF); +const etk::Color etk::color::coral((uint32_t)0xFF7F50FF); +const etk::Color etk::color::cornflowerBlue((uint32_t)0x6495EDFF); +const etk::Color etk::color::cornsilk((uint32_t)0xFFF8DCFF); +const etk::Color etk::color::crimson((uint32_t)0xDC143CFF); +const etk::Color etk::color::cyan((uint32_t)0x00FFFFFF); +const etk::Color etk::color::darkBlue((uint32_t)0x00008BFF); +const etk::Color etk::color::darkCyan((uint32_t)0x008B8BFF); +const etk::Color etk::color::darkGoldenRod((uint32_t)0xB8860BFF); +const etk::Color etk::color::darkGray((uint32_t)0xA9A9A9FF); +const etk::Color etk::color::darkGrey((uint32_t)0xA9A9A9FF); +const etk::Color etk::color::darkGreen((uint32_t)0x006400FF); +const etk::Color etk::color::darkKhaki((uint32_t)0xBDB76BFF); +const etk::Color etk::color::darkMagenta((uint32_t)0x8B008BFF); +const etk::Color etk::color::darkOliveGreen((uint32_t)0x556B2FFF); +const etk::Color etk::color::darkorange((uint32_t)0xFF8C00FF); +const etk::Color etk::color::darkOrchid((uint32_t)0x9932CCFF); +const etk::Color etk::color::darkRed((uint32_t)0x8B0000FF); +const etk::Color etk::color::darkSalmon((uint32_t)0xE9967AFF); +const etk::Color etk::color::darkSeaGreen((uint32_t)0x8FBC8FFF); +const etk::Color etk::color::darkSlateBlue((uint32_t)0x483D8BFF); +const etk::Color etk::color::darkSlateGray((uint32_t)0x2F4F4FFF); +const etk::Color etk::color::darkSlateGrey((uint32_t)0x2F4F4FFF); +const etk::Color etk::color::darkTurquoise((uint32_t)0x00CED1FF); +const etk::Color etk::color::darkViolet((uint32_t)0x9400D3FF); +const etk::Color etk::color::deepPink((uint32_t)0xFF1493FF); +const etk::Color etk::color::deepSkyBlue((uint32_t)0x00BFFFFF); +const etk::Color etk::color::dimGray((uint32_t)0x696969FF); +const etk::Color etk::color::dimGrey((uint32_t)0x696969FF); +const etk::Color etk::color::dodgerBlue((uint32_t)0x1E90FFFF); +const etk::Color etk::color::fireBrick((uint32_t)0xB22222FF); +const etk::Color etk::color::floralWhite((uint32_t)0xFFFAF0FF); +const etk::Color etk::color::forestGreen((uint32_t)0x228B22FF); +const etk::Color etk::color::fuchsia((uint32_t)0xFF00FFFF); +const etk::Color etk::color::gainsboro((uint32_t)0xDCDCDCFF); +const etk::Color etk::color::ghostWhite((uint32_t)0xF8F8FFFF); +const etk::Color etk::color::gold((uint32_t)0xFFD700FF); +const etk::Color etk::color::goldenRod((uint32_t)0xDAA520FF); +const etk::Color etk::color::gray((uint32_t)0x808080FF); +const etk::Color etk::color::grey((uint32_t)0x808080FF); +const etk::Color etk::color::green((uint32_t)0x008000FF); +const etk::Color etk::color::greenYellow((uint32_t)0xADFF2FFF); +const etk::Color etk::color::honeyDew((uint32_t)0xF0FFF0FF); +const etk::Color etk::color::hotPink((uint32_t)0xFF69B4FF); +const etk::Color etk::color::indianRed ((uint32_t)0xCD5C5CFF); +const etk::Color etk::color::indigo ((uint32_t)0x4B0082FF); +const etk::Color etk::color::ivory((uint32_t)0xFFFFF0FF); +const etk::Color etk::color::khaki((uint32_t)0xF0E68CFF); +const etk::Color etk::color::lavender((uint32_t)0xE6E6FAFF); +const etk::Color etk::color::lavenderBlush((uint32_t)0xFFF0F5FF); +const etk::Color etk::color::lawnGreen((uint32_t)0x7CFC00FF); +const etk::Color etk::color::lemonChiffon((uint32_t)0xFFFACDFF); +const etk::Color etk::color::lightBlue((uint32_t)0xADD8E6FF); +const etk::Color etk::color::lightCoral((uint32_t)0xF08080FF); +const etk::Color etk::color::lightCyan((uint32_t)0xE0FFFFFF); +const etk::Color etk::color::lightGoldenRodYellow((uint32_t)0xFAFAD2FF); +const etk::Color etk::color::lightGray((uint32_t)0xD3D3D3FF); +const etk::Color etk::color::lightGrey((uint32_t)0xD3D3D3FF); +const etk::Color etk::color::lightGreen((uint32_t)0x90EE90FF); +const etk::Color etk::color::lightPink((uint32_t)0xFFB6C1FF); +const etk::Color etk::color::lightSalmon((uint32_t)0xFFA07AFF); +const etk::Color etk::color::lightSeaGreen((uint32_t)0x20B2AAFF); +const etk::Color etk::color::lightSkyBlue((uint32_t)0x87CEFAFF); +const etk::Color etk::color::lightSlateGray((uint32_t)0x778899FF); +const etk::Color etk::color::lightSlateGrey((uint32_t)0x778899FF); +const etk::Color etk::color::lightSteelBlue((uint32_t)0xB0C4DEFF); +const etk::Color etk::color::lightYellow((uint32_t)0xFFFFE0FF); +const etk::Color etk::color::lime((uint32_t)0x00FF00FF); +const etk::Color etk::color::limeGreen((uint32_t)0x32CD32FF); +const etk::Color etk::color::linen((uint32_t)0xFAF0E6FF); +const etk::Color etk::color::magenta((uint32_t)0xFF00FFFF); +const etk::Color etk::color::maroon((uint32_t)0x800000FF); +const etk::Color etk::color::mediumAquaMarine((uint32_t)0x66CDAAFF); +const etk::Color etk::color::mediumBlue((uint32_t)0x0000CDFF); +const etk::Color etk::color::mediumOrchid((uint32_t)0xBA55D3FF); +const etk::Color etk::color::mediumPurple((uint32_t)0x9370D8FF); +const etk::Color etk::color::mediumSeaGreen((uint32_t)0x3CB371FF); +const etk::Color etk::color::mediumSlateBlue((uint32_t)0x7B68EEFF); +const etk::Color etk::color::mediumSpringGreen((uint32_t)0x00FA9AFF); +const etk::Color etk::color::mediumTurquoise((uint32_t)0x48D1CCFF); +const etk::Color etk::color::mediumVioletRed((uint32_t)0xC71585FF); +const etk::Color etk::color::midnightBlue((uint32_t)0x191970FF); +const etk::Color etk::color::mintCream((uint32_t)0xF5FFFAFF); +const etk::Color etk::color::mistyRose((uint32_t)0xFFE4E1FF); +const etk::Color etk::color::moccasin((uint32_t)0xFFE4B5FF); +const etk::Color etk::color::navajoWhite((uint32_t)0xFFDEADFF); +const etk::Color etk::color::navy((uint32_t)0x000080FF); +const etk::Color etk::color::oldLace((uint32_t)0xFDF5E6FF); +const etk::Color etk::color::olive((uint32_t)0x808000FF); +const etk::Color etk::color::oliveDrab((uint32_t)0x6B8E23FF); +const etk::Color etk::color::orange((uint32_t)0xFFA500FF); +const etk::Color etk::color::orangeRed((uint32_t)0xFF4500FF); +const etk::Color etk::color::orchid((uint32_t)0xDA70D6FF); +const etk::Color etk::color::paleGoldenRod((uint32_t)0xEEE8AAFF); +const etk::Color etk::color::paleGreen((uint32_t)0x98FB98FF); +const etk::Color etk::color::paleTurquoise((uint32_t)0xAFEEEEFF); +const etk::Color etk::color::paleVioletRed((uint32_t)0xD87093FF); +const etk::Color etk::color::papayaWhip((uint32_t)0xFFEFD5FF); +const etk::Color etk::color::peachPuff((uint32_t)0xFFDAB9FF); +const etk::Color etk::color::peru((uint32_t)0xCD853FFF); +const etk::Color etk::color::pink((uint32_t)0xFFC0CBFF); +const etk::Color etk::color::plum((uint32_t)0xDDA0DDFF); +const etk::Color etk::color::powderBlue((uint32_t)0xB0E0E6FF); +const etk::Color etk::color::purple((uint32_t)0x800080FF); +const etk::Color etk::color::red((uint32_t)0xFF0000FF); +const etk::Color etk::color::rosyBrown((uint32_t)0xBC8F8FFF); +const etk::Color etk::color::royalBlue((uint32_t)0x4169E1FF); +const etk::Color etk::color::saddleBrown((uint32_t)0x8B4513FF); +const etk::Color etk::color::salmon((uint32_t)0xFA8072FF); +const etk::Color etk::color::sandyBrown((uint32_t)0xF4A460FF); +const etk::Color etk::color::seaGreen((uint32_t)0x2E8B57FF); +const etk::Color etk::color::seaShell((uint32_t)0xFFF5EEFF); +const etk::Color etk::color::sienna((uint32_t)0xA0522DFF); +const etk::Color etk::color::silver((uint32_t)0xC0C0C0FF); +const etk::Color etk::color::skyBlue((uint32_t)0x87CEEBFF); +const etk::Color etk::color::slateBlue((uint32_t)0x6A5ACDFF); +const etk::Color etk::color::slateGray((uint32_t)0x708090FF); +const etk::Color etk::color::slateGrey((uint32_t)0x708090FF); +const etk::Color etk::color::snow((uint32_t)0xFFFAFAFF); +const etk::Color etk::color::springGreen((uint32_t)0x00FF7FFF); +const etk::Color etk::color::steelBlue((uint32_t)0x4682B4FF); +const etk::Color etk::color::tan((uint32_t)0xD2B48CFF); +const etk::Color etk::color::teal((uint32_t)0x008080FF); +const etk::Color etk::color::thistle((uint32_t)0xD8BFD8FF); +const etk::Color etk::color::tomato((uint32_t)0xFF6347FF); +const etk::Color etk::color::turquoise((uint32_t)0x40E0D0FF); +const etk::Color etk::color::violet((uint32_t)0xEE82EEFF); +const etk::Color etk::color::wheat((uint32_t)0xF5DEB3FF); +const etk::Color etk::color::white((uint32_t)0xFFFFFFFF); +const etk::Color etk::color::whiteSmoke((uint32_t)0xF5F5F5FF); +const etk::Color etk::color::yellow((uint32_t)0xFFFF00FF); +const etk::Color etk::color::yellowGreen((uint32_t)0x9ACD32FF); typedef struct { const char * colorName; - color_ts color; + etk::Color color; } colorList_ts; static const colorList_ts listOfColor[] = { - { "none", etk::color::color_none}, - { "AliceBlue", etk::color::color_AliceBlue}, - { "AntiqueWhite", etk::color::color_AntiqueWhite}, - { "Aqua", etk::color::color_Aqua}, - { "Aquamarine", etk::color::color_Aquamarine}, - { "Azure", etk::color::color_Azure}, - { "Beige", etk::color::color_Beige}, - { "Bisque", etk::color::color_Bisque}, - { "Black", etk::color::color_Black}, - { "BlanchedAlmond", etk::color::color_BlanchedAlmond}, - { "Blue", etk::color::color_Blue}, - { "BlueViolet", etk::color::color_BlueViolet}, - { "Brown", etk::color::color_Brown}, - { "BurlyWood", etk::color::color_BurlyWood}, - { "CadetBlue", etk::color::color_CadetBlue}, - { "Chartreuse", etk::color::color_Chartreuse}, - { "Chocolate", etk::color::color_Chocolate}, - { "Coral", etk::color::color_Coral}, - { "CornflowerBlue", etk::color::color_CornflowerBlue}, - { "Cornsilk", etk::color::color_Cornsilk}, - { "Crimson", etk::color::color_Crimson}, - { "Cyan", etk::color::color_Cyan}, - { "DarkBlue", etk::color::color_DarkBlue}, - { "DarkCyan", etk::color::color_DarkCyan}, - { "DarkGoldenRod", etk::color::color_DarkGoldenRod}, - { "DarkGray", etk::color::color_DarkGray}, - { "DarkGrey", etk::color::color_DarkGrey}, - { "DarkGreen", etk::color::color_DarkGreen}, - { "DarkKhaki", etk::color::color_DarkKhaki}, - { "DarkMagenta", etk::color::color_DarkMagenta}, - { "DarkOliveGreen", etk::color::color_DarkOliveGreen}, - { "Darkorange", etk::color::color_Darkorange}, - { "DarkOrchid", etk::color::color_DarkOrchid}, - { "DarkRed", etk::color::color_DarkRed}, - { "DarkSalmon", etk::color::color_DarkSalmon}, - { "DarkSeaGreen", etk::color::color_DarkSeaGreen}, - { "DarkSlateBlue", etk::color::color_DarkSlateBlue}, - { "DarkSlateGray", etk::color::color_DarkSlateGray}, - { "DarkSlateGrey", etk::color::color_DarkSlateGrey}, - { "DarkTurquoise", etk::color::color_DarkTurquoise}, - { "DarkViolet", etk::color::color_DarkViolet}, - { "DeepPink", etk::color::color_DeepPink}, - { "DeepSkyBlue", etk::color::color_DeepSkyBlue}, - { "DimGray", etk::color::color_DimGray}, - { "DimGrey", etk::color::color_DimGrey}, - { "DodgerBlue", etk::color::color_DodgerBlue}, - { "FireBrick", etk::color::color_FireBrick}, - { "FloralWhite", etk::color::color_FloralWhite}, - { "ForestGreen", etk::color::color_ForestGreen}, - { "Fuchsia", etk::color::color_Fuchsia}, - { "Gainsboro", etk::color::color_Gainsboro}, - { "GhostWhite", etk::color::color_GhostWhite}, - { "Gold", etk::color::color_Gold}, - { "GoldenRod", etk::color::color_GoldenRod}, - { "Gray", etk::color::color_Gray}, - { "Grey", etk::color::color_Grey}, - { "Green", etk::color::color_Green}, - { "GreenYellow", etk::color::color_GreenYellow}, - { "HoneyDew", etk::color::color_HoneyDew}, - { "HotPink", etk::color::color_HotPink}, - { "IndianRed", etk::color::color_IndianRed}, - { "Indigo", etk::color::color_Indigo}, - { "Ivory", etk::color::color_Ivory}, - { "Khaki", etk::color::color_Khaki}, - { "Lavender", etk::color::color_Lavender}, - { "LavenderBlush", etk::color::color_LavenderBlush}, - { "LawnGreen", etk::color::color_LawnGreen}, - { "LemonChiffon", etk::color::color_LemonChiffon}, - { "LightBlue", etk::color::color_LightBlue}, - { "LightCoral", etk::color::color_LightCoral}, - { "LightCyan", etk::color::color_LightCyan}, - { "LightGoldenRodYellow", etk::color::color_LightGoldenRodYellow}, - { "LightGray", etk::color::color_LightGray}, - { "LightGrey", etk::color::color_LightGrey}, - { "LightGreen", etk::color::color_LightGreen}, - { "LightPink", etk::color::color_LightPink}, - { "LightSalmon", etk::color::color_LightSalmon}, - { "LightSeaGreen", etk::color::color_LightSeaGreen}, - { "LightSkyBlue", etk::color::color_LightSkyBlue}, - { "LightSlateGray", etk::color::color_LightSlateGray}, - { "LightSlateGrey", etk::color::color_LightSlateGrey}, - { "LightSteelBlue", etk::color::color_LightSteelBlue}, - { "LightYellow", etk::color::color_LightYellow}, - { "Lime", etk::color::color_Lime}, - { "LimeGreen", etk::color::color_LimeGreen}, - { "Linen", etk::color::color_Linen}, - { "Magenta", etk::color::color_Magenta}, - { "Maroon", etk::color::color_Maroon}, - { "MediumAquaMarine", etk::color::color_MediumAquaMarine}, - { "MediumBlue", etk::color::color_MediumBlue}, - { "MediumOrchid", etk::color::color_MediumOrchid}, - { "MediumPurple", etk::color::color_MediumPurple}, - { "MediumSeaGreen", etk::color::color_MediumSeaGreen}, - { "MediumSlateBlue", etk::color::color_MediumSlateBlue}, - { "MediumSpringGreen", etk::color::color_MediumSpringGreen}, - { "MediumTurquoise", etk::color::color_MediumTurquoise}, - { "MediumVioletRed", etk::color::color_MediumVioletRed}, - { "MidnightBlue", etk::color::color_MidnightBlue}, - { "MintCream", etk::color::color_MintCream}, - { "MistyRose", etk::color::color_MistyRose}, - { "Moccasin", etk::color::color_Moccasin}, - { "NavajoWhite", etk::color::color_NavajoWhite}, - { "Navy", etk::color::color_Navy}, - { "OldLace", etk::color::color_OldLace}, - { "Olive", etk::color::color_Olive}, - { "OliveDrab", etk::color::color_OliveDrab}, - { "Orange", etk::color::color_Orange}, - { "OrangeRed", etk::color::color_OrangeRed}, - { "Orchid", etk::color::color_Orchid}, - { "PaleGoldenRod", etk::color::color_PaleGoldenRod}, - { "PaleGreen", etk::color::color_PaleGreen}, - { "PaleTurquoise", etk::color::color_PaleTurquoise}, - { "PaleVioletRed", etk::color::color_PaleVioletRed}, - { "PapayaWhip", etk::color::color_PapayaWhip}, - { "PeachPuff", etk::color::color_PeachPuff}, - { "Peru", etk::color::color_Peru}, - { "Pink", etk::color::color_Pink}, - { "Plum", etk::color::color_Plum}, - { "PowderBlue", etk::color::color_PowderBlue}, - { "Purple", etk::color::color_Purple}, - { "Red", etk::color::color_Red}, - { "RosyBrown", etk::color::color_RosyBrown}, - { "RoyalBlue", etk::color::color_RoyalBlue}, - { "SaddleBrown", etk::color::color_SaddleBrown}, - { "Salmon", etk::color::color_Salmon}, - { "SandyBrown", etk::color::color_SandyBrown}, - { "SeaGreen", etk::color::color_SeaGreen}, - { "SeaShell", etk::color::color_SeaShell}, - { "Sienna", etk::color::color_Sienna}, - { "Silver", etk::color::color_Silver}, - { "SkyBlue", etk::color::color_SkyBlue}, - { "SlateBlue", etk::color::color_SlateBlue}, - { "SlateGray", etk::color::color_SlateGray}, - { "SlateGrey", etk::color::color_SlateGrey}, - { "Snow", etk::color::color_Snow}, - { "SpringGreen", etk::color::color_SpringGreen}, - { "SteelBlue", etk::color::color_SteelBlue}, - { "Tan", etk::color::color_Tan}, - { "Teal", etk::color::color_Teal}, - { "Thistle", etk::color::color_Thistle}, - { "Tomato", etk::color::color_Tomato}, - { "Turquoise", etk::color::color_Turquoise}, - { "Violet", etk::color::color_Violet}, - { "Wheat", etk::color::color_Wheat}, - { "White", etk::color::color_White}, - { "WhiteSmoke", etk::color::color_WhiteSmoke}, - { "Yellow", etk::color::color_Yellow}, - { "YellowGreen", etk::color::color_YellowGreen} + { "none", etk::color::none}, + { "AliceBlue", etk::color::aliceBlue}, + { "AntiqueWhite", etk::color::antiqueWhite}, + { "Aqua", etk::color::aqua}, + { "Aquamarine", etk::color::aquamarine}, + { "Azure", etk::color::azure}, + { "Beige", etk::color::beige}, + { "Bisque", etk::color::bisque}, + { "Black", etk::color::black}, + { "BlanchedAlmond", etk::color::blanchedAlmond}, + { "Blue", etk::color::blue}, + { "BlueViolet", etk::color::blueViolet}, + { "Brown", etk::color::brown}, + { "BurlyWood", etk::color::burlyWood}, + { "CadetBlue", etk::color::cadetBlue}, + { "Chartreuse", etk::color::chartreuse}, + { "Chocolate", etk::color::chocolate}, + { "Coral", etk::color::coral}, + { "CornflowerBlue", etk::color::cornflowerBlue}, + { "Cornsilk", etk::color::cornsilk}, + { "Crimson", etk::color::crimson}, + { "Cyan", etk::color::cyan}, + { "DarkBlue", etk::color::darkBlue}, + { "DarkCyan", etk::color::darkCyan}, + { "DarkGoldenRod", etk::color::darkGoldenRod}, + { "DarkGray", etk::color::darkGray}, + { "DarkGrey", etk::color::darkGrey}, + { "DarkGreen", etk::color::darkGreen}, + { "DarkKhaki", etk::color::darkKhaki}, + { "DarkMagenta", etk::color::darkMagenta}, + { "DarkOliveGreen", etk::color::darkOliveGreen}, + { "Darkorange", etk::color::darkorange}, + { "DarkOrchid", etk::color::darkOrchid}, + { "DarkRed", etk::color::darkRed}, + { "DarkSalmon", etk::color::darkSalmon}, + { "DarkSeaGreen", etk::color::darkSeaGreen}, + { "DarkSlateBlue", etk::color::darkSlateBlue}, + { "DarkSlateGray", etk::color::darkSlateGray}, + { "DarkSlateGrey", etk::color::darkSlateGrey}, + { "DarkTurquoise", etk::color::darkTurquoise}, + { "DarkViolet", etk::color::darkViolet}, + { "DeepPink", etk::color::deepPink}, + { "DeepSkyBlue", etk::color::deepSkyBlue}, + { "DimGray", etk::color::dimGray}, + { "DimGrey", etk::color::dimGrey}, + { "DodgerBlue", etk::color::dodgerBlue}, + { "FireBrick", etk::color::fireBrick}, + { "FloralWhite", etk::color::floralWhite}, + { "ForestGreen", etk::color::forestGreen}, + { "Fuchsia", etk::color::fuchsia}, + { "Gainsboro", etk::color::gainsboro}, + { "GhostWhite", etk::color::ghostWhite}, + { "Gold", etk::color::gold}, + { "GoldenRod", etk::color::goldenRod}, + { "Gray", etk::color::gray}, + { "Grey", etk::color::grey}, + { "Green", etk::color::green}, + { "GreenYellow", etk::color::greenYellow}, + { "HoneyDew", etk::color::honeyDew}, + { "HotPink", etk::color::hotPink}, + { "IndianRed", etk::color::indianRed}, + { "Indigo", etk::color::indigo}, + { "Ivory", etk::color::ivory}, + { "Khaki", etk::color::khaki}, + { "Lavender", etk::color::lavender}, + { "LavenderBlush", etk::color::lavenderBlush}, + { "LawnGreen", etk::color::lawnGreen}, + { "LemonChiffon", etk::color::lemonChiffon}, + { "LightBlue", etk::color::lightBlue}, + { "LightCoral", etk::color::lightCoral}, + { "LightCyan", etk::color::lightCyan}, + { "LightGoldenRodYellow", etk::color::lightGoldenRodYellow}, + { "LightGray", etk::color::lightGray}, + { "LightGrey", etk::color::lightGrey}, + { "LightGreen", etk::color::lightGreen}, + { "LightPink", etk::color::lightPink}, + { "LightSalmon", etk::color::lightSalmon}, + { "LightSeaGreen", etk::color::lightSeaGreen}, + { "LightSkyBlue", etk::color::lightSkyBlue}, + { "LightSlateGray", etk::color::lightSlateGray}, + { "LightSlateGrey", etk::color::lightSlateGrey}, + { "LightSteelBlue", etk::color::lightSteelBlue}, + { "LightYellow", etk::color::lightYellow}, + { "Lime", etk::color::lime}, + { "LimeGreen", etk::color::limeGreen}, + { "Linen", etk::color::linen}, + { "Magenta", etk::color::magenta}, + { "Maroon", etk::color::maroon}, + { "MediumAquaMarine", etk::color::mediumAquaMarine}, + { "MediumBlue", etk::color::mediumBlue}, + { "MediumOrchid", etk::color::mediumOrchid}, + { "MediumPurple", etk::color::mediumPurple}, + { "MediumSeaGreen", etk::color::mediumSeaGreen}, + { "MediumSlateBlue", etk::color::mediumSlateBlue}, + { "MediumSpringGreen", etk::color::mediumSpringGreen}, + { "MediumTurquoise", etk::color::mediumTurquoise}, + { "MediumVioletRed", etk::color::mediumVioletRed}, + { "MidnightBlue", etk::color::midnightBlue}, + { "MintCream", etk::color::mintCream}, + { "MistyRose", etk::color::mistyRose}, + { "Moccasin", etk::color::moccasin}, + { "NavajoWhite", etk::color::navajoWhite}, + { "Navy", etk::color::navy}, + { "OldLace", etk::color::oldLace}, + { "Olive", etk::color::olive}, + { "OliveDrab", etk::color::oliveDrab}, + { "Orange", etk::color::orange}, + { "OrangeRed", etk::color::orangeRed}, + { "Orchid", etk::color::orchid}, + { "PaleGoldenRod", etk::color::paleGoldenRod}, + { "PaleGreen", etk::color::paleGreen}, + { "PaleTurquoise", etk::color::paleTurquoise}, + { "PaleVioletRed", etk::color::paleVioletRed}, + { "PapayaWhip", etk::color::papayaWhip}, + { "PeachPuff", etk::color::peachPuff}, + { "Peru", etk::color::peru}, + { "Pink", etk::color::pink}, + { "Plum", etk::color::plum}, + { "PowderBlue", etk::color::powderBlue}, + { "Purple", etk::color::purple}, + { "Red", etk::color::red}, + { "RosyBrown", etk::color::rosyBrown}, + { "RoyalBlue", etk::color::royalBlue}, + { "SaddleBrown", etk::color::saddleBrown}, + { "Salmon", etk::color::salmon}, + { "SandyBrown", etk::color::sandyBrown}, + { "SeaGreen", etk::color::seaGreen}, + { "SeaShell", etk::color::seaShell}, + { "Sienna", etk::color::sienna}, + { "Silver", etk::color::silver}, + { "SkyBlue", etk::color::skyBlue}, + { "SlateBlue", etk::color::slateBlue}, + { "SlateGray", etk::color::slateGray}, + { "SlateGrey", etk::color::slateGrey}, + { "Snow", etk::color::snow}, + { "SpringGreen", etk::color::springGreen}, + { "SteelBlue", etk::color::steelBlue}, + { "Tan", etk::color::tan}, + { "Teal", etk::color::teal}, + { "Thistle", etk::color::thistle}, + { "Tomato", etk::color::tomato}, + { "Turquoise", etk::color::turquoise}, + { "Violet", etk::color::violet}, + { "Wheat", etk::color::wheat}, + { "White", etk::color::white}, + { "WhiteSmoke", etk::color::whiteSmoke}, + { "Yellow", etk::color::yellow}, + { "YellowGreen", etk::color::yellowGreen} }; static const int32_t listOfColorSize = sizeof(listOfColor) / sizeof(colorList_ts); -static bool strnCmpNoCase(const char * input1, const char * input2, int32_t maxLen) +etk::Color::Color(void) { - int32_t iii=0; - while ('\0' != *input1 && '\0' != *input2 && iii < maxLen) { - char in1 = *input1; - char in2 = *input2; - if (in1 != in2) { - if (in1 <= 'Z' && in1 >= 'A') { - in1 = in1 - 'A' + 'a'; - } - if (in2 <= 'Z' && in2 >= 'A') { - in2 = in2 - 'A' + 'a'; - } - if (in1 != in2) { - return false; - } - } - iii++; - input1++; - input2++; - } - return true; + red = 0xFF; + green = 0xFF; + blue = 0xFF; + alpha = 0xFF; } -/** - * @brief Parse a color specification from the svg file - * @param[in] inputData Data C String with the xml definition - * @return the parsed color - */ -color_ts etk::color::Parse(const char *inputData) +etk::Color::Color(const uint32_t _input) { - color_ts localColor = etk::color::color_White; + red = (uint8_t)((_input&0xFF000000)>>24); + green = (uint8_t)((_input&0x00FF0000)>>16); + blue = (uint8_t)((_input&0x0000FF00)>>8); + alpha = (uint8_t)((_input&0x000000FF)); +} + +uint32_t etk::Color::Get(void) const +{ + uint32_t directData = red<<24; + directData += green<<16; + directData += blue<<8; + directData += alpha; + return directData; +}; + + +etk::Color::Color(const etk::Color& data) +{ + if( this != &data ) { + red = data.red; + green = data.green; + blue = data.blue; + alpha = data.alpha; + } +} + + + +etk::Color::Color(float _red, float _green, float _blue, float _alpha) +{ + _red = etk_avg(0.0, _red, 1.0); + _green = etk_avg(0.0, _green, 1.0); + _blue = etk_avg(0.0, _blue, 1.0); + _alpha = etk_avg(0.0, _alpha, 1.0); + red = (uint8_t)(_red*256.0); + green = (uint8_t)(_green*256.0); + blue = (uint8_t)(_blue*256.0); + alpha = (uint8_t)(_alpha*256.0); +} + + +etk::Color::Color(uint8_t _red, uint8_t _green, uint8_t _blue, uint8_t _alpha) +{ + red = _red; + green = _green; + blue = _blue; + alpha = _alpha; +} + + +etk::Color::Color(const char * _input) +{ + etk::UString tmpVal = _input; + Set(tmpVal); +} +etk::Color::Color(etk::UString _input) +{ + Set(_input); +} + +void etk::Color::Set(etk::UString _input) +{ + const char * inputData = _input.c_str(); - uint32_t red, green, blue, alpha; + *this = etk::color::white; + + uint32_t _red, _green, _blue, _alpha; float fred, fgreen, fblue, falpha; size_t len = strlen(inputData); @@ -376,35 +420,35 @@ color_ts etk::color::Parse(const char *inputData) && inputData[0] == '#') { if(len == 4) { if (sscanf(inputData + 1, "%1x%1x%1x", &red, &green, &blue) == 3) { - localColor.red = (red | red << 4); - localColor.green= (green | green << 4); - localColor.blue = (blue | blue << 4); + red = (red | red << 4); + green= (green | green << 4); + blue = (blue | blue << 4); } else { TK_ERROR(" pb in parsing the color : \"" << inputData << "\""); } } else if (len==5) { - if (sscanf(inputData + 1, "%1x%1x%1x%1x", &red, &green, &blue, &alpha) == 4) { - localColor.red = (red | red << 4); - localColor.green = (green | green << 4); - localColor.blue = (blue | blue << 4); - localColor.alpha = (alpha | alpha << 4); + if (sscanf(inputData + 1, "%1x%1x%1x%1x", &_red, &_green, &_blue, &_alpha) == 4) { + red = (_red | _red << 4); + green = (_green | _green << 4); + blue = (_blue | _blue << 4); + alpha = (_alpha | _alpha << 4); } else { TK_ERROR(" pb in parsing the color : \"" << inputData << "\""); } } else if (len == 7) { - if (sscanf(inputData + 1, "%2x%2x%2x", &red, &green, &blue) == 3) { - localColor.red = red; - localColor.green= green; - localColor.blue = blue; + if (sscanf(inputData + 1, "%2x%2x%2x", &_red, &_green, &_blue) == 3) { + red = _red; + green= _green; + blue = _blue; } else { TK_ERROR(" pb in parsing the color : \"" << inputData << "\""); } } else if (len == 9) { - if (sscanf(inputData + 1, "%2x%2x%2x%2x", &red, &green, &blue, &alpha) == 4) { - localColor.red = red; - localColor.green= green; - localColor.blue = blue; - localColor.alpha = alpha; + if (sscanf(inputData + 1, "%2x%2x%2x%2x", &_red, &_green, &_blue, &_alpha) == 4) { + red = _red; + green= _green; + blue = _blue; + alpha = _alpha; } else { TK_ERROR(" pb in parsing the color : \"" << inputData << "\""); } @@ -416,31 +460,31 @@ color_ts etk::color::Parse(const char *inputData) && inputData[1] == 'g' && inputData[2] == 'b' && inputData[3] == '(' ) { - if (sscanf(inputData + 4, "%u,%u,%u,%u", &red, &green, &blue, &alpha) == 4) { - localColor.red = etk_min(0xFF, red); - localColor.green= etk_min(0xFF, green); - localColor.blue = etk_min(0xFF, blue); - localColor.alpha = etk_min(0xFF, alpha); - } else if (sscanf(inputData + 4, "%u,%u,%u", &red, &green, &blue) == 3) { - localColor.red = etk_min(0xFF, red); - localColor.green= etk_min(0xFF, green); - localColor.blue = etk_min(0xFF, blue); + if (sscanf(inputData + 4, "%u,%u,%u,%u", &_red, &_green, &_blue, &_alpha) == 4) { + red = etk_min(0xFF, _red); + green= etk_min(0xFF, _green); + blue = etk_min(0xFF, _blue); + alpha = etk_min(0xFF, _alpha); + } else if (sscanf(inputData + 4, "%u,%u,%u", &_red, &_green, &_blue) == 3) { + red = etk_min(0xFF, _red); + green= etk_min(0xFF, _green); + blue = etk_min(0xFF, _blue); } else if (sscanf(inputData + 4, "%f%%,%f%%,%f%%,%f%%", &fred, &fgreen, &fblue, &falpha) == 4) { fred = etk_avg(0.0, fred, 1.0); fgreen= etk_avg(0.0, fgreen, 1.0); fblue = etk_avg(0.0, fblue, 1.0); falpha = etk_avg(0.0, falpha, 1.0); - localColor.red = (uint8_t)(fred * 255.); - localColor.green= (uint8_t)(fgreen * 255.); - localColor.blue = (uint8_t)(fblue * 255.); - localColor.alpha = (uint8_t)(falpha * 255.); + red = (uint8_t)(fred * 255.); + green= (uint8_t)(fgreen * 255.); + blue = (uint8_t)(fblue * 255.); + alpha = (uint8_t)(falpha * 255.); } else if (sscanf(inputData + 4, "%f%%,%f%%,%f%%", &fred, &fgreen, &fblue) == 3) { fred = etk_avg(0.0, fred, 1.0); fgreen= etk_avg(0.0, fgreen, 1.0); fblue = etk_avg(0.0, fblue, 1.0); - localColor.red = (uint8_t)(fred * 255.); - localColor.green= (uint8_t)(fgreen * 255.); - localColor.blue = (uint8_t)(fblue * 255.); + red = (uint8_t)(fred * 255.); + green= (uint8_t)(fgreen * 255.); + blue = (uint8_t)(fblue * 255.); } else { TK_ERROR(" pb in parsing the color : \"" << inputData << "\" ==> unknown methode ..."); } @@ -448,9 +492,9 @@ color_ts etk::color::Parse(const char *inputData) bool findIt = false; // direct named color ... for (int32_t iii=0; iii " << localColor); - return localColor; + TK_VERBOSE("Parse color : \"" << inputData << "\" ==> " << *this); } - -color_ts etk::color::Create(uint32_t val) +etk::CCout& etk::operator <<(etk::CCout &os, const etk::Color &obj) { - color_ts tmpColor; - tmpColor.red=(uint8_t)((val>>24)&0xFF); - tmpColor.green=(uint8_t)((val>>16)&0xFF); - tmpColor.blue=(uint8_t)((val>>8)&0xFF); - tmpColor.alpha=(uint8_t)((val)&0xFF); - return tmpColor; + char tmpData[256]; + snprintf(tmpData, 256, "#%02X%02X%02X%02X", obj.red, obj.green, obj.blue, obj.alpha); + os << tmpData; + return os; } -color_ts etk::color::Create(uint8_t _red, uint8_t _green, uint8_t _blue, uint8_t _alpha) +etk::Color& etk::Color::operator= (const etk::Color &_input ) { - color_ts tmpColor; - tmpColor.red =_red; - tmpColor.green=_green; - tmpColor.blue =_blue; - tmpColor.alpha=_alpha; - return tmpColor; + //TK_INFO("OPERATOR de recopie"); + if( this != &_input ) { + red = _input.red; + green = _input.green; + blue = _input.blue; + alpha = _input.alpha; + } + return *this; } -color_ts etk::color::Create(float _red, float _green, float _blue, float _alpha) + +etk::Color& etk::Color::operator= (const uint32_t _input ) { - color_ts tmpColor; - _red = etk_avg((float)0, (float)_red, (float)1); - _green = etk_avg((float)0, (float)_green, (float)1); - _blue = etk_avg((float)0, (float)_blue, (float)1); - _alpha = etk_avg((float)0, (float)_alpha, (float)1); - tmpColor.red =(uint8_t)(_red*255); - tmpColor.green=(uint8_t)(_green*255); - tmpColor.blue =(uint8_t)(_blue*255); - tmpColor.alpha=(uint8_t)(_alpha*255); - return tmpColor; + red = (uint8_t)((_input&0xFF000000)>>24); + green = (uint8_t)((_input&0x00FF0000)>>16); + blue = (uint8_t)((_input&0x0000FF00)>>8); + alpha = (uint8_t)((_input&0x000000FF)); + return *this; +} + +bool etk::Color::operator==(const Color& _input) const +{ + if( red != _input.red + || green != _input.green + || blue != _input.blue + || alpha != _input.alpha ) { + return false; + } + return true; +} + +bool etk::Color::operator!=(const Color& _input) const +{ + if( red != _input.red + || green != _input.green + || blue != _input.blue + || alpha != _input.alpha ) { + return true; + } + return false; } diff --git a/Sources/libetk/etk/Color.h b/Sources/libetk/etk/Color.h index f5b052c2..88473dbd 100644 --- a/Sources/libetk/etk/Color.h +++ b/Sources/libetk/etk/Color.h @@ -25,165 +25,195 @@ #ifndef __ETK_COLOR_H__ #define __ETK_COLOR_H__ +#include + +#ifndef __ETK_USTRING_H__ + namespace etk { + class UString; + }; +#endif + namespace etk { + + class Color { + public: + uint8_t red; + uint8_t green; + uint8_t blue; + uint8_t alpha; + // constructor : + Color(void); + Color(const etk::Color& data); + Color(const uint32_t data); + Color(uint8_t _red, uint8_t _green, uint8_t _blue, uint8_t _alpha = 255); + Color(float _red, float _green, float _blue, float _alpha = 1.0); + Color(etk::UString data); + Color(const char * data); + // operator : + etk::Color& operator=(const uint32_t _input); + etk::Color& operator=(const etk::Color& _input); + bool operator==(const etk::Color& _input) const; + bool operator!=(const etk::Color& _input) const; + // access : + void Set(etk::UString _input); + uint32_t Get(void) const; + /***************************************************** + * Cout << operator + *****************************************************/ + friend etk::CCout& operator <<( etk::CCout &os,const etk::Color &obj); + }; + + etk::CCout& operator <<(etk::CCout &os, const etk::Color &obj); + namespace color { - extern const color_ts color_none; - extern const color_ts color_AliceBlue; - extern const color_ts color_AntiqueWhite; - extern const color_ts color_Aqua; - extern const color_ts color_Aquamarine; - extern const color_ts color_Azure; - extern const color_ts color_Beige; - extern const color_ts color_Bisque; - extern const color_ts color_Black; - extern const color_ts color_BlanchedAlmond; - extern const color_ts color_Blue; - extern const color_ts color_BlueViolet; - extern const color_ts color_Brown; - extern const color_ts color_BurlyWood; - extern const color_ts color_CadetBlue; - extern const color_ts color_Chartreuse; - extern const color_ts color_Chocolate; - extern const color_ts color_Coral; - extern const color_ts color_CornflowerBlue; - extern const color_ts color_Cornsilk; - extern const color_ts color_Crimson; - extern const color_ts color_Cyan; - extern const color_ts color_DarkBlue; - extern const color_ts color_DarkCyan; - extern const color_ts color_DarkGoldenRod; - extern const color_ts color_DarkGray; - extern const color_ts color_DarkGrey; - extern const color_ts color_DarkGreen; - extern const color_ts color_DarkKhaki; - extern const color_ts color_DarkMagenta; - extern const color_ts color_DarkOliveGreen; - extern const color_ts color_Darkorange; - extern const color_ts color_DarkOrchid; - extern const color_ts color_DarkRed; - extern const color_ts color_DarkSalmon; - extern const color_ts color_DarkSeaGreen; - extern const color_ts color_DarkSlateBlue; - extern const color_ts color_DarkSlateGray; - extern const color_ts color_DarkSlateGrey; - extern const color_ts color_DarkTurquoise; - extern const color_ts color_DarkViolet; - extern const color_ts color_DeepPink; - extern const color_ts color_DeepSkyBlue; - extern const color_ts color_DimGray; - extern const color_ts color_DimGrey; - extern const color_ts color_DodgerBlue; - extern const color_ts color_FireBrick; - extern const color_ts color_FloralWhite; - extern const color_ts color_ForestGreen; - extern const color_ts color_Fuchsia; - extern const color_ts color_Gainsboro; - extern const color_ts color_GhostWhite; - extern const color_ts color_Gold; - extern const color_ts color_GoldenRod; - extern const color_ts color_Gray; - extern const color_ts color_Grey; - extern const color_ts color_Green; - extern const color_ts color_GreenYellow; - extern const color_ts color_HoneyDew; - extern const color_ts color_HotPink; - extern const color_ts color_IndianRed; - extern const color_ts color_Indigo; - extern const color_ts color_Ivory; - extern const color_ts color_Khaki; - extern const color_ts color_Lavender; - extern const color_ts color_LavenderBlush; - extern const color_ts color_LawnGreen; - extern const color_ts color_LemonChiffon; - extern const color_ts color_LightBlue; - extern const color_ts color_LightCoral; - extern const color_ts color_LightCyan; - extern const color_ts color_LightGoldenRodYellow; - extern const color_ts color_LightGray; - extern const color_ts color_LightGrey; - extern const color_ts color_LightGreen; - extern const color_ts color_LightPink; - extern const color_ts color_LightSalmon; - extern const color_ts color_LightSeaGreen; - extern const color_ts color_LightSkyBlue; - extern const color_ts color_LightSlateGray; - extern const color_ts color_LightSlateGrey; - extern const color_ts color_LightSteelBlue; - extern const color_ts color_LightYellow; - extern const color_ts color_Lime; - extern const color_ts color_LimeGreen; - extern const color_ts color_Linen; - extern const color_ts color_Magenta; - extern const color_ts color_Maroon; - extern const color_ts color_MediumAquaMarine; - extern const color_ts color_MediumBlue; - extern const color_ts color_MediumOrchid; - extern const color_ts color_MediumPurple; - extern const color_ts color_MediumSeaGreen; - extern const color_ts color_MediumSlateBlue; - extern const color_ts color_MediumSpringGreen; - extern const color_ts color_MediumTurquoise; - extern const color_ts color_MediumVioletRed; - extern const color_ts color_MidnightBlue; - extern const color_ts color_MintCream; - extern const color_ts color_MistyRose; - extern const color_ts color_Moccasin; - extern const color_ts color_NavajoWhite; - extern const color_ts color_Navy; - extern const color_ts color_OldLace; - extern const color_ts color_Olive; - extern const color_ts color_OliveDrab; - extern const color_ts color_Orange; - extern const color_ts color_OrangeRed; - extern const color_ts color_Orchid; - extern const color_ts color_PaleGoldenRod; - extern const color_ts color_PaleGreen; - extern const color_ts color_PaleTurquoise; - extern const color_ts color_PaleVioletRed; - extern const color_ts color_PapayaWhip; - extern const color_ts color_PeachPuff; - extern const color_ts color_Peru; - extern const color_ts color_Pink; - extern const color_ts color_Plum; - extern const color_ts color_PowderBlue; - extern const color_ts color_Purple; - extern const color_ts color_Red; - extern const color_ts color_RosyBrown; - extern const color_ts color_RoyalBlue; - extern const color_ts color_SaddleBrown; - extern const color_ts color_Salmon; - extern const color_ts color_SandyBrown; - extern const color_ts color_SeaGreen; - extern const color_ts color_SeaShell; - extern const color_ts color_Sienna; - extern const color_ts color_Silver; - extern const color_ts color_SkyBlue; - extern const color_ts color_SlateBlue; - extern const color_ts color_SlateGray; - extern const color_ts color_SlateGrey; - extern const color_ts color_Snow; - extern const color_ts color_SpringGreen; - extern const color_ts color_SteelBlue; - extern const color_ts color_Tan; - extern const color_ts color_Teal; - extern const color_ts color_Thistle; - extern const color_ts color_Tomato; - extern const color_ts color_Turquoise; - extern const color_ts color_Violet; - extern const color_ts color_Wheat; - extern const color_ts color_White; - extern const color_ts color_WhiteSmoke; - extern const color_ts color_Yellow; - extern const color_ts color_YellowGreen; - - - color_ts Parse(const char *inputData); - - color_ts Create(uint32_t val); - - color_ts Create( uint8_t _red, uint8_t _green, uint8_t _blue, uint8_t _alpha=255); - - color_ts Create(float _red, float _green, float _blue, float _alpha=1.0); + extern const Color none; + extern const Color aliceBlue; + extern const Color antiqueWhite; + extern const Color aqua; + extern const Color aquamarine; + extern const Color azure; + extern const Color beige; + extern const Color bisque; + extern const Color black; + extern const Color blanchedAlmond; + extern const Color blue; + extern const Color blueViolet; + extern const Color brown; + extern const Color burlyWood; + extern const Color cadetBlue; + extern const Color chartreuse; + extern const Color chocolate; + extern const Color coral; + extern const Color cornflowerBlue; + extern const Color cornsilk; + extern const Color crimson; + extern const Color cyan; + extern const Color darkBlue; + extern const Color darkCyan; + extern const Color darkGoldenRod; + extern const Color darkGray; + extern const Color darkGrey; + extern const Color darkGreen; + extern const Color darkKhaki; + extern const Color darkMagenta; + extern const Color darkOliveGreen; + extern const Color darkorange; + extern const Color darkOrchid; + extern const Color darkRed; + extern const Color darkSalmon; + extern const Color darkSeaGreen; + extern const Color darkSlateBlue; + extern const Color darkSlateGray; + extern const Color darkSlateGrey; + extern const Color darkTurquoise; + extern const Color darkViolet; + extern const Color deepPink; + extern const Color deepSkyBlue; + extern const Color dimGray; + extern const Color dimGrey; + extern const Color dodgerBlue; + extern const Color fireBrick; + extern const Color floralWhite; + extern const Color forestGreen; + extern const Color fuchsia; + extern const Color gainsboro; + extern const Color ghostWhite; + extern const Color gold; + extern const Color goldenRod; + extern const Color gray; + extern const Color grey; + extern const Color green; + extern const Color greenYellow; + extern const Color honeyDew; + extern const Color hotPink; + extern const Color indianRed; + extern const Color indigo; + extern const Color ivory; + extern const Color khaki; + extern const Color lavender; + extern const Color lavenderBlush; + extern const Color lawnGreen; + extern const Color lemonChiffon; + extern const Color lightBlue; + extern const Color lightCoral; + extern const Color lightCyan; + extern const Color lightGoldenRodYellow; + extern const Color lightGray; + extern const Color lightGrey; + extern const Color lightGreen; + extern const Color lightPink; + extern const Color lightSalmon; + extern const Color lightSeaGreen; + extern const Color lightSkyBlue; + extern const Color lightSlateGray; + extern const Color lightSlateGrey; + extern const Color lightSteelBlue; + extern const Color lightYellow; + extern const Color lime; + extern const Color limeGreen; + extern const Color linen; + extern const Color magenta; + extern const Color maroon; + extern const Color mediumAquaMarine; + extern const Color mediumBlue; + extern const Color mediumOrchid; + extern const Color mediumPurple; + extern const Color mediumSeaGreen; + extern const Color mediumSlateBlue; + extern const Color mediumSpringGreen; + extern const Color mediumTurquoise; + extern const Color mediumVioletRed; + extern const Color midnightBlue; + extern const Color mintCream; + extern const Color mistyRose; + extern const Color moccasin; + extern const Color navajoWhite; + extern const Color navy; + extern const Color oldLace; + extern const Color olive; + extern const Color oliveDrab; + extern const Color orange; + extern const Color orangeRed; + extern const Color orchid; + extern const Color paleGoldenRod; + extern const Color paleGreen; + extern const Color paleTurquoise; + extern const Color paleVioletRed; + extern const Color papayaWhip; + extern const Color peachPuff; + extern const Color peru; + extern const Color pink; + extern const Color plum; + extern const Color powderBlue; + extern const Color purple; + extern const Color red; + extern const Color rosyBrown; + extern const Color royalBlue; + extern const Color saddleBrown; + extern const Color salmon; + extern const Color sandyBrown; + extern const Color seaGreen; + extern const Color seaShell; + extern const Color sienna; + extern const Color silver; + extern const Color skyBlue; + extern const Color slateBlue; + extern const Color slateGray; + extern const Color slateGrey; + extern const Color snow; + extern const Color springGreen; + extern const Color steelBlue; + extern const Color tan; + extern const Color teal; + extern const Color thistle; + extern const Color tomato; + extern const Color turquoise; + extern const Color violet; + extern const Color wheat; + extern const Color white; + extern const Color whiteSmoke; + extern const Color yellow; + extern const Color yellowGreen; }; }; diff --git a/Sources/libetk/etk/File.cpp b/Sources/libetk/etk/File.cpp index 38190b9a..11d07ef3 100644 --- a/Sources/libetk/etk/File.cpp +++ b/Sources/libetk/etk/File.cpp @@ -56,7 +56,7 @@ etk::UString baseApplName = "ewolNoName"; static void loadAPK(etk::UString& apkPath) { TK_DEBUG("Loading APK \"" << apkPath << "\""); - s_APKArchive = zip_open(apkPath.Utf8Data(), 0, NULL); + s_APKArchive = zip_open(apkPath.c_str(), 0, NULL); TK_ASSERT(s_APKArchive != NULL, "Error loading APK ... \"" << apkPath << "\""); //Just for debug, print APK contents s_APKnbFiles = zip_get_num_files(s_APKArchive); @@ -399,7 +399,7 @@ void etk::File::SetCompleateName(etk::UString &newFilename, etk::FileType_te typ TK_VERBOSE("3 : Get file Name : " << destFilename ); if (true == needUnpack) { // Get the real Path of the current File - ok = realpath(destFilename.Utf8Data(), buf); + ok = realpath(destFilename.c_str(), buf); if (!ok) { int32_t lastPos = destFilename.FindBack('/'); if (-1 != lastPos) { @@ -407,7 +407,7 @@ void etk::File::SetCompleateName(etk::UString &newFilename, etk::FileType_te typ etk::UString tmpFilename = destFilename.Extract(lastPos+1); destFilename.Remove(lastPos, destFilename.Size() - lastPos); TK_VERBOSE("try to find :\"" << destFilename << "\" / \"" << tmpFilename << "\" "); - ok = realpath(destFilename.Utf8Data(), buf); + ok = realpath(destFilename.c_str(), buf); if (!ok) { TK_VERBOSE("Can not find real Path name of \"" << destFilename << "\""); m_shortFilename = tmpFilename; @@ -562,7 +562,7 @@ int32_t etk::File::Size(void) break; } myCompleateName += GetCompleateName(); - myFile=fopen(myCompleateName.Utf8Data(),"rb"); + myFile=fopen(myCompleateName.c_str(),"rb"); if(NULL == myFile) { //EWOL_ERROR("Can not find the file name=\"" << m_folder << "\" / \"" << m_shortFilename << "\""); return -1; @@ -604,9 +604,9 @@ bool etk::File::Exist(void) break; } myCompleateName += GetCompleateName(); - myFile=fopen(myCompleateName.Utf8Data(),"rb"); + myFile=fopen(myCompleateName.c_str(),"rb"); if(NULL == myFile) { - TK_DEBUG("try to open : " << myCompleateName.Utf8Data()); + TK_DEBUG("try to open : " << myCompleateName.c_str()); return false; } fclose(myFile); @@ -643,7 +643,7 @@ bool etk::File::fOpenRead(void) break; } myCompleateName += GetCompleateName(); - m_PointerFile=fopen(myCompleateName.Utf8Data(),"rb"); + m_PointerFile=fopen(myCompleateName.c_str(),"rb"); if(NULL == m_PointerFile) { TK_ERROR("Can not find the file name=\"" << GetCompleateName() << "\""); return false; @@ -679,7 +679,7 @@ bool etk::File::fOpenWrite(void) break; } myCompleateName += GetCompleateName(); - m_PointerFile=fopen(myCompleateName.Utf8Data(),"wb"); + m_PointerFile=fopen(myCompleateName.c_str(),"wb"); if(NULL == m_PointerFile) { TK_ERROR("Can not find the file name=\"" << GetCompleateName() << "\""); return false; diff --git a/Sources/libetk/etk/RegExp.cpp b/Sources/libetk/etk/RegExp.cpp index bcf3ca0a..d33c0b02 100644 --- a/Sources/libetk/etk/RegExp.cpp +++ b/Sources/libetk/etk/RegExp.cpp @@ -88,7 +88,7 @@ const int32_t etk::constConvertionTableSize = sizeof(etk::constConvertionTable) * @return --- * */ -void etk::DisplayData(etk::VectorType &data) +void etk::DisplayData(etk::Vector &data) { int32_t i; for (i=0; i<(int32_t)data.Size() ; i++) { @@ -106,7 +106,7 @@ void etk::DisplayData(etk::VectorType &data) * @return --- * */ -void etk::DisplayElem(etk::VectorType &data, int32_t start, int32_t stop) +void etk::DisplayElem(etk::Vector &data, int32_t start, int32_t stop) { int32_t i; etk::cout<< ETK_BASH_COLOR_NORMAL; @@ -176,7 +176,7 @@ char * etk::levelSpace(int32_t level) * @return --- * */ -int32_t etk::GetLenOfPTheseElem(etk::VectorType &data, int32_t startPos) +int32_t etk::GetLenOfPTheseElem(etk::Vector &data, int32_t startPos) { int32_t pos = startPos; int32_t nbOpen = 0; @@ -225,7 +225,7 @@ int32_t etk::GetLenOfPTheseElem(etk::VectorType &data, int32_t startPos * @return --- * */ -int32_t etk::GetLenOfPThese(etk::VectorType &data, int32_t startPos) +int32_t etk::GetLenOfPThese(etk::Vector &data, int32_t startPos) { int32_t pos = startPos; int32_t nbOpen = 0; @@ -278,7 +278,7 @@ int32_t etk::GetLenOfPThese(etk::VectorType &data, int32_t startPos) * @return --- * */ -int32_t etk::GetLenOfBracket(etk::VectorType &data, int32_t startPos) +int32_t etk::GetLenOfBracket(etk::Vector &data, int32_t startPos) { int32_t pos = startPos; // special case of the (...) or | ==> we search '|' or ')' @@ -322,7 +322,7 @@ int32_t etk::GetLenOfBracket(etk::VectorType &data, int32_t startPos) * @return --- * */ -int32_t etk::GetLenOfBrace(etk::VectorType &data, int32_t startPos) +int32_t etk::GetLenOfBrace(etk::Vector &data, int32_t startPos) { int32_t pos = startPos; // special case of the (...) or | ==> we search '|' or ')' @@ -366,7 +366,7 @@ int32_t etk::GetLenOfBrace(etk::VectorType &data, int32_t startPos) * @return --- * */ -int32_t etk::GetLenOfNormal(etk::VectorType &data, int32_t startPos) +int32_t etk::GetLenOfNormal(etk::Vector &data, int32_t startPos) { int32_t pos = startPos; @@ -423,7 +423,7 @@ int32_t etk::GetLenOfNormal(etk::VectorType &data, int32_t startPos) * @return --- * */ -bool etk::ParseBrace(etk::VectorType &data, int32_t &min, int32_t &max) +bool etk::ParseBrace(etk::Vector &data, int32_t &min, int32_t &max) { //TK_INFO("parse {...} in "; DisplayElem(data); ); int32_t k=0; diff --git a/Sources/libetk/etk/RegExp.h b/Sources/libetk/etk/RegExp.h index e4cf0dca..fc15c4e0 100644 --- a/Sources/libetk/etk/RegExp.h +++ b/Sources/libetk/etk/RegExp.h @@ -29,7 +29,7 @@ #include #include #include -#include +#include namespace etk { @@ -94,15 +94,15 @@ typedef struct { extern const convertionTable_ts constConvertionTable[]; extern const int32_t constConvertionTableSize; -void DisplayData(etk::VectorType &data); -void DisplayElem(etk::VectorType &data, int32_t start=0, int32_t stop=0x7FFFFFFF); +void DisplayData(etk::Vector &data); +void DisplayElem(etk::Vector &data, int32_t start=0, int32_t stop=0x7FFFFFFF); char * levelSpace(int32_t level); -int32_t GetLenOfPTheseElem(etk::VectorType &data, int32_t startPos); -int32_t GetLenOfPThese(etk::VectorType &data, int32_t startPos); -int32_t GetLenOfBracket(etk::VectorType &data, int32_t startPos); -int32_t GetLenOfBrace(etk::VectorType &data, int32_t startPos); -int32_t GetLenOfNormal(etk::VectorType &data, int32_t startPos); -bool ParseBrace(etk::VectorType &data, int32_t &min, int32_t &max); +int32_t GetLenOfPTheseElem(etk::Vector &data, int32_t startPos); +int32_t GetLenOfPThese(etk::Vector &data, int32_t startPos); +int32_t GetLenOfBracket(etk::Vector &data, int32_t startPos); +int32_t GetLenOfBrace(etk::Vector &data, int32_t startPos); +int32_t GetLenOfNormal(etk::Vector &data, int32_t startPos); +bool ParseBrace(etk::Vector &data, int32_t &min, int32_t &max); #undef __class__ @@ -139,7 +139,7 @@ template class RegExpNode{ * @param[in,out] * @return */ - virtual int32_t Generate(etk::VectorType &data) + virtual int32_t Generate(etk::Vector &data) { return 0; }; @@ -199,7 +199,7 @@ template class RegExpNode{ int32_t m_multipleMin; //!< minimum repetition (included) int32_t m_multipleMax; //!< maximum repetition (included) // Data Section ... (can have no data...) - etk::VectorType m_RegExpData; //!< data to parse and compare in some case ... + etk::Vector m_RegExpData; //!< data to parse and compare in some case ... }; #undef __class__ @@ -233,7 +233,7 @@ template class RegExpNodeValue : public RegExpNode * @param[in,out] * @return */ - int32_t Generate(etk::VectorType &data) + int32_t Generate(etk::Vector &data) { RegExpNode::m_RegExpData = data; //TK_DEBUG("Request Parse \"Value\" data="; DisplayElem(RegExpNode::m_RegExpData);); @@ -303,7 +303,7 @@ template class RegExpNodeValue : public RegExpNode }; protected : // SubNodes : - etk::VectorType m_data; + etk::Vector m_data; }; #undef __class__ #define __class__ "etk::RegExpNodeBracket" @@ -336,7 +336,7 @@ template class RegExpNodeBracket : public RegExpNode &data) + int32_t Generate(etk::Vector &data) { RegExpNode::m_RegExpData = data; //TK_DEBUG("Request Parse [...] data="; DisplayElem(RegExpNode::m_RegExpData);); @@ -421,7 +421,7 @@ template class RegExpNodeBracket : public RegExpNode m_data; + etk::Vector m_data; }; #undef __class__ #define __class__ "etk::RegExpNodeDigit" @@ -1211,14 +1211,14 @@ template class RegExpNodePTheseElem : public RegExpNode &data) + int32_t Generate(etk::Vector &data) { RegExpNode::m_RegExpData = data; //TK_DEBUG("Request Parse (elem) data="; DisplayElem(RegExpNode::m_RegExpData);); int32_t pos = 0; int32_t elementSize = 0; - etk::VectorType tmpData; + etk::Vector tmpData; while (pos < RegExpNode::m_RegExpData.Size()) { tmpData.Clear(); switch (RegExpNode::m_RegExpData[pos]) @@ -1404,7 +1404,7 @@ template class RegExpNodePTheseElem : public RegExpNode*> m_subNode; + etk::Vector*> m_subNode; private : /** * @brief Set the number of repeate time on a the last node in the list ... @@ -1461,7 +1461,7 @@ template class RegExpNodePThese : public RegExpNode &data) + int32_t Generate(etk::Vector &data) { RegExpNode::m_RegExpData = data; //TK_DEBUG("Request Parse (...) data="; DisplayElem(RegExpNode::m_RegExpData);); @@ -1471,7 +1471,7 @@ template class RegExpNodePThese : public RegExpNode0) { // geerate output deta ... - etk::VectorType tmpData; + etk::Vector tmpData; for (int32_t k=pos; k::m_RegExpData[k]); } @@ -1547,7 +1547,7 @@ template class RegExpNodePThese : public RegExpNode*> m_subNode; + etk::Vector*> m_subNode; //int32_t m_posPthese; //!< position of the element is detected in the output element }; #undef __class__ @@ -1634,7 +1634,7 @@ template class RegExp { void SetRegExp(etk::UString &expressionRequested) { m_expressionRequested = expressionRequested; // TODO : Must be deprecated ... - etk::VectorType tmpExp; + etk::Vector tmpExp; //TK_DEBUG("Parse RegExp : " << expressionRequested.c_str() ); m_isOk = false; @@ -1644,7 +1644,7 @@ template class RegExp { m_notEndWithChar = false; // TODO : Check this ... ==> could create some errors ... - char * exp = expressionRequested.Utf8Data(); + char * exp = expressionRequested.c_str(); int32_t regExpLen = strlen(exp); // change in the regular Opcode ==> replace \x with the corect element ... x if needed int32_t iii; @@ -1977,7 +1977,7 @@ template class RegExp { * @param[in,out] * @return */ - bool CheckGoodPosition(etk::VectorType tmpExp, int32_t &pos) + bool CheckGoodPosition(etk::Vector tmpExp, int32_t &pos) { int16_t curentCode = tmpExp[pos]; int16_t endCode = REGEXP_OPCODE_PTHESE_OUT; @@ -2083,7 +2083,7 @@ template class RegExp { * @param[in,out] * @return */ - bool CheckGoodPosition(etk::VectorType tmpExp) + bool CheckGoodPosition(etk::Vector tmpExp) { int32_t pos = 0; while (pos < (int32_t)tmpExp.Size()) { diff --git a/Sources/libetk/etk/Stream.h b/Sources/libetk/etk/Stream.h index 159b6586..acb533f7 100644 --- a/Sources/libetk/etk/Stream.h +++ b/Sources/libetk/etk/Stream.h @@ -187,11 +187,6 @@ namespace etk{ strncat(m_tmpChar, tmp, MAX_LOG_SIZE); return *this; } - CCout& operator << (color_ts t) { - snprintf(tmp, MAX_LOG_SIZE_TMP, "#%02X%02X%02X%02X", t.red, t.green, t.blue, t.alpha); - strncat(m_tmpChar, tmp, MAX_LOG_SIZE); - return *this; - } CCout& operator << (clipping_ts t) { snprintf(tmp, MAX_LOG_SIZE_TMP, "origin=(%f,%f) size=(%f,%f)", t.x, t.y, t.w, t.h); strncat(m_tmpChar, tmp, MAX_LOG_SIZE); diff --git a/Sources/libetk/etk/Types.h b/Sources/libetk/etk/Types.h index 30957b38..9487c14f 100644 --- a/Sources/libetk/etk/Types.h +++ b/Sources/libetk/etk/Types.h @@ -68,8 +68,6 @@ typedef enum { #define etk_max(elemA, elemB) (((elemA)<(elemB)) ? (elemB) : (elemA)) #define etk_avg(minimim, elem, maximum) (((minimim)>(elem)) ? (minimim) : ((maximum)<(elem)) ? (maximum) : (elem)) -#include - typedef struct { float u; float v; @@ -82,38 +80,6 @@ typedef struct { float h; }clipping_ts; -typedef struct color_ts { - uint8_t red; - uint8_t green; - uint8_t blue; - uint8_t alpha; - color_ts(void) { - red = 0xFF; - green = 0xFF; - blue = 0xFF; - alpha = 0xFF; - }; - color_ts(uint32_t data) { - red = (uint8_t)((data&0xFF000000)>>24); - green = (uint8_t)((data&0x00FF0000)>>16); - blue = (uint8_t)((data&0x0000FF00)>>8); - alpha = (uint8_t)((data&0x000000FF)); - }; - color_ts(float _red, float _green, float _blue, float _alpha = 1.0) { - _red = etk_avg(0.0, _red, 1.0); - _green = etk_avg(0.0, _green, 1.0); - _blue = etk_avg(0.0, _blue, 1.0); - _alpha = etk_avg(0.0, _alpha, 1.0); - red = (uint8_t)(_red*256.0); - green = (uint8_t)(_green*256.0); - blue = (uint8_t)(_blue*256.0); - alpha = (uint8_t)(_alpha*256.0); - }; -}color_ts; - -#include - - #endif - +#include diff --git a/Sources/libetk/etk/UString.cpp b/Sources/libetk/etk/UString.cpp index ea2e68e4..fe90d24f 100644 --- a/Sources/libetk/etk/UString.cpp +++ b/Sources/libetk/etk/UString.cpp @@ -47,7 +47,7 @@ int32_t strlen(const uniChar_t * data) etk::CCout& etk::operator <<(etk::CCout &os, const etk::UString &obj) { - etk::VectorType output_UTF8; + etk::Vector output_UTF8; unicode::convertUnicodeToUtf8(obj.m_data, output_UTF8); output_UTF8.PushBack('\0'); os << &output_UTF8[0]; @@ -135,7 +135,7 @@ void etk::UString::Set(const char * inputData, int32_t len) len = strlen(inputData); } // convert the string - etk::VectorType tmpChar; + etk::Vector tmpChar; for (int32_t iii=0; iii inputData) +const etk::UString& etk::UString::operator= (etk::Vector inputData) { - etk::VectorType output_Unicode; + etk::Vector output_Unicode; unicode::convertUtf8ToUnicode(inputData, output_Unicode); *this = output_Unicode; return *this; @@ -292,9 +292,9 @@ const etk::UString& etk::UString::operator= (etk::VectorType inputData) * @return * */ -const etk::UString& etk::UString::operator= (etk::VectorType inputData) +const etk::UString& etk::UString::operator= (etk::Vector inputData) { - etk::VectorType output_Unicode; + etk::Vector output_Unicode; unicode::convertUtf8ToUnicode(inputData, output_Unicode); *this = output_Unicode; return *this; @@ -309,7 +309,7 @@ const etk::UString& etk::UString::operator= (etk::VectorType inputData) * @return * */ -const etk::UString& etk::UString::operator= (etk::VectorType inputData) +const etk::UString& etk::UString::operator= (etk::Vector inputData) { m_data = inputData; if (m_data.Size()>0) { @@ -734,9 +734,9 @@ etk::UString etk::UString::Extract(int32_t posStart, int32_t posEnd) * @return The desired vector with data * */ -etk::VectorType etk::UString::GetVector(void) +etk::Vector etk::UString::GetVector(void) { - etk::VectorType out = m_data; + etk::Vector out = m_data; out.PopBack(); return out; } @@ -780,7 +780,7 @@ bool etk::UString::EndWith(const etk::UString& data) } -char * etk::UString::Utf8Data(void) +char * etk::UString::c_str(void) { // UTF8 generation : m_dataUtf8.Clear(); diff --git a/Sources/libetk/etk/UString.h b/Sources/libetk/etk/UString.h index 5839bc50..f5a2a701 100644 --- a/Sources/libetk/etk/UString.h +++ b/Sources/libetk/etk/UString.h @@ -26,7 +26,7 @@ #define __ETK_USTRING_H__ #include -#include +#include namespace etk { @@ -54,9 +54,9 @@ namespace etk * = assigment *****************************************************/ const etk::UString& operator= (const etk::UString &etkS ); - const etk::UString& operator= (etk::VectorType inputData); - const etk::UString& operator= (etk::VectorType inputData); - const etk::UString& operator= (etk::VectorType inputData); + const etk::UString& operator= (etk::Vector inputData); + const etk::UString& operator= (etk::Vector inputData); + const etk::UString& operator= (etk::Vector inputData); /***************************************************** * == operator *****************************************************/ @@ -116,8 +116,8 @@ namespace etk // Find element int32_t FindForward(const char data, int32_t startPos=0); int32_t FindForward(const uniChar_t data, int32_t startPos=0); - int32_t FindBack(const char data, int32_t startPos=0x7FFFFFFF); - int32_t FindBack(const uniChar_t data, int32_t startPos=0x7FFFFFFF); + int32_t FindBack(const char data, int32_t startPos=0x7FFFFFFF); + int32_t FindBack(const uniChar_t data, int32_t startPos=0x7FFFFFFF); bool IsEmpty(void) const; int32_t Size(void) const; @@ -131,17 +131,17 @@ namespace etk void Remove(int32_t currentID, int32_t len); void Clear(void); - etk::VectorType GetVector(void); - uniChar_t * pointer(void) { return &m_data[0]; }; + etk::Vector GetVector(void); + uniChar_t * pointer(void) { return &m_data[0]; }; // generate temporary allocation (auto unallocated...) - char * Utf8Data(void); + char * c_str(void); // Sting operation : etk::UString Extract(int32_t posStart=0, int32_t posEnd=0x7FFFFFFF); private : - etk::VectorType m_data; //!< internal data is stored in the Unicode properties ... - etk::VectorType m_dataUtf8; //!< Tmp data for the Utf8Data() function + etk::Vector m_data; //!< internal data is stored in the Unicode properties ... + etk::Vector m_dataUtf8; //!< Tmp data for the Utf8Data() function }; etk::CCout& operator <<(etk::CCout &os, const etk::UString &obj); diff --git a/Sources/libetk/etk/Vector.h b/Sources/libetk/etk/Vector.h index e6951458..c084ec72 100644 --- a/Sources/libetk/etk/Vector.h +++ b/Sources/libetk/etk/Vector.h @@ -32,288 +32,691 @@ #undef __class__ #define __class__ "etk::Vector" -/** - * @brief etkVector classes ... - * - * @tparam[in] T The type of objects to store. - * @tparam[in] INC Incrementation mode (0 : Exponential to 200 and increment by stemp of 200) - * - * @todo : Need to add : popBack / Assign / Insert / Erase / Swap / Clear - * - * m_data - * ---------- |-----------------------| - * | 0 |-------->| Class Data | - * |--------| |-----------------------| - * | 1 |----| - * |--------| | - * | 2 |====|==============| |-----------------------| - * |--------| | --->| Class Data | - * m_count | 3 |-| | |-----------------------| - * |--------| | | - * | x | | | |-----------------------| - * |--------| | -------->| Class Data | - * | x | | |-----------------------| - * |--------| | - * | x | | - * |--------| | |-----------------------| - * | x | --------------------->| Class Data | - * |--------| |-----------------------| - * | x | - * |--------| - * | x | - * |--------| - * m_size | x | - * ---------- - * - */ + namespace etk { - -template class Vector -{ - public: /** - * @brief + * @brief Vector classes ... * - * @param[in,out] --- + * @tparam[in] SIZE Size of the current element. * - * @return --- + * m_data + * <------------ m_dataSize ------------> + * ---------------------------------------- + * | 0 | + * |--------------------------------------| + * | 1 | + * |--------------------------------------| + * | 2 | + * |--------------------------------------| + * m_size | 3 | + * |--------------------------------------| + * | x | + * |--------------------------------------| + * | x | + * |--------------------------------------| + * | x | + * |--------------------------------------| + * | x | + * |--------------------------------------| + * | x | + * |--------------------------------------| + * | x | + * |--------------------------------------| + * m_allocated | x | + * ---------------------------------------- * */ - Vector(int count = 0): - m_data(NULL), - m_count(0), - m_size(0) + template class Vector { - Resize(count); - } + public: + class Iterator + { + // Private data : + private: + int32_t m_current; //!< curent Id on the vector + Vector * m_vector; //!< Pointer on the curent element of the vectorBin + public: + /** + * @brief Basic itarator constructor with no link with an etkVector + */ + Iterator(): + m_current(-1), + m_vector(NULL) + { + // nothing to do ... + } + /** + * @brief Recopy constructor on a specific etkVector. + * @param[in] otherIterator The Iterator that might be copy + */ + Iterator(const Iterator & otherIterator): + m_current(otherIterator.m_current), + m_vector(otherIterator.m_vector) + { + // nothing to do ... + } + /** + * @brief Asignation operator. + * @param[in] otherIterator The Iterator that might be copy + * @return reference on the curent Iterator + */ + Iterator& operator=(const Iterator & otherIterator) + { + m_current = otherIterator.m_current; + m_vector = otherIterator.m_vector; + return *this; + } + /** + * @brief Basic destructor + */ + ~Iterator() + { + m_current = -1; + m_vector = NULL; + } + /** + * @brief basic boolean cast + * @return true if the element is present in the etkVector size + */ + operator bool () + { + if( 0 <= m_current + && m_current < m_vector->Size() ) + { + return true; + } else { + return false; + } + } + /** + * @brief Incremental operator + * @return Reference on the current iterator incremented + */ + Iterator& operator++ () + { + if( NULL != m_vector + && m_current < m_vector->Size() ) + { + m_current++; + } + return *this; + } + /** + * @brief Decremental operator + * @return Reference on the current iterator decremented + */ + Iterator& operator-- () + { + if (m_current >= 0) { + m_current--; + } + return *this; + } + /** + * @brief Incremental operator + * @return Reference on a new iterator and increment the other one + */ + Iterator operator++ (int32_t) + { + Iterator it(*this); + ++(*this); + return it; + } + /** + * @brief Decremental operator + * @return Reference on a new iterator and decrement the other one + */ + Iterator operator-- (int32_t) + { + Iterator it(*this); + --(*this); + return it; + } + /** + * @brief Get reference on the current Element + * @return the reference on the current Element + */ + MY_TYPE & operator-> () const + { + TK_CHECK_INOUT(m_current >= 0 && m_current < m_vector->Size()); + return &m_vector->Get(m_current); + } + /** + * @brief Get reference on the current Element + * @return the reference on the current Element + */ + MY_TYPE & operator* () const + { + TK_CHECK_INOUT(m_current >= 0 && m_current < m_vector->Size()); + return m_vector->Get(m_current); + } + private: + /** + * @brief + * + * @param[in,out] --- + * + * @return --- + * + */ + Iterator(Vector * Evb, int32_t pos): + m_current(pos), + m_vector(Evb) + { + // nothing to do ... + } + friend class Vector; + }; - /** - * @brief - * - * @param[in,out] --- - * - * @return --- - * - */ - Vector(const etk::Vector & myVector): - m_size(myVector.m_size), - m_count(myVector.m_count), - m_data(NULL) - { - int32_t i; - ETK_MALLOC_CAST(m_data, m_size, T, T*);//reinterpret_cast); - for(i=0; i & Evb) + { + m_allocated = Evb.m_allocated; + m_size = Evb.m_size; + m_increment = Evb.m_increment; + m_data = NULL; + //TK_DEBUG("USE Specific vector allocator ... Evb.m_size=" << Evb.m_size << " Evb.m_increment=" << Evb.m_increment); + // allocate all same data + ETK_MALLOC(m_data, m_allocated, MY_TYPE); + TK_ASSERT(NULL!=m_data, "Error in data allocation"); + // Copy all data ... + memcpy(m_data, Evb.m_data, m_allocated * sizeof(MY_TYPE) ); + } - /** - * @brief - * - * @param[in,out] --- - * - * @return --- - * - */ - Vector& operator=(const etk::Vector & etkVector) - { - int32_t i; - this->~etkVector(); - m_size = etkVector.m_size; - m_count = etkVector.m_count; - ETK_MALLOC_CAST(m_data, m_size, T, T*);//reinterpret_cast); - for(i=0; i & Evb) + { + //TK_DEBUG("USE RECOPY vector ... Evb.m_size=" << Evb.m_size << " Evb.m_increment=" << Evb.m_increment); + if( this != &Evb ) // avoid copy to itself + { + if (NULL!=m_data) { + ETK_FREE(m_data); + m_data = NULL; + } + // Set the new value + m_allocated = Evb.m_allocated; + m_size = Evb.m_size; + m_increment = Evb.m_increment; + // allocate all same data + ETK_MALLOC(m_data, m_allocated, MY_TYPE); + TK_ASSERT(NULL!=m_data, "Error in data allocation"); + // Copy all data ... + memcpy(m_data, Evb.m_data, m_allocated * sizeof(MY_TYPE) ); + } + // Return the curent pointer + return *this; + } - /** - * @brief - * - * @param[in,out] --- - * - * @return --- - * - */ - T& Get(int32_t pos) - { - return m_data[pos]; - } + /** + * @brief Add at the Last position of the Vector + * @param[in] item Element to add at the end of vector + */ + Vector& operator+= (const etk::Vector & Evb) // += operator + { + int32_t nbElememt = Evb.Size(); + int32_t idx = m_size; + Resize(m_size+nbElememt); + memcpy(&m_data[idx], &Evb.m_data[0], nbElememt*sizeof(MY_TYPE) ); + // Return the curent pointer + return *this; + } - /** - * @brief - * - * @param[in,out] --- - * - * @return --- - * - */ - T& operator[] (int32_t pos) - { - return Get(pos); - } + /** + * @brief Set increment mode of this vector (default it match corectly with the number of element inside) + * @param[in] newIncrementNumber methode requested + */ + void SetIncrement(int32_t newIncrementNumber) + { + m_increment = newIncrementNumber; + } - /** - * @brief - * - * @param[in,out] --- - * - * @return --- - * - */ - const T& operator[] (int32_t pos) const - { - return m_data[pos]; - } + /** + * @brief Get the number of element in the vector + * @return The number requested + */ + int32_t Size() const + { + return m_size; + } - /** - * @brief - * - * @param[in,out] --- - * - * @return --- - * - */ - int IndexOf(const T * item) const - { - int32_t res = item - m_data; - if( 0 > res - || res >= Size()) - { - return -1; - } else { - return res; - } - } - - /** - * @brief - * - * @param[in,out] --- - * - * @return --- - * - */ - void PushBack(const T& item) - { - int32_t idx = Size(); - Resize(idx+1); - Get(idx) = item; - } - - /** - * @brief - * - * @param[in,out] --- - * - * @return --- - * - */ - void Resize(int32_t count) - { - int32_t i; - // Reallocate memory - if (count > m_size) { - ChangeAllocation(count); - } - - // Remove deprecated element - for(i=count; i m_size) { - // generate new size - while(count > m_size) { - if (INC) { - m_size = (m_size + INC); - } else if (m_size==0) { - m_size = 1; - } else { - m_size = m_size * 2; + /** + * @brief Get the Allocated size in the vector + * @return The size of allocation + */ + int32_t AllocatedSize() const + { + return m_allocated; + } + + /** + * @brief Get a current element in the vector + * @param[in] pos Desired position read + * @return Reference on the Element + */ + MY_TYPE& Get(int32_t pos) + { + return m_data[pos]; + } + + /** + * @brief Get an copy Element an a special position + * @param[in] pos Position in the vector that might be get [0..Size()] + * @return An reference on the copy of selected element + */ + MY_TYPE& operator[] (int32_t pos) + { + return Get(pos); + } + + /** + * @brief Get an Element an a special position + * @param[in] pos Position in the vector that might be get [0..Size()] + * @return An reference on the selected element + */ + const MY_TYPE& operator[] (int32_t pos) const + { + return m_data[pos]; + } + + /** + * @brief Add at the Last position of the Vector + * @param[in] item Element to add at the end of vector + */ + void PushBack(const MY_TYPE& item) + { + int32_t idx = m_size; + Resize(m_size+1); + m_data[idx] = item; + } + + /** + * @brief Add at the Last position of the Vector + * @param[in] item Element to add at the end of vector + */ + void PushBack(const MY_TYPE * item, int32_t nbElement) + { + if (NULL == item) { + return; + } + int32_t idx = m_size; + Resize(m_size+nbElement); + memcpy(&m_data[idx], item, nbElement*sizeof(MY_TYPE) ); + } + + /** + * @brief Remove the last element of the vector + */ + void PopBack(void) + { + if(m_size>0) { + Resize(m_size-1); } } - // Allocate the curent element - T * data = NULL; - ETK_MALLOC_CAST(data, m_size, T, T*);//reinterpret_cast); - for(int i=0; i0) { + Resize(0); + } } - Destroy(); - m_data = data; - } - } - -private: - T * m_data; //!< pointer on the current Data - int32_t m_count; //!< number of element - int32_t m_size; //!< current allocated size + + /** + * @brief + * + * @param[in,out] --- + * + * @return --- + * + */ + void Insert(int32_t pos, const MY_TYPE& item) + { + if (pos>m_size) { + TK_ERROR(" can not insert Element at this position : " << pos << " > " << m_size<< " add it at the end ... "); + PushBack(item); + return; + } + int32_t tmpSize = m_size; + // Request resize of the current buffer + Resize(m_size+1); + // move curent data + int32_t sizeToMove = (tmpSize - pos)*sizeof(MY_TYPE); + if ( 0 < sizeToMove) { + memmove((m_data + pos + 1), (m_data + pos), sizeToMove ); + } + // affectation of the current element + m_data[pos] = item; + } + + /** + * @brief + * + * @param[in,out] --- + * + * @return --- + * + */ + void Insert(int32_t pos, const MY_TYPE * item, int32_t nbElement) + { + if (pos>m_size) { + TK_WARNING(" can not insert Element at this position : " << pos << " > " << m_size << " add it at the end ... "); + PushBack(item, nbElement); + return; + } + int32_t tmpSize = m_size; + // Request resize of the current buffer + Resize(m_size+nbElement); + // move curent data (after the position) + int32_t sizeToMove = (tmpSize - pos)*sizeof(MY_TYPE); + if ( 0 < sizeToMove) { + memmove((m_data + pos + nbElement), (m_data + pos), sizeToMove ); + } + // affectation of all input element + memcpy(&m_data[pos], item, nbElement*sizeof(MY_TYPE) ); + } + + /** + * @brief Remove one element + * + * @param[in] pos Position to remove the data + * + * @return --- + * + */ + void Erase(int32_t pos) + { + if (pos<0 || (uint32_t)pos>m_size) { + TK_ERROR(" can not Erase Element at this position : " << pos << " > " << m_size); + return; + } + int32_t tmpSize = m_size; + int32_t sizeToMove = (tmpSize - (pos+1))*sizeof(MY_TYPE); + if ( 0 < sizeToMove) { + // move curent data + memmove((m_data + pos), (m_data + pos + 1), sizeToMove ); + } + // Request resize of the current buffer + Resize(m_size-1); + } + + /** + * @brief Remove N elements + * + * @param[in] pos Position to remove the data + * @param[in] posEnd Last position number + * + * @return --- + * + */ + void Erase(int32_t pos, int32_t posEnd) + { + if (pos>m_size) { + TK_ERROR(" can not Erase Element at this position : " << pos << " > " << m_size); + return; + } + if (posEnd>m_size) { + posEnd = m_size; + } + int32_t nbElement = m_size - pos; + int32_t tmpSize = m_size; + // move curent data + int32_t sizeToMove = (tmpSize - (pos+nbElement))*sizeof(MY_TYPE); + if ( 0 < sizeToMove) { + memmove((m_data + pos), (m_data + pos + nbElement), sizeToMove ); + } + // Request resize of the current buffer + Resize(m_size-nbElement); + } + + /** + * @brief Remove N element + * + * @param[in] pos Position to remove the data + * @param[in] nbElement number of element to remove + * + * @return --- + * + */ + void EraseLen(int32_t pos, int32_t nbElement) + { + if (pos>m_size) { + TK_ERROR(" can not Erase Len Element at this position : " << pos << " > " << m_size); + return; + } + if (pos+nbElement>m_size) { + nbElement = m_size - pos; + } + int32_t tmpSize = m_size; + // move curent data + int32_t sizeToMove = (tmpSize - (pos+nbElement))*sizeof(MY_TYPE); + if ( 0 < sizeToMove) { + memmove((m_data + pos), (m_data + pos + nbElement), sizeToMove ); + } + // Request resize of the current buffer + Resize(m_size-nbElement); + } + + /** + * @brief extract data between two point : + * @param[in] posStart start position to extract data + * @param[in] posEnd End position to extract data + * @return the extracted vector + */ + Vector Extract(int32_t posStart = 0, int32_t posEnd=0x7FFFFFFF) + { + Vector out; + if (posStart < 0) { + posStart = 0; + } else if (posStart >= Size() ) { + return out; + } + if (posEnd < 0) { + return out; + } else if (posEnd >= Size() ) { + posEnd = Size(); + } + out.PushBack(&m_data[posStart], posEnd-posStart); + return out; + } + + /** + * @brief Set the minimum allocation in memory for the curent vector ==> reallocate the + * buffer to fit exactly the mumber of element needed + */ + void Fit(void) + { + if (m_size > m_allocated) { + // Reallocate the curent data to the correct size ... + ETK_REALLOC(m_data, m_size, MY_TYPE); + } + // Check result with assert : + TK_ASSERT(NULL!=m_data, "Error in data Fitting"); + m_allocated = m_size; + } + + /** + * @brief Get an iterator an an specific position + * @param[in] pos Requested position of the iterator in the vector + * @return The Iterator + */ + Iterator Position(int32_t pos) + { + return Iterator(this, pos); + } + + /** + * @brief Get an Iterator on the start position of the Vector + * @return The Iterator + */ + Iterator Begin(void) + { + return Position(0); + } + + /** + * @brief Get an Iterator on the end position of the Vector + * @return The Iterator + */ + Iterator End(void) + { + return Position( Size()-1 ); + } + + private: + /** + * @brief Change the current size of the vector + * @param[in] newSize New requested size of element in the vector + */ + void Resize(int32_t newSize) + { + // Reallocate memory + if (newSize > m_allocated) { + ChangeAllocation(newSize); + } + m_size = newSize; + } + + /** + * @brief Change the current allocation to the corect one (depend on the current size) + * @param[in] newSize Minimum number of element needed + */ + void ChangeAllocation(int32_t newSize) + { + // set the minimal size to 1 + if(newSize <= 0) { + newSize = 1; + } + int32_t requestSize = m_allocated; + // set the size with the corect chose type : + if (newSize == m_allocated) { + return; + } else if (newSize < requestSize) { + // down the size of the vector: + if (0==m_increment) { + // never down size... + } else { + int32_t devide = m_increment; + if (devide == 0) { + devide = 1; + } + int32_t numberOfStep = m_allocated / devide; + if (newSize< ((numberOfStep-2)*devide + devide/2) ) { + //Allow Reallocation of a new size shorter + requestSize = ((newSize / devide)+1) * devide; + } + } + } else { + while(newSize > requestSize) { + if (0 == requestSize) { + requestSize = 1; + } else if (0==m_increment) { + requestSize = requestSize * 2; + } else { + requestSize = (requestSize + m_increment); + } + } + } + // No reallocation needed : + if (requestSize == m_allocated) { + return; + } + // check if something is allocated : + if (NULL == m_data) { + // no data allocated ==> request an allocation (might be the first) + ETK_MALLOC(m_data, requestSize, MY_TYPE); + } else { + // move datas + ETK_REALLOC(m_data, requestSize, MY_TYPE); + } + // Check result with assert : + TK_ASSERT(NULL!=m_data, "Error in data allocation"); + // set the new allocation size + m_allocated = requestSize; + } + }; + /** - * @brief + * @brief VectorP classes ... * - * @param[in,out] --- + * @tparam[in] T The type of objects to store. + * @tparam[in] INC Incrementation mode (0 : Exponential to 200 and increment by stemp of 200) * - * @return --- + * m_data + * ---------- |-----------------------| + * | 0 |-------->| Class Data | + * |--------| |-----------------------| + * | 1 |----| + * |--------| | + * | 2 |====|==============| |-----------------------| + * |--------| | --->| Class Data | + * m_count | 3 |-| | |-----------------------| + * |--------| | | + * | x | | | |-----------------------| + * |--------| | -------->| Class Data | + * | x | | |-----------------------| + * |--------| | + * | x | | + * |--------| | |-----------------------| + * | x | --------------------->| Class Data | + * |--------| |-----------------------| + * | x | + * |--------| + * | x | + * |--------| + * m_size | x | + * ---------- * */ - void Destroy() + /* + template class VectorP private Vector { - for(int i=0; i -#include -#include - -#undef __class__ -#define __class__ "etk::VectorType" - -/** - * @brief VectorType classes ... - * - * @tparam[in] SIZE Size of the current element. - * - * m_data - * <------------ m_dataSize ------------> - * ---------------------------------------- - * | 0 | - * |--------------------------------------| - * | 1 | - * |--------------------------------------| - * | 2 | - * |--------------------------------------| - * m_size | 3 | - * |--------------------------------------| - * | x | - * |--------------------------------------| - * | x | - * |--------------------------------------| - * | x | - * |--------------------------------------| - * | x | - * |--------------------------------------| - * | x | - * |--------------------------------------| - * | x | - * |--------------------------------------| - * m_allocated | x | - * ---------------------------------------- - * - */ - -namespace etk -{ - -template class VectorType -{ - public: - class Iterator - { - // Private data : - private: - int32_t m_current; //!< curent Id on the vector - VectorType * m_VectorType; //!< Pointer on the curent element of the vectorBin - public: - /** - * @brief Basic itarator constructor with no link with an etkVector - */ - Iterator(): - m_current(-1), - m_VectorType(NULL) - { - // nothing to do ... - } - /** - * @brief Recopy constructor on a specific etkVector. - * @param[in] otherIterator The Iterator that might be copy - */ - Iterator(const Iterator & otherIterator): - m_current(otherIterator.m_current), - m_VectorType(otherIterator.m_VectorType) - { - // nothing to do ... - } - /** - * @brief Asignation operator. - * @param[in] otherIterator The Iterator that might be copy - * @return reference on the curent Iterator - */ - Iterator& operator=(const Iterator & otherIterator) - { - m_current = otherIterator.m_current; - m_VectorType = otherIterator.m_VectorType; - return *this; - } - /** - * @brief Basic destructor - */ - ~Iterator() - { - m_current = -1; - m_VectorType = NULL; - } - /** - * @brief basic boolean cast - * @return true if the element is present in the etkVector size - */ - operator bool () - { - if( 0 <= m_current - && m_current < m_VectorType->Size() ) - { - return true; - } else { - return false; - } - } - /** - * @brief Incremental operator - * @return Reference on the current iterator incremented - */ - Iterator& operator++ () - { - if( NULL != m_VectorType - && m_current < m_VectorType->Size() ) - { - m_current++; - } - return *this; - } - /** - * @brief Decremental operator - * @return Reference on the current iterator decremented - */ - Iterator& operator-- () - { - if (m_current >= 0) { - m_current--; - } - return *this; - } - /** - * @brief Incremental operator - * @return Reference on a new iterator and increment the other one - */ - Iterator operator++ (int32_t) - { - Iterator it(*this); - ++(*this); - return it; - } - /** - * @brief Decremental operator - * @return Reference on a new iterator and decrement the other one - */ - Iterator operator-- (int32_t) - { - Iterator it(*this); - --(*this); - return it; - } - /** - * @brief Get reference on the current Element - * @return the reference on the current Element - */ - MY_TYPE & operator-> () const - { - TK_CHECK_INOUT(m_current >= 0 && m_current < m_VectorType->Size()); - return &m_VectorType->Get(m_current); - } - /** - * @brief Get reference on the current Element - * @return the reference on the current Element - */ - MY_TYPE & operator* () const - { - TK_CHECK_INOUT(m_current >= 0 && m_current < m_VectorType->Size()); - return m_VectorType->Get(m_current); - } - private: - /** - * @brief - * - * @param[in,out] --- - * - * @return --- - * - */ - Iterator(VectorType * Evb, int32_t pos): - m_current(pos), - m_VectorType(Evb) - { - // nothing to do ... - } - friend class VectorType; - }; - - private: - MY_TYPE * m_data; //!< pointer on the curetn table of Data - int32_t m_size; //!< nb Element in the buffer - int32_t m_allocated; //!< Current allocated size - int32_t m_increment; //!< methode of increment - public: - /** - * @brief Create an empty vector - * @param[in] count Minimum request size of the Buffer - */ - VectorType(int32_t count = 0): - m_data(NULL), - m_size(0), - m_allocated(0), - m_increment(1) - { - ChangeAllocation(count); - } - - /** - * @brief Re-copy constructor (copy all needed data) - * @param[in] Evb Vector that might be copy - */ - VectorType(const etk::VectorType & Evb) - { - m_allocated = Evb.m_allocated; - m_size = Evb.m_size; - m_increment = Evb.m_increment; - m_data = NULL; - //TK_DEBUG("USE Specific vector allocator ... Evb.m_size=" << Evb.m_size << " Evb.m_increment=" << Evb.m_increment); - // allocate all same data - ETK_MALLOC(m_data, m_allocated, MY_TYPE); - TK_ASSERT(NULL!=m_data, "Error in data allocation"); - // Copy all data ... - memcpy(m_data, Evb.m_data, m_allocated * sizeof(MY_TYPE) ); - } - - /** - * @brief Destructor of the current Class - */ - ~VectorType() - { - if (NULL!=m_data) { - ETK_FREE(m_data); - m_data = NULL; - } - m_allocated = 0; - m_size = 0; - m_increment = 0; - } - - /** - * @brief Re-copy operator - * @param[in] Evb Vector that might be copy - * @return reference on the curent re-copy vector - */ - VectorType& operator=(const etk::VectorType & Evb) - { - //TK_DEBUG("USE RECOPY vector ... Evb.m_size=" << Evb.m_size << " Evb.m_increment=" << Evb.m_increment); - if( this != &Evb ) // avoid copy to itself - { - if (NULL!=m_data) { - ETK_FREE(m_data); - m_data = NULL; - } - // Set the new value - m_allocated = Evb.m_allocated; - m_size = Evb.m_size; - m_increment = Evb.m_increment; - // allocate all same data - ETK_MALLOC(m_data, m_allocated, MY_TYPE); - TK_ASSERT(NULL!=m_data, "Error in data allocation"); - // Copy all data ... - memcpy(m_data, Evb.m_data, m_allocated * sizeof(MY_TYPE) ); - } - // Return the curent pointer - return *this; - } - - /** - * @brief Add at the Last position of the Vector - * @param[in] item Element to add at the end of vector - */ - VectorType& operator+= (const etk::VectorType & Evb) // += operator - { - int32_t nbElememt = Evb.Size(); - int32_t idx = m_size; - Resize(m_size+nbElememt); - memcpy(&m_data[idx], &Evb.m_data[0], nbElememt*sizeof(MY_TYPE) ); - // Return the curent pointer - return *this; - } - - /** - * @brief Set increment mode of this vector (default it match corectly with the number of element inside) - * @param[in] newIncrementNumber methode requested - */ - void SetIncrement(int32_t newIncrementNumber) - { - m_increment = newIncrementNumber; - } - - /** - * @brief Get the number of element in the vector - * @return The number requested - */ - int32_t Size() const - { - return m_size; - } - - /** - * @brief Get the Allocated size in the vector - * @return The size of allocation - */ - int32_t AllocatedSize() const - { - return m_allocated; - } - - /** - * @brief Get a current element in the vector - * @param[in] pos Desired position read - * @return Reference on the Element - */ - MY_TYPE& Get(int32_t pos) - { - return m_data[pos]; - } - - /** - * @brief Get an copy Element an a special position - * @param[in] pos Position in the vector that might be get [0..Size()] - * @return An reference on the copy of selected element - */ - MY_TYPE& operator[] (int32_t pos) - { - return Get(pos); - } - - /** - * @brief Get an Element an a special position - * @param[in] pos Position in the vector that might be get [0..Size()] - * @return An reference on the selected element - */ - const MY_TYPE& operator[] (int32_t pos) const - { - return m_data[pos]; - } - - /** - * @brief Add at the Last position of the Vector - * @param[in] item Element to add at the end of vector - */ - void PushBack(const MY_TYPE& item) - { - int32_t idx = m_size; - Resize(m_size+1); - m_data[idx] = item; - } - - /** - * @brief Add at the Last position of the Vector - * @param[in] item Element to add at the end of vector - */ - void PushBack(const MY_TYPE * item, int32_t nbElement) - { - if (NULL == item) { - return; - } - int32_t idx = m_size; - Resize(m_size+nbElement); - memcpy(&m_data[idx], item, nbElement*sizeof(MY_TYPE) ); - } - - /** - * @brief Remove the last element of the vector - */ - void PopBack(void) - { - if(m_size>0) { - Resize(m_size-1); - } - } - - /** - * @brief Remove all alement in the current vector - */ - void Clear(void) - { - if(m_size>0) { - Resize(0); - } - } - - /** - * @brief - * - * @param[in,out] --- - * - * @return --- - * - */ - void Insert(int32_t pos, const MY_TYPE& item) - { - if (pos>m_size) { - TK_ERROR(" can not insert Element at this position : " << pos << " > " << m_size<< " add it at the end ... "); - PushBack(item); - return; - } - int32_t tmpSize = m_size; - // Request resize of the current buffer - Resize(m_size+1); - // move curent data - int32_t sizeToMove = (tmpSize - pos)*sizeof(MY_TYPE); - if ( 0 < sizeToMove) { - memmove((m_data + pos + 1), (m_data + pos), sizeToMove ); - } - // affectation of the current element - m_data[pos] = item; - } - - /** - * @brief - * - * @param[in,out] --- - * - * @return --- - * - */ - void Insert(int32_t pos, const MY_TYPE * item, int32_t nbElement) - { - if (pos>m_size) { - TK_WARNING(" can not insert Element at this position : " << pos << " > " << m_size << " add it at the end ... "); - PushBack(item, nbElement); - return; - } - int32_t tmpSize = m_size; - // Request resize of the current buffer - Resize(m_size+nbElement); - // move curent data (after the position) - int32_t sizeToMove = (tmpSize - pos)*sizeof(MY_TYPE); - if ( 0 < sizeToMove) { - memmove((m_data + pos + nbElement), (m_data + pos), sizeToMove ); - } - // affectation of all input element - memcpy(&m_data[pos], item, nbElement*sizeof(MY_TYPE) ); - } - - /** - * @brief Remove one element - * - * @param[in] pos Position to remove the data - * - * @return --- - * - */ - void Erase(int32_t pos) - { - if (pos<0 || (uint32_t)pos>m_size) { - TK_ERROR(" can not Erase Element at this position : " << pos << " > " << m_size); - return; - } - int32_t tmpSize = m_size; - int32_t sizeToMove = (tmpSize - (pos+1))*sizeof(MY_TYPE); - if ( 0 < sizeToMove) { - // move curent data - memmove((m_data + pos), (m_data + pos + 1), sizeToMove ); - } - // Request resize of the current buffer - Resize(m_size-1); - } - - /** - * @brief Remove N elements - * - * @param[in] pos Position to remove the data - * @param[in] posEnd Last position number - * - * @return --- - * - */ - void Erase(int32_t pos, int32_t posEnd) - { - if (pos>m_size) { - TK_ERROR(" can not Erase Element at this position : " << pos << " > " << m_size); - return; - } - if (posEnd>m_size) { - posEnd = m_size; - } - int32_t nbElement = m_size - pos; - int32_t tmpSize = m_size; - // move curent data - int32_t sizeToMove = (tmpSize - (pos+nbElement))*sizeof(MY_TYPE); - if ( 0 < sizeToMove) { - memmove((m_data + pos), (m_data + pos + nbElement), sizeToMove ); - } - // Request resize of the current buffer - Resize(m_size-nbElement); - } - - /** - * @brief Remove N element - * - * @param[in] pos Position to remove the data - * @param[in] nbElement number of element to remove - * - * @return --- - * - */ - void EraseLen(int32_t pos, int32_t nbElement) - { - if (pos>m_size) { - TK_ERROR(" can not Erase Len Element at this position : " << pos << " > " << m_size); - return; - } - if (pos+nbElement>m_size) { - nbElement = m_size - pos; - } - int32_t tmpSize = m_size; - // move curent data - int32_t sizeToMove = (tmpSize - (pos+nbElement))*sizeof(MY_TYPE); - if ( 0 < sizeToMove) { - memmove((m_data + pos), (m_data + pos + nbElement), sizeToMove ); - } - // Request resize of the current buffer - Resize(m_size-nbElement); - } - - /** - * @brief extract data between two point : - * @param[in] posStart start position to extract data - * @param[in] posEnd End position to extract data - * @return the extracted vector - */ - VectorType Extract(int32_t posStart = 0, int32_t posEnd=0x7FFFFFFF) - { - VectorType out; - if (posStart < 0) { - posStart = 0; - } else if (posStart >= Size() ) { - return out; - } - if (posEnd < 0) { - return out; - } else if (posEnd >= Size() ) { - posEnd = Size(); - } - out.PushBack(&m_data[posStart], posEnd-posStart); - return out; - } - - /** - * @brief Set the minimum allocation in memory for the curent vector ==> reallocate the - * buffer to fit exactly the mumber of element needed - */ - void Fit(void) - { - if (m_size > m_allocated) { - // Reallocate the curent data to the correct size ... - ETK_REALLOC(m_data, m_size, MY_TYPE); - } - // Check result with assert : - TK_ASSERT(NULL!=m_data, "Error in data Fitting"); - m_allocated = m_size; - } - - /** - * @brief Get an iterator an an specific position - * @param[in] pos Requested position of the iterator in the vector - * @return The Iterator - */ - Iterator Position(int32_t pos) - { - return Iterator(this, pos); - } - - /** - * @brief Get an Iterator on the start position of the Vector - * @return The Iterator - */ - Iterator Begin(void) - { - return Position(0); - } - - /** - * @brief Get an Iterator on the end position of the Vector - * @return The Iterator - */ - Iterator End(void) - { - return Position( Size()-1 ); - } - - private: - /** - * @brief Change the current size of the vector - * @param[in] newSize New requested size of element in the vector - */ - void Resize(int32_t newSize) - { - // Reallocate memory - if (newSize > m_allocated) { - ChangeAllocation(newSize); - } - m_size = newSize; - } - - /** - * @brief Change the current allocation to the corect one (depend on the current size) - * @param[in] newSize Minimum number of element needed - */ - void ChangeAllocation(int32_t newSize) - { - // set the minimal size to 1 - if(newSize <= 0) { - newSize = 1; - } - int32_t requestSize = m_allocated; - // set the size with the corect chose type : - if (newSize == m_allocated) { - return; - } else if (newSize < requestSize) { - // down the size of the vector: - if (0==m_increment) { - // never down size... - } else { - int32_t devide = m_increment; - if (devide == 0) { - devide = 1; - } - int32_t numberOfStep = m_allocated / devide; - if (newSize< ((numberOfStep-2)*devide + devide/2) ) { - //Allow Reallocation of a new size shorter - requestSize = ((newSize / devide)+1) * devide; - } - } - } else { - while(newSize > requestSize) { - if (0 == requestSize) { - requestSize = 1; - } else if (0==m_increment) { - requestSize = requestSize * 2; - } else { - requestSize = (requestSize + m_increment); - } - } - } - // No reallocation needed : - if (requestSize == m_allocated) { - return; - } - // check if something is allocated : - if (NULL == m_data) { - // no data allocated ==> request an allocation (might be the first) - ETK_MALLOC(m_data, requestSize, MY_TYPE); - } else { - // move datas - ETK_REALLOC(m_data, requestSize, MY_TYPE); - } - // Check result with assert : - TK_ASSERT(NULL!=m_data, "Error in data allocation"); - // set the new allocation size - m_allocated = requestSize; - } -}; -} - -#undef __class__ -#define __class__ NULL - -#endif - diff --git a/Sources/libetk/etk/tool.cpp b/Sources/libetk/etk/tool.cpp index 1dc7fe47..9b90355e 100644 --- a/Sources/libetk/etk/tool.cpp +++ b/Sources/libetk/etk/tool.cpp @@ -39,9 +39,9 @@ int32_t etk::tool::irand(int32_t a, int32_t b) } -void etk::tool::SortList(etk::VectorType &m_listDirectory) +void etk::tool::SortList(etk::Vector &m_listDirectory) { - etk::VectorType tmpList = m_listDirectory; + etk::Vector tmpList = m_listDirectory; m_listDirectory.Clear(); for(int32_t iii=0; iii &m_listDirectory) //EWOL_DEBUG("position="<= 'A') { + in1 = in1 - 'A' + 'a'; + } + if (in2 <= 'Z' && in2 >= 'A') { + in2 = in2 - 'A' + 'a'; + } + if (in1 != in2) { + return false; + } + } + iii++; + input1++; + input2++; + } + return true; +} + diff --git a/Sources/libetk/etk/tool.h b/Sources/libetk/etk/tool.h index 22eaac60..3e0931c9 100644 --- a/Sources/libetk/etk/tool.h +++ b/Sources/libetk/etk/tool.h @@ -32,7 +32,8 @@ namespace etk { namespace tool { float frand(float a, float b); int32_t irand(int32_t a, int32_t b); - void SortList(etk::VectorType &m_listDirectory); + void SortList(etk::Vector &m_listDirectory); + bool strnCmpNoCase(const char * input1, const char * input2, int32_t maxLen); }; }; diff --git a/Sources/libetk/etk/unicode.cpp b/Sources/libetk/etk/unicode.cpp index c932e82d..64f20870 100644 --- a/Sources/libetk/etk/unicode.cpp +++ b/Sources/libetk/etk/unicode.cpp @@ -99,7 +99,7 @@ void unicode::convertUnicodeToIso(charset_te inputCharset, uniChar_t input_Unico } -int32_t unicode::convertIsoToUnicode(charset_te inputCharset, etk::VectorType& input_ISO, etk::VectorType& output_Unicode) +int32_t unicode::convertIsoToUnicode(charset_te inputCharset, etk::Vector& input_ISO, etk::Vector& output_Unicode) { output_Unicode.Clear(); uniChar_t output; @@ -115,7 +115,7 @@ int32_t unicode::convertIsoToUnicode(charset_te inputCharset, etk::VectorType& input_ISO, etk::VectorType& output_Unicode) +int32_t unicode::convertIsoToUnicode(charset_te inputCharset, etk::Vector& input_ISO, etk::Vector& output_Unicode) { output_Unicode.Clear(); uniChar_t output; @@ -132,7 +132,7 @@ int32_t unicode::convertIsoToUnicode(charset_te inputCharset, etk::VectorType& input_Unicode, etk::VectorType& output_ISO) +int32_t unicode::convertUnicodeToIso(charset_te inputCharset, etk::Vector& input_Unicode, etk::Vector& output_ISO) { output_ISO.Clear(); char output[10]; @@ -148,7 +148,7 @@ int32_t unicode::convertUnicodeToIso(charset_te inputCharset, etk::VectorType& input_Unicode, etk::VectorType& output_ISO) +int32_t unicode::convertUnicodeToIso(charset_te inputCharset, etk::Vector& input_Unicode, etk::Vector& output_ISO) { output_ISO.Clear(); char output[10]; @@ -254,7 +254,7 @@ void unicode::convertUtf8ToUnicode(char * input_UTF8, uniChar_t &output_Unicode) } -int32_t unicode::convertUnicodeToUtf8(const etk::VectorType& input_Unicode, etk::VectorType& output_UTF8) +int32_t unicode::convertUnicodeToUtf8(const etk::Vector& input_Unicode, etk::Vector& output_UTF8) { char output[10]; @@ -270,7 +270,7 @@ int32_t unicode::convertUnicodeToUtf8(const etk::VectorType& input_Un return output_UTF8.Size()-1; } -int32_t unicode::convertUnicodeToUtf8(const etk::VectorType& input_Unicode, etk::VectorType& output_UTF8) +int32_t unicode::convertUnicodeToUtf8(const etk::Vector& input_Unicode, etk::Vector& output_UTF8) { char output[10]; @@ -287,7 +287,7 @@ int32_t unicode::convertUnicodeToUtf8(const etk::VectorType& input_Un } -int32_t unicode::convertUtf8ToUnicode(etk::VectorType& input_UTF8, etk::VectorType& output_Unicode) +int32_t unicode::convertUtf8ToUnicode(etk::Vector& input_UTF8, etk::Vector& output_Unicode) { char tmpData[20]; int32_t pos = 0; @@ -338,7 +338,7 @@ int32_t unicode::convertUtf8ToUnicode(etk::VectorType& input_UTF8, etk::Ve return 0; } -int32_t unicode::convertUtf8ToUnicode(etk::VectorType& input_UTF8, etk::VectorType& output_Unicode) +int32_t unicode::convertUtf8ToUnicode(etk::Vector& input_UTF8, etk::Vector& output_Unicode) { char tmpData[20]; int32_t pos = 0; @@ -389,7 +389,7 @@ int32_t unicode::convertUtf8ToUnicode(etk::VectorType& input_UTF8, etk:: return 0; } -int32_t unicode::convertUtf8ToUnicode(char * input_UTF8, etk::VectorType& output_Unicode) +int32_t unicode::convertUtf8ToUnicode(char * input_UTF8, etk::Vector& output_Unicode) { char tmpData[20]; int32_t pos = 0; @@ -466,14 +466,14 @@ void unicode::convertUtf8ToIso(charset_te inputCharset, char * input_UTF8, char } -int32_t unicode::convertIsoToUtf8(charset_te inputCharset, etk::VectorType& input_ISO, etk::VectorType& output_UTF8) +int32_t unicode::convertIsoToUtf8(charset_te inputCharset, etk::Vector& input_ISO, etk::Vector& output_UTF8) { TK_WARNING("TODO : not coded..."); return 0; } -int32_t unicode::convertUtf8ToIso(charset_te inputCharset, etk::VectorType& input_UTF8, etk::VectorType& output_ISO) +int32_t unicode::convertUtf8ToIso(charset_te inputCharset, etk::Vector& input_UTF8, etk::Vector& output_ISO) { TK_WARNING("TODO : not coded..."); return 0; diff --git a/Sources/libetk/etk/unicode.h b/Sources/libetk/etk/unicode.h index c42fa65e..482c28d8 100644 --- a/Sources/libetk/etk/unicode.h +++ b/Sources/libetk/etk/unicode.h @@ -26,7 +26,7 @@ #define __UNICODE_H__ #include -#include +#include namespace unicode { typedef enum { EDN_CHARSET_UTF8, @@ -47,25 +47,25 @@ namespace unicode { } charset_te; // transform ISO <==> Unicode - void convertIsoToUnicode(charset_te inputCharset, char input_ISO, uniChar_t & output_Unicode); - void convertUnicodeToIso(charset_te inputCharset, uniChar_t input_Unicode, char & output_ISO); - int32_t convertIsoToUnicode(charset_te inputCharset, etk::VectorType& input_ISO, etk::VectorType& output_Unicode); - int32_t convertIsoToUnicode(charset_te inputCharset, etk::VectorType& input_ISO, etk::VectorType& output_Unicode); - int32_t convertUnicodeToIso(charset_te inputCharset, etk::VectorType& input_Unicode, etk::VectorType& output_ISO); - int32_t convertUnicodeToIso(charset_te inputCharset, etk::VectorType& input_Unicode, etk::VectorType& output_ISO); + void convertIsoToUnicode(charset_te inputCharset, char input_ISO, uniChar_t & output_Unicode); + void convertUnicodeToIso(charset_te inputCharset, uniChar_t input_Unicode, char & output_ISO); + int32_t convertIsoToUnicode(charset_te inputCharset, etk::Vector& input_ISO, etk::Vector& output_Unicode); + int32_t convertIsoToUnicode(charset_te inputCharset, etk::Vector& input_ISO, etk::Vector& output_Unicode); + int32_t convertUnicodeToIso(charset_te inputCharset, etk::Vector& input_Unicode, etk::Vector& output_ISO); + int32_t convertUnicodeToIso(charset_te inputCharset, etk::Vector& input_Unicode, etk::Vector& output_ISO); // Transform UTF-8 <==> Unicode - void convertUnicodeToUtf8( uniChar_t input_Unicode, char * output_UTF8); - void convertUtf8ToUnicode( char * input_UTF8, uniChar_t& output_Unicode); - int32_t convertUnicodeToUtf8( const etk::VectorType& input_Unicode, etk::VectorType& output_UTF8); - int32_t convertUnicodeToUtf8( const etk::VectorType& input_Unicode, etk::VectorType& output_UTF8); - int32_t convertUtf8ToUnicode( etk::VectorType& input_UTF8, etk::VectorType& output_Unicode); - int32_t convertUtf8ToUnicode( etk::VectorType& input_UTF8, etk::VectorType& output_Unicode); - int32_t convertUtf8ToUnicode( char * input_UTF8, etk::VectorType& output_Unicode); + void convertUnicodeToUtf8( uniChar_t input_Unicode, char * output_UTF8); + void convertUtf8ToUnicode( char * input_UTF8, uniChar_t& output_Unicode); + int32_t convertUnicodeToUtf8( const etk::Vector& input_Unicode, etk::Vector& output_UTF8); + int32_t convertUnicodeToUtf8( const etk::Vector& input_Unicode, etk::Vector& output_UTF8); + int32_t convertUtf8ToUnicode( etk::Vector& input_UTF8, etk::Vector& output_Unicode); + int32_t convertUtf8ToUnicode( etk::Vector& input_UTF8, etk::Vector& output_Unicode); + int32_t convertUtf8ToUnicode( char * input_UTF8, etk::Vector& output_Unicode); // Transform ISO <==> UTF-8 - void convertIsoToUtf8( charset_te inputCharset, char input_ISO, char * output_UTF8); - void convertUtf8ToIso( charset_te inputCharset, char * input_UTF8, char & output_ISO); - int32_t convertIsoToUtf8( charset_te inputCharset, etk::VectorType& input_ISO, etk::VectorType& output_UTF8); - int32_t convertUtf8ToIso( charset_te inputCharset, etk::VectorType& input_UTF8, etk::VectorType& output_ISO); + void convertIsoToUtf8( charset_te inputCharset, char input_ISO, char * output_UTF8); + void convertUtf8ToIso( charset_te inputCharset, char * input_UTF8, char & output_ISO); + int32_t convertIsoToUtf8( charset_te inputCharset, etk::Vector& input_ISO, etk::Vector& output_UTF8); + int32_t convertUtf8ToIso( charset_te inputCharset, etk::Vector& input_UTF8, etk::Vector& output_ISO); void Utf8_SizeElement(const char * data, int32_t lenMax , uint8_t &size, bool &baseValid); int32_t strUtf8Len(const char *input_UTF8); diff --git a/Sources/libewol/ewol/Audio/audio.cpp b/Sources/libewol/ewol/Audio/audio.cpp index 734ead87..2ebf9a36 100644 --- a/Sources/libewol/ewol/Audio/audio.cpp +++ b/Sources/libewol/ewol/Audio/audio.cpp @@ -311,9 +311,9 @@ class RequestPlay { } }; -#include -etk::VectorType ListEffects; -etk::VectorType ListEffectsPlaying; +#include +etk::Vector ListEffects; +etk::Vector ListEffectsPlaying; int32_t ewol::audio::effects::Add(etk::UString file) diff --git a/Sources/libewol/ewol/EObject.cpp b/Sources/libewol/ewol/EObject.cpp index 15c6e4ea..edac491e 100644 --- a/Sources/libewol/ewol/EObject.cpp +++ b/Sources/libewol/ewol/EObject.cpp @@ -38,7 +38,7 @@ extern "C" { }; // internal element of the widget manager : -static etk::VectorType m_messageList; // all widget allocated ==> all time increment ... never removed ... +static etk::Vector m_messageList; // all widget allocated ==> all time increment ... never removed ... void ewol::EObjectMessageMultiCast::Init(void) diff --git a/Sources/libewol/ewol/EObject.h b/Sources/libewol/ewol/EObject.h index d7f10698..f78f0e5a 100644 --- a/Sources/libewol/ewol/EObject.h +++ b/Sources/libewol/ewol/EObject.h @@ -27,7 +27,7 @@ #include #include -#include +#include namespace ewol { namespace EObjectMessageMultiCast { @@ -55,8 +55,8 @@ namespace ewol { class EObject { private: int32_t m_uniqueId; //!< Object UniqueID ==> TODO : Check if it use is needed - etk::VectorType m_externEvent; //!< Generic list of event generation for output link - etk::VectorType m_availlableEventId; //!< List of all event availlable for this widget + etk::Vector m_externEvent; //!< Generic list of event generation for output link + etk::Vector m_availlableEventId; //!< List of all event availlable for this widget public: /** * @brief Constructor diff --git a/Sources/libewol/ewol/EObjectManager.cpp b/Sources/libewol/ewol/EObjectManager.cpp index a4d9ef2f..33258785 100644 --- a/Sources/libewol/ewol/EObjectManager.cpp +++ b/Sources/libewol/ewol/EObjectManager.cpp @@ -31,8 +31,8 @@ static bool IsInit = false; // internal element of the widget manager : -static etk::VectorType m_eObjectList; // all widget allocated ==> all time increment ... never removed ... -static etk::VectorType m_eObjectAutoRemoveList; // all widget allocated +static etk::Vector m_eObjectList; // all widget allocated ==> all time increment ... never removed ... +static etk::Vector m_eObjectAutoRemoveList; // all widget allocated void ewol::EObjectManager::Init(void) diff --git a/Sources/libewol/ewol/Font.h b/Sources/libewol/ewol/Font.h index 98c3c74e..8b71382a 100644 --- a/Sources/libewol/ewol/Font.h +++ b/Sources/libewol/ewol/Font.h @@ -57,27 +57,27 @@ namespace ewol clipping_ts & drawClipping, const etk::UString & unicodeString, int32_t & fontTextureId, - etk::VectorType > & coord, - etk::VectorType & coordTex); + etk::Vector > & coord, + etk::Vector & coordTex); int32_t DrawText(int32_t fontID, Vector2D textPos, clipping_ts & drawClipping, const uniChar_t unicodeChar, int32_t & fontTextureId, - etk::VectorType > & coord, - etk::VectorType & coordTex); + etk::Vector > & coord, + etk::Vector & coordTex); int32_t DrawText(int32_t fontID, Vector2D textPos, const etk::UString & unicodeString, int32_t & fontTextureId, - etk::VectorType > & coord, - etk::VectorType & coordTex); + etk::Vector > & coord, + etk::Vector & coordTex); int32_t DrawText(int32_t fontID, Vector2D textPos, const uniChar_t unicodeChar, int32_t & fontTextureId, - etk::VectorType > & coord, - etk::VectorType & coordTex); + etk::Vector > & coord, + etk::Vector & coordTex); int32_t LoadFont(etk::File fontFileName); }; diff --git a/Sources/libewol/ewol/FontFreeType.cpp b/Sources/libewol/ewol/FontFreeType.cpp index 422c6d8d..3b004ad4 100644 --- a/Sources/libewol/ewol/FontFreeType.cpp +++ b/Sources/libewol/ewol/FontFreeType.cpp @@ -25,7 +25,7 @@ #include #include #include -#include +#include #include extern "C" { @@ -220,7 +220,7 @@ class FTFontInternal } public: etk::UString GetFontName(void) {return m_fontName;}; - bool GenerateBitmapFont(int32_t size, int32_t &height, int32_t & textureId, etk::VectorType & listElement) + bool GenerateBitmapFont(int32_t size, int32_t &height, int32_t & textureId, etk::Vector & listElement) { // 300dpi (hight quality) 96 dpi (normal quality) int32_t fontQuality = 96; @@ -378,7 +378,7 @@ class FTFontInternal FT_Face m_fftFace; }; -static etk::VectorType m_listLoadedTTFont; +static etk::Vector m_listLoadedTTFont; static etk::UString s_currentFolderName = ""; @@ -436,7 +436,7 @@ class FTFont{ return false; }; - etk::VectorType & GetRefOnElement(void) + etk::Vector & GetRefOnElement(void) { return m_elements; }; @@ -462,10 +462,10 @@ class FTFont{ int32_t m_size; // nb pixel height int32_t m_lineHeight; // nb pixel height int32_t m_interline; // nb pixel between 2 lines - etk::VectorType m_elements; // + etk::Vector m_elements; // }; -static etk::VectorType m_listLoadedFont; +static etk::Vector m_listLoadedFont; #undef __class__ #define __class__ "ewol::FontFreeType" @@ -579,14 +579,14 @@ int32_t ewol::DrawText(int32_t fontID, clipping_ts & drawClipping, const etk::UString& unicodeString, int32_t & fontTextureId, - etk::VectorType > & coord, - etk::VectorType & coordTex) + etk::Vector > & coord, + etk::Vector & coordTex) { if(fontID>=m_listLoadedFont.Size() || fontID < 0) { EWOL_WARNING("try to display text with an fontID that does not existed " << fontID); return 0; } - etk::VectorType & listOfElement = m_listLoadedFont[fontID]->GetRefOnElement(); + etk::Vector & listOfElement = m_listLoadedFont[fontID]->GetRefOnElement(); fontTextureId = m_listLoadedFont[fontID]->GetOglId(); int32_t fontSize = m_listLoadedFont[fontID]->GetSize(); @@ -763,15 +763,15 @@ int32_t ewol::DrawText(int32_t fontID, clipping_ts & drawClipping, const uniChar_t unicodeChar, int32_t & fontTextureId, - etk::VectorType > & coord, - etk::VectorType & coordTex) + etk::Vector > & coord, + etk::Vector & coordTex) { #if 0 if(fontID>=m_listLoadedFont.Size() || fontID < 0) { EWOL_WARNING("try to display text with an fontID that does not existed " << fontID); return 0; } - etk::VectorType & listOfElement = m_listLoadedFont[fontID]->GetRefOnElement(); + etk::Vector & listOfElement = m_listLoadedFont[fontID]->GetRefOnElement(); fontTextureId = m_listLoadedFont[fontID]->GetOglId(); int32_t fontSize = m_listLoadedFont[fontID]->GetSize(); @@ -920,14 +920,14 @@ int32_t ewol::DrawText(int32_t fontID, Vector2D textPos, const etk::UString& unicodeString, int32_t & fontTextureId, - etk::VectorType > & coord, - etk::VectorType & coordTex) + etk::Vector > & coord, + etk::Vector & coordTex) { if(fontID>=m_listLoadedFont.Size() || fontID < 0) { EWOL_WARNING("try to display text with an fontID that does not existed " << fontID); return 0; } - etk::VectorType & listOfElement = m_listLoadedFont[fontID]->GetRefOnElement(); + etk::Vector & listOfElement = m_listLoadedFont[fontID]->GetRefOnElement(); fontTextureId = m_listLoadedFont[fontID]->GetOglId(); int32_t fontSize = m_listLoadedFont[fontID]->GetSize(); @@ -1056,14 +1056,14 @@ int32_t ewol::DrawText(int32_t fontID, Vector2D textPos, const uniChar_t unicodeChar, int32_t & fontTextureId, - etk::VectorType > & coord, - etk::VectorType & coordTex) + etk::Vector > & coord, + etk::Vector & coordTex) { if(fontID>=m_listLoadedFont.Size() || fontID < 0) { EWOL_WARNING("try to display text with an fontID that does not existed " << fontID); return 0; } - etk::VectorType & listOfElement = m_listLoadedFont[fontID]->GetRefOnElement(); + etk::Vector & listOfElement = m_listLoadedFont[fontID]->GetRefOnElement(); fontTextureId = m_listLoadedFont[fontID]->GetOglId(); int32_t fontSize = m_listLoadedFont[fontID]->GetSize(); @@ -1187,7 +1187,7 @@ int32_t ewol::GetWidth(int32_t fontID, const etk::UString& unicodeString) EWOL_WARNING("try to display text with an fontID that does not existed " << fontID); return 0; } - etk::VectorType & listOfElement = m_listLoadedFont[fontID]->GetRefOnElement(); + etk::Vector & listOfElement = m_listLoadedFont[fontID]->GetRefOnElement(); float posDrawX = 0.0; for(int32_t iii=0; iii * tmpSprite = NULL; +static etk::Vector * tmpSprite = NULL; static ewol::SceneElement * tmpScene = NULL; template int index(lua_State* L); @@ -90,12 +90,12 @@ template class LuaValue lua_pushcfunction(L, newindex); lua_setfield(L, -2, "__newindex"); lua_setmetatable(L, -2); - lua_setglobal(L, name.Utf8Data()); + lua_setglobal(L, name.c_str()); } virtual ~LuaValue(void) { lua_pushnil(L); - lua_setglobal(L, name.Utf8Data()); + lua_setglobal(L, name.c_str()); ptr = 0; L = 0; } @@ -399,7 +399,7 @@ LUAMOD_API int lua_ElementAdd(lua_State *L) int32_t group = luaL_checkint(L, 2); // TODO : Remove this when find an other way do do it ... ewol::GameElementLua * ttmpObj = tmpObj; - etk::VectorType * ttmpSprite = tmpSprite; + etk::Vector * ttmpSprite = tmpSprite; ewol::SceneElement * ttmpScene = tmpScene; uint32_t elementId = tmpScene->AddElementNamed(group, elementName); tmpObj = ttmpObj; @@ -542,7 +542,7 @@ LUAMOD_API int lua_HaveImpact(lua_State *L) // TODO : Remove this when find an other way do do it ... ewol::GameElementLua * ttmpObj = tmpObj; - etk::VectorType * ttmpSprite = tmpSprite; + etk::Vector * ttmpSprite = tmpSprite; ewol::SceneElement * ttmpScene = tmpScene; bool result = tmpScene->HaveImpact(tmpObj->GroupGet(), tmpObj->TypeGet(), tmpObj->PositionGet(), tmpObj->SizeGet()); @@ -566,7 +566,7 @@ LUAMOD_API int lua_Explosion(lua_State *L) // TODO : Remove this when find an other way do do it ... ewol::GameElementLua * ttmpObj = tmpObj; - etk::VectorType * ttmpSprite = tmpSprite; + etk::Vector * ttmpSprite = tmpSprite; ewol::SceneElement * ttmpScene = tmpScene; tmpScene->Explosion(tmpObj->GroupGet(), tmpObj->TypeGet(), tmpObj->PositionGet(), 0.01, tmpObj->PowerGet()); @@ -674,7 +674,7 @@ ewol::GameElementLua::GameElementLua(ewol::SceneElement & sceneElement, etk::USt // close the file: fileElement.fClose(); - if (luaL_loadbuffer(m_luaState, fileBuffer, fileSize, tmpName.Utf8Data())) { + if (luaL_loadbuffer(m_luaState, fileBuffer, fileSize, tmpName.c_str())) { //if (luaL_loadfile(m_luaState, "/home/heero/dev/perso/TethysDefender/assets/elementGame/Cube.lua" ) ) { EWOL_ERROR("LUA: " << lua_tostring(m_luaState, -1)); return; @@ -899,8 +899,8 @@ void ewol::GameElementLua::Message(etk::UString control, etk::UString message) if(!lua_isfunction(m_luaState,-1)) { lua_pop(m_luaState,1); } else { - lua_pushstring(m_luaState, control.Utf8Data()); - lua_pushstring(m_luaState, message.Utf8Data()); + lua_pushstring(m_luaState, control.c_str()); + lua_pushstring(m_luaState, message.c_str()); // do the call (2 arguments, 0 result) if (lua_pcall(m_luaState, 2, 0, 0) != 0) { EWOL_ERROR("LUA: error running function 'Message':" << lua_tostring(m_luaState, -1)); diff --git a/Sources/libewol/ewol/Game/SceneElement.h b/Sources/libewol/ewol/Game/SceneElement.h index 1e1099f3..f96397f6 100644 --- a/Sources/libewol/ewol/Game/SceneElement.h +++ b/Sources/libewol/ewol/Game/SceneElement.h @@ -54,10 +54,10 @@ namespace ewol { int32_t numberOfGroup; //!< curent scene number of group etk::UString groupDescription[MAX_GROUP_NUMBER]; //!< name of all the groups int32_t groupEnemy[MAX_GROUP_NUMBER][MAX_GROUP_NUMBER]; //!< list of the ennemy - etk::VectorType animated; //!< element that must be display the second - etk::VectorType listAnimatedElements[MAX_GROUP_NUMBER]; //!< generic element to display order in the diffferent group - etk::VectorType listGarbage; //!< garbage of the old element allocated ==> prevent multiple alloc and free - etk::VectorType listCreatorElement; //!< list of all creatable elements + etk::Vector animated; //!< element that must be display the second + etk::Vector listAnimatedElements[MAX_GROUP_NUMBER]; //!< generic element to display order in the diffferent group + etk::Vector listGarbage; //!< garbage of the old element allocated ==> prevent multiple alloc and free + etk::Vector listCreatorElement; //!< list of all creatable elements int16_t GetUniqueId(void) { int16_t iddd = m_id; m_id++; return iddd; }; void RegisterElementType(etk::UString name, creatorElement_tf * loadElement, etk::UString userString); void RmElement(int32_t group, int32_t idElement); diff --git a/Sources/libewol/ewol/OObject.h b/Sources/libewol/ewol/OObject.h index 823d6934..a9c497f9 100644 --- a/Sources/libewol/ewol/OObject.h +++ b/Sources/libewol/ewol/OObject.h @@ -26,10 +26,11 @@ #define __EWOL_O_OBJECT_H__ #include +#include #include #include #include -#include +#include namespace ewol { extern "C" { diff --git a/Sources/libewol/ewol/OObject/2DColored.cpp b/Sources/libewol/ewol/OObject/2DColored.cpp index e8532241..5ced3da4 100644 --- a/Sources/libewol/ewol/OObject/2DColored.cpp +++ b/Sources/libewol/ewol/OObject/2DColored.cpp @@ -80,7 +80,7 @@ void ewol::OObject2DColored::Clear(void) } -void generatePolyGone(etk::VectorType > & input, etk::VectorType > & output ) +void generatePolyGone(etk::Vector > & input, etk::Vector > & output ) { if (input.Size()<3) { return; @@ -94,7 +94,7 @@ void generatePolyGone(etk::VectorType > & input, etk::VectorType //EWOL_DEBUG("generate Plygone : " << input.Size() << " ==> " << output.Size() ); } -void SutherlandHodgman(etk::VectorType > & input, etk::VectorType > & output, float sx, float sy, float ex, float ey) +void SutherlandHodgman(etk::Vector > & input, etk::Vector > & output, float sx, float sy, float ex, float ey) { // with Sutherland-Hodgman-Algorithm if (input.Size() <0) { @@ -298,7 +298,7 @@ void ewol::OObject2DColored::GenerateTriangle(void) } -void ewol::OObject2DColored::SetColor(color_ts color) +void ewol::OObject2DColored::SetColor(etk::Color color) { if (m_triElement < 1) { m_color[0] = color; @@ -315,22 +315,13 @@ void ewol::OObject2DColored::SetColor(color_ts color) void ewol::OObject2DColored::SetColor(float red, float green, float blue, float alpha) { if (m_triElement < 1) { - m_color[0].red = red*255; - m_color[0].green = green*255; - m_color[0].blue = blue*255; - m_color[0].alpha = alpha*255; + m_color[0] = etk::Color(red, green, blue, alpha); } if (m_triElement < 2) { - m_color[1].red = red*255; - m_color[1].green = green*255; - m_color[1].blue = blue*255; - m_color[1].alpha = alpha*255; + m_color[1] = etk::Color(red, green, blue, alpha); } if (m_triElement < 3) { - m_color[2].red = red*255; - m_color[2].green = green*255; - m_color[2].blue = blue*255; - m_color[2].alpha = alpha*255; + m_color[2] = etk::Color(red, green, blue, alpha); } } diff --git a/Sources/libewol/ewol/OObject/2DColored.h b/Sources/libewol/ewol/OObject/2DColored.h index ccebea7f..bd67ef0c 100644 --- a/Sources/libewol/ewol/OObject/2DColored.h +++ b/Sources/libewol/ewol/OObject/2DColored.h @@ -36,18 +36,18 @@ namespace ewol { public: virtual void Draw(void); protected: - etk::VectorType > m_coord; //!< internal coord of the object - etk::VectorType m_coordColor; //!< internal color of the different point - //etk::VectorType m_linkCoord; //!< internal link between point to generate triangle + etk::Vector > m_coord; //!< internal coord of the object + etk::Vector m_coordColor; //!< internal color of the different point + //etk::Vector m_linkCoord; //!< internal link between point to generate triangle int32_t m_triElement; - color_ts m_color[3]; + etk::Color m_color[3]; Vector2D m_triangle[3]; void GenerateTriangle(void); void ResetCount(void); public: void Clear(void); void SetColor(float red, float green, float blue, float alpha = 1.0); - void SetColor(color_ts color); + void SetColor(etk::Color color); void SetPoint(Vector2D point); void SetPoint(float x, float y); void Line(float sx, float sy, float ex, float ey, float thickness); diff --git a/Sources/libewol/ewol/OObject/2DText.cpp b/Sources/libewol/ewol/OObject/2DText.cpp index 72a45ed9..23bf088c 100644 --- a/Sources/libewol/ewol/OObject/2DText.cpp +++ b/Sources/libewol/ewol/OObject/2DText.cpp @@ -29,7 +29,7 @@ #undef __class__ #define __class__ "ewol::OObject2DText" -ewol::OObject2DText::OObject2DText(etk::UString FontName, int32_t size, color_ts textColorFg) +ewol::OObject2DText::OObject2DText(etk::UString FontName, int32_t size, etk::Color textColorFg) { m_textColorFg = textColorFg; if (FontName == "") { @@ -44,10 +44,7 @@ ewol::OObject2DText::OObject2DText(etk::UString FontName, int32_t size, color_ts // open with default font ... ewol::OObject2DText::OObject2DText(void) { - m_textColorFg.red = 0; - m_textColorFg.green = 0; - m_textColorFg.blue = 0; - m_textColorFg.alpha = 0xFF; + m_textColorFg = 0x000000FF; m_FontId = GetDefaultFontId(); } diff --git a/Sources/libewol/ewol/OObject/2DText.h b/Sources/libewol/ewol/OObject/2DText.h index 6a5f7c80..1c5741fc 100644 --- a/Sources/libewol/ewol/OObject/2DText.h +++ b/Sources/libewol/ewol/OObject/2DText.h @@ -32,7 +32,7 @@ namespace ewol { class OObject2DText :public ewol::OObject { public: - OObject2DText(etk::UString FontName, int32_t size, color_ts textColorFg); + OObject2DText(etk::UString FontName, int32_t size, etk::Color textColorFg); OObject2DText(void); virtual ~OObject2DText(void); public: @@ -43,10 +43,10 @@ namespace ewol { int32_t Text(Vector2D textPos, clipping_ts drawClipping, const uniChar_t unicodeChar); protected: int32_t m_FontId; //!< font internal ID - color_ts m_textColorFg; //!< text color ... + etk::Color m_textColorFg; //!< text color ... int32_t m_FontTextureId; //!< font internal Texture ID - etk::VectorType > m_coord; //!< internal coord of the object - etk::VectorType m_coordTex; //!< internal texture coordinate for every point + etk::Vector > m_coord; //!< internal coord of the object + etk::Vector m_coordTex; //!< internal texture coordinate for every point }; }; diff --git a/Sources/libewol/ewol/OObject/2DTextColored.cpp b/Sources/libewol/ewol/OObject/2DTextColored.cpp index 19328f8a..88defb23 100644 --- a/Sources/libewol/ewol/OObject/2DTextColored.cpp +++ b/Sources/libewol/ewol/OObject/2DTextColored.cpp @@ -31,7 +31,7 @@ ewol::OObject2DTextColored::OObject2DTextColored(etk::UString FontName, int32_t size) { - m_color = etk::color::color_Black; + m_color = etk::color::black; if (FontName == "") { m_FontId = GetDefaultFontId(); } else { @@ -48,7 +48,7 @@ ewol::OObject2DTextColored::OObject2DTextColored(etk::UString FontName, int32_t ewol::OObject2DTextColored::OObject2DTextColored(int32_t fontID) { - m_color = etk::color::color_Black; + m_color = etk::color::black; if (fontID < 0) { m_FontId = GetDefaultFontId(); } else { @@ -60,7 +60,7 @@ ewol::OObject2DTextColored::OObject2DTextColored(int32_t fontID) // open with default font ... ewol::OObject2DTextColored::OObject2DTextColored(void) { - m_color = etk::color::color_Black; + m_color = etk::color::black; m_FontId = GetDefaultFontId(); } @@ -140,7 +140,7 @@ int32_t ewol::OObject2DTextColored::Text(Vector2D textPos, const uniChar_ } -void ewol::OObject2DTextColored::SetColor(color_ts color) +void ewol::OObject2DTextColored::SetColor(etk::Color color) { m_color = color; } @@ -148,7 +148,7 @@ void ewol::OObject2DTextColored::SetColor(color_ts color) void ewol::OObject2DTextColored::SetColor(float red, float green, float blue, float alpha) { - m_color = etk::color::Create(red, green, blue, alpha); + m_color = etk::Color(red, green, blue, alpha); } diff --git a/Sources/libewol/ewol/OObject/2DTextColored.h b/Sources/libewol/ewol/OObject/2DTextColored.h index 1566dc78..0b8e244e 100644 --- a/Sources/libewol/ewol/OObject/2DTextColored.h +++ b/Sources/libewol/ewol/OObject/2DTextColored.h @@ -38,18 +38,18 @@ namespace ewol { public: virtual void Draw(void); void SetColor(float red, float green, float blue, float alpha = 1.0); - void SetColor(color_ts color); + void SetColor(etk::Color color); // set a specific text void Clear(void); int32_t Text(Vector2D textPos, const etk::UString& unicodeString); int32_t Text(Vector2D textPos, const uniChar_t unicodeChar); protected: int32_t m_FontId; //!< font internal ID - color_ts m_color; //!< tmp text color ... + etk::Color m_color; //!< tmp text color ... int32_t m_FontTextureId; //!< font internal Texture ID - etk::VectorType > m_coord; //!< internal coord of the object - etk::VectorType m_coordTex; //!< internal texture coordinate for every point - etk::VectorType m_coordColor; //!< internal color of the different point + etk::Vector > m_coord; //!< internal coord of the object + etk::Vector m_coordTex; //!< internal texture coordinate for every point + etk::Vector m_coordColor; //!< internal color of the different point public: void SetFontID(int32_t fontID) { m_FontId = fontID; }; int32_t GetFontID(void) { return m_FontId; }; diff --git a/Sources/libewol/ewol/OObject/2DTextured.cpp b/Sources/libewol/ewol/OObject/2DTextured.cpp index d965f12c..854a8511 100644 --- a/Sources/libewol/ewol/OObject/2DTextured.cpp +++ b/Sources/libewol/ewol/OObject/2DTextured.cpp @@ -84,12 +84,12 @@ void ewol::OObject2DTextured::Clear(void) m_coordColor.Clear(); } -void ewol::OObject2DTextured::Rectangle(float x, float y, float w, float h, color_ts tmpColor) +void ewol::OObject2DTextured::Rectangle(float x, float y, float w, float h, etk::Color tmpColor) { Rectangle(x, y, w, h, 0.0, 0.0, 1.0, 1.0, tmpColor); } -void ewol::OObject2DTextured::Rectangle(float x, float y, float w, float h, float texX, float texY, float texSX, float texSY, color_ts tmpColor) +void ewol::OObject2DTextured::Rectangle(float x, float y, float w, float h, float texX, float texY, float texSX, float texSY, etk::Color tmpColor) { //EWOL_DEBUG("Add rectangle : ..."); Vector2D point; diff --git a/Sources/libewol/ewol/OObject/2DTextured.h b/Sources/libewol/ewol/OObject/2DTextured.h index 7c428b25..de8e4d67 100644 --- a/Sources/libewol/ewol/OObject/2DTextured.h +++ b/Sources/libewol/ewol/OObject/2DTextured.h @@ -37,13 +37,13 @@ namespace ewol { public: virtual void Draw(void); void Clear(void); - void Rectangle(float x, float y, float w, float h, float texX=0.0, float texY=0.0, float texSX=1.0, float texSY=1.0, color_ts tmpColor=0xFFFFFFFF); - void Rectangle(float x, float y, float w, float h, color_ts tmpColor); + void Rectangle(float x, float y, float w, float h, float texX=0.0, float texY=0.0, float texSX=1.0, float texSY=1.0, etk::Color tmpColor=etk::color::white); + void Rectangle(float x, float y, float w, float h, etk::Color tmpColor); protected: int32_t m_textureId; //!< texture internal ID - etk::VectorType > m_coord; //!< internal coord of the object - etk::VectorType m_coordTex; //!< internal texture coordinate for every point - etk::VectorType m_coordColor; //!< internal color of the different point + etk::Vector > m_coord; //!< internal coord of the object + etk::Vector m_coordTex; //!< internal texture coordinate for every point + etk::Vector m_coordColor; //!< internal color of the different point }; }; diff --git a/Sources/libewol/ewol/OObject/Sprite.cpp b/Sources/libewol/ewol/OObject/Sprite.cpp index f61fbf27..0295d2d3 100644 --- a/Sources/libewol/ewol/OObject/Sprite.cpp +++ b/Sources/libewol/ewol/OObject/Sprite.cpp @@ -90,7 +90,7 @@ void ewol::Sprite::Clear(void) void ewol::Sprite::Element(Vector2D pos, float size, float angle) { - color_ts tmpColor(0xFFFFFFFF); + etk::Color tmpColor(0xFFFFFFFF); Vector3D pos2; pos2.x = pos.x; pos2.y = pos.y; @@ -100,11 +100,11 @@ void ewol::Sprite::Element(Vector2D pos, float size, float angle) void ewol::Sprite::Element(Vector3D pos, float size, float angle) { - color_ts tmpColor(0xFFFFFFFF); + etk::Color tmpColor(0xFFFFFFFF); Element(pos, size, angle, tmpColor); } -void ewol::Sprite::Element(Vector2D pos, float size, float angle, color_ts tmpColor) +void ewol::Sprite::Element(Vector2D pos, float size, float angle, etk::Color tmpColor) { Vector3D pos2; pos2.x = pos.x; @@ -114,7 +114,7 @@ void ewol::Sprite::Element(Vector2D pos, float size, float angle, color_t } -void ewol::Sprite::Element(Vector3D pos, float size, float angle, color_ts tmpColor) +void ewol::Sprite::Element(Vector3D pos, float size, float angle, etk::Color tmpColor) { angle -= M_PI/4; size *= 0.7; diff --git a/Sources/libewol/ewol/OObject/Sprite.h b/Sources/libewol/ewol/OObject/Sprite.h index 283fa550..a0c07d87 100644 --- a/Sources/libewol/ewol/OObject/Sprite.h +++ b/Sources/libewol/ewol/OObject/Sprite.h @@ -40,14 +40,14 @@ namespace ewol { void Clear(void); void Element(Vector2D pos, float size, float angle); void Element(Vector3D pos, float size, float angle); - void Element(Vector2D pos, float size, float angle, color_ts tmpColor); - void Element(Vector3D pos, float size, float angle, color_ts tmpColor); + void Element(Vector2D pos, float size, float angle, etk::Color tmpColor); + void Element(Vector3D pos, float size, float angle, etk::Color tmpColor); bool HasName(etk::UString& name) { return name == m_name; }; protected: int32_t m_textureId; //!< texture internal ID - etk::VectorType > m_coord; //!< internal coord of the object - etk::VectorType m_coordTex; //!< internal texture coordinate for every point - etk::VectorType m_coordColor; //!< internal color of the different point + etk::Vector > m_coord; //!< internal coord of the object + etk::Vector m_coordTex; //!< internal texture coordinate for every point + etk::Vector m_coordColor; //!< internal color of the different point }; }; diff --git a/Sources/libewol/ewol/ShortCutManager.cpp b/Sources/libewol/ewol/ShortCutManager.cpp index a0ec7753..0542d21f 100644 --- a/Sources/libewol/ewol/ShortCutManager.cpp +++ b/Sources/libewol/ewol/ShortCutManager.cpp @@ -39,7 +39,7 @@ class EventShortCut { uniChar_t UnicodeValue; }; -static etk::VectorType l_inputShortCutEvent; //!< generic short-cut event +static etk::Vector l_inputShortCutEvent; //!< generic short-cut event void ewol::shortCut::Add(bool shift, bool control, bool alt, bool meta, uniChar_t unicodeValue, const char * generateEventId, etk::UString data) diff --git a/Sources/libewol/ewol/Texture.cpp b/Sources/libewol/ewol/Texture.cpp index a8afd645..f0424369 100644 --- a/Sources/libewol/ewol/Texture.cpp +++ b/Sources/libewol/ewol/Texture.cpp @@ -53,7 +53,7 @@ class LoadedTexture bool m_destroy; }; //! List of all Texture loaded ... -etk::VectorType l_listLoadedTexture; +etk::Vector l_listLoadedTexture; #undef __class__ #define __class__ "texture" diff --git a/Sources/libewol/ewol/Widget.h b/Sources/libewol/ewol/Widget.h index 9385daa0..d96abe6e 100644 --- a/Sources/libewol/ewol/Widget.h +++ b/Sources/libewol/ewol/Widget.h @@ -31,7 +31,7 @@ namespace ewol { class Widget; }; #include -#include +#include #include #include #include diff --git a/Sources/libewol/ewol/WidgetManager.cpp b/Sources/libewol/ewol/WidgetManager.cpp index e37d881d..edfb19ee 100644 --- a/Sources/libewol/ewol/WidgetManager.cpp +++ b/Sources/libewol/ewol/WidgetManager.cpp @@ -27,7 +27,7 @@ #include #include //#include -#include +#include #undef __class__ #define __class__ "WidgetManager" @@ -37,7 +37,7 @@ static bool IsInit = false; // For the focus Management static ewol::Widget * m_focusWidgetDefault = NULL; static ewol::Widget * m_focusWidgetCurrent = NULL; -static etk::VectorType l_listOfPeriodicWidget; +static etk::Vector l_listOfPeriodicWidget; static bool l_havePeriodic = false; static bool l_haveRedraw = true; diff --git a/Sources/libewol/ewol/WidgetManager.h b/Sources/libewol/ewol/WidgetManager.h index 2d88e690..866963d5 100644 --- a/Sources/libewol/ewol/WidgetManager.h +++ b/Sources/libewol/ewol/WidgetManager.h @@ -28,7 +28,7 @@ #include #include #include -#include +#include #include namespace ewol { diff --git a/Sources/libewol/ewol/Windows.h b/Sources/libewol/ewol/Windows.h index ad587583..aee9ee85 100644 --- a/Sources/libewol/ewol/Windows.h +++ b/Sources/libewol/ewol/Windows.h @@ -27,7 +27,7 @@ #include #include -#include +#include #include namespace ewol { @@ -79,7 +79,7 @@ namespace ewol { } private: ewol::Widget* m_subWidget; - etk::VectorType m_popUpWidgetList; + etk::Vector m_popUpWidgetList; public: void SetSubWidget(ewol::Widget * widget); void PopUpWidgetPush(ewol::Widget * widget); diff --git a/Sources/libewol/ewol/base/MainThread.cpp b/Sources/libewol/ewol/base/MainThread.cpp index b9ed3fce..d97fc51c 100644 --- a/Sources/libewol/ewol/base/MainThread.cpp +++ b/Sources/libewol/ewol/base/MainThread.cpp @@ -171,15 +171,6 @@ void ewolProcessEvents(void) } } } - // pb here when dynamic widget ... - if (0 < nbEvent) { - //EWOL_DEBUG(" ******** Redraw"); - if(true == ewol::threadMsg::HasDisplayDone(androidJniMsg)) { - int64_t localTime = GetCurrentTime(); - ewol::widgetManager::PeriodicCall(localTime); - } - EWOL_NativeRegenerateDisplay(); - } } @@ -370,6 +361,12 @@ void guiSystem::Draw(void) { if (true == isGlobalSystemInit) { ewolProcessEvents(); + + int64_t localTime = GetCurrentTime(); + ewol::widgetManager::PeriodicCall(localTime); + + EWOL_NativeRegenerateDisplay(); + ewol::texture::UpdateContext(); EWOL_NativeRender(); } diff --git a/Sources/libewol/ewol/base/guiX11.cpp b/Sources/libewol/ewol/base/guiX11.cpp index a190efbc..1cc44c0e 100644 --- a/Sources/libewol/ewol/base/guiX11.cpp +++ b/Sources/libewol/ewol/base/guiX11.cpp @@ -281,7 +281,7 @@ static void local_SetTitle(etk::UString title) EWOL_INFO("X11: Set Title (START)"); #endif XTextProperty tp; - tp.value = (unsigned char *)title.Utf8Data(); + tp.value = (unsigned char *)title.c_str(); tp.encoding = XA_WM_NAME; tp.format = 8; tp.nitems = strlen((const char*)tp.value); @@ -593,9 +593,9 @@ void X11_Run(void) const char * magatTextToSend = NULL; if (req->selection == XAtomeSelection) { - magatTextToSend = l_clipBoardPrimary.Utf8Data(); + magatTextToSend = l_clipBoardPrimary.c_str(); } else if (req->selection == XAtomeClipBoard) { - magatTextToSend = l_clipBoardStd.Utf8Data(); + magatTextToSend = l_clipBoardStd.c_str(); } else { magatTextToSend = ""; } @@ -1182,7 +1182,7 @@ bool guiAbstraction::IsPressedInput(int32_t inputID) #include -static etk::VectorType listArgs; +static etk::Vector listArgs; int32_t ewol::CmdLineNb(void) { diff --git a/Sources/libewol/ewol/threadMsg.h b/Sources/libewol/ewol/threadMsg.h index 13288572..e20d97f8 100644 --- a/Sources/libewol/ewol/threadMsg.h +++ b/Sources/libewol/ewol/threadMsg.h @@ -53,7 +53,7 @@ namespace ewol { bool isInit; pthread_mutex_t mutex; pthread_cond_t condition; - //etk::VectorType + //etk::Vector threadMsgContent_ts listOfMessages[MSG_PRIO_NUMBER][NUMBER_OF_ELEMENT_IN_THE_FIFO]; int32_t nbMessages[MSG_PRIO_NUMBER]; bool displayHasDone; diff --git a/Sources/libewol/ewol/widget/Button.cpp b/Sources/libewol/ewol/widget/Button.cpp index 7444231b..b40950e5 100644 --- a/Sources/libewol/ewol/widget/Button.cpp +++ b/Sources/libewol/ewol/widget/Button.cpp @@ -68,9 +68,9 @@ void ewol::Button::Init(void) m_padding.x = 4; #endif - m_textColorFg = etk::color::color_Black; + m_textColorFg = etk::color::black; - m_textColorBg = etk::color::color_Black; + m_textColorBg = etk::color::black; m_textColorBg.alpha = 0x3F; SetCanHaveFocus(true); } diff --git a/Sources/libewol/ewol/widget/Button.h b/Sources/libewol/ewol/widget/Button.h index 538f9769..0ad53ab5 100644 --- a/Sources/libewol/ewol/widget/Button.h +++ b/Sources/libewol/ewol/widget/Button.h @@ -62,16 +62,16 @@ namespace ewol { bool GetValue(void); void SetAlignement(textAlignement_te typeAlign); void SetPadding(Vector2D newPadding); - void SetColorBg(color_ts newColor) { m_textColorBg = newColor; }; - void SetColorFg(color_ts newColor) { m_textColorFg = newColor; }; + void SetColorBg(etk::Color newColor) { m_textColorBg = newColor; }; + void SetColorFg(etk::Color newColor) { m_textColorFg = newColor; }; private: bool m_hasAnImage; etk::UString m_imageSelected; textAlignement_te m_alignement; Vector2D m_padding; etk::UString m_label; - color_ts m_textColorFg; //!< Text color - color_ts m_textColorBg; //!< Background color + etk::Color m_textColorFg; //!< Text color + etk::Color m_textColorBg; //!< Background color public: virtual void OnRegenerateDisplay(void); /** diff --git a/Sources/libewol/ewol/widget/ButtonColor.cpp b/Sources/libewol/ewol/widget/ButtonColor.cpp index 70fa0688..c9ed0f71 100644 --- a/Sources/libewol/ewol/widget/ButtonColor.cpp +++ b/Sources/libewol/ewol/widget/ButtonColor.cpp @@ -63,7 +63,7 @@ void ewol::ButtonColor::Init(void) #endif - m_textColorBg = etk::color::color_Black; + m_textColorBg = etk::color::black; m_textColorBg.alpha = 0x3F; m_widgetContextMenu = NULL; SetCanHaveFocus(true); @@ -160,15 +160,9 @@ void ewol::ButtonColor::OnRegenerateDisplay(void) tmpSizeY -= 2*m_padding.y; if ((m_textColorBg.red>0.5) || (m_textColorBg.green>0.5) || (m_textColorBg.blue > 0.8) ) { - m_textColorFg.red = 0.0; - m_textColorFg.green = 0.0; - m_textColorFg.blue = 0.0; - m_textColorFg.alpha = 1.0; + m_textColorFg = etk::color::black; } else { - m_textColorFg.red = 1.0; - m_textColorFg.green = 1.0; - m_textColorFg.blue = 1.0; - m_textColorFg.alpha = 1.0; + m_textColorFg = etk::color::white; } ewol::OObject2DText * tmpText = new ewol::OObject2DText("", -1, m_textColorFg); /* @@ -247,16 +241,12 @@ bool ewol::ButtonColor::OnEventInput(ewol::inputType_te type, int32_t IdInput, e } -void ewol::ButtonColor::SetCurrentColor(color_ts color) +void ewol::ButtonColor::SetCurrentColor(etk::Color color) { m_selectedColor = color; m_textColorBg = m_selectedColor; char colorText[256]; - sprintf(colorText, "#%02X%02X%02X%02X", - (uint8_t)(color.red * 0xFF), - (uint8_t)(color.green * 0xFF), - (uint8_t)(color.blue * 0xFF), - (uint8_t)(color.alpha * 0xFF)); + sprintf(colorText, "#%08X", color.Get()); //set the new label ... SetLabel(colorText); } @@ -272,16 +262,12 @@ void ewol::ButtonColor::OnReceiveMessage(ewol::EObject * CallerObject, const cha { if (eventId == ewolEventColorChooserChange) { // TODO : Parse the input color ... - //color_ts tmpColor(data); - color_ts tmpColor; + //etk::Color tmpColor(data); + etk::Color tmpColor; m_selectedColor = tmpColor; m_textColorBg = m_selectedColor; char colorText[256]; - sprintf(colorText, "#%02X%02X%02X%02X", - (uint8_t)(tmpColor.red * 0xFF), - (uint8_t)(tmpColor.green * 0xFF), - (uint8_t)(tmpColor.blue * 0xFF), - (uint8_t)(tmpColor.alpha * 0xFF)); + sprintf(colorText, "#%08X", tmpColor.Get()); //set the new label ... SetLabel(colorText); GenerateEventId(ewolEventButtonColorChange); diff --git a/Sources/libewol/ewol/widget/ButtonColor.h b/Sources/libewol/ewol/widget/ButtonColor.h index f7a413e2..c56c2d84 100644 --- a/Sources/libewol/ewol/widget/ButtonColor.h +++ b/Sources/libewol/ewol/widget/ButtonColor.h @@ -59,9 +59,9 @@ namespace ewol { textAlignement_te m_alignement; Vector2D m_padding; etk::UString m_label; - color_ts m_textColorFg; //!< Text color - color_ts m_textColorBg; //!< Background color - color_ts m_selectedColor; //!< user current selected Color + etk::Color m_textColorFg; //!< Text color + etk::Color m_textColorBg; //!< Background color + etk::Color m_selectedColor; //!< user current selected Color ewol::ContextMenu* m_widgetContextMenu; public: virtual void OnRegenerateDisplay(void); @@ -76,8 +76,8 @@ namespace ewol { * @return false the event is not used */ virtual bool OnEventInput(ewol::inputType_te type, int32_t IdInput, eventInputType_te typeEvent, Vector2D pos); - color_ts GetCurrentColor(void) { return m_selectedColor; }; - void SetCurrentColor(color_ts color); + etk::Color GetCurrentColor(void) { return m_selectedColor; }; + void SetCurrentColor(etk::Color color); /** * @brief Receive a message from an other EObject with a specific eventId and data * @param[in] CallerObject Pointer on the EObject that information came from diff --git a/Sources/libewol/ewol/widget/ButtonImage.cpp b/Sources/libewol/ewol/widget/ButtonImage.cpp index 1343633d..10cc1227 100644 --- a/Sources/libewol/ewol/widget/ButtonImage.cpp +++ b/Sources/libewol/ewol/widget/ButtonImage.cpp @@ -41,7 +41,7 @@ void ewol::WIDGET_ButtonImageInit(void) #undef __class__ #define __class__ "ButtonImage" -ewol::ButtonImage::ButtonImage(etk::UString imageName, color_ts col) +ewol::ButtonImage::ButtonImage(etk::UString imageName, etk::Color col) { AddEventId(ewolEventButtonPressed); AddEventId(ewolEventButtonDown); @@ -68,7 +68,7 @@ ewol::ButtonImage::~ButtonImage(void) } -void ewol::ButtonImage::SetImage(etk::UString imageName, color_ts col) +void ewol::ButtonImage::SetImage(etk::UString imageName, etk::Color col) { m_image = imageName; m_color = col; @@ -76,7 +76,7 @@ void ewol::ButtonImage::SetImage(etk::UString imageName, color_ts col) MarkToRedraw(); } -void ewol::ButtonImage::SetImageBG(etk::UString imageName, color_ts col) +void ewol::ButtonImage::SetImageBG(etk::UString imageName, etk::Color col) { m_imageBg1 = imageName; m_colorBg1 = col; @@ -84,7 +84,7 @@ void ewol::ButtonImage::SetImageBG(etk::UString imageName, color_ts col) MarkToRedraw(); } -void ewol::ButtonImage::SetImageSelected(etk::UString imageName, color_ts col) +void ewol::ButtonImage::SetImageSelected(etk::UString imageName, etk::Color col) { m_imageBg2 = imageName; m_colorBg2 = col; diff --git a/Sources/libewol/ewol/widget/ButtonImage.h b/Sources/libewol/ewol/widget/ButtonImage.h index 49839ff2..1f8e507b 100644 --- a/Sources/libewol/ewol/widget/ButtonImage.h +++ b/Sources/libewol/ewol/widget/ButtonImage.h @@ -34,7 +34,7 @@ namespace ewol { class ButtonImage :public ewol::Widget { public: - ButtonImage(etk::UString image, color_ts col=0xFFFFFFFF); + ButtonImage(etk::UString image, etk::Color col=0xFFFFFFFF); /** * @brief Get the current Object type of the EObject * @note In Embended platforme, it is many time no -rtti flag, then it is not possible to use dynamic cast ==> this will replace it @@ -44,9 +44,9 @@ namespace ewol { virtual const char * const GetObjectType(void) { return "EwolButtonImage"; }; void Init(void); virtual ~ButtonImage(void); - void SetImage(etk::UString imageName, color_ts col=0xFFFFFFFF); - void SetImageBG(etk::UString imageName, color_ts col=0xFFFFFFFF); - void SetImageSelected(etk::UString imageName, color_ts col=0xFFFFFFFF); + void SetImage(etk::UString imageName, etk::Color col=0xFFFFFFFF); + void SetImageBG(etk::UString imageName, etk::Color col=0xFFFFFFFF); + void SetImageSelected(etk::UString imageName, etk::Color col=0xFFFFFFFF); void SetValue(bool val); bool GetValue(void); void SetToggleMode(bool val); @@ -55,15 +55,15 @@ namespace ewol { etk::UString m_image; bool m_resetNeeded; ewol::OObject2DTextured* m_OOImage; - color_ts m_color; + etk::Color m_color; etk::UString m_imageBg1; ewol::OObject2DTextured* m_OOImageBg1; - color_ts m_colorBg1; + etk::Color m_colorBg1; etk::UString m_imageBg2; ewol::OObject2DTextured* m_OOImageBG2; - color_ts m_colorBg2; + etk::Color m_colorBg2; bool m_over; bool m_down; diff --git a/Sources/libewol/ewol/widget/CheckBox.cpp b/Sources/libewol/ewol/widget/CheckBox.cpp index 26baeb66..f3fda4fd 100644 --- a/Sources/libewol/ewol/widget/CheckBox.cpp +++ b/Sources/libewol/ewol/widget/CheckBox.cpp @@ -38,8 +38,8 @@ extern const char * const ewolEventCheckBoxClicked = "ewol CheckBox Clicked"; void ewol::CheckBox::Init(void) { AddEventId(ewolEventCheckBoxClicked); - m_textColorFg = etk::color::color_Black; - m_textColorBg = etk::color::color_White; + m_textColorFg = etk::color::black; + m_textColorBg = etk::color::white; m_value = false; SetCanHaveFocus(true); SetMouseLimit(1); diff --git a/Sources/libewol/ewol/widget/CheckBox.h b/Sources/libewol/ewol/widget/CheckBox.h index f231bf36..ce98cfac 100644 --- a/Sources/libewol/ewol/widget/CheckBox.h +++ b/Sources/libewol/ewol/widget/CheckBox.h @@ -53,8 +53,8 @@ namespace ewol { private: etk::UString m_label; bool m_value; - color_ts m_textColorFg; //!< Text color - color_ts m_textColorBg; //!< Background color + etk::Color m_textColorFg; //!< Text color + etk::Color m_textColorBg; //!< Background color public: virtual void OnRegenerateDisplay(void); public: diff --git a/Sources/libewol/ewol/widget/ColorBar.cpp b/Sources/libewol/ewol/widget/ColorBar.cpp index 8ac07608..e389b1e3 100644 --- a/Sources/libewol/ewol/widget/ColorBar.cpp +++ b/Sources/libewol/ewol/widget/ColorBar.cpp @@ -27,6 +27,7 @@ #include #include +#include extern const char * const ewolEventColorBarChange = "ewol-color-bar-change"; @@ -48,7 +49,7 @@ ewol::ColorBar::ColorBar(void) #endif m_currentUserPos.x=0; m_currentUserPos.y=0; - m_currentColor = etk::color::color_Black; + m_currentColor = etk::color::black; SetCanHaveFocus(true); } @@ -65,10 +66,10 @@ bool ewol::ColorBar::CalculateMinSize(void) MarkToRedraw(); return true; } -static color_ts s_listColorWhite(0xFFFFFFFF); -static color_ts s_listColorBlack(0x000000FF); +static etk::Color s_listColorWhite(0xFFFFFFFF); +static etk::Color s_listColorBlack(0x000000FF); #define NB_BAND_COLOR (6) -static color_ts s_listColor[NB_BAND_COLOR+1] = { +static etk::Color s_listColor[NB_BAND_COLOR+1] = { 0xFF0000FF, 0xFFFF00FF, 0x00FF00FF, @@ -78,14 +79,14 @@ static color_ts s_listColor[NB_BAND_COLOR+1] = { 0xFF0000FF }; -color_ts ewol::ColorBar::GetCurrentColor(void) +etk::Color ewol::ColorBar::GetCurrentColor(void) { return m_currentColor; } -void ewol::ColorBar::SetCurrentColor(color_ts newOne) +void ewol::ColorBar::SetCurrentColor(etk::Color newOne) { m_currentColor = newOne; - m_currentColor.alpha = 1.0; + m_currentColor.alpha = 0xFF; // estimate the cursor position : // TODO : Later when really needed ... } @@ -192,17 +193,12 @@ void ewol::ColorBar::OnRegenerateDisplay(void) tmpOObjects->SetPoint(tmpOriginX + (iii+0.5)*(tmpSizeX/NB_BAND_COLOR), tmpOriginY+tmpSizeY); */ } - color_ts tmpColor; + etk::Color tmpColor; if (m_currentUserPos.y > 0.5) { - tmpColor.red = 1.0; - tmpColor.green = 1.0; - tmpColor.blue = 1.0; + tmpColor = etk::color::white; } else { - tmpColor.red = 0.0; - tmpColor.green = 0.0; - tmpColor.blue = 0.0; + tmpColor = etk::color::black; } - tmpColor.alpha = 1.0; tmpOObjects->SetColor(tmpColor); tmpOObjects->Circle(m_currentUserPos.x*m_size.x, m_currentUserPos.y*m_size.y, 3.0, 1.0); @@ -240,8 +236,7 @@ bool ewol::ColorBar::OnEventInput(ewol::inputType_te type, int32_t IdInput, even float localPos = relativePos.x - (m_size.x/6) * bandID; float poroportionnalPos = localPos/(m_size.x/6); EWOL_VERBOSE("bandId=" << bandID << " relative pos=" << localPos); - color_ts estimateColor; - estimateColor.alpha = 1.0; + etk::Color estimateColor = etk::color::white; if (s_listColor[bandID].red == s_listColor[bandID+1].red) { estimateColor.red = s_listColor[bandID].red; } else if (s_listColor[bandID].red < s_listColor[bandID+1].red) { @@ -286,10 +281,7 @@ bool ewol::ColorBar::OnEventInput(ewol::inputType_te type, int32_t IdInput, even (uint8_t)(estimateColor.alpha * 0xFF)); EWOL_DEBUG("new color : " << colorText); */ - if( m_currentColor.red != estimateColor.red - || m_currentColor.green != estimateColor.green - || m_currentColor.blue != estimateColor.blue - || m_currentColor.alpha != estimateColor.alpha) { + if( m_currentColor != estimateColor) { m_currentColor = estimateColor; GenerateEventId(ewolEventColorBarChange); } diff --git a/Sources/libewol/ewol/widget/ColorBar.h b/Sources/libewol/ewol/widget/ColorBar.h index c7567b90..50fcb708 100644 --- a/Sources/libewol/ewol/widget/ColorBar.h +++ b/Sources/libewol/ewol/widget/ColorBar.h @@ -45,10 +45,10 @@ namespace ewol { */ virtual const char * const GetObjectType(void) { return "EwolColorBar"; }; virtual bool CalculateMinSize(void); - color_ts GetCurrentColor(void); - void SetCurrentColor(color_ts newOne); + etk::Color GetCurrentColor(void); + void SetCurrentColor(etk::Color newOne); private: - color_ts m_currentColor; + etk::Color m_currentColor; Vector2D m_currentUserPos; Vector2D m_padding; public: diff --git a/Sources/libewol/ewol/widget/ContextMenu.cpp b/Sources/libewol/ewol/widget/ContextMenu.cpp index d9abbcbc..f1529f23 100644 --- a/Sources/libewol/ewol/widget/ContextMenu.cpp +++ b/Sources/libewol/ewol/widget/ContextMenu.cpp @@ -40,9 +40,9 @@ ewol::ContextMenu::ContextMenu(void) m_padding.y = 4; m_offset = 20; - m_colorBackGroung = etk::color::color_White; + m_colorBackGroung = etk::color::white; - m_colorBorder = etk::color::color_Black; + m_colorBorder = etk::color::black; m_colorBorder.alpha = 0x7F; m_arrowPos.x = 0; diff --git a/Sources/libewol/ewol/widget/ContextMenu.h b/Sources/libewol/ewol/widget/ContextMenu.h index 0dcdab3a..b7a5ce9c 100644 --- a/Sources/libewol/ewol/widget/ContextMenu.h +++ b/Sources/libewol/ewol/widget/ContextMenu.h @@ -57,8 +57,8 @@ namespace ewol { virtual void SetExpendX(bool newExpend=false); virtual void SetExpendY(bool newExpend=false); private: - color_ts m_colorBackGroung; - color_ts m_colorBorder; + etk::Color m_colorBackGroung; + etk::Color m_colorBorder; Vector2D m_padding; Vector2D m_arrowPos; float m_offset; diff --git a/Sources/libewol/ewol/widget/Drawable.h b/Sources/libewol/ewol/widget/Drawable.h index 20aa740b..3c5950d7 100644 --- a/Sources/libewol/ewol/widget/Drawable.h +++ b/Sources/libewol/ewol/widget/Drawable.h @@ -44,7 +44,7 @@ namespace ewol { virtual const char * const GetObjectType(void) { return "EwolDrawable"; }; private: - etk::VectorType m_listOObject; //!< generic element to display... + etk::Vector m_listOObject; //!< generic element to display... public: void AddOObject(ewol::OObject* newObject, int32_t pos=-1); void ClearOObjectList(void); diff --git a/Sources/libewol/ewol/widget/Entry.cpp b/Sources/libewol/ewol/widget/Entry.cpp index 367922b4..144ed4df 100644 --- a/Sources/libewol/ewol/widget/Entry.cpp +++ b/Sources/libewol/ewol/widget/Entry.cpp @@ -51,9 +51,9 @@ void ewol::Entry::Init(void) m_borderSize = 2; m_paddingSize = 3; m_displayCursor = false; - m_textColorFg = etk::color::color_Black; + m_textColorFg = etk::color::black; - m_textColorBg = etk::color::color_White; + m_textColorBg = etk::color::white; m_textColorBg.alpha = 0xAF; SetCanHaveFocus(true); } diff --git a/Sources/libewol/ewol/widget/Entry.h b/Sources/libewol/ewol/widget/Entry.h index 74554fe2..d87262dc 100644 --- a/Sources/libewol/ewol/widget/Entry.h +++ b/Sources/libewol/ewol/widget/Entry.h @@ -57,8 +57,8 @@ namespace ewol { } private: etk::UString m_data; - color_ts m_textColorFg; //!< Text color - color_ts m_textColorBg; //!< Background color + etk::Color m_textColorFg; //!< Text color + etk::Color m_textColorBg; //!< Background color int32_t m_userSize; int32_t m_displayStartPosition; int32_t m_displayCursorPos; diff --git a/Sources/libewol/ewol/widget/Image.cpp b/Sources/libewol/ewol/widget/Image.cpp index fff4509c..8d724376 100644 --- a/Sources/libewol/ewol/widget/Image.cpp +++ b/Sources/libewol/ewol/widget/Image.cpp @@ -58,7 +58,7 @@ void ewol::Image::Init(void) m_padding.x = 4; #endif - m_textColorBg = etk::color::color_Black; + m_textColorBg = etk::color::black; m_textColorBg.alpha = 0x00; m_imageSize = 32; } diff --git a/Sources/libewol/ewol/widget/Image.h b/Sources/libewol/ewol/widget/Image.h index 88bd808b..2f1fedda 100644 --- a/Sources/libewol/ewol/widget/Image.h +++ b/Sources/libewol/ewol/widget/Image.h @@ -51,7 +51,7 @@ namespace ewol { private: etk::UString m_imageSelected; Vector2D m_padding; - color_ts m_textColorBg; //!< Background color + etk::Color m_textColorBg; //!< Background color int32_t m_imageSize; public: virtual void OnRegenerateDisplay(void); diff --git a/Sources/libewol/ewol/widget/Joystick.cpp b/Sources/libewol/ewol/widget/Joystick.cpp index 2bd0f945..cad9b4cf 100644 --- a/Sources/libewol/ewol/widget/Joystick.cpp +++ b/Sources/libewol/ewol/widget/Joystick.cpp @@ -103,9 +103,9 @@ ewol::Joystick::Joystick(void) m_lock = false; m_displayMode = ewol::JOYSTICK_NORMAL_MODE; - m_colorFg = etk::color::color_Blue; + m_colorFg = etk::color::blue; - m_colorBg = etk::color::color_Black; + m_colorBg = etk::color::black; m_colorBg.alpha = 0x3F; m_displayPos.x = 0.0; diff --git a/Sources/libewol/ewol/widget/Joystick.h b/Sources/libewol/ewol/widget/Joystick.h index e223fa0d..b13ab967 100644 --- a/Sources/libewol/ewol/widget/Joystick.h +++ b/Sources/libewol/ewol/widget/Joystick.h @@ -41,8 +41,8 @@ namespace ewol { class Joystick :public ewol::Drawable { private: - color_ts m_colorFg; //!< Forground color - color_ts m_colorBg; //!< Background color + etk::Color m_colorFg; //!< Forground color + etk::Color m_colorBg; //!< Background color Vector2D m_displayPos; //!< direction of the cursor ... float m_distance; //!< dintance from the center float m_angle; //!< angle of the arraw (if < 0 : No arraw...) 0 is the TOP ... diff --git a/Sources/libewol/ewol/widget/Label.cpp b/Sources/libewol/ewol/widget/Label.cpp index 100491e4..fe749768 100644 --- a/Sources/libewol/ewol/widget/Label.cpp +++ b/Sources/libewol/ewol/widget/Label.cpp @@ -39,7 +39,7 @@ extern const char * const ewolEventLabelPressed = "ewol Label Pressed"; void ewol::Label::Init(void) { AddEventId(ewolEventLabelPressed); - m_textColorFg = etk::color::color_Black; + m_textColorFg = etk::color::black; SetCanHaveFocus(false); } diff --git a/Sources/libewol/ewol/widget/Label.h b/Sources/libewol/ewol/widget/Label.h index ddaa8f43..2eb52ca0 100644 --- a/Sources/libewol/ewol/widget/Label.h +++ b/Sources/libewol/ewol/widget/Label.h @@ -50,7 +50,7 @@ namespace ewol { void SetLabel(etk::UString newLabel); private: etk::UString m_label; - color_ts m_textColorFg; //!< Text color + etk::Color m_textColorFg; //!< Text color public: virtual void OnRegenerateDisplay(void); public: diff --git a/Sources/libewol/ewol/widget/Layer.cpp b/Sources/libewol/ewol/widget/Layer.cpp index 1c21b4ed..92250b4f 100644 --- a/Sources/libewol/ewol/widget/Layer.cpp +++ b/Sources/libewol/ewol/widget/Layer.cpp @@ -118,7 +118,7 @@ void ewol::Layer::LockExpendContamination(bool lockExpend) m_lockExpendContamination = lockExpend; } -//etk::VectorType m_SubWidget; +//etk::Vector m_SubWidget; void ewol::Layer::SubWidgetRemoveAll(void) { diff --git a/Sources/libewol/ewol/widget/Layer.h b/Sources/libewol/ewol/widget/Layer.h index ee586c8e..59b26566 100644 --- a/Sources/libewol/ewol/widget/Layer.h +++ b/Sources/libewol/ewol/widget/Layer.h @@ -53,7 +53,7 @@ namespace ewol { void LockExpendContamination(bool lockExpend=false); private: bool m_lockExpendContamination; - etk::VectorType m_subWidget; + etk::Vector m_subWidget; public: virtual void SubWidgetRemoveAll(void); virtual void SubWidgetAdd(ewol::Widget* newWidget); diff --git a/Sources/libewol/ewol/widget/List.cpp b/Sources/libewol/ewol/widget/List.cpp index 72a0c34a..a4c760fd 100644 --- a/Sources/libewol/ewol/widget/List.cpp +++ b/Sources/libewol/ewol/widget/List.cpp @@ -141,10 +141,10 @@ void ewol::List::OnRegenerateDisplay(void) m_maxSize.y = (minHeight + 2*m_paddingSizeY) * nbRaw; - etk::VectorType listSizeColomn; + etk::Vector listSizeColomn; ewol::OObject2DColored * BGOObjects = new ewol::OObject2DColored(); - color_ts basicBG = GetBasicBG(); + etk::Color basicBG = GetBasicBG(); BGOObjects->SetColor(basicBG); BGOObjects->Rectangle(0, 0, m_size.x, m_size.y); @@ -172,8 +172,8 @@ void ewol::List::OnRegenerateDisplay(void) for(int32_t iii=startRaw; iiiSetColor(bg); BGOObjects->Rectangle(0, m_size.y - tmpOriginY, m_size.x, minHeight+2*m_paddingSizeY); diff --git a/Sources/libewol/ewol/widget/List.h b/Sources/libewol/ewol/widget/List.h index 51c9d762..f6e0d8d3 100644 --- a/Sources/libewol/ewol/widget/List.h +++ b/Sources/libewol/ewol/widget/List.h @@ -48,7 +48,7 @@ namespace ewol { void SetLabel(etk::UString newLabel); // Drawing capabilities .... private: - etk::VectorType m_listOObject; //!< generic element to display... + etk::Vector m_listOObject; //!< generic element to display... public: void AddOObject(ewol::OObject* newObject, int32_t pos=-1); void ClearOObjectList(void); @@ -74,21 +74,21 @@ namespace ewol { virtual bool OnEventInput(ewol::inputType_te type, int32_t IdInput, eventInputType_te typeEvent, Vector2D pos); protected: // function call to display the list : - virtual color_ts GetBasicBG(void) { - color_ts bg(0xFFFFFFFF); + virtual etk::Color GetBasicBG(void) { + etk::Color bg(0xFFFFFFFF); return bg; } virtual uint32_t GetNuberOfColomn(void) { return 0; }; - virtual bool GetTitle(int32_t colomn, etk::UString &myTitle, color_ts &fg, color_ts &bg) { + virtual bool GetTitle(int32_t colomn, etk::UString &myTitle, etk::Color &fg, etk::Color &bg) { myTitle = ""; return false; }; virtual uint32_t GetNuberOfRaw(void) { return 0; }; - virtual bool GetElement(int32_t colomn, int32_t raw, etk::UString &myTextToWrite, color_ts &fg, color_ts &bg) { + virtual bool GetElement(int32_t colomn, int32_t raw, etk::UString &myTextToWrite, etk::Color &fg, etk::Color &bg) { myTextToWrite = ""; bg = 0xFFFFFFFF; fg = 0x000000FF; diff --git a/Sources/libewol/ewol/widget/ListFileSystem.cpp b/Sources/libewol/ewol/widget/ListFileSystem.cpp index db99605d..e47b8b38 100644 --- a/Sources/libewol/ewol/widget/ListFileSystem.cpp +++ b/Sources/libewol/ewol/widget/ListFileSystem.cpp @@ -38,9 +38,9 @@ extern const char * const ewolEventFSFileValidate = "ewol-event-file-system-fi extern const char * const ewolEventFSFolderSelect = "ewol-event-file-system-folder-select"; extern const char * const ewolEventFSFolderValidate = "ewol-event-file-system-folder-validate"; -static void SortElementList(etk::VectorType &list) +static void SortElementList(etk::Vector &list) { - etk::VectorType tmpList = list; + etk::Vector tmpList = list; list.Clear(); for(int32_t iii=0; iii= 0 && raw < m_list.Size() && NULL != m_list[raw]) { myTextToWrite = m_list[raw]->m_name; } else { myTextToWrite = "ERROR"; } - fg = etk::color::color_Black; + fg = etk::color::black; if (raw % 2) { bg = 0xFFFFFF00; } else { diff --git a/Sources/libewol/ewol/widget/ListFileSystem.h b/Sources/libewol/ewol/widget/ListFileSystem.h index 6f86c028..0a442434 100644 --- a/Sources/libewol/ewol/widget/ListFileSystem.h +++ b/Sources/libewol/ewol/widget/ListFileSystem.h @@ -55,7 +55,7 @@ namespace ewol { class ListFileSystem : public ewol::List { private: - etk::VectorType m_list; + etk::Vector m_list; etk::UString m_folder; int32_t m_selectedLine; bool m_showFile; @@ -66,11 +66,11 @@ namespace ewol { ListFileSystem(void); ~ListFileSystem(void); // display API : - virtual color_ts GetBasicBG(void); + virtual etk::Color GetBasicBG(void); uint32_t GetNuberOfColomn(void); - bool GetTitle(int32_t colomn, etk::UString &myTitle, color_ts &fg, color_ts &bg); + bool GetTitle(int32_t colomn, etk::UString &myTitle, etk::Color &fg, etk::Color &bg); uint32_t GetNuberOfRaw(void); - bool GetElement(int32_t colomn, int32_t raw, etk::UString &myTextToWrite, color_ts &fg, color_ts &bg); + bool GetElement(int32_t colomn, int32_t raw, etk::UString &myTextToWrite, etk::Color &fg, etk::Color &bg); bool OnItemEvent(int32_t IdInput, ewol::eventInputType_te typeEvent, int32_t colomn, int32_t raw, float x, float y); /** * @brief Get the current Object type of the EObject diff --git a/Sources/libewol/ewol/widget/Menu.h b/Sources/libewol/ewol/widget/Menu.h index b8d40cbc..973e8d9f 100644 --- a/Sources/libewol/ewol/widget/Menu.h +++ b/Sources/libewol/ewol/widget/Menu.h @@ -64,7 +64,7 @@ namespace ewol { virtual void SubWidgetRemove(ewol::Widget* newWidget); virtual void SubWidgetUnLink(ewol::Widget* newWidget); private: - etk::VectorType m_listElement; + etk::Vector m_listElement; int32_t m_staticId; // unique ID for every element of the menu ... ewol::ContextMenu* m_widgetContextMenu; public: diff --git a/Sources/libewol/ewol/widget/PopUp.cpp b/Sources/libewol/ewol/widget/PopUp.cpp index 2e3a49a3..dd8b8309 100644 --- a/Sources/libewol/ewol/widget/PopUp.cpp +++ b/Sources/libewol/ewol/widget/PopUp.cpp @@ -36,12 +36,12 @@ ewol::PopUp::PopUp(void) : m_userExpendX = true; m_userExpendY = true; - m_colorBackGroung = etk::color::color_White; + m_colorBackGroung = etk::color::white; - m_colorEmptyArea = etk::color::color_Black; + m_colorEmptyArea = etk::color::black; m_colorEmptyArea.alpha = 0x7F; - m_colorBorder = etk::color::color_Black; + m_colorBorder = etk::color::black; m_colorBorder.alpha = 0x7F; m_subWidget = 0; diff --git a/Sources/libewol/ewol/widget/PopUp.h b/Sources/libewol/ewol/widget/PopUp.h index 0b8698a0..eb67c403 100644 --- a/Sources/libewol/ewol/widget/PopUp.h +++ b/Sources/libewol/ewol/widget/PopUp.h @@ -51,9 +51,9 @@ namespace ewol { virtual void SetExpendY(bool newExpend=false); void SetDisplayRatio(float ratio); private: - color_ts m_colorBackGroung; - color_ts m_colorBorder; - color_ts m_colorEmptyArea; + etk::Color m_colorBackGroung; + etk::Color m_colorBorder; + etk::Color m_colorEmptyArea; ewol::Widget* m_subWidgetNext; ewol::Widget* m_subWidget; float m_displayRatio; diff --git a/Sources/libewol/ewol/widget/ProgressBar.cpp b/Sources/libewol/ewol/widget/ProgressBar.cpp index 48474d0a..39247091 100644 --- a/Sources/libewol/ewol/widget/ProgressBar.cpp +++ b/Sources/libewol/ewol/widget/ProgressBar.cpp @@ -36,14 +36,11 @@ ewol::ProgressBar::ProgressBar(void) { m_value = 0.0; - m_textColorFg = etk::color::color_Black; + m_textColorFg = etk::color::black; - m_textColorBgOn.red = 0; - m_textColorBgOn.green = 0xFF; - m_textColorBgOn.blue = 0; - m_textColorBgOn.alpha = 0xFF; + m_textColorBgOn = 0x00FF00FF; - m_textColorBgOff = etk::color::color_Black; + m_textColorBgOff = etk::color::black; m_textColorBgOff.alpha = 0x3F; SetCanHaveFocus(true); } diff --git a/Sources/libewol/ewol/widget/ProgressBar.h b/Sources/libewol/ewol/widget/ProgressBar.h index 9cba6c27..77e616a2 100644 --- a/Sources/libewol/ewol/widget/ProgressBar.h +++ b/Sources/libewol/ewol/widget/ProgressBar.h @@ -46,12 +46,12 @@ namespace ewol { virtual bool CalculateMinSize(void); void ValueSet(float val); float ValueGet(void); - void SetColor(color_ts newColor) { m_textColorFg = newColor; }; + void SetColor(etk::Color newColor) { m_textColorFg = newColor; }; private: float m_value; //!< % used - color_ts m_textColorFg; //!< forder bar color - color_ts m_textColorBgOn; //!< bar color enable - color_ts m_textColorBgOff; //!< bar color disable + etk::Color m_textColorFg; //!< forder bar color + etk::Color m_textColorBgOn; //!< bar color enable + etk::Color m_textColorBgOff; //!< bar color disable public: virtual void OnRegenerateDisplay(void); }; diff --git a/Sources/libewol/ewol/widget/SizerHori.cpp b/Sources/libewol/ewol/widget/SizerHori.cpp index d970757d..48b0886f 100644 --- a/Sources/libewol/ewol/widget/SizerHori.cpp +++ b/Sources/libewol/ewol/widget/SizerHori.cpp @@ -158,7 +158,7 @@ void ewol::SizerHori::LockExpendContamination(bool lockExpend) m_lockExpendContamination = lockExpend; } -//etk::VectorType m_subWidget[m_currentCreateId]; +//etk::Vector m_subWidget[m_currentCreateId]; void ewol::SizerHori::SubWidgetRemoveAll(void) { diff --git a/Sources/libewol/ewol/widget/SizerHori.h b/Sources/libewol/ewol/widget/SizerHori.h index 053c5f94..0ce962dc 100644 --- a/Sources/libewol/ewol/widget/SizerHori.h +++ b/Sources/libewol/ewol/widget/SizerHori.h @@ -54,7 +54,7 @@ namespace ewol { void LockExpendContamination(bool lockExpend=false); private: bool m_lockExpendContamination; - etk::VectorType m_subWidget; + etk::Vector m_subWidget; public: virtual void SubWidgetRemoveAll(void); virtual void SubWidgetAdd(ewol::Widget* newWidget); diff --git a/Sources/libewol/ewol/widget/SizerVert.cpp b/Sources/libewol/ewol/widget/SizerVert.cpp index 72beae16..7340f946 100644 --- a/Sources/libewol/ewol/widget/SizerVert.cpp +++ b/Sources/libewol/ewol/widget/SizerVert.cpp @@ -161,7 +161,7 @@ void ewol::SizerVert::LockExpendContamination(bool lockExpend) m_lockExpendContamination = lockExpend; } -//etk::VectorType m_SubWidget; +//etk::Vector m_SubWidget; void ewol::SizerVert::SubWidgetRemoveAll(void) { diff --git a/Sources/libewol/ewol/widget/SizerVert.h b/Sources/libewol/ewol/widget/SizerVert.h index 01623ae2..2d3bb934 100644 --- a/Sources/libewol/ewol/widget/SizerVert.h +++ b/Sources/libewol/ewol/widget/SizerVert.h @@ -53,7 +53,7 @@ namespace ewol { void LockExpendContamination(bool lockExpend=false); private: bool m_lockExpendContamination; - etk::VectorType m_subWidget; + etk::Vector m_subWidget; public: virtual void SubWidgetRemoveAll(void); virtual void SubWidgetAdd(ewol::Widget* newWidget); diff --git a/Sources/libewol/ewol/widget/Slider.cpp b/Sources/libewol/ewol/widget/Slider.cpp index e0f1cc94..a44554f2 100644 --- a/Sources/libewol/ewol/widget/Slider.cpp +++ b/Sources/libewol/ewol/widget/Slider.cpp @@ -45,11 +45,9 @@ ewol::Slider::Slider(void) m_min = 0; m_max = 10; - m_textColorFg = etk::color::color_Black; + m_textColorFg = etk::color::black; - m_textColorBg.red = 0; - m_textColorBg.green = 0; - m_textColorBg.blue = 0; + m_textColorBg = etk::color::black; m_textColorBg.alpha = 0x3F; SetCanHaveFocus(true); } @@ -109,7 +107,7 @@ void ewol::Slider::OnRegenerateDisplay(void) tmpOObjects->SetColor(m_textColorFg); // draw a line : tmpOObjects->Line(dotRadius, m_size.y/2, m_size.x-dotRadius, m_size.y/2, 1); - color_ts borderDot = m_textColorFg; + etk::Color borderDot = m_textColorFg; borderDot.alpha /= 2; tmpOObjects->SetColor(borderDot); tmpOObjects->Disc(4+((float)(m_value-m_min)/(float)(m_max-m_min))*(float)(m_size.x-2*dotRadius), m_size.y/2, dotRadius); diff --git a/Sources/libewol/ewol/widget/Slider.h b/Sources/libewol/ewol/widget/Slider.h index 0871412c..697d07ef 100644 --- a/Sources/libewol/ewol/widget/Slider.h +++ b/Sources/libewol/ewol/widget/Slider.h @@ -49,13 +49,13 @@ namespace ewol { int32_t GetValue(void); void SetMin(int32_t val); void SetMax(int32_t val); - void SetColor(color_ts newColor) { m_textColorFg = newColor; }; + void SetColor(etk::Color newColor) { m_textColorFg = newColor; }; private: int32_t m_value; int32_t m_min; int32_t m_max; - color_ts m_textColorFg; //!< Text color - color_ts m_textColorBg; //!< Background color + etk::Color m_textColorFg; //!< Text color + etk::Color m_textColorBg; //!< Background color public: virtual void OnRegenerateDisplay(void); public: diff --git a/Sources/libewol/ewol/widget/Spacer.h b/Sources/libewol/ewol/widget/Spacer.h index 6ceb73f9..8d0ac20e 100644 --- a/Sources/libewol/ewol/widget/Spacer.h +++ b/Sources/libewol/ewol/widget/Spacer.h @@ -53,10 +53,10 @@ namespace ewol { */ virtual ewol::Widget * GetWidgetAtPos(Vector2D pos) { return NULL; }; virtual void OnRegenerateDisplay(void); - void SetColor(color_ts newColor) { m_color = newColor; MarkToRedraw(); }; + void SetColor(etk::Color newColor) { m_color = newColor; MarkToRedraw(); }; private: float m_localSize; - color_ts m_color; + etk::Color m_color; }; }; diff --git a/Sources/libewol/ewol/widget/WSlider.cpp b/Sources/libewol/ewol/widget/WSlider.cpp index 87ad3691..909e189b 100644 --- a/Sources/libewol/ewol/widget/WSlider.cpp +++ b/Sources/libewol/ewol/widget/WSlider.cpp @@ -140,7 +140,7 @@ void ewol::WSlider::LockExpendContamination(bool lockExpend) m_lockExpendContamination = lockExpend; } -//etk::VectorType m_SubWidget; +//etk::Vector m_SubWidget; void ewol::WSlider::SubWidgetRemoveAll(void) { diff --git a/Sources/libewol/ewol/widget/WSlider.h b/Sources/libewol/ewol/widget/WSlider.h index 737f0624..cbe711e1 100644 --- a/Sources/libewol/ewol/widget/WSlider.h +++ b/Sources/libewol/ewol/widget/WSlider.h @@ -53,7 +53,7 @@ namespace ewol { void LockExpendContamination(bool lockExpend=false); private: bool m_lockExpendContamination; - etk::VectorType m_subWidget; + etk::Vector m_subWidget; int32_t m_windowsSources; // widget source viewed int32_t m_windowsDestination; // widget destinated viewed int32_t m_slidingProgress; // ratio progression of a sliding diff --git a/Sources/libewol/ewol/widget/WidgetScrolled.h b/Sources/libewol/ewol/widget/WidgetScrolled.h index 8b76f837..00ebfd28 100644 --- a/Sources/libewol/ewol/widget/WidgetScrolled.h +++ b/Sources/libewol/ewol/widget/WidgetScrolled.h @@ -47,7 +47,7 @@ namespace ewol { class WidgetScrooled : public ewol::Widget { private: - etk::VectorType m_listOObject; //!< generic element to display... + etk::Vector m_listOObject; //!< generic element to display... void AddOObject(ewol::OObject* newObject, int32_t pos=-1); void ClearOObjectList(void); protected: diff --git a/Sources/libewol/ewol/widgetMeta/ColorChooser.cpp b/Sources/libewol/ewol/widgetMeta/ColorChooser.cpp index 8574c82c..5c90fcc1 100644 --- a/Sources/libewol/ewol/widgetMeta/ColorChooser.cpp +++ b/Sources/libewol/ewol/widgetMeta/ColorChooser.cpp @@ -29,7 +29,7 @@ #include #include //#include -#include +#include extern "C" { // file browsing ... @@ -71,8 +71,8 @@ ewol::ColorChooser::ColorChooser(void) */ SubWidgetAdd(m_widgetColorBar); - color_ts sliderColor; - sliderColor = etk::color::color_Black; + etk::Color sliderColor; + sliderColor = etk::color::black; m_widgetRed = new ewol::Slider(); m_widgetRed->RegisterOnEvent(this, ewolEventSliderChange, eventColorSpecificHasChange); @@ -80,18 +80,16 @@ ewol::ColorChooser::ColorChooser(void) m_widgetRed->SetFillX(true); m_widgetRed->SetMin(0); m_widgetRed->SetMax(255); - sliderColor.red = 0xFF; + sliderColor = 0xFF0000FF; m_widgetRed->SetColor(sliderColor); - sliderColor.red = 0; SubWidgetAdd(m_widgetRed); m_widgetGreen = new ewol::Slider(); m_widgetGreen->RegisterOnEvent(this, ewolEventSliderChange, eventColorSpecificHasChange); m_widgetGreen->SetExpendX(true); m_widgetGreen->SetFillX(true); m_widgetGreen->SetMin(0); - sliderColor.green = 0xFF; + sliderColor = 0x00FF00FF; m_widgetGreen->SetColor(sliderColor); - sliderColor.green = 0; m_widgetGreen->SetMax(255); SubWidgetAdd(m_widgetGreen); m_widgetBlue = new ewol::Slider(); @@ -99,9 +97,8 @@ ewol::ColorChooser::ColorChooser(void) m_widgetBlue->SetExpendX(true); m_widgetBlue->SetFillX(true); m_widgetBlue->SetMin(0); - sliderColor.blue = 0xFF; + sliderColor = 0x0000FFFF; m_widgetBlue->SetColor(sliderColor); - sliderColor.blue = 0; m_widgetBlue->SetMax(255); SubWidgetAdd(m_widgetBlue); m_widgetAlpha = new ewol::Slider(); @@ -112,7 +109,7 @@ ewol::ColorChooser::ColorChooser(void) m_widgetAlpha->SetMax(255); SubWidgetAdd(m_widgetAlpha); - m_currentColor = etk::color::color_White; + m_currentColor = etk::color::white; } @@ -122,7 +119,7 @@ ewol::ColorChooser::~ColorChooser(void) } -void ewol::ColorChooser::SetColor(color_ts newColor) +void ewol::ColorChooser::SetColor(etk::Color newColor) { m_currentColor = newColor; if (NULL != m_widgetRed) { @@ -143,7 +140,7 @@ void ewol::ColorChooser::SetColor(color_ts newColor) } -color_ts ewol::ColorChooser::GetColor(void) +etk::Color ewol::ColorChooser::GetColor(void) { return m_currentColor; } @@ -164,7 +161,7 @@ void ewol::ColorChooser::OnReceiveMessage(ewol::EObject * CallerObject, const ch //EWOL_INFO("Receive Extern Event ... : widgetPointer=" << CallerObject << "\"" << eventId << "\" ==> data=\"" << data << "\"" ); if (eventColorBarHasChange == eventId) { //==> colorBar has change ... - float tmpAlpha = m_currentColor.alpha; + uint8_t tmpAlpha = m_currentColor.alpha; // the colorbar has no notion of the alpha ==> keep it ... if (NULL != m_widgetColorBar) { m_currentColor = m_widgetColorBar->GetCurrentColor(); diff --git a/Sources/libewol/ewol/widgetMeta/ColorChooser.h b/Sources/libewol/ewol/widgetMeta/ColorChooser.h index 8502b48c..8ab13ce9 100644 --- a/Sources/libewol/ewol/widgetMeta/ColorChooser.h +++ b/Sources/libewol/ewol/widgetMeta/ColorChooser.h @@ -66,15 +66,15 @@ namespace ewol { */ virtual void OnObjectRemove(ewol::EObject * removeObject); - void SetColor(color_ts newColor); - color_ts GetColor(void); + void SetColor(etk::Color newColor); + etk::Color GetColor(void); private:; ewol::ColorBar* m_widgetColorBar; ewol::Slider* m_widgetRed; ewol::Slider* m_widgetGreen; ewol::Slider* m_widgetBlue; ewol::Slider* m_widgetAlpha; - color_ts m_currentColor; + etk::Color m_currentColor; }; }; diff --git a/Sources/libewol/ewol/widgetMeta/FileChooser.cpp b/Sources/libewol/ewol/widgetMeta/FileChooser.cpp index 9679fbe6..81e14164 100644 --- a/Sources/libewol/ewol/widgetMeta/FileChooser.cpp +++ b/Sources/libewol/ewol/widgetMeta/FileChooser.cpp @@ -30,7 +30,7 @@ #include #include //#include -#include +#include extern "C" { // file browsing ... @@ -354,7 +354,7 @@ void ewol::FileChooser::OnReceiveMessage(ewol::EObject * CallerObject, const cha char * ok; EWOL_DEBUG("new PATH : \"" << m_folder << "\""); - ok = realpath(m_folder.Utf8Data(), buf); + ok = realpath(m_folder.c_str(), buf); if (!ok) { EWOL_ERROR("Error to get the real path"); m_folder = "/"; @@ -387,7 +387,7 @@ void ewol::FileChooser::OnReceiveMessage(ewol::EObject * CallerObject, const cha char * ok; EWOL_DEBUG("new PATH : \"" << tmpUserFolder << "\""); - ok = realpath(tmpUserFolder.Utf8Data(), buf); + ok = realpath(tmpUserFolder.c_str(), buf); if (!ok) { EWOL_ERROR("Error to get the real path"); m_folder = "/"; diff --git a/Sources/libewol/ewol/widgetMeta/Parameter.cpp b/Sources/libewol/ewol/widgetMeta/Parameter.cpp index 189ca236..63e18368 100644 --- a/Sources/libewol/ewol/widgetMeta/Parameter.cpp +++ b/Sources/libewol/ewol/widgetMeta/Parameter.cpp @@ -29,7 +29,7 @@ #include #include #include -#include +#include #include @@ -203,7 +203,7 @@ void ewol::Parameter::OnReceiveMessage(ewol::EObject * CallerObject, const char } else if (eventId == l_eventMenuSelected) { if (NULL != m_wSlider) { int32_t value = 0; - sscanf(data.Utf8Data(), "%d", &value); + sscanf(data.c_str(), "%d", &value); EWOL_DEBUG("event on the parameter : " << eventId << " select ID=" << value << ""); m_wSlider->SubWidgetSelectSet(value); } diff --git a/Sources/libewol/ewol/widgetMeta/ParameterList.cpp b/Sources/libewol/ewol/widgetMeta/ParameterList.cpp index a6580553..87e13b21 100644 --- a/Sources/libewol/ewol/widgetMeta/ParameterList.cpp +++ b/Sources/libewol/ewol/widgetMeta/ParameterList.cpp @@ -148,7 +148,7 @@ void ewol::ParameterList::OnRegenerateDisplay(void) m_maxSize.y = (minHeight + 2*m_paddingSizeY) * nbRaw; - etk::VectorType listSizeColomn; + etk::Vector listSizeColomn; // set background color : ewol::OObject2DColored * BGOObjects = new ewol::OObject2DColored(); @@ -176,7 +176,7 @@ void ewol::ParameterList::OnRegenerateDisplay(void) for(int32_t iii=startRaw; iiim_label; } diff --git a/Sources/libewol/ewol/widgetMeta/ParameterList.h b/Sources/libewol/ewol/widgetMeta/ParameterList.h index 96d5bc55..6cf0c77f 100644 --- a/Sources/libewol/ewol/widgetMeta/ParameterList.h +++ b/Sources/libewol/ewol/widgetMeta/ParameterList.h @@ -55,7 +55,7 @@ namespace ewol { { private: int32_t m_idSelected; - etk::VectorType m_list; + etk::Vector m_list; public: ParameterList(void); /** @@ -70,7 +70,7 @@ namespace ewol { void SetLabel(etk::UString newLabel); // Drawing capabilities .... private: - etk::VectorType m_listOObject; //!< generic element to display... + etk::Vector m_listOObject; //!< generic element to display... public: void AddOObject(ewol::OObject* newObject, int32_t pos=-1); void ClearOObjectList(void); diff --git a/Sources/libewol/ewol/widgetMeta/StdPopUp.cpp b/Sources/libewol/ewol/widgetMeta/StdPopUp.cpp index 45c23039..7f4b33f1 100644 --- a/Sources/libewol/ewol/widgetMeta/StdPopUp.cpp +++ b/Sources/libewol/ewol/widgetMeta/StdPopUp.cpp @@ -29,7 +29,7 @@ #include #include #include -#include +#include #undef __class__ diff --git a/Sources/libparsersvg b/Sources/libparsersvg index fa80d21d..e2597ef3 160000 --- a/Sources/libparsersvg +++ b/Sources/libparsersvg @@ -1 +1 @@ -Subproject commit fa80d21d573ca2a349e9b23a5bc79f5e67bcf5f8 +Subproject commit e2597ef3153d850c3f5e9f0b4a58e86141c56693