[DEV] code style step 1

This commit is contained in:
2013-10-07 22:04:21 +02:00
parent 211c253116
commit d677075e16
45 changed files with 1890 additions and 1890 deletions

View File

@@ -17,7 +17,7 @@ appl::Buffer::Buffer(void) :
}
bool appl::Buffer::LoadFile(const etk::UString& _name)
bool appl::Buffer::loadFile(const etk::UString& _name)
{
APPL_DEBUG("Load file : '" << _name << "'");
m_fileName = _name;
@@ -33,7 +33,7 @@ bool appl::Buffer::LoadFile(const etk::UString& _name)
void appl::Buffer::SetFileName(const etk::UString& _name)
void appl::Buffer::setFileName(const etk::UString& _name)
{
// TODO : ...
}
@@ -47,7 +47,7 @@ void appl::Buffer::MoveCursorRight(appl::Buffer::moveMode _mode)
switch (_mode) {
default:
case moveLetter:
nbElement = Get(m_cursorPos, value);
nbElement = get(m_cursorPos, value);
if (nbElement>0) {
m_cursorPos += nbElement;
}
@@ -70,7 +70,7 @@ void appl::Buffer::MoveCursorLeft(appl::Buffer::moveMode _mode)
switch (_mode) {
default:
case moveLetter:
nbElement = GetBack(m_cursorPos-1, value);
nbElement = getBack(m_cursorPos-1, value);
if (nbElement>0) {
m_cursorPos -= nbElement;
}
@@ -86,7 +86,7 @@ void appl::Buffer::MoveCursorLeft(appl::Buffer::moveMode _mode)
void appl::Buffer::MoveCursorUp(esize_t _nbLine)
{
// Find the position of the start of the line.
// find the position of the start of the line.
esize_t lineStartPos = StartLine(m_cursorPos);
// check if we can go up ...
if (lineStartPos == 0) {
@@ -97,10 +97,10 @@ void appl::Buffer::MoveCursorUp(esize_t _nbLine)
m_cursorPreferredCol = CountDispChars(lineStartPos, m_cursorPos);
}
EWOL_DEBUG("ploop : " << m_cursorPreferredCol);
// Get the previous line
// get the previous line
esize_t prevLineStartPos = CountBackwardNLines(lineStartPos, _nbLine);
//APPL_INFO("Move Line UP result : prevLineStartPos=" << prevLineStartPos);
// Get the display char position
//APPL_INFO("Move line UP result : prevLineStartPos=" << prevLineStartPos);
// get the display char position
esize_t newPos = CountForwardDispChars(prevLineStartPos, m_cursorPreferredCol);
//APPL_INFO("Move to colomn : column=" << column << " newPos=" << newPos);
//SetInsertPosition(newPos);
@@ -110,10 +110,10 @@ void appl::Buffer::MoveCursorUp(esize_t _nbLine)
void appl::Buffer::MoveCursorDown(esize_t _nbLine)
{
// check if we are not at the end of Buffer
if (m_cursorPos == m_data.Size() ) {
if (m_cursorPos == m_data.size() ) {
return;
}
// Find the position of the start of the line.
// find the position of the start of the line.
esize_t lineStartPos = StartLine(m_cursorPos);
if (m_cursorPreferredCol < 0) {
@@ -122,8 +122,8 @@ void appl::Buffer::MoveCursorDown(esize_t _nbLine)
EWOL_DEBUG("ploop : " << m_cursorPreferredCol);
// get the next line :
esize_t nextLineStartPos = CountForwardNLines(lineStartPos, _nbLine);
//APPL_INFO("Move Line DOWN result : nextLineStartPos=" << nextLineStartPos);
// Get the display char position
//APPL_INFO("Move line DOWN result : nextLineStartPos=" << nextLineStartPos);
// get the display char position
esize_t newPos = CountForwardDispChars(nextLineStartPos, m_cursorPreferredCol);
//APPL_INFO("Move to colomn : column=" << column << " newPos=" << newPos);
//SetInsertPosition(newPos);
@@ -143,7 +143,7 @@ esize_t appl::Buffer::EndLine(esize_t _pos)
{
esize_t endPos;
if (false == Search(_pos, etk::UniChar::Return, endPos)) {
endPos = m_data.Size();
endPos = m_data.size();
}
return endPos;
}
@@ -153,17 +153,17 @@ bool appl::Buffer::Search(esize_t _pos, const etk::UniChar& _search, esize_t& _r
// move in the string
esize_t nbElementBuffer = 0;
etk::UniChar value;
for(esize_t iii=_pos ; iii<m_data.Size() ; iii+=nbElementBuffer ) {
nbElementBuffer = GetBack(iii, value);
for(esize_t iii=_pos ; iii<m_data.size() ; iii+=nbElementBuffer ) {
nbElementBuffer = getBack(iii, value);
if (value == _search) {
_result = iii;
return true;
}
if (nbElementBuffer<=0) {
if (nbElementBuffer <= 0) {
nbElementBuffer = 1;
}
}
_result = m_data.Size();
_result = m_data.size();
return false;
}
@@ -172,13 +172,13 @@ bool appl::Buffer::SearchBack(esize_t _pos, const etk::UniChar& _search, esize_t
// move in the string
esize_t nbElementBuffer = 0;
etk::UniChar value;
for(esize_t iii=_pos-1 ; iii>=0 ; iii-=nbElementBuffer ) {
nbElementBuffer = GetBack(iii, value);
for(esize_t iii=_pos-1 ; iii >= 0 ; iii-=nbElementBuffer ) {
nbElementBuffer = getBack(iii, value);
if (value == _search) {
_result = iii-nbElementBuffer;
return true;
}
if (nbElementBuffer<=0) {
if (nbElementBuffer <= 0) {
nbElementBuffer = 1;
}
}
@@ -187,44 +187,44 @@ bool appl::Buffer::SearchBack(esize_t _pos, const etk::UniChar& _search, esize_t
}
bool appl::Buffer::OnEventEntry(const ewol::EventEntry& _event) // TODO : , vec2 _displaySize)
bool appl::Buffer::onEventEntry(const ewol::EventEntry& _event) // TODO : , vec2 _displaySize)
{
//APPL_DEBUG(" event : " << _event);
if (_event.GetType() == ewol::keyEvent::keyboardChar) {
if (_event.getType() == ewol::keyEvent::keyboardChar) {
//APPL_DEBUG("KB EVENT : \"" << UTF8_data << "\" size=" << strlen(UTF8_data) << "type=" << (int32_t)typeEvent);
if (_event.GetStatus() != ewol::keyEvent::statusDown) {
if (_event.getStatus() != ewol::keyEvent::statusDown) {
return false;
}
if (_event.GetChar() == etk::UniChar::Tabulation) {
m_data.Insert(m_cursorPos, '\t');
if (_event.getChar() == etk::UniChar::Tabulation) {
m_data.insert(m_cursorPos, '\t');
m_cursorPos += 1;
} else if (_event.GetChar() == etk::UniChar::Return) {
m_data.Insert(m_cursorPos, '\n');
} else if (_event.getChar() == etk::UniChar::Return) {
m_data.insert(m_cursorPos, '\n');
m_cursorPos += 1;
} else if (_event.GetChar() == etk::UniChar::Suppress ) {
} else if (_event.getChar() == etk::UniChar::Suppress ) {
//APPL_INFO("keyEvent : <suppr> pos=" << m_cursorPos);
etk::UniChar value;
esize_t nbElement = Get(m_cursorPos, value);
esize_t nbElement = get(m_cursorPos, value);
if (nbElement>0) {
m_data.Remove(m_cursorPos, nbElement);
m_data.remove(m_cursorPos, nbElement);
}
} else if (_event.GetChar() == etk::UniChar::Delete) {
} else if (_event.getChar() == etk::UniChar::Delete) {
//APPL_INFO("keyEvent : <del> pos=" << m_cursorPos);
etk::UniChar value;
esize_t nbElement = GetBack(m_cursorPos-1, value);
esize_t nbElement = getBack(m_cursorPos-1, value);
if (nbElement>0) {
m_cursorPos -= nbElement;
m_data.Remove(m_cursorPos, nbElement);
m_data.remove(m_cursorPos, nbElement);
}
} else {
// normal adding char ...
char output[5];
int32_t nbElement = _event.GetChar().GetUtf8(output);
if (_event.GetSpecialKey().IsSetInsert() == false) {
m_data.Insert(m_cursorPos, (int8_t*)output, nbElement);
int32_t nbElement = _event.getChar().GetUtf8(output);
if (_event.getSpecialKey().isSetInsert() == false) {
m_data.insert(m_cursorPos, (int8_t*)output, nbElement);
} else {
etk::UniChar value;
esize_t nbElementRemove = Get(m_cursorPos, value);
esize_t nbElementRemove = get(m_cursorPos, value);
m_data.Replace(m_cursorPos, nbElementRemove, (int8_t*)output, nbElement);
}
m_cursorPos += nbElement;
@@ -232,10 +232,10 @@ bool appl::Buffer::OnEventEntry(const ewol::EventEntry& _event) // TODO : , vec2
return true;
}
// move events ...
if (_event.GetStatus() == ewol::keyEvent::statusDown) {
if (_event.getStatus() == ewol::keyEvent::statusDown) {
bool needUpdatePosition = true;
// check selection event ...
switch(_event.GetType()) {
switch(_event.getType()) {
case ewol::keyEvent::keyboardLeft:
//APPL_INFO("keyEvent : <LEFT>");
MoveCursorLeft();
@@ -282,10 +282,10 @@ bool appl::Buffer::OnEventEntry(const ewol::EventEntry& _event) // TODO : , vec2
}
esize_t appl::Buffer::Get(esize_t _pos, etk::UniChar& _value, unicode::charset_te _charset) const
esize_t appl::Buffer::get(esize_t _pos, etk::UniChar& _value, unicode::charset_te _charset) const
{
_value = '\0';
if (_pos<0 && _pos<m_data.Size()) {
if (_pos<0 && _pos<m_data.size()) {
return 0;
}
if (_charset == unicode::EDN_CHARSET_UTF8) {
@@ -293,22 +293,22 @@ esize_t appl::Buffer::Get(esize_t _pos, etk::UniChar& _value, unicode::charset_t
memset(tmpVal, 0, sizeof(tmpVal));
tmpVal[0] = m_data[_pos];
int8_t nbChar = etk::UniChar::TheoricUTF8Len(tmpVal[0]);
for (int32_t iii=1; iii<nbChar && _pos+iii<m_data.Size(); ++iii) {
for (int32_t iii=1; iii<nbChar && _pos+iii<m_data.size(); ++iii) {
tmpVal[iii] = m_data[_pos+iii];
}
// transform ...
int32_t nbElement = _value.SetUtf8(tmpVal);
int32_t nbElement = _value.setUtf8(tmpVal);
return nbElement;
}
// TODO :: need to trancode iso ==> UNICODE ...
_value.Set(m_data[_pos]);
// TODO :: need to trancode iso == > UNICODE ...
_value.set(m_data[_pos]);
return 1;
}
esize_t appl::Buffer::GetBack(esize_t _pos, etk::UniChar& _value, unicode::charset_te _charset) const
esize_t appl::Buffer::getBack(esize_t _pos, etk::UniChar& _value, unicode::charset_te _charset) const
{
_value = '\0';
if (_pos<0 && _pos<m_data.Size()) {
if (_pos<0 && _pos<m_data.size()) {
return 0;
}
if (_charset == unicode::EDN_CHARSET_UTF8) {
@@ -324,10 +324,10 @@ esize_t appl::Buffer::GetBack(esize_t _pos, etk::UniChar& _value, unicode::chars
++iii;
*pointerVal = m_data[_pos - iii];
};
int32_t nbElement = _value.SetUtf8(pointerVal);
int32_t nbElement = _value.setUtf8(pointerVal);
return nbElement;
}
_value.Set(m_data[_pos]);
_value.set(m_data[_pos]);
return 1;
}
@@ -338,48 +338,48 @@ static const char *ControlCodeTable[32] = {
void appl::Buffer::Expand(esize_t& _indent, const etk::UniChar& _value, etk::UString& _out) const
{
_out.Clear();
_out.clear();
int32_t tabDist = 4;
if (_value == etk::UniChar::Tabulation) {
int32_t nSpaces = tabDist - (_indent % tabDist);
for (int32_t iii=0; iii<nSpaces; iii++) {
_out.Append(etk::UniChar::Space);
_out.append(etk::UniChar::Space);
}
return;
}
// Convert ASCII control codes to readable character sequences
// convert ASCII control codes to readable character sequences
if (_value == etk::UniChar::Null) {
_out.Append(etk::UniChar('<'));
_out.Append(etk::UniChar('n'));
_out.Append(etk::UniChar('u'));
_out.Append(etk::UniChar('l'));
_out.Append(etk::UniChar('>'));
_out.append(etk::UniChar('<'));
_out.append(etk::UniChar('n'));
_out.append(etk::UniChar('u'));
_out.append(etk::UniChar('l'));
_out.append(etk::UniChar('>'));
return;
}
if (_value == etk::UniChar::Return) {
// nothing to display...
return;
}
if (_value.Get() <= 31) {
_out.Append(etk::UniChar('<'));
const char * tmp = ControlCodeTable[_value.Get()];
if (_value.get() <= 31) {
_out.append(etk::UniChar('<'));
const char * tmp = ControlCodeTable[_value.get()];
while (*tmp!='\0') {
_out.Append(etk::UniChar(*tmp));
_out.append(etk::UniChar(*tmp));
tmp++;
}
_out.Append(etk::UniChar('>'));
_out.append(etk::UniChar('>'));
return;
}
if (_value == etk::UniChar::Delete) {
_out.Append(etk::UniChar('<'));
_out.Append(etk::UniChar('d'));
_out.Append(etk::UniChar('e'));
_out.Append(etk::UniChar('l'));
_out.Append(etk::UniChar('>'));
_out.append(etk::UniChar('<'));
_out.append(etk::UniChar('d'));
_out.append(etk::UniChar('e'));
_out.append(etk::UniChar('l'));
_out.append(etk::UniChar('>'));
return;
}
// nothing to do ...
_out.Append(_value);
_out.append(_value);
//APPL_DEBUG("plop : " << _out);
}
@@ -390,13 +390,13 @@ int32_t appl::Buffer::CountDispChars(esize_t _posStart, esize_t _posEnd)
esize_t bufferElementSize;
etk::UniChar value;
//APPL_DEBUG("_posStart="<< _posStart << " _posEnd=" << _posEnd);
for(int32_t iii=_posStart; iii<_posEnd && iii<m_data.Size() ; iii+=bufferElementSize ) {
for(int32_t iii=_posStart; iii<_posEnd && iii<m_data.size() ; iii+=bufferElementSize ) {
// get the element value:
bufferElementSize = Get(iii, value);
bufferElementSize = get(iii, value);
//APPL_DEBUG(" get : " << value << " size=" << bufferElementSize);
Expand(charCount, value, expanded);
charCount += expanded.Size();
if (bufferElementSize<=0) {
charCount += expanded.size();
if (bufferElementSize <= 0) {
bufferElementSize = 1;
}
}
@@ -411,15 +411,15 @@ esize_t appl::Buffer::CountForwardDispChars(esize_t _posStart, int32_t _nChars)
esize_t bufferElementSize;
etk::UniChar value;
int32_t iii;
for(iii = _posStart; charCount<_nChars && iii<m_data.Size() ; iii+=bufferElementSize ) {
for(iii = _posStart; charCount<_nChars && iii<m_data.size() ; iii+=bufferElementSize ) {
// get the element value:
bufferElementSize = Get(iii, value);
bufferElementSize = get(iii, value);
if (value == etk::UniChar::Return) {
return iii;
}
Expand(charCount, value, expanded);
charCount += expanded.Size();
if (bufferElementSize<=0) {
charCount += expanded.size();
if (bufferElementSize <= 0) {
bufferElementSize = 1;
}
}
@@ -431,56 +431,56 @@ esize_t appl::Buffer::CountForwardNLines(esize_t _startPos, int32_t _nLines)
{
if (_nLines <= 0) {
return _startPos;
} else if (_startPos > m_data.Size() ) {
return m_data.Size();
} else if (_startPos > m_data.size() ) {
return m_data.size();
}
esize_t bufferElementSize;
etk::UniChar value;
int32_t lineCount = 0;
//APPL_INFO("startPos=" << startPos << " nLines=" << nLines);
for(int32_t iii = _startPos+1; iii<m_data.Size() ; iii+=bufferElementSize ) {
for(int32_t iii = _startPos+1; iii<m_data.size() ; iii+=bufferElementSize ) {
// get the element value:
bufferElementSize = Get(iii, value);
bufferElementSize = get(iii, value);
if (value == etk::UniChar::Return) {
lineCount++;
if (lineCount == _nLines) {
//APPL_INFO(" ==> (1) at position=" << myPosIt.Position()+1 );
//APPL_INFO(" == > (1) at position=" << myPosIt.Position()+1 );
return iii+1;
}
}
if (bufferElementSize<=0) {
if (bufferElementSize <= 0) {
bufferElementSize = 1;
}
}
//APPL_INFO(" ==> (2) at position=" << myPosIt.Position() );
return m_data.Size();
//APPL_INFO(" == > (2) at position=" << myPosIt.Position() );
return m_data.size();
}
esize_t appl::Buffer::CountBackwardNLines(esize_t _startPos, int32_t _nLines)
{
if (_startPos <= 0) {
return 0;
} else if (_startPos > m_data.Size() ) {
_startPos = m_data.Size();
} else if (_startPos > m_data.size() ) {
_startPos = m_data.size();
}
//APPL_INFO("startPos=" << startPos << " nLines=" << nLines);
esize_t bufferElementSize;
etk::UniChar value;
int32_t lineCount = 0;
for(int32_t iii = _startPos-1; iii>=0 ; iii-=bufferElementSize ) {
for(int32_t iii = _startPos-1; iii >= 0 ; iii-=bufferElementSize ) {
// get the element value:
bufferElementSize = GetBack(iii, value);
bufferElementSize = getBack(iii, value);
if (value == etk::UniChar::Return) {
lineCount++;
if (lineCount >= _nLines) {
//APPL_INFO(" ==> (1) at position=" << myPosIt.Position()+1 );
//APPL_INFO(" == > (1) at position=" << myPosIt.Position()+1 );
return iii+1;
}
}
if (bufferElementSize<=0) {
if (bufferElementSize <= 0) {
bufferElementSize = 1;
}
}
//APPL_INFO(" ==> (2) at position=0");
//APPL_INFO(" == > (2) at position=0");
return 0;
}

View File

@@ -28,15 +28,15 @@ namespace appl
etk::UString m_fileName; //!< name of the file (with his path)
public:
/**
* @brief Get the curent filename of the Buffer
* @brief get the curent filename of the Buffer
*/
const etk::UString& GetFileName(void) { return m_fileName; }
bool LoadFile(const etk::UString& _name);
void SetFileName(const etk::UString& _name);
const etk::UString& getFileName(void) { return m_fileName; }
bool loadFile(const etk::UString& _name);
void setFileName(const etk::UString& _name);
bool m_isModify; //!< true if the file is modify
etk::Buffer m_data; //!< copy of the file buffer
public:
etk::Buffer& GetData(void) { return m_data; };
etk::Buffer& getData(void) { return m_data; };
/*
appl::History m_history;
Highlight m_highlight;
@@ -46,23 +46,23 @@ namespace appl
public:
esize_t m_cursorPos; //!< cursor position.
int32_t m_cursorPreferredCol; //!< position of the cursor when up and down is done.
bool OnEventEntry(const ewol::EventEntry& _event);
bool onEventEntry(const ewol::EventEntry& _event);
/**
* @brief Get the next element in the buffer.
* @brief get the next element in the buffer.
* @param[in] _pos Position in the buffer
* @param[out] _value Unicode value read in the buffer
* @param[in] _charset Charset used to parse the current buffer
* @return number ofelement read in the buffer (to increment the position)
*/
esize_t Get(esize_t _pos, etk::UniChar& _value, unicode::charset_te _charset = unicode::EDN_CHARSET_UTF8) const;
esize_t get(esize_t _pos, etk::UniChar& _value, unicode::charset_te _charset = unicode::EDN_CHARSET_UTF8) const;
/**
* @brief Get the previous element in the buffer.
* @brief get the previous element in the buffer.
* @param[in] _pos Position in the buffer (last element of the element)
* @param[out] _value Unicode value read in the buffer
* @param[in] _charset Charset used to parse the current buffer
* @return number of element read in the buffer (to increment the position)
*/
esize_t GetBack(esize_t _pos, etk::UniChar& _value, unicode::charset_te _charset = unicode::EDN_CHARSET_UTF8) const;
esize_t getBack(esize_t _pos, etk::UniChar& _value, unicode::charset_te _charset = unicode::EDN_CHARSET_UTF8) const;
/**
* @brief Expand the specify char to have a user frendly display for special char and tabs
* @param[in] _indent Curent indentation in the line
@@ -97,13 +97,13 @@ namespace appl
*/
void MoveCursorDown(esize_t _nbLine);
/**
* @brief Get the start of a line with the position in the buffer.
* @brief get the start of a line with the position in the buffer.
* @param[in] _pos position in the buffer.
* @return The position in the buffer of the start of the line.
*/
esize_t StartLine(esize_t _pos);
/**
* @brief Get the end of a line with the position in the buffer.
* @brief get the end of a line with the position in the buffer.
* @param[in] _pos position in the buffer.
* @return The position in the buffer of the end of the line.
*/
@@ -126,7 +126,7 @@ namespace appl
bool SearchBack(esize_t _pos, const etk::UniChar& _search, esize_t& _result);
/**
* @brief Count the number of displayed characters between buffer position
* Displayed characters are the characters shown on the screen to represent characters in the
* displayed characters are the characters shown on the screen to represent characters in the
* buffer, where tabs and control characters are expanded
* @param[in] _posStart start position
* @param[in] _posEnd End position
@@ -141,16 +141,16 @@ namespace appl
*/
esize_t CountForwardDispChars(esize_t _posStart, int32_t _nChars);
/**
* @brief Find the first character of the line "nLines" forward
* @brief find the first character of the line "nLines" forward
* @param[in,out] _startPos Start position.
* @param[in,out] _nLines Number of line to count.
* @return position of the starting the line.
*/
esize_t CountForwardNLines(esize_t _startPos, int32_t _nLines);
/**
* @brief Find the first character of the line "nLines" backwards
* @brief find the first character of the line "nLines" backwards
* @param[in,out] _startPos Start position to count (this caracter is not counted)
* @param[in,out] _nLines Number of line to count (if ==0 means find the beginning of the line)
* @param[in,out] _nLines Number of line to count (if == 0 means find the beginning of the line)
* @return position of the starting the line
*/
esize_t CountBackwardNLines(esize_t _startPos, int32_t _nLines);

View File

@@ -21,29 +21,29 @@ class classBufferManager: public ewol::EObject
// Constructeur
classBufferManager(void);
~classBufferManager(void);
const char * const GetObjectType(void)
const char * const getObjectType(void)
{
return "ApplBufferManager";
}
public:
virtual void OnReceiveMessage(const ewol::EMessage& _msg);
virtual void onReceiveMessage(const ewol::EMessage& _msg);
private:
// return the ID of the buffer allocated
// create a buffer with no element
int32_t Create(void);
// open curent filename
int32_t Open(etk::FSNode &myFile);
bool Remove(int32_t BufferID);
int32_t open(etk::FSNode &myFile);
bool remove(int32_t BufferID);
public:
int32_t GetSelected(void) { return m_idSelected;};
//void SetSelected(int32_t id) {m_idSelected = id;};
BufferText* Get(int32_t BufferID);
int32_t getSelected(void) { return m_idSelected;};
//void setSelected(int32_t id) {m_idSelected = id;};
BufferText* get(int32_t BufferID);
bool Exist(int32_t BufferID);
bool Exist(etk::FSNode &myFile);
int32_t GetId(etk::FSNode &myFile);
// return the number of buffer (open in the past) if 5 buffer open and 4 close ==> return 5
uint32_t Size(void);
uint32_t SizeOpen(void);
int32_t getId(etk::FSNode &myFile);
// return the number of buffer (open in the past) if 5 buffer open and 4 close == > return 5
uint32_t size(void);
uint32_t sizeOpen(void);
int32_t WitchBuffer(int32_t iEmeElement);
@@ -51,7 +51,7 @@ class classBufferManager: public ewol::EObject
etk::Vector<BufferText*> listBuffer; //!< element List of the char Elements
void RemoveAll(void); //!< remove all buffer
void removeAll(void); //!< remove all buffer
int32_t m_idSelected;
};
@@ -71,25 +71,25 @@ classBufferManager::classBufferManager(void)
classBufferManager::~classBufferManager(void)
{
//clean All Buffer
APPL_INFO("~classBufferManager::RemoveAll();");
RemoveAll();
APPL_INFO("~classBufferManager::removeAll();");
removeAll();
// clear The list of Buffer
APPL_INFO("~classBufferManager::listBuffer.Clear();");
listBuffer.Clear();
APPL_INFO("~classBufferManager::listBuffer.clear();");
listBuffer.clear();
}
void classBufferManager::OnReceiveMessage(const ewol::EMessage& _msg)
void classBufferManager::onReceiveMessage(const ewol::EMessage& _msg)
{
ewol::EObject::OnReceiveMessage(_msg);
ewol::EObject::onReceiveMessage(_msg);
if (_msg.GetMessage() == ednMsgBufferId) {
if (_msg.getMessage() == ednMsgBufferId) {
// select a new buffer ID :
if (_msg.GetData() == "") {
if (_msg.getData() == "") {
APPL_ERROR("Request select buffer ID = \"\" ");
} else {
int32_t newID = -1;
sscanf(_msg.GetData().c_str(), "%d", &newID);
sscanf(_msg.getData().c_str(), "%d", &newID);
if(true == Exist(newID)) {
m_idSelected = newID;
} else {
@@ -97,19 +97,19 @@ void classBufferManager::OnReceiveMessage(const ewol::EMessage& _msg)
APPL_ERROR("Request a non existant ID : " << newID << " reset to -1...");
}
}
} else if (_msg.GetMessage() == ednMsgGuiNew) {
} else if (_msg.getMessage() == ednMsgGuiNew) {
int32_t newOne = Create();
if (-1 != newOne) {
m_idSelected = newOne;
SendMultiCast(ednMsgBufferId, m_idSelected);
SendMultiCast(ednMsgBufferListChange);
}
} else if (_msg.GetMessage() == ednMsgOpenFile) {
if (_msg.GetData() != "" ) {
etk::FSNode myFile(_msg.GetData());
if (myFile.GetNodeType() == etk::FSN_FILE) {
APPL_DEBUG("request open file = \"" << _msg.GetData() << "\" ?= \"" << myFile << "\"");
int32_t newOne = Open(myFile);
} else if (_msg.getMessage() == ednMsgOpenFile) {
if (_msg.getData() != "" ) {
etk::FSNode myFile(_msg.getData());
if (myFile.getNodeType() == etk::FSN_FILE) {
APPL_DEBUG("request open file = \"" << _msg.getData() << "\" ?= \"" << myFile << "\"");
int32_t newOne = open(myFile);
if (-1 != newOne) {
m_idSelected = newOne;
SendMultiCast(ednMsgBufferId, m_idSelected);
@@ -119,57 +119,57 @@ void classBufferManager::OnReceiveMessage(const ewol::EMessage& _msg)
APPL_ERROR("Can not open the file : \"" << myFile << "\"");
}
} else {
APPL_ERROR("Request to open an Unknox element file : " << myFile << " type:" << myFile.GetNodeType());
APPL_ERROR("Request to open an Unknox element file : " << myFile << " type:" << myFile.getNodeType());
}
}
} else if (_msg.GetMessage() == ednMsgGuiSave) {
if (_msg.GetData() == "") {
} else if (_msg.getMessage() == ednMsgGuiSave) {
if (_msg.getData() == "") {
APPL_ERROR("Null data for close file ... ");
} else {
if (_msg.GetData() == "current") {
if (_msg.getData() == "current") {
// Check buffer existence
if(true == Exist(m_idSelected)) {
// If no name ==> request a Gui display ...
if (Get(m_idSelected)->HaveName() == false) {
// If no name == > request a Gui display ...
if (get(m_idSelected)->haveName() == false) {
SendMultiCast(ednMsgGuiSaveAs, "current");
} else {
Get(m_idSelected)->Save();
get(m_idSelected)->Save();
}
}
} else {
int32_t newId;
sscanf(_msg.GetData().c_str(), "%d", &newId);
sscanf(_msg.getData().c_str(), "%d", &newId);
if (false == Exist(newId)) {
APPL_ERROR("Request a save As with a non existant ID=" << newId);
} else {
// If no name ==> request a Gui display ...
if (Get(newId)->HaveName() == false) {
// If no name == > request a Gui display ...
if (get(newId)->haveName() == false) {
SendMultiCast(ednMsgGuiSaveAs, newId);
} else {
Get(m_idSelected)->Save();
get(m_idSelected)->Save();
}
}
SendMultiCast(ednMsgBufferState, "saved");
}
}
} else if (_msg.GetMessage() == ednMsgGuiClose) {
if (_msg.GetData() == "") {
} else if (_msg.getMessage() == ednMsgGuiClose) {
if (_msg.getData() == "") {
APPL_ERROR("Null data for close file ... ");
} else {
if (_msg.GetData() == "All") {
if (_msg.getData() == "All") {
} else {
int32_t closeID = -1;
if (_msg.GetData() == "current") {
if (_msg.getData() == "current") {
closeID = m_idSelected;
APPL_DEBUG("Close specific buffer ID" << closeID);
} else {
// close specific buffer ...
sscanf(_msg.GetData().c_str(), "%d", &closeID);
sscanf(_msg.getData().c_str(), "%d", &closeID);
APPL_DEBUG("Close specific buffer ID="<< closeID);
}
if(true == Exist(closeID)) {
// Get the new display buffer
// get the new display buffer
if (m_idSelected == closeID) {
// Try previous buffer
int32_t destBuffer = -1;
@@ -181,7 +181,7 @@ void classBufferManager::OnReceiveMessage(const ewol::EMessage& _msg)
}
// 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;
@@ -192,25 +192,25 @@ void classBufferManager::OnReceiveMessage(const ewol::EMessage& _msg)
m_idSelected = destBuffer;
SendMultiCast(ednMsgBufferId, destBuffer);
}
// Remove requested buffer
Remove(closeID);
// remove requested buffer
remove(closeID);
SendMultiCast(ednMsgBufferListChange);
} else {
APPL_ERROR("Request Close of a non existant ID : " << closeID);
APPL_ERROR("Request close of a non existant ID : " << closeID);
}
}
}
} else if (_msg.GetMessage() == ednMsgCodeViewSelectedId) {
} else if (_msg.getMessage() == ednMsgCodeViewSelectedId) {
//Change the selected buffer
if (_msg.GetData() == "") {
if (_msg.getData() == "") {
APPL_ERROR("Null data for changing buffer ID file ... ");
} else {
int32_t newId;
sscanf(_msg.GetData().c_str(), "%d", &newId);
sscanf(_msg.getData().c_str(), "%d", &newId);
if (true == Exist(newId)) {
m_idSelected = newId;
} else {
APPL_ERROR("code biew request the selection of an non -existant buffer ==> reset to -1");
APPL_ERROR("code biew request the selection of an non -existant buffer == > reset to -1");
m_idSelected = -1;
}
SendMultiCast(ednMsgBufferId, m_idSelected);
@@ -222,11 +222,11 @@ void classBufferManager::OnReceiveMessage(const ewol::EMessage& _msg)
{
// Check buffer existence
if(true == Exist(dataID)) {
// If no name ==> request a Gui display ...
if (Get(dataID)->HaveName() == false) {
// If no name == > request a Gui display ...
if (get(dataID)->haveName() == false) {
SendMessage(APPL_MSG__GUI_SHOW_SAVE_AS, dataID);
} else {
Get(dataID)->Save();
get(dataID)->Save();
}
}
break;
@@ -241,18 +241,18 @@ void classBufferManager::OnReceiveMessage(const ewol::EMessage& _msg)
/**
* @brief Remove all buffer opened
* @brief remove all buffer opened
*
* @param[in,out] ---
*
* @return ---
*
*/
void classBufferManager::RemoveAll(void)
void classBufferManager::removeAll(void)
{
int32_t i;
for (i=0; i<listBuffer.Size(); i++) {
Remove(i);
for (i=0; i<listBuffer.size(); i++) {
remove(i);
}
SendMultiCast(ednMsgGuiClose, "All");
}
@@ -271,9 +271,9 @@ int32_t classBufferManager::Create(void)
{
// allocate a new Buffer
BufferText *myBuffer = new BufferText();
// Add at the list of element
listBuffer.PushBack(myBuffer);
int32_t basicID = listBuffer.Size() - 1;
// add at the list of element
listBuffer.pushBack(myBuffer);
int32_t basicID = listBuffer.size() - 1;
return basicID;
}
@@ -288,30 +288,30 @@ int32_t classBufferManager::Create(void)
* @todo : check if this file is not curently open and return the old ID
*
*/
int32_t classBufferManager::Open(etk::FSNode &myFile)
int32_t classBufferManager::open(etk::FSNode &myFile)
{
if (false == Exist(myFile)) {
// allocate a new Buffer
BufferText *myBuffer = new BufferText(myFile);
// Add at the list of element
listBuffer.PushBack(myBuffer);
return listBuffer.Size() - 1;
// add at the list of element
listBuffer.pushBack(myBuffer);
return listBuffer.size() - 1;
} else {
// the buffer already existed ==> we open it ...
return GetId(myFile);
// the buffer already existed == > we open it ...
return getId(myFile);
}
}
BufferText * classBufferManager::Get(int32_t BufferID)
BufferText * classBufferManager::get(int32_t BufferID)
{
// possible special case : -1;
if (-1 >= BufferID) {
return NULL;
}
// 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];
@@ -319,7 +319,7 @@ BufferText * 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 NULL;
}
@@ -331,7 +331,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;
@@ -343,21 +343,21 @@ bool classBufferManager::Exist(int32_t BufferID)
bool classBufferManager::Exist(etk::FSNode &myFile )
{
if (-1 == GetId(myFile)) {
if (-1 == getId(myFile)) {
return false;
}
return true;
}
int32_t classBufferManager::GetId(etk::FSNode &myFile)
int32_t classBufferManager::getId(etk::FSNode &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) {
if ( listBuffer[iii]->getFileName() == myFile) {
return iii;
}
}
@@ -366,18 +366,18 @@ int32_t classBufferManager::GetId(etk::FSNode &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 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 ...
uint32_t classBufferManager::SizeOpen(void)
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++;
@@ -394,18 +394,18 @@ uint32_t classBufferManager::SizeOpen(void)
* @return ---
*
*/
bool classBufferManager::Remove(int32_t BufferID)
bool classBufferManager::remove(int32_t BufferID)
{
if (-1 >= 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...
/*
if (false == IsSaved(BufferID) ) {
if (false == isSaved(BufferID) ) {
APPL_INFO("Buffer " << BufferID << " : Not Saved", BufferID);
}
*/
@@ -413,7 +413,7 @@ bool classBufferManager::Remove(int32_t BufferID)
delete( listBuffer[BufferID] );
listBuffer[BufferID] = NULL;
/*
ewol::widgetMessageMultiCast::Send(GetWidgetId(), ednMsgBufferListChange);
ewol::widgetMessageMultiCast::Send(getWidgetId(), ednMsgBufferListChange);
*/
return true;
} else {
@@ -421,7 +421,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;
}
}
@@ -437,7 +437,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 :
@@ -456,10 +456,10 @@ int32_t classBufferManager::WitchBuffer(int32_t iEmeElement)
static classBufferManager * localManager = NULL;
void BufferManager::Init(void)
void BufferManager::init(void)
{
if (NULL != localManager) {
EWOL_ERROR("classBufferManager ==> already exist, just unlink the previous ...");
EWOL_ERROR("classBufferManager == > already exist, just unlink the previous ...");
localManager = NULL;
}
localManager = new classBufferManager();
@@ -472,35 +472,35 @@ void BufferManager::Init(void)
void BufferManager::UnInit(void)
{
if (NULL == localManager) {
EWOL_ERROR("classBufferManager ==> request UnInit, but does not exist ...");
EWOL_ERROR("classBufferManager == > request UnInit, but does not exist ...");
return;
}
delete(localManager);
localManager = NULL;
}
int32_t BufferManager::GetSelected(void)
int32_t BufferManager::getSelected(void)
{
if (NULL == localManager) {
EWOL_ERROR("classBufferManager ==> request UnInit, but does not exist ...");
EWOL_ERROR("classBufferManager == > request UnInit, but does not exist ...");
return -1;
}
return localManager->GetSelected();
return localManager->getSelected();
}
BufferText * BufferManager::Get(int32_t BufferID)
BufferText * BufferManager::get(int32_t BufferID)
{
if (NULL == localManager) {
EWOL_ERROR("classBufferManager ==> request UnInit, but does not exist ...");
EWOL_ERROR("classBufferManager == > request UnInit, but does not exist ...");
return NULL;
}
return localManager->Get(BufferID);
return localManager->get(BufferID);
}
bool BufferManager::Exist(int32_t BufferID)
{
if (NULL == localManager) {
EWOL_ERROR("classBufferManager ==> request UnInit, but does not exist ...");
EWOL_ERROR("classBufferManager == > request UnInit, but does not exist ...");
return false;
}
return localManager->Exist(BufferID);
@@ -509,43 +509,43 @@ bool BufferManager::Exist(int32_t BufferID)
bool BufferManager::Exist(etk::FSNode &myFile)
{
if (NULL == localManager) {
EWOL_ERROR("classBufferManager ==> request UnInit, but does not exist ...");
EWOL_ERROR("classBufferManager == > request UnInit, but does not exist ...");
return false;
}
return localManager->Exist(myFile);
}
int32_t BufferManager::GetId(etk::FSNode &myFile)
int32_t BufferManager::getId(etk::FSNode &myFile)
{
if (NULL == localManager) {
EWOL_ERROR("classBufferManager ==> request UnInit, but does not exist ...");
EWOL_ERROR("classBufferManager == > request UnInit, but does not exist ...");
return -1;
}
return localManager->GetId(myFile);
return localManager->getId(myFile);
}
uint32_t BufferManager::Size(void)
uint32_t BufferManager::size(void)
{
if (NULL == localManager) {
EWOL_ERROR("classBufferManager ==> request UnInit, but does not exist ...");
EWOL_ERROR("classBufferManager == > request UnInit, but does not exist ...");
return 0;
}
return localManager->Size();
return localManager->size();
}
uint32_t BufferManager::SizeOpen(void)
uint32_t BufferManager::sizeOpen(void)
{
if (NULL == localManager) {
EWOL_ERROR("classBufferManager ==> request UnInit, but does not exist ...");
EWOL_ERROR("classBufferManager == > request UnInit, but does not exist ...");
return 0;
}
return localManager->SizeOpen();
return localManager->sizeOpen();
}
int32_t BufferManager::WitchBuffer(int32_t iEmeElement)
{
if (NULL == localManager) {
EWOL_ERROR("classBufferManager ==> request UnInit, but does not exist ...");
EWOL_ERROR("classBufferManager == > request UnInit, but does not exist ...");
return -1;
}
return localManager->WitchBuffer(iEmeElement);

View File

@@ -15,16 +15,16 @@
namespace BufferManager
{
void Init(void);
void init(void);
void UnInit(void);
int32_t GetSelected(void);
BufferText* Get(int32_t BufferID);
int32_t getSelected(void);
BufferText* get(int32_t BufferID);
bool Exist(int32_t BufferID);
bool Exist(etk::FSNode &myFile);
int32_t GetId(etk::FSNode &myFile);
// return the number of buffer (open in the past) if 5 buffer open and 4 close ==> return 5
uint32_t Size(void);
uint32_t SizeOpen(void);
int32_t getId(etk::FSNode &myFile);
// return the number of buffer (open in the past) if 5 buffer open and 4 close == > return 5
uint32_t size(void);
uint32_t sizeOpen(void);
int32_t WitchBuffer(int32_t iEmeElement);
};

File diff suppressed because it is too large Load Diff

View File

@@ -42,7 +42,7 @@ typedef struct{
uint32_t startLineDisplay; //!< First line display.
uint32_t startColomnDisplay; //!< First Colomn displayed
uint32_t diplayableColomn; //!< NB colomn that can be displayed
uint32_t diplayableLine; //!< NB Line that can be displayed
uint32_t diplayableLine; //!< NB line that can be displayed
}infoStatBuffer_ts;
@@ -56,31 +56,31 @@ class BufferText
bool m_updatePositionRequested; //!< if a position xhange in the windows ...
vec2 m_maximumSize; //!< current maxSize of the buffer
public:
void SetModify(bool status);
virtual vec2 GetBorderSize(void);
void setModify(bool status);
virtual vec2 getBorderSize(void);
void RequestUpdateOfThePosition(void) { m_updatePositionRequested = true; };
void SetMaximumSize(vec2 maxSize) { m_maximumSize = maxSize; };
bool NeedToUpdateDisplayPosition(void);
vec2 GetMaxSize(void) { return m_maximumSize; };
bool IsModify(void);
void setMaximumSize(vec2 maxSize) { m_maximumSize = maxSize; };
bool needToUpdateDisplayPosition(void);
vec2 getMaxSize(void) { return m_maximumSize; };
bool isModify(void);
public:
etk::FSNode GetFileName(void) { return m_fileName; };
etk::FSNode getFileName(void) { return m_fileName; };
void SetFileName(etk::FSNode &newName)
void setFileName(etk::FSNode &newName)
{
m_fileName = newName;
m_haveName = true;
NameChange();
};
void SetFileName(etk::UString &newName)
void setFileName(etk::UString &newName)
{
m_fileName.SetName(newName);
m_fileName.setName(newName);
m_haveName = true;
NameChange();
};
bool HaveName(void)
bool haveName(void)
{
return m_haveName;
}
@@ -90,12 +90,12 @@ class BufferText
virtual ~BufferText(void);
void Save(void);
void GetInfo(infoStatBuffer_ts &infoToUpdate);
void SetLineDisplay(uint32_t lineNumber);
int32_t Display(ewol::Text& OOText,
void getInfo(infoStatBuffer_ts &infoToUpdate);
void setLineDisplay(uint32_t lineNumber);
int32_t display(ewol::Text& OOText,
int32_t offsetX, int32_t offsetY,
int32_t sizeX, int32_t sizeY);
void AddChar(uniChar_t unicodeData);
void addChar(uniChar_t unicodeData);
void cursorMove(ewol::keyEvent::keyboard_te moveTypeEvent);
void MouseSelectFromCursorTo(vec2 pos);
void MouseEvent(vec2 pos);
@@ -108,22 +108,22 @@ class BufferText
void Search(etk::UString &data, bool back, bool caseSensitive, bool wrap, bool regExp);
void Replace(etk::UString &data);
int32_t FindLine(etk::UString &data);
int32_t findLine(etk::UString &data);
void JumpAtLine(int32_t newLine);
int32_t GetCurrentLine(void);
int32_t getCurrentLine(void);
void RemoveLine(void);
void removeLine(void);
void SelectAll(void);
void SelectNone(void);
void Undo(void);
void Redo(void);
void SetCharset(unicode::charset_te newCharset);
int32_t GetNumberOfLine(void);
void setCharset(unicode::charset_te newCharset);
int32_t getNumberOfLine(void);
protected:
void NameChange(void);
private:
int32_t GetLineNumberNumberOfElement(void);
int32_t getLineNumberNumberOfElement(void);
// Direct buffer IO
EdnBuf m_EdnBuf; //!< buffer associated on this displayer
@@ -139,15 +139,15 @@ class BufferText
private:
bool m_centerRequested;
public:
virtual vec2 GetPosition(int32_t fontId, bool& centerRequested);
virtual vec2 getPosition(int32_t fontId, bool& centerRequested);
private:
bool TextDMoveUp(int32_t offset);
bool TextDMoveDown(int32_t offset);
void SetInsertPosition(int32_t newPosition, bool insertChar = false);
void setInsertPosition(int32_t newPosition, bool insertChar = false);
int32_t GetMousePosition(vec2 pos);
int32_t getMousePosition(vec2 pos);
void DrawLineNumber(ewol::Text* OOText, int32_t sizeX, int32_t sizeY, int32_t nbColomn, int32_t lineNumber, int32_t positionY);
void drawLineNumber(ewol::Text* OOText, int32_t sizeX, int32_t sizeY, int32_t nbColomn, int32_t lineNumber, int32_t positionY);
};

View File

@@ -34,7 +34,7 @@ static const char *ControlCodeTable[32] = {
*/
EdnBuf::EdnBuf(void)
{
// TODO : Set it configurable !!!
// TODO : set it configurable !!!
m_tabDist = 8;
m_useTabs = true;
@@ -61,7 +61,7 @@ EdnBuf::EdnBuf(void)
*/
EdnBuf::~EdnBuf(void)
{
// TODO : Remove history and Future
// TODO : remove history and Future
}
/**
@@ -80,7 +80,7 @@ bool EdnBuf::DumpIn(etk::FSNode &file)
/**
* @brief Load in the current file open
* @brief load in the current file open
*
* @param[in,out] myFile pointer on the file where data might be read
*
@@ -91,10 +91,10 @@ bool EdnBuf::DumpFrom(etk::FSNode &file)
{
if (true == m_data.DumpFrom(file) ) {
// set no selection
UpdateSelection(0, 0, m_data.Size() );
updateSelection(0, 0, m_data.size() );
// generate HighLight
CleanHighLight();
GenerateHighLightAt(0, m_data.Size());
generateHighLightAt(0, m_data.size());
CountNumberOfLines();
return true;
}
@@ -102,53 +102,53 @@ bool EdnBuf::DumpFrom(etk::FSNode &file)
}
void EdnBuf::GetAll(etk::Vector<int8_t> &text)
void EdnBuf::getAll(etk::Vector<int8_t> &text)
{
// Clean output vector
text.Clear();
// Set data on the vector
text = m_data.Get(0, m_data.Size());
text.clear();
// set data on the vector
text = m_data.get(0, m_data.size());
}
void EdnBuf::SetAll(etk::Vector<int8_t> &text)
void EdnBuf::setAll(etk::Vector<int8_t> &text)
{
etk::Vector<int8_t> deletedText;
// extract all data of the buffer :
GetAll(deletedText);
getAll(deletedText);
// Remove all data in the buffer:
m_data.Clear();
// remove all data in the buffer:
m_data.clear();
// inset text data :
m_data.Insert(0, 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);
eventModification(0, m_data.size(), deletedText);
}
void EdnBuf::GetRange(int32_t start, int32_t end, etk::Vector<int8_t> &output)
void EdnBuf::getRange(int32_t start, int32_t end, etk::Vector<int8_t> &output)
{
// Remove all data ...
output.Clear();
// remove all data ...
output.clear();
// import data :
output = m_data.Get(start, end-start);
//APPL_DEBUG("request start=" << start << " end="<< end << " size="<< end-start << " result size=" << output.Size() );
output = m_data.get(start, end-start);
//APPL_DEBUG("request start=" << start << " end="<< end << " size="<< end-start << " result size=" << output.size() );
}
void EdnBuf::GetRange(int32_t start, int32_t end, etk::UString &output)
void EdnBuf::getRange(int32_t start, int32_t end, etk::UString &output)
{
// Remove all data ...
// remove all data ...
output = "";
// import data :
etk::Vector<int8_t> localOutput = m_data.Get(start, end-start);
etk::Vector<int8_t> localOutput = m_data.get(start, end-start);
// transcript in UNICODE ...
if (true == m_isUtf8) {
localOutput.PushBack('\0');
localOutput.pushBack('\0');
output = (char*)&localOutput[0];
} else {
etk::Vector<uniChar_t> tmpUnicodeData;
@@ -156,12 +156,12 @@ void EdnBuf::GetRange(int32_t start, int32_t end, etk::UString &output)
convertIsoToUnicode(m_charsetType, localOutput, tmpUnicodeData);
output = tmpUnicodeData;
}
//APPL_DEBUG("request start=" << start << " end="<< end << " size="<< end-start << " result size=" << output.Size() );
//APPL_DEBUG("request start=" << start << " end="<< end << " size="<< end-start << " result size=" << output.size() );
}
/**
* @brief Get an element at the selected position
* @brief get an element at the selected position
*
* @param[in] pos Charecters Position, [0..n]
*
@@ -170,13 +170,13 @@ void EdnBuf::GetRange(int32_t start, int32_t end, etk::UString &output)
*/
int8_t EdnBuf::operator[] (int32_t pos) const
{
int8_t res = m_data.Get(pos);
int8_t res = m_data.get(pos);
return res;
}
/**
* @brief Insert Data in the Buffer
* @brief insert Data in the Buffer
*
* @param[in] pos Position in the Buffer
* @param[in] insertText Text to insert
@@ -184,28 +184,28 @@ int8_t EdnBuf::operator[] (int32_t pos) const
* @return ---
*
*/
int32_t EdnBuf::Insert(int32_t pos, etk::Vector<int8_t> &insertText)
int32_t EdnBuf::insert(int32_t pos, etk::Vector<int8_t> &insertText)
{
// if pos is not contiguous to existing text, make it
pos = etk_avg(0, pos, m_data.Size() );
pos = etk_avg(0, pos, m_data.size() );
// insert Data
int32_t sizeInsert=LocalInsert(pos, insertText);
// Call the redisplay ...
etk::Vector<int8_t> deletedText;
eventModification(pos, insertText.Size(), deletedText);
eventModification(pos, insertText.size(), deletedText);
return sizeInsert;
}
int32_t EdnBuf::Insert(int32_t pos, etk::UString &insertText)
int32_t EdnBuf::insert(int32_t pos, etk::UString &insertText)
{
// if pos is not contiguous to existing text, make it
pos = etk_avg(0, pos, m_data.Size() );
pos = etk_avg(0, pos, m_data.size() );
// insert Data
int32_t sizeInsert=LocalInsert(pos, insertText);
// Call the redisplay ...
etk::Vector<int8_t> deletedText;
eventModification(pos, insertText.Size(), deletedText);
eventModification(pos, insertText.size(), deletedText);
return sizeInsert;
}
@@ -225,11 +225,11 @@ int32_t EdnBuf::Replace(int32_t start, int32_t end, etk::Vector<int8_t> &insertT
return 0;
}
etk::Vector<int8_t> deletedText;
GetRange(start, end, 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)
@@ -238,37 +238,37 @@ int32_t EdnBuf::Replace(int32_t start, int32_t end, etk::UString &insertText)
return 0;
}
etk::Vector<int8_t> deletedText;
GetRange(start, end, deletedText);
getRange(start, end, deletedText);
etk::Vector<int8_t> tmpInsertText;
if (true == m_isUtf8) {
etk::Char tmpChar = insertText.c_str();
const char * tmpPointer = tmpChar;
while (*tmpPointer != '\0') {
tmpInsertText.PushBack(*tmpPointer++);
tmpInsertText.pushBack(*tmpPointer++);
}
} else {
etk::Vector<uniChar_t> tmppp = insertText.GetVector();
etk::Vector<uniChar_t> tmppp = insertText.getVector();
convertUnicodeToIso(m_charsetType, tmppp, tmpInsertText);
}
if (tmpInsertText.Size()>0) {
if (tmpInsertText[tmpInsertText.Size()-1] == '\0') {
tmpInsertText.PopBack();
if (tmpInsertText.size()>0) {
if (tmpInsertText[tmpInsertText.size()-1] == '\0') {
tmpInsertText.popBack();
}
}
if (tmpInsertText.Size()>0) {
if (tmpInsertText[tmpInsertText.Size()-1] == '\0') {
tmpInsertText.PopBack();
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();
}
/**
* @brief Remove data between [start..end]
* @brief remove data between [start..end]
*
* @param[in] start Position started in the buffer
* @param[in] end Position ended in the buffer
@@ -276,7 +276,7 @@ int32_t EdnBuf::Replace(int32_t start, int32_t end, etk::UString &insertText)
* @return ---
*
*/
void EdnBuf::Remove(int32_t start, int32_t end)
void EdnBuf::remove(int32_t start, int32_t end)
{
etk::Vector<int8_t> deletedText;
@@ -286,12 +286,12 @@ void EdnBuf::Remove(int32_t start, int32_t end)
start = end;
end = temp;
}
start = etk_avg(0 , start, m_data.Size());
end = etk_avg(0 , end, m_data.Size());
start = etk_avg(0 , start, m_data.size());
end = etk_avg(0 , end, m_data.size());
// Remove and redisplay
GetRange(start, end, deletedText);
m_data.Remove(start, end - start);
// remove and redisplay
getRange(start, end, deletedText);
m_data.remove(start, end - start);
eventModification(start, 0, deletedText);
}
@@ -300,27 +300,27 @@ int32_t EdnBuf::Indent(void)
{
int32_t SelectionStart, SelectionEnd, SelectionRectStart, SelectionRectEnd;
bool SelectionIsRect;
bool haveSelectionActive = GetSelectionPos(SelectionStart, SelectionEnd, SelectionIsRect, SelectionRectStart, SelectionRectEnd);
bool haveSelectionActive = getSelectionPos(SelectionStart, SelectionEnd, SelectionIsRect, SelectionRectStart, SelectionRectEnd);
if (false == haveSelectionActive) {
return SelectionEnd;
}
// Disable selection:
// disable selection:
Unselect();
// Get Range :
// get Range :
int32_t l_start = StartOfLine(SelectionStart);
int32_t l_end = EndOfLine(SelectionEnd);
etk::Vector<int8_t> l_tmpData;
GetRange(l_start, l_end, l_tmpData);
getRange(l_start, l_end, l_tmpData);
l_tmpData.Insert(0, '\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(i, '\t');
l_tmpData.insert(i, '\t');
} else {
for (int32_t j=0; j<m_tabDist; j++) {
l_tmpData.Insert(i, ' ');
l_tmpData.insert(i, ' ');
}
}
}
@@ -328,8 +328,8 @@ int32_t EdnBuf::Indent(void)
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();
// set the new selection :
l_end = l_start + l_tmpData.size();
Select(l_start, l_end);
// Return the position of the cursor
return l_end;
@@ -339,26 +339,26 @@ int32_t EdnBuf::UnIndent(void)
{
int32_t SelectionStart, SelectionEnd, SelectionRectStart, SelectionRectEnd;
bool SelectionIsRect;
bool haveSelectionActive = GetSelectionPos(SelectionStart, SelectionEnd, SelectionIsRect, SelectionRectStart, SelectionRectEnd);
bool haveSelectionActive = getSelectionPos(SelectionStart, SelectionEnd, SelectionIsRect, SelectionRectStart, SelectionRectEnd);
if (false == haveSelectionActive) {
return SelectionEnd;
}
// Disable selection:
// disable selection:
Unselect();
// Get Range :
// get Range :
int32_t l_start = StartOfLine(SelectionStart);
int32_t l_end = EndOfLine(SelectionEnd);
etk::Vector<int8_t> l_tmpData;
GetRange(l_start, l_end, l_tmpData);
getRange(l_start, l_end, l_tmpData);
l_tmpData.Insert(0, '\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(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(i);
} else if('\t' == l_tmpData[i]) {
@@ -374,8 +374,8 @@ int32_t EdnBuf::UnIndent(void)
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();
// set the new selection :
l_end = l_start + l_tmpData.size();
Select(l_start, l_end);
// Return the position of the cursor
return l_end;
@@ -383,7 +383,7 @@ int32_t EdnBuf::UnIndent(void)
/**
* @brief Get the data of a specific line
* @brief get the data of a specific line
*
* @param[in] pos Position in a line that might be geted
* @param[out] text Data in the current line at pos
@@ -391,14 +391,14 @@ int32_t EdnBuf::UnIndent(void)
* @return ---
*
*/
void EdnBuf::GetLineText(int32_t pos, etk::Vector<int8_t> &text)
void EdnBuf::getLineText(int32_t pos, etk::Vector<int8_t> &text)
{
GetRange( StartOfLine(pos), EndOfLine(pos), text);
getRange( StartOfLine(pos), EndOfLine(pos), text);
}
/**
* @brief Find the position of the start of the current line
* @brief find the position of the start of the current line
*
* @param[in] pos position inside the line whe we need to find the start
*
@@ -416,7 +416,7 @@ int32_t EdnBuf::StartOfLine(int32_t pos)
/**
* @brief Find the position of the end of the current line
* @brief find the position of the end of the current line
*
* @param[in] pos position inside the line whe we need to find the end
*
@@ -427,7 +427,7 @@ int32_t EdnBuf::EndOfLine(int32_t pos)
{
int32_t endPos;
if (false == SearchForward(pos, '\n', &endPos)) {
endPos = m_data.Size();
endPos = m_data.size();
}
return endPos;
}
@@ -444,12 +444,12 @@ int32_t EdnBuf::EndOfLine(int32_t pos)
* @return number of displayable char (display char width)
*
*/
int32_t EdnBuf::GetExpandedChar(int32_t &pos, int32_t indent, char outUTF8[MAX_EXP_CHAR_LEN], uint32_t &currentChar)
int32_t EdnBuf::getExpandedChar(int32_t &pos, int32_t indent, char outUTF8[MAX_EXP_CHAR_LEN], uint32_t &currentChar)
{
int32_t i, nSpaces;
char c = m_data.Get(pos);
char c = m_data.get(pos);
currentChar = (uint32_t)c & 0xFF;
/* Convert tabs to spaces */
/* convert tabs to spaces */
if (c == '\t') {
nSpaces = m_tabDist - (indent % m_tabDist);
for (i=0; i<nSpaces; i++) {
@@ -460,7 +460,7 @@ int32_t EdnBuf::GetExpandedChar(int32_t &pos, int32_t indent, char outUTF8[MAX_E
return nSpaces;
}
// Convert ASCII control codes to readable character sequences
// convert ASCII control codes to readable character sequences
if (c == '\0') {
outUTF8[0] = '<';
outUTF8[1] = 'n';
@@ -507,14 +507,14 @@ int32_t EdnBuf::GetExpandedChar(int32_t &pos, int32_t indent, char outUTF8[MAX_E
pos++;
} else {
char tmpString[8];
for (int32_t k=0; k<6 && k< m_data.Size() - pos; k++) {
tmpString[k] = m_data.Get(pos+k);
for (int32_t k=0; k<6 && k< m_data.size() - pos; k++) {
tmpString[k] = m_data.get(pos+k);
}
tmpString[6] = '\0';
uint8_t size;
bool baseValid;
unicode::Utf8_SizeElement(tmpString, 6 , size, baseValid);
currentChar = 0; // TODO : Set UNICODE char ...
currentChar = 0; // TODO : set UNICODE char ...
if (baseValid == true) {
char *tmp = outUTF8;
for (int32_t kkk=0; kkk<size; kkk++) {
@@ -544,12 +544,12 @@ int32_t EdnBuf::GetExpandedChar(int32_t &pos, int32_t indent, char outUTF8[MAX_E
* @return number of displayable char (display char width)
*
*/
int32_t EdnBuf::GetExpandedChar(int32_t &pos, int32_t indent, uniChar_t outUnicode[MAX_EXP_CHAR_LEN], uint32_t &currentChar)
int32_t EdnBuf::getExpandedChar(int32_t &pos, int32_t indent, uniChar_t outUnicode[MAX_EXP_CHAR_LEN], uint32_t &currentChar)
{
int32_t i, nSpaces;
char c = m_data.Get(pos);
char c = m_data.get(pos);
currentChar = (uint32_t)c & 0xFF;
/* Convert tabs to spaces */
/* convert tabs to spaces */
if (c == '\t') {
nSpaces = m_tabDist - (indent % m_tabDist);
for (i=0; i<nSpaces; i++) {
@@ -560,7 +560,7 @@ int32_t EdnBuf::GetExpandedChar(int32_t &pos, int32_t indent, uniChar_t outUnico
return nSpaces;
}
// Convert ASCII control codes to readable character sequences
// convert ASCII control codes to readable character sequences
if (c == '\0') {
outUnicode[0] = '<';
outUnicode[1] = 'n';
@@ -604,13 +604,13 @@ int32_t EdnBuf::GetExpandedChar(int32_t &pos, int32_t indent, uniChar_t outUnico
memset(outUnicode, 0, sizeof(uniChar_t)*MAX_EXP_CHAR_LEN);
// Otherwise, just return the character
if (false ==m_isUtf8) {
if (false == m_isUtf8) {
unicode::convertIsoToUnicode(m_charsetType, c, outUnicode[0]);
pos++;
} else {
char tmpString[8];
for (int32_t k=0; k<6 && k< m_data.Size() - pos; k++) {
tmpString[k] = m_data.Get(pos+k);
for (int32_t k=0; k<6 && k< m_data.size() - pos; k++) {
tmpString[k] = m_data.get(pos+k);
}
tmpString[6] = '\0';
uint8_t size;
@@ -623,7 +623,7 @@ int32_t EdnBuf::GetExpandedChar(int32_t &pos, int32_t indent, uniChar_t outUnico
tmp[kkk] = tmpString[kkk];
tmp[kkk+1] = '\0';
}
outUnicode[0].SetUtf8(tmp);
outUnicode[0].setUtf8(tmp);
outUnicode[1] = 0;
} else {
outUnicode[0] = '<';
@@ -648,7 +648,7 @@ int32_t EdnBuf::GetExpandedChar(int32_t &pos, int32_t indent, uniChar_t outUnico
/**
* @brief generate the real display of character of the output (ex : \t ==> 4 spaces or less ...)
* @brief generate the real display of character of the output (ex : \t == > 4 spaces or less ...)
*
* @param[in] c Char that might be converted
* @param[in] indent Curent indentation befor the curent char
@@ -661,7 +661,7 @@ int32_t EdnBuf::ExpandCharacter(char c, int32_t indent, char outUTF8[MAX_EXP_CHA
{
int32_t i, nSpaces;
/* Convert tabs to spaces */
/* convert tabs to spaces */
if (c == '\t') {
nSpaces = m_tabDist - (indent % m_tabDist);
for (i=0; i<nSpaces; i++) {
@@ -671,7 +671,7 @@ int32_t EdnBuf::ExpandCharacter(char c, int32_t indent, char outUTF8[MAX_EXP_CHA
return nSpaces;
}
// Convert ASCII control codes to readable character sequences
// convert ASCII control codes to readable character sequences
if (c == '\0') {
outUTF8[0] = '<';
outUTF8[1] = 'n';
@@ -708,7 +708,7 @@ int32_t EdnBuf::ExpandCharacter(char c, int32_t indent, char outUTF8[MAX_EXP_CHA
}
/**
* @brief Generate the size of the display of one element
* @brief generate the size of the display of one element
*
* @param[in] c Char that might be converted
* @param[in] indent Curent indentation befor the curent char
@@ -735,11 +735,11 @@ int32_t EdnBuf::CharWidth(char c, int32_t indent)
/**
* @brief Count the number of displayed characters between buffer position
*
* Displayed characters are the characters shown on the screen to represent characters in the
* displayed characters are the characters shown on the screen to represent characters in the
* buffer, where tabs and control characters are expanded
*
* @param[in] lineStartPos Start position in the line
* @param[in] targetPos Displayed target position in char
* @param[in] targetPos displayed target position in char
*
* @return the ID in the buffer of the requested char
*
@@ -749,7 +749,7 @@ int32_t EdnBuf::CountDispChars(int32_t lineStartPos, int32_t targetPos)
int32_t charCount = 0;
char expandedChar[MAX_EXP_CHAR_LEN];
//APPL_DEBUG("lineStartPos="<< lineStartPos << " targetPos=" << targetPos);
for(int32_t iii = lineStartPos; iii< targetPos && iii<m_data.Size() ; iii++ ) {
for(int32_t iii = lineStartPos; iii< targetPos && iii<m_data.size() ; iii++ ) {
charCount += ExpandCharacter(m_data[iii], charCount, expandedChar);
}
//APPL_DEBUG(" result=" << charCount);
@@ -766,7 +766,7 @@ int32_t EdnBuf::CountForwardDispChars(int32_t lineStartPos, int32_t nChars)
{
int32_t charCount = 0;
int32_t iii = 0;
for(iii = lineStartPos; charCount<nChars && iii<m_data.Size() ; iii++ ) {
for(iii = lineStartPos; charCount<nChars && iii<m_data.size() ; iii++ ) {
char c = m_data[iii];
if (c == '\n') {
return iii;
@@ -785,7 +785,7 @@ int32_t EdnBuf::CountForwardDispChars(int32_t lineStartPos, int32_t nChars)
int32_t EdnBuf::CountLines(int32_t startPos, int32_t endPos)
{
int32_t lineCount = 0;
for(int32_t iii = startPos; iii<m_data.Size() ; iii++ ) {
for(int32_t iii = startPos; iii<m_data.size() ; iii++ ) {
if (iii == endPos) {
return lineCount;
}
@@ -804,7 +804,7 @@ int32_t EdnBuf::CountLines(int32_t startPos, int32_t endPos)
int32_t EdnBuf::CountLines(etk::Vector<int8_t> &data)
{
int32_t lineCount = 0;
for(int32_t iii=0 ; iii<data.Size() ; iii++ ) {
for(int32_t iii=0 ; iii<data.size() ; iii++ ) {
if ('\n' == data[iii]) {
lineCount++;
}
@@ -815,7 +815,7 @@ int32_t EdnBuf::CountLines(etk::Vector<int8_t> &data)
int32_t EdnBuf::CountLines(void)
{
int32_t lineCount = 0;
for(int32_t iii=0 ; iii<m_data.Size() ; iii++ ) {
for(int32_t iii=0 ; iii<m_data.size() ; iii++ ) {
if ('\n' == m_data[iii]) {
lineCount++;
}
@@ -824,18 +824,18 @@ int32_t EdnBuf::CountLines(void)
}
/**
* @brief Calculate the number of line
* @brief calculate the number of line
* @return the number of line in the buffer [1..n]
*/
void EdnBuf::CountNumberOfLines(void)
{
m_nbLine = CountLines(0, m_data.Size());
m_nbLine = CountLines(0, m_data.size());
m_nbLine++;
}
/**
* @brief Find the first character of the line "nLines" forward
* @brief find the first character of the line "nLines" forward
*
* @param[in,out] startPos Start position to count
* @param[in,out] nLines number of line to count
@@ -847,31 +847,31 @@ int32_t EdnBuf::CountForwardNLines(int32_t startPos, int32_t nLines)
{
if (nLines == 0) {
return startPos;
} else if (startPos > m_data.Size() ) {
return m_data.Size();
} else if (startPos > m_data.size() ) {
return m_data.size();
}
int32_t lineCount = 0;
//APPL_INFO("startPos=" << startPos << " nLines=" << nLines);
int32_t iii = 0;
for(iii = startPos; iii<m_data.Size() ; iii++ ) {
for(iii = startPos; iii<m_data.size() ; iii++ ) {
if ('\n' == m_data[iii]) {
lineCount++;
if (lineCount == nLines) {
//APPL_INFO(" ==> (1) at position=" << myPosIt.Position()+1 );
//APPL_INFO(" == > (1) at position=" << myPosIt.Position()+1 );
return iii+1;
}
}
}
//APPL_INFO(" ==> (2) at position=" << myPosIt.Position() );
//APPL_INFO(" == > (2) at position=" << myPosIt.Position() );
return iii;
}
/**
* @brief Find the first character of the line "nLines" backwards
* @brief find the first character of the line "nLines" backwards
*
* @param[in,out] startPos Start position to count (this caracter is not counted)
* @param[in,out] nLines number of line to count (if ==0 means find the beginning of the line)
* @param[in,out] nLines number of line to count (if == 0 means find the beginning of the line)
*
* @return position of the starting the line
*
@@ -880,22 +880,22 @@ int32_t EdnBuf::CountBackwardNLines(int32_t startPos, int32_t nLines)
{
if (startPos <= 0) {
return 0;
} else if (startPos > m_data.Size() ) {
startPos = m_data.Size();
} else if (startPos > m_data.size() ) {
startPos = m_data.size();
}
//APPL_INFO("startPos=" << startPos << " nLines=" << nLines);
int32_t lineCount = -1;
for(int32_t iii = startPos-1; iii>=0 ; iii-- ) {
for(int32_t iii = startPos-1; iii >= 0 ; iii-- ) {
if ('\n' == m_data[iii]) {
lineCount++;
if (lineCount >= nLines) {
//APPL_INFO(" ==> (1) at position=" << myPosIt.Position()+1 );
//APPL_INFO(" == > (1) at position=" << myPosIt.Position()+1 );
return iii+1;
}
}
}
//APPL_INFO(" ==> (2) at position=0");
//APPL_INFO(" == > (2) at position=0");
return 0;
}
@@ -911,10 +911,10 @@ bool EdnBuf::charMatch(char first, char second, bool caseSensitive)
}
}
if(first == second) {
//APPL_DEBUG("charMatch(" << first << ", " << second << ", " << caseSensitive << ") ==> true");
//APPL_DEBUG("charMatch(" << first << ", " << second << ", " << caseSensitive << ") == > true");
return true;
} else {
//APPL_DEBUG("charMatch(" << first << ", " << second << ", " << caseSensitive << ") ==> false");
//APPL_DEBUG("charMatch(" << first << ", " << second << ", " << caseSensitive << ") == > false");
return false;
}
}
@@ -926,8 +926,8 @@ bool EdnBuf::charMatch(char first, char second, bool caseSensitive)
* @param[in] searchVect String to search
* @param[out] foundPos Current position founded
*
* @return true ==> found data
* @return false ==> not found data
* @return true == > found data
* @return false == > not found data
*
*/
bool EdnBuf::SearchForward(int32_t startPos, etk::UString &search, int32_t *foundPos, int32_t *foundPosEnd, bool caseSensitive)
@@ -937,17 +937,17 @@ bool EdnBuf::SearchForward(int32_t startPos, etk::UString &search, int32_t *foun
etk::Char tmpChar = search.c_str();
const char * tmpPointer = tmpChar;
while (*tmpPointer != '\0') {
searchVect.PushBack(*tmpPointer++);
searchVect.pushBack(*tmpPointer++);
}
} else {
etk::Vector<etk::UniChar> tmppp = search.GetVector();
etk::Vector<etk::UniChar> tmppp = search.getVector();
convertUnicodeToIso(m_charsetType, tmppp, searchVect);
}
// remove the '\0' at the end of the string ...
searchVect.PopBack();
searchVect.popBack();
int32_t position;
int32_t searchLen = searchVect.Size();
int32_t dataLen = m_data.Size();
int32_t searchLen = searchVect.size();
int32_t dataLen = m_data.size();
char currentChar = '\0';
APPL_INFO(" startPos=" << startPos << " searchLen=" << searchLen);
for (position=startPos; position<dataLen - (searchLen-1); position++) {
@@ -964,13 +964,13 @@ 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;
}
}
}
*foundPos = m_data.Size();
*foundPosEnd = m_data.Size();
*foundPos = m_data.size();
*foundPosEnd = m_data.size();
return false;
}
@@ -982,8 +982,8 @@ bool EdnBuf::SearchForward(int32_t startPos, etk::UString &search, int32_t *foun
* @param[in] searchChars String to search
* @param[out] foundPos Current position founded
*
* @return true ==> found data
* @return false ==> not found data
* @return true == > found data
* @return false == > not found data
*
*/
bool EdnBuf::SearchBackward(int32_t startPos, etk::UString &search, int32_t *foundPos, int32_t *foundPosEnd, bool caseSensitive)
@@ -993,25 +993,25 @@ bool EdnBuf::SearchBackward(int32_t startPos, etk::UString &search, int32_t *fou
etk::Char tmpChar = search.c_str();
const char * tmpPointer = tmpChar;
while (*tmpPointer != '\0') {
searchVect.PushBack(*tmpPointer++);
searchVect.pushBack(*tmpPointer++);
}
} else {
etk::Vector<etk::UniChar> tmppp = search.GetVector();
etk::Vector<etk::UniChar> tmppp = search.getVector();
convertUnicodeToIso(m_charsetType, tmppp, searchVect);
}
// remove the '\0' at the end of the string ...
searchVect.PopBack();
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--) {
for (position=startPos; position >= searchLen-1; position--) {
currentChar = m_data[position];
if (true == charMatch(currentChar, searchVect[searchLen-1], caseSensitive)) {
int32_t i;
bool found = true;
for (i=searchLen-1; i>=0; i--) {
for (i=searchLen-1; i >= 0; i--) {
currentChar = m_data[position - (searchLen-1) + i];
if (false == charMatch(currentChar, searchVect[i], caseSensitive)) {
found = false;
@@ -1020,13 +1020,13 @@ 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;
}
}
}
*foundPos = m_data.Size();
*foundPosEnd = m_data.Size();
*foundPos = m_data.size();
*foundPosEnd = m_data.size();
return false;
}
@@ -1054,7 +1054,7 @@ bool EdnBuf::SelectAround(int32_t startPos, int32_t &beginPos, int32_t &endPos)
{
APPL_DEBUG("select spacer");
// special case we are looking for separation
for (beginPos=startPos; beginPos>=0; beginPos--) {
for (beginPos=startPos; beginPos >= 0; beginPos--) {
currentChar = m_data[beginPos];
if( '\t' != currentChar
&& ' ' != currentChar)
@@ -1064,7 +1064,7 @@ bool EdnBuf::SelectAround(int32_t startPos, int32_t &beginPos, int32_t &endPos)
}
}
// special case we are looking for separation
for (endPos=startPos; endPos<m_data.Size(); endPos++) {
for (endPos=startPos; endPos<m_data.size(); endPos++) {
currentChar = m_data[endPos];
if( '\t' != currentChar
&& ' ' != currentChar)
@@ -1076,7 +1076,7 @@ bool EdnBuf::SelectAround(int32_t startPos, int32_t &beginPos, int32_t &endPos)
} else if( true == isChar(currentChar)){
APPL_DEBUG("select normal Char");
// Search back
for (beginPos=startPos; beginPos>=0; beginPos--) {
for (beginPos=startPos; beginPos >= 0; beginPos--) {
currentChar = m_data[beginPos];
if( false == isChar(currentChar)) {
beginPos++;
@@ -1084,7 +1084,7 @@ bool EdnBuf::SelectAround(int32_t startPos, int32_t &beginPos, int32_t &endPos)
}
}
// Search forward
for (endPos=startPos; endPos<m_data.Size(); endPos++) {
for (endPos=startPos; endPos<m_data.size(); endPos++) {
currentChar = m_data[endPos];
if( false == isChar(currentChar)) {
break;
@@ -1095,7 +1095,7 @@ bool EdnBuf::SelectAround(int32_t startPos, int32_t &beginPos, int32_t &endPos)
char comparechar = currentChar;
APPL_DEBUG("select same char");
// Search back
for (beginPos=startPos; beginPos>=0; beginPos--) {
for (beginPos=startPos; beginPos >= 0; beginPos--) {
currentChar = m_data[beginPos];
if(comparechar != currentChar)
{
@@ -1104,7 +1104,7 @@ bool EdnBuf::SelectAround(int32_t startPos, int32_t &beginPos, int32_t &endPos)
}
}
// Search forward
for (endPos=startPos; endPos<m_data.Size(); endPos++) {
for (endPos=startPos; endPos<m_data.size(); endPos++) {
currentChar = m_data[endPos];
if(comparechar != currentChar)
{
@@ -1120,7 +1120,7 @@ bool EdnBuf::SelectAround(int32_t startPos, int32_t &beginPos, int32_t &endPos)
/**
* @brief Insert data in the buffer binary and call all needed functions.
* @brief insert data in the buffer binary and call all needed functions.
*
* @param[in] pos Position to insert data in the buffer.
* @param[in] insertText Data to insert.
@@ -1130,12 +1130,12 @@ bool EdnBuf::SelectAround(int32_t startPos, int32_t &beginPos, int32_t &endPos)
*/
int32_t EdnBuf::LocalInsert(int32_t pos, etk::Vector<int8_t> &insertText)
{
// Insert data in buffer
m_data.Insert(pos, 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)
{
@@ -1144,15 +1144,15 @@ int32_t EdnBuf::LocalInsert(int32_t pos, etk::UString &insertText)
etk::Char tmpChar = insertText.c_str();
const char * tmpPointer = tmpChar;
while (*tmpPointer != '\0') {
tmpInsertText.PushBack(*tmpPointer++);
tmpInsertText.pushBack(*tmpPointer++);
}
} else {
etk::Vector<etk::UniChar> tmppp = insertText.GetVector();
etk::Vector<etk::UniChar> tmppp = insertText.getVector();
convertUnicodeToIso(m_charsetType, tmppp, tmpInsertText);
}
if (tmpInsertText.Size()>0) {
if (tmpInsertText[tmpInsertText.Size()-1] == '\0') {
tmpInsertText.PopBack();
if (tmpInsertText.size()>0) {
if (tmpInsertText[tmpInsertText.size()-1] == '\0') {
tmpInsertText.popBack();
}
}
return LocalInsert(pos, tmpInsertText);
@@ -1171,38 +1171,38 @@ int32_t EdnBuf::LocalInsert(int32_t pos, etk::UString &insertText)
*/
void EdnBuf::eventModification(int32_t pos, int32_t nInserted, etk::Vector<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 :
//APPL_INFO(" add=" << CountLines(pos, pos+nInserted) << " lines | remove="<< CountLines(deletedText) << " lines");
m_nbLine += CountLines(pos, pos+nInserted) - CountLines(deletedText);
// Update histories
// update histories
if (false == m_isUndoProcessing) {
// normal or Redo processing
EdnBufHistory *exempleHistory = new EdnBufHistory(pos, nInserted, deletedText);
m_historyUndo.PushBack(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.PopBack();
m_historyRedo.popBack();
}
}
} else {
// undo processing ==> add element in Redo vector ...
// undo processing == > add element in Redo vector ...
EdnBufHistory *exempleHistory = new EdnBufHistory(pos, nInserted, deletedText);
m_historyRedo.PushBack(exempleHistory);
m_historyRedo.pushBack(exempleHistory);
}
// Regenerate the Highlight :
RegenerateHighLightAt(pos, deletedText.Size(), nInserted);
RegenerateHighLightAt(pos, deletedText.size(), nInserted);
}
}
@@ -1223,13 +1223,13 @@ void EdnBuf::eventModification(int32_t pos, int32_t nInserted, etk::Vector<int8_
bool EdnBuf::SearchForward(int32_t startPos, char searchChar, int32_t *foundPos)
{
// move in the string
for(int32_t iii=startPos ; iii<m_data.Size() ; iii++ ) {
for(int32_t iii=startPos ; iii<m_data.size() ; iii++ ) {
if (m_data[iii] == searchChar) {
*foundPos = iii;
return true;
}
}
*foundPos = m_data.Size();
*foundPos = m_data.size();
return false;
}
@@ -1247,7 +1247,7 @@ bool EdnBuf::SearchForward(int32_t startPos, char searchChar, int32_t *foundPos)
bool EdnBuf::SearchBackward(int32_t startPos, char searchChar, int32_t *foundPos)
{
// move in the string
for(int32_t iii=startPos-1 ; iii>=0 ; iii-- ) {
for(int32_t iii=startPos-1 ; iii >= 0 ; iii-- ) {
if (m_data[iii] == searchChar) {
*foundPos = iii;
return true;

View File

@@ -49,37 +49,37 @@ typedef struct {
}displayHLData_ts;
class EdnBuf {
// TODO : Set an iterator to acces at every data without knowin the system ...
// TODO : set an iterator to acces at every data without knowin the system ...
public:
// constructer
EdnBuf(void);
// destructer
~EdnBuf(void);
// public function :
void GetAll(etk::Vector<int8_t>& _text);
void SetAll(etk::Vector<int8_t>& _text);
void GetRange(int32_t _start, int32_t _end, etk::Vector<int8_t>& _output);
void GetRange(int32_t _start, int32_t _end, etk::UString& _output);
void getAll(etk::Vector<int8_t>& _text);
void setAll(etk::Vector<int8_t>& _text);
void getRange(int32_t _start, int32_t _end, etk::Vector<int8_t>& _output);
void getRange(int32_t _start, int32_t _end, etk::UString& _output);
bool DumpIn(etk::FSNode& _file);
bool DumpFrom(etk::FSNode& _file);
// replace with operator [] ...
int8_t operator[] (int32_t) const;
int32_t Insert(int32_t _pos, etk::Vector<int8_t>& _insertText);
int32_t Insert(int32_t _pos, etk::UString& _insertText);
int32_t insert(int32_t _pos, etk::Vector<int8_t>& _insertText);
int32_t insert(int32_t _pos, etk::UString& _insertText);
int32_t Replace(int32_t _start, int32_t _end, etk::Vector<int8_t>& _insertText);
int32_t Replace(int32_t _start, int32_t _end, etk::UString& _insertText);
void Remove(int32_t _start, int32_t _end);
void remove(int32_t _start, int32_t _end);
int32_t Indent(void);
int32_t UnIndent(void);
void GetLineText(int32_t _pos, etk::Vector<int8_t>& _text);
void getLineText(int32_t _pos, etk::Vector<int8_t>& _text);
int32_t StartOfLine(int32_t _pos);
int32_t EndOfLine(int32_t _pos);
int32_t GetExpandedChar(int32_t& _pos, int32_t _indent, uniChar_t _outUnicode[MAX_EXP_CHAR_LEN], uint32_t& _currentChar);
int32_t GetExpandedChar(int32_t& _pos, int32_t _indent, char _outUTF8[MAX_EXP_CHAR_LEN], uint32_t& _currentChar);
int32_t ExpandCharacter(char _c, int32_t _indent, char _outUTF8[MAX_EXP_CHAR_LEN]); // TODO : Remove
int32_t getExpandedChar(int32_t& _pos, int32_t _indent, uniChar_t _outUnicode[MAX_EXP_CHAR_LEN], uint32_t& _currentChar);
int32_t getExpandedChar(int32_t& _pos, int32_t _indent, char _outUTF8[MAX_EXP_CHAR_LEN], uint32_t& _currentChar);
int32_t ExpandCharacter(char _c, int32_t _indent, char _outUTF8[MAX_EXP_CHAR_LEN]); // TODO : remove
int32_t CharWidth(char _c, int32_t _indent); // TODO : rework this
int32_t CountDispChars(int32_t _lineStartPos, int32_t _targetPos);
int32_t CountForwardDispChars(int32_t _lineStartPos, int32_t _nChars);
@@ -95,8 +95,8 @@ class EdnBuf {
bool SearchBackward(int32_t _startPos, char _searchChar, int32_t* _foundPos);
bool SelectAround(int32_t _startPos, int32_t& _beginPos, int32_t& _endPos);
// Buffer Size system :
int32_t Size(void) { return m_data.Size(); };
// Buffer size system :
int32_t size(void) { return m_data.size(); };
int32_t NumberOfLines(void) { return m_nbLine; };
// -----------------------------------------
@@ -107,16 +107,16 @@ class EdnBuf {
void Select(int32_t _start, int32_t _end);
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(etk::Vector<int8_t>& _text);
void GetSelectionText(etk::UString& _text);
void RemoveSelected(void);
bool getSelectionPos(int32_t& _start, int32_t& _end, bool& _isRect, int32_t& _rectStart, int32_t& _rectEnd);
void getSelectionText(etk::Vector<int8_t>& _text);
void getSelectionText(etk::UString& _text);
void removeSelected(void);
int32_t ReplaceSelected(etk::Vector<int8_t>& _text);
int32_t ReplaceSelected(etk::UString& _text);
private:
// current selection of the buffer
selection m_selectionList; //!< Selection area of the buffer
void UpdateSelection(int32_t _pos, int32_t _nDeleted, int32_t _nInserted);
void updateSelection(int32_t _pos, int32_t _nDeleted, int32_t _nInserted);
// -----------------------------------------
// History section :
@@ -137,15 +137,15 @@ class EdnBuf {
Highlight * m_Highlight; //!< internal link with the Highlight system
etk::Vector<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 generateHighLightAt(int32_t _pos, int32_t _endPos, int32_t _addinPos=0);
void CleanHighLight(void);
void FindMainHighLightPosition(int32_t _startPos, int32_t _endPos, int32_t &_startId, int32_t &_stopId, bool _backPreviousNotEnded);
void findMainHighLightPosition(int32_t _startPos, int32_t _endPos, int32_t &_startId, int32_t &_stopId, bool _backPreviousNotEnded);
public:
void SetHLSystem(Highlight* _newHLSystem);
void setHLSystem(Highlight* _newHLSystem);
void HightlightGenerateLines(displayHLData_ts& _MData, int32_t _startPos, int32_t _nbLines);
colorInformation_ts* GetElementColorAtPosition(displayHLData_ts& _MData, int32_t _pos);
colorInformation_ts* getElementColorAtPosition(displayHLData_ts& _MData, int32_t _pos);
private:
colorInformation_ts* GetElementColorAtPosition(int32_t _pos, int32_t &_starPos);
colorInformation_ts* getElementColorAtPosition(int32_t _pos, int32_t &_starPos);
private:
etk::Buffer m_data; //!< buffer of the data in the mode int8_t
@@ -153,18 +153,18 @@ class EdnBuf {
int32_t m_nbLine; //!< Number of line in the biffer
// -----------------------------------------
// Display property and charset ...
// display property and charset ...
// -----------------------------------------
public:
int32_t GetTabDistance(void) { return m_tabDist; } ;
void SetTabDistance(int32_t _tabDist) { m_tabDist = _tabDist; };
unicode::charset_te GetCharsetType(void) { return m_charsetType; };
void SetCharsetType(unicode::charset_te _newOne) { m_charsetType = _newOne; if (unicode::EDN_CHARSET_UTF8==_newOne){m_isUtf8=true;} else {m_isUtf8=false;} };
bool GetUTF8Mode(void) { return m_isUtf8; };
void SetUTF8Mode(bool _newOne) { m_isUtf8 = _newOne; m_charsetType=unicode::EDN_CHARSET_UTF8; };
int32_t getTabDistance(void) { return m_tabDist; } ;
void setTabDistance(int32_t _tabDist) { m_tabDist = _tabDist; };
unicode::charset_te getCharsetType(void) { return m_charsetType; };
void setCharsetType(unicode::charset_te _newOne) { m_charsetType = _newOne; if (unicode::EDN_CHARSET_UTF8 == _newOne){m_isUtf8=true;} else {m_isUtf8=false;} };
bool getUTF8Mode(void) { return m_isUtf8; };
void setUTF8Mode(bool _newOne) { m_isUtf8 = _newOne; m_charsetType=unicode::EDN_CHARSET_UTF8; };
private:
// Special mode of the buffer :
bool m_isUtf8; //!< true if we are in UTF8 mode ==> if true the size of a char is 0, otherwise .. 1->4 ( TODO : not now)
bool m_isUtf8; //!< true if we are in UTF8 mode == > if true the size of a char is 0, otherwise .. 1->4 ( TODO : not now)
unicode::charset_te m_charsetType; //!< if UTF8 mode is at false : the charset type of the buffer
// Local Tabulation policies
int32_t m_tabDist; //!< equiv. number of characters in a tab

View File

@@ -29,7 +29,7 @@ EdnBufHistory::EdnBufHistory(int32_t pos, int32_t nInserted, etk::Vector<int8_t>
m_deletedText = deletedText;
}
void EdnBufHistory::Set(int32_t pos, int32_t nInserted, etk::Vector<int8_t> &deletedText)
void EdnBufHistory::set(int32_t pos, int32_t nInserted, etk::Vector<int8_t> &deletedText)
{
//APPL_INFO("EdnBufHistory new + data");
m_pos = pos;
@@ -49,7 +49,7 @@ int32_t EdnBufHistory::getPos(void)
int32_t EdnBufHistory::getnbDeleted(void)
{
return m_deletedText.Size();
return m_deletedText.size();
}
int32_t EdnBufHistory::getnbInserted(void)

View File

@@ -17,7 +17,7 @@ class EdnBufHistory{
EdnBufHistory(void);
EdnBufHistory(int32_t pos, int32_t nInserted, etk::Vector<int8_t> &deletedText);
~EdnBufHistory(void);
void Set(int32_t pos, int32_t nInserted, etk::Vector<int8_t> &deletedText);
void set(int32_t pos, int32_t nInserted, etk::Vector<int8_t> &deletedText);
int32_t getPos(void);
int32_t getnbDeleted(void);
int32_t getnbInserted(void);

View File

@@ -14,16 +14,16 @@
#undef __class__
#define __class__ "EdnBuf{HighLight}"
void EdnBuf::SetHLSystem(Highlight * newHLSystem)
void EdnBuf::setHLSystem(Highlight * newHLSystem)
{
if (m_Highlight != newHLSystem) {
m_Highlight = newHLSystem;
m_HLDataPass1.Clear();
RegenerateHighLightAt(0, 0, m_data.Size());
m_HLDataPass1.clear();
RegenerateHighLightAt(0, 0, m_data.size());
}
}
// TODO : Check this fuction it have too many conditionnal inside ==> can do a better algo
// TODO : Check this fuction it have too many conditionnal inside == > can do a better algo
void EdnBuf::RegenerateHighLightAt(int32_t pos, int32_t nbDeleted, int32_t nbAdded)
{
//GTimeVal timeStart;
@@ -43,10 +43,10 @@ void EdnBuf::RegenerateHighLightAt(int32_t pos, int32_t nbDeleted, int32_t nbAdd
//APPL_INFO("(pos="<<pos<<", nbDeleted="<<nbDeleted<<", nbAdded=" << nbAdded << "\");");
int32_t i;
/*
for (i=0; i< (int32_t)m_HLDataPass1.Size(); i++) {
for (i=0; i< (int32_t)m_HLDataPass1.size(); i++) {
etk::UString ploppp;
if (NULL != m_HLDataPass1[i].patern ) {
ploppp = ((HighlightPattern*)m_HLDataPass1[i].patern)->GetName();
ploppp = ((HighlightPattern*)m_HLDataPass1[i].patern)->getName();
}
APPL_DEBUG("HighLight (previous) element id=" << i << " S=" << m_HLDataPass1[i].beginStart << " E=" << m_HLDataPass1[i].endStop << " patern name=" << ploppp );
}
@@ -56,15 +56,15 @@ 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);
findMainHighLightPosition(pos, posEnd, startId, stopId, true);
// Remove deprecated element
// remove deprecated element
if( -1 == startId
&& -1 == stopId)
{
m_HLDataPass1.Clear();
m_HLDataPass1.clear();
} else if(-1 == startId) {
if (0 == stopId){
m_HLDataPass1.Erase(0);
@@ -75,22 +75,22 @@ void EdnBuf::RegenerateHighLightAt(int32_t pos, int32_t nbDeleted, int32_t nbAdd
}
} else if(-1 == stopId) {
//APPL_DEBUG("3 * Erase " << startId+1 << "-> end");
m_HLDataPass1.EraseLen(startId+1, m_HLDataPass1.Size() - startId);
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.EraseLen(startId+1, stopId - startId);
if (stopId == currentSize-1) {
stopId = -1;
}
}
//APPL_DEBUG("new size=" << (int32_t)m_HLDataPass1.Size()-1);
//APPL_DEBUG("new size=" << (int32_t)m_HLDataPass1.size()-1);
/*
for (i=0; i< (int32_t)m_HLDataPass1.Size(); i++) {
for (i=0; i< (int32_t)m_HLDataPass1.size(); i++) {
etk::UString ploppp;
if (NULL != m_HLDataPass1[i].patern ) {
ploppp = ((HighlightPattern*)m_HLDataPass1[i].patern)->GetName();
ploppp = ((HighlightPattern*)m_HLDataPass1[i].patern)->getName();
}
APPL_DEBUG("HighLight (Middle) element id=" << i << " S=" << m_HLDataPass1[i].beginStart << " E=" << m_HLDataPass1[i].endStop << " patern name=" << ploppp );
}
@@ -102,7 +102,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;
@@ -114,26 +114,26 @@ void EdnBuf::RegenerateHighLightAt(int32_t pos, int32_t nbDeleted, int32_t nbAdd
&& -1 == stopId)
{
//APPL_DEBUG("******* Regenerate ALL");
GenerateHighLightAt(0, m_data.Size());
generateHighLightAt(0, m_data.size());
} else if(-1 == startId) {
//APPL_DEBUG("******* Regenerate START");
GenerateHighLightAt(0, m_HLDataPass1[0].beginStart, 0);
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);
generateHighLightAt(m_HLDataPass1[startId].endStop, m_HLDataPass1[startId+1].beginStart, startId+1);
}
} else {
// Parse the new element ...
GenerateHighLightAt(0, m_data.Size());
generateHighLightAt(0, m_data.size());
}
/*
for (i=0; i< (int32_t)m_HLDataPass1.Size(); i++) {
for (i=0; i< (int32_t)m_HLDataPass1.size(); i++) {
etk::UString ploppp;
if (NULL != m_HLDataPass1[i].patern ) {
ploppp = ((HighlightPattern*)m_HLDataPass1[i].patern)->GetName();
ploppp = ((HighlightPattern*)m_HLDataPass1[i].patern)->getName();
}
APPL_DEBUG("HighLight (end) element id=" << i << " S=" << m_HLDataPass1[i].beginStart << " E=" << m_HLDataPass1[i].endStop << " patern name=" << ploppp );
}
@@ -143,13 +143,13 @@ void EdnBuf::RegenerateHighLightAt(int32_t pos, int32_t nbDeleted, int32_t nbAdd
//APPL_DEBUG("HL General = " << timeStop.tv_usec - timeStart.tv_usec << " micro-s");
}
void EdnBuf::FindMainHighLightPosition(int32_t startPos, int32_t endPos, int32_t &startId, int32_t &stopId, bool backPreviousNotEnded)
void EdnBuf::findMainHighLightPosition(int32_t startPos, int32_t endPos, int32_t &startId, int32_t &stopId, bool backPreviousNotEnded)
{
startId = -1;
stopId = -1;
/* rules to start stop:
HighLight data ----
Remove area ****
remove area ****
Start pos S
End pos E
@@ -185,7 +185,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;
}
@@ -193,7 +193,7 @@ void EdnBuf::FindMainHighLightPosition(int32_t startPos, int32_t endPos, int32_t
}
// go back while the previous element is not eneded
if (true == backPreviousNotEnded) {
for (i=startId; i>=0; i--) {
for (i=startId; i >= 0; i--) {
if (m_HLDataPass1[i].notEnded == false) {
break;
}
@@ -206,7 +206,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;
@@ -214,15 +214,15 @@ void EdnBuf::FindMainHighLightPosition(int32_t startPos, int32_t endPos, int32_t
}
}
/*
if (-1 != startId && startId < (int32_t)m_HLDataPass1.Size()) {
APPL_DEBUG("==> BEGIN : start="<<m_HLDataPass1[startId].beginStart<<", stop="<<m_HLDataPass1[startId].endStop<<" id=" << startId << "/" << (int32_t)m_HLDataPass1.Size()-1);
if (-1 != startId && startId < (int32_t)m_HLDataPass1.size()) {
APPL_DEBUG(" == > BEGIN : start="<<m_HLDataPass1[startId].beginStart<<", stop="<<m_HLDataPass1[startId].endStop<<" id=" << startId << "/" << (int32_t)m_HLDataPass1.size()-1);
} else {
APPL_DEBUG("==> BEGIN : start=???, stop=??? id=" << startId);
APPL_DEBUG(" == > BEGIN : start=???, stop=??? id=" << startId);
}
if (-1 != stopId && stopId < (int32_t)m_HLDataPass1.Size()) {
APPL_DEBUG("==> END : start="<<m_HLDataPass1[stopId].beginStart<<", stop="<<m_HLDataPass1[stopId].endStop<<" id=" << stopId<< "/" << (int32_t)m_HLDataPass1.Size()-1);
if (-1 != stopId && stopId < (int32_t)m_HLDataPass1.size()) {
APPL_DEBUG(" == > END : start="<<m_HLDataPass1[stopId].beginStart<<", stop="<<m_HLDataPass1[stopId].endStop<<" id=" << stopId<< "/" << (int32_t)m_HLDataPass1.size()-1);
} else {
APPL_DEBUG("==> END : start=???, stop=??? id=" << stopId);
APPL_DEBUG(" == > END : start=???, stop=??? id=" << stopId);
}
*/
}
@@ -230,7 +230,7 @@ void EdnBuf::FindMainHighLightPosition(int32_t startPos, int32_t endPos, int32_t
void EdnBuf::GenerateHighLightAt(int32_t pos, int32_t endPos, int32_t addinPos)
void EdnBuf::generateHighLightAt(int32_t pos, int32_t endPos, int32_t addinPos)
{
if (NULL == m_Highlight) {
return;
@@ -243,16 +243,16 @@ 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();
// remove all element in the list...
m_HLDataPass1.clear();
}
colorInformation_ts *EdnBuf::GetElementColorAtPosition(int32_t pos, int32_t &starPos)
colorInformation_ts *EdnBuf::getElementColorAtPosition(int32_t pos, int32_t &starPos)
{
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)
@@ -277,49 +277,49 @@ 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
FindMainHighLightPosition(HLStart, HLStop, startId, stopId, true);
findMainHighLightPosition(HLStart, HLStop, startId, stopId, true);
int32_t k;
//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 :
if (0==k) {
if (0 == k) {
if (HLStart < m_HLDataPass1[k].beginStart) {
//APPL_DEBUG(" ==> (empty section 1 ) k="<<k<<" start="<<HLStart<<" stop="<<m_HLDataPass1[k].beginStart );
//APPL_DEBUG(" == > (empty section 1 ) k="<<k<<" start="<<HLStart<<" stop="<<m_HLDataPass1[k].beginStart );
m_Highlight->Parse2(HLStart,
m_HLDataPass1[k].beginStart,
MData.HLData,
m_data);
} // else : nothing to do ...
} else {
//APPL_DEBUG(" ==> (empty section 2 ) k="<<k<<" start="<<m_HLDataPass1[k-1].endStop<<" stop="<<m_HLDataPass1[k].beginStart );
//APPL_DEBUG(" == > (empty section 2 ) k="<<k<<" start="<<m_HLDataPass1[k-1].endStop<<" stop="<<m_HLDataPass1[k].beginStart );
m_Highlight->Parse2(m_HLDataPass1[k-1].endStop,
m_HLDataPass1[k].beginStart,
MData.HLData,
m_data);
}
// under section :
//APPL_DEBUG(" ==> (under section ) k="<<k<<" start="<<m_HLDataPass1[k].beginStart<<" stop="<<m_HLDataPass1[k].endStop << " subSectionOfID=" << 99999999);
//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( k < (int32_t)m_HLDataPass1.Size()) {
if (m_HLDataPass1.Size() != 0) {
//APPL_DEBUG(" ==> (empty section 3 ) k="<<k<<" start="<<m_HLDataPass1[k-1].endStop<<" stop="<<HLStop );
if (endSearch == (int32_t)m_HLDataPass1.size() ){
//if( k < (int32_t)m_HLDataPass1.size()) {
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,
MData.HLData,
m_data);
} else {
//APPL_DEBUG(" ==> (empty section 4 ) k="<<k<<" start=0 stop="<<HLStop );
//APPL_DEBUG(" == > (empty section 4 ) k="<<k<<" start=0 stop="<<HLStop );
m_Highlight->Parse2(0,
HLStop,
MData.HLData,
@@ -334,11 +334,11 @@ void EdnBuf::HightlightGenerateLines(displayHLData_ts & MData, int32_t HLStart,
}
colorInformation_ts * EdnBuf::GetElementColorAtPosition(displayHLData_ts & MData, int32_t pos)
colorInformation_ts * EdnBuf::getElementColorAtPosition(displayHLData_ts & MData, int32_t pos)
{
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)
@@ -346,8 +346,8 @@ colorInformation_ts * EdnBuf::GetElementColorAtPosition(displayHLData_ts & MData
return &MData.HLData[i];
}
if(MData.HLData[i].beginStart > pos) {
return GetElementColorAtPosition(pos, MData.posHLPass1);
return getElementColorAtPosition(pos, MData.posHLPass1);
}
}
return GetElementColorAtPosition(pos, MData.posHLPass1);
return getElementColorAtPosition(pos, MData.posHLPass1);
}

View File

@@ -19,7 +19,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) {
@@ -29,8 +29,8 @@ int32_t EdnBuf::Undo(void)
}
nbElement--;
if (m_historyUndo[nbElement] == NULL) {
APPL_ERROR("EdnBuf::Undo Find empty history ==> remove it");
m_historyUndo.PopBack();
APPL_ERROR("EdnBuf::Undo find empty history == > remove it");
m_historyUndo.popBack();
return -1;
}
int32_t pos = m_historyUndo[nbElement]->getPos();
@@ -44,13 +44,13 @@ int32_t EdnBuf::Undo(void)
if (0 == nbDeleted) {
APPL_DEBUG("EdnBuf::Undo nothing to do in UNDO");
} else {
Insert(pos, deletedText);
insert(pos, deletedText);
posDest = pos + nbDeleted;
}
} else {
if (0 == nbDeleted) {
// only remove data
Remove(pos, pos+nbInserted);
remove(pos, pos+nbInserted);
posDest = pos;
} else {
// replace data
@@ -60,14 +60,14 @@ int32_t EdnBuf::Undo(void)
}
// remove element in the list :
delete(m_historyUndo[nbElement]);
m_historyUndo.PopBack();
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) {
@@ -77,8 +77,8 @@ int32_t EdnBuf::Redo(void)
}
nbElement--;
if (m_historyRedo[nbElement] == NULL) {
APPL_ERROR("EdnBuf::Redo Find empty history ==> remove it");
m_historyRedo.PopBack();
APPL_ERROR("EdnBuf::Redo find empty history == > remove it");
m_historyRedo.popBack();
return -1;
}
int32_t pos = m_historyRedo[nbElement]->getPos();
@@ -92,13 +92,13 @@ int32_t EdnBuf::Redo(void)
if (0 == nbDeleted) {
APPL_ERROR("EdnBuf::Redo nothing to do in REDO");
} else {
Insert(pos, deletedText);
insert(pos, deletedText);
posDest = pos + nbDeleted;
}
} else {
if (0 == nbDeleted) {
// only remove data
Remove(pos, pos+nbInserted);
remove(pos, pos+nbInserted);
posDest = pos;
} else {
// replace data
@@ -108,7 +108,7 @@ int32_t EdnBuf::Redo(void)
}
// remove element in the list :
delete(m_historyRedo[nbElement]);
m_historyRedo.PopBack();
m_historyRedo.popBack();
m_isRedoProcessing = false;
return posDest;
}

View File

@@ -97,7 +97,7 @@ void EdnBuf::RectSelect(int32_t start, int32_t end, int32_t rectStart, int32_t r
* @return ---
*
*/
bool EdnBuf::GetSelectionPos(int32_t &start, int32_t &end, bool &isRect, int32_t &rectStart, int32_t &rectEnd)
bool EdnBuf::getSelectionPos(int32_t &start, int32_t &end, bool &isRect, int32_t &rectStart, int32_t &rectEnd)
{
/* Always fill in the parameters (zero-width can be requested too). */
isRect = m_selectionList.rectangular;
@@ -119,14 +119,14 @@ bool EdnBuf::GetSelectionPos(int32_t &start, int32_t &end, bool &isRect, int32_t
* @return ---
*
*/
void EdnBuf::GetSelectionText(etk::Vector<int8_t> &text)
void EdnBuf::getSelectionText(etk::Vector<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);
bool isSelected = getSelectionPos(start, end, isRect, rectStart, rectEnd);
// No data selected ...
if (false == isSelected) {
@@ -138,17 +138,17 @@ void EdnBuf::GetSelectionText(etk::Vector<int8_t> &text)
//GetTextInRect(start, end, rectStart, rectEnd, text);
// TODO : ...
} else {
GetRange(start, end, text);
getRange(start, end, text);
}
}
void EdnBuf::GetSelectionText(etk::UString &text)
void EdnBuf::getSelectionText(etk::UString &text)
{
int32_t start, end, rectStart, rectEnd;
bool isRect;
// remove output data
text = "";
bool isSelected = GetSelectionPos(start, end, isRect, rectStart, rectEnd);
bool isSelected = getSelectionPos(start, end, isRect, rectStart, rectEnd);
// No data selected ...
if (false == isSelected) {
@@ -160,7 +160,7 @@ void EdnBuf::GetSelectionText(etk::UString &text)
//GetTextInRect(start, end, rectStart, rectEnd, text);
// TODO : ...
} else {
GetRange(start, end, text);
getRange(start, end, text);
}
}
@@ -173,12 +173,12 @@ void EdnBuf::GetSelectionText(etk::UString &text)
* @return ---
*
*/
void EdnBuf::RemoveSelected(void)
void EdnBuf::removeSelected(void)
{
int32_t start, end;
int32_t rectStart, rectEnd;
bool isRect;
bool isSelected = GetSelectionPos(start, end, isRect, rectStart, rectEnd);
bool isSelected = getSelectionPos(start, end, isRect, rectStart, rectEnd);
// No data selected ...
if (false == isSelected) {
@@ -189,7 +189,7 @@ void EdnBuf::RemoveSelected(void)
//RemoveRect(start, end, rectStart, rectEnd);
// TODO : ...
} else {
Remove(start, end);
remove(start, end);
}
Unselect();
}
@@ -207,7 +207,7 @@ int32_t EdnBuf::ReplaceSelected(etk::Vector<int8_t> &text)
{
int32_t start, end, rectStart, rectEnd;
bool isRect;
bool isSelected = GetSelectionPos(start, end, isRect, rectStart, rectEnd);
bool isSelected = getSelectionPos(start, end, isRect, rectStart, rectEnd);
// No data selected ...
if (false == isSelected) {
@@ -229,7 +229,7 @@ int32_t EdnBuf::ReplaceSelected(etk::UString &text)
{
int32_t start, end, rectStart, rectEnd;
bool isRect;
bool isSelected = GetSelectionPos(start, end, isRect, rectStart, rectEnd);
bool isSelected = getSelectionPos(start, end, isRect, rectStart, rectEnd);
// No data selected ...
if (false == isSelected) {
@@ -250,7 +250,7 @@ int32_t EdnBuf::ReplaceSelected(etk::UString &text)
/*
** Update an individual selection for changes in the corresponding text
** update an individual selection for changes in the corresponding text
*/
/**
* @brief
@@ -260,7 +260,7 @@ int32_t EdnBuf::ReplaceSelected(etk::UString &text)
* @return ---
*
*/
void EdnBuf::UpdateSelection(int32_t pos, int32_t nDeleted, int32_t nInserted)
void EdnBuf::updateSelection(int32_t pos, int32_t nDeleted, int32_t nInserted)
{
if( ( false == m_selectionList.selected
&& false == m_selectionList.zeroWidth)