[DEV] continue removing stl
This commit is contained in:
parent
c76ce3b339
commit
6493e83dbe
@ -7,7 +7,7 @@
|
||||
#include <ewol/DrawProperty.hpp>
|
||||
#include <ewol/debug.hpp>
|
||||
|
||||
std::ostream& ewol::operator <<(std::ostream& _os, const ewol::DrawProperty& _obj) {
|
||||
etk::Stream& ewol::operator <<(etk::Stream& _os, const ewol::DrawProperty& _obj) {
|
||||
_os << "{ windowsSize=" << _obj.m_windowsSize << " start=" << _obj.m_origin << " stop=" << (_obj.m_origin+_obj.m_size) << "}";
|
||||
return _os;
|
||||
}
|
||||
|
@ -43,6 +43,6 @@ namespace ewol {
|
||||
ivec2 m_size; //!< Windows clipping upper widget (can not be <0 and >m_windowsSize)
|
||||
void limit(const vec2& _origin, const vec2& _size);
|
||||
};
|
||||
std::ostream& operator <<(std::ostream& _os, const ewol::DrawProperty& _obj);
|
||||
etk::Stream& operator <<(etk::Stream& _os, const ewol::DrawProperty& _obj);
|
||||
|
||||
}
|
||||
|
@ -76,7 +76,7 @@ ewol::Padding ewol::Padding::operator+(const Padding& _v) {
|
||||
m_value[3] + _v.m_value[3]);
|
||||
}
|
||||
|
||||
std::ostream& ewol::operator <<(std::ostream& _os, const ewol::Padding& _obj) {
|
||||
etk::Stream& ewol::operator <<(etk::Stream& _os, const ewol::Padding& _obj) {
|
||||
_os << "{";
|
||||
_os << _obj.xLeft();
|
||||
_os << ",";
|
||||
|
@ -37,6 +37,6 @@ namespace ewol {
|
||||
Padding operator+(const Padding& _v);
|
||||
|
||||
};
|
||||
std::ostream& operator <<(std::ostream& _os, const ewol::Padding& _obj);
|
||||
etk::Stream& operator <<(etk::Stream& _os, const ewol::Padding& _obj);
|
||||
};
|
||||
|
||||
|
@ -44,7 +44,7 @@ ewol::compositing::Area::~Area() {
|
||||
void ewol::compositing::Area::loadProgram() {
|
||||
// get the shader resource :
|
||||
m_GLPosition = 0;
|
||||
m_GLprogram = gale::resource::Program::create(std::string("{ewol}DATA:textured3D.prog"));
|
||||
m_GLprogram = gale::resource::Program::create(etk::String("{ewol}DATA:textured3D.prog"));
|
||||
if (m_GLprogram != nullptr) {
|
||||
m_GLPosition = m_GLprogram->getAttribute("EW_coord3d");
|
||||
m_GLColor = m_GLprogram->getAttribute("EW_color");
|
||||
|
@ -14,21 +14,21 @@ const int32_t ewol::compositing::Drawing::m_vboIdColor(1);
|
||||
|
||||
#if 0
|
||||
|
||||
static void generatePolyGone(std::vector<vec2 > & input, std::vector<vec2 > & output )
|
||||
static void generatePolyGone(etk::Vector<vec2 > & input, etk::Vector<vec2 > & output )
|
||||
{
|
||||
if (input.size()<3) {
|
||||
return;
|
||||
}
|
||||
// TODO : Regenerate a linear poligone generation
|
||||
for (int32_t iii=1; iii<input.size()-1; iii++) {
|
||||
output.push_back(input[0]);
|
||||
output.push_back(input[iii]);
|
||||
output.push_back(input[iii+1]);
|
||||
output.pushBack(input[0]);
|
||||
output.pushBack(input[iii]);
|
||||
output.pushBack(input[iii+1]);
|
||||
}
|
||||
//EWOL_DEBUG("generate Plygone : " << input.size() << " == > " << output.size() );
|
||||
}
|
||||
|
||||
static void SutherlandHodgman(std::vector<vec2 > & input, std::vector<vec2 > & output, float sx, float sy, float ex, float ey)
|
||||
static void SutherlandHodgman(etk::Vector<vec2 > & input, etk::Vector<vec2 > & output, float sx, float sy, float ex, float ey)
|
||||
{
|
||||
// with Sutherland-Hodgman-Algorithm
|
||||
if (input.size() <0) {
|
||||
@ -53,7 +53,7 @@ static void SutherlandHodgman(std::vector<vec2 > & input, std::vector<vec2 > & o
|
||||
float bbb = lastElement.y - (aaa*lastElement.x);
|
||||
destPoint.y = aaa*sx + bbb;
|
||||
destPoint.x = sx;
|
||||
output.push_back(destPoint);
|
||||
output.pushBack(destPoint);
|
||||
} else {
|
||||
//EWOL_DEBUG("element OUT == > OUT ");
|
||||
}
|
||||
@ -61,7 +61,7 @@ static void SutherlandHodgman(std::vector<vec2 > & input, std::vector<vec2 > & o
|
||||
} else {
|
||||
if(true == inside) {
|
||||
//EWOL_DEBUG("element IN == > IN ");
|
||||
output.push_back(input[iii]);
|
||||
output.pushBack(input[iii]);
|
||||
} else {
|
||||
//EWOL_DEBUG("element OUT == > IN ");
|
||||
//new point intersection ...
|
||||
@ -70,8 +70,8 @@ static void SutherlandHodgman(std::vector<vec2 > & input, std::vector<vec2 > & o
|
||||
float bbb = lastElement.y - (aaa*lastElement.x);
|
||||
destPoint.y = aaa*sx + bbb;
|
||||
destPoint.x = sx;
|
||||
output.push_back(destPoint);
|
||||
output.push_back(input[iii]);
|
||||
output.pushBack(destPoint);
|
||||
output.pushBack(input[iii]);
|
||||
}
|
||||
inside = true;
|
||||
}
|
||||
@ -98,7 +98,7 @@ static void SutherlandHodgman(std::vector<vec2 > & input, std::vector<vec2 > & o
|
||||
float bbb = lastElement.x - (aaa*lastElement.y);
|
||||
destPoint.y = sy;
|
||||
destPoint.x = sy*aaa + bbb;
|
||||
output.push_back(destPoint);
|
||||
output.pushBack(destPoint);
|
||||
} else {
|
||||
//EWOL_DEBUG("element OUT == > OUT ");
|
||||
}
|
||||
@ -106,7 +106,7 @@ static void SutherlandHodgman(std::vector<vec2 > & input, std::vector<vec2 > & o
|
||||
} else {
|
||||
if(true == inside) {
|
||||
//EWOL_DEBUG("element IN == > IN ");
|
||||
output.push_back(input[iii]);
|
||||
output.pushBack(input[iii]);
|
||||
} else {
|
||||
//EWOL_DEBUG("element OUT == > IN ");
|
||||
//new point intersection ...
|
||||
@ -115,8 +115,8 @@ static void SutherlandHodgman(std::vector<vec2 > & input, std::vector<vec2 > & o
|
||||
float bbb = lastElement.x - (aaa*lastElement.y);
|
||||
destPoint.y = sy;
|
||||
destPoint.x = sy*aaa + bbb;
|
||||
output.push_back(destPoint);
|
||||
output.push_back(input[iii]);
|
||||
output.pushBack(destPoint);
|
||||
output.pushBack(input[iii]);
|
||||
}
|
||||
inside = true;
|
||||
}
|
||||
@ -143,7 +143,7 @@ static void SutherlandHodgman(std::vector<vec2 > & input, std::vector<vec2 > & o
|
||||
float bbb = lastElement.y - (aaa*lastElement.x);
|
||||
destPoint.y = aaa*ex + bbb;
|
||||
destPoint.x = ex;
|
||||
output.push_back(destPoint);
|
||||
output.pushBack(destPoint);
|
||||
} else {
|
||||
//EWOL_DEBUG("element OUT == > OUT ");
|
||||
}
|
||||
@ -151,7 +151,7 @@ static void SutherlandHodgman(std::vector<vec2 > & input, std::vector<vec2 > & o
|
||||
} else {
|
||||
if(true == inside) {
|
||||
//EWOL_DEBUG("element IN == > IN ");
|
||||
output.push_back(input[iii]);
|
||||
output.pushBack(input[iii]);
|
||||
} else {
|
||||
//EWOL_DEBUG("element OUT == > IN ");
|
||||
//new point intersection ...
|
||||
@ -160,8 +160,8 @@ static void SutherlandHodgman(std::vector<vec2 > & input, std::vector<vec2 > & o
|
||||
float bbb = lastElement.y - (aaa*lastElement.x);
|
||||
destPoint.y = aaa*ex + bbb;
|
||||
destPoint.x = ex;
|
||||
output.push_back(destPoint);
|
||||
output.push_back(input[iii]);
|
||||
output.pushBack(destPoint);
|
||||
output.pushBack(input[iii]);
|
||||
}
|
||||
inside = true;
|
||||
}
|
||||
@ -187,7 +187,7 @@ static void SutherlandHodgman(std::vector<vec2 > & input, std::vector<vec2 > & o
|
||||
float bbb = lastElement.x - (aaa*lastElement.y);
|
||||
destPoint.y = ey;
|
||||
destPoint.x = ey*aaa + bbb;
|
||||
output.push_back(destPoint);
|
||||
output.pushBack(destPoint);
|
||||
} else {
|
||||
//EWOL_DEBUG("element OUT == > OUT ");
|
||||
}
|
||||
@ -195,7 +195,7 @@ static void SutherlandHodgman(std::vector<vec2 > & input, std::vector<vec2 > & o
|
||||
} else {
|
||||
if(true == inside) {
|
||||
//EWOL_DEBUG("element IN == > IN ");
|
||||
output.push_back(input[iii]);
|
||||
output.pushBack(input[iii]);
|
||||
} else {
|
||||
//EWOL_DEBUG("element OUT == > IN ");
|
||||
//new point intersection ...
|
||||
@ -204,8 +204,8 @@ static void SutherlandHodgman(std::vector<vec2 > & input, std::vector<vec2 > & o
|
||||
float bbb = lastElement.x - (aaa*lastElement.y);
|
||||
destPoint.y = ey;
|
||||
destPoint.x = ey*aaa + bbb;
|
||||
output.push_back(destPoint);
|
||||
output.push_back(input[iii]);
|
||||
output.pushBack(destPoint);
|
||||
output.pushBack(input[iii]);
|
||||
}
|
||||
inside = true;
|
||||
}
|
||||
|
@ -15,7 +15,7 @@ const int32_t ewol::compositing::Image::m_vboIdCoordTex(1);
|
||||
const int32_t ewol::compositing::Image::m_vboIdColor(2);
|
||||
#define NB_VBO (3)
|
||||
|
||||
ewol::compositing::Image::Image(const std::string& _imageName,
|
||||
ewol::compositing::Image::Image(const etk::String& _imageName,
|
||||
bool _df,
|
||||
int32_t _size) :
|
||||
m_filename(_imageName),
|
||||
@ -268,7 +268,7 @@ void ewol::compositing::Image::printPart(const vec2& _size,
|
||||
m_VBO->flush();
|
||||
}
|
||||
|
||||
void ewol::compositing::Image::setSource(const std::string& _newFile, const vec2& _size) {
|
||||
void ewol::compositing::Image::setSource(const etk::String& _newFile, const vec2& _size) {
|
||||
clear();
|
||||
if ( m_filename == _newFile
|
||||
&& m_requestSize == _size) {
|
||||
|
@ -17,7 +17,7 @@ namespace ewol {
|
||||
public:
|
||||
static const int32_t sizeAuto;
|
||||
private:
|
||||
std::string m_filename;
|
||||
etk::String m_filename;
|
||||
ivec2 m_requestSize;
|
||||
vec3 m_position; //!< The current position to draw
|
||||
vec3 m_clippingPosStart; //!< Clipping start position
|
||||
@ -54,7 +54,7 @@ namespace ewol {
|
||||
* @param[in] _df enable distance field mode
|
||||
* @param[in] _size for the image when Verctorial image loading is requested
|
||||
*/
|
||||
Image(const std::string& _imageName="",
|
||||
Image(const etk::String& _imageName="",
|
||||
bool _df=false,
|
||||
int32_t _size=ewol::compositing::Image::sizeAuto);
|
||||
/**
|
||||
@ -159,10 +159,10 @@ namespace ewol {
|
||||
* @param[in] _newFile New file of the Image
|
||||
* @param[in] _size for the image when Verctorial image loading is requested
|
||||
*/
|
||||
void setSource(const std::string& _newFile, int32_t _size=32) {
|
||||
void setSource(const etk::String& _newFile, int32_t _size=32) {
|
||||
setSource(_newFile, vec2(_size,_size));
|
||||
};
|
||||
void setSource(const std::string& _newFile, const vec2& _size);
|
||||
void setSource(const etk::String& _newFile, const vec2& _size);
|
||||
void setSource(egami::Image _image);
|
||||
/**
|
||||
* @brief Sometimes the user declare an image but not allocate the ressources all the time, this is to know it ..
|
||||
|
@ -13,7 +13,7 @@ const int32_t ewol::compositing::Shaper::m_vboIdCoord(0);
|
||||
const int32_t ewol::compositing::Shaper::m_vboIdPos(1);
|
||||
#define NB_VBO (2)
|
||||
|
||||
ewol::compositing::Shaper::Shaper(const std::string& _shaperName) :
|
||||
ewol::compositing::Shaper::Shaper(const etk::String& _shaperName) :
|
||||
m_name(_shaperName),
|
||||
m_config(nullptr),
|
||||
m_confIdMode(-1),
|
||||
@ -106,10 +106,10 @@ void ewol::compositing::Shaper::loadProgram() {
|
||||
m_confImageFile = m_config->request("image");
|
||||
m_confColorFile = m_config->request("color");
|
||||
}
|
||||
std::string basicShaderFile = m_config->getString(m_confProgramFile);
|
||||
etk::String basicShaderFile = m_config->getString(m_confProgramFile);
|
||||
if (basicShaderFile != "") {
|
||||
std::string tmpFilename(basicShaderFile);
|
||||
if (tmpFilename.find(':') == std::string::npos) {
|
||||
etk::String tmpFilename(basicShaderFile);
|
||||
if (tmpFilename.find(':') == etk::String::npos) {
|
||||
// get the relative position of the current file ...
|
||||
etk::FSNode file(m_name);
|
||||
tmpFilename = file.getRelativeFolder() + basicShaderFile;
|
||||
@ -133,10 +133,10 @@ void ewol::compositing::Shaper::loadProgram() {
|
||||
// for the texture ID :
|
||||
m_GLtexID = m_GLprogram->getUniform("EW_texID");
|
||||
}
|
||||
std::string basicImageFile = m_config->getString(m_confImageFile);
|
||||
etk::String basicImageFile = m_config->getString(m_confImageFile);
|
||||
if (basicImageFile != "") {
|
||||
std::string tmpFilename(basicImageFile);
|
||||
if (tmpFilename.find(':') == std::string::npos) {
|
||||
etk::String tmpFilename(basicImageFile);
|
||||
if (tmpFilename.find(':') == etk::String::npos) {
|
||||
// get the relative position of the current file ...
|
||||
etk::FSNode file(m_name);
|
||||
tmpFilename = file.getRelativeFolder() + basicImageFile;
|
||||
@ -148,10 +148,10 @@ void ewol::compositing::Shaper::loadProgram() {
|
||||
m_resourceTexture = ewol::resource::TextureFile::create(tmpFilename, size);
|
||||
}
|
||||
}
|
||||
std::string basicColorFile = m_config->getString(m_confColorFile);
|
||||
etk::String basicColorFile = m_config->getString(m_confColorFile);
|
||||
if (basicColorFile != "") {
|
||||
std::string tmpFilename(basicColorFile);
|
||||
if (tmpFilename.find(':') == std::string::npos) {
|
||||
etk::String tmpFilename(basicColorFile);
|
||||
if (tmpFilename.find(':') == etk::String::npos) {
|
||||
// get the relative position of the current file ...
|
||||
etk::FSNode file(m_name);
|
||||
tmpFilename = file.getRelativeFolder() + basicColorFile;
|
||||
@ -162,11 +162,11 @@ void ewol::compositing::Shaper::loadProgram() {
|
||||
m_colorProperty = ewol::resource::ColorFile::create(tmpFilename);
|
||||
if ( m_GLprogram != nullptr
|
||||
&& m_colorProperty != nullptr) {
|
||||
std::vector<std::string> listColor = m_colorProperty->getColors();
|
||||
etk::Vector<etk::String> listColor = m_colorProperty->getColors();
|
||||
for (auto tmpColor : listColor) {
|
||||
int32_t glId = m_GLprogram->getUniform(tmpColor);
|
||||
int32_t colorID = m_colorProperty->request(tmpColor);
|
||||
m_listAssiciatedId.push_back(ivec2(glId, colorID));
|
||||
m_listAssiciatedId.pushBack(ivec2(glId, colorID));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -275,7 +275,7 @@ bool ewol::compositing::Shaper::periodicCall(const ewol::event::Time& _event) {
|
||||
}
|
||||
m_stateTransition += _event.getDeltaCall() / timeRelativity;
|
||||
//m_stateTransition += _event.getDeltaCall();
|
||||
m_stateTransition = std::avg(0.0f, m_stateTransition, 1.0f);
|
||||
m_stateTransition = etk::avg(0.0f, m_stateTransition, 1.0f);
|
||||
EWOL_VERBOSE("relative=" << timeRelativity << " Transition : " << m_stateTransition);
|
||||
}
|
||||
return true;
|
||||
@ -478,10 +478,10 @@ void ewol::compositing::Shaper::setShape(const vec2& _origin, const vec2& _size,
|
||||
border.yTop() - borderTmp.yTop(),
|
||||
border.xRight() - borderTmp.xRight(),
|
||||
border.yButtom() + borderTmp.yButtom());
|
||||
ewol::Padding inside(insideBorder.xLeft() + std::max(0.0f, paddingIn.xLeft()),
|
||||
insideBorder.yTop() - std::max(0.0f, paddingIn.yTop()),
|
||||
insideBorder.xRight() - std::max(0.0f, paddingIn.xRight()),
|
||||
insideBorder.yButtom() + std::max(0.0f, paddingIn.yButtom()));
|
||||
ewol::Padding inside(insideBorder.xLeft() + etk::max(0.0f, paddingIn.xLeft()),
|
||||
insideBorder.yTop() - etk::max(0.0f, paddingIn.yTop()),
|
||||
insideBorder.xRight() - etk::max(0.0f, paddingIn.xRight()),
|
||||
insideBorder.yButtom() + etk::max(0.0f, paddingIn.yButtom()));
|
||||
|
||||
#endif
|
||||
/*
|
||||
@ -624,7 +624,7 @@ ewol::Padding ewol::compositing::Shaper::getBorder() {
|
||||
return padding;
|
||||
}
|
||||
|
||||
void ewol::compositing::Shaper::setSource(const std::string& _newFile) {
|
||||
void ewol::compositing::Shaper::setSource(const etk::String& _newFile) {
|
||||
clear();
|
||||
unLoadProgram();
|
||||
m_name = _newFile;
|
||||
@ -645,7 +645,7 @@ const etk::Color<float>& ewol::compositing::Shaper::getColor(int32_t _id) {
|
||||
return m_colorProperty->get(_id);
|
||||
}
|
||||
|
||||
int32_t ewol::compositing::Shaper::requestColor(const std::string& _name) {
|
||||
int32_t ewol::compositing::Shaper::requestColor(const etk::String& _name) {
|
||||
if (m_colorProperty == nullptr) {
|
||||
EWOL_WARNING("nullptr of m_colorProperty ==> return -1 for name " << _name);
|
||||
return -1;
|
||||
@ -653,7 +653,7 @@ int32_t ewol::compositing::Shaper::requestColor(const std::string& _name) {
|
||||
return m_colorProperty->request(_name);
|
||||
}
|
||||
|
||||
int32_t ewol::compositing::Shaper::requestConfig(const std::string& _name) {
|
||||
int32_t ewol::compositing::Shaper::requestConfig(const etk::String& _name) {
|
||||
if (m_config == nullptr) {
|
||||
EWOL_WARNING("nullptr of m_config ==> return -1 for name " << _name);
|
||||
return -1;
|
||||
@ -672,17 +672,17 @@ double ewol::compositing::Shaper::getConfigNumber(int32_t _id) {
|
||||
|
||||
|
||||
namespace etk {
|
||||
template<> std::string to_string<ewol::compositing::Shaper>(const ewol::compositing::Shaper& _obj) {
|
||||
template<> etk::String toString<ewol::compositing::Shaper>(const ewol::compositing::Shaper& _obj) {
|
||||
return _obj.getSource();
|
||||
}
|
||||
template<> std::u32string to_u32string<ewol::compositing::Shaper>(const ewol::compositing::Shaper& _obj) {
|
||||
return etk::to_u32string(etk::to_string(_obj));
|
||||
template<> etk::UString toUString<ewol::compositing::Shaper>(const ewol::compositing::Shaper& _obj) {
|
||||
return etk::toUString(etk::toString(_obj));
|
||||
}
|
||||
template<> bool from_string<ewol::compositing::Shaper>(ewol::compositing::Shaper& _variableRet, const std::string& _value) {
|
||||
template<> bool from_string<ewol::compositing::Shaper>(ewol::compositing::Shaper& _variableRet, const etk::String& _value) {
|
||||
_variableRet.setSource(_value);
|
||||
return true;
|
||||
}
|
||||
template<> bool from_string<ewol::compositing::Shaper>(ewol::compositing::Shaper& _variableRet, const std::u32string& _value) {
|
||||
return from_string(_variableRet, etk::to_string(_value));
|
||||
template<> bool from_string<ewol::compositing::Shaper>(ewol::compositing::Shaper& _variableRet, const etk::UString& _value) {
|
||||
return from_string(_variableRet, etk::toString(_value));
|
||||
}
|
||||
};
|
@ -38,7 +38,7 @@ namespace ewol {
|
||||
// TODO : Abstaraction between states (call by name and the system greate IDs
|
||||
class Shaper : public ewol::Compositing {
|
||||
private:
|
||||
std::string m_name; //!< Name of the configuration of the shaper.
|
||||
etk::String m_name; //!< Name of the configuration of the shaper.
|
||||
// External theme config:
|
||||
ememory::SharedPtr<ewol::resource::ConfigFile> m_config; //!< pointer on the config file resources
|
||||
int32_t m_confIdPaddingOut[shaperPosCount]; //!< Padding out property : X-left X-right Y-top Y-buttom
|
||||
@ -75,7 +75,7 @@ namespace ewol {
|
||||
int32_t m_nbVertexToDisplay;
|
||||
// color management theme:
|
||||
ememory::SharedPtr<ewol::resource::ColorFile> m_colorProperty; //!< input resource for color management
|
||||
std::vector<ivec2> m_listAssiciatedId; //!< Corellation ID between ColorProperty (Y) and OpenGL Program (X)
|
||||
etk::Vector<ivec2> m_listAssiciatedId; //!< Corellation ID between ColorProperty (Y) and OpenGL Program (X)
|
||||
protected:
|
||||
static const int32_t m_vboIdCoord;
|
||||
static const int32_t m_vboIdPos;
|
||||
@ -94,7 +94,7 @@ namespace ewol {
|
||||
* @brief generic constructor
|
||||
* @param[in] _shaperName Name of the file that might be loaded
|
||||
*/
|
||||
Shaper(const std::string& _shaperName="");
|
||||
Shaper(const etk::String& _shaperName="");
|
||||
/**
|
||||
* @brief generic destructor
|
||||
*/
|
||||
@ -166,12 +166,12 @@ namespace ewol {
|
||||
* @brief change the shaper Source
|
||||
* @param[in] _newFile New file of the shaper
|
||||
*/
|
||||
void setSource(const std::string& _newFile);
|
||||
void setSource(const etk::String& _newFile);
|
||||
/**
|
||||
* @brief get the shaper file Source
|
||||
* @return the shapper file name
|
||||
*/
|
||||
const std::string& getSource() const {
|
||||
const etk::String& getSource() const {
|
||||
return m_name;
|
||||
};
|
||||
/**
|
||||
@ -236,7 +236,7 @@ namespace ewol {
|
||||
* @param[in] _name Name of the element requested
|
||||
* @return The Id of the color
|
||||
*/
|
||||
int32_t requestColor(const std::string& _name);
|
||||
int32_t requestColor(const etk::String& _name);
|
||||
/**
|
||||
* @brief Get The color associated at an ID.
|
||||
* @param[in] _id Id of the color
|
||||
@ -249,7 +249,7 @@ namespace ewol {
|
||||
* @param[in] _name Name of the element requested
|
||||
* @return The Id of the element
|
||||
*/
|
||||
int32_t requestConfig(const std::string& _name);
|
||||
int32_t requestConfig(const etk::String& _name);
|
||||
/**
|
||||
* @brief Get The number associated at an ID.
|
||||
* @param[in] _id Id of the parameter
|
||||
|
@ -7,7 +7,7 @@
|
||||
#include <ewol/debug.hpp>
|
||||
#include <ewol/compositing/Sprite.hpp>
|
||||
|
||||
ewol::compositing::Sprite::Sprite(const std::string& _imageName, const ivec2& _nbSprite, int32_t _size) :
|
||||
ewol::compositing::Sprite::Sprite(const etk::String& _imageName, const ivec2& _nbSprite, int32_t _size) :
|
||||
ewol::compositing::Image(_imageName, false, _size),
|
||||
m_nbSprite(_nbSprite),
|
||||
m_unitarySpriteSize(0,0) {
|
||||
|
@ -15,7 +15,7 @@ namespace ewol {
|
||||
ivec2 m_nbSprite; //!< number of sprite in vertical and horizontal
|
||||
vec2 m_unitarySpriteSize; //!< size of a unique sprite
|
||||
public:
|
||||
Sprite(const std::string& _imageName,
|
||||
Sprite(const etk::String& _imageName,
|
||||
const ivec2& _nbSprite,
|
||||
int32_t _size=ewol::compositing::Image::sizeAuto);
|
||||
virtual ~Sprite() {};
|
||||
|
@ -9,7 +9,7 @@
|
||||
#include <ewol/context/Context.hpp>
|
||||
#include <etk/types.hpp>
|
||||
|
||||
ewol::compositing::Text::Text(const std::string& _fontName, int32_t _fontSize) :
|
||||
ewol::compositing::Text::Text(const etk::String& _fontName, int32_t _fontSize) :
|
||||
m_font(nullptr) {
|
||||
setFont(_fontName, _fontSize);
|
||||
}
|
||||
@ -124,7 +124,7 @@ ewol::GlyphProperty * ewol::compositing::Text::getGlyphPointer(char32_t _charcod
|
||||
|
||||
void ewol::compositing::Text::setFontSize(int32_t _fontSize) {
|
||||
// get old size
|
||||
std::string fontName = "";
|
||||
etk::String fontName = "";
|
||||
if (m_font != nullptr) {
|
||||
fontName = m_font->getName();
|
||||
// Remove the :XX for the size ...
|
||||
@ -134,7 +134,7 @@ void ewol::compositing::Text::setFontSize(int32_t _fontSize) {
|
||||
setFont(fontName, _fontSize);
|
||||
}
|
||||
|
||||
void ewol::compositing::Text::setFontName(const std::string& _fontName) {
|
||||
void ewol::compositing::Text::setFontName(const etk::String& _fontName) {
|
||||
// get old size
|
||||
int32_t fontSize = -1;
|
||||
if (m_font != nullptr) {
|
||||
@ -143,7 +143,7 @@ void ewol::compositing::Text::setFontName(const std::string& _fontName) {
|
||||
setFont(_fontName, fontSize);
|
||||
}
|
||||
|
||||
void ewol::compositing::Text::setFont(std::string _fontName, int32_t _fontSize) {
|
||||
void ewol::compositing::Text::setFont(etk::String _fontName, int32_t _fontSize) {
|
||||
clear();
|
||||
// remove old one
|
||||
ememory::SharedPtr<ewol::resource::TexturedFont> previousFont = m_font;
|
||||
@ -154,7 +154,7 @@ void ewol::compositing::Text::setFont(std::string _fontName, int32_t _fontSize)
|
||||
_fontName = ewol::getContext().getFontDefault().getName();
|
||||
}
|
||||
_fontName += ":";
|
||||
_fontName += etk::to_string(_fontSize);
|
||||
_fontName += etk::toString(_fontSize);
|
||||
EWOL_VERBOSE("plop : " << _fontName << " size=" << _fontSize << " result :" << _fontName);
|
||||
// link to new one
|
||||
m_font = ewol::resource::TexturedFont::create(_fontName);
|
||||
|
@ -13,7 +13,7 @@
|
||||
#include <ewol/resource/TexturedFont.hpp>
|
||||
#include <ewol/compositing/TextBase.hpp>
|
||||
#include <exml/exml.hpp>
|
||||
#include <string>
|
||||
#include <etk/String.hpp>
|
||||
|
||||
#include <etk/Color.hpp>
|
||||
|
||||
@ -28,7 +28,7 @@ namespace ewol {
|
||||
* @param[in] _fontName Name of the font that might be loaded
|
||||
* @param[in] _fontSize size of the font that might be loaded
|
||||
*/
|
||||
Text(const std::string& _fontName="", int32_t _fontSize=-1);
|
||||
Text(const etk::String& _fontName="", int32_t _fontSize=-1);
|
||||
/**
|
||||
* @brief generic destructor
|
||||
*/
|
||||
@ -45,8 +45,8 @@ namespace ewol {
|
||||
|
||||
public:
|
||||
virtual void setFontSize(int32_t _fontSize);
|
||||
virtual void setFontName(const std::string& _fontName);
|
||||
virtual void setFont(std::string _fontName, int32_t _fontSize);
|
||||
virtual void setFontName(const etk::String& _fontName);
|
||||
virtual void setFont(etk::String _fontName, int32_t _fontSize);
|
||||
virtual void setFontMode(enum ewol::font::mode _mode);
|
||||
virtual void printChar(const char32_t& _charcode);
|
||||
virtual vec3 calculateSizeChar(const char32_t& _charcode);
|
||||
|
@ -16,7 +16,7 @@ const int32_t ewol::compositing::TextBase::m_vboIdColor(2);
|
||||
const int32_t ewol::compositing::TextBase::m_vboIdGlyphLevel(3);
|
||||
#define NB_VBO (4)
|
||||
|
||||
ewol::compositing::TextBase::TextBase(const std::string& _shaderName, bool _loadProgram) :
|
||||
ewol::compositing::TextBase::TextBase(const etk::String& _shaderName, bool _loadProgram) :
|
||||
m_position(0.0, 0.0, 0.0),
|
||||
m_clippingPosStart(0.0, 0.0, 0.0),
|
||||
m_clippingPosStop(0.0, 0.0, 0.0),
|
||||
@ -59,7 +59,7 @@ ewol::compositing::TextBase::~TextBase() {
|
||||
|
||||
}
|
||||
|
||||
void ewol::compositing::TextBase::loadProgram(const std::string& _shaderName) {
|
||||
void ewol::compositing::TextBase::loadProgram(const etk::String& _shaderName) {
|
||||
// get the shader resource:
|
||||
m_GLPosition = 0;
|
||||
ememory::SharedPtr<gale::resource::Program> old = m_GLprogram;
|
||||
@ -132,10 +132,10 @@ void ewol::compositing::TextBase::setPos(const vec3& _pos) {
|
||||
// check min max for display area
|
||||
if (m_nbCharDisplayed != 0) {
|
||||
EWOL_VERBOSE("update size 1 " << m_sizeDisplayStart << " " << m_sizeDisplayStop);
|
||||
m_sizeDisplayStop.setX(std::max(m_position.x(), m_sizeDisplayStop.x()));
|
||||
m_sizeDisplayStop.setY(std::max(m_position.y(), m_sizeDisplayStop.y()));
|
||||
m_sizeDisplayStart.setX(std::min(m_position.x(), m_sizeDisplayStart.x()));
|
||||
m_sizeDisplayStart.setY(std::min(m_position.y(), m_sizeDisplayStart.y()));
|
||||
m_sizeDisplayStop.setX(etk::max(m_position.x(), m_sizeDisplayStop.x()));
|
||||
m_sizeDisplayStop.setY(etk::max(m_position.y(), m_sizeDisplayStop.y()));
|
||||
m_sizeDisplayStart.setX(etk::min(m_position.x(), m_sizeDisplayStart.x()));
|
||||
m_sizeDisplayStart.setY(etk::min(m_position.y(), m_sizeDisplayStart.y()));
|
||||
EWOL_VERBOSE("update size 2 " << m_sizeDisplayStart << " " << m_sizeDisplayStop);
|
||||
}
|
||||
// update position
|
||||
@ -150,10 +150,10 @@ void ewol::compositing::TextBase::setPos(const vec3& _pos) {
|
||||
EWOL_VERBOSE("update size 0 " << m_sizeDisplayStart << " " << m_sizeDisplayStop);
|
||||
} else {
|
||||
EWOL_VERBOSE("update size 3 " << m_sizeDisplayStart << " " << m_sizeDisplayStop);
|
||||
m_sizeDisplayStop.setX(std::max(m_position.x(), m_sizeDisplayStop.x()));
|
||||
m_sizeDisplayStop.setY(std::max(m_position.y(), m_sizeDisplayStop.y()));
|
||||
m_sizeDisplayStart.setX(std::min(m_position.x(), m_sizeDisplayStart.x()));
|
||||
m_sizeDisplayStart.setY(std::min(m_position.y(), m_sizeDisplayStart.y()));
|
||||
m_sizeDisplayStop.setX(etk::max(m_position.x(), m_sizeDisplayStop.x()));
|
||||
m_sizeDisplayStop.setY(etk::max(m_position.y(), m_sizeDisplayStop.y()));
|
||||
m_sizeDisplayStart.setX(etk::min(m_position.x(), m_sizeDisplayStart.x()));
|
||||
m_sizeDisplayStart.setY(etk::min(m_position.y(), m_sizeDisplayStart.y()));
|
||||
EWOL_VERBOSE("update size 4 " << m_sizeDisplayStart << " " << m_sizeDisplayStop);
|
||||
}
|
||||
}
|
||||
@ -241,13 +241,13 @@ void ewol::compositing::TextBase::setKerningMode(bool _newMode) {
|
||||
m_kerning = _newMode;
|
||||
}
|
||||
|
||||
void ewol::compositing::TextBase::print(const std::u32string& _text) {
|
||||
std::vector<TextDecoration> decorationEmpty;
|
||||
void ewol::compositing::TextBase::print(const etk::UString& _text) {
|
||||
etk::Vector<TextDecoration> decorationEmpty;
|
||||
print(_text, decorationEmpty);
|
||||
}
|
||||
|
||||
void ewol::compositing::TextBase::print(const std::string& _text) {
|
||||
std::vector<TextDecoration> decorationEmpty;
|
||||
void ewol::compositing::TextBase::print(const etk::String& _text) {
|
||||
etk::Vector<TextDecoration> decorationEmpty;
|
||||
print(_text, decorationEmpty);
|
||||
}
|
||||
|
||||
@ -263,7 +263,7 @@ void ewol::compositing::TextBase::parseHtmlNode(const exml::Element& _element) {
|
||||
// nothing to do ...
|
||||
continue;
|
||||
} else if (it.isText() == true) {
|
||||
htmlAddData(etk::to_u32string(it.getValue()));
|
||||
htmlAddData(etk::toUString(it.getValue()));
|
||||
EWOL_VERBOSE("XML add : " << it.getValue());
|
||||
continue;
|
||||
} else if (it.isElement() == false) {
|
||||
@ -282,7 +282,7 @@ void ewol::compositing::TextBase::parseHtmlNode(const exml::Element& _element) {
|
||||
} else if (etk::compare_no_case(elem.getValue(), "font") == true) {
|
||||
EWOL_VERBOSE("XML Font ...");
|
||||
TextDecoration tmpDeco = m_htmlDecoTmp;
|
||||
std::string colorValue = elem.attributes["color"];
|
||||
etk::String colorValue = elem.attributes["color"];
|
||||
if (colorValue.size() != 0) {
|
||||
m_htmlDecoTmp.m_colorFg = colorValue;
|
||||
}
|
||||
@ -352,23 +352,23 @@ void ewol::compositing::TextBase::parseHtmlNode(const exml::Element& _element) {
|
||||
}
|
||||
}
|
||||
|
||||
void ewol::compositing::TextBase::printDecorated(const std::string& _text) {
|
||||
std::string tmpData("<html>\n<body>\n");
|
||||
void ewol::compositing::TextBase::printDecorated(const etk::String& _text) {
|
||||
etk::String tmpData("<html>\n<body>\n");
|
||||
tmpData += _text;
|
||||
tmpData += "\n</body>\n</html>\n";
|
||||
//EWOL_DEBUG("plop : " << tmpData);
|
||||
printHTML(tmpData);
|
||||
}
|
||||
|
||||
void ewol::compositing::TextBase::printDecorated(const std::u32string& _text) {
|
||||
std::u32string tmpData(U"<html>\n<body>\n");
|
||||
void ewol::compositing::TextBase::printDecorated(const etk::UString& _text) {
|
||||
etk::UString tmpData(U"<html>\n<body>\n");
|
||||
tmpData += _text;
|
||||
tmpData += U"\n</body>\n</html>\n";
|
||||
//EWOL_DEBUG("plop : " << tmpData);
|
||||
printHTML(tmpData);
|
||||
}
|
||||
|
||||
void ewol::compositing::TextBase::printHTML(const std::string& _text) {
|
||||
void ewol::compositing::TextBase::printHTML(const etk::String& _text) {
|
||||
exml::Document doc;
|
||||
|
||||
// reset parameter :
|
||||
@ -396,15 +396,15 @@ void ewol::compositing::TextBase::printHTML(const std::string& _text) {
|
||||
htmlFlush();
|
||||
}
|
||||
|
||||
void ewol::compositing::TextBase::printHTML(const std::u32string& _text) {
|
||||
void ewol::compositing::TextBase::printHTML(const etk::UString& _text) {
|
||||
exml::Document doc;
|
||||
|
||||
// reset parameter :
|
||||
m_htmlDecoTmp.m_colorBg = m_defaultColorBg;
|
||||
m_htmlDecoTmp.m_colorFg = m_defaultColorFg;
|
||||
m_htmlDecoTmp.m_mode = ewol::font::Regular;
|
||||
// TODO : Create an instance of xml parser to manage std::u32string...
|
||||
if (doc.parse(etk::to_string(_text)) == false) {
|
||||
// TODO : Create an instance of xml parser to manage etk::UString...
|
||||
if (doc.parse(etk::toString(_text)) == false) {
|
||||
EWOL_ERROR( "can not load XML: PARSING error: Decorated text ");
|
||||
return;
|
||||
}
|
||||
@ -424,7 +424,7 @@ void ewol::compositing::TextBase::printHTML(const std::u32string& _text) {
|
||||
htmlFlush();
|
||||
}
|
||||
|
||||
void ewol::compositing::TextBase::print(const std::string& _text, const std::vector<TextDecoration>& _decoration) {
|
||||
void ewol::compositing::TextBase::print(const etk::String& _text, const etk::Vector<TextDecoration>& _decoration) {
|
||||
etk::Color<> tmpFg(m_color);
|
||||
etk::Color<> tmpBg(m_colorBg);
|
||||
if (m_alignement == alignDisable) {
|
||||
@ -609,7 +609,7 @@ void ewol::compositing::TextBase::print(const std::string& _text, const std::vec
|
||||
}
|
||||
}
|
||||
|
||||
void ewol::compositing::TextBase::print(const std::u32string& _text, const std::vector<TextDecoration>& _decoration) {
|
||||
void ewol::compositing::TextBase::print(const etk::UString& _text, const etk::Vector<TextDecoration>& _decoration) {
|
||||
etk::Color<> tmpFg(m_color);
|
||||
etk::Color<> tmpBg(m_colorBg);
|
||||
if (m_alignement == alignDisable) {
|
||||
@ -820,7 +820,7 @@ void ewol::compositing::TextBase::disableAlignement() {
|
||||
m_alignement = alignDisable;
|
||||
}
|
||||
|
||||
vec3 ewol::compositing::TextBase::calculateSizeHTML(const std::string& _text) {
|
||||
vec3 ewol::compositing::TextBase::calculateSizeHTML(const etk::String& _text) {
|
||||
// remove intermediate result
|
||||
reset();
|
||||
//EWOL_DEBUG(" 0 size for=\n" << text);
|
||||
@ -834,11 +834,11 @@ vec3 ewol::compositing::TextBase::calculateSizeHTML(const std::string& _text) {
|
||||
//EWOL_DEBUG(" 1 Stop pos=" << m_sizeDisplayStop);
|
||||
|
||||
// get the last elements
|
||||
m_sizeDisplayStop.setValue(std::max(m_position.x(), m_sizeDisplayStop.x()) ,
|
||||
std::max(m_position.y(), m_sizeDisplayStop.y()) ,
|
||||
m_sizeDisplayStop.setValue(etk::max(m_position.x(), m_sizeDisplayStop.x()) ,
|
||||
etk::max(m_position.y(), m_sizeDisplayStop.y()) ,
|
||||
0);
|
||||
m_sizeDisplayStart.setValue(std::min(m_position.x(), m_sizeDisplayStart.x()) ,
|
||||
std::min(m_position.y(), m_sizeDisplayStart.y()) ,
|
||||
m_sizeDisplayStart.setValue(etk::min(m_position.x(), m_sizeDisplayStart.x()) ,
|
||||
etk::min(m_position.y(), m_sizeDisplayStart.y()) ,
|
||||
0);
|
||||
|
||||
//EWOL_DEBUG(" 2 Start pos=" << m_sizeDisplayStart);
|
||||
@ -851,7 +851,7 @@ vec3 ewol::compositing::TextBase::calculateSizeHTML(const std::string& _text) {
|
||||
m_sizeDisplayStop.z()-m_sizeDisplayStart.z());
|
||||
}
|
||||
|
||||
vec3 ewol::compositing::TextBase::calculateSizeHTML(const std::u32string& _text) {
|
||||
vec3 ewol::compositing::TextBase::calculateSizeHTML(const etk::UString& _text) {
|
||||
// remove intermediate result
|
||||
reset();
|
||||
//EWOL_DEBUG(" 0 size for=\n" << text);
|
||||
@ -865,11 +865,11 @@ vec3 ewol::compositing::TextBase::calculateSizeHTML(const std::u32string& _text)
|
||||
//EWOL_DEBUG(" 1 Stop pos=" << m_sizeDisplayStop);
|
||||
|
||||
// get the last elements
|
||||
m_sizeDisplayStop.setValue(std::max(m_position.x(), m_sizeDisplayStop.x()) ,
|
||||
std::max(m_position.y(), m_sizeDisplayStop.y()) ,
|
||||
m_sizeDisplayStop.setValue(etk::max(m_position.x(), m_sizeDisplayStop.x()) ,
|
||||
etk::max(m_position.y(), m_sizeDisplayStop.y()) ,
|
||||
0);
|
||||
m_sizeDisplayStart.setValue(std::min(m_position.x(), m_sizeDisplayStart.x()) ,
|
||||
std::min(m_position.y(), m_sizeDisplayStart.y()) ,
|
||||
m_sizeDisplayStart.setValue(etk::min(m_position.x(), m_sizeDisplayStart.x()) ,
|
||||
etk::min(m_position.y(), m_sizeDisplayStart.y()) ,
|
||||
0);
|
||||
|
||||
//EWOL_DEBUG(" 2 Start pos=" << m_sizeDisplayStart);
|
||||
@ -882,29 +882,29 @@ vec3 ewol::compositing::TextBase::calculateSizeHTML(const std::u32string& _text)
|
||||
m_sizeDisplayStop.z()-m_sizeDisplayStart.z());
|
||||
}
|
||||
|
||||
vec3 ewol::compositing::TextBase::calculateSizeDecorated(const std::string& _text) {
|
||||
vec3 ewol::compositing::TextBase::calculateSizeDecorated(const etk::String& _text) {
|
||||
if (_text.size() == 0) {
|
||||
return vec3(0,0,0);
|
||||
}
|
||||
std::string tmpData("<html><body>\n");
|
||||
etk::String tmpData("<html><body>\n");
|
||||
tmpData+=_text;
|
||||
tmpData+="\n</body></html>\n";
|
||||
vec3 tmpVal = calculateSizeHTML(tmpData);
|
||||
return tmpVal;
|
||||
}
|
||||
|
||||
vec3 ewol::compositing::TextBase::calculateSizeDecorated(const std::u32string& _text) {
|
||||
vec3 ewol::compositing::TextBase::calculateSizeDecorated(const etk::UString& _text) {
|
||||
if (_text.size() == 0) {
|
||||
return vec3(0,0,0);
|
||||
}
|
||||
std::u32string tmpData(U"<html><body>\n");
|
||||
etk::UString tmpData(U"<html><body>\n");
|
||||
tmpData += _text;
|
||||
tmpData += U"\n</body></html>\n";
|
||||
vec3 tmpVal = calculateSizeHTML(tmpData);
|
||||
return tmpVal;
|
||||
}
|
||||
|
||||
vec3 ewol::compositing::TextBase::calculateSize(const std::string& _text) {
|
||||
vec3 ewol::compositing::TextBase::calculateSize(const etk::String& _text) {
|
||||
vec3 outputSize(0, 0, 0);
|
||||
for(auto element : _text) {
|
||||
vec3 tmpp = calculateSize(element);
|
||||
@ -916,7 +916,7 @@ vec3 ewol::compositing::TextBase::calculateSize(const std::string& _text) {
|
||||
return outputSize;
|
||||
}
|
||||
|
||||
vec3 ewol::compositing::TextBase::calculateSize(const std::u32string& _text) {
|
||||
vec3 ewol::compositing::TextBase::calculateSize(const etk::UString& _text) {
|
||||
vec3 outputSize(0, 0, 0);
|
||||
for(auto element : _text) {
|
||||
vec3 tmpp = calculateSize(element);
|
||||
@ -939,7 +939,7 @@ void ewol::compositing::TextBase::printCursor(bool _isInsertMode, float _cursorS
|
||||
}
|
||||
}
|
||||
|
||||
bool ewol::compositing::TextBase::extrapolateLastId(const std::string& _text,
|
||||
bool ewol::compositing::TextBase::extrapolateLastId(const etk::String& _text,
|
||||
const int32_t _start,
|
||||
int32_t& _stop,
|
||||
int32_t& _space,
|
||||
@ -1002,7 +1002,7 @@ bool ewol::compositing::TextBase::extrapolateLastId(const std::string& _text,
|
||||
}
|
||||
}
|
||||
|
||||
bool ewol::compositing::TextBase::extrapolateLastId(const std::u32string& _text,
|
||||
bool ewol::compositing::TextBase::extrapolateLastId(const etk::UString& _text,
|
||||
const int32_t _start,
|
||||
int32_t& _stop,
|
||||
int32_t& _space,
|
||||
@ -1065,20 +1065,20 @@ bool ewol::compositing::TextBase::extrapolateLastId(const std::u32string& _text,
|
||||
}
|
||||
}
|
||||
|
||||
void ewol::compositing::TextBase::htmlAddData(const std::u32string& _data) {
|
||||
void ewol::compositing::TextBase::htmlAddData(const etk::UString& _data) {
|
||||
if( m_htmlCurrrentLine.size()>0
|
||||
&& m_htmlCurrrentLine[m_htmlCurrrentLine.size()-1] != ' ') {
|
||||
m_htmlCurrrentLine += U" ";
|
||||
if(m_htmlDecoration.size()>0) {
|
||||
TextDecoration tmp = m_htmlDecoration[m_htmlDecoration.size()-1];
|
||||
m_htmlDecoration.push_back(tmp);
|
||||
m_htmlDecoration.pushBack(tmp);
|
||||
} else {
|
||||
m_htmlDecoration.push_back(m_htmlDecoTmp);
|
||||
m_htmlDecoration.pushBack(m_htmlDecoTmp);
|
||||
}
|
||||
}
|
||||
m_htmlCurrrentLine += _data;
|
||||
for(size_t iii=0; iii<_data.size() ; iii++) {
|
||||
m_htmlDecoration.push_back(m_htmlDecoTmp);
|
||||
m_htmlDecoration.pushBack(m_htmlDecoTmp);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -12,7 +12,7 @@
|
||||
#include <ewol/compositing/Drawing.hpp>
|
||||
#include <ewol/resource/TexturedFont.hpp>
|
||||
#include <exml/exml.hpp>
|
||||
#include <string>
|
||||
#include <etk/String.hpp>
|
||||
|
||||
namespace ewol {
|
||||
namespace compositing {
|
||||
@ -94,12 +94,12 @@ namespace ewol {
|
||||
/**
|
||||
* @brief load the openGL program and get all the ID needed
|
||||
*/
|
||||
virtual void loadProgram(const std::string& _shaderName);
|
||||
virtual void loadProgram(const etk::String& _shaderName);
|
||||
public:
|
||||
/**
|
||||
* @brief generic constructor
|
||||
*/
|
||||
TextBase(const std::string& _shaderName = "{ewol}DATA:text.prog", bool _loadProgram = true);
|
||||
TextBase(const etk::String& _shaderName = "{ewol}DATA:text.prog", bool _loadProgram = true);
|
||||
/**
|
||||
* @brief generic destructor
|
||||
*/
|
||||
@ -221,13 +221,13 @@ namespace ewol {
|
||||
* @brief Specify the font name (this reset the internal element of the current text (system requirement)
|
||||
* @param[in] _fontName Current name of the selected font
|
||||
*/
|
||||
virtual void setFontName(const std::string& _fontName) = 0;
|
||||
virtual void setFontName(const etk::String& _fontName) = 0;
|
||||
/**
|
||||
* @brief Specify the font property (this reset the internal element of the current text (system requirement)
|
||||
* @param[in] fontName Current name of the selected font
|
||||
* @param[in] fontSize New font size
|
||||
*/
|
||||
virtual void setFont(std::string _fontName, int32_t _fontSize) = 0;
|
||||
virtual void setFont(etk::String _fontName, int32_t _fontSize) = 0;
|
||||
/**
|
||||
* @brief Specify the font mode for the next @ref print
|
||||
* @param[in] mode The font mode requested
|
||||
@ -262,9 +262,9 @@ namespace ewol {
|
||||
* @brief display a compleat string in the current element.
|
||||
* @param[in] _text The string to display.
|
||||
*/
|
||||
void print(const std::string& _text);
|
||||
void print(const etk::String& _text);
|
||||
//! @previous
|
||||
void print(const std::u32string& _text);
|
||||
void print(const etk::UString& _text);
|
||||
/**
|
||||
* @brief display a compleat string in the current element with the generic decoration specification. (basic html data)
|
||||
*
|
||||
@ -294,9 +294,9 @@ namespace ewol {
|
||||
* @param[in] _text The string to display.
|
||||
* @TODO : implementation not done ....
|
||||
*/
|
||||
void printDecorated(const std::string& _text);
|
||||
void printDecorated(const etk::String& _text);
|
||||
//! @previous
|
||||
void printDecorated(const std::u32string& _text);
|
||||
void printDecorated(const etk::UString& _text);
|
||||
/**
|
||||
* @brief display a compleat string in the current element with the generic decoration specification. (basic html data)
|
||||
*
|
||||
@ -330,17 +330,17 @@ namespace ewol {
|
||||
* @param[in] _text The string to display.
|
||||
* @TODO : implementation not done ....
|
||||
*/
|
||||
void printHTML(const std::string& _text);
|
||||
void printHTML(const etk::String& _text);
|
||||
//! @previous
|
||||
void printHTML(const std::u32string& _text);
|
||||
void printHTML(const etk::UString& _text);
|
||||
/**
|
||||
* @brief display a compleat string in the current element whith specific decorations (advence mode).
|
||||
* @param[in] _text The string to display.
|
||||
* @param[in] _decoration The text decoration for the text that might be display (if the vector is smaller, the last parameter is get)
|
||||
*/
|
||||
void print(const std::string& _text, const std::vector<TextDecoration>& _decoration);
|
||||
void print(const etk::String& _text, const etk::Vector<TextDecoration>& _decoration);
|
||||
//! @previous
|
||||
void print(const std::u32string& _text, const std::vector<TextDecoration>& _decoration);
|
||||
void print(const etk::UString& _text, const etk::Vector<TextDecoration>& _decoration);
|
||||
/**
|
||||
* @brief display the current char in the current element (note that the kerning is availlable if the position is not changed)
|
||||
* @param[in] _charcode Char that might be dispalyed
|
||||
@ -379,25 +379,25 @@ namespace ewol {
|
||||
* @param[in] _text The string to calculate dimention.
|
||||
* @return The theoric size used.
|
||||
*/
|
||||
vec3 calculateSizeHTML(const std::string& _text);
|
||||
vec3 calculateSizeHTML(const etk::String& _text);
|
||||
//! @previous
|
||||
vec3 calculateSizeHTML(const std::u32string& _text);
|
||||
vec3 calculateSizeHTML(const etk::UString& _text);
|
||||
/**
|
||||
* @brief calculate a theoric text size
|
||||
* @param[in] _text The string to calculate dimention.
|
||||
* @return The theoric size used.
|
||||
*/
|
||||
vec3 calculateSizeDecorated(const std::string& _text);
|
||||
vec3 calculateSizeDecorated(const etk::String& _text);
|
||||
//! @previous
|
||||
vec3 calculateSizeDecorated(const std::u32string& _text);
|
||||
vec3 calculateSizeDecorated(const etk::UString& _text);
|
||||
/**
|
||||
* @brief calculate a theoric text size
|
||||
* @param[in] _text The string to calculate dimention.
|
||||
* @return The theoric size used.
|
||||
*/
|
||||
vec3 calculateSize(const std::string& _text);
|
||||
vec3 calculateSize(const etk::String& _text);
|
||||
//! @previous
|
||||
vec3 calculateSize(const std::u32string& _text);
|
||||
vec3 calculateSize(const etk::UString& _text);
|
||||
/**
|
||||
* @brief calculate a theoric charcode size
|
||||
* @param[in] _charcode The µUnicode value to calculate dimention.
|
||||
@ -428,19 +428,19 @@ namespace ewol {
|
||||
* @return true if the rifht has free space that can be use for jystify.
|
||||
* @return false if we find '\n'
|
||||
*/
|
||||
bool extrapolateLastId(const std::string& _text, const int32_t _start, int32_t& _stop, int32_t& _space, int32_t& _freeSpace);
|
||||
bool extrapolateLastId(const etk::String& _text, const int32_t _start, int32_t& _stop, int32_t& _space, int32_t& _freeSpace);
|
||||
//! @previous
|
||||
bool extrapolateLastId(const std::u32string& _text, const int32_t _start, int32_t& _stop, int32_t& _space, int32_t& _freeSpace);
|
||||
bool extrapolateLastId(const etk::UString& _text, const int32_t _start, int32_t& _stop, int32_t& _space, int32_t& _freeSpace);
|
||||
protected:
|
||||
// this section is reserved for HTML parsing and display:
|
||||
std::u32string m_htmlCurrrentLine; //!< current line for HTML display
|
||||
std::vector<TextDecoration> m_htmlDecoration; //!< current decoration for the HTML display
|
||||
etk::UString m_htmlCurrrentLine; //!< current line for HTML display
|
||||
etk::Vector<TextDecoration> m_htmlDecoration; //!< current decoration for the HTML display
|
||||
TextDecoration m_htmlDecoTmp; //!< current decoration
|
||||
/**
|
||||
* @brief add a line with the current m_htmlDecoTmp decoration
|
||||
* @param[in] _data The cuurent data to add.
|
||||
*/
|
||||
void htmlAddData(const std::u32string& _data);
|
||||
void htmlAddData(const etk::UString& _data);
|
||||
/**
|
||||
* @brief draw the current line
|
||||
*/
|
||||
|
@ -9,7 +9,7 @@
|
||||
#include <ewol/context/Context.hpp>
|
||||
#include <etk/types.hpp>
|
||||
|
||||
ewol::compositing::TextDF::TextDF(const std::string& _fontName, int32_t _fontSize) :
|
||||
ewol::compositing::TextDF::TextDF(const etk::String& _fontName, int32_t _fontSize) :
|
||||
ewol::compositing::TextBase("", false),
|
||||
m_fontDF(nullptr),
|
||||
m_GLglyphLevel(-1),
|
||||
@ -23,7 +23,7 @@ ewol::compositing::TextDF::~TextDF() {
|
||||
}
|
||||
|
||||
void ewol::compositing::TextDF::updateSizeToRender(const vec2& _size) {
|
||||
float minSize = std::min(_size.x(), _size.y());
|
||||
float minSize = etk::min(_size.x(), _size.y());
|
||||
if (m_fontDF != nullptr) {
|
||||
setFontSize(m_fontDF->getSize(minSize));
|
||||
}
|
||||
@ -106,7 +106,7 @@ void ewol::compositing::TextDF::drawD(bool _disableDepthTest) {
|
||||
m_GLprogram->unUse();
|
||||
}
|
||||
|
||||
void ewol::compositing::TextDF::loadProgram(const std::string& _shaderName) {
|
||||
void ewol::compositing::TextDF::loadProgram(const etk::String& _shaderName) {
|
||||
ewol::compositing::TextBase::loadProgram(_shaderName);
|
||||
if (m_GLprogram != nullptr) {
|
||||
m_GLglyphLevel = m_GLprogram->getAttribute("EW_glyphLevel");
|
||||
@ -140,11 +140,11 @@ void ewol::compositing::TextDF::setFontSize(int32_t _fontSize) {
|
||||
}
|
||||
}
|
||||
|
||||
void ewol::compositing::TextDF::setFontName(const std::string& _fontName) {
|
||||
void ewol::compositing::TextDF::setFontName(const etk::String& _fontName) {
|
||||
clear();
|
||||
// remove old one
|
||||
ememory::SharedPtr<ewol::resource::DistanceFieldFont> previousFont = m_fontDF;
|
||||
std::string fontName;
|
||||
etk::String fontName;
|
||||
if (_fontName == "") {
|
||||
fontName = ewol::getContext().getFontDefault().getName();
|
||||
} else {
|
||||
@ -159,7 +159,7 @@ void ewol::compositing::TextDF::setFontName(const std::string& _fontName) {
|
||||
}
|
||||
}
|
||||
|
||||
void ewol::compositing::TextDF::setFont(std::string _fontName, int32_t _fontSize) {
|
||||
void ewol::compositing::TextDF::setFont(etk::String _fontName, int32_t _fontSize) {
|
||||
setFontSize(_fontSize);
|
||||
setFontName(_fontName);
|
||||
}
|
||||
|
@ -13,7 +13,7 @@
|
||||
#include <ewol/resource/DistanceFieldFont.hpp>
|
||||
#include <ewol/compositing/TextBase.hpp>
|
||||
#include <exml/exml.hpp>
|
||||
#include <string>
|
||||
#include <etk/String.hpp>
|
||||
|
||||
namespace ewol {
|
||||
namespace compositing {
|
||||
@ -28,7 +28,7 @@ namespace ewol {
|
||||
* @param[in] _fontName Name of the font that might be loaded
|
||||
* @param[in] _fontSize size of the font that might be loaded
|
||||
*/
|
||||
TextDF(const std::string& _fontName="", int32_t _fontSize=-1);
|
||||
TextDF(const etk::String& _fontName="", int32_t _fontSize=-1);
|
||||
/**
|
||||
* @brief generic destructor
|
||||
*/
|
||||
@ -56,10 +56,10 @@ namespace ewol {
|
||||
virtual ewol::GlyphProperty * getGlyphPointer(char32_t _charcode);
|
||||
|
||||
public:
|
||||
virtual void loadProgram(const std::string& _shaderName);
|
||||
virtual void loadProgram(const etk::String& _shaderName);
|
||||
virtual void setFontSize(int32_t _fontSize);
|
||||
virtual void setFontName(const std::string& _fontName);
|
||||
virtual void setFont(std::string _fontName, int32_t _fontSize);
|
||||
virtual void setFontName(const etk::String& _fontName);
|
||||
virtual void setFont(etk::String _fontName, int32_t _fontSize);
|
||||
virtual void setFontMode(enum ewol::font::mode _mode);
|
||||
virtual void printChar(const char32_t& _charcode);
|
||||
virtual vec3 calculateSizeChar(const char32_t& _charcode);
|
||||
|
@ -23,7 +23,7 @@ ewol::context::ConfigFont::~ConfigFont() {
|
||||
ewol::resource::freeTypeUnInit();
|
||||
}
|
||||
|
||||
void ewol::context::ConfigFont::set(const std::string& _fontName, int32_t _size) {
|
||||
void ewol::context::ConfigFont::set(const etk::String& _fontName, int32_t _size) {
|
||||
m_name = _fontName;
|
||||
m_size = _size;
|
||||
EWOL_INFO("Set default Font : '" << m_name << "' size=" << m_size);
|
||||
@ -34,7 +34,7 @@ void ewol::context::ConfigFont::setSize(int32_t _size) {
|
||||
EWOL_INFO("Set default Font : '" << m_name << "' size=" << m_size << " (change size only)");
|
||||
}
|
||||
|
||||
void ewol::context::ConfigFont::setName(const std::string& _fontName) {
|
||||
void ewol::context::ConfigFont::setName(const etk::String& _fontName) {
|
||||
m_name = _fontName;
|
||||
EWOL_INFO("Set default Font : '" << m_name << "' size=" << m_size << " (change name only)");
|
||||
}
|
||||
|
@ -17,24 +17,24 @@ namespace ewol {
|
||||
ConfigFont();
|
||||
virtual ~ConfigFont();
|
||||
private:
|
||||
std::string m_folder;
|
||||
etk::String m_folder;
|
||||
public:
|
||||
/**
|
||||
* @brief Specify the default font folder for the Ewol search system (only needed when embended font)
|
||||
* @param[in] _folder basic folder of the font (ex: DATA:fonts)
|
||||
*/
|
||||
void setFolder(const std::string& _folder) {
|
||||
void setFolder(const etk::String& _folder) {
|
||||
m_folder = _folder;
|
||||
};
|
||||
/**
|
||||
* @brief get the default font folder.
|
||||
* @return The default font folder.
|
||||
*/
|
||||
const std::string& getFolder() {
|
||||
const etk::String& getFolder() {
|
||||
return m_folder;
|
||||
};
|
||||
private:
|
||||
std::string m_name;
|
||||
etk::String m_name;
|
||||
int32_t m_size;
|
||||
public:
|
||||
/**
|
||||
@ -42,19 +42,19 @@ namespace ewol {
|
||||
* @param[in] _fontName The font name requested (not case sensitive) ex "Arial" or multiple separate by ';' ex : "Arial;Helvetica".
|
||||
* @param[in] _size The default size of the font default=10.
|
||||
*/
|
||||
void set(const std::string& _fontName, int32_t _size);
|
||||
void set(const etk::String& _fontName, int32_t _size);
|
||||
/**
|
||||
* @brief get the current default font name
|
||||
* @raturn a reference on the font name string
|
||||
*/
|
||||
const std::string& getName() {
|
||||
const etk::String& getName() {
|
||||
return m_name;
|
||||
};
|
||||
/**
|
||||
* @brief Set the current default font name
|
||||
* @param[in] _fontName The font name requested (not case sensitive) ex "Arial" or multiple separate by ';' ex : "Arial;Helvetica".
|
||||
*/
|
||||
void setName(const std::string& _fontName);
|
||||
void setName(const etk::String& _fontName);
|
||||
/**
|
||||
* @brief get the default font size.
|
||||
* @return the font size.
|
||||
|
@ -41,7 +41,7 @@ ewol::Context& ewol::getContext() {
|
||||
}
|
||||
|
||||
|
||||
void ewol::Context::setInitImage(const std::string& _fileName) {
|
||||
void ewol::Context::setInitImage(const etk::String& _fileName) {
|
||||
//m_initDisplayImageName = _fileName;
|
||||
}
|
||||
|
||||
|
@ -142,7 +142,7 @@ namespace ewol {
|
||||
* @brief Special for init (main) set the start image when loading data
|
||||
* @param[in] _fileName Name of the image to load
|
||||
*/
|
||||
void setInitImage(const std::string& _fileName);
|
||||
void setInitImage(const etk::String& _fileName);
|
||||
public:
|
||||
/**
|
||||
* @brief Request a display after call a resize
|
||||
|
@ -174,7 +174,7 @@ int32_t ewol::context::InputManager::localGetDestinationId(enum gale::key::type
|
||||
ewol::WidgetShared tmpWidget = m_eventInputSaved[iii].curentWidgetEvent.lock();
|
||||
if (tmpWidget == _destWidget) {
|
||||
if (iii != _realInputId) {
|
||||
lastMinimum = std::max(lastMinimum, m_eventInputSaved[iii].destinationInputId);
|
||||
lastMinimum = etk::max(lastMinimum, m_eventInputSaved[iii].destinationInputId);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -6,7 +6,7 @@
|
||||
|
||||
#include <ewol/widget/Widget.hpp>
|
||||
|
||||
std::ostream& ewol::event::operator <<(std::ostream& _os, const ewol::event::Entry& _obj) {
|
||||
etk::Stream& ewol::event::operator <<(etk::Stream& _os, const ewol::event::Entry& _obj) {
|
||||
_os << "{type=" << _obj.getType();
|
||||
_os << " status=" << _obj.getStatus();
|
||||
if (_obj.getType() == gale::key::keyboard::character) {
|
||||
@ -16,7 +16,7 @@ std::ostream& ewol::event::operator <<(std::ostream& _os, const ewol::event::Ent
|
||||
return _os;
|
||||
}
|
||||
|
||||
std::ostream& ewol::event::operator <<(std::ostream& _os, const ewol::event::EntrySystem& _obj) {
|
||||
etk::Stream& ewol::event::operator <<(etk::Stream& _os, const ewol::event::EntrySystem& _obj) {
|
||||
_os << _obj.m_event;
|
||||
return _os;
|
||||
}
|
||||
|
@ -52,7 +52,7 @@ namespace ewol {
|
||||
return m_unicodeData;
|
||||
};
|
||||
};
|
||||
std::ostream& operator <<(std::ostream& _os, const ewol::event::Entry& _obj);
|
||||
etk::Stream& operator <<(etk::Stream& _os, const ewol::event::Entry& _obj);
|
||||
|
||||
class EntrySystem {
|
||||
public:
|
||||
@ -65,6 +65,6 @@ namespace ewol {
|
||||
};
|
||||
ewol::event::Entry m_event;
|
||||
};
|
||||
std::ostream& operator <<(std::ostream& _os, const ewol::event::EntrySystem& _obj);
|
||||
etk::Stream& operator <<(etk::Stream& _os, const ewol::event::EntrySystem& _obj);
|
||||
};
|
||||
};
|
||||
|
@ -6,16 +6,16 @@
|
||||
|
||||
#include <ewol/widget/Widget.hpp>
|
||||
|
||||
std::ostream& ewol::event::operator <<(std::ostream& _os, const ewol::event::Input& _obj) {
|
||||
etk::Stream& ewol::event::operator <<(etk::Stream& _os, const ewol::event::Input& _obj) {
|
||||
_os << "{type=" << _obj.getType();
|
||||
_os << " status=" << _obj.getStatus();
|
||||
_os << " id=" << etk::to_string(_obj.getId());
|
||||
_os << " id=" << etk::toString(_obj.getId());
|
||||
_os << " pos=" << _obj.getPos();
|
||||
_os << "}";
|
||||
return _os;
|
||||
}
|
||||
|
||||
std::ostream& ewol::event::operator <<(std::ostream& _os, const ewol::event::InputSystem& _obj) {
|
||||
etk::Stream& ewol::event::operator <<(etk::Stream& _os, const ewol::event::InputSystem& _obj) {
|
||||
_os << _obj.m_event;
|
||||
return _os;
|
||||
}
|
||||
|
@ -66,7 +66,7 @@ namespace ewol {
|
||||
// TODO : Call the entry element ant rest it ...
|
||||
}
|
||||
};
|
||||
std::ostream& operator <<(std::ostream& _os, const ewol::event::Input& _obj);
|
||||
etk::Stream& operator <<(etk::Stream& _os, const ewol::event::Input& _obj);
|
||||
|
||||
class InputSystem {
|
||||
public:
|
||||
@ -98,7 +98,7 @@ namespace ewol {
|
||||
return m_realIdEvent;
|
||||
};
|
||||
};
|
||||
std::ostream& operator <<(std::ostream& _os, const ewol::event::InputSystem& _obj);
|
||||
etk::Stream& operator <<(etk::Stream& _os, const ewol::event::InputSystem& _obj);
|
||||
};
|
||||
};
|
||||
|
||||
|
@ -6,7 +6,7 @@
|
||||
|
||||
#include <ewol/widget/Widget.hpp>
|
||||
|
||||
std::ostream& ewol::event::operator <<(std::ostream& _os, const ewol::event::Time& _obj) {
|
||||
etk::Stream& ewol::event::operator <<(etk::Stream& _os, const ewol::event::Time& _obj) {
|
||||
_os << "{time=" << _obj.getTime();
|
||||
_os << " uptime=" << _obj.getApplUpTime();
|
||||
_os << " delta=" << _obj.getDelta();
|
||||
@ -16,12 +16,12 @@ std::ostream& ewol::event::operator <<(std::ostream& _os, const ewol::event::Tim
|
||||
}
|
||||
|
||||
namespace etk {
|
||||
template<> std::string to_string<ewol::event::Time>(ewol::event::Time const& _obj) {
|
||||
std::string out;
|
||||
out = "{[ewol::event::Time]time=" + etk::to_string(_obj.getTime());
|
||||
out += ";uptime=" + etk::to_string(_obj.getApplUpTime());
|
||||
out += ";delta=" + etk::to_string(_obj.getDelta());
|
||||
out += ";deltaCall=" + etk::to_string(_obj.getDeltaCall());
|
||||
template<> etk::String toString<ewol::event::Time>(ewol::event::Time const& _obj) {
|
||||
etk::String out;
|
||||
out = "{[ewol::event::Time]time=" + etk::toString(_obj.getTime());
|
||||
out += ";uptime=" + etk::toString(_obj.getApplUpTime());
|
||||
out += ";delta=" + etk::toString(_obj.getDelta());
|
||||
out += ";deltaCall=" + etk::toString(_obj.getDeltaCall());
|
||||
out += "}";
|
||||
return out;
|
||||
}
|
||||
|
@ -63,7 +63,7 @@ namespace ewol {
|
||||
return m_timeDeltaCall.toSeconds();
|
||||
};
|
||||
};
|
||||
std::ostream& operator <<(std::ostream& _os, const ewol::event::Time& _obj);
|
||||
etk::Stream& operator <<(etk::Stream& _os, const ewol::event::Time& _obj);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -18,7 +18,7 @@
|
||||
#define EWOL_VERSION "0.0.0"
|
||||
#endif
|
||||
|
||||
std::string ewol::getVersion() {
|
||||
etk::String ewol::getVersion() {
|
||||
return EWOL_VERSION;
|
||||
}
|
||||
|
||||
|
@ -26,5 +26,5 @@ namespace ewol {
|
||||
* @brief get EWOL version
|
||||
* @return The string that describe ewol version
|
||||
*/
|
||||
std::string getVersion();
|
||||
etk::String getVersion();
|
||||
};
|
||||
|
@ -7,7 +7,7 @@
|
||||
#include <ewol/debug.hpp>
|
||||
#include <ewol/gravity.hpp>
|
||||
|
||||
std::string ewol::gravityToString(const enum ewol::gravity _obj) {
|
||||
etk::String ewol::gravityToString(const enum ewol::gravity _obj) {
|
||||
switch(_obj) {
|
||||
case ewol::gravity_center:
|
||||
return "center";
|
||||
@ -31,7 +31,7 @@ std::string ewol::gravityToString(const enum ewol::gravity _obj) {
|
||||
return "unknow";
|
||||
}
|
||||
|
||||
enum ewol::gravity ewol::stringToGravity(const std::string& _obj) {
|
||||
enum ewol::gravity ewol::stringToGravity(const etk::String& _obj) {
|
||||
if (_obj == "center") {
|
||||
return ewol::gravity_center;
|
||||
} else if (_obj == "top-left") {
|
||||
@ -76,7 +76,7 @@ vec2 ewol::gravityGenerateDelta(const enum ewol::gravity _gravity, const vec2& _
|
||||
return out;
|
||||
}
|
||||
|
||||
std::ostream& ewol::operator <<(std::ostream& _os, const enum ewol::gravity _obj) {
|
||||
etk::Stream& ewol::operator <<(etk::Stream& _os, const enum ewol::gravity _obj) {
|
||||
_os << ewol::gravityToString(_obj);
|
||||
return _os;
|
||||
}
|
||||
|
@ -24,8 +24,8 @@ namespace ewol {
|
||||
gravity_buttomRight = gravity_buttom|gravity_right, //!< gravity is in buttom-right
|
||||
gravity_buttomLeft = gravity_buttom|gravity_left, //!< gravity is in buttom-left
|
||||
};
|
||||
std::ostream& operator <<(std::ostream& _os, const enum ewol::gravity _obj);
|
||||
std::string gravityToString(const enum ewol::gravity _obj);
|
||||
enum ewol::gravity stringToGravity(const std::string& _obj);
|
||||
etk::Stream& operator <<(etk::Stream& _os, const enum ewol::gravity _obj);
|
||||
etk::String gravityToString(const enum ewol::gravity _obj);
|
||||
enum ewol::gravity stringToGravity(const etk::String& _obj);
|
||||
vec2 gravityGenerateDelta(const enum ewol::gravity _gravity, const vec2& _deltas);
|
||||
}
|
||||
|
@ -71,7 +71,7 @@ void ewol::object::Manager::add(const ewol::ObjectShared& _object) {
|
||||
if (_object == nullptr) {
|
||||
EWOL_ERROR("try to add an inexistant Object in manager");
|
||||
}
|
||||
m_eObjectList.push_back(_object);
|
||||
m_eObjectList.pushBack(_object);
|
||||
}
|
||||
|
||||
int32_t ewol::object::Manager::getNumberObject() {
|
||||
@ -97,7 +97,7 @@ void ewol::object::Manager::cleanInternalRemoved() {
|
||||
}
|
||||
}
|
||||
|
||||
ewol::ObjectShared ewol::object::Manager::get(const std::string& _name) {
|
||||
ewol::ObjectShared ewol::object::Manager::get(const etk::String& _name) {
|
||||
std::unique_lock<std::recursive_mutex> lock(m_mutex);
|
||||
if (_name == "") {
|
||||
return nullptr;
|
||||
@ -113,7 +113,7 @@ ewol::ObjectShared ewol::object::Manager::get(const std::string& _name) {
|
||||
}
|
||||
|
||||
|
||||
ewol::ObjectShared ewol::object::Manager::getObjectNamed(const std::string& _name) {
|
||||
ewol::ObjectShared ewol::object::Manager::getObjectNamed(const etk::String& _name) {
|
||||
std::unique_lock<std::recursive_mutex> lock(m_mutex);
|
||||
return ewol::object::Manager::get(_name);
|
||||
}
|
||||
@ -121,7 +121,7 @@ ewol::ObjectShared ewol::object::Manager::getObjectNamed(const std::string& _nam
|
||||
|
||||
void ewol::object::Manager::workerAdd(const ewol::ObjectShared& _worker) {
|
||||
std::unique_lock<std::recursive_mutex> lock(m_mutex);
|
||||
m_workerList.push_back(_worker);
|
||||
m_workerList.pushBack(_worker);
|
||||
}
|
||||
|
||||
void ewol::object::Manager::workerRemove(const ewol::ObjectShared& _worker) {
|
||||
|
@ -19,7 +19,7 @@ namespace ewol {
|
||||
protected:
|
||||
std::recursive_mutex m_mutex;
|
||||
private:
|
||||
std::vector<ewol::ObjectWeak> m_eObjectList; // all widget allocated == > all time increment ... never removed ...
|
||||
etk::Vector<ewol::ObjectWeak> m_eObjectList; // all widget allocated == > all time increment ... never removed ...
|
||||
Context& m_context;
|
||||
public:
|
||||
Manager(Context& _context);
|
||||
@ -56,16 +56,16 @@ namespace ewol {
|
||||
* @param[in] _name Name of the Object
|
||||
* @return Pointer on the finded Object.
|
||||
*/
|
||||
ewol::ObjectShared get(const std::string& _name);
|
||||
ewol::ObjectShared get(const etk::String& _name);
|
||||
public:
|
||||
/**
|
||||
* @brief retrive an object with his name
|
||||
* @param[in] _name Name of the object
|
||||
* @return the requested object or nullptr
|
||||
*/
|
||||
ewol::ObjectShared getObjectNamed(const std::string& _name);
|
||||
ewol::ObjectShared getObjectNamed(const etk::String& _name);
|
||||
private:
|
||||
std::vector<ewol::ObjectShared> m_workerList;
|
||||
etk::Vector<ewol::ObjectShared> m_workerList;
|
||||
public:
|
||||
/**
|
||||
* @brief Add a worker on the system list.
|
||||
|
@ -88,10 +88,10 @@ void ewol::Object::addObjectType(const char* _type) {
|
||||
EWOL_ERROR(" try to add a type with no value...");
|
||||
return;
|
||||
}
|
||||
m_listType.push_back(_type);
|
||||
m_listType.pushBack(_type);
|
||||
}
|
||||
std::string ewol::Object::getTypeDescription() const {
|
||||
std::string ret("ewol::Object");
|
||||
etk::String ewol::Object::getTypeDescription() const {
|
||||
etk::String ret("ewol::Object");
|
||||
for(auto element : m_listType) {
|
||||
ret += "|";
|
||||
ret += element;
|
||||
@ -99,7 +99,7 @@ std::string ewol::Object::getTypeDescription() const {
|
||||
return ret;
|
||||
}
|
||||
|
||||
bool ewol::Object::isTypeCompatible(const std::string& _type) const {
|
||||
bool ewol::Object::isTypeCompatible(const etk::String& _type) const {
|
||||
if (_type == "ewol::Object") {
|
||||
return true;
|
||||
}
|
||||
@ -144,7 +144,7 @@ bool ewol::Object::storeXML(exml::Element& _node) const {
|
||||
return errorOccured;
|
||||
}
|
||||
|
||||
bool ewol::Object::propertySetOnWidgetNamed(const std::string& _objectName, const std::string& _config, const std::string& _value) {
|
||||
bool ewol::Object::propertySetOnWidgetNamed(const etk::String& _objectName, const etk::String& _config, const etk::String& _value) {
|
||||
ewol::ObjectShared object = getObjectManager().get(_objectName);
|
||||
if (object == nullptr) {
|
||||
return false;
|
||||
@ -161,11 +161,11 @@ ewol::Context& ewol::Object::getContext() {
|
||||
return ewol::getContext();
|
||||
}
|
||||
|
||||
ewol::ObjectShared ewol::Object::getObjectNamed(const std::string& _objectName) {
|
||||
ewol::ObjectShared ewol::Object::getObjectNamed(const etk::String& _objectName) {
|
||||
return getObjectManager().getObjectNamed(_objectName);
|
||||
}
|
||||
|
||||
ewol::ObjectShared ewol::Object::getSubObjectNamed(const std::string& _objectName) {
|
||||
ewol::ObjectShared ewol::Object::getSubObjectNamed(const etk::String& _objectName) {
|
||||
EWOL_VERBOSE("check if name : " << _objectName << " ?= " << propertyName.get());
|
||||
if (_objectName == propertyName.get()) {
|
||||
return sharedFromThis();
|
||||
@ -174,7 +174,7 @@ ewol::ObjectShared ewol::Object::getSubObjectNamed(const std::string& _objectNam
|
||||
}
|
||||
|
||||
|
||||
bool ewol::propertySetOnObjectNamed(const std::string& _objectName, const std::string& _config, const std::string& _value) {
|
||||
bool ewol::propertySetOnObjectNamed(const etk::String& _objectName, const etk::String& _config, const etk::String& _value) {
|
||||
ewol::ObjectShared object = ewol::getContext().getEObjectManager().get(_objectName);
|
||||
if (object == nullptr) {
|
||||
return false;
|
||||
|
@ -6,7 +6,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <etk/types.hpp>
|
||||
#include <vector>
|
||||
#include <etk/Vector.hpp>
|
||||
#include <exml/exml.hpp>
|
||||
#include <mutex>
|
||||
#include <ememory/memory.hpp>
|
||||
@ -35,7 +35,7 @@ template<class TYPE_OBJECT> static void baseInit(const ememory::SharedPtr<TYPE_O
|
||||
return;
|
||||
}
|
||||
|
||||
template<class TYPE_OBJECT, class TYPE_VAL, class ... TYPE> static void baseInit(const ememory::SharedPtr<TYPE_OBJECT>& _object, const std::string& _name, const TYPE_VAL& _val, TYPE&& ... _all ) {
|
||||
template<class TYPE_OBJECT, class TYPE_VAL, class ... TYPE> static void baseInit(const ememory::SharedPtr<TYPE_OBJECT>& _object, const etk::String& _name, const TYPE_VAL& _val, TYPE&& ... _all ) {
|
||||
eproperty::Property* prop(nullptr);
|
||||
eproperty::PropertyType<TYPE_VAL>* propType(nullptr);
|
||||
if (_object == nullptr) {
|
||||
@ -108,7 +108,7 @@ exit_on_error:
|
||||
EWOL_ERROR("Factory error"); \
|
||||
return nullptr; \
|
||||
} \
|
||||
baseInit(object, "name", std::string(uniqueName), _all... ); \
|
||||
baseInit(object, "name", etk::String(uniqueName), _all... ); \
|
||||
object->init(); \
|
||||
if (object->objectHasBeenCorectlyInit() == false) { \
|
||||
EWOL_CRITICAL("Object Is not correctly init : " << #className ); \
|
||||
@ -129,7 +129,7 @@ namespace ewol {
|
||||
public: // Event list
|
||||
|
||||
public: // propertie list
|
||||
eproperty::Value<std::string> propertyName; //!< name of the element ...
|
||||
eproperty::Value<etk::String> propertyName; //!< name of the element ...
|
||||
private:
|
||||
static size_t m_valUID; //!< Static used for the unique ID definition
|
||||
private:
|
||||
@ -187,7 +187,7 @@ namespace ewol {
|
||||
*/
|
||||
virtual void removeParent();
|
||||
private:
|
||||
std::vector<const char*> m_listType;
|
||||
etk::Vector<const char*> m_listType;
|
||||
public:
|
||||
/**
|
||||
* @brief get the current Object type of the Object
|
||||
@ -198,13 +198,13 @@ namespace ewol {
|
||||
* @brief Get the herarchie of the Object type.
|
||||
* @return descriptive string.
|
||||
*/
|
||||
std::string getTypeDescription() const;
|
||||
etk::String getTypeDescription() const;
|
||||
/**
|
||||
* @brief check if the element herited from a specific type
|
||||
* @param[in] _type Type to check.
|
||||
* @return true if the element is compatible.
|
||||
*/
|
||||
bool isTypeCompatible(const std::string& _type) const;
|
||||
bool isTypeCompatible(const etk::String& _type) const;
|
||||
protected:
|
||||
/**
|
||||
* @brief Add a type of the list of Object.
|
||||
@ -233,7 +233,7 @@ namespace ewol {
|
||||
};
|
||||
public:
|
||||
// TODO : Rework the position on this function ... This is a convignent function ...
|
||||
bool propertySetOnWidgetNamed(const std::string& _objectName, const std::string& _config, const std::string& _value);
|
||||
bool propertySetOnWidgetNamed(const etk::String& _objectName, const etk::String& _config, const etk::String& _value);
|
||||
public:
|
||||
/**
|
||||
* @brief load attribute properties with an XML node.
|
||||
@ -290,13 +290,13 @@ namespace ewol {
|
||||
* @param[in] _name Name of the object
|
||||
* @return the requested object or nullptr
|
||||
*/
|
||||
static ewol::ObjectShared getObjectNamed(const std::string& _objectName);
|
||||
static ewol::ObjectShared getObjectNamed(const etk::String& _objectName);
|
||||
/**
|
||||
* @brief Retrive an object with his name (in the global list)
|
||||
* @param[in] _name Name of the object
|
||||
* @return the requested object or nullptr
|
||||
*/
|
||||
virtual ewol::ObjectShared getSubObjectNamed(const std::string& _objectName);
|
||||
virtual ewol::ObjectShared getSubObjectNamed(const etk::String& _objectName);
|
||||
protected:
|
||||
// TODO : Create a template ...
|
||||
/**
|
||||
@ -317,11 +317,11 @@ namespace ewol {
|
||||
EWOL_ERROR("Can not connect signal ...");
|
||||
return;
|
||||
}
|
||||
m_callerList.push_back(std::make_pair(ewol::ObjectWeak(_obj), std::connect(_func, obj2.get())));
|
||||
m_callerList.pushBack(etk::makePair(ewol::ObjectWeak(_obj), std::connect(_func, obj2.get())));
|
||||
}
|
||||
*/
|
||||
};
|
||||
bool propertySetOnObjectNamed(const std::string& _objectName, const std::string& _config, const std::string& _value);
|
||||
bool propertySetOnObjectNamed(const etk::String& _objectName, const etk::String& _config, const etk::String& _value);
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -16,7 +16,7 @@ ewol::resource::ColorFile::ColorFile() :
|
||||
addResourceType("ewol::ColorFile");
|
||||
}
|
||||
|
||||
void ewol::resource::ColorFile::init(const std::string& _filename) {
|
||||
void ewol::resource::ColorFile::init(const etk::String& _filename) {
|
||||
std::unique_lock<std::recursive_mutex> lock(m_mutex);
|
||||
gale::Resource::init(_filename);
|
||||
EWOL_DEBUG("CF : load \"" << _filename << "\"");
|
||||
@ -56,8 +56,8 @@ void ewol::resource::ColorFile::reload() {
|
||||
findError = true;
|
||||
continue;
|
||||
}
|
||||
std::string name = tmpObj["name"].toString().get();
|
||||
std::string color = tmpObj["color"].toString().get(m_errorColor.getHexString());
|
||||
etk::String name = tmpObj["name"].toString().get();
|
||||
etk::String color = tmpObj["color"].toString().get(m_errorColor.getHexString());
|
||||
EWOL_DEBUG("find new color : '" << name << "' color='" << color << "'");
|
||||
if (name.size() == 0) {
|
||||
EWOL_ERROR("Drop an empty name");
|
||||
@ -73,7 +73,7 @@ void ewol::resource::ColorFile::reload() {
|
||||
}
|
||||
|
||||
|
||||
int32_t ewol::resource::ColorFile::request(const std::string& _paramName) {
|
||||
int32_t ewol::resource::ColorFile::request(const etk::String& _paramName) {
|
||||
std::unique_lock<std::recursive_mutex> lock(m_mutex);
|
||||
// check if the parameters existed :
|
||||
if (m_list.exist(_paramName) == false) {
|
||||
|
@ -26,7 +26,7 @@ namespace ewol {
|
||||
* @param[in] _filename Name of the file needed
|
||||
*/
|
||||
ColorFile();
|
||||
void init(const std::string& _filename);
|
||||
void init(const etk::String& _filename);
|
||||
public:
|
||||
DECLARE_RESOURCE_NAMED_FACTORY(ColorFile);
|
||||
/**
|
||||
@ -46,7 +46,7 @@ namespace ewol {
|
||||
* @param[in] _paramName Name of the color.
|
||||
* @return A unique ID of the color (or -1 if an error occured).
|
||||
*/
|
||||
int32_t request(const std::string& _paramName);
|
||||
int32_t request(const etk::String& _paramName);
|
||||
/**
|
||||
* @brief Get the associated color of the ID.
|
||||
* @param[in] _Id Id of the color.
|
||||
@ -62,7 +62,7 @@ namespace ewol {
|
||||
* @brief Get All color name
|
||||
* @return list of all color existing
|
||||
*/
|
||||
std::vector<std::string> getColors() const {
|
||||
etk::Vector<etk::String> getColors() const {
|
||||
return m_list.getKeys();
|
||||
}
|
||||
public: // herited function:
|
||||
|
@ -34,7 +34,7 @@ ewol::resource::Colored3DObject::~Colored3DObject() {
|
||||
}
|
||||
|
||||
|
||||
void ewol::resource::Colored3DObject::draw(const std::vector<vec3>& _vertices,
|
||||
void ewol::resource::Colored3DObject::draw(const etk::Vector<vec3>& _vertices,
|
||||
const etk::Color<float>& _color,
|
||||
bool _updateDepthBuffer,
|
||||
bool _depthtest) {
|
||||
@ -76,7 +76,7 @@ void ewol::resource::Colored3DObject::draw(const std::vector<vec3>& _vertices,
|
||||
}
|
||||
}
|
||||
|
||||
void ewol::resource::Colored3DObject::draw(const std::vector<vec3>& _vertices,
|
||||
void ewol::resource::Colored3DObject::draw(const etk::Vector<vec3>& _vertices,
|
||||
const etk::Color<float>& _color,
|
||||
mat4& _transformationMatrix,
|
||||
bool _updateDepthBuffer,
|
||||
@ -116,7 +116,7 @@ void ewol::resource::Colored3DObject::draw(const std::vector<vec3>& _vertices,
|
||||
}
|
||||
}
|
||||
|
||||
void ewol::resource::Colored3DObject::drawLine(std::vector<vec3>& _vertices,
|
||||
void ewol::resource::Colored3DObject::drawLine(etk::Vector<vec3>& _vertices,
|
||||
const etk::Color<float>& _color,
|
||||
mat4& _transformationMatrix,
|
||||
bool _updateDepthBuffer,
|
||||
@ -163,44 +163,44 @@ void ewol::resource::Colored3DObject::drawCubeLine(const vec3& _min,
|
||||
mat4& _transformationMatrix,
|
||||
bool _updateDepthBuffer,
|
||||
bool _depthtest) {
|
||||
std::vector<vec3> vertices;
|
||||
vertices.push_back(vec3(_min.x(), _min.y(),_min.z()));
|
||||
vertices.push_back(vec3(_max.x(), _min.y(),_min.z()));
|
||||
etk::Vector<vec3> vertices;
|
||||
vertices.pushBack(vec3(_min.x(), _min.y(),_min.z()));
|
||||
vertices.pushBack(vec3(_max.x(), _min.y(),_min.z()));
|
||||
|
||||
vertices.push_back(vec3(_max.x(), _min.y(),_min.z()));
|
||||
vertices.push_back(vec3(_max.x(), _min.y(),_max.z()));
|
||||
vertices.pushBack(vec3(_max.x(), _min.y(),_min.z()));
|
||||
vertices.pushBack(vec3(_max.x(), _min.y(),_max.z()));
|
||||
|
||||
vertices.push_back(vec3(_max.x(), _min.y(),_max.z()));
|
||||
vertices.push_back(vec3(_min.x(), _min.y(),_max.z()));
|
||||
vertices.pushBack(vec3(_max.x(), _min.y(),_max.z()));
|
||||
vertices.pushBack(vec3(_min.x(), _min.y(),_max.z()));
|
||||
|
||||
vertices.push_back(vec3(_min.x(), _min.y(),_max.z()));
|
||||
vertices.push_back(vec3(_min.x(), _min.y(),_min.z()));
|
||||
vertices.pushBack(vec3(_min.x(), _min.y(),_max.z()));
|
||||
vertices.pushBack(vec3(_min.x(), _min.y(),_min.z()));
|
||||
|
||||
|
||||
vertices.push_back(vec3(_min.x(), _max.y(),_min.z()));
|
||||
vertices.push_back(vec3(_max.x(), _max.y(),_min.z()));
|
||||
vertices.pushBack(vec3(_min.x(), _max.y(),_min.z()));
|
||||
vertices.pushBack(vec3(_max.x(), _max.y(),_min.z()));
|
||||
|
||||
vertices.push_back(vec3(_max.x(), _max.y(),_min.z()));
|
||||
vertices.push_back(vec3(_max.x(), _max.y(),_max.z()));
|
||||
vertices.pushBack(vec3(_max.x(), _max.y(),_min.z()));
|
||||
vertices.pushBack(vec3(_max.x(), _max.y(),_max.z()));
|
||||
|
||||
vertices.push_back(vec3(_max.x(), _max.y(),_max.z()));
|
||||
vertices.push_back(vec3(_min.x(), _max.y(),_max.z()));
|
||||
vertices.pushBack(vec3(_max.x(), _max.y(),_max.z()));
|
||||
vertices.pushBack(vec3(_min.x(), _max.y(),_max.z()));
|
||||
|
||||
vertices.push_back(vec3(_min.x(), _max.y(),_max.z()));
|
||||
vertices.push_back(vec3(_min.x(), _max.y(),_min.z()));
|
||||
vertices.pushBack(vec3(_min.x(), _max.y(),_max.z()));
|
||||
vertices.pushBack(vec3(_min.x(), _max.y(),_min.z()));
|
||||
|
||||
|
||||
vertices.push_back(vec3(_min.x(), _min.y(),_min.z()));
|
||||
vertices.push_back(vec3(_min.x(), _max.y(),_min.z()));
|
||||
vertices.pushBack(vec3(_min.x(), _min.y(),_min.z()));
|
||||
vertices.pushBack(vec3(_min.x(), _max.y(),_min.z()));
|
||||
|
||||
vertices.push_back(vec3(_max.x(), _min.y(),_min.z()));
|
||||
vertices.push_back(vec3(_max.x(), _max.y(),_min.z()));
|
||||
vertices.pushBack(vec3(_max.x(), _min.y(),_min.z()));
|
||||
vertices.pushBack(vec3(_max.x(), _max.y(),_min.z()));
|
||||
|
||||
vertices.push_back(vec3(_max.x(), _min.y(),_max.z()));
|
||||
vertices.push_back(vec3(_max.x(), _max.y(),_max.z()));
|
||||
vertices.pushBack(vec3(_max.x(), _min.y(),_max.z()));
|
||||
vertices.pushBack(vec3(_max.x(), _max.y(),_max.z()));
|
||||
|
||||
vertices.push_back(vec3(_min.x(), _min.y(),_max.z()));
|
||||
vertices.push_back(vec3(_min.x(), _max.y(),_max.z()));
|
||||
vertices.pushBack(vec3(_min.x(), _min.y(),_max.z()));
|
||||
vertices.pushBack(vec3(_min.x(), _max.y(),_max.z()));
|
||||
|
||||
drawLine(vertices, _color, _transformationMatrix, _updateDepthBuffer, _depthtest);
|
||||
}
|
||||
@ -208,7 +208,7 @@ void ewol::resource::Colored3DObject::drawCubeLine(const vec3& _min,
|
||||
void ewol::resource::Colored3DObject::drawSquare(const vec3& _size,
|
||||
mat4& _transformationMatrix,
|
||||
const etk::Color<float>& _tmpColor) {
|
||||
std::vector<vec3> tmpVertices;
|
||||
etk::Vector<vec3> tmpVertices;
|
||||
static int indices[36] = { 0,1,2, 3,2,1, 4,0,6,
|
||||
6,0,2, 5,1,4, 4,1,0,
|
||||
7,3,1, 7,1,5, 5,4,7,
|
||||
@ -226,9 +226,9 @@ void ewol::resource::Colored3DObject::drawSquare(const vec3& _size,
|
||||
// normal calculation :
|
||||
//btVector3 normal = (vertices[indices[iii+2]]-vertices[indices[iii]]).cross(vertices[indices[iii+1]]-vertices[indices[iii]]);
|
||||
//normal.normalize ();
|
||||
tmpVertices.push_back(vertices[indices[iii]]);
|
||||
tmpVertices.push_back(vertices[indices[iii+1]]);
|
||||
tmpVertices.push_back(vertices[indices[iii+2]]);
|
||||
tmpVertices.pushBack(vertices[indices[iii]]);
|
||||
tmpVertices.pushBack(vertices[indices[iii+1]]);
|
||||
tmpVertices.pushBack(vertices[indices[iii+2]]);
|
||||
}
|
||||
draw(tmpVertices, _tmpColor, _transformationMatrix);
|
||||
}
|
||||
@ -238,7 +238,7 @@ void ewol::resource::Colored3DObject::drawSphere(float _radius,
|
||||
int _longs,
|
||||
mat4& _transformationMatrix,
|
||||
const etk::Color<float>& _tmpColor) {
|
||||
std::vector<vec3> tmpVertices;
|
||||
etk::Vector<vec3> tmpVertices;
|
||||
for(int32_t iii=0; iii<=_lats; ++iii) {
|
||||
float lat0 = M_PI * (-0.5f + float(iii - 1) / _lats);
|
||||
float z0 = _radius*sin(lat0);
|
||||
@ -261,13 +261,13 @@ void ewol::resource::Colored3DObject::drawSphere(float _radius,
|
||||
vec3 v2 = vec3(x * zr1, y * zr1, z1);
|
||||
vec3 v3 = vec3(x * zr0, y * zr0, z0);
|
||||
|
||||
tmpVertices.push_back(v1);
|
||||
tmpVertices.push_back(v2);
|
||||
tmpVertices.push_back(v3);
|
||||
tmpVertices.pushBack(v1);
|
||||
tmpVertices.pushBack(v2);
|
||||
tmpVertices.pushBack(v3);
|
||||
|
||||
tmpVertices.push_back(v1);
|
||||
tmpVertices.push_back(v3);
|
||||
tmpVertices.push_back(v4);
|
||||
tmpVertices.pushBack(v1);
|
||||
tmpVertices.pushBack(v3);
|
||||
tmpVertices.pushBack(v4);
|
||||
}
|
||||
}
|
||||
draw(tmpVertices, _tmpColor, _transformationMatrix);
|
||||
@ -278,7 +278,7 @@ void ewol::resource::Colored3DObject::drawCylinder(float _radius,
|
||||
int _longs,
|
||||
mat4& _transformationMatrix,
|
||||
const etk::Color<float>& _tmpColor) {
|
||||
std::vector<vec3> tmpVertices;
|
||||
etk::Vector<vec3> tmpVertices;
|
||||
// center to border (TOP)
|
||||
|
||||
// center to border (TOP)
|
||||
@ -296,9 +296,9 @@ void ewol::resource::Colored3DObject::drawCylinder(float _radius,
|
||||
x = cos(lng)*_radius;
|
||||
y = sin(lng)*_radius;
|
||||
vec3 v3 = vec3(x, y, z);
|
||||
tmpVertices.push_back(v1);
|
||||
tmpVertices.push_back(v3);
|
||||
tmpVertices.push_back(v2);
|
||||
tmpVertices.pushBack(v1);
|
||||
tmpVertices.pushBack(v3);
|
||||
tmpVertices.pushBack(v2);
|
||||
}
|
||||
// Cylinder
|
||||
for(int32_t jjj=0; jjj<_longs; ++jjj) {
|
||||
@ -317,13 +317,13 @@ void ewol::resource::Colored3DObject::drawCylinder(float _radius,
|
||||
vec3 v3 = vec3(x, y, z);
|
||||
vec3 v3b = vec3(x, y, -z);
|
||||
|
||||
tmpVertices.push_back(v2);
|
||||
tmpVertices.push_back(v3);
|
||||
tmpVertices.push_back(v3b);
|
||||
tmpVertices.pushBack(v2);
|
||||
tmpVertices.pushBack(v3);
|
||||
tmpVertices.pushBack(v3b);
|
||||
|
||||
tmpVertices.push_back(v2);
|
||||
tmpVertices.push_back(v3b);
|
||||
tmpVertices.push_back(v2b);
|
||||
tmpVertices.pushBack(v2);
|
||||
tmpVertices.pushBack(v3b);
|
||||
tmpVertices.pushBack(v2b);
|
||||
}
|
||||
// center to border (BUTTOM)
|
||||
for(int32_t jjj=0; jjj<_longs; ++jjj) {
|
||||
@ -340,9 +340,9 @@ void ewol::resource::Colored3DObject::drawCylinder(float _radius,
|
||||
x = cos(lng)*_radius;
|
||||
y = sin(lng)*_radius;
|
||||
vec3 v3 = vec3(x, y, z);
|
||||
tmpVertices.push_back(v1);
|
||||
tmpVertices.push_back(v2);
|
||||
tmpVertices.push_back(v3);
|
||||
tmpVertices.pushBack(v1);
|
||||
tmpVertices.pushBack(v2);
|
||||
tmpVertices.pushBack(v3);
|
||||
}
|
||||
draw(tmpVertices, _tmpColor, _transformationMatrix);
|
||||
}
|
||||
@ -352,7 +352,7 @@ void ewol::resource::Colored3DObject::drawCapsule(float _radius,
|
||||
int _longs,
|
||||
mat4& _transformationMatrix,
|
||||
const etk::Color<float>& _tmpColor) {
|
||||
std::vector<vec3> tmpVertices;
|
||||
etk::Vector<vec3> tmpVertices;
|
||||
_lats = int32_t(_lats / 2)*2;
|
||||
|
||||
// center to border (TOP)
|
||||
@ -378,13 +378,13 @@ void ewol::resource::Colored3DObject::drawCapsule(float _radius,
|
||||
y = sin(lng);
|
||||
vec3 v2 = vec3(x * zr1, y * zr1, z1+offset);
|
||||
vec3 v3 = vec3(x * zr0, y * zr0, z0+offset);
|
||||
tmpVertices.push_back(v1);
|
||||
tmpVertices.push_back(v2);
|
||||
tmpVertices.push_back(v3);
|
||||
tmpVertices.pushBack(v1);
|
||||
tmpVertices.pushBack(v2);
|
||||
tmpVertices.pushBack(v3);
|
||||
|
||||
tmpVertices.push_back(v1);
|
||||
tmpVertices.push_back(v3);
|
||||
tmpVertices.push_back(v4);
|
||||
tmpVertices.pushBack(v1);
|
||||
tmpVertices.pushBack(v3);
|
||||
tmpVertices.pushBack(v4);
|
||||
}
|
||||
}
|
||||
// Cylinder
|
||||
@ -404,13 +404,13 @@ void ewol::resource::Colored3DObject::drawCapsule(float _radius,
|
||||
vec3 v3 = vec3(x, y, z);
|
||||
vec3 v3b = vec3(x, y, -z);
|
||||
|
||||
tmpVertices.push_back(v2);
|
||||
tmpVertices.push_back(v3);
|
||||
tmpVertices.push_back(v3b);
|
||||
tmpVertices.pushBack(v2);
|
||||
tmpVertices.pushBack(v3);
|
||||
tmpVertices.pushBack(v3b);
|
||||
|
||||
tmpVertices.push_back(v2);
|
||||
tmpVertices.push_back(v3b);
|
||||
tmpVertices.push_back(v2b);
|
||||
tmpVertices.pushBack(v2);
|
||||
tmpVertices.pushBack(v3b);
|
||||
tmpVertices.pushBack(v2b);
|
||||
}
|
||||
// center to border (BUTTOM)
|
||||
offset = -_size*0.5f;
|
||||
@ -435,13 +435,13 @@ void ewol::resource::Colored3DObject::drawCapsule(float _radius,
|
||||
y = sin(lng);
|
||||
vec3 v2 = vec3(x * zr1, y * zr1, z1+offset);
|
||||
vec3 v3 = vec3(x * zr0, y * zr0, z0+offset);
|
||||
tmpVertices.push_back(v1);
|
||||
tmpVertices.push_back(v2);
|
||||
tmpVertices.push_back(v3);
|
||||
tmpVertices.pushBack(v1);
|
||||
tmpVertices.pushBack(v2);
|
||||
tmpVertices.pushBack(v3);
|
||||
|
||||
tmpVertices.push_back(v1);
|
||||
tmpVertices.push_back(v3);
|
||||
tmpVertices.push_back(v4);
|
||||
tmpVertices.pushBack(v1);
|
||||
tmpVertices.pushBack(v3);
|
||||
tmpVertices.pushBack(v4);
|
||||
}
|
||||
}
|
||||
draw(tmpVertices, _tmpColor, _transformationMatrix);
|
||||
@ -453,7 +453,7 @@ void ewol::resource::Colored3DObject::drawCone(float _radius,
|
||||
int _longs,
|
||||
mat4& _transformationMatrix,
|
||||
const etk::Color<float>& _tmpColor) {
|
||||
std::vector<vec3> tmpVertices;
|
||||
etk::Vector<vec3> tmpVertices;
|
||||
// center to border (TOP)
|
||||
for(int32_t jjj=0; jjj<_longs; ++jjj) {
|
||||
float lng = 2.0f * M_PI * float(jjj - 1) / _longs;
|
||||
@ -467,9 +467,9 @@ void ewol::resource::Colored3DObject::drawCone(float _radius,
|
||||
x = cos(lng)*_radius;
|
||||
y = sin(lng)*_radius;
|
||||
vec3 v3 = vec3(x, y, _size/2);
|
||||
tmpVertices.push_back(v1);
|
||||
tmpVertices.push_back(v3);
|
||||
tmpVertices.push_back(v2);
|
||||
tmpVertices.pushBack(v1);
|
||||
tmpVertices.pushBack(v3);
|
||||
tmpVertices.pushBack(v2);
|
||||
}
|
||||
// center to border (BUTTOM)
|
||||
for(int32_t jjj=0; jjj<_longs; ++jjj) {
|
||||
@ -485,23 +485,23 @@ void ewol::resource::Colored3DObject::drawCone(float _radius,
|
||||
x = cos(lng)*_radius;
|
||||
y = sin(lng)*_radius;
|
||||
vec3 v3 = vec3(x, y, _size/2);
|
||||
tmpVertices.push_back(v1);
|
||||
tmpVertices.push_back(v2);
|
||||
tmpVertices.push_back(v3);
|
||||
tmpVertices.pushBack(v1);
|
||||
tmpVertices.pushBack(v2);
|
||||
tmpVertices.pushBack(v3);
|
||||
}
|
||||
draw(tmpVertices, _tmpColor, _transformationMatrix);
|
||||
}
|
||||
|
||||
void ewol::resource::Colored3DObject::drawTriangles(const std::vector<vec3>& _vertex,
|
||||
const std::vector<uint32_t>& _indice,
|
||||
void ewol::resource::Colored3DObject::drawTriangles(const etk::Vector<vec3>& _vertex,
|
||||
const etk::Vector<uint32_t>& _indice,
|
||||
mat4& _transformationMatrix,
|
||||
const etk::Color<float>& _tmpColor,
|
||||
const vec3& _offset) {
|
||||
std::vector<vec3> tmpVertices;
|
||||
etk::Vector<vec3> tmpVertices;
|
||||
for (size_t iii=0; iii<_indice.size()/3; ++iii) {
|
||||
tmpVertices.push_back(_vertex[_indice[iii*3 + 0]]+_offset);
|
||||
tmpVertices.push_back(_vertex[_indice[iii*3 + 1]]+_offset);
|
||||
tmpVertices.push_back(_vertex[_indice[iii*3 + 2]]+_offset);
|
||||
tmpVertices.pushBack(_vertex[_indice[iii*3 + 0]]+_offset);
|
||||
tmpVertices.pushBack(_vertex[_indice[iii*3 + 1]]+_offset);
|
||||
tmpVertices.pushBack(_vertex[_indice[iii*3 + 2]]+_offset);
|
||||
//EWOL_INFO(" indices " << _indice[iii*3 + 0] << " " << _indice[iii*3 + 1] << " " << _indice[iii*3 + 2]);
|
||||
//EWOL_INFO(" triangle " << _vertex[_indice[iii*3 + 0]] << " " << _vertex[_indice[iii*3 + 1]] << " " << _vertex[_indice[iii*3 + 2]]);
|
||||
}
|
||||
@ -510,7 +510,7 @@ void ewol::resource::Colored3DObject::drawTriangles(const std::vector<vec3>& _ve
|
||||
}
|
||||
|
||||
namespace etk {
|
||||
template<> std::string to_string(ewol::resource::Colored3DObject const&) {
|
||||
template<> etk::String toString(ewol::resource::Colored3DObject const&) {
|
||||
return "!!ewol::resource::Colored3DObject!ERROR!CAN_NOT_BE_CONVERT!!";
|
||||
}
|
||||
}
|
||||
|
@ -30,16 +30,16 @@ namespace ewol {
|
||||
DECLARE_RESOURCE_FACTORY(Colored3DObject);
|
||||
virtual ~Colored3DObject();
|
||||
public:
|
||||
virtual void draw(const std::vector<vec3>& _vertices,
|
||||
virtual void draw(const etk::Vector<vec3>& _vertices,
|
||||
const etk::Color<float>& _color,
|
||||
bool _updateDepthBuffer=true,
|
||||
bool _depthtest=true);
|
||||
virtual void draw(const std::vector<vec3>& _vertices,
|
||||
virtual void draw(const etk::Vector<vec3>& _vertices,
|
||||
const etk::Color<float>& _color,
|
||||
mat4& _transformationMatrix,
|
||||
bool _updateDepthBuffer=true,
|
||||
bool _depthtest=true);
|
||||
virtual void drawLine(std::vector<vec3>& _vertices,
|
||||
virtual void drawLine(etk::Vector<vec3>& _vertices,
|
||||
const etk::Color<float>& _color,
|
||||
mat4& _transformationMatrix,
|
||||
bool _updateDepthBuffer=true,
|
||||
@ -77,8 +77,8 @@ namespace ewol {
|
||||
int _longs,
|
||||
mat4& _transformationMatrix,
|
||||
const etk::Color<float>& _tmpColor);
|
||||
void drawTriangles(const std::vector<vec3>& _vertex,
|
||||
const std::vector<uint32_t>& _indice,
|
||||
void drawTriangles(const etk::Vector<vec3>& _vertex,
|
||||
const etk::Vector<uint32_t>& _indice,
|
||||
mat4& _transformationMatrix,
|
||||
const etk::Color<float>& _tmpColor,
|
||||
const vec3& _offset=vec3(0,0,0.1));
|
||||
|
@ -18,7 +18,7 @@ ewol::resource::ConfigFile::ConfigFile() :
|
||||
addResourceType("ewol::ConfigFile");
|
||||
}
|
||||
|
||||
void ewol::resource::ConfigFile::init(const std::string& _filename) {
|
||||
void ewol::resource::ConfigFile::init(const etk::String& _filename) {
|
||||
std::unique_lock<std::recursive_mutex> lock(m_mutex);
|
||||
gale::Resource::init(_filename);
|
||||
EWOL_DEBUG("SFP : load \"" << _filename << "\"");
|
||||
@ -48,7 +48,7 @@ void ewol::resource::ConfigFile::reload() {
|
||||
}
|
||||
|
||||
|
||||
int32_t ewol::resource::ConfigFile::request(const std::string& _paramName) {
|
||||
int32_t ewol::resource::ConfigFile::request(const etk::String& _paramName) {
|
||||
std::unique_lock<std::recursive_mutex> lock(m_mutex);
|
||||
// check if the parameters existed :
|
||||
if (m_list.exist(_paramName) == false) {
|
||||
@ -70,7 +70,7 @@ double ewol::resource::ConfigFile::getNumber(int32_t _id) {
|
||||
return m_list[_id].toNumber().get();
|
||||
}
|
||||
|
||||
std::string ewol::resource::ConfigFile::getString(int32_t _id) {
|
||||
etk::String ewol::resource::ConfigFile::getString(int32_t _id) {
|
||||
std::unique_lock<std::recursive_mutex> lock(m_mutex);
|
||||
if ( _id < 0
|
||||
|| m_list[_id].exist() == false) {
|
||||
|
@ -19,17 +19,17 @@ namespace ewol {
|
||||
etk::Hash<ejson::Value> m_list;
|
||||
protected:
|
||||
ConfigFile();
|
||||
void init(const std::string& _filename);
|
||||
void init(const etk::String& _filename);
|
||||
public:
|
||||
virtual ~ConfigFile();
|
||||
DECLARE_RESOURCE_NAMED_FACTORY(ConfigFile);
|
||||
public:
|
||||
void reload();
|
||||
|
||||
int32_t request(const std::string& _paramName);
|
||||
int32_t request(const etk::String& _paramName);
|
||||
|
||||
double getNumber(int32_t _id);
|
||||
std::string getString(int32_t _id);
|
||||
etk::String getString(int32_t _id);
|
||||
bool getBoolean(int32_t _id);
|
||||
public:
|
||||
/**
|
||||
@ -38,7 +38,7 @@ namespace ewol {
|
||||
* @param[in] _filename Name of the configuration file.
|
||||
* @return pointer on the resource or nullptr if an error occured.
|
||||
*/
|
||||
static ememory::SharedPtr<ewol::resource::ConfigFile> keep(const std::string& _filename);
|
||||
static ememory::SharedPtr<ewol::resource::ConfigFile> keep(const etk::String& _filename);
|
||||
};
|
||||
};
|
||||
};
|
||||
|
@ -31,29 +31,29 @@ ewol::resource::DistanceFieldFont::DistanceFieldFont() :
|
||||
m_sizeRatio = 1.0f;
|
||||
}
|
||||
|
||||
void ewol::resource::DistanceFieldFont::init(const std::string& _fontName) {
|
||||
void ewol::resource::DistanceFieldFont::init(const etk::String& _fontName) {
|
||||
std::unique_lock<std::recursive_mutex> lock(m_mutex);
|
||||
ewol::resource::Texture::init(_fontName);
|
||||
std::string localName = _fontName;
|
||||
std::vector<std::string> folderList;
|
||||
etk::String localName = _fontName;
|
||||
etk::Vector<etk::String> folderList;
|
||||
if (true == ewol::getContext().getFontDefault().getUseExternal()) {
|
||||
#if defined(__TARGET_OS__Android)
|
||||
folderList.push_back("ROOT:system/fonts");
|
||||
folderList.pushBack("ROOT:system/fonts");
|
||||
#elif defined(__TARGET_OS__Linux)
|
||||
folderList.push_back("ROOT:usr/share/fonts/truetype");
|
||||
folderList.pushBack("ROOT:usr/share/fonts/truetype");
|
||||
#endif
|
||||
}
|
||||
std::string applicationBaseFont = ewol::getContext().getFontDefault().getFolder();
|
||||
std::vector<std::string> applicationBaseFontList = etk::FSNodeExplodeMultiplePath(applicationBaseFont);
|
||||
etk::String applicationBaseFont = ewol::getContext().getFontDefault().getFolder();
|
||||
etk::Vector<etk::String> applicationBaseFontList = etk::FSNodeExplodeMultiplePath(applicationBaseFont);
|
||||
for (auto &it : applicationBaseFontList) {
|
||||
folderList.push_back(it);
|
||||
folderList.pushBack(it);
|
||||
}
|
||||
for (size_t folderID = 0; folderID < folderList.size() ; folderID++) {
|
||||
etk::FSNode myFolder(folderList[folderID]);
|
||||
// find the real Font name :
|
||||
std::vector<std::string> output;
|
||||
etk::Vector<etk::String> output;
|
||||
myFolder.folderGetRecursiveFiles(output);
|
||||
std::vector<std::string> split = etk::split(localName, ';');
|
||||
etk::Vector<etk::String> split = etk::split(localName, ';');
|
||||
EWOL_INFO("try to find font named : " << split << " in: " << myFolder);
|
||||
//EWOL_CRITICAL("parse string : " << split);
|
||||
bool hasFindAFont = false;
|
||||
@ -139,13 +139,13 @@ float ewol::resource::DistanceFieldFont::getDisplayRatio(float _size) {
|
||||
void ewol::resource::DistanceFieldFont::generateDistanceField(const egami::ImageMono& _input, egami::Image& _output) {
|
||||
std::unique_lock<std::recursive_mutex> lock(m_mutex);
|
||||
int32_t size = _input.getSize().x() * _input.getSize().y();
|
||||
std::vector<short> xdist(size);
|
||||
std::vector<short> ydist(size);
|
||||
std::vector<double> gx(size);
|
||||
std::vector<double> gy(size);
|
||||
std::vector<double> data(size);
|
||||
std::vector<double> outside(size);
|
||||
std::vector<double> inside(size);
|
||||
etk::Vector<short> xdist(size);
|
||||
etk::Vector<short> ydist(size);
|
||||
etk::Vector<double> gx(size);
|
||||
etk::Vector<double> gy(size);
|
||||
etk::Vector<double> data(size);
|
||||
etk::Vector<double> outside(size);
|
||||
etk::Vector<double> inside(size);
|
||||
// Convert img into double (data)
|
||||
double img_min = 255, img_max = -255;
|
||||
for (int32_t yyy = 0; yyy < _input.getSize().y(); ++yyy) {
|
||||
@ -284,7 +284,7 @@ bool ewol::resource::DistanceFieldFont::addGlyph(const char32_t& _val) {
|
||||
EWOL_WARNING("Did not find char : '" << _val << "'=" << _val);
|
||||
tmpchar.setNotExist();
|
||||
}
|
||||
m_listElement.push_back(tmpchar);
|
||||
m_listElement.pushBack(tmpchar);
|
||||
//m_font[iii]->display();
|
||||
// generate the kerning for all the characters :
|
||||
if (tmpchar.exist() == true) {
|
||||
@ -352,13 +352,13 @@ void ewol::resource::DistanceFieldFont::exportOnFile() {
|
||||
ejson::Array tmpList;
|
||||
for (size_t iii=0; iii<m_listElement.size(); ++iii) {
|
||||
ejson::Object tmpObj;
|
||||
tmpObj.add("m_UVal", ejson::String(etk::to_string(m_listElement[iii].m_UVal)));
|
||||
tmpObj.add("m_UVal", ejson::String(etk::toString(m_listElement[iii].m_UVal)));
|
||||
tmpObj.add("m_glyphIndex", ejson::Number(m_listElement[iii].m_glyphIndex));
|
||||
tmpObj.add("m_sizeTexture", ejson::String((std::string)m_listElement[iii].m_sizeTexture));
|
||||
tmpObj.add("m_bearing", ejson::String((std::string)m_listElement[iii].m_bearing));
|
||||
tmpObj.add("m_advance", ejson::String((std::string)m_listElement[iii].m_advance));
|
||||
tmpObj.add("m_texturePosStart", ejson::String((std::string)m_listElement[iii].m_texturePosStart));
|
||||
tmpObj.add("m_texturePosSize", ejson::String((std::string)m_listElement[iii].m_texturePosSize));
|
||||
tmpObj.add("m_sizeTexture", ejson::String((etk::String)m_listElement[iii].m_sizeTexture));
|
||||
tmpObj.add("m_bearing", ejson::String((etk::String)m_listElement[iii].m_bearing));
|
||||
tmpObj.add("m_advance", ejson::String((etk::String)m_listElement[iii].m_advance));
|
||||
tmpObj.add("m_texturePosStart", ejson::String((etk::String)m_listElement[iii].m_texturePosStart));
|
||||
tmpObj.add("m_texturePosSize", ejson::String((etk::String)m_listElement[iii].m_texturePosSize));
|
||||
tmpObj.add("m_exist", ejson::Boolean(m_listElement[iii].m_exist));
|
||||
tmpList.add(tmpObj);
|
||||
}
|
||||
@ -412,7 +412,7 @@ bool ewol::resource::DistanceFieldFont::importFromFile() {
|
||||
prop.m_texturePosStart = tmpObj["m_texturePosStart"].toString().get("0,0");
|
||||
prop.m_texturePosSize = tmpObj["m_texturePosSize"].toString().get("0,0");
|
||||
prop.m_exist = tmpObj["m_exist"].toBoolean().get(false);
|
||||
m_listElement.push_back(prop);
|
||||
m_listElement.pushBack(prop);
|
||||
}
|
||||
m_data = egami::load(m_fileName + ".bmp");
|
||||
return m_data.exist();
|
||||
|
@ -13,21 +13,21 @@ namespace ewol {
|
||||
namespace resource {
|
||||
class DistanceFieldFont : public ewol::resource::Texture {
|
||||
private:
|
||||
std::string m_fileName;
|
||||
etk::String m_fileName;
|
||||
float m_sizeRatio;
|
||||
// specific element to have the the know if the specify element is known...
|
||||
// == > otherwise I can just generate italic ...
|
||||
// == > Bold is a little more complicated (maybe with the bordersize)
|
||||
ememory::SharedPtr<ewol::resource::FontBase> m_font;
|
||||
public:
|
||||
std::vector<GlyphProperty> m_listElement;
|
||||
etk::Vector<GlyphProperty> m_listElement;
|
||||
private:
|
||||
// for the texture generation :
|
||||
ivec2 m_lastGlyphPos;
|
||||
int32_t m_lastRawHeigh;
|
||||
protected:
|
||||
DistanceFieldFont();
|
||||
void init(const std::string& _fontName);
|
||||
void init(const etk::String& _fontName);
|
||||
public:
|
||||
DECLARE_RESOURCE_NAMED_FACTORY(DistanceFieldFont);
|
||||
virtual ~DistanceFieldFont();
|
||||
@ -68,7 +68,7 @@ namespace ewol {
|
||||
* @param[in] _filename Name of the texture font.
|
||||
* @return pointer on the resource or nullptr if an error occured.
|
||||
*/
|
||||
static ememory::SharedPtr<ewol::resource::DistanceFieldFont> keep(const std::string& _filename);
|
||||
static ememory::SharedPtr<ewol::resource::DistanceFieldFont> keep(const etk::String& _filename);
|
||||
private:
|
||||
/**
|
||||
* @brief add a glyph in a texture font.
|
||||
|
@ -5,7 +5,7 @@
|
||||
*/
|
||||
|
||||
#include <etk/types.hpp>
|
||||
#include <vector>
|
||||
#include <etk/Vector.hpp>
|
||||
#include <etk/os/FSNode.hpp>
|
||||
|
||||
|
||||
@ -54,7 +54,7 @@ ewol::resource::FontFreeType::FontFreeType() {
|
||||
m_FileSize = 0;
|
||||
}
|
||||
|
||||
void ewol::resource::FontFreeType::init(const std::string& _fontName) {
|
||||
void ewol::resource::FontFreeType::init(const etk::String& _fontName) {
|
||||
std::unique_lock<std::recursive_mutex> lock(m_mutex);
|
||||
ewol::resource::FontBase::init(_fontName);
|
||||
etk::FSNode myfile(_fontName);
|
||||
@ -106,7 +106,7 @@ ewol::resource::FontFreeType::~FontFreeType() {
|
||||
FT_Done_Face( m_fftFace );
|
||||
}
|
||||
|
||||
vec2 ewol::resource::FontFreeType::getSize(int32_t _fontSize, const std::string& _unicodeString) {
|
||||
vec2 ewol::resource::FontFreeType::getSize(int32_t _fontSize, const etk::String& _unicodeString) {
|
||||
std::unique_lock<std::recursive_mutex> lock(m_mutex);
|
||||
if(false == m_init) {
|
||||
return vec2(0,0);
|
||||
@ -276,7 +276,7 @@ bool ewol::resource::FontFreeType::drawGlyph(egami::ImageMono& _imageOut,
|
||||
}
|
||||
|
||||
|
||||
void ewol::resource::FontFreeType::generateKerning(int32_t fontSize, std::vector<ewol::GlyphProperty>& listGlyph) {
|
||||
void ewol::resource::FontFreeType::generateKerning(int32_t fontSize, etk::Vector<ewol::GlyphProperty>& listGlyph) {
|
||||
std::unique_lock<std::recursive_mutex> lock(m_mutex);
|
||||
if(m_init == false) {
|
||||
return;
|
||||
|
@ -26,7 +26,7 @@ namespace ewol {
|
||||
void display();
|
||||
protected:
|
||||
FontFreeType();
|
||||
void init(const std::string& _fontName);
|
||||
void init(const etk::String& _fontName);
|
||||
public:
|
||||
DECLARE_RESOURCE_NAMED_FACTORY(FontFreeType);
|
||||
virtual ~FontFreeType();
|
||||
@ -46,12 +46,12 @@ namespace ewol {
|
||||
ewol::GlyphProperty& _property,
|
||||
int32_t _borderSize = 0);
|
||||
|
||||
vec2 getSize(int32_t _fontSize, const std::string& _unicodeString);
|
||||
vec2 getSize(int32_t _fontSize, const etk::String& _unicodeString);
|
||||
|
||||
int32_t getHeight(int32_t _fontSize);
|
||||
float getSizeWithHeight(float _fontHeight);
|
||||
|
||||
void generateKerning(int32_t _fontSize, std::vector<ewol::GlyphProperty>& _listGlyph);
|
||||
void generateKerning(int32_t _fontSize, etk::Vector<ewol::GlyphProperty>& _listGlyph);
|
||||
};
|
||||
void freeTypeInit();
|
||||
void freeTypeUnInit();
|
||||
|
@ -43,7 +43,7 @@ void ewol::resource::TextureFile::init() {
|
||||
ewol::resource::Texture::init();
|
||||
}
|
||||
|
||||
void ewol::resource::TextureFile::init(std::string _genName, const std::string& _tmpFilename, const ivec2& _size) {
|
||||
void ewol::resource::TextureFile::init(etk::String _genName, const etk::String& _tmpFilename, const ivec2& _size) {
|
||||
std::unique_lock<std::recursive_mutex> lock(m_mutex);
|
||||
ewol::resource::Texture::init(_genName);
|
||||
EWOL_DEBUG("create a new resource::Image : _genName=" << _genName << " _tmpFilename=" << _tmpFilename << " size=" << _size);
|
||||
@ -61,13 +61,13 @@ void ewol::resource::TextureFile::init(std::string _genName, const std::string&
|
||||
}
|
||||
m_lastSize = m_realImageSize;
|
||||
#ifdef GENERATE_DISTANCE_FIELD_MODE
|
||||
//egami::generateDistanceFieldFile(_tmpFilename, std::string(_tmpFilename, 0, _tmpFilename.size()-4) + ".bmp");
|
||||
egami::generateDistanceFieldFile(_tmpFilename, std::string(_tmpFilename, 0, _tmpFilename.size()-4) + ".edf");
|
||||
//egami::generateDistanceFieldFile(_tmpFilename, etk::String(_tmpFilename, 0, _tmpFilename.size()-4) + ".bmp");
|
||||
egami::generateDistanceFieldFile(_tmpFilename, etk::String(_tmpFilename, 0, _tmpFilename.size()-4) + ".edf");
|
||||
#endif
|
||||
flush();
|
||||
}
|
||||
|
||||
ememory::SharedPtr<ewol::resource::TextureFile> ewol::resource::TextureFile::create(const std::string& _filename, ivec2 _size, ivec2 _sizeRegister) {
|
||||
ememory::SharedPtr<ewol::resource::TextureFile> ewol::resource::TextureFile::create(const etk::String& _filename, ivec2 _size, ivec2 _sizeRegister) {
|
||||
EWOL_VERBOSE("KEEP: TextureFile: '" << _filename << "' size=" << _size << " sizeRegister=" << _sizeRegister);
|
||||
if (_filename == "") {
|
||||
ememory::SharedPtr<ewol::resource::TextureFile> object(new ewol::resource::TextureFile());
|
||||
@ -87,7 +87,7 @@ ememory::SharedPtr<ewol::resource::TextureFile> ewol::resource::TextureFile::cre
|
||||
_size.setY(-1);
|
||||
//EWOL_ERROR("Error Request the image size.y() =0 ???");
|
||||
}
|
||||
std::string tmpFilename = _filename;
|
||||
etk::String tmpFilename = _filename;
|
||||
if (etk::end_with(_filename, ".svg") == false) {
|
||||
_size = ewol::resource::TextureFile::sizeAuto;
|
||||
}
|
||||
@ -97,9 +97,9 @@ ememory::SharedPtr<ewol::resource::TextureFile> ewol::resource::TextureFile::cre
|
||||
if (_sizeRegister != ewol::resource::TextureFile::sizeAuto) {
|
||||
if (_sizeRegister != ewol::resource::TextureFile::sizeDefault) {
|
||||
tmpFilename += ":";
|
||||
tmpFilename += etk::to_string(_size.x());
|
||||
tmpFilename += etk::toString(_size.x());
|
||||
tmpFilename += "x";
|
||||
tmpFilename += etk::to_string(_size.y());
|
||||
tmpFilename += etk::toString(_size.y());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -24,7 +24,7 @@ namespace ewol {
|
||||
protected:
|
||||
TextureFile();
|
||||
void init();
|
||||
void init(std::string _genName, const std::string& _fileName, const ivec2& _size);
|
||||
void init(etk::String _genName, const etk::String& _fileName, const ivec2& _size);
|
||||
public:
|
||||
virtual ~TextureFile() { };
|
||||
public:
|
||||
@ -40,7 +40,7 @@ namespace ewol {
|
||||
* @param[in] _sizeRegister size register in named (When you preaload the images the size write here will be )
|
||||
* @return pointer on the resource or nullptr if an error occured.
|
||||
*/
|
||||
static ememory::SharedPtr<ewol::resource::TextureFile> create(const std::string& _filename,
|
||||
static ememory::SharedPtr<ewol::resource::TextureFile> create(const etk::String& _filename,
|
||||
ivec2 _size=ewol::resource::TextureFile::sizeAuto,
|
||||
ivec2 _sizeRegister=ewol::resource::TextureFile::sizeAuto);
|
||||
};
|
||||
|
@ -22,7 +22,7 @@ void ewol::resource::ImageDF::init() {
|
||||
ewol::resource::Texture::init();
|
||||
}
|
||||
|
||||
void ewol::resource::ImageDF::init(std::string _genName, const std::string& _tmpfileName, const ivec2& _size) {
|
||||
void ewol::resource::ImageDF::init(etk::String _genName, const etk::String& _tmpfileName, const ivec2& _size) {
|
||||
std::unique_lock<std::recursive_mutex> lock(m_mutex);
|
||||
ewol::resource::Texture::init(_genName);
|
||||
EWOL_DEBUG("create a new resource::Image : _genName=" << _genName << " _tmpfileName=" << _tmpfileName << " size=" << _size);
|
||||
@ -51,13 +51,13 @@ void ewol::resource::ImageDF::init(std::string _genName, const std::string& _tmp
|
||||
void ewol::resource::ImageDF::generateDistanceField(const egami::ImageMono& _input, egami::Image& _output) {
|
||||
std::unique_lock<std::recursive_mutex> lock(m_mutex);
|
||||
int32_t size = _input.getSize().x() * _input.getSize().y();
|
||||
std::vector<short> xdist(size);
|
||||
std::vector<short> ydist(size);
|
||||
std::vector<double> gx(size);
|
||||
std::vector<double> gy(size);
|
||||
std::vector<double> data(size);
|
||||
std::vector<double> outside(size);
|
||||
std::vector<double> inside(size);
|
||||
etk::Vector<short> xdist(size);
|
||||
etk::Vector<short> ydist(size);
|
||||
etk::Vector<double> gx(size);
|
||||
etk::Vector<double> gy(size);
|
||||
etk::Vector<double> data(size);
|
||||
etk::Vector<double> outside(size);
|
||||
etk::Vector<double> inside(size);
|
||||
// Convert img into double (data)
|
||||
double img_min = 255, img_max = -255;
|
||||
for (int32_t yyy = 0; yyy < _input.getSize().y(); ++yyy) {
|
||||
@ -150,7 +150,7 @@ static int32_t nextP2(int32_t _value) {
|
||||
|
||||
|
||||
|
||||
ememory::SharedPtr<ewol::resource::ImageDF> ewol::resource::ImageDF::create(const std::string& _filename, ivec2 _size) {
|
||||
ememory::SharedPtr<ewol::resource::ImageDF> ewol::resource::ImageDF::create(const etk::String& _filename, ivec2 _size) {
|
||||
EWOL_VERBOSE("KEEP: TextureFile: '" << _filename << "' size=" << _size);
|
||||
if (_filename == "") {
|
||||
ememory::SharedPtr<ewol::resource::ImageDF> object(new ewol::resource::ImageDF());
|
||||
@ -170,7 +170,7 @@ ememory::SharedPtr<ewol::resource::ImageDF> ewol::resource::ImageDF::create(cons
|
||||
_size.setY(-1);
|
||||
//EWOL_ERROR("Error Request the image size.y() =0 ???");
|
||||
}
|
||||
std::string TmpFilename = _filename;
|
||||
etk::String TmpFilename = _filename;
|
||||
if (etk::end_with(_filename, ".svg") == false) {
|
||||
_size = ivec2(-1,-1);
|
||||
}
|
||||
@ -185,9 +185,9 @@ ememory::SharedPtr<ewol::resource::ImageDF> ewol::resource::ImageDF::create(cons
|
||||
_size.setValue(nextP2(_size.x()), nextP2(_size.y()));
|
||||
#endif
|
||||
TmpFilename += ":";
|
||||
TmpFilename += etk::to_string(_size.x());
|
||||
TmpFilename += etk::toString(_size.x());
|
||||
TmpFilename += "x";
|
||||
TmpFilename += etk::to_string(_size.y());
|
||||
TmpFilename += etk::toString(_size.y());
|
||||
}
|
||||
|
||||
EWOL_VERBOSE("KEEP: TextureFile: '" << TmpFilename << "' new size=" << _size);
|
||||
|
@ -18,7 +18,7 @@ namespace ewol {
|
||||
protected:
|
||||
ImageDF();
|
||||
void init();
|
||||
void init(std::string _genName, const std::string& _fileName, const ivec2& _size);
|
||||
void init(etk::String _genName, const etk::String& _fileName, const ivec2& _size);
|
||||
public:
|
||||
virtual ~ImageDF() { };
|
||||
protected:
|
||||
@ -40,7 +40,7 @@ namespace ewol {
|
||||
* @param[in] _requested size of the image (usefull when loading .svg to automatic rescale)
|
||||
* @return pointer on the resource or nullptr if an error occured.
|
||||
*/
|
||||
static ememory::SharedPtr<ewol::resource::ImageDF> create(const std::string& _filename, ivec2 _size=ivec2(-1,-1));
|
||||
static ememory::SharedPtr<ewol::resource::ImageDF> create(const etk::String& _filename, ivec2 _size=ivec2(-1,-1));
|
||||
};
|
||||
};
|
||||
};
|
||||
|
@ -29,7 +29,7 @@ static int32_t nextP2(int32_t _value) {
|
||||
return val;
|
||||
}
|
||||
|
||||
void ewol::resource::Texture::init(const std::string& _filename) {
|
||||
void ewol::resource::Texture::init(const etk::String& _filename) {
|
||||
gale::Resource::init(_filename);
|
||||
}
|
||||
void ewol::resource::Texture::init() {
|
||||
@ -45,7 +45,9 @@ ewol::resource::Texture::Texture() :
|
||||
m_lastSize(1,1),
|
||||
m_loaded(false),
|
||||
m_lastTypeObject(0),
|
||||
m_lastSizeObject(0) {
|
||||
m_lastSizeObject(0),
|
||||
m_repeat(false),
|
||||
m_filter(ewol::resource::TextureFilter::linear) {
|
||||
addResourceType("ewol::compositing::Texture");
|
||||
}
|
||||
|
||||
@ -53,6 +55,15 @@ ewol::resource::Texture::~Texture() {
|
||||
removeContext();
|
||||
}
|
||||
|
||||
|
||||
void ewol::resource::Texture::setRepeat(bool _value) {
|
||||
m_repeat = _value;
|
||||
}
|
||||
|
||||
void ewol::resource::Texture::setFilterMode(enum ewol::resource::TextureFilter _filter) {
|
||||
m_filter = _filter;
|
||||
}
|
||||
|
||||
#include <egami/egami.hpp>
|
||||
|
||||
bool ewol::resource::Texture::updateContext() {
|
||||
@ -71,37 +82,27 @@ bool ewol::resource::Texture::updateContext() {
|
||||
}
|
||||
int32_t typeObject = GL_RGBA;
|
||||
int32_t sizeObject = GL_UNSIGNED_BYTE;
|
||||
#ifdef EWOL_USE_FBO
|
||||
int32_t sizeByte = 1;
|
||||
#endif
|
||||
int32_t sizeByte = 1;
|
||||
switch (m_data.getType()) {
|
||||
case egami::colorType::RGBA8:
|
||||
typeObject = GL_RGBA;
|
||||
sizeObject = GL_UNSIGNED_BYTE;
|
||||
#ifdef EWOL_USE_FBO
|
||||
sizeByte = 4;
|
||||
#endif
|
||||
sizeByte = 4;
|
||||
break;
|
||||
case egami::colorType::RGB8:
|
||||
typeObject = GL_RGB;
|
||||
sizeObject = GL_UNSIGNED_BYTE;
|
||||
#ifdef EWOL_USE_FBO
|
||||
sizeByte = 3;
|
||||
#endif
|
||||
sizeByte = 3;
|
||||
break;
|
||||
case egami::colorType::RGBAf:
|
||||
typeObject = GL_RGBA;
|
||||
sizeObject = GL_FLOAT;
|
||||
#ifdef EWOL_USE_FBO
|
||||
sizeByte = 16;
|
||||
#endif
|
||||
sizeByte = 16;
|
||||
break;
|
||||
case egami::colorType::RGBf:
|
||||
typeObject = GL_RGBA;
|
||||
sizeObject = GL_FLOAT;
|
||||
#ifdef EWOL_USE_FBO
|
||||
sizeByte = 12;
|
||||
#endif
|
||||
sizeByte = 12;
|
||||
break;
|
||||
case egami::colorType::unsignedInt16:
|
||||
case egami::colorType::unsignedInt32:
|
||||
@ -145,29 +146,32 @@ bool ewol::resource::Texture::updateContext() {
|
||||
// TODO : check error ???
|
||||
glBindTexture(GL_TEXTURE_2D, m_texId);
|
||||
if (m_loaded == false) {
|
||||
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_WRAP_S,GL_REPEAT);
|
||||
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_WRAP_T,GL_REPEAT);
|
||||
// TODO : Check error ???
|
||||
//glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
|
||||
//glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
|
||||
//--- mode nearest
|
||||
//glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); // 18/20
|
||||
//glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
|
||||
//--- Mode linear
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); // 16/17
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
|
||||
if (m_repeat == false) {
|
||||
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_WRAP_S,GL_CLAMP_TO_EDGE);
|
||||
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_WRAP_T,GL_CLAMP_TO_EDGE);
|
||||
} else {
|
||||
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_WRAP_S,GL_REPEAT);
|
||||
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_WRAP_T,GL_REPEAT);
|
||||
}
|
||||
if (m_filter == ewol::resource::TextureFilter::linear) {
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
|
||||
} else {
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
|
||||
}
|
||||
}
|
||||
//glPixelStorei(GL_UNPACK_ALIGNMENT,1);
|
||||
echrono::Steady toc1 = echrono::Steady::now();
|
||||
EWOL_VERBOSE(" BIND ==> " << (toc1 - tic));
|
||||
//egami::store(m_data, std::string("~/texture_") + etk::to_string(getId()) + ".bmp");
|
||||
//egami::store(m_data, etk::String("~/texture_") + etk::toString(getId()) + ".bmp");
|
||||
#if defined(__TARGET_OS__Android) \
|
||||
|| defined(__TARGET_OS__IOs)
|
||||
// On some embended target, the texture size must be square of 2:
|
||||
if (m_loaded == false) {
|
||||
// 1: Create the square 2 texture:
|
||||
int32_t bufferSize = m_data.getGPUSize().x() * m_data.getGPUSize().y() * 8;
|
||||
static std::vector<float> tmpData;
|
||||
static etk::Vector<float> tmpData;
|
||||
if (tmpData.size() < bufferSize) {
|
||||
tmpData.resize(bufferSize, 0.0f);
|
||||
}
|
||||
@ -217,6 +221,7 @@ bool ewol::resource::Texture::updateContext() {
|
||||
glBindBuffer(GL_PIXEL_UNPACK_BUFFER, 0);
|
||||
#else
|
||||
//3 Flush all time the data:
|
||||
echrono::Steady tic1 = echrono::Steady::now();
|
||||
glTexSubImage2D(GL_TEXTURE_2D, // Target
|
||||
0, // Level
|
||||
0, // x offset
|
||||
@ -225,7 +230,9 @@ bool ewol::resource::Texture::updateContext() {
|
||||
m_data.getHeight(),
|
||||
typeObject, // format
|
||||
sizeObject, // type
|
||||
m_data.getTextureDataPointer() );
|
||||
(void*)((char*)m_data.getTextureDataPointer()) );
|
||||
echrono::Steady toc2 = echrono::Steady::now();
|
||||
EWOL_INFO(" updateContext [STOP] ==> " << (toc2 - tic1));
|
||||
#endif
|
||||
#else
|
||||
// This is the normal case ==> set the image and after set just the update of the data
|
||||
@ -254,7 +261,7 @@ bool ewol::resource::Texture::updateContext() {
|
||||
// now the data is loaded
|
||||
m_loaded = true;
|
||||
echrono::Steady toc = echrono::Steady::now();
|
||||
EWOL_VERBOSE(" updateContext [STOP] ==> " << (toc - toc1));
|
||||
//EWOL_ERROR(" updateContext [STOP] ==> " << (toc - toc1));
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -14,6 +14,10 @@
|
||||
|
||||
namespace ewol {
|
||||
namespace resource {
|
||||
enum class TextureFilter {
|
||||
nearest,
|
||||
linear
|
||||
};
|
||||
class Texture : public gale::Resource {
|
||||
protected:
|
||||
uint32_t m_texId; //!< openGl textureID.
|
||||
@ -28,9 +32,25 @@ namespace ewol {
|
||||
bool m_loaded;
|
||||
int32_t m_lastTypeObject;
|
||||
int32_t m_lastSizeObject;
|
||||
protected:
|
||||
bool m_repeat; //!< repeate mode of the image (repeat the image if out of range [0..1]
|
||||
public:
|
||||
/**
|
||||
* @brief Set the repeate mode of the images if UV range is out of [0..1]
|
||||
* @param[in] _value Value of the new repeate mode
|
||||
*/
|
||||
void setRepeat(bool _value);
|
||||
protected:
|
||||
enum ewol::resource::TextureFilter m_filter; //!< Filter apply at the image when rendering it
|
||||
public:
|
||||
/**
|
||||
* @brief Set the Filter mode to apply at the image when display with a scale (not 1:1 ratio)
|
||||
* @param[in] _value Value of the new filter mode
|
||||
*/
|
||||
void setFilterMode(enum ewol::resource::TextureFilter _filter);
|
||||
// Public API:
|
||||
protected:
|
||||
void init(const std::string& _filename);
|
||||
void init(const etk::String& _filename);
|
||||
void init();
|
||||
Texture();
|
||||
public:
|
||||
|
@ -16,7 +16,7 @@
|
||||
#include <ewol/context/Context.hpp>
|
||||
|
||||
|
||||
std::ostream& ewol::operator <<(std::ostream& _os, enum ewol::font::mode _obj) {
|
||||
etk::Stream& ewol::operator <<(etk::Stream& _os, enum ewol::font::mode _obj) {
|
||||
switch(_obj) {
|
||||
default :
|
||||
_os << "error";
|
||||
@ -42,7 +42,7 @@ ewol::resource::TexturedFont::TexturedFont():
|
||||
addResourceType("ewol::resource::TexturedFont");
|
||||
}
|
||||
|
||||
void ewol::resource::TexturedFont::init(const std::string& _fontName) {
|
||||
void ewol::resource::TexturedFont::init(const etk::String& _fontName) {
|
||||
std::unique_lock<std::recursive_mutex> lock(m_mutex);
|
||||
ewol::resource::Texture::init(_fontName);
|
||||
EWOL_DEBUG("Load font : '" << _fontName << "'" );
|
||||
@ -83,32 +83,32 @@ void ewol::resource::TexturedFont::init(const std::string& _fontName) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
std::string localName(_fontName, 0, (tmpPos - tmpData));
|
||||
etk::String localName(_fontName, 0, (tmpPos - tmpData));
|
||||
if (tmpSize>400) {
|
||||
EWOL_ERROR("Font size too big ==> limit at 400 when exxeed ==> error : " << tmpSize << "==>30");
|
||||
tmpSize = 30;
|
||||
}
|
||||
m_size = tmpSize;
|
||||
|
||||
std::vector<std::string> folderList;
|
||||
etk::Vector<etk::String> folderList;
|
||||
if (ewol::getContext().getFontDefault().getUseExternal() == true) {
|
||||
#if defined(__TARGET_OS__Android)
|
||||
folderList.push_back("ROOT:system/fonts");
|
||||
folderList.pushBack("ROOT:system/fonts");
|
||||
#elif defined(__TARGET_OS__Linux)
|
||||
folderList.push_back("ROOT:usr/share/fonts");
|
||||
folderList.pushBack("ROOT:usr/share/fonts");
|
||||
#endif
|
||||
}
|
||||
std::string applicationBaseFont = ewol::getContext().getFontDefault().getFolder();
|
||||
std::vector<std::string> applicationBaseFontList = etk::FSNodeExplodeMultiplePath(applicationBaseFont);
|
||||
etk::String applicationBaseFont = ewol::getContext().getFontDefault().getFolder();
|
||||
etk::Vector<etk::String> applicationBaseFontList = etk::FSNodeExplodeMultiplePath(applicationBaseFont);
|
||||
for (auto &it : applicationBaseFontList) {
|
||||
folderList.push_back(it);
|
||||
folderList.pushBack(it);
|
||||
}
|
||||
for (size_t folderID=0; folderID<folderList.size() ; folderID++) {
|
||||
etk::FSNode myFolder(folderList[folderID]);
|
||||
// find the real Font name :
|
||||
std::vector<std::string> output;
|
||||
etk::Vector<etk::String> output;
|
||||
myFolder.folderGetRecursiveFiles(output);
|
||||
std::vector<std::string> split = etk::split(localName, ';');
|
||||
etk::Vector<etk::String> split = etk::split(localName, ';');
|
||||
EWOL_INFO("try to find font named : " << split << " in: " << myFolder);
|
||||
//EWOL_CRITICAL("parse string : " << split);
|
||||
bool hasFindAFont = false;
|
||||
@ -286,7 +286,7 @@ bool ewol::resource::TexturedFont::addGlyph(const char32_t& _val) {
|
||||
EWOL_WARNING("Did not find char : '" << _val << "'=" << _val);
|
||||
tmpchar.setNotExist();
|
||||
}
|
||||
m_listElement[iii].push_back(tmpchar);
|
||||
m_listElement[iii].pushBack(tmpchar);
|
||||
//m_font[iii]->display();
|
||||
// generate the kerning for all the characters :
|
||||
if (tmpchar.exist() == true) {
|
||||
|
@ -20,12 +20,12 @@ namespace ewol {
|
||||
BoldItalic,
|
||||
};
|
||||
}
|
||||
std::ostream& operator <<(std::ostream& _os, enum ewol::font::mode _obj);
|
||||
etk::Stream& operator <<(etk::Stream& _os, enum ewol::font::mode _obj);
|
||||
|
||||
namespace resource {
|
||||
class TexturedFont : public ewol::resource::Texture {
|
||||
private:
|
||||
std::string m_fileName[4];
|
||||
etk::String m_fileName[4];
|
||||
int32_t m_size;
|
||||
int32_t m_height[4];
|
||||
// specific element to have the the know if the specify element is known...
|
||||
@ -35,14 +35,14 @@ namespace ewol {
|
||||
enum ewol::font::mode m_modeWraping[4]; //!< This is a wrapping mode to prevent the fact that no font is define for a specific mode
|
||||
public:
|
||||
GlyphProperty m_emptyGlyph;
|
||||
std::vector<GlyphProperty> m_listElement[4];
|
||||
etk::Vector<GlyphProperty> m_listElement[4];
|
||||
private:
|
||||
// for the texture generation :
|
||||
ivec2 m_lastGlyphPos[4];
|
||||
int32_t m_lastRawHeigh[4];
|
||||
protected:
|
||||
TexturedFont();
|
||||
void init(const std::string& _fontName);
|
||||
void init(const etk::String& _fontName);
|
||||
public:
|
||||
DECLARE_RESOURCE_NAMED_FACTORY(TexturedFont);
|
||||
virtual ~TexturedFont();
|
||||
|
@ -21,7 +21,7 @@ namespace ewol {
|
||||
FontBase() {
|
||||
addResourceType("ewol::FontFreeType");
|
||||
}
|
||||
void init(const std::string& _fontName) {
|
||||
void init(const etk::String& _fontName) {
|
||||
gale::Resource::init(_fontName);
|
||||
};
|
||||
|
||||
@ -41,12 +41,12 @@ namespace ewol {
|
||||
ewol::GlyphProperty& _property,
|
||||
int32_t _borderSize = 0) = 0;
|
||||
|
||||
virtual vec2 getSize(int32_t _fontSize, const std::string& _unicodeString) = 0;
|
||||
virtual vec2 getSize(int32_t _fontSize, const etk::String& _unicodeString) = 0;
|
||||
virtual float getSizeWithHeight(float _fontHeight) = 0;
|
||||
|
||||
virtual int32_t getHeight(int32_t _fontSize) = 0;
|
||||
|
||||
virtual void generateKerning(int32_t _fontSize, std::vector<ewol::GlyphProperty>& _listGlyph) { };
|
||||
virtual void generateKerning(int32_t _fontSize, etk::Vector<ewol::GlyphProperty>& _listGlyph) { };
|
||||
|
||||
virtual void display() {};
|
||||
};
|
||||
|
@ -58,7 +58,7 @@ namespace ewol {
|
||||
vec2 m_texturePosStart; //!< Texture normalized position (START)
|
||||
vec2 m_texturePosSize; //!< Texture normalized position (SIZE)
|
||||
private:
|
||||
std::vector<ewol::Kerning> m_kerning; //!< kerning values of link of all elements
|
||||
etk::Vector<ewol::Kerning> m_kerning; //!< kerning values of link of all elements
|
||||
public:
|
||||
GlyphProperty() :
|
||||
m_UVal(0),
|
||||
@ -80,7 +80,7 @@ namespace ewol {
|
||||
return 0;
|
||||
};
|
||||
void kerningAdd(const char32_t _charcode, float _value) {
|
||||
m_kerning.push_back(ewol::Kerning(_charcode, _value));
|
||||
m_kerning.pushBack(ewol::Kerning(_charcode, _value));
|
||||
};
|
||||
void kerningClear() {
|
||||
m_kerning.clear();
|
||||
|
@ -43,7 +43,7 @@ namespace ewol {
|
||||
float m_value; //!< kerning real offset
|
||||
public:
|
||||
/**
|
||||
* @brief Simple constructor that allow to allocate the std::vector element
|
||||
* @brief Simple constructor that allow to allocate the etk::Vector element
|
||||
*/
|
||||
Kerning() :
|
||||
m_UVal(0),
|
||||
|
@ -13,7 +13,7 @@
|
||||
#include <ewol/widget/Manager.hpp>
|
||||
#include <ewol/widget/meta/StdPopUp.hpp>
|
||||
|
||||
void ewol::tools::message::create(enum ewol::tools::message::type _type, const std::string& _message) {
|
||||
void ewol::tools::message::create(enum ewol::tools::message::type _type, const etk::String& _message) {
|
||||
ewol::widget::StdPopUpShared tmpPopUp = widget::StdPopUp::create();
|
||||
if (tmpPopUp == nullptr) {
|
||||
EWOL_ERROR("Can not create a simple pop-up");
|
||||
@ -46,19 +46,19 @@ void ewol::tools::message::create(enum ewol::tools::message::type _type, const s
|
||||
windows->popUpWidgetPush(tmpPopUp);
|
||||
}
|
||||
|
||||
void ewol::tools::message::displayInfo(const std::string& _message) {
|
||||
void ewol::tools::message::displayInfo(const etk::String& _message) {
|
||||
ewol::tools::message::create(ewol::tools::message::type::info, _message);
|
||||
}
|
||||
|
||||
void ewol::tools::message::displayWarning(const std::string& _message) {
|
||||
void ewol::tools::message::displayWarning(const etk::String& _message) {
|
||||
ewol::tools::message::create(ewol::tools::message::type::warning, _message);
|
||||
}
|
||||
|
||||
void ewol::tools::message::displayError(const std::string& _message) {
|
||||
void ewol::tools::message::displayError(const etk::String& _message) {
|
||||
ewol::tools::message::create(ewol::tools::message::type::error, _message);
|
||||
}
|
||||
|
||||
void ewol::tools::message::displayCritical(const std::string& _message) {
|
||||
void ewol::tools::message::displayCritical(const etk::String& _message) {
|
||||
ewol::tools::message::create(ewol::tools::message::type::critical, _message);
|
||||
}
|
||||
|
||||
|
@ -26,27 +26,27 @@ namespace ewol {
|
||||
* @param[in] _type Type of the error.
|
||||
* @param[in] _message message to display (decorated text)
|
||||
*/
|
||||
void create(enum ewol::tools::message::type _type, const std::string& _message);
|
||||
void create(enum ewol::tools::message::type _type, const etk::String& _message);
|
||||
/**
|
||||
* @brief Create a simple information message
|
||||
* @param[in] _message message to display (decorated text)
|
||||
*/
|
||||
void displayInfo(const std::string& _message);
|
||||
void displayInfo(const etk::String& _message);
|
||||
/**
|
||||
* @brief Create a simple warning message
|
||||
* @param[in] _message message to display (decorated text)
|
||||
*/
|
||||
void displayWarning(const std::string& _message);
|
||||
void displayWarning(const etk::String& _message);
|
||||
/**
|
||||
* @brief Create a simple error message
|
||||
* @param[in] _message message to display (decorated text)
|
||||
*/
|
||||
void displayError(const std::string& _message);
|
||||
void displayError(const etk::String& _message);
|
||||
/**
|
||||
* @brief Create a simple critical message
|
||||
* @param[in] _message message to display (decorated text)
|
||||
*/
|
||||
void displayCritical(const std::string& _message);
|
||||
void displayCritical(const etk::String& _message);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -6,18 +6,18 @@
|
||||
|
||||
#include <ewol/debug.hpp>
|
||||
#include <etranslate/etranslate.hpp>
|
||||
#include <map>
|
||||
#include <etk/Map.hpp>
|
||||
#include <etk/os/FSNode.hpp>
|
||||
#include <ejson/ejson.hpp>
|
||||
|
||||
class LocalInstanceTranslation {
|
||||
private:
|
||||
std::map<std::string,std::string> m_listPath;
|
||||
std::string m_major;
|
||||
std::string m_languageDefault;
|
||||
std::string m_language;
|
||||
etk::Map<etk::String,etk::String> m_listPath;
|
||||
etk::String m_major;
|
||||
etk::String m_languageDefault;
|
||||
etk::String m_language;
|
||||
bool m_translateLoadad;
|
||||
std::map<std::string,std::string> m_translate;
|
||||
etk::Map<etk::String,etk::String> m_translate;
|
||||
public:
|
||||
LocalInstanceTranslation() :
|
||||
m_major("ewol"),
|
||||
@ -27,7 +27,7 @@ class LocalInstanceTranslation {
|
||||
// nothing to do ...
|
||||
}
|
||||
public:
|
||||
void addPath(const std::string& _lib, const std::string& _path, bool _major) {
|
||||
void addPath(const etk::String& _lib, const etk::String& _path, bool _major) {
|
||||
auto it = m_listPath.find(_lib);
|
||||
if (it == m_listPath.end()) {
|
||||
m_listPath.insert(make_pair(_lib, _path));
|
||||
@ -42,16 +42,16 @@ class LocalInstanceTranslation {
|
||||
m_translate.clear();
|
||||
};
|
||||
|
||||
const std::string& getPaths(const std::string& _lib) {
|
||||
const etk::String& getPaths(const etk::String& _lib) {
|
||||
auto it = m_listPath.find(_lib);
|
||||
if (it == m_listPath.end()) {
|
||||
static const std::string g_error("");
|
||||
static const etk::String g_error("");
|
||||
return g_error;
|
||||
}
|
||||
return it->second;
|
||||
};
|
||||
|
||||
void setLanguageDefault(const std::string& _lang) {
|
||||
void setLanguageDefault(const etk::String& _lang) {
|
||||
if (m_languageDefault == _lang) {
|
||||
return;
|
||||
}
|
||||
@ -61,11 +61,11 @@ class LocalInstanceTranslation {
|
||||
m_translate.clear();
|
||||
};
|
||||
|
||||
const std::string& getLanguageDefault() {
|
||||
const etk::String& getLanguageDefault() {
|
||||
return m_languageDefault;
|
||||
};
|
||||
|
||||
void setLanguage(const std::string& _lang) {
|
||||
void setLanguage(const etk::String& _lang) {
|
||||
if (m_language == _lang) {
|
||||
return;
|
||||
}
|
||||
@ -97,29 +97,29 @@ class LocalInstanceTranslation {
|
||||
}
|
||||
};
|
||||
|
||||
const std::string& getLanguage() {
|
||||
const etk::String& getLanguage() {
|
||||
return m_language;
|
||||
};
|
||||
|
||||
std::string get(const std::string& _instance) {
|
||||
etk::String get(const etk::String& _instance) {
|
||||
loadTranslation();
|
||||
EWOL_VERBOSE("Request translate: '" << _instance << "'");
|
||||
// find all iterance of '_T{' ... '}'
|
||||
std::string out;
|
||||
etk::String out;
|
||||
auto itOld = _instance.begin();
|
||||
size_t pos = _instance.find("_T{");
|
||||
while (pos != std::string::npos) {
|
||||
while (pos != etk::String::npos) {
|
||||
out.append(itOld, _instance.begin() + pos);
|
||||
auto it = _instance.begin() + pos + 3;
|
||||
itOld = it;
|
||||
pos = _instance.find("}", pos);
|
||||
if (pos == std::string::npos) {
|
||||
if (pos == etk::String::npos) {
|
||||
EWOL_WARNING("missing end translation '}' in: '" << _instance << "'");
|
||||
it = _instance.end();
|
||||
} else {
|
||||
it = _instance.begin() + pos;
|
||||
}
|
||||
std::string basicEmptyValue = std::string(itOld, it);
|
||||
etk::String basicEmptyValue = etk::String(itOld, it);
|
||||
auto itTranslate = m_translate.find(basicEmptyValue);
|
||||
if (itTranslate == m_translate.end()) {
|
||||
EWOL_DEBUG("Can not find tranlation : '" << _instance << "'");
|
||||
@ -149,17 +149,17 @@ class LocalInstanceTranslation {
|
||||
// start parse language for Major:
|
||||
auto itMajor = m_listPath.find(m_major);
|
||||
if (itMajor != m_listPath.end()) {
|
||||
std::string filename(itMajor->second + "/" + m_language + ".json");
|
||||
etk::String filename(itMajor->second + "/" + m_language + ".json");
|
||||
ejson::Document doc;
|
||||
doc.load(filename);
|
||||
for (auto element : doc.getKeys()) {
|
||||
std::string val = doc[element].toString().get();
|
||||
etk::String val = doc[element].toString().get();
|
||||
m_translate.insert(make_pair(element, val));
|
||||
}
|
||||
filename = itMajor->second + "/" + m_languageDefault + ".json";
|
||||
doc.load(filename);
|
||||
for (auto element : doc.getKeys()) {
|
||||
std::string val = doc[element].toString().get();
|
||||
etk::String val = doc[element].toString().get();
|
||||
auto itTrans = m_translate.find(element);
|
||||
if (itTrans == m_translate.end()) {
|
||||
m_translate.insert(make_pair(element, val));
|
||||
@ -171,14 +171,14 @@ class LocalInstanceTranslation {
|
||||
if (it.first == m_major) {
|
||||
continue;
|
||||
}
|
||||
std::string filename(it.second + "/" + m_languageDefault + ".json");
|
||||
etk::String filename(it.second + "/" + m_languageDefault + ".json");
|
||||
if (etk::FSNodeExist(filename) == false) {
|
||||
continue;
|
||||
}
|
||||
ejson::Document doc;
|
||||
doc.load(filename);
|
||||
for (auto element : doc.getKeys()) {
|
||||
std::string val = doc[element].toString().get();
|
||||
etk::String val = doc[element].toString().get();
|
||||
auto itTrans = m_translate.find(element);
|
||||
if (itTrans == m_translate.end()) {
|
||||
m_translate.insert(make_pair(element, val));
|
||||
@ -190,14 +190,14 @@ class LocalInstanceTranslation {
|
||||
if (it.first == m_major) {
|
||||
continue;
|
||||
}
|
||||
std::string filename(it.second + "/" + m_languageDefault + ".json");
|
||||
etk::String filename(it.second + "/" + m_languageDefault + ".json");
|
||||
if (etk::FSNodeExist(filename) == false) {
|
||||
continue;
|
||||
}
|
||||
ejson::Document doc;
|
||||
doc.load(filename);
|
||||
for (auto element : doc.getKeys()) {
|
||||
std::string val = doc[element].toString().get();
|
||||
etk::String val = doc[element].toString().get();
|
||||
auto itTrans = m_translate.find(element);
|
||||
if (itTrans == m_translate.end()) {
|
||||
m_translate.insert(make_pair(element, val));
|
||||
@ -213,35 +213,35 @@ static LocalInstanceTranslation& getInstanceTranslation() {
|
||||
return g_val;
|
||||
}
|
||||
|
||||
void etranslate::addPath(const std::string& _lib, const std::string& _path, bool _major) {
|
||||
void etranslate::addPath(const etk::String& _lib, const etk::String& _path, bool _major) {
|
||||
getInstanceTranslation().addPath(_lib, _path, _major);
|
||||
}
|
||||
|
||||
const std::string& etranslate::getPaths(const std::string& _lib) {
|
||||
const etk::String& etranslate::getPaths(const etk::String& _lib) {
|
||||
return getInstanceTranslation().getPaths(_lib);
|
||||
}
|
||||
|
||||
void etranslate::setLanguageDefault(const std::string& _lang) {
|
||||
void etranslate::setLanguageDefault(const etk::String& _lang) {
|
||||
getInstanceTranslation().setLanguageDefault(_lang);
|
||||
}
|
||||
|
||||
const std::string& etranslate::getLanguageDefault() {
|
||||
const etk::String& etranslate::getLanguageDefault() {
|
||||
return getInstanceTranslation().getLanguageDefault();
|
||||
}
|
||||
|
||||
void etranslate::setLanguage(const std::string& _lang) {
|
||||
void etranslate::setLanguage(const etk::String& _lang) {
|
||||
getInstanceTranslation().setLanguage(_lang);
|
||||
}
|
||||
|
||||
const std::string& etranslate::getLanguage() {
|
||||
const etk::String& etranslate::getLanguage() {
|
||||
return getInstanceTranslation().getLanguage();
|
||||
}
|
||||
|
||||
void etranslate::autoDetectLanguage() {
|
||||
EWOL_VERBOSE("Auto-detect language of system");
|
||||
std::string nonameLocalName;
|
||||
std::string userLocalName;
|
||||
std::string globalLocalName;
|
||||
etk::String nonameLocalName;
|
||||
etk::String userLocalName;
|
||||
etk::String globalLocalName;
|
||||
try {
|
||||
nonameLocalName = std::locale(std::locale(), new std::ctype<char>).name();
|
||||
userLocalName = std::locale("").name();
|
||||
@ -255,7 +255,7 @@ void etranslate::autoDetectLanguage() {
|
||||
userLocalName = "EN";
|
||||
globalLocalName = "EN";
|
||||
}
|
||||
std::string lang = nonameLocalName;
|
||||
etk::String lang = nonameLocalName;
|
||||
if ( lang == "*"
|
||||
|| lang == "") {
|
||||
lang = userLocalName;
|
||||
@ -269,7 +269,7 @@ void etranslate::autoDetectLanguage() {
|
||||
|| lang.size() < 2) {
|
||||
lang = "EN";
|
||||
}
|
||||
lang = std::string(lang.begin(), lang.begin()+2);
|
||||
lang = etk::String(lang.begin(), lang.begin()+2);
|
||||
lang = etk::toupper(lang);
|
||||
EWOL_INFO("Select Language : '" << lang << "'");
|
||||
getInstanceTranslation().setLanguage(lang);
|
||||
@ -280,7 +280,7 @@ void etranslate::autoDetectLanguage() {
|
||||
if (s == nullptr || strlen(s) < 2) {
|
||||
EWOL_INFO("Try to determine system language FAIL ...");
|
||||
} else {
|
||||
std::string lang;
|
||||
etk::String lang;
|
||||
lang += s[0];
|
||||
lang += s[1];
|
||||
lang = etk::toupper(lang);
|
||||
@ -292,7 +292,7 @@ void etranslate::autoDetectLanguage() {
|
||||
#endif
|
||||
}
|
||||
|
||||
std::string etranslate::get(const std::string& _instance) {
|
||||
etk::String etranslate::get(const etk::String& _instance) {
|
||||
return getInstanceTranslation().get(_instance);
|
||||
}
|
||||
|
||||
|
@ -30,33 +30,33 @@ namespace ewol {
|
||||
* @param[in] _path ETK generic path (DATA:... or /xxx)
|
||||
* @param[in] _major This path is the major path (The last loaded, the one which overload all)
|
||||
*/
|
||||
void addPath(const std::string& _lib, const std::string& _path, bool _major = false);
|
||||
void addPath(const etk::String& _lib, const etk::String& _path, bool _major = false);
|
||||
/**
|
||||
* @brief Get the current paths of the library
|
||||
* @param[in] _lib Library name that the path depend
|
||||
* @return Path name.
|
||||
*/
|
||||
const std::string& getPaths(const std::string& _lib);
|
||||
const etk::String& getPaths(const etk::String& _lib);
|
||||
/**
|
||||
* @brief Set the default language to load data (the default language might contain all internal data for the basic application)
|
||||
* @param[in] _lang Language to load : ("EN" for english, "FR" for french, "DE" for German, "SP" for spanish ...)
|
||||
*/
|
||||
void setLanguageDefault(const std::string& _lang);
|
||||
void setLanguageDefault(const etk::String& _lang);
|
||||
/**
|
||||
* @brief Get the current language selected
|
||||
* @return The 2/3 char defining the language
|
||||
*/
|
||||
const std::string& getLanguageDefault();
|
||||
const etk::String& getLanguageDefault();
|
||||
/**
|
||||
* @brief Set the language to load data. when no data availlable, we get the default language.
|
||||
* @param[in] _lang Language to load : ("EN" for english, "FR" for french, "DE" for German, "SP" for spanish ...)
|
||||
*/
|
||||
void setLanguage(const std::string& _lang);
|
||||
void setLanguage(const etk::String& _lang);
|
||||
/**
|
||||
* @brief Get the current language loaded
|
||||
* @return The 2/3 char defining the language
|
||||
*/
|
||||
const std::string& getLanguage();
|
||||
const etk::String& getLanguage();
|
||||
/**
|
||||
* @brief Automatic detection of the system language
|
||||
*/
|
||||
@ -66,7 +66,7 @@ namespace ewol {
|
||||
* @param[in] _instance Text to translate.
|
||||
* @return The tranlated text.
|
||||
*/
|
||||
std::string get(const std::string& _instance);
|
||||
etk::String get(const etk::String& _instance);
|
||||
};
|
||||
};
|
||||
// Here we define a simple macro to Translate all string simply:
|
||||
|
@ -41,7 +41,7 @@ namespace ewol {
|
||||
esignal::Signal<> signalLeave;
|
||||
esignal::Signal<bool> signalValue;
|
||||
public: // propertie list
|
||||
eproperty::Value<std::string> propertyShape; //!< shaper name property
|
||||
eproperty::Value<etk::String> propertyShape; //!< shaper name property
|
||||
eproperty::Value<bool> propertyValue; //!< Current state of the button.
|
||||
eproperty::List<enum buttonLock> propertyLock; //!< Current lock state of the button.
|
||||
eproperty::Value<bool> propertyToggleMode; //!< The button is able to toggle.
|
||||
|
@ -44,7 +44,7 @@ ewol::widget::ButtonColor::~ButtonColor() {
|
||||
|
||||
void ewol::widget::ButtonColor::calculateMinMaxSize() {
|
||||
ewol::Padding padding = m_shaper.getPadding();
|
||||
std::string label = propertyValue.getString();
|
||||
etk::String label = propertyValue.getString();
|
||||
vec3 minSize = m_text.calculateSize(label);
|
||||
m_minSize.setX(padding.x()*2 + minSize.x() + 7);
|
||||
m_minSize.setY(padding.y()*2 + minSize.y() );
|
||||
@ -69,7 +69,7 @@ void ewol::widget::ButtonColor::onRegenerateDisplay() {
|
||||
|
||||
ewol::Padding padding = m_shaper.getPadding();
|
||||
|
||||
std::string label = propertyValue.getString();
|
||||
etk::String label = propertyValue.getString();
|
||||
|
||||
ivec2 localSize = m_minSize;
|
||||
|
||||
|
@ -25,7 +25,7 @@ namespace ewol {
|
||||
esignal::Signal<etk::Color<>> signalChange;
|
||||
public: // properties
|
||||
eproperty::Value<etk::Color<>> propertyValue; //!< Current color.
|
||||
eproperty::Value<std::string> propertyShape; //!< Current color.
|
||||
eproperty::Value<etk::String> propertyShape; //!< Current color.
|
||||
private:
|
||||
ewol::compositing::Shaper m_shaper; //!< Compositing theme.
|
||||
ewol::compositing::Text m_text; //!< Compositing Test display.
|
||||
|
@ -27,7 +27,7 @@ namespace ewol {
|
||||
esignal::Signal<bool> signalValue;
|
||||
public: // propertie list
|
||||
eproperty::Value<bool> propertyValue; //!< Current state of the checkbox.
|
||||
eproperty::Value<std::string> propertyShape; //!< shape of the widget
|
||||
eproperty::Value<etk::String> propertyShape; //!< shape of the widget
|
||||
private:
|
||||
ewol::compositing::Shaper m_shaper; //!< Compositing theme.
|
||||
bool m_mouseHover; //!< Flag to know where the mouse is (inside the displayed widget (if not fill)).
|
||||
|
@ -159,8 +159,8 @@ bool ewol::widget::ColorBar::onEventInput(const ewol::event::Input& _event) {
|
||||
vec2 relativePos = relativePosition(_event.getPos());
|
||||
//EWOL_DEBUG("Event on BT ...");
|
||||
if (1 == _event.getId()) {
|
||||
relativePos.setValue( std::avg(0.0f, m_size.x(),relativePos.x()),
|
||||
std::avg(0.0f, m_size.y(),relativePos.y()) );
|
||||
relativePos.setValue( etk::avg(0.0f, m_size.x(),relativePos.x()),
|
||||
etk::avg(0.0f, m_size.y(),relativePos.y()) );
|
||||
if( gale::key::status::pressSingle == _event.getStatus()
|
||||
|| gale::key::status::move == _event.getStatus()) {
|
||||
// nothing to do ...
|
||||
|
@ -18,21 +18,21 @@ ewol::widget::Composer::Composer() :
|
||||
// nothing to do ...
|
||||
}
|
||||
|
||||
ewol::WidgetShared ewol::widget::composerGenerateFile(const std::string& _fileName, uint64_t _id) {
|
||||
std::string tmpData = etk::FSNodeReadAllData(_fileName);
|
||||
ewol::WidgetShared ewol::widget::composerGenerateFile(const etk::String& _fileName, uint64_t _id) {
|
||||
etk::String tmpData = etk::FSNodeReadAllData(_fileName);
|
||||
return ewol::widget::composerGenerateString(tmpData, _id);
|
||||
}
|
||||
|
||||
ewol::WidgetShared ewol::widget::composerGenerateString(const std::string& _data, uint64_t _id) {
|
||||
ewol::WidgetShared ewol::widget::composerGenerateString(const etk::String& _data, uint64_t _id) {
|
||||
ewol::widget::Manager& widgetManager = ewol::getContext().getWidgetManager();
|
||||
if (_data == "") {
|
||||
return nullptr;
|
||||
}
|
||||
exml::Document doc;
|
||||
std::string tmpData = _data;
|
||||
etk::String tmpData = _data;
|
||||
// replace all elements:
|
||||
if (_id != 0) {
|
||||
tmpData = etk::replace(tmpData, "{ID}", etk::to_string(_id));
|
||||
tmpData = etk::replace(tmpData, "{ID}", etk::toString(_id));
|
||||
}
|
||||
if (doc.parse(tmpData) == false) {
|
||||
EWOL_ERROR(" can not load file XML string...");
|
||||
@ -51,7 +51,7 @@ ewol::WidgetShared ewol::widget::composerGenerateString(const std::string& _data
|
||||
EWOL_ERROR(" (l ?) No node in the XML file/string. {2}");
|
||||
return nullptr;
|
||||
}
|
||||
std::string widgetName = pNode.getValue();
|
||||
etk::String widgetName = pNode.getValue();
|
||||
if (widgetManager.exist(widgetName) == false) {
|
||||
EWOL_ERROR("(l " << pNode.getPos() << ") Unknown basic node='" << widgetName << "' not in : [" << widgetManager.list() << "]" );
|
||||
return nullptr;
|
||||
@ -72,17 +72,17 @@ ewol::widget::Composer::~Composer() {
|
||||
|
||||
}
|
||||
|
||||
bool ewol::widget::Composer::loadFromFile(const std::string& _fileName, uint64_t _id) {
|
||||
std::string tmpData = etk::FSNodeReadAllData(_fileName);
|
||||
bool ewol::widget::Composer::loadFromFile(const etk::String& _fileName, uint64_t _id) {
|
||||
etk::String tmpData = etk::FSNodeReadAllData(_fileName);
|
||||
return loadFromString(tmpData, _id);
|
||||
}
|
||||
|
||||
bool ewol::widget::Composer::loadFromString(const std::string& _composerXmlString, uint64_t _id) {
|
||||
bool ewol::widget::Composer::loadFromString(const etk::String& _composerXmlString, uint64_t _id) {
|
||||
exml::Document doc;
|
||||
std::string tmpData = _composerXmlString;
|
||||
etk::String tmpData = _composerXmlString;
|
||||
// replace all elements:
|
||||
if (_id != 0) {
|
||||
tmpData = etk::replace(tmpData, "{ID}", etk::to_string(_id));
|
||||
tmpData = etk::replace(tmpData, "{ID}", etk::toString(_id));
|
||||
}
|
||||
if (doc.parse(tmpData) == false) {
|
||||
EWOL_ERROR(" can not load file XML string...");
|
||||
|
@ -21,7 +21,7 @@ namespace ewol {
|
||||
class Composer : public ewol::widget::Container {
|
||||
public:
|
||||
eproperty::Value<bool> propertyRemoveIfUnderRemove; //!< Remove the composer if sub element request a remove
|
||||
eproperty::Value<std::string> propertySubFile; //!< If loading a sub-file, we must do it here ==> permit to con,figure it in the xml and not have wrong display
|
||||
eproperty::Value<etk::String> propertySubFile; //!< If loading a sub-file, we must do it here ==> permit to con,figure it in the xml and not have wrong display
|
||||
protected:
|
||||
/**
|
||||
* @brief Constructor
|
||||
@ -40,7 +40,7 @@ namespace ewol {
|
||||
* @return true == > all done OK
|
||||
* @return false == > some error occured
|
||||
*/
|
||||
bool loadFromFile(const std::string& _fileName, uint64_t _id=0);
|
||||
bool loadFromFile(const etk::String& _fileName, uint64_t _id=0);
|
||||
/**
|
||||
* @brief load a composition with a file
|
||||
* @param[in] _composerXmlString xml to parse directly
|
||||
@ -48,7 +48,7 @@ namespace ewol {
|
||||
* @return true == > all done OK
|
||||
* @return false == > some error occured
|
||||
*/
|
||||
bool loadFromString(const std::string& _composerXmlString, uint64_t _id=0);
|
||||
bool loadFromString(const etk::String& _composerXmlString, uint64_t _id=0);
|
||||
private:
|
||||
void requestDestroyFromChild(const ewol::ObjectShared& _child) override;
|
||||
public:
|
||||
@ -56,7 +56,7 @@ namespace ewol {
|
||||
protected:
|
||||
virtual void onChangePropertySubFile();
|
||||
};
|
||||
ewol::WidgetShared composerGenerateString(const std::string& _data = "", uint64_t _id=0);
|
||||
ewol::WidgetShared composerGenerateFile(const std::string& _data = "", uint64_t _id=0);
|
||||
ewol::WidgetShared composerGenerateString(const etk::String& _data = "", uint64_t _id=0);
|
||||
ewol::WidgetShared composerGenerateFile(const etk::String& _data = "", uint64_t _id=0);
|
||||
};
|
||||
};
|
||||
|
@ -67,7 +67,7 @@ void ewol::widget::Container::subWidgetUnLink() {
|
||||
m_subWidget.reset();
|
||||
}
|
||||
|
||||
ewol::ObjectShared ewol::widget::Container::getSubObjectNamed(const std::string& _objectName) {
|
||||
ewol::ObjectShared ewol::widget::Container::getSubObjectNamed(const etk::String& _objectName) {
|
||||
ewol::ObjectShared tmpObject = ewol::Widget::getSubObjectNamed(_objectName);
|
||||
if (tmpObject != nullptr) {
|
||||
return tmpObject;
|
||||
@ -153,7 +153,7 @@ bool ewol::widget::Container::loadXML(const exml::Element& _node) {
|
||||
// trash here all that is not element
|
||||
continue;
|
||||
}
|
||||
std::string widgetName = pNode.getValue();
|
||||
etk::String widgetName = pNode.getValue();
|
||||
EWOL_VERBOSE("[" << getId() << "] t=" << getObjectType() << " Load node name : '" << widgetName << "'");
|
||||
if (getWidgetManager().exist(widgetName) == false) {
|
||||
EWOL_ERROR("(l " << pNode.getPos() << ") Unknown basic node='" << widgetName << "' not in : [" << getWidgetManager().list() << "]" );
|
||||
|
@ -63,7 +63,7 @@ namespace ewol {
|
||||
void onChangeSize() override;
|
||||
void calculateMinMaxSize() override;
|
||||
ewol::WidgetShared getWidgetAtPos(const vec2& _pos) override;
|
||||
ewol::ObjectShared getSubObjectNamed(const std::string& _objectName) override;
|
||||
ewol::ObjectShared getSubObjectNamed(const etk::String& _objectName) override;
|
||||
bool loadXML(const exml::Element& _node) override;
|
||||
void setOffset(const vec2& _newVal) override;
|
||||
void requestDestroyFromChild(const ewol::ObjectShared& _child) override;
|
||||
|
@ -72,7 +72,7 @@ void ewol::widget::Container2::subWidgetUnLink(int32_t _idWidget) {
|
||||
m_subWidget[_idWidget].reset();
|
||||
}
|
||||
|
||||
ewol::ObjectShared ewol::widget::Container2::getSubObjectNamed(const std::string& _widgetName) {
|
||||
ewol::ObjectShared ewol::widget::Container2::getSubObjectNamed(const etk::String& _widgetName) {
|
||||
ewol::ObjectShared tmpObject = ewol::Widget::getSubObjectNamed(_widgetName);
|
||||
if (tmpObject != nullptr) {
|
||||
return tmpObject;
|
||||
@ -186,7 +186,7 @@ bool ewol::widget::Container2::loadXML(const exml::Element& _node) {
|
||||
// trash here all that is not element
|
||||
continue;
|
||||
}
|
||||
std::string widgetName = pNode.getValue();
|
||||
etk::String widgetName = pNode.getValue();
|
||||
if (getWidgetManager().exist(widgetName) == false) {
|
||||
EWOL_ERROR("(l " << pNode.getPos() << ") Unknown basic node='" << widgetName << "' not in: [" << getWidgetManager().list() << "]" );
|
||||
continue;
|
||||
|
@ -164,7 +164,7 @@ namespace ewol {
|
||||
void calculateMinMaxSize() override {
|
||||
calculateMinMaxSizePadded();
|
||||
}
|
||||
ewol::ObjectShared getSubObjectNamed(const std::string& _objectName) override;
|
||||
ewol::ObjectShared getSubObjectNamed(const etk::String& _objectName) override;
|
||||
bool loadXML(const exml::Element& _node) override;
|
||||
void setOffset(const vec2& _newVal) override;
|
||||
void requestDestroyFromChild(const ewol::ObjectShared& _child) override;
|
||||
|
@ -74,7 +74,7 @@ int32_t ewol::widget::ContainerN::subWidgetAdd(ewol::WidgetShared _newWidget) {
|
||||
return -1;
|
||||
}
|
||||
_newWidget->setParent(sharedFromThis());
|
||||
m_subWidget.push_back(_newWidget);
|
||||
m_subWidget.pushBack(_newWidget);
|
||||
markToRedraw();
|
||||
requestUpdateSize();
|
||||
// added at the last eelement :
|
||||
@ -148,7 +148,7 @@ void ewol::widget::ContainerN::subWidgetRemoveAllDelayed() {
|
||||
subWidgetRemoveAll();
|
||||
}
|
||||
|
||||
ewol::ObjectShared ewol::widget::ContainerN::getSubObjectNamed(const std::string& _objectName) {
|
||||
ewol::ObjectShared ewol::widget::ContainerN::getSubObjectNamed(const etk::String& _objectName) {
|
||||
ewol::ObjectShared tmpObject = ewol::Widget::getSubObjectNamed(_objectName);
|
||||
if (tmpObject != nullptr) {
|
||||
return tmpObject;
|
||||
@ -209,8 +209,8 @@ void ewol::widget::ContainerN::calculateMinMaxSize() {
|
||||
m_subExpend.setY(true);
|
||||
}
|
||||
vec2 tmpSize = it->getCalculateMinSize();
|
||||
m_minSize.setValue( std::max(tmpSize.x(), m_minSize.x()),
|
||||
std::max(tmpSize.y(), m_minSize.y()) );
|
||||
m_minSize.setValue( etk::max(tmpSize.x(), m_minSize.x()),
|
||||
etk::max(tmpSize.y(), m_minSize.y()) );
|
||||
}
|
||||
}
|
||||
//EWOL_ERROR("[" << getId() << "] {" << getObjectType() << "} Result min size : " << m_minSize);
|
||||
@ -257,7 +257,7 @@ bool ewol::widget::ContainerN::loadXML(const exml::Element& _node) {
|
||||
// remove previous element :
|
||||
subWidgetRemoveAll();
|
||||
|
||||
std::string tmpAttributeValue = _node.attributes["lock"];
|
||||
etk::String tmpAttributeValue = _node.attributes["lock"];
|
||||
if (tmpAttributeValue.size()!=0) {
|
||||
propertyLockExpand.set(tmpAttributeValue);
|
||||
}
|
||||
@ -273,7 +273,7 @@ bool ewol::widget::ContainerN::loadXML(const exml::Element& _node) {
|
||||
// trash here all that is not element
|
||||
continue;
|
||||
}
|
||||
std::string widgetName = pNode.getValue();
|
||||
etk::String widgetName = pNode.getValue();
|
||||
EWOL_VERBOSE(" t=" << getObjectType() << " Load node name : '" << widgetName << "'");
|
||||
if (getWidgetManager().exist(widgetName) == false) {
|
||||
EWOL_ERROR("[" << getId() << "] {" << getObjectType() << "} (l " << pNode.getPos() << ") Unknown basic node='" << widgetName << "' not in : [" << getWidgetManager().list() << "]" );
|
||||
|
@ -94,7 +94,7 @@ namespace ewol {
|
||||
void onChangeSize() override;
|
||||
void calculateMinMaxSize() override;
|
||||
ewol::WidgetShared getWidgetAtPos(const vec2& _pos) override;
|
||||
ewol::ObjectShared getSubObjectNamed(const std::string& _objectName) override;
|
||||
ewol::ObjectShared getSubObjectNamed(const etk::String& _objectName) override;
|
||||
bool loadXML(const exml::Element& _node) override;
|
||||
void setOffset(const vec2& _newVal) override;
|
||||
void requestDestroyFromChild(const ewol::ObjectShared& _child) override;
|
||||
|
@ -70,8 +70,8 @@ void ewol::widget::ContextMenu::onChangeSize() {
|
||||
}
|
||||
int32_t minWidth = 100;
|
||||
int32_t maxWidth = 300;
|
||||
subWidgetSize.setX((int32_t)std::max(minWidth, (int32_t)subWidgetSize.x()));
|
||||
subWidgetSize.setX((int32_t)std::min(maxWidth, (int32_t)subWidgetSize.x()));
|
||||
subWidgetSize.setX((int32_t)etk::max(minWidth, (int32_t)subWidgetSize.x()));
|
||||
subWidgetSize.setX((int32_t)etk::min(maxWidth, (int32_t)subWidgetSize.x()));
|
||||
subWidgetSize.setY((int32_t)subWidgetSize.y());
|
||||
|
||||
// set config to the Sub-widget
|
||||
@ -92,9 +92,9 @@ void ewol::widget::ContextMenu::onChangeSize() {
|
||||
break;
|
||||
}
|
||||
// set the widget position at the border of the screen
|
||||
subWidgetOrigin.setX( (int32_t)( std::max(0, (int32_t)(subWidgetOrigin.x()-padding.x()))
|
||||
subWidgetOrigin.setX( (int32_t)( etk::max(0, (int32_t)(subWidgetOrigin.x()-padding.x()))
|
||||
+ padding.x()) );
|
||||
subWidgetOrigin.setY( (int32_t)( std::max(0, (int32_t)(subWidgetOrigin.y()-padding.y()))
|
||||
subWidgetOrigin.setY( (int32_t)( etk::max(0, (int32_t)(subWidgetOrigin.y()-padding.y()))
|
||||
+ padding.y()) );
|
||||
switch (propertyArrawBorder.get()) {
|
||||
default:
|
||||
|
@ -31,7 +31,7 @@ namespace ewol {
|
||||
markNone
|
||||
};
|
||||
public: // properties
|
||||
eproperty::Value<std::string> propertyShape; //!< shape of the widget.
|
||||
eproperty::Value<etk::String> propertyShape; //!< shape of the widget.
|
||||
eproperty::Value<vec2> propertyArrowPos;
|
||||
eproperty::List<enum markPosition> propertyArrawBorder;
|
||||
protected:
|
||||
|
@ -78,7 +78,7 @@ ewol::widget::Entry::~Entry() {
|
||||
|
||||
}
|
||||
|
||||
void ewol::widget::Entry::onCallbackShortCut(const std::string& _value) {
|
||||
void ewol::widget::Entry::onCallbackShortCut(const etk::String& _value) {
|
||||
if (_value == "clean") {
|
||||
onCallbackEntryClean();
|
||||
} else if (_value == "cut") {
|
||||
@ -161,7 +161,7 @@ void ewol::widget::Entry::onRegenerateDisplay() {
|
||||
} else {
|
||||
m_text.setCursorPos(m_displayCursorPos);
|
||||
}
|
||||
std::string valueToDisplay = *propertyValue;
|
||||
etk::String valueToDisplay = *propertyValue;
|
||||
if (*propertyPassword == true) {
|
||||
for (auto &it: valueToDisplay) {
|
||||
it = '*';
|
||||
@ -188,13 +188,13 @@ void ewol::widget::Entry::updateCursorPosition(const vec2& _pos, bool _selection
|
||||
vec2 relPos = relativePosition(_pos);
|
||||
relPos.setX(relPos.x()-m_displayStartPosition - padding.xLeft());
|
||||
// try to find the new cursor position :
|
||||
std::string tmpDisplay = std::string(propertyValue, 0, m_displayStartPosition);
|
||||
etk::String tmpDisplay = etk::String(propertyValue, 0, m_displayStartPosition);
|
||||
int32_t displayHidenSize = m_text.calculateSize(tmpDisplay).x();
|
||||
//EWOL_DEBUG("hidenSize : " << displayHidenSize);
|
||||
int32_t newCursorPosition = -1;
|
||||
int32_t tmpTextOriginX = padding.xLeft();
|
||||
for (size_t iii=0; iii<propertyValue->size(); iii++) {
|
||||
tmpDisplay = std::string(propertyValue, 0, iii);
|
||||
tmpDisplay = etk::String(propertyValue, 0, iii);
|
||||
int32_t tmpWidth = m_text.calculateSize(tmpDisplay).x() - displayHidenSize;
|
||||
if (tmpWidth >= relPos.x()-tmpTextOriginX) {
|
||||
newCursorPosition = iii;
|
||||
@ -250,7 +250,7 @@ void ewol::widget::Entry::copySelectionToClipBoard(enum gale::context::clipBoard
|
||||
pos1 = m_displayCursorPos;
|
||||
}
|
||||
// Copy
|
||||
std::string tmpData = std::string(propertyValue, pos1, pos2);
|
||||
etk::String tmpData = etk::String(propertyValue, pos1, pos2);
|
||||
gale::context::clipBoard::set(_clipboardID, tmpData);
|
||||
}
|
||||
|
||||
@ -362,7 +362,7 @@ bool ewol::widget::Entry::onEventEntry(const ewol::event::Entry& _event) {
|
||||
// SUPPR :
|
||||
if (propertyValue->size() > 0 && m_displayCursorPos < (int64_t)propertyValue->size()) {
|
||||
propertyValue.getDirect().erase(m_displayCursorPos, 1);
|
||||
m_displayCursorPos = std::max(m_displayCursorPos, 0);
|
||||
m_displayCursorPos = etk::max(m_displayCursorPos, 0);
|
||||
m_displayCursorPosSelection = m_displayCursorPos;
|
||||
}
|
||||
} else if (_event.getChar() == 0x08) {
|
||||
@ -370,14 +370,14 @@ bool ewol::widget::Entry::onEventEntry(const ewol::event::Entry& _event) {
|
||||
if (propertyValue->size() > 0 && m_displayCursorPos != 0) {
|
||||
propertyValue.getDirect().erase(m_displayCursorPos-1, 1);
|
||||
m_displayCursorPos--;
|
||||
m_displayCursorPos = std::max(m_displayCursorPos, 0);
|
||||
m_displayCursorPos = etk::max(m_displayCursorPos, 0);
|
||||
m_displayCursorPosSelection = m_displayCursorPos;
|
||||
}
|
||||
} else if(_event.getChar() >= 20) {
|
||||
if ((int64_t)propertyValue->size() > propertyMaxCharacter) {
|
||||
EWOL_INFO("Reject data for entry : '" << _event.getChar() << "'");
|
||||
} else {
|
||||
std::string newData = propertyValue;
|
||||
etk::String newData = propertyValue;
|
||||
newData.insert(newData.begin()+m_displayCursorPos, _event.getChar());
|
||||
setInternalValue(newData);
|
||||
if (propertyValue.get() == newData) {
|
||||
@ -409,7 +409,7 @@ bool ewol::widget::Entry::onEventEntry(const ewol::event::Entry& _event) {
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
m_displayCursorPos = std::avg(0, m_displayCursorPos, (int32_t)propertyValue->size());
|
||||
m_displayCursorPos = etk::avg(0, m_displayCursorPos, (int32_t)propertyValue->size());
|
||||
m_displayCursorPosSelection = m_displayCursorPos;
|
||||
markToRedraw();
|
||||
return true;
|
||||
@ -418,8 +418,8 @@ bool ewol::widget::Entry::onEventEntry(const ewol::event::Entry& _event) {
|
||||
return false;
|
||||
}
|
||||
|
||||
void ewol::widget::Entry::setInternalValue(const std::string& _newData) {
|
||||
std::string previous = propertyValue;
|
||||
void ewol::widget::Entry::setInternalValue(const etk::String& _newData) {
|
||||
etk::String previous = propertyValue;
|
||||
// check the RegExp :
|
||||
if (_newData.size()>0) {
|
||||
std::smatch resultMatch;
|
||||
@ -445,10 +445,10 @@ void ewol::widget::Entry::onEventClipboard(enum gale::context::clipBoard::clipbo
|
||||
// remove curent selected data ...
|
||||
removeSelected();
|
||||
// get current selection / Copy :
|
||||
std::string tmpData = get(_clipboardID);
|
||||
etk::String tmpData = get(_clipboardID);
|
||||
// add it on the current display :
|
||||
if (tmpData.size() != 0) {
|
||||
std::string newData = propertyValue;
|
||||
etk::String newData = propertyValue;
|
||||
newData.insert(m_displayCursorPos, &tmpData[0]);
|
||||
setInternalValue(newData);
|
||||
if (propertyValue.get() == newData) {
|
||||
@ -518,17 +518,17 @@ void ewol::widget::Entry::updateTextPosition() {
|
||||
m_displayStartPosition = 0;
|
||||
} else {
|
||||
// all can not be set :
|
||||
std::string tmpDisplay = std::string(propertyValue, 0, m_displayCursorPos);
|
||||
etk::String tmpDisplay = etk::String(propertyValue, 0, m_displayCursorPos);
|
||||
int32_t pixelCursorPos = m_text.calculateSize(tmpDisplay).x();
|
||||
// check if the Cussor is visible at 10px nearest the border :
|
||||
int32_t tmp1 = pixelCursorPos+m_displayStartPosition;
|
||||
EWOL_DEBUG("cursorPos=" << pixelCursorPos << "px maxSize=" << tmpUserSize << "px tmp1=" << tmp1);
|
||||
if (tmp1<10) {
|
||||
// set the cursor on le left
|
||||
m_displayStartPosition = std::min(-pixelCursorPos+10, 0);
|
||||
m_displayStartPosition = etk::min(-pixelCursorPos+10, 0);
|
||||
} else if (tmp1>tmpUserSize-10) {
|
||||
// set the cursor of the Right
|
||||
m_displayStartPosition = std::min(-pixelCursorPos + tmpUserSize - 10, 0);
|
||||
m_displayStartPosition = etk::min(-pixelCursorPos + tmpUserSize - 10, 0);
|
||||
}
|
||||
// else : the cursor is inside the display
|
||||
//m_displayStartPosition = -totalWidth + tmpUserSize;
|
||||
@ -576,10 +576,10 @@ void ewol::widget::Entry::onChangePropertyShaper() {
|
||||
}
|
||||
|
||||
void ewol::widget::Entry::onChangePropertyValue() {
|
||||
std::string newData = propertyValue.get();
|
||||
etk::String newData = propertyValue.get();
|
||||
if ((int64_t)newData.size() > propertyMaxCharacter) {
|
||||
newData = std::string(newData, 0, propertyMaxCharacter);
|
||||
EWOL_DEBUG("Limit entry set of data... " << std::string(newData, propertyMaxCharacter));
|
||||
newData = etk::String(newData, 0, propertyMaxCharacter);
|
||||
EWOL_DEBUG("Limit entry set of data... " << etk::String(newData, propertyMaxCharacter));
|
||||
}
|
||||
// set the value with the check of the RegExp ...
|
||||
setInternalValue(newData);
|
||||
|
@ -34,15 +34,15 @@ namespace ewol {
|
||||
class Entry : public ewol::Widget {
|
||||
public: // Event list
|
||||
esignal::Signal<> signalClick; //!< bang on click the entry box
|
||||
esignal::Signal<std::string> signalEnter; //!< Enter key is pressed
|
||||
esignal::Signal<std::string> signalModify; //!< data change
|
||||
esignal::Signal<etk::String> signalEnter; //!< Enter key is pressed
|
||||
esignal::Signal<etk::String> signalModify; //!< data change
|
||||
public: // propertie list
|
||||
eproperty::Value<bool> propertyPassword; //!< Disable display of the content of the entry
|
||||
eproperty::Value<std::string> propertyShape;
|
||||
eproperty::Value<std::string> propertyValue; //!< string that must be displayed
|
||||
eproperty::Value<etk::String> propertyShape;
|
||||
eproperty::Value<etk::String> propertyValue; //!< string that must be displayed
|
||||
eproperty::Range<int32_t> propertyMaxCharacter; //!< number max of xharacter in the list
|
||||
eproperty::Value<std::string> propertyRegex; //!< regular expression value
|
||||
eproperty::Value<std::string> propertyTextWhenNothing; //!< Text to display when nothing in in the entry (decorated text...)
|
||||
eproperty::Value<etk::String> propertyRegex; //!< regular expression value
|
||||
eproperty::Value<etk::String> propertyTextWhenNothing; //!< Text to display when nothing in in the entry (decorated text...)
|
||||
private:
|
||||
ewol::compositing::Shaper m_shaper;
|
||||
int32_t m_colorIdTextFg; //!< color property of the text foreground
|
||||
@ -68,7 +68,7 @@ namespace ewol {
|
||||
* @brief internal check the value with RegExp checking
|
||||
* @param[in] _newData The new string to display
|
||||
*/
|
||||
void setInternalValue(const std::string& _newData);
|
||||
void setInternalValue(const etk::String& _newData);
|
||||
private:
|
||||
std::regex m_regex; //!< regular expression to check content
|
||||
private:
|
||||
@ -123,7 +123,7 @@ namespace ewol {
|
||||
*/
|
||||
void periodicCall(const ewol::event::Time& _event);
|
||||
private: // callback functions
|
||||
void onCallbackShortCut(const std::string& _value);
|
||||
void onCallbackShortCut(const etk::String& _value);
|
||||
void onCallbackEntryClean();
|
||||
void onCallbackCut();
|
||||
void onCallbackCopy();
|
||||
|
@ -96,10 +96,10 @@ void ewol::widget::Gird::calculateMinMaxSize() {
|
||||
vec2 tmpSize = m_subWidget[iii].widget->getCalculateMinSize();
|
||||
EWOL_DEBUG(" [" << iii << "] subWidgetMinSize=" << tmpSize);
|
||||
// for all we get the max size :
|
||||
m_uniformSizeRow = std::max((int32_t)tmpSize.y(), m_uniformSizeRow);
|
||||
m_uniformSizeRow = etk::max((int32_t)tmpSize.y(), m_uniformSizeRow);
|
||||
// for the colomn size : We set the autamatic value in negative :
|
||||
if (m_sizeCol[m_subWidget[iii].col] <= 0) {
|
||||
m_sizeCol[m_subWidget[iii].col] = std::min(m_sizeCol[m_subWidget[iii].col], (int32_t)-tmpSize.x() );
|
||||
m_sizeCol[m_subWidget[iii].col] = etk::min(m_sizeCol[m_subWidget[iii].col], (int32_t)-tmpSize.x() );
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -145,7 +145,7 @@ void ewol::widget::Gird::setColNumber(int32_t _colNumber) {
|
||||
} else {
|
||||
// just add the col size:
|
||||
for (int32_t iii=m_sizeCol.size()-1; iii<_colNumber-1 ; iii++) {
|
||||
m_sizeCol.push_back(0);
|
||||
m_sizeCol.pushBack(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -224,7 +224,7 @@ void ewol::widget::Gird::subWidgetAdd(int32_t _colId, int32_t _rowId, ewol::Widg
|
||||
}
|
||||
}
|
||||
// not find == > just adding it ...
|
||||
m_subWidget.push_back(prop);
|
||||
m_subWidget.pushBack(prop);
|
||||
}
|
||||
|
||||
void ewol::widget::Gird::subWidgetRemove(ewol::WidgetShared _newWidget) {
|
||||
|
@ -6,7 +6,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <etk/types.hpp>
|
||||
#include <vector>
|
||||
#include <etk/Vector.hpp>
|
||||
#include <ewol/debug.hpp>
|
||||
#include <ewol/widget/Widget.hpp>
|
||||
#include <ewol/widget/Manager.hpp>
|
||||
@ -29,8 +29,8 @@ namespace ewol {
|
||||
};
|
||||
int32_t m_sizeRow; //!< size of all lines (row) (if set (otherwise 0)) == > we have a only one size ==> multiple size will have no use ...
|
||||
int32_t m_uniformSizeRow;
|
||||
std::vector<int32_t> m_sizeCol; //!< size of all colomn (if set (otherwise 0))
|
||||
std::vector<GirdProperties> m_subWidget; //!< all sub widget are contained in this element
|
||||
etk::Vector<int32_t> m_sizeCol; //!< size of all colomn (if set (otherwise 0))
|
||||
etk::Vector<GirdProperties> m_subWidget; //!< all sub widget are contained in this element
|
||||
ewol::WidgetShared m_tmpWidget; //!< use when replace a widget ...
|
||||
bool m_gavityButtom;
|
||||
protected:
|
||||
|
@ -41,7 +41,7 @@ void ewol::widget::Image::init() {
|
||||
}
|
||||
}
|
||||
|
||||
void ewol::widget::Image::set(const std::string& _file, const gale::Dimension& _border) {
|
||||
void ewol::widget::Image::set(const etk::String& _file, const gale::Dimension& _border) {
|
||||
EWOL_VERBOSE("Set Image : " << _file << " border=" << _border);
|
||||
propertyBorder.set(_border);
|
||||
propertySource.set(_file);
|
||||
@ -158,7 +158,7 @@ bool ewol::widget::Image::loadXML(const exml::Element& _node) {
|
||||
ewol::Widget::loadXML(_node);
|
||||
// get internal data :
|
||||
|
||||
std::string tmpAttributeValue = _node.attributes["ratio"];
|
||||
etk::String tmpAttributeValue = _node.attributes["ratio"];
|
||||
if (tmpAttributeValue.size() != 0) {
|
||||
if (etk::compare_no_case(tmpAttributeValue, "true") == true) {
|
||||
propertyKeepRatio.setDirect(true);
|
||||
|
@ -25,7 +25,7 @@ namespace ewol {
|
||||
public: // signals
|
||||
esignal::Signal<> signalPressed;
|
||||
public: // properties
|
||||
eproperty::Value<std::string> propertySource; //!< file name of the image.
|
||||
eproperty::Value<etk::String> propertySource; //!< file name of the image.
|
||||
eproperty::Value<gale::Dimension> propertyBorder; //!< border to add at the image.
|
||||
eproperty::Value<gale::Dimension> propertyImageSize; //!< border to add at the image.
|
||||
eproperty::Value<bool> propertyKeepRatio; //!< keep the image ratio between width and hight
|
||||
@ -55,7 +55,7 @@ namespace ewol {
|
||||
* @param[in] _file Filaneme of the new image
|
||||
* @param[in] _border New border size to set
|
||||
*/
|
||||
void set(const std::string& _file, const gale::Dimension& _border);
|
||||
void set(const etk::String& _file, const gale::Dimension& _border);
|
||||
protected:
|
||||
vec2 m_imageRenderSize; //!< size of the image when we render it
|
||||
protected:
|
||||
|
@ -11,8 +11,8 @@
|
||||
#include <ewol/widget/Manager.hpp>
|
||||
|
||||
static bool l_displayBackground(true);
|
||||
static std::string l_background("");
|
||||
static std::string l_foreground("");
|
||||
static etk::String l_background("");
|
||||
static etk::String l_foreground("");
|
||||
static float l_ratio(1.0/7.0);
|
||||
|
||||
ewol::widget::Joystick::Joystick() :
|
||||
@ -129,7 +129,7 @@ bool ewol::widget::Joystick::onEventInput(const ewol::event::Input& _event) {
|
||||
if(gale::key::status::down == typeEvent) {
|
||||
signalEnable.emit();
|
||||
} else {
|
||||
std::string tmp = std::string("distance=") + std::string(m_distance) + std::string("angle=") + std::string(m_angle+M_PI/2);
|
||||
etk::String tmp = etk::String("distance=") + etk::String(m_distance) + std::string("angle=") + std::string(m_angle+M_PI/2);
|
||||
signalMove.emit(m_angle+M_PI/2);
|
||||
}
|
||||
//teta += M_PI/2;
|
||||
@ -165,7 +165,7 @@ void ewol::widget::Joystick::ratio(float newRatio) {
|
||||
}
|
||||
|
||||
|
||||
void ewol::widget::Joystick::background(std::string imageNameInData, bool display) {
|
||||
void ewol::widget::Joystick::background(etk::String imageNameInData, bool display) {
|
||||
// TODO : check if it existed
|
||||
m_background = imageNameInData;
|
||||
m_displayBackground = display;
|
||||
@ -173,7 +173,7 @@ void ewol::widget::Joystick::background(std::string imageNameInData, bool displa
|
||||
}
|
||||
|
||||
|
||||
void ewol::widget::Joystick::foreground(std::string imageNameInData) {
|
||||
void ewol::widget::Joystick::foreground(etk::String imageNameInData) {
|
||||
// TODO : check if it existed
|
||||
m_foreground = imageNameInData;
|
||||
EWOL_INFO("Set default Joystick Foreground at " << m_foreground);
|
||||
|
@ -43,8 +43,8 @@ namespace ewol {
|
||||
private:
|
||||
// generic property of the joystick:
|
||||
bool m_displayBackground;
|
||||
std::string m_background;
|
||||
std::string m_foreground;
|
||||
etk::String m_background;
|
||||
etk::String m_foreground;
|
||||
float m_ratio;
|
||||
protected:
|
||||
Joystick();
|
||||
@ -68,12 +68,12 @@ namespace ewol {
|
||||
* @param[in] _imageNameInData the new rbackground that might be set
|
||||
* @param[in] _display
|
||||
*/
|
||||
void background(std::string _imageNameInData, bool _display=true);
|
||||
void background(etk::String _imageNameInData, bool _display=true);
|
||||
/**
|
||||
* @brief set the Foreground of the widget joystick
|
||||
* @param[in] _imageNameInData the new Foreground that might be set
|
||||
*/
|
||||
void foreground(std::string _imageNameInData);
|
||||
void foreground(etk::String _imageNameInData);
|
||||
/**
|
||||
* @brief get the property of the joystick
|
||||
* @param[out] _distance distance to the center
|
||||
|
@ -57,8 +57,8 @@ void ewol::widget::Label::calculateMinMaxSize() {
|
||||
vec3 minSize = m_text.calculateSizeDecorated(m_value);
|
||||
//EWOL_DEBUG("[" << getId() << "] {" << getObjectType() << "} minSize : " << minSize);
|
||||
|
||||
m_minSize.setX(std::avg(tmpMin.x(), 4 + minSize.x(), tmpMax.x()));
|
||||
m_minSize.setY(std::avg(tmpMin.y(), 4 + minSize.y(), tmpMax.y()));
|
||||
m_minSize.setX(etk::avg(tmpMin.x(), 4 + minSize.x(), tmpMax.x()));
|
||||
m_minSize.setY(etk::avg(tmpMin.y(), 4 + minSize.y(), tmpMax.y()));
|
||||
EWOL_VERBOSE("[" << getId() << "] {" << getObjectType() << "} Result min size : " << tmpMin << " < " << m_minSize << " < " << tmpMax);
|
||||
}
|
||||
|
||||
@ -77,8 +77,8 @@ void ewol::widget::Label::onRegenerateDisplay() {
|
||||
// to know the size of one line :
|
||||
vec3 minSize = m_text.calculateSize(char32_t('A'));
|
||||
|
||||
//minSize.setX(std::max(minSize.x(), m_minSize.x()));
|
||||
//minSize.setY(std::max(minSize.y(), m_minSize.y()));
|
||||
//minSize.setX(etk::max(minSize.x(), m_minSize.x()));
|
||||
//minSize.setY(etk::max(minSize.y(), m_minSize.y()));
|
||||
if (tmpMax.x() <= 999999) {
|
||||
m_text.setTextAlignement(0, tmpMax.x()-2*paddingSize, ewol::compositing::alignLeft);
|
||||
}
|
||||
@ -149,9 +149,9 @@ bool ewol::widget::Label::loadXML(const exml::Element& _node) {
|
||||
|
||||
void ewol::widget::Label::onChangePropertyValue() {
|
||||
if (*propertyAutoTranslate == true) {
|
||||
m_value = etk::to_u32string(etranslate::get(*propertyValue));
|
||||
m_value = etk::toUString(etranslate::get(*propertyValue));
|
||||
} else {
|
||||
m_value = etk::to_u32string(*propertyValue);
|
||||
m_value = etk::toUString(*propertyValue);
|
||||
}
|
||||
markToRedraw();
|
||||
requestUpdateSize();
|
||||
|
@ -26,10 +26,10 @@ namespace ewol {
|
||||
esignal::Signal<> signalPressed;
|
||||
public: // properties
|
||||
eproperty::Value<bool> propertyAutoTranslate; //!< if at true the data is translate automaticaly translate.
|
||||
eproperty::Value<std::string> propertyValue; //!< decorated text to display.
|
||||
eproperty::Value<etk::String> propertyValue; //!< decorated text to display.
|
||||
private:
|
||||
ewol::compositing::Text m_text; //!< Compositing text element.
|
||||
std::u32string m_value;
|
||||
etk::UString m_value;
|
||||
ememory::SharedPtr<ewol::resource::ColorFile> m_colorProperty; //!< theme color property
|
||||
int32_t m_colorDefaultFgText; //!< Default color of the text
|
||||
int32_t m_colorDefaultBgText; //!< Default Background color of the text
|
||||
|
@ -73,7 +73,7 @@ void ewol::widget::List::addOObject(ewol::Compositing* _newObject, int32_t _pos)
|
||||
return;
|
||||
}
|
||||
if (_pos < 0 || (size_t)_pos >= m_listOObject.size() ) {
|
||||
m_listOObject.push_back(_newObject);
|
||||
m_listOObject.pushBack(_newObject);
|
||||
} else {
|
||||
m_listOObject.insert(m_listOObject.begin()+_pos, _newObject);
|
||||
}
|
||||
@ -123,7 +123,7 @@ void ewol::widget::List::onRegenerateDisplay() {
|
||||
(minHeight + 2*m_paddingSizeY) * nbRaw );
|
||||
|
||||
|
||||
std::vector<int32_t> listSizeColomn;
|
||||
etk::Vector<int32_t> listSizeColomn;
|
||||
|
||||
ewol::compositing::Drawing * BGOObjects = new ewol::compositing::Drawing();
|
||||
etk::Color<> basicBG = getBasicBG();
|
||||
@ -154,7 +154,7 @@ void ewol::widget::List::onRegenerateDisplay() {
|
||||
int32_t displayPositionX = 0;
|
||||
ivec2 tmpRegister(startRaw, displayPositionY);
|
||||
// add the default position raw :
|
||||
m_lineSize.push_back(tmpRegister);
|
||||
m_lineSize.pushBack(tmpRegister);
|
||||
|
||||
for (size_t jjj=0; jjj<nbColomn && displayPositionX < m_size.x() ; jjj++) {
|
||||
int32_t sizeColom = 0;
|
||||
@ -162,7 +162,7 @@ void ewol::widget::List::onRegenerateDisplay() {
|
||||
m_nbVisibleRaw = 0;
|
||||
for (int32_t iii=startRaw; iii<nbRaw && displayPositionY >= 0; iii++) {
|
||||
m_nbVisibleRaw++;
|
||||
std::string myTextToWrite;
|
||||
etk::String myTextToWrite;
|
||||
etk::Color<> fg;
|
||||
etk::Color<> bg;
|
||||
getElement(jjj, iii, myTextToWrite, fg, bg);
|
||||
@ -179,7 +179,7 @@ void ewol::widget::List::onRegenerateDisplay() {
|
||||
|
||||
// get the maximum size of the colomn :
|
||||
vec3 textSize = tmpText->calculateSize(myTextToWrite);
|
||||
sizeColom = std::max(sizeColom, (int32_t)textSize.x());
|
||||
sizeColom = etk::max(sizeColom, (int32_t)textSize.x());
|
||||
|
||||
tmpText->setColor(fg);
|
||||
tmpText->setPos(vec3(tmpOriginX + displayPositionX, displayPositionY, 0) );
|
||||
@ -191,14 +191,14 @@ void ewol::widget::List::onRegenerateDisplay() {
|
||||
// add the raw position to remember it ...
|
||||
tmpRegister.setX(tmpRegister.x()+1);
|
||||
tmpRegister.setY(displayPositionY);
|
||||
m_lineSize.push_back(tmpRegister);
|
||||
m_lineSize.pushBack(tmpRegister);
|
||||
//EWOL_DEBUG("List indexation:" << tmpRegister);
|
||||
}
|
||||
}
|
||||
displayPositionX += sizeColom;
|
||||
tmpOriginX += m_paddingSizeX*2*2;
|
||||
}
|
||||
//m_lineSize.push_back(tmpOriginY);
|
||||
//m_lineSize.pushBack(tmpOriginY);
|
||||
addOObject(BGOObjects, 0);
|
||||
|
||||
// call the herited class...
|
||||
|
@ -25,11 +25,11 @@ namespace ewol {
|
||||
public:
|
||||
virtual ~List();
|
||||
void calculateMinMaxSize() override;
|
||||
void setLabel(std::string _newLabel);
|
||||
void setLabel(etk::String _newLabel);
|
||||
// drawing capabilities ....
|
||||
private:
|
||||
std::vector<ewol::Compositing*> m_listOObject; //!< generic element to display...
|
||||
std::vector<ivec2 > m_lineSize;
|
||||
etk::Vector<ewol::Compositing*> m_listOObject; //!< generic element to display...
|
||||
etk::Vector<ivec2 > m_lineSize;
|
||||
public:
|
||||
void addOObject(ewol::Compositing* _newObject, int32_t _pos=-1);
|
||||
void clearOObjectList();
|
||||
@ -48,14 +48,14 @@ namespace ewol {
|
||||
virtual uint32_t getNuberOfColomn() {
|
||||
return 1;
|
||||
};
|
||||
virtual bool getTitle(int32_t _colomn, std::string& _myTitle, etk::Color<> &_fg, etk::Color<> &_bg) {
|
||||
virtual bool getTitle(int32_t _colomn, etk::String& _myTitle, etk::Color<> &_fg, etk::Color<> &_bg) {
|
||||
_myTitle = "";
|
||||
return false;
|
||||
};
|
||||
virtual uint32_t getNuberOfRaw() {
|
||||
return 0;
|
||||
};
|
||||
virtual bool getElement(int32_t _colomn, int32_t _raw, std::string &_myTextToWrite, etk::Color<> &_fg, etk::Color<> &_bg) {
|
||||
virtual bool getElement(int32_t _colomn, int32_t _raw, etk::String &_myTextToWrite, etk::Color<> &_fg, etk::Color<> &_bg) {
|
||||
_myTextToWrite = "";
|
||||
_bg = etk::Color<>(0xFF, 0xFF, 0xFF, 0xFF);
|
||||
_fg = etk::Color<>(0x00, 0x00, 0x00, 0xFF);
|
||||
|
@ -82,8 +82,8 @@ void ewol::widget::ListFileSystem::regenerateView() {
|
||||
markToRedraw();
|
||||
}
|
||||
|
||||
std::string ewol::widget::ListFileSystem::getSelect() const {
|
||||
std::string tmpVal = "";
|
||||
etk::String ewol::widget::ListFileSystem::getSelect() const {
|
||||
etk::String tmpVal = "";
|
||||
if (m_selectedLine >= 0) {
|
||||
if (m_list[m_selectedLine] != nullptr) {
|
||||
tmpVal = m_list[m_selectedLine]->getNameFile();
|
||||
@ -93,7 +93,7 @@ std::string ewol::widget::ListFileSystem::getSelect() const {
|
||||
}
|
||||
|
||||
// select the specific file
|
||||
void ewol::widget::ListFileSystem::setSelect(const std::string& _data) {
|
||||
void ewol::widget::ListFileSystem::setSelect(const etk::String& _data) {
|
||||
// remove selected line
|
||||
m_selectedLine = -1;
|
||||
// search the coresponding file :
|
||||
@ -113,7 +113,7 @@ uint32_t ewol::widget::ListFileSystem::getNuberOfColomn() {
|
||||
return 1;
|
||||
}
|
||||
|
||||
bool ewol::widget::ListFileSystem::getTitle(int32_t _colomn, std::string &_myTitle, etk::Color<>& _fg, etk::Color<>& _bg) {
|
||||
bool ewol::widget::ListFileSystem::getTitle(int32_t _colomn, etk::String &_myTitle, etk::Color<>& _fg, etk::Color<>& _bg) {
|
||||
_myTitle = "title";
|
||||
return true;
|
||||
}
|
||||
@ -130,7 +130,7 @@ uint32_t ewol::widget::ListFileSystem::getNuberOfRaw() {
|
||||
return m_list.size() + offset;
|
||||
}
|
||||
|
||||
bool ewol::widget::ListFileSystem::getElement(int32_t _colomn, int32_t _raw, std::string& _myTextToWrite, etk::Color<>& _fg, etk::Color<>& _bg) {
|
||||
bool ewol::widget::ListFileSystem::getElement(int32_t _colomn, int32_t _raw, etk::String& _myTextToWrite, etk::Color<>& _fg, etk::Color<>& _bg) {
|
||||
int32_t offset = 0;
|
||||
if (*propertyShowFolder == true) {
|
||||
if (*propertyPath == "/") {
|
||||
|
@ -20,17 +20,17 @@ namespace ewol {
|
||||
*/
|
||||
class ListFileSystem : public ewol::widget::List {
|
||||
public: // signals
|
||||
esignal::Signal<std::string> signalFileSelect; //!< @event "file-select" Generated when a file is selected.
|
||||
esignal::Signal<std::string> signalFileValidate; //!< @event "file-validate" Generate when the user validate (return) or double click on the element
|
||||
esignal::Signal<std::string> signalFolderSelect;
|
||||
esignal::Signal<std::string> signalFolderValidate;
|
||||
esignal::Signal<etk::String> signalFileSelect; //!< @event "file-select" Generated when a file is selected.
|
||||
esignal::Signal<etk::String> signalFileValidate; //!< @event "file-validate" Generate when the user validate (return) or double click on the element
|
||||
esignal::Signal<etk::String> signalFolderSelect;
|
||||
esignal::Signal<etk::String> signalFolderValidate;
|
||||
public: // properties
|
||||
eproperty::Value<std::string> propertyPath; //!< Current folder that display point on.
|
||||
eproperty::Value<std::string> propertyFile; //!< current selected file
|
||||
eproperty::Value<etk::String> propertyPath; //!< Current folder that display point on.
|
||||
eproperty::Value<etk::String> propertyFile; //!< current selected file
|
||||
eproperty::Value<bool> propertyShowFile; //!< Show files elements
|
||||
eproperty::Value<bool> propertyShowFolder; //!< Display the folders elements
|
||||
eproperty::Value<bool> propertyShowHidden; //!< Display hidden elements
|
||||
eproperty::Value<std::string> propertyFilter; //!< Regular expression to filter the view (for temporary file:".*(~|.bck|.pyc)\e")
|
||||
eproperty::Value<etk::String> propertyFilter; //!< Regular expression to filter the view (for temporary file:".*(~|.bck|.pyc)\e")
|
||||
protected:
|
||||
ListFileSystem();
|
||||
public:
|
||||
@ -45,13 +45,13 @@ namespace ewol {
|
||||
protected:
|
||||
etk::Color<> getBasicBG() override;
|
||||
uint32_t getNuberOfColomn() override;
|
||||
bool getTitle(int32_t _colomn, std::string& _myTitle, etk::Color<>& _fg, etk::Color<>& _bg) override;
|
||||
bool getTitle(int32_t _colomn, etk::String& _myTitle, etk::Color<>& _fg, etk::Color<>& _bg) override;
|
||||
uint32_t getNuberOfRaw() override;
|
||||
bool getElement(int32_t _colomn, int32_t _raw, std::string& _myTextToWrite, etk::Color<>& _fg, etk::Color<>& _bg) override;
|
||||
bool getElement(int32_t _colomn, int32_t _raw, etk::String& _myTextToWrite, etk::Color<>& _fg, etk::Color<>& _bg) override;
|
||||
bool onItemEvent(int32_t _IdInput, enum gale::key::status _typeEvent, int32_t _colomn, int32_t _raw, float _x, float _y) override;
|
||||
protected:
|
||||
// TODO: use shred_ptr
|
||||
std::vector<etk::FSNode *> m_list; //!< List of all element in the path. (they are filtered)
|
||||
etk::Vector<etk::FSNode *> m_list; //!< List of all element in the path. (they are filtered)
|
||||
/**
|
||||
* @brief Clean the list of element.
|
||||
*/
|
||||
@ -67,12 +67,12 @@ namespace ewol {
|
||||
* @brief Select a specific file in the path
|
||||
* @param[in] _data File to selested.
|
||||
*/
|
||||
virtual void setSelect(const std::string& _data);
|
||||
virtual void setSelect(const etk::String& _data);
|
||||
/**
|
||||
* @brief Get the current selected file/folder/... in the list
|
||||
* @return the String of the element selected.
|
||||
*/
|
||||
std::string getSelect() const ;
|
||||
etk::String getSelect() const ;
|
||||
protected:
|
||||
virtual void onChangePropertyPath();
|
||||
virtual void onChangePropertyFile();
|
||||
|
@ -28,7 +28,7 @@
|
||||
#include <ewol/widget/Select.hpp>
|
||||
#include <ewol/widget/Spin.hpp>
|
||||
#include <ewol/widget/Menu.hpp>
|
||||
#include <vector>
|
||||
#include <etk/Vector.hpp>
|
||||
|
||||
ewol::widget::Manager::Manager() :
|
||||
m_haveRedraw(true) {
|
||||
@ -164,7 +164,7 @@ bool ewol::widget::Manager::isDrawingNeeded() {
|
||||
}
|
||||
|
||||
// element that generate the list of elements
|
||||
void ewol::widget::Manager::addWidgetCreator(const std::string& _name,
|
||||
void ewol::widget::Manager::addWidgetCreator(const etk::String& _name,
|
||||
ewol::widget::Manager::widgetCreatorFunction _pointer,
|
||||
ewol::widget::Manager::widgetCreatorFunctionXml _pointerXml) {
|
||||
if ( _pointer == nullptr
|
||||
@ -172,7 +172,7 @@ void ewol::widget::Manager::addWidgetCreator(const std::string& _name,
|
||||
return;
|
||||
}
|
||||
//Keep name in lower case :
|
||||
std::string nameLower = etk::tolower(_name);
|
||||
etk::String nameLower = etk::tolower(_name);
|
||||
bool find = false;
|
||||
{
|
||||
auto it = m_creatorList.find(nameLower);
|
||||
@ -198,8 +198,8 @@ void ewol::widget::Manager::addWidgetCreator(const std::string& _name,
|
||||
m_creatorListXml.insert(make_pair(nameLower, _pointerXml));
|
||||
}
|
||||
|
||||
ewol::WidgetShared ewol::widget::Manager::create(const std::string& _name) {
|
||||
std::string nameLower = etk::tolower(_name);
|
||||
ewol::WidgetShared ewol::widget::Manager::create(const etk::String& _name) {
|
||||
etk::String nameLower = etk::tolower(_name);
|
||||
auto it = m_creatorList.find(nameLower);
|
||||
if (it != m_creatorList.end()) {
|
||||
if (it->second != nullptr) {
|
||||
@ -210,8 +210,8 @@ ewol::WidgetShared ewol::widget::Manager::create(const std::string& _name) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
ewol::WidgetShared ewol::widget::Manager::create(const std::string& _name, const exml::Element& _node) {
|
||||
std::string nameLower = etk::tolower(_name);
|
||||
ewol::WidgetShared ewol::widget::Manager::create(const etk::String& _name, const exml::Element& _node) {
|
||||
etk::String nameLower = etk::tolower(_name);
|
||||
auto it = m_creatorListXml.find(nameLower);
|
||||
if (it != m_creatorListXml.end()) {
|
||||
if (it->second != nullptr) {
|
||||
@ -222,8 +222,8 @@ ewol::WidgetShared ewol::widget::Manager::create(const std::string& _name, const
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
bool ewol::widget::Manager::exist(const std::string& _name) {
|
||||
std::string nameLower = etk::tolower(_name);
|
||||
bool ewol::widget::Manager::exist(const etk::String& _name) {
|
||||
etk::String nameLower = etk::tolower(_name);
|
||||
auto it = m_creatorList.find(nameLower);
|
||||
if (it == m_creatorList.end()) {
|
||||
return false;
|
||||
@ -231,8 +231,8 @@ bool ewol::widget::Manager::exist(const std::string& _name) {
|
||||
return true;
|
||||
}
|
||||
|
||||
std::string ewol::widget::Manager::list() {
|
||||
std::string tmpVal;
|
||||
etk::String ewol::widget::Manager::list() {
|
||||
etk::String tmpVal;
|
||||
for (auto &it : m_creatorList) {
|
||||
if (tmpVal.size() != 0) {
|
||||
tmpVal += ",";
|
||||
|
@ -7,7 +7,7 @@
|
||||
|
||||
#include <etk/types.hpp>
|
||||
#include <ewol/debug.hpp>
|
||||
#include <vector>
|
||||
#include <etk/Vector.hpp>
|
||||
#include <unordered_map>
|
||||
#include <ewol/widget/Widget.hpp>
|
||||
|
||||
@ -50,8 +50,8 @@ namespace ewol {
|
||||
using widgetCreatorFunction = std::function<ewol::WidgetShared()>; //!< funtion factory basic definition
|
||||
using widgetCreatorFunctionXml = std::function<ewol::WidgetShared(const exml::Element& _node)>; //!< funtion factory basic definition
|
||||
private:
|
||||
std::unordered_map<std::string, widgetCreatorFunction> m_creatorList; //!< List of factory of a widget
|
||||
std::unordered_map<std::string, widgetCreatorFunctionXml> m_creatorListXml; //!< List of factory of a widget
|
||||
std::unordered_map<etk::String, widgetCreatorFunction> m_creatorList; //!< List of factory of a widget
|
||||
std::unordered_map<etk::String, widgetCreatorFunctionXml> m_creatorListXml; //!< List of factory of a widget
|
||||
public:
|
||||
/**
|
||||
* @brief add a factory of a specific widget.
|
||||
@ -59,32 +59,32 @@ namespace ewol {
|
||||
* @param[in] _factory Function pointer to create the widget
|
||||
* @param[in] _factoryXml Function pointer to create the widget with XML node for parsing of XML
|
||||
*/
|
||||
void addWidgetCreator(const std::string& _name, widgetCreatorFunction _factory, widgetCreatorFunctionXml _factoryXml);
|
||||
void addWidgetCreator(const etk::String& _name, widgetCreatorFunction _factory, widgetCreatorFunctionXml _factoryXml);
|
||||
/**
|
||||
* @brief Create a widget with his name.
|
||||
* @param[in] _name Name of the widget to create.
|
||||
* @return The widget created (nullptr if it does not exist).
|
||||
*/
|
||||
ewol::WidgetShared create(const std::string& _name);
|
||||
ewol::WidgetShared create(const etk::String& _name);
|
||||
/**
|
||||
* @brief Create a widget with his name.
|
||||
* @param[in] _name Name of the widget to create.
|
||||
* @param[in] _node Reference on the XML node.
|
||||
* @return The widget created (nullptr if it does not exist).
|
||||
*/
|
||||
ewol::WidgetShared create(const std::string& _name, const exml::Element& _node);
|
||||
ewol::WidgetShared create(const etk::String& _name, const exml::Element& _node);
|
||||
/**
|
||||
* @brief Check if an Widget exist
|
||||
* @param[in] _name Name of the widget to check.
|
||||
* @return true The Widget exist.
|
||||
* @return false The Widget Does NOT exist.
|
||||
*/
|
||||
bool exist(const std::string& _name);
|
||||
bool exist(const etk::String& _name);
|
||||
/**
|
||||
* @brief Get the list of all Widget that can be created.
|
||||
* @return Separate with ',' string list.
|
||||
*/
|
||||
std::string list();
|
||||
etk::String list();
|
||||
// ---------------------------------------------
|
||||
// -- Something change area (TODO: maybe set it in the windows)
|
||||
// ---------------------------------------------
|
||||
|
@ -47,15 +47,15 @@ void ewol::widget::Menu::clear() {
|
||||
m_listElement.clear();
|
||||
}
|
||||
|
||||
int32_t ewol::widget::Menu::addTitle(const std::string& _label,
|
||||
const std::string& _image,
|
||||
const std::string& _message) {
|
||||
int32_t ewol::widget::Menu::addTitle(const etk::String& _label,
|
||||
const etk::String& _image,
|
||||
const etk::String& _message) {
|
||||
return add(-1, _label, _image, _message);
|
||||
}
|
||||
|
||||
static const char* eventButtonPressed = "menu-local-pressed";
|
||||
|
||||
int32_t ewol::widget::Menu::get(const std::string& _label) {
|
||||
int32_t ewol::widget::Menu::get(const etk::String& _label) {
|
||||
for (auto &it : m_listElement) {
|
||||
if (it.m_label == _label) {
|
||||
return it.m_localId;
|
||||
@ -65,9 +65,9 @@ int32_t ewol::widget::Menu::get(const std::string& _label) {
|
||||
}
|
||||
|
||||
int32_t ewol::widget::Menu::add(int32_t _parent,
|
||||
const std::string& _label,
|
||||
const std::string& _image,
|
||||
const std::string& _message) {
|
||||
const etk::String& _label,
|
||||
const etk::String& _image,
|
||||
const etk::String& _message) {
|
||||
// try to find one already created:
|
||||
int32_t previous = get(_label);
|
||||
if (previous != -1) {
|
||||
@ -86,7 +86,7 @@ int32_t ewol::widget::Menu::add(int32_t _parent,
|
||||
return tmpObject.m_localId;
|
||||
}
|
||||
if (tmpObject.m_image.size()!=0) {
|
||||
std::string composeString ="<sizer mode='hori' expand='true,false' fill='true,true'>\n";
|
||||
etk::String composeString ="<sizer mode='hori' expand='true,false' fill='true,true'>\n";
|
||||
if (etk::end_with(tmpObject.m_image, ".edf") == true) {
|
||||
composeString+=" <image src='" + tmpObject.m_image + "' size='8,8mm' distance-field='true'/>\n";
|
||||
} else {
|
||||
@ -106,7 +106,7 @@ int32_t ewol::widget::Menu::add(int32_t _parent,
|
||||
myButton->signalPressed.connect(sharedFromThis(), &ewol::widget::Menu::onButtonPressed, ewol::widget::ButtonWeak(myButton));
|
||||
tmpObject.m_widgetPointer = myButton;
|
||||
}
|
||||
m_listElement.push_back(tmpObject);
|
||||
m_listElement.pushBack(tmpObject);
|
||||
return tmpObject.m_localId;
|
||||
}
|
||||
|
||||
@ -136,7 +136,7 @@ int32_t ewol::widget::Menu::addSpacer(int32_t _parent) {
|
||||
// add it in the widget list
|
||||
ewol::widget::Sizer::subWidgetAdd(mySpacer);
|
||||
}
|
||||
m_listElement.push_back(tmpObject);
|
||||
m_listElement.pushBack(tmpObject);
|
||||
return tmpObject.m_localId;
|
||||
}
|
||||
|
||||
@ -240,7 +240,7 @@ void ewol::widget::Menu::onButtonPressed(ewol::widget::ButtonWeak _button) {
|
||||
// add it in the widget list
|
||||
mySizer->subWidgetAdd(myButton);
|
||||
if (it2->m_image.size() != 0) {
|
||||
std::string composeString;
|
||||
etk::String composeString;
|
||||
composeString+= " <sizer mode='hori' expand='true,false' fill='true,true' lock='true'>\n";
|
||||
if (etk::end_with(it2->m_image, ".edf") == true) {
|
||||
composeString+=" <image src='" + it2->m_image + "' size='8,8mm' distance-field='true'/>\n";
|
||||
@ -253,7 +253,7 @@ void ewol::widget::Menu::onButtonPressed(ewol::widget::ButtonWeak _button) {
|
||||
} else {
|
||||
if (menuHaveImage == true) {
|
||||
myButton->setSubWidget(ewol::widget::composerGenerateString(
|
||||
std::string() +
|
||||
etk::String() +
|
||||
" <sizer mode='hori' expand='true,false' fill='true,true' lock='true'>\n"
|
||||
" <spacer min-size='8,0mm'/>\n"
|
||||
" <label exand='true,true' fill='true,true'><![CDATA[<left>" + it2->m_label + "</left>]]></label>\n"
|
||||
@ -262,7 +262,7 @@ void ewol::widget::Menu::onButtonPressed(ewol::widget::ButtonWeak _button) {
|
||||
} else {
|
||||
ewol::widget::LabelShared tmpLabel = widget::Label::create();
|
||||
if (tmpLabel != nullptr) {
|
||||
tmpLabel->propertyValue.set(std::string("<left>") + it2->m_label + "</left>\n");
|
||||
tmpLabel->propertyValue.set(etk::String("<left>") + it2->m_label + "</left>\n");
|
||||
tmpLabel->propertyExpand.set(bvec2(true,false));
|
||||
tmpLabel->propertyFill.set(bvec2(true,true));
|
||||
myButton->setSubWidget(tmpLabel);
|
||||
@ -296,7 +296,7 @@ bool ewol::widget::Menu::loadXML(const exml::Element& _node) {
|
||||
// trash here all that is not element
|
||||
continue;
|
||||
}
|
||||
std::string widgetName = pNode.getValue();
|
||||
etk::String widgetName = pNode.getValue();
|
||||
EWOL_INFO("Get node : " << pNode);
|
||||
if (widgetName == "elem") {
|
||||
// <elem title="_T{Title of the button}" image="DATA:List.svg" event="menu:exit">
|
||||
@ -308,7 +308,7 @@ bool ewol::widget::Menu::loadXML(const exml::Element& _node) {
|
||||
// trash here all that is not element
|
||||
continue;
|
||||
}
|
||||
std::string widgetName2 = pNode2.getValue();
|
||||
etk::String widgetName2 = pNode2.getValue();
|
||||
if (widgetName2 == "elem") {
|
||||
// <elem title="_T{Title of the button}" image="DATA:List.svg" event="menu:exit">
|
||||
add(idMenu, pNode2.attributes["title"], pNode2.attributes["image"], pNode2.attributes["event"]);
|
||||
|
@ -20,9 +20,9 @@ namespace ewol {
|
||||
int32_t m_localId;
|
||||
int32_t m_parentId;
|
||||
ewol::WidgetWeak m_widgetPointer;
|
||||
std::string m_label;
|
||||
std::string m_image;
|
||||
std::string m_message;
|
||||
etk::String m_label;
|
||||
etk::String m_image;
|
||||
etk::String m_message;
|
||||
};
|
||||
class Menu;
|
||||
using MenuShared = ememory::SharedPtr<ewol::widget::Menu>;
|
||||
@ -32,7 +32,7 @@ namespace ewol {
|
||||
*/
|
||||
class Menu :public ewol::widget::Sizer {
|
||||
public:
|
||||
esignal::Signal<std::string> signalSelect; // event on a menu button or ...
|
||||
esignal::Signal<etk::String> signalSelect; // event on a menu button or ...
|
||||
protected:
|
||||
Menu();
|
||||
public:
|
||||
@ -45,14 +45,14 @@ namespace ewol {
|
||||
void subWidgetUnLink(ewol::WidgetShared _newWidget) override;
|
||||
bool loadXML(const exml::Element& _node) override;
|
||||
private:
|
||||
std::vector<ewol::widget::MenuElement> m_listElement;
|
||||
etk::Vector<ewol::widget::MenuElement> m_listElement;
|
||||
int32_t m_staticId; // unique ID for every element of the menu ...
|
||||
ewol::widget::ContextMenuWeak m_widgetContextMenu;
|
||||
int32_t get(const std::string& _label);
|
||||
int32_t get(const etk::String& _label);
|
||||
public:
|
||||
void clear();
|
||||
int32_t addTitle(const std::string& _label, const std::string& _image="", const std::string& _message = "");
|
||||
int32_t add(int32_t _parent, const std::string& _label, const std::string& _image="", const std::string& _message = "");
|
||||
int32_t addTitle(const etk::String& _label, const etk::String& _image="", const etk::String& _message = "");
|
||||
int32_t add(int32_t _parent, const etk::String& _label, const etk::String& _image="", const etk::String& _message = "");
|
||||
int32_t addSpacer(int32_t _parent=-1);
|
||||
void remove(int32_t _id);
|
||||
private:
|
||||
|
@ -23,7 +23,7 @@ namespace ewol {
|
||||
*/
|
||||
class PopUp : public ewol::widget::Container {
|
||||
public: // properties
|
||||
eproperty::Value<std::string> propertyShape; //!< Compositing theme.
|
||||
eproperty::Value<etk::String> propertyShape; //!< Compositing theme.
|
||||
eproperty::Value<bvec2> propertyLockExpand; //!< Lock the expend of the sub widget to this one == > this permit to limit bigger subWidget
|
||||
eproperty::Value<bool> propertyCloseOutEvent; //!< ratio progression of a sliding
|
||||
protected:
|
||||
|
@ -42,8 +42,8 @@ ewol::widget::ProgressBar::~ProgressBar() {
|
||||
|
||||
void ewol::widget::ProgressBar::calculateMinMaxSize() {
|
||||
vec2 tmpMin = propertyMinSize->getPixel();
|
||||
m_minSize.setValue( std::max(tmpMin.x(), 40.0f),
|
||||
std::max(tmpMin.y(), dotRadius*2.0f) );
|
||||
m_minSize.setValue( etk::max(tmpMin.x(), 40.0f),
|
||||
etk::max(tmpMin.y(), dotRadius*2.0f) );
|
||||
markToRedraw();
|
||||
}
|
||||
|
||||
|
@ -161,9 +161,9 @@ void ewol::widget::Scroll::onRegenerateDisplay() {
|
||||
if( m_size.y() < scrollSize.y()
|
||||
|| scrollOffset.y() != 0) {
|
||||
float lenScrollBar = m_size.y()*m_size.y() / scrollSize.y();
|
||||
lenScrollBar = std::avg(10.0f, lenScrollBar, m_size.y());
|
||||
lenScrollBar = etk::avg(10.0f, lenScrollBar, m_size.y());
|
||||
float originScrollBar = scrollOffset.y() / (scrollSize.y()-m_size.y()*propertyLimit->y());
|
||||
originScrollBar = std::avg(0.0f, originScrollBar, 1.0f);
|
||||
originScrollBar = etk::avg(0.0f, originScrollBar, 1.0f);
|
||||
originScrollBar *= (m_size.y()-lenScrollBar);
|
||||
m_shaperV.setShape(vec2(m_size.x() - paddingVert.x(), 0),
|
||||
vec2(paddingVert.x(), m_size.y()),
|
||||
@ -173,9 +173,9 @@ void ewol::widget::Scroll::onRegenerateDisplay() {
|
||||
if( m_size.x() < scrollSize.x()
|
||||
|| scrollOffset.x() != 0) {
|
||||
float lenScrollBar = (m_size.x()-paddingHori.xLeft())*(m_size.x()-paddingVert.x()) / scrollSize.x();
|
||||
lenScrollBar = std::avg(10.0f, lenScrollBar, (m_size.x()-paddingVert.x()));
|
||||
lenScrollBar = etk::avg(10.0f, lenScrollBar, (m_size.x()-paddingVert.x()));
|
||||
float originScrollBar = scrollOffset.x() / (scrollSize.x()-m_size.x()*propertyLimit->x());
|
||||
originScrollBar = std::avg(0.0f, originScrollBar, 1.0f);
|
||||
originScrollBar = etk::avg(0.0f, originScrollBar, 1.0f);
|
||||
originScrollBar *= (m_size.x()-paddingHori.xRight()-lenScrollBar);
|
||||
m_shaperH.setShape(vec2(0, 0),
|
||||
vec2(m_size.x()-paddingVert.x(), paddingHori.y()),
|
||||
@ -212,7 +212,7 @@ bool ewol::widget::Scroll::onEventInput(const ewol::event::Input& _event) {
|
||||
m_highSpeedButton = 1;
|
||||
// force direct scrolling in this case
|
||||
scrollOffset.setY((int32_t)(scrollSize.y() * (relativePos.y()-SCROLL_BAR_SPACE) / (m_size.y()-SCROLL_BAR_SPACE*2)));
|
||||
scrollOffset.setY(std::avg(0.0f, scrollOffset.y(), (scrollSize.y() - m_size.y()*propertyLimit->y())));
|
||||
scrollOffset.setY(etk::avg(0.0f, scrollOffset.y(), (scrollSize.y() - m_size.y()*propertyLimit->y())));
|
||||
markToRedraw();
|
||||
if (m_subWidget != nullptr) {
|
||||
m_subWidget->setOffset(scrollOffset);
|
||||
@ -229,7 +229,7 @@ bool ewol::widget::Scroll::onEventInput(const ewol::event::Input& _event) {
|
||||
m_highSpeedButton = 1;
|
||||
// force direct scrolling in this case
|
||||
scrollOffset.setX((int32_t)(scrollSize.x() * (relativePos.x()-SCROLL_BAR_SPACE) / (m_size.x()-SCROLL_BAR_SPACE*2)));
|
||||
scrollOffset.setY(std::avg(0.0f, scrollOffset.x(), (scrollSize.x() - m_size.x()*propertyLimit->x())));
|
||||
scrollOffset.setY(etk::avg(0.0f, scrollOffset.x(), (scrollSize.x() - m_size.x()*propertyLimit->x())));
|
||||
markToRedraw();
|
||||
if (m_subWidget != nullptr) {
|
||||
m_subWidget->setOffset(scrollOffset);
|
||||
@ -243,7 +243,7 @@ bool ewol::widget::Scroll::onEventInput(const ewol::event::Input& _event) {
|
||||
EWOL_VERBOSE(" mode UP " << m_size.y() << "<" << scrollSize.y());
|
||||
if(m_size.y() < scrollSize.y()) {
|
||||
scrollOffset.setY(scrollOffset.y()-m_pixelScrolling);
|
||||
scrollOffset.setY(std::avg(0.0f, scrollOffset.y(), (scrollSize.y() - m_size.y()*propertyLimit->y())));
|
||||
scrollOffset.setY(etk::avg(0.0f, scrollOffset.y(), (scrollSize.y() - m_size.y()*propertyLimit->y())));
|
||||
markToRedraw();
|
||||
if (m_subWidget != nullptr) {
|
||||
m_subWidget->setOffset(scrollOffset);
|
||||
@ -255,7 +255,7 @@ bool ewol::widget::Scroll::onEventInput(const ewol::event::Input& _event) {
|
||||
EWOL_VERBOSE(" mode DOWN " << m_size.y() << "<" << scrollSize.y());
|
||||
if(m_size.y() < scrollSize.y()) {
|
||||
scrollOffset.setY(scrollOffset.y()+m_pixelScrolling);
|
||||
scrollOffset.setY(std::avg(0.0f, scrollOffset.y(), (scrollSize.y() - m_size.y()*propertyLimit->y())));
|
||||
scrollOffset.setY(etk::avg(0.0f, scrollOffset.y(), (scrollSize.y() - m_size.y()*propertyLimit->y())));
|
||||
markToRedraw();
|
||||
if (m_subWidget != nullptr) {
|
||||
m_subWidget->setOffset(scrollOffset);
|
||||
@ -325,7 +325,7 @@ bool ewol::widget::Scroll::onEventInput(const ewol::event::Input& _event) {
|
||||
}
|
||||
markToRedraw();
|
||||
}
|
||||
scrollOffset.setY(std::avg(0.0f, scrollOffset.y(), (scrollSize.y() - m_size.y()*propertyLimit->y())));
|
||||
scrollOffset.setY(etk::avg(0.0f, scrollOffset.y(), (scrollSize.y() - m_size.y()*propertyLimit->y())));
|
||||
if (m_subWidget != nullptr) {
|
||||
m_subWidget->setOffset(scrollOffset);
|
||||
}
|
||||
@ -334,7 +334,7 @@ bool ewol::widget::Scroll::onEventInput(const ewol::event::Input& _event) {
|
||||
if( m_highSpeedMode == speedModeEnableHorizontal
|
||||
&& _event.getStatus() == gale::key::status::move) {
|
||||
scrollOffset.setX((int32_t)(scrollSize.x() * (relativePos.x()-SCROLL_BAR_SPACE) / (m_size.x()-SCROLL_BAR_SPACE*2)));
|
||||
scrollOffset.setX(std::avg(0.0f, scrollOffset.x(), (scrollSize.x() - m_size.x()*propertyLimit->x() )));
|
||||
scrollOffset.setX(etk::avg(0.0f, scrollOffset.x(), (scrollSize.x() - m_size.x()*propertyLimit->x() )));
|
||||
markToRedraw();
|
||||
if (m_subWidget != nullptr) {
|
||||
m_subWidget->setOffset(scrollOffset);
|
||||
@ -344,7 +344,7 @@ bool ewol::widget::Scroll::onEventInput(const ewol::event::Input& _event) {
|
||||
if( m_highSpeedMode == speedModeEnableVertical
|
||||
&& _event.getStatus() == gale::key::status::move) {
|
||||
scrollOffset.setY((int32_t)(scrollSize.y() * (relativePos.y()-SCROLL_BAR_SPACE) / (m_size.y()-SCROLL_BAR_SPACE*2)));
|
||||
scrollOffset.setY(std::avg(0.0f, scrollOffset.y(), (scrollSize.y() - m_size.y()*propertyLimit->x())));
|
||||
scrollOffset.setY(etk::avg(0.0f, scrollOffset.y(), (scrollSize.y() - m_size.y()*propertyLimit->x())));
|
||||
markToRedraw();
|
||||
if (m_subWidget != nullptr) {
|
||||
m_subWidget->setOffset(scrollOffset);
|
||||
@ -388,11 +388,11 @@ bool ewol::widget::Scroll::onEventInput(const ewol::event::Input& _event) {
|
||||
//scrollOffset.x = (int32_t)(scrollSize.x * x / m_size.x);
|
||||
if (propertyLimit->x() != 0.0f) {
|
||||
scrollOffset.setX(scrollOffset.x() + (relativePos.x() - m_highSpeedStartPos.x()));
|
||||
scrollOffset.setX(std::avg(0.0f, scrollOffset.x(), (scrollSize.x() - m_size.x()*propertyLimit->x())));
|
||||
scrollOffset.setX(etk::avg(0.0f, scrollOffset.x(), (scrollSize.x() - m_size.x()*propertyLimit->x())));
|
||||
}
|
||||
if (propertyLimit->y() != 0.0f) {
|
||||
scrollOffset.setY(scrollOffset.y() - (relativePos.y() - m_highSpeedStartPos.y()));
|
||||
scrollOffset.setY(std::avg(0.0f, scrollOffset.y(), (scrollSize.y() - m_size.y()*propertyLimit->y())));
|
||||
scrollOffset.setY(etk::avg(0.0f, scrollOffset.y(), (scrollSize.y() - m_size.y()*propertyLimit->y())));
|
||||
}
|
||||
// update current position:
|
||||
m_highSpeedStartPos = relativePos;
|
||||
|
@ -20,8 +20,8 @@ namespace ewol {
|
||||
class Scroll : public ewol::widget::Container {
|
||||
public: // properties
|
||||
eproperty::Range<vec2> propertyLimit; //!< Set the limitation of the ratio in the sreen
|
||||
eproperty::Value<std::string> propertyShapeVert; //!< Vertical shaper name
|
||||
eproperty::Value<std::string> propertyShapeHori; //!< Horizontal shaper name
|
||||
eproperty::Value<etk::String> propertyShapeVert; //!< Vertical shaper name
|
||||
eproperty::Value<etk::String> propertyShapeHori; //!< Horizontal shaper name
|
||||
eproperty::Value<bool> propertyHover; //!< Horizontal shaper name
|
||||
public:
|
||||
enum highSpeedMode {
|
||||
|
@ -10,7 +10,7 @@
|
||||
#include <ewol/widget/Label.hpp>
|
||||
#include <ewol/widget/Windows.hpp>
|
||||
|
||||
ewol::widget::Select::Element::Element(int32_t _value, std::string _name, bool _selected):
|
||||
ewol::widget::Select::Element::Element(int32_t _value, etk::String _name, bool _selected):
|
||||
m_value(_value),
|
||||
m_name(_name),
|
||||
m_selected(_selected) {
|
||||
@ -91,14 +91,14 @@ void ewol::widget::Select::optionClear() {
|
||||
optionSelectDefault();
|
||||
}
|
||||
|
||||
void ewol::widget::Select::optionAdd(int32_t _value, std::string _data) {
|
||||
void ewol::widget::Select::optionAdd(int32_t _value, etk::String _data) {
|
||||
for (auto &it : m_listElement) {
|
||||
if (_value == it.m_value) {
|
||||
EWOL_DEBUG("replace element: " << _value << " with: '" << _data << "'");
|
||||
it.m_name = _data;
|
||||
}
|
||||
}
|
||||
m_listElement.push_back(ewol::widget::Select::Element(_value, _data, false));
|
||||
m_listElement.pushBack(ewol::widget::Select::Element(_value, _data, false));
|
||||
}
|
||||
|
||||
bool ewol::widget::Select::loadXML(const exml::Element& _node) {
|
||||
@ -120,9 +120,9 @@ bool ewol::widget::Select::loadXML(const exml::Element& _node) {
|
||||
EWOL_ERROR("(l " << pNode.getPos() << ") Unknown basic node='" << pNode.getValue() << "' not in : [option]" );
|
||||
continue;
|
||||
}
|
||||
std::string valId = pNode.attributes["id"];
|
||||
std::string valIsSelected = pNode.attributes["select"];
|
||||
std::string valText = pNode.getText();
|
||||
etk::String valId = pNode.attributes["id"];
|
||||
etk::String valIsSelected = pNode.attributes["select"];
|
||||
etk::String valText = pNode.getText();
|
||||
int32_t id = etk::string_to_int32_t(valId);
|
||||
bool select = etk::string_to_bool(valIsSelected);
|
||||
optionAdd(id, valText);
|
||||
@ -180,7 +180,7 @@ void ewol::widget::Select::onCallbackOpenMenu() {
|
||||
continue;
|
||||
}
|
||||
if (it.m_selected == true) {
|
||||
myLabel->propertyValue.set(std::string("<b>") + it.m_name + "</b>");
|
||||
myLabel->propertyValue.set(etk::String("<b>") + it.m_name + "</b>");
|
||||
} else {
|
||||
myLabel->propertyValue.set(it.m_name);
|
||||
}
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user