[DEV] coding style step 1

This commit is contained in:
Edouard DUPIN 2013-10-07 22:09:13 +02:00
parent d9177e4565
commit 9e540f286e
186 changed files with 6956 additions and 7007 deletions

2
external/agg vendored

@ -1 +1 @@
Subproject commit 64280cda086d931f7af6ac4ce29e181ceee8f45b Subproject commit 3970e6969827ec485bdf260f003653f27d1e8749

View File

@ -8,33 +8,27 @@
#include <date/date.h> #include <date/date.h>
int32_t date::GetYear(void) int32_t date::getYear(void) {
{
return BUILD_YEAR; return BUILD_YEAR;
} }
int32_t date::GetMonth(void) int32_t date::getMonth(void) {
{
return BUILD_MONTH; return BUILD_MONTH;
} }
int32_t date::GetDay(void) int32_t date::getDay(void) {
{
return BUILD_DAY; return BUILD_DAY;
} }
int32_t date::GetHour(void) int32_t date::getHour(void) {
{
return BUILD_HOUR; return BUILD_HOUR;
} }
int32_t date::GetMinute(void) int32_t date::getMinute(void) {
{
return BUILD_MINUTE; return BUILD_MINUTE;
} }
int32_t date::GetSecond(void) int32_t date::getSecond(void) {
{
return BUILD_SECOND; return BUILD_SECOND;
} }

View File

@ -11,14 +11,13 @@
#include <stdint.h> #include <stdint.h>
namespace date namespace date {
{ int32_t getYear(void);
int32_t GetYear(void); int32_t getMonth(void);
int32_t GetMonth(void); int32_t getDay(void);
int32_t GetDay(void); int32_t getHour(void);
int32_t GetHour(void); int32_t getMinute(void);
int32_t GetMinute(void); int32_t getSecond(void);
int32_t GetSecond(void);
}; };

2
external/egami vendored

@ -1 +1 @@
Subproject commit 9ab5eea1f349fdae52932508d108d2e954813bad Subproject commit 11956be90c71c30c77b7c487ff16b077db22a49d

2
external/ege vendored

@ -1 +1 @@
Subproject commit c5b072f457d6c4fc7775fc0bd062e60ad37ef450 Subproject commit 319b4552d1d90522b87b3c6913d716cd033d4a2c

2
external/ejson vendored

@ -1 +1 @@
Subproject commit 299ca3e6b2edf15cc8156b97d9e59b3d3c3a4fa7 Subproject commit a788a3c450585c42dd59cf8e3813bd1a4a241c5e

2
external/esvg vendored

@ -1 +1 @@
Subproject commit 32c4469c127fed6ff4f3c9a7031eb7e76f72c43b Subproject commit ce05b596afbc485c55071f4fd7b162e932c3f410

2
external/etk vendored

@ -1 +1 @@
Subproject commit dfcb78c081c6d975cf88dcb2e4cd1b0ada289c67 Subproject commit 63906e9b7726c0ad630e12409843d7381febaf24

2
external/exml vendored

@ -1 +1 @@
Subproject commit 75ef4d184ade2791d1db3b3d0f40b8ae46aa7f45 Subproject commit 33d1e95085e090eec9860213ba97a1616442d159

View File

@ -12,7 +12,7 @@
#undef __class__ #undef __class__
#define __class__ "Dimension" #define __class__ "Dimension"
// TODO : Set this in a super class acced in a statin fuction... // TODO : set this in a super class acced in a statin fuction...
// ratio in milimeter : // ratio in milimeter :
static bool isInit = false; static bool isInit = false;
static vec2 ratio(9999999,888888); static vec2 ratio(9999999,888888);
@ -31,51 +31,51 @@ static const float millimeterToCentimeter = 10.0f;
static const float millimeterToKilometer = 1000000.0f; static const float millimeterToKilometer = 1000000.0f;
void ewol::dimension::Init(void) void ewol::dimension::init(void)
{ {
if (true==isInit) { if (true == isInit) {
return; return;
} }
ewol::Dimension conversion(vec2(72,72), ewol::Dimension::Inch); ewol::Dimension conversion(vec2(72,72), ewol::Dimension::Inch);
ratio = conversion.GetMillimeter(); ratio = conversion.getMillimeter();
invRatio.setValue(1.0f/ratio.x(),1.0f/ratio.y()); invRatio.setValue(1.0f/ratio.x(),1.0f/ratio.y());
windowsSize.Set(vec2(200,200), ewol::Dimension::Pixel); windowsSize.set(vec2(200,200), ewol::Dimension::Pixel);
isInit = true; isInit = true;
} }
void ewol::dimension::UnInit(void) void ewol::dimension::unInit(void)
{ {
isInit = false; isInit = false;
ratio.setValue(9999999,888888); ratio.setValue(9999999,888888);
invRatio.setValue(1.0f/ratio.x(),1.0f/ratio.y()); invRatio.setValue(1.0f/ratio.x(),1.0f/ratio.y());
windowsSize.Set(vec2(9999999,88888), ewol::Dimension::Pixel); windowsSize.set(vec2(9999999,88888), ewol::Dimension::Pixel);
} }
void ewol::dimension::SetPixelRatio(const vec2& _ratio, ewol::Dimension::distance_te _type) void ewol::dimension::setPixelRatio(const vec2& _ratio, ewol::Dimension::distance_te _type)
{ {
ewol::dimension::Init(); ewol::dimension::init();
EWOL_INFO("Set a new screen ratio for the screen : ratio=" << _ratio << " type=" << _type); EWOL_INFO("Set a new screen ratio for the screen : ratio=" << _ratio << " type=" << _type);
ewol::Dimension conversion(_ratio, _type); ewol::Dimension conversion(_ratio, _type);
EWOL_INFO(" ==> " << conversion); EWOL_INFO(" == > " << conversion);
ratio = conversion.GetMillimeter(); ratio = conversion.getMillimeter();
invRatio.setValue(1.0f/ratio.x(),1.0f/ratio.y()); invRatio.setValue(1.0f/ratio.x(),1.0f/ratio.y());
EWOL_INFO("Set a new screen ratio for the screen : ratioMm=" << ratio); EWOL_INFO("Set a new screen ratio for the screen : ratioMm=" << ratio);
} }
void ewol::dimension::SetPixelWindowsSize(const vec2& _size) void ewol::dimension::setPixelWindowsSize(const vec2& _size)
{ {
windowsSize = _size; windowsSize = _size;
EWOL_VERBOSE("Set a new Windows property size " << windowsSize << "px"); EWOL_VERBOSE("Set a new Windows property size " << windowsSize << "px");
} }
vec2 ewol::dimension::GetWindowsSize(ewol::Dimension::distance_te _type) vec2 ewol::dimension::getWindowsSize(ewol::Dimension::distance_te _type)
{ {
return windowsSize.Get(_type); return windowsSize.get(_type);
} }
float ewol::dimension::GetWindowsDiag(ewol::Dimension::distance_te _type) float ewol::dimension::getWindowsDiag(ewol::Dimension::distance_te _type)
{ {
vec2 size = ewol::dimension::GetWindowsSize(_type); vec2 size = ewol::dimension::getWindowsSize(_type);
return size.length(); return size.length();
} }
@ -94,45 +94,45 @@ ewol::Dimension::Dimension(const vec2& _size, ewol::Dimension::distance_te _type
m_data(0,0), m_data(0,0),
m_type(ewol::Dimension::Pixel) m_type(ewol::Dimension::Pixel)
{ {
Set(_size, _type); set(_size, _type);
} }
void ewol::Dimension::Set(etk::UString _config) void ewol::Dimension::set(etk::UString _config)
{ {
m_data.setValue(0,0); m_data.setValue(0,0);
m_type = ewol::Dimension::Pixel; m_type = ewol::Dimension::Pixel;
distance_te type = ewol::Dimension::Pixel; distance_te type = ewol::Dimension::Pixel;
if (_config.EndWith("%",false)==true) { if (_config.endWith("%",false) == true) {
type = ewol::Dimension::Pourcent; type = ewol::Dimension::Pourcent;
_config.Remove(_config.Size()-1, 1); _config.remove(_config.size()-1, 1);
} else if (_config.EndWith("px",false)==true) { } else if (_config.endWith("px",false) == true) {
type = ewol::Dimension::Pixel; type = ewol::Dimension::Pixel;
_config.Remove(_config.Size()-2, 2); _config.remove(_config.size()-2, 2);
} else if (_config.EndWith("ft",false)==true) { } else if (_config.endWith("ft",false) == true) {
type = ewol::Dimension::foot; type = ewol::Dimension::foot;
_config.Remove(_config.Size()-2, 2); _config.remove(_config.size()-2, 2);
} else if (_config.EndWith("in",false)==true) { } else if (_config.endWith("in",false) == true) {
type = ewol::Dimension::Inch; type = ewol::Dimension::Inch;
_config.Remove(_config.Size()-2, 2); _config.remove(_config.size()-2, 2);
} else if (_config.EndWith("km",false)==true) { } else if (_config.endWith("km",false) == true) {
type = ewol::Dimension::Kilometer; type = ewol::Dimension::Kilometer;
_config.Remove(_config.Size()-2, 2); _config.remove(_config.size()-2, 2);
} else if (_config.EndWith("mm",false)==true) { } else if (_config.endWith("mm",false) == true) {
type = ewol::Dimension::Millimeter; type = ewol::Dimension::Millimeter;
_config.Remove(_config.Size()-2, 2); _config.remove(_config.size()-2, 2);
} else if (_config.EndWith("cm",false)==true) { } else if (_config.endWith("cm",false) == true) {
type = ewol::Dimension::Centimeter; type = ewol::Dimension::Centimeter;
_config.Remove(_config.Size()-2, 2); _config.remove(_config.size()-2, 2);
} else if (_config.EndWith("m",false)==true) { } else if (_config.endWith("m",false) == true) {
type = ewol::Dimension::Meter; type = ewol::Dimension::Meter;
_config.Remove(_config.Size()-1, 1); _config.remove(_config.size()-1, 1);
} else { } else {
EWOL_CRITICAL("Can not parse dimention : \"" << _config << "\""); EWOL_CRITICAL("Can not parse dimention : \"" << _config << "\"");
return; return;
} }
vec2 tmp = _config; vec2 tmp = _config;
Set(tmp, type); set(tmp, type);
EWOL_VERBOSE(" config dimention : \"" << _config << "\" ==> " << *this ); EWOL_VERBOSE(" config dimention : \"" << _config << "\" == > " << *this );
} }
ewol::Dimension::~Dimension(void) ewol::Dimension::~Dimension(void)
@ -143,9 +143,9 @@ ewol::Dimension::~Dimension(void)
ewol::Dimension::operator etk::UString(void) const ewol::Dimension::operator etk::UString(void) const
{ {
etk::UString str; etk::UString str;
str = Get(GetType()); str = get(getType());
switch(GetType()) { switch(getType()) {
case ewol::Dimension::Pourcent: case ewol::Dimension::Pourcent:
str += "%"; str += "%";
break; break;
@ -174,31 +174,31 @@ ewol::Dimension::operator etk::UString(void) const
return str; return str;
} }
vec2 ewol::Dimension::Get(ewol::Dimension::distance_te _type) const vec2 ewol::Dimension::get(ewol::Dimension::distance_te _type) const
{ {
switch(_type) { switch(_type) {
case ewol::Dimension::Pourcent: case ewol::Dimension::Pourcent:
return GetPourcent(); return getPourcent();
case ewol::Dimension::Pixel: case ewol::Dimension::Pixel:
return GetPixel(); return getPixel();
case ewol::Dimension::Meter: case ewol::Dimension::Meter:
return GetMeter(); return getMeter();
case ewol::Dimension::Centimeter: case ewol::Dimension::Centimeter:
return GetCentimeter(); return getCentimeter();
case ewol::Dimension::Millimeter: case ewol::Dimension::Millimeter:
return GetMillimeter(); return getMillimeter();
case ewol::Dimension::Kilometer: case ewol::Dimension::Kilometer:
return GetKilometer(); return getKilometer();
case ewol::Dimension::Inch: case ewol::Dimension::Inch:
return GetInch(); return getInch();
case ewol::Dimension::foot: case ewol::Dimension::foot:
return GetFoot(); return getFoot();
} }
} }
void ewol::Dimension::Set(const vec2& _size, ewol::Dimension::distance_te _type) void ewol::Dimension::set(const vec2& _size, ewol::Dimension::distance_te _type)
{ {
// Set min max on input to limit error : // set min max on input to limit error :
vec2 size(etk_avg(0.0f,_size.x(),9999999.0f), vec2 size(etk_avg(0.0f,_size.x(),9999999.0f),
etk_avg(0.0f,_size.y(),9999999.0f)); etk_avg(0.0f,_size.y(),9999999.0f));
switch(_type) { switch(_type) {
@ -207,7 +207,7 @@ void ewol::Dimension::Set(const vec2& _size, ewol::Dimension::distance_te _type)
vec2 size2(etk_avg(0.0f,_size.x(),100.0f), vec2 size2(etk_avg(0.0f,_size.x(),100.0f),
etk_avg(0.0f,_size.y(),100.0f)); etk_avg(0.0f,_size.y(),100.0f));
m_data = vec2(size2.x()*0.01f, size2.y()*0.01f); m_data = vec2(size2.x()*0.01f, size2.y()*0.01f);
//EWOL_VERBOSE("Set % : " << size2 << " ==> " << m_data); //EWOL_VERBOSE("Set % : " << size2 << " == > " << m_data);
} }
break; break;
case ewol::Dimension::Pixel: case ewol::Dimension::Pixel:
@ -235,23 +235,23 @@ void ewol::Dimension::Set(const vec2& _size, ewol::Dimension::distance_te _type)
m_type = _type; m_type = _type;
} }
vec2 ewol::Dimension::GetPixel(void) const vec2 ewol::Dimension::getPixel(void) const
{ {
if (m_type!=ewol::Dimension::Pourcent) { if (m_type!=ewol::Dimension::Pourcent) {
return m_data; return m_data;
} else { } else {
vec2 windDim = windowsSize.GetPixel(); vec2 windDim = windowsSize.getPixel();
vec2 res = vec2(windDim.x()*m_data.x(), windDim.y()*m_data.y()); vec2 res = vec2(windDim.x()*m_data.x(), windDim.y()*m_data.y());
//EWOL_DEBUG("Get % : " << m_data << " / " << windDim << "==> " << res); //EWOL_DEBUG("Get % : " << m_data << " / " << windDim << " == > " << res);
return res; return res;
} }
} }
vec2 ewol::Dimension::GetPourcent(void) const vec2 ewol::Dimension::getPourcent(void) const
{ {
if (m_type!=ewol::Dimension::Pourcent) { if (m_type!=ewol::Dimension::Pourcent) {
vec2 windDim = windowsSize.GetPixel(); vec2 windDim = windowsSize.getPixel();
//EWOL_DEBUG(" windows dimention : " /*<< windowsSize*/ << " ==> " << windDim << "px"); // ==> infinite loop ... //EWOL_DEBUG(" windows dimention : " /*<< windowsSize*/ << " == > " << windDim << "px"); // ==> infinite loop ...
//printf(" windows dimention : %f,%f", windDim.x(),windDim.y()); //printf(" windows dimention : %f,%f", windDim.x(),windDim.y());
//printf(" data : %f,%f", m_data.x(),m_data.y()); //printf(" data : %f,%f", m_data.x(),m_data.y());
return vec2((m_data.x()/windDim.x())*100.0f, (m_data.y()/windDim.y())*100.0f); return vec2((m_data.x()/windDim.x())*100.0f, (m_data.y()/windDim.y())*100.0f);
@ -259,34 +259,34 @@ vec2 ewol::Dimension::GetPourcent(void) const
return vec2(m_data.x()*100.0f, m_data.y()*100.0f);; return vec2(m_data.x()*100.0f, m_data.y()*100.0f);;
} }
vec2 ewol::Dimension::GetMeter(void) const vec2 ewol::Dimension::getMeter(void) const
{ {
return ewol::Dimension::GetMillimeter()*millimeterToMeter; return ewol::Dimension::getMillimeter()*millimeterToMeter;
} }
vec2 ewol::Dimension::GetCentimeter(void) const vec2 ewol::Dimension::getCentimeter(void) const
{ {
return ewol::Dimension::GetMillimeter()*millimeterToCentimeter; return ewol::Dimension::getMillimeter()*millimeterToCentimeter;
} }
vec2 ewol::Dimension::GetMillimeter(void) const vec2 ewol::Dimension::getMillimeter(void) const
{ {
return ewol::Dimension::GetPixel()*invRatio; return ewol::Dimension::getPixel()*invRatio;
} }
vec2 ewol::Dimension::GetKilometer(void) const vec2 ewol::Dimension::getKilometer(void) const
{ {
return ewol::Dimension::GetMillimeter()*millimeterToKilometer; return ewol::Dimension::getMillimeter()*millimeterToKilometer;
} }
vec2 ewol::Dimension::GetInch(void) const vec2 ewol::Dimension::getInch(void) const
{ {
return ewol::Dimension::GetMillimeter()*millimeterToInch; return ewol::Dimension::getMillimeter()*millimeterToInch;
} }
vec2 ewol::Dimension::GetFoot(void) const vec2 ewol::Dimension::getFoot(void) const
{ {
return ewol::Dimension::GetMillimeter()*millimeterToFoot; return ewol::Dimension::getMillimeter()*millimeterToFoot;
} }
etk::CCout& ewol::operator <<(etk::CCout &os, const ewol::Dimension::distance_te& obj) etk::CCout& ewol::operator <<(etk::CCout &os, const ewol::Dimension::distance_te& obj)
@ -322,6 +322,6 @@ etk::CCout& ewol::operator <<(etk::CCout &os, const ewol::Dimension::distance_te
etk::CCout& ewol::operator <<(etk::CCout& _os, const ewol::Dimension& _obj) etk::CCout& ewol::operator <<(etk::CCout& _os, const ewol::Dimension& _obj)
{ {
_os << _obj.Get(_obj.GetType()) << _obj.GetType(); _os << _obj.get(_obj.getType()) << _obj.getType();
return _os; return _os;
} }

View File

@ -50,12 +50,12 @@ namespace ewol
* @brief Constructor * @brief Constructor
* @param[in] _config dimension configuration. * @param[in] _config dimension configuration.
*/ */
Dimension(const etk::UString& _config) : m_data(0,0),m_type(ewol::Dimension::Pixel) { Set(_config); }; Dimension(const etk::UString& _config) : m_data(0,0),m_type(ewol::Dimension::Pixel) { set(_config); };
/** /**
* @brief Constructor * @brief Constructor
* @param[in] _config dimension configuration. * @param[in] _config dimension configuration.
*/ */
Dimension(const char* _config) : m_data(0,0),m_type(ewol::Dimension::Pixel) { Set(_config); }; Dimension(const char* _config) : m_data(0,0),m_type(ewol::Dimension::Pixel) { set(_config); };
/** /**
* @brief Destructor * @brief Destructor
*/ */
@ -67,65 +67,65 @@ namespace ewol
operator etk::UString(void) const; operator etk::UString(void) const;
/** /**
* @brief Get the current dimention in requested type * @brief get the current dimention in requested type
* @param[in] _type Type of unit requested. * @param[in] _type Type of unit requested.
* @return dimention requested. * @return dimention requested.
*/ */
vec2 Get(ewol::Dimension::distance_te _type) const; vec2 get(ewol::Dimension::distance_te _type) const;
/** /**
* @brief Set the current dimention in requested type * @brief set the current dimention in requested type
* @param[in] _size Dimention to set * @param[in] _size Dimention to set
* @param[in] _type Type of unit requested. * @param[in] _type Type of unit requested.
*/ */
void Set(const vec2& _size, ewol::Dimension::distance_te _type); void set(const vec2& _size, ewol::Dimension::distance_te _type);
private: private:
/** /**
* @brief Set the current dimention in requested type * @brief set the current dimention in requested type
* @param[in] _config dimension configuration. * @param[in] _config dimension configuration.
*/ */
void Set(etk::UString _config); void set(etk::UString _config);
public: public:
/** /**
* @brief Get the current dimention in pixel * @brief get the current dimention in pixel
* @return dimention in Pixel * @return dimention in Pixel
*/ */
vec2 GetPixel(void) const; vec2 getPixel(void) const;
/** /**
* @brief Get the current dimention in Pourcent * @brief get the current dimention in Pourcent
* @return dimention in Pourcent * @return dimention in Pourcent
*/ */
vec2 GetPourcent(void) const; vec2 getPourcent(void) const;
/** /**
* @brief Get the current dimention in Meter * @brief get the current dimention in Meter
* @return dimention in Meter * @return dimention in Meter
*/ */
vec2 GetMeter(void) const; vec2 getMeter(void) const;
/** /**
* @brief Get the current dimention in Centimeter * @brief get the current dimention in Centimeter
* @return dimention in Centimeter * @return dimention in Centimeter
*/ */
vec2 GetCentimeter(void) const; vec2 getCentimeter(void) const;
/** /**
* @brief Get the current dimention in Millimeter * @brief get the current dimention in Millimeter
* @return dimention in Millimeter * @return dimention in Millimeter
*/ */
vec2 GetMillimeter(void) const; vec2 getMillimeter(void) const;
/** /**
* @brief Get the current dimention in Kilometer * @brief get the current dimention in Kilometer
* @return dimention in Kilometer * @return dimention in Kilometer
*/ */
vec2 GetKilometer(void) const; vec2 getKilometer(void) const;
/** /**
* @brief Get the current dimention in Inch * @brief get the current dimention in Inch
* @return dimention in Inch * @return dimention in Inch
*/ */
vec2 GetInch(void) const; vec2 getInch(void) const;
/** /**
* @brief Get the current dimention in Foot * @brief get the current dimention in Foot
* @return dimention in Foot * @return dimention in Foot
*/ */
vec2 GetFoot(void) const; vec2 getFoot(void) const;
/***************************************************** /*****************************************************
* = assigment * = assigment
*****************************************************/ *****************************************************/
@ -139,7 +139,7 @@ namespace ewol
/***************************************************** /*****************************************************
* == operator * == operator
*****************************************************/ *****************************************************/
bool operator== (const Dimension& _obj) const { bool operator == (const Dimension& _obj) const {
if( m_data == _obj.m_data if( m_data == _obj.m_data
&& m_type == _obj.m_type) { && m_type == _obj.m_type) {
return true; return true;
@ -160,7 +160,7 @@ namespace ewol
* @breif get the dimension type * @breif get the dimension type
* @return the type * @return the type
*/ */
ewol::Dimension::distance_te GetType(void) const { return m_type; }; ewol::Dimension::distance_te getType(void) const { return m_type; };
}; };
etk::CCout& operator <<(etk::CCout& _os, const ewol::Dimension::distance_te& _obj); etk::CCout& operator <<(etk::CCout& _os, const ewol::Dimension::distance_te& _obj);
etk::CCout& operator <<(etk::CCout& _os, const ewol::Dimension& _obj); etk::CCout& operator <<(etk::CCout& _os, const ewol::Dimension& _obj);
@ -171,35 +171,35 @@ namespace ewol
/** /**
* @brief basic init * @brief basic init
*/ */
void Init(void); void init(void);
/** /**
* @brief basic un-init * @brief basic un-init
*/ */
void UnInit(void); void unInit(void);
/** /**
* @brief Set the Milimeter ratio for calculation * @brief set the Milimeter ratio for calculation
* @param[in] Ratio Milimeter ration for the screen calculation interpolation * @param[in] Ratio Milimeter ration for the screen calculation interpolation
* @param[in] type Unit type requested. * @param[in] type Unit type requested.
* @note: same as @ref SetPixelPerInch (internal manage convertion) * @note: same as @ref setPixelPerInch (internal manage convertion)
*/ */
void SetPixelRatio(const vec2& _ratio, ewol::Dimension::distance_te _type); void setPixelRatio(const vec2& _ratio, ewol::Dimension::distance_te _type);
/** /**
* @brief Set the current Windows Size * @brief set the current Windows size
* @param[in] size Size of the current windows in pixel. * @param[in] size size of the current windows in pixel.
*/ */
void SetPixelWindowsSize(const vec2& _size); void setPixelWindowsSize(const vec2& _size);
/** /**
* @brief Get the Windows Size in the request unit * @brief get the Windows size in the request unit
* @param[in] type Unit type requested. * @param[in] type Unit type requested.
* @return the requested size * @return the requested size
*/ */
vec2 GetWindowsSize(ewol::Dimension::distance_te _type); vec2 getWindowsSize(ewol::Dimension::distance_te _type);
/** /**
* @brief Get the Windows diagonal size in the request unit * @brief get the Windows diagonal size in the request unit
* @param[in] type Unit type requested. * @param[in] type Unit type requested.
* @return the requested size * @return the requested size
*/ */
float GetWindowsDiag(ewol::Dimension::distance_te _type); float getWindowsDiag(ewol::Dimension::distance_te _type);
}; };
}; };

View File

@ -29,25 +29,25 @@ ewol::Light::~Light(void)
} }
void ewol::Light::Link(ewol::Program* prog, const etk::UString& baseName) void ewol::Light::link(ewol::Program* prog, const etk::UString& baseName)
{ {
if (NULL == prog) { if (NULL == prog) {
return; return;
} }
m_GL_direction = prog->GetUniform(baseName+".direction"); m_GL_direction = prog->getUniform(baseName+".direction");
m_GL_halfplane = prog->GetUniform(baseName+".halfplane"); m_GL_halfplane = prog->getUniform(baseName+".halfplane");
m_GL_ambientColor = prog->GetUniform(baseName+".ambientColor"); m_GL_ambientColor = prog->getUniform(baseName+".ambientColor");
m_GL_diffuseColor = prog->GetUniform(baseName+".diffuseColor"); m_GL_diffuseColor = prog->getUniform(baseName+".diffuseColor");
m_GL_specularColor = prog->GetUniform(baseName+".specularColor"); m_GL_specularColor = prog->getUniform(baseName+".specularColor");
} }
void ewol::Light::Draw(ewol::Program* prog) void ewol::Light::draw(ewol::Program* prog)
{ {
prog->Uniform3(m_GL_direction, m_direction); prog->uniform3(m_GL_direction, m_direction);
prog->Uniform3(m_GL_halfplane, m_halfplane); prog->uniform3(m_GL_halfplane, m_halfplane);
prog->Uniform4(m_GL_ambientColor, m_ambientColor); prog->uniform4(m_GL_ambientColor, m_ambientColor);
prog->Uniform4(m_GL_diffuseColor, m_diffuseColor); prog->uniform4(m_GL_diffuseColor, m_diffuseColor);
prog->Uniform4(m_GL_specularColor, m_specularColor); prog->uniform4(m_GL_specularColor, m_specularColor);
} }
etk::CCout& ewol::operator <<(etk::CCout& _os, const ewol::Light& _obj) etk::CCout& ewol::operator <<(etk::CCout& _os, const ewol::Light& _obj)

View File

@ -35,21 +35,21 @@ namespace ewol
public: public:
Light(void); Light(void);
~Light(void); ~Light(void);
void Link(ewol::Program* prog, const etk::UString& baseName); void link(ewol::Program* prog, const etk::UString& baseName);
void Draw(ewol::Program* prog); void draw(ewol::Program* prog);
void SetDirection(const vec3& val) { void setDirection(const vec3& val) {
m_direction = val; m_direction = val;
} }
void SetHalfPlane(const vec3& val) { void setHalfPlane(const vec3& val) {
m_halfplane = val; m_halfplane = val;
} }
void SetAmbientColor(const vec4& val) { void setAmbientColor(const vec4& val) {
m_ambientColor = val; m_ambientColor = val;
} }
void SetDiffuseColor(const vec4& val) { void setDiffuseColor(const vec4& val) {
m_diffuseColor = val; m_diffuseColor = val;
} }
void SetSpecularColor(const vec4& val) { void setSpecularColor(const vec4& val) {
m_specularColor = val; m_specularColor = val;
} }

View File

@ -21,16 +21,16 @@ ewol::MaterialGlId::MaterialGlId(void) :
} }
void ewol::MaterialGlId::Link(ewol::Program* _prog, const etk::UString& _baseName) void ewol::MaterialGlId::link(ewol::Program* _prog, const etk::UString& _baseName)
{ {
if (NULL == _prog) { if (NULL == _prog) {
return; return;
} }
m_GL_ambientFactor = _prog->GetUniform(_baseName+".ambientFactor"); m_GL_ambientFactor = _prog->getUniform(_baseName+".ambientFactor");
m_GL_diffuseFactor = _prog->GetUniform(_baseName+".diffuseFactor"); m_GL_diffuseFactor = _prog->getUniform(_baseName+".diffuseFactor");
m_GL_specularFactor = _prog->GetUniform(_baseName+".specularFactor"); m_GL_specularFactor = _prog->getUniform(_baseName+".specularFactor");
m_GL_shininess = _prog->GetUniform(_baseName+".shininess"); m_GL_shininess = _prog->getUniform(_baseName+".shininess");
m_GL_texture0 = _prog->GetUniform("EW_texID"); m_GL_texture0 = _prog->getUniform("EW_texID");
} }
ewol::Material::Material(void) : ewol::Material::Material(void) :
@ -45,27 +45,27 @@ ewol::Material::Material(void) :
ewol::Material::~Material(void) ewol::Material::~Material(void)
{ {
if(NULL!=m_texture0) { if(NULL!=m_texture0) {
ewol::TextureFile::Release(m_texture0); ewol::TextureFile::release(m_texture0);
} }
} }
void ewol::Material::Draw(ewol::Program* _prog, const MaterialGlId& _glID) void ewol::Material::draw(ewol::Program* _prog, const MaterialGlId& _glID)
{ {
_prog->Uniform4(_glID.m_GL_ambientFactor, m_ambientFactor); _prog->uniform4(_glID.m_GL_ambientFactor, m_ambientFactor);
_prog->Uniform4(_glID.m_GL_diffuseFactor, m_diffuseFactor); _prog->uniform4(_glID.m_GL_diffuseFactor, m_diffuseFactor);
_prog->Uniform4(_glID.m_GL_specularFactor, m_specularFactor); _prog->uniform4(_glID.m_GL_specularFactor, m_specularFactor);
_prog->Uniform1f(_glID.m_GL_shininess, m_shininess); _prog->uniform1f(_glID.m_GL_shininess, m_shininess);
if (NULL != m_texture0) { if (NULL != m_texture0) {
_prog->SetTexture0(_glID.m_GL_texture0, m_texture0->GetId()); _prog->setTexture0(_glID.m_GL_texture0, m_texture0->getId());
} }
} }
void ewol::Material::SetTexture0(const etk::UString& _filename) void ewol::Material::setTexture0(const etk::UString& _filename)
{ {
ivec2 tmpSize(256, 256); ivec2 tmpSize(256, 256);
// prevent overloard error : // prevent overloard error :
ewol::TextureFile* tmpCopy = m_texture0; ewol::TextureFile* tmpCopy = m_texture0;
m_texture0 = ewol::TextureFile::Keep(_filename, tmpSize); m_texture0 = ewol::TextureFile::keep(_filename, tmpSize);
if (NULL == m_texture0 ) { if (NULL == m_texture0 ) {
EWOL_ERROR("Can not load specific texture : " << _filename); EWOL_ERROR("Can not load specific texture : " << _filename);
// retreave previous texture: // retreave previous texture:
@ -74,7 +74,7 @@ void ewol::Material::SetTexture0(const etk::UString& _filename)
} }
if (NULL != tmpCopy) { 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... // really release previous texture. In case of same texture loading, then we did not have reload it .. just increase and decrease index...
ewol::TextureFile::Release(tmpCopy); ewol::TextureFile::release(tmpCopy);
} }
} }

View File

@ -27,7 +27,7 @@ namespace ewol
int32_t m_GL_shininess; int32_t m_GL_shininess;
int32_t m_GL_texture0; int32_t m_GL_texture0;
MaterialGlId(void); MaterialGlId(void);
void Link(ewol::Program* _prog, const etk::UString& _baseName); void link(ewol::Program* _prog, const etk::UString& _baseName);
}; };
class Material class Material
{ {
@ -43,26 +43,26 @@ namespace ewol
public: public:
Material(void); Material(void);
~Material(void); ~Material(void);
void Draw(ewol::Program* _prog, const MaterialGlId& _glID); void draw(ewol::Program* _prog, const MaterialGlId& _glID);
void SetAmbientFactor(const vec4& _val) { void setAmbientFactor(const vec4& _val) {
m_ambientFactor = _val; m_ambientFactor = _val;
} }
void SetDiffuseFactor(const vec4& _val) { void setDiffuseFactor(const vec4& _val) {
m_diffuseFactor = _val; m_diffuseFactor = _val;
} }
void SetSpecularFactor(const vec4& _val) { void setSpecularFactor(const vec4& _val) {
m_specularFactor = _val; m_specularFactor = _val;
} }
void SetShininess(float _val) { void setShininess(float _val) {
m_shininess = _val; m_shininess = _val;
} }
void SetTexture0(const etk::UString& _filename); void setTexture0(const etk::UString& _filename);
void SetImageSize(const ivec2& _newSize) { if (m_texture0==NULL){return;} m_texture0->SetImageSize(_newSize); }; void setImageSize(const ivec2& _newSize) { if (m_texture0 == NULL){return;} m_texture0->setImageSize(_newSize); };
// get the reference on this image to draw nomething on it ... // get the reference on this image to draw nomething on it ...
egami::Image* Get(void) { if (m_texture0==NULL){return NULL;} return &m_texture0->Get(); }; egami::Image* get(void) { if (m_texture0 == NULL){return NULL;} return &m_texture0->get(); };
// Flush the data to send it at the OpenGl system // flush the data to send it at the openGl system
void Flush(void) { if (m_texture0==NULL){return;} m_texture0->Flush(); }; void flush(void) { if (m_texture0 == NULL){return;} m_texture0->flush(); };
}; };
}; };

View File

@ -44,7 +44,7 @@ static const char* clipboardDescriptionString[ewol::clipBoard::clipboardCount+1]
etk::CCout& ewol::clipBoard::operator <<(etk::CCout& _os, const ewol::clipBoard::clipboardListe_te _obj) etk::CCout& ewol::clipBoard::operator <<(etk::CCout& _os, const ewol::clipBoard::clipboardListe_te _obj)
{ {
if (_obj>=0 && _obj <ewol::clipBoard::clipboardCount) { if (_obj >= 0 && _obj <ewol::clipBoard::clipboardCount) {
_os << clipboardDescriptionString[_obj]; _os << clipboardDescriptionString[_obj];
} else { } else {
_os << "[ERROR]"; _os << "[ERROR]";
@ -53,28 +53,28 @@ etk::CCout& ewol::clipBoard::operator <<(etk::CCout& _os, const ewol::clipBoard:
} }
void ewol::clipBoard::Init(void) void ewol::clipBoard::init(void)
{ {
EWOL_INFO("Initialyse ClipBoards"); EWOL_INFO("Initialyse ClipBoards");
for(int32_t i=0; i<ewol::clipBoard::clipboardCount; i++) { for(int32_t i=0; i<ewol::clipBoard::clipboardCount; i++) {
mesCopy[i].Clear(); mesCopy[i].clear();
} }
} }
void ewol::clipBoard::UnInit(void) void ewol::clipBoard::unInit(void)
{ {
EWOL_INFO("Initialyse ClipBoards"); EWOL_INFO("Initialyse ClipBoards");
for(int32_t i=0; i<ewol::clipBoard::clipboardCount; i++) { for(int32_t i=0; i<ewol::clipBoard::clipboardCount; i++) {
mesCopy[i].Clear(); mesCopy[i].clear();
} }
} }
void ewol::clipBoard::Set(ewol::clipBoard::clipboardListe_te _clipboardID, const etk::UString& _data) void ewol::clipBoard::set(ewol::clipBoard::clipboardListe_te _clipboardID, const etk::UString& _data)
{ {
// check if ID is correct // check if ID is correct
if(0 == _data.Size()) { if(0 == _data.size()) {
EWOL_INFO("request a copy of nothing"); EWOL_INFO("request a copy of nothing");
return; return;
} else } else
@ -84,17 +84,17 @@ void ewol::clipBoard::Set(ewol::clipBoard::clipboardListe_te _clipboardID, const
return; return;
} }
ewol::clipBoard::SetSystem(_clipboardID, _data); ewol::clipBoard::setSystem(_clipboardID, _data);
if( ewol::clipBoard::clipboardStd == _clipboardID if( ewol::clipBoard::clipboardStd == _clipboardID
|| ewol::clipBoard::clipboardSelection == _clipboardID) { || ewol::clipBoard::clipboardSelection == _clipboardID) {
ewol::GetContext().ClipBoardSet(_clipboardID); ewol::getContext().clipBoardSet(_clipboardID);
EWOL_TODO("Set ClipBoard"); EWOL_TODO("Set ClipBoard");
} }
} }
void ewol::clipBoard::Request(ewol::clipBoard::clipboardListe_te _clipboardID) void ewol::clipBoard::request(ewol::clipBoard::clipboardListe_te _clipboardID)
{ {
if(_clipboardID >= ewol::clipBoard::clipboardCount) { if(_clipboardID >= ewol::clipBoard::clipboardCount) {
EWOL_WARNING("request ClickBoard id error"); EWOL_WARNING("request ClickBoard id error");
@ -103,17 +103,17 @@ void ewol::clipBoard::Request(ewol::clipBoard::clipboardListe_te _clipboardID)
if( ewol::clipBoard::clipboardStd == _clipboardID if( ewol::clipBoard::clipboardStd == _clipboardID
|| ewol::clipBoard::clipboardSelection == _clipboardID) { || ewol::clipBoard::clipboardSelection == _clipboardID) {
ewol::GetContext().ClipBoardGet(_clipboardID); ewol::getContext().clipBoardGet(_clipboardID);
EWOL_TODO("Get ClipBoard"); EWOL_TODO("Get ClipBoard");
} else { } else {
// generate an event on the main thread ... // generate an event on the main thread ...
ewol::GetContext().OS_ClipBoardArrive(_clipboardID); ewol::getContext().OS_ClipBoardArrive(_clipboardID);
EWOL_TODO("ClipBoard arrive"); EWOL_TODO("ClipBoard arrive");
} }
} }
void ewol::clipBoard::SetSystem(ewol::clipBoard::clipboardListe_te _clipboardID, const etk::UString& _data) void ewol::clipBoard::setSystem(ewol::clipBoard::clipboardListe_te _clipboardID, const etk::UString& _data)
{ {
if(_clipboardID >= ewol::clipBoard::clipboardCount) { if(_clipboardID >= ewol::clipBoard::clipboardCount) {
EWOL_WARNING("request ClickBoard id error"); EWOL_WARNING("request ClickBoard id error");
@ -124,7 +124,7 @@ void ewol::clipBoard::SetSystem(ewol::clipBoard::clipboardListe_te _clipboardID,
} }
const etk::UString& ewol::clipBoard::Get(ewol::clipBoard::clipboardListe_te _clipboardID) const etk::UString& ewol::clipBoard::get(ewol::clipBoard::clipboardListe_te _clipboardID)
{ {
static const etk::UString emptyString(""); static const etk::UString emptyString("");
if(_clipboardID >= ewol::clipBoard::clipboardCount) { if(_clipboardID >= ewol::clipBoard::clipboardCount) {

View File

@ -17,16 +17,16 @@ namespace ewol {
namespace clipBoard namespace clipBoard
{ {
typedef enum { typedef enum {
clipboard0, //!< Internal clipboard 0 clipboard0, //!< internal clipboard 0
clipboard1, //!< Internal clipboard 1 clipboard1, //!< internal clipboard 1
clipboard2, //!< Internal clipboard 2 clipboard2, //!< internal clipboard 2
clipboard3, //!< Internal clipboard 3 clipboard3, //!< internal clipboard 3
clipboard4, //!< Internal clipboard 4 clipboard4, //!< internal clipboard 4
clipboard5, //!< Internal clipboard 5 clipboard5, //!< internal clipboard 5
clipboard6, //!< Internal clipboard 6 clipboard6, //!< internal clipboard 6
clipboard7, //!< Internal clipboard 7 clipboard7, //!< internal clipboard 7
clipboard8, //!< Internal clipboard 8 clipboard8, //!< internal clipboard 8
clipboard9, //!< Internal clipboard 9 clipboard9, //!< internal clipboard 9
clipboardStd, //!< External clipboard represent the Copy/Cut/Past buffer clipboardStd, //!< External clipboard represent the Copy/Cut/Past buffer
clipboardSelection, //!< External or internal clipboard depending on the OS, represent the middle button clipboardSelection, //!< External or internal clipboard depending on the OS, represent the middle button
clipboardCount, //!< Total number of clipboard clipboardCount, //!< Total number of clipboard
@ -38,11 +38,11 @@ namespace ewol {
etk::CCout& operator <<(etk::CCout& _os, const ewol::clipBoard::clipboardListe_te _obj); etk::CCout& operator <<(etk::CCout& _os, const ewol::clipBoard::clipboardListe_te _obj);
/** /**
* @brief Set the string data on a specific clipboard. The Gui system is notify that the clipboard "SELECTION" and "COPY" are change * @brief set the string data on a specific clipboard. The Gui system is notify that the clipboard "SELECTION" and "COPY" are change
* @param[in] _clipboardID Select the specific ID of the clipboard * @param[in] _clipboardID Select the specific ID of the clipboard
* @param[in] _data The string that might be send to the clipboard * @param[in] _data The string that might be send to the clipboard
*/ */
void Set(ewol::clipBoard::clipboardListe_te _clipboardID, const etk::UString& _data); void set(ewol::clipBoard::clipboardListe_te _clipboardID, const etk::UString& _data);
/** /**
* @brief Call system to request the current clipboard. * @brief Call system to request the current clipboard.
* @note Due to some system that manage the clipboard request asynchronous (like X11) and ewol managing the system with only one thread, * @note Due to some system that manage the clipboard request asynchronous (like X11) and ewol managing the system with only one thread,
@ -50,33 +50,33 @@ namespace ewol {
* notification of the arrival of this buffer id * notification of the arrival of this buffer id
* @param[in] _clipboardID the needed clipboard ID * @param[in] _clipboardID the needed clipboard ID
*/ */
void Request(ewol::clipBoard::clipboardListe_te _clipboardID); void request(ewol::clipBoard::clipboardListe_te _clipboardID);
/** /**
* @brief Set the ewol internal buffer (no notification at the GUI). This fuction might be use by the * @brief set the ewol internal buffer (no notification at the GUI). This fuction might be use by the
* Gui abstraction to set the buffer we receive. The end user must not use it. * Gui abstraction to set the buffer we receive. The end user must not use it.
* @param[in] _clipboardID selected clipboard ID * @param[in] _clipboardID selected clipboard ID
* @param[in] _data new buffer data * @param[in] _data new buffer data
*/ */
void SetSystem(ewol::clipBoard::clipboardListe_te _clipboardID,const etk::UString& _data); void setSystem(ewol::clipBoard::clipboardListe_te _clipboardID,const etk::UString& _data);
/** /**
* @brief Get the ewol internal buffer of the curent clipboard. The end user can use it when he receive the event in * @brief get the ewol internal buffer of the curent clipboard. The end user can use it when he receive the event in
* the widget : @ref OnEventClipboard ==> we can nothe this function is the only one which permit it. * the widget : @ref onEventClipboard == > we can nothe this function is the only one which permit it.
* @note if we call this fuction withoutcallin @ref ewol::clipBoard::Request, we only get the previous clipboard * @note if we call this fuction withoutcallin @ref ewol::clipBoard::Request, we only get the previous clipboard
* @param[in] _clipboardID selected clipboard ID * @param[in] _clipboardID selected clipboard ID
* @return the requested buffer * @return the requested buffer
*/ */
const etk::UString& Get(ewol::clipBoard::clipboardListe_te _clipboardID); const etk::UString& get(ewol::clipBoard::clipboardListe_te _clipboardID);
// internal section // internal section
/** /**
* @brief Initialize the clipboard system (done by ewol) * @brief initialize the clipboard system (done by ewol)
*/ */
void Init(void); void init(void);
/** /**
* @brief Un-Initialize the clipboard system (done by ewol) * @brief Un-Initialize the clipboard system (done by ewol)
*/ */
void UnInit(void); void unInit(void);
}; };
}; };

View File

@ -10,37 +10,37 @@
#include <ewol/commandLine.h> #include <ewol/commandLine.h>
#include <etk/Vector.h> #include <etk/Vector.h>
void ewol::CommandLine::Parse(int32_t _argc, const char* _argv[]) void ewol::CommandLine::parse(int32_t _argc, const char* _argv[])
{ {
for( int32_t i=1 ; i<_argc; i++) { for( int32_t i=1 ; i<_argc; i++) {
EWOL_INFO("commandLine : \"" << _argv[i] << "\"" ); EWOL_INFO("commandLine : \"" << _argv[i] << "\"" );
m_listArgs.PushBack(_argv[i]); m_listArgs.pushBack(_argv[i]);
} }
} }
esize_t ewol::CommandLine::Size(void) esize_t ewol::CommandLine::size(void)
{ {
return m_listArgs.Size(); return m_listArgs.size();
} }
const etk::UString& ewol::CommandLine::Get(int32_t _id) const etk::UString& ewol::CommandLine::get(int32_t _id)
{ {
static const etk::UString errorArg(""); static const etk::UString errorArg("");
if (_id<0 && _id>=m_listArgs.Size()) { if (_id<0 && _id >= m_listArgs.size()) {
return errorArg; return errorArg;
} }
return m_listArgs[_id]; return m_listArgs[_id];
} }
void ewol::CommandLine::Add(const etk::UString& _newElement) void ewol::CommandLine::add(const etk::UString& _newElement)
{ {
m_listArgs.PushBack(_newElement); m_listArgs.pushBack(_newElement);
} }
void ewol::CommandLine::Remove(esize_t _id) void ewol::CommandLine::remove(esize_t _id)
{ {
m_listArgs.Remove(_id); m_listArgs.remove(_id);
} }

View File

@ -22,27 +22,27 @@ namespace ewol
/** /**
* @brief Parse the command line parameters * @brief Parse the command line parameters
*/ */
void Parse(int32_t _argc, const char* _argv[]); void parse(int32_t _argc, const char* _argv[]);
/** /**
* @brief Get the number of element in the Command Line * @brief get the number of element in the Command line
* @return the number of element * @return the number of element
*/ */
esize_t Size(void); esize_t size(void);
/** /**
* @brief Get an element with a specific ID * @brief get an element with a specific ID
* @return _id The cmdLine Id element * @return _id The cmdLine Id element
*/ */
const etk::UString& Get(int32_t _id); const etk::UString& get(int32_t _id);
/** /**
* @brief Add one element at the Command Line * @brief add one element at the Command line
* @param[in] _newElement String in the input that might be added. * @param[in] _newElement String in the input that might be added.
*/ */
void Add(const etk::UString& _newElement); void add(const etk::UString& _newElement);
/** /**
* @brief Remove an element * @brief remove an element
* @param[in] _id Id of the element * @param[in] _id Id of the element
*/ */
void Remove(esize_t _id); void remove(esize_t _id);
}; };
}; };

View File

@ -23,35 +23,35 @@ ewol::Area::Area(const ivec2& _size) :
m_GLtexID(-1), m_GLtexID(-1),
m_resource(NULL) m_resource(NULL)
{ {
m_resource = ewol::Texture::Keep(); m_resource = ewol::Texture::keep();
m_resource->SetImageSize(_size); m_resource->setImageSize(_size);
m_resource->Flush(); m_resource->flush();
LoadProgram(); loadProgram();
} }
ewol::Area::~Area(void) ewol::Area::~Area(void)
{ {
ewol::Texture::Release(m_resource); ewol::Texture::release(m_resource);
ewol::Program::Release(m_GLprogram); ewol::Program::release(m_GLprogram);
} }
void ewol::Area::LoadProgram(void) void ewol::Area::loadProgram(void)
{ {
// get the shader resource : // get the shader resource :
m_GLPosition = 0; m_GLPosition = 0;
m_GLprogram = ewol::Program::Keep("DATA:textured3D.prog"); m_GLprogram = ewol::Program::keep("DATA:textured3D.prog");
if (NULL != m_GLprogram) { if (NULL != m_GLprogram) {
m_GLPosition = m_GLprogram->GetAttribute("EW_coord3d"); m_GLPosition = m_GLprogram->getAttribute("EW_coord3d");
m_GLColor = m_GLprogram->GetAttribute("EW_color"); m_GLColor = m_GLprogram->getAttribute("EW_color");
m_GLtexture = m_GLprogram->GetAttribute("EW_texture2d"); m_GLtexture = m_GLprogram->getAttribute("EW_texture2d");
m_GLMatrix = m_GLprogram->GetUniform("EW_MatrixTransformation"); m_GLMatrix = m_GLprogram->getUniform("EW_MatrixTransformation");
m_GLtexID = m_GLprogram->GetUniform("EW_texID"); m_GLtexID = m_GLprogram->getUniform("EW_texID");
} }
} }
void ewol::Area::Draw(bool _disableDepthTest) void ewol::Area::draw(bool _disableDepthTest)
{ {
if (m_coord.Size()<=0) { if (m_coord.size() <= 0) {
//EWOL_WARNING("Nothink to draw..."); //EWOL_WARNING("Nothink to draw...");
return; return;
} }
@ -59,83 +59,83 @@ void ewol::Area::Draw(bool _disableDepthTest)
// this is a normale case ... the user can choice to have no image ... // this is a normale case ... the user can choice to have no image ...
return; return;
} }
if (m_GLprogram==NULL) { if (m_GLprogram == NULL) {
EWOL_ERROR("No shader ..."); EWOL_ERROR("No shader ...");
return; return;
} }
// set Matrix : translation/positionMatrix // set Matrix : translation/positionMatrix
mat4 tmpMatrix = ewol::openGL::GetMatrix()*m_matrixApply; mat4 tmpMatrix = ewol::openGL::getMatrix()*m_matrixApply;
m_GLprogram->Use(); m_GLprogram->use();
m_GLprogram->UniformMatrix4fv(m_GLMatrix, 1, tmpMatrix.m_mat); m_GLprogram->uniformMatrix4fv(m_GLMatrix, 1, tmpMatrix.m_mat);
// TextureID // TextureID
m_GLprogram->SetTexture0(m_GLtexID, m_resource->GetId()); m_GLprogram->setTexture0(m_GLtexID, m_resource->getId());
// position : // position :
m_GLprogram->SendAttribute(m_GLPosition, 3/*x,y,z,unused*/, &m_coord[0], 4*sizeof(btScalar)); m_GLprogram->sendAttribute(m_GLPosition, 3/*x,y,z,unused*/, &m_coord[0], 4*sizeof(btScalar));
// Texture : // Texture :
m_GLprogram->SendAttribute(m_GLtexture, 2/*u,v*/, &m_coordTex[0]); m_GLprogram->sendAttribute(m_GLtexture, 2/*u,v*/, &m_coordTex[0]);
// color : // color :
m_GLprogram->SendAttribute(m_GLColor, 4/*r,g,b,a*/, &m_coordColor[0]); m_GLprogram->sendAttribute(m_GLColor, 4/*r,g,b,a*/, &m_coordColor[0]);
// Request the draw od the elements : // Request the draw od the elements :
ewol::openGL::DrawArrays(GL_TRIANGLES, 0, m_coord.Size()); ewol::openGL::drawArrays(GL_TRIANGLES, 0, m_coord.size());
m_GLprogram->UnUse(); m_GLprogram->unUse();
} }
void ewol::Area::Clear(void) void ewol::Area::clear(void)
{ {
// call upper class // call upper class
ewol::Compositing::Clear(); ewol::Compositing::clear();
// Reset Buffer : // reset Buffer :
m_coord.Clear(); m_coord.clear();
m_coordTex.Clear(); m_coordTex.clear();
m_coordColor.Clear(); m_coordColor.clear();
// Reset temporal variables : // reset temporal variables :
m_position = vec3(0.0, 0.0, 0.0); m_position = vec3(0.0, 0.0, 0.0);
} }
void ewol::Area::Print(const ivec2& _size) void ewol::Area::print(const ivec2& _size)
{ {
vec3 point(0,0,0); vec3 point(0,0,0);
vec2 tex(0,1); vec2 tex(0,1);
point.setX(m_position.x()); point.setX(m_position.x());
point.setY(m_position.y()); point.setY(m_position.y());
m_coord.PushBack(point); m_coord.pushBack(point);
m_coordTex.PushBack(tex); m_coordTex.pushBack(tex);
m_coordColor.PushBack(m_color); m_coordColor.pushBack(m_color);
tex.setValue(1,1); tex.setValue(1,1);
point.setX(m_position.x() + _size.x()); point.setX(m_position.x() + _size.x());
point.setY(m_position.y()); point.setY(m_position.y());
m_coord.PushBack(point); m_coord.pushBack(point);
m_coordTex.PushBack(tex); m_coordTex.pushBack(tex);
m_coordColor.PushBack(m_color); m_coordColor.pushBack(m_color);
tex.setValue(1,0); tex.setValue(1,0);
point.setX(m_position.x() + _size.x()); point.setX(m_position.x() + _size.x());
point.setY(m_position.y() + _size.y()); point.setY(m_position.y() + _size.y());
m_coord.PushBack(point); m_coord.pushBack(point);
m_coordTex.PushBack(tex); m_coordTex.pushBack(tex);
m_coordColor.PushBack(m_color); m_coordColor.pushBack(m_color);
m_coord.PushBack(point); m_coord.pushBack(point);
m_coordTex.PushBack(tex); m_coordTex.pushBack(tex);
m_coordColor.PushBack(m_color); m_coordColor.pushBack(m_color);
tex.setValue(0,0); tex.setValue(0,0);
point.setX(m_position.x()); point.setX(m_position.x());
point.setY(m_position.y() + _size.y()); point.setY(m_position.y() + _size.y());
m_coord.PushBack(point); m_coord.pushBack(point);
m_coordTex.PushBack(tex); m_coordTex.pushBack(tex);
m_coordColor.PushBack(m_color); m_coordColor.pushBack(m_color);
tex.setValue(0,1); tex.setValue(0,1);
point.setX(m_position.x()); point.setX(m_position.x());
point.setY(m_position.y()); point.setY(m_position.y());
m_coord.PushBack(point); m_coord.pushBack(point);
m_coordTex.PushBack(tex); m_coordTex.pushBack(tex);
m_coordColor.PushBack(m_color); m_coordColor.pushBack(m_color);
} }

View File

@ -34,9 +34,9 @@ namespace ewol
etk::Vector<etk::Color<float> > m_coordColor; //!< internal color of the different point etk::Vector<etk::Color<float> > m_coordColor; //!< internal color of the different point
private: private:
/** /**
* @brief Load the openGL program and get all the ID needed * @brief load the openGL program and get all the ID needed
*/ */
void LoadProgram(void); void loadProgram(void);
public: public:
/** /**
* @brief generic constructor * @brief generic constructor
@ -49,38 +49,38 @@ namespace ewol
~Area(void); ~Area(void);
public: public:
/** /**
* @brief Draw All the refistered text in the current element on openGL * @brief draw All the refistered text in the current element on openGL
*/ */
void Draw(bool _disableDepthTest=true); void draw(bool _disableDepthTest=true);
/** /**
* @brief Clear alll the registered element in the current element * @brief clear alll the registered element in the current element
*/ */
void Clear(void); void clear(void);
/** /**
* @brief Get the current display position (sometime needed in the gui control) * @brief get the current display position (sometime needed in the gui control)
* @return the current position. * @return the current position.
*/ */
const vec3& GetPos(void) { return m_position; }; const vec3& getPos(void) { return m_position; };
/** /**
* @brief Set position for the next text writen * @brief set position for the next text writen
* @param[in] _pos Position of the text (in 3D) * @param[in] _pos Position of the text (in 3D)
*/ */
void SetPos(const vec3& _pos) { m_position = _pos; }; void setPos(const vec3& _pos) { m_position = _pos; };
inline void SetPos(const vec2& _pos) { SetPos(vec3(_pos.x(),_pos.y(),0)); }; inline void setPos(const vec2& _pos) { setPos(vec3(_pos.x(),_pos.y(),0)); };
/** /**
* @brief Set relative position for the next text writen * @brief set relative position for the next text writen
* @param[in] _pos ofset apply of the text (in 3D) * @param[in] _pos ofset apply of the text (in 3D)
*/ */
void SetRelPos(const vec3& _pos) { m_position += _pos; }; void setRelPos(const vec3& _pos) { m_position += _pos; };
inline void SetRelPos(const vec2& _pos) { SetRelPos(vec3(_pos.x(),_pos.y(),0)); }; inline void setRelPos(const vec2& _pos) { setRelPos(vec3(_pos.x(),_pos.y(),0)); };
/** /**
* @brief Add a compleate of the image to display with the requested size * @brief add a compleate of the image to display with the requested size
* @param[in] _size Size of the output image * @param[in] _size size of the output image
*/ */
void Print(const ivec2& _size); void print(const ivec2& _size);
egami::Image& Get(void) { return m_resource->Get(); }; egami::Image& get(void) { return m_resource->get(); };
void Flush(void) { m_resource->Flush(); }; void flush(void) { m_resource->flush(); };
}; };
}; };

View File

@ -25,37 +25,37 @@ ewol::Compositing::~Compositing(void)
} }
void ewol::Compositing::ResetMatrix(void) void ewol::Compositing::resetMatrix(void)
{ {
m_matrixApply.Identity(); m_matrixApply.identity();
} }
void ewol::Compositing::Translate(const vec3& _vect) void ewol::Compositing::translate(const vec3& _vect)
{ {
m_matrixApply *= etk::matTranslate(_vect); m_matrixApply *= etk::matTranslate(_vect);
} }
void ewol::Compositing::Rotate(const vec3& _vect, float _angle) void ewol::Compositing::rotate(const vec3& _vect, float _angle)
{ {
m_matrixApply *= etk::matRotate(_vect, _angle); m_matrixApply *= etk::matRotate(_vect, _angle);
} }
void ewol::Compositing::Scale(const vec3& _vect) void ewol::Compositing::scale(const vec3& _vect)
{ {
m_matrixApply *= etk::matScale(_vect); m_matrixApply *= etk::matScale(_vect);
} }
void ewol::Compositing::Clear(void) void ewol::Compositing::clear(void)
{ {
m_matrixApply.Identity(); m_matrixApply.identity();
} }
void ewol::Compositing::SetMatrix(const mat4& _mat) void ewol::Compositing::setMatrix(const mat4& _mat)
{ {
m_matrixApply = _mat; m_matrixApply = _mat;
} }

View File

@ -31,35 +31,35 @@ namespace ewol
/** /**
* @brief Virtal pure function that request the draw of all openGl elements * @brief Virtal pure function that request the draw of all openGl elements
*/ */
virtual void Draw(bool _disableDepthTest=true)=0; virtual void draw(bool _disableDepthTest=true)=0;
/** /**
* @brief Clear alll tre registered element in the current element * @brief clear alll tre registered element in the current element
*/ */
virtual void Clear(void); virtual void clear(void);
/** /**
* @brief Reset to the eye matrix the openGL mouving system * @brief reset to the eye matrix the openGL mouving system
*/ */
virtual void ResetMatrix(void); virtual void resetMatrix(void);
/** /**
* @brief Translate the current display of this element * @brief translate the current display of this element
* @param[in] _vect The translation vector to apply at the transformation matrix * @param[in] _vect The translation vector to apply at the transformation matrix
*/ */
virtual void Translate(const vec3& _vect); virtual void translate(const vec3& _vect);
/** /**
* @brief Rotate the curent display of this element * @brief rotate the curent display of this element
* @param[in] _vect The rotation vector to apply at the transformation matrix * @param[in] _vect The rotation vector to apply at the transformation matrix
*/ */
virtual void Rotate(const vec3& _vect, float _angle); virtual void rotate(const vec3& _vect, float _angle);
/** /**
* @brief Scale the current diaplsy of this element * @brief scale the current diaplsy of this element
* @param[in] _vect The scaling vector to apply at the transformation matrix * @param[in] _vect The scaling vector to apply at the transformation matrix
*/ */
virtual void Scale(const vec3& _vect); virtual void scale(const vec3& _vect);
/** /**
* @brief set the transformation matrix * @brief set the transformation matrix
* @param[in] _mat The new matrix. * @param[in] _mat The new matrix.
*/ */
virtual void SetMatrix(const mat4& _mat); virtual void setMatrix(const mat4& _mat);
}; };
}; };

View File

@ -14,62 +14,62 @@
static void generatePolyGone(etk::Vector<vec2 > & input, etk::Vector<vec2 > & output ) static void generatePolyGone(etk::Vector<vec2 > & input, etk::Vector<vec2 > & output )
{ {
if (input.Size()<3) { if (input.size()<3) {
return; return;
} }
// TODO : Regenerate a linear poligone generation // TODO : Regenerate a linear poligone generation
for (int32_t iii=1; iii<input.Size()-1; iii++) { for (int32_t iii=1; iii<input.size()-1; iii++) {
output.PushBack(input[0]); output.pushBack(input[0]);
output.PushBack(input[iii]); output.pushBack(input[iii]);
output.PushBack(input[iii+1]); output.pushBack(input[iii+1]);
} }
//EWOL_DEBUG("generate Plygone : " << input.Size() << " ==> " << output.Size() ); //EWOL_DEBUG("generate Plygone : " << input.size() << " == > " << output.size() );
} }
static void SutherlandHodgman(etk::Vector<vec2 > & input, etk::Vector<vec2 > & output, float sx, float sy, float ex, float ey) static void SutherlandHodgman(etk::Vector<vec2 > & input, etk::Vector<vec2 > & output, float sx, float sy, float ex, float ey)
{ {
// with Sutherland-Hodgman-Algorithm // with Sutherland-Hodgman-Algorithm
if (input.Size() <0) { if (input.size() <0) {
return; return;
} }
//int32_t sizeInit=input.Size(); //int32_t sizeInit=input.size();
// last element : // last element :
vec2 destPoint; vec2 destPoint;
vec2 lastElement = input[input.Size()-1]; vec2 lastElement = input[input.size()-1];
bool inside = true; bool inside = true;
if (lastElement.x < sx) { if (lastElement.x < sx) {
inside = false; inside = false;
} }
//EWOL_DEBUG("generate an crop : "); //EWOL_DEBUG("generate an crop : ");
for(int32_t iii=0; iii<input.Size(); iii++) { for(int32_t iii=0; iii<input.size(); iii++) {
if(input[iii].x < sx) { if(input[iii].x < sx) {
if(true == inside) { if(true == inside) {
//EWOL_DEBUG("element IN ==> OUT "); //EWOL_DEBUG("element IN == > OUT ");
//new point intersection ... //new point intersection ...
//y=aaax+bbb //y=aaax+bbb
float aaa = (lastElement.y-input[iii].y) / (lastElement.x-input[iii].x); float aaa = (lastElement.y-input[iii].y) / (lastElement.x-input[iii].x);
float bbb = lastElement.y - (aaa*lastElement.x); float bbb = lastElement.y - (aaa*lastElement.x);
destPoint.y = aaa*sx + bbb; destPoint.y = aaa*sx + bbb;
destPoint.x = sx; destPoint.x = sx;
output.PushBack(destPoint); output.pushBack(destPoint);
} else { } else {
//EWOL_DEBUG("element OUT ==> OUT "); //EWOL_DEBUG("element OUT == > OUT ");
} }
inside = false; inside = false;
} else { } else {
if(true == inside) { if(true == inside) {
//EWOL_DEBUG("element IN ==> IN "); //EWOL_DEBUG("element IN == > IN ");
output.PushBack(input[iii]); output.pushBack(input[iii]);
} else { } else {
//EWOL_DEBUG("element OUT ==> IN "); //EWOL_DEBUG("element OUT == > IN ");
//new point intersection ... //new point intersection ...
//y=aaax+bbb //y=aaax+bbb
float aaa = (lastElement.y-input[iii].y) / (lastElement.x-input[iii].x); float aaa = (lastElement.y-input[iii].y) / (lastElement.x-input[iii].x);
float bbb = lastElement.y - (aaa*lastElement.x); float bbb = lastElement.y - (aaa*lastElement.x);
destPoint.y = aaa*sx + bbb; destPoint.y = aaa*sx + bbb;
destPoint.x = sx; destPoint.x = sx;
output.PushBack(destPoint); output.pushBack(destPoint);
output.PushBack(input[iii]); output.pushBack(input[iii]);
} }
inside = true; inside = true;
} }
@ -78,43 +78,43 @@ static void SutherlandHodgman(etk::Vector<vec2 > & input, etk::Vector<vec2 > & o
lastElement.y = input[iii].y; lastElement.y = input[iii].y;
} }
//EWOL_DEBUG("generate an crop on element : " << sizeInit << " ==> " << output.Size() << "intermediate (1)"); //EWOL_DEBUG("generate an crop on element : " << sizeInit << " == > " << output.size() << "intermediate (1)");
input = output; input = output;
output.Clear(); output.clear();
lastElement = input[input.Size()-1]; lastElement = input[input.size()-1];
inside = true; inside = true;
if (lastElement.y < sy) { if (lastElement.y < sy) {
inside = false; inside = false;
} }
for(int32_t iii=0; iii<input.Size(); iii++) { for(int32_t iii=0; iii<input.size(); iii++) {
if(input[iii].y < sy) { if(input[iii].y < sy) {
if(true == inside) { if(true == inside) {
//EWOL_DEBUG("element IN ==> OUT "); //EWOL_DEBUG("element IN == > OUT ");
//new point intersection ... //new point intersection ...
//x=aaay+bbb //x=aaay+bbb
float aaa = (lastElement.x-input[iii].x) / (lastElement.y-input[iii].y); float aaa = (lastElement.x-input[iii].x) / (lastElement.y-input[iii].y);
float bbb = lastElement.x - (aaa*lastElement.y); float bbb = lastElement.x - (aaa*lastElement.y);
destPoint.y = sy; destPoint.y = sy;
destPoint.x = sy*aaa + bbb; destPoint.x = sy*aaa + bbb;
output.PushBack(destPoint); output.pushBack(destPoint);
} else { } else {
//EWOL_DEBUG("element OUT ==> OUT "); //EWOL_DEBUG("element OUT == > OUT ");
} }
inside = false; inside = false;
} else { } else {
if(true == inside) { if(true == inside) {
//EWOL_DEBUG("element IN ==> IN "); //EWOL_DEBUG("element IN == > IN ");
output.PushBack(input[iii]); output.pushBack(input[iii]);
} else { } else {
//EWOL_DEBUG("element OUT ==> IN "); //EWOL_DEBUG("element OUT == > IN ");
//new point intersection ... //new point intersection ...
//y=aaax+bbb //y=aaax+bbb
float aaa = (lastElement.x-input[iii].x) / (lastElement.y-input[iii].y); float aaa = (lastElement.x-input[iii].x) / (lastElement.y-input[iii].y);
float bbb = lastElement.x - (aaa*lastElement.y); float bbb = lastElement.x - (aaa*lastElement.y);
destPoint.y = sy; destPoint.y = sy;
destPoint.x = sy*aaa + bbb; destPoint.x = sy*aaa + bbb;
output.PushBack(destPoint); output.pushBack(destPoint);
output.PushBack(input[iii]); output.pushBack(input[iii]);
} }
inside = true; inside = true;
} }
@ -124,42 +124,42 @@ static void SutherlandHodgman(etk::Vector<vec2 > & input, etk::Vector<vec2 > & o
} }
input = output; input = output;
output.Clear(); output.clear();
lastElement = input[input.Size()-1]; lastElement = input[input.size()-1];
inside = true; inside = true;
if (lastElement.x > ex) { if (lastElement.x > ex) {
inside = false; inside = false;
} }
//EWOL_DEBUG("generate an crop : "); //EWOL_DEBUG("generate an crop : ");
for(int32_t iii=0; iii<input.Size(); iii++) { for(int32_t iii=0; iii<input.size(); iii++) {
if(input[iii].x > ex) { if(input[iii].x > ex) {
if(true == inside) { if(true == inside) {
//EWOL_DEBUG("element IN ==> OUT "); //EWOL_DEBUG("element IN == > OUT ");
//new point intersection ... //new point intersection ...
//y=aaax+bbb //y=aaax+bbb
float aaa = (lastElement.y-input[iii].y) / (lastElement.x-input[iii].x); float aaa = (lastElement.y-input[iii].y) / (lastElement.x-input[iii].x);
float bbb = lastElement.y - (aaa*lastElement.x); float bbb = lastElement.y - (aaa*lastElement.x);
destPoint.y = aaa*ex + bbb; destPoint.y = aaa*ex + bbb;
destPoint.x = ex; destPoint.x = ex;
output.PushBack(destPoint); output.pushBack(destPoint);
} else { } else {
//EWOL_DEBUG("element OUT ==> OUT "); //EWOL_DEBUG("element OUT == > OUT ");
} }
inside = false; inside = false;
} else { } else {
if(true == inside) { if(true == inside) {
//EWOL_DEBUG("element IN ==> IN "); //EWOL_DEBUG("element IN == > IN ");
output.PushBack(input[iii]); output.pushBack(input[iii]);
} else { } else {
//EWOL_DEBUG("element OUT ==> IN "); //EWOL_DEBUG("element OUT == > IN ");
//new point intersection ... //new point intersection ...
//y=aaax+bbb //y=aaax+bbb
float aaa = (lastElement.y-input[iii].y) / (lastElement.x-input[iii].x); float aaa = (lastElement.y-input[iii].y) / (lastElement.x-input[iii].x);
float bbb = lastElement.y - (aaa*lastElement.x); float bbb = lastElement.y - (aaa*lastElement.x);
destPoint.y = aaa*ex + bbb; destPoint.y = aaa*ex + bbb;
destPoint.x = ex; destPoint.x = ex;
output.PushBack(destPoint); output.pushBack(destPoint);
output.PushBack(input[iii]); output.pushBack(input[iii]);
} }
inside = true; inside = true;
} }
@ -169,41 +169,41 @@ static void SutherlandHodgman(etk::Vector<vec2 > & input, etk::Vector<vec2 > & o
} }
input = output; input = output;
output.Clear(); output.clear();
lastElement = input[input.Size()-1]; lastElement = input[input.size()-1];
inside = true; inside = true;
if (lastElement.y > ey) { if (lastElement.y > ey) {
inside = false; inside = false;
} }
for(int32_t iii=0; iii<input.Size(); iii++) { for(int32_t iii=0; iii<input.size(); iii++) {
if(input[iii].y > ey) { if(input[iii].y > ey) {
if(true == inside) { if(true == inside) {
//EWOL_DEBUG("element IN ==> OUT "); //EWOL_DEBUG("element IN == > OUT ");
//new point intersection ... //new point intersection ...
//x=aaay+bbb //x=aaay+bbb
float aaa = (lastElement.x-input[iii].x) / (lastElement.y-input[iii].y); float aaa = (lastElement.x-input[iii].x) / (lastElement.y-input[iii].y);
float bbb = lastElement.x - (aaa*lastElement.y); float bbb = lastElement.x - (aaa*lastElement.y);
destPoint.y = ey; destPoint.y = ey;
destPoint.x = ey*aaa + bbb; destPoint.x = ey*aaa + bbb;
output.PushBack(destPoint); output.pushBack(destPoint);
} else { } else {
//EWOL_DEBUG("element OUT ==> OUT "); //EWOL_DEBUG("element OUT == > OUT ");
} }
inside = false; inside = false;
} else { } else {
if(true == inside) { if(true == inside) {
//EWOL_DEBUG("element IN ==> IN "); //EWOL_DEBUG("element IN == > IN ");
output.PushBack(input[iii]); output.pushBack(input[iii]);
} else { } else {
//EWOL_DEBUG("element OUT ==> IN "); //EWOL_DEBUG("element OUT == > IN ");
//new point intersection ... //new point intersection ...
//y=aaax+bbb //y=aaax+bbb
float aaa = (lastElement.x-input[iii].x) / (lastElement.y-input[iii].y); float aaa = (lastElement.x-input[iii].x) / (lastElement.y-input[iii].y);
float bbb = lastElement.x - (aaa*lastElement.y); float bbb = lastElement.x - (aaa*lastElement.y);
destPoint.y = ey; destPoint.y = ey;
destPoint.x = ey*aaa + bbb; destPoint.x = ey*aaa + bbb;
output.PushBack(destPoint); output.pushBack(destPoint);
output.PushBack(input[iii]); output.pushBack(input[iii]);
} }
inside = true; inside = true;
} }
@ -213,7 +213,7 @@ static void SutherlandHodgman(etk::Vector<vec2 > & input, etk::Vector<vec2 > & o
} }
//EWOL_DEBUG("generate an crop on element : " << sizeInit << " ==> " << output.Size() ); //EWOL_DEBUG("generate an crop on element : " << sizeInit << " == > " << output.size() );
} }
#endif #endif
@ -231,7 +231,7 @@ ewol::Drawing::Drawing(void) :
m_thickness(0.0), m_thickness(0.0),
m_triElement(0) m_triElement(0)
{ {
LoadProgram(); loadProgram();
for (int32_t iii=0; iii<3; iii++) { for (int32_t iii=0; iii<3; iii++) {
m_triangle[iii] = m_position; m_triangle[iii] = m_position;
m_tricolor[iii] = m_color; m_tricolor[iii] = m_color;
@ -241,23 +241,23 @@ ewol::Drawing::Drawing(void) :
ewol::Drawing::~Drawing(void) ewol::Drawing::~Drawing(void)
{ {
UnLoadProgram(); unLoadProgram();
} }
void ewol::Drawing::GenerateTriangle(void) void ewol::Drawing::generateTriangle(void)
{ {
m_triElement = 0; m_triElement = 0;
m_coord.PushBack(m_triangle[0]); m_coord.pushBack(m_triangle[0]);
m_coordColor.PushBack(m_tricolor[0]); m_coordColor.pushBack(m_tricolor[0]);
m_coord.PushBack(m_triangle[1]); m_coord.pushBack(m_triangle[1]);
m_coordColor.PushBack(m_tricolor[1]); m_coordColor.pushBack(m_tricolor[1]);
m_coord.PushBack(m_triangle[2]); m_coord.pushBack(m_triangle[2]);
m_coordColor.PushBack(m_tricolor[2]); m_coordColor.pushBack(m_tricolor[2]);
} }
void ewol::Drawing::InternalSetColor(const etk::Color<>& _color) void ewol::Drawing::internalSetColor(const etk::Color<>& _color)
{ {
if (m_triElement < 1) { if (m_triElement < 1) {
m_tricolor[0] = _color; m_tricolor[0] = _color;
@ -271,72 +271,72 @@ void ewol::Drawing::InternalSetColor(const etk::Color<>& _color)
} }
void ewol::Drawing::SetPoint(const vec3& _point) void ewol::Drawing::setPoint(const vec3& _point)
{ {
m_triangle[m_triElement] = _point; m_triangle[m_triElement] = _point;
m_triElement++; m_triElement++;
if (m_triElement>=3) { if (m_triElement >= 3) {
GenerateTriangle(); generateTriangle();
} }
} }
void ewol::Drawing::ResetCount(void) void ewol::Drawing::resetCount(void)
{ {
m_triElement = 0; m_triElement = 0;
} }
void ewol::Drawing::UnLoadProgram(void) void ewol::Drawing::unLoadProgram(void)
{ {
ewol::Program::Release(m_GLprogram); ewol::Program::release(m_GLprogram);
} }
void ewol::Drawing::LoadProgram(void) void ewol::Drawing::loadProgram(void)
{ {
// remove previous loading ... in case // remove previous loading ... in case
UnLoadProgram(); unLoadProgram();
// oad the new ... // oad the new ...
m_GLprogram = ewol::Program::Keep("DATA:color3.prog"); m_GLprogram = ewol::Program::keep("DATA:color3.prog");
// get the shader resource : // get the shader resource :
if (NULL != m_GLprogram ) { if (NULL != m_GLprogram ) {
m_GLPosition = m_GLprogram->GetAttribute("EW_coord3d"); m_GLPosition = m_GLprogram->getAttribute("EW_coord3d");
m_GLColor = m_GLprogram->GetAttribute("EW_color"); m_GLColor = m_GLprogram->getAttribute("EW_color");
m_GLMatrix = m_GLprogram->GetUniform("EW_MatrixTransformation"); m_GLMatrix = m_GLprogram->getUniform("EW_MatrixTransformation");
} }
} }
void ewol::Drawing::Draw(bool _disableDepthTest) void ewol::Drawing::draw(bool _disableDepthTest)
{ {
if (m_coord.Size()<=0) { if (m_coord.size() <= 0) {
// TODO : a remÚtre ... // TODO : a remÚtre ...
//EWOL_WARNING("Nothink to draw..."); //EWOL_WARNING("Nothink to draw...");
return; return;
} }
if (m_GLprogram==NULL) { if (m_GLprogram == NULL) {
EWOL_ERROR("No shader ..."); EWOL_ERROR("No shader ...");
return; return;
} }
// set Matrix : translation/positionMatrix // set Matrix : translation/positionMatrix
mat4 tmpMatrix = ewol::openGL::GetMatrix()*m_matrixApply; mat4 tmpMatrix = ewol::openGL::getMatrix()*m_matrixApply;
m_GLprogram->Use(); m_GLprogram->use();
m_GLprogram->UniformMatrix4fv(m_GLMatrix, 1, tmpMatrix.m_mat); m_GLprogram->uniformMatrix4fv(m_GLMatrix, 1, tmpMatrix.m_mat);
// position : // position :
m_GLprogram->SendAttribute(m_GLPosition, 3/*x,y,z,unused*/, &m_coord[0], 4*sizeof(btScalar)); m_GLprogram->sendAttribute(m_GLPosition, 3/*x,y,z,unused*/, &m_coord[0], 4*sizeof(btScalar));
// color : // color :
m_GLprogram->SendAttribute(m_GLColor, 4/*r,g,b,a*/, &m_coordColor[0]); m_GLprogram->sendAttribute(m_GLColor, 4/*r,g,b,a*/, &m_coordColor[0]);
// Request the draw od the elements : // Request the draw od the elements :
ewol::openGL::DrawArrays(GL_TRIANGLES, 0, m_coord.Size()); ewol::openGL::drawArrays(GL_TRIANGLES, 0, m_coord.size());
m_GLprogram->UnUse(); m_GLprogram->unUse();
} }
void ewol::Drawing::Clear(void) void ewol::Drawing::clear(void)
{ {
// call upper class // call upper class
ewol::Compositing::Clear(); ewol::Compositing::clear();
// Reset Buffer : // reset Buffer :
m_coord.Clear(); m_coord.clear();
m_coordColor.Clear(); m_coordColor.clear();
// Reset temporal variables : // reset temporal variables :
m_position = vec3(0.0, 0.0, 0.0); m_position = vec3(0.0, 0.0, 0.0);
m_clippingPosStart = vec3(0.0, 0.0, 0.0); m_clippingPosStart = vec3(0.0, 0.0, 0.0);
@ -352,7 +352,7 @@ void ewol::Drawing::Clear(void)
} }
} }
void ewol::Drawing::SetClipping(const vec3& _pos, const vec3& _posEnd) void ewol::Drawing::setClipping(const vec3& _pos, const vec3& _posEnd)
{ {
// note the internal system all time request to have a bounding all time in the same order // note the internal system all time request to have a bounding all time in the same order
if (_pos.x() <= _posEnd.x()) { if (_pos.x() <= _posEnd.x()) {
@ -380,7 +380,7 @@ void ewol::Drawing::SetClipping(const vec3& _pos, const vec3& _posEnd)
} }
void ewol::Drawing::SetThickness(float _thickness) void ewol::Drawing::setThickness(float _thickness)
{ {
m_thickness = _thickness; m_thickness = _thickness;
// thickness must be positive // thickness must be positive
@ -389,16 +389,16 @@ void ewol::Drawing::SetThickness(float _thickness)
} }
} }
void ewol::Drawing::AddVertex(void) void ewol::Drawing::addVertex(void)
{ {
InternalSetColor(m_color); internalSetColor(m_color);
SetPoint(m_position); setPoint(m_position);
} }
void ewol::Drawing::LineTo(const vec3& _dest) void ewol::Drawing::lineTo(const vec3& _dest)
{ {
ResetCount(); resetCount();
InternalSetColor(m_color); internalSetColor(m_color);
EWOL_VERBOSE("DrawLine : " << m_position << " to " << _dest); EWOL_VERBOSE("DrawLine : " << m_position << " to " << _dest);
if (m_position.x() == _dest.x() && m_position.y() == _dest.y() && m_position.z() == _dest.z()) { if (m_position.x() == _dest.x() && m_position.y() == _dest.y() && m_position.z() == _dest.z()) {
EWOL_WARNING("Try to draw an line width 0"); EWOL_WARNING("Try to draw an line width 0");
@ -420,21 +420,21 @@ void ewol::Drawing::LineTo(const vec3& _dest)
float offsety = sin(teta-M_PI/2) * (m_thickness/2); float offsety = sin(teta-M_PI/2) * (m_thickness/2);
float offsetx = cos(teta-M_PI/2) * (m_thickness/2); float offsetx = cos(teta-M_PI/2) * (m_thickness/2);
SetPoint(vec3(m_position.x() - offsetx, m_position.y() - offsety, m_position.z()) ); setPoint(vec3(m_position.x() - offsetx, m_position.y() - offsety, m_position.z()) );
SetPoint(vec3(m_position.x() + offsetx, m_position.y() + offsety, m_position.z()) ); setPoint(vec3(m_position.x() + offsetx, m_position.y() + offsety, m_position.z()) );
SetPoint(vec3(_dest.x() + offsetx, _dest.y() + offsety, m_position.z()) ); setPoint(vec3(_dest.x() + offsetx, _dest.y() + offsety, m_position.z()) );
SetPoint(vec3(_dest.x() + offsetx, _dest.y() + offsety, _dest.z()) ); setPoint(vec3(_dest.x() + offsetx, _dest.y() + offsety, _dest.z()) );
SetPoint(vec3(_dest.x() - offsetx, _dest.y() - offsety, _dest.z()) ); setPoint(vec3(_dest.x() - offsetx, _dest.y() - offsety, _dest.z()) );
SetPoint(vec3(m_position.x() - offsetx, m_position.y() - offsety, _dest.z()) ); setPoint(vec3(m_position.x() - offsetx, m_position.y() - offsety, _dest.z()) );
// update the system position : // update the system position :
m_position = _dest; m_position = _dest;
} }
void ewol::Drawing::Rectangle(const vec3& _dest) void ewol::Drawing::rectangle(const vec3& _dest)
{ {
ResetCount(); resetCount();
InternalSetColor(m_color); internalSetColor(m_color);
/* Bitmap position /* Bitmap position
* xA xB * xA xB
* yC *------* * yC *------*
@ -476,23 +476,23 @@ void ewol::Drawing::Rectangle(const vec3& _dest)
|| dxA >= dxB) { || dxA >= dxB) {
return; return;
} }
SetPoint(vec3(dxA, dyD, 0) ); setPoint(vec3(dxA, dyD, 0) );
SetPoint(vec3(dxA, dyC, 0) ); setPoint(vec3(dxA, dyC, 0) );
SetPoint(vec3(dxB, dyC, 0) ); setPoint(vec3(dxB, dyC, 0) );
SetPoint(vec3(dxB, dyC, 0) ); setPoint(vec3(dxB, dyC, 0) );
SetPoint(vec3(dxB, dyD, 0) ); setPoint(vec3(dxB, dyD, 0) );
SetPoint(vec3(dxA, dyD, 0) ); setPoint(vec3(dxA, dyD, 0) );
} }
void ewol::Drawing::Cube(const vec3& _dest) void ewol::Drawing::cube(const vec3& _dest)
{ {
} }
void ewol::Drawing::Circle(float _radius, float _angleStart, float _angleStop) void ewol::Drawing::circle(float _radius, float _angleStart, float _angleStop)
{ {
ResetCount(); resetCount();
if (_radius<0) { if (_radius<0) {
_radius *= -1; _radius *= -1;
@ -508,9 +508,9 @@ void ewol::Drawing::Circle(float _radius, float _angleStart, float _angleStop)
// display background : // display background :
if (m_colorBg.a()!=0) { if (m_colorBg.a()!=0) {
InternalSetColor(m_colorBg); internalSetColor(m_colorBg);
for (int32_t iii=0; iii<nbOcurence; iii++) { for (int32_t iii=0; iii<nbOcurence; iii++) {
SetPoint(vec3(m_position.x(), setPoint(vec3(m_position.x(),
m_position.y(), m_position.y(),
0) ); 0) );
@ -518,7 +518,7 @@ void ewol::Drawing::Circle(float _radius, float _angleStart, float _angleStop)
float offsety = sin(angleOne) * _radius; float offsety = sin(angleOne) * _radius;
float offsetx = cos(angleOne) * _radius; float offsetx = cos(angleOne) * _radius;
SetPoint(vec3(m_position.x() + offsetx, setPoint(vec3(m_position.x() + offsetx,
m_position.y() + offsety, m_position.y() + offsety,
0) ); 0) );
@ -526,18 +526,18 @@ void ewol::Drawing::Circle(float _radius, float _angleStart, float _angleStop)
offsety = sin(angleTwo) * _radius; offsety = sin(angleTwo) * _radius;
offsetx = cos(angleTwo) * _radius; offsetx = cos(angleTwo) * _radius;
SetPoint(vec3(m_position.x() + offsetx, setPoint(vec3(m_position.x() + offsetx,
m_position.y() + offsety, m_position.y() + offsety,
0) ); 0) );
} }
} }
// show if we have a border : // show if we have a border :
if( m_thickness==0 if( m_thickness == 0
|| m_color.a()==0) { || m_color.a() == 0) {
return; return;
} }
InternalSetColor(m_color); internalSetColor(m_color);
for (int32_t iii=0; iii<nbOcurence; iii++) { for (int32_t iii=0; iii<nbOcurence; iii++) {
float angleOne = _angleStart + (_angleStop* iii / nbOcurence) ; float angleOne = _angleStart + (_angleStop* iii / nbOcurence) ;
@ -552,13 +552,13 @@ void ewol::Drawing::Circle(float _radius, float _angleStart, float _angleStop)
float offsetInt2y = sin(angleTwo) * (_radius-m_thickness/2); float offsetInt2y = sin(angleTwo) * (_radius-m_thickness/2);
float offsetInt2x = cos(angleTwo) * (_radius-m_thickness/2); float offsetInt2x = cos(angleTwo) * (_radius-m_thickness/2);
SetPoint(vec3(m_position.x() + offsetIntx, m_position.y() + offsetInty, 0)); setPoint(vec3(m_position.x() + offsetIntx, m_position.y() + offsetInty, 0));
SetPoint(vec3(m_position.x() + offsetExtx, m_position.y() + offsetExty, 0)); setPoint(vec3(m_position.x() + offsetExtx, m_position.y() + offsetExty, 0));
SetPoint(vec3(m_position.x() + offsetExt2x, m_position.y() + offsetExt2y, 0)); setPoint(vec3(m_position.x() + offsetExt2x, m_position.y() + offsetExt2y, 0));
SetPoint(vec3(m_position.x() + offsetExt2x, m_position.y() + offsetExt2y, 0)); setPoint(vec3(m_position.x() + offsetExt2x, m_position.y() + offsetExt2y, 0));
SetPoint(vec3(m_position.x() + offsetInt2x, m_position.y() + offsetInt2y, 0)); setPoint(vec3(m_position.x() + offsetInt2x, m_position.y() + offsetInt2y, 0));
SetPoint(vec3(m_position.x() + offsetIntx, m_position.y() + offsetInty, 0)); setPoint(vec3(m_position.x() + offsetIntx, m_position.y() + offsetInty, 0));
} }
} }

View File

@ -47,13 +47,13 @@ namespace ewol
~Drawing(void); ~Drawing(void);
private: private:
/** /**
* @brief Load the openGL program and get all the ID needed * @brief load the openGL program and get all the ID needed
*/ */
void LoadProgram(void); void loadProgram(void);
/** /**
* @brief Un-Load the openGL program and get all the ID needed * @brief Un-Load the openGL program and get all the ID needed
*/ */
void UnLoadProgram(void); void unLoadProgram(void);
float m_thickness; //!< when drawing line and other things float m_thickness; //!< when drawing line and other things
int32_t m_triElement; //!< special counter of the single dot generated int32_t m_triElement; //!< special counter of the single dot generated
vec3 m_triangle[3]; //!< Register every system with a combinaison of tiangle vec3 m_triangle[3]; //!< Register every system with a combinaison of tiangle
@ -62,122 +62,122 @@ namespace ewol
/** /**
* @brief Lunch the generation of triangle * @brief Lunch the generation of triangle
*/ */
void GenerateTriangle(void); void generateTriangle(void);
/** /**
* @brief in case of some error the count can be reset * @brief in case of some error the count can be reset
*/ */
void ResetCount(void); void resetCount(void);
/** /**
* @brief Set the Color of the current triangle drawing * @brief set the Color of the current triangle drawing
* @param[in] _color Color to current dots generated * @param[in] _color Color to current dots generated
*/ */
void InternalSetColor(const etk::Color<>& _color); void internalSetColor(const etk::Color<>& _color);
/** /**
* @brief internal add of the specific point * @brief internal add of the specific point
* @param[in] _point The requeste dpoint to add * @param[in] _point The requeste dpoint to add
*/ */
void SetPoint(const vec3& point); void setPoint(const vec3& point);
public: public:
/** /**
* @brief Draw All the refistered text in the current element on openGL * @brief draw All the refistered text in the current element on openGL
*/ */
void Draw(bool _disableDepthTest=true); void draw(bool _disableDepthTest=true);
/** /**
* @brief Clear alll tre registered element in the current element * @brief clear alll tre registered element in the current element
*/ */
void Clear(void); void clear(void);
/** /**
* @brief Get the current display position (sometime needed in the gui control) * @brief get the current display position (sometime needed in the gui control)
* @return the current position. * @return the current position.
*/ */
const vec3& GetPos(void) { return m_position; }; const vec3& getPos(void) { return m_position; };
/** /**
* @brief Set position for the next text writen * @brief set position for the next text writen
* @param[in] _pos Position of the text (in 3D) * @param[in] _pos Position of the text (in 3D)
*/ */
void SetPos(const vec3& _pos) { m_position = _pos; }; void setPos(const vec3& _pos) { m_position = _pos; };
inline void SetPos(const vec2& _pos) { SetPos(vec3(_pos.x(), _pos.y(), 0)); }; inline void setPos(const vec2& _pos) { setPos(vec3(_pos.x(), _pos.y(), 0)); };
/** /**
* @brief Set relative position for the next text writen * @brief set relative position for the next text writen
* @param[in] _pos ofset apply of the text (in 3D) * @param[in] _pos ofset apply of the text (in 3D)
*/ */
void SetRelPos(const vec3& _pos) { m_position += _pos; }; void setRelPos(const vec3& _pos) { m_position += _pos; };
inline void SetRelPos(const vec2& _pos) { SetRelPos(vec3(_pos.x(), _pos.y(), 0)); }; inline void setRelPos(const vec2& _pos) { setRelPos(vec3(_pos.x(), _pos.y(), 0)); };
/** /**
* @brief Set the Color of the current foreground font * @brief set the Color of the current foreground font
* @param[in] _color Color to set on foreground (for next print) * @param[in] _color Color to set on foreground (for next print)
*/ */
void SetColor(const etk::Color<>& _color) { m_color = _color; }; void setColor(const etk::Color<>& _color) { m_color = _color; };
/** /**
* @brief Set the background color of the font (for selected Text (not the global BG)) * @brief set the background color of the font (for selected Text (not the global BG))
* @param[in] _color Color to set on background (for next print) * @param[in] _color Color to set on background (for next print)
*/ */
void SetColorBg(const etk::Color<>& _color) { m_colorBg = _color; }; void setColorBg(const etk::Color<>& _color) { m_colorBg = _color; };
/** /**
* @brief Request a clipping area for the text (next draw only) * @brief Request a clipping area for the text (next draw only)
* @param[in]_ pos Start position of the clipping * @param[in]_ pos Start position of the clipping
* @param[in] _width Width size of the clipping * @param[in] _width Width size of the clipping
*/ */
void SetClippingWidth(const vec3& _pos, const vec3& _width) { SetClipping(_pos, _pos+_width); }; void setClippingWidth(const vec3& _pos, const vec3& _width) { setClipping(_pos, _pos+_width); };
inline void SetClippingWidth(const vec2& _pos, const vec2& _width) { SetClippingWidth(vec3(_pos.x(),_pos.y(),-1), vec3(_width.x(),_width.y(), 2)); }; inline void setClippingWidth(const vec2& _pos, const vec2& _width) { setClippingWidth(vec3(_pos.x(),_pos.y(),-1), vec3(_width.x(),_width.y(), 2)); };
/** /**
* @brief Request a clipping area for the text (next draw only) * @brief Request a clipping area for the text (next draw only)
* @param[in] _pos Start position of the clipping * @param[in] _pos Start position of the clipping
* @param[in] _posEnd End position of the clipping * @param[in] _posEnd End position of the clipping
*/ */
void SetClipping(const vec3& _pos, const vec3& _posEnd); void setClipping(const vec3& _pos, const vec3& _posEnd);
inline void SetClipping(const vec2& _pos, const vec2& _posEnd) { SetClipping(vec3(_pos.x(),_pos.y(),-1), vec3(_posEnd.x(),_posEnd.y(), 1)); }; inline void setClipping(const vec2& _pos, const vec2& _posEnd) { setClipping(vec3(_pos.x(),_pos.y(),-1), vec3(_posEnd.x(),_posEnd.y(), 1)); };
/** /**
* @brief Enable/Disable the clipping (without lose the current clipping position) * @brief enable/Disable the clipping (without lose the current clipping position)
* @brief _newMode The new status of the clipping * @brief _newMode The new status of the clipping
*/ */
void SetClippingMode(bool _newMode) { m_clippingEnable = _newMode; }; void setClippingMode(bool _newMode) { m_clippingEnable = _newMode; };
/** /**
* @brief Specify the line thickness for the next elements * @brief Specify the line thickness for the next elements
* @param[in] _thickness The thickness disired for the next print * @param[in] _thickness The thickness disired for the next print
*/ */
void SetThickness(float _thickness); void setThickness(float _thickness);
/** /**
* @brief Add a point reference at the current position (this is a vertex reference at the current position * @brief add a point reference at the current position (this is a vertex reference at the current position
*/ */
void AddVertex(void); void addVertex(void);
/** /**
* @brief Draw a line to a specific position * @brief draw a line to a specific position
* @param[in] _dest Position of the end of the line. * @param[in] _dest Position of the end of the line.
*/ */
void LineTo(const vec3& _dest); void lineTo(const vec3& _dest);
inline void LineTo(const vec2& _dest) { LineTo(vec3(_dest.x(), _dest.y(), 0)); }; inline void lineTo(const vec2& _dest) { lineTo(vec3(_dest.x(), _dest.y(), 0)); };
/** /**
* @brief Relative drawing a line (spacial vector) * @brief Relative drawing a line (spacial vector)
* @param[in] _vect Vector of the curent line. * @param[in] _vect Vector of the curent line.
*/ */
void LineRel(const vec3& _vect) { LineTo(m_position+_vect); }; void lineRel(const vec3& _vect) { lineTo(m_position+_vect); };
inline void LineRel(const vec2& _vect) { LineRel(vec3(_vect.x(), _vect.y(), 0)); }; inline void lineRel(const vec2& _vect) { lineRel(vec3(_vect.x(), _vect.y(), 0)); };
/** /**
* @brief Draw a 2D rectangle to the position requested. * @brief draw a 2D rectangle to the position requested.
* @param[in] _dest Position the the end of the rectangle * @param[in] _dest Position the the end of the rectangle
*/ */
void Rectangle(const vec3& _dest); void rectangle(const vec3& _dest);
inline void Rectangle(const vec2& _dest) { Rectangle(vec3(_dest.x(), _dest.y(), 0)); }; inline void rectangle(const vec2& _dest) { rectangle(vec3(_dest.x(), _dest.y(), 0)); };
/** /**
* @brief Draw a 2D rectangle to the requested size. * @brief draw a 2D rectangle to the requested size.
* @param[in] _size size of the rectangle * @param[in] _size size of the rectangle
*/ */
void RectangleWidth(const vec3& _size) { Rectangle(m_position+_size); }; void rectangleWidth(const vec3& _size) { rectangle(m_position+_size); };
inline void RectangleWidth(const vec2& _size) { RectangleWidth(vec3(_size.x(), _size.y(), 0)); }; inline void rectangleWidth(const vec2& _size) { rectangleWidth(vec3(_size.x(), _size.y(), 0)); };
/** /**
* @brief Draw a 3D rectangle to the position requested. * @brief draw a 3D rectangle to the position requested.
* @param[in] _dest Position the the end of the rectangle * @param[in] _dest Position the the end of the rectangle
*/ */
void Cube(const vec3& _dest); void cube(const vec3& _dest);
/** /**
* @brief Draw a 2D circle with the specify rafdius parameter. * @brief draw a 2D circle with the specify rafdius parameter.
* @param[in] _radius Distence to the dorder * @param[in] _radius Distence to the dorder
* @param[in] _angleStart start angle of this circle ([0..2PI] otherwithe ==> disable) * @param[in] _angleStart start angle of this circle ([0..2PI] otherwithe == > disable)
* @param[in] _angleStop stop angle of this circle ([0..2PI] otherwithe ==> disable) * @param[in] _angleStop stop angle of this circle ([0..2PI] otherwithe == > disable)
*/ */
void Circle(float _radius, float _angleStart = 0, float _angleStop = 2*M_PI); void circle(float _radius, float _angleStart = 0, float _angleStop = 2*M_PI);
}; };
}; };

View File

@ -27,33 +27,33 @@ ewol::Image::Image(const etk::UString& _imageName) :
m_GLtexID(-1), m_GLtexID(-1),
m_resource(NULL) m_resource(NULL)
{ {
SetSource(_imageName); setSource(_imageName);
LoadProgram(); loadProgram();
} }
ewol::Image::~Image(void) ewol::Image::~Image(void)
{ {
ewol::TextureFile::Release(m_resource); ewol::TextureFile::release(m_resource);
ewol::Program::Release(m_GLprogram); ewol::Program::release(m_GLprogram);
} }
void ewol::Image::LoadProgram(void) void ewol::Image::loadProgram(void)
{ {
// get the shader resource : // get the shader resource :
m_GLPosition = 0; m_GLPosition = 0;
m_GLprogram = ewol::Program::Keep("DATA:textured3D.prog"); m_GLprogram = ewol::Program::keep("DATA:textured3D.prog");
if (NULL!=m_GLprogram) { if (NULL!=m_GLprogram) {
m_GLPosition = m_GLprogram->GetAttribute("EW_coord3d"); m_GLPosition = m_GLprogram->getAttribute("EW_coord3d");
m_GLColor = m_GLprogram->GetAttribute("EW_color"); m_GLColor = m_GLprogram->getAttribute("EW_color");
m_GLtexture = m_GLprogram->GetAttribute("EW_texture2d"); m_GLtexture = m_GLprogram->getAttribute("EW_texture2d");
m_GLMatrix = m_GLprogram->GetUniform("EW_MatrixTransformation"); m_GLMatrix = m_GLprogram->getUniform("EW_MatrixTransformation");
m_GLtexID = m_GLprogram->GetUniform("EW_texID"); m_GLtexID = m_GLprogram->getUniform("EW_texID");
} }
} }
void ewol::Image::Draw(bool _disableDepthTest) void ewol::Image::draw(bool _disableDepthTest)
{ {
if (m_coord.Size()<=0) { if (m_coord.size() <= 0) {
//EWOL_WARNING("Nothink to draw..."); //EWOL_WARNING("Nothink to draw...");
return; return;
} }
@ -61,41 +61,41 @@ void ewol::Image::Draw(bool _disableDepthTest)
// this is a normale case ... the user can choice to have no image ... // this is a normale case ... the user can choice to have no image ...
return; return;
} }
if (m_GLprogram==NULL) { if (m_GLprogram == NULL) {
EWOL_ERROR("No shader ..."); EWOL_ERROR("No shader ...");
return; return;
} }
if (_disableDepthTest == true) { if (_disableDepthTest == true) {
ewol::openGL::Disable(ewol::openGL::FLAG_DEPTH_TEST); ewol::openGL::disable(ewol::openGL::FLAG_DEPTH_TEST);
} else { } else {
ewol::openGL::Enable(ewol::openGL::FLAG_DEPTH_TEST); ewol::openGL::enable(ewol::openGL::FLAG_DEPTH_TEST);
} }
// set Matrix : translation/positionMatrix // set Matrix : translation/positionMatrix
mat4 tmpMatrix = ewol::openGL::GetMatrix()*m_matrixApply; mat4 tmpMatrix = ewol::openGL::getMatrix()*m_matrixApply;
m_GLprogram->Use(); m_GLprogram->use();
m_GLprogram->UniformMatrix4fv(m_GLMatrix, 1, tmpMatrix.m_mat); m_GLprogram->uniformMatrix4fv(m_GLMatrix, 1, tmpMatrix.m_mat);
// TextureID // TextureID
m_GLprogram->SetTexture0(m_GLtexID, m_resource->GetId()); m_GLprogram->setTexture0(m_GLtexID, m_resource->getId());
// position : // position :
m_GLprogram->SendAttribute(m_GLPosition, 3/*x,y,z,unused*/, &m_coord[0], 4*sizeof(btScalar)); m_GLprogram->sendAttribute(m_GLPosition, 3/*x,y,z,unused*/, &m_coord[0], 4*sizeof(btScalar));
// Texture : // Texture :
m_GLprogram->SendAttribute(m_GLtexture, 2/*u,v*/, &m_coordTex[0]); m_GLprogram->sendAttribute(m_GLtexture, 2/*u,v*/, &m_coordTex[0]);
// color : // color :
m_GLprogram->SendAttribute(m_GLColor, 4/*r,g,b,a*/, &m_coordColor[0]); m_GLprogram->sendAttribute(m_GLColor, 4/*r,g,b,a*/, &m_coordColor[0]);
// Request the draw od the elements : // Request the draw od the elements :
ewol::openGL::DrawArrays(GL_TRIANGLES, 0, m_coord.Size()); ewol::openGL::drawArrays(GL_TRIANGLES, 0, m_coord.size());
m_GLprogram->UnUse(); m_GLprogram->unUse();
} }
void ewol::Image::Clear(void) void ewol::Image::clear(void)
{ {
// call upper class // call upper class
ewol::Compositing::Clear(); ewol::Compositing::clear();
// Reset Buffer : // reset Buffer :
m_coord.Clear(); m_coord.clear();
m_coordTex.Clear(); m_coordTex.clear();
m_coordColor.Clear(); m_coordColor.clear();
// Reset temporal variables : // reset temporal variables :
m_position = vec3(0.0, 0.0, 0.0); m_position = vec3(0.0, 0.0, 0.0);
m_clippingPosStart = vec3(0.0, 0.0, 0.0); m_clippingPosStart = vec3(0.0, 0.0, 0.0);
m_clippingPosStop = vec3(0.0, 0.0, 0.0); m_clippingPosStop = vec3(0.0, 0.0, 0.0);
@ -104,7 +104,7 @@ void ewol::Image::Clear(void)
m_angle = 0.0; m_angle = 0.0;
} }
void ewol::Image::SetClipping(const vec3& _pos, vec3 _posEnd) void ewol::Image::setClipping(const vec3& _pos, vec3 _posEnd)
{ {
// note the internal system all time request to have a bounding all time in the same order // note the internal system all time request to have a bounding all time in the same order
if (_pos.x() <= _posEnd.x()) { if (_pos.x() <= _posEnd.x()) {
@ -131,61 +131,61 @@ void ewol::Image::SetClipping(const vec3& _pos, vec3 _posEnd)
m_clippingEnable = true; m_clippingEnable = true;
} }
void ewol::Image::SetAngle(float _angle) void ewol::Image::setAngle(float _angle)
{ {
m_angle = _angle; m_angle = _angle;
} }
void ewol::Image::Print(const vec2& _size) void ewol::Image::print(const vec2& _size)
{ {
PrintPart(_size, vec2(0,0), vec2(1,1)); printPart(_size, vec2(0,0), vec2(1,1));
} }
void ewol::Image::PrintPart(const vec2& _size, void ewol::Image::printPart(const vec2& _size,
const vec2& _sourcePosStart, const vec2& _sourcePosStart,
const vec2& _sourcePosStop) const vec2& _sourcePosStop)
{ {
if (m_angle==0.0f) { if (m_angle == 0.0f) {
vec3 point = m_position; vec3 point = m_position;
vec2 tex(_sourcePosStart.x(),_sourcePosStop.y()); vec2 tex(_sourcePosStart.x(),_sourcePosStop.y());
m_coord.PushBack(point); m_coord.pushBack(point);
m_coordTex.PushBack(tex); m_coordTex.pushBack(tex);
m_coordColor.PushBack(m_color); m_coordColor.pushBack(m_color);
tex.setValue(_sourcePosStop.x(),_sourcePosStop.y()); tex.setValue(_sourcePosStop.x(),_sourcePosStop.y());
point.setX(m_position.x() + _size.x()); point.setX(m_position.x() + _size.x());
point.setY(m_position.y()); point.setY(m_position.y());
m_coord.PushBack(point); m_coord.pushBack(point);
m_coordTex.PushBack(tex); m_coordTex.pushBack(tex);
m_coordColor.PushBack(m_color); m_coordColor.pushBack(m_color);
tex.setValue(_sourcePosStop.x(),_sourcePosStart.y()); tex.setValue(_sourcePosStop.x(),_sourcePosStart.y());
point.setX(m_position.x() + _size.x()); point.setX(m_position.x() + _size.x());
point.setY(m_position.y() + _size.y()); point.setY(m_position.y() + _size.y());
m_coord.PushBack(point); m_coord.pushBack(point);
m_coordTex.PushBack(tex); m_coordTex.pushBack(tex);
m_coordColor.PushBack(m_color); m_coordColor.pushBack(m_color);
m_coord.PushBack(point); m_coord.pushBack(point);
m_coordTex.PushBack(tex); m_coordTex.pushBack(tex);
m_coordColor.PushBack(m_color); m_coordColor.pushBack(m_color);
tex.setValue(_sourcePosStart.x(),_sourcePosStart.y()); tex.setValue(_sourcePosStart.x(),_sourcePosStart.y());
point.setX(m_position.x()); point.setX(m_position.x());
point.setY(m_position.y() + _size.y()); point.setY(m_position.y() + _size.y());
m_coord.PushBack(point); m_coord.pushBack(point);
m_coordTex.PushBack(tex); m_coordTex.pushBack(tex);
m_coordColor.PushBack(m_color); m_coordColor.pushBack(m_color);
tex.setValue(_sourcePosStart.x(),_sourcePosStop.y()); tex.setValue(_sourcePosStart.x(),_sourcePosStop.y());
point.setX(m_position.x()); point.setX(m_position.x());
point.setY(m_position.y()); point.setY(m_position.y());
m_coord.PushBack(point); m_coord.pushBack(point);
m_coordTex.PushBack(tex); m_coordTex.pushBack(tex);
m_coordColor.PushBack(m_color); m_coordColor.pushBack(m_color);
return; return;
} }
vec3 center = m_position + vec3(_size.x(),_size.y(),0)/2.0f; vec3 center = m_position + vec3(_size.x(),_size.y(),0)/2.0f;
@ -196,73 +196,73 @@ void ewol::Image::PrintPart(const vec2& _size,
point.setValue(-limitedSize.x(), -limitedSize.y(), 0); point.setValue(-limitedSize.x(), -limitedSize.y(), 0);
point = point.rotate(vec3(0,0,1), m_angle) + center; point = point.rotate(vec3(0,0,1), m_angle) + center;
m_coord.PushBack(point); m_coord.pushBack(point);
m_coordTex.PushBack(tex); m_coordTex.pushBack(tex);
m_coordColor.PushBack(m_color); m_coordColor.pushBack(m_color);
tex.setValue(_sourcePosStop.x(),_sourcePosStop.y()); tex.setValue(_sourcePosStop.x(),_sourcePosStop.y());
point.setValue(limitedSize.x(), -limitedSize.y(), 0); point.setValue(limitedSize.x(), -limitedSize.y(), 0);
point = point.rotate(vec3(0,0,1), m_angle) + center; point = point.rotate(vec3(0,0,1), m_angle) + center;
m_coord.PushBack(point); m_coord.pushBack(point);
m_coordTex.PushBack(tex); m_coordTex.pushBack(tex);
m_coordColor.PushBack(m_color); m_coordColor.pushBack(m_color);
tex.setValue(_sourcePosStop.x(),_sourcePosStart.y()); tex.setValue(_sourcePosStop.x(),_sourcePosStart.y());
point.setValue(limitedSize.x(), limitedSize.y(), 0); point.setValue(limitedSize.x(), limitedSize.y(), 0);
point = point.rotate(vec3(0,0,1), m_angle) + center; point = point.rotate(vec3(0,0,1), m_angle) + center;
m_coord.PushBack(point); m_coord.pushBack(point);
m_coordTex.PushBack(tex); m_coordTex.pushBack(tex);
m_coordColor.PushBack(m_color); m_coordColor.pushBack(m_color);
m_coord.PushBack(point); m_coord.pushBack(point);
m_coordTex.PushBack(tex); m_coordTex.pushBack(tex);
m_coordColor.PushBack(m_color); m_coordColor.pushBack(m_color);
tex.setValue(_sourcePosStart.x(),_sourcePosStart.y()); tex.setValue(_sourcePosStart.x(),_sourcePosStart.y());
point.setValue(-limitedSize.x(), limitedSize.y(), 0); point.setValue(-limitedSize.x(), limitedSize.y(), 0);
point = point.rotate(vec3(0,0,1), m_angle) + center; point = point.rotate(vec3(0,0,1), m_angle) + center;
m_coord.PushBack(point); m_coord.pushBack(point);
m_coordTex.PushBack(tex); m_coordTex.pushBack(tex);
m_coordColor.PushBack(m_color); m_coordColor.pushBack(m_color);
tex.setValue(_sourcePosStart.x(),_sourcePosStop.y()); tex.setValue(_sourcePosStart.x(),_sourcePosStop.y());
point.setValue(-limitedSize.x(), -limitedSize.y(), 0); point.setValue(-limitedSize.x(), -limitedSize.y(), 0);
point = point.rotate(vec3(0,0,1), m_angle) + center; point = point.rotate(vec3(0,0,1), m_angle) + center;
m_coord.PushBack(point); m_coord.pushBack(point);
m_coordTex.PushBack(tex); m_coordTex.pushBack(tex);
m_coordColor.PushBack(m_color); m_coordColor.pushBack(m_color);
} }
void ewol::Image::SetSource(const etk::UString& _newFile, const vec2& _size) void ewol::Image::setSource(const etk::UString& _newFile, const vec2& _size)
{ {
Clear(); clear();
// remove old one // remove old one
ewol::TextureFile::Release(m_resource); ewol::TextureFile::release(m_resource);
ivec2 tmpSize(_size.x(),_size.y()); ivec2 tmpSize(_size.x(),_size.y());
// note that no image can be loaded... // note that no image can be loaded...
if (_newFile != "") { if (_newFile != "") {
// link to new One // link to new one
m_resource = ewol::TextureFile::Keep(_newFile, tmpSize); m_resource = ewol::TextureFile::keep(_newFile, tmpSize);
if (NULL == m_resource) { if (NULL == m_resource) {
EWOL_ERROR("Can not get Image resource"); EWOL_ERROR("Can not get Image resource");
} }
} }
} }
bool ewol::Image::HasSources(void) bool ewol::Image::hasSources(void)
{ {
return m_resource!=NULL; return m_resource!=NULL;
} }
vec2 ewol::Image::GetRealSize(void) vec2 ewol::Image::getRealSize(void)
{ {
if (NULL==m_resource) { if (NULL == m_resource) {
return vec2(0,0); return vec2(0,0);
} }
return m_resource->GetRealSize(); return m_resource->getRealSize();
} }

View File

@ -39,9 +39,9 @@ namespace ewol
etk::Vector<etk::Color<float> > m_coordColor; //!< internal color of the different point etk::Vector<etk::Color<float> > m_coordColor; //!< internal color of the different point
private: private:
/** /**
* @brief Load the openGL program and get all the ID needed * @brief load the openGL program and get all the ID needed
*/ */
void LoadProgram(void); void loadProgram(void);
public: public:
/** /**
* @brief generic constructor * @brief generic constructor
@ -54,92 +54,92 @@ namespace ewol
virtual ~Image(void); virtual ~Image(void);
public: public:
/** /**
* @brief Draw All the refistered text in the current element on openGL * @brief draw All the refistered text in the current element on openGL
* @param[in] _disableDepthTest Disable the Depth test for display * @param[in] _disableDepthTest disable the Depth test for display
*/ */
void Draw(bool _disableDepthTest=true); void draw(bool _disableDepthTest=true);
/** /**
* @brief Clear alll tre registered element in the current element * @brief clear alll tre registered element in the current element
*/ */
void Clear(void); void clear(void);
/** /**
* @brief Get the current display position (sometime needed in the gui control) * @brief get the current display position (sometime needed in the gui control)
* @return the current position. * @return the current position.
*/ */
const vec3& GetPos(void) { return m_position; }; const vec3& getPos(void) { return m_position; };
/** /**
* @brief Set position for the next text writen * @brief set position for the next text writen
* @param[in] _pos Position of the text (in 3D) * @param[in] _pos Position of the text (in 3D)
*/ */
void SetPos(const vec3& _pos) { m_position = _pos; }; void setPos(const vec3& _pos) { m_position = _pos; };
inline void SetPos(const vec2& _pos) { SetPos(vec3(_pos.x(),_pos.y(),0)); }; inline void setPos(const vec2& _pos) { setPos(vec3(_pos.x(),_pos.y(),0)); };
/** /**
* @brief Set relative position for the next text writen * @brief set relative position for the next text writen
* @param[in] _pos ofset apply of the text (in 3D) * @param[in] _pos ofset apply of the text (in 3D)
*/ */
void SetRelPos(const vec3& _pos) { m_position += _pos; }; void setRelPos(const vec3& _pos) { m_position += _pos; };
inline void SetRelPos(const vec2& _pos) { SetRelPos(vec3(_pos.x(),_pos.y(),0)); }; inline void setRelPos(const vec2& _pos) { setRelPos(vec3(_pos.x(),_pos.y(),0)); };
/** /**
* @brief Set the Color of the current foreground font * @brief set the Color of the current foreground font
* @param[in] _color Color to set on foreground (for next print) * @param[in] _color Color to set on foreground (for next print)
*/ */
void SetColor(const etk::Color<>& _color) { m_color = _color; }; void setColor(const etk::Color<>& _color) { m_color = _color; };
/** /**
* @brief Request a clipping area for the text (next draw only) * @brief Request a clipping area for the text (next draw only)
* @param[in] _pos Start position of the clipping * @param[in] _pos Start position of the clipping
* @param[in] _width Width size of the clipping * @param[in] _width Width size of the clipping
*/ */
void SetClippingWidth(const vec3& _pos, vec3 _width) { SetClipping(_pos, _pos+_width); }; void setClippingWidth(const vec3& _pos, vec3 _width) { setClipping(_pos, _pos+_width); };
inline void SetClippingWidth(const vec2& _pos, const vec2& _width) { SetClippingWidth(vec3(_pos.x(),_pos.y(),0), vec3(_width.x(),_width.y(),0)); }; inline void setClippingWidth(const vec2& _pos, const vec2& _width) { setClippingWidth(vec3(_pos.x(),_pos.y(),0), vec3(_width.x(),_width.y(),0)); };
/** /**
* @brief Request a clipping area for the text (next draw only) * @brief Request a clipping area for the text (next draw only)
* @param[in] _pos Start position of the clipping * @param[in] _pos Start position of the clipping
* @param[in] _posEnd End position of the clipping * @param[in] _posEnd End position of the clipping
*/ */
void SetClipping(const vec3& _pos, vec3 _posEnd); void setClipping(const vec3& _pos, vec3 _posEnd);
inline void SetClipping(const vec2& _pos, const vec2& _posEnd) { SetClipping(vec3(_pos.x(),_pos.y(),0), vec3(_posEnd.x(),_posEnd.y(),0)); }; inline void setClipping(const vec2& _pos, const vec2& _posEnd) { setClipping(vec3(_pos.x(),_pos.y(),0), vec3(_posEnd.x(),_posEnd.y(),0)); };
/** /**
* @brief Enable/Disable the clipping (without lose the current clipping position) * @brief enable/Disable the clipping (without lose the current clipping position)
* @brief _newMode The new status of the clipping * @brief _newMode The new status of the clipping
*/ */
void SetClippingMode(bool _newMode) { m_clippingEnable = _newMode; }; void setClippingMode(bool _newMode) { m_clippingEnable = _newMode; };
/** /**
* @brief Set a unique rotation of this element (not set in the Rotate Generic system) * @brief set a unique rotation of this element (not set in the rotate Generic system)
* @param[in] _angle Angle to set in radiant. * @param[in] _angle Angle to set in radiant.
*/ */
void SetAngle(float _angleRad); void setAngle(float _angleRad);
/** /**
* @brief Add a compleate of the image to display with the requested size * @brief add a compleate of the image to display with the requested size
* @param[in] _size Size of the output image * @param[in] _size size of the output image
*/ */
void Print(const ivec2& _size) { Print(vec2(_size.x(),_size.y())); }; void print(const ivec2& _size) { print(vec2(_size.x(),_size.y())); };
void Print(const vec2& _size); void print(const vec2& _size);
/** /**
* @brief Add a part of the image to display with the requested size * @brief add a part of the image to display with the requested size
* @param[in] _size Size of the output image * @param[in] _size size of the output image
* @param[in] _sourcePosStart Start position in the image [0..1] (can be bigger but this repeate the image). * @param[in] _sourcePosStart Start position in the image [0..1] (can be bigger but this repeate the image).
* @param[in] _sourcePosStop Stop position in the image [0..1] (can be bigger but this repeate the image). * @param[in] _sourcePosStop Stop position in the image [0..1] (can be bigger but this repeate the image).
*/ */
void PrintPart(const vec2& _size, void printPart(const vec2& _size,
const vec2& _sourcePosStart, const vec2& _sourcePosStart,
const vec2& _sourcePosStop); const vec2& _sourcePosStop);
/** /**
* @brief Change the image Source ==> can not be done to display 2 images at the same time ... * @brief change the image Source == > can not be done to display 2 images at the same time ...
* @param[in] _newFile New file of the Image * @param[in] _newFile New file of the Image
* @param[in] _size for the image when Verctorial image loading is requested * @param[in] _size for the image when Verctorial image loading is requested
*/ */
void SetSource(const etk::UString& _newFile, int32_t _size=32) { SetSource(_newFile, vec2(_size,_size)); }; void setSource(const etk::UString& _newFile, int32_t _size=32) { setSource(_newFile, vec2(_size,_size)); };
void SetSource(const etk::UString& _newFile, const vec2& _size); void setSource(const etk::UString& _newFile, const vec2& _size);
/** /**
* @brief Sometimes the user declare an image but not allocate the ressources all the time, this is to know it .. * @brief Sometimes the user declare an image but not allocate the ressources all the time, this is to know it ..
* @return the validity od the resources. * @return the validity od the resources.
*/ */
bool HasSources(void); bool hasSources(void);
/** /**
* @brief Get the source image registered size in the file (<0 when multiple size image) * @brief get the source image registered size in the file (<0 when multiple size image)
* @return tre image registered size * @return tre image registered size
*/ */
vec2 GetRealSize(void); vec2 getRealSize(void);
}; };
}; };

View File

@ -39,111 +39,111 @@ ewol::Shaper::Shaper(const etk::UString& _shaperName) :
m_stateNew(0), m_stateNew(0),
m_stateTransition(1.0) m_stateTransition(1.0)
{ {
LoadProgram(); loadProgram();
UpdateVertex(); updateVertex();
} }
ewol::Shaper::~Shaper(void) ewol::Shaper::~Shaper(void)
{ {
UnLoadProgram(); unLoadProgram();
} }
void ewol::Shaper::UnLoadProgram(void) void ewol::Shaper::unLoadProgram(void)
{ {
ewol::Program::Release(m_GLprogram); ewol::Program::release(m_GLprogram);
ewol::TextureFile::Release(m_resourceTexture); ewol::TextureFile::release(m_resourceTexture);
ewol::ConfigFile::Release(m_config); ewol::ConfigFile::release(m_config);
} }
void ewol::Shaper::LoadProgram(void) void ewol::Shaper::loadProgram(void)
{ {
if (m_name=="") { if (m_name == "") {
EWOL_DEBUG("no Shaper set for loading resources ..."); EWOL_DEBUG("no Shaper set for loading resources ...");
return; return;
} }
m_config = ewol::ConfigFile::Keep(m_name); m_config = ewol::ConfigFile::keep(m_name);
if (NULL != m_config) { if (NULL != m_config) {
m_confIdPaddingX = m_config->Request("PaddingX"); m_confIdPaddingX = m_config->request("PaddingX");
m_confIdPaddingY = m_config->Request("PaddingY"); m_confIdPaddingY = m_config->request("PaddingY");
m_confIdChangeTime = m_config->Request("ChangeTime"); m_confIdChangeTime = m_config->request("ChangeTime");
m_confProgramFile = m_config->Request("program"); m_confProgramFile = m_config->request("program");
m_confImageFile = m_config->Request("image"); m_confImageFile = m_config->request("image");
} }
etk::UString basicShaderFile = m_config->GetString(m_confProgramFile); etk::UString basicShaderFile = m_config->getString(m_confProgramFile);
if (basicShaderFile!="") { if (basicShaderFile!="") {
// Get the relative position of the current file ... // get the relative position of the current file ...
etk::FSNode file(m_name); etk::FSNode file(m_name);
etk::UString tmpFilename = file.GetRelativeFolder() + basicShaderFile; etk::UString tmpFilename = file.getRelativeFolder() + basicShaderFile;
EWOL_DEBUG("Shaper try load shader : " << tmpFilename << " with base : " << basicShaderFile); EWOL_DEBUG("Shaper try load shader : " << tmpFilename << " with base : " << basicShaderFile);
// get the shader resource : // get the shader resource :
m_GLPosition = 0; m_GLPosition = 0;
m_GLprogram = ewol::Program::Keep(tmpFilename); m_GLprogram = ewol::Program::keep(tmpFilename);
if (NULL !=m_GLprogram) { if (NULL !=m_GLprogram) {
m_GLPosition = m_GLprogram->GetAttribute("EW_coord2d"); m_GLPosition = m_GLprogram->getAttribute("EW_coord2d");
m_GLMatrix = m_GLprogram->GetUniform("EW_MatrixTransformation"); m_GLMatrix = m_GLprogram->getUniform("EW_MatrixTransformation");
// Widget property ==> for the Vertex shader // Widget property == > for the Vertex shader
m_GLPropertySize = m_GLprogram->GetUniform("EW_widgetProperty.size"); m_GLPropertySize = m_GLprogram->getUniform("EW_widgetProperty.size");
m_GLPropertyOrigin = m_GLprogram->GetUniform("EW_widgetProperty.origin"); m_GLPropertyOrigin = m_GLprogram->getUniform("EW_widgetProperty.origin");
m_GLPropertyInsidePos = m_GLprogram->GetUniform("EW_widgetProperty.insidePos"); m_GLPropertyInsidePos = m_GLprogram->getUniform("EW_widgetProperty.insidePos");
m_GLPropertyInsideSize = m_GLprogram->GetUniform("EW_widgetProperty.insideSize"); m_GLPropertyInsideSize = m_GLprogram->getUniform("EW_widgetProperty.insideSize");
// status property ==> for the fragment shader // status property == > for the fragment shader
m_GLStateOld = m_GLprogram->GetUniform("EW_status.stateOld"); m_GLStateOld = m_GLprogram->getUniform("EW_status.stateOld");
m_GLStateNew = m_GLprogram->GetUniform("EW_status.stateNew"); m_GLStateNew = m_GLprogram->getUniform("EW_status.stateNew");
m_GLStateTransition = m_GLprogram->GetUniform("EW_status.transition"); m_GLStateTransition = m_GLprogram->getUniform("EW_status.transition");
// for the texture ID : // for the texture ID :
m_GLtexID = m_GLprogram->GetUniform("EW_texID"); m_GLtexID = m_GLprogram->getUniform("EW_texID");
} }
etk::UString basicImageFile = m_config->GetString(m_confImageFile); etk::UString basicImageFile = m_config->getString(m_confImageFile);
if (basicImageFile != "") { if (basicImageFile != "") {
tmpFilename = file.GetRelativeFolder() + basicImageFile; tmpFilename = file.getRelativeFolder() + basicImageFile;
ivec2 size(64,64); ivec2 size(64,64);
m_resourceTexture = ewol::TextureFile::Keep(tmpFilename, size); m_resourceTexture = ewol::TextureFile::keep(tmpFilename, size);
} }
} }
} }
void ewol::Shaper::Draw(bool _disableDepthTest) void ewol::Shaper::draw(bool _disableDepthTest)
{ {
if (m_config == NULL) { if (m_config == NULL) {
// this is a normale case ... the user can choice to have no config basic file ... // this is a normale case ... the user can choice to have no config basic file ...
return; return;
} }
if (m_GLprogram==NULL) { if (m_GLprogram == NULL) {
EWOL_ERROR("No shader ..."); EWOL_ERROR("No shader ...");
return; return;
} }
//glScalef(m_scaling.x, m_scaling.y, 1.0); //glScalef(m_scaling.x, m_scaling.y, 1.0);
m_GLprogram->Use(); m_GLprogram->use();
// set Matrix : translation/positionMatrix // set Matrix : translation/positionMatrix
mat4 tmpMatrix = ewol::openGL::GetMatrix(); mat4 tmpMatrix = ewol::openGL::getMatrix();
m_GLprogram->UniformMatrix4fv(m_GLMatrix, 1, tmpMatrix.m_mat); m_GLprogram->uniformMatrix4fv(m_GLMatrix, 1, tmpMatrix.m_mat);
// position : // position :
m_GLprogram->SendAttribute(m_GLPosition, 2/*x,y*/, m_coord); m_GLprogram->sendAttribute(m_GLPosition, 2/*x,y*/, m_coord);
// all entry parameters : // all entry parameters :
m_GLprogram->Uniform2(m_GLPropertySize, m_propertySize); m_GLprogram->uniform2(m_GLPropertySize, m_propertySize);
m_GLprogram->Uniform2(m_GLPropertyOrigin, m_propertyOrigin); m_GLprogram->uniform2(m_GLPropertyOrigin, m_propertyOrigin);
m_GLprogram->Uniform2(m_GLPropertyInsidePos, m_propertyInsidePosition); m_GLprogram->uniform2(m_GLPropertyInsidePos, m_propertyInsidePosition);
m_GLprogram->Uniform2(m_GLPropertyInsideSize, m_propertyInsideSize); m_GLprogram->uniform2(m_GLPropertyInsideSize, m_propertyInsideSize);
m_GLprogram->Uniform1i(m_GLStateOld, m_stateOld); m_GLprogram->uniform1i(m_GLStateOld, m_stateOld);
m_GLprogram->Uniform1i(m_GLStateNew, m_stateNew); m_GLprogram->uniform1i(m_GLStateNew, m_stateNew);
m_GLprogram->Uniform1f(m_GLStateTransition, m_stateTransition); m_GLprogram->uniform1f(m_GLStateTransition, m_stateTransition);
if (NULL!=m_resourceTexture) { if (NULL!=m_resourceTexture) {
// TextureID // TextureID
m_GLprogram->SetTexture0(m_GLtexID, m_resourceTexture->GetId()); m_GLprogram->setTexture0(m_GLtexID, m_resourceTexture->getId());
} }
// Request the draw of the elements : // Request the draw of the elements :
ewol::openGL::DrawArrays(GL_TRIANGLES, 0, 6); ewol::openGL::drawArrays(GL_TRIANGLES, 0, 6);
m_GLprogram->UnUse(); m_GLprogram->unUse();
} }
void ewol::Shaper::Clear(void) void ewol::Shaper::clear(void)
{ {
// nothing to do ... // nothing to do ...
} }
bool ewol::Shaper::ChangeStatusIn(int32_t _newStatusId) bool ewol::Shaper::changeStatusIn(int32_t _newStatusId)
{ {
if (_newStatusId != m_stateNew) { if (_newStatusId != m_stateNew) {
m_nextStatusRequested = _newStatusId; m_nextStatusRequested = _newStatusId;
@ -156,11 +156,11 @@ bool ewol::Shaper::ChangeStatusIn(int32_t _newStatusId)
return false; return false;
} }
bool ewol::Shaper::PeriodicCall(const ewol::EventTime& _event) bool ewol::Shaper::periodicCall(const ewol::EventTime& _event)
{ {
//EWOL_DEBUG("call=" << _event); //EWOL_DEBUG("call=" << _event);
// start : // start :
if (m_stateTransition>=1.0) { if (m_stateTransition >= 1.0) {
m_stateOld = m_stateNew; m_stateOld = m_stateNew;
if( m_nextStatusRequested != -1 if( m_nextStatusRequested != -1
&& m_nextStatusRequested != m_stateOld) { && m_nextStatusRequested != m_stateOld) {
@ -186,9 +186,9 @@ bool ewol::Shaper::PeriodicCall(const ewol::EventTime& _event)
m_nextStatusRequested = -1; m_nextStatusRequested = -1;
} }
} }
float timeRelativity = m_config->GetFloat(m_confIdChangeTime)/1000.0; float timeRelativity = m_config->getFloat(m_confIdChangeTime)/1000.0;
m_stateTransition += _event.GetDeltaCall()/timeRelativity; m_stateTransition += _event.getDeltaCall()/timeRelativity;
//m_stateTransition += _event.GetDeltaCall(); //m_stateTransition += _event.getDeltaCall();
m_stateTransition = etk_avg(0.0f, m_stateTransition, 1.0f); m_stateTransition = etk_avg(0.0f, m_stateTransition, 1.0f);
//EWOL_DEBUG("relative=" << timeRelativity << " Transition : " << m_stateTransition); //EWOL_DEBUG("relative=" << timeRelativity << " Transition : " << m_stateTransition);
} }
@ -196,9 +196,9 @@ bool ewol::Shaper::PeriodicCall(const ewol::EventTime& _event)
} }
void ewol::Shaper::UpdateVertex(void) void ewol::Shaper::updateVertex(void)
{ {
// set coord ==> must be a static VBO ... // set coord == > must be a static VBO ...
m_coord[0].setValue( m_propertyOrigin.x(), m_coord[0].setValue( m_propertyOrigin.x(),
m_propertyOrigin.y()+m_propertySize.y()); m_propertyOrigin.y()+m_propertySize.y());
m_coord[1].setValue( m_propertyOrigin.x(), m_coord[1].setValue( m_propertyOrigin.x(),
@ -214,54 +214,54 @@ void ewol::Shaper::UpdateVertex(void)
m_propertyOrigin.y()+m_propertySize.y()); m_propertyOrigin.y()+m_propertySize.y());
} }
void ewol::Shaper::SetOrigin(const vec2& _newOri) void ewol::Shaper::setOrigin(const vec2& _newOri)
{ {
if (m_propertyOrigin != _newOri) { if (m_propertyOrigin != _newOri) {
m_propertyOrigin = _newOri; m_propertyOrigin = _newOri;
UpdateVertex(); updateVertex();
} }
} }
void ewol::Shaper::SetSize(const vec2& _newSize) void ewol::Shaper::setSize(const vec2& _newSize)
{ {
if (m_propertySize != _newSize) { if (m_propertySize != _newSize) {
m_propertySize = _newSize; m_propertySize = _newSize;
UpdateVertex(); updateVertex();
} }
} }
void ewol::Shaper::SetInsideSize(const vec2& _newInsideSize) void ewol::Shaper::setInsideSize(const vec2& _newInsideSize)
{ {
m_propertyInsideSize = _newInsideSize; m_propertyInsideSize = _newInsideSize;
} }
void ewol::Shaper::SetInsidePos(const vec2& _newInsidePos) void ewol::Shaper::setInsidePos(const vec2& _newInsidePos)
{ {
m_propertyInsidePosition = _newInsidePos; m_propertyInsidePosition = _newInsidePos;
} }
vec2 ewol::Shaper::GetPadding(void) vec2 ewol::Shaper::getPadding(void)
{ {
vec2 padding(0,0); vec2 padding(0,0);
if (m_config!=NULL) { if (m_config!=NULL) {
padding.setValue(m_config->GetFloat(m_confIdPaddingX), padding.setValue(m_config->getFloat(m_confIdPaddingX),
m_config->GetFloat(m_confIdPaddingY)); m_config->getFloat(m_confIdPaddingY));
} }
return padding; return padding;
} }
void ewol::Shaper::SetSource(const etk::UString& _newFile) void ewol::Shaper::setSource(const etk::UString& _newFile)
{ {
Clear(); clear();
UnLoadProgram(); unLoadProgram();
m_name = _newFile; m_name = _newFile;
LoadProgram(); loadProgram();
} }
bool ewol::Shaper::HasSources(void) bool ewol::Shaper::hasSources(void)
{ {
return m_GLprogram!=NULL; return m_GLprogram!=NULL;
} }

View File

@ -19,7 +19,7 @@ namespace ewol
/** /**
* @brief the Shaper system is a basic theme configuration for every widget, it corespond at a background display described by a pool of files * @brief the Shaper system is a basic theme configuration for every widget, it corespond at a background display described by a pool of files
*/ */
// TODO : Load image // TODO : load image
// TODO : Abstaraction between states (call by name and the system greate IDs // TODO : Abstaraction between states (call by name and the system greate IDs
class Shaper : public ewol::Compositing class Shaper : public ewol::Compositing
{ {
@ -30,9 +30,9 @@ namespace ewol
int32_t m_confIdPaddingX; //!< ConfigFile padding property X int32_t m_confIdPaddingX; //!< ConfigFile padding property X
int32_t m_confIdPaddingY; //!< ConfigFile padding property Y int32_t m_confIdPaddingY; //!< ConfigFile padding property Y
int32_t m_confIdChangeTime; //!< ConfigFile padding transition time property int32_t m_confIdChangeTime; //!< ConfigFile padding transition time property
int32_t m_confProgramFile; //!< ConfigFile OpengGl program Name int32_t m_confProgramFile; //!< ConfigFile opengGl program Name
int32_t m_confImageFile; //!< ConfigFile OpengGl program Name int32_t m_confImageFile; //!< ConfigFile opengGl program Name
// OpenGL shaders programs: // openGL shaders programs:
ewol::Program* m_GLprogram; //!< pointer on the opengl display program ewol::Program* m_GLprogram; //!< pointer on the opengl display program
int32_t m_GLPosition; //!< openGL id on the element (vertex buffer) int32_t m_GLPosition; //!< openGL id on the element (vertex buffer)
int32_t m_GLMatrix; //!< openGL id on the element (transformation matrix) int32_t m_GLMatrix; //!< openGL id on the element (transformation matrix)
@ -58,13 +58,13 @@ namespace ewol
vec2 m_coord[6]; //!< the double triangle coordonates vec2 m_coord[6]; //!< the double triangle coordonates
private: private:
/** /**
* @brief Load the openGL program and get all the ID needed * @brief load the openGL program and get all the ID needed
*/ */
void LoadProgram(void); void loadProgram(void);
/** /**
* @brief Un-Load the openGL program and get all the ID needed * @brief Un-Load the openGL program and get all the ID needed
*/ */
void UnLoadProgram(void); void unLoadProgram(void);
public: public:
/** /**
* @brief generic constructor * @brief generic constructor
@ -77,87 +77,87 @@ namespace ewol
~Shaper(void); ~Shaper(void);
public: public:
/** /**
* @brief Draw All the refistered text in the current element on openGL * @brief draw All the refistered text in the current element on openGL
*/ */
void Draw(bool _disableDepthTest=true); void draw(bool _disableDepthTest=true);
/** /**
* @brief Clear alll tre registered element in the current element * @brief clear alll tre registered element in the current element
*/ */
void Clear(void); void clear(void);
/** /**
* @brief change the current status in an other * @brief change the current status in an other
* @param[in] _newStatusId the next new status requested * @param[in] _newStatusId the next new status requested
* @return true The widget must call this fuction periodicly (and redraw itself) * @return true The widget must call this fuction periodicly (and redraw itself)
* @return false No need to request the periodic call. * @return false No need to request the periodic call.
*/ */
bool ChangeStatusIn(int32_t _newStatusId); bool changeStatusIn(int32_t _newStatusId);
/** /**
* @brief Get the current displayed status of the shaper * @brief get the current displayed status of the shaper
* @return The Status Id * @return The Status Id
*/ */
int32_t GetCurrentDisplayedStatus(void) { return m_stateNew; }; int32_t getCurrentDisplayedStatus(void) { return m_stateNew; };
/** /**
* @brief Get the next displayed status of the shaper * @brief get the next displayed status of the shaper
* @return The next status Id (-1 if no status in next) * @return The next status Id (-1 if no status in next)
*/ */
int32_t GetNextDisplayedStatus(void) { return m_nextStatusRequested; }; int32_t getNextDisplayedStatus(void) { return m_nextStatusRequested; };
/** /**
* @brief Get the current trasion status * @brief get the current trasion status
* @return value of the transition status (0.0f when no activity) * @return value of the transition status (0.0f when no activity)
*/ */
float GetTransitionStatus(void) { return m_stateTransition; }; float getTransitionStatus(void) { return m_stateTransition; };
/** /**
* @brief Same as the widfget periodic call (this is for change display) * @brief Same as the widfget periodic call (this is for change display)
* @param[in] _event The current time of the call. * @param[in] _event The current time of the call.
* @return true The widget must call this fuction periodicly (and redraw itself) * @return true The widget must call this fuction periodicly (and redraw itself)
* @return false No need to request the periodic call. * @return false No need to request the periodic call.
*/ */
bool PeriodicCall(const ewol::EventTime& _event); bool periodicCall(const ewol::EventTime& _event);
/** /**
* @brief Set the widget origin (needed fot the display) * @brief set the widget origin (needed fot the display)
* @param[in] _newOri : the new widget origin * @param[in] _newOri : the new widget origin
*/ */
void SetOrigin(const vec2& _newOri); void setOrigin(const vec2& _newOri);
/** /**
* @brief Set the widget size (needed fot the display) * @brief set the widget size (needed fot the display)
* @param[in] _newSize : the new widget size * @param[in] _newSize : the new widget size
*/ */
void SetSize(const vec2& _newSize); void setSize(const vec2& _newSize);
/** /**
* @brief Set the internal widget size * @brief set the internal widget size
* @param[in] _newInsidePos : the subelement size. * @param[in] _newInsidePos : the subelement size.
*/ */
void SetInsideSize(const vec2& _newInsideSize); void setInsideSize(const vec2& _newInsideSize);
/** /**
* @brief Set the internal widget position * @brief set the internal widget position
* @param[in] _newInsidePos : the subelement position * @param[in] _newInsidePos : the subelement position
*/ */
void SetInsidePos(const vec2& _newInsidePos); void setInsidePos(const vec2& _newInsidePos);
/** /**
* @brief Get the padding declared by the user in the config file * @brief get the padding declared by the user in the config file
* @return the padding property * @return the padding property
*/ */
vec2 GetPadding(void); vec2 getPadding(void);
/** /**
* @brief Change the shaper Source * @brief change the shaper Source
* @param[in] _newFile New file of the shaper * @param[in] _newFile New file of the shaper
*/ */
void SetSource(const etk::UString& _newFile); void setSource(const etk::UString& _newFile);
/** /**
* @brief Get the shaper file Source * @brief get the shaper file Source
* @return the shapper file name * @return the shapper file name
*/ */
const etk::UString& GetSource(void) const { return m_name; }; const etk::UString& getSource(void) const { return m_name; };
/** /**
* @brief Sometimes the user declare an image but not allocate the ressources all the time, this is to know it .. * @brief Sometimes the user declare an image but not allocate the ressources all the time, this is to know it ..
* @return the validity od the resources. * @return the validity od the resources.
*/ */
bool HasSources(void); bool hasSources(void);
private: private:
/** /**
* @brief Update the internal vertex table. * @brief update the internal vertex table.
*/ */
void UpdateVertex(void); void updateVertex(void);
}; };
}; };

View File

@ -18,7 +18,7 @@ ewol::Sprite::Sprite(const etk::UString& _imageName, const ivec2& _nbSprite) :
m_unitarySpriteSize(0,0) m_unitarySpriteSize(0,0)
{ {
/* /*
vec2 imageSize = GetRealSize(); vec2 imageSize = getRealSize();
m_unitarySpriteSize.setValue(imageSize.x()/(float)m_nbSprite.x(), m_unitarySpriteSize.setValue(imageSize.x()/(float)m_nbSprite.x(),
imageSize.y()/(float)m_nbSprite.y()); imageSize.y()/(float)m_nbSprite.y());
*/ */
@ -28,15 +28,15 @@ ewol::Sprite::Sprite(const etk::UString& _imageName, const ivec2& _nbSprite) :
} }
void ewol::Sprite::PrintSprite(const ivec2& _spriteID, const vec3& _size) void ewol::Sprite::printSprite(const ivec2& _spriteID, const vec3& _size)
{ {
if( _spriteID.x()<0 if( _spriteID.x()<0
|| _spriteID.y()<0 || _spriteID.y()<0
|| _spriteID.x()>=m_nbSprite.x() || _spriteID.x() >= m_nbSprite.x()
|| _spriteID.y()>=m_nbSprite.y()) { || _spriteID.y() >= m_nbSprite.y()) {
return; return;
} }
PrintPart(vec2(_size.x(),_size.y()), printPart(vec2(_size.x(),_size.y()),
vec2((float)(_spriteID.x() )*m_unitarySpriteSize.x(), (float)(_spriteID.y() )*m_unitarySpriteSize.y()), vec2((float)(_spriteID.x() )*m_unitarySpriteSize.x(), (float)(_spriteID.y() )*m_unitarySpriteSize.y()),
vec2((float)(_spriteID.x()+1)*m_unitarySpriteSize.x(), (float)(_spriteID.y()+1)*m_unitarySpriteSize.y())); vec2((float)(_spriteID.x()+1)*m_unitarySpriteSize.x(), (float)(_spriteID.y()+1)*m_unitarySpriteSize.y()));
} }

View File

@ -23,8 +23,8 @@ namespace ewol
public: public:
Sprite(const etk::UString& _imageName, const ivec2& _nbSprite); Sprite(const etk::UString& _imageName, const ivec2& _nbSprite);
virtual ~Sprite() {}; virtual ~Sprite() {};
void PrintSprite(const ivec2& _spriteID, const vec2& _size) { PrintSprite(_spriteID, vec3(_size.x(), _size.y(),0)); }; void printSprite(const ivec2& _spriteID, const vec2& _size) { printSprite(_spriteID, vec3(_size.x(), _size.y(),0)); };
void PrintSprite(const ivec2& _spriteID, const vec3& _size); void printSprite(const ivec2& _spriteID, const vec3& _size);
}; };
}; };

File diff suppressed because it is too large Load Diff

View File

@ -25,9 +25,9 @@ namespace ewol
class TextDecoration class TextDecoration
{ {
public: public:
etk::Color<> m_colorBg; //!< Display background color etk::Color<> m_colorBg; //!< display background color
etk::Color<> m_colorFg; //!< Display foreground color etk::Color<> m_colorFg; //!< display foreground color
ewol::font::mode_te m_mode; //!< Display mode Regular/Bold/Italic/BoldItalic ewol::font::mode_te m_mode; //!< display mode Regular/Bold/Italic/BoldItalic
TextDecoration(void) TextDecoration(void)
{ {
m_colorBg = etk::color::blue; m_colorBg = etk::color::blue;
@ -50,7 +50,7 @@ namespace ewol
private: private:
ewol::Drawing m_vectorialDraw; //!< This is used to draw background selection and other things ... ewol::Drawing m_vectorialDraw; //!< This is used to draw background selection and other things ...
public: public:
ewol::Drawing& GetDrawing(void) { return m_vectorialDraw; }; ewol::Drawing& getDrawing(void) { return m_vectorialDraw; };
private: private:
int32_t m_nbCharDisplayed; //!< prevent some error in calculation size. int32_t m_nbCharDisplayed; //!< prevent some error in calculation size.
vec3 m_sizeDisplayStart; //!< The start windows of the display. vec3 m_sizeDisplayStart; //!< The start windows of the display.
@ -68,7 +68,7 @@ namespace ewol
private: private:
ewol::font::mode_te m_mode; //!< font display property : Regular/Bold/Italic/BoldItalic ewol::font::mode_te m_mode; //!< font display property : Regular/Bold/Italic/BoldItalic
bool m_kerning; //!< Kerning enable or disable on the next elements displayed bool m_kerning; //!< Kerning enable or disable on the next elements displayed
bool m_distanceField; //!< Texture in distance Field mode ==> maybe move this in the font property. bool m_distanceField; //!< Texture in distance Field mode == > maybe move this in the font property.
uniChar_t m_previousCharcode; //!< we remember the previous charcode to perform the kerning. @ref Kerning uniChar_t m_previousCharcode; //!< we remember the previous charcode to perform the kerning. @ref Kerning
private: private:
float m_startTextpos; //!< start position of the Alignement (when \n the text return at this position) float m_startTextpos; //!< start position of the Alignement (when \n the text return at this position)
@ -83,7 +83,7 @@ namespace ewol
int32_t m_GLtexID; //!< openGL id on the element (texture ID) int32_t m_GLtexID; //!< openGL id on the element (texture ID)
private: private:
int32_t m_selectionStartPos; //!< start position of the Selection (if == m_cursorPos ==> no selection) int32_t m_selectionStartPos; //!< start position of the Selection (if == m_cursorPos ==> no selection)
int32_t m_cursorPos; //!< Cursor position (default no cursor ==> -100) int32_t m_cursorPos; //!< Cursor position (default no cursor == > -100)
private: private:
ewol::TexturedFont* m_font; //!< Font resources ewol::TexturedFont* m_font; //!< Font resources
private: // Text private: // Text
@ -92,14 +92,14 @@ namespace ewol
etk::Vector<etk::Color<float> > m_coordColor; //!< internal color of the different point etk::Vector<etk::Color<float> > m_coordColor; //!< internal color of the different point
private: private:
/** /**
* @brief Load the openGL program and get all the ID needed * @brief load the openGL program and get all the ID needed
*/ */
void LoadProgram(void); void loadProgram(void);
public: public:
/** /**
* @brief generic constructor * @brief generic constructor
* @param[in] _fontName Name of the font that might be loaded * @param[in] _fontName Name of the font that might be loaded
* @param[in] _fontSize Size 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=-1); Text(const etk::UString& _fontName="", int32_t _fontSize=-1);
/** /**
@ -108,126 +108,126 @@ namespace ewol
~Text(void); ~Text(void);
public: public:
// Derived function // Derived function
virtual void Translate(const vec3& _vect); virtual void translate(const vec3& _vect);
// Derived function // Derived function
virtual void Rotate(const vec3& _vect, float _angle); virtual void rotate(const vec3& _vect, float _angle);
// Derived function // Derived function
virtual void Scale(const vec3& _vect); virtual void scale(const vec3& _vect);
public: public:
/** /**
* @brief Draw All the refistered text in the current element on openGL * @brief draw All the refistered text in the current element on openGL
*/ */
void Draw(bool _disableDepthTest=true); void draw(bool _disableDepthTest=true);
void Draw(const mat4& _transformationMatrix, bool _enableDepthTest=false); void draw(const mat4& _transformationMatrix, bool _enableDepthTest=false);
/** /**
* @brief Clear all the registered element in the current element * @brief clear all the registered element in the current element
*/ */
void Clear(void); void clear(void);
/** /**
* @brief Clear all the intermediate result detween 2 prints * @brief clear all the intermediate result detween 2 prints
*/ */
void Reset(void); void reset(void);
/** /**
* @brief Get the current display position (sometime needed in the gui control) * @brief get the current display position (sometime needed in the gui control)
* @return the current position. * @return the current position.
*/ */
const vec3& GetPos(void) { return m_position; }; const vec3& getPos(void) { return m_position; };
/** /**
* @brief Set position for the next text writen * @brief set position for the next text writen
* @param[in] _pos Position of the text (in 3D) * @param[in] _pos Position of the text (in 3D)
*/ */
void SetPos(const vec3& _pos); void setPos(const vec3& _pos);
inline void SetPos(const vec2& _pos) { SetPos(vec3(_pos.x(),_pos.y(),0)); }; inline void setPos(const vec2& _pos) { setPos(vec3(_pos.x(),_pos.y(),0)); };
/** /**
* @brief Set relative position for the next text writen * @brief set relative position for the next text writen
* @param[in] _pos ofset apply of the text (in 3D) * @param[in] _pos ofset apply of the text (in 3D)
*/ */
void SetRelPos(const vec3& _pos); void setRelPos(const vec3& _pos);
inline void SetRelPos(const vec2& _pos) { SetRelPos(vec3(_pos.x(),_pos.y(),0)); }; inline void setRelPos(const vec2& _pos) { setRelPos(vec3(_pos.x(),_pos.y(),0)); };
/** /**
* @brief Set the Color of the current foreground font * @brief set the Color of the current foreground font
* @param[in] _color Color to set on foreground (for next print) * @param[in] _color Color to set on foreground (for next print)
*/ */
void SetColor(const etk::Color<>& _color) { m_color = _color; }; void setColor(const etk::Color<>& _color) { m_color = _color; };
/** /**
* @brief Set the background color of the font (for selected Text (not the global BG)) * @brief set the background color of the font (for selected Text (not the global BG))
* @param[in] _color Color to set on background (for next print) * @param[in] _color Color to set on background (for next print)
*/ */
void SetColorBg(const etk::Color<>& _color); void setColorBg(const etk::Color<>& _color);
/** /**
* @brief Request a clipping area for the text (next draw only) * @brief Request a clipping area for the text (next draw only)
* @param[in] _pos Start position of the clipping * @param[in] _pos Start position of the clipping
* @param[in] _width Width size of the clipping * @param[in] _width Width size of the clipping
*/ */
void SetClippingWidth(const vec3& _pos, const vec3& _width) { SetClipping(_pos, _pos+_width); } void setClippingWidth(const vec3& _pos, const vec3& _width) { setClipping(_pos, _pos+_width); }
void SetClippingWidth(const vec2& _pos, const vec2& _width) { SetClipping(_pos, _pos+_width); }; void setClippingWidth(const vec2& _pos, const vec2& _width) { setClipping(_pos, _pos+_width); };
/** /**
* @brief Request a clipping area for the text (next draw only) * @brief Request a clipping area for the text (next draw only)
* @param[in] _pos Start position of the clipping * @param[in] _pos Start position of the clipping
* @param[in] _posEnd End position of the clipping * @param[in] _posEnd End position of the clipping
*/ */
void SetClipping(const vec3& _pos, const vec3& _posEnd); void setClipping(const vec3& _pos, const vec3& _posEnd);
void SetClipping(const vec2& _pos, const vec2& _posEnd) { SetClipping(vec3(_pos.x(),_pos.y(),-1), vec3(_posEnd.x(),_posEnd.y(),1) ); }; void setClipping(const vec2& _pos, const vec2& _posEnd) { setClipping(vec3(_pos.x(),_pos.y(),-1), vec3(_posEnd.x(),_posEnd.y(),1) ); };
/** /**
* @brief Enable/Disable the clipping (without lose the current clipping position) * @brief enable/Disable the clipping (without lose the current clipping position)
* @brief _newMode The new status of the clipping * @brief _newMode The new status of the clipping
*/ */
// TODO : Rename SetClippingActivity // TODO : Rename setClippingActivity
void SetClippingMode(bool _newMode); void setClippingMode(bool _newMode);
/** /**
* @brief Specify the font size (this reset the internal element of the current text (system requirement) * @brief Specify the font size (this reset the internal element of the current text (system requirement)
* @param[in] _fontSize New font size * @param[in] _fontSize New font size
*/ */
void SetFontSize(int32_t _fontSize); void setFontSize(int32_t _fontSize);
/** /**
* @brief Specify the font name (this reset the internal element of the current text (system requirement) * @brief Specify the font name (this reset the internal element of the current text (system requirement)
* @param[in] _fontName Current name of the selected font * @param[in] _fontName Current name of the selected font
*/ */
void SetFontName(const etk::UString& _fontName); void setFontName(const etk::UString& _fontName);
/** /**
* @brief Specify the font property (this reset the internal element of the current text (system requirement) * @brief Specify the font property (this reset the internal element of the current text (system requirement)
* @param[in] fontName Current name of the selected font * @param[in] fontName Current name of the selected font
* @param[in] fontSize New font size * @param[in] fontSize New font size
*/ */
void SetFont(etk::UString _fontName, int32_t _fontSize); void setFont(etk::UString _fontName, int32_t _fontSize);
/** /**
* @brief Specify the font mode for the next @ref Print * @brief Specify the font mode for the next @ref print
* @param[in] mode The font mode requested * @param[in] mode The font mode requested
*/ */
void SetFontMode(ewol::font::mode_te _mode); void setFontMode(ewol::font::mode_te _mode);
/** /**
* @brief Get the current font mode * @brief get the current font mode
* @return The font mode applied * @return The font mode applied
*/ */
ewol::font::mode_te GetFontMode(void); ewol::font::mode_te getFontMode(void);
/** /**
* @brief Enable or disable the bold mode * @brief enable or disable the bold mode
* @param[in] _status The new status for this display property * @param[in] _status The new status for this display property
*/ */
void SetFontBold(bool _status); void setFontBold(bool _status);
/** /**
* @brief Enable or disable the italic mode * @brief enable or disable the italic mode
* @param[in] _status The new status for this display property * @param[in] _status The new status for this display property
*/ */
void SetFontItalic(bool _status); void setFontItalic(bool _status);
/** /**
* @brief Set the activation of the Kerning for the display (if it existed) * @brief set the activation of the Kerning for the display (if it existed)
* @param[in] _newMode Enable/Diasable the kerning on this font. * @param[in] _newMode enable/Diasable the kerning on this font.
*/ */
void SetKerningMode(bool _newMode); void setKerningMode(bool _newMode);
/** /**
* @brief Request the distance field mode for this text display * @brief Request the distance field mode for this text display
* @param[in] _newMode Enable/Diasable the Distance Field on this font. * @param[in] _newMode enable/Diasable the Distance Field on this font.
* @todo : not implemented for now * @todo : not implemented for now
*/ */
void SetDistanceFieldMode(bool _newMode); void setDistanceFieldMode(bool _newMode);
/** /**
* @brief Display a compleat string in the current element. * @brief display a compleat string in the current element.
* @param[in] _text The string to display. * @param[in] _text The string to display.
*/ */
void Print(const etk::UString& _text); void print(const etk::UString& _text);
/** /**
* @brief Display a compleat string in the current element with the generic decoration specification. (basic html data) * @brief display a compleat string in the current element with the generic decoration specification. (basic html data)
* <pre> * <pre>
* <br/> * <br/>
* <br/><br/><br/> * <br/><br/><br/>
@ -253,9 +253,9 @@ namespace ewol
* @param[in] _text The string to display. * @param[in] _text The string to display.
* @TODO : implementation not done .... * @TODO : implementation not done ....
*/ */
void PrintDecorated(const etk::UString& _text); void printDecorated(const etk::UString& _text);
/** /**
* @brief Display a compleat string in the current element with the generic decoration specification. (basic html data) * @brief display a compleat string in the current element with the generic decoration specification. (basic html data)
* <pre> * <pre>
* <html> * <html>
* <body> * <body>
@ -285,28 +285,28 @@ namespace ewol
* @param[in] _text The string to display. * @param[in] _text The string to display.
* @TODO : implementation not done .... * @TODO : implementation not done ....
*/ */
void PrintHTML(const etk::UString& _text); void printHTML(const etk::UString& _text);
/** /**
* @brief Display a compleat string in the current element whith specific decorations (advence mode). * @brief display a compleat string in the current element whith specific decorations (advence mode).
* @param[in] _text The string to display. * @param[in] _text The string to display.
* @param[in] _decoration The text decoration for the text that might be display (if the vector is smaller, the last parameter is get) * @param[in] _decoration The text decoration for the text that might be display (if the vector is smaller, the last parameter is get)
*/ */
void Print(const etk::UString& _text, const etk::Vector<TextDecoration>& _decoration); void print(const etk::UString& _text, const etk::Vector<TextDecoration>& _decoration);
/** /**
* @brief Display the current char in the current element (note that the kerning is availlable if the position is not changed) * @brief display the current char in the current element (note that the kerning is availlable if the position is not changed)
* @param[in] _charcode Char that might be dispalyed * @param[in] _charcode Char that might be dispalyed
*/ */
void Print(const uniChar_t& _charcode); void print(const uniChar_t& _charcode);
/** /**
* @brief This Generate the line return ==> it return to the alignement position start and at the correct line position ==> it might be use to not know the line height * @brief This generate the line return == > it return to the alignement position start and at the correct line position ==> it might be use to not know the line height
*/ */
void ForceLineReturn(void); void forceLineReturn(void);
private: private:
/** /**
* @brief This parse a tinyXML node (void pointer to permit to hide tiny XML in include). * @brief This parse a tinyXML node (void pointer to permit to hide tiny XML in include).
* @param[in] _element the exml element. * @param[in] _element the exml element.
*/ */
void ParseHtmlNode(exml::Element* _element); void parseHtmlNode(exml::Element* _element);
public: public:
/** /**
* @brief This generate the possibility to generate the big text property * @brief This generate the possibility to generate the big text property
@ -315,48 +315,48 @@ namespace ewol
* @param[in] _alignement mode of alignement for the Text. * @param[in] _alignement mode of alignement for the Text.
* @note The text align in center change of line every display done (even if it was just a char) * @note The text align in center change of line every display done (even if it was just a char)
*/ */
void SetTextAlignement(float _startTextpos, float _stopTextPos, ewol::Text::aligneMode_te _alignement=ewol::Text::alignDisable); void setTextAlignement(float _startTextpos, float _stopTextPos, ewol::Text::aligneMode_te _alignement=ewol::Text::alignDisable);
/** /**
* @brief Disable the alignement system * @brief disable the alignement system
*/ */
void DisableAlignement(void); void disableAlignement(void);
/** /**
* @brief Get the current alignement property * @brief get the current alignement property
* @return the curent alignement type * @return the curent alignement type
*/ */
ewol::Text::aligneMode_te GetAlignement(void); ewol::Text::aligneMode_te getAlignement(void);
/** /**
* @brief Calculate a theoric text size * @brief calculate a theoric text size
* @param[in] _text The string to calculate dimention. * @param[in] _text The string to calculate dimention.
* @return The theoric size used. * @return The theoric size used.
*/ */
vec3 CalculateSizeHTML(const etk::UString& _text); vec3 calculateSizeHTML(const etk::UString& _text);
/** /**
* @brief Calculate a theoric text size * @brief calculate a theoric text size
* @param[in] _text The string to calculate dimention. * @param[in] _text The string to calculate dimention.
* @return The theoric size used. * @return The theoric size used.
*/ */
vec3 CalculateSizeDecorated(const etk::UString& _text); vec3 calculateSizeDecorated(const etk::UString& _text);
/** /**
* @brief Calculate a theoric text size * @brief calculate a theoric text size
* @param[in] _text The string to calculate dimention. * @param[in] _text The string to calculate dimention.
* @return The theoric size used. * @return The theoric size used.
*/ */
vec3 CalculateSize(const etk::UString& _text); vec3 calculateSize(const etk::UString& _text);
/** /**
* @brief Calculate a theoric charcode size * @brief calculate a theoric charcode size
* @param[in] _charcode The µUnicode value to calculate dimention. * @param[in] _charcode The µUnicode value to calculate dimention.
* @return The theoric size used. * @return The theoric size used.
*/ */
vec3 CalculateSize(const uniChar_t& _charcode); vec3 calculateSize(const uniChar_t& _charcode);
/** /**
* @brief Draw a cursor at the specify position * @brief draw a cursor at the specify position
* @param[in] _isInsertMode True if the insert mode is activated * @param[in] _isInsertMode True if the insert mode is activated
*/ */
void PrintCursor(bool _isInsertMode); void printCursor(bool _isInsertMode);
private: private:
/** /**
* @brief Calculate the element number that is the first out the alignement range * @brief calculate the element number that is the first out the alignement range
* (start at the specify ID, and use start pos with current one) * (start at the specify ID, and use start pos with current one)
* @param[in] _text The string that might be parsed. * @param[in] _text The string that might be parsed.
* @param[in] _start The first elemnt that might be used to calculate. * @param[in] _start The first elemnt that might be used to calculate.
@ -365,7 +365,7 @@ namespace ewol
* @parma[out] _freespace This represent the number of pixel present in the right white space. * @parma[out] _freespace This represent the number of pixel present in the right white space.
* @return true if the rifht has free space that can be use for jystify (return false if we find \n * @return true if the rifht has free space that can be use for jystify (return false if we find \n
*/ */
bool ExtrapolateLastId(const etk::UString& _text, const int32_t _start, int32_t& _stop, int32_t& _space, int32_t& _freeSpace); bool extrapolateLastId(const etk::UString& _text, const int32_t _start, int32_t& _stop, int32_t& _space, int32_t& _freeSpace);
private: private:
// this section is reserved for HTML parsing and display: // this section is reserved for HTML parsing and display:
etk::UString m_htmlCurrrentLine; //!< current line for HTML display etk::UString m_htmlCurrrentLine; //!< current line for HTML display
@ -375,37 +375,37 @@ namespace ewol
* @brief add a line with the current m_htmlDecoTmp decoration * @brief add a line with the current m_htmlDecoTmp decoration
* @param[in] _data The cuurent data to add. * @param[in] _data The cuurent data to add.
*/ */
void HtmlAddData(const etk::UString& _data); void htmlAddData(const etk::UString& _data);
/** /**
* @brief Draw the current line * @brief draw the current line
*/ */
void HtmlFlush(void); void htmlFlush(void);
public: public:
/** /**
* @brief Remove the cursor display * @brief remove the cursor display
*/ */
void DisableCursor(void); void disableCursor(void);
/** /**
* @brief Set a cursor at a specific position: * @brief set a cursor at a specific position:
* @param[in] _cursorPos id of the cursor position * @param[in] _cursorPos id of the cursor position
*/ */
void SetCursorPos(int32_t _cursorPos); void setCursorPos(int32_t _cursorPos);
/** /**
* @brief Set a cursor at a specific position with his associated selection: * @brief set a cursor at a specific position with his associated selection:
* @param[in] _cursorPos id of the cursor position * @param[in] _cursorPos id of the cursor position
* @param[in] _selectionStartPos id of the starting of the selection * @param[in] _selectionStartPos id of the starting of the selection
*/ */
void SetCursorSelection(int32_t _cursorPos, int32_t _selectionStartPos); void setCursorSelection(int32_t _cursorPos, int32_t _selectionStartPos);
/** /**
* @brief Change the selection color * @brief change the selection color
* @param[in] _color New color for the Selection * @param[in] _color New color for the Selection
*/ */
void SetSelectionColor(const etk::Color<>& _color); void setSelectionColor(const etk::Color<>& _color);
/** /**
* @brief Change the cursor color * @brief change the cursor color
* @param[in] _color New color for the Selection * @param[in] _color New color for the Selection
*/ */
void SetCursorColor(const etk::Color<>& _color); void setCursorColor(const etk::Color<>& _color);
}; };
}; };

View File

@ -35,7 +35,7 @@ static const char* cursorDescriptionString[ewol::cursorCount+1] = {
etk::CCout& ewol::operator <<(etk::CCout& _os, const ewol::cursorDisplay_te _obj) etk::CCout& ewol::operator <<(etk::CCout& _os, const ewol::cursorDisplay_te _obj)
{ {
if (_obj>=0 && _obj <ewol::cursorCount) { if (_obj >= 0 && _obj <ewol::cursorCount) {
_os << cursorDescriptionString[_obj]; _os << cursorDescriptionString[_obj];
} else { } else {
_os << "[ERROR]"; _os << "[ERROR]";

View File

@ -19,7 +19,7 @@
#define __class__ "ewol" #define __class__ "ewol"
etk::UString ewol::GetCompilationMode(void) etk::UString ewol::getCompilationMode(void)
{ {
#ifdef MODE_RELEASE #ifdef MODE_RELEASE
return "Release"; return "Release";
@ -28,7 +28,7 @@ etk::UString ewol::GetCompilationMode(void)
#endif #endif
} }
etk::UString ewol::GetBoardType(void) etk::UString ewol::getBoardType(void)
{ {
#ifdef __TARGET_OS__Linux #ifdef __TARGET_OS__Linux
return "Linux"; return "Linux";
@ -45,14 +45,14 @@ etk::UString ewol::GetBoardType(void)
#endif #endif
} }
etk::UString ewol::GetVersion(void) etk::UString ewol::getVersion(void)
{ {
#define FIRST_YEAR (2011) #define FIRST_YEAR (2011)
etk::UString tmpOutput = (date::GetYear()-FIRST_YEAR); etk::UString tmpOutput = (date::getYear()-FIRST_YEAR);
tmpOutput += "."; tmpOutput += ".";
tmpOutput += date::GetMonth(); tmpOutput += date::getMonth();
tmpOutput += "."; tmpOutput += ".";
tmpOutput += date::GetDay(); tmpOutput += date::getDay();
return tmpOutput; return tmpOutput;
} }

View File

@ -27,26 +27,26 @@ namespace ewol
*/ */
int32_t Run(int32_t _argc, const char* _argv[]); int32_t Run(int32_t _argc, const char* _argv[]);
/** /**
* @brief Get EWOL version * @brief get EWOL version
* @return The string that describe ewol version * @return The string that describe ewol version
*/ */
etk::UString GetVersion(void); etk::UString getVersion(void);
/** /**
* @brief Get current time in us... * @brief get current time in us...
* @return The current time * @return The current time
* @note is implemented by the OS implementation cf renderer/X11/... * @note is implemented by the OS implementation cf renderer/X11/...
*/ */
int64_t GetTime(void); int64_t getTime(void);
/** /**
* @brief Get compilation mode (release/debug) * @brief get compilation mode (release/debug)
* @return the string of the mode of commpilation * @return the string of the mode of commpilation
*/ */
etk::UString GetCompilationMode(void); etk::UString getCompilationMode(void);
/** /**
* @brief Get the board type (Android/Linux/MacOs/...) * @brief get the board type (Android/Linux/MacOs/...)
* @return the string of the mode of commpilation * @return the string of the mode of commpilation
*/ */
etk::UString GetBoardType(void); etk::UString getBoardType(void);
}; };
#endif #endif

View File

@ -27,7 +27,7 @@ static const char* statusDescriptionString[ewol::keyEvent::statusCount+1] = {
etk::CCout& ewol::keyEvent::operator <<(etk::CCout& _os, const ewol::keyEvent::status_te _obj) etk::CCout& ewol::keyEvent::operator <<(etk::CCout& _os, const ewol::keyEvent::status_te _obj)
{ {
if (_obj>=0 && _obj <ewol::keyEvent::statusCount) { if (_obj >= 0 && _obj <ewol::keyEvent::statusCount) {
_os << statusDescriptionString[_obj]; _os << statusDescriptionString[_obj];
} else { } else {
_os << "[ERROR]"; _os << "[ERROR]";
@ -79,7 +79,7 @@ static const char* keyboardDescriptionString[ewol::keyEvent::keyboardCount+1] =
etk::CCout& ewol::keyEvent::operator <<(etk::CCout& _os, const ewol::keyEvent::keyboard_te _obj) etk::CCout& ewol::keyEvent::operator <<(etk::CCout& _os, const ewol::keyEvent::keyboard_te _obj)
{ {
if (_obj>=0 && _obj <ewol::keyEvent::keyboardCount) { if (_obj >= 0 && _obj <ewol::keyEvent::keyboardCount) {
_os << keyboardDescriptionString[_obj]; _os << keyboardDescriptionString[_obj];
} else { } else {
_os << "[ERROR]"; _os << "[ERROR]";
@ -98,7 +98,7 @@ static const char* typeDescriptionString[ewol::keyEvent::typeCount+1] = {
etk::CCout& ewol::keyEvent::operator <<(etk::CCout& _os, const ewol::keyEvent::type_te _obj) etk::CCout& ewol::keyEvent::operator <<(etk::CCout& _os, const ewol::keyEvent::type_te _obj)
{ {
if (_obj>=0 && _obj < ewol::keyEvent::typeCount) { if (_obj >= 0 && _obj < ewol::keyEvent::typeCount) {
_os << typeDescriptionString[_obj]; _os << typeDescriptionString[_obj];
} else { } else {
_os << "[ERROR]"; _os << "[ERROR]";
@ -112,41 +112,41 @@ ewol::SpecialKey::SpecialKey(void) :
} }
bool ewol::SpecialKey::IsSetCapsLock(void) const bool ewol::SpecialKey::isSetCapsLock(void) const
{ {
return capLock; return capLock;
} }
bool ewol::SpecialKey::IsSetShift(void) const bool ewol::SpecialKey::isSetShift(void) const
{ {
return shift; return shift;
} }
bool ewol::SpecialKey::IsSetCtrl(void) const bool ewol::SpecialKey::isSetCtrl(void) const
{ {
return ctrl; return ctrl;
} }
bool ewol::SpecialKey::IsSetMeta(void) const bool ewol::SpecialKey::isSetMeta(void) const
{ {
return meta; return meta;
} }
bool ewol::SpecialKey::IsSetAlt(void) const bool ewol::SpecialKey::isSetAlt(void) const
{ {
return alt; return alt;
} }
bool ewol::SpecialKey::IsSetAltGr(void) const bool ewol::SpecialKey::isSetAltGr(void) const
{ {
return altGr; return altGr;
} }
bool ewol::SpecialKey::IsSetNumLock(void) const bool ewol::SpecialKey::isSetNumLock(void) const
{ {
return numLock; return numLock;
} }
bool ewol::SpecialKey::IsSetInsert(void) const bool ewol::SpecialKey::isSetInsert(void) const
{ {
return insert; return insert;
} }

View File

@ -67,10 +67,10 @@ namespace ewol
keyboardPageDown, //!< page down key keyboardPageDown, //!< page down key
keyboardStart, //!< Start key keyboardStart, //!< Start key
keyboardEnd, //!< End key keyboardEnd, //!< End key
keyboardPrint, //!< Print screen key. keyboardPrint, //!< print screen key.
keyboardStopDefil, //!< Stop display key. keyboardStopDefil, //!< Stop display key.
keyboardWait, //!< Wait key. keyboardWait, //!< Wait key.
keyboardInsert, //!< Insert key. keyboardInsert, //!< insert key.
keyboardF1, //!< F1 key. keyboardF1, //!< F1 key.
keyboardF2, //!< F2 key. keyboardF2, //!< F2 key.
keyboardF3, //!< F3 key. keyboardF3, //!< F3 key.
@ -124,45 +124,45 @@ namespace ewol
*/ */
SpecialKey(void); SpecialKey(void);
/** /**
* @brief Get the current CapLock Status * @brief get the current CapLock Status
* @return The status value * @return The status value
*/ */
bool IsSetCapsLock(void) const; bool isSetCapsLock(void) const;
/** /**
* @brief Get the current Shift key status * @brief get the current Shift key status
* @return The status value * @return The status value
*/ */
bool IsSetShift(void) const; bool isSetShift(void) const;
/** /**
* @brief Get the Current Control key status * @brief get the Current Control key status
* @return The status value * @return The status value
*/ */
bool IsSetCtrl(void) const; bool isSetCtrl(void) const;
/** /**
* @brief Get the current Meta key status (also named windows or apple key) * @brief get the current Meta key status (also named windows or apple key)
* @return The status value * @return The status value
*/ */
bool IsSetMeta(void) const; bool isSetMeta(void) const;
/** /**
* @brief Get the current Alt key status * @brief get the current Alt key status
* @return The status value * @return The status value
*/ */
bool IsSetAlt(void) const; bool isSetAlt(void) const;
/** /**
* @brief Get the current Alt-Gr key status * @brief get the current Alt-Gr key status
* @return The status value * @return The status value
*/ */
bool IsSetAltGr(void) const; bool isSetAltGr(void) const;
/** /**
* @brief Get the current Ver-num key status * @brief get the current Ver-num key status
* @return The status value * @return The status value
*/ */
bool IsSetNumLock(void) const; bool isSetNumLock(void) const;
/** /**
* @brief Get the current Intert key status * @brief get the current Intert key status
* @return The status value * @return The status value
*/ */
bool IsSetInsert(void) const; bool isSetInsert(void) const;
}; };
/** /**
* @brief Debug operator To display the curent element in a Human redeable information * @brief Debug operator To display the curent element in a Human redeable information

View File

@ -10,12 +10,12 @@
bool ewol::PhysicsBox::Parse(const char* _line) bool ewol::PhysicsBox::parse(const char* _line)
{ {
if (true== ewol::PhysicsShape::Parse(_line)) { if (true == ewol::PhysicsShape::parse(_line)) {
return true; return true;
} }
if(0==strncmp(_line, "half-extents : ", 15) ) { if(0 == strncmp(_line, "half-extents : ", 15) ) {
sscanf(&_line[15], "%f %f %f", &m_size.m_floats[0], &m_size.m_floats[1], &m_size.m_floats[2] ); sscanf(&_line[15], "%f %f %f", &m_size.m_floats[0], &m_size.m_floats[1], &m_size.m_floats[2] );
EWOL_DEBUG(" halfSize=" << m_size); EWOL_DEBUG(" halfSize=" << m_size);
return true; return true;

View File

@ -21,17 +21,17 @@ namespace ewol
PhysicsBox(void) {}; PhysicsBox(void) {};
virtual ~PhysicsBox(void) {}; virtual ~PhysicsBox(void) {};
public: public:
virtual bool Parse(const char* _line); virtual bool parse(const char* _line);
virtual void Display(void) {}; virtual void display(void) {};
public: public:
virtual type_te GetType(void) { return ewol::PhysicsShape::box; }; virtual type_te getType(void) { return ewol::PhysicsShape::box; };
private: private:
vec3 m_size; // Box size property in X, Y and Z vec3 m_size; // Box size property in X, Y and Z
public: public:
const vec3& GetSize(void) const { return m_size; }; const vec3& getSize(void) const { return m_size; };
public: public:
virtual const PhysicsBox* ToBox(void) const { return this; }; virtual const PhysicsBox* toBox(void) const { return this; };
virtual PhysicsBox* ToBox(void) { return this; }; virtual PhysicsBox* toBox(void) { return this; };
}; };
}; };

View File

@ -10,17 +10,17 @@
bool ewol::PhysicsCapsule::Parse(const char* _line) bool ewol::PhysicsCapsule::parse(const char* _line)
{ {
if (true== ewol::PhysicsShape::Parse(_line)) { if (true == ewol::PhysicsShape::parse(_line)) {
return true; return true;
} }
if(0==strncmp(_line, "radius : ", 9) ) { if(0 == strncmp(_line, "radius : ", 9) ) {
sscanf(&_line[9], "%f", &m_radius ); sscanf(&_line[9], "%f", &m_radius );
EWOL_DEBUG(" radius=" << m_radius); EWOL_DEBUG(" radius=" << m_radius);
return true; return true;
} }
if(0==strncmp(_line, "height : ", 9) ) { if(0 == strncmp(_line, "height : ", 9) ) {
sscanf(&_line[9], "%f", &m_height ); sscanf(&_line[9], "%f", &m_height );
EWOL_DEBUG(" height=" << m_height); EWOL_DEBUG(" height=" << m_height);
return true; return true;

View File

@ -22,21 +22,21 @@ namespace ewol
PhysicsCapsule(void) {}; PhysicsCapsule(void) {};
virtual ~PhysicsCapsule(void) {}; virtual ~PhysicsCapsule(void) {};
public: public:
virtual bool Parse(const char* _line); virtual bool parse(const char* _line);
virtual void Display(void) {}; virtual void display(void) {};
public: public:
virtual type_te GetType(void) { return ewol::PhysicsShape::capsule; }; virtual type_te getType(void) { return ewol::PhysicsShape::capsule; };
private: private:
float m_radius; float m_radius;
public: public:
float GetRadius(void) const { return m_radius; }; float getRadius(void) const { return m_radius; };
private: private:
float m_height; float m_height;
public: public:
float GetHeight(void) const { return m_height; }; float getHeight(void) const { return m_height; };
public: public:
virtual const PhysicsCapsule* ToCapsule(void) const { return this; }; virtual const PhysicsCapsule* toCapsule(void) const { return this; };
virtual PhysicsCapsule* ToCapsule(void) { return this; }; virtual PhysicsCapsule* toCapsule(void) { return this; };
}; };
}; };

View File

@ -10,17 +10,17 @@
bool ewol::PhysicsCone::Parse(const char* _line) bool ewol::PhysicsCone::parse(const char* _line)
{ {
if (true== ewol::PhysicsShape::Parse(_line)) { if (true == ewol::PhysicsShape::parse(_line)) {
return true; return true;
} }
if(0==strncmp(_line, "radius : ", 9) ) { if(0 == strncmp(_line, "radius : ", 9) ) {
sscanf(&_line[9], "%f", &m_radius ); sscanf(&_line[9], "%f", &m_radius );
EWOL_DEBUG(" radius=" << m_radius); EWOL_DEBUG(" radius=" << m_radius);
return true; return true;
} }
if(0==strncmp(_line, "height : ", 9) ) { if(0 == strncmp(_line, "height : ", 9) ) {
sscanf(&_line[9], "%f", &m_height ); sscanf(&_line[9], "%f", &m_height );
EWOL_DEBUG(" height=" << m_height); EWOL_DEBUG(" height=" << m_height);
return true; return true;

View File

@ -22,21 +22,21 @@ namespace ewol
PhysicsCone(void) {}; PhysicsCone(void) {};
virtual ~PhysicsCone(void) {}; virtual ~PhysicsCone(void) {};
public: public:
virtual bool Parse(const char* _line); virtual bool parse(const char* _line);
virtual void Display(void) {}; virtual void display(void) {};
public: public:
virtual type_te GetType(void) { return ewol::PhysicsShape::cone; }; virtual type_te getType(void) { return ewol::PhysicsShape::cone; };
private: private:
float m_radius; float m_radius;
public: public:
float GetRadius(void) const { return m_radius; }; float getRadius(void) const { return m_radius; };
private: private:
float m_height; float m_height;
public: public:
float GetHeight(void) const { return m_height; }; float getHeight(void) const { return m_height; };
public: public:
virtual const PhysicsCone* ToCone(void) const { return this; }; virtual const PhysicsCone* toCone(void) const { return this; };
virtual PhysicsCone* ToCone(void) { return this; }; virtual PhysicsCone* toCone(void) { return this; };
}; };
}; };

View File

@ -10,12 +10,12 @@
bool ewol::PhysicsConvexHull::Parse(const char* _line) bool ewol::PhysicsConvexHull::parse(const char* _line)
{ {
if (true== ewol::PhysicsShape::Parse(_line)) { if (true == ewol::PhysicsShape::parse(_line)) {
return true; return true;
} }
if(0==strncmp(_line, "points : ", 8) ) { if(0 == strncmp(_line, "points : ", 8) ) {
//EWOL_DEBUG("convex hull point parsing " << _line); //EWOL_DEBUG("convex hull point parsing " << _line);
char* base = (char*)(&_line[8]); char* base = (char*)(&_line[8]);
char* tmp= strchr(base, '|'); char* tmp= strchr(base, '|');
@ -23,20 +23,20 @@ bool ewol::PhysicsConvexHull::Parse(const char* _line)
while (tmp != NULL) { while (tmp != NULL) {
*tmp = '\0'; *tmp = '\0';
sscanf(base, "%f %f %f", &pos.m_floats[0], &pos.m_floats[1], &pos.m_floats[2] ); sscanf(base, "%f %f %f", &pos.m_floats[0], &pos.m_floats[1], &pos.m_floats[2] );
m_points.PushBack(pos); m_points.pushBack(pos);
base = tmp+1; base = tmp+1;
tmp= strchr(base, '|'); tmp= strchr(base, '|');
} }
sscanf(base, "%f %f %f", &pos.m_floats[0], &pos.m_floats[1], &pos.m_floats[2] ); sscanf(base, "%f %f %f", &pos.m_floats[0], &pos.m_floats[1], &pos.m_floats[2] );
m_points.PushBack(pos); m_points.pushBack(pos);
/* /*
for (int32_t iii=0; iii<m_points.Size(); iii++) { for (int32_t iii=0; iii<m_points.size(); iii++) {
EWOL_DEBUG(" parsed " << m_points[iii]); EWOL_DEBUG(" parsed " << m_points[iii]);
} }
*/ */
return true; return true;
} }
if(0==strncmp(_line, "scale : ", 8) ) { if(0 == strncmp(_line, "scale : ", 8) ) {
sscanf(&_line[8], "%f %f %f", &m_scale.m_floats[0], &m_scale.m_floats[1], &m_scale.m_floats[2] ); sscanf(&_line[8], "%f %f %f", &m_scale.m_floats[0], &m_scale.m_floats[1], &m_scale.m_floats[2] );
EWOL_DEBUG(" scale=" << m_scale); EWOL_DEBUG(" scale=" << m_scale);
return true; return true;

View File

@ -22,21 +22,21 @@ namespace ewol
PhysicsConvexHull(void) {}; PhysicsConvexHull(void) {};
virtual ~PhysicsConvexHull(void) {}; virtual ~PhysicsConvexHull(void) {};
public: public:
virtual bool Parse(const char* _line); virtual bool parse(const char* _line);
virtual void Display(void) {}; virtual void display(void) {};
public: public:
virtual type_te GetType(void) { return ewol::PhysicsShape::convexHull; }; virtual type_te getType(void) { return ewol::PhysicsShape::convexHull; };
private: private:
vec3 m_scale; vec3 m_scale;
public: public:
vec3 GetScale(void) const { return m_scale; }; vec3 getScale(void) const { return m_scale; };
private: private:
etk::Vector<vec3> m_points; etk::Vector<vec3> m_points;
public: public:
const etk::Vector<vec3>& GetPointList(void) const { return m_points; }; const etk::Vector<vec3>& getPointList(void) const { return m_points; };
public: public:
virtual const PhysicsConvexHull* ToConvexHull(void) const { return this; }; virtual const PhysicsConvexHull* toConvexHull(void) const { return this; };
virtual PhysicsConvexHull* ToConvexHull(void) { return this; }; virtual PhysicsConvexHull* toConvexHull(void) { return this; };
}; };
}; };

View File

@ -9,12 +9,12 @@
#include <ewol/physicsShape/PhysicsCylinder.h> #include <ewol/physicsShape/PhysicsCylinder.h>
bool ewol::PhysicsCylinder::Parse(const char* _line) bool ewol::PhysicsCylinder::parse(const char* _line)
{ {
if (true== ewol::PhysicsShape::Parse(_line)) { if (true == ewol::PhysicsShape::parse(_line)) {
return true; return true;
} }
if(0==strncmp(_line, "half-extents : ", 15) ) { if(0 == strncmp(_line, "half-extents : ", 15) ) {
sscanf(&_line[15], "%f %f %f", &m_size.m_floats[0], &m_size.m_floats[1], &m_size.m_floats[2] ); sscanf(&_line[15], "%f %f %f", &m_size.m_floats[0], &m_size.m_floats[1], &m_size.m_floats[2] );
EWOL_DEBUG(" halfSize=" << m_size); EWOL_DEBUG(" halfSize=" << m_size);
return true; return true;

View File

@ -22,17 +22,17 @@ namespace ewol
PhysicsCylinder(void) {}; PhysicsCylinder(void) {};
virtual ~PhysicsCylinder(void) {}; virtual ~PhysicsCylinder(void) {};
public: public:
virtual bool Parse(const char* _line); virtual bool parse(const char* _line);
virtual void Display(void) {}; virtual void display(void) {};
public: public:
virtual type_te GetType(void) { return ewol::PhysicsShape::cylinder; }; virtual type_te getType(void) { return ewol::PhysicsShape::cylinder; };
private: private:
vec3 m_size; vec3 m_size;
public: public:
vec3 GetSize(void) const { return m_size; }; vec3 getSize(void) const { return m_size; };
public: public:
virtual const PhysicsCylinder* ToCylinder(void) const { return this; }; virtual const PhysicsCylinder* toCylinder(void) const { return this; };
virtual PhysicsCylinder* ToCylinder(void) { return this; }; virtual PhysicsCylinder* toCylinder(void) { return this; };
}; };
}; };

View File

@ -15,10 +15,10 @@
#include <ewol/physicsShape/PhysicsSphere.h> #include <ewol/physicsShape/PhysicsSphere.h>
ewol::PhysicsShape* ewol::PhysicsShape::Create(const etk::UString& _name) ewol::PhysicsShape* ewol::PhysicsShape::create(const etk::UString& _name)
{ {
ewol::PhysicsShape* tmpp = NULL; ewol::PhysicsShape* tmpp = NULL;
etk::UString name = _name.ToLower(); etk::UString name = _name.toLower();
if (name == "box") { if (name == "box") {
tmpp = new ewol::PhysicsBox(); tmpp = new ewol::PhysicsBox();
} else if (name == "sphere") { } else if (name == "sphere") {
@ -35,23 +35,23 @@ ewol::PhysicsShape* ewol::PhysicsShape::Create(const etk::UString& _name)
EWOL_ERROR("Create an unknow element : '" << _name << "' availlable : [BOX,SPHERE,CONE,CYLINDER,CAPSULE,CONVEXHULL]"); EWOL_ERROR("Create an unknow element : '" << _name << "' availlable : [BOX,SPHERE,CONE,CYLINDER,CAPSULE,CONVEXHULL]");
return NULL; return NULL;
} }
if (tmpp==NULL) { if (tmpp == NULL) {
EWOL_ERROR("Allocation error for physical element : '" << _name << "'"); EWOL_ERROR("Allocation error for physical element : '" << _name << "'");
} }
return tmpp; return tmpp;
} }
bool ewol::PhysicsShape::Parse(const char* _line) bool ewol::PhysicsShape::parse(const char* _line)
{ {
if(0==strncmp(_line, "origin : ", 9) ) { if(0 == strncmp(_line, "origin : ", 9) ) {
sscanf(&_line[9], "%f %f %f", &m_origin.m_floats[0], &m_origin.m_floats[1], &m_origin.m_floats[2] ); sscanf(&_line[9], "%f %f %f", &m_origin.m_floats[0], &m_origin.m_floats[1], &m_origin.m_floats[2] );
EWOL_DEBUG(" Origin=" << m_origin); EWOL_DEBUG(" Origin=" << m_origin);
return true; return true;
} }
if(0==strncmp(_line, "rotate : ", 9) ) { if(0 == strncmp(_line, "rotate : ", 9) ) {
sscanf(&_line[9], "%f %f %f %f", &m_quaternion.m_floats[0], &m_quaternion.m_floats[1], &m_quaternion.m_floats[2], &m_quaternion.m_floats[3] ); sscanf(&_line[9], "%f %f %f %f", &m_quaternion.m_floats[0], &m_quaternion.m_floats[1], &m_quaternion.m_floats[2], &m_quaternion.m_floats[3] );
EWOL_DEBUG(" Rotate=" << m_quaternion); EWOL_DEBUG(" rotate=" << m_quaternion);
return true; return true;
} }
return false; return false;

View File

@ -28,7 +28,7 @@ namespace ewol
class PhysicsShape class PhysicsShape
{ {
public: public:
static PhysicsShape* Create(const etk::UString& _name); static PhysicsShape* create(const etk::UString& _name);
public: public:
typedef enum { typedef enum {
unknow, unknow,
@ -43,44 +43,44 @@ namespace ewol
PhysicsShape(void) : m_quaternion(1,0,0,0), m_origin(0,0,0) {}; PhysicsShape(void) : m_quaternion(1,0,0,0), m_origin(0,0,0) {};
virtual ~PhysicsShape(void) {}; virtual ~PhysicsShape(void) {};
public: public:
virtual type_te GetType(void) { return ewol::PhysicsShape::unknow; }; virtual type_te getType(void) { return ewol::PhysicsShape::unknow; };
public: public:
virtual bool Parse(const char* _line); virtual bool parse(const char* _line);
virtual void Display(void) {}; virtual void display(void) {};
private: private:
vec4 m_quaternion; vec4 m_quaternion;
public: public:
vec4 GetQuaternion(void) const { return m_quaternion; }; vec4 getQuaternion(void) const { return m_quaternion; };
private: private:
vec3 m_origin; vec3 m_origin;
public: public:
vec3 GetOrigin(void) const { return m_origin; }; vec3 getOrigin(void) const { return m_origin; };
public: public:
bool IsBox(void) { return GetType()==ewol::PhysicsShape::box; }; bool isBox(void) { return getType() == ewol::PhysicsShape::box; };
bool IsCylinder(void) { return GetType()==ewol::PhysicsShape::cylinder; }; bool isCylinder(void) { return getType() == ewol::PhysicsShape::cylinder; };
bool IsCapsule(void) { return GetType()==ewol::PhysicsShape::capsule; }; bool isCapsule(void) { return getType() == ewol::PhysicsShape::capsule; };
bool IsCone(void) { return GetType()==ewol::PhysicsShape::cone; }; bool isCone(void) { return getType() == ewol::PhysicsShape::cone; };
bool IsConvexHull(void) { return GetType()==ewol::PhysicsShape::convexHull; }; bool isConvexHull(void) { return getType() == ewol::PhysicsShape::convexHull; };
bool IsSphere(void) { return GetType()==ewol::PhysicsShape::sphere; }; bool isSphere(void) { return getType() == ewol::PhysicsShape::sphere; };
virtual const PhysicsBox* ToBox(void) const { return NULL; }; virtual const PhysicsBox* toBox(void) const { return NULL; };
virtual PhysicsBox* ToBox(void) { return NULL; }; virtual PhysicsBox* toBox(void) { return NULL; };
virtual const PhysicsCylinder* ToCylinder(void) const { return NULL; }; virtual const PhysicsCylinder* toCylinder(void) const { return NULL; };
virtual PhysicsCylinder* ToCylinder(void) { return NULL; }; virtual PhysicsCylinder* toCylinder(void) { return NULL; };
virtual const PhysicsCapsule* ToCapsule(void) const { return NULL; }; virtual const PhysicsCapsule* toCapsule(void) const { return NULL; };
virtual PhysicsCapsule* ToCapsule(void) { return NULL; }; virtual PhysicsCapsule* toCapsule(void) { return NULL; };
virtual const PhysicsCone* ToCone(void) const { return NULL; }; virtual const PhysicsCone* toCone(void) const { return NULL; };
virtual PhysicsCone* ToCone(void) { return NULL; }; virtual PhysicsCone* toCone(void) { return NULL; };
virtual const PhysicsConvexHull* ToConvexHull(void) const { return NULL; }; virtual const PhysicsConvexHull* toConvexHull(void) const { return NULL; };
virtual PhysicsConvexHull* ToConvexHull(void) { return NULL; }; virtual PhysicsConvexHull* toConvexHull(void) { return NULL; };
virtual const PhysicsSphere* ToSphere(void) const { return NULL; }; virtual const PhysicsSphere* toSphere(void) const { return NULL; };
virtual PhysicsSphere* ToSphere(void) { return NULL; }; virtual PhysicsSphere* toSphere(void) { return NULL; };
}; };
}; };

View File

@ -10,12 +10,12 @@
bool ewol::PhysicsSphere::Parse(const char* _line) bool ewol::PhysicsSphere::parse(const char* _line)
{ {
if (true== ewol::PhysicsShape::Parse(_line)) { if (true == ewol::PhysicsShape::parse(_line)) {
return true; return true;
} }
if(0==strncmp(_line, "radius : ", 9) ) { if(0 == strncmp(_line, "radius : ", 9) ) {
sscanf(&_line[9], "%f", &m_radius ); sscanf(&_line[9], "%f", &m_radius );
EWOL_DEBUG(" radius=" << m_radius); EWOL_DEBUG(" radius=" << m_radius);
return true; return true;

View File

@ -22,17 +22,17 @@ namespace ewol
PhysicsSphere(void) {}; PhysicsSphere(void) {};
virtual ~PhysicsSphere(void) {}; virtual ~PhysicsSphere(void) {};
public: public:
virtual bool Parse(const char* _line); virtual bool parse(const char* _line);
virtual void Display(void) {}; virtual void display(void) {};
public: public:
virtual type_te GetType(void) { return ewol::PhysicsShape::sphere; }; virtual type_te getType(void) { return ewol::PhysicsShape::sphere; };
private: private:
float m_radius; // props["radius"] = obj.scale.x float m_radius; // props["radius"] = obj.scale.x
public: public:
float GetRadius(void) const { return m_radius; }; float getRadius(void) const { return m_radius; };
private: private:
virtual const PhysicsSphere* ToSphere(void) const { return this; }; virtual const PhysicsSphere* toSphere(void) const { return this; };
virtual PhysicsSphere* ToSphere(void) { return this; }; virtual PhysicsSphere* toSphere(void) { return this; };
}; };
}; };

View File

@ -20,7 +20,7 @@
int64_t ewol::GetTime(void) int64_t ewol::getTime(void)
{ {
struct timeval now; struct timeval now;
gettimeofday(&now, NULL); gettimeofday(&now, NULL);
@ -68,7 +68,7 @@ class AndroidContext : public ewol::eContext
private: private:
bool SafeInitMethodID(jmethodID& _mid, jclass& _cls, char* _name, char* _sign) bool SafeInitMethodID(jmethodID& _mid, jclass& _cls, char* _name, char* _sign)
{ {
_mid = m_JavaVirtualMachinePointer->GetMethodID(_cls, _name, _sign); _mid = m_JavaVirtualMachinePointer->getMethodID(_cls, _name, _sign);
if(_mid == NULL) { if(_mid == NULL) {
EWOL_ERROR("C->java : Can't find the method " << _name); EWOL_ERROR("C->java : Can't find the method " << _name);
/* remove access on the virtual machine : */ /* remove access on the virtual machine : */
@ -95,16 +95,16 @@ class AndroidContext : public ewol::eContext
{ {
EWOL_DEBUG("*******************************************"); EWOL_DEBUG("*******************************************");
if (m_javaApplicationType == appl_application) { if (m_javaApplicationType == appl_application) {
EWOL_DEBUG("** Set JVM Pointer (application) **"); EWOL_DEBUG("** set JVM Pointer (application) **");
} else { } else {
EWOL_DEBUG("** Set JVM Pointer (LiveWallpaper) **"); EWOL_DEBUG("** set JVM Pointer (LiveWallpaper) **");
} }
EWOL_DEBUG("*******************************************"); EWOL_DEBUG("*******************************************");
m_JavaVirtualMachinePointer = _env; m_JavaVirtualMachinePointer = _env;
// get default needed all time elements : // get default needed all time elements :
if (NULL != m_JavaVirtualMachinePointer) { if (NULL != m_JavaVirtualMachinePointer) {
EWOL_DEBUG("C->java : try load org/ewol/Ewol class"); EWOL_DEBUG("C->java : try load org/ewol/Ewol class");
m_javaClassEwol = m_JavaVirtualMachinePointer->FindClass("org/ewol/Ewol" ); m_javaClassEwol = m_JavaVirtualMachinePointer->findClass("org/ewol/Ewol" );
if (m_javaClassEwol == 0) { if (m_javaClassEwol == 0) {
EWOL_ERROR("C->java : Can't find org/ewol/Ewol class"); EWOL_ERROR("C->java : Can't find org/ewol/Ewol class");
// remove access on the virtual machine : // remove access on the virtual machine :
@ -112,7 +112,7 @@ class AndroidContext : public ewol::eContext
return; return;
} }
/* The object field extends Activity and implement EwolCallback */ /* The object field extends Activity and implement EwolCallback */
m_javaClassEwolCallback = m_JavaVirtualMachinePointer->GetObjectClass(_objCallback); m_javaClassEwolCallback = m_JavaVirtualMachinePointer->getObjectClass(_objCallback);
if(m_javaClassEwolCallback == NULL) { if(m_javaClassEwolCallback == NULL) {
EWOL_ERROR("C->java : Can't find org/ewol/EwolCallback class"); EWOL_ERROR("C->java : Can't find org/ewol/EwolCallback class");
// remove access on the virtual machine : // remove access on the virtual machine :
@ -124,7 +124,7 @@ class AndroidContext : public ewol::eContext
m_javaClassEwolCallback, m_javaClassEwolCallback,
"titleSet", "titleSet",
"(Ljava/lang/String;)V"); "(Ljava/lang/String;)V");
if (ret==false) { if (ret == false) {
java_check_exception(_env); java_check_exception(_env);
return; return;
} }
@ -132,7 +132,7 @@ class AndroidContext : public ewol::eContext
m_javaClassEwolCallback, m_javaClassEwolCallback,
"stop", "stop",
"()V"); "()V");
if (ret==false) { if (ret == false) {
java_check_exception(_env); java_check_exception(_env);
return; return;
} }
@ -141,7 +141,7 @@ class AndroidContext : public ewol::eContext
m_javaClassEwolCallback, m_javaClassEwolCallback,
"eventNotifier", "eventNotifier",
"([Ljava/lang/String;)V"); "([Ljava/lang/String;)V");
if (ret==false) { if (ret == false) {
java_check_exception(_env); java_check_exception(_env);
return; return;
} }
@ -150,7 +150,7 @@ class AndroidContext : public ewol::eContext
m_javaClassEwolCallback, m_javaClassEwolCallback,
"keyboardUpdate", "keyboardUpdate",
"(Z)V"); "(Z)V");
if (ret==false) { if (ret == false) {
java_check_exception(_env); java_check_exception(_env);
return; return;
} }
@ -159,7 +159,7 @@ class AndroidContext : public ewol::eContext
m_javaClassEwolCallback, m_javaClassEwolCallback,
"orientationUpdate", "orientationUpdate",
"(I)V"); "(I)V");
if (ret==false) { if (ret == false) {
java_check_exception(_env); java_check_exception(_env);
return; return;
} }
@ -167,7 +167,7 @@ class AndroidContext : public ewol::eContext
m_javaObjectEwolCallback = _env->NewGlobalRef(_objCallback); m_javaObjectEwolCallback = _env->NewGlobalRef(_objCallback);
//javaObjectEwolCallbackAndActivity = objCallback; //javaObjectEwolCallbackAndActivity = objCallback;
m_javaDefaultClassString = m_JavaVirtualMachinePointer->FindClass("java/lang/String" ); m_javaDefaultClassString = m_JavaVirtualMachinePointer->findClass("java/lang/String" );
if (m_javaDefaultClassString == 0) { if (m_javaDefaultClassString == 0) {
EWOL_ERROR("C->java : Can't find java/lang/String" ); EWOL_ERROR("C->java : Can't find java/lang/String" );
// remove access on the virtual machine : // remove access on the virtual machine :
@ -212,7 +212,7 @@ class AndroidContext : public ewol::eContext
void ClipBoardGet(ewol::clipBoard::clipboardListe_te _clipboardID) void ClipBoardGet(ewol::clipBoard::clipboardListe_te _clipboardID)
{ {
// this is to force the local system to think we have the buffer // this is to force the local system to think we have the buffer
// TODO : Remove this 2 Line when code will be writen // TODO : remove this 2 line when code will be writen
m_clipBoardOwnerStd = true; m_clipBoardOwnerStd = true;
switch (_clipboardID) switch (_clipboardID)
{ {
@ -223,7 +223,7 @@ class AndroidContext : public ewol::eContext
break; break;
case ewol::clipBoard::clipboardStd: case ewol::clipBoard::clipboardStd:
if (false == m_clipBoardOwnerStd) { if (false == m_clipBoardOwnerStd) {
// Generate a request TO the OS // generate a request TO the OS
// TODO : Send the message to the OS "We disire to receive the copy buffer ... // TODO : Send the message to the OS "We disire to receive the copy buffer ...
} else { } else {
// just transmit an event , we have the data in the system // just transmit an event , we have the data in the system
@ -266,7 +266,7 @@ class AndroidContext : public ewol::eContext
return false; return false;
} }
JNIEnv *JavaVirtualMachinePointer_tmp; JNIEnv *JavaVirtualMachinePointer_tmp;
*_rstatus = g_JavaVM->GetEnv((void **) &JavaVirtualMachinePointer_tmp, JNI_VERSION_1_6); *_rstatus = g_JavaVM->getEnv((void **) &JavaVirtualMachinePointer_tmp, JNI_VERSION_1_6);
if (*_rstatus == JNI_EDETACHED) { if (*_rstatus == JNI_EDETACHED) {
JavaVMAttachArgs lJavaVMAttachArgs; JavaVMAttachArgs lJavaVMAttachArgs;
lJavaVMAttachArgs.version = JNI_VERSION_1_6; lJavaVMAttachArgs.version = JNI_VERSION_1_6;
@ -306,7 +306,7 @@ class AndroidContext : public ewol::eContext
void KeyboardHide(void) { SendJavaKeyboardUpdate(JNI_FALSE); }; void KeyboardHide(void) { SendJavaKeyboardUpdate(JNI_FALSE); };
// mode 0 : auto; 1 landscape, 2 portrait // mode 0 : auto; 1 landscape, 2 portrait
void ForceOrientation(ewol::orientation_te _orientation) void forceOrientation(ewol::orientation_te _orientation)
{ {
#ifndef __ANDROID_PERMISSION__SET_ORIENTATION__ #ifndef __ANDROID_PERMISSION__SET_ORIENTATION__
EWOL_ERROR("C->java : call set orientation without Allow application to do it ... Break..."); EWOL_ERROR("C->java : call set orientation without Allow application to do it ... Break...");
@ -327,7 +327,7 @@ class AndroidContext : public ewol::eContext
#endif #endif
} }
void SetTitle(etk::UString& _title) void setTitle(etk::UString& _title)
{ {
EWOL_DEBUG("C->java : send message to the java : \"" << _title << "\""); EWOL_DEBUG("C->java : send message to the java : \"" << _title << "\"");
if (m_javaApplicationType == appl_application) { if (m_javaApplicationType == appl_application) {
@ -419,7 +419,7 @@ static etk::Vector<AndroidContext*> s_listInstance;
extern "C" extern "C"
{ {
// JNI OnLoad // JNI onLoad
JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM* _jvm, void* _reserved) JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM* _jvm, void* _reserved)
{ {
// get the java virtual machine handle ... // get the java virtual machine handle ...
@ -427,7 +427,7 @@ extern "C"
EWOL_DEBUG("JNI-> load the jvm ..." ); EWOL_DEBUG("JNI-> load the jvm ..." );
return JNI_VERSION_1_6; return JNI_VERSION_1_6;
} }
// JNI OnUnLoad // JNI onUnLoad
JNIEXPORT void JNICALL JNI_OnUnload(JavaVM* _vm, void *_reserved) JNIEXPORT void JNICALL JNI_OnUnload(JavaVM* _vm, void *_reserved)
{ {
g_JavaVM = NULL; g_JavaVM = NULL;
@ -437,21 +437,21 @@ extern "C"
/* Call to initialize the graphics state */ /* Call to initialize the graphics state */
void Java_org_ewol_Ewol_EWparamSetArchiveDir(JNIEnv* _env, jclass _cls, jint _id, jint _mode, jstring _myString) void Java_org_ewol_Ewol_EWparamSetArchiveDir(JNIEnv* _env, jclass _cls, jint _id, jint _mode, jstring _myString)
{ {
if( _id>=s_listInstance.Size() if( _id >= s_listInstance.size()
|| _id<0 || _id<0
|| NULL==s_listInstance[_id] ) { || NULL == s_listInstance[_id] ) {
EWOL_ERROR("Call C With an incorrect instance _id=" << (int32_t)_id); EWOL_ERROR("Call C With an incorrect instance _id=" << (int32_t)_id);
// TODO : Generate error in java to stop the current instance // TODO : generate error in java to stop the current instance
return; return;
} }
//EWOL_CRITICAL(" call with ID : " << _id); //EWOL_CRITICAL(" call with ID : " << _id);
// direct setting of the date in the string system ... // direct setting of the date in the string system ...
jboolean isCopy; jboolean isCopy;
const char* str = _env->GetStringUTFChars(_myString, &isCopy); const char* str = _env->getStringUTFChars(_myString, &isCopy);
s_listInstance[_id]->SetArchiveDir(_mode, str); s_listInstance[_id]->setArchiveDir(_mode, str);
if (isCopy == JNI_TRUE) { if (isCopy == JNI_TRUE) {
// from here str is reset ... // from here str is reset ...
_env->ReleaseStringUTFChars(_myString, str); _env->releaseStringUTFChars(_myString, str);
str = NULL; str = NULL;
} }
} }
@ -471,26 +471,26 @@ extern "C"
return -1; return -1;
} }
if (NULL == tmpContext) { if (NULL == tmpContext) {
EWOL_ERROR("Can not allocate the main context instance _id=" << (s_listInstance.Size()-1)); EWOL_ERROR("Can not allocate the main context instance _id=" << (s_listInstance.size()-1));
return -1; return -1;
} }
// for future case : all time this ... // for future case : all time this ...
s_listInstance.PushBack(tmpContext); s_listInstance.pushBack(tmpContext);
int32_t newID = s_listInstance.Size()-1; int32_t newID = s_listInstance.size()-1;
return newID; return newID;
} }
void Java_org_ewol_Ewol_EWsetJavaVirtualMachineStop(JNIEnv* _env, jclass _cls, jint _id) void Java_org_ewol_Ewol_EWsetJavaVirtualMachineStop(JNIEnv* _env, jclass _cls, jint _id)
{ {
EWOL_DEBUG("*******************************************"); EWOL_DEBUG("*******************************************");
EWOL_DEBUG("** Remove JVM Pointer **"); EWOL_DEBUG("** remove JVM Pointer **");
EWOL_DEBUG("*******************************************"); EWOL_DEBUG("*******************************************");
if( _id>=s_listInstance.Size() if( _id >= s_listInstance.size()
|| _id<0) { || _id<0) {
EWOL_ERROR("Call C With an incorrect instance _id=" << (int32_t)_id); EWOL_ERROR("Call C With an incorrect instance _id=" << (int32_t)_id);
return; return;
} }
if (NULL==s_listInstance[_id]) { if (NULL == s_listInstance[_id]) {
EWOL_ERROR("the requested instance _id=" << (int32_t)_id << " is already removed ..."); EWOL_ERROR("the requested instance _id=" << (int32_t)_id << " is already removed ...");
return; return;
} }
@ -500,12 +500,12 @@ extern "C"
} }
void Java_org_ewol_Ewol_EWtouchEvent(JNIEnv* _env, jobject _thiz, jint _id) void Java_org_ewol_Ewol_EWtouchEvent(JNIEnv* _env, jobject _thiz, jint _id)
{ {
EWOL_DEBUG(" ==> Touch Event"); EWOL_DEBUG(" == > Touch Event");
if( _id>=s_listInstance.Size() if( _id >= s_listInstance.size()
|| _id<0 || _id<0
|| NULL==s_listInstance[_id] ) { || NULL == s_listInstance[_id] ) {
EWOL_ERROR("Call C With an incorrect instance _id=" << (int32_t)_id); EWOL_ERROR("Call C With an incorrect instance _id=" << (int32_t)_id);
// TODO : Generate error in java to stop the current instance // TODO : generate error in java to stop the current instance
return; return;
} }
java_check_exception(_env); java_check_exception(_env);
@ -514,28 +514,28 @@ extern "C"
void Java_org_ewol_Ewol_EWonCreate(JNIEnv* _env, jobject _thiz, jint _id) void Java_org_ewol_Ewol_EWonCreate(JNIEnv* _env, jobject _thiz, jint _id)
{ {
EWOL_DEBUG("*******************************************"); EWOL_DEBUG("*******************************************");
EWOL_DEBUG("** Activity On Create **"); EWOL_DEBUG("** Activity on Create **");
EWOL_DEBUG("*******************************************"); EWOL_DEBUG("*******************************************");
if( _id>=s_listInstance.Size() if( _id >= s_listInstance.size()
|| _id<0 || _id<0
|| NULL==s_listInstance[_id] ) { || NULL == s_listInstance[_id] ) {
EWOL_ERROR("Call C With an incorrect instance _id=" << (int32_t)_id); EWOL_ERROR("Call C With an incorrect instance _id=" << (int32_t)_id);
// TODO : Generate error in java to stop the current instance // TODO : generate error in java to stop the current instance
return; return;
} }
//s_listInstance[_id]->Init(); //s_listInstance[_id]->init();
} }
void Java_org_ewol_Ewol_EWonStart(JNIEnv* _env, jobject _thiz, jint _id) void Java_org_ewol_Ewol_EWonStart(JNIEnv* _env, jobject _thiz, jint _id)
{ {
EWOL_DEBUG("*******************************************"); EWOL_DEBUG("*******************************************");
EWOL_DEBUG("** Activity On Start **"); EWOL_DEBUG("** Activity on Start **");
EWOL_DEBUG("*******************************************"); EWOL_DEBUG("*******************************************");
if( _id>=s_listInstance.Size() if( _id >= s_listInstance.size()
|| _id<0 || _id<0
|| NULL==s_listInstance[_id] ) { || NULL == s_listInstance[_id] ) {
EWOL_ERROR("Call C With an incorrect instance _id=" << (int32_t)_id); EWOL_ERROR("Call C With an incorrect instance _id=" << (int32_t)_id);
// TODO : Generate error in java to stop the current instance // TODO : generate error in java to stop the current instance
return; return;
} }
//SendSystemMessage(" testmessages ... "); //SendSystemMessage(" testmessages ... ");
@ -543,26 +543,26 @@ extern "C"
void Java_org_ewol_Ewol_EWonReStart(JNIEnv* _env, jobject _thiz, jint _id) void Java_org_ewol_Ewol_EWonReStart(JNIEnv* _env, jobject _thiz, jint _id)
{ {
EWOL_DEBUG("*******************************************"); EWOL_DEBUG("*******************************************");
EWOL_DEBUG("** Activity On Re-Start **"); EWOL_DEBUG("** Activity on Re-Start **");
EWOL_DEBUG("*******************************************"); EWOL_DEBUG("*******************************************");
if( _id>=s_listInstance.Size() if( _id >= s_listInstance.size()
|| _id<0 || _id<0
|| NULL==s_listInstance[_id] ) { || NULL == s_listInstance[_id] ) {
EWOL_ERROR("Call C With an incorrect instance _id=" << (int32_t)_id); EWOL_ERROR("Call C With an incorrect instance _id=" << (int32_t)_id);
// TODO : Generate error in java to stop the current instance // TODO : generate error in java to stop the current instance
return; return;
} }
} }
void Java_org_ewol_Ewol_EWonResume(JNIEnv* _env, jobject _thiz, jint _id) void Java_org_ewol_Ewol_EWonResume(JNIEnv* _env, jobject _thiz, jint _id)
{ {
EWOL_DEBUG("*******************************************"); EWOL_DEBUG("*******************************************");
EWOL_DEBUG("** Activity On Resume **"); EWOL_DEBUG("** Activity on resume **");
EWOL_DEBUG("*******************************************"); EWOL_DEBUG("*******************************************");
if( _id>=s_listInstance.Size() if( _id >= s_listInstance.size()
|| _id<0 || _id<0
|| NULL==s_listInstance[_id] ) { || NULL == s_listInstance[_id] ) {
EWOL_ERROR("Call C With an incorrect instance _id=" << (int32_t)_id); EWOL_ERROR("Call C With an incorrect instance _id=" << (int32_t)_id);
// TODO : Generate error in java to stop the current instance // TODO : generate error in java to stop the current instance
return; return;
} }
s_listInstance[_id]->OS_Resume(); s_listInstance[_id]->OS_Resume();
@ -570,29 +570,29 @@ extern "C"
void Java_org_ewol_Ewol_EWonPause(JNIEnv* _env, jobject _thiz, jint _id) void Java_org_ewol_Ewol_EWonPause(JNIEnv* _env, jobject _thiz, jint _id)
{ {
EWOL_DEBUG("*******************************************"); EWOL_DEBUG("*******************************************");
EWOL_DEBUG("** Activity On Pause **"); EWOL_DEBUG("** Activity on pause **");
EWOL_DEBUG("*******************************************"); EWOL_DEBUG("*******************************************");
if( _id>=s_listInstance.Size() if( _id >= s_listInstance.size()
|| _id<0 || _id<0
|| NULL==s_listInstance[_id] ) { || NULL == s_listInstance[_id] ) {
EWOL_ERROR("Call C With an incorrect instance _id=" << (int32_t)_id); EWOL_ERROR("Call C With an incorrect instance _id=" << (int32_t)_id);
// TODO : Generate error in java to stop the current instance // TODO : generate error in java to stop the current instance
return; return;
} }
// All the openGl has been destroyed ... // All the openGl has been destroyed ...
s_listInstance[_id]->GetResourcesManager().ContextHasBeenDestroyed(); s_listInstance[_id]->getResourcesManager().ContextHasBeenDestroyed();
s_listInstance[_id]->OS_Suspend(); s_listInstance[_id]->OS_Suspend();
} }
void Java_org_ewol_Ewol_EWonStop(JNIEnv* _env, jobject _thiz, jint _id) void Java_org_ewol_Ewol_EWonStop(JNIEnv* _env, jobject _thiz, jint _id)
{ {
EWOL_DEBUG("*******************************************"); EWOL_DEBUG("*******************************************");
EWOL_DEBUG("** Activity On Stop **"); EWOL_DEBUG("** Activity on Stop **");
EWOL_DEBUG("*******************************************"); EWOL_DEBUG("*******************************************");
if( _id>=s_listInstance.Size() if( _id >= s_listInstance.size()
|| _id<0 || _id<0
|| NULL==s_listInstance[_id] ) { || NULL == s_listInstance[_id] ) {
EWOL_ERROR("Call C With an incorrect instance _id=" << (int32_t)_id); EWOL_ERROR("Call C With an incorrect instance _id=" << (int32_t)_id);
// TODO : Generate error in java to stop the current instance // TODO : generate error in java to stop the current instance
return; return;
} }
s_listInstance[_id]->OS_Stop(); s_listInstance[_id]->OS_Stop();
@ -600,13 +600,13 @@ extern "C"
void Java_org_ewol_Ewol_EWonDestroy(JNIEnv* _env, jobject _thiz, jint _id) void Java_org_ewol_Ewol_EWonDestroy(JNIEnv* _env, jobject _thiz, jint _id)
{ {
EWOL_DEBUG("*******************************************"); EWOL_DEBUG("*******************************************");
EWOL_DEBUG("** Activity On Destroy **"); EWOL_DEBUG("** Activity on Destroy **");
EWOL_DEBUG("*******************************************"); EWOL_DEBUG("*******************************************");
if( _id>=s_listInstance.Size() if( _id >= s_listInstance.size()
|| _id<0 || _id<0
|| NULL==s_listInstance[_id] ) { || NULL == s_listInstance[_id] ) {
EWOL_ERROR("Call C With an incorrect instance _id=" << (int32_t)_id); EWOL_ERROR("Call C With an incorrect instance _id=" << (int32_t)_id);
// TODO : Generate error in java to stop the current instance // TODO : generate error in java to stop the current instance
return; return;
} }
//s_listInstance[_id]->UnInit(); //s_listInstance[_id]->UnInit();
@ -619,11 +619,11 @@ extern "C"
* ********************************************************************************************** */ * ********************************************************************************************** */
void Java_org_ewol_Ewol_EWinputEventMotion(JNIEnv* _env, jobject _thiz, jint _id, jint _pointerID, jfloat _x, jfloat _y ) void Java_org_ewol_Ewol_EWinputEventMotion(JNIEnv* _env, jobject _thiz, jint _id, jint _pointerID, jfloat _x, jfloat _y )
{ {
if( _id>=s_listInstance.Size() if( _id >= s_listInstance.size()
|| _id<0 || _id<0
|| NULL==s_listInstance[_id] ) { || NULL == s_listInstance[_id] ) {
EWOL_ERROR("Call C With an incorrect instance _id=" << (int32_t)_id); EWOL_ERROR("Call C With an incorrect instance _id=" << (int32_t)_id);
// TODO : Generate error in java to stop the current instance // TODO : generate error in java to stop the current instance
return; return;
} }
s_listInstance[_id]->OS_SetInputMotion(_pointerID+1, vec2(_x,_y)); s_listInstance[_id]->OS_SetInputMotion(_pointerID+1, vec2(_x,_y));
@ -631,11 +631,11 @@ extern "C"
void Java_org_ewol_Ewol_EWinputEventState(JNIEnv* _env, jobject _thiz, jint _id, jint _pointerID, jboolean _isUp, jfloat _x, jfloat _y) void Java_org_ewol_Ewol_EWinputEventState(JNIEnv* _env, jobject _thiz, jint _id, jint _pointerID, jboolean _isUp, jfloat _x, jfloat _y)
{ {
if( _id>=s_listInstance.Size() if( _id >= s_listInstance.size()
|| _id<0 || _id<0
|| NULL==s_listInstance[_id] ) { || NULL == s_listInstance[_id] ) {
EWOL_ERROR("Call C With an incorrect instance _id=" << (int32_t)_id); EWOL_ERROR("Call C With an incorrect instance _id=" << (int32_t)_id);
// TODO : Generate error in java to stop the current instance // TODO : generate error in java to stop the current instance
return; return;
} }
s_listInstance[_id]->OS_SetInputState(_pointerID+1, _isUp, vec2(_x,_y)); s_listInstance[_id]->OS_SetInputState(_pointerID+1, _isUp, vec2(_x,_y));
@ -643,11 +643,11 @@ extern "C"
void Java_org_ewol_Ewol_EWmouseEventMotion(JNIEnv* _env, jobject _thiz, jint _id, jint _pointerID, jfloat _x, jfloat _y) void Java_org_ewol_Ewol_EWmouseEventMotion(JNIEnv* _env, jobject _thiz, jint _id, jint _pointerID, jfloat _x, jfloat _y)
{ {
if( _id>=s_listInstance.Size() if( _id >= s_listInstance.size()
|| _id<0 || _id<0
|| NULL==s_listInstance[_id] ) { || NULL == s_listInstance[_id] ) {
EWOL_ERROR("Call C With an incorrect instance _id=" << (int32_t)_id); EWOL_ERROR("Call C With an incorrect instance _id=" << (int32_t)_id);
// TODO : Generate error in java to stop the current instance // TODO : generate error in java to stop the current instance
return; return;
} }
s_listInstance[_id]->OS_SetMouseMotion(_pointerID+1, vec2(_x,_y)); s_listInstance[_id]->OS_SetMouseMotion(_pointerID+1, vec2(_x,_y));
@ -655,11 +655,11 @@ extern "C"
void Java_org_ewol_Ewol_EWmouseEventState(JNIEnv* _env, jobject _thiz, jint _id, jint _pointerID, jboolean _isUp, jfloat _x, jfloat _y) void Java_org_ewol_Ewol_EWmouseEventState(JNIEnv* _env, jobject _thiz, jint _id, jint _pointerID, jboolean _isUp, jfloat _x, jfloat _y)
{ {
if( _id>=s_listInstance.Size() if( _id >= s_listInstance.size()
|| _id<0 || _id<0
|| NULL==s_listInstance[_id] ) { || NULL == s_listInstance[_id] ) {
EWOL_ERROR("Call C With an incorrect instance _id=" << (int32_t)_id); EWOL_ERROR("Call C With an incorrect instance _id=" << (int32_t)_id);
// TODO : Generate error in java to stop the current instance // TODO : generate error in java to stop the current instance
return; return;
} }
s_listInstance[_id]->OS_SetMouseState(_pointerID+1, _isUp, vec2(_x,_y)); s_listInstance[_id]->OS_SetMouseState(_pointerID+1, _isUp, vec2(_x,_y));
@ -667,11 +667,11 @@ extern "C"
void Java_org_ewol_Ewol_EWunknowEvent(JNIEnv* _env, jobject _thiz, jint _id, jint _pointerID) void Java_org_ewol_Ewol_EWunknowEvent(JNIEnv* _env, jobject _thiz, jint _id, jint _pointerID)
{ {
if( _id>=s_listInstance.Size() if( _id >= s_listInstance.size()
|| _id<0 || _id<0
|| NULL==s_listInstance[_id] ) { || NULL == s_listInstance[_id] ) {
EWOL_ERROR("Call C With an incorrect instance _id=" << (int32_t)_id); EWOL_ERROR("Call C With an incorrect instance _id=" << (int32_t)_id);
// TODO : Generate error in java to stop the current instance // TODO : generate error in java to stop the current instance
return; return;
} }
EWOL_DEBUG("Unknown IO event : " << _pointerID << " ???"); EWOL_DEBUG("Unknown IO event : " << _pointerID << " ???");
@ -679,11 +679,11 @@ extern "C"
void Java_org_ewol_Ewol_EWkeyboardEventMove(JNIEnv* _env, jobject _thiz, jint _id, jint _type, jboolean _isdown) void Java_org_ewol_Ewol_EWkeyboardEventMove(JNIEnv* _env, jobject _thiz, jint _id, jint _type, jboolean _isdown)
{ {
if( _id>=s_listInstance.Size() if( _id >= s_listInstance.size()
|| _id<0 || _id<0
|| NULL==s_listInstance[_id] ) { || NULL == s_listInstance[_id] ) {
EWOL_ERROR("Call C With an incorrect instance _id=" << (int32_t)_id); EWOL_ERROR("Call C With an incorrect instance _id=" << (int32_t)_id);
// TODO : Generate error in java to stop the current instance // TODO : generate error in java to stop the current instance
return; return;
} }
EWOL_DEBUG("IO keyboard Move event : \"" << _type << "\" is down=" << _isdown); EWOL_DEBUG("IO keyboard Move event : \"" << _type << "\" is down=" << _isdown);
@ -691,11 +691,11 @@ extern "C"
void Java_org_ewol_Ewol_EWkeyboardEventKey(JNIEnv* _env, jobject _thiz, jint _id, jint _uniChar, jboolean _isdown) void Java_org_ewol_Ewol_EWkeyboardEventKey(JNIEnv* _env, jobject _thiz, jint _id, jint _uniChar, jboolean _isdown)
{ {
if( _id>=s_listInstance.Size() if( _id >= s_listInstance.size()
|| _id<0 || _id<0
|| NULL==s_listInstance[_id] ) { || NULL == s_listInstance[_id] ) {
EWOL_ERROR("Call C With an incorrect instance _id=" << (int32_t)_id); EWOL_ERROR("Call C With an incorrect instance _id=" << (int32_t)_id);
// TODO : Generate error in java to stop the current instance // TODO : generate error in java to stop the current instance
return; return;
} }
EWOL_DEBUG("IO keyboard Key event : \"" << _uniChar << "\" is down=" << _isdown); EWOL_DEBUG("IO keyboard Key event : \"" << _uniChar << "\" is down=" << _isdown);
@ -704,48 +704,48 @@ extern "C"
void Java_org_ewol_Ewol_EWdisplayPropertyMetrics(JNIEnv* _env, jobject _thiz, jint _id, jfloat _ratioX, jfloat _ratioY) void Java_org_ewol_Ewol_EWdisplayPropertyMetrics(JNIEnv* _env, jobject _thiz, jint _id, jfloat _ratioX, jfloat _ratioY)
{ {
if( _id>=s_listInstance.Size() if( _id >= s_listInstance.size()
|| _id<0 || _id<0
|| NULL==s_listInstance[_id] ) { || NULL == s_listInstance[_id] ) {
EWOL_ERROR("Call C With an incorrect instance _id=" << (int32_t)_id); EWOL_ERROR("Call C With an incorrect instance _id=" << (int32_t)_id);
// TODO : Generate error in java to stop the current instance // TODO : generate error in java to stop the current instance
return; return;
} }
// set the internal system ratio properties ... // set the internal system ratio properties ...
ewol::dimension::SetPixelRatio(vec2(_ratioX,_ratioY), ewol::Dimension::Inch); ewol::dimension::setPixelRatio(vec2(_ratioX,_ratioY), ewol::Dimension::Inch);
} }
// TODO : Set a return true or false if we want to grep this event ... // TODO : set a return true or false if we want to grep this event ...
void Java_org_ewol_Ewol_EWkeyboardEventKeySystem(JNIEnv* _env, jobject _thiz, jint _id, jint _keyVal, jboolean _isdown) void Java_org_ewol_Ewol_EWkeyboardEventKeySystem(JNIEnv* _env, jobject _thiz, jint _id, jint _keyVal, jboolean _isdown)
{ {
if( _id>=s_listInstance.Size() if( _id >= s_listInstance.size()
|| _id<0 || _id<0
|| NULL==s_listInstance[_id] ) { || NULL == s_listInstance[_id] ) {
EWOL_ERROR("Call C With an incorrect instance _id=" << (int32_t)_id); EWOL_ERROR("Call C With an incorrect instance _id=" << (int32_t)_id);
// TODO : Generate error in java to stop the current instance // TODO : generate error in java to stop the current instance
return; return;
} }
switch (_keyVal) { switch (_keyVal) {
case org_ewol_EwolConstants_EWOL_SYSTEM_KEY_VOLUME_UP: case org_ewol_EwolConstants_EWOL_SYSTEM_KEY_VOLUME_UP:
EWOL_DEBUG("IO keyboard Key System \"VOLUME_UP\" is down=" << _isdown); EWOL_DEBUG("IO keyboard Key system \"VOLUME_UP\" is down=" << _isdown);
break; break;
case org_ewol_EwolConstants_EWOL_SYSTEM_KEY_VOLUME_DOWN: case org_ewol_EwolConstants_EWOL_SYSTEM_KEY_VOLUME_DOWN:
EWOL_DEBUG("IO keyboard Key System \"VOLUME_DOWN\" is down=" << _isdown); EWOL_DEBUG("IO keyboard Key system \"VOLUME_DOWN\" is down=" << _isdown);
break; break;
case org_ewol_EwolConstants_EWOL_SYSTEM_KEY_MENU: case org_ewol_EwolConstants_EWOL_SYSTEM_KEY_MENU:
EWOL_DEBUG("IO keyboard Key System \"MENU\" is down=" << _isdown); EWOL_DEBUG("IO keyboard Key system \"MENU\" is down=" << _isdown);
break; break;
case org_ewol_EwolConstants_EWOL_SYSTEM_KEY_CAMERA: case org_ewol_EwolConstants_EWOL_SYSTEM_KEY_CAMERA:
EWOL_DEBUG("IO keyboard Key System \"CAMERA\" is down=" << _isdown); EWOL_DEBUG("IO keyboard Key system \"CAMERA\" is down=" << _isdown);
break; break;
case org_ewol_EwolConstants_EWOL_SYSTEM_KEY_HOME: case org_ewol_EwolConstants_EWOL_SYSTEM_KEY_HOME:
EWOL_DEBUG("IO keyboard Key System \"HOME\" is down=" << _isdown); EWOL_DEBUG("IO keyboard Key system \"HOME\" is down=" << _isdown);
break; break;
case org_ewol_EwolConstants_EWOL_SYSTEM_KEY_POWER: case org_ewol_EwolConstants_EWOL_SYSTEM_KEY_POWER:
EWOL_DEBUG("IO keyboard Key System \"POWER\" is down=" << _isdown); EWOL_DEBUG("IO keyboard Key system \"POWER\" is down=" << _isdown);
break; break;
default: default:
EWOL_DEBUG("IO keyboard Key System event : \"" << _keyVal << "\" is down=" << _isdown); EWOL_DEBUG("IO keyboard Key system event : \"" << _keyVal << "\" is down=" << _isdown);
break; break;
} }
} }
@ -756,11 +756,11 @@ extern "C"
* ********************************************************************************************** */ * ********************************************************************************************** */
void Java_org_ewol_Ewol_EWrenderInit(JNIEnv* _env, jobject _thiz, jint _id) void Java_org_ewol_Ewol_EWrenderInit(JNIEnv* _env, jobject _thiz, jint _id)
{ {
if( _id>=s_listInstance.Size() if( _id >= s_listInstance.size()
|| _id<0 || _id<0
|| NULL==s_listInstance[_id] ) { || NULL == s_listInstance[_id] ) {
EWOL_ERROR("Call C With an incorrect instance _id=" << (int32_t)_id); EWOL_ERROR("Call C With an incorrect instance _id=" << (int32_t)_id);
// TODO : Generate error in java to stop the current instance // TODO : generate error in java to stop the current instance
return; return;
} }
@ -768,11 +768,11 @@ extern "C"
void Java_org_ewol_Ewol_EWrenderResize( JNIEnv* _env, jobject _thiz, jint _id, jint _w, jint _h ) void Java_org_ewol_Ewol_EWrenderResize( JNIEnv* _env, jobject _thiz, jint _id, jint _w, jint _h )
{ {
if( _id>=s_listInstance.Size() if( _id >= s_listInstance.size()
|| _id<0 || _id<0
|| NULL==s_listInstance[_id] ) { || NULL == s_listInstance[_id] ) {
EWOL_ERROR("Call C With an incorrect instance _id=" << (int32_t)_id); EWOL_ERROR("Call C With an incorrect instance _id=" << (int32_t)_id);
// TODO : Generate error in java to stop the current instance // TODO : generate error in java to stop the current instance
return; return;
} }
s_listInstance[_id]->OS_Resize(vec2(_w, _h)); s_listInstance[_id]->OS_Resize(vec2(_w, _h));
@ -781,11 +781,11 @@ extern "C"
// TODO : Return tur or foalse to not redraw when the under draw has not be done (processing gain of time) // TODO : Return tur or foalse to not redraw when the under draw has not be done (processing gain of time)
void Java_org_ewol_Ewol_EWrenderDraw(JNIEnv* _env, jobject _thiz, jint _id) void Java_org_ewol_Ewol_EWrenderDraw(JNIEnv* _env, jobject _thiz, jint _id)
{ {
if( _id>=s_listInstance.Size() if( _id >= s_listInstance.size()
|| _id<0 || _id<0
|| NULL==s_listInstance[_id] ) { || NULL == s_listInstance[_id] ) {
EWOL_ERROR("Call C With an incorrect instance _id=" << (int32_t)_id); EWOL_ERROR("Call C With an incorrect instance _id=" << (int32_t)_id);
// TODO : Generate error in java to stop the current instance // TODO : generate error in java to stop the current instance
return; return;
} }
s_listInstance[_id]->OS_Draw(true); s_listInstance[_id]->OS_Draw(true);
@ -793,24 +793,24 @@ extern "C"
void Java_org_ewol_Ewol_EWaudioPlayback(JNIEnv* _env, void* _reserved, jint _id, jshortArray _location, jint _frameRate, jint _nbChannels) void Java_org_ewol_Ewol_EWaudioPlayback(JNIEnv* _env, void* _reserved, jint _id, jshortArray _location, jint _frameRate, jint _nbChannels)
{ {
if( _id>=s_listInstance.Size() if( _id >= s_listInstance.size()
|| _id<0 || _id<0
|| NULL==s_listInstance[_id] ) { || NULL == s_listInstance[_id] ) {
EWOL_ERROR("Call C With an incorrect instance _id=" << (int32_t)_id); EWOL_ERROR("Call C With an incorrect instance _id=" << (int32_t)_id);
// TODO : Generate error in java to stop the current instance // TODO : generate error in java to stop the current instance
return; return;
} }
// Get the short* pointer from the Java array // get the short* pointer from the Java array
jboolean isCopy; jboolean isCopy;
jshort* dst = _env->GetShortArrayElements(_location, &isCopy); jshort* dst = _env->getShortArrayElements(_location, &isCopy);
if (NULL != dst) { if (NULL != dst) {
ewol::audio::GetData(dst, _frameRate, _nbChannels); ewol::audio::getData(dst, _frameRate, _nbChannels);
} }
//APPL_DEBUG("IO Audio event request: Frames=" << frameRate << " channels=" << nbChannels); //APPL_DEBUG("IO Audio event request: Frames=" << frameRate << " channels=" << nbChannels);
// TODO : Understand why it did not work corectly ... // TODO : Understand why it did not work corectly ...
//if (isCopy == JNI_TRUE) { //if (isCopy == JNI_TRUE) {
// Release the short* pointer // release the short* pointer
_env->ReleaseShortArrayElements(_location, dst, 0); _env->releaseShortArrayElements(_location, dst, 0);
//} //}
} }
}; };

View File

@ -18,16 +18,16 @@ ewol::ConfigFont::ConfigFont(void) :
m_size(10), m_size(10),
m_useExternal(false) m_useExternal(false)
{ {
ewol::FreeTypeInit(); ewol::freeTypeInit();
} }
ewol::ConfigFont::~ConfigFont(void) ewol::ConfigFont::~ConfigFont(void)
{ {
// UnInit FreeTypes // UnInit FreeTypes
ewol::FreeTypeUnInit(); ewol::freeTypeUnInit();
} }
void ewol::ConfigFont::Set(const etk::UString& _fontName, int32_t _size) void ewol::ConfigFont::set(const etk::UString& _fontName, int32_t _size)
{ {
m_name = _fontName; m_name = _fontName;
m_size = _size; m_size = _size;

View File

@ -29,45 +29,45 @@ namespace ewol
* @brief Specify the default font folder for the Ewol search system (only needed when embended font) * @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) * @param[in] _folder basic folder of the font (ex: DATA:fonts)
*/ */
void SetFolder(const etk::UString& _folder) { m_folder = _folder; }; void setFolder(const etk::UString& _folder) { m_folder = _folder; };
/** /**
* @brief Get the default font folder. * @brief get the default font folder.
* @return The default font folder. * @return The default font folder.
*/ */
const etk::UString& GetFolder(void) { return m_folder; }; const etk::UString& getFolder(void) { return m_folder; };
private: private:
etk::UString m_name; etk::UString m_name;
int32_t m_size; int32_t m_size;
public: public:
/** /**
* @brief Set the defaut font for all the widgets and basics display. * @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] _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. * @param[in] _size The default size of the font default=10.
*/ */
void Set(const etk::UString& _fontName, int32_t _size); void set(const etk::UString& _fontName, int32_t _size);
/** /**
* @brief Get the current default font name * @brief get the current default font name
* @raturn a reference on the font name string * @raturn a reference on the font name string
*/ */
const etk::UString& GetName(void) { return m_name; }; const etk::UString& getName(void) { return m_name; };
/** /**
* @brief Get the default font size. * @brief get the default font size.
* @return the font size. * @return the font size.
*/ */
int32_t GetSize(void) { return m_size; }; int32_t getSize(void) { return m_size; };
private: private:
bool m_useExternal; bool m_useExternal;
public: public:
/** /**
* @brief Set use of internal/external Font * @brief set use of internal/external Font
* @param[in] _val true to enable search of internal data. * @param[in] _val true to enable search of internal data.
*/ */
void SetUseExternal(bool _val) { m_useExternal=_val; }; void setUseExternal(bool _val) { m_useExternal=_val; };
/** /**
* @brief Get the use of internal/external Font * @brief get the use of internal/external Font
* @return true to enable search of internal data. * @return true to enable search of internal data.
*/ */
bool GetUseExternal(void) { return m_useExternal; }; bool getUseExternal(void) { return m_useExternal; };
}; };
}; };

View File

@ -14,28 +14,28 @@
etk::CCout& ewol::operator <<(etk::CCout& _os, const ewol::EConfig& _obj) etk::CCout& ewol::operator <<(etk::CCout& _os, const ewol::EConfig& _obj)
{ {
_os << "{"; _os << "{";
_os << "config=\"" << _obj.GetConfig() << "\""; _os << "config=\"" << _obj.getConfig() << "\"";
_os << " data=\"" << _obj.GetData() << "\"}"; _os << " data=\"" << _obj.getData() << "\"}";
return _os; return _os;
} }
etk::CCout& ewol::operator <<(etk::CCout& _os, const ewol::EConfigElement& _obj) etk::CCout& ewol::operator <<(etk::CCout& _os, const ewol::EConfigElement& _obj)
{ {
_os << "{"; _os << "{";
if (NULL != _obj.GetConfig()) { if (NULL != _obj.getConfig()) {
_os << "config=\"" << _obj.GetConfig() << "\""; _os << "config=\"" << _obj.getConfig() << "\"";
} }
if (NULL != _obj.GetType()) { if (NULL != _obj.getType()) {
_os << " type=\"" << _obj.GetType() << "\""; _os << " type=\"" << _obj.getType() << "\"";
} }
if (NULL != _obj.GetControl()) { if (NULL != _obj.getControl()) {
_os << " ctrl=\"" << _obj.GetControl() << "\""; _os << " ctrl=\"" << _obj.getControl() << "\"";
} }
if (NULL != _obj.GetDescription()) { if (NULL != _obj.getDescription()) {
_os << " desc=\"" << _obj.GetDescription() << "\""; _os << " desc=\"" << _obj.getDescription() << "\"";
} }
if (NULL != _obj.GetDefault()) { if (NULL != _obj.getDefault()) {
_os << " default=\"" << _obj.GetDefault() << "\""; _os << " default=\"" << _obj.getDefault() << "\"";
} }
_os << "}"; _os << "}";
return _os; return _os;

View File

@ -23,16 +23,16 @@ namespace ewol {
m_config(_config), m_config(_config),
m_data(_data) m_data(_data)
{ }; { };
void SetConfig(const char* _config) { m_config = _config; }; void setConfig(const char* _config) { m_config = _config; };
inline const char* GetConfig(void) const { return m_config; }; inline const char* getConfig(void) const { return m_config; };
void SetData(const etk::UString& _data) { m_data = _data; }; void setData(const etk::UString& _data) { m_data = _data; };
inline const etk::UString& GetData(void) const { return m_data; }; inline const etk::UString& getData(void) const { return m_data; };
}; };
etk::CCout& operator <<(etk::CCout& _os, const ewol::EConfig& _obj); etk::CCout& operator <<(etk::CCout& _os, const ewol::EConfig& _obj);
class EConfigElement { class EConfigElement {
private: private:
const char* m_config; //!< config properties (used for XML properties ==> only : "[0-9a-zA-Z\-]" ==> this is a regExp control. const char* m_config; //!< config properties (used for XML properties == > only : "[0-9a-zA-Z\-]" ==> this is a regExp control.
const char* m_type; //!< type of the config[integer,float,string,reg-exp,list]. const char* m_type; //!< type of the config[integer,float,string,reg-exp,list].
const char* m_control; //!< control the type of the type set ( integer:[0..256], regExp: "[0-9a-zA-Z]", list:[plop,plop2,plop3] ) const char* m_control; //!< control the type of the type set ( integer:[0..256], regExp: "[0-9a-zA-Z]", list:[plop,plop2,plop3] )
const char* m_description; //!< description to help user to configure it. const char* m_description; //!< description to help user to configure it.
@ -50,11 +50,11 @@ namespace ewol {
m_description(_description), m_description(_description),
m_default(_default) m_default(_default)
{ }; { };
inline const char* GetConfig(void) const { return m_config; }; inline const char* getConfig(void) const { return m_config; };
inline const char* GetType(void) const { return m_type; }; inline const char* getType(void) const { return m_type; };
inline const char* GetControl(void) const { return m_control; }; inline const char* getControl(void) const { return m_control; };
inline const char* GetDescription(void) const { return m_description; }; inline const char* getDescription(void) const { return m_description; };
inline const char* GetDefault(void) const { return m_default; }; inline const char* getDefault(void) const { return m_default; };
}; };
etk::CCout& operator <<(etk::CCout& _os, const ewol::EConfigElement& _obj); etk::CCout& operator <<(etk::CCout& _os, const ewol::EConfigElement& _obj);
}; };

View File

@ -14,12 +14,12 @@
etk::CCout& ewol::operator <<(etk::CCout& _os, const ewol::EMessage& _obj) etk::CCout& ewol::operator <<(etk::CCout& _os, const ewol::EMessage& _obj)
{ {
_os << "{"; _os << "{";
if (NULL != _obj.GetMessage()) { if (NULL != _obj.getMessage()) {
_os << "msg=\"" << _obj.GetMessage() << "\""; _os << "msg=\"" << _obj.getMessage() << "\"";
} else { } else {
_os << "msg=\"NULL\""; _os << "msg=\"NULL\"";
} }
_os << " data=\"" << _obj.GetData() << "\"}"; _os << " data=\"" << _obj.getData() << "\"}";
return _os; return _os;
} }

View File

@ -16,7 +16,7 @@ namespace ewol {
class EMessage { class EMessage {
private: private:
ewol::EObject* m_callerObject; //!< Caller class. ewol::EObject* m_callerObject; //!< Caller class.
const char* m_event; //!< Event pointer ==> unique Id define by the system ... const char* m_event; //!< Event pointer == > unique Id define by the system ...
etk::UString m_data; //!< compositing additionnal message Value. etk::UString m_data; //!< compositing additionnal message Value.
public: public:
EMessage(ewol::EObject* _caller, EMessage(ewol::EObject* _caller,
@ -26,12 +26,12 @@ namespace ewol {
m_event(_message), m_event(_message),
m_data(_data) m_data(_data)
{ }; { };
void SetCaller(ewol::EObject* _caller) { m_callerObject = _caller; }; void setCaller(ewol::EObject* _caller) { m_callerObject = _caller; };
inline ewol::EObject* GetCaller(void) const { return m_callerObject; }; inline ewol::EObject* getCaller(void) const { return m_callerObject; };
void SetMessage(const char* _message) { m_event = _message; }; void setMessage(const char* _message) { m_event = _message; };
inline const char* GetMessage(void) const { return m_event; }; inline const char* getMessage(void) const { return m_event; };
void SetData(const etk::UString& _data) { m_data = _data; }; void setData(const etk::UString& _data) { m_data = _data; };
inline const etk::UString& GetData(void) const { return m_data; }; inline const etk::UString& getData(void) const { return m_data; };
}; };
etk::CCout& operator <<(etk::CCout& _os, const ewol::EMessage& _obj); etk::CCout& operator <<(etk::CCout& _os, const ewol::EMessage& _obj);
}; };

View File

@ -22,11 +22,11 @@ ewol::EMultiCast::EMultiCast(void)
ewol::EMultiCast::~EMultiCast(void) ewol::EMultiCast::~EMultiCast(void)
{ {
EWOL_INFO("EObject message Multi-Cast"); EWOL_INFO("EObject message Multi-Cast");
m_messageList.Clear(); m_messageList.clear();
} }
void ewol::EMultiCast::Add(ewol::EObject* _object, const char* const _message) void ewol::EMultiCast::add(ewol::EObject* _object, const char* const _message)
{ {
if (NULL == _object) { if (NULL == _object) {
EWOL_ERROR("Add with NULL object"); EWOL_ERROR("Add with NULL object");
@ -36,42 +36,42 @@ void ewol::EMultiCast::Add(ewol::EObject* _object, const char* const _message)
EWOL_ERROR("Add with NULL Message"); EWOL_ERROR("Add with NULL Message");
return; return;
} }
m_messageList.PushBack(MessageList(_message, _object)); m_messageList.pushBack(MessageList(_message, _object));
EWOL_DEBUG("SendMulticast ADD listener :" << _object->GetId() << " on \"" << _message << "\"" ); EWOL_DEBUG("SendMulticast ADD listener :" << _object->getId() << " on \"" << _message << "\"" );
} }
void ewol::EMultiCast::Rm(ewol::EObject* _object) void ewol::EMultiCast::rm(ewol::EObject* _object)
{ {
if (NULL == _object) { if (NULL == _object) {
EWOL_ERROR("Rm with NULL object"); EWOL_ERROR("Rm with NULL object");
return; return;
} }
// send the message at all registered widget ... // send the message at all registered widget ...
for (int32_t iii=m_messageList.Size()-1; iii>=0; iii--) { for (int32_t iii=m_messageList.size()-1; iii >= 0; iii--) {
if(m_messageList[iii].m_object == _object) { if(m_messageList[iii].m_object == _object) {
EWOL_DEBUG("SendMulticast RM listener :" << _object->GetId()); EWOL_DEBUG("SendMulticast RM listener :" << _object->getId());
m_messageList[iii].m_message = NULL; m_messageList[iii].m_message = NULL;
m_messageList[iii].m_object = NULL; m_messageList[iii].m_object = NULL;
m_messageList.Erase(iii); m_messageList.erase(iii);
} }
} }
} }
void ewol::EMultiCast::Send(ewol::EObject* _object, const char* const _message, const etk::UString& _data) void ewol::EMultiCast::send(ewol::EObject* _object, const char* const _message, const etk::UString& _data)
{ {
EWOL_VERBOSE("SendMulticast message \"" << _message << "\" data=\"" << _data << "\" to :"); EWOL_VERBOSE("SendMulticast message \"" << _message << "\" data=\"" << _data << "\" to :");
// send the message at all registered widget ... // send the message at all registered widget ...
for (int32_t iii=0; iii<m_messageList.Size(); iii++) { for (int32_t iii=0; iii<m_messageList.size(); iii++) {
if( m_messageList[iii].m_message == _message if( m_messageList[iii].m_message == _message
&& m_messageList[iii].m_object != _object) && m_messageList[iii].m_object != _object)
{ {
if (NULL != m_messageList[iii].m_object) { if (NULL != m_messageList[iii].m_object) {
EWOL_VERBOSE(" id = " << m_messageList[iii].m_object->GetId() << " type=" << m_messageList[iii].m_object->GetObjectType()); EWOL_VERBOSE(" id = " << m_messageList[iii].m_object->getId() << " type=" << m_messageList[iii].m_object->getObjectType());
// generate event ... (create message before ... // generate event ... (create message before ...
ewol::EMessage tmpMsg(_object, m_messageList[iii].m_message, _data); ewol::EMessage tmpMsg(_object, m_messageList[iii].m_message, _data);
m_messageList[iii].m_object->OnReceiveMessage(tmpMsg); m_messageList[iii].m_object->onReceiveMessage(tmpMsg);
} }
} }
} }

View File

@ -30,10 +30,10 @@ namespace ewol {
public: public:
EMultiCast(); EMultiCast();
~EMultiCast(void); ~EMultiCast(void);
void AnonymousSend(const char* const _messageId, const etk::UString& _data) { Send(NULL, _messageId, _data); }; void anonymousSend(const char* const _messageId, const etk::UString& _data) { send(NULL, _messageId, _data); };
void Send(ewol::EObject* _object, const char* const _message, const etk::UString& _data); void send(ewol::EObject* _object, const char* const _message, const etk::UString& _data);
void Rm(ewol::EObject* _object); void rm(ewol::EObject* _object);
void Add(ewol::EObject* _object, const char* const _message); void add(ewol::EObject* _object, const char* const _message);
}; };
}; };

View File

@ -25,84 +25,84 @@ ewol::EObject::EObject(void) :
// note this is nearly atomic ... (but it is enough) // note this is nearly atomic ... (but it is enough)
m_uniqueId = ss_globalUniqueId++; m_uniqueId = ss_globalUniqueId++;
EWOL_DEBUG("new EObject : [" << m_uniqueId << "]"); EWOL_DEBUG("new EObject : [" << m_uniqueId << "]");
GetEObjectManager().Add(this); getEObjectManager().add(this);
RegisterConfig(ewol::EObject::configName, "string", NULL, "EObject name, might be a unique reference in all the program"); registerConfig(ewol::EObject::configName, "string", NULL, "EObject name, might be a unique reference in all the program");
} }
ewol::EObject::~EObject(void) ewol::EObject::~EObject(void)
{ {
EWOL_DEBUG("delete EObject : [" << m_uniqueId << "]"); EWOL_DEBUG("delete EObject : [" << m_uniqueId << "]");
GetEObjectManager().Rm(this); getEObjectManager().rm(this);
GetMultiCast().Rm(this); getMultiCast().rm(this);
for (int32_t iii=0; iii<m_externEvent.Size(); iii++) { for (int32_t iii=0; iii<m_externEvent.size(); iii++) {
if (NULL!=m_externEvent[iii]) { if (NULL!=m_externEvent[iii]) {
delete(m_externEvent[iii]); delete(m_externEvent[iii]);
m_externEvent[iii] = NULL; m_externEvent[iii] = NULL;
} }
} }
m_externEvent.Clear(); m_externEvent.clear();
m_availlableEventId.Clear(); m_availlableEventId.clear();
m_uniqueId = -1; m_uniqueId = -1;
} }
void ewol::EObject::AutoDestroy(void) void ewol::EObject::autoDestroy(void)
{ {
GetEObjectManager().AutoRemove(this); getEObjectManager().autoRemove(this);
} }
void ewol::EObject::RemoveObject(void) void ewol::EObject::removeObject(void)
{ {
GetEObjectManager().AutoRemove(this); getEObjectManager().autoRemove(this);
} }
void ewol::EObject::AddEventId(const char * _generateEventId) void ewol::EObject::addEventId(const char * _generateEventId)
{ {
if (NULL != _generateEventId) { if (NULL != _generateEventId) {
m_availlableEventId.PushBack(_generateEventId); m_availlableEventId.pushBack(_generateEventId);
} }
} }
void ewol::EObject::GenerateEventId(const char * _generateEventId, const etk::UString& _data) void ewol::EObject::generateEventId(const char * _generateEventId, const etk::UString& _data)
{ {
int32_t nbObject = GetEObjectManager().GetNumberObject(); int32_t nbObject = getEObjectManager().getNumberObject();
// for every element registered ... // for every element registered ...
for (int32_t iii=0; iii<m_externEvent.Size(); iii++) { for (int32_t iii=0; iii<m_externEvent.size(); iii++) {
if (NULL!=m_externEvent[iii]) { if (NULL!=m_externEvent[iii]) {
// if we find the event ... // if we find the event ...
if (m_externEvent[iii]->localEventId == _generateEventId) { if (m_externEvent[iii]->localEventId == _generateEventId) {
if (NULL != m_externEvent[iii]->destEObject) { if (NULL != m_externEvent[iii]->destEObject) {
if (m_externEvent[iii]->overloadData.Size()<=0){ if (m_externEvent[iii]->overloadData.size() <= 0){
ewol::EMessage tmpMsg(this, m_externEvent[iii]->destEventId, _data); ewol::EMessage tmpMsg(this, m_externEvent[iii]->destEventId, _data);
m_externEvent[iii]->destEObject->OnReceiveMessage(tmpMsg); m_externEvent[iii]->destEObject->onReceiveMessage(tmpMsg);
} else { } else {
// set the user requested data ... // set the user requested data ...
ewol::EMessage tmpMsg(this, m_externEvent[iii]->destEventId, m_externEvent[iii]->overloadData); ewol::EMessage tmpMsg(this, m_externEvent[iii]->destEventId, m_externEvent[iii]->overloadData);
m_externEvent[iii]->destEObject->OnReceiveMessage(tmpMsg); m_externEvent[iii]->destEObject->onReceiveMessage(tmpMsg);
} }
} }
} }
} }
} }
if (nbObject > GetEObjectManager().GetNumberObject()) { if (nbObject > getEObjectManager().getNumberObject()) {
EWOL_CRITICAL("It if really dangerous ro remove (delete) element inside a callback ... use ->RemoveObject() which is asynchronous"); EWOL_CRITICAL("It if really dangerous ro remove (delete) element inside a callback ... use ->removeObject() which is asynchronous");
} }
} }
void ewol::EObject::SendMultiCast(const char* const _messageId, const etk::UString& _data) void ewol::EObject::sendMultiCast(const char* const _messageId, const etk::UString& _data)
{ {
int32_t nbObject = GetEObjectManager().GetNumberObject(); int32_t nbObject = getEObjectManager().getNumberObject();
GetMultiCast().Send(this, _messageId, _data); getMultiCast().send(this, _messageId, _data);
if (nbObject > GetEObjectManager().GetNumberObject()) { if (nbObject > getEObjectManager().getNumberObject()) {
EWOL_CRITICAL("It if really dangerous ro remove (delete) element inside a callback ... use ->RemoveObject() which is asynchronous"); EWOL_CRITICAL("It if really dangerous ro remove (delete) element inside a callback ... use ->removeObject() which is asynchronous");
} }
} }
void ewol::EObject::RegisterMultiCast(const char* const _messageId) void ewol::EObject::registerMultiCast(const char* const _messageId)
{ {
GetMultiCast().Add(this, _messageId); getMultiCast().add(this, _messageId);
} }
void ewol::EObject::RegisterOnEvent(ewol::EObject * _destinationObject, void ewol::EObject::registerOnEvent(ewol::EObject * _destinationObject,
const char * _eventId, const char * _eventId,
const char * _eventIdgenerated, const char * _eventIdgenerated,
const etk::UString& _overloadData) const etk::UString& _overloadData)
@ -117,7 +117,7 @@ void ewol::EObject::RegisterOnEvent(ewol::EObject * _destinationObject,
} }
// check if event existed : // check if event existed :
bool findIt = false; bool findIt = false;
for(int32_t iii=0; iii<m_availlableEventId.Size(); iii++) { for(int32_t iii=0; iii<m_availlableEventId.size(); iii++) {
if (m_availlableEventId[iii] == _eventId) { if (m_availlableEventId[iii] == _eventId) {
findIt = true; findIt = true;
break; break;
@ -125,7 +125,7 @@ void ewol::EObject::RegisterOnEvent(ewol::EObject * _destinationObject,
} }
if (false == findIt) { if (false == findIt) {
EWOL_DEBUG("Try to register with a NON direct string name"); EWOL_DEBUG("Try to register with a NON direct string name");
for(int32_t iii=0; iii<m_availlableEventId.Size(); iii++) { for(int32_t iii=0; iii<m_availlableEventId.size(); iii++) {
if (0 == strncmp(m_availlableEventId[iii], _eventId, 1024)) { if (0 == strncmp(m_availlableEventId[iii], _eventId, 1024)) {
findIt = true; findIt = true;
_eventIdgenerated = m_availlableEventId[iii]; _eventIdgenerated = m_availlableEventId[iii];
@ -134,7 +134,7 @@ void ewol::EObject::RegisterOnEvent(ewol::EObject * _destinationObject,
} }
} }
if (false == findIt) { if (false == findIt) {
EWOL_ERROR("Can not register event on this WidgetType=" << GetObjectType() << " event=\"" << _eventId << "\" ==> unknow event"); EWOL_ERROR("Can not register event on this WidgetType=" << getObjectType() << " event=\"" << _eventId << "\" == > unknow event");
return; return;
} }
ewol::EventExtGen * tmpEvent = new ewol::EventExtGen(); ewol::EventExtGen * tmpEvent = new ewol::EventExtGen();
@ -150,112 +150,112 @@ void ewol::EObject::RegisterOnEvent(ewol::EObject * _destinationObject,
} else { } else {
tmpEvent->destEventId = _eventId; tmpEvent->destEventId = _eventId;
} }
m_externEvent.PushBack(tmpEvent); m_externEvent.pushBack(tmpEvent);
} }
void ewol::EObject::OnObjectRemove(ewol::EObject * _removeObject) void ewol::EObject::onObjectRemove(ewol::EObject * _removeObject)
{ {
for(int32_t iii=m_externEvent.Size()-1; iii>=0; iii--) { for(int32_t iii=m_externEvent.size()-1; iii >= 0; iii--) {
if (NULL==m_externEvent[iii]) { if (NULL == m_externEvent[iii]) {
m_externEvent.Erase(iii); m_externEvent.erase(iii);
} else if (m_externEvent[iii]->destEObject == _removeObject) { } else if (m_externEvent[iii]->destEObject == _removeObject) {
m_externEvent.Erase(iii); m_externEvent.erase(iii);
} }
} }
} }
void ewol::EObject::RegisterConfig(const char* _config, const char* _type, const char* _control, const char* _description, const char* _default) void ewol::EObject::registerConfig(const char* _config, const char* _type, const char* _control, const char* _description, const char* _default)
{ {
if (NULL == _config) { if (NULL == _config) {
EWOL_ERROR("Try to add NULL config"); EWOL_ERROR("Try to add NULL config");
return; return;
} }
for(int32_t iii=0 ; iii<m_listConfig.Size() ; iii++) { for(int32_t iii=0 ; iii<m_listConfig.size() ; iii++) {
if (NULL != m_listConfig[iii].GetConfig()) { if (NULL != m_listConfig[iii].getConfig()) {
if (0==strcmp(m_listConfig[iii].GetConfig(), _config) ) { if (0 == strcmp(m_listConfig[iii].getConfig(), _config) ) {
EWOL_ERROR("Try to add config already added : " << _config << " at pos=" << iii); EWOL_ERROR("Try to add config already added : " << _config << " at pos=" << iii);
} }
} }
} }
m_listConfig.PushBack(ewol::EConfigElement(_config, _type, _control, _description, _default)); m_listConfig.pushBack(ewol::EConfigElement(_config, _type, _control, _description, _default));
} }
bool ewol::EObject::LoadXML(exml::Element* _node) bool ewol::EObject::loadXML(exml::Element* _node)
{ {
if (NULL==_node) { if (NULL == _node) {
return false; return false;
} }
bool errorOccured = true; bool errorOccured = true;
for(int32_t iii=0 ; iii<m_listConfig.Size() ; iii++) { for(int32_t iii=0 ; iii<m_listConfig.size() ; iii++) {
if (m_listConfig[iii].GetConfig() == NULL) { if (m_listConfig[iii].getConfig() == NULL) {
continue; continue;
} }
etk::UString value = _node->GetAttribute(m_listConfig[iii].GetConfig()); etk::UString value = _node->getAttribute(m_listConfig[iii].getConfig());
// check existance : // check existance :
if (value.Size()==0) { if (value.size() == 0) {
continue; continue;
} }
if (false==SetConfig(ewol::EConfig(m_listConfig[iii].GetConfig(), value) ) ) { if (false == setConfig(ewol::EConfig(m_listConfig[iii].getConfig(), value) ) ) {
errorOccured = false; errorOccured = false;
} }
} }
return errorOccured; return errorOccured;
} }
bool ewol::EObject::StoreXML(exml::Element* _node) const bool ewol::EObject::storeXML(exml::Element* _node) const
{ {
if (NULL==_node) { if (NULL == _node) {
return false; return false;
} }
bool errorOccured = true; bool errorOccured = true;
for(int32_t iii=0 ; iii<m_listConfig.Size() ; iii++) { for(int32_t iii=0 ; iii<m_listConfig.size() ; iii++) {
if (m_listConfig[iii].GetConfig() == NULL) { if (m_listConfig[iii].getConfig() == NULL) {
continue; continue;
} }
etk::UString value = GetConfig(m_listConfig[iii].GetConfig()); etk::UString value = getConfig(m_listConfig[iii].getConfig());
if (NULL != m_listConfig[iii].GetDefault() ) { if (NULL != m_listConfig[iii].getDefault() ) {
if (value == m_listConfig[iii].GetDefault() ) { if (value == m_listConfig[iii].getDefault() ) {
// nothing to add on the XML : // nothing to add on the XML :
continue; continue;
} }
} }
// add attribute ... ==> note : Add special element when '"' element detected ... // add attribute ... == > note : add special element when '"' element detected ...
_node->SetAttribute(m_listConfig[iii].GetConfig(), value); _node->setAttribute(m_listConfig[iii].getConfig(), value);
} }
return errorOccured; return errorOccured;
} }
bool ewol::EObject::OnSetConfig(const ewol::EConfig& _conf) bool ewol::EObject::onSetConfig(const ewol::EConfig& _conf)
{ {
EWOL_VERBOSE("[" << GetId() << "] {" << GetObjectType() << "} set config : " << _conf); EWOL_VERBOSE("[" << getId() << "] {" << getObjectType() << "} set config : " << _conf);
if (_conf.GetConfig() == ewol::EObject::configName) { if (_conf.getConfig() == ewol::EObject::configName) {
EWOL_VERBOSE("[" << GetId() << "] {" << GetObjectType() << "} Set config name : \"" << _conf.GetData() << "\""); EWOL_VERBOSE("[" << getId() << "] {" << getObjectType() << "} set config name : \"" << _conf.getData() << "\"");
SetName(_conf.GetData()); setName(_conf.getData());
return true; return true;
} }
return false; return false;
} }
bool ewol::EObject::OnGetConfig(const char* _config, etk::UString& _result) const bool ewol::EObject::onGetConfig(const char* _config, etk::UString& _result) const
{ {
if (_config == ewol::EObject::configName) { if (_config == ewol::EObject::configName) {
_result = GetName(); _result = getName();
return true; return true;
} }
return false; return false;
}; };
bool ewol::EObject::SetConfig(const etk::UString& _config, const etk::UString& _value) bool ewol::EObject::setConfig(const etk::UString& _config, const etk::UString& _value)
{ {
for(int32_t iii=0 ; iii<m_listConfig.Size() ; iii++) { for(int32_t iii=0 ; iii<m_listConfig.size() ; iii++) {
if (NULL != m_listConfig[iii].GetConfig()) { if (NULL != m_listConfig[iii].getConfig()) {
if (_config == m_listConfig[iii].GetConfig() ) { if (_config == m_listConfig[iii].getConfig() ) {
// call config with standard parameter // call config with standard parameter
return SetConfig(ewol::EConfig(m_listConfig[iii].GetConfig(), _value)); return setConfig(ewol::EConfig(m_listConfig[iii].getConfig(), _value));
} }
} }
} }
@ -263,22 +263,22 @@ bool ewol::EObject::SetConfig(const etk::UString& _config, const etk::UString& _
return false; return false;
} }
etk::UString ewol::EObject::GetConfig(const char* _config) const etk::UString ewol::EObject::getConfig(const char* _config) const
{ {
etk::UString res=""; etk::UString res="";
if (NULL != _config) { if (NULL != _config) {
(void)OnGetConfig(_config, res); (void)onGetConfig(_config, res);
} }
return res; return res;
}; };
etk::UString ewol::EObject::GetConfig(const etk::UString& _config) const etk::UString ewol::EObject::getConfig(const etk::UString& _config) const
{ {
for(int32_t iii=0 ; iii<m_listConfig.Size() ; iii++) { for(int32_t iii=0 ; iii<m_listConfig.size() ; iii++) {
if (NULL != m_listConfig[iii].GetConfig()) { if (NULL != m_listConfig[iii].getConfig()) {
if (_config == m_listConfig[iii].GetConfig() ) { if (_config == m_listConfig[iii].getConfig() ) {
// call config with standard parameter // call config with standard parameter
return GetConfig(m_listConfig[iii].GetConfig()); return getConfig(m_listConfig[iii].getConfig());
} }
} }
} }
@ -287,36 +287,36 @@ etk::UString ewol::EObject::GetConfig(const etk::UString& _config) const
} }
bool ewol::EObject::SetConfigNamed(const etk::UString& _name, const ewol::EConfig& _conf) bool ewol::EObject::setConfigNamed(const etk::UString& _name, const ewol::EConfig& _conf)
{ {
ewol::EObject* object = GetEObjectManager().Get(_name); ewol::EObject* object = getEObjectManager().get(_name);
if (object == NULL) { if (object == NULL) {
return false; return false;
} }
return object->SetConfig(_conf); return object->setConfig(_conf);
} }
bool ewol::EObject::SetConfigNamed(const etk::UString& _name, const etk::UString& _config, const etk::UString& _value) bool ewol::EObject::setConfigNamed(const etk::UString& _name, const etk::UString& _config, const etk::UString& _value)
{ {
ewol::EObject* object = GetEObjectManager().Get(_name); ewol::EObject* object = getEObjectManager().get(_name);
if (object == NULL) { if (object == NULL) {
return false; return false;
} }
return object->SetConfig(_config, _value); return object->setConfig(_config, _value);
} }
ewol::EObjectManager& ewol::EObject::GetEObjectManager(void) ewol::EObjectManager& ewol::EObject::getEObjectManager(void)
{ {
return ewol::GetContext().GetEObjectManager(); return ewol::getContext().getEObjectManager();
} }
ewol::EMultiCast& ewol::EObject::GetMultiCast(void) ewol::EMultiCast& ewol::EObject::getMultiCast(void)
{ {
return ewol::GetContext().GetEObjectManager().MultiCast(); return ewol::getContext().getEObjectManager().multiCast();
} }
ewol::eContext& ewol::EObject::GetContext(void) ewol::eContext& ewol::EObject::getContext(void)
{ {
return ewol::GetContext(); return ewol::getContext();
} }

View File

@ -33,13 +33,12 @@ namespace ewol {
public: public:
const char* localEventId; //!< local event Id generation const char* localEventId; //!< local event Id generation
ewol::EObject* destEObject; //!< destination widget that might be call ewol::EObject* destEObject; //!< destination widget that might be call
const char* destEventId; //!< Generated event ID on the distant widget const char* destEventId; //!< generated event ID on the distant widget
etk::UString overloadData; //!< sometimes the user prefer to receive some specific data on an event (instead of the one sed by the widget) etk::UString overloadData; //!< sometimes the user prefer to receive some specific data on an event (instead of the one sed by the widget)
}; };
/** /**
* @brief Basic message classes for ewol system * @brief Basic message classes for ewol system
*
* this class mermit at every EObject to communicate between them. * this class mermit at every EObject to communicate between them.
*/ */
class EObject { class EObject {
@ -49,7 +48,7 @@ namespace ewol {
protected: protected:
bool m_static; //!< set this variable at true if this element must not be auto destroy (exemple : use static object) bool m_static; //!< set this variable at true if this element must not be auto destroy (exemple : use static object)
private: private:
int32_t m_uniqueId; //!< Object UniqueID ==> TODO : Check if it use is needed int32_t m_uniqueId; //!< Object UniqueID == > TODO : Check if it use is needed
etk::Vector<EventExtGen*> m_externEvent; //!< Generic list of event generation for output link etk::Vector<EventExtGen*> m_externEvent; //!< Generic list of event generation for output link
etk::Vector<const char*> m_availlableEventId; //!< List of all event availlable for this widget etk::Vector<const char*> m_availlableEventId; //!< List of all event availlable for this widget
public: public:
@ -64,85 +63,85 @@ namespace ewol {
virtual ~EObject(void); virtual ~EObject(void);
/** /**
* @brief Get the static status of the EObject ==> mark at true if the user set the object mark as static allocated element ==> not auto remove element * @brief get the static status of the EObject == > mark at true if the user set the object mark as static allocated element ==> not auto remove element
* @return true if it might not be removed ==> usefull for conficuration class * @return true if it might not be removed == > usefull for conficuration class
*/ */
bool GetStatic(void){ return m_static; }; bool getStatic(void){ return m_static; };
/** /**
* @brief Get the UniqueId of the EObject * @brief get the UniqueId of the EObject
* @return the requested ID * @return the requested ID
*/ */
int32_t GetId(void){ return m_uniqueId; }; int32_t getId(void){ return m_uniqueId; };
/** /**
* @brief Auto-destroy the object * @brief Auto-destroy the object
*/ */
void AutoDestroy(void); void autoDestroy(void);
/** /**
* @brief Asynchronous removing the object * @brief Asynchronous removing the object
*/ */
void RemoveObject(void); void removeObject(void);
/** /**
* @brief Get the current Object type of the EObject * @brief get the current Object type of the EObject
* @note In Embended platforme, it is many time no -rtti flag, then it is not possible to use dynamic cast ==> this will replace it * @note In Embended platforme, it is many time no -rtti flag, then it is not possible to use dynamic cast == > this will replace it
* @param[in] _objectType type description * @param[in] _objectType type description
* @return true if the object is compatible, otherwise false * @return true if the object is compatible, otherwise false
*/ */
virtual const char * const GetObjectType(void) { return "EObject"; }; virtual const char * const getObjectType(void) { return "EObject"; };
protected: protected:
/** /**
* @brief Add a specific event Id in the list to prevent wrong link on a EObject * @brief add a specific event Id in the list to prevent wrong link on a EObject
* @param[in] _generateEventId event Id to add * @param[in] _generateEventId event Id to add
*/ */
void AddEventId(const char * _generateEventId); void addEventId(const char * _generateEventId);
/** /**
* @brief Generate event on all registered EObject * @brief generate event on all registered EObject
* @param[in] _generateEventId event Id that is curetly generated * @param[in] _generateEventId event Id that is curetly generated
* @param[in] _data data associated with the event * @param[in] _data data associated with the event
*/ */
void GenerateEventId(const char * _generateEventId, const etk::UString& _data = ""); void generateEventId(const char * _generateEventId, const etk::UString& _data = "");
/** /**
* @brief Generate Multicast event on all EObject requested the event * @brief generate Multicast event on all EObject requested the event
* @param[in] _messageId Event Id that is generated * @param[in] _messageId Event Id that is generated
* @param[in] _data String that is send at all the destinations * @param[in] _data String that is send at all the destinations
*/ */
void SendMultiCast(const char* const _messageId, const etk::UString& _data = ""); void sendMultiCast(const char* const _messageId, const etk::UString& _data = "");
/** /**
* @brief Register of the arrival of a Multicast message * @brief Register of the arrival of a Multicast message
* @param[in] _messageId Event Id waiting for... * @param[in] _messageId Event Id waiting for...
*/ */
void RegisterMultiCast(const char* const _messageId); void registerMultiCast(const char* const _messageId);
public: public:
/** /**
* @brief Register an EObject over an other to get event on the second... * @brief Register an EObject over an other to get event on the second...
* @param[in] _destinationObject pointer on the object that might be call when an event is generated * @param[in] _destinationObject pointer on the object that might be call when an event is generated
* @param[in] _eventId Event generate inside the object * @param[in] _eventId Event generate inside the object
* @param[in] _eventIdgenerated event generated when call the distant EObject.OnReceiveMessage(...) * @param[in] _eventIdgenerated event generated when call the distant EObject.onReceiveMessage(...)
* @param[in] _overloadData When the user prever to receive a data specificly for this event ... * @param[in] _overloadData When the user prever to receive a data specificly for this event ...
*/ */
void RegisterOnEvent(ewol::EObject * _destinationObject, void registerOnEvent(ewol::EObject * _destinationObject,
const char * _eventId, const char * _eventId,
const char * _eventIdgenerated = NULL, const char * _eventIdgenerated = NULL,
const etk::UString& _overloadData=""); const etk::UString& _overloadData="");
/** /**
* @brief Inform object that an other object is removed ... * @brief Inform object that an other object is removed ...
* @param[in] _removeObject Pointer on the EObject remeved ==> the user must remove all reference on this EObject * @param[in] _removeObject Pointer on the EObject remeved == > the user must remove all reference on this EObject
* @note : Sub classes must call this class * @note : Sub classes must call this class
*/ */
virtual void OnObjectRemove(ewol::EObject * _removeObject); virtual void onObjectRemove(ewol::EObject * _removeObject);
/** /**
* @brief Receive a message from an other EObject with a specific eventId and data * @brief Receive a message from an other EObject with a specific eventId and data
* @param[in] _msg Message handle * @param[in] _msg Message handle
*/ */
virtual void OnReceiveMessage(const ewol::EMessage& _msg) { }; virtual void onReceiveMessage(const ewol::EMessage& _msg) { };
private: private:
etk::Vector<ewol::EConfigElement> m_listConfig; etk::Vector<ewol::EConfigElement> m_listConfig;
protected: protected:
@ -154,86 +153,86 @@ namespace ewol {
* @param[in] _description Descritpion on the current type. * @param[in] _description Descritpion on the current type.
* @param[in] _default Default value of this parameter. * @param[in] _default Default value of this parameter.
*/ */
void RegisterConfig(const char* _config, const char* _type=NULL, const char* _control=NULL, const char* _description=NULL, const char* _default=NULL); void registerConfig(const char* _config, const char* _type=NULL, const char* _control=NULL, const char* _description=NULL, const char* _default=NULL);
/** /**
* @brief Configuration requested to the curent EObject * @brief Configuration requested to the curent EObject
* @param[in] _conf Configuration handle. * @param[in] _conf Configuration handle.
* @return true if the parametere has been used * @return true if the parametere has been used
*/ */
virtual bool OnSetConfig(const ewol::EConfig& _conf); virtual bool onSetConfig(const ewol::EConfig& _conf);
/** /**
* @brief Receive a configuration message from an other element system or from the curent EObject * @brief Receive a configuration message from an other element system or from the curent EObject
* @param[in] _config Configuration name. * @param[in] _config Configuration name.
* @param[out] _result Result of the request. * @param[out] _result Result of the request.
* @return true if the config is set * @return true if the config is set
*/ */
virtual bool OnGetConfig(const char* _config, etk::UString& _result) const ; virtual bool onGetConfig(const char* _config, etk::UString& _result) const ;
public: public:
/** /**
* @brief Get all the configuration list * @brief get all the configuration list
* @return The list of all parameter availlable in the widget * @return The list of all parameter availlable in the widget
*/ */
virtual const etk::Vector<ewol::EConfigElement>& GetConfigList(void) { return m_listConfig; }; virtual const etk::Vector<ewol::EConfigElement>& getConfigList(void) { return m_listConfig; };
/** /**
* @brief Configuration requested to the curent EObject (systrem mode) * @brief Configuration requested to the curent EObject (systrem mode)
* @param[in] _conf Configuration handle. * @param[in] _conf Configuration handle.
* @return true if config set correctly... * @return true if config set correctly...
*/ */
bool SetConfig(const ewol::EConfig& _conf) { return OnSetConfig(_conf); }; bool setConfig(const ewol::EConfig& _conf) { return onSetConfig(_conf); };
bool SetConfig(const etk::UString& _config, const etk::UString& _value); // need a search ... bool setConfig(const etk::UString& _config, const etk::UString& _value); // need a search ...
bool SetConfigNamed(const etk::UString& _name, const etk::UString& _config, const etk::UString& _value); // need a search ... bool setConfigNamed(const etk::UString& _name, const etk::UString& _config, const etk::UString& _value); // need a search ...
bool SetConfigNamed(const etk::UString& _name, const ewol::EConfig& _conf); bool setConfigNamed(const etk::UString& _name, const ewol::EConfig& _conf);
/** /**
* @brief Configuration Get from the curent EObject (systrem mode) * @brief Configuration get from the curent EObject (systrem mode)
* @param[in] _config Configuration name. * @param[in] _config Configuration name.
* @return the config properties * @return the config properties
*/ */
etk::UString GetConfig(const char* _config) const; etk::UString getConfig(const char* _config) const;
etk::UString GetConfig(const etk::UString& _config) const; // need search etk::UString getConfig(const etk::UString& _config) const; // need search
protected: protected:
etk::UString m_name; //!< name of the element ... etk::UString m_name; //!< name of the element ...
public: public:
/** /**
* @brief Get the eObject name * @brief get the eObject name
* @return The requested name * @return The requested name
*/ */
const etk::UString& GetName(void) const { return m_name; }; const etk::UString& getName(void) const { return m_name; };
/** /**
* @brief Get the Widget name * @brief get the Widget name
* @param[in] _name The new name * @param[in] _name The new name
*/ */
void SetName(const etk::UString& _name) { m_name=_name; }; void setName(const etk::UString& _name) { m_name=_name; };
public: public:
/** /**
* @brief Load properties with an XML node. * @brief load properties with an XML node.
* @param[in] _node Pointer on the tinyXML node. * @param[in] _node Pointer on the tinyXML node.
* @return true : All has been done corectly. * @return true : All has been done corectly.
* @return false : An error occured. * @return false : An error occured.
*/ */
virtual bool LoadXML(exml::Element* _node); virtual bool loadXML(exml::Element* _node);
/** /**
* @brief Store properties in this XML node. * @brief store properties in this XML node.
* @param[in,out] _node Pointer on the tinyXML node. * @param[in,out] _node Pointer on the tinyXML node.
* @return true : All has been done corectly. * @return true : All has been done corectly.
* @return false : An error occured. * @return false : An error occured.
*/ */
virtual bool StoreXML(exml::Element* _node) const; virtual bool storeXML(exml::Element* _node) const;
public: public:
/** /**
* @breif Get the current EObject manager. * @breif get the current EObject manager.
* @return the requested object manager. * @return the requested object manager.
*/ */
ewol::EObjectManager& GetEObjectManager(void); ewol::EObjectManager& getEObjectManager(void);
/** /**
* @breif Get the current EObject Message Multicast manager. * @breif get the current EObject Message Multicast manager.
* @return the requested object manager. * @return the requested object manager.
*/ */
ewol::EMultiCast& GetMultiCast(void); ewol::EMultiCast& getMultiCast(void);
/** /**
* @brief Get the curent the system inteface. * @brief get the curent the system inteface.
* @return current reference on the instance. * @return current reference on the instance.
*/ */
eContext& GetContext(void); eContext& getContext(void);
}; };
}; };

View File

@ -15,97 +15,97 @@
ewol::EObjectManager::EObjectManager(void) ewol::EObjectManager::EObjectManager(void)
{ {
EWOL_DEBUG("==> Init EObject-Manager"); EWOL_DEBUG(" == > init EObject-Manager");
// Can create mlemory leak ... ==> but not predictable comportement otherwise ... // Can create mlemory leak ... == > but not predictable comportement otherwise ...
m_eObjectAutoRemoveList.Clear(); m_eObjectAutoRemoveList.clear();
m_eObjectList.Clear(); m_eObjectList.clear();
} }
ewol::EObjectManager::~EObjectManager(void) ewol::EObjectManager::~EObjectManager(void)
{ {
bool hasError = false; bool hasError = false;
if (m_eObjectAutoRemoveList.Size()!=0) { if (m_eObjectAutoRemoveList.size()!=0) {
EWOL_ERROR("Must not have anymore eObject to auto-remove !!!"); EWOL_ERROR("Must not have anymore eObject to auto-remove !!!");
hasError = true; hasError = true;
} }
if (m_eObjectList.Size()!=0) { if (m_eObjectList.size()!=0) {
EWOL_ERROR("Must not have anymore eObject !!!"); EWOL_ERROR("Must not have anymore eObject !!!");
hasError = true; hasError = true;
} }
if (true==hasError) { if (true == hasError) {
EWOL_ERROR("Check if the function UnInit has been called !!!"); EWOL_ERROR("Check if the function UnInit has been called !!!");
} }
} }
void ewol::EObjectManager::UnInit(void) void ewol::EObjectManager::unInit(void)
{ {
EWOL_DEBUG("==> Un-Init EObject-Manager"); EWOL_DEBUG(" == > Un-Init EObject-Manager");
RemoveAllAutoRemove(); removeAllAutoRemove();
EWOL_INFO(" Remove missing user widget"); EWOL_INFO(" remove missing user widget");
int32_t iii=0; int32_t iii=0;
while(iii<m_eObjectList.Size()) { while(iii<m_eObjectList.size()) {
if (m_eObjectList[iii]!=NULL) { if (m_eObjectList[iii]!=NULL) {
if (m_eObjectList[iii]->GetStatic() == true) { if (m_eObjectList[iii]->getStatic() == true) {
iii++; iii++;
} else { } else {
EWOL_WARNING("Un-INIT : Remove EObject type=\"" << m_eObjectList[iii]->GetObjectType() << "\""); EWOL_WARNING("Un-INIT : remove EObject type=\"" << m_eObjectList[iii]->getObjectType() << "\"");
delete(m_eObjectList[iii]); delete(m_eObjectList[iii]);
m_eObjectList[iii] = NULL; m_eObjectList[iii] = NULL;
} }
} else { } else {
m_eObjectList.Erase(iii); m_eObjectList.erase(iii);
} }
} }
} }
void ewol::EObjectManager::Add(ewol::EObject* _object) void ewol::EObjectManager::add(ewol::EObject* _object)
{ {
if (NULL != _object) { if (NULL != _object) {
m_eObjectList.PushBack(_object); m_eObjectList.pushBack(_object);
} else { } else {
EWOL_ERROR("try to add an inexistant EObject in manager"); EWOL_ERROR("try to add an inexistant EObject in manager");
} }
} }
int32_t ewol::EObjectManager::GetNumberObject(void) int32_t ewol::EObjectManager::getNumberObject(void)
{ {
return m_eObjectList.Size() + m_eObjectAutoRemoveList.Size(); return m_eObjectList.size() + m_eObjectAutoRemoveList.size();
} }
void ewol::EObjectManager::informOneObjectIsRemoved(ewol::EObject* _object) void ewol::EObjectManager::informOneObjectIsRemoved(ewol::EObject* _object)
{ {
for (int32_t iii=0; iii<m_eObjectList.Size(); iii++) { for (int32_t iii=0; iii<m_eObjectList.size(); iii++) {
if (m_eObjectList[iii] != NULL) { if (m_eObjectList[iii] != NULL) {
m_eObjectList[iii]->OnObjectRemove(_object); m_eObjectList[iii]->onObjectRemove(_object);
} }
} }
for (int32_t iii=0; iii<m_eObjectAutoRemoveList.Size(); iii++) { for (int32_t iii=0; iii<m_eObjectAutoRemoveList.size(); iii++) {
if( m_eObjectAutoRemoveList[iii] != NULL if( m_eObjectAutoRemoveList[iii] != NULL
&& m_eObjectAutoRemoveList[iii] != _object) { && m_eObjectAutoRemoveList[iii] != _object) {
m_eObjectAutoRemoveList[iii]->OnObjectRemove(_object); m_eObjectAutoRemoveList[iii]->onObjectRemove(_object);
} }
} }
// call input event manager to remove linked widget ... // call input event manager to remove linked widget ...
ewol::GetContext().OnObjectRemove(_object); ewol::getContext().onObjectRemove(_object);
} }
void ewol::EObjectManager::Rm(ewol::EObject* _object) void ewol::EObjectManager::rm(ewol::EObject* _object)
{ {
if (NULL == _object) { if (NULL == _object) {
EWOL_ERROR("Try to remove (NULL) EObject"); EWOL_ERROR("Try to remove (NULL) EObject");
return; return;
} }
for (int32_t iii=0; iii<m_eObjectList.Size(); iii++) { for (int32_t iii=0; iii<m_eObjectList.size(); iii++) {
if (m_eObjectList[iii] == _object) { if (m_eObjectList[iii] == _object) {
// Remove Element // remove Element
m_eObjectList[iii] = NULL; m_eObjectList[iii] = NULL;
m_eObjectList.Erase(iii); m_eObjectList.erase(iii);
informOneObjectIsRemoved(_object); informOneObjectIsRemoved(_object);
return; return;
} }
} }
// check if the object has not been auto removed ... or remove in defered time ... // check if the object has not been auto removed ... or remove in defered time ...
for (int32_t iii=0; iii<m_eObjectAutoRemoveList.Size(); iii++) { for (int32_t iii=0; iii<m_eObjectAutoRemoveList.size(); iii++) {
if( m_eObjectAutoRemoveList[iii] != NULL if( m_eObjectAutoRemoveList[iii] != NULL
&& m_eObjectAutoRemoveList[iii] == _object) { && m_eObjectAutoRemoveList[iii] == _object) {
return; return;
@ -115,21 +115,21 @@ void ewol::EObjectManager::Rm(ewol::EObject* _object)
EWOL_ERROR("Try to remove EObject that is not referenced ..."); EWOL_ERROR("Try to remove EObject that is not referenced ...");
} }
void ewol::EObjectManager::AutoRemove(ewol::EObject* _object) void ewol::EObjectManager::autoRemove(ewol::EObject* _object)
{ {
if (NULL == _object) { if (NULL == _object) {
EWOL_ERROR("Try to Auto-Remove (NULL) EObject"); EWOL_ERROR("Try to Auto-Remove (NULL) EObject");
return; return;
} }
for (int32_t iii=0; iii<m_eObjectList.Size(); iii++) { for (int32_t iii=0; iii<m_eObjectList.size(); iii++) {
if (m_eObjectList[iii] == _object) { if (m_eObjectList[iii] == _object) {
// Remove Element // remove Element
m_eObjectList[iii] = NULL; m_eObjectList[iii] = NULL;
m_eObjectList.Erase(iii); m_eObjectList.erase(iii);
EWOL_DEBUG("Auto-Remove EObject : [" << _object->GetId() << "] type=\"" << _object->GetObjectType() << "\""); EWOL_DEBUG("Auto-Remove EObject : [" << _object->getId() << "] type=\"" << _object->getObjectType() << "\"");
informOneObjectIsRemoved(_object); informOneObjectIsRemoved(_object);
m_eObjectAutoRemoveList.PushBack(_object); m_eObjectAutoRemoveList.pushBack(_object);
ewol::GetContext().ForceRedrawAll(); ewol::getContext().forceRedrawAll();
return; return;
} }
} }
@ -137,29 +137,29 @@ void ewol::EObjectManager::AutoRemove(ewol::EObject* _object)
} }
// clean all EObject that request an autoRemove ... // clean all EObject that request an autoRemove ...
void ewol::EObjectManager::RemoveAllAutoRemove(void) void ewol::EObjectManager::removeAllAutoRemove(void)
{ {
//EWOL_DEBUG("Auto-Remove EObject section : " << m_eObjectAutoRemoveList.Size() << " elemeents"); //EWOL_DEBUG("Auto-Remove EObject section : " << m_eObjectAutoRemoveList.size() << " elemeents");
while(0<m_eObjectAutoRemoveList.Size()) { while(0<m_eObjectAutoRemoveList.size()) {
if (m_eObjectAutoRemoveList[0]!=NULL) { if (m_eObjectAutoRemoveList[0]!=NULL) {
EWOL_DEBUG("Real Auto-Remove EObject type=\"" << m_eObjectAutoRemoveList[0]->GetObjectType() << "\""); EWOL_DEBUG("Real Auto-Remove EObject type=\"" << m_eObjectAutoRemoveList[0]->getObjectType() << "\"");
delete(m_eObjectAutoRemoveList[0]); delete(m_eObjectAutoRemoveList[0]);
m_eObjectAutoRemoveList[0] = NULL; m_eObjectAutoRemoveList[0] = NULL;
} else { } else {
m_eObjectAutoRemoveList.Erase(0); m_eObjectAutoRemoveList.erase(0);
} }
} }
m_eObjectAutoRemoveList.Clear(); m_eObjectAutoRemoveList.clear();
} }
ewol::EObject* ewol::EObjectManager::Get(const etk::UString& _name) ewol::EObject* ewol::EObjectManager::get(const etk::UString& _name)
{ {
if (_name=="") { if (_name == "") {
return NULL; return NULL;
} }
for (int32_t iii=0; iii<m_eObjectList.Size(); iii++) { for (int32_t iii=0; iii<m_eObjectList.size(); iii++) {
if (m_eObjectList[iii] != NULL) { if (m_eObjectList[iii] != NULL) {
if (m_eObjectList[iii]->GetName() == _name) { if (m_eObjectList[iii]->getName() == _name) {
return m_eObjectList[iii]; return m_eObjectList[iii];
} }
} }

View File

@ -18,7 +18,7 @@ namespace ewol
class EObjectManager class EObjectManager
{ {
private: private:
etk::Vector<ewol::EObject*> m_eObjectList; // all widget allocated ==> all time increment ... never removed ... etk::Vector<ewol::EObject*> m_eObjectList; // all widget allocated == > all time increment ... never removed ...
etk::Vector<ewol::EObject*> m_eObjectAutoRemoveList; // all widget allocated etk::Vector<ewol::EObject*> m_eObjectAutoRemoveList; // all widget allocated
public: public:
EObjectManager(void); EObjectManager(void);
@ -26,22 +26,22 @@ namespace ewol
/** /**
* @brief remove all resources (un-init) out of the destructor (due to the system implementation) * @brief remove all resources (un-init) out of the destructor (due to the system implementation)
*/ */
void UnInit(void); void unInit(void);
void Add(ewol::EObject* _object); void add(ewol::EObject* _object);
void Rm(ewol::EObject* _object); void rm(ewol::EObject* _object);
int32_t GetNumberObject(void); int32_t getNumberObject(void);
void AutoRemove(ewol::EObject* _object); void autoRemove(ewol::EObject* _object);
void RemoveAllAutoRemove(void); void removeAllAutoRemove(void);
ewol::EObject* Get(const etk::UString& _name); ewol::EObject* get(const etk::UString& _name);
private: private:
void informOneObjectIsRemoved(ewol::EObject* _object); void informOneObjectIsRemoved(ewol::EObject* _object);
private: private:
ewol::EMultiCast m_multiCast; //!< muticast manager ewol::EMultiCast m_multiCast; //!< muticast manager
public: public:
ewol::EMultiCast& MultiCast(void) { return m_multiCast; }; ewol::EMultiCast& multiCast(void) { return m_multiCast; };
}; };
}; };

View File

@ -13,10 +13,10 @@
etk::CCout& ewol::operator <<(etk::CCout& _os, const ewol::EventEntry& _obj) etk::CCout& ewol::operator <<(etk::CCout& _os, const ewol::EventEntry& _obj)
{ {
_os << "{type=" << _obj.GetType(); _os << "{type=" << _obj.getType();
_os << " status=" << _obj.GetStatus(); _os << " status=" << _obj.getStatus();
if (_obj.GetType() == ewol::keyEvent::keyboardChar) { if (_obj.getType() == ewol::keyEvent::keyboardChar) {
_os << " char=" << _obj.GetChar(); _os << " char=" << _obj.getChar();
} }
_os << "}"; _os << "}";
return _os; return _os;

View File

@ -29,14 +29,14 @@ namespace ewol {
m_specialKey(_specialKey), m_specialKey(_specialKey),
m_unicodeData(_char) m_unicodeData(_char)
{ }; { };
void SetType(ewol::keyEvent::keyboard_te _type) { m_type = _type; }; void setType(ewol::keyEvent::keyboard_te _type) { m_type = _type; };
inline const ewol::keyEvent::keyboard_te& GetType(void) const { return m_type; }; inline const ewol::keyEvent::keyboard_te& getType(void) const { return m_type; };
void SetStatus(ewol::keyEvent::status_te _status) { m_status = _status; }; void setStatus(ewol::keyEvent::status_te _status) { m_status = _status; };
inline const ewol::keyEvent::status_te& GetStatus(void) const { return m_status; }; inline const ewol::keyEvent::status_te& getStatus(void) const { return m_status; };
void SetSpecialKey(const ewol::SpecialKey& _specialKey) { m_specialKey = _specialKey; }; void setSpecialKey(const ewol::SpecialKey& _specialKey) { m_specialKey = _specialKey; };
inline const ewol::SpecialKey& GetSpecialKey(void) const { return m_specialKey; }; inline const ewol::SpecialKey& getSpecialKey(void) const { return m_specialKey; };
void SetChar(uniChar_t _char) { m_unicodeData = _char; }; void setChar(uniChar_t _char) { m_unicodeData = _char; };
inline const uniChar_t& GetChar(void) const { return m_unicodeData; }; inline const uniChar_t& getChar(void) const { return m_unicodeData; };
}; };
etk::CCout& operator <<(etk::CCout& _os, const ewol::EventEntry& _obj); etk::CCout& operator <<(etk::CCout& _os, const ewol::EventEntry& _obj);

View File

@ -13,10 +13,10 @@
etk::CCout& ewol::operator <<(etk::CCout& _os, const ewol::EventInput& _obj) etk::CCout& ewol::operator <<(etk::CCout& _os, const ewol::EventInput& _obj)
{ {
_os << "{type=" << _obj.GetType(); _os << "{type=" << _obj.getType();
_os << " status=" << _obj.GetStatus(); _os << " status=" << _obj.getStatus();
_os << " id=" << _obj.GetId(); _os << " id=" << _obj.getId();
_os << " pos=" << _obj.GetPos(); _os << " pos=" << _obj.getPos();
_os << "}"; _os << "}";
return _os; return _os;
} }

View File

@ -28,14 +28,14 @@ namespace ewol {
m_inputId(_id), m_inputId(_id),
m_pos(_pos) m_pos(_pos)
{ }; { };
void SetType(ewol::keyEvent::type_te _type) { m_type = _type; }; void setType(ewol::keyEvent::type_te _type) { m_type = _type; };
inline const ewol::keyEvent::type_te& GetType(void) const { return m_type; }; inline const ewol::keyEvent::type_te& getType(void) const { return m_type; };
void SetStatus(ewol::keyEvent::status_te _status) { m_status = _status; }; void setStatus(ewol::keyEvent::status_te _status) { m_status = _status; };
inline const ewol::keyEvent::status_te& GetStatus(void) const { return m_status; }; inline const ewol::keyEvent::status_te& getStatus(void) const { return m_status; };
void SetId(uint8_t _id) { m_inputId = _id; }; void setId(uint8_t _id) { m_inputId = _id; };
inline const uint8_t& GetId(void) const { return m_inputId; }; inline const uint8_t& getId(void) const { return m_inputId; };
void SetPos(const vec2& _pos) { m_pos = _pos; }; void setPos(const vec2& _pos) { m_pos = _pos; };
inline const vec2& GetPos(void) const { return m_pos; }; inline const vec2& getPos(void) const { return m_pos; };
}; };
etk::CCout& operator <<(etk::CCout& _os, const ewol::EventInput& _obj); etk::CCout& operator <<(etk::CCout& _os, const ewol::EventInput& _obj);
@ -56,10 +56,10 @@ namespace ewol {
ewol::Widget* m_dest; ewol::Widget* m_dest;
int32_t m_realIdEvent; int32_t m_realIdEvent;
public: public:
void SetDestWidget(ewol::Widget* _dest) { m_dest = _dest; }; void setDestWidget(ewol::Widget* _dest) { m_dest = _dest; };
inline ewol::Widget* GetDestWidget(void) const { return m_dest; }; inline ewol::Widget* getDestWidget(void) const { return m_dest; };
void SetRealId(int32_t _realIdEvent) { m_realIdEvent = _realIdEvent; }; void setRealId(int32_t _realIdEvent) { m_realIdEvent = _realIdEvent; };
inline int32_t GetRealId(void) const { return m_realIdEvent; }; inline int32_t getRealId(void) const { return m_realIdEvent; };
/* /*
private: private:
int64_t m_lastTime; int64_t m_lastTime;

View File

@ -13,10 +13,10 @@
etk::CCout& ewol::operator <<(etk::CCout& _os, const ewol::EventTime& _obj) etk::CCout& ewol::operator <<(etk::CCout& _os, const ewol::EventTime& _obj)
{ {
_os << "{time=" << _obj.GetTime(); _os << "{time=" << _obj.getTime();
_os << " uptime=" << _obj.GetApplUpTime(); _os << " uptime=" << _obj.getApplUpTime();
_os << " delta=" << _obj.GetDelta(); _os << " delta=" << _obj.getDelta();
_os << " deltaCall=" << _obj.GetDeltaCall(); _os << " deltaCall=" << _obj.getDeltaCall();
_os << "}"; _os << "}";
return _os; return _os;
} }

View File

@ -29,15 +29,15 @@ namespace ewol {
m_timeDeltaCall(_timeDeltaCall) m_timeDeltaCall(_timeDeltaCall)
{ }; { };
public: public:
void SetTime(int64_t _timeSystem) { m_timeSystem=_timeSystem; }; void setTime(int64_t _timeSystem) { m_timeSystem=_timeSystem; };
inline int64_t GetTime(void) const { return m_timeSystem; }; inline int64_t getTime(void) const { return m_timeSystem; };
void SetApplWakeUpTime(int64_t _timeUpAppl) { m_timeUpAppl=_timeUpAppl; }; void setApplWakeUpTime(int64_t _timeUpAppl) { m_timeUpAppl=_timeUpAppl; };
inline int64_t GetApplWakeUpTime(void) const { return m_timeUpAppl; }; inline int64_t getApplWakeUpTime(void) const { return m_timeUpAppl; };
inline int64_t GetApplUpTime(void) const { return m_timeSystem-m_timeUpAppl; }; inline int64_t getApplUpTime(void) const { return m_timeSystem-m_timeUpAppl; };
void SetDelta(float _timeDelta) { m_timeDelta=_timeDelta; }; void setDelta(float _timeDelta) { m_timeDelta=_timeDelta; };
inline float GetDelta(void) const { return m_timeDelta; }; inline float getDelta(void) const { return m_timeDelta; };
void SetDeltaCall(float _timeDeltaCall) { m_timeDeltaCall=_timeDeltaCall; }; void setDeltaCall(float _timeDeltaCall) { m_timeDeltaCall=_timeDeltaCall; };
inline float GetDeltaCall(void) const { return m_timeDeltaCall; }; inline float getDeltaCall(void) const { return m_timeDeltaCall; };
}; };
etk::CCout& operator <<(etk::CCout& _os, const ewol::EventTime& _obj); etk::CCout& operator <<(etk::CCout& _os, const ewol::EventTime& _obj);
}; };

View File

@ -13,8 +13,6 @@ namespace ewol
{ {
/** /**
* @brief This class is designed to count the number of frame per second in the main renderer system * @brief This class is designed to count the number of frame per second in the main renderer system
* @param ---
* @return ---
*/ */
class Fps class Fps
{ {
@ -38,11 +36,8 @@ namespace ewol
public: public:
/** /**
* @brief Constructor * @brief Constructor
* @param ---
* @return ---
*/ */
Fps(const char * displayName, bool displayFPS) Fps(const char * displayName, bool displayFPS) {
{
startTime = -1; startTime = -1;
nbCallTime = 0; nbCallTime = 0;
nbDisplayTime = 0; nbDisplayTime = 0;
@ -60,21 +55,15 @@ namespace ewol
} }
/** /**
* @brief Destructor * @brief Destructor
* @param ---
* @return ---
*/ */
~Fps(void) ~Fps(void) {
{
} }
/** /**
* @brief this might be call every time a diplay start * @brief this might be call every time a diplay start
* @param ---
* @return ---
*/ */
void Tic(void) void tic(void) {
{ int64_t currentTime = ewol::getTime();
int64_t currentTime = ewol::GetTime();
ticTime = currentTime; ticTime = currentTime;
nbCallTime++; nbCallTime++;
if (startTime<0) { if (startTime<0) {
@ -87,14 +76,12 @@ namespace ewol
} }
/** /**
* @brief this might be call every time a diplay stop, it do the display every second * @brief this might be call every time a diplay stop, it do the display every second
* @param[in] displayTime Display curent time of the frame. * @param[in] displayTime display curent time of the frame.
* @return ---
*/ */
void Toc(bool displayTime=false) void toc(bool displayTime = false) {
{ int64_t currentTime = ewol::getTime();
int64_t currentTime = ewol::GetTime();
int64_t processTimeLocal = (currentTime - ticTime); int64_t processTimeLocal = (currentTime - ticTime);
if (displayTime==true) { if (displayTime == true) {
EWOL_DEBUG(m_displayName << " : processTime : " << (float)((float)processTimeLocal / 1000.0) << "ms "); EWOL_DEBUG(m_displayName << " : processTime : " << (float)((float)processTimeLocal / 1000.0) << "ms ");
} }
if (drwingDone) { if (drwingDone) {
@ -111,16 +98,14 @@ namespace ewol
/** /**
* @brief this might be call when a display is really done * @brief this might be call when a display is really done
*/ */
void IncrementCounter(void) void incrementCounter(void) {
{
nbDisplayTime++; nbDisplayTime++;
drwingDone = true; drwingDone = true;
} }
/** /**
* @brief Draw debug display ... * @brief draw debug display ...
*/ */
void Draw(void) void draw(void) {
{
if (true == display) { if (true == display) {
if (nbDisplayTime>0) { if (nbDisplayTime>0) {
EWOL_DEBUG(m_displayName << " : Active : " EWOL_DEBUG(m_displayName << " : Active : "
@ -151,14 +136,5 @@ namespace ewol
} }
}; };
}; };
/**
* @brief This fuction display and calculate the curent frame per second of the display
* @note this function must be call 2 time the first at the start of the display and the second at the end of this one
* @param[in] Represent the mode of the counter
* @param[in] the curent system time
* @ return ---
*/
#endif #endif

View File

@ -32,7 +32,7 @@
#include <mach/mach.h> #include <mach/mach.h>
int64_t ewol::GetTime(void) int64_t ewol::getTime(void)
{ {
struct timespec now; struct timespec now;
clock_serv_t cclock; clock_serv_t cclock;
@ -100,7 +100,7 @@ MacOSInterface* interface = NULL;
bool MacOs::Draw(bool _displayEveryTime) bool MacOs::draw(bool _displayEveryTime)
{ {
if (interface == NULL) { if (interface == NULL) {
return false; return false;
@ -117,7 +117,7 @@ void MacOs::Resize(float _x, float _y)
} }
void MacOs::SetMouseState(int32_t _id, bool _isDown, float _x, float _y) void MacOs::setMouseState(int32_t _id, bool _isDown, float _x, float _y)
{ {
if (interface == NULL) { if (interface == NULL) {
return; return;
@ -125,7 +125,7 @@ void MacOs::SetMouseState(int32_t _id, bool _isDown, float _x, float _y)
interface->MAC_SetMouseState(_id, _isDown, _x, _y); interface->MAC_SetMouseState(_id, _isDown, _x, _y);
} }
void MacOs::SetMouseMotion(int32_t _id, float _x, float _y) void MacOs::setMouseMotion(int32_t _id, float _x, float _y)
{ {
if (interface == NULL) { if (interface == NULL) {
return; return;
@ -133,7 +133,7 @@ void MacOs::SetMouseMotion(int32_t _id, float _x, float _y)
interface->MAC_SetMouseMotion(_id, _x, _y); interface->MAC_SetMouseMotion(_id, _x, _y);
} }
void MacOs::SetKeyboard(ewol::SpecialKey _keyboardMode, int32_t _unichar, bool _isDown, bool _isAReapeateKey) void MacOs::setKeyboard(ewol::SpecialKey _keyboardMode, int32_t _unichar, bool _isDown, bool _isAReapeateKey)
{ {
if (interface == NULL) { if (interface == NULL) {
return; return;
@ -150,7 +150,7 @@ void MacOs::SetKeyboard(ewol::SpecialKey _keyboardMode, int32_t _unichar, bool _
*/ */
int ewol::Run(int _argc, const char *_argv[]) int ewol::Run(int _argc, const char *_argv[])
{ {
etk::SetArgZero(_argv[0]); etk::setArgZero(_argv[0]);
interface = new MacOSInterface(_argc, _argv); interface = new MacOSInterface(_argc, _argv);
if (NULL == interface) { if (NULL == interface) {
EWOL_CRITICAL("Can not create the X11 interface ... MEMORY allocation error"); EWOL_CRITICAL("Can not create the X11 interface ... MEMORY allocation error");

View File

@ -15,16 +15,16 @@ namespace MacOs
{ {
// return true if a flush is needed // return true if a flush is needed
bool Draw(bool _displayEveryTime); bool draw(bool _displayEveryTime);
/** /**
* @brief The OS inform that the current windows has change his size. * @brief The OS inform that the current windows has change his size.
* @param[in] _size new size of the windows. * @param[in] _size new size of the windows.
*/ */
void Resize(float _x, float _y); void Resize(float _x, float _y);
void SetMouseState(int32_t _id, bool _isDown, float _x, float _y); void setMouseState(int32_t _id, bool _isDown, float _x, float _y);
void SetMouseMotion(int32_t _id, float _x, float _y); void setMouseMotion(int32_t _id, float _x, float _y);
void SetKeyboard(ewol::SpecialKey _keyboardMode, int32_t _unichar, bool _isDown, bool _isAReapeateKey); void setKeyboard(ewol::SpecialKey _keyboardMode, int32_t _unichar, bool _isDown, bool _isAReapeateKey);
}; };

View File

@ -10,7 +10,7 @@
#import <Cocoa/Cocoa.h> #import <Cocoa/Cocoa.h>
@interface OpenGLView : NSOpenGLView<NSWindowDelegate> @interface openGLView : NSOpenGLView<NSWindowDelegate>
{ {
} }
- (void)prepareOpenGL; - (void)prepareOpenGL;

View File

@ -27,7 +27,7 @@
int64_t ewol::GetTime(void) int64_t ewol::getTime(void)
{ {
struct timeval now; struct timeval now;
gettimeofday(&now, NULL); gettimeofday(&now, NULL);
@ -78,8 +78,8 @@ class WindowsContext : public ewol::eContext
wc.cbClsExtra = 0; wc.cbClsExtra = 0;
wc.cbWndExtra = 0; wc.cbWndExtra = 0;
wc.hInstance = hInstance; wc.hInstance = hInstance;
wc.hIcon = LoadIcon( NULL, IDI_APPLICATION ); wc.hIcon = loadIcon( NULL, IDI_APPLICATION );
wc.hCursor = LoadCursor( NULL, IDC_ARROW ); wc.hCursor = loadCursor( NULL, IDC_ARROW );
wc.hbrBackground = (HBRUSH)GetStockObject( BLACK_BRUSH ); wc.hbrBackground = (HBRUSH)GetStockObject( BLACK_BRUSH );
wc.lpszMenuName = NULL; wc.lpszMenuName = NULL;
wc.lpszClassName = "EwolMainWindows"; wc.lpszClassName = "EwolMainWindows";
@ -90,13 +90,13 @@ class WindowsContext : public ewol::eContext
WS_CAPTION | WS_POPUPWINDOW | WS_VISIBLE | WS_SIZEBOX, WS_CAPTION | WS_POPUPWINDOW | WS_VISIBLE | WS_SIZEBOX,
0, 0, 800, 600, 0, 0, 800, 600,
NULL, NULL, hInstance, NULL ); NULL, NULL, hInstance, NULL );
int border_thickness = GetSystemMetrics(SM_CXSIZEFRAME); int border_thickness = getSystemMetrics(SM_CXSIZEFRAME);
int title_size = GetSystemMetrics(SM_CYCAPTION); int title_size = getSystemMetrics(SM_CYCAPTION);
m_currentHeight = 600-2*border_thickness -title_size; m_currentHeight = 600-2*border_thickness -title_size;
OS_Resize(800-2*border_thickness, m_currentHeight); OS_Resize(800-2*border_thickness, m_currentHeight);
// enable OpenGL for the window // enable openGL for the window
EnableOpenGL( hWnd, &hDC, &hRC ); enableOpenGL( hWnd, &hDC, &hRC );
// program main loop // program main loop
while(true == m_run) { while(true == m_run) {
@ -106,7 +106,7 @@ class WindowsContext : public ewol::eContext
if ( msg.message == WM_QUIT ) { if ( msg.message == WM_QUIT ) {
m_run = false; m_run = false;
} else { } else {
TranslateMessage( &msg ); translateMessage( &msg );
DispatchMessage( &msg ); DispatchMessage( &msg );
} }
} else { } else {
@ -114,8 +114,8 @@ class WindowsContext : public ewol::eContext
SwapBuffers( hDC ); SwapBuffers( hDC );
} }
} }
// shutdown OpenGL // shutdown openGL
DisableOpenGL( hWnd, hDC, hRC ); disableOpenGL( hWnd, hDC, hRC );
// destroy the window explicitly // destroy the window explicitly
DestroyWindow( hWnd ); DestroyWindow( hWnd );
return msg.wParam; return msg.wParam;
@ -128,10 +128,10 @@ class WindowsContext : public ewol::eContext
PostQuitMessage(0); PostQuitMessage(0);
} }
void SetSize(const vec2& _size) void setSize(const vec2& _size)
{ {
int border_thickness = GetSystemMetrics(SM_CXSIZEFRAME); int border_thickness = getSystemMetrics(SM_CXSIZEFRAME);
int title_size = GetSystemMetrics(SM_CYCAPTION); int title_size = getSystemMetrics(SM_CYCAPTION);
size.setValue(_size.x() + border_thickness*2, size.setValue(_size.x() + border_thickness*2,
_size.y() + border_thickness*2 + title_size); _size.y() + border_thickness*2 + title_size);
//m_currentHeight = size.y; //m_currentHeight = size.y;
@ -141,7 +141,7 @@ class WindowsContext : public ewol::eContext
void ClipBoardGet(ewol::clipBoard::clipboardListe_te _clipboardID) void ClipBoardGet(ewol::clipBoard::clipboardListe_te _clipboardID)
{ {
// this is to force the local system to think we have the buffer // this is to force the local system to think we have the buffer
// TODO : Remove this 2 Line when code will be writen // TODO : remove this 2 line when code will be writen
l_clipBoardOwnerStd = true; l_clipBoardOwnerStd = true;
switch (_clipboardID) switch (_clipboardID)
{ {
@ -152,7 +152,7 @@ class WindowsContext : public ewol::eContext
break; break;
case ewol::clipBoard::clipboardStd: case ewol::clipBoard::clipboardStd:
if (false == l_clipBoardOwnerStd) { if (false == l_clipBoardOwnerStd) {
// Generate a request TO the OS // generate a request TO the OS
// TODO : Send the message to the OS "We disire to receive the copy buffer ... // TODO : Send the message to the OS "We disire to receive the copy buffer ...
} else { } else {
// just transmit an event , we have the data in the system // just transmit an event , we have the data in the system
@ -187,11 +187,11 @@ class WindowsContext : public ewol::eContext
// Enable OpenGL // enable openGL
void EnableOpenGL(HWND _hWnd, HDC* _hDC, HGLRC* _hRC) void enableOpenGL(HWND _hWnd, HDC* _hDC, HGLRC* _hRC)
{ {
// get the device context (DC) // get the device context (DC)
*hDC = GetDC( _hWnd ); *hDC = getDC( _hWnd );
PIXELFORMATDESCRIPTOR pfd; PIXELFORMATDESCRIPTOR pfd;
// set the pixel format for the DC // set the pixel format for the DC
@ -204,7 +204,7 @@ class WindowsContext : public ewol::eContext
pfd.cDepthBits = 16; pfd.cDepthBits = 16;
pfd.iLayerType = PFD_MAIN_PLANE; pfd.iLayerType = PFD_MAIN_PLANE;
int format = ChoosePixelFormat( *_hDC, &pfd ); int format = ChoosePixelFormat( *_hDC, &pfd );
SetPixelFormat( *_hDC, format, &pfd ); setPixelFormat( *_hDC, format, &pfd );
// create and enable the render context (RC) // create and enable the render context (RC)
*_hRC = wglCreateContext( *_hDC ); *_hRC = wglCreateContext( *_hDC );
@ -212,20 +212,20 @@ class WindowsContext : public ewol::eContext
} }
// Disable OpenGL // disable openGL
void DisableOpenGL(HWND _hWnd, HDC _hDC, HGLRC _hRC) void disableOpenGL(HWND _hWnd, HDC _hDC, HGLRC _hRC)
{ {
wglMakeCurrent( NULL, NULL ); wglMakeCurrent( NULL, NULL );
wglDeleteContext( _hRC ); wglDeleteContext( _hRC );
ReleaseDC( _hWnd, _hDC ); releaseDC( _hWnd, _hDC );
} }
// Window Procedure // Window Procedure
static LRESULT CALLBACK WndProc(HWND _hWnd, UINT _message, WPARAM _wParam, LPARAM _lParam) static LRESULT CALLBACK WndProc(HWND _hWnd, UINT _message, WPARAM _wParam, LPARAM _lParam)
{ {
// TODO : Set this function really work... // TODO : set this function really work...
classPointer->WndProcReal(_hWnd, _message, _wParam, _lParam); classPointer->WndProcReal(_hWnd, _message, _wParam, _lParam);
} }
@ -274,8 +274,8 @@ class WindowsContext : public ewol::eContext
if (NULL != tmpVal) { if (NULL != tmpVal) {
//EWOL_DEBUG("WM_WINDOWPOSCHANGING : : (" << tmpVal->x << "," << tmpVal->y << ") ( " << tmpVal->cx << "," << tmpVal->cy << ")"); //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 : // in windows system, we need to remove the size of the border elements :
int border_thickness = GetSystemMetrics(SM_CXSIZEFRAME); int border_thickness = getSystemMetrics(SM_CXSIZEFRAME);
int title_size = GetSystemMetrics(SM_CYCAPTION); int title_size = getSystemMetrics(SM_CYCAPTION);
m_currentHeight = tmpVal->cy - 2*border_thickness - title_size; m_currentHeight = tmpVal->cy - 2*border_thickness - title_size;
OS_Resize(tmpVal->cx-2*border_thickness, m_currentHeight); OS_Resize(tmpVal->cx-2*border_thickness, m_currentHeight);
} }
@ -362,14 +362,14 @@ class WindowsContext : public ewol::eContext
//case : keyInput = ewol::keyEvent::keyboardContextMenu; break; //case : keyInput = ewol::keyEvent::keyboardContextMenu; break;
case VK_NUMLOCK: keyInput = ewol::keyEvent::keyboardNumLock; guiKeyBoardMode.numLock = buttonIsDown; break; case VK_NUMLOCK: keyInput = ewol::keyEvent::keyboardNumLock; guiKeyBoardMode.numLock = buttonIsDown; break;
case VK_BACK: // DEL case VK_BACK: // DEL
tmpChar.Set(0x08); tmpChar.set(0x08);
break; break;
// TODO : Really strang, need to understand why ... // TODO : Really strang, need to understand why ...
case 46: // Suppr case 46: // Suppr
tmpChar.Set(0x7F); tmpChar.set(0x7F);
break; break;
case VK_TAB: // special case for TAB case VK_TAB: // special case for TAB
tmpChar.Set(0x09); tmpChar.set(0x09);
break; break;
case VK_RETURN: // special case for TAB case VK_RETURN: // special case for TAB
tmpChar = '\n'; tmpChar = '\n';
@ -377,18 +377,18 @@ class WindowsContext : public ewol::eContext
default: default:
{ {
BYTE kbd[256]; BYTE kbd[256];
GetKeyboardState(kbd); getKeyboardState(kbd);
const int BUFFER_LENGTH = 8; //Length of the buffer const int BUFFER_LENGTH = 8; //Length of the buffer
WCHAR chars[BUFFER_LENGTH]; WCHAR chars[BUFFER_LENGTH];
ToUnicode(wParam,lParam,kbd,chars,BUFFER_LENGTH,0); ToUnicode(wParam,lParam,kbd,chars,BUFFER_LENGTH,0);
tmpChar.SetUtf8((char*)chars); tmpChar.setUtf8((char*)chars);
} }
break; break;
} }
EWOL_DEBUG("kjhkjhkjhkjhkj = " << _wParam); EWOL_DEBUG("kjhkjhkjhkjhkj = " << _wParam);
if (tmpChar == 0) { if (tmpChar == 0) {
//EWOL_DEBUG("eventKey Move type : " << GetCharTypeMoveEvent(keyInput) ); //EWOL_DEBUG("eventKey Move type : " << getCharTypeMoveEvent(keyInput) );
OS_SetKeyboardMove(guiKeyBoardMode, keyInput, buttonIsDown); OS_SetKeyboardMove(guiKeyBoardMode, keyInput, buttonIsDown);
} else { } else {
OS_SetKeyboard(guiKeyBoardMode, tmpChar, buttonIsDown); OS_SetKeyboard(guiKeyBoardMode, tmpChar, buttonIsDown);

View File

@ -51,7 +51,7 @@ bool hasDisplay = false;
#define X11_INFO EWOL_VERBOSE #define X11_INFO EWOL_VERBOSE
#define X11_CRITICAL EWOL_VERBOSE #define X11_CRITICAL EWOL_VERBOSE
#endif #endif
int64_t ewol::GetTime(void) int64_t ewol::getTime(void)
{ {
struct timespec now; struct timespec now;
int ret = clock_gettime(CLOCK_REALTIME, &now); int ret = clock_gettime(CLOCK_REALTIME, &now);
@ -213,7 +213,7 @@ class X11Interface : public ewol::eContext
{ {
X11_INFO("Receive : ClientMessage"); X11_INFO("Receive : ClientMessage");
if(XAtomeDeleteWindows == (int64_t)event.xclient.data.l[0]) { if(XAtomeDeleteWindows == (int64_t)event.xclient.data.l[0]) {
EWOL_INFO(" ==> Kill Requested ..."); EWOL_INFO(" == > Kill Requested ...");
OS_Stop(); OS_Stop();
m_run = false; m_run = false;
} }
@ -223,7 +223,7 @@ class X11Interface : public ewol::eContext
// Selection AREA // // Selection AREA //
/////////////////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////////////////
case SelectionClear: case SelectionClear:
// Selection has been done on an other program ==> clear ours ... // Selection has been done on an other program == > clear ours ...
X11_INFO("X11 event SelectionClear"); X11_INFO("X11 event SelectionClear");
{ {
#ifdef DEBUG_X11_EVENT #ifdef DEBUG_X11_EVENT
@ -242,14 +242,14 @@ class X11Interface : public ewol::eContext
} else if (true == m_clipBoardOwnerStd) { } else if (true == m_clipBoardOwnerStd) {
m_clipBoardOwnerStd = false; m_clipBoardOwnerStd = false;
} else { } else {
EWOL_ERROR("X11 event SelectionClear ==> but no selection requested anymore ..."); EWOL_ERROR("X11 event SelectionClear == > but no selection requested anymore ...");
} }
} }
break; break;
case SelectionNotify: case SelectionNotify:
X11_INFO("X11 event SelectionNotify"); X11_INFO("X11 event SelectionNotify");
if (event.xselection.property == None) { if (event.xselection.property == None) {
EWOL_VERBOSE(" ==> no data ..."); EWOL_VERBOSE(" == > no data ...");
} else { } else {
unsigned char *buf = 0; unsigned char *buf = 0;
Atom type; Atom type;
@ -270,12 +270,12 @@ class X11Interface : public ewol::eContext
); );
if (true == m_clipBoardRequestPrimary) { if (true == m_clipBoardRequestPrimary) {
etk::UString tmpppp((char*)buf); etk::UString tmpppp((char*)buf);
ewol::clipBoard::SetSystem(ewol::clipBoard::clipboardSelection, tmpppp); ewol::clipBoard::setSystem(ewol::clipBoard::clipboardSelection, tmpppp);
// just transmit an event , we have the data in the system // just transmit an event , we have the data in the system
OS_ClipBoardArrive(ewol::clipBoard::clipboardSelection); OS_ClipBoardArrive(ewol::clipBoard::clipboardSelection);
} else { } else {
etk::UString tmpppp((char*)buf); etk::UString tmpppp((char*)buf);
ewol::clipBoard::SetSystem(ewol::clipBoard::clipboardStd, tmpppp); ewol::clipBoard::setSystem(ewol::clipBoard::clipboardStd, tmpppp);
// just transmit an event , we have the data in the system // just transmit an event , we have the data in the system
OS_ClipBoardArrive(ewol::clipBoard::clipboardStd); OS_ClipBoardArrive(ewol::clipBoard::clipboardStd);
} }
@ -299,9 +299,9 @@ class X11Interface : public ewol::eContext
etk::UString tmpData = ""; etk::UString tmpData = "";
if (req->selection == XAtomeSelection) { if (req->selection == XAtomeSelection) {
tmpData = ewol::clipBoard::Get(ewol::clipBoard::clipboardSelection); tmpData = ewol::clipBoard::get(ewol::clipBoard::clipboardSelection);
} else if (req->selection == XAtomeClipBoard) { } else if (req->selection == XAtomeClipBoard) {
tmpData = ewol::clipBoard::Get(ewol::clipBoard::clipboardStd); tmpData = ewol::clipBoard::get(ewol::clipBoard::clipboardStd);
} }
etk::Char tmpValueStoredTimeToSend = tmpData.c_str(); etk::Char tmpValueStoredTimeToSend = tmpData.c_str();
const char * magatTextToSend = tmpValueStoredTimeToSend; const char * magatTextToSend = tmpValueStoredTimeToSend;
@ -324,7 +324,7 @@ class X11Interface : public ewol::eContext
(unsigned char*)listOfAtom, (unsigned char*)listOfAtom,
nbAtomSupported ); nbAtomSupported );
respond.xselection.property=req->property; respond.xselection.property=req->property;
EWOL_INFO(" ==> Respond ... (test)"); EWOL_INFO(" == > Respond ... (test)");
} else if(XAtomeTargetString == req->target) { } else if(XAtomeTargetString == req->target) {
XChangeProperty( m_display, XChangeProperty( m_display,
req->requestor, req->requestor,
@ -335,7 +335,7 @@ class X11Interface : public ewol::eContext
(unsigned char*)magatTextToSend, (unsigned char*)magatTextToSend,
strlen(magatTextToSend)); strlen(magatTextToSend));
respond.xselection.property=req->property; respond.xselection.property=req->property;
EWOL_INFO(" ==> Respond ..."); EWOL_INFO(" == > Respond ...");
} else if (XAtomeTargetStringUTF8 == req->target) { } else if (XAtomeTargetStringUTF8 == req->target) {
XChangeProperty( m_display, XChangeProperty( m_display,
req->requestor, req->requestor,
@ -346,7 +346,7 @@ class X11Interface : public ewol::eContext
(unsigned char*)magatTextToSend, (unsigned char*)magatTextToSend,
strlen(magatTextToSend)); strlen(magatTextToSend));
respond.xselection.property=req->property; respond.xselection.property=req->property;
EWOL_INFO(" ==> Respond ..."); EWOL_INFO(" == > Respond ...");
} else { } else {
respond.xselection.property= None; respond.xselection.property= None;
} }
@ -357,7 +357,7 @@ class X11Interface : public ewol::eContext
respond.xselection.target= req->target; respond.xselection.target= req->target;
respond.xselection.time = req->time; respond.xselection.time = req->time;
XSendEvent (m_display, req->requestor,0,0,&respond); XSendEvent (m_display, req->requestor,0,0,&respond);
// Flush the message on the pipe ... // flush the message on the pipe ...
XFlush (m_display); XFlush (m_display);
} }
break; break;
@ -446,7 +446,7 @@ class X11Interface : public ewol::eContext
break; break;
case MotionNotify: case MotionNotify:
X11_INFO("X11 event MotionNotify"); X11_INFO("X11 event MotionNotify");
if( true==m_grabAllEvent if( true == m_grabAllEvent
&& event.xmotion.x == (int32_t)m_forcePos.x() && event.xmotion.x == (int32_t)m_forcePos.x()
&& event.xmotion.y == (int32_t)m_forcePos.y()) { && event.xmotion.y == (int32_t)m_forcePos.y()) {
X11_VERBOSE("X11 reject mouse move (grab mode)"); X11_VERBOSE("X11 reject mouse move (grab mode)");
@ -456,12 +456,12 @@ class X11Interface : public ewol::eContext
} else { } else {
m_cursorEventX = event.xmotion.x; m_cursorEventX = event.xmotion.x;
m_cursorEventY = (m_currentHeight-event.xmotion.y); m_cursorEventY = (m_currentHeight-event.xmotion.y);
if(true==m_grabAllEvent) { if(true == m_grabAllEvent) {
m_cursorEventX -= m_forcePos.x(); m_cursorEventX -= m_forcePos.x();
m_cursorEventY -= (m_currentHeight-m_forcePos.y()); m_cursorEventY -= (m_currentHeight-m_forcePos.y());
} }
vec2 newDelta = vec2(m_cursorEventX, m_cursorEventY); vec2 newDelta = vec2(m_cursorEventX, m_cursorEventY);
if(true==m_grabAllEvent) { if(true == m_grabAllEvent) {
m_cursorEventX -= m_curentGrabDelta.x(); m_cursorEventX -= m_curentGrabDelta.x();
m_cursorEventY -= m_curentGrabDelta.y(); m_cursorEventY -= m_curentGrabDelta.y();
} }
@ -479,9 +479,9 @@ class X11Interface : public ewol::eContext
X11_DEBUG("X11 event: bt=" << 0 << " " << event.type << " = \"MotionNotify\" (" << m_cursorEventX << "," << m_cursorEventY << ")"); X11_DEBUG("X11 event: bt=" << 0 << " " << event.type << " = \"MotionNotify\" (" << m_cursorEventX << "," << m_cursorEventY << ")");
OS_SetMouseMotion(0, vec2(m_cursorEventX, m_cursorEventY)); OS_SetMouseMotion(0, vec2(m_cursorEventX, m_cursorEventY));
} }
if (true==m_grabAllEvent) { if (true == m_grabAllEvent) {
if (m_positionChangeRequested == false) { if (m_positionChangeRequested == false) {
X11_DEBUG("X11 Set pointer position : " << m_forcePos); X11_DEBUG("X11 set pointer position : " << m_forcePos);
XWarpPointer(m_display, None, m_WindowHandle, 0,0, 0, 0, m_forcePos.x(), m_forcePos.y()); XWarpPointer(m_display, None, m_WindowHandle, 0,0, 0, 0, m_forcePos.x(), m_forcePos.y());
XFlush(m_display); XFlush(m_display);
m_positionChangeRequested = true; m_positionChangeRequested = true;
@ -490,11 +490,11 @@ class X11Interface : public ewol::eContext
} }
break; break;
case FocusIn: case FocusIn:
X11_INFO("X11 event FocusIn"); X11_INFO("X11 event focusIn");
specialEventThatNeedARedraw=true; specialEventThatNeedARedraw=true;
break; break;
case FocusOut: case FocusOut:
X11_INFO("X11 event : FocusOut"); X11_INFO("X11 event : focusOut");
specialEventThatNeedARedraw=true; specialEventThatNeedARedraw=true;
break; break;
case KeyPress: case KeyPress:
@ -625,23 +625,23 @@ class X11Interface : public ewol::eContext
case 77: keyInput = ewol::keyEvent::keyboardNumLock; m_guiKeyBoardMode.numLock = (event.type == KeyPress) ? true : false; break; case 77: keyInput = ewol::keyEvent::keyboardNumLock; m_guiKeyBoardMode.numLock = (event.type == KeyPress) ? true : false; break;
case 91: // Suppr on keypad case 91: // Suppr on keypad
find = false; find = false;
if(m_guiKeyBoardMode.numLock==true){ if(m_guiKeyBoardMode.numLock == true){
OS_SetKeyboard(m_guiKeyBoardMode, '.', (event.type==KeyPress), thisIsAReapeateKey); OS_SetKeyboard(m_guiKeyBoardMode, '.', (event.type == KeyPress), thisIsAReapeateKey);
if (true==thisIsAReapeateKey) { if (true == thisIsAReapeateKey) {
OS_SetKeyboard(m_guiKeyBoardMode, '.', !(event.type==KeyPress), thisIsAReapeateKey); OS_SetKeyboard(m_guiKeyBoardMode, '.', !(event.type == KeyPress), thisIsAReapeateKey);
} }
} else { } else {
OS_SetKeyboard(m_guiKeyBoardMode, 0x7F, (event.type==KeyPress), thisIsAReapeateKey); OS_SetKeyboard(m_guiKeyBoardMode, 0x7F, (event.type == KeyPress), thisIsAReapeateKey);
if (true==thisIsAReapeateKey) { if (true == thisIsAReapeateKey) {
OS_SetKeyboard(m_guiKeyBoardMode, 0x7F, !(event.type==KeyPress), thisIsAReapeateKey); OS_SetKeyboard(m_guiKeyBoardMode, 0x7F, !(event.type == KeyPress), thisIsAReapeateKey);
} }
} }
break; break;
case 23: // special case for TAB case 23: // special case for TAB
find = false; find = false;
OS_SetKeyboard(m_guiKeyBoardMode, 0x09, (event.type==KeyPress), thisIsAReapeateKey); OS_SetKeyboard(m_guiKeyBoardMode, 0x09, (event.type == KeyPress), thisIsAReapeateKey);
if (true==thisIsAReapeateKey) { if (true == thisIsAReapeateKey) {
OS_SetKeyboard(m_guiKeyBoardMode, 0x09, !(event.type==KeyPress), thisIsAReapeateKey); OS_SetKeyboard(m_guiKeyBoardMode, 0x09, !(event.type == KeyPress), thisIsAReapeateKey);
} }
break; break;
default: default:
@ -669,11 +669,11 @@ class X11Interface : public ewol::eContext
if (count>0) { if (count>0) {
// transform it in unicode // transform it in unicode
etk::UniChar tmpChar = 0; etk::UniChar tmpChar = 0;
tmpChar.SetUtf8(buf); tmpChar.setUtf8(buf);
//EWOL_INFO("event Key : " << event.xkey.keycode << " char=\"" << buf << "\"'len=" << strlen(buf) << " unicode=" << unicodeValue); //EWOL_INFO("event Key : " << event.xkey.keycode << " char=\"" << buf << "\"'len=" << strlen(buf) << " unicode=" << unicodeValue);
OS_SetKeyboard(m_guiKeyBoardMode, tmpChar, (event.type==KeyPress), thisIsAReapeateKey); OS_SetKeyboard(m_guiKeyBoardMode, tmpChar, (event.type == KeyPress), thisIsAReapeateKey);
if (true==thisIsAReapeateKey) { if (true == thisIsAReapeateKey) {
OS_SetKeyboard(m_guiKeyBoardMode, tmpChar, !(event.type==KeyPress), thisIsAReapeateKey); OS_SetKeyboard(m_guiKeyBoardMode, tmpChar, !(event.type == KeyPress), thisIsAReapeateKey);
} }
} else { } else {
EWOL_WARNING("Unknow event Key : " << event.xkey.keycode); EWOL_WARNING("Unknow event Key : " << event.xkey.keycode);
@ -682,10 +682,10 @@ class X11Interface : public ewol::eContext
break; break;
} }
if (true == find) { if (true == find) {
//EWOL_DEBUG("eventKey Move type : " << GetCharTypeMoveEvent(keyInput) ); //EWOL_DEBUG("eventKey Move type : " << getCharTypeMoveEvent(keyInput) );
OS_SetKeyboardMove(m_guiKeyBoardMode, keyInput, (event.type==KeyPress), thisIsAReapeateKey); OS_SetKeyboardMove(m_guiKeyBoardMode, keyInput, (event.type == KeyPress), thisIsAReapeateKey);
if (true==thisIsAReapeateKey) { if (true == thisIsAReapeateKey) {
OS_SetKeyboardMove(m_guiKeyBoardMode, keyInput, !(event.type==KeyPress), thisIsAReapeateKey); OS_SetKeyboardMove(m_guiKeyBoardMode, keyInput, !(event.type == KeyPress), thisIsAReapeateKey);
} }
} }
} }
@ -728,26 +728,26 @@ class X11Interface : public ewol::eContext
m_run = false; m_run = false;
} }
/****************************************************************************************/ /****************************************************************************************/
virtual void SetSize(const vec2& _size) virtual void setSize(const vec2& _size)
{ {
X11_INFO("X11-API: ChangeSize=" << _size); X11_INFO("X11-API: changeSize=" << _size);
m_currentHeight = _size.y(); m_currentHeight = _size.y();
m_currentWidth = _size.x(); m_currentWidth = _size.x();
XResizeWindow(m_display, m_WindowHandle, _size.x(), _size.y()); XResizeWindow(m_display, m_WindowHandle, _size.x(), _size.y());
} }
/****************************************************************************************/ /****************************************************************************************/
virtual void SetPos(const vec2& _pos) virtual void setPos(const vec2& _pos)
{ {
X11_INFO("X11-API: ChangePos=" << _pos); X11_INFO("X11-API: changePos=" << _pos);
XMoveWindow(m_display, m_WindowHandle, _pos.x(), _pos.y()); XMoveWindow(m_display, m_WindowHandle, _pos.x(), _pos.y());
m_originX = _pos.x(); m_originX = _pos.x();
m_originY = _pos.y(); m_originY = _pos.y();
} }
/****************************************************************************************/ /****************************************************************************************/
/* /*
virtual void GetAbsPos(ivec2& pos) virtual void getAbsPos(ivec2& pos)
{ {
X11_INFO("X11-API: GetAbsPos"); X11_INFO("X11-API: getAbsPos");
int tmp; int tmp;
unsigned int tmp2; unsigned int tmp2;
Window fromroot, tmpwin; Window fromroot, tmpwin;
@ -755,10 +755,10 @@ class X11Interface : public ewol::eContext
} }
*/ */
/****************************************************************************************/ /****************************************************************************************/
virtual void SetCursor(ewol::cursorDisplay_te _newCursor) virtual void setCursor(ewol::cursorDisplay_te _newCursor)
{ {
if (_newCursor != m_currentCursor) { if (_newCursor != m_currentCursor) {
X11_DEBUG("X11-API: Set New Cursor : " << _newCursor); X11_DEBUG("X11-API: set New Cursor : " << _newCursor);
// undefine previous cursors ... // undefine previous cursors ...
XUndefineCursor(m_display, m_WindowHandle); XUndefineCursor(m_display, m_WindowHandle);
// set the new one : // set the new one :
@ -883,7 +883,7 @@ class X11Interface : public ewol::eContext
m_forcePos.setY(m_currentHeight - m_forcePos.y()); m_forcePos.setY(m_currentHeight - m_forcePos.y());
m_grabAllEvent = true; m_grabAllEvent = true;
// change the pointer position to generate a good mouving at the start ... // change the pointer position to generate a good mouving at the start ...
X11_DEBUG("X11-API: Set pointer position : " << m_forcePos); X11_DEBUG("X11-API: set pointer position : " << m_forcePos);
XWarpPointer(m_display, None, m_WindowHandle, 0,0, 0, 0, m_forcePos.x(), m_forcePos.y()); XWarpPointer(m_display, None, m_WindowHandle, 0,0, 0, 0, m_forcePos.x(), m_forcePos.y());
XFlush(m_display); XFlush(m_display);
m_positionChangeRequested = true; m_positionChangeRequested = true;
@ -918,7 +918,7 @@ class X11Interface : public ewol::eContext
} }
int Xscreen = DefaultScreen(m_display); int Xscreen = DefaultScreen(m_display);
// set the DPI for the current screen : // set the DPI for the current screen :
ewol::dimension::SetPixelRatio(vec2((float)DisplayWidth(m_display, Xscreen)/(float)DisplayWidthMM(m_display, Xscreen), ewol::dimension::setPixelRatio(vec2((float)DisplayWidth(m_display, Xscreen)/(float)DisplayWidthMM(m_display, Xscreen),
(float)DisplayHeight(m_display, Xscreen)/(float)DisplayHeightMM(m_display, Xscreen)), (float)DisplayHeight(m_display, Xscreen)/(float)DisplayHeightMM(m_display, Xscreen)),
ewol::Dimension::Millimeter); ewol::Dimension::Millimeter);
// get an appropriate visual // get an appropriate visual
@ -1008,7 +1008,7 @@ class X11Interface : public ewol::eContext
XFree(StartupState); XFree(StartupState);
/* Open it, wait for it to appear */ /* open it, wait for it to appear */
XMapWindow(m_display, m_WindowHandle); XMapWindow(m_display, m_WindowHandle);
//XIfEvent(m_display, &event, WaitForMapNotify, (char*)&m_WindowHandle); //XIfEvent(m_display, &event, WaitForMapNotify, (char*)&m_WindowHandle);
@ -1037,7 +1037,7 @@ class X11Interface : public ewol::eContext
XSetICFocus(m_xic); XSetICFocus(m_xic);
// Set the kill atom so we get a message when the user tries to close the window // set the kill atom so we get a message when the user tries to close the window
if ((m_delAtom = XInternAtom(m_display, "WM_DELETE_WINDOW", 0)) != None) { if ((m_delAtom = XInternAtom(m_display, "WM_DELETE_WINDOW", 0)) != None) {
XSetWMProtocols(m_display, m_WindowHandle, &m_delAtom, 1); XSetWMProtocols(m_display, m_WindowHandle, &m_delAtom, 1);
} }
@ -1048,19 +1048,19 @@ class X11Interface : public ewol::eContext
return true; return true;
} }
/****************************************************************************************/ /****************************************************************************************/
void SetIcon(const etk::UString& _inputFile) void setIcon(const etk::UString& _inputFile)
{ {
egami::Image dataImage; egami::Image dataImage;
// load data // load data
if (false == egami::Load(dataImage, _inputFile)) { if (false == egami::load(dataImage, _inputFile)) {
EWOL_ERROR("Error when loading Icon"); EWOL_ERROR("Error when loading Icon");
return; return;
} }
int32_t depth = DefaultDepth(m_display, DefaultScreen(m_display) ); int32_t depth = DefaultDepth(m_display, DefaultScreen(m_display) );
EWOL_DEBUG("X11 Create icon Size=(" << dataImage.GetWidth() << "," << dataImage.GetHeight() << ") depth=" << depth); EWOL_DEBUG("X11 Create icon size=(" << dataImage.getWidth() << "," << dataImage.getHeight() << ") depth=" << depth);
switch(depth) { switch(depth) {
case 8: case 8:
EWOL_CRITICAL("Not manage pixmap in 8 bit... ==> no icon ..."); EWOL_CRITICAL("Not manage pixmap in 8 bit... == > no icon ...");
return; return;
case 16: case 16:
break; break;
@ -1072,7 +1072,7 @@ class X11Interface : public ewol::eContext
EWOL_CRITICAL("Unknow thys type of bitDepth : " << depth); EWOL_CRITICAL("Unknow thys type of bitDepth : " << depth);
return; return;
} }
char* tmpVal = new char[4*dataImage.GetWidth()*dataImage.GetHeight()]; char* tmpVal = new char[4*dataImage.getWidth()*dataImage.getHeight()];
if (NULL == tmpVal) { if (NULL == tmpVal) {
EWOL_CRITICAL("Allocation error ..."); EWOL_CRITICAL("Allocation error ...");
return; return;
@ -1080,9 +1080,9 @@ class X11Interface : public ewol::eContext
char* tmpPointer = tmpVal; char* tmpPointer = tmpVal;
switch(depth) { switch(depth) {
case 16: case 16:
for(ivec2 pos(0,0); pos.y()<dataImage.GetHeight(); pos.setY(pos.y()+1)) { for(ivec2 pos(0,0); pos.y()<dataImage.getHeight(); pos.setY(pos.y()+1)) {
for(pos.setX(0); pos.x()<dataImage.GetHeight(); pos.setX(pos.x()+1)) { for(pos.setX(0); pos.x()<dataImage.getHeight(); pos.setX(pos.x()+1)) {
etk::Color<> tmpColor = dataImage.Get(pos); etk::Color<> tmpColor = dataImage.get(pos);
int16_t tmpVal = (((uint16_t)((uint16_t)tmpColor.r()>>3))<<11) int16_t tmpVal = (((uint16_t)((uint16_t)tmpColor.r()>>3))<<11)
+ (((uint16_t)((uint16_t)tmpColor.g()>>2))<<5) + (((uint16_t)((uint16_t)tmpColor.g()>>2))<<5)
+ ((uint16_t)((uint16_t)tmpColor.b()>>3)); + ((uint16_t)((uint16_t)tmpColor.b()>>3));
@ -1092,9 +1092,9 @@ class X11Interface : public ewol::eContext
} }
break; break;
case 24: case 24:
for(ivec2 pos(0,0); pos.y()<dataImage.GetHeight(); pos.setY(pos.y()+1)) { for(ivec2 pos(0,0); pos.y()<dataImage.getHeight(); pos.setY(pos.y()+1)) {
for(pos.setX(0); pos.x()<dataImage.GetHeight(); pos.setX(pos.x()+1)) { for(pos.setX(0); pos.x()<dataImage.getHeight(); pos.setX(pos.x()+1)) {
etk::Color<> tmpColor = dataImage.Get(pos); etk::Color<> tmpColor = dataImage.get(pos);
*tmpPointer++ = tmpColor.b(); *tmpPointer++ = tmpColor.b();
*tmpPointer++ = tmpColor.g(); *tmpPointer++ = tmpColor.g();
*tmpPointer++ = tmpColor.r(); *tmpPointer++ = tmpColor.r();
@ -1103,9 +1103,9 @@ class X11Interface : public ewol::eContext
} }
break; break;
case 32: case 32:
for(ivec2 pos(0,0); pos.y()<dataImage.GetHeight(); pos.setY(pos.y()+1)) { for(ivec2 pos(0,0); pos.y()<dataImage.getHeight(); pos.setY(pos.y()+1)) {
for(pos.setX(0); pos.x()<dataImage.GetHeight(); pos.setX(pos.x()+1)) { for(pos.setX(0); pos.x()<dataImage.getHeight(); pos.setX(pos.x()+1)) {
etk::Color<> tmpColor = dataImage.Get(pos); etk::Color<> tmpColor = dataImage.get(pos);
*tmpPointer++ = tmpColor.a(); *tmpPointer++ = tmpColor.a();
*tmpPointer++ = tmpColor.b(); *tmpPointer++ = tmpColor.b();
*tmpPointer++ = tmpColor.g(); *tmpPointer++ = tmpColor.g();
@ -1123,12 +1123,12 @@ class X11Interface : public ewol::eContext
ZPixmap, ZPixmap,
0, 0,
(char*)tmpVal, (char*)tmpVal,
dataImage.GetWidth(), dataImage.getWidth(),
dataImage.GetHeight(), dataImage.getHeight(),
32, 32,
0); 0);
Pixmap tmpPixmap = XCreatePixmap(m_display, m_WindowHandle, dataImage.GetWidth(), dataImage.GetHeight(), depth); Pixmap tmpPixmap = XCreatePixmap(m_display, m_WindowHandle, dataImage.getWidth(), dataImage.getHeight(), depth);
switch(tmpPixmap) { switch(tmpPixmap) {
case BadAlloc: case BadAlloc:
EWOL_ERROR("X11: BadAlloc"); EWOL_ERROR("X11: BadAlloc");
@ -1144,7 +1144,7 @@ class X11Interface : public ewol::eContext
break; break;
} }
GC tmpGC = DefaultGC(m_display, DefaultScreen(m_display) ); GC tmpGC = DefaultGC(m_display, DefaultScreen(m_display) );
int error = XPutImage(m_display, tmpPixmap, tmpGC, myImage, 0, 0, 0, 0, dataImage.GetWidth(), dataImage.GetHeight()); int error = XPutImage(m_display, tmpPixmap, tmpGC, myImage, 0, 0, 0, 0, dataImage.getWidth(), dataImage.getHeight());
switch(error) { switch(error) {
case BadDrawable: case BadDrawable:
EWOL_ERROR("X11: BadDrawable"); EWOL_ERROR("X11: BadDrawable");
@ -1174,11 +1174,11 @@ class X11Interface : public ewol::eContext
win_hints->icon_pixmap = tmpPixmap; win_hints->icon_pixmap = tmpPixmap;
// pass the hints to the window manager. // pass the hints to the window manager.
XSetWMHints(m_display, m_WindowHandle, win_hints); XSetWMHints(m_display, m_WindowHandle, win_hints);
EWOL_INFO(" ==> might be done "); EWOL_INFO(" == > might be done ");
// finally, we can free the WM hints structure. // finally, we can free the WM hints structure.
XFree(win_hints); XFree(win_hints);
// Note when we free the pixmap ... the icon is removed ... ==> this is a real memory leek ... // Note when we free the pixmap ... the icon is removed ... == > this is a real memory leek ...
//XFreePixmap(m_display, tmpPixmap); //XFreePixmap(m_display, tmpPixmap);
myImage->data = NULL; myImage->data = NULL;
@ -1219,15 +1219,15 @@ class X11Interface : public ewol::eContext
EWOL_INFO("XF86 DRI NOT available\n"); EWOL_INFO("XF86 DRI NOT available\n");
} }
// Enable vertical synchronisation : (some computer has synchronisation disable) // enable vertical synchronisation : (some computer has synchronisation disable)
setVSync(true); setVSync(true);
return true; return true;
} }
/****************************************************************************************/ /****************************************************************************************/
void SetTitle(const etk::UString& _title) void setTitle(const etk::UString& _title)
{ {
X11_INFO("X11: Set Title (START)"); X11_INFO("X11: set Title (START)");
XTextProperty tp; XTextProperty tp;
etk::Char tmpChar = _title.c_str(); etk::Char tmpChar = _title.c_str();
tp.value = (unsigned char *)((const char*)tmpChar); tp.value = (unsigned char *)((const char*)tmpChar);
@ -1238,7 +1238,7 @@ class X11Interface : public ewol::eContext
XStoreName(m_display, m_WindowHandle, (const char*)tp.value); XStoreName(m_display, m_WindowHandle, (const char*)tp.value);
XSetIconName(m_display, m_WindowHandle, (const char*)tp.value); XSetIconName(m_display, m_WindowHandle, (const char*)tp.value);
XSetWMIconName(m_display, m_WindowHandle, &tp); XSetWMIconName(m_display, m_WindowHandle, &tp);
X11_INFO("X11: Set Title (END)"); X11_INFO("X11: set Title (END)");
} }
/****************************************************************************************/ /****************************************************************************************/
void ClipBoardGet(ewol::clipBoard::clipboardListe_te _clipboardID) void ClipBoardGet(ewol::clipBoard::clipboardListe_te _clipboardID)
@ -1248,7 +1248,7 @@ class X11Interface : public ewol::eContext
case ewol::clipBoard::clipboardSelection: case ewol::clipBoard::clipboardSelection:
if (false == m_clipBoardOwnerPrimary) { if (false == m_clipBoardOwnerPrimary) {
m_clipBoardRequestPrimary = true; m_clipBoardRequestPrimary = true;
// Generate a request on X11 // generate a request on X11
XConvertSelection(m_display, XConvertSelection(m_display,
XAtomeSelection, XAtomeSelection,
XAtomeTargetStringUTF8, XAtomeTargetStringUTF8,
@ -1263,7 +1263,7 @@ class X11Interface : public ewol::eContext
case ewol::clipBoard::clipboardStd: case ewol::clipBoard::clipboardStd:
if (false == m_clipBoardOwnerStd) { if (false == m_clipBoardOwnerStd) {
m_clipBoardRequestPrimary = false; m_clipBoardRequestPrimary = false;
// Generate a request on X11 // generate a request on X11
XConvertSelection(m_display, XConvertSelection(m_display,
XAtomeClipBoard, XAtomeClipBoard,
XAtomeTargetStringUTF8, XAtomeTargetStringUTF8,
@ -1314,7 +1314,7 @@ class X11Interface : public ewol::eContext
*/ */
int ewol::Run(int _argc, const char *_argv[]) int ewol::Run(int _argc, const char *_argv[])
{ {
etk::SetArgZero(_argv[0]); etk::setArgZero(_argv[0]);
X11Interface* interface = new X11Interface(_argc, _argv); X11Interface* interface = new X11Interface(_argc, _argv);
if (NULL == interface) { if (NULL == interface) {
EWOL_CRITICAL("Can not create the X11 interface ... MEMORY allocation error"); EWOL_CRITICAL("Can not create the X11 interface ... MEMORY allocation error");

View File

@ -30,31 +30,31 @@ static bool isInit = false;
# include <ewol/renderer/audio/interfacePortAudio.h> # include <ewol/renderer/audio/interfacePortAudio.h>
#endif #endif
void ewol::audio::Init(void) void ewol::audio::init(void)
{ {
if (isInit == true) { if (isInit == true) {
EWOL_ERROR("multiple init requested ... at the audio system ..."); EWOL_ERROR("multiple init requested ... at the audio system ...");
} }
ewol::audio::effects::VolumeSet(0); ewol::audio::effects::volumeSet(0);
ewol::audio::effects::MuteSet(false); ewol::audio::effects::muteSet(false);
ewol::audio::music::VolumeSet(0); ewol::audio::music::volumeSet(0);
ewol::audio::music::MuteSet(false); ewol::audio::music::muteSet(false);
musicFadingTime = 100; musicFadingTime = 100;
isInit = true; isInit = true;
#ifdef BUILD_PORTAUDIO #ifdef BUILD_PORTAUDIO
ewol::portAudio::Init(); ewol::portAudio::init();
#endif #endif
} }
void ewol::audio::UnInit(void) void ewol::audio::unInit(void)
{ {
if (false == isInit) { if (false == isInit) {
EWOL_ERROR("multiple un-init requested ... at the audio system ..."); EWOL_ERROR("multiple un-init requested ... at the audio system ...");
return; return;
} }
#ifdef BUILD_PORTAUDIO #ifdef BUILD_PORTAUDIO
ewol::portAudio::UnInit(); ewol::portAudio::unInit();
#endif #endif
musicMute = true; musicMute = true;
musicVolume = -5000; musicVolume = -5000;
@ -65,7 +65,7 @@ void ewol::audio::UnInit(void)
static ewol::audio::AudioCallback userLocalCallback = NULL; static ewol::audio::AudioCallback userLocalCallback = NULL;
void ewol::audio::GetData(int16_t * bufferInterlace, int32_t nbSample, int32_t nbChannels) void ewol::audio::getData(int16_t * bufferInterlace, int32_t nbSample, int32_t nbChannels)
{ {
// TODO : set the real playing time ... // TODO : set the real playing time ...
currentTimePlaying += 10; currentTimePlaying += 10;
@ -80,9 +80,9 @@ void ewol::audio::GetData(int16_t * bufferInterlace, int32_t nbSample, int32_t n
(*userLocalCallback)(bufferInterlace, nbSample, nbChannels); (*userLocalCallback)(bufferInterlace, nbSample, nbChannels);
} }
// get background music : // get background music :
ewol::audio::music::GetData(bufferInterlace, nbSample, nbChannels); ewol::audio::music::getData(bufferInterlace, nbSample, nbChannels);
// add effects : // add effects :
ewol::audio::effects::GetData(bufferInterlace, nbSample, nbChannels); ewol::audio::effects::getData(bufferInterlace, nbSample, nbChannels);
static FILE * plop = fopen("/home/edupin/testFile48khzstereo.raw", "w"); static FILE * plop = fopen("/home/edupin/testFile48khzstereo.raw", "w");
if (plop!=NULL) { if (plop!=NULL) {
fwrite(bufferInterlace, sizeof(int16_t), nbSample*nbChannels, plop); fwrite(bufferInterlace, sizeof(int16_t), nbSample*nbChannels, plop);
@ -90,69 +90,69 @@ void ewol::audio::GetData(int16_t * bufferInterlace, int32_t nbSample, int32_t n
} }
void ewol::audio::AddCallbackOutput(ewol::audio::AudioCallback userCallback) void ewol::audio::addCallbackOutput(ewol::audio::AudioCallback userCallback)
{ {
userLocalCallback = userCallback; userLocalCallback = userCallback;
} }
void ewol::audio::music::Fading(int32_t timeMs) void ewol::audio::music::fading(int32_t timeMs)
{ {
musicFadingTime = timeMs; musicFadingTime = timeMs;
musicFadingTime = etk_avg(-100, musicFadingTime, 20); musicFadingTime = etk_avg(-100, musicFadingTime, 20);
EWOL_INFO("Set music fading time at " << timeMs << "ms ==> " << musicFadingTime << "ms"); EWOL_INFO("Set music fading time at " << timeMs << "ms == > " << musicFadingTime << "ms");
} }
bool ewol::audio::music::ListAdd(etk::UString file) bool ewol::audio::music::listAdd(etk::UString file)
{ {
return false; return false;
} }
bool ewol::audio::music::ListRm(etk::UString file) bool ewol::audio::music::listRm(etk::UString file)
{ {
return false; return false;
} }
bool ewol::audio::music::ListClean(void) bool ewol::audio::music::listClean(void)
{ {
return false; return false;
} }
bool ewol::audio::music::ListPrevious(void) bool ewol::audio::music::listPrevious(void)
{ {
return false; return false;
} }
bool ewol::audio::music::ListNext(void) bool ewol::audio::music::listNext(void)
{ {
return false; return false;
} }
bool ewol::audio::music::ListFirst(void) bool ewol::audio::music::listFirst(void)
{ {
return false; return false;
} }
bool ewol::audio::music::ListLast(void) bool ewol::audio::music::listLast(void)
{ {
return false; return false;
} }
bool ewol::audio::music::ListPlay(void) bool ewol::audio::music::listPlay(void)
{ {
return false; return false;
} }
bool ewol::audio::music::ListStop(void) bool ewol::audio::music::listStop(void)
{ {
return false; return false;
} }
@ -160,20 +160,20 @@ bool ewol::audio::music::ListStop(void)
bool ewol::audio::music::Play(etk::UString file) bool ewol::audio::music::play(etk::UString file)
{ {
return false; return false;
} }
bool ewol::audio::music::Stop(void) bool ewol::audio::music::stop(void)
{ {
return false; return false;
} }
float ewol::audio::music::VolumeGet(void) float ewol::audio::music::volumeGet(void)
{ {
return musicVolume; return musicVolume;
} }
@ -181,32 +181,32 @@ float ewol::audio::music::VolumeGet(void)
static void uptateMusicVolume(void) static void uptateMusicVolume(void)
{ {
if (musicMute==true) { if (musicMute == true) {
musicVolumeApply = 0; musicVolumeApply = 0;
} else { } else {
// Convert in an fixpoint value // convert in an fixpoint value
// V2 = V1*10^(db/20) // V2 = V1*10^(db/20)
double coef = pow(10, (musicVolume/20) ); double coef = pow(10, (musicVolume/20) );
musicVolumeApply = (int32_t)(coef * (double)(1<<16)); musicVolumeApply = (int32_t)(coef * (double)(1<<16));
} }
} }
void ewol::audio::music::VolumeSet(float newVolume) void ewol::audio::music::volumeSet(float newVolume)
{ {
musicVolume = newVolume; musicVolume = newVolume;
musicVolume = etk_avg(-1000, musicVolume, 40); musicVolume = etk_avg(-1000, musicVolume, 40);
EWOL_INFO("Set music Volume at " << newVolume << "dB ==> " << musicVolume << "dB"); EWOL_INFO("Set music Volume at " << newVolume << "dB == > " << musicVolume << "dB");
uptateMusicVolume(); uptateMusicVolume();
} }
bool ewol::audio::music::MuteGet(void) bool ewol::audio::music::muteGet(void)
{ {
return musicMute; return musicMute;
} }
void ewol::audio::music::MuteSet(bool newMute) void ewol::audio::music::muteSet(bool newMute)
{ {
musicMute = newMute; musicMute = newMute;
EWOL_INFO("Set music Mute at " << newMute); EWOL_INFO("Set music Mute at " << newMute);
@ -214,7 +214,7 @@ void ewol::audio::music::MuteSet(bool newMute)
} }
void ewol::audio::music::GetData(int16_t * bufferInterlace, int32_t nbSample, int32_t nbChannels) void ewol::audio::music::getData(int16_t * bufferInterlace, int32_t nbSample, int32_t nbChannels)
{ {
/*static int32_t maxValue = 0; /*static int32_t maxValue = 0;
static float angle = 0; static float angle = 0;
@ -226,7 +226,7 @@ void ewol::audio::music::GetData(int16_t * bufferInterlace, int32_t nbSample, in
bufferInterlace[iii*2] = (float)maxValue * sin(angle/180.0 * M_PI); bufferInterlace[iii*2] = (float)maxValue * sin(angle/180.0 * M_PI);
bufferInterlace[iii*2+1] = bufferInterlace[iii*2]; bufferInterlace[iii*2+1] = bufferInterlace[iii*2];
angle+=0.9; angle+=0.9;
if (angle>=360) { if (angle >= 360) {
angle -= 360.0; angle -= 360.0;
} }
}*/ }*/
@ -244,7 +244,7 @@ class EffectsLoaded {
{ {
m_file = file; m_file = file;
m_requestedTime = 1; m_requestedTime = 1;
m_data = ewol::audio::wav::LoadData(file, 1, 48000, m_nbSamples); m_data = ewol::audio::wav::loadData(file, 1, 48000, m_nbSamples);
if (m_data == NULL) { if (m_data == NULL) {
// write an error ... // write an error ...
} }
@ -262,11 +262,11 @@ class RequestPlay {
int32_t m_playTime; // position in sample playing in the audio effects int32_t m_playTime; // position in sample playing in the audio effects
public : public :
RequestPlay(EffectsLoaded * effect) : m_freeSlot(false), m_effect(effect), m_playTime(0) { }; RequestPlay(EffectsLoaded * effect) : m_freeSlot(false), m_effect(effect), m_playTime(0) { };
void Reset(EffectsLoaded * effect) { m_effect=effect; m_playTime=0; m_freeSlot=false; }; void reset(EffectsLoaded * effect) { m_effect=effect; m_playTime=0; m_freeSlot=false; };
bool IsFree(void) { return m_freeSlot; }; bool isFree(void) { return m_freeSlot; };
void Play(int16_t * bufferInterlace, int32_t nbSample, int32_t nbChannels) void play(int16_t * bufferInterlace, int32_t nbSample, int32_t nbChannels)
{ {
if (true==m_freeSlot) { if (true == m_freeSlot) {
return; return;
} }
if (m_effect->m_data == NULL) { if (m_effect->m_data == NULL) {
@ -279,7 +279,7 @@ class RequestPlay {
int16_t * newData = &m_effect->m_data[m_playTime]; int16_t * newData = &m_effect->m_data[m_playTime];
//EWOL_DEBUG("AUDIO : Play slot... nb sample : " << processTimeMax << " playTime=" <<m_playTime << " nbCannels=" << nbChannels); //EWOL_DEBUG("AUDIO : Play slot... nb sample : " << processTimeMax << " playTime=" <<m_playTime << " nbCannels=" << nbChannels);
for (int32_t iii=0; iii<processTimeMax; iii++) { for (int32_t iii=0; iii<processTimeMax; iii++) {
// TODO : Set volume and spacialisation ... // TODO : set volume and spacialisation ...
for (int32_t jjj=0; jjj<nbChannels; jjj++) { for (int32_t jjj=0; jjj<nbChannels; jjj++) {
int32_t tmppp = *pointer + ((((int32_t)*newData)*effectsVolumeApply)>>16); int32_t tmppp = *pointer + ((((int32_t)*newData)*effectsVolumeApply)>>16);
*pointer = etk_avg(-32767, tmppp, 32766); *pointer = etk_avg(-32767, tmppp, 32766);
@ -290,7 +290,7 @@ class RequestPlay {
} }
m_playTime += processTimeMax; m_playTime += processTimeMax;
// check end of playing ... // check end of playing ...
if (m_effect->m_nbSamples<=m_playTime) { if (m_effect->m_nbSamples <= m_playTime) {
m_freeSlot=true; m_freeSlot=true;
} }
} }
@ -301,9 +301,9 @@ etk::Vector<EffectsLoaded*> ListEffects;
etk::Vector<RequestPlay*> ListEffectsPlaying; etk::Vector<RequestPlay*> ListEffectsPlaying;
int32_t ewol::audio::effects::Add(etk::UString file) int32_t ewol::audio::effects::add(etk::UString file)
{ {
for (int32_t iii=0; iii<ListEffects.Size(); iii++) { for (int32_t iii=0; iii<ListEffects.size(); iii++) {
if (NULL != ListEffects[iii]) { if (NULL != ListEffects[iii]) {
if (ListEffects[iii]->m_file == file) { if (ListEffects[iii]->m_file == file) {
ListEffects[iii]->m_requestedTime++; ListEffects[iii]->m_requestedTime++;
@ -317,25 +317,25 @@ int32_t ewol::audio::effects::Add(etk::UString file)
EWOL_ERROR("Error to load the effects : \"" << file << "\""); EWOL_ERROR("Error to load the effects : \"" << file << "\"");
return -1; return -1;
} }
ListEffects.PushBack(tmpEffect); ListEffects.pushBack(tmpEffect);
return ListEffects.Size()-1; return ListEffects.size()-1;
} }
void ewol::audio::effects::Rm(int32_t effectId) void ewol::audio::effects::rm(int32_t effectId)
{ {
// find element ... // find element ...
if (effectId <0 || effectId >= ListEffects.Size()) { if (effectId <0 || effectId >= ListEffects.size()) {
EWOL_ERROR("Wrong effect ID : " << effectId << " != [0.." << ListEffects.Size()-1 << "] ==> can not remove it ..."); EWOL_ERROR("Wrong effect ID : " << effectId << " != [0.." << ListEffects.size()-1 << "] == > can not remove it ...");
return; return;
} }
if (ListEffects[effectId] == NULL) { if (ListEffects[effectId] == NULL) {
EWOL_ERROR("effect ID : " << effectId << " ==> has already been removed"); EWOL_ERROR("effect ID : " << effectId << " == > has already been removed");
return; return;
} }
// check number of requested // check number of requested
if (ListEffects[effectId]->m_requestedTime <=0) { if (ListEffects[effectId]->m_requestedTime <= 0) {
EWOL_ERROR("effect ID : " << effectId << " ==> request more than predicted a removed of an effects"); EWOL_ERROR("effect ID : " << effectId << " == > request more than predicted a removed of an effects");
return; return;
} }
ListEffects[effectId]->m_requestedTime--; ListEffects[effectId]->m_requestedTime--;
@ -344,21 +344,21 @@ void ewol::audio::effects::Rm(int32_t effectId)
} }
void ewol::audio::effects::Play(int32_t effectId, float xxx, float yyy) void ewol::audio::effects::play(int32_t effectId, float xxx, float yyy)
{ {
if (effectId <0 || effectId >= ListEffects.Size()) { if (effectId <0 || effectId >= ListEffects.size()) {
EWOL_ERROR("Wrong effect ID : " << effectId << " != [0.." << ListEffects.Size()-1 << "] ==> can not play it ..."); EWOL_ERROR("Wrong effect ID : " << effectId << " != [0.." << ListEffects.size()-1 << "] == > can not play it ...");
return; return;
} }
if (ListEffects[effectId] == NULL) { if (ListEffects[effectId] == NULL) {
EWOL_ERROR("effect ID : " << effectId << " ==> has been removed"); EWOL_ERROR("effect ID : " << effectId << " == > has been removed");
return; return;
} }
EWOL_VERBOSE("effect play : " << effectId ); EWOL_VERBOSE("effect play : " << effectId );
// try to find an empty slot : // try to find an empty slot :
for (int32_t iii=0; iii<ListEffectsPlaying.Size(); iii++) { for (int32_t iii=0; iii<ListEffectsPlaying.size(); iii++) {
if (ListEffectsPlaying[iii]->IsFree()) { if (ListEffectsPlaying[iii]->isFree()) {
ListEffectsPlaying[iii]->Reset(ListEffects[effectId]); ListEffectsPlaying[iii]->reset(ListEffects[effectId]);
return; return;
} }
} }
@ -367,11 +367,11 @@ void ewol::audio::effects::Play(int32_t effectId, float xxx, float yyy)
EWOL_CRITICAL("Allocation error of a playing element : " << effectId); EWOL_CRITICAL("Allocation error of a playing element : " << effectId);
return; return;
} }
ListEffectsPlaying.PushBack(newPlay); ListEffectsPlaying.pushBack(newPlay);
} }
float ewol::audio::effects::VolumeGet(void) float ewol::audio::effects::volumeGet(void)
{ {
return effectsVolume; return effectsVolume;
} }
@ -379,32 +379,32 @@ float ewol::audio::effects::VolumeGet(void)
static void uptateEffectVolume(void) static void uptateEffectVolume(void)
{ {
if (effectsMute==true) { if (effectsMute == true) {
effectsVolumeApply = 0; effectsVolumeApply = 0;
} else { } else {
// Convert in an fixpoint value // convert in an fixpoint value
// V2 = V1*10^(db/20) // V2 = V1*10^(db/20)
double coef = pow(10, (effectsVolume/20) ); double coef = pow(10, (effectsVolume/20) );
effectsVolumeApply = (int32_t)(coef * (double)(1<<16)); effectsVolumeApply = (int32_t)(coef * (double)(1<<16));
} }
} }
void ewol::audio::effects::VolumeSet(float newVolume) void ewol::audio::effects::volumeSet(float newVolume)
{ {
effectsVolume = newVolume; effectsVolume = newVolume;
effectsVolume = etk_avg(-100, effectsVolume, 20); effectsVolume = etk_avg(-100, effectsVolume, 20);
EWOL_INFO("Set music Volume at " << newVolume << "dB ==> " << effectsVolume << "dB"); EWOL_INFO("Set music Volume at " << newVolume << "dB == > " << effectsVolume << "dB");
uptateEffectVolume(); uptateEffectVolume();
} }
bool ewol::audio::effects::MuteGet(void) bool ewol::audio::effects::muteGet(void)
{ {
return effectsMute; return effectsMute;
} }
void ewol::audio::effects::MuteSet(bool newMute) void ewol::audio::effects::muteSet(bool newMute)
{ {
effectsMute = newMute; effectsMute = newMute;
EWOL_INFO("Set effects Mute at " << newMute); EWOL_INFO("Set effects Mute at " << newMute);
@ -412,11 +412,11 @@ void ewol::audio::effects::MuteSet(bool newMute)
void ewol::audio::effects::GetData(int16_t * bufferInterlace, int32_t nbSample, int32_t nbChannels) void ewol::audio::effects::getData(int16_t * bufferInterlace, int32_t nbSample, int32_t nbChannels)
{ {
for (int32_t iii=0; iii<ListEffectsPlaying.Size(); iii++) { for (int32_t iii=0; iii<ListEffectsPlaying.size(); iii++) {
if (ListEffectsPlaying[iii]!= NULL) { if (ListEffectsPlaying[iii]!= NULL) {
ListEffectsPlaying[iii]->Play(bufferInterlace, nbSample, nbChannels); ListEffectsPlaying[iii]->play(bufferInterlace, nbSample, nbChannels);
} }
} }
} }

View File

@ -15,51 +15,51 @@
namespace ewol { namespace ewol {
namespace audio { namespace audio {
void Init(void); void init(void);
void UnInit(void); void unInit(void);
typedef void (*AudioCallback)(int16_t * bufferInterlace, int32_t nbSample, int32_t nbChannels); typedef void (*AudioCallback)(int16_t * bufferInterlace, int32_t nbSample, int32_t nbChannels);
void AddCallbackOutput(AudioCallback userCallback); void addCallbackOutput(AudioCallback userCallback);
void GetData(int16_t * bufferInterlace, int32_t nbSample, int32_t nbChannels); void getData(int16_t * bufferInterlace, int32_t nbSample, int32_t nbChannels);
namespace music { namespace music {
void Fading(int32_t timeMs); void fading(int32_t timeMs);
// list playing system : is cyclic ... // list playing system : is cyclic ...
bool ListAdd(etk::UString file); bool listAdd(etk::UString file);
bool ListRm(etk::UString file); bool listRm(etk::UString file);
bool ListClean(void); bool listClean(void);
bool ListPrevious(void); bool listPrevious(void);
bool ListNext(void); bool listNext(void);
bool ListFirst(void); bool listFirst(void);
bool ListLast(void); bool listLast(void);
bool ListPlay(void); // List playing bool listPlay(void); // List playing
bool ListStop(void); // List stopping bool listStop(void); // List stopping
bool Play(etk::UString file); // play specific file ... pause the list element; bool play(etk::UString file); // play specific file ... pause the list element;
bool Stop(void); bool stop(void);
// in db // in db
float VolumeGet(void); float volumeGet(void);
void VolumeSet(float newVolume); void volumeSet(float newVolume);
bool MuteGet(void); bool muteGet(void);
void MuteSet(bool newMute); void muteSet(bool newMute);
void GetData(int16_t * bufferInterlace, int32_t nbSample, int32_t nbChannels); void getData(int16_t * bufferInterlace, int32_t nbSample, int32_t nbChannels);
}; };
// note effect is loaded in memory (then don't create long effect) and unload only when requested // note effect is loaded in memory (then don't create long effect) and unload only when requested
namespace effects { namespace effects {
// note : support file (Mono, 16bit, 48kHz) : .raw or .wav (no encodage) or .ogg (decoded with tremor lib) // note : support file (Mono, 16bit, 48kHz) : .raw or .wav (no encodage) or .ogg (decoded with tremor lib)
int32_t Add(etk::UString file); int32_t add(etk::UString file);
void Rm(int32_t effectId); void rm(int32_t effectId);
void Play(int32_t effectId, float xxx, float yyy); void play(int32_t effectId, float xxx, float yyy);
// in db // in db
float VolumeGet(void); float volumeGet(void);
void VolumeSet(float newVolume); void volumeSet(float newVolume);
bool MuteGet(void); bool muteGet(void);
void MuteSet(bool newMute); void muteSet(bool newMute);
void GetData(int16_t * bufferInterlace, int32_t nbSample, int32_t nbChannels); void getData(int16_t * bufferInterlace, int32_t nbSample, int32_t nbChannels);
}; };
}; };

View File

@ -60,7 +60,7 @@ typedef struct {
#define COMPR_G721 (64) #define COMPR_G721 (64)
#define COMPR_MPEG (80) #define COMPR_MPEG (80)
int16_t * ewol::audio::wav::LoadData(etk::UString filename, int8_t nbChan, int32_t frequency, int32_t & nbSampleOut) int16_t * ewol::audio::wav::loadData(etk::UString filename, int8_t nbChan, int32_t frequency, int32_t & nbSampleOut)
{ {
nbSampleOut = 0; nbSampleOut = 0;
waveHeader myHeader; waveHeader myHeader;
@ -69,28 +69,28 @@ int16_t * ewol::audio::wav::LoadData(etk::UString filename, int8_t nbChan, int32
// Start loading the XML : // Start loading the XML :
EWOL_DEBUG("open file (WAV) \"" << fileAccess << "\""); EWOL_DEBUG("open file (WAV) \"" << fileAccess << "\"");
if (false == fileAccess.Exist()) { if (false == fileAccess.exist()) {
EWOL_ERROR("File Does not exist : \"" << fileAccess << "\""); EWOL_ERROR("File Does not exist : \"" << fileAccess << "\"");
return NULL; return NULL;
} }
int32_t fileSize = fileAccess.FileSize(); int32_t fileSize = fileAccess.fileSize();
if (0==fileSize) { if (0 == fileSize) {
EWOL_ERROR("This file is empty : \"" << fileAccess << "\""); EWOL_ERROR("This file is empty : \"" << fileAccess << "\"");
return NULL; return NULL;
} }
if (false == fileAccess.FileOpenRead()) { if (false == fileAccess.fileOpenRead()) {
EWOL_ERROR("Can not open the file : \"" << fileAccess << "\""); EWOL_ERROR("Can not open the file : \"" << fileAccess << "\"");
return NULL; return NULL;
} }
// try to find endienness : // try to find endienness :
if (fileSize < sizeof(waveHeader)) { if (fileSize < sizeof(waveHeader)) {
EWOL_ERROR("File : \"" << fileAccess << "\" ==> has not enouth data inside might be minumum of " << (int32_t)(sizeof(waveHeader))); EWOL_ERROR("File : \"" << fileAccess << "\" == > has not enouth data inside might be minumum of " << (int32_t)(sizeof(waveHeader)));
return NULL; return NULL;
} }
// ---------------------------------------------- // ----------------------------------------------
// read the header : // read the header :
// ---------------------------------------------- // ----------------------------------------------
if (fileAccess.FileRead(&myHeader.riffTag, 1, 4)!=4) { if (fileAccess.fileRead(&myHeader.riffTag, 1, 4)!=4) {
EWOL_ERROR("Can not 4 element in the file : \"" << fileAccess << "\""); EWOL_ERROR("Can not 4 element in the file : \"" << fileAccess << "\"");
return NULL; return NULL;
} }
@ -108,14 +108,14 @@ int16_t * ewol::audio::wav::LoadData(etk::UString filename, int8_t nbChan, int32
} }
// get the data size : // get the data size :
unsigned char tmpData[32]; unsigned char tmpData[32];
if (fileAccess.FileRead(tmpData, 1, 4)!=4) { if (fileAccess.fileRead(tmpData, 1, 4)!=4) {
EWOL_ERROR("Can not 4 element in the file : \"" << fileAccess << "\""); EWOL_ERROR("Can not 4 element in the file : \"" << fileAccess << "\"");
return NULL; return NULL;
} }
myHeader.size = CONVERT_UINT32(littleEndien, tmpData); myHeader.size = CONVERT_UINT32(littleEndien, tmpData);
// get the data size : // get the data size :
if (fileAccess.FileRead(&myHeader.waveTag, 1, 4)!=4) { if (fileAccess.fileRead(&myHeader.waveTag, 1, 4)!=4) {
EWOL_ERROR("Can not 4 element in the file : \"" << fileAccess << "\""); EWOL_ERROR("Can not 4 element in the file : \"" << fileAccess << "\"");
return NULL; return NULL;
} }
@ -128,7 +128,7 @@ int16_t * ewol::audio::wav::LoadData(etk::UString filename, int8_t nbChan, int32
} }
// get the data size : // get the data size :
if (fileAccess.FileRead(&myHeader.fmtTag, 1, 4)!=4) { if (fileAccess.fileRead(&myHeader.fmtTag, 1, 4)!=4) {
EWOL_ERROR("Can not 4 element in the file : \"" << fileAccess << "\""); EWOL_ERROR("Can not 4 element in the file : \"" << fileAccess << "\"");
return NULL; return NULL;
} }
@ -140,17 +140,17 @@ int16_t * ewol::audio::wav::LoadData(etk::UString filename, int8_t nbChan, int32
return NULL; return NULL;
} }
// get the data size : // get the data size :
if (fileAccess.FileRead(tmpData, 1, 4)!=4) { if (fileAccess.fileRead(tmpData, 1, 4)!=4) {
EWOL_ERROR("Can not 4 element in the file : \"" << fileAccess << "\""); EWOL_ERROR("Can not 4 element in the file : \"" << fileAccess << "\"");
return NULL; return NULL;
} }
myHeader.waveFormatSize = CONVERT_UINT32(littleEndien, tmpData); myHeader.waveFormatSize = CONVERT_UINT32(littleEndien, tmpData);
if (myHeader.waveFormatSize != 16) { if (myHeader.waveFormatSize != 16) {
EWOL_ERROR("file : \"" << fileAccess << "\" ==> header error ..."); EWOL_ERROR("file : \"" << fileAccess << "\" == > header error ...");
return NULL; return NULL;
} }
if (fileAccess.FileRead(tmpData, 1, 16)!=16) { if (fileAccess.fileRead(tmpData, 1, 16)!=16) {
EWOL_ERROR("Can not 16 element in the file : \"" << fileAccess << "\""); EWOL_ERROR("Can not 16 element in the file : \"" << fileAccess << "\"");
return NULL; return NULL;
} }
@ -174,7 +174,7 @@ int16_t * ewol::audio::wav::LoadData(etk::UString filename, int8_t nbChan, int32
EWOL_DEBUG(" bytesPerFrame : " << myHeader.waveFormat.bytesPerFrame); EWOL_DEBUG(" bytesPerFrame : " << myHeader.waveFormat.bytesPerFrame);
EWOL_DEBUG(" bitsPerSample : " << myHeader.waveFormat.bitsPerSample); EWOL_DEBUG(" bitsPerSample : " << myHeader.waveFormat.bitsPerSample);
// get the data size : // get the data size :
if (fileAccess.FileRead(&myHeader.dataTag, 1, 4)!=4) { if (fileAccess.fileRead(&myHeader.dataTag, 1, 4)!=4) {
EWOL_ERROR("Can not 4 element in the file : \"" << fileAccess << "\""); EWOL_ERROR("Can not 4 element in the file : \"" << fileAccess << "\"");
return NULL; return NULL;
} }
@ -186,7 +186,7 @@ int16_t * ewol::audio::wav::LoadData(etk::UString filename, int8_t nbChan, int32
return NULL; return NULL;
} }
// get the data size : // get the data size :
if (fileAccess.FileRead(tmpData, 1, 4)!=4) { if (fileAccess.fileRead(tmpData, 1, 4)!=4) {
EWOL_ERROR("Can not 4 element in the file : \"" << fileAccess << "\""); EWOL_ERROR("Can not 4 element in the file : \"" << fileAccess << "\"");
return NULL; return NULL;
} }
@ -198,22 +198,22 @@ int16_t * ewol::audio::wav::LoadData(etk::UString filename, int8_t nbChan, int32
//Parse the data and transform it if needed ... //Parse the data and transform it if needed ...
if (COMPR_PCM != myHeader.waveFormat.type) { if (COMPR_PCM != myHeader.waveFormat.type) {
EWOL_ERROR("File : \"" << fileAccess << "\" ==> support only PCM compression ..."); EWOL_ERROR("File : \"" << fileAccess << "\" == > support only PCM compression ...");
return NULL; return NULL;
} }
if (myHeader.waveFormat.channelCount==0 || myHeader.waveFormat.channelCount>2) { if (myHeader.waveFormat.channelCount == 0 || myHeader.waveFormat.channelCount>2) {
EWOL_ERROR("File : \"" << fileAccess << "\" ==> support only mono or stereo ..." << myHeader.waveFormat.channelCount); EWOL_ERROR("File : \"" << fileAccess << "\" == > support only mono or stereo ..." << myHeader.waveFormat.channelCount);
return NULL; return NULL;
} }
if ( ! ( myHeader.waveFormat.bitsPerSample==16 if ( ! ( myHeader.waveFormat.bitsPerSample == 16
|| myHeader.waveFormat.bitsPerSample==24 || myHeader.waveFormat.bitsPerSample == 24
|| myHeader.waveFormat.bitsPerSample==32 ) ) { || myHeader.waveFormat.bitsPerSample == 32 ) ) {
EWOL_ERROR("File : \"" << fileAccess << "\" ==> not supported bit/sample ..." << myHeader.waveFormat.bitsPerSample); EWOL_ERROR("File : \"" << fileAccess << "\" == > not supported bit/sample ..." << myHeader.waveFormat.bitsPerSample);
return NULL; return NULL;
} }
if( ! ( 44100 == myHeader.waveFormat.samplesPerSec if( ! ( 44100 == myHeader.waveFormat.samplesPerSec
|| 48000 == myHeader.waveFormat.samplesPerSec) ) { || 48000 == myHeader.waveFormat.samplesPerSec) ) {
EWOL_ERROR("File : \"" << fileAccess << "\" ==> not supported frequency " << myHeader.waveFormat.samplesPerSec << " != 48000"); EWOL_ERROR("File : \"" << fileAccess << "\" == > not supported frequency " << myHeader.waveFormat.samplesPerSec << " != 48000");
return NULL; return NULL;
} }
EWOL_DEBUG(" dataSize : " << myHeader.dataSize); EWOL_DEBUG(" dataSize : " << myHeader.dataSize);
@ -232,14 +232,14 @@ int16_t * ewol::audio::wav::LoadData(etk::UString filename, int8_t nbChan, int32
char audioSample[8]; char audioSample[8];
if (myHeader.waveFormat.bitsPerSample == 16) { if (myHeader.waveFormat.bitsPerSample == 16) {
if (myHeader.waveFormat.channelCount == 1) { if (myHeader.waveFormat.channelCount == 1) {
if (fileAccess.FileRead(audioSample, 1, 2)!=2) { if (fileAccess.fileRead(audioSample, 1, 2)!=2) {
EWOL_ERROR("Read Error at position : " << iii); EWOL_ERROR("Read Error at position : " << iii);
return NULL; return NULL;
} }
left = ((int32_t)((int16_t)CONVERT_INT16(littleEndien, audioSample))) << 16; left = ((int32_t)((int16_t)CONVERT_INT16(littleEndien, audioSample))) << 16;
right = left; right = left;
} else { } else {
if (fileAccess.FileRead(audioSample, 1, 4)!=4) { if (fileAccess.fileRead(audioSample, 1, 4)!=4) {
EWOL_ERROR("Read Error at position : " << iii); EWOL_ERROR("Read Error at position : " << iii);
return NULL; return NULL;
} }
@ -248,14 +248,14 @@ int16_t * ewol::audio::wav::LoadData(etk::UString filename, int8_t nbChan, int32
} }
} else if (myHeader.waveFormat.bitsPerSample == 24) { } else if (myHeader.waveFormat.bitsPerSample == 24) {
if (myHeader.waveFormat.channelCount == 1) { if (myHeader.waveFormat.channelCount == 1) {
if (fileAccess.FileRead(audioSample, 1, 3)!=3) { if (fileAccess.fileRead(audioSample, 1, 3)!=3) {
EWOL_ERROR("Read Error at position : " << iii); EWOL_ERROR("Read Error at position : " << iii);
return NULL; return NULL;
} }
left = CONVERT_INT24(littleEndien, audioSample); left = CONVERT_INT24(littleEndien, audioSample);
right = left; right = left;
} else { } else {
if (fileAccess.FileRead(audioSample, 1, 6)!=6) { if (fileAccess.fileRead(audioSample, 1, 6)!=6) {
EWOL_ERROR("Read Error at position : " << iii); EWOL_ERROR("Read Error at position : " << iii);
return NULL; return NULL;
} }
@ -264,14 +264,14 @@ int16_t * ewol::audio::wav::LoadData(etk::UString filename, int8_t nbChan, int32
} }
} else if (myHeader.waveFormat.bitsPerSample == 32) { } else if (myHeader.waveFormat.bitsPerSample == 32) {
if (myHeader.waveFormat.channelCount == 1) { if (myHeader.waveFormat.channelCount == 1) {
if (fileAccess.FileRead(audioSample, 1, 4)!=4) { if (fileAccess.fileRead(audioSample, 1, 4)!=4) {
EWOL_ERROR("Read Error at position : " << iii); EWOL_ERROR("Read Error at position : " << iii);
return NULL; return NULL;
} }
left = CONVERT_INT32(littleEndien, audioSample); left = CONVERT_INT32(littleEndien, audioSample);
right = left; right = left;
} else { } else {
if (fileAccess.FileRead(audioSample, 1, 8)!=8) { if (fileAccess.fileRead(audioSample, 1, 8)!=8) {
EWOL_ERROR("Read Error at position : " << iii); EWOL_ERROR("Read Error at position : " << iii);
return NULL; return NULL;
} }
@ -287,7 +287,7 @@ int16_t * ewol::audio::wav::LoadData(etk::UString filename, int8_t nbChan, int32
} }
} }
// close the file: // close the file:
fileAccess.FileClose(); fileAccess.fileClose();
nbSampleOut = nbSample; nbSampleOut = nbSample;
return outputData; return outputData;
} }

View File

@ -15,7 +15,7 @@
namespace ewol { namespace ewol {
namespace audio { namespace audio {
namespace wav { namespace wav {
int16_t * LoadData(etk::UString filename, int8_t nbChan, int32_t frequency, int32_t & nbSampleOut); int16_t * loadData(etk::UString filename, int8_t nbChan, int32_t frequency, int32_t & nbSampleOut);
}; };
}; };
}; };

View File

@ -45,13 +45,13 @@ static int patestCallback( const void *inputBuffer, void *outputBuffer,
userOutputData *data = (userOutputData*)userData; userOutputData *data = (userOutputData*)userData;
// no use of the input buffer ... (mightt be NULL) // no use of the input buffer ... (mightt be NULL)
(void) inputBuffer; (void) inputBuffer;
ewol::audio::GetData((int16_t*)outputBuffer, framesPerBuffer, data->nbChanelsOutput); ewol::audio::getData((int16_t*)outputBuffer, framesPerBuffer, data->nbChanelsOutput);
return 0; return 0;
} }
#define SAMPLE_RATE (44100) #define SAMPLE_RATE (44100)
void ewol::portAudio::Init(void) void ewol::portAudio::init(void)
{ {
PaError err; PaError err;
EWOL_DEBUG("Create Audio Thread..."); EWOL_DEBUG("Create Audio Thread...");
@ -65,7 +65,7 @@ void ewol::portAudio::Init(void)
data.nbChanelsInput = 0; data.nbChanelsInput = 0;
data.nbChanelsOutput = 2; data.nbChanelsOutput = 2;
data.frameSize = 256; data.frameSize = 256;
/* Open an audio I/O stream. */ /* open an audio I/O stream. */
err = Pa_OpenDefaultStream( &stream, data.nbChanelsInput, data.nbChanelsOutput, err = Pa_OpenDefaultStream( &stream, data.nbChanelsInput, data.nbChanelsOutput,
paInt16, data.sampleRate, data.frameSize, paInt16, data.sampleRate, data.frameSize,
patestCallback, &data ); patestCallback, &data );
@ -81,7 +81,7 @@ void ewol::portAudio::Init(void)
EWOL_DEBUG("Create Audio Thread ... might have start"); EWOL_DEBUG("Create Audio Thread ... might have start");
} }
void ewol::portAudio::UnInit(void) void ewol::portAudio::unInit(void)
{ {
PaError err; PaError err;
// destroy the thread ... // destroy the thread ...

View File

@ -13,8 +13,8 @@
namespace ewol { namespace ewol {
namespace portAudio { namespace portAudio {
void Init(void); void init(void);
void UnInit(void); void unInit(void);
}; };
}; };

View File

@ -9,7 +9,7 @@
/* /*
notes : notes :
sudo edn /etc/udev/rules.d/framebuffer.rules sudo edn /etc/udev/rules.d/framebuffer.rules
KERNEL=="fb0", OWNER="root", MODE="0660" KERNEL == "fb0", OWNER="root", MODE="0660"
sudo usermod -a -G video username sudo usermod -a -G video username
sudo usermod -a -G tty username sudo usermod -a -G tty username
sudo fbset -i sudo fbset -i
@ -47,7 +47,7 @@
#include <directfbgl.h> #include <directfbgl.h>
int64_t guiInterface::GetTime(void) int64_t guiInterface::getTime(void)
{ {
struct timespec now; struct timespec now;
int ret = clock_gettime(CLOCK_REALTIME, &now); int ret = clock_gettime(CLOCK_REALTIME, &now);
@ -88,17 +88,17 @@ static int screen_height = 600;
/** /**
* @brief Set the new title of the windows * @brief set the new title of the windows
* @param title New desired title * @param title New desired title
* @return --- * @return ---
*/ */
void guiInterface::SetTitle(etk::UString& title) void guiInterface::setTitle(etk::UString& title)
{ {
// TODO : ... // TODO : ...
} }
void guiInterface::SetIcon(etk::UString inputFile) void guiInterface::setIcon(etk::UString inputFile)
{ {
// TODO : ... // TODO : ...
} }
@ -106,7 +106,7 @@ void guiInterface::SetIcon(etk::UString inputFile)
void DirectFB_Init(int argc, const char *argv[]) void DirectFB_Init(int argc, const char *argv[])
{ {
EWOL_INFO("DirectFB Init (START)"); EWOL_INFO("DirectFB init (START)");
DFBResult err; DFBResult err;
DFBSurfaceDescription dsc; DFBSurfaceDescription dsc;
@ -127,10 +127,10 @@ void DirectFB_Init(int argc, const char *argv[])
exit(-1); exit(-1);
} }
EWOL_INFO("call SetCooperativeLevel"); EWOL_INFO("call setCooperativeLevel");
// set our cooperative level to DFSCL_FULLSCREEN for exclusive access to the primary layer // set our cooperative level to DFSCL_FULLSCREEN for exclusive access to the primary layer
dfb->SetCooperativeLevel(dfb, DFSCL_FULLSCREEN); dfb->setCooperativeLevel(dfb, DFSCL_FULLSCREEN);
//dfb->SetCooperativeLevel(dfb, DFSCL_NORMAL); //dfb->setCooperativeLevel(dfb, DFSCL_NORMAL);
// get the primary surface, i.e. the surface of the primary layer we have exclusive access to // get the primary surface, i.e. the surface of the primary layer we have exclusive access to
dsc.flags = (DFBSurfaceDescriptionFlags)(DSDESC_CAPS);// | DSDESC_PIXELFORMAT); dsc.flags = (DFBSurfaceDescriptionFlags)(DSDESC_CAPS);// | DSDESC_PIXELFORMAT);
@ -151,20 +151,20 @@ void DirectFB_Init(int argc, const char *argv[])
exit(-1); exit(-1);
} }
primary->SetBlittingFlags(primary, DSBLIT_BLEND_ALPHACHANNEL); primary->setBlittingFlags(primary, DSBLIT_BLEND_ALPHACHANNEL);
primary->SetPorterDuff( primary, DSPD_ADD ); primary->setPorterDuff( primary, DSPD_ADD );
primary->SetDstBlendFunction(primary, DSBF_SRCALPHA); primary->setDstBlendFunction(primary, DSBF_SRCALPHA);
primary->SetDrawingFlags(primary, DSDRAW_BLEND); primary->setDrawingFlags(primary, DSDRAW_BLEND);
primary->Blit(primary, primary, NULL, 0, 0); primary->Blit(primary, primary, NULL, 0, 0);
EWOL_INFO("call GetSize"); EWOL_INFO("call getSize");
// get the size of the surface and fill it // get the size of the surface and fill it
err = primary->GetSize(primary, &screen_width, &screen_height); err = primary->getSize(primary, &screen_width, &screen_height);
if (DFB_OK!=err) { if (DFB_OK!=err) {
EWOL_ERROR("primary->GetSize"); EWOL_ERROR("primary->getSize");
DirectFBErrorFatal("primary->GetSize", err); DirectFBErrorFatal("primary->getSize", err);
exit(-1); exit(-1);
} }
@ -182,25 +182,25 @@ void DirectFB_Init(int argc, const char *argv[])
primary->Flip(primary, NULL, (DFBSurfaceFlipFlags)0);//DSFLIP_ONSYNC); primary->Flip(primary, NULL, (DFBSurfaceFlipFlags)0);//DSFLIP_ONSYNC);
// NOTE : we need to force it on X11 display ... // NOTE : we need to force it on X11 display ...
EWOL_INFO("call GetGL"); EWOL_INFO("call getGL");
// get the GL context // get the GL context
err = primary->GetGL(primary, &primary_gl); err = primary->getGL(primary, &primary_gl);
if (DFB_OK!=err) { if (DFB_OK!=err) {
EWOL_ERROR("primary->GetGL"); EWOL_ERROR("primary->getGL");
DirectFBErrorFatal("GetGL", err); DirectFBErrorFatal("GetGL", err);
exit(-1); exit(-1);
} }
EWOL_INFO("DirectFB Init (STOP)"); EWOL_INFO("DirectFB init (STOP)");
} }
void DirectFB_UnInit(void) void DirectFB_UnInit(void)
{ {
// release our interfaces to shutdown DirectFB // release our interfaces to shutdown DirectFB
primary_gl->Release(primary_gl); primary_gl->release(primary_gl);
primary->Release(primary); primary->release(primary);
events->Release(events); events->release(events);
dfb->Release(dfb); dfb->release(dfb);
} }
void DirectFB_Run(void) void DirectFB_Run(void)
@ -210,13 +210,13 @@ void DirectFB_Run(void)
DFBResult err; DFBResult err;
int32_t position = 0; int32_t position = 0;
while (true==m_run) { while (true == m_run) {
DFBInputEvent evt; DFBInputEvent evt;
unsigned long t; unsigned long t;
/* /*
primary->SetColor (primary, 0x00, 0x00, 0x00, 0xFF); primary->setColor (primary, 0x00, 0x00, 0x00, 0xFF);
primary->FillRectangle(primary, 0, 0, screen_width, screen_height); primary->FillRectangle(primary, 0, 0, screen_width, screen_height);
primary->SetColor (primary, 0xFF, (uint8_t)position, 0x00, 0xFF); primary->setColor (primary, 0xFF, (uint8_t)position, 0x00, 0xFF);
primary->FillRectangle(primary, position, position, 300, 300); primary->FillRectangle(primary, position, position, 300, 300);
primary->Flip(primary, NULL, (DFBSurfaceFlipFlags)0);//DSFLIP_ONSYNC); primary->Flip(primary, NULL, (DFBSurfaceFlipFlags)0);//DSFLIP_ONSYNC);
position++; position++;
@ -230,9 +230,9 @@ void DirectFB_Run(void)
EWOL_ERROR("primary_gl->Lock"); EWOL_ERROR("primary_gl->Lock");
DirectFBErrorFatal("primary_gl->Lock", err); DirectFBErrorFatal("primary_gl->Lock", err);
} }
// TODO : Set at false // TODO : set at false
bool hasDisplay = eSystem::Draw(true); bool hasDisplay = eSystem::draw(true);
if (true==hasDisplay) { if (true == hasDisplay) {
glFinish(); glFinish();
} }
err = primary_gl->Unlock(primary_gl); err = primary_gl->Unlock(primary_gl);
@ -243,7 +243,7 @@ void DirectFB_Run(void)
primary->Flip(primary, NULL, (DFBSurfaceFlipFlags)0);//DSFLIP_ONSYNC); primary->Flip(primary, NULL, (DFBSurfaceFlipFlags)0);//DSFLIP_ONSYNC);
} }
while (events->GetEvent(events, DFB_EVENT(&evt)) == DFB_OK) { while (events->getEvent(events, DFB_EVENT(&evt)) == DFB_OK) {
switch (evt.type) { switch (evt.type) {
default: default:
case DIET_UNKNOWN: /* unknown event */ case DIET_UNKNOWN: /* unknown event */
@ -252,12 +252,12 @@ void DirectFB_Run(void)
case DIET_KEYPRESS: /* a key is been pressed */ case DIET_KEYPRESS: /* a key is been pressed */
case DIET_KEYRELEASE: /* a key is been released */ case DIET_KEYRELEASE: /* a key is been released */
{ {
bool isPressed = (evt.type==DIET_KEYPRESS); bool isPressed = (evt.type == DIET_KEYPRESS);
//EWOL_DEBUG("event KeyBoard isPressed : " << isPressed << " symbole=\"" << (char)evt.key_symbol << "\"=" << ((int32_t)evt.key_symbol) << " ..."); //EWOL_DEBUG("event KeyBoard isPressed : " << isPressed << " symbole=\"" << (char)evt.key_symbol << "\"=" << ((int32_t)evt.key_symbol) << " ...");
if( 1 <= evt.key_symbol && evt.key_symbol <= 0x7F ) { if( 1 <= evt.key_symbol && evt.key_symbol <= 0x7F ) {
eSystem::SetKeyboard(guiKeyBoardMode, evt.key_symbol, isPressed, false); eSystem::setKeyboard(guiKeyBoardMode, evt.key_symbol, isPressed, false);
} else { } else {
EWOL_DEBUG("event KeyBoard isPressed : " << isPressed << " symbole=\"" << (char)evt.key_symbol << "\"=" << ((int32_t)evt.key_symbol) << " ==> not managed key"); EWOL_DEBUG("event KeyBoard isPressed : " << isPressed << " symbole=\"" << (char)evt.key_symbol << "\"=" << ((int32_t)evt.key_symbol) << " == > not managed key");
} }
} }
break; break;
@ -286,7 +286,7 @@ void DirectFB_Run(void)
case DIET_BUTTONPRESS: /* a (mouse) button is been pressed */ case DIET_BUTTONPRESS: /* a (mouse) button is been pressed */
case DIET_BUTTONRELEASE: /* a (mouse) button is been released */ case DIET_BUTTONRELEASE: /* a (mouse) button is been released */
{ {
bool isPressed = (evt.type==DIET_KEYPRESS); bool isPressed = (evt.type == DIET_KEYPRESS);
EWOL_DEBUG("event mouse event pressed=" << isPressed << " flag" << (char)evt.flags << " axis=" << evt.axis << " value=" << evt.axisrel); EWOL_DEBUG("event mouse event pressed=" << isPressed << " flag" << (char)evt.flags << " axis=" << evt.axis << " value=" << evt.axisrel);
} }
break; break;
@ -410,25 +410,25 @@ void guiInterface::KeyboardHide(void)
} }
void guiInterface::ChangeSize(ivec2 size) void guiInterface::changeSize(ivec2 size)
{ {
// TODO : ... // TODO : ...
} }
void guiInterface::ChangePos(ivec2 pos) void guiInterface::changePos(ivec2 pos)
{ {
// TODO : ... // TODO : ...
} }
void guiInterface::GetAbsPos(ivec2& pos) void guiInterface::getAbsPos(ivec2& pos)
{ {
// TODO : ... // TODO : ...
} }
void guiInterface::SetCursor(ewol::cursorDisplay_te newCursor) void guiInterface::setCursor(ewol::cursorDisplay_te newCursor)
{ {
// TODO : ... // TODO : ...
} }
@ -454,7 +454,7 @@ int guiInterface::main(int argc, const char *argv[])
// start X11 thread ... // start X11 thread ...
DirectFB_Init(argc, argv); DirectFB_Init(argc, argv);
//start the basic thread : //start the basic thread :
eSystem::Init(); eSystem::init();
// Run ... // Run ...
DirectFB_Run(); DirectFB_Run();
// UnInit: // UnInit:
@ -468,7 +468,7 @@ int guiInterface::main(int argc, const char *argv[])
} }
void guiInterface::ForceOrientation(ewol::orientation_te orientation) void guiInterface::forceOrientation(ewol::orientation_te orientation)
{ {
// nothing to do ... // nothing to do ...
} }

View File

@ -29,11 +29,11 @@
#include <date/date.h> #include <date/date.h>
/** /**
* @brief Get the main ewol mutex (event or periodic call mutex). * @brief get the main ewol mutex (event or periodic call mutex).
* @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. * @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 * @return the main inteface Mutex
*/ */
static etk::Mutex& MutexInterface(void) static etk::Mutex& mutexInterface(void)
{ {
static etk::Mutex s_interfaceMutex; static etk::Mutex s_interfaceMutex;
return s_interfaceMutex; return s_interfaceMutex;
@ -41,7 +41,7 @@ static etk::Mutex& MutexInterface(void)
static ewol::eContext* l_curentInterface=NULL; static ewol::eContext* l_curentInterface=NULL;
ewol::eContext& ewol::GetContext(void) ewol::eContext& ewol::getContext(void)
{ {
#if DEBUG_LEVEL > 2 #if DEBUG_LEVEL > 2
if(NULL == l_curentInterface){ if(NULL == l_curentInterface){
@ -52,50 +52,50 @@ ewol::eContext& ewol::GetContext(void)
} }
/** /**
* @brief Set the curent interface. * @brief set the curent interface.
* @note this lock the main mutex * @note this lock the main mutex
*/ */
void ewol::eContext::LockContext(void) void ewol::eContext::lockContext(void)
{ {
MutexInterface().Lock(); mutexInterface().lock();
l_curentInterface = this; l_curentInterface = this;
} }
/** /**
* @brief Set the curent interface at NULL. * @brief set the curent interface at NULL.
* @note this un-lock the main mutex * @note this un-lock the main mutex
*/ */
void ewol::eContext::UnLockContext(void) void ewol::eContext::unLockContext(void)
{ {
l_curentInterface = NULL; l_curentInterface = NULL;
MutexInterface().UnLock(); mutexInterface().unLock();
} }
void ewol::eContext::InputEventTransfertWidget(ewol::Widget* source, ewol::Widget* destination) void ewol::eContext::inputEventTransfertWidget(ewol::Widget* source, ewol::Widget* destination)
{ {
m_input.TransfertEvent(source, destination); m_input.transfertEvent(source, destination);
} }
void ewol::eContext::InputEventGrabPointer(ewol::Widget* widget) void ewol::eContext::inputEventGrabPointer(ewol::Widget* widget)
{ {
m_input.GrabPointer(widget); m_input.grabPointer(widget);
} }
void ewol::eContext::InputEventUnGrabPointer(void) void ewol::eContext::inputEventUnGrabPointer(void)
{ {
m_input.UnGrabPointer(); m_input.unGrabPointer();
} }
void ewol::eContext::ProcessEvents(void) void ewol::eContext::processEvents(void)
{ {
int32_t nbEvent = 0; int32_t nbEvent = 0;
//EWOL_DEBUG(" ******** Event"); //EWOL_DEBUG(" ******** Event");
eSystemMessage data; eSystemMessage data;
while (m_msgSystem.Count()>0) while (m_msgSystem.count()>0)
{ {
nbEvent++; nbEvent++;
m_msgSystem.Wait(data); m_msgSystem.wait(data);
//EWOL_DEBUG("EVENT"); //EWOL_DEBUG("EVENT");
switch (data.TypeMessage) { switch (data.TypeMessage) {
case THREAD_INIT: case THREAD_INIT:
@ -103,40 +103,40 @@ void ewol::eContext::ProcessEvents(void)
/*bool returnVal = */APP_Init(*this); /*bool returnVal = */APP_Init(*this);
break; break;
case THREAD_RECALCULATE_SIZE: case THREAD_RECALCULATE_SIZE:
ForceRedrawAll(); forceRedrawAll();
break; break;
case THREAD_RESIZE: case THREAD_RESIZE:
//EWOL_DEBUG("Receive MSG : THREAD_RESIZE"); //EWOL_DEBUG("Receive MSG : THREAD_RESIZE");
m_windowsSize = data.dimention; m_windowsSize = data.dimention;
ewol::dimension::SetPixelWindowsSize(m_windowsSize); ewol::dimension::setPixelWindowsSize(m_windowsSize);
ForceRedrawAll(); forceRedrawAll();
break; break;
case THREAD_INPUT_MOTION: case THREAD_INPUT_MOTION:
//EWOL_DEBUG("Receive MSG : THREAD_INPUT_MOTION"); //EWOL_DEBUG("Receive MSG : THREAD_INPUT_MOTION");
m_input.Motion(data.inputType, data.inputId, data.dimention); m_input.motion(data.inputType, data.inputId, data.dimention);
break; break;
case THREAD_INPUT_STATE: case THREAD_INPUT_STATE:
//EWOL_DEBUG("Receive MSG : THREAD_INPUT_STATE"); //EWOL_DEBUG("Receive MSG : THREAD_INPUT_STATE");
m_input.State(data.inputType, data.inputId, data.stateIsDown, data.dimention); m_input.state(data.inputType, data.inputId, data.stateIsDown, data.dimention);
break; break;
case THREAD_KEYBORAD_KEY: case THREAD_KEYBORAD_KEY:
case THREAD_KEYBORAD_MOVE: case THREAD_KEYBORAD_MOVE:
//EWOL_DEBUG("Receive MSG : THREAD_KEYBORAD_KEY"); //EWOL_DEBUG("Receive MSG : THREAD_KEYBORAD_KEY");
if (NULL != m_windowsCurrent) { if (NULL != m_windowsCurrent) {
if (false==m_windowsCurrent->OnEventShortCut(data.keyboardSpecial, if (false == m_windowsCurrent->onEventShortCut(data.keyboardSpecial,
data.keyboardChar, data.keyboardChar,
data.keyboardMove, data.keyboardMove,
data.stateIsDown) ) { data.stateIsDown) ) {
// Get the current Focused Widget : // get the current focused Widget :
ewol::Widget * tmpWidget = m_widgetManager.FocusGet(); ewol::Widget * tmpWidget = m_widgetManager.focusGet();
if (NULL != tmpWidget) { if (NULL != tmpWidget) {
// check if the widget allow repeating key events. // check if the widget allow repeating key events.
//EWOL_DEBUG("repeating test :" << data.repeateKey << " widget=" << tmpWidget->GetKeyboardRepeate() << " state=" << data.stateIsDown); //EWOL_DEBUG("repeating test :" << data.repeateKey << " widget=" << tmpWidget->getKeyboardRepeate() << " state=" << data.stateIsDown);
if( false==data.repeateKey if( false == data.repeateKey
|| ( true==data.repeateKey || ( true == data.repeateKey
&& true==tmpWidget->GetKeyboardRepeate()) ) { && true == tmpWidget->getKeyboardRepeate()) ) {
// check Widget shortcut // check Widget shortcut
if (false==tmpWidget->OnEventShortCut(data.keyboardSpecial, if (false == tmpWidget->onEventShortCut(data.keyboardSpecial,
data.keyboardChar, data.keyboardChar,
data.keyboardMove, data.keyboardMove,
data.stateIsDown) ) { data.stateIsDown) ) {
@ -147,9 +147,9 @@ void ewol::eContext::ProcessEvents(void)
data.keyboardSpecial, data.keyboardSpecial,
data.keyboardChar); data.keyboardChar);
if(true == data.stateIsDown) { if(true == data.stateIsDown) {
tmpEntryEvent.m_event.SetStatus(ewol::keyEvent::statusDown); tmpEntryEvent.m_event.setStatus(ewol::keyEvent::statusDown);
} }
tmpWidget->SystemEventEntry(tmpEntryEvent); tmpWidget->systemEventEntry(tmpEntryEvent);
} else { // THREAD_KEYBORAD_MOVE } else { // THREAD_KEYBORAD_MOVE
EWOL_DEBUG("THREAD_KEYBORAD_MOVE" << data.keyboardMove << " " << data.stateIsDown); EWOL_DEBUG("THREAD_KEYBORAD_MOVE" << data.keyboardMove << " " << data.stateIsDown);
ewol::EventEntrySystem tmpEntryEvent(data.keyboardMove, ewol::EventEntrySystem tmpEntryEvent(data.keyboardMove,
@ -157,9 +157,9 @@ void ewol::eContext::ProcessEvents(void)
data.keyboardSpecial, data.keyboardSpecial,
0); 0);
if(true == data.stateIsDown) { if(true == data.stateIsDown) {
tmpEntryEvent.m_event.SetStatus(ewol::keyEvent::statusDown); tmpEntryEvent.m_event.setStatus(ewol::keyEvent::statusDown);
} }
tmpWidget->SystemEventEntry(tmpEntryEvent); tmpWidget->systemEventEntry(tmpEntryEvent);
} }
} else { } else {
EWOL_DEBUG("remove Repeate key ..."); EWOL_DEBUG("remove Repeate key ...");
@ -171,9 +171,9 @@ void ewol::eContext::ProcessEvents(void)
break; break;
case THREAD_CLIPBOARD_ARRIVE: case THREAD_CLIPBOARD_ARRIVE:
{ {
ewol::Widget * tmpWidget = m_widgetManager.FocusGet(); ewol::Widget * tmpWidget = m_widgetManager.focusGet();
if (tmpWidget != NULL) { if (tmpWidget != NULL) {
tmpWidget->OnEventClipboard(data.clipboardID); tmpWidget->onEventClipboard(data.clipboardID);
} }
} }
break; break;
@ -194,21 +194,21 @@ void ewol::eContext::ProcessEvents(void)
} }
} }
void ewol::eContext::SetArchiveDir(int mode, const char* str) void ewol::eContext::setArchiveDir(int mode, const char* str)
{ {
switch(mode) switch(mode)
{ {
case 0: case 0:
EWOL_DEBUG("Directory APK : path=" << str); EWOL_DEBUG("Directory APK : path=" << str);
etk::SetBaseFolderData(str); etk::setBaseFolderData(str);
break; break;
case 1: case 1:
EWOL_DEBUG("Directory mode=FILE path=" << str); EWOL_DEBUG("Directory mode=FILE path=" << str);
etk::SetBaseFolderDataUser(str); etk::setBaseFolderDataUser(str);
break; break;
case 2: case 2:
EWOL_DEBUG("Directory mode=CACHE path=" << str); EWOL_DEBUG("Directory mode=CACHE path=" << str);
etk::SetBaseFolderCache(str); etk::setBaseFolderCache(str);
break; break;
case 3: case 3:
EWOL_DEBUG("Directory mode=EXTERNAL_CACHE path=" << str); EWOL_DEBUG("Directory mode=EXTERNAL_CACHE path=" << str);
@ -232,98 +232,98 @@ ewol::eContext::eContext(int32_t _argc, const char* _argv[]) :
m_windowsCurrent(NULL), m_windowsCurrent(NULL),
m_windowsSize(320,480) m_windowsSize(320,480)
{ {
m_commandLine.Parse(_argc, _argv); m_commandLine.parse(_argc, _argv);
EWOL_INFO("==> Ewol System Init (BEGIN)"); EWOL_INFO(" == > Ewol system init (BEGIN)");
// set the curent interface : // set the curent interface :
LockContext(); lockContext();
// parse the debug level: // parse the debug level:
for(esize_t iii=m_commandLine.Size()-1 ; iii>=0 ; --iii) { for(esize_t iii=m_commandLine.size()-1 ; iii >= 0 ; --iii) {
if (m_commandLine.Get(iii) == "-l0") { if (m_commandLine.get(iii) == "-l0") {
GeneralDebugSetLevel(etk::LOG_LEVEL_NONE); debug::setGeneralLevel(etk::LOG_LEVEL_NONE);
} else if (m_commandLine.Get(iii) == "-l1") { } else if (m_commandLine.get(iii) == "-l1") {
GeneralDebugSetLevel(etk::LOG_LEVEL_CRITICAL); debug::setGeneralLevel(etk::LOG_LEVEL_CRITICAL);
} else if (m_commandLine.Get(iii) == "-l2") { } else if (m_commandLine.get(iii) == "-l2") {
GeneralDebugSetLevel(etk::LOG_LEVEL_ERROR); debug::setGeneralLevel(etk::LOG_LEVEL_ERROR);
} else if (m_commandLine.Get(iii) == "-l3") { } else if (m_commandLine.get(iii) == "-l3") {
GeneralDebugSetLevel(etk::LOG_LEVEL_WARNING); debug::setGeneralLevel(etk::LOG_LEVEL_WARNING);
} else if (m_commandLine.Get(iii) == "-l4") { } else if (m_commandLine.get(iii) == "-l4") {
GeneralDebugSetLevel(etk::LOG_LEVEL_INFO); debug::setGeneralLevel(etk::LOG_LEVEL_INFO);
} else if (m_commandLine.Get(iii) == "-l5") { } else if (m_commandLine.get(iii) == "-l5") {
GeneralDebugSetLevel(etk::LOG_LEVEL_DEBUG); debug::setGeneralLevel(etk::LOG_LEVEL_DEBUG);
} else if( m_commandLine.Get(iii) == "-l6" } else if( m_commandLine.get(iii) == "-l6"
|| m_commandLine.Get(iii) == "-l7" || m_commandLine.get(iii) == "-l7"
|| m_commandLine.Get(iii) == "-l8" || m_commandLine.get(iii) == "-l8"
|| m_commandLine.Get(iii) == "-l9") { || m_commandLine.get(iii) == "-l9") {
GeneralDebugSetLevel(etk::LOG_LEVEL_VERBOSE); debug::setGeneralLevel(etk::LOG_LEVEL_VERBOSE);
} else if (m_commandLine.Get(iii) == "-fps") { } else if (m_commandLine.get(iii) == "-fps") {
m_displayFps=true; m_displayFps=true;
} else { } else {
continue; continue;
} }
m_commandLine.Remove(iii); m_commandLine.remove(iii);
} }
EWOL_INFO("v:" << ewol::GetVersion()); EWOL_INFO("v:" << ewol::getVersion());
EWOL_INFO("Build Date: " << date::GetYear() << "/" << date::GetMonth() << "/" << date::GetDay() << " " << date::GetHour() << "h" << date::GetMinute()); EWOL_INFO("Build Date: " << date::getYear() << "/" << date::getMonth() << "/" << date::getDay() << " " << date::getHour() << "h" << date::getMinute());
// TODO : Remove this ... // TODO : remove this ...
etk::InitDefaultFolder("ewolApplNoName"); etk::initDefaultFolder("ewolApplNoName");
// request the init of the application in the main context of openGL ... // request the init of the application in the main context of openGL ...
{ {
eSystemMessage data; eSystemMessage data;
data.TypeMessage = THREAD_INIT; data.TypeMessage = THREAD_INIT;
m_msgSystem.Post(data); m_msgSystem.post(data);
} }
// force a recalculation // force a recalculation
RequestUpdateSize(); requestUpdateSize();
#if defined(__EWOL_ANDROID_ORIENTATION_LANDSCAPE__) #if defined(__EWOL_ANDROID_ORIENTATION_LANDSCAPE__)
ForceOrientation(ewol::SCREEN_ORIENTATION_LANDSCAPE); forceOrientation(ewol::SCREEN_ORIENTATION_LANDSCAPE);
#elif defined(__EWOL_ANDROID_ORIENTATION_PORTRAIT__) #elif defined(__EWOL_ANDROID_ORIENTATION_PORTRAIT__)
ForceOrientation(ewol::SCREEN_ORIENTATION_PORTRAIT); forceOrientation(ewol::SCREEN_ORIENTATION_PORTRAIT);
#else #else
ForceOrientation(ewol::SCREEN_ORIENTATION_AUTO); forceOrientation(ewol::SCREEN_ORIENTATION_AUTO);
#endif #endif
// release the curent interface : // release the curent interface :
UnLockContext(); unLockContext();
EWOL_INFO("==> Ewol System Init (END)"); EWOL_INFO(" == > Ewol system init (END)");
} }
ewol::eContext::~eContext(void) ewol::eContext::~eContext(void)
{ {
EWOL_INFO("==> Ewol System Un-Init (BEGIN)"); EWOL_INFO(" == > Ewol system Un-Init (BEGIN)");
// set the curent interface : // set the curent interface :
LockContext(); lockContext();
// call application to uninit // call application to uninit
APP_UnInit(*this); APP_UnInit(*this);
if (NULL!=m_windowsCurrent) { if (NULL!=m_windowsCurrent) {
EWOL_ERROR("Main windows has not been removed... ==> memory leek"); EWOL_ERROR("Main windows has not been removed... == > memory leek");
} }
// unset all windows // unset all windows
m_windowsCurrent = NULL; m_windowsCurrent = NULL;
m_msgSystem.Clean(); m_msgSystem.clean();
m_EObjectManager.UnInit(); m_EObjectManager.unInit();
m_resourceManager.UnInit(); m_resourceManager.unInit();
// release the curent interface : // release the curent interface :
UnLockContext(); unLockContext();
EWOL_INFO("==> Ewol System Un-Init (END)"); EWOL_INFO(" == > Ewol system Un-Init (END)");
} }
void ewol::eContext::RequestUpdateSize(void) void ewol::eContext::requestUpdateSize(void)
{ {
eSystemMessage data; eSystemMessage data;
data.TypeMessage = THREAD_RECALCULATE_SIZE; data.TypeMessage = THREAD_RECALCULATE_SIZE;
m_msgSystem.Post(data); m_msgSystem.post(data);
} }
void ewol::eContext::OS_Resize(const vec2& _size) void ewol::eContext::OS_Resize(const vec2& _size)
{ {
// TODO : Better in the thread ... ==> but generate some init error ... // TODO : Better in the thread ... == > but generate some init error ...
ewol::dimension::SetPixelWindowsSize(_size); ewol::dimension::setPixelWindowsSize(_size);
eSystemMessage data; eSystemMessage data;
data.TypeMessage = THREAD_RESIZE; data.TypeMessage = THREAD_RESIZE;
data.dimention = _size; data.dimention = _size;
m_msgSystem.Post(data); m_msgSystem.post(data);
} }
void ewol::eContext::OS_Move(const vec2& _pos) void ewol::eContext::OS_Move(const vec2& _pos)
{ {
@ -343,7 +343,7 @@ void ewol::eContext::OS_SetInputMotion(int _pointerID, const vec2& _pos )
data.inputType = ewol::keyEvent::typeFinger; data.inputType = ewol::keyEvent::typeFinger;
data.inputId = _pointerID; data.inputId = _pointerID;
data.dimention = _pos; data.dimention = _pos;
m_msgSystem.Post(data); m_msgSystem.post(data);
} }
@ -355,7 +355,7 @@ void ewol::eContext::OS_SetInputState(int _pointerID, bool _isDown, const vec2&
data.inputId = _pointerID; data.inputId = _pointerID;
data.stateIsDown = _isDown; data.stateIsDown = _isDown;
data.dimention = _pos; data.dimention = _pos;
m_msgSystem.Post(data); m_msgSystem.post(data);
} }
@ -366,7 +366,7 @@ void ewol::eContext::OS_SetMouseMotion(int _pointerID, const vec2& _pos )
data.inputType = ewol::keyEvent::typeMouse; data.inputType = ewol::keyEvent::typeMouse;
data.inputId = _pointerID; data.inputId = _pointerID;
data.dimention = _pos; data.dimention = _pos;
m_msgSystem.Post(data); m_msgSystem.post(data);
} }
@ -378,7 +378,7 @@ void ewol::eContext::OS_SetMouseState(int _pointerID, bool _isDown, const vec2&
data.inputId = _pointerID; data.inputId = _pointerID;
data.stateIsDown = _isDown; data.stateIsDown = _isDown;
data.dimention = _pos; data.dimention = _pos;
m_msgSystem.Post(data); m_msgSystem.post(data);
} }
@ -393,7 +393,7 @@ void ewol::eContext::OS_SetKeyboard(ewol::SpecialKey& _special,
data.keyboardChar = _myChar; data.keyboardChar = _myChar;
data.keyboardSpecial = _special; data.keyboardSpecial = _special;
data.repeateKey = _isARepeateKey; data.repeateKey = _isARepeateKey;
m_msgSystem.Post(data); m_msgSystem.post(data);
} }
void ewol::eContext::OS_SetKeyboardMove(ewol::SpecialKey& _special, void ewol::eContext::OS_SetKeyboardMove(ewol::SpecialKey& _special,
@ -407,7 +407,7 @@ void ewol::eContext::OS_SetKeyboardMove(ewol::SpecialKey& _special,
data.keyboardMove = _move; data.keyboardMove = _move;
data.keyboardSpecial = _special; data.keyboardSpecial = _special;
data.repeateKey = _isARepeateKey; data.repeateKey = _isARepeateKey;
m_msgSystem.Post(data); m_msgSystem.post(data);
} }
@ -415,14 +415,14 @@ void ewol::eContext::OS_Hide(void)
{ {
eSystemMessage data; eSystemMessage data;
data.TypeMessage = THREAD_HIDE; data.TypeMessage = THREAD_HIDE;
m_msgSystem.Post(data); m_msgSystem.post(data);
} }
void ewol::eContext::OS_Show(void) void ewol::eContext::OS_Show(void)
{ {
eSystemMessage data; eSystemMessage data;
data.TypeMessage = THREAD_SHOW; data.TypeMessage = THREAD_SHOW;
m_msgSystem.Post(data); m_msgSystem.post(data);
} }
@ -431,12 +431,12 @@ void ewol::eContext::OS_ClipBoardArrive(ewol::clipBoard::clipboardListe_te _clip
eSystemMessage data; eSystemMessage data;
data.TypeMessage = THREAD_CLIPBOARD_ARRIVE; data.TypeMessage = THREAD_CLIPBOARD_ARRIVE;
data.clipboardID = _clipboardID; data.clipboardID = _clipboardID;
m_msgSystem.Post(data); m_msgSystem.post(data);
} }
bool ewol::eContext::OS_Draw(bool _displayEveryTime) bool ewol::eContext::OS_Draw(bool _displayEveryTime)
{ {
int64_t currentTime = ewol::GetTime(); int64_t currentTime = ewol::getTime();
// this is to prevent the multiple display at the a high frequency ... // this is to prevent the multiple display at the a high frequency ...
#if (!defined(__TARGET_OS__Android) && !defined(__TARGET_OS__Windows)) #if (!defined(__TARGET_OS__Android) && !defined(__TARGET_OS__Windows))
if(currentTime - m_previousDisplayTime < 1000000/120) { if(currentTime - m_previousDisplayTime < 1000000/120) {
@ -448,124 +448,124 @@ bool ewol::eContext::OS_Draw(bool _displayEveryTime)
m_previousDisplayTime = currentTime; m_previousDisplayTime = currentTime;
// process the events // process the events
if (m_displayFps==true) { if (m_displayFps == true) {
m_FpsSystemEvent.Tic(); m_FpsSystemEvent.tic();
} }
bool needRedraw = false; bool needRedraw = false;
//! Event management section ... //! Event management section ...
{ {
// set the curent interface : // set the curent interface :
LockContext(); lockContext();
ProcessEvents(); processEvents();
// call all the widget that neded to do something periodicly // call all the widget that neded to do something periodicly
//! ewol::widgetManager::PeriodicCall(currentTime); //! ewol::widgetManager::periodicCall(currentTime);
m_widgetManager.PeriodicCall(currentTime); m_widgetManager.periodicCall(currentTime);
// Remove all widget that they are no more usefull (these who decided to destroy themself) // remove all widget that they are no more usefull (these who decided to destroy themself)
//! ewol::EObjectManager::RemoveAllAutoRemove(); //! ewol::EObjectManager::removeAllAutoRemove();
m_EObjectManager.RemoveAllAutoRemove(); m_EObjectManager.removeAllAutoRemove();
// check if the user selected a windows // check if the user selected a windows
if (NULL != m_windowsCurrent) { if (NULL != m_windowsCurrent) {
// Redraw all needed elements // Redraw all needed elements
m_windowsCurrent->OnRegenerateDisplay(); m_windowsCurrent->onRegenerateDisplay();
} }
if (m_displayFps==true) { if (m_displayFps == true) {
m_FpsSystemEvent.IncrementCounter(); m_FpsSystemEvent.incrementCounter();
m_FpsSystemEvent.Toc(); m_FpsSystemEvent.toc();
} }
//! bool needRedraw = ewol::widgetManager::IsDrawingNeeded(); //! bool needRedraw = ewol::widgetManager::isDrawingNeeded();
needRedraw = m_widgetManager.IsDrawingNeeded(); needRedraw = m_widgetManager.isDrawingNeeded();
// release the curent interface : // release the curent interface :
UnLockContext(); unLockContext();
} }
bool hasDisplayDone = false; bool hasDisplayDone = false;
//! Drawing section : //! drawing section :
{ {
// Lock OpenGl context: // Lock openGl context:
ewol::openGL::Lock(); ewol::openGL::lock();
if (m_displayFps==true) { if (m_displayFps == true) {
m_FpsSystemContext.Tic(); m_FpsSystemContext.tic();
} }
if (NULL != m_windowsCurrent) { if (NULL != m_windowsCurrent) {
if( true == needRedraw if( true == needRedraw
|| true == _displayEveryTime) { || true == _displayEveryTime) {
m_resourceManager.UpdateContext(); m_resourceManager.updateContext();
if (m_displayFps==true) { if (m_displayFps == true) {
m_FpsSystemContext.IncrementCounter(); m_FpsSystemContext.incrementCounter();
} }
} }
} }
if (m_displayFps==true) { if (m_displayFps == true) {
m_FpsSystemContext.Toc(); m_FpsSystemContext.toc();
m_FpsSystem.Tic(); m_FpsSystem.tic();
} }
if (NULL != m_windowsCurrent) { if (NULL != m_windowsCurrent) {
if( true == needRedraw if( true == needRedraw
|| true == _displayEveryTime) { || true == _displayEveryTime) {
m_FpsSystem.IncrementCounter(); m_FpsSystem.incrementCounter();
m_windowsCurrent->SysDraw(); m_windowsCurrent->sysDraw();
hasDisplayDone = true; hasDisplayDone = true;
} }
} }
if (m_displayFps==true) { if (m_displayFps == true) {
m_FpsSystem.Toc(); m_FpsSystem.toc();
m_FpsFlush.Tic(); m_FpsFlush.tic();
m_FpsFlush.IncrementCounter(); m_FpsFlush.incrementCounter();
} }
glFlush(); glFlush();
//glFinish(); //glFinish();
if (m_displayFps==true) { if (m_displayFps == true) {
m_FpsFlush.Toc(); m_FpsFlush.toc();
} }
// Release Open GL Context // release open GL Context
ewol::openGL::UnLock(); ewol::openGL::unLock();
} }
if (m_displayFps==true) { if (m_displayFps == true) {
m_FpsSystemEvent.Draw(); m_FpsSystemEvent.draw();
m_FpsSystemContext.Draw(); m_FpsSystemContext.draw();
m_FpsSystem.Draw(); m_FpsSystem.draw();
m_FpsFlush.Draw(); m_FpsFlush.draw();
} }
return hasDisplayDone; return hasDisplayDone;
} }
void ewol::eContext::OnObjectRemove(ewol::EObject * _removeObject) void ewol::eContext::onObjectRemove(ewol::EObject * _removeObject)
{ {
//EWOL_CRITICAL("element removed"); //EWOL_CRITICAL("element removed");
m_input.OnObjectRemove(_removeObject); m_input.onObjectRemove(_removeObject);
} }
void ewol::eContext::ResetIOEvent(void) void ewol::eContext::resetIOEvent(void)
{ {
m_input.NewLayerSet(); m_input.newLayerSet();
} }
void ewol::eContext::OS_OpenGlContextDestroy(void) void ewol::eContext::OS_OpenGlContextDestroy(void)
{ {
m_resourceManager.ContextHasBeenDestroyed(); m_resourceManager.contextHasBeenDestroyed();
} }
void ewol::eContext::SetWindows(ewol::Windows* _windows) void ewol::eContext::setWindows(ewol::Windows* _windows)
{ {
// Remove current Focus : // remove current focus :
m_widgetManager.FocusSetDefault(NULL); m_widgetManager.focusSetDefault(NULL);
m_widgetManager.FocusRelease(); m_widgetManager.focusRelease();
// set the new pointer as windows system // set the new pointer as windows system
m_windowsCurrent = _windows; m_windowsCurrent = _windows;
// Set the new default Focus : // set the new default focus :
m_widgetManager.FocusSetDefault(_windows); m_widgetManager.focusSetDefault(_windows);
// request all the widget redrawing // request all the widget redrawing
ForceRedrawAll(); forceRedrawAll();
} }
void ewol::eContext::ForceRedrawAll(void) void ewol::eContext::forceRedrawAll(void)
{ {
if (NULL != m_windowsCurrent) { if (NULL != m_windowsCurrent) {
m_windowsCurrent->CalculateSize(vec2(m_windowsSize.x(), m_windowsSize.y())); m_windowsCurrent->calculateSize(vec2(m_windowsSize.x(), m_windowsSize.y()));
} }
} }
@ -573,7 +573,7 @@ void ewol::eContext::ForceRedrawAll(void)
void ewol::eContext::OS_Stop(void) void ewol::eContext::OS_Stop(void)
{ {
if (NULL != m_windowsCurrent) { if (NULL != m_windowsCurrent) {
m_windowsCurrent->SysOnKill(); m_windowsCurrent->sysOnKill();
} }
} }
@ -584,6 +584,6 @@ void ewol::eContext::OS_Suspend(void)
void ewol::eContext::OS_Resume(void) void ewol::eContext::OS_Resume(void)
{ {
m_previousDisplayTime = ewol::GetTime(); m_previousDisplayTime = ewol::getTime();
m_widgetManager.PeriodicCallResume(m_previousDisplayTime); m_widgetManager.periodicCallResume(m_previousDisplayTime);
} }

View File

@ -24,7 +24,7 @@
#include <ewol/commandLine.h> #include <ewol/commandLine.h>
// TODO : Remove this from here ... // TODO : remove this from here ...
typedef enum { typedef enum {
THREAD_NONE, THREAD_NONE,
THREAD_INIT, THREAD_INIT,
@ -41,7 +41,7 @@ typedef enum {
THREAD_CLIPBOARD_ARRIVE, THREAD_CLIPBOARD_ARRIVE,
} theadMessage_te; } theadMessage_te;
// TODO : Remove this from here ... // TODO : remove this from here ...
class eSystemMessage { class eSystemMessage {
public : public :
// specify the message type // specify the message type
@ -88,37 +88,37 @@ namespace ewol
private: private:
ewol::CommandLine m_commandLine; //!< Start command line information ewol::CommandLine m_commandLine; //!< Start command line information
public: public:
ewol::CommandLine& GetCmd(void) { return m_commandLine; }; ewol::CommandLine& getCmd(void) { return m_commandLine; };
private: private:
ewol::ConfigFont m_configFont; //!< global font configuration ewol::ConfigFont m_configFont; //!< global font configuration
public: public:
ewol::ConfigFont& GetFontDefault(void) { return m_configFont; }; ewol::ConfigFont& getFontDefault(void) { return m_configFont; };
private: private:
ewol::WidgetManager m_widgetManager; //!< global widget manager ewol::WidgetManager m_widgetManager; //!< global widget manager
public: public:
ewol::WidgetManager& GetWidgetManager(void) { return m_widgetManager; }; ewol::WidgetManager& getWidgetManager(void) { return m_widgetManager; };
private: private:
ewol::EObjectManager m_EObjectManager; //!< eObject Manager main instance ewol::EObjectManager m_EObjectManager; //!< eObject Manager main instance
public: public:
ewol::EObjectManager& GetEObjectManager(void) { return m_EObjectManager; }; ewol::EObjectManager& getEObjectManager(void) { return m_EObjectManager; };
private: private:
ewol::ResourceManager m_resourceManager; //!< global resources Manager ewol::ResourceManager m_resourceManager; //!< global resources Manager
public: public:
ewol::ResourceManager& GetResourcesManager(void) { return m_resourceManager; }; ewol::ResourceManager& getResourcesManager(void) { return m_resourceManager; };
public: public:
eContext(int32_t _argc=0, const char* _argv[]=NULL); eContext(int32_t _argc=0, const char* _argv[]=NULL);
virtual ~eContext(void); virtual ~eContext(void);
protected: protected:
/** /**
* @brief Set the curent interface. * @brief set the curent interface.
* @note this lock the main mutex * @note this lock the main mutex
*/ */
void LockContext(void); void lockContext(void);
/** /**
* @brief Set the curent interface at NULL. * @brief set the curent interface at NULL.
* @note this un-lock the main mutex * @note this un-lock the main mutex
*/ */
void UnLockContext(void); void unLockContext(void);
private: private:
int64_t m_previousDisplayTime; // this is to limit framerate ... in case... int64_t m_previousDisplayTime; // this is to limit framerate ... in case...
ewol::eInput m_input; ewol::eInput m_input;
@ -131,10 +131,10 @@ namespace ewol
/** /**
* @brief Processing all the event arrived ... (commoly called in draw function) * @brief Processing all the event arrived ... (commoly called in draw function)
*/ */
void ProcessEvents(void); void processEvents(void);
public: public:
virtual void SetArchiveDir(int _mode, const char* _str); virtual void setArchiveDir(int _mode, const char* _str);
virtual void OS_SetInputMotion(int _pointerID, const vec2& _pos); virtual void OS_SetInputMotion(int _pointerID, const vec2& _pos);
@ -156,28 +156,28 @@ namespace ewol
*/ */
virtual void OS_Suspend(void); virtual void OS_Suspend(void);
/** /**
* @brief The current context is Resumed * @brief The current context is resumed
*/ */
virtual void OS_Resume(void); virtual void OS_Resume(void);
//virtual void OS_SetClipBoard(ewol::clipBoard::clipboardListe_te _clipboardID); //virtual void OS_SetClipBoard(ewol::clipBoard::clipboardListe_te _clipboardID);
void RequestUpdateSize(void); void requestUpdateSize(void);
// return true if a flush is needed // return true if a flush is needed
bool OS_Draw(bool _displayEveryTime); bool OS_Draw(bool _displayEveryTime);
/** /**
* @brief Inform object that an other object is removed ... * @brief Inform object that an other object is removed ...
* @param[in] removeObject Pointer on the EObject removed ==> the user must remove all reference on this EObject * @param[in] removeObject Pointer on the EObject removed == > the user must remove all reference on this EObject
* @note : Sub classes must call this class * @note : Sub classes must call this class
*/ */
void OnObjectRemove(ewol::EObject * removeObject); void onObjectRemove(ewol::EObject * removeObject);
/** /**
* @brief reset event management for the IO like Input ou Mouse or keyborad * @brief reset event management for the IO like Input ou Mouse or keyborad
*/ */
void ResetIOEvent(void); void resetIOEvent(void);
/** /**
* @brief The OS inform that the OpenGL constext has been destroy ==> use to automaticly reload the texture and other thinks ... * @brief The OS inform that the openGL constext has been destroy == > use to automaticly reload the texture and other thinks ...
*/ */
void OS_OpenGlContextDestroy(void); void OS_OpenGlContextDestroy(void);
/** /**
@ -187,7 +187,7 @@ namespace ewol
/** /**
* @brief The application request that the Window will be killed * @brief The application request that the Window will be killed
*/ */
virtual void Stop(void) { }; virtual void stop(void) { };
private: private:
ewol::Windows* m_windowsCurrent; //!< curent displayed windows ewol::Windows* m_windowsCurrent; //!< curent displayed windows
public: public:
@ -195,20 +195,20 @@ namespace ewol
* @brief set the current windows to display : * @brief set the current windows to display :
* @param _windows Windows that might be displayed * @param _windows Windows that might be displayed
*/ */
void SetWindows(ewol::Windows* _windows); void setWindows(ewol::Windows* _windows);
/** /**
* @brief Get the current windows that is displayed * @brief get the current windows that is displayed
* @return the current handle on the windows (can be null) * @return the current handle on the windows (can be null)
*/ */
ewol::Windows* GetWindows(void) { return m_windowsCurrent; }; ewol::Windows* getWindows(void) { return m_windowsCurrent; };
private: private:
vec2 m_windowsSize; //!< current size of the system vec2 m_windowsSize; //!< current size of the system
public: public:
/** /**
* @brief Get the current windows size * @brief get the current windows size
* @return the current size ... * @return the current size ...
*/ */
const vec2& GetSize(void) { return m_windowsSize; }; const vec2& getSize(void) { return m_windowsSize; };
/** /**
* @brief The OS inform that the current windows has change his size. * @brief The OS inform that the current windows has change his size.
* @param[in] _size new size of the windows. * @param[in] _size new size of the windows.
@ -218,7 +218,7 @@ namespace ewol
* @brief The application request a change of his curent size. * @brief The application request a change of his curent size.
* @param[in] _size new Requested size of the windows. * @param[in] _size new Requested size of the windows.
*/ */
virtual void SetSize(const vec2& _size) { }; virtual void setSize(const vec2& _size) { };
/** /**
* @brief The OS inform that the current windows has change his position. * @brief The OS inform that the current windows has change his position.
* @param[in] _pos New position of the Windows. * @param[in] _pos New position of the Windows.
@ -228,7 +228,7 @@ namespace ewol
* @brief The Application request that the current windows will change his position. * @brief The Application request that the current windows will change his position.
* @param[in] _pos New position of the Windows requested. * @param[in] _pos New position of the Windows requested.
*/ */
virtual void SetPos(const vec2& _pos) { }; virtual void setPos(const vec2& _pos) { };
/** /**
* @brief The OS inform that the Windows is now Hidden. * @brief The OS inform that the Windows is now Hidden.
*/ */
@ -236,7 +236,7 @@ namespace ewol
/** /**
* @brief The Application request that the Windows will be Hidden. * @brief The Application request that the Windows will be Hidden.
*/ */
virtual void Hide(void) { }; virtual void hide(void) { };
/** /**
* @brief The OS inform that the Windows is now visible. * @brief The OS inform that the Windows is now visible.
*/ */
@ -244,11 +244,11 @@ namespace ewol
/** /**
* @brief The Application request that the Windows will be visible. * @brief The Application request that the Windows will be visible.
*/ */
virtual void Show(void) { }; virtual void show(void) { };
/** /**
* @brief Redraw all the windows * @brief Redraw all the windows
*/ */
void ForceRedrawAll(void); void forceRedrawAll(void);
// TODO : Later ... // TODO : Later ...
/** /**
@ -256,75 +256,75 @@ namespace ewol
* @param source the widget where the event came from * @param source the widget where the event came from
* @param destination the widget where the event mitgh be generated now * @param destination the widget where the event mitgh be generated now
*/ */
void InputEventTransfertWidget(ewol::Widget* _source, ewol::Widget* _destination); void inputEventTransfertWidget(ewol::Widget* _source, ewol::Widget* _destination);
/** /**
* @brief This fonction lock the pointer properties to move in relative instead of absolute * @brief This fonction lock the pointer properties to move in relative instead of absolute
* @param[in] widget The widget that lock the pointer events * @param[in] widget The widget that lock the pointer events
*/ */
void InputEventGrabPointer(ewol::Widget* _widget); void inputEventGrabPointer(ewol::Widget* _widget);
/** /**
* @brief This fonction un-lock the pointer properties to move in relative instead of absolute * @brief This fonction un-lock the pointer properties to move in relative instead of absolute
*/ */
void InputEventUnGrabPointer(void); void inputEventUnGrabPointer(void);
/** /**
* @brief Display the virtal keyboard (for touch system only) * @brief display the virtal keyboard (for touch system only)
*/ */
void KeyboardShow(void) {}; void keyboardShow(void) {};
/** /**
* @brief Hide the virtal keyboard (for touch system only) * @brief Hide the virtal keyboard (for touch system only)
*/ */
void KeyboardHide(void) {}; void keyboardHide(void) {};
/** /**
* @brief Inform the Gui that we want to have a copy of the clipboard * @brief Inform the Gui that we want to have a copy of the clipboard
* @param[in] _clipboardID ID of the clipboard (STD/SELECTION) only apear here * @param[in] _clipboardID ID of the clipboard (STD/SELECTION) only apear here
*/ */
virtual void ClipBoardGet(ewol::clipBoard::clipboardListe_te _clipboardID) { }; virtual void clipBoardGet(ewol::clipBoard::clipboardListe_te _clipboardID) { };
/** /**
* @brief Inform the Gui that we are the new owner of the clipboard * @brief Inform the Gui that we are the new owner of the clipboard
* @param[in] _clipboardID ID of the clipboard (STD/SELECTION) only apear here * @param[in] _clipboardID ID of the clipboard (STD/SELECTION) only apear here
*/ */
virtual void ClipBoardSet(ewol::clipBoard::clipboardListe_te _clipboardID) { }; virtual void clipBoardSet(ewol::clipBoard::clipboardListe_te _clipboardID) { };
/** /**
* @brief Call by the OS when a clipboard arrive to US (previously requested by a widget) * @brief Call by the OS when a clipboard arrive to US (previously requested by a widget)
* @param[in] Id of the clipboard * @param[in] Id of the clipboard
*/ */
void OS_ClipBoardArrive(ewol::clipBoard::clipboardListe_te _clipboardID); void OS_ClipBoardArrive(ewol::clipBoard::clipboardListe_te _clipboardID);
/** /**
* @brief Set the new title of the windows * @brief set the new title of the windows
* @param[in] title New desired title * @param[in] title New desired title
*/ */
virtual void SetTitle(const etk::UString& _title) { }; virtual void setTitle(const etk::UString& _title) { };
/** /**
* @brief Force the screen orientation (availlable on portable elements ... * @brief force the screen orientation (availlable on portable elements ...
* @param[in] _orientation Selected orientation. * @param[in] _orientation Selected orientation.
*/ */
virtual void ForceOrientation(ewol::orientation_te _orientation) { }; virtual void forceOrientation(ewol::orientation_te _orientation) { };
/** /**
* @brief Get all the event from the X system * @brief get all the event from the X system
* @param[in] _isGrabbed "true" if all the event will be get, false if we want only ours. * @param[in] _isGrabbed "true" if all the event will be get, false if we want only ours.
* @param[in] _forcedPosition the position where the mouse might be reset at every events ... * @param[in] _forcedPosition the position where the mouse might be reset at every events ...
*/ */
virtual void GrabPointerEvents(bool _isGrabbed, const vec2& _forcedPosition) { }; virtual void grabPointerEvents(bool _isGrabbed, const vec2& _forcedPosition) { };
/** /**
* @brief Set the cursor display type. * @brief set the cursor display type.
* @param[in] _newCursor selected new cursor. * @param[in] _newCursor selected new cursor.
*/ */
virtual void SetCursor(ewol::cursorDisplay_te _newCursor) { }; virtual void setCursor(ewol::cursorDisplay_te _newCursor) { };
/** /**
* @brief Set the Icon of the program * @brief set the Icon of the program
* @param[in] _inputFile new filename icon of the curent program. * @param[in] _inputFile new filename icon of the curent program.
*/ */
virtual void SetIcon(const etk::UString& _inputFile) { }; virtual void setIcon(const etk::UString& _inputFile) { };
/** /**
* @brief Get the curent time in micro-second * @brief get the curent time in micro-second
* @note : must be implemented in all system OS implementation * @note : must be implemented in all system OS implementation
* @return The curent time of the process * @return The curent time of the process
*/ */
static int64_t GetTime(void); static int64_t getTime(void);
private: private:
// TODO : Set user argument here .... // TODO : set user argument here ....
public: public:
/** /**
@ -345,7 +345,7 @@ namespace ewol
* @brief From everyware in the program, we can get the context inteface. * @brief From everyware in the program, we can get the context inteface.
* @return current reference on the instance. * @return current reference on the instance.
*/ */
eContext& GetContext(void); eContext& getContext(void);
}; };
//!< must be define in CPP by the application ... this are the main init and unInit of the Application //!< must be define in CPP by the application ... this are the main init and unInit of the Application

View File

@ -28,7 +28,7 @@
#define EVENT_DEBUG EWOL_VERBOSE #define EVENT_DEBUG EWOL_VERBOSE
//#define EVENT_DEBUG EWOL_DEBUG //#define EVENT_DEBUG EWOL_DEBUG
void ewol::eInput::CalculateLimit(void) void ewol::eInput::calculateLimit(void)
{ {
m_eventInputLimit.sepatateTime = 300000; // µs m_eventInputLimit.sepatateTime = 300000; // µs
m_eventInputLimit.DpiOffset = m_dpi*100; m_eventInputLimit.DpiOffset = m_dpi*100;
@ -36,11 +36,11 @@ void ewol::eInput::CalculateLimit(void)
m_eventMouseLimit.DpiOffset = (float)m_dpi*(float)0.1; m_eventMouseLimit.DpiOffset = (float)m_dpi*(float)0.1;
} }
void ewol::eInput::SetDpi(int32_t newDPI) void ewol::eInput::setDpi(int32_t newDPI)
{ {
m_dpi = newDPI; m_dpi = newDPI;
// recalculate the DPI system ... // recalculate the DPI system ...
CalculateLimit(); calculateLimit();
} }
bool ewol::eInput::localEventInput(ewol::keyEvent::type_te _type, bool ewol::eInput::localEventInput(ewol::keyEvent::type_te _type,
@ -54,7 +54,7 @@ bool ewol::eInput::localEventInput(ewol::keyEvent::type_te _type,
// create the system Event : // create the system Event :
ewol::EventInputSystem tmpEventSystem(_type, _status, _IdInput, _pos, _destWidget, 0); // TODO : set the real ID ... ewol::EventInputSystem tmpEventSystem(_type, _status, _IdInput, _pos, _destWidget, 0); // TODO : set the real ID ...
// generate the event : // generate the event :
return _destWidget->SystemEventInput(tmpEventSystem); return _destWidget->systemEventInput(tmpEventSystem);
} else { } else {
return false; return false;
} }
@ -62,12 +62,12 @@ bool ewol::eInput::localEventInput(ewol::keyEvent::type_te _type,
return false; return false;
} }
void ewol::eInput::AbortElement(InputPoperty_ts *_eventTable, int32_t _idInput, ewol::keyEvent::type_te _type) void ewol::eInput::abortElement(InputPoperty_ts *_eventTable, int32_t _idInput, ewol::keyEvent::type_te _type)
{ {
if (NULL==_eventTable) { if (NULL == _eventTable) {
return; return;
} }
if (_eventTable[_idInput].isUsed==true) { if (_eventTable[_idInput].isUsed == true) {
localEventInput(_type, localEventInput(_type,
_eventTable[_idInput].curentWidgetEvent, _eventTable[_idInput].curentWidgetEvent,
_eventTable[_idInput].destinationInputId, _eventTable[_idInput].destinationInputId,
@ -76,9 +76,9 @@ void ewol::eInput::AbortElement(InputPoperty_ts *_eventTable, int32_t _idInput,
} }
} }
void ewol::eInput::CleanElement(InputPoperty_ts *_eventTable, int32_t _idInput) void ewol::eInput::cleanElement(InputPoperty_ts *_eventTable, int32_t _idInput)
{ {
if (NULL==_eventTable) { if (NULL == _eventTable) {
return; return;
} }
//EWOL_INFO("CleanElement[" << idInput << "] = @" << (int64_t)eventTable); //EWOL_INFO("CleanElement[" << idInput << "] = @" << (int64_t)eventTable);
@ -97,7 +97,7 @@ void ewol::eInput::CleanElement(InputPoperty_ts *_eventTable, int32_t _idInput)
void ewol::eInput::TransfertEvent(ewol::Widget* source, ewol::Widget* destination) void ewol::eInput::transfertEvent(ewol::Widget* source, ewol::Widget* destination)
{ {
if( NULL == source if( NULL == source
|| NULL == destination) { || NULL == destination) {
@ -107,64 +107,64 @@ void ewol::eInput::TransfertEvent(ewol::Widget* source, ewol::Widget* destinatio
for(int32_t iii=0; iii<MAX_MANAGE_INPUT; iii++) { for(int32_t iii=0; iii<MAX_MANAGE_INPUT; iii++) {
if (m_eventInputSaved[iii].curentWidgetEvent == source) { if (m_eventInputSaved[iii].curentWidgetEvent == source) {
// inform the widget that it does not receive the event now // inform the widget that it does not receive the event now
EVENT_DEBUG("GUI : Input ID=" << iii << "==>" << m_eventInputSaved[iii].destinationInputId << " [EVENT_INPUT_TYPE_ABORT] " << m_eventInputSaved[iii].posEvent); EVENT_DEBUG("GUI : Input ID=" << iii << " == >" << m_eventInputSaved[iii].destinationInputId << " [EVENT_INPUT_TYPE_ABORT] " << m_eventInputSaved[iii].posEvent);
localEventInput(ewol::keyEvent::typeFinger, m_eventInputSaved[iii].curentWidgetEvent, m_eventInputSaved[iii].destinationInputId, ewol::keyEvent::statusAbort, m_eventInputSaved[iii].posEvent); localEventInput(ewol::keyEvent::typeFinger, m_eventInputSaved[iii].curentWidgetEvent, m_eventInputSaved[iii].destinationInputId, ewol::keyEvent::statusAbort, m_eventInputSaved[iii].posEvent);
// set the new widget ... // set the new widget ...
m_eventInputSaved[iii].curentWidgetEvent = destination; m_eventInputSaved[iii].curentWidgetEvent = destination;
// inform the widget that he receive the event property now... // inform the widget that he receive the event property now...
EVENT_DEBUG("GUI : Input ID=" << iii << "==>" << m_eventInputSaved[iii].destinationInputId << " [EVENT_INPUT_TYPE_TRANSFERT] " << m_eventInputSaved[iii].posEvent); EVENT_DEBUG("GUI : Input ID=" << iii << " == >" << m_eventInputSaved[iii].destinationInputId << " [EVENT_INPUT_TYPE_TRANSFERT] " << m_eventInputSaved[iii].posEvent);
localEventInput(ewol::keyEvent::typeFinger, m_eventInputSaved[iii].curentWidgetEvent, m_eventInputSaved[iii].destinationInputId, ewol::keyEvent::statusTransfert, m_eventInputSaved[iii].posEvent); localEventInput(ewol::keyEvent::typeFinger, m_eventInputSaved[iii].curentWidgetEvent, m_eventInputSaved[iii].destinationInputId, ewol::keyEvent::statusTransfert, m_eventInputSaved[iii].posEvent);
} }
if (m_eventMouseSaved[iii].curentWidgetEvent == source) { if (m_eventMouseSaved[iii].curentWidgetEvent == source) {
// inform the widget that it does not receive the event now // inform the widget that it does not receive the event now
EVENT_DEBUG("GUI : Input ID=" << iii << "==>" << m_eventMouseSaved[iii].destinationInputId << " [EVENT_INPUT_TYPE_ABORT] " << m_eventMouseSaved[iii].posEvent); EVENT_DEBUG("GUI : Input ID=" << iii << " == >" << m_eventMouseSaved[iii].destinationInputId << " [EVENT_INPUT_TYPE_ABORT] " << m_eventMouseSaved[iii].posEvent);
localEventInput(ewol::keyEvent::typeMouse, m_eventMouseSaved[iii].curentWidgetEvent, m_eventMouseSaved[iii].destinationInputId, ewol::keyEvent::statusAbort, m_eventMouseSaved[iii].posEvent); localEventInput(ewol::keyEvent::typeMouse, m_eventMouseSaved[iii].curentWidgetEvent, m_eventMouseSaved[iii].destinationInputId, ewol::keyEvent::statusAbort, m_eventMouseSaved[iii].posEvent);
// set the new widget ... // set the new widget ...
m_eventMouseSaved[iii].curentWidgetEvent = destination; m_eventMouseSaved[iii].curentWidgetEvent = destination;
// inform the widget that he receive the event property now... // inform the widget that he receive the event property now...
EVENT_DEBUG("GUI : Input ID=" << iii << "==>" << m_eventMouseSaved[iii].destinationInputId << " [EVENT_INPUT_TYPE_TRANSFERT] " << m_eventMouseSaved[iii].posEvent); EVENT_DEBUG("GUI : Input ID=" << iii << " == >" << m_eventMouseSaved[iii].destinationInputId << " [EVENT_INPUT_TYPE_TRANSFERT] " << m_eventMouseSaved[iii].posEvent);
localEventInput(ewol::keyEvent::typeMouse, m_eventMouseSaved[iii].curentWidgetEvent, m_eventMouseSaved[iii].destinationInputId, ewol::keyEvent::statusTransfert, m_eventMouseSaved[iii].posEvent); localEventInput(ewol::keyEvent::typeMouse, m_eventMouseSaved[iii].curentWidgetEvent, m_eventMouseSaved[iii].destinationInputId, ewol::keyEvent::statusTransfert, m_eventMouseSaved[iii].posEvent);
} }
} }
} }
void ewol::eInput::GrabPointer(ewol::Widget* widget) void ewol::eInput::grabPointer(ewol::Widget* widget)
{ {
if(NULL==widget) { if(NULL == widget) {
return; return;
} }
m_grabWidget = widget; m_grabWidget = widget;
m_context.GrabPointerEvents(true, widget->GetOrigin() + ivec2(widget->GetSize().x()/2.0f, widget->GetSize().y()/2.0f) ); m_context.grabPointerEvents(true, widget->getOrigin() + ivec2(widget->getSize().x()/2.0f, widget->getSize().y()/2.0f) );
} }
void ewol::eInput::UnGrabPointer(void) void ewol::eInput::unGrabPointer(void)
{ {
m_grabWidget = NULL; m_grabWidget = NULL;
m_context.GrabPointerEvents(false, vec2(0,0)); m_context.grabPointerEvents(false, vec2(0,0));
} }
void ewol::eInput::OnObjectRemove(ewol::EObject * removeObject) void ewol::eInput::onObjectRemove(ewol::EObject * removeObject)
{ {
for(int32_t iii=0; iii<MAX_MANAGE_INPUT; iii++) { for(int32_t iii=0; iii<MAX_MANAGE_INPUT; iii++) {
if (m_eventInputSaved[iii].curentWidgetEvent == removeObject) { if (m_eventInputSaved[iii].curentWidgetEvent == removeObject) {
// remove the property of this input ... // remove the property of this input ...
CleanElement(m_eventInputSaved, iii); cleanElement(m_eventInputSaved, iii);
} }
if (m_eventMouseSaved[iii].curentWidgetEvent == removeObject) { if (m_eventMouseSaved[iii].curentWidgetEvent == removeObject) {
// remove the property of this input ... // remove the property of this input ...
CleanElement(m_eventMouseSaved, iii); cleanElement(m_eventMouseSaved, iii);
} }
} }
} }
void ewol::eInput::NewLayerSet(void) void ewol::eInput::newLayerSet(void)
{ {
for(int32_t iii=0; iii<MAX_MANAGE_INPUT; iii++) { for(int32_t iii=0; iii<MAX_MANAGE_INPUT; iii++) {
// remove the property of this input ... // remove the property of this input ...
AbortElement(m_eventInputSaved, iii, ewol::keyEvent::typeFinger); abortElement(m_eventInputSaved, iii, ewol::keyEvent::typeFinger);
CleanElement(m_eventInputSaved, iii); cleanElement(m_eventInputSaved, iii);
AbortElement(m_eventMouseSaved, iii, ewol::keyEvent::typeMouse); abortElement(m_eventMouseSaved, iii, ewol::keyEvent::typeMouse);
CleanElement(m_eventMouseSaved, iii); cleanElement(m_eventMouseSaved, iii);
} }
} }
@ -172,12 +172,12 @@ ewol::eInput::eInput(ewol::eContext& _context) :
m_grabWidget(NULL), m_grabWidget(NULL),
m_context(_context) m_context(_context)
{ {
SetDpi(200); setDpi(200);
EWOL_INFO("Init (start)"); EWOL_INFO("Init (start)");
for(int32_t iii=0; iii<MAX_MANAGE_INPUT; iii++) { for(int32_t iii=0; iii<MAX_MANAGE_INPUT; iii++) {
// remove the property of this input ... // remove the property of this input ...
CleanElement(m_eventInputSaved, iii); cleanElement(m_eventInputSaved, iii);
CleanElement(m_eventMouseSaved, iii); cleanElement(m_eventMouseSaved, iii);
} }
EWOL_INFO("Init (end)"); EWOL_INFO("Init (end)");
} }
@ -194,7 +194,7 @@ int32_t ewol::eInput::localGetDestinationId(ewol::keyEvent::type_te _type, ewol:
if (_type == ewol::keyEvent::typeFinger) { if (_type == ewol::keyEvent::typeFinger) {
int32_t lastMinimum = 0; int32_t lastMinimum = 0;
for(int32_t iii=0; iii<MAX_MANAGE_INPUT; iii++) { for(int32_t iii=0; iii<MAX_MANAGE_INPUT; iii++) {
if (true==m_eventInputSaved[iii].isUsed) { if (true == m_eventInputSaved[iii].isUsed) {
if (m_eventInputSaved[iii].curentWidgetEvent == _destWidget) { if (m_eventInputSaved[iii].curentWidgetEvent == _destWidget) {
if (iii != _realInputId) { if (iii != _realInputId) {
lastMinimum = etk_max(lastMinimum, m_eventInputSaved[iii].destinationInputId); lastMinimum = etk_max(lastMinimum, m_eventInputSaved[iii].destinationInputId);
@ -207,12 +207,12 @@ int32_t ewol::eInput::localGetDestinationId(ewol::keyEvent::type_te _type, ewol:
return _realInputId; return _realInputId;
} }
// note if id<0 ==> the it was finger event ... // note if id<0 == > the it was finger event ...
void ewol::eInput::Motion(ewol::keyEvent::type_te type, int pointerID, vec2 pos) void ewol::eInput::motion(ewol::keyEvent::type_te type, int pointerID, vec2 pos)
{ {
EVENT_DEBUG("motion event : " << type << " " << pointerID << " " << pos); EVENT_DEBUG("motion event : " << type << " " << pointerID << " " << pos);
if (MAX_MANAGE_INPUT<=pointerID) { if (MAX_MANAGE_INPUT <= pointerID) {
// reject pointer ==> out of IDs... // reject pointer == > out of IDs...
return; return;
} }
InputPoperty_ts *eventTable = NULL; InputPoperty_ts *eventTable = NULL;
@ -229,7 +229,7 @@ void ewol::eInput::Motion(ewol::keyEvent::type_te type, int pointerID, vec2 pos)
// not manage input // not manage input
return; return;
} }
ewol::Windows* tmpWindows = m_context.GetWindows(); ewol::Windows* tmpWindows = m_context.getWindows();
// special case for the mouse event 0 that represent the hover event of the system : // special case for the mouse event 0 that represent the hover event of the system :
if (type == ewol::keyEvent::typeMouse && pointerID == 0) { if (type == ewol::keyEvent::typeMouse && pointerID == 0) {
// this event is all time on the good widget ... and manage the enter and leave ... // this event is all time on the good widget ... and manage the enter and leave ...
@ -240,7 +240,7 @@ void ewol::eInput::Motion(ewol::keyEvent::type_te type, int pointerID, vec2 pos)
tmpWidget = m_grabWidget; tmpWidget = m_grabWidget;
} else { } else {
if (NULL != tmpWindows) { if (NULL != tmpWindows) {
tmpWidget = tmpWindows->GetWidgetAtPos(pos); tmpWidget = tmpWindows->getWidgetAtPos(pos);
} }
} }
if( tmpWidget != eventTable[pointerID].curentWidgetEvent if( tmpWidget != eventTable[pointerID].curentWidgetEvent
@ -250,12 +250,12 @@ void ewol::eInput::Motion(ewol::keyEvent::type_te type, int pointerID, vec2 pos)
|| (eventTable[pointerID].origin.x() + eventTable[pointerID].size.x()) < pos.x() || (eventTable[pointerID].origin.x() + eventTable[pointerID].size.x()) < pos.x()
|| (eventTable[pointerID].origin.y() + eventTable[pointerID].size.y()) < pos.y()) ) ) { || (eventTable[pointerID].origin.y() + eventTable[pointerID].size.y()) < pos.y()) ) ) {
eventTable[pointerID].isInside = false; eventTable[pointerID].isInside = false;
EVENT_DEBUG("GUI : Input ID=" << pointerID << "==>" << eventTable[pointerID].destinationInputId << " [LEAVE] " << pos); EVENT_DEBUG("GUI : Input ID=" << pointerID << " == >" << eventTable[pointerID].destinationInputId << " [LEAVE] " << pos);
eventTable[pointerID].posEvent = pos; eventTable[pointerID].posEvent = pos;
localEventInput(type, eventTable[pointerID].curentWidgetEvent, eventTable[pointerID].destinationInputId, ewol::keyEvent::statusLeave, pos); localEventInput(type, eventTable[pointerID].curentWidgetEvent, eventTable[pointerID].destinationInputId, ewol::keyEvent::statusLeave, pos);
} }
if (false == eventTable[pointerID].isInside) { if (false == eventTable[pointerID].isInside) {
// Set the element inside ... // set the element inside ...
eventTable[pointerID].isInside = true; eventTable[pointerID].isInside = true;
// get destination widget : // get destination widget :
eventTable[pointerID].curentWidgetEvent = tmpWidget; eventTable[pointerID].curentWidgetEvent = tmpWidget;
@ -263,15 +263,15 @@ void ewol::eInput::Motion(ewol::keyEvent::type_te type, int pointerID, vec2 pos)
eventTable[pointerID].isInside = false; eventTable[pointerID].isInside = false;
} }
if (NULL != eventTable[pointerID].curentWidgetEvent) { if (NULL != eventTable[pointerID].curentWidgetEvent) {
eventTable[pointerID].origin = eventTable[pointerID].curentWidgetEvent->GetOrigin(); eventTable[pointerID].origin = eventTable[pointerID].curentWidgetEvent->getOrigin();
eventTable[pointerID].size = eventTable[pointerID].curentWidgetEvent->GetSize(); eventTable[pointerID].size = eventTable[pointerID].curentWidgetEvent->getSize();
} }
eventTable[pointerID].destinationInputId = 0; eventTable[pointerID].destinationInputId = 0;
EVENT_DEBUG("GUI : Input ID=" << pointerID << "==>" << eventTable[pointerID].destinationInputId << " [ENTER] " << pos); EVENT_DEBUG("GUI : Input ID=" << pointerID << " == >" << eventTable[pointerID].destinationInputId << " [ENTER] " << pos);
eventTable[pointerID].posEvent = pos; eventTable[pointerID].posEvent = pos;
localEventInput(type, eventTable[pointerID].curentWidgetEvent, eventTable[pointerID].destinationInputId, ewol::keyEvent::statusEnter, pos); localEventInput(type, eventTable[pointerID].curentWidgetEvent, eventTable[pointerID].destinationInputId, ewol::keyEvent::statusEnter, pos);
} }
EVENT_DEBUG("GUI : Input ID=" << pointerID << "==>" << eventTable[pointerID].destinationInputId << " [MOVE] " << pos); EVENT_DEBUG("GUI : Input ID=" << pointerID << " == >" << eventTable[pointerID].destinationInputId << " [MOVE] " << pos);
eventTable[pointerID].posEvent = pos; eventTable[pointerID].posEvent = pos;
localEventInput(type, eventTable[pointerID].curentWidgetEvent, eventTable[pointerID].destinationInputId, ewol::keyEvent::statusMove, pos); localEventInput(type, eventTable[pointerID].curentWidgetEvent, eventTable[pointerID].destinationInputId, ewol::keyEvent::statusMove, pos);
} else if (true == eventTable[pointerID].isUsed) { } else if (true == eventTable[pointerID].isUsed) {
@ -281,7 +281,7 @@ void ewol::eInput::Motion(ewol::keyEvent::type_te type, int pointerID, vec2 pos)
|| (eventTable[pointerID].origin.x() + eventTable[pointerID].size.x()) < pos.x() || (eventTable[pointerID].origin.x() + eventTable[pointerID].size.x()) < pos.x()
|| (eventTable[pointerID].origin.y() + eventTable[pointerID].size.y()) < pos.y()) { || (eventTable[pointerID].origin.y() + eventTable[pointerID].size.y()) < pos.y()) {
eventTable[pointerID].isInside = false; eventTable[pointerID].isInside = false;
EVENT_DEBUG("GUI : Input ID=" << pointerID << "==>" << eventTable[pointerID].destinationInputId << " [LEAVE] " << pos); EVENT_DEBUG("GUI : Input ID=" << pointerID << " == >" << eventTable[pointerID].destinationInputId << " [LEAVE] " << pos);
eventTable[pointerID].posEvent = pos; eventTable[pointerID].posEvent = pos;
localEventInput(type, eventTable[pointerID].curentWidgetEvent, eventTable[pointerID].destinationInputId, ewol::keyEvent::statusLeave, pos); localEventInput(type, eventTable[pointerID].curentWidgetEvent, eventTable[pointerID].destinationInputId, ewol::keyEvent::statusLeave, pos);
} }
@ -291,25 +291,25 @@ void ewol::eInput::Motion(ewol::keyEvent::type_te type, int pointerID, vec2 pos)
&& ( eventTable[pointerID].origin.y() <= pos.y() && ( eventTable[pointerID].origin.y() <= pos.y()
&& (eventTable[pointerID].origin.y() + eventTable[pointerID].size.y()) >= pos.y() ) ) { && (eventTable[pointerID].origin.y() + eventTable[pointerID].size.y()) >= pos.y() ) ) {
eventTable[pointerID].isInside = true; eventTable[pointerID].isInside = true;
EVENT_DEBUG("GUI : Input ID=" << pointerID << "==>" << eventTable[pointerID].destinationInputId << " [ENTER] " << pos); EVENT_DEBUG("GUI : Input ID=" << pointerID << " == >" << eventTable[pointerID].destinationInputId << " [ENTER] " << pos);
eventTable[pointerID].posEvent = pos; eventTable[pointerID].posEvent = pos;
localEventInput(type, eventTable[pointerID].curentWidgetEvent, eventTable[pointerID].destinationInputId, ewol::keyEvent::statusEnter, pos); localEventInput(type, eventTable[pointerID].curentWidgetEvent, eventTable[pointerID].destinationInputId, ewol::keyEvent::statusEnter, pos);
} }
} }
EVENT_DEBUG("GUI : Input ID=" << pointerID << "==>" << eventTable[pointerID].destinationInputId << " [MOVE] " << pos); EVENT_DEBUG("GUI : Input ID=" << pointerID << " == >" << eventTable[pointerID].destinationInputId << " [MOVE] " << pos);
eventTable[pointerID].posEvent = pos; eventTable[pointerID].posEvent = pos;
localEventInput(type, eventTable[pointerID].curentWidgetEvent, eventTable[pointerID].destinationInputId, ewol::keyEvent::statusMove, pos); localEventInput(type, eventTable[pointerID].curentWidgetEvent, eventTable[pointerID].destinationInputId, ewol::keyEvent::statusMove, pos);
} }
} }
void ewol::eInput::State(ewol::keyEvent::type_te type, int pointerID, bool isDown, vec2 pos) void ewol::eInput::state(ewol::keyEvent::type_te type, int pointerID, bool isDown, vec2 pos)
{ {
if (MAX_MANAGE_INPUT<=pointerID) { if (MAX_MANAGE_INPUT <= pointerID) {
// reject pointer ==> out of IDs... // reject pointer == > out of IDs...
return; return;
} }
EWOL_DEBUG("event pointerId=" << pointerID); EWOL_DEBUG("event pointerId=" << pointerID);
// convert position in Open-GL coordonates ... // convert position in open-GL coordonates ...
InputPoperty_ts *eventTable = NULL; InputPoperty_ts *eventTable = NULL;
inputLimit_ts localLimit; inputLimit_ts localLimit;
if (type == ewol::keyEvent::typeMouse) { if (type == ewol::keyEvent::typeMouse) {
@ -328,25 +328,25 @@ void ewol::eInput::State(ewol::keyEvent::type_te type, int pointerID, bool isDow
return; return;
} }
// get the curent time ... // get the curent time ...
int64_t currentTime = ewol::GetTime(); int64_t currentTime = ewol::getTime();
ewol::Windows* tmpWindows = m_context.GetWindows(); ewol::Windows* tmpWindows = m_context.getWindows();
if (true == isDown) { if (true == isDown) {
EWOL_VERBOSE("GUI : Input ID=" << pointerID << "==>" << eventTable[pointerID].destinationInputId << " [DOWN] " << pos); EWOL_VERBOSE("GUI : Input ID=" << pointerID << " == >" << eventTable[pointerID].destinationInputId << " [DOWN] " << pos);
if(true == eventTable[pointerID].isUsed) { if(true == eventTable[pointerID].isUsed) {
// we have an event previously ... check delay between click and offset position // we have an event previously ... check delay between click and offset position
if (currentTime - eventTable[pointerID].lastTimeEvent > localLimit.sepatateTime) { if (currentTime - eventTable[pointerID].lastTimeEvent > localLimit.sepatateTime) {
CleanElement(eventTable, pointerID); cleanElement(eventTable, pointerID);
} else if( abs(eventTable[pointerID].downStart.x() - pos.x()) >= localLimit.DpiOffset } else if( abs(eventTable[pointerID].downStart.x() - pos.x()) >= localLimit.DpiOffset
|| abs(eventTable[pointerID].downStart.y() - pos.y()) >= localLimit.DpiOffset ){ || abs(eventTable[pointerID].downStart.y() - pos.y()) >= localLimit.DpiOffset ){
CleanElement(eventTable, pointerID); cleanElement(eventTable, pointerID);
} }
} }
if(true == eventTable[pointerID].isUsed) { if(true == eventTable[pointerID].isUsed) {
// save start time // save start time
eventTable[pointerID].lastTimeEvent = currentTime; eventTable[pointerID].lastTimeEvent = currentTime;
// generate DOWN Event // generate DOWN Event
EVENT_DEBUG("GUI : Input ID=" << pointerID << "==>" << eventTable[pointerID].destinationInputId << " [DOWN] " << pos); EVENT_DEBUG("GUI : Input ID=" << pointerID << " == >" << eventTable[pointerID].destinationInputId << " [DOWN] " << pos);
eventTable[pointerID].posEvent = pos; eventTable[pointerID].posEvent = pos;
localEventInput(type, eventTable[pointerID].curentWidgetEvent, eventTable[pointerID].destinationInputId, ewol::keyEvent::statusDown, pos); localEventInput(type, eventTable[pointerID].curentWidgetEvent, eventTable[pointerID].destinationInputId, ewol::keyEvent::statusDown, pos);
} else { } else {
@ -356,32 +356,32 @@ void ewol::eInput::State(ewol::keyEvent::type_te type, int pointerID, bool isDow
eventTable[pointerID].downStart = pos; eventTable[pointerID].downStart = pos;
// save start time // save start time
eventTable[pointerID].lastTimeEvent = currentTime; eventTable[pointerID].lastTimeEvent = currentTime;
// Set the element inside ... // set the element inside ...
eventTable[pointerID].isInside = true; eventTable[pointerID].isInside = true;
// get destination widget : // get destination widget :
if(NULL != tmpWindows) { if(NULL != tmpWindows) {
if (m_grabWidget != NULL && type == ewol::keyEvent::typeMouse) { if (m_grabWidget != NULL && type == ewol::keyEvent::typeMouse) {
eventTable[pointerID].curentWidgetEvent = m_grabWidget; eventTable[pointerID].curentWidgetEvent = m_grabWidget;
} else { } else {
eventTable[pointerID].curentWidgetEvent = tmpWindows->GetWidgetAtPos(pos); eventTable[pointerID].curentWidgetEvent = tmpWindows->getWidgetAtPos(pos);
} }
} else { } else {
eventTable[pointerID].curentWidgetEvent = NULL; eventTable[pointerID].curentWidgetEvent = NULL;
} }
if (NULL != eventTable[pointerID].curentWidgetEvent) { if (NULL != eventTable[pointerID].curentWidgetEvent) {
eventTable[pointerID].origin = eventTable[pointerID].curentWidgetEvent->GetOrigin(); eventTable[pointerID].origin = eventTable[pointerID].curentWidgetEvent->getOrigin();
eventTable[pointerID].size = eventTable[pointerID].curentWidgetEvent->GetSize(); eventTable[pointerID].size = eventTable[pointerID].curentWidgetEvent->getSize();
eventTable[pointerID].destinationInputId = localGetDestinationId(type, eventTable[pointerID].curentWidgetEvent, pointerID); eventTable[pointerID].destinationInputId = localGetDestinationId(type, eventTable[pointerID].curentWidgetEvent, pointerID);
} else { } else {
eventTable[pointerID].destinationInputId = -1; eventTable[pointerID].destinationInputId = -1;
} }
// generate DOWN Event // generate DOWN Event
EVENT_DEBUG("GUI : Input ID=" << pointerID << "==>" << eventTable[pointerID].destinationInputId << " [DOWN] " << pos); EVENT_DEBUG("GUI : Input ID=" << pointerID << " == >" << eventTable[pointerID].destinationInputId << " [DOWN] " << pos);
eventTable[pointerID].posEvent = pos; eventTable[pointerID].posEvent = pos;
localEventInput(type, eventTable[pointerID].curentWidgetEvent, eventTable[pointerID].destinationInputId, ewol::keyEvent::statusDown, pos); localEventInput(type, eventTable[pointerID].curentWidgetEvent, eventTable[pointerID].destinationInputId, ewol::keyEvent::statusDown, pos);
} }
} else { } else {
EWOL_VERBOSE("GUI : Input ID=" << pointerID << "==>" << eventTable[pointerID].destinationInputId << " [UP] " << pos); EWOL_VERBOSE("GUI : Input ID=" << pointerID << " == >" << eventTable[pointerID].destinationInputId << " [UP] " << pos);
if(false == eventTable[pointerID].isUsed) { if(false == eventTable[pointerID].isUsed) {
// bad case ... ??? // bad case ... ???
EWOL_DEBUG("Up event without previous down ... "); EWOL_DEBUG("Up event without previous down ... ");
@ -391,7 +391,7 @@ void ewol::eInput::State(ewol::keyEvent::type_te type, int pointerID, bool isDow
eventTable[pointerID].curentWidgetEvent = NULL; eventTable[pointerID].curentWidgetEvent = NULL;
} else { } else {
// generate UP Event // generate UP Event
EVENT_DEBUG("GUI : Input ID=" << pointerID << "==>" << eventTable[pointerID].destinationInputId << " [UP] " << pos); EVENT_DEBUG("GUI : Input ID=" << pointerID << " == >" << eventTable[pointerID].destinationInputId << " [UP] " << pos);
eventTable[pointerID].posEvent = pos; eventTable[pointerID].posEvent = pos;
localEventInput(type, eventTable[pointerID].curentWidgetEvent, pointerID, ewol::keyEvent::statusUp, pos); localEventInput(type, eventTable[pointerID].curentWidgetEvent, pointerID, ewol::keyEvent::statusUp, pos);
// generate event (single) // generate event (single)
@ -403,7 +403,7 @@ void ewol::eInput::State(ewol::keyEvent::type_te type, int pointerID, bool isDow
eventTable[pointerID].lastTimeEvent = currentTime; eventTable[pointerID].lastTimeEvent = currentTime;
int32_t nbClickMax = 0; int32_t nbClickMax = 0;
if(eventTable[pointerID].curentWidgetEvent != NULL) { if(eventTable[pointerID].curentWidgetEvent != NULL) {
nbClickMax = eventTable[pointerID].curentWidgetEvent->GetMouseLimit(); nbClickMax = eventTable[pointerID].curentWidgetEvent->getMouseLimit();
if (nbClickMax>5) { if (nbClickMax>5) {
nbClickMax = 5; nbClickMax = 5;
} }
@ -414,7 +414,7 @@ void ewol::eInput::State(ewol::keyEvent::type_te type, int pointerID, bool isDow
&& eventTable[pointerID].nbClickEvent < nbClickMax) { && eventTable[pointerID].nbClickEvent < nbClickMax) {
// generate event SINGLE : // generate event SINGLE :
eventTable[pointerID].nbClickEvent++; eventTable[pointerID].nbClickEvent++;
EVENT_DEBUG("GUI : Input ID=" << pointerID << "==>" << eventTable[pointerID].destinationInputId << " [" << eventTable[pointerID].nbClickEvent << "] " << pos); EVENT_DEBUG("GUI : Input ID=" << pointerID << " == >" << eventTable[pointerID].destinationInputId << " [" << eventTable[pointerID].nbClickEvent << "] " << pos);
eventTable[pointerID].posEvent = pos; eventTable[pointerID].posEvent = pos;
localEventInput(type, localEventInput(type,
eventTable[pointerID].curentWidgetEvent, eventTable[pointerID].curentWidgetEvent,
@ -430,7 +430,7 @@ void ewol::eInput::State(ewol::keyEvent::type_te type, int pointerID, bool isDow
} }
// specific for tuch event // specific for tuch event
if (type == ewol::keyEvent::typeFinger) { if (type == ewol::keyEvent::typeFinger) {
CleanElement(eventTable, pointerID); cleanElement(eventTable, pointerID);
} }
} }
} }

View File

@ -45,11 +45,11 @@ namespace ewol
int32_t m_dpi; int32_t m_dpi;
inputLimit_ts m_eventInputLimit; inputLimit_ts m_eventInputLimit;
inputLimit_ts m_eventMouseLimit; inputLimit_ts m_eventMouseLimit;
void CalculateLimit(void); void calculateLimit(void);
InputPoperty_ts m_eventInputSaved[MAX_MANAGE_INPUT]; InputPoperty_ts m_eventInputSaved[MAX_MANAGE_INPUT];
InputPoperty_ts m_eventMouseSaved[MAX_MANAGE_INPUT]; InputPoperty_ts m_eventMouseSaved[MAX_MANAGE_INPUT];
void AbortElement(InputPoperty_ts *eventTable, int32_t idInput, ewol::keyEvent::type_te _type); void abortElement(InputPoperty_ts *eventTable, int32_t idInput, ewol::keyEvent::type_te _type);
void CleanElement(InputPoperty_ts *eventTable, int32_t idInput); void cleanElement(InputPoperty_ts *eventTable, int32_t idInput);
/** /**
* @brief generate the event on the destinated widget. * @brief generate the event on the destinated widget.
* @param[in] type Type of the event that might be sended. * @param[in] type Type of the event that might be sended.
@ -65,11 +65,11 @@ namespace ewol
ewol::keyEvent::status_te typeEvent, ewol::keyEvent::status_te typeEvent,
vec2 pos); vec2 pos);
/** /**
* @brief Convert the system event id in the correct EWOL id depending of the system management mode * @brief convert the system event id in the correct EWOL id depending of the system management mode
* This function find the next input id unused on the specifiic widget * This function find the next input id unused on the specifiic widget
* ==> on PC, the ID does not change (GUI is not the same) * == > on PC, the ID does not change (GUI is not the same)
* @param[in] destWidget Pointer of the widget destination * @param[in] destWidget Pointer of the widget destination
* @param[in] realInputId System Id * @param[in] realInputId system Id
* @return the ewol input id * @return the ewol input id
*/ */
int32_t localGetDestinationId(ewol::keyEvent::type_te type, int32_t localGetDestinationId(ewol::keyEvent::type_te type,
@ -80,41 +80,41 @@ namespace ewol
public: public:
eInput(ewol::eContext& _context); eInput(ewol::eContext& _context);
~eInput(void); ~eInput(void);
void SetDpi(int32_t newDPI); void setDpi(int32_t newDPI);
// note if id<0 ==> the it was finger event ... // note if id<0 == > the it was finger event ...
void Motion(ewol::keyEvent::type_te type, int pointerID, vec2 pos ); void motion(ewol::keyEvent::type_te type, int pointerID, vec2 pos );
void State(ewol::keyEvent::type_te type, int pointerID, bool isDown, vec2 pos); void state(ewol::keyEvent::type_te type, int pointerID, bool isDown, vec2 pos);
/** /**
* @brief Inform object that an other object is removed ... * @brief Inform object that an other object is removed ...
* @param[in] removeObject Pointer on the EObject remeved ==> the user must remove all reference on this EObject * @param[in] removeObject Pointer on the EObject remeved == > the user must remove all reference on this EObject
* @note : Sub classes must call this class * @note : Sub classes must call this class
* @return --- * @return ---
*/ */
void OnObjectRemove(ewol::EObject * removeObject); void onObjectRemove(ewol::EObject * removeObject);
/** /**
* @brief a new layer on the windows is set ==> might remove all the property of the current element ... * @brief a new layer on the windows is set == > might remove all the property of the current element ...
* @param --- * @param ---
* @return --- * @return ---
*/ */
void NewLayerSet(void); void newLayerSet(void);
/** /**
* @brief This is to transfert the event from one widget to another one * @brief This is to transfert the event from one widget to another one
* @param source the widget where the event came from * @param source the widget where the event came from
* @param destination the widget where the event mitgh be generated now * @param destination the widget where the event mitgh be generated now
* @return --- * @return ---
*/ */
void TransfertEvent(ewol::Widget* source, ewol::Widget* destination); void transfertEvent(ewol::Widget* source, ewol::Widget* destination);
/** /**
* @brief This fonction lock the pointer properties to move in relative instead of absolute * @brief This fonction lock the pointer properties to move in relative instead of absolute
* @param[in] widget The widget that lock the pointer events * @param[in] widget The widget that lock the pointer events
*/ */
void GrabPointer(ewol::Widget* widget); void grabPointer(ewol::Widget* widget);
/** /**
* @brief This fonction un-lock the pointer properties to move in relative instead of absolute * @brief This fonction un-lock the pointer properties to move in relative instead of absolute
*/ */
void UnGrabPointer(void); void unGrabPointer(void);
}; };
}; };

View File

@ -11,11 +11,11 @@
#include <ewol/renderer/openGL.h> #include <ewol/renderer/openGL.h>
/** /**
* @brief Get the draw mutex (ewol render). * @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. * @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 * @return the main inteface Mutex
*/ */
static etk::Mutex& MutexOpenGl(void) static etk::Mutex& mutexOpenGl(void)
{ {
static etk::Mutex s_drawMutex; static etk::Mutex s_drawMutex;
return s_drawMutex; return s_drawMutex;
@ -29,103 +29,102 @@ static uint32_t l_textureflags = 0;
static int32_t l_programId = 0; static int32_t l_programId = 0;
void ewol::openGL::Lock(void) void ewol::openGL::lock(void) {
{ mutexOpenGl().lock();
MutexOpenGl().Lock(); l_matrixList.clear();
l_matrixList.Clear();
mat4 tmpMat; mat4 tmpMat;
l_matrixList.PushBack(tmpMat); l_matrixList.pushBack(tmpMat);
l_matrixCamera.Identity(); l_matrixCamera.identity();
l_flagsCurrent = 0; l_flagsCurrent = 0;
l_flagsMustBeSet = 0; l_flagsMustBeSet = 0;
l_textureflags = 0; l_textureflags = 0;
l_programId = -1; l_programId = -1;
} }
void ewol::openGL::UnLock(void) void ewol::openGL::unLock(void)
{ {
MutexOpenGl().UnLock(); mutexOpenGl().unLock();
} }
void ewol::openGL::SetBasicMatrix(const mat4& newOne) void ewol::openGL::setBasicMatrix(const mat4& newOne)
{ {
if (l_matrixList.Size()!=1) { if (l_matrixList.size()!=1) {
EWOL_ERROR("matrix is not corect size in the stack : " << l_matrixList.Size()); EWOL_ERROR("matrix is not corect size in the stack : " << l_matrixList.size());
} }
l_matrixList.Clear(); l_matrixList.clear();
l_matrixList.PushBack(newOne); l_matrixList.pushBack(newOne);
} }
void ewol::openGL::SetMatrix(const mat4& newOne) void ewol::openGL::setMatrix(const mat4& newOne)
{ {
if (l_matrixList.Size()==0) { if (l_matrixList.size() == 0) {
EWOL_ERROR("set matrix list is not corect size in the stack : " << l_matrixList.Size()); EWOL_ERROR("set matrix list is not corect size in the stack : " << l_matrixList.size());
l_matrixList.PushBack(newOne); l_matrixList.pushBack(newOne);
return; return;
} }
l_matrixList[l_matrixList.Size()-1] = newOne; l_matrixList[l_matrixList.size()-1] = newOne;
} }
void ewol::openGL::Push(void) void ewol::openGL::push(void)
{ {
if (l_matrixList.Size()==0) { if (l_matrixList.size() == 0) {
EWOL_ERROR("set matrix list is not corect size in the stack : " << l_matrixList.Size()); EWOL_ERROR("set matrix list is not corect size in the stack : " << l_matrixList.size());
mat4 tmp; mat4 tmp;
l_matrixList.PushBack(tmp); l_matrixList.pushBack(tmp);
return; return;
} }
mat4 tmp = l_matrixList[l_matrixList.Size()-1]; mat4 tmp = l_matrixList[l_matrixList.size()-1];
l_matrixList.PushBack(tmp); l_matrixList.pushBack(tmp);
} }
void ewol::openGL::Pop(void) void ewol::openGL::pop(void)
{ {
if (l_matrixList.Size()<=1) { if (l_matrixList.size() <= 1) {
EWOL_ERROR("set matrix list is not corect size in the stack : " << l_matrixList.Size()); EWOL_ERROR("set matrix list is not corect size in the stack : " << l_matrixList.size());
l_matrixList.Clear(); l_matrixList.clear();
mat4 tmp; mat4 tmp;
l_matrixList.PushBack(tmp); l_matrixList.pushBack(tmp);
l_matrixCamera.Identity(); l_matrixCamera.identity();
return; return;
} }
l_matrixList.PopBack(); l_matrixList.popBack();
l_matrixCamera.Identity(); l_matrixCamera.identity();
} }
const mat4& ewol::openGL::GetMatrix(void) const mat4& ewol::openGL::getMatrix(void)
{ {
if (l_matrixList.Size()==0) { if (l_matrixList.size() == 0) {
EWOL_ERROR("set matrix list is not corect size in the stack : " << l_matrixList.Size()); EWOL_ERROR("set matrix list is not corect size in the stack : " << l_matrixList.size());
mat4 tmp; mat4 tmp;
l_matrixList.PushBack(tmp); l_matrixList.pushBack(tmp);
} }
return l_matrixList[l_matrixList.Size()-1]; return l_matrixList[l_matrixList.size()-1];
} }
const mat4& ewol::openGL::GetCameraMatrix(void) const mat4& ewol::openGL::getCameraMatrix(void)
{ {
return l_matrixCamera; return l_matrixCamera;
} }
void ewol::openGL::SetCameraMatrix(const mat4& newOne) void ewol::openGL::setCameraMatrix(const mat4& newOne)
{ {
l_matrixCamera = newOne; l_matrixCamera = newOne;
} }
void ewol::openGL::Finish(void) void ewol::openGL::finish(void)
{ {
l_programId = -1; l_programId = -1;
l_textureflags = 0; l_textureflags = 0;
} }
void ewol::openGL::Flush(void) void ewol::openGL::flush(void)
{ {
l_programId = -1; l_programId = -1;
l_textureflags = 0; l_textureflags = 0;
} }
void ewol::openGL::Swap(void) void ewol::openGL::swap(void)
{ {
} }
@ -196,48 +195,48 @@ static correspondenceTable_ts basicFlag[] = {
static int32_t basicFlagCount = sizeof(basicFlag) / sizeof(correspondenceTable_ts); static int32_t basicFlagCount = sizeof(basicFlag) / sizeof(correspondenceTable_ts);
void ewol::openGL::Enable(ewol::openGL::openGlFlags_te flagID) void ewol::openGL::enable(ewol::openGL::openGlFlags_te flagID)
{ {
#ifdef DIRECT_MODE #ifdef DIRECT_MODE
for (int32_t iii=0; iii<basicFlagCount ; iii++) { for (int32_t iii=0; iii<basicFlagCount ; iii++) {
if ( basicFlag[iii].curentFlag==(uint32_t)flagID ) { if ( basicFlag[iii].curentFlag == (uint32_t)flagID ) {
glEnable(basicFlag[iii].OGlFlag); glEnable(basicFlag[iii].OGlFlag);
} }
} }
# else # else
//EWOL_DEBUG("Enable FLAGS = " << l_flagsMustBeSet); //EWOL_DEBUG("Enable FLAGS = " << l_flagsMustBeSet);
l_flagsMustBeSet |= (uint32_t)flagID; l_flagsMustBeSet |= (uint32_t)flagID;
//EWOL_DEBUG(" ==>" << l_flagsMustBeSet); //EWOL_DEBUG(" == >" << l_flagsMustBeSet);
#endif #endif
} }
void ewol::openGL::Disable(ewol::openGL::openGlFlags_te flagID) void ewol::openGL::disable(ewol::openGL::openGlFlags_te flagID)
{ {
#ifdef DIRECT_MODE #ifdef DIRECT_MODE
for (int32_t iii=0; iii<basicFlagCount ; iii++) { for (int32_t iii=0; iii<basicFlagCount ; iii++) {
if ( basicFlag[iii].curentFlag==(uint32_t)flagID ) { if ( basicFlag[iii].curentFlag == (uint32_t)flagID ) {
glDisable(basicFlag[iii].OGlFlag); glDisable(basicFlag[iii].OGlFlag);
} }
} }
# else # else
//EWOL_DEBUG("Disable FLAGS = " << l_flagsMustBeSet); //EWOL_DEBUG("Disable FLAGS = " << l_flagsMustBeSet);
l_flagsMustBeSet &= ~((uint32_t)flagID); l_flagsMustBeSet &= ~((uint32_t)flagID);
//EWOL_DEBUG(" ==>" << l_flagsMustBeSet); //EWOL_DEBUG(" == >" << l_flagsMustBeSet);
#endif #endif
} }
void ewol::openGL::UpdateAllFlags(void) void ewol::openGL::updateAllFlags(void)
{ {
#ifdef DIRECT_MODE #ifdef DIRECT_MODE
return; return;
#endif #endif
// check if fhags has change : // check if fhags has change :
if (l_flagsMustBeSet==l_flagsCurrent ) { if (l_flagsMustBeSet == l_flagsCurrent ) {
return; return;
} }
//EWOL_DEBUG(" ==>" << l_flagsMustBeSet); //EWOL_DEBUG(" == >" << l_flagsMustBeSet);
for (int32_t iii=0; iii<basicFlagCount ; iii++) { for (int32_t iii=0; iii<basicFlagCount ; iii++) {
uint32_t CurrentFlag = basicFlag[iii].curentFlag; uint32_t CurrentFlag = basicFlag[iii].curentFlag;
if ( (l_flagsMustBeSet&CurrentFlag)!=(l_flagsCurrent&CurrentFlag) ) { if ( (l_flagsMustBeSet&CurrentFlag)!=(l_flagsCurrent&CurrentFlag) ) {
@ -252,63 +251,63 @@ void ewol::openGL::UpdateAllFlags(void)
} }
void ewol::openGL::ActiveTexture(uint32_t flagID) void ewol::openGL::activeTexture(uint32_t flagID)
{ {
if (l_programId>=0) { if (l_programId >= 0) {
glActiveTexture(flagID); glActiveTexture(flagID);
} }
} }
void ewol::openGL::DesActiveTexture(uint32_t flagID) void ewol::openGL::desActiveTexture(uint32_t flagID)
{ {
if (l_programId>=0) { if (l_programId >= 0) {
} }
} }
void ewol::openGL::DrawArrays(uint32_t mode, int32_t first, int32_t count) void ewol::openGL::drawArrays(uint32_t mode, int32_t first, int32_t count)
{ {
if (l_programId>=0) { if (l_programId >= 0) {
UpdateAllFlags(); updateAllFlags();
glDrawArrays(mode, first, count); glDrawArrays(mode, first, count);
} }
} }
void ewol::openGL::DrawElements(uint32_t mode, const etk::Vector<uint32_t>& indices) void ewol::openGL::drawElements(uint32_t mode, const etk::Vector<uint32_t>& indices)
{ {
if (l_programId>=0) { if (l_programId >= 0) {
UpdateAllFlags(); updateAllFlags();
//EWOL_DEBUG("Request draw of " << indices.Size() << "elements"); //EWOL_DEBUG("Request draw of " << indices.size() << "elements");
glDrawElements(mode, indices.Size(), GL_UNSIGNED_INT, &indices[0]); glDrawElements(mode, indices.size(), GL_UNSIGNED_INT, &indices[0]);
} }
} }
void ewol::openGL::DrawElements16(uint32_t mode, const etk::Vector<uint16_t>& indices) void ewol::openGL::drawElements16(uint32_t mode, const etk::Vector<uint16_t>& indices)
{ {
if (l_programId>=0) { if (l_programId >= 0) {
UpdateAllFlags(); updateAllFlags();
glDrawElements(mode, indices.Size(), GL_UNSIGNED_SHORT, &indices[0]); glDrawElements(mode, indices.size(), GL_UNSIGNED_SHORT, &indices[0]);
} }
} }
void ewol::openGL::DrawElements8(uint32_t mode, const etk::Vector<uint8_t>& indices) void ewol::openGL::drawElements8(uint32_t mode, const etk::Vector<uint8_t>& indices)
{ {
if (l_programId>=0) { if (l_programId >= 0) {
UpdateAllFlags(); updateAllFlags();
glDrawElements(mode, indices.Size(), GL_UNSIGNED_BYTE, &indices[0]); glDrawElements(mode, indices.size(), GL_UNSIGNED_BYTE, &indices[0]);
} }
} }
void ewol::openGL::UseProgram(int32_t id) void ewol::openGL::useProgram(int32_t id)
{ {
//EWOL_DEBUG("USE prog : " << id); //EWOL_DEBUG("USE prog : " << id);
#if 1 #if 1
// note : In normal openGL case, the system might call with the program ID and at the end with 0, // note : In normal openGL case, the system might call with the program ID and at the end with 0,
// here, we wrap this use to prevent over call of glUseProgram ==> then we set -1 when the // here, we wrap this use to prevent over call of glUseProgram == > then we set -1 when the
// user no more use this program, and just stop grnerating. (chen 0 ==> this is an errored program ... // user no more use this program, and just stop grnerating. (chen 0 == > this is an errored program ...
if (-1==id) { if (-1 == id) {
// not used ==> because it is unneded // not used == > because it is unneded
return; return;
} }
if (l_programId != id) { if (l_programId != id) {
@ -316,7 +315,7 @@ void ewol::openGL::UseProgram(int32_t id)
glUseProgram(l_programId); glUseProgram(l_programId);
} }
#else #else
if (-1==id) { if (-1 == id) {
glUseProgram(0); glUseProgram(0);
} else { } else {
l_programId = id; l_programId = id;

View File

@ -22,7 +22,7 @@ extern "C" {
#define GL_GLEXT_PROTOTYPES #define GL_GLEXT_PROTOTYPES
#include <GL/gl.h> #include <GL/gl.h>
// TODO : Check it it work // TODO : Check it it work
// This is to prevent the use of these element that is not allowed in the OpenGL ES // This is to prevent the use of these element that is not allowed in the openGL ES
#undef glVertexPointer #undef glVertexPointer
#undef glTexCoordPointer #undef glTexCoordPointer
#undef glColorPointer #undef glColorPointer
@ -56,59 +56,59 @@ extern "C" {
namespace ewol { namespace ewol {
namespace openGL { namespace openGL {
/** /**
* @brief Lock the OpenGL context for one user only ==> better to keep flags and other things ... * @brief Lock the openGL context for one user only == > better to keep flags and other things ...
*/ */
void Lock(void); void lock(void);
/** /**
* @brief Un-lock the OpenGL context for an other user... * @brief Un-lock the openGL context for an other user...
*/ */
void UnLock(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. * @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 * @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
*/ */
void SetBasicMatrix(const mat4& newOne); void setBasicMatrix(const mat4& newOne);
/** /**
* @brief this funtion configure the current use matrix for the renderer (call @ref Push before, and @ref Pop when no more needed). * @brief this funtion configure the current use matrix for the renderer (call @ref Push before, and @ref Pop when no more needed).
* @param[in] newOne The new current matrix use for the render. * @param[in] newOne The new current matrix use for the render.
* @note We did not use opengl standard system, due to the fact that is not supported in opengl ES-2 * @note We did not use opengl standard system, due to the fact that is not supported in opengl ES-2
*/ */
void SetMatrix(const mat4& newOne); void setMatrix(const mat4& newOne);
/** /**
* @brief Store current matrix in the matrix stack. * @brief store current matrix in the matrix stack.
*/ */
void Push(void); void push(void);
/** /**
* @brief Remove the current matrix and get the last one from the matrix stack. * @brief remove the current matrix and get the last one from the matrix stack.
*/ */
void Pop(void); void pop(void);
/** /**
* @brief Get a reference on the current matrix destinate to opengl renderer. * @brief get a reference on the current matrix destinate to opengl renderer.
* @return The requested matrix. * @return The requested matrix.
*/ */
const mat4& GetMatrix(void); const mat4& getMatrix(void);
/** /**
* @brief Get a reference on the current matrix camera destinate to opengl renderer. * @brief get a reference on the current matrix camera destinate to opengl renderer.
* @return The requested matrix. * @return The requested matrix.
*/ */
const mat4& GetCameraMatrix(void); const mat4& getCameraMatrix(void);
/** /**
* @brief Set a reference on the current camera to opengl renderer. * @brief set a reference on the current camera to opengl renderer.
* @param[in] newOne The requested matrix. * @param[in] newOne The requested matrix.
*/ */
void SetCameraMatrix(const mat4& newOne); void setCameraMatrix(const mat4& newOne);
/** /**
* @brief * @brief
*/ */
void Finish(void); void finish(void);
/** /**
* @brief * @brief
*/ */
void Flush(void); void flush(void);
/** /**
* @brief * @brief
*/ */
void Swap(void); void swap(void);
typedef enum { typedef enum {
FLAG_BLEND = 1<<0, //!< If enabled, blend the computed fragment color values with the values in the color buffers. See glBlendFunc. FLAG_BLEND = 1<<0, //!< If enabled, blend the computed fragment color values with the values in the color buffers. See glBlendFunc.
@ -127,8 +127,8 @@ namespace ewol {
FLAG_POLYGON_OFFSET_LINE = 1<<13, //!< If enabled, and if the polygon is rendered in GL_LINE mode, an offset is added to depth values of a polygon's fragments before the depth comparison is performed. See glPolygonOffset. FLAG_POLYGON_OFFSET_LINE = 1<<13, //!< If enabled, and if the polygon is rendered in GL_LINE mode, an offset is added to depth values of a polygon's fragments before the depth comparison is performed. See glPolygonOffset.
FLAG_POLYGON_OFFSET_POINT = 1<<14, //!< If enabled, an offset is added to depth values of a polygon's fragments before the depth comparison is performed, if the polygon is rendered in GL_POINT mode. See glPolygonOffset. FLAG_POLYGON_OFFSET_POINT = 1<<14, //!< If enabled, an offset is added to depth values of a polygon's fragments before the depth comparison is performed, if the polygon is rendered in GL_POINT mode. See glPolygonOffset.
FLAG_POLYGON_SMOOTH = 1<<15, //!< If enabled, draw polygons with proper filtering. Otherwise, draw aliased polygons. For correct antialiased polygons, an alpha buffer is needed and the polygons must be sorted front to back. FLAG_POLYGON_SMOOTH = 1<<15, //!< If enabled, draw polygons with proper filtering. Otherwise, draw aliased polygons. For correct antialiased polygons, an alpha buffer is needed and the polygons must be sorted front to back.
FLAG_PRIMITIVE_RESTART = 1<<16, //!< Enables primitive restarting. If enabled, any one of the draw commands which transfers a set of generic attribute array elements to the GL will restart the primitive when the index of the vertex is equal to the primitive restart index. See glPrimitiveRestartIndex. FLAG_PRIMITIVE_RESTART = 1<<16, //!< enables primitive restarting. If enabled, any one of the draw commands which transfers a set of generic attribute array elements to the GL will restart the primitive when the index of the vertex is equal to the primitive restart index. See glPrimitiveRestartIndex.
FLAG_PRIMITIVE_RESTART_FIXED_INDEX = 1<<17, //!< Enables primitive restarting with a fixed index. If enabled, any one of the draw commands which transfers a set of generic attribute array elements to the GL will restart the primitive when the index of the vertex is equal to the fixed primitive index for the specified index type. The fixed index is equal to 2n1 where n is equal to 8 for GL_UNSIGNED_BYTE, 16 for GL_UNSIGNED_SHORT and 32 for GL_UNSIGNED_INT. FLAG_PRIMITIVE_RESTART_FIXED_INDEX = 1<<17, //!< enables primitive restarting with a fixed index. If enabled, any one of the draw commands which transfers a set of generic attribute array elements to the GL will restart the primitive when the index of the vertex is equal to the fixed primitive index for the specified index type. The fixed index is equal to 2n1 where n is equal to 8 for GL_UNSIGNED_BYTE, 16 for GL_UNSIGNED_SHORT and 32 for GL_UNSIGNED_INT.
FLAG_SAMPLE_ALPHA_TO_COVERAGE = 1<<18, //!< If enabled, compute a temporary coverage value where each bit is determined by the alpha value at the corresponding sample location. The temporary coverage value is then ANDed with the fragment coverage value. FLAG_SAMPLE_ALPHA_TO_COVERAGE = 1<<18, //!< If enabled, compute a temporary coverage value where each bit is determined by the alpha value at the corresponding sample location. The temporary coverage value is then ANDed with the fragment coverage value.
FLAG_SAMPLE_ALPHA_TO_ONE = 1<<19, //!< If enabled, each sample alpha value is replaced by the maximum representable alpha value. FLAG_SAMPLE_ALPHA_TO_ONE = 1<<19, //!< If enabled, each sample alpha value is replaced by the maximum representable alpha value.
FLAG_SAMPLE_COVERAGE = 1<<20, //!< If enabled, the fragment's coverage is ANDed with the temporary coverage value. If GL_SAMPLE_COVERAGE_INVERT is set to GL_TRUE, invert the coverage value. See glSampleCoverage. FLAG_SAMPLE_COVERAGE = 1<<20, //!< If enabled, the fragment's coverage is ANDed with the temporary coverage value. If GL_SAMPLE_COVERAGE_INVERT is set to GL_TRUE, invert the coverage value. See glSampleCoverage.
@ -143,41 +143,41 @@ namespace ewol {
} openGlFlags_te; } openGlFlags_te;
/** /**
* @brief Enable a flag on the system * @brief enable a flag on the system
* @param[in] flagID The flag requested * @param[in] flagID The flag requested
*/ */
void Enable(openGlFlags_te flagID); void enable(openGlFlags_te flagID);
/** /**
* @brief Disable a flag on the system * @brief disable a flag on the system
* @param[in] flagID The flag requested * @param[in] flagID The flag requested
*/ */
void Disable(openGlFlags_te flagID); void disable(openGlFlags_te flagID);
/** /**
* @brieg Update all the internal flag needed to be set from tre previous element set ... * @brieg update all the internal flag needed to be set from tre previous element set ...
*/ */
void UpdateAllFlags(void); void updateAllFlags(void);
/** /**
* @brief Enable Texture on the system * @brief enable Texture on the system
* @param[in] flagID The flag requested * @param[in] flagID The flag requested
*/ */
void ActiveTexture(uint32_t flagID); void activeTexture(uint32_t flagID);
/** /**
* @brief Disable Texture on the system * @brief disable Texture on the system
* @param[in] flagID The flag requested * @param[in] flagID The flag requested
*/ */
void DesActiveTexture(uint32_t flagID); void desActiveTexture(uint32_t flagID);
/** /**
* @brief draw a specific array ==> this enable mode difference ... * @brief draw a specific array == > this enable mode difference ...
*/ */
void DrawArrays(uint32_t mode, int32_t first, int32_t count); void drawArrays(uint32_t mode, int32_t first, int32_t count);
void DrawElements (uint32_t mode, const etk::Vector<uint32_t>& indices); void drawElements (uint32_t mode, const etk::Vector<uint32_t>& indices);
void DrawElements16(uint32_t mode, const etk::Vector<uint16_t>& indices); void drawElements16(uint32_t mode, const etk::Vector<uint16_t>& indices);
void DrawElements8 (uint32_t mode, const etk::Vector<uint8_t>& indices); void drawElements8 (uint32_t mode, const etk::Vector<uint8_t>& indices);
/** /**
* @brief Use openGL program * @brief Use openGL program
* @param[in] id Id of the program that might be used * @param[in] id Id of the program that might be used
*/ */
void UseProgram(int32_t id); void useProgram(int32_t id);
}; };
}; };

View File

@ -19,149 +19,149 @@ ewol::Colored3DObject::Colored3DObject(void) :
{ {
// get the shader resource : // get the shader resource :
m_GLPosition = 0; m_GLPosition = 0;
m_GLprogram = ewol::Program::Keep("DATA:simple3D.prog"); m_GLprogram = ewol::Program::keep("DATA:simple3D.prog");
if (NULL != m_GLprogram ) { if (NULL != m_GLprogram ) {
m_GLPosition = m_GLprogram->GetAttribute("EW_coord3d"); m_GLPosition = m_GLprogram->getAttribute("EW_coord3d");
m_GLColor = m_GLprogram->GetUniform("EW_color"); m_GLColor = m_GLprogram->getUniform("EW_color");
m_GLMatrix = m_GLprogram->GetUniform("EW_MatrixTransformation"); m_GLMatrix = m_GLprogram->getUniform("EW_MatrixTransformation");
} }
} }
ewol::Colored3DObject::~Colored3DObject(void) ewol::Colored3DObject::~Colored3DObject(void)
{ {
// remove dynamics dependencies : // remove dynamics dependencies :
ewol::Program::Release(m_GLprogram); ewol::Program::release(m_GLprogram);
} }
void ewol::Colored3DObject::Draw(etk::Vector<vec3>& _vertices, void ewol::Colored3DObject::draw(etk::Vector<vec3>& _vertices,
const etk::Color<float>& _color, const etk::Color<float>& _color,
bool _updateDepthBuffer, bool _updateDepthBuffer,
bool _depthtest) bool _depthtest)
{ {
if (_vertices.Size()<=0) { if (_vertices.size() <= 0) {
return; return;
} }
if (m_GLprogram==NULL) { if (m_GLprogram == NULL) {
EWOL_ERROR("No shader ..."); EWOL_ERROR("No shader ...");
return; return;
} }
if (true==_depthtest) { if (true == _depthtest) {
ewol::openGL::Enable(ewol::openGL::FLAG_DEPTH_TEST); ewol::openGL::enable(ewol::openGL::FLAG_DEPTH_TEST);
if (false==_updateDepthBuffer) { if (false == _updateDepthBuffer) {
glDepthMask(GL_FALSE); glDepthMask(GL_FALSE);
} }
} }
//EWOL_DEBUG(" Display " << m_coord.Size() << " elements" ); //EWOL_DEBUG(" display " << m_coord.size() << " elements" );
m_GLprogram->Use(); m_GLprogram->use();
// set Matrix : translation/positionMatrix // set Matrix : translation/positionMatrix
mat4 projMatrix = ewol::openGL::GetMatrix(); mat4 projMatrix = ewol::openGL::getMatrix();
mat4 camMatrix = ewol::openGL::GetCameraMatrix(); mat4 camMatrix = ewol::openGL::getCameraMatrix();
mat4 tmpMatrix = projMatrix * camMatrix; mat4 tmpMatrix = projMatrix * camMatrix;
m_GLprogram->UniformMatrix4fv(m_GLMatrix, 1, tmpMatrix.m_mat); m_GLprogram->uniformMatrix4fv(m_GLMatrix, 1, tmpMatrix.m_mat);
// position : // position :
m_GLprogram->SendAttribute(m_GLPosition, 3/*x,y,z,unused*/, &_vertices[0], 4*sizeof(float)); m_GLprogram->sendAttribute(m_GLPosition, 3/*x,y,z,unused*/, &_vertices[0], 4*sizeof(float));
// color : // color :
m_GLprogram->Uniform4fv(m_GLColor, 1/*r,g,b,a*/, (float*)&_color); m_GLprogram->uniform4fv(m_GLColor, 1/*r,g,b,a*/, (float*)&_color);
// Request the draw od the elements : // Request the draw od the elements :
ewol::openGL::DrawArrays(GL_TRIANGLES, 0, _vertices.Size()); ewol::openGL::drawArrays(GL_TRIANGLES, 0, _vertices.size());
m_GLprogram->UnUse(); m_GLprogram->unUse();
// Request the draw od the elements : // Request the draw od the elements :
//glDrawArrays(GL_LINES, 0, vertices.Size()); //glDrawArrays(GL_LINES, 0, vertices.size());
//m_GLprogram->UnUse(); //m_GLprogram->UnUse();
if (true==_depthtest) { if (true == _depthtest) {
if (false==_updateDepthBuffer) { if (false == _updateDepthBuffer) {
glDepthMask(GL_TRUE); glDepthMask(GL_TRUE);
} }
ewol::openGL::Disable(ewol::openGL::FLAG_DEPTH_TEST); ewol::openGL::disable(ewol::openGL::FLAG_DEPTH_TEST);
} }
} }
void ewol::Colored3DObject::Draw(etk::Vector<vec3>& _vertices, void ewol::Colored3DObject::draw(etk::Vector<vec3>& _vertices,
const etk::Color<float>& _color, const etk::Color<float>& _color,
mat4& _transformationMatrix, mat4& _transformationMatrix,
bool _updateDepthBuffer, bool _updateDepthBuffer,
bool _depthtest) bool _depthtest)
{ {
if (_vertices.Size()<=0) { if (_vertices.size() <= 0) {
return; return;
} }
if (m_GLprogram==NULL) { if (m_GLprogram == NULL) {
EWOL_ERROR("No shader ..."); EWOL_ERROR("No shader ...");
return; return;
} }
if (true==_depthtest) { if (true == _depthtest) {
ewol::openGL::Enable(ewol::openGL::FLAG_DEPTH_TEST); ewol::openGL::enable(ewol::openGL::FLAG_DEPTH_TEST);
if (false==_updateDepthBuffer) { if (false == _updateDepthBuffer) {
glDepthMask(GL_FALSE); glDepthMask(GL_FALSE);
} }
} }
//EWOL_DEBUG(" Display " << m_coord.Size() << " elements" ); //EWOL_DEBUG(" display " << m_coord.size() << " elements" );
m_GLprogram->Use(); m_GLprogram->use();
// set Matrix : translation/positionMatrix // set Matrix : translation/positionMatrix
mat4 projMatrix = ewol::openGL::GetMatrix(); mat4 projMatrix = ewol::openGL::getMatrix();
mat4 camMatrix = ewol::openGL::GetCameraMatrix(); mat4 camMatrix = ewol::openGL::getCameraMatrix();
mat4 tmpMatrix = projMatrix * camMatrix * _transformationMatrix; mat4 tmpMatrix = projMatrix * camMatrix * _transformationMatrix;
m_GLprogram->UniformMatrix4fv(m_GLMatrix, 1, tmpMatrix.m_mat); m_GLprogram->uniformMatrix4fv(m_GLMatrix, 1, tmpMatrix.m_mat);
// position : // position :
m_GLprogram->SendAttribute(m_GLPosition, 3/*x,y,z*/, &_vertices[0], 4*sizeof(float)); m_GLprogram->sendAttribute(m_GLPosition, 3/*x,y,z*/, &_vertices[0], 4*sizeof(float));
// color : // color :
m_GLprogram->Uniform4fv(m_GLColor, 1/*r,g,b,a*/, (float*)&_color); m_GLprogram->uniform4fv(m_GLColor, 1/*r,g,b,a*/, (float*)&_color);
// Request the draw od the elements : // Request the draw od the elements :
ewol::openGL::DrawArrays(GL_TRIANGLES, 0, _vertices.Size()); ewol::openGL::drawArrays(GL_TRIANGLES, 0, _vertices.size());
m_GLprogram->UnUse(); m_GLprogram->unUse();
if (true==_depthtest) { if (true == _depthtest) {
if (false==_updateDepthBuffer) { if (false == _updateDepthBuffer) {
glDepthMask(GL_TRUE); glDepthMask(GL_TRUE);
} }
ewol::openGL::Disable(ewol::openGL::FLAG_DEPTH_TEST); ewol::openGL::disable(ewol::openGL::FLAG_DEPTH_TEST);
} }
} }
void ewol::Colored3DObject::DrawLine(etk::Vector<vec3>& _vertices, void ewol::Colored3DObject::drawLine(etk::Vector<vec3>& _vertices,
const etk::Color<float>& _color, const etk::Color<float>& _color,
mat4& _transformationMatrix, mat4& _transformationMatrix,
bool _updateDepthBuffer, bool _updateDepthBuffer,
bool _depthtest) bool _depthtest)
{ {
if (_vertices.Size()<=0) { if (_vertices.size() <= 0) {
return; return;
} }
if (m_GLprogram==NULL) { if (m_GLprogram == NULL) {
EWOL_ERROR("No shader ..."); EWOL_ERROR("No shader ...");
return; return;
} }
if (true==_depthtest) { if (true == _depthtest) {
ewol::openGL::Enable(ewol::openGL::FLAG_DEPTH_TEST); ewol::openGL::enable(ewol::openGL::FLAG_DEPTH_TEST);
if (false==_updateDepthBuffer) { if (false == _updateDepthBuffer) {
glDepthMask(GL_FALSE); glDepthMask(GL_FALSE);
} }
} }
//EWOL_DEBUG(" Display " << m_coord.Size() << " elements" ); //EWOL_DEBUG(" display " << m_coord.size() << " elements" );
m_GLprogram->Use(); m_GLprogram->use();
// set Matrix : translation/positionMatrix // set Matrix : translation/positionMatrix
mat4 projMatrix = ewol::openGL::GetMatrix(); mat4 projMatrix = ewol::openGL::getMatrix();
mat4 camMatrix = ewol::openGL::GetCameraMatrix(); mat4 camMatrix = ewol::openGL::getCameraMatrix();
mat4 tmpMatrix = projMatrix * camMatrix * _transformationMatrix; mat4 tmpMatrix = projMatrix * camMatrix * _transformationMatrix;
m_GLprogram->UniformMatrix4fv(m_GLMatrix, 1, tmpMatrix.m_mat); m_GLprogram->uniformMatrix4fv(m_GLMatrix, 1, tmpMatrix.m_mat);
// position : // position :
m_GLprogram->SendAttribute(m_GLPosition, 3/*x,y,z*/, &_vertices[0], 4*sizeof(float)); m_GLprogram->sendAttribute(m_GLPosition, 3/*x,y,z*/, &_vertices[0], 4*sizeof(float));
// color : // color :
m_GLprogram->Uniform4fv(m_GLColor, 1/*r,g,b,a*/, (float*)&_color); m_GLprogram->uniform4fv(m_GLColor, 1/*r,g,b,a*/, (float*)&_color);
// Request the draw od the elements : // Request the draw od the elements :
ewol::openGL::DrawArrays(GL_LINES, 0, _vertices.Size()); ewol::openGL::drawArrays(GL_LINES, 0, _vertices.size());
m_GLprogram->UnUse(); m_GLprogram->unUse();
if (true==_depthtest) { if (true == _depthtest) {
if (false==_updateDepthBuffer) { if (false == _updateDepthBuffer) {
glDepthMask(GL_TRUE); glDepthMask(GL_TRUE);
} }
ewol::openGL::Disable(ewol::openGL::FLAG_DEPTH_TEST); ewol::openGL::disable(ewol::openGL::FLAG_DEPTH_TEST);
} }
} }
ewol::Colored3DObject* ewol::Colored3DObject::Keep(void) ewol::Colored3DObject* ewol::Colored3DObject::keep(void)
{ {
EWOL_VERBOSE("KEEP : direct Colored3DObject"); EWOL_VERBOSE("KEEP : direct Colored3DObject");
// need to crate a new one ... // need to crate a new one ...
@ -170,16 +170,16 @@ ewol::Colored3DObject* ewol::Colored3DObject::Keep(void)
EWOL_ERROR("allocation error of a resource : Colored3DObject "); EWOL_ERROR("allocation error of a resource : Colored3DObject ");
return NULL; return NULL;
} }
GetManager().LocalAdd(object); getManager().localAdd(object);
return object; return object;
} }
void ewol::Colored3DObject::Release(ewol::Colored3DObject*& _object) void ewol::Colored3DObject::release(ewol::Colored3DObject*& _object)
{ {
if (NULL == _object) { if (NULL == _object) {
return; return;
} }
ewol::Resource* object2 = static_cast<ewol::Resource*>(_object); ewol::Resource* object2 = static_cast<ewol::Resource*>(_object);
GetManager().Release(object2); getManager().release(object2);
_object = NULL; _object = NULL;
} }

View File

@ -28,33 +28,33 @@ namespace ewol
Colored3DObject(void); Colored3DObject(void);
virtual ~Colored3DObject(void); virtual ~Colored3DObject(void);
public: public:
virtual const char* GetType(void) { return "ewol::Colored3DObject"; }; virtual const char* getType(void) { return "ewol::Colored3DObject"; };
virtual void Draw(etk::Vector<vec3>& _vertices, virtual void draw(etk::Vector<vec3>& _vertices,
const etk::Color<float>& _color, const etk::Color<float>& _color,
bool _updateDepthBuffer=true, bool _updateDepthBuffer=true,
bool _depthtest=true); bool _depthtest=true);
virtual void Draw(etk::Vector<vec3>& _vertices, virtual void draw(etk::Vector<vec3>& _vertices,
const etk::Color<float>& _color, const etk::Color<float>& _color,
mat4& _transformationMatrix, mat4& _transformationMatrix,
bool _updateDepthBuffer=true, bool _updateDepthBuffer=true,
bool _depthtest=true); bool _depthtest=true);
virtual void DrawLine(etk::Vector<vec3>& _vertices, virtual void drawLine(etk::Vector<vec3>& _vertices,
const etk::Color<float>& _color, const etk::Color<float>& _color,
mat4& _transformationMatrix, mat4& _transformationMatrix,
bool _updateDepthBuffer=true, bool _updateDepthBuffer=true,
bool _depthtest=true); bool _depthtest=true);
public: public:
/** /**
* @brief Keep the resource pointer. * @brief keep the resource pointer.
* @note Never free this pointer by your own... * @note Never free this pointer by your own...
* @return pointer on the resource or NULL if an error occured. * @return pointer on the resource or NULL if an error occured.
*/ */
static ewol::Colored3DObject* Keep(void); static ewol::Colored3DObject* keep(void);
/** /**
* @brief Release the keeped resources * @brief release the keeped resources
* @param[in,out] reference on the object pointer * @param[in,out] reference on the object pointer
*/ */
static void Release(ewol::Colored3DObject*& _object); static void release(ewol::Colored3DObject*& _object);
}; };
}; };

View File

@ -15,7 +15,7 @@
#define __class__ "ConfigFile" #define __class__ "ConfigFile"
void ewol::SimpleConfigElement::Parse(const etk::UString& value) void ewol::SimpleConfigElement::parse(const etk::UString& value)
{ {
etk::Char tmp = value.c_str(); etk::Char tmp = value.c_str();
m_valueInt = 0; m_valueInt = 0;
@ -31,50 +31,50 @@ ewol::ConfigFile::ConfigFile(const etk::UString& _filename):
ewol::Resource(_filename) ewol::Resource(_filename)
{ {
EWOL_DEBUG("SFP : load \"" << _filename << "\""); EWOL_DEBUG("SFP : load \"" << _filename << "\"");
Reload(); reload();
} }
ewol::ConfigFile::~ConfigFile(void) ewol::ConfigFile::~ConfigFile(void)
{ {
// remove all element // remove all element
for (int32_t iii=0; iii<m_list.Size(); iii++){ for (int32_t iii=0; iii<m_list.size(); iii++){
if (NULL != m_list[iii]) { if (NULL != m_list[iii]) {
delete(m_list[iii]); delete(m_list[iii]);
m_list[iii] = NULL; m_list[iii] = NULL;
} }
} }
m_list.Clear(); m_list.clear();
} }
void ewol::ConfigFile::Reload(void) void ewol::ConfigFile::reload(void)
{ {
// Reset all parameters // reset all parameters
for (int32_t iii=0; iii<m_list.Size(); iii++){ for (int32_t iii=0; iii<m_list.size(); iii++){
if (NULL != m_list[iii]) { if (NULL != m_list[iii]) {
m_list[iii]->Parse(""); m_list[iii]->parse("");
} }
} }
// acess of the file : // acess of the file :
etk::FSNode file(m_name); etk::FSNode file(m_name);
if (false == file.Exist()) { if (false == file.exist()) {
EWOL_ERROR("File does not Exist : \"" << file << "\""); EWOL_ERROR("File does not Exist : \"" << file << "\"");
return; return;
} }
etk::UString fileExtention = file.FileGetExtention(); etk::UString fileExtention = file.fileGetExtention();
if (fileExtention != "conf") { if (fileExtention != "conf") {
EWOL_ERROR("File does not have extention \".conf\" for program but : \"" << fileExtention << "\""); EWOL_ERROR("File does not have extention \".conf\" for program but : \"" << fileExtention << "\"");
return; return;
} }
if (false == file.FileOpenRead()) { if (false == file.fileOpenRead()) {
EWOL_ERROR("Can not open the file : " << file); EWOL_ERROR("Can not open the file : " << file);
return; return;
} }
#define MAX_LINE_SIZE (2048) #define MAX_LINE_SIZE (2048)
char tmpData[MAX_LINE_SIZE]; char tmpData[MAX_LINE_SIZE];
while (file.FileGets(tmpData, MAX_LINE_SIZE) != NULL) { while (file.fileGets(tmpData, MAX_LINE_SIZE) != NULL) {
int32_t len = strlen(tmpData); int32_t len = strlen(tmpData);
if( tmpData[len-1] == '\n' if( tmpData[len-1] == '\n'
|| tmpData[len-1] == '\r') { || tmpData[len-1] == '\r') {
@ -87,30 +87,30 @@ void ewol::ConfigFile::Reload(void)
} }
etk::UString tmpData2(tmpData); etk::UString tmpData2(tmpData);
etk::UString tmppp("#"); etk::UString tmppp("#");
if (true == tmpData2.StartWith(tmppp)) { if (true == tmpData2.startWith(tmppp)) {
// comment ... // comment ...
continue; continue;
} }
tmppp="//"; tmppp="//";
if (true == tmpData2.StartWith(tmppp)) { if (true == tmpData2.startWith(tmppp)) {
// comment ... // comment ...
continue; continue;
} }
// get parameters : // get parameters :
int32_t pos = tmpData2.FindForward('='); int32_t pos = tmpData2.findForward('=');
if (pos == -1){ if (pos == -1){
//the element "=" is not find ... //the element "=" is not find ...
continue; continue;
} }
etk::UString paramName = tmpData2.Extract(0, pos); etk::UString paramName = tmpData2.extract(0, pos);
etk::UString paramValue = tmpData2.Extract(pos+1, 0x7FFFF); etk::UString paramValue = tmpData2.extract(pos+1, 0x7FFFF);
EWOL_DEBUG(" param name=\"" << paramName << "\" val=\"" << paramValue << "\""); EWOL_DEBUG(" param name=\"" << paramName << "\" val=\"" << paramValue << "\"");
// check if the parameters existed : // check if the parameters existed :
bool findParam = false; bool findParam = false;
for (int32_t iii=0; iii<m_list.Size(); iii++){ for (int32_t iii=0; iii<m_list.size(); iii++){
if (NULL != m_list[iii]) { if (NULL != m_list[iii]) {
if (m_list[iii]->m_paramName == paramName) { if (m_list[iii]->m_paramName == paramName) {
m_list[iii]->Parse(paramValue); m_list[iii]->parse(paramValue);
findParam = true; findParam = true;
// stop parsing ... // stop parsing ...
break; break;
@ -122,21 +122,21 @@ void ewol::ConfigFile::Reload(void)
if (NULL == tmpElement) { if (NULL == tmpElement) {
EWOL_DEBUG("error while allocation"); EWOL_DEBUG("error while allocation");
} else { } else {
tmpElement->Parse(paramValue); tmpElement->parse(paramValue);
m_list.PushBack(tmpElement); m_list.pushBack(tmpElement);
} }
} }
} }
// close the file: // close the file:
file.FileClose(); file.fileClose();
} }
int32_t ewol::ConfigFile::Request(const etk::UString& _paramName) int32_t ewol::ConfigFile::request(const etk::UString& _paramName)
{ {
// check if the parameters existed : // check if the parameters existed :
for (int32_t iii=0; iii<m_list.Size(); iii++){ for (int32_t iii=0; iii<m_list.size(); iii++){
if (NULL != m_list[iii]) { if (NULL != m_list[iii]) {
if (m_list[iii]->m_paramName == _paramName) { if (m_list[iii]->m_paramName == _paramName) {
return iii; return iii;
@ -147,16 +147,16 @@ int32_t ewol::ConfigFile::Request(const etk::UString& _paramName)
if (NULL == tmpElement) { if (NULL == tmpElement) {
EWOL_DEBUG("error while allocation"); EWOL_DEBUG("error while allocation");
} else { } else {
m_list.PushBack(tmpElement); m_list.pushBack(tmpElement);
} }
return m_list.Size()-1; return m_list.size()-1;
} }
ewol::ConfigFile* ewol::ConfigFile::Keep(const etk::UString& _filename) ewol::ConfigFile* ewol::ConfigFile::keep(const etk::UString& _filename)
{ {
EWOL_INFO("KEEP : SimpleConfig : file : \"" << _filename << "\""); EWOL_INFO("KEEP : SimpleConfig : file : \"" << _filename << "\"");
ewol::ConfigFile* object = static_cast<ewol::ConfigFile*>(GetManager().LocalKeep(_filename)); ewol::ConfigFile* object = static_cast<ewol::ConfigFile*>(getManager().localKeep(_filename));
if (NULL != object) { if (NULL != object) {
return object; return object;
} }
@ -166,17 +166,17 @@ ewol::ConfigFile* ewol::ConfigFile::Keep(const etk::UString& _filename)
EWOL_ERROR("allocation error of a resource : ??Mesh.obj??"); EWOL_ERROR("allocation error of a resource : ??Mesh.obj??");
return NULL; return NULL;
} }
GetManager().LocalAdd(object); getManager().localAdd(object);
return object; return object;
} }
void ewol::ConfigFile::Release(ewol::ConfigFile*& _object) void ewol::ConfigFile::release(ewol::ConfigFile*& _object)
{ {
if (NULL == _object) { if (NULL == _object) {
return; return;
} }
ewol::Resource* object2 = static_cast<ewol::Resource*>(_object); ewol::Resource* object2 = static_cast<ewol::Resource*>(_object);
GetManager().Release(object2); getManager().release(object2);
_object = NULL; _object = NULL;
} }

View File

@ -30,10 +30,10 @@ namespace ewol
m_valueInt(0), m_valueInt(0),
m_valuefloat(0.0) { }; m_valuefloat(0.0) { };
~SimpleConfigElement(void) { }; ~SimpleConfigElement(void) { };
void Parse(const etk::UString& value); void parse(const etk::UString& value);
int32_t GetInteger(void) { return m_valueInt; }; int32_t getInteger(void) { return m_valueInt; };
float GetFloat(void) { return m_valuefloat; }; float getFloat(void) { return m_valuefloat; };
etk::UString& GetString(void) { return m_value; }; etk::UString& getString(void) { return m_value; };
}; };
class ConfigFile : public ewol::Resource class ConfigFile : public ewol::Resource
@ -45,27 +45,27 @@ namespace ewol
ConfigFile(const etk::UString& _filename); ConfigFile(const etk::UString& _filename);
virtual ~ConfigFile(void); virtual ~ConfigFile(void);
public: public:
const char* GetType(void) { return "ewol::SimpleConfigFile"; }; const char* getType(void) { return "ewol::SimpleConfigFile"; };
void Reload(void); void reload(void);
int32_t Request(const etk::UString& _paramName); int32_t request(const etk::UString& _paramName);
int32_t GetInteger(int32_t id) { if (id<0) { return 0; } return m_list[id]->GetInteger(); }; int32_t getInteger(int32_t id) { if (id<0) { return 0; } return m_list[id]->getInteger(); };
float GetFloat(int32_t id) { if (id<0) { return 0; } return m_list[id]->GetFloat(); }; float getFloat(int32_t id) { if (id<0) { return 0; } return m_list[id]->getFloat(); };
etk::UString& GetString(int32_t id) { if (id<0) { return m_errorString; } return m_list[id]->GetString(); }; etk::UString& getString(int32_t id) { if (id<0) { return m_errorString; } return m_list[id]->getString(); };
public: public:
/** /**
* @brief Keep the resource pointer. * @brief keep the resource pointer.
* @note Never free this pointer by your own... * @note Never free this pointer by your own...
* @param[in] _filename Name of the configuration file. * @param[in] _filename Name of the configuration file.
* @return pointer on the resource or NULL if an error occured. * @return pointer on the resource or NULL if an error occured.
*/ */
static ewol::ConfigFile* Keep(const etk::UString& _filename); static ewol::ConfigFile* keep(const etk::UString& _filename);
/** /**
* @brief Release the keeped resources * @brief release the keeped resources
* @param[in,out] reference on the object pointer * @param[in,out] reference on the object pointer
*/ */
static void Release(ewol::ConfigFile*& _object); static void release(ewol::ConfigFile*& _object);
}; };
}; };

View File

@ -27,9 +27,9 @@
static int32_t l_countLoaded=0; static int32_t l_countLoaded=0;
static FT_Library library; static FT_Library library;
void ewol::FreeTypeInit(void) void ewol::freeTypeInit(void)
{ {
EWOL_DEBUG("==> Init Font-Manager"); EWOL_DEBUG(" == > init Font-Manager");
l_countLoaded++; l_countLoaded++;
if (l_countLoaded>1) { if (l_countLoaded>1) {
// already loaded ... // already loaded ...
@ -41,9 +41,9 @@ void ewol::FreeTypeInit(void)
} }
} }
void ewol::FreeTypeUnInit(void) void ewol::freeTypeUnInit(void)
{ {
EWOL_DEBUG("==> Un-Init Font-Manager"); EWOL_DEBUG(" == > Un-Init Font-Manager");
l_countLoaded--; l_countLoaded--;
if (l_countLoaded>0) { if (l_countLoaded>0) {
// already needed ... // already needed ...
@ -66,16 +66,16 @@ ewol::FontFreeType::FontFreeType(const etk::UString& _fontName) :
m_FileSize = 0; m_FileSize = 0;
etk::FSNode myfile(_fontName); etk::FSNode myfile(_fontName);
if (false == myfile.Exist()) { if (false == myfile.exist()) {
EWOL_ERROR("File Does not exist : " << myfile); EWOL_ERROR("File Does not exist : " << myfile);
return; return;
} }
m_FileSize = myfile.FileSize(); m_FileSize = myfile.fileSize();
if (0==m_FileSize) { if (0 == m_FileSize) {
EWOL_ERROR("This file is empty : " << myfile); EWOL_ERROR("This file is empty : " << myfile);
return; return;
} }
if (false == myfile.FileOpenRead()) { if (false == myfile.fileOpenRead()) {
EWOL_ERROR("Can not open the file : " << myfile); EWOL_ERROR("Can not open the file : " << myfile);
return; return;
} }
@ -86,9 +86,9 @@ ewol::FontFreeType::FontFreeType(const etk::UString& _fontName) :
return; return;
} }
// load data from the file : // load data from the file :
myfile.FileRead(m_FileBuffer, 1, m_FileSize); myfile.fileRead(m_FileBuffer, 1, m_FileSize);
// close the file: // close the file:
myfile.FileClose(); myfile.fileClose();
// load Face ... // load Face ...
int32_t error = FT_New_Memory_Face( library, m_FileBuffer, m_FileSize, 0, &m_fftFace ); int32_t error = FT_New_Memory_Face( library, m_FileBuffer, m_FileSize, 0, &m_fftFace );
if( FT_Err_Unknown_File_Format == error) { if( FT_Err_Unknown_File_Format == error) {
@ -115,9 +115,9 @@ ewol::FontFreeType::~FontFreeType(void)
} }
vec2 ewol::FontFreeType::GetSize(int32_t _fontSize, const etk::UString& _unicodeString) vec2 ewol::FontFreeType::getSize(int32_t _fontSize, const etk::UString& _unicodeString)
{ {
if(false==m_init) { if(false == m_init) {
return vec2(0,0); return vec2(0,0);
} }
// TODO : ... // TODO : ...
@ -125,29 +125,29 @@ vec2 ewol::FontFreeType::GetSize(int32_t _fontSize, const etk::UString& _unicode
return outputSize; return outputSize;
} }
int32_t ewol::FontFreeType::GetHeight(int32_t _fontSize) int32_t ewol::FontFreeType::getHeight(int32_t _fontSize)
{ {
return _fontSize*1.43f; // this is a really "magic" number ... return _fontSize*1.43f; // this is a really "magic" number ...
} }
bool ewol::FontFreeType::GetGlyphProperty(int32_t _fontSize, ewol::GlyphProperty& _property) bool ewol::FontFreeType::getGlyphProperty(int32_t _fontSize, ewol::GlyphProperty& _property)
{ {
if(false==m_init) { if(false == m_init) {
return false; return false;
} }
// 300dpi (hight quality) 96 dpi (normal quality) // 300dpi (hight quality) 96 dpi (normal quality)
int32_t fontQuality = 96; int32_t fontQuality = 96;
// Select Size ... // Select size ...
// note tha <<6==*64 corespond with the 1/64th of points calculation of freetype // note tha <<6 == *64 corespond with the 1/64th of points calculation of freetype
int32_t error = FT_Set_Char_Size(m_fftFace, _fontSize<<6, _fontSize<<6, fontQuality, fontQuality); int32_t error = FT_Set_Char_Size(m_fftFace, _fontSize<<6, _fontSize<<6, fontQuality, fontQuality);
if (0!=error ) { if (0!=error ) {
EWOL_ERROR("FT_Set_Char_Size ==> error in settings ..."); EWOL_ERROR("FT_Set_Char_Size == > error in settings ...");
return false; return false;
} }
// a small shortcut // a small shortcut
FT_GlyphSlot slot = m_fftFace->glyph; FT_GlyphSlot slot = m_fftFace->glyph;
// retrieve glyph index from character code // retrieve glyph index from character code
int32_t glyph_index = FT_Get_Char_Index(m_fftFace, _property.m_UVal.Get()); int32_t glyph_index = FT_Get_Char_Index(m_fftFace, _property.m_UVal.get());
// load glyph image into the slot (erase previous one) // load glyph image into the slot (erase previous one)
error = FT_Load_Glyph(m_fftFace, // handle to face object error = FT_Load_Glyph(m_fftFace, // handle to face object
glyph_index, // glyph index glyph_index, // glyph index
@ -171,23 +171,22 @@ bool ewol::FontFreeType::GetGlyphProperty(int32_t _fontSize, ewol::GlyphProperty
return true; return true;
} }
bool ewol::FontFreeType::DrawGlyph(egami::Image& _imageOut, bool ewol::FontFreeType::drawGlyph(egami::Image& _imageOut,
int32_t _fontSize, int32_t _fontSize,
ivec2 _glyphPosition, ivec2 _glyphPosition,
ewol::GlyphProperty& _property, ewol::GlyphProperty& _property,
int8_t _posInImage) int8_t _posInImage)
{ {
if(false == m_init) {
if(false==m_init) {
return false; return false;
} }
// 300dpi (hight quality) 96 dpi (normal quality) // 300dpi (hight quality) 96 dpi (normal quality)
int32_t fontQuality = 96; int32_t fontQuality = 96;
// Select Size ... // Select size ...
// note tha <<6==*64 corespond with the 1/64th of points calculation of freetype // note tha <<6 == *64 corespond with the 1/64th of points calculation of freetype
int32_t error = FT_Set_Char_Size(m_fftFace, _fontSize<<6, _fontSize<<6, fontQuality, fontQuality); int32_t error = FT_Set_Char_Size(m_fftFace, _fontSize<<6, _fontSize<<6, fontQuality, fontQuality);
if (0!=error ) { if (0!=error ) {
EWOL_ERROR("FT_Set_Char_Size ==> error in settings ..."); EWOL_ERROR("FT_Set_Char_Size == > error in settings ...");
return false; return false;
} }
// a small shortcut // a small shortcut
@ -210,59 +209,59 @@ bool ewol::FontFreeType::DrawGlyph(egami::Image& _imageOut,
etk::Color<> tlpppp(0xFFFFFF00); etk::Color<> tlpppp(0xFFFFFF00);
for(int32_t jjj=0; jjj < slot->bitmap.rows;jjj++) { for(int32_t jjj=0; jjj < slot->bitmap.rows;jjj++) {
for(int32_t iii=0; iii < slot->bitmap.width; iii++){ for(int32_t iii=0; iii < slot->bitmap.width; iii++){
tlpppp = _imageOut.Get(ivec2(_glyphPosition.x()+iii, _glyphPosition.y()+jjj)); tlpppp = _imageOut.get(ivec2(_glyphPosition.x()+iii, _glyphPosition.y()+jjj));
uint8_t valueColor = slot->bitmap.buffer[iii + slot->bitmap.width*jjj]; uint8_t valueColor = slot->bitmap.buffer[iii + slot->bitmap.width*jjj];
// set only alpha : // set only alpha :
switch(_posInImage) switch(_posInImage)
{ {
default: default:
case 0: case 0:
tlpppp.SetA(valueColor); tlpppp.setA(valueColor);
break; break;
case 1: case 1:
tlpppp.SetR(valueColor); tlpppp.setR(valueColor);
break; break;
case 2: case 2:
tlpppp.SetG(valueColor); tlpppp.setG(valueColor);
break; break;
case 3: case 3:
tlpppp.SetB(valueColor); tlpppp.setB(valueColor);
break; break;
} }
// real set of color // real set of color
_imageOut.Set(ivec2(_glyphPosition.x()+iii, _glyphPosition.y()+jjj), tlpppp ); _imageOut.set(ivec2(_glyphPosition.x()+iii, _glyphPosition.y()+jjj), tlpppp );
} }
} }
return true; return true;
} }
void ewol::FontFreeType::GenerateKerning(int32_t fontSize, etk::Vector<ewol::GlyphProperty>& listGlyph) void ewol::FontFreeType::generateKerning(int32_t fontSize, etk::Vector<ewol::GlyphProperty>& listGlyph)
{ {
if(false==m_init) { if(false == m_init) {
return; return;
} }
if ((FT_FACE_FLAG_KERNING & m_fftFace->face_flags) == 0) { if ((FT_FACE_FLAG_KERNING & m_fftFace->face_flags) == 0) {
EWOL_INFO("No kerning generation (Disable) in the font"); EWOL_INFO("No kerning generation (disable) in the font");
} }
// 300dpi (hight quality) 96 dpi (normal quality) // 300dpi (hight quality) 96 dpi (normal quality)
int32_t fontQuality = 96; int32_t fontQuality = 96;
// Select Size ... // Select size ...
// note tha <<6==*64 corespond with the 1/64th of points calculation of freetype // note tha <<6 == *64 corespond with the 1/64th of points calculation of freetype
int32_t error = FT_Set_Char_Size(m_fftFace, fontSize<<6, fontSize<<6, fontQuality, fontQuality); int32_t error = FT_Set_Char_Size(m_fftFace, fontSize<<6, fontSize<<6, fontQuality, fontQuality);
if (0!=error ) { if (0!=error ) {
EWOL_ERROR("FT_Set_Char_Size ==> error in settings ..."); EWOL_ERROR("FT_Set_Char_Size == > error in settings ...");
return; return;
} }
// For all the kerning element we get the kerning value : // For all the kerning element we get the kerning value :
for(int32_t iii=0; iii<listGlyph.Size(); iii++) { for(int32_t iii=0; iii<listGlyph.size(); iii++) {
listGlyph[iii].KerningClear(); listGlyph[iii].kerningClear();
for(int32_t kkk=0; kkk<listGlyph.Size(); kkk++) { for(int32_t kkk=0; kkk<listGlyph.size(); kkk++) {
FT_Vector kerning; FT_Vector kerning;
FT_Get_Kerning(m_fftFace, listGlyph[kkk].m_glyphIndex, listGlyph[iii].m_glyphIndex, FT_KERNING_UNFITTED, &kerning ); FT_Get_Kerning(m_fftFace, listGlyph[kkk].m_glyphIndex, listGlyph[iii].m_glyphIndex, FT_KERNING_UNFITTED, &kerning );
// add the kerning only if != 0 ... // add the kerning only if != 0 ...
if (kerning.x != 0) { if (kerning.x != 0) {
listGlyph[iii].KerningAdd(listGlyph[kkk].m_UVal, listGlyph[iii].kerningAdd(listGlyph[kkk].m_UVal,
kerning.x/32.0f ); kerning.x/32.0f );
//EWOL_DEBUG("Kerning between : '" << (char)listGlyph[iii].m_UVal << "'&'" << (char)listGlyph[kkk].m_UVal << "' value : " << kerning.x << " => " << (kerning.x/64.0f)); //EWOL_DEBUG("Kerning between : '" << (char)listGlyph[iii].m_UVal << "'&'" << (char)listGlyph[kkk].m_UVal << "' value : " << kerning.x << " => " << (kerning.x/64.0f));
} }
@ -271,9 +270,9 @@ void ewol::FontFreeType::GenerateKerning(int32_t fontSize, etk::Vector<ewol::Gly
} }
void ewol::FontFreeType::Display(void) void ewol::FontFreeType::display(void)
{ {
if(false==m_init) { if(false == m_init) {
return; return;
} }
EWOL_INFO(" nuber of glyph = " << (int)m_fftFace->num_glyphs); EWOL_INFO(" nuber of glyph = " << (int)m_fftFace->num_glyphs);
@ -360,10 +359,10 @@ void ewol::FontFreeType::Display(void)
ewol::FontBase* ewol::FontFreeType::Keep(const etk::UString& _filename) ewol::FontBase* ewol::FontFreeType::keep(const etk::UString& _filename)
{ {
EWOL_VERBOSE("KEEP : Font : file : \"" << _filename << "\""); EWOL_VERBOSE("KEEP : Font : file : \"" << _filename << "\"");
ewol::FontBase* object = static_cast<ewol::FontBase*>(GetManager().LocalKeep(_filename)); ewol::FontBase* object = static_cast<ewol::FontBase*>(getManager().localKeep(_filename));
if (NULL != object) { if (NULL != object) {
return object; return object;
} }
@ -373,16 +372,16 @@ ewol::FontBase* ewol::FontFreeType::Keep(const etk::UString& _filename)
EWOL_ERROR("allocation error of a resource : " << _filename); EWOL_ERROR("allocation error of a resource : " << _filename);
return NULL; return NULL;
} }
GetManager().LocalAdd(object); getManager().localAdd(object);
return object; return object;
} }
void ewol::FontFreeType::Release(ewol::FontBase*& _object) void ewol::FontFreeType::release(ewol::FontBase*& _object)
{ {
if (NULL == _object) { if (NULL == _object) {
return; return;
} }
ewol::Resource* object2 = static_cast<ewol::Resource*>(_object); ewol::Resource* object2 = static_cast<ewol::Resource*>(_object);
GetManager().Release(object2); getManager().release(object2);
_object = NULL; _object = NULL;
} }

View File

@ -27,42 +27,42 @@ namespace ewol
int32_t m_FileSize; int32_t m_FileSize;
FT_Face m_fftFace; FT_Face m_fftFace;
bool m_init; bool m_init;
void Display(void); void display(void);
protected: protected:
FontFreeType(const etk::UString& _fontName); FontFreeType(const etk::UString& _fontName);
~FontFreeType(void); ~FontFreeType(void);
public: public:
bool GetGlyphProperty(int32_t _fontSize, bool getGlyphProperty(int32_t _fontSize,
ewol::GlyphProperty& _property); ewol::GlyphProperty& _property);
bool DrawGlyph(egami::Image& _imageOut, bool drawGlyph(egami::Image& _imageOut,
int32_t _fontSize, int32_t _fontSize,
ivec2 _glyphPosition, ivec2 _glyphPosition,
ewol::GlyphProperty& _property, ewol::GlyphProperty& _property,
int8_t _posInImage); int8_t _posInImage);
vec2 GetSize(int32_t _fontSize, const etk::UString& _unicodeString); vec2 getSize(int32_t _fontSize, const etk::UString& _unicodeString);
int32_t GetHeight(int32_t _fontSize); int32_t getHeight(int32_t _fontSize);
void GenerateKerning(int32_t _fontSize, etk::Vector<ewol::GlyphProperty>& _listGlyph); void generateKerning(int32_t _fontSize, etk::Vector<ewol::GlyphProperty>& _listGlyph);
public: public:
/** /**
* @brief Keep the resource pointer. * @brief keep the resource pointer.
* @note Never free this pointer by your own... * @note Never free this pointer by your own...
* @param[in] _filename Name of the base font. * @param[in] _filename Name of the base font.
* @return pointer on the resource or NULL if an error occured. * @return pointer on the resource or NULL if an error occured.
*/ */
static ewol::FontBase* Keep(const etk::UString& _filename); static ewol::FontBase* keep(const etk::UString& _filename);
/** /**
* @brief Release the keeped resources * @brief release the keeped resources
* @param[in,out] reference on the object pointer * @param[in,out] reference on the object pointer
*/ */
static void Release(ewol::FontBase*& _object); static void release(ewol::FontBase*& _object);
}; };
void FreeTypeInit(void); void freeTypeInit(void);
void FreeTypeUnInit(void); void freeTypeUnInit(void);
}; };

View File

@ -16,6 +16,7 @@
#undef __class__ #undef __class__
#define __class__ "TextureFile" #define __class__ "TextureFile"
ewol::TextureFile::TextureFile(const etk::UString& _genName) : ewol::TextureFile::TextureFile(const etk::UString& _genName) :
Texture(_genName) Texture(_genName)
{ {
@ -26,12 +27,12 @@ ewol::TextureFile::TextureFile(const etk::UString& _genName) :
ewol::TextureFile::TextureFile(etk::UString _genName, const etk::UString& _tmpfileName, const ivec2& _size) : ewol::TextureFile::TextureFile(etk::UString _genName, const etk::UString& _tmpfileName, const ivec2& _size) :
Texture(_genName) Texture(_genName)
{ {
if (false == egami::Load(m_data, _tmpfileName, _size)) { if (false == egami::load(m_data, _tmpfileName, _size)) {
EWOL_ERROR("ERROR when loading the image : " << _tmpfileName); EWOL_ERROR("ERROR when loading the image : " << _tmpfileName);
} }
ivec2 tmp = m_data.GetSize(); ivec2 tmp = m_data.getSize();
m_realImageSize = vec2(tmp.x(), tmp.y()); m_realImageSize = vec2(tmp.x(), tmp.y());
Flush(); flush();
} }
@ -57,7 +58,7 @@ static int32_t nextP2(int32_t _value)
ewol::TextureFile* ewol::TextureFile::Keep(const etk::UString& _filename, ivec2 _size) ewol::TextureFile* ewol::TextureFile::keep(const etk::UString& _filename, ivec2 _size)
{ {
EWOL_INFO("KEEP : TextureFile : file : " << _filename << " basic size=" << _size); EWOL_INFO("KEEP : TextureFile : file : " << _filename << " basic size=" << _size);
if (_filename == "") { if (_filename == "") {
@ -66,27 +67,27 @@ ewol::TextureFile* ewol::TextureFile::Keep(const etk::UString& _filename, ivec2
EWOL_ERROR("allocation error of a resource : ??TEX??"); EWOL_ERROR("allocation error of a resource : ??TEX??");
return NULL; return NULL;
} }
GetManager().LocalAdd(object); getManager().localAdd(object);
return object; return object;
} }
if (_size.x()==0) { if (_size.x() == 0) {
_size.setX(-1); _size.setX(-1);
//EWOL_ERROR("Error Request the image size.x() =0 ???"); //EWOL_ERROR("Error Request the image size.x() =0 ???");
} }
if (_size.y()==0) { if (_size.y() == 0) {
_size.setY(-1); _size.setY(-1);
//EWOL_ERROR("Error Request the image size.y() =0 ???"); //EWOL_ERROR("Error Request the image size.y() =0 ???");
} }
etk::UString TmpFilename = _filename; etk::UString TmpFilename = _filename;
if (false == _filename.EndWith(".svg") ) { if (false == _filename.endWith(".svg") ) {
_size = ivec2(-1,-1); _size = ivec2(-1,-1);
} }
#ifdef __TARGET_OS__MacOs #ifdef __TARGET_OS__MacOs
EWOL_ERROR("TODO : Remove this strange hack"); EWOL_ERROR("TODO : remove this strange hack");
_size = ivec2(64,64); _size = ivec2(64,64);
#endif #endif
if (_size.x()>0 && _size.y()>0) { if (_size.x()>0 && _size.y()>0) {
EWOL_VERBOSE(" ==> specific size : " << _size); EWOL_VERBOSE(" == > specific size : " << _size);
#ifdef __TARGET_OS__Android #ifdef __TARGET_OS__Android
_size.setValue(nextP2(_size.x()), nextP2(_size.y())); _size.setValue(nextP2(_size.x()), nextP2(_size.y()));
#endif #endif
@ -97,29 +98,29 @@ ewol::TextureFile* ewol::TextureFile::Keep(const etk::UString& _filename, ivec2
} }
EWOL_INFO("KEEP : TextureFile : file : \"" << TmpFilename << "\" new size=" << _size); EWOL_INFO("KEEP : TextureFile : file : \"" << TmpFilename << "\" new size=" << _size);
ewol::TextureFile* object = static_cast<ewol::TextureFile*>(GetManager().LocalKeep(TmpFilename)); ewol::TextureFile* object = static_cast<ewol::TextureFile*>(getManager().localKeep(TmpFilename));
if (NULL != object) { if (NULL != object) {
return object; return object;
} }
EWOL_INFO(" ==> create new one..."); EWOL_INFO(" == > create new one...");
// need to crate a new one ... // need to crate a new one ...
object = new ewol::TextureFile(TmpFilename, _filename, _size); object = new ewol::TextureFile(TmpFilename, _filename, _size);
if (NULL == object) { if (NULL == object) {
EWOL_ERROR("allocation error of a resource : " << _filename); EWOL_ERROR("allocation error of a resource : " << _filename);
return NULL; return NULL;
} }
GetManager().LocalAdd(object); getManager().localAdd(object);
return object; return object;
} }
void ewol::TextureFile::Release(ewol::TextureFile*& _object) void ewol::TextureFile::release(ewol::TextureFile*& _object)
{ {
if (NULL == _object) { if (NULL == _object) {
return; return;
} }
ewol::Resource* object2 = static_cast<ewol::Resource*>(_object); ewol::Resource* object2 = static_cast<ewol::Resource*>(_object);
GetManager().Release(object2); getManager().release(object2);
_object = NULL; _object = NULL;
} }

View File

@ -26,22 +26,22 @@ namespace ewol
TextureFile(etk::UString _genName, const etk::UString& _fileName, const ivec2& _size); TextureFile(etk::UString _genName, const etk::UString& _fileName, const ivec2& _size);
~TextureFile(void) { }; ~TextureFile(void) { };
public: public:
virtual const char* GetType(void) { return "ewol::TextureFile"; }; virtual const char* getType(void) { return "ewol::TextureFile"; };
const vec2& GetRealSize(void) { return m_realImageSize; }; const vec2& getRealSize(void) { return m_realImageSize; };
public: public:
/** /**
* @brief Keep the resource pointer. * @brief keep the resource pointer.
* @note Never free this pointer by your own... * @note Never free this pointer by your own...
* @param[in] _filename Name of the image file. * @param[in] _filename Name of the image file.
* @param[in] _requested size of the image (usefull when loading .svg to automatic rescale) * @param[in] _requested size of the image (usefull when loading .svg to automatic rescale)
* @return pointer on the resource or NULL if an error occured. * @return pointer on the resource or NULL if an error occured.
*/ */
static ewol::TextureFile* Keep(const etk::UString& _filename, ivec2 _size=ivec2(-1,-1)); static ewol::TextureFile* keep(const etk::UString& _filename, ivec2 _size=ivec2(-1,-1));
/** /**
* @brief Release the keeped resources * @brief release the keeped resources
* @param[in,out] reference on the object pointer * @param[in,out] reference on the object pointer
*/ */
static void Release(ewol::TextureFile*& _object); static void release(ewol::TextureFile*& _object);
}; };
}; };

File diff suppressed because it is too large Load Diff

View File

@ -111,61 +111,61 @@ namespace ewol
Mesh(const etk::UString& _fileName, const etk::UString& _shaderName="DATA:textured3D2.prog"); Mesh(const etk::UString& _fileName, const etk::UString& _shaderName="DATA:textured3D2.prog");
virtual ~Mesh(void); virtual ~Mesh(void);
public: public:
virtual const char* GetType(void) { return "ewol::Mesh"; }; virtual const char* getType(void) { return "ewol::Mesh"; };
virtual void Draw(mat4& _positionMatrix, bool _enableDepthTest=true, bool _enableDepthUpdate=true); virtual void draw(mat4& _positionMatrix, bool _enableDepthTest=true, bool _enableDepthUpdate=true);
void GenerateVBO(void); void generateVBO(void);
private: private:
void CalculateNormaleFace(void); void calculateNormaleFace(void);
void CalculateNormaleEdge(void); void calculateNormaleEdge(void);
public : public :
void CreateViewBox(const etk::UString& _materialName,float _size=1.0); void createViewBox(const etk::UString& _materialName,float _size=1.0);
private: private:
bool LoadOBJ(const etk::UString& _fileName); bool loadOBJ(const etk::UString& _fileName);
bool LoadEMF(const etk::UString& _fileName); bool loadEMF(const etk::UString& _fileName);
public: public:
void AddMaterial(const etk::UString& _name, ewol::Material* _data); void addMaterial(const etk::UString& _name, ewol::Material* _data);
public: public:
/** /**
* @brief Set the check of normal position befor sending it to the openGl card * @brief set the check of normal position befor sending it to the openGl card
* @param[in] _status New state. * @param[in] _status New state.
*/ */
void SetCheckNormal(bool _status) { m_checkNormal=_status; }; void setCheckNormal(bool _status) { m_checkNormal=_status; };
/** /**
* @brief Get the check value of normal position befor sending it to the openGl card * @brief get the check value of normal position befor sending it to the openGl card
* @return Get the chcking stus of normal or not * @return get the chcking stus of normal or not
*/ */
bool GetCheckNormal(void) { return m_checkNormal; }; bool getCheckNormal(void) { return m_checkNormal; };
const etk::Vector<ewol::PhysicsShape*>& GetPhysicalProperties(void) const { return m_physics; }; const etk::Vector<ewol::PhysicsShape*>& getPhysicalProperties(void) const { return m_physics; };
private: private:
void* m_pointerShape; //!< all mesh have a basic shape (bullet or other) the void pointer mermit to not depent on the bullet lib void* m_pointerShape; //!< all mesh have a basic shape (bullet or other) the void pointer mermit to not depent on the bullet lib
public: public:
/** /**
* @brief Set the shape pointer (no type ==> user might know it ...) * @brief set the shape pointer (no type == > user might know it ...)
* @param[in] _shape The new shape (this remove the previous one) * @param[in] _shape The new shape (this remove the previous one)
*/ */
void SetShape(void* _shape); void setShape(void* _shape);
/** /**
* @brief Get the pointer on the shame (no type) * @brief get the pointer on the shame (no type)
* @return Pointer on shape. * @return Pointer on shape.
*/ */
void* GetShape(void) { return m_pointerShape; }; void* getShape(void) { return m_pointerShape; };
private: private:
void (*m_functionFreeShape)(void* _pointer); void (*m_functionFreeShape)(void* _pointer);
public: public:
void SetFreeShapeFunction(void (*_functionFreeShape)(void* _pointer)) { m_functionFreeShape = _functionFreeShape; }; void setFreeShapeFunction(void (*_functionFreeShape)(void* _pointer)) { m_functionFreeShape = _functionFreeShape; };
public: public:
/** /**
* @brief Keep the resource pointer. * @brief keep the resource pointer.
* @note Never free this pointer by your own... * @note Never free this pointer by your own...
* @param[in] _filename Name of the ewol mesh file. * @param[in] _filename Name of the ewol mesh file.
* @return pointer on the resource or NULL if an error occured. * @return pointer on the resource or NULL if an error occured.
*/ */
static ewol::Mesh* Keep(const etk::UString& _meshname); static ewol::Mesh* keep(const etk::UString& _meshname);
/** /**
* @brief Release the keeped resources * @brief release the keeped resources
* @param[in,out] reference on the object pointer * @param[in,out] reference on the object pointer
*/ */
static void Release(ewol::Mesh*& _object); static void release(ewol::Mesh*& _object);
}; };
}; };

Some files were not shown because too many files have changed in this diff Show More