From f52a6919e37d9e141f1b2ae844a5af3d0723b309 Mon Sep 17 00:00:00 2001 From: Edouard DUPIN Date: Mon, 2 Sep 2013 06:46:49 +0200 Subject: [PATCH] [DEV] rework some global elements (step 5) --- sources/ewol/Material.cpp | 6 +- sources/ewol/commandLine.cpp | 51 +- sources/ewol/commandLine.h | 49 +- sources/ewol/compositing/Area.cpp | 8 +- sources/ewol/compositing/Drawing.cpp | 4 +- sources/ewol/compositing/Image.cpp | 10 +- sources/ewol/compositing/Shaper.cpp | 12 +- sources/ewol/compositing/Text.cpp | 10 +- sources/ewol/ewol.cpp | 118 --- sources/ewol/ewol.h | 16 +- .../physicsShape/PhysicsBox.cpp | 2 +- .../{resources => }/physicsShape/PhysicsBox.h | 2 +- .../physicsShape/PhysicsCapsule.cpp | 2 +- .../physicsShape/PhysicsCapsule.h | 2 +- .../physicsShape/PhysicsCone.cpp | 2 +- .../physicsShape/PhysicsCone.h | 2 +- .../physicsShape/PhysicsConvexHull.cpp | 2 +- .../physicsShape/PhysicsConvexHull.h | 2 +- .../physicsShape/PhysicsCylinder.cpp | 2 +- .../physicsShape/PhysicsCylinder.h | 2 +- .../physicsShape/PhysicsShape.cpp | 14 +- .../physicsShape/PhysicsShape.h | 0 .../physicsShape/PhysicsSphere.cpp | 2 +- .../physicsShape/PhysicsSphere.h | 2 +- sources/ewol/renderer/Android/Context.cpp | 2 +- sources/ewol/renderer/EMultiCast.cpp | 4 +- sources/ewol/renderer/EMultiCast.h | 4 +- sources/ewol/renderer/EObject.cpp | 10 +- sources/ewol/renderer/EObject.h | 6 +- sources/ewol/renderer/EObjectManager.cpp | 6 +- sources/ewol/renderer/EObjectManager.h | 2 +- sources/ewol/renderer/Windows/Context.cpp | 935 ++++++++---------- sources/ewol/renderer/X11/Context.cpp | 22 +- sources/ewol/renderer/eContext.cpp | 55 +- sources/ewol/renderer/eContext.h | 19 +- sources/ewol/renderer/eInput.cpp | 6 +- sources/ewol/renderer/eInput.h | 2 +- sources/ewol/resources/Colored3DObject.cpp | 4 +- sources/ewol/resources/Mesh.cpp | 8 +- sources/ewol/resources/Mesh.h | 2 +- sources/ewol/resources/Program.cpp | 8 +- sources/ewol/resources/ResourceManager.cpp | 98 +- sources/ewol/resources/ResourceManager.h | 104 +- sources/ewol/resources/Texture.cpp | 3 +- sources/ewol/resources/TexturedFont.cpp | 4 +- .../ewol/resources/VirtualBufferObject.cpp | 3 +- sources/ewol/widget/Button.cpp | 1 - sources/ewol/widget/ButtonColor.cpp | 1 - sources/ewol/widget/Entry.cpp | 7 +- sources/ewol/widget/Mesh.cpp | 2 +- sources/ewol/widget/Mesh.h | 2 +- sources/ewol/widget/Widget.cpp | 26 +- sources/ewol/widget/Widget.h | 10 +- sources/ewol/widget/Windows.cpp | 6 +- sources/lutin_ewol.py | 37 +- 55 files changed, 809 insertions(+), 912 deletions(-) rename sources/ewol/{resources => }/physicsShape/PhysicsBox.cpp (89%) rename sources/ewol/{resources => }/physicsShape/PhysicsBox.h (92%) rename sources/ewol/{resources => }/physicsShape/PhysicsCapsule.cpp (90%) rename sources/ewol/{resources => }/physicsShape/PhysicsCapsule.h (93%) rename sources/ewol/{resources => }/physicsShape/PhysicsCone.cpp (90%) rename sources/ewol/{resources => }/physicsShape/PhysicsCone.h (93%) rename sources/ewol/{resources => }/physicsShape/PhysicsConvexHull.cpp (94%) rename sources/ewol/{resources => }/physicsShape/PhysicsConvexHull.h (93%) rename sources/ewol/{resources => }/physicsShape/PhysicsCylinder.cpp (88%) rename sources/ewol/{resources => }/physicsShape/PhysicsCylinder.h (92%) rename sources/ewol/{resources => }/physicsShape/PhysicsShape.cpp (77%) rename sources/ewol/{resources => }/physicsShape/PhysicsShape.h (100%) rename sources/ewol/{resources => }/physicsShape/PhysicsSphere.cpp (87%) rename sources/ewol/{resources => }/physicsShape/PhysicsSphere.h (92%) diff --git a/sources/ewol/Material.cpp b/sources/ewol/Material.cpp index fd07932d..7fb8e5b4 100644 --- a/sources/ewol/Material.cpp +++ b/sources/ewol/Material.cpp @@ -45,7 +45,7 @@ ewol::Material::Material(void) : ewol::Material::~Material(void) { if(NULL!=m_texture0) { - ewol::ResourceManager::Release(m_texture0); + ewol::resource::Release(m_texture0); } } @@ -66,7 +66,7 @@ void ewol::Material::SetTexture0(const etk::UString& _filename) // prevent overloard error : ewol::TextureFile* tmpCopy = m_texture0; m_texture0 = NULL; - if (false == ewol::ResourceManager::Keep(_filename, m_texture0, tmpSize)) { + if (false == ewol::resource::Keep(_filename, m_texture0, tmpSize)) { EWOL_ERROR("Can not load specific texture : " << _filename); // retreave previous texture: m_texture0 = tmpCopy; @@ -74,7 +74,7 @@ void ewol::Material::SetTexture0(const etk::UString& _filename) } 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::ResourceManager::Release(tmpCopy); + ewol::resource::Release(tmpCopy); } } diff --git a/sources/ewol/commandLine.cpp b/sources/ewol/commandLine.cpp index b25235a0..1f67715a 100644 --- a/sources/ewol/commandLine.cpp +++ b/sources/ewol/commandLine.cpp @@ -10,36 +10,37 @@ #include #include -// ------------------------------------------------------------------------ -// Command line arguments -// ------------------------------------------------------------------------ - -static etk::Vector listArgs; - - -void ewol::commandLine::Clean(void) +void ewol::CommandLine::Parse(int32_t _argc, const char* _argv[]) { - EWOL_DEBUG("Clean commandLine (START)"); - listArgs.Clear(); - EWOL_DEBUG("Clean commandLine (END)"); -} - -int32_t ewol::commandLine::Size(void) -{ - return listArgs.Size(); -} - -etk::UString ewol::commandLine::Get(int32_t _id) -{ - if (_id<0 && _id>=listArgs.Size()) { - return ""; + for( int32_t i=1 ; i<_argc; i++) { + EWOL_INFO("commandLine : \"" << _argv[i] << "\"" ); + m_listArgs.PushBack(_argv[i]); } - return listArgs[_id]; } -void ewol::commandLine::Add(const etk::UString& _newElement) + + +esize_t ewol::CommandLine::Size(void) { - listArgs.PushBack(_newElement); + return m_listArgs.Size(); } +const etk::UString& ewol::CommandLine::Get(int32_t _id) +{ + static const etk::UString errorArg(""); + if (_id<0 && _id>=m_listArgs.Size()) { + return errorArg; + } + return m_listArgs[_id]; +} + +void ewol::CommandLine::Add(const etk::UString& _newElement) +{ + m_listArgs.PushBack(_newElement); +} + +void ewol::CommandLine::Remove(esize_t _id) +{ + m_listArgs.Remove(_id); +} diff --git a/sources/ewol/commandLine.h b/sources/ewol/commandLine.h index b6b4f382..ed963685 100644 --- a/sources/ewol/commandLine.h +++ b/sources/ewol/commandLine.h @@ -14,26 +14,35 @@ namespace ewol { - namespace commandLine { - /** - * @brief Remove all the element bufferised in the commandLine system - */ - void Clean(void); - /** - * @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 - */ - etk::UString 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 etk::UString& _newElement); + class CommandLine + { + private: + etk::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 + */ + esize_t Size(void); + /** + * @brief Get an element with a specific ID + * @return _id The cmdLine Id element + */ + const etk::UString& 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 etk::UString& _newElement); + /** + * @brief Remove an element + * @param[in] _id Id of the element + */ + void Remove(esize_t _id); }; }; diff --git a/sources/ewol/compositing/Area.cpp b/sources/ewol/compositing/Area.cpp index 247a0784..5f8023d3 100644 --- a/sources/ewol/compositing/Area.cpp +++ b/sources/ewol/compositing/Area.cpp @@ -23,7 +23,7 @@ ewol::Area::Area(const ivec2& _size) : m_GLtexID(-1), m_resource(NULL) { - ewol::ResourceManager::Keep(m_resource); + ewol::resource::Keep(m_resource); m_resource->SetImageSize(_size); m_resource->Flush(); LoadProgram(); @@ -32,10 +32,10 @@ ewol::Area::Area(const ivec2& _size) : ewol::Area::~Area(void) { if (NULL != m_resource) { - ewol::ResourceManager::Release(m_resource); + ewol::resource::Release(m_resource); m_resource = NULL; } - ewol::ResourceManager::Release(m_GLprogram); + ewol::resource::Release(m_GLprogram); } void ewol::Area::LoadProgram(void) @@ -43,7 +43,7 @@ void ewol::Area::LoadProgram(void) etk::UString tmpString("DATA:textured3D.prog"); // get the shader resource : m_GLPosition = 0; - if (true == ewol::ResourceManager::Keep(tmpString, m_GLprogram) ) { + if (true == ewol::resource::Keep(tmpString, m_GLprogram) ) { m_GLPosition = m_GLprogram->GetAttribute("EW_coord3d"); m_GLColor = m_GLprogram->GetAttribute("EW_color"); m_GLtexture = m_GLprogram->GetAttribute("EW_texture2d"); diff --git a/sources/ewol/compositing/Drawing.cpp b/sources/ewol/compositing/Drawing.cpp index 9eb12ee7..96662702 100644 --- a/sources/ewol/compositing/Drawing.cpp +++ b/sources/ewol/compositing/Drawing.cpp @@ -289,7 +289,7 @@ void ewol::Drawing::ResetCount(void) void ewol::Drawing::UnLoadProgram(void) { if (NULL!=m_GLprogram) { - ewol::ResourceManager::Release(m_GLprogram); + ewol::resource::Release(m_GLprogram); m_GLprogram = NULL; } } @@ -301,7 +301,7 @@ void ewol::Drawing::LoadProgram(void) // oad the new ... etk::UString tmpString("DATA:color3.prog"); // get the shader resource : - if (true == ewol::ResourceManager::Keep(tmpString, m_GLprogram) ) { + if (true == ewol::resource::Keep(tmpString, m_GLprogram) ) { m_GLPosition = m_GLprogram->GetAttribute("EW_coord3d"); m_GLColor = m_GLprogram->GetAttribute("EW_color"); m_GLMatrix = m_GLprogram->GetUniform("EW_MatrixTransformation"); diff --git a/sources/ewol/compositing/Image.cpp b/sources/ewol/compositing/Image.cpp index 233db2c4..5004dfe0 100644 --- a/sources/ewol/compositing/Image.cpp +++ b/sources/ewol/compositing/Image.cpp @@ -34,10 +34,10 @@ ewol::Image::Image(const etk::UString& _imageName) : ewol::Image::~Image(void) { if (NULL != m_resource) { - ewol::ResourceManager::Release(m_resource); + ewol::resource::Release(m_resource); m_resource = NULL; } - ewol::ResourceManager::Release(m_GLprogram); + ewol::resource::Release(m_GLprogram); } void ewol::Image::LoadProgram(void) @@ -45,7 +45,7 @@ void ewol::Image::LoadProgram(void) etk::UString tmpString("DATA:textured3D.prog"); // get the shader resource : m_GLPosition = 0; - if (true == ewol::ResourceManager::Keep(tmpString, m_GLprogram) ) { + if (true == ewol::resource::Keep(tmpString, m_GLprogram) ) { m_GLPosition = m_GLprogram->GetAttribute("EW_coord3d"); m_GLColor = m_GLprogram->GetAttribute("EW_color"); m_GLtexture = m_GLprogram->GetAttribute("EW_texture2d"); @@ -240,14 +240,14 @@ void ewol::Image::SetSource(const etk::UString& _newFile, const vec2& _size) Clear(); // remove old one if (NULL != m_resource) { - ewol::ResourceManager::Release(m_resource); + ewol::resource::Release(m_resource); m_resource = NULL; } ivec2 tmpSize(_size.x(),_size.y()); // note that no image can be loaded... if (_newFile != "") { // link to new One - if (false == ewol::ResourceManager::Keep(_newFile, m_resource, tmpSize)) { + if (false == ewol::resource::Keep(_newFile, m_resource, tmpSize)) { EWOL_ERROR("Can not get Image resource"); } } diff --git a/sources/ewol/compositing/Shaper.cpp b/sources/ewol/compositing/Shaper.cpp index 66116788..2ae4670a 100644 --- a/sources/ewol/compositing/Shaper.cpp +++ b/sources/ewol/compositing/Shaper.cpp @@ -51,15 +51,15 @@ ewol::Shaper::~Shaper(void) void ewol::Shaper::UnLoadProgram(void) { if (NULL != m_GLprogram) { - ewol::ResourceManager::Release(m_GLprogram); + ewol::resource::Release(m_GLprogram); m_GLprogram = NULL; } if (NULL != m_resourceTexture) { - ewol::ResourceManager::Release(m_resourceTexture); + ewol::resource::Release(m_resourceTexture); m_resourceTexture = NULL; } if (NULL != m_config) { - ewol::ResourceManager::Release(m_config); + ewol::resource::Release(m_config); m_config = NULL; } } @@ -70,7 +70,7 @@ void ewol::Shaper::LoadProgram(void) EWOL_DEBUG("no Shaper set for loading resources ..."); return; } - if (true == ewol::ResourceManager::Keep(m_name, m_config) ) { + if (true == ewol::resource::Keep(m_name, m_config) ) { m_confIdPaddingX = m_config->Request("PaddingX"); m_confIdPaddingY = m_config->Request("PaddingY"); m_confIdChangeTime = m_config->Request("ChangeTime"); @@ -85,7 +85,7 @@ void ewol::Shaper::LoadProgram(void) EWOL_DEBUG("Shaper try load shader : " << tmpFilename << " with base : " << basicShaderFile); // get the shader resource : m_GLPosition = 0; - if (true == ewol::ResourceManager::Keep(tmpFilename, m_GLprogram) ) { + if (true == ewol::resource::Keep(tmpFilename, m_GLprogram) ) { m_GLPosition = m_GLprogram->GetAttribute("EW_coord2d"); m_GLMatrix = m_GLprogram->GetUniform("EW_MatrixTransformation"); // Widget property ==> for the Vertex shader @@ -104,7 +104,7 @@ void ewol::Shaper::LoadProgram(void) if (basicImageFile != "") { tmpFilename = file.GetRelativeFolder() + basicImageFile; ivec2 size(64,64); - if (true == ewol::ResourceManager::Keep(tmpFilename, m_resourceTexture, size) ) { + if (true == ewol::resource::Keep(tmpFilename, m_resourceTexture, size) ) { // nothing else to do ... } } diff --git a/sources/ewol/compositing/Text.cpp b/sources/ewol/compositing/Text.cpp index 4dd73ffa..1a0775d2 100644 --- a/sources/ewol/compositing/Text.cpp +++ b/sources/ewol/compositing/Text.cpp @@ -49,10 +49,10 @@ ewol::Text::~Text(void) { if (NULL != m_font) { - ewol::ResourceManager::Release(m_font); + ewol::resource::Release(m_font); m_font = NULL; } - ewol::ResourceManager::Release(m_GLprogram); + ewol::resource::Release(m_GLprogram); } void ewol::Text::LoadProgram(void) @@ -60,7 +60,7 @@ void ewol::Text::LoadProgram(void) etk::UString tmpString("DATA:text.prog"); // get the shader resource : m_GLPosition = 0; - if (true == ewol::ResourceManager::Keep(tmpString, m_GLprogram) ) { + if (true == ewol::resource::Keep(tmpString, m_GLprogram) ) { m_GLPosition = m_GLprogram->GetAttribute("EW_coord2d"); m_GLColor = m_GLprogram->GetAttribute("EW_color"); m_GLtexture = m_GLprogram->GetAttribute("EW_texture2d"); @@ -316,7 +316,7 @@ void ewol::Text::SetFont(etk::UString _fontName, int32_t _fontSize) Clear(); // remove old one if (NULL != m_font) { - ewol::ResourceManager::Release(m_font); + ewol::resource::Release(m_font); m_font = NULL; } if (_fontSize <= 0) { @@ -328,7 +328,7 @@ void ewol::Text::SetFont(etk::UString _fontName, int32_t _fontSize) _fontName += ":"; _fontName += _fontSize; // link to new One - if (false == ewol::ResourceManager::Keep(_fontName, m_font)) { + if (false == ewol::resource::Keep(_fontName, m_font)) { EWOL_ERROR("Can not get font resource"); } } diff --git a/sources/ewol/ewol.cpp b/sources/ewol/ewol.cpp index 87c5760e..66282388 100644 --- a/sources/ewol/ewol.cpp +++ b/sources/ewol/ewol.cpp @@ -18,46 +18,6 @@ #undef __class__ #define __class__ "ewol" -int32_t ewol::Run(int32_t _argc, const char* _argv[]) -{ - if (NULL!=_argv) { - etk::SetArgZero(_argv[0]); - } - // init display convertions: - ewol::dimension::Init(); - - EWOL_DEBUG("Store commangLine in the specific system"); - ewol::commandLine::Clean(); - for( int32_t i=1 ; i<_argc; i++) { - EWOL_INFO("commandLine : \"" << _argv[i] << "\"" ); - if (0==strncmp("-l0", _argv[i], 256)) { - GeneralDebugSetLevel(etk::LOG_LEVEL_NONE); - } else if (0==strncmp("-l1", _argv[i], 256)) { - GeneralDebugSetLevel(etk::LOG_LEVEL_CRITICAL); - } else if (0==strncmp("-l2", _argv[i], 256)) { - GeneralDebugSetLevel(etk::LOG_LEVEL_ERROR); - } else if (0==strncmp("-l3", _argv[i], 256)) { - GeneralDebugSetLevel(etk::LOG_LEVEL_WARNING); - } else if (0==strncmp("-l4", _argv[i], 256)) { - GeneralDebugSetLevel(etk::LOG_LEVEL_INFO); - } else if (0==strncmp("-l5", _argv[i], 256)) { - GeneralDebugSetLevel(etk::LOG_LEVEL_DEBUG); - } else if( 0==strncmp("-l6", _argv[i], 256) - || 0==strncmp("-l7", _argv[i], 256) - || 0==strncmp("-l8", _argv[i], 256) - || 0==strncmp("-l9", _argv[i], 256)) { - GeneralDebugSetLevel(etk::LOG_LEVEL_VERBOSE); - } else { - ewol::commandLine::Add(_argv[i]); - } - } - // call standard RUN ... - int32_t error = ewol::eContext::main(_argc, _argv); - - ewol::commandLine::Clean(); - - return error; -} etk::UString ewol::GetCompilationMode(void) { @@ -85,62 +45,6 @@ etk::UString ewol::GetBoardType(void) #endif } -/* - - -void ewol::WindowsSet(ewol::Windows* _windows) -{ - // Remove current Focus : - ewol::widgetManager::FocusSetDefault(NULL); - ewol::widgetManager::FocusRelease(); - // set display of the windows : - eSystem::SetCurrentWindows(_windows); - // Set the new default Focus : - ewol::widgetManager::FocusSetDefault(_windows); -} - -void ewol::WindowsPopUpAdd(ewol::Widget* _tmpWidget) -{ - ewol::Windows* tmpWindows = eSystem::GetCurrentWindows(); - if (NULL != tmpWindows && NULL != _tmpWidget) { - tmpWindows->PopUpWidgetPush(_tmpWidget); - } -} - -void ewol::ChangeSize(const ivec2& _size) -{ - guiInterface::ChangeSize(_size); -} - -void ewol::ChangePos(const ivec2& _pos) -{ - guiInterface::ChangePos(_pos); -} - -void ewol::ForceRedrawAll(void) -{ - eSystem::ForceRedrawAll(); -} - -void ewol::RequestUpdateSize(void) -{ - eSystem::RequestUpdateSize(); -} - -void ewol::Keyboard(bool _hide) -{ - if (true == _hide) { - guiInterface::KeyboardHide(); - } else { - guiInterface::KeyboardShow(); - } -} -void ewol::SetTitle(const etk::UString& _title) -{ - etk::UString title = _title; - guiInterface::SetTitle(title); -} -*/ etk::UString ewol::GetVersion(void) { #define FIRST_YEAR (2011) @@ -152,27 +56,5 @@ etk::UString ewol::GetVersion(void) return tmpOutput; } -int64_t ewol::GetTime(void) -{ - return ewol::eContext::GetTime(); -} -/* -void ewol::InputEventTransfertWidget(ewol::Widget* _source, ewol::Widget* _destination) -{ - eSystem::InputEventTransfertWidget(_source, _destination); -} - -void ewol::ForceOrientation(ewol::orientation_te _orientation) -{ - guiInterface::ForceOrientation(_orientation); -} - - -void ewol::SetIcon(const etk::UString& _icon) -{ - guiInterface::SetIcon(_icon); -} -*/ - diff --git a/sources/ewol/ewol.h b/sources/ewol/ewol.h index 14d26377..0821e589 100644 --- a/sources/ewol/ewol.h +++ b/sources/ewol/ewol.h @@ -34,6 +34,7 @@ namespace ewol /** * @brief Get current time in us... * @return The current time + * @note is implemented by the OS implementation cf renderer/X11/... */ int64_t GetTime(void); /** @@ -42,23 +43,10 @@ namespace ewol */ etk::UString GetCompilationMode(void); /** - * @brief Get the board type () + * @brief Get the board type (Android/Linux/MacOs/...) * @return the string of the mode of commpilation */ etk::UString GetBoardType(void); - - typedef enum { - SCREEN_ORIENTATION_AUTO = 0, - SCREEN_ORIENTATION_LANDSCAPE, - SCREEN_ORIENTATION_PORTRAIT, - } orientation_te; - /* - / ** - * @brief Force a specific orientation for mobile devices - * @param[in] orientation the requested position. - * / - void ForceOrientation(ewol::orientation_te _orientation); - */ }; #endif diff --git a/sources/ewol/resources/physicsShape/PhysicsBox.cpp b/sources/ewol/physicsShape/PhysicsBox.cpp similarity index 89% rename from sources/ewol/resources/physicsShape/PhysicsBox.cpp rename to sources/ewol/physicsShape/PhysicsBox.cpp index 76305d0e..8dc6c337 100644 --- a/sources/ewol/resources/physicsShape/PhysicsBox.cpp +++ b/sources/ewol/physicsShape/PhysicsBox.cpp @@ -6,7 +6,7 @@ * @license BSD v3 (see license file) */ #include -#include +#include diff --git a/sources/ewol/resources/physicsShape/PhysicsBox.h b/sources/ewol/physicsShape/PhysicsBox.h similarity index 92% rename from sources/ewol/resources/physicsShape/PhysicsBox.h rename to sources/ewol/physicsShape/PhysicsBox.h index 21c46bf8..0baa2b5e 100644 --- a/sources/ewol/resources/physicsShape/PhysicsBox.h +++ b/sources/ewol/physicsShape/PhysicsBox.h @@ -11,7 +11,7 @@ #include -#include +#include namespace ewol { diff --git a/sources/ewol/resources/physicsShape/PhysicsCapsule.cpp b/sources/ewol/physicsShape/PhysicsCapsule.cpp similarity index 90% rename from sources/ewol/resources/physicsShape/PhysicsCapsule.cpp rename to sources/ewol/physicsShape/PhysicsCapsule.cpp index 2eb23292..44e31690 100644 --- a/sources/ewol/resources/physicsShape/PhysicsCapsule.cpp +++ b/sources/ewol/physicsShape/PhysicsCapsule.cpp @@ -6,7 +6,7 @@ * @license BSD v3 (see license file) */ #include -#include +#include diff --git a/sources/ewol/resources/physicsShape/PhysicsCapsule.h b/sources/ewol/physicsShape/PhysicsCapsule.h similarity index 93% rename from sources/ewol/resources/physicsShape/PhysicsCapsule.h rename to sources/ewol/physicsShape/PhysicsCapsule.h index 3c8254fa..796f4a93 100644 --- a/sources/ewol/resources/physicsShape/PhysicsCapsule.h +++ b/sources/ewol/physicsShape/PhysicsCapsule.h @@ -11,7 +11,7 @@ #include -#include +#include namespace ewol diff --git a/sources/ewol/resources/physicsShape/PhysicsCone.cpp b/sources/ewol/physicsShape/PhysicsCone.cpp similarity index 90% rename from sources/ewol/resources/physicsShape/PhysicsCone.cpp rename to sources/ewol/physicsShape/PhysicsCone.cpp index 90728918..65a61d87 100644 --- a/sources/ewol/resources/physicsShape/PhysicsCone.cpp +++ b/sources/ewol/physicsShape/PhysicsCone.cpp @@ -6,7 +6,7 @@ * @license BSD v3 (see license file) */ #include -#include +#include diff --git a/sources/ewol/resources/physicsShape/PhysicsCone.h b/sources/ewol/physicsShape/PhysicsCone.h similarity index 93% rename from sources/ewol/resources/physicsShape/PhysicsCone.h rename to sources/ewol/physicsShape/PhysicsCone.h index 0ac99570..67bc0041 100644 --- a/sources/ewol/resources/physicsShape/PhysicsCone.h +++ b/sources/ewol/physicsShape/PhysicsCone.h @@ -11,7 +11,7 @@ #include -#include +#include namespace ewol diff --git a/sources/ewol/resources/physicsShape/PhysicsConvexHull.cpp b/sources/ewol/physicsShape/PhysicsConvexHull.cpp similarity index 94% rename from sources/ewol/resources/physicsShape/PhysicsConvexHull.cpp rename to sources/ewol/physicsShape/PhysicsConvexHull.cpp index 72ca252b..acf23925 100644 --- a/sources/ewol/resources/physicsShape/PhysicsConvexHull.cpp +++ b/sources/ewol/physicsShape/PhysicsConvexHull.cpp @@ -6,7 +6,7 @@ * @license BSD v3 (see license file) */ #include -#include +#include diff --git a/sources/ewol/resources/physicsShape/PhysicsConvexHull.h b/sources/ewol/physicsShape/PhysicsConvexHull.h similarity index 93% rename from sources/ewol/resources/physicsShape/PhysicsConvexHull.h rename to sources/ewol/physicsShape/PhysicsConvexHull.h index 046561ba..1b16ad64 100644 --- a/sources/ewol/resources/physicsShape/PhysicsConvexHull.h +++ b/sources/ewol/physicsShape/PhysicsConvexHull.h @@ -11,7 +11,7 @@ #include -#include +#include namespace ewol diff --git a/sources/ewol/resources/physicsShape/PhysicsCylinder.cpp b/sources/ewol/physicsShape/PhysicsCylinder.cpp similarity index 88% rename from sources/ewol/resources/physicsShape/PhysicsCylinder.cpp rename to sources/ewol/physicsShape/PhysicsCylinder.cpp index 23fbfffd..fde47078 100644 --- a/sources/ewol/resources/physicsShape/PhysicsCylinder.cpp +++ b/sources/ewol/physicsShape/PhysicsCylinder.cpp @@ -6,7 +6,7 @@ * @license BSD v3 (see license file) */ #include -#include +#include bool ewol::PhysicsCylinder::Parse(const char* _line) diff --git a/sources/ewol/resources/physicsShape/PhysicsCylinder.h b/sources/ewol/physicsShape/PhysicsCylinder.h similarity index 92% rename from sources/ewol/resources/physicsShape/PhysicsCylinder.h rename to sources/ewol/physicsShape/PhysicsCylinder.h index e52ad8c4..3a18e970 100644 --- a/sources/ewol/resources/physicsShape/PhysicsCylinder.h +++ b/sources/ewol/physicsShape/PhysicsCylinder.h @@ -11,7 +11,7 @@ #include -#include +#include namespace ewol diff --git a/sources/ewol/resources/physicsShape/PhysicsShape.cpp b/sources/ewol/physicsShape/PhysicsShape.cpp similarity index 77% rename from sources/ewol/resources/physicsShape/PhysicsShape.cpp rename to sources/ewol/physicsShape/PhysicsShape.cpp index a6200a18..68e7ac2c 100644 --- a/sources/ewol/resources/physicsShape/PhysicsShape.cpp +++ b/sources/ewol/physicsShape/PhysicsShape.cpp @@ -6,13 +6,13 @@ * @license BSD v3 (see license file) */ #include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include ewol::PhysicsShape* ewol::PhysicsShape::Create(const etk::UString& _name) diff --git a/sources/ewol/resources/physicsShape/PhysicsShape.h b/sources/ewol/physicsShape/PhysicsShape.h similarity index 100% rename from sources/ewol/resources/physicsShape/PhysicsShape.h rename to sources/ewol/physicsShape/PhysicsShape.h diff --git a/sources/ewol/resources/physicsShape/PhysicsSphere.cpp b/sources/ewol/physicsShape/PhysicsSphere.cpp similarity index 87% rename from sources/ewol/resources/physicsShape/PhysicsSphere.cpp rename to sources/ewol/physicsShape/PhysicsSphere.cpp index 007a442c..47a6825a 100644 --- a/sources/ewol/resources/physicsShape/PhysicsSphere.cpp +++ b/sources/ewol/physicsShape/PhysicsSphere.cpp @@ -6,7 +6,7 @@ * @license BSD v3 (see license file) */ #include -#include +#include diff --git a/sources/ewol/resources/physicsShape/PhysicsSphere.h b/sources/ewol/physicsShape/PhysicsSphere.h similarity index 92% rename from sources/ewol/resources/physicsShape/PhysicsSphere.h rename to sources/ewol/physicsShape/PhysicsSphere.h index 8e7e3fde..0e4f3e9c 100644 --- a/sources/ewol/resources/physicsShape/PhysicsSphere.h +++ b/sources/ewol/physicsShape/PhysicsSphere.h @@ -11,7 +11,7 @@ #include -#include +#include namespace ewol diff --git a/sources/ewol/renderer/Android/Context.cpp b/sources/ewol/renderer/Android/Context.cpp index a6cdce34..334cbdfc 100644 --- a/sources/ewol/renderer/Android/Context.cpp +++ b/sources/ewol/renderer/Android/Context.cpp @@ -16,7 +16,7 @@ #include #include /* include auto generated file */ -#include +#include typedef enum { appl_unknow, diff --git a/sources/ewol/renderer/EMultiCast.cpp b/sources/ewol/renderer/EMultiCast.cpp index b9d08664..648dd802 100644 --- a/sources/ewol/renderer/EMultiCast.cpp +++ b/sources/ewol/renderer/EMultiCast.cpp @@ -7,8 +7,8 @@ */ #include -#include -#include +#include +#include #undef __class__ #define __class__ "EMultiCast" diff --git a/sources/ewol/renderer/EMultiCast.h b/sources/ewol/renderer/EMultiCast.h index df476b09..c5936f9b 100644 --- a/sources/ewol/renderer/EMultiCast.h +++ b/sources/ewol/renderer/EMultiCast.h @@ -6,8 +6,8 @@ * @license BSD v3 (see license file) */ -#ifndef __EWOL_E_OBJECT_MESSAGE_MULTICAST_H__ -#define __EWOL_E_OBJECT_MESSAGE_MULTICAST_H__ +#ifndef __EWOL_E_MULTICAST_H__ +#define __EWOL_E_MULTICAST_H__ #include #include diff --git a/sources/ewol/renderer/EObject.cpp b/sources/ewol/renderer/EObject.cpp index 66f353cd..6a2bf0f4 100644 --- a/sources/ewol/renderer/EObject.cpp +++ b/sources/ewol/renderer/EObject.cpp @@ -33,7 +33,7 @@ ewol::EObject::~EObject(void) { EWOL_DEBUG("delete EObject : [" << m_uniqueId << "]"); GetEObjectManager().Rm(this); - GetEObjectMessageMultiCast().Rm(this); + GetMultiCast().Rm(this); for (int32_t iii=0; iii GetEObjectManager().GetNumberObject()) { EWOL_CRITICAL("It if really dangerous ro remove (delete) element inside a callback ... use ->RemoveObject() which is asynchronous"); } @@ -99,7 +99,7 @@ void ewol::EObject::SendMultiCast(const char* const _messageId, const etk::UStri void ewol::EObject::RegisterMultiCast(const char* const _messageId) { - GetEObjectMessageMultiCast().Add(this, _messageId); + GetMultiCast().Add(this, _messageId); } void ewol::EObject::RegisterOnEvent(ewol::EObject * _destinationObject, @@ -311,12 +311,12 @@ ewol::EObjectManager& ewol::EObject::GetEObjectManager(void) return ewol::GetContext().GetEObjectManager(); } -ewol::EMultiCast& ewol::EObject::GetEObjectMessageMultiCast(void) +ewol::EMultiCast& ewol::EObject::GetMultiCast(void) { return ewol::GetContext().GetEObjectManager().MultiCast(); } -ewol::eSystem& ewol::EObject::GetSystem(void) +ewol::eContext& ewol::EObject::GetContext(void) { return ewol::GetContext(); } diff --git a/sources/ewol/renderer/EObject.h b/sources/ewol/renderer/EObject.h index c2c65021..d2f1ab22 100644 --- a/sources/ewol/renderer/EObject.h +++ b/sources/ewol/renderer/EObject.h @@ -18,7 +18,7 @@ namespace ewol { class EObject; class EObjectManager; class EMultiCast; - class eSystem; + class eContext; }; #include @@ -228,12 +228,12 @@ namespace ewol { * @breif Get the current EObject Message Multicast manager. * @return the requested object manager. */ - ewol::EMultiCast& GetEObjectMessageMultiCast(void); + ewol::EMultiCast& GetMultiCast(void); /** * @brief Get the curent the system inteface. * @return current reference on the instance. */ - eSystem& GetSystem(void); + eContext& GetContext(void); }; }; diff --git a/sources/ewol/renderer/EObjectManager.cpp b/sources/ewol/renderer/EObjectManager.cpp index efe699c9..4427fc5d 100644 --- a/sources/ewol/renderer/EObjectManager.cpp +++ b/sources/ewol/renderer/EObjectManager.cpp @@ -7,7 +7,7 @@ */ #include -#include +#include #include #undef __class__ @@ -70,7 +70,7 @@ void ewol::EObjectManager::informOneObjectIsRemoved(ewol::EObject* _object) } } // call input event manager to remove linked widget ... - ewol::eSystem::GetSystem().OnObjectRemove(_object); + ewol::GetContext().OnObjectRemove(_object); } void ewol::EObjectManager::Rm(ewol::EObject* _object) @@ -113,7 +113,7 @@ void ewol::EObjectManager::AutoRemove(ewol::EObject* _object) EWOL_DEBUG("Auto-Remove EObject : [" << _object->GetId() << "] type=\"" << _object->GetObjectType() << "\""); informOneObjectIsRemoved(_object); m_eObjectAutoRemoveList.PushBack(_object); - ewol::eSystem::GetSystem().ForceRedrawAll(); + ewol::GetContext().ForceRedrawAll(); return; } } diff --git a/sources/ewol/renderer/EObjectManager.h b/sources/ewol/renderer/EObjectManager.h index b81038d7..0dec4cff 100644 --- a/sources/ewol/renderer/EObjectManager.h +++ b/sources/ewol/renderer/EObjectManager.h @@ -36,7 +36,7 @@ namespace ewol private: ewol::EMultiCast m_multiCast; //!< muticast manager public: - ewol::EMultiCast MultiCast(void) { return m_multiCast; }; + ewol::EMultiCast& MultiCast(void) { return m_multiCast; }; }; }; diff --git a/sources/ewol/renderer/Windows/Context.cpp b/sources/ewol/renderer/Windows/Context.cpp index 6a02f6c0..fecb53f0 100644 --- a/sources/ewol/renderer/Windows/Context.cpp +++ b/sources/ewol/renderer/Windows/Context.cpp @@ -16,163 +16,464 @@ #include #include -#include -#include -#include +#include +#include +#include #include #include - -int32_t m_currentHeight = 0; +#include +#include -int64_t guiInterface::GetTime(void) + +int64_t ewol::GetTime(void) { - struct timeval now; + struct timeval now; gettimeofday(&now, NULL); //EWOL_VERBOSE("current time : " << now.tv_sec << "s " << now.tv_usec << "us"); return (int64_t)((int64_t)now.tv_sec*(int64_t)1000000 + (int64_t)now.tv_usec); } -bool inputIsPressed[20]; - -static ewol::SpecialKey guiKeyBoardMode; - -void guiInterface::SetTitle(etk::UString& title) -{ - // TODO ... -} #undef __class__ -#define __class__ "guiInterface" +#define __class__ "ContextWindows" -bool m_run = true; -void guiInterface::Stop(void) +class WindowsContext : public eContext { - m_run = false; - // To exit program ... - PostQuitMessage(0); -} - - -void guiInterface::KeyboardShow(void) -{ - // nothing to do : No keyboard on computer ... -} - - -void guiInterface::KeyboardHide(void) -{ - // nothing to do : No keyboard on computer ... -} - - - -void guiInterface::ChangeSize(ivec2 size) -{ - int border_thickness = GetSystemMetrics(SM_CXSIZEFRAME); - int title_size = GetSystemMetrics(SM_CYCAPTION); - size.setValue(size.x() + border_thickness*2, - size.y() + border_thickness*2 + title_size); - //m_currentHeight = size.y; - // TODO : Later -} - -void guiInterface::ChangePos(ivec2 pos) -{ - // TODO : Later -} - -void guiInterface::GetAbsPos(ivec2& size) -{ - // TODO : Later - size.setValue(0,0); -} - - - -// ------------------------------------------------------------------------- -// ClipBoard AREA : -// ------------------------------------------------------------------------- - -bool l_clipBoardOwnerStd = false; - -void guiInterface::ClipBoardGet(ewol::clipBoard::clipboardListe_te clipboardID) -{ - // this is to force the local system to think we have the buffer - // TODO : Remove this 2 Line when code will be writen - l_clipBoardOwnerStd = true; - switch (clipboardID) - { - case ewol::clipBoard::clipboardSelection: - // NOTE : Windows does not support the middle button the we do it internaly - // just transmit an event , we have the data in the system - eSystem::ClipBoardArrive(clipboardID); - break; - case ewol::clipBoard::clipboardStd: - if (false == l_clipBoardOwnerStd) { - // Generate a request TO the OS - // TODO : Send the message to the OS "We disire to receive the copy buffer ... - } else { - // just transmit an event , we have the data in the system - eSystem::ClipBoardArrive(clipboardID); + private: + int32_t m_currentHeight = 0; + bool m_inputIsPressed[MAX_MANAGE_INPUT]; + ewol::SpecialKey m_guiKeyBoardMode; + bool m_run = true; + bool m_clipBoardOwnerStd = false; + public: + WindowsContext(int32_t _argc, char* _argv[]) : + ewol::eContext(_argc, _argv) + { + for (int32_t iii=0; iiiWndProcReal(_hWnd, _message, _wParam, _lParam); + } + + LRESULT CALLBACK WndProcReal(HWND _hWnd, UINT _message, WPARAM _wParam, LPARAM _lParam) + { + bool buttonIsDown = true; + int32_t mouseButtonId = 0; + ivec2 pos; + // to know all _message : http://wiki.winehq.org/List_Of_Windows__messages + switch (_message) + { + /* ************************************************************************** + * Gui event + * **************************************************************************/ + case WM_CREATE: + EWOL_DEBUG("WM_CREATE"); + return 0; + case WM_CLOSE: + EWOL_DEBUG("WM_CLOSE"); + PostQuitMessage( 0 ); + return 0; + case WM_DESTROY: + EWOL_DEBUG("WM_DESTROY"); + return 0; + case WM_MOVE: + EWOL_DEBUG("WM_MOVE"); + return 0; + case WM_SIZE: + EWOL_DEBUG("WM_SIZE"); + return 0; + /* + case WM_GETMINMAXINFO: + { + MINMAXINFO* tmpVal = (MINMAXINFO*)lParam; + EWOL_DEBUG("WM_GETMINMAXINFO : "); + EWOL_DEBUG(" ptMaxSize : " << tmpVal->ptMaxSize.x << "," << tmpVal->ptMaxSize.y << ")"); + EWOL_DEBUG(" ptMaxPosition : " << tmpVal->ptMaxPosition.x << "," << tmpVal->ptMaxPosition.y << ")"); + EWOL_DEBUG(" ptMinTrackSize : " << tmpVal->ptMinTrackSize.x << "," << tmpVal->ptMinTrackSize.y << ")"); + EWOL_DEBUG(" ptMaxTrackSize : " << tmpVal->ptMaxTrackSize.x << "," << tmpVal->ptMaxTrackSize.y << ")"); + } + return 0; + */ + case WM_WINDOWPOSCHANGING: + { + WINDOWPOS* tmpVal = (WINDOWPOS*)_lParam; + if (NULL != tmpVal) { + //EWOL_DEBUG("WM_WINDOWPOSCHANGING : : (" << tmpVal->x << "," << tmpVal->y << ") ( " << tmpVal->cx << "," << tmpVal->cy << ")"); + // in windows system, we need to remove the size of the border elements : + int border_thickness = GetSystemMetrics(SM_CXSIZEFRAME); + int title_size = GetSystemMetrics(SM_CYCAPTION); + m_currentHeight = tmpVal->cy - 2*border_thickness - title_size; + OS_Resize(tmpVal->cx-2*border_thickness, m_currentHeight); + } + } + return 0; + // these message are not parse by us ... + case WM_SETCURSOR: // Call the windows if we want the mouse event : + case WM_NCHITTEST: // inform the application the position of the mouse is moving + return DefWindowProc( _hWnd, _message, _wParam, _lParam ); + + /* ************************************************************************** + * Keyboard management + * **************************************************************************/ + case WM_KEYUP: + buttonIsDown = false; + case WM_KEYDOWN: + { + etk::UniChar tmpChar = 0; + ewol::keyEvent::keyboard_te keyInput; + switch (_wParam) { + //case 80: // keypad + case VK_UP: keyInput = ewol::keyEvent::keyboardUp; break; + //case 83: // keypad + case VK_LEFT: keyInput = ewol::keyEvent::keyboardLeft; break; + //case 85: // keypad + case VK_RIGHT: keyInput = ewol::keyEvent::keyboardRight; break; + //case 88: // keypad + case VK_DOWN: keyInput = ewol::keyEvent::keyboardDown; break; + //case 81: // keypad + case VK_PRIOR: keyInput = ewol::keyEvent::keyboardPageUp; break; + //case 89: // keypad + case VK_NEXT: keyInput = ewol::keyEvent::keyboardPageDown; break; + //case 79: // keypad + case VK_HOME: keyInput = ewol::keyEvent::keyboardStart; break; + //case 87: // keypad + case VK_END: keyInput = ewol::keyEvent::keyboardEnd; break; + //case VK_: keyInput = ewol::keyEvent::keyboardStopDefil; break; + case VK_PAUSE: keyInput = ewol::keyEvent::keyboardWait; break; + //case 90: // keypad + case VK_INSERT: + keyInput = ewol::keyEvent::keyboardInsert; + guiKeyBoardMode.insert = buttonIsDown; + break; + case VK_F1: keyInput = ewol::keyEvent::keyboardF1; break; + case VK_F2: keyInput = ewol::keyEvent::keyboardF2; break; + case VK_F3: keyInput = ewol::keyEvent::keyboardF3; break; + case VK_F4: keyInput = ewol::keyEvent::keyboardF4; break; + case VK_F5: keyInput = ewol::keyEvent::keyboardF5; break; + case VK_F6: keyInput = ewol::keyEvent::keyboardF6; break; + case VK_F7: keyInput = ewol::keyEvent::keyboardF7; break; + case VK_F8: keyInput = ewol::keyEvent::keyboardF8; break; + case VK_F9: keyInput = ewol::keyEvent::keyboardF9; break; + case VK_F10: keyInput = ewol::keyEvent::keyboardF10; break; + case VK_F11: keyInput = ewol::keyEvent::keyboardF11; break; + case VK_F12: + case VK_F13: + case VK_F14: + case VK_F15: + case VK_F16: + case VK_F17: + case VK_F18: + case VK_F19: + case VK_F20: + case VK_F21: + case VK_F22: + case VK_F23: + case VK_F24: keyInput = ewol::keyEvent::keyboardF12; break; + case VK_CAPITAL: keyInput = ewol::keyEvent::keyboardCapLock; guiKeyBoardMode.capLock = buttonIsDown; break; + + case VK_SHIFT: + case VK_LSHIFT: keyInput = ewol::keyEvent::keyboardShiftLeft; guiKeyBoardMode.shift = buttonIsDown; break; + case VK_RSHIFT: keyInput = ewol::keyEvent::keyboardShiftRight; guiKeyBoardMode.shift = buttonIsDown; break; + + case VK_CONTROL: + case VK_LCONTROL: keyInput = ewol::keyEvent::keyboardCtrlLeft; guiKeyBoardMode.ctrl = buttonIsDown; break; + case VK_RCONTROL: keyInput = ewol::keyEvent::keyboardCtrlRight; guiKeyBoardMode.ctrl = buttonIsDown; break; + + case VK_LWIN: keyInput = ewol::keyEvent::keyboardMetaLeft; guiKeyBoardMode.meta = buttonIsDown; break; + case VK_RWIN: keyInput = ewol::keyEvent::keyboardMetaRight; guiKeyBoardMode.meta = buttonIsDown; break; + + case VK_MENU: + case VK_LMENU: keyInput = ewol::keyEvent::keyboardAlt; guiKeyBoardMode.alt = buttonIsDown; break; + case VK_RMENU: keyInput = ewol::keyEvent::keyboardAltGr; guiKeyBoardMode.altGr = buttonIsDown; break; + //case : keyInput = ewol::keyEvent::keyboardContextMenu; break; + case VK_NUMLOCK: keyInput = ewol::keyEvent::keyboardNumLock; guiKeyBoardMode.numLock = buttonIsDown; break; + case VK_BACK: // DEL + tmpChar.Set(0x08); + break; + // TODO : Really strang, need to understand why ... + case 46: // Suppr + tmpChar.Set(0x7F); + break; + case VK_TAB: // special case for TAB + tmpChar.Set(0x09); + break; + case VK_RETURN: // special case for TAB + tmpChar = '\n'; + break; + default: + { + BYTE kbd[256]; + GetKeyboardState(kbd); + const int BUFFER_LENGTH = 8; //Length of the buffer + WCHAR chars[BUFFER_LENGTH]; + + ToUnicode(wParam,lParam,kbd,chars,BUFFER_LENGTH,0); + tmpChar.SetUtf8((char*)chars); + } + break; + } + EWOL_DEBUG("kjhkjhkjhkjhkj = " << _wParam); + if (tmpChar == 0) { + //EWOL_DEBUG("eventKey Move type : " << GetCharTypeMoveEvent(keyInput) ); + OS_SetKeyboardMove(guiKeyBoardMode, keyInput, buttonIsDown); + } else { + OS_SetKeyboard(guiKeyBoardMode, tmpChar, buttonIsDown); + } + } + return 0; + /* ************************************************************************** + * Mouse management + * **************************************************************************/ + case WM_LBUTTONUP: + buttonIsDown = false; + case WM_LBUTTONDOWN: + mouseButtonId = 1; + pos.setValue(GET_X_LPARAM(_lParam), + m_currentHeight-GET_Y_LPARAM(_lParam)); + inputIsPressed[mouseButtonId] = buttonIsDown; + OS_SetMouseState(mouseButtonId, buttonIsDown, (float)pos.x(), (float)pos.y()); + return 0; + + case WM_MBUTTONUP: + buttonIsDown = false; + case WM_MBUTTONDOWN: + mouseButtonId = 2; + pos.setValue(GET_X_LPARAM(_lParam), + m_currentHeight-GET_Y_LPARAM(_lParam)); + inputIsPressed[mouseButtonId] = buttonIsDown; + OS_SetMouseState(mouseButtonId, buttonIsDown, (float)pos.x(), (float)pos.y()); + return 0; + + case WM_RBUTTONUP: + buttonIsDown = false; + case WM_RBUTTONDOWN: + mouseButtonId = 3; + pos.setValue(GET_X_LPARAM(_lParam), + m_currentHeight-GET_Y_LPARAM(_lParam)); + inputIsPressed[mouseButtonId] = buttonIsDown; + OS_SetMouseState(mouseButtonId, buttonIsDown, (float)pos.x(), (float)pos.y()); + return 0; + + case WM_MOUSEWHEEL: + if (wParam & 0x200000) { + EWOL_DEBUG("event SCROOL UP"); + mouseButtonId = 4; + } else{ + EWOL_DEBUG("event SCROOL DOWN"); + mouseButtonId = 5; + } + pos.setValue(GET_X_LPARAM(_lParam), + m_currentHeight-GET_Y_LPARAM(_lParam)); + OS_SetMouseState(mouseButtonId, true, (float)pos.x(), (float)pos.y()); + OS_SetMouseState(mouseButtonId, false, (float)pos.x(), (float)pos.y()); + return 0; + + case WM_MOUSEHOVER: + case WM_MOUSEMOVE: + pos.setValue(GET_X_LPARAM(_lParam), + m_currentHeight-GET_Y_LPARAM(_lParam)); + for (int32_t iii=0; iii -#include - -// Function Declarations - -LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam); -void EnableOpenGL(HWND hWnd, HDC * hDC, HGLRC * hRC); -void DisableOpenGL(HWND hWnd, HDC hDC, HGLRC hRC); -int Windows_Run(void); - - /** * @brief Main of the program * @param std IO * @return std IO */ -int guiInterface::main(int argc, const char *argv[]) +int ewol::Run(int _argc, const char *_argv[]) { GLenum err = glewInit(); - if (GLEW_OK != err) - { + if (GLEW_OK != err) { /* Problem: glewInit failed, something is seriously wrong. */ EWOL_ERROR("Error:" << glewGetErrorString(err)); } @@ -180,373 +481,15 @@ int guiInterface::main(int argc, const char *argv[]) EWOL_ERROR("OpenGL 2.0 not available"); //return 1; } - - for (int32_t iii=0; iiiptMaxSize.x << "," << tmpVal->ptMaxSize.y << ")"); - EWOL_DEBUG(" ptMaxPosition : " << tmpVal->ptMaxPosition.x << "," << tmpVal->ptMaxPosition.y << ")"); - EWOL_DEBUG(" ptMinTrackSize : " << tmpVal->ptMinTrackSize.x << "," << tmpVal->ptMinTrackSize.y << ")"); - EWOL_DEBUG(" ptMaxTrackSize : " << tmpVal->ptMaxTrackSize.x << "," << tmpVal->ptMaxTrackSize.y << ")"); - } - return 0; - */ - case WM_WINDOWPOSCHANGING: - { - WINDOWPOS* tmpVal = (WINDOWPOS*)lParam; - if (NULL != tmpVal) { - //EWOL_DEBUG("WM_WINDOWPOSCHANGING : : (" << tmpVal->x << "," << tmpVal->y << ") ( " << tmpVal->cx << "," << tmpVal->cy << ")"); - // in windows system, we need to remove the size of the border elements : - int border_thickness = GetSystemMetrics(SM_CXSIZEFRAME); - int title_size = GetSystemMetrics(SM_CYCAPTION); - m_currentHeight = tmpVal->cy - 2*border_thickness - title_size; - eSystem::Resize(tmpVal->cx-2*border_thickness, m_currentHeight); - } - } - return 0; - // these message are not parse by us ... - case WM_SETCURSOR: // Call the windows if we want the mouse event : - case WM_NCHITTEST: // inform the application the position of the mouse is moving - return DefWindowProc( hWnd, message, wParam, lParam ); - - /* ************************************************************************** - * Keyboard management - * **************************************************************************/ - case WM_KEYUP: - buttonIsDown = false; - case WM_KEYDOWN: - { - etk::UniChar tmpChar = 0; - ewol::keyEvent::keyboard_te keyInput; - switch (wParam) { - //case 80: // keypad - case VK_UP: keyInput = ewol::keyEvent::keyboardUp; break; - //case 83: // keypad - case VK_LEFT: keyInput = ewol::keyEvent::keyboardLeft; break; - //case 85: // keypad - case VK_RIGHT: keyInput = ewol::keyEvent::keyboardRight; break; - //case 88: // keypad - case VK_DOWN: keyInput = ewol::keyEvent::keyboardDown; break; - //case 81: // keypad - case VK_PRIOR: keyInput = ewol::keyEvent::keyboardPageUp; break; - //case 89: // keypad - case VK_NEXT: keyInput = ewol::keyEvent::keyboardPageDown; break; - //case 79: // keypad - case VK_HOME: keyInput = ewol::keyEvent::keyboardStart; break; - //case 87: // keypad - case VK_END: keyInput = ewol::keyEvent::keyboardEnd; break; - //case VK_: keyInput = ewol::keyEvent::keyboardStopDefil; break; - case VK_PAUSE: keyInput = ewol::keyEvent::keyboardWait; break; - //case 90: // keypad - case VK_INSERT: - keyInput = ewol::keyEvent::keyboardInsert; - guiKeyBoardMode.insert = buttonIsDown; - break; - case VK_F1: keyInput = ewol::keyEvent::keyboardF1; break; - case VK_F2: keyInput = ewol::keyEvent::keyboardF2; break; - case VK_F3: keyInput = ewol::keyEvent::keyboardF3; break; - case VK_F4: keyInput = ewol::keyEvent::keyboardF4; break; - case VK_F5: keyInput = ewol::keyEvent::keyboardF5; break; - case VK_F6: keyInput = ewol::keyEvent::keyboardF6; break; - case VK_F7: keyInput = ewol::keyEvent::keyboardF7; break; - case VK_F8: keyInput = ewol::keyEvent::keyboardF8; break; - case VK_F9: keyInput = ewol::keyEvent::keyboardF9; break; - case VK_F10: keyInput = ewol::keyEvent::keyboardF10; break; - case VK_F11: keyInput = ewol::keyEvent::keyboardF11; break; - case VK_F12: - case VK_F13: - case VK_F14: - case VK_F15: - case VK_F16: - case VK_F17: - case VK_F18: - case VK_F19: - case VK_F20: - case VK_F21: - case VK_F22: - case VK_F23: - case VK_F24: keyInput = ewol::keyEvent::keyboardF12; break; - case VK_CAPITAL: keyInput = ewol::keyEvent::keyboardCapLock; guiKeyBoardMode.capLock = buttonIsDown; break; - - case VK_SHIFT: - case VK_LSHIFT: keyInput = ewol::keyEvent::keyboardShiftLeft; guiKeyBoardMode.shift = buttonIsDown; break; - case VK_RSHIFT: keyInput = ewol::keyEvent::keyboardShiftRight; guiKeyBoardMode.shift = buttonIsDown; break; - - case VK_CONTROL: - case VK_LCONTROL: keyInput = ewol::keyEvent::keyboardCtrlLeft; guiKeyBoardMode.ctrl = buttonIsDown; break; - case VK_RCONTROL: keyInput = ewol::keyEvent::keyboardCtrlRight; guiKeyBoardMode.ctrl = buttonIsDown; break; - - case VK_LWIN: keyInput = ewol::keyEvent::keyboardMetaLeft; guiKeyBoardMode.meta = buttonIsDown; break; - case VK_RWIN: keyInput = ewol::keyEvent::keyboardMetaRight; guiKeyBoardMode.meta = buttonIsDown; break; - - case VK_MENU: - case VK_LMENU: keyInput = ewol::keyEvent::keyboardAlt; guiKeyBoardMode.alt = buttonIsDown; break; - case VK_RMENU: keyInput = ewol::keyEvent::keyboardAltGr; guiKeyBoardMode.altGr = buttonIsDown; break; - //case : keyInput = ewol::keyEvent::keyboardContextMenu; break; - case VK_NUMLOCK: keyInput = ewol::keyEvent::keyboardNumLock; guiKeyBoardMode.numLock = buttonIsDown; break; - case VK_BACK: // DEL - tmpChar.Set(0x08); - break; - // TODO : Really strang, need to understand why ... - case 46: // Suppr - tmpChar.Set(0x7F); - break; - case VK_TAB: // special case for TAB - tmpChar.Set(0x09); - break; - case VK_RETURN: // special case for TAB - tmpChar = '\n'; - break; - default: - { - BYTE kbd[256]; - GetKeyboardState(kbd); - const int BUFFER_LENGTH = 8; //Length of the buffer - WCHAR chars[BUFFER_LENGTH]; - - ToUnicode(wParam,lParam,kbd,chars,BUFFER_LENGTH,0); - tmpChar.SetUtf8((char*)chars); - } - break; - } - EWOL_DEBUG("kjhkjhkjhkjhkj = " << wParam); - if (tmpChar == 0) { - //EWOL_DEBUG("eventKey Move type : " << GetCharTypeMoveEvent(keyInput) ); - eSystem::SetKeyboardMove(guiKeyBoardMode, keyInput, buttonIsDown); - } else { - eSystem::SetKeyboard(guiKeyBoardMode, tmpChar, buttonIsDown); - } - } - return 0; - /* ************************************************************************** - * Mouse management - * **************************************************************************/ - case WM_LBUTTONUP: - buttonIsDown = false; - case WM_LBUTTONDOWN: - mouseButtonId = 1; - pos.setValue(GET_X_LPARAM(lParam), - m_currentHeight-GET_Y_LPARAM(lParam)); - inputIsPressed[mouseButtonId] = buttonIsDown; - eSystem::SetMouseState(mouseButtonId, buttonIsDown, (float)pos.x(), (float)pos.y()); - return 0; - - case WM_MBUTTONUP: - buttonIsDown = false; - case WM_MBUTTONDOWN: - mouseButtonId = 2; - pos.setValue(GET_X_LPARAM(lParam), - m_currentHeight-GET_Y_LPARAM(lParam)); - inputIsPressed[mouseButtonId] = buttonIsDown; - eSystem::SetMouseState(mouseButtonId, buttonIsDown, (float)pos.x(), (float)pos.y()); - return 0; - - case WM_RBUTTONUP: - buttonIsDown = false; - case WM_RBUTTONDOWN: - mouseButtonId = 3; - pos.setValue(GET_X_LPARAM(lParam), - m_currentHeight-GET_Y_LPARAM(lParam)); - inputIsPressed[mouseButtonId] = buttonIsDown; - eSystem::SetMouseState(mouseButtonId, buttonIsDown, (float)pos.x(), (float)pos.y()); - return 0; - - case WM_MOUSEWHEEL: - if (wParam & 0x200000) { - EWOL_DEBUG("event SCROOL UP"); - mouseButtonId = 4; - } else{ - EWOL_DEBUG("event SCROOL DOWN"); - mouseButtonId = 5; - } - pos.setValue(GET_X_LPARAM(lParam), - m_currentHeight-GET_Y_LPARAM(lParam)); - eSystem::SetMouseState(mouseButtonId, true, (float)pos.x(), (float)pos.y()); - eSystem::SetMouseState(mouseButtonId, false, (float)pos.x(), (float)pos.y()); - return 0; - - case WM_MOUSEHOVER: - case WM_MOUSEMOVE: - pos.setValue(GET_X_LPARAM(lParam), - m_currentHeight-GET_Y_LPARAM(lParam)); - for (int32_t iii=0; iiiRun(); + delete(interface); + interface = NULL; + return retValue; } -// Enable OpenGL -void EnableOpenGL(HWND hWnd, HDC * hDC, HGLRC * hRC) -{ - PIXELFORMATDESCRIPTOR pfd; - int format; - - // get the device context (DC) - *hDC = GetDC( hWnd ); - - // set the pixel format for the DC - ZeroMemory( &pfd, sizeof( pfd ) ); - pfd.nSize = sizeof( pfd ); - pfd.nVersion = 1; - pfd.dwFlags = PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL | PFD_DOUBLEBUFFER; - pfd.iPixelType = PFD_TYPE_RGBA; - pfd.cColorBits = 24; - pfd.cDepthBits = 16; - pfd.iLayerType = PFD_MAIN_PLANE; - format = ChoosePixelFormat( *hDC, &pfd ); - SetPixelFormat( *hDC, format, &pfd ); - - // create and enable the render context (RC) - *hRC = wglCreateContext( *hDC ); - wglMakeCurrent( *hDC, *hRC ); - -} - -// Disable OpenGL - -void DisableOpenGL(HWND hWnd, HDC hDC, HGLRC hRC) -{ - wglMakeCurrent( NULL, NULL ); - wglDeleteContext( hRC ); - ReleaseDC( hWnd, hDC ); -} - -void guiInterface::ForceOrientation(ewol::orientation_te orientation) -{ - // nothing to do ... -} - -void guiInterface::GrabPointerEvents(bool isGrabbed, vec2 forcedPosition) -{ - // nothing to do ... -} - -void guiInterface::SetCursor(ewol::cursorDisplay_te newCursor) -{ - // nothing to do ... -} - - diff --git a/sources/ewol/renderer/X11/Context.cpp b/sources/ewol/renderer/X11/Context.cpp index 4955c6c0..f14bcdde 100644 --- a/sources/ewol/renderer/X11/Context.cpp +++ b/sources/ewol/renderer/X11/Context.cpp @@ -15,8 +15,8 @@ #include #include -#include -#include +#include +#include #include #include @@ -50,7 +50,7 @@ bool hasDisplay = false; #define X11_INFO EWOL_VERBOSE #define X11_CRITICAL EWOL_VERBOSE #endif -int64_t ewol::eSystem::GetTime(void) +int64_t ewol::GetTime(void) { struct timespec now; int ret = clock_gettime(CLOCK_REALTIME, &now); @@ -102,7 +102,7 @@ extern "C" { #undef __class__ #define __class__ "x11Interface" -class X11Interface : public ewol::eSystem +class X11Interface : public ewol::eContext { private: ewol::SpecialKey m_guiKeyBoardMode; @@ -139,7 +139,8 @@ class X11Interface : public ewol::eSystem Atom XAtomeDeleteWindows; ewol::cursorDisplay_te m_currentCursor; //!< select the current cursor to display : public: - X11Interface(void) : + X11Interface(int32_t _argc, const char* _argv[]) : + ewol::eContext(_argc, _argv), m_display(NULL), m_originX(0), m_originY(0), @@ -210,7 +211,7 @@ class X11Interface : public ewol::eSystem X11_INFO("Receive : ClientMessage"); if(XAtomeDeleteWindows == (int64_t)event.xclient.data.l[0]) { EWOL_INFO(" ==> Kill Requested ..."); - eSystem::OS_Stop(); + OS_Stop(); m_run = false; } } @@ -1195,11 +1196,11 @@ class X11Interface : public ewol::eSystem return true; } /****************************************************************************************/ - void SetTitle(etk::UString& title) + void SetTitle(const etk::UString& _title) { X11_INFO("X11: Set Title (START)"); XTextProperty tp; - etk::Char tmpChar = title.c_str(); + etk::Char tmpChar = _title.c_str(); tp.value = (unsigned char *)((const char*)tmpChar); tp.encoding = XA_WM_NAME; tp.format = 8; @@ -1282,13 +1283,14 @@ class X11Interface : public ewol::eSystem * @param std IO * @return std IO */ -int ewol::eSystem::main(int _argc, const char *_argv[]) +int ewol::Run(int _argc, const char *_argv[]) { - X11Interface* interface = new X11Interface(); + X11Interface* interface = new X11Interface(_argc, _argv); if (NULL == interface) { EWOL_CRITICAL("Can not create the X11 interface ... MEMORY allocation error"); return -2; } + int32_t retValue = interface->Run(); delete(interface); interface = NULL; diff --git a/sources/ewol/renderer/eContext.cpp b/sources/ewol/renderer/eContext.cpp index 5dad3dc2..b11ffeb4 100644 --- a/sources/ewol/renderer/eContext.cpp +++ b/sources/ewol/renderer/eContext.cpp @@ -103,13 +103,13 @@ void ewol::eContext::ProcessEvents(void) /*bool returnVal = */APP_Init(*this); break; case THREAD_RECALCULATE_SIZE: - eSystem::ForceRedrawAll(); + ForceRedrawAll(); break; case THREAD_RESIZE: //EWOL_DEBUG("Receive MSG : THREAD_RESIZE"); m_windowsSize = data.dimention; ewol::dimension::SetPixelWindowsSize(m_windowsSize); - eSystem::ForceRedrawAll(); + ForceRedrawAll(); break; case THREAD_INPUT_MOTION: //EWOL_DEBUG("Receive MSG : THREAD_INPUT_MOTION"); @@ -220,9 +220,9 @@ void ewol::eContext::SetArchiveDir(int mode, const char* str) -ewol::eContext::eSystem(void) : +ewol::eContext::eContext(int32_t _argc, const char* _argv[]) : m_previousDisplayTime(0), - m_managementInput(*this), + m_input(*this), m_FpsSystemEvent( "Event ", false), m_FpsSystemContext("Context ", false), m_FpsSystem( "Draw ", true), @@ -230,9 +230,35 @@ ewol::eContext::eSystem(void) : m_windowsCurrent(NULL), m_windowsSize(320,480) { + m_commandLine.Parse(_argc, _argv); EWOL_INFO("==> Ewol System Init (BEGIN)"); // set the curent interface : - SetSystem(); + LockContext(); + // parse the debug level: + for(esize_t iii=m_commandLine.Size()-1 ; iii>=0 ; --iii) { + if (m_commandLine.Get(iii) == "-l0") { + GeneralDebugSetLevel(etk::LOG_LEVEL_NONE); + } else if (m_commandLine.Get(iii) == "-l1") { + GeneralDebugSetLevel(etk::LOG_LEVEL_CRITICAL); + } else if (m_commandLine.Get(iii) == "-l2") { + GeneralDebugSetLevel(etk::LOG_LEVEL_ERROR); + } else if (m_commandLine.Get(iii) == "-l3") { + GeneralDebugSetLevel(etk::LOG_LEVEL_WARNING); + } else if (m_commandLine.Get(iii) == "-l4") { + GeneralDebugSetLevel(etk::LOG_LEVEL_INFO); + } else if (m_commandLine.Get(iii) == "-l5") { + GeneralDebugSetLevel(etk::LOG_LEVEL_DEBUG); + } else if( m_commandLine.Get(iii) == "-l6" + || m_commandLine.Get(iii) == "-l7" + || m_commandLine.Get(iii) == "-l8" + || m_commandLine.Get(iii) == "-l9") { + GeneralDebugSetLevel(etk::LOG_LEVEL_VERBOSE); + } else { + continue; + } + m_commandLine.Remove(iii); + } + EWOL_INFO("v:" << ewol::GetVersion()); EWOL_INFO("Build Date: " << date::GetYear() << "/" << date::GetMonth() << "/" << date::GetDay() << " " << date::GetHour() << "h" << date::GetMinute()); // TODO : Remove this ... @@ -253,15 +279,15 @@ ewol::eContext::eSystem(void) : ForceOrientation(ewol::SCREEN_ORIENTATION_AUTO); #endif // release the curent interface : - ReleaseSystem(); + UnLockContext(); EWOL_INFO("==> Ewol System Init (END)"); } -ewol::eContext::~eSystem(void) +ewol::eContext::~eContext(void) { EWOL_INFO("==> Ewol System Un-Init (BEGIN)"); // set the curent interface : - SetSystem(); + LockContext(); // call application to uninit APP_UnInit(*this); if (NULL!=m_windowsCurrent) { @@ -271,7 +297,7 @@ ewol::eContext::~eSystem(void) m_windowsCurrent = NULL; m_msgSystem.Clean(); // release the curent interface : - ReleaseSystem(); + UnLockContext(); EWOL_INFO("==> Ewol System Un-Init (END)"); } @@ -419,7 +445,7 @@ bool ewol::eContext::OS_Draw(bool _displayEveryTime) //! Event management section ... { // set the curent interface : - SetSystem(); + LockContext(); ProcessEvents(); // call all the widget that neded to do something periodicly //! ewol::widgetManager::PeriodicCall(currentTime); @@ -437,7 +463,7 @@ bool ewol::eContext::OS_Draw(bool _displayEveryTime) //! bool needRedraw = ewol::widgetManager::IsDrawingNeeded(); needRedraw = m_widgetManager.IsDrawingNeeded(); // release the curent interface : - ReleaseSystem(); + UnLockContext(); } bool hasDisplayDone = false; //! Drawing section : @@ -480,7 +506,7 @@ bool ewol::eContext::OS_Draw(bool _displayEveryTime) } /* -void ewol::eSystem::OnObjectRemove(ewol::EObject * removeObject) +void ewol::eContext::OnObjectRemove(ewol::EObject * removeObject) { m_managementInput.OnObjectRemove(removeObject); } @@ -500,8 +526,13 @@ void ewol::eContext::OS_OpenGlContextDestroy(void) void ewol::eContext::SetWindows(ewol::Windows* _windows) { + // Remove current Focus : + m_widgetManager.FocusSetDefault(NULL); + m_widgetManager.FocusRelease(); // set the new pointer as windows system m_windowsCurrent = _windows; + // Set the new default Focus : + m_widgetManager.FocusSetDefault(_windows); // request all the widget redrawing ForceRedrawAll(); } diff --git a/sources/ewol/renderer/eContext.h b/sources/ewol/renderer/eContext.h index 6feb9df1..029eff9b 100644 --- a/sources/ewol/renderer/eContext.h +++ b/sources/ewol/renderer/eContext.h @@ -21,6 +21,7 @@ #include #include #include +#include // TODO : Remove this from here ... @@ -76,8 +77,18 @@ class eSystemMessage { namespace ewol { + typedef enum { + SCREEN_ORIENTATION_AUTO = 0, + SCREEN_ORIENTATION_LANDSCAPE, + SCREEN_ORIENTATION_PORTRAIT, + } orientation_te; + class eContext { + private: + ewol::CommandLine m_commandLine; //!< Start command line information + public: + ewol::CommandLine& GetCmd(void) { return m_commandLine; }; private: ewol::ConfigFont m_configFont; //!< global font configuration public: @@ -95,7 +106,7 @@ namespace ewol public: ewol::ResourceManager& GetResourcesManager(void) { return m_resourceManager; }; public: - eContext(void); + eContext(int32_t _argc=0, const char* _argv[]=NULL); virtual ~eContext(void); protected: /** @@ -277,7 +288,7 @@ namespace ewol * @brief Set the new title of the windows * @param[in] title New desired title */ - virtual void SetTitle(etk::UString& _title) { }; + virtual void SetTitle(const etk::UString& _title) { }; /** * @brief Force the screen orientation (availlable on portable elements ... * @param[in] _orientation Selected orientation. @@ -332,8 +343,8 @@ namespace ewol //!< 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::eSystem& _system); -void APP_UnInit(ewol::eSystem& _system); +bool APP_Init(ewol::eContext& _context); +void APP_UnInit(ewol::eContext& _context); #endif diff --git a/sources/ewol/renderer/eInput.cpp b/sources/ewol/renderer/eInput.cpp index a4bd0e1f..ca5dd0ca 100644 --- a/sources/ewol/renderer/eInput.cpp +++ b/sources/ewol/renderer/eInput.cpp @@ -15,9 +15,9 @@ #include #include -#include -#include -#include +#include +#include +#include #include #include diff --git a/sources/ewol/renderer/eInput.h b/sources/ewol/renderer/eInput.h index b646ec10..e122486e 100644 --- a/sources/ewol/renderer/eInput.h +++ b/sources/ewol/renderer/eInput.h @@ -76,7 +76,7 @@ namespace ewol ewol::Widget* destWidget, int32_t realInputId); private: - ewol::eContext& m_system; + ewol::eContext& m_context; public: eInput(ewol::eContext& _context); ~eInput(void); diff --git a/sources/ewol/resources/Colored3DObject.cpp b/sources/ewol/resources/Colored3DObject.cpp index 9416c693..1a010034 100644 --- a/sources/ewol/resources/Colored3DObject.cpp +++ b/sources/ewol/resources/Colored3DObject.cpp @@ -21,7 +21,7 @@ ewol::Colored3DObject::Colored3DObject(etk::UString _genName) : etk::UString tmpString("DATA:simple3D.prog"); // get the shader resource : m_GLPosition = 0; - if (true == ewol::ResourceManager::Keep(tmpString, m_GLprogram) ) { + if (true == ewol::resource::Keep(tmpString, m_GLprogram) ) { m_GLPosition = m_GLprogram->GetAttribute("EW_coord3d"); m_GLColor = m_GLprogram->GetUniform("EW_color"); m_GLMatrix = m_GLprogram->GetUniform("EW_MatrixTransformation"); @@ -31,7 +31,7 @@ ewol::Colored3DObject::Colored3DObject(etk::UString _genName) : ewol::Colored3DObject::~Colored3DObject(void) { // remove dynamics dependencies : - ewol::ResourceManager::Release(m_GLprogram); + ewol::resource::Release(m_GLprogram); } diff --git a/sources/ewol/resources/Mesh.cpp b/sources/ewol/resources/Mesh.cpp index 06423f9f..63c212e4 100644 --- a/sources/ewol/resources/Mesh.cpp +++ b/sources/ewol/resources/Mesh.cpp @@ -33,7 +33,7 @@ ewol::Mesh::Mesh(const etk::UString& _fileName, const etk::UString& _shaderName) //EWOL_DEBUG(m_name << " " << m_light); - if (true == ewol::ResourceManager::Keep(_shaderName, m_GLprogram) ) { + if (true == ewol::resource::Keep(_shaderName, m_GLprogram) ) { m_GLPosition = m_GLprogram->GetAttribute("EW_coord3d"); m_GLtexture = m_GLprogram->GetAttribute("EW_texture2d"); m_GLNormal = m_GLprogram->GetAttribute("EW_normal"); @@ -44,7 +44,7 @@ ewol::Mesh::Mesh(const etk::UString& _fileName, const etk::UString& _shaderName) m_light.Link(m_GLprogram, "EW_directionalLight"); } // this is the properties of the buffer requested : "r"/"w" + "-" + buffer type "f"=flaot "i"=integer - ewol::ResourceManager::Keep("w-fff", m_verticesVBO); + ewol::resource::Keep("w-fff", m_verticesVBO); // load the curent file : etk::UString tmpName = _fileName.ToLower(); @@ -68,8 +68,8 @@ ewol::Mesh::Mesh(const etk::UString& _fileName, const etk::UString& _shaderName) ewol::Mesh::~Mesh(void) { // remove dynamics dependencies : - ewol::ResourceManager::Release(m_GLprogram); - ewol::ResourceManager::Release(m_verticesVBO); + ewol::resource::Release(m_GLprogram); + ewol::resource::Release(m_verticesVBO); if (m_functionFreeShape!=NULL) { m_functionFreeShape(m_pointerShape); m_pointerShape = NULL; diff --git a/sources/ewol/resources/Mesh.h b/sources/ewol/resources/Mesh.h index 6df6930a..87ce53ec 100644 --- a/sources/ewol/resources/Mesh.h +++ b/sources/ewol/resources/Mesh.h @@ -18,7 +18,7 @@ #include #include #include -#include +#include // 3 "float" elements #define MESH_VBO_VERTICES (0) // 2 "float" elements diff --git a/sources/ewol/resources/Program.cpp b/sources/ewol/resources/Program.cpp index 6e9536aa..53eba715 100644 --- a/sources/ewol/resources/Program.cpp +++ b/sources/ewol/resources/Program.cpp @@ -37,14 +37,14 @@ ewol::Program::Program(const etk::UString& filename) : // remove extention ... tmpFilename.Remove(tmpFilename.Size()-4, 4); ewol::Shader* tmpShader = NULL; - if (false == ewol::ResourceManager::Keep(tmpFilename+"vert", tmpShader)) { + if (false == ewol::resource::Keep(tmpFilename+"vert", tmpShader)) { EWOL_CRITICAL("Error while getting a specific shader filename : " << tmpFilename); return; } else { EWOL_DEBUG("Add shader on program : "<< tmpFilename << "vert"); m_shaderList.PushBack(tmpShader); } - if (false == ewol::ResourceManager::Keep(tmpFilename+"frag", tmpShader)) { + if (false == ewol::resource::Keep(tmpFilename+"frag", tmpShader)) { EWOL_CRITICAL("Error while getting a specific shader filename : " << tmpFilename); return; } else { @@ -81,7 +81,7 @@ ewol::Program::Program(const etk::UString& filename) : // get it with relative position : etk::UString tmpFilename = file.GetRelativeFolder() + tmpData; ewol::Shader* tmpShader = NULL; - if (false == ewol::ResourceManager::Keep(tmpFilename, tmpShader)) { + if (false == ewol::resource::Keep(tmpFilename, tmpShader)) { EWOL_CRITICAL("Error while getting a specific shader filename : " << tmpFilename); } else { EWOL_DEBUG("Add shader on program : "<< tmpFilename); @@ -99,7 +99,7 @@ ewol::Program::Program(const etk::UString& filename) : ewol::Program::~Program(void) { for (int32_t iii=0; iii(ewol::eSystem::GetSystem().GetResourcesManager().LocalKeep(filename)); + object = static_cast(ewol::GetContext().GetResourcesManager().LocalKeep(filename)); if (NULL != object) { return true; } @@ -192,15 +192,15 @@ bool ewol::ResourceManager::Keep(const etk::UString& filename, ewol::TexturedFon EWOL_ERROR("allocation error of a resource : " << filename); return false; } - ewol::eSystem::GetSystem().GetResourcesManager().LocalAdd(object); + ewol::GetContext().GetResourcesManager().LocalAdd(object); return true; } -bool ewol::ResourceManager::Keep(const etk::UString& filename, ewol::FontBase*& object) +bool ewol::resource::Keep(const etk::UString& filename, ewol::FontBase*& object) { EWOL_VERBOSE("KEEP : Font : file : \"" << filename << "\""); - object = static_cast(ewol::eSystem::GetSystem().GetResourcesManager().LocalKeep(filename)); + object = static_cast(ewol::GetContext().GetResourcesManager().LocalKeep(filename)); if (NULL != object) { return true; } @@ -210,14 +210,14 @@ bool ewol::ResourceManager::Keep(const etk::UString& filename, ewol::FontBase*& EWOL_ERROR("allocation error of a resource : " << filename); return false; } - ewol::eSystem::GetSystem().GetResourcesManager().LocalAdd(object); + ewol::GetContext().GetResourcesManager().LocalAdd(object); return true; } -bool ewol::ResourceManager::Keep(const etk::UString& filename, ewol::Program*& object) +bool ewol::resource::Keep(const etk::UString& filename, ewol::Program*& object) { EWOL_VERBOSE("KEEP : Program : file : \"" << filename << "\""); - object = static_cast(ewol::eSystem::GetSystem().GetResourcesManager().LocalKeep(filename)); + object = static_cast(ewol::GetContext().GetResourcesManager().LocalKeep(filename)); if (NULL != object) { return true; } @@ -227,14 +227,14 @@ bool ewol::ResourceManager::Keep(const etk::UString& filename, ewol::Program*& o EWOL_ERROR("allocation error of a resource : " << filename); return false; } - ewol::eSystem::GetSystem().GetResourcesManager().LocalAdd(object); + ewol::GetContext().GetResourcesManager().LocalAdd(object); return true; } -bool ewol::ResourceManager::Keep(const etk::UString& filename, ewol::Shader*& object) +bool ewol::resource::Keep(const etk::UString& filename, ewol::Shader*& object) { EWOL_VERBOSE("KEEP : Simpleshader : file : \"" << filename << "\""); - object = static_cast(ewol::eSystem::GetSystem().GetResourcesManager().LocalKeep(filename)); + object = static_cast(ewol::GetContext().GetResourcesManager().LocalKeep(filename)); if (NULL != object) { return true; } @@ -244,11 +244,11 @@ bool ewol::ResourceManager::Keep(const etk::UString& filename, ewol::Shader*& ob EWOL_ERROR("allocation error of a resource : " << filename); return false; } - ewol::eSystem::GetSystem().GetResourcesManager().LocalAdd(object); + ewol::GetContext().GetResourcesManager().LocalAdd(object); return true; } -bool ewol::ResourceManager::Keep(ewol::Texture*& object) +bool ewol::resource::Keep(ewol::Texture*& object) { // this element create a new one every time .... object = new ewol::Texture(""); @@ -256,15 +256,15 @@ bool ewol::ResourceManager::Keep(ewol::Texture*& object) EWOL_ERROR("allocation error of a resource : ??TEX??"); return false; } - ewol::eSystem::GetSystem().GetResourcesManager().LocalAdd(object); + ewol::GetContext().GetResourcesManager().LocalAdd(object); return true; } -bool ewol::ResourceManager::Keep(ewol::Colored3DObject*& _object) +bool ewol::resource::Keep(ewol::Colored3DObject*& _object) { EWOL_VERBOSE("KEEP : direct Colored3DObject"); etk::UString filename = "?metaObject?Colored3DObject"; - _object = static_cast(ewol::eSystem::GetSystem().GetResourcesManager().LocalKeep(filename)); + _object = static_cast(ewol::GetContext().GetResourcesManager().LocalKeep(filename)); if (NULL != _object) { return true; } @@ -274,7 +274,7 @@ bool ewol::ResourceManager::Keep(ewol::Colored3DObject*& _object) EWOL_ERROR("allocation error of a resource : Colored3DObject "); return false; } - ewol::eSystem::GetSystem().GetResourcesManager().LocalAdd(_object); + ewol::GetContext().GetResourcesManager().LocalAdd(_object); return true; } #ifdef __TARGET_OS__Android @@ -297,7 +297,7 @@ static int32_t nextP2(int32_t _value) } #endif -bool ewol::ResourceManager::Keep(const etk::UString& _filename, ewol::TextureFile*& _object, ivec2 _size) +bool ewol::resource::Keep(const etk::UString& _filename, ewol::TextureFile*& _object, ivec2 _size) { EWOL_INFO("KEEP : TextureFile : file : " << _filename << " basic size=" << _size); if (_filename == "") { @@ -306,7 +306,7 @@ bool ewol::ResourceManager::Keep(const etk::UString& _filename, ewol::TextureFil EWOL_ERROR("allocation error of a resource : ??TEX??"); return false; } - ewol::eSystem::GetSystem().GetResourcesManager().LocalAdd(_object); + ewol::GetContext().GetResourcesManager().LocalAdd(_object); return true; } if (_size.x()==0) { @@ -337,7 +337,7 @@ bool ewol::ResourceManager::Keep(const etk::UString& _filename, ewol::TextureFil } EWOL_INFO("KEEP : TextureFile : file : \"" << TmpFilename << "\" new size=" << _size); - _object = static_cast(ewol::eSystem::GetSystem().GetResourcesManager().LocalKeep(TmpFilename)); + _object = static_cast(ewol::GetContext().GetResourcesManager().LocalKeep(TmpFilename)); if (NULL != _object) { return true; } @@ -348,14 +348,14 @@ bool ewol::ResourceManager::Keep(const etk::UString& _filename, ewol::TextureFil EWOL_ERROR("allocation error of a resource : " << _filename); return false; } - ewol::eSystem::GetSystem().GetResourcesManager().LocalAdd(_object); + ewol::GetContext().GetResourcesManager().LocalAdd(_object); return true; } -bool ewol::ResourceManager::Keep(const etk::UString& _meshName, ewol::Mesh*& _object) +bool ewol::resource::Keep(const etk::UString& _meshName, ewol::Mesh*& _object) { - _object = static_cast(ewol::eSystem::GetSystem().GetResourcesManager().LocalKeep(_meshName)); + _object = static_cast(ewol::GetContext().GetResourcesManager().LocalKeep(_meshName)); if (NULL != _object) { return true; } @@ -364,12 +364,12 @@ bool ewol::ResourceManager::Keep(const etk::UString& _meshName, ewol::Mesh*& _ob EWOL_ERROR("allocation error of a resource : ??Mesh??" << _meshName); return false; } - ewol::eSystem::GetSystem().GetResourcesManager().LocalAdd(_object); + ewol::GetContext().GetResourcesManager().LocalAdd(_object); return true; } -bool ewol::ResourceManager::Keep(const etk::UString& _accesMode, ewol::VirtualBufferObject*& _object) +bool ewol::resource::Keep(const etk::UString& _accesMode, ewol::VirtualBufferObject*& _object) { // this element create a new one every time .... _object = new ewol::VirtualBufferObject(_accesMode); @@ -377,14 +377,14 @@ bool ewol::ResourceManager::Keep(const etk::UString& _accesMode, ewol::VirtualBu EWOL_ERROR("allocation error of a resource : ??VBO??"); return false; } - ewol::eSystem::GetSystem().GetResourcesManager().LocalAdd(_object); + ewol::GetContext().GetResourcesManager().LocalAdd(_object); return true; } -bool ewol::ResourceManager::Keep(const etk::UString& filename, ewol::ConfigFile*& object) +bool ewol::resource::Keep(const etk::UString& filename, ewol::ConfigFile*& object) { EWOL_INFO("KEEP : SimpleConfig : file : \"" << filename << "\""); - object = static_cast(ewol::eSystem::GetSystem().GetResourcesManager().LocalKeep(filename)); + object = static_cast(ewol::GetContext().GetResourcesManager().LocalKeep(filename)); if (NULL != object) { return true; } @@ -394,7 +394,7 @@ bool ewol::ResourceManager::Keep(const etk::UString& filename, ewol::ConfigFile* EWOL_ERROR("allocation error of a resource : ??Mesh.obj??"); return false; } - ewol::eSystem::GetSystem().GetResourcesManager().LocalAdd(object); + ewol::GetContext().GetResourcesManager().LocalAdd(object); return true; } @@ -434,68 +434,68 @@ void ewol::ResourceManager::Release(ewol::Resource*& object) } -void ewol::ResourceManager::Release(ewol::TexturedFont*& object) +void ewol::resource::Release(ewol::TexturedFont*& object) { ewol::Resource* object2 = static_cast(object); - ewol::eSystem::GetSystem().GetResourcesManager().Release(object2); + ewol::GetContext().GetResourcesManager().Release(object2); object = NULL; } -void ewol::ResourceManager::Release(ewol::FontBase*& object) +void ewol::resource::Release(ewol::FontBase*& object) { ewol::Resource* object2 = static_cast(object); - ewol::eSystem::GetSystem().GetResourcesManager().Release(object2); + ewol::GetContext().GetResourcesManager().Release(object2); object = NULL; } -void ewol::ResourceManager::Release(ewol::Program*& object) +void ewol::resource::Release(ewol::Program*& object) { ewol::Resource* object2 = static_cast(object); - ewol::eSystem::GetSystem().GetResourcesManager().Release(object2); + ewol::GetContext().GetResourcesManager().Release(object2); object = NULL; } -void ewol::ResourceManager::Release(ewol::Shader*& object) +void ewol::resource::Release(ewol::Shader*& object) { ewol::Resource* object2 = static_cast(object); - ewol::eSystem::GetSystem().GetResourcesManager().Release(object2); + ewol::GetContext().GetResourcesManager().Release(object2); object = NULL; } -void ewol::ResourceManager::Release(ewol::Texture*& object) +void ewol::resource::Release(ewol::Texture*& object) { ewol::Resource* object2 = static_cast(object); - ewol::eSystem::GetSystem().GetResourcesManager().Release(object2); + ewol::GetContext().GetResourcesManager().Release(object2); object = NULL; } -void ewol::ResourceManager::Release(ewol::TextureFile*& object) +void ewol::resource::Release(ewol::TextureFile*& object) { ewol::Resource* object2 = static_cast(object); //EWOL_INFO("RELEASE : TextureFile : nb=" << object2->GetCounter()); - ewol::eSystem::GetSystem().GetResourcesManager().Release(object2); + ewol::GetContext().GetResourcesManager().Release(object2); object = NULL; } -void ewol::ResourceManager::Release(ewol::Mesh*& object) +void ewol::resource::Release(ewol::Mesh*& object) { ewol::Resource* object2 = static_cast(object); - ewol::eSystem::GetSystem().GetResourcesManager().Release(object2); + ewol::GetContext().GetResourcesManager().Release(object2); object = NULL; } -void ewol::ResourceManager::Release(ewol::ConfigFile*& object) +void ewol::resource::Release(ewol::ConfigFile*& object) { ewol::Resource* object2 = static_cast(object); - ewol::eSystem::GetSystem().GetResourcesManager().Release(object2); + ewol::GetContext().GetResourcesManager().Release(object2); object = NULL; } -void ewol::ResourceManager::Release(ewol::Colored3DObject*& object) +void ewol::resource::Release(ewol::Colored3DObject*& object) { ewol::Resource* object2 = static_cast(object); - ewol::eSystem::GetSystem().GetResourcesManager().Release(object2); + ewol::GetContext().GetResourcesManager().Release(object2); object = NULL; } -void ewol::ResourceManager::Release(ewol::VirtualBufferObject*& object) +void ewol::resource::Release(ewol::VirtualBufferObject*& object) { ewol::Resource* object2 = static_cast(object); - ewol::eSystem::GetSystem().GetResourcesManager().Release(object2); + ewol::GetContext().GetResourcesManager().Release(object2); object = NULL; } diff --git a/sources/ewol/resources/ResourceManager.h b/sources/ewol/resources/ResourceManager.h index 26355605..6a7aa1b8 100644 --- a/sources/ewol/resources/ResourceManager.h +++ b/sources/ewol/resources/ResourceManager.h @@ -62,63 +62,71 @@ namespace ewol * @brief This is to inform the resources manager that we have no more openGl context ... */ void ContextHasBeenDestroyed(void); - private: + public: // internal API to extent eResources in extern Soft ewol::Resource* LocalKeep(const etk::UString& filename); void LocalAdd(ewol::Resource* object); public: - /** - * @brief Load the specify resources type - * @param[in] filename The filename of the resources - * @param[in,out] object The resources that might be instanciate. - * @return true if the resource has been loaded corectly. - * @return false An error occured ... - * @note when you call the Keep function, you must call the Realease function ==> otherwise the resources will never be freed - * @note The resources with the same name are loaded only one time, a counter prevent multiple loading... - */ - static bool Keep(const etk::UString& filename, ewol::TexturedFont*& object); - static bool Keep(const etk::UString& filename, ewol::FontBase*& object); - static bool Keep(const etk::UString& filename, ewol::Program*& object); - static bool Keep(const etk::UString& filename, ewol::Shader*& object); - static bool Keep(ewol::Texture*& object); // no name needed here ... - static bool Keep(const etk::UString& filename, ewol::TextureFile*& object, ivec2 size=ivec2(-1,-1)); - static bool Keep(const etk::UString& accesMode, ewol::VirtualBufferObject*& object); - static bool Keep(const etk::UString& meshName, ewol::Mesh*& object); - static bool Keep(const etk::UString& filename, ewol::ConfigFile*& object); - static bool Keep(ewol::Colored3DObject*& object); - - // must became : - /* - ewol::Font* KeepFont(const etk::UString& _filename); - ewol::Program* KeepProgram(const etk::UString& _filename); - ewol::Shader* KeepShader(const etk::UString& _filename); - ewol::Texture* KeepTexture(void); - ewol::Texture* KeepTexture(const etk::UString& _filename, const ivec2& size=ivec2(-1,-1)); - void AddTextureResourceCreator(pf* _plop, const etk::UString& _ext); - ewol::Audio* KeepAudio(const etk::UString& _filename, bool _inRam=false); - void AddAudioResourceCreator(pf* _plop, const etk::UString& _ext); - ewol::VirtualBufferObject* KeepVBO(const etk::UString& _accesMode); - ewol::Mesh* KeepMesh(const etk::UString& _filename); - ewol::ConfigFile* KeepConfigFile(const etk::UString& _filename); - ewol::Colored3DObject* Keep3DObject(void); - - void Release(ewol::Resource*& object); - */ /** * @brief Release a resources and free it if the Last release is call. * @param[in,out] object element to realease ==> is return at NULL value. */ void Release(ewol::Resource*& object); - static void Release(ewol::TexturedFont*& object); - static void Release(ewol::FontBase*& object); - static void Release(ewol::Program*& object); - static void Release(ewol::Shader*& object); - static void Release(ewol::Texture*& object); - static void Release(ewol::TextureFile*& object); - static void Release(ewol::VirtualBufferObject*& object); - static void Release(ewol::Mesh*& object); - static void Release(ewol::ConfigFile*& object); - static void Release(ewol::Colored3DObject*& object); + }; + namespace resource + { + /** + * @brief Load the specify resources type + * @param[in] filename The filename of the resources + * @param[in,out] object The resources that might be instanciate. + * @return true if the resource has been loaded corectly. + * @return false An error occured ... + * @note when you call the Keep function, you must call the Realease function ==> otherwise the resources will never be freed + * @note The resources with the same name are loaded only one time, a counter prevent multiple loading... + */ + bool Keep(const etk::UString& filename, ewol::TexturedFont*& object); + bool Keep(const etk::UString& filename, ewol::FontBase*& object); + bool Keep(const etk::UString& filename, ewol::Program*& object); + bool Keep(const etk::UString& filename, ewol::Shader*& object); + bool Keep(ewol::Texture*& object); // no name needed here ... + bool Keep(const etk::UString& filename, ewol::TextureFile*& object, ivec2 size=ivec2(-1,-1)); + bool Keep(const etk::UString& accesMode, ewol::VirtualBufferObject*& object); + bool Keep(const etk::UString& meshName, ewol::Mesh*& object); + bool Keep(const etk::UString& filename, ewol::ConfigFile*& object); + bool Keep(ewol::Colored3DObject*& object); + + // must became : + /* + ewol::Font* KeepFont(const etk::UString& _filename); + ewol::Program* KeepProgram(const etk::UString& _filename); + ewol::Shader* KeepShader(const etk::UString& _filename); + ewol::Texture* KeepTexture(void); + ewol::Texture* KeepTexture(const etk::UString& _filename, const ivec2& size=ivec2(-1,-1)); + void AddTextureResourceCreator(pf* _plop, const etk::UString& _ext); + ewol::Audio* KeepAudio(const etk::UString& _filename, bool _inRam=false); + void AddAudioResourceCreator(pf* _plop, const etk::UString& _ext); + ewol::VirtualBufferObject* KeepVBO(const etk::UString& _accesMode); + ewol::Mesh* KeepMesh(const etk::UString& _filename); + ewol::ConfigFile* KeepConfigFile(const etk::UString& _filename); + ewol::Colored3DObject* Keep3DObject(void); + + void Release(ewol::Resource*& object); + */ + /** + * @brief Release a resources and free it if the Last release is call. + * @param[in,out] object element to realease ==> is return at NULL value. + */ + void Release(ewol::Resource*& object); + void Release(ewol::TexturedFont*& object); + void Release(ewol::FontBase*& object); + void Release(ewol::Program*& object); + void Release(ewol::Shader*& object); + void Release(ewol::Texture*& object); + void Release(ewol::TextureFile*& object); + void Release(ewol::VirtualBufferObject*& object); + void Release(ewol::Mesh*& object); + void Release(ewol::ConfigFile*& object); + void Release(ewol::Colored3DObject*& object); }; }; diff --git a/sources/ewol/resources/Texture.cpp b/sources/ewol/resources/Texture.cpp index 915796c2..400c6286 100644 --- a/sources/ewol/resources/Texture.cpp +++ b/sources/ewol/resources/Texture.cpp @@ -11,6 +11,7 @@ #include #include #include +#include #undef __class__ #define __class__ "Texture" @@ -104,7 +105,7 @@ void ewol::Texture::RemoveContextToLate(void) void ewol::Texture::Flush(void) { // request to the manager to be call at the next update ... - ewol::resource::Update(this); + ewol::GetContext().GetResourcesManager().Update(this); } diff --git a/sources/ewol/resources/TexturedFont.cpp b/sources/ewol/resources/TexturedFont.cpp index 7058afe5..2b528f1b 100644 --- a/sources/ewol/resources/TexturedFont.cpp +++ b/sources/ewol/resources/TexturedFont.cpp @@ -112,14 +112,14 @@ ewol::TexturedFont::TexturedFont(etk::UString fontName) : m_size = tmpSize; etk::Vector folderList; - if (true==ewol::eSystem::GetSystem().GetFontDefault().GetUseExternal()) { + if (true==ewol::GetContext().GetFontDefault().GetUseExternal()) { #if defined(__TARGET_OS__Android) folderList.PushBack("/system/fonts"); #elif defined(__TARGET_OS__Linux) folderList.PushBack("/usr/share/fonts/truetype"); #endif } - folderList.PushBack(ewol::eSystem::GetSystem().GetFontDefault().GetFolder()); + folderList.PushBack(ewol::GetContext().GetFontDefault().GetFolder()); for (int32_t folderID=0; folderID #include #include +#include #undef __class__ #define __class__ "VirtualBufferObject" @@ -93,7 +94,7 @@ void ewol::VirtualBufferObject::Reload(void) void ewol::VirtualBufferObject::Flush(void) { // request to the manager to be call at the next update ... - ewol::resource::Update(this); + ewol::GetContext().GetResourcesManager().Update(this); } void ewol::VirtualBufferObject::PushOnBuffer(int32_t id, const vec3& data) diff --git a/sources/ewol/widget/Button.cpp b/sources/ewol/widget/Button.cpp index 96d4a024..fbc06359 100644 --- a/sources/ewol/widget/Button.cpp +++ b/sources/ewol/widget/Button.cpp @@ -9,7 +9,6 @@ #include #include -#include #undef __class__ #define __class__ "Button" diff --git a/sources/ewol/widget/ButtonColor.cpp b/sources/ewol/widget/ButtonColor.cpp index 93a3181c..6e95fb2d 100644 --- a/sources/ewol/widget/ButtonColor.cpp +++ b/sources/ewol/widget/ButtonColor.cpp @@ -14,7 +14,6 @@ #include #include #include -#include extern const char * const ewolEventButtonColorChange = "ewol-Button-Color-Change"; diff --git a/sources/ewol/widget/Entry.cpp b/sources/ewol/widget/Entry.cpp index 6979077c..41cccd84 100644 --- a/sources/ewol/widget/Entry.cpp +++ b/sources/ewol/widget/Entry.cpp @@ -10,8 +10,7 @@ #include #include #include -#include - +#include const char * const ewolEventEntryCut = "ewol-widget-entry-event-internal-cut"; @@ -556,7 +555,7 @@ void widget::Entry::OnGetFocus(void) { m_displayCursor = true; ChangeStatusIn(STATUS_SELECTED); - GetSystem().KeyboardShow(); + ShowKeyboard(); MarkToRedraw(); } @@ -565,7 +564,7 @@ void widget::Entry::OnLostFocus(void) { m_displayCursor = false; ChangeStatusIn(STATUS_NORMAL); - GetSystem().KeyboardHide(); + HideKeyboard(); MarkToRedraw(); } diff --git a/sources/ewol/widget/Mesh.cpp b/sources/ewol/widget/Mesh.cpp index 7a1c66b4..e01de0bc 100644 --- a/sources/ewol/widget/Mesh.cpp +++ b/sources/ewol/widget/Mesh.cpp @@ -8,7 +8,7 @@ #include #include -#include +#include extern const char * const ewolEventMeshPressed = "ewol-mesh-Pressed"; diff --git a/sources/ewol/widget/Mesh.h b/sources/ewol/widget/Mesh.h index 4c8ccaef..0cc460b4 100644 --- a/sources/ewol/widget/Mesh.h +++ b/sources/ewol/widget/Mesh.h @@ -11,7 +11,7 @@ #include #include -#include +#include extern const char * const ewolEventMeshPressed; diff --git a/sources/ewol/widget/Widget.cpp b/sources/ewol/widget/Widget.cpp index a2b5b438..cd96f574 100644 --- a/sources/ewol/widget/Widget.cpp +++ b/sources/ewol/widget/Widget.cpp @@ -11,7 +11,7 @@ #include #include #include -#include +#include #undef __class__ #define __class__ "DrawProperty" @@ -695,7 +695,7 @@ bool ewol::Widget::OnEventShortCut(ewol::SpecialKey& _special, uniChar_t _unicod void ewol::Widget::GrabCursor(void) { if (false == m_grabCursor) { - GetSystem().InputEventGrabPointer(this); + GetContext().InputEventGrabPointer(this); m_grabCursor = true; } } @@ -703,7 +703,7 @@ void ewol::Widget::GrabCursor(void) void ewol::Widget::UnGrabCursor(void) { if (true==m_grabCursor) { - GetSystem().InputEventUnGrabPointer(); + GetContext().InputEventUnGrabPointer(); m_grabCursor = false; } } @@ -720,7 +720,7 @@ void ewol::Widget::SetCursor(ewol::cursorDisplay_te _newCursor) { EWOL_DEBUG("Change Cursor in " << _newCursor); m_cursorDisplay = _newCursor; - GetSystem().SetCursor(m_cursorDisplay); + GetContext().SetCursor(m_cursorDisplay); } ewol::cursorDisplay_te ewol::Widget::GetCursor(void) @@ -857,17 +857,29 @@ bool ewol::Widget::OnGetConfig(const char* _config, etk::UString& _result) const void ewol::Widget::RequestUpdateSize(void) { - GetSystem().RequestUpdateSize(); + GetContext().RequestUpdateSize(); } ewol::WidgetManager& ewol::Widget::GetWidgetManager(void) { - return GetSystem().GetWidgetManager(); + return GetContext().GetWidgetManager(); } ewol::Windows* ewol::Widget::GetWindows(void) { - return GetSystem().GetWindows(); + return GetContext().GetWindows(); } + + +void ewol::Widget::ShowKeyboard(void) +{ + GetContext().KeyboardShow(); +} + +void ewol::Widget::HideKeyboard(void) +{ + GetContext().KeyboardHide(); +} + diff --git a/sources/ewol/widget/Widget.h b/sources/ewol/widget/Widget.h index 801145e9..1b703ef9 100644 --- a/sources/ewol/widget/Widget.h +++ b/sources/ewol/widget/Widget.h @@ -418,12 +418,20 @@ namespace ewol { * @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 // ---------------------------------------------------------------------------------------------------------------- diff --git a/sources/ewol/widget/Windows.cpp b/sources/ewol/widget/Windows.cpp index 0b7240af..db9a3568 100644 --- a/sources/ewol/widget/Windows.cpp +++ b/sources/ewol/widget/Windows.cpp @@ -10,7 +10,7 @@ #include #include #include -#include +#include #include #include #include @@ -205,7 +205,7 @@ void ewol::Windows::PopUpWidgetPush(ewol::Widget * widget) // Regenerate the size calculation : CalculateSize(m_size); // TODO : it is dansgerous to access directly to the system ... - GetSystem().ResetIOEvent(); + GetContext().ResetIOEvent(); } @@ -241,5 +241,5 @@ void ewol::Windows::SetTitle(const etk::UString& _title) { // TODO : Remove this ... etk::UString title = _title; - GetSystem().SetTitle(title); + GetContext().SetTitle(title); } diff --git a/sources/lutin_ewol.py b/sources/lutin_ewol.py index 14f4caef..325e705c 100755 --- a/sources/lutin_ewol.py +++ b/sources/lutin_ewol.py @@ -28,7 +28,7 @@ def Create(target): 'ewol/renderer/EMessage.cpp', 'ewol/renderer/EObject.cpp', 'ewol/renderer/EObjectManager.cpp', - 'ewol/renderer/EObjectMessageMultiCast.cpp', + 'ewol/renderer/EMultiCast.cpp', 'ewol/renderer/openGL.cpp', 'ewol/renderer/ConfigFont.cpp', 'ewol/renderer/EventInput.cpp', @@ -37,7 +37,7 @@ def Create(target): 'ewol/renderer/eContext.cpp', 'ewol/renderer/eInput.cpp']) - # renderer : + # resources : myModule.AddSrcFile([ 'ewol/resources/Shader.cpp', 'ewol/resources/Program.cpp', @@ -49,15 +49,18 @@ def Create(target): 'ewol/resources/Texture.cpp', 'ewol/resources/Colored3DObject.cpp', 'ewol/resources/Image.cpp', - 'ewol/resources/physicsShape/PhysicsShape.cpp', - 'ewol/resources/physicsShape/PhysicsBox.cpp', - 'ewol/resources/physicsShape/PhysicsCapsule.cpp', - 'ewol/resources/physicsShape/PhysicsCone.cpp', - 'ewol/resources/physicsShape/PhysicsConvexHull.cpp', - 'ewol/resources/physicsShape/PhysicsCylinder.cpp', - 'ewol/resources/physicsShape/PhysicsSphere.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', @@ -164,7 +167,7 @@ def Create(target): #endif #ifeq ("$(CONFIG___EWOL_LINUX_GUI_MODE_X11__)","y") - myModule.AddSrcFile('ewol/renderer/os/gui.X11.cpp') + myModule.AddSrcFile('ewol/renderer/X11/Context.cpp') #endif #ifeq ("$(CONFIG___EWOL_LINUX_GUI_MODE_DIRECT_FB__)","y") #myModule.CompileFlags_CC('-I/usr/local/include/directfb') @@ -179,18 +182,18 @@ def Create(target): myModule.AddExportflag_LD("-landroid") java_tmp_dir = lutinTools.GetCurrentPath(__file__) + "/../../ewol/sources/android/src/" - cpp_tmp_dir = lutinTools.GetCurrentPath(__file__) + "/ewol/renderer/os/" + cpp_tmp_dir = lutinTools.GetCurrentPath(__file__) + "/ewol/renderer/Android/" java_tmp_src = java_tmp_dir + "org/ewol/EwolConstants" lutinMultiprocess.RunCommand("javac " + java_tmp_src + ".java") lutinMultiprocess.RunCommand("cd " + java_tmp_dir + " && javah org.ewol.EwolConstants") lutinTools.CopyFile(java_tmp_dir + "org_ewol_EwolConstants.h", cpp_tmp_dir + "org_ewol_EwolConstants.h", True) lutinTools.RemoveFile(java_tmp_src + ".class") - myModule.AddSrcFile("ewol/renderer/os/gui.Android.cpp") + myModule.AddSrcFile("ewol/renderer/Android/Context.cpp") elif target.name=="Windows": myModule.AddModuleDepend("glew") - myModule.AddSrcFile("ewol/renderer/os/gui.Windows.cpp") + myModule.AddSrcFile("ewol/renderer/Windows/Context.cpp") elif target.name=="MacOs": myModule.AddExportflag_LD([ "-framework Cocoa", @@ -198,10 +201,10 @@ def Create(target): "-framework QuartzCore", "-framework AppKit"]) myModule.AddSrcFile([ - "ewol/renderer/os/gui.MacOs.cpp", - "ewol/renderer/os/gui.MacOs.Interface.mm", - "ewol/renderer/os/gui.MacOs.AppDelegate.mm", - "ewol/renderer/os/gui.MacOs.OpenglView.mm"]) + "ewol/renderer/MacOs/Context.cpp", + "ewol/renderer/MacOs/Interface.mm", + "ewol/renderer/MacOs/AppDelegate.mm", + "ewol/renderer/MacOs/OpenglView.mm"]) else: debug.error("unknow mode...")