From 3e8b6d8b91d0161fa2d98e60b2b2cae70eea7e1c Mon Sep 17 00:00:00 2001 From: Edouard DUPIN Date: Thu, 12 Dec 2013 22:18:56 +0100 Subject: [PATCH] [DEV] rework the internal arch eneded (not work) --- build | 2 +- data/icon.svg | 67 + external/ege | 2 +- sources/ewol/Dimension.h | 214 --- sources/ewol/Light.cpp | 59 - sources/ewol/Light.h | 61 - sources/ewol/Material.cpp | 76 - sources/ewol/Material.h | 69 - sources/ewol/clipBoard.h | 85 - sources/ewol/commandLine.h | 47 - sources/ewol/compositing/Area.cpp | 26 +- sources/ewol/compositing/Area.h | 22 +- sources/ewol/compositing/Compose.h | 66 - .../{Compose.cpp => Compositing.cpp} | 16 +- sources/ewol/compositing/Compositing.h | 64 + sources/ewol/compositing/Drawing.cpp | 4 +- sources/ewol/compositing/Drawing.h | 22 +- sources/ewol/compositing/Image.cpp | 12 +- sources/ewol/compositing/Image.h | 11 +- sources/ewol/compositing/Shaper.cpp | 18 +- sources/ewol/compositing/Shaper.h | 48 +- sources/ewol/compositing/Sprite.cpp | 2 +- sources/ewol/compositing/Sprite.h | 4 +- sources/ewol/compositing/Text.cpp | 10 +- sources/ewol/compositing/Text.h | 19 +- .../{renderer => context}/Android/Context.cpp | 0 .../ewol/{renderer => context}/ConfigFont.cpp | 8 +- sources/ewol/context/ConfigFont.h | 87 + .../eContext.cpp => context/Context.cpp} | 0 .../eContext.h => context/Context.h} | 62 +- sources/ewol/{ => context}/Dimension.cpp | 164 +- sources/ewol/context/Dimension.h | 214 +++ sources/ewol/context/Fps.h | 141 ++ .../{renderer => context}/IOs/Context.cpp | 0 .../eInput.cpp => context/InputManager.cpp} | 66 +- sources/ewol/context/InputManager.h | 126 ++ .../{renderer => context}/MacOs/AppDelegate.h | 0 .../MacOs/AppDelegate.mm | 0 .../{renderer => context}/MacOs/Context.cpp | 0 .../{renderer => context}/MacOs/Context.h | 0 .../{renderer => context}/MacOs/Interface.h | 0 .../{renderer => context}/MacOs/Interface.mm | 0 .../{renderer => context}/MacOs/OpenglView.h | 0 .../{renderer => context}/MacOs/OpenglView.mm | 0 .../{renderer => context}/Windows/Context.cpp | 0 .../{renderer => context}/X11/Context.cpp | 0 .../{renderer => context}/audio/audio.cpp | 0 .../ewol/{renderer => context}/audio/audio.h | 0 .../{renderer => context}/audio/decWav.cpp | 0 .../ewol/{renderer => context}/audio/decWav.h | 0 .../audio/interfacePortAudio.cpp | 0 .../audio/interfacePortAudio.h | 0 sources/ewol/{ => context}/clipBoard.cpp | 42 +- sources/ewol/context/clipBoard.h | 85 + sources/ewol/{ => context}/commandLine.cpp | 10 +- sources/ewol/context/commandLine.h | 49 + sources/ewol/{ => context}/cursor.cpp | 6 +- sources/ewol/context/cursor.h | 50 + .../directFB/Context.cpp | 0 sources/ewol/cursor.h | 49 - .../EventEntry.cpp => event/Entry.cpp} | 6 +- sources/ewol/event/Entry.h | 77 + .../EventInput.cpp => event/Input.cpp} | 4 +- sources/ewol/event/Input.h | 94 ++ .../EventTime.cpp => event/Time.cpp} | 4 +- sources/ewol/event/Time.h | 67 + sources/ewol/key.cpp | 151 -- sources/ewol/key.h | 175 -- sources/ewol/key/Special.cpp | 180 ++ sources/ewol/key/Special.h | 115 ++ sources/ewol/key/key.h | 19 + sources/ewol/key/keyboard.cpp | 60 + sources/ewol/key/keyboard.h | 71 + sources/ewol/key/status.cpp | 37 + sources/ewol/key/status.h | 47 + sources/ewol/key/type.cpp | 28 + sources/ewol/key/type.h | 38 + sources/ewol/object/Config.cpp | 19 + sources/ewol/object/Config.h | 47 + .../EConfig.cpp => object/ConfigElement.cpp} | 13 +- sources/ewol/object/ConfigElement.h | 60 + .../EObjectManager.cpp => object/Manager.cpp} | 54 +- sources/ewol/object/Manager.h | 51 + .../EMessage.cpp => object/Message.cpp} | 6 +- sources/ewol/object/Message.h | 56 + .../EMultiCast.cpp => object/MultiCast.cpp} | 16 +- sources/ewol/object/MultiCast.h | 46 + .../EObject.cpp => object/Object.cpp} | 138 +- .../{renderer/EObject.h => object/Object.h} | 124 +- sources/ewol/{renderer => openGL}/openGL.cpp | 0 sources/ewol/{renderer => openGL}/openGL.h | 0 sources/ewol/physicsShape/PhysicsBox.cpp | 23 - sources/ewol/physicsShape/PhysicsBox.h | 44 - sources/ewol/physicsShape/PhysicsCapsule.cpp | 28 - sources/ewol/physicsShape/PhysicsCapsule.h | 52 - sources/ewol/physicsShape/PhysicsCone.cpp | 28 - sources/ewol/physicsShape/PhysicsCone.h | 52 - .../ewol/physicsShape/PhysicsConvexHull.cpp | 44 - sources/ewol/physicsShape/PhysicsConvexHull.h | 52 - sources/ewol/physicsShape/PhysicsCylinder.cpp | 22 - sources/ewol/physicsShape/PhysicsCylinder.h | 45 - sources/ewol/physicsShape/PhysicsShape.cpp | 57 - sources/ewol/physicsShape/PhysicsShape.h | 135 -- sources/ewol/physicsShape/PhysicsSphere.cpp | 25 - sources/ewol/physicsShape/PhysicsSphere.h | 43 - sources/ewol/renderer/ConfigFont.h | 87 - sources/ewol/renderer/EConfig.h | 64 - sources/ewol/renderer/EMessage.h | 41 - sources/ewol/renderer/EMultiCast.h | 44 - sources/ewol/renderer/EObjectManager.h | 49 - sources/ewol/renderer/EventEntry.h | 73 - sources/ewol/renderer/EventInput.h | 105 -- sources/ewol/renderer/EventTime.h | 64 - sources/ewol/renderer/Fps.h | 138 -- sources/ewol/renderer/eInput.h | 116 -- .../Colored3DObject.cpp | 0 .../{resources => resource}/Colored3DObject.h | 0 .../{resources => resource}/ConfigFile.cpp | 0 .../ewol/{resources => resource}/ConfigFile.h | 14 +- .../{resources => resource}/FontFreeType.cpp | 0 .../{resources => resource}/FontFreeType.h | 0 .../ewol/{resources => resource}/Image.cpp | 0 sources/ewol/{resources => resource}/Image.h | 8 +- .../ewol/{resources => resource}/Manager.cpp | 0 .../ewol/{resources => resource}/Manager.h | 11 +- .../ewol/{resources => resource}/Program.cpp | 0 .../ewol/{resources => resource}/Program.h | 50 +- .../ewol/{resources => resource}/Resource.cpp | 10 +- sources/ewol/resource/Resource.h | 73 + .../ewol/{resources => resource}/Shader.cpp | 0 sources/ewol/{resources => resource}/Shader.h | 23 +- .../ewol/{resources => resource}/Texture.cpp | 0 .../ewol/{resources => resource}/Texture.h | 23 +- .../{resources => resource}/TexturedFont.cpp | 0 .../{resources => resource}/TexturedFont.h | 15 +- .../VirtualBufferObject.cpp | 0 .../VirtualBufferObject.h | 10 +- .../{resources => resource}/font/FontBase.h | 10 +- sources/ewol/resource/font/GlyphProperty.h | 108 ++ sources/ewol/resource/font/Kerning.h | 71 + sources/ewol/resources/Mesh.cpp | 1038 ------------ sources/ewol/resources/Mesh.h | 169 -- sources/ewol/resources/Resource.h | 73 - sources/ewol/resources/font/GlyphProperty.h | 108 -- sources/ewol/resources/font/Kerning.h | 72 - sources/ewol/widget/Image.h | 2 +- .../widget/{WidgetManager.cpp => Manager.cpp} | 0 .../widget/{WidgetManager.h => Manager.h} | 0 sources/ewol/widget/Mesh.cpp | 133 -- sources/ewol/widget/Mesh.h | 74 - sources/ewol/widget/Widget.h | 1490 +++++++++-------- sources/lutin_ewol.py | 154 +- 152 files changed, 3643 insertions(+), 5515 deletions(-) create mode 100644 data/icon.svg delete mode 100644 sources/ewol/Dimension.h delete mode 100644 sources/ewol/Light.cpp delete mode 100644 sources/ewol/Light.h delete mode 100644 sources/ewol/Material.cpp delete mode 100644 sources/ewol/Material.h delete mode 100644 sources/ewol/clipBoard.h delete mode 100644 sources/ewol/commandLine.h delete mode 100644 sources/ewol/compositing/Compose.h rename sources/ewol/compositing/{Compose.cpp => Compositing.cpp} (54%) create mode 100644 sources/ewol/compositing/Compositing.h rename sources/ewol/{renderer => context}/Android/Context.cpp (100%) rename sources/ewol/{renderer => context}/ConfigFont.cpp (70%) create mode 100644 sources/ewol/context/ConfigFont.h rename sources/ewol/{renderer/eContext.cpp => context/Context.cpp} (100%) rename sources/ewol/{renderer/eContext.h => context/Context.h} (87%) rename sources/ewol/{ => context}/Dimension.cpp (54%) create mode 100644 sources/ewol/context/Dimension.h create mode 100644 sources/ewol/context/Fps.h rename sources/ewol/{renderer => context}/IOs/Context.cpp (100%) rename sources/ewol/{renderer/eInput.cpp => context/InputManager.cpp} (89%) create mode 100644 sources/ewol/context/InputManager.h rename sources/ewol/{renderer => context}/MacOs/AppDelegate.h (100%) rename sources/ewol/{renderer => context}/MacOs/AppDelegate.mm (100%) rename sources/ewol/{renderer => context}/MacOs/Context.cpp (100%) rename sources/ewol/{renderer => context}/MacOs/Context.h (100%) rename sources/ewol/{renderer => context}/MacOs/Interface.h (100%) rename sources/ewol/{renderer => context}/MacOs/Interface.mm (100%) rename sources/ewol/{renderer => context}/MacOs/OpenglView.h (100%) rename sources/ewol/{renderer => context}/MacOs/OpenglView.mm (100%) rename sources/ewol/{renderer => context}/Windows/Context.cpp (100%) rename sources/ewol/{renderer => context}/X11/Context.cpp (100%) rename sources/ewol/{renderer => context}/audio/audio.cpp (100%) rename sources/ewol/{renderer => context}/audio/audio.h (100%) rename sources/ewol/{renderer => context}/audio/decWav.cpp (100%) rename sources/ewol/{renderer => context}/audio/decWav.h (100%) rename sources/ewol/{renderer => context}/audio/interfacePortAudio.cpp (100%) rename sources/ewol/{renderer => context}/audio/interfacePortAudio.h (100%) rename sources/ewol/{ => context}/clipBoard.cpp (53%) create mode 100644 sources/ewol/context/clipBoard.h rename sources/ewol/{ => context}/commandLine.cpp (65%) create mode 100644 sources/ewol/context/commandLine.h rename sources/ewol/{ => context}/cursor.cpp (82%) create mode 100644 sources/ewol/context/cursor.h rename sources/ewol/{renderer => context}/directFB/Context.cpp (100%) delete mode 100644 sources/ewol/cursor.h rename sources/ewol/{renderer/EventEntry.cpp => event/Entry.cpp} (65%) create mode 100644 sources/ewol/event/Entry.h rename sources/ewol/{renderer/EventInput.cpp => event/Input.cpp} (71%) create mode 100644 sources/ewol/event/Input.h rename sources/ewol/{renderer/EventTime.cpp => event/Time.cpp} (77%) create mode 100644 sources/ewol/event/Time.h delete mode 100644 sources/ewol/key.cpp delete mode 100644 sources/ewol/key.h create mode 100644 sources/ewol/key/Special.cpp create mode 100644 sources/ewol/key/Special.h create mode 100644 sources/ewol/key/key.h create mode 100644 sources/ewol/key/keyboard.cpp create mode 100644 sources/ewol/key/keyboard.h create mode 100644 sources/ewol/key/status.cpp create mode 100644 sources/ewol/key/status.h create mode 100644 sources/ewol/key/type.cpp create mode 100644 sources/ewol/key/type.h create mode 100644 sources/ewol/object/Config.cpp create mode 100644 sources/ewol/object/Config.h rename sources/ewol/{renderer/EConfig.cpp => object/ConfigElement.cpp} (64%) create mode 100644 sources/ewol/object/ConfigElement.h rename sources/ewol/{renderer/EObjectManager.cpp => object/Manager.cpp} (69%) create mode 100644 sources/ewol/object/Manager.h rename sources/ewol/{renderer/EMessage.cpp => object/Message.cpp} (69%) create mode 100644 sources/ewol/object/Message.h rename sources/ewol/{renderer/EMultiCast.cpp => object/MultiCast.cpp} (79%) create mode 100644 sources/ewol/object/MultiCast.h rename sources/ewol/{renderer/EObject.cpp => object/Object.cpp} (63%) rename sources/ewol/{renderer/EObject.h => object/Object.h} (71%) rename sources/ewol/{renderer => openGL}/openGL.cpp (100%) rename sources/ewol/{renderer => openGL}/openGL.h (100%) delete mode 100644 sources/ewol/physicsShape/PhysicsBox.cpp delete mode 100644 sources/ewol/physicsShape/PhysicsBox.h delete mode 100644 sources/ewol/physicsShape/PhysicsCapsule.cpp delete mode 100644 sources/ewol/physicsShape/PhysicsCapsule.h delete mode 100644 sources/ewol/physicsShape/PhysicsCone.cpp delete mode 100644 sources/ewol/physicsShape/PhysicsCone.h delete mode 100644 sources/ewol/physicsShape/PhysicsConvexHull.cpp delete mode 100644 sources/ewol/physicsShape/PhysicsConvexHull.h delete mode 100644 sources/ewol/physicsShape/PhysicsCylinder.cpp delete mode 100644 sources/ewol/physicsShape/PhysicsCylinder.h delete mode 100644 sources/ewol/physicsShape/PhysicsShape.cpp delete mode 100644 sources/ewol/physicsShape/PhysicsShape.h delete mode 100644 sources/ewol/physicsShape/PhysicsSphere.cpp delete mode 100644 sources/ewol/physicsShape/PhysicsSphere.h delete mode 100644 sources/ewol/renderer/ConfigFont.h delete mode 100644 sources/ewol/renderer/EConfig.h delete mode 100644 sources/ewol/renderer/EMessage.h delete mode 100644 sources/ewol/renderer/EMultiCast.h delete mode 100644 sources/ewol/renderer/EObjectManager.h delete mode 100644 sources/ewol/renderer/EventEntry.h delete mode 100644 sources/ewol/renderer/EventInput.h delete mode 100644 sources/ewol/renderer/EventTime.h delete mode 100644 sources/ewol/renderer/Fps.h delete mode 100644 sources/ewol/renderer/eInput.h rename sources/ewol/{resources => resource}/Colored3DObject.cpp (100%) rename sources/ewol/{resources => resource}/Colored3DObject.h (100%) rename sources/ewol/{resources => resource}/ConfigFile.cpp (100%) rename sources/ewol/{resources => resource}/ConfigFile.h (84%) rename sources/ewol/{resources => resource}/FontFreeType.cpp (100%) rename sources/ewol/{resources => resource}/FontFreeType.h (100%) rename sources/ewol/{resources => resource}/Image.cpp (100%) rename sources/ewol/{resources => resource}/Image.h (83%) rename sources/ewol/{resources => resource}/Manager.cpp (100%) rename sources/ewol/{resources => resource}/Manager.h (85%) rename sources/ewol/{resources => resource}/Program.cpp (100%) rename sources/ewol/{resources => resource}/Program.h (91%) rename sources/ewol/{resources => resource}/Resource.cpp (74%) create mode 100644 sources/ewol/resource/Resource.h rename sources/ewol/{resources => resource}/Shader.cpp (100%) rename sources/ewol/{resources => resource}/Shader.h (81%) rename sources/ewol/{resources => resource}/Texture.cpp (100%) rename sources/ewol/{resources => resource}/Texture.h (78%) rename sources/ewol/{resources => resource}/TexturedFont.cpp (100%) rename sources/ewol/{resources => resource}/TexturedFont.h (91%) rename sources/ewol/{resources => resource}/VirtualBufferObject.cpp (100%) rename sources/ewol/{resources => resource}/VirtualBufferObject.h (93%) rename sources/ewol/{resources => resource}/font/FontBase.h (82%) create mode 100644 sources/ewol/resource/font/GlyphProperty.h create mode 100644 sources/ewol/resource/font/Kerning.h delete mode 100644 sources/ewol/resources/Mesh.cpp delete mode 100644 sources/ewol/resources/Mesh.h delete mode 100644 sources/ewol/resources/Resource.h delete mode 100644 sources/ewol/resources/font/GlyphProperty.h delete mode 100644 sources/ewol/resources/font/Kerning.h rename sources/ewol/widget/{WidgetManager.cpp => Manager.cpp} (100%) rename sources/ewol/widget/{WidgetManager.h => Manager.h} (100%) delete mode 100644 sources/ewol/widget/Mesh.cpp delete mode 100644 sources/ewol/widget/Mesh.h diff --git a/build b/build index 5ea83bfd..3498be99 160000 --- a/build +++ b/build @@ -1 +1 @@ -Subproject commit 5ea83bfddea9a0c93f65170b73d3be07f8a100e0 +Subproject commit 3498be99a18dd11444dbe87f1557471e65529bbc diff --git a/data/icon.svg b/data/icon.svg new file mode 100644 index 00000000..5553afd8 --- /dev/null +++ b/data/icon.svg @@ -0,0 +1,67 @@ + + + + + + + + + + + + image/svg+xml + + + + + + + + + diff --git a/external/ege b/external/ege index bc3e08d6..2c54a551 160000 --- a/external/ege +++ b/external/ege @@ -1 +1 @@ -Subproject commit bc3e08d665834900a81a7e1cd0e703793f25d208 +Subproject commit 2c54a551b4a007d79a9f7a4367e019f11bc94f7b diff --git a/sources/ewol/Dimension.h b/sources/ewol/Dimension.h deleted file mode 100644 index b9afebc1..00000000 --- a/sources/ewol/Dimension.h +++ /dev/null @@ -1,214 +0,0 @@ -/** - * @author Edouard DUPIN - * - * @copyright 2011, Edouard DUPIN, all right reserved - * - * @license BSD v3 (see license file) - */ - -#ifndef __EWOL_DIMENSION_H__ -#define __EWOL_DIMENSION_H__ - -#include -#include -#include - -namespace ewol { - /** - * @brief in the dimention class we store the data as the more usefull unit (pixel) - * but one case need to be dynamic the %, then when requested in % the register the % value - */ - class Dimension { - public: - enum distance { - Pourcent=0, - Pixel, - Meter, - Centimeter, - Millimeter, - Kilometer, - Inch, - foot, - }; - private: - vec2 m_data; - enum distance m_type; - public: - /** - * @brief Constructor (default :0,0 mode pixel) - */ - Dimension(void); - /** - * @brief Constructor - * @param[in] _size Requested dimention - * @param[in] _type Unit of the Dimention - */ - Dimension(const vec2& _size, enum ewol::Dimension::distance _type=ewol::Dimension::Pixel); - /** - * @brief Constructor - * @param[in] _config dimension configuration. - */ - Dimension(const std::string& _config) : - m_data(0,0), - m_type(ewol::Dimension::Pixel) { - set(_config); - }; - /** - * @brief Constructor - * @param[in] _config dimension configuration. - */ - Dimension(const char* _config) : - m_data(0,0), - m_type(ewol::Dimension::Pixel) { - set(_config); - }; - /** - * @brief Destructor - */ - ~Dimension(void); - - /** - * @brief string cast : - */ - operator std::string(void) const; - - /** - * @brief get the current dimention in requested type - * @param[in] _type Type of unit requested. - * @return dimention requested. - */ - vec2 get(enum distance _type) const; - /** - * @brief set the current dimention in requested type - * @param[in] _size Dimention to set - * @param[in] _type Type of unit requested. - */ - void set(const vec2& _size, enum distance _type); - - private: - /** - * @brief set the current dimention in requested type - * @param[in] _config dimension configuration. - */ - void set(std::string _config); - public: - /** - * @brief get the current dimention in pixel - * @return dimention in Pixel - */ - vec2 getPixel(void) const; - /** - * @brief get the current dimention in Pourcent - * @return dimention in Pourcent - */ - vec2 getPourcent(void) const; - /** - * @brief get the current dimention in Meter - * @return dimention in Meter - */ - vec2 getMeter(void) const; - /** - * @brief get the current dimention in Centimeter - * @return dimention in Centimeter - */ - vec2 getCentimeter(void) const; - /** - * @brief get the current dimention in Millimeter - * @return dimention in Millimeter - */ - vec2 getMillimeter(void) const; - /** - * @brief get the current dimention in Kilometer - * @return dimention in Kilometer - */ - vec2 getKilometer(void) const; - /** - * @brief get the current dimention in Inch - * @return dimention in Inch - */ - vec2 getInch(void) const; - /** - * @brief get the current dimention in Foot - * @return dimention in Foot - */ - vec2 getFoot(void) const; - /***************************************************** - * = assigment - *****************************************************/ - const Dimension& operator= (const Dimension& _obj ) { - if (this!=&_obj) { - m_data = _obj.m_data; - m_type = _obj.m_type; - } - return *this; - } - /***************************************************** - * == operator - *****************************************************/ - bool operator == (const Dimension& _obj) const { - if( m_data == _obj.m_data - && m_type == _obj.m_type) { - return true; - } - return false; - } - /***************************************************** - * != operator - *****************************************************/ - bool operator!= (const Dimension& _obj) const { - if( m_data != _obj.m_data - || m_type != _obj.m_type) { - return true; - } - return false; - } - /** - * @breif get the dimension type - * @return the type - */ - enum distance getType(void) const { - return m_type; - }; - }; - etk::CCout& operator <<(etk::CCout& _os, enum ewol::Dimension::distance _obj); - etk::CCout& operator <<(etk::CCout& _os, const ewol::Dimension& _obj); - - namespace dimension { - - /** - * @brief basic init - */ - void init(void); - /** - * @brief basic un-init - */ - void unInit(void); - /** - * @brief set the Milimeter ratio for calculation - * @param[in] Ratio Milimeter ration for the screen calculation interpolation - * @param[in] type Unit type requested. - * @note: same as @ref setPixelPerInch (internal manage convertion) - */ - void setPixelRatio(const vec2& _ratio, enum ewol::Dimension::distance _type); - /** - * @brief set the current Windows size - * @param[in] size size of the current windows in pixel. - */ - void setPixelWindowsSize(const vec2& _size); - /** - * @brief get the Windows size in the request unit - * @param[in] type Unit type requested. - * @return the requested size - */ - vec2 getWindowsSize(enum ewol::Dimension::distance _type); - /** - * @brief get the Windows diagonal size in the request unit - * @param[in] type Unit type requested. - * @return the requested size - */ - float getWindowsDiag(enum ewol::Dimension::distance _type); - }; -}; - -#endif - diff --git a/sources/ewol/Light.cpp b/sources/ewol/Light.cpp deleted file mode 100644 index b985dd01..00000000 --- a/sources/ewol/Light.cpp +++ /dev/null @@ -1,59 +0,0 @@ -/** - * @author Edouard DUPIN - * - * @copyright 2011, Edouard DUPIN, all right reserved - * - * @license BSD v3 (see license file) - */ - -#include -#include - -ewol::Light::Light(void) : - m_direction(0,0,0), - m_halfplane(0,0,0), - m_ambientColor(0,0,0,0), - m_diffuseColor(0,0,0,0), - m_specularColor(0,0,0,0), - m_GL_direction(0), - m_GL_halfplane(0), - m_GL_ambientColor(0), - m_GL_diffuseColor(0), - m_GL_specularColor(0) { - // nothing to do else ... -} - -ewol::Light::~Light(void) { - -} - -void ewol::Light::link(ewol::Program* _prog, const std::string& _baseName) { - if (NULL == _prog) { - return; - } - m_GL_direction = _prog->getUniform(_baseName+".direction"); - m_GL_halfplane = _prog->getUniform(_baseName+".halfplane"); - m_GL_ambientColor = _prog->getUniform(_baseName+".ambientColor"); - m_GL_diffuseColor = _prog->getUniform(_baseName+".diffuseColor"); - m_GL_specularColor = _prog->getUniform(_baseName+".specularColor"); -} - -void ewol::Light::draw(ewol::Program* _prog) { - _prog->uniform3(m_GL_direction, m_direction); - _prog->uniform3(m_GL_halfplane, m_halfplane); - _prog->uniform4(m_GL_ambientColor, m_ambientColor); - _prog->uniform4(m_GL_diffuseColor, m_diffuseColor); - _prog->uniform4(m_GL_specularColor, m_specularColor); -} - -etk::CCout& ewol::operator <<(etk::CCout& _os, const ewol::Light& _obj) { - _os << "light:{"; - _os << "dir=" << _obj.m_direction; - _os << " halfplan=" << _obj.m_halfplane; - _os << " color:{ anbiant=" << _obj.m_ambientColor; - _os << " diffuse=" << _obj.m_diffuseColor; - _os << " specular=" << _obj.m_specularColor; - _os << "}}"; - return _os; -} - diff --git a/sources/ewol/Light.h b/sources/ewol/Light.h deleted file mode 100644 index ed7b116b..00000000 --- a/sources/ewol/Light.h +++ /dev/null @@ -1,61 +0,0 @@ -/** - * @author Edouard DUPIN - * - * @copyright 2011, Edouard DUPIN, all right reserved - * - * @license BSD v3 (see license file) - */ - -#ifndef __EWOL_LIGHT_H__ -#define __EWOL_LIGHT_H__ - -#include -#include -#include -#include - -namespace ewol { - class Light { - private: - // values - vec3 m_direction; - vec3 m_halfplane; - vec4 m_ambientColor; - vec4 m_diffuseColor; - vec4 m_specularColor; - private: - // GL index - int32_t m_GL_direction; - int32_t m_GL_halfplane; - int32_t m_GL_ambientColor; - int32_t m_GL_diffuseColor; - int32_t m_GL_specularColor; - public: - Light(void); - ~Light(void); - void link(ewol::Program* _prog, const std::string& _baseName); - void draw(ewol::Program* _prog); - void setDirection(const vec3& val) { - m_direction = val; - } - void setHalfPlane(const vec3& val) { - m_halfplane = val; - } - void setAmbientColor(const vec4& val) { - m_ambientColor = val; - } - void setDiffuseColor(const vec4& val) { - m_diffuseColor = val; - } - void setSpecularColor(const vec4& val) { - m_specularColor = val; - } - - friend etk::CCout& operator <<(etk::CCout& _os, const ewol::Light& _obj); - }; - etk::CCout& operator <<(etk::CCout& _os, const ewol::Light& _obj); -}; - - -#endif - diff --git a/sources/ewol/Material.cpp b/sources/ewol/Material.cpp deleted file mode 100644 index 4943afb2..00000000 --- a/sources/ewol/Material.cpp +++ /dev/null @@ -1,76 +0,0 @@ -/** - * @author Edouard DUPIN - * - * @copyright 2011, Edouard DUPIN, all right reserved - * - * @license BSD v3 (see license file) - */ - -#include -#include -#include - -ewol::MaterialGlId::MaterialGlId(void) : - m_GL_ambientFactor(0), - m_GL_diffuseFactor(0), - m_GL_specularFactor(0), - m_GL_shininess(0), - m_GL_texture0(0) { - // nothing to do else ... -} - - -void ewol::MaterialGlId::link(ewol::Program* _prog, const std::string& _baseName) { - if (NULL == _prog) { - return; - } - m_GL_ambientFactor = _prog->getUniform(_baseName+".ambientFactor"); - m_GL_diffuseFactor = _prog->getUniform(_baseName+".diffuseFactor"); - m_GL_specularFactor = _prog->getUniform(_baseName+".specularFactor"); - m_GL_shininess = _prog->getUniform(_baseName+".shininess"); - m_GL_texture0 = _prog->getUniform("EW_texID"); -} - -ewol::Material::Material(void) : - m_ambientFactor(1,1,1,1), - m_diffuseFactor(0,0,0,1), - m_specularFactor(0,0,0,1), - m_shininess(1), - m_texture0(NULL) { - // nothing to do else ... -} -ewol::Material::~Material(void) { - if(NULL!=m_texture0) { - ewol::TextureFile::release(m_texture0); - } -} - -void ewol::Material::draw(ewol::Program* _prog, const MaterialGlId& _glID) { - _prog->uniform4(_glID.m_GL_ambientFactor, m_ambientFactor); - _prog->uniform4(_glID.m_GL_diffuseFactor, m_diffuseFactor); - _prog->uniform4(_glID.m_GL_specularFactor, m_specularFactor); - _prog->uniform1f(_glID.m_GL_shininess, m_shininess); - if (NULL != m_texture0) { - _prog->setTexture0(_glID.m_GL_texture0, m_texture0->getId()); - } -} - -void ewol::Material::setTexture0(const std::string& _filename) { - ivec2 tmpSize(256, 256); - // prevent overloard error : - ewol::TextureFile* tmpCopy = m_texture0; - m_texture0 = ewol::TextureFile::keep(_filename, tmpSize); - if (NULL == m_texture0 ) { - EWOL_ERROR("Can not load specific texture : " << _filename); - // retreave previous texture: - m_texture0 = tmpCopy; - return; - } - if (NULL != tmpCopy) { - // really release previous texture. In case of same texture loading, then we did not have reload it .. just increase and decrease index... - ewol::TextureFile::release(tmpCopy); - } -} - - - diff --git a/sources/ewol/Material.h b/sources/ewol/Material.h deleted file mode 100644 index 754cd94b..00000000 --- a/sources/ewol/Material.h +++ /dev/null @@ -1,69 +0,0 @@ -/** - * @author Edouard DUPIN - * - * @copyright 2011, Edouard DUPIN, all right reserved - * - * @license BSD v3 (see license file) - */ - -#ifndef __EWOL_MATERIAL_H__ -#define __EWOL_MATERIAL_H__ - -#include -#include -#include -#include -#include - -namespace ewol { - class MaterialGlId { - public: - // GL index - int32_t m_GL_ambientFactor; - int32_t m_GL_diffuseFactor; - int32_t m_GL_specularFactor; - int32_t m_GL_shininess; - int32_t m_GL_texture0; - MaterialGlId(void); - void link(ewol::Program* _prog, const std::string& _baseName); - }; - class Material { - private: - // values - vec4 m_ambientFactor; - vec4 m_diffuseFactor; - vec4 m_specularFactor; - float m_shininess; - ewol::TextureFile* m_texture0; - public: - std::vector m_listIndexFaces; - public: - Material(void); - ~Material(void); - void draw(ewol::Program* _prog, const MaterialGlId& _glID); - void setAmbientFactor(const vec4& _val) { - m_ambientFactor = _val; - } - void setDiffuseFactor(const vec4& _val) { - m_diffuseFactor = _val; - } - void setSpecularFactor(const vec4& _val) { - m_specularFactor = _val; - } - void setShininess(float _val) { - m_shininess = _val; - } - void setTexture0(const std::string& _filename); - - void setImageSize(const ivec2& _newSize) { if (m_texture0 == NULL){return;} m_texture0->setImageSize(_newSize); }; - // get the reference on this image to draw nomething on it ... - egami::Image* get(void) { if (m_texture0 == NULL){return NULL;} return &m_texture0->get(); }; - // flush the data to send it at the openGl system - void flush(void) { if (m_texture0 == NULL){return;} m_texture0->flush(); }; - }; - -}; - - -#endif - diff --git a/sources/ewol/clipBoard.h b/sources/ewol/clipBoard.h deleted file mode 100644 index 35f530c3..00000000 --- a/sources/ewol/clipBoard.h +++ /dev/null @@ -1,85 +0,0 @@ -/** - * @author Edouard DUPIN - * - * @copyright 2011, Edouard DUPIN, all right reserved - * - * @license BSD v3 (see license file) - */ - -#ifndef __EWOL_CLIPBOARD_H__ -#define __EWOL_CLIPBOARD_H__ - -#include -#include - - -namespace ewol { - namespace clipBoard - { - enum clipboardListe { - clipboard0, //!< internal clipboard 0 - clipboard1, //!< internal clipboard 1 - clipboard2, //!< internal clipboard 2 - clipboard3, //!< internal clipboard 3 - clipboard4, //!< internal clipboard 4 - clipboard5, //!< internal clipboard 5 - clipboard6, //!< internal clipboard 6 - clipboard7, //!< internal clipboard 7 - clipboard8, //!< internal clipboard 8 - clipboard9, //!< internal clipboard 9 - clipboardStd, //!< External clipboard represent the Copy/Cut/Past buffer - clipboardSelection, //!< External or internal clipboard depending on the OS, represent the middle button - clipboardCount, //!< Total number of clipboard - }; - - /** - * @brief Debug operator To display the curent element in a Human redeable information - */ - etk::CCout& operator <<(etk::CCout& _os, const enum ewol::clipBoard::clipboardListe _obj); - - /** - * @brief set the string data on a specific clipboard. The Gui system is notify that the clipboard "SELECTION" and "COPY" are change - * @param[in] _clipboardID Select the specific ID of the clipboard - * @param[in] _data The string that might be send to the clipboard - */ - void set(enum ewol::clipBoard::clipboardListe _clipboardID, const std::string& _data); - /** - * @brief Call system to request the current clipboard. - * @note Due to some system that manage the clipboard request asynchronous (like X11) and ewol managing the system with only one thread, - * we need the call the system to send us the buffer, this is really ambigous, but the widget (who has focus) receive the - * notification of the arrival of this buffer id - * @param[in] _clipboardID the needed clipboard ID - */ - void request(enum ewol::clipBoard::clipboardListe _clipboardID); - /** - * @brief set the ewol internal buffer (no notification at the GUI). This fuction might be use by the - * Gui abstraction to set the buffer we receive. The end user must not use it. - * @param[in] _clipboardID selected clipboard ID - * @param[in] _data new buffer data - */ - void setSystem(enum ewol::clipBoard::clipboardListe _clipboardID,const std::string& _data); - /** - * @brief get the ewol internal buffer of the curent clipboard. The end user can use it when he receive the event in - * the widget : @ref onEventClipboard == > we can nothe this function is the only one which permit it. - * @note if we call this fuction withoutcallin @ref ewol::clipBoard::Request, we only get the previous clipboard - * @param[in] _clipboardID selected clipboard ID - * @return the requested buffer - */ - const std::string& get(enum ewol::clipBoard::clipboardListe _clipboardID); - - // internal section - - /** - * @brief initialize the clipboard system (done by ewol) - */ - void init(void); - /** - * @brief Un-Initialize the clipboard system (done by ewol) - */ - void unInit(void); - }; -}; - -#endif - - diff --git a/sources/ewol/commandLine.h b/sources/ewol/commandLine.h deleted file mode 100644 index a0d4ea6e..00000000 --- a/sources/ewol/commandLine.h +++ /dev/null @@ -1,47 +0,0 @@ -/** - * @author Edouard DUPIN - * - * @copyright 2011, Edouard DUPIN, all right reserved - * - * @license BSD v3 (see license file) - */ - -#ifndef __EWOL_COMMAND_LINE_H__ -#define __EWOL_COMMAND_LINE_H__ - -#include -#include - -namespace ewol { - class CommandLine { - private: - std::vector m_listArgs; //!< list of all argument parsed - public: - /** - * @brief Parse the command line parameters - */ - void parse(int32_t _argc, const char* _argv[]); - /** - * @brief get the number of element in the Command line - * @return the number of element - */ - int32_t size(void); - /** - * @brief get an element with a specific ID - * @return _id The cmdLine Id element - */ - const std::string& get(int32_t _id); - /** - * @brief add one element at the Command line - * @param[in] _newElement String in the input that might be added. - */ - void add(const std::string& _newElement); - /** - * @brief remove an element - * @param[in] _id Id of the element - */ - void remove(int32_t _id); - }; -}; - -#endif diff --git a/sources/ewol/compositing/Area.cpp b/sources/ewol/compositing/Area.cpp index 7839adab..f5a2eb51 100644 --- a/sources/ewol/compositing/Area.cpp +++ b/sources/ewol/compositing/Area.cpp @@ -13,30 +13,30 @@ #define __class__ "ewol::compositing::Area" ewol::compositing::Area::Area(const ivec2& _size) : - m_position(0.0, 0.0, 0.0), - m_color(etk::color::white), - m_GLprogram(NULL), - m_GLPosition(-1), - m_GLMatrix(-1), - m_GLColor(-1), - m_GLtexture(-1), - m_GLtexID(-1), - m_resource(NULL) { - m_resource = ewol::Texture::keep(); + m_position(0.0, 0.0, 0.0), + m_color(etk::color::white), + m_GLprogram(NULL), + m_GLPosition(-1), + m_GLMatrix(-1), + m_GLColor(-1), + m_GLtexture(-1), + m_GLtexID(-1), + m_resource(NULL) { + m_resource = ewol::resource::Texture::keep(); m_resource->setImageSize(_size); m_resource->flush(); loadProgram(); } ewol::compositing::Area::~Area(void) { - ewol::Texture::release(m_resource); - ewol::Program::release(m_GLprogram); + ewol::resource::Texture::release(m_resource); + ewol::resource::Program::release(m_GLprogram); } void ewol::compositing::Area::loadProgram(void) { // get the shader resource : m_GLPosition = 0; - m_GLprogram = ewol::Program::keep("DATA:textured3D.prog"); + m_GLprogram = ewol::resource::Program::keep("DATA:textured3D.prog"); if (NULL != m_GLprogram) { m_GLPosition = m_GLprogram->getAttribute("EW_coord3d"); m_GLColor = m_GLprogram->getAttribute("EW_color"); diff --git a/sources/ewol/compositing/Area.h b/sources/ewol/compositing/Area.h index 9e698d65..5c1a7bad 100644 --- a/sources/ewol/compositing/Area.h +++ b/sources/ewol/compositing/Area.h @@ -9,25 +9,27 @@ #ifndef __EWOL_COMPOSITING_AREA_H__ #define __EWOL_COMPOSITING_AREA_H__ +#include #include -#include -#include +#include +#include +#include namespace ewol { namespace compositing { - class Area : public ewol::compositing::Compose { + class Area : public ewol::Compositing { private: vec3 m_position; //!< The current position to draw etk::Color<> m_color; //!< The text foreground color private: - ewol::Program* m_GLprogram; //!< pointer on the opengl display program - int32_t m_GLPosition; //!< openGL id on the element (vertex buffer) - int32_t m_GLMatrix; //!< openGL id on the element (transformation matrix) - int32_t m_GLColor; //!< openGL id on the element (color buffer) - int32_t m_GLtexture; //!< openGL id on the element (Texture position) - int32_t m_GLtexID; //!< openGL id on the element (texture ID) + ewol::resource::Program* m_GLprogram; //!< pointer on the opengl display program + int32_t m_GLPosition; //!< openGL id on the element (vertex buffer) + int32_t m_GLMatrix; //!< openGL id on the element (transformation matrix) + int32_t m_GLColor; //!< openGL id on the element (color buffer) + int32_t m_GLtexture; //!< openGL id on the element (Texture position) + int32_t m_GLtexID; //!< openGL id on the element (texture ID) private: - ewol::Texture* m_resource; //!< texture resources + ewol::resource::Texture* m_resource; //!< texture resources std::vector m_coord; //!< internal coord of the object std::vector m_coordTex; //!< internal texture coordinate for every point std::vector > m_coordColor; //!< internal color of the different point diff --git a/sources/ewol/compositing/Compose.h b/sources/ewol/compositing/Compose.h deleted file mode 100644 index 123b7f2d..00000000 --- a/sources/ewol/compositing/Compose.h +++ /dev/null @@ -1,66 +0,0 @@ -/** - * @author Edouard DUPIN - * - * @copyright 2011, Edouard DUPIN, all right reserved - * - * @license BSD v3 (see license file) - */ - -#ifndef __EWOL_COMPOSITING_COMPOSE_H__ -#define __EWOL_COMPOSITING_COMPOSE_H__ - -#include -#include -#include - -namespace ewol { - namespace compositing { - class Compose { - protected: - mat4 m_matrixApply; - public: - /** - * @brief generic constructor - */ - Compose(void); - /** - * @brief Generic destructor - */ - virtual ~Compose(void); - /** - * @brief Virtal pure function that request the draw of all openGl elements - */ - virtual void draw(bool _disableDepthTest=true)=0; - /** - * @brief clear alll tre registered element in the current element - */ - virtual void clear(void); - /** - * @brief reset to the eye matrix the openGL mouving system - */ - virtual void resetMatrix(void); - /** - * @brief translate the current display of this element - * @param[in] _vect The translation vector to apply at the transformation matrix - */ - virtual void translate(const vec3& _vect); - /** - * @brief rotate the curent display of this element - * @param[in] _vect The rotation vector to apply at the transformation matrix - */ - virtual void rotate(const vec3& _vect, float _angle); - /** - * @brief scale the current diaplsy of this element - * @param[in] _vect The scaling vector to apply at the transformation matrix - */ - virtual void scale(const vec3& _vect); - /** - * @brief set the transformation matrix - * @param[in] _mat The new matrix. - */ - virtual void setMatrix(const mat4& _mat); - }; - }; -}; - -#endif diff --git a/sources/ewol/compositing/Compose.cpp b/sources/ewol/compositing/Compositing.cpp similarity index 54% rename from sources/ewol/compositing/Compose.cpp rename to sources/ewol/compositing/Compositing.cpp index 0d1ee833..0ee3cebe 100644 --- a/sources/ewol/compositing/Compose.cpp +++ b/sources/ewol/compositing/Compositing.cpp @@ -13,41 +13,41 @@ #include -ewol::compositing::Compose::Compose(void) { +ewol::Compositing::Compositing(void) { // nothing to do } -ewol::compositing::Compose::~Compose(void) { +ewol::Compositing::~Compositing(void) { // nothing to do } -void ewol::compositing::Compose::resetMatrix(void) { +void ewol::Compositing::resetMatrix(void) { m_matrixApply.identity(); } -void ewol::compositing::Compose::translate(const vec3& _vect) { +void ewol::Compositing::translate(const vec3& _vect) { m_matrixApply *= etk::matTranslate(_vect); } -void ewol::compositing::Compose::rotate(const vec3& _vect, float _angle) { +void ewol::Compositing::rotate(const vec3& _vect, float _angle) { m_matrixApply *= etk::matRotate(_vect, _angle); } -void ewol::compositing::Compose::scale(const vec3& _vect) { +void ewol::Compositing::scale(const vec3& _vect) { m_matrixApply *= etk::matScale(_vect); } -void ewol::compositing::Compose::clear(void) { +void ewol::Compositing::clear(void) { m_matrixApply.identity(); } -void ewol::compositing::Compose::setMatrix(const mat4& _mat) { +void ewol::Compositing::setMatrix(const mat4& _mat) { m_matrixApply = _mat; } diff --git a/sources/ewol/compositing/Compositing.h b/sources/ewol/compositing/Compositing.h new file mode 100644 index 00000000..410b382b --- /dev/null +++ b/sources/ewol/compositing/Compositing.h @@ -0,0 +1,64 @@ +/** + * @author Edouard DUPIN + * + * @copyright 2011, Edouard DUPIN, all right reserved + * + * @license BSD v3 (see license file) + */ + +#ifndef __EWOL_COMPOSITING_H__ +#define __EWOL_COMPOSITING_H__ + +#include +#include +#include + +namespace ewol { + class Compositing { + protected: + mat4 m_matrixApply; + public: + /** + * @brief generic constructor + */ + Compositing(void); + /** + * @brief Generic destructor + */ + virtual ~Compositing(void); + /** + * @brief Virtal pure function that request the draw of all openGl elements + */ + virtual void draw(bool _disableDepthTest=true)=0; + /** + * @brief clear alll tre registered element in the current element + */ + virtual void clear(void); + /** + * @brief reset to the eye matrix the openGL mouving system + */ + virtual void resetMatrix(void); + /** + * @brief translate the current display of this element + * @param[in] _vect The translation vector to apply at the transformation matrix + */ + virtual void translate(const vec3& _vect); + /** + * @brief rotate the curent display of this element + * @param[in] _vect The rotation vector to apply at the transformation matrix + */ + virtual void rotate(const vec3& _vect, float _angle); + /** + * @brief scale the current diaplsy of this element + * @param[in] _vect The scaling vector to apply at the transformation matrix + */ + virtual void scale(const vec3& _vect); + /** + * @brief set the transformation matrix + * @param[in] _mat The new matrix. + */ + virtual void setMatrix(const mat4& _mat); + }; +}; + +#endif diff --git a/sources/ewol/compositing/Drawing.cpp b/sources/ewol/compositing/Drawing.cpp index 57227552..a7c8785a 100644 --- a/sources/ewol/compositing/Drawing.cpp +++ b/sources/ewol/compositing/Drawing.cpp @@ -277,14 +277,14 @@ void ewol::compositing::Drawing::resetCount(void) { } void ewol::compositing::Drawing::unLoadProgram(void) { - ewol::Program::release(m_GLprogram); + ewol::resource::Program::release(m_GLprogram); } void ewol::compositing::Drawing::loadProgram(void) { // remove previous loading ... in case unLoadProgram(); // oad the new ... - m_GLprogram = ewol::Program::keep("DATA:color3.prog"); + m_GLprogram = ewol::resource::Program::keep("DATA:color3.prog"); // get the shader resource : if (NULL != m_GLprogram ) { m_GLPosition = m_GLprogram->getAttribute("EW_coord3d"); diff --git a/sources/ewol/compositing/Drawing.h b/sources/ewol/compositing/Drawing.h index 3d7f4115..f24d0d03 100644 --- a/sources/ewol/compositing/Drawing.h +++ b/sources/ewol/compositing/Drawing.h @@ -12,13 +12,13 @@ #include #include -#include -#include +#include +#include namespace ewol { namespace compositing { - class Drawing : public ewol::compositing::Compose { + class Drawing : public ewol::Compositing { private: vec3 m_position; //!< The current position to draw vec3 m_clippingPosStart; //!< Clipping start position @@ -28,10 +28,10 @@ namespace ewol { etk::Color<> m_color; //!< The text foreground color etk::Color<> m_colorBg; //!< The text background color private: - ewol::Program* m_GLprogram; //!< pointer on the opengl display program - int32_t m_GLPosition; //!< openGL id on the element (vertex buffer) - int32_t m_GLMatrix; //!< openGL id on the element (transformation matrix) - int32_t m_GLColor; //!< openGL id on the element (color buffer) + ewol::resource::Program* m_GLprogram; //!< pointer on the opengl display program + int32_t m_GLPosition; //!< openGL id on the element (vertex buffer) + int32_t m_GLMatrix; //!< openGL id on the element (transformation matrix) + int32_t m_GLColor; //!< openGL id on the element (color buffer) private: // Background Color (display only when needed) std::vector m_coord; //!< internal position for the text display std::vector > m_coordColor; //!< internal color of the background @@ -53,10 +53,10 @@ namespace ewol { * @brief Un-Load the openGL program and get all the ID needed */ void unLoadProgram(void); - float m_thickness; //!< when drawing line and other things - int32_t m_triElement; //!< special counter of the single dot generated - vec3 m_triangle[3]; //!< Register every system with a combinaison of tiangle - etk::Color m_tricolor[3]; //!< Register every the associated color foreground + float m_thickness; //!< when drawing line and other things + int32_t m_triElement; //!< special counter of the single dot generated + vec3 m_triangle[3]; //!< Register every system with a combinaison of tiangle + etk::Color m_tricolor[3]; //!< Register every the associated color foreground // internal API for the generation abstraction of triangles /** * @brief Lunch the generation of triangle diff --git a/sources/ewol/compositing/Image.cpp b/sources/ewol/compositing/Image.cpp index ba194ba3..55912fc2 100644 --- a/sources/ewol/compositing/Image.cpp +++ b/sources/ewol/compositing/Image.cpp @@ -31,14 +31,14 @@ ewol::compositing::Image::Image(const std::string& _imageName) : } ewol::compositing::Image::~Image(void) { - ewol::TextureFile::release(m_resource); - ewol::Program::release(m_GLprogram); + ewol::resource::TextureFile::release(m_resource); + ewol::resource::Program::release(m_GLprogram); } void ewol::compositing::Image::loadProgram(void) { // get the shader resource : m_GLPosition = 0; - m_GLprogram = ewol::Program::keep("DATA:textured3D.prog"); + m_GLprogram = ewol::resource::Program::keep("DATA:textured3D.prog"); if (NULL!=m_GLprogram) { m_GLPosition = m_GLprogram->getAttribute("EW_coord3d"); m_GLColor = m_GLprogram->getAttribute("EW_color"); @@ -85,7 +85,7 @@ void ewol::compositing::Image::draw(bool _disableDepthTest) { void ewol::compositing::Image::clear(void) { // call upper class - ewol::compositing::Compose::clear(); + ewol::Compositing::clear(); // reset Buffer : m_coord.clear(); m_coordTex.clear(); @@ -229,12 +229,12 @@ void ewol::compositing::Image::printPart(const vec2& _size, void ewol::compositing::Image::setSource(const std::string& _newFile, const vec2& _size) { clear(); // remove old one - ewol::TextureFile::release(m_resource); + ewol::resource::TextureFile::release(m_resource); ivec2 tmpSize(_size.x(),_size.y()); // note that no image can be loaded... if (_newFile != "") { // link to new one - m_resource = ewol::TextureFile::keep(_newFile, tmpSize); + m_resource = ewol::resource::TextureFile::keep(_newFile, tmpSize); if (NULL == m_resource) { EWOL_ERROR("Can not get Image resource"); } diff --git a/sources/ewol/compositing/Image.h b/sources/ewol/compositing/Image.h index 1ef7c43a..667ef944 100644 --- a/sources/ewol/compositing/Image.h +++ b/sources/ewol/compositing/Image.h @@ -10,12 +10,13 @@ #define __EWOL_COMPOSITING_IMAGE_H__ #include -#include -#include +#include +#include +#include namespace ewol { namespace compositing { - class Image : public ewol::compositing::Compose { + class Image : public ewol::Compositing { private: vec3 m_position; //!< The current position to draw vec3 m_clippingPosStart; //!< Clipping start position @@ -25,14 +26,14 @@ namespace ewol { etk::Color<> m_color; //!< The text foreground color float m_angle; //!< Angle to set at the axes private: - ewol::Program* m_GLprogram; //!< pointer on the opengl display program + ewol::resource::Program* m_GLprogram; //!< pointer on the opengl display program int32_t m_GLPosition; //!< openGL id on the element (vertex buffer) int32_t m_GLMatrix; //!< openGL id on the element (transformation matrix) int32_t m_GLColor; //!< openGL id on the element (color buffer) int32_t m_GLtexture; //!< openGL id on the element (Texture position) int32_t m_GLtexID; //!< openGL id on the element (texture ID) private: - ewol::TextureFile* m_resource; //!< texture resources + ewol::resource::TextureFile* m_resource; //!< texture resources std::vector m_coord; //!< internal coord of the object std::vector m_coordTex; //!< internal texture coordinate for every point std::vector > m_coordColor; //!< internal color of the different point diff --git a/sources/ewol/compositing/Shaper.cpp b/sources/ewol/compositing/Shaper.cpp index b42f7f65..8806d95e 100644 --- a/sources/ewol/compositing/Shaper.cpp +++ b/sources/ewol/compositing/Shaper.cpp @@ -47,9 +47,9 @@ ewol::compositing::Shaper::~Shaper(void) { } void ewol::compositing::Shaper::unLoadProgram(void) { - ewol::Program::release(m_GLprogram); - ewol::TextureFile::release(m_resourceTexture); - ewol::ConfigFile::release(m_config); + ewol::resource::Program::release(m_GLprogram); + ewol::resource::TextureFile::release(m_resourceTexture); + ewol::resource::ConfigFile::release(m_config); } void ewol::compositing::Shaper::loadProgram(void) { @@ -57,7 +57,7 @@ void ewol::compositing::Shaper::loadProgram(void) { EWOL_DEBUG("no Shaper set for loading resources ..."); return; } - m_config = ewol::ConfigFile::keep(m_name); + m_config = ewol::resource::ConfigFile::keep(m_name); if (NULL != m_config) { m_confIdPaddingX = m_config->request("PaddingX"); m_confIdPaddingY = m_config->request("PaddingY"); @@ -73,7 +73,7 @@ void ewol::compositing::Shaper::loadProgram(void) { EWOL_DEBUG("Shaper try load shader : " << tmpFilename << " with base : " << basicShaderFile); // get the shader resource : m_GLPosition = 0; - m_GLprogram = ewol::Program::keep(tmpFilename); + m_GLprogram = ewol::resource::Program::keep(tmpFilename); if (NULL !=m_GLprogram) { m_GLPosition = m_GLprogram->getAttribute("EW_coord2d"); m_GLMatrix = m_GLprogram->getUniform("EW_MatrixTransformation"); @@ -93,7 +93,7 @@ void ewol::compositing::Shaper::loadProgram(void) { if (basicImageFile != "") { tmpFilename = file.getRelativeFolder() + basicImageFile; ivec2 size(64,64); - m_resourceTexture = ewol::TextureFile::keep(tmpFilename, size); + m_resourceTexture = ewol::resource::TextureFile::keep(tmpFilename, size); } } } @@ -148,7 +148,7 @@ bool ewol::compositing::Shaper::changeStatusIn(int32_t _newStatusId) { return false; } -bool ewol::compositing::Shaper::periodicCall(const ewol::EventTime& _event) { +bool ewol::compositing::Shaper::periodicCall(const ewol::event::Time& _event) { //EWOL_DEBUG("call=" << _event); // start : if (m_stateTransition >= 1.0) { @@ -177,8 +177,8 @@ bool ewol::compositing::Shaper::periodicCall(const ewol::EventTime& _event) { m_nextStatusRequested = -1; } } - float timeRelativity = m_config->getFloat(m_confIdChangeTime)/1000.0; - m_stateTransition += _event.getDeltaCall()/timeRelativity; + float timeRelativity = m_config->getFloat(m_confIdChangeTime) / 1000.0; + m_stateTransition += _event.getDeltaCall() / timeRelativity; //m_stateTransition += _event.getDeltaCall(); m_stateTransition = etk_avg(0.0f, m_stateTransition, 1.0f); //EWOL_DEBUG("relative=" << timeRelativity << " Transition : " << m_stateTransition); diff --git a/sources/ewol/compositing/Shaper.h b/sources/ewol/compositing/Shaper.h index 3f90eb3a..5a3b2856 100644 --- a/sources/ewol/compositing/Shaper.h +++ b/sources/ewol/compositing/Shaper.h @@ -10,9 +10,11 @@ #define __EWOL_COMPOSITING_SHAPER_H__ #include -#include -#include -#include +#include +#include +#include +#include +#include namespace ewol { namespace compositing { @@ -21,30 +23,30 @@ namespace ewol { */ // TODO : load image // TODO : Abstaraction between states (call by name and the system greate IDs - class Shaper : public ewol::compositing::Compose { + class Shaper : public ewol::Compositing { private: std::string m_name; //!< Name of the configuration of the shaper. // External theme config: - ewol::ConfigFile* m_config; //!< pointer on the config file resources - int32_t m_confIdPaddingX; //!< ConfigFile padding property X - int32_t m_confIdPaddingY; //!< ConfigFile padding property Y - int32_t m_confIdChangeTime; //!< ConfigFile padding transition time property - int32_t m_confProgramFile; //!< ConfigFile opengGl program Name - int32_t m_confImageFile; //!< ConfigFile opengGl program Name + ewol::resource::ConfigFile* m_config; //!< pointer on the config file resources + int32_t m_confIdPaddingX; //!< ConfigFile padding property X + int32_t m_confIdPaddingY; //!< ConfigFile padding property Y + int32_t m_confIdChangeTime; //!< ConfigFile padding transition time property + int32_t m_confProgramFile; //!< ConfigFile opengGl program Name + int32_t m_confImageFile; //!< ConfigFile opengGl program Name // openGL shaders programs: - ewol::Program* m_GLprogram; //!< pointer on the opengl display program - int32_t m_GLPosition; //!< openGL id on the element (vertex buffer) - int32_t m_GLMatrix; //!< openGL id on the element (transformation matrix) - int32_t m_GLPropertySize; //!< openGL id on the element (widget size) - int32_t m_GLPropertyOrigin; //!< openGL id on the element (widget origin) - int32_t m_GLPropertyInsidePos; //!< openGL id on the element (widget internal element position) - int32_t m_GLPropertyInsideSize; //!< openGL id on the element (widget internal element size) - int32_t m_GLStateOld; //!< openGL id on the element (old state displayed) - int32_t m_GLStateNew; //!< openGL id on the element (new state displayed) - int32_t m_GLStateTransition; //!< openGL id on the element (transition ofset [0.0..1.0] ) - int32_t m_GLtexID; //!< openGL id on the element (texture image) + ewol::resource::Program* m_GLprogram; //!< pointer on the opengl display program + int32_t m_GLPosition; //!< openGL id on the element (vertex buffer) + int32_t m_GLMatrix; //!< openGL id on the element (transformation matrix) + int32_t m_GLPropertySize; //!< openGL id on the element (widget size) + int32_t m_GLPropertyOrigin; //!< openGL id on the element (widget origin) + int32_t m_GLPropertyInsidePos; //!< openGL id on the element (widget internal element position) + int32_t m_GLPropertyInsideSize; //!< openGL id on the element (widget internal element size) + int32_t m_GLStateOld; //!< openGL id on the element (old state displayed) + int32_t m_GLStateNew; //!< openGL id on the element (new state displayed) + int32_t m_GLStateTransition; //!< openGL id on the element (transition ofset [0.0..1.0] ) + int32_t m_GLtexID; //!< openGL id on the element (texture image) // For the Image : - ewol::TextureFile* m_resourceTexture; //!< texture resources (for the image) + ewol::resource::TextureFile* m_resourceTexture; //!< texture resources (for the image) // internal needed data : int32_t m_nextStatusRequested; //!< when status is changing, this represent the next step of it vec2 m_propertyOrigin; //!< widget origin @@ -117,7 +119,7 @@ namespace ewol { * @return true The widget must call this fuction periodicly (and redraw itself) * @return false No need to request the periodic call. */ - bool periodicCall(const ewol::EventTime& _event); + bool periodicCall(const ewol::event::Time& _event); /** * @brief set the widget origin (needed fot the display) * @param[in] _newOri : the new widget origin diff --git a/sources/ewol/compositing/Sprite.cpp b/sources/ewol/compositing/Sprite.cpp index f882318c..b3d01f3b 100644 --- a/sources/ewol/compositing/Sprite.cpp +++ b/sources/ewol/compositing/Sprite.cpp @@ -13,7 +13,7 @@ #define __class__ "ewol::compositing::Sprite" ewol::compositing::Sprite::Sprite(const std::string& _imageName, const ivec2& _nbSprite) : - ewol::Image(_imageName), + ewol::compositing::Image(_imageName), m_nbSprite(_nbSprite), m_unitarySpriteSize(0,0) { /* diff --git a/sources/ewol/compositing/Sprite.h b/sources/ewol/compositing/Sprite.h index a32e842c..782c8084 100644 --- a/sources/ewol/compositing/Sprite.h +++ b/sources/ewol/compositing/Sprite.h @@ -11,11 +11,11 @@ #include #include -#include +#include namespace ewol { namespace compositing { - class Sprite : public ewol::compositing::Compose { + class Sprite : public ewol::compositing::Image { protected: ivec2 m_nbSprite; //!< number of sprite in vertical and horizontal vec2 m_unitarySpriteSize; //!< size of a unique sprite diff --git a/sources/ewol/compositing/Text.cpp b/sources/ewol/compositing/Text.cpp index 6cd3ea28..e59cbccc 100644 --- a/sources/ewol/compositing/Text.cpp +++ b/sources/ewol/compositing/Text.cpp @@ -8,7 +8,7 @@ #include #include -#include +#include #include #undef __class__ @@ -30,7 +30,7 @@ ewol::compositing::Text::Text(const std::string& _fontName, int32_t _fontSize) : m_previousCharcode(0), m_startTextpos(0), m_stopTextPos(0), - m_alignement(ewol::Text::alignDisable), + m_alignement(alignDisable), m_GLprogram(NULL), m_GLPosition(-1), m_GLMatrix(-1), @@ -46,14 +46,14 @@ ewol::compositing::Text::Text(const std::string& _fontName, int32_t _fontSize) : ewol::compositing::Text::~Text(void) { - ewol::TexturedFont::release(m_font); - ewol::Program::release(m_GLprogram); + ewol::resource::TexturedFont::release(m_font); + ewol::resource::Program::release(m_GLprogram); } void ewol::compositing::Text::loadProgram(void) { // get the shader resource : m_GLPosition = 0; - m_GLprogram = ewol::Program::keep("DATA:text.prog"); + m_GLprogram = ewol::resource::Program::keep("DATA:text.prog"); if (m_GLprogram != NULL) { m_GLPosition = m_GLprogram->getAttribute("EW_coord2d"); m_GLColor = m_GLprogram->getAttribute("EW_color"); diff --git a/sources/ewol/compositing/Text.h b/sources/ewol/compositing/Text.h index f24585f7..c989cb77 100644 --- a/sources/ewol/compositing/Text.h +++ b/sources/ewol/compositing/Text.h @@ -12,9 +12,9 @@ #include #include -#include +#include #include -#include +#include #include #include @@ -22,6 +22,7 @@ namespace ewol { namespace compositing { /** * @brief This class represent the specific display for every char in the string ... + * @not-in-doc */ class TextDecoration { public: @@ -35,7 +36,7 @@ namespace ewol { } }; - class Text : public ewol::compositing::Compose { + class Text : public ewol::Compositing { public: enum aligneMode { alignDisable, @@ -45,9 +46,9 @@ namespace ewol { alignJustify }; private: - ewol::Drawing m_vectorialDraw; //!< This is used to draw background selection and other things ... + ewol::compositing::Drawing m_vectorialDraw; //!< This is used to draw background selection and other things ... public: - ewol::Drawing& getDrawing(void) { + ewol::compositing::Drawing& getDrawing(void) { return m_vectorialDraw; }; private: @@ -74,7 +75,7 @@ namespace ewol { float m_stopTextPos; //!< end of the alignement (when a string is too hight it cut at the word previously this virtual line and the center is perform with this one) enum aligneMode m_alignement; //!< Current Alignement mode (justify/left/right ...) private: - ewol::Program* m_GLprogram; //!< pointer on the opengl display program + ewol::resource::Program* m_GLprogram; //!< pointer on the opengl display program int32_t m_GLPosition; //!< openGL id on the element (vertex buffer) int32_t m_GLMatrix; //!< openGL id on the element (transformation matrix) int32_t m_GLColor; //!< openGL id on the element (color buffer) @@ -84,7 +85,7 @@ namespace ewol { int32_t m_selectionStartPos; //!< start position of the Selection (if == m_cursorPos ==> no selection) int32_t m_cursorPos; //!< Cursor position (default no cursor == > -100) private: - ewol::TexturedFont* m_font; //!< Font resources + ewol::resource::TexturedFont* m_font; //!< Font resources private: // Text std::vector m_coord; //!< internal coord of the object std::vector m_coordTex; //!< internal texture coordinate for every point @@ -325,7 +326,7 @@ namespace ewol { * @param[in] _alignement mode of alignement for the Text. * @note The text align in center change of line every display done (even if it was just a char) */ - void setTextAlignement(float _startTextpos, float _stopTextPos, enum ewol::Text::aligneMode _alignement=ewol::Text::alignDisable); + void setTextAlignement(float _startTextpos, float _stopTextPos, enum ewol::compositing::Text::aligneMode _alignement=ewol::compositing::Text::alignDisable); /** * @brief disable the alignement system */ @@ -334,7 +335,7 @@ namespace ewol { * @brief get the current alignement property * @return the curent alignement type */ - enum ewol::Text::aligneMode getAlignement(void); + enum ewol::compositing::Text::aligneMode getAlignement(void); /** * @brief calculate a theoric text size * @param[in] _text The string to calculate dimention. diff --git a/sources/ewol/renderer/Android/Context.cpp b/sources/ewol/context/Android/Context.cpp similarity index 100% rename from sources/ewol/renderer/Android/Context.cpp rename to sources/ewol/context/Android/Context.cpp diff --git a/sources/ewol/renderer/ConfigFont.cpp b/sources/ewol/context/ConfigFont.cpp similarity index 70% rename from sources/ewol/renderer/ConfigFont.cpp rename to sources/ewol/context/ConfigFont.cpp index 024fb8aa..9e603c59 100644 --- a/sources/ewol/renderer/ConfigFont.cpp +++ b/sources/ewol/context/ConfigFont.cpp @@ -10,9 +10,9 @@ #include #undef __class__ -#define __class__ "ConfigFont" +#define __class__ "context::ConfigFont" -ewol::ConfigFont::ConfigFont(void) : +ewol::context::ConfigFont::ConfigFont(void) : m_folder("DATA:fonts"), m_name("Arial;Helvetica"), m_size(10), @@ -20,12 +20,12 @@ ewol::ConfigFont::ConfigFont(void) : ewol::freeTypeInit(); } -ewol::ConfigFont::~ConfigFont(void) { +ewol::context::ConfigFont::~ConfigFont(void) { // UnInit FreeTypes ewol::freeTypeUnInit(); } -void ewol::ConfigFont::set(const std::string& _fontName, int32_t _size) { +void ewol::context::ConfigFont::set(const std::string& _fontName, int32_t _size) { m_name = _fontName; m_size = _size; EWOL_INFO("Set default Font : '" << _fontName << "' size=" << _size); diff --git a/sources/ewol/context/ConfigFont.h b/sources/ewol/context/ConfigFont.h new file mode 100644 index 00000000..d17c1f09 --- /dev/null +++ b/sources/ewol/context/ConfigFont.h @@ -0,0 +1,87 @@ +/** + * @author Edouard DUPIN + * + * @copyright 2011, Edouard DUPIN, all right reserved + * + * @license BSD v3 (see license file) + */ + +#ifndef __EWOL_CONFIG_FONT_H__ +#define __EWOL_CONFIG_FONT_H__ + +#include +#include + +namespace ewol { + namespace context { + class ConfigFont { + public: + /** + * Constructor / destructor + */ + ConfigFont(void); + ~ConfigFont(void); + private: + std::string m_folder; + public: + /** + * @brief Specify the default font folder for the Ewol search system (only needed when embended font) + * @param[in] _folder basic folder of the font (ex: DATA:fonts) + */ + void setFolder(const std::string& _folder) { + m_folder = _folder; + }; + /** + * @brief get the default font folder. + * @return The default font folder. + */ + const std::string& getFolder(void) { + return m_folder; + }; + private: + std::string m_name; + int32_t m_size; + public: + /** + * @brief set the defaut font for all the widgets and basics display. + * @param[in] _fontName The font name requested (not case sensitive) ex "Arial" or multiple separate by ';' ex : "Arial;Helvetica". + * @param[in] _size The default size of the font default=10. + */ + void set(const std::string& _fontName, int32_t _size); + /** + * @brief get the current default font name + * @raturn a reference on the font name string + */ + const std::string& getName(void) { + return m_name; + }; + /** + * @brief get the default font size. + * @return the font size. + */ + int32_t getSize(void) { + return m_size; + }; + private: + bool m_useExternal; + public: + /** + * @brief set use of internal/external Font + * @param[in] _val true to enable search of internal data. + */ + void setUseExternal(bool _val) { + m_useExternal=_val; + }; + /** + * @brief get the use of internal/external Font + * @return true to enable search of internal data. + */ + bool getUseExternal(void) { + return m_useExternal; + }; + }; + }; +}; + +#endif + diff --git a/sources/ewol/renderer/eContext.cpp b/sources/ewol/context/Context.cpp similarity index 100% rename from sources/ewol/renderer/eContext.cpp rename to sources/ewol/context/Context.cpp diff --git a/sources/ewol/renderer/eContext.h b/sources/ewol/context/Context.h similarity index 87% rename from sources/ewol/renderer/eContext.h rename to sources/ewol/context/Context.h index fe635c8b..9d012232 100644 --- a/sources/ewol/renderer/eContext.h +++ b/sources/ewol/context/Context.h @@ -11,60 +11,62 @@ #include #include -#include #include -#include +#include +#include +#include +#include #include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include namespace ewol { - class eSystemMessage; + /** + * @not-in-doc + */ enum orientation{ screenAuto = 0, screenLandscape, screenPortrait }; - class eContext { + class Context { private: - ewol::CommandLine m_commandLine; //!< Start command line information + ewol::context::CommandLine m_commandLine; //!< Start command line information public: - ewol::CommandLine& getCmd(void) { + ewol::context::CommandLine& getCmd(void) { return m_commandLine; }; private: - ewol::ConfigFont m_configFont; //!< global font configuration + ewol::context::ConfigFont m_configFont; //!< global font configuration public: - ewol::ConfigFont& getFontDefault(void) { + ewol::context::ConfigFont& getFontDefault(void) { return m_configFont; }; private: - ewol::WidgetManager m_widgetManager; //!< global widget manager + ewol::widget::Manager m_widgetManager; //!< global widget manager public: - ewol::WidgetManager& getWidgetManager(void) { + ewol::widget::Manager& getWidgetManager(void) { return m_widgetManager; }; private: - ewol::EObjectManager m_EObjectManager; //!< eObject Manager main instance + ewol::object::Manager m_EObjectManager; //!< eObject Manager main instance public: - ewol::EObjectManager& getEObjectManager(void) { + ewol::object::Manager& getEObjectManager(void) { return m_EObjectManager; }; private: - ewol::ResourceManager m_resourceManager; //!< global resources Manager + ewol::resource::Manager m_resourceManager; //!< global resources Manager public: - ewol::ResourceManager& getResourcesManager(void) { + ewol::resource::Manager& getResourcesManager(void) { return m_resourceManager; }; public: - eContext(int32_t _argc=0, const char* _argv[]=NULL); - virtual ~eContext(void); + Context(int32_t _argc=0, const char* _argv[]=NULL); + virtual ~Context(void); protected: /** * @brief set the curent interface. @@ -78,13 +80,13 @@ namespace ewol { void unLockContext(void); private: int64_t m_previousDisplayTime; // this is to limit framerate ... in case... - ewol::eInput m_input; + ewol::InputManager m_input; etk::MessageFifo m_msgSystem; bool m_displayFps; - ewol::Fps m_FpsSystemEvent; - ewol::Fps m_FpsSystemContext; - ewol::Fps m_FpsSystem; - ewol::Fps m_FpsFlush; + ewol::context::Fps m_FpsSystemEvent; + ewol::context::Fps m_FpsSystemContext; + ewol::context::Fps m_FpsSystem; + ewol::context::Fps m_FpsFlush; /** * @brief Processing all the event arrived ... (commoly called in draw function) */ @@ -303,13 +305,13 @@ namespace ewol { * @brief From everyware in the program, we can get the context inteface. * @return current reference on the instance. */ - eContext& getContext(void); + Context& getContext(void); }; //!< must be define in CPP by the application ... this are the main init and unInit of the Application // return false if an error occured bool APP_Init(ewol::eContext& _context); -void APP_UnInit(ewol::eContext& _context); +void APP_UnInit(ewol::Context& _context); #endif diff --git a/sources/ewol/Dimension.cpp b/sources/ewol/context/Dimension.cpp similarity index 54% rename from sources/ewol/Dimension.cpp rename to sources/ewol/context/Dimension.cpp index 2a67cc92..8237a534 100644 --- a/sources/ewol/Dimension.cpp +++ b/sources/ewol/context/Dimension.cpp @@ -17,7 +17,7 @@ static bool isInit = false; static vec2 ratio(9999999,888888); static vec2 invRatio(1,1); -static ewol::Dimension windowsSize(vec2(9999999,888888), ewol::Dimension::Pixel); +static ewol::context::Dimension windowsSize(vec2(9999999,888888), ewol::Dimension::Pixel); static const float inchToMillimeter = 1.0f/25.4f; static const float footToMillimeter = 1.0f/304.8f; @@ -31,87 +31,87 @@ static const float millimeterToCentimeter = 10.0f; static const float millimeterToKilometer = 1000000.0f; -void ewol::dimension::init(void) { +void ewol::context::Dimension::init(void) { if (true == isInit) { return; } - ewol::Dimension conversion(vec2(72,72), ewol::Dimension::Inch); + ewol::context::Dimension conversion(vec2(72,72), ewol::context::Dimension::Inch); ratio = conversion.getMillimeter(); invRatio.setValue(1.0f/ratio.x(),1.0f/ratio.y()); - windowsSize.set(vec2(200,200), ewol::Dimension::Pixel); + windowsSize.set(vec2(200,200), ewol::context::Dimension::Pixel); isInit = true; } -void ewol::dimension::unInit(void) { +void ewol::context::Dimension::unInit(void) { isInit = false; ratio.setValue(9999999,888888); invRatio.setValue(1.0f/ratio.x(),1.0f/ratio.y()); - windowsSize.set(vec2(9999999,88888), ewol::Dimension::Pixel); + windowsSize.set(vec2(9999999,88888), ewol::context::Dimension::Pixel); } -void ewol::dimension::setPixelRatio(const vec2& _ratio, enum ewol::Dimension::distance _type) { - ewol::dimension::init(); +void ewol::context::Dimension::setPixelRatio(const vec2& _ratio, enum ewol::context::Dimension::distance _type) { + ewol::context::Dimension::init(); EWOL_INFO("Set a new screen ratio for the screen : ratio=" << _ratio << " type=" << _type); - ewol::Dimension conversion(_ratio, _type); + ewol::context::Dimension conversion(_ratio, _type); EWOL_INFO(" == > " << conversion); ratio = conversion.getMillimeter(); invRatio.setValue(1.0f/ratio.x(),1.0f/ratio.y()); EWOL_INFO("Set a new screen ratio for the screen : ratioMm=" << ratio); } -void ewol::dimension::setPixelWindowsSize(const vec2& _size) { +void ewol::context::Dimension::setPixelWindowsSize(const vec2& _size) { windowsSize = _size; EWOL_VERBOSE("Set a new Windows property size " << windowsSize << "px"); } -vec2 ewol::dimension::getWindowsSize(enum ewol::Dimension::distance _type) { +vec2 ewol::context::Dimension::getWindowsSize(enum ewol::context::Dimension::distance _type) { return windowsSize.get(_type); } -float ewol::dimension::getWindowsDiag(enum ewol::Dimension::distance _type) { - vec2 size = ewol::dimension::getWindowsSize(_type); +float ewol::context::Dimension::getWindowsDiag(enum ewol::context::Dimension::distance _type) { + vec2 size = ewol::context::Dimension::getWindowsSize(_type); return size.length(); } -ewol::Dimension::Dimension(void) : +ewol::context::Dimension::Dimension(void) : m_data(0,0), - m_type(ewol::Dimension::Pixel) { + m_type(ewol::context::Dimension::Pixel) { // notinh to do ... } -ewol::Dimension::Dimension(const vec2& _size, enum ewol::Dimension::distance _type) : +ewol::context::Dimension::Dimension(const vec2& _size, enum ewol::context::Dimension::distance _type) : m_data(0,0), - m_type(ewol::Dimension::Pixel) { + m_type(ewol::context::Dimension::Pixel) { set(_size, _type); } -void ewol::Dimension::set(std::string _config) { +void ewol::context::Dimension::set(std::string _config) { m_data.setValue(0,0); - m_type = ewol::Dimension::Pixel; - enum distance type = ewol::Dimension::Pixel; + m_type = ewol::context::Dimension::Pixel; + enum distance type = ewol::context::Dimension::Pixel; if (end_with(_config, "%", false) == true) { - type = ewol::Dimension::Pourcent; + type = ewol::context::Dimension::Pourcent; _config.erase(_config.size()-1, 1); } else if (end_with(_config, "px",false) == true) { - type = ewol::Dimension::Pixel; + type = ewol::context::Dimension::Pixel; _config.erase(_config.size()-2, 2); } else if (end_with(_config, "ft",false) == true) { - type = ewol::Dimension::foot; + type = ewol::context::Dimension::foot; _config.erase(_config.size()-2, 2); } else if (end_with(_config, "in",false) == true) { - type = ewol::Dimension::Inch; + type = ewol::context::Dimension::Inch; _config.erase(_config.size()-2, 2); } else if (end_with(_config, "km",false) == true) { - type = ewol::Dimension::Kilometer; + type = ewol::context::Dimension::Kilometer; _config.erase(_config.size()-2, 2); } else if (end_with(_config, "mm",false) == true) { - type = ewol::Dimension::Millimeter; + type = ewol::context::Dimension::Millimeter; _config.erase(_config.size()-2, 2); } else if (end_with(_config, "cm",false) == true) { - type = ewol::Dimension::Centimeter; + type = ewol::context::Dimension::Centimeter; _config.erase(_config.size()-2, 2); } else if (end_with(_config, "m",false) == true) { - type = ewol::Dimension::Meter; + type = ewol::context::Dimension::Meter; _config.erase(_config.size()-1, 1); } else { EWOL_CRITICAL("Can not parse dimention : \"" << _config << "\""); @@ -122,104 +122,104 @@ void ewol::Dimension::set(std::string _config) { EWOL_VERBOSE(" config dimention : \"" << _config << "\" == > " << *this ); } -ewol::Dimension::~Dimension(void) { +ewol::context::Dimension::~Dimension(void) { // nothing to do ... } -ewol::Dimension::operator std::string(void) const { +ewol::context::Dimension::operator std::string(void) const { std::string str; str = get(getType()); switch(getType()) { - case ewol::Dimension::Pourcent: + case ewol::context::Dimension::Pourcent: str += "%"; break; - case ewol::Dimension::Pixel: + case ewol::context::Dimension::Pixel: str += "px"; break; - case ewol::Dimension::Meter: + case ewol::context::Dimension::Meter: str += "m"; break; - case ewol::Dimension::Centimeter: + case ewol::context::Dimension::Centimeter: str += "cm"; break; - case ewol::Dimension::Millimeter: + case ewol::context::Dimension::Millimeter: str += "mm"; break; - case ewol::Dimension::Kilometer: + case ewol::context::Dimension::Kilometer: str += "km"; break; - case ewol::Dimension::Inch: + case ewol::context::Dimension::Inch: str += "in"; break; - case ewol::Dimension::foot: + case ewol::context::Dimension::foot: str += "ft"; break; } return str; } -vec2 ewol::Dimension::get(enum ewol::Dimension::distance _type) const { +vec2 ewol::context::Dimension::get(enum ewol::context::Dimension::distance _type) const { switch(_type) { - case ewol::Dimension::Pourcent: + case ewol::context::Dimension::Pourcent: return getPourcent(); - case ewol::Dimension::Pixel: + case ewol::context::Dimension::Pixel: return getPixel(); - case ewol::Dimension::Meter: + case ewol::context::Dimension::Meter: return getMeter(); - case ewol::Dimension::Centimeter: + case ewol::context::Dimension::Centimeter: return getCentimeter(); - case ewol::Dimension::Millimeter: + case ewol::context::Dimension::Millimeter: return getMillimeter(); - case ewol::Dimension::Kilometer: + case ewol::context::Dimension::Kilometer: return getKilometer(); - case ewol::Dimension::Inch: + case ewol::context::Dimension::Inch: return getInch(); - case ewol::Dimension::foot: + case ewol::context::Dimension::foot: return getFoot(); } return vec2(0,0); } -void ewol::Dimension::set(const vec2& _size, enum ewol::Dimension::distance _type) { +void ewol::context::Dimension::set(const vec2& _size, enum ewol::context::Dimension::distance _type) { // set min max on input to limit error : vec2 size(etk_avg(0.0f,_size.x(),9999999.0f), etk_avg(0.0f,_size.y(),9999999.0f)); switch(_type) { - case ewol::Dimension::Pourcent: { + case ewol::context::Dimension::Pourcent: { vec2 size2(etk_avg(0.0f,_size.x(),100.0f), etk_avg(0.0f,_size.y(),100.0f)); m_data = vec2(size2.x()*0.01f, size2.y()*0.01f); //EWOL_VERBOSE("Set % : " << size2 << " == > " << m_data); break; } - case ewol::Dimension::Pixel: + case ewol::context::Dimension::Pixel: m_data = size; break; - case ewol::Dimension::Meter: + case ewol::context::Dimension::Meter: m_data = vec2(size.x()*meterToMillimeter*ratio.x(), size.y()*meterToMillimeter*ratio.y()); break; - case ewol::Dimension::Centimeter: + case ewol::context::Dimension::Centimeter: m_data = vec2(size.x()*centimeterToMillimeter*ratio.x(), size.y()*centimeterToMillimeter*ratio.y()); break; - case ewol::Dimension::Millimeter: + case ewol::context::Dimension::Millimeter: m_data = vec2(size.x()*ratio.x(), size.y()*ratio.y()); break; - case ewol::Dimension::Kilometer: + case ewol::context::Dimension::Kilometer: m_data = vec2(size.x()*kilometerToMillimeter*ratio.x(), size.y()*kilometerToMillimeter*ratio.y()); break; - case ewol::Dimension::Inch: + case ewol::context::Dimension::Inch: m_data = vec2(size.x()*inchToMillimeter*ratio.x(), size.y()*inchToMillimeter*ratio.y()); break; - case ewol::Dimension::foot: + case ewol::context::Dimension::foot: m_data = vec2(size.x()*footToMillimeter*ratio.x(), size.y()*footToMillimeter*ratio.y()); break; } m_type = _type; } -vec2 ewol::Dimension::getPixel(void) const { - if (m_type!=ewol::Dimension::Pourcent) { +vec2 ewol::context::Dimension::getPixel(void) const { + if (m_type!=ewol::context::Dimension::Pourcent) { return m_data; } else { vec2 windDim = windowsSize.getPixel(); @@ -229,8 +229,8 @@ vec2 ewol::Dimension::getPixel(void) const { } } -vec2 ewol::Dimension::getPourcent(void) const { - if (m_type!=ewol::Dimension::Pourcent) { +vec2 ewol::context::Dimension::getPourcent(void) const { + if (m_type!=ewol::context::Dimension::Pourcent) { vec2 windDim = windowsSize.getPixel(); //EWOL_DEBUG(" windows dimention : " /*<< windowsSize*/ << " == > " << windDim << "px"); // ==> infinite loop ... //printf(" windows dimention : %f,%f", windDim.x(),windDim.y()); @@ -240,61 +240,61 @@ vec2 ewol::Dimension::getPourcent(void) const { return vec2(m_data.x()*100.0f, m_data.y()*100.0f);; } -vec2 ewol::Dimension::getMeter(void) const { - return ewol::Dimension::getMillimeter()*millimeterToMeter; +vec2 ewol::context::Dimension::getMeter(void) const { + return ewol::context::Dimension::getMillimeter()*millimeterToMeter; } -vec2 ewol::Dimension::getCentimeter(void) const { - return ewol::Dimension::getMillimeter()*millimeterToCentimeter; +vec2 ewol::context::Dimension::getCentimeter(void) const { + return ewol::context::Dimension::getMillimeter()*millimeterToCentimeter; } -vec2 ewol::Dimension::getMillimeter(void) const { - return ewol::Dimension::getPixel()*invRatio; +vec2 ewol::context::Dimension::getMillimeter(void) const { + return ewol::context::Dimension::getPixel()*invRatio; } -vec2 ewol::Dimension::getKilometer(void) const { - return ewol::Dimension::getMillimeter()*millimeterToKilometer; +vec2 ewol::context::Dimension::getKilometer(void) const { + return ewol::context::Dimension::getMillimeter()*millimeterToKilometer; } -vec2 ewol::Dimension::getInch(void) const { - return ewol::Dimension::getMillimeter()*millimeterToInch; +vec2 ewol::context::Dimension::getInch(void) const { + return ewol::context::Dimension::getMillimeter()*millimeterToInch; } -vec2 ewol::Dimension::getFoot(void) const { - return ewol::Dimension::getMillimeter()*millimeterToFoot; +vec2 ewol::context::Dimension::getFoot(void) const { + return ewol::context::Dimension::getMillimeter()*millimeterToFoot; } -etk::CCout& ewol::operator <<(etk::CCout& _os, enum ewol::Dimension::distance _obj) { +etk::CCout& ewol::operator <<(etk::CCout& _os, enum ewol::context::Dimension::distance _obj) { switch(_obj) { - case ewol::Dimension::Pourcent: + case ewol::context::Dimension::Pourcent: _os << "%"; break; - case ewol::Dimension::Pixel: + case ewol::context::Dimension::Pixel: _os << "px"; break; - case ewol::Dimension::Meter: + case ewol::context::Dimension::Meter: _os << "m"; break; - case ewol::Dimension::Centimeter: + case ewol::context::Dimension::Centimeter: _os << "cm"; break; - case ewol::Dimension::Millimeter: + case ewol::context::Dimension::Millimeter: _os << "mm"; break; - case ewol::Dimension::Kilometer: + case ewol::context::Dimension::Kilometer: _os << "km"; break; - case ewol::Dimension::Inch: + case ewol::context::Dimension::Inch: _os << "in"; break; - case ewol::Dimension::foot: + case ewol::context::Dimension::foot: _os << "ft"; break; } return _os; } -etk::CCout& ewol::operator <<(etk::CCout& _os, const ewol::Dimension& _obj) { +etk::CCout& ewol::operator <<(etk::CCout& _os, const ewol::context::Dimension& _obj) { _os << _obj.get(_obj.getType()) << _obj.getType(); return _os; } diff --git a/sources/ewol/context/Dimension.h b/sources/ewol/context/Dimension.h new file mode 100644 index 00000000..0b6c9308 --- /dev/null +++ b/sources/ewol/context/Dimension.h @@ -0,0 +1,214 @@ +/** + * @author Edouard DUPIN + * + * @copyright 2011, Edouard DUPIN, all right reserved + * + * @license BSD v3 (see license file) + */ + +#ifndef __EWOL_DIMENSION_H__ +#define __EWOL_DIMENSION_H__ + +#include +#include +#include + +namespace ewol { + namespace context { + /** + * @brief in the dimention class we store the data as the more usefull unit (pixel) + * but one case need to be dynamic the %, then when requested in % the register the % value + */ + class Dimension { + public: + enum distance { + Pourcent=0, + Pixel, + Meter, + Centimeter, + Millimeter, + Kilometer, + Inch, + foot, + }; + private: + vec2 m_data; + enum distance m_type; + public: + /** + * @brief Constructor (default :0,0 mode pixel) + */ + Dimension(void); + /** + * @brief Constructor + * @param[in] _size Requested dimention + * @param[in] _type Unit of the Dimention + */ + Dimension(const vec2& _size, enum ewol::context::Dimension::distance _type=ewol::context::Dimension::Pixel); + /** + * @brief Constructor + * @param[in] _config dimension configuration. + */ + Dimension(const std::string& _config) : + m_data(0,0), + m_type(ewol::context::Dimension::Pixel) { + set(_config); + }; + /** + * @brief Constructor + * @param[in] _config dimension configuration. + */ + Dimension(const char* _config) : + m_data(0,0), + m_type(ewol::context::Dimension::Pixel) { + set(_config); + }; + /** + * @brief Destructor + */ + ~Dimension(void); + + /** + * @brief string cast : + */ + operator std::string(void) const; + + /** + * @brief get the current dimention in requested type + * @param[in] _type Type of unit requested. + * @return dimention requested. + */ + vec2 get(enum distance _type) const; + /** + * @brief set the current dimention in requested type + * @param[in] _size Dimention to set + * @param[in] _type Type of unit requested. + */ + void set(const vec2& _size, enum distance _type); + + private: + /** + * @brief set the current dimention in requested type + * @param[in] _config dimension configuration. + */ + void set(std::string _config); + public: + /** + * @brief get the current dimention in pixel + * @return dimention in Pixel + */ + vec2 getPixel(void) const; + /** + * @brief get the current dimention in Pourcent + * @return dimention in Pourcent + */ + vec2 getPourcent(void) const; + /** + * @brief get the current dimention in Meter + * @return dimention in Meter + */ + vec2 getMeter(void) const; + /** + * @brief get the current dimention in Centimeter + * @return dimention in Centimeter + */ + vec2 getCentimeter(void) const; + /** + * @brief get the current dimention in Millimeter + * @return dimention in Millimeter + */ + vec2 getMillimeter(void) const; + /** + * @brief get the current dimention in Kilometer + * @return dimention in Kilometer + */ + vec2 getKilometer(void) const; + /** + * @brief get the current dimention in Inch + * @return dimention in Inch + */ + vec2 getInch(void) const; + /** + * @brief get the current dimention in Foot + * @return dimention in Foot + */ + vec2 getFoot(void) const; + /***************************************************** + * = assigment + *****************************************************/ + const Dimension& operator= (const Dimension& _obj ) { + if (this!=&_obj) { + m_data = _obj.m_data; + m_type = _obj.m_type; + } + return *this; + } + /***************************************************** + * == operator + *****************************************************/ + bool operator == (const Dimension& _obj) const { + if( m_data == _obj.m_data + && m_type == _obj.m_type) { + return true; + } + return false; + } + /***************************************************** + * != operator + *****************************************************/ + bool operator!= (const Dimension& _obj) const { + if( m_data != _obj.m_data + || m_type != _obj.m_type) { + return true; + } + return false; + } + /** + * @breif get the dimension type + * @return the type + */ + enum distance getType(void) const { + return m_type; + }; + public : // Global static access : + /** + * @brief basic init + */ + static void init(void); + /** + * @brief basic un-init + */ + static void unInit(void); + /** + * @brief set the Milimeter ratio for calculation + * @param[in] Ratio Milimeter ration for the screen calculation interpolation + * @param[in] type Unit type requested. + * @note: same as @ref setPixelPerInch (internal manage convertion) + */ + static void setPixelRatio(const vec2& _ratio, enum ewol::context::Dimension::distance _type); + /** + * @brief set the current Windows size + * @param[in] size size of the current windows in pixel. + */ + static void setPixelWindowsSize(const vec2& _size); + /** + * @brief get the Windows size in the request unit + * @param[in] type Unit type requested. + * @return the requested size + */ + static vec2 getWindowsSize(enum ewol::context::Dimension::distance _type); + /** + * @brief get the Windows diagonal size in the request unit + * @param[in] type Unit type requested. + * @return the requested size + */ + static float getWindowsDiag(enum ewol::context::Dimension::distance _type); + + }; + }; + etk::CCout& operator <<(etk::CCout& _os, enum ewol::context::Dimension::distance _obj); + etk::CCout& operator <<(etk::CCout& _os, const ewol::context::Dimension& _obj); +}; + +#endif + diff --git a/sources/ewol/context/Fps.h b/sources/ewol/context/Fps.h new file mode 100644 index 00000000..c0cfecce --- /dev/null +++ b/sources/ewol/context/Fps.h @@ -0,0 +1,141 @@ +/** + * @author Edouard DUPIN + * + * @copyright 2011, Edouard DUPIN, all right reserved + * + * @license BSD v3 (see license file) + */ + +#ifndef __EWOL_FPS_H__ +#define __EWOL_FPS_H__ + +namespace ewol { + namespace context { + /** + * @brief This class is designed to count the number of frame per second in the main renderer system + * @not-in-doc + */ + class Fps { + // display every second ... + #define DISPLAY_PERIODE_US (1000000) + private: + int64_t startTime; + int64_t nbCallTime; + int64_t nbDisplayTime; + int64_t min; + int64_t avg; + int64_t max; + int64_t min_idle; + int64_t avg_idle; + int64_t max_idle; + int64_t ticTime; + bool display; + bool drwingDone; + const char * m_displayName; + bool m_displayFPS; + public: + /** + * @brief Constructor + */ + Fps(const char * displayName, bool displayFPS) { + startTime = -1; + nbCallTime = 0; + nbDisplayTime = 0; + min = 99999999999999LL; + avg = 0; + max = 0; + min_idle = 99999999999999LL; + avg_idle = 0; + max_idle = 0; + ticTime = 0; + display = false; + drwingDone = false; + m_displayName = displayName; + m_displayFPS = displayFPS; + } + /** + * @brief Destructor + */ + ~Fps(void) { + + } + /** + * @brief this might be call every time a diplay start + */ + void tic(void) { + int64_t currentTime = ewol::getTime(); + ticTime = currentTime; + nbCallTime++; + if (startTime<0) { + startTime = currentTime; + } + //EWOL_DEBUG("current : " << currentTime << "time diff : " << (currentTime - startTime)); + if ( (currentTime - startTime) > DISPLAY_PERIODE_US) { + display = true; + } + } + /** + * @brief this might be call every time a diplay stop, it do the display every second + * @param[in] displayTime display curent time of the frame. + */ + void toc(bool displayTime = false) { + int64_t currentTime = ewol::getTime(); + int64_t processTimeLocal = (currentTime - ticTime); + if (displayTime == true) { + EWOL_DEBUG(m_displayName << " : processTime : " << (float)((float)processTimeLocal / 1000.0) << "ms "); + } + if (drwingDone) { + min = etk_min(min, processTimeLocal); + max = etk_max(max, processTimeLocal); + avg += processTimeLocal; + drwingDone = false; + } else { + min_idle = etk_min(min_idle, processTimeLocal); + max_idle = etk_max(max_idle, processTimeLocal); + avg_idle += processTimeLocal; + } + } + /** + * @brief this might be call when a display is really done + */ + void incrementCounter(void) { + nbDisplayTime++; + drwingDone = true; + } + /** + * @brief draw debug display ... + */ + void draw(void) { + if (true == display) { + if (nbDisplayTime>0) { + EWOL_DEBUG(m_displayName << " : Active : " + << (float)((float)min / 1000.0) << "ms " + << (float)((float)avg / (float)nbDisplayTime / 1000.0) << "ms " + << (float)((float)max / 1000.0) << "ms "); + } + if (nbCallTime-nbDisplayTime>0) { + EWOL_DEBUG(m_displayName << " : idle : " + << (float)((float)min_idle / 1000.0) << "ms " + << (float)((float)avg_idle / (float)(nbCallTime-nbDisplayTime) / 1000.0) << "ms " + << (float)((float)max_idle / 1000.0) << "ms "); + } + if (true == m_displayFPS) { + EWOL_DEBUG("FPS : " << nbDisplayTime << "/" << nbCallTime << "fps"); + } + max = 0; + min = 99999999999999LL; + avg = 0; + max_idle = 0; + min_idle = 99999999999999LL; + avg_idle = 0; + nbCallTime = 0; + nbDisplayTime = 0; + startTime = -1; + display = false; + } + } + }; + }; +}; +#endif + diff --git a/sources/ewol/renderer/IOs/Context.cpp b/sources/ewol/context/IOs/Context.cpp similarity index 100% rename from sources/ewol/renderer/IOs/Context.cpp rename to sources/ewol/context/IOs/Context.cpp diff --git a/sources/ewol/renderer/eInput.cpp b/sources/ewol/context/InputManager.cpp similarity index 89% rename from sources/ewol/renderer/eInput.cpp rename to sources/ewol/context/InputManager.cpp index bcd35309..0b82e142 100644 --- a/sources/ewol/renderer/eInput.cpp +++ b/sources/ewol/context/InputManager.cpp @@ -16,7 +16,7 @@ #include #include #include -#include +#include #include #include @@ -28,24 +28,24 @@ #define EVENT_DEBUG EWOL_VERBOSE //#define EVENT_DEBUG EWOL_DEBUG -void ewol::eInput::calculateLimit(void) { +void ewol::context::InputManager::calculateLimit(void) { m_eventInputLimit.sepatateTime = 300000; // µs m_eventInputLimit.DpiOffset = m_dpi*100; m_eventMouseLimit.sepatateTime = 300000; // µs m_eventMouseLimit.DpiOffset = (float)m_dpi*(float)0.1; } -void ewol::eInput::setDpi(int32_t newDPI) { +void ewol::context::InputManager::setDpi(int32_t newDPI) { m_dpi = newDPI; // recalculate the DPI system ... calculateLimit(); } -bool ewol::eInput::localEventInput(enum ewol::keyEvent::type _type, - ewol::Widget* _destWidget, - int32_t _IdInput, - enum ewol::keyEvent::status _status, - vec2 _pos) { +bool ewol::context::InputManager::localEventInput(enum ewol::keyEvent::type _type, + ewol::Widget* _destWidget, + int32_t _IdInput, + enum ewol::keyEvent::status _status, + vec2 _pos) { if (NULL != _destWidget) { if (_type == ewol::keyEvent::typeMouse || _type == ewol::keyEvent::typeFinger) { // create the system Event : @@ -59,9 +59,9 @@ bool ewol::eInput::localEventInput(enum ewol::keyEvent::type _type, return false; } -void ewol::eInput::abortElement(InputPoperty_ts *_eventTable, - int32_t _idInput, - enum ewol::keyEvent::type _type) { +void ewol::context::InputManager::abortElement(InputPoperty *_eventTable, + int32_t _idInput, + enum ewol::keyEvent::type _type) { if (NULL == _eventTable) { return; } @@ -74,8 +74,8 @@ void ewol::eInput::abortElement(InputPoperty_ts *_eventTable, } } -void ewol::eInput::cleanElement(InputPoperty_ts *_eventTable, - int32_t _idInput) { +void ewol::context::InputManager::cleanElement(InputPoperty *_eventTable, + int32_t _idInput) { if (NULL == _eventTable) { return; } @@ -93,7 +93,7 @@ void ewol::eInput::cleanElement(InputPoperty_ts *_eventTable, _eventTable[_idInput].posEvent.setValue(0,0); } -void ewol::eInput::transfertEvent(ewol::Widget* _source, ewol::Widget* _destination) { +void ewol::context::InputManager::transfertEvent(ewol::Widget* _source, ewol::Widget* _destination) { if( NULL == _source || NULL == _destination) { // prevent errors ... @@ -123,7 +123,7 @@ void ewol::eInput::transfertEvent(ewol::Widget* _source, ewol::Widget* _destinat } } -void ewol::eInput::grabPointer(ewol::Widget* _widget) { +void ewol::context::InputManager::grabPointer(ewol::Widget* _widget) { if(NULL == _widget) { return; } @@ -133,12 +133,12 @@ void ewol::eInput::grabPointer(ewol::Widget* _widget) { _widget->getSize().y()/2.0f) ); } -void ewol::eInput::unGrabPointer(void) { +void ewol::context::InputManager::unGrabPointer(void) { m_grabWidget = NULL; m_context.grabPointerEvents(false, vec2(0,0)); } -void ewol::eInput::onObjectRemove(ewol::EObject * removeObject) { +void ewol::context::InputManager::onObjectRemove(ewol::EObject * removeObject) { for(int32_t iii=0; iii the it was finger event ... -void ewol::eInput::motion(enum ewol::keyEvent::type _type, - int _pointerID, - vec2 _pos) { +void ewol::context::InputManager::motion(enum ewol::keyEvent::type _type, + int _pointerID, + vec2 _pos) { EVENT_DEBUG("motion event : " << _type << " " << _pointerID << " " << _pos); if (MAX_MANAGE_INPUT <= _pointerID) { // reject pointer == > out of IDs... return; } - InputPoperty_ts *eventTable = NULL; + InputPoperty *eventTable = NULL; if (_type == ewol::keyEvent::typeMouse) { eventTable = m_eventMouseSaved; } else if (_type == ewol::keyEvent::typeFinger) { @@ -328,10 +328,10 @@ void ewol::eInput::motion(enum ewol::keyEvent::type _type, } } -void ewol::eInput::state(enum ewol::keyEvent::type _type, - int _pointerID, - bool _isDown, - vec2 _pos) +void ewol::context::InputManager::state(enum ewol::keyEvent::type _type, + int _pointerID, + bool _isDown, + vec2 _pos) { if (MAX_MANAGE_INPUT <= _pointerID) { // reject pointer == > out of IDs... @@ -339,8 +339,8 @@ void ewol::eInput::state(enum ewol::keyEvent::type _type, } EVENT_DEBUG("event pointerId=" << _pointerID); // convert position in open-GL coordonates ... - InputPoperty_ts *eventTable = NULL; - inputLimit_ts localLimit; + InputPoperty *eventTable = NULL; + InputLimit localLimit; if (_type == ewol::keyEvent::typeMouse) { eventTable = m_eventMouseSaved; localLimit = m_eventMouseLimit; diff --git a/sources/ewol/context/InputManager.h b/sources/ewol/context/InputManager.h new file mode 100644 index 00000000..27e3e312 --- /dev/null +++ b/sources/ewol/context/InputManager.h @@ -0,0 +1,126 @@ +/** + * @author Edouard DUPIN + * + * @copyright 2011, Edouard DUPIN, all right reserved + * + * @license BSD v3 (see license file) + */ + +#ifndef __EWOL_SYSTEM_INPUT_H__ +#define __EWOL_SYSTEM_INPUT_H__ + +#include + +#define MAX_MANAGE_INPUT (15) + +namespace ewol { + namespace context { + /** + * @brief internal structure + * @not-in-doc + */ + class InputPoperty { + public: + bool isUsed; + int32_t destinationInputId; + int64_t lastTimeEvent; + ewol::Widget* curentWidgetEvent; + vec2 origin; + vec2 size; + vec2 downStart; + vec2 posEvent; + bool isDown; + bool isInside; + int32_t nbClickEvent; // 0 .. 1 .. 2 .. 3 + }; + + /** + * @brief internal structure + * @not-in-doc + */ + class InputLimit { + int32_t sepatateTime; + int32_t DpiOffset; + }; + class Context; + class InputManager { + // special grab pointer mode : + private: + ewol::Widget* m_grabWidget; //!< widget that grab the curent pointer. + private: + int32_t m_dpi; + InputLimit m_eventInputLimit; + InputLimit m_eventMouseLimit; + void calculateLimit(void); + InputPoperty m_eventInputSaved[MAX_MANAGE_INPUT]; + InputPoperty m_eventMouseSaved[MAX_MANAGE_INPUT]; + void abortElement(InputPoperty* _eventTable, int32_t _idInput, enum ewol::key::type _type); + void cleanElement(InputPoperty* _eventTable, int32_t _idInput); + /** + * @brief generate the event on the destinated widget. + * @param[in] _type Type of the event that might be sended. + * @param[in] _destWidget Pointer on the requested widget that element might be sended + * @param[in] _IdInput Id of the event (PC : [0..9] and touch : [1..9]) + * @param[in] _typeEvent type of the eventg generated + * @param[in] _pos position of the event + * @return true if event has been greped + */ + bool localEventInput(enum ewol::keyEvent::type _type, + ewol::Widget* _destWidget, + int32_t _IdInput, + enum ewol::keyEvent::status _typeEvent, + vec2 _pos); + /** + * @brief convert the system event id in the correct EWOL id depending of the system management mode + * This function find the next input id unused on the specifiic widget + * == > on PC, the ID does not change (GUI is not the same) + * @param[in] _type Type of the kay event. + * @param[in] _destWidget Pointer of the widget destination + * @param[in] _realInputId system Id + * @return the ewol input id + */ + int32_t localGetDestinationId(enum ewol::keyEvent::type _type, + ewol::Widget* _destWidget, + int32_t _realInputId); + private: + ewol::eContext& m_context; + public: + InputManager(ewol::eContext& _context); + ~InputManager(void); + void setDpi(int32_t newDPI); + + // note if id<0 == > the it was finger event ... + void motion(enum ewol::keyEvent::type _type, int _pointerID, vec2 _pos ); + void state(enum ewol::keyEvent::type _type, int _pointerID, bool _isDown, vec2 _pos); + + /** + * @brief Inform object that an other object is removed ... + * @param[in] removeObject Pointer on the EObject remeved == > the user must remove all reference on this EObject + * @note : Sub classes must call this class + */ + void onObjectRemove(ewol::EObject* _removeObject); + /** + * @brief a new layer on the windows is set == > might remove all the property of the current element ... + */ + void newLayerSet(void); + /** + * @brief This is to transfert the event from one widget to another one + * @param _source the widget where the event came from + * @param _destination the widget where the event mitgh be generated now + */ + void transfertEvent(ewol::Widget* _source, ewol::Widget* _destination); + /** + * @brief This fonction lock the pointer properties to move in relative instead of absolute + * @param[in] _widget The widget that lock the pointer events + */ + void grabPointer(ewol::Widget* _widget); + /** + * @brief This fonction un-lock the pointer properties to move in relative instead of absolute + */ + void unGrabPointer(void); + }; + }; +}; +#endif + + diff --git a/sources/ewol/renderer/MacOs/AppDelegate.h b/sources/ewol/context/MacOs/AppDelegate.h similarity index 100% rename from sources/ewol/renderer/MacOs/AppDelegate.h rename to sources/ewol/context/MacOs/AppDelegate.h diff --git a/sources/ewol/renderer/MacOs/AppDelegate.mm b/sources/ewol/context/MacOs/AppDelegate.mm similarity index 100% rename from sources/ewol/renderer/MacOs/AppDelegate.mm rename to sources/ewol/context/MacOs/AppDelegate.mm diff --git a/sources/ewol/renderer/MacOs/Context.cpp b/sources/ewol/context/MacOs/Context.cpp similarity index 100% rename from sources/ewol/renderer/MacOs/Context.cpp rename to sources/ewol/context/MacOs/Context.cpp diff --git a/sources/ewol/renderer/MacOs/Context.h b/sources/ewol/context/MacOs/Context.h similarity index 100% rename from sources/ewol/renderer/MacOs/Context.h rename to sources/ewol/context/MacOs/Context.h diff --git a/sources/ewol/renderer/MacOs/Interface.h b/sources/ewol/context/MacOs/Interface.h similarity index 100% rename from sources/ewol/renderer/MacOs/Interface.h rename to sources/ewol/context/MacOs/Interface.h diff --git a/sources/ewol/renderer/MacOs/Interface.mm b/sources/ewol/context/MacOs/Interface.mm similarity index 100% rename from sources/ewol/renderer/MacOs/Interface.mm rename to sources/ewol/context/MacOs/Interface.mm diff --git a/sources/ewol/renderer/MacOs/OpenglView.h b/sources/ewol/context/MacOs/OpenglView.h similarity index 100% rename from sources/ewol/renderer/MacOs/OpenglView.h rename to sources/ewol/context/MacOs/OpenglView.h diff --git a/sources/ewol/renderer/MacOs/OpenglView.mm b/sources/ewol/context/MacOs/OpenglView.mm similarity index 100% rename from sources/ewol/renderer/MacOs/OpenglView.mm rename to sources/ewol/context/MacOs/OpenglView.mm diff --git a/sources/ewol/renderer/Windows/Context.cpp b/sources/ewol/context/Windows/Context.cpp similarity index 100% rename from sources/ewol/renderer/Windows/Context.cpp rename to sources/ewol/context/Windows/Context.cpp diff --git a/sources/ewol/renderer/X11/Context.cpp b/sources/ewol/context/X11/Context.cpp similarity index 100% rename from sources/ewol/renderer/X11/Context.cpp rename to sources/ewol/context/X11/Context.cpp diff --git a/sources/ewol/renderer/audio/audio.cpp b/sources/ewol/context/audio/audio.cpp similarity index 100% rename from sources/ewol/renderer/audio/audio.cpp rename to sources/ewol/context/audio/audio.cpp diff --git a/sources/ewol/renderer/audio/audio.h b/sources/ewol/context/audio/audio.h similarity index 100% rename from sources/ewol/renderer/audio/audio.h rename to sources/ewol/context/audio/audio.h diff --git a/sources/ewol/renderer/audio/decWav.cpp b/sources/ewol/context/audio/decWav.cpp similarity index 100% rename from sources/ewol/renderer/audio/decWav.cpp rename to sources/ewol/context/audio/decWav.cpp diff --git a/sources/ewol/renderer/audio/decWav.h b/sources/ewol/context/audio/decWav.h similarity index 100% rename from sources/ewol/renderer/audio/decWav.h rename to sources/ewol/context/audio/decWav.h diff --git a/sources/ewol/renderer/audio/interfacePortAudio.cpp b/sources/ewol/context/audio/interfacePortAudio.cpp similarity index 100% rename from sources/ewol/renderer/audio/interfacePortAudio.cpp rename to sources/ewol/context/audio/interfacePortAudio.cpp diff --git a/sources/ewol/renderer/audio/interfacePortAudio.h b/sources/ewol/context/audio/interfacePortAudio.h similarity index 100% rename from sources/ewol/renderer/audio/interfacePortAudio.h rename to sources/ewol/context/audio/interfacePortAudio.h diff --git a/sources/ewol/clipBoard.cpp b/sources/ewol/context/clipBoard.cpp similarity index 53% rename from sources/ewol/clipBoard.cpp rename to sources/ewol/context/clipBoard.cpp index 0791a26f..534db4da 100644 --- a/sources/ewol/clipBoard.cpp +++ b/sources/ewol/context/clipBoard.cpp @@ -23,9 +23,9 @@ note: la copy dans le : 10 : bouton du milieux */ //!< Local copy of the clipboards -static std::string mesCopy[ewol::clipBoard::clipboardCount]; +static std::string mesCopy[ewol::clipBoard::context::clipboardCount]; -static const char* clipboardDescriptionString[ewol::clipBoard::clipboardCount+1] = { +static const char* clipboardDescriptionString[ewol::clipBoard::context::clipboardCount+1] = { "clipboard0", "clipboard1", "clipboard2", @@ -41,8 +41,8 @@ static const char* clipboardDescriptionString[ewol::clipBoard::clipboardCount+1] "clipboardCount" }; -etk::CCout& ewol::clipBoard::operator <<(etk::CCout& _os, const enum ewol::clipBoard::clipboardListe _obj) { - if (_obj >= 0 && _obj = 0 && _obj = ewol::clipBoard::clipboardCount) { + if(_clipboardID >= ewol::context::clipBoard::clipboardCount) { EWOL_WARNING("request ClickBoard id error"); return; } - ewol::clipBoard::setSystem(_clipboardID, _data); + ewol::context::clipBoard::setSystem(_clipboardID, _data); - if( ewol::clipBoard::clipboardStd == _clipboardID - || ewol::clipBoard::clipboardSelection == _clipboardID) { + if( ewol::context::clipBoard::clipboardStd == _clipboardID + || ewol::context::clipBoard::clipboardSelection == _clipboardID) { ewol::getContext().clipBoardSet(_clipboardID); EWOL_TODO("Set ClipBoard"); } } -void ewol::clipBoard::request(enum ewol::clipBoard::clipboardListe _clipboardID) { - if(_clipboardID >= ewol::clipBoard::clipboardCount) { +void ewol::context::clipBoard::request(enum ewol::context::clipBoard::clipboardListe _clipboardID) { + if(_clipboardID >= ewol::context::clipBoard::clipboardCount) { EWOL_WARNING("request ClickBoard id error"); return; } - if( ewol::clipBoard::clipboardStd == _clipboardID - || ewol::clipBoard::clipboardSelection == _clipboardID) { + if( ewol::context::clipBoard::clipboardStd == _clipboardID + || ewol::context::clipBoard::clipboardSelection == _clipboardID) { ewol::getContext().clipBoardGet(_clipboardID); EWOL_TODO("Get ClipBoard"); } else { @@ -107,8 +107,8 @@ void ewol::clipBoard::request(enum ewol::clipBoard::clipboardListe _clipboardID) } -void ewol::clipBoard::setSystem(enum ewol::clipBoard::clipboardListe _clipboardID, const std::string& _data) { - if(_clipboardID >= ewol::clipBoard::clipboardCount) { +void ewol::context::clipBoard::setSystem(enum ewol::context::clipBoard::clipboardListe _clipboardID, const std::string& _data) { + if(_clipboardID >= ewol::context::clipBoard::clipboardCount) { EWOL_WARNING("request ClickBoard id error"); return; } @@ -117,9 +117,9 @@ void ewol::clipBoard::setSystem(enum ewol::clipBoard::clipboardListe _clipboardI } -const std::string& ewol::clipBoard::get(enum ewol::clipBoard::clipboardListe _clipboardID) { +const std::string& ewol::context::clipBoard::get(enum ewol::context::clipBoard::clipboardListe _clipboardID) { static const std::string emptyString(""); - if(_clipboardID >= ewol::clipBoard::clipboardCount) { + if(_clipboardID >= ewol::context::clipBoard::clipboardCount) { EWOL_WARNING("request ClickBoard id error"); return emptyString; } diff --git a/sources/ewol/context/clipBoard.h b/sources/ewol/context/clipBoard.h new file mode 100644 index 00000000..bc19943a --- /dev/null +++ b/sources/ewol/context/clipBoard.h @@ -0,0 +1,85 @@ +/** + * @author Edouard DUPIN + * + * @copyright 2011, Edouard DUPIN, all right reserved + * + * @license BSD v3 (see license file) + */ + +#ifndef __EWOL_CLIPBOARD_H__ +#define __EWOL_CLIPBOARD_H__ + +#include +#include + +// TODO : Remove this ... ==> set it in the context .... +namespace ewol { + namespace context { + namespace clipBoard { + enum clipboardListe { + clipboard0, //!< internal clipboard 0 + clipboard1, //!< internal clipboard 1 + clipboard2, //!< internal clipboard 2 + clipboard3, //!< internal clipboard 3 + clipboard4, //!< internal clipboard 4 + clipboard5, //!< internal clipboard 5 + clipboard6, //!< internal clipboard 6 + clipboard7, //!< internal clipboard 7 + clipboard8, //!< internal clipboard 8 + clipboard9, //!< internal clipboard 9 + clipboardStd, //!< External clipboard represent the Copy/Cut/Past buffer + clipboardSelection, //!< External or internal clipboard depending on the OS, represent the middle button + clipboardCount, //!< Total number of clipboard + }; + + /** + * @brief set the string data on a specific clipboard. The Gui system is notify that the clipboard "SELECTION" and "COPY" are change + * @param[in] _clipboardID Select the specific ID of the clipboard + * @param[in] _data The string that might be send to the clipboard + */ + void set(enum ewol::context::clipBoard::clipboardListe _clipboardID, const std::string& _data); + /** + * @brief Call system to request the current clipboard. + * @note Due to some system that manage the clipboard request asynchronous (like X11) and ewol managing the system with only one thread, + * we need the call the system to send us the buffer, this is really ambigous, but the widget (who has focus) receive the + * notification of the arrival of this buffer id + * @param[in] _clipboardID the needed clipboard ID + */ + void request(enum ewol::context::clipBoard::clipboardListe _clipboardID); + /** + * @brief set the ewol internal buffer (no notification at the GUI). This fuction might be use by the + * Gui abstraction to set the buffer we receive. The end user must not use it. + * @param[in] _clipboardID selected clipboard ID + * @param[in] _data new buffer data + */ + void setSystem(enum ewol::context::clipBoard::clipboardListe _clipboardID,const std::string& _data); + /** + * @brief get the ewol internal buffer of the curent clipboard. The end user can use it when he receive the event in + * the widget : @ref onEventClipboard == > we can nothe this function is the only one which permit it. + * @note if we call this fuction withoutcallin @ref ewol::clipBoard::Request, we only get the previous clipboard + * @param[in] _clipboardID selected clipboard ID + * @return the requested buffer + */ + const std::string& get(enum ewol::context::clipBoard::clipboardListe _clipboardID); + + // internal section + + /** + * @brief initialize the clipboard system (done by ewol) + */ + void init(void); + /** + * @brief Un-Initialize the clipboard system (done by ewol) + */ + void unInit(void); + }; + }; + /** + * @brief Debug operator To display the curent element in a Human redeable information + */ + etk::CCout& operator <<(etk::CCout& _os, const enum ewol::context::clipBoard::clipboardListe _obj); +}; + +#endif + + diff --git a/sources/ewol/commandLine.cpp b/sources/ewol/context/commandLine.cpp similarity index 65% rename from sources/ewol/commandLine.cpp rename to sources/ewol/context/commandLine.cpp index d4522734..7ce3801e 100644 --- a/sources/ewol/commandLine.cpp +++ b/sources/ewol/context/commandLine.cpp @@ -10,18 +10,18 @@ #include #include -void ewol::CommandLine::parse(int32_t _argc, const char* _argv[]) { +void ewol::context::CommandLine::parse(int32_t _argc, const char* _argv[]) { for (int32_t i=1 ; i<_argc; i++) { EWOL_INFO("commandLine : \"" << _argv[i] << "\"" ); m_listArgs.push_back(_argv[i]); } } -int32_t ewol::CommandLine::size(void) { +int32_t ewol::context::CommandLine::size(void) { return m_listArgs.size(); } -const std::string& ewol::CommandLine::get(int32_t _id) { +const std::string& ewol::context::CommandLine::get(int32_t _id) { static const std::string errorArg(""); if ( _id < 0 && _id >= (int64_t)m_listArgs.size()) { @@ -30,11 +30,11 @@ const std::string& ewol::CommandLine::get(int32_t _id) { return m_listArgs[_id]; } -void ewol::CommandLine::add(const std::string& _newElement) { +void ewol::context::CommandLine::add(const std::string& _newElement) { m_listArgs.push_back(_newElement); } -void ewol::CommandLine::remove(int32_t _id) { +void ewol::context::CommandLine::remove(int32_t _id) { m_listArgs.erase(m_listArgs.begin()+_id); } diff --git a/sources/ewol/context/commandLine.h b/sources/ewol/context/commandLine.h new file mode 100644 index 00000000..8740d019 --- /dev/null +++ b/sources/ewol/context/commandLine.h @@ -0,0 +1,49 @@ +/** + * @author Edouard DUPIN + * + * @copyright 2011, Edouard DUPIN, all right reserved + * + * @license BSD v3 (see license file) + */ + +#ifndef __EWOL_COMMAND_LINE_H__ +#define __EWOL_COMMAND_LINE_H__ + +#include +#include + +namespace ewol { + namespace context { + class CommandLine { + private: + std::vector m_listArgs; //!< list of all argument parsed + public: + /** + * @brief Parse the command line parameters + */ + void parse(int32_t _argc, const char* _argv[]); + /** + * @brief get the number of element in the Command line + * @return the number of element + */ + int32_t size(void); + /** + * @brief get an element with a specific ID + * @return _id The cmdLine Id element + */ + const std::string& get(int32_t _id); + /** + * @brief add one element at the Command line + * @param[in] _newElement String in the input that might be added. + */ + void add(const std::string& _newElement); + /** + * @brief remove an element + * @param[in] _id Id of the element + */ + void remove(int32_t _id); + }; + }; +}; + +#endif diff --git a/sources/ewol/cursor.cpp b/sources/ewol/context/cursor.cpp similarity index 82% rename from sources/ewol/cursor.cpp rename to sources/ewol/context/cursor.cpp index d7c069c5..30f70c9d 100644 --- a/sources/ewol/cursor.cpp +++ b/sources/ewol/context/cursor.cpp @@ -8,7 +8,7 @@ #include -static const char* cursorDescriptionString[ewol::cursorCount+1] = { +static const char* cursorDescriptionString[ewol::context::cursorCount+1] = { "cursorArrow", "cursorLeftArrow", "cursorInfo", @@ -33,8 +33,8 @@ static const char* cursorDescriptionString[ewol::cursorCount+1] = { "cursorCount" }; -etk::CCout& ewol::operator <<(etk::CCout& _os, const enum ewol::cursorDisplay _obj) { - if (_obj >= 0 && _obj = 0 && _obj +#include +namespace ewol { + namespace context { + enum cursorDisplay { + cursorArrow, // this is the normal arrow ... + cursorLeftArrow, + cursorInfo, + cursorDestroy, + cursorHelp, + cursorCycle, + cursorSpray, + cursorWait, + cursorText, + cursorCrossHair, + cursorSlideUpDown, //!< change the position (slide) vertical + cursorSlideLeftRight, //!< change the position (slide) horizontal + cursorResizeUp, + cursorResizeDown, + cursorResizeLeft, + cursorResizeRight, + cursorCornerTopLeft, + cursorCornerTopRight, + cursorCornerButtomLeft, + cursorCornerButtomRight, + cursorNone, + // just for the count: + cursorCount + }; + }; + /** + * @brief Debug operator To display the curent element in a Human readable information + */ + etk::CCout& operator <<(etk::CCout& _os, const enum ewol::context::cursorDisplay _obj); +}; + +#endif + + diff --git a/sources/ewol/renderer/directFB/Context.cpp b/sources/ewol/context/directFB/Context.cpp similarity index 100% rename from sources/ewol/renderer/directFB/Context.cpp rename to sources/ewol/context/directFB/Context.cpp diff --git a/sources/ewol/cursor.h b/sources/ewol/cursor.h deleted file mode 100644 index 7284033a..00000000 --- a/sources/ewol/cursor.h +++ /dev/null @@ -1,49 +0,0 @@ -/** - * @author Edouard DUPIN - * - * @copyright 2011, Edouard DUPIN, all right reserved - * - * @license BSD v3 (see license file) - */ - -#ifndef __EWOL_CURSOR_H__ -#define __EWOL_CURSOR_H__ - -#include -#include -namespace ewol -{ - enum cursorDisplay { - cursorArrow, // this is the normal arrow ... - cursorLeftArrow, - cursorInfo, - cursorDestroy, - cursorHelp, - cursorCycle, - cursorSpray, - cursorWait, - cursorText, - cursorCrossHair, - cursorSlideUpDown, //!< change the position (slide) vertical - cursorSlideLeftRight, //!< change the position (slide) horizontal - cursorResizeUp, - cursorResizeDown, - cursorResizeLeft, - cursorResizeRight, - cursorCornerTopLeft, - cursorCornerTopRight, - cursorCornerButtomLeft, - cursorCornerButtomRight, - cursorNone, - // just for the count: - cursorCount - }; - /** - * @brief Debug operator To display the curent element in a Human readable information - */ - etk::CCout& operator <<(etk::CCout& _os, const enum ewol::cursorDisplay _obj); -}; - -#endif - - diff --git a/sources/ewol/renderer/EventEntry.cpp b/sources/ewol/event/Entry.cpp similarity index 65% rename from sources/ewol/renderer/EventEntry.cpp rename to sources/ewol/event/Entry.cpp index 44e68b46..86e2f13f 100644 --- a/sources/ewol/renderer/EventEntry.cpp +++ b/sources/ewol/event/Entry.cpp @@ -11,17 +11,17 @@ #undef __class__ #define __class__ "EventEntry" -etk::CCout& ewol::operator <<(etk::CCout& _os, const ewol::EventEntry& _obj) { +etk::CCout& ewol::operator <<(etk::CCout& _os, const ewol::event::Entry& _obj) { _os << "{type=" << _obj.getType(); _os << " status=" << _obj.getStatus(); - if (_obj.getType() == ewol::keyEvent::keyboardChar) { + if (_obj.getType() == ewol::key::keyboardChar) { _os << " char=" << _obj.getChar(); } _os << "}"; return _os; } -etk::CCout& operator <<(etk::CCout& _os, const ewol::EventEntrySystem& _obj) { +etk::CCout& operator <<(etk::CCout& _os, const ewol::event::EntrySystem& _obj) { _os << _obj.m_event; return _os; } diff --git a/sources/ewol/event/Entry.h b/sources/ewol/event/Entry.h new file mode 100644 index 00000000..20835190 --- /dev/null +++ b/sources/ewol/event/Entry.h @@ -0,0 +1,77 @@ +/** + * @author Edouard DUPIN + * + * @copyright 2011, Edouard DUPIN, all right reserved + * + * @license BSD v3 (see license file) + */ + +#ifndef __EWOL_EVENT_ENTRY_H__ +#define __EWOL_EVENT_ENTRY_H__ + +#include +#include + +namespace ewol { + namespace event { + class Entry { + private: + enum ewol::key::keyboard m_type; //!< type of hardware event + enum ewol::key::status m_status; //!< status of hardware event + ewol::key::Special m_specialKey; //!< input key status (prevent change in time..) + char32_t m_unicodeData; //!< Unicode data (in some case) + public: + Entry(enum ewol::key::keyboard _type, + enum ewol::key::status _status, + ewol::key::Special _specialKey, + char32_t _char) : + m_type(_type), + m_status(_status), + m_specialKey(_specialKey), + m_unicodeData(_char) { + + }; + void setType(enum ewol::key::keyboard _type) { + m_type = _type; + }; + inline const enum ewol::key::keyboard& getType(void) const { + return m_type; + }; + void setStatus(enum ewol::key::status _status) { + m_status = _status; + }; + inline const enum ewol::key::status& getStatus(void) const { + return m_status; + }; + void setSpecialKey(const ewol::key::Special& _specialKey) { + m_specialKey = _specialKey; + }; + inline const ewol::key::Special& getSpecialKey(void) const { + return m_specialKey; + }; + void setChar(char32_t _char) { + m_unicodeData = _char; + }; + inline const char32_t& getChar(void) const { + return m_unicodeData; + }; + }; + + class EntrySystem { + public: + EntrySystem(enum ewol::key::keyboard _type, + enum ewol::key::status _status, + ewol::key::Special _specialKey, + char32_t _char) : + m_event(_type, _status, _specialKey, _char) { + + }; + ewol::event::Entry m_event; + }; + }; + etk::CCout& operator <<(etk::CCout& _os, const ewol::event::Entry& _obj); + etk::CCout& operator <<(etk::CCout& _os, const ewol::event::EntrySystem& _obj); +}; + +#endif + diff --git a/sources/ewol/renderer/EventInput.cpp b/sources/ewol/event/Input.cpp similarity index 71% rename from sources/ewol/renderer/EventInput.cpp rename to sources/ewol/event/Input.cpp index 38d9fc21..6f45efc7 100644 --- a/sources/ewol/renderer/EventInput.cpp +++ b/sources/ewol/event/Input.cpp @@ -11,7 +11,7 @@ #undef __class__ #define __class__ "EventInput" -etk::CCout& ewol::operator <<(etk::CCout& _os, const ewol::EventInput& _obj) { +etk::CCout& ewol::operator <<(etk::CCout& _os, const ewol::event::Input& _obj) { _os << "{type=" << _obj.getType(); _os << " status=" << _obj.getStatus(); _os << " id=" << _obj.getId(); @@ -20,7 +20,7 @@ etk::CCout& ewol::operator <<(etk::CCout& _os, const ewol::EventInput& _obj) { return _os; } -etk::CCout& ewol::operator <<(etk::CCout& _os, const ewol::EventInputSystem& _obj) { +etk::CCout& ewol::operator <<(etk::CCout& _os, const ewol::event::InputSystem& _obj) { _os << _obj.m_event; return _os; } diff --git a/sources/ewol/event/Input.h b/sources/ewol/event/Input.h new file mode 100644 index 00000000..f245227b --- /dev/null +++ b/sources/ewol/event/Input.h @@ -0,0 +1,94 @@ +/** + * @author Edouard DUPIN + * + * @copyright 2011, Edouard DUPIN, all right reserved + * + * @license BSD v3 (see license file) + */ + +#ifndef __EWOL_EVENT_INPUT_H__ +#define __EWOL_EVENT_INPUT_H__ + +#include + +namespace ewol { + namespace event { + class Input { + private: + enum ewol::key::type m_type; + enum ewol::key::status m_status; + uint8_t m_inputId; + vec2 m_pos; + public: + Input(enum ewol::key::type _type, + enum ewol::key::status _status, + uint8_t _id, + const vec2& _pos): + m_type(_type), + m_status(_status), + m_inputId(_id), + m_pos(_pos){ + + }; + void setType(enum ewol::key::type _type) { + m_type = _type; + }; + inline const enum ewol::key::type& getType(void) const { + return m_type; + }; + void setStatus(enum ewol::key::status _status) { + m_status = _status; + }; + inline const enum ewol::key::status& getStatus(void) const { + return m_status; + }; + void setId(uint8_t _id) { + m_inputId = _id; + }; + inline const uint8_t& getId(void) const { + return m_inputId; + }; + void setPos(const vec2& _pos) { + m_pos = _pos; + }; + inline const vec2& getPos(void) const { + return m_pos; + }; + }; + + class InputSystem { + public: + InputSystem(enum ewol::key::type _type, + enum ewol::key::status _status, + uint8_t _id, + const vec2& _pos, + ewol::Widget* _dest, + int32_t _realIdEvent) : + m_event(_type, _status, _id, _pos), + m_dest(_dest), + m_realIdEvent(_realIdEvent) { }; + ewol::event::Input m_event; + private: + ewol::Widget* m_dest; + int32_t m_realIdEvent; + public: + void setDestWidget(ewol::Widget* _dest) { + m_dest = _dest; + }; + inline ewol::Widget* getDestWidget(void) const { + return m_dest; + }; + void setRealId(int32_t _realIdEvent) { + m_realIdEvent = _realIdEvent; + }; + inline int32_t getRealId(void) const { + return m_realIdEvent; + }; + }; + }; + etk::CCout& operator <<(etk::CCout& _os, const ewol::event::Input& _obj); + etk::CCout& operator <<(etk::CCout& _os, const ewol::event::InputSystem& _obj); +}; + +#endif + diff --git a/sources/ewol/renderer/EventTime.cpp b/sources/ewol/event/Time.cpp similarity index 77% rename from sources/ewol/renderer/EventTime.cpp rename to sources/ewol/event/Time.cpp index ff1b7bc7..798abef5 100644 --- a/sources/ewol/renderer/EventTime.cpp +++ b/sources/ewol/event/Time.cpp @@ -9,9 +9,9 @@ #include #undef __class__ -#define __class__ "EventTime" +#define __class__ "event::Time" -etk::CCout& ewol::operator <<(etk::CCout& _os, const ewol::EventTime& _obj) { +etk::CCout& ewol::operator <<(etk::CCout& _os, const ewol::event::Time& _obj) { _os << "{time=" << _obj.getTime(); _os << " uptime=" << _obj.getApplUpTime(); _os << " delta=" << _obj.getDelta(); diff --git a/sources/ewol/event/Time.h b/sources/ewol/event/Time.h new file mode 100644 index 00000000..a490f9f1 --- /dev/null +++ b/sources/ewol/event/Time.h @@ -0,0 +1,67 @@ +/** + * @author Edouard DUPIN + * + * @copyright 2011, Edouard DUPIN, all right reserved + * + * @license BSD v3 (see license file) + */ + +#ifndef __EWOL_EVENT_CALL_TIME_H__ +#define __EWOL_EVENT_CALL_TIME_H__ + +#include + +namespace ewol { + namespace event { + class Time { + private: + int64_t m_timeSystem; //!< Current system time (micro-second) + int64_t m_timeUpAppl; //!< Current application wake up-time (micro-second) + float m_timeDelta; //!< Time from the last cycle call of the system (main appl tick) (second) + float m_timeDeltaCall; //!< Time from the last call (when we can manage periodic call with specifying periode) (second) + public: + Time(int64_t _timeSystem, + int64_t _timeUpAppl, + float _timeDelta, + float _timeDeltaCall) : + m_timeSystem(_timeSystem), + m_timeUpAppl(_timeUpAppl), + m_timeDelta(_timeDelta), + m_timeDeltaCall(_timeDeltaCall){ + + }; + public: + void setTime(int64_t _timeSystem) { + m_timeSystem=_timeSystem; + }; + inline int64_t getTime(void) const { + return m_timeSystem; + }; + void setApplWakeUpTime(int64_t _timeUpAppl) { + m_timeUpAppl=_timeUpAppl; + }; + inline int64_t getApplWakeUpTime(void) const { + return m_timeUpAppl; + }; + inline int64_t getApplUpTime(void) const { + return m_timeSystem-m_timeUpAppl; + }; + void setDelta(float _timeDelta) { + m_timeDelta=_timeDelta; + }; + inline float getDelta(void) const { + return m_timeDelta; + }; + void setDeltaCall(float _timeDeltaCall) { + m_timeDeltaCall=_timeDeltaCall; + }; + inline float getDeltaCall(void) const { + return m_timeDeltaCall; + }; + }; + }; + etk::CCout& operator <<(etk::CCout& _os, const ewol::event::Time& _obj); +}; + +#endif + diff --git a/sources/ewol/key.cpp b/sources/ewol/key.cpp deleted file mode 100644 index b6d18cae..00000000 --- a/sources/ewol/key.cpp +++ /dev/null @@ -1,151 +0,0 @@ -/** - * @author Edouard DUPIN - * - * @copyright 2011, Edouard DUPIN, all right reserved - * - * @license BSD v3 (see license file) - */ - -#include - -static const char* statusDescriptionString[ewol::keyEvent::statusCount+1] = { - "statusUnknow", - "statusDown", - "statusMove", - "statusSingle", - "statusDouble", - "statusTriple", - "statusQuad", - "statusQuinte", - "statusUp", - "statusEnter", - "statusLeave", - "statusAbort", - "statusTransfert", - "statusCount" -}; - -etk::CCout& ewol::keyEvent::operator <<(etk::CCout& _os, const enum ewol::keyEvent::status _obj) { - if (_obj >= 0 && _obj = 0 && _obj = 0 && _obj < ewol::keyEvent::typeCount) { - _os << typeDescriptionString[_obj]; - } else { - _os << "[ERROR]"; - } - return _os; -} - -ewol::SpecialKey::SpecialKey(void) : - value(0) { - -} - -bool ewol::SpecialKey::isSetCapsLock(void) const { - return capLock; -} - -bool ewol::SpecialKey::isSetShift(void) const { - return shift; -} - -bool ewol::SpecialKey::isSetCtrl(void) const { - return ctrl; -} - -bool ewol::SpecialKey::isSetMeta(void) const { - return meta; -} - -bool ewol::SpecialKey::isSetAlt(void) const { - return alt; -} - -bool ewol::SpecialKey::isSetAltGr(void) const { - return altGr; -} - -bool ewol::SpecialKey::isSetNumLock(void) const { - return numLock; -} -bool ewol::SpecialKey::isSetInsert(void) const { - return insert; -} - -etk::CCout& ewol::operator <<(etk::CCout& _os, const ewol::SpecialKey _obj) { - _os << " capLock=" << _obj.capLock; - _os << " shift=" << _obj.shift; - _os << " ctrl=" << _obj.ctrl; - _os << " meta=" << _obj.meta; - _os << " alt=" << _obj.alt; - _os << " altGr=" << _obj.altGr; - _os << " verNum=" << _obj.numLock; - _os << " insert=" << _obj.insert; - return _os; -} diff --git a/sources/ewol/key.h b/sources/ewol/key.h deleted file mode 100644 index 07f1de56..00000000 --- a/sources/ewol/key.h +++ /dev/null @@ -1,175 +0,0 @@ -/** - * @author Edouard DUPIN - * - * @copyright 2011, Edouard DUPIN, all right reserved - * - * @license BSD v3 (see license file) - */ - -#ifndef __EWOL_KEY_H__ -#define __EWOL_KEY_H__ - -#include -#include - -namespace ewol { - namespace keyEvent { - /** - * @brief type of input : Note that the keyboard is not prevent due to the fact that data is too different - */ - enum type { - typeUnknow = 0, //!< Unknow input Type - typeMouse, //!< Mouse type - typeFinger, //!< Finger type - typeStylet, //!< Stylet type - typeCount //!< number of types - }; - /** - * @brief Debug operator To display the curent element in a Human redeable information - */ - etk::CCout& operator <<(etk::CCout& _os, const enum ewol::keyEvent::type _obj); - /** - * @brief Keybord event or joyestick event - */ - enum status { - statusUnknow = 0, - statusDown, // availlable on Keyboard too - statusMove, - statusSingle, - statusDouble, - statusTriple, - statusQuad, - statusQuinte, - statusUp, // availlable on Keyboard too - statusEnter, - statusLeave, - statusAbort, // Appeare when an event is tranfert betwwen widgets (the widget which receive this has lost the events) - statusTransfert, // Appeare when an event is tranfert betwwen widgets (the widget which receive this has receive the transfert of the event) - statusCount, // number max of imput possible - }; - /** - * @brief Debug operator To display the curent element in a Human redeable information - */ - etk::CCout& operator <<(etk::CCout& _os, const enum ewol::keyEvent::status _obj); - /** - * @brief Keybord event or joyestick event - */ - enum keyboard { - keyboardUnknow = 0, //!< Unknown keyboard key - keyboardChar, //!< Char input is arrived ... - keyboardLeft, //!< Left key <-- - keyboardRight, //!< Right key --> - keyboardUp, //!< Up key ^ - keyboardDown, //!< Down key \/ - keyboardPageUp, //!< Page Up key - keyboardPageDown, //!< page down key - keyboardStart, //!< Start key - keyboardEnd, //!< End key - keyboardPrint, //!< print screen key. - keyboardStopDefil, //!< Stop display key. - keyboardWait, //!< Wait key. - keyboardInsert, //!< insert key. - keyboardF1, //!< F1 key. - keyboardF2, //!< F2 key. - keyboardF3, //!< F3 key. - keyboardF4, //!< F4 key. - keyboardF5, //!< F5 key. - keyboardF6, //!< F6 key. - keyboardF7, //!< F7 key. - keyboardF8, //!< F8 key. - keyboardF9, //!< F9 key. - keyboardF10, //!< F10 key. - keyboardF11, //!< F11 key. - keyboardF12, //!< F12 key. - keyboardCapLock, //!< Capital Letter Lock key. - keyboardShiftLeft, //!< Shift left key. - keyboardShiftRight, //!< Shift right key. - keyboardCtrlLeft, //!< Control left key. - keyboardCtrlRight, //!< Control right key. - keyboardMetaLeft, //!< Meta left key (apple key or windows key). - keyboardMetaRight, //!< Meta right key (apple key or windows key). - keyboardAlt, //!< Alt key. - keyboardAltGr, //!< Alt ground key. - keyboardContextMenu, //!< Contextual menu key. - keyboardNumLock, //!< Numerical Lock key. - keyboardCount //!< number of posible key - }; - /** - * @brief Debug operator To display the curent element in a Human redeable information - */ - etk::CCout& operator <<(etk::CCout& _os, const enum ewol::keyEvent::keyboard _obj); - - }; - - class SpecialKey { - public: - union { - uint32_t value; - struct { - unsigned capLock : 1; - unsigned shift : 1; - unsigned ctrl : 1; - unsigned meta : 1; - unsigned alt : 1; - unsigned altGr : 1; - unsigned numLock : 1; - unsigned insert : 1; - }; - }; - public: - /** - * @brief Main constructor - */ - SpecialKey(void); - /** - * @brief get the current CapLock Status - * @return The status value - */ - bool isSetCapsLock(void) const; - /** - * @brief get the current Shift key status - * @return The status value - */ - bool isSetShift(void) const; - /** - * @brief get the Current Control key status - * @return The status value - */ - bool isSetCtrl(void) const; - /** - * @brief get the current Meta key status (also named windows or apple key) - * @return The status value - */ - bool isSetMeta(void) const; - /** - * @brief get the current Alt key status - * @return The status value - */ - bool isSetAlt(void) const; - /** - * @brief get the current Alt-Gr key status - * @return The status value - */ - bool isSetAltGr(void) const; - /** - * @brief get the current Ver-num key status - * @return The status value - */ - bool isSetNumLock(void) const; - /** - * @brief get the current Intert key status - * @return The status value - */ - bool isSetInsert(void) const; - }; - /** - * @brief Debug operator To display the curent element in a Human redeable information - */ - etk::CCout& operator <<(etk::CCout& _os, const ewol::SpecialKey _obj); -}; - - - -#endif - - diff --git a/sources/ewol/key/Special.cpp b/sources/ewol/key/Special.cpp new file mode 100644 index 00000000..64ef75f5 --- /dev/null +++ b/sources/ewol/key/Special.cpp @@ -0,0 +1,180 @@ +/** + * @author Edouard DUPIN + * + * @copyright 2011, Edouard DUPIN, all right reserved + * + * @license BSD v3 (see license file) + */ + +#include + +#define EWOL_FLAG_KEY_CAPS_LOCK 0x00000001 +#define EWOL_FLAG_KEY_SHIFT 0x00000002 +#define EWOL_FLAG_KEY_CTRL 0x00000004 +#define EWOL_FLAG_KEY_META 0x00000008 +#define EWOL_FLAG_KEY_ALT 0x00000010 +#define EWOL_FLAG_KEY_ALTGR 0x00000020 +#define EWOL_FLAG_KEY_NUM_LOCK 0x00000040 +#define EWOL_FLAG_KEY_INSERT 0x00000080 + + +ewol::key::Special::SpecialKey(void) : + m_value(0) { + +} + +bool ewol::key::Special::getCapsLock(void) const { + if ((m_value & EWOL_FLAG_KEY_CAPS_LOCK) != 0) { + return true; + } + return false; +} +void ewol::key::Special::setCapsLock(bool _value) { + if ((m_value & EWOL_FLAG_KEY_CAPS_LOCK) != 0) { + if (_value == false) { + m_value -= EWOL_FLAG_KEY_CAPS_LOCK; + } + } else { + if (_value == true) { + m_value += EWOL_FLAG_KEY_CAPS_LOCK; + } + } +} + +bool ewol::key::Special::getShift(void) const { + if ((m_value & EWOL_FLAG_KEY_SHIFT) != 0) { + return true; + } + return false; +} +void ewol::key::Special::setShift(bool _value) { + if ((m_value & EWOL_FLAG_KEY_SHIFT) != 0) { + if (_value == false) { + m_value -= EWOL_FLAG_KEY_SHIFT; + } + } else { + if (_value == true) { + m_value += EWOL_FLAG_KEY_SHIFT; + } + } +} + +bool ewol::key::Special::getCtrl(void) const { + if ((m_value & EWOL_FLAG_KEY_CTRL) != 0) { + return true; + } + return false; +} +void ewol::key::Special::setCtrl(bool _value) { + if ((m_value & EWOL_FLAG_KEY_CTRL) != 0) { + if (_value == false) { + m_value -= EWOL_FLAG_KEY_CTRL; + } + } else { + if (_value == true) { + m_value += EWOL_FLAG_KEY_CTRL; + } + } +} + +bool ewol::key::Special::getMeta(void) const { + if ((m_value & EWOL_FLAG_KEY_META) != 0) { + return true; + } + return false; +} +void ewol::key::Special::setMeta(bool _value) { + if ((m_value & EWOL_FLAG_KEY_META) != 0) { + if (_value == false) { + m_value -= EWOL_FLAG_KEY_META; + } + } else { + if (_value == true) { + m_value += EWOL_FLAG_KEY_META; + } + } +} + +bool ewol::key::Special::getAlt(void) const { + if ((m_value & EWOL_FLAG_KEY_ALT) != 0) { + return true; + } + return false; +} +void ewol::key::Special::setAlt(bool _value) { + if ((m_value & EWOL_FLAG_KEY_ALT) != 0) { + if (_value == false) { + m_value -= EWOL_FLAG_KEY_ALT; + } + } else { + if (_value == true) { + m_value += EWOL_FLAG_KEY_ALT; + } + } +} + +bool ewol::key::Special::getAltGr(void) const { + if ((m_value & EWOL_FLAG_KEY_ALTGR) != 0) { + return true; + } + return false; +} +void ewol::key::Special::setAltGr(bool _value) { + if ((m_value & EWOL_FLAG_KEY_ALTGR) != 0) { + if (_value == false) { + m_value -= EWOL_FLAG_KEY_ALTGR; + } + } else { + if (_value == true) { + m_value += EWOL_FLAG_KEY_ALTGR; + } + } +} + +bool ewol::key::Special::getNumLock(void) const { + if ((m_value & EWOL_FLAG_KEY_NUM_LOCK) != 0) { + return true; + } + return false; +} +void ewol::key::Special::setNumLock(bool _value) { + if ((m_value & EWOL_FLAG_KEY_NUM_LOCK) != 0) { + if (_value == false) { + m_value -= EWOL_FLAG_KEY_NUM_LOCK; + } + } else { + if (_value == true) { + m_value += EWOL_FLAG_KEY_NUM_LOCK; + } + } +} + +bool ewol::key::Special::getInsert(void) const { + if ((m_value & EWOL_FLAG_KEY_INSERT) != 0) { + return true; + } + return false; +} +void ewol::key::Special::setInsert(bool _value) { + if ((m_value & EWOL_FLAG_KEY_INSERT) != 0) { + if (_value == false) { + m_value -= EWOL_FLAG_KEY_INSERT; + } + } else { + if (_value == true) { + m_value += EWOL_FLAG_KEY_INSERT; + } + } +} + +etk::CCout& ewol::key::operator <<(etk::CCout& _os, const ewol::key::Special _obj) { + _os << " capLock=" << _obj.getCapsLock(); + _os << " shift=" << _obj.getShift(); + _os << " ctrl=" << _obj.getCtrl(); + _os << " meta=" << _obj.getMeta(); + _os << " alt=" << _obj.getAlt(); + _os << " altGr=" << _obj.getAltGr(); + _os << " verNum=" << _obj.getNumLock(); + _os << " insert=" << _obj.getInsert(); + return _os; +} diff --git a/sources/ewol/key/Special.h b/sources/ewol/key/Special.h new file mode 100644 index 00000000..04c22070 --- /dev/null +++ b/sources/ewol/key/Special.h @@ -0,0 +1,115 @@ +/** + * @author Edouard DUPIN + * + * @copyright 2011, Edouard DUPIN, all right reserved + * + * @license BSD v3 (see license file) + */ + +#ifndef __EWOL_KEY_SPECIAL_H__ +#define __EWOL_KEY_SPECIAL_H__ + +#include +#include + +namespace ewol { + namespace key { + /** + * @brief This class consider generic special keyborad key (insert, control, shift ...) + */ + class Special { + private: + uint32_t m_value; + public: + /** + * @brief Main constructor + */ + Special(void); + /** + * @brief get the current CapLock Status + * @return The CapLock value + */ + bool getCapsLock(void) const; + /** + * @brief set the current CapLock Status + * @param[in] _value The new CapLock value + */ + void setCapsLock(bool _value); + /** + * @brief Get the current Shift key status + * @return The Shift value + */ + bool getShift(void) const; + /** + * @brief Set the current Shift key status + * @param[in] _value The new Shift value + */ + void setShift(bool _value); + /** + * @brief Get the Current Control key status + * @return The Control value + */ + bool getCtrl(void) const; + /** + * @brief Set the Current Control key status + * @param[in] _value The new Control value + */ + void setCtrl(bool _value); + /** + * @brief Get the current Meta key status (also named windows or apple key) + * @return The Meta value (name Windows key, apple key, command key ...) + */ + bool getMeta(void) const; + /** + * @brief Set the current Meta key status (also named windows or apple key) + * @param[in] _value The new Meta value (name Windows key, apple key, command key ...) + */ + void setMeta(bool _value); + /** + * @brief Get the current Alt key status + * @return The Alt value + */ + bool getAlt(void) const; + /** + * @brief Set the current Alt key status + * @param[in] _value The new Alt value + */ + void setAlt(bool _value); + /** + * @brief Get the current Alt-Gr key status + * @return The Alt-gr value (does not exist on MacOs) + */ + bool getAltGr(void) const; + /** + * @brief Set the current Alt-Gr key status + * @param[in] _value The new Alt-gr value (does not exist on MacOs) + */ + void setAltGr(bool _value); + /** + * @brief Get the current Ver-num key status + * @return The Numerical Lock value + */ + bool getNumLock(void) const; + /** + * @brief Set the current Ver-num key status + * @param[in] _value The new Numerical Lock value + */ + void setNumLock(bool _value); + /** + * @brief Get the current Intert key status + * @return The Insert value + */ + bool getInsert(void) const; + /** + * @brief Set the current Intert key status + * @param[in] _value The new Insert value + */ + void setInsert(bool _value); + }; + etk::CCout& operator <<(etk::CCout& _os, const ewol::key::Special _obj); + }; +}; + +#endif + + diff --git a/sources/ewol/key/key.h b/sources/ewol/key/key.h new file mode 100644 index 00000000..c737d736 --- /dev/null +++ b/sources/ewol/key/key.h @@ -0,0 +1,19 @@ +/** + * @author Edouard DUPIN + * + * @copyright 2011, Edouard DUPIN, all right reserved + * + * @license BSD v3 (see license file) + */ + +#ifndef __EWOL_KEY_H__ +#define __EWOL_KEY_H__ + +#include +#include +#include +#include + +#endif + + diff --git a/sources/ewol/key/keyboard.cpp b/sources/ewol/key/keyboard.cpp new file mode 100644 index 00000000..95ddfa1d --- /dev/null +++ b/sources/ewol/key/keyboard.cpp @@ -0,0 +1,60 @@ +/** + * @author Edouard DUPIN + * + * @copyright 2011, Edouard DUPIN, all right reserved + * + * @license BSD v3 (see license file) + */ + +#include + +static const char* keyboardDescriptionString[ewol::key::keyboardCount+1] = { + "keyboardUnknow", + "keyboardChar", + "keyboardLeft", + "keyboardRight", + "keyboardUp", + "keyboardDown", + "keyboardPageUp", + "keyboardPageDown", + "keyboardStart", + "keyboardEnd", + "keyboardPrint", + "keyboardStopDefil", + "keyboardWait", + "keyboardInsert", + "keyboardF1", + "keyboardF2", + "keyboardF3", + "keyboardF4", + "keyboardF5", + "keyboardF6", + "keyboardF7", + "keyboardF8", + "keyboardF9", + "keyboardF10", + "keyboardF11", + "keyboardF12", + "keyboardCapLock", + "keyboardShiftLeft", + "keyboardShiftRight", + "keyboardCtrlLeft", + "keyboardCtrlRight", + "keyboardMetaLeft", + "keyboardMetaRight", + "keyboardAlt", + "keyboardAltGr", + "keyboardContextMenu", + "keyboardNumLock", + "keyboardCount" +}; + +etk::CCout& ewol::key::operator <<(etk::CCout& _os, const enum ewol::key::keyboard _obj) { + if (_obj >= 0 && _obj +#include + +namespace ewol { + namespace key { + /** + * @brief Keybord event or joystick event + */ + enum keyboard { + keyboardUnknow = 0, //!< Unknown keyboard key + keyboardChar, //!< Char input is arrived ... + keyboardLeft, //!< Left key <-- + keyboardRight, //!< Right key --> + keyboardUp, //!< Up key ^ + keyboardDown, //!< Down key \/ + keyboardPageUp, //!< Page Up key + keyboardPageDown, //!< page down key + keyboardStart, //!< Start key + keyboardEnd, //!< End key + keyboardPrint, //!< print screen key. + keyboardStopDefil, //!< Stop display key. + keyboardWait, //!< Wait key. + keyboardInsert, //!< insert key. + keyboardF1, //!< F1 key. + keyboardF2, //!< F2 key. + keyboardF3, //!< F3 key. + keyboardF4, //!< F4 key. + keyboardF5, //!< F5 key. + keyboardF6, //!< F6 key. + keyboardF7, //!< F7 key. + keyboardF8, //!< F8 key. + keyboardF9, //!< F9 key. + keyboardF10, //!< F10 key. + keyboardF11, //!< F11 key. + keyboardF12, //!< F12 key. + keyboardCapLock, //!< Capital Letter Lock key. + keyboardShiftLeft, //!< Shift left key. + keyboardShiftRight, //!< Shift right key. + keyboardCtrlLeft, //!< Control left key. + keyboardCtrlRight, //!< Control right key. + keyboardMetaLeft, //!< Meta left key (apple key or windows key). + keyboardMetaRight, //!< Meta right key (apple key or windows key). + keyboardAlt, //!< Alt key. + keyboardAltGr, //!< Alt ground key. + keyboardContextMenu, //!< Contextual menu key. + keyboardNumLock, //!< Numerical Lock key. + keyboardCount //!< number of posible key + }; + /** + * @brief Debug operator To display the curent element in a Human redeable information + */ + etk::CCout& operator <<(etk::CCout& _os, const enum ewol::key::keyboard _obj); + }; +}; + + + +#endif + + diff --git a/sources/ewol/key/status.cpp b/sources/ewol/key/status.cpp new file mode 100644 index 00000000..3c9e251d --- /dev/null +++ b/sources/ewol/key/status.cpp @@ -0,0 +1,37 @@ +/** + * @author Edouard DUPIN + * + * @copyright 2011, Edouard DUPIN, all right reserved + * + * @license BSD v3 (see license file) + */ + +#include + +static const char* statusDescriptionString[ewol::key::statusCount+1] = { + "statusUnknow", + "statusDown", + "statusMove", + "statusSingle", + "statusDouble", + "statusTriple", + "statusQuad", + "statusQuinte", + "statusUp", + "statusEnter", + "statusLeave", + "statusAbort", + "statusTransfert", + "statusCount" +}; + +etk::CCout& ewol::key::operator <<(etk::CCout& _os, const enum ewol::key::status _obj) { + if (_obj >= 0 && _obj +#include + +namespace ewol { + namespace key { + /** + * @brief Keybord event or joyestick event + */ + enum status { + statusUnknow = 0, + statusDown, // availlable on Keyboard too + statusMove, + statusSingle, + statusDouble, + statusTriple, + statusQuad, + statusQuinte, + statusUp, // availlable on Keyboard too + statusEnter, + statusLeave, + statusAbort, // Appeare when an event is tranfert betwwen widgets (the widget which receive this has lost the events) + statusTransfert, // Appeare when an event is tranfert betwwen widgets (the widget which receive this has receive the transfert of the event) + statusCount, // number max of imput possible + }; + /** + * @brief Debug operator To display the curent element in a Human redeable information + */ + etk::CCout& operator <<(etk::CCout& _os, const enum ewol::key::status _obj); + }; +}; + + + +#endif + + diff --git a/sources/ewol/key/type.cpp b/sources/ewol/key/type.cpp new file mode 100644 index 00000000..15e2ab9f --- /dev/null +++ b/sources/ewol/key/type.cpp @@ -0,0 +1,28 @@ +/** + * @author Edouard DUPIN + * + * @copyright 2011, Edouard DUPIN, all right reserved + * + * @license BSD v3 (see license file) + */ + +#include + + +static const char* typeDescriptionString[ewol::key::typeCount+1] = { + "typeUnknow", + "typeMouse", + "typeFinger", + "typeStylet", + "typeCount" +}; + +etk::CCout& ewol::operator <<(etk::CCout& _os, const enum ewol::key::type _obj) { + if (_obj >= 0 && _obj < ewol::key::typeCount) { + _os << typeDescriptionString[_obj]; + } else { + _os << "[ERROR]"; + } + return _os; +} + diff --git a/sources/ewol/key/type.h b/sources/ewol/key/type.h new file mode 100644 index 00000000..9007ea20 --- /dev/null +++ b/sources/ewol/key/type.h @@ -0,0 +1,38 @@ +/** + * @author Edouard DUPIN + * + * @copyright 2011, Edouard DUPIN, all right reserved + * + * @license BSD v3 (see license file) + */ + +#ifndef __EWOL_KEY_TYPE_H__ +#define __EWOL_KEY_TYPE_H__ + +#include +#include + +namespace ewol { + namespace key { + /** + * @brief type of input : Note that the keyboard is not prevent due to the fact that data is too different + */ + enum type { + typeUnknow = 0, //!< Unknow input Type + typeMouse, //!< Mouse type + typeFinger, //!< Finger type + typeStylet, //!< Stylet type + typeCount //!< number of types + }; + }; + /** + * @brief Debug operator To display the curent element in a Human redeable information + */ + etk::CCout& operator <<(etk::CCout& _os, const enum ewol::key::type _obj); +}; + + + +#endif + + diff --git a/sources/ewol/object/Config.cpp b/sources/ewol/object/Config.cpp new file mode 100644 index 00000000..51f6f270 --- /dev/null +++ b/sources/ewol/object/Config.cpp @@ -0,0 +1,19 @@ +/** + * @author Edouard DUPIN + * + * @copyright 2011, Edouard DUPIN, all right reserved + * + * @license BSD v3 (see license file) + */ + +#include + +#undef __class__ +#define __class__ "object::Config" + +etk::CCout& ewol::operator <<(etk::CCout& _os, const ewol::object::Config& _obj) { + _os << "{"; + _os << "config=\"" << _obj.getConfig() << "\""; + _os << " data=\"" << _obj.getData() << "\"}"; + return _os; +} diff --git a/sources/ewol/object/Config.h b/sources/ewol/object/Config.h new file mode 100644 index 00000000..4cffe5d5 --- /dev/null +++ b/sources/ewol/object/Config.h @@ -0,0 +1,47 @@ +/** + * @author Edouard DUPIN + * + * @copyright 2011, Edouard DUPIN, all right reserved + * + * @license BSD v3 (see license file) + */ + +#ifndef __EWOL_OBJECT_CONFIG_H__ +#define __EWOL_OBJECT_CONFIG_H__ + +#include +#include + +namespace ewol { + namespace object { + class Config { + private: + const char* m_config; //!< config properties. + std::string m_data; //!< compositing additionnal message Value. + public: + Config(const char* _config, + const std::string& _data) : + m_config(_config), + m_data(_data) { + + }; + void setConfig(const char* _config) { + m_config = _config; + }; + inline const char* getConfig(void) const { + return m_config; + }; + void setData(const std::string& _data) { + m_data = _data; + }; + inline const std::string& getData(void) const { + return m_data; + }; + }; + }; + etk::CCout& operator <<(etk::CCout& _os, const ewol::object::Config& _obj); +}; + + +#endif + diff --git a/sources/ewol/renderer/EConfig.cpp b/sources/ewol/object/ConfigElement.cpp similarity index 64% rename from sources/ewol/renderer/EConfig.cpp rename to sources/ewol/object/ConfigElement.cpp index 3407516a..5a4ede8b 100644 --- a/sources/ewol/renderer/EConfig.cpp +++ b/sources/ewol/object/ConfigElement.cpp @@ -6,19 +6,12 @@ * @license BSD v3 (see license file) */ -#include +#include #undef __class__ -#define __class__ "EConfig" +#define __class__ "object::ConfigElement" -etk::CCout& ewol::operator <<(etk::CCout& _os, const ewol::EConfig& _obj) { - _os << "{"; - _os << "config=\"" << _obj.getConfig() << "\""; - _os << " data=\"" << _obj.getData() << "\"}"; - return _os; -} - -etk::CCout& ewol::operator <<(etk::CCout& _os, const ewol::EConfigElement& _obj) { +etk::CCout& ewol::operator <<(etk::CCout& _os, const ewol::object::ConfigElement& _obj) { _os << "{"; if (NULL != _obj.getConfig()) { _os << "config=\"" << _obj.getConfig() << "\""; diff --git a/sources/ewol/object/ConfigElement.h b/sources/ewol/object/ConfigElement.h new file mode 100644 index 00000000..cb2303c6 --- /dev/null +++ b/sources/ewol/object/ConfigElement.h @@ -0,0 +1,60 @@ +/** + * @author Edouard DUPIN + * + * @copyright 2011, Edouard DUPIN, all right reserved + * + * @license BSD v3 (see license file) + */ + +#ifndef __EWOL_OBJECT_CONFIG_ELEMENT_H__ +#define __EWOL_OBJECT_CONFIG_ELEMENT_H__ + +#include +#include + +namespace ewol { + namespace object { + class ConfigElement { + private: + const char* m_config; //!< config properties (used for XML properties == > only : "[0-9a-zA-Z\-]" ==> this is a regExp control. + const char* m_type; //!< type of the config[integer,float,string,reg-exp,list]. + const char* m_control; //!< control the type of the type set ( integer:[0..256], regExp: "[0-9a-zA-Z]", list:[plop,plop2,plop3] ) + const char* m_description; //!< description to help user to configure it. + const char* m_default; //!< default value ... + public: + // note : no parameter capability is needed to create element in case of vector stoarage. + ConfigElement(const char* _config = NULL, + const char* _type = NULL, + const char* _control = NULL, + const char* _description = NULL, + const char* _default = NULL) : + m_config(_config), + m_type(_type), + m_control(_control), + m_description(_description), + m_default(_default) { + + }; + inline const char* getConfig(void) const { + return m_config; + }; + inline const char* getType(void) const { + return m_type; + }; + inline const char* getControl(void) const { + return m_control; + }; + inline const char* getDescription(void) const { + return m_description; + }; + inline const char* getDefault(void) const { + return m_default; + }; + }; + }; + etk::CCout& operator <<(etk::CCout& _os, const ewol::object::ConfigElement& _obj); +}; + + +#endif + diff --git a/sources/ewol/renderer/EObjectManager.cpp b/sources/ewol/object/Manager.cpp similarity index 69% rename from sources/ewol/renderer/EObjectManager.cpp rename to sources/ewol/object/Manager.cpp index 184c95da..cce76954 100644 --- a/sources/ewol/renderer/EObjectManager.cpp +++ b/sources/ewol/object/Manager.cpp @@ -6,21 +6,21 @@ * @license BSD v3 (see license file) */ -#include -#include +#include +#include #include #undef __class__ -#define __class__ "EObjectManager" +#define __class__ "ewol::object::Manager" -ewol::EObjectManager::EObjectManager(void) { - EWOL_DEBUG(" == > init EObject-Manager"); +ewol::object::Manager::Manager(void) { + EWOL_DEBUG(" == > init Object-Manager"); // Can create mlemory leak ... == > but not predictable comportement otherwise ... m_eObjectAutoRemoveList.clear(); m_eObjectList.clear(); } -ewol::EObjectManager::~EObjectManager(void) { +ewol::object::Manager::~Manager(void) { bool hasError = false; if (m_eObjectAutoRemoveList.size()!=0) { EWOL_ERROR("Must not have anymore eObject to auto-remove !!!"); @@ -35,8 +35,8 @@ ewol::EObjectManager::~EObjectManager(void) { } } -void ewol::EObjectManager::unInit(void) { - EWOL_DEBUG(" == > Un-Init EObject-Manager"); +void ewol::object::Manager::unInit(void) { + EWOL_DEBUG(" == > Un-Init Object-Manager"); removeAllAutoRemove(); EWOL_INFO(" remove missing user widget"); size_t iii=0; @@ -46,7 +46,7 @@ void ewol::EObjectManager::unInit(void) { || m_eObjectList[iii]->getStatusResource() == true) { iii++; } else { - EWOL_WARNING("Un-INIT : remove EObject type=\"" << m_eObjectList[iii]->getObjectType() << "\""); + EWOL_WARNING("Un-INIT : remove Object type=\"" << m_eObjectList[iii]->getObjectType() << "\""); delete(m_eObjectList[iii]); m_eObjectList[iii] = NULL; } @@ -61,7 +61,7 @@ void ewol::EObjectManager::unInit(void) { if (m_eObjectList[iii]->getStatic() == true) { iii++; } else { - EWOL_WARNING("Un-INIT : remove EObject type=\"" << m_eObjectList[iii]->getObjectType() << "\""); + EWOL_WARNING("Un-INIT : remove Object type=\"" << m_eObjectList[iii]->getObjectType() << "\""); delete(m_eObjectList[iii]); m_eObjectList[iii] = NULL; } @@ -73,7 +73,7 @@ void ewol::EObjectManager::unInit(void) { EWOL_INFO(" remove static user widgets"); while(iii < m_eObjectList.size()) { if (m_eObjectList[iii] != NULL) { - EWOL_WARNING("Un-INIT : remove EObject type=\"" << m_eObjectList[iii]->getObjectType() << "\""); + EWOL_WARNING("Un-INIT : remove Object type=\"" << m_eObjectList[iii]->getObjectType() << "\""); delete(m_eObjectList[iii]); m_eObjectList[iii] = NULL; } else { @@ -82,19 +82,19 @@ void ewol::EObjectManager::unInit(void) { } } -void ewol::EObjectManager::add(ewol::EObject* _object) { +void ewol::object::Manager::add(ewol::Object* _object) { if (NULL != _object) { m_eObjectList.push_back(_object); } else { - EWOL_ERROR("try to add an inexistant EObject in manager"); + EWOL_ERROR("try to add an inexistant Object in manager"); } } -int32_t ewol::EObjectManager::getNumberObject(void) { +int32_t ewol::object::Manager::getNumberObject(void) { return m_eObjectList.size() + m_eObjectAutoRemoveList.size(); } -void ewol::EObjectManager::informOneObjectIsRemoved(ewol::EObject* _object) { +void ewol::object::Manager::informOneObjectIsRemoved(ewol::Object* _object) { for (size_t iii=0; iiionObjectRemove(_object); @@ -110,9 +110,9 @@ void ewol::EObjectManager::informOneObjectIsRemoved(ewol::EObject* _object) { ewol::getContext().onObjectRemove(_object); } -void ewol::EObjectManager::rm(ewol::EObject* _object) { +void ewol::object::Manager::rm(ewol::Object* _object) { if (NULL == _object) { - EWOL_ERROR("Try to remove (NULL) EObject"); + EWOL_ERROR("Try to remove (NULL) Object"); return; } for (size_t iii=0; iiigetId() << "] type=\"" << _object->getObjectType() << "\""); + EWOL_DEBUG("Auto-Remove Object : [" << _object->getId() << "] type=\"" << _object->getObjectType() << "\""); informOneObjectIsRemoved(_object); m_eObjectAutoRemoveList.push_back(_object); ewol::getContext().forceRedrawAll(); return; } } - EWOL_ERROR("Try to Auto-Remove EObject that is not referenced ..."); + EWOL_ERROR("Try to Auto-Remove Object that is not referenced ..."); } -// clean all EObject that request an autoRemove ... -void ewol::EObjectManager::removeAllAutoRemove(void) { - //EWOL_DEBUG("Auto-Remove EObject section : " << m_eObjectAutoRemoveList.size() << " elemeents"); +// clean all Object that request an autoRemove ... +void ewol::object::Manager::removeAllAutoRemove(void) { + //EWOL_DEBUG("Auto-Remove Object section : " << m_eObjectAutoRemoveList.size() << " elemeents"); while(0getObjectType() << "\""); + EWOL_DEBUG("Real Auto-Remove Object type=\"" << m_eObjectAutoRemoveList[0]->getObjectType() << "\""); delete(m_eObjectAutoRemoveList[0]); m_eObjectAutoRemoveList[0] = NULL; } else { @@ -170,7 +170,7 @@ void ewol::EObjectManager::removeAllAutoRemove(void) { m_eObjectAutoRemoveList.clear(); } -ewol::EObject* ewol::EObjectManager::get(const std::string& _name) { +ewol::Object* ewol::object::Manager::get(const std::string& _name) { if (_name == "") { return NULL; } diff --git a/sources/ewol/object/Manager.h b/sources/ewol/object/Manager.h new file mode 100644 index 00000000..6d15688b --- /dev/null +++ b/sources/ewol/object/Manager.h @@ -0,0 +1,51 @@ +/** + * @author Edouard DUPIN + * + * @copyright 2011, Edouard DUPIN, all right reserved + * + * @license BSD v3 (see license file) + */ + +#ifndef __EWOL_OBJECT_MANAGER_H__ +#define __EWOL_OBJECT_MANAGER_H__ + +#include +#include +#include + +namespace ewol { + namespace object { + class Manager { + private: + std::vector m_eObjectList; // all widget allocated == > all time increment ... never removed ... + std::vector m_eObjectAutoRemoveList; // all widget allocated + public: + Manager(void); + ~Manager(void); + /** + * @brief remove all resources (un-init) out of the destructor (due to the system implementation) + */ + void unInit(void); + + void add(ewol::Object* _object); + void rm(ewol::Object* _object); + int32_t getNumberObject(void); + + void autoRemove(ewol::Object* _object); + void removeAllAutoRemove(void); + + ewol::Object* get(const std::string& _name); + private: + void informOneObjectIsRemoved(ewol::Object* _object); + private: + ewol::object::MultiCast m_multiCast; //!< muticast manager + public: + ewol::object::MultiCast& multiCast(void) { + return m_multiCast; + }; + }; + }; +}; + +#endif + diff --git a/sources/ewol/renderer/EMessage.cpp b/sources/ewol/object/Message.cpp similarity index 69% rename from sources/ewol/renderer/EMessage.cpp rename to sources/ewol/object/Message.cpp index 571122d1..6ad72d9a 100644 --- a/sources/ewol/renderer/EMessage.cpp +++ b/sources/ewol/object/Message.cpp @@ -6,12 +6,12 @@ * @license BSD v3 (see license file) */ -#include +#include #undef __class__ -#define __class__ "EMessage" +#define __class__ "object/Message" -etk::CCout& ewol::operator <<(etk::CCout& _os, const ewol::EMessage& _obj) { +etk::CCout& ewol::operator <<(etk::CCout& _os, const ewol::object::Message& _obj) { _os << "{"; if (NULL != _obj.getMessage()) { _os << "msg=\"" << _obj.getMessage() << "\""; diff --git a/sources/ewol/object/Message.h b/sources/ewol/object/Message.h new file mode 100644 index 00000000..1ce55901 --- /dev/null +++ b/sources/ewol/object/Message.h @@ -0,0 +1,56 @@ +/** + * @author Edouard DUPIN + * + * @copyright 2011, Edouard DUPIN, all right reserved + * + * @license BSD v3 (see license file) + */ + +#ifndef __EWOL_OBJECT_MESSAGE_H__ +#define __EWOL_OBJECT_MESSAGE_H__ + +#include +#include + +namespace ewol { + namespace object { + class Message { + private: + ewol::Object* m_callerObject; //!< Caller class. + const char* m_event; //!< Event pointer == > unique Id define by the system ... + std::string m_data; //!< compositing additionnal message Value. + public: + Message(ewol::Object* _caller, + const char* _message, + const std::string& _data) : + m_callerObject(_caller), + m_event(_message), + m_data(_data) { + + }; + void setCaller(ewol::Object* _caller) { + m_callerObject = _caller; + }; + inline ewol::Object* getCaller(void) const { + return m_callerObject; + }; + void setMessage(const char* _message) { + m_event = _message; + }; + inline const char* getMessage(void) const { + return m_event; + }; + void setData(const std::string& _data) { + m_data = _data; + }; + inline const std::string& getData(void) const { + return m_data; + }; + }; + }; + etk::CCout& operator <<(etk::CCout& _os, const ewol::object::Message& _obj); +}; + + +#endif + diff --git a/sources/ewol/renderer/EMultiCast.cpp b/sources/ewol/object/MultiCast.cpp similarity index 79% rename from sources/ewol/renderer/EMultiCast.cpp rename to sources/ewol/object/MultiCast.cpp index 10ac9a2e..ac0f5065 100644 --- a/sources/ewol/renderer/EMultiCast.cpp +++ b/sources/ewol/object/MultiCast.cpp @@ -7,24 +7,24 @@ */ #include -#include -#include +#include +#include #undef __class__ -#define __class__ "EMultiCast" +#define __class__ "object::MultiCast" -ewol::EMultiCast::EMultiCast(void) { +ewol::object::MultiCast::MultiCast(void) { EWOL_INFO("EObject message Multi-Cast"); } -ewol::EMultiCast::~EMultiCast(void) { +ewol::object::MultiCast::~MultiCast(void) { EWOL_INFO("EObject message Multi-Cast"); m_messageList.clear(); } -void ewol::EMultiCast::add(ewol::EObject* _object, const char* const _message) { +void ewol::object::MultiCast::add(ewol::Object* _object, const char* const _message) { if (NULL == _object) { EWOL_ERROR("Add with NULL object"); return; @@ -38,7 +38,7 @@ void ewol::EMultiCast::add(ewol::EObject* _object, const char* const _message) { } -void ewol::EMultiCast::rm(ewol::EObject* _object) { +void ewol::object::MultiCast::rm(ewol::Object* _object) { if (NULL == _object) { EWOL_ERROR("Rm with NULL object"); return; @@ -54,7 +54,7 @@ void ewol::EMultiCast::rm(ewol::EObject* _object) { } } -void ewol::EMultiCast::send(ewol::EObject* _object, const char* const _message, const std::string& _data) { +void ewol::object::MultiCast::send(ewol::Object* _object, const char* const _message, const std::string& _data) { EWOL_VERBOSE("SendMulticast message \"" << _message << "\" data=\"" << _data << "\" to :"); // send the message at all registered widget ... diff --git a/sources/ewol/object/MultiCast.h b/sources/ewol/object/MultiCast.h new file mode 100644 index 00000000..0ac71626 --- /dev/null +++ b/sources/ewol/object/MultiCast.h @@ -0,0 +1,46 @@ +/** + * @author Edouard DUPIN + * + * @copyright 2011, Edouard DUPIN, all right reserved + * + * @license BSD v3 (see license file) + */ + +#ifndef __EWOL_OBJECT_MULTICAST_H__ +#define __EWOL_OBJECT_MULTICAST_H__ + +#include +#include +#include +#include + +#include + +namespace ewol { + namespace object { + class MultiCast { + private: + class MessageList { + public: + MessageList(const char* _message=NULL, ewol::Object* _object=NULL) : + m_message(_message), m_object(_object) { + + } + const char* m_message; + ewol::Object* m_object; + }; + std::vector m_messageList; //!< List of all message ... + public: + MultiCast(void); + ~MultiCast(void); + void anonymousSend(const char* const _messageId, const std::string& _data) { + send(NULL, _messageId, _data); + }; + void send(ewol::Object* _object, const char* const _message, const std::string& _data); + void rm(ewol::Object* _object); + void add(ewol::Object* _object, const char* const _message); + }; + }; +}; + +#endif diff --git a/sources/ewol/renderer/EObject.cpp b/sources/ewol/object/Object.cpp similarity index 63% rename from sources/ewol/renderer/EObject.cpp rename to sources/ewol/object/Object.cpp index 34cb179d..a082dc76 100644 --- a/sources/ewol/renderer/EObject.cpp +++ b/sources/ewol/object/Object.cpp @@ -6,41 +6,41 @@ * @license BSD v3 (see license file) */ -#include -#include +#include +#include #include -#include +#include #undef __class__ -#define __class__ "ewol::EObject" +#define __class__ "ewol::Object" -const char* const ewol::EObject::configName = "name"; -size_t ewol::EObject::m_valUID = 0; +const char* const ewol::Object::configName = "name"; +size_t ewol::Object::m_valUID = 0; -ewol::EObject::EObject(void) : +ewol::Object::Object(void) : m_static(false), m_isResource(false) { // note this is nearly atomic ... (but it is enough) m_uniqueId = m_valUID++; - EWOL_DEBUG("new EObject : [" << m_uniqueId << "]"); - getEObjectManager().add(this); - registerConfig(ewol::EObject::configName, "string", NULL, "EObject name, might be a unique reference in all the program"); + EWOL_DEBUG("new Object : [" << m_uniqueId << "]"); + getObjectManager().add(this); + registerConfig(ewol::Object::configName, "string", NULL, "Object name, might be a unique reference in all the program"); } -ewol::EObject::EObject(const std::string& _name) : +ewol::Object::Object(const std::string& _name) : m_static(false), m_name(_name), m_isResource(false) { // note this is nearly atomic ... (but it is enough) m_uniqueId = m_valUID++; - EWOL_DEBUG("new EObject : [" << m_uniqueId << "]"); - getEObjectManager().add(this); - registerConfig(ewol::EObject::configName, "string", NULL, "EObject name, might be a unique reference in all the program"); + EWOL_DEBUG("new Object : [" << m_uniqueId << "]"); + getObjectManager().add(this); + registerConfig(ewol::Object::configName, "string", NULL, "Object name, might be a unique reference in all the program"); } -ewol::EObject::~EObject(void) { - EWOL_DEBUG("delete EObject : [" << m_uniqueId << "] : " << getTypeDescription()); - getEObjectManager().rm(this); +ewol::Object::~Object(void) { + EWOL_DEBUG("delete Object : [" << m_uniqueId << "] : " << getTypeDescription()); + getObjectManager().rm(this); getMultiCast().rm(this); for (size_t iii=0; iiilocalEventId == _generateEventId) { - if (NULL != m_externEvent[iii]->destEObject) { + if (NULL != m_externEvent[iii]->destObject) { if (m_externEvent[iii]->overloadData.size() <= 0){ ewol::EMessage tmpMsg(this, m_externEvent[iii]->destEventId, _data); EWOL_VERBOSE("send message " << tmpMsg); - m_externEvent[iii]->destEObject->onReceiveMessage(tmpMsg); + m_externEvent[iii]->destObject->onReceiveMessage(tmpMsg); } else { // set the user requested data ... ewol::EMessage tmpMsg(this, m_externEvent[iii]->destEventId, m_externEvent[iii]->overloadData); EWOL_VERBOSE("send message " << tmpMsg); - m_externEvent[iii]->destEObject->onReceiveMessage(tmpMsg); + m_externEvent[iii]->destObject->onReceiveMessage(tmpMsg); } } } } } - if (nbObject > getEObjectManager().getNumberObject()) { - EWOL_CRITICAL("It if really dangerous ro remove (delete) element inside a callback ... use ->removeObject() which is asynchronous"); + if (nbObject > getObjectManager().getNumberObject()) { + EWOL_CRITICAL("It if really dangerous ro remove (delete) element inside a callback ... use ->removObject() which is asynchronous"); } } -void ewol::EObject::sendMultiCast(const char* const _messageId, const std::string& _data) { - int32_t nbObject = getEObjectManager().getNumberObject(); +void ewol::Object::sendMultiCast(const char* const _messageId, const std::string& _data) { + int32_t nbObject = getObjectManager().getNumberObject(); getMultiCast().send(this, _messageId, _data); - if (nbObject > getEObjectManager().getNumberObject()) { - EWOL_CRITICAL("It if really dangerous ro remove (delete) element inside a callback ... use ->removeObject() which is asynchronous"); + if (nbObject > getObjectManager().getNumberObject()) { + EWOL_CRITICAL("It if really dangerous ro remove (delete) element inside a callback ... use ->removObject() which is asynchronous"); } } -void ewol::EObject::registerMultiCast(const char* const _messageId) { +void ewol::Object::registerMultiCast(const char* const _messageId) { getMultiCast().add(this, _messageId); } -void ewol::EObject::registerOnEvent(ewol::EObject * _destinationObject, +void ewol::Object::registerOnEvent(ewol::Object * _destinationObject, const char * _eventId, const char * _eventIdgenerated, const std::string& _overloadData) { if (NULL == _destinationObject) { - EWOL_ERROR("Input ERROR NULL pointer EObject ..."); + EWOL_ERROR("Input ERROR NULL pointer Object ..."); return; } if (NULL == _eventId) { @@ -175,13 +175,13 @@ void ewol::EObject::registerOnEvent(ewol::EObject * _destinationObject, EWOL_ERROR("Can not register event on this Type=" << getObjectType() << " event=\"" << _eventId << "\" == > unknow event"); return; } - ewol::EventExtGen * tmpEvent = new ewol::EventExtGen(); + ewol::object::EventExtGen * tmpEvent = new ewol::object::EventExtGen(); if (NULL == tmpEvent) { EWOL_ERROR("Allocation error in Register Event..."); return; } tmpEvent->localEventId = _eventId; - tmpEvent->destEObject = _destinationObject; + tmpEvent->destObject = _destinationObject; tmpEvent->overloadData = _overloadData; if (NULL != _eventIdgenerated) { tmpEvent->destEventId = _eventIdgenerated; @@ -191,10 +191,10 @@ void ewol::EObject::registerOnEvent(ewol::EObject * _destinationObject, m_externEvent.push_back(tmpEvent); } -void ewol::EObject::unRegisterOnEvent(ewol::EObject * _destinationObject, +void ewol::Object::unRegisterOnEvent(ewol::Object * _destinationObject, const char * _eventId) { if (NULL == _destinationObject) { - EWOL_ERROR("Input ERROR NULL pointer EObject ..."); + EWOL_ERROR("Input ERROR NULL pointer Object ..."); return; } // check if event existed : @@ -202,7 +202,7 @@ void ewol::EObject::unRegisterOnEvent(ewol::EObject * _destinationObject, if (m_externEvent[iii] == NULL) { continue; } - if (m_externEvent[iii]->destEObject != _destinationObject) { + if (m_externEvent[iii]->destObject != _destinationObject) { continue; } if (_eventId == NULL) { @@ -213,18 +213,18 @@ void ewol::EObject::unRegisterOnEvent(ewol::EObject * _destinationObject, } } -void ewol::EObject::onObjectRemove(ewol::EObject * _removeObject) { +void ewol::Object::onObjectRemove(ewol::Object * _removObject) { for(int32_t iii=m_externEvent.size()-1; iii >= 0; iii--) { if (NULL == m_externEvent[iii]) { m_externEvent.erase(m_externEvent.begin()+iii); - } else if (m_externEvent[iii]->destEObject == _removeObject) { + } else if (m_externEvent[iii]->destObject == _removObject) { m_externEvent.erase(m_externEvent.begin()+iii); } } } -void ewol::EObject::registerConfig(const char* _config, +void ewol::Object::registerConfig(const char* _config, const char* _type, const char* _control, const char* _description, @@ -244,7 +244,7 @@ void ewol::EObject::registerConfig(const char* _config, } -bool ewol::EObject::loadXML(exml::Element* _node) { +bool ewol::Object::loadXML(exml::Element* _node) { if (NULL == _node) { return false; } @@ -265,7 +265,7 @@ bool ewol::EObject::loadXML(exml::Element* _node) { return errorOccured; } -bool ewol::EObject::storeXML(exml::Element* _node) const { +bool ewol::Object::storeXML(exml::Element* _node) const { if (NULL == _node) { return false; } @@ -288,9 +288,9 @@ bool ewol::EObject::storeXML(exml::Element* _node) const { } -bool ewol::EObject::onSetConfig(const ewol::EConfig& _conf) { +bool ewol::Object::onSetConfig(const ewol::EConfig& _conf) { EWOL_VERBOSE("[" << getId() << "] {" << getObjectType() << "} set config : " << _conf); - if (_conf.getConfig() == ewol::EObject::configName) { + if (_conf.getConfig() == ewol::Object::configName) { EWOL_VERBOSE("[" << getId() << "] {" << getObjectType() << "} set config name : \"" << _conf.getData() << "\""); setName(_conf.getData()); return true; @@ -298,15 +298,15 @@ bool ewol::EObject::onSetConfig(const ewol::EConfig& _conf) { return false; } -bool ewol::EObject::onGetConfig(const char* _config, std::string& _result) const { - if (_config == ewol::EObject::configName) { +bool ewol::Object::onGetConfig(const char* _config, std::string& _result) const { + if (_config == ewol::Object::configName) { _result = getName(); return true; } return false; } -bool ewol::EObject::setConfig(const std::string& _config, const std::string& _value) { +bool ewol::Object::setConfig(const std::string& _config, const std::string& _value) { for(size_t iii=0 ; iiisetConfig(_conf); } -bool ewol::EObject::setConfigNamed(const std::string& _objectName, const std::string& _config, const std::string& _value) { - ewol::EObject* object = getEObjectManager().get(_objectName); +bool ewol::Object::setConfigNamed(const std::string& _objectName, const std::string& _config, const std::string& _value) { + ewol::Object* object = getObjectManager().get(_objectName); if (object == NULL) { return false; } return object->setConfig(_config, _value); } -ewol::EObjectManager& ewol::EObject::getEObjectManager(void) { - return ewol::getContext().getEObjectManager(); +ewol::ObjectManager& ewol::Object::getObjectManager(void) { + return ewol::getContext().getObjectManager(); } -ewol::EMultiCast& ewol::EObject::getMultiCast(void) { - return ewol::getContext().getEObjectManager().multiCast(); +ewol::EMultiCast& ewol::Object::getMultiCast(void) { + return ewol::getContext().getObjectManager().multiCast(); } -ewol::eContext& ewol::EObject::getContext(void) { +ewol::eContext& ewol::Object::getContext(void) { return ewol::getContext(); } diff --git a/sources/ewol/renderer/EObject.h b/sources/ewol/object/Object.h similarity index 71% rename from sources/ewol/renderer/EObject.h rename to sources/ewol/object/Object.h index 58a8e3e9..9a530afe 100644 --- a/sources/ewol/renderer/EObject.h +++ b/sources/ewol/object/Object.h @@ -6,8 +6,8 @@ * @license BSD v3 (see license file) */ -#ifndef __EWOL_E_OBJECT_H__ -#define __EWOL_E_OBJECT_H__ +#ifndef __EWOL_OBJECT_H__ +#define __EWOL_OBJECT_H__ #include #include @@ -16,31 +16,39 @@ #include namespace ewol { // some class need to define element befor other ... - class EObject; - class EObjectManager; - class EMultiCast; - class eContext; + class Object; + namespace object { + class Manager; + }; + namespace context { + class MultiCast; + }; + class Context; }; -#include -#include +#include +#include +#include namespace ewol { - /** - * local class for event generation - */ - class EventExtGen { - public: - const char* localEventId; //!< local event Id generation - ewol::EObject* destEObject; //!< destination widget that might be call - const char* destEventId; //!< generated event ID on the distant widget - std::string overloadData; //!< sometimes the user prefer to receive some specific data on an event (instead of the one sed by the widget) - }; + namespace object { + /** + * local class for event generation + * @not-in-doc + */ + class EventExtGen { + public: + const char* localEventId; //!< local event Id generation + ewol::Object* destObject; //!< destination widget that might be call + const char* destEventId; //!< generated event ID on the distant widget + std::string overloadData; //!< sometimes the user prefer to receive some specific data on an event (instead of the one sed by the widget) + }; + } /** * @brief Basic message classes for ewol system - * this class mermit at every EObject to communicate between them. + * this class mermit at every Object to communicate between them. */ - class EObject { + class Object { private: static size_t m_valUID; //!< stic used for the unique ID definition public: @@ -50,16 +58,16 @@ namespace ewol { /** * @brief Constructor. */ - EObject(void); + Object(void); /** * @brief Constructor. - * @param[in] _name Name of the EObject. + * @param[in] _name Name of the Object. */ - EObject(const std::string& _name); + Object(const std::string& _name); /** * @brief Destructor */ - virtual ~EObject(void); + virtual ~Object(void); protected: /** * @brief Auto-destroy the object @@ -74,12 +82,12 @@ namespace ewol { std::vector m_listType; public: /** - * @brief get the current Object type of the EObject + * @brief get the current Object type of the Object * @return the last type name of the element */ const char * const getObjectType(void); /** - * @brief Get the herarchie of the EObject type. + * @brief Get the herarchie of the Object type. * @return descriptive string. */ std::string getTypeDescription(void); @@ -91,7 +99,7 @@ namespace ewol { bool isTypeCompatible(const std::string& _type); protected: /** - * @brief Add a type of the list of eObject. + * @brief Add a type of the list of Object. * @param[in] _type new type to add. */ void addObjectType(const char* _type); @@ -99,7 +107,7 @@ namespace ewol { bool m_static; //!< set this variable at true if this element must not be auto destroy (exemple : use static object) public: /** - * @brief get the static status of the EObject == > mark at true if the user set the object mark as static allocated element ==> not auto remove element + * @brief get the static status of the Object == > mark at true if the user set the object mark as static allocated element ==> not auto remove element * @return true if it might not be removed == > usefull for conficuration class */ bool getStatic(void){ @@ -109,29 +117,29 @@ namespace ewol { int32_t m_uniqueId; //!< Object UniqueID == > TODO : Check if it use is needed public: /** - * @brief get the UniqueId of the EObject + * @brief get the UniqueId of the Object * @return the requested ID */ int32_t getId(void){ return m_uniqueId; }; private: - std::vector m_externEvent; //!< Generic list of event generation for output link + std::vector m_externEvent; //!< Generic list of event generation for output link std::vector m_availlableEventId; //!< List of all event availlable for this widget protected: /** - * @brief add a specific event Id in the list to prevent wrong link on a EObject + * @brief add a specific event Id in the list to prevent wrong link on a Object * @param[in] _generateEventId event Id to add */ void addEventId(const char * _generateEventId); /** - * @brief generate event on all registered EObject + * @brief generate event on all registered Object * @param[in] _generateEventId event Id that is curetly generated * @param[in] _data data associated with the event */ void generateEventId(const char * _generateEventId, const std::string& _data = ""); /** - * @brief generate Multicast event on all EObject requested the event + * @brief generate Multicast event on all Object requested the event * @param[in] _messageId Event Id that is generated * @param[in] _data String that is send at all the destinations */ @@ -143,41 +151,41 @@ namespace ewol { void registerMultiCast(const char* const _messageId); public: /** - * @brief Register an EObject over an other to get event on the second... + * @brief Register an Object over an other to get event on the second... * @param[in] _destinationObject pointer on the object that might be call when an event is generated * @param[in] _eventId Event generate inside the object - * @param[in] _eventIdgenerated event generated when call the distant EObject.onReceiveMessage(...) + * @param[in] _eventIdgenerated event generated when call the distant Object.onReceiveMessage(...) * @param[in] _overloadData When the user prever to receive a data specificly for this event ... */ - void registerOnEvent(ewol::EObject * _destinationObject, + void registerOnEvent(ewol::Object * _destinationObject, const char * _eventId, const char * _eventIdgenerated = NULL, const std::string& _overloadData = ""); /** - * @brief Un-Register an EObject over an other. + * @brief Un-Register an Object over an other. * @param[in] _destinationObject pointer on the object that might be call when an event is generated * @param[in] _eventId Event generate inside the object (NULL to remove all event on this object) */ - void unRegisterOnEvent(ewol::EObject * _destinationObject, + void unRegisterOnEvent(ewol::Object * _destinationObject, const char * _eventId = NULL); /** * @brief Inform object that an other object is removed ... - * @param[in] _removeObject Pointer on the EObject remeved == > the user must remove all reference on this EObject + * @param[in] _removObject Pointer on the Object remeved == > the user must remove all reference on this Object * @note : Sub classes must call this class */ - virtual void onObjectRemove(ewol::EObject * _removeObject); + virtual void onObjectRemove(ewol::Object * _removeObject); /** - * @brief Receive a message from an other EObject with a specific eventId and data + * @brief Receive a message from an other Object with a specific eventId and data * @param[in] _msg Message handle */ - virtual void onReceiveMessage(const ewol::EMessage& _msg) { + virtual void onReceiveMessage(const ewol::object::Message& _msg) { }; private: - std::vector m_listConfig; + std::vector m_listConfig; protected: /** - * @brief the EObject add a configuration capabilities + * @brief the Object add a configuration capabilities * @param[in] _config Configuration name. * @param[in] _type Type of the config. * @param[in] _control control of the current type. @@ -190,13 +198,13 @@ namespace ewol { const char* _description = NULL, const char* _default = NULL); /** - * @brief Configuration requested to the curent EObject + * @brief Configuration requested to the curent Object * @param[in] _conf Configuration handle. * @return true if the parametere has been used */ - virtual bool onSetConfig(const ewol::EConfig& _conf); + virtual bool onSetConfig(const ewol::object::Config& _conf); /** - * @brief Receive a configuration message from an other element system or from the curent EObject + * @brief Receive a configuration message from an other element system or from the curent Object * @param[in] _config Configuration name. * @param[out] _result Result of the request. * @return true if the config is set @@ -207,23 +215,23 @@ namespace ewol { * @brief get all the configuration list * @return The list of all parameter availlable in the widget */ - virtual const std::vector& getConfigList(void) { + virtual const std::vector& getConfigList(void) { return m_listConfig; }; /** - * @brief Configuration requested to the curent EObject (systrem mode) + * @brief Configuration requested to the curent Object (systrem mode) * @param[in] _conf Configuration handle. * @return true if config set correctly... */ - bool setConfig(const ewol::EConfig& _conf) { + bool setConfig(const ewol::object::Config& _conf) { return onSetConfig(_conf); }; bool setConfig(const std::string& _config, const std::string& _value); // need a search ... // TODO : Distingish global search and sub search ... bool setConfigNamed(const std::string& _objectName, const std::string& _config, const std::string& _value); // need a search ... - bool setConfigNamed(const std::string& _objectName, const ewol::EConfig& _conf); + bool setConfigNamed(const std::string& _objectName, const ewol::object::Config& _conf); /** - * @brief Configuration get from the curent EObject (systrem mode) + * @brief Configuration get from the curent Object (systrem mode) * @param[in] _config Configuration name. * @return the config properties */ @@ -233,7 +241,7 @@ namespace ewol { std::string m_name; //!< name of the element ... public: /** - * @brief get the eObject name + * @brief get the Object name * @return The requested name */ const std::string& getName(void) const { @@ -263,20 +271,20 @@ namespace ewol { virtual bool storeXML(exml::Element* _node) const; public: /** - * @breif get the current EObject manager. + * @breif get the current Object manager. * @return the requested object manager. */ - ewol::EObjectManager& getEObjectManager(void); + ewol::object::Manager& getObjectManager(void); /** - * @breif get the current EObject Message Multicast manager. + * @breif get the current Object Message Multicast manager. * @return the requested object manager. */ - ewol::EMultiCast& getMultiCast(void); + ewol::context::MultiCast& getMultiCast(void); /** * @brief get the curent the system inteface. * @return current reference on the instance. */ - eContext& getContext(void); + ewol::Context& getContext(void); private: bool m_isResource; //!< enable this when you want to declare this element is auto-remove public: diff --git a/sources/ewol/renderer/openGL.cpp b/sources/ewol/openGL/openGL.cpp similarity index 100% rename from sources/ewol/renderer/openGL.cpp rename to sources/ewol/openGL/openGL.cpp diff --git a/sources/ewol/renderer/openGL.h b/sources/ewol/openGL/openGL.h similarity index 100% rename from sources/ewol/renderer/openGL.h rename to sources/ewol/openGL/openGL.h diff --git a/sources/ewol/physicsShape/PhysicsBox.cpp b/sources/ewol/physicsShape/PhysicsBox.cpp deleted file mode 100644 index 8fa66417..00000000 --- a/sources/ewol/physicsShape/PhysicsBox.cpp +++ /dev/null @@ -1,23 +0,0 @@ -/** - * @author Edouard DUPIN - * - * @copyright 2011, Edouard DUPIN, all right reserved - * - * @license BSD v3 (see license file) - */ -#include -#include - - - -bool ewol::PhysicsBox::parse(const char* _line) { - if (true == ewol::PhysicsShape::parse(_line)) { - return true; - } - if(0 == strncmp(_line, "half-extents : ", 15) ) { - sscanf(&_line[15], "%f %f %f", &m_size.m_floats[0], &m_size.m_floats[1], &m_size.m_floats[2] ); - EWOL_VERBOSE(" halfSize=" << m_size); - return true; - } - return false; -} diff --git a/sources/ewol/physicsShape/PhysicsBox.h b/sources/ewol/physicsShape/PhysicsBox.h deleted file mode 100644 index 172f6c7e..00000000 --- a/sources/ewol/physicsShape/PhysicsBox.h +++ /dev/null @@ -1,44 +0,0 @@ -/** - * @author Edouard DUPIN - * - * @copyright 2011, Edouard DUPIN, all right reserved - * - * @license BSD v3 (see license file) - */ - -#ifndef __EWOL_PHYSICS_BOX_H__ -#define __EWOL_PHYSICS_BOX_H__ - - -#include -#include - -namespace ewol { - class PhysicsBox : public ewol::PhysicsShape { - public: - PhysicsBox(void) {}; - virtual ~PhysicsBox(void) {}; - public: - virtual bool parse(const char* _line); - virtual void display(void) {}; - public: - virtual enum type getType(void) { - return ewol::PhysicsShape::box; - }; - private: - vec3 m_size; // Box size property in X, Y and Z - public: - const vec3& getSize(void) const { - return m_size; - }; - public: - virtual const PhysicsBox* toBox(void) const { - return this; - }; - virtual PhysicsBox* toBox(void) { - return this; - }; - }; -}; - -#endif diff --git a/sources/ewol/physicsShape/PhysicsCapsule.cpp b/sources/ewol/physicsShape/PhysicsCapsule.cpp deleted file mode 100644 index 1f6aecb6..00000000 --- a/sources/ewol/physicsShape/PhysicsCapsule.cpp +++ /dev/null @@ -1,28 +0,0 @@ -/** - * @author Edouard DUPIN - * - * @copyright 2011, Edouard DUPIN, all right reserved - * - * @license BSD v3 (see license file) - */ -#include -#include - - - -bool ewol::PhysicsCapsule::parse(const char* _line) { - if (true == ewol::PhysicsShape::parse(_line)) { - return true; - } - if(0 == strncmp(_line, "radius : ", 9) ) { - sscanf(&_line[9], "%f", &m_radius ); - EWOL_VERBOSE(" radius=" << m_radius); - return true; - } - if(0 == strncmp(_line, "height : ", 9) ) { - sscanf(&_line[9], "%f", &m_height ); - EWOL_VERBOSE(" height=" << m_height); - return true; - } - return false; -} diff --git a/sources/ewol/physicsShape/PhysicsCapsule.h b/sources/ewol/physicsShape/PhysicsCapsule.h deleted file mode 100644 index 6e53974d..00000000 --- a/sources/ewol/physicsShape/PhysicsCapsule.h +++ /dev/null @@ -1,52 +0,0 @@ -/** - * @author Edouard DUPIN - * - * @copyright 2011, Edouard DUPIN, all right reserved - * - * @license BSD v3 (see license file) - */ - -#ifndef __EWOL_PHYSICS_CAPSULE_H__ -#define __EWOL_PHYSICS_CAPSULE_H__ - - -#include -#include - - -namespace ewol { - class PhysicsCapsule : public ewol::PhysicsShape { - public: - PhysicsCapsule(void) {}; - virtual ~PhysicsCapsule(void) {}; - public: - virtual bool parse(const char* _line); - virtual void display(void) {}; - public: - virtual enum type getType(void) { - return ewol::PhysicsShape::capsule; - }; - private: - float m_radius; - public: - float getRadius(void) const { - return m_radius; - }; - private: - float m_height; - public: - float getHeight(void) const { - return m_height; - }; - public: - virtual const PhysicsCapsule* toCapsule(void) const { - return this; - }; - virtual PhysicsCapsule* toCapsule(void) { - return this; - }; - }; -}; - - -#endif diff --git a/sources/ewol/physicsShape/PhysicsCone.cpp b/sources/ewol/physicsShape/PhysicsCone.cpp deleted file mode 100644 index 2b1f5e7a..00000000 --- a/sources/ewol/physicsShape/PhysicsCone.cpp +++ /dev/null @@ -1,28 +0,0 @@ -/** - * @author Edouard DUPIN - * - * @copyright 2011, Edouard DUPIN, all right reserved - * - * @license BSD v3 (see license file) - */ -#include -#include - - - -bool ewol::PhysicsCone::parse(const char* _line) { - if (true == ewol::PhysicsShape::parse(_line)) { - return true; - } - if(0 == strncmp(_line, "radius : ", 9) ) { - sscanf(&_line[9], "%f", &m_radius ); - EWOL_VERBOSE(" radius=" << m_radius); - return true; - } - if(0 == strncmp(_line, "height : ", 9) ) { - sscanf(&_line[9], "%f", &m_height ); - EWOL_VERBOSE(" height=" << m_height); - return true; - } - return false; -} diff --git a/sources/ewol/physicsShape/PhysicsCone.h b/sources/ewol/physicsShape/PhysicsCone.h deleted file mode 100644 index 9d5234de..00000000 --- a/sources/ewol/physicsShape/PhysicsCone.h +++ /dev/null @@ -1,52 +0,0 @@ -/** - * @author Edouard DUPIN - * - * @copyright 2011, Edouard DUPIN, all right reserved - * - * @license BSD v3 (see license file) - */ - -#ifndef __EWOL_PHYSICS_CONE_H__ -#define __EWOL_PHYSICS_CONE_H__ - - -#include -#include - - -namespace ewol { - class PhysicsCone : public ewol::PhysicsShape { - public: - PhysicsCone(void) {}; - virtual ~PhysicsCone(void) {}; - public: - virtual bool parse(const char* _line); - virtual void display(void) {}; - public: - virtual enum type getType(void) { - return ewol::PhysicsShape::cone; - }; - private: - float m_radius; - public: - float getRadius(void) const { - return m_radius; - }; - private: - float m_height; - public: - float getHeight(void) const { - return m_height; - }; - public: - virtual const PhysicsCone* toCone(void) const { - return this; - }; - virtual PhysicsCone* toCone(void) { - return this; - }; - }; -}; - - -#endif diff --git a/sources/ewol/physicsShape/PhysicsConvexHull.cpp b/sources/ewol/physicsShape/PhysicsConvexHull.cpp deleted file mode 100644 index 78fb5e47..00000000 --- a/sources/ewol/physicsShape/PhysicsConvexHull.cpp +++ /dev/null @@ -1,44 +0,0 @@ -/** - * @author Edouard DUPIN - * - * @copyright 2011, Edouard DUPIN, all right reserved - * - * @license BSD v3 (see license file) - */ -#include -#include - - - -bool ewol::PhysicsConvexHull::parse(const char* _line) { - if (true == ewol::PhysicsShape::parse(_line)) { - return true; - } - if(0 == strncmp(_line, "points : ", 8) ) { - //EWOL_DEBUG("convex hull point parsing " << _line); - char* base = (char*)(&_line[8]); - char* tmp= strchr(base, '|'); - vec3 pos(0,0,0); - while (tmp != NULL) { - *tmp = '\0'; - sscanf(base, "%f %f %f", &pos.m_floats[0], &pos.m_floats[1], &pos.m_floats[2] ); - m_points.push_back(pos); - base = tmp+1; - tmp= strchr(base, '|'); - } - sscanf(base, "%f %f %f", &pos.m_floats[0], &pos.m_floats[1], &pos.m_floats[2] ); - m_points.push_back(pos); - /* - for (int32_t iii=0; iii -#include - -namespace ewol -{ - class ConfigFont - { - public: - /** - * Constructor / destructor - */ - ConfigFont(void); - ~ConfigFont(void); - private: - std::string m_folder; - public: - /** - * @brief Specify the default font folder for the Ewol search system (only needed when embended font) - * @param[in] _folder basic folder of the font (ex: DATA:fonts) - */ - void setFolder(const std::string& _folder) { - m_folder = _folder; - }; - /** - * @brief get the default font folder. - * @return The default font folder. - */ - const std::string& getFolder(void) { - return m_folder; - }; - private: - std::string m_name; - int32_t m_size; - public: - /** - * @brief set the defaut font for all the widgets and basics display. - * @param[in] _fontName The font name requested (not case sensitive) ex "Arial" or multiple separate by ';' ex : "Arial;Helvetica". - * @param[in] _size The default size of the font default=10. - */ - void set(const std::string& _fontName, int32_t _size); - /** - * @brief get the current default font name - * @raturn a reference on the font name string - */ - const std::string& getName(void) { - return m_name; - }; - /** - * @brief get the default font size. - * @return the font size. - */ - int32_t getSize(void) { - return m_size; - }; - private: - bool m_useExternal; - public: - /** - * @brief set use of internal/external Font - * @param[in] _val true to enable search of internal data. - */ - void setUseExternal(bool _val) { - m_useExternal=_val; - }; - /** - * @brief get the use of internal/external Font - * @return true to enable search of internal data. - */ - bool getUseExternal(void) { - return m_useExternal; - }; - }; -}; - -#endif - diff --git a/sources/ewol/renderer/EConfig.h b/sources/ewol/renderer/EConfig.h deleted file mode 100644 index 244aace9..00000000 --- a/sources/ewol/renderer/EConfig.h +++ /dev/null @@ -1,64 +0,0 @@ -/** - * @author Edouard DUPIN - * - * @copyright 2011, Edouard DUPIN, all right reserved - * - * @license BSD v3 (see license file) - */ - -#ifndef __EWOL_E_CONFIG_H__ -#define __EWOL_E_CONFIG_H__ - -#include -#include - -namespace ewol { - class EConfig { - private: - const char* m_config; //!< config properties. - std::string m_data; //!< compositing additionnal message Value. - public: - EConfig(const char* _config, - const std::string& _data) : - m_config(_config), - m_data(_data) - { }; - void setConfig(const char* _config) { m_config = _config; }; - inline const char* getConfig(void) const { return m_config; }; - void setData(const std::string& _data) { m_data = _data; }; - inline const std::string& getData(void) const { return m_data; }; - }; - etk::CCout& operator <<(etk::CCout& _os, const ewol::EConfig& _obj); - - class EConfigElement { - private: - const char* m_config; //!< config properties (used for XML properties == > only : "[0-9a-zA-Z\-]" ==> this is a regExp control. - const char* m_type; //!< type of the config[integer,float,string,reg-exp,list]. - const char* m_control; //!< control the type of the type set ( integer:[0..256], regExp: "[0-9a-zA-Z]", list:[plop,plop2,plop3] ) - const char* m_description; //!< description to help user to configure it. - const char* m_default; //!< default value ... - public: - // note : no parameter capability is needed to create element in case of vector stoarage. - EConfigElement(const char* _config=NULL, - const char* _type=NULL, - const char* _control=NULL, - const char* _description=NULL, - const char* _default=NULL) : - m_config(_config), - m_type(_type), - m_control(_control), - m_description(_description), - m_default(_default) - { }; - inline const char* getConfig(void) const { return m_config; }; - inline const char* getType(void) const { return m_type; }; - inline const char* getControl(void) const { return m_control; }; - inline const char* getDescription(void) const { return m_description; }; - inline const char* getDefault(void) const { return m_default; }; - }; - etk::CCout& operator <<(etk::CCout& _os, const ewol::EConfigElement& _obj); -}; - - -#endif - diff --git a/sources/ewol/renderer/EMessage.h b/sources/ewol/renderer/EMessage.h deleted file mode 100644 index 75184be0..00000000 --- a/sources/ewol/renderer/EMessage.h +++ /dev/null @@ -1,41 +0,0 @@ -/** - * @author Edouard DUPIN - * - * @copyright 2011, Edouard DUPIN, all right reserved - * - * @license BSD v3 (see license file) - */ - -#ifndef __EWOL_E_MESSAGE_H__ -#define __EWOL_E_MESSAGE_H__ - -#include -#include - -namespace ewol { - class EMessage { - private: - ewol::EObject* m_callerObject; //!< Caller class. - const char* m_event; //!< Event pointer == > unique Id define by the system ... - std::string m_data; //!< compositing additionnal message Value. - public: - EMessage(ewol::EObject* _caller, - const char* _message, - const std::string& _data) : - m_callerObject(_caller), - m_event(_message), - m_data(_data) - { }; - void setCaller(ewol::EObject* _caller) { m_callerObject = _caller; }; - inline ewol::EObject* getCaller(void) const { return m_callerObject; }; - void setMessage(const char* _message) { m_event = _message; }; - inline const char* getMessage(void) const { return m_event; }; - void setData(const std::string& _data) { m_data = _data; }; - inline const std::string& getData(void) const { return m_data; }; - }; - etk::CCout& operator <<(etk::CCout& _os, const ewol::EMessage& _obj); -}; - - -#endif - diff --git a/sources/ewol/renderer/EMultiCast.h b/sources/ewol/renderer/EMultiCast.h deleted file mode 100644 index c0e451e4..00000000 --- a/sources/ewol/renderer/EMultiCast.h +++ /dev/null @@ -1,44 +0,0 @@ -/** - * @author Edouard DUPIN - * - * @copyright 2011, Edouard DUPIN, all right reserved - * - * @license BSD v3 (see license file) - */ - -#ifndef __EWOL_E_MULTICAST_H__ -#define __EWOL_E_MULTICAST_H__ - -#include -#include -#include -#include - -#include - -namespace ewol { - class EMultiCast { - private: - class MessageList { - public: - MessageList(const char* _message=NULL, ewol::EObject* _object=NULL) : - m_message(_message), m_object(_object) { - - } - const char* m_message; - ewol::EObject* m_object; - }; - std::vector m_messageList; //!< List of all message ... - public: - EMultiCast(); - ~EMultiCast(void); - void anonymousSend(const char* const _messageId, const std::string& _data) { - send(NULL, _messageId, _data); - }; - void send(ewol::EObject* _object, const char* const _message, const std::string& _data); - void rm(ewol::EObject* _object); - void add(ewol::EObject* _object, const char* const _message); - }; -}; - -#endif \ No newline at end of file diff --git a/sources/ewol/renderer/EObjectManager.h b/sources/ewol/renderer/EObjectManager.h deleted file mode 100644 index 9ca8a9e3..00000000 --- a/sources/ewol/renderer/EObjectManager.h +++ /dev/null @@ -1,49 +0,0 @@ -/** - * @author Edouard DUPIN - * - * @copyright 2011, Edouard DUPIN, all right reserved - * - * @license BSD v3 (see license file) - */ - -#ifndef __EWOL_E_OBJECT_MANAGER_H__ -#define __EWOL_E_OBJECT_MANAGER_H__ - -#include -#include -#include - -namespace ewol { - class EObjectManager { - private: - std::vector m_eObjectList; // all widget allocated == > all time increment ... never removed ... - std::vector m_eObjectAutoRemoveList; // all widget allocated - public: - EObjectManager(void); - ~EObjectManager(void); - /** - * @brief remove all resources (un-init) out of the destructor (due to the system implementation) - */ - void unInit(void); - - void add(ewol::EObject* _object); - void rm(ewol::EObject* _object); - int32_t getNumberObject(void); - - void autoRemove(ewol::EObject* _object); - void removeAllAutoRemove(void); - - ewol::EObject* get(const std::string& _name); - private: - void informOneObjectIsRemoved(ewol::EObject* _object); - private: - ewol::EMultiCast m_multiCast; //!< muticast manager - public: - ewol::EMultiCast& multiCast(void) { - return m_multiCast; - }; - }; -}; - -#endif - diff --git a/sources/ewol/renderer/EventEntry.h b/sources/ewol/renderer/EventEntry.h deleted file mode 100644 index 8999fc1a..00000000 --- a/sources/ewol/renderer/EventEntry.h +++ /dev/null @@ -1,73 +0,0 @@ -/** - * @author Edouard DUPIN - * - * @copyright 2011, Edouard DUPIN, all right reserved - * - * @license BSD v3 (see license file) - */ - -#ifndef __EWOL_EVENT_ENTRY_H__ -#define __EWOL_EVENT_ENTRY_H__ - -#include -#include - -namespace ewol { - class EventEntry { - private: - enum ewol::keyEvent::keyboard m_type; //!< type of hardware event - enum ewol::keyEvent::status m_status; //!< status of hardware event - ewol::SpecialKey m_specialKey; //!< input key status (prevent change in time..) - char32_t m_unicodeData; //!< Unicode data (in some case) - public: - EventEntry(enum ewol::keyEvent::keyboard _type, - enum ewol::keyEvent::status _status, - ewol::SpecialKey _specialKey, - char32_t _char) : - m_type(_type), - m_status(_status), - m_specialKey(_specialKey), - m_unicodeData(_char) - { }; - void setType(enum ewol::keyEvent::keyboard _type) { - m_type = _type; - }; - inline const enum ewol::keyEvent::keyboard& getType(void) const { - return m_type; - }; - void setStatus(enum ewol::keyEvent::status _status) { - m_status = _status; - }; - inline const enum ewol::keyEvent::status& getStatus(void) const { - return m_status; - }; - void setSpecialKey(const ewol::SpecialKey& _specialKey) { - m_specialKey = _specialKey; - }; - inline const ewol::SpecialKey& getSpecialKey(void) const { - return m_specialKey; - }; - void setChar(char32_t _char) { - m_unicodeData = _char; - }; - inline const char32_t& getChar(void) const { - return m_unicodeData; - }; - }; - etk::CCout& operator <<(etk::CCout& _os, const ewol::EventEntry& _obj); - - class EventEntrySystem { - public: - EventEntrySystem(enum ewol::keyEvent::keyboard _type, - enum ewol::keyEvent::status _status, - ewol::SpecialKey _specialKey, - char32_t _char) : - m_event(_type, _status, _specialKey, _char) - { }; - ewol::EventEntry m_event; - }; - etk::CCout& operator <<(etk::CCout& _os, const ewol::EventEntrySystem& _obj); -}; - -#endif - diff --git a/sources/ewol/renderer/EventInput.h b/sources/ewol/renderer/EventInput.h deleted file mode 100644 index 09a1eb2e..00000000 --- a/sources/ewol/renderer/EventInput.h +++ /dev/null @@ -1,105 +0,0 @@ -/** - * @author Edouard DUPIN - * - * @copyright 2011, Edouard DUPIN, all right reserved - * - * @license BSD v3 (see license file) - */ - -#ifndef __EWOL_EVENT_INPUT_H__ -#define __EWOL_EVENT_INPUT_H__ - -#include - -namespace ewol { - class EventInput { - private: - enum ewol::keyEvent::type m_type; - enum ewol::keyEvent::status m_status; - uint8_t m_inputId; - vec2 m_pos; - public: - EventInput(enum ewol::keyEvent::type _type, - enum ewol::keyEvent::status _status, - uint8_t _id, - const vec2& _pos): - m_type(_type), - m_status(_status), - m_inputId(_id), - m_pos(_pos) - { }; - void setType(enum ewol::keyEvent::type _type) { - m_type = _type; - }; - inline const enum ewol::keyEvent::type& getType(void) const { - return m_type; - }; - void setStatus(enum ewol::keyEvent::status _status) { - m_status = _status; - }; - inline const enum ewol::keyEvent::status& getStatus(void) const { - return m_status; - }; - void setId(uint8_t _id) { - m_inputId = _id; - }; - inline const uint8_t& getId(void) const { - return m_inputId; - }; - void setPos(const vec2& _pos) { - m_pos = _pos; - }; - inline const vec2& getPos(void) const { - return m_pos; - }; - }; - etk::CCout& operator <<(etk::CCout& _os, const ewol::EventInput& _obj); - - class EventInputSystem { - public: - EventInputSystem(enum ewol::keyEvent::type _type, - enum ewol::keyEvent::status _status, - uint8_t _id, - const vec2& _pos, - ewol::Widget* _dest, - int32_t _realIdEvent) : - m_event(_type, _status, _id, _pos), - m_dest(_dest), - m_realIdEvent(_realIdEvent) - { }; - ewol::EventInput m_event; - private: - ewol::Widget* m_dest; - int32_t m_realIdEvent; - public: - void setDestWidget(ewol::Widget* _dest) { - m_dest = _dest; - }; - inline ewol::Widget* getDestWidget(void) const { - return m_dest; - }; - void setRealId(int32_t _realIdEvent) { - m_realIdEvent = _realIdEvent; - }; - inline int32_t getRealId(void) const { - return m_realIdEvent; - }; - /* - private: - int64_t m_lastTime; - uint8_t m_systemId; - uint8_t m_id; - uint8_t m_numberClick; - bool m_isUsed; - bool m_isDown; - bool m_isInside; - ewol::Widget* m_widget; - vec2 m_downStart; - vec2 m_pos; - */ - }; - etk::CCout& operator <<(etk::CCout& _os, const ewol::EventInputSystem& _obj); -}; - -#endif - diff --git a/sources/ewol/renderer/EventTime.h b/sources/ewol/renderer/EventTime.h deleted file mode 100644 index 55e6c504..00000000 --- a/sources/ewol/renderer/EventTime.h +++ /dev/null @@ -1,64 +0,0 @@ -/** - * @author Edouard DUPIN - * - * @copyright 2011, Edouard DUPIN, all right reserved - * - * @license BSD v3 (see license file) - */ - -#ifndef __EWOL_EVENT_CALL_TIME_H__ -#define __EWOL_EVENT_CALL_TIME_H__ - -#include - -namespace ewol { - class EventTime { - private: - int64_t m_timeSystem; //!< Current system time (micro-second) - int64_t m_timeUpAppl; //!< Current application wake up-time (micro-second) - float m_timeDelta; //!< Time from the last cycle call of the system (main appl tick) (second) - float m_timeDeltaCall; //!< Time from the last call (when we can manage periodic call with specifying periode) (second) - public: - EventTime(int64_t _timeSystem, - int64_t _timeUpAppl, - float _timeDelta, - float _timeDeltaCall) : - m_timeSystem(_timeSystem), - m_timeUpAppl(_timeUpAppl), - m_timeDelta(_timeDelta), - m_timeDeltaCall(_timeDeltaCall) - { }; - public: - void setTime(int64_t _timeSystem) { - m_timeSystem=_timeSystem; - }; - inline int64_t getTime(void) const { - return m_timeSystem; - }; - void setApplWakeUpTime(int64_t _timeUpAppl) { - m_timeUpAppl=_timeUpAppl; - }; - inline int64_t getApplWakeUpTime(void) const { - return m_timeUpAppl; - }; - inline int64_t getApplUpTime(void) const { - return m_timeSystem-m_timeUpAppl; - }; - void setDelta(float _timeDelta) { - m_timeDelta=_timeDelta; - }; - inline float getDelta(void) const { - return m_timeDelta; - }; - void setDeltaCall(float _timeDeltaCall) { - m_timeDeltaCall=_timeDeltaCall; - }; - inline float getDeltaCall(void) const { - return m_timeDeltaCall; - }; - }; - etk::CCout& operator <<(etk::CCout& _os, const ewol::EventTime& _obj); -}; - -#endif - diff --git a/sources/ewol/renderer/Fps.h b/sources/ewol/renderer/Fps.h deleted file mode 100644 index 7461e3ff..00000000 --- a/sources/ewol/renderer/Fps.h +++ /dev/null @@ -1,138 +0,0 @@ -/** - * @author Edouard DUPIN - * - * @copyright 2011, Edouard DUPIN, all right reserved - * - * @license BSD v3 (see license file) - */ - -#ifndef __EWOL_FPS_H__ -#define __EWOL_FPS_H__ - -namespace ewol { - /** - * @brief This class is designed to count the number of frame per second in the main renderer system - */ - class Fps { - // display every second ... - #define DISPLAY_PERIODE_US (1000000) - private: - int64_t startTime; - int64_t nbCallTime; - int64_t nbDisplayTime; - int64_t min; - int64_t avg; - int64_t max; - int64_t min_idle; - int64_t avg_idle; - int64_t max_idle; - int64_t ticTime; - bool display; - bool drwingDone; - const char * m_displayName; - bool m_displayFPS; - public: - /** - * @brief Constructor - */ - Fps(const char * displayName, bool displayFPS) { - startTime = -1; - nbCallTime = 0; - nbDisplayTime = 0; - min = 99999999999999LL; - avg = 0; - max = 0; - min_idle = 99999999999999LL; - avg_idle = 0; - max_idle = 0; - ticTime = 0; - display = false; - drwingDone = false; - m_displayName = displayName; - m_displayFPS = displayFPS; - } - /** - * @brief Destructor - */ - ~Fps(void) { - - } - /** - * @brief this might be call every time a diplay start - */ - void tic(void) { - int64_t currentTime = ewol::getTime(); - ticTime = currentTime; - nbCallTime++; - if (startTime<0) { - startTime = currentTime; - } - //EWOL_DEBUG("current : " << currentTime << "time diff : " << (currentTime - startTime)); - if ( (currentTime - startTime) > DISPLAY_PERIODE_US) { - display = true; - } - } - /** - * @brief this might be call every time a diplay stop, it do the display every second - * @param[in] displayTime display curent time of the frame. - */ - void toc(bool displayTime = false) { - int64_t currentTime = ewol::getTime(); - int64_t processTimeLocal = (currentTime - ticTime); - if (displayTime == true) { - EWOL_DEBUG(m_displayName << " : processTime : " << (float)((float)processTimeLocal / 1000.0) << "ms "); - } - if (drwingDone) { - min = etk_min(min, processTimeLocal); - max = etk_max(max, processTimeLocal); - avg += processTimeLocal; - drwingDone = false; - } else { - min_idle = etk_min(min_idle, processTimeLocal); - max_idle = etk_max(max_idle, processTimeLocal); - avg_idle += processTimeLocal; - } - } - /** - * @brief this might be call when a display is really done - */ - void incrementCounter(void) { - nbDisplayTime++; - drwingDone = true; - } - /** - * @brief draw debug display ... - */ - void draw(void) { - if (true == display) { - if (nbDisplayTime>0) { - EWOL_DEBUG(m_displayName << " : Active : " - << (float)((float)min / 1000.0) << "ms " - << (float)((float)avg / (float)nbDisplayTime / 1000.0) << "ms " - << (float)((float)max / 1000.0) << "ms "); - } - if (nbCallTime-nbDisplayTime>0) { - EWOL_DEBUG(m_displayName << " : idle : " - << (float)((float)min_idle / 1000.0) << "ms " - << (float)((float)avg_idle / (float)(nbCallTime-nbDisplayTime) / 1000.0) << "ms " - << (float)((float)max_idle / 1000.0) << "ms "); - } - if (true == m_displayFPS) { - EWOL_DEBUG("FPS : " << nbDisplayTime << "/" << nbCallTime << "fps"); - } - max = 0; - min = 99999999999999LL; - avg = 0; - max_idle = 0; - min_idle = 99999999999999LL; - avg_idle = 0; - nbCallTime = 0; - nbDisplayTime = 0; - startTime = -1; - display = false; - } - } - }; -}; -#endif - diff --git a/sources/ewol/renderer/eInput.h b/sources/ewol/renderer/eInput.h deleted file mode 100644 index fdaefd19..00000000 --- a/sources/ewol/renderer/eInput.h +++ /dev/null @@ -1,116 +0,0 @@ -/** - * @author Edouard DUPIN - * - * @copyright 2011, Edouard DUPIN, all right reserved - * - * @license BSD v3 (see license file) - */ - -#ifndef __EWOL_SYSTEM_INPUT_H__ -#define __EWOL_SYSTEM_INPUT_H__ - -#include - -#define MAX_MANAGE_INPUT (15) - -namespace ewol { - // internal structure - typedef struct { - bool isUsed; - int32_t destinationInputId; - int64_t lastTimeEvent; - ewol::Widget* curentWidgetEvent; - vec2 origin; - vec2 size; - vec2 downStart; - vec2 posEvent; - bool isDown; - bool isInside; - int32_t nbClickEvent; // 0 .. 1 .. 2 .. 3 - } InputPoperty_ts; - - typedef struct { - int32_t sepatateTime; - int32_t DpiOffset; - } inputLimit_ts; - class eContext; - class eInput { - // special grab pointer mode : - private: - ewol::Widget* m_grabWidget; //!< widget that grab the curent pointer. - private: - int32_t m_dpi; - inputLimit_ts m_eventInputLimit; - inputLimit_ts m_eventMouseLimit; - void calculateLimit(void); - InputPoperty_ts m_eventInputSaved[MAX_MANAGE_INPUT]; - InputPoperty_ts m_eventMouseSaved[MAX_MANAGE_INPUT]; - void abortElement(InputPoperty_ts* _eventTable, int32_t _idInput, enum ewol::keyEvent::type _type); - void cleanElement(InputPoperty_ts* _eventTable, int32_t _idInput); - /** - * @brief generate the event on the destinated widget. - * @param[in] _type Type of the event that might be sended. - * @param[in] _destWidget Pointer on the requested widget that element might be sended - * @param[in] _IdInput Id of the event (PC : [0..9] and touch : [1..9]) - * @param[in] _typeEvent type of the eventg generated - * @param[in] _pos position of the event - * @return true if event has been greped - */ - bool localEventInput(enum ewol::keyEvent::type _type, - ewol::Widget* _destWidget, - int32_t _IdInput, - enum ewol::keyEvent::status _typeEvent, - vec2 _pos); - /** - * @brief convert the system event id in the correct EWOL id depending of the system management mode - * This function find the next input id unused on the specifiic widget - * == > on PC, the ID does not change (GUI is not the same) - * @param[in] _type Type of the kay event. - * @param[in] _destWidget Pointer of the widget destination - * @param[in] _realInputId system Id - * @return the ewol input id - */ - int32_t localGetDestinationId(enum ewol::keyEvent::type _type, - ewol::Widget* _destWidget, - int32_t _realInputId); - private: - ewol::eContext& m_context; - public: - eInput(ewol::eContext& _context); - ~eInput(void); - void setDpi(int32_t newDPI); - - // note if id<0 == > the it was finger event ... - void motion(enum ewol::keyEvent::type _type, int _pointerID, vec2 _pos ); - void state(enum ewol::keyEvent::type _type, int _pointerID, bool _isDown, vec2 _pos); - - /** - * @brief Inform object that an other object is removed ... - * @param[in] removeObject Pointer on the EObject remeved == > the user must remove all reference on this EObject - * @note : Sub classes must call this class - */ - void onObjectRemove(ewol::EObject* _removeObject); - /** - * @brief a new layer on the windows is set == > might remove all the property of the current element ... - */ - void newLayerSet(void); - /** - * @brief This is to transfert the event from one widget to another one - * @param _source the widget where the event came from - * @param _destination the widget where the event mitgh be generated now - */ - void transfertEvent(ewol::Widget* _source, ewol::Widget* _destination); - /** - * @brief This fonction lock the pointer properties to move in relative instead of absolute - * @param[in] _widget The widget that lock the pointer events - */ - void grabPointer(ewol::Widget* _widget); - /** - * @brief This fonction un-lock the pointer properties to move in relative instead of absolute - */ - void unGrabPointer(void); - }; -}; -#endif - - diff --git a/sources/ewol/resources/Colored3DObject.cpp b/sources/ewol/resource/Colored3DObject.cpp similarity index 100% rename from sources/ewol/resources/Colored3DObject.cpp rename to sources/ewol/resource/Colored3DObject.cpp diff --git a/sources/ewol/resources/Colored3DObject.h b/sources/ewol/resource/Colored3DObject.h similarity index 100% rename from sources/ewol/resources/Colored3DObject.h rename to sources/ewol/resource/Colored3DObject.h diff --git a/sources/ewol/resources/ConfigFile.cpp b/sources/ewol/resource/ConfigFile.cpp similarity index 100% rename from sources/ewol/resources/ConfigFile.cpp rename to sources/ewol/resource/ConfigFile.cpp diff --git a/sources/ewol/resources/ConfigFile.h b/sources/ewol/resource/ConfigFile.h similarity index 84% rename from sources/ewol/resources/ConfigFile.h rename to sources/ewol/resource/ConfigFile.h index a33398d0..a91e34dc 100644 --- a/sources/ewol/resources/ConfigFile.h +++ b/sources/ewol/resource/ConfigFile.h @@ -11,10 +11,13 @@ #include #include -#include +#include namespace ewol { namespace resource { + /** + * @not-in-doc + */ class SimpleConfigElement { public: std::string m_paramName; @@ -35,15 +38,14 @@ namespace ewol { std::string& getString(void) { return m_value; }; }; - class ConfigFile : public ewol::resource::Resource { + class ConfigFile : public ewol::Resource { private: - std::vector m_list; + std::vector m_list; std::string m_errorString; protected: ConfigFile(const std::string& _filename); virtual ~ConfigFile(void); public: - const char* getType(void) { return "ewol::SimpleConfigFile"; }; void reload(void); int32_t request(const std::string& _paramName); @@ -73,12 +75,12 @@ namespace ewol { * @param[in] _filename Name of the configuration file. * @return pointer on the resource or NULL if an error occured. */ - static ewol::ConfigFile* keep(const std::string& _filename); + static ewol::resource::ConfigFile* keep(const std::string& _filename); /** * @brief release the keeped resources * @param[in,out] reference on the object pointer */ - static void release(ewol::ConfigFile*& _object); + static void release(ewol::resource::ConfigFile*& _object); }; }; }; diff --git a/sources/ewol/resources/FontFreeType.cpp b/sources/ewol/resource/FontFreeType.cpp similarity index 100% rename from sources/ewol/resources/FontFreeType.cpp rename to sources/ewol/resource/FontFreeType.cpp diff --git a/sources/ewol/resources/FontFreeType.h b/sources/ewol/resource/FontFreeType.h similarity index 100% rename from sources/ewol/resources/FontFreeType.h rename to sources/ewol/resource/FontFreeType.h diff --git a/sources/ewol/resources/Image.cpp b/sources/ewol/resource/Image.cpp similarity index 100% rename from sources/ewol/resources/Image.cpp rename to sources/ewol/resource/Image.cpp diff --git a/sources/ewol/resources/Image.h b/sources/ewol/resource/Image.h similarity index 83% rename from sources/ewol/resources/Image.h rename to sources/ewol/resource/Image.h index 3e56ad81..3154cacd 100644 --- a/sources/ewol/resources/Image.h +++ b/sources/ewol/resource/Image.h @@ -12,8 +12,8 @@ #include #include #include -#include -#include +#include +#include namespace ewol { namespace resource { @@ -35,12 +35,12 @@ namespace ewol { * @param[in] _requested size of the image (usefull when loading .svg to automatic rescale) * @return pointer on the resource or NULL if an error occured. */ - static ewol::TextureFile* keep(const std::string& _filename, ivec2 _size=ivec2(-1,-1)); + static ewol::resource::TextureFile* keep(const std::string& _filename, ivec2 _size=ivec2(-1,-1)); /** * @brief release the keeped resources * @param[in,out] reference on the object pointer */ - static void release(ewol::TextureFile*& _object); + static void release(ewol::resource::TextureFile*& _object); }; }; }; diff --git a/sources/ewol/resources/Manager.cpp b/sources/ewol/resource/Manager.cpp similarity index 100% rename from sources/ewol/resources/Manager.cpp rename to sources/ewol/resource/Manager.cpp diff --git a/sources/ewol/resources/Manager.h b/sources/ewol/resource/Manager.h similarity index 85% rename from sources/ewol/resources/Manager.h rename to sources/ewol/resource/Manager.h index aa8bb0e8..e24838d8 100644 --- a/sources/ewol/resources/Manager.h +++ b/sources/ewol/resource/Manager.h @@ -11,16 +11,7 @@ #include #include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include namespace ewol { namespace resource { diff --git a/sources/ewol/resources/Program.cpp b/sources/ewol/resource/Program.cpp similarity index 100% rename from sources/ewol/resources/Program.cpp rename to sources/ewol/resource/Program.cpp diff --git a/sources/ewol/resources/Program.h b/sources/ewol/resource/Program.h similarity index 91% rename from sources/ewol/resources/Program.h rename to sources/ewol/resource/Program.h index b3e903e2..603f1130 100644 --- a/sources/ewol/resources/Program.h +++ b/sources/ewol/resource/Program.h @@ -12,10 +12,10 @@ #include #include #include -#include -#include -#include -#include +#include +#include +#include +#include namespace ewol { namespace resource { @@ -23,6 +23,7 @@ namespace ewol { * @brief In a openGL program we need some data to communicate with them, we register all the name requested by the user in this structure: * @note Register all requested element permit to abstract the fact that some element does not exist and remove control of existance from upper code. * This is important to note when the Program is reloaded the elements availlable can change. + * @not-in-doc */ class progAttributeElement { public : @@ -44,12 +45,12 @@ namespace ewol { * filename4.frag * */ - class Program : public ewol::resource::Resource { + class Program : public ewol::Resource { private : bool m_exist; //!< the file existed GLuint m_program; //!< openGL id of the current program - std::vector m_shaderList; //!< List of all the shader loaded - std::vector m_elementList; //!< List of all the attribute requested by the user + std::vector m_shaderList; //!< List of all the shader loaded + std::vector m_elementList; //!< List of all the attribute requested by the user bool m_hasTexture; //!< A texture has been set to the current shader bool m_hasTexture1; //!< A texture has been set to the current shader protected: @@ -63,11 +64,6 @@ namespace ewol { */ virtual ~Program(void); public: - /** - * @brief Generic function that get the resouces name of his type. - * @return The define char of his name. - */ - const char* getType(void) { return "ewol::Program"; }; /** * @brief User request an attribute on this program. * @note The attribute is send to the fragment shaders @@ -88,7 +84,7 @@ namespace ewol { int32_t _jumpBetweenSample=0); void sendAttributePointer(int32_t _idElem, int32_t _nbElement, - ewol::VirtualBufferObject* _vbo, + ewol::resource::VirtualBufferObject* _vbo, int32_t _index, int32_t _jumpBetweenSample=0, int32_t _offset=0); @@ -227,12 +223,24 @@ namespace ewol { */ void uniform4iv(int32_t _idElem, int32_t _nbElement, const int32_t *_value); - inline void uniform2(int32_t _idElem, const vec2& _value) { uniform2fv(_idElem, 1, &_value.m_floats[0]); }; - inline void uniform3(int32_t _idElem, const vec3& _value) { uniform3fv(_idElem, 1, &_value.m_floats[0]); }; - inline void uniform4(int32_t _idElem, const vec4& _value) { uniform4fv(_idElem, 1, &_value.m_floats[0]); }; - inline void uniform2(int32_t _idElem, const ivec2& _value) { uniform2iv(_idElem, 1, &_value.m_floats[0]); }; - inline void uniform3(int32_t _idElem, const ivec3& _value) { uniform3iv(_idElem, 1, &_value.m_floats[0]); }; - inline void uniform4(int32_t _idElem, const ivec4& _value) { uniform4iv(_idElem, 1, &_value.m_floats[0]); }; + inline void uniform2(int32_t _idElem, const vec2& _value) { + uniform2fv(_idElem, 1, &_value.m_floats[0]); + }; + inline void uniform3(int32_t _idElem, const vec3& _value) { + uniform3fv(_idElem, 1, &_value.m_floats[0]); + }; + inline void uniform4(int32_t _idElem, const vec4& _value) { + uniform4fv(_idElem, 1, &_value.m_floats[0]); + }; + inline void uniform2(int32_t _idElem, const ivec2& _value) { + uniform2iv(_idElem, 1, &_value.m_floats[0]); + }; + inline void uniform3(int32_t _idElem, const ivec3& _value) { + uniform3iv(_idElem, 1, &_value.m_floats[0]); + }; + inline void uniform4(int32_t _idElem, const ivec4& _value) { + uniform4iv(_idElem, 1, &_value.m_floats[0]); + }; /** * @brief Request the processing of this program @@ -273,12 +281,12 @@ namespace ewol { * @param[in] _filename Name of the openGL program. * @return pointer on the resource or NULL if an error occured. */ - static ewol::Program* keep(const std::string& _filename); + static ewol::resource::Program* keep(const std::string& _filename); /** * @brief release the keeped resources * @param[in,out] reference on the object pointer */ - static void release(ewol::Program*& _object); + static void release(ewol::resource::Program*& _object); }; }; }; diff --git a/sources/ewol/resources/Resource.cpp b/sources/ewol/resource/Resource.cpp similarity index 74% rename from sources/ewol/resources/Resource.cpp rename to sources/ewol/resource/Resource.cpp index 085a3de2..4d77fe89 100644 --- a/sources/ewol/resources/Resource.cpp +++ b/sources/ewol/resource/Resource.cpp @@ -15,22 +15,22 @@ #include -void ewol::resource::Resource::updateContext(void) { +void ewol::Resource::updateContext(void) { EWOL_DEBUG("Not set for : [" << getId() << "]" << getName() << " loaded " << m_counter << " time(s)"); } -void ewol::resource::Resource::removeContext(void) { +void ewol::Resource::removeContext(void) { EWOL_DEBUG("Not set for : [" << getId() << "]" << getName() << " loaded " << m_counter << " time(s)"); } -void ewol::resource::Resource::removeContextToLate(void) { +void ewol::Resource::removeContextToLate(void) { EWOL_DEBUG("Not set for : [" << getId() << "]" << getName() << " loaded " << m_counter << " time(s)"); } -void ewol::resource::Resource::reload(void) { +void ewol::Resource::reload(void) { EWOL_DEBUG("Not set for : [" << getId() << "]" << getName() << " loaded " << m_counter << " time(s)"); } -ewol::resource::Manager& ewol::resource::Resource::getManager(void) { +ewol::resource::Manager& ewol::Resource::getManager(void) { return ewol::getContext().getResourcesManager(); } \ No newline at end of file diff --git a/sources/ewol/resource/Resource.h b/sources/ewol/resource/Resource.h new file mode 100644 index 00000000..b7920e76 --- /dev/null +++ b/sources/ewol/resource/Resource.h @@ -0,0 +1,73 @@ +/** + * @author Edouard DUPIN + * + * @copyright 2011, Edouard DUPIN, all right reserved + * + * @license BSD v3 (see license file) + */ + + +#ifndef __RESOURCES_H__ +#define __RESOURCES_H__ + +#include +#include +#include +#include + +#define MAX_RESOURCE_LEVEL (5) + +namespace ewol { + namespace resource { + class Manager; + }; + // class resources is pure virtual + class Resource : public ewol::Object { + public: + Resource(void) : + m_counter(1), + m_resourceLevel(MAX_RESOURCE_LEVEL-1) { + addObjectType("ewol::Resource"); + setStatusResource(true); + }; + Resource(const std::string& _name) : + ewol::Object(_name), + m_counter(1), + m_resourceLevel(MAX_RESOURCE_LEVEL-1) { + addObjectType("ewol::Resource"); + setStatusResource(true); + }; + virtual ~Resource(void) { + + }; + private: + uint32_t m_counter; //!< number of time the element was loaded. + public: + void increment(void) { + m_counter++; + }; + bool decrement(void) { + m_counter--; + return (m_counter == 0)?true:false; + }; + int32_t getCounter(void) { + return m_counter; + }; + protected: + uint8_t m_resourceLevel; //!< Level of the resource ==> for updata priority [0..5] 0 must be update first. + public: + uint8_t getResourceLevel(void) { + return m_resourceLevel; + }; + virtual void updateContext(void); + virtual void removeContext(void); + virtual void removeContextToLate(void); + virtual void reload(void); + static ewol::resource::Manager& getManager(void); + }; +}; + + + +#endif + diff --git a/sources/ewol/resources/Shader.cpp b/sources/ewol/resource/Shader.cpp similarity index 100% rename from sources/ewol/resources/Shader.cpp rename to sources/ewol/resource/Shader.cpp diff --git a/sources/ewol/resources/Shader.h b/sources/ewol/resource/Shader.h similarity index 81% rename from sources/ewol/resources/Shader.h rename to sources/ewol/resource/Shader.h index 5632cbfc..c4a55b64 100644 --- a/sources/ewol/resources/Shader.h +++ b/sources/ewol/resource/Shader.h @@ -11,15 +11,15 @@ #include #include -#include -#include +#include +#include namespace ewol { namespace resource { /** * @brief Shader is a specific resources for opengl, used only in @ref Program. This are components of the renderer pipe-line */ - class Shader : public ewol::resource::Resource { + class Shader : public ewol::Resource { private : bool m_exist; //!< The shader file existed and has been loaded char* m_fileData; //!< A copy of the data loaded from the file (usefull only when opengl context is removed) @@ -36,21 +36,20 @@ namespace ewol { */ virtual ~Shader(void); public: - /** - * @brief Generic function that get the resouces name of his type. - * @return The define char of his name. - */ - const char* getType(void) { return "ewol::Shader"; }; /** * @brief get the opengl reference id of this shader. * @return The opengl id. */ - GLuint getGL_ID(void) { return m_shader; }; + GLuint getGL_ID(void) { + return m_shader; + }; /** * @brief get the opengl type of this shader. * @return The type of this loaded shader. */ - GLenum getShaderType(void) { return m_type; }; + GLenum getShaderType(void) { + return m_type; + }; /** * @brief This load/reload the data in the opengl context, needed when removed previously. */ @@ -75,12 +74,12 @@ namespace ewol { * @param[in] _filename Name of the openGL Shader. * @return pointer on the resource or NULL if an error occured. */ - static ewol::Shader* keep(const std::string& _filename); + static ewol::resource::Shader* keep(const std::string& _filename); /** * @brief release the keeped resources * @param[in,out] reference on the object pointer */ - static void release(ewol::Shader*& _object); + static void release(ewol::resource::Shader*& _object); }; }; }; diff --git a/sources/ewol/resources/Texture.cpp b/sources/ewol/resource/Texture.cpp similarity index 100% rename from sources/ewol/resources/Texture.cpp rename to sources/ewol/resource/Texture.cpp diff --git a/sources/ewol/resources/Texture.h b/sources/ewol/resource/Texture.h similarity index 78% rename from sources/ewol/resources/Texture.h rename to sources/ewol/resource/Texture.h index 01de3965..97d26aba 100644 --- a/sources/ewol/resources/Texture.h +++ b/sources/ewol/resource/Texture.h @@ -12,12 +12,12 @@ #include #include #include -#include -#include +#include +#include namespace ewol { namespace resource { - class Texture : public ewol::resource::Resource { + class Texture : public ewol::Resource { protected: // openGl Context propoerties : egami::Image m_data; @@ -34,19 +34,24 @@ namespace ewol { void removeContextToLate(void); // middleware interface: public: - GLuint getId(void) { return m_texId; }; - vec2 getUsableSize(void) { return m_endPointSize; }; + GLuint getId(void) { + return m_texId; + }; + vec2 getUsableSize(void) { + return m_endPointSize; + }; // Public API: protected: Texture(const std::string& _filename); Texture(void); ~Texture(void); public: - virtual const char* getType(void) { return "ewol::Texture"; }; // you must set the size here, because it will be set in multiple of pow(2) void setImageSize(ivec2 newSize); // get the reference on this image to draw nomething on it ... - inline egami::Image& get(void) { return m_data; }; + inline egami::Image& get(void) { + return m_data; + }; // flush the data to send it at the openGl system void flush(void); public: @@ -55,12 +60,12 @@ namespace ewol { * @note Never free this pointer by your own... * @return pointer on the resource or NULL if an error occured. */ - static ewol::Texture* keep(void); + static ewol::resource::Texture* keep(void); /** * @brief release the keeped resources * @param[in,out] reference on the object pointer */ - static void release(ewol::Texture*& _object); + static void release(ewol::resource::Texture*& _object); }; }; }; diff --git a/sources/ewol/resources/TexturedFont.cpp b/sources/ewol/resource/TexturedFont.cpp similarity index 100% rename from sources/ewol/resources/TexturedFont.cpp rename to sources/ewol/resource/TexturedFont.cpp diff --git a/sources/ewol/resources/TexturedFont.h b/sources/ewol/resource/TexturedFont.h similarity index 91% rename from sources/ewol/resources/TexturedFont.h rename to sources/ewol/resource/TexturedFont.h index bb2aadac..89071d4f 100644 --- a/sources/ewol/resources/TexturedFont.h +++ b/sources/ewol/resource/TexturedFont.h @@ -9,12 +9,15 @@ #ifndef __EWOL_TEXTURED_FONT_H__ #define __EWOL_TEXTURED_FONT_H__ -#include -#include -#include +#include +#include +#include namespace ewol { namespace font { + /** + * @not-in-doc + */ enum mode { Regular=0, Italic, @@ -33,7 +36,7 @@ namespace ewol { // specific element to have the the know if the specify element is known... // == > otherwise I can just generate italic ... // == > Bold is a little more complicated (maybe with the bordersize) - ewol::FontBase* m_font[4]; + ewol::resource::FontBase* m_font[4]; enum ewol::font::mode m_modeWraping[4]; //!< This is a wrapping mode to prevent the fact that no font is define for a specific mode public: std::vector m_listElement[4]; @@ -93,12 +96,12 @@ namespace ewol { * @param[in] _filename Name of the texture font. * @return pointer on the resource or NULL if an error occured. */ - static ewol::TexturedFont* keep(const std::string& _filename); + static ewol::resource::TexturedFont* keep(const std::string& _filename); /** * @brief release the keeped resources * @param[in,out] reference on the object pointer */ - static void release(ewol::TexturedFont*& _object); + static void release(ewol::resource::TexturedFont*& _object); private: /** * @brief add a glyph in a texture font. diff --git a/sources/ewol/resources/VirtualBufferObject.cpp b/sources/ewol/resource/VirtualBufferObject.cpp similarity index 100% rename from sources/ewol/resources/VirtualBufferObject.cpp rename to sources/ewol/resource/VirtualBufferObject.cpp diff --git a/sources/ewol/resources/VirtualBufferObject.h b/sources/ewol/resource/VirtualBufferObject.h similarity index 93% rename from sources/ewol/resources/VirtualBufferObject.h rename to sources/ewol/resource/VirtualBufferObject.h index 6f30a578..6a7b650f 100644 --- a/sources/ewol/resources/VirtualBufferObject.h +++ b/sources/ewol/resource/VirtualBufferObject.h @@ -12,8 +12,8 @@ #include #include #include -#include -#include +#include +#include #define NB_VBO_MAX (20) @@ -22,7 +22,7 @@ namespace ewol { /** * @brief VirtualBufferObject is a specific resources for opengl, this load the data directly in the graphic card ad keep these inside */ - class VirtualBufferObject : public ewol::resource::Resource { + class VirtualBufferObject : public ewol::Resource { private : size_t m_nbVBO; bool m_exist; //!< This data is availlable in the Graphic card @@ -104,12 +104,12 @@ namespace ewol { * @param[in] _number Number of VBO needed * @return pointer on the resource or NULL if an error occured. */ - static ewol::VirtualBufferObject* keep(int32_t _number); + static ewol::resource::VirtualBufferObject* keep(int32_t _number); /** * @brief release the keeped resources * @param[in,out] reference on the object pointer */ - static void release(ewol::VirtualBufferObject*& _object); + static void release(ewol::resource::VirtualBufferObject*& _object); }; }; }; diff --git a/sources/ewol/resources/font/FontBase.h b/sources/ewol/resource/font/FontBase.h similarity index 82% rename from sources/ewol/resources/font/FontBase.h rename to sources/ewol/resource/font/FontBase.h index 7dddb94f..33ce74ac 100644 --- a/sources/ewol/resources/font/FontBase.h +++ b/sources/ewol/resource/font/FontBase.h @@ -12,21 +12,19 @@ #include #include #include -#include -#include -#include +#include +#include +#include namespace ewol { namespace resource { - class FontBase : public ewol::resource::Resource { + class FontBase : public ewol::Resource { public: FontBase(const std::string& _fontName) : ewol::Resource(_fontName) {}; virtual ~FontBase(void) { }; - const char* getType(void) { return "ewol::Font"; }; - virtual bool getGlyphProperty(int32_t _fontSize, ewol::GlyphProperty& _property) = 0; diff --git a/sources/ewol/resource/font/GlyphProperty.h b/sources/ewol/resource/font/GlyphProperty.h new file mode 100644 index 00000000..2be32124 --- /dev/null +++ b/sources/ewol/resource/font/GlyphProperty.h @@ -0,0 +1,108 @@ +/** + * @author Edouard DUPIN + * + * @copyright 2011, Edouard DUPIN, all right reserved + * + * @license BSD v3 (see license file) + */ + +#ifndef __EWOL_FONT_GLYPH_PROPERTY_H__ +#define __EWOL_FONT_GLYPH_PROPERTY_H__ + +#include + + +namespace ewol { + /* + | | | | + | | | | + | | | | + Y | | | | + ^ |------------| |------------| + | + m_advance.y:/-> | + | | + | | + m_sizeTex.x/-> | | |------------| |------------| + | | | | | | | + | | | | | | | + | | | | | | | + | | | | | | | + | | | | A | | G | + | | | | | | | + | | | | | | | + | | | | | | | + | | | | | | | + \-> | | |------------| |------------| + /--> | | + \--> \-> | + m_bearing.y | + |____*________________________*____________>> X + + + <------------------------> : m_advance.x + + <------------> : m_sizeTexture.x + + <---> : m_bearing.x + + */ + /** + * @not-in-doc + */ + class GlyphProperty { + public: + char32_t m_UVal; //!< Unicode value + private: + bool m_exist; + public: + int32_t m_glyphIndex; //!< Glyph index in the system + ivec2 m_sizeTexture; //!< size of the element to display + ivec2 m_bearing; //!< offset to display the data (can be negatif id the texture sise is bigger than the theoric places in the string) + ivec2 m_advance; //!< space use in the display for this specific char + vec2 m_texturePosStart; //!< Texture normalised position (START) + vec2 m_texturePosSize; //!< Texture normalised position (SIZE) + private: + std::vector m_kerning; //!< kerning values of link of all elements + public: + GlyphProperty(void) : + m_UVal(0), + m_exist(true), + m_glyphIndex(0), + m_sizeTexture(0,0), + m_bearing(0,0), + m_advance(0,0), + m_texturePosStart(0,0), + m_texturePosSize(0,0) { + + }; + float kerningGet(const char32_t _charcode) { + for(size_t iii=0; iii -#include -#include -#include - -#undef __class__ -#define __class__ "resource::Mesh" - -ewol::resource::Mesh::Mesh(const std::string& _fileName, const std::string& _shaderName) : - ewol::resource::Resource(_fileName), - m_normalMode(normalModeNone), - m_checkNormal(false), - m_pointerShape(NULL), - m_functionFreeShape(NULL) { - addObjectType("ewol::Mesh"); - EWOL_VERBOSE("Load a new mesh : '" << _fileName << "'"); - // get the shader resource : - m_GLPosition = 0; - - m_light.setDirection(vec3(0,-cos(M_PI/4),0)); - m_light.setHalfPlane(vec3(1,0,0)); - m_light.setAmbientColor(vec4(1,1,1,1)); - m_light.setDiffuseColor(vec4(1.0,1.0,1.0,1)); - m_light.setSpecularColor(vec4(0.0,0.0,0.0,1)); - - //EWOL_DEBUG(m_name << " " << m_light); - m_GLprogram = ewol::Program::keep(_shaderName); - if (NULL != m_GLprogram ) { - m_GLPosition = m_GLprogram->getAttribute("EW_coord3d"); - m_GLtexture = m_GLprogram->getAttribute("EW_texture2d"); - m_GLNormal = m_GLprogram->getAttribute("EW_normal"); - m_GLMatrix = m_GLprogram->getUniform("EW_MatrixTransformation"); - m_GLMatrixPosition = m_GLprogram->getUniform("EW_MatrixPosition"); - // Link material and Lights - m_GLMaterial.link(m_GLprogram, "EW_material"); - m_light.link(m_GLprogram, "EW_directionalLight"); - } - // this is the properties of the buffer requested : "r"/"w" + "-" + buffer type "f"=flaot "i"=integer - m_verticesVBO = ewol::VirtualBufferObject::keep(4); - - // load the curent file : - std::string tmpName = to_lower(_fileName); - // select the corect loader : - if (end_with(tmpName, ".obj") == true) { - if (loadOBJ(_fileName) == false) { - EWOL_ERROR("Error To load OBJ file " << tmpName ); - return; - } - } else if (end_with(tmpName, ".emf") ) { - if (loadEMF(_fileName) == false) { - EWOL_ERROR("Error To load EMF file " << tmpName ); - return; - } - //EWOL_CRITICAL("Load a new mesh : '" << _fileName << "' (end)"); - } else { - // nothing to do == > reqiest an enmpty mesh ==> user manage it ... - } -} - -ewol::resource::Mesh::~Mesh(void) { - // remove dynamics dependencies : - ewol::resource::Program::release(m_GLprogram); - ewol::resource::VirtualBufferObject::release(m_verticesVBO); - if (m_functionFreeShape!=NULL) { - m_functionFreeShape(m_pointerShape); - m_pointerShape = NULL; - } -} - -//#define DISPLAY_NB_VERTEX_DISPLAYED - -void ewol::resource::Mesh::draw(mat4& _positionMatrix, - bool _enableDepthTest, - bool _enableDepthUpdate) { - if (m_GLprogram == NULL) { - EWOL_ERROR("No shader ..."); - return; - } - //EWOL_DEBUG(m_name << " " << m_light); - if (_enableDepthTest == true) { - ewol::openGL::enable(ewol::openGL::FLAG_DEPTH_TEST); - if (false == _enableDepthUpdate) { - glDepthMask(GL_FALSE); - } - } else { - ewol::openGL::disable(ewol::openGL::FLAG_DEPTH_TEST); - } - //EWOL_DEBUG(" display " << m_coord.size() << " elements" ); - m_GLprogram->use(); - // set Matrix : translation/positionMatrix - mat4 projMatrix = ewol::openGL::getMatrix(); - mat4 camMatrix = ewol::openGL::getCameraMatrix(); - mat4 tmpMatrix = projMatrix * camMatrix; - m_GLprogram->uniformMatrix4fv(m_GLMatrix, 1, tmpMatrix.m_mat); - m_GLprogram->uniformMatrix4fv(m_GLMatrixPosition, 1, _positionMatrix.m_mat); - // position : - m_GLprogram->sendAttributePointer(m_GLPosition, 3/*x,y,z*/, m_verticesVBO, MESH_VBO_VERTICES); - // Texture : - m_GLprogram->sendAttributePointer(m_GLtexture, 2/*u,v*/, m_verticesVBO, MESH_VBO_TEXTURE); - // position : - m_GLprogram->sendAttributePointer(m_GLNormal, 3/*x,y,z*/, m_verticesVBO, MESH_VBO_VERTICES_NORMAL); - // draw lights : - m_light.draw(m_GLprogram); - #ifdef DISPLAY_NB_VERTEX_DISPLAYED - int32_t nbElementDrawTheoric = 0; - int32_t nbElementDraw = 0; - #endif - for (int32_t kkk=0; kkkdraw(m_GLprogram, m_GLMaterial); - if (m_checkNormal == false) { - ewol::openGL::drawElements(GL_TRIANGLES, m_listFaces.getValue(kkk).m_index); - #ifdef DISPLAY_NB_VERTEX_DISPLAYED - nbElementDraw += m_listFaces.getValue(kkk).m_index.size(); - nbElementDrawTheoric += m_listFaces.getValue(kkk).m_index.size(); - #endif - } else { - mat4 mattttt = (projMatrix * camMatrix) * _positionMatrix; - mattttt.m_mat[3] = 0; - mattttt.m_mat[7] = 0; - mattttt.m_mat[11] = 0; - //vec3 cameraNormal = vec3(-mattttt.m_mat[2], -mattttt.m_mat[6], -mattttt.m_mat[10]); - vec3 cameraNormal = vec3(0,0,-1); - cameraNormal.normalized(); - // remove face that is notin the view ... - std::vector tmpIndexResult; - std::vector& tmppFaces = m_listFaces.getValue(kkk).m_faces; - //std::vector& tmppIndex = m_listFaces.getValue(kkk).m_index; - if (normalModeFace == m_normalMode) { - for(size_t iii=0; iii= 0.0f) { - tmpIndexResult.push_back(iii*3); - tmpIndexResult.push_back(iii*3+1); - tmpIndexResult.push_back(iii*3+2); - } - } - } else { - for(size_t iii=0; iii= -0.2f) - || (btDot(mattttt * m_listVertexNormal[tmppFaces[iii].m_normal[1]], cameraNormal) >= -0.2f) - || (btDot(mattttt * m_listVertexNormal[tmppFaces[iii].m_normal[2]], cameraNormal) >= -0.2f) ) { - tmpIndexResult.push_back(iii*3); - tmpIndexResult.push_back(iii*3+1); - tmpIndexResult.push_back(iii*3+2); - } - } - } - ewol::openGL::drawElements(GL_TRIANGLES, tmpIndexResult); - #ifdef DISPLAY_NB_VERTEX_DISPLAYED - nbElementDraw += tmpIndexResult.size(); - nbElementDrawTheoric += m_listFaces.getValue(kkk).m_index.size(); - #endif - } - } - #ifdef DISPLAY_NB_VERTEX_DISPLAYED - EWOL_DEBUG(((float)nbElementDraw/(float)nbElementDrawTheoric*100.0f) << "% Request draw : " << m_listFaces.size() << ":" << nbElementDraw << "/" << nbElementDrawTheoric << " elements [" << m_name << "]"); - #endif - m_GLprogram->unUse(); - if (_enableDepthTest == true){ - if (false == _enableDepthUpdate) { - glDepthMask(GL_TRUE); - } - ewol::openGL::disable(ewol::openGL::FLAG_DEPTH_TEST); - } - // TODO : UNDERSTAND why ... it is needed - glBindBuffer(GL_ARRAY_BUFFER,0); -} - -// normal calculation of the normal face is really easy : -void ewol::resource::Mesh::calculateNormaleFace(void) { - m_listFacesNormal.clear(); - if (m_normalMode != ewol::Mesh::normalModeFace) { - std::vector& tmpFaceList = m_listFaces.getValue(0).m_faces; - for(size_t iii=0 ; iii& tmpFaceList = m_listFaces.getValue(0).m_faces; - vec3 normal(0,0,0); - // add the vertex from all the element in the list for face when the element in the face ... - for(size_t jjj=0 ; jjjpushOnBuffer(MESH_VBO_VERTICES_NORMAL, normal); - if( tmpFaceList[jjj].m_vertex[0] == (int32_t)iii - || tmpFaceList[jjj].m_vertex[1] == (int32_t)iii - || tmpFaceList[jjj].m_vertex[2] == (int32_t)iii) { - normal += m_listFacesNormal[jjj]; - } - } - if (normal == vec3(0,0,0)) { - m_listVertexNormal.push_back(vec3(1,1,1)); - } else { - m_listVertexNormal.push_back(normal.normalized()); - } - } - m_normalMode = ewol::Mesh::normalModeVertex; - } -} - -// for debugging ... -//#define PRINT_HALF (1) -//#define TRY_MINIMAL_VBO - -void ewol::resource::Mesh::generateVBO(void) { - // calculate the normal of all faces if needed - if (m_normalMode == ewol::Mesh::normalModeNone) { - // when no normal detected == > auto generate Face normal .... - calculateNormaleFace(); - } - // generate element in 2 pass : - // - create new index dependeng a vertex is a unique componenet of position, texture, normal - // - the index list generation (can be dynamic ... (TODO later) - for (int32_t kkk=0; kkksizeOnBufferVec3(MESH_VBO_VERTICES); jjj++) { - if( m_verticesVBO->getOnBufferVec3(MESH_VBO_VERTICES,jjj) == position - && m_verticesVBO->getOnBufferVec3(MESH_VBO_VERTICES_NORMAL,jjj) == normal - && m_verticesVBO->getOnBufferVec2(MESH_VBO_TEXTURE,jjj) == texturepos) { - vertexVBOId[indice] = jjj; - elementFind = true; - //EWOL_DEBUG("search indice : " << jjj); - tmpppppp += jjj; - // stop searching ... - break; - } - } - #endif - if (false == elementFind) { - m_verticesVBO->pushOnBuffer(MESH_VBO_VERTICES, position); - m_verticesVBO->pushOnBuffer(MESH_VBO_VERTICES_NORMAL, normal); - m_verticesVBO->pushOnBuffer(MESH_VBO_TEXTURE, texturepos); - vertexVBOId[indice] = m_verticesVBO->sizeOnBufferVec3(MESH_VBO_VERTICES)-1; - } - } - for(size_t indice=0 ; indice<3; indice++) { - tmpFaceList.m_index.push_back(vertexVBOId[indice]); - } - } - #ifdef TRY_MINIMAL_VBO - EWOL_DEBUG("nb cycle ? : " << tmpppppp); - #endif - } - // update all the VBO elements ... - m_verticesVBO->flush(); -} - - -void ewol::resource::Mesh::createViewBox(const std::string& _materialName,float _size) { - m_normalMode = ewol::Mesh::normalModeNone; - // This is the direct generation basis on the .obj system - /* - 5 6 - o---------------------o - /. /| - / . / | - / . / | - / . / | - / . / | - 4 / . / | - o---------------------o | - | . |7 | - | . | | - | . | | - | . | | - | o..............|......o - | . 1 | / 2 - | . | / - | . | / - | . | / - | . | / - |. |/ - o---------------------o - 0 3 - */ - m_listVertex.push_back(vec3( _size, -_size, -_size)); // 0 - m_listVertex.push_back(vec3( _size, -_size, _size)); // 1 - m_listVertex.push_back(vec3(-_size, -_size, _size)); // 2 - m_listVertex.push_back(vec3(-_size, -_size, -_size)); // 3 - m_listVertex.push_back(vec3( _size, _size, -_size)); // 4 - m_listVertex.push_back(vec3( _size, _size, _size)); // 5 - m_listVertex.push_back(vec3(-_size, _size, _size)); // 6 - m_listVertex.push_back(vec3(-_size, _size, -_size)); // 7 - /* - o----------o----------o----------o - |8 |9 |10 |11 - | | | | - | | | | - | 0 | 1 | 2 | - | | | | - | | | | - | | | | - | | | | - o----------o----------o----------o - |4 |5 |6 |7 - | | | | - | | | | - | 3 | 4 | 5 | - | | | | - | | | | - | | | | - | | | | - o----------o----------o----------o - 0 1 2 3 - */ - m_listUV.push_back(vec2(0.0 , 0.0 )); // 0 - m_listUV.push_back(vec2(1.0/3.0, 0.0 )); // 1 - m_listUV.push_back(vec2(2.0/3.0, 0.0 )); // 2 - m_listUV.push_back(vec2(1.0 , 0.0 )); // 3 - m_listUV.push_back(vec2(0.0 , 0.5 )); // 4 - m_listUV.push_back(vec2(1.0/3.0, 0.5 )); // 5 - m_listUV.push_back(vec2(2.0/3.0, 0.5 )); // 6 - m_listUV.push_back(vec2(1.0 , 0.5 )); // 7 - m_listUV.push_back(vec2(0.0 , 1.0 )); // 8 - m_listUV.push_back(vec2(1.0/3.0, 1.0 )); // 9 - m_listUV.push_back(vec2(2.0/3.0, 1.0 )); // 10 - m_listUV.push_back(vec2(1.0 , 1.0 )); // 11 - - if (m_listFaces.exist(_materialName) == false) { - FaceIndexing empty; - m_listFaces.add(_materialName, empty); - } - { - FaceIndexing& tmpElement = m_listFaces[_materialName]; - tmpElement.m_faces.push_back(Face(0,1, 1,5, 2,6)); // 4 - tmpElement.m_faces.push_back(Face(0,1, 2,6, 3,2)); // 4 - tmpElement.m_faces.push_back(Face(4,4, 0,0, 3,1)); // 3 - tmpElement.m_faces.push_back(Face(4,4, 3,1, 7,5)); // 3 - tmpElement.m_faces.push_back(Face(2,6, 6,10, 7,11)); // 2 - tmpElement.m_faces.push_back(Face(2,6, 7,11, 3,7)); // 2 - tmpElement.m_faces.push_back(Face(4,2, 7,3, 6,7)); // 5 - tmpElement.m_faces.push_back(Face(4,2, 6,7, 5,6)); // 5 - tmpElement.m_faces.push_back(Face(1,5, 5,9, 6,10)); // 1 - tmpElement.m_faces.push_back(Face(1,5, 6,10, 2,6)); // 1 - tmpElement.m_faces.push_back(Face(0,4, 4,8, 5,9)); // 0 - tmpElement.m_faces.push_back(Face(0,4, 5,9, 1,5)); // 0 - } - calculateNormaleFace(); -} - - -bool ewol::resource::Mesh::loadOBJ(const std::string& _fileName) { - m_normalMode = ewol::Mesh::normalModeNone; -#if 0 - etk::FSNode fileName(_fileName); - // get the fileSize ... - int32_t size = fileName.fileSize(); - if (size == 0 ) { - EWOL_ERROR("No data in the file named=\"" << fileName << "\""); - return false; - } - if(false == fileName.fileOpenRead() ) { - EWOL_ERROR("Can not find the file name=\"" << fileName << "\""); - return false; - } - char inputDataLine[2048]; - - int32_t lineID = 0; - while (NULL != fileName.fileGets(inputDataLine, 2048) ) - { - lineID++; - if (inputDataLine[0] == 'v') { - if (inputDataLine[1] == 'n') { - // Vertice normal : vn 0.000000 0.000000 -1.000000 - // we did not use normal == > we recalculated it if needed (some .obj does not export normal, then it is simple like this ... - // TODO : Use the normal provided ... => can be smooth or not ... (cf check "s 1") - } else if (inputDataLine[1] == 't') { - // Texture position : vt 0.748573 0.750412 - vec2 vertex(0,0); - sscanf(&inputDataLine[3], "%f %f", &vertex.m_floats[0], &vertex.m_floats[1]); - m_listUV.push_back(vertex); - } else { - // Vertice position : v 1.000000 -1.000000 -1.000000 - vec3 vertex(0,0,0); - sscanf(&inputDataLine[2], "%f %f %f", &vertex.m_floats[0], &vertex.m_floats[1], &vertex.m_floats[2] ); - m_listVertex.push_back(vertex); - } - } else if (inputDataLine[0] == 'f') { - // face : f 5/1/1 1/2/1 4/3/1* - uint32_t vertexIndex[4], uvIndex[4], normalIndex[4]; - bool quadMode = true; - int32_t matches = sscanf(&inputDataLine[2], "%d/%d/%d %d/%d/%d %d/%d/%d %d/%d/%d\n", - &vertexIndex[0], &uvIndex[0], &normalIndex[0], - &vertexIndex[1], &uvIndex[1], &normalIndex[1], - &vertexIndex[2], &uvIndex[2], &normalIndex[2], - &vertexIndex[3], &uvIndex[3], &normalIndex[3] ); - if (12 != matches){ - // no normal mode : - matches = sscanf(&inputDataLine[2], "%d/%d %d/%d %d/%d %d/%d\n", - &vertexIndex[0], &uvIndex[0], - &vertexIndex[1], &uvIndex[1], - &vertexIndex[2], &uvIndex[2], - &vertexIndex[3], &uvIndex[3] ); - if (8 != matches){ - quadMode = false; - matches = sscanf(&inputDataLine[2], "%d/%d/%d %d/%d/%d %d/%d/%d\n", - &vertexIndex[0], &uvIndex[0], &normalIndex[0], - &vertexIndex[1], &uvIndex[1], &normalIndex[1], - &vertexIndex[2], &uvIndex[2], &normalIndex[2] ); - if (9 != matches){ - // no normal mode : - matches = sscanf(&inputDataLine[2], "%d/%d %d/%d %d/%d\n", - &vertexIndex[0], &uvIndex[0], - &vertexIndex[1], &uvIndex[1], - &vertexIndex[2], &uvIndex[2] ); - if (6 != matches){ - EWOL_ERROR("Parsing error in the .obj files : " << fileName << " (l=" << lineID << ") in 'f' section : \"" << &inputDataLine[2] << "\" expected : %d/%d(/%d) %d/%d(/%d) %d/%d(/%d) (%d/%d(/%d)) () for option"); - continue; - } - } - } - } - if (true == quadMode) { - m_listFaces.push_back(Face(vertexIndex[0]-1, uvIndex[0]-1, - vertexIndex[1]-1, uvIndex[1]-1, - vertexIndex[2]-1, uvIndex[2]-1, - vertexIndex[3]-1, uvIndex[3]-1)); - } else { - m_listFaces.push_back(Face(vertexIndex[0]-1, uvIndex[0]-1, - vertexIndex[1]-1, uvIndex[1]-1, - vertexIndex[2]-1, uvIndex[2]-1)); - } - /* - EWOL_DEBUG(" plop : " << tmpFace.m_nbElement << " ? " << m_listFaces[m_listFaces.size()-1].m_nbElement); - EWOL_DEBUG(" : " << tmpFace.m_vertex[0] << " ? " << m_listFaces[m_listFaces.size()-1].m_vertex[0]); - EWOL_DEBUG(" : " << tmpFace.m_uv[0] << " ? " << m_listFaces[m_listFaces.size()-1].m_uv[0]); - */ - } else if (inputDataLine[0] == 's') { - // ??? : s off - } else if (inputDataLine[0] == '#') { - // comment - // nothing to do ... just go to the new line ... - } else if( inputDataLine[0] == 'u' - && inputDataLine[1] == 's' - && inputDataLine[2] == 'e' - && inputDataLine[3] == 'm' - && inputDataLine[4] == 't' - && inputDataLine[5] == 'l' ) { - // Use Material : usemtl imageName.xxx - while( inputDataLine[strlen(inputDataLine)-1] == '\n' - || inputDataLine[strlen(inputDataLine)-1] == '\r' - || inputDataLine[strlen(inputDataLine)-1] == ' ') { - if (1 == strlen(inputDataLine) ){ - break; - } - inputDataLine[strlen(inputDataLine)-1] = '\0'; - } - std::string tmpVal(&inputDataLine[7]); - setTexture(fileName.getRelativeFolder() + tmpVal); - } else if( inputDataLine[0] == 'm' - && inputDataLine[1] == 't' - && inputDataLine[2] == 'l' - && inputDataLine[3] == 'l' - && inputDataLine[4] == 'i' - && inputDataLine[5] == 'b' ) { - // ???? : mtllib cube.mtl - } - } - fileName.fileClose(); - generateVBO(); -#endif - return true; -} - -void jumpEndLine(etk::FSNode& _file) { - char current=_file.fileGet(); - while( current != '\0' - && current != '\n') { - //printf("%c", current); - current=_file.fileGet(); - } -} - -int32_t countIndent(etk::FSNode& _file) { - int32_t nbIndent=0; - int32_t nbSpacesTab=0; - int32_t nbChar=0; - //EWOL_DEBUG(" start count Indent"); - for(char current=_file.fileGet(); current != '\0'; current=_file.fileGet()) { - nbChar++; - //EWOL_DEBUG("parse : " << current); - if (current == '\t') { - nbSpacesTab = 0; - nbIndent++; - } else if (current == ' ') { - nbSpacesTab++; - if (nbSpacesTab == 4) { - nbSpacesTab = 0; - nbIndent++; - } - } else if (current == '#') { - // Auto remove comment ... - jumpEndLine(_file); - return countIndent(_file); - } else { - - break; - } - } - //EWOL_DEBUG("indent : " << nbIndent); - _file.fileSeek(-nbChar, etk::FSN_SEEK_CURRENT); - return nbIndent; -} - -char* loadNextData(char* _elementLine, - int64_t _maxData, - etk::FSNode& _file, - bool _removeTabs=false, - bool _stopColomn=false, - bool _stopPipe=true) { - memset(_elementLine, 0, _maxData); - char * element = _elementLine; - int64_t outSize = 0; - /* - if (m_zipReadingOffset >= m_zipContent->size()) { - element[0] = '\0'; - return NULL; - } - */ - char current = _file.fileGet(); - while (current != '\0') { - if( _removeTabs == false - || element != _elementLine) { - *element = current; - element++; - } - if( current == '\n' - || current == '\r' - || ( current == '|' - && _stopPipe == true) - || ( current == ':' - && _stopColomn == true) ) - { - *element = '\0'; - //EWOL_DEBUG(" plop : '" << _elementLine << "'" ); - return _elementLine; - } else if( element == _elementLine - && current != '\t') { - *element = current; - element++; - } - // check maxData size ... - if (outSize >= _maxData-1) { - *element = '\0'; - return _elementLine; - } - current = _file.fileGet(); - } - if (outSize == 0) { - return NULL; - } else { - // send last line - return _elementLine; - } - return NULL; -} - -void removeEndLine(char* _val) { - int32_t len = strlen(_val); - if( len>0 - && ( _val[len-1] == '\n' - || _val[len-1] == '\r' ) ) { - _val[len-1] = '\0'; - } - len--; - if( len>0 - && ( _val[len-1] == '\n' - || _val[len-1] == '\r') ) { - _val[len-1] = '\0'; - } -} - -enum emfModuleMode { - EMFModuleNone, - EMFModuleMesh, - EMFModuleMeshNamed, - EMFModuleMeshVertex, - EMFModuleMeshUVMapping, - EMFModuleMeshNormalVertex, - EMFModuleMeshNormalFace, - EMFModuleMeshFace, - EMFModuleMeshFaceMaterial, - EMFModuleMeshPhysics, - EMFModuleMeshPhysicsNamed, - EMFModuleMesh_END, - EMFModuleMaterial, - EMFModuleMaterialNamed, - EMFModuleMaterial_END, -}; - -bool ewol::resource::Mesh::loadEMF(const std::string& _fileName) { - m_checkNormal = true; - m_normalMode = ewol::Mesh::normalModeNone; - etk::FSNode fileName(_fileName); - // get the fileSize ... - int32_t size = fileName.fileSize(); - if (size == 0 ) { - EWOL_ERROR("No data in the file named=\"" << fileName << "\""); - return false; - } - if(false == fileName.fileOpenRead() ) { - EWOL_ERROR("Can not find the file name=\"" << fileName << "\""); - return false; - } - char inputDataLine[2048]; - // load the first line : - fileName.fileGets(inputDataLine, 2048); - if(0 == strncmp(inputDataLine, "EMF(STRING)", 11)) { - // parse in string mode ... - } else if (0 == strncmp(inputDataLine, "EMF(BINARY)", 11)) { - EWOL_ERROR(" file binary mode is not supported now : 'EMF(BINARY)'"); - return false; - } else { - EWOL_ERROR(" file mode is not supported now : 'EMF(? ? ?)' = '" << inputDataLine << "'"); - return false; - } - enum emfModuleMode currentMode = EMFModuleNone; - EWOL_VERBOSE("Start parsing Mesh file : " << fileName); - // mesh global param : - std::string currentMeshName = ""; - int32_t meshFaceMaterialID = -1; - // material global param : - std::string materialName = ""; - ewol::Material* material = NULL; - // physical shape: - ewol::PhysicsShape* physics = NULL; - while(1) { - int32_t level = countIndent(fileName); - if (level == 0) { - // new section ... - if (NULL == loadNextData(inputDataLine, 2048, fileName)) { - // reach end of file ... - break; - } - if(0 == strncmp(inputDataLine, "Mesh :", 6) ) { - currentMode = EMFModuleMesh; - EWOL_VERBOSE("Parse Mesh :"); - } else if(0 == strncmp(inputDataLine, "Materials : ", 11) ) { - currentMode = EMFModuleMaterial; - EWOL_VERBOSE("Parse Material :"); - } else { - currentMode = EMFModuleNone; - } - } else { - if (currentMode >= EMFModuleMesh && currentMode <= EMFModuleMesh_END) { - if (level == 1) { - //Find mesh name ... - if (NULL == loadNextData(inputDataLine, 2048, fileName, true)) { - // reach end of file ... - break; - } - removeEndLine(inputDataLine); - currentMeshName = inputDataLine; - currentMode = EMFModuleMeshNamed; - EWOL_VERBOSE(" "<< currentMeshName); - continue; - } - if (level == 2) { - // In the mesh level 2 the line size must not exced 2048 - if (NULL == loadNextData(inputDataLine, 2048, fileName, true)) { - // reach end of file ... - break; - } - removeEndLine(inputDataLine); - if(0 == strncmp(inputDataLine, "Vertex", 6) ) { - currentMode = EMFModuleMeshVertex; - EWOL_VERBOSE(" Vertex ..."); - } else if(0 == strncmp(inputDataLine, "UV-mapping", 10) ) { - currentMode = EMFModuleMeshUVMapping; - EWOL_VERBOSE(" UV-mapping ..."); - } else if(0 == strncmp(inputDataLine, "Normal(vertex)", 14) ) { - currentMode = EMFModuleMeshNormalVertex; - EWOL_VERBOSE(" Normal(vertex) ..."); - } else if(0 == strncmp(inputDataLine, "Normal(face)", 12) ) { - currentMode = EMFModuleMeshNormalFace; - EWOL_VERBOSE(" Normal(face) ..."); - } else if(0 == strncmp(inputDataLine, "Face", 4) ) { - currentMode = EMFModuleMeshFace; - EWOL_VERBOSE(" Face ..."); - } else if(0 == strncmp(inputDataLine, "Physics", 7) ) { - currentMode = EMFModuleMeshPhysics; - EWOL_VERBOSE(" Physics ..."); - } else { - EWOL_ERROR(" Unknow mesh property '"< 2 - switch (currentMode) { - default: - EWOL_ERROR("Unknow ... "<< level); - jumpEndLine(fileName); - break; - case EMFModuleMeshVertex: { - vec3 vertex(0,0,0); - while (NULL != loadNextData(inputDataLine, 2048, fileName, true, true) ) { - if (inputDataLine[0] == '\0') { - break; - } - sscanf(inputDataLine, "%f %f %f", &vertex.m_floats[0], &vertex.m_floats[1], &vertex.m_floats[2] ); - m_listVertex.push_back(vertex); - int32_t len = strlen(inputDataLine)-1; - if( inputDataLine[len] == '\n' - || inputDataLine[len] == '\r') { - break; - } - } - EWOL_VERBOSE(" " << m_listVertex.size() << " vertex"); - break; - } - case EMFModuleMeshUVMapping: { - vec2 uvMap(0,0); - while (NULL != loadNextData(inputDataLine, 2048, fileName, true, true) ) { - if (inputDataLine[0] == '\0') { - break; - } - sscanf(inputDataLine, "%f %f", &uvMap.m_floats[0], &uvMap.m_floats[1]); - m_listUV.push_back(uvMap); - int32_t len = strlen(inputDataLine)-1; - if( inputDataLine[len] == '\n' - || inputDataLine[len] == '\r') { - break; - } - } - EWOL_VERBOSE(" " << m_listUV.size() << " coord"); - break; - } - case EMFModuleMeshNormalVertex: { - m_normalMode = ewol::Mesh::normalModeVertex; - vec3 normal(0,0,0); - // find the vertex Normal list. - while (NULL != loadNextData(inputDataLine, 2048, fileName, true, true) ) { - if (inputDataLine[0] == '\0') { - break; - } - sscanf(inputDataLine, "%f %f %f", &normal.m_floats[0], &normal.m_floats[1], &normal.m_floats[2] ); - m_listVertexNormal.push_back(normal); - int32_t len = strlen(inputDataLine)-1; - if( inputDataLine[len] == '\n' - || inputDataLine[len] == '\r') { - break; - } - } - EWOL_VERBOSE(" " << m_listVertexNormal.size() << " Normals"); - break; - } - case EMFModuleMeshNormalFace: { - m_normalMode = ewol::Mesh::normalModeFace; - vec3 normal(0,0,0); - // find the face Normal list. - while (NULL != loadNextData(inputDataLine, 2048, fileName, true, true) ) { - if (inputDataLine[0] == '\0') { - break; - } - sscanf(inputDataLine, "%f %f %f", &normal.m_floats[0], &normal.m_floats[1], &normal.m_floats[2] ); - m_listFacesNormal.push_back(normal); - int32_t len = strlen(inputDataLine)-1; - if( inputDataLine[len] == '\n' - || inputDataLine[len] == '\r') { - break; - } - } - EWOL_VERBOSE(" " << m_listFacesNormal.size() << " Normals"); - break; - } - case EMFModuleMeshFace: - case EMFModuleMeshFaceMaterial: - if (level == 3) { - //Find mesh name ... - if (NULL == loadNextData(inputDataLine, 2048, fileName, true)) { - // reach end of file ... - break; - } - removeEndLine(inputDataLine); - // new maretial selection - currentMode = EMFModuleMeshFaceMaterial; - FaceIndexing empty; - m_listFaces.add(inputDataLine, empty); - meshFaceMaterialID = m_listFaces.getId(inputDataLine); - EWOL_VERBOSE(" " << inputDataLine); - } else if (currentMode == EMFModuleMeshFaceMaterial) { - while (NULL != loadNextData(inputDataLine, 2048, fileName, true, true) ) { - if (inputDataLine[0] == '\0') { - // end of line - break; - } - if (meshFaceMaterialID < 0) { - continue; - } - uint32_t vertexIndex[3], uvIndex[3], normalIndex[3]; - vertexIndex[0] = 0; - vertexIndex[1] = 0; - vertexIndex[2] = 0; - uvIndex[0] = 0; - uvIndex[1] = 0; - uvIndex[2] = 0; - normalIndex[0] = 0; - normalIndex[1] = 0; - normalIndex[2] = 0; - scanf(inputDataLine, "%d/%d/%d %d/%d/%d %d/%d/%d", - &vertexIndex[0], &uvIndex[0], &normalIndex[0], - &vertexIndex[1], &uvIndex[1], &normalIndex[1], - &vertexIndex[2], &uvIndex[2], &normalIndex[2] ); - m_listFaces.getValue(meshFaceMaterialID).m_faces.push_back(Face(vertexIndex[0], uvIndex[0], normalIndex[0], - vertexIndex[1], uvIndex[1], normalIndex[1], - vertexIndex[2], uvIndex[2], normalIndex[2])); - /* - EWOL_DEBUG("face :" << vertexIndex[0] << "/" << uvIndex[0] << "/" << normalIndex[0] << - " " << vertexIndex[1] << "/" << uvIndex[1] << "/" << normalIndex[1] << - " " << vertexIndex[2] << "/" << uvIndex[2] << "/" << normalIndex[2]); - */ - int32_t len = strlen(inputDataLine)-1; - if( inputDataLine[len] == '\n' - || inputDataLine[len] == '\r') { - break; - } - } - EWOL_VERBOSE(" " << m_listFaces.getValue(meshFaceMaterialID).m_faces.size() << " faces"); - } else { - // insert element without material ... - EWOL_ERROR(" try to add face without material selection ..."); - jumpEndLine(fileName); - } - break; - case EMFModuleMeshPhysics: - case EMFModuleMeshPhysicsNamed: - if (NULL == loadNextData(inputDataLine, 2048, fileName, true, false, false)) { - // reach end of file ... - break; - } - removeEndLine(inputDataLine); - if (level == 3) { - physics = ewol::PhysicsShape::create(inputDataLine); - if (physics == NULL) { - EWOL_ERROR("Allocation error when creating physical shape ..."); - continue; - } - m_physics.push_back(physics); - EWOL_VERBOSE(" " << m_physics.size() << " " << inputDataLine); - currentMode = EMFModuleMeshPhysicsNamed; - } else if (currentMode == EMFModuleMeshPhysicsNamed) { - if (physics == NULL) { - EWOL_ERROR("Can not parse :'" << inputDataLine << "' in physical shape ..."); - continue; - } - if (false == physics->parse(inputDataLine)) { - EWOL_ERROR("ERROR when parsing :'" << inputDataLine << "' in physical shape ..."); - } - } - break; - } - continue; - } else if (currentMode >= EMFModuleMaterial && currentMode <= EMFModuleMaterial_END) { - // all material element is stored on 1 line (size < 2048) - if (NULL == loadNextData(inputDataLine, 2048, fileName, true)) { - // reach end of file ... - break; - } - removeEndLine(inputDataLine); - if (level == 1) { - // add previous material : - if( materialName != "" - && material!=NULL) { - m_materials.add(materialName, material); - materialName = ""; - material = NULL; - } - material = new ewol::Material(); - materialName = inputDataLine; - currentMode = EMFModuleMaterialNamed; - EWOL_VERBOSE(" "<< materialName); - continue; - } - // level >1 - if (currentMode != EMFModuleMaterialNamed) { - EWOL_WARNING(" Unknow element ..."<< level); - jumpEndLine(fileName); - continue; - } - if (NULL == material) { - EWOL_ERROR("material allocation error"); - jumpEndLine(fileName); - continue; - } - if(0 == strncmp(inputDataLine,"Ns ",3)) { - float tmpVal=0; - sscanf(&inputDataLine[3], "%f", &tmpVal); - material->setShininess(tmpVal); - EWOL_VERBOSE(" Shininess " << tmpVal); - } else if(0 == strncmp(inputDataLine,"Ka ",3)) { - float tmpVal1=0; - float tmpVal2=0; - float tmpVal3=0; - sscanf(&inputDataLine[3], "%f %f %f", &tmpVal1, &tmpVal2, &tmpVal3); - vec4 tmp(tmpVal1, tmpVal2, tmpVal3, 1); - material->setAmbientFactor(tmp); - EWOL_VERBOSE(" AmbientFactor " << tmp); - } else if(0 == strncmp(inputDataLine,"Kd ",3)) { - float tmpVal1=0; - float tmpVal2=0; - float tmpVal3=0; - sscanf(&inputDataLine[3], "%f %f %f", &tmpVal1, &tmpVal2, &tmpVal3); - vec4 tmp(tmpVal1, tmpVal2, tmpVal3, 1); - material->setDiffuseFactor(tmp); - EWOL_VERBOSE(" DiffuseFactor " << tmp); - } else if(0 == strncmp(inputDataLine,"Ks ",3)) { - float tmpVal1=0; - float tmpVal2=0; - float tmpVal3=0; - sscanf(&inputDataLine[3], "%f %f %f", &tmpVal1, &tmpVal2, &tmpVal3); - vec4 tmp(tmpVal1, tmpVal2, tmpVal3, 1); - material->setSpecularFactor(tmp); - EWOL_VERBOSE(" SpecularFactor " << tmp); - } else if(0 == strncmp(inputDataLine,"Ni ",3)) { - float tmpVal=0; - sscanf(&inputDataLine[3], "%f", &tmpVal); - // TODO : ... - EWOL_VERBOSE(" Ni " << tmpVal); - } else if(0 == strncmp(inputDataLine,"d ",2)) { - float tmpVal=0; - sscanf(&inputDataLine[2], "%f", &tmpVal); - // TODO : ... - EWOL_VERBOSE(" d " << tmpVal); - } else if(0 == strncmp(inputDataLine,"illum ",6)) { - int tmpVal=0; - sscanf(&inputDataLine[6], "%d", &tmpVal); - // TODO : ... - EWOL_VERBOSE(" illum " << tmpVal); - } else if(0 == strncmp(inputDataLine,"map_Kd ",7)) { - material->setTexture0(fileName.getRelativeFolder() + &inputDataLine[7]); - EWOL_VERBOSE(" Texture " << &inputDataLine[7]); - } else { - EWOL_ERROR("unknow material property ... : '" << inputDataLine << "'"); - } - } else { - // unknow ... - EWOL_WARNING("Unknow type of line == > jump end of line ... "); - jumpEndLine(fileName); - } - } - } - // add last material ... - if( materialName != "" - && material!=NULL) { - m_materials.add(materialName, material); - materialName = ""; - material = NULL; - } - EWOL_VERBOSE("Stop parsing Mesh file"); - - fileName.fileClose(); - generateVBO(); - return true; -} - -void ewol::resource::Mesh::addMaterial(const std::string& _name, ewol::Material* _data) { - if (NULL == _data) { - EWOL_ERROR(" can not add material with null pointer"); - return; - } - if (_name == "") { - EWOL_ERROR(" can not add material with no name"); - return; - } - // really add the material : - m_materials.add(_name, _data); -} - -void ewol::resource::Mesh::setShape(void* _shape) { - if (m_functionFreeShape!=NULL) { - m_functionFreeShape(m_pointerShape); - m_pointerShape = NULL; - } - m_pointerShape=_shape; -} - -ewol::resource::Mesh* ewol::resource::Mesh::keep(const std::string& _meshName) { - ewol::resource::Mesh* object = static_cast(getManager().localKeep(_meshName)); - if (NULL != object) { - return object; - } - EWOL_DEBUG("CREATE: Mesh: '" << _meshName << "'"); - object = new ewol::resource::Mesh(_meshName); - if (NULL == object) { - EWOL_ERROR("allocation error of a resource : ??Mesh??" << _meshName); - return NULL; - } - getManager().localAdd(object); - return object; -} - -void ewol::resource::Mesh::release(ewol::Mesh*& _object) { - if (NULL == _object) { - return; - } - ewol::resource::Resource* object2 = static_cast(_object); - getManager().release(object2); - _object = NULL; -} diff --git a/sources/ewol/resources/Mesh.h b/sources/ewol/resources/Mesh.h deleted file mode 100644 index 0268556a..00000000 --- a/sources/ewol/resources/Mesh.h +++ /dev/null @@ -1,169 +0,0 @@ -/** - * @author Edouard DUPIN - * - * @copyright 2011, Edouard DUPIN, all right reserved - * - * @license BSD v3 (see license file) - */ - -#ifndef __MESH_H__ -#define __MESH_H__ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -// 3 "float" elements -#define MESH_VBO_VERTICES (0) -// 2 "float" elements -#define MESH_VBO_TEXTURE (1) -// 3 "float" elements -#define MESH_VBO_VERTICES_NORMAL (2) -// Face normal position : -#define MESH_VBO_FACE_NORMAL (3) -// 4 "float" elements -#define MESH_VBO_COLOR (4) - -namespace ewol { - namespace resource { - class Face { - public: - int32_t m_vertex[3]; - int32_t m_uv[3]; - int32_t m_normal[3]; - public: - Face(void) {}; - Face(int32_t v1, int32_t t1, - int32_t v2, int32_t t2, - int32_t v3, int32_t t3) { - m_vertex[0] = v1; - m_vertex[1] = v2; - m_vertex[2] = v3; - m_uv[0] = t1; - m_uv[1] = t2; - m_uv[2] = t3; - m_normal[0] = -1; - m_normal[1] = -1; - m_normal[2] = -1; - }; - Face(int32_t v1, int32_t t1, int32_t n1, - int32_t v2, int32_t t2, int32_t n2, - int32_t v3, int32_t t3, int32_t n3) { - m_vertex[0] = v1; - m_vertex[1] = v2; - m_vertex[2] = v3; - m_uv[0] = t1; - m_uv[1] = t2; - m_uv[2] = t3; - m_normal[0] = n1; - m_normal[1] = n2; - m_normal[2] = n3; - }; - }; - class FaceIndexing { - public: - std::vector m_faces; - std::vector m_index; - }; - class Mesh : public ewol::resource::Resource { - public: - enum normalMode { - normalModeNone, - normalModeFace, - normalModeVertex, - }; - protected: - enum normalMode m_normalMode; // select the normal mode of display - bool m_checkNormal; //!< when enable, this check the normal of the mesh before sending it at the 3d card - protected: - ewol::Program* m_GLprogram; - int32_t m_GLPosition; - int32_t m_GLMatrix; - int32_t m_GLMatrixPosition; - int32_t m_GLNormal; - int32_t m_GLtexture; - int32_t m_bufferOfset; - int32_t m_numberOfElments; - MaterialGlId m_GLMaterial; - ewol::Light m_light; - protected: - std::vector m_listVertex; //!< List of all vertex in the element - std::vector m_listUV; //!< List of all UV point in the mesh (for the specify texture) - std::vector m_listFacesNormal; //!< List of all Face normal, when calculated - std::vector m_listVertexNormal; //!< List of all Face normal, when calculated - etk::Hash m_listFaces; //!< List of all Face for the mesh - etk::Hash m_materials; - std::vector m_physics; //!< collision shape module ... (independent of bullet lib) - protected: - ewol::VirtualBufferObject* m_verticesVBO; - protected: - Mesh(const std::string& _fileName, const std::string& _shaderName="DATA:textured3D2.prog"); - virtual ~Mesh(void); - public: - virtual const char* getType(void) { return "ewol::Mesh"; }; - virtual void draw(mat4& _positionMatrix, bool _enableDepthTest=true, bool _enableDepthUpdate=true); - void generateVBO(void); - private: - void calculateNormaleFace(void); - void calculateNormaleEdge(void); - public : - void createViewBox(const std::string& _materialName,float _size=1.0); - private: - bool loadOBJ(const std::string& _fileName); - bool loadEMF(const std::string& _fileName); - public: - void addMaterial(const std::string& _name, ewol::Material* _data); - public: - /** - * @brief set the check of normal position befor sending it to the openGl card - * @param[in] _status New state. - */ - void setCheckNormal(bool _status) { m_checkNormal=_status; }; - /** - * @brief get the check value of normal position befor sending it to the openGl card - * @return get the chcking stus of normal or not - */ - bool getCheckNormal(void) { return m_checkNormal; }; - const std::vector& getPhysicalProperties(void) const { return m_physics; }; - private: - void* m_pointerShape; //!< all mesh have a basic shape (bullet or other) the void pointer mermit to not depent on the bullet lib - public: - /** - * @brief set the shape pointer (no type == > user might know it ...) - * @param[in] _shape The new shape (this remove the previous one) - */ - void setShape(void* _shape); - /** - * @brief get the pointer on the shame (no type) - * @return Pointer on shape. - */ - void* getShape(void) { return m_pointerShape; }; - private: - void (*m_functionFreeShape)(void* _pointer); - public: - void setFreeShapeFunction(void (*_functionFreeShape)(void* _pointer)) { m_functionFreeShape = _functionFreeShape; }; - public: - /** - * @brief keep the resource pointer. - * @note Never free this pointer by your own... - * @param[in] _filename Name of the ewol mesh file. - * @return pointer on the resource or NULL if an error occured. - */ - static ewol::Mesh* keep(const std::string& _meshname); - /** - * @brief release the keeped resources - * @param[in,out] reference on the object pointer - */ - static void release(ewol::Mesh*& _object); - }; - }; -}; - - -#endif diff --git a/sources/ewol/resources/Resource.h b/sources/ewol/resources/Resource.h deleted file mode 100644 index 48cadeea..00000000 --- a/sources/ewol/resources/Resource.h +++ /dev/null @@ -1,73 +0,0 @@ -/** - * @author Edouard DUPIN - * - * @copyright 2011, Edouard DUPIN, all right reserved - * - * @license BSD v3 (see license file) - */ - - -#ifndef __RESOURCES_H__ -#define __RESOURCES_H__ - -#include -#include -#include -#include - -#define MAX_RESOURCE_LEVEL (5) - -namespace ewol { - namespace resource { - class Manager; - // class resources is pure virtual - class Resource : public ewol::EObject { - public: - Resource(void) : - m_counter(1), - m_resourceLevel(MAX_RESOURCE_LEVEL-1) { - addObjectType("ewol::Resource"); - setStatusResource(true); - }; - Resource(const std::string& _name) : - ewol::EObject(_name), - m_counter(1), - m_resourceLevel(MAX_RESOURCE_LEVEL-1) { - addObjectType("ewol::Resource"); - setStatusResource(true); - }; - virtual ~Resource(void) { - - }; - private: - uint32_t m_counter; //!< number of time the element was loaded. - public: - void increment(void) { - m_counter++; - }; - bool decrement(void) { - m_counter--; - return (m_counter == 0)?true:false; - }; - int32_t getCounter(void) { - return m_counter; - }; - protected: - uint8_t m_resourceLevel; //!< Level of the resource ==> for updata priority [0..5] 0 must be update first. - public: - uint8_t getResourceLevel(void) { - return m_resourceLevel; - }; - virtual void updateContext(void); - virtual void removeContext(void); - virtual void removeContextToLate(void); - virtual void reload(void); - static ewol::resource::Manager& getManager(void); - }; - }; -}; - - - -#endif - diff --git a/sources/ewol/resources/font/GlyphProperty.h b/sources/ewol/resources/font/GlyphProperty.h deleted file mode 100644 index cf8b762c..00000000 --- a/sources/ewol/resources/font/GlyphProperty.h +++ /dev/null @@ -1,108 +0,0 @@ -/** - * @author Edouard DUPIN - * - * @copyright 2011, Edouard DUPIN, all right reserved - * - * @license BSD v3 (see license file) - */ - -#ifndef __EWOL_FONT_GLYPH_PROPERTY_H__ -#define __EWOL_FONT_GLYPH_PROPERTY_H__ - -#include - - -namespace ewol { - namespace resource { - /* - | | | | - | | | | - | | | | - Y | | | | - ^ |------------| |------------| - | - m_advance.y:/-> | - | | - | | - m_sizeTex.x/-> | | |------------| |------------| - | | | | | | | - | | | | | | | - | | | | | | | - | | | | | | | - | | | | A | | G | - | | | | | | | - | | | | | | | - | | | | | | | - | | | | | | | - \-> | | |------------| |------------| - /--> | | - \--> \-> | - m_bearing.y | - |____*________________________*____________>> X - - - <------------------------> : m_advance.x - - <------------> : m_sizeTexture.x - - <---> : m_bearing.x - - */ - - class GlyphProperty { - public: - char32_t m_UVal; //!< Unicode value - private: - bool m_exist; - public: - int32_t m_glyphIndex; //!< Glyph index in the system - ivec2 m_sizeTexture; //!< size of the element to display - ivec2 m_bearing; //!< offset to display the data (can be negatif id the texture sise is bigger than the theoric places in the string) - ivec2 m_advance; //!< space use in the display for this specific char - vec2 m_texturePosStart; //!< Texture normalised position (START) - vec2 m_texturePosSize; //!< Texture normalised position (SIZE) - private: - std::vector m_kerning; //!< kerning values of link of all elements - public: - GlyphProperty(void) : - m_UVal(0), - m_exist(true), - m_glyphIndex(0), - m_sizeTexture(0,0), - m_bearing(0,0), - m_advance(0,0), - m_texturePosStart(0,0), - m_texturePosSize(0,0) { - - }; - float kerningGet(const char32_t _charcode) { - for(size_t iii=0; iii #include #include -#include +#include extern const char * const ewolEventImagePressed; diff --git a/sources/ewol/widget/WidgetManager.cpp b/sources/ewol/widget/Manager.cpp similarity index 100% rename from sources/ewol/widget/WidgetManager.cpp rename to sources/ewol/widget/Manager.cpp diff --git a/sources/ewol/widget/WidgetManager.h b/sources/ewol/widget/Manager.h similarity index 100% rename from sources/ewol/widget/WidgetManager.h rename to sources/ewol/widget/Manager.h diff --git a/sources/ewol/widget/Mesh.cpp b/sources/ewol/widget/Mesh.cpp deleted file mode 100644 index 7ecd8969..00000000 --- a/sources/ewol/widget/Mesh.cpp +++ /dev/null @@ -1,133 +0,0 @@ -/** - * @author Edouard DUPIN - * - * @copyright 2011, Edouard DUPIN, all right reserved - * - * @license BSD v3 (see license file) - */ - -#include -#include -#include - - -extern const char * const ewolEventMeshPressed = "ewol-mesh-Pressed"; - -#undef __class__ -#define __class__ "Mesh" - - - -ewol::widget::Mesh::Mesh(const std::string& _filename) : - m_meshName(_filename), - m_object(NULL), - m_position(0,0,0), - m_angle(0,0,0), - m_angleSpeed(0,0,0), - m_cameraDistance(10.0) { - addObjectType("ewol::widget::Mesh"); - addEventId(ewolEventMeshPressed); - // Limit event at 1: - setMouseLimit(1); - if (_filename!="") { - m_object = ewol::Mesh::keep(m_meshName); - if (NULL == m_object) { - EWOL_ERROR("Can not load the resource : \"" << m_meshName << "\""); - } - } -} - -ewol::widget::Mesh::~Mesh(void) { - ewol::Mesh::release(m_object); -} - -void ewol::widget::Mesh::onDraw(void) { - mat4 transformationMatrix = etk::matTranslate(vec3(0,0,-m_cameraDistance)) - * etk::matTranslate(m_position) - * etk::matRotate(vec3(1,0,0),m_angle.x()) - * etk::matRotate(vec3(0,1,0),m_angle.y()) - * etk::matRotate(vec3(0,0,1),m_angle.z()); - if (NULL != m_object) { - m_object->draw(transformationMatrix); - } -} - -void ewol::widget::Mesh::systemDraw(const ewol::DrawProperty& _displayProp) { - ewol::openGL::push(); - // here we invert the reference of the standard openGl view because the reference in the common display is Top left and not buttom left - glViewport( m_origin.x(), - m_origin.y(), - m_size.x(), - m_size.y()); - float ratio = m_size.x() / m_size.y(); - //EWOL_INFO("ratio : " << ratio); - mat4 tmpProjection = etk::matPerspective(M_PI/3.0, ratio, 0.5, 100); - //mat4 tmpMat = tmpProjection * m_camera.getMatrix(); - // set internal matrix system : - //ewol::openGL::setMatrix(tmpMat); - ewol::openGL::setMatrix(tmpProjection); - - onDraw(); - ewol::openGL::pop(); -} - -void ewol::widget::Mesh::onRegenerateDisplay(void) { - if (true == needRedraw()) { - - } -} - -void ewol::widget::Mesh::periodicCall(const ewol::EventTime& _event) { - m_angle += m_angleSpeed*_event.getDeltaCall(); - markToRedraw(); -} - -bool ewol::widget::Mesh::onEventInput(const ewol::EventInput& _event) { - //EWOL_DEBUG("Event on BT ..."); - if (1 == _event.getId()) { - if(ewol::keyEvent::statusSingle == _event.getStatus()) { - generateEventId(ewolEventMeshPressed); - return true; - } - } - return false; -} - -void ewol::widget::Mesh::setFile(const std::string& _filename) { - if( _filename!="" - && m_meshName != _filename ) { - ewol::Mesh::release(m_object); - m_meshName = _filename; - m_object = ewol::Mesh::keep(m_meshName); - if (NULL == m_object) { - EWOL_ERROR("Can not load the resource : \"" << m_meshName << "\""); - } - } - markToRedraw(); -} - -void ewol::widget::Mesh::setPosition(const vec3& _pos) { - m_position = _pos; - markToRedraw(); -} - -void ewol::widget::Mesh::setAngle(const vec3& _angle) { - m_angle = _angle; - markToRedraw(); -} - -void ewol::widget::Mesh::setAngleSpeed(const vec3& _speed) { - if (_speed!=vec3(0,0,0)) { - periodicCallEnable(); - } else { - periodicCallDisable(); - } - m_angleSpeed = _speed; - markToRedraw(); -} - -void ewol::widget::Mesh::setDistance(float _distance) -{ - m_cameraDistance = _distance; - markToRedraw(); -} diff --git a/sources/ewol/widget/Mesh.h b/sources/ewol/widget/Mesh.h deleted file mode 100644 index 99d584bd..00000000 --- a/sources/ewol/widget/Mesh.h +++ /dev/null @@ -1,74 +0,0 @@ -/** - * @author Edouard DUPIN - * - * @copyright 2011, Edouard DUPIN, all right reserved - * - * @license BSD v3 (see license file) - */ - -#ifndef __EWOL_WIDGET_MESH_H__ -#define __EWOL_WIDGET_MESH_H__ - -#include -#include -#include - -extern const char * const ewolEventMeshPressed; - - -namespace ewol { - namespace widget { - /** - * @ingroup ewolWidgetGroup - */ - class Mesh :public ewol::Widget { - private: - // mesh name : - std::string m_meshName; - ewol::Mesh* m_object; - // mesh display properties: - vec3 m_position; - vec3 m_angle; - vec3 m_angleSpeed; - float m_cameraDistance; - public: - Mesh(const std::string& filename); // automatic considering in the appl Data older - virtual ~Mesh(void); - public: // Derived function - virtual void onRegenerateDisplay(void); - virtual void systemDraw(const ewol::DrawProperty& displayProp); - virtual void onDraw(void); - virtual bool onEventInput(const ewol::EventInput& _event); - virtual void periodicCall(const ewol::EventTime& _event); - public: - /** - * @brief set a mesh name file - * @param[in] filename Name of the new mesh - */ - void setFile(const std::string& filename); - /** - * @brief set the mesh position - * @param[in] pos The new position of the mesh - */ - void setPosition(const vec3& pos); - /** - * @brief set the mesh angle of view - * @param[in] angle view angle of the mesh - */ - void setAngle(const vec3& angle); - /** - * @brief set the mesh angle speed - * @param[in] spped radian speed of the mesh - */ - void setAngleSpeed(const vec3& speed); - /** - * @brief set the camera distance of the mesh - * @param[in] dist Diatance of the mesh - */ - void setDistance(float distance); - }; - }; -}; - - -#endif diff --git a/sources/ewol/widget/Widget.h b/sources/ewol/widget/Widget.h index e1b45873..a3ed33b9 100644 --- a/sources/ewol/widget/Widget.h +++ b/sources/ewol/widget/Widget.h @@ -9,8 +9,8 @@ #ifndef __EWOL_WIDGET_H__ #define __EWOL_WIDGET_H__ -#include -#include +#include +#include namespace ewol { class Widget; @@ -23,755 +23,759 @@ namespace ewol { #include #include #include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include #define ULTIMATE_MAX_SIZE (99999999) namespace ewol { - //namespace widget { - class DrawProperty{ - /* - /--> m_windowsSize - *--------------------------------------------------* - | g | - | | - | m_size | - | / | - | o-------------------o | - | | | | - | | | | - | | | | - | | | | - | | | | - | | | | - | | | | - | | | | - | o-------------------o | - | / | - | m_origin | - | | - *--------------------------------------------------* - / - (0,0) - */ - public : - ivec2 m_windowsSize; //!< Windows compleate size - ivec2 m_origin; //!< Windows clipping upper widget (can not be <0) - ivec2 m_size; //!< Windows clipping upper widget (can not be <0 and >m_windowsSize) - void limit(const vec2& _origin, const vec2& _size); - }; - etk::CCout& operator <<(etk::CCout& _os, const ewol::DrawProperty& _obj); - /** - * @brief Gravity of the widget property + /** + * @not-in-doc + */ + class DrawProperty{ + /* + /--> m_windowsSize + *--------------------------------------------------* + | g | + | | + | m_size | + | / | + | o-------------------o | + | | | | + | | | | + | | | | + | | | | + | | | | + | | | | + | | | | + | | | | + | o-------------------o | + | / | + | m_origin | + | | + *--------------------------------------------------* + / + (0,0) */ - enum gravity { - gravityCenter=0x00, //!< gravity is in certer - gravityTopLeft=0x05, - gravityTop=0x01, - gravityTopRight=0x03, - gravityRight=0x02, - gravityButtomRight=0x06, - gravityButtom=0x04, - gravityButtomLeft=0x0C, - gravityLeft=0x08, - }; - etk::CCout& operator <<(etk::CCout& _os, const enum ewol::gravity _obj); - std::string gravityToString(const enum ewol::gravity _obj); - enum ewol::gravity stringToGravity(const std::string& _obj); + public : + ivec2 m_windowsSize; //!< Windows compleate size + ivec2 m_origin; //!< Windows clipping upper widget (can not be <0) + ivec2 m_size; //!< Windows clipping upper widget (can not be <0 and >m_windowsSize) + void limit(const vec2& _origin, const vec2& _size); + }; + etk::CCout& operator <<(etk::CCout& _os, const ewol::DrawProperty& _obj); + /** + * @brief Gravity of the widget property + * @not-in-doc + */ + enum gravity { + gravityCenter=0x00, //!< gravity is in certer + gravityTopLeft=0x05, + gravityTop=0x01, + gravityTopRight=0x03, + gravityRight=0x02, + gravityButtomRight=0x06, + gravityButtom=0x04, + gravityButtomLeft=0x0C, + gravityLeft=0x08, + }; + etk::CCout& operator <<(etk::CCout& _os, const enum ewol::gravity _obj); + std::string gravityToString(const enum ewol::gravity _obj); + enum ewol::gravity stringToGravity(const std::string& _obj); + /** + * @not-in-doc + */ + class EventShortCut { + public: + bool broadcastEvent; //!< if it is true, then the message is sent to all the system + const char* generateEventId; //!< Local generated event + std::string eventData; //!< data link with the event + ewol::key::Special specialKey; //!< special board key + char32_t unicodeValue; //!< 0 if not used + enum ewol::key::keyboard keyboardMoveValue; //!< ewol::EVENT_KB_MOVE_TYPE_NONE if not used + EventShortCut(void) { + broadcastEvent = false; + generateEventId = NULL; + eventData = ""; + unicodeValue = 0; + keyboardMoveValue = ewol::key::keyboardUnknow; + }; + ~EventShortCut(void) { }; + }; + /** + * @ingroup ewolWidgetGroup + */ + class Widget : public ewol::Object { + public: + // Config list of properties + static const char* const configFill; + static const char* const configExpand; + static const char* const configHide; + static const char* const configFocus; + static const char* const configMinSize; + static const char* const configMaxSize; + static const char* const configGravity; + public: + /** + * @brief Constructor of the widget classes + * @return (no execption generated (not managed in embended platform)) + */ + Widget(void); + /** + * @brief Destructor of the widget classes + */ + virtual ~Widget(void); + // ---------------------------------------------------------------------------------------------------------------- + // -- Hierarchy management: + // ---------------------------------------------------------------------------------------------------------------- + protected: + ewol::Widget* m_up; //!< uppper widget in the tree of widget + public: + /** + * @brief set the upper widget of this widget. + * @param[in] _upper Father widget (only keep the last and write error if a previous was set) == > disable with NULL. + */ + void setUpperWidget(ewol::Widget* _upper); + /** + * @brief remove the upper widget of this widget. + */ + void removeUpperWidget(void) { + setUpperWidget(NULL); + }; + /** + * @brief get the upper widget (father). + * @ return the requested widget (if NULL , 2 case : root widget or error implementation). + */ + ewol::Widget* getUpperWidget(void) { + return m_up; + }; + // ---------------------------------------------------------------------------------------------------------------- + // -- Widget size: + // ---------------------------------------------------------------------------------------------------------------- + protected: + vec2 m_size; //!< internal : current size of the widget + vec2 m_minSize; //!< internal : minimum size of the widget + vec2 m_maxSize; //!< internal : maximum size of the widget + public: + /** + * @brief convert the absolute position in the local Position (Relative) + * @param[in] _pos Absolute position that you request convertion + * @return the relative position + */ + virtual vec2 relativePosition(const vec2& _pos); + /** + * @brief Parent set the possible diplay size of the current widget whith his own possibilities + * By default this save the widget available size in the widget size + * @param[in] _available Available x&y pixel size + * @note : INTERNAL EWOL SYSTEM + */ + virtual void calculateSize(const vec2& _available); + /** + * @brief get the widget size + * @return Requested size + * @note : INTERNAL EWOL SYSTEM + */ + virtual vec2 getSize(void); + /** + * @brief calculate the minimum and maximum size (need to estimate expend properties of the widget) + * @note : INTERNAL EWOL SYSTEM + */ + virtual void calculateMinMaxSize(void); + /** + * @brief get the widget minimum size calculated + * @return Requested size + * @note : INTERNAL EWOL SYSTEM + */ + virtual vec2 getCalculateMinSize(void); + /** + * @brief get the widget maximum size calculated + * @return Requested size + * @note : INTERNAL EWOL SYSTEM + */ + virtual vec2 getCalculateMaxSize(void); + protected: + vec2 m_offset; //!< Offset of the display in the viewport + public: + /** + * @brief set the zoom property of the widget. + * @param[in] _newVal offset value. + */ + virtual void setOffset(const vec2& _newVal); + /** + * @brief get the offset property of the widget. + * @return The current offset value. + */ + virtual const vec2& getOffset(void) { + return m_offset; + }; + protected: + // internal element calculated by the system + float m_zoom; //!< generic widget zoom + public: + /** + * @brief set the zoom property of the widget + * @param[in] _newVal newZoom value + */ + virtual void setZoom(float _newVal); + /** + * @brief get the zoom property of the widget + * @return the current zoom value + */ + virtual float getZoom(void); + protected: + vec2 m_origin; //!< internal ... I do not really known how i can use it ... + public: + /** + * @brief set origin at the widget (must be an parrent widget that set this parameter). + * This represent the absolute origin in the program windows + * @param[in] _pos Position of the origin + * @note : INTERNAL EWOL SYSTEM + */ + virtual void setOrigin(const vec2& _pos); + /** + * @brief get the origin (obsolute position in the windows) + * @return coordonate of the origin requested + */ + virtual vec2 getOrigin(void); + protected: + ewol::Dimension m_userMinSize; //!< user define the minimum size of the widget + public: + /** + * @brief User set the minimum size he want to set the display + * @param[in] _size set minimum size (none : 0) + */ + void setMinSize(const ewol::Dimension& _size); + /** + * @brief User set No minimum size. + */ + void setNoMinSize(void); + /** + * @brief get the current calculated min size + * @return the size requested + */ + const ewol::Dimension& getMinSize(void) { + return m_userMinSize; + }; + /** + * @brief Check if the current min size is compatible with the user minimum size + * If it is not the user minimum size will overWrite the minimum size set. + * @note : INTERNAL EWOL SYSTEM + */ + virtual void checkMinSize(void); + protected: + ewol::Dimension m_userMaxSize; //!< user define the maximum size of the widget + public: + /** + * @brief User set the maximum size he want to set the display + * @param[in] _size The new maximum size requested (vec2(0,0) to unset) + */ + void setMaxSize(const ewol::Dimension& _size); + /** + * @brief User set No maximum size. + */ + void setNoMaxSize(void); + /** + * @brief get the current maximum size + * @return the size requested + */ + const ewol::Dimension& getMaxSize(void) { + return m_userMaxSize; + }; + /** + * @brief Check if the current max size is compatible with the user maximum size + * If it is not the user maximum size will overWrite the maximum size set. + * @note : INTERNAL EWOL SYSTEM + */ + virtual void checkMaxSize(void); + protected: + bvec2 m_userExpand; + public: + /** + * @brief set the expend capabilities (x&y) + * @param[in] _newExpend 2D boolean repensent the capacity to expend + */ + virtual void setExpand(const bvec2& _newExpand); + /** + * @brief get the expend capabilities (x&y) (set by the user) + * @return 2D boolean repensent the capacity to expend + */ + virtual bvec2 getExpand(void) { + return m_userExpand; + }; + /** + * @brief get the expend capabilities (x&y) + * @return 2D boolean repensent the capacity to expend + * @note : INTERNAL EWOL SYSTEM + */ + virtual bvec2 canExpand(void); + protected: + bvec2 m_userFill; + public: + /** + * @brief set the x&y filling capacity + * @param[in] _newFill new x&y fill state + */ + virtual void setFill(const bvec2& _newFill); + /** + * @brief set the x&y filling capacity set by the user + * @return bvec2 repensent the capacity to x&y filling (set by the user) + */ + virtual const bvec2& getFill(void) { + return m_userFill; + }; + /** + * @brief get the filling capabilities x&y + * @return bvec2 repensent the capacity to x&y filling + * @note : INTERNAL EWOL SYSTEM + */ + const bvec2& canFill(void); + protected: + bool m_hide; //!< hide a widget on the display + public: + /** + * @brief set the widget hidden + */ + virtual void hide(void); + /** + * @brief set the widget visible + */ + virtual void show(void); + /** + * @brief get the visibility of the widget + * @return true: if the widget is hiden, false: it is visible + */ + virtual bool isHide(void) { + return m_hide; + }; - class EventShortCut { - public: - bool broadcastEvent; //!< if it is true, then the message is sent to all the system - const char* generateEventId; //!< Local generated event - std::string eventData; //!< data link with the event - ewol::SpecialKey specialKey; //!< special board key - char32_t unicodeValue; //!< 0 if not used - enum ewol::keyEvent::keyboard keyboardMoveValue; //!< ewol::EVENT_KB_MOVE_TYPE_NONE if not used - EventShortCut(void) { - broadcastEvent = false; - generateEventId = NULL; - eventData = ""; - unicodeValue = 0; - keyboardMoveValue = ewol::keyEvent::keyboardUnknow; - }; - ~EventShortCut(void) { }; - }; - /** - * @ingroup ewolWidgetGroup - */ - class Widget : public ewol::EObject { - public: - // Config list of properties - static const char* const configFill; - static const char* const configExpand; - static const char* const configHide; - static const char* const configFocus; - static const char* const configMinSize; - static const char* const configMaxSize; - static const char* const configGravity; - public: - /** - * @brief Constructor of the widget classes - * @return (no execption generated (not managed in embended platform)) - */ - Widget(void); - /** - * @brief Destructor of the widget classes - */ - virtual ~Widget(void); - // ---------------------------------------------------------------------------------------------------------------- - // -- Hierarchy management: - // ---------------------------------------------------------------------------------------------------------------- - protected: - ewol::Widget* m_up; //!< uppper widget in the tree of widget - public: - /** - * @brief set the upper widget of this widget. - * @param[in] _upper Father widget (only keep the last and write error if a previous was set) == > disable with NULL. - */ - void setUpperWidget(ewol::Widget* _upper); - /** - * @brief remove the upper widget of this widget. - */ - void removeUpperWidget(void) { - setUpperWidget(NULL); - }; - /** - * @brief get the upper widget (father). - * @ return the requested widget (if NULL , 2 case : root widget or error implementation). - */ - ewol::Widget* getUpperWidget(void) { - return m_up; - }; - // ---------------------------------------------------------------------------------------------------------------- - // -- Widget size: - // ---------------------------------------------------------------------------------------------------------------- - protected: - vec2 m_size; //!< internal : current size of the widget - vec2 m_minSize; //!< internal : minimum size of the widget - vec2 m_maxSize; //!< internal : maximum size of the widget - public: - /** - * @brief convert the absolute position in the local Position (Relative) - * @param[in] _pos Absolute position that you request convertion - * @return the relative position - */ - virtual vec2 relativePosition(const vec2& _pos); - /** - * @brief Parent set the possible diplay size of the current widget whith his own possibilities - * By default this save the widget available size in the widget size - * @param[in] _available Available x&y pixel size - * @note : INTERNAL EWOL SYSTEM - */ - virtual void calculateSize(const vec2& _available); - /** - * @brief get the widget size - * @return Requested size - * @note : INTERNAL EWOL SYSTEM - */ - virtual vec2 getSize(void); - /** - * @brief calculate the minimum and maximum size (need to estimate expend properties of the widget) - * @note : INTERNAL EWOL SYSTEM - */ - virtual void calculateMinMaxSize(void); - /** - * @brief get the widget minimum size calculated - * @return Requested size - * @note : INTERNAL EWOL SYSTEM - */ - virtual vec2 getCalculateMinSize(void); - /** - * @brief get the widget maximum size calculated - * @return Requested size - * @note : INTERNAL EWOL SYSTEM - */ - virtual vec2 getCalculateMaxSize(void); - protected: - vec2 m_offset; //!< Offset of the display in the viewport - public: - /** - * @brief set the zoom property of the widget. - * @param[in] _newVal offset value. - */ - virtual void setOffset(const vec2& _newVal); - /** - * @brief get the offset property of the widget. - * @return The current offset value. - */ - virtual const vec2& getOffset(void) { - return m_offset; - }; - protected: - // internal element calculated by the system - float m_zoom; //!< generic widget zoom - public: - /** - * @brief set the zoom property of the widget - * @param[in] _newVal newZoom value - */ - virtual void setZoom(float _newVal); - /** - * @brief get the zoom property of the widget - * @return the current zoom value - */ - virtual float getZoom(void); - protected: - vec2 m_origin; //!< internal ... I do not really known how i can use it ... - public: - /** - * @brief set origin at the widget (must be an parrent widget that set this parameter). - * This represent the absolute origin in the program windows - * @param[in] _pos Position of the origin - * @note : INTERNAL EWOL SYSTEM - */ - virtual void setOrigin(const vec2& _pos); - /** - * @brief get the origin (obsolute position in the windows) - * @return coordonate of the origin requested - */ - virtual vec2 getOrigin(void); - protected: - ewol::Dimension m_userMinSize; //!< user define the minimum size of the widget - public: - /** - * @brief User set the minimum size he want to set the display - * @param[in] _size set minimum size (none : 0) - */ - void setMinSize(const ewol::Dimension& _size); - /** - * @brief User set No minimum size. - */ - void setNoMinSize(void); - /** - * @brief get the current calculated min size - * @return the size requested - */ - const ewol::Dimension& getMinSize(void) { - return m_userMinSize; - }; - /** - * @brief Check if the current min size is compatible with the user minimum size - * If it is not the user minimum size will overWrite the minimum size set. - * @note : INTERNAL EWOL SYSTEM - */ - virtual void checkMinSize(void); - protected: - ewol::Dimension m_userMaxSize; //!< user define the maximum size of the widget - public: - /** - * @brief User set the maximum size he want to set the display - * @param[in] _size The new maximum size requested (vec2(0,0) to unset) - */ - void setMaxSize(const ewol::Dimension& _size); - /** - * @brief User set No maximum size. - */ - void setNoMaxSize(void); - /** - * @brief get the current maximum size - * @return the size requested - */ - const ewol::Dimension& getMaxSize(void) { - return m_userMaxSize; - }; - /** - * @brief Check if the current max size is compatible with the user maximum size - * If it is not the user maximum size will overWrite the maximum size set. - * @note : INTERNAL EWOL SYSTEM - */ - virtual void checkMaxSize(void); - protected: - bvec2 m_userExpand; - public: - /** - * @brief set the expend capabilities (x&y) - * @param[in] _newExpend 2D boolean repensent the capacity to expend - */ - virtual void setExpand(const bvec2& _newExpand); - /** - * @brief get the expend capabilities (x&y) (set by the user) - * @return 2D boolean repensent the capacity to expend - */ - virtual bvec2 getExpand(void) { - return m_userExpand; - }; - /** - * @brief get the expend capabilities (x&y) - * @return 2D boolean repensent the capacity to expend - * @note : INTERNAL EWOL SYSTEM - */ - virtual bvec2 canExpand(void); - protected: - bvec2 m_userFill; - public: - /** - * @brief set the x&y filling capacity - * @param[in] _newFill new x&y fill state - */ - virtual void setFill(const bvec2& _newFill); - /** - * @brief set the x&y filling capacity set by the user - * @return bvec2 repensent the capacity to x&y filling (set by the user) - */ - virtual const bvec2& getFill(void) { - return m_userFill; - }; - /** - * @brief get the filling capabilities x&y - * @return bvec2 repensent the capacity to x&y filling - * @note : INTERNAL EWOL SYSTEM - */ - const bvec2& canFill(void); - protected: - bool m_hide; //!< hide a widget on the display - public: - /** - * @brief set the widget hidden - */ - virtual void hide(void); - /** - * @brief set the widget visible - */ - virtual void show(void); - /** - * @brief get the visibility of the widget - * @return true: if the widget is hiden, false: it is visible - */ - virtual bool isHide(void) { - return m_hide; - }; - - protected: - enum ewol::gravity m_gravity; //!< Gravity of the widget - public: - /** - * @brief set the widget gravity - * @param[in] _gravity New gravity of the widget - */ - virtual void setGravity(enum ewol::gravity _gravity); - /** - * @brief get the widget gravity - * @return the gravity type - */ - virtual enum ewol::gravity getGravity(void) { - return m_gravity; - }; - // ---------------------------------------------------------------------------------------------------------------- - // -- focus Area - // ---------------------------------------------------------------------------------------------------------------- - private: - bool m_hasFocus; //!< set the focus on this widget - bool m_canFocus; //!< the focus can be done on this widget - public: - /** - * @brief get the focus state of the widget - * @return focus state - */ - virtual bool getFocus(void) { - return m_hasFocus; - }; - /** - * @brief get the capability to have focus - * @return State capability to have focus - */ - virtual bool canHaveFocus(void) { - return m_canFocus; - }; - /** - * @brief set focus on this widget - * @return return true if the widget keep the focus - */ - virtual bool setFocus(void); - /** - * @brief remove the focus on this widget - * @return return true if the widget have release his focus (if he has it) - */ - virtual bool rmFocus(void); - /** - * @brief set the capability to have the focus - * @param[in] _canFocusState new focus capability - */ - virtual void setCanHaveFocus(bool _canFocusState); - /** - * @brief keep the focus on this widget == > this remove the previous focus on all other widget - */ - virtual void keepFocus(void); - protected: - /** - * @brief Event of the focus has been grep by the current widget - */ - virtual void onGetFocus(void) {}; - /** - * @brief Event of the focus has been lost by the current widget - */ - virtual void onLostFocus(void) {}; - - // ---------------------------------------------------------------------------------------------------------------- - // -- Mouse event properties Area - // ---------------------------------------------------------------------------------------------------------------- - private: - int32_t m_limitMouseEvent; //!< this is to limit the number of mouse event that the widget can supported - public: - /** - * @brief get the number of mouse event supported - * @return return the number of event that the mouse supported [0..3] - */ - virtual int32_t getMouseLimit(void) { - return m_limitMouseEvent; - }; - /** - * @brief get the number of mouse event supported - * @param[in] _numberState The number of event that the mouse supported [0..3] - */ - virtual void setMouseLimit(int32_t _numberState) { - m_limitMouseEvent = _numberState; - }; - - // ---------------------------------------------------------------------------------------------------------------- - // -- keyboard event properties Area - // ---------------------------------------------------------------------------------------------------------------- - private: - bool m_allowRepeateKeyboardEvent; //!< This remove the repeating keybord event due to the constant pressing key. - public: - /** - * @brief get the keyboard repeating event supporting. - * @return true : the event can be repeated. - * @return false : the event must not be repeated. - */ - virtual bool getKeyboardRepeate(void) { - return m_allowRepeateKeyboardEvent; - }; - protected: - /** - * @brief set the keyboard repeating event supporting. - * @param[in] _state The repeating status (true: enable, false disable). - */ - virtual void setKeyboardRepeate(bool _state) { - m_allowRepeateKeyboardEvent = _state; - }; - /** - * @brief display the virtual keyboard (if needed) - */ - virtual void showKeyboard(void); - /** - * @brief Hide the virtual keyboard (if needed) - */ - virtual void hideKeyboard(void); - // ---------------------------------------------------------------------------------------------------------------- - // -- periodic call Area - // ---------------------------------------------------------------------------------------------------------------- - private: - int64_t m_periodicCallDeltaTime; //!< -1 : disable / 0 : every time / else in US - int64_t m_periodicCallTime; //!< Last call time - protected: - /** - * @brief disable the periodic call. - */ - void periodicCallDisable(void); - /** - * @brief disable the periodic call. - * @param[in] _callInSecond periodic call in second (float) - */ - void periodicCallEnable(float _callInSecond=0); - public: - /** - * @brief {SYSTEM} get a reference of the periodic call delta time - * @return the perodic time delta call -1 : disable / 0 : every time / else in US - */ - int64_t systemGetCallDeltaTime(void) const { - return m_periodicCallDeltaTime; - }; - /** - * @brief {SYSTEM} get a reference of the periodic call time - * @return Last call from the periodic call - */ - int64_t systemGetLastCallTime(void) const { - return m_periodicCallTime; - }; - /** - * @brief {SYSTEM} get a reference of the periodic call time - * @return Last call from the periodic call - */ - void systemSetLastCallTime(int64_t _time) { - m_periodicCallTime=_time; - }; - /** - * @brief periodic call of this widget - * @param _event Current time property - */ - virtual void periodicCall(const ewol::EventTime& _event) { - - }; - public: - /** - * @brief get the widget at the specific windows absolute position - * @param[in] _pos gAbsolute position of the requested widget knowledge - * @return NULL No widget found - * @return pointer on the widget found - * @note : INTERNAL EWOL SYSTEM - */ - virtual ewol::Widget* getWidgetAtPos(const vec2& _pos) { - if (false == isHide()) { - return this; - } - return NULL; - }; - /** - * @brief get the widget if it have this name or one of the subwidget with the same name - * @param[in] _widgetName name of the widget - * @return the requested pointer on the node (or NULL pointer) - */ - virtual ewol::Widget* getWidgetNamed(const std::string& _widgetName); - - // event section: - public: - /** - * @brief {SYSTEM} system event input (only meta widget might overwrite this function). - * @param[in] _event Event properties - * @return true the event is used - * @return false the event is not used - */ - virtual bool systemEventInput(ewol::EventInputSystem& _event); - protected: - /** - * @brief Event on an input of this Widget (finger, mouse, stilet) - * @param[in] _event Event properties - * @return true the event is used - * @return false the event is not used - */ - virtual bool onEventInput(const ewol::EventInput& _event) { - return false; - }; - public: - /** - * @brief {SYSTEM} Entry event (only meta widget might overwrite this function). - * @param[in] _event Event properties - * @return true if the event has been used - * @return false if the event has not been used - */ - virtual bool systemEventEntry(ewol::EventEntrySystem& _event); - protected: - /** - * @brief Entry event. - * represent the physical event : - * - Keyboard (key event and move event) - * - Accelerometer - * - Joystick - * @param[in] _event Event properties - * @return true if the event has been used - * @return false if the event has not been used - */ - virtual bool onEventEntry(const ewol::EventEntry& _event) { - return false; - }; - public: - /** - * @brief Event on a past event == > this event is asynchronous due to all system does not support direct getting datas - * @note : need to have focus ... - * @param[in] mode Mode of data requested - */ - virtual void onEventClipboard(enum ewol::clipBoard::clipboardListe _clipboardID) { }; - - // ---------------------------------------------------------------------------------------------------------------- - // -- Shortcut : management of the shortcut - // ---------------------------------------------------------------------------------------------------------------- - private: - std::vector m_localShortcut; //!< list of all shortcut in the widget - protected: - /** - * @brief add a specific shortcut with his description - * @param[in] _descriptiveString Description string of the shortcut - * @param[in] _generateEventId Event generic of the element - * @param[in] _data Associate data wit the event - */ - virtual void shortCutAdd(const char * _descriptiveString, - const char * _generateEventId, - std::string _data="", - bool _broadcast=false); - /** - * @brief remove all curent shortCut - */ - virtual void shortCutClean(void); - public: - /** - * @brief Event on a short-cut of this Widget (in case of return false, the event on the keyevent will arrive in the function @ref onEventKb). - * @param[in] _special All the special kay pressed at this time. - * @param[in] _unicodeValue Key pressed by the user not used if the kbMove!=ewol::EVENT_KB_MOVE_TYPE_NONE. - * @param[in] _kbMove Special key of the keyboard. - * @return true if the event has been used. - * @return false if the event has not been used. - * @note To prevent some error when you get an event get it if it is down and Up ... == > like this it could not generate some ununderstanding error. - */ - virtual bool onEventShortCut(ewol::SpecialKey& _special, - char32_t _unicodeValue, - enum ewol::keyEvent::keyboard _kbMove, - bool _isDown); - // ---------------------------------------------------------------------------------------------------------------- - // -- drawing : All drawing must be done in 2 separate buffer 1 for the current display and 1 for the working... - // ---------------------------------------------------------------------------------------------------------------- - protected: - bool m_needRegenerateDisplay; //!< the display might be done the next regeneration - /** - * @brief The widget mark itself that it need to regenerate the nest time. - */ - virtual void markToRedraw(void); - /** - * @brief get the need of the redrawing of the widget and reset it to false - * @return true if we need to redraw - * @return false if we have no need to redraw - */ - virtual bool needRedraw(void) { - bool tmpData=m_needRegenerateDisplay; - m_needRegenerateDisplay=false; - return tmpData; - }; - public: - /** - * @brief {SYSTEM} extern interface to request a draw ... (called by the drawing thread [Android, X11, ...]) - * This function generate a clipping with the viewport openGL system. Like this a widget draw can not draw over an other widget - * @note This function is virtual for the scrolled widget, and the more complicated openGl widget - * @param[in] _displayProp properties of the current display - * @note : INTERNAL EWOL SYSTEM - */ - virtual void systemDraw(const DrawProperty& _displayProp); - protected: - /** - * @brief Common widget drawing function (called by the drawing thread [Android, X11, ...]) - */ - virtual void onDraw(void) { }; - public: - /** - * @brief Event generated when a redraw is needed - */ - virtual void onRegenerateDisplay(void) { }; - // grab cursor mode - private: - bool m_grabCursor; - public: - /** - * @brief Grab the cursor : This get all the mouvement of the mouse in PC mode, and generate an ofset instead of a position. - * @note : the generation of the offset is due to the fact the cursor position is forced at the center of the widget. - * @note This done nothing in "Finger" or "Stylet" mode. - */ - virtual void grabCursor(void); - /** - * @brief Un-Grab the cursor (default mode cursor offset) - */ - virtual void unGrabCursor(void); - /** - * @brief get the grabbing status of the cursor. - * @return true if the cursor is curently grabbed - */ - virtual bool getGrabStatus(void); - private: - enum ewol::cursorDisplay m_cursorDisplay; - public: - /** - * @brief set the cursor display type. - * @param[in] _newCursor selected new cursor. - */ - virtual void setCursor(enum ewol::cursorDisplay _newCursor); - /** - * @brief get the currrent cursor. - * @return the type of the cursor. - */ - virtual enum ewol::cursorDisplay getCursor(void); - public: // Derived function - virtual void onObjectRemove(ewol::EObject* _removeObject); - virtual bool loadXML(exml::Element* _node); - protected: // Derived function - virtual bool onSetConfig(const ewol::EConfig& _conf); - virtual bool onGetConfig(const char* _config, std::string& _result) const; - public: - /** - * @brief need to be call When the size of the current widget have change == > this force the system to recalculate all the widget positions - */ - void requestUpdateSize(void); - /** - * @brief get the current Widget Manager - */ - ewol::WidgetManager& getWidgetManager(void); - /** - * @brief get the curent Windows - */ - ewol::Windows* getWindows(void); - /* - * Annimation section : + protected: + enum ewol::gravity m_gravity; //!< Gravity of the widget + public: + /** + * @brief set the widget gravity + * @param[in] _gravity New gravity of the widget */ - public: - // configuration : - static const char* const configAnnimationAddType; - static const char* const configAnnimationAddTime; - static const char* const configAnnimationRemoveType; - static const char* const configAnnimationRemoveTime; - // event generated : - static const char* const eventAnnimationStart; //!< event when start annimation - static const char* const eventAnnimationRatio; //!< event when % of annimation change (integer) - static const char* const eventAnnimationStop; //!< event when stop annimation - protected: - enum annimationMode { - annimationModeEnableAdd, - annimationModeEnableRemove, - annimationModeDisable - }; - enum annimationMode m_annimationMode; //!< true when the annimation is started - float m_annimationratio; //!< Ratio of the annimation [0..1] - private: - std::vector m_annimationList[2]; //!< List of all annimation type ADD - protected: - const char* m_annimationType[2]; //!< type of start annimation (default NULL ==> no annimation) - float m_annimationTime[2]; //!< time to produce start annimation - protected: - /** - * @brief Add a annimation type capabilities of this widget. - * @param[in] _mode Configuring mode. - * @param[in] _type Type of the annimation. - */ - void addAnnimationType(enum annimationMode _mode, const char* _type); - public: - /** - * @brief set a annimation type. - * @param[in] _mode Configuring mode. - * @param[in] _type type of the annimation - */ - void setAnnimationType(enum annimationMode _mode, const std::string& _type); - /** - * @brief set a annimation time to produce. - * @param[in] _mode Configuring mode. - * @param[in] _time Time in second of the annimation display - */ - void setAnnimationTime(enum annimationMode _mode, float _time); - /** - * @brief Start the annimation. - * @param[in] _mode Configuring mode. - * @return true if an annimation will be started, false ==> no annimation and no event - */ - bool startAnnimation(enum annimationMode _mode); - /** - * @brief Stop/Break the annimation. - * @return true if an annimation will be stoped, false ==> no curent annimation and no event wil be generated - */ - bool stopAnnimation(void); - protected: - /** - * @brief Event when start the annimation. - * @param[in] _mode Configuring mode. - * @return true need to add periodic call. - */ - virtual bool onStartAnnimation(enum annimationMode _mode) { return false; }; - /** - * @brief Event when Stop the annimation. - */ - virtual void onStopAnnimation(void) { }; + virtual void setGravity(enum ewol::gravity _gravity); + /** + * @brief get the widget gravity + * @return the gravity type + */ + virtual enum ewol::gravity getGravity(void) { + return m_gravity; + }; + // ---------------------------------------------------------------------------------------------------------------- + // -- focus Area + // ---------------------------------------------------------------------------------------------------------------- + private: + bool m_hasFocus; //!< set the focus on this widget + bool m_canFocus; //!< the focus can be done on this widget + public: + /** + * @brief get the focus state of the widget + * @return focus state + */ + virtual bool getFocus(void) { + return m_hasFocus; + }; + /** + * @brief get the capability to have focus + * @return State capability to have focus + */ + virtual bool canHaveFocus(void) { + return m_canFocus; + }; + /** + * @brief set focus on this widget + * @return return true if the widget keep the focus + */ + virtual bool setFocus(void); + /** + * @brief remove the focus on this widget + * @return return true if the widget have release his focus (if he has it) + */ + virtual bool rmFocus(void); + /** + * @brief set the capability to have the focus + * @param[in] _canFocusState new focus capability + */ + virtual void setCanHaveFocus(bool _canFocusState); + /** + * @brief keep the focus on this widget == > this remove the previous focus on all other widget + */ + virtual void keepFocus(void); + protected: + /** + * @brief Event of the focus has been grep by the current widget + */ + virtual void onGetFocus(void) {}; + /** + * @brief Event of the focus has been lost by the current widget + */ + virtual void onLostFocus(void) {}; + + // ---------------------------------------------------------------------------------------------------------------- + // -- Mouse event properties Area + // ---------------------------------------------------------------------------------------------------------------- + private: + int32_t m_limitMouseEvent; //!< this is to limit the number of mouse event that the widget can supported + public: + /** + * @brief get the number of mouse event supported + * @return return the number of event that the mouse supported [0..3] + */ + virtual int32_t getMouseLimit(void) { + return m_limitMouseEvent; + }; + /** + * @brief get the number of mouse event supported + * @param[in] _numberState The number of event that the mouse supported [0..3] + */ + virtual void setMouseLimit(int32_t _numberState) { + m_limitMouseEvent = _numberState; + }; + + // ---------------------------------------------------------------------------------------------------------------- + // -- keyboard event properties Area + // ---------------------------------------------------------------------------------------------------------------- + private: + bool m_allowRepeateKeyboardEvent; //!< This remove the repeating keybord event due to the constant pressing key. + public: + /** + * @brief get the keyboard repeating event supporting. + * @return true : the event can be repeated. + * @return false : the event must not be repeated. + */ + virtual bool getKeyboardRepeate(void) { + return m_allowRepeateKeyboardEvent; + }; + protected: + /** + * @brief set the keyboard repeating event supporting. + * @param[in] _state The repeating status (true: enable, false disable). + */ + virtual void setKeyboardRepeate(bool _state) { + m_allowRepeateKeyboardEvent = _state; + }; + /** + * @brief display the virtual keyboard (if needed) + */ + virtual void showKeyboard(void); + /** + * @brief Hide the virtual keyboard (if needed) + */ + virtual void hideKeyboard(void); + // ---------------------------------------------------------------------------------------------------------------- + // -- periodic call Area + // ---------------------------------------------------------------------------------------------------------------- + private: + int64_t m_periodicCallDeltaTime; //!< -1 : disable / 0 : every time / else in US + int64_t m_periodicCallTime; //!< Last call time + protected: + /** + * @brief disable the periodic call. + */ + void periodicCallDisable(void); + /** + * @brief disable the periodic call. + * @param[in] _callInSecond periodic call in second (float) + */ + void periodicCallEnable(float _callInSecond=0); + public: + /** + * @brief {SYSTEM} get a reference of the periodic call delta time + * @return the perodic time delta call -1 : disable / 0 : every time / else in US + */ + int64_t systemGetCallDeltaTime(void) const { + return m_periodicCallDeltaTime; + }; + /** + * @brief {SYSTEM} get a reference of the periodic call time + * @return Last call from the periodic call + */ + int64_t systemGetLastCallTime(void) const { + return m_periodicCallTime; + }; + /** + * @brief {SYSTEM} get a reference of the periodic call time + * @return Last call from the periodic call + */ + void systemSetLastCallTime(int64_t _time) { + m_periodicCallTime=_time; + }; + /** + * @brief periodic call of this widget + * @param _event Current time property + */ + virtual void periodicCall(const ewol::EventTime& _event) { - }; - //}; + }; + public: + /** + * @brief get the widget at the specific windows absolute position + * @param[in] _pos gAbsolute position of the requested widget knowledge + * @return NULL No widget found + * @return pointer on the widget found + * @note : INTERNAL EWOL SYSTEM + */ + virtual ewol::Widget* getWidgetAtPos(const vec2& _pos) { + if (false == isHide()) { + return this; + } + return NULL; + }; + /** + * @brief get the widget if it have this name or one of the subwidget with the same name + * @param[in] _widgetName name of the widget + * @return the requested pointer on the node (or NULL pointer) + */ + virtual ewol::Widget* getWidgetNamed(const std::string& _widgetName); + + // event section: + public: + /** + * @brief {SYSTEM} system event input (only meta widget might overwrite this function). + * @param[in] _event Event properties + * @return true the event is used + * @return false the event is not used + */ + virtual bool systemEventInput(ewol::EventInputSystem& _event); + protected: + /** + * @brief Event on an input of this Widget (finger, mouse, stilet) + * @param[in] _event Event properties + * @return true the event is used + * @return false the event is not used + */ + virtual bool onEventInput(const ewol::EventInput& _event) { + return false; + }; + public: + /** + * @brief {SYSTEM} Entry event (only meta widget might overwrite this function). + * @param[in] _event Event properties + * @return true if the event has been used + * @return false if the event has not been used + */ + virtual bool systemEventEntry(ewol::EventEntrySystem& _event); + protected: + /** + * @brief Entry event. + * represent the physical event : + * - Keyboard (key event and move event) + * - Accelerometer + * - Joystick + * @param[in] _event Event properties + * @return true if the event has been used + * @return false if the event has not been used + */ + virtual bool onEventEntry(const ewol::EventEntry& _event) { + return false; + }; + public: + /** + * @brief Event on a past event == > this event is asynchronous due to all system does not support direct getting datas + * @note : need to have focus ... + * @param[in] mode Mode of data requested + */ + virtual void onEventClipboard(enum ewol::clipBoard::clipboardListe _clipboardID) { }; + + // ---------------------------------------------------------------------------------------------------------------- + // -- Shortcut : management of the shortcut + // ---------------------------------------------------------------------------------------------------------------- + private: + std::vector m_localShortcut; //!< list of all shortcut in the widget + protected: + /** + * @brief add a specific shortcut with his description + * @param[in] _descriptiveString Description string of the shortcut + * @param[in] _generateEventId Event generic of the element + * @param[in] _data Associate data wit the event + */ + virtual void shortCutAdd(const char * _descriptiveString, + const char * _generateEventId, + std::string _data="", + bool _broadcast=false); + /** + * @brief remove all curent shortCut + */ + virtual void shortCutClean(void); + public: + /** + * @brief Event on a short-cut of this Widget (in case of return false, the event on the keyevent will arrive in the function @ref onEventKb). + * @param[in] _special All the special kay pressed at this time. + * @param[in] _unicodeValue Key pressed by the user not used if the kbMove!=ewol::EVENT_KB_MOVE_TYPE_NONE. + * @param[in] _kbMove Special key of the keyboard. + * @return true if the event has been used. + * @return false if the event has not been used. + * @note To prevent some error when you get an event get it if it is down and Up ... == > like this it could not generate some ununderstanding error. + */ + virtual bool onEventShortCut(ewol::SpecialKey& _special, + char32_t _unicodeValue, + enum ewol::keyEvent::keyboard _kbMove, + bool _isDown); + // ---------------------------------------------------------------------------------------------------------------- + // -- drawing : All drawing must be done in 2 separate buffer 1 for the current display and 1 for the working... + // ---------------------------------------------------------------------------------------------------------------- + protected: + bool m_needRegenerateDisplay; //!< the display might be done the next regeneration + /** + * @brief The widget mark itself that it need to regenerate the nest time. + */ + virtual void markToRedraw(void); + /** + * @brief get the need of the redrawing of the widget and reset it to false + * @return true if we need to redraw + * @return false if we have no need to redraw + */ + virtual bool needRedraw(void) { + bool tmpData=m_needRegenerateDisplay; + m_needRegenerateDisplay=false; + return tmpData; + }; + public: + /** + * @brief {SYSTEM} extern interface to request a draw ... (called by the drawing thread [Android, X11, ...]) + * This function generate a clipping with the viewport openGL system. Like this a widget draw can not draw over an other widget + * @note This function is virtual for the scrolled widget, and the more complicated openGl widget + * @param[in] _displayProp properties of the current display + * @note : INTERNAL EWOL SYSTEM + */ + virtual void systemDraw(const DrawProperty& _displayProp); + protected: + /** + * @brief Common widget drawing function (called by the drawing thread [Android, X11, ...]) + */ + virtual void onDraw(void) { }; + public: + /** + * @brief Event generated when a redraw is needed + */ + virtual void onRegenerateDisplay(void) { }; + // grab cursor mode + private: + bool m_grabCursor; + public: + /** + * @brief Grab the cursor : This get all the mouvement of the mouse in PC mode, and generate an ofset instead of a position. + * @note : the generation of the offset is due to the fact the cursor position is forced at the center of the widget. + * @note This done nothing in "Finger" or "Stylet" mode. + */ + virtual void grabCursor(void); + /** + * @brief Un-Grab the cursor (default mode cursor offset) + */ + virtual void unGrabCursor(void); + /** + * @brief get the grabbing status of the cursor. + * @return true if the cursor is curently grabbed + */ + virtual bool getGrabStatus(void); + private: + enum ewol::cursorDisplay m_cursorDisplay; + public: + /** + * @brief set the cursor display type. + * @param[in] _newCursor selected new cursor. + */ + virtual void setCursor(enum ewol::cursorDisplay _newCursor); + /** + * @brief get the currrent cursor. + * @return the type of the cursor. + */ + virtual enum ewol::cursorDisplay getCursor(void); + public: // Derived function + virtual void onObjectRemove(ewol::EObject* _removeObject); + virtual bool loadXML(exml::Element* _node); + protected: // Derived function + virtual bool onSetConfig(const ewol::EConfig& _conf); + virtual bool onGetConfig(const char* _config, std::string& _result) const; + public: + /** + * @brief need to be call When the size of the current widget have change == > this force the system to recalculate all the widget positions + */ + void requestUpdateSize(void); + /** + * @brief get the current Widget Manager + */ + ewol::WidgetManager& getWidgetManager(void); + /** + * @brief get the curent Windows + */ + ewol::Windows* getWindows(void); + /* + * Annimation section : + */ + public: + // configuration : + static const char* const configAnnimationAddType; + static const char* const configAnnimationAddTime; + static const char* const configAnnimationRemoveType; + static const char* const configAnnimationRemoveTime; + // event generated : + static const char* const eventAnnimationStart; //!< event when start annimation + static const char* const eventAnnimationRatio; //!< event when % of annimation change (integer) + static const char* const eventAnnimationStop; //!< event when stop annimation + protected: + enum annimationMode { + annimationModeEnableAdd, + annimationModeEnableRemove, + annimationModeDisable + }; + enum annimationMode m_annimationMode; //!< true when the annimation is started + float m_annimationratio; //!< Ratio of the annimation [0..1] + private: + std::vector m_annimationList[2]; //!< List of all annimation type ADD + protected: + const char* m_annimationType[2]; //!< type of start annimation (default NULL ==> no annimation) + float m_annimationTime[2]; //!< time to produce start annimation + protected: + /** + * @brief Add a annimation type capabilities of this widget. + * @param[in] _mode Configuring mode. + * @param[in] _type Type of the annimation. + */ + void addAnnimationType(enum annimationMode _mode, const char* _type); + public: + /** + * @brief set a annimation type. + * @param[in] _mode Configuring mode. + * @param[in] _type type of the annimation + */ + void setAnnimationType(enum annimationMode _mode, const std::string& _type); + /** + * @brief set a annimation time to produce. + * @param[in] _mode Configuring mode. + * @param[in] _time Time in second of the annimation display + */ + void setAnnimationTime(enum annimationMode _mode, float _time); + /** + * @brief Start the annimation. + * @param[in] _mode Configuring mode. + * @return true if an annimation will be started, false ==> no annimation and no event + */ + bool startAnnimation(enum annimationMode _mode); + /** + * @brief Stop/Break the annimation. + * @return true if an annimation will be stoped, false ==> no curent annimation and no event wil be generated + */ + bool stopAnnimation(void); + protected: + /** + * @brief Event when start the annimation. + * @param[in] _mode Configuring mode. + * @return true need to add periodic call. + */ + virtual bool onStartAnnimation(enum annimationMode _mode) { return false; }; + /** + * @brief Event when Stop the annimation. + */ + virtual void onStopAnnimation(void) { }; + + }; }; diff --git a/sources/lutin_ewol.py b/sources/lutin_ewol.py index e644d977..3a644bcc 100755 --- a/sources/lutin_ewol.py +++ b/sources/lutin_ewol.py @@ -21,61 +21,10 @@ def Create(target): # add the file to compile: myModule.AddSrcFile([ 'ewol/ewol.cpp', - 'ewol/clipBoard.cpp', - 'ewol/debug.cpp', - 'ewol/commandLine.cpp', - 'ewol/key.cpp', - 'ewol/cursor.cpp', - 'ewol/Dimension.cpp', - 'ewol/Light.cpp', - 'ewol/Material.cpp']) + 'ewol/debug.cpp' + ]) - #openGl Basic access abstraction (for the model matrix and include - myModule.AddSrcFile([ - 'ewol/renderer/EConfig.cpp', - 'ewol/renderer/EMessage.cpp', - 'ewol/renderer/EObject.cpp', - 'ewol/renderer/EObjectManager.cpp', - 'ewol/renderer/EMultiCast.cpp', - 'ewol/renderer/openGL.cpp', - 'ewol/renderer/ConfigFont.cpp', - 'ewol/renderer/EventInput.cpp', - 'ewol/renderer/EventEntry.cpp', - 'ewol/renderer/EventTime.cpp', - 'ewol/renderer/eContext.cpp', - 'ewol/renderer/eInput.cpp']) - - # resources : - myModule.AddSrcFile([ - 'ewol/resources/Shader.cpp', - 'ewol/resources/Program.cpp', - 'ewol/resources/VirtualBufferObject.cpp', - 'ewol/resources/ConfigFile.cpp', - 'ewol/resources/FontFreeType.cpp', - 'ewol/resources/TexturedFont.cpp', - 'ewol/resources/Mesh.cpp', - 'ewol/resources/Texture.cpp', - 'ewol/resources/Colored3DObject.cpp', - 'ewol/resources/Image.cpp', - 'ewol/resources/Resource.cpp', - 'ewol/resources/ResourceManager.cpp']) - - # physical shape parser - myModule.AddSrcFile([ - 'ewol/physicsShape/PhysicsShape.cpp', - 'ewol/physicsShape/PhysicsBox.cpp', - 'ewol/physicsShape/PhysicsCapsule.cpp', - 'ewol/physicsShape/PhysicsCone.cpp', - 'ewol/physicsShape/PhysicsConvexHull.cpp', - 'ewol/physicsShape/PhysicsCylinder.cpp', - 'ewol/physicsShape/PhysicsSphere.cpp']) - - # Audio system - myModule.AddSrcFile([ - 'ewol/renderer/audio/audio.cpp', - 'ewol/renderer/audio/decWav.cpp']) - - # Compositing + # compositing : myModule.AddSrcFile([ 'ewol/compositing/Compositing.cpp', 'ewol/compositing/Text.cpp', @@ -83,44 +32,107 @@ def Create(target): 'ewol/compositing/Image.cpp', 'ewol/compositing/Sprite.cpp', 'ewol/compositing/Shaper.cpp', - 'ewol/compositing/Area.cpp']) + 'ewol/compositing/Area.cpp' + ]) - # all widgets + # context : + myModule.AddSrcFile([ + 'ewol/context/clipBoard.cpp', + 'ewol/context/commandLine.cpp', + 'ewol/context/ConfigFont.cpp', + 'ewol/context/Context.cpp', + 'ewol/context/cursor.cpp', + 'ewol/context/Dimension.cpp', + 'ewol/context/InputManager.cpp' + ]) + if target.name=="Linux": + myModule.AddSrcFile('ewol/context/X11/Context.cpp') + elif target.name=="Android": + myModule.AddSrcFile("ewol/context/Android/Context.cpp") + elif target.name=="Windows": + myModule.AddSrcFile("ewol/context/Windows/Context.cpp") + elif target.name=="MacOs": + myModule.AddSrcFile([ + "ewol/context/MacOs/Context.cpp", + "ewol/context/MacOs/Interface.mm", + "ewol/context/MacOs/AppDelegate.mm", + "ewol/context/MacOs/OpenglView.mm"]) + else: + debug.error("unknow mode...") + + # Key properties : + myModule.AddSrcFile([ + 'ewol/key/keyboard.cpp', + 'ewol/key/Special.cpp', + 'ewol/key/status.cpp', + 'ewol/key/type.cpp' + ]) + + # object : + myModule.AddSrcFile([ + 'ewol/object/Config.cpp', + 'ewol/object/ConfigElement.cpp', + 'ewol/object/Manager.cpp', + 'ewol/object/Message.cpp', + 'ewol/object/MultiCast.cpp', + 'ewol/object/Object.cpp' + ]) + + # OpenGL interface : + myModule.AddSrcFile([ + 'ewol/openGL/openGL.cpp' + ]) + + # resources : + myModule.AddSrcFile([ + 'ewol/resource/Colored3DObject.cpp', + 'ewol/resource/ConfigFile.cpp', + 'ewol/resource/FontFreeType.cpp', + 'ewol/resource/Image.cpp', + 'ewol/resource/Manager.cpp', + 'ewol/resource/Program.cpp', + 'ewol/resource/Resource.cpp', + 'ewol/resource/Shader.cpp', + 'ewol/resource/Texture.cpp', + 'ewol/resource/TexturedFont.cpp', + 'ewol/resource/VirtualBufferObject.cpp' + ]) + + # widget : myModule.AddSrcFile([ - 'ewol/widget/Widget.cpp', - 'ewol/widget/WidgetManager.cpp', - 'ewol/widget/Windows.cpp', - 'ewol/widget/Button.cpp', - 'ewol/widget/Gird.cpp', - 'ewol/widget/Image.cpp', 'ewol/widget/ButtonColor.cpp', + 'ewol/widget/Button.cpp', 'ewol/widget/CheckBox.cpp', 'ewol/widget/ColorBar.cpp', - 'ewol/widget/ContextMenu.cpp', 'ewol/widget/Composer.cpp', 'ewol/widget/Container.cpp', 'ewol/widget/ContainerN.cpp', + 'ewol/widget/ContextMenu.cpp', 'ewol/widget/Entry.cpp', + 'ewol/widget/Gird.cpp', + 'ewol/widget/Image.cpp', 'ewol/widget/Joystick.cpp', 'ewol/widget/Label.cpp', + 'ewol/widget/Layer.cpp', 'ewol/widget/List.cpp', 'ewol/widget/ListFileSystem.cpp', - 'ewol/widget/Layer.cpp', + 'ewol/widget/Manager.cpp', 'ewol/widget/Menu.cpp', - 'ewol/widget/Mesh.cpp', + 'ewol/widget/meta/ColorChooser.cpp', + 'ewol/widget/meta/FileChooser.cpp', + 'ewol/widget/meta/Parameter.cpp', + 'ewol/widget/meta/ParameterList.cpp', + 'ewol/widget/meta/StdPopUp.cpp', 'ewol/widget/PopUp.cpp', 'ewol/widget/ProgressBar.cpp', 'ewol/widget/Scroll.cpp', 'ewol/widget/Sizer.cpp', 'ewol/widget/Slider.cpp', - 'ewol/widget/WSlider.cpp', 'ewol/widget/Spacer.cpp', 'ewol/widget/WidgetScrolled.cpp', - 'ewol/widget/meta/StdPopUp.cpp', - 'ewol/widget/meta/FileChooser.cpp', - 'ewol/widget/meta/ColorChooser.cpp', - 'ewol/widget/meta/Parameter.cpp', - 'ewol/widget/meta/ParameterList.cpp']) + 'ewol/widget/Windows.cpp', + 'ewol/widget/WSlider.cpp', + ]) myModule.CopyFolder('../data/theme/default/widgetEntry.*','theme/default') myModule.CopyFolder('../data/theme/rounded/widgetEntry.*','theme/rounded')