[DEV] update new archi

This commit is contained in:
Edouard DUPIN 2013-12-12 22:59:31 +01:00
parent 3e8b6d8b91
commit 01f409de3a
25 changed files with 632 additions and 645 deletions

View File

@ -17,7 +17,7 @@
static bool isInit = false; static bool isInit = false;
static vec2 ratio(9999999,888888); static vec2 ratio(9999999,888888);
static vec2 invRatio(1,1); static vec2 invRatio(1,1);
static ewol::context::Dimension windowsSize(vec2(9999999,888888), ewol::Dimension::Pixel); static ewol::Dimension windowsSize(vec2(9999999,888888), ewol::Dimension::Pixel);
static const float inchToMillimeter = 1.0f/25.4f; static const float inchToMillimeter = 1.0f/25.4f;
static const float footToMillimeter = 1.0f/304.8f; static const float footToMillimeter = 1.0f/304.8f;
@ -31,87 +31,87 @@ static const float millimeterToCentimeter = 10.0f;
static const float millimeterToKilometer = 1000000.0f; static const float millimeterToKilometer = 1000000.0f;
void ewol::context::Dimension::init(void) { void ewol::Dimension::init(void) {
if (true == isInit) { if (true == isInit) {
return; return;
} }
ewol::context::Dimension conversion(vec2(72,72), ewol::context::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::context::Dimension::Pixel); windowsSize.set(vec2(200,200), ewol::Dimension::Pixel);
isInit = true; isInit = true;
} }
void ewol::context::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::context::Dimension::Pixel); windowsSize.set(vec2(9999999,88888), ewol::Dimension::Pixel);
} }
void ewol::context::Dimension::setPixelRatio(const vec2& _ratio, enum ewol::context::Dimension::distance _type) { void ewol::Dimension::setPixelRatio(const vec2& _ratio, enum ewol::Dimension::distance _type) {
ewol::context::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::context::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::context::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::context::Dimension::getWindowsSize(enum ewol::context::Dimension::distance _type) { vec2 ewol::Dimension::getWindowsSize(enum ewol::Dimension::distance _type) {
return windowsSize.get(_type); return windowsSize.get(_type);
} }
float ewol::context::Dimension::getWindowsDiag(enum ewol::context::Dimension::distance _type) { float ewol::Dimension::getWindowsDiag(enum ewol::Dimension::distance _type) {
vec2 size = ewol::context::Dimension::getWindowsSize(_type); vec2 size = ewol::Dimension::getWindowsSize(_type);
return size.length(); return size.length();
} }
ewol::context::Dimension::Dimension(void) : ewol::Dimension::Dimension(void) :
m_data(0,0), m_data(0,0),
m_type(ewol::context::Dimension::Pixel) { m_type(ewol::Dimension::Pixel) {
// notinh to do ... // notinh to do ...
} }
ewol::context::Dimension::Dimension(const vec2& _size, enum ewol::context::Dimension::distance _type) : ewol::Dimension::Dimension(const vec2& _size, enum ewol::Dimension::distance _type) :
m_data(0,0), m_data(0,0),
m_type(ewol::context::Dimension::Pixel) { m_type(ewol::Dimension::Pixel) {
set(_size, _type); set(_size, _type);
} }
void ewol::context::Dimension::set(std::string _config) { void ewol::Dimension::set(std::string _config) {
m_data.setValue(0,0); m_data.setValue(0,0);
m_type = ewol::context::Dimension::Pixel; m_type = ewol::Dimension::Pixel;
enum distance type = ewol::context::Dimension::Pixel; enum distance type = ewol::Dimension::Pixel;
if (end_with(_config, "%", false) == true) { if (end_with(_config, "%", false) == true) {
type = ewol::context::Dimension::Pourcent; type = ewol::Dimension::Pourcent;
_config.erase(_config.size()-1, 1); _config.erase(_config.size()-1, 1);
} else if (end_with(_config, "px",false) == true) { } else if (end_with(_config, "px",false) == true) {
type = ewol::context::Dimension::Pixel; type = ewol::Dimension::Pixel;
_config.erase(_config.size()-2, 2); _config.erase(_config.size()-2, 2);
} else if (end_with(_config, "ft",false) == true) { } else if (end_with(_config, "ft",false) == true) {
type = ewol::context::Dimension::foot; type = ewol::Dimension::foot;
_config.erase(_config.size()-2, 2); _config.erase(_config.size()-2, 2);
} else if (end_with(_config, "in",false) == true) { } else if (end_with(_config, "in",false) == true) {
type = ewol::context::Dimension::Inch; type = ewol::Dimension::Inch;
_config.erase(_config.size()-2, 2); _config.erase(_config.size()-2, 2);
} else if (end_with(_config, "km",false) == true) { } else if (end_with(_config, "km",false) == true) {
type = ewol::context::Dimension::Kilometer; type = ewol::Dimension::Kilometer;
_config.erase(_config.size()-2, 2); _config.erase(_config.size()-2, 2);
} else if (end_with(_config, "mm",false) == true) { } else if (end_with(_config, "mm",false) == true) {
type = ewol::context::Dimension::Millimeter; type = ewol::Dimension::Millimeter;
_config.erase(_config.size()-2, 2); _config.erase(_config.size()-2, 2);
} else if (end_with(_config, "cm",false) == true) { } else if (end_with(_config, "cm",false) == true) {
type = ewol::context::Dimension::Centimeter; type = ewol::Dimension::Centimeter;
_config.erase(_config.size()-2, 2); _config.erase(_config.size()-2, 2);
} else if (end_with(_config, "m",false) == true) { } else if (end_with(_config, "m",false) == true) {
type = ewol::context::Dimension::Meter; type = ewol::Dimension::Meter;
_config.erase(_config.size()-1, 1); _config.erase(_config.size()-1, 1);
} else { } else {
EWOL_CRITICAL("Can not parse dimention : \"" << _config << "\""); EWOL_CRITICAL("Can not parse dimention : \"" << _config << "\"");
@ -122,104 +122,104 @@ void ewol::context::Dimension::set(std::string _config) {
EWOL_VERBOSE(" config dimention : \"" << _config << "\" == > " << *this ); EWOL_VERBOSE(" config dimention : \"" << _config << "\" == > " << *this );
} }
ewol::context::Dimension::~Dimension(void) { ewol::Dimension::~Dimension(void) {
// nothing to do ... // nothing to do ...
} }
ewol::context::Dimension::operator std::string(void) const { ewol::Dimension::operator std::string(void) const {
std::string str; std::string str;
str = get(getType()); str = get(getType());
switch(getType()) { switch(getType()) {
case ewol::context::Dimension::Pourcent: case ewol::Dimension::Pourcent:
str += "%"; str += "%";
break; break;
case ewol::context::Dimension::Pixel: case ewol::Dimension::Pixel:
str += "px"; str += "px";
break; break;
case ewol::context::Dimension::Meter: case ewol::Dimension::Meter:
str += "m"; str += "m";
break; break;
case ewol::context::Dimension::Centimeter: case ewol::Dimension::Centimeter:
str += "cm"; str += "cm";
break; break;
case ewol::context::Dimension::Millimeter: case ewol::Dimension::Millimeter:
str += "mm"; str += "mm";
break; break;
case ewol::context::Dimension::Kilometer: case ewol::Dimension::Kilometer:
str += "km"; str += "km";
break; break;
case ewol::context::Dimension::Inch: case ewol::Dimension::Inch:
str += "in"; str += "in";
break; break;
case ewol::context::Dimension::foot: case ewol::Dimension::foot:
str += "ft"; str += "ft";
break; break;
} }
return str; return str;
} }
vec2 ewol::context::Dimension::get(enum ewol::context::Dimension::distance _type) const { vec2 ewol::Dimension::get(enum ewol::Dimension::distance _type) const {
switch(_type) { switch(_type) {
case ewol::context::Dimension::Pourcent: case ewol::Dimension::Pourcent:
return getPourcent(); return getPourcent();
case ewol::context::Dimension::Pixel: case ewol::Dimension::Pixel:
return getPixel(); return getPixel();
case ewol::context::Dimension::Meter: case ewol::Dimension::Meter:
return getMeter(); return getMeter();
case ewol::context::Dimension::Centimeter: case ewol::Dimension::Centimeter:
return getCentimeter(); return getCentimeter();
case ewol::context::Dimension::Millimeter: case ewol::Dimension::Millimeter:
return getMillimeter(); return getMillimeter();
case ewol::context::Dimension::Kilometer: case ewol::Dimension::Kilometer:
return getKilometer(); return getKilometer();
case ewol::context::Dimension::Inch: case ewol::Dimension::Inch:
return getInch(); return getInch();
case ewol::context::Dimension::foot: case ewol::Dimension::foot:
return getFoot(); return getFoot();
} }
return vec2(0,0); return vec2(0,0);
} }
void ewol::context::Dimension::set(const vec2& _size, enum ewol::context::Dimension::distance _type) { void ewol::Dimension::set(const vec2& _size, enum ewol::Dimension::distance _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) {
case ewol::context::Dimension::Pourcent: { case ewol::Dimension::Pourcent: {
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::context::Dimension::Pixel: case ewol::Dimension::Pixel:
m_data = size; m_data = size;
break; break;
case ewol::context::Dimension::Meter: case ewol::Dimension::Meter:
m_data = vec2(size.x()*meterToMillimeter*ratio.x(), size.y()*meterToMillimeter*ratio.y()); m_data = vec2(size.x()*meterToMillimeter*ratio.x(), size.y()*meterToMillimeter*ratio.y());
break; break;
case ewol::context::Dimension::Centimeter: case ewol::Dimension::Centimeter:
m_data = vec2(size.x()*centimeterToMillimeter*ratio.x(), size.y()*centimeterToMillimeter*ratio.y()); m_data = vec2(size.x()*centimeterToMillimeter*ratio.x(), size.y()*centimeterToMillimeter*ratio.y());
break; break;
case ewol::context::Dimension::Millimeter: case ewol::Dimension::Millimeter:
m_data = vec2(size.x()*ratio.x(), size.y()*ratio.y()); m_data = vec2(size.x()*ratio.x(), size.y()*ratio.y());
break; break;
case ewol::context::Dimension::Kilometer: case ewol::Dimension::Kilometer:
m_data = vec2(size.x()*kilometerToMillimeter*ratio.x(), size.y()*kilometerToMillimeter*ratio.y()); m_data = vec2(size.x()*kilometerToMillimeter*ratio.x(), size.y()*kilometerToMillimeter*ratio.y());
break; break;
case ewol::context::Dimension::Inch: case ewol::Dimension::Inch:
m_data = vec2(size.x()*inchToMillimeter*ratio.x(), size.y()*inchToMillimeter*ratio.y()); m_data = vec2(size.x()*inchToMillimeter*ratio.x(), size.y()*inchToMillimeter*ratio.y());
break; break;
case ewol::context::Dimension::foot: case ewol::Dimension::foot:
m_data = vec2(size.x()*footToMillimeter*ratio.x(), size.y()*footToMillimeter*ratio.y()); m_data = vec2(size.x()*footToMillimeter*ratio.x(), size.y()*footToMillimeter*ratio.y());
break; break;
} }
m_type = _type; m_type = _type;
} }
vec2 ewol::context::Dimension::getPixel(void) const { vec2 ewol::Dimension::getPixel(void) const {
if (m_type!=ewol::context::Dimension::Pourcent) { if (m_type!=ewol::Dimension::Pourcent) {
return m_data; return m_data;
} else { } else {
vec2 windDim = windowsSize.getPixel(); vec2 windDim = windowsSize.getPixel();
@ -229,8 +229,8 @@ vec2 ewol::context::Dimension::getPixel(void) const {
} }
} }
vec2 ewol::context::Dimension::getPourcent(void) const { vec2 ewol::Dimension::getPourcent(void) const {
if (m_type!=ewol::context::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());
@ -240,61 +240,61 @@ vec2 ewol::context::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::context::Dimension::getMeter(void) const { vec2 ewol::Dimension::getMeter(void) const {
return ewol::context::Dimension::getMillimeter()*millimeterToMeter; return ewol::Dimension::getMillimeter()*millimeterToMeter;
} }
vec2 ewol::context::Dimension::getCentimeter(void) const { vec2 ewol::Dimension::getCentimeter(void) const {
return ewol::context::Dimension::getMillimeter()*millimeterToCentimeter; return ewol::Dimension::getMillimeter()*millimeterToCentimeter;
} }
vec2 ewol::context::Dimension::getMillimeter(void) const { vec2 ewol::Dimension::getMillimeter(void) const {
return ewol::context::Dimension::getPixel()*invRatio; return ewol::Dimension::getPixel()*invRatio;
} }
vec2 ewol::context::Dimension::getKilometer(void) const { vec2 ewol::Dimension::getKilometer(void) const {
return ewol::context::Dimension::getMillimeter()*millimeterToKilometer; return ewol::Dimension::getMillimeter()*millimeterToKilometer;
} }
vec2 ewol::context::Dimension::getInch(void) const { vec2 ewol::Dimension::getInch(void) const {
return ewol::context::Dimension::getMillimeter()*millimeterToInch; return ewol::Dimension::getMillimeter()*millimeterToInch;
} }
vec2 ewol::context::Dimension::getFoot(void) const { vec2 ewol::Dimension::getFoot(void) const {
return ewol::context::Dimension::getMillimeter()*millimeterToFoot; return ewol::Dimension::getMillimeter()*millimeterToFoot;
} }
etk::CCout& ewol::operator <<(etk::CCout& _os, enum ewol::context::Dimension::distance _obj) { etk::CCout& ewol::operator <<(etk::CCout& _os, enum ewol::Dimension::distance _obj) {
switch(_obj) { switch(_obj) {
case ewol::context::Dimension::Pourcent: case ewol::Dimension::Pourcent:
_os << "%"; _os << "%";
break; break;
case ewol::context::Dimension::Pixel: case ewol::Dimension::Pixel:
_os << "px"; _os << "px";
break; break;
case ewol::context::Dimension::Meter: case ewol::Dimension::Meter:
_os << "m"; _os << "m";
break; break;
case ewol::context::Dimension::Centimeter: case ewol::Dimension::Centimeter:
_os << "cm"; _os << "cm";
break; break;
case ewol::context::Dimension::Millimeter: case ewol::Dimension::Millimeter:
_os << "mm"; _os << "mm";
break; break;
case ewol::context::Dimension::Kilometer: case ewol::Dimension::Kilometer:
_os << "km"; _os << "km";
break; break;
case ewol::context::Dimension::Inch: case ewol::Dimension::Inch:
_os << "in"; _os << "in";
break; break;
case ewol::context::Dimension::foot: case ewol::Dimension::foot:
_os << "ft"; _os << "ft";
break; break;
} }
return _os; return _os;
} }
etk::CCout& ewol::operator <<(etk::CCout& _os, const ewol::context::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;
} }

212
sources/ewol/Dimension.h Normal file
View File

@ -0,0 +1,212 @@
/**
* @author Edouard DUPIN
*
* @copyright 2011, Edouard DUPIN, all right reserved
*
* @license BSD v3 (see license file)
*/
#ifndef __EWOL_DIMENSION_H__
#define __EWOL_DIMENSION_H__
#include <etk/types.h>
#include <etk/UString.h>
#include <etk/math/Vector2D.h>
namespace ewol {
/**
* @brief in the dimention class we store the data as the more usefull unit (pixel)
* but one case need to be dynamic the %, then when requested in % the register the % value
*/
class Dimension {
public:
enum distance {
Pourcent=0,
Pixel,
Meter,
Centimeter,
Millimeter,
Kilometer,
Inch,
foot,
};
private:
vec2 m_data;
enum distance m_type;
public:
/**
* @brief Constructor (default :0,0 mode pixel)
*/
Dimension(void);
/**
* @brief Constructor
* @param[in] _size Requested dimention
* @param[in] _type Unit of the Dimention
*/
Dimension(const vec2& _size, enum ewol::Dimension::distance _type=ewol::Dimension::Pixel);
/**
* @brief Constructor
* @param[in] _config dimension configuration.
*/
Dimension(const std::string& _config) :
m_data(0,0),
m_type(ewol::Dimension::Pixel) {
set(_config);
};
/**
* @brief Constructor
* @param[in] _config dimension configuration.
*/
Dimension(const char* _config) :
m_data(0,0),
m_type(ewol::Dimension::Pixel) {
set(_config);
};
/**
* @brief Destructor
*/
~Dimension(void);
/**
* @brief string cast :
*/
operator std::string(void) const;
/**
* @brief get the current dimention in requested type
* @param[in] _type Type of unit requested.
* @return dimention requested.
*/
vec2 get(enum distance _type) const;
/**
* @brief set the current dimention in requested type
* @param[in] _size Dimention to set
* @param[in] _type Type of unit requested.
*/
void set(const vec2& _size, enum distance _type);
private:
/**
* @brief set the current dimention in requested type
* @param[in] _config dimension configuration.
*/
void set(std::string _config);
public:
/**
* @brief get the current dimention in pixel
* @return dimention in Pixel
*/
vec2 getPixel(void) const;
/**
* @brief get the current dimention in Pourcent
* @return dimention in Pourcent
*/
vec2 getPourcent(void) const;
/**
* @brief get the current dimention in Meter
* @return dimention in Meter
*/
vec2 getMeter(void) const;
/**
* @brief get the current dimention in Centimeter
* @return dimention in Centimeter
*/
vec2 getCentimeter(void) const;
/**
* @brief get the current dimention in Millimeter
* @return dimention in Millimeter
*/
vec2 getMillimeter(void) const;
/**
* @brief get the current dimention in Kilometer
* @return dimention in Kilometer
*/
vec2 getKilometer(void) const;
/**
* @brief get the current dimention in Inch
* @return dimention in Inch
*/
vec2 getInch(void) const;
/**
* @brief get the current dimention in Foot
* @return dimention in Foot
*/
vec2 getFoot(void) const;
/*****************************************************
* = assigment
*****************************************************/
const Dimension& operator= (const Dimension& _obj ) {
if (this!=&_obj) {
m_data = _obj.m_data;
m_type = _obj.m_type;
}
return *this;
}
/*****************************************************
* == operator
*****************************************************/
bool operator == (const Dimension& _obj) const {
if( m_data == _obj.m_data
&& m_type == _obj.m_type) {
return true;
}
return false;
}
/*****************************************************
* != operator
*****************************************************/
bool operator!= (const Dimension& _obj) const {
if( m_data != _obj.m_data
|| m_type != _obj.m_type) {
return true;
}
return false;
}
/**
* @breif get the dimension type
* @return the type
*/
enum distance getType(void) const {
return m_type;
};
public : // Global static access :
/**
* @brief basic init
*/
static void init(void);
/**
* @brief basic un-init
*/
static void unInit(void);
/**
* @brief set the Milimeter ratio for calculation
* @param[in] Ratio Milimeter ration for the screen calculation interpolation
* @param[in] type Unit type requested.
* @note: same as @ref setPixelPerInch (internal manage convertion)
*/
static void setPixelRatio(const vec2& _ratio, enum ewol::Dimension::distance _type);
/**
* @brief set the current Windows size
* @param[in] size size of the current windows in pixel.
*/
static void setPixelWindowsSize(const vec2& _size);
/**
* @brief get the Windows size in the request unit
* @param[in] type Unit type requested.
* @return the requested size
*/
static vec2 getWindowsSize(enum ewol::Dimension::distance _type);
/**
* @brief get the Windows diagonal size in the request unit
* @param[in] type Unit type requested.
* @return the requested size
*/
static float getWindowsDiag(enum ewol::Dimension::distance _type);
};
etk::CCout& operator <<(etk::CCout& _os, enum ewol::Dimension::distance _obj);
etk::CCout& operator <<(etk::CCout& _os, const ewol::Dimension& _obj);
};
#endif

View File

@ -183,7 +183,7 @@ void ewol::compositing::Text::reset(void) {
m_previousCharcode = 0; m_previousCharcode = 0;
m_startTextpos = 0; m_startTextpos = 0;
m_stopTextPos = 0; m_stopTextPos = 0;
m_alignement = ewol::Text::alignDisable; m_alignement = alignDisable;
m_htmlCurrrentLine = ""; m_htmlCurrrentLine = "";
m_selectionStartPos = -100; m_selectionStartPos = -100;
m_cursorPos = -100; m_cursorPos = -100;
@ -289,7 +289,7 @@ void ewol::compositing::Text::setFontName(const std::string& _fontName) {
void ewol::compositing::Text::setFont(std::string _fontName, int32_t _fontSize) { void ewol::compositing::Text::setFont(std::string _fontName, int32_t _fontSize) {
clear(); clear();
// remove old one // remove old one
ewol::TexturedFont * previousFont = m_font; ewol::resource::TexturedFont * previousFont = m_font;
if (_fontSize <= 0) { if (_fontSize <= 0) {
_fontSize = ewol::getContext().getFontDefault().getSize(); _fontSize = ewol::getContext().getFontDefault().getSize();
} }
@ -300,12 +300,12 @@ void ewol::compositing::Text::setFont(std::string _fontName, int32_t _fontSize)
_fontName += std::to_string(_fontSize); _fontName += std::to_string(_fontSize);
EWOL_VERBOSE("plop : " << _fontName << " size=" << _fontSize << " result :" << _fontName); EWOL_VERBOSE("plop : " << _fontName << " size=" << _fontSize << " result :" << _fontName);
// link to new one // link to new one
m_font = ewol::TexturedFont::keep(_fontName); m_font = ewol::resource::TexturedFont::keep(_fontName);
if (m_font == NULL) { if (m_font == NULL) {
EWOL_ERROR("Can not get font resource"); EWOL_ERROR("Can not get font resource");
m_font = previousFont; m_font = previousFont;
} else { } else {
ewol::TexturedFont::release(previousFont); ewol::resource::TexturedFont::release(previousFont);
} }
} }
@ -315,7 +315,7 @@ void ewol::compositing::Text::setFontMode(enum ewol::font::mode _mode) {
} }
} }
enum ewol::font::mode ewol::Text::getFontMode(void) { enum ewol::font::mode ewol::compositing::Text::getFontMode(void) {
return m_mode; return m_mode;
} }
@ -440,29 +440,29 @@ void ewol::compositing::Text::parseHtmlNode(exml::Element* _element) {
|| compare_no_case(elem->getValue(), "paragraph") == true) { || compare_no_case(elem->getValue(), "paragraph") == true) {
EWOL_VERBOSE("XML paragraph ..."); EWOL_VERBOSE("XML paragraph ...");
htmlFlush(); htmlFlush();
m_alignement = ewol::Text::alignLeft; m_alignement = alignLeft;
forceLineReturn(); forceLineReturn();
parseHtmlNode(elem); parseHtmlNode(elem);
forceLineReturn(); forceLineReturn();
} else if (compare_no_case(elem->getValue(), "center") == true) { } else if (compare_no_case(elem->getValue(), "center") == true) {
EWOL_VERBOSE("XML center ..."); EWOL_VERBOSE("XML center ...");
htmlFlush(); htmlFlush();
m_alignement = ewol::Text::alignCenter; m_alignement = alignCenter;
parseHtmlNode(elem); parseHtmlNode(elem);
} else if (compare_no_case(elem->getValue(), "left") == true) { } else if (compare_no_case(elem->getValue(), "left") == true) {
EWOL_VERBOSE("XML left ..."); EWOL_VERBOSE("XML left ...");
htmlFlush(); htmlFlush();
m_alignement = ewol::Text::alignLeft; m_alignement = alignLeft;
parseHtmlNode(elem); parseHtmlNode(elem);
} else if (compare_no_case(elem->getValue(), "right") == true) { } else if (compare_no_case(elem->getValue(), "right") == true) {
EWOL_VERBOSE("XML right ..."); EWOL_VERBOSE("XML right ...");
htmlFlush(); htmlFlush();
m_alignement = ewol::Text::alignRight; m_alignement = alignRight;
parseHtmlNode(elem); parseHtmlNode(elem);
} else if (compare_no_case(elem->getValue(), "justify") == true) { } else if (compare_no_case(elem->getValue(), "justify") == true) {
EWOL_VERBOSE("XML justify ..."); EWOL_VERBOSE("XML justify ...");
htmlFlush(); htmlFlush();
m_alignement = ewol::Text::alignJustify; m_alignement = alignJustify;
parseHtmlNode(elem); parseHtmlNode(elem);
} else { } else {
EWOL_ERROR("(l "<< elem->getPos() << ") node not suported type : " << elem->getType() << " val=\""<< elem->getValue() << "\"" ); EWOL_ERROR("(l "<< elem->getPos() << ") node not suported type : " << elem->getType() << " val=\""<< elem->getValue() << "\"" );
@ -513,7 +513,7 @@ void ewol::compositing::Text::print(const std::string& _text, const std::vector<
} }
etk::Color<> tmpFg(m_color); etk::Color<> tmpFg(m_color);
etk::Color<> tmpBg(m_colorBg); etk::Color<> tmpBg(m_colorBg);
if (m_alignement == ewol::Text::alignDisable) { if (m_alignement == alignDisable) {
//EWOL_DEBUG(" 1 print in not alligned mode : start=" << m_sizeDisplayStart << " stop=" << m_sizeDisplayStop << " pos=" << m_position); //EWOL_DEBUG(" 1 print in not alligned mode : start=" << m_sizeDisplayStart << " stop=" << m_sizeDisplayStop << " pos=" << m_position);
// display the cursor if needed (if it is at the start position...) // display the cursor if needed (if it is at the start position...)
if (m_needDisplay == true) { if (m_needDisplay == true) {
@ -581,16 +581,16 @@ void ewol::compositing::Text::print(const std::string& _text, const std::vector<
bool needNoJustify = extrapolateLastId(_text, currentId, stop, space, freeSpace); bool needNoJustify = extrapolateLastId(_text, currentId, stop, space, freeSpace);
float interpolation = basicSpaceWidth; float interpolation = basicSpaceWidth;
switch (m_alignement) { switch (m_alignement) {
case ewol::Text::alignJustify: case alignJustify:
if (needNoJustify == false) { if (needNoJustify == false) {
interpolation += (float)freeSpace / (float)(space-1); interpolation += (float)freeSpace / (float)(space-1);
} }
break; break;
case ewol::Text::alignDisable: // must not came from here ... case alignDisable: // must not came from here ...
case ewol::Text::alignLeft: case alignLeft:
// nothing to do ... // nothing to do ...
break; break;
case ewol::Text::alignRight: case alignRight:
if (m_needDisplay == true) { if (m_needDisplay == true) {
// Move the first char at the right : // Move the first char at the right :
setPos(vec3(m_position.x() + freeSpace, setPos(vec3(m_position.x() + freeSpace,
@ -598,7 +598,7 @@ void ewol::compositing::Text::print(const std::string& _text, const std::vector<
m_position.z()) ); m_position.z()) );
} }
break; break;
case ewol::Text::alignCenter: case alignCenter:
if (m_needDisplay == true) { if (m_needDisplay == true) {
// Move the first char at the right : // Move the first char at the right :
setPos(vec3(m_position.x() + freeSpace/2, setPos(vec3(m_position.x() + freeSpace/2,
@ -702,7 +702,7 @@ void ewol::compositing::Text::print(const std::u32string& _text, const std::vect
} }
etk::Color<> tmpFg(m_color); etk::Color<> tmpFg(m_color);
etk::Color<> tmpBg(m_colorBg); etk::Color<> tmpBg(m_colorBg);
if (m_alignement == ewol::Text::alignDisable) { if (m_alignement == alignDisable) {
//EWOL_DEBUG(" 1 print in not alligned mode : start=" << m_sizeDisplayStart << " stop=" << m_sizeDisplayStop << " pos=" << m_position); //EWOL_DEBUG(" 1 print in not alligned mode : start=" << m_sizeDisplayStart << " stop=" << m_sizeDisplayStop << " pos=" << m_position);
// display the cursor if needed (if it is at the start position...) // display the cursor if needed (if it is at the start position...)
if (m_needDisplay == true) { if (m_needDisplay == true) {
@ -770,16 +770,16 @@ void ewol::compositing::Text::print(const std::u32string& _text, const std::vect
bool needNoJustify = extrapolateLastId(_text, currentId, stop, space, freeSpace); bool needNoJustify = extrapolateLastId(_text, currentId, stop, space, freeSpace);
float interpolation = basicSpaceWidth; float interpolation = basicSpaceWidth;
switch (m_alignement) { switch (m_alignement) {
case ewol::Text::alignJustify: case alignJustify:
if (needNoJustify == false) { if (needNoJustify == false) {
interpolation += (float)freeSpace / (float)(space-1); interpolation += (float)freeSpace / (float)(space-1);
} }
break; break;
case ewol::Text::alignDisable: // must not came from here ... case alignDisable: // must not came from here ...
case ewol::Text::alignLeft: case alignLeft:
// nothing to do ... // nothing to do ...
break; break;
case ewol::Text::alignRight: case alignRight:
if (m_needDisplay == true) { if (m_needDisplay == true) {
// Move the first char at the right : // Move the first char at the right :
setPos(vec3(m_position.x() + freeSpace, setPos(vec3(m_position.x() + freeSpace,
@ -787,7 +787,7 @@ void ewol::compositing::Text::print(const std::u32string& _text, const std::vect
m_position.z()) ); m_position.z()) );
} }
break; break;
case ewol::Text::alignCenter: case alignCenter:
if (m_needDisplay == true) { if (m_needDisplay == true) {
// Move the first char at the right : // Move the first char at the right :
setPos(vec3(m_position.x() + freeSpace/2, setPos(vec3(m_position.x() + freeSpace/2,
@ -1061,7 +1061,7 @@ void ewol::compositing::Text::forceLineReturn(void) {
setPos(vec3(m_startTextpos, m_position.y() - m_font->getHeight(m_mode), 0) ); setPos(vec3(m_startTextpos, m_position.y() - m_font->getHeight(m_mode), 0) );
} }
void ewol::compositing::Text::setTextAlignement(float _startTextpos, float _stopTextPos, enum ewol::Text::aligneMode _alignement) { void ewol::compositing::Text::setTextAlignement(float _startTextpos, float _stopTextPos, enum ewol::compositing::Text::aligneMode _alignement) {
m_startTextpos = _startTextpos; m_startTextpos = _startTextpos;
m_stopTextPos = _stopTextPos+1; m_stopTextPos = _stopTextPos+1;
m_alignement = _alignement; m_alignement = _alignement;
@ -1075,7 +1075,7 @@ enum ewol::compositing::Text::aligneMode ewol::compositing::Text::getAlignement(
} }
void ewol::compositing::Text::disableAlignement(void) { void ewol::compositing::Text::disableAlignement(void) {
m_alignement = ewol::Text::alignDisable; m_alignement = alignDisable;
} }
vec3 ewol::compositing::Text::calculateSizeHTML(const std::string& _text) { vec3 ewol::compositing::Text::calculateSizeHTML(const std::string& _text) {

View File

@ -6,8 +6,8 @@
* @license BSD v3 (see license file) * @license BSD v3 (see license file)
*/ */
#include <ewol/renderer/ConfigFont.h> #include <ewol/context/ConfigFont.h>
#include <ewol/resources/FontFreeType.h> #include <ewol/resource/FontFreeType.h>
#undef __class__ #undef __class__
#define __class__ "context::ConfigFont" #define __class__ "context::ConfigFont"
@ -17,12 +17,12 @@ ewol::context::ConfigFont::ConfigFont(void) :
m_name("Arial;Helvetica"), m_name("Arial;Helvetica"),
m_size(10), m_size(10),
m_useExternal(false) { m_useExternal(false) {
ewol::freeTypeInit(); ewol::resource::freeTypeInit();
} }
ewol::context::ConfigFont::~ConfigFont(void) { ewol::context::ConfigFont::~ConfigFont(void) {
// UnInit FreeTypes // UnInit FreeTypes
ewol::freeTypeUnInit(); ewol::resource::freeTypeUnInit();
} }
void ewol::context::ConfigFont::set(const std::string& _fontName, int32_t _size) { void ewol::context::ConfigFont::set(const std::string& _fontName, int32_t _size) {

View File

@ -10,24 +10,25 @@
#include <etk/types.h> #include <etk/types.h>
#include <ewol/ewol.h>
#include <ewol/Dimension.h>
#include <ewol/debug.h>
#include <ewol/renderer/EObject.h>
#include <ewol/renderer/EObjectManager.h>
#include <ewol/renderer/eContext.h>
#include <ewol/resources/ResourceManager.h>
#include <ewol/renderer/openGL.h>
#include <ewol/widget/WidgetManager.h>
#include <etk/os/FSNode.h> #include <etk/os/FSNode.h>
#include <etk/os/Mutex.h> #include <etk/os/Mutex.h>
#include <date/date.h> #include <date/date.h>
#include <ewol/ewol.h>
#include <ewol/Dimension.h>
#include <ewol/debug.h>
#include <ewol/object/Object.h>
#include <ewol/object/Manager.h>
#include <ewol/context/Context.h>
#include <ewol/resource/Manager.h>
#include <ewol/openGL/openGL.h>
#include <ewol/widget/Manager.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.
@ -39,8 +40,8 @@ static etk::Mutex& mutexInterface(void) {
} }
static ewol::eContext* l_curentInterface=NULL; static ewol::Context* l_curentInterface=NULL;
ewol::eContext& ewol::getContext(void) { ewol::Context& ewol::getContext(void) {
#if DEBUG_LEVEL > 2 #if DEBUG_LEVEL > 2
if(NULL == l_curentInterface){ if(NULL == l_curentInterface){
EWOL_CRITICAL("[CRITICAL] try acces at an empty interface"); EWOL_CRITICAL("[CRITICAL] try acces at an empty interface");
@ -53,7 +54,7 @@ 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::Context::lockContext(void) {
mutexInterface().lock(); mutexInterface().lock();
l_curentInterface = this; l_curentInterface = this;
} }
@ -62,7 +63,7 @@ void ewol::eContext::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 ewol::eContext::unLockContext(void) { void ewol::Context::unLockContext(void) {
l_curentInterface = NULL; l_curentInterface = NULL;
mutexInterface().unLock(); mutexInterface().unLock();
} }
@ -91,9 +92,9 @@ namespace ewol {
// specify the message type // specify the message type
enum theadMessage TypeMessage; enum theadMessage TypeMessage;
// can not set a union ... // can not set a union ...
enum ewol::clipBoard::clipboardListe clipboardID; enum ewol::context::clipBoard::clipboardListe clipboardID;
// InputId // InputId
enum ewol::keyEvent::type inputType; enum ewol::key::type inputType;
int32_t inputId; int32_t inputId;
// generic dimentions // generic dimentions
vec2 dimention; vec2 dimention;
@ -101,19 +102,19 @@ namespace ewol {
bool repeateKey; //!< special flag for the repeating key on the PC interface bool repeateKey; //!< special flag for the repeating key on the PC interface
bool stateIsDown; bool stateIsDown;
char32_t keyboardChar; char32_t keyboardChar;
enum ewol::keyEvent::keyboard keyboardMove; enum ewol::key::keyboard keyboardMove;
ewol::SpecialKey keyboardSpecial; ewol::key::Special keyboardSpecial;
eSystemMessage(void) : eSystemMessage(void) :
TypeMessage(msgNone), TypeMessage(msgNone),
clipboardID(ewol::clipBoard::clipboardStd), clipboardID(ewol::context::clipBoard::clipboardStd),
inputType(ewol::keyEvent::typeUnknow), inputType(ewol::key::typeUnknow),
inputId(-1), inputId(-1),
dimention(0,0), dimention(0,0),
repeateKey(false), repeateKey(false),
stateIsDown(false), stateIsDown(false),
keyboardChar(0), keyboardChar(0),
keyboardMove(ewol::keyEvent::keyboardUnknow) keyboardMove(ewol::key::keyboardUnknow)
{ {
} }
@ -121,21 +122,21 @@ namespace ewol {
}; };
void ewol::eContext::inputEventTransfertWidget(ewol::Widget* _source, void ewol::Context::inputEventTransfertWidget(ewol::Widget* _source,
ewol::Widget* _destination) { ewol::Widget* _destination) {
m_input.transfertEvent(_source, _destination); m_input.transfertEvent(_source, _destination);
} }
void ewol::eContext::inputEventGrabPointer(ewol::Widget* _widget) { void ewol::Context::inputEventGrabPointer(ewol::Widget* _widget) {
m_input.grabPointer(_widget); m_input.grabPointer(_widget);
} }
void ewol::eContext::inputEventUnGrabPointer(void) { void ewol::Context::inputEventUnGrabPointer(void) {
m_input.unGrabPointer(); m_input.unGrabPointer();
} }
void ewol::eContext::processEvents(void) { void ewol::Context::processEvents(void) {
int32_t nbEvent = 0; int32_t nbEvent = 0;
//EWOL_DEBUG(" ******** Event"); //EWOL_DEBUG(" ******** Event");
ewol::eSystemMessage* data = NULL; ewol::eSystemMessage* data = NULL;
@ -159,7 +160,7 @@ void ewol::eContext::processEvents(void) {
case eSystemMessage::msgResize: case eSystemMessage::msgResize:
//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 eSystemMessage::msgInputMotion: case eSystemMessage::msgInputMotion:
@ -193,22 +194,22 @@ void ewol::eContext::processEvents(void) {
data->stateIsDown) ) { data->stateIsDown) ) {
// generate the direct event ... // generate the direct event ...
if (data->TypeMessage == eSystemMessage::msgKeyboardKey) { if (data->TypeMessage == eSystemMessage::msgKeyboardKey) {
ewol::EventEntrySystem tmpEntryEvent(ewol::keyEvent::keyboardChar, ewol::event::EntrySystem tmpEntryEvent(ewol::key::keyboardChar,
ewol::keyEvent::statusUp, ewol::key::statusUp,
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::key::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::event::EntrySystem tmpEntryEvent(data->keyboardMove,
ewol::keyEvent::statusUp, ewol::key::statusUp,
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::key::statusDown);
} }
tmpWidget->systemEventEntry(tmpEntryEvent); tmpWidget->systemEventEntry(tmpEntryEvent);
} }
@ -245,7 +246,7 @@ void ewol::eContext::processEvents(void) {
} }
} }
void ewol::eContext::setArchiveDir(int _mode, const char* _str) { void ewol::Context::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);
@ -270,7 +271,7 @@ void ewol::eContext::setArchiveDir(int _mode, const char* _str) {
ewol::eContext::eContext(int32_t _argc, const char* _argv[]) : ewol::Context::Context(int32_t _argc, const char* _argv[]) :
m_previousDisplayTime(0), m_previousDisplayTime(0),
m_input(*this), m_input(*this),
#if defined(__TARGET_OS__Android) #if defined(__TARGET_OS__Android)
@ -343,7 +344,7 @@ ewol::eContext::eContext(int32_t _argc, const char* _argv[]) :
EWOL_INFO(" == > Ewol system init (END)"); EWOL_INFO(" == > Ewol system init (END)");
} }
ewol::eContext::~eContext(void) { ewol::Context::~Context(void) {
EWOL_INFO(" == > Ewol system Un-Init (BEGIN)"); EWOL_INFO(" == > Ewol system Un-Init (BEGIN)");
// TODO : Clean the message list ... // TODO : Clean the message list ...
// set the curent interface : // set the curent interface :
@ -364,7 +365,7 @@ ewol::eContext::~eContext(void) {
EWOL_INFO(" == > Ewol system Un-Init (END)"); EWOL_INFO(" == > Ewol system Un-Init (END)");
} }
void ewol::eContext::requestUpdateSize(void) { void ewol::Context::requestUpdateSize(void) {
ewol::eSystemMessage *data = new ewol::eSystemMessage(); ewol::eSystemMessage *data = new ewol::eSystemMessage();
if (data == NULL) { if (data == NULL) {
EWOL_ERROR("allocationerror of message"); EWOL_ERROR("allocationerror of message");
@ -374,9 +375,9 @@ void ewol::eContext::requestUpdateSize(void) {
m_msgSystem.post(data); m_msgSystem.post(data);
} }
void ewol::eContext::OS_Resize(const vec2& _size) { void ewol::Context::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);
ewol::eSystemMessage *data = new ewol::eSystemMessage(); ewol::eSystemMessage *data = new ewol::eSystemMessage();
if (data == NULL) { if (data == NULL) {
EWOL_ERROR("allocationerror of message"); EWOL_ERROR("allocationerror of message");
@ -386,7 +387,7 @@ void ewol::eContext::OS_Resize(const vec2& _size) {
data->dimention = _size; data->dimention = _size;
m_msgSystem.post(data); m_msgSystem.post(data);
} }
void ewol::eContext::OS_Move(const vec2& _pos) { void ewol::Context::OS_Move(const vec2& _pos) {
/* /*
ewol::eSystemMessage *data = new ewol::eSystemMessage(); ewol::eSystemMessage *data = new ewol::eSystemMessage();
data->TypeMessage = eSystemMessage::msgResize; data->TypeMessage = eSystemMessage::msgResize;
@ -396,61 +397,61 @@ void ewol::eContext::OS_Move(const vec2& _pos) {
*/ */
} }
void ewol::eContext::OS_SetInputMotion(int _pointerID, const vec2& _pos ) { void ewol::Context::OS_SetInputMotion(int _pointerID, const vec2& _pos ) {
ewol::eSystemMessage *data = new ewol::eSystemMessage(); ewol::eSystemMessage *data = new ewol::eSystemMessage();
if (data == NULL) { if (data == NULL) {
EWOL_ERROR("allocationerror of message"); EWOL_ERROR("allocationerror of message");
return; return;
} }
data->TypeMessage = eSystemMessage::msgInputMotion; data->TypeMessage = eSystemMessage::msgInputMotion;
data->inputType = ewol::keyEvent::typeFinger; data->inputType = ewol::key::typeFinger;
data->inputId = _pointerID; data->inputId = _pointerID;
data->dimention = _pos; data->dimention = _pos;
m_msgSystem.post(data); m_msgSystem.post(data);
} }
void ewol::eContext::OS_SetInputState(int _pointerID, bool _isDown, const vec2& _pos ) { void ewol::Context::OS_SetInputState(int _pointerID, bool _isDown, const vec2& _pos ) {
ewol::eSystemMessage *data = new ewol::eSystemMessage(); ewol::eSystemMessage *data = new ewol::eSystemMessage();
if (data == NULL) { if (data == NULL) {
EWOL_ERROR("allocationerror of message"); EWOL_ERROR("allocationerror of message");
return; return;
} }
data->TypeMessage = eSystemMessage::msgInputState; data->TypeMessage = eSystemMessage::msgInputState;
data->inputType = ewol::keyEvent::typeFinger; data->inputType = ewol::key::typeFinger;
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);
} }
void ewol::eContext::OS_SetMouseMotion(int _pointerID, const vec2& _pos ) { void ewol::Context::OS_SetMouseMotion(int _pointerID, const vec2& _pos ) {
ewol::eSystemMessage *data = new ewol::eSystemMessage(); ewol::eSystemMessage *data = new ewol::eSystemMessage();
if (data == NULL) { if (data == NULL) {
EWOL_ERROR("allocationerror of message"); EWOL_ERROR("allocationerror of message");
return; return;
} }
data->TypeMessage = eSystemMessage::msgInputMotion; data->TypeMessage = eSystemMessage::msgInputMotion;
data->inputType = ewol::keyEvent::typeMouse; data->inputType = ewol::key::typeMouse;
data->inputId = _pointerID; data->inputId = _pointerID;
data->dimention = _pos; data->dimention = _pos;
m_msgSystem.post(data); m_msgSystem.post(data);
} }
void ewol::eContext::OS_SetMouseState(int _pointerID, bool _isDown, const vec2& _pos ) { void ewol::Context::OS_SetMouseState(int _pointerID, bool _isDown, const vec2& _pos ) {
ewol::eSystemMessage *data = new ewol::eSystemMessage(); ewol::eSystemMessage *data = new ewol::eSystemMessage();
if (data == NULL) { if (data == NULL) {
EWOL_ERROR("allocationerror of message"); EWOL_ERROR("allocationerror of message");
return; return;
} }
data->TypeMessage = eSystemMessage::msgInputState; data->TypeMessage = eSystemMessage::msgInputState;
data->inputType = ewol::keyEvent::typeMouse; data->inputType = ewol::key::typeMouse;
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);
} }
void ewol::eContext::OS_SetKeyboard(ewol::SpecialKey& _special, void ewol::Context::OS_SetKeyboard(ewol::key::Special& _special,
char32_t _myChar, char32_t _myChar,
bool _isDown, bool _isDown,
bool _isARepeateKey) { bool _isARepeateKey) {
@ -467,8 +468,8 @@ void ewol::eContext::OS_SetKeyboard(ewol::SpecialKey& _special,
m_msgSystem.post(data); m_msgSystem.post(data);
} }
void ewol::eContext::OS_SetKeyboardMove(ewol::SpecialKey& _special, void ewol::Context::OS_SetKeyboardMove(ewol::key::Special& _special,
enum ewol::keyEvent::keyboard _move, enum ewol::key::keyboard _move,
bool _isDown, bool _isDown,
bool _isARepeateKey) { bool _isARepeateKey) {
ewol::eSystemMessage *data = new ewol::eSystemMessage(); ewol::eSystemMessage *data = new ewol::eSystemMessage();
@ -484,7 +485,7 @@ void ewol::eContext::OS_SetKeyboardMove(ewol::SpecialKey& _special,
m_msgSystem.post(data); m_msgSystem.post(data);
} }
void ewol::eContext::OS_Hide(void) { void ewol::Context::OS_Hide(void) {
ewol::eSystemMessage *data = new ewol::eSystemMessage(); ewol::eSystemMessage *data = new ewol::eSystemMessage();
if (data == NULL) { if (data == NULL) {
EWOL_ERROR("allocationerror of message"); EWOL_ERROR("allocationerror of message");
@ -494,7 +495,7 @@ void ewol::eContext::OS_Hide(void) {
m_msgSystem.post(data); m_msgSystem.post(data);
} }
void ewol::eContext::OS_Show(void) { void ewol::Context::OS_Show(void) {
ewol::eSystemMessage *data = new ewol::eSystemMessage(); ewol::eSystemMessage *data = new ewol::eSystemMessage();
if (data == NULL) { if (data == NULL) {
EWOL_ERROR("allocationerror of message"); EWOL_ERROR("allocationerror of message");
@ -505,7 +506,7 @@ void ewol::eContext::OS_Show(void) {
} }
void ewol::eContext::OS_ClipBoardArrive(enum ewol::clipBoard::clipboardListe _clipboardID) { void ewol::Context::OS_ClipBoardArrive(enum ewol::context::clipBoard::clipboardListe _clipboardID) {
ewol::eSystemMessage *data = new ewol::eSystemMessage(); ewol::eSystemMessage *data = new ewol::eSystemMessage();
if (data == NULL) { if (data == NULL) {
EWOL_ERROR("allocationerror of message"); EWOL_ERROR("allocationerror of message");
@ -516,7 +517,7 @@ void ewol::eContext::OS_ClipBoardArrive(enum ewol::clipBoard::clipboardListe _cl
m_msgSystem.post(data); m_msgSystem.post(data);
} }
bool ewol::eContext::OS_Draw(bool _displayEveryTime) { bool ewol::Context::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))
@ -542,7 +543,7 @@ bool ewol::eContext::OS_Draw(bool _displayEveryTime) {
//! 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::ObjectManager::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) {
@ -609,20 +610,20 @@ bool ewol::eContext::OS_Draw(bool _displayEveryTime) {
return hasDisplayDone; return hasDisplayDone;
} }
void ewol::eContext::onObjectRemove(ewol::EObject * _removeObject) { void ewol::Context::onObjectRemove(ewol::Object * _removeObject) {
//EWOL_CRITICAL("element removed"); //EWOL_CRITICAL("element removed");
m_input.onObjectRemove(_removeObject); m_input.onObjectRemove(_removeObject);
} }
void ewol::eContext::resetIOEvent(void) { void ewol::Context::resetIOEvent(void) {
m_input.newLayerSet(); m_input.newLayerSet();
} }
void ewol::eContext::OS_OpenGlContextDestroy(void) { void ewol::Context::OS_OpenGlContextDestroy(void) {
m_resourceManager.contextHasBeenDestroyed(); m_resourceManager.contextHasBeenDestroyed();
} }
void ewol::eContext::setWindows(ewol::Windows* _windows) { void ewol::Context::setWindows(ewol::widget::Windows* _windows) {
// remove current focus : // remove current focus :
m_widgetManager.focusSetDefault(NULL); m_widgetManager.focusSetDefault(NULL);
m_widgetManager.focusRelease(); m_widgetManager.focusRelease();
@ -634,57 +635,57 @@ void ewol::eContext::setWindows(ewol::Windows* _windows) {
forceRedrawAll(); forceRedrawAll();
} }
void ewol::eContext::forceRedrawAll(void) { void ewol::Context::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()));
} }
} }
void ewol::eContext::OS_Stop(void) { void ewol::Context::OS_Stop(void) {
if (NULL != m_windowsCurrent) { if (NULL != m_windowsCurrent) {
m_windowsCurrent->sysOnKill(); m_windowsCurrent->sysOnKill();
} }
} }
void ewol::eContext::OS_Suspend(void) { void ewol::Context::OS_Suspend(void) {
m_previousDisplayTime = -1; m_previousDisplayTime = -1;
} }
void ewol::eContext::OS_Resume(void) { void ewol::Context::OS_Resume(void) {
m_previousDisplayTime = ewol::getTime(); m_previousDisplayTime = ewol::getTime();
m_widgetManager.periodicCallResume(m_previousDisplayTime); m_widgetManager.periodicCallResume(m_previousDisplayTime);
} }
void ewol::eContext::stop(void) { void ewol::Context::stop(void) {
} }
void ewol::eContext::setSize(const vec2& _size) { void ewol::Context::setSize(const vec2& _size) {
EWOL_INFO("setSize: NOT implemented ..."); EWOL_INFO("setSize: NOT implemented ...");
}; };
void ewol::eContext::setPos(const vec2& _pos) { void ewol::Context::setPos(const vec2& _pos) {
EWOL_INFO("setPos: NOT implemented ..."); EWOL_INFO("setPos: NOT implemented ...");
} }
void ewol::eContext::hide(void) { void ewol::Context::hide(void) {
EWOL_INFO("hide: NOT implemented ..."); EWOL_INFO("hide: NOT implemented ...");
}; };
void ewol::eContext::show(void) { void ewol::Context::show(void) {
EWOL_INFO("show: NOT implemented ..."); EWOL_INFO("show: NOT implemented ...");
} }
void ewol::eContext::setTitle(const std::string& _title) { void ewol::Context::setTitle(const std::string& _title) {
EWOL_INFO("setTitle: NOT implemented ..."); EWOL_INFO("setTitle: NOT implemented ...");
} }
void ewol::eContext::keyboardShow(void) { void ewol::Context::keyboardShow(void) {
EWOL_INFO("keyboardShow: NOT implemented ..."); EWOL_INFO("keyboardShow: NOT implemented ...");
} }
void ewol::eContext::keyboardHide(void) { void ewol::Context::keyboardHide(void) {
EWOL_INFO("keyboardHide: NOT implemented ..."); EWOL_INFO("keyboardHide: NOT implemented ...");
} }

View File

@ -24,6 +24,10 @@
#include <ewol/context/Fps.h> #include <ewol/context/Fps.h>
namespace ewol { namespace ewol {
/**
* @not-in-doc
*/
class eSystemMessage;
/** /**
* @not-in-doc * @not-in-doc
*/ */
@ -80,7 +84,7 @@ namespace ewol {
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::InputManager m_input; ewol::context::InputManager m_input;
etk::MessageFifo<ewol::eSystemMessage*> m_msgSystem; etk::MessageFifo<ewol::eSystemMessage*> m_msgSystem;
bool m_displayFps; bool m_displayFps;
ewol::context::Fps m_FpsSystemEvent; ewol::context::Fps m_FpsSystemEvent;
@ -101,12 +105,12 @@ namespace ewol {
virtual void OS_SetMouseMotion(int _pointerID, const vec2& _pos); virtual void OS_SetMouseMotion(int _pointerID, const vec2& _pos);
virtual void OS_SetMouseState(int _pointerID, bool _isDown, const vec2& _pos); virtual void OS_SetMouseState(int _pointerID, bool _isDown, const vec2& _pos);
virtual void OS_SetKeyboard(ewol::SpecialKey& _special, virtual void OS_SetKeyboard(ewol::key::Special& _special,
char32_t _myChar, char32_t _myChar,
bool _isDown, bool _isDown,
bool _isARepeateKey=false); bool _isARepeateKey=false);
virtual void OS_SetKeyboardMove(ewol::SpecialKey& _special, virtual void OS_SetKeyboardMove(ewol::key::Special& _special,
enum ewol::keyEvent::keyboard _move, enum ewol::key::keyboard _move,
bool _isDown, bool _isDown,
bool _isARepeateKey=false); bool _isARepeateKey=false);
/** /**
@ -127,7 +131,7 @@ namespace ewol {
* @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::Object* _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
*/ */
@ -145,18 +149,18 @@ namespace ewol {
*/ */
virtual void stop(void); virtual void stop(void);
private: private:
ewol::Windows* m_windowsCurrent; //!< curent displayed windows ewol::widget::Windows* m_windowsCurrent; //!< curent displayed windows
public: public:
/** /**
* @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::widget::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) { ewol::widget::Windows* getWindows(void) {
return m_windowsCurrent; return m_windowsCurrent;
}; };
private: private:
@ -240,17 +244,17 @@ namespace ewol {
* @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(enum ewol::clipBoard::clipboardListe _clipboardID) { }; virtual void clipBoardGet(enum ewol::context::clipBoard::clipboardListe _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(enum ewol::clipBoard::clipboardListe _clipboardID) { }; virtual void clipBoardSet(enum ewol::context::clipBoard::clipboardListe _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(enum ewol::clipBoard::clipboardListe _clipboardID); void OS_ClipBoardArrive(enum ewol::context::clipBoard::clipboardListe _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
@ -271,7 +275,7 @@ namespace ewol {
* @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(enum ewol::cursorDisplay _newCursor) { }; virtual void setCursor(enum ewol::context::cursorDisplay _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.
@ -310,7 +314,7 @@ namespace ewol {
//!< 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
// return false if an error occured // return false if an error occured
bool APP_Init(ewol::eContext& _context); bool APP_Init(ewol::Context& _context);
void APP_UnInit(ewol::Context& _context); void APP_UnInit(ewol::Context& _context);

View File

@ -1,214 +0,0 @@
/**
* @author Edouard DUPIN
*
* @copyright 2011, Edouard DUPIN, all right reserved
*
* @license BSD v3 (see license file)
*/
#ifndef __EWOL_DIMENSION_H__
#define __EWOL_DIMENSION_H__
#include <etk/types.h>
#include <etk/UString.h>
#include <etk/math/Vector2D.h>
namespace ewol {
namespace context {
/**
* @brief in the dimention class we store the data as the more usefull unit (pixel)
* but one case need to be dynamic the %, then when requested in % the register the % value
*/
class Dimension {
public:
enum distance {
Pourcent=0,
Pixel,
Meter,
Centimeter,
Millimeter,
Kilometer,
Inch,
foot,
};
private:
vec2 m_data;
enum distance m_type;
public:
/**
* @brief Constructor (default :0,0 mode pixel)
*/
Dimension(void);
/**
* @brief Constructor
* @param[in] _size Requested dimention
* @param[in] _type Unit of the Dimention
*/
Dimension(const vec2& _size, enum ewol::context::Dimension::distance _type=ewol::context::Dimension::Pixel);
/**
* @brief Constructor
* @param[in] _config dimension configuration.
*/
Dimension(const std::string& _config) :
m_data(0,0),
m_type(ewol::context::Dimension::Pixel) {
set(_config);
};
/**
* @brief Constructor
* @param[in] _config dimension configuration.
*/
Dimension(const char* _config) :
m_data(0,0),
m_type(ewol::context::Dimension::Pixel) {
set(_config);
};
/**
* @brief Destructor
*/
~Dimension(void);
/**
* @brief string cast :
*/
operator std::string(void) const;
/**
* @brief get the current dimention in requested type
* @param[in] _type Type of unit requested.
* @return dimention requested.
*/
vec2 get(enum distance _type) const;
/**
* @brief set the current dimention in requested type
* @param[in] _size Dimention to set
* @param[in] _type Type of unit requested.
*/
void set(const vec2& _size, enum distance _type);
private:
/**
* @brief set the current dimention in requested type
* @param[in] _config dimension configuration.
*/
void set(std::string _config);
public:
/**
* @brief get the current dimention in pixel
* @return dimention in Pixel
*/
vec2 getPixel(void) const;
/**
* @brief get the current dimention in Pourcent
* @return dimention in Pourcent
*/
vec2 getPourcent(void) const;
/**
* @brief get the current dimention in Meter
* @return dimention in Meter
*/
vec2 getMeter(void) const;
/**
* @brief get the current dimention in Centimeter
* @return dimention in Centimeter
*/
vec2 getCentimeter(void) const;
/**
* @brief get the current dimention in Millimeter
* @return dimention in Millimeter
*/
vec2 getMillimeter(void) const;
/**
* @brief get the current dimention in Kilometer
* @return dimention in Kilometer
*/
vec2 getKilometer(void) const;
/**
* @brief get the current dimention in Inch
* @return dimention in Inch
*/
vec2 getInch(void) const;
/**
* @brief get the current dimention in Foot
* @return dimention in Foot
*/
vec2 getFoot(void) const;
/*****************************************************
* = assigment
*****************************************************/
const Dimension& operator= (const Dimension& _obj ) {
if (this!=&_obj) {
m_data = _obj.m_data;
m_type = _obj.m_type;
}
return *this;
}
/*****************************************************
* == operator
*****************************************************/
bool operator == (const Dimension& _obj) const {
if( m_data == _obj.m_data
&& m_type == _obj.m_type) {
return true;
}
return false;
}
/*****************************************************
* != operator
*****************************************************/
bool operator!= (const Dimension& _obj) const {
if( m_data != _obj.m_data
|| m_type != _obj.m_type) {
return true;
}
return false;
}
/**
* @breif get the dimension type
* @return the type
*/
enum distance getType(void) const {
return m_type;
};
public : // Global static access :
/**
* @brief basic init
*/
static void init(void);
/**
* @brief basic un-init
*/
static void unInit(void);
/**
* @brief set the Milimeter ratio for calculation
* @param[in] Ratio Milimeter ration for the screen calculation interpolation
* @param[in] type Unit type requested.
* @note: same as @ref setPixelPerInch (internal manage convertion)
*/
static void setPixelRatio(const vec2& _ratio, enum ewol::context::Dimension::distance _type);
/**
* @brief set the current Windows size
* @param[in] size size of the current windows in pixel.
*/
static void setPixelWindowsSize(const vec2& _size);
/**
* @brief get the Windows size in the request unit
* @param[in] type Unit type requested.
* @return the requested size
*/
static vec2 getWindowsSize(enum ewol::context::Dimension::distance _type);
/**
* @brief get the Windows diagonal size in the request unit
* @param[in] type Unit type requested.
* @return the requested size
*/
static float getWindowsDiag(enum ewol::context::Dimension::distance _type);
};
};
etk::CCout& operator <<(etk::CCout& _os, enum ewol::context::Dimension::distance _obj);
etk::CCout& operator <<(etk::CCout& _os, const ewol::context::Dimension& _obj);
};
#endif

View File

@ -13,15 +13,15 @@
#include <ewol/ewol.h> #include <ewol/ewol.h>
#include <ewol/renderer/EObject.h> #include <ewol/object/Object.h>
#include <ewol/renderer/EObjectManager.h> #include <ewol/object/Manager.h>
#include <ewol/renderer/eContext.h> #include <ewol/context/Context.h>
#include <ewol/renderer/InputManager.h> #include <ewol/context/InputManager.h>
#include <ewol/resources/Texture.h> #include <ewol/resource/Texture.h>
#include <ewol/widget/Widget.h> #include <ewol/widget/Widget.h>
#include <ewol/widget/Windows.h> #include <ewol/widget/Windows.h>
#include <ewol/widget/WidgetManager.h> #include <ewol/widget/Manager.h>
@ -41,15 +41,15 @@ void ewol::context::InputManager::setDpi(int32_t newDPI) {
calculateLimit(); calculateLimit();
} }
bool ewol::context::InputManager::localEventInput(enum ewol::keyEvent::type _type, bool ewol::context::InputManager::localEventInput(enum ewol::key::type _type,
ewol::Widget* _destWidget, ewol::Widget* _destWidget,
int32_t _IdInput, int32_t _IdInput,
enum ewol::keyEvent::status _status, enum ewol::key::status _status,
vec2 _pos) { vec2 _pos) {
if (NULL != _destWidget) { if (NULL != _destWidget) {
if (_type == ewol::keyEvent::typeMouse || _type == ewol::keyEvent::typeFinger) { if (_type == ewol::key::typeMouse || _type == ewol::key::typeFinger) {
// create the system Event : // create the system Event :
ewol::EventInputSystem tmpEventSystem(_type, _status, _IdInput, _pos, _destWidget, 0); // TODO : set the real ID ... ewol::event::InputSystem 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 {
@ -61,7 +61,7 @@ bool ewol::context::InputManager::localEventInput(enum ewol::keyEvent::type _typ
void ewol::context::InputManager::abortElement(InputPoperty *_eventTable, void ewol::context::InputManager::abortElement(InputPoperty *_eventTable,
int32_t _idInput, int32_t _idInput,
enum ewol::keyEvent::type _type) { enum ewol::key::type _type) {
if (NULL == _eventTable) { if (NULL == _eventTable) {
return; return;
} }
@ -69,7 +69,7 @@ void ewol::context::InputManager::abortElement(InputPoperty *_eventTable,
localEventInput(_type, localEventInput(_type,
_eventTable[_idInput].curentWidgetEvent, _eventTable[_idInput].curentWidgetEvent,
_eventTable[_idInput].destinationInputId, _eventTable[_idInput].destinationInputId,
ewol::keyEvent::statusAbort, ewol::key::statusAbort,
_eventTable[_idInput].posEvent); _eventTable[_idInput].posEvent);
} }
} }
@ -103,22 +103,22 @@ void ewol::context::InputManager::transfertEvent(ewol::Widget* _source, ewol::Wi
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::key::typeFinger, m_eventInputSaved[iii].curentWidgetEvent, m_eventInputSaved[iii].destinationInputId, ewol::key::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::key::typeFinger, m_eventInputSaved[iii].curentWidgetEvent, m_eventInputSaved[iii].destinationInputId, ewol::key::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::key::typeMouse, m_eventMouseSaved[iii].curentWidgetEvent, m_eventMouseSaved[iii].destinationInputId, ewol::key::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::key::typeMouse, m_eventMouseSaved[iii].curentWidgetEvent, m_eventMouseSaved[iii].destinationInputId, ewol::key::statusTransfert, m_eventMouseSaved[iii].posEvent);
} }
} }
} }
@ -138,7 +138,7 @@ void ewol::context::InputManager::unGrabPointer(void) {
m_context.grabPointerEvents(false, vec2(0,0)); m_context.grabPointerEvents(false, vec2(0,0));
} }
void ewol::context::InputManager::onObjectRemove(ewol::EObject * removeObject) { void ewol::context::InputManager::onObjectRemove(ewol::Object * 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 ...
@ -154,14 +154,14 @@ void ewol::context::InputManager::onObjectRemove(ewol::EObject * removeObject) {
void ewol::context::InputManager::newLayerSet(void) { void ewol::context::InputManager::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::key::typeFinger);
cleanElement(m_eventInputSaved, iii); cleanElement(m_eventInputSaved, iii);
abortElement(m_eventMouseSaved, iii, ewol::keyEvent::typeMouse); abortElement(m_eventMouseSaved, iii, ewol::key::typeMouse);
cleanElement(m_eventMouseSaved, iii); cleanElement(m_eventMouseSaved, iii);
} }
} }
ewol::context::InputManager::InputManager(ewol::eContext& _context) : ewol::context::InputManager::InputManager(ewol::Context& _context) :
m_grabWidget(NULL), m_grabWidget(NULL),
m_context(_context) { m_context(_context) {
setDpi(200); setDpi(200);
@ -179,10 +179,10 @@ ewol::context::InputManager::~InputManager(void) {
EWOL_INFO("Un-Init (end)"); EWOL_INFO("Un-Init (end)");
} }
int32_t ewol::context::InputManager::localGetDestinationId(enum ewol::keyEvent::type _type, int32_t ewol::context::InputManager::localGetDestinationId(enum ewol::key::type _type,
ewol::Widget* _destWidget, ewol::Widget* _destWidget,
int32_t _realInputId) { int32_t _realInputId) {
if (_type == ewol::keyEvent::typeFinger) { if (_type == ewol::key::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) {
@ -199,7 +199,7 @@ int32_t ewol::context::InputManager::localGetDestinationId(enum ewol::keyEvent::
} }
// note if id<0 == > the it was finger event ... // note if id<0 == > the it was finger event ...
void ewol::context::InputManager::motion(enum ewol::keyEvent::type _type, void ewol::context::InputManager::motion(enum ewol::key::type _type,
int _pointerID, int _pointerID,
vec2 _pos) { vec2 _pos) {
EVENT_DEBUG("motion event : " << _type << " " << _pointerID << " " << _pos); EVENT_DEBUG("motion event : " << _type << " " << _pointerID << " " << _pos);
@ -208,9 +208,9 @@ void ewol::context::InputManager::motion(enum ewol::keyEvent::type _type,
return; return;
} }
InputPoperty *eventTable = NULL; InputPoperty *eventTable = NULL;
if (_type == ewol::keyEvent::typeMouse) { if (_type == ewol::key::typeMouse) {
eventTable = m_eventMouseSaved; eventTable = m_eventMouseSaved;
} else if (_type == ewol::keyEvent::typeFinger) { } else if (_type == ewol::key::typeFinger) {
eventTable = m_eventInputSaved; eventTable = m_eventInputSaved;
} else { } else {
EWOL_ERROR("Unknown type of event"); EWOL_ERROR("Unknown type of event");
@ -221,9 +221,9 @@ void ewol::context::InputManager::motion(enum ewol::keyEvent::type _type,
// not manage input // not manage input
return; return;
} }
ewol::Windows* tmpWindows = m_context.getWindows(); ewol::widget::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::key::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 ...
// NOTE : the "layer widget" force us to get the widget at the specific position all the time : // NOTE : the "layer widget" force us to get the widget at the specific position all the time :
ewol::Widget* tmpWidget = NULL; ewol::Widget* tmpWidget = NULL;
@ -247,7 +247,7 @@ void ewol::context::InputManager::motion(enum ewol::keyEvent::type _type,
localEventInput(_type, localEventInput(_type,
eventTable[_pointerID].curentWidgetEvent, eventTable[_pointerID].curentWidgetEvent,
eventTable[_pointerID].destinationInputId, eventTable[_pointerID].destinationInputId,
ewol::keyEvent::statusLeave, ewol::key::statusLeave,
_pos); _pos);
} }
if (false == eventTable[_pointerID].isInside) { if (false == eventTable[_pointerID].isInside) {
@ -270,7 +270,7 @@ void ewol::context::InputManager::motion(enum ewol::keyEvent::type _type,
localEventInput(_type, localEventInput(_type,
eventTable[_pointerID].curentWidgetEvent, eventTable[_pointerID].curentWidgetEvent,
eventTable[_pointerID].destinationInputId, eventTable[_pointerID].destinationInputId,
ewol::keyEvent::statusEnter, ewol::key::statusEnter,
_pos); _pos);
} }
EVENT_DEBUG("GUI : Input ID=" << _pointerID EVENT_DEBUG("GUI : Input ID=" << _pointerID
@ -280,7 +280,7 @@ void ewol::context::InputManager::motion(enum ewol::keyEvent::type _type,
localEventInput(_type, localEventInput(_type,
eventTable[_pointerID].curentWidgetEvent, eventTable[_pointerID].curentWidgetEvent,
eventTable[_pointerID].destinationInputId, eventTable[_pointerID].destinationInputId,
ewol::keyEvent::statusMove, ewol::key::statusMove,
_pos); _pos);
} else if (true == eventTable[_pointerID].isUsed) { } else if (true == eventTable[_pointerID].isUsed) {
if (true == eventTable[_pointerID].isInside) { if (true == eventTable[_pointerID].isInside) {
@ -296,7 +296,7 @@ void ewol::context::InputManager::motion(enum ewol::keyEvent::type _type,
localEventInput(_type, localEventInput(_type,
eventTable[_pointerID].curentWidgetEvent, eventTable[_pointerID].curentWidgetEvent,
eventTable[_pointerID].destinationInputId, eventTable[_pointerID].destinationInputId,
ewol::keyEvent::statusLeave, ewol::key::statusLeave,
_pos); _pos);
} }
} else { } else {
@ -312,7 +312,7 @@ void ewol::context::InputManager::motion(enum ewol::keyEvent::type _type,
localEventInput(_type, localEventInput(_type,
eventTable[_pointerID].curentWidgetEvent, eventTable[_pointerID].curentWidgetEvent,
eventTable[_pointerID].destinationInputId, eventTable[_pointerID].destinationInputId,
ewol::keyEvent::statusEnter, ewol::key::statusEnter,
_pos); _pos);
} }
} }
@ -323,12 +323,12 @@ void ewol::context::InputManager::motion(enum ewol::keyEvent::type _type,
localEventInput(_type, localEventInput(_type,
eventTable[_pointerID].curentWidgetEvent, eventTable[_pointerID].curentWidgetEvent,
eventTable[_pointerID].destinationInputId, eventTable[_pointerID].destinationInputId,
ewol::keyEvent::statusMove, ewol::key::statusMove,
_pos); _pos);
} }
} }
void ewol::context::InputManager::state(enum ewol::keyEvent::type _type, void ewol::context::InputManager::state(enum ewol::key::type _type,
int _pointerID, int _pointerID,
bool _isDown, bool _isDown,
vec2 _pos) vec2 _pos)
@ -341,10 +341,10 @@ void ewol::context::InputManager::state(enum ewol::keyEvent::type _type,
// convert position in open-GL coordonates ... // convert position in open-GL coordonates ...
InputPoperty *eventTable = NULL; InputPoperty *eventTable = NULL;
InputLimit localLimit; InputLimit localLimit;
if (_type == ewol::keyEvent::typeMouse) { if (_type == ewol::key::typeMouse) {
eventTable = m_eventMouseSaved; eventTable = m_eventMouseSaved;
localLimit = m_eventMouseLimit; localLimit = m_eventMouseLimit;
} else if (_type == ewol::keyEvent::typeFinger) { } else if (_type == ewol::key::typeFinger) {
eventTable = m_eventInputSaved; eventTable = m_eventInputSaved;
localLimit = m_eventInputLimit; localLimit = m_eventInputLimit;
} else { } else {
@ -358,7 +358,7 @@ void ewol::context::InputManager::state(enum ewol::keyEvent::type _type,
} }
// 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::widget::Windows* tmpWindows = m_context.getWindows();
if (true == _isDown) { if (true == _isDown) {
EVENT_DEBUG("GUI : Input ID=" << _pointerID EVENT_DEBUG("GUI : Input ID=" << _pointerID
@ -384,7 +384,7 @@ void ewol::context::InputManager::state(enum ewol::keyEvent::type _type,
localEventInput(_type, localEventInput(_type,
eventTable[_pointerID].curentWidgetEvent, eventTable[_pointerID].curentWidgetEvent,
eventTable[_pointerID].destinationInputId, eventTable[_pointerID].destinationInputId,
ewol::keyEvent::statusDown, ewol::key::statusDown,
_pos); _pos);
} else { } else {
// Mark it used : // Mark it used :
@ -397,7 +397,7 @@ void ewol::context::InputManager::state(enum ewol::keyEvent::type _type,
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::key::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);
@ -420,7 +420,7 @@ void ewol::context::InputManager::state(enum ewol::keyEvent::type _type,
localEventInput(_type, localEventInput(_type,
eventTable[_pointerID].curentWidgetEvent, eventTable[_pointerID].curentWidgetEvent,
eventTable[_pointerID].destinationInputId, eventTable[_pointerID].destinationInputId,
ewol::keyEvent::statusDown, ewol::key::statusDown,
_pos); _pos);
} }
} else { } else {
@ -443,7 +443,7 @@ void ewol::context::InputManager::state(enum ewol::keyEvent::type _type,
localEventInput(_type, localEventInput(_type,
eventTable[_pointerID].curentWidgetEvent, eventTable[_pointerID].curentWidgetEvent,
_pointerID, _pointerID,
ewol::keyEvent::statusUp, ewol::key::statusUp,
_pos); _pos);
// generate event (single) // generate event (single)
if( abs(eventTable[_pointerID].downStart.x() - _pos.x()) < localLimit.DpiOffset if( abs(eventTable[_pointerID].downStart.x() - _pos.x()) < localLimit.DpiOffset
@ -461,7 +461,7 @@ void ewol::context::InputManager::state(enum ewol::keyEvent::type _type,
} }
// in grab mode the single to quinte event are not generated .... // in grab mode the single to quinte event are not generated ....
if( ( m_grabWidget == NULL if( ( m_grabWidget == NULL
|| _type != ewol::keyEvent::typeMouse ) || _type != ewol::key::typeMouse )
&& eventTable[_pointerID].nbClickEvent < nbClickMax) { && eventTable[_pointerID].nbClickEvent < nbClickMax) {
// generate event SINGLE : // generate event SINGLE :
eventTable[_pointerID].nbClickEvent++; eventTable[_pointerID].nbClickEvent++;
@ -472,7 +472,7 @@ void ewol::context::InputManager::state(enum ewol::keyEvent::type _type,
localEventInput(_type, localEventInput(_type,
eventTable[_pointerID].curentWidgetEvent, eventTable[_pointerID].curentWidgetEvent,
eventTable[_pointerID].destinationInputId, eventTable[_pointerID].destinationInputId,
(enum ewol::keyEvent::status)(ewol::keyEvent::statusSingle + eventTable[_pointerID].nbClickEvent-1), (enum ewol::key::status)(ewol::key::statusSingle + eventTable[_pointerID].nbClickEvent-1),
_pos); _pos);
if( eventTable[_pointerID].nbClickEvent >= nbClickMax) { if( eventTable[_pointerID].nbClickEvent >= nbClickMax) {
eventTable[_pointerID].nbClickEvent = 0; eventTable[_pointerID].nbClickEvent = 0;
@ -482,7 +482,7 @@ void ewol::context::InputManager::state(enum ewol::keyEvent::type _type,
} }
} }
// specific for tuch event // specific for tuch event
if (_type == ewol::keyEvent::typeFinger) { if (_type == ewol::key::typeFinger) {
cleanElement(eventTable, _pointerID); cleanElement(eventTable, _pointerID);
} }
} }

View File

@ -39,8 +39,9 @@ namespace ewol {
* @not-in-doc * @not-in-doc
*/ */
class InputLimit { class InputLimit {
int32_t sepatateTime; public:
int32_t DpiOffset; int32_t sepatateTime;
int32_t DpiOffset;
}; };
class Context; class Context;
class InputManager { class InputManager {
@ -65,10 +66,10 @@ namespace ewol {
* @param[in] _pos position of the event * @param[in] _pos position of the event
* @return true if event has been greped * @return true if event has been greped
*/ */
bool localEventInput(enum ewol::keyEvent::type _type, bool localEventInput(enum ewol::key::type _type,
ewol::Widget* _destWidget, ewol::Widget* _destWidget,
int32_t _IdInput, int32_t _IdInput,
enum ewol::keyEvent::status _typeEvent, enum ewol::key::status _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
@ -79,26 +80,26 @@ namespace ewol {
* @param[in] _realInputId system Id * @param[in] _realInputId system Id
* @return the ewol input id * @return the ewol input id
*/ */
int32_t localGetDestinationId(enum ewol::keyEvent::type _type, int32_t localGetDestinationId(enum ewol::key::type _type,
ewol::Widget* _destWidget, ewol::Widget* _destWidget,
int32_t _realInputId); int32_t _realInputId);
private: private:
ewol::eContext& m_context; ewol::Context& m_context;
public: public:
InputManager(ewol::eContext& _context); InputManager(ewol::Context& _context);
~InputManager(void); ~InputManager(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(enum ewol::keyEvent::type _type, int _pointerID, vec2 _pos ); void motion(enum ewol::key::type _type, int _pointerID, vec2 _pos );
void state(enum ewol::keyEvent::type _type, int _pointerID, bool _isDown, vec2 _pos); void state(enum ewol::key::type _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 Object remeved == > the user must remove all reference on this Object
* @note : Sub classes must call this class * @note : Sub classes must call this class
*/ */
void onObjectRemove(ewol::EObject* _removeObject); void onObjectRemove(ewol::Object* _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 ...
*/ */

View File

@ -7,24 +7,26 @@
*/ */
#include <ewol/debug.h>
#include <ewol/ewol.h>
#include <ewol/key.h>
#include <ewol/commandLine.h>
#include <etk/UString.h>
#include <etk/unicode.h>
#include <etk/os/FSNode.h>
#include <ewol/widget/WidgetManager.h>
#include <ewol/resources/ResourceManager.h>
#include <ewol/renderer/eContext.h>
#include <ewol/Dimension.h>
#include <unistd.h> #include <unistd.h>
#include <stdlib.h> #include <stdlib.h>
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
#include <etk/UString.h>
#include <etk/unicode.h>
#include <etk/os/FSNode.h>
#include <ewol/debug.h>
#include <ewol/ewol.h>
#include <ewol/key/key.h>
#include <ewol/context/commandLine.h>
#include <ewol/widget/Manager.h>
#include <ewol/resource/Manager.h>
#include <ewol/context/Context.h>
#include <ewol/Dimension.h>
#if defined(__TARGET_OS__Linux) #if defined(__TARGET_OS__Linux)
#include <GL/glx.h> #include <GL/glx.h>
#elif defined(__TARGET_OS__MacOs) #elif defined(__TARGET_OS__MacOs)
@ -102,9 +104,9 @@ extern "C" {
#undef __class__ #undef __class__
#define __class__ "x11Interface" #define __class__ "x11Interface"
class X11Interface : public ewol::eContext { class X11Interface : public ewol::Context {
private: private:
ewol::SpecialKey m_guiKeyBoardMode; ewol::key::Special m_guiKeyBoardMode;
// for double and triple click selection, we need to save the previous click up and down position , and the previous time ... // for double and triple click selection, we need to save the previous click up and down position , and the previous time ...
Atom m_delAtom; Atom m_delAtom;
Display* m_display; Display* m_display;
@ -138,11 +140,11 @@ class X11Interface : public ewol::eContext {
Atom XAtomeTargetTarget; Atom XAtomeTargetTarget;
Atom XAtomeEWOL; Atom XAtomeEWOL;
Atom XAtomeDeleteWindows; Atom XAtomeDeleteWindows;
enum ewol::cursorDisplay m_currentCursor; //!< select the current cursor to display : enum ewol::context::cursorDisplay m_currentCursor; //!< select the current cursor to display :
char32_t m_lastKeyPressed; //!< The last element key presed... char32_t m_lastKeyPressed; //!< The last element key presed...
public: public:
X11Interface(int32_t _argc, const char* _argv[]) : X11Interface(int32_t _argc, const char* _argv[]) :
ewol::eContext(_argc, _argv), ewol::Context(_argc, _argv),
m_display(NULL), m_display(NULL),
m_originX(0), m_originX(0),
m_originY(0), m_originY(0),
@ -167,7 +169,7 @@ class X11Interface : public ewol::eContext {
XAtomeTargetTarget(0), XAtomeTargetTarget(0),
XAtomeEWOL(0), XAtomeEWOL(0),
XAtomeDeleteWindows(0), XAtomeDeleteWindows(0),
m_currentCursor(ewol::cursorArrow), m_currentCursor(ewol::context::cursorArrow),
m_lastKeyPressed(0) { m_lastKeyPressed(0) {
X11_INFO("X11:INIT"); X11_INFO("X11:INIT");
for (int32_t iii=0; iii<MAX_MANAGE_INPUT; iii++) { for (int32_t iii=0; iii<MAX_MANAGE_INPUT; iii++) {
@ -264,14 +266,14 @@ class X11Interface : public ewol::eContext {
); );
if (true == m_clipBoardRequestPrimary) { if (true == m_clipBoardRequestPrimary) {
std::string tmpppp((char*)buf); std::string tmpppp((char*)buf);
ewol::clipBoard::setSystem(ewol::clipBoard::clipboardSelection, tmpppp); ewol::context::clipBoard::setSystem(ewol::context::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::context::clipBoard::clipboardSelection);
} else { } else {
std::string tmpppp((char*)buf); std::string tmpppp((char*)buf);
ewol::clipBoard::setSystem(ewol::clipBoard::clipboardStd, tmpppp); ewol::context::clipBoard::setSystem(ewol::context::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::context::clipBoard::clipboardStd);
} }
} }
break; break;
@ -292,9 +294,9 @@ class X11Interface : public ewol::eContext {
std::string tmpData = ""; std::string tmpData = "";
if (req->selection == XAtomeSelection) { if (req->selection == XAtomeSelection) {
tmpData = ewol::clipBoard::get(ewol::clipBoard::clipboardSelection); tmpData = ewol::context::clipBoard::get(ewol::context::clipBoard::clipboardSelection);
} else if (req->selection == XAtomeClipBoard) { } else if (req->selection == XAtomeClipBoard) {
tmpData = ewol::clipBoard::get(ewol::clipBoard::clipboardStd); tmpData = ewol::context::clipBoard::get(ewol::context::clipBoard::clipboardStd);
} }
const char * magatTextToSend = tmpData.c_str(); const char * magatTextToSend = tmpData.c_str();
Atom listOfAtom[4]; Atom listOfAtom[4];
@ -515,108 +517,108 @@ class X11Interface : public ewol::eContext {
X11_DEBUG("eventKey : " << event.xkey.keycode << " state : " << event.xkey.state); X11_DEBUG("eventKey : " << event.xkey.keycode << " state : " << event.xkey.state);
if (event.xkey.state & (1<<0) ) { if (event.xkey.state & (1<<0) ) {
//EWOL_DEBUG(" Special Key : SHIFT"); //EWOL_DEBUG(" Special Key : SHIFT");
m_guiKeyBoardMode.shift = true; m_guiKeyBoardMode.setShift(true);
} else { } else {
m_guiKeyBoardMode.shift = false; m_guiKeyBoardMode.setShift(false);
} }
if (event.xkey.state & (1<<1) ) { if (event.xkey.state & (1<<1) ) {
//EWOL_DEBUG(" Special Key : CAPS_LOCK"); //EWOL_DEBUG(" Special Key : CAPS_LOCK");
m_guiKeyBoardMode.capLock = true; m_guiKeyBoardMode.setCapsLock(true);
} else { } else {
m_guiKeyBoardMode.capLock = false; m_guiKeyBoardMode.setCapsLock(false);
} }
if (event.xkey.state & (1<<2) ) { if (event.xkey.state & (1<<2) ) {
//EWOL_DEBUG(" Special Key : Ctrl"); //EWOL_DEBUG(" Special Key : Ctrl");
m_guiKeyBoardMode.ctrl = true; m_guiKeyBoardMode.setCtrl(true);
} else { } else {
m_guiKeyBoardMode.ctrl = false; m_guiKeyBoardMode.setCtrl(false);
} }
if (event.xkey.state & (1<<3) ) { if (event.xkey.state & (1<<3) ) {
//EWOL_DEBUG(" Special Key : Alt"); //EWOL_DEBUG(" Special Key : Alt");
m_guiKeyBoardMode.alt = true; m_guiKeyBoardMode.setAlt(true);
} else { } else {
m_guiKeyBoardMode.alt = false; m_guiKeyBoardMode.setAlt(false);
} }
if (event.xkey.state & (1<<4) ) { if (event.xkey.state & (1<<4) ) {
//EWOL_DEBUG(" Special Key : VER_num"); //EWOL_DEBUG(" Special Key : VER_num");
m_guiKeyBoardMode.numLock = true; m_guiKeyBoardMode.setNumLock(true);
} else { } else {
m_guiKeyBoardMode.numLock = false; m_guiKeyBoardMode.setNumLock(false);
} }
if (event.xkey.state & (1<<5) ) { if (event.xkey.state & (1<<5) ) {
EWOL_DEBUG(" Special Key : MOD"); EWOL_DEBUG(" Special Key : MOD");
} }
if (event.xkey.state & (1<<6) ) { if (event.xkey.state & (1<<6) ) {
//EWOL_DEBUG(" Special Key : META"); //EWOL_DEBUG(" Special Key : META");
m_guiKeyBoardMode.meta = true; m_guiKeyBoardMode.setMeta(true);
} else { } else {
m_guiKeyBoardMode.meta = false; m_guiKeyBoardMode.setMeta(false);
} }
if (event.xkey.state & (1<<7) ) { if (event.xkey.state & (1<<7) ) {
//EWOL_DEBUG(" Special Key : ALT_GR"); //EWOL_DEBUG(" Special Key : ALT_GR");
m_guiKeyBoardMode.altGr = true; m_guiKeyBoardMode.setAltGr(true);
} else { } else {
m_guiKeyBoardMode.altGr = false; m_guiKeyBoardMode.setAltGr(false);
} }
bool find = true; bool find = true;
enum ewol::keyEvent::keyboard keyInput; enum ewol::key::keyboard keyInput;
switch (event.xkey.keycode) { switch (event.xkey.keycode) {
//case 80: // keypad //case 80: // keypad
case 111: keyInput = ewol::keyEvent::keyboardUp; break; case 111: keyInput = ewol::key::keyboardUp; break;
//case 83: // keypad //case 83: // keypad
case 113: keyInput = ewol::keyEvent::keyboardLeft; break; case 113: keyInput = ewol::key::keyboardLeft; break;
//case 85: // keypad //case 85: // keypad
case 114: keyInput = ewol::keyEvent::keyboardRight; break; case 114: keyInput = ewol::key::keyboardRight; break;
//case 88: // keypad //case 88: // keypad
case 116: keyInput = ewol::keyEvent::keyboardDown; break; case 116: keyInput = ewol::key::keyboardDown; break;
//case 81: // keypad //case 81: // keypad
case 112: keyInput = ewol::keyEvent::keyboardPageUp; break; case 112: keyInput = ewol::key::keyboardPageUp; break;
//case 89: // keypad //case 89: // keypad
case 117: keyInput = ewol::keyEvent::keyboardPageDown; break; case 117: keyInput = ewol::key::keyboardPageDown; break;
//case 79: // keypad //case 79: // keypad
case 110: keyInput = ewol::keyEvent::keyboardStart; break; case 110: keyInput = ewol::key::keyboardStart; break;
//case 87: // keypad //case 87: // keypad
case 115: keyInput = ewol::keyEvent::keyboardEnd; break; case 115: keyInput = ewol::key::keyboardEnd; break;
case 78: keyInput = ewol::keyEvent::keyboardStopDefil; break; case 78: keyInput = ewol::key::keyboardStopDefil; break;
case 127: keyInput = ewol::keyEvent::keyboardWait; break; case 127: keyInput = ewol::key::keyboardWait; break;
//case 90: // keypad //case 90: // keypad
case 118: case 118:
keyInput = ewol::keyEvent::keyboardInsert; keyInput = ewol::key::keyboardInsert;
if(event.type == KeyRelease) { if(event.type == KeyRelease) {
if (true == m_guiKeyBoardMode.insert) { if (true == m_guiKeyBoardMode.getInsert()) {
m_guiKeyBoardMode.insert = false; m_guiKeyBoardMode.setInsert(false);
} else { } else {
m_guiKeyBoardMode.insert = true; m_guiKeyBoardMode.setInsert(true);
} }
} }
break; break;
//case 84: keyInput = ewol::keyEvent::keyboardCenter; break; // Keypad //case 84: keyInput = ewol::key::keyboardCenter; break; // Keypad
case 67: keyInput = ewol::keyEvent::keyboardF1; break; case 67: keyInput = ewol::key::keyboardF1; break;
case 68: keyInput = ewol::keyEvent::keyboardF2; break; case 68: keyInput = ewol::key::keyboardF2; break;
case 69: keyInput = ewol::keyEvent::keyboardF3; break; case 69: keyInput = ewol::key::keyboardF3; break;
case 70: keyInput = ewol::keyEvent::keyboardF4; break; case 70: keyInput = ewol::key::keyboardF4; break;
case 71: keyInput = ewol::keyEvent::keyboardF5; break; case 71: keyInput = ewol::key::keyboardF5; break;
case 72: keyInput = ewol::keyEvent::keyboardF6; break; case 72: keyInput = ewol::key::keyboardF6; break;
case 73: keyInput = ewol::keyEvent::keyboardF7; break; case 73: keyInput = ewol::key::keyboardF7; break;
case 74: keyInput = ewol::keyEvent::keyboardF8; break; case 74: keyInput = ewol::key::keyboardF8; break;
case 75: keyInput = ewol::keyEvent::keyboardF9; break; case 75: keyInput = ewol::key::keyboardF9; break;
case 76: keyInput = ewol::keyEvent::keyboardF10; break; case 76: keyInput = ewol::key::keyboardF10; break;
case 95: keyInput = ewol::keyEvent::keyboardF11; break; case 95: keyInput = ewol::key::keyboardF11; break;
case 96: keyInput = ewol::keyEvent::keyboardF12; break; case 96: keyInput = ewol::key::keyboardF12; break;
case 66: keyInput = ewol::keyEvent::keyboardCapLock; m_guiKeyBoardMode.capLock = (event.type == KeyPress) ? true : false; break; case 66: keyInput = ewol::key::keyboardCapLock; m_guiKeyBoardMode.setCapsLock( (event.type == KeyPress) ? true : false); break;
case 50: keyInput = ewol::keyEvent::keyboardShiftLeft; m_guiKeyBoardMode.shift = (event.type == KeyPress) ? true : false; break; case 50: keyInput = ewol::key::keyboardShiftLeft; m_guiKeyBoardMode.setShift ( (event.type == KeyPress) ? true : false); break;
case 62: keyInput = ewol::keyEvent::keyboardShiftRight; m_guiKeyBoardMode.shift = (event.type == KeyPress) ? true : false; break; case 62: keyInput = ewol::key::keyboardShiftRight; m_guiKeyBoardMode.setShift ( (event.type == KeyPress) ? true : false); break;
case 37: keyInput = ewol::keyEvent::keyboardCtrlLeft; m_guiKeyBoardMode.ctrl = (event.type == KeyPress) ? true : false; break; case 37: keyInput = ewol::key::keyboardCtrlLeft; m_guiKeyBoardMode.setCtrl ( (event.type == KeyPress) ? true : false); break;
case 105: keyInput = ewol::keyEvent::keyboardCtrlRight; m_guiKeyBoardMode.ctrl = (event.type == KeyPress) ? true : false; break; case 105: keyInput = ewol::key::keyboardCtrlRight; m_guiKeyBoardMode.setCtrl ( (event.type == KeyPress) ? true : false); break;
case 133: keyInput = ewol::keyEvent::keyboardMetaLeft; m_guiKeyBoardMode.meta = (event.type == KeyPress) ? true : false; break; case 133: keyInput = ewol::key::keyboardMetaLeft; m_guiKeyBoardMode.setMeta ( (event.type == KeyPress) ? true : false); break;
case 134: keyInput = ewol::keyEvent::keyboardMetaRight; m_guiKeyBoardMode.meta = (event.type == KeyPress) ? true : false; break; case 134: keyInput = ewol::key::keyboardMetaRight; m_guiKeyBoardMode.setMeta ( (event.type == KeyPress) ? true : false); break;
case 64: keyInput = ewol::keyEvent::keyboardAlt; m_guiKeyBoardMode.alt = (event.type == KeyPress) ? true : false; break; case 64: keyInput = ewol::key::keyboardAlt; m_guiKeyBoardMode.setAlt ( (event.type == KeyPress) ? true : false); break;
case 108: keyInput = ewol::keyEvent::keyboardAltGr; m_guiKeyBoardMode.altGr = (event.type == KeyPress) ? true : false; break; case 108: keyInput = ewol::key::keyboardAltGr; m_guiKeyBoardMode.setAltGr ( (event.type == KeyPress) ? true : false); break;
case 135: keyInput = ewol::keyEvent::keyboardContextMenu; break; case 135: keyInput = ewol::key::keyboardContextMenu; break;
case 77: keyInput = ewol::keyEvent::keyboardNumLock; m_guiKeyBoardMode.numLock = (event.type == KeyPress) ? true : false; break; case 77: keyInput = ewol::key::keyboardNumLock; m_guiKeyBoardMode.setNumLock ( (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.getNumLock() == 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);
@ -744,7 +746,7 @@ class X11Interface : public ewol::eContext {
} }
*/ */
/****************************************************************************************/ /****************************************************************************************/
virtual void setCursor(enum ewol::cursorDisplay _newCursor) { virtual void setCursor(enum ewol::context::cursorDisplay _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 ...
@ -753,7 +755,7 @@ class X11Interface : public ewol::eContext {
m_currentCursor = _newCursor; m_currentCursor = _newCursor;
Cursor myCursor = None; Cursor myCursor = None;
switch (m_currentCursor) { switch (m_currentCursor) {
case ewol::cursorNone: case ewol::context::cursorNone:
{ {
Pixmap bitmapNoData; Pixmap bitmapNoData;
XColor black; XColor black;
@ -766,61 +768,61 @@ class X11Interface : public ewol::eContext {
&black, &black, 0, 0); &black, &black, 0, 0);
} }
break; break;
case ewol::cursorLeftArrow: case ewol::context::cursorLeftArrow:
myCursor = XCreateFontCursor(m_display, XC_top_left_arrow); myCursor = XCreateFontCursor(m_display, XC_top_left_arrow);
break; break;
case ewol::cursorInfo: case ewol::context::cursorInfo:
myCursor = XCreateFontCursor(m_display, XC_hand1); myCursor = XCreateFontCursor(m_display, XC_hand1);
break; break;
case ewol::cursorDestroy: case ewol::context::cursorDestroy:
myCursor = XCreateFontCursor(m_display, XC_pirate); myCursor = XCreateFontCursor(m_display, XC_pirate);
break; break;
case ewol::cursorHelp: case ewol::context::cursorHelp:
myCursor = XCreateFontCursor(m_display, XC_question_arrow); myCursor = XCreateFontCursor(m_display, XC_question_arrow);
break; break;
case ewol::cursorCycle: case ewol::context::cursorCycle:
myCursor = XCreateFontCursor(m_display, XC_exchange); myCursor = XCreateFontCursor(m_display, XC_exchange);
break; break;
case ewol::cursorSpray: case ewol::context::cursorSpray:
myCursor = XCreateFontCursor(m_display, XC_spraycan); myCursor = XCreateFontCursor(m_display, XC_spraycan);
break; break;
case ewol::cursorWait: case ewol::context::cursorWait:
myCursor = XCreateFontCursor(m_display, XC_watch); myCursor = XCreateFontCursor(m_display, XC_watch);
break; break;
case ewol::cursorText: case ewol::context::cursorText:
myCursor = XCreateFontCursor(m_display, XC_xterm); myCursor = XCreateFontCursor(m_display, XC_xterm);
break; break;
case ewol::cursorCrossHair: case ewol::context::cursorCrossHair:
myCursor = XCreateFontCursor(m_display, XC_crosshair); myCursor = XCreateFontCursor(m_display, XC_crosshair);
break; break;
case ewol::cursorSlideUpDown: case ewol::context::cursorSlideUpDown:
myCursor = XCreateFontCursor(m_display, XC_sb_v_double_arrow); myCursor = XCreateFontCursor(m_display, XC_sb_v_double_arrow);
break; break;
case ewol::cursorSlideLeftRight: case ewol::context::cursorSlideLeftRight:
myCursor = XCreateFontCursor(m_display, XC_sb_h_double_arrow); myCursor = XCreateFontCursor(m_display, XC_sb_h_double_arrow);
break; break;
case ewol::cursorResizeUp: case ewol::context::cursorResizeUp:
myCursor = XCreateFontCursor(m_display, XC_top_side); myCursor = XCreateFontCursor(m_display, XC_top_side);
break; break;
case ewol::cursorResizeDown: case ewol::context::cursorResizeDown:
myCursor = XCreateFontCursor(m_display, XC_bottom_side); myCursor = XCreateFontCursor(m_display, XC_bottom_side);
break; break;
case ewol::cursorResizeLeft: case ewol::context::cursorResizeLeft:
myCursor = XCreateFontCursor(m_display, XC_left_side); myCursor = XCreateFontCursor(m_display, XC_left_side);
break; break;
case ewol::cursorResizeRight: case ewol::context::cursorResizeRight:
myCursor = XCreateFontCursor(m_display, XC_right_side); myCursor = XCreateFontCursor(m_display, XC_right_side);
break; break;
case ewol::cursorCornerTopLeft: case ewol::context::cursorCornerTopLeft:
myCursor = XCreateFontCursor(m_display, XC_top_left_corner); myCursor = XCreateFontCursor(m_display, XC_top_left_corner);
break; break;
case ewol::cursorCornerTopRight: case ewol::context::cursorCornerTopRight:
myCursor = XCreateFontCursor(m_display, XC_top_right_corner); myCursor = XCreateFontCursor(m_display, XC_top_right_corner);
break; break;
case ewol::cursorCornerButtomLeft: case ewol::context::cursorCornerButtomLeft:
myCursor = XCreateFontCursor(m_display, XC_bottom_right_corner); myCursor = XCreateFontCursor(m_display, XC_bottom_right_corner);
break; break;
case ewol::cursorCornerButtomRight: case ewol::context::cursorCornerButtomRight:
myCursor = XCreateFontCursor(m_display, XC_bottom_left_corner); myCursor = XCreateFontCursor(m_display, XC_bottom_left_corner);
break; break;
default : default :
@ -904,7 +906,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
@ -1222,9 +1224,9 @@ class X11Interface : public ewol::eContext {
X11_INFO("X11: set Title (END)"); X11_INFO("X11: set Title (END)");
} }
/****************************************************************************************/ /****************************************************************************************/
void clipBoardGet(enum ewol::clipBoard::clipboardListe _clipboardID) { void clipBoardGet(enum ewol::context::clipBoard::clipboardListe _clipboardID) {
switch (_clipboardID) { switch (_clipboardID) {
case ewol::clipBoard::clipboardSelection: case ewol::context::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
@ -1239,7 +1241,7 @@ class X11Interface : public ewol::eContext {
OS_ClipBoardArrive(_clipboardID); OS_ClipBoardArrive(_clipboardID);
} }
break; break;
case ewol::clipBoard::clipboardStd: case ewol::context::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
@ -1260,17 +1262,17 @@ class X11Interface : public ewol::eContext {
} }
} }
/****************************************************************************************/ /****************************************************************************************/
void clipBoardSet(enum ewol::clipBoard::clipboardListe _clipboardID) { void clipBoardSet(enum ewol::context::clipBoard::clipboardListe _clipboardID) {
switch (_clipboardID) switch (_clipboardID)
{ {
case ewol::clipBoard::clipboardSelection: case ewol::context::clipBoard::clipboardSelection:
// Request the selection : // Request the selection :
if (false == m_clipBoardOwnerPrimary) { if (false == m_clipBoardOwnerPrimary) {
XSetSelectionOwner(m_display, XAtomeSelection, m_WindowHandle, CurrentTime); XSetSelectionOwner(m_display, XAtomeSelection, m_WindowHandle, CurrentTime);
m_clipBoardOwnerPrimary = true; m_clipBoardOwnerPrimary = true;
} }
break; break;
case ewol::clipBoard::clipboardStd: case ewol::context::clipBoard::clipboardStd:
// Request the clipBoard : // Request the clipBoard :
if (false == m_clipBoardOwnerStd) { if (false == m_clipBoardOwnerStd) {
XSetSelectionOwner(m_display, XAtomeClipBoard, m_WindowHandle, CurrentTime); XSetSelectionOwner(m_display, XAtomeClipBoard, m_WindowHandle, CurrentTime);

View File

@ -9,8 +9,8 @@
#include <etk/types.h> #include <etk/types.h>
#include <ewol/debug.h> #include <ewol/debug.h>
#include <ewol/clipBoard.h> #include <ewol/context/clipBoard.h>
#include <ewol/renderer/eContext.h> #include <ewol/context/Context.h>
#undef __class__ #undef __class__
#define __class__ "ClipBoard" #define __class__ "ClipBoard"
@ -23,9 +23,9 @@ note: la copy dans le :
10 : bouton du milieux 10 : bouton du milieux
*/ */
//!< Local copy of the clipboards //!< Local copy of the clipboards
static std::string mesCopy[ewol::clipBoard::context::clipboardCount]; static std::string mesCopy[ewol::context::clipBoard::clipboardCount];
static const char* clipboardDescriptionString[ewol::clipBoard::context::clipboardCount+1] = { static const char* clipboardDescriptionString[ewol::context::clipBoard::clipboardCount+1] = {
"clipboard0", "clipboard0",
"clipboard1", "clipboard1",
"clipboard2", "clipboard2",

View File

@ -7,7 +7,7 @@
*/ */
#include <ewol/debug.h> #include <ewol/debug.h>
#include <ewol/commandLine.h> #include <ewol/context/commandLine.h>
#include <vector> #include <vector>
void ewol::context::CommandLine::parse(int32_t _argc, const char* _argv[]) { void ewol::context::CommandLine::parse(int32_t _argc, const char* _argv[]) {

View File

@ -6,7 +6,7 @@
* @license BSD v3 (see license file) * @license BSD v3 (see license file)
*/ */
#include <ewol/cursor.h> #include <ewol/context/cursor.h>
static const char* cursorDescriptionString[ewol::context::cursorCount+1] = { static const char* cursorDescriptionString[ewol::context::cursorCount+1] = {
"cursorArrow", "cursorArrow",

View File

@ -7,10 +7,10 @@
*/ */
#include <ewol/ewol.h> #include <ewol/ewol.h>
#include <ewol/widget/WidgetManager.h> #include <ewol/widget/Manager.h>
#include <ewol/renderer/eContext.h> #include <ewol/context/Context.h>
#include <ewol/commandLine.h> #include <ewol/context/commandLine.h>
#include <etk/os/FSNode.h> #include <etk/os/FSNode.h>
#include <ewol/Dimension.h> #include <ewol/Dimension.h>
#include <date/date.h> #include <date/date.h>

View File

@ -18,7 +18,7 @@
#define EWOL_FLAG_KEY_INSERT 0x00000080 #define EWOL_FLAG_KEY_INSERT 0x00000080
ewol::key::Special::SpecialKey(void) : ewol::key::Special::Special(void) :
m_value(0) { m_value(0) {
} }

View File

@ -7,6 +7,8 @@
*/ */
#include <ewol/object/Config.h> #include <ewol/object/Config.h>
#include <etk/UString.h>
#undef __class__ #undef __class__
#define __class__ "object::Config" #define __class__ "object::Config"

View File

@ -7,7 +7,7 @@
*/ */
#include <ewol/object/Manager.h> #include <ewol/object/Manager.h>
#include <ewol/contect/Context.h> #include <ewol/context/Context.h>
#include <ewol/ewol.h> #include <ewol/ewol.h>
#undef __class__ #undef __class__

View File

@ -65,7 +65,7 @@ void ewol::object::MultiCast::send(ewol::Object* _object, const char* const _mes
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::object::Message tmpMsg(_object, m_messageList[iii].m_message, _data);
m_messageList[iii].m_object->onReceiveMessage(tmpMsg); m_messageList[iii].m_object->onReceiveMessage(tmpMsg);
} }
} }

View File

@ -10,6 +10,7 @@
#include <ewol/object/Manager.h> #include <ewol/object/Manager.h>
#include <ewol/debug.h> #include <ewol/debug.h>
#include <ewol/context/Context.h> #include <ewol/context/Context.h>
#include <ewol/object/MultiCast.h>
#undef __class__ #undef __class__
#define __class__ "ewol::Object" #define __class__ "ewol::Object"
@ -92,7 +93,7 @@ void ewol::Object::autoDestroy(void) {
getObjectManager().autoRemove(this); getObjectManager().autoRemove(this);
} }
void ewol::Object::removObject(void) { void ewol::Object::removeObject(void) {
getObjectManager().autoRemove(this); getObjectManager().autoRemove(this);
} }
@ -111,12 +112,12 @@ void ewol::Object::generateEventId(const char * _generateEventId, const std::str
if (m_externEvent[iii]->localEventId == _generateEventId) { if (m_externEvent[iii]->localEventId == _generateEventId) {
if (NULL != m_externEvent[iii]->destObject) { if (NULL != m_externEvent[iii]->destObject) {
if (m_externEvent[iii]->overloadData.size() <= 0){ if (m_externEvent[iii]->overloadData.size() <= 0){
ewol::EMessage tmpMsg(this, m_externEvent[iii]->destEventId, _data); ewol::object::Message tmpMsg(this, m_externEvent[iii]->destEventId, _data);
EWOL_VERBOSE("send message " << tmpMsg); EWOL_VERBOSE("send message " << tmpMsg);
m_externEvent[iii]->destObject->onReceiveMessage(tmpMsg); m_externEvent[iii]->destObject->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::object::Message tmpMsg(this, m_externEvent[iii]->destEventId, m_externEvent[iii]->overloadData);
EWOL_VERBOSE("send message " << tmpMsg); EWOL_VERBOSE("send message " << tmpMsg);
m_externEvent[iii]->destObject->onReceiveMessage(tmpMsg); m_externEvent[iii]->destObject->onReceiveMessage(tmpMsg);
} }
@ -240,7 +241,7 @@ void ewol::Object::registerConfig(const char* _config,
} }
} }
} }
m_listConfig.push_back(ewol::EConfigElement(_config, _type, _control, _description, _default)); m_listConfig.push_back(ewol::object::ConfigElement(_config, _type, _control, _description, _default));
} }
@ -258,7 +259,7 @@ bool ewol::Object::loadXML(exml::Element* _node) {
if (value.size() == 0) { if (value.size() == 0) {
continue; continue;
} }
if (false == setConfig(ewol::EConfig(m_listConfig[iii].getConfig(), value) ) ) { if (false == setConfig(ewol::object::Config(m_listConfig[iii].getConfig(), value) ) ) {
errorOccured = false; errorOccured = false;
} }
} }
@ -288,7 +289,7 @@ bool ewol::Object::storeXML(exml::Element* _node) const {
} }
bool ewol::Object::onSetConfig(const ewol::EConfig& _conf) { bool ewol::Object::onSetConfig(const ewol::object::Config& _conf) {
EWOL_VERBOSE("[" << getId() << "] {" << getObjectType() << "} set config : " << _conf); EWOL_VERBOSE("[" << getId() << "] {" << getObjectType() << "} set config : " << _conf);
if (_conf.getConfig() == ewol::Object::configName) { if (_conf.getConfig() == ewol::Object::configName) {
EWOL_VERBOSE("[" << getId() << "] {" << getObjectType() << "} set config name : \"" << _conf.getData() << "\""); EWOL_VERBOSE("[" << getId() << "] {" << getObjectType() << "} set config name : \"" << _conf.getData() << "\"");
@ -311,7 +312,7 @@ bool ewol::Object::setConfig(const std::string& _config, const std::string& _val
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::object::Config(m_listConfig[iii].getConfig(), _value));
} }
} }
} }
@ -340,7 +341,7 @@ std::string ewol::Object::getConfig(const std::string& _config) const {
return ""; return "";
} }
bool ewol::Object::setConfigNamed(const std::string& _objectName, const ewol::EConfig& _conf) { bool ewol::Object::setConfigNamed(const std::string& _objectName, const ewol::object::Config& _conf) {
ewol::Object* object = getObjectManager().get(_objectName); ewol::Object* object = getObjectManager().get(_objectName);
if (object == NULL) { if (object == NULL) {
return false; return false;
@ -356,14 +357,14 @@ bool ewol::Object::setConfigNamed(const std::string& _objectName, const std::str
return object->setConfig(_config, _value); return object->setConfig(_config, _value);
} }
ewol::ObjectManager& ewol::Object::getObjectManager(void) { ewol::object::Manager& ewol::Object::getObjectManager(void) {
return ewol::getContext().getObjectManager(); return ewol::getContext().getEObjectManager();
} }
ewol::EMultiCast& ewol::Object::getMultiCast(void) { ewol::object::MultiCast& ewol::Object::getMultiCast(void) {
return ewol::getContext().getObjectManager().multiCast(); return ewol::getContext().getEObjectManager().multiCast();
} }
ewol::eContext& ewol::Object::getContext(void) { ewol::Context& ewol::Object::getContext(void) {
return ewol::getContext(); return ewol::getContext();
} }

View File

@ -19,8 +19,6 @@ namespace ewol {
class Object; class Object;
namespace object { namespace object {
class Manager; class Manager;
};
namespace context {
class MultiCast; class MultiCast;
}; };
class Context; class Context;
@ -279,7 +277,7 @@ namespace ewol {
* @breif get the current Object Message Multicast manager. * @breif get the current Object Message Multicast manager.
* @return the requested object manager. * @return the requested object manager.
*/ */
ewol::context::MultiCast& getMultiCast(void); ewol::object::MultiCast& 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.

View File

@ -8,7 +8,7 @@
#include <vector> #include <vector>
#include <ewol/debug.h> #include <ewol/debug.h>
#include <ewol/renderer/openGL.h> #include <ewol/openGL/openGL.h>
/** /**
* @brief get the draw mutex (ewol render). * @brief get the draw mutex (ewol render).

View File

@ -10,7 +10,7 @@
#define __EWOL_FONT_FREE_TYPE_H__ #define __EWOL_FONT_FREE_TYPE_H__
#include <etk/types.h> #include <etk/types.h>
#include <ewol/resources/font/FontBase.h> #include <ewol/resource/font/FontBase.h>
extern "C" { extern "C" {
#include <freetype/ft2build.h> #include <freetype/ft2build.h>
@ -53,12 +53,12 @@ namespace ewol {
* @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 std::string& _filename); static ewol::resource::FontBase* keep(const std::string& _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::resource::FontBase*& _object);
}; };
void freeTypeInit(void); void freeTypeInit(void);
void freeTypeUnInit(void); void freeTypeUnInit(void);

View File

@ -10,7 +10,7 @@
#define __EWOL_WIDGET_H__ #define __EWOL_WIDGET_H__
#include <ewol/object/Object.h> #include <ewol/object/Object.h>
#include <ewol/context/Dimension.h> #include <ewol/Dimension.h>
namespace ewol { namespace ewol {
class Widget; class Widget;
@ -510,7 +510,7 @@ namespace ewol {
* @brief periodic call of this widget * @brief periodic call of this widget
* @param _event Current time property * @param _event Current time property
*/ */
virtual void periodicCall(const ewol::EventTime& _event) { virtual void periodicCall(const ewol::event::Time& _event) {
}; };
public: public:
@ -542,7 +542,7 @@ namespace ewol {
* @return true the event is used * @return true the event is used
* @return false the event is not used * @return false the event is not used
*/ */
virtual bool systemEventInput(ewol::EventInputSystem& _event); virtual bool systemEventInput(ewol::event::InputSystem& _event);
protected: protected:
/** /**
* @brief Event on an input of this Widget (finger, mouse, stilet) * @brief Event on an input of this Widget (finger, mouse, stilet)
@ -550,7 +550,7 @@ namespace ewol {
* @return true the event is used * @return true the event is used
* @return false the event is not used * @return false the event is not used
*/ */
virtual bool onEventInput(const ewol::EventInput& _event) { virtual bool onEventInput(const ewol::event::Input& _event) {
return false; return false;
}; };
public: public:
@ -560,7 +560,7 @@ namespace ewol {
* @return true if the event has been used * @return true if the event has been used
* @return false if the event has not been used * @return false if the event has not been used
*/ */
virtual bool systemEventEntry(ewol::EventEntrySystem& _event); virtual bool systemEventEntry(ewol::event::EntrySystem& _event);
protected: protected:
/** /**
* @brief Entry event. * @brief Entry event.
@ -572,7 +572,7 @@ namespace ewol {
* @return true if the event has been used * @return true if the event has been used
* @return false if the event has not been used * @return false if the event has not been used
*/ */
virtual bool onEventEntry(const ewol::EventEntry& _event) { virtual bool onEventEntry(const ewol::event::Entry& _event) {
return false; return false;
}; };
public: public:
@ -581,7 +581,7 @@ namespace ewol {
* @note : need to have focus ... * @note : need to have focus ...
* @param[in] mode Mode of data requested * @param[in] mode Mode of data requested
*/ */
virtual void onEventClipboard(enum ewol::clipBoard::clipboardListe _clipboardID) { }; virtual void onEventClipboard(enum ewol::context::clipBoard::clipboardListe _clipboardID) { };
// ---------------------------------------------------------------------------------------------------------------- // ----------------------------------------------------------------------------------------------------------------
// -- Shortcut : management of the shortcut // -- Shortcut : management of the shortcut
@ -613,9 +613,9 @@ namespace ewol {
* @return false if the event has not been used. * @return false if the event has not been used.
* @note To prevent some error when you get an event get it if it is down and Up ... == > like this it could not generate some ununderstanding error. * @note To prevent some error when you get an event get it if it is down and Up ... == > like this it could not generate some ununderstanding error.
*/ */
virtual bool onEventShortCut(ewol::SpecialKey& _special, virtual bool onEventShortCut(ewol::key::Special& _special,
char32_t _unicodeValue, char32_t _unicodeValue,
enum ewol::keyEvent::keyboard _kbMove, enum ewol::key::keyboard _kbMove,
bool _isDown); bool _isDown);
// ---------------------------------------------------------------------------------------------------------------- // ----------------------------------------------------------------------------------------------------------------
// -- drawing : All drawing must be done in 2 separate buffer 1 for the current display and 1 for the working... // -- drawing : All drawing must be done in 2 separate buffer 1 for the current display and 1 for the working...
@ -632,8 +632,8 @@ namespace ewol {
* @return false if we have no need to redraw * @return false if we have no need to redraw
*/ */
virtual bool needRedraw(void) { virtual bool needRedraw(void) {
bool tmpData=m_needRegenerateDisplay; bool tmpData = m_needRegenerateDisplay;
m_needRegenerateDisplay=false; m_needRegenerateDisplay = false;
return tmpData; return tmpData;
}; };
public: public:
@ -675,23 +675,23 @@ namespace ewol {
*/ */
virtual bool getGrabStatus(void); virtual bool getGrabStatus(void);
private: private:
enum ewol::cursorDisplay m_cursorDisplay; enum ewol::context::cursorDisplay m_cursorDisplay;
public: public:
/** /**
* @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(enum ewol::cursorDisplay _newCursor); virtual void setCursor(enum ewol::context::cursorDisplay _newCursor);
/** /**
* @brief get the currrent cursor. * @brief get the currrent cursor.
* @return the type of the cursor. * @return the type of the cursor.
*/ */
virtual enum ewol::cursorDisplay getCursor(void); virtual enum ewol::context::cursorDisplay getCursor(void);
public: // Derived function public: // Derived function
virtual void onObjectRemove(ewol::EObject* _removeObject); virtual void onObjectRemove(ewol::Object* _removeObject);
virtual bool loadXML(exml::Element* _node); virtual bool loadXML(exml::Element* _node);
protected: // Derived function protected: // Derived function
virtual bool onSetConfig(const ewol::EConfig& _conf); virtual bool onSetConfig(const ewol::object::Config& _conf);
virtual bool onGetConfig(const char* _config, std::string& _result) const; virtual bool onGetConfig(const char* _config, std::string& _result) const;
public: public:
/** /**
@ -701,11 +701,11 @@ namespace ewol {
/** /**
* @brief get the current Widget Manager * @brief get the current Widget Manager
*/ */
ewol::WidgetManager& getWidgetManager(void); ewol::widget::Manager& getWidgetManager(void);
/** /**
* @brief get the curent Windows * @brief get the curent Windows
*/ */
ewol::Windows* getWindows(void); ewol::widget::Windows* getWindows(void);
/* /*
* Annimation section : * Annimation section :
*/ */

View File

@ -19,7 +19,7 @@ namespace ewol {
/** /**
* @ingroup ewolWidgetGroup * @ingroup ewolWidgetGroup
*/ */
class Windows : public ewol::widget::Widget { class Windows : public ewol::Widget {
public: public:
Windows(void); Windows(void);
virtual ~Windows(void); virtual ~Windows(void);
@ -72,7 +72,7 @@ namespace ewol {
virtual void systemDraw(const ewol::DrawProperty& _displayProp); virtual void systemDraw(const ewol::DrawProperty& _displayProp);
public: // Derived function public: // Derived function
virtual void onRegenerateDisplay(void); virtual void onRegenerateDisplay(void);
virtual void onObjectRemove(ewol::EObject * _removeObject); virtual void onObjectRemove(ewol::Object * _removeObject);
virtual void calculateSize(const vec2& _availlable); virtual void calculateSize(const vec2& _availlable);
virtual ewol::Widget * getWidgetAtPos(const vec2& _pos); virtual ewol::Widget * getWidgetAtPos(const vec2& _pos);
void setTitle(const std::string& _title); void setTitle(const std::string& _title);

View File

@ -21,7 +21,8 @@ def Create(target):
# add the file to compile: # add the file to compile:
myModule.AddSrcFile([ myModule.AddSrcFile([
'ewol/ewol.cpp', 'ewol/ewol.cpp',
'ewol/debug.cpp' 'ewol/debug.cpp',
'ewol/Dimension.cpp'
]) ])
# compositing : # compositing :
@ -42,7 +43,6 @@ def Create(target):
'ewol/context/ConfigFont.cpp', 'ewol/context/ConfigFont.cpp',
'ewol/context/Context.cpp', 'ewol/context/Context.cpp',
'ewol/context/cursor.cpp', 'ewol/context/cursor.cpp',
'ewol/context/Dimension.cpp',
'ewol/context/InputManager.cpp' 'ewol/context/InputManager.cpp'
]) ])
if target.name=="Linux": if target.name=="Linux":
@ -180,14 +180,6 @@ def Create(target):
#ifeq ("$(CONFIG_BUILD_PORTAUDIO)","y") #ifeq ("$(CONFIG_BUILD_PORTAUDIO)","y")
#myModule.AddSrcFile('ewol/renderer/audio/interfacePortAudio.cpp') #myModule.AddSrcFile('ewol/renderer/audio/interfacePortAudio.cpp')
#endif #endif
#ifeq ("$(CONFIG___EWOL_LINUX_GUI_MODE_X11__)","y")
myModule.AddSrcFile('ewol/renderer/X11/Context.cpp')
#endif
#ifeq ("$(CONFIG___EWOL_LINUX_GUI_MODE_DIRECT_FB__)","y")
#myModule.CompileFlags_CC('-I/usr/local/include/directfb')
#myModule.AddSrcFile('ewol/renderer/os/gui.directFB.cpp')
#endif
elif target.name=="Android": elif target.name=="Android":
myModule.AddExportflag_LD("-lGLESv2") myModule.AddExportflag_LD("-lGLESv2")
@ -195,7 +187,6 @@ def Create(target):
myModule.AddExportflag_LD("-ldl") myModule.AddExportflag_LD("-ldl")
myModule.AddExportflag_LD("-llog") myModule.AddExportflag_LD("-llog")
myModule.AddExportflag_LD("-landroid") myModule.AddExportflag_LD("-landroid")
java_tmp_dir = lutinTools.GetCurrentPath(__file__) + "/../../ewol/sources/android/src/" java_tmp_dir = lutinTools.GetCurrentPath(__file__) + "/../../ewol/sources/android/src/"
cpp_tmp_dir = lutinTools.GetCurrentPath(__file__) + "/ewol/renderer/Android/" cpp_tmp_dir = lutinTools.GetCurrentPath(__file__) + "/ewol/renderer/Android/"
java_tmp_src = java_tmp_dir + "org/ewol/EwolConstants" java_tmp_src = java_tmp_dir + "org/ewol/EwolConstants"
@ -203,25 +194,14 @@ def Create(target):
lutinMultiprocess.RunCommand("cd " + java_tmp_dir + " && javah org.ewol.EwolConstants") lutinMultiprocess.RunCommand("cd " + java_tmp_dir + " && javah org.ewol.EwolConstants")
lutinTools.CopyFile(java_tmp_dir + "org_ewol_EwolConstants.h", cpp_tmp_dir + "org_ewol_EwolConstants.h", True) lutinTools.CopyFile(java_tmp_dir + "org_ewol_EwolConstants.h", cpp_tmp_dir + "org_ewol_EwolConstants.h", True)
lutinTools.RemoveFile(java_tmp_src + ".class") lutinTools.RemoveFile(java_tmp_src + ".class")
myModule.AddSrcFile("ewol/renderer/Android/Context.cpp")
elif target.name=="Windows": elif target.name=="Windows":
myModule.AddModuleDepend("glew") myModule.AddModuleDepend("glew")
myModule.AddSrcFile("ewol/renderer/Windows/Context.cpp")
elif target.name=="MacOs": elif target.name=="MacOs":
myModule.AddExportflag_LD([ myModule.AddExportflag_LD([
"-framework Cocoa", "-framework Cocoa",
"-framework OpenGL", "-framework OpenGL",
"-framework QuartzCore", "-framework QuartzCore",
"-framework AppKit"]) "-framework AppKit"])
myModule.AddSrcFile([
"ewol/renderer/MacOs/Context.cpp",
"ewol/renderer/MacOs/Interface.mm",
"ewol/renderer/MacOs/AppDelegate.mm",
"ewol/renderer/MacOs/OpenglView.mm"])
else:
debug.error("unknow mode...")
# add the currrent module at the # add the currrent module at the
return myModule return myModule