[DEV] rework (step 3)

This commit is contained in:
Edouard DUPIN 2013-08-30 07:46:21 +02:00
parent 4a8aa9f7b0
commit f89d88e62a
56 changed files with 476 additions and 748 deletions

View File

@ -1,166 +0,0 @@
/**
* @author Edouard DUPIN
*
* @copyright 2011, Edouard DUPIN, all right reserved
*
* @license BSD v3 (see license file)
*/
#include <ewol/UserConfig.h>
#include <ewol/eObject/EObjectManager.h>
#include <etk/os/FSNode.h>
#include <ewol/debug.h>
#include <exml/Declaration.h>
class UserConfig : public ewol::EObject
{
private:
etk::Vector<ewol::EObject*> m_list;
etk::UString m_fileName;
public:
UserConfig(void) : m_fileName("USERDATA:generalConfig.xml")
{
m_static = true; // Note : Set the object static notification( Must be set or assert at the end of process)
};
~UserConfig(void) { m_list.Clear(); };
etk::Vector<ewol::EObject*>& List(void) { return m_list; };
etk::UString& FileName(void) { return m_fileName; };
void OnObjectRemove(ewol::EObject * _removeObject)
{
for( int32_t iii=m_list.Size()-1 ; iii>=0 ; iii--) {
if (m_list[iii] == _removeObject) {
m_list.Erase(iii);
}
}
};
};
static UserConfig& l_obj(void)
{
static UserConfig s_obj;
return s_obj;
}
void ewol::userConfig::Init(void)
{
}
void ewol::userConfig::UnInit(void)
{
}
const ewol::EObject* ewol::userConfig::GetUserConfig(const etk::UString& _name)
{
if (_name == "") {
return NULL;
}
for (int32_t iii=0; iii<l_obj().List().Size() ; iii++) {
if (l_obj().List()[iii] != NULL) {
if (l_obj().List()[iii]->GetName() == _name) {
return l_obj().List()[iii];
}
}
}
return NULL;
}
void ewol::userConfig::AddUserConfig(ewol::EObject* _newConfig)
{
if (_newConfig == NULL) {
return;
}
for (int32_t iii=0; iii<l_obj().List().Size() ; iii++) {
if (l_obj().List()[iii] != NULL) {
if (l_obj().List()[iii] == _newConfig) {
return ;
}
}
}
l_obj().List().PushBack(_newConfig);
}
void ewol::userConfig::SetConfigName(const etk::UString& _fileName)
{
l_obj().FileName() = _fileName;
}
bool ewol::userConfig::Load(void)
{
// allocate the document in the stack
exml::Document doc;
if (false == doc.Load(l_obj().FileName())) {
EWOL_ERROR("Error occured when loading XML : " << l_obj().FileName());
return false;
}
if (0 == doc.Size() ) {
EWOL_ERROR("(l ?) No nodes in the xml file ... \"" << l_obj().FileName() << "\"");
return false;
}
exml::Element* root = (exml::Element*)doc.GetNamed("config");
if (NULL == root ) {
EWOL_ERROR("(l ?) main node not find: \"config\" in \"" << l_obj().FileName() << "\"");
return false;
}
for(int32_t iii=0; iii< root->Size(); iii++) {
exml::Element* child = root->GetElement(iii);
if (child==NULL) {
// other than element is trash here
continue;
}
bool elementFound = false;
for (int32_t iii=0; iii<l_obj().List().Size() ; iii++) {
if (l_obj().List()[iii] != NULL) {
if (l_obj().List()[iii]->GetName() == child->GetValue()) {
l_obj().List()[iii]->LoadXML(child);
elementFound = true;
break;
}
}
}
if (elementFound==false) {
EWOL_ERROR("(l "<<child->GetPos()<<") node not suported : \""<<child->GetValue());
}
}
return true;
}
bool ewol::userConfig::Save(void)
{
// step 1 : Move the file to prevent writing error
etk::FSNodeHistory(l_obj().FileName(), 9);
exml::Document doc;
doc.Append(new exml::DeclarationXML("1.0"));
exml::Element * ElementBase = new exml::Element("config");
doc.Append(ElementBase);
for (int32_t iii=0; iii<l_obj().List().Size() ; iii++) {
if (l_obj().List()[iii] == NULL) {
continue;
}
if (l_obj().List()[iii]->GetName().Size() == 0) {
continue;
}
exml::Element* element = new exml::Element(l_obj().List()[iii]->GetName());
if (NULL != element) {
l_obj().List()[iii]->StoreXML(element);
ElementBase->Append(element);
}
}
//Save Document
doc.Store(l_obj().FileName());
EWOL_DEBUG("Save in file : " << l_obj().FileName());
// step 3 : Remove oldest save
return true;
}

View File

@ -1,32 +0,0 @@
/**
* @author Edouard DUPIN
*
* @copyright 2011, Edouard DUPIN, all right reserved
*
* @license BSD v3 (see license file)
*/
#ifndef __EWOL_USER_CONFIG_H__
#define __EWOL_USER_CONFIG_H__
#include <etk/types.h>
#include <etk/Stream.h>
#include <ewol/eObject/EObject.h>
namespace ewol
{
namespace userConfig
{
void Init(void);
void UnInit(void);
const ewol::EObject* GetUserConfig(const etk::UString& _name);
void AddUserConfig(ewol::EObject* _newConfig);
//void RmUserConfig(ewol::EObject* _newConfig); // note : To remove user config ==> just destroy it ==> simple ..
void SetConfigName(const etk::UString& _fileName="USERDATA:generalConfig.xml");
bool Load(void);
bool Save(void);
};
};
#endif

View File

@ -10,8 +10,7 @@
#include <ewol/debug.h>
#include <ewol/clipBoard.h>
#include <ewol/renderer/os/gui.h>
#include <ewol/renderer/os/eSystem.h>
#include <ewol/renderer/eSystem.h>
#undef __class__
#define __class__ "ClipBoard"

View File

