Revert "STANDARD ==> remove vector type and replace with std::vector (done but sone assertion)" ==> bad idea
This reverts commit 4012d75279df3f5226373a9d33a1df1372db71d5.
This commit is contained in:
parent
7ee4747cc2
commit
a20f3e4063
@ -1 +0,0 @@
|
||||
APP_STL := stlport_static
|
@ -80,7 +80,7 @@ class classBufferManager: public ewol::EObject
|
||||
|
||||
private:
|
||||
|
||||
std::vector<Buffer*> listBuffer; //!< element List of the char Elements
|
||||
etk::VectorType<Buffer*> listBuffer; //!< element List of the char Elements
|
||||
|
||||
void RemoveAll(void); //!< remove all buffer
|
||||
int32_t m_idSelected;
|
||||
@ -125,7 +125,7 @@ classBufferManager::~classBufferManager(void)
|
||||
RemoveAll();
|
||||
// clear The list of Buffer
|
||||
APPL_INFO("~classBufferManager::listBuffer.Clear();");
|
||||
listBuffer.clear();
|
||||
listBuffer.Clear();
|
||||
APPL_INFO("~classBufferManager::delete(BufferNotExiste);");
|
||||
delete(BufferNotExiste);
|
||||
}
|
||||
@ -235,7 +235,7 @@ void classBufferManager::OnReceiveMessage(ewol::EObject * CallerObject, const ch
|
||||
}
|
||||
// try next buffer
|
||||
if (-1 == destBuffer) {
|
||||
for(int32_t ii=closeID+1; ii < listBuffer.size(); ii++) {
|
||||
for(int32_t ii=closeID+1; ii < listBuffer.Size(); ii++) {
|
||||
if (true == Exist(ii) ) {
|
||||
destBuffer = ii;
|
||||
break;
|
||||
@ -305,7 +305,7 @@ void classBufferManager::OnReceiveMessage(ewol::EObject * CallerObject, const ch
|
||||
void classBufferManager::RemoveAll(void)
|
||||
{
|
||||
int32_t i;
|
||||
for (i=0; i<listBuffer.size(); i++) {
|
||||
for (i=0; i<listBuffer.Size(); i++) {
|
||||
Remove(i);
|
||||
}
|
||||
SendMultiCast(ednMsgGuiClose, "All");
|
||||
@ -326,8 +326,8 @@ int32_t classBufferManager::Create(void)
|
||||
// allocate a new Buffer
|
||||
Buffer *myBuffer = new BufferText();
|
||||
// Add at the list of element
|
||||
listBuffer.push_back(myBuffer);
|
||||
int32_t basicID = listBuffer.size() - 1;
|
||||
listBuffer.PushBack(myBuffer);
|
||||
int32_t basicID = listBuffer.Size() - 1;
|
||||
return basicID;
|
||||
}
|
||||
|
||||
@ -348,8 +348,8 @@ int32_t classBufferManager::Open(etk::File &myFile)
|
||||
// allocate a new Buffer
|
||||
Buffer *myBuffer = new BufferText(myFile);
|
||||
// Add at the list of element
|
||||
listBuffer.push_back(myBuffer);
|
||||
return listBuffer.size() - 1;
|
||||
listBuffer.PushBack(myBuffer);
|
||||
return listBuffer.Size() - 1;
|
||||
} else {
|
||||
// the buffer already existed ==> we open it ...
|
||||
return GetId(myFile);
|
||||
@ -365,7 +365,7 @@ Buffer * classBufferManager::Get(int32_t BufferID)
|
||||
return BufferNotExiste;
|
||||
}
|
||||
// check if the Buffer existed
|
||||
if (BufferID < listBuffer.size()) {
|
||||
if (BufferID < listBuffer.Size()) {
|
||||
// check if the buffer already existed
|
||||
if (NULL != listBuffer[BufferID]) {
|
||||
return listBuffer[BufferID];
|
||||
@ -373,7 +373,7 @@ Buffer * classBufferManager::Get(int32_t BufferID)
|
||||
APPL_ERROR("non existing Buffer " << BufferID);
|
||||
}
|
||||
} else {
|
||||
APPL_ERROR("call an non existing Buffer number too hight : " << BufferID << " > " << listBuffer.size());
|
||||
APPL_ERROR("call an non existing Buffer number too hight : " << BufferID << " > " << listBuffer.Size());
|
||||
}
|
||||
return BufferNotExiste;
|
||||
}
|
||||
@ -385,7 +385,7 @@ bool classBufferManager::Exist(int32_t BufferID)
|
||||
return false;
|
||||
}
|
||||
// check if the Buffer existed
|
||||
if (BufferID < listBuffer.size()) {
|
||||
if (BufferID < listBuffer.Size()) {
|
||||
// check if the buffer already existed
|
||||
if (NULL != listBuffer[BufferID]) {
|
||||
return true;
|
||||
@ -408,7 +408,7 @@ int32_t classBufferManager::GetId(etk::File &myFile)
|
||||
{
|
||||
int32_t iii;
|
||||
// check if the Buffer existed
|
||||
for (iii=0; iii < listBuffer.size(); iii++) {
|
||||
for (iii=0; iii < listBuffer.Size(); iii++) {
|
||||
// check if the buffer already existed
|
||||
if (NULL != listBuffer[iii]) {
|
||||
if ( listBuffer[iii]->GetFileName() == myFile) {
|
||||
@ -423,7 +423,7 @@ int32_t classBufferManager::GetId(etk::File &myFile)
|
||||
// return the number of buffer (open in the past) if 5 buffer open and 4 close ==> return 5
|
||||
uint32_t classBufferManager::Size(void)
|
||||
{
|
||||
return listBuffer.size();
|
||||
return listBuffer.Size();
|
||||
}
|
||||
|
||||
// nb of opens file Now ...
|
||||
@ -431,7 +431,7 @@ uint32_t classBufferManager::SizeOpen(void)
|
||||
{
|
||||
uint32_t jjj = 0;
|
||||
// check if the Buffer existed
|
||||
for (int32_t iii=0; iii<listBuffer.size(); iii++) {
|
||||
for (int32_t iii=0; iii<listBuffer.Size(); iii++) {
|
||||
// check if the buffer already existed
|
||||
if (NULL != listBuffer[iii]) {
|
||||
jjj++;
|
||||
@ -454,7 +454,7 @@ bool classBufferManager::Remove(int32_t BufferID)
|
||||
return false;
|
||||
}
|
||||
// check if the Buffer existed
|
||||
if (BufferID < listBuffer.size()) {
|
||||
if (BufferID < listBuffer.Size()) {
|
||||
// check if the buffer already existed
|
||||
if (NULL != listBuffer[BufferID]) {
|
||||
// TODO : Check if it saved...
|
||||
@ -475,7 +475,7 @@ bool classBufferManager::Remove(int32_t BufferID)
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
APPL_INFO("call an non existing Buffer number too hight : " << BufferID << " > " << listBuffer.size());
|
||||
APPL_INFO("call an non existing Buffer number too hight : " << BufferID << " > " << listBuffer.Size());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@ -491,7 +491,7 @@ bool classBufferManager::Remove(int32_t BufferID)
|
||||
int32_t classBufferManager::WitchBuffer(int32_t iEmeElement)
|
||||
{
|
||||
int32_t i;
|
||||
for (i=0; i<listBuffer.size(); i++) {
|
||||
for (i=0; i<listBuffer.Size(); i++) {
|
||||
if (NULL != listBuffer[i]) {
|
||||
iEmeElement--;
|
||||
// find the element :
|
||||
|
@ -913,8 +913,8 @@ void BufferText::AddChar(uniChar_t unicodeData)
|
||||
bool haveSelectionActive = m_EdnBuf.GetSelectionPos(SelectionStart, SelectionEnd, SelectionIsRect, SelectionRectStart, SelectionRectEnd);
|
||||
if (unicodeData == 0x09) {
|
||||
if (false == haveSelectionActive) {
|
||||
std::vector<int8_t> tmpVect;
|
||||
tmpVect.push_back(0x09);
|
||||
etk::VectorType<int8_t> tmpVect;
|
||||
tmpVect.PushBack(0x09);
|
||||
m_EdnBuf.Insert(m_cursorPos, tmpVect);
|
||||
SetInsertPosition(m_cursorPos+1, true);
|
||||
} else {
|
||||
@ -922,10 +922,10 @@ void BufferText::AddChar(uniChar_t unicodeData)
|
||||
// count the number of line :
|
||||
int32_t nbSelectedLines = m_EdnBuf.CountLines(SelectionStart, SelectionEnd);
|
||||
if (0 == nbSelectedLines) {
|
||||
std::vector<int8_t> tmpVect;
|
||||
tmpVect.push_back(0x09);
|
||||
etk::VectorType<int8_t> tmpVect;
|
||||
tmpVect.PushBack(0x09);
|
||||
m_EdnBuf.ReplaceSelected(tmpVect);
|
||||
SetInsertPosition(SelectionStart+tmpVect.size(), true);
|
||||
SetInsertPosition(SelectionStart+tmpVect.Size(), true);
|
||||
} else {
|
||||
if (true == ewol::IsSetShift() ) {
|
||||
m_cursorPos = m_EdnBuf.UnIndent();
|
||||
@ -935,11 +935,11 @@ void BufferText::AddChar(uniChar_t unicodeData)
|
||||
}
|
||||
}
|
||||
} else if (unicodeData == '\n') {
|
||||
std::vector<int8_t> tmpVect;
|
||||
etk::VectorType<int8_t> tmpVect;
|
||||
if (true == ewol::IsSetShift()) {
|
||||
tmpVect.push_back('\r');
|
||||
tmpVect.PushBack('\r');
|
||||
} else {
|
||||
tmpVect.push_back('\n');
|
||||
tmpVect.PushBack('\n');
|
||||
// if Auto indent Enable ==> we get the start of the previous line and add it to tne new one
|
||||
if (true == globals::IsSetAutoIndent() ) {
|
||||
int32_t l_lineStart;
|
||||
@ -952,9 +952,9 @@ void BufferText::AddChar(uniChar_t unicodeData)
|
||||
// add same characters in the temporar buffer
|
||||
for (int32_t kk=l_lineStart; kk<m_cursorPos; kk++) {
|
||||
if (' ' == m_EdnBuf[kk]) {
|
||||
tmpVect.push_back(' ');
|
||||
tmpVect.PushBack(' ');
|
||||
} else if('\t' == m_EdnBuf[kk]) {
|
||||
tmpVect.push_back('\t');
|
||||
tmpVect.PushBack('\t');
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
@ -964,10 +964,10 @@ void BufferText::AddChar(uniChar_t unicodeData)
|
||||
// Set temporary buffer in the real buffer
|
||||
if (false == haveSelectionActive) {
|
||||
m_EdnBuf.Insert(m_cursorPos, tmpVect);
|
||||
SetInsertPosition(m_cursorPos+tmpVect.size(), true);
|
||||
SetInsertPosition(m_cursorPos+tmpVect.Size(), true);
|
||||
} else {
|
||||
m_EdnBuf.ReplaceSelected(tmpVect);
|
||||
SetInsertPosition(SelectionStart+tmpVect.size(), true);
|
||||
SetInsertPosition(SelectionStart+tmpVect.Size(), true);
|
||||
}
|
||||
} else if (unicodeData == 0x7F ) {
|
||||
//APPL_INFO("keyEvent : <Suppr> pos=" << m_cursorPos);
|
||||
@ -991,11 +991,9 @@ void BufferText::AddChar(uniChar_t unicodeData)
|
||||
if (true == m_EdnBuf.GetUTF8Mode()) {
|
||||
char tmpUTF8[16];
|
||||
unicode::convertUnicodeToUtf8(unicodeData, tmpUTF8);
|
||||
std::vector<int8_t> tmpVect;
|
||||
etk::VectorType<int8_t> tmpVect;
|
||||
int32_t localOfset = strlen(tmpUTF8);
|
||||
for (int32_t iii=0; iii<localOfset ; iii++) {
|
||||
tmpVect.push_back(tmpUTF8[iii]);
|
||||
}
|
||||
tmpVect.PushBack((int8_t*)tmpUTF8, localOfset);
|
||||
if (false == haveSelectionActive) {
|
||||
m_EdnBuf.Insert(m_cursorPos, tmpVect);
|
||||
SetInsertPosition(m_cursorPos+localOfset, true);
|
||||
@ -1008,8 +1006,8 @@ void BufferText::AddChar(uniChar_t unicodeData)
|
||||
char output_ISO;
|
||||
unicode::convertUnicodeToIso(m_EdnBuf.GetCharsetType(), unicodeData, output_ISO);
|
||||
//printf(" insert : \"%s\"==> 0x%08x=%d ", UTF8data, (unsigned int)output_ISO, (int)output_ISO);
|
||||
std::vector<int8_t> tmpVect;
|
||||
tmpVect.push_back(output_ISO);
|
||||
etk::VectorType<int8_t> tmpVect;
|
||||
tmpVect.PushBack(output_ISO);
|
||||
if (false == haveSelectionActive) {
|
||||
m_EdnBuf.Insert(m_cursorPos, tmpVect);
|
||||
SetInsertPosition(m_cursorPos+1, true);
|
||||
@ -1032,7 +1030,7 @@ int32_t BufferText::FindLine(etk::UString &data)
|
||||
return 0;
|
||||
}
|
||||
APPL_INFO("Search data line : \"" << data << "\"");
|
||||
std::vector<uniChar_t> mVectSearch;
|
||||
etk::VectorType<uniChar_t> mVectSearch;
|
||||
mVectSearch = data.GetVector();
|
||||
//APPL_INFO("search data Forward : startSearchPos=" << startSearchPos );
|
||||
/*
|
||||
|
@ -119,18 +119,18 @@ bool EdnBuf::DumpFrom(FILE *myFile)
|
||||
}
|
||||
|
||||
|
||||
void EdnBuf::GetAll(std::vector<int8_t> &text)
|
||||
void EdnBuf::GetAll(etk::VectorType<int8_t> &text)
|
||||
{
|
||||
// Clean output vector
|
||||
text.clear();
|
||||
text.Clear();
|
||||
// Set data on the vector
|
||||
m_data.Get(0, m_data.Size(), text);
|
||||
}
|
||||
|
||||
|
||||
void EdnBuf::SetAll(std::vector<int8_t> &text)
|
||||
void EdnBuf::SetAll(etk::VectorType<int8_t> &text)
|
||||
{
|
||||
std::vector<int8_t> deletedText;
|
||||
etk::VectorType<int8_t> deletedText;
|
||||
|
||||
// extract all data of the buffer :
|
||||
GetAll(deletedText);
|
||||
@ -142,16 +142,16 @@ void EdnBuf::SetAll(std::vector<int8_t> &text)
|
||||
m_data.Insert(0, text);
|
||||
|
||||
// Zero all of the existing selections
|
||||
UpdateSelection(0, deletedText.size(), 0);
|
||||
UpdateSelection(0, deletedText.Size(), 0);
|
||||
|
||||
// Call the modification Event Manager
|
||||
eventModification(0, m_data.Size(), deletedText);
|
||||
}
|
||||
|
||||
void EdnBuf::GetRange(int32_t start, int32_t end, std::vector<int8_t> &output)
|
||||
void EdnBuf::GetRange(int32_t start, int32_t end, etk::VectorType<int8_t> &output)
|
||||
{
|
||||
// Remove all data ...
|
||||
output.clear();
|
||||
output.Clear();
|
||||
// import data :
|
||||
m_data.Get(start, end-start, output);
|
||||
//APPL_DEBUG("request start=" << start << " end="<< end << " size="<< end-start << " result size=" << output.Size() );
|
||||
@ -162,14 +162,14 @@ void EdnBuf::GetRange(int32_t start, int32_t end, etk::UString &output)
|
||||
// Remove all data ...
|
||||
output = "";
|
||||
// import data :
|
||||
std::vector<int8_t> localOutput;
|
||||
etk::VectorType<int8_t> localOutput;
|
||||
m_data.Get(start, end-start, localOutput);
|
||||
// transcript in UNICODE ...
|
||||
if (true == m_isUtf8) {
|
||||
localOutput.push_back('\0');
|
||||
localOutput.PushBack('\0');
|
||||
output = (char*)&localOutput[0];
|
||||
} else {
|
||||
std::vector<uniChar_t> tmpUnicodeData;
|
||||
etk::VectorType<uniChar_t> tmpUnicodeData;
|
||||
// transform in unicode :
|
||||
convertIsoToUnicode(m_charsetType, localOutput, tmpUnicodeData);
|
||||
output = tmpUnicodeData;
|
||||
@ -202,7 +202,7 @@ int8_t EdnBuf::operator[] (int32_t pos)
|
||||
* @return ---
|
||||
*
|
||||
*/
|
||||
int32_t EdnBuf::Insert(int32_t pos, std::vector<int8_t> &insertText)
|
||||
int32_t EdnBuf::Insert(int32_t pos, etk::VectorType<int8_t> &insertText)
|
||||
{
|
||||
// if pos is not contiguous to existing text, make it
|
||||
pos = etk_avg(0, pos, m_data.Size() );
|
||||
@ -210,8 +210,8 @@ int32_t EdnBuf::Insert(int32_t pos, std::vector<int8_t> &insertText)
|
||||
int32_t sizeInsert=LocalInsert(pos, insertText);
|
||||
|
||||
// Call the redisplay ...
|
||||
std::vector<int8_t> deletedText;
|
||||
eventModification(pos, insertText.size(), deletedText);
|
||||
etk::VectorType<int8_t> deletedText;
|
||||
eventModification(pos, insertText.Size(), deletedText);
|
||||
return sizeInsert;
|
||||
}
|
||||
int32_t EdnBuf::Insert(int32_t pos, etk::UString &insertText)
|
||||
@ -222,7 +222,7 @@ int32_t EdnBuf::Insert(int32_t pos, etk::UString &insertText)
|
||||
int32_t sizeInsert=LocalInsert(pos, insertText);
|
||||
|
||||
// Call the redisplay ...
|
||||
std::vector<int8_t> deletedText;
|
||||
etk::VectorType<int8_t> deletedText;
|
||||
eventModification(pos, insertText.Size(), deletedText);
|
||||
return sizeInsert;
|
||||
}
|
||||
@ -237,17 +237,17 @@ int32_t EdnBuf::Insert(int32_t pos, etk::UString &insertText)
|
||||
* @return nb Octet inserted
|
||||
*
|
||||
*/
|
||||
int32_t EdnBuf::Replace(int32_t start, int32_t end, std::vector<int8_t> &insertText)
|
||||
int32_t EdnBuf::Replace(int32_t start, int32_t end, etk::VectorType<int8_t> &insertText)
|
||||
{
|
||||
if (end-start == 0) {
|
||||
return 0;
|
||||
}
|
||||
std::vector<int8_t> deletedText;
|
||||
etk::VectorType<int8_t> deletedText;
|
||||
GetRange(start, end, deletedText);
|
||||
m_data.Replace(start, end-start, insertText);
|
||||
// update internal elements
|
||||
eventModification(start, insertText.size(), deletedText);
|
||||
return insertText.size();
|
||||
eventModification(start, insertText.Size(), deletedText);
|
||||
return insertText.Size();
|
||||
}
|
||||
|
||||
int32_t EdnBuf::Replace(int32_t start, int32_t end, etk::UString &insertText)
|
||||
@ -255,32 +255,32 @@ int32_t EdnBuf::Replace(int32_t start, int32_t end, etk::UString &insertText)
|
||||
if (end-start == 0) {
|
||||
return 0;
|
||||
}
|
||||
std::vector<int8_t> deletedText;
|
||||
etk::VectorType<int8_t> deletedText;
|
||||
GetRange(start, end, deletedText);
|
||||
std::vector<int8_t> tmpInsertText;
|
||||
etk::VectorType<int8_t> tmpInsertText;
|
||||
if (true == m_isUtf8) {
|
||||
char * tmpPointer = insertText.Utf8Data();
|
||||
while (*tmpPointer != '\0') {
|
||||
tmpInsertText.push_back(*tmpPointer++);
|
||||
tmpInsertText.PushBack(*tmpPointer++);
|
||||
}
|
||||
} else {
|
||||
std::vector<unsigned int> tmppp = insertText.GetVector();
|
||||
etk::VectorType<unsigned int> tmppp = insertText.GetVector();
|
||||
convertUnicodeToIso(m_charsetType, tmppp, tmpInsertText);
|
||||
}
|
||||
if (tmpInsertText.size()>0) {
|
||||
if (tmpInsertText[tmpInsertText.size()-1] == '\0') {
|
||||
tmpInsertText.pop_back();
|
||||
if (tmpInsertText.Size()>0) {
|
||||
if (tmpInsertText[tmpInsertText.Size()-1] == '\0') {
|
||||
tmpInsertText.PopBack();
|
||||
}
|
||||
}
|
||||
if (tmpInsertText.size()>0) {
|
||||
if (tmpInsertText[tmpInsertText.size()-1] == '\0') {
|
||||
tmpInsertText.pop_back();
|
||||
if (tmpInsertText.Size()>0) {
|
||||
if (tmpInsertText[tmpInsertText.Size()-1] == '\0') {
|
||||
tmpInsertText.PopBack();
|
||||
}
|
||||
}
|
||||
m_data.Replace(start, end-start, tmpInsertText);
|
||||
// update internal elements
|
||||
eventModification(start, tmpInsertText.size(), deletedText);
|
||||
return tmpInsertText.size();
|
||||
eventModification(start, tmpInsertText.Size(), deletedText);
|
||||
return tmpInsertText.Size();
|
||||
}
|
||||
|
||||
|
||||
@ -296,7 +296,7 @@ int32_t EdnBuf::Replace(int32_t start, int32_t end, etk::UString &insertText)
|
||||
void EdnBuf::Remove(int32_t start, int32_t end)
|
||||
{
|
||||
|
||||
std::vector<int8_t> deletedText;
|
||||
etk::VectorType<int8_t> deletedText;
|
||||
// Make sure the arguments make sense
|
||||
if (start > end) {
|
||||
int32_t temp = start;
|
||||
@ -327,26 +327,26 @@ int32_t EdnBuf::Indent(void)
|
||||
// Get Range :
|
||||
int32_t l_start = StartOfLine(SelectionStart);
|
||||
int32_t l_end = EndOfLine(SelectionEnd);
|
||||
std::vector<int8_t> l_tmpData;
|
||||
etk::VectorType<int8_t> l_tmpData;
|
||||
GetRange(l_start, l_end, l_tmpData);
|
||||
|
||||
l_tmpData.insert(l_tmpData.begin(), '\n');
|
||||
for (int32_t i=1; i<l_tmpData.size(); i++) {
|
||||
l_tmpData.Insert(0, '\n');
|
||||
for (int32_t i=1; i<l_tmpData.Size(); i++) {
|
||||
if ('\n' == l_tmpData[i-1]) {
|
||||
if (true == m_useTabs) {
|
||||
l_tmpData.insert(l_tmpData.begin()+i, '\t');
|
||||
l_tmpData.Insert(i, '\t');
|
||||
} else {
|
||||
for (int32_t j=0; j<m_tabDist; j++) {
|
||||
l_tmpData.insert(l_tmpData.begin()+i, ' ');
|
||||
l_tmpData.Insert(i, ' ');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
l_tmpData.erase(l_tmpData.begin());
|
||||
l_tmpData.Erase(0);
|
||||
// Real replace of DATA :
|
||||
Replace(l_start, l_end, l_tmpData);
|
||||
// Set the new selection :
|
||||
l_end = l_start + l_tmpData.size();
|
||||
l_end = l_start + l_tmpData.Size();
|
||||
Select(l_start, l_end);
|
||||
// Return the position of the cursor
|
||||
return l_end;
|
||||
@ -366,20 +366,20 @@ int32_t EdnBuf::UnIndent(void)
|
||||
// Get Range :
|
||||
int32_t l_start = StartOfLine(SelectionStart);
|
||||
int32_t l_end = EndOfLine(SelectionEnd);
|
||||
std::vector<int8_t> l_tmpData;
|
||||
etk::VectorType<int8_t> l_tmpData;
|
||||
GetRange(l_start, l_end, l_tmpData);
|
||||
|
||||
l_tmpData.insert(l_tmpData.begin(), '\n');
|
||||
for (int32_t i=1; i<l_tmpData.size(); i++) {
|
||||
l_tmpData.Insert(0, '\n');
|
||||
for (int32_t i=1; i<l_tmpData.Size(); i++) {
|
||||
if ('\n' == l_tmpData[i-1]) {
|
||||
if('\t' == l_tmpData[i]) {
|
||||
l_tmpData.erase(l_tmpData.begin()+i);
|
||||
l_tmpData.Erase(i);
|
||||
} else if(' ' == l_tmpData[i]) {
|
||||
for (int32_t j=0; j<m_tabDist && j+i<l_tmpData.size() ; j++) {
|
||||
for (int32_t j=0; j<m_tabDist && j+i<l_tmpData.Size() ; j++) {
|
||||
if(' ' == l_tmpData[i]) {
|
||||
l_tmpData.erase(l_tmpData.begin()+i);
|
||||
l_tmpData.Erase(i);
|
||||
} else if('\t' == l_tmpData[i]) {
|
||||
l_tmpData.erase(l_tmpData.begin()+i);
|
||||
l_tmpData.Erase(i);
|
||||
break;
|
||||
} else {
|
||||
break;
|
||||
@ -388,11 +388,11 @@ int32_t EdnBuf::UnIndent(void)
|
||||
}
|
||||
}
|
||||
}
|
||||
l_tmpData.erase(l_tmpData.begin());
|
||||
l_tmpData.Erase(0);
|
||||
// Real replace of DATA :
|
||||
Replace(l_start, l_end, l_tmpData);
|
||||
// Set the new selection :
|
||||
l_end = l_start + l_tmpData.size();
|
||||
l_end = l_start + l_tmpData.Size();
|
||||
Select(l_start, l_end);
|
||||
// Return the position of the cursor
|
||||
return l_end;
|
||||
@ -408,7 +408,7 @@ int32_t EdnBuf::UnIndent(void)
|
||||
* @return ---
|
||||
*
|
||||
*/
|
||||
void EdnBuf::GetLineText(int32_t pos, std::vector<int8_t> &text)
|
||||
void EdnBuf::GetLineText(int32_t pos, etk::VectorType<int8_t> &text)
|
||||
{
|
||||
GetRange( StartOfLine(pos), EndOfLine(pos), text);
|
||||
}
|
||||
@ -841,12 +841,12 @@ int32_t EdnBuf::CountLines(int32_t startPos, int32_t endPos)
|
||||
* @return number of line found
|
||||
*
|
||||
*/
|
||||
int32_t EdnBuf::CountLines(std::vector<int8_t> &data)
|
||||
int32_t EdnBuf::CountLines(etk::VectorType<int8_t> &data)
|
||||
{
|
||||
std::vector<int8_t>::iterator myPosIt = data.begin();
|
||||
etk::VectorType<int8_t>::Iterator myPosIt = data.Begin();
|
||||
int32_t lineCount = 0;
|
||||
|
||||
while(myPosIt < data.end()) {
|
||||
while(myPosIt) {
|
||||
if ('\n' == *myPosIt) {
|
||||
lineCount++;
|
||||
}
|
||||
@ -987,20 +987,20 @@ bool EdnBuf::charMatch(char first, char second, bool caseSensitive)
|
||||
*/
|
||||
bool EdnBuf::SearchForward(int32_t startPos, etk::UString &search, int32_t *foundPos, int32_t *foundPosEnd, bool caseSensitive)
|
||||
{
|
||||
std::vector<int8_t> searchVect;
|
||||
etk::VectorType<int8_t> searchVect;
|
||||
if (true == m_isUtf8) {
|
||||
char * tmpPointer = search.Utf8Data();
|
||||
while (*tmpPointer != '\0') {
|
||||
searchVect.push_back(*tmpPointer++);
|
||||
searchVect.PushBack(*tmpPointer++);
|
||||
}
|
||||
} else {
|
||||
std::vector<unsigned int> tmppp = search.GetVector();
|
||||
etk::VectorType<unsigned int> tmppp = search.GetVector();
|
||||
convertUnicodeToIso(m_charsetType, tmppp, searchVect);
|
||||
}
|
||||
// remove the '\0' at the end of the string ...
|
||||
searchVect.pop_back();
|
||||
searchVect.PopBack();
|
||||
int32_t position;
|
||||
int32_t searchLen = searchVect.size();
|
||||
int32_t searchLen = searchVect.Size();
|
||||
int32_t dataLen = m_data.Size();
|
||||
char currentChar = '\0';
|
||||
APPL_INFO(" startPos=" << startPos << " searchLen=" << searchLen);
|
||||
@ -1018,7 +1018,7 @@ bool EdnBuf::SearchForward(int32_t startPos, etk::UString &search, int32_t *foun
|
||||
}
|
||||
if (true == found) {
|
||||
*foundPos = position;
|
||||
*foundPosEnd = position + searchVect.size();
|
||||
*foundPosEnd = position + searchVect.Size();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@ -1042,21 +1042,21 @@ bool EdnBuf::SearchForward(int32_t startPos, etk::UString &search, int32_t *foun
|
||||
*/
|
||||
bool EdnBuf::SearchBackward(int32_t startPos, etk::UString &search, int32_t *foundPos, int32_t *foundPosEnd, bool caseSensitive)
|
||||
{
|
||||
std::vector<int8_t> searchVect;
|
||||
etk::VectorType<int8_t> searchVect;
|
||||
if (true == m_isUtf8) {
|
||||
char * tmpPointer = search.Utf8Data();
|
||||
while (*tmpPointer != '\0') {
|
||||
searchVect.push_back(*tmpPointer++);
|
||||
searchVect.PushBack(*tmpPointer++);
|
||||
}
|
||||
} else {
|
||||
std::vector<unsigned int> tmppp = search.GetVector();
|
||||
etk::VectorType<unsigned int> tmppp = search.GetVector();
|
||||
convertUnicodeToIso(m_charsetType, tmppp, searchVect);
|
||||
}
|
||||
// remove the '\0' at the end of the string ...
|
||||
searchVect.pop_back();
|
||||
searchVect.PopBack();
|
||||
|
||||
int32_t position;
|
||||
int32_t searchLen = searchVect.size();
|
||||
int32_t searchLen = searchVect.Size();
|
||||
char currentChar = '\0';
|
||||
//APPL_INFO(" startPos=" << startPos << " searchLen=" << searchLen);
|
||||
for (position=startPos; position>=searchLen-1; position--) {
|
||||
@ -1073,7 +1073,7 @@ bool EdnBuf::SearchBackward(int32_t startPos, etk::UString &search, int32_t *fou
|
||||
}
|
||||
if (true == found) {
|
||||
*foundPos = position - (searchLen-1);
|
||||
*foundPosEnd = position + searchVect.size();
|
||||
*foundPosEnd = position + searchVect.Size();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@ -1181,30 +1181,30 @@ bool EdnBuf::SelectAround(int32_t startPos, int32_t &beginPos, int32_t &endPos)
|
||||
* @return number of element inserted.
|
||||
*
|
||||
*/
|
||||
int32_t EdnBuf::LocalInsert(int32_t pos, std::vector<int8_t> &insertText)
|
||||
int32_t EdnBuf::LocalInsert(int32_t pos, etk::VectorType<int8_t> &insertText)
|
||||
{
|
||||
// Insert data in buffer
|
||||
m_data.Insert(pos, insertText);
|
||||
// update the current selected area
|
||||
UpdateSelection(pos, 0, insertText.size() );
|
||||
UpdateSelection(pos, 0, insertText.Size() );
|
||||
// return the number of element inserted ...
|
||||
return insertText.size();
|
||||
return insertText.Size();
|
||||
}
|
||||
int32_t EdnBuf::LocalInsert(int32_t pos, etk::UString &insertText)
|
||||
{
|
||||
std::vector<int8_t> tmpInsertText;
|
||||
etk::VectorType<int8_t> tmpInsertText;
|
||||
if (true == m_isUtf8) {
|
||||
char * tmpPointer = insertText.Utf8Data();
|
||||
while (*tmpPointer != '\0') {
|
||||
tmpInsertText.push_back(*tmpPointer++);
|
||||
tmpInsertText.PushBack(*tmpPointer++);
|
||||
}
|
||||
} else {
|
||||
std::vector<unsigned int> tmppp = insertText.GetVector();
|
||||
etk::VectorType<unsigned int> tmppp = insertText.GetVector();
|
||||
convertUnicodeToIso(m_charsetType, tmppp, tmpInsertText);
|
||||
}
|
||||
if (tmpInsertText.size()>0) {
|
||||
if (tmpInsertText[tmpInsertText.size()-1] == '\0') {
|
||||
tmpInsertText.pop_back();
|
||||
if (tmpInsertText.Size()>0) {
|
||||
if (tmpInsertText[tmpInsertText.Size()-1] == '\0') {
|
||||
tmpInsertText.PopBack();
|
||||
}
|
||||
}
|
||||
return LocalInsert(pos, tmpInsertText);
|
||||
@ -1221,15 +1221,15 @@ int32_t EdnBuf::LocalInsert(int32_t pos, etk::UString &insertText)
|
||||
* @return ---
|
||||
*
|
||||
*/
|
||||
void EdnBuf::eventModification(int32_t pos, int32_t nInserted, std::vector<int8_t> &deletedText)
|
||||
void EdnBuf::eventModification(int32_t pos, int32_t nInserted, etk::VectorType<int8_t> &deletedText)
|
||||
{
|
||||
if( 0 == deletedText.size()
|
||||
if( 0 == deletedText.Size()
|
||||
&& 0 == nInserted)
|
||||
{
|
||||
// we do nothing ...
|
||||
//APPL_INFO("EdnBuf::eventModification(pos="<<pos<<", ... , nRestyled=" << nRestyled << ", deletedText=\"" << textDisplay << "\");");
|
||||
} else {
|
||||
APPL_INFO("(pos="<<pos<<", nDeleted="<<deletedText.size()<<", nInserted=" << nInserted << ", deletedText=\"xx???xx\");");
|
||||
APPL_INFO("(pos="<<pos<<", nDeleted="<<deletedText.Size()<<", nInserted=" << nInserted << ", deletedText=\"xx???xx\");");
|
||||
// update the number of lines :
|
||||
//CountNumberOfLines(); //==> not efficent methode ...
|
||||
// ==> better methode : just update the number of line added and removed ...
|
||||
@ -1239,24 +1239,24 @@ void EdnBuf::eventModification(int32_t pos, int32_t nInserted, std::vector<int8_
|
||||
if (false == m_isUndoProcessing) {
|
||||
// normal or Redo processing
|
||||
EdnBufHistory *exempleHistory = new EdnBufHistory(pos, nInserted, deletedText);
|
||||
m_historyUndo.push_back(exempleHistory);
|
||||
m_historyUndo.PushBack(exempleHistory);
|
||||
if (false == m_isRedoProcessing) {
|
||||
// remove all element in the redo system ...
|
||||
int32_t i;
|
||||
for (i=m_historyRedo.size()-1; i>=0; i--) {
|
||||
for (i=m_historyRedo.Size()-1; i>=0; i--) {
|
||||
if (NULL != m_historyRedo[i]) {
|
||||
delete(m_historyRedo[i]);
|
||||
}
|
||||
m_historyRedo.pop_back();
|
||||
m_historyRedo.PopBack();
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// undo processing ==> add element in Redo vector ...
|
||||
EdnBufHistory *exempleHistory = new EdnBufHistory(pos, nInserted, deletedText);
|
||||
m_historyRedo.push_back(exempleHistory);
|
||||
m_historyRedo.PushBack(exempleHistory);
|
||||
}
|
||||
// Regenerate the Highlight :
|
||||
RegenerateHighLightAt(pos, deletedText.size(), nInserted);
|
||||
RegenerateHighLightAt(pos, deletedText.Size(), nInserted);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -59,9 +59,9 @@ typedef struct {
|
||||
} selection;
|
||||
|
||||
typedef struct {
|
||||
std::vector<colorInformation_ts> HLData;
|
||||
int32_t posHLPass1;
|
||||
int32_t posHLPass2;
|
||||
etk::VectorType<colorInformation_ts> HLData;
|
||||
int32_t posHLPass1;
|
||||
int32_t posHLPass2;
|
||||
}displayHLData_ts;
|
||||
|
||||
|
||||
@ -74,24 +74,24 @@ class EdnBuf {
|
||||
// destructer
|
||||
~EdnBuf(void);
|
||||
// public function :
|
||||
void GetAll( std::vector<int8_t> &text);
|
||||
void SetAll( std::vector<int8_t> &text);
|
||||
void GetRange( int32_t start, int32_t end, std::vector<int8_t> &output);
|
||||
void GetAll( etk::VectorType<int8_t> &text);
|
||||
void SetAll( etk::VectorType<int8_t> &text);
|
||||
void GetRange( int32_t start, int32_t end, etk::VectorType<int8_t> &output);
|
||||
void GetRange( int32_t start, int32_t end, etk::UString &output);
|
||||
bool DumpIn( FILE *myFile);
|
||||
bool DumpFrom( FILE *myFile);
|
||||
// replace with operator [] ...
|
||||
int8_t operator[] (int32_t);
|
||||
int32_t Insert( int32_t pos, std::vector<int8_t> &insertText);
|
||||
int32_t Insert( int32_t pos, etk::VectorType<int8_t> &insertText);
|
||||
int32_t Insert( int32_t pos, etk::UString &insertText);
|
||||
int32_t Replace( int32_t start, int32_t end, std::vector<int8_t> &insertText);
|
||||
int32_t Replace( int32_t start, int32_t end, etk::VectorType<int8_t> &insertText);
|
||||
int32_t Replace( int32_t start, int32_t end, etk::UString &insertText);
|
||||
void Remove( int32_t start, int32_t end);
|
||||
int32_t Indent( void);
|
||||
int32_t UnIndent( void);
|
||||
|
||||
|
||||
void GetLineText( int32_t pos, std::vector<int8_t> &text);
|
||||
void GetLineText( int32_t pos, etk::VectorType<int8_t> &text);
|
||||
int32_t StartOfLine( int32_t pos);
|
||||
int32_t EndOfLine( int32_t pos);
|
||||
|
||||
@ -103,7 +103,7 @@ class EdnBuf {
|
||||
int32_t CountForwardDispChars( int32_t lineStartPos, int32_t nChars);
|
||||
int32_t CountLines( int32_t startPos, int32_t endPos);
|
||||
int32_t CountLines( void);
|
||||
int32_t CountLines( std::vector<int8_t> &data);
|
||||
int32_t CountLines( etk::VectorType<int8_t> &data);
|
||||
int32_t CountForwardNLines( int32_t startPos, int32_t nLines);
|
||||
int32_t CountBackwardNLines( int32_t startPos, int32_t nLines);
|
||||
|
||||
@ -126,10 +126,10 @@ class EdnBuf {
|
||||
void Unselect( void);
|
||||
void RectSelect( int32_t start, int32_t end, int32_t rectStart, int32_t rectEnd);
|
||||
bool GetSelectionPos( int32_t &start, int32_t &end, bool &isRect, int32_t &rectStart, int32_t &rectEnd);
|
||||
void GetSelectionText( std::vector<int8_t> &text);
|
||||
void GetSelectionText( etk::VectorType<int8_t> &text);
|
||||
void GetSelectionText( etk::UString &text);
|
||||
void RemoveSelected( void);
|
||||
int32_t ReplaceSelected( std::vector<int8_t> &text);
|
||||
int32_t ReplaceSelected( etk::VectorType<int8_t> &text);
|
||||
int32_t ReplaceSelected( etk::UString &text);
|
||||
private:
|
||||
// current selection of the buffer
|
||||
@ -140,20 +140,20 @@ class EdnBuf {
|
||||
// History section :
|
||||
// -----------------------------------------
|
||||
public:
|
||||
int32_t Undo(void);
|
||||
int32_t Redo(void);
|
||||
int32_t Undo(void);
|
||||
int32_t Redo(void);
|
||||
private:
|
||||
bool m_isUndoProcessing;
|
||||
bool m_isRedoProcessing;
|
||||
std::vector<EdnBufHistory*> m_historyUndo;
|
||||
std::vector<EdnBufHistory*> m_historyRedo;
|
||||
bool m_isUndoProcessing;
|
||||
bool m_isRedoProcessing;
|
||||
etk::VectorType<EdnBufHistory*> m_historyUndo;
|
||||
etk::VectorType<EdnBufHistory*> m_historyRedo;
|
||||
|
||||
// -----------------------------------------
|
||||
// hightlight section :
|
||||
// -----------------------------------------
|
||||
private:
|
||||
Highlight * m_Highlight; //!< internal link with the Highlight system
|
||||
std::vector<colorInformation_ts> m_HLDataPass1; //!< colorisation position in the current buffer pass 1
|
||||
etk::VectorType<colorInformation_ts> m_HLDataPass1; //!< colorisation position in the current buffer pass 1
|
||||
void RegenerateHighLightAt(int32_t pos, int32_t nbDeleted, int32_t nbAdded);
|
||||
void GenerateHighLightAt(int32_t pos, int32_t endPos, int32_t addinPos=0);
|
||||
void CleanHighLight(void);
|
||||
@ -197,10 +197,10 @@ class EdnBuf {
|
||||
void removeSelected( selection &sel);
|
||||
void replaceSelected( selection &sel, const char *text);
|
||||
|
||||
void eventModification( int32_t pos, int32_t nInserted, std::vector<int8_t> &deletedText);
|
||||
void eventModification( int32_t pos, int32_t nInserted, etk::VectorType<int8_t> &deletedText);
|
||||
|
||||
|
||||
int32_t LocalInsert( int32_t pos, std::vector<int8_t> &insertText);
|
||||
int32_t LocalInsert( int32_t pos, etk::VectorType<int8_t> &insertText);
|
||||
int32_t LocalInsert( int32_t pos, etk::UString &insertText);
|
||||
|
||||
bool charMatch( char first, char second, bool caseSensitive = true);
|
||||
|
@ -39,7 +39,7 @@ EdnBufHistory::EdnBufHistory(void)
|
||||
m_nInserted = 0;
|
||||
}
|
||||
|
||||
EdnBufHistory::EdnBufHistory(int32_t pos, int32_t nInserted, std::vector<int8_t> &deletedText)
|
||||
EdnBufHistory::EdnBufHistory(int32_t pos, int32_t nInserted, etk::VectorType<int8_t> &deletedText)
|
||||
{
|
||||
//APPL_INFO("EdnBufHistory new + data");
|
||||
m_pos = pos;
|
||||
@ -47,7 +47,7 @@ EdnBufHistory::EdnBufHistory(int32_t pos, int32_t nInserted, std::vector<int8_t>
|
||||
m_deletedText = deletedText;
|
||||
}
|
||||
|
||||
void EdnBufHistory::Set(int32_t pos, int32_t nInserted, std::vector<int8_t> &deletedText)
|
||||
void EdnBufHistory::Set(int32_t pos, int32_t nInserted, etk::VectorType<int8_t> &deletedText)
|
||||
{
|
||||
//APPL_INFO("EdnBufHistory new + data");
|
||||
m_pos = pos;
|
||||
@ -67,7 +67,7 @@ int32_t EdnBufHistory::getPos(void)
|
||||
|
||||
int32_t EdnBufHistory::getnbDeleted(void)
|
||||
{
|
||||
return m_deletedText.size();
|
||||
return m_deletedText.Size();
|
||||
}
|
||||
|
||||
int32_t EdnBufHistory::getnbInserted(void)
|
||||
@ -75,7 +75,7 @@ int32_t EdnBufHistory::getnbInserted(void)
|
||||
return m_nInserted;
|
||||
}
|
||||
|
||||
void EdnBufHistory::getData(std::vector<int8_t> &deletedText)
|
||||
void EdnBufHistory::getData(etk::VectorType<int8_t> &deletedText)
|
||||
{
|
||||
deletedText = m_deletedText;
|
||||
}
|
||||
|
@ -27,22 +27,22 @@
|
||||
#define __EDN_BUFFER_HISTORY_H__
|
||||
|
||||
|
||||
#include <vector>
|
||||
#include <etk/VectorType.h>
|
||||
|
||||
class EdnBufHistory{
|
||||
public:
|
||||
EdnBufHistory(void);
|
||||
EdnBufHistory(int32_t pos, int32_t nInserted, std::vector<int8_t> &deletedText);
|
||||
EdnBufHistory(int32_t pos, int32_t nInserted, etk::VectorType<int8_t> &deletedText);
|
||||
~EdnBufHistory(void);
|
||||
void Set(int32_t pos, int32_t nInserted, std::vector<int8_t> &deletedText);
|
||||
void Set(int32_t pos, int32_t nInserted, etk::VectorType<int8_t> &deletedText);
|
||||
int32_t getPos(void);
|
||||
int32_t getnbDeleted(void);
|
||||
int32_t getnbInserted(void);
|
||||
void getData(std::vector<int8_t> &deletedText);
|
||||
void getData(etk::VectorType<int8_t> &deletedText);
|
||||
private:
|
||||
int32_t m_pos;
|
||||
int32_t m_nInserted;
|
||||
std::vector<int8_t> m_deletedText;
|
||||
etk::VectorType<int8_t> m_deletedText;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -35,7 +35,7 @@ void EdnBuf::SetHLSystem(Highlight * newHLSystem)
|
||||
{
|
||||
if (m_Highlight != newHLSystem) {
|
||||
m_Highlight = newHLSystem;
|
||||
m_HLDataPass1.clear();
|
||||
m_HLDataPass1.Clear();
|
||||
RegenerateHighLightAt(0, 0, m_data.Size());
|
||||
}
|
||||
}
|
||||
@ -73,7 +73,7 @@ void EdnBuf::RegenerateHighLightAt(int32_t pos, int32_t nbDeleted, int32_t nbAdd
|
||||
int32_t startId;
|
||||
int32_t stopId;
|
||||
// clean data if needed
|
||||
if (0 != m_HLDataPass1.size()) {
|
||||
if (0 != m_HLDataPass1.Size()) {
|
||||
// find element previous
|
||||
FindMainHighLightPosition(pos, posEnd, startId, stopId, true);
|
||||
|
||||
@ -81,23 +81,23 @@ void EdnBuf::RegenerateHighLightAt(int32_t pos, int32_t nbDeleted, int32_t nbAdd
|
||||
if( -1 == startId
|
||||
&& -1 == stopId)
|
||||
{
|
||||
m_HLDataPass1.clear();
|
||||
m_HLDataPass1.Clear();
|
||||
} else if(-1 == startId) {
|
||||
if (0 == stopId){
|
||||
m_HLDataPass1.erase(m_HLDataPass1.begin());
|
||||
m_HLDataPass1.Erase(0);
|
||||
//APPL_DEBUG("1 * Erase 0");
|
||||
} else {
|
||||
m_HLDataPass1.erase(m_HLDataPass1.begin(), m_HLDataPass1.begin()+stopId);
|
||||
m_HLDataPass1.EraseLen(0,stopId);
|
||||
//APPL_DEBUG("2 * Erase 0->" << stopId);
|
||||
}
|
||||
} else if(-1 == stopId) {
|
||||
//APPL_DEBUG("3 * Erase " << startId+1 << "-> end");
|
||||
m_HLDataPass1.erase(m_HLDataPass1.begin()+startId+1, m_HLDataPass1.end());
|
||||
m_HLDataPass1.EraseLen(startId+1, m_HLDataPass1.Size() - startId);
|
||||
stopId = -1;
|
||||
} else {
|
||||
int32_t currentSize = m_HLDataPass1.size();
|
||||
int32_t currentSize = m_HLDataPass1.Size();
|
||||
//APPL_DEBUG("4 * Erase " << startId+1 << "->" << stopId << " in " << currentSize << " elements" );
|
||||
m_HLDataPass1.erase(m_HLDataPass1.begin() + startId+1, m_HLDataPass1.begin() + stopId );
|
||||
m_HLDataPass1.EraseLen(startId+1, stopId - startId);
|
||||
if (stopId == currentSize-1) {
|
||||
stopId = -1;
|
||||
}
|
||||
@ -119,7 +119,7 @@ void EdnBuf::RegenerateHighLightAt(int32_t pos, int32_t nbDeleted, int32_t nbAdd
|
||||
} else {
|
||||
elemStart = startId+1;
|
||||
}
|
||||
for (i=elemStart; i< (int32_t)m_HLDataPass1.size(); i++) {
|
||||
for (i=elemStart; i< (int32_t)m_HLDataPass1.Size(); i++) {
|
||||
//APPL_DEBUG("move element=" << i);
|
||||
m_HLDataPass1[i].beginStart += nbAdded - nbDeleted;
|
||||
m_HLDataPass1[i].beginStop += nbAdded - nbDeleted;
|
||||
@ -137,7 +137,7 @@ void EdnBuf::RegenerateHighLightAt(int32_t pos, int32_t nbDeleted, int32_t nbAdd
|
||||
GenerateHighLightAt(0, m_HLDataPass1[0].beginStart, 0);
|
||||
} else if(-1 == stopId) {
|
||||
//APPL_DEBUG("******* Regenerate STOP");
|
||||
GenerateHighLightAt(m_HLDataPass1[m_HLDataPass1.size() -1].endStop, m_data.Size(), m_HLDataPass1.size());
|
||||
GenerateHighLightAt(m_HLDataPass1[m_HLDataPass1.Size() -1].endStop, m_data.Size(), m_HLDataPass1.Size());
|
||||
} else {
|
||||
//APPL_DEBUG("******* Regenerate RANGE");
|
||||
GenerateHighLightAt(m_HLDataPass1[startId].endStop, m_HLDataPass1[startId+1].beginStart, startId+1);
|
||||
@ -202,7 +202,7 @@ void EdnBuf::FindMainHighLightPosition(int32_t startPos, int32_t endPos, int32_t
|
||||
S=-1 *************** E
|
||||
*/
|
||||
int32_t i;
|
||||
for (i=0; i< (int32_t)m_HLDataPass1.size(); i++) {
|
||||
for (i=0; i< (int32_t)m_HLDataPass1.Size(); i++) {
|
||||
if (m_HLDataPass1[i].endStop > startPos) {
|
||||
break;
|
||||
}
|
||||
@ -223,7 +223,7 @@ void EdnBuf::FindMainHighLightPosition(int32_t startPos, int32_t endPos, int32_t
|
||||
} else {
|
||||
elemStart = startId+1;
|
||||
}
|
||||
for (i=elemStart; i< (int32_t)m_HLDataPass1.size(); i++) {
|
||||
for (i=elemStart; i< (int32_t)m_HLDataPass1.Size(); i++) {
|
||||
if (m_HLDataPass1[i].beginStart > endPos)
|
||||
{
|
||||
stopId = i;
|
||||
@ -261,7 +261,7 @@ void EdnBuf::GenerateHighLightAt(int32_t pos, int32_t endPos, int32_t addinPos)
|
||||
void EdnBuf::CleanHighLight(void)
|
||||
{
|
||||
// Remove all element in the list...
|
||||
m_HLDataPass1.clear();
|
||||
m_HLDataPass1.Clear();
|
||||
}
|
||||
|
||||
|
||||
@ -269,7 +269,7 @@ colorInformation_ts *EdnBuf::GetElementColorAtPosition(int32_t pos, int32_t &sta
|
||||
{
|
||||
int32_t i;
|
||||
int32_t start = etk_max(0, starPos-1);
|
||||
for (i=start; i<(int32_t)m_HLDataPass1.size(); i++) {
|
||||
for (i=start; i<(int32_t)m_HLDataPass1.Size(); i++) {
|
||||
starPos = i;
|
||||
if( m_HLDataPass1[i].beginStart <= pos
|
||||
&& m_HLDataPass1[i].endStop > pos)
|
||||
@ -294,7 +294,7 @@ void EdnBuf::HightlightGenerateLines(displayHLData_ts & MData, int32_t HLStart,
|
||||
//GTimeVal timeStart;
|
||||
//g_get_current_time(&timeStart);
|
||||
HLStart = StartOfLine(HLStart);
|
||||
MData.HLData.clear();
|
||||
MData.HLData.Clear();
|
||||
int32_t HLStop = CountForwardNLines(HLStart, nbLines);
|
||||
int32_t startId, stopId;
|
||||
// find element previous
|
||||
@ -304,7 +304,7 @@ void EdnBuf::HightlightGenerateLines(displayHLData_ts & MData, int32_t HLStart,
|
||||
//APPL_DEBUG("List of section between : "<< startId << " & " << stopId);
|
||||
int32_t endSearch = stopId+1;
|
||||
if (-1 == stopId) {
|
||||
endSearch = m_HLDataPass1.size();
|
||||
endSearch = m_HLDataPass1.Size();
|
||||
}
|
||||
for (k=etk_max(startId, 0); k<endSearch; k++) {
|
||||
// empty section :
|
||||
@ -327,9 +327,9 @@ void EdnBuf::HightlightGenerateLines(displayHLData_ts & MData, int32_t HLStart,
|
||||
//APPL_DEBUG(" ==> (under section ) k="<<k<<" start="<<m_HLDataPass1[k].beginStart<<" stop="<<m_HLDataPass1[k].endStop << " subSectionOfID=" << 99999999);
|
||||
// TODO : ...
|
||||
}
|
||||
if (endSearch == (int32_t)m_HLDataPass1.size() ){
|
||||
if (endSearch == (int32_t)m_HLDataPass1.Size() ){
|
||||
//if( k < (int32_t)m_HLDataPass1.Size()) {
|
||||
if (m_HLDataPass1.size() != 0) {
|
||||
if (m_HLDataPass1.Size() != 0) {
|
||||
//APPL_DEBUG(" ==> (empty section 3 ) k="<<k<<" start="<<m_HLDataPass1[k-1].endStop<<" stop="<<HLStop );
|
||||
m_Highlight->Parse2(m_HLDataPass1[k-1].endStop,
|
||||
HLStop,
|
||||
@ -355,7 +355,7 @@ colorInformation_ts * EdnBuf::GetElementColorAtPosition(displayHLData_ts & MData
|
||||
{
|
||||
int32_t i;
|
||||
int32_t start = etk_max(0, MData.posHLPass2-1);
|
||||
for (i=start; i<(int32_t)MData.HLData.size(); i++) {
|
||||
for (i=start; i<(int32_t)MData.HLData.Size(); i++) {
|
||||
MData.posHLPass2 = i;
|
||||
if( MData.HLData[i].beginStart <= pos
|
||||
&& MData.HLData[i].endStop > pos)
|
||||
|
@ -36,7 +36,7 @@
|
||||
|
||||
int32_t EdnBuf::Undo(void)
|
||||
{
|
||||
int32_t nbElement = m_historyUndo.size();
|
||||
int32_t nbElement = m_historyUndo.Size();
|
||||
//APPL_DEBUG("EdnBuf::Undo Request id="<<nbElement);
|
||||
int32_t posDest = -1;
|
||||
if (0 == nbElement) {
|
||||
@ -47,13 +47,13 @@ int32_t EdnBuf::Undo(void)
|
||||
nbElement--;
|
||||
if (m_historyUndo[nbElement] == NULL) {
|
||||
APPL_ERROR("EdnBuf::Undo Find empty history ==> remove it");
|
||||
m_historyUndo.pop_back();
|
||||
m_historyUndo.PopBack();
|
||||
return -1;
|
||||
}
|
||||
int32_t pos = m_historyUndo[nbElement]->getPos();
|
||||
int32_t nbDeleted = m_historyUndo[nbElement]->getnbDeleted();
|
||||
int32_t nbInserted = m_historyUndo[nbElement]->getnbInserted();
|
||||
std::vector<int8_t> deletedText;
|
||||
etk::VectorType<int8_t> deletedText;
|
||||
m_historyUndo[nbElement]->getData(deletedText);
|
||||
m_isUndoProcessing = true;
|
||||
if (0 == nbInserted) {
|
||||
@ -77,14 +77,14 @@ int32_t EdnBuf::Undo(void)
|
||||
}
|
||||
// remove element in the list :
|
||||
delete(m_historyUndo[nbElement]);
|
||||
m_historyUndo.pop_back();
|
||||
m_historyUndo.PopBack();
|
||||
m_isUndoProcessing = false;
|
||||
return posDest;
|
||||
}
|
||||
|
||||
int32_t EdnBuf::Redo(void)
|
||||
{
|
||||
int32_t nbElement = m_historyRedo.size();
|
||||
int32_t nbElement = m_historyRedo.Size();
|
||||
//APPL_DEBUG("EdnBuf::Redo Request id="<<nbElement);
|
||||
int32_t posDest = -1;
|
||||
if (0 == nbElement) {
|
||||
@ -95,13 +95,13 @@ int32_t EdnBuf::Redo(void)
|
||||
nbElement--;
|
||||
if (m_historyRedo[nbElement] == NULL) {
|
||||
APPL_ERROR("EdnBuf::Redo Find empty history ==> remove it");
|
||||
m_historyRedo.pop_back();
|
||||
m_historyRedo.PopBack();
|
||||
return -1;
|
||||
}
|
||||
int32_t pos = m_historyRedo[nbElement]->getPos();
|
||||
int32_t nbDeleted = m_historyRedo[nbElement]->getnbDeleted();
|
||||
int32_t nbInserted = m_historyRedo[nbElement]->getnbInserted();
|
||||
std::vector<int8_t> deletedText;
|
||||
etk::VectorType<int8_t> deletedText;
|
||||
m_historyRedo[nbElement]->getData(deletedText);
|
||||
m_isRedoProcessing = true;
|
||||
if (0 == nbInserted) {
|
||||
@ -125,7 +125,7 @@ int32_t EdnBuf::Redo(void)
|
||||
}
|
||||
// remove element in the list :
|
||||
delete(m_historyRedo[nbElement]);
|
||||
m_historyRedo.pop_back();
|
||||
m_historyRedo.PopBack();
|
||||
m_isRedoProcessing = false;
|
||||
return posDest;
|
||||
}
|
||||
|
@ -136,12 +136,12 @@ bool EdnBuf::GetSelectionPos(int32_t &start, int32_t &end, bool &isRect, int32_t
|
||||
* @return ---
|
||||
*
|
||||
*/
|
||||
void EdnBuf::GetSelectionText(std::vector<int8_t> &text)
|
||||
void EdnBuf::GetSelectionText(etk::VectorType<int8_t> &text)
|
||||
{
|
||||
int32_t start, end, rectStart, rectEnd;
|
||||
bool isRect;
|
||||
// remove output data
|
||||
text.clear();
|
||||
text.Clear();
|
||||
|
||||
bool isSelected = GetSelectionPos(start, end, isRect, rectStart, rectEnd);
|
||||
|
||||
@ -220,7 +220,7 @@ void EdnBuf::RemoveSelected(void)
|
||||
* @return ---
|
||||
*
|
||||
*/
|
||||
int32_t EdnBuf::ReplaceSelected(std::vector<int8_t> &text)
|
||||
int32_t EdnBuf::ReplaceSelected(etk::VectorType<int8_t> &text)
|
||||
{
|
||||
int32_t start, end, rectStart, rectEnd;
|
||||
bool isRect;
|
||||
|
@ -225,26 +225,18 @@ int8_t& EdnVectorBuf::Get(int32_t pos)
|
||||
* @return ---
|
||||
*
|
||||
*/
|
||||
void EdnVectorBuf::Get(int32_t pos, int32_t nbElement, std::vector<int8_t> &tmpBuffer)
|
||||
void EdnVectorBuf::Get(int32_t pos, int32_t nbElement, etk::VectorType<int8_t> &tmpBuffer)
|
||||
{
|
||||
tmpBuffer.clear();
|
||||
tmpBuffer.Clear();
|
||||
if (pos < m_gapStart) {
|
||||
if (pos + nbElement < m_gapStart) {
|
||||
for (int32_t iii = 0 ; iii < nbElement; iii++) {
|
||||
tmpBuffer.push_back(m_data[pos + iii]);
|
||||
}
|
||||
tmpBuffer.PushBack(&m_data[pos], nbElement);
|
||||
} else {
|
||||
for (int32_t iii = 0 ; iii < m_gapStart-pos; iii++) {
|
||||
tmpBuffer.push_back(m_data[pos + iii]);
|
||||
}
|
||||
for (int32_t iii = 0 ; iii < nbElement - (m_gapStart - pos); iii++) {
|
||||
tmpBuffer.push_back(m_data[m_gapEnd + iii]);
|
||||
}
|
||||
tmpBuffer.PushBack(&m_data[pos], m_gapStart - pos);
|
||||
tmpBuffer.PushBack(&m_data[m_gapEnd], nbElement - (m_gapStart - pos) );
|
||||
}
|
||||
} else {
|
||||
for (int32_t iii = 0 ; iii < nbElement; iii++) {
|
||||
tmpBuffer.push_back(m_data[pos+(m_gapEnd-m_gapStart)+iii]);
|
||||
}
|
||||
tmpBuffer.PushBack(&m_data[pos+(m_gapEnd-m_gapStart)], nbElement);
|
||||
}
|
||||
}
|
||||
|
||||
@ -405,15 +397,15 @@ void EdnVectorBuf::Insert(int32_t pos, const int8_t& item)
|
||||
* @return ---
|
||||
*
|
||||
*/
|
||||
void EdnVectorBuf::Insert(int32_t pos, std::vector<int8_t>& items)
|
||||
void EdnVectorBuf::Insert(int32_t pos, etk::VectorType<int8_t>& items)
|
||||
{
|
||||
if( pos > Size()
|
||||
|| pos < 0 ) {
|
||||
APPL_ERROR("Request higher than buffer size : pos="<<pos<< " bufferSize="<<Size());
|
||||
return;
|
||||
}
|
||||
if( items.size() > GapSize() ) {
|
||||
if (false == GapResize(pos, GAP_SIZE_MIN + items.size()) ) {
|
||||
if( items.Size() > GapSize() ) {
|
||||
if (false == GapResize(pos, GAP_SIZE_MIN + items.Size()) ) {
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
@ -422,10 +414,10 @@ void EdnVectorBuf::Insert(int32_t pos, std::vector<int8_t>& items)
|
||||
}
|
||||
}
|
||||
int32_t i;
|
||||
for(i=0; i<items.size(); i++) {
|
||||
for(i=0; i<items.Size(); i++) {
|
||||
m_data[m_gapStart+i] = items[i];
|
||||
}
|
||||
m_gapStart += items.size();
|
||||
m_gapStart += items.Size();
|
||||
}
|
||||
|
||||
|
||||
@ -461,7 +453,7 @@ void EdnVectorBuf::Replace(int32_t pos, const int8_t& item)
|
||||
* @return ---
|
||||
*
|
||||
*/
|
||||
void EdnVectorBuf::Replace(int32_t pos, int32_t nbRemoveElement, std::vector<int8_t>& items)
|
||||
void EdnVectorBuf::Replace(int32_t pos, int32_t nbRemoveElement, etk::VectorType<int8_t>& items)
|
||||
{
|
||||
if( pos > Size()
|
||||
|| pos < 0 ) {
|
||||
@ -608,3 +600,105 @@ void EdnVectorBuf::Display(void)
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @brief
|
||||
*
|
||||
* @param[in,out] ---
|
||||
*
|
||||
* @return ---
|
||||
*
|
||||
*/
|
||||
void TestEdnVectorBuf(void)
|
||||
{
|
||||
EdnVectorBuf myBufferTmp;
|
||||
int32_t i;
|
||||
|
||||
//invert data
|
||||
for (i=0; i<50; i++) {
|
||||
myBufferTmp.Insert(0, 'a' + i%26);
|
||||
}
|
||||
myBufferTmp.Display();
|
||||
myBufferTmp.Clear();
|
||||
myBufferTmp.Display();
|
||||
|
||||
myBufferTmp.Remove(2, 300);
|
||||
/*
|
||||
char plop='a';
|
||||
myBufferTmp.Insert(0, plop);
|
||||
myBufferTmp.Display();
|
||||
plop='b';
|
||||
myBufferTmp.Insert(0, plop);
|
||||
myBufferTmp.Display();
|
||||
plop='c';
|
||||
myBufferTmp.Insert(0, plop);
|
||||
myBufferTmp.Display();
|
||||
plop='d';
|
||||
myBufferTmp.Insert(0, plop);
|
||||
myBufferTmp.Display();
|
||||
plop='e';
|
||||
myBufferTmp.Insert(0, plop);
|
||||
myBufferTmp.Display();
|
||||
plop='f';
|
||||
myBufferTmp.Insert(0, plop);
|
||||
myBufferTmp.Display();
|
||||
plop='g';
|
||||
myBufferTmp.Insert(0, plop);
|
||||
myBufferTmp.Display();
|
||||
plop='h';
|
||||
myBufferTmp.Insert(0, plop);
|
||||
myBufferTmp.Display();
|
||||
plop='m';
|
||||
|
||||
etk::VectorType<int8_t> items;
|
||||
items.PushBack('i');
|
||||
items.PushBack('j');
|
||||
items.PushBack('k');
|
||||
items.PushBack('l');
|
||||
items.PushBack('m');
|
||||
items.PushBack('n');
|
||||
items.PushBack('o');
|
||||
items.PushBack('p');
|
||||
|
||||
|
||||
|
||||
myBufferTmp.Insert(3, items);
|
||||
myBufferTmp.Display();
|
||||
|
||||
|
||||
|
||||
plop='7';
|
||||
myBufferTmp.Insert(7, plop);
|
||||
myBufferTmp.Display();
|
||||
|
||||
myBufferTmp.Replace(8, 'z');
|
||||
myBufferTmp.Display();
|
||||
|
||||
items.Clear();
|
||||
items.PushBack('1');
|
||||
items.PushBack('2');
|
||||
items.PushBack('3');
|
||||
myBufferTmp.Replace(10, 4, items);
|
||||
myBufferTmp.Display();
|
||||
|
||||
|
||||
myBufferTmp.PushBack('a');
|
||||
myBufferTmp.PushBack('a');
|
||||
myBufferTmp.PushBack('a');
|
||||
myBufferTmp.PushBack('a');
|
||||
myBufferTmp.Display();
|
||||
|
||||
|
||||
myBufferTmp.PopBack();
|
||||
myBufferTmp.PopBack();
|
||||
myBufferTmp.PopBack();
|
||||
myBufferTmp.PopBack();
|
||||
myBufferTmp.Display();
|
||||
|
||||
myBufferTmp.Remove(2, 3);
|
||||
myBufferTmp.Display();
|
||||
*/
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -26,7 +26,7 @@
|
||||
#ifndef __EDN_VECTOR_BUF_H__
|
||||
#define __EDN_VECTOR_BUF_H__
|
||||
|
||||
#include <vector>
|
||||
#include <etk/VectorType.h>
|
||||
|
||||
#undef __class__
|
||||
#define __class__ "EdnVectorBuf"
|
||||
@ -271,14 +271,14 @@ class EdnVectorBuf
|
||||
EdnVectorBuf & operator=( const EdnVectorBuf & Evb);
|
||||
int8_t operator[] (int32_t pos);
|
||||
int8_t & Get( int32_t pos);
|
||||
void Get( int32_t pos, int32_t nbElement, std::vector<int8_t> &tmpBuffer);
|
||||
void Get( int32_t pos, int32_t nbElement, etk::VectorType<int8_t> &tmpBuffer);
|
||||
// insert functions
|
||||
void PushBack( const int8_t& item);
|
||||
void Insert( int32_t pos, const int8_t& item);
|
||||
void Insert( int32_t pos, std::vector<int8_t>& items);
|
||||
void Insert( int32_t pos, etk::VectorType<int8_t>& items);
|
||||
// Remove and insert functions
|
||||
void Replace( int32_t pos, const int8_t& item);
|
||||
void Replace( int32_t pos, int32_t nbRemoveElement, std::vector<int8_t>& items);
|
||||
void Replace( int32_t pos, int32_t nbRemoveElement, etk::VectorType<int8_t>& items);
|
||||
// Revove fonctions
|
||||
void Remove( int32_t pos, int32_t nbRemoveElement = 1);
|
||||
void PopBack( void);
|
||||
@ -300,7 +300,6 @@ class EdnVectorBuf
|
||||
* @return The number requested
|
||||
*/
|
||||
int32_t Size(void) { return m_allocated - GapSize(); };
|
||||
int32_t size(void) { return m_allocated - GapSize(); };
|
||||
|
||||
Iterator Position(int32_t pos)
|
||||
{
|
||||
@ -337,5 +336,6 @@ class EdnVectorBuf
|
||||
#undef __class__
|
||||
#define __class__ NULL
|
||||
|
||||
void TestEdnVectorBuf(void);
|
||||
|
||||
#endif
|
||||
|
@ -67,10 +67,10 @@ class classColorManager: public ewol::EObject
|
||||
void DisplayListOfColor(void);
|
||||
|
||||
private:
|
||||
etk::UString m_fileColor;
|
||||
std::vector<Colorize*> listMyColor; //!< List of ALL Color
|
||||
Colorize * errorColor;
|
||||
color_ts basicColors[COLOR_NUMBER_MAX];
|
||||
etk::UString m_fileColor;
|
||||
etk::VectorType<Colorize*> listMyColor; //!< List of ALL Color
|
||||
Colorize * errorColor;
|
||||
color_ts basicColors[COLOR_NUMBER_MAX];
|
||||
};
|
||||
|
||||
|
||||
@ -85,14 +85,14 @@ classColorManager::~classColorManager(void)
|
||||
|
||||
int32_t i;
|
||||
// clean all Element
|
||||
for (i=0; i< listMyColor.size(); i++) {
|
||||
for (i=0; i< listMyColor.Size(); i++) {
|
||||
if (NULL != listMyColor[i]) {
|
||||
delete(listMyColor[i]);
|
||||
listMyColor[i] = NULL;
|
||||
}
|
||||
}
|
||||
// clear the compleate list
|
||||
listMyColor.clear();
|
||||
listMyColor.Clear();
|
||||
}
|
||||
|
||||
void classColorManager::OnReceiveMessage(ewol::EObject * CallerObject, const char * eventId, etk::UString data)
|
||||
@ -125,14 +125,14 @@ void classColorManager::LoadFile(const char * xmlFilename)
|
||||
// Remove all old color :
|
||||
int32_t i;
|
||||
// clean all Element
|
||||
for (i=0; i< listMyColor.size(); i++) {
|
||||
for (i=0; i< listMyColor.Size(); i++) {
|
||||
if (NULL != listMyColor[i]) {
|
||||
delete(listMyColor[i]);
|
||||
listMyColor[i] = NULL;
|
||||
}
|
||||
}
|
||||
// clear the compleate list
|
||||
listMyColor.clear();
|
||||
listMyColor.Clear();
|
||||
|
||||
m_fileColor = xmlFilename;
|
||||
APPL_DEBUG("open file (COLOR) \"" << xmlFilename << "\" ? = \"" << m_fileColor << "\"");
|
||||
@ -275,7 +275,7 @@ void classColorManager::LoadFile(const char * xmlFilename)
|
||||
myNewColor->SetItalic(true);
|
||||
}
|
||||
}
|
||||
listMyColor.push_back(myNewColor);
|
||||
listMyColor.PushBack(myNewColor);
|
||||
} else {
|
||||
APPL_ERROR(PFX"(l "<<pNode->Row()<<") node not suported : \""<<pNode->Value()<<"\" must be [color]");
|
||||
}
|
||||
@ -299,7 +299,7 @@ void classColorManager::LoadFile(const char * xmlFilename)
|
||||
Colorize *classColorManager::Get(const char *colorName)
|
||||
{
|
||||
int32_t i;
|
||||
for (i=0; i<listMyColor.size(); i++) {
|
||||
for (i=0; i<listMyColor.Size(); i++) {
|
||||
etk::UString elementName = listMyColor[i]->GetName();
|
||||
if (elementName == colorName) {
|
||||
return listMyColor[i];
|
||||
@ -330,7 +330,7 @@ color_ts & classColorManager::Get(basicColor_te myColor)
|
||||
bool classColorManager::Exist(const char *colorName)
|
||||
{
|
||||
int32_t i;
|
||||
for (i=0; i<listMyColor.size(); i++) {
|
||||
for (i=0; i<listMyColor.Size(); i++) {
|
||||
etk::UString elementName = listMyColor[i]->GetName();
|
||||
if (elementName == colorName) {
|
||||
return true;
|
||||
@ -349,7 +349,7 @@ void classColorManager::DisplayListOfColor(void)
|
||||
{
|
||||
int32_t i;
|
||||
APPL_INFO(PFX"List of ALL COLOR : ");
|
||||
for (i=0; i<listMyColor.size(); i++) {
|
||||
for (i=0; i<listMyColor.Size(); i++) {
|
||||
//etk::UString elementName = listMyColor[i]->GetName();
|
||||
//APPL_INFO(i << " : \"" << elementName.c_str() << "\"" );
|
||||
listMyColor[i]->Display(i);
|
||||
|
@ -54,7 +54,7 @@ CodeView::CodeView(void)
|
||||
m_bufferID = -1;
|
||||
m_buttunOneSelected = false;
|
||||
|
||||
m_lineNumberList.clear();
|
||||
m_lineNumberList.Clear();
|
||||
|
||||
m_textColorFg = etk::color::color_Black;
|
||||
|
||||
@ -91,11 +91,11 @@ void CodeView::UpdateNumberOfLineReference(int32_t bufferID)
|
||||
Vector2D<float> tmpCoord;
|
||||
tmpCoord.x = 0;
|
||||
tmpCoord.y = 0;
|
||||
if (m_lineNumberList.size()<=bufferID) {
|
||||
if (m_lineNumberList.Size()<=bufferID) {
|
||||
// update the number of elements :
|
||||
for (int32_t iii=m_lineNumberList.size(); iii <= bufferID; iii++) {
|
||||
for (int32_t iii=m_lineNumberList.Size(); iii <= bufferID; iii++) {
|
||||
// add start line at 0 :
|
||||
m_lineNumberList.push_back(tmpCoord);
|
||||
m_lineNumberList.PushBack(tmpCoord);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -289,7 +289,7 @@ void CodeView::OnReceiveMessage(ewol::EObject * CallerObject, const char * event
|
||||
if(eventId == ednMsgBufferId) {
|
||||
//keep the reference of the display offset :
|
||||
if( m_bufferID >=0
|
||||
&& m_bufferID < m_lineNumberList.size()) {
|
||||
&& m_bufferID < m_lineNumberList.Size()) {
|
||||
m_lineNumberList[m_bufferID] = m_originScrooled;
|
||||
}
|
||||
int32_t bufferID = 0;
|
||||
@ -301,7 +301,7 @@ void CodeView::OnReceiveMessage(ewol::EObject * CallerObject, const char * event
|
||||
UpdateNumberOfLineReference(m_bufferID);
|
||||
// set back if needed the display position ...
|
||||
if( m_bufferID >=0
|
||||
&& m_bufferID < m_lineNumberList.size()) {
|
||||
&& m_bufferID < m_lineNumberList.Size()) {
|
||||
m_originScrooled = m_lineNumberList[m_bufferID];
|
||||
}
|
||||
} else if (eventId == ednMsgGuiCopy) {
|
||||
|
@ -48,19 +48,19 @@ class CodeView :public ewol::WidgetScrooled
|
||||
const char * const GetObjectType(void) { return "ApplCodeView"; };
|
||||
virtual bool CalculateMinSize(void);
|
||||
private:
|
||||
etk::UString m_label;
|
||||
color_ts m_textColorFg; //!< Text color
|
||||
color_ts m_textColorBg; //!< Background color
|
||||
int32_t m_bufferID;
|
||||
bool m_buttunOneSelected;
|
||||
std::vector<Vector2D<float> > m_lineNumberList;
|
||||
void UpdateNumberOfLineReference(int32_t bufferID);
|
||||
etk::UString m_label;
|
||||
color_ts m_textColorFg; //!< Text color
|
||||
color_ts m_textColorBg; //!< Background color
|
||||
int32_t m_bufferID;
|
||||
bool m_buttunOneSelected;
|
||||
etk::VectorType<Vector2D<float> > m_lineNumberList;
|
||||
void UpdateNumberOfLineReference(int32_t bufferID);
|
||||
// drawing elements :
|
||||
ewol::OObject2DTextColored m_OObjectTextNormal[NB_BOUBLE_BUFFER];
|
||||
ewol::OObject2DTextColored m_OObjectTextBold[NB_BOUBLE_BUFFER];
|
||||
ewol::OObject2DTextColored m_OObjectTextItalic[NB_BOUBLE_BUFFER];
|
||||
ewol::OObject2DTextColored m_OObjectTextBoldItalic[NB_BOUBLE_BUFFER];
|
||||
ewol::OObject2DColored m_OObjectsColored[NB_BOUBLE_BUFFER];
|
||||
ewol::OObject2DTextColored m_OObjectTextNormal[NB_BOUBLE_BUFFER];
|
||||
ewol::OObject2DTextColored m_OObjectTextBold[NB_BOUBLE_BUFFER];
|
||||
ewol::OObject2DTextColored m_OObjectTextItalic[NB_BOUBLE_BUFFER];
|
||||
ewol::OObject2DTextColored m_OObjectTextBoldItalic[NB_BOUBLE_BUFFER];
|
||||
ewol::OObject2DColored m_OObjectsColored[NB_BOUBLE_BUFFER];
|
||||
|
||||
public:
|
||||
virtual void OnRegenerateDisplay(void);
|
||||
|
@ -33,14 +33,14 @@
|
||||
#define __class__ "Highlight"
|
||||
|
||||
|
||||
void Highlight::ParseRules(TiXmlNode *child, std::vector<HighlightPattern*> &mListPatern, int32_t level)
|
||||
void Highlight::ParseRules(TiXmlNode *child, etk::VectorType<HighlightPattern*> &mListPatern, int32_t level)
|
||||
{
|
||||
// Create the patern ...
|
||||
HighlightPattern *myPattern = new HighlightPattern();
|
||||
// parse under Element
|
||||
myPattern->ParseRules(child, level);
|
||||
// add element in the list
|
||||
mListPatern.push_back(myPattern);
|
||||
mListPatern.PushBack(myPattern);
|
||||
}
|
||||
|
||||
|
||||
@ -100,7 +100,7 @@ Highlight::Highlight(etk::UString &xmlFilename)
|
||||
if (NULL != myData) {
|
||||
//APPL_INFO(PFX"(l %d) node fined : %s=\"%s\"", child->Row(), child->Value() , myData);
|
||||
etk::UString * myEdnData = new etk::UString(myData);
|
||||
m_listExtentions.push_back(myEdnData);
|
||||
m_listExtentions.PushBack(myEdnData);
|
||||
}
|
||||
} else if (!strcmp(child->Value(), "pass1")) {
|
||||
// Get sub Nodes ...
|
||||
@ -145,35 +145,35 @@ Highlight::~Highlight(void)
|
||||
{
|
||||
int32_t i;
|
||||
// clean all Element
|
||||
for (i=0; i< m_listHighlightPass1.size(); i++) {
|
||||
for (i=0; i< m_listHighlightPass1.Size(); i++) {
|
||||
if (NULL != m_listHighlightPass1[i]) {
|
||||
delete(m_listHighlightPass1[i]);
|
||||
m_listHighlightPass1[i] = NULL;
|
||||
}
|
||||
}
|
||||
// clear the compleate list
|
||||
m_listHighlightPass1.clear();
|
||||
m_listHighlightPass1.Clear();
|
||||
|
||||
// clean all Element
|
||||
for (i=0; i< m_listExtentions.size(); i++) {
|
||||
for (i=0; i< m_listExtentions.Size(); i++) {
|
||||
if (NULL != m_listExtentions[i]) {
|
||||
delete(m_listExtentions[i]);
|
||||
m_listExtentions[i] = NULL;
|
||||
}
|
||||
}
|
||||
// clear the compleate list
|
||||
m_listExtentions.clear();
|
||||
m_listExtentions.Clear();
|
||||
}
|
||||
|
||||
void Highlight::ReloadColor(void)
|
||||
{
|
||||
int32_t i;
|
||||
for (i=0; i< m_listHighlightPass1.size(); i++) {
|
||||
for (i=0; i< m_listHighlightPass1.Size(); i++) {
|
||||
if (NULL != m_listHighlightPass1[i]) {
|
||||
m_listHighlightPass1[i]->ReloadColor();
|
||||
}
|
||||
}
|
||||
for (i=0; i< m_listHighlightPass2.size(); i++) {
|
||||
for (i=0; i< m_listHighlightPass2.Size(); i++) {
|
||||
if (NULL != m_listHighlightPass2[i]) {
|
||||
m_listHighlightPass2[i]->ReloadColor();
|
||||
}
|
||||
@ -183,7 +183,7 @@ void Highlight::ReloadColor(void)
|
||||
bool Highlight::HasExtention(etk::UString &ext)
|
||||
{
|
||||
int32_t i;
|
||||
for (i=0; i<m_listExtentions.size(); i++) {
|
||||
for (i=0; i<m_listExtentions.Size(); i++) {
|
||||
if (ext == *m_listExtentions[i] ) {
|
||||
return true;
|
||||
}
|
||||
@ -203,7 +203,7 @@ bool Highlight::FileNameCompatible(etk::File &fileName)
|
||||
}
|
||||
APPL_DEBUG(" try to find : in \"" << fileName << "\" extention:\"" << extention << "\" ");
|
||||
|
||||
for (i=0; i<m_listExtentions.size(); i++) {
|
||||
for (i=0; i<m_listExtentions.Size(); i++) {
|
||||
if (extention == *m_listExtentions[i] ) {
|
||||
return true;
|
||||
}
|
||||
@ -216,16 +216,16 @@ void Highlight::Display(void)
|
||||
{
|
||||
int32_t i;
|
||||
APPL_INFO("List of ALL Highlight : ");
|
||||
for (i=0; i< m_listExtentions.size(); i++) {
|
||||
for (i=0; i< m_listExtentions.Size(); i++) {
|
||||
APPL_INFO(" Extention : " << i << " : " << *m_listExtentions[i] );
|
||||
}
|
||||
// Display all elements
|
||||
for (i=0; i< m_listHighlightPass1.size(); i++) {
|
||||
for (i=0; i< m_listHighlightPass1.Size(); i++) {
|
||||
APPL_INFO(" " << i << " Pass 1 : " << m_listHighlightPass1[i]->GetName() );
|
||||
//m_listHighlightPass1[i]->Display();
|
||||
}
|
||||
// Display all elements
|
||||
for (i=0; i< m_listHighlightPass2.size(); i++) {
|
||||
for (i=0; i< m_listHighlightPass2.Size(); i++) {
|
||||
APPL_INFO(" " << i << " Pass 2 : " << m_listHighlightPass2[i]->GetName() );
|
||||
//m_listHighlightPass2[i]->Display();
|
||||
}
|
||||
@ -236,7 +236,7 @@ void Highlight::Display(void)
|
||||
// TODO : Celui qui appelle suprime des element pour rien ... Enfin c'est pas trègrave... Il suffirait juste de suprimer celuis d'avant si il n'est pas terminer...
|
||||
void Highlight::Parse(int32_t start,
|
||||
int32_t stop,
|
||||
std::vector<colorInformation_ts> &metaData,
|
||||
etk::VectorType<colorInformation_ts> &metaData,
|
||||
int32_t addingPos,
|
||||
EdnVectorBuf &buffer)
|
||||
{
|
||||
@ -250,27 +250,27 @@ void Highlight::Parse(int32_t start,
|
||||
while (elementStart<elementStop) {
|
||||
//APPL_DEBUG("Parse element in the buffer id=" << elementStart);
|
||||
//try to fond the HL in ALL of we have
|
||||
for (int32_t jjj=0; jjj<m_listHighlightPass1.size(); jjj++){
|
||||
for (int32_t jjj=0; jjj<m_listHighlightPass1.Size(); jjj++){
|
||||
resultFind_te ret = HLP_FIND_OK;
|
||||
//APPL_DEBUG("Parse HL id=" << jjj << " position search: (" << start << "," << buffer.Size() << ")" );
|
||||
// Stop the search to the end (to get the end of the pattern)
|
||||
ret = m_listHighlightPass1[jjj]->Find(elementStart, buffer.size(), resultat, buffer);
|
||||
ret = m_listHighlightPass1[jjj]->Find(elementStart, buffer.Size(), resultat, buffer);
|
||||
if (HLP_FIND_ERROR != ret) {
|
||||
//APPL_INFO("Find Pattern in the Buffer : (" << resultat.beginStart << "," << resultat.endStop << ")" );
|
||||
// Remove element in the current List where the current Element have a end inside the next...
|
||||
int32_t kkk=addingPos;
|
||||
while(kkk < metaData.size() ) {
|
||||
while(kkk < metaData.Size() ) {
|
||||
if (metaData[kkk].beginStart <= resultat.endStop) {
|
||||
// Remove element
|
||||
//APPL_INFO("Erase element=" << kkk);
|
||||
metaData.erase(metaData.begin()+kkk, metaData.begin()+kkk+1);
|
||||
metaData.EraseLen(kkk, kkk+1);
|
||||
// Increase the end of search
|
||||
if (kkk < metaData.size()) {
|
||||
if (kkk < metaData.Size()) {
|
||||
// just befor the end of the next element
|
||||
elementStop = metaData[kkk].beginStart-1;
|
||||
} else {
|
||||
// end of the buffer
|
||||
elementStop = buffer.size();
|
||||
elementStop = buffer.Size();
|
||||
}
|
||||
} else {
|
||||
// Not find ==> exit the cycle :
|
||||
@ -278,7 +278,7 @@ void Highlight::Parse(int32_t start,
|
||||
}
|
||||
}
|
||||
// Add curent element in the list ...
|
||||
metaData.insert(metaData.begin()+addingPos, resultat);
|
||||
metaData.Insert(addingPos, resultat);
|
||||
//APPL_DEBUG("INSERT at "<< addingPos << " S=" << resultat.beginStart << " E=" << resultat.endStop );
|
||||
// Update the current research starting element: (Set position at the end of the current element
|
||||
elementStart = resultat.endStop-1;
|
||||
@ -300,7 +300,7 @@ void Highlight::Parse(int32_t start,
|
||||
*/
|
||||
void Highlight::Parse2(int32_t start,
|
||||
int32_t stop,
|
||||
std::vector<colorInformation_ts> &metaData,
|
||||
etk::VectorType<colorInformation_ts> &metaData,
|
||||
EdnVectorBuf &buffer)
|
||||
{
|
||||
//APPL_DEBUG("Parse element 0 => " << m_listHighlightPass2.size() << " ==> position search: (" << start << "," << stop << ")" );
|
||||
@ -311,7 +311,7 @@ void Highlight::Parse2(int32_t start,
|
||||
//APPL_DEBUG("Parse element in the buffer id=" << elementStart);
|
||||
//try to fond the HL in ALL of we have
|
||||
int32_t jjj;
|
||||
for (jjj=0; jjj<m_listHighlightPass2.size(); jjj++){
|
||||
for (jjj=0; jjj<m_listHighlightPass2.Size(); jjj++){
|
||||
resultFind_te ret = HLP_FIND_OK;
|
||||
//APPL_DEBUG("Parse HL id=" << jjj << " position search: (" << start << "," << buffer.Size() << ")" );
|
||||
// Stop the search to the end (to get the end of the pattern)
|
||||
@ -319,7 +319,7 @@ void Highlight::Parse2(int32_t start,
|
||||
if (HLP_FIND_ERROR != ret) {
|
||||
//APPL_INFO("Find Pattern in the Buffer : (" << resultat.beginStart << "," << resultat.endStop << ")" );
|
||||
// Add curent element in the list ...
|
||||
metaData.push_back(resultat);
|
||||
metaData.PushBack(resultat);
|
||||
elementStart = resultat.endStop-1;
|
||||
// Exit current cycle
|
||||
break;
|
||||
|
@ -59,19 +59,19 @@ class Highlight {
|
||||
void ReloadColor(void);
|
||||
void Parse(int32_t start,
|
||||
int32_t stop,
|
||||
std::vector<colorInformation_ts> &metaData,
|
||||
etk::VectorType<colorInformation_ts> &metaData,
|
||||
int32_t addingPos,
|
||||
EdnVectorBuf &buffer);
|
||||
void Parse2(int32_t start,
|
||||
int32_t stop,
|
||||
std::vector<colorInformation_ts> &metaData,
|
||||
etk::VectorType<colorInformation_ts> &metaData,
|
||||
EdnVectorBuf &buffer);
|
||||
private:
|
||||
void ParseRules(TiXmlNode *child, std::vector<HighlightPattern*> &mListPatern, int32_t level);
|
||||
etk::UString m_styleName; //!< curent style name (like "c++" or "c" or "script Bash")
|
||||
std::vector<etk::UString*> m_listExtentions; //!< List of possible extention for this high-light, like : ".c", ".cpp", ".h"
|
||||
std::vector<HighlightPattern*> m_listHighlightPass1; //!< List of ALL hightlight modules (pass 1 ==> when we load and wride data on the buffer)
|
||||
std::vector<HighlightPattern*> m_listHighlightPass2; //!< List of ALL hightlight modules (pass 2 ==> When we display the buffer( only the display area (100 lines)) )
|
||||
void ParseRules(TiXmlNode *child, etk::VectorType<HighlightPattern*> &mListPatern, int32_t level);
|
||||
etk::UString m_styleName; //!< curent style name (like "c++" or "c" or "script Bash")
|
||||
etk::VectorType<etk::UString*> m_listExtentions; //!< List of possible extention for this high-light, like : ".c", ".cpp", ".h"
|
||||
etk::VectorType<HighlightPattern*> m_listHighlightPass1; //!< List of ALL hightlight modules (pass 1 ==> when we load and wride data on the buffer)
|
||||
etk::VectorType<HighlightPattern*> m_listHighlightPass2; //!< List of ALL hightlight modules (pass 2 ==> When we display the buffer( only the display area (100 lines)) )
|
||||
};
|
||||
|
||||
|
||||
|
@ -35,7 +35,7 @@
|
||||
class localClassHighlightManager: public ewol::EObject
|
||||
{
|
||||
private:
|
||||
std::vector<Highlight*> listHighlight; //!< List of ALL hightlight modules
|
||||
etk::VectorType<Highlight*> listHighlight; //!< List of ALL hightlight modules
|
||||
public:
|
||||
// Constructeur
|
||||
localClassHighlightManager(void) {
|
||||
@ -44,14 +44,14 @@ class localClassHighlightManager: public ewol::EObject
|
||||
~localClassHighlightManager(void) {
|
||||
int32_t i;
|
||||
// clean all Element
|
||||
for (i=0; i< listHighlight.size(); i++) {
|
||||
for (i=0; i< listHighlight.Size(); i++) {
|
||||
if (NULL != listHighlight[i]) {
|
||||
delete(listHighlight[i]);
|
||||
listHighlight[i] = NULL;
|
||||
}
|
||||
}
|
||||
// clear the compleate list
|
||||
listHighlight.clear();
|
||||
listHighlight.Clear();
|
||||
};
|
||||
|
||||
/**
|
||||
@ -92,7 +92,7 @@ class localClassHighlightManager: public ewol::EObject
|
||||
Highlight* Get(etk::File &fileName)
|
||||
{
|
||||
int32_t i;
|
||||
for (i=0; i<listHighlight.size(); i++) {
|
||||
for (i=0; i<listHighlight.Size(); i++) {
|
||||
if (true == listHighlight[i]->FileNameCompatible(fileName) ) {
|
||||
return listHighlight[i];
|
||||
}
|
||||
@ -113,47 +113,47 @@ class localClassHighlightManager: public ewol::EObject
|
||||
{
|
||||
etk::UString xmlFilename = "lang_c.xml";
|
||||
Highlight *myHightline = new Highlight(xmlFilename);
|
||||
listHighlight.push_back(myHightline);
|
||||
listHighlight.PushBack(myHightline);
|
||||
|
||||
xmlFilename = "lang_boo.xml";
|
||||
myHightline = new Highlight(xmlFilename);
|
||||
listHighlight.push_back(myHightline);
|
||||
listHighlight.PushBack(myHightline);
|
||||
|
||||
xmlFilename = "lang_Makefile.xml";
|
||||
myHightline = new Highlight(xmlFilename);
|
||||
listHighlight.push_back(myHightline);
|
||||
listHighlight.PushBack(myHightline);
|
||||
|
||||
xmlFilename = "lang_asm.xml";
|
||||
myHightline = new Highlight(xmlFilename);
|
||||
listHighlight.push_back(myHightline);
|
||||
listHighlight.PushBack(myHightline);
|
||||
|
||||
xmlFilename = "lang_xml.xml";
|
||||
myHightline = new Highlight(xmlFilename);
|
||||
listHighlight.push_back(myHightline);
|
||||
listHighlight.PushBack(myHightline);
|
||||
|
||||
xmlFilename = "lang_php.xml";
|
||||
myHightline = new Highlight(xmlFilename);
|
||||
listHighlight.push_back(myHightline);
|
||||
listHighlight.PushBack(myHightline);
|
||||
|
||||
xmlFilename = "lang_bash.xml";
|
||||
myHightline = new Highlight(xmlFilename);
|
||||
listHighlight.push_back(myHightline);
|
||||
listHighlight.PushBack(myHightline);
|
||||
|
||||
xmlFilename = "lang_matlab.xml";
|
||||
myHightline = new Highlight(xmlFilename);
|
||||
listHighlight.push_back(myHightline);
|
||||
listHighlight.PushBack(myHightline);
|
||||
|
||||
xmlFilename = "lang_java.xml";
|
||||
myHightline = new Highlight(xmlFilename);
|
||||
listHighlight.push_back(myHightline);
|
||||
listHighlight.PushBack(myHightline);
|
||||
|
||||
xmlFilename = "lang_lua.xml";
|
||||
myHightline = new Highlight(xmlFilename);
|
||||
listHighlight.push_back(myHightline);
|
||||
listHighlight.PushBack(myHightline);
|
||||
|
||||
xmlFilename = "lang_in.xml";
|
||||
myHightline = new Highlight(xmlFilename);
|
||||
listHighlight.push_back(myHightline);
|
||||
listHighlight.PushBack(myHightline);
|
||||
|
||||
//myHightline->Display();
|
||||
}
|
||||
|
@ -118,7 +118,7 @@ void HighlightPattern::Display(void)
|
||||
}
|
||||
*/
|
||||
// Display all elements
|
||||
for (int32_t i=0; i< m_subPatern.size(); i++) {
|
||||
for (int32_t i=0; i< m_subPatern.Size(); i++) {
|
||||
APPL_INFO(" " << i << " SubPattern : " << m_subPatern[i]->GetName() );
|
||||
m_subPatern[i]->Display();
|
||||
}
|
||||
|
@ -33,7 +33,7 @@ class HighlightPattern;
|
||||
|
||||
#include <etk/RegExp.h>
|
||||
#include <Colorize.h>
|
||||
#include <vector>
|
||||
#include <etk/VectorType.h>
|
||||
#include <tinyXML/tinyxml.h>
|
||||
#include <EdnVectorBuf.h>
|
||||
|
||||
@ -72,17 +72,17 @@ class HighlightPattern {
|
||||
void ReloadColor(void);
|
||||
|
||||
private:
|
||||
int32_t m_level; //!< Level of the pattern ==> this is to overwrite next pattern when we create an higher ....
|
||||
etk::UString m_paternName; //!< Current style name (like "c++" or "c" or "script Bash")
|
||||
etk::UString m_colorName; //!< Current color name
|
||||
Colorize * m_color; //!< Link to the color manager
|
||||
etk::RegExp<EdnVectorBuf> * m_regExpStart; //!< Start of Regular expression
|
||||
etk::RegExp<EdnVectorBuf> * m_regExpStop; //!< Stop of Regular Expression
|
||||
bool m_haveStopPatern; //!< Stop patern presence
|
||||
bool m_multiline; //!< The patern is multiline
|
||||
uniChar_t m_escapeChar; //!< Escape char to prevent exeit of patern ....
|
||||
std::vector<HighlightPattern *> m_subPatern; //!< Under patern of this one
|
||||
// std::vector<HighlightPattern *> m_subColor; //!< Under Color in the start RegExp ...
|
||||
int32_t m_level; //!< Level of the pattern ==> this is to overwrite next pattern when we create an higher ....
|
||||
etk::UString m_paternName; //!< Current style name (like "c++" or "c" or "script Bash")
|
||||
etk::UString m_colorName; //!< Current color name
|
||||
Colorize * m_color; //!< Link to the color manager
|
||||
etk::RegExp<EdnVectorBuf> * m_regExpStart; //!< Start of Regular expression
|
||||
etk::RegExp<EdnVectorBuf> * m_regExpStop; //!< Stop of Regular Expression
|
||||
bool m_haveStopPatern; //!< Stop patern presence
|
||||
bool m_multiline; //!< The patern is multiline
|
||||
uniChar_t m_escapeChar; //!< Escape char to prevent exeit of patern ....
|
||||
etk::VectorType<HighlightPattern *> m_subPatern; //!< Under patern of this one
|
||||
// etk::VectorType<HighlightPattern *> m_subColor; //!< Under Color in the start RegExp ...
|
||||
};
|
||||
|
||||
#endif
|
||||
|
Loading…
x
Reference in New Issue
Block a user