STANDARD ==> remove vector type and replace with std::vector (done but sone assertion)
This commit is contained in:
parent
3b60ac1214
commit
274e9d7ef7
@ -88,10 +88,10 @@ const int32_t etk::constConvertionTableSize = sizeof(etk::constConvertionTable)
|
|||||||
* @return ---
|
* @return ---
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
void etk::DisplayData(etk::VectorType<char> &data)
|
void etk::DisplayData(std::vector<char> &data)
|
||||||
{
|
{
|
||||||
int32_t i;
|
int32_t i;
|
||||||
for (i=0; i<(int32_t)data.Size() ; i++) {
|
for (i=0; i<(int32_t)data.size() ; i++) {
|
||||||
etk::cout<< (char)(data[i]&0x00FF );
|
etk::cout<< (char)(data[i]&0x00FF );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -106,11 +106,11 @@ void etk::DisplayData(etk::VectorType<char> &data)
|
|||||||
* @return ---
|
* @return ---
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
void etk::DisplayElem(etk::VectorType<int16_t> &data, int32_t start, int32_t stop)
|
void etk::DisplayElem(std::vector<int16_t> &data, int32_t start, int32_t stop)
|
||||||
{
|
{
|
||||||
int32_t i;
|
int32_t i;
|
||||||
etk::cout<< ETK_BASH_COLOR_NORMAL;
|
etk::cout<< ETK_BASH_COLOR_NORMAL;
|
||||||
for (i=start; i<(int32_t)data.Size() && i<stop ; i++) {
|
for (i=start; i<(int32_t)data.size() && i<stop ; i++) {
|
||||||
switch(data[i])
|
switch(data[i])
|
||||||
{
|
{
|
||||||
case REGEXP_OPCODE_PTHESE_IN: etk::cout<<ETK_BASH_COLOR_RED << (char*)"(" << ETK_BASH_COLOR_NORMAL; break;
|
case REGEXP_OPCODE_PTHESE_IN: etk::cout<<ETK_BASH_COLOR_RED << (char*)"(" << ETK_BASH_COLOR_NORMAL; break;
|
||||||
@ -142,29 +142,16 @@ void etk::DisplayElem(etk::VectorType<int16_t> &data, int32_t start, int32_t sto
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
char * etk::levelSpace(int32_t level)
|
|
||||||
|
static const char* tmpSpaceArray = " ";
|
||||||
|
|
||||||
|
const char * etk::levelSpace(int32_t level)
|
||||||
{
|
{
|
||||||
switch(level)
|
int32_t len = strlen(tmpSpaceArray);
|
||||||
{
|
if (level*2 > len) {
|
||||||
case 0: return (char*)"";
|
return tmpSpaceArray;
|
||||||
case 1: return (char*)" ";
|
|
||||||
case 2: return (char*)" ";
|
|
||||||
case 3: return (char*)" ";
|
|
||||||
case 4: return (char*)" ";
|
|
||||||
case 5: return (char*)" ";
|
|
||||||
case 6: return (char*)" ";
|
|
||||||
case 7: return (char*)" ";
|
|
||||||
case 8: return (char*)" ";
|
|
||||||
case 9: return (char*)" ";
|
|
||||||
case 10: return (char*)" ";
|
|
||||||
case 11: return (char*)" ";
|
|
||||||
case 12: return (char*)" ";
|
|
||||||
case 13: return (char*)" ";
|
|
||||||
case 14: return (char*)" ";
|
|
||||||
case 15: return (char*)" ";
|
|
||||||
case 16: return (char*)" ";
|
|
||||||
default: return (char*)" ";
|
|
||||||
}
|
}
|
||||||
|
return tmpSpaceArray + len - level*2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -176,7 +163,7 @@ char * etk::levelSpace(int32_t level)
|
|||||||
* @return ---
|
* @return ---
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
int32_t etk::GetLenOfPTheseElem(etk::VectorType<int16_t> &data, int32_t startPos)
|
int32_t etk::GetLenOfPTheseElem(std::vector<int16_t> &data, int32_t startPos)
|
||||||
{
|
{
|
||||||
int32_t pos = startPos;
|
int32_t pos = startPos;
|
||||||
int32_t nbOpen = 0;
|
int32_t nbOpen = 0;
|
||||||
@ -186,7 +173,7 @@ int32_t etk::GetLenOfPTheseElem(etk::VectorType<int16_t> &data, int32_t startPos
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
// find size ...
|
// find size ...
|
||||||
while (pos < (int32_t)data.Size() ) {
|
while (pos < (int32_t)data.size() ) {
|
||||||
if(REGEXP_OPCODE_PTHESE_IN == data[pos]) {
|
if(REGEXP_OPCODE_PTHESE_IN == data[pos]) {
|
||||||
// find a sub section :
|
// find a sub section :
|
||||||
nbOpen++;
|
nbOpen++;
|
||||||
@ -225,7 +212,7 @@ int32_t etk::GetLenOfPTheseElem(etk::VectorType<int16_t> &data, int32_t startPos
|
|||||||
* @return ---
|
* @return ---
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
int32_t etk::GetLenOfPThese(etk::VectorType<int16_t> &data, int32_t startPos)
|
int32_t etk::GetLenOfPThese(std::vector<int16_t> &data, int32_t startPos)
|
||||||
{
|
{
|
||||||
int32_t pos = startPos;
|
int32_t pos = startPos;
|
||||||
int32_t nbOpen = 0;
|
int32_t nbOpen = 0;
|
||||||
@ -236,7 +223,7 @@ int32_t etk::GetLenOfPThese(etk::VectorType<int16_t> &data, int32_t startPos)
|
|||||||
{
|
{
|
||||||
pos++;
|
pos++;
|
||||||
// find size ...
|
// find size ...
|
||||||
while (pos < (int32_t)data.Size() ) {
|
while (pos < (int32_t)data.size() ) {
|
||||||
if(REGEXP_OPCODE_PTHESE_IN == data[pos]) {
|
if(REGEXP_OPCODE_PTHESE_IN == data[pos]) {
|
||||||
// find a sub section :
|
// find a sub section :
|
||||||
nbOpen++;
|
nbOpen++;
|
||||||
@ -278,7 +265,7 @@ int32_t etk::GetLenOfPThese(etk::VectorType<int16_t> &data, int32_t startPos)
|
|||||||
* @return ---
|
* @return ---
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
int32_t etk::GetLenOfBracket(etk::VectorType<int16_t> &data, int32_t startPos)
|
int32_t etk::GetLenOfBracket(std::vector<int16_t> &data, int32_t startPos)
|
||||||
{
|
{
|
||||||
int32_t pos = startPos;
|
int32_t pos = startPos;
|
||||||
// special case of the (...) or | ==> we search '|' or ')'
|
// special case of the (...) or | ==> we search '|' or ')'
|
||||||
@ -287,7 +274,7 @@ int32_t etk::GetLenOfBracket(etk::VectorType<int16_t> &data, int32_t startPos)
|
|||||||
} else if( REGEXP_OPCODE_BRACKET_IN == data[pos]) {
|
} else if( REGEXP_OPCODE_BRACKET_IN == data[pos]) {
|
||||||
pos++;
|
pos++;
|
||||||
// find size ...
|
// find size ...
|
||||||
while (pos < (int32_t)data.Size() ) {
|
while (pos < (int32_t)data.size() ) {
|
||||||
if(REGEXP_OPCODE_BRACKET_OUT == data[pos]) {
|
if(REGEXP_OPCODE_BRACKET_OUT == data[pos]) {
|
||||||
// Find the end of the [...]
|
// Find the end of the [...]
|
||||||
// just return the size inside
|
// just return the size inside
|
||||||
@ -322,7 +309,7 @@ int32_t etk::GetLenOfBracket(etk::VectorType<int16_t> &data, int32_t startPos)
|
|||||||
* @return ---
|
* @return ---
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
int32_t etk::GetLenOfBrace(etk::VectorType<int16_t> &data, int32_t startPos)
|
int32_t etk::GetLenOfBrace(std::vector<int16_t> &data, int32_t startPos)
|
||||||
{
|
{
|
||||||
int32_t pos = startPos;
|
int32_t pos = startPos;
|
||||||
// special case of the (...) or | ==> we search '|' or ')'
|
// special case of the (...) or | ==> we search '|' or ')'
|
||||||
@ -331,7 +318,7 @@ int32_t etk::GetLenOfBrace(etk::VectorType<int16_t> &data, int32_t startPos)
|
|||||||
} else if( REGEXP_OPCODE_BRACE_IN == data[pos]) {
|
} else if( REGEXP_OPCODE_BRACE_IN == data[pos]) {
|
||||||
pos++;
|
pos++;
|
||||||
// find size ...
|
// find size ...
|
||||||
while (pos < (int32_t)data.Size() ) {
|
while (pos < (int32_t)data.size() ) {
|
||||||
if(REGEXP_OPCODE_BRACE_OUT == data[pos]) {
|
if(REGEXP_OPCODE_BRACE_OUT == data[pos]) {
|
||||||
// Find the end of the [...]
|
// Find the end of the [...]
|
||||||
// just return the size inside
|
// just return the size inside
|
||||||
@ -366,12 +353,12 @@ int32_t etk::GetLenOfBrace(etk::VectorType<int16_t> &data, int32_t startPos)
|
|||||||
* @return ---
|
* @return ---
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
int32_t etk::GetLenOfNormal(etk::VectorType<int16_t> &data, int32_t startPos)
|
int32_t etk::GetLenOfNormal(std::vector<int16_t> &data, int32_t startPos)
|
||||||
{
|
{
|
||||||
int32_t pos = startPos;
|
int32_t pos = startPos;
|
||||||
|
|
||||||
// find size ...
|
// find size ...
|
||||||
while (pos < (int32_t)data.Size() ) {
|
while (pos < (int32_t)data.size() ) {
|
||||||
switch(data[pos])
|
switch(data[pos])
|
||||||
{
|
{
|
||||||
case REGEXP_OPCODE_PTHESE_IN:
|
case REGEXP_OPCODE_PTHESE_IN:
|
||||||
@ -423,7 +410,7 @@ int32_t etk::GetLenOfNormal(etk::VectorType<int16_t> &data, int32_t startPos)
|
|||||||
* @return ---
|
* @return ---
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
bool etk::ParseBrace(etk::VectorType<int16_t> &data, int32_t &min, int32_t &max)
|
bool etk::ParseBrace(std::vector<int16_t> &data, int32_t &min, int32_t &max)
|
||||||
{
|
{
|
||||||
//TK_INFO("parse {...} in "; DisplayElem(data); );
|
//TK_INFO("parse {...} in "; DisplayElem(data); );
|
||||||
int32_t k=0;
|
int32_t k=0;
|
||||||
@ -431,7 +418,7 @@ bool etk::ParseBrace(etk::VectorType<int16_t> &data, int32_t &min, int32_t &max)
|
|||||||
int32_t firstElement = 0;
|
int32_t firstElement = 0;
|
||||||
int32_t SecondElement = 0;
|
int32_t SecondElement = 0;
|
||||||
|
|
||||||
while(k<data.Size()) {
|
while(k<data.size()) {
|
||||||
if (',' == (char)data[k]) {
|
if (',' == (char)data[k]) {
|
||||||
k++;
|
k++;
|
||||||
break;
|
break;
|
||||||
@ -447,10 +434,10 @@ bool etk::ParseBrace(etk::VectorType<int16_t> &data, int32_t &min, int32_t &max)
|
|||||||
}
|
}
|
||||||
k++;
|
k++;
|
||||||
}
|
}
|
||||||
if (k==data.Size()) {
|
if (k==data.size()) {
|
||||||
SecondElement = firstElement;
|
SecondElement = firstElement;
|
||||||
}
|
}
|
||||||
while(k<data.Size()) {
|
while(k<data.size()) {
|
||||||
if (',' == (char)data[k]) {
|
if (',' == (char)data[k]) {
|
||||||
TK_ERROR("Can not find a second , in {} at pos " << k);
|
TK_ERROR("Can not find a second , in {} at pos " << k);
|
||||||
return false;
|
return false;
|
||||||
|
@ -29,7 +29,7 @@
|
|||||||
#include <etk/DebugInternal.h>
|
#include <etk/DebugInternal.h>
|
||||||
#include <etk/Memory.h>
|
#include <etk/Memory.h>
|
||||||
#include <etk/UString.h>
|
#include <etk/UString.h>
|
||||||
#include <etk/VectorType.h>
|
#include <vector>
|
||||||
|
|
||||||
namespace etk {
|
namespace etk {
|
||||||
|
|
||||||
@ -94,15 +94,15 @@ typedef struct {
|
|||||||
extern const convertionTable_ts constConvertionTable[];
|
extern const convertionTable_ts constConvertionTable[];
|
||||||
extern const int32_t constConvertionTableSize;
|
extern const int32_t constConvertionTableSize;
|
||||||
|
|
||||||
void DisplayData(etk::VectorType<char> &data);
|
void DisplayData(std::vector<char> &data);
|
||||||
void DisplayElem(etk::VectorType<int16_t> &data, int32_t start=0, int32_t stop=0x7FFFFFFF);
|
void DisplayElem(std::vector<int16_t> &data, int32_t start=0, int32_t stop=0x7FFFFFFF);
|
||||||
char * levelSpace(int32_t level);
|
const char * levelSpace(int32_t level);
|
||||||
int32_t GetLenOfPTheseElem(etk::VectorType<int16_t> &data, int32_t startPos);
|
int32_t GetLenOfPTheseElem(std::vector<int16_t> &data, int32_t startPos);
|
||||||
int32_t GetLenOfPThese(etk::VectorType<int16_t> &data, int32_t startPos);
|
int32_t GetLenOfPThese(std::vector<int16_t> &data, int32_t startPos);
|
||||||
int32_t GetLenOfBracket(etk::VectorType<int16_t> &data, int32_t startPos);
|
int32_t GetLenOfBracket(std::vector<int16_t> &data, int32_t startPos);
|
||||||
int32_t GetLenOfBrace(etk::VectorType<int16_t> &data, int32_t startPos);
|
int32_t GetLenOfBrace(std::vector<int16_t> &data, int32_t startPos);
|
||||||
int32_t GetLenOfNormal(etk::VectorType<int16_t> &data, int32_t startPos);
|
int32_t GetLenOfNormal(std::vector<int16_t> &data, int32_t startPos);
|
||||||
bool ParseBrace(etk::VectorType<int16_t> &data, int32_t &min, int32_t &max);
|
bool ParseBrace(std::vector<int16_t> &data, int32_t &min, int32_t &max);
|
||||||
|
|
||||||
|
|
||||||
#undef __class__
|
#undef __class__
|
||||||
@ -139,7 +139,7 @@ template<class CLASS_TYPE> class RegExpNode{
|
|||||||
* @param[in,out]
|
* @param[in,out]
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
virtual int32_t Generate(etk::VectorType<int16_t> &data)
|
virtual int32_t Generate(std::vector<int16_t> &data)
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
};
|
};
|
||||||
@ -199,7 +199,7 @@ template<class CLASS_TYPE> class RegExpNode{
|
|||||||
int32_t m_multipleMin; //!< minimum repetition (included)
|
int32_t m_multipleMin; //!< minimum repetition (included)
|
||||||
int32_t m_multipleMax; //!< maximum repetition (included)
|
int32_t m_multipleMax; //!< maximum repetition (included)
|
||||||
// Data Section ... (can have no data...)
|
// Data Section ... (can have no data...)
|
||||||
etk::VectorType<int16_t> m_RegExpData; //!< data to parse and compare in some case ...
|
std::vector<int16_t> m_RegExpData; //!< data to parse and compare in some case ...
|
||||||
};
|
};
|
||||||
|
|
||||||
#undef __class__
|
#undef __class__
|
||||||
@ -233,15 +233,15 @@ template<class CLASS_TYPE> class RegExpNodeValue : public RegExpNode<CLASS_TYPE>
|
|||||||
* @param[in,out]
|
* @param[in,out]
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
int32_t Generate(etk::VectorType<int16_t> &data)
|
int32_t Generate(std::vector<int16_t> &data)
|
||||||
{
|
{
|
||||||
RegExpNode<CLASS_TYPE>::m_RegExpData = data;
|
RegExpNode<CLASS_TYPE>::m_RegExpData = data;
|
||||||
//TK_DEBUG("Request Parse \"Value\" data="; DisplayElem(RegExpNode<CLASS_TYPE>::m_RegExpData););
|
//TK_DEBUG("Request Parse \"Value\" data="; DisplayElem(RegExpNode<CLASS_TYPE>::m_RegExpData););
|
||||||
m_data.Clear();
|
m_data.clear();
|
||||||
for (int32_t i=0; i<RegExpNode<CLASS_TYPE>::m_RegExpData.Size(); i++) {
|
for (int32_t i=0; i<RegExpNode<CLASS_TYPE>::m_RegExpData.size(); i++) {
|
||||||
m_data.PushBack((char)RegExpNode<CLASS_TYPE>::m_RegExpData[i]);
|
m_data.push_back((char)RegExpNode<CLASS_TYPE>::m_RegExpData[i]);
|
||||||
}
|
}
|
||||||
return data.Size();
|
return data.size();
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -253,7 +253,7 @@ template<class CLASS_TYPE> class RegExpNodeValue : public RegExpNode<CLASS_TYPE>
|
|||||||
{
|
{
|
||||||
findLen = 0;
|
findLen = 0;
|
||||||
//TK_INFO("Parse node : Value{" << RegExpNode<CLASS_TYPE>::m_multipleMin << "," << RegExpNode<CLASS_TYPE>::m_multipleMax << "}");
|
//TK_INFO("Parse node : Value{" << RegExpNode<CLASS_TYPE>::m_multipleMin << "," << RegExpNode<CLASS_TYPE>::m_multipleMax << "}");
|
||||||
if (0==m_data.Size()) {
|
if (0==m_data.size()) {
|
||||||
TK_ERROR("No data inside type elemTypeValue");
|
TK_ERROR("No data inside type elemTypeValue");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -263,14 +263,14 @@ template<class CLASS_TYPE> class RegExpNodeValue : public RegExpNode<CLASS_TYPE>
|
|||||||
for (j=0; j<RegExpNode<CLASS_TYPE>::m_multipleMax && tmpFind == true; j++) {
|
for (j=0; j<RegExpNode<CLASS_TYPE>::m_multipleMax && tmpFind == true; j++) {
|
||||||
int32_t ofset = 0;
|
int32_t ofset = 0;
|
||||||
int32_t k;
|
int32_t k;
|
||||||
for (k=0; findLen+k<lenMax && k < m_data.Size(); k++) {
|
for (k=0; findLen+k<lenMax && k < m_data.size(); k++) {
|
||||||
if (m_data[k] != data[currentPos+findLen+k]) {
|
if (m_data[k] != data[currentPos+findLen+k]) {
|
||||||
tmpFind=false;
|
tmpFind=false;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
ofset++;
|
ofset++;
|
||||||
}
|
}
|
||||||
if (k != (int32_t)m_data.Size()) {
|
if (k != (int32_t)m_data.size()) {
|
||||||
// parsing not ended ...
|
// parsing not ended ...
|
||||||
tmpFind=false;
|
tmpFind=false;
|
||||||
}
|
}
|
||||||
@ -303,7 +303,7 @@ template<class CLASS_TYPE> class RegExpNodeValue : public RegExpNode<CLASS_TYPE>
|
|||||||
};
|
};
|
||||||
protected :
|
protected :
|
||||||
// SubNodes :
|
// SubNodes :
|
||||||
etk::VectorType<char> m_data;
|
std::vector<char> m_data;
|
||||||
};
|
};
|
||||||
#undef __class__
|
#undef __class__
|
||||||
#define __class__ "etk::RegExpNodeBracket"
|
#define __class__ "etk::RegExpNodeBracket"
|
||||||
@ -336,38 +336,38 @@ template<class CLASS_TYPE> class RegExpNodeBracket : public RegExpNode<CLASS_TYP
|
|||||||
* @param[in,out]
|
* @param[in,out]
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
int32_t Generate(etk::VectorType<int16_t> &data)
|
int32_t Generate(std::vector<int16_t> &data)
|
||||||
{
|
{
|
||||||
RegExpNode<CLASS_TYPE>::m_RegExpData = data;
|
RegExpNode<CLASS_TYPE>::m_RegExpData = data;
|
||||||
//TK_DEBUG("Request Parse [...] data="; DisplayElem(RegExpNode<CLASS_TYPE>::m_RegExpData););
|
//TK_DEBUG("Request Parse [...] data="; DisplayElem(RegExpNode<CLASS_TYPE>::m_RegExpData););
|
||||||
m_data.Clear();
|
m_data.clear();
|
||||||
|
|
||||||
char lastElement = 'a';
|
char lastElement = 'a';
|
||||||
bool multipleElement = false;
|
bool multipleElement = false;
|
||||||
//
|
//
|
||||||
for (int32_t k=0; k<RegExpNode<CLASS_TYPE>::m_RegExpData.Size(); k++) {
|
for (int32_t k=0; k<RegExpNode<CLASS_TYPE>::m_RegExpData.size(); k++) {
|
||||||
if (RegExpNode<CLASS_TYPE>::m_RegExpData[k] == REGEXP_OPCODE_TO && multipleElement == true) {
|
if (RegExpNode<CLASS_TYPE>::m_RegExpData[k] == REGEXP_OPCODE_TO && multipleElement == true) {
|
||||||
TK_ERROR("Can not have 2 consecutive - in [...]");
|
TK_ERROR("Can not have 2 consecutive - in [...]");
|
||||||
return 0;
|
return 0;
|
||||||
} else if (multipleElement == true) {
|
} else if (multipleElement == true) {
|
||||||
char j='\0';
|
char j='\0';
|
||||||
for (j=lastElement+1; j <= (char)RegExpNode<CLASS_TYPE>::m_RegExpData[k]; j++) {
|
for (j=lastElement+1; j <= (char)RegExpNode<CLASS_TYPE>::m_RegExpData[k]; j++) {
|
||||||
m_data.PushBack(j);
|
m_data.push_back(j);
|
||||||
}
|
}
|
||||||
multipleElement = false;
|
multipleElement = false;
|
||||||
} else if(RegExpNode<CLASS_TYPE>::m_RegExpData[k] == REGEXP_OPCODE_TO) {
|
} else if(RegExpNode<CLASS_TYPE>::m_RegExpData[k] == REGEXP_OPCODE_TO) {
|
||||||
multipleElement = true;
|
multipleElement = true;
|
||||||
} else {
|
} else {
|
||||||
lastElement = (char)RegExpNode<CLASS_TYPE>::m_RegExpData[k];
|
lastElement = (char)RegExpNode<CLASS_TYPE>::m_RegExpData[k];
|
||||||
m_data.PushBack(lastElement);
|
m_data.push_back(lastElement);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// check size ...
|
// check size ...
|
||||||
if (m_data.Size() == 0) {
|
if (m_data.size() == 0) {
|
||||||
TK_ERROR("No data inside [...] ");
|
TK_ERROR("No data inside [...] ");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
return data.Size();
|
return data.size();
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -379,7 +379,7 @@ template<class CLASS_TYPE> class RegExpNodeBracket : public RegExpNode<CLASS_TYP
|
|||||||
{
|
{
|
||||||
findLen = 0;
|
findLen = 0;
|
||||||
//TK_INFO("Parse node : [...]{" << RegExpNode<CLASS_TYPE>::m_multipleMin << "," << RegExpNode<CLASS_TYPE>::m_multipleMax << "}");
|
//TK_INFO("Parse node : [...]{" << RegExpNode<CLASS_TYPE>::m_multipleMin << "," << RegExpNode<CLASS_TYPE>::m_multipleMax << "}");
|
||||||
if (0==m_data.Size()) {
|
if (0==m_data.size()) {
|
||||||
TK_ERROR("No data inside type elemTypeValue");
|
TK_ERROR("No data inside type elemTypeValue");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -389,7 +389,7 @@ template<class CLASS_TYPE> class RegExpNodeBracket : public RegExpNode<CLASS_TYP
|
|||||||
for (j=0; j<RegExpNode<CLASS_TYPE>::m_multipleMax && tmpFind ==true && j < lenMax; j++) {
|
for (j=0; j<RegExpNode<CLASS_TYPE>::m_multipleMax && tmpFind ==true && j < lenMax; j++) {
|
||||||
int32_t i;
|
int32_t i;
|
||||||
tmpFind=false;
|
tmpFind=false;
|
||||||
for (i=0; i<m_data.Size(); i++) {
|
for (i=0; i<m_data.size(); i++) {
|
||||||
if (m_data[i] == data[currentPos+j]) {
|
if (m_data[i] == data[currentPos+j]) {
|
||||||
findLen += 1;
|
findLen += 1;
|
||||||
tmpFind=true;
|
tmpFind=true;
|
||||||
@ -421,7 +421,7 @@ template<class CLASS_TYPE> class RegExpNodeBracket : public RegExpNode<CLASS_TYP
|
|||||||
};
|
};
|
||||||
protected :
|
protected :
|
||||||
// SubNodes :
|
// SubNodes :
|
||||||
etk::VectorType<char> m_data;
|
std::vector<char> m_data;
|
||||||
};
|
};
|
||||||
#undef __class__
|
#undef __class__
|
||||||
#define __class__ "etk::RegExpNodeDigit"
|
#define __class__ "etk::RegExpNodeDigit"
|
||||||
@ -1211,28 +1211,28 @@ template<class CLASS_TYPE> class RegExpNodePTheseElem : public RegExpNode<CLASS_
|
|||||||
* @param[in,out]
|
* @param[in,out]
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
int32_t Generate(etk::VectorType<int16_t> &data)
|
int32_t Generate(std::vector<int16_t> &data)
|
||||||
{
|
{
|
||||||
RegExpNode<CLASS_TYPE>::m_RegExpData = data;
|
RegExpNode<CLASS_TYPE>::m_RegExpData = data;
|
||||||
//TK_DEBUG("Request Parse (elem) data="; DisplayElem(RegExpNode<CLASS_TYPE>::m_RegExpData););
|
//TK_DEBUG("Request Parse (elem) data="; DisplayElem(RegExpNode<CLASS_TYPE>::m_RegExpData););
|
||||||
|
|
||||||
int32_t pos = 0;
|
int32_t pos = 0;
|
||||||
int32_t elementSize = 0;
|
int32_t elementSize = 0;
|
||||||
etk::VectorType<int16_t> tmpData;
|
std::vector<int16_t> tmpData;
|
||||||
while (pos < RegExpNode<CLASS_TYPE>::m_RegExpData.Size()) {
|
while (pos < RegExpNode<CLASS_TYPE>::m_RegExpData.size()) {
|
||||||
tmpData.Clear();
|
tmpData.clear();
|
||||||
switch (RegExpNode<CLASS_TYPE>::m_RegExpData[pos])
|
switch (RegExpNode<CLASS_TYPE>::m_RegExpData[pos])
|
||||||
{
|
{
|
||||||
case REGEXP_OPCODE_PTHESE_IN:
|
case REGEXP_OPCODE_PTHESE_IN:
|
||||||
{
|
{
|
||||||
elementSize=GetLenOfPThese(RegExpNode<CLASS_TYPE>::m_RegExpData, pos);
|
elementSize=GetLenOfPThese(RegExpNode<CLASS_TYPE>::m_RegExpData, pos);
|
||||||
for (int32_t k=pos+1; k<pos+elementSize+1; k++) {
|
for (int32_t k=pos+1; k<pos+elementSize+1; k++) {
|
||||||
tmpData.PushBack(RegExpNode<CLASS_TYPE>::m_RegExpData[k]);
|
tmpData.push_back(RegExpNode<CLASS_TYPE>::m_RegExpData[k]);
|
||||||
}
|
}
|
||||||
RegExpNodePThese<CLASS_TYPE> * myElem = new RegExpNodePThese<CLASS_TYPE>();
|
RegExpNodePThese<CLASS_TYPE> * myElem = new RegExpNodePThese<CLASS_TYPE>();
|
||||||
(void)myElem->Generate(tmpData);
|
(void)myElem->Generate(tmpData);
|
||||||
// add to the subnode list :
|
// add to the subnode list :
|
||||||
m_subNode.PushBack(myElem);
|
m_subNode.push_back(myElem);
|
||||||
// move current position ...
|
// move current position ...
|
||||||
pos += elementSize+1;
|
pos += elementSize+1;
|
||||||
}
|
}
|
||||||
@ -1245,12 +1245,12 @@ template<class CLASS_TYPE> class RegExpNodePTheseElem : public RegExpNode<CLASS_
|
|||||||
{
|
{
|
||||||
elementSize=GetLenOfBracket(RegExpNode<CLASS_TYPE>::m_RegExpData, pos);
|
elementSize=GetLenOfBracket(RegExpNode<CLASS_TYPE>::m_RegExpData, pos);
|
||||||
for (int32_t k=pos+1; k<pos+elementSize+1; k++) {
|
for (int32_t k=pos+1; k<pos+elementSize+1; k++) {
|
||||||
tmpData.PushBack(RegExpNode<CLASS_TYPE>::m_RegExpData[k]);
|
tmpData.push_back(RegExpNode<CLASS_TYPE>::m_RegExpData[k]);
|
||||||
}
|
}
|
||||||
RegExpNodeBracket<CLASS_TYPE> * myElem = new RegExpNodeBracket<CLASS_TYPE>();
|
RegExpNodeBracket<CLASS_TYPE> * myElem = new RegExpNodeBracket<CLASS_TYPE>();
|
||||||
(void)myElem->Generate(tmpData);
|
(void)myElem->Generate(tmpData);
|
||||||
// add to the subnode list :
|
// add to the subnode list :
|
||||||
m_subNode.PushBack(myElem);
|
m_subNode.push_back(myElem);
|
||||||
// move current position ...
|
// move current position ...
|
||||||
pos += elementSize+1;
|
pos += elementSize+1;
|
||||||
}
|
}
|
||||||
@ -1263,7 +1263,7 @@ template<class CLASS_TYPE> class RegExpNodePTheseElem : public RegExpNode<CLASS_
|
|||||||
{
|
{
|
||||||
elementSize=GetLenOfBrace(RegExpNode<CLASS_TYPE>::m_RegExpData, pos);
|
elementSize=GetLenOfBrace(RegExpNode<CLASS_TYPE>::m_RegExpData, pos);
|
||||||
for (int32_t k=pos+1; k<pos+elementSize+1; k++) {
|
for (int32_t k=pos+1; k<pos+elementSize+1; k++) {
|
||||||
tmpData.PushBack(RegExpNode<CLASS_TYPE>::m_RegExpData[k]);
|
tmpData.push_back(RegExpNode<CLASS_TYPE>::m_RegExpData[k]);
|
||||||
}
|
}
|
||||||
int32_t min = 0;
|
int32_t min = 0;
|
||||||
int32_t max = 0;
|
int32_t max = 0;
|
||||||
@ -1299,59 +1299,59 @@ template<class CLASS_TYPE> class RegExpNodePTheseElem : public RegExpNode<CLASS_
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
case REGEXP_OPCODE_DOT:
|
case REGEXP_OPCODE_DOT:
|
||||||
m_subNode.PushBack(new RegExpNodeDot<CLASS_TYPE>());
|
m_subNode.push_back(new RegExpNodeDot<CLASS_TYPE>());
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case REGEXP_OPCODE_START_OF_LINE:
|
case REGEXP_OPCODE_START_OF_LINE:
|
||||||
m_subNode.PushBack(new RegExpNodeSOL<CLASS_TYPE>());
|
m_subNode.push_back(new RegExpNodeSOL<CLASS_TYPE>());
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case REGEXP_OPCODE_END_OF_LINE:
|
case REGEXP_OPCODE_END_OF_LINE:
|
||||||
m_subNode.PushBack(new RegExpNodeEOL<CLASS_TYPE>());
|
m_subNode.push_back(new RegExpNodeEOL<CLASS_TYPE>());
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case REGEXP_OPCODE_DIGIT:
|
case REGEXP_OPCODE_DIGIT:
|
||||||
m_subNode.PushBack(new RegExpNodeDigit<CLASS_TYPE>());
|
m_subNode.push_back(new RegExpNodeDigit<CLASS_TYPE>());
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case REGEXP_OPCODE_DIGIT_NOT:
|
case REGEXP_OPCODE_DIGIT_NOT:
|
||||||
m_subNode.PushBack(new RegExpNodeDigitNot<CLASS_TYPE>());
|
m_subNode.push_back(new RegExpNodeDigitNot<CLASS_TYPE>());
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case REGEXP_OPCODE_LETTER:
|
case REGEXP_OPCODE_LETTER:
|
||||||
m_subNode.PushBack(new RegExpNodeLetter<CLASS_TYPE>());
|
m_subNode.push_back(new RegExpNodeLetter<CLASS_TYPE>());
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case REGEXP_OPCODE_LETTER_NOT:
|
case REGEXP_OPCODE_LETTER_NOT:
|
||||||
m_subNode.PushBack(new RegExpNodeLetterNot<CLASS_TYPE>());
|
m_subNode.push_back(new RegExpNodeLetterNot<CLASS_TYPE>());
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case REGEXP_OPCODE_SPACE:
|
case REGEXP_OPCODE_SPACE:
|
||||||
m_subNode.PushBack(new RegExpNodeWhiteSpace<CLASS_TYPE>());
|
m_subNode.push_back(new RegExpNodeWhiteSpace<CLASS_TYPE>());
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case REGEXP_OPCODE_SPACE_NOT:
|
case REGEXP_OPCODE_SPACE_NOT:
|
||||||
m_subNode.PushBack(new RegExpNodeWhiteSpaceNot<CLASS_TYPE>());
|
m_subNode.push_back(new RegExpNodeWhiteSpaceNot<CLASS_TYPE>());
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case REGEXP_OPCODE_WORD:
|
case REGEXP_OPCODE_WORD:
|
||||||
m_subNode.PushBack(new RegExpNodeWordChar<CLASS_TYPE>());
|
m_subNode.push_back(new RegExpNodeWordChar<CLASS_TYPE>());
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case REGEXP_OPCODE_WORD_NOT:
|
case REGEXP_OPCODE_WORD_NOT:
|
||||||
m_subNode.PushBack(new RegExpNodeWordCharNot<CLASS_TYPE>());
|
m_subNode.push_back(new RegExpNodeWordCharNot<CLASS_TYPE>());
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
{
|
{
|
||||||
elementSize=GetLenOfNormal(RegExpNode<CLASS_TYPE>::m_RegExpData, pos);
|
elementSize=GetLenOfNormal(RegExpNode<CLASS_TYPE>::m_RegExpData, pos);
|
||||||
for (int32_t k=pos; k<pos+elementSize; k++) {
|
for (int32_t k=pos; k<pos+elementSize; k++) {
|
||||||
tmpData.PushBack(RegExpNode<CLASS_TYPE>::m_RegExpData[k]);
|
tmpData.push_back(RegExpNode<CLASS_TYPE>::m_RegExpData[k]);
|
||||||
}
|
}
|
||||||
RegExpNodeValue<CLASS_TYPE> * myElem = new RegExpNodeValue<CLASS_TYPE>();
|
RegExpNodeValue<CLASS_TYPE> * myElem = new RegExpNodeValue<CLASS_TYPE>();
|
||||||
(void)myElem->Generate(tmpData);
|
(void)myElem->Generate(tmpData);
|
||||||
// add to the subnode list :
|
// add to the subnode list :
|
||||||
m_subNode.PushBack(myElem);
|
m_subNode.push_back(myElem);
|
||||||
// move current position ...
|
// move current position ...
|
||||||
pos += elementSize-1;
|
pos += elementSize-1;
|
||||||
}
|
}
|
||||||
@ -1359,7 +1359,7 @@ template<class CLASS_TYPE> class RegExpNodePTheseElem : public RegExpNode<CLASS_
|
|||||||
}
|
}
|
||||||
pos++;
|
pos++;
|
||||||
}
|
}
|
||||||
return data.Size();
|
return data.size();
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1373,11 +1373,11 @@ template<class CLASS_TYPE> class RegExpNodePTheseElem : public RegExpNode<CLASS_
|
|||||||
//TK_INFO("Parse node : (Elem){" << RegExpNode<CLASS_TYPE>::m_multipleMin << "," << RegExpNode<CLASS_TYPE>::m_multipleMax << "}");
|
//TK_INFO("Parse node : (Elem){" << RegExpNode<CLASS_TYPE>::m_multipleMin << "," << RegExpNode<CLASS_TYPE>::m_multipleMax << "}");
|
||||||
// NOTE 1 : Must done only one time in EVERY case ...
|
// NOTE 1 : Must done only one time in EVERY case ...
|
||||||
// NOTE 2 : All element inside must be OK
|
// NOTE 2 : All element inside must be OK
|
||||||
if (0 == m_subNode.Size()) {
|
if (0 == m_subNode.size()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
int32_t tmpCurrentPos = currentPos;
|
int32_t tmpCurrentPos = currentPos;
|
||||||
for (int32_t i=0; i<m_subNode.Size(); i++) {
|
for (int32_t i=0; i<m_subNode.size(); i++) {
|
||||||
int32_t tmpFindLen;
|
int32_t tmpFindLen;
|
||||||
if (false == m_subNode[i]->Parse(data, tmpCurrentPos, lenMax, tmpFindLen)) {
|
if (false == m_subNode[i]->Parse(data, tmpCurrentPos, lenMax, tmpFindLen)) {
|
||||||
findLen = 0;
|
findLen = 0;
|
||||||
@ -1398,13 +1398,13 @@ template<class CLASS_TYPE> class RegExpNodePTheseElem : public RegExpNode<CLASS_
|
|||||||
void Display(int32_t level)
|
void Display(int32_t level)
|
||||||
{
|
{
|
||||||
TK_INFO("Find NODE : " << levelSpace(level) << "@(Elem)@ {" << RegExpNode<CLASS_TYPE>::m_multipleMin << "," << RegExpNode<CLASS_TYPE>::m_multipleMax << "} subdata="; DisplayElem(RegExpNode<CLASS_TYPE>::m_RegExpData););
|
TK_INFO("Find NODE : " << levelSpace(level) << "@(Elem)@ {" << RegExpNode<CLASS_TYPE>::m_multipleMin << "," << RegExpNode<CLASS_TYPE>::m_multipleMax << "} subdata="; DisplayElem(RegExpNode<CLASS_TYPE>::m_RegExpData););
|
||||||
for(int32_t i=0; i<m_subNode.Size(); i++) {
|
for(int32_t i=0; i<m_subNode.size(); i++) {
|
||||||
m_subNode[i]->Display(level+1);
|
m_subNode[i]->Display(level+1);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
protected :
|
protected :
|
||||||
// SubNodes :
|
// SubNodes :
|
||||||
etk::VectorType<RegExpNode<CLASS_TYPE>*> m_subNode;
|
std::vector<RegExpNode<CLASS_TYPE>*> m_subNode;
|
||||||
private :
|
private :
|
||||||
/**
|
/**
|
||||||
* @brief Set the number of repeate time on a the last node in the list ...
|
* @brief Set the number of repeate time on a the last node in the list ...
|
||||||
@ -1417,11 +1417,11 @@ template<class CLASS_TYPE> class RegExpNodePTheseElem : public RegExpNode<CLASS_
|
|||||||
*/
|
*/
|
||||||
bool SetMultiplicityOnLastNode(int32_t min, int32_t max)
|
bool SetMultiplicityOnLastNode(int32_t min, int32_t max)
|
||||||
{
|
{
|
||||||
if (0==m_subNode.Size()) {
|
if (0==m_subNode.size()) {
|
||||||
TK_ERROR("Set multiplicity on an inexistant element ....");
|
TK_ERROR("Set multiplicity on an inexistant element ....");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
RegExpNode<CLASS_TYPE> * myNode = m_subNode[m_subNode.Size()-1];
|
RegExpNode<CLASS_TYPE> * myNode = m_subNode[m_subNode.size()-1];
|
||||||
if (NULL==myNode) {
|
if (NULL==myNode) {
|
||||||
TK_ERROR("INTERNAL error ==> node not generated");
|
TK_ERROR("INTERNAL error ==> node not generated");
|
||||||
return false;
|
return false;
|
||||||
@ -1461,7 +1461,7 @@ template<class CLASS_TYPE> class RegExpNodePThese : public RegExpNode<CLASS_TYPE
|
|||||||
* @param[in,out]
|
* @param[in,out]
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
int32_t Generate(etk::VectorType<int16_t> &data)
|
int32_t Generate(std::vector<int16_t> &data)
|
||||||
{
|
{
|
||||||
RegExpNode<CLASS_TYPE>::m_RegExpData = data;
|
RegExpNode<CLASS_TYPE>::m_RegExpData = data;
|
||||||
//TK_DEBUG("Request Parse (...) data="; DisplayElem(RegExpNode<CLASS_TYPE>::m_RegExpData););
|
//TK_DEBUG("Request Parse (...) data="; DisplayElem(RegExpNode<CLASS_TYPE>::m_RegExpData););
|
||||||
@ -1471,14 +1471,14 @@ template<class CLASS_TYPE> class RegExpNodePThese : public RegExpNode<CLASS_TYPE
|
|||||||
// generate all the "elemTypePTheseElem" of the Node
|
// generate all the "elemTypePTheseElem" of the Node
|
||||||
while (elementSize>0) {
|
while (elementSize>0) {
|
||||||
// geerate output deta ...
|
// geerate output deta ...
|
||||||
etk::VectorType<int16_t> tmpData;
|
std::vector<int16_t> tmpData;
|
||||||
for (int32_t k=pos; k<pos+elementSize; k++) {
|
for (int32_t k=pos; k<pos+elementSize; k++) {
|
||||||
tmpData.PushBack(RegExpNode<CLASS_TYPE>::m_RegExpData[k]);
|
tmpData.push_back(RegExpNode<CLASS_TYPE>::m_RegExpData[k]);
|
||||||
}
|
}
|
||||||
RegExpNodePTheseElem<CLASS_TYPE> * myElem = new RegExpNodePTheseElem<CLASS_TYPE>();
|
RegExpNodePTheseElem<CLASS_TYPE> * myElem = new RegExpNodePTheseElem<CLASS_TYPE>();
|
||||||
(void)myElem->Generate(tmpData);
|
(void)myElem->Generate(tmpData);
|
||||||
// add to the subnode list :
|
// add to the subnode list :
|
||||||
m_subNode.PushBack(myElem);
|
m_subNode.push_back(myElem);
|
||||||
pos += elementSize+1;
|
pos += elementSize+1;
|
||||||
//TK_DEBUG("plop="; DisplayElem(data, pos, pos+1););
|
//TK_DEBUG("plop="; DisplayElem(data, pos, pos+1););
|
||||||
elementSize = GetLenOfPTheseElem(RegExpNode<CLASS_TYPE>::m_RegExpData, pos);
|
elementSize = GetLenOfPTheseElem(RegExpNode<CLASS_TYPE>::m_RegExpData, pos);
|
||||||
@ -1488,7 +1488,7 @@ template<class CLASS_TYPE> class RegExpNodePThese : public RegExpNode<CLASS_TYPE
|
|||||||
TK_ERROR("No data in the (...) element at " << pos);
|
TK_ERROR("No data in the (...) element at " << pos);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return data.Size();
|
return data.size();
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1500,14 +1500,14 @@ template<class CLASS_TYPE> class RegExpNodePThese : public RegExpNode<CLASS_TYPE
|
|||||||
{
|
{
|
||||||
findLen = 0;
|
findLen = 0;
|
||||||
//TK_INFO("Parse node : (...){" << RegExpNode<CLASS_TYPE>::m_multipleMin << "," << RegExpNode<CLASS_TYPE>::m_multipleMax << "}");
|
//TK_INFO("Parse node : (...){" << RegExpNode<CLASS_TYPE>::m_multipleMin << "," << RegExpNode<CLASS_TYPE>::m_multipleMax << "}");
|
||||||
if (0 == m_subNode.Size()) {
|
if (0 == m_subNode.size()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
bool tmpFind = true;
|
bool tmpFind = true;
|
||||||
int32_t j;
|
int32_t j;
|
||||||
for (j=0; j<RegExpNode<CLASS_TYPE>::m_multipleMax && tmpFind == true ; j++) {
|
for (j=0; j<RegExpNode<CLASS_TYPE>::m_multipleMax && tmpFind == true ; j++) {
|
||||||
tmpFind = false;
|
tmpFind = false;
|
||||||
for (int32_t i=0; i<m_subNode.Size(); i++) {
|
for (int32_t i=0; i<m_subNode.size(); i++) {
|
||||||
int32_t tmpFindLen;
|
int32_t tmpFindLen;
|
||||||
if (true == m_subNode[i]->Parse(data, currentPos+findLen, lenMax, tmpFindLen)) {
|
if (true == m_subNode[i]->Parse(data, currentPos+findLen, lenMax, tmpFindLen)) {
|
||||||
findLen += tmpFindLen;
|
findLen += tmpFindLen;
|
||||||
@ -1539,7 +1539,7 @@ template<class CLASS_TYPE> class RegExpNodePThese : public RegExpNode<CLASS_TYPE
|
|||||||
TK_INFO("regExp :"; DisplayElem(RegExpNode<CLASS_TYPE>::m_RegExpData););
|
TK_INFO("regExp :"; DisplayElem(RegExpNode<CLASS_TYPE>::m_RegExpData););
|
||||||
} else {
|
} else {
|
||||||
TK_INFO("Find NODE : " << levelSpace(level) << "@(...)@ {" << RegExpNode<CLASS_TYPE>::m_multipleMin << "," << RegExpNode<CLASS_TYPE>::m_multipleMax << "} subdata="; DisplayElem(RegExpNode<CLASS_TYPE>::m_RegExpData););
|
TK_INFO("Find NODE : " << levelSpace(level) << "@(...)@ {" << RegExpNode<CLASS_TYPE>::m_multipleMin << "," << RegExpNode<CLASS_TYPE>::m_multipleMax << "} subdata="; DisplayElem(RegExpNode<CLASS_TYPE>::m_RegExpData););
|
||||||
for(int32_t i=0; i<m_subNode.Size(); i++) {
|
for(int32_t i=0; i<m_subNode.size(); i++) {
|
||||||
m_subNode[i]->Display(level+1);
|
m_subNode[i]->Display(level+1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1547,7 +1547,7 @@ template<class CLASS_TYPE> class RegExpNodePThese : public RegExpNode<CLASS_TYPE
|
|||||||
|
|
||||||
protected :
|
protected :
|
||||||
// SubNodes :
|
// SubNodes :
|
||||||
etk::VectorType<RegExpNode<CLASS_TYPE>*> m_subNode;
|
std::vector<RegExpNode<CLASS_TYPE>*> m_subNode;
|
||||||
//int32_t m_posPthese; //!< position of the element is detected in the output element
|
//int32_t m_posPthese; //!< position of the element is detected in the output element
|
||||||
};
|
};
|
||||||
#undef __class__
|
#undef __class__
|
||||||
@ -1634,7 +1634,7 @@ template<class CLASS_TYPE> class RegExp {
|
|||||||
void SetRegExp(etk::UString &expressionRequested)
|
void SetRegExp(etk::UString &expressionRequested)
|
||||||
{
|
{
|
||||||
m_expressionRequested = expressionRequested; // TODO : Must be deprecated ...
|
m_expressionRequested = expressionRequested; // TODO : Must be deprecated ...
|
||||||
etk::VectorType<int16_t> tmpExp;
|
std::vector<int16_t> tmpExp;
|
||||||
|
|
||||||
//TK_DEBUG("Parse RegExp : " << expressionRequested.c_str() );
|
//TK_DEBUG("Parse RegExp : " << expressionRequested.c_str() );
|
||||||
m_isOk = false;
|
m_isOk = false;
|
||||||
@ -1667,7 +1667,7 @@ template<class CLASS_TYPE> class RegExp {
|
|||||||
if( true == constConvertionTable[j].haveBackSlash
|
if( true == constConvertionTable[j].haveBackSlash
|
||||||
&& exp[iii+1] == constConvertionTable[j].inputValue)
|
&& exp[iii+1] == constConvertionTable[j].inputValue)
|
||||||
{
|
{
|
||||||
tmpExp.PushBack(constConvertionTable[j].newValue);
|
tmpExp.push_back(constConvertionTable[j].newValue);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1699,13 +1699,13 @@ template<class CLASS_TYPE> class RegExp {
|
|||||||
if( false == constConvertionTable[j].haveBackSlash
|
if( false == constConvertionTable[j].haveBackSlash
|
||||||
&& exp[iii] == constConvertionTable[j].inputValue)
|
&& exp[iii] == constConvertionTable[j].inputValue)
|
||||||
{
|
{
|
||||||
tmpExp.PushBack(constConvertionTable[j].newValue);
|
tmpExp.push_back(constConvertionTable[j].newValue);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// not find : normal element
|
// not find : normal element
|
||||||
if (j==constConvertionTableSize) {
|
if (j==constConvertionTableSize) {
|
||||||
tmpExp.PushBack( ((int16_t)exp[iii]) & 0x00FF);
|
tmpExp.push_back( ((int16_t)exp[iii]) & 0x00FF);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1730,25 +1730,25 @@ template<class CLASS_TYPE> class RegExp {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
//TK_DEBUG("Main element :"; DisplayElem(tmpExp, 0, tmpExp.Size()); );
|
//TK_DEBUG("Main element :"; DisplayElem(tmpExp, 0, tmpExp.size()); );
|
||||||
if( tmpExp.Size()>0
|
if( tmpExp.size()>0
|
||||||
&& REGEXP_OPCODE_NO_CHAR == tmpExp[0])
|
&& REGEXP_OPCODE_NO_CHAR == tmpExp[0])
|
||||||
{
|
{
|
||||||
//TK_DEBUG("=> must not begin with char");
|
//TK_DEBUG("=> must not begin with char");
|
||||||
m_notBeginWithChar = true;
|
m_notBeginWithChar = true;
|
||||||
// remove element
|
// remove element
|
||||||
tmpExp.Erase(0);
|
tmpExp.erase(tmpExp.begin());
|
||||||
}
|
}
|
||||||
if( tmpExp.Size()>0
|
if( tmpExp.size()>0
|
||||||
&& REGEXP_OPCODE_NO_CHAR == tmpExp[tmpExp.Size()-1])
|
&& REGEXP_OPCODE_NO_CHAR == *tmpExp.end())
|
||||||
{
|
{
|
||||||
//TK_DEBUG("=> must not end with char");
|
//TK_DEBUG("=> must not end with char");
|
||||||
m_notEndWithChar = true;
|
m_notEndWithChar = true;
|
||||||
// remove element
|
// remove element
|
||||||
tmpExp.Erase(tmpExp.Size()-1);
|
tmpExp.erase(tmpExp.end());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tmpExp.Size() != m_exprRootNode.Generate(tmpExp) ) {
|
if (tmpExp.size() != m_exprRootNode.Generate(tmpExp) ) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// TODO : optimize node here ...
|
// TODO : optimize node here ...
|
||||||
@ -1793,7 +1793,7 @@ template<class CLASS_TYPE> class RegExp {
|
|||||||
if (false == m_isOk) {
|
if (false == m_isOk) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
int32_t buflen = SearchIn.Size();
|
int32_t buflen = SearchIn.size();
|
||||||
if (endPos > buflen) {
|
if (endPos > buflen) {
|
||||||
endPos = buflen;
|
endPos = buflen;
|
||||||
}
|
}
|
||||||
@ -1831,7 +1831,7 @@ template<class CLASS_TYPE> class RegExp {
|
|||||||
}
|
}
|
||||||
// Check end :
|
// Check end :
|
||||||
if (true == m_notEndWithChar) {
|
if (true == m_notEndWithChar) {
|
||||||
if (i+findLen < SearchIn.Size() ) {
|
if (i+findLen < SearchIn.size() ) {
|
||||||
char tmpVal = SearchIn[i+findLen];
|
char tmpVal = SearchIn[i+findLen];
|
||||||
if( ( 'a' <= tmpVal
|
if( ( 'a' <= tmpVal
|
||||||
&& 'z' >= tmpVal )
|
&& 'z' >= tmpVal )
|
||||||
@ -1874,7 +1874,7 @@ template<class CLASS_TYPE> class RegExp {
|
|||||||
if (false == m_isOk) {
|
if (false == m_isOk) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
int32_t buflen = SearchIn.Size();
|
int32_t buflen = SearchIn.size();
|
||||||
if (endPos > buflen) {
|
if (endPos > buflen) {
|
||||||
endPos = buflen;
|
endPos = buflen;
|
||||||
}
|
}
|
||||||
@ -1910,7 +1910,7 @@ template<class CLASS_TYPE> class RegExp {
|
|||||||
}
|
}
|
||||||
// Check end :
|
// Check end :
|
||||||
if (true == m_notEndWithChar) {
|
if (true == m_notEndWithChar) {
|
||||||
if (startPos+findLen < SearchIn.Size() ) {
|
if (startPos+findLen < SearchIn.size() ) {
|
||||||
char tmpVal = SearchIn[startPos+findLen];
|
char tmpVal = SearchIn[startPos+findLen];
|
||||||
if( ( 'a' <= tmpVal
|
if( ( 'a' <= tmpVal
|
||||||
&& 'z' >= tmpVal )
|
&& 'z' >= tmpVal )
|
||||||
@ -1977,7 +1977,7 @@ template<class CLASS_TYPE> class RegExp {
|
|||||||
* @param[in,out]
|
* @param[in,out]
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
bool CheckGoodPosition(etk::VectorType<int16_t> tmpExp, int32_t &pos)
|
bool CheckGoodPosition(std::vector<int16_t> tmpExp, int32_t &pos)
|
||||||
{
|
{
|
||||||
int16_t curentCode = tmpExp[pos];
|
int16_t curentCode = tmpExp[pos];
|
||||||
int16_t endCode = REGEXP_OPCODE_PTHESE_OUT;
|
int16_t endCode = REGEXP_OPCODE_PTHESE_OUT;
|
||||||
@ -1990,7 +1990,7 @@ template<class CLASS_TYPE> class RegExp {
|
|||||||
input = (char*)"{x,x}";
|
input = (char*)"{x,x}";
|
||||||
}
|
}
|
||||||
pos++;
|
pos++;
|
||||||
if (pos >= (int32_t)tmpExp.Size()) {
|
if (pos >= (int32_t)tmpExp.size()) {
|
||||||
TK_ERROR("ended with: ( or { or [ ... not permited");
|
TK_ERROR("ended with: ( or { or [ ... not permited");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -1998,7 +1998,7 @@ template<class CLASS_TYPE> class RegExp {
|
|||||||
// case dependent :
|
// case dependent :
|
||||||
if( REGEXP_OPCODE_BRACKET_IN == curentCode
|
if( REGEXP_OPCODE_BRACKET_IN == curentCode
|
||||||
|| REGEXP_OPCODE_BRACE_IN == curentCode) {
|
|| REGEXP_OPCODE_BRACE_IN == curentCode) {
|
||||||
while(pos< (int32_t)tmpExp.Size()) {
|
while(pos< (int32_t)tmpExp.size()) {
|
||||||
//TK_DEBUG("check : " << tmpExp[pos]);
|
//TK_DEBUG("check : " << tmpExp[pos]);
|
||||||
// if we find the end :
|
// if we find the end :
|
||||||
if (endCode == tmpExp[pos]) {
|
if (endCode == tmpExp[pos]) {
|
||||||
@ -2041,7 +2041,7 @@ template<class CLASS_TYPE> class RegExp {
|
|||||||
pos++;
|
pos++;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
while(pos< (int32_t)tmpExp.Size()) {
|
while(pos< (int32_t)tmpExp.size()) {
|
||||||
if (endCode == tmpExp[pos]) {
|
if (endCode == tmpExp[pos]) {
|
||||||
// find the last element
|
// find the last element
|
||||||
return true;
|
return true;
|
||||||
@ -2083,10 +2083,10 @@ template<class CLASS_TYPE> class RegExp {
|
|||||||
* @param[in,out]
|
* @param[in,out]
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
bool CheckGoodPosition(etk::VectorType<int16_t> tmpExp)
|
bool CheckGoodPosition(std::vector<int16_t> tmpExp)
|
||||||
{
|
{
|
||||||
int32_t pos = 0;
|
int32_t pos = 0;
|
||||||
while (pos < (int32_t)tmpExp.Size()) {
|
while (pos < (int32_t)tmpExp.size()) {
|
||||||
//TK_DEBUG("check : " << tmpExp[pos]);
|
//TK_DEBUG("check : " << tmpExp[pos]);
|
||||||
if( REGEXP_OPCODE_PTHESE_IN == tmpExp[pos]
|
if( REGEXP_OPCODE_PTHESE_IN == tmpExp[pos]
|
||||||
|| REGEXP_OPCODE_BRACKET_IN == tmpExp[pos]
|
|| REGEXP_OPCODE_BRACKET_IN == tmpExp[pos]
|
||||||
|
@ -22,6 +22,7 @@
|
|||||||
*******************************************************************************
|
*******************************************************************************
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <etk/DebugInternal.h>
|
||||||
#include <etk/UString.h>
|
#include <etk/UString.h>
|
||||||
#include <etk/Memory.h>
|
#include <etk/Memory.h>
|
||||||
#include <etk/unicode.h>
|
#include <etk/unicode.h>
|
||||||
@ -47,9 +48,9 @@ int32_t strlen(const uniChar_t * data)
|
|||||||
|
|
||||||
etk::CCout& etk::operator <<(etk::CCout &os, const etk::UString &obj)
|
etk::CCout& etk::operator <<(etk::CCout &os, const etk::UString &obj)
|
||||||
{
|
{
|
||||||
etk::VectorType<char> output_UTF8;
|
std::vector<char> output_UTF8;
|
||||||
unicode::convertUnicodeToUtf8(obj.m_data, output_UTF8);
|
unicode::convertUnicodeToUtf8(obj.m_data, output_UTF8);
|
||||||
output_UTF8.PushBack('\0');
|
output_UTF8.push_back('\0');
|
||||||
os << &output_UTF8[0];
|
os << &output_UTF8[0];
|
||||||
return os;
|
return os;
|
||||||
}
|
}
|
||||||
@ -64,8 +65,8 @@ etk::CCout& etk::operator <<(etk::CCout &os, const etk::UString &obj)
|
|||||||
*/
|
*/
|
||||||
etk::UString::~UString(void)
|
etk::UString::~UString(void)
|
||||||
{
|
{
|
||||||
m_data.Clear();
|
m_data.clear();
|
||||||
m_dataUtf8.Clear();
|
m_dataUtf8.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -80,8 +81,8 @@ etk::UString::~UString(void)
|
|||||||
etk::UString::UString(void)
|
etk::UString::UString(void)
|
||||||
{
|
{
|
||||||
//TK_INFO("new etk::UString()");
|
//TK_INFO("new etk::UString()");
|
||||||
m_data.Clear();
|
m_data.clear();
|
||||||
m_data.PushBack('\0');
|
m_data.push_back('\0');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -95,8 +96,8 @@ etk::UString::UString(void)
|
|||||||
*/
|
*/
|
||||||
etk::UString::UString(const char* inputData, int32_t len)
|
etk::UString::UString(const char* inputData, int32_t len)
|
||||||
{
|
{
|
||||||
m_data.Clear();
|
m_data.clear();
|
||||||
m_data.PushBack('\0');
|
m_data.push_back('\0');
|
||||||
Set(inputData, len);
|
Set(inputData, len);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -111,8 +112,8 @@ etk::UString::UString(const char* inputData, int32_t len)
|
|||||||
*/
|
*/
|
||||||
etk::UString::UString(const uniChar_t* inputData, int32_t len)
|
etk::UString::UString(const uniChar_t* inputData, int32_t len)
|
||||||
{
|
{
|
||||||
m_data.Clear();
|
m_data.clear();
|
||||||
m_data.PushBack('\0');
|
m_data.push_back('\0');
|
||||||
Set(inputData, len);
|
Set(inputData, len);
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
@ -135,18 +136,18 @@ void etk::UString::Set(const char * inputData, int32_t len)
|
|||||||
len = strlen(inputData);
|
len = strlen(inputData);
|
||||||
}
|
}
|
||||||
// convert the string
|
// convert the string
|
||||||
etk::VectorType<char> tmpChar;
|
std::vector<char> tmpChar;
|
||||||
for (int32_t iii=0; iii<len; iii++) {
|
for (int32_t iii=0; iii<len; iii++) {
|
||||||
tmpChar.PushBack(inputData[iii]);
|
tmpChar.push_back(inputData[iii]);
|
||||||
}
|
}
|
||||||
// add it ...
|
// add it ...
|
||||||
if (len != 0) {
|
if (len != 0) {
|
||||||
// remove the last '\0'
|
// remove the last '\0'
|
||||||
m_data.PopBack();
|
m_data.pop_back();
|
||||||
// copy the data ...
|
// copy the data ...
|
||||||
unicode::convertUtf8ToUnicode(tmpChar, m_data);
|
unicode::convertUtf8ToUnicode(tmpChar, m_data);
|
||||||
// add the last '\0'
|
// add the last '\0'
|
||||||
m_data.PushBack('\0');
|
m_data.push_back('\0');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -163,11 +164,13 @@ void etk::UString::Set(const uniChar_t * inputData, int32_t len)
|
|||||||
|
|
||||||
if (len != 0) {
|
if (len != 0) {
|
||||||
// remove the last '\0'
|
// remove the last '\0'
|
||||||
m_data.PopBack();
|
m_data.pop_back();
|
||||||
// copy the data ...
|
// copy the data ...
|
||||||
m_data.PushBack(inputData, len);
|
for (int32_t iii=0; iii<len; iii++) {
|
||||||
|
m_data.push_back(inputData[iii]);
|
||||||
|
}
|
||||||
// add the last '\0'
|
// add the last '\0'
|
||||||
m_data.PushBack('\0');
|
m_data.push_back('\0');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
@ -184,8 +187,8 @@ etk::UString::UString(char inputData)
|
|||||||
// generate the UString :
|
// generate the UString :
|
||||||
sprintf(tmpVal, "%c", inputData);
|
sprintf(tmpVal, "%c", inputData);
|
||||||
// set the internal data :
|
// set the internal data :
|
||||||
m_data.Clear();
|
m_data.clear();
|
||||||
m_data.PushBack('\0');
|
m_data.push_back('\0');
|
||||||
Set(tmpVal);
|
Set(tmpVal);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -196,8 +199,8 @@ etk::UString::UString(int inputData)
|
|||||||
// generate the UString :
|
// generate the UString :
|
||||||
sprintf(tmpVal, "%d", inputData);
|
sprintf(tmpVal, "%d", inputData);
|
||||||
// set the internal data :
|
// set the internal data :
|
||||||
m_data.Clear();
|
m_data.clear();
|
||||||
m_data.PushBack('\0');
|
m_data.push_back('\0');
|
||||||
Set(tmpVal);
|
Set(tmpVal);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -216,8 +219,8 @@ etk::UString::UString(unsigned int inputData)
|
|||||||
// generate the UString :
|
// generate the UString :
|
||||||
sprintf(tmpVal, "%d", inputData);
|
sprintf(tmpVal, "%d", inputData);
|
||||||
// set the internal data :
|
// set the internal data :
|
||||||
m_data.Clear();
|
m_data.clear();
|
||||||
m_data.PushBack('\0');
|
m_data.push_back('\0');
|
||||||
Set(tmpVal);
|
Set(tmpVal);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -227,8 +230,8 @@ etk::UString::UString(float inputData)
|
|||||||
// generate the UString :
|
// generate the UString :
|
||||||
sprintf(tmpVal, "%f", inputData);
|
sprintf(tmpVal, "%f", inputData);
|
||||||
// set the internal data :
|
// set the internal data :
|
||||||
m_data.Clear();
|
m_data.clear();
|
||||||
m_data.PushBack('\0');
|
m_data.push_back('\0');
|
||||||
Set(tmpVal);
|
Set(tmpVal);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -238,8 +241,8 @@ etk::UString::UString(double inputData)
|
|||||||
// generate the UString :
|
// generate the UString :
|
||||||
sprintf(tmpVal, "%lf", inputData);
|
sprintf(tmpVal, "%lf", inputData);
|
||||||
// set the internal data :
|
// set the internal data :
|
||||||
m_data.Clear();
|
m_data.clear();
|
||||||
m_data.PushBack('\0');
|
m_data.push_back('\0');
|
||||||
Set(tmpVal);
|
Set(tmpVal);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -276,9 +279,9 @@ const etk::UString& etk::UString::operator= (const etk::UString &etkS )
|
|||||||
* @return
|
* @return
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
const etk::UString& etk::UString::operator= (etk::VectorType<char> inputData)
|
const etk::UString& etk::UString::operator= (std::vector<char> inputData)
|
||||||
{
|
{
|
||||||
etk::VectorType<uniChar_t> output_Unicode;
|
std::vector<uniChar_t> output_Unicode;
|
||||||
unicode::convertUtf8ToUnicode(inputData, output_Unicode);
|
unicode::convertUtf8ToUnicode(inputData, output_Unicode);
|
||||||
*this = output_Unicode;
|
*this = output_Unicode;
|
||||||
return *this;
|
return *this;
|
||||||
@ -292,9 +295,9 @@ const etk::UString& etk::UString::operator= (etk::VectorType<char> inputData)
|
|||||||
* @return
|
* @return
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
const etk::UString& etk::UString::operator= (etk::VectorType<int8_t> inputData)
|
const etk::UString& etk::UString::operator= (std::vector<int8_t> inputData)
|
||||||
{
|
{
|
||||||
etk::VectorType<uniChar_t> output_Unicode;
|
std::vector<uniChar_t> output_Unicode;
|
||||||
unicode::convertUtf8ToUnicode(inputData, output_Unicode);
|
unicode::convertUtf8ToUnicode(inputData, output_Unicode);
|
||||||
*this = output_Unicode;
|
*this = output_Unicode;
|
||||||
return *this;
|
return *this;
|
||||||
@ -309,12 +312,12 @@ const etk::UString& etk::UString::operator= (etk::VectorType<int8_t> inputData)
|
|||||||
* @return
|
* @return
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
const etk::UString& etk::UString::operator= (etk::VectorType<uniChar_t> inputData)
|
const etk::UString& etk::UString::operator= (std::vector<uniChar_t> inputData)
|
||||||
{
|
{
|
||||||
m_data = inputData;
|
m_data = inputData;
|
||||||
if (m_data.Size()>0) {
|
if (m_data.size()>0) {
|
||||||
if (m_data[m_data.Size()-1] != '\0') {
|
if (m_data[m_data.size()-1] != '\0') {
|
||||||
m_data.PushBack('\0');
|
m_data.push_back('\0');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//TK_DEBUG("m_dataLen="<<m_dataLen << " m_dataLenUTF8="<<m_dataLenUTF8 << " description=" << m_data);
|
//TK_DEBUG("m_dataLen="<<m_dataLen << " m_dataLenUTF8="<<m_dataLenUTF8 << " description=" << m_data);
|
||||||
@ -343,7 +346,7 @@ uniChar_t changeOrder(uniChar_t elemA)
|
|||||||
bool etk::UString::operator> (const etk::UString& etkS) const
|
bool etk::UString::operator> (const etk::UString& etkS) const
|
||||||
{
|
{
|
||||||
if( this != &etkS ) {
|
if( this != &etkS ) {
|
||||||
for (int32_t iii=0; iii < m_data.Size() && iii < etkS.m_data.Size(); iii++) {
|
for (int32_t iii=0; iii < m_data.size() && iii < etkS.m_data.size(); iii++) {
|
||||||
//TK_DEBUG(" compare : '" << (char)m_data[iii] << "'>'" << (char)etkS.m_data[iii] << "' ==> " << changeOrder(m_data[iii]) << ">" << changeOrder(etkS.m_data[iii]) << "");
|
//TK_DEBUG(" compare : '" << (char)m_data[iii] << "'>'" << (char)etkS.m_data[iii] << "' ==> " << changeOrder(m_data[iii]) << ">" << changeOrder(etkS.m_data[iii]) << "");
|
||||||
uniChar_t elemA = changeOrder(m_data[iii]);
|
uniChar_t elemA = changeOrder(m_data[iii]);
|
||||||
uniChar_t elemB = changeOrder(etkS.m_data[iii]);
|
uniChar_t elemB = changeOrder(etkS.m_data[iii]);
|
||||||
@ -354,7 +357,7 @@ bool etk::UString::operator> (const etk::UString& etkS) const
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (m_data.Size() > etkS.m_data.Size()) {
|
if (m_data.size() > etkS.m_data.size()) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -364,7 +367,7 @@ bool etk::UString::operator> (const etk::UString& etkS) const
|
|||||||
bool etk::UString::operator>= (const etk::UString& etkS) const
|
bool etk::UString::operator>= (const etk::UString& etkS) const
|
||||||
{
|
{
|
||||||
if( this != &etkS ) {
|
if( this != &etkS ) {
|
||||||
for (int32_t iii=0; iii < m_data.Size() && iii < etkS.m_data.Size(); iii++) {
|
for (int32_t iii=0; iii < m_data.size() && iii < etkS.m_data.size(); iii++) {
|
||||||
uniChar_t elemA = changeOrder(m_data[iii]);
|
uniChar_t elemA = changeOrder(m_data[iii]);
|
||||||
uniChar_t elemB = changeOrder(etkS.m_data[iii]);
|
uniChar_t elemB = changeOrder(etkS.m_data[iii]);
|
||||||
if (elemA != elemB) {
|
if (elemA != elemB) {
|
||||||
@ -374,7 +377,7 @@ bool etk::UString::operator>= (const etk::UString& etkS) const
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (m_data.Size() >= etkS.m_data.Size()) {
|
if (m_data.size() >= etkS.m_data.size()) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -384,7 +387,7 @@ bool etk::UString::operator>= (const etk::UString& etkS) const
|
|||||||
bool etk::UString::operator< (const etk::UString& etkS) const
|
bool etk::UString::operator< (const etk::UString& etkS) const
|
||||||
{
|
{
|
||||||
if( this != &etkS ) {
|
if( this != &etkS ) {
|
||||||
for (int32_t iii=0; iii < m_data.Size() && iii < etkS.m_data.Size(); iii++) {
|
for (int32_t iii=0; iii < m_data.size() && iii < etkS.m_data.size(); iii++) {
|
||||||
uniChar_t elemA = changeOrder(m_data[iii]);
|
uniChar_t elemA = changeOrder(m_data[iii]);
|
||||||
uniChar_t elemB = changeOrder(etkS.m_data[iii]);
|
uniChar_t elemB = changeOrder(etkS.m_data[iii]);
|
||||||
if (elemA != elemB) {
|
if (elemA != elemB) {
|
||||||
@ -394,7 +397,7 @@ bool etk::UString::operator< (const etk::UString& etkS) const
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (m_data.Size() < etkS.m_data.Size()) {
|
if (m_data.size() < etkS.m_data.size()) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -404,7 +407,7 @@ bool etk::UString::operator< (const etk::UString& etkS) const
|
|||||||
bool etk::UString::operator<= (const etk::UString& etkS) const
|
bool etk::UString::operator<= (const etk::UString& etkS) const
|
||||||
{
|
{
|
||||||
if( this != &etkS ) {
|
if( this != &etkS ) {
|
||||||
for (int32_t iii=0; iii < m_data.Size() && iii < etkS.m_data.Size(); iii++) {
|
for (int32_t iii=0; iii < m_data.size() && iii < etkS.m_data.size(); iii++) {
|
||||||
uniChar_t elemA = changeOrder(m_data[iii]);
|
uniChar_t elemA = changeOrder(m_data[iii]);
|
||||||
uniChar_t elemB = changeOrder(etkS.m_data[iii]);
|
uniChar_t elemB = changeOrder(etkS.m_data[iii]);
|
||||||
if (elemA != elemB) {
|
if (elemA != elemB) {
|
||||||
@ -414,7 +417,7 @@ bool etk::UString::operator<= (const etk::UString& etkS) const
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (m_data.Size() <= etkS.m_data.Size()) {
|
if (m_data.size() <= etkS.m_data.size()) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -433,11 +436,11 @@ bool etk::UString::operator<= (const etk::UString& etkS) const
|
|||||||
bool etk::UString::operator== (const etk::UString& etkS) const
|
bool etk::UString::operator== (const etk::UString& etkS) const
|
||||||
{
|
{
|
||||||
if( this != &etkS ) {
|
if( this != &etkS ) {
|
||||||
if (etkS.m_data.Size() != m_data.Size()) {
|
if (etkS.m_data.size() != m_data.size()) {
|
||||||
//TK_DEBUG(" not the same size : " << etkS.m_data.Size() << "!=" << m_data.Size());
|
//TK_DEBUG(" not the same size : " << etkS.m_data.Size() << "!=" << m_data.Size());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
for (int32_t iii= 0; iii<m_data.Size(); iii++) {
|
for (int32_t iii= 0; iii<m_data.size(); iii++) {
|
||||||
//TK_DEBUG(" check : " << etkS.m_data[iii] << "!=" << m_data[iii]);
|
//TK_DEBUG(" check : " << etkS.m_data[iii] << "!=" << m_data[iii]);
|
||||||
if (etkS.m_data[iii]!= m_data[iii]){
|
if (etkS.m_data[iii]!= m_data[iii]){
|
||||||
return false;
|
return false;
|
||||||
@ -476,13 +479,13 @@ const etk::UString& etk::UString::operator+= (const etk::UString &etkS)
|
|||||||
{
|
{
|
||||||
if (0 < etkS.Size()) {
|
if (0 < etkS.Size()) {
|
||||||
// remove the last '\0'
|
// remove the last '\0'
|
||||||
m_data.PopBack();
|
m_data.pop_back();
|
||||||
// copy the data ...
|
// copy the data ...
|
||||||
m_data += etkS.m_data;
|
m_data.insert(m_data.end(), etkS.m_data.begin(), etkS.m_data.end());
|
||||||
// This previous include the \0 in case of the 2 UString are different...
|
// This previous include the \0 in case of the 2 UString are different...
|
||||||
if( this == &etkS ) {
|
if( this == &etkS ) {
|
||||||
// add the removed end UString
|
// add the removed end UString
|
||||||
m_data.PushBack('\0');
|
m_data.push_back('\0');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return *this;
|
return *this;
|
||||||
@ -522,7 +525,7 @@ etk::UString etk::UString::operator+ (const etk::UString &etkS)
|
|||||||
*/
|
*/
|
||||||
bool etk::UString::IsEmpty(void) const
|
bool etk::UString::IsEmpty(void) const
|
||||||
{
|
{
|
||||||
if(1 >= m_data.Size() ) {
|
if(1 >= m_data.size() ) {
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
@ -540,10 +543,10 @@ bool etk::UString::IsEmpty(void) const
|
|||||||
*/
|
*/
|
||||||
int32_t etk::UString::Size(void) const
|
int32_t etk::UString::Size(void) const
|
||||||
{
|
{
|
||||||
if (m_data.Size() == 0) {
|
if (m_data.size() == 0) {
|
||||||
return 0;
|
return 0;
|
||||||
} else {
|
} else {
|
||||||
return m_data.Size() - 1;
|
return m_data.size() - 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -582,10 +585,14 @@ void etk::UString::Add(int32_t currentID, const uniChar_t* inputData)
|
|||||||
currentID = 0;
|
currentID = 0;
|
||||||
} else if (currentID > Size() ) {
|
} else if (currentID > Size() ) {
|
||||||
TK_ERROR("Curent ID(" << currentID << ") > maxSize ... (" << Size() << ") ==> add at the end ...");
|
TK_ERROR("Curent ID(" << currentID << ") > maxSize ... (" << Size() << ") ==> add at the end ...");
|
||||||
m_data.PushBack(inputData, len);
|
for (int32_t iii=0; iii<len; iii++) {
|
||||||
|
m_data.push_back(inputData[iii]);
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
m_data.Insert(currentID, inputData, len);
|
for (int32_t iii=0; iii<len; iii++) {
|
||||||
|
m_data.insert(m_data.begin()+currentID+iii, inputData[iii]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -620,7 +627,7 @@ void etk::UString::Remove(int32_t currentID, int32_t len)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// TODO : check the size of the data
|
// TODO : check the size of the data
|
||||||
m_data.EraseLen(currentID, len);
|
m_data.erase(m_data.begin()+currentID, m_data.begin()+currentID+len);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -634,8 +641,8 @@ void etk::UString::Remove(int32_t currentID, int32_t len)
|
|||||||
*/
|
*/
|
||||||
void etk::UString::Clear(void)
|
void etk::UString::Clear(void)
|
||||||
{
|
{
|
||||||
m_data.Clear();
|
m_data.clear();
|
||||||
m_data.PushBack('\0');
|
m_data.push_back('\0');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -720,8 +727,9 @@ etk::UString etk::UString::Extract(int32_t posStart, int32_t posEnd)
|
|||||||
} else if (posEnd >= Size() ) {
|
} else if (posEnd >= Size() ) {
|
||||||
posEnd = Size();
|
posEnd = Size();
|
||||||
}
|
}
|
||||||
out.m_data = m_data.Extract(posStart, posEnd);
|
out.m_data.clear();
|
||||||
out.m_data.PushBack('\0');
|
out.m_data.insert(out.m_data.begin(), m_data.begin()+posStart, m_data.begin()+posEnd);
|
||||||
|
out.m_data.push_back('\0');
|
||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -734,10 +742,10 @@ etk::UString etk::UString::Extract(int32_t posStart, int32_t posEnd)
|
|||||||
* @return The desired vector with data
|
* @return The desired vector with data
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
etk::VectorType<uniChar_t> etk::UString::GetVector(void)
|
std::vector<uniChar_t> etk::UString::GetVector(void)
|
||||||
{
|
{
|
||||||
etk::VectorType<uniChar_t> out = m_data;
|
std::vector<uniChar_t> out = m_data;
|
||||||
out.PopBack();
|
out.pop_back();
|
||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -783,9 +791,9 @@ bool etk::UString::EndWith(const etk::UString& data)
|
|||||||
char * etk::UString::Utf8Data(void)
|
char * etk::UString::Utf8Data(void)
|
||||||
{
|
{
|
||||||
// UTF8 generation :
|
// UTF8 generation :
|
||||||
m_dataUtf8.Clear();
|
m_dataUtf8.clear();
|
||||||
unicode::convertUnicodeToUtf8(m_data, m_dataUtf8);
|
unicode::convertUnicodeToUtf8(m_data, m_dataUtf8);
|
||||||
m_dataUtf8.PushBack('\0');
|
m_dataUtf8.push_back('\0');
|
||||||
|
|
||||||
return &m_dataUtf8[0];
|
return &m_dataUtf8[0];
|
||||||
}
|
}
|
||||||
|
@ -26,7 +26,7 @@
|
|||||||
#define __ETK_USTRING_H__
|
#define __ETK_USTRING_H__
|
||||||
|
|
||||||
#include <etk/Stream.h>
|
#include <etk/Stream.h>
|
||||||
#include <etk/VectorType.h>
|
#include <vector>
|
||||||
|
|
||||||
namespace etk
|
namespace etk
|
||||||
{
|
{
|
||||||
@ -54,9 +54,9 @@ namespace etk
|
|||||||
* = assigment
|
* = assigment
|
||||||
*****************************************************/
|
*****************************************************/
|
||||||
const etk::UString& operator= (const etk::UString &etkS );
|
const etk::UString& operator= (const etk::UString &etkS );
|
||||||
const etk::UString& operator= (etk::VectorType<char> inputData);
|
const etk::UString& operator= (std::vector<char> inputData);
|
||||||
const etk::UString& operator= (etk::VectorType<int8_t> inputData);
|
const etk::UString& operator= (std::vector<int8_t> inputData);
|
||||||
const etk::UString& operator= (etk::VectorType<uniChar_t> inputData);
|
const etk::UString& operator= (std::vector<uniChar_t> inputData);
|
||||||
/*****************************************************
|
/*****************************************************
|
||||||
* == operator
|
* == operator
|
||||||
*****************************************************/
|
*****************************************************/
|
||||||
@ -131,7 +131,7 @@ namespace etk
|
|||||||
void Remove(int32_t currentID, int32_t len);
|
void Remove(int32_t currentID, int32_t len);
|
||||||
void Clear(void);
|
void Clear(void);
|
||||||
|
|
||||||
etk::VectorType<uniChar_t> GetVector(void);
|
std::vector<uniChar_t> GetVector(void);
|
||||||
uniChar_t * pointer(void) { return &m_data[0]; };
|
uniChar_t * pointer(void) { return &m_data[0]; };
|
||||||
// generate temporary allocation (auto unallocated...)
|
// generate temporary allocation (auto unallocated...)
|
||||||
char * Utf8Data(void);
|
char * Utf8Data(void);
|
||||||
@ -140,8 +140,8 @@ namespace etk
|
|||||||
etk::UString Extract(int32_t posStart=0, int32_t posEnd=0x7FFFFFFF);
|
etk::UString Extract(int32_t posStart=0, int32_t posEnd=0x7FFFFFFF);
|
||||||
|
|
||||||
private :
|
private :
|
||||||
etk::VectorType<uniChar_t> m_data; //!< internal data is stored in the Unicode properties ...
|
std::vector<uniChar_t> m_data; //!< internal data is stored in the Unicode properties ...
|
||||||
etk::VectorType<char> m_dataUtf8; //!< Tmp data for the Utf8Data() function
|
std::vector<char> m_dataUtf8; //!< Tmp data for the Utf8Data() function
|
||||||
};
|
};
|
||||||
|
|
||||||
etk::CCout& operator <<(etk::CCout &os, const etk::UString &obj);
|
etk::CCout& operator <<(etk::CCout &os, const etk::UString &obj);
|
||||||
|
@ -1,323 +0,0 @@
|
|||||||
/**
|
|
||||||
*******************************************************************************
|
|
||||||
* @file etk/Vector.h
|
|
||||||
* @brief Ewol Tool Kit : Basic etk::Vector (template)
|
|
||||||
* @author Edouard DUPIN
|
|
||||||
* @date 07/04/2011
|
|
||||||
* @par Project
|
|
||||||
* Ewol TK
|
|
||||||
*
|
|
||||||
* @par Copyright
|
|
||||||
* Copyright 2011 Edouard DUPIN, all right reserved
|
|
||||||
*
|
|
||||||
* This software is distributed in the hope that it will be useful, but WITHOUT
|
|
||||||
* ANY WARRANTY.
|
|
||||||
*
|
|
||||||
* Licence summary :
|
|
||||||
* You can modify and redistribute the sources code and binaries.
|
|
||||||
* You can send me the bug-fix
|
|
||||||
*
|
|
||||||
* Term of the licence in in the file licence.txt.
|
|
||||||
*
|
|
||||||
*******************************************************************************
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef __ETK_VECTOR_H__
|
|
||||||
#define __ETK_VECTOR_H__
|
|
||||||
|
|
||||||
#include <etk/Types.h>
|
|
||||||
#include <etk/DebugInternal.h>
|
|
||||||
#include <etk/Memory.h>
|
|
||||||
|
|
||||||
#undef __class__
|
|
||||||
#define __class__ "etk::Vector"
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief etkVector classes ...
|
|
||||||
*
|
|
||||||
* @tparam[in] T The type of objects to store.
|
|
||||||
* @tparam[in] INC Incrementation mode (0 : Exponential to 200 and increment by stemp of 200)
|
|
||||||
*
|
|
||||||
* @todo : Need to add : popBack / Assign / Insert / Erase / Swap / Clear
|
|
||||||
*
|
|
||||||
* m_data
|
|
||||||
* ---------- |-----------------------|
|
|
||||||
* | 0 |-------->| Class Data |
|
|
||||||
* |--------| |-----------------------|
|
|
||||||
* | 1 |----|
|
|
||||||
* |--------| |
|
|
||||||
* | 2 |====|==============| |-----------------------|
|
|
||||||
* |--------| | --->| Class Data |
|
|
||||||
* m_count | 3 |-| | |-----------------------|
|
|
||||||
* |--------| | |
|
|
||||||
* | x | | | |-----------------------|
|
|
||||||
* |--------| | -------->| Class Data |
|
|
||||||
* | x | | |-----------------------|
|
|
||||||
* |--------| |
|
|
||||||
* | x | |
|
|
||||||
* |--------| | |-----------------------|
|
|
||||||
* | x | --------------------->| Class Data |
|
|
||||||
* |--------| |-----------------------|
|
|
||||||
* | x |
|
|
||||||
* |--------|
|
|
||||||
* | x |
|
|
||||||
* |--------|
|
|
||||||
* m_size | x |
|
|
||||||
* ----------
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
namespace etk
|
|
||||||
{
|
|
||||||
|
|
||||||
template<class T, int32_t INC=0> class Vector
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
/**
|
|
||||||
* @brief
|
|
||||||
*
|
|
||||||
* @param[in,out] ---
|
|
||||||
*
|
|
||||||
* @return ---
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
Vector(int count = 0):
|
|
||||||
m_data(NULL),
|
|
||||||
m_count(0),
|
|
||||||
m_size(0)
|
|
||||||
{
|
|
||||||
Resize(count);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief
|
|
||||||
*
|
|
||||||
* @param[in,out] ---
|
|
||||||
*
|
|
||||||
* @return ---
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
Vector(const etk::Vector<T> & myVector):
|
|
||||||
m_size(myVector.m_size),
|
|
||||||
m_count(myVector.m_count),
|
|
||||||
m_data(NULL)
|
|
||||||
{
|
|
||||||
int32_t i;
|
|
||||||
ETK_MALLOC_CAST(m_data, m_size, T, T*);//reinterpret_cast<T*>);
|
|
||||||
for(i=0; i<m_count; i++) {
|
|
||||||
new (&m_data[i]) T(myVector[i]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief
|
|
||||||
*
|
|
||||||
* @param[in,out] ---
|
|
||||||
*
|
|
||||||
* @return ---
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
~Vector()
|
|
||||||
{
|
|
||||||
Destroy();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief
|
|
||||||
*
|
|
||||||
* @param[in,out] ---
|
|
||||||
*
|
|
||||||
* @return ---
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
Vector& operator=(const etk::Vector<T> & etkVector)
|
|
||||||
{
|
|
||||||
int32_t i;
|
|
||||||
this->~etkVector();
|
|
||||||
m_size = etkVector.m_size;
|
|
||||||
m_count = etkVector.m_count;
|
|
||||||
ETK_MALLOC_CAST(m_data, m_size, T, T*);//reinterpret_cast<T*>);
|
|
||||||
for(i=0; i<m_count; i++) {
|
|
||||||
new (&m_data[i]) T(etkVector[i]);
|
|
||||||
}
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief
|
|
||||||
*
|
|
||||||
* @param[in,out] ---
|
|
||||||
*
|
|
||||||
* @return ---
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
int32_t Size()
|
|
||||||
{
|
|
||||||
return m_count;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief
|
|
||||||
*
|
|
||||||
* @param[in,out] ---
|
|
||||||
*
|
|
||||||
* @return ---
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
T& Get(int32_t pos)
|
|
||||||
{
|
|
||||||
return m_data[pos];
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief
|
|
||||||
*
|
|
||||||
* @param[in,out] ---
|
|
||||||
*
|
|
||||||
* @return ---
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
T& operator[] (int32_t pos)
|
|
||||||
{
|
|
||||||
return Get(pos);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief
|
|
||||||
*
|
|
||||||
* @param[in,out] ---
|
|
||||||
*
|
|
||||||
* @return ---
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
const T& operator[] (int32_t pos) const
|
|
||||||
{
|
|
||||||
return m_data[pos];
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief
|
|
||||||
*
|
|
||||||
* @param[in,out] ---
|
|
||||||
*
|
|
||||||
* @return ---
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
int IndexOf(const T * item) const
|
|
||||||
{
|
|
||||||
int32_t res = item - m_data;
|
|
||||||
if( 0 > res
|
|
||||||
|| res >= Size())
|
|
||||||
{
|
|
||||||
return -1;
|
|
||||||
} else {
|
|
||||||
return res;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief
|
|
||||||
*
|
|
||||||
* @param[in,out] ---
|
|
||||||
*
|
|
||||||
* @return ---
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
void PushBack(const T& item)
|
|
||||||
{
|
|
||||||
int32_t idx = Size();
|
|
||||||
Resize(idx+1);
|
|
||||||
Get(idx) = item;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief
|
|
||||||
*
|
|
||||||
* @param[in,out] ---
|
|
||||||
*
|
|
||||||
* @return ---
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
void Resize(int32_t count)
|
|
||||||
{
|
|
||||||
int32_t i;
|
|
||||||
// Reallocate memory
|
|
||||||
if (count > m_size) {
|
|
||||||
ChangeAllocation(count);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Remove deprecated element
|
|
||||||
for(i=count; i<m_count; i++) {
|
|
||||||
m_data[i].~T();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Create nex item
|
|
||||||
for(i=m_count;i<count;i++) {
|
|
||||||
new (&m_data[i]) T();
|
|
||||||
}
|
|
||||||
|
|
||||||
m_count = count;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief
|
|
||||||
*
|
|
||||||
* @param[in,out] ---
|
|
||||||
*
|
|
||||||
* @return ---
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
void ChangeAllocation(int count)
|
|
||||||
{
|
|
||||||
if (count > m_size) {
|
|
||||||
// generate new size
|
|
||||||
while(count > m_size) {
|
|
||||||
if (INC) {
|
|
||||||
m_size = (m_size + INC);
|
|
||||||
} else if (m_size==0) {
|
|
||||||
m_size = 1;
|
|
||||||
} else {
|
|
||||||
m_size = m_size * 2;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// Allocate the curent element
|
|
||||||
T * data = NULL;
|
|
||||||
ETK_MALLOC_CAST(data, m_size, T, T*);//reinterpret_cast<T*>);
|
|
||||||
for(int i=0; i<m_count; i++) {
|
|
||||||
new (&data[i]) T(m_data[i]);
|
|
||||||
}
|
|
||||||
Destroy();
|
|
||||||
m_data = data;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private:
|
|
||||||
T * m_data; //!< pointer on the current Data
|
|
||||||
int32_t m_count; //!< number of element
|
|
||||||
int32_t m_size; //!< current allocated size
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief
|
|
||||||
*
|
|
||||||
* @param[in,out] ---
|
|
||||||
*
|
|
||||||
* @return ---
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
void Destroy()
|
|
||||||
{
|
|
||||||
for(int i=0; i<m_count; i++) {
|
|
||||||
m_data[i].~T();
|
|
||||||
}
|
|
||||||
if (m_data) {
|
|
||||||
ETK_FREE(m_data);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
#undef __class__
|
|
||||||
#define __class__ NULL
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
@ -1,687 +0,0 @@
|
|||||||
/**
|
|
||||||
*******************************************************************************
|
|
||||||
* @file etk/VectorType.h
|
|
||||||
* @brief Ewol Tool Kit : Basic VectorType for direct data insertion (template)
|
|
||||||
* @author Edouard DUPIN
|
|
||||||
* @date 07/04/2011
|
|
||||||
* @par Project
|
|
||||||
* Ewol TK
|
|
||||||
*
|
|
||||||
* @par Copyright
|
|
||||||
* Copyright 2011 Edouard DUPIN, all right reserved
|
|
||||||
*
|
|
||||||
* This software is distributed in the hope that it will be useful, but WITHOUT
|
|
||||||
* ANY WARRANTY.
|
|
||||||
*
|
|
||||||
* Licence summary :
|
|
||||||
* You can modify and redistribute the sources code and binaries.
|
|
||||||
* You can send me the bug-fix
|
|
||||||
*
|
|
||||||
* Term of the licence in in the file licence.txt.
|
|
||||||
*
|
|
||||||
*******************************************************************************
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef __ETK_VECTOR_TYPE_H__
|
|
||||||
#define __ETK_VECTOR_TYPE_H__
|
|
||||||
|
|
||||||
#include <etk/Types.h>
|
|
||||||
#include <etk/DebugInternal.h>
|
|
||||||
#include <etk/Memory.h>
|
|
||||||
|
|
||||||
#undef __class__
|
|
||||||
#define __class__ "etk::VectorType"
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief VectorType classes ...
|
|
||||||
*
|
|
||||||
* @tparam[in] SIZE Size of the current element.
|
|
||||||
*
|
|
||||||
* m_data
|
|
||||||
* <------------ m_dataSize ------------>
|
|
||||||
* ----------------------------------------
|
|
||||||
* | 0 |
|
|
||||||
* |--------------------------------------|
|
|
||||||
* | 1 |
|
|
||||||
* |--------------------------------------|
|
|
||||||
* | 2 |
|
|
||||||
* |--------------------------------------|
|
|
||||||
* m_size | 3 |
|
|
||||||
* |--------------------------------------|
|
|
||||||
* | x |
|
|
||||||
* |--------------------------------------|
|
|
||||||
* | x |
|
|
||||||
* |--------------------------------------|
|
|
||||||
* | x |
|
|
||||||
* |--------------------------------------|
|
|
||||||
* | x |
|
|
||||||
* |--------------------------------------|
|
|
||||||
* | x |
|
|
||||||
* |--------------------------------------|
|
|
||||||
* | x |
|
|
||||||
* |--------------------------------------|
|
|
||||||
* m_allocated | x |
|
|
||||||
* ----------------------------------------
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
namespace etk
|
|
||||||
{
|
|
||||||
|
|
||||||
template<typename MY_TYPE=int32_t> class VectorType
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
class Iterator
|
|
||||||
{
|
|
||||||
// Private data :
|
|
||||||
private:
|
|
||||||
int32_t m_current; //!< curent Id on the vector
|
|
||||||
VectorType<MY_TYPE> * m_VectorType; //!< Pointer on the curent element of the vectorBin
|
|
||||||
public:
|
|
||||||
/**
|
|
||||||
* @brief Basic itarator constructor with no link with an etkVector
|
|
||||||
*/
|
|
||||||
Iterator():
|
|
||||||
m_current(-1),
|
|
||||||
m_VectorType(NULL)
|
|
||||||
{
|
|
||||||
// nothing to do ...
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* @brief Recopy constructor on a specific etkVector.
|
|
||||||
* @param[in] otherIterator The Iterator that might be copy
|
|
||||||
*/
|
|
||||||
Iterator(const Iterator & otherIterator):
|
|
||||||
m_current(otherIterator.m_current),
|
|
||||||
m_VectorType(otherIterator.m_VectorType)
|
|
||||||
{
|
|
||||||
// nothing to do ...
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* @brief Asignation operator.
|
|
||||||
* @param[in] otherIterator The Iterator that might be copy
|
|
||||||
* @return reference on the curent Iterator
|
|
||||||
*/
|
|
||||||
Iterator& operator=(const Iterator & otherIterator)
|
|
||||||
{
|
|
||||||
m_current = otherIterator.m_current;
|
|
||||||
m_VectorType = otherIterator.m_VectorType;
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* @brief Basic destructor
|
|
||||||
*/
|
|
||||||
~Iterator()
|
|
||||||
{
|
|
||||||
m_current = -1;
|
|
||||||
m_VectorType = NULL;
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* @brief basic boolean cast
|
|
||||||
* @return true if the element is present in the etkVector size
|
|
||||||
*/
|
|
||||||
operator bool ()
|
|
||||||
{
|
|
||||||
if( 0 <= m_current
|
|
||||||
&& m_current < m_VectorType->Size() )
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
} else {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* @brief Incremental operator
|
|
||||||
* @return Reference on the current iterator incremented
|
|
||||||
*/
|
|
||||||
Iterator& operator++ ()
|
|
||||||
{
|
|
||||||
if( NULL != m_VectorType
|
|
||||||
&& m_current < m_VectorType->Size() )
|
|
||||||
{
|
|
||||||
m_current++;
|
|
||||||
}
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* @brief Decremental operator
|
|
||||||
* @return Reference on the current iterator decremented
|
|
||||||
*/
|
|
||||||
Iterator& operator-- ()
|
|
||||||
{
|
|
||||||
if (m_current >= 0) {
|
|
||||||
m_current--;
|
|
||||||
}
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* @brief Incremental operator
|
|
||||||
* @return Reference on a new iterator and increment the other one
|
|
||||||
*/
|
|
||||||
Iterator operator++ (int32_t)
|
|
||||||
{
|
|
||||||
Iterator it(*this);
|
|
||||||
++(*this);
|
|
||||||
return it;
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* @brief Decremental operator
|
|
||||||
* @return Reference on a new iterator and decrement the other one
|
|
||||||
*/
|
|
||||||
Iterator operator-- (int32_t)
|
|
||||||
{
|
|
||||||
Iterator it(*this);
|
|
||||||
--(*this);
|
|
||||||
return it;
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* @brief Get reference on the current Element
|
|
||||||
* @return the reference on the current Element
|
|
||||||
*/
|
|
||||||
MY_TYPE & operator-> () const
|
|
||||||
{
|
|
||||||
TK_CHECK_INOUT(m_current >= 0 && m_current < m_VectorType->Size());
|
|
||||||
return &m_VectorType->Get(m_current);
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* @brief Get reference on the current Element
|
|
||||||
* @return the reference on the current Element
|
|
||||||
*/
|
|
||||||
MY_TYPE & operator* () const
|
|
||||||
{
|
|
||||||
TK_CHECK_INOUT(m_current >= 0 && m_current < m_VectorType->Size());
|
|
||||||
return m_VectorType->Get(m_current);
|
|
||||||
}
|
|
||||||
private:
|
|
||||||
/**
|
|
||||||
* @brief
|
|
||||||
*
|
|
||||||
* @param[in,out] ---
|
|
||||||
*
|
|
||||||
* @return ---
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
Iterator(VectorType<MY_TYPE> * Evb, int32_t pos):
|
|
||||||
m_current(pos),
|
|
||||||
m_VectorType(Evb)
|
|
||||||
{
|
|
||||||
// nothing to do ...
|
|
||||||
}
|
|
||||||
friend class VectorType;
|
|
||||||
};
|
|
||||||
|
|
||||||
private:
|
|
||||||
MY_TYPE * m_data; //!< pointer on the curetn table of Data
|
|
||||||
int32_t m_size; //!< nb Element in the buffer
|
|
||||||
int32_t m_allocated; //!< Current allocated size
|
|
||||||
int32_t m_increment; //!< methode of increment
|
|
||||||
public:
|
|
||||||
/**
|
|
||||||
* @brief Create an empty vector
|
|
||||||
* @param[in] count Minimum request size of the Buffer
|
|
||||||
*/
|
|
||||||
VectorType(int32_t count = 0):
|
|
||||||
m_data(NULL),
|
|
||||||
m_size(0),
|
|
||||||
m_allocated(0),
|
|
||||||
m_increment(1)
|
|
||||||
{
|
|
||||||
ChangeAllocation(count);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Re-copy constructor (copy all needed data)
|
|
||||||
* @param[in] Evb Vector that might be copy
|
|
||||||
*/
|
|
||||||
VectorType(const etk::VectorType<MY_TYPE> & Evb)
|
|
||||||
{
|
|
||||||
m_allocated = Evb.m_allocated;
|
|
||||||
m_size = Evb.m_size;
|
|
||||||
m_increment = Evb.m_increment;
|
|
||||||
m_data = NULL;
|
|
||||||
//TK_DEBUG("USE Specific vector allocator ... Evb.m_size=" << Evb.m_size << " Evb.m_increment=" << Evb.m_increment);
|
|
||||||
// allocate all same data
|
|
||||||
ETK_MALLOC(m_data, m_allocated, MY_TYPE);
|
|
||||||
TK_ASSERT(NULL!=m_data, "Error in data allocation");
|
|
||||||
// Copy all data ...
|
|
||||||
memcpy(m_data, Evb.m_data, m_allocated * sizeof(MY_TYPE) );
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Destructor of the current Class
|
|
||||||
*/
|
|
||||||
~VectorType()
|
|
||||||
{
|
|
||||||
if (NULL!=m_data) {
|
|
||||||
ETK_FREE(m_data);
|
|
||||||
m_data = NULL;
|
|
||||||
}
|
|
||||||
m_allocated = 0;
|
|
||||||
m_size = 0;
|
|
||||||
m_increment = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Re-copy operator
|
|
||||||
* @param[in] Evb Vector that might be copy
|
|
||||||
* @return reference on the curent re-copy vector
|
|
||||||
*/
|
|
||||||
VectorType& operator=(const etk::VectorType<MY_TYPE> & Evb)
|
|
||||||
{
|
|
||||||
//TK_DEBUG("USE RECOPY vector ... Evb.m_size=" << Evb.m_size << " Evb.m_increment=" << Evb.m_increment);
|
|
||||||
if( this != &Evb ) // avoid copy to itself
|
|
||||||
{
|
|
||||||
if (NULL!=m_data) {
|
|
||||||
ETK_FREE(m_data);
|
|
||||||
m_data = NULL;
|
|
||||||
}
|
|
||||||
// Set the new value
|
|
||||||
m_allocated = Evb.m_allocated;
|
|
||||||
m_size = Evb.m_size;
|
|
||||||
m_increment = Evb.m_increment;
|
|
||||||
// allocate all same data
|
|
||||||
ETK_MALLOC(m_data, m_allocated, MY_TYPE);
|
|
||||||
TK_ASSERT(NULL!=m_data, "Error in data allocation");
|
|
||||||
// Copy all data ...
|
|
||||||
memcpy(m_data, Evb.m_data, m_allocated * sizeof(MY_TYPE) );
|
|
||||||
}
|
|
||||||
// Return the curent pointer
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Add at the Last position of the Vector
|
|
||||||
* @param[in] item Element to add at the end of vector
|
|
||||||
*/
|
|
||||||
VectorType& operator+= (const etk::VectorType<MY_TYPE> & Evb) // += operator
|
|
||||||
{
|
|
||||||
int32_t nbElememt = Evb.Size();
|
|
||||||
int32_t idx = m_size;
|
|
||||||
Resize(m_size+nbElememt);
|
|
||||||
memcpy(&m_data[idx], &Evb.m_data[0], nbElememt*sizeof(MY_TYPE) );
|
|
||||||
// Return the curent pointer
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Set increment mode of this vector (default it match corectly with the number of element inside)
|
|
||||||
* @param[in] newIncrementNumber methode requested
|
|
||||||
*/
|
|
||||||
void SetIncrement(int32_t newIncrementNumber)
|
|
||||||
{
|
|
||||||
m_increment = newIncrementNumber;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Get the number of element in the vector
|
|
||||||
* @return The number requested
|
|
||||||
*/
|
|
||||||
int32_t Size() const
|
|
||||||
{
|
|
||||||
return m_size;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Get the Allocated size in the vector
|
|
||||||
* @return The size of allocation
|
|
||||||
*/
|
|
||||||
int32_t AllocatedSize() const
|
|
||||||
{
|
|
||||||
return m_allocated;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Get a current element in the vector
|
|
||||||
* @param[in] pos Desired position read
|
|
||||||
* @return Reference on the Element
|
|
||||||
*/
|
|
||||||
MY_TYPE& Get(int32_t pos)
|
|
||||||
{
|
|
||||||
return m_data[pos];
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Get an copy Element an a special position
|
|
||||||
* @param[in] pos Position in the vector that might be get [0..Size()]
|
|
||||||
* @return An reference on the copy of selected element
|
|
||||||
*/
|
|
||||||
MY_TYPE& operator[] (int32_t pos)
|
|
||||||
{
|
|
||||||
return Get(pos);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Get an Element an a special position
|
|
||||||
* @param[in] pos Position in the vector that might be get [0..Size()]
|
|
||||||
* @return An reference on the selected element
|
|
||||||
*/
|
|
||||||
const MY_TYPE& operator[] (int32_t pos) const
|
|
||||||
{
|
|
||||||
return m_data[pos];
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Add at the Last position of the Vector
|
|
||||||
* @param[in] item Element to add at the end of vector
|
|
||||||
*/
|
|
||||||
void PushBack(const MY_TYPE& item)
|
|
||||||
{
|
|
||||||
int32_t idx = m_size;
|
|
||||||
Resize(m_size+1);
|
|
||||||
m_data[idx] = item;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Add at the Last position of the Vector
|
|
||||||
* @param[in] item Element to add at the end of vector
|
|
||||||
*/
|
|
||||||
void PushBack(const MY_TYPE * item, int32_t nbElement)
|
|
||||||
{
|
|
||||||
if (NULL == item) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
int32_t idx = m_size;
|
|
||||||
Resize(m_size+nbElement);
|
|
||||||
memcpy(&m_data[idx], item, nbElement*sizeof(MY_TYPE) );
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Remove the last element of the vector
|
|
||||||
*/
|
|
||||||
void PopBack(void)
|
|
||||||
{
|
|
||||||
if(m_size>0) {
|
|
||||||
Resize(m_size-1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Remove all alement in the current vector
|
|
||||||
*/
|
|
||||||
void Clear(void)
|
|
||||||
{
|
|
||||||
if(m_size>0) {
|
|
||||||
Resize(0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief
|
|
||||||
*
|
|
||||||
* @param[in,out] ---
|
|
||||||
*
|
|
||||||
* @return ---
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
void Insert(int32_t pos, const MY_TYPE& item)
|
|
||||||
{
|
|
||||||
if (pos>m_size) {
|
|
||||||
TK_ERROR(" can not insert Element at this position : " << pos << " > " << m_size<< " add it at the end ... ");
|
|
||||||
PushBack(item);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
int32_t tmpSize = m_size;
|
|
||||||
// Request resize of the current buffer
|
|
||||||
Resize(m_size+1);
|
|
||||||
// move curent data
|
|
||||||
int32_t sizeToMove = (tmpSize - pos)*sizeof(MY_TYPE);
|
|
||||||
if ( 0 < sizeToMove) {
|
|
||||||
memmove((m_data + pos + 1), (m_data + pos), sizeToMove );
|
|
||||||
}
|
|
||||||
// affectation of the current element
|
|
||||||
m_data[pos] = item;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief
|
|
||||||
*
|
|
||||||
* @param[in,out] ---
|
|
||||||
*
|
|
||||||
* @return ---
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
void Insert(int32_t pos, const MY_TYPE * item, int32_t nbElement)
|
|
||||||
{
|
|
||||||
if (pos>m_size) {
|
|
||||||
TK_WARNING(" can not insert Element at this position : " << pos << " > " << m_size << " add it at the end ... ");
|
|
||||||
PushBack(item, nbElement);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
int32_t tmpSize = m_size;
|
|
||||||
// Request resize of the current buffer
|
|
||||||
Resize(m_size+nbElement);
|
|
||||||
// move curent data (after the position)
|
|
||||||
int32_t sizeToMove = (tmpSize - pos)*sizeof(MY_TYPE);
|
|
||||||
if ( 0 < sizeToMove) {
|
|
||||||
memmove((m_data + pos + nbElement), (m_data + pos), sizeToMove );
|
|
||||||
}
|
|
||||||
// affectation of all input element
|
|
||||||
memcpy(&m_data[pos], item, nbElement*sizeof(MY_TYPE) );
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Remove one element
|
|
||||||
*
|
|
||||||
* @param[in] pos Position to remove the data
|
|
||||||
*
|
|
||||||
* @return ---
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
void Erase(int32_t pos)
|
|
||||||
{
|
|
||||||
if (pos<0 || (uint32_t)pos>m_size) {
|
|
||||||
TK_ERROR(" can not Erase Element at this position : " << pos << " > " << m_size);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
int32_t tmpSize = m_size;
|
|
||||||
int32_t sizeToMove = (tmpSize - (pos+1))*sizeof(MY_TYPE);
|
|
||||||
if ( 0 < sizeToMove) {
|
|
||||||
// move curent data
|
|
||||||
memmove((m_data + pos), (m_data + pos + 1), sizeToMove );
|
|
||||||
}
|
|
||||||
// Request resize of the current buffer
|
|
||||||
Resize(m_size-1);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Remove N elements
|
|
||||||
*
|
|
||||||
* @param[in] pos Position to remove the data
|
|
||||||
* @param[in] posEnd Last position number
|
|
||||||
*
|
|
||||||
* @return ---
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
void Erase(int32_t pos, int32_t posEnd)
|
|
||||||
{
|
|
||||||
if (pos>m_size) {
|
|
||||||
TK_ERROR(" can not Erase Element at this position : " << pos << " > " << m_size);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (posEnd>m_size) {
|
|
||||||
posEnd = m_size;
|
|
||||||
}
|
|
||||||
int32_t nbElement = m_size - pos;
|
|
||||||
int32_t tmpSize = m_size;
|
|
||||||
// move curent data
|
|
||||||
int32_t sizeToMove = (tmpSize - (pos+nbElement))*sizeof(MY_TYPE);
|
|
||||||
if ( 0 < sizeToMove) {
|
|
||||||
memmove((m_data + pos), (m_data + pos + nbElement), sizeToMove );
|
|
||||||
}
|
|
||||||
// Request resize of the current buffer
|
|
||||||
Resize(m_size-nbElement);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Remove N element
|
|
||||||
*
|
|
||||||
* @param[in] pos Position to remove the data
|
|
||||||
* @param[in] nbElement number of element to remove
|
|
||||||
*
|
|
||||||
* @return ---
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
void EraseLen(int32_t pos, int32_t nbElement)
|
|
||||||
{
|
|
||||||
if (pos>m_size) {
|
|
||||||
TK_ERROR(" can not Erase Len Element at this position : " << pos << " > " << m_size);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (pos+nbElement>m_size) {
|
|
||||||
nbElement = m_size - pos;
|
|
||||||
}
|
|
||||||
int32_t tmpSize = m_size;
|
|
||||||
// move curent data
|
|
||||||
int32_t sizeToMove = (tmpSize - (pos+nbElement))*sizeof(MY_TYPE);
|
|
||||||
if ( 0 < sizeToMove) {
|
|
||||||
memmove((m_data + pos), (m_data + pos + nbElement), sizeToMove );
|
|
||||||
}
|
|
||||||
// Request resize of the current buffer
|
|
||||||
Resize(m_size-nbElement);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief extract data between two point :
|
|
||||||
* @param[in] posStart start position to extract data
|
|
||||||
* @param[in] posEnd End position to extract data
|
|
||||||
* @return the extracted vector
|
|
||||||
*/
|
|
||||||
VectorType Extract(int32_t posStart = 0, int32_t posEnd=0x7FFFFFFF)
|
|
||||||
{
|
|
||||||
VectorType<MY_TYPE> out;
|
|
||||||
if (posStart < 0) {
|
|
||||||
posStart = 0;
|
|
||||||
} else if (posStart >= Size() ) {
|
|
||||||
return out;
|
|
||||||
}
|
|
||||||
if (posEnd < 0) {
|
|
||||||
return out;
|
|
||||||
} else if (posEnd >= Size() ) {
|
|
||||||
posEnd = Size();
|
|
||||||
}
|
|
||||||
out.PushBack(&m_data[posStart], posEnd-posStart);
|
|
||||||
return out;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Set the minimum allocation in memory for the curent vector ==> reallocate the
|
|
||||||
* buffer to fit exactly the mumber of element needed
|
|
||||||
*/
|
|
||||||
void Fit(void)
|
|
||||||
{
|
|
||||||
if (m_size > m_allocated) {
|
|
||||||
// Reallocate the curent data to the correct size ...
|
|
||||||
ETK_REALLOC(m_data, m_size, MY_TYPE);
|
|
||||||
}
|
|
||||||
// Check result with assert :
|
|
||||||
TK_ASSERT(NULL!=m_data, "Error in data Fitting");
|
|
||||||
m_allocated = m_size;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Get an iterator an an specific position
|
|
||||||
* @param[in] pos Requested position of the iterator in the vector
|
|
||||||
* @return The Iterator
|
|
||||||
*/
|
|
||||||
Iterator Position(int32_t pos)
|
|
||||||
{
|
|
||||||
return Iterator(this, pos);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Get an Iterator on the start position of the Vector
|
|
||||||
* @return The Iterator
|
|
||||||
*/
|
|
||||||
Iterator Begin(void)
|
|
||||||
{
|
|
||||||
return Position(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Get an Iterator on the end position of the Vector
|
|
||||||
* @return The Iterator
|
|
||||||
*/
|
|
||||||
Iterator End(void)
|
|
||||||
{
|
|
||||||
return Position( Size()-1 );
|
|
||||||
}
|
|
||||||
|
|
||||||
private:
|
|
||||||
/**
|
|
||||||
* @brief Change the current size of the vector
|
|
||||||
* @param[in] newSize New requested size of element in the vector
|
|
||||||
*/
|
|
||||||
void Resize(int32_t newSize)
|
|
||||||
{
|
|
||||||
// Reallocate memory
|
|
||||||
if (newSize > m_allocated) {
|
|
||||||
ChangeAllocation(newSize);
|
|
||||||
}
|
|
||||||
m_size = newSize;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Change the current allocation to the corect one (depend on the current size)
|
|
||||||
* @param[in] newSize Minimum number of element needed
|
|
||||||
*/
|
|
||||||
void ChangeAllocation(int32_t newSize)
|
|
||||||
{
|
|
||||||
// set the minimal size to 1
|
|
||||||
if(newSize <= 0) {
|
|
||||||
newSize = 1;
|
|
||||||
}
|
|
||||||
int32_t requestSize = m_allocated;
|
|
||||||
// set the size with the corect chose type :
|
|
||||||
if (newSize == m_allocated) {
|
|
||||||
return;
|
|
||||||
} else if (newSize < requestSize) {
|
|
||||||
// down the size of the vector:
|
|
||||||
if (0==m_increment) {
|
|
||||||
// never down size...
|
|
||||||
} else {
|
|
||||||
int32_t devide = m_increment;
|
|
||||||
if (devide == 0) {
|
|
||||||
devide = 1;
|
|
||||||
}
|
|
||||||
int32_t numberOfStep = m_allocated / devide;
|
|
||||||
if (newSize< ((numberOfStep-2)*devide + devide/2) ) {
|
|
||||||
//Allow Reallocation of a new size shorter
|
|
||||||
requestSize = ((newSize / devide)+1) * devide;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
while(newSize > requestSize) {
|
|
||||||
if (0 == requestSize) {
|
|
||||||
requestSize = 1;
|
|
||||||
} else if (0==m_increment) {
|
|
||||||
requestSize = requestSize * 2;
|
|
||||||
} else {
|
|
||||||
requestSize = (requestSize + m_increment);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// No reallocation needed :
|
|
||||||
if (requestSize == m_allocated) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
// check if something is allocated :
|
|
||||||
if (NULL == m_data) {
|
|
||||||
// no data allocated ==> request an allocation (might be the first)
|
|
||||||
ETK_MALLOC(m_data, requestSize, MY_TYPE);
|
|
||||||
} else {
|
|
||||||
// move datas
|
|
||||||
ETK_REALLOC(m_data, requestSize, MY_TYPE);
|
|
||||||
}
|
|
||||||
// Check result with assert :
|
|
||||||
TK_ASSERT(NULL!=m_data, "Error in data allocation");
|
|
||||||
// set the new allocation size
|
|
||||||
m_allocated = requestSize;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
#undef __class__
|
|
||||||
#define __class__ NULL
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
@ -39,20 +39,20 @@ int32_t etk::tool::irand(int32_t a, int32_t b)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void etk::tool::SortList(etk::VectorType<etk::UString *> &m_listDirectory)
|
void etk::tool::SortList(std::vector<etk::UString *> &m_listDirectory)
|
||||||
{
|
{
|
||||||
etk::VectorType<etk::UString *> tmpList = m_listDirectory;
|
std::vector<etk::UString *> tmpList = m_listDirectory;
|
||||||
m_listDirectory.Clear();
|
m_listDirectory.clear();
|
||||||
for(int32_t iii=0; iii<tmpList.Size(); iii++) {
|
for(int32_t iii=0; iii<tmpList.size(); iii++) {
|
||||||
|
|
||||||
int32_t findPos = 0;
|
int32_t findPos = 0;
|
||||||
for(int32_t jjj=0; jjj<m_listDirectory.Size(); jjj++) {
|
for(int32_t jjj=0; jjj<m_listDirectory.size(); jjj++) {
|
||||||
//EWOL_DEBUG("compare : \""<<*tmpList[iii] << "\" and \"" << *m_listDirectory[jjj] << "\"");
|
//EWOL_DEBUG("compare : \""<<*tmpList[iii] << "\" and \"" << *m_listDirectory[jjj] << "\"");
|
||||||
if (*tmpList[iii] > *m_listDirectory[jjj]) {
|
if (*tmpList[iii] > *m_listDirectory[jjj]) {
|
||||||
findPos = jjj+1;
|
findPos = jjj+1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//EWOL_DEBUG("position="<<findPos);
|
//EWOL_DEBUG("position="<<findPos);
|
||||||
m_listDirectory.Insert(findPos, tmpList[iii]);
|
m_listDirectory.insert(m_listDirectory.begin()+findPos, tmpList[iii]);
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -32,7 +32,7 @@ namespace etk {
|
|||||||
namespace tool {
|
namespace tool {
|
||||||
float frand(float a, float b);
|
float frand(float a, float b);
|
||||||
int32_t irand(int32_t a, int32_t b);
|
int32_t irand(int32_t a, int32_t b);
|
||||||
void SortList(etk::VectorType<etk::UString *> &m_listDirectory);
|
void SortList(std::vector<etk::UString *> &m_listDirectory);
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -24,8 +24,8 @@
|
|||||||
|
|
||||||
// cf : http://unicode.org/fr/charts/symbols.html#CombiningDiacriticalMarks
|
// cf : http://unicode.org/fr/charts/symbols.html#CombiningDiacriticalMarks
|
||||||
|
|
||||||
|
#include <etk/DebugInternal.h>
|
||||||
#include <etk/Types.h>
|
#include <etk/Types.h>
|
||||||
#include <etk/Debug.h>
|
|
||||||
#include <etk/unicodeTable.h>
|
#include <etk/unicodeTable.h>
|
||||||
#include <etk/unicode.h>
|
#include <etk/unicode.h>
|
||||||
|
|
||||||
@ -58,7 +58,7 @@ void unicode::convertIsoToUnicode(charset_te inputCharset, char input_ISO, uniCh
|
|||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
default :
|
default :
|
||||||
TK_WARNING("Unknow charset ... " << inputCharset);
|
TK_WARNING("Unknow charset ... " << (int32_t)inputCharset);
|
||||||
output_Unicode = '?';
|
output_Unicode = '?';
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -99,69 +99,69 @@ void unicode::convertUnicodeToIso(charset_te inputCharset, uniChar_t input_Unico
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int32_t unicode::convertIsoToUnicode(charset_te inputCharset, etk::VectorType<char>& input_ISO, etk::VectorType<uniChar_t>& output_Unicode)
|
int32_t unicode::convertIsoToUnicode(charset_te inputCharset, std::vector<char>& input_ISO, std::vector<uniChar_t>& output_Unicode)
|
||||||
{
|
{
|
||||||
output_Unicode.Clear();
|
output_Unicode.clear();
|
||||||
uniChar_t output;
|
uniChar_t output;
|
||||||
for(int32_t iii=0; iii<input_ISO.Size(); iii++) {
|
for(int32_t iii=0; iii<input_ISO.size(); iii++) {
|
||||||
convertIsoToUnicode(inputCharset, (char)input_ISO[iii], output);
|
convertIsoToUnicode(inputCharset, (char)input_ISO[iii], output);
|
||||||
output_Unicode.PushBack(output);
|
output_Unicode.push_back(output);
|
||||||
}
|
}
|
||||||
if (output_Unicode.Size() == 0) {
|
if (output_Unicode.size() == 0) {
|
||||||
output_Unicode.PushBack(0);
|
output_Unicode.push_back(0);
|
||||||
} else if (output_Unicode[output_Unicode.Size()-1] != 0) {
|
} else if (output_Unicode[output_Unicode.size()-1] != 0) {
|
||||||
output_Unicode.PushBack(0);
|
output_Unicode.push_back(0);
|
||||||
}
|
}
|
||||||
return output_Unicode.Size();
|
return output_Unicode.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t unicode::convertIsoToUnicode(charset_te inputCharset, etk::VectorType<int8_t>& input_ISO, etk::VectorType<uniChar_t>& output_Unicode)
|
int32_t unicode::convertIsoToUnicode(charset_te inputCharset, std::vector<int8_t>& input_ISO, std::vector<uniChar_t>& output_Unicode)
|
||||||
{
|
{
|
||||||
output_Unicode.Clear();
|
output_Unicode.clear();
|
||||||
uniChar_t output;
|
uniChar_t output;
|
||||||
for(int32_t iii=0; iii<input_ISO.Size(); iii++) {
|
for(int32_t iii=0; iii<input_ISO.size(); iii++) {
|
||||||
convertIsoToUnicode(inputCharset, (char)input_ISO[iii], output);
|
convertIsoToUnicode(inputCharset, (char)input_ISO[iii], output);
|
||||||
output_Unicode.PushBack(output);
|
output_Unicode.push_back(output);
|
||||||
}
|
}
|
||||||
if (output_Unicode.Size() == 0) {
|
if (output_Unicode.size() == 0) {
|
||||||
output_Unicode.PushBack(0);
|
output_Unicode.push_back(0);
|
||||||
} else if (output_Unicode[output_Unicode.Size()-1] != 0) {
|
} else if (output_Unicode[output_Unicode.size()-1] != 0) {
|
||||||
output_Unicode.PushBack(0);
|
output_Unicode.push_back(0);
|
||||||
}
|
}
|
||||||
return output_Unicode.Size();
|
return output_Unicode.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int32_t unicode::convertUnicodeToIso(charset_te inputCharset, etk::VectorType<uniChar_t>& input_Unicode, etk::VectorType<char>& output_ISO)
|
int32_t unicode::convertUnicodeToIso(charset_te inputCharset, std::vector<uniChar_t>& input_Unicode, std::vector<char>& output_ISO)
|
||||||
{
|
{
|
||||||
output_ISO.Clear();
|
output_ISO.clear();
|
||||||
char output[10];
|
char output[10];
|
||||||
for(int32_t iii=0; iii<input_Unicode.Size(); iii++) {
|
for(int32_t iii=0; iii<input_Unicode.size(); iii++) {
|
||||||
convertUnicodeToUtf8(input_Unicode[iii], output);
|
convertUnicodeToUtf8(input_Unicode[iii], output);
|
||||||
char * tmp = output;
|
char * tmp = output;
|
||||||
while(*tmp != '\0') {
|
while(*tmp != '\0') {
|
||||||
output_ISO.PushBack(*tmp);
|
output_ISO.push_back(*tmp);
|
||||||
tmp++;
|
tmp++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
output_ISO.PushBack(0);
|
output_ISO.push_back(0);
|
||||||
return output_ISO.Size();
|
return output_ISO.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t unicode::convertUnicodeToIso(charset_te inputCharset, etk::VectorType<uniChar_t>& input_Unicode, etk::VectorType<int8_t>& output_ISO)
|
int32_t unicode::convertUnicodeToIso(charset_te inputCharset, std::vector<uniChar_t>& input_Unicode, std::vector<int8_t>& output_ISO)
|
||||||
{
|
{
|
||||||
output_ISO.Clear();
|
output_ISO.clear();
|
||||||
char output[10];
|
char output[10];
|
||||||
for(int32_t iii=0; iii<input_Unicode.Size(); iii++) {
|
for(int32_t iii=0; iii<input_Unicode.size(); iii++) {
|
||||||
convertUnicodeToUtf8(input_Unicode[iii], output);
|
convertUnicodeToUtf8(input_Unicode[iii], output);
|
||||||
char * tmp = output;
|
char * tmp = output;
|
||||||
while(*tmp != '\0') {
|
while(*tmp != '\0') {
|
||||||
output_ISO.PushBack(*tmp);
|
output_ISO.push_back(*tmp);
|
||||||
tmp++;
|
tmp++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
output_ISO.PushBack(0);
|
output_ISO.push_back(0);
|
||||||
return output_ISO.Size();
|
return output_ISO.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -254,45 +254,45 @@ void unicode::convertUtf8ToUnicode(char * input_UTF8, uniChar_t &output_Unicode)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int32_t unicode::convertUnicodeToUtf8(const etk::VectorType<uniChar_t>& input_Unicode, etk::VectorType<char>& output_UTF8)
|
int32_t unicode::convertUnicodeToUtf8(const std::vector<uniChar_t>& input_Unicode, std::vector<char>& output_UTF8)
|
||||||
{
|
{
|
||||||
char output[10];
|
char output[10];
|
||||||
|
|
||||||
for (int32_t iii=0; iii<input_Unicode.Size(); iii++) {
|
for (int32_t iii=0; iii<input_Unicode.size(); iii++) {
|
||||||
unicode::convertUnicodeToUtf8(input_Unicode[iii], output);
|
unicode::convertUnicodeToUtf8(input_Unicode[iii], output);
|
||||||
char * tmp = output ;
|
char * tmp = output ;
|
||||||
while (*tmp != '\0') {
|
while (*tmp != '\0') {
|
||||||
output_UTF8.PushBack(*tmp);
|
output_UTF8.push_back(*tmp);
|
||||||
tmp++;
|
tmp++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
output_UTF8.PushBack('\0');
|
output_UTF8.push_back('\0');
|
||||||
return output_UTF8.Size()-1;
|
return output_UTF8.size()-1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t unicode::convertUnicodeToUtf8(const etk::VectorType<uniChar_t>& input_Unicode, etk::VectorType<int8_t>& output_UTF8)
|
int32_t unicode::convertUnicodeToUtf8(const std::vector<uniChar_t>& input_Unicode, std::vector<int8_t>& output_UTF8)
|
||||||
{
|
{
|
||||||
char output[10];
|
char output[10];
|
||||||
|
|
||||||
for (int32_t iii=0; iii<input_Unicode.Size(); iii++) {
|
for (int32_t iii=0; iii<input_Unicode.size(); iii++) {
|
||||||
unicode::convertUnicodeToUtf8(input_Unicode[iii], output);
|
unicode::convertUnicodeToUtf8(input_Unicode[iii], output);
|
||||||
char * tmp = output ;
|
char * tmp = output ;
|
||||||
while (*tmp != '\0') {
|
while (*tmp != '\0') {
|
||||||
output_UTF8.PushBack((int8_t)*tmp);
|
output_UTF8.push_back((int8_t)*tmp);
|
||||||
tmp++;
|
tmp++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
output_UTF8.PushBack('\0');
|
output_UTF8.push_back('\0');
|
||||||
return output_UTF8.Size()-1;
|
return output_UTF8.size()-1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int32_t unicode::convertUtf8ToUnicode(etk::VectorType<char>& input_UTF8, etk::VectorType<uniChar_t>& output_Unicode)
|
int32_t unicode::convertUtf8ToUnicode(std::vector<char>& input_UTF8, std::vector<uniChar_t>& output_Unicode)
|
||||||
{
|
{
|
||||||
char tmpData[20];
|
char tmpData[20];
|
||||||
int32_t pos = 0;
|
int32_t pos = 0;
|
||||||
while (pos < input_UTF8.Size()) {
|
while (pos < input_UTF8.size()) {
|
||||||
int32_t lenMax = input_UTF8.Size() - pos;
|
int32_t lenMax = input_UTF8.size() - pos;
|
||||||
//4 case
|
//4 case
|
||||||
if( 1<=lenMax
|
if( 1<=lenMax
|
||||||
&& 0x00 == (input_UTF8[pos+0] & 0x80) )
|
&& 0x00 == (input_UTF8[pos+0] & 0x80) )
|
||||||
@ -333,17 +333,17 @@ int32_t unicode::convertUtf8ToUnicode(etk::VectorType<char>& input_UTF8, etk::Ve
|
|||||||
}
|
}
|
||||||
uniChar_t tmpUnicode;
|
uniChar_t tmpUnicode;
|
||||||
convertUtf8ToUnicode(tmpData, tmpUnicode);
|
convertUtf8ToUnicode(tmpData, tmpUnicode);
|
||||||
output_Unicode.PushBack(tmpUnicode);
|
output_Unicode.push_back(tmpUnicode);
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t unicode::convertUtf8ToUnicode(etk::VectorType<int8_t>& input_UTF8, etk::VectorType<uniChar_t>& output_Unicode)
|
int32_t unicode::convertUtf8ToUnicode(std::vector<int8_t>& input_UTF8, std::vector<uniChar_t>& output_Unicode)
|
||||||
{
|
{
|
||||||
char tmpData[20];
|
char tmpData[20];
|
||||||
int32_t pos = 0;
|
int32_t pos = 0;
|
||||||
while (pos < input_UTF8.Size()) {
|
while (pos < input_UTF8.size()) {
|
||||||
int32_t lenMax = input_UTF8.Size() - pos;
|
int32_t lenMax = input_UTF8.size() - pos;
|
||||||
//4 case
|
//4 case
|
||||||
if( 1<=lenMax
|
if( 1<=lenMax
|
||||||
&& 0x00 == (input_UTF8[pos+0] & 0x80) )
|
&& 0x00 == (input_UTF8[pos+0] & 0x80) )
|
||||||
@ -384,12 +384,12 @@ int32_t unicode::convertUtf8ToUnicode(etk::VectorType<int8_t>& input_UTF8, etk::
|
|||||||
}
|
}
|
||||||
uniChar_t tmpUnicode;
|
uniChar_t tmpUnicode;
|
||||||
convertUtf8ToUnicode(tmpData, tmpUnicode);
|
convertUtf8ToUnicode(tmpData, tmpUnicode);
|
||||||
output_Unicode.PushBack(tmpUnicode);
|
output_Unicode.push_back(tmpUnicode);
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t unicode::convertUtf8ToUnicode(char * input_UTF8, etk::VectorType<uniChar_t>& output_Unicode)
|
int32_t unicode::convertUtf8ToUnicode(char * input_UTF8, std::vector<uniChar_t>& output_Unicode)
|
||||||
{
|
{
|
||||||
char tmpData[20];
|
char tmpData[20];
|
||||||
int32_t pos = 0;
|
int32_t pos = 0;
|
||||||
@ -439,7 +439,7 @@ int32_t unicode::convertUtf8ToUnicode(char * input_UTF8, etk::VectorType<uniChar
|
|||||||
}
|
}
|
||||||
uniChar_t tmpUnicode;
|
uniChar_t tmpUnicode;
|
||||||
convertUtf8ToUnicode(tmpData, tmpUnicode);
|
convertUtf8ToUnicode(tmpData, tmpUnicode);
|
||||||
output_Unicode.PushBack(tmpUnicode);
|
output_Unicode.push_back(tmpUnicode);
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -466,14 +466,14 @@ void unicode::convertUtf8ToIso(charset_te inputCharset, char * input_UTF8, char
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int32_t unicode::convertIsoToUtf8(charset_te inputCharset, etk::VectorType<char>& input_ISO, etk::VectorType<char>& output_UTF8)
|
int32_t unicode::convertIsoToUtf8(charset_te inputCharset, std::vector<char>& input_ISO, std::vector<char>& output_UTF8)
|
||||||
{
|
{
|
||||||
TK_WARNING("TODO : not coded...");
|
TK_WARNING("TODO : not coded...");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int32_t unicode::convertUtf8ToIso(charset_te inputCharset, etk::VectorType<char>& input_UTF8, etk::VectorType<char>& output_ISO)
|
int32_t unicode::convertUtf8ToIso(charset_te inputCharset, std::vector<char>& input_UTF8, std::vector<char>& output_ISO)
|
||||||
{
|
{
|
||||||
TK_WARNING("TODO : not coded...");
|
TK_WARNING("TODO : not coded...");
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -26,7 +26,7 @@
|
|||||||
#define __UNICODE_H__
|
#define __UNICODE_H__
|
||||||
|
|
||||||
#include <etk/Types.h>
|
#include <etk/Types.h>
|
||||||
#include <etk/VectorType.h>
|
#include <vector>
|
||||||
namespace unicode {
|
namespace unicode {
|
||||||
typedef enum {
|
typedef enum {
|
||||||
EDN_CHARSET_UTF8,
|
EDN_CHARSET_UTF8,
|
||||||
@ -49,23 +49,23 @@ namespace unicode {
|
|||||||
// transform ISO <==> Unicode
|
// transform ISO <==> Unicode
|
||||||
void convertIsoToUnicode(charset_te inputCharset, char input_ISO, uniChar_t & output_Unicode);
|
void convertIsoToUnicode(charset_te inputCharset, char input_ISO, uniChar_t & output_Unicode);
|
||||||
void convertUnicodeToIso(charset_te inputCharset, uniChar_t input_Unicode, char & output_ISO);
|
void convertUnicodeToIso(charset_te inputCharset, uniChar_t input_Unicode, char & output_ISO);
|
||||||
int32_t convertIsoToUnicode(charset_te inputCharset, etk::VectorType<char>& input_ISO, etk::VectorType<uniChar_t>& output_Unicode);
|
int32_t convertIsoToUnicode(charset_te inputCharset, std::vector<char>& input_ISO, std::vector<uniChar_t>& output_Unicode);
|
||||||
int32_t convertIsoToUnicode(charset_te inputCharset, etk::VectorType<int8_t>& input_ISO, etk::VectorType<uniChar_t>& output_Unicode);
|
int32_t convertIsoToUnicode(charset_te inputCharset, std::vector<int8_t>& input_ISO, std::vector<uniChar_t>& output_Unicode);
|
||||||
int32_t convertUnicodeToIso(charset_te inputCharset, etk::VectorType<uniChar_t>& input_Unicode, etk::VectorType<char>& output_ISO);
|
int32_t convertUnicodeToIso(charset_te inputCharset, std::vector<uniChar_t>& input_Unicode, std::vector<char>& output_ISO);
|
||||||
int32_t convertUnicodeToIso(charset_te inputCharset, etk::VectorType<uniChar_t>& input_Unicode, etk::VectorType<int8_t>& output_ISO);
|
int32_t convertUnicodeToIso(charset_te inputCharset, std::vector<uniChar_t>& input_Unicode, std::vector<int8_t>& output_ISO);
|
||||||
// Transform UTF-8 <==> Unicode
|
// Transform UTF-8 <==> Unicode
|
||||||
void convertUnicodeToUtf8( uniChar_t input_Unicode, char * output_UTF8);
|
void convertUnicodeToUtf8( uniChar_t input_Unicode, char * output_UTF8);
|
||||||
void convertUtf8ToUnicode( char * input_UTF8, uniChar_t& output_Unicode);
|
void convertUtf8ToUnicode( char * input_UTF8, uniChar_t& output_Unicode);
|
||||||
int32_t convertUnicodeToUtf8( const etk::VectorType<uniChar_t>& input_Unicode, etk::VectorType<char>& output_UTF8);
|
int32_t convertUnicodeToUtf8( const std::vector<uniChar_t>& input_Unicode, std::vector<char>& output_UTF8);
|
||||||
int32_t convertUnicodeToUtf8( const etk::VectorType<uniChar_t>& input_Unicode, etk::VectorType<int8_t>& output_UTF8);
|
int32_t convertUnicodeToUtf8( const std::vector<uniChar_t>& input_Unicode, std::vector<int8_t>& output_UTF8);
|
||||||
int32_t convertUtf8ToUnicode( etk::VectorType<char>& input_UTF8, etk::VectorType<uniChar_t>& output_Unicode);
|
int32_t convertUtf8ToUnicode( std::vector<char>& input_UTF8, std::vector<uniChar_t>& output_Unicode);
|
||||||
int32_t convertUtf8ToUnicode( etk::VectorType<int8_t>& input_UTF8, etk::VectorType<uniChar_t>& output_Unicode);
|
int32_t convertUtf8ToUnicode( std::vector<int8_t>& input_UTF8, std::vector<uniChar_t>& output_Unicode);
|
||||||
int32_t convertUtf8ToUnicode( char * input_UTF8, etk::VectorType<uniChar_t>& output_Unicode);
|
int32_t convertUtf8ToUnicode( char * input_UTF8, std::vector<uniChar_t>& output_Unicode);
|
||||||
// Transform ISO <==> UTF-8
|
// Transform ISO <==> UTF-8
|
||||||
void convertIsoToUtf8( charset_te inputCharset, char input_ISO, char * output_UTF8);
|
void convertIsoToUtf8( charset_te inputCharset, char input_ISO, char * output_UTF8);
|
||||||
void convertUtf8ToIso( charset_te inputCharset, char * input_UTF8, char & output_ISO);
|
void convertUtf8ToIso( charset_te inputCharset, char * input_UTF8, char & output_ISO);
|
||||||
int32_t convertIsoToUtf8( charset_te inputCharset, etk::VectorType<char>& input_ISO, etk::VectorType<char>& output_UTF8);
|
int32_t convertIsoToUtf8( charset_te inputCharset, std::vector<char>& input_ISO, std::vector<char>& output_UTF8);
|
||||||
int32_t convertUtf8ToIso( charset_te inputCharset, etk::VectorType<char>& input_UTF8, etk::VectorType<char>& output_ISO);
|
int32_t convertUtf8ToIso( charset_te inputCharset, std::vector<char>& input_UTF8, std::vector<char>& output_ISO);
|
||||||
|
|
||||||
void Utf8_SizeElement(const char * data, int32_t lenMax , uint8_t &size, bool &baseValid);
|
void Utf8_SizeElement(const char * data, int32_t lenMax , uint8_t &size, bool &baseValid);
|
||||||
int32_t strUtf8Len(const char *input_UTF8);
|
int32_t strUtf8Len(const char *input_UTF8);
|
||||||
|
@ -311,14 +311,14 @@ class RequestPlay {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
#include <etk/VectorType.h>
|
#include <vector>
|
||||||
etk::VectorType<EffectsLoaded*> ListEffects;
|
std::vector<EffectsLoaded*> ListEffects;
|
||||||
etk::VectorType<RequestPlay*> ListEffectsPlaying;
|
std::vector<RequestPlay*> ListEffectsPlaying;
|
||||||
|
|
||||||
|
|
||||||
int32_t ewol::audio::effects::Add(etk::UString file)
|
int32_t ewol::audio::effects::Add(etk::UString file)
|
||||||
{
|
{
|
||||||
for (int32_t iii=0; iii<ListEffects.Size(); iii++) {
|
for (int32_t iii=0; iii<ListEffects.size(); iii++) {
|
||||||
if (NULL != ListEffects[iii]) {
|
if (NULL != ListEffects[iii]) {
|
||||||
if (ListEffects[iii]->m_file == file) {
|
if (ListEffects[iii]->m_file == file) {
|
||||||
ListEffects[iii]->m_requestedTime++;
|
ListEffects[iii]->m_requestedTime++;
|
||||||
@ -332,16 +332,16 @@ int32_t ewol::audio::effects::Add(etk::UString file)
|
|||||||
EWOL_ERROR("Error to load the effects : \"" << file << "\"");
|
EWOL_ERROR("Error to load the effects : \"" << file << "\"");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
ListEffects.PushBack(tmpEffect);
|
ListEffects.push_back(tmpEffect);
|
||||||
return ListEffects.Size()-1;
|
return ListEffects.size()-1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void ewol::audio::effects::Rm(int32_t effectId)
|
void ewol::audio::effects::Rm(int32_t effectId)
|
||||||
{
|
{
|
||||||
// find element ...
|
// find element ...
|
||||||
if (effectId <0 || effectId >= ListEffects.Size()) {
|
if (effectId <0 || effectId >= ListEffects.size()) {
|
||||||
EWOL_ERROR("Wrong effect ID : " << effectId << " != [0.." << ListEffects.Size()-1 << "] ==> can not remove it ...");
|
EWOL_ERROR("Wrong effect ID : " << effectId << " != [0.." << ListEffects.size()-1 << "] ==> can not remove it ...");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (ListEffects[effectId] == NULL) {
|
if (ListEffects[effectId] == NULL) {
|
||||||
@ -361,8 +361,8 @@ void ewol::audio::effects::Rm(int32_t effectId)
|
|||||||
|
|
||||||
void ewol::audio::effects::Play(int32_t effectId, float xxx, float yyy)
|
void ewol::audio::effects::Play(int32_t effectId, float xxx, float yyy)
|
||||||
{
|
{
|
||||||
if (effectId <0 || effectId >= ListEffects.Size()) {
|
if (effectId <0 || effectId >= ListEffects.size()) {
|
||||||
EWOL_ERROR("Wrong effect ID : " << effectId << " != [0.." << ListEffects.Size()-1 << "] ==> can not play it ...");
|
EWOL_ERROR("Wrong effect ID : " << effectId << " != [0.." << ListEffects.size()-1 << "] ==> can not play it ...");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (ListEffects[effectId] == NULL) {
|
if (ListEffects[effectId] == NULL) {
|
||||||
@ -371,7 +371,7 @@ void ewol::audio::effects::Play(int32_t effectId, float xxx, float yyy)
|
|||||||
}
|
}
|
||||||
EWOL_VERBOSE("effect play : " << effectId );
|
EWOL_VERBOSE("effect play : " << effectId );
|
||||||
// try to find an empty slot :
|
// try to find an empty slot :
|
||||||
for (int32_t iii=0; iii<ListEffectsPlaying.Size(); iii++) {
|
for (int32_t iii=0; iii<ListEffectsPlaying.size(); iii++) {
|
||||||
if (ListEffectsPlaying[iii]->IsFree()) {
|
if (ListEffectsPlaying[iii]->IsFree()) {
|
||||||
ListEffectsPlaying[iii]->Reset(ListEffects[effectId]);
|
ListEffectsPlaying[iii]->Reset(ListEffects[effectId]);
|
||||||
return;
|
return;
|
||||||
@ -382,7 +382,7 @@ void ewol::audio::effects::Play(int32_t effectId, float xxx, float yyy)
|
|||||||
EWOL_CRITICAL("Allocation error of a playing element : " << effectId);
|
EWOL_CRITICAL("Allocation error of a playing element : " << effectId);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
ListEffectsPlaying.PushBack(newPlay);
|
ListEffectsPlaying.push_back(newPlay);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -429,7 +429,7 @@ void ewol::audio::effects::MuteSet(bool newMute)
|
|||||||
|
|
||||||
void ewol::audio::effects::GetData(int16_t * bufferInterlace, int32_t nbSample, int32_t nbChannels)
|
void ewol::audio::effects::GetData(int16_t * bufferInterlace, int32_t nbSample, int32_t nbChannels)
|
||||||
{
|
{
|
||||||
for (int32_t iii=0; iii<ListEffectsPlaying.Size(); iii++) {
|
for (int32_t iii=0; iii<ListEffectsPlaying.size(); iii++) {
|
||||||
if (ListEffectsPlaying[iii]!= NULL) {
|
if (ListEffectsPlaying[iii]!= NULL) {
|
||||||
ListEffectsPlaying[iii]->Play(bufferInterlace, nbSample, nbChannels);
|
ListEffectsPlaying[iii]->Play(bufferInterlace, nbSample, nbChannels);
|
||||||
}
|
}
|
||||||
|
@ -38,20 +38,20 @@ extern "C" {
|
|||||||
};
|
};
|
||||||
|
|
||||||
// internal element of the widget manager :
|
// internal element of the widget manager :
|
||||||
static etk::VectorType<messageList_ts> m_messageList; // all widget allocated ==> all time increment ... never removed ...
|
static std::vector<messageList_ts> m_messageList; // all widget allocated ==> all time increment ... never removed ...
|
||||||
|
|
||||||
|
|
||||||
void ewol::EObjectMessageMultiCast::Init(void)
|
void ewol::EObjectMessageMultiCast::Init(void)
|
||||||
{
|
{
|
||||||
EWOL_INFO("EObject message Multi-Cast");
|
EWOL_INFO("EObject message Multi-Cast");
|
||||||
m_messageList.Clear();
|
m_messageList.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void ewol::EObjectMessageMultiCast::UnInit(void)
|
void ewol::EObjectMessageMultiCast::UnInit(void)
|
||||||
{
|
{
|
||||||
EWOL_INFO("EObject message Multi-Cast");
|
EWOL_INFO("EObject message Multi-Cast");
|
||||||
m_messageList.Clear();
|
m_messageList.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -68,7 +68,7 @@ static void MultiCastAdd(ewol::EObject* object, const char* const message)
|
|||||||
messageList_ts tmpMessage;
|
messageList_ts tmpMessage;
|
||||||
tmpMessage.object = object;
|
tmpMessage.object = object;
|
||||||
tmpMessage.message = message;
|
tmpMessage.message = message;
|
||||||
m_messageList.PushBack(tmpMessage);
|
m_messageList.push_back(tmpMessage);
|
||||||
EWOL_DEBUG("SendMulticast ADD listener :" << object->GetId() << " on \"" << message << "\"" );
|
EWOL_DEBUG("SendMulticast ADD listener :" << object->GetId() << " on \"" << message << "\"" );
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -80,12 +80,12 @@ static void MultiCastRm(ewol::EObject* object)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// send the message at all registered widget ...
|
// send the message at all registered widget ...
|
||||||
for (int32_t iii=m_messageList.Size()-1; iii>=0; iii--) {
|
for (int32_t iii=m_messageList.size()-1; iii>=0; iii--) {
|
||||||
if(m_messageList[iii].object == object) {
|
if(m_messageList[iii].object == object) {
|
||||||
EWOL_DEBUG("SendMulticast RM listener :" << object->GetId());
|
EWOL_DEBUG("SendMulticast RM listener :" << object->GetId());
|
||||||
m_messageList[iii].message = NULL;
|
m_messageList[iii].message = NULL;
|
||||||
m_messageList[iii].object = NULL;
|
m_messageList[iii].object = NULL;
|
||||||
m_messageList.Erase(iii);
|
m_messageList.erase(m_messageList.begin()+iii);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -95,7 +95,7 @@ static void MultiCastSend(ewol::EObject* object, const char* const message, etk:
|
|||||||
EWOL_VERBOSE("SendMulticast message \"" << message << "\" data=\"" << data << "\" to :");
|
EWOL_VERBOSE("SendMulticast message \"" << message << "\" data=\"" << data << "\" to :");
|
||||||
|
|
||||||
// send the message at all registered widget ...
|
// send the message at all registered widget ...
|
||||||
for (int32_t iii=0; iii<m_messageList.Size(); iii++) {
|
for (int32_t iii=0; iii<m_messageList.size(); iii++) {
|
||||||
if( m_messageList[iii].message == message
|
if( m_messageList[iii].message == message
|
||||||
&& m_messageList[iii].object != object)
|
&& m_messageList[iii].object != object)
|
||||||
{
|
{
|
||||||
@ -138,14 +138,14 @@ ewol::EObject::~EObject(void)
|
|||||||
ewol::EObjectManager::Rm(this);
|
ewol::EObjectManager::Rm(this);
|
||||||
MultiCastRm(this);
|
MultiCastRm(this);
|
||||||
EWOL_DEBUG("delete EObject : [" << m_uniqueId << "]");
|
EWOL_DEBUG("delete EObject : [" << m_uniqueId << "]");
|
||||||
for (int32_t iii=0; iii<m_externEvent.Size(); iii++) {
|
for (int32_t iii=0; iii<m_externEvent.size(); iii++) {
|
||||||
if (NULL!=m_externEvent[iii]) {
|
if (NULL!=m_externEvent[iii]) {
|
||||||
delete(m_externEvent[iii]);
|
delete(m_externEvent[iii]);
|
||||||
m_externEvent[iii] = NULL;
|
m_externEvent[iii] = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
m_externEvent.Clear();
|
m_externEvent.clear();
|
||||||
m_availlableEventId.Clear();
|
m_availlableEventId.clear();
|
||||||
m_uniqueId = -1;
|
m_uniqueId = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -169,7 +169,7 @@ int32_t ewol::EObject::GetId(void)
|
|||||||
void ewol::EObject::AddEventId(const char * generateEventId)
|
void ewol::EObject::AddEventId(const char * generateEventId)
|
||||||
{
|
{
|
||||||
if (NULL != generateEventId) {
|
if (NULL != generateEventId) {
|
||||||
m_availlableEventId.PushBack(generateEventId);
|
m_availlableEventId.push_back(generateEventId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -183,7 +183,7 @@ void ewol::EObject::AddEventId(const char * generateEventId)
|
|||||||
void ewol::EObject::GenerateEventId(const char * generateEventId, const etk::UString data)
|
void ewol::EObject::GenerateEventId(const char * generateEventId, const etk::UString data)
|
||||||
{
|
{
|
||||||
// for every element registered ...
|
// for every element registered ...
|
||||||
for (int32_t iii=0; iii<m_externEvent.Size(); iii++) {
|
for (int32_t iii=0; iii<m_externEvent.size(); iii++) {
|
||||||
if (NULL!=m_externEvent[iii]) {
|
if (NULL!=m_externEvent[iii]) {
|
||||||
// if we find the event ...
|
// if we find the event ...
|
||||||
if (m_externEvent[iii]->localEventId == generateEventId) {
|
if (m_externEvent[iii]->localEventId == generateEventId) {
|
||||||
@ -235,7 +235,7 @@ void ewol::EObject::RegisterOnEvent(ewol::EObject * destinationObject, const cha
|
|||||||
}
|
}
|
||||||
// check if event existed :
|
// check if event existed :
|
||||||
bool findIt = false;
|
bool findIt = false;
|
||||||
for(int32_t iii=0; iii<m_availlableEventId.Size(); iii++) {
|
for(int32_t iii=0; iii<m_availlableEventId.size(); iii++) {
|
||||||
if (m_availlableEventId[iii] == eventId) {
|
if (m_availlableEventId[iii] == eventId) {
|
||||||
findIt = true;
|
findIt = true;
|
||||||
break;
|
break;
|
||||||
@ -243,7 +243,7 @@ void ewol::EObject::RegisterOnEvent(ewol::EObject * destinationObject, const cha
|
|||||||
}
|
}
|
||||||
if (false == findIt) {
|
if (false == findIt) {
|
||||||
EWOL_DEBUG("Try to register with a NON direct string name");
|
EWOL_DEBUG("Try to register with a NON direct string name");
|
||||||
for(int32_t iii=0; iii<m_availlableEventId.Size(); iii++) {
|
for(int32_t iii=0; iii<m_availlableEventId.size(); iii++) {
|
||||||
if (0 == strncmp(m_availlableEventId[iii], eventId, 1024)) {
|
if (0 == strncmp(m_availlableEventId[iii], eventId, 1024)) {
|
||||||
findIt = true;
|
findIt = true;
|
||||||
eventIdgenerated = m_availlableEventId[iii];
|
eventIdgenerated = m_availlableEventId[iii];
|
||||||
@ -267,7 +267,7 @@ void ewol::EObject::RegisterOnEvent(ewol::EObject * destinationObject, const cha
|
|||||||
} else {
|
} else {
|
||||||
tmpEvent->destEventId = eventId;
|
tmpEvent->destEventId = eventId;
|
||||||
}
|
}
|
||||||
m_externEvent.PushBack(tmpEvent);
|
m_externEvent.push_back(tmpEvent);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -278,11 +278,11 @@ void ewol::EObject::RegisterOnEvent(ewol::EObject * destinationObject, const cha
|
|||||||
*/
|
*/
|
||||||
void ewol::EObject::OnObjectRemove(ewol::EObject * removeObject)
|
void ewol::EObject::OnObjectRemove(ewol::EObject * removeObject)
|
||||||
{
|
{
|
||||||
for(int32_t iii=m_externEvent.Size()-1; iii>=0; iii--) {
|
for(int32_t iii=m_externEvent.size()-1; iii>=0; iii--) {
|
||||||
if (NULL==m_externEvent[iii]) {
|
if (NULL==m_externEvent[iii]) {
|
||||||
m_externEvent.Erase(iii);
|
m_externEvent.erase(m_externEvent.begin()+iii);
|
||||||
} else if (m_externEvent[iii]->destEObject == removeObject) {
|
} else if (m_externEvent[iii]->destEObject == removeObject) {
|
||||||
m_externEvent.Erase(iii);
|
m_externEvent.erase(m_externEvent.begin()+iii);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -27,7 +27,7 @@
|
|||||||
|
|
||||||
#include <etk/Types.h>
|
#include <etk/Types.h>
|
||||||
#include <etk/UString.h>
|
#include <etk/UString.h>
|
||||||
#include <etk/VectorType.h>
|
#include <vector>
|
||||||
|
|
||||||
namespace ewol {
|
namespace ewol {
|
||||||
namespace EObjectMessageMultiCast {
|
namespace EObjectMessageMultiCast {
|
||||||
@ -55,8 +55,8 @@ namespace ewol {
|
|||||||
class EObject {
|
class EObject {
|
||||||
private:
|
private:
|
||||||
int32_t m_uniqueId; //!< Object UniqueID ==> TODO : Check if it use is needed
|
int32_t m_uniqueId; //!< Object UniqueID ==> TODO : Check if it use is needed
|
||||||
etk::VectorType<EventExtGen*> m_externEvent; //!< Generic list of event generation for output link
|
std::vector<EventExtGen*> m_externEvent; //!< Generic list of event generation for output link
|
||||||
etk::VectorType<const char*> m_availlableEventId; //!< List of all event availlable for this widget
|
std::vector<const char*> m_availlableEventId; //!< List of all event availlable for this widget
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
* @brief Constructor
|
* @brief Constructor
|
||||||
|
@ -31,8 +31,8 @@
|
|||||||
static bool IsInit = false;
|
static bool IsInit = false;
|
||||||
|
|
||||||
// internal element of the widget manager :
|
// internal element of the widget manager :
|
||||||
static etk::VectorType<ewol::EObject*> m_eObjectList; // all widget allocated ==> all time increment ... never removed ...
|
static std::vector<ewol::EObject*> m_eObjectList; // all widget allocated ==> all time increment ... never removed ...
|
||||||
static etk::VectorType<ewol::EObject*> m_eObjectDeletedList; // all widget allocated
|
static std::vector<ewol::EObject*> m_eObjectDeletedList; // all widget allocated
|
||||||
|
|
||||||
|
|
||||||
void ewol::EObjectManager::Init(void)
|
void ewol::EObjectManager::Init(void)
|
||||||
@ -40,8 +40,8 @@ void ewol::EObjectManager::Init(void)
|
|||||||
EWOL_DEBUG("==> Init EObject-Manager");
|
EWOL_DEBUG("==> Init EObject-Manager");
|
||||||
// Can create mlemory leak ... ==> but not predictable comportement otherwise ...
|
// Can create mlemory leak ... ==> but not predictable comportement otherwise ...
|
||||||
// TODO : Check if we can do sotthing better
|
// TODO : Check if we can do sotthing better
|
||||||
m_eObjectDeletedList.Clear();
|
m_eObjectDeletedList.clear();
|
||||||
m_eObjectList.Clear();
|
m_eObjectList.clear();
|
||||||
IsInit = true;
|
IsInit = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -53,11 +53,11 @@ void ewol::EObjectManager::UnInit(void)
|
|||||||
ewol::EObjectManager::RemoveAllMark();
|
ewol::EObjectManager::RemoveAllMark();
|
||||||
}
|
}
|
||||||
EWOL_INFO(" Remove missing user widget");
|
EWOL_INFO(" Remove missing user widget");
|
||||||
while(0<m_eObjectList.Size()) {
|
while(0<m_eObjectList.size()) {
|
||||||
if (m_eObjectList[0]!=NULL) {
|
if (m_eObjectList[0]!=NULL) {
|
||||||
MarkToRemoved(m_eObjectList[0]);
|
MarkToRemoved(m_eObjectList[0]);
|
||||||
} else {
|
} else {
|
||||||
m_eObjectList.Erase(0);
|
m_eObjectList.erase(m_eObjectList.begin());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// local acces ==> this control the mutex Lock
|
// local acces ==> this control the mutex Lock
|
||||||
@ -70,7 +70,7 @@ void ewol::EObjectManager::Add(ewol::EObject* object)
|
|||||||
{
|
{
|
||||||
// TODO : Chek if not existed before ...
|
// TODO : Chek if not existed before ...
|
||||||
if (NULL != object) {
|
if (NULL != object) {
|
||||||
m_eObjectList.PushBack(object);
|
m_eObjectList.push_back(object);
|
||||||
} else {
|
} else {
|
||||||
EWOL_ERROR("try to add an inexistant EObject in manager");
|
EWOL_ERROR("try to add an inexistant EObject in manager");
|
||||||
}
|
}
|
||||||
@ -82,18 +82,18 @@ void ewol::EObjectManager::Rm(ewol::EObject* object)
|
|||||||
EWOL_ERROR("Try to remove (NULL) EObject");
|
EWOL_ERROR("Try to remove (NULL) EObject");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
for (int32_t iii=0; iii<m_eObjectList.Size(); iii++) {
|
for (int32_t iii=0; iii<m_eObjectList.size(); iii++) {
|
||||||
if (m_eObjectList[iii] == object) {
|
if (m_eObjectList[iii] == object) {
|
||||||
// Remove Element
|
// Remove Element
|
||||||
m_eObjectList.Erase(iii);
|
m_eObjectList.erase(m_eObjectList.begin()+iii);
|
||||||
EWOL_CRITICAL("EObject direct remove is really DANGEROUS due to the multithreading ...");
|
EWOL_CRITICAL("EObject direct remove is really DANGEROUS due to the multithreading ...");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (int32_t iii=0; iii<m_eObjectDeletedList.Size(); iii++) {
|
for (int32_t iii=0; iii<m_eObjectDeletedList.size(); iii++) {
|
||||||
if (m_eObjectDeletedList[iii] == object) {
|
if (m_eObjectDeletedList[iii] == object) {
|
||||||
// Remove Element
|
// Remove Element
|
||||||
m_eObjectDeletedList.Erase(iii);
|
m_eObjectDeletedList.erase(m_eObjectDeletedList.begin()+iii);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -104,7 +104,7 @@ void ewol::EObjectManager::Rm(ewol::EObject* object)
|
|||||||
|
|
||||||
void informOneObjectIsRemoved(ewol::EObject* object)
|
void informOneObjectIsRemoved(ewol::EObject* object)
|
||||||
{
|
{
|
||||||
for (int32_t iii=0; iii<m_eObjectList.Size(); iii++) {
|
for (int32_t iii=0; iii<m_eObjectList.size(); iii++) {
|
||||||
if (m_eObjectList[iii] != NULL) {
|
if (m_eObjectList[iii] != NULL) {
|
||||||
m_eObjectList[iii]->OnObjectRemove(object);
|
m_eObjectList[iii]->OnObjectRemove(object);
|
||||||
}
|
}
|
||||||
@ -122,7 +122,7 @@ void ewol::EObjectManager::MarkToRemoved(ewol::EObject* object)
|
|||||||
}
|
}
|
||||||
int32_t findId = -1;
|
int32_t findId = -1;
|
||||||
// check if the widget is not destroy :
|
// check if the widget is not destroy :
|
||||||
for(int32_t iii=0; iii<m_eObjectList.Size(); iii++) {
|
for(int32_t iii=0; iii<m_eObjectList.size(); iii++) {
|
||||||
if (m_eObjectList[iii] == object) {
|
if (m_eObjectList[iii] == object) {
|
||||||
findId = iii;
|
findId = iii;
|
||||||
break;
|
break;
|
||||||
@ -132,9 +132,9 @@ void ewol::EObjectManager::MarkToRemoved(ewol::EObject* object)
|
|||||||
EWOL_CRITICAL("Try to mark remove an object already removed (or not registerd [imposible case]) ==> requested for EObject : [" << object->GetId() << "] type=" << object->GetObjectType());
|
EWOL_CRITICAL("Try to mark remove an object already removed (or not registerd [imposible case]) ==> requested for EObject : [" << object->GetId() << "] type=" << object->GetObjectType());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
m_eObjectList.Erase(findId);
|
m_eObjectList.erase(m_eObjectList.begin()+findId);
|
||||||
EWOL_DEBUG("MarkToRemoved EObject : [" << object->GetId() << "] type=" << object->GetObjectType());
|
EWOL_DEBUG("MarkToRemoved EObject : [" << object->GetId() << "] type=" << object->GetObjectType());
|
||||||
m_eObjectDeletedList.PushBack(object);
|
m_eObjectDeletedList.push_back(object);
|
||||||
// Informe all EObject to remove reference of this one ...
|
// Informe all EObject to remove reference of this one ...
|
||||||
informOneObjectIsRemoved(object);
|
informOneObjectIsRemoved(object);
|
||||||
}
|
}
|
||||||
@ -143,9 +143,9 @@ void ewol::EObjectManager::MarkToRemoved(ewol::EObject* object)
|
|||||||
|
|
||||||
void ewol::EObjectManager::RemoveAllMark(void)
|
void ewol::EObjectManager::RemoveAllMark(void)
|
||||||
{
|
{
|
||||||
etk::VectorType<ewol::EObject*> m_tmpList = m_eObjectDeletedList;
|
std::vector<ewol::EObject*> m_tmpList = m_eObjectDeletedList;
|
||||||
// direct delete of the current list ...
|
// direct delete of the current list ...
|
||||||
for(int32_t iii=0; iii<m_tmpList.Size(); iii++) {
|
for(int32_t iii=0; iii<m_tmpList.size(); iii++) {
|
||||||
if (NULL != m_tmpList[iii]) {
|
if (NULL != m_tmpList[iii]) {
|
||||||
delete(m_tmpList[iii]);
|
delete(m_tmpList[iii]);
|
||||||
m_tmpList[iii] = NULL;
|
m_tmpList[iii] = NULL;
|
||||||
|
@ -28,6 +28,7 @@
|
|||||||
#include <etk/Types.h>
|
#include <etk/Types.h>
|
||||||
#include <ewol/Debug.h>
|
#include <ewol/Debug.h>
|
||||||
#include <etk/File.h>
|
#include <etk/File.h>
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
|
|
||||||
namespace ewol
|
namespace ewol
|
||||||
@ -57,27 +58,27 @@ namespace ewol
|
|||||||
clipping_ts & drawClipping,
|
clipping_ts & drawClipping,
|
||||||
const etk::UString & unicodeString,
|
const etk::UString & unicodeString,
|
||||||
int32_t & fontTextureId,
|
int32_t & fontTextureId,
|
||||||
etk::VectorType<Vector2D<float> > & coord,
|
std::vector<Vector2D<float> > & coord,
|
||||||
etk::VectorType<texCoord_ts> & coordTex);
|
std::vector<texCoord_ts> & coordTex);
|
||||||
int32_t DrawText(int32_t fontID,
|
int32_t DrawText(int32_t fontID,
|
||||||
Vector2D<float> textPos,
|
Vector2D<float> textPos,
|
||||||
clipping_ts & drawClipping,
|
clipping_ts & drawClipping,
|
||||||
const uniChar_t unicodeChar,
|
const uniChar_t unicodeChar,
|
||||||
int32_t & fontTextureId,
|
int32_t & fontTextureId,
|
||||||
etk::VectorType<Vector2D<float> > & coord,
|
std::vector<Vector2D<float> > & coord,
|
||||||
etk::VectorType<texCoord_ts> & coordTex);
|
std::vector<texCoord_ts> & coordTex);
|
||||||
int32_t DrawText(int32_t fontID,
|
int32_t DrawText(int32_t fontID,
|
||||||
Vector2D<float> textPos,
|
Vector2D<float> textPos,
|
||||||
const etk::UString & unicodeString,
|
const etk::UString & unicodeString,
|
||||||
int32_t & fontTextureId,
|
int32_t & fontTextureId,
|
||||||
etk::VectorType<Vector2D<float> > & coord,
|
std::vector<Vector2D<float> > & coord,
|
||||||
etk::VectorType<texCoord_ts> & coordTex);
|
std::vector<texCoord_ts> & coordTex);
|
||||||
int32_t DrawText(int32_t fontID,
|
int32_t DrawText(int32_t fontID,
|
||||||
Vector2D<float> textPos,
|
Vector2D<float> textPos,
|
||||||
const uniChar_t unicodeChar,
|
const uniChar_t unicodeChar,
|
||||||
int32_t & fontTextureId,
|
int32_t & fontTextureId,
|
||||||
etk::VectorType<Vector2D<float> > & coord,
|
std::vector<Vector2D<float> > & coord,
|
||||||
etk::VectorType<texCoord_ts> & coordTex);
|
std::vector<texCoord_ts> & coordTex);
|
||||||
int32_t LoadFont(etk::File fontFileName);
|
int32_t LoadFont(etk::File fontFileName);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -25,7 +25,7 @@
|
|||||||
#include <ewol/Font.h>
|
#include <ewol/Font.h>
|
||||||
#include <ewol/Texture.h>
|
#include <ewol/Texture.h>
|
||||||
#include <etk/unicode.h>
|
#include <etk/unicode.h>
|
||||||
#include <etk/VectorType.h>
|
#include <vector>
|
||||||
|
|
||||||
#include <ewol/importgl.h>
|
#include <ewol/importgl.h>
|
||||||
extern "C" {
|
extern "C" {
|
||||||
@ -220,7 +220,7 @@ class FTFontInternal
|
|||||||
}
|
}
|
||||||
public:
|
public:
|
||||||
etk::UString GetFontName(void) {return m_fontName;};
|
etk::UString GetFontName(void) {return m_fontName;};
|
||||||
bool GenerateBitmapFont(int32_t size, int32_t &height, int32_t & textureId, etk::VectorType<freeTypeFontElement_ts> & listElement)
|
bool GenerateBitmapFont(int32_t size, int32_t &height, int32_t & textureId, std::vector<freeTypeFontElement_ts> & listElement)
|
||||||
{
|
{
|
||||||
// 300dpi (hight quality) 96 dpi (normal quality)
|
// 300dpi (hight quality) 96 dpi (normal quality)
|
||||||
int32_t fontQuality = 96;
|
int32_t fontQuality = 96;
|
||||||
@ -253,7 +253,7 @@ class FTFontInternal
|
|||||||
EWOL_DEBUG("metrics.horiAdvance=" << (slot->metrics.horiAdvance >> 6));
|
EWOL_DEBUG("metrics.horiAdvance=" << (slot->metrics.horiAdvance >> 6));
|
||||||
EWOL_DEBUG("metrics.vertAdvance=" << (slot->metrics.vertAdvance >> 6));
|
EWOL_DEBUG("metrics.vertAdvance=" << (slot->metrics.vertAdvance >> 6));
|
||||||
|
|
||||||
int32_t nbElement = listElement.Size();
|
int32_t nbElement = listElement.size();
|
||||||
int32_t coter = simpleSQRT(nbElement);
|
int32_t coter = simpleSQRT(nbElement);
|
||||||
// note : +1 is for the overlapping of the glyph (Part 1)
|
// note : +1 is for the overlapping of the glyph (Part 1)
|
||||||
int32_t glyphMaxWidth = /*(m_fftFace->max_advance_width>>6); */(slot->metrics.horiAdvance>>6) +1;
|
int32_t glyphMaxWidth = /*(m_fftFace->max_advance_width>>6); */(slot->metrics.horiAdvance>>6) +1;
|
||||||
@ -285,7 +285,7 @@ class FTFontInternal
|
|||||||
int32_t tmpLineStartPos = 0;
|
int32_t tmpLineStartPos = 0;
|
||||||
int32_t CurrentLineHigh = 0;
|
int32_t CurrentLineHigh = 0;
|
||||||
// Generate for All Elements :
|
// Generate for All Elements :
|
||||||
for (int32_t iii=0; iii<listElement.Size(); iii++) {
|
for (int32_t iii=0; iii<listElement.size(); iii++) {
|
||||||
// increment the position of the texture
|
// increment the position of the texture
|
||||||
/*
|
/*
|
||||||
if (iii!=0) {
|
if (iii!=0) {
|
||||||
@ -378,7 +378,7 @@ class FTFontInternal
|
|||||||
FT_Face m_fftFace;
|
FT_Face m_fftFace;
|
||||||
};
|
};
|
||||||
|
|
||||||
static etk::VectorType<FTFontInternal*> m_listLoadedTTFont;
|
static std::vector<FTFontInternal*> m_listLoadedTTFont;
|
||||||
|
|
||||||
|
|
||||||
static etk::UString s_currentFolderName = "";
|
static etk::UString s_currentFolderName = "";
|
||||||
@ -390,7 +390,7 @@ class FTFont{
|
|||||||
FTFont(etk::File fontfileName, etk::UString fontName, int32_t size)
|
FTFont(etk::File fontfileName, etk::UString fontName, int32_t size)
|
||||||
{
|
{
|
||||||
m_trueTypeFontId = -1;
|
m_trueTypeFontId = -1;
|
||||||
for (int32_t iii=0; iii < m_listLoadedTTFont.Size(); iii++) {
|
for (int32_t iii=0; iii < m_listLoadedTTFont.size(); iii++) {
|
||||||
if (m_listLoadedTTFont[iii]->GetFontName() == fontName) {
|
if (m_listLoadedTTFont[iii]->GetFontName() == fontName) {
|
||||||
m_trueTypeFontId = iii;
|
m_trueTypeFontId = iii;
|
||||||
}
|
}
|
||||||
@ -398,19 +398,19 @@ class FTFont{
|
|||||||
if (-1==m_trueTypeFontId) {
|
if (-1==m_trueTypeFontId) {
|
||||||
// load a new one ...
|
// load a new one ...
|
||||||
FTFontInternal * tmpElement = new FTFontInternal(fontfileName, fontName);
|
FTFontInternal * tmpElement = new FTFontInternal(fontfileName, fontName);
|
||||||
m_listLoadedTTFont.PushBack(tmpElement);
|
m_listLoadedTTFont.push_back(tmpElement);
|
||||||
m_trueTypeFontId = m_listLoadedTTFont.Size() -1;
|
m_trueTypeFontId = m_listLoadedTTFont.size() -1;
|
||||||
}
|
}
|
||||||
// set the bassic charset:
|
// set the bassic charset:
|
||||||
m_elements.Clear();
|
m_elements.clear();
|
||||||
freeTypeFontElement_ts tmpchar1;
|
freeTypeFontElement_ts tmpchar1;
|
||||||
tmpchar1.unicodeCharVal = 0;
|
tmpchar1.unicodeCharVal = 0;
|
||||||
m_elements.PushBack(tmpchar1);
|
m_elements.push_back(tmpchar1);
|
||||||
// TODO : dynamic generation of this : expected minimum of 0x20 => 0x7F ....
|
// TODO : dynamic generation of this : expected minimum of 0x20 => 0x7F ....
|
||||||
for (int32_t iii=0x20; iii<0xFF; iii++) {
|
for (int32_t iii=0x20; iii<0xFF; iii++) {
|
||||||
freeTypeFontElement_ts tmpchar;
|
freeTypeFontElement_ts tmpchar;
|
||||||
tmpchar.unicodeCharVal = iii;
|
tmpchar.unicodeCharVal = iii;
|
||||||
m_elements.PushBack(tmpchar);
|
m_elements.push_back(tmpchar);
|
||||||
if (0x7F == iii) {
|
if (0x7F == iii) {
|
||||||
iii = 0x9F;
|
iii = 0x9F;
|
||||||
}
|
}
|
||||||
@ -436,7 +436,7 @@ class FTFont{
|
|||||||
return false;
|
return false;
|
||||||
};
|
};
|
||||||
|
|
||||||
etk::VectorType<freeTypeFontElement_ts> & GetRefOnElement(void)
|
std::vector<freeTypeFontElement_ts> & GetRefOnElement(void)
|
||||||
{
|
{
|
||||||
return m_elements;
|
return m_elements;
|
||||||
};
|
};
|
||||||
@ -462,10 +462,10 @@ class FTFont{
|
|||||||
int32_t m_size; // nb pixel height
|
int32_t m_size; // nb pixel height
|
||||||
int32_t m_lineHeight; // nb pixel height
|
int32_t m_lineHeight; // nb pixel height
|
||||||
int32_t m_interline; // nb pixel between 2 lines
|
int32_t m_interline; // nb pixel between 2 lines
|
||||||
etk::VectorType<freeTypeFontElement_ts> m_elements; //
|
std::vector<freeTypeFontElement_ts> m_elements; //
|
||||||
};
|
};
|
||||||
|
|
||||||
static etk::VectorType<FTFont*> m_listLoadedFont;
|
static std::vector<FTFont*> m_listLoadedFont;
|
||||||
|
|
||||||
#undef __class__
|
#undef __class__
|
||||||
#define __class__ "ewol::FontFreeType"
|
#define __class__ "ewol::FontFreeType"
|
||||||
@ -490,7 +490,7 @@ void ewol::InitFont(void)
|
|||||||
// prevent android error ==> can create memory leak but I prefer
|
// prevent android error ==> can create memory leak but I prefer
|
||||||
s_currentFolderName = "";
|
s_currentFolderName = "";
|
||||||
s_currentDefaultFontName = "";
|
s_currentDefaultFontName = "";
|
||||||
m_listLoadedTTFont.Clear();
|
m_listLoadedTTFont.clear();
|
||||||
s_currentDefaultFontId = -1;
|
s_currentDefaultFontId = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -508,21 +508,21 @@ void ewol::UnInitFont(void)
|
|||||||
s_currentDefaultFontId = -1;
|
s_currentDefaultFontId = -1;
|
||||||
|
|
||||||
// unload global font
|
// unload global font
|
||||||
for(int32_t iii=0; iii<m_listLoadedFont.Size(); iii++) {
|
for(int32_t iii=0; iii<m_listLoadedFont.size(); iii++) {
|
||||||
if (NULL != m_listLoadedFont[iii]) {
|
if (NULL != m_listLoadedFont[iii]) {
|
||||||
delete(m_listLoadedFont[iii]);
|
delete(m_listLoadedFont[iii]);
|
||||||
}
|
}
|
||||||
m_listLoadedFont[iii] = NULL;
|
m_listLoadedFont[iii] = NULL;
|
||||||
}
|
}
|
||||||
m_listLoadedFont.Clear();
|
m_listLoadedFont.clear();
|
||||||
// unload TFT font ...
|
// unload TFT font ...
|
||||||
for(int32_t iii=0; iii<m_listLoadedTTFont.Size(); iii++) {
|
for(int32_t iii=0; iii<m_listLoadedTTFont.size(); iii++) {
|
||||||
if (NULL != m_listLoadedTTFont[iii]) {
|
if (NULL != m_listLoadedTTFont[iii]) {
|
||||||
delete(m_listLoadedTTFont[iii]);
|
delete(m_listLoadedTTFont[iii]);
|
||||||
}
|
}
|
||||||
m_listLoadedTTFont[iii] = NULL;
|
m_listLoadedTTFont[iii] = NULL;
|
||||||
}
|
}
|
||||||
m_listLoadedTTFont.Clear();
|
m_listLoadedTTFont.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ewol::SetDefaultFont(etk::UString fontName, int32_t size)
|
void ewol::SetDefaultFont(etk::UString fontName, int32_t size)
|
||||||
@ -559,14 +559,14 @@ int32_t ewol::LoadFont(etk::UString fontName, int32_t size)
|
|||||||
EWOL_ERROR("Font does not exist: \"" << fileName.GetCompleateName() << "\"");
|
EWOL_ERROR("Font does not exist: \"" << fileName.GetCompleateName() << "\"");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
for (int32_t iii=0; iii < m_listLoadedFont.Size(); iii++) {
|
for (int32_t iii=0; iii < m_listLoadedFont.size(); iii++) {
|
||||||
if (true == m_listLoadedFont[iii]->Check(fontName, size)) {
|
if (true == m_listLoadedFont[iii]->Check(fontName, size)) {
|
||||||
return iii;
|
return iii;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
FTFont * tmpFont = new FTFont(fileName, fontName, size);
|
FTFont * tmpFont = new FTFont(fileName, fontName, size);
|
||||||
m_listLoadedFont.PushBack(tmpFont);
|
m_listLoadedFont.push_back(tmpFont);
|
||||||
return m_listLoadedFont.Size()-1;
|
return m_listLoadedFont.size()-1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ewol::UnloadFont(int32_t id)
|
void ewol::UnloadFont(int32_t id)
|
||||||
@ -579,14 +579,14 @@ int32_t ewol::DrawText(int32_t fontID,
|
|||||||
clipping_ts & drawClipping,
|
clipping_ts & drawClipping,
|
||||||
const etk::UString& unicodeString,
|
const etk::UString& unicodeString,
|
||||||
int32_t & fontTextureId,
|
int32_t & fontTextureId,
|
||||||
etk::VectorType<Vector2D<float> > & coord,
|
std::vector<Vector2D<float> > & coord,
|
||||||
etk::VectorType<texCoord_ts> & coordTex)
|
std::vector<texCoord_ts> & coordTex)
|
||||||
{
|
{
|
||||||
if(fontID>=m_listLoadedFont.Size() || fontID < 0) {
|
if(fontID>=m_listLoadedFont.size() || fontID < 0) {
|
||||||
EWOL_WARNING("try to display text with an fontID that does not existed " << fontID);
|
EWOL_WARNING("try to display text with an fontID that does not existed " << fontID);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
etk::VectorType<freeTypeFontElement_ts> & listOfElement = m_listLoadedFont[fontID]->GetRefOnElement();
|
std::vector<freeTypeFontElement_ts> & listOfElement = m_listLoadedFont[fontID]->GetRefOnElement();
|
||||||
|
|
||||||
fontTextureId = m_listLoadedFont[fontID]->GetOglId();
|
fontTextureId = m_listLoadedFont[fontID]->GetOglId();
|
||||||
int32_t fontSize = m_listLoadedFont[fontID]->GetSize();
|
int32_t fontSize = m_listLoadedFont[fontID]->GetSize();
|
||||||
@ -603,7 +603,7 @@ int32_t ewol::DrawText(int32_t fontID,
|
|||||||
charIndex = tmpChar - 0x1F;
|
charIndex = tmpChar - 0x1F;
|
||||||
} else {
|
} else {
|
||||||
charIndex = 0;
|
charIndex = 0;
|
||||||
for (int32_t iii=0x80-0x20; iii < listOfElement.Size(); iii++) {
|
for (int32_t iii=0x80-0x20; iii < listOfElement.size(); iii++) {
|
||||||
if (listOfElement[iii].unicodeCharVal == tmpChar) {
|
if (listOfElement[iii].unicodeCharVal == tmpChar) {
|
||||||
charIndex = iii;
|
charIndex = iii;
|
||||||
break;
|
break;
|
||||||
@ -724,13 +724,13 @@ int32_t ewol::DrawText(int32_t fontID,
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
// set texture coordonates :
|
// set texture coordonates :
|
||||||
coordTex.PushBack(texturePos[0]);
|
coordTex.push_back(texturePos[0]);
|
||||||
coordTex.PushBack(texturePos[1]);
|
coordTex.push_back(texturePos[1]);
|
||||||
coordTex.PushBack(texturePos[2]);
|
coordTex.push_back(texturePos[2]);
|
||||||
// set display positions :
|
// set display positions :
|
||||||
coord.PushBack(bitmapDrawPos[0]);
|
coord.push_back(bitmapDrawPos[0]);
|
||||||
coord.PushBack(bitmapDrawPos[1]);
|
coord.push_back(bitmapDrawPos[1]);
|
||||||
coord.PushBack(bitmapDrawPos[2]);
|
coord.push_back(bitmapDrawPos[2]);
|
||||||
|
|
||||||
/* Step 2 :
|
/* Step 2 :
|
||||||
*
|
*
|
||||||
@ -740,13 +740,13 @@ int32_t ewol::DrawText(int32_t fontID,
|
|||||||
* ********
|
* ********
|
||||||
*/
|
*/
|
||||||
// set texture coordonates :
|
// set texture coordonates :
|
||||||
coordTex.PushBack(texturePos[0]);
|
coordTex.push_back(texturePos[0]);
|
||||||
coordTex.PushBack(texturePos[2]);
|
coordTex.push_back(texturePos[2]);
|
||||||
coordTex.PushBack(texturePos[3]);
|
coordTex.push_back(texturePos[3]);
|
||||||
// set display positions :
|
// set display positions :
|
||||||
coord.PushBack(bitmapDrawPos[0]);
|
coord.push_back(bitmapDrawPos[0]);
|
||||||
coord.PushBack(bitmapDrawPos[2]);
|
coord.push_back(bitmapDrawPos[2]);
|
||||||
coord.PushBack(bitmapDrawPos[3]);
|
coord.push_back(bitmapDrawPos[3]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -763,15 +763,15 @@ int32_t ewol::DrawText(int32_t fontID,
|
|||||||
clipping_ts & drawClipping,
|
clipping_ts & drawClipping,
|
||||||
const uniChar_t unicodeChar,
|
const uniChar_t unicodeChar,
|
||||||
int32_t & fontTextureId,
|
int32_t & fontTextureId,
|
||||||
etk::VectorType<Vector2D<float> > & coord,
|
std::vector<Vector2D<float> > & coord,
|
||||||
etk::VectorType<texCoord_ts> & coordTex)
|
std::vector<texCoord_ts> & coordTex)
|
||||||
{
|
{
|
||||||
#if 0
|
#if 0
|
||||||
if(fontID>=m_listLoadedFont.Size() || fontID < 0) {
|
if(fontID>=m_listLoadedFont.Size() || fontID < 0) {
|
||||||
EWOL_WARNING("try to display text with an fontID that does not existed " << fontID);
|
EWOL_WARNING("try to display text with an fontID that does not existed " << fontID);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
etk::VectorType<freeTypeFontElement_ts> & listOfElement = m_listLoadedFont[fontID]->GetRefOnElement();
|
std::vector<freeTypeFontElement_ts> & listOfElement = m_listLoadedFont[fontID]->GetRefOnElement();
|
||||||
|
|
||||||
fontTextureId = m_listLoadedFont[fontID]->GetOglId();
|
fontTextureId = m_listLoadedFont[fontID]->GetOglId();
|
||||||
int32_t fontSize = m_listLoadedFont[fontID]->GetSize();
|
int32_t fontSize = m_listLoadedFont[fontID]->GetSize();
|
||||||
@ -920,14 +920,14 @@ int32_t ewol::DrawText(int32_t fontID,
|
|||||||
Vector2D<float> textPos,
|
Vector2D<float> textPos,
|
||||||
const etk::UString& unicodeString,
|
const etk::UString& unicodeString,
|
||||||
int32_t & fontTextureId,
|
int32_t & fontTextureId,
|
||||||
etk::VectorType<Vector2D<float> > & coord,
|
std::vector<Vector2D<float> > & coord,
|
||||||
etk::VectorType<texCoord_ts> & coordTex)
|
std::vector<texCoord_ts> & coordTex)
|
||||||
{
|
{
|
||||||
if(fontID>=m_listLoadedFont.Size() || fontID < 0) {
|
if(fontID>=m_listLoadedFont.size() || fontID < 0) {
|
||||||
EWOL_WARNING("try to display text with an fontID that does not existed " << fontID);
|
EWOL_WARNING("try to display text with an fontID that does not existed " << fontID);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
etk::VectorType<freeTypeFontElement_ts> & listOfElement = m_listLoadedFont[fontID]->GetRefOnElement();
|
std::vector<freeTypeFontElement_ts> & listOfElement = m_listLoadedFont[fontID]->GetRefOnElement();
|
||||||
|
|
||||||
fontTextureId = m_listLoadedFont[fontID]->GetOglId();
|
fontTextureId = m_listLoadedFont[fontID]->GetOglId();
|
||||||
int32_t fontSize = m_listLoadedFont[fontID]->GetSize();
|
int32_t fontSize = m_listLoadedFont[fontID]->GetSize();
|
||||||
@ -944,7 +944,7 @@ int32_t ewol::DrawText(int32_t fontID,
|
|||||||
charIndex = tmpChar - 0x1F;
|
charIndex = tmpChar - 0x1F;
|
||||||
} else {
|
} else {
|
||||||
charIndex = 0;
|
charIndex = 0;
|
||||||
for (int32_t iii=0x80-0x20; iii < listOfElement.Size(); iii++) {
|
for (int32_t iii=0x80-0x20; iii < listOfElement.size(); iii++) {
|
||||||
if (listOfElement[iii].unicodeCharVal == tmpChar) {
|
if (listOfElement[iii].unicodeCharVal == tmpChar) {
|
||||||
charIndex = iii;
|
charIndex = iii;
|
||||||
break;
|
break;
|
||||||
@ -1018,13 +1018,13 @@ int32_t ewol::DrawText(int32_t fontID,
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
// set texture coordonates :
|
// set texture coordonates :
|
||||||
coordTex.PushBack(texturePos[0]);
|
coordTex.push_back(texturePos[0]);
|
||||||
coordTex.PushBack(texturePos[1]);
|
coordTex.push_back(texturePos[1]);
|
||||||
coordTex.PushBack(texturePos[2]);
|
coordTex.push_back(texturePos[2]);
|
||||||
// set display positions :
|
// set display positions :
|
||||||
coord.PushBack(bitmapDrawPos[0]);
|
coord.push_back(bitmapDrawPos[0]);
|
||||||
coord.PushBack(bitmapDrawPos[1]);
|
coord.push_back(bitmapDrawPos[1]);
|
||||||
coord.PushBack(bitmapDrawPos[2]);
|
coord.push_back(bitmapDrawPos[2]);
|
||||||
|
|
||||||
/* Step 2 :
|
/* Step 2 :
|
||||||
*
|
*
|
||||||
@ -1034,13 +1034,13 @@ int32_t ewol::DrawText(int32_t fontID,
|
|||||||
* ********
|
* ********
|
||||||
*/
|
*/
|
||||||
// set texture coordonates :
|
// set texture coordonates :
|
||||||
coordTex.PushBack(texturePos[0]);
|
coordTex.push_back(texturePos[0]);
|
||||||
coordTex.PushBack(texturePos[2]);
|
coordTex.push_back(texturePos[2]);
|
||||||
coordTex.PushBack(texturePos[3]);
|
coordTex.push_back(texturePos[3]);
|
||||||
// set display positions :
|
// set display positions :
|
||||||
coord.PushBack(bitmapDrawPos[0]);
|
coord.push_back(bitmapDrawPos[0]);
|
||||||
coord.PushBack(bitmapDrawPos[2]);
|
coord.push_back(bitmapDrawPos[2]);
|
||||||
coord.PushBack(bitmapDrawPos[3]);
|
coord.push_back(bitmapDrawPos[3]);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1056,14 +1056,14 @@ int32_t ewol::DrawText(int32_t fontID,
|
|||||||
Vector2D<float> textPos,
|
Vector2D<float> textPos,
|
||||||
const uniChar_t unicodeChar,
|
const uniChar_t unicodeChar,
|
||||||
int32_t & fontTextureId,
|
int32_t & fontTextureId,
|
||||||
etk::VectorType<Vector2D<float> > & coord,
|
std::vector<Vector2D<float> > & coord,
|
||||||
etk::VectorType<texCoord_ts> & coordTex)
|
std::vector<texCoord_ts> & coordTex)
|
||||||
{
|
{
|
||||||
if(fontID>=m_listLoadedFont.Size() || fontID < 0) {
|
if(fontID>=m_listLoadedFont.size() || fontID < 0) {
|
||||||
EWOL_WARNING("try to display text with an fontID that does not existed " << fontID);
|
EWOL_WARNING("try to display text with an fontID that does not existed " << fontID);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
etk::VectorType<freeTypeFontElement_ts> & listOfElement = m_listLoadedFont[fontID]->GetRefOnElement();
|
std::vector<freeTypeFontElement_ts> & listOfElement = m_listLoadedFont[fontID]->GetRefOnElement();
|
||||||
|
|
||||||
fontTextureId = m_listLoadedFont[fontID]->GetOglId();
|
fontTextureId = m_listLoadedFont[fontID]->GetOglId();
|
||||||
int32_t fontSize = m_listLoadedFont[fontID]->GetSize();
|
int32_t fontSize = m_listLoadedFont[fontID]->GetSize();
|
||||||
@ -1077,7 +1077,7 @@ int32_t ewol::DrawText(int32_t fontID,
|
|||||||
charIndex = unicodeChar - 0x1F;
|
charIndex = unicodeChar - 0x1F;
|
||||||
} else {
|
} else {
|
||||||
charIndex = 0;
|
charIndex = 0;
|
||||||
for (int32_t iii=0x80-0x20; iii < listOfElement.Size(); iii++) {
|
for (int32_t iii=0x80-0x20; iii < listOfElement.size(); iii++) {
|
||||||
if (listOfElement[iii].unicodeCharVal == unicodeChar) {
|
if (listOfElement[iii].unicodeCharVal == unicodeChar) {
|
||||||
charIndex = iii;
|
charIndex = iii;
|
||||||
break;
|
break;
|
||||||
@ -1149,13 +1149,13 @@ int32_t ewol::DrawText(int32_t fontID,
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
// set texture coordonates :
|
// set texture coordonates :
|
||||||
coordTex.PushBack(texturePos[0]);
|
coordTex.push_back(texturePos[0]);
|
||||||
coordTex.PushBack(texturePos[1]);
|
coordTex.push_back(texturePos[1]);
|
||||||
coordTex.PushBack(texturePos[2]);
|
coordTex.push_back(texturePos[2]);
|
||||||
// set display positions :
|
// set display positions :
|
||||||
coord.PushBack(bitmapDrawPos[0]);
|
coord.push_back(bitmapDrawPos[0]);
|
||||||
coord.PushBack(bitmapDrawPos[1]);
|
coord.push_back(bitmapDrawPos[1]);
|
||||||
coord.PushBack(bitmapDrawPos[2]);
|
coord.push_back(bitmapDrawPos[2]);
|
||||||
|
|
||||||
/* Step 2 :
|
/* Step 2 :
|
||||||
*
|
*
|
||||||
@ -1165,13 +1165,13 @@ int32_t ewol::DrawText(int32_t fontID,
|
|||||||
* ********
|
* ********
|
||||||
*/
|
*/
|
||||||
// set texture coordonates :
|
// set texture coordonates :
|
||||||
coordTex.PushBack(texturePos[0]);
|
coordTex.push_back(texturePos[0]);
|
||||||
coordTex.PushBack(texturePos[2]);
|
coordTex.push_back(texturePos[2]);
|
||||||
coordTex.PushBack(texturePos[3]);
|
coordTex.push_back(texturePos[3]);
|
||||||
// set display positions :
|
// set display positions :
|
||||||
coord.PushBack(bitmapDrawPos[0]);
|
coord.push_back(bitmapDrawPos[0]);
|
||||||
coord.PushBack(bitmapDrawPos[2]);
|
coord.push_back(bitmapDrawPos[2]);
|
||||||
coord.PushBack(bitmapDrawPos[3]);
|
coord.push_back(bitmapDrawPos[3]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
posDrawX += listOfElement[charIndex].advance;
|
posDrawX += listOfElement[charIndex].advance;
|
||||||
@ -1183,11 +1183,11 @@ int32_t ewol::DrawText(int32_t fontID,
|
|||||||
|
|
||||||
int32_t ewol::GetWidth(int32_t fontID, const etk::UString& unicodeString)
|
int32_t ewol::GetWidth(int32_t fontID, const etk::UString& unicodeString)
|
||||||
{
|
{
|
||||||
if(fontID>=m_listLoadedFont.Size() || fontID < 0) {
|
if(fontID>=m_listLoadedFont.size() || fontID < 0) {
|
||||||
EWOL_WARNING("try to display text with an fontID that does not existed " << fontID);
|
EWOL_WARNING("try to display text with an fontID that does not existed " << fontID);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
etk::VectorType<freeTypeFontElement_ts> & listOfElement = m_listLoadedFont[fontID]->GetRefOnElement();
|
std::vector<freeTypeFontElement_ts> & listOfElement = m_listLoadedFont[fontID]->GetRefOnElement();
|
||||||
|
|
||||||
float posDrawX = 0.0;
|
float posDrawX = 0.0;
|
||||||
for(int32_t iii=0; iii<unicodeString.Size(); iii++) {
|
for(int32_t iii=0; iii<unicodeString.Size(); iii++) {
|
||||||
@ -1200,7 +1200,7 @@ int32_t ewol::GetWidth(int32_t fontID, const etk::UString& unicodeString)
|
|||||||
} else if (tmpChar < 0x80) {
|
} else if (tmpChar < 0x80) {
|
||||||
charIndex = tmpChar - 0x1F;
|
charIndex = tmpChar - 0x1F;
|
||||||
} else {
|
} else {
|
||||||
for (int32_t iii=0x80-0x20; iii < listOfElement.Size(); iii++) {
|
for (int32_t iii=0x80-0x20; iii < listOfElement.size(); iii++) {
|
||||||
if (listOfElement[iii].unicodeCharVal == tmpChar) {
|
if (listOfElement[iii].unicodeCharVal == tmpChar) {
|
||||||
charIndex = iii;
|
charIndex = iii;
|
||||||
break;
|
break;
|
||||||
@ -1217,7 +1217,7 @@ int32_t ewol::GetWidth(int32_t fontID, const etk::UString& unicodeString)
|
|||||||
|
|
||||||
int32_t ewol::GetHeight(int32_t fontID)
|
int32_t ewol::GetHeight(int32_t fontID)
|
||||||
{
|
{
|
||||||
if(fontID>=m_listLoadedFont.Size() || fontID < 0) {
|
if(fontID>=m_listLoadedFont.size() || fontID < 0) {
|
||||||
EWOL_WARNING("try to display text with an fontID that does not existed " << fontID);
|
EWOL_WARNING("try to display text with an fontID that does not existed " << fontID);
|
||||||
return 10;
|
return 10;
|
||||||
}
|
}
|
||||||
|
@ -34,7 +34,7 @@
|
|||||||
//For every acces :
|
//For every acces :
|
||||||
|
|
||||||
static ewol::GameElementLua * tmpObj = NULL;
|
static ewol::GameElementLua * tmpObj = NULL;
|
||||||
static etk::VectorType<ewol::Sprite*> * tmpSprite = NULL;
|
static std::vector<ewol::Sprite*> * tmpSprite = NULL;
|
||||||
static ewol::SceneElement * tmpScene = NULL;
|
static ewol::SceneElement * tmpScene = NULL;
|
||||||
|
|
||||||
template <typename T> int index(lua_State* L);
|
template <typename T> int index(lua_State* L);
|
||||||
@ -399,7 +399,7 @@ LUAMOD_API int lua_ElementAdd(lua_State *L)
|
|||||||
int32_t group = luaL_checkint(L, 2);
|
int32_t group = luaL_checkint(L, 2);
|
||||||
// TODO : Remove this when find an other way do do it ...
|
// TODO : Remove this when find an other way do do it ...
|
||||||
ewol::GameElementLua * ttmpObj = tmpObj;
|
ewol::GameElementLua * ttmpObj = tmpObj;
|
||||||
etk::VectorType<ewol::Sprite*> * ttmpSprite = tmpSprite;
|
std::vector<ewol::Sprite*> * ttmpSprite = tmpSprite;
|
||||||
ewol::SceneElement * ttmpScene = tmpScene;
|
ewol::SceneElement * ttmpScene = tmpScene;
|
||||||
uint32_t elementId = tmpScene->AddElementNamed(group, elementName);
|
uint32_t elementId = tmpScene->AddElementNamed(group, elementName);
|
||||||
tmpObj = ttmpObj;
|
tmpObj = ttmpObj;
|
||||||
@ -542,7 +542,7 @@ LUAMOD_API int lua_HaveImpact(lua_State *L)
|
|||||||
|
|
||||||
// TODO : Remove this when find an other way do do it ...
|
// TODO : Remove this when find an other way do do it ...
|
||||||
ewol::GameElementLua * ttmpObj = tmpObj;
|
ewol::GameElementLua * ttmpObj = tmpObj;
|
||||||
etk::VectorType<ewol::Sprite*> * ttmpSprite = tmpSprite;
|
std::vector<ewol::Sprite*> * ttmpSprite = tmpSprite;
|
||||||
ewol::SceneElement * ttmpScene = tmpScene;
|
ewol::SceneElement * ttmpScene = tmpScene;
|
||||||
|
|
||||||
bool result = tmpScene->HaveImpact(tmpObj->GroupGet(), tmpObj->TypeGet(), tmpObj->PositionGet(), tmpObj->SizeGet());
|
bool result = tmpScene->HaveImpact(tmpObj->GroupGet(), tmpObj->TypeGet(), tmpObj->PositionGet(), tmpObj->SizeGet());
|
||||||
@ -566,7 +566,7 @@ LUAMOD_API int lua_Explosion(lua_State *L)
|
|||||||
|
|
||||||
// TODO : Remove this when find an other way do do it ...
|
// TODO : Remove this when find an other way do do it ...
|
||||||
ewol::GameElementLua * ttmpObj = tmpObj;
|
ewol::GameElementLua * ttmpObj = tmpObj;
|
||||||
etk::VectorType<ewol::Sprite*> * ttmpSprite = tmpSprite;
|
std::vector<ewol::Sprite*> * ttmpSprite = tmpSprite;
|
||||||
ewol::SceneElement * ttmpScene = tmpScene;
|
ewol::SceneElement * ttmpScene = tmpScene;
|
||||||
|
|
||||||
tmpScene->Explosion(tmpObj->GroupGet(), tmpObj->TypeGet(), tmpObj->PositionGet(), 0.01, tmpObj->PowerGet());
|
tmpScene->Explosion(tmpObj->GroupGet(), tmpObj->TypeGet(), tmpObj->PositionGet(), 0.01, tmpObj->PowerGet());
|
||||||
|
@ -57,37 +57,37 @@ ewol::SceneElement::~SceneElement(void)
|
|||||||
{
|
{
|
||||||
EWOL_DEBUG("Remove sceane, allocated element : " << allocatedElements << " and retreive : " << retreviveElement);
|
EWOL_DEBUG("Remove sceane, allocated element : " << allocatedElements << " and retreive : " << retreviveElement);
|
||||||
// clean all element allocated :
|
// clean all element allocated :
|
||||||
for (int32_t jjj=0; jjj<listGarbage.Size(); jjj++) {
|
for (int32_t jjj=0; jjj<listGarbage.size(); jjj++) {
|
||||||
if (NULL != listGarbage[jjj]) {
|
if (NULL != listGarbage[jjj]) {
|
||||||
delete(listGarbage[jjj]);
|
delete(listGarbage[jjj]);
|
||||||
listGarbage[jjj] = NULL;
|
listGarbage[jjj] = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
listGarbage.Clear();
|
listGarbage.clear();
|
||||||
for (int32_t jjj=0; jjj<listCreatorElement.Size(); jjj++) {
|
for (int32_t jjj=0; jjj<listCreatorElement.size(); jjj++) {
|
||||||
if (NULL != listCreatorElement[jjj]) {
|
if (NULL != listCreatorElement[jjj]) {
|
||||||
delete(listCreatorElement[jjj]);
|
delete(listCreatorElement[jjj]);
|
||||||
listCreatorElement[jjj] = NULL;
|
listCreatorElement[jjj] = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
listCreatorElement.Clear();
|
listCreatorElement.clear();
|
||||||
for (int32_t iii=0; iii<MAX_GROUP_NUMBER; iii++) {
|
for (int32_t iii=0; iii<MAX_GROUP_NUMBER; iii++) {
|
||||||
for (int32_t jjj=0; jjj<listAnimatedElements[iii].Size(); jjj++) {
|
for (int32_t jjj=0; jjj<listAnimatedElements[iii].size(); jjj++) {
|
||||||
if (NULL != listAnimatedElements[iii][jjj]) {
|
if (NULL != listAnimatedElements[iii][jjj]) {
|
||||||
delete(listAnimatedElements[iii][jjj]);
|
delete(listAnimatedElements[iii][jjj]);
|
||||||
listAnimatedElements[iii][jjj] = NULL;
|
listAnimatedElements[iii][jjj] = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
listAnimatedElements[iii].Clear();
|
listAnimatedElements[iii].clear();
|
||||||
}
|
}
|
||||||
for (int32_t iii=0; iii<NB_BOUBLE_BUFFER; iii++) {
|
for (int32_t iii=0; iii<NB_BOUBLE_BUFFER; iii++) {
|
||||||
for (int32_t jjj=0; jjj<animated[iii].Size(); jjj++) {
|
for (int32_t jjj=0; jjj<animated[iii].size(); jjj++) {
|
||||||
if (NULL != animated[iii][jjj]) {
|
if (NULL != animated[iii][jjj]) {
|
||||||
delete(animated[iii][jjj]);
|
delete(animated[iii][jjj]);
|
||||||
animated[iii][jjj] = NULL;
|
animated[iii][jjj] = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
animated[iii].Clear();
|
animated[iii].clear();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -102,7 +102,7 @@ void ewol::SceneElement::RegisterElementType(etk::UString name, creatorElement_t
|
|||||||
tmpElement->name = name;
|
tmpElement->name = name;
|
||||||
tmpElement->userString = userString;
|
tmpElement->userString = userString;
|
||||||
tmpElement->loadElement = loadElement;
|
tmpElement->loadElement = loadElement;
|
||||||
listCreatorElement.PushBack(tmpElement);
|
listCreatorElement.push_back(tmpElement);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -112,15 +112,15 @@ void ewol::SceneElement::RmElement(int32_t group, int32_t idElement)
|
|||||||
EWOL_ERROR("group is wrong " << group << "!=[0," << MAX_GROUP_NUMBER << "]==> not rm at the system ...");
|
EWOL_ERROR("group is wrong " << group << "!=[0," << MAX_GROUP_NUMBER << "]==> not rm at the system ...");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (idElement < 0 || idElement >= listAnimatedElements[group].Size()) {
|
if (idElement < 0 || idElement >= listAnimatedElements[group].size()) {
|
||||||
EWOL_ERROR("idElement is wrong " << idElement << "!=[0," << listAnimatedElements[group].Size() << "]==> not rm at the system ...");
|
EWOL_ERROR("idElement is wrong " << idElement << "!=[0," << listAnimatedElements[group].size() << "]==> not rm at the system ...");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (NULL == listAnimatedElements[group][idElement]) {
|
if (NULL == listAnimatedElements[group][idElement]) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// try to find an empty slot :
|
// try to find an empty slot :
|
||||||
for (int32_t iii=0; iii<listGarbage.Size(); iii++) {
|
for (int32_t iii=0; iii<listGarbage.size(); iii++) {
|
||||||
if (NULL == listGarbage[iii]) {
|
if (NULL == listGarbage[iii]) {
|
||||||
// find an empty slot ...
|
// find an empty slot ...
|
||||||
listGarbage[iii] = listAnimatedElements[group][idElement];
|
listGarbage[iii] = listAnimatedElements[group][idElement];
|
||||||
@ -129,7 +129,7 @@ void ewol::SceneElement::RmElement(int32_t group, int32_t idElement)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
listAnimatedElements[group][idElement]->UnInit();
|
listAnimatedElements[group][idElement]->UnInit();
|
||||||
listGarbage.PushBack(listAnimatedElements[group][idElement]);
|
listGarbage.push_back(listAnimatedElements[group][idElement]);
|
||||||
listAnimatedElements[group][idElement] = NULL;
|
listAnimatedElements[group][idElement] = NULL;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -147,7 +147,7 @@ uint32_t ewol::SceneElement::AddElement(int32_t group, ewol::GameElement* newEle
|
|||||||
// for statistic
|
// for statistic
|
||||||
newElement->Init();
|
newElement->Init();
|
||||||
newElement->GroupSet(group);
|
newElement->GroupSet(group);
|
||||||
for (int32_t iii=0; iii<listAnimatedElements[group].Size(); iii++) {
|
for (int32_t iii=0; iii<listAnimatedElements[group].size(); iii++) {
|
||||||
if (NULL == listAnimatedElements[group][iii]) {
|
if (NULL == listAnimatedElements[group][iii]) {
|
||||||
// find an empty slot ...
|
// find an empty slot ...
|
||||||
listAnimatedElements[group][iii] = newElement;
|
listAnimatedElements[group][iii] = newElement;
|
||||||
@ -155,9 +155,9 @@ uint32_t ewol::SceneElement::AddElement(int32_t group, ewol::GameElement* newEle
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
//did not find empty slot :
|
//did not find empty slot :
|
||||||
listAnimatedElements[group].PushBack(newElement);
|
listAnimatedElements[group].push_back(newElement);
|
||||||
if (listAnimatedElements[group].Size()>0) {
|
if (listAnimatedElements[group].size()>0) {
|
||||||
return createUniqueId(newElement->GetUniqueId(), listAnimatedElements[group].Size()-1);
|
return createUniqueId(newElement->GetUniqueId(), listAnimatedElements[group].size()-1);
|
||||||
} else {
|
} else {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -166,7 +166,7 @@ uint32_t ewol::SceneElement::AddElement(int32_t group, ewol::GameElement* newEle
|
|||||||
uint32_t ewol::SceneElement::AddElementNamed(int32_t group, etk::UString &elementName)
|
uint32_t ewol::SceneElement::AddElementNamed(int32_t group, etk::UString &elementName)
|
||||||
{
|
{
|
||||||
// try to fined it in the garbase :
|
// try to fined it in the garbase :
|
||||||
for (int32_t iii=0; iii<listGarbage.Size(); iii++) {
|
for (int32_t iii=0; iii<listGarbage.size(); iii++) {
|
||||||
if (NULL != listGarbage[iii]) {
|
if (NULL != listGarbage[iii]) {
|
||||||
// check his name :
|
// check his name :
|
||||||
if (true == listGarbage[iii]->HasName(elementName)) {
|
if (true == listGarbage[iii]->HasName(elementName)) {
|
||||||
@ -180,7 +180,7 @@ uint32_t ewol::SceneElement::AddElementNamed(int32_t group, etk::UString &elemen
|
|||||||
}
|
}
|
||||||
ewol::GameElement* newElement=NULL;
|
ewol::GameElement* newElement=NULL;
|
||||||
// find in registered element
|
// find in registered element
|
||||||
for (int32_t iii=0; iii<listCreatorElement.Size(); iii++) {
|
for (int32_t iii=0; iii<listCreatorElement.size(); iii++) {
|
||||||
if (NULL != listCreatorElement[iii]) {
|
if (NULL != listCreatorElement[iii]) {
|
||||||
// check his name :
|
// check his name :
|
||||||
if (listCreatorElement[iii]->name == elementName) {
|
if (listCreatorElement[iii]->name == elementName) {
|
||||||
@ -205,7 +205,7 @@ ewol::GameElement* ewol::SceneElement::GetElement(uint32_t idElement)
|
|||||||
uint16_t realUniqueId = (uint16_t)((idElement >> 16 ) & 0x0000FFFF);
|
uint16_t realUniqueId = (uint16_t)((idElement >> 16 ) & 0x0000FFFF);
|
||||||
uint16_t posInList = (uint16_t)(idElement & 0x0000FFFF);
|
uint16_t posInList = (uint16_t)(idElement & 0x0000FFFF);
|
||||||
for (int32_t iii=0; iii<numberOfGroup; iii++) {
|
for (int32_t iii=0; iii<numberOfGroup; iii++) {
|
||||||
if( posInList < listAnimatedElements[iii].Size()
|
if( posInList < listAnimatedElements[iii].size()
|
||||||
&& NULL != listAnimatedElements[iii][posInList]
|
&& NULL != listAnimatedElements[iii][posInList]
|
||||||
&& realUniqueId == listAnimatedElements[iii][posInList]->GetUniqueId()) {
|
&& realUniqueId == listAnimatedElements[iii][posInList]->GetUniqueId()) {
|
||||||
return listAnimatedElements[iii][posInList];
|
return listAnimatedElements[iii][posInList];
|
||||||
@ -229,7 +229,7 @@ uint32_t ewol::SceneElement::GetNearestEnemy(Vector2D<float> position, int32_t g
|
|||||||
if (gId == groupId) {
|
if (gId == groupId) {
|
||||||
EWOL_ERROR("groupId=" << gId << " is ennemy of groupId:" << groupId);
|
EWOL_ERROR("groupId=" << gId << " is ennemy of groupId:" << groupId);
|
||||||
}
|
}
|
||||||
for (int32_t iii=0; iii<listAnimatedElements[gId].Size(); iii++) {
|
for (int32_t iii=0; iii<listAnimatedElements[gId].size(); iii++) {
|
||||||
if (NULL != listAnimatedElements[gId][iii]) {
|
if (NULL != listAnimatedElements[gId][iii]) {
|
||||||
if (true == listAnimatedElements[gId][iii]->CanBeCibledGet()) {
|
if (true == listAnimatedElements[gId][iii]->CanBeCibledGet()) {
|
||||||
Vector2D<float> tmpPos = listAnimatedElements[gId][iii]->PositionGet();
|
Vector2D<float> tmpPos = listAnimatedElements[gId][iii]->PositionGet();
|
||||||
@ -251,7 +251,7 @@ bool ewol::SceneElement::HaveImpact(int32_t group, int32_t type, Vector2D<float>
|
|||||||
{
|
{
|
||||||
for (int32_t jjj=0; jjj<MAX_GROUP_NUMBER; jjj++) {
|
for (int32_t jjj=0; jjj<MAX_GROUP_NUMBER; jjj++) {
|
||||||
if (group != jjj) {
|
if (group != jjj) {
|
||||||
for (int32_t iii=0; iii<listAnimatedElements[jjj].Size(); iii++) {
|
for (int32_t iii=0; iii<listAnimatedElements[jjj].size(); iii++) {
|
||||||
if (NULL != listAnimatedElements[jjj][iii]) {
|
if (NULL != listAnimatedElements[jjj][iii]) {
|
||||||
if (true == listAnimatedElements[jjj][iii]->HaveImpact(group, type, position, size )) {
|
if (true == listAnimatedElements[jjj][iii]->HaveImpact(group, type, position, size )) {
|
||||||
return true;
|
return true;
|
||||||
@ -266,7 +266,7 @@ bool ewol::SceneElement::HaveImpact(int32_t group, int32_t type, Vector2D<float>
|
|||||||
void ewol::SceneElement::Explosion(int32_t group, int32_t type, Vector2D<float> position, float pxAtenuation, float power)
|
void ewol::SceneElement::Explosion(int32_t group, int32_t type, Vector2D<float> position, float pxAtenuation, float power)
|
||||||
{
|
{
|
||||||
for (int32_t jjj=0; jjj<MAX_GROUP_NUMBER; jjj++) {
|
for (int32_t jjj=0; jjj<MAX_GROUP_NUMBER; jjj++) {
|
||||||
for (int32_t iii=0; iii<listAnimatedElements[jjj].Size(); iii++) {
|
for (int32_t iii=0; iii<listAnimatedElements[jjj].size(); iii++) {
|
||||||
if (NULL != listAnimatedElements[jjj][iii]) {
|
if (NULL != listAnimatedElements[jjj][iii]) {
|
||||||
if (true == listAnimatedElements[jjj][iii]->Explosion(group, type, position, pxAtenuation, power) ) {
|
if (true == listAnimatedElements[jjj][iii]->Explosion(group, type, position, pxAtenuation, power) ) {
|
||||||
RmElement(jjj, iii);
|
RmElement(jjj, iii);
|
||||||
@ -282,7 +282,7 @@ uint32_t ewol::SceneElement::GetElementAtPos(Vector2D<float> position, int32_t m
|
|||||||
uint32_t result = 0;
|
uint32_t result = 0;
|
||||||
float lastQuadDistance = 9999999999999999.0;
|
float lastQuadDistance = 9999999999999999.0;
|
||||||
for (int32_t jjj=0; jjj<MAX_GROUP_NUMBER; jjj++) {
|
for (int32_t jjj=0; jjj<MAX_GROUP_NUMBER; jjj++) {
|
||||||
for (int32_t iii=0; iii<listAnimatedElements[jjj].Size(); iii++) {
|
for (int32_t iii=0; iii<listAnimatedElements[jjj].size(); iii++) {
|
||||||
if (NULL != listAnimatedElements[jjj][iii]) {
|
if (NULL != listAnimatedElements[jjj][iii]) {
|
||||||
Vector2D<float> tmpPos = listAnimatedElements[jjj][iii]->PositionGet();
|
Vector2D<float> tmpPos = listAnimatedElements[jjj][iii]->PositionGet();
|
||||||
float distance = quadDist(position, tmpPos);
|
float distance = quadDist(position, tmpPos);
|
||||||
@ -324,7 +324,7 @@ void ewol::SceneElement::SetEventExternJoystick(uint32_t id, int32_t joyId, floa
|
|||||||
*/
|
*/
|
||||||
int32_t ewol::SceneElement::LoadSprite(etk::UString fileName, float maxSize)
|
int32_t ewol::SceneElement::LoadSprite(etk::UString fileName, float maxSize)
|
||||||
{
|
{
|
||||||
for (int32_t iii=0; iii<animated[0].Size(); iii++) {
|
for (int32_t iii=0; iii<animated[0].size(); iii++) {
|
||||||
if (animated[0][iii] != NULL) {
|
if (animated[0][iii] != NULL) {
|
||||||
if (animated[0][iii]->HasName(fileName) == true) {
|
if (animated[0][iii]->HasName(fileName) == true) {
|
||||||
// count the number of element registered ...
|
// count the number of element registered ...
|
||||||
@ -341,9 +341,9 @@ int32_t ewol::SceneElement::LoadSprite(etk::UString fileName, float maxSize)
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
// add it :
|
// add it :
|
||||||
animated[iii].PushBack(tmpSprite);
|
animated[iii].push_back(tmpSprite);
|
||||||
}
|
}
|
||||||
return animated[0].Size() -1;
|
return animated[0].size() -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -354,7 +354,7 @@ int32_t ewol::SceneElement::LoadSprite(etk::UString fileName, float maxSize)
|
|||||||
*/
|
*/
|
||||||
void ewol::SceneElement::UnLoadSprite(int32_t spriteId)
|
void ewol::SceneElement::UnLoadSprite(int32_t spriteId)
|
||||||
{
|
{
|
||||||
if (spriteId >= 0 && spriteId < animated[0].Size()) {
|
if (spriteId >= 0 && spriteId < animated[0].size()) {
|
||||||
if (animated[0][spriteId] != NULL) {
|
if (animated[0][spriteId] != NULL) {
|
||||||
// count the number of element registered ...
|
// count the number of element registered ...
|
||||||
if (true == animated[0][spriteId]->DecreaseLoadedTime() ) {
|
if (true == animated[0][spriteId]->DecreaseLoadedTime() ) {
|
||||||
|
@ -26,6 +26,7 @@
|
|||||||
#define __EWOL_SCENE_ELEMENT_H__
|
#define __EWOL_SCENE_ELEMENT_H__
|
||||||
|
|
||||||
#include <etk/Types.h>
|
#include <etk/Types.h>
|
||||||
|
#include <vector>
|
||||||
#include <ewol/Debug.h>
|
#include <ewol/Debug.h>
|
||||||
#include <ewol/OObject/Sprite.h>
|
#include <ewol/OObject/Sprite.h>
|
||||||
|
|
||||||
@ -54,10 +55,10 @@ namespace ewol {
|
|||||||
int32_t numberOfGroup; //!< curent scene number of group
|
int32_t numberOfGroup; //!< curent scene number of group
|
||||||
etk::UString groupDescription[MAX_GROUP_NUMBER]; //!< name of all the groups
|
etk::UString groupDescription[MAX_GROUP_NUMBER]; //!< name of all the groups
|
||||||
int32_t groupEnemy[MAX_GROUP_NUMBER][MAX_GROUP_NUMBER]; //!< list of the ennemy
|
int32_t groupEnemy[MAX_GROUP_NUMBER][MAX_GROUP_NUMBER]; //!< list of the ennemy
|
||||||
etk::VectorType<ewol::Sprite*> animated[NB_BOUBLE_BUFFER]; //!< element that must be display the second
|
std::vector<ewol::Sprite*> animated[NB_BOUBLE_BUFFER]; //!< element that must be display the second
|
||||||
etk::VectorType<ewol::GameElement*> listAnimatedElements[MAX_GROUP_NUMBER]; //!< generic element to display order in the diffferent group
|
std::vector<ewol::GameElement*> listAnimatedElements[MAX_GROUP_NUMBER]; //!< generic element to display order in the diffferent group
|
||||||
etk::VectorType<ewol::GameElement*> listGarbage; //!< garbage of the old element allocated ==> prevent multiple alloc and free
|
std::vector<ewol::GameElement*> listGarbage; //!< garbage of the old element allocated ==> prevent multiple alloc and free
|
||||||
etk::VectorType<listRegisteElement*> listCreatorElement; //!< list of all creatable elements
|
std::vector<listRegisteElement*> listCreatorElement; //!< list of all creatable elements
|
||||||
int16_t GetUniqueId(void) { int16_t iddd = m_id; m_id++; return iddd; };
|
int16_t GetUniqueId(void) { int16_t iddd = m_id; m_id++; return iddd; };
|
||||||
void RegisterElementType(etk::UString name, creatorElement_tf * loadElement, etk::UString userString);
|
void RegisterElementType(etk::UString name, creatorElement_tf * loadElement, etk::UString userString);
|
||||||
void RmElement(int32_t group, int32_t idElement);
|
void RmElement(int32_t group, int32_t idElement);
|
||||||
|
@ -29,7 +29,7 @@
|
|||||||
#include <etk/File.h>
|
#include <etk/File.h>
|
||||||
#include <ewol/Debug.h>
|
#include <ewol/Debug.h>
|
||||||
#include <ewol/Font.h>
|
#include <ewol/Font.h>
|
||||||
#include <etk/VectorType.h>
|
#include <vector>
|
||||||
|
|
||||||
namespace ewol {
|
namespace ewol {
|
||||||
extern "C" {
|
extern "C" {
|
||||||
|
@ -40,14 +40,14 @@ ewol::OObject2DColored::OObject2DColored(void)
|
|||||||
|
|
||||||
ewol::OObject2DColored::~OObject2DColored(void)
|
ewol::OObject2DColored::~OObject2DColored(void)
|
||||||
{
|
{
|
||||||
m_coord.Clear();
|
m_coord.clear();
|
||||||
m_coordColor.Clear();
|
m_coordColor.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void ewol::OObject2DColored::Draw(void)
|
void ewol::OObject2DColored::Draw(void)
|
||||||
{
|
{
|
||||||
if (m_coord.Size()<=0) {
|
if (m_coord.size()<=0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
glPushMatrix();
|
glPushMatrix();
|
||||||
@ -62,7 +62,7 @@ void ewol::OObject2DColored::Draw(void)
|
|||||||
//glColorPointer(4, oglTypeFloat_t, 0, &m_coordColor[0] );
|
//glColorPointer(4, oglTypeFloat_t, 0, &m_coordColor[0] );
|
||||||
glColorPointer(4, GL_UNSIGNED_BYTE, 0, &m_coordColor[0] );
|
glColorPointer(4, GL_UNSIGNED_BYTE, 0, &m_coordColor[0] );
|
||||||
// Render : draw all of the triangles at once
|
// Render : draw all of the triangles at once
|
||||||
glDrawArrays( GL_TRIANGLES, 0, m_coord.Size());
|
glDrawArrays( GL_TRIANGLES, 0, m_coord.size());
|
||||||
//glDrawElements( GL_TRIANGLES, 0, m_coord.Size());
|
//glDrawElements( GL_TRIANGLES, 0, m_coord.Size());
|
||||||
//EWOL_DEBUG("Draw ..." << m_coord.Size()/3 << " triangle(s)");
|
//EWOL_DEBUG("Draw ..." << m_coord.Size()/3 << " triangle(s)");
|
||||||
|
|
||||||
@ -75,41 +75,41 @@ void ewol::OObject2DColored::Draw(void)
|
|||||||
|
|
||||||
void ewol::OObject2DColored::Clear(void)
|
void ewol::OObject2DColored::Clear(void)
|
||||||
{
|
{
|
||||||
m_coord.Clear();
|
m_coord.clear();
|
||||||
m_coordColor.Clear();
|
m_coordColor.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void generatePolyGone(etk::VectorType<Vector2D<float> > & input, etk::VectorType<Vector2D<float> > & output )
|
void generatePolyGone(std::vector<Vector2D<float> > & input, std::vector<Vector2D<float> > & output )
|
||||||
{
|
{
|
||||||
if (input.Size()<3) {
|
if (input.size()<3) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// TODO : Regenerate a linear poligone generation
|
// TODO : Regenerate a linear poligone generation
|
||||||
for (int32_t iii=1; iii<input.Size()-1; iii++) {
|
for (int32_t iii=1; iii<input.size()-1; iii++) {
|
||||||
output.PushBack(input[0]);
|
output.push_back(input[0]);
|
||||||
output.PushBack(input[iii]);
|
output.push_back(input[iii]);
|
||||||
output.PushBack(input[iii+1]);
|
output.push_back(input[iii+1]);
|
||||||
}
|
}
|
||||||
//EWOL_DEBUG("generate Plygone : " << input.Size() << " ==> " << output.Size() );
|
//EWOL_DEBUG("generate Plygone : " << input.Size() << " ==> " << output.Size() );
|
||||||
}
|
}
|
||||||
|
|
||||||
void SutherlandHodgman(etk::VectorType<Vector2D<float> > & input, etk::VectorType<Vector2D<float> > & output, float sx, float sy, float ex, float ey)
|
void SutherlandHodgman(std::vector<Vector2D<float> > & input, std::vector<Vector2D<float> > & output, float sx, float sy, float ex, float ey)
|
||||||
{
|
{
|
||||||
// with Sutherland-Hodgman-Algorithm
|
// with Sutherland-Hodgman-Algorithm
|
||||||
if (input.Size() <0) {
|
if (input.size() <=0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
//int32_t sizeInit=input.Size();
|
//int32_t sizeInit=input.Size();
|
||||||
// last element :
|
// last element :
|
||||||
Vector2D<float> destPoint;
|
Vector2D<float> destPoint;
|
||||||
Vector2D<float> lastElement = input[input.Size()-1];
|
Vector2D<float> lastElement = input[input.size()-1];
|
||||||
bool inside = true;
|
bool inside = true;
|
||||||
if (lastElement.x < sx) {
|
if (lastElement.x < sx) {
|
||||||
inside = false;
|
inside = false;
|
||||||
}
|
}
|
||||||
//EWOL_DEBUG("generate an crop : ");
|
//EWOL_DEBUG("generate an crop : ");
|
||||||
for(int32_t iii=0; iii<input.Size(); iii++) {
|
for(int32_t iii=0; iii<input.size(); iii++) {
|
||||||
if(input[iii].x < sx) {
|
if(input[iii].x < sx) {
|
||||||
if(true == inside) {
|
if(true == inside) {
|
||||||
//EWOL_DEBUG("element IN ==> OUT ");
|
//EWOL_DEBUG("element IN ==> OUT ");
|
||||||
@ -119,7 +119,7 @@ void SutherlandHodgman(etk::VectorType<Vector2D<float> > & input, etk::VectorTyp
|
|||||||
float bbb = lastElement.y - (aaa*lastElement.x);
|
float bbb = lastElement.y - (aaa*lastElement.x);
|
||||||
destPoint.y = aaa*sx + bbb;
|
destPoint.y = aaa*sx + bbb;
|
||||||
destPoint.x = sx;
|
destPoint.x = sx;
|
||||||
output.PushBack(destPoint);
|
output.push_back(destPoint);
|
||||||
} else {
|
} else {
|
||||||
//EWOL_DEBUG("element OUT ==> OUT ");
|
//EWOL_DEBUG("element OUT ==> OUT ");
|
||||||
}
|
}
|
||||||
@ -127,7 +127,7 @@ void SutherlandHodgman(etk::VectorType<Vector2D<float> > & input, etk::VectorTyp
|
|||||||
} else {
|
} else {
|
||||||
if(true == inside) {
|
if(true == inside) {
|
||||||
//EWOL_DEBUG("element IN ==> IN ");
|
//EWOL_DEBUG("element IN ==> IN ");
|
||||||
output.PushBack(input[iii]);
|
output.push_back(input[iii]);
|
||||||
} else {
|
} else {
|
||||||
//EWOL_DEBUG("element OUT ==> IN ");
|
//EWOL_DEBUG("element OUT ==> IN ");
|
||||||
//new point intersection ...
|
//new point intersection ...
|
||||||
@ -136,8 +136,8 @@ void SutherlandHodgman(etk::VectorType<Vector2D<float> > & input, etk::VectorTyp
|
|||||||
float bbb = lastElement.y - (aaa*lastElement.x);
|
float bbb = lastElement.y - (aaa*lastElement.x);
|
||||||
destPoint.y = aaa*sx + bbb;
|
destPoint.y = aaa*sx + bbb;
|
||||||
destPoint.x = sx;
|
destPoint.x = sx;
|
||||||
output.PushBack(destPoint);
|
output.push_back(destPoint);
|
||||||
output.PushBack(input[iii]);
|
output.push_back(input[iii]);
|
||||||
}
|
}
|
||||||
inside = true;
|
inside = true;
|
||||||
}
|
}
|
||||||
@ -148,13 +148,13 @@ void SutherlandHodgman(etk::VectorType<Vector2D<float> > & input, etk::VectorTyp
|
|||||||
|
|
||||||
//EWOL_DEBUG("generate an crop on element : " << sizeInit << " ==> " << output.Size() << "intermediate (1)");
|
//EWOL_DEBUG("generate an crop on element : " << sizeInit << " ==> " << output.Size() << "intermediate (1)");
|
||||||
input = output;
|
input = output;
|
||||||
output.Clear();
|
output.clear();
|
||||||
lastElement = input[input.Size()-1];
|
lastElement = input[input.size()-1];
|
||||||
inside = true;
|
inside = true;
|
||||||
if (lastElement.y < sy) {
|
if (lastElement.y < sy) {
|
||||||
inside = false;
|
inside = false;
|
||||||
}
|
}
|
||||||
for(int32_t iii=0; iii<input.Size(); iii++) {
|
for(int32_t iii=0; iii<input.size(); iii++) {
|
||||||
if(input[iii].y < sy) {
|
if(input[iii].y < sy) {
|
||||||
if(true == inside) {
|
if(true == inside) {
|
||||||
//EWOL_DEBUG("element IN ==> OUT ");
|
//EWOL_DEBUG("element IN ==> OUT ");
|
||||||
@ -164,7 +164,7 @@ void SutherlandHodgman(etk::VectorType<Vector2D<float> > & input, etk::VectorTyp
|
|||||||
float bbb = lastElement.x - (aaa*lastElement.y);
|
float bbb = lastElement.x - (aaa*lastElement.y);
|
||||||
destPoint.y = sy;
|
destPoint.y = sy;
|
||||||
destPoint.x = sy*aaa + bbb;
|
destPoint.x = sy*aaa + bbb;
|
||||||
output.PushBack(destPoint);
|
output.push_back(destPoint);
|
||||||
} else {
|
} else {
|
||||||
//EWOL_DEBUG("element OUT ==> OUT ");
|
//EWOL_DEBUG("element OUT ==> OUT ");
|
||||||
}
|
}
|
||||||
@ -172,7 +172,7 @@ void SutherlandHodgman(etk::VectorType<Vector2D<float> > & input, etk::VectorTyp
|
|||||||
} else {
|
} else {
|
||||||
if(true == inside) {
|
if(true == inside) {
|
||||||
//EWOL_DEBUG("element IN ==> IN ");
|
//EWOL_DEBUG("element IN ==> IN ");
|
||||||
output.PushBack(input[iii]);
|
output.push_back(input[iii]);
|
||||||
} else {
|
} else {
|
||||||
//EWOL_DEBUG("element OUT ==> IN ");
|
//EWOL_DEBUG("element OUT ==> IN ");
|
||||||
//new point intersection ...
|
//new point intersection ...
|
||||||
@ -181,8 +181,8 @@ void SutherlandHodgman(etk::VectorType<Vector2D<float> > & input, etk::VectorTyp
|
|||||||
float bbb = lastElement.x - (aaa*lastElement.y);
|
float bbb = lastElement.x - (aaa*lastElement.y);
|
||||||
destPoint.y = sy;
|
destPoint.y = sy;
|
||||||
destPoint.x = sy*aaa + bbb;
|
destPoint.x = sy*aaa + bbb;
|
||||||
output.PushBack(destPoint);
|
output.push_back(destPoint);
|
||||||
output.PushBack(input[iii]);
|
output.push_back(input[iii]);
|
||||||
}
|
}
|
||||||
inside = true;
|
inside = true;
|
||||||
}
|
}
|
||||||
@ -192,14 +192,14 @@ void SutherlandHodgman(etk::VectorType<Vector2D<float> > & input, etk::VectorTyp
|
|||||||
}
|
}
|
||||||
|
|
||||||
input = output;
|
input = output;
|
||||||
output.Clear();
|
output.clear();
|
||||||
lastElement = input[input.Size()-1];
|
lastElement = input[input.size()-1];
|
||||||
inside = true;
|
inside = true;
|
||||||
if (lastElement.x > ex) {
|
if (lastElement.x > ex) {
|
||||||
inside = false;
|
inside = false;
|
||||||
}
|
}
|
||||||
//EWOL_DEBUG("generate an crop : ");
|
//EWOL_DEBUG("generate an crop : ");
|
||||||
for(int32_t iii=0; iii<input.Size(); iii++) {
|
for(int32_t iii=0; iii<input.size(); iii++) {
|
||||||
if(input[iii].x > ex) {
|
if(input[iii].x > ex) {
|
||||||
if(true == inside) {
|
if(true == inside) {
|
||||||
//EWOL_DEBUG("element IN ==> OUT ");
|
//EWOL_DEBUG("element IN ==> OUT ");
|
||||||
@ -209,7 +209,7 @@ void SutherlandHodgman(etk::VectorType<Vector2D<float> > & input, etk::VectorTyp
|
|||||||
float bbb = lastElement.y - (aaa*lastElement.x);
|
float bbb = lastElement.y - (aaa*lastElement.x);
|
||||||
destPoint.y = aaa*ex + bbb;
|
destPoint.y = aaa*ex + bbb;
|
||||||
destPoint.x = ex;
|
destPoint.x = ex;
|
||||||
output.PushBack(destPoint);
|
output.push_back(destPoint);
|
||||||
} else {
|
} else {
|
||||||
//EWOL_DEBUG("element OUT ==> OUT ");
|
//EWOL_DEBUG("element OUT ==> OUT ");
|
||||||
}
|
}
|
||||||
@ -217,7 +217,7 @@ void SutherlandHodgman(etk::VectorType<Vector2D<float> > & input, etk::VectorTyp
|
|||||||
} else {
|
} else {
|
||||||
if(true == inside) {
|
if(true == inside) {
|
||||||
//EWOL_DEBUG("element IN ==> IN ");
|
//EWOL_DEBUG("element IN ==> IN ");
|
||||||
output.PushBack(input[iii]);
|
output.push_back(input[iii]);
|
||||||
} else {
|
} else {
|
||||||
//EWOL_DEBUG("element OUT ==> IN ");
|
//EWOL_DEBUG("element OUT ==> IN ");
|
||||||
//new point intersection ...
|
//new point intersection ...
|
||||||
@ -226,8 +226,8 @@ void SutherlandHodgman(etk::VectorType<Vector2D<float> > & input, etk::VectorTyp
|
|||||||
float bbb = lastElement.y - (aaa*lastElement.x);
|
float bbb = lastElement.y - (aaa*lastElement.x);
|
||||||
destPoint.y = aaa*ex + bbb;
|
destPoint.y = aaa*ex + bbb;
|
||||||
destPoint.x = ex;
|
destPoint.x = ex;
|
||||||
output.PushBack(destPoint);
|
output.push_back(destPoint);
|
||||||
output.PushBack(input[iii]);
|
output.push_back(input[iii]);
|
||||||
}
|
}
|
||||||
inside = true;
|
inside = true;
|
||||||
}
|
}
|
||||||
@ -237,13 +237,13 @@ void SutherlandHodgman(etk::VectorType<Vector2D<float> > & input, etk::VectorTyp
|
|||||||
}
|
}
|
||||||
|
|
||||||
input = output;
|
input = output;
|
||||||
output.Clear();
|
output.clear();
|
||||||
lastElement = input[input.Size()-1];
|
lastElement = input[input.size()-1];
|
||||||
inside = true;
|
inside = true;
|
||||||
if (lastElement.y > ey) {
|
if (lastElement.y > ey) {
|
||||||
inside = false;
|
inside = false;
|
||||||
}
|
}
|
||||||
for(int32_t iii=0; iii<input.Size(); iii++) {
|
for(int32_t iii=0; iii<input.size(); iii++) {
|
||||||
if(input[iii].y > ey) {
|
if(input[iii].y > ey) {
|
||||||
if(true == inside) {
|
if(true == inside) {
|
||||||
//EWOL_DEBUG("element IN ==> OUT ");
|
//EWOL_DEBUG("element IN ==> OUT ");
|
||||||
@ -253,7 +253,7 @@ void SutherlandHodgman(etk::VectorType<Vector2D<float> > & input, etk::VectorTyp
|
|||||||
float bbb = lastElement.x - (aaa*lastElement.y);
|
float bbb = lastElement.x - (aaa*lastElement.y);
|
||||||
destPoint.y = ey;
|
destPoint.y = ey;
|
||||||
destPoint.x = ey*aaa + bbb;
|
destPoint.x = ey*aaa + bbb;
|
||||||
output.PushBack(destPoint);
|
output.push_back(destPoint);
|
||||||
} else {
|
} else {
|
||||||
//EWOL_DEBUG("element OUT ==> OUT ");
|
//EWOL_DEBUG("element OUT ==> OUT ");
|
||||||
}
|
}
|
||||||
@ -261,7 +261,7 @@ void SutherlandHodgman(etk::VectorType<Vector2D<float> > & input, etk::VectorTyp
|
|||||||
} else {
|
} else {
|
||||||
if(true == inside) {
|
if(true == inside) {
|
||||||
//EWOL_DEBUG("element IN ==> IN ");
|
//EWOL_DEBUG("element IN ==> IN ");
|
||||||
output.PushBack(input[iii]);
|
output.push_back(input[iii]);
|
||||||
} else {
|
} else {
|
||||||
//EWOL_DEBUG("element OUT ==> IN ");
|
//EWOL_DEBUG("element OUT ==> IN ");
|
||||||
//new point intersection ...
|
//new point intersection ...
|
||||||
@ -270,8 +270,8 @@ void SutherlandHodgman(etk::VectorType<Vector2D<float> > & input, etk::VectorTyp
|
|||||||
float bbb = lastElement.x - (aaa*lastElement.y);
|
float bbb = lastElement.x - (aaa*lastElement.y);
|
||||||
destPoint.y = ey;
|
destPoint.y = ey;
|
||||||
destPoint.x = ey*aaa + bbb;
|
destPoint.x = ey*aaa + bbb;
|
||||||
output.PushBack(destPoint);
|
output.push_back(destPoint);
|
||||||
output.PushBack(input[iii]);
|
output.push_back(input[iii]);
|
||||||
}
|
}
|
||||||
inside = true;
|
inside = true;
|
||||||
}
|
}
|
||||||
@ -289,12 +289,12 @@ void ewol::OObject2DColored::GenerateTriangle(void)
|
|||||||
{
|
{
|
||||||
m_triElement = 0;
|
m_triElement = 0;
|
||||||
|
|
||||||
m_coord.PushBack(m_triangle[0]);
|
m_coord.push_back(m_triangle[0]);
|
||||||
m_coordColor.PushBack(m_color[0]);
|
m_coordColor.push_back(m_color[0]);
|
||||||
m_coord.PushBack(m_triangle[1]);
|
m_coord.push_back(m_triangle[1]);
|
||||||
m_coordColor.PushBack(m_color[1]);
|
m_coordColor.push_back(m_color[1]);
|
||||||
m_coord.PushBack(m_triangle[2]);
|
m_coord.push_back(m_triangle[2]);
|
||||||
m_coordColor.PushBack(m_color[2]);
|
m_coordColor.push_back(m_color[2]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -36,9 +36,9 @@ namespace ewol {
|
|||||||
public:
|
public:
|
||||||
virtual void Draw(void);
|
virtual void Draw(void);
|
||||||
protected:
|
protected:
|
||||||
etk::VectorType<Vector2D<float> > m_coord; //!< internal coord of the object
|
std::vector<Vector2D<float> > m_coord; //!< internal coord of the object
|
||||||
etk::VectorType<color_ts> m_coordColor; //!< internal color of the different point
|
std::vector<color_ts> m_coordColor; //!< internal color of the different point
|
||||||
//etk::VectorType<linkCoord_ts> m_linkCoord; //!< internal link between point to generate triangle
|
//std::vector<linkCoord_ts> m_linkCoord; //!< internal link between point to generate triangle
|
||||||
int32_t m_triElement;
|
int32_t m_triElement;
|
||||||
color_ts m_color[3];
|
color_ts m_color[3];
|
||||||
Vector2D<float> m_triangle[3];
|
Vector2D<float> m_triangle[3];
|
||||||
|
@ -58,7 +58,7 @@ ewol::OObject2DText::~OObject2DText(void)
|
|||||||
|
|
||||||
void ewol::OObject2DText::Draw(void)
|
void ewol::OObject2DText::Draw(void)
|
||||||
{
|
{
|
||||||
if (m_coord.Size()<=0) {
|
if (m_coord.size()<=0) {
|
||||||
// TODO : a remètre ...
|
// TODO : a remètre ...
|
||||||
//EWOL_WARNING("Nothink to draw...");
|
//EWOL_WARNING("Nothink to draw...");
|
||||||
return;
|
return;
|
||||||
@ -70,7 +70,7 @@ void ewol::OObject2DText::Draw(void)
|
|||||||
glEnableClientState( GL_TEXTURE_COORD_ARRAY ); // Enable Texture Coord Arrays
|
glEnableClientState( GL_TEXTURE_COORD_ARRAY ); // Enable Texture Coord Arrays
|
||||||
glVertexPointer( 2, GL_FLOAT, 0, &m_coord[0] );
|
glVertexPointer( 2, GL_FLOAT, 0, &m_coord[0] );
|
||||||
glTexCoordPointer( 2, GL_FLOAT, 0, &m_coordTex[0] );
|
glTexCoordPointer( 2, GL_FLOAT, 0, &m_coordTex[0] );
|
||||||
glDrawArrays( GL_TRIANGLES, 0, m_coord.Size());
|
glDrawArrays( GL_TRIANGLES, 0, m_coord.size());
|
||||||
//EWOL_DEBUG("request draw of " << m_coord.Size() << " elements");
|
//EWOL_DEBUG("request draw of " << m_coord.Size() << " elements");
|
||||||
glDisableClientState( GL_VERTEX_ARRAY ); // Disable Vertex Arrays
|
glDisableClientState( GL_VERTEX_ARRAY ); // Disable Vertex Arrays
|
||||||
glDisableClientState( GL_TEXTURE_COORD_ARRAY ); // Disable Texture Coord Arrays
|
glDisableClientState( GL_TEXTURE_COORD_ARRAY ); // Disable Texture Coord Arrays
|
||||||
@ -79,8 +79,8 @@ void ewol::OObject2DText::Draw(void)
|
|||||||
|
|
||||||
void ewol::OObject2DText::Clear(void)
|
void ewol::OObject2DText::Clear(void)
|
||||||
{
|
{
|
||||||
m_coord.Clear();
|
m_coord.clear();
|
||||||
m_coordTex.Clear();
|
m_coordTex.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t ewol::OObject2DText::Text(Vector2D<float> textPos, clipping_ts drawClipping, const etk::UString& unicodeString)
|
int32_t ewol::OObject2DText::Text(Vector2D<float> textPos, clipping_ts drawClipping, const etk::UString& unicodeString)
|
||||||
|
@ -45,8 +45,8 @@ namespace ewol {
|
|||||||
int32_t m_FontId; //!< font internal ID
|
int32_t m_FontId; //!< font internal ID
|
||||||
color_ts m_textColorFg; //!< text color ...
|
color_ts m_textColorFg; //!< text color ...
|
||||||
int32_t m_FontTextureId; //!< font internal Texture ID
|
int32_t m_FontTextureId; //!< font internal Texture ID
|
||||||
etk::VectorType<Vector2D<float> > m_coord; //!< internal coord of the object
|
std::vector<Vector2D<float> > m_coord; //!< internal coord of the object
|
||||||
etk::VectorType<texCoord_ts> m_coordTex; //!< internal texture coordinate for every point
|
std::vector<texCoord_ts> m_coordTex; //!< internal texture coordinate for every point
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -71,7 +71,7 @@ ewol::OObject2DTextColored::~OObject2DTextColored(void)
|
|||||||
|
|
||||||
void ewol::OObject2DTextColored::Draw(void)
|
void ewol::OObject2DTextColored::Draw(void)
|
||||||
{
|
{
|
||||||
if (m_coord.Size()<=0) {
|
if (m_coord.size()<=0) {
|
||||||
// TODO : a remètre ...
|
// TODO : a remètre ...
|
||||||
//EWOL_WARNING("Nothink to draw...");
|
//EWOL_WARNING("Nothink to draw...");
|
||||||
return;
|
return;
|
||||||
@ -84,7 +84,7 @@ void ewol::OObject2DTextColored::Draw(void)
|
|||||||
glVertexPointer( 2, GL_FLOAT, 0, &m_coord[0] );
|
glVertexPointer( 2, GL_FLOAT, 0, &m_coord[0] );
|
||||||
glTexCoordPointer( 2, GL_FLOAT, 0, &m_coordTex[0] );
|
glTexCoordPointer( 2, GL_FLOAT, 0, &m_coordTex[0] );
|
||||||
glColorPointer( 4, GL_UNSIGNED_BYTE, 0, &m_coordColor[0] );
|
glColorPointer( 4, GL_UNSIGNED_BYTE, 0, &m_coordColor[0] );
|
||||||
glDrawArrays( GL_TRIANGLES, 0, m_coord.Size());
|
glDrawArrays( GL_TRIANGLES, 0, m_coord.size());
|
||||||
//EWOL_DEBUG("request draw of " << m_coord.Size() << " elements");
|
//EWOL_DEBUG("request draw of " << m_coord.Size() << " elements");
|
||||||
glDisableClientState( GL_COLOR_ARRAY ); // Disable Color Arrays
|
glDisableClientState( GL_COLOR_ARRAY ); // Disable Color Arrays
|
||||||
glDisableClientState( GL_VERTEX_ARRAY ); // Disable Vertex Arrays
|
glDisableClientState( GL_VERTEX_ARRAY ); // Disable Vertex Arrays
|
||||||
@ -94,9 +94,9 @@ void ewol::OObject2DTextColored::Draw(void)
|
|||||||
|
|
||||||
void ewol::OObject2DTextColored::Clear(void)
|
void ewol::OObject2DTextColored::Clear(void)
|
||||||
{
|
{
|
||||||
m_coord.Clear();
|
m_coord.clear();
|
||||||
m_coordTex.Clear();
|
m_coordTex.clear();
|
||||||
m_coordColor.Clear();
|
m_coordColor.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t ewol::OObject2DTextColored::Text(Vector2D<float> textPos, const etk::UString& unicodeString)
|
int32_t ewol::OObject2DTextColored::Text(Vector2D<float> textPos, const etk::UString& unicodeString)
|
||||||
@ -106,15 +106,15 @@ int32_t ewol::OObject2DTextColored::Text(Vector2D<float> textPos, const etk::USt
|
|||||||
EWOL_ERROR("Font Id is not corectly defined");
|
EWOL_ERROR("Font Id is not corectly defined");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
int32_t nbElementInTheArray = m_coord.Size();
|
int32_t nbElementInTheArray = m_coord.size();
|
||||||
int32_t size = 0;
|
int32_t size = 0;
|
||||||
if (true==m_hasClipping) {
|
if (true==m_hasClipping) {
|
||||||
size = ewol::DrawText(m_FontId, textPos, m_clipping, unicodeString, m_FontTextureId, m_coord, m_coordTex);
|
size = ewol::DrawText(m_FontId, textPos, m_clipping, unicodeString, m_FontTextureId, m_coord, m_coordTex);
|
||||||
} else {
|
} else {
|
||||||
size = ewol::DrawText(m_FontId, textPos, unicodeString, m_FontTextureId, m_coord, m_coordTex);
|
size = ewol::DrawText(m_FontId, textPos, unicodeString, m_FontTextureId, m_coord, m_coordTex);
|
||||||
}
|
}
|
||||||
for (int32_t iii=nbElementInTheArray; iii<m_coord.Size(); iii++) {
|
for (int32_t iii=nbElementInTheArray; iii<m_coord.size(); iii++) {
|
||||||
m_coordColor.PushBack(m_color);
|
m_coordColor.push_back(m_color);
|
||||||
}
|
}
|
||||||
return size;
|
return size;
|
||||||
}
|
}
|
||||||
@ -126,15 +126,15 @@ int32_t ewol::OObject2DTextColored::Text(Vector2D<float> textPos, const uniChar_
|
|||||||
EWOL_ERROR("Font Id is not corectly defined");
|
EWOL_ERROR("Font Id is not corectly defined");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
int32_t nbElementInTheArray = m_coord.Size();
|
int32_t nbElementInTheArray = m_coord.size();
|
||||||
int32_t size = 0;
|
int32_t size = 0;
|
||||||
if (true==m_hasClipping) {
|
if (true==m_hasClipping) {
|
||||||
size = ewol::DrawText(m_FontId, textPos, m_clipping, unicodeChar, m_FontTextureId, m_coord, m_coordTex);
|
size = ewol::DrawText(m_FontId, textPos, m_clipping, unicodeChar, m_FontTextureId, m_coord, m_coordTex);
|
||||||
} else {
|
} else {
|
||||||
size = ewol::DrawText(m_FontId, textPos, unicodeChar, m_FontTextureId, m_coord, m_coordTex);
|
size = ewol::DrawText(m_FontId, textPos, unicodeChar, m_FontTextureId, m_coord, m_coordTex);
|
||||||
}
|
}
|
||||||
for (int32_t iii=nbElementInTheArray; iii<m_coord.Size(); iii++) {
|
for (int32_t iii=nbElementInTheArray; iii<m_coord.size(); iii++) {
|
||||||
m_coordColor.PushBack(m_color);
|
m_coordColor.push_back(m_color);
|
||||||
}
|
}
|
||||||
return size;
|
return size;
|
||||||
}
|
}
|
||||||
|
@ -47,9 +47,9 @@ namespace ewol {
|
|||||||
int32_t m_FontId; //!< font internal ID
|
int32_t m_FontId; //!< font internal ID
|
||||||
color_ts m_color; //!< tmp text color ...
|
color_ts m_color; //!< tmp text color ...
|
||||||
int32_t m_FontTextureId; //!< font internal Texture ID
|
int32_t m_FontTextureId; //!< font internal Texture ID
|
||||||
etk::VectorType<Vector2D<float> > m_coord; //!< internal coord of the object
|
std::vector<Vector2D<float> > m_coord; //!< internal coord of the object
|
||||||
etk::VectorType<texCoord_ts> m_coordTex; //!< internal texture coordinate for every point
|
std::vector<texCoord_ts> m_coordTex; //!< internal texture coordinate for every point
|
||||||
etk::VectorType<color_ts> m_coordColor; //!< internal color of the different point
|
std::vector<color_ts> m_coordColor; //!< internal color of the different point
|
||||||
public:
|
public:
|
||||||
void SetFontID(int32_t fontID) { m_FontId = fontID; };
|
void SetFontID(int32_t fontID) { m_FontId = fontID; };
|
||||||
int32_t GetFontID(void) { return m_FontId; };
|
int32_t GetFontID(void) { return m_FontId; };
|
||||||
|
@ -52,7 +52,7 @@ ewol::OObject2DTextured::~OObject2DTextured(void)
|
|||||||
|
|
||||||
void ewol::OObject2DTextured::Draw(void)
|
void ewol::OObject2DTextured::Draw(void)
|
||||||
{
|
{
|
||||||
if (m_coord.Size()<=0) {
|
if (m_coord.size()<=0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (m_textureId == -1) {
|
if (m_textureId == -1) {
|
||||||
@ -69,7 +69,7 @@ void ewol::OObject2DTextured::Draw(void)
|
|||||||
glVertexPointer( 2, GL_FLOAT, 0, &m_coord[0] );
|
glVertexPointer( 2, GL_FLOAT, 0, &m_coord[0] );
|
||||||
glTexCoordPointer( 2, GL_FLOAT, 0, &m_coordTex[0] );
|
glTexCoordPointer( 2, GL_FLOAT, 0, &m_coordTex[0] );
|
||||||
glColorPointer( 4, GL_UNSIGNED_BYTE, 0, &m_coordColor[0] );
|
glColorPointer( 4, GL_UNSIGNED_BYTE, 0, &m_coordColor[0] );
|
||||||
glDrawArrays( GL_TRIANGLES, 0, m_coord.Size());
|
glDrawArrays( GL_TRIANGLES, 0, m_coord.size());
|
||||||
//EWOL_DEBUG("request draw of " << m_coord.Size() << " elements");
|
//EWOL_DEBUG("request draw of " << m_coord.Size() << " elements");
|
||||||
glDisableClientState( GL_COLOR_ARRAY ); // Disable Color Arrays
|
glDisableClientState( GL_COLOR_ARRAY ); // Disable Color Arrays
|
||||||
glDisableClientState( GL_VERTEX_ARRAY ); // Disable Vertex Arrays
|
glDisableClientState( GL_VERTEX_ARRAY ); // Disable Vertex Arrays
|
||||||
@ -79,9 +79,9 @@ void ewol::OObject2DTextured::Draw(void)
|
|||||||
|
|
||||||
void ewol::OObject2DTextured::Clear(void)
|
void ewol::OObject2DTextured::Clear(void)
|
||||||
{
|
{
|
||||||
m_coord.Clear();
|
m_coord.clear();
|
||||||
m_coordTex.Clear();
|
m_coordTex.clear();
|
||||||
m_coordColor.Clear();
|
m_coordColor.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ewol::OObject2DTextured::Rectangle(float x, float y, float w, float h, color_ts tmpColor)
|
void ewol::OObject2DTextured::Rectangle(float x, float y, float w, float h, color_ts tmpColor)
|
||||||
@ -99,45 +99,45 @@ void ewol::OObject2DTextured::Rectangle(float x, float y, float w, float h, floa
|
|||||||
tex.v = texSY;
|
tex.v = texSY;
|
||||||
point.x = x;
|
point.x = x;
|
||||||
point.y = y;
|
point.y = y;
|
||||||
m_coord.PushBack(point);
|
m_coord.push_back(point);
|
||||||
m_coordTex.PushBack(tex);
|
m_coordTex.push_back(tex);
|
||||||
m_coordColor.PushBack(tmpColor);
|
m_coordColor.push_back(tmpColor);
|
||||||
|
|
||||||
|
|
||||||
tex.u = texSX;
|
tex.u = texSX;
|
||||||
tex.v = texSY;
|
tex.v = texSY;
|
||||||
point.x = x + w;
|
point.x = x + w;
|
||||||
point.y = y;
|
point.y = y;
|
||||||
m_coord.PushBack(point);
|
m_coord.push_back(point);
|
||||||
m_coordTex.PushBack(tex);
|
m_coordTex.push_back(tex);
|
||||||
m_coordColor.PushBack(tmpColor);
|
m_coordColor.push_back(tmpColor);
|
||||||
|
|
||||||
|
|
||||||
tex.u = texSX;
|
tex.u = texSX;
|
||||||
tex.v = texY;
|
tex.v = texY;
|
||||||
point.x = x + w;
|
point.x = x + w;
|
||||||
point.y = y + h;
|
point.y = y + h;
|
||||||
m_coord.PushBack(point);
|
m_coord.push_back(point);
|
||||||
m_coordTex.PushBack(tex);
|
m_coordTex.push_back(tex);
|
||||||
m_coordColor.PushBack(tmpColor);
|
m_coordColor.push_back(tmpColor);
|
||||||
|
|
||||||
m_coord.PushBack(point);
|
m_coord.push_back(point);
|
||||||
m_coordTex.PushBack(tex);
|
m_coordTex.push_back(tex);
|
||||||
m_coordColor.PushBack(tmpColor);
|
m_coordColor.push_back(tmpColor);
|
||||||
|
|
||||||
tex.u = texX;
|
tex.u = texX;
|
||||||
tex.v = texY;
|
tex.v = texY;
|
||||||
point.x = x;
|
point.x = x;
|
||||||
point.y = y + h;
|
point.y = y + h;
|
||||||
m_coord.PushBack(point);
|
m_coord.push_back(point);
|
||||||
m_coordTex.PushBack(tex);
|
m_coordTex.push_back(tex);
|
||||||
m_coordColor.PushBack(tmpColor);
|
m_coordColor.push_back(tmpColor);
|
||||||
|
|
||||||
tex.u = texX;
|
tex.u = texX;
|
||||||
tex.v = texSY;
|
tex.v = texSY;
|
||||||
point.x = x;
|
point.x = x;
|
||||||
point.y = y;
|
point.y = y;
|
||||||
m_coord.PushBack(point);
|
m_coord.push_back(point);
|
||||||
m_coordTex.PushBack(tex);
|
m_coordTex.push_back(tex);
|
||||||
m_coordColor.PushBack(tmpColor);
|
m_coordColor.push_back(tmpColor);
|
||||||
}
|
}
|
||||||
|
@ -41,9 +41,9 @@ namespace ewol {
|
|||||||
void Rectangle(float x, float y, float w, float h, color_ts tmpColor);
|
void Rectangle(float x, float y, float w, float h, color_ts tmpColor);
|
||||||
protected:
|
protected:
|
||||||
int32_t m_textureId; //!< texture internal ID
|
int32_t m_textureId; //!< texture internal ID
|
||||||
etk::VectorType<Vector2D<float> > m_coord; //!< internal coord of the object
|
std::vector<Vector2D<float> > m_coord; //!< internal coord of the object
|
||||||
etk::VectorType<texCoord_ts> m_coordTex; //!< internal texture coordinate for every point
|
std::vector<texCoord_ts> m_coordTex; //!< internal texture coordinate for every point
|
||||||
etk::VectorType<color_ts> m_coordColor; //!< internal color of the different point
|
std::vector<color_ts> m_coordColor; //!< internal color of the different point
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -56,7 +56,7 @@ ewol::Sprite::~Sprite(void)
|
|||||||
|
|
||||||
void ewol::Sprite::Draw(void)
|
void ewol::Sprite::Draw(void)
|
||||||
{
|
{
|
||||||
if (m_coord.Size()<=0) {
|
if (m_coord.size()<=0) {
|
||||||
//EWOL_WARNING("Nothink to draw...");
|
//EWOL_WARNING("Nothink to draw...");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -73,7 +73,7 @@ void ewol::Sprite::Draw(void)
|
|||||||
glVertexPointer( 3, GL_FLOAT, 0, &m_coord[0] );
|
glVertexPointer( 3, GL_FLOAT, 0, &m_coord[0] );
|
||||||
glTexCoordPointer( 2, GL_FLOAT, 0, &m_coordTex[0] );
|
glTexCoordPointer( 2, GL_FLOAT, 0, &m_coordTex[0] );
|
||||||
glColorPointer( 4, GL_UNSIGNED_BYTE, 0, &m_coordColor[0] );
|
glColorPointer( 4, GL_UNSIGNED_BYTE, 0, &m_coordColor[0] );
|
||||||
glDrawArrays( GL_TRIANGLES, 0, m_coord.Size());
|
glDrawArrays( GL_TRIANGLES, 0, m_coord.size());
|
||||||
//EWOL_DEBUG("request draw of " << m_coord.Size() << " elements");
|
//EWOL_DEBUG("request draw of " << m_coord.Size() << " elements");
|
||||||
glDisableClientState( GL_COLOR_ARRAY ); // Disable Color Arrays
|
glDisableClientState( GL_COLOR_ARRAY ); // Disable Color Arrays
|
||||||
glDisableClientState( GL_VERTEX_ARRAY ); // Disable Vertex Arrays
|
glDisableClientState( GL_VERTEX_ARRAY ); // Disable Vertex Arrays
|
||||||
@ -83,9 +83,9 @@ void ewol::Sprite::Draw(void)
|
|||||||
|
|
||||||
void ewol::Sprite::Clear(void)
|
void ewol::Sprite::Clear(void)
|
||||||
{
|
{
|
||||||
m_coord.Clear();
|
m_coord.clear();
|
||||||
m_coordTex.Clear();
|
m_coordTex.clear();
|
||||||
m_coordColor.Clear();
|
m_coordColor.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ewol::Sprite::Element(Vector2D<float> pos, float size, float angle)
|
void ewol::Sprite::Element(Vector2D<float> pos, float size, float angle)
|
||||||
@ -134,36 +134,36 @@ void ewol::Sprite::Element(Vector3D<float> pos, float size, float angle, color_t
|
|||||||
|
|
||||||
point.x = xxxCos + pos.x;
|
point.x = xxxCos + pos.x;
|
||||||
point.y = yyySin + pos.y;
|
point.y = yyySin + pos.y;
|
||||||
m_coord.PushBack(point);
|
m_coord.push_back(point);
|
||||||
m_coordTex.PushBack(texB);
|
m_coordTex.push_back(texB);
|
||||||
m_coordColor.PushBack(tmpColor);
|
m_coordColor.push_back(tmpColor);
|
||||||
|
|
||||||
point.x = yyySin + pos.x;
|
point.x = yyySin + pos.x;
|
||||||
point.y = -xxxCos + pos.y;
|
point.y = -xxxCos + pos.y;
|
||||||
m_coord.PushBack(point);
|
m_coord.push_back(point);
|
||||||
m_coordTex.PushBack(texC);
|
m_coordTex.push_back(texC);
|
||||||
m_coordColor.PushBack(tmpColor);
|
m_coordColor.push_back(tmpColor);
|
||||||
|
|
||||||
point.x = -xxxCos + pos.x;
|
point.x = -xxxCos + pos.x;
|
||||||
point.y = -yyySin + pos.y;
|
point.y = -yyySin + pos.y;
|
||||||
m_coord.PushBack(point);
|
m_coord.push_back(point);
|
||||||
m_coordTex.PushBack(texD);
|
m_coordTex.push_back(texD);
|
||||||
m_coordColor.PushBack(tmpColor);
|
m_coordColor.push_back(tmpColor);
|
||||||
|
|
||||||
m_coord.PushBack(point);
|
m_coord.push_back(point);
|
||||||
m_coordTex.PushBack(texD);
|
m_coordTex.push_back(texD);
|
||||||
m_coordColor.PushBack(tmpColor);
|
m_coordColor.push_back(tmpColor);
|
||||||
|
|
||||||
point.x = -yyySin + pos.x;
|
point.x = -yyySin + pos.x;
|
||||||
point.y = xxxCos + pos.y;
|
point.y = xxxCos + pos.y;
|
||||||
m_coord.PushBack(point);
|
m_coord.push_back(point);
|
||||||
m_coordTex.PushBack(texA);
|
m_coordTex.push_back(texA);
|
||||||
m_coordColor.PushBack(tmpColor);
|
m_coordColor.push_back(tmpColor);
|
||||||
|
|
||||||
point.x = xxxCos + pos.x;
|
point.x = xxxCos + pos.x;
|
||||||
point.y = yyySin + pos.y;
|
point.y = yyySin + pos.y;
|
||||||
m_coord.PushBack(point);
|
m_coord.push_back(point);
|
||||||
m_coordTex.PushBack(texB);
|
m_coordTex.push_back(texB);
|
||||||
m_coordColor.PushBack(tmpColor);
|
m_coordColor.push_back(tmpColor);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -45,9 +45,9 @@ namespace ewol {
|
|||||||
bool HasName(etk::UString& name) { return name == m_name; };
|
bool HasName(etk::UString& name) { return name == m_name; };
|
||||||
protected:
|
protected:
|
||||||
int32_t m_textureId; //!< texture internal ID
|
int32_t m_textureId; //!< texture internal ID
|
||||||
etk::VectorType<Vector3D<float> > m_coord; //!< internal coord of the object
|
std::vector<Vector3D<float> > m_coord; //!< internal coord of the object
|
||||||
etk::VectorType<texCoord_ts> m_coordTex; //!< internal texture coordinate for every point
|
std::vector<texCoord_ts> m_coordTex; //!< internal texture coordinate for every point
|
||||||
etk::VectorType<color_ts> m_coordColor; //!< internal color of the different point
|
std::vector<color_ts> m_coordColor; //!< internal color of the different point
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -39,7 +39,7 @@ class EventShortCut {
|
|||||||
uniChar_t UnicodeValue;
|
uniChar_t UnicodeValue;
|
||||||
};
|
};
|
||||||
|
|
||||||
static etk::VectorType<EventShortCut *> l_inputShortCutEvent; //!< generic short-cut event
|
static std::vector<EventShortCut *> l_inputShortCutEvent; //!< generic short-cut event
|
||||||
|
|
||||||
|
|
||||||
void ewol::shortCut::Add(bool shift, bool control, bool alt, bool meta, uniChar_t unicodeValue, const char * generateEventId, etk::UString data)
|
void ewol::shortCut::Add(bool shift, bool control, bool alt, bool meta, uniChar_t unicodeValue, const char * generateEventId, etk::UString data)
|
||||||
@ -56,7 +56,7 @@ void ewol::shortCut::Add(bool shift, bool control, bool alt, bool meta, uniChar_
|
|||||||
newEvent->meta = meta;
|
newEvent->meta = meta;
|
||||||
newEvent->UnicodeValue = unicodeValue;
|
newEvent->UnicodeValue = unicodeValue;
|
||||||
newEvent->eventData = data;
|
newEvent->eventData = data;
|
||||||
l_inputShortCutEvent.PushBack(newEvent);
|
l_inputShortCutEvent.push_back(newEvent);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -100,25 +100,25 @@ void ewol::shortCut::Add(const char * descriptiveString, const char * generateEv
|
|||||||
|
|
||||||
void ewol::shortCut::Init(void)
|
void ewol::shortCut::Init(void)
|
||||||
{
|
{
|
||||||
if (l_inputShortCutEvent.Size()>0) {
|
if (l_inputShortCutEvent.size()>0) {
|
||||||
EWOL_WARNING("Old element error in the shortCut system");
|
EWOL_WARNING("Old element error in the shortCut system");
|
||||||
for(int32_t iii=0; iii< l_inputShortCutEvent.Size(); iii++) {
|
for(int32_t iii=0; iii< l_inputShortCutEvent.size(); iii++) {
|
||||||
delete(l_inputShortCutEvent[iii]);
|
delete(l_inputShortCutEvent[iii]);
|
||||||
l_inputShortCutEvent[iii] = NULL;
|
l_inputShortCutEvent[iii] = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
l_inputShortCutEvent.Clear();
|
l_inputShortCutEvent.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ewol::shortCut::UnInit(void)
|
void ewol::shortCut::UnInit(void)
|
||||||
{
|
{
|
||||||
if (l_inputShortCutEvent.Size()>0) {
|
if (l_inputShortCutEvent.size()>0) {
|
||||||
for(int32_t iii=0; iii< l_inputShortCutEvent.Size(); iii++) {
|
for(int32_t iii=0; iii< l_inputShortCutEvent.size(); iii++) {
|
||||||
delete(l_inputShortCutEvent[iii]);
|
delete(l_inputShortCutEvent[iii]);
|
||||||
l_inputShortCutEvent[iii] = NULL;
|
l_inputShortCutEvent[iii] = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
l_inputShortCutEvent.Clear();
|
l_inputShortCutEvent.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -129,7 +129,7 @@ bool ewol::shortCut::Process(bool shift, bool control, bool alt, bool meta, uniC
|
|||||||
unicodeValue += 'a' - 'A';
|
unicodeValue += 'a' - 'A';
|
||||||
}
|
}
|
||||||
//EWOL_INFO("Try to find generic shortcut ...");
|
//EWOL_INFO("Try to find generic shortcut ...");
|
||||||
for(int32_t iii=l_inputShortCutEvent.Size()-1; iii>=0; iii--) {
|
for(int32_t iii=l_inputShortCutEvent.size()-1; iii>=0; iii--) {
|
||||||
if( l_inputShortCutEvent[iii]->shift == shift
|
if( l_inputShortCutEvent[iii]->shift == shift
|
||||||
&& l_inputShortCutEvent[iii]->control == control
|
&& l_inputShortCutEvent[iii]->control == control
|
||||||
&& l_inputShortCutEvent[iii]->alt == alt
|
&& l_inputShortCutEvent[iii]->alt == alt
|
||||||
|
@ -53,7 +53,7 @@ class LoadedTexture
|
|||||||
bool m_destroy;
|
bool m_destroy;
|
||||||
};
|
};
|
||||||
//! List of all Texture loaded ...
|
//! List of all Texture loaded ...
|
||||||
etk::VectorType<LoadedTexture*> l_listLoadedTexture;
|
std::vector<LoadedTexture*> l_listLoadedTexture;
|
||||||
#undef __class__
|
#undef __class__
|
||||||
#define __class__ "texture"
|
#define __class__ "texture"
|
||||||
|
|
||||||
@ -82,13 +82,13 @@ void ewol::texture::UnInit(void)
|
|||||||
{
|
{
|
||||||
pthread_mutex_lock(&localMutex);
|
pthread_mutex_lock(&localMutex);
|
||||||
EWOL_DEBUG("==> Un-Init Texture-Manager");
|
EWOL_DEBUG("==> Un-Init Texture-Manager");
|
||||||
for (int32_t iii=0; iii<l_listLoadedTexture.Size(); iii++) {
|
for (int32_t iii=0; iii<l_listLoadedTexture.size(); iii++) {
|
||||||
if (l_listLoadedTexture[iii] != NULL) {
|
if (l_listLoadedTexture[iii] != NULL) {
|
||||||
delete(l_listLoadedTexture[iii]);
|
delete(l_listLoadedTexture[iii]);
|
||||||
}
|
}
|
||||||
l_listLoadedTexture[iii] = NULL;
|
l_listLoadedTexture[iii] = NULL;
|
||||||
}
|
}
|
||||||
l_listLoadedTexture.Clear();
|
l_listLoadedTexture.clear();
|
||||||
pthread_mutex_unlock(&localMutex);
|
pthread_mutex_unlock(&localMutex);
|
||||||
int ret = pthread_mutex_destroy(&localMutex);
|
int ret = pthread_mutex_destroy(&localMutex);
|
||||||
EWOL_ASSERT(ret == 0, "Error destroying Mutex ...");
|
EWOL_ASSERT(ret == 0, "Error destroying Mutex ...");
|
||||||
@ -105,7 +105,7 @@ void ewol::texture::UnInit(void)
|
|||||||
void ewol::texture::UpdateContextIsDestroy(void)
|
void ewol::texture::UpdateContextIsDestroy(void)
|
||||||
{
|
{
|
||||||
pthread_mutex_lock(&localMutex);
|
pthread_mutex_lock(&localMutex);
|
||||||
for (int32_t iii=0; iii < l_listLoadedTexture.Size(); iii++) {
|
for (int32_t iii=0; iii < l_listLoadedTexture.size(); iii++) {
|
||||||
if( NULL != l_listLoadedTexture[iii]
|
if( NULL != l_listLoadedTexture[iii]
|
||||||
&& NULL != l_listLoadedTexture[iii]->m_data)
|
&& NULL != l_listLoadedTexture[iii]->m_data)
|
||||||
{
|
{
|
||||||
@ -131,7 +131,7 @@ void ewol::texture::UpdateContext(void)
|
|||||||
{
|
{
|
||||||
bool needRedraw = false;
|
bool needRedraw = false;
|
||||||
pthread_mutex_lock(&localMutex);
|
pthread_mutex_lock(&localMutex);
|
||||||
for (int32_t iii=0; iii < l_listLoadedTexture.Size(); iii++) {
|
for (int32_t iii=0; iii < l_listLoadedTexture.size(); iii++) {
|
||||||
if( NULL != l_listLoadedTexture[iii]
|
if( NULL != l_listLoadedTexture[iii]
|
||||||
&& NULL != l_listLoadedTexture[iii]->m_data)
|
&& NULL != l_listLoadedTexture[iii]->m_data)
|
||||||
{
|
{
|
||||||
@ -241,8 +241,8 @@ int32_t ewol::texture::Load(int32_t target, int32_t level, int32_t internalForma
|
|||||||
memcpy(tmpTex->m_data, data, sizeof(char) * tmpTex->m_nbBytes);
|
memcpy(tmpTex->m_data, data, sizeof(char) * tmpTex->m_nbBytes);
|
||||||
|
|
||||||
pthread_mutex_lock(&localMutex);
|
pthread_mutex_lock(&localMutex);
|
||||||
l_listLoadedTexture.PushBack(tmpTex);
|
l_listLoadedTexture.push_back(tmpTex);
|
||||||
outTextureID = l_listLoadedTexture.Size()-1;
|
outTextureID = l_listLoadedTexture.size()-1;
|
||||||
pthread_mutex_unlock(&localMutex);
|
pthread_mutex_unlock(&localMutex);
|
||||||
return outTextureID;
|
return outTextureID;
|
||||||
}
|
}
|
||||||
@ -279,8 +279,8 @@ static int32_t nextP2(int32_t value)
|
|||||||
int32_t ewol::texture::Load(etk::UString tmpfileName, int32_t requestedWidth)
|
int32_t ewol::texture::Load(etk::UString tmpfileName, int32_t requestedWidth)
|
||||||
{
|
{
|
||||||
int32_t outTextureID = -1;
|
int32_t outTextureID = -1;
|
||||||
if (l_listLoadedTexture.Size()!=0) {
|
if (l_listLoadedTexture.size()!=0) {
|
||||||
for (int32_t iii=0; iii<l_listLoadedTexture.Size(); iii++) {
|
for (int32_t iii=0; iii<l_listLoadedTexture.size(); iii++) {
|
||||||
if (NULL != l_listLoadedTexture[iii]) {
|
if (NULL != l_listLoadedTexture[iii]) {
|
||||||
if (l_listLoadedTexture[iii]->m_filename == tmpfileName) {
|
if (l_listLoadedTexture[iii]->m_filename == tmpfileName) {
|
||||||
l_listLoadedTexture[iii]->m_nbTimeLoaded++;
|
l_listLoadedTexture[iii]->m_nbTimeLoaded++;
|
||||||
@ -352,7 +352,7 @@ int32_t ewol::texture::Load(etk::UString tmpfileName, int32_t requestedWidth)
|
|||||||
void ewol::texture::UnLoad(uint32_t textureID)
|
void ewol::texture::UnLoad(uint32_t textureID)
|
||||||
{
|
{
|
||||||
//EWOL_INFO("Unload a specific tecture ID=" << textureID);
|
//EWOL_INFO("Unload a specific tecture ID=" << textureID);
|
||||||
if ((int32_t)textureID<l_listLoadedTexture.Size()) {
|
if ((int32_t)textureID<l_listLoadedTexture.size()) {
|
||||||
if (NULL == l_listLoadedTexture[textureID]) {
|
if (NULL == l_listLoadedTexture[textureID]) {
|
||||||
EWOL_ERROR("Texture : " << textureID << " does not existe anymore...");
|
EWOL_ERROR("Texture : " << textureID << " does not existe anymore...");
|
||||||
return;
|
return;
|
||||||
@ -375,7 +375,7 @@ void ewol::texture::UnLoad(uint32_t textureID)
|
|||||||
*/
|
*/
|
||||||
uint32_t ewol::texture::GetGLID(uint32_t textureID)
|
uint32_t ewol::texture::GetGLID(uint32_t textureID)
|
||||||
{
|
{
|
||||||
if ((int32_t)textureID<l_listLoadedTexture.Size()) {
|
if ((int32_t)textureID<l_listLoadedTexture.size()) {
|
||||||
return l_listLoadedTexture[textureID]->m_openGlTextureID;
|
return l_listLoadedTexture[textureID]->m_openGlTextureID;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
@ -389,7 +389,7 @@ uint32_t ewol::texture::GetGLID(uint32_t textureID)
|
|||||||
*/
|
*/
|
||||||
int32_t ewol::texture::GetSize(uint32_t textureID)
|
int32_t ewol::texture::GetSize(uint32_t textureID)
|
||||||
{
|
{
|
||||||
for (int32_t iii=0; iii<l_listLoadedTexture.Size(); iii++) {
|
for (int32_t iii=0; iii<l_listLoadedTexture.size(); iii++) {
|
||||||
if (l_listLoadedTexture[iii]->m_openGlTextureID == textureID) {
|
if (l_listLoadedTexture[iii]->m_openGlTextureID == textureID) {
|
||||||
return l_listLoadedTexture[iii]->m_width;
|
return l_listLoadedTexture[iii]->m_width;
|
||||||
}
|
}
|
||||||
|
@ -33,7 +33,6 @@ namespace ewol {
|
|||||||
class Widget;
|
class Widget;
|
||||||
};
|
};
|
||||||
#include <etk/Types.h>
|
#include <etk/Types.h>
|
||||||
#include <etk/VectorType.h>
|
|
||||||
#include <ewol/Debug.h>
|
#include <ewol/Debug.h>
|
||||||
#include <ewol/OObject.h>
|
#include <ewol/OObject.h>
|
||||||
#include <ewol/base/eventInputManagement.h>
|
#include <ewol/base/eventInputManagement.h>
|
||||||
|
@ -27,7 +27,7 @@
|
|||||||
#include <ewol/widget/Button.h>
|
#include <ewol/widget/Button.h>
|
||||||
#include <ewol/widget/ButtonColor.h>
|
#include <ewol/widget/ButtonColor.h>
|
||||||
//#include <ewol/widget/Scene.h>
|
//#include <ewol/widget/Scene.h>
|
||||||
#include <etk/VectorType.h>
|
#include <vector>
|
||||||
|
|
||||||
#undef __class__
|
#undef __class__
|
||||||
#define __class__ "WidgetManager"
|
#define __class__ "WidgetManager"
|
||||||
@ -38,7 +38,7 @@ static bool IsInit = false;
|
|||||||
// For the focus Management
|
// For the focus Management
|
||||||
static ewol::Widget * m_focusWidgetDefault = NULL;
|
static ewol::Widget * m_focusWidgetDefault = NULL;
|
||||||
static ewol::Widget * m_focusWidgetCurrent = NULL;
|
static ewol::Widget * m_focusWidgetCurrent = NULL;
|
||||||
static etk::VectorType<ewol::Widget*> l_listOfPeriodicWidget;
|
static std::vector<ewol::Widget*> l_listOfPeriodicWidget;
|
||||||
static bool l_havePeriodic = false;
|
static bool l_havePeriodic = false;
|
||||||
|
|
||||||
void ewol::widgetManager::Init(void)
|
void ewol::widgetManager::Init(void)
|
||||||
@ -50,7 +50,7 @@ void ewol::widgetManager::Init(void)
|
|||||||
// prevent android error ==> can create memory leak but I prefer
|
// prevent android error ==> can create memory leak but I prefer
|
||||||
m_focusWidgetDefault = NULL;
|
m_focusWidgetDefault = NULL;
|
||||||
m_focusWidgetCurrent = NULL;
|
m_focusWidgetCurrent = NULL;
|
||||||
l_listOfPeriodicWidget.Clear();
|
l_listOfPeriodicWidget.clear();
|
||||||
l_havePeriodic = false;
|
l_havePeriodic = false;
|
||||||
// init all the widget global parameters :
|
// init all the widget global parameters :
|
||||||
ewol::WIDGET_JoystickInit();
|
ewol::WIDGET_JoystickInit();
|
||||||
@ -69,7 +69,7 @@ void ewol::widgetManager::UnInit(void)
|
|||||||
|
|
||||||
IsInit = false;
|
IsInit = false;
|
||||||
|
|
||||||
l_listOfPeriodicWidget.Clear();
|
l_listOfPeriodicWidget.clear();
|
||||||
int ret = pthread_mutex_destroy(&localMutex);
|
int ret = pthread_mutex_destroy(&localMutex);
|
||||||
EWOL_ASSERT(ret == 0, "Error destroying Mutex ...");
|
EWOL_ASSERT(ret == 0, "Error destroying Mutex ...");
|
||||||
}
|
}
|
||||||
@ -170,25 +170,25 @@ void ewol::widgetManager::FocusRemoveIfRemove(ewol::Widget * newWidget)
|
|||||||
|
|
||||||
void ewol::widgetManager::PeriodicCallAdd(ewol::Widget * pWidget)
|
void ewol::widgetManager::PeriodicCallAdd(ewol::Widget * pWidget)
|
||||||
{
|
{
|
||||||
for (int32_t iii=0; iii < l_listOfPeriodicWidget.Size(); iii++) {
|
for (int32_t iii=0; iii < l_listOfPeriodicWidget.size(); iii++) {
|
||||||
if (l_listOfPeriodicWidget[iii] == pWidget) {
|
if (l_listOfPeriodicWidget[iii] == pWidget) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (int32_t iii=0; iii < l_listOfPeriodicWidget.Size(); iii++) {
|
for (int32_t iii=0; iii < l_listOfPeriodicWidget.size(); iii++) {
|
||||||
if (NULL == l_listOfPeriodicWidget[iii]) {
|
if (NULL == l_listOfPeriodicWidget[iii]) {
|
||||||
l_listOfPeriodicWidget[iii] = pWidget;
|
l_listOfPeriodicWidget[iii] = pWidget;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
l_listOfPeriodicWidget.PushBack(pWidget);
|
l_listOfPeriodicWidget.push_back(pWidget);
|
||||||
l_havePeriodic = true;
|
l_havePeriodic = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ewol::widgetManager::PeriodicCallRm(ewol::Widget * pWidget)
|
void ewol::widgetManager::PeriodicCallRm(ewol::Widget * pWidget)
|
||||||
{
|
{
|
||||||
int32_t nbElement = 0;
|
int32_t nbElement = 0;
|
||||||
for (int32_t iii=0; iii < l_listOfPeriodicWidget.Size(); iii++) {
|
for (int32_t iii=0; iii < l_listOfPeriodicWidget.size(); iii++) {
|
||||||
if (l_listOfPeriodicWidget[iii] == pWidget) {
|
if (l_listOfPeriodicWidget[iii] == pWidget) {
|
||||||
l_listOfPeriodicWidget[iii] = NULL;
|
l_listOfPeriodicWidget[iii] = NULL;
|
||||||
} else {
|
} else {
|
||||||
@ -202,7 +202,7 @@ void ewol::widgetManager::PeriodicCallRm(ewol::Widget * pWidget)
|
|||||||
|
|
||||||
void ewol::widgetManager::PeriodicCall(int64_t localTime)
|
void ewol::widgetManager::PeriodicCall(int64_t localTime)
|
||||||
{
|
{
|
||||||
for (int32_t iii=0; iii < l_listOfPeriodicWidget.Size(); iii++) {
|
for (int32_t iii=0; iii < l_listOfPeriodicWidget.size(); iii++) {
|
||||||
if (NULL != l_listOfPeriodicWidget[iii]) {
|
if (NULL != l_listOfPeriodicWidget[iii]) {
|
||||||
l_listOfPeriodicWidget[iii]->PeriodicCall(localTime);
|
l_listOfPeriodicWidget[iii]->PeriodicCall(localTime);
|
||||||
}
|
}
|
||||||
|
@ -28,7 +28,7 @@
|
|||||||
#include <etk/Types.h>
|
#include <etk/Types.h>
|
||||||
#include <ewol/Debug.h>
|
#include <ewol/Debug.h>
|
||||||
#include <ewol/OObject.h>
|
#include <ewol/OObject.h>
|
||||||
#include <etk/VectorType.h>
|
#include <vector>
|
||||||
#include <ewol/Widget.h>
|
#include <ewol/Widget.h>
|
||||||
|
|
||||||
namespace ewol {
|
namespace ewol {
|
||||||
|
@ -61,13 +61,13 @@ ewol::Windows::~Windows(void)
|
|||||||
m_subWidget[m_currentCreateId]=NULL;
|
m_subWidget[m_currentCreateId]=NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
for(int32_t iii=0; iii<m_popUpWidgetList[m_currentCreateId].Size(); iii++) {
|
for(int32_t iii=0; iii<m_popUpWidgetList[m_currentCreateId].size(); iii++) {
|
||||||
if (NULL != m_popUpWidgetList[m_currentCreateId][iii]) {
|
if (NULL != m_popUpWidgetList[m_currentCreateId][iii]) {
|
||||||
m_popUpWidgetList[m_currentCreateId][iii]->MarkToRemove();
|
m_popUpWidgetList[m_currentCreateId][iii]->MarkToRemove();
|
||||||
m_popUpWidgetList[m_currentCreateId][iii]=NULL;
|
m_popUpWidgetList[m_currentCreateId][iii]=NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
m_popUpWidgetList[m_currentCreateId].Clear();
|
m_popUpWidgetList[m_currentCreateId].clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -82,7 +82,7 @@ bool ewol::Windows::CalculateSize(float availlableX, float availlableY)
|
|||||||
// TODO : Herited from MinSize .. and expand ???
|
// TODO : Herited from MinSize .. and expand ???
|
||||||
m_subWidget[m_currentCreateId]->CalculateSize(m_size.x, m_size.y);
|
m_subWidget[m_currentCreateId]->CalculateSize(m_size.x, m_size.y);
|
||||||
}
|
}
|
||||||
for(int32_t iii=0; iii<m_popUpWidgetList[m_currentCreateId].Size(); iii++) {
|
for(int32_t iii=0; iii<m_popUpWidgetList[m_currentCreateId].size(); iii++) {
|
||||||
if (NULL != m_popUpWidgetList[m_currentCreateId][iii]) {
|
if (NULL != m_popUpWidgetList[m_currentCreateId][iii]) {
|
||||||
m_popUpWidgetList[m_currentCreateId][iii]->CalculateMinSize();
|
m_popUpWidgetList[m_currentCreateId][iii]->CalculateMinSize();
|
||||||
m_popUpWidgetList[m_currentCreateId][iii]->CalculateSize(m_size.x, m_size.y);
|
m_popUpWidgetList[m_currentCreateId][iii]->CalculateSize(m_size.x, m_size.y);
|
||||||
@ -102,11 +102,11 @@ ewol::Widget * ewol::Windows::GetWidgetAtPos(Vector2D<float> pos)
|
|||||||
// calculate relative position
|
// calculate relative position
|
||||||
Vector2D<float> relativePos = RelativePosition(pos);
|
Vector2D<float> relativePos = RelativePosition(pos);
|
||||||
// event go directly on the pop-up
|
// event go directly on the pop-up
|
||||||
if (0 < m_popUpWidgetList[m_currentCreateId].Size()) {
|
if (0 < m_popUpWidgetList[m_currentCreateId].size()) {
|
||||||
if (NULL == m_popUpWidgetList[m_currentCreateId][m_popUpWidgetList[m_currentCreateId].Size()-1]) {
|
if (NULL == m_popUpWidgetList[m_currentCreateId][m_popUpWidgetList[m_currentCreateId].size()-1]) {
|
||||||
m_popUpWidgetList[m_currentCreateId].PopBack();
|
m_popUpWidgetList[m_currentCreateId].pop_back();
|
||||||
} else {
|
} else {
|
||||||
return m_popUpWidgetList[m_currentCreateId][m_popUpWidgetList[m_currentCreateId].Size()-1]->GetWidgetAtPos(pos);
|
return m_popUpWidgetList[m_currentCreateId][m_popUpWidgetList[m_currentCreateId].size()-1]->GetWidgetAtPos(pos);
|
||||||
}
|
}
|
||||||
// otherwise in the normal windows
|
// otherwise in the normal windows
|
||||||
} else if (NULL != m_subWidget[m_currentCreateId]) {
|
} else if (NULL != m_subWidget[m_currentCreateId]) {
|
||||||
@ -143,7 +143,7 @@ void ewol::Windows::OnRegenerateDisplay(void)
|
|||||||
if (NULL != m_subWidget[m_currentCreateId]) {
|
if (NULL != m_subWidget[m_currentCreateId]) {
|
||||||
m_subWidget[m_currentCreateId]->OnRegenerateDisplay();
|
m_subWidget[m_currentCreateId]->OnRegenerateDisplay();
|
||||||
}
|
}
|
||||||
for(int32_t iii=0; iii<m_popUpWidgetList[m_currentCreateId].Size(); iii++) {
|
for(int32_t iii=0; iii<m_popUpWidgetList[m_currentCreateId].size(); iii++) {
|
||||||
if (NULL != m_popUpWidgetList[m_currentCreateId][iii]) {
|
if (NULL != m_popUpWidgetList[m_currentCreateId][iii]) {
|
||||||
m_popUpWidgetList[m_currentCreateId][iii]->OnRegenerateDisplay();
|
m_popUpWidgetList[m_currentCreateId][iii]->OnRegenerateDisplay();
|
||||||
}
|
}
|
||||||
@ -165,7 +165,7 @@ void ewol::Windows::OnDraw(ewol::DrawProperty& displayProp)
|
|||||||
//EWOL_DEBUG("Draw Windows");
|
//EWOL_DEBUG("Draw Windows");
|
||||||
}
|
}
|
||||||
// second display the pop-up
|
// second display the pop-up
|
||||||
for(int32_t iii=0; iii<m_popUpWidgetList[m_currentDrawId].Size(); iii++) {
|
for(int32_t iii=0; iii<m_popUpWidgetList[m_currentDrawId].size(); iii++) {
|
||||||
if (NULL != m_popUpWidgetList[m_currentDrawId][iii]) {
|
if (NULL != m_popUpWidgetList[m_currentDrawId][iii]) {
|
||||||
m_popUpWidgetList[m_currentDrawId][iii]->GenDraw(displayProp);
|
m_popUpWidgetList[m_currentDrawId][iii]->GenDraw(displayProp);
|
||||||
//EWOL_DEBUG("Draw Pop-up");
|
//EWOL_DEBUG("Draw Pop-up");
|
||||||
@ -191,7 +191,7 @@ void ewol::Windows::SetSubWidget(ewol::Widget * widget)
|
|||||||
|
|
||||||
void ewol::Windows::PopUpWidgetPush(ewol::Widget * widget)
|
void ewol::Windows::PopUpWidgetPush(ewol::Widget * widget)
|
||||||
{
|
{
|
||||||
m_popUpWidgetList[m_currentCreateId].PushBack(widget);
|
m_popUpWidgetList[m_currentCreateId].push_back(widget);
|
||||||
// Regenerate the size calculation :
|
// Regenerate the size calculation :
|
||||||
CalculateSize(m_size.x, m_size.y);
|
CalculateSize(m_size.x, m_size.y);
|
||||||
m_needFlipFlop = true;
|
m_needFlipFlop = true;
|
||||||
@ -218,7 +218,7 @@ void ewol::Windows::OnFlipFlopEvent(void)
|
|||||||
if (NULL != m_subWidget[m_currentDrawId]) {
|
if (NULL != m_subWidget[m_currentDrawId]) {
|
||||||
m_subWidget[m_currentDrawId]->OnFlipFlopEvent();
|
m_subWidget[m_currentDrawId]->OnFlipFlopEvent();
|
||||||
}
|
}
|
||||||
for(int32_t iii=0; iii<m_popUpWidgetList[m_currentDrawId].Size(); iii++) {
|
for(int32_t iii=0; iii<m_popUpWidgetList[m_currentDrawId].size(); iii++) {
|
||||||
if(NULL != m_popUpWidgetList[m_currentDrawId][iii]) {
|
if(NULL != m_popUpWidgetList[m_currentDrawId][iii]) {
|
||||||
m_popUpWidgetList[m_currentDrawId][iii]->OnFlipFlopEvent();
|
m_popUpWidgetList[m_currentDrawId][iii]->OnFlipFlopEvent();
|
||||||
}
|
}
|
||||||
@ -242,11 +242,11 @@ void ewol::Windows::OnObjectRemove(ewol::EObject * removeObject)
|
|||||||
m_subWidget[m_currentCreateId] = NULL;
|
m_subWidget[m_currentCreateId] = NULL;
|
||||||
m_needFlipFlop = true;
|
m_needFlipFlop = true;
|
||||||
}
|
}
|
||||||
for(int32_t iii=m_popUpWidgetList[m_currentCreateId].Size()-1; iii>=0; iii--) {
|
for(int32_t iii=m_popUpWidgetList[m_currentCreateId].size()-1; iii>=0; iii--) {
|
||||||
if(m_popUpWidgetList[m_currentCreateId][iii] == removeObject) {
|
if(m_popUpWidgetList[m_currentCreateId][iii] == removeObject) {
|
||||||
EWOL_DEBUG("Remove Pop-up [" << iii << "] element of the windows ==> destroyed object");
|
EWOL_DEBUG("Remove Pop-up [" << iii << "] element of the windows ==> destroyed object");
|
||||||
m_popUpWidgetList[m_currentCreateId][iii] = NULL;
|
m_popUpWidgetList[m_currentCreateId][iii] = NULL;
|
||||||
m_popUpWidgetList[m_currentCreateId].Erase(iii);
|
m_popUpWidgetList[m_currentCreateId].erase(m_popUpWidgetList[m_currentCreateId].begin()+iii );
|
||||||
m_needFlipFlop = true;
|
m_needFlipFlop = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -27,7 +27,7 @@
|
|||||||
|
|
||||||
#include <etk/Types.h>
|
#include <etk/Types.h>
|
||||||
#include <ewol/Debug.h>
|
#include <ewol/Debug.h>
|
||||||
#include <etk/VectorType.h>
|
#include <vector>
|
||||||
#include <ewol/Widget.h>
|
#include <ewol/Widget.h>
|
||||||
|
|
||||||
namespace ewol {
|
namespace ewol {
|
||||||
@ -79,7 +79,7 @@ namespace ewol {
|
|||||||
}
|
}
|
||||||
private:
|
private:
|
||||||
ewol::Widget* m_subWidget[NB_BOUBLE_BUFFER];
|
ewol::Widget* m_subWidget[NB_BOUBLE_BUFFER];
|
||||||
etk::VectorType<ewol::Widget*> m_popUpWidgetList[NB_BOUBLE_BUFFER];
|
std::vector<ewol::Widget*> m_popUpWidgetList[NB_BOUBLE_BUFFER];
|
||||||
public:
|
public:
|
||||||
void SetSubWidget(ewol::Widget * widget);
|
void SetSubWidget(ewol::Widget * widget);
|
||||||
void PopUpWidgetPush(ewol::Widget * widget);
|
void PopUpWidgetPush(ewol::Widget * widget);
|
||||||
|
@ -1270,16 +1270,16 @@ bool guiAbstraction::IsPressedInput(int32_t inputID)
|
|||||||
|
|
||||||
#include <ewol/ewol.h>
|
#include <ewol/ewol.h>
|
||||||
|
|
||||||
static etk::VectorType<etk::UString*> listArgs;
|
static std::vector<etk::UString*> listArgs;
|
||||||
|
|
||||||
int32_t ewol::CmdLineNb(void)
|
int32_t ewol::CmdLineNb(void)
|
||||||
{
|
{
|
||||||
return listArgs.Size();
|
return listArgs.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
etk::UString ewol::CmdLineGet(int32_t id)
|
etk::UString ewol::CmdLineGet(int32_t id)
|
||||||
{
|
{
|
||||||
if (id<0 && id>=listArgs.Size()) {
|
if (id<0 && id>=listArgs.size()) {
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
if (NULL == listArgs[id]) {
|
if (NULL == listArgs[id]) {
|
||||||
@ -1317,7 +1317,7 @@ int main(int argc, char *argv[])
|
|||||||
} else {
|
} else {
|
||||||
etk::UString* tmpString = new etk::UString(argv[i]);
|
etk::UString* tmpString = new etk::UString(argv[i]);
|
||||||
if (NULL != tmpString) {
|
if (NULL != tmpString) {
|
||||||
listArgs.PushBack(tmpString);
|
listArgs.push_back(tmpString);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1336,13 +1336,13 @@ int main(int argc, char *argv[])
|
|||||||
guiAbstraction::Stop();
|
guiAbstraction::Stop();
|
||||||
// uninit ALL :
|
// uninit ALL :
|
||||||
EWOL_SystemStop();
|
EWOL_SystemStop();
|
||||||
for (int32_t iii=0; iii<listArgs.Size(); iii++) {
|
for (int32_t iii=0; iii<listArgs.size(); iii++) {
|
||||||
if (NULL != listArgs[iii]) {
|
if (NULL != listArgs[iii]) {
|
||||||
delete listArgs[iii];
|
delete listArgs[iii];
|
||||||
listArgs[iii] = NULL;
|
listArgs[iii] = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
listArgs.Clear();
|
listArgs.clear();
|
||||||
#ifdef PTHREAD_GUI_LOCK_MULTITHREAD
|
#ifdef PTHREAD_GUI_LOCK_MULTITHREAD
|
||||||
ret = pthread_mutex_destroy(&l_mutex);
|
ret = pthread_mutex_destroy(&l_mutex);
|
||||||
EWOL_ASSERT(ret == 0, "Error destroying Mutex ...");
|
EWOL_ASSERT(ret == 0, "Error destroying Mutex ...");
|
||||||
|
@ -34,11 +34,11 @@ ewol::Drawable::~Drawable(void)
|
|||||||
{
|
{
|
||||||
//clean all the object
|
//clean all the object
|
||||||
for (int32_t jjj=0; jjj<NB_BOUBLE_BUFFER; jjj++) {
|
for (int32_t jjj=0; jjj<NB_BOUBLE_BUFFER; jjj++) {
|
||||||
for (int32_t iii=0; iii<m_listOObject[jjj].Size(); iii++) {
|
for (int32_t iii=0; iii<m_listOObject[jjj].size(); iii++) {
|
||||||
delete(m_listOObject[jjj][iii]);
|
delete(m_listOObject[jjj][iii]);
|
||||||
m_listOObject[jjj][iii] = NULL;
|
m_listOObject[jjj][iii] = NULL;
|
||||||
}
|
}
|
||||||
m_listOObject[jjj].Clear();
|
m_listOObject[jjj].clear();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -50,10 +50,10 @@ void ewol::Drawable::AddOObject(ewol::OObject* newObject, int32_t pos)
|
|||||||
EWOL_ERROR("Try to add an empty object in the Widget generic display system");
|
EWOL_ERROR("Try to add an empty object in the Widget generic display system");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (pos < 0 || pos >= m_listOObject[m_currentCreateId].Size() ) {
|
if (pos < 0 || pos >= m_listOObject[m_currentCreateId].size() ) {
|
||||||
m_listOObject[m_currentCreateId].PushBack(newObject);
|
m_listOObject[m_currentCreateId].push_back(newObject);
|
||||||
} else {
|
} else {
|
||||||
m_listOObject[m_currentCreateId].Insert(pos, newObject);
|
m_listOObject[m_currentCreateId].insert(m_listOObject[m_currentCreateId].begin()+pos, newObject);
|
||||||
}
|
}
|
||||||
m_needFlipFlop = true;
|
m_needFlipFlop = true;
|
||||||
}
|
}
|
||||||
@ -61,16 +61,16 @@ void ewol::Drawable::AddOObject(ewol::OObject* newObject, int32_t pos)
|
|||||||
|
|
||||||
void ewol::Drawable::ClearOObjectList(void)
|
void ewol::Drawable::ClearOObjectList(void)
|
||||||
{
|
{
|
||||||
for (int32_t iii=0; iii<m_listOObject[m_currentCreateId].Size(); iii++) {
|
for (int32_t iii=0; iii<m_listOObject[m_currentCreateId].size(); iii++) {
|
||||||
delete(m_listOObject[m_currentCreateId][iii]);
|
delete(m_listOObject[m_currentCreateId][iii]);
|
||||||
m_listOObject[m_currentCreateId][iii] = NULL;
|
m_listOObject[m_currentCreateId][iii] = NULL;
|
||||||
}
|
}
|
||||||
m_listOObject[m_currentCreateId].Clear();
|
m_listOObject[m_currentCreateId].clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ewol::Drawable::OnDraw(DrawProperty& displayProp)
|
void ewol::Drawable::OnDraw(DrawProperty& displayProp)
|
||||||
{
|
{
|
||||||
for (int32_t iii=0; iii<m_listOObject[m_currentDrawId].Size(); iii++) {
|
for (int32_t iii=0; iii<m_listOObject[m_currentDrawId].size(); iii++) {
|
||||||
if (NULL != m_listOObject[m_currentDrawId][iii]) {
|
if (NULL != m_listOObject[m_currentDrawId][iii]) {
|
||||||
m_listOObject[m_currentDrawId][iii]->Draw();
|
m_listOObject[m_currentDrawId][iii]->Draw();
|
||||||
}
|
}
|
||||||
|
@ -26,6 +26,7 @@
|
|||||||
#define __EWOL_WIDGET_DRAWABLE_H__
|
#define __EWOL_WIDGET_DRAWABLE_H__
|
||||||
|
|
||||||
#include <ewol/Widget.h>
|
#include <ewol/Widget.h>
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
|
|
||||||
namespace ewol {
|
namespace ewol {
|
||||||
@ -44,7 +45,7 @@ namespace ewol {
|
|||||||
virtual const char * const GetObjectType(void) { return "EwolDrawable"; };
|
virtual const char * const GetObjectType(void) { return "EwolDrawable"; };
|
||||||
|
|
||||||
private:
|
private:
|
||||||
etk::VectorType<ewol::OObject*> m_listOObject[NB_BOUBLE_BUFFER]; //!< generic element to display...
|
std::vector<ewol::OObject*> m_listOObject[NB_BOUBLE_BUFFER]; //!< generic element to display...
|
||||||
public:
|
public:
|
||||||
void AddOObject(ewol::OObject* newObject, int32_t pos=-1);
|
void AddOObject(ewol::OObject* newObject, int32_t pos=-1);
|
||||||
void ClearOObjectList(void);
|
void ClearOObjectList(void);
|
||||||
|
@ -48,7 +48,7 @@ bool ewol::Layer::CalculateSize(float availlableX, float availlableY)
|
|||||||
//EWOL_DEBUG("Update Size");
|
//EWOL_DEBUG("Update Size");
|
||||||
m_size.x = availlableX;
|
m_size.x = availlableX;
|
||||||
m_size.y = availlableY;
|
m_size.y = availlableY;
|
||||||
for (int32_t iii=0; iii<m_subWidget[m_currentCreateId].Size(); iii++) {
|
for (int32_t iii=0; iii<m_subWidget[m_currentCreateId].size(); iii++) {
|
||||||
if (NULL != m_subWidget[m_currentCreateId][iii]) {
|
if (NULL != m_subWidget[m_currentCreateId][iii]) {
|
||||||
m_subWidget[m_currentCreateId][iii]->SetOrigin(m_origin.x, m_origin.y);
|
m_subWidget[m_currentCreateId][iii]->SetOrigin(m_origin.x, m_origin.y);
|
||||||
m_subWidget[m_currentCreateId][iii]->CalculateSize(m_size.x, m_size.y);
|
m_subWidget[m_currentCreateId][iii]->CalculateSize(m_size.x, m_size.y);
|
||||||
@ -65,7 +65,7 @@ bool ewol::Layer::CalculateMinSize(void)
|
|||||||
m_userExpendY=false;
|
m_userExpendY=false;
|
||||||
m_minSize.x = 0.0;
|
m_minSize.x = 0.0;
|
||||||
m_minSize.y = 0.0;
|
m_minSize.y = 0.0;
|
||||||
for (int32_t iii=0; iii<m_subWidget[m_currentCreateId].Size(); iii++) {
|
for (int32_t iii=0; iii<m_subWidget[m_currentCreateId].size(); iii++) {
|
||||||
if (NULL != m_subWidget[m_currentCreateId][iii]) {
|
if (NULL != m_subWidget[m_currentCreateId][iii]) {
|
||||||
m_subWidget[m_currentCreateId][iii]->CalculateMinSize();
|
m_subWidget[m_currentCreateId][iii]->CalculateMinSize();
|
||||||
if (true == m_subWidget[m_currentCreateId][iii]->CanExpentX()) {
|
if (true == m_subWidget[m_currentCreateId][iii]->CanExpentX()) {
|
||||||
@ -118,15 +118,14 @@ void ewol::Layer::LockExpendContamination(bool lockExpend)
|
|||||||
m_lockExpendContamination = lockExpend;
|
m_lockExpendContamination = lockExpend;
|
||||||
}
|
}
|
||||||
|
|
||||||
//etk::VectorType<ewol::Widget*> m_SubWidget;
|
|
||||||
|
|
||||||
void ewol::Layer::SubWidgetRemoveAll(void)
|
void ewol::Layer::SubWidgetRemoveAll(void)
|
||||||
{
|
{
|
||||||
for (int32_t iii=0; iii<m_subWidget[m_currentCreateId].Size(); iii++) {
|
for (int32_t iii=0; iii<m_subWidget[m_currentCreateId].size(); iii++) {
|
||||||
m_subWidget[m_currentCreateId][iii]->MarkToRemove();
|
m_subWidget[m_currentCreateId][iii]->MarkToRemove();
|
||||||
m_subWidget[m_currentCreateId][iii] = NULL;
|
m_subWidget[m_currentCreateId][iii] = NULL;
|
||||||
}
|
}
|
||||||
m_subWidget[m_currentCreateId].Clear();
|
m_subWidget[m_currentCreateId].clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -135,7 +134,7 @@ void ewol::Layer::SubWidgetAdd(ewol::Widget* newWidget)
|
|||||||
if (NULL == newWidget) {
|
if (NULL == newWidget) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
m_subWidget[m_currentCreateId].PushBack(newWidget);
|
m_subWidget[m_currentCreateId].push_back(newWidget);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -144,11 +143,11 @@ void ewol::Layer::SubWidgetRemove(ewol::Widget* newWidget)
|
|||||||
if (NULL == newWidget) {
|
if (NULL == newWidget) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
for (int32_t iii=0; iii<m_subWidget[m_currentCreateId].Size(); iii++) {
|
for (int32_t iii=0; iii<m_subWidget[m_currentCreateId].size(); iii++) {
|
||||||
if (newWidget == m_subWidget[m_currentCreateId][iii]) {
|
if (newWidget == m_subWidget[m_currentCreateId][iii]) {
|
||||||
m_subWidget[m_currentCreateId][iii]->MarkToRemove();
|
m_subWidget[m_currentCreateId][iii]->MarkToRemove();
|
||||||
m_subWidget[m_currentCreateId][iii] = NULL;
|
m_subWidget[m_currentCreateId][iii] = NULL;
|
||||||
m_subWidget[m_currentCreateId].Erase(iii);
|
m_subWidget[m_currentCreateId].erase(m_subWidget[m_currentCreateId].begin()+iii);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -159,10 +158,10 @@ void ewol::Layer::SubWidgetUnLink(ewol::Widget* newWidget)
|
|||||||
if (NULL == newWidget) {
|
if (NULL == newWidget) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
for (int32_t iii=0; iii<m_subWidget[m_currentCreateId].Size(); iii++) {
|
for (int32_t iii=0; iii<m_subWidget[m_currentCreateId].size(); iii++) {
|
||||||
if (newWidget == m_subWidget[m_currentCreateId][iii]) {
|
if (newWidget == m_subWidget[m_currentCreateId][iii]) {
|
||||||
m_subWidget[m_currentCreateId][iii] = NULL;
|
m_subWidget[m_currentCreateId][iii] = NULL;
|
||||||
m_subWidget[m_currentCreateId].Erase(iii);
|
m_subWidget[m_currentCreateId].erase(m_subWidget[m_currentCreateId].begin()+iii);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -172,7 +171,7 @@ void ewol::Layer::SubWidgetUnLink(ewol::Widget* newWidget)
|
|||||||
void ewol::Layer::OnDraw(DrawProperty& displayProp)
|
void ewol::Layer::OnDraw(DrawProperty& displayProp)
|
||||||
{
|
{
|
||||||
// draw is done in the invert sense of inserting ... the first element inserted is on the top and the last is on the buttom
|
// draw is done in the invert sense of inserting ... the first element inserted is on the top and the last is on the buttom
|
||||||
for (int32_t iii=m_subWidget[m_currentDrawId].Size()-1; iii>=0; iii--) {
|
for (int32_t iii=m_subWidget[m_currentDrawId].size()-1; iii>=0; iii--) {
|
||||||
if (NULL != m_subWidget[m_currentDrawId][iii]) {
|
if (NULL != m_subWidget[m_currentDrawId][iii]) {
|
||||||
m_subWidget[m_currentDrawId][iii]->GenDraw(displayProp);
|
m_subWidget[m_currentDrawId][iii]->GenDraw(displayProp);
|
||||||
}
|
}
|
||||||
@ -183,7 +182,7 @@ void ewol::Layer::OnDraw(DrawProperty& displayProp)
|
|||||||
|
|
||||||
void ewol::Layer::OnRegenerateDisplay(void)
|
void ewol::Layer::OnRegenerateDisplay(void)
|
||||||
{
|
{
|
||||||
for (int32_t iii=0; iii<m_subWidget[m_currentCreateId].Size(); iii++) {
|
for (int32_t iii=0; iii<m_subWidget[m_currentCreateId].size(); iii++) {
|
||||||
if (NULL != m_subWidget[m_currentCreateId][iii]) {
|
if (NULL != m_subWidget[m_currentCreateId][iii]) {
|
||||||
m_subWidget[m_currentCreateId][iii]->OnRegenerateDisplay();
|
m_subWidget[m_currentCreateId][iii]->OnRegenerateDisplay();
|
||||||
}
|
}
|
||||||
@ -200,7 +199,7 @@ void ewol::Layer::OnRegenerateDisplay(void)
|
|||||||
ewol::Widget * ewol::Layer::GetWidgetAtPos(Vector2D<float> pos)
|
ewol::Widget * ewol::Layer::GetWidgetAtPos(Vector2D<float> pos)
|
||||||
{
|
{
|
||||||
// for all element in the sizer ...
|
// for all element in the sizer ...
|
||||||
for (int32_t iii=0; iii<m_subWidget[m_currentCreateId].Size(); iii++) {
|
for (int32_t iii=0; iii<m_subWidget[m_currentCreateId].size(); iii++) {
|
||||||
if (NULL != m_subWidget[m_currentCreateId][iii]) {
|
if (NULL != m_subWidget[m_currentCreateId][iii]) {
|
||||||
Vector2D<float> tmpSize = m_subWidget[m_currentCreateId][iii]->GetSize();
|
Vector2D<float> tmpSize = m_subWidget[m_currentCreateId][iii]->GetSize();
|
||||||
Vector2D<float> tmpOrigin = m_subWidget[m_currentCreateId][iii]->GetOrigin();
|
Vector2D<float> tmpOrigin = m_subWidget[m_currentCreateId][iii]->GetOrigin();
|
||||||
@ -234,7 +233,7 @@ void ewol::Layer::OnFlipFlopEvent(void)
|
|||||||
m_subWidget[m_currentCreateId] = m_subWidget[m_currentDrawId];
|
m_subWidget[m_currentCreateId] = m_subWidget[m_currentDrawId];
|
||||||
}
|
}
|
||||||
// in every case, we propagate the flip-flop EVENT
|
// in every case, we propagate the flip-flop EVENT
|
||||||
for(int32_t iii=0; iii<m_subWidget[m_currentDrawId].Size(); iii++) {
|
for(int32_t iii=0; iii<m_subWidget[m_currentDrawId].size(); iii++) {
|
||||||
if(NULL != m_subWidget[m_currentDrawId][iii]) {
|
if(NULL != m_subWidget[m_currentDrawId][iii]) {
|
||||||
m_subWidget[m_currentDrawId][iii]->OnFlipFlopEvent();
|
m_subWidget[m_currentDrawId][iii]->OnFlipFlopEvent();
|
||||||
}
|
}
|
||||||
@ -253,11 +252,11 @@ void ewol::Layer::OnObjectRemove(ewol::EObject * removeObject)
|
|||||||
// First step call parrent :
|
// First step call parrent :
|
||||||
ewol::Widget::OnObjectRemove(removeObject);
|
ewol::Widget::OnObjectRemove(removeObject);
|
||||||
// second step find if in all the elements ...
|
// second step find if in all the elements ...
|
||||||
for(int32_t iii=m_subWidget[m_currentCreateId].Size()-1; iii>=0; iii--) {
|
for(int32_t iii=m_subWidget[m_currentCreateId].size()-1; iii>=0; iii--) {
|
||||||
if(m_subWidget[m_currentCreateId][iii] == removeObject) {
|
if(m_subWidget[m_currentCreateId][iii] == removeObject) {
|
||||||
EWOL_DEBUG("Remove sizer sub Element [" << iii << "] ==> destroyed object");
|
EWOL_DEBUG("Remove sizer sub Element [" << iii << "] ==> destroyed object");
|
||||||
m_subWidget[m_currentCreateId][iii] = NULL;
|
m_subWidget[m_currentCreateId][iii] = NULL;
|
||||||
m_subWidget[m_currentCreateId].Erase(iii);
|
m_subWidget[m_currentCreateId].erase(m_subWidget[m_currentCreateId].begin()+iii);
|
||||||
m_needFlipFlop = true;
|
m_needFlipFlop = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -26,6 +26,7 @@
|
|||||||
#define __EWOL_LAYER_H__
|
#define __EWOL_LAYER_H__
|
||||||
|
|
||||||
#include <etk/Types.h>
|
#include <etk/Types.h>
|
||||||
|
#include <vector>
|
||||||
#include <ewol/Debug.h>
|
#include <ewol/Debug.h>
|
||||||
#include <ewol/Widget.h>
|
#include <ewol/Widget.h>
|
||||||
|
|
||||||
@ -53,7 +54,7 @@ namespace ewol {
|
|||||||
void LockExpendContamination(bool lockExpend=false);
|
void LockExpendContamination(bool lockExpend=false);
|
||||||
private:
|
private:
|
||||||
bool m_lockExpendContamination;
|
bool m_lockExpendContamination;
|
||||||
etk::VectorType<ewol::Widget*> m_subWidget[NB_BOUBLE_BUFFER];
|
std::vector<ewol::Widget*> m_subWidget[NB_BOUBLE_BUFFER];
|
||||||
public:
|
public:
|
||||||
virtual void SubWidgetRemoveAll(void);
|
virtual void SubWidgetRemoveAll(void);
|
||||||
virtual void SubWidgetAdd(ewol::Widget* newWidget);
|
virtual void SubWidgetAdd(ewol::Widget* newWidget);
|
||||||
|
@ -52,11 +52,11 @@ ewol::List::~List(void)
|
|||||||
{
|
{
|
||||||
//clean all the object
|
//clean all the object
|
||||||
for (int32_t jjj=0; jjj<NB_BOUBLE_BUFFER; jjj++) {
|
for (int32_t jjj=0; jjj<NB_BOUBLE_BUFFER; jjj++) {
|
||||||
for (int32_t iii=0; iii<m_listOObject[jjj].Size(); iii++) {
|
for (int32_t iii=0; iii<m_listOObject[jjj].size(); iii++) {
|
||||||
delete(m_listOObject[jjj][iii]);
|
delete(m_listOObject[jjj][iii]);
|
||||||
m_listOObject[jjj][iii] = NULL;
|
m_listOObject[jjj][iii] = NULL;
|
||||||
}
|
}
|
||||||
m_listOObject[jjj].Clear();
|
m_listOObject[jjj].clear();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -81,10 +81,10 @@ void ewol::List::AddOObject(ewol::OObject* newObject, int32_t pos)
|
|||||||
EWOL_ERROR("Try to add an empty object in the Widget generic display system");
|
EWOL_ERROR("Try to add an empty object in the Widget generic display system");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (pos < 0 || pos >= m_listOObject[m_currentCreateId].Size() ) {
|
if (pos < 0 || pos >= m_listOObject[m_currentCreateId].size() ) {
|
||||||
m_listOObject[m_currentCreateId].PushBack(newObject);
|
m_listOObject[m_currentCreateId].push_back(newObject);
|
||||||
} else {
|
} else {
|
||||||
m_listOObject[m_currentCreateId].Insert(pos, newObject);
|
m_listOObject[m_currentCreateId].insert(m_listOObject[m_currentCreateId].begin()+pos, newObject);
|
||||||
}
|
}
|
||||||
m_needFlipFlop = true;
|
m_needFlipFlop = true;
|
||||||
}
|
}
|
||||||
@ -92,16 +92,16 @@ void ewol::List::AddOObject(ewol::OObject* newObject, int32_t pos)
|
|||||||
|
|
||||||
void ewol::List::ClearOObjectList(void)
|
void ewol::List::ClearOObjectList(void)
|
||||||
{
|
{
|
||||||
for (int32_t iii=0; iii<m_listOObject[m_currentCreateId].Size(); iii++) {
|
for (int32_t iii=0; iii<m_listOObject[m_currentCreateId].size(); iii++) {
|
||||||
delete(m_listOObject[m_currentCreateId][iii]);
|
delete(m_listOObject[m_currentCreateId][iii]);
|
||||||
m_listOObject[m_currentCreateId][iii] = NULL;
|
m_listOObject[m_currentCreateId][iii] = NULL;
|
||||||
}
|
}
|
||||||
m_listOObject[m_currentCreateId].Clear();
|
m_listOObject[m_currentCreateId].clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ewol::List::OnDraw(DrawProperty& displayProp)
|
void ewol::List::OnDraw(DrawProperty& displayProp)
|
||||||
{
|
{
|
||||||
for (int32_t iii=0; iii<m_listOObject[m_currentDrawId].Size(); iii++) {
|
for (int32_t iii=0; iii<m_listOObject[m_currentDrawId].size(); iii++) {
|
||||||
if (NULL != m_listOObject[m_currentDrawId][iii]) {
|
if (NULL != m_listOObject[m_currentDrawId][iii]) {
|
||||||
m_listOObject[m_currentDrawId][iii]->Draw();
|
m_listOObject[m_currentDrawId][iii]->Draw();
|
||||||
}
|
}
|
||||||
@ -144,7 +144,7 @@ void ewol::List::OnRegenerateDisplay(void)
|
|||||||
m_maxSize.y = (minHeight + 2*m_paddingSizeY) * nbRaw;
|
m_maxSize.y = (minHeight + 2*m_paddingSizeY) * nbRaw;
|
||||||
|
|
||||||
|
|
||||||
etk::VectorType<int32_t> listSizeColomn;
|
std::vector<int32_t> listSizeColomn;
|
||||||
|
|
||||||
ewol::OObject2DColored * BGOObjects = new ewol::OObject2DColored();
|
ewol::OObject2DColored * BGOObjects = new ewol::OObject2DColored();
|
||||||
color_ts basicBG = GetBasicBG();
|
color_ts basicBG = GetBasicBG();
|
||||||
|
@ -29,6 +29,7 @@
|
|||||||
#include <ewol/Debug.h>
|
#include <ewol/Debug.h>
|
||||||
#include <ewol/widget/WidgetScrolled.h>
|
#include <ewol/widget/WidgetScrolled.h>
|
||||||
#include <ewol/widget/Drawable.h>
|
#include <ewol/widget/Drawable.h>
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
namespace ewol {
|
namespace ewol {
|
||||||
class List :public ewol::WidgetScrooled
|
class List :public ewol::WidgetScrooled
|
||||||
@ -48,7 +49,7 @@ namespace ewol {
|
|||||||
void SetLabel(etk::UString newLabel);
|
void SetLabel(etk::UString newLabel);
|
||||||
// Drawing capabilities ....
|
// Drawing capabilities ....
|
||||||
private:
|
private:
|
||||||
etk::VectorType<ewol::OObject*> m_listOObject[NB_BOUBLE_BUFFER]; //!< generic element to display...
|
std::vector<ewol::OObject*> m_listOObject[NB_BOUBLE_BUFFER]; //!< generic element to display...
|
||||||
public:
|
public:
|
||||||
void AddOObject(ewol::OObject* newObject, int32_t pos=-1);
|
void AddOObject(ewol::OObject* newObject, int32_t pos=-1);
|
||||||
void ClearOObjectList(void);
|
void ClearOObjectList(void);
|
||||||
|
@ -38,14 +38,14 @@ extern const char * const ewolEventFSFileValidate = "ewol-event-file-system-fi
|
|||||||
extern const char * const ewolEventFSFolderSelect = "ewol-event-file-system-folder-select";
|
extern const char * const ewolEventFSFolderSelect = "ewol-event-file-system-folder-select";
|
||||||
extern const char * const ewolEventFSFolderValidate = "ewol-event-file-system-folder-validate";
|
extern const char * const ewolEventFSFolderValidate = "ewol-event-file-system-folder-validate";
|
||||||
|
|
||||||
static void SortElementList(etk::VectorType<ewol::elementFS *> &list)
|
static void SortElementList(std::vector<ewol::elementFS *> &list)
|
||||||
{
|
{
|
||||||
etk::VectorType<ewol::elementFS *> tmpList = list;
|
std::vector<ewol::elementFS *> tmpList = list;
|
||||||
list.Clear();
|
list.clear();
|
||||||
for(int32_t iii=0; iii<tmpList.Size(); iii++) {
|
for(int32_t iii=0; iii<tmpList.size(); iii++) {
|
||||||
if (NULL != tmpList[iii]) {
|
if (NULL != tmpList[iii]) {
|
||||||
int32_t findPos = 0;
|
int32_t findPos = 0;
|
||||||
for(int32_t jjj=0; jjj<list.Size(); jjj++) {
|
for(int32_t jjj=0; jjj<list.size(); jjj++) {
|
||||||
//EWOL_DEBUG("compare : \""<<*tmpList[iii] << "\" and \"" << *m_listDirectory[jjj] << "\"");
|
//EWOL_DEBUG("compare : \""<<*tmpList[iii] << "\" and \"" << *m_listDirectory[jjj] << "\"");
|
||||||
if (list[jjj]!=NULL) {
|
if (list[jjj]!=NULL) {
|
||||||
if (tmpList[iii]->m_name > list[jjj]->m_name) {
|
if (tmpList[iii]->m_name > list[jjj]->m_name) {
|
||||||
@ -54,7 +54,7 @@ static void SortElementList(etk::VectorType<ewol::elementFS *> &list)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
//EWOL_DEBUG("position="<<findPos);
|
//EWOL_DEBUG("position="<<findPos);
|
||||||
list.Insert(findPos, tmpList[iii]);
|
list.insert(list.begin()+findPos, tmpList[iii]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -78,7 +78,7 @@ ewol::ListFileSystem::ListFileSystem(void)
|
|||||||
|
|
||||||
ewol::ListFileSystem::~ListFileSystem(void)
|
ewol::ListFileSystem::~ListFileSystem(void)
|
||||||
{
|
{
|
||||||
for (int32_t iii=0; iii<m_list.Size(); iii++) {
|
for (int32_t iii=0; iii<m_list.size(); iii++) {
|
||||||
if (NULL != m_list[iii]) {
|
if (NULL != m_list[iii]) {
|
||||||
delete(m_list[iii]);
|
delete(m_list[iii]);
|
||||||
m_list[iii] = NULL;
|
m_list[iii] = NULL;
|
||||||
@ -95,13 +95,13 @@ color_ts ewol::ListFileSystem::GetBasicBG(void) {
|
|||||||
void ewol::ListFileSystem::RegenerateView(void)
|
void ewol::ListFileSystem::RegenerateView(void)
|
||||||
{
|
{
|
||||||
// clean the list of files :
|
// clean the list of files :
|
||||||
for (int32_t iii=0; iii<m_list.Size(); iii++) {
|
for (int32_t iii=0; iii<m_list.size(); iii++) {
|
||||||
if (NULL != m_list[iii]) {
|
if (NULL != m_list[iii]) {
|
||||||
delete(m_list[iii]);
|
delete(m_list[iii]);
|
||||||
m_list[iii] = NULL;
|
m_list[iii] = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
m_list.Clear();
|
m_list.clear();
|
||||||
m_originScrooled.x = 0;
|
m_originScrooled.x = 0;
|
||||||
m_originScrooled.y = 0;
|
m_originScrooled.y = 0;
|
||||||
|
|
||||||
@ -111,14 +111,14 @@ void ewol::ListFileSystem::RegenerateView(void)
|
|||||||
// the "." permit to reload the curent folder
|
// the "." permit to reload the curent folder
|
||||||
tmpEmement = new ewol::elementFS(".", ewol::EFS_FOLDER);
|
tmpEmement = new ewol::elementFS(".", ewol::EFS_FOLDER);
|
||||||
if (NULL != tmpEmement) {
|
if (NULL != tmpEmement) {
|
||||||
m_list.PushBack(tmpEmement);
|
m_list.push_back(tmpEmement);
|
||||||
}
|
}
|
||||||
tmpEmement = NULL;
|
tmpEmement = NULL;
|
||||||
// the ".." permit to show the upper folder (but not availlable for the "/" folder
|
// the ".." permit to show the upper folder (but not availlable for the "/" folder
|
||||||
if (m_folder != "/") {
|
if (m_folder != "/") {
|
||||||
tmpEmement = new ewol::elementFS("..", ewol::EFS_FOLDER);
|
tmpEmement = new ewol::elementFS("..", ewol::EFS_FOLDER);
|
||||||
if (NULL != tmpEmement) {
|
if (NULL != tmpEmement) {
|
||||||
m_list.PushBack(tmpEmement);
|
m_list.push_back(tmpEmement);
|
||||||
}
|
}
|
||||||
tmpEmement = NULL;
|
tmpEmement = NULL;
|
||||||
}
|
}
|
||||||
@ -137,7 +137,7 @@ void ewol::ListFileSystem::RegenerateView(void)
|
|||||||
|| true ==m_showHidden) {
|
|| true ==m_showHidden) {
|
||||||
tmpEmement = new ewol::elementFS(tmpString, ewol::EFS_FILE);
|
tmpEmement = new ewol::elementFS(tmpString, ewol::EFS_FILE);
|
||||||
if (NULL != tmpEmement) {
|
if (NULL != tmpEmement) {
|
||||||
m_list.PushBack(tmpEmement);
|
m_list.push_back(tmpEmement);
|
||||||
}
|
}
|
||||||
tmpEmement = NULL;
|
tmpEmement = NULL;
|
||||||
}
|
}
|
||||||
@ -153,7 +153,7 @@ void ewol::ListFileSystem::RegenerateView(void)
|
|||||||
|| true ==m_showHidden) {
|
|| true ==m_showHidden) {
|
||||||
tmpEmement = new ewol::elementFS(tmpString, ewol::EFS_FOLDER);
|
tmpEmement = new ewol::elementFS(tmpString, ewol::EFS_FOLDER);
|
||||||
if (NULL != tmpEmement) {
|
if (NULL != tmpEmement) {
|
||||||
m_list.PushBack(tmpEmement);
|
m_list.push_back(tmpEmement);
|
||||||
}
|
}
|
||||||
tmpEmement = NULL;
|
tmpEmement = NULL;
|
||||||
}
|
}
|
||||||
@ -222,11 +222,12 @@ etk::UString ewol::ListFileSystem::GetSelect(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// select the specific file
|
// select the specific file
|
||||||
void ewol::ListFileSystem::SetSelect( etk::UString data) {
|
void ewol::ListFileSystem::SetSelect( etk::UString data)
|
||||||
|
{
|
||||||
// remove selected line
|
// remove selected line
|
||||||
m_selectedLine = -1;
|
m_selectedLine = -1;
|
||||||
// search the coresponding file :
|
// search the coresponding file :
|
||||||
for (int32_t iii=0; iii<m_list.Size(); iii++) {
|
for (int32_t iii=0; iii<m_list.size(); iii++) {
|
||||||
if (NULL!=m_list[iii]) {
|
if (NULL!=m_list[iii]) {
|
||||||
if (m_list[iii]->m_name == data) {
|
if (m_list[iii]->m_name == data) {
|
||||||
// we find the line :
|
// we find the line :
|
||||||
@ -238,18 +239,25 @@ void ewol::ListFileSystem::SetSelect( etk::UString data) {
|
|||||||
MarkToReedraw();
|
MarkToReedraw();
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t ewol::ListFileSystem::GetNuberOfColomn(void) {
|
uint32_t ewol::ListFileSystem::GetNuberOfColomn(void)
|
||||||
|
{
|
||||||
return 1;
|
return 1;
|
||||||
};
|
}
|
||||||
bool ewol::ListFileSystem::GetTitle(int32_t colomn, etk::UString &myTitle, color_ts &fg, color_ts &bg) {
|
|
||||||
|
bool ewol::ListFileSystem::GetTitle(int32_t colomn, etk::UString &myTitle, color_ts &fg, color_ts &bg)
|
||||||
|
{
|
||||||
myTitle = "title";
|
myTitle = "title";
|
||||||
return true;
|
return true;
|
||||||
};
|
}
|
||||||
uint32_t ewol::ListFileSystem::GetNuberOfRaw(void) {
|
|
||||||
return m_list.Size();
|
uint32_t ewol::ListFileSystem::GetNuberOfRaw(void)
|
||||||
};
|
{
|
||||||
bool ewol::ListFileSystem::GetElement(int32_t colomn, int32_t raw, etk::UString &myTextToWrite, color_ts &fg, color_ts &bg) {
|
return m_list.size();
|
||||||
if (raw >= 0 && raw < m_list.Size() && NULL != m_list[raw]) {
|
}
|
||||||
|
|
||||||
|
bool ewol::ListFileSystem::GetElement(int32_t colomn, int32_t raw, etk::UString &myTextToWrite, color_ts &fg, color_ts &bg)
|
||||||
|
{
|
||||||
|
if (raw >= 0 && raw < m_list.size() && NULL != m_list[raw]) {
|
||||||
myTextToWrite = m_list[raw]->m_name;
|
myTextToWrite = m_list[raw]->m_name;
|
||||||
} else {
|
} else {
|
||||||
myTextToWrite = "ERROR";
|
myTextToWrite = "ERROR";
|
||||||
@ -264,13 +272,14 @@ bool ewol::ListFileSystem::GetElement(int32_t colomn, int32_t raw, etk::UString
|
|||||||
bg = 0x8F8FFFFF;
|
bg = 0x8F8FFFFF;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
};
|
}
|
||||||
|
|
||||||
bool ewol::ListFileSystem::OnItemEvent(int32_t IdInput, ewol::eventInputType_te typeEvent, int32_t colomn, int32_t raw, float x, float y) {
|
bool ewol::ListFileSystem::OnItemEvent(int32_t IdInput, ewol::eventInputType_te typeEvent, int32_t colomn, int32_t raw, float x, float y)
|
||||||
|
{
|
||||||
if (typeEvent == ewol::EVENT_INPUT_TYPE_SINGLE) {
|
if (typeEvent == ewol::EVENT_INPUT_TYPE_SINGLE) {
|
||||||
EWOL_INFO("Event on List : IdInput=" << IdInput << " colomn=" << colomn << " raw=" << raw );
|
EWOL_INFO("Event on List : IdInput=" << IdInput << " colomn=" << colomn << " raw=" << raw );
|
||||||
if (1 == IdInput) {
|
if (1 == IdInput) {
|
||||||
if (raw > m_list.Size() ) {
|
if (raw > m_list.size() ) {
|
||||||
m_selectedLine = -1;
|
m_selectedLine = -1;
|
||||||
} else {
|
} else {
|
||||||
m_selectedLine = raw;
|
m_selectedLine = raw;
|
||||||
|
@ -26,6 +26,7 @@
|
|||||||
#define __EWOL_LIST_FILE_H__
|
#define __EWOL_LIST_FILE_H__
|
||||||
|
|
||||||
#include <ewol/widget/List.h>
|
#include <ewol/widget/List.h>
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
extern const char * const ewolEventFSFileSelect;
|
extern const char * const ewolEventFSFileSelect;
|
||||||
extern const char * const ewolEventFSFileValidate;
|
extern const char * const ewolEventFSFileValidate;
|
||||||
@ -55,7 +56,7 @@ namespace ewol {
|
|||||||
class ListFileSystem : public ewol::List
|
class ListFileSystem : public ewol::List
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
etk::VectorType<ewol::elementFS *> m_list;
|
std::vector<ewol::elementFS *> m_list;
|
||||||
etk::UString m_folder;
|
etk::UString m_folder;
|
||||||
int32_t m_selectedLine;
|
int32_t m_selectedLine;
|
||||||
bool m_showFile;
|
bool m_showFile;
|
||||||
|
@ -70,13 +70,13 @@ void ewol::Menu::SubWidgetUnLink(ewol::Widget* newWidget)
|
|||||||
|
|
||||||
void ewol::Menu::Clear(void)
|
void ewol::Menu::Clear(void)
|
||||||
{
|
{
|
||||||
for( int32_t iii=0; iii < m_listElement.Size(); iii++) {
|
for( int32_t iii=0; iii < m_listElement.size(); iii++) {
|
||||||
if (m_listElement[iii] != NULL) {
|
if (m_listElement[iii] != NULL) {
|
||||||
delete(m_listElement[iii]);
|
delete(m_listElement[iii]);
|
||||||
m_listElement[iii] = NULL;
|
m_listElement[iii] = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
m_listElement.Clear();
|
m_listElement.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t ewol::Menu::AddTitle(etk::UString label, etk::UString image, const char * generateEvent, const etk::UString message)
|
int32_t ewol::Menu::AddTitle(etk::UString label, etk::UString image, const char * generateEvent, const etk::UString message)
|
||||||
@ -98,7 +98,7 @@ int32_t ewol::Menu::Add(int32_t parent, etk::UString label, etk::UString image,
|
|||||||
tmpObject->m_image = image;
|
tmpObject->m_image = image;
|
||||||
tmpObject->m_generateEvent = generateEvent;
|
tmpObject->m_generateEvent = generateEvent;
|
||||||
tmpObject->m_message = message;
|
tmpObject->m_message = message;
|
||||||
m_listElement.PushBack(tmpObject);
|
m_listElement.push_back(tmpObject);
|
||||||
if (-1 == tmpObject->m_parentId) {
|
if (-1 == tmpObject->m_parentId) {
|
||||||
ewol::Button * myButton = NULL;
|
ewol::Button * myButton = NULL;
|
||||||
myButton = new ewol::Button(label);
|
myButton = new ewol::Button(label);
|
||||||
@ -138,7 +138,7 @@ void ewol::Menu::OnReceiveMessage(ewol::EObject * CallerObject, const char * eve
|
|||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
if (eventId == ewolEventButtonPressed) {
|
if (eventId == ewolEventButtonPressed) {
|
||||||
for(int32_t iii=0; iii<m_listElement.Size(); iii++) {
|
for(int32_t iii=0; iii<m_listElement.size(); iii++) {
|
||||||
if (CallerObject == m_listElement[iii]->m_widgetPointer) {
|
if (CallerObject == m_listElement[iii]->m_widgetPointer) {
|
||||||
// 2 posible case (have a message or have a child ...
|
// 2 posible case (have a message or have a child ...
|
||||||
if (m_listElement[iii]->m_generateEvent != NULL) {
|
if (m_listElement[iii]->m_generateEvent != NULL) {
|
||||||
@ -154,7 +154,7 @@ void ewol::Menu::OnReceiveMessage(ewol::EObject * CallerObject, const char * eve
|
|||||||
} else{
|
} else{
|
||||||
EWOL_DEBUG("Menu ==> Load Sub Menu");
|
EWOL_DEBUG("Menu ==> Load Sub Menu");
|
||||||
bool findChild = false;
|
bool findChild = false;
|
||||||
for(int32_t jjj=0; jjj<m_listElement.Size(); jjj++) {
|
for(int32_t jjj=0; jjj<m_listElement.size(); jjj++) {
|
||||||
if (m_listElement[iii]->m_localId == m_listElement[jjj]->m_parentId) {
|
if (m_listElement[iii]->m_localId == m_listElement[jjj]->m_parentId) {
|
||||||
findChild = true;
|
findChild = true;
|
||||||
break;
|
break;
|
||||||
@ -191,7 +191,7 @@ void ewol::Menu::OnReceiveMessage(ewol::EObject * CallerObject, const char * eve
|
|||||||
// set it in the pop-up-system :
|
// set it in the pop-up-system :
|
||||||
m_widgetContextMenu->SubWidgetSet(mySizerVert);
|
m_widgetContextMenu->SubWidgetSet(mySizerVert);
|
||||||
|
|
||||||
for(int32_t jjj=m_listElement.Size()-1; jjj>=0; jjj--) {
|
for(int32_t jjj=m_listElement.size()-1; jjj>=0; jjj--) {
|
||||||
if (m_listElement[iii]!=NULL) {
|
if (m_listElement[iii]!=NULL) {
|
||||||
if (m_listElement[iii]->m_localId == m_listElement[jjj]->m_parentId) {
|
if (m_listElement[iii]->m_localId == m_listElement[jjj]->m_parentId) {
|
||||||
myButton = new ewol::Button(m_listElement[jjj]->m_label);
|
myButton = new ewol::Button(m_listElement[jjj]->m_label);
|
||||||
@ -231,7 +231,7 @@ void ewol::Menu::OnObjectRemove(ewol::EObject * removeObject)
|
|||||||
if (m_widgetContextMenu == removeObject) {
|
if (m_widgetContextMenu == removeObject) {
|
||||||
m_widgetContextMenu = NULL;
|
m_widgetContextMenu = NULL;
|
||||||
}
|
}
|
||||||
for(int32_t jjj=0; jjj<m_listElement.Size(); jjj++) {
|
for(int32_t jjj=0; jjj<m_listElement.size(); jjj++) {
|
||||||
if (NULL != m_listElement[jjj]) {
|
if (NULL != m_listElement[jjj]) {
|
||||||
if (m_listElement[jjj]->m_widgetPointer == removeObject) {
|
if (m_listElement[jjj]->m_widgetPointer == removeObject) {
|
||||||
m_listElement[jjj]->m_widgetPointer = NULL;
|
m_listElement[jjj]->m_widgetPointer = NULL;
|
||||||
|
@ -26,6 +26,7 @@
|
|||||||
#define __EWOL_MENU_H__
|
#define __EWOL_MENU_H__
|
||||||
|
|
||||||
#include <etk/Types.h>
|
#include <etk/Types.h>
|
||||||
|
#include <vector>
|
||||||
#include <etk/UString.h>
|
#include <etk/UString.h>
|
||||||
#include <ewol/Debug.h>
|
#include <ewol/Debug.h>
|
||||||
#include <ewol/Widget.h>
|
#include <ewol/Widget.h>
|
||||||
@ -64,7 +65,7 @@ namespace ewol {
|
|||||||
virtual void SubWidgetRemove(ewol::Widget* newWidget);
|
virtual void SubWidgetRemove(ewol::Widget* newWidget);
|
||||||
virtual void SubWidgetUnLink(ewol::Widget* newWidget);
|
virtual void SubWidgetUnLink(ewol::Widget* newWidget);
|
||||||
private:
|
private:
|
||||||
etk::VectorType<MenuElement*> m_listElement;
|
std::vector<MenuElement*> m_listElement;
|
||||||
int32_t m_staticId; // unique ID for every element of the menu ...
|
int32_t m_staticId; // unique ID for every element of the menu ...
|
||||||
ewol::ContextMenu* m_widgetContextMenu;
|
ewol::ContextMenu* m_widgetContextMenu;
|
||||||
public:
|
public:
|
||||||
|
@ -63,13 +63,13 @@ void ewol::Scene::OnRegenerateDisplay(void)
|
|||||||
{
|
{
|
||||||
if (true == NeedRedraw()) {
|
if (true == NeedRedraw()) {
|
||||||
// clean elements
|
// clean elements
|
||||||
for (int32_t iii=0; iii<m_sceneElement.animated[m_currentCreateId].Size(); iii++) {
|
for (int32_t iii=0; iii<m_sceneElement.animated[m_currentCreateId].size(); iii++) {
|
||||||
if (NULL != m_sceneElement.animated[m_currentCreateId][iii]) {
|
if (NULL != m_sceneElement.animated[m_currentCreateId][iii]) {
|
||||||
m_sceneElement.animated[m_currentCreateId][iii]->Clear();
|
m_sceneElement.animated[m_currentCreateId][iii]->Clear();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (int32_t jjj=0; jjj<MAX_GROUP_NUMBER; jjj++) {
|
for (int32_t jjj=0; jjj<MAX_GROUP_NUMBER; jjj++) {
|
||||||
for (int32_t iii=0; iii<m_sceneElement.listAnimatedElements[jjj].Size(); iii++) {
|
for (int32_t iii=0; iii<m_sceneElement.listAnimatedElements[jjj].size(); iii++) {
|
||||||
if (NULL != m_sceneElement.listAnimatedElements[jjj][iii]) {
|
if (NULL != m_sceneElement.listAnimatedElements[jjj][iii]) {
|
||||||
// find an empty slot ...
|
// find an empty slot ...
|
||||||
m_sceneElement.listAnimatedElements[jjj][iii]->Draw(m_currentCreateId);
|
m_sceneElement.listAnimatedElements[jjj][iii]->Draw(m_currentCreateId);
|
||||||
@ -90,7 +90,7 @@ void ewol::Scene::OnDraw(DrawProperty& displayProp)
|
|||||||
{
|
{
|
||||||
//EWOL_ERROR(" On draw : " << m_currentDrawId);
|
//EWOL_ERROR(" On draw : " << m_currentDrawId);
|
||||||
// draw elements
|
// draw elements
|
||||||
for (int32_t iii=0; iii<m_sceneElement.animated[m_currentDrawId].Size(); iii++) {
|
for (int32_t iii=0; iii<m_sceneElement.animated[m_currentDrawId].size(); iii++) {
|
||||||
if (NULL != m_sceneElement.animated[m_currentDrawId][iii]) {
|
if (NULL != m_sceneElement.animated[m_currentDrawId][iii]) {
|
||||||
m_sceneElement.animated[m_currentDrawId][iii]->Draw();
|
m_sceneElement.animated[m_currentDrawId][iii]->Draw();
|
||||||
}
|
}
|
||||||
@ -126,7 +126,7 @@ void ewol::Scene::PeriodicCall(int64_t localTime)
|
|||||||
ScenePeriodicCall(m_lastCallTime, CYCLIC_CALL_PERIODE_US);
|
ScenePeriodicCall(m_lastCallTime, CYCLIC_CALL_PERIODE_US);
|
||||||
//EWOL_ERROR("Periodic Call ... " << localTime);
|
//EWOL_ERROR("Periodic Call ... " << localTime);
|
||||||
for (int32_t jjj=0; jjj<MAX_GROUP_NUMBER; jjj++) {
|
for (int32_t jjj=0; jjj<MAX_GROUP_NUMBER; jjj++) {
|
||||||
for (int32_t iii=0; iii<m_sceneElement.listAnimatedElements[jjj].Size(); iii++) {
|
for (int32_t iii=0; iii<m_sceneElement.listAnimatedElements[jjj].size(); iii++) {
|
||||||
if (NULL != m_sceneElement.listAnimatedElements[jjj][iii]) {
|
if (NULL != m_sceneElement.listAnimatedElements[jjj][iii]) {
|
||||||
// check if the element request an auto Kill ...
|
// check if the element request an auto Kill ...
|
||||||
if (true == m_sceneElement.listAnimatedElements[jjj][iii]->Process(m_lastCallTime, CYCLIC_CALL_PERIODE_US) ) {
|
if (true == m_sceneElement.listAnimatedElements[jjj][iii]->Process(m_lastCallTime, CYCLIC_CALL_PERIODE_US) ) {
|
||||||
|
@ -51,7 +51,7 @@ bool ewol::SizerHori::CalculateSize(float availlableX, float availlableY)
|
|||||||
float unexpendableSize=0.0;
|
float unexpendableSize=0.0;
|
||||||
int32_t nbWidgetFixedSize=0;
|
int32_t nbWidgetFixedSize=0;
|
||||||
int32_t nbWidgetNotFixedSize=0;
|
int32_t nbWidgetNotFixedSize=0;
|
||||||
for (int32_t iii=0; iii<m_subWidget[m_currentCreateId].Size(); iii++) {
|
for (int32_t iii=0; iii<m_subWidget[m_currentCreateId].size(); iii++) {
|
||||||
if (NULL != m_subWidget[m_currentCreateId][iii]) {
|
if (NULL != m_subWidget[m_currentCreateId][iii]) {
|
||||||
Vector2D<float> tmpSize = m_subWidget[m_currentCreateId][iii]->GetMinSize();
|
Vector2D<float> tmpSize = m_subWidget[m_currentCreateId][iii]->GetMinSize();
|
||||||
unexpendableSize += tmpSize.x;
|
unexpendableSize += tmpSize.x;
|
||||||
@ -73,7 +73,7 @@ bool ewol::SizerHori::CalculateSize(float availlableX, float availlableY)
|
|||||||
Vector2D<float> tmpOrigin;
|
Vector2D<float> tmpOrigin;
|
||||||
tmpOrigin.x = m_origin.x;
|
tmpOrigin.x = m_origin.x;
|
||||||
tmpOrigin.y = m_origin.y;
|
tmpOrigin.y = m_origin.y;
|
||||||
for (int32_t iii=0; iii<m_subWidget[m_currentCreateId].Size(); iii++) {
|
for (int32_t iii=0; iii<m_subWidget[m_currentCreateId].size(); iii++) {
|
||||||
if (NULL != m_subWidget[m_currentCreateId][iii]) {
|
if (NULL != m_subWidget[m_currentCreateId][iii]) {
|
||||||
Vector2D<float> tmpSize = m_subWidget[m_currentCreateId][iii]->GetMinSize();
|
Vector2D<float> tmpSize = m_subWidget[m_currentCreateId][iii]->GetMinSize();
|
||||||
// Set the origin :
|
// Set the origin :
|
||||||
@ -101,7 +101,7 @@ bool ewol::SizerHori::CalculateMinSize(void)
|
|||||||
m_userExpendY=false;
|
m_userExpendY=false;
|
||||||
m_minSize.x = 0.0;
|
m_minSize.x = 0.0;
|
||||||
m_minSize.y = 0.0;
|
m_minSize.y = 0.0;
|
||||||
for (int32_t iii=0; iii<m_subWidget[m_currentCreateId].Size(); iii++) {
|
for (int32_t iii=0; iii<m_subWidget[m_currentCreateId].size(); iii++) {
|
||||||
if (NULL != m_subWidget[m_currentCreateId][iii]) {
|
if (NULL != m_subWidget[m_currentCreateId][iii]) {
|
||||||
m_subWidget[m_currentCreateId][iii]->CalculateMinSize();
|
m_subWidget[m_currentCreateId][iii]->CalculateMinSize();
|
||||||
if (true == m_subWidget[m_currentCreateId][iii]->CanExpentX()) {
|
if (true == m_subWidget[m_currentCreateId][iii]->CanExpentX()) {
|
||||||
@ -158,17 +158,16 @@ void ewol::SizerHori::LockExpendContamination(bool lockExpend)
|
|||||||
m_lockExpendContamination = lockExpend;
|
m_lockExpendContamination = lockExpend;
|
||||||
}
|
}
|
||||||
|
|
||||||
//etk::VectorType<ewol::Widget*> m_subWidget[m_currentCreateId];
|
|
||||||
|
|
||||||
void ewol::SizerHori::SubWidgetRemoveAll(void)
|
void ewol::SizerHori::SubWidgetRemoveAll(void)
|
||||||
{
|
{
|
||||||
for (int32_t iii=0; iii<m_subWidget[m_currentCreateId].Size(); iii++) {
|
for (int32_t iii=0; iii<m_subWidget[m_currentCreateId].size(); iii++) {
|
||||||
if (NULL != m_subWidget[m_currentCreateId][iii]) {
|
if (NULL != m_subWidget[m_currentCreateId][iii]) {
|
||||||
m_subWidget[m_currentCreateId][iii]->MarkToRemove();
|
m_subWidget[m_currentCreateId][iii]->MarkToRemove();
|
||||||
m_subWidget[m_currentCreateId][iii] = NULL;
|
m_subWidget[m_currentCreateId][iii] = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
m_subWidget[m_currentCreateId].Clear();
|
m_subWidget[m_currentCreateId].clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -177,7 +176,7 @@ void ewol::SizerHori::SubWidgetAdd(ewol::Widget* newWidget)
|
|||||||
if (NULL == newWidget) {
|
if (NULL == newWidget) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
m_subWidget[m_currentCreateId].PushBack(newWidget);
|
m_subWidget[m_currentCreateId].push_back(newWidget);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -186,13 +185,13 @@ void ewol::SizerHori::SubWidgetRemove(ewol::Widget* newWidget)
|
|||||||
if (NULL == newWidget) {
|
if (NULL == newWidget) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
for (int32_t iii=0; iii<m_subWidget[m_currentCreateId].Size(); iii++) {
|
for (int32_t iii=0; iii<m_subWidget[m_currentCreateId].size(); iii++) {
|
||||||
if (newWidget == m_subWidget[m_currentCreateId][iii]) {
|
if (newWidget == m_subWidget[m_currentCreateId][iii]) {
|
||||||
if (NULL != m_subWidget[m_currentCreateId][iii]) {
|
if (NULL != m_subWidget[m_currentCreateId][iii]) {
|
||||||
m_subWidget[m_currentCreateId][iii]->MarkToRemove();
|
m_subWidget[m_currentCreateId][iii]->MarkToRemove();
|
||||||
m_subWidget[m_currentCreateId][iii] = NULL;
|
m_subWidget[m_currentCreateId][iii] = NULL;
|
||||||
}
|
}
|
||||||
m_subWidget[m_currentCreateId].Erase(iii);
|
m_subWidget[m_currentCreateId].erase(m_subWidget[m_currentCreateId].begin()+iii);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -203,10 +202,10 @@ void ewol::SizerHori::SubWidgetUnLink(ewol::Widget* newWidget)
|
|||||||
if (NULL == newWidget) {
|
if (NULL == newWidget) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
for (int32_t iii=0; iii<m_subWidget[m_currentCreateId].Size(); iii++) {
|
for (int32_t iii=0; iii<m_subWidget[m_currentCreateId].size(); iii++) {
|
||||||
if (newWidget == m_subWidget[m_currentCreateId][iii]) {
|
if (newWidget == m_subWidget[m_currentCreateId][iii]) {
|
||||||
m_subWidget[m_currentCreateId][iii] = NULL;
|
m_subWidget[m_currentCreateId][iii] = NULL;
|
||||||
m_subWidget[m_currentCreateId].Erase(iii);
|
m_subWidget[m_currentCreateId].erase(m_subWidget[m_currentCreateId].begin()+iii);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -215,7 +214,7 @@ void ewol::SizerHori::SubWidgetUnLink(ewol::Widget* newWidget)
|
|||||||
|
|
||||||
void ewol::SizerHori::OnDraw(DrawProperty& displayProp)
|
void ewol::SizerHori::OnDraw(DrawProperty& displayProp)
|
||||||
{
|
{
|
||||||
for (int32_t iii=0; iii<m_subWidget[m_currentDrawId].Size(); iii++) {
|
for (int32_t iii=0; iii<m_subWidget[m_currentDrawId].size(); iii++) {
|
||||||
if (NULL != m_subWidget[m_currentDrawId][iii]) {
|
if (NULL != m_subWidget[m_currentDrawId][iii]) {
|
||||||
m_subWidget[m_currentDrawId][iii]->GenDraw(displayProp);
|
m_subWidget[m_currentDrawId][iii]->GenDraw(displayProp);
|
||||||
}
|
}
|
||||||
@ -225,7 +224,7 @@ void ewol::SizerHori::OnDraw(DrawProperty& displayProp)
|
|||||||
|
|
||||||
void ewol::SizerHori::OnRegenerateDisplay(void)
|
void ewol::SizerHori::OnRegenerateDisplay(void)
|
||||||
{
|
{
|
||||||
for (int32_t iii=0; iii<m_subWidget[m_currentCreateId].Size(); iii++) {
|
for (int32_t iii=0; iii<m_subWidget[m_currentCreateId].size(); iii++) {
|
||||||
if (NULL != m_subWidget[m_currentCreateId][iii]) {
|
if (NULL != m_subWidget[m_currentCreateId][iii]) {
|
||||||
m_subWidget[m_currentCreateId][iii]->OnRegenerateDisplay();
|
m_subWidget[m_currentCreateId][iii]->OnRegenerateDisplay();
|
||||||
}
|
}
|
||||||
@ -246,7 +245,7 @@ ewol::Widget * ewol::SizerHori::GetWidgetAtPos(Vector2D<float> pos)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
// for all element in the sizer ...
|
// for all element in the sizer ...
|
||||||
for (int32_t iii=0; iii<m_subWidget[m_currentCreateId].Size(); iii++) {
|
for (int32_t iii=0; iii<m_subWidget[m_currentCreateId].size(); iii++) {
|
||||||
if (NULL != m_subWidget[m_currentCreateId][iii]) {
|
if (NULL != m_subWidget[m_currentCreateId][iii]) {
|
||||||
Vector2D<float> tmpSize = m_subWidget[m_currentCreateId][iii]->GetSize();
|
Vector2D<float> tmpSize = m_subWidget[m_currentCreateId][iii]->GetSize();
|
||||||
Vector2D<float> tmpOrigin = m_subWidget[m_currentCreateId][iii]->GetOrigin();
|
Vector2D<float> tmpOrigin = m_subWidget[m_currentCreateId][iii]->GetOrigin();
|
||||||
@ -283,7 +282,7 @@ void ewol::SizerHori::OnFlipFlopEvent(void)
|
|||||||
m_subWidget[m_currentCreateId] = m_subWidget[m_currentDrawId];
|
m_subWidget[m_currentCreateId] = m_subWidget[m_currentDrawId];
|
||||||
}
|
}
|
||||||
// in every case, we propagate the flip-flop EVENT
|
// in every case, we propagate the flip-flop EVENT
|
||||||
for(int32_t iii=0; iii<m_subWidget[m_currentDrawId].Size(); iii++) {
|
for(int32_t iii=0; iii<m_subWidget[m_currentDrawId].size(); iii++) {
|
||||||
if(NULL != m_subWidget[m_currentDrawId][iii]) {
|
if(NULL != m_subWidget[m_currentDrawId][iii]) {
|
||||||
m_subWidget[m_currentDrawId][iii]->OnFlipFlopEvent();
|
m_subWidget[m_currentDrawId][iii]->OnFlipFlopEvent();
|
||||||
}
|
}
|
||||||
@ -302,11 +301,11 @@ void ewol::SizerHori::OnObjectRemove(ewol::EObject * removeObject)
|
|||||||
// First step call parrent :
|
// First step call parrent :
|
||||||
ewol::Widget::OnObjectRemove(removeObject);
|
ewol::Widget::OnObjectRemove(removeObject);
|
||||||
// second step find if in all the elements ...
|
// second step find if in all the elements ...
|
||||||
for(int32_t iii=m_subWidget[m_currentCreateId].Size()-1; iii>=0; iii--) {
|
for(int32_t iii=m_subWidget[m_currentCreateId].size()-1; iii>=0; iii--) {
|
||||||
if(m_subWidget[m_currentCreateId][iii] == removeObject) {
|
if(m_subWidget[m_currentCreateId][iii] == removeObject) {
|
||||||
EWOL_DEBUG("Remove sizer sub Element [" << iii << "] ==> destroyed object");
|
EWOL_DEBUG("Remove sizer sub Element [" << iii << "] ==> destroyed object");
|
||||||
m_subWidget[m_currentCreateId][iii] = NULL;
|
m_subWidget[m_currentCreateId][iii] = NULL;
|
||||||
m_subWidget[m_currentCreateId].Erase(iii);
|
m_subWidget[m_currentCreateId].erase(m_subWidget[m_currentCreateId].begin()+iii);
|
||||||
m_needFlipFlop = true;
|
m_needFlipFlop = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -26,6 +26,7 @@
|
|||||||
#define __EWOL_SIZER_HORI_H__
|
#define __EWOL_SIZER_HORI_H__
|
||||||
|
|
||||||
#include <etk/Types.h>
|
#include <etk/Types.h>
|
||||||
|
#include <vector>
|
||||||
#include <ewol/Debug.h>
|
#include <ewol/Debug.h>
|
||||||
#include <ewol/Widget.h>
|
#include <ewol/Widget.h>
|
||||||
|
|
||||||
@ -54,7 +55,7 @@ namespace ewol {
|
|||||||
void LockExpendContamination(bool lockExpend=false);
|
void LockExpendContamination(bool lockExpend=false);
|
||||||
private:
|
private:
|
||||||
bool m_lockExpendContamination;
|
bool m_lockExpendContamination;
|
||||||
etk::VectorType<ewol::Widget*> m_subWidget[NB_BOUBLE_BUFFER];
|
std::vector<ewol::Widget*> m_subWidget[NB_BOUBLE_BUFFER];
|
||||||
public:
|
public:
|
||||||
virtual void SubWidgetRemoveAll(void);
|
virtual void SubWidgetRemoveAll(void);
|
||||||
virtual void SubWidgetAdd(ewol::Widget* newWidget);
|
virtual void SubWidgetAdd(ewol::Widget* newWidget);
|
||||||
|
@ -52,7 +52,7 @@ bool ewol::SizerVert::CalculateSize(float availlableX, float availlableY)
|
|||||||
float unexpendableSize=0.0;
|
float unexpendableSize=0.0;
|
||||||
int32_t nbWidgetFixedSize=0;
|
int32_t nbWidgetFixedSize=0;
|
||||||
int32_t nbWidgetNotFixedSize=0;
|
int32_t nbWidgetNotFixedSize=0;
|
||||||
for (int32_t iii=0; iii<m_subWidget[m_currentCreateId].Size(); iii++) {
|
for (int32_t iii=0; iii<m_subWidget[m_currentCreateId].size(); iii++) {
|
||||||
if (NULL != m_subWidget[m_currentCreateId][iii]) {
|
if (NULL != m_subWidget[m_currentCreateId][iii]) {
|
||||||
Vector2D<float> tmpSize = m_subWidget[m_currentCreateId][iii]->GetMinSize();
|
Vector2D<float> tmpSize = m_subWidget[m_currentCreateId][iii]->GetMinSize();
|
||||||
unexpendableSize += tmpSize.y;
|
unexpendableSize += tmpSize.y;
|
||||||
@ -75,7 +75,7 @@ bool ewol::SizerVert::CalculateSize(float availlableX, float availlableY)
|
|||||||
Vector2D<float> tmpOrigin;
|
Vector2D<float> tmpOrigin;
|
||||||
tmpOrigin.x = m_origin.x;
|
tmpOrigin.x = m_origin.x;
|
||||||
tmpOrigin.y = m_origin.y;
|
tmpOrigin.y = m_origin.y;
|
||||||
for (int32_t iii=0; iii<m_subWidget[m_currentCreateId].Size(); iii++) {
|
for (int32_t iii=0; iii<m_subWidget[m_currentCreateId].size(); iii++) {
|
||||||
if (NULL != m_subWidget[m_currentCreateId][iii]) {
|
if (NULL != m_subWidget[m_currentCreateId][iii]) {
|
||||||
Vector2D<float> tmpSize = m_subWidget[m_currentCreateId][iii]->GetMinSize();
|
Vector2D<float> tmpSize = m_subWidget[m_currentCreateId][iii]->GetMinSize();
|
||||||
// Set the origin :
|
// Set the origin :
|
||||||
@ -103,7 +103,7 @@ bool ewol::SizerVert::CalculateMinSize(void)
|
|||||||
m_userExpendY=false;
|
m_userExpendY=false;
|
||||||
m_minSize.x = 0.0;
|
m_minSize.x = 0.0;
|
||||||
m_minSize.y = 0.0;
|
m_minSize.y = 0.0;
|
||||||
for (int32_t iii=0; iii<m_subWidget[m_currentCreateId].Size(); iii++) {
|
for (int32_t iii=0; iii<m_subWidget[m_currentCreateId].size(); iii++) {
|
||||||
if (NULL != m_subWidget[m_currentCreateId][iii]) {
|
if (NULL != m_subWidget[m_currentCreateId][iii]) {
|
||||||
m_subWidget[m_currentCreateId][iii]->CalculateMinSize();
|
m_subWidget[m_currentCreateId][iii]->CalculateMinSize();
|
||||||
if (true == m_subWidget[m_currentCreateId][iii]->CanExpentX()) {
|
if (true == m_subWidget[m_currentCreateId][iii]->CanExpentX()) {
|
||||||
@ -165,11 +165,11 @@ void ewol::SizerVert::LockExpendContamination(bool lockExpend)
|
|||||||
|
|
||||||
void ewol::SizerVert::SubWidgetRemoveAll(void)
|
void ewol::SizerVert::SubWidgetRemoveAll(void)
|
||||||
{
|
{
|
||||||
for (int32_t iii=0; iii<m_subWidget[m_currentCreateId].Size(); iii++) {
|
for (int32_t iii=0; iii<m_subWidget[m_currentCreateId].size(); iii++) {
|
||||||
m_subWidget[m_currentCreateId][iii]->MarkToRemove();
|
m_subWidget[m_currentCreateId][iii]->MarkToRemove();
|
||||||
m_subWidget[m_currentCreateId][iii] = NULL;
|
m_subWidget[m_currentCreateId][iii] = NULL;
|
||||||
}
|
}
|
||||||
m_subWidget[m_currentCreateId].Clear();
|
m_subWidget[m_currentCreateId].clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -178,7 +178,7 @@ void ewol::SizerVert::SubWidgetAdd(ewol::Widget* newWidget)
|
|||||||
if (NULL == newWidget) {
|
if (NULL == newWidget) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
m_subWidget[m_currentCreateId].PushBack(newWidget);
|
m_subWidget[m_currentCreateId].push_back(newWidget);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -187,11 +187,11 @@ void ewol::SizerVert::SubWidgetRemove(ewol::Widget* newWidget)
|
|||||||
if (NULL == newWidget) {
|
if (NULL == newWidget) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
for (int32_t iii=0; iii<m_subWidget[m_currentCreateId].Size(); iii++) {
|
for (int32_t iii=0; iii<m_subWidget[m_currentCreateId].size(); iii++) {
|
||||||
if (newWidget == m_subWidget[m_currentCreateId][iii]) {
|
if (newWidget == m_subWidget[m_currentCreateId][iii]) {
|
||||||
m_subWidget[m_currentCreateId][iii]->MarkToRemove();
|
m_subWidget[m_currentCreateId][iii]->MarkToRemove();
|
||||||
m_subWidget[m_currentCreateId][iii] = NULL;
|
m_subWidget[m_currentCreateId][iii] = NULL;
|
||||||
m_subWidget[m_currentCreateId].Erase(iii);
|
m_subWidget[m_currentCreateId].erase(m_subWidget[m_currentCreateId].begin()+iii);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -202,10 +202,10 @@ void ewol::SizerVert::SubWidgetUnLink(ewol::Widget* newWidget)
|
|||||||
if (NULL == newWidget) {
|
if (NULL == newWidget) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
for (int32_t iii=0; iii<m_subWidget[m_currentCreateId].Size(); iii++) {
|
for (int32_t iii=0; iii<m_subWidget[m_currentCreateId].size(); iii++) {
|
||||||
if (newWidget == m_subWidget[m_currentCreateId][iii]) {
|
if (newWidget == m_subWidget[m_currentCreateId][iii]) {
|
||||||
m_subWidget[m_currentCreateId][iii] = NULL;
|
m_subWidget[m_currentCreateId][iii] = NULL;
|
||||||
m_subWidget[m_currentCreateId].Erase(iii);
|
m_subWidget[m_currentCreateId].erase(m_subWidget[m_currentCreateId].begin()+iii);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -214,7 +214,7 @@ void ewol::SizerVert::SubWidgetUnLink(ewol::Widget* newWidget)
|
|||||||
|
|
||||||
void ewol::SizerVert::OnDraw(DrawProperty& displayProp)
|
void ewol::SizerVert::OnDraw(DrawProperty& displayProp)
|
||||||
{
|
{
|
||||||
for (int32_t iii=0; iii<m_subWidget[m_currentDrawId].Size(); iii++) {
|
for (int32_t iii=0; iii<m_subWidget[m_currentDrawId].size(); iii++) {
|
||||||
if (NULL != m_subWidget[m_currentDrawId][iii]) {
|
if (NULL != m_subWidget[m_currentDrawId][iii]) {
|
||||||
m_subWidget[m_currentDrawId][iii]->GenDraw(displayProp);
|
m_subWidget[m_currentDrawId][iii]->GenDraw(displayProp);
|
||||||
}
|
}
|
||||||
@ -225,7 +225,7 @@ void ewol::SizerVert::OnDraw(DrawProperty& displayProp)
|
|||||||
|
|
||||||
void ewol::SizerVert::OnRegenerateDisplay(void)
|
void ewol::SizerVert::OnRegenerateDisplay(void)
|
||||||
{
|
{
|
||||||
for (int32_t iii=0; iii<m_subWidget[m_currentCreateId].Size(); iii++) {
|
for (int32_t iii=0; iii<m_subWidget[m_currentCreateId].size(); iii++) {
|
||||||
if (NULL != m_subWidget[m_currentCreateId][iii]) {
|
if (NULL != m_subWidget[m_currentCreateId][iii]) {
|
||||||
m_subWidget[m_currentCreateId][iii]->OnRegenerateDisplay();
|
m_subWidget[m_currentCreateId][iii]->OnRegenerateDisplay();
|
||||||
}
|
}
|
||||||
@ -246,7 +246,7 @@ ewol::Widget * ewol::SizerVert::GetWidgetAtPos(Vector2D<float> pos)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
// for all element in the sizer ...
|
// for all element in the sizer ...
|
||||||
for (int32_t iii=0; iii<m_subWidget[m_currentCreateId].Size(); iii++) {
|
for (int32_t iii=0; iii<m_subWidget[m_currentCreateId].size(); iii++) {
|
||||||
if (NULL != m_subWidget[m_currentCreateId][iii]) {
|
if (NULL != m_subWidget[m_currentCreateId][iii]) {
|
||||||
Vector2D<float> tmpSize = m_subWidget[m_currentCreateId][iii]->GetSize();
|
Vector2D<float> tmpSize = m_subWidget[m_currentCreateId][iii]->GetSize();
|
||||||
Vector2D<float> tmpOrigin = m_subWidget[m_currentCreateId][iii]->GetOrigin();
|
Vector2D<float> tmpOrigin = m_subWidget[m_currentCreateId][iii]->GetOrigin();
|
||||||
@ -283,7 +283,7 @@ void ewol::SizerVert::OnFlipFlopEvent(void)
|
|||||||
m_subWidget[m_currentCreateId] = m_subWidget[m_currentDrawId];
|
m_subWidget[m_currentCreateId] = m_subWidget[m_currentDrawId];
|
||||||
}
|
}
|
||||||
// in every case, we propagate the flip-flop EVENT
|
// in every case, we propagate the flip-flop EVENT
|
||||||
for(int32_t iii=0; iii<m_subWidget[m_currentDrawId].Size(); iii++) {
|
for(int32_t iii=0; iii<m_subWidget[m_currentDrawId].size(); iii++) {
|
||||||
if(NULL != m_subWidget[m_currentDrawId][iii]) {
|
if(NULL != m_subWidget[m_currentDrawId][iii]) {
|
||||||
m_subWidget[m_currentDrawId][iii]->OnFlipFlopEvent();
|
m_subWidget[m_currentDrawId][iii]->OnFlipFlopEvent();
|
||||||
}
|
}
|
||||||
@ -302,11 +302,11 @@ void ewol::SizerVert::OnObjectRemove(ewol::EObject * removeObject)
|
|||||||
// First step call parrent :
|
// First step call parrent :
|
||||||
ewol::Widget::OnObjectRemove(removeObject);
|
ewol::Widget::OnObjectRemove(removeObject);
|
||||||
// second step find if in all the elements ...
|
// second step find if in all the elements ...
|
||||||
for(int32_t iii=m_subWidget[m_currentCreateId].Size()-1; iii>=0; iii--) {
|
for(int32_t iii=m_subWidget[m_currentCreateId].size()-1; iii>=0; iii--) {
|
||||||
if(m_subWidget[m_currentCreateId][iii] == removeObject) {
|
if(m_subWidget[m_currentCreateId][iii] == removeObject) {
|
||||||
EWOL_DEBUG("Remove sizer sub Element [" << iii << "] ==> destroyed object");
|
EWOL_DEBUG("Remove sizer sub Element [" << iii << "] ==> destroyed object");
|
||||||
m_subWidget[m_currentCreateId][iii] = NULL;
|
m_subWidget[m_currentCreateId][iii] = NULL;
|
||||||
m_subWidget[m_currentCreateId].Erase(iii);
|
m_subWidget[m_currentCreateId].erase(m_subWidget[m_currentCreateId].begin()+iii);
|
||||||
m_needFlipFlop = true;
|
m_needFlipFlop = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -53,7 +53,7 @@ namespace ewol {
|
|||||||
void LockExpendContamination(bool lockExpend=false);
|
void LockExpendContamination(bool lockExpend=false);
|
||||||
private:
|
private:
|
||||||
bool m_lockExpendContamination;
|
bool m_lockExpendContamination;
|
||||||
etk::VectorType<ewol::Widget*> m_subWidget[NB_BOUBLE_BUFFER];
|
std::vector<ewol::Widget*> m_subWidget[NB_BOUBLE_BUFFER];
|
||||||
public:
|
public:
|
||||||
virtual void SubWidgetRemoveAll(void);
|
virtual void SubWidgetRemoveAll(void);
|
||||||
virtual void SubWidgetAdd(ewol::Widget* newWidget);
|
virtual void SubWidgetAdd(ewol::Widget* newWidget);
|
||||||
|
@ -57,7 +57,7 @@ bool ewol::WSlider::CalculateSize(float availlableX, float availlableY)
|
|||||||
|
|
||||||
if (m_windowsDestination == m_windowsSources) {
|
if (m_windowsDestination == m_windowsSources) {
|
||||||
int32_t iii = m_windowsDestination;
|
int32_t iii = m_windowsDestination;
|
||||||
if (iii < m_subWidget[m_currentCreateId].Size()) {
|
if (iii < m_subWidget[m_currentCreateId].size()) {
|
||||||
if (NULL != m_subWidget[m_currentCreateId][iii]) {
|
if (NULL != m_subWidget[m_currentCreateId][iii]) {
|
||||||
m_subWidget[m_currentCreateId][iii]->SetOrigin(m_origin.x, m_origin.y);
|
m_subWidget[m_currentCreateId][iii]->SetOrigin(m_origin.x, m_origin.y);
|
||||||
m_subWidget[m_currentCreateId][iii]->CalculateSize(m_size.x, m_size.y);
|
m_subWidget[m_currentCreateId][iii]->CalculateSize(m_size.x, m_size.y);
|
||||||
@ -65,14 +65,14 @@ bool ewol::WSlider::CalculateSize(float availlableX, float availlableY)
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
int32_t iii = m_windowsSources;
|
int32_t iii = m_windowsSources;
|
||||||
if (iii < m_subWidget[m_currentCreateId].Size()) {
|
if (iii < m_subWidget[m_currentCreateId].size()) {
|
||||||
if (NULL != m_subWidget[m_currentCreateId][iii]) {
|
if (NULL != m_subWidget[m_currentCreateId][iii]) {
|
||||||
m_subWidget[m_currentCreateId][iii]->SetOrigin(m_origin.x - (m_size.x*(float)m_slidingProgress/1000.0), m_origin.y);
|
m_subWidget[m_currentCreateId][iii]->SetOrigin(m_origin.x - (m_size.x*(float)m_slidingProgress/1000.0), m_origin.y);
|
||||||
m_subWidget[m_currentCreateId][iii]->CalculateSize(m_size.x, m_size.y);
|
m_subWidget[m_currentCreateId][iii]->CalculateSize(m_size.x, m_size.y);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
iii = m_windowsDestination;
|
iii = m_windowsDestination;
|
||||||
if (iii < m_subWidget[m_currentCreateId].Size()) {
|
if (iii < m_subWidget[m_currentCreateId].size()) {
|
||||||
if (NULL != m_subWidget[m_currentCreateId][iii]) {
|
if (NULL != m_subWidget[m_currentCreateId][iii]) {
|
||||||
m_subWidget[m_currentCreateId][iii]->SetOrigin(m_origin.x - (m_size.x*((float)m_slidingProgress/1000.0) - m_size.x), m_origin.y);
|
m_subWidget[m_currentCreateId][iii]->SetOrigin(m_origin.x - (m_size.x*((float)m_slidingProgress/1000.0) - m_size.x), m_origin.y);
|
||||||
m_subWidget[m_currentCreateId][iii]->CalculateSize(m_size.x, m_size.y);
|
m_subWidget[m_currentCreateId][iii]->CalculateSize(m_size.x, m_size.y);
|
||||||
@ -91,7 +91,7 @@ bool ewol::WSlider::CalculateMinSize(void)
|
|||||||
m_underExpend.y=false;
|
m_underExpend.y=false;
|
||||||
m_minSize.x = 0.0;
|
m_minSize.x = 0.0;
|
||||||
m_minSize.y = 0.0;
|
m_minSize.y = 0.0;
|
||||||
for (int32_t iii=0; iii<m_subWidget[m_currentCreateId].Size(); iii++) {
|
for (int32_t iii=0; iii<m_subWidget[m_currentCreateId].size(); iii++) {
|
||||||
if (NULL != m_subWidget[m_currentCreateId][iii]) {
|
if (NULL != m_subWidget[m_currentCreateId][iii]) {
|
||||||
m_subWidget[m_currentCreateId][iii]->CalculateMinSize();
|
m_subWidget[m_currentCreateId][iii]->CalculateMinSize();
|
||||||
if (true == m_subWidget[m_currentCreateId][iii]->CanExpentX()) {
|
if (true == m_subWidget[m_currentCreateId][iii]->CanExpentX()) {
|
||||||
@ -144,11 +144,11 @@ void ewol::WSlider::LockExpendContamination(bool lockExpend)
|
|||||||
|
|
||||||
void ewol::WSlider::SubWidgetRemoveAll(void)
|
void ewol::WSlider::SubWidgetRemoveAll(void)
|
||||||
{
|
{
|
||||||
for (int32_t iii=0; iii<m_subWidget[m_currentCreateId].Size(); iii++) {
|
for (int32_t iii=0; iii<m_subWidget[m_currentCreateId].size(); iii++) {
|
||||||
m_subWidget[m_currentCreateId][iii]->MarkToRemove();
|
m_subWidget[m_currentCreateId][iii]->MarkToRemove();
|
||||||
m_subWidget[m_currentCreateId][iii] = NULL;
|
m_subWidget[m_currentCreateId][iii] = NULL;
|
||||||
}
|
}
|
||||||
m_subWidget[m_currentCreateId].Clear();
|
m_subWidget[m_currentCreateId].clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -157,7 +157,7 @@ void ewol::WSlider::SubWidgetAdd(ewol::Widget* newWidget)
|
|||||||
if (NULL == newWidget) {
|
if (NULL == newWidget) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
m_subWidget[m_currentCreateId].PushBack(newWidget);
|
m_subWidget[m_currentCreateId].push_back(newWidget);
|
||||||
MarkToReedraw();
|
MarkToReedraw();
|
||||||
ewol::RequestUpdateSize();
|
ewol::RequestUpdateSize();
|
||||||
}
|
}
|
||||||
@ -168,11 +168,11 @@ void ewol::WSlider::SubWidgetRemove(ewol::Widget* newWidget)
|
|||||||
if (NULL == newWidget) {
|
if (NULL == newWidget) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
for (int32_t iii=0; iii<m_subWidget[m_currentCreateId].Size(); iii++) {
|
for (int32_t iii=0; iii<m_subWidget[m_currentCreateId].size(); iii++) {
|
||||||
if (newWidget == m_subWidget[m_currentCreateId][iii]) {
|
if (newWidget == m_subWidget[m_currentCreateId][iii]) {
|
||||||
m_subWidget[m_currentCreateId][iii]->MarkToRemove();
|
m_subWidget[m_currentCreateId][iii]->MarkToRemove();
|
||||||
m_subWidget[m_currentCreateId][iii] = NULL;
|
m_subWidget[m_currentCreateId][iii] = NULL;
|
||||||
m_subWidget[m_currentCreateId].Erase(iii);
|
m_subWidget[m_currentCreateId].erase(m_subWidget[m_currentCreateId].begin()+iii);
|
||||||
MarkToReedraw();
|
MarkToReedraw();
|
||||||
ewol::RequestUpdateSize();
|
ewol::RequestUpdateSize();
|
||||||
return;
|
return;
|
||||||
@ -185,10 +185,10 @@ void ewol::WSlider::SubWidgetUnLink(ewol::Widget* newWidget)
|
|||||||
if (NULL == newWidget) {
|
if (NULL == newWidget) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
for (int32_t iii=0; iii<m_subWidget[m_currentCreateId].Size(); iii++) {
|
for (int32_t iii=0; iii<m_subWidget[m_currentCreateId].size(); iii++) {
|
||||||
if (newWidget == m_subWidget[m_currentCreateId][iii]) {
|
if (newWidget == m_subWidget[m_currentCreateId][iii]) {
|
||||||
m_subWidget[m_currentCreateId][iii] = NULL;
|
m_subWidget[m_currentCreateId][iii] = NULL;
|
||||||
m_subWidget[m_currentCreateId].Erase(iii);
|
m_subWidget[m_currentCreateId].erase(m_subWidget[m_currentCreateId].begin()+iii);
|
||||||
ewol::RequestUpdateSize();
|
ewol::RequestUpdateSize();
|
||||||
MarkToReedraw();
|
MarkToReedraw();
|
||||||
return;
|
return;
|
||||||
@ -198,7 +198,7 @@ void ewol::WSlider::SubWidgetUnLink(ewol::Widget* newWidget)
|
|||||||
|
|
||||||
void ewol::WSlider::SubWidgetSelectSet(int32_t id)
|
void ewol::WSlider::SubWidgetSelectSet(int32_t id)
|
||||||
{
|
{
|
||||||
if (id<0 || id > m_subWidget[m_currentCreateId].Size()) {
|
if (id<0 || id > m_subWidget[m_currentCreateId].size()) {
|
||||||
EWOL_ERROR("Can not change to a widget not present");
|
EWOL_ERROR("Can not change to a widget not present");
|
||||||
}
|
}
|
||||||
m_windowsDestination = id;
|
m_windowsDestination = id;
|
||||||
@ -232,7 +232,7 @@ void ewol::WSlider::OnDraw(DrawProperty& displayProp)
|
|||||||
if (m_windowsDestination == m_windowsSources) {
|
if (m_windowsDestination == m_windowsSources) {
|
||||||
//EWOL_DEBUG("Draw : " << m_windowsDestination);
|
//EWOL_DEBUG("Draw : " << m_windowsDestination);
|
||||||
int32_t iii = m_windowsDestination;
|
int32_t iii = m_windowsDestination;
|
||||||
if (iii<0 || iii > m_subWidget[m_currentDrawId].Size()) {
|
if (iii<0 || iii > m_subWidget[m_currentDrawId].size()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (NULL != m_subWidget[m_currentDrawId][iii]) {
|
if (NULL != m_subWidget[m_currentDrawId][iii]) {
|
||||||
@ -242,7 +242,7 @@ void ewol::WSlider::OnDraw(DrawProperty& displayProp)
|
|||||||
//EWOL_DEBUG("Draw : " << m_windowsSources << "=>" << m_windowsDestination << "progress=" << ((float)m_slidingProgress/1000.) );
|
//EWOL_DEBUG("Draw : " << m_windowsSources << "=>" << m_windowsDestination << "progress=" << ((float)m_slidingProgress/1000.) );
|
||||||
// draw Sources :
|
// draw Sources :
|
||||||
int32_t iii = m_windowsSources;
|
int32_t iii = m_windowsSources;
|
||||||
if (iii<0 || iii > m_subWidget[m_currentDrawId].Size()) {
|
if (iii<0 || iii > m_subWidget[m_currentDrawId].size()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (NULL != m_subWidget[m_currentDrawId][iii]) {
|
if (NULL != m_subWidget[m_currentDrawId][iii]) {
|
||||||
@ -250,7 +250,7 @@ void ewol::WSlider::OnDraw(DrawProperty& displayProp)
|
|||||||
}
|
}
|
||||||
// Draw Destination :
|
// Draw Destination :
|
||||||
iii = m_windowsDestination;
|
iii = m_windowsDestination;
|
||||||
if (iii<0 || iii > m_subWidget[m_currentDrawId].Size()) {
|
if (iii<0 || iii > m_subWidget[m_currentDrawId].size()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (NULL != m_subWidget[m_currentDrawId][iii]) {
|
if (NULL != m_subWidget[m_currentDrawId][iii]) {
|
||||||
@ -265,7 +265,7 @@ void ewol::WSlider::OnRegenerateDisplay(void)
|
|||||||
{
|
{
|
||||||
if (m_windowsDestination == m_windowsSources) {
|
if (m_windowsDestination == m_windowsSources) {
|
||||||
int32_t iii = m_windowsDestination;
|
int32_t iii = m_windowsDestination;
|
||||||
if (iii<0 || iii > m_subWidget[m_currentCreateId].Size()) {
|
if (iii<0 || iii > m_subWidget[m_currentCreateId].size()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (NULL != m_subWidget[m_currentCreateId][iii]) {
|
if (NULL != m_subWidget[m_currentCreateId][iii]) {
|
||||||
@ -273,14 +273,14 @@ void ewol::WSlider::OnRegenerateDisplay(void)
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
int32_t iii = m_windowsSources;
|
int32_t iii = m_windowsSources;
|
||||||
if (iii<0 || iii > m_subWidget[m_currentCreateId].Size()) {
|
if (iii<0 || iii > m_subWidget[m_currentCreateId].size()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (NULL != m_subWidget[m_currentCreateId][iii]) {
|
if (NULL != m_subWidget[m_currentCreateId][iii]) {
|
||||||
m_subWidget[m_currentCreateId][iii]->OnRegenerateDisplay();
|
m_subWidget[m_currentCreateId][iii]->OnRegenerateDisplay();
|
||||||
}
|
}
|
||||||
iii = m_windowsDestination;
|
iii = m_windowsDestination;
|
||||||
if (iii<0 || iii > m_subWidget[m_currentCreateId].Size()) {
|
if (iii<0 || iii > m_subWidget[m_currentCreateId].size()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (NULL != m_subWidget[m_currentCreateId][iii]) {
|
if (NULL != m_subWidget[m_currentCreateId][iii]) {
|
||||||
@ -299,7 +299,7 @@ void ewol::WSlider::OnRegenerateDisplay(void)
|
|||||||
ewol::Widget * ewol::WSlider::GetWidgetAtPos(Vector2D<float> pos)
|
ewol::Widget * ewol::WSlider::GetWidgetAtPos(Vector2D<float> pos)
|
||||||
{
|
{
|
||||||
// TODO : Review this ...
|
// TODO : Review this ...
|
||||||
if (m_windowsDestination<0 || m_windowsDestination > m_subWidget[m_currentCreateId].Size()) {
|
if (m_windowsDestination<0 || m_windowsDestination > m_subWidget[m_currentCreateId].size()) {
|
||||||
// error ...
|
// error ...
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@ -336,7 +336,7 @@ void ewol::WSlider::OnFlipFlopEvent(void)
|
|||||||
if (true == needFlipFlop) {
|
if (true == needFlipFlop) {
|
||||||
m_subWidget[m_currentCreateId] = m_subWidget[m_currentDrawId];
|
m_subWidget[m_currentCreateId] = m_subWidget[m_currentDrawId];
|
||||||
}
|
}
|
||||||
if (m_windowsDestination<0 || m_windowsDestination > m_subWidget[m_currentDrawId].Size()) {
|
if (m_windowsDestination<0 || m_windowsDestination > m_subWidget[m_currentDrawId].size()) {
|
||||||
// error ...
|
// error ...
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -357,11 +357,11 @@ void ewol::WSlider::OnObjectRemove(ewol::EObject * removeObject)
|
|||||||
// First step call parrent :
|
// First step call parrent :
|
||||||
ewol::Widget::OnObjectRemove(removeObject);
|
ewol::Widget::OnObjectRemove(removeObject);
|
||||||
// second step find if in all the elements ...
|
// second step find if in all the elements ...
|
||||||
for(int32_t iii=m_subWidget[m_currentCreateId].Size()-1; iii>=0; iii--) {
|
for(int32_t iii=m_subWidget[m_currentCreateId].size()-1; iii>=0; iii--) {
|
||||||
if(m_subWidget[m_currentCreateId][iii] == removeObject) {
|
if(m_subWidget[m_currentCreateId][iii] == removeObject) {
|
||||||
EWOL_DEBUG("Remove sizer sub Element [" << iii << "] ==> destroyed object");
|
EWOL_DEBUG("Remove sizer sub Element [" << iii << "] ==> destroyed object");
|
||||||
m_subWidget[m_currentCreateId][iii] = NULL;
|
m_subWidget[m_currentCreateId][iii] = NULL;
|
||||||
m_subWidget[m_currentCreateId].Erase(iii);
|
m_subWidget[m_currentCreateId].erase(m_subWidget[m_currentCreateId].begin()+iii);
|
||||||
m_needFlipFlop = true;
|
m_needFlipFlop = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -26,6 +26,7 @@
|
|||||||
#define __EWOL_W_SLIDER_H__
|
#define __EWOL_W_SLIDER_H__
|
||||||
|
|
||||||
#include <etk/Types.h>
|
#include <etk/Types.h>
|
||||||
|
#include <vector>
|
||||||
#include <ewol/Debug.h>
|
#include <ewol/Debug.h>
|
||||||
#include <ewol/Widget.h>
|
#include <ewol/Widget.h>
|
||||||
|
|
||||||
@ -53,7 +54,7 @@ namespace ewol {
|
|||||||
void LockExpendContamination(bool lockExpend=false);
|
void LockExpendContamination(bool lockExpend=false);
|
||||||
private:
|
private:
|
||||||
bool m_lockExpendContamination;
|
bool m_lockExpendContamination;
|
||||||
etk::VectorType<ewol::Widget*> m_subWidget[NB_BOUBLE_BUFFER];
|
std::vector<ewol::Widget*> m_subWidget[NB_BOUBLE_BUFFER];
|
||||||
int32_t m_windowsSources; // widget source viewed
|
int32_t m_windowsSources; // widget source viewed
|
||||||
int32_t m_windowsDestination; // widget destinated viewed
|
int32_t m_windowsDestination; // widget destinated viewed
|
||||||
int32_t m_slidingProgress; // ratio progression of a sliding
|
int32_t m_slidingProgress; // ratio progression of a sliding
|
||||||
@ -64,7 +65,7 @@ namespace ewol {
|
|||||||
virtual void SubWidgetUnLink(ewol::Widget* newWidget);
|
virtual void SubWidgetUnLink(ewol::Widget* newWidget);
|
||||||
void SubWidgetSelectSet(int32_t id);
|
void SubWidgetSelectSet(int32_t id);
|
||||||
int32_t SubWidgetSelectGet(void) { return (int32_t)m_slidingProgress; };
|
int32_t SubWidgetSelectGet(void) { return (int32_t)m_slidingProgress; };
|
||||||
int32_t SubWidgetNumber(void) { return m_subWidget[m_currentCreateId].Size(); };
|
int32_t SubWidgetNumber(void) { return m_subWidget[m_currentCreateId].size(); };
|
||||||
protected:
|
protected:
|
||||||
virtual void OnDraw(DrawProperty& displayProp);
|
virtual void OnDraw(DrawProperty& displayProp);
|
||||||
public:
|
public:
|
||||||
|
@ -311,10 +311,10 @@ void ewol::WidgetScrooled::AddOObject(ewol::OObject* newObject, int32_t pos)
|
|||||||
EWOL_ERROR("Try to add an empty object in the Widget generic display system");
|
EWOL_ERROR("Try to add an empty object in the Widget generic display system");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (pos < 0 || pos >= m_listOObject[m_currentCreateId].Size() ) {
|
if (pos < 0 || pos >= m_listOObject[m_currentCreateId].size() ) {
|
||||||
m_listOObject[m_currentCreateId].PushBack(newObject);
|
m_listOObject[m_currentCreateId].push_back(newObject);
|
||||||
} else {
|
} else {
|
||||||
m_listOObject[m_currentCreateId].Insert(pos, newObject);
|
m_listOObject[m_currentCreateId].insert(m_listOObject[m_currentCreateId].begin()+pos, newObject);
|
||||||
}
|
}
|
||||||
m_needFlipFlop = true;
|
m_needFlipFlop = true;
|
||||||
}
|
}
|
||||||
@ -322,16 +322,16 @@ void ewol::WidgetScrooled::AddOObject(ewol::OObject* newObject, int32_t pos)
|
|||||||
|
|
||||||
void ewol::WidgetScrooled::ClearOObjectList(void)
|
void ewol::WidgetScrooled::ClearOObjectList(void)
|
||||||
{
|
{
|
||||||
for (int32_t iii=0; iii<m_listOObject[m_currentCreateId].Size(); iii++) {
|
for (int32_t iii=0; iii<m_listOObject[m_currentCreateId].size(); iii++) {
|
||||||
delete(m_listOObject[m_currentCreateId][iii]);
|
delete(m_listOObject[m_currentCreateId][iii]);
|
||||||
m_listOObject[m_currentCreateId][iii] = NULL;
|
m_listOObject[m_currentCreateId][iii] = NULL;
|
||||||
}
|
}
|
||||||
m_listOObject[m_currentCreateId].Clear();
|
m_listOObject[m_currentCreateId].clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ewol::WidgetScrooled::OnDraw(DrawProperty& displayProp)
|
void ewol::WidgetScrooled::OnDraw(DrawProperty& displayProp)
|
||||||
{
|
{
|
||||||
for (int32_t iii=0; iii<m_listOObject[m_currentDrawId].Size(); iii++) {
|
for (int32_t iii=0; iii<m_listOObject[m_currentDrawId].size(); iii++) {
|
||||||
if (NULL != m_listOObject[m_currentDrawId][iii]) {
|
if (NULL != m_listOObject[m_currentDrawId][iii]) {
|
||||||
m_listOObject[m_currentDrawId][iii]->Draw();
|
m_listOObject[m_currentDrawId][iii]->Draw();
|
||||||
}
|
}
|
||||||
|
@ -26,6 +26,7 @@
|
|||||||
#define __EWOL_SCROLLED_WIDGET_H__
|
#define __EWOL_SCROLLED_WIDGET_H__
|
||||||
|
|
||||||
#include <etk/Types.h>
|
#include <etk/Types.h>
|
||||||
|
#include <vector>
|
||||||
#include <ewol/Debug.h>
|
#include <ewol/Debug.h>
|
||||||
#include <ewol/Widget.h>
|
#include <ewol/Widget.h>
|
||||||
|
|
||||||
@ -47,7 +48,7 @@ namespace ewol {
|
|||||||
class WidgetScrooled : public ewol::Widget
|
class WidgetScrooled : public ewol::Widget
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
etk::VectorType<ewol::OObject*> m_listOObject[NB_BOUBLE_BUFFER]; //!< generic element to display...
|
std::vector<ewol::OObject*> m_listOObject[NB_BOUBLE_BUFFER]; //!< generic element to display...
|
||||||
void AddOObject(ewol::OObject* newObject, int32_t pos=-1);
|
void AddOObject(ewol::OObject* newObject, int32_t pos=-1);
|
||||||
void ClearOObjectList(void);
|
void ClearOObjectList(void);
|
||||||
protected:
|
protected:
|
||||||
|
@ -28,8 +28,6 @@
|
|||||||
#include <ewol/widget/List.h>
|
#include <ewol/widget/List.h>
|
||||||
#include <ewol/widget/Spacer.h>
|
#include <ewol/widget/Spacer.h>
|
||||||
#include <ewol/WidgetManager.h>
|
#include <ewol/WidgetManager.h>
|
||||||
//#include <etk/Vector.h>
|
|
||||||
#include <etk/VectorType.h>
|
|
||||||
|
|
||||||
extern "C" {
|
extern "C" {
|
||||||
// file browsing ...
|
// file browsing ...
|
||||||
|
@ -29,8 +29,6 @@
|
|||||||
#include <ewol/widget/Spacer.h>
|
#include <ewol/widget/Spacer.h>
|
||||||
#include <ewol/widget/Image.h>
|
#include <ewol/widget/Image.h>
|
||||||
#include <ewol/WidgetManager.h>
|
#include <ewol/WidgetManager.h>
|
||||||
//#include <etk/Vector.h>
|
|
||||||
#include <etk/VectorType.h>
|
|
||||||
|
|
||||||
extern "C" {
|
extern "C" {
|
||||||
// file browsing ...
|
// file browsing ...
|
||||||
|
@ -29,7 +29,6 @@
|
|||||||
#include <ewol/widget/Spacer.h>
|
#include <ewol/widget/Spacer.h>
|
||||||
#include <ewol/widget/Image.h>
|
#include <ewol/widget/Image.h>
|
||||||
#include <ewol/WidgetManager.h>
|
#include <ewol/WidgetManager.h>
|
||||||
#include <etk/VectorType.h>
|
|
||||||
|
|
||||||
|
|
||||||
#include <ewol/ewol.h>
|
#include <ewol/ewol.h>
|
||||||
|
@ -58,11 +58,11 @@ ewol::ParameterList::~ParameterList(void)
|
|||||||
{
|
{
|
||||||
//clean all the object
|
//clean all the object
|
||||||
for (int32_t jjj=0; jjj<NB_BOUBLE_BUFFER; jjj++) {
|
for (int32_t jjj=0; jjj<NB_BOUBLE_BUFFER; jjj++) {
|
||||||
for (int32_t iii=0; iii<m_listOObject[jjj].Size(); iii++) {
|
for (int32_t iii=0; iii<m_listOObject[jjj].size(); iii++) {
|
||||||
delete(m_listOObject[jjj][iii]);
|
delete(m_listOObject[jjj][iii]);
|
||||||
m_listOObject[jjj][iii] = NULL;
|
m_listOObject[jjj][iii] = NULL;
|
||||||
}
|
}
|
||||||
m_listOObject[jjj].Clear();
|
m_listOObject[jjj].clear();
|
||||||
}
|
}
|
||||||
MenuClear();
|
MenuClear();
|
||||||
}
|
}
|
||||||
@ -88,10 +88,10 @@ void ewol::ParameterList::AddOObject(ewol::OObject* newObject, int32_t pos)
|
|||||||
EWOL_ERROR("Try to add an empty object in the Widget generic display system");
|
EWOL_ERROR("Try to add an empty object in the Widget generic display system");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (pos < 0 || pos >= m_listOObject[m_currentCreateId].Size() ) {
|
if (pos < 0 || pos >= m_listOObject[m_currentCreateId].size() ) {
|
||||||
m_listOObject[m_currentCreateId].PushBack(newObject);
|
m_listOObject[m_currentCreateId].push_back(newObject);
|
||||||
} else {
|
} else {
|
||||||
m_listOObject[m_currentCreateId].Insert(pos, newObject);
|
m_listOObject[m_currentCreateId].insert(m_listOObject[m_currentCreateId].begin()+pos, newObject);
|
||||||
}
|
}
|
||||||
m_needFlipFlop = true;
|
m_needFlipFlop = true;
|
||||||
}
|
}
|
||||||
@ -99,16 +99,16 @@ void ewol::ParameterList::AddOObject(ewol::OObject* newObject, int32_t pos)
|
|||||||
|
|
||||||
void ewol::ParameterList::ClearOObjectList(void)
|
void ewol::ParameterList::ClearOObjectList(void)
|
||||||
{
|
{
|
||||||
for (int32_t iii=0; iii<m_listOObject[m_currentCreateId].Size(); iii++) {
|
for (int32_t iii=0; iii<m_listOObject[m_currentCreateId].size(); iii++) {
|
||||||
delete(m_listOObject[m_currentCreateId][iii]);
|
delete(m_listOObject[m_currentCreateId][iii]);
|
||||||
m_listOObject[m_currentCreateId][iii] = NULL;
|
m_listOObject[m_currentCreateId][iii] = NULL;
|
||||||
}
|
}
|
||||||
m_listOObject[m_currentCreateId].Clear();
|
m_listOObject[m_currentCreateId].clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ewol::ParameterList::OnDraw(DrawProperty& displayProp)
|
void ewol::ParameterList::OnDraw(DrawProperty& displayProp)
|
||||||
{
|
{
|
||||||
for (int32_t iii=0; iii<m_listOObject[m_currentDrawId].Size(); iii++) {
|
for (int32_t iii=0; iii<m_listOObject[m_currentDrawId].size(); iii++) {
|
||||||
if (NULL != m_listOObject[m_currentDrawId][iii]) {
|
if (NULL != m_listOObject[m_currentDrawId][iii]) {
|
||||||
m_listOObject[m_currentDrawId][iii]->Draw();
|
m_listOObject[m_currentDrawId][iii]->Draw();
|
||||||
}
|
}
|
||||||
@ -145,13 +145,13 @@ void ewol::ParameterList::OnRegenerateDisplay(void)
|
|||||||
|
|
||||||
|
|
||||||
//uint32_t nbColomn = GetNuberOfColomn();
|
//uint32_t nbColomn = GetNuberOfColomn();
|
||||||
int32_t nbRaw = m_list.Size();
|
int32_t nbRaw = m_list.size();
|
||||||
// For the scrooling windows
|
// For the scrooling windows
|
||||||
m_maxSize.x = m_size.x;
|
m_maxSize.x = m_size.x;
|
||||||
m_maxSize.y = (minHeight + 2*m_paddingSizeY) * nbRaw;
|
m_maxSize.y = (minHeight + 2*m_paddingSizeY) * nbRaw;
|
||||||
|
|
||||||
|
|
||||||
etk::VectorType<int32_t> listSizeColomn;
|
std::vector<int32_t> listSizeColomn;
|
||||||
|
|
||||||
// set background color :
|
// set background color :
|
||||||
ewol::OObject2DColored * BGOObjects = new ewol::OObject2DColored();
|
ewol::OObject2DColored * BGOObjects = new ewol::OObject2DColored();
|
||||||
@ -231,7 +231,7 @@ bool ewol::ParameterList::OnEventInput(ewol::inputType_te type, int32_t IdInput,
|
|||||||
|
|
||||||
int32_t rawID = (relativePos.y+m_originScrooled.y) / (minHeight + 2*m_paddingSizeY);
|
int32_t rawID = (relativePos.y+m_originScrooled.y) / (minHeight + 2*m_paddingSizeY);
|
||||||
// generate an event on a rawId if the element request change and Select it ...
|
// generate an event on a rawId if the element request change and Select it ...
|
||||||
if (rawID >=0 && rawID<m_list.Size()) {
|
if (rawID >=0 && rawID<m_list.size()) {
|
||||||
if (m_list[rawID]!=NULL) {
|
if (m_list[rawID]!=NULL) {
|
||||||
if (m_list[rawID]->m_refId>=0) {
|
if (m_list[rawID]->m_refId>=0) {
|
||||||
GenerateEventId(ewolEventParameterListSelect, m_list[rawID]->m_refId);
|
GenerateEventId(ewolEventParameterListSelect, m_list[rawID]->m_refId);
|
||||||
@ -261,9 +261,9 @@ void ewol::ParameterList::MenuAdd(etk::UString& label, int32_t refId, etk::UStri
|
|||||||
{
|
{
|
||||||
ewol::elementPL* tmpEmement = new ewol::elementPL(label, refId, image, false);
|
ewol::elementPL* tmpEmement = new ewol::elementPL(label, refId, image, false);
|
||||||
if (NULL != tmpEmement) {
|
if (NULL != tmpEmement) {
|
||||||
m_list.PushBack(tmpEmement);
|
m_list.push_back(tmpEmement);
|
||||||
if (m_idSelected == -1 && label != "---" && refId>0) {
|
if (m_idSelected == -1 && label != "---" && refId>0) {
|
||||||
m_idSelected = m_list.Size()-1;
|
m_idSelected = m_list.size()-1;
|
||||||
}
|
}
|
||||||
MarkToReedraw();
|
MarkToReedraw();
|
||||||
}
|
}
|
||||||
@ -273,7 +273,7 @@ void ewol::ParameterList::MenuAddGroup(etk::UString& label)
|
|||||||
etk::UString image = "";
|
etk::UString image = "";
|
||||||
ewol::elementPL* tmpEmement = new ewol::elementPL(label, -1, image, true);
|
ewol::elementPL* tmpEmement = new ewol::elementPL(label, -1, image, true);
|
||||||
if (NULL != tmpEmement) {
|
if (NULL != tmpEmement) {
|
||||||
m_list.PushBack(tmpEmement);
|
m_list.push_back(tmpEmement);
|
||||||
MarkToReedraw();
|
MarkToReedraw();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -282,18 +282,18 @@ void ewol::ParameterList::MenuAddGroup(etk::UString& label)
|
|||||||
void ewol::ParameterList::MenuClear(void)
|
void ewol::ParameterList::MenuClear(void)
|
||||||
{
|
{
|
||||||
m_idSelected = -1;
|
m_idSelected = -1;
|
||||||
for (int32_t iii=0; iii<m_list.Size(); iii++) {
|
for (int32_t iii=0; iii<m_list.size(); iii++) {
|
||||||
if (NULL != m_list[iii]) {
|
if (NULL != m_list[iii]) {
|
||||||
delete(m_list[iii]);
|
delete(m_list[iii]);
|
||||||
m_list[iii] = NULL;
|
m_list[iii] = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
m_list.Clear();
|
m_list.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ewol::ParameterList::MenuSeparator(void)
|
void ewol::ParameterList::MenuSeparator(void)
|
||||||
{
|
{
|
||||||
if (m_list.Size()>0) {
|
if (m_list.size()>0) {
|
||||||
etk::UString label = "";
|
etk::UString label = "";
|
||||||
etk::UString image = "";
|
etk::UString image = "";
|
||||||
MenuAdd(label, -1, image);
|
MenuAdd(label, -1, image);
|
||||||
|
@ -55,7 +55,7 @@ namespace ewol {
|
|||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
int32_t m_idSelected;
|
int32_t m_idSelected;
|
||||||
etk::VectorType<ewol::elementPL *> m_list;
|
std::vector<ewol::elementPL *> m_list;
|
||||||
public:
|
public:
|
||||||
ParameterList(void);
|
ParameterList(void);
|
||||||
/**
|
/**
|
||||||
@ -70,7 +70,7 @@ namespace ewol {
|
|||||||
void SetLabel(etk::UString newLabel);
|
void SetLabel(etk::UString newLabel);
|
||||||
// Drawing capabilities ....
|
// Drawing capabilities ....
|
||||||
private:
|
private:
|
||||||
etk::VectorType<ewol::OObject*> m_listOObject[NB_BOUBLE_BUFFER]; //!< generic element to display...
|
std::vector<ewol::OObject*> m_listOObject[NB_BOUBLE_BUFFER]; //!< generic element to display...
|
||||||
public:
|
public:
|
||||||
void AddOObject(ewol::OObject* newObject, int32_t pos=-1);
|
void AddOObject(ewol::OObject* newObject, int32_t pos=-1);
|
||||||
void ClearOObjectList(void);
|
void ClearOObjectList(void);
|
||||||
|
@ -1 +1 @@
|
|||||||
Subproject commit efe22dc9a440905565ab653d942bba5aaca040f8
|
Subproject commit f15fc7bbad327fb793ba7ad6973a2aa091f71e5f
|
Loading…
x
Reference in New Issue
Block a user