@ -8,7 +8,6 @@
#include <ewol/debug.h>
#include <ewol/compositing/Area.h>
#include <ewol/config.h>
#undef __class__
#define __class__ "ewol::Area"
@ -24,7 +23,7 @@ ewol::Area::Area(const ivec2& _size) :
m_GLtexID(-1),
m_resource(NULL)
{
ewol::resource::Keep(m_resource);
ewol::ResourceManager::Keep(m_resource);
m_resource->SetImageSize(_size);
m_resource->Flush();
LoadProgram();
@ -33,10 +32,10 @@ ewol::Area::Area(const ivec2& _size) :
ewol::Area::~Area(void)
{
if (NULL != m_resource) {
ewol::resource::Release(m_resource);
ewol::ResourceManager::Release(m_resource);
m_resource = NULL;
}
ewol::resource::Release(m_GLprogram);
ewol::ResourceManager::Release(m_GLprogram);
}
void ewol::Area::LoadProgram(void)
@ -44,7 +43,7 @@ void ewol::Area::LoadProgram(void)
etk::UString tmpString("DATA:textured3D.prog");
// get the shader resource :
m_GLPosition = 0;
if (true == ewol::resource::Keep(tmpString, m_GLprogram) ) {
if (true == ewol::ResourceManager::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");

View File

@ -289,7 +289,7 @@ void ewol::Drawing::ResetCount(void)
void ewol::Drawing::UnLoadProgram(void)
{
if (NULL!=m_GLprogram) {
ewol::resource::Release(m_GLprogram);
ewol::ResourceManager::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::resource::Keep(tmpString, m_GLprogram) ) {
if (true == ewol::ResourceManager::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");

View File

@ -8,7 +8,6 @@
#include <ewol/debug.h>
#include <ewol/compositing/Image.h>
#include <ewol/config.h>
#undef __class__
#define __class__ "ewol::Image"
@ -35,10 +34,10 @@ ewol::Image::Image(const etk::UString& _imageName) :
ewol::Image::~Image(void)
{
if (NULL != m_resource) {
ewol::resource::Release(m_resource);
ewol::ResourceManager::Release(m_resource);
m_resource = NULL;
}
ewol::resource::Release(m_GLprogram);
ewol::ResourceManager::Release(m_GLprogram);
}
void ewol::Image::LoadProgram(void)
@ -46,7 +45,7 @@ void ewol::Image::LoadProgram(void)
etk::UString tmpString("DATA:textured3D.prog");
// get the shader resource :
m_GLPosition = 0;
if (true == ewol::resource::Keep(tmpString, m_GLprogram) ) {
if (true == ewol::ResourceManager::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");
@ -241,14 +240,14 @@ void ewol::Image::SetSource(const etk::UString& _newFile, const vec2& _size)
Clear();
// remove old one
if (NULL != m_resource) {
ewol::resource::Release(m_resource);
ewol::ResourceManager::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::resource::Keep(_newFile, m_resource, tmpSize)) {
if (false == ewol::ResourceManager::Keep(_newFile, m_resource, tmpSize)) {
EWOL_ERROR("Can not get Image resource");
}
}

View File

@ -9,7 +9,6 @@
#include <etk/os/FSNode.h>
#include <ewol/debug.h>
#include <ewol/compositing/Shaper.h>
#include <ewol/config.h>
#undef __class__
#define __class__ "ewol::Shaper"
@ -52,15 +51,15 @@ ewol::Shaper::~Shaper(void)
void ewol::Shaper::UnLoadProgram(void)
{
if (NULL != m_GLprogram) {
ewol::resource::Release(m_GLprogram);
ewol::ResourceManager::Release(m_GLprogram);
m_GLprogram = NULL;
}
if (NULL != m_resourceTexture) {
ewol::resource::Release(m_resourceTexture);
ewol::ResourceManager::Release(m_resourceTexture);
m_resourceTexture = NULL;
}
if (NULL != m_config) {
ewol::resource::Release(m_config);
ewol::ResourceManager::Release(m_config);
m_config = NULL;
}
}
@ -71,7 +70,7 @@ void ewol::Shaper::LoadProgram(void)
EWOL_DEBUG("no Shaper set for loading resources ...");
return;
}
if (true == ewol::resource::Keep(m_name, m_config) ) {
if (true == ewol::ResourceManager::Keep(m_name, m_config) ) {
m_confIdPaddingX = m_config->Request("PaddingX");
m_confIdPaddingY = m_config->Request("PaddingY");
m_confIdChangeTime = m_config->Request("ChangeTime");
@ -86,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::resource::Keep(tmpFilename, m_GLprogram) ) {
if (true == ewol::ResourceManager::Keep(tmpFilename, m_GLprogram) ) {
m_GLPosition = m_GLprogram->GetAttribute("EW_coord2d");
m_GLMatrix = m_GLprogram->GetUniform("EW_MatrixTransformation");
// Widget property ==> for the Vertex shader
@ -105,7 +104,7 @@ void ewol::Shaper::LoadProgram(void)
if (basicImageFile != "") {
tmpFilename = file.GetRelativeFolder() + basicImageFile;
ivec2 size(64,64);
if (true == ewol::resource::Keep(tmpFilename, m_resourceTexture, size) ) {
if (true == ewol::ResourceManager::Keep(tmpFilename, m_resourceTexture, size) ) {
// nothing else to do ...
}
}

View File

@ -8,7 +8,6 @@
#include <ewol/debug.h>
#include <ewol/compositing/Sprite.h>
#include <ewol/config.h>
#undef __class__
#define __class__ "ewol::Sprite"

View File

@ -8,42 +8,11 @@
#include <ewol/debug.h>
#include <ewol/compositing/Text.h>
#include <ewol/config.h>
#include <ewol/renderer/eSystem.h>
#undef __class__
#define __class__ "ewol::Text"
ewol::Text::Text(void) :
m_position(0.0, 0.0, 0.0),
m_clippingPosStart(0.0, 0.0, 0.0),
m_clippingPosStop(0.0, 0.0, 0.0),
m_clippingEnable(false),
m_color(etk::color::black),
m_colorBg(etk::color::none),
m_colorCursor(etk::color::black),
m_colorSelection(etk::color::olive),
m_mode(ewol::font::Regular),
m_kerning(true),
m_distanceField(false),
m_previousCharcode(0),
m_startTextpos(0),
m_stopTextPos(0),
m_alignement(ewol::Text::alignDisable),
m_GLprogram(NULL),
m_GLPosition(-1),
m_GLMatrix(-1),
m_GLColor(-1),
m_GLtexture(-1),
m_GLtexID(-1),
m_selectionStartPos(-100),
m_cursorPos(-100),
m_font(NULL)
{
SetFont("", -1);
LoadProgram();
}
ewol::Text::Text(const etk::UString& _fontName, int32_t _fontSize) :
m_position(0.0, 0.0, 0.0),
@ -80,10 +49,10 @@ ewol::Text::~Text(void)
{
if (NULL != m_font) {
ewol::resource::Release(m_font);
ewol::ResourceManager::Release(m_font);
m_font = NULL;
}
ewol::resource::Release(m_GLprogram);
ewol::ResourceManager::Release(m_GLprogram);
}
void ewol::Text::LoadProgram(void)
@ -91,7 +60,7 @@ void ewol::Text::LoadProgram(void)
etk::UString tmpString("DATA:text.prog");
// get the shader resource :
m_GLPosition = 0;
if (true == ewol::resource::Keep(tmpString, m_GLprogram) ) {
if (true == ewol::ResourceManager::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");
@ -347,19 +316,19 @@ void ewol::Text::SetFont(etk::UString _fontName, int32_t _fontSize)
Clear();
// remove old one
if (NULL != m_font) {
ewol::resource::Release(m_font);
ewol::ResourceManager::Release(m_font);
m_font = NULL;
}
if (_fontSize <= 0) {
_fontSize = ewol::config::FontGetDefaultSize();
_fontSize = ewol::eSystem::GetSystem().GetFontDefault().GetSize();
}
if (_fontName == "") {
_fontName = ewol::config::FontGetDefaultName();
_fontName = ewol::eSystem::GetSystem().GetFontDefault().GetName();
}
_fontName += ":";
_fontName += _fontSize;
// link to new One
if (false == ewol::resource::Keep(_fontName, m_font)) {
if (false == ewol::ResourceManager::Keep(_fontName, m_font)) {
EWOL_ERROR("Can not get font resource");
}
}

View File

@ -94,16 +94,12 @@ namespace ewol
*/
void LoadProgram(void);
public:
/**
* @brief generic constructor
*/
Text(void);
/**
* @brief generic constructor
* @param[in] _fontName Name of the font that might be loaded
* @param[in] _fontSize Size of the font that might be loaded
*/
Text(const etk::UString& _fontName, int32_t _fontSize);
Text(const etk::UString& _fontName="", int32_t _fontSize=-1);
/**
* @brief generic destructor
*/

View File

@ -1,56 +0,0 @@
/**
* @author Edouard DUPIN
*
* @copyright 2011, Edouard DUPIN, all right reserved
*
* @license BSD v3 (see license file)
*/
#include <ewol/config.h>
#include <ewol/renderer/resources/FontFreeType.h>
#undef __class__
#define __class__ "ewol::config"
static etk::UString l_fontConfigFolder = "DATA::fonts";
static etk::UString l_fontConfigName = "Arial";
static int32_t l_fontConfigSize = 10;
void ewol::config::Init(void)
{
// reset font properties
l_fontConfigFolder = "DATA::fonts";
l_fontConfigName = "Arial;Helvetica";
l_fontConfigSize = 10;
ewol::FreeTypeInit();
}
void ewol::config::UnInit(void)
{
// UnInit FreeTypes
ewol::FreeTypeUnInit();
}
void ewol::config::FontFolder(const etk::UString& _folder)
{
l_fontConfigFolder = _folder;
}
void ewol::config::FontSetDefault(const etk::UString& _fontName, int32_t _size)
{
l_fontConfigName = _fontName;
l_fontConfigSize = _size;
}
const etk::UString& ewol::config::FontGetDefaultName(void)
{
return l_fontConfigName;
}
int32_t ewol::config::FontGetDefaultSize(void)
{
return l_fontConfigSize;
}

View File

@ -1,56 +0,0 @@
/**
* @author Edouard DUPIN
*
* @copyright 2011, Edouard DUPIN, all right reserved
*
* @license BSD v3 (see license file)
*/
#ifndef __EWOL_CONFIG_H__
#define __EWOL_CONFIG_H__
#include <etk/types.h>
#include <etk/UString.h>
namespace ewol
{
namespace config
{
/**
* @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 FontFolder(const etk::UString& _folder);
/**
* @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 FontSetDefault(const etk::UString& _fontName, int32_t _size);
/**
* @brief Get the current default font name
* @raturn a reference on the font name string
*/
const etk::UString& FontGetDefaultName(void);
/**
* @brief Get the default font size.
* @return the font size.
*/
int32_t FontGetDefaultSize(void);
// Internal section :
/**
* Init the configuration
*/
void Init(void);
/**
* UnInit the configuration
*/
void UnInit(void);
};
};
#endif

View File

@ -8,23 +8,16 @@
#include <ewol/ewol.h>
#include <ewol/widget/WidgetManager.h>
#include <ewol/renderer/os/eSystem.h>
#include <ewol/renderer/eSystem.h>
#include <ewol/renderer/resources/TexturedFont.h>
#include <ewol/renderer/os/gui.h>
#include <ewol/commandLine.h>
#include <etk/os/FSNode.h>
#include <ewol/Dimension.h>
#include <date/date.h>
#include <ewol/UserConfig.h>
#undef __class__
#define __class__ "ewol"
/*
void ewol::SetFontSourcesFolder(bool _inOsSystem)
{
ewol::font::SetFontPropety(_inOsSystem);
}
*/
int32_t ewol::Run(int32_t _argc, const char* _argv[])
{
if (NULL!=_argv) {
@ -32,7 +25,6 @@ int32_t ewol::Run(int32_t _argc, const char* _argv[])
}
// init display convertions:
ewol::dimension::Init();
ewol::userConfig::Init();
EWOL_DEBUG("Store commangLine in the specific system");
ewol::commandLine::Clean();

View File

@ -0,0 +1,36 @@
/**
* @author Edouard DUPIN
*
* @copyright 2011, Edouard DUPIN, all right reserved
*
* @license BSD v3 (see license file)
*/
#include <ewol/renderer/ConfigFont.h>
#include <ewol/renderer/resources/FontFreeType.h>
#undef __class__
#define __class__ "ConfigFont"
ewol::ConfigFont::ConfigFont(void) :
m_folder("DATA::fonts"),
m_name("Arial;Helvetica"),
m_size(10),
m_useExternal(false)
{
ewol::FreeTypeInit();
}
ewol::ConfigFont::~ConfigFont(void)
{
// UnInit FreeTypes
ewol::FreeTypeUnInit();
}
void ewol::ConfigFont::Set(const etk::UString& _fontName, int32_t _size)
{
m_name = _fontName;
m_size = _size;
}

View File

@ -0,0 +1,75 @@
/**
* @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 <etk/types.h>
#include <etk/UString.h>
namespace ewol
{
class ConfigFont
{
public:
/**
* Constructor / destructor
*/
ConfigFont(void);
~ConfigFont(void);
private:
etk::UString 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 etk::UString& _folder) { m_folder = _folder; };
/**
* @brief Get the default font folder.
* @return The default font folder.
*/
const etk::UString& GetFolder(void) { return m_folder; };
private:
etk::UString 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 etk::UString& _fontName, int32_t _size);
/**
* @brief Get the current default font name
* @raturn a reference on the font name string
*/
const etk::UString& 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

View File

@ -6,7 +6,7 @@
* @license BSD v3 (see license file)
*/
#include <ewol/eObject/EObject.h>
#include <ewol/renderer/EObject.h>
#undef __class__
#define __class__ "EConfig"

View File

@ -6,7 +6,7 @@
* @license BSD v3 (see license file)
*/
#include <ewol/eObject/EObject.h>
#include <ewol/renderer/EObject.h>
#undef __class__
#define __class__ "EMessage"

View File

@ -6,11 +6,11 @@
* @license BSD v3 (see license file)
*/
#include <ewol/eObject/EObject.h>
#include <ewol/eObject/EObjectManager.h>
#include <ewol/eObject/EObjectMessageMultiCast.h>
#include <ewol/renderer/EObject.h>
#include <ewol/renderer/EObjectManager.h>
#include <ewol/renderer/EObjectMessageMultiCast.h>
#include <ewol/debug.h>
#include <ewol/renderer/os/eSystem.h>
#include <ewol/renderer/eSystem.h>
#undef __class__
#define __class__ "ewol::EObject"

View File

@ -21,8 +21,8 @@ namespace ewol {
class eSystem;
};
#include <ewol/eObject/EConfig.h>
#include <ewol/eObject/EMessage.h>
#include <ewol/renderer/EConfig.h>
#include <ewol/renderer/EMessage.h>
namespace ewol {

View File

@ -6,8 +6,8 @@
* @license BSD v3 (see license file)
*/
#include <ewol/eObject/EObjectManager.h>
#include <ewol/renderer/os/eSystem.h>
#include <ewol/renderer/EObjectManager.h>
#include <ewol/renderer/eSystem.h>
#include <ewol/ewol.h>
#undef __class__

View File

@ -10,7 +10,7 @@
#define __EWOL_E_OBJECT_MANAGER_H__
#include <etk/types.h>
#include <ewol/eObject/EObject.h>
#include <ewol/renderer/EObject.h>
namespace ewol
{

View File

@ -7,8 +7,8 @@
*/
#include <ewol/debug.h>
#include <ewol/eObject/EObjectMessageMultiCast.h>
#include <ewol/renderer/os/eSystem.h>
#include <ewol/renderer/EObjectMessageMultiCast.h>
#include <ewol/renderer/eSystem.h>
#undef __class__
#define __class__ "EObjectMessageMultiCast"

View File

@ -14,7 +14,7 @@
#include <etk/Vector.h>
#include <exml/exml.h>
#include <ewol/eObject/EObject.h>
#include <ewol/renderer/EObject.h>
namespace ewol {
class EObjectMessageMultiCast

View File

@ -45,7 +45,7 @@ ewol::Material::Material(void) :
ewol::Material::~Material(void)
{
if(NULL!=m_texture0) {
ewol::resource::Release(m_texture0);
ewol::ResourceManager::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::resource::Keep(_filename, m_texture0, tmpSize)) {
if (false == ewol::ResourceManager::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::resource::Release(tmpCopy);
ewol::ResourceManager::Release(tmpCopy);
}
}

View File

@ -12,72 +12,64 @@
#include <ewol/renderer/resources/FontFreeType.h>
#include <ewol/ewol.h>
#include <ewol/renderer/openGL.h>
#include <ewol/renderer/eSystem.h>
// Specific for the resource :
uint32_t ewol::Resource::valBase=0;
static etk::Vector<ewol::Resource*> l_resourceList;
static etk::Vector<ewol::Resource*> l_resourceListToUpdate;
static bool l_contextHasBeenRemoved = true;
void ewol::resource::Init(void)
ewol::ResourceManager::ResourceManager(void) :
m_contextHasBeenRemoved(true)
{
// nothing to do in theory then, we clean the buffers :
// NOTE : If we do domething here, then the system does not work corectly
if (l_resourceList.Size() != 0) {
EWOL_CRITICAL("Start with a resource manager Not empty, number of resources loaded : " << l_resourceList.Size());
}
l_resourceListToUpdate.Clear();
l_resourceList.Clear();
l_contextHasBeenRemoved = true;
// nothing to do ...
}
void ewol::resource::UnInit(void)
ewol::ResourceManager::~ResourceManager(void)
{
Display();
l_resourceListToUpdate.Clear();
m_resourceListToUpdate.Clear();
// remove all resources ...
for (int32_t iii=l_resourceList.Size()-1; iii>=0; iii--) {
if (l_resourceList[iii] != NULL) {
EWOL_WARNING("Find a resource that is not removed : [" << l_resourceList[iii]->GetUID() << "]"
<< "=\"" << l_resourceList[iii]->GetName() << "\" "
<< l_resourceList[iii]->GetCounter() << " elements");
delete(l_resourceList[iii]);
l_resourceList[iii] = NULL;
for (int32_t iii=m_resourceList.Size()-1; iii>=0; iii--) {
if (m_resourceList[iii] != NULL) {
EWOL_WARNING("Find a resource that is not removed : [" << m_resourceList[iii]->GetUID() << "]"
<< "=\"" << m_resourceList[iii]->GetName() << "\" "
<< m_resourceList[iii]->GetCounter() << " elements");
delete(m_resourceList[iii]);
m_resourceList[iii] = NULL;
}
}
l_resourceList.Clear();
m_resourceList.Clear();
}
void ewol::resource::Display(void)
void ewol::ResourceManager::Display(void)
{
EWOL_INFO("Resources loaded : ");
// remove all resources ...
for (int32_t iii=l_resourceList.Size()-1; iii>=0; iii--) {
if (l_resourceList[iii] != NULL) {
EWOL_INFO(" [" << l_resourceList[iii]->GetUID() << "]"
<< l_resourceList[iii]->GetType()
<< "=\"" << l_resourceList[iii]->GetName() << "\" "
<< l_resourceList[iii]->GetCounter() << " elements");
for (int32_t iii=m_resourceList.Size()-1; iii>=0; iii--) {
if (m_resourceList[iii] != NULL) {
EWOL_INFO(" [" << m_resourceList[iii]->GetUID() << "]"
<< m_resourceList[iii]->GetType()
<< "=\"" << m_resourceList[iii]->GetName() << "\" "
<< m_resourceList[iii]->GetCounter() << " elements");
}
}
EWOL_INFO("Resources ---");
}
void ewol::resource::ReLoadResources(void)
void ewol::ResourceManager::ReLoadResources(void)
{
EWOL_INFO("------------- Resources re-loaded -------------");
// remove all resources ...
if (l_resourceList.Size() != 0) {
if (m_resourceList.Size() != 0) {
for (int32_t jjj=0; jjj<MAX_RESOURCE_LEVEL; jjj++) {
EWOL_INFO(" Reload level : " << jjj << "/" << (MAX_RESOURCE_LEVEL-1));
for (int32_t iii=l_resourceList.Size()-1; iii>=0; iii--) {
if(l_resourceList[iii] != NULL) {
if (jjj==l_resourceList[iii]->GetResourceLevel()) {
l_resourceList[iii]->Reload();
EWOL_INFO(" [" << l_resourceList[iii]->GetUID() << "]="<< l_resourceList[iii]->GetType());
for (int32_t iii=m_resourceList.Size()-1; iii>=0; iii--) {
if(m_resourceList[iii] != NULL) {
if (jjj==m_resourceList[iii]->GetResourceLevel()) {
m_resourceList[iii]->Reload();
EWOL_INFO(" [" << m_resourceList[iii]->GetUID() << "]="<< m_resourceList[iii]->GetType());
}
}
}
@ -88,48 +80,48 @@ void ewol::resource::ReLoadResources(void)
EWOL_INFO("------------- Resources -------------");
}
void ewol::resource::Update(ewol::Resource* object)
void ewol::ResourceManager::Update(ewol::Resource* object)
{
// chek if not added before
for (int32_t iii=0; iii<l_resourceListToUpdate.Size(); iii++) {
if (l_resourceListToUpdate[iii] != NULL) {
if (l_resourceListToUpdate[iii] == object) {
for (int32_t iii=0; iii<m_resourceListToUpdate.Size(); iii++) {
if (m_resourceListToUpdate[iii] != NULL) {
if (m_resourceListToUpdate[iii] == object) {
// just prevent some double add ...
return;
}
}
}
// add it ...
l_resourceListToUpdate.PushBack(object);
m_resourceListToUpdate.PushBack(object);
}
// Specific to load or update the data in the openGl context ==> system use only
void ewol::resource::UpdateContext(void)
void ewol::ResourceManager::UpdateContext(void)
{
if (true == l_contextHasBeenRemoved) {
if (true == m_contextHasBeenRemoved) {
// need to update all ...
l_contextHasBeenRemoved = false;
if (l_resourceList.Size() != 0) {
m_contextHasBeenRemoved = false;
if (m_resourceList.Size() != 0) {
for (int32_t jjj=0; jjj<MAX_RESOURCE_LEVEL; jjj++) {
EWOL_INFO(" UpdateContext level (D) : " << jjj << "/" << (MAX_RESOURCE_LEVEL-1));
for (int32_t iii=0; iii<l_resourceList.Size(); iii++) {
if(l_resourceList[iii] != NULL) {
if (jjj==l_resourceList[iii]->GetResourceLevel()) {
for (int32_t iii=0; iii<m_resourceList.Size(); iii++) {
if(m_resourceList[iii] != NULL) {
if (jjj==m_resourceList[iii]->GetResourceLevel()) {
//EWOL_DEBUG("Update context of " << iii << " named : " << l_resourceList[iii]->GetName());
l_resourceList[iii]->UpdateContext();
m_resourceList[iii]->UpdateContext();
}
}
}
}
}
}else {
if (l_resourceListToUpdate.Size() != 0) {
if (m_resourceListToUpdate.Size() != 0) {
for (int32_t jjj=0; jjj<MAX_RESOURCE_LEVEL; jjj++) {
EWOL_INFO(" UpdateContext level (U) : " << jjj << "/" << (MAX_RESOURCE_LEVEL-1));
for (int32_t iii=0; iii<l_resourceListToUpdate.Size(); iii++) {
if(l_resourceListToUpdate[iii] != NULL) {
if (jjj==l_resourceListToUpdate[iii]->GetResourceLevel()) {
l_resourceListToUpdate[iii]->UpdateContext();
for (int32_t iii=0; iii<m_resourceListToUpdate.Size(); iii++) {
if(m_resourceListToUpdate[iii] != NULL) {
if (jjj==m_resourceListToUpdate[iii]->GetResourceLevel()) {
m_resourceListToUpdate[iii]->UpdateContext();
}
}
}
@ -137,20 +129,19 @@ void ewol::resource::UpdateContext(void)
}
}
// Clean the update list
l_resourceListToUpdate.Clear();
m_resourceListToUpdate.Clear();
}
// in this case, it is really too late ...
void ewol::resource::ContextHasBeenDestroyed(void)
void ewol::ResourceManager::ContextHasBeenDestroyed(void)
{
for (int32_t iii=0; iii<l_resourceList.Size(); iii++) {
if (l_resourceList[iii] != NULL) {
l_resourceList[iii]->RemoveContextToLate();
for (int32_t iii=0; iii<m_resourceList.Size(); iii++) {
if (m_resourceList[iii] != NULL) {
m_resourceList[iii]->RemoveContextToLate();
}
}
ewol::openGL::ContextIsRemoved();
// no context preent ...
l_contextHasBeenRemoved = true;
m_contextHasBeenRemoved = true;
}
@ -158,14 +149,14 @@ void ewol::resource::ContextHasBeenDestroyed(void)
// internal generic keeper ...
ewol::Resource* ewol::resource::LocalKeep(const etk::UString& filename)
ewol::Resource* ewol::ResourceManager::LocalKeep(const etk::UString& filename)
{
EWOL_VERBOSE("KEEP (DEFAULT) : file : \"" << filename << "\"");
for (int32_t iii=0; iii<l_resourceList.Size(); iii++) {
if (l_resourceList[iii] != NULL) {
if(l_resourceList[iii]->HasName(filename)) {
l_resourceList[iii]->Increment();
return l_resourceList[iii];
for (int32_t iii=0; iii<m_resourceList.Size(); iii++) {
if (m_resourceList[iii] != NULL) {
if(m_resourceList[iii]->HasName(filename)) {
m_resourceList[iii]->Increment();
return m_resourceList[iii];
}
}
}
@ -174,24 +165,24 @@ ewol::Resource* ewol::resource::LocalKeep(const etk::UString& filename)
}
// internal generic keeper ...
void ewol::resource::LocalAdd(ewol::Resource* object)
void ewol::ResourceManager::LocalAdd(ewol::Resource* object)
{
//Add ... find empty slot
for (int32_t iii=0; iii<l_resourceList.Size(); iii++) {
if (l_resourceList[iii] == NULL) {
l_resourceList[iii] = object;
for (int32_t iii=0; iii<m_resourceList.Size(); iii++) {
if (m_resourceList[iii] == NULL) {
m_resourceList[iii] = object;
return;
}
}
// add at the end if no slot is free
l_resourceList.PushBack(object);
m_resourceList.PushBack(object);
}
// return the type of the resource ...
bool ewol::resource::Keep(const etk::UString& filename, ewol::TexturedFont*& object)
bool ewol::ResourceManager::Keep(const etk::UString& filename, ewol::TexturedFont*& object)
{
EWOL_VERBOSE("KEEP : TexturedFont : file : \"" << filename << "\"");
object = static_cast<ewol::TexturedFont*>(LocalKeep(filename));
object = static_cast<ewol::TexturedFont*>(ewol::eSystem::GetSystem().GetResourcesManager().LocalKeep(filename));
if (NULL != object) {
return true;
}
@ -201,15 +192,15 @@ bool ewol::resource::Keep(const etk::UString& filename, ewol::TexturedFont*& obj
EWOL_ERROR("allocation error of a resource : " << filename);
return false;
}
LocalAdd(object);
ewol::eSystem::GetSystem().GetResourcesManager().LocalAdd(object);
return true;
}
bool ewol::resource::Keep(const etk::UString& filename, ewol::FontBase*& object)
bool ewol::ResourceManager::Keep(const etk::UString& filename, ewol::FontBase*& object)
{
EWOL_VERBOSE("KEEP : Font : file : \"" << filename << "\"");
object = static_cast<ewol::FontBase*>(LocalKeep(filename));
object = static_cast<ewol::FontBase*>(ewol::eSystem::GetSystem().GetResourcesManager().LocalKeep(filename));
if (NULL != object) {
return true;
}
@ -219,14 +210,14 @@ bool ewol::resource::Keep(const etk::UString& filename, ewol::FontBase*& object)
EWOL_ERROR("allocation error of a resource : " << filename);
return false;
}
LocalAdd(object);
ewol::eSystem::GetSystem().GetResourcesManager().LocalAdd(object);
return true;
}
bool ewol::resource::Keep(const etk::UString& filename, ewol::Program*& object)
bool ewol::ResourceManager::Keep(const etk::UString& filename, ewol::Program*& object)
{
EWOL_VERBOSE("KEEP : Program : file : \"" << filename << "\"");
object = static_cast<ewol::Program*>(LocalKeep(filename));
object = static_cast<ewol::Program*>(ewol::eSystem::GetSystem().GetResourcesManager().LocalKeep(filename));
if (NULL != object) {
return true;
}
@ -236,14 +227,14 @@ bool ewol::resource::Keep(const etk::UString& filename, ewol::Program*& object)
EWOL_ERROR("allocation error of a resource : " << filename);
return false;
}
LocalAdd(object);
ewol::eSystem::GetSystem().GetResourcesManager().LocalAdd(object);
return true;
}
bool ewol::resource::Keep(const etk::UString& filename, ewol::Shader*& object)
bool ewol::ResourceManager::Keep(const etk::UString& filename, ewol::Shader*& object)
{
EWOL_VERBOSE("KEEP : Simpleshader : file : \"" << filename << "\"");
object = static_cast<ewol::Shader*>(LocalKeep(filename));
object = static_cast<ewol::Shader*>(ewol::eSystem::GetSystem().GetResourcesManager().LocalKeep(filename));
if (NULL != object) {
return true;
}
@ -253,11 +244,11 @@ bool ewol::resource::Keep(const etk::UString& filename, ewol::Shader*& object)
EWOL_ERROR("allocation error of a resource : " << filename);
return false;
}
LocalAdd(object);
ewol::eSystem::GetSystem().GetResourcesManager().LocalAdd(object);
return true;
}
bool ewol::resource::Keep(ewol::Texture*& object)
bool ewol::ResourceManager::Keep(ewol::Texture*& object)
{
// this element create a new one every time ....
object = new ewol::Texture("");
@ -265,15 +256,15 @@ bool ewol::resource::Keep(ewol::Texture*& object)
EWOL_ERROR("allocation error of a resource : ??TEX??");
return false;
}
LocalAdd(object);
ewol::eSystem::GetSystem().GetResourcesManager().LocalAdd(object);
return true;
}
bool ewol::resource::Keep(ewol::Colored3DObject*& _object)
bool ewol::ResourceManager::Keep(ewol::Colored3DObject*& _object)
{
EWOL_VERBOSE("KEEP : direct Colored3DObject");
etk::UString filename = "?metaObject?Colored3DObject";
_object = static_cast<ewol::Colored3DObject*>(LocalKeep(filename));
_object = static_cast<ewol::Colored3DObject*>(ewol::eSystem::GetSystem().GetResourcesManager().LocalKeep(filename));
if (NULL != _object) {
return true;
}
@ -283,7 +274,7 @@ bool ewol::resource::Keep(ewol::Colored3DObject*& _object)
EWOL_ERROR("allocation error of a resource : Colored3DObject ");
return false;
}
LocalAdd(_object);
ewol::eSystem::GetSystem().GetResourcesManager().LocalAdd(_object);
return true;
}
#ifdef __TARGET_OS__Android
@ -306,7 +297,7 @@ static int32_t nextP2(int32_t _value)
}
#endif
bool ewol::resource::Keep(const etk::UString& _filename, ewol::TextureFile*& _object, ivec2 _size)
bool ewol::ResourceManager::Keep(const etk::UString& _filename, ewol::TextureFile*& _object, ivec2 _size)
{
EWOL_INFO("KEEP : TextureFile : file : " << _filename << " basic size=" << _size);
if (_filename == "") {
@ -315,7 +306,7 @@ bool ewol::resource::Keep(const etk::UString& _filename, ewol::TextureFile*& _ob
EWOL_ERROR("allocation error of a resource : ??TEX??");
return false;
}
LocalAdd(_object);
ewol::eSystem::GetSystem().GetResourcesManager().LocalAdd(_object);
return true;
}
if (_size.x()==0) {
@ -346,7 +337,7 @@ bool ewol::resource::Keep(const etk::UString& _filename, ewol::TextureFile*& _ob
}
EWOL_INFO("KEEP : TextureFile : file : \"" << TmpFilename << "\" new size=" << _size);
_object = static_cast<ewol::TextureFile*>(LocalKeep(TmpFilename));
_object = static_cast<ewol::TextureFile*>(ewol::eSystem::GetSystem().GetResourcesManager().LocalKeep(TmpFilename));
if (NULL != _object) {
return true;
}
@ -357,14 +348,14 @@ bool ewol::resource::Keep(const etk::UString& _filename, ewol::TextureFile*& _ob
EWOL_ERROR("allocation error of a resource : " << _filename);
return false;
}
LocalAdd(_object);
ewol::eSystem::GetSystem().GetResourcesManager().LocalAdd(_object);
return true;
}
bool ewol::resource::Keep(const etk::UString& _meshName, ewol::Mesh*& _object)
bool ewol::ResourceManager::Keep(const etk::UString& _meshName, ewol::Mesh*& _object)
{
_object = static_cast<ewol::Mesh*>(LocalKeep(_meshName));
_object = static_cast<ewol::Mesh*>(ewol::eSystem::GetSystem().GetResourcesManager().LocalKeep(_meshName));
if (NULL != _object) {
return true;
}
@ -373,12 +364,12 @@ bool ewol::resource::Keep(const etk::UString& _meshName, ewol::Mesh*& _object)
EWOL_ERROR("allocation error of a resource : ??Mesh??" << _meshName);
return false;
}
LocalAdd(_object);
ewol::eSystem::GetSystem().GetResourcesManager().LocalAdd(_object);
return true;
}
bool ewol::resource::Keep(const etk::UString& _accesMode, ewol::VirtualBufferObject*& _object)
bool ewol::ResourceManager::Keep(const etk::UString& _accesMode, ewol::VirtualBufferObject*& _object)
{
// this element create a new one every time ....
_object = new ewol::VirtualBufferObject(_accesMode);
@ -386,14 +377,14 @@ bool ewol::resource::Keep(const etk::UString& _accesMode, ewol::VirtualBufferObj
EWOL_ERROR("allocation error of a resource : ??VBO??");
return false;
}
LocalAdd(_object);
ewol::eSystem::GetSystem().GetResourcesManager().LocalAdd(_object);
return true;
}
bool ewol::resource::Keep(const etk::UString& filename, ewol::ConfigFile*& object)
bool ewol::ResourceManager::Keep(const etk::UString& filename, ewol::ConfigFile*& object)
{
EWOL_INFO("KEEP : SimpleConfig : file : \"" << filename << "\"");
object = static_cast<ewol::ConfigFile*>(LocalKeep(filename));
object = static_cast<ewol::ConfigFile*>(ewol::eSystem::GetSystem().GetResourcesManager().LocalKeep(filename));
if (NULL != object) {
return true;
}
@ -403,33 +394,33 @@ bool ewol::resource::Keep(const etk::UString& filename, ewol::ConfigFile*& objec
EWOL_ERROR("allocation error of a resource : ??Mesh.obj??");
return false;
}
LocalAdd(object);
ewol::eSystem::GetSystem().GetResourcesManager().LocalAdd(object);
return true;
}
void ewol::resource::Release(ewol::Resource*& object)
void ewol::ResourceManager::Release(ewol::Resource*& object)
{
if (NULL == object) {
EWOL_ERROR("Try to remove a resource that have null pointer ...");
return;
}
for (int32_t iii=0; iii<l_resourceListToUpdate.Size(); iii++) {
if (l_resourceListToUpdate[iii] == object) {
l_resourceListToUpdate[iii] = NULL;
for (int32_t iii=0; iii<m_resourceListToUpdate.Size(); iii++) {
if (m_resourceListToUpdate[iii] == object) {
m_resourceListToUpdate[iii] = NULL;
//l_resourceListToUpdate.Erase(iii);
}
}
EWOL_VERBOSE("RELEASE (default) : file : \"" << object->GetName() << "\"");
for (int32_t iii=l_resourceList.Size()-1; iii>=0; iii--) {
if (l_resourceList[iii] != NULL) {
if(l_resourceList[iii] == object) {
if (true == l_resourceList[iii]->Decrement()) {
for (int32_t iii=m_resourceList.Size()-1; iii>=0; iii--) {
if (m_resourceList[iii] != NULL) {
if(m_resourceList[iii] == object) {
if (true == m_resourceList[iii]->Decrement()) {
// delete element
delete(l_resourceList[iii]);
delete(m_resourceList[iii]);
// remove element from the list :
l_resourceList[iii] = NULL;
m_resourceList[iii] = NULL;
}
// insidiously remove the pointer for the caller ...
object = NULL;
@ -443,68 +434,68 @@ void ewol::resource::Release(ewol::Resource*& object)
}
void ewol::resource::Release(ewol::TexturedFont*& object)
void ewol::ResourceManager::Release(ewol::TexturedFont*& object)
{
ewol::Resource* object2 = static_cast<ewol::Resource*>(object);
Release(object2);
ewol::eSystem::GetSystem().GetResourcesManager().Release(object2);
object = NULL;
}
void ewol::resource::Release(ewol::FontBase*& object)
void ewol::ResourceManager::Release(ewol::FontBase*& object)
{
ewol::Resource* object2 = static_cast<ewol::Resource*>(object);
Release(object2);
ewol::eSystem::GetSystem().GetResourcesManager().Release(object2);
object = NULL;
}
void ewol::resource::Release(ewol::Program*& object)
void ewol::ResourceManager::Release(ewol::Program*& object)
{
ewol::Resource* object2 = static_cast<ewol::Resource*>(object);
Release(object2);
ewol::eSystem::GetSystem().GetResourcesManager().Release(object2);
object = NULL;
}
void ewol::resource::Release(ewol::Shader*& object)
void ewol::ResourceManager::Release(ewol::Shader*& object)
{
ewol::Resource* object2 = static_cast<ewol::Resource*>(object);
Release(object2);
ewol::eSystem::GetSystem().GetResourcesManager().Release(object2);
object = NULL;
}
void ewol::resource::Release(ewol::Texture*& object)
void ewol::ResourceManager::Release(ewol::Texture*& object)
{
ewol::Resource* object2 = static_cast<ewol::Resource*>(object);
Release(object2);
ewol::eSystem::GetSystem().GetResourcesManager().Release(object2);
object = NULL;
}
void ewol::resource::Release(ewol::TextureFile*& object)
void ewol::ResourceManager::Release(ewol::TextureFile*& object)
{
ewol::Resource* object2 = static_cast<ewol::Resource*>(object);
//EWOL_INFO("RELEASE : TextureFile : nb=" << object2->GetCounter());
Release(object2);
ewol::eSystem::GetSystem().GetResourcesManager().Release(object2);
object = NULL;
}
void ewol::resource::Release(ewol::Mesh*& object)
void ewol::ResourceManager::Release(ewol::Mesh*& object)
{
ewol::Resource* object2 = static_cast<ewol::Resource*>(object);
Release(object2);
ewol::eSystem::GetSystem().GetResourcesManager().Release(object2);
object = NULL;
}
void ewol::resource::Release(ewol::ConfigFile*& object)
void ewol::ResourceManager::Release(ewol::ConfigFile*& object)
{
ewol::Resource* object2 = static_cast<ewol::Resource*>(object);
Release(object2);
ewol::eSystem::GetSystem().GetResourcesManager().Release(object2);
object = NULL;
}
void ewol::resource::Release(ewol::Colored3DObject*& object)
void ewol::ResourceManager::Release(ewol::Colored3DObject*& object)
{
ewol::Resource* object2 = static_cast<ewol::Resource*>(object);
Release(object2);
ewol::eSystem::GetSystem().GetResourcesManager().Release(object2);
object = NULL;
}
void ewol::resource::Release(ewol::VirtualBufferObject*& object)
void ewol::ResourceManager::Release(ewol::VirtualBufferObject*& object)
{
ewol::Resource* object2 = static_cast<ewol::Resource*>(object);
Release(object2);
ewol::eSystem::GetSystem().GetResourcesManager().Release(object2);
object = NULL;
}

View File

@ -24,96 +24,102 @@
namespace ewol
{
namespace resource {
/**
* @brief Initialize the internal variable
*/
void Init(void);
/**
* @brief Uninitiamize the resource manager, free all resources previously requested
* @note when not free ==> generate warning, because the segfault can appear after...
*/
void UnInit(void);
/**
* @brief Display in the log all the resources loaded ...
*/
void Display(void);
/**
* @brief Reload all resources from files, and send there in openGL card if needed.
* @note If File is reference at THEME:XXX:filename if the Theme change the file will reload the newOne
*/
void ReLoadResources(void);
/**
* @brief Call by the system to send all the needed data on the graphic card chen they change ...
* @param[in] object The resources that might be updated
*/
void Update(ewol::Resource* object);
/**
* @brief Call by the system chen the openGL Context has been unexpectially removed ==> This reload all the texture, VBO and other ....
*/
void UpdateContext(void);
/**
* @brief This is to inform the resources manager that we have no more openGl context ...
*/
void ContextHasBeenDestroyed(void);
// internal API to extent eResources in extern Soft
ewol::Resource* LocalKeep(const etk::UString& filename);
void LocalAdd(ewol::Resource* object);
/**
* @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);
}
class ResourceManager
{
private:
etk::Vector<ewol::Resource*> m_resourceList;
etk::Vector<ewol::Resource*> m_resourceListToUpdate;
bool m_contextHasBeenRemoved;
public:
/**
* @brief Initialize the internal variable
*/
ResourceManager(void);
/**
* @brief Uninitiamize the resource manager, free all resources previously requested
* @note when not free ==> generate warning, because the segfault can appear after...
*/
~ResourceManager(void);
/**
* @brief Display in the log all the resources loaded ...
*/
void Display(void);
/**
* @brief Reload all resources from files, and send there in openGL card if needed.
* @note If File is reference at THEME:XXX:filename if the Theme change the file will reload the newOne
*/
void ReLoadResources(void);
/**
* @brief Call by the system to send all the needed data on the graphic card chen they change ...
* @param[in] object The resources that might be updated
*/
void Update(ewol::Resource* object);
/**
* @brief Call by the system chen the openGL Context has been unexpectially removed ==> This reload all the texture, VBO and other ....
*/
void UpdateContext(void);
/**
* @brief This is to inform the resources manager that we have no more openGl context ...
*/
void ContextHasBeenDestroyed(void);
private:
// 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);
};
};

View File

@ -14,15 +14,12 @@
#include <ewol/Dimension.h>
#include <ewol/debug.h>
#include <ewol/config.h>
#include <ewol/renderer/EObject.h>
#include <ewol/renderer/EObjectManager.h>
#include <ewol/eObject/EObject.h>
#include <ewol/eObject/EObjectManager.h>
#include <ewol/renderer/os/eSystem.h>
#include <ewol/renderer/os/gui.h>
#include <ewol/renderer/eSystem.h>
#include <ewol/renderer/ResourceManager.h>
#include <ewol/renderer/os/eSystemInput.h>
#include <ewol/renderer/eSystemInput.h>
#include <ewol/renderer/openGL.h>
#include <ewol/widget/WidgetManager.h>
@ -43,16 +40,6 @@ static etk::Mutex& MutexInterface(void)
return s_interfaceMutex;
}
/**
* @brief Get the draw mutex (ewol render).
* @note due ti the fact that the system can be called for multiple instance, for naw we just limit the acces to one process at a time.
* @return the main inteface Mutex
*/
static etk::Mutex& MutexDraw(void)
{
static etk::Mutex s_drawMutex;
return s_drawMutex;
}
static ewol::eSystem* l_curentInterface=NULL;
ewol::eSystem& ewol::eSystem::GetSystem(void)
@ -251,10 +238,6 @@ ewol::eSystem::eSystem(void) :
EWOL_INFO("Build Date: " << date::GetYear() << "/" << date::GetMonth() << "/" << date::GetDay() << " " << date::GetHour() << "h" << date::GetMinute());
// TODO : Remove this ...
etk::InitDefaultFolder("ewolApplNoName");
// TODO : Remove all of this gloabals ...
ewol::openGL::Init();
ewol::resource::Init();
ewol::config::Init();
// request the init of the application in the main context of openGL ...
{
eSystemMessage data;
@ -282,11 +265,11 @@ ewol::eSystem::~eSystem(void)
SetSystem();
// call application to uninit
APP_UnInit(*this);
if (NULL!=m_windowsCurrent) {
EWOL_ERROR("Main windows has not been removed... ==> memory leek");
}
// unset all windows
m_windowsCurrent = NULL;
ewol::config::UnInit();
ewol::resource::UnInit();
ewol::openGL::UnInit();
m_msgSystem.Clean();
// release the curent interface :
ReleaseSystem();
@ -461,12 +444,12 @@ bool ewol::eSystem::OS_Draw(bool _displayEveryTime)
//! Drawing section :
{
// Lock OpenGl context:
MutexDraw().Lock();
ewol::openGL::Lock();
m_FpsSystemContext.Tic();
if (NULL != m_windowsCurrent) {
if( true == needRedraw
|| true == _displayEveryTime) {
ewol::resource::UpdateContext();
m_resourceManager.UpdateContext();
m_FpsSystemContext.IncrementCounter();
}
}
@ -488,7 +471,7 @@ bool ewol::eSystem::OS_Draw(bool _displayEveryTime)
//glFinish();
m_FpsFlush.Toc();
// Release Open GL Context
MutexDraw().UnLock();
ewol::openGL::UnLock();
}
m_FpsSystemEvent.Draw();
m_FpsSystemContext.Draw();
@ -512,7 +495,7 @@ void ewol::eSystem::ResetIOEvent(void)
void ewol::eSystem::OS_OpenGlContextDestroy(void)
{
ewol::resource::ContextHasBeenDestroyed();
m_resourceManager.ContextHasBeenDestroyed();
}

View File

@ -14,12 +14,14 @@
#include <ewol/ewol.h>
#include <ewol/clipBoard.h>
#include <ewol/widget/Windows.h>
#include <ewol/renderer/os/eSystemInput.h>
#include <ewol/renderer/eSystemInput.h>
#include <ewol/renderer/os/Fps.h>
#include <etk/MessageFifo.h>
#include <ewol/widget/WidgetManager.h>
#include <ewol/eObject/EObjectManager.h>
#include <ewol/eObject/EObjectMessageMultiCast.h>
#include <ewol/renderer/ConfigFont.h>
#include <ewol/renderer/EObjectManager.h>
#include <ewol/renderer/EObjectMessageMultiCast.h>
#include <ewol/renderer/ResourceManager.h>
// TODO : Remove this from here ...
@ -75,8 +77,13 @@ class eSystemMessage {
namespace ewol
{
// TODO : Rename this Context
class eSystem
{
private:
ewol::ConfigFont m_configFont; //!< global font configuration
public:
ewol::ConfigFont& GetFontDefault(void) { return m_configFont; };
private:
ewol::WidgetManager m_widgetManager; //!< global widget manager
public:
@ -89,13 +96,17 @@ namespace ewol
ewol::EObjectMessageMultiCast m_MessageMulticast; //!< global message multicastiong system
public:
ewol::EObjectMessageMultiCast& GetEObjectMessageMultiCast(void) { return m_MessageMulticast; };
private:
ewol::ResourceManager m_resourceManager; //!< global resources Manager
public:
ewol::ResourceManager& GetResourcesManager(void) { return m_resourceManager; };
public:
eSystem(void);
virtual ~eSystem(void);
public:
/**
* @brief From everyware in the program, we can get the system inteface.
* @return curent pointer on the instance.
* @return current reference on the instance.
*/
static eSystem& GetSystem(void);
protected:

View File

@ -13,12 +13,10 @@
#include <ewol/ewol.h>
#include <ewol/eObject/EObject.h>
#include <ewol/eObject/EObjectManager.h>
#include <ewol/renderer/os/gui.h>
#include <ewol/renderer/os/eSystem.h>
#include <ewol/renderer/os/eSystemInput.h>
#include <ewol/renderer/EObject.h>
#include <ewol/renderer/EObjectManager.h>
#include <ewol/renderer/eSystem.h>
#include <ewol/renderer/eSystemInput.h>
#include <ewol/renderer/resources/Texture.h>
#include <ewol/widget/Widget.h>

View File

@ -10,6 +10,17 @@
#include <ewol/debug.h>
#include <ewol/renderer/openGL.h>
/**
* @brief Get the draw mutex (ewol render).
* @note due ti the fact that the system can be called for multiple instance, for naw we just limit the acces to one process at a time.
* @return the main inteface Mutex
*/
static etk::Mutex& MutexOpenGl(void)
{
static etk::Mutex s_drawMutex;
return s_drawMutex;
}
etk::Vector<mat4> l_matrixList;
mat4 l_matrixCamera;
static uint32_t l_flagsCurrent = 0;
@ -17,9 +28,10 @@ static uint32_t l_flagsMustBeSet = 0;
static uint32_t l_textureflags = 0;
static int32_t l_programId = 0;
void ewol::openGL::Init(void)
void ewol::openGL::Lock(void)
{
// remove deprecated pb ...
MutexOpenGl().Lock();
l_matrixList.Clear();
mat4 tmpMat;
l_matrixList.PushBack(tmpMat);
@ -30,17 +42,9 @@ void ewol::openGL::Init(void)
l_programId = -1;
}
void ewol::openGL::UnInit(void)
void ewol::openGL::UnLock(void)
{
l_matrixList.Clear();
l_matrixCamera.Identity();
}
void ewol::openGL::ContextIsRemoved(void)
{
// same as call Init, but in case of changing...
ewol::openGL::Init();
MutexOpenGl().UnLock();
}
void ewol::openGL::SetBasicMatrix(const mat4& newOne)

View File

@ -56,18 +56,13 @@ extern "C" {
namespace ewol {
namespace openGL {
/**
* @brief Initialize the open gl system (all the data register in the graphic card is all time duplicate in the memory)
* this is due to the fact of some operating system destroy sometime the opengl context
* @brief Lock the OpenGL context for one user only ==> better to keep flags and other things ...
*/
void Init(void);
void Lock(void);
/**
* @brief un-init the opengl element from the graphic card
* @brief Un-lock the OpenGL context for an other user...
*/
void UnInit(void);
/**
* @brief Need to call it when openGl context is removed ==> need to reset internal properties ...
*/
void ContextIsRemoved(void);
void UnLock(void);
/**
* @brief When you will done an opengl rendering, you might call this reset matrix first. It remove all the stach of the matrix pushed.
* @param[in] newOne the default matrix that might be set for the graphic card for renderer. if too more pop will be done, this is the last that mmight survived

View File

@ -12,9 +12,8 @@
#include <stdint.h>
#include <pthread.h>
#include <ewol/debug.h>
#include <ewol/renderer/os/eSystem.h>
#include <ewol/renderer/eSystem.h>
#include <ewol/renderer/audio/audio.h>
#include <ewol/renderer/os/gui.h>
#include <ewol/Dimension.h>
/* include auto generated file */
#include <ewol/renderer/os/org_ewol_EwolConstants.h>

View File

@ -9,7 +9,7 @@
#import <ewol/renderer/os/gui.MacOs.OpenglView.h>
#include <OpenGL/gl.h>
#include <ewol/renderer/os/eSystem.h>
#include <ewol/renderer/eSystem.h>
#include <ewol/debug.h>
#include <ewol/Dimension.h>

View File

@ -15,10 +15,9 @@
#include <etk/UString.h>
#include <etk/unicode.h>
#include <ewol/widget/WidgetManager.h>
#include <ewol/renderer/os/gui.h>
#include <ewol/renderer/ResourceManager.h>
#include <ewol/renderer/os/eSystem.h>
#include <ewol/renderer/eSystem.h>
#include <unistd.h>
#include <stdlib.h>

View File

@ -15,11 +15,10 @@
#include <etk/UString.h>
#include <etk/unicode.h>
#include <ewol/widget/WidgetManager.h>
#include <ewol/renderer/os/gui.h>
#include <ewol/renderer/resources/Texture.h>
#include <ewol/renderer/resources/Image.h>
#include <ewol/renderer/os/eSystem.h>
#include <ewol/renderer/eSystem.h>
#include <ewol/renderer/openGL.h>
#include <sys/time.h>

View File

@ -10,15 +10,13 @@
#include <ewol/debug.h>
#include <ewol/ewol.h>
#include <ewol/key.h>
#include <ewol/config.h>
#include <ewol/commandLine.h>
#include <etk/UString.h>
#include <etk/unicode.h>
#include <ewol/widget/WidgetManager.h>
#include <ewol/renderer/os/gui.h>
#include <ewol/renderer/ResourceManager.h>
#include <ewol/renderer/os/eSystem.h>
#include <ewol/renderer/eSystem.h>
#include <ewol/Dimension.h>
#include <unistd.h>

View File

@ -33,10 +33,9 @@
#include <etk/UString.h>
#include <etk/unicode.h>
#include <ewol/widget/WidgetManager.h>
#include <ewol/renderer/os/gui.h>
#include <ewol/renderer/ResourceManager.h>
#include <ewol/renderer/os/eSystem.h>
#include <ewol/renderer/eSystem.h>
#include <ewol/renderer/openGL.h>
#include <unistd.h>

View File

@ -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::resource::Keep(tmpString, m_GLprogram) ) {
if (true == ewol::ResourceManager::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::resource::Release(m_GLprogram);
ewol::ResourceManager::Release(m_GLprogram);
}

View File

@ -23,11 +23,17 @@
// free Font hnadle of librairies ... entry for acces ...
static int32_t l_countLoaded=0;
static FT_Library library;
void ewol::FreeTypeInit(void)
{
EWOL_DEBUG("==> Init Font-Manager");
l_countLoaded++;
if (l_countLoaded>1) {
// already loaded ...
return;
}
int32_t error = FT_Init_FreeType( &library );
if(0 != error) {
EWOL_CRITICAL(" when loading FreeType Librairy ...");
@ -37,6 +43,11 @@ void ewol::FreeTypeInit(void)
void ewol::FreeTypeUnInit(void)
{
EWOL_DEBUG("==> Un-Init Font-Manager");
l_countLoaded--;
if (l_countLoaded>0) {
// already needed ...
return;
}
int32_t error = FT_Done_FreeType( library );
library = NULL;
if(0 != error) {

View File

@ -33,7 +33,7 @@ ewol::Mesh::Mesh(const etk::UString& _fileName, const etk::UString& _shaderName)
//EWOL_DEBUG(m_name << " " << m_light);
if (true == ewol::resource::Keep(_shaderName, m_GLprogram) ) {
if (true == ewol::ResourceManager::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::resource::Keep("w-fff", m_verticesVBO);
ewol::ResourceManager::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::resource::Release(m_GLprogram);
ewol::resource::Release(m_verticesVBO);
ewol::ResourceManager::Release(m_GLprogram);
ewol::ResourceManager::Release(m_verticesVBO);
if (m_functionFreeShape!=NULL) {
m_functionFreeShape(m_pointerShape);
m_pointerShape = NULL;

View File

@ -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::resource::Keep(tmpFilename+"vert", tmpShader)) {
if (false == ewol::ResourceManager::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::resource::Keep(tmpFilename+"frag", tmpShader)) {
if (false == ewol::ResourceManager::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::resource::Keep(tmpFilename, tmpShader)) {
if (false == ewol::ResourceManager::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<m_shaderList.Size(); iii++) {
ewol::resource::Release(m_shaderList[iii]);
ewol::ResourceManager::Release(m_shaderList[iii]);
m_shaderList[iii] = 0;
}
m_shaderList.Clear();

View File

@ -9,9 +9,8 @@
#include <etk/types.h>
#include <etk/os/FSNode.h>
#include <ewol/config.h>
#include <ewol/renderer/ResourceManager.h>
#include <ewol/renderer/eSystem.h>
#include <ewol/renderer/resources/font/FontBase.h>
#include <ewol/renderer/resources/TexturedFont.h>
@ -68,16 +67,6 @@ static int32_t simpleSQRT(int32_t value)
return val;
}
static bool& GetFontInSystem(void)
{
static bool fontInOs = true;
return fontInOs;
}
void ewol::font::SetFontPropety(bool inOSSystem)
{
GetFontInSystem() = inOSSystem;
}
ewol::TexturedFont::TexturedFont(etk::UString fontName) :
ewol::Texture(fontName)
@ -123,14 +112,14 @@ ewol::TexturedFont::TexturedFont(etk::UString fontName) :
m_size = tmpSize;
etk::Vector<etk::UString> folderList;
if (true==GetFontInSystem()) {
if (true==ewol::eSystem::GetSystem().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("DATA:fonts");
folderList.PushBack(ewol::eSystem::GetSystem().GetFontDefault().GetFolder());
for (int32_t folderID=0; folderID<folderList.Size() ; folderID++) {
etk::FSNode myFolder(folderList[folderID]);
// find the real Font name :

View File

@ -17,7 +17,6 @@ namespace ewol
{
namespace font
{
void SetFontPropety(bool inOSSystem);
typedef enum {
Regular=0,
Italic,

View File

@ -9,7 +9,7 @@
#include <ewol/ewol.h>
#include <ewol/widget/Button.h>
#include <ewol/renderer/os/eSystem.h>
#include <ewol/renderer/eSystem.h>
#undef __class__
#define __class__ "Button"

View File

@ -14,7 +14,7 @@
#include <ewol/widget/meta/ColorChooser.h>
#include <ewol/widget/Windows.h>
#include <ewol/ewol.h>
#include <ewol/renderer/os/eSystem.h>
#include <ewol/renderer/eSystem.h>
extern const char * const ewolEventButtonColorChange = "ewol-Button-Color-Change";

View File

@ -10,7 +10,7 @@
#include <ewol/widget/Entry.h>
#include <ewol/widget/WidgetManager.h>
#include <ewol/ewol.h>
#include <ewol/renderer/os/eSystem.h>
#include <ewol/renderer/eSystem.h>

View File

@ -7,7 +7,6 @@
*/
#include <ewol/ewol.h>
#include <ewol/eObject/EObject.h>
#include <ewol/widget/WidgetManager.h>
#include <ewol/widget/Menu.h>
#include <ewol/widget/Button.h>

View File

@ -7,12 +7,11 @@
*/
#include <ewol/widget/Widget.h>
#include <ewol/eObject/EObjectManager.h>
#include <ewol/renderer/EObjectManager.h>
#include <ewol/widget/WidgetManager.h>
#include <ewol/ewol.h>
#include <ewol/renderer/openGL.h>
#include <ewol/renderer/os/eSystem.h>
#include <ewol/renderer/os/gui.h>
#include <ewol/renderer/eSystem.h>
#undef __class__
#define __class__ "DrawProperty"

View File

@ -9,7 +9,7 @@
#ifndef __EWOL_WIDGET_H__
#define __EWOL_WIDGET_H__
#include <ewol/eObject/EObject.h>
#include <ewol/renderer/EObject.h>
#include <ewol/Dimension.h>
namespace ewol {

View File

@ -10,7 +10,7 @@
#include <etk/UString.h>
#include <ewol/ewol.h>
#include <ewol/renderer/openGL.h>
#include <ewol/renderer/os/eSystem.h>
#include <ewol/renderer/eSystem.h>
#include <ewol/widget/Widget.h>
#include <ewol/widget/Windows.h>
#include <ewol/widget/WidgetManager.h>

View File

@ -13,7 +13,6 @@
#include <ewol/widget/Image.h>
#include <ewol/widget/WidgetManager.h>
#include <ewol/widget/Composer.h>
#include <ewol/UserConfig.h>
#include <etk/Vector.h>
@ -213,7 +212,8 @@ void widget::Parameter::OnReceiveMessage(const ewol::EMessage& _msg)
// Close this widget ...
AutoDestroy();
} else if (_msg.GetMessage() == ewolEventParameterSave) {
ewol::userConfig::Save();
//ewol::userConfig::Save();
EWOL_TODO("Save Parameter !!! ");
} else if (_msg.GetMessage() == l_eventMenuSelected) {
if (NULL != m_wSlider) {
int32_t value = 0;

View File

@ -15,34 +15,30 @@ def Create(target):
'ewol/ewol.cpp',
'ewol/clipBoard.cpp',
'ewol/debug.cpp',
'ewol/config.cpp',
'ewol/commandLine.cpp',
'ewol/key.cpp',
'ewol/cursor.cpp',
'ewol/Dimension.cpp',
'ewol/UserConfig.cpp'])
'ewol/Dimension.cpp'])
# Basic Eobject of EWOL
myModule.AddSrcFile([
'ewol/eObject/EConfig.cpp',
'ewol/eObject/EMessage.cpp',
'ewol/eObject/EObject.cpp',
'ewol/eObject/EObjectManager.cpp',
'ewol/eObject/EObjectMessageMultiCast.cpp'])
myModule.AddSrcFile([])
#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/EObjectMessageMultiCast.cpp',
'ewol/renderer/openGL.cpp',
'ewol/renderer/ConfigFont.cpp',
'ewol/renderer/EventInput.cpp',
'ewol/renderer/EventEntry.cpp',
'ewol/renderer/EventTime.cpp',
'ewol/renderer/Light.cpp',
'ewol/renderer/Material.cpp'])
# Operating System interface
myModule.AddSrcFile([
'ewol/renderer/os/eSystem.cpp',
'ewol/renderer/os/eSystemInput.cpp'])
'ewol/renderer/Material.cpp',
'ewol/renderer/eSystem.cpp',
'ewol/renderer/eSystemInput.cpp'])
# renderer :
myModule.AddSrcFile([