Remove old theme manager and change the color system (add basic abstraction and default color definition)
This commit is contained in:
parent
e0416fc774
commit
9d60aa1a55
501
Sources/libetk/etk/Color.cpp
Normal file
501
Sources/libetk/etk/Color.cpp
Normal file
@ -0,0 +1,501 @@
|
|||||||
|
/**
|
||||||
|
*******************************************************************************
|
||||||
|
* @file etk/Color.h
|
||||||
|
* @brief Ewol Tool Kit : basic colors
|
||||||
|
* @author Edouard DUPIN
|
||||||
|
* @date 23/04/2012
|
||||||
|
* @par Project
|
||||||
|
* Ewol TK
|
||||||
|
*
|
||||||
|
* @par Copyright
|
||||||
|
* Copyright 2011 Edouard DUPIN, all right reserved
|
||||||
|
*
|
||||||
|
* This software is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
* ANY WARRANTY.
|
||||||
|
*
|
||||||
|
* Licence summary :
|
||||||
|
* You can modify and redistribute the sources code and binaries.
|
||||||
|
* You can send me the bug-fix
|
||||||
|
*
|
||||||
|
* Term of the licence in in the file licence.txt.
|
||||||
|
*
|
||||||
|
*******************************************************************************
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <etk/Types.h>
|
||||||
|
#include <etk/Color.h>
|
||||||
|
#include <etk/DebugInternal.h>
|
||||||
|
|
||||||
|
|
||||||
|
const color_ts etk::color::color_none = {0x00, 0x00, 0x00, 0x00};
|
||||||
|
const color_ts etk::color::color_AliceBlue = {0xF0, 0xF8, 0xFF, 0xFF};
|
||||||
|
const color_ts etk::color::color_AntiqueWhite = {0xFA, 0xEB, 0xD7, 0xFF};
|
||||||
|
const color_ts etk::color::color_Aqua = {0x00, 0xFF, 0xFF, 0xFF};
|
||||||
|
const color_ts etk::color::color_Aquamarine = {0x7F, 0xFF, 0xD4, 0xFF};
|
||||||
|
const color_ts etk::color::color_Azure = {0xF0, 0xFF, 0xFF, 0xFF};
|
||||||
|
const color_ts etk::color::color_Beige = {0xF5, 0xF5, 0xDC, 0xFF};
|
||||||
|
const color_ts etk::color::color_Bisque = {0xFF, 0xE4, 0xC4, 0xFF};
|
||||||
|
const color_ts etk::color::color_Black = {0x00, 0x00, 0x00, 0xFF};
|
||||||
|
const color_ts etk::color::color_BlanchedAlmond = {0xFF, 0xEB, 0xCD, 0xFF};
|
||||||
|
const color_ts etk::color::color_Blue = {0x00, 0x00, 0xFF, 0xFF};
|
||||||
|
const color_ts etk::color::color_BlueViolet = {0x8A, 0x2B, 0xE2, 0xFF};
|
||||||
|
const color_ts etk::color::color_Brown = {0xA5, 0x2A, 0x2A, 0xFF};
|
||||||
|
const color_ts etk::color::color_BurlyWood = {0xDE, 0xB8, 0x87, 0xFF};
|
||||||
|
const color_ts etk::color::color_CadetBlue = {0x5F, 0x9E, 0xA0, 0xFF};
|
||||||
|
const color_ts etk::color::color_Chartreuse = {0x7F, 0xFF, 0x00, 0xFF};
|
||||||
|
const color_ts etk::color::color_Chocolate = {0xD2, 0x69, 0x1E, 0xFF};
|
||||||
|
const color_ts etk::color::color_Coral = {0xFF, 0x7F, 0x50, 0xFF};
|
||||||
|
const color_ts etk::color::color_CornflowerBlue = {0x64, 0x95, 0xED, 0xFF};
|
||||||
|
const color_ts etk::color::color_Cornsilk = {0xFF, 0xF8, 0xDC, 0xFF};
|
||||||
|
const color_ts etk::color::color_Crimson = {0xDC, 0x14, 0x3C, 0xFF};
|
||||||
|
const color_ts etk::color::color_Cyan = {0x00, 0xFF, 0xFF, 0xFF};
|
||||||
|
const color_ts etk::color::color_DarkBlue = {0x00, 0x00, 0x8B, 0xFF};
|
||||||
|
const color_ts etk::color::color_DarkCyan = {0x00, 0x8B, 0x8B, 0xFF};
|
||||||
|
const color_ts etk::color::color_DarkGoldenRod = {0xB8, 0x86, 0x0B, 0xFF};
|
||||||
|
const color_ts etk::color::color_DarkGray = {0xA9, 0xA9, 0xA9, 0xFF};
|
||||||
|
const color_ts etk::color::color_DarkGrey = {0xA9, 0xA9, 0xA9, 0xFF};
|
||||||
|
const color_ts etk::color::color_DarkGreen = {0x00, 0x64, 0x00, 0xFF};
|
||||||
|
const color_ts etk::color::color_DarkKhaki = {0xBD, 0xB7, 0x6B, 0xFF};
|
||||||
|
const color_ts etk::color::color_DarkMagenta = {0x8B, 0x00, 0x8B, 0xFF};
|
||||||
|
const color_ts etk::color::color_DarkOliveGreen = {0x55, 0x6B, 0x2F, 0xFF};
|
||||||
|
const color_ts etk::color::color_Darkorange = {0xFF, 0x8C, 0x00, 0xFF};
|
||||||
|
const color_ts etk::color::color_DarkOrchid = {0x99, 0x32, 0xCC, 0xFF};
|
||||||
|
const color_ts etk::color::color_DarkRed = {0x8B, 0x00, 0x00, 0xFF};
|
||||||
|
const color_ts etk::color::color_DarkSalmon = {0xE9, 0x96, 0x7A, 0xFF};
|
||||||
|
const color_ts etk::color::color_DarkSeaGreen = {0x8F, 0xBC, 0x8F, 0xFF};
|
||||||
|
const color_ts etk::color::color_DarkSlateBlue = {0x48, 0x3D, 0x8B, 0xFF};
|
||||||
|
const color_ts etk::color::color_DarkSlateGray = {0x2F, 0x4F, 0x4F, 0xFF};
|
||||||
|
const color_ts etk::color::color_DarkSlateGrey = {0x2F, 0x4F, 0x4F, 0xFF};
|
||||||
|
const color_ts etk::color::color_DarkTurquoise = {0x00, 0xCE, 0xD1, 0xFF};
|
||||||
|
const color_ts etk::color::color_DarkViolet = {0x94, 0x00, 0xD3, 0xFF};
|
||||||
|
const color_ts etk::color::color_DeepPink = {0xFF, 0x14, 0x93, 0xFF};
|
||||||
|
const color_ts etk::color::color_DeepSkyBlue = {0x00, 0xBF, 0xFF, 0xFF};
|
||||||
|
const color_ts etk::color::color_DimGray = {0x69, 0x69, 0x69, 0xFF};
|
||||||
|
const color_ts etk::color::color_DimGrey = {0x69, 0x69, 0x69, 0xFF};
|
||||||
|
const color_ts etk::color::color_DodgerBlue = {0x1E, 0x90, 0xFF, 0xFF};
|
||||||
|
const color_ts etk::color::color_FireBrick = {0xB2, 0x22, 0x22, 0xFF};
|
||||||
|
const color_ts etk::color::color_FloralWhite = {0xFF, 0xFA, 0xF0, 0xFF};
|
||||||
|
const color_ts etk::color::color_ForestGreen = {0x22, 0x8B, 0x22, 0xFF};
|
||||||
|
const color_ts etk::color::color_Fuchsia = {0xFF, 0x00, 0xFF, 0xFF};
|
||||||
|
const color_ts etk::color::color_Gainsboro = {0xDC, 0xDC, 0xDC, 0xFF};
|
||||||
|
const color_ts etk::color::color_GhostWhite = {0xF8, 0xF8, 0xFF, 0xFF};
|
||||||
|
const color_ts etk::color::color_Gold = {0xFF, 0xD7, 0x00, 0xFF};
|
||||||
|
const color_ts etk::color::color_GoldenRod = {0xDA, 0xA5, 0x20, 0xFF};
|
||||||
|
const color_ts etk::color::color_Gray = {0x80, 0x80, 0x80, 0xFF};
|
||||||
|
const color_ts etk::color::color_Grey = {0x80, 0x80, 0x80, 0xFF};
|
||||||
|
const color_ts etk::color::color_Green = {0x00, 0x80, 0x00, 0xFF};
|
||||||
|
const color_ts etk::color::color_GreenYellow = {0xAD, 0xFF, 0x2F, 0xFF};
|
||||||
|
const color_ts etk::color::color_HoneyDew = {0xF0, 0xFF, 0xF0, 0xFF};
|
||||||
|
const color_ts etk::color::color_HotPink = {0xFF, 0x69, 0xB4, 0xFF};
|
||||||
|
const color_ts etk::color::color_IndianRed = {0xCD, 0x5C, 0x5C, 0xFF};
|
||||||
|
const color_ts etk::color::color_Indigo = {0x4B, 0x00, 0x82, 0xFF};
|
||||||
|
const color_ts etk::color::color_Ivory = {0xFF, 0xFF, 0xF0, 0xFF};
|
||||||
|
const color_ts etk::color::color_Khaki = {0xF0, 0xE6, 0x8C, 0xFF};
|
||||||
|
const color_ts etk::color::color_Lavender = {0xE6, 0xE6, 0xFA, 0xFF};
|
||||||
|
const color_ts etk::color::color_LavenderBlush = {0xFF, 0xF0, 0xF5, 0xFF};
|
||||||
|
const color_ts etk::color::color_LawnGreen = {0x7C, 0xFC, 0x00, 0xFF};
|
||||||
|
const color_ts etk::color::color_LemonChiffon = {0xFF, 0xFA, 0xCD, 0xFF};
|
||||||
|
const color_ts etk::color::color_LightBlue = {0xAD, 0xD8, 0xE6, 0xFF};
|
||||||
|
const color_ts etk::color::color_LightCoral = {0xF0, 0x80, 0x80, 0xFF};
|
||||||
|
const color_ts etk::color::color_LightCyan = {0xE0, 0xFF, 0xFF, 0xFF};
|
||||||
|
const color_ts etk::color::color_LightGoldenRodYellow = {0xFA, 0xFA, 0xD2, 0xFF};
|
||||||
|
const color_ts etk::color::color_LightGray = {0xD3, 0xD3, 0xD3, 0xFF};
|
||||||
|
const color_ts etk::color::color_LightGrey = {0xD3, 0xD3, 0xD3, 0xFF};
|
||||||
|
const color_ts etk::color::color_LightGreen = {0x90, 0xEE, 0x90, 0xFF};
|
||||||
|
const color_ts etk::color::color_LightPink = {0xFF, 0xB6, 0xC1, 0xFF};
|
||||||
|
const color_ts etk::color::color_LightSalmon = {0xFF, 0xA0, 0x7A, 0xFF};
|
||||||
|
const color_ts etk::color::color_LightSeaGreen = {0x20, 0xB2, 0xAA, 0xFF};
|
||||||
|
const color_ts etk::color::color_LightSkyBlue = {0x87, 0xCE, 0xFA, 0xFF};
|
||||||
|
const color_ts etk::color::color_LightSlateGray = {0x77, 0x88, 0x99, 0xFF};
|
||||||
|
const color_ts etk::color::color_LightSlateGrey = {0x77, 0x88, 0x99, 0xFF};
|
||||||
|
const color_ts etk::color::color_LightSteelBlue = {0xB0, 0xC4, 0xDE, 0xFF};
|
||||||
|
const color_ts etk::color::color_LightYellow = {0xFF, 0xFF, 0xE0, 0xFF};
|
||||||
|
const color_ts etk::color::color_Lime = {0x00, 0xFF, 0x00, 0xFF};
|
||||||
|
const color_ts etk::color::color_LimeGreen = {0x32, 0xCD, 0x32, 0xFF};
|
||||||
|
const color_ts etk::color::color_Linen = {0xFA, 0xF0, 0xE6, 0xFF};
|
||||||
|
const color_ts etk::color::color_Magenta = {0xFF, 0x00, 0xFF, 0xFF};
|
||||||
|
const color_ts etk::color::color_Maroon = {0x80, 0x00, 0x00, 0xFF};
|
||||||
|
const color_ts etk::color::color_MediumAquaMarine = {0x66, 0xCD, 0xAA, 0xFF};
|
||||||
|
const color_ts etk::color::color_MediumBlue = {0x00, 0x00, 0xCD, 0xFF};
|
||||||
|
const color_ts etk::color::color_MediumOrchid = {0xBA, 0x55, 0xD3, 0xFF};
|
||||||
|
const color_ts etk::color::color_MediumPurple = {0x93, 0x70, 0xD8, 0xFF};
|
||||||
|
const color_ts etk::color::color_MediumSeaGreen = {0x3C, 0xB3, 0x71, 0xFF};
|
||||||
|
const color_ts etk::color::color_MediumSlateBlue = {0x7B, 0x68, 0xEE, 0xFF};
|
||||||
|
const color_ts etk::color::color_MediumSpringGreen = {0x00, 0xFA, 0x9A, 0xFF};
|
||||||
|
const color_ts etk::color::color_MediumTurquoise = {0x48, 0xD1, 0xCC, 0xFF};
|
||||||
|
const color_ts etk::color::color_MediumVioletRed = {0xC7, 0x15, 0x85, 0xFF};
|
||||||
|
const color_ts etk::color::color_MidnightBlue = {0x19, 0x19, 0x70, 0xFF};
|
||||||
|
const color_ts etk::color::color_MintCream = {0xF5, 0xFF, 0xFA, 0xFF};
|
||||||
|
const color_ts etk::color::color_MistyRose = {0xFF, 0xE4, 0xE1, 0xFF};
|
||||||
|
const color_ts etk::color::color_Moccasin = {0xFF, 0xE4, 0xB5, 0xFF};
|
||||||
|
const color_ts etk::color::color_NavajoWhite = {0xFF, 0xDE, 0xAD, 0xFF};
|
||||||
|
const color_ts etk::color::color_Navy = {0x00, 0x00, 0x80, 0xFF};
|
||||||
|
const color_ts etk::color::color_OldLace = {0xFD, 0xF5, 0xE6, 0xFF};
|
||||||
|
const color_ts etk::color::color_Olive = {0x80, 0x80, 0x00, 0xFF};
|
||||||
|
const color_ts etk::color::color_OliveDrab = {0x6B, 0x8E, 0x23, 0xFF};
|
||||||
|
const color_ts etk::color::color_Orange = {0xFF, 0xA5, 0x00, 0xFF};
|
||||||
|
const color_ts etk::color::color_OrangeRed = {0xFF, 0x45, 0x00, 0xFF};
|
||||||
|
const color_ts etk::color::color_Orchid = {0xDA, 0x70, 0xD6, 0xFF};
|
||||||
|
const color_ts etk::color::color_PaleGoldenRod = {0xEE, 0xE8, 0xAA, 0xFF};
|
||||||
|
const color_ts etk::color::color_PaleGreen = {0x98, 0xFB, 0x98, 0xFF};
|
||||||
|
const color_ts etk::color::color_PaleTurquoise = {0xAF, 0xEE, 0xEE, 0xFF};
|
||||||
|
const color_ts etk::color::color_PaleVioletRed = {0xD8, 0x70, 0x93, 0xFF};
|
||||||
|
const color_ts etk::color::color_PapayaWhip = {0xFF, 0xEF, 0xD5, 0xFF};
|
||||||
|
const color_ts etk::color::color_PeachPuff = {0xFF, 0xDA, 0xB9, 0xFF};
|
||||||
|
const color_ts etk::color::color_Peru = {0xCD, 0x85, 0x3F, 0xFF};
|
||||||
|
const color_ts etk::color::color_Pink = {0xFF, 0xC0, 0xCB, 0xFF};
|
||||||
|
const color_ts etk::color::color_Plum = {0xDD, 0xA0, 0xDD, 0xFF};
|
||||||
|
const color_ts etk::color::color_PowderBlue = {0xB0, 0xE0, 0xE6, 0xFF};
|
||||||
|
const color_ts etk::color::color_Purple = {0x80, 0x00, 0x80, 0xFF};
|
||||||
|
const color_ts etk::color::color_Red = {0xFF, 0x00, 0x00, 0xFF};
|
||||||
|
const color_ts etk::color::color_RosyBrown = {0xBC, 0x8F, 0x8F, 0xFF};
|
||||||
|
const color_ts etk::color::color_RoyalBlue = {0x41, 0x69, 0xE1, 0xFF};
|
||||||
|
const color_ts etk::color::color_SaddleBrown = {0x8B, 0x45, 0x13, 0xFF};
|
||||||
|
const color_ts etk::color::color_Salmon = {0xFA, 0x80, 0x72, 0xFF};
|
||||||
|
const color_ts etk::color::color_SandyBrown = {0xF4, 0xA4, 0x60, 0xFF};
|
||||||
|
const color_ts etk::color::color_SeaGreen = {0x2E, 0x8B, 0x57, 0xFF};
|
||||||
|
const color_ts etk::color::color_SeaShell = {0xFF, 0xF5, 0xEE, 0xFF};
|
||||||
|
const color_ts etk::color::color_Sienna = {0xA0, 0x52, 0x2D, 0xFF};
|
||||||
|
const color_ts etk::color::color_Silver = {0xC0, 0xC0, 0xC0, 0xFF};
|
||||||
|
const color_ts etk::color::color_SkyBlue = {0x87, 0xCE, 0xEB, 0xFF};
|
||||||
|
const color_ts etk::color::color_SlateBlue = {0x6A, 0x5A, 0xCD, 0xFF};
|
||||||
|
const color_ts etk::color::color_SlateGray = {0x70, 0x80, 0x90, 0xFF};
|
||||||
|
const color_ts etk::color::color_SlateGrey = {0x70, 0x80, 0x90, 0xFF};
|
||||||
|
const color_ts etk::color::color_Snow = {0xFF, 0xFA, 0xFA, 0xFF};
|
||||||
|
const color_ts etk::color::color_SpringGreen = {0x00, 0xFF, 0x7F, 0xFF};
|
||||||
|
const color_ts etk::color::color_SteelBlue = {0x46, 0x82, 0xB4, 0xFF};
|
||||||
|
const color_ts etk::color::color_Tan = {0xD2, 0xB4, 0x8C, 0xFF};
|
||||||
|
const color_ts etk::color::color_Teal = {0x00, 0x80, 0x80, 0xFF};
|
||||||
|
const color_ts etk::color::color_Thistle = {0xD8, 0xBF, 0xD8, 0xFF};
|
||||||
|
const color_ts etk::color::color_Tomato = {0xFF, 0x63, 0x47, 0xFF};
|
||||||
|
const color_ts etk::color::color_Turquoise = {0x40, 0xE0, 0xD0, 0xFF};
|
||||||
|
const color_ts etk::color::color_Violet = {0xEE, 0x82, 0xEE, 0xFF};
|
||||||
|
const color_ts etk::color::color_Wheat = {0xF5, 0xDE, 0xB3, 0xFF};
|
||||||
|
const color_ts etk::color::color_White = {0xFF, 0xFF, 0xFF, 0xFF};
|
||||||
|
const color_ts etk::color::color_WhiteSmoke = {0xF5, 0xF5, 0xF5, 0xFF};
|
||||||
|
const color_ts etk::color::color_Yellow = {0xFF, 0xFF, 0x00, 0xFF};
|
||||||
|
const color_ts etk::color::color_YellowGreen = {0x9A, 0xCD, 0x32, 0xFF};
|
||||||
|
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
const char * colorName;
|
||||||
|
color_ts 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}
|
||||||
|
};
|
||||||
|
static const int32_t listOfColorSize = sizeof(listOfColor) / sizeof(colorList_ts);
|
||||||
|
|
||||||
|
|
||||||
|
static bool strnCmpNoCase(const char * input1, const char * input2, int32_t maxLen)
|
||||||
|
{
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @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)
|
||||||
|
{
|
||||||
|
color_ts localColor = etk::color::color_White;
|
||||||
|
|
||||||
|
uint32_t red, green, blue, alpha;
|
||||||
|
float fred, fgreen, fblue, falpha;
|
||||||
|
size_t len = strlen(inputData);
|
||||||
|
|
||||||
|
if( len >=1
|
||||||
|
&& 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);
|
||||||
|
} 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);
|
||||||
|
} 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;
|
||||||
|
} 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;
|
||||||
|
} else {
|
||||||
|
TK_ERROR(" pb in parsing the color : \"" << inputData << "\"");
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
TK_ERROR(" pb in parsing the color : \"" << inputData << "\" ==> unknown methode ...");
|
||||||
|
}
|
||||||
|
} else if( 4 <= len
|
||||||
|
&& inputData[0] == 'r'
|
||||||
|
&& 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);
|
||||||
|
} 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.);
|
||||||
|
} 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.);
|
||||||
|
} else {
|
||||||
|
TK_ERROR(" pb in parsing the color : \"" << inputData << "\" ==> unknown methode ...");
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
bool findIt = false;
|
||||||
|
// direct named color ...
|
||||||
|
for (int32_t iii=0; iii<listOfColorSize; iii++) {
|
||||||
|
if (strnCmpNoCase(listOfColor[iii].colorName, inputData, strlen(listOfColor[iii].colorName)) == true) {
|
||||||
|
findIt = true;
|
||||||
|
localColor = listOfColor[iii].color;
|
||||||
|
// stop searching
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// not find color ...
|
||||||
|
if (findIt == false) {
|
||||||
|
TK_ERROR(" pb in parsing the color : \"" << inputData << "\" not find ...");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
TK_VERBOSE("Parse color : \"" << inputData << "\" ==> " << localColor);
|
||||||
|
return localColor;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
color_ts etk::color::Create(uint32_t val)
|
||||||
|
{
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
color_ts etk::color::Create(uint8_t _red, uint8_t _green, uint8_t _blue, uint8_t _alpha)
|
||||||
|
{
|
||||||
|
color_ts tmpColor;
|
||||||
|
tmpColor.red =_red;
|
||||||
|
tmpColor.green=_green;
|
||||||
|
tmpColor.blue =_blue;
|
||||||
|
tmpColor.alpha=_alpha;
|
||||||
|
return tmpColor;
|
||||||
|
}
|
||||||
|
|
||||||
|
color_ts etk::color::Create(etkFloat_t _red, etkFloat_t _green, etkFloat_t _blue, etkFloat_t _alpha)
|
||||||
|
{
|
||||||
|
color_ts tmpColor;
|
||||||
|
_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);
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
191
Sources/libetk/etk/Color.h
Normal file
191
Sources/libetk/etk/Color.h
Normal file
@ -0,0 +1,191 @@
|
|||||||
|
/**
|
||||||
|
*******************************************************************************
|
||||||
|
* @file etk/Color.h
|
||||||
|
* @brief Ewol Tool Kit : basic colors
|
||||||
|
* @author Edouard DUPIN
|
||||||
|
* @date 23/04/2012
|
||||||
|
* @par Project
|
||||||
|
* Ewol TK
|
||||||
|
*
|
||||||
|
* @par Copyright
|
||||||
|
* Copyright 2011 Edouard DUPIN, all right reserved
|
||||||
|
*
|
||||||
|
* This software is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
* ANY WARRANTY.
|
||||||
|
*
|
||||||
|
* Licence summary :
|
||||||
|
* You can modify and redistribute the sources code and binaries.
|
||||||
|
* You can send me the bug-fix
|
||||||
|
*
|
||||||
|
* Term of the licence in in the file licence.txt.
|
||||||
|
*
|
||||||
|
*******************************************************************************
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef __ETK_COLOR_H__
|
||||||
|
#define __ETK_COLOR_H__
|
||||||
|
|
||||||
|
namespace etk {
|
||||||
|
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(etkFloat_t _red, etkFloat_t _green, etkFloat_t _blue, etkFloat_t _alpha=1.0);
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
@ -140,11 +140,6 @@ namespace etk{
|
|||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
CCout& operator << (color_ts t) {
|
CCout& operator << (color_ts t) {
|
||||||
snprintf(tmp, MAX_LOG_SIZE_TMP, "(r=%f,g=%f,b=%f,a=%f)", t.red, t.green, t.blue, t.alpha);
|
|
||||||
strncat(m_tmpChar, tmp, MAX_LOG_SIZE);
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
CCout& operator << (color8_ts t) {
|
|
||||||
snprintf(tmp, MAX_LOG_SIZE_TMP, "#%02X%02X%02X%02X", t.red, t.green, t.blue, t.alpha);
|
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);
|
strncat(m_tmpChar, tmp, MAX_LOG_SIZE);
|
||||||
return *this;
|
return *this;
|
||||||
|
@ -101,21 +101,14 @@ extern "C"
|
|||||||
etkFloat_t h;
|
etkFloat_t h;
|
||||||
}clipping_ts;
|
}clipping_ts;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct color_ts {
|
||||||
etkFloat_t red;
|
|
||||||
etkFloat_t green;
|
|
||||||
etkFloat_t blue;
|
|
||||||
etkFloat_t alpha;
|
|
||||||
}color_ts;
|
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
uint8_t red;
|
uint8_t red;
|
||||||
uint8_t green;
|
uint8_t green;
|
||||||
uint8_t blue;
|
uint8_t blue;
|
||||||
uint8_t alpha;
|
uint8_t alpha;
|
||||||
}color8_ts;
|
}color_ts;
|
||||||
}
|
}
|
||||||
|
#include <etk/Color.h>
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -9,6 +9,7 @@ FILE_LIST = \
|
|||||||
etk/UString.cpp \
|
etk/UString.cpp \
|
||||||
etk/Stream.cpp \
|
etk/Stream.cpp \
|
||||||
etk/File.cpp \
|
etk/File.cpp \
|
||||||
etk/RegExp.cpp
|
etk/RegExp.cpp \
|
||||||
|
etk/Color.cpp
|
||||||
|
|
||||||
|
|
||||||
|
@ -59,7 +59,8 @@ void ewol::OObject2DColored::Draw(void)
|
|||||||
|
|
||||||
// Set the vertex pointer to our vertex data
|
// Set the vertex pointer to our vertex data
|
||||||
glVertexPointer(2, oglTypeFloat_t, 0, &m_coord[0] );
|
glVertexPointer(2, oglTypeFloat_t, 0, &m_coord[0] );
|
||||||
glColorPointer(4, oglTypeFloat_t, 0, &m_coordColor[0] );
|
//glColorPointer(4, oglTypeFloat_t, 0, &m_coordColor[0] );
|
||||||
|
glColorPointer(4, GL_UNSIGNED_BYTE, 0, &m_coordColor[0] );
|
||||||
// Render : draw all of the triangles at once
|
// Render : draw all of the triangles at once
|
||||||
glDrawArrays( GL_TRIANGLES, 0, m_coord.Size());
|
glDrawArrays( GL_TRIANGLES, 0, m_coord.Size());
|
||||||
//glDrawElements( GL_TRIANGLES, 0, m_coord.Size());
|
//glDrawElements( GL_TRIANGLES, 0, m_coord.Size());
|
||||||
@ -315,22 +316,22 @@ void ewol::OObject2DColored::SetColor(color_ts color)
|
|||||||
void ewol::OObject2DColored::SetColor(etkFloat_t red, etkFloat_t green, etkFloat_t blue, etkFloat_t alpha)
|
void ewol::OObject2DColored::SetColor(etkFloat_t red, etkFloat_t green, etkFloat_t blue, etkFloat_t alpha)
|
||||||
{
|
{
|
||||||
if (m_triElement < 1) {
|
if (m_triElement < 1) {
|
||||||
m_color[0].red = red;
|
m_color[0].red = red*255;
|
||||||
m_color[0].green = green;
|
m_color[0].green = green*255;
|
||||||
m_color[0].blue = blue;
|
m_color[0].blue = blue*255;
|
||||||
m_color[0].alpha = alpha;
|
m_color[0].alpha = alpha*255;
|
||||||
}
|
}
|
||||||
if (m_triElement < 2) {
|
if (m_triElement < 2) {
|
||||||
m_color[1].red = red;
|
m_color[1].red = red*255;
|
||||||
m_color[1].green = green;
|
m_color[1].green = green*255;
|
||||||
m_color[1].blue = blue;
|
m_color[1].blue = blue*255;
|
||||||
m_color[1].alpha = alpha;
|
m_color[1].alpha = alpha*255;
|
||||||
}
|
}
|
||||||
if (m_triElement < 3) {
|
if (m_triElement < 3) {
|
||||||
m_color[2].red = red;
|
m_color[2].red = red*255;
|
||||||
m_color[2].green = green;
|
m_color[2].green = green*255;
|
||||||
m_color[2].blue = blue;
|
m_color[2].blue = blue*255;
|
||||||
m_color[2].alpha = alpha;
|
m_color[2].alpha = alpha*255;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -44,10 +44,10 @@ ewol::OObject2DText::OObject2DText(etk::UString FontName, int32_t size, color_ts
|
|||||||
// open with default font ...
|
// open with default font ...
|
||||||
ewol::OObject2DText::OObject2DText(void)
|
ewol::OObject2DText::OObject2DText(void)
|
||||||
{
|
{
|
||||||
m_textColorFg.red = 0.0;
|
m_textColorFg.red = 0;
|
||||||
m_textColorFg.green = 0.0;
|
m_textColorFg.green = 0;
|
||||||
m_textColorFg.blue = 0.0;
|
m_textColorFg.blue = 0;
|
||||||
m_textColorFg.alpha = 1.0;
|
m_textColorFg.alpha = 0xFF;
|
||||||
m_FontId = GetDefaultFontId();
|
m_FontId = GetDefaultFontId();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -63,7 +63,7 @@ void ewol::OObject2DText::Draw(void)
|
|||||||
//EWOL_WARNING("Nothink to draw...");
|
//EWOL_WARNING("Nothink to draw...");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
glColor4f(m_textColorFg.red, m_textColorFg.green, m_textColorFg.blue, m_textColorFg.alpha);
|
glColor4ub(m_textColorFg.red, m_textColorFg.green, m_textColorFg.blue, m_textColorFg.alpha);
|
||||||
glEnable(GL_TEXTURE_2D);
|
glEnable(GL_TEXTURE_2D);
|
||||||
glBindTexture(GL_TEXTURE_2D, ewol::texture::GetGLID(m_FontTextureId));
|
glBindTexture(GL_TEXTURE_2D, ewol::texture::GetGLID(m_FontTextureId));
|
||||||
glEnableClientState( GL_VERTEX_ARRAY ); // Enable Vertex Arrays
|
glEnableClientState( GL_VERTEX_ARRAY ); // Enable Vertex Arrays
|
||||||
|
@ -31,10 +31,7 @@
|
|||||||
|
|
||||||
ewol::OObject2DTextColored::OObject2DTextColored(etk::UString FontName, int32_t size)
|
ewol::OObject2DTextColored::OObject2DTextColored(etk::UString FontName, int32_t size)
|
||||||
{
|
{
|
||||||
m_color.red = 0.0;
|
m_color = etk::color::color_Black;
|
||||||
m_color.green = 0.0;
|
|
||||||
m_color.blue = 0.0;
|
|
||||||
m_color.alpha = 1.0;
|
|
||||||
if (FontName == "") {
|
if (FontName == "") {
|
||||||
m_FontId = GetDefaultFontId();
|
m_FontId = GetDefaultFontId();
|
||||||
} else {
|
} else {
|
||||||
@ -51,10 +48,7 @@ ewol::OObject2DTextColored::OObject2DTextColored(etk::UString FontName, int32_t
|
|||||||
|
|
||||||
ewol::OObject2DTextColored::OObject2DTextColored(int32_t fontID)
|
ewol::OObject2DTextColored::OObject2DTextColored(int32_t fontID)
|
||||||
{
|
{
|
||||||
m_color.red = 0.0;
|
m_color = etk::color::color_Black;
|
||||||
m_color.green = 0.0;
|
|
||||||
m_color.blue = 0.0;
|
|
||||||
m_color.alpha = 1.0;
|
|
||||||
if (fontID < 0) {
|
if (fontID < 0) {
|
||||||
m_FontId = GetDefaultFontId();
|
m_FontId = GetDefaultFontId();
|
||||||
} else {
|
} else {
|
||||||
@ -66,10 +60,7 @@ ewol::OObject2DTextColored::OObject2DTextColored(int32_t fontID)
|
|||||||
// open with default font ...
|
// open with default font ...
|
||||||
ewol::OObject2DTextColored::OObject2DTextColored(void)
|
ewol::OObject2DTextColored::OObject2DTextColored(void)
|
||||||
{
|
{
|
||||||
m_color.red = 0.0;
|
m_color = etk::color::color_Black;
|
||||||
m_color.green = 0.0;
|
|
||||||
m_color.blue = 0.0;
|
|
||||||
m_color.alpha = 1.0;
|
|
||||||
m_FontId = GetDefaultFontId();
|
m_FontId = GetDefaultFontId();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -92,7 +83,7 @@ void ewol::OObject2DTextColored::Draw(void)
|
|||||||
glEnableClientState( GL_COLOR_ARRAY ); // Enable Color Arrays
|
glEnableClientState( GL_COLOR_ARRAY ); // Enable Color Arrays
|
||||||
glVertexPointer( 2, oglTypeFloat_t, 0, &m_coord[0] );
|
glVertexPointer( 2, oglTypeFloat_t, 0, &m_coord[0] );
|
||||||
glTexCoordPointer( 2, oglTypeFloat_t, 0, &m_coordTex[0] );
|
glTexCoordPointer( 2, oglTypeFloat_t, 0, &m_coordTex[0] );
|
||||||
glColorPointer( 4, oglTypeFloat_t, 0, &m_coordColor[0] );
|
glColorPointer( 4, GL_UNSIGNED_BYTE, 0, &m_coordColor[0] );
|
||||||
glDrawArrays( GL_TRIANGLES, 0, m_coord.Size());
|
glDrawArrays( GL_TRIANGLES, 0, m_coord.Size());
|
||||||
//EWOL_DEBUG("request draw of " << m_coord.Size() << " elements");
|
//EWOL_DEBUG("request draw of " << m_coord.Size() << " elements");
|
||||||
glDisableClientState( GL_COLOR_ARRAY ); // Disable Color Arrays
|
glDisableClientState( GL_COLOR_ARRAY ); // Disable Color Arrays
|
||||||
@ -157,10 +148,7 @@ void ewol::OObject2DTextColored::SetColor(color_ts color)
|
|||||||
|
|
||||||
void ewol::OObject2DTextColored::SetColor(etkFloat_t red, etkFloat_t green, etkFloat_t blue, etkFloat_t alpha)
|
void ewol::OObject2DTextColored::SetColor(etkFloat_t red, etkFloat_t green, etkFloat_t blue, etkFloat_t alpha)
|
||||||
{
|
{
|
||||||
m_color.red = red;
|
m_color = etk::color::Create(red, green, blue, alpha);
|
||||||
m_color.green = green;
|
|
||||||
m_color.blue = blue;
|
|
||||||
m_color.alpha = alpha;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -33,7 +33,6 @@
|
|||||||
#include <ewol/EObject.h>
|
#include <ewol/EObject.h>
|
||||||
#include <ewol/EObjectManager.h>
|
#include <ewol/EObjectManager.h>
|
||||||
#include <ewol/WidgetManager.h>
|
#include <ewol/WidgetManager.h>
|
||||||
#include <ewol/themeManager.h>
|
|
||||||
#include <ewol/ShortCutManager.h>
|
#include <ewol/ShortCutManager.h>
|
||||||
#include <ewol/base/eventInputManagement.h>
|
#include <ewol/base/eventInputManagement.h>
|
||||||
|
|
||||||
@ -112,7 +111,6 @@ static void* BaseAppEntry(void* param)
|
|||||||
ewol::eventInput::Init();
|
ewol::eventInput::Init();
|
||||||
ewol::widgetManager::Init();
|
ewol::widgetManager::Init();
|
||||||
ewol::texture::Init();
|
ewol::texture::Init();
|
||||||
ewol::theme::Init();
|
|
||||||
ewol::InitFont();
|
ewol::InitFont();
|
||||||
ewol::shortCut::Init();
|
ewol::shortCut::Init();
|
||||||
APP_Init();
|
APP_Init();
|
||||||
@ -217,7 +215,6 @@ static void* BaseAppEntry(void* param)
|
|||||||
ewol::widgetManager::UnInit();
|
ewol::widgetManager::UnInit();
|
||||||
ewol::EObjectMessageMultiCast::UnInit();
|
ewol::EObjectMessageMultiCast::UnInit();
|
||||||
ewol::EObjectManager::UnInit();
|
ewol::EObjectManager::UnInit();
|
||||||
ewol::theme::UnInit();
|
|
||||||
ewol::eventInput::UnInit();
|
ewol::eventInput::UnInit();
|
||||||
EWOL_DEBUG("==> Un-Init BThread (END)");
|
EWOL_DEBUG("==> Un-Init BThread (END)");
|
||||||
pthread_exit(NULL);
|
pthread_exit(NULL);
|
||||||
|
@ -1,47 +0,0 @@
|
|||||||
/**
|
|
||||||
*******************************************************************************
|
|
||||||
* @file ewol/theme/EolBase.cpp
|
|
||||||
* @brief basic ewol theme eol file basic element Virtual Classes (Sources)
|
|
||||||
* @author Edouard DUPIN
|
|
||||||
* @date 23/11/2011
|
|
||||||
* @par Project
|
|
||||||
* ewol
|
|
||||||
*
|
|
||||||
* @par Copyright
|
|
||||||
* Copyright 2011 Edouard DUPIN, all right reserved
|
|
||||||
*
|
|
||||||
* This software is distributed in the hope that it will be useful, but WITHOUT
|
|
||||||
* ANY WARRANTY.
|
|
||||||
*
|
|
||||||
* Licence summary :
|
|
||||||
* You can modify and redistribute the sources code and binaries.
|
|
||||||
* You can send me the bug-fix
|
|
||||||
*
|
|
||||||
* Term of the licence in in the file licence.txt.
|
|
||||||
*
|
|
||||||
*******************************************************************************
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <ewol/theme/Theme.h>
|
|
||||||
#include <ewol/theme/EolBase.h>
|
|
||||||
|
|
||||||
#undef __class__
|
|
||||||
#define __class__ "ewol::theme::EolBase"
|
|
||||||
|
|
||||||
|
|
||||||
ewol::theme::EolBase::EolBase(void)
|
|
||||||
{
|
|
||||||
//EWOL_DEBUG("new...");
|
|
||||||
}
|
|
||||||
|
|
||||||
ewol::theme::EolBase::~EolBase(void)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
void ewol::theme::EolBase::Parse(TiXmlNode * pNode)
|
|
||||||
{
|
|
||||||
EWOL_INFO("Element Base .. Generic ... nothing to parse..." );
|
|
||||||
}
|
|
||||||
*/
|
|
@ -1,50 +0,0 @@
|
|||||||
/**
|
|
||||||
*******************************************************************************
|
|
||||||
* @file ewol/theme/EolBase.h
|
|
||||||
* @brief basic ewol theme eol file basic element virtual Classes (Header)
|
|
||||||
* @author Edouard DUPIN
|
|
||||||
* @date 23/11/2011
|
|
||||||
* @par Project
|
|
||||||
* ewol
|
|
||||||
*
|
|
||||||
* @par Copyright
|
|
||||||
* Copyright 2011 Edouard DUPIN, all right reserved
|
|
||||||
*
|
|
||||||
* This software is distributed in the hope that it will be useful, but WITHOUT
|
|
||||||
* ANY WARRANTY.
|
|
||||||
*
|
|
||||||
* Licence summary :
|
|
||||||
* You can modify and redistribute the sources code and binaries.
|
|
||||||
* You can send me the bug-fix
|
|
||||||
*
|
|
||||||
* Term of the licence in in the file licence.txt.
|
|
||||||
*
|
|
||||||
*******************************************************************************
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#ifndef __EWOL_THEME_EOL_BASE__H__
|
|
||||||
#define __EWOL_THEME_EOL_BASE__H__
|
|
||||||
|
|
||||||
#include <etk/Types.h>
|
|
||||||
#include <etk/UString.h>
|
|
||||||
#include <ewol/OObject.h>
|
|
||||||
#include <tinyXML/tinyxml.h>
|
|
||||||
|
|
||||||
|
|
||||||
namespace ewol {
|
|
||||||
namespace theme {
|
|
||||||
class EolBase {
|
|
||||||
public:
|
|
||||||
EolBase(void);
|
|
||||||
virtual ~EolBase(void);
|
|
||||||
virtual void Parse(TiXmlNode * pNode) = 0;
|
|
||||||
virtual void Generate(const ewol::theme::Theme * myTheme, const ewol::theme::EolElement * myElement, ewol::OObject2DColored & newObject, etkFloat_t posX, etkFloat_t posY, etkFloat_t sizeX, etkFloat_t sizeY) = 0;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
@ -1,119 +0,0 @@
|
|||||||
/**
|
|
||||||
*******************************************************************************
|
|
||||||
* @file ewol/theme/EolBasicCircle.cpp
|
|
||||||
* @brief basic ewol theme eol file basic element type=Circle (Sources)
|
|
||||||
* @author Edouard DUPIN
|
|
||||||
* @date 23/11/2011
|
|
||||||
* @par Project
|
|
||||||
* ewol
|
|
||||||
*
|
|
||||||
* @par Copyright
|
|
||||||
* Copyright 2011 Edouard DUPIN, all right reserved
|
|
||||||
*
|
|
||||||
* This software is distributed in the hope that it will be useful, but WITHOUT
|
|
||||||
* ANY WARRANTY.
|
|
||||||
*
|
|
||||||
* Licence summary :
|
|
||||||
* You can modify and redistribute the sources code and binaries.
|
|
||||||
* You can send me the bug-fix
|
|
||||||
*
|
|
||||||
* Term of the licence in in the file licence.txt.
|
|
||||||
*
|
|
||||||
*******************************************************************************
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <ewol/theme/Theme.h>
|
|
||||||
#include <ewol/theme/EolBaseCircle.h>
|
|
||||||
|
|
||||||
#undef __class__
|
|
||||||
#define __class__ "ewol::theme::EolBaseCircle"
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
ewol::theme::EolBaseCircle::EolBaseCircle(void)
|
|
||||||
{
|
|
||||||
//EWOL_DEBUG("new element Base : Circle/Disk ...");
|
|
||||||
}
|
|
||||||
|
|
||||||
ewol::theme::EolBaseCircle::~EolBaseCircle(void)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
void ewol::theme::EolBaseCircle::Parse(TiXmlNode * pNode)
|
|
||||||
{
|
|
||||||
m_colorBG = pNode->ToElement()->Attribute("colorBG");
|
|
||||||
m_colorBorder = pNode->ToElement()->Attribute("colorBorder");
|
|
||||||
|
|
||||||
const char * tmp = pNode->ToElement()->Attribute("position");
|
|
||||||
if (NULL == tmp) {
|
|
||||||
m_posCenter.x=0;
|
|
||||||
m_posCenter.y=0;
|
|
||||||
} else {
|
|
||||||
double xxx,yyy;
|
|
||||||
// optimize for multiple type input ...
|
|
||||||
sscanf(tmp, "%lf;%lf", &xxx,&yyy);
|
|
||||||
m_posCenter.x=xxx;
|
|
||||||
m_posCenter.y=yyy;
|
|
||||||
}
|
|
||||||
|
|
||||||
tmp = pNode->ToElement()->Attribute("radius");
|
|
||||||
if (NULL == tmp) {
|
|
||||||
m_radius=0;
|
|
||||||
} else {
|
|
||||||
double tmpVal;
|
|
||||||
// optimize for multiple type input ...
|
|
||||||
sscanf(tmp, "%lf", &tmpVal);
|
|
||||||
m_radius=tmpVal;
|
|
||||||
}
|
|
||||||
|
|
||||||
tmp = pNode->ToElement()->Attribute("thickness");
|
|
||||||
if (NULL == tmp) {
|
|
||||||
m_thickness=0.01;
|
|
||||||
} else {
|
|
||||||
double tmpVal;
|
|
||||||
// optimize for multiple type input ...
|
|
||||||
sscanf(tmp, "%lf", &tmpVal);
|
|
||||||
m_thickness=tmpVal;
|
|
||||||
}
|
|
||||||
EWOL_DEBUG("(l " << pNode->Row() << ") Parse Base Element : \"Circle\" : pos(" << m_posCenter.x << "," << m_posCenter.y << ") radius=" << m_radius
|
|
||||||
<< " colorBG=\"" << m_colorBG << "\" colorBorder=\"" << m_colorBorder << "\" thickness=" << m_thickness);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void ewol::theme::EolBaseCircle::Generate(const ewol::theme::Theme * myTheme, const ewol::theme::EolElement * myElement, ewol::OObject2DColored & newObject, etkFloat_t posX, etkFloat_t posY, etkFloat_t sizeX, etkFloat_t sizeY)
|
|
||||||
{
|
|
||||||
if (m_colorBG != "") {
|
|
||||||
color_ts selectedColorBG = {1.0, 1.0, 1.0, 1.0};
|
|
||||||
bool res = false;
|
|
||||||
if (NULL != myElement) {
|
|
||||||
res = myElement->GetColor(m_colorBG, selectedColorBG);
|
|
||||||
}
|
|
||||||
// try from theme if not existed
|
|
||||||
if( false == res
|
|
||||||
&& NULL != myTheme ) {
|
|
||||||
myElement->GetColor(m_colorBG, selectedColorBG);
|
|
||||||
}
|
|
||||||
newObject.SetColor(selectedColorBG);
|
|
||||||
newObject.Disc(posX + m_posCenter.x*sizeX, posY + m_posCenter.y*sizeY, m_radius*(sizeX+sizeY)/2);
|
|
||||||
}
|
|
||||||
if (m_colorBorder != "") {
|
|
||||||
color_ts selectedColorBorder = {0.0, 0.0, 0.0, 1.0};
|
|
||||||
bool res = false;
|
|
||||||
// try get color for current element
|
|
||||||
if (NULL != myElement) {
|
|
||||||
res = myElement->GetColor(m_colorBorder, selectedColorBorder);
|
|
||||||
}
|
|
||||||
// try from theme if not existed
|
|
||||||
if( false == res
|
|
||||||
&& NULL != myTheme ) {
|
|
||||||
myElement->GetColor(m_colorBorder, selectedColorBorder);
|
|
||||||
}
|
|
||||||
newObject.SetColor(selectedColorBorder);
|
|
||||||
newObject.Circle(posX + m_posCenter.x*sizeX, posY + m_posCenter.y*sizeY, m_radius*(sizeX+sizeY)/2, m_thickness*(sizeX+sizeY)/2);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -1,57 +0,0 @@
|
|||||||
/**
|
|
||||||
*******************************************************************************
|
|
||||||
* @file ewol/theme/EolBasicCircle.h
|
|
||||||
* @brief basic ewol theme eol file basic element type=Circle (Header)
|
|
||||||
* @author Edouard DUPIN
|
|
||||||
* @date 23/11/2011
|
|
||||||
* @par Project
|
|
||||||
* ewol
|
|
||||||
*
|
|
||||||
* @par Copyright
|
|
||||||
* Copyright 2011 Edouard DUPIN, all right reserved
|
|
||||||
*
|
|
||||||
* This software is distributed in the hope that it will be useful, but WITHOUT
|
|
||||||
* ANY WARRANTY.
|
|
||||||
*
|
|
||||||
* Licence summary :
|
|
||||||
* You can modify and redistribute the sources code and binaries.
|
|
||||||
* You can send me the bug-fix
|
|
||||||
*
|
|
||||||
* Term of the licence in in the file licence.txt.
|
|
||||||
*
|
|
||||||
*******************************************************************************
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <ewol/theme/EolBase.h>
|
|
||||||
#include <ewol/theme/EolColor.h>
|
|
||||||
|
|
||||||
#ifndef __EWOL_THEME_EOL_BASE_CIRCLE_H__
|
|
||||||
#define __EWOL_THEME_EOL_BASE_CIRCLE_H__
|
|
||||||
|
|
||||||
namespace ewol {
|
|
||||||
namespace theme {
|
|
||||||
class EolBaseCircle : public EolBase {
|
|
||||||
public:
|
|
||||||
EolBaseCircle(void);
|
|
||||||
virtual ~EolBaseCircle(void);
|
|
||||||
/*
|
|
||||||
<circle colorBG="..." ==> generate condition to display background ...
|
|
||||||
colorBorder="..." ==> generate condition to display border ...
|
|
||||||
position="0.53;0.56"
|
|
||||||
radius="0.2"
|
|
||||||
thickness="0.05" ==> only if neededd by border, default 0.01
|
|
||||||
/>
|
|
||||||
*/
|
|
||||||
virtual void Parse(TiXmlNode * pNode);
|
|
||||||
virtual void Generate(const ewol::theme::Theme * myTheme, const ewol::theme::EolElement * myElement, ewol::OObject2DColored & newObject, etkFloat_t posX, etkFloat_t posY, etkFloat_t sizeX, etkFloat_t sizeY);
|
|
||||||
private:
|
|
||||||
etk::UString m_colorBG;
|
|
||||||
etk::UString m_colorBorder;
|
|
||||||
coord2D_ts m_posCenter;
|
|
||||||
etkFloat_t m_radius;
|
|
||||||
etkFloat_t m_thickness;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
#endif
|
|
||||||
|
|
@ -1,28 +0,0 @@
|
|||||||
/**
|
|
||||||
*******************************************************************************
|
|
||||||
* @file ewol/theme/EolBasicCirclePart.cpp
|
|
||||||
* @brief basic ewol theme eol file basic element type=CirclePart (Sources)
|
|
||||||
* @author Edouard DUPIN
|
|
||||||
* @date 23/11/2011
|
|
||||||
* @par Project
|
|
||||||
* ewol
|
|
||||||
*
|
|
||||||
* @par Copyright
|
|
||||||
* Copyright 2011 Edouard DUPIN, all right reserved
|
|
||||||
*
|
|
||||||
* This software is distributed in the hope that it will be useful, but WITHOUT
|
|
||||||
* ANY WARRANTY.
|
|
||||||
*
|
|
||||||
* Licence summary :
|
|
||||||
* You can modify and redistribute the sources code and binaries.
|
|
||||||
* You can send me the bug-fix
|
|
||||||
*
|
|
||||||
* Term of the licence in in the file licence.txt.
|
|
||||||
*
|
|
||||||
*******************************************************************************
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
#undef __class__
|
|
||||||
#define __class__ "ewol::theme::EolBaseCirclePart"
|
|
||||||
|
|
@ -1,32 +0,0 @@
|
|||||||
/**
|
|
||||||
*******************************************************************************
|
|
||||||
* @file ewol/theme/EolBasicCirclePart.h
|
|
||||||
* @brief basic ewol theme eol file basic element type=CirclePart (Header)
|
|
||||||
* @author Edouard DUPIN
|
|
||||||
* @date 23/11/2011
|
|
||||||
* @par Project
|
|
||||||
* ewol
|
|
||||||
*
|
|
||||||
* @par Copyright
|
|
||||||
* Copyright 2011 Edouard DUPIN, all right reserved
|
|
||||||
*
|
|
||||||
* This software is distributed in the hope that it will be useful, but WITHOUT
|
|
||||||
* ANY WARRANTY.
|
|
||||||
*
|
|
||||||
* Licence summary :
|
|
||||||
* You can modify and redistribute the sources code and binaries.
|
|
||||||
* You can send me the bug-fix
|
|
||||||
*
|
|
||||||
* Term of the licence in in the file licence.txt.
|
|
||||||
*
|
|
||||||
*******************************************************************************
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
#include <ewol/theme/EolBase.h>
|
|
||||||
|
|
||||||
#ifndef __EWOL_THEME_EOL_BASE_CIRCLE_PART_H__
|
|
||||||
#define __EWOL_THEME_EOL_BASE_CIRCLE_PART_H__
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
@ -1,101 +0,0 @@
|
|||||||
/**
|
|
||||||
*******************************************************************************
|
|
||||||
* @file ewol/theme/EolBaseLine.cpp
|
|
||||||
* @brief basic ewol theme eol file basic element type=Line (Sources)
|
|
||||||
* @author Edouard DUPIN
|
|
||||||
* @date 23/11/2011
|
|
||||||
* @par Project
|
|
||||||
* ewol
|
|
||||||
*
|
|
||||||
* @par Copyright
|
|
||||||
* Copyright 2011 Edouard DUPIN, all right reserved
|
|
||||||
*
|
|
||||||
* This software is distributed in the hope that it will be useful, but WITHOUT
|
|
||||||
* ANY WARRANTY.
|
|
||||||
*
|
|
||||||
* Licence summary :
|
|
||||||
* You can modify and redistribute the sources code and binaries.
|
|
||||||
* You can send me the bug-fix
|
|
||||||
*
|
|
||||||
* Term of the licence in in the file licence.txt.
|
|
||||||
*
|
|
||||||
*******************************************************************************
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <ewol/theme/Theme.h>
|
|
||||||
#include <ewol/theme/EolBaseLine.h>
|
|
||||||
|
|
||||||
#undef __class__
|
|
||||||
#define __class__ "ewol::theme::EolBaseLine"
|
|
||||||
|
|
||||||
|
|
||||||
ewol::theme::EolBaseLine::EolBaseLine(void)
|
|
||||||
{
|
|
||||||
//EWOL_DEBUG("new element Base : Line ...");
|
|
||||||
}
|
|
||||||
|
|
||||||
ewol::theme::EolBaseLine::~EolBaseLine(void)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void ewol::theme::EolBaseLine::Parse(TiXmlNode * pNode)
|
|
||||||
{
|
|
||||||
m_color = pNode->ToElement()->Attribute("color");
|
|
||||||
|
|
||||||
const char * tmp = pNode->ToElement()->Attribute("positionStart");
|
|
||||||
if (NULL == tmp) {
|
|
||||||
m_posStart.x=0;
|
|
||||||
m_posStart.y=0;
|
|
||||||
} else {
|
|
||||||
double xxx,yyy;
|
|
||||||
// optimize for multiple type input ...
|
|
||||||
sscanf(tmp, "%lf;%lf", &xxx,&yyy);
|
|
||||||
m_posStart.x=xxx;
|
|
||||||
m_posStart.y=yyy;
|
|
||||||
}
|
|
||||||
tmp = pNode->ToElement()->Attribute("positionStop");
|
|
||||||
if (NULL == tmp) {
|
|
||||||
m_posStop.x=0;
|
|
||||||
m_posStop.y=0;
|
|
||||||
} else {
|
|
||||||
double xxx,yyy;
|
|
||||||
// optimize for multiple type input ...
|
|
||||||
sscanf(tmp, "%lf;%lf", &xxx,&yyy);
|
|
||||||
m_posStop.x=xxx;
|
|
||||||
m_posStop.y=yyy;
|
|
||||||
}
|
|
||||||
tmp = pNode->ToElement()->Attribute("thickness");
|
|
||||||
if (NULL == tmp) {
|
|
||||||
m_thickness=0.01;
|
|
||||||
} else {
|
|
||||||
double tmpVal;
|
|
||||||
// optimize for multiple type input ...
|
|
||||||
sscanf(tmp, "%lf", &tmpVal);
|
|
||||||
m_thickness=tmpVal;
|
|
||||||
}
|
|
||||||
EWOL_DEBUG("(l " << pNode->Row() << ") Parse Base Element : \"line\" : pos(" << m_posStart.x << "," << m_posStart.y << ") to pos(" << m_posStop.x << "," << m_posStop.y << ") thickness=" << m_thickness);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void ewol::theme::EolBaseLine::Generate(const ewol::theme::Theme * myTheme, const ewol::theme::EolElement * myElement, ewol::OObject2DColored & newObject, etkFloat_t posX, etkFloat_t posY, etkFloat_t sizeX, etkFloat_t sizeY)
|
|
||||||
{
|
|
||||||
bool res = false;
|
|
||||||
color_ts selectedColor = {0.0, 0.0, 0.0, 1.0};
|
|
||||||
// try get color for current element
|
|
||||||
if (NULL != myElement) {
|
|
||||||
res = myElement->GetColor(m_color, selectedColor);
|
|
||||||
}
|
|
||||||
// try from theme if not existed
|
|
||||||
if( false == res
|
|
||||||
&& NULL != myTheme ) {
|
|
||||||
myElement->GetColor(m_color, selectedColor);
|
|
||||||
}
|
|
||||||
newObject.SetColor(selectedColor);
|
|
||||||
newObject.Line(posX + m_posStart.x*sizeX, posY + m_posStart.y*sizeY, posX + m_posStop.x*sizeX, posY + m_posStop.y*sizeY, m_thickness*(sizeX+sizeY)/2);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -1,58 +0,0 @@
|
|||||||
/**
|
|
||||||
*******************************************************************************
|
|
||||||
* @file ewol/theme/EolBaseLine.h
|
|
||||||
* @brief basic ewol theme eol file basic element type=Line (Header)
|
|
||||||
* @author Edouard DUPIN
|
|
||||||
* @date 23/11/2011
|
|
||||||
* @par Project
|
|
||||||
* ewol
|
|
||||||
*
|
|
||||||
* @par Copyright
|
|
||||||
* Copyright 2011 Edouard DUPIN, all right reserved
|
|
||||||
*
|
|
||||||
* This software is distributed in the hope that it will be useful, but WITHOUT
|
|
||||||
* ANY WARRANTY.
|
|
||||||
*
|
|
||||||
* Licence summary :
|
|
||||||
* You can modify and redistribute the sources code and binaries.
|
|
||||||
* You can send me the bug-fix
|
|
||||||
*
|
|
||||||
* Term of the licence in in the file licence.txt.
|
|
||||||
*
|
|
||||||
*******************************************************************************
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
#include <ewol/theme/EolBase.h>
|
|
||||||
#include <ewol/theme/EolColor.h>
|
|
||||||
|
|
||||||
#ifndef __EWOL_THEME_EOL_BASE_LINE_H__
|
|
||||||
#define __EWOL_THEME_EOL_BASE_LINE_H__
|
|
||||||
|
|
||||||
namespace ewol {
|
|
||||||
namespace theme {
|
|
||||||
class EolBaseLine : public EolBase {
|
|
||||||
public:
|
|
||||||
EolBaseLine(void);
|
|
||||||
virtual ~EolBaseLine(void);
|
|
||||||
/*
|
|
||||||
<line color="..."
|
|
||||||
positionStart="0.53;0.56"
|
|
||||||
positionStop="0.22;0.11"
|
|
||||||
thickness="0.05"
|
|
||||||
/>
|
|
||||||
*/
|
|
||||||
virtual void Parse(TiXmlNode * pNode);
|
|
||||||
virtual void Generate(const ewol::theme::Theme * myTheme, const ewol::theme::EolElement * myElement, ewol::OObject2DColored & newObject, etkFloat_t posX, etkFloat_t posY, etkFloat_t sizeX, etkFloat_t sizeY);
|
|
||||||
private:
|
|
||||||
etk::UString m_color;
|
|
||||||
coord2D_ts m_posStart;
|
|
||||||
coord2D_ts m_posStop;
|
|
||||||
etkFloat_t m_thickness;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
@ -1,28 +0,0 @@
|
|||||||
/**
|
|
||||||
*******************************************************************************
|
|
||||||
* @file ewol/theme/EolBasePolygone.cpp
|
|
||||||
* @brief basic ewol theme eol file basic element type=polygone (Sources)
|
|
||||||
* @author Edouard DUPIN
|
|
||||||
* @date 23/11/2011
|
|
||||||
* @par Project
|
|
||||||
* ewol
|
|
||||||
*
|
|
||||||
* @par Copyright
|
|
||||||
* Copyright 2011 Edouard DUPIN, all right reserved
|
|
||||||
*
|
|
||||||
* This software is distributed in the hope that it will be useful, but WITHOUT
|
|
||||||
* ANY WARRANTY.
|
|
||||||
*
|
|
||||||
* Licence summary :
|
|
||||||
* You can modify and redistribute the sources code and binaries.
|
|
||||||
* You can send me the bug-fix
|
|
||||||
*
|
|
||||||
* Term of the licence in in the file licence.txt.
|
|
||||||
*
|
|
||||||
*******************************************************************************
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
#undef __class__
|
|
||||||
#define __class__ "ewol::theme::EolBasePolygone"
|
|
||||||
|
|
@ -1,32 +0,0 @@
|
|||||||
/**
|
|
||||||
*******************************************************************************
|
|
||||||
* @file ewol/theme/EolBasePolygone.h
|
|
||||||
* @brief basic ewol theme eol file basic element type=polygone (Header)
|
|
||||||
* @author Edouard DUPIN
|
|
||||||
* @date 23/11/2011
|
|
||||||
* @par Project
|
|
||||||
* ewol
|
|
||||||
*
|
|
||||||
* @par Copyright
|
|
||||||
* Copyright 2011 Edouard DUPIN, all right reserved
|
|
||||||
*
|
|
||||||
* This software is distributed in the hope that it will be useful, but WITHOUT
|
|
||||||
* ANY WARRANTY.
|
|
||||||
*
|
|
||||||
* Licence summary :
|
|
||||||
* You can modify and redistribute the sources code and binaries.
|
|
||||||
* You can send me the bug-fix
|
|
||||||
*
|
|
||||||
* Term of the licence in in the file licence.txt.
|
|
||||||
*
|
|
||||||
*******************************************************************************
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
#include <ewol/theme/EolBase.h>
|
|
||||||
|
|
||||||
#ifndef __EWOL_THEME_EOL_BASE_POLYGONE_H__
|
|
||||||
#define __EWOL_THEME_EOL_BASE_POLYGONE_H__
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
@ -1,117 +0,0 @@
|
|||||||
/**
|
|
||||||
*******************************************************************************
|
|
||||||
* @file ewol/theme/EolBaseRect.cpp
|
|
||||||
* @brief basic ewol theme eol file basic element type=rectangle (Sources)
|
|
||||||
* @author Edouard DUPIN
|
|
||||||
* @date 23/11/2011
|
|
||||||
* @par Project
|
|
||||||
* ewol
|
|
||||||
*
|
|
||||||
* @par Copyright
|
|
||||||
* Copyright 2011 Edouard DUPIN, all right reserved
|
|
||||||
*
|
|
||||||
* This software is distributed in the hope that it will be useful, but WITHOUT
|
|
||||||
* ANY WARRANTY.
|
|
||||||
*
|
|
||||||
* Licence summary :
|
|
||||||
* You can modify and redistribute the sources code and binaries.
|
|
||||||
* You can send me the bug-fix
|
|
||||||
*
|
|
||||||
* Term of the licence in in the file licence.txt.
|
|
||||||
*
|
|
||||||
*******************************************************************************
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <ewol/theme/Theme.h>
|
|
||||||
#include <ewol/theme/EolBaseRect.h>
|
|
||||||
|
|
||||||
#undef __class__
|
|
||||||
#define __class__ "ewol::theme::EolBaseRect"
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
ewol::theme::EolBaseRect::EolBaseRect(void)
|
|
||||||
{
|
|
||||||
//EWOL_DEBUG("new element Base : Rectangle ...");
|
|
||||||
}
|
|
||||||
|
|
||||||
ewol::theme::EolBaseRect::~EolBaseRect(void)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void ewol::theme::EolBaseRect::Parse(TiXmlNode * pNode)
|
|
||||||
{
|
|
||||||
const char * tmp = pNode->ToElement()->Attribute("position");
|
|
||||||
if (NULL == tmp) {
|
|
||||||
m_position.x=0;
|
|
||||||
m_position.y=0;
|
|
||||||
} else {
|
|
||||||
double xxx,yyy;
|
|
||||||
// optimize for multiple type input ...
|
|
||||||
sscanf(tmp, "%lf;%lf", &xxx,&yyy);
|
|
||||||
m_position.x=xxx;
|
|
||||||
m_position.y=yyy;
|
|
||||||
}
|
|
||||||
tmp = pNode->ToElement()->Attribute("size");
|
|
||||||
if (NULL == tmp) {
|
|
||||||
m_size.x=0;
|
|
||||||
m_size.y=0;
|
|
||||||
} else {
|
|
||||||
double xxx,yyy;
|
|
||||||
// optimize for multiple type input ...
|
|
||||||
sscanf(tmp, "%lf;%lf", &xxx,&yyy);
|
|
||||||
m_size.x=xxx;
|
|
||||||
m_size.y=yyy;
|
|
||||||
}
|
|
||||||
tmp = pNode->ToElement()->Attribute("thickness");
|
|
||||||
if (NULL == tmp) {
|
|
||||||
m_thickness=0.01;
|
|
||||||
} else {
|
|
||||||
double tmpVal;
|
|
||||||
// optimize for multiple type input ...
|
|
||||||
sscanf(tmp, "%lf", &tmpVal);
|
|
||||||
m_thickness=tmpVal;
|
|
||||||
}
|
|
||||||
m_colorBG = pNode->ToElement()->Attribute("colorBG");
|
|
||||||
m_colorBorder = pNode->ToElement()->Attribute("colorBorder");
|
|
||||||
EWOL_DEBUG("(l " << pNode->Row() << ") Parse Base Element : \"rect\" : pos(" << m_position.x << "," << m_position.y << ") "
|
|
||||||
<< "size(" << m_size.x << "," << m_size.y << ") colorBG=\"" << m_colorBG << "\" colorBorder=\"" << m_colorBorder << "\" thickness=" << m_thickness);
|
|
||||||
}
|
|
||||||
|
|
||||||
void ewol::theme::EolBaseRect::Generate(const ewol::theme::Theme * myTheme, const ewol::theme::EolElement * myElement, ewol::OObject2DColored & newObject, etkFloat_t posX, etkFloat_t posY, etkFloat_t sizeX, etkFloat_t sizeY)
|
|
||||||
{
|
|
||||||
if (m_colorBG != "") {
|
|
||||||
color_ts selectedColorBG = {1.0, 1.0, 1.0, 1.0};
|
|
||||||
bool res = false;
|
|
||||||
if (NULL != myElement) {
|
|
||||||
res = myElement->GetColor(m_colorBG, selectedColorBG);
|
|
||||||
}
|
|
||||||
// try from theme if not existed
|
|
||||||
if( false == res
|
|
||||||
&& NULL != myTheme ) {
|
|
||||||
myElement->GetColor(m_colorBG, selectedColorBG);
|
|
||||||
}
|
|
||||||
newObject.SetColor(selectedColorBG);
|
|
||||||
newObject.Rectangle(posX + m_position.x*sizeX, posY + m_position.y*sizeY, m_size.x*sizeX, m_size.y*sizeY);
|
|
||||||
}
|
|
||||||
if (m_colorBorder != "") {
|
|
||||||
color_ts selectedColorBorder = {0.0, 0.0, 0.0, 1.0};
|
|
||||||
bool res = false;
|
|
||||||
// try get color for current element
|
|
||||||
if (NULL != myElement) {
|
|
||||||
res = myElement->GetColor(m_colorBorder, selectedColorBorder);
|
|
||||||
}
|
|
||||||
// try from theme if not existed
|
|
||||||
if( false == res
|
|
||||||
&& NULL != myTheme ) {
|
|
||||||
myElement->GetColor(m_colorBorder, selectedColorBorder);
|
|
||||||
}
|
|
||||||
newObject.SetColor(selectedColorBorder);
|
|
||||||
newObject.RectangleBorder(posX + m_position.x*sizeX, posY + m_position.y*sizeY, m_size.x*sizeX, m_size.y*sizeY, m_thickness*(sizeX+sizeY)/2);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -1,59 +0,0 @@
|
|||||||
/**
|
|
||||||
*******************************************************************************
|
|
||||||
* @file ewol/theme/EolBaseRect.h
|
|
||||||
* @brief basic ewol theme eol file basic element type=rectangle (Header)
|
|
||||||
* @author Edouard DUPIN
|
|
||||||
* @date 23/11/2011
|
|
||||||
* @par Project
|
|
||||||
* ewol
|
|
||||||
*
|
|
||||||
* @par Copyright
|
|
||||||
* Copyright 2011 Edouard DUPIN, all right reserved
|
|
||||||
*
|
|
||||||
* This software is distributed in the hope that it will be useful, but WITHOUT
|
|
||||||
* ANY WARRANTY.
|
|
||||||
*
|
|
||||||
* Licence summary :
|
|
||||||
* You can modify and redistribute the sources code and binaries.
|
|
||||||
* You can send me the bug-fix
|
|
||||||
*
|
|
||||||
* Term of the licence in in the file licence.txt.
|
|
||||||
*
|
|
||||||
*******************************************************************************
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
#include <ewol/theme/EolBase.h>
|
|
||||||
#include <ewol/theme/EolColor.h>
|
|
||||||
|
|
||||||
#ifndef __EWOL_THEME_EOL_BASE_RECT_H__
|
|
||||||
#define __EWOL_THEME_EOL_BASE_RECT_H__
|
|
||||||
|
|
||||||
namespace ewol {
|
|
||||||
namespace theme {
|
|
||||||
class EolBaseRect : public EolBase {
|
|
||||||
public:
|
|
||||||
EolBaseRect(void);
|
|
||||||
virtual ~EolBaseRect(void);
|
|
||||||
/*
|
|
||||||
<rect colorBG="..." ==> generate condition to display background ...
|
|
||||||
colorBorder="..." ==> generate condition to display border ...
|
|
||||||
position="0.53;0.56"
|
|
||||||
size="0.22;0.11"
|
|
||||||
thickness="0.05" ==> only if neededd by border, default 0.01
|
|
||||||
/>
|
|
||||||
*/
|
|
||||||
virtual void Parse(TiXmlNode * pNode);
|
|
||||||
virtual void Generate(const ewol::theme::Theme * myTheme, const ewol::theme::EolElement * myElement, ewol::OObject2DColored & newObject, etkFloat_t posX, etkFloat_t posY, etkFloat_t sizeX, etkFloat_t sizeY);
|
|
||||||
private:
|
|
||||||
etk::UString m_colorBG;
|
|
||||||
etk::UString m_colorBorder;
|
|
||||||
coord2D_ts m_position;
|
|
||||||
coord2D_ts m_size;
|
|
||||||
etkFloat_t m_thickness;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
@ -1,28 +0,0 @@
|
|||||||
/**
|
|
||||||
*******************************************************************************
|
|
||||||
* @file ewol/theme/EolBaseTriangle.cpp
|
|
||||||
* @brief basic ewol theme eol file basic element type=triangle (Sources)
|
|
||||||
* @author Edouard DUPIN
|
|
||||||
* @date 23/11/2011
|
|
||||||
* @par Project
|
|
||||||
* ewol
|
|
||||||
*
|
|
||||||
* @par Copyright
|
|
||||||
* Copyright 2011 Edouard DUPIN, all right reserved
|
|
||||||
*
|
|
||||||
* This software is distributed in the hope that it will be useful, but WITHOUT
|
|
||||||
* ANY WARRANTY.
|
|
||||||
*
|
|
||||||
* Licence summary :
|
|
||||||
* You can modify and redistribute the sources code and binaries.
|
|
||||||
* You can send me the bug-fix
|
|
||||||
*
|
|
||||||
* Term of the licence in in the file licence.txt.
|
|
||||||
*
|
|
||||||
*******************************************************************************
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
#undef __class__
|
|
||||||
#define __class__ "ewol::theme::EolBaseTriangle"
|
|
||||||
|
|
@ -1,32 +0,0 @@
|
|||||||
/**
|
|
||||||
*******************************************************************************
|
|
||||||
* @file ewol/theme/EolBaseTriangle.h
|
|
||||||
* @brief basic ewol theme eol file basic element type=triangle (Header)
|
|
||||||
* @author Edouard DUPIN
|
|
||||||
* @date 23/11/2011
|
|
||||||
* @par Project
|
|
||||||
* ewol
|
|
||||||
*
|
|
||||||
* @par Copyright
|
|
||||||
* Copyright 2011 Edouard DUPIN, all right reserved
|
|
||||||
*
|
|
||||||
* This software is distributed in the hope that it will be useful, but WITHOUT
|
|
||||||
* ANY WARRANTY.
|
|
||||||
*
|
|
||||||
* Licence summary :
|
|
||||||
* You can modify and redistribute the sources code and binaries.
|
|
||||||
* You can send me the bug-fix
|
|
||||||
*
|
|
||||||
* Term of the licence in in the file licence.txt.
|
|
||||||
*
|
|
||||||
*******************************************************************************
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
#include <ewol/theme/EolBase.h>
|
|
||||||
|
|
||||||
#ifndef __EWOL_THEME_EOL_BASE_TRIANGLE_H__
|
|
||||||
#define __EWOL_THEME_EOL_BASE_TRIANGLE_H__
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
@ -1,127 +0,0 @@
|
|||||||
/**
|
|
||||||
*******************************************************************************
|
|
||||||
* @file ewol/theme/EolColor.cpp
|
|
||||||
* @brief basic ewol theme eol file color (Sources)
|
|
||||||
* @author Edouard DUPIN
|
|
||||||
* @date 23/11/2011
|
|
||||||
* @par Project
|
|
||||||
* ewol
|
|
||||||
*
|
|
||||||
* @par Copyright
|
|
||||||
* Copyright 2011 Edouard DUPIN, all right reserved
|
|
||||||
*
|
|
||||||
* This software is distributed in the hope that it will be useful, but WITHOUT
|
|
||||||
* ANY WARRANTY.
|
|
||||||
*
|
|
||||||
* Licence summary :
|
|
||||||
* You can modify and redistribute the sources code and binaries.
|
|
||||||
* You can send me the bug-fix
|
|
||||||
*
|
|
||||||
* Term of the licence in in the file licence.txt.
|
|
||||||
*
|
|
||||||
*******************************************************************************
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
#include <ewol/theme/EolColor.h>
|
|
||||||
|
|
||||||
#undef __class__
|
|
||||||
#define __class__ "ewol::theme::EolColor"
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
ewol::theme::EolColor::EolColor(void)
|
|
||||||
{
|
|
||||||
m_color.red = 0.0;
|
|
||||||
m_color.green = 0.0;
|
|
||||||
m_color.blue = 0.0;
|
|
||||||
m_color.alpha = 1.0;
|
|
||||||
}
|
|
||||||
|
|
||||||
ewol::theme::EolColor::~EolColor(void)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void ewol::theme::EolColor::Parse(TiXmlNode * pNode)
|
|
||||||
{
|
|
||||||
m_name = pNode->ToElement()->Attribute("name");
|
|
||||||
const char *color = pNode->ToElement()->Attribute("val");
|
|
||||||
if (NULL != color) {
|
|
||||||
if (color[0] == '#') {
|
|
||||||
// Find a direct Color
|
|
||||||
unsigned int r=0;
|
|
||||||
unsigned int v=0;
|
|
||||||
unsigned int b=0;
|
|
||||||
unsigned int a=0xFF;
|
|
||||||
sscanf(color, "#%02x%02x%02x%02x", &r,&v,&b,&a);
|
|
||||||
m_color.red = (etkFloat_t)r/255.0;
|
|
||||||
m_color.green = (etkFloat_t)v/255.0;
|
|
||||||
m_color.blue = (etkFloat_t)b/255.0;
|
|
||||||
m_color.alpha = (etkFloat_t)a/255.0;
|
|
||||||
} else if (color[0] == '&') {
|
|
||||||
//find a reference Color
|
|
||||||
|
|
||||||
} else {
|
|
||||||
// must be a float color
|
|
||||||
double r=0.0;
|
|
||||||
double v=0.0;
|
|
||||||
double b=0.0;
|
|
||||||
double a=1.0;
|
|
||||||
sscanf(color, "%lf;%lf;%lf;%lf", &r,&v,&b,&a);
|
|
||||||
m_color.red = (etkFloat_t)r;
|
|
||||||
m_color.green = (etkFloat_t)v;
|
|
||||||
m_color.blue = (etkFloat_t)b;
|
|
||||||
m_color.alpha = (etkFloat_t)a;
|
|
||||||
if (m_color.red>1.0) { m_color.red = 1.0; }
|
|
||||||
if (m_color.green>1.0) { m_color.green = 1.0; }
|
|
||||||
if (m_color.blue>1.0) { m_color.blue = 1.0; }
|
|
||||||
if (m_color.alpha>1.0) { m_color.alpha = 1.0; }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (NULL != color) {
|
|
||||||
EWOL_INFO("(l " << pNode->Row() << ") color name=\"" << m_name << "\" \"" << color << "\" ==> red="<< m_color.red <<" green="<< m_color.green <<" blue="<< m_color.blue <<" alpha="<< m_color.alpha );
|
|
||||||
} else {
|
|
||||||
EWOL_INFO("(l " << pNode->Row() << ") color name=\"" << m_name << "\" \"\"???? ==> red="<< m_color.red <<" green="<< m_color.green <<" blue="<< m_color.blue <<" alpha="<< m_color.alpha );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
etk::UString ewol::theme::EolColor::GetName(void) const
|
|
||||||
{
|
|
||||||
return m_name;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void ewol::theme::EolColor::SetName(etk::UString & newName)
|
|
||||||
{
|
|
||||||
m_name = newName;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool ewol::theme::EolColor::HasName(etk::UString & newName) const
|
|
||||||
{
|
|
||||||
return m_name == newName;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
color_ts ewol::theme::EolColor::Get(void) const
|
|
||||||
{
|
|
||||||
return m_color;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void ewol::theme::EolColor::Set(color_ts newColor)
|
|
||||||
{
|
|
||||||
m_color = newColor;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void ewol::theme::EolColor::Set(etkFloat_t red, etkFloat_t green, etkFloat_t blue, etkFloat_t alpha)
|
|
||||||
{
|
|
||||||
m_color.red = red;
|
|
||||||
m_color.green = green;
|
|
||||||
m_color.blue = blue;
|
|
||||||
m_color.alpha = alpha;
|
|
||||||
}
|
|
@ -1,60 +0,0 @@
|
|||||||
/**
|
|
||||||
*******************************************************************************
|
|
||||||
* @file ewol/theme/EolColor.h
|
|
||||||
* @brief basic ewol theme eol file color (Header)
|
|
||||||
* @author Edouard DUPIN
|
|
||||||
* @date 23/11/2011
|
|
||||||
* @par Project
|
|
||||||
* ewol
|
|
||||||
*
|
|
||||||
* @par Copyright
|
|
||||||
* Copyright 2011 Edouard DUPIN, all right reserved
|
|
||||||
*
|
|
||||||
* This software is distributed in the hope that it will be useful, but WITHOUT
|
|
||||||
* ANY WARRANTY.
|
|
||||||
*
|
|
||||||
* Licence summary :
|
|
||||||
* You can modify and redistribute the sources code and binaries.
|
|
||||||
* You can send me the bug-fix
|
|
||||||
*
|
|
||||||
* Term of the licence in in the file licence.txt.
|
|
||||||
*
|
|
||||||
*******************************************************************************
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
#ifndef __EWOL_THEME_EOL_COLOR_H__
|
|
||||||
#define __EWOL_THEME_EOL_COLOR_H__
|
|
||||||
|
|
||||||
|
|
||||||
#include <etk/Types.h>
|
|
||||||
#include <etk/UString.h>
|
|
||||||
#include <etk/File.h>
|
|
||||||
#include <ewol/OObject.h>
|
|
||||||
#include <tinyXML/tinyxml.h>
|
|
||||||
|
|
||||||
|
|
||||||
namespace ewol {
|
|
||||||
namespace theme {
|
|
||||||
class EolColor {
|
|
||||||
public:
|
|
||||||
EolColor(void);
|
|
||||||
virtual ~EolColor(void);
|
|
||||||
|
|
||||||
void Parse(TiXmlNode * pNode);
|
|
||||||
etk::UString GetName(void) const;
|
|
||||||
void SetName(etk::UString & newName);
|
|
||||||
bool HasName(etk::UString & newName) const;
|
|
||||||
color_ts Get(void) const;
|
|
||||||
void Set(color_ts newColor);
|
|
||||||
void Set(etkFloat_t red, etkFloat_t green, etkFloat_t blue, etkFloat_t alpha = 1);
|
|
||||||
private:
|
|
||||||
color_ts m_color;
|
|
||||||
etk::UString m_name;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
@ -1,288 +0,0 @@
|
|||||||
/**
|
|
||||||
*******************************************************************************
|
|
||||||
* @file ewol/theme/EolElement.cpp
|
|
||||||
* @brief basic ewol theme eol file element (Sources)
|
|
||||||
* @author Edouard DUPIN
|
|
||||||
* @date 23/11/2011
|
|
||||||
* @par Project
|
|
||||||
* ewol
|
|
||||||
*
|
|
||||||
* @par Copyright
|
|
||||||
* Copyright 2011 Edouard DUPIN, all right reserved
|
|
||||||
*
|
|
||||||
* This software is distributed in the hope that it will be useful, but WITHOUT
|
|
||||||
* ANY WARRANTY.
|
|
||||||
*
|
|
||||||
* Licence summary :
|
|
||||||
* You can modify and redistribute the sources code and binaries.
|
|
||||||
* You can send me the bug-fix
|
|
||||||
*
|
|
||||||
* Term of the licence in in the file licence.txt.
|
|
||||||
*
|
|
||||||
*******************************************************************************
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <ewol/theme/Theme.h>
|
|
||||||
|
|
||||||
#undef __class__
|
|
||||||
#define __class__ "ewol::theme::EolElement"
|
|
||||||
|
|
||||||
|
|
||||||
ewol::theme::EolElement::EolElement(void)
|
|
||||||
{
|
|
||||||
//EWOL_DEBUG("new...");
|
|
||||||
}
|
|
||||||
|
|
||||||
ewol::theme::EolElement::~EolElement(void)
|
|
||||||
{
|
|
||||||
RemoveAll();
|
|
||||||
}
|
|
||||||
|
|
||||||
void ewol::theme::EolElement::RemoveAll(void)
|
|
||||||
{
|
|
||||||
for(int32_t iii=0; iii<m_listColor.Size(); iii++) {
|
|
||||||
if (m_listColor[iii] != NULL) {
|
|
||||||
delete m_listColor[iii];
|
|
||||||
m_listColor[iii] = NULL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
m_listColor.Clear();
|
|
||||||
for(int32_t iii=0; iii<m_listGroup.Size(); iii++) {
|
|
||||||
if (m_listGroup[iii] != NULL) {
|
|
||||||
delete m_listGroup[iii];
|
|
||||||
m_listGroup[iii] = NULL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
m_listGroup.Clear();
|
|
||||||
for(int32_t iii=0; iii<m_listElement.Size(); iii++) {
|
|
||||||
if (m_listElement[iii] != NULL) {
|
|
||||||
delete m_listElement[iii];
|
|
||||||
m_listElement[iii] = NULL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
m_listElement.Clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
void ewol::theme::EolElement::Parse(TiXmlNode * root)
|
|
||||||
{
|
|
||||||
// clean all internal elements ...
|
|
||||||
RemoveAll();
|
|
||||||
// get the name ...
|
|
||||||
m_name = root->ToElement()->Attribute("name");
|
|
||||||
const char * tmp = root->ToElement()->Attribute("ratio");
|
|
||||||
if (NULL == tmp) {
|
|
||||||
m_ratio=1.0;
|
|
||||||
} else {
|
|
||||||
double xxx;
|
|
||||||
// optimize for multiple type input ...
|
|
||||||
sscanf(tmp, "%lf", &xxx);
|
|
||||||
m_ratio=xxx;
|
|
||||||
}
|
|
||||||
etk::UString tmpString = root->ToElement()->Attribute("ClipX");
|
|
||||||
if (tmpString == "true") {
|
|
||||||
m_clipX = true;
|
|
||||||
} else {
|
|
||||||
m_clipX = false;
|
|
||||||
}
|
|
||||||
etk::UString tmpString2 = root->ToElement()->Attribute("ClipY");
|
|
||||||
if (tmpString2 == "true") {
|
|
||||||
m_clipY = true;
|
|
||||||
} else {
|
|
||||||
m_clipY = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
tmp = root->ToElement()->Attribute("internalElemStart");
|
|
||||||
if (NULL == tmp) {
|
|
||||||
m_internalElemStart.x=0;
|
|
||||||
m_internalElemStart.y=0;
|
|
||||||
} else {
|
|
||||||
double xxx,yyy;
|
|
||||||
// optimize for multiple type input ...
|
|
||||||
sscanf(tmp, "%lf;%lf", &xxx,&yyy);
|
|
||||||
m_internalElemStart.x=xxx;
|
|
||||||
m_internalElemStart.y=yyy;
|
|
||||||
}
|
|
||||||
tmp = root->ToElement()->Attribute("internalElemStop");
|
|
||||||
if (NULL == tmp) {
|
|
||||||
m_internalElemStop.x=0;
|
|
||||||
m_internalElemStop.y=0;
|
|
||||||
} else {
|
|
||||||
double xxx,yyy;
|
|
||||||
// optimize for multiple type input ...
|
|
||||||
sscanf(tmp, "%lf;%lf", &xxx,&yyy);
|
|
||||||
m_internalElemStop.x=xxx;
|
|
||||||
m_internalElemStop.y=yyy;
|
|
||||||
}
|
|
||||||
EWOL_INFO("(l " << root->Row() << ") ELEMENT name=\"" << m_name << "\" internalStart(" << m_internalElemStart.x << "," << m_internalElemStart.y << ") to internalStop(" << m_internalElemStop.x << "," << m_internalElemStop.y << ") ratio=" << m_ratio );
|
|
||||||
EWOL_INFO(" --------------------- START ---------------------");
|
|
||||||
for(TiXmlNode * pNode=root->FirstChild(); NULL!=pNode; pNode = pNode->NextSibling()) {
|
|
||||||
if (pNode->Type()==TiXmlNode::TINYXML_COMMENT) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
etk::UString nodeValue = pNode->Value();
|
|
||||||
if (nodeValue == "group") {
|
|
||||||
//EWOL_INFO("Find group ... ");
|
|
||||||
etk::UString groupNameTmp = pNode->ToElement()->Attribute("name");
|
|
||||||
if (groupNameTmp == "") {
|
|
||||||
EWOL_ERROR("(l " << pNode->Row() << ") Group with NO name ... (not parsed)");
|
|
||||||
// not added it
|
|
||||||
} else {
|
|
||||||
bool findASameName = false;
|
|
||||||
// check if existed ...
|
|
||||||
for (int32_t iii=0; iii < m_listGroup.Size(); iii++) {
|
|
||||||
if(NULL!=m_listGroup[iii]) {
|
|
||||||
if(m_listGroup[iii]->HasName(groupNameTmp) == true) {
|
|
||||||
findASameName = true;
|
|
||||||
EWOL_WARNING("(l " << pNode->Row() << ") Find a Group with the same Name : \"" << groupNameTmp <<"\"");
|
|
||||||
m_listGroup[iii]->Parse(pNode);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (findASameName == false) {
|
|
||||||
//EWOL_DEBUG("(l " << pNode->Row() << ") Add a new Group : \"" << groupNameTmp <<"\"");
|
|
||||||
ewol::theme::EolElementFrame * myGroupTmp = new ewol::theme::EolElementFrame();
|
|
||||||
if (NULL != myGroupTmp) {
|
|
||||||
myGroupTmp->Parse(pNode);
|
|
||||||
m_listGroup.PushBack(myGroupTmp);
|
|
||||||
} else {
|
|
||||||
EWOL_ERROR("(l " << pNode->Row() << ") Error Allocation : \"" << nodeValue <<"\"");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else if (nodeValue == "frame") {
|
|
||||||
//EWOL_INFO("Find frame ... ");
|
|
||||||
etk::UString groupNameTmp = pNode->ToElement()->Attribute("name");
|
|
||||||
if (groupNameTmp == "") {
|
|
||||||
EWOL_ERROR("(l " << pNode->Row() << ") Group with NO name ... (not parsed)");
|
|
||||||
// not added it
|
|
||||||
} else {
|
|
||||||
bool findASameName = false;
|
|
||||||
// check if existed ...
|
|
||||||
for (int32_t iii=0; iii < m_listElement.Size(); iii++) {
|
|
||||||
if(NULL!=m_listElement[iii]) {
|
|
||||||
if(m_listElement[iii]->HasName(groupNameTmp) == true) {
|
|
||||||
findASameName = true;
|
|
||||||
EWOL_WARNING("(l " << pNode->Row() << ") Find a Frame with the same Name : \"" << groupNameTmp <<"\"");
|
|
||||||
m_listGroup[iii]->Parse(pNode);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (findASameName == false) {
|
|
||||||
//EWOL_DEBUG("(l " << pNode->Row() << ") Add a new Frame : \"" << groupNameTmp <<"\"");
|
|
||||||
ewol::theme::EolElementFrame * myGroupTmp = new ewol::theme::EolElementFrame();
|
|
||||||
if (NULL != myGroupTmp) {
|
|
||||||
myGroupTmp->Parse(pNode);
|
|
||||||
m_listElement.PushBack(myGroupTmp);
|
|
||||||
} else {
|
|
||||||
EWOL_ERROR("(l " << pNode->Row() << ") Error Allocation : \"" << nodeValue <<"\"");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else if (nodeValue == "color") {
|
|
||||||
etk::UString colorNameTmp = pNode->ToElement()->Attribute("name");
|
|
||||||
if (colorNameTmp == "") {
|
|
||||||
EWOL_ERROR("(l " << pNode->Row() << ") Color with NO name ... (not parsed)");
|
|
||||||
// not added it
|
|
||||||
} else {
|
|
||||||
bool findASameName = false;
|
|
||||||
// check if existed ...
|
|
||||||
for (int32_t iii=0; iii < m_listColor.Size(); iii++) {
|
|
||||||
if(NULL!=m_listColor[iii]) {
|
|
||||||
if(m_listColor[iii]->HasName(colorNameTmp) == true) {
|
|
||||||
findASameName = true;
|
|
||||||
EWOL_WARNING("(l " << pNode->Row() << ") Find a color with the same Name : \"" << colorNameTmp <<"\"");
|
|
||||||
m_listColor[iii]->Parse(pNode);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (findASameName == false) {
|
|
||||||
//EWOL_DEBUG("(l " << pNode->Row() << ") Add a new COLOR : \"" << colorNameTmp <<"\"");
|
|
||||||
ewol::theme::EolColor * myColorTmp = new ewol::theme::EolColor();
|
|
||||||
if (NULL != myColorTmp) {
|
|
||||||
myColorTmp->Parse(pNode);
|
|
||||||
m_listColor.PushBack(myColorTmp);
|
|
||||||
} else {
|
|
||||||
EWOL_ERROR("(l " << pNode->Row() << ") Error Allocation : \"" << nodeValue <<"\"");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
EWOL_ERROR("(l " << pNode->Row() << ") node not suported : \"" << nodeValue <<"\" must be [group,color,frame]");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
EWOL_INFO(" --------------------- STOP ---------------------");
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
bool ewol::theme::EolElement::GetColor(etk::UString colorName, color_ts & selectedColor) const
|
|
||||||
{
|
|
||||||
for (int32_t iii=0; iii < m_listColor.Size(); iii++) {
|
|
||||||
if(NULL!=m_listColor[iii]) {
|
|
||||||
if(m_listColor[iii]->HasName(colorName) == true) {
|
|
||||||
selectedColor = m_listColor[iii]->Get();
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
selectedColor.red = 0.0;
|
|
||||||
selectedColor.green = 0.0;
|
|
||||||
selectedColor.blue = 0.0;
|
|
||||||
selectedColor.alpha = 1.0;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
int32_t ewol::theme::EolElement::GetNbFrame(void) const
|
|
||||||
{
|
|
||||||
return m_listElement.Size();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
int32_t ewol::theme::EolElement::GetFrameId(etk::UString & frameName) const
|
|
||||||
{
|
|
||||||
for (int32_t iii=0; iii < m_listElement.Size(); iii++) {
|
|
||||||
if(NULL!=m_listElement[iii]) {
|
|
||||||
if(m_listElement[iii]->HasName(frameName) == true) {
|
|
||||||
return iii;;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
etk::UString ewol::theme::EolElement::GetName(void) const
|
|
||||||
{
|
|
||||||
return m_name;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void ewol::theme::EolElement::SetName(etk::UString & newName)
|
|
||||||
{
|
|
||||||
m_name = newName;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool ewol::theme::EolElement::HasName(etk::UString & newName) const
|
|
||||||
{
|
|
||||||
return m_name == newName;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void ewol::theme::EolElement::Generate(const ewol::theme::Theme * myTheme, int32_t frameId, ewol::OObject2DColored & newObject, etkFloat_t posX, etkFloat_t posY, etkFloat_t sizeX, etkFloat_t sizeY)
|
|
||||||
{
|
|
||||||
if (0 > frameId || frameId > m_listElement.Size()) {
|
|
||||||
EWOL_ERROR("Did not find the frame id=" << frameId);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (NULL != m_listElement[frameId]) {
|
|
||||||
m_listElement[frameId]->Generate(myTheme, this, newObject, posX, posY, sizeX, sizeY);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -1,81 +0,0 @@
|
|||||||
/**
|
|
||||||
*******************************************************************************
|
|
||||||
* @file ewol/theme/EolElement.h
|
|
||||||
* @brief basic ewol theme eol file element (Header)
|
|
||||||
* @author Edouard DUPIN
|
|
||||||
* @date 23/11/2011
|
|
||||||
* @par Project
|
|
||||||
* ewol
|
|
||||||
*
|
|
||||||
* @par Copyright
|
|
||||||
* Copyright 2011 Edouard DUPIN, all right reserved
|
|
||||||
*
|
|
||||||
* This software is distributed in the hope that it will be useful, but WITHOUT
|
|
||||||
* ANY WARRANTY.
|
|
||||||
*
|
|
||||||
* Licence summary :
|
|
||||||
* You can modify and redistribute the sources code and binaries.
|
|
||||||
* You can send me the bug-fix
|
|
||||||
*
|
|
||||||
* Term of the licence in in the file licence.txt.
|
|
||||||
*
|
|
||||||
*******************************************************************************
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#ifndef __EWOL_THEME_EOL_ELEMENT_H__
|
|
||||||
#define __EWOL_THEME_EOL_ELEMENT_H__
|
|
||||||
|
|
||||||
#include <etk/Types.h>
|
|
||||||
#include <etk/UString.h>
|
|
||||||
#include <etk/File.h>
|
|
||||||
#include <ewol/OObject.h>
|
|
||||||
#include <ewol/theme/EolColor.h>
|
|
||||||
#include <ewol/theme/EolElementFrame.h>
|
|
||||||
|
|
||||||
|
|
||||||
namespace ewol {
|
|
||||||
namespace theme {
|
|
||||||
class EolElement {
|
|
||||||
public:
|
|
||||||
EolElement(void);
|
|
||||||
virtual ~EolElement(void);
|
|
||||||
void Parse(TiXmlNode * pNode);
|
|
||||||
etk::UString GetName(void) const;
|
|
||||||
void SetName(etk::UString & newName);
|
|
||||||
bool HasName(etk::UString & newName) const;
|
|
||||||
|
|
||||||
void Generate(const ewol::theme::Theme * myTheme, int32_t frameId, ewol::OObject2DColored & newObject, etkFloat_t posX, etkFloat_t posY, etkFloat_t sizeX, etkFloat_t sizeY);
|
|
||||||
bool GenerateGroup(const ewol::theme::Theme * myTheme, etk::UString groupName, ewol::OObject2DColored & newObject, etkFloat_t posX, etkFloat_t posY, etkFloat_t sizeX, etkFloat_t sizeY);
|
|
||||||
bool GetColor(etk::UString colorName, color_ts & selectedColor) const;
|
|
||||||
|
|
||||||
int32_t GetNbFrame(void) const;
|
|
||||||
int32_t GetFrameId(etk::UString & frameName) const;
|
|
||||||
private:
|
|
||||||
void RemoveAll(void);
|
|
||||||
etk::UString m_name;
|
|
||||||
/*
|
|
||||||
void Load(etk::File & newFile) { };
|
|
||||||
void Generate(int32_t id, int32_t frameId, OObject2DTextured & newObject, etkFloat_t posX, etkFloat_t posY, etkFloat_t sizeX, etkFloat_t sizeY) {};
|
|
||||||
int32_t GetNbFrame(int32_t id) {return 0;};
|
|
||||||
int32_t GetFrameId(int32_t id, etk::UString & frameName) {return 0;};
|
|
||||||
int32_t GetObjectId(etk::UString name) { return -1; };
|
|
||||||
*/
|
|
||||||
private:
|
|
||||||
etk::VectorType<ewol::theme::EolColor*> m_listColor;
|
|
||||||
etk::VectorType<ewol::theme::EolElementFrame*> m_listGroup;
|
|
||||||
etk::VectorType<ewol::theme::EolElementFrame*> m_listElement;
|
|
||||||
etkFloat_t m_ratio;
|
|
||||||
bool m_clipX;
|
|
||||||
bool m_clipY;
|
|
||||||
coord2D_ts m_internalElemStart;
|
|
||||||
coord2D_ts m_internalElemStop;
|
|
||||||
public:
|
|
||||||
// acces to manage and create object ==> drawing system
|
|
||||||
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
#endif
|
|
||||||
|
|
@ -1,133 +0,0 @@
|
|||||||
/**
|
|
||||||
*******************************************************************************
|
|
||||||
* @file ewol/theme/EolElementFrame.cpp
|
|
||||||
* @brief basic ewol theme eol file element (specific frame) (Sources)
|
|
||||||
* @author Edouard DUPIN
|
|
||||||
* @date 23/11/2011
|
|
||||||
* @par Project
|
|
||||||
* ewol
|
|
||||||
*
|
|
||||||
* @par Copyright
|
|
||||||
* Copyright 2011 Edouard DUPIN, all right reserved
|
|
||||||
*
|
|
||||||
* This software is distributed in the hope that it will be useful, but WITHOUT
|
|
||||||
* ANY WARRANTY.
|
|
||||||
*
|
|
||||||
* Licence summary :
|
|
||||||
* You can modify and redistribute the sources code and binaries.
|
|
||||||
* You can send me the bug-fix
|
|
||||||
*
|
|
||||||
* Term of the licence in in the file licence.txt.
|
|
||||||
*
|
|
||||||
*******************************************************************************
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#include <ewol/theme/Theme.h>
|
|
||||||
#include <ewol/theme/EolElementFrame.h>
|
|
||||||
|
|
||||||
#undef __class__
|
|
||||||
#define __class__ "ewol::theme::EolElementFrame"
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
ewol::theme::EolElementFrame::EolElementFrame(void)
|
|
||||||
{
|
|
||||||
//EWOL_DEBUG("new...");
|
|
||||||
}
|
|
||||||
|
|
||||||
ewol::theme::EolElementFrame::~EolElementFrame(void)
|
|
||||||
{
|
|
||||||
RemoveAll();
|
|
||||||
}
|
|
||||||
|
|
||||||
void ewol::theme::EolElementFrame::RemoveAll(void)
|
|
||||||
{
|
|
||||||
for(int32_t iii=0; iii<m_description.Size(); iii++) {
|
|
||||||
if (m_description[iii] != NULL) {
|
|
||||||
delete m_description[iii];
|
|
||||||
m_description[iii] = NULL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
m_description.Clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
void ewol::theme::EolElementFrame::Parse(TiXmlNode * root)
|
|
||||||
{
|
|
||||||
RemoveAll();
|
|
||||||
m_name = root->ToElement()->Attribute("name");
|
|
||||||
EWOL_INFO("(l " << root->Row() << ") Group name=\"" << m_name << "\" " );
|
|
||||||
for(TiXmlNode * pNode=root->FirstChild(); NULL!=pNode; pNode = pNode->NextSibling()) {
|
|
||||||
if (pNode->Type()==TiXmlNode::TINYXML_COMMENT) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
etk::UString nodeValue = pNode->Value();
|
|
||||||
ewol::theme::EolBase * myBaseTmp = NULL;
|
|
||||||
if (nodeValue == "line") {
|
|
||||||
//EWOL_INFO("Find baseElement Line");
|
|
||||||
myBaseTmp = new ewol::theme::EolBaseLine();
|
|
||||||
if (NULL == myBaseTmp) {
|
|
||||||
EWOL_ERROR("(l " << pNode->Row() << ") Error Allocation : \"" << nodeValue <<"\"");
|
|
||||||
}
|
|
||||||
} else if (nodeValue == "rect") {
|
|
||||||
//EWOL_INFO("Find baseElement Rectangle");
|
|
||||||
myBaseTmp = new ewol::theme::EolBaseRect();
|
|
||||||
if (NULL == myBaseTmp) {
|
|
||||||
EWOL_ERROR("(l " << pNode->Row() << ") Error Allocation : \"" << nodeValue <<"\"");
|
|
||||||
}
|
|
||||||
} else if (nodeValue == "link") {
|
|
||||||
EWOL_WARNING("(l " << pNode->Row() << ") Not Parsed now : \"" << nodeValue <<"\"");
|
|
||||||
} else if (nodeValue == "triangle") {
|
|
||||||
EWOL_WARNING("(l " << pNode->Row() << ") Not Parsed now : \"" << nodeValue <<"\"");
|
|
||||||
} else if (nodeValue == "polygone") {
|
|
||||||
EWOL_WARNING("(l " << pNode->Row() << ") Not Parsed now : \"" << nodeValue <<"\"");
|
|
||||||
} else if (nodeValue == "circle") {
|
|
||||||
//EWOL_INFO("Find baseElement Rectangle");
|
|
||||||
myBaseTmp = new ewol::theme::EolBaseCircle();
|
|
||||||
if (NULL == myBaseTmp) {
|
|
||||||
EWOL_ERROR("(l " << pNode->Row() << ") Error Allocation : \"" << nodeValue <<"\"");
|
|
||||||
}
|
|
||||||
} else if (nodeValue == "circlePart") {
|
|
||||||
EWOL_WARNING("(l " << pNode->Row() << ") Not Parsed now : \"" << nodeValue <<"\"");
|
|
||||||
} else {
|
|
||||||
EWOL_ERROR("(l " << pNode->Row() << ") Node not suported : \"" << nodeValue <<"\" must be [line,rect,link,triangle,polygone,circle,circlePart]");
|
|
||||||
}
|
|
||||||
if (NULL != myBaseTmp) {
|
|
||||||
myBaseTmp->Parse(pNode);
|
|
||||||
m_description.PushBack(myBaseTmp);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
etk::UString ewol::theme::EolElementFrame::GetName(void)
|
|
||||||
{
|
|
||||||
return m_name;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void ewol::theme::EolElementFrame::SetName(etk::UString & newName)
|
|
||||||
{
|
|
||||||
m_name = newName;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool ewol::theme::EolElementFrame::HasName(etk::UString & newName)
|
|
||||||
{
|
|
||||||
return m_name == newName;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void ewol::theme::EolElementFrame::Generate(const ewol::theme::Theme * myTheme, const ewol::theme::EolElement * myElement, ewol::OObject2DColored & newObject, etkFloat_t posX, etkFloat_t posY, etkFloat_t sizeX, etkFloat_t sizeY)
|
|
||||||
{
|
|
||||||
for (int32_t iii=0; iii<m_description.Size(); iii++) {
|
|
||||||
m_description[iii]->Generate(myTheme, myElement, newObject, posX, posY, sizeX, sizeY);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -1,70 +0,0 @@
|
|||||||
/**
|
|
||||||
*******************************************************************************
|
|
||||||
* @file ewol/theme/EolElementFrame.h
|
|
||||||
* @brief basic ewol theme eol file element (specific frame) (Header)
|
|
||||||
* @author Edouard DUPIN
|
|
||||||
* @date 23/11/2011
|
|
||||||
* @par Project
|
|
||||||
* ewol
|
|
||||||
*
|
|
||||||
* @par Copyright
|
|
||||||
* Copyright 2011 Edouard DUPIN, all right reserved
|
|
||||||
*
|
|
||||||
* This software is distributed in the hope that it will be useful, but WITHOUT
|
|
||||||
* ANY WARRANTY.
|
|
||||||
*
|
|
||||||
* Licence summary :
|
|
||||||
* You can modify and redistribute the sources code and binaries.
|
|
||||||
* You can send me the bug-fix
|
|
||||||
*
|
|
||||||
* Term of the licence in in the file licence.txt.
|
|
||||||
*
|
|
||||||
*******************************************************************************
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#ifndef __EWOL_THEME_EOL_ELEMENT_FRAME_H__
|
|
||||||
#define __EWOL_THEME_EOL_ELEMENT_FRAME_H__
|
|
||||||
|
|
||||||
#include <etk/Types.h>
|
|
||||||
#include <etk/UString.h>
|
|
||||||
#include <etk/File.h>
|
|
||||||
#include <ewol/OObject.h>
|
|
||||||
#include <ewol/theme/EolColor.h>
|
|
||||||
#include <ewol/theme/EolBase.h>
|
|
||||||
#include <ewol/theme/EolBaseLine.h>
|
|
||||||
#include <ewol/theme/EolBaseRect.h>
|
|
||||||
#include <ewol/theme/EolBaseCircle.h>
|
|
||||||
#include <ewol/theme/EolBaseCirclePart.h>
|
|
||||||
#include <ewol/theme/EolBaseTriangle.h>
|
|
||||||
#include <ewol/theme/EolBasePolygone.h>
|
|
||||||
|
|
||||||
|
|
||||||
namespace ewol {
|
|
||||||
namespace theme {
|
|
||||||
class EolElementFrame {
|
|
||||||
public:
|
|
||||||
EolElementFrame(void);
|
|
||||||
virtual ~EolElementFrame(void);
|
|
||||||
|
|
||||||
void Generate(const ewol::theme::Theme * myTheme, const ewol::theme::EolElement * myElement, ewol::OObject2DColored & newObject, etkFloat_t posX, etkFloat_t posY, etkFloat_t sizeX, etkFloat_t sizeY);
|
|
||||||
|
|
||||||
void Parse(TiXmlNode * pNode);
|
|
||||||
etk::UString GetName(void);
|
|
||||||
void SetName(etk::UString & newName);
|
|
||||||
bool HasName(etk::UString & newName);
|
|
||||||
private:
|
|
||||||
void RemoveAll(void);
|
|
||||||
etk::UString m_name;
|
|
||||||
etk::VectorType<ewol::theme::EolBase*> m_description; // all element to draw the image ...
|
|
||||||
public:
|
|
||||||
// acces to manage and create object ==> drawing system
|
|
||||||
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
@ -25,50 +25,39 @@
|
|||||||
#include <tinyXML/tinyxml.h>
|
#include <tinyXML/tinyxml.h>
|
||||||
|
|
||||||
#include <ewol/theme/Theme.h>
|
#include <ewol/theme/Theme.h>
|
||||||
|
#include <ewol/Debug.h>
|
||||||
|
|
||||||
#undef __class__
|
#undef __class__
|
||||||
#define __class__ "ewol::theme::Theme"
|
#define __class__ "theme"
|
||||||
|
|
||||||
#define MAX_LINE_SIZE (2048)
|
|
||||||
|
|
||||||
ewol::theme::Theme::Theme(void)
|
void ewol::theme::Load(etk::File & localFile)
|
||||||
{
|
{
|
||||||
|
if (localFile.HasExtention() == false) {
|
||||||
}
|
EWOL_ERROR("can not load theme with file, has no extention : " << localFile);
|
||||||
|
|
||||||
|
|
||||||
ewol::theme::Theme::~Theme(void)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
void ewol::theme::Theme::Load(etk::File & newFile, bool defaultTheme)
|
|
||||||
{
|
|
||||||
if (newFile.HasExtention() == false) {
|
|
||||||
EWOL_ERROR("can not load theme with file, has no extention : " << newFile);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (newFile.GetExtention() != "eol") {
|
if (localFile.GetExtention() != "eol") {
|
||||||
EWOL_ERROR("can not load theme with file, has not extention .eol : " << newFile);
|
EWOL_ERROR("can not load theme with file, has not extention .eol : " << localFile);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (false == newFile.Exist()) {
|
if (false == localFile.Exist()) {
|
||||||
EWOL_ERROR("File does not Exist ... " << newFile);
|
EWOL_ERROR("File does not Exist ... " << localFile);
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
TiXmlDocument XmlDocument;
|
TiXmlDocument XmlDocument;
|
||||||
// open the curent File
|
// open the curent File
|
||||||
if (false == newFile.Exist()) {
|
if (false == localFile.Exist()) {
|
||||||
EWOL_ERROR("File Does not exist : " << newFile);
|
EWOL_ERROR("File Does not exist : " << localFile);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
int32_t fileSize = newFile.Size();
|
int32_t fileSize = localFile.Size();
|
||||||
if (0==fileSize) {
|
if (0==fileSize) {
|
||||||
EWOL_ERROR("This file is empty : " << newFile);
|
EWOL_ERROR("This file is empty : " << localFile);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (false == newFile.fOpenRead()) {
|
if (false == localFile.fOpenRead()) {
|
||||||
EWOL_ERROR("Can not open the file : " << newFile);
|
EWOL_ERROR("Can not open the file : " << localFile);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// allocate data
|
// allocate data
|
||||||
@ -79,114 +68,23 @@ void ewol::theme::Theme::Load(etk::File & newFile, bool defaultTheme)
|
|||||||
}
|
}
|
||||||
memset(fileBuffer, 0, (fileSize+5)*sizeof(char));
|
memset(fileBuffer, 0, (fileSize+5)*sizeof(char));
|
||||||
// load data from the file :
|
// load data from the file :
|
||||||
newFile.fRead(fileBuffer, 1, fileSize);
|
localFile.fRead(fileBuffer, 1, fileSize);
|
||||||
// close the file:
|
// close the file:
|
||||||
newFile.fClose();
|
localFile.fClose();
|
||||||
// load the XML from the memory
|
// load the XML from the memory
|
||||||
XmlDocument.Parse((const char*)fileBuffer, 0, TIXML_ENCODING_UTF8);
|
XmlDocument.Parse((const char*)fileBuffer, 0, TIXML_ENCODING_UTF8);
|
||||||
|
|
||||||
TiXmlElement* root = XmlDocument.FirstChildElement( "eol" );
|
TiXmlElement* root = XmlDocument.FirstChildElement( "ewolTheme" );
|
||||||
if (NULL == root ) {
|
if (NULL == root ) {
|
||||||
EWOL_ERROR("(l ?) main node not find: \"eol\" in \"" << newFile << "\"");
|
EWOL_ERROR("(l ?) main node not find: \"ewolTheme\" in \"" << localFile << "\"");
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
for(TiXmlNode * pNode=root->FirstChild(); NULL!=pNode; pNode = pNode->NextSibling()) {
|
for(TiXmlNode * pNode=root->FirstChild(); NULL!=pNode; pNode = pNode->NextSibling()) {
|
||||||
if (pNode->Type()==TiXmlNode::TINYXML_COMMENT) {
|
if (pNode->Type()==TiXmlNode::TINYXML_COMMENT) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
etk::UString nodeValue = pNode->Value();
|
EWOL_TODO("default theme loading");
|
||||||
if (nodeValue == "element") {
|
//EWOL_ERROR("(l " << pNode->Row() << ") node not suported : \"" << nodeValue <<"\" must be [???,???]");
|
||||||
//EWOL_INFO("Find ELEMENT ... ");
|
|
||||||
etk::UString elementNameTmp = pNode->ToElement()->Attribute("name");
|
|
||||||
if (elementNameTmp == "") {
|
|
||||||
EWOL_ERROR("(l " << pNode->Row() << ") Element with NO name ... (not parsed)");
|
|
||||||
// not added it
|
|
||||||
} else {
|
|
||||||
bool findASameName = false;
|
|
||||||
// check if existed ...
|
|
||||||
for (int32_t iii=0; iii < m_listElement.Size(); iii++) {
|
|
||||||
if(NULL!=m_listElement[iii]) {
|
|
||||||
if(m_listElement[iii]->HasName(elementNameTmp) == true) {
|
|
||||||
findASameName = true;
|
|
||||||
EWOL_WARNING("(l " << pNode->Row() << ") Find a Group with the same Name : \"" << elementNameTmp <<"\"");
|
|
||||||
m_listElement[iii]->Parse(pNode);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (findASameName == false) {
|
|
||||||
//EWOL_DEBUG("(l " << pNode->Row() << ") Add a new Element : \"" << elementNameTmp <<"\"");
|
|
||||||
ewol::theme::EolElement * myElementTmp = new ewol::theme::EolElement();
|
|
||||||
if (NULL != myElementTmp) {
|
|
||||||
myElementTmp->Parse(pNode);
|
|
||||||
m_listElement.PushBack(myElementTmp);
|
|
||||||
} else {
|
|
||||||
EWOL_ERROR("(l " << pNode->Row() << ") Error Allocation : \"" << nodeValue <<"\"");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else if (nodeValue == "group") {
|
|
||||||
//EWOL_INFO("Find group ... ");
|
|
||||||
etk::UString groupNameTmp = pNode->ToElement()->Attribute("name");
|
|
||||||
if (groupNameTmp == "") {
|
|
||||||
EWOL_ERROR("(l " << pNode->Row() << ") Group with NO name ... (not parsed)");
|
|
||||||
// not added it
|
|
||||||
} else {
|
|
||||||
bool findASameName = false;
|
|
||||||
// check if existed ...
|
|
||||||
for (int32_t iii=0; iii < m_listGroup.Size(); iii++) {
|
|
||||||
if(NULL!=m_listGroup[iii]) {
|
|
||||||
if(m_listGroup[iii]->HasName(groupNameTmp) == true) {
|
|
||||||
findASameName = true;
|
|
||||||
EWOL_WARNING("(l " << pNode->Row() << ") Find a Group with the same Name : \"" << groupNameTmp <<"\"");
|
|
||||||
m_listGroup[iii]->Parse(pNode);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (findASameName == false) {
|
|
||||||
//EWOL_DEBUG("(l " << pNode->Row() << ") Add a new Group : \"" << groupNameTmp <<"\"");
|
|
||||||
ewol::theme::EolElementFrame * myGroupTmp = new ewol::theme::EolElementFrame();
|
|
||||||
if (NULL != myGroupTmp) {
|
|
||||||
myGroupTmp->Parse(pNode);
|
|
||||||
m_listGroup.PushBack(myGroupTmp);
|
|
||||||
} else {
|
|
||||||
EWOL_ERROR("(l " << pNode->Row() << ") Error Allocation : \"" << nodeValue <<"\"");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else if (nodeValue == "color") {
|
|
||||||
etk::UString colorNameTmp = pNode->ToElement()->Attribute("name");
|
|
||||||
if (colorNameTmp == "") {
|
|
||||||
EWOL_ERROR("(l " << pNode->Row() << ") Color with NO name ... (not parsed)");
|
|
||||||
// not added it
|
|
||||||
} else {
|
|
||||||
bool findASameName = false;
|
|
||||||
// check if existed ...
|
|
||||||
for (int32_t iii=0; iii < m_listColor.Size(); iii++) {
|
|
||||||
if(NULL!=m_listColor[iii]) {
|
|
||||||
if(m_listColor[iii]->HasName(colorNameTmp) == true) {
|
|
||||||
findASameName = true;
|
|
||||||
EWOL_WARNING("(l " << pNode->Row() << ") Find a color with the same Name : \"" << colorNameTmp <<"\"");
|
|
||||||
m_listColor[iii]->Parse(pNode);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (findASameName == false) {
|
|
||||||
//EWOL_DEBUG("(l " << pNode->Row() << ") Add a new COLOR : \"" << colorNameTmp <<"\"");
|
|
||||||
ewol::theme::EolColor * myColorTmp = new ewol::theme::EolColor();
|
|
||||||
if (NULL != myColorTmp) {
|
|
||||||
myColorTmp->Parse(pNode);
|
|
||||||
m_listColor.PushBack(myColorTmp);
|
|
||||||
} else {
|
|
||||||
EWOL_ERROR("(l " << pNode->Row() << ") Error Allocation : \"" << nodeValue <<"\"");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
EWOL_ERROR("(l " << pNode->Row() << ") node not suported : \"" << nodeValue <<"\" must be [group,color,element]");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (NULL != fileBuffer) {
|
if (NULL != fileBuffer) {
|
||||||
@ -194,90 +92,3 @@ void ewol::theme::Theme::Load(etk::File & newFile, bool defaultTheme)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool ewol::theme::Theme::GetColor(etk::UString colorName, color_ts & selectedColor)
|
|
||||||
{
|
|
||||||
for (int32_t iii=0; iii < m_listColor.Size(); iii++) {
|
|
||||||
if(NULL!=m_listColor[iii]) {
|
|
||||||
if(m_listColor[iii]->HasName(colorName) == true) {
|
|
||||||
selectedColor = m_listColor[iii]->Get();
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
selectedColor.red = 0.0;
|
|
||||||
selectedColor.green = 0.0;
|
|
||||||
selectedColor.blue = 0.0;
|
|
||||||
selectedColor.alpha = 1.0;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
void ewol::theme::Theme::Generate(int32_t id, int32_t frameId, ewol::OObject2DColored & newObject, etkFloat_t posX, etkFloat_t posY, etkFloat_t sizeX, etkFloat_t sizeY)
|
|
||||||
{
|
|
||||||
if (0 > id || id > m_listElement.Size()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (NULL != m_listElement[id]) {
|
|
||||||
m_listElement[id]->Generate(this, frameId, newObject, posX, posY, sizeX, sizeY);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
bool ewol::theme::Theme::GenerateGroup(etk::UString groupName, ewol::OObject2DColored & newObject, etkFloat_t posX, etkFloat_t posY, etkFloat_t sizeX, etkFloat_t sizeY)
|
|
||||||
{
|
|
||||||
if (groupName == "") {
|
|
||||||
EWOL_ERROR("Did not find the group name=" << groupName);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
for (int32_t iii=0; iii < m_listGroup.Size(); iii++) {
|
|
||||||
if(NULL!=m_listGroup[iii]) {
|
|
||||||
if(m_listGroup[iii]->HasName(groupName) == true) {
|
|
||||||
// TODO : Call Group display ...
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
int32_t ewol::theme::Theme::GetNbFrame(int32_t id)
|
|
||||||
{
|
|
||||||
if (0 > id || id > m_listElement.Size()) {
|
|
||||||
EWOL_ERROR("Did not find the Element id=" << id);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
if (NULL != m_listElement[id]) {
|
|
||||||
return m_listElement[id]->GetNbFrame();
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
int32_t ewol::theme::Theme::GetFrameId(int32_t id, etk::UString & frameName)
|
|
||||||
{
|
|
||||||
if (0 > id || id > m_listElement.Size()) {
|
|
||||||
EWOL_ERROR("Did not find the Element named=" << frameName);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
if (NULL != m_listElement[id]) {
|
|
||||||
return m_listElement[id]->GetFrameId(frameName);
|
|
||||||
}
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
int32_t ewol::theme::Theme::GetObjectId(etk::UString name)
|
|
||||||
{
|
|
||||||
if (name == "") {
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
for (int32_t iii=0; iii < m_listElement.Size(); iii++) {
|
|
||||||
if(NULL!=m_listElement[iii]) {
|
|
||||||
if(m_listElement[iii]->HasName(name) == true) {
|
|
||||||
return iii;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
EWOL_ERROR("Did not find the Element named=" << name);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
@ -26,44 +26,14 @@
|
|||||||
|
|
||||||
#ifndef __EWOL_EOL_THEME_H__
|
#ifndef __EWOL_EOL_THEME_H__
|
||||||
#define __EWOL_EOL_THEME_H__
|
#define __EWOL_EOL_THEME_H__
|
||||||
namespace ewol {
|
|
||||||
namespace theme {
|
|
||||||
class Theme;
|
|
||||||
class EolElement;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#include <etk/Types.h>
|
#include <etk/Types.h>
|
||||||
#include <etk/UString.h>
|
#include <etk/UString.h>
|
||||||
#include <etk/File.h>
|
#include <etk/File.h>
|
||||||
#include <etk/VectorType.h>
|
|
||||||
#include <ewol/OObject.h>
|
|
||||||
#include <ewol/theme/EolColor.h>
|
|
||||||
#include <ewol/theme/EolBase.h>
|
|
||||||
#include <ewol/theme/EolElement.h>
|
|
||||||
#include <ewol/theme/EolElementFrame.h>
|
|
||||||
|
|
||||||
namespace ewol {
|
namespace ewol {
|
||||||
namespace theme {
|
namespace theme {
|
||||||
class Theme {
|
void Load(etk::File & localFile);
|
||||||
public:
|
|
||||||
Theme(void);
|
|
||||||
virtual ~Theme(void);
|
|
||||||
void Load(etk::File & newFile, bool defaultTheme=false);
|
|
||||||
void Generate(int32_t id, int32_t frameId, ewol::OObject2DColored & newObject, etkFloat_t posX, etkFloat_t posY, etkFloat_t sizeX, etkFloat_t sizeY);
|
|
||||||
bool GenerateGroup(etk::UString groupName, ewol::OObject2DColored & newObject, etkFloat_t posX, etkFloat_t posY, etkFloat_t sizeX, etkFloat_t sizeY);
|
|
||||||
bool GetColor(etk::UString colorName, color_ts & selectedColor);
|
|
||||||
int32_t GetNbFrame(int32_t id);
|
|
||||||
int32_t GetFrameId(int32_t id, etk::UString & frameName);
|
|
||||||
int32_t GetObjectId(etk::UString name);
|
|
||||||
private:
|
|
||||||
etk::VectorType<ewol::theme::EolColor*> m_listColor;
|
|
||||||
etk::VectorType<ewol::theme::EolElementFrame*> m_listGroup;
|
|
||||||
etk::VectorType<ewol::theme::EolElement*> m_listElement;
|
|
||||||
public:
|
|
||||||
// acces to manage and create object ==> drawing system
|
|
||||||
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1,116 +0,0 @@
|
|||||||
/**
|
|
||||||
*******************************************************************************
|
|
||||||
* @file ewol/themeManager.cpp
|
|
||||||
* @brief basic ewol theme Manager (Sources)
|
|
||||||
* @author Edouard DUPIN
|
|
||||||
* @date 23/11/2011
|
|
||||||
* @par Project
|
|
||||||
* ewol
|
|
||||||
*
|
|
||||||
* @par Copyright
|
|
||||||
* Copyright 2011 Edouard DUPIN, all right reserved
|
|
||||||
*
|
|
||||||
* This software is distributed in the hope that it will be useful, but WITHOUT
|
|
||||||
* ANY WARRANTY.
|
|
||||||
*
|
|
||||||
* Licence summary :
|
|
||||||
* You can modify and redistribute the sources code and binaries.
|
|
||||||
* You can send me the bug-fix
|
|
||||||
*
|
|
||||||
* Term of the licence in in the file licence.txt.
|
|
||||||
*
|
|
||||||
*******************************************************************************
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <ewol/themeManager.h>
|
|
||||||
#include <ewol/theme/Theme.h>
|
|
||||||
|
|
||||||
|
|
||||||
#undef __class__
|
|
||||||
#define __class__ "ewol::theme"
|
|
||||||
|
|
||||||
static ewol::theme::Theme * localTheme = NULL;
|
|
||||||
|
|
||||||
void ewol::theme::Init(void)
|
|
||||||
{
|
|
||||||
EWOL_DEBUG("==> Init Theme-Manager");
|
|
||||||
localTheme = new ewol::theme::Theme();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void ewol::theme::UnInit(void)
|
|
||||||
{
|
|
||||||
EWOL_DEBUG("==> Un-Init Theme-Manager");
|
|
||||||
if (NULL != localTheme) {
|
|
||||||
delete(localTheme);
|
|
||||||
localTheme = NULL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void ewol::theme::LoadDefault(etk::File filename)
|
|
||||||
{
|
|
||||||
EWOL_INFO("Load default Theme : " << filename);
|
|
||||||
if (NULL == localTheme) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
localTheme->Load(filename, true);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void ewol::theme::Load(etk::File filename)
|
|
||||||
{
|
|
||||||
EWOL_INFO("Add personal theme : " << filename);
|
|
||||||
if (NULL == localTheme) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
localTheme->Load(filename, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
int32_t ewol::theme::GetObjectId(etk::UString name)
|
|
||||||
{
|
|
||||||
if (NULL == localTheme) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
return localTheme->GetObjectId(name);
|
|
||||||
}
|
|
||||||
|
|
||||||
// ???? GetObjectType(int32_t id);
|
|
||||||
|
|
||||||
|
|
||||||
void ewol::theme::Generate(int32_t id, int32_t frameId, ewol::OObject2DColored & newObject, etkFloat_t posX, etkFloat_t posY, etkFloat_t sizeX, etkFloat_t sizeY)
|
|
||||||
{
|
|
||||||
if (NULL == localTheme) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (id<0) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
localTheme->Generate(id, frameId, newObject, posX, posY, sizeX, sizeY);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
int32_t ewol::theme::GetNbFrame(int32_t id)
|
|
||||||
{
|
|
||||||
if (NULL == localTheme) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
if (id<0) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
return localTheme->GetNbFrame(id);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
int32_t ewol::theme::GetFrameId(int32_t id, etk::UString & frameName)
|
|
||||||
{
|
|
||||||
if (NULL == localTheme) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
if (id<0) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
return localTheme->GetFrameId(id, frameName);
|
|
||||||
}
|
|
||||||
|
|
@ -1,52 +0,0 @@
|
|||||||
/**
|
|
||||||
*******************************************************************************
|
|
||||||
* @file ewol/themeManager.h
|
|
||||||
* @brief basic ewol theme Manager (Header)
|
|
||||||
* @author Edouard DUPIN
|
|
||||||
* @date 23/11/2011
|
|
||||||
* @par Project
|
|
||||||
* ewol
|
|
||||||
*
|
|
||||||
* @par Copyright
|
|
||||||
* Copyright 2011 Edouard DUPIN, all right reserved
|
|
||||||
*
|
|
||||||
* This software is distributed in the hope that it will be useful, but WITHOUT
|
|
||||||
* ANY WARRANTY.
|
|
||||||
*
|
|
||||||
* Licence summary :
|
|
||||||
* You can modify and redistribute the sources code and binaries.
|
|
||||||
* You can send me the bug-fix
|
|
||||||
*
|
|
||||||
* Term of the licence in in the file licence.txt.
|
|
||||||
*
|
|
||||||
*******************************************************************************
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#ifndef __EWOL_THEME_MANAGER_H__
|
|
||||||
#define __EWOL_THEME_MANAGER_H__
|
|
||||||
|
|
||||||
#include <etk/Types.h>
|
|
||||||
#include <etk/UString.h>
|
|
||||||
#include <etk/File.h>
|
|
||||||
#include <ewol/OObject.h>
|
|
||||||
|
|
||||||
namespace ewol {
|
|
||||||
namespace theme {
|
|
||||||
void Init(void);
|
|
||||||
void UnInit(void);
|
|
||||||
void LoadDefault(etk::File filename); // default system theme ==> when an element in not find in the user theme, it is search in this one ... not needed
|
|
||||||
void Load(etk::File filename); // add a user theme at the list ==> this remove previous declaration by the user...
|
|
||||||
int32_t GetObjectId(etk::UString name);
|
|
||||||
// ???? GetObjectType(int32_t id);
|
|
||||||
void Generate(int32_t id, int32_t frameId, ewol::OObject2DColored & newObject, etkFloat_t posX, etkFloat_t posY, etkFloat_t sizeX, etkFloat_t sizeY);
|
|
||||||
int32_t GetNbFrame(int32_t id);
|
|
||||||
int32_t GetFrameId(int32_t id, etk::UString & frameName);
|
|
||||||
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
@ -68,15 +68,10 @@ void ewol::Button::Init(void)
|
|||||||
m_padding.x = 4;
|
m_padding.x = 4;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
m_textColorFg.red = 0.0;
|
m_textColorFg = etk::color::color_Black;
|
||||||
m_textColorFg.green = 0.0;
|
|
||||||
m_textColorFg.blue = 0.0;
|
|
||||||
m_textColorFg.alpha = 1.0;
|
|
||||||
|
|
||||||
m_textColorBg.red = 0.0;
|
m_textColorBg = etk::color::color_Black;
|
||||||
m_textColorBg.green = 0.0;
|
m_textColorBg.alpha = 0x3F;
|
||||||
m_textColorBg.blue = 0.0;
|
|
||||||
m_textColorBg.alpha = 0.25;
|
|
||||||
SetCanHaveFocus(true);
|
SetCanHaveFocus(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -63,10 +63,8 @@ void ewol::ButtonColor::Init(void)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
m_textColorBg.red = 0.0;
|
m_textColorBg = etk::color::color_Black;
|
||||||
m_textColorBg.green = 0.0;
|
m_textColorBg.alpha = 0x3F;
|
||||||
m_textColorBg.blue = 0.0;
|
|
||||||
m_textColorBg.alpha = 0.25;
|
|
||||||
m_widgetContextMenu = NULL;
|
m_widgetContextMenu = NULL;
|
||||||
SetCanHaveFocus(true);
|
SetCanHaveFocus(true);
|
||||||
}
|
}
|
||||||
|
@ -38,15 +38,8 @@ extern const char * const ewolEventCheckBoxClicked = "ewol CheckBox Clicked";
|
|||||||
void ewol::CheckBox::Init(void)
|
void ewol::CheckBox::Init(void)
|
||||||
{
|
{
|
||||||
AddEventId(ewolEventCheckBoxClicked);
|
AddEventId(ewolEventCheckBoxClicked);
|
||||||
m_textColorFg.red = 0.0;
|
m_textColorFg = etk::color::color_Black;
|
||||||
m_textColorFg.green = 0.0;
|
m_textColorBg = etk::color::color_White;
|
||||||
m_textColorFg.blue = 0.0;
|
|
||||||
m_textColorFg.alpha = 1.0;
|
|
||||||
|
|
||||||
m_textColorBg.red = 1.0;
|
|
||||||
m_textColorBg.green = 1.0;
|
|
||||||
m_textColorBg.blue = 1.0;
|
|
||||||
m_textColorBg.alpha = 1.0;
|
|
||||||
m_value = false;
|
m_value = false;
|
||||||
SetCanHaveFocus(true);
|
SetCanHaveFocus(true);
|
||||||
}
|
}
|
||||||
|
@ -48,10 +48,7 @@ ewol::ColorBar::ColorBar(void)
|
|||||||
#endif
|
#endif
|
||||||
m_currentUserPos.x=0;
|
m_currentUserPos.x=0;
|
||||||
m_currentUserPos.y=0;
|
m_currentUserPos.y=0;
|
||||||
m_currentColor.red = 0.0;
|
m_currentColor = etk::color::color_Black;
|
||||||
m_currentColor.green = 0.0;
|
|
||||||
m_currentColor.blue = 0.0;
|
|
||||||
m_currentColor.alpha = 1.0;
|
|
||||||
SetCanHaveFocus(true);
|
SetCanHaveFocus(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -106,17 +103,17 @@ bool ewol::ColorBar::CalculateMinSize(void)
|
|||||||
MarkToReedraw();
|
MarkToReedraw();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
static color_ts s_listColorWhite = {1.0, 1.0, 1.0, 1.0 };
|
static color_ts s_listColorWhite = {0xFF, 0xFF, 0xFF, 0xFF};
|
||||||
static color_ts s_listColorBlack = {0.0, 0.0, 0.0, 1.0 };
|
static color_ts s_listColorBlack = {0x00, 0x00, 0x00, 0xFF};
|
||||||
#define NB_BAND_COLOR (6)
|
#define NB_BAND_COLOR (6)
|
||||||
static color_ts s_listColor[NB_BAND_COLOR+1] = {
|
static color_ts s_listColor[NB_BAND_COLOR+1] = {
|
||||||
{1.0, 0.0, 0.0, 1.0 },
|
{0xFF, 0x00, 0x00, 0xFF},
|
||||||
{1.0, 1.0, 0.0, 1.0 },
|
{0xFF, 0xFF, 0x00, 0xFF},
|
||||||
{0.0, 1.0, 0.0, 1.0 },
|
{0x00, 0xFF, 0x00, 0xFF},
|
||||||
{0.0, 1.0, 1.0, 1.0 },
|
{0x00, 0xFF, 0xFF, 0xFF},
|
||||||
{0.0, 0.0, 1.0, 1.0 },
|
{0x00, 0x00, 0xFF, 0xFF},
|
||||||
{1.0, 0.0, 1.0, 1.0 },
|
{0xFF, 0x00, 0xFF, 0xFF},
|
||||||
{1.0, 0.0, 0.0, 1.0 }
|
{0xFF, 0x00, 0x00, 0xFF}
|
||||||
};
|
};
|
||||||
|
|
||||||
color_ts ewol::ColorBar::GetCurrentColor(void)
|
color_ts ewol::ColorBar::GetCurrentColor(void)
|
||||||
|
@ -40,15 +40,10 @@ ewol::ContextMenu::ContextMenu(void)
|
|||||||
m_padding.y = 4;
|
m_padding.y = 4;
|
||||||
m_offset = 20;
|
m_offset = 20;
|
||||||
|
|
||||||
m_colorBackGroung.red = 1.0;
|
m_colorBackGroung = etk::color::color_White;
|
||||||
m_colorBackGroung.green = 1.0;
|
|
||||||
m_colorBackGroung.blue = 1.0;
|
|
||||||
m_colorBackGroung.alpha = 1.0;
|
|
||||||
|
|
||||||
m_colorBorder.red = 0.0;
|
m_colorBorder = etk::color::color_Black;
|
||||||
m_colorBorder.green = 0.0;
|
m_colorBorder.alpha = 0x7F;
|
||||||
m_colorBorder.blue = 0.0;
|
|
||||||
m_colorBorder.alpha = 0.50;
|
|
||||||
|
|
||||||
m_arrowPos.x = 0;
|
m_arrowPos.x = 0;
|
||||||
m_arrowPos.y = 0;
|
m_arrowPos.y = 0;
|
||||||
|
@ -51,15 +51,10 @@ void ewol::Entry::Init(void)
|
|||||||
m_borderSize = 2;
|
m_borderSize = 2;
|
||||||
m_paddingSize = 3;
|
m_paddingSize = 3;
|
||||||
m_displayCursor = false;
|
m_displayCursor = false;
|
||||||
m_textColorFg.red = 0.0;
|
m_textColorFg = etk::color::color_Black;
|
||||||
m_textColorFg.green = 0.0;
|
|
||||||
m_textColorFg.blue = 0.0;
|
|
||||||
m_textColorFg.alpha = 1.0;
|
|
||||||
|
|
||||||
m_textColorBg.red = 1.0;
|
m_textColorBg = etk::color::color_White;
|
||||||
m_textColorBg.green = 1.0;
|
m_textColorBg.alpha = 0xAF;
|
||||||
m_textColorBg.blue = 1.0;
|
|
||||||
m_textColorBg.alpha = 0.75;
|
|
||||||
SetCanHaveFocus(true);
|
SetCanHaveFocus(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -103,15 +103,10 @@ ewol::Joystick::Joystick(void)
|
|||||||
m_lock = false;
|
m_lock = false;
|
||||||
m_displayMode = ewol::JOYSTICK_NORMAL_MODE;
|
m_displayMode = ewol::JOYSTICK_NORMAL_MODE;
|
||||||
|
|
||||||
m_colorFg.red = 1.0;
|
m_colorFg = etk::color::color_Blue;
|
||||||
m_colorFg.green = 0.0;
|
|
||||||
m_colorFg.blue = 0.0;
|
|
||||||
m_colorFg.alpha = 1.0;
|
|
||||||
|
|
||||||
m_colorBg.red = 0.0;
|
m_colorBg = etk::color::color_Black;
|
||||||
m_colorBg.green = 0.0;
|
m_colorBg.alpha = 0x3F;
|
||||||
m_colorBg.blue = 0.0;
|
|
||||||
m_colorBg.alpha = 0.25;
|
|
||||||
|
|
||||||
m_displayPos.x = 0.0;
|
m_displayPos.x = 0.0;
|
||||||
m_displayPos.y = 0.0;
|
m_displayPos.y = 0.0;
|
||||||
|
@ -39,10 +39,7 @@ extern const char * const ewolEventLabelPressed = "ewol Label Pressed";
|
|||||||
void ewol::Label::Init(void)
|
void ewol::Label::Init(void)
|
||||||
{
|
{
|
||||||
AddEventId(ewolEventLabelPressed);
|
AddEventId(ewolEventLabelPressed);
|
||||||
m_textColorFg.red = 0.0;
|
m_textColorFg = etk::color::color_Black;
|
||||||
m_textColorFg.green = 0.0;
|
|
||||||
m_textColorFg.blue = 0.0;
|
|
||||||
m_textColorFg.alpha = 1.0;
|
|
||||||
SetCanHaveFocus(false);
|
SetCanHaveFocus(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -34,21 +34,14 @@ ewol::PopUp::PopUp(void)
|
|||||||
{
|
{
|
||||||
m_userExpendX = true;
|
m_userExpendX = true;
|
||||||
m_userExpendY = true;
|
m_userExpendY = true;
|
||||||
|
|
||||||
m_colorBackGroung.red = 1.0;
|
|
||||||
m_colorBackGroung.green = 1.0;
|
|
||||||
m_colorBackGroung.blue = 1.0;
|
|
||||||
m_colorBackGroung.alpha = 1.0;
|
|
||||||
|
|
||||||
m_colorEmptyArea.red = 0.0;
|
|
||||||
m_colorEmptyArea.green = 0.0;
|
|
||||||
m_colorEmptyArea.blue = 0.0;
|
|
||||||
m_colorEmptyArea.alpha = 0.50;
|
|
||||||
|
|
||||||
m_colorBorder.red = 0.0;
|
m_colorBackGroung = etk::color::color_White;
|
||||||
m_colorBorder.green = 0.0;
|
|
||||||
m_colorBorder.blue = 0.0;
|
m_colorEmptyArea = etk::color::color_Black;
|
||||||
m_colorBorder.alpha = 0.50;
|
m_colorEmptyArea.alpha = 0x7F;
|
||||||
|
|
||||||
|
m_colorBorder = etk::color::color_Black;
|
||||||
|
m_colorBorder.alpha = 0x7F;
|
||||||
|
|
||||||
for (int32_t iii=0; iii<NB_BOUBLE_BUFFER; iii++) {
|
for (int32_t iii=0; iii<NB_BOUBLE_BUFFER; iii++) {
|
||||||
m_subWidget[iii] = 0;
|
m_subWidget[iii] = 0;
|
||||||
|
@ -36,20 +36,15 @@ ewol::ProgressBar::ProgressBar(void)
|
|||||||
{
|
{
|
||||||
m_value = 0.0;
|
m_value = 0.0;
|
||||||
|
|
||||||
m_textColorFg.red = 0.0;
|
m_textColorFg = etk::color::color_Black;
|
||||||
m_textColorFg.green = 0.0;
|
|
||||||
m_textColorFg.blue = 0.0;
|
|
||||||
m_textColorFg.alpha = 1.0;
|
|
||||||
|
|
||||||
m_textColorBgOn.red = 0.0;
|
m_textColorBgOn.red = 0;
|
||||||
m_textColorBgOn.green = 1.0;
|
m_textColorBgOn.green = 0xFF;
|
||||||
m_textColorBgOn.blue = 0.0;
|
m_textColorBgOn.blue = 0;
|
||||||
m_textColorBgOn.alpha = 1.0;
|
m_textColorBgOn.alpha = 0xFF;
|
||||||
|
|
||||||
m_textColorBgOff.red = 0.0;
|
m_textColorBgOff = etk::color::color_Black;
|
||||||
m_textColorBgOff.green = 0.0;
|
m_textColorBgOff.alpha = 0x3F;
|
||||||
m_textColorBgOff.blue = 0.0;
|
|
||||||
m_textColorBgOff.alpha = 0.25;
|
|
||||||
SetCanHaveFocus(true);
|
SetCanHaveFocus(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -45,15 +45,12 @@ ewol::Slider::Slider(void)
|
|||||||
m_min = 0;
|
m_min = 0;
|
||||||
m_max = 10;
|
m_max = 10;
|
||||||
|
|
||||||
m_textColorFg.red = 0.0;
|
m_textColorFg = etk::color::color_Black;
|
||||||
m_textColorFg.green = 0.0;
|
|
||||||
m_textColorFg.blue = 0.0;
|
|
||||||
m_textColorFg.alpha = 1.0;
|
|
||||||
|
|
||||||
m_textColorBg.red = 0.0;
|
m_textColorBg.red = 0;
|
||||||
m_textColorBg.green = 0.0;
|
m_textColorBg.green = 0;
|
||||||
m_textColorBg.blue = 0.0;
|
m_textColorBg.blue = 0;
|
||||||
m_textColorBg.alpha = 0.25;
|
m_textColorBg.alpha = 0x3F;
|
||||||
SetCanHaveFocus(true);
|
SetCanHaveFocus(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -72,10 +72,7 @@ ewol::ColorChooser::ColorChooser(void)
|
|||||||
SubWidgetAdd(m_widgetColorBar);
|
SubWidgetAdd(m_widgetColorBar);
|
||||||
|
|
||||||
color_ts sliderColor;
|
color_ts sliderColor;
|
||||||
sliderColor.red = 0.0;
|
sliderColor = etk::color::color_Black;
|
||||||
sliderColor.green = 0.0;
|
|
||||||
sliderColor.blue = 0.0;
|
|
||||||
sliderColor.alpha = 1.0;
|
|
||||||
|
|
||||||
m_widgetRed = new ewol::Slider();
|
m_widgetRed = new ewol::Slider();
|
||||||
m_widgetRed->RegisterOnEvent(this, ewolEventSliderChange, eventColorSpecificHasChange);
|
m_widgetRed->RegisterOnEvent(this, ewolEventSliderChange, eventColorSpecificHasChange);
|
||||||
@ -83,18 +80,18 @@ ewol::ColorChooser::ColorChooser(void)
|
|||||||
m_widgetRed->SetFillX(true);
|
m_widgetRed->SetFillX(true);
|
||||||
m_widgetRed->SetMin(0);
|
m_widgetRed->SetMin(0);
|
||||||
m_widgetRed->SetMax(255);
|
m_widgetRed->SetMax(255);
|
||||||
sliderColor.red = 1.0;
|
sliderColor.red = 0xFF;
|
||||||
m_widgetRed->SetColor(sliderColor);
|
m_widgetRed->SetColor(sliderColor);
|
||||||
sliderColor.red = 0.0;
|
sliderColor.red = 0;
|
||||||
SubWidgetAdd(m_widgetRed);
|
SubWidgetAdd(m_widgetRed);
|
||||||
m_widgetGreen = new ewol::Slider();
|
m_widgetGreen = new ewol::Slider();
|
||||||
m_widgetGreen->RegisterOnEvent(this, ewolEventSliderChange, eventColorSpecificHasChange);
|
m_widgetGreen->RegisterOnEvent(this, ewolEventSliderChange, eventColorSpecificHasChange);
|
||||||
m_widgetGreen->SetExpendX(true);
|
m_widgetGreen->SetExpendX(true);
|
||||||
m_widgetGreen->SetFillX(true);
|
m_widgetGreen->SetFillX(true);
|
||||||
m_widgetGreen->SetMin(0);
|
m_widgetGreen->SetMin(0);
|
||||||
sliderColor.green = 1.0;
|
sliderColor.green = 0xFF;
|
||||||
m_widgetGreen->SetColor(sliderColor);
|
m_widgetGreen->SetColor(sliderColor);
|
||||||
sliderColor.green = 0.0;
|
sliderColor.green = 0;
|
||||||
m_widgetGreen->SetMax(255);
|
m_widgetGreen->SetMax(255);
|
||||||
SubWidgetAdd(m_widgetGreen);
|
SubWidgetAdd(m_widgetGreen);
|
||||||
m_widgetBlue = new ewol::Slider();
|
m_widgetBlue = new ewol::Slider();
|
||||||
@ -102,9 +99,9 @@ ewol::ColorChooser::ColorChooser(void)
|
|||||||
m_widgetBlue->SetExpendX(true);
|
m_widgetBlue->SetExpendX(true);
|
||||||
m_widgetBlue->SetFillX(true);
|
m_widgetBlue->SetFillX(true);
|
||||||
m_widgetBlue->SetMin(0);
|
m_widgetBlue->SetMin(0);
|
||||||
sliderColor.blue = 1.0;
|
sliderColor.blue = 0xFF;
|
||||||
m_widgetBlue->SetColor(sliderColor);
|
m_widgetBlue->SetColor(sliderColor);
|
||||||
sliderColor.blue = 0.0;
|
sliderColor.blue = 0;
|
||||||
m_widgetBlue->SetMax(255);
|
m_widgetBlue->SetMax(255);
|
||||||
SubWidgetAdd(m_widgetBlue);
|
SubWidgetAdd(m_widgetBlue);
|
||||||
m_widgetAlpha = new ewol::Slider();
|
m_widgetAlpha = new ewol::Slider();
|
||||||
@ -115,10 +112,7 @@ ewol::ColorChooser::ColorChooser(void)
|
|||||||
m_widgetAlpha->SetMax(255);
|
m_widgetAlpha->SetMax(255);
|
||||||
SubWidgetAdd(m_widgetAlpha);
|
SubWidgetAdd(m_widgetAlpha);
|
||||||
|
|
||||||
m_currentColor.red = 1.0;
|
m_currentColor = etk::color::color_White;
|
||||||
m_currentColor.green = 1.0;
|
|
||||||
m_currentColor.blue = 1.0;
|
|
||||||
m_currentColor.alpha = 1.0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -170,16 +164,16 @@ void ewol::ColorChooser::SetColor(color_ts newColor)
|
|||||||
{
|
{
|
||||||
m_currentColor = newColor;
|
m_currentColor = newColor;
|
||||||
if (NULL != m_widgetRed) {
|
if (NULL != m_widgetRed) {
|
||||||
m_widgetRed->SetValue(m_currentColor.red * 255.);
|
m_widgetRed->SetValue(m_currentColor.red);
|
||||||
}
|
}
|
||||||
if (NULL != m_widgetGreen) {
|
if (NULL != m_widgetGreen) {
|
||||||
m_widgetGreen->SetValue(m_currentColor.green * 255.);
|
m_widgetGreen->SetValue(m_currentColor.green);
|
||||||
}
|
}
|
||||||
if (NULL != m_widgetBlue) {
|
if (NULL != m_widgetBlue) {
|
||||||
m_widgetBlue->SetValue(m_currentColor.blue * 255.);
|
m_widgetBlue->SetValue(m_currentColor.blue);
|
||||||
}
|
}
|
||||||
if (NULL != m_widgetAlpha) {
|
if (NULL != m_widgetAlpha) {
|
||||||
m_widgetAlpha->SetValue(m_currentColor.alpha * 255.);
|
m_widgetAlpha->SetValue(m_currentColor.alpha);
|
||||||
}
|
}
|
||||||
if (NULL != m_widgetColorBar) {
|
if (NULL != m_widgetColorBar) {
|
||||||
m_widgetColorBar->SetCurrentColor(m_currentColor);
|
m_widgetColorBar->SetCurrentColor(m_currentColor);
|
||||||
@ -215,31 +209,31 @@ void ewol::ColorChooser::OnReceiveMessage(ewol::EObject * CallerObject, const ch
|
|||||||
}
|
}
|
||||||
m_currentColor.alpha = tmpAlpha;
|
m_currentColor.alpha = tmpAlpha;
|
||||||
if (NULL != m_widgetRed) {
|
if (NULL != m_widgetRed) {
|
||||||
m_widgetRed->SetValue(m_currentColor.red * 255.);
|
m_widgetRed->SetValue(m_currentColor.red);
|
||||||
}
|
}
|
||||||
if (NULL != m_widgetGreen) {
|
if (NULL != m_widgetGreen) {
|
||||||
m_widgetGreen->SetValue(m_currentColor.green * 255.);
|
m_widgetGreen->SetValue(m_currentColor.green);
|
||||||
}
|
}
|
||||||
if (NULL != m_widgetBlue) {
|
if (NULL != m_widgetBlue) {
|
||||||
m_widgetBlue->SetValue(m_currentColor.blue * 255.);
|
m_widgetBlue->SetValue(m_currentColor.blue);
|
||||||
}
|
}
|
||||||
if (NULL != m_widgetAlpha) {
|
if (NULL != m_widgetAlpha) {
|
||||||
m_widgetAlpha->SetValue(m_currentColor.alpha * 255.);
|
m_widgetAlpha->SetValue(m_currentColor.alpha);
|
||||||
}
|
}
|
||||||
GenerateEventId(ewolEventColorChooserChange);
|
GenerateEventId(ewolEventColorChooserChange);
|
||||||
} else if (eventColorSpecificHasChange == eventId) {
|
} else if (eventColorSpecificHasChange == eventId) {
|
||||||
// Slider has changes his color ==> get the one change ...
|
// Slider has changes his color ==> get the one change ...
|
||||||
if (CallerObject == m_widgetRed) {
|
if (CallerObject == m_widgetRed) {
|
||||||
m_currentColor.red = m_widgetRed->GetValue() / 255.;
|
m_currentColor.red = m_widgetRed->GetValue();
|
||||||
}
|
}
|
||||||
if (CallerObject == m_widgetGreen) {
|
if (CallerObject == m_widgetGreen) {
|
||||||
m_currentColor.green = m_widgetGreen->GetValue() / 255.;
|
m_currentColor.green = m_widgetGreen->GetValue();
|
||||||
}
|
}
|
||||||
if (CallerObject == m_widgetBlue) {
|
if (CallerObject == m_widgetBlue) {
|
||||||
m_currentColor.blue = m_widgetBlue->GetValue() / 255.;
|
m_currentColor.blue = m_widgetBlue->GetValue();
|
||||||
}
|
}
|
||||||
if (CallerObject == m_widgetAlpha) {
|
if (CallerObject == m_widgetAlpha) {
|
||||||
m_currentColor.alpha = m_widgetAlpha->GetValue() / 255.;
|
m_currentColor.alpha = m_widgetAlpha->GetValue();
|
||||||
}
|
}
|
||||||
if (NULL != m_widgetColorBar) {
|
if (NULL != m_widgetColorBar) {
|
||||||
m_widgetColorBar->SetCurrentColor(m_currentColor);
|
m_widgetColorBar->SetCurrentColor(m_currentColor);
|
||||||
|
@ -116,10 +116,10 @@ class FileChooserFolderList : public ewol::List
|
|||||||
|
|
||||||
virtual color_ts GetBasicBG(void) {
|
virtual color_ts GetBasicBG(void) {
|
||||||
color_ts bg;
|
color_ts bg;
|
||||||
bg.red = 0.0;
|
bg.red = 0;
|
||||||
bg.green = 0.0;
|
bg.green = 0;
|
||||||
bg.blue = 0.0;
|
bg.blue = 0;
|
||||||
bg.alpha = 0.2;
|
bg.alpha = 0x30;
|
||||||
return bg;
|
return bg;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -139,26 +139,20 @@ class FileChooserFolderList : public ewol::List
|
|||||||
} else {
|
} else {
|
||||||
myTextToWrite = "ERROR";
|
myTextToWrite = "ERROR";
|
||||||
}
|
}
|
||||||
fg.red = 0.0;
|
fg = etk::color::color_Black;
|
||||||
fg.green = 0.0;
|
|
||||||
fg.blue = 0.0;
|
|
||||||
fg.alpha = 1.0;
|
|
||||||
if (raw % 2) {
|
if (raw % 2) {
|
||||||
bg.red = 1.0;
|
bg = etk::color::color_White;
|
||||||
bg.green = 1.0;
|
|
||||||
bg.blue = 1.0;
|
|
||||||
bg.alpha = 1.0;
|
|
||||||
} else {
|
} else {
|
||||||
bg.red = 0.5;
|
bg.red = 0x7F;
|
||||||
bg.green = 0.5;
|
bg.green = 0x7F;
|
||||||
bg.blue = 0.5;
|
bg.blue = 0x7F;
|
||||||
bg.alpha = 1.0;
|
bg.alpha = 0xFF;
|
||||||
}
|
}
|
||||||
if (m_selectedLine == raw) {
|
if (m_selectedLine == raw) {
|
||||||
bg.red = 0.6;
|
bg.red = 0x8F;
|
||||||
bg.green = 0.6;
|
bg.green = 0x8F;
|
||||||
bg.blue = 1.0;
|
bg.blue = 0xFF;
|
||||||
bg.alpha = 1.0;
|
bg.alpha = 0xFF;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
@ -253,10 +247,10 @@ class FileChooserFileList : public ewol::List
|
|||||||
};
|
};
|
||||||
virtual color_ts GetBasicBG(void) {
|
virtual color_ts GetBasicBG(void) {
|
||||||
color_ts bg;
|
color_ts bg;
|
||||||
bg.red = 0.0;
|
bg.red = 0;
|
||||||
bg.green = 0.0;
|
bg.green = 0;
|
||||||
bg.blue = 0.0;
|
bg.blue = 0;
|
||||||
bg.alpha = 0.2;
|
bg.alpha = 0x30;
|
||||||
return bg;
|
return bg;
|
||||||
}
|
}
|
||||||
void AddElement(etk::UString element)
|
void AddElement(etk::UString element)
|
||||||
@ -306,26 +300,23 @@ class FileChooserFileList : public ewol::List
|
|||||||
} else {
|
} else {
|
||||||
myTextToWrite = "ERROR";
|
myTextToWrite = "ERROR";
|
||||||
}
|
}
|
||||||
fg.red = 0.0;
|
fg = etk::color::color_Black;
|
||||||
fg.green = 0.0;
|
|
||||||
fg.blue = 0.0;
|
|
||||||
fg.alpha = 1.0;
|
|
||||||
if (raw % 2) {
|
if (raw % 2) {
|
||||||
bg.red = 0.9;
|
bg.red = 0xCF;
|
||||||
bg.green = 1.0;
|
bg.green = 0xFF;
|
||||||
bg.blue = 1.0;
|
bg.blue = 0xFF;
|
||||||
bg.alpha = 1.0;
|
bg.alpha = 0xFF;
|
||||||
} else {
|
} else {
|
||||||
bg.red = 0.7;
|
bg.red = 0x9F;
|
||||||
bg.green = 0.7;
|
bg.green = 0x9F;
|
||||||
bg.blue = 0.7;
|
bg.blue = 0x9F;
|
||||||
bg.alpha = 1.0;
|
bg.alpha = 0xFF;
|
||||||
}
|
}
|
||||||
if (m_selectedLine == raw) {
|
if (m_selectedLine == raw) {
|
||||||
bg.red = 0.6;
|
bg.red = 0x8F;
|
||||||
bg.green = 0.6;
|
bg.green = 0x8F;
|
||||||
bg.blue = 1.0;
|
bg.blue = 0xFF;
|
||||||
bg.alpha = 1.0;
|
bg.alpha = 0xFF;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
|
@ -50,17 +50,6 @@ FILE_LIST = ewol/ewol.cpp \
|
|||||||
ewol/widgetMeta/FileChooser.cpp \
|
ewol/widgetMeta/FileChooser.cpp \
|
||||||
ewol/widgetMeta/ColorChooser.cpp \
|
ewol/widgetMeta/ColorChooser.cpp \
|
||||||
ewol/widgetMeta/Keyboard.cpp \
|
ewol/widgetMeta/Keyboard.cpp \
|
||||||
ewol/themeManager.cpp \
|
ewol/theme/Theme.cpp
|
||||||
ewol/theme/Theme.cpp \
|
|
||||||
ewol/theme/EolElement.cpp \
|
|
||||||
ewol/theme/EolElementFrame.cpp \
|
|
||||||
ewol/theme/EolColor.cpp \
|
|
||||||
ewol/theme/EolBase.cpp \
|
|
||||||
ewol/theme/EolBaseCircle.cpp \
|
|
||||||
ewol/theme/EolBaseCirclePart.cpp \
|
|
||||||
ewol/theme/EolBaseLine.cpp \
|
|
||||||
ewol/theme/EolBasePolygone.cpp \
|
|
||||||
ewol/theme/EolBaseRect.cpp \
|
|
||||||
ewol/theme/EolBaseTriangle.cpp
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -350,162 +350,6 @@ void svg::Base::ParsePaintAttr(const TiXmlNode *node)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
typedef struct {
|
|
||||||
const char * colorName;
|
|
||||||
uint32_t color;
|
|
||||||
} colorList_ts;
|
|
||||||
|
|
||||||
const colorList_ts listOfColor[] = {
|
|
||||||
{ "none", 0x00000000},
|
|
||||||
{ "AliceBlue", 0xF0F8FFFF},
|
|
||||||
{ "AntiqueWhite", 0xFAEBD7FF},
|
|
||||||
{ "Aqua", 0x00FFFFFF},
|
|
||||||
{ "Aquamarine", 0x7FFFD4FF},
|
|
||||||
{ "Azure", 0xF0FFFFFF},
|
|
||||||
{ "Beige", 0xF5F5DCFF},
|
|
||||||
{ "Bisque", 0xFFE4C4FF},
|
|
||||||
{ "Black", 0x000000FF},
|
|
||||||
{ "BlanchedAlmond", 0xFFEBCDFF},
|
|
||||||
{ "Blue", 0x0000FFFF},
|
|
||||||
{ "BlueViolet", 0x8A2BE2FF},
|
|
||||||
{ "Brown", 0xA52A2AFF},
|
|
||||||
{ "BurlyWood", 0xDEB887FF},
|
|
||||||
{ "CadetBlue", 0x5F9EA0FF},
|
|
||||||
{ "Chartreuse", 0x7FFF00FF},
|
|
||||||
{ "Chocolate", 0xD2691EFF},
|
|
||||||
{ "Coral", 0xFF7F50FF},
|
|
||||||
{ "CornflowerBlue", 0x6495EDFF},
|
|
||||||
{ "Cornsilk", 0xFFF8DCFF},
|
|
||||||
{ "Crimson", 0xDC143CFF},
|
|
||||||
{ "Cyan", 0x00FFFFFF},
|
|
||||||
{ "DarkBlue", 0x00008BFF},
|
|
||||||
{ "DarkCyan", 0x008B8BFF},
|
|
||||||
{ "DarkGoldenRod", 0xB8860BFF},
|
|
||||||
{ "DarkGray", 0xA9A9A9FF},
|
|
||||||
{ "DarkGrey", 0xA9A9A9FF},
|
|
||||||
{ "DarkGreen", 0x006400FF},
|
|
||||||
{ "DarkKhaki", 0xBDB76BFF},
|
|
||||||
{ "DarkMagenta", 0x8B008BFF},
|
|
||||||
{ "DarkOliveGreen", 0x556B2FFF},
|
|
||||||
{ "Darkorange", 0xFF8C00FF},
|
|
||||||
{ "DarkOrchid", 0x9932CCFF},
|
|
||||||
{ "DarkRed", 0x8B0000FF},
|
|
||||||
{ "DarkSalmon", 0xE9967AFF},
|
|
||||||
{ "DarkSeaGreen", 0x8FBC8FFF},
|
|
||||||
{ "DarkSlateBlue", 0x483D8BFF},
|
|
||||||
{ "DarkSlateGray", 0x2F4F4FFF},
|
|
||||||
{ "DarkSlateGrey", 0x2F4F4FFF},
|
|
||||||
{ "DarkTurquoise", 0x00CED1FF},
|
|
||||||
{ "DarkViolet", 0x9400D3FF},
|
|
||||||
{ "DeepPink", 0xFF1493FF},
|
|
||||||
{ "DeepSkyBlue", 0x00BFFFFF},
|
|
||||||
{ "DimGray", 0x696969FF},
|
|
||||||
{ "DimGrey", 0x696969FF},
|
|
||||||
{ "DodgerBlue", 0x1E90FFFF},
|
|
||||||
{ "FireBrick", 0xB22222FF},
|
|
||||||
{ "FloralWhite", 0xFFFAF0FF},
|
|
||||||
{ "ForestGreen", 0x228B22FF},
|
|
||||||
{ "Fuchsia", 0xFF00FFFF},
|
|
||||||
{ "Gainsboro", 0xDCDCDCFF},
|
|
||||||
{ "GhostWhite", 0xF8F8FFFF},
|
|
||||||
{ "Gold", 0xFFD700FF},
|
|
||||||
{ "GoldenRod", 0xDAA520FF},
|
|
||||||
{ "Gray", 0x808080FF},
|
|
||||||
{ "Grey", 0x808080FF},
|
|
||||||
{ "Green", 0x008000FF},
|
|
||||||
{ "GreenYellow", 0xADFF2FFF},
|
|
||||||
{ "HoneyDew", 0xF0FFF0FF},
|
|
||||||
{ "HotPink", 0xFF69B4FF},
|
|
||||||
{ "IndianRed ", 0xCD5C5CFF},
|
|
||||||
{ "Indigo ", 0x4B0082FF},
|
|
||||||
{ "Ivory", 0xFFFFF0FF},
|
|
||||||
{ "Khaki", 0xF0E68CFF},
|
|
||||||
{ "Lavender", 0xE6E6FAFF},
|
|
||||||
{ "LavenderBlush", 0xFFF0F5FF},
|
|
||||||
{ "LawnGreen", 0x7CFC00FF},
|
|
||||||
{ "LemonChiffon", 0xFFFACDFF},
|
|
||||||
{ "LightBlue", 0xADD8E6FF},
|
|
||||||
{ "LightCoral", 0xF08080FF},
|
|
||||||
{ "LightCyan", 0xE0FFFFFF},
|
|
||||||
{ "LightGoldenRodYellow", 0xFAFAD2FF},
|
|
||||||
{ "LightGray", 0xD3D3D3FF},
|
|
||||||
{ "LightGrey", 0xD3D3D3FF},
|
|
||||||
{ "LightGreen", 0x90EE90FF},
|
|
||||||
{ "LightPink", 0xFFB6C1FF},
|
|
||||||
{ "LightSalmon", 0xFFA07AFF},
|
|
||||||
{ "LightSeaGreen", 0x20B2AAFF},
|
|
||||||
{ "LightSkyBlue", 0x87CEFAFF},
|
|
||||||
{ "LightSlateGray", 0x778899FF},
|
|
||||||
{ "LightSlateGrey", 0x778899FF},
|
|
||||||
{ "LightSteelBlue", 0xB0C4DEFF},
|
|
||||||
{ "LightYellow", 0xFFFFE0FF},
|
|
||||||
{ "Lime", 0x00FF00FF},
|
|
||||||
{ "LimeGreen", 0x32CD32FF},
|
|
||||||
{ "Linen", 0xFAF0E6FF},
|
|
||||||
{ "Magenta", 0xFF00FFFF},
|
|
||||||
{ "Maroon", 0x800000FF},
|
|
||||||
{ "MediumAquaMarine", 0x66CDAAFF},
|
|
||||||
{ "MediumBlue", 0x0000CDFF},
|
|
||||||
{ "MediumOrchid", 0xBA55D3FF},
|
|
||||||
{ "MediumPurple", 0x9370D8FF},
|
|
||||||
{ "MediumSeaGreen", 0x3CB371FF},
|
|
||||||
{ "MediumSlateBlue", 0x7B68EEFF},
|
|
||||||
{ "MediumSpringGreen", 0x00FA9AFF},
|
|
||||||
{ "MediumTurquoise", 0x48D1CCFF},
|
|
||||||
{ "MediumVioletRed", 0xC71585FF},
|
|
||||||
{ "MidnightBlue", 0x191970FF},
|
|
||||||
{ "MintCream", 0xF5FFFAFF},
|
|
||||||
{ "MistyRose", 0xFFE4E1FF},
|
|
||||||
{ "Moccasin", 0xFFE4B5FF},
|
|
||||||
{ "NavajoWhite", 0xFFDEADFF},
|
|
||||||
{ "Navy", 0x000080FF},
|
|
||||||
{ "OldLace", 0xFDF5E6FF},
|
|
||||||
{ "Olive", 0x808000FF},
|
|
||||||
{ "OliveDrab", 0x6B8E23FF},
|
|
||||||
{ "Orange", 0xFFA500FF},
|
|
||||||
{ "OrangeRed", 0xFF4500FF},
|
|
||||||
{ "Orchid", 0xDA70D6FF},
|
|
||||||
{ "PaleGoldenRod", 0xEEE8AAFF},
|
|
||||||
{ "PaleGreen", 0x98FB98FF},
|
|
||||||
{ "PaleTurquoise", 0xAFEEEEFF},
|
|
||||||
{ "PaleVioletRed", 0xD87093FF},
|
|
||||||
{ "PapayaWhip", 0xFFEFD5FF},
|
|
||||||
{ "PeachPuff", 0xFFDAB9FF},
|
|
||||||
{ "Peru", 0xCD853FFF},
|
|
||||||
{ "Pink", 0xFFC0CBFF},
|
|
||||||
{ "Plum", 0xDDA0DDFF},
|
|
||||||
{ "PowderBlue", 0xB0E0E6FF},
|
|
||||||
{ "Purple", 0x800080FF},
|
|
||||||
{ "Red", 0xFF0000FF},
|
|
||||||
{ "RosyBrown", 0xBC8F8FFF},
|
|
||||||
{ "RoyalBlue", 0x4169E1FF},
|
|
||||||
{ "SaddleBrown", 0x8B4513FF},
|
|
||||||
{ "Salmon", 0xFA8072FF},
|
|
||||||
{ "SandyBrown", 0xF4A460FF},
|
|
||||||
{ "SeaGreen", 0x2E8B57FF},
|
|
||||||
{ "SeaShell", 0xFFF5EEFF},
|
|
||||||
{ "Sienna", 0xA0522DFF},
|
|
||||||
{ "Silver", 0xC0C0C0FF},
|
|
||||||
{ "SkyBlue", 0x87CEEBFF},
|
|
||||||
{ "SlateBlue", 0x6A5ACDFF},
|
|
||||||
{ "SlateGray", 0x708090FF},
|
|
||||||
{ "SlateGrey", 0x708090FF},
|
|
||||||
{ "Snow", 0xFFFAFAFF},
|
|
||||||
{ "SpringGreen", 0x00FF7FFF},
|
|
||||||
{ "SteelBlue", 0x4682B4FF},
|
|
||||||
{ "Tan", 0xD2B48CFF},
|
|
||||||
{ "Teal", 0x008080FF},
|
|
||||||
{ "Thistle", 0xD8BFD8FF},
|
|
||||||
{ "Tomato", 0xFF6347FF},
|
|
||||||
{ "Turquoise", 0x40E0D0FF},
|
|
||||||
{ "Violet", 0xEE82EEFF},
|
|
||||||
{ "Wheat", 0xF5DEB3FF},
|
|
||||||
{ "White", 0xFFFFFFFF},
|
|
||||||
{ "WhiteSmoke", 0xF5F5F5FF},
|
|
||||||
{ "Yellow", 0xFFFF00FF},
|
|
||||||
{ "YellowGreen", 0x9ACD32FF}
|
|
||||||
};
|
|
||||||
const int32_t listOfColorSize = sizeof(listOfColor) / sizeof(colorList_ts);
|
|
||||||
|
|
||||||
bool strnCmpNoCase(const char * input1, const char * input2, int32_t maxLen)
|
bool strnCmpNoCase(const char * input1, const char * input2, int32_t maxLen)
|
||||||
{
|
{
|
||||||
@ -537,118 +381,23 @@ bool strnCmpNoCase(const char * input1, const char * input2, int32_t maxLen)
|
|||||||
* @param[in] inputData Data C String with the xml definition
|
* @param[in] inputData Data C String with the xml definition
|
||||||
* @return the parsed color
|
* @return the parsed color
|
||||||
*/
|
*/
|
||||||
color8_ts svg::Base::ParseColor(const char *inputData)
|
color_ts svg::Base::ParseColor(const char *inputData)
|
||||||
{
|
{
|
||||||
color8_ts localColor;
|
color_ts localColor = etk::color::color_White;;
|
||||||
localColor.red =0xFF;
|
|
||||||
localColor.green=0xFF;
|
|
||||||
localColor.blue =0xFF;
|
|
||||||
localColor.alpha=0xFF;
|
|
||||||
|
|
||||||
uint32_t red, green, blue, alpha;
|
|
||||||
float fred, fgreen, fblue, falpha;
|
|
||||||
size_t len = strlen(inputData);
|
size_t len = strlen(inputData);
|
||||||
|
|
||||||
if( len >=1
|
if( 4 < len
|
||||||
&& inputData[0] == '#') {
|
&& inputData[0] == 'u'
|
||||||
if(len == 4) {
|
&& inputData[1] == 'r'
|
||||||
if (sscanf(inputData + 1, "%1x%1x%1x", &red, &green, &blue) == 3) {
|
&& inputData[2] == 'l'
|
||||||
localColor.red = (red | red << 4);
|
&& inputData[3] == '(') {
|
||||||
localColor.green= (green | green << 4);
|
|
||||||
localColor.blue = (blue | blue << 4);
|
|
||||||
} else {
|
|
||||||
SVG_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);
|
|
||||||
} else {
|
|
||||||
SVG_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;
|
|
||||||
} else {
|
|
||||||
SVG_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;
|
|
||||||
} else {
|
|
||||||
SVG_ERROR(" pb in parsing the color : \"" << inputData << "\"");
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
SVG_ERROR(" pb in parsing the color : \"" << inputData << "\" ==> unknown methode ...");
|
|
||||||
}
|
|
||||||
} else if( 4 <= len
|
|
||||||
&& inputData[0] == 'r'
|
|
||||||
&& 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);
|
|
||||||
} else if (sscanf(inputData + 4, "%f%%,%f%%,%f%%,%f%%", &fred, &fgreen, &fblue, &falpha) == 4) {
|
|
||||||
fred = etk_max(0.0, etk_min(1.0, fred));
|
|
||||||
fgreen= etk_max(0.0, etk_min(1.0, fgreen));
|
|
||||||
fblue = etk_max(0.0, etk_min(1.0, fblue));
|
|
||||||
falpha = etk_max(0.0, etk_min(1.0, falpha));
|
|
||||||
localColor.red = (uint8_t)(fred * 255.);
|
|
||||||
localColor.green= (uint8_t)(fgreen * 255.);
|
|
||||||
localColor.blue = (uint8_t)(fblue * 255.);
|
|
||||||
localColor.alpha = (uint8_t)(falpha * 255.);
|
|
||||||
} else if (sscanf(inputData + 4, "%f%%,%f%%,%f%%", &fred, &fgreen, &fblue) == 3) {
|
|
||||||
fred = etk_max(0.0, etk_min(1.0, fred));
|
|
||||||
fgreen= etk_max(0.0, etk_min(1.0, fgreen));
|
|
||||||
fblue = etk_max(0.0, etk_min(1.0, fblue));
|
|
||||||
localColor.red = (uint8_t)(fred * 255.);
|
|
||||||
localColor.green= (uint8_t)(fgreen * 255.);
|
|
||||||
localColor.blue = (uint8_t)(fblue * 255.);
|
|
||||||
} else {
|
|
||||||
SVG_ERROR(" pb in parsing the color : \"" << inputData << "\" ==> unknown methode ...");
|
|
||||||
}
|
|
||||||
} else if( 4 < len
|
|
||||||
&& inputData[0] == 'u'
|
|
||||||
&& inputData[1] == 'r'
|
|
||||||
&& inputData[2] == 'l'
|
|
||||||
&& inputData[3] == '(') {
|
|
||||||
if (inputData[4] == '#') {
|
if (inputData[4] == '#') {
|
||||||
// TODO : parse gradient ...
|
// TODO : parse gradient ...
|
||||||
}
|
}
|
||||||
SVG_ERROR(" pb in parsing the color : \"" << inputData << "\" ==> url(XXX) is not supported now ...");
|
SVG_ERROR(" pb in parsing the color : \"" << inputData << "\" ==> url(XXX) is not supported now ...");
|
||||||
} else {
|
} else {
|
||||||
bool findIt = false;
|
localColor = etk::color::Parse(inputData);
|
||||||
// direct named color ...
|
|
||||||
for (int32_t iii=0; iii<listOfColorSize; iii++) {
|
|
||||||
if (strnCmpNoCase(listOfColor[iii].colorName, inputData, strlen(listOfColor[iii].colorName)) == true) {
|
|
||||||
findIt = true;
|
|
||||||
localColor.red = (uint8_t)((0xFF000000 & listOfColor[iii].color) >> 24) ;
|
|
||||||
localColor.green= (uint8_t)((0x00FF0000 & listOfColor[iii].color) >> 16) ;
|
|
||||||
localColor.blue = (uint8_t)((0x0000FF00 & listOfColor[iii].color) >> 8) ;
|
|
||||||
localColor.alpha = (uint8_t)(0x000000FF & listOfColor[iii].color) ;
|
|
||||||
// stop searching
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// or color in reference ...
|
|
||||||
if (findIt == false) {
|
|
||||||
// TODO : Might be a named color ... need to find it ...
|
|
||||||
SVG_ERROR(" pb in parsing the color : \"" << inputData << "\" ==> refs color not supported now ...");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
SVG_VERBOSE("Parse color : \"" << inputData << "\" ==> " << localColor);
|
SVG_VERBOSE("Parse color : \"" << inputData << "\" ==> " << localColor);
|
||||||
return localColor;
|
return localColor;
|
||||||
|
@ -63,7 +63,7 @@ namespace svg
|
|||||||
void ParsePosition(const TiXmlNode *node, coord2D_ts &pos, coord2D_ts &size);
|
void ParsePosition(const TiXmlNode *node, coord2D_ts &pos, coord2D_ts &size);
|
||||||
etkFloat_t ParseLength(const char *dataInput);
|
etkFloat_t ParseLength(const char *dataInput);
|
||||||
void ParsePaintAttr(const TiXmlNode *node);
|
void ParsePaintAttr(const TiXmlNode *node);
|
||||||
color8_ts ParseColor(const char *inputData);
|
color_ts ParseColor(const char *inputData);
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -53,8 +53,8 @@ namespace svg
|
|||||||
|
|
||||||
class PaintState {
|
class PaintState {
|
||||||
public:
|
public:
|
||||||
color8_ts fill;
|
color_ts fill;
|
||||||
color8_ts stroke;
|
color_ts stroke;
|
||||||
etkFloat_t strokeWidth;
|
etkFloat_t strokeWidth;
|
||||||
bool flagEvenOdd;
|
bool flagEvenOdd;
|
||||||
lineCap_te lineCap;
|
lineCap_te lineCap;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user