[DEV] update to the etk normalisation
This commit is contained in:
parent
2fc47723f0
commit
db8f379e30
@ -7,6 +7,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#include <etk/types.h>
|
||||||
#include <appl/Buffer.h>
|
#include <appl/Buffer.h>
|
||||||
#include <appl/debug.h>
|
#include <appl/debug.h>
|
||||||
#include <ewol/context/clipBoard.h>
|
#include <ewol/context/clipBoard.h>
|
||||||
@ -19,14 +20,14 @@ const char* const appl::Buffer::eventSelectChange = "edn-select-change";
|
|||||||
const char* const appl::Buffer::eventChangeName = "edn-buffer-name-change";
|
const char* const appl::Buffer::eventChangeName = "edn-buffer-name-change";
|
||||||
|
|
||||||
appl::Buffer::Iterator& appl::Buffer::Iterator::operator++ (void) {
|
appl::Buffer::Iterator& appl::Buffer::Iterator::operator++ (void) {
|
||||||
m_value = etk::UChar::Null;
|
m_value = u32char::Null;
|
||||||
if (m_current < 0) {
|
if (m_current < 0) {
|
||||||
m_current = 0;
|
m_current = 0;
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
if (m_data != NULL) {
|
if (m_data != NULL) {
|
||||||
if (m_current < m_data->m_data.size() ) {
|
if (m_current < m_data->m_data.size() ) {
|
||||||
int8_t nbChar = etk::UChar::theoricUTF8Len(m_data->m_data[m_current]);
|
int8_t nbChar = utf8::theoricLen(m_data->m_data[m_current]);
|
||||||
if (nbChar != 0) {
|
if (nbChar != 0) {
|
||||||
m_current+=nbChar;
|
m_current+=nbChar;
|
||||||
} else {
|
} else {
|
||||||
@ -41,11 +42,11 @@ appl::Buffer::Iterator& appl::Buffer::Iterator::operator++ (void) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
appl::Buffer::Iterator& appl::Buffer::Iterator::operator-- (void) {
|
appl::Buffer::Iterator& appl::Buffer::Iterator::operator-- (void) {
|
||||||
m_value = etk::UChar::Null;
|
m_value = u32char::Null;
|
||||||
if (m_data != NULL) {
|
if (m_data != NULL) {
|
||||||
if (m_current > 0) {
|
if (m_current > 0) {
|
||||||
int32_t iii = -1;
|
int32_t iii = -1;
|
||||||
while( etk::UChar::theoricUTF8First(m_data->m_data[m_current+iii]) == false
|
while( utf8::theoricFirst(m_data->m_data[m_current+iii]) == false
|
||||||
&& iii >= -6
|
&& iii >= -6
|
||||||
&& m_current-iii>0) {
|
&& m_current-iii>0) {
|
||||||
--iii;
|
--iii;
|
||||||
@ -62,7 +63,7 @@ appl::Buffer::Iterator& appl::Buffer::Iterator::operator-- (void) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
char32_t appl::Buffer::Iterator::operator* (void) {
|
char32_t appl::Buffer::Iterator::operator* (void) {
|
||||||
if (m_value != etk::UChar::Null) {
|
if (m_value != u32char::Null) {
|
||||||
return m_value;
|
return m_value;
|
||||||
}
|
}
|
||||||
if (m_data == NULL) {
|
if (m_data == NULL) {
|
||||||
@ -77,12 +78,12 @@ char32_t appl::Buffer::Iterator::operator* (void) {
|
|||||||
char tmpVal[5];
|
char tmpVal[5];
|
||||||
memset(tmpVal, 0, sizeof(tmpVal));
|
memset(tmpVal, 0, sizeof(tmpVal));
|
||||||
tmpVal[0] = m_data->m_data[m_current];
|
tmpVal[0] = m_data->m_data[m_current];
|
||||||
int8_t nbChar = etk::UChar::theoricUTF8Len(tmpVal[0]);
|
int8_t nbChar = utf8::theoricLen(tmpVal[0]);
|
||||||
for (int32_t iii=1; iii<nbChar && m_current+iii<m_data->m_data.size(); ++iii) {
|
for (int32_t iii=1; iii<nbChar && m_current+iii<m_data->m_data.size(); ++iii) {
|
||||||
tmpVal[iii] = m_data->m_data[m_current+iii];
|
tmpVal[iii] = m_data->m_data[m_current+iii];
|
||||||
}
|
}
|
||||||
// transform ...
|
// transform ...
|
||||||
m_value = etk::setUtf8(tmpVal);
|
m_value = utf8::convertChar32(tmpVal);
|
||||||
return m_value;
|
return m_value;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -148,13 +149,8 @@ bool appl::Buffer::loadFile(const std::string& _name) {
|
|||||||
m_isModify = true;
|
m_isModify = true;
|
||||||
m_cursorPos = 0;
|
m_cursorPos = 0;
|
||||||
setHighlightType("");
|
setHighlightType("");
|
||||||
etk::FSNode file(m_fileName);
|
|
||||||
if (file.exist() == false) {
|
|
||||||
APPL_INFO("File doesn not exist !!! " << file);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
m_nbLines = 0;
|
m_nbLines = 0;
|
||||||
if (true == m_data.dumpFrom(file) ) {
|
if (m_data.dumpFrom(m_fileName) == true ) {
|
||||||
countNumberofLine();
|
countNumberofLine();
|
||||||
tryFindHighlightType();
|
tryFindHighlightType();
|
||||||
m_isModify = false;
|
m_isModify = false;
|
||||||
@ -174,9 +170,8 @@ void appl::Buffer::setFileName(const std::string& _name) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool appl::Buffer::storeFile(void) {
|
bool appl::Buffer::storeFile(void) {
|
||||||
etk::FSNode file(m_fileName);
|
if (m_data.dumpIn(m_fileName) == true) {
|
||||||
if (true == m_data.dumpIn(file) ) {
|
APPL_INFO("saving file : " << m_fileName);
|
||||||
APPL_INFO("saving file : " << file);
|
|
||||||
setModification(false);
|
setModification(false);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -201,7 +196,7 @@ void appl::Buffer::countNumberofLine(void) {
|
|||||||
for (Iterator it = begin();
|
for (Iterator it = begin();
|
||||||
(bool)it == true;
|
(bool)it == true;
|
||||||
++it) {
|
++it) {
|
||||||
if (*it == etk::UChar::Return) {
|
if (*it == u32char::Return) {
|
||||||
++m_nbLines;
|
++m_nbLines;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -210,7 +205,7 @@ void appl::Buffer::countNumberofLine(void) {
|
|||||||
|
|
||||||
appl::Buffer::Iterator appl::Buffer::getStartLine(const appl::Buffer::Iterator& _pos) {
|
appl::Buffer::Iterator appl::Buffer::getStartLine(const appl::Buffer::Iterator& _pos) {
|
||||||
appl::Buffer::Iterator startPos;
|
appl::Buffer::Iterator startPos;
|
||||||
if (false == searchBack(_pos, etk::UChar::Return, startPos)) {
|
if (false == searchBack(_pos, u32char::Return, startPos)) {
|
||||||
return begin();
|
return begin();
|
||||||
}
|
}
|
||||||
// note search will return the position of \n ==> the lione start just after ...
|
// note search will return the position of \n ==> the lione start just after ...
|
||||||
@ -219,7 +214,7 @@ appl::Buffer::Iterator appl::Buffer::getStartLine(const appl::Buffer::Iterator&
|
|||||||
|
|
||||||
appl::Buffer::Iterator appl::Buffer::getEndLine(const appl::Buffer::Iterator& _pos) {
|
appl::Buffer::Iterator appl::Buffer::getEndLine(const appl::Buffer::Iterator& _pos) {
|
||||||
appl::Buffer::Iterator endPos;
|
appl::Buffer::Iterator endPos;
|
||||||
if (false == search(_pos, etk::UChar::Return, endPos)) {
|
if (false == search(_pos, u32char::Return, endPos)) {
|
||||||
endPos = end();
|
endPos = end();
|
||||||
}
|
}
|
||||||
// Note the line end at the \n
|
// Note the line end at the \n
|
||||||
@ -429,16 +424,16 @@ bool appl::Buffer::getPosAround(const appl::Buffer::Iterator& _startPos,
|
|||||||
char32_t currentValue = *position(_startPos);
|
char32_t currentValue = *position(_startPos);
|
||||||
_beginPos = begin();
|
_beginPos = begin();
|
||||||
_endPos = end();
|
_endPos = end();
|
||||||
if ( currentValue == etk::UChar::Tabulation
|
if ( currentValue == u32char::Tabulation
|
||||||
|| currentValue == etk::UChar::Space) {
|
|| currentValue == u32char::Space) {
|
||||||
APPL_DEBUG("select spacer");
|
APPL_DEBUG("select spacer");
|
||||||
// Search back
|
// Search back
|
||||||
for (Iterator it = --position(_startPos);
|
for (Iterator it = --position(_startPos);
|
||||||
(bool)it == true;
|
(bool)it == true;
|
||||||
--it) {
|
--it) {
|
||||||
currentValue = *it;
|
currentValue = *it;
|
||||||
if ( currentValue != etk::UChar::Tabulation
|
if ( currentValue != u32char::Tabulation
|
||||||
&& currentValue != etk::UChar::Space) {
|
&& currentValue != u32char::Space) {
|
||||||
_beginPos = ++it;
|
_beginPos = ++it;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -448,14 +443,14 @@ bool appl::Buffer::getPosAround(const appl::Buffer::Iterator& _startPos,
|
|||||||
(bool)it == true;
|
(bool)it == true;
|
||||||
++it) {
|
++it) {
|
||||||
currentValue = *it;
|
currentValue = *it;
|
||||||
if ( currentValue != etk::UChar::Tabulation
|
if ( currentValue != u32char::Tabulation
|
||||||
&& currentValue != etk::UChar::Space) {
|
&& currentValue != u32char::Space) {
|
||||||
_endPos = it;
|
_endPos = it;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
} else if( etk::isSpecialChar(currentValue) == false
|
} else if( u32char::isSpecialChar(currentValue) == false
|
||||||
|| currentValue == '_') {
|
|| currentValue == '_') {
|
||||||
APPL_DEBUG("select normal Char");
|
APPL_DEBUG("select normal Char");
|
||||||
// Search back
|
// Search back
|
||||||
@ -464,7 +459,7 @@ bool appl::Buffer::getPosAround(const appl::Buffer::Iterator& _startPos,
|
|||||||
--it) {
|
--it) {
|
||||||
currentValue = *it;
|
currentValue = *it;
|
||||||
if ( currentValue != '_'
|
if ( currentValue != '_'
|
||||||
&& true == etk::isSpecialChar(currentValue)) {
|
&& u32char::isSpecialChar(currentValue) == true) {
|
||||||
_beginPos = ++it;
|
_beginPos = ++it;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -475,7 +470,7 @@ bool appl::Buffer::getPosAround(const appl::Buffer::Iterator& _startPos,
|
|||||||
++it) {
|
++it) {
|
||||||
currentValue = *it;
|
currentValue = *it;
|
||||||
if ( currentValue != '_'
|
if ( currentValue != '_'
|
||||||
&& true == etk::isSpecialChar(currentValue)) {
|
&& u32char::isSpecialChar(currentValue) == true) {
|
||||||
_endPos = it;
|
_endPos = it;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -528,21 +523,21 @@ static const char *ControlCodeTable[32] = {
|
|||||||
void appl::Buffer::expand(int32_t& _indent, const char32_t& _value, std::u32string& _out) const {
|
void appl::Buffer::expand(int32_t& _indent, const char32_t& _value, std::u32string& _out) const {
|
||||||
_out.clear();
|
_out.clear();
|
||||||
int32_t tabDist = 4;
|
int32_t tabDist = 4;
|
||||||
if (_value == etk::UChar::Tabulation) {
|
if (_value == u32char::Tabulation) {
|
||||||
int32_t nSpaces = tabDist - (_indent % tabDist);
|
int32_t nSpaces = tabDist - (_indent % tabDist);
|
||||||
for (int32_t iii=0; iii<nSpaces; iii++) {
|
for (int32_t iii=0; iii<nSpaces; iii++) {
|
||||||
_out += etk::UChar::Space;
|
_out += u32char::Space;
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// convert ASCII control codes to readable character sequences
|
// convert ASCII control codes to readable character sequences
|
||||||
if (_value == etk::UChar::Null) {
|
if (_value == u32char::Null) {
|
||||||
_out += U"<nul>";
|
_out += U"<nul>";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (_value == etk::UChar::Return) {
|
if (_value == u32char::Return) {
|
||||||
// nothing to display...
|
// nothing to display...
|
||||||
_out += etk::UChar::Return;
|
_out += u32char::Return;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (_value <= 31) {
|
if (_value <= 31) {
|
||||||
@ -555,7 +550,7 @@ void appl::Buffer::expand(int32_t& _indent, const char32_t& _value, std::u32stri
|
|||||||
_out += '>';
|
_out += '>';
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (_value == etk::UChar::Delete) {
|
if (_value == u32char::Delete) {
|
||||||
_out += U"<del>";
|
_out += U"<del>";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -572,7 +567,7 @@ appl::Buffer::Iterator appl::Buffer::countForwardNLines(const appl::Buffer::Iter
|
|||||||
(bool)it == true;
|
(bool)it == true;
|
||||||
++it) {
|
++it) {
|
||||||
value = *it;
|
value = *it;
|
||||||
if (value == etk::UChar::Return) {
|
if (value == u32char::Return) {
|
||||||
lineCount++;
|
lineCount++;
|
||||||
if (lineCount == _nLines) {
|
if (lineCount == _nLines) {
|
||||||
//APPL_INFO(" == > (1) at position=" << myPosIt.Position()+1 );
|
//APPL_INFO(" == > (1) at position=" << myPosIt.Position()+1 );
|
||||||
@ -592,7 +587,7 @@ appl::Buffer::Iterator appl::Buffer::countBackwardNLines(const appl::Buffer::Ite
|
|||||||
(bool)it == true;
|
(bool)it == true;
|
||||||
--it) {
|
--it) {
|
||||||
value = *it;
|
value = *it;
|
||||||
if (value == etk::UChar::Return) {
|
if (value == u32char::Return) {
|
||||||
lineCount++;
|
lineCount++;
|
||||||
if (lineCount >= _nLines) {
|
if (lineCount >= _nLines) {
|
||||||
//APPL_INFO(" == > (1) at position=" << myPosIt.Position()+1 );
|
//APPL_INFO(" == > (1) at position=" << myPosIt.Position()+1 );
|
||||||
@ -987,7 +982,7 @@ uint32_t appl::Buffer::getCursorLinesId(void) {
|
|||||||
for (Iterator it = begin();
|
for (Iterator it = begin();
|
||||||
(bool)it == true && it <= cursor();
|
(bool)it == true && it <= cursor();
|
||||||
++it) {
|
++it) {
|
||||||
if (*it == etk::UChar::Return) {
|
if (*it == u32char::Return) {
|
||||||
++line;
|
++line;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -9,9 +9,8 @@
|
|||||||
#ifndef __APPL_BUFFER_H__
|
#ifndef __APPL_BUFFER_H__
|
||||||
#define __APPL_BUFFER_H__
|
#define __APPL_BUFFER_H__
|
||||||
|
|
||||||
#include <etk/UString.h>
|
#include <etk/types.h>
|
||||||
#include <etk/os/FSNode.h>
|
#include <etk/os/FSNode.h>
|
||||||
#include <etk/unicode.h>
|
|
||||||
#include <ewol/ewol.h>
|
#include <ewol/ewol.h>
|
||||||
#include <etk/Buffer.h>
|
#include <etk/Buffer.h>
|
||||||
#include <ewol/object/Object.h>
|
#include <ewol/object/Object.h>
|
||||||
@ -42,7 +41,7 @@ namespace appl {
|
|||||||
Iterator(void):
|
Iterator(void):
|
||||||
m_current(0),
|
m_current(0),
|
||||||
m_data(NULL),
|
m_data(NULL),
|
||||||
m_value(etk::UChar::Null) {
|
m_value(u32char::Null) {
|
||||||
// nothing to do ...
|
// nothing to do ...
|
||||||
};
|
};
|
||||||
/**
|
/**
|
||||||
@ -52,7 +51,7 @@ namespace appl {
|
|||||||
Iterator(const Iterator & _obj):
|
Iterator(const Iterator & _obj):
|
||||||
m_current(_obj.m_current),
|
m_current(_obj.m_current),
|
||||||
m_data(_obj.m_data),
|
m_data(_obj.m_data),
|
||||||
m_value(etk::UChar::Null) {
|
m_value(u32char::Null) {
|
||||||
// nothing to do ...
|
// nothing to do ...
|
||||||
};
|
};
|
||||||
/**
|
/**
|
||||||
@ -63,7 +62,7 @@ namespace appl {
|
|||||||
Iterator& operator=(const Iterator & _obj) {
|
Iterator& operator=(const Iterator & _obj) {
|
||||||
m_current = _obj.m_current;
|
m_current = _obj.m_current;
|
||||||
m_data = _obj.m_data;
|
m_data = _obj.m_data;
|
||||||
m_value = etk::UChar::Null;
|
m_value = u32char::Null;
|
||||||
return *this;
|
return *this;
|
||||||
};
|
};
|
||||||
/**
|
/**
|
||||||
@ -72,7 +71,7 @@ namespace appl {
|
|||||||
~Iterator(void) {
|
~Iterator(void) {
|
||||||
m_current = 0;
|
m_current = 0;
|
||||||
m_data = NULL;
|
m_data = NULL;
|
||||||
m_value = etk::UChar::Null;
|
m_value = u32char::Null;
|
||||||
};
|
};
|
||||||
/**
|
/**
|
||||||
* @brief basic boolean cast
|
* @brief basic boolean cast
|
||||||
@ -283,7 +282,7 @@ namespace appl {
|
|||||||
Iterator(Buffer* _obj, int64_t _pos) :
|
Iterator(Buffer* _obj, int64_t _pos) :
|
||||||
m_current(_pos),
|
m_current(_pos),
|
||||||
m_data(_obj),
|
m_data(_obj),
|
||||||
m_value(etk::UChar::Null) {
|
m_value(u32char::Null) {
|
||||||
// nothing to do ...
|
// nothing to do ...
|
||||||
};
|
};
|
||||||
friend class Buffer;
|
friend class Buffer;
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
#include <appl/debug.h>
|
#include <appl/debug.h>
|
||||||
#include <appl/global.h>
|
#include <appl/global.h>
|
||||||
#include <appl/BufferManager.h>
|
#include <appl/BufferManager.h>
|
||||||
#include <etk/UString.h>
|
#include <etk/types.h>
|
||||||
#include <ewol/object/Object.h>
|
#include <ewol/object/Object.h>
|
||||||
#include <ewol/object/Manager.h>
|
#include <ewol/object/Manager.h>
|
||||||
#include <ewol/resource/Manager.h>
|
#include <ewol/resource/Manager.h>
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
#define __GLYPH_DECORATION_H__
|
#define __GLYPH_DECORATION_H__
|
||||||
|
|
||||||
#include <etk/Color.h>
|
#include <etk/Color.h>
|
||||||
#include <etk/UString.h>
|
#include <etk/types.h>
|
||||||
|
|
||||||
namespace appl {
|
namespace appl {
|
||||||
class GlyphDecoration {
|
class GlyphDecoration {
|
||||||
|
@ -89,7 +89,7 @@ void BufferView::insertAlphabetic(appl::dataBufferStruct* _dataStruct, bool _sel
|
|||||||
if (m_list[iii] == NULL) {
|
if (m_list[iii] == NULL) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (to_lower(m_list[iii]->m_bufferName.getNameFile()) > to_lower(_dataStruct->m_bufferName.getNameFile())) {
|
if (std::tolower(m_list[iii]->m_bufferName.getNameFile()) > std::tolower(_dataStruct->m_bufferName.getNameFile())) {
|
||||||
m_list.insert(m_list.begin() + iii, _dataStruct);
|
m_list.insert(m_list.begin() + iii, _dataStruct);
|
||||||
_dataStruct = NULL;
|
_dataStruct = NULL;
|
||||||
if (_selectNewPosition == true) {
|
if (_selectNewPosition == true) {
|
||||||
|
@ -386,10 +386,10 @@ void MainWindows::onReceiveMessage(const ewol::object::Message& _msg) {
|
|||||||
m_bufferManager->open(_msg.getData());
|
m_bufferManager->open(_msg.getData());
|
||||||
} else if (_msg.getMessage() == ednMsgGuiSave) {
|
} else if (_msg.getMessage() == ednMsgGuiSave) {
|
||||||
APPL_DEBUG("Request saving the file : " << _msg.getData());
|
APPL_DEBUG("Request saving the file : " << _msg.getData());
|
||||||
if (to_lower(_msg.getData()) == "current") {
|
if (std::tolower(_msg.getData()) == "current") {
|
||||||
appl::WorkerSaveFile* tmpWorker = new appl::WorkerSaveFile("", false);
|
appl::WorkerSaveFile* tmpWorker = new appl::WorkerSaveFile("", false);
|
||||||
return;
|
return;
|
||||||
} else if (to_lower(_msg.getData()) == "all") {
|
} else if (std::tolower(_msg.getData()) == "all") {
|
||||||
appl::WorkerSaveAllFile* tmpWorker = new appl::WorkerSaveAllFile();
|
appl::WorkerSaveAllFile* tmpWorker = new appl::WorkerSaveAllFile();
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
|
@ -136,11 +136,11 @@ void Search::onReceiveMessage(const ewol::object::Message& _msg) {
|
|||||||
replace();
|
replace();
|
||||||
find();
|
find();
|
||||||
} else if ( _msg.getMessage() == l_eventCaseCb) {
|
} else if ( _msg.getMessage() == l_eventCaseCb) {
|
||||||
m_caseSensitive = stobool(_msg.getData());
|
m_caseSensitive = std::stob(_msg.getData());
|
||||||
} else if ( _msg.getMessage() == l_eventWrapCb) {
|
} else if ( _msg.getMessage() == l_eventWrapCb) {
|
||||||
m_wrap = stobool(_msg.getData());
|
m_wrap = std::stob(_msg.getData());
|
||||||
} else if ( _msg.getMessage() == l_eventForwardCb) {
|
} else if ( _msg.getMessage() == l_eventForwardCb) {
|
||||||
m_forward = stobool(_msg.getData());
|
m_forward = std::stob(_msg.getData());
|
||||||
} else if ( _msg.getMessage() == l_eventHideBt) {
|
} else if ( _msg.getMessage() == l_eventHideBt) {
|
||||||
hide();
|
hide();
|
||||||
} else if ( _msg.getMessage() == ednMsgGuiSearch) {
|
} else if ( _msg.getMessage() == ednMsgGuiSearch) {
|
||||||
|
@ -146,7 +146,7 @@ void appl::TextViewer::onRegenerateDisplay(void) {
|
|||||||
for (startingIt = m_buffer->begin();
|
for (startingIt = m_buffer->begin();
|
||||||
(bool)startingIt == true;
|
(bool)startingIt == true;
|
||||||
++startingIt) {
|
++startingIt) {
|
||||||
if (*startingIt == etk::UChar::Return) {
|
if (*startingIt == u32char::Return) {
|
||||||
++startLineId;
|
++startLineId;
|
||||||
m_displayText.forceLineReturn();
|
m_displayText.forceLineReturn();
|
||||||
if (m_size.y() >= m_displayText.getPos().y()) {
|
if (m_size.y() >= m_displayText.getPos().y()) {
|
||||||
@ -206,7 +206,7 @@ void appl::TextViewer::onRegenerateDisplay(void) {
|
|||||||
}
|
}
|
||||||
//APPL_DEBUG("display element '" << currentValue << "'at pos : " << m_displayText.getPos() );
|
//APPL_DEBUG("display element '" << currentValue << "'at pos : " << m_displayText.getPos() );
|
||||||
//APPL_DEBUG(" element size : " << iii << " : " << bufferElementSize);
|
//APPL_DEBUG(" element size : " << iii << " : " << bufferElementSize);
|
||||||
if (*it == etk::UChar::Return) {
|
if (*it == u32char::Return) {
|
||||||
countNbLine += 1;
|
countNbLine += 1;
|
||||||
countColomn = 0;
|
countColomn = 0;
|
||||||
maxSizeX = etk_max(m_displayText.getPos().x(), maxSizeX);
|
maxSizeX = etk_max(m_displayText.getPos().x(), maxSizeX);
|
||||||
@ -245,9 +245,9 @@ void appl::TextViewer::onRegenerateDisplay(void) {
|
|||||||
m_displayText.setColor((*m_paintingProperties)[m_colorNormal].getForeground());
|
m_displayText.setColor((*m_paintingProperties)[m_colorNormal].getForeground());
|
||||||
}
|
}
|
||||||
if (haveBackground == false) {
|
if (haveBackground == false) {
|
||||||
if (*it == etk::UChar::Space) {
|
if (*it == u32char::Space) {
|
||||||
m_displayText.setColorBg((*m_paintingProperties)[m_colorSpace].getForeground());
|
m_displayText.setColorBg((*m_paintingProperties)[m_colorSpace].getForeground());
|
||||||
} else if (*it == etk::UChar::Tabulation) {
|
} else if (*it == u32char::Tabulation) {
|
||||||
m_displayText.setColorBg((*m_paintingProperties)[m_colorTabulation].getForeground());
|
m_displayText.setColorBg((*m_paintingProperties)[m_colorTabulation].getForeground());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -317,11 +317,11 @@ bool appl::TextViewer::onEventEntry(const ewol::event::Entry& _event) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
char32_t localValue = _event.getChar();
|
char32_t localValue = _event.getChar();
|
||||||
if (localValue == etk::UChar::Return) {
|
if (localValue == u32char::Return) {
|
||||||
if (true == _event.getSpecialKey().getShift()) {
|
if (true == _event.getSpecialKey().getShift()) {
|
||||||
localValue = etk::UChar::CarrierReturn;
|
localValue = u32char::CarrierReturn;
|
||||||
}
|
}
|
||||||
} else if (localValue == etk::UChar::Suppress ) {
|
} else if (localValue == u32char::Suppress ) {
|
||||||
//APPL_INFO("keyEvent : <suppr> pos=" << m_cursorPos);
|
//APPL_INFO("keyEvent : <suppr> pos=" << m_cursorPos);
|
||||||
if (m_buffer->hasTextSelected()) {
|
if (m_buffer->hasTextSelected()) {
|
||||||
remove();
|
remove();
|
||||||
@ -332,7 +332,7 @@ bool appl::TextViewer::onEventEntry(const ewol::event::Entry& _event) {
|
|||||||
replace("", pos, posEnd);
|
replace("", pos, posEnd);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
} else if (localValue == etk::UChar::Delete) {
|
} else if (localValue == u32char::Delete) {
|
||||||
//APPL_INFO("keyEvent : <del> pos=" << m_cursorPos);
|
//APPL_INFO("keyEvent : <del> pos=" << m_cursorPos);
|
||||||
if (m_buffer->hasTextSelected()) {
|
if (m_buffer->hasTextSelected()) {
|
||||||
remove();
|
remove();
|
||||||
@ -347,7 +347,7 @@ bool appl::TextViewer::onEventEntry(const ewol::event::Entry& _event) {
|
|||||||
m_buffer->setSelectMode(false);
|
m_buffer->setSelectMode(false);
|
||||||
// normal adding char ...
|
// normal adding char ...
|
||||||
char output[5];
|
char output[5];
|
||||||
int32_t nbElement = etk::getUtf8(localValue, output);
|
int32_t nbElement = u32char::convertUtf8(localValue, output);
|
||||||
if ( m_buffer->hasTextSelected() == false
|
if ( m_buffer->hasTextSelected() == false
|
||||||
&& _event.getSpecialKey().getInsert() == true) {
|
&& _event.getSpecialKey().getInsert() == true) {
|
||||||
appl::Buffer::Iterator pos = m_buffer->cursor();
|
appl::Buffer::Iterator pos = m_buffer->cursor();
|
||||||
@ -560,14 +560,14 @@ appl::Buffer::Iterator appl::TextViewer::getMousePosition(const vec2& _relativeP
|
|||||||
(bool)it == true;
|
(bool)it == true;
|
||||||
++it) {
|
++it) {
|
||||||
currentValue = *it;
|
currentValue = *it;
|
||||||
if (currentValue == etk::UChar::Return) {
|
if (currentValue == u32char::Return) {
|
||||||
m_displayText.forceLineReturn();
|
m_displayText.forceLineReturn();
|
||||||
countColomn = 0;
|
countColomn = 0;
|
||||||
} else {
|
} else {
|
||||||
if (-_relativePos.y() >= positionCurentDisplay.y()) {
|
if (-_relativePos.y() >= positionCurentDisplay.y()) {
|
||||||
m_buffer->expand(countColomn, currentValue, stringToDisplay);
|
m_buffer->expand(countColomn, currentValue, stringToDisplay);
|
||||||
for (size_t kkk=0; kkk<stringToDisplay.size(); ++kkk) {
|
for (size_t kkk=0; kkk<stringToDisplay.size(); ++kkk) {
|
||||||
if (stringToDisplay[kkk] == etk::UChar::Return) {
|
if (stringToDisplay[kkk] == u32char::Return) {
|
||||||
m_displayText.forceLineReturn();
|
m_displayText.forceLineReturn();
|
||||||
countColomn = 0;
|
countColomn = 0;
|
||||||
} else {
|
} else {
|
||||||
@ -939,7 +939,7 @@ appl::Buffer::Iterator appl::TextViewer::getPosSize(const appl::Buffer::Iterator
|
|||||||
currentValue = *it;
|
currentValue = *it;
|
||||||
m_buffer->expand(countColomn, currentValue, stringToDisplay);
|
m_buffer->expand(countColomn, currentValue, stringToDisplay);
|
||||||
for (size_t kkk=0; kkk<stringToDisplay.size(); ++kkk) {
|
for (size_t kkk=0; kkk<stringToDisplay.size(); ++kkk) {
|
||||||
if (stringToDisplay[kkk] == etk::UChar::Return) {
|
if (stringToDisplay[kkk] == u32char::Return) {
|
||||||
return it;
|
return it;
|
||||||
} else {
|
} else {
|
||||||
m_displayText.print(stringToDisplay[kkk]);
|
m_displayText.print(stringToDisplay[kkk]);
|
||||||
@ -968,7 +968,7 @@ float appl::TextViewer::getScreenSize(const appl::Buffer::Iterator& _startLinePo
|
|||||||
//APPL_DEBUG("parse : " << currentValue);
|
//APPL_DEBUG("parse : " << currentValue);
|
||||||
m_buffer->expand(countColomn, currentValue, stringToDisplay);
|
m_buffer->expand(countColomn, currentValue, stringToDisplay);
|
||||||
for (size_t kkk=0; kkk<stringToDisplay.size(); ++kkk) {
|
for (size_t kkk=0; kkk<stringToDisplay.size(); ++kkk) {
|
||||||
if (stringToDisplay[kkk] == etk::UChar::Return) {
|
if (stringToDisplay[kkk] == u32char::Return) {
|
||||||
return m_displayText.getPos().x() + 2; // TODO : Add the +2 for the end of line ...
|
return m_displayText.getPos().x() + 2; // TODO : Add the +2 for the end of line ...
|
||||||
} else {
|
} else {
|
||||||
m_displayText.print(stringToDisplay[kkk]);
|
m_displayText.print(stringToDisplay[kkk]);
|
||||||
|
@ -83,7 +83,7 @@ namespace appl {
|
|||||||
bool replace(const std::string& _data, const appl::Buffer::Iterator& _pos, const appl::Buffer::Iterator& _posEnd);
|
bool replace(const std::string& _data, const appl::Buffer::Iterator& _pos, const appl::Buffer::Iterator& _posEnd);
|
||||||
bool replace(const std::string& _data);
|
bool replace(const std::string& _data);
|
||||||
bool replace(const std::u32string& _data) {
|
bool replace(const std::u32string& _data) {
|
||||||
return replace(to_u8string(_data));
|
return replace(std::to_string(_data));
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* @brief Remove selected data ...
|
* @brief Remove selected data ...
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
#define __HIGHLIGHT_MANAGER_H__
|
#define __HIGHLIGHT_MANAGER_H__
|
||||||
|
|
||||||
|
|
||||||
#include <etk/UString.h>
|
#include <etk/types.h>
|
||||||
#include <appl/globalMsg.h>
|
#include <appl/globalMsg.h>
|
||||||
#include <appl/Highlight.h>
|
#include <appl/Highlight.h>
|
||||||
#include <ewol/widget/Widget.h>
|
#include <ewol/widget/Widget.h>
|
||||||
|
@ -19,7 +19,7 @@ appl::HighlightPattern::HighlightPattern(appl::GlyphPainting*& _glyphPainting) :
|
|||||||
m_regExpStart(NULL),
|
m_regExpStart(NULL),
|
||||||
m_regExpStop(NULL),
|
m_regExpStop(NULL),
|
||||||
m_colorName(""),
|
m_colorName(""),
|
||||||
m_escapeChar(etk::UChar::Null),
|
m_escapeChar(u32char::Null),
|
||||||
m_multiline(false),
|
m_multiline(false),
|
||||||
m_level(0) {
|
m_level(0) {
|
||||||
m_regExpStart = new etk::RegExp<etk::Buffer>();
|
m_regExpStart = new etk::RegExp<etk::Buffer>();
|
||||||
@ -40,7 +40,7 @@ void appl::HighlightPattern::setPaternStart(std::string& _regExp) {
|
|||||||
if (m_regExpStart == NULL) {
|
if (m_regExpStart == NULL) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
m_regExpStart->setRegExp(_regExp);
|
m_regExpStart->compile(_regExp);
|
||||||
}
|
}
|
||||||
|
|
||||||
void appl::HighlightPattern::setPaternStop(std::string& _regExp) {
|
void appl::HighlightPattern::setPaternStop(std::string& _regExp) {
|
||||||
@ -51,7 +51,7 @@ void appl::HighlightPattern::setPaternStop(std::string& _regExp) {
|
|||||||
if (_regExp.size() != 0) {
|
if (_regExp.size() != 0) {
|
||||||
m_regExpStop = new etk::RegExp<etk::Buffer>();
|
m_regExpStop = new etk::RegExp<etk::Buffer>();
|
||||||
if (m_regExpStop != NULL) {
|
if (m_regExpStop != NULL) {
|
||||||
m_regExpStop->setRegExp(_regExp);
|
m_regExpStop->compile(_regExp);
|
||||||
} else {
|
} else {
|
||||||
APPL_ERROR("Allocation error");
|
APPL_ERROR("Allocation error");
|
||||||
}
|
}
|
||||||
@ -170,7 +170,7 @@ enum resultFind appl::HighlightPattern::find(int32_t _start,
|
|||||||
}
|
}
|
||||||
_resultat.beginStart = m_regExpStart->start();
|
_resultat.beginStart = m_regExpStart->start();
|
||||||
_resultat.beginStop = m_regExpStart->stop();
|
_resultat.beginStop = m_regExpStart->stop();
|
||||||
if (m_regExpStop->process(_buffer, _resultat.beginStop, _stop, m_escapeChar) == true) {
|
if (m_regExpStop->parse(_buffer, _resultat.beginStop, _stop, m_escapeChar) == true) {
|
||||||
_resultat.endStart = m_regExpStop->start();
|
_resultat.endStart = m_regExpStop->start();
|
||||||
_resultat.endStop = m_regExpStop->stop();
|
_resultat.endStop = m_regExpStop->stop();
|
||||||
return HLP_FIND_OK;
|
return HLP_FIND_OK;
|
||||||
|
@ -32,7 +32,7 @@ bool appl::TextPluginAutoIndent::onEventEntry(appl::TextViewer& _textDrawer,
|
|||||||
if (_event.getStatus() != ewol::key::statusDown) {
|
if (_event.getStatus() != ewol::key::statusDown) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (_event.getChar() != etk::UChar::Return) {
|
if (_event.getChar() != u32char::Return) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (_event.getSpecialKey().getShift() == true) {
|
if (_event.getSpecialKey().getShift() == true) {
|
||||||
@ -49,10 +49,10 @@ bool appl::TextPluginAutoIndent::onEventEntry(appl::TextViewer& _textDrawer,
|
|||||||
for (appl::Buffer::Iterator it = startLine;
|
for (appl::Buffer::Iterator it = startLine;
|
||||||
(bool)it == true;
|
(bool)it == true;
|
||||||
++it) {
|
++it) {
|
||||||
if (*it == etk::UChar::Space) {
|
if (*it == u32char::Space) {
|
||||||
data += etk::UChar::Space;
|
data += u32char::Space;
|
||||||
} else if(*it == etk::UChar::Tabulation) {
|
} else if(*it == u32char::Tabulation) {
|
||||||
data += etk::UChar::Tabulation;
|
data += u32char::Tabulation;
|
||||||
} else {
|
} else {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -31,7 +31,7 @@ bool appl::TextPluginMultiLineTab::onEventEntry(appl::TextViewer& _textDrawer,
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
char32_t localValue = _event.getChar();
|
char32_t localValue = _event.getChar();
|
||||||
if (localValue != etk::UChar::Tabulation) {
|
if (localValue != u32char::Tabulation) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (_textDrawer.hasTextSelected() == false) {
|
if (_textDrawer.hasTextSelected() == false) {
|
||||||
@ -51,18 +51,18 @@ bool appl::TextPluginMultiLineTab::onEventEntry(appl::TextViewer& _textDrawer,
|
|||||||
|
|
||||||
if (true == _event.getSpecialKey().getShift() ) {
|
if (true == _event.getSpecialKey().getShift() ) {
|
||||||
// un-indent
|
// un-indent
|
||||||
data.insert(0, 1, etk::UChar::Return);
|
data.insert(0, 1, u32char::Return);
|
||||||
for (int32_t iii=1; iii<data.size(); ++iii) {
|
for (int32_t iii=1; iii<data.size(); ++iii) {
|
||||||
if (data[iii-1] != etk::UChar::Return) {
|
if (data[iii-1] != u32char::Return) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if(data[iii] == etk::UChar::Tabulation) {
|
if(data[iii] == u32char::Tabulation) {
|
||||||
data.erase(iii, 1);
|
data.erase(iii, 1);
|
||||||
} else if(data[iii] == etk::UChar::Space) {
|
} else if(data[iii] == u32char::Space) {
|
||||||
for (int32_t jjj=0; jjj<m_tabDist && jjj+iii<data.size() ; jjj++) {
|
for (int32_t jjj=0; jjj<m_tabDist && jjj+iii<data.size() ; jjj++) {
|
||||||
if(data[iii] == etk::UChar::Space) {
|
if(data[iii] == u32char::Space) {
|
||||||
data.erase(iii, 1);
|
data.erase(iii, 1);
|
||||||
} else if(data[iii] == etk::UChar::Tabulation) {
|
} else if(data[iii] == u32char::Tabulation) {
|
||||||
data.erase(iii, 1);
|
data.erase(iii, 1);
|
||||||
break;
|
break;
|
||||||
} else {
|
} else {
|
||||||
@ -74,17 +74,17 @@ bool appl::TextPluginMultiLineTab::onEventEntry(appl::TextViewer& _textDrawer,
|
|||||||
data.erase(0, 1);
|
data.erase(0, 1);
|
||||||
} else {
|
} else {
|
||||||
// indent
|
// indent
|
||||||
data.insert(0, 1, etk::UChar::Return);
|
data.insert(0, 1, u32char::Return);
|
||||||
for (int32_t iii=1; iii<data.size(); iii++) {
|
for (int32_t iii=1; iii<data.size(); iii++) {
|
||||||
if (data[iii-1] != etk::UChar::Return) {
|
if (data[iii-1] != u32char::Return) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (true == _event.getSpecialKey().getCtrl() ) {
|
if (true == _event.getSpecialKey().getCtrl() ) {
|
||||||
data.insert(iii, 1, etk::UChar::Space);
|
data.insert(iii, 1, u32char::Space);
|
||||||
} else if (true == m_useTabs) {
|
} else if (true == m_useTabs) {
|
||||||
data.insert(iii, 1, etk::UChar::Tabulation);
|
data.insert(iii, 1, u32char::Tabulation);
|
||||||
} else {
|
} else {
|
||||||
data.insert(iii, m_tabDist, etk::UChar::Space);
|
data.insert(iii, m_tabDist, u32char::Space);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
data.erase(0, 1);
|
data.erase(0, 1);
|
||||||
|
@ -44,19 +44,19 @@ class myParamGlobal : public ewol::Object {
|
|||||||
bool onSetConfig(const ewol::object::Config& _conf) {
|
bool onSetConfig(const ewol::object::Config& _conf) {
|
||||||
// Not set the EObject node parameter (name == > not change ...)
|
// Not set the EObject node parameter (name == > not change ...)
|
||||||
if (_conf.getConfig() == configEOL) {
|
if (_conf.getConfig() == configEOL) {
|
||||||
m_displayEOL = stobool(_conf.getData());
|
m_displayEOL = std::stob(_conf.getData());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (_conf.getConfig() == configAutoIndent) {
|
if (_conf.getConfig() == configAutoIndent) {
|
||||||
m_AutoIndent = stobool(_conf.getData());
|
m_AutoIndent = std::stob(_conf.getData());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (_conf.getConfig() == configShowTabChar) {
|
if (_conf.getConfig() == configShowTabChar) {
|
||||||
m_displayTabChar = stobool(_conf.getData());
|
m_displayTabChar = std::stob(_conf.getData());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (_conf.getConfig() == configShowSpaceChar) {
|
if (_conf.getConfig() == configShowSpaceChar) {
|
||||||
m_displaySpaceChar = stobool(_conf.getData());
|
m_displaySpaceChar = std::stob(_conf.getData());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
@ -7,7 +7,6 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <etk/types.h>
|
#include <etk/types.h>
|
||||||
#include <etk/UString.h>
|
|
||||||
#include <ewol/ewol.h>
|
#include <ewol/ewol.h>
|
||||||
#include <ewol/object/Object.h>
|
#include <ewol/object/Object.h>
|
||||||
#include <ewol/widget/Manager.h>
|
#include <ewol/widget/Manager.h>
|
||||||
@ -28,9 +27,6 @@
|
|||||||
#include <appl/Gui/Search.h>
|
#include <appl/Gui/Search.h>
|
||||||
#include <appl/ctags/readtags.h>
|
#include <appl/ctags/readtags.h>
|
||||||
#include <appl/globalMsg.h>
|
#include <appl/globalMsg.h>
|
||||||
#include <vector>
|
|
||||||
#include <string>
|
|
||||||
#include <etk/unicode.h>
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Main of the program (This can be set in every case, but it is not used in Andoid...).
|
* @brief Main of the program (This can be set in every case, but it is not used in Andoid...).
|
||||||
@ -43,18 +39,6 @@ int main(int _argc, const char *_argv[]) {
|
|||||||
}
|
}
|
||||||
appl::BufferManager* bufferManager = NULL;
|
appl::BufferManager* bufferManager = NULL;
|
||||||
|
|
||||||
etk::CCout& operator <<(etk::CCout& _os, const std::u32string& _obj) {
|
|
||||||
std::vector<char32_t> tmpp;
|
|
||||||
for (size_t iii=0; iii<_obj.size(); ++iii) {
|
|
||||||
tmpp.push_back(_obj[iii]);
|
|
||||||
}
|
|
||||||
std::vector<char> output_UTF8;
|
|
||||||
unicode::convertUnicodeToUtf8(tmpp, output_UTF8);
|
|
||||||
output_UTF8.push_back('\0');
|
|
||||||
_os << &output_UTF8[0];
|
|
||||||
return _os;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief main application function initialisation
|
* @brief main application function initialisation
|
||||||
*/
|
*/
|
||||||
|
Loading…
x
Reference in New Issue
Block a user