[DEV] code style step 1

This commit is contained in:
Edouard DUPIN 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,8 +153,8 @@ 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;
@ -163,7 +163,7 @@ bool appl::Buffer::Search(esize_t _pos, const etk::UniChar& _search, esize_t& _r
nbElementBuffer = 1;
}
}
_result = m_data.Size();
_result = m_data.size();
return false;
}
@ -173,7 +173,7 @@ bool appl::Buffer::SearchBack(esize_t _pos, const etk::UniChar& _search, esize_t
esize_t nbElementBuffer = 0;
etk::UniChar value;
for(esize_t iii=_pos-1 ; iii >= 0 ; iii-=nbElementBuffer ) {
nbElementBuffer = GetBack(iii, value);
nbElementBuffer = getBack(iii, value);
if (value == _search) {
_result = iii-nbElementBuffer;
return true;
@ -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]);
_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,12 +390,12 @@ 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();
charCount += expanded.size();
if (bufferElementSize <= 0) {
bufferElementSize = 1;
}
@ -411,14 +411,14 @@ 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();
charCount += expanded.size();
if (bufferElementSize <= 0) {
bufferElementSize = 1;
}
@ -431,16 +431,16 @@ 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) {
@ -453,15 +453,15 @@ esize_t appl::Buffer::CountForwardNLines(esize_t _startPos, int32_t _nLines)
}
}
//APPL_INFO(" == > (2) at position=" << myPosIt.Position() );
return m_data.Size();
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;
@ -469,7 +469,7 @@ esize_t appl::Buffer::CountBackwardNLines(esize_t _startPos, int32_t _nLines)
int32_t lineCount = 0;
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) {

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,14 +141,14 @@ 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)
* @return position of the starting the line

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);
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);
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 (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 (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,21 +192,21 @@ 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 {
@ -223,10 +223,10 @@ 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 (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);
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;
}
}
@ -367,17 +367,17 @@ 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)
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,7 +456,7 @@ 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 ...");
@ -479,22 +479,22 @@ void BufferManager::UnInit(void)
localManager = NULL;
}
int32_t BufferManager::GetSelected(void)
int32_t BufferManager::getSelected(void)
{
if (NULL == localManager) {
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 ...");
return NULL;
}
return localManager->Get(BufferID);
return localManager->get(BufferID);
}
bool BufferManager::Exist(int32_t BufferID)
@ -515,31 +515,31 @@ bool BufferManager::Exist(etk::FSNode &myFile)
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 ...");
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 ...");
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 ...");
return 0;
}
return localManager->SizeOpen();
return localManager->sizeOpen();
}
int32_t BufferManager::WitchBuffer(int32_t 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);
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);
uint32_t size(void);
uint32_t sizeOpen(void);
int32_t WitchBuffer(int32_t iEmeElement);
};

View File

@ -61,13 +61,13 @@ void BufferText::BasicInit(void)
*/
void BufferText::NameChange(void)
{
// Find HL system
// find HL system
//APPL_DEBUG("check name change");
if (true == HighlightManager::Exist(m_fileName)) {
Highlight * myHL = HighlightManager::Get(m_fileName);
// Set the new HL
Highlight * myHL = HighlightManager::get(m_fileName);
// set the new HL
if (NULL != myHL) {
m_EdnBuf.SetHLSystem(myHL);
m_EdnBuf.setHLSystem(myHL);
}
}
@ -82,18 +82,18 @@ void BufferText::NameChange(void)
* @return ---
*
*/
bool BufferText::IsModify(void)
bool BufferText::isModify(void)
{
return m_fileModify;
}
void BufferText::SetModify(bool status)
void BufferText::setModify(bool status)
{
if (status != m_fileModify) {
m_fileModify = status;
// TODO : Remove from here
// TODO : remove from here
etk::UString data = "Modify";
ewol::GetContext().GetEObjectManager().MultiCast().AnonymousSend(ednMsgBufferState, data);
ewol::getContext().getEObjectManager().MultiCast().AnonymousSend(ednMsgBufferState, data);
}
}
@ -106,14 +106,14 @@ void BufferText::SetModify(bool status)
* @return ---
*
*/
bool BufferText::NeedToUpdateDisplayPosition(void)
bool BufferText::needToUpdateDisplayPosition(void)
{
bool tmpVal = m_updatePositionRequested;
m_updatePositionRequested = false;
return tmpVal;
}
vec2 BufferText::GetBorderSize(void)
vec2 BufferText::getBorderSize(void)
{
return vec2(30,30);;
}
@ -139,12 +139,12 @@ BufferText::BufferText()
etk::UString mString = "Untitle - ";
mString += fileBasicID++;
EWOL_DEBUG("Create buffer try name : \"" << mString << "\"");
SetFileName(mString);
setFileName(mString);
m_haveName = false;
EWOL_DEBUG("Create buffer with name : " << m_fileName );
BasicInit();
SetModify(true);
setModify(true);
APPL_INFO("New(Empty-Buffer)");
}
@ -161,26 +161,26 @@ BufferText::BufferText(etk::FSNode &fileName)
{
m_fileModify = false;
EWOL_DEBUG("Create buffer try name : \"" << fileName << "\"");
SetFileName(fileName);
setFileName(fileName);
EWOL_DEBUG("Create buffer with name : " << m_fileName );
BasicInit();
NameChange();
APPL_INFO("Add Data from file(" << GetFileName() << ")");
APPL_INFO("Add Data from file(" << getFileName() << ")");
etk::FSNode myFile(fileName);
if (true == myFile.Exist()) {
if (false == myFile.FileOpenRead()) {
if (false == myFile.fileOpenRead()) {
APPL_WARNING("File can not be open in read mode : " << myFile);
SetModify(true);
setModify(true);
} else {
m_EdnBuf.DumpFrom(myFile);
myFile.FileClose();
SetModify(false);
myFile.fileClose();
setModify(false);
}
} else {
// fichier inexistant... creation d'un nouveaux
APPL_WARNING("No File ==> created a new one(" << GetFileName() << ")");
SetModify(true);
APPL_WARNING("No file == > created a new one(" << getFileName() << ")");
setModify(true);
}
RequestUpdateOfThePosition();
}
@ -196,14 +196,14 @@ BufferText::BufferText(etk::FSNode &fileName)
*/
void BufferText::Save(void)
{
APPL_INFO("Save File : \"" << GetFileName() << "\"" );
etk::FSNode myFile(GetFileName());
if (false == myFile.FileOpenWrite()) {
APPL_INFO("Save file : \"" << getFileName() << "\"" );
etk::FSNode myFile(getFileName());
if (false == myFile.fileOpenWrite()) {
APPL_ERROR("Can not open in writing the specify file");
} else {
m_EdnBuf.DumpIn(myFile);
myFile.FileClose();
SetModify(false);
myFile.fileClose();
setModify(false);
}
}
@ -231,7 +231,7 @@ BufferText::~BufferText(void)
* @return ---
*
*/
void BufferText::GetInfo(infoStatBuffer_ts &infoToUpdate)
void BufferText::getInfo(infoStatBuffer_ts &infoToUpdate)
{
}
@ -244,21 +244,21 @@ void BufferText::GetInfo(infoStatBuffer_ts &infoToUpdate)
* @return ---
*
*/
void BufferText::SetLineDisplay(uint32_t lineNumber)
void BufferText::setLineDisplay(uint32_t lineNumber)
{
}
#define SEPARATION_SIZE_LINE_NUMBER (3)
void BufferText::DrawLineNumber(ewol::Text* OOText, int32_t sizeX, int32_t sizeY, int32_t nbColomn, int32_t lineNumber, int32_t positionY)
void BufferText::drawLineNumber(ewol::Text* OOText, int32_t sizeX, int32_t sizeY, int32_t nbColomn, int32_t lineNumber, int32_t positionY)
{
char tmpLineNumber[50];
sprintf(tmpLineNumber, "%*d", nbColomn, lineNumber);
OOText->SetColorBg(ColorizeManager::Get(COLOR_LIST_BG_2));
OOText->SetColor(ColorizeManager::Get(COLOR_CODE_LINE_NUMBER));
OOText->SetPos(vec3(1.0f, (float)positionY, 0.0f) );
OOText->Print(tmpLineNumber);
OOText->setColorBg(ColorizeManager::get(COLOR_LIST_BG_2));
OOText->setColor(ColorizeManager::get(COLOR_CODE_LINE_NUMBER));
OOText->setPos(vec3(1.0f, (float)positionY, 0.0f) );
OOText->print(tmpLineNumber);
}
@ -270,7 +270,7 @@ void BufferText::DrawLineNumber(ewol::Text* OOText, int32_t sizeX, int32_t sizeY
* @return the number of colomn
*
*/
int32_t BufferText::GetLineNumberNumberOfElement(void)
int32_t BufferText::getLineNumberNumberOfElement(void)
{
int32_t nbColoneForLineNumber = 1;
// get the number of line in the buffer
@ -289,20 +289,20 @@ int32_t BufferText::GetLineNumberNumberOfElement(void)
return nbColoneForLineNumber;
}
int32_t BufferText::GetNumberOfLine(void)
int32_t BufferText::getNumberOfLine(void)
{
return m_EdnBuf.CountLines();
}
/**
* @brief Display the curent buffer with all the probematic imposed by the xharset and the user contraint.
* @brief display the curent buffer with all the probematic imposed by the xharset and the user contraint.
*
* @param[in,out] drawer the basic user drawer of EDN.
*
* @return
*
*/
int32_t BufferText::Display(ewol::Text& OOText,
int32_t BufferText::display(ewol::Text& OOText,
int32_t offsetX, int32_t offsetY,
int32_t sizeX, int32_t sizeY)
{
@ -310,7 +310,7 @@ int32_t BufferText::Display(ewol::Text& OOText,
bool selIsRect;
int32_t selHave;
vec3 tmpLetterSize = OOText.CalculateSize((uniChar_t)'A');
vec3 tmpLetterSize = OOText.calculateSize((uniChar_t)'A');
int32_t letterWidth = tmpLetterSize.x();
int32_t letterHeight = tmpLetterSize.y();
@ -324,35 +324,35 @@ int32_t BufferText::Display(ewol::Text& OOText,
vec2 maxSize;
maxSize.setX(0);
maxSize.setY(m_EdnBuf.NumberOfLines() * tmpLetterSize.y());
int32_t nbColoneForLineNumber = GetLineNumberNumberOfElement();
int32_t nbColoneForLineNumber = getLineNumberNumberOfElement();
// update the number of element that can be displayed
m_displaySize.setX((sizeX/letterWidth) + 1 - nbColoneForLineNumber);
m_displaySize.setY((sizeY/letterHeight) + 1);
APPL_VERBOSE("main DIPLAY " << m_displaySize.x() << " char * " << m_displaySize.y() << " char");
selHave = m_EdnBuf.GetSelectionPos(selStart, selEnd, selIsRect, selRectStart, selRectEnd);
selHave = m_EdnBuf.getSelectionPos(selStart, selEnd, selIsRect, selRectStart, selRectEnd);
colorInformation_ts * HLColor = NULL;
int32_t iii, new_i;
// Get color :
Colorize * myColor = ColorizeManager::Get("normal");
Colorize * myColorSel = ColorizeManager::Get("SelectedText");
etk::Color<> & myColorSpace = ColorizeManager::Get(COLOR_CODE_SPACE);
etk::Color<> & myColorTab = ColorizeManager::Get(COLOR_CODE_TAB);
// get color :
Colorize * myColor = ColorizeManager::get("normal");
Colorize * myColorSel = ColorizeManager::get("SelectedText");
etk::Color<> & myColorSpace = ColorizeManager::get(COLOR_CODE_SPACE);
etk::Color<> & myColorTab = ColorizeManager::get(COLOR_CODE_TAB);
Colorize * selectColor = NULL;
int mylen = m_EdnBuf.Size();
int mylen = m_EdnBuf.size();
int32_t x_base=nbColoneForLineNumber*letterWidth;
int32_t idX = 0;
int64_t startTime = ewol::GetTime();
int64_t startTime = ewol::getTime();
int displayLines = 0;
// Regenerate the colorizing if necessary ...
displayHLData_ts m_displayLocalSyntax;
m_EdnBuf.HightlightGenerateLines(m_displayLocalSyntax, displayStartBufferPos, m_displaySize.y());
int64_t stopTime = ewol::GetTime();
int64_t stopTime = ewol::getTime();
APPL_DEBUG("Parsing Highlight = " << stopTime - startTime << " micro-s");
uniChar_t displayChar[MAX_EXP_CHAR_LEN];
@ -367,24 +367,24 @@ int32_t BufferText::Display(ewol::Text& OOText,
y = sizeY - y;
y -= letterHeight;
OOText.SetClippingMode(false);
DrawLineNumber(&OOText, x_base, sizeY, nbColoneForLineNumber, currentLineID, y);
OOText.setClippingMode(false);
drawLineNumber(&OOText, x_base, sizeY, nbColoneForLineNumber, currentLineID, y);
int32_t pixelX = x_base + SEPARATION_SIZE_LINE_NUMBER;
vec3 drawClippingPos(0,0,-0.5);
vec3 drawClippingSize(sizeX, sizeY, 1);
OOText.SetClippingWidth(vec3((float)pixelX, 0.0f, -0.5f),
OOText.setClippingWidth(vec3((float)pixelX, 0.0f, -0.5f),
vec3((float)(sizeX - drawClippingPos.x()), (float)sizeY, 0.5f) );
// Clear the line intexation :
m_elmentList.Clear();
// clear the line intexation :
m_elmentList.clear();
// every char element is register to find the diplay pos when mouse event arrive
CharElement tmpElementProperty;
tmpElementProperty.m_yOffset = y;
tmpElementProperty.m_xOffset = 0;
tmpElementProperty.m_ySize = 10;
tmpElementProperty.m_bufferPos = displayStartBufferPos;
m_elmentList.PushBack(tmpElementProperty);
m_elmentList.pushBack(tmpElementProperty);
vec3 tmpCursorPosition(0, 0, -1); //Cursor is display only at the end to be all time over the background ... (-1 in z no cursor)
@ -396,7 +396,7 @@ int32_t BufferText::Display(ewol::Text& OOText,
new_i = iii;
// update the element buffer pos:
tmpElementProperty.m_bufferPos = new_i;
displaywidth = m_EdnBuf.GetExpandedChar(new_i, idX, displayChar, currentChar);
displaywidth = m_EdnBuf.getExpandedChar(new_i, idX, displayChar, currentChar);
int32_t drawSize = 0;
// update display position :
@ -408,46 +408,46 @@ int32_t BufferText::Display(ewol::Text& OOText,
//APPL_INFO("diplay element=" << new_i);
if (currentChar!='\n') {
selectColor = myColor;
HLColor = m_EdnBuf.GetElementColorAtPosition(m_displayLocalSyntax, iii);
HLColor = m_EdnBuf.getElementColorAtPosition(m_displayLocalSyntax, iii);
if (HLColor != NULL) {
if (HLColor->patern != NULL) {
selectColor = HLColor->patern->GetColor();
selectColor = HLColor->patern->getColor();
}
}
OOText.SetColorBg(etk::color::none);
OOText.setColorBg(etk::color::none);
if( true == selHave
&& selStart <= iii
&& selEnd > iii)
{
selectColor = myColorSel;
OOText.SetColorBg(selectColor->GetBG() );
OOText.setColorBg(selectColor->getBG() );
} else {
if(false == selectColor->HaveBg()) {
if(false == selectColor->haveBg()) {
if( currentChar == ' '
&& globals::IsSetDisplaySpaceChar() == true )
&& globals::isSetDisplaySpaceChar() == true )
{
OOText.SetColorBg(myColorSpace);
OOText.setColorBg(myColorSpace);
} else if( currentChar == '\t'
&& globals::IsSetDisplayTabChar() == true )
&& globals::isSetDisplayTabChar() == true )
{
OOText.SetColorBg(myColorTab);
OOText.setColorBg(myColorTab);
}
} else {
OOText.SetColorBg(selectColor->GetBG());
OOText.setColorBg(selectColor->getBG());
}
}
tmpElementProperty.m_ySize = 20;//OOText.GetHeight();
OOText.SetColor(selectColor->GetFG() );
//OOText.SetColorBg(selectColor->GetFG());
OOText.SetFontBold(selectColor->GetBold());
OOText.SetFontItalic(selectColor->GetItalic());
tmpElementProperty.m_ySize = 20;//OOText.getHeight();
OOText.setColor(selectColor->getFG() );
//OOText.setColorBg(selectColor->getFG());
OOText.setFontBold(selectColor->getBold());
OOText.setFontItalic(selectColor->getItalic());
myStringToDisplay = displayChar;
OOText.SetPos(vec3(textPos.x(), textPos.y(), 0.0f) );
OOText.Print(myStringToDisplay);
OOText.setPos(vec3(textPos.x(), textPos.y(), 0.0f) );
OOText.print(myStringToDisplay);
// To update the display position
drawSize = OOText.GetPos().x() - textPos.x();
drawSize = OOText.getPos().x() - textPos.x();
//APPL_DEBUG("add element : " << tmpElementProperty.m_yOffset << "," << tmpElementProperty.m_xOffset);
m_elmentList.PushBack(tmpElementProperty);
m_elmentList.pushBack(tmpElementProperty);
}
idX += displaywidth;
@ -467,37 +467,37 @@ int32_t BufferText::Display(ewol::Text& OOText,
//APPL_DEBUG("display pos =" << y);
displayLines++;
currentLineID++;
OOText.SetClippingMode(false);
OOText.SetFontBold(false);
OOText.SetFontItalic(false);
DrawLineNumber(&OOText, x_base, sizeY, nbColoneForLineNumber, currentLineID, y);
OOText.SetClippingMode(true);
OOText.setClippingMode(false);
OOText.setFontBold(false);
OOText.setFontItalic(false);
drawLineNumber(&OOText, x_base, sizeY, nbColoneForLineNumber, currentLineID, y);
OOText.setClippingMode(true);
// add elements :
m_elmentList.PushBack(tmpElementProperty);
m_elmentList.pushBack(tmpElementProperty);
}
}
//APPL_DEBUG("end at pos buf =" << iii << " / " << m_EdnBuf.Size());
//APPL_DEBUG("end at pos buf =" << iii << " / " << m_EdnBuf.size());
// special case : the cursor is at the end of the buffer...
if (m_cursorPos == iii) {
tmpCursorPosition = vec3(pixelX - offsetX, y, 0);
}
if (tmpCursorPosition.z()!=-1) {
// display the cursor:
OOText.SetPos(tmpCursorPosition);
OOText.SetColor(ColorizeManager::Get(COLOR_CODE_CURSOR));
OOText.SetColorBg(ColorizeManager::Get(COLOR_CODE_CURSOR));
OOText.PrintCursor(false);
OOText.setPos(tmpCursorPosition);
OOText.setColor(ColorizeManager::get(COLOR_CODE_CURSOR));
OOText.setColorBg(ColorizeManager::get(COLOR_CODE_CURSOR));
OOText.printCursor(false);
}
// Display the 80 colomn limit line :
// display the 80 colomn limit line :
OOText.SetClippingMode(false);
OOText.GetDrawing().SetThickness(2);
OOText.GetDrawing().SetColor(etk::Color<>(200,200,0,255));
OOText.GetDrawing().SetPos(vec2((float)((nbColoneForLineNumber+80)*tmpLetterSize.x()), 0.0f));
OOText.GetDrawing().LineRel(vec2(0.0f, 2500.0f));
OOText.setClippingMode(false);
OOText.getDrawing().setThickness(2);
OOText.getDrawing().setColor(etk::Color<>(200,200,0,255));
OOText.getDrawing().setPos(vec2((float)((nbColoneForLineNumber+80)*tmpLetterSize.x()), 0.0f));
OOText.getDrawing().lineRel(vec2(0.0f, 2500.0f));
// set the maximum size for the display ...
SetMaximumSize(maxSize);
int64_t stopTime2 = ewol::GetTime();
setMaximumSize(maxSize);
int64_t stopTime2 = ewol::getTime();
APPL_DEBUG("DRAW text (brut) = " << stopTime2 - stopTime << " micro-s");
return 0;
@ -505,11 +505,11 @@ int32_t BufferText::Display(ewol::Text& OOText,
int32_t BufferText::GetMousePosition(vec2 pos)
int32_t BufferText::getMousePosition(vec2 pos)
{
bool inLineDone=false;
//APPL_DEBUG("try to find in : " << width << "," << height);
for(int32_t iii=0; iii<m_elmentList.Size()-1; iii++) {
for(int32_t iii=0; iii<m_elmentList.size()-1; iii++) {
//APPL_DEBUG("check element : " << m_elmentList[iii].m_yOffset << " <= " << pos.y << " <" << (m_elmentList[iii].m_yOffset + m_elmentList[iii].m_ySize));
if(false == inLineDone) {
if( pos.y() >= m_elmentList[iii].m_yOffset
@ -532,10 +532,10 @@ int32_t BufferText::GetMousePosition(vec2 pos)
}
}
}
if (m_elmentList.Size()>0) {
if(pos.y()<m_elmentList[m_elmentList.Size()/2].m_yOffset) {
if (m_elmentList.size()>0) {
if(pos.y()<m_elmentList[m_elmentList.size()/2].m_yOffset) {
//APPL_DEBUG("Error to get position (return Last)");
return m_elmentList[m_elmentList.Size()-1].m_bufferPos;
return m_elmentList[m_elmentList.size()-1].m_bufferPos;
} else {
//APPL_DEBUG("Error to get position (return begin)");
return m_elmentList[0].m_bufferPos;
@ -559,13 +559,13 @@ int32_t BufferText::GetMousePosition(vec2 pos)
// TODO : Simplify selection ....
void BufferText::MouseEvent(vec2 pos)
{
if (false) { //ewol::GetCurrentSpecialKeyStatus().IsSetShift() ) {
if (false) { //ewol::getCurrentSpecialKeyStatus().isSetShift() ) {
MouseSelectFromCursorTo(pos);
} else {
// Get the caracter mouse position
int32_t newPos = GetMousePosition(pos);
// get the caracter mouse position
int32_t newPos = getMousePosition(pos);
// move the cursor
SetInsertPosition(newPos);
setInsertPosition(newPos);
// if a preferred column wasn't aleady established, establish it
/*if (m_cursorPreferredCol < 0) {
@ -584,21 +584,21 @@ void BufferText::MouseEvent(vec2 pos)
*
* @return ---
*
* @todo : Set the move up and DOWN...
* @todo : set the move up and DOWN...
*
*/
void BufferText::MouseSelectFromCursorTo(vec2 pos)
{
// Get the caracter mouse position
int32_t newPos = GetMousePosition(pos);
// get the caracter mouse position
int32_t newPos = getMousePosition(pos);
int32_t selStart, selEnd, selRectStart, selRectEnd;
bool selIsRect;
int32_t selHave = m_EdnBuf.GetSelectionPos(selStart, selEnd, selIsRect, selRectStart, selRectEnd);
int32_t selHave = m_EdnBuf.getSelectionPos(selStart, selEnd, selIsRect, selRectStart, selRectEnd);
//APPL_DEBUG("BufferText:: " << selHave << " = BufGetSelectionPos(SELECTION_PRIMARY," << selStart << "," << selEnd << "," << selIsRect << "," << selRectStart << "," << selRectEnd << ");" );
int32_t rememberCursorPos = m_cursorPos;
// move the cursor
SetInsertPosition(newPos);
setInsertPosition(newPos);
// if a preferred column wasn't aleady established, establish it
/*if (m_cursorPreferredCol < 0) {
@ -654,19 +654,19 @@ void BufferText::MouseEventTriple(void)
Copy(ewol::clipBoard::clipboardSelection);
}
void BufferText::RemoveLine(void)
void BufferText::removeLine(void)
{
int32_t start = m_EdnBuf.StartOfLine(m_cursorPos);
int32_t stop = m_EdnBuf.EndOfLine(m_cursorPos);
m_EdnBuf.Remove(start, stop+1);
SetInsertPosition(start);
SetModify(true);
m_EdnBuf.remove(start, stop+1);
setInsertPosition(start);
setModify(true);
}
void BufferText::SelectAll(void)
{
m_EdnBuf.Select(0, m_EdnBuf.Size());
m_cursorPos = m_EdnBuf.Size();
m_EdnBuf.Select(0, m_EdnBuf.size());
m_cursorPos = m_EdnBuf.size();
Copy(ewol::clipBoard::clipboardSelection);
}
@ -684,11 +684,11 @@ void BufferText::SelectNone(void)
* @return ---
*
*/
void BufferText::SetInsertPosition(int32_t newPos, bool insertChar)
void BufferText::setInsertPosition(int32_t newPos, bool insertChar)
{
int32_t SelectionStart, SelectionEnd, SelectionRectStart, SelectionRectEnd;
bool SelectionIsRect;
bool haveSelectionActive = m_EdnBuf.GetSelectionPos(SelectionStart, SelectionEnd, SelectionIsRect, SelectionRectStart, SelectionRectEnd);
bool haveSelectionActive = m_EdnBuf.getSelectionPos(SelectionStart, SelectionEnd, SelectionIsRect, SelectionRectStart, SelectionRectEnd);
int32_t rememberCursorPos = m_cursorPos;
//APPL_DEBUG("newPos=" << newPos);
@ -700,8 +700,8 @@ void BufferText::SetInsertPosition(int32_t newPos, bool insertChar)
if (newPos < 0){
newPos = 0;
}
if (newPos > m_EdnBuf.Size()) {
newPos = m_EdnBuf.Size();
if (newPos > m_EdnBuf.size()) {
newPos = m_EdnBuf.size();
}
m_cursorPos = newPos;
}
@ -713,11 +713,11 @@ void BufferText::SetInsertPosition(int32_t newPos, bool insertChar)
}
if( false == haveSelectionActive
&& true == false ) //ewol::GetCurrentSpecialKeyStatus().IsSetShift() )
&& true == false ) //ewol::getCurrentSpecialKeyStatus().isSetShift() )
{
// new selection
m_EdnBuf.Select(rememberCursorPos, m_cursorPos);
} else if( true == false //ewol::GetCurrentSpecialKeyStatus().IsSetShift()
} else if( true == false //ewol::getCurrentSpecialKeyStatus().isSetShift()
&& true == haveSelectionActive)
{
// update selection
@ -733,7 +733,7 @@ bool BufferText::TextDMoveUp(int32_t offset)
{
int32_t lineStartPos, column, prevLineStartPos, newPos;
// Find the position of the start of the line.
// find the position of the start of the line.
lineStartPos = m_EdnBuf.StartOfLine(m_cursorPos);
// check if we can go up ...
if (lineStartPos == 0) {
@ -747,15 +747,15 @@ bool BufferText::TextDMoveUp(int32_t offset)
column = m_EdnBuf.CountDispChars(lineStartPos, m_cursorPos);
}
// Get the previous line
// get the previous line
prevLineStartPos = m_EdnBuf.CountBackwardNLines(lineStartPos, offset);
//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
newPos = m_EdnBuf.CountForwardDispChars(prevLineStartPos, column);
//APPL_INFO("Move to colomn : column=" << column << " newPos=" << newPos);
// move the cursor
SetInsertPosition(newPos);
setInsertPosition(newPos);
// if a preferred column wasn't aleady established, establish it
if (m_cursorPreferredCol < 0) {
@ -770,10 +770,10 @@ bool BufferText::TextDMoveDown(int32_t offset)
int32_t lineStartPos, column, nextLineStartPos, newPos;
// check if we are not at the end of Buffer
if (m_cursorPos == m_EdnBuf.Size() ) {
if (m_cursorPos == m_EdnBuf.size() ) {
return false;
}
// Find the position of the start of the line.
// find the position of the start of the line.
lineStartPos = m_EdnBuf.StartOfLine(m_cursorPos);
if (m_cursorPreferredCol >= 0) {
@ -783,12 +783,12 @@ bool BufferText::TextDMoveDown(int32_t offset)
}
// get the next line :
nextLineStartPos = m_EdnBuf.CountForwardNLines(lineStartPos, offset);
//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
newPos = m_EdnBuf.CountForwardDispChars(nextLineStartPos, column);
//APPL_INFO("Move to colomn : column=" << column << " newPos=" << newPos);
SetInsertPosition(newPos);
setInsertPosition(newPos);
// if a preferred column wasn't aleady established, establish it
if (m_cursorPreferredCol < 0) {
m_cursorPreferredCol = column;
@ -813,13 +813,13 @@ void BufferText::cursorMove(ewol::keyEvent::keyboard_te moveTypeEvent)
case ewol::keyEvent::keyboardLeft:
//APPL_INFO("keyEvent : <LEFT>");
if (m_cursorPos > 0) {
SetInsertPosition(m_cursorPos - 1);
setInsertPosition(m_cursorPos - 1);
}
break;
case ewol::keyEvent::keyboardRight:
//APPL_INFO("keyEvent : <RIGHT>");
if (m_cursorPos < m_EdnBuf.Size() ) {
SetInsertPosition(m_cursorPos + 1);
if (m_cursorPos < m_EdnBuf.size() ) {
setInsertPosition(m_cursorPos + 1);
}
break;
case ewol::keyEvent::keyboardUp:
@ -841,11 +841,11 @@ void BufferText::cursorMove(ewol::keyEvent::keyboard_te moveTypeEvent)
break;
case ewol::keyEvent::keyboardStart:
//APPL_INFO("keyEvent : <Start of line>");
SetInsertPosition(m_EdnBuf.StartOfLine(m_cursorPos) );
setInsertPosition(m_EdnBuf.StartOfLine(m_cursorPos) );
break;
case ewol::keyEvent::keyboardEnd:
//APPL_INFO("keyEvent : <End of line>");
SetInsertPosition(m_EdnBuf.EndOfLine(m_cursorPos) );
setInsertPosition(m_EdnBuf.EndOfLine(m_cursorPos) );
break;
default:
//LastUpDownoutputPosition = -1;
@ -866,13 +866,13 @@ void BufferText::cursorMove(ewol::keyEvent::keyboard_te moveTypeEvent)
* @return ---
*
*/
vec2 BufferText::GetPosition(int32_t fontId, bool& centerRequested)
vec2 BufferText::getPosition(int32_t fontId, bool& centerRequested)
{
centerRequested = m_centerRequested;
m_centerRequested = false;
vec2 outputPosition(0,0);
// Display position (Y mode):
// display position (Y mode):
APPL_INFO("change the position : " << m_cursorPos);
// get the line id of the curent position of the cursor :
outputPosition.setY(m_EdnBuf.CountLines(0, m_cursorPos));
@ -884,10 +884,10 @@ vec2 BufferText::GetPosition(int32_t fontId, bool& centerRequested)
// get font porperties :
// TODO : change this :
// TODO : Set it back ...
// TODO : set it back ...
/*
float letterWidth = ewol::GetWidth(fontId, "A");
float letterHeight = ewol::GetHeight(fontId);
float letterWidth = ewol::getWidth(fontId, "A");
float letterHeight = ewol::getHeight(fontId);
*/
float letterWidth = 10;
float letterHeight = 15;
@ -925,28 +925,28 @@ vec2 BufferText::GetPosition(int32_t fontId, bool& centerRequested)
* @return ---
*
*/
void BufferText::AddChar(uniChar_t unicodeData)
void BufferText::addChar(uniChar_t unicodeData)
{
int32_t SelectionStart, SelectionEnd, SelectionRectStart, SelectionRectEnd;
bool SelectionIsRect;
bool haveSelectionActive = m_EdnBuf.GetSelectionPos(SelectionStart, SelectionEnd, SelectionIsRect, SelectionRectStart, SelectionRectEnd);
bool haveSelectionActive = m_EdnBuf.getSelectionPos(SelectionStart, SelectionEnd, SelectionIsRect, SelectionRectStart, SelectionRectEnd);
if (unicodeData == 0x09) {
if (false == haveSelectionActive) {
etk::Vector<int8_t> tmpVect;
tmpVect.PushBack(0x09);
m_EdnBuf.Insert(m_cursorPos, tmpVect);
SetInsertPosition(m_cursorPos+1, true);
tmpVect.pushBack(0x09);
m_EdnBuf.insert(m_cursorPos, tmpVect);
setInsertPosition(m_cursorPos+1, true);
} else {
// Indent depend of the multiline in the selection ...
// count the number of line :
int32_t nbSelectedLines = m_EdnBuf.CountLines(SelectionStart, SelectionEnd);
if (0 == nbSelectedLines) {
etk::Vector<int8_t> tmpVect;
tmpVect.PushBack(0x09);
tmpVect.pushBack(0x09);
m_EdnBuf.ReplaceSelected(tmpVect);
SetInsertPosition(SelectionStart+tmpVect.Size(), true);
setInsertPosition(SelectionStart+tmpVect.size(), true);
} else {
if (true == false ) { //ewol::GetCurrentSpecialKeyStatus().IsSetShift() ) {
if (true == false ) { //ewol::getCurrentSpecialKeyStatus().isSetShift() ) {
m_cursorPos = m_EdnBuf.UnIndent();
} else {
m_cursorPos = m_EdnBuf.Indent();
@ -955,14 +955,14 @@ void BufferText::AddChar(uniChar_t unicodeData)
}
} else if (unicodeData == '\n') {
etk::Vector<int8_t> tmpVect;
if (true == false ) { //ewol::GetCurrentSpecialKeyStatus().IsSetShift()) {
tmpVect.PushBack('\r');
if (true == false ) { //ewol::getCurrentSpecialKeyStatus().isSetShift()) {
tmpVect.pushBack('\r');
} else {
tmpVect.PushBack('\n');
// if Auto indent Enable ==> we get the start of the previous line and add it to tne new one
if (true == globals::IsSetAutoIndent() ) {
tmpVect.pushBack('\n');
// if Auto indent enable == > we get the start of the previous line and add it to tne new one
if (true == globals::isSetAutoIndent() ) {
int32_t l_lineStart;
// Get the begin of the line or the begin of the line befor selection
// get the begin of the line or the begin of the line befor selection
if (false == haveSelectionActive) {
l_lineStart = m_EdnBuf.StartOfLine(m_cursorPos);
} else {
@ -971,86 +971,86 @@ void BufferText::AddChar(uniChar_t unicodeData)
// add same characters in the temporar buffer
for (int32_t kk=l_lineStart; kk<m_cursorPos; kk++) {
if (' ' == m_EdnBuf[kk]) {
tmpVect.PushBack(' ');
tmpVect.pushBack(' ');
} else if('\t' == m_EdnBuf[kk]) {
tmpVect.PushBack('\t');
tmpVect.pushBack('\t');
} else {
break;
}
}
}
}
// Set temporary buffer in the real buffer
// set temporary buffer in the real buffer
if (false == haveSelectionActive) {
m_EdnBuf.Insert(m_cursorPos, tmpVect);
SetInsertPosition(m_cursorPos+tmpVect.Size(), true);
m_EdnBuf.insert(m_cursorPos, tmpVect);
setInsertPosition(m_cursorPos+tmpVect.size(), true);
} else {
m_EdnBuf.ReplaceSelected(tmpVect);
SetInsertPosition(SelectionStart+tmpVect.Size(), true);
setInsertPosition(SelectionStart+tmpVect.size(), true);
}
} else if (unicodeData == 0x7F ) {
//APPL_INFO("keyEvent : <Suppr> pos=" << m_cursorPos);
if (false == haveSelectionActive) {
m_EdnBuf.Remove(m_cursorPos, m_cursorPos+1);
m_EdnBuf.remove(m_cursorPos, m_cursorPos+1);
} else {
m_EdnBuf.RemoveSelected();
SetInsertPosition(SelectionStart, true);
m_EdnBuf.removeSelected();
setInsertPosition(SelectionStart, true);
}
} else if (unicodeData == 0x08) {
//APPL_INFO("keyEvent : <Del> pos=" << m_cursorPos);
if (false == haveSelectionActive) {
m_EdnBuf.Remove(m_cursorPos-1, m_cursorPos);
SetInsertPosition(m_cursorPos-1, true);
m_EdnBuf.remove(m_cursorPos-1, m_cursorPos);
setInsertPosition(m_cursorPos-1, true);
} else {
m_EdnBuf.RemoveSelected();
SetInsertPosition(SelectionStart, true);
m_EdnBuf.removeSelected();
setInsertPosition(SelectionStart, true);
}
} else {
// normal adding char ...
if (true == m_EdnBuf.GetUTF8Mode()) {
if (true == m_EdnBuf.getUTF8Mode()) {
char tmpUTF8[16];
unicodeData.GetUtf8(tmpUTF8);
unicodeData.getUtf8(tmpUTF8);
etk::Vector<int8_t> tmpVect;
int32_t localOfset = strlen(tmpUTF8);
tmpVect.PushBack((int8_t*)tmpUTF8, localOfset);
tmpVect.pushBack((int8_t*)tmpUTF8, localOfset);
if (false == haveSelectionActive) {
m_EdnBuf.Insert(m_cursorPos, tmpVect);
SetInsertPosition(m_cursorPos+localOfset, true);
m_EdnBuf.insert(m_cursorPos, tmpVect);
setInsertPosition(m_cursorPos+localOfset, true);
} else {
m_EdnBuf.ReplaceSelected(tmpVect);
SetInsertPosition(SelectionStart+localOfset, true);
setInsertPosition(SelectionStart+localOfset, true);
}
} else {
// convert in the Good ISO format :
char output_ISO;
unicode::convertUnicodeToIso(m_EdnBuf.GetCharsetType(), unicodeData, output_ISO);
unicode::convertUnicodeToIso(m_EdnBuf.getCharsetType(), unicodeData, output_ISO);
//printf(" insert : \"%s\" == > 0x%08x=%d ", UTF8data, (unsigned int)output_ISO, (int)output_ISO);
etk::Vector<int8_t> tmpVect;
tmpVect.PushBack(output_ISO);
tmpVect.pushBack(output_ISO);
if (false == haveSelectionActive) {
m_EdnBuf.Insert(m_cursorPos, tmpVect);
SetInsertPosition(m_cursorPos+1, true);
m_EdnBuf.insert(m_cursorPos, tmpVect);
setInsertPosition(m_cursorPos+1, true);
} else {
m_EdnBuf.ReplaceSelected(tmpVect);
SetInsertPosition(SelectionStart+1, true);
setInsertPosition(SelectionStart+1, true);
}
}
}
SetModify(true);
setModify(true);
RequestUpdateOfThePosition();
}
int32_t BufferText::FindLine(etk::UString &data)
int32_t BufferText::findLine(etk::UString &data)
{
if ( 0 == data.Size()) {
if ( 0 == data.size()) {
APPL_WARNING("no search data");
return 0;
}
APPL_INFO("Search data line : \"" << data << "\"");
etk::Vector<uniChar_t> mVectSearch;
mVectSearch = data.GetVector();
mVectSearch = data.getVector();
//APPL_INFO("search data Forward : startSearchPos=" << startSearchPos );
/*
int32_t foundPos;
@ -1071,20 +1071,20 @@ void BufferText::JumpAtLine(int32_t newLine)
int32_t positionLine = m_EdnBuf.CountForwardNLines(0, newLine);
m_EdnBuf.Unselect();
APPL_DEBUG("jump at the line : " << newLine );
SetInsertPosition(positionLine);
setInsertPosition(positionLine);
m_centerRequested = true;
RequestUpdateOfThePosition();
}
/**
* @brief Get the current line (to know where to jump)
* @brief get the current line (to know where to jump)
*
* @param ---
*
* @return Return the current line number
*
*/
int32_t BufferText::GetCurrentLine(void)
int32_t BufferText::getCurrentLine(void)
{
return m_EdnBuf.CountLines(0, m_cursorPos);
}
@ -1097,7 +1097,7 @@ void BufferText::Search(etk::UString &data, bool back, bool caseSensitive, bool
int32_t SelectionStart, SelectionEnd, SelectionRectStart, SelectionRectEnd;
bool SelectionIsRect;
bool haveSelectionActive = m_EdnBuf.GetSelectionPos(SelectionStart, SelectionEnd, SelectionIsRect, SelectionRectStart, SelectionRectEnd);
bool haveSelectionActive = m_EdnBuf.getSelectionPos(SelectionStart, SelectionEnd, SelectionIsRect, SelectionRectStart, SelectionRectEnd);
int32_t startSearchPos = m_cursorPos;
if (true == haveSelectionActive) {
@ -1108,7 +1108,7 @@ void BufferText::Search(etk::UString &data, bool back, bool caseSensitive, bool
}
}
if ( 0 == data.Size()) {
if ( 0 == data.size()) {
APPL_WARNING("no search data");
return;
}
@ -1126,11 +1126,11 @@ void BufferText::Search(etk::UString &data, bool back, bool caseSensitive, bool
// if find data :
if (true == findSomething) {
// select new position
SetInsertPosition(foundPosEnd);
setInsertPosition(foundPosEnd);
m_EdnBuf.Select(foundPos, foundPosEnd);
}
} else {
//APPL_INFO("search data Backward : " << data.GetDirectPointer() );
//APPL_INFO("search data Backward : " << data.getDirectPointer() );
int32_t foundPos;
int32_t foundPosEnd;
bool findSomething = m_EdnBuf.SearchBackward(startSearchPos, data, &foundPos, &foundPosEnd, caseSensitive);
@ -1138,12 +1138,12 @@ void BufferText::Search(etk::UString &data, bool back, bool caseSensitive, bool
&& true == wrap)
{
//APPL_INFO("WrapMode !!! end == > 0");
findSomething = m_EdnBuf.SearchBackward(m_EdnBuf.Size(), data, &foundPos, &foundPosEnd, caseSensitive);
findSomething = m_EdnBuf.SearchBackward(m_EdnBuf.size(), data, &foundPos, &foundPosEnd, caseSensitive);
}
// if find data :
if (true == findSomething) {
// select new position
SetInsertPosition(foundPos);
setInsertPosition(foundPos);
m_EdnBuf.Select(foundPos, foundPosEnd);
}
}
@ -1156,13 +1156,13 @@ void BufferText::Replace(etk::UString &data)
{
int32_t SelectionStart, SelectionEnd, SelectionRectStart, SelectionRectEnd;
bool SelectionIsRect;
bool haveSelectionActive = m_EdnBuf.GetSelectionPos(SelectionStart, SelectionEnd, SelectionIsRect, SelectionRectStart, SelectionRectEnd);
bool haveSelectionActive = m_EdnBuf.getSelectionPos(SelectionStart, SelectionEnd, SelectionIsRect, SelectionRectStart, SelectionRectEnd);
if (true == haveSelectionActive) {
// Replace Data :
int32_t size = m_EdnBuf.ReplaceSelected(data);
SetInsertPosition(SelectionStart + size);
setInsertPosition(SelectionStart + size);
}
SetModify(true);
setModify(true);
}
@ -1179,10 +1179,10 @@ void BufferText::Copy(ewol::clipBoard::clipboardListe_te clipboardID)
etk::UString mVect;
// get the curent selected data
if (true == m_EdnBuf.SelectHasSelection() ) {
m_EdnBuf.GetSelectionText(mVect);
m_EdnBuf.getSelectionText(mVect);
}
// copy data in the click board :
ewol::clipBoard::Set(clipboardID, mVect);
ewol::clipBoard::set(clipboardID, mVect);
}
@ -1199,18 +1199,18 @@ void BufferText::Cut(ewol::clipBoard::clipboardListe_te clipboardID)
int32_t SelectionStart, SelectionEnd, SelectionRectStart, SelectionRectEnd;
bool SelectionIsRect;
bool haveSelectionActive = m_EdnBuf.GetSelectionPos(SelectionStart, SelectionEnd, SelectionIsRect, SelectionRectStart, SelectionRectEnd);
bool haveSelectionActive = m_EdnBuf.getSelectionPos(SelectionStart, SelectionEnd, SelectionIsRect, SelectionRectStart, SelectionRectEnd);
// copy data
Copy(clipboardID);
// remove data :
if (true == haveSelectionActive ) {
APPL_INFO("REMOVE SELECTION");
m_EdnBuf.RemoveSelected();
m_EdnBuf.removeSelected();
m_cursorPos = SelectionStart;
}
RequestUpdateOfThePosition();
SetModify(true);
setModify(true);
}
@ -1226,11 +1226,11 @@ void BufferText::Paste(ewol::clipBoard::clipboardListe_te clipboardID)
{
etk::UString mVect;
// copy data from the click board :
mVect = ewol::clipBoard::Get(clipboardID);
mVect = ewol::clipBoard::get(clipboardID);
int32_t SelectionStart, SelectionEnd, SelectionRectStart, SelectionRectEnd;
bool SelectionIsRect;
bool haveSelectionActive = m_EdnBuf.GetSelectionPos(SelectionStart, SelectionEnd, SelectionIsRect, SelectionRectStart, SelectionRectEnd);
bool haveSelectionActive = m_EdnBuf.getSelectionPos(SelectionStart, SelectionEnd, SelectionIsRect, SelectionRectStart, SelectionRectEnd);
if (true == haveSelectionActive ) {
// replace data
@ -1238,11 +1238,11 @@ void BufferText::Paste(ewol::clipBoard::clipboardListe_te clipboardID)
m_cursorPos = SelectionStart + size;
} else {
// insert data
int32_t size = m_EdnBuf.Insert(m_cursorPos, mVect);
int32_t size = m_EdnBuf.insert(m_cursorPos, mVect);
m_cursorPos += size;
}
RequestUpdateOfThePosition();
SetModify(true);
setModify(true);
}
@ -1250,9 +1250,9 @@ void BufferText::Undo(void)
{
int32_t newPos = m_EdnBuf.Undo();
if (newPos >= 0) {
SetInsertPosition(newPos, true);
setInsertPosition(newPos, true);
RequestUpdateOfThePosition();
SetModify(true);
setModify(true);
}
}
@ -1260,15 +1260,15 @@ void BufferText::Redo(void)
{
int32_t newPos = m_EdnBuf.Redo();
if (newPos >= 0) {
SetInsertPosition(newPos, true);
setInsertPosition(newPos, true);
RequestUpdateOfThePosition();
SetModify(true);
setModify(true);
}
}
void BufferText::SetCharset(unicode::charset_te newCharset)
void BufferText::setCharset(unicode::charset_te newCharset)
{
m_EdnBuf.SetCharsetType(newCharset);
m_EdnBuf.setCharsetType(newCharset);
}

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';
@ -609,8 +609,8 @@ int32_t EdnBuf::GetExpandedChar(int32_t &pos, int32_t indent, uniChar_t outUnico
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] = '<';
@ -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,13 +847,13 @@ 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) {
@ -868,7 +868,7 @@ int32_t EdnBuf::CountForwardNLines(int32_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)
@ -880,8 +880,8 @@ 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);
@ -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;
}
@ -993,17 +993,17 @@ 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--) {
@ -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;
}
@ -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)
@ -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;
@ -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 ...
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;
}

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,15 +153,15 @@ 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)

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,12 +14,12 @@
#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());
}
}
@ -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;
}
@ -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,13 +214,13 @@ 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);
}
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);
}
@ -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,17 +277,17 @@ 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 :
@ -310,9 +310,9 @@ void EdnBuf::HightlightGenerateLines(displayHLData_ts & MData, int32_t HLStart,
//APPL_DEBUG(" == > (under section ) k="<<k<<" start="<<m_HLDataPass1[k].beginStart<<" stop="<<m_HLDataPass1[k].endStop << " subSectionOfID=" << 99999999);
// TODO : ...
}
if (endSearch == (int32_t)m_HLDataPass1.Size() ){
//if( k < (int32_t)m_HLDataPass1.Size()) {
if (m_HLDataPass1.Size() != 0) {
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,
@ -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)

View File

@ -25,7 +25,7 @@ Colorize::Colorize(const etk::UString &_newColorName) :
APPL_VERBOSE("New(Colorise)");
}
void Colorize::SetItalic(bool _enable)
void Colorize::setItalic(bool _enable)
{
m_italic = _enable;
if (true == _enable) {
@ -35,7 +35,7 @@ void Colorize::SetItalic(bool _enable)
}
}
void Colorize::SetBold(bool _enable)
void Colorize::setBold(bool _enable)
{
m_bold = _enable;
if (true == _enable) {

View File

@ -20,32 +20,32 @@ class Colorize {
private:
etk::UString m_colorName; //!< curent color Name
public:
void SetName(const etk::UString& _newColorName) { m_colorName = _newColorName; };
const etk::UString& GetName(void) { return m_colorName; };
void setName(const etk::UString& _newColorName) { m_colorName = _newColorName; };
const etk::UString& getName(void) { return m_colorName; };
private:
etk::Color<> m_colorFG;
public:
void SetFgColor(const etk::UString& _myColor) { m_colorFG=_myColor; };
const etk::Color<>& GetFG(void) { return m_colorFG; };
bool HaveFg(void) { return m_colorFG.a()!=0; };
void setFgColor(const etk::UString& _myColor) { m_colorFG=_myColor; };
const etk::Color<>& getFG(void) { return m_colorFG; };
bool haveFg(void) { return m_colorFG.a()!=0; };
private:
etk::Color<> m_colorBG;
public:
void SetBgColor(const etk::UString& _myColor) { m_colorBG=_myColor; };
const etk::Color<>& GetBG(void) { return m_colorBG; };
bool HaveBg(void) { return m_colorBG.a()!=0; };
void setBgColor(const etk::UString& _myColor) { m_colorBG=_myColor; };
const etk::Color<>& getBG(void) { return m_colorBG; };
bool haveBg(void) { return m_colorBG.a()!=0; };
private:
bool m_italic;
public:
void SetItalic(bool _enable);
bool GetItalic(void) { return m_italic; };
void setItalic(bool _enable);
bool getItalic(void) { return m_italic; };
private:
bool m_bold;
public:
void SetBold(bool _enable);
bool GetBold(void) { return m_bold; };
void Display(int32_t _i) { APPL_INFO(" " << _i << " : fg="<< m_colorFG << " bold=" << m_italic << " bold=" << m_italic << "\"" << m_colorName << "\""); };
void setBold(bool _enable);
bool getBold(void) { return m_bold; };
void display(int32_t _i) { APPL_INFO(" " << _i << " : fg="<< m_colorFG << " bold=" << m_italic << " bold=" << m_italic << "\"" << m_colorName << "\""); };
};
#endif

View File

@ -28,7 +28,7 @@ class classColorManager: public ewol::EObject
// Constructeur
classColorManager(void)
{
//ewol::widgetMessageMultiCast::Add(GetWidgetId(), ednMsgGuiChangeColor);
//ewol::widgetMessageMultiCast::add(getWidgetId(), ednMsgGuiChangeColor);
}
~classColorManager(void)
{
@ -36,43 +36,43 @@ class classColorManager: public ewol::EObject
int32_t i;
// clean all Element
for (i=0; i< listMyColor.Size(); i++) {
for (i=0; i< listMyColor.size(); i++) {
if (NULL != listMyColor[i]) {
delete(listMyColor[i]);
listMyColor[i] = NULL;
}
}
// clear the compleate list
listMyColor.Clear();
listMyColor.clear();
}
const char * const GetObjectType(void)
const char * const getObjectType(void)
{
return "Appl::ColorManager";
}
void OnReceiveMessage(const ewol::EMessage& _msg)
void onReceiveMessage(const ewol::EMessage& _msg)
{
/*
switch (id)
{
case APPL_MSG__RELOAD_COLOR_FILE:
{
// Reaload File
// Reaload file
// TODO : Check this : Pb in the recopy etk::UString element
etk::UString plop = m_fileColor;
LoadFile(plop);
loadFile(plop);
}
break;
}
*/
}
public:
void LoadFile(const etk::UString& _xmlFilename);
Colorize* Get(const etk::UString& _colorName)
void loadFile(const etk::UString& _xmlFilename);
Colorize* get(const etk::UString& _colorName)
{
int32_t i;
for (i=0; i<listMyColor.Size(); i++) {
if (listMyColor[i]->GetName() == _colorName) {
for (i=0; i<listMyColor.size(); i++) {
if (listMyColor[i]->getName() == _colorName) {
return listMyColor[i];
}
}
@ -80,7 +80,7 @@ class classColorManager: public ewol::EObject
// an error
return errorColor;
}
etk::Color<>& Get(basicColor_te _myColor)
etk::Color<>& get(basicColor_te _myColor)
{
if (_myColor < COLOR_NUMBER_MAX) {
return basicColors[_myColor];
@ -91,81 +91,81 @@ class classColorManager: public ewol::EObject
bool Exist(const etk::UString& _colorName)
{
int32_t i;
for (i=0; i<listMyColor.Size(); i++) {
if (listMyColor[i]->GetName() == _colorName) {
for (i=0; i<listMyColor.size(); i++) {
if (listMyColor[i]->getName() == _colorName) {
return true;
}
}
return false;
}
void DisplayListOfColor(void)
void displayListOfColor(void)
{
int32_t i;
APPL_INFO(PFX"List of ALL COLOR : ");
for (i=0; i<listMyColor.Size(); i++) {
//etk::UString elementName = listMyColor[i]->GetName();
for (i=0; i<listMyColor.size(); i++) {
//etk::UString elementName = listMyColor[i]->getName();
//APPL_INFO(i << " : \"" << elementName.c_str() << "\"" );
listMyColor[i]->Display(i);
listMyColor[i]->display(i);
}
}
};
void classColorManager::LoadFile(const etk::UString& _xmlFilename)
void classColorManager::loadFile(const etk::UString& _xmlFilename)
{
// Remove all old color :
for (int32_t iii=0; iii< listMyColor.Size(); iii++) {
// remove all old color :
for (int32_t iii=0; iii< listMyColor.size(); iii++) {
if (NULL != listMyColor[iii]) {
delete(listMyColor[iii]);
listMyColor[iii] = NULL;
}
}
// clear the compleate list
listMyColor.Clear();
listMyColor.clear();
m_fileColor = _xmlFilename;
APPL_DEBUG("open file (COLOR) \"" << _xmlFilename << "\" ? = \"" << m_fileColor << "\"");
errorColor = new Colorize();
errorColor->SetBgColor("#00FF00FF");
errorColor->SetFgColor("#FF00FFFF");
errorColor->setBgColor("#00FF00FF");
errorColor->setFgColor("#FF00FFFF");
// open the curent File
// open the curent file
etk::UString fileName(etk::UString("DATA:color/") + _xmlFilename + etk::UString(".xml"));
exml::Document doc;
if (doc.Load(fileName)==false) {
if (doc.load(fileName) == false) {
APPL_ERROR(" can not load file XML : " << fileName);
return;
}
exml::Element* root = (exml::Element*)doc.GetNamed("EdnColor");
exml::Element* root = (exml::Element*)doc.getNamed("EdnColor");
if (NULL == root ) {
APPL_ERROR("[" << GetId() << "] {" << GetObjectType() << "} (l ?) main node not find: \"EdnColor\" ...");
APPL_ERROR("[" << getId() << "] {" << GetObjectType() << "} (l ?) main node not find: \"EdnColor\" ...");
return;
}
// parse all the elements :
for(int32_t iii=0; iii< root->Size(); iii++) {
exml::Element* pNode = root->GetElement(iii);
for(int32_t iii=0; iii< root->size(); iii++) {
exml::Element* pNode = root->getElement(iii);
if (pNode == NULL) {
// trash here all that is not element.
continue;
}
if (pNode->GetValue()=="gui") {
for(int32_t iii=0; iii< pNode->Size(); iii++) {
exml::Element* pGuiNode = pNode->GetElement(iii);
if (pNode->getValue() == "gui") {
for(int32_t iii=0; iii< pNode->size(); iii++) {
exml::Element* pGuiNode = pNode->getElement(iii);
if (pGuiNode == NULL) {
// trash here all that is not element.
continue;
}
if (pGuiNode->GetValue()!="color") {
APPL_ERROR("(l "<<pGuiNode->GetPos()<<") node not suported : \""<<pGuiNode->GetValue()<<"\" must be [color]");
if (pGuiNode->getValue()!="color") {
APPL_ERROR("(l "<<pGuiNode->getPos()<<") node not suported : \""<<pGuiNode->GetValue()<<"\" must be [color]");
continue;
}
//--------------------------------------------------------------------------------------------
//<color name="basicBackground" val="#000000"/>
//--------------------------------------------------------------------------------------------
etk::UString colorName = pGuiNode->GetAttribute("name");
if (colorName.Size()==0) {
APPL_ERROR("(l "<< pGuiNode->GetPos() <<") node with no name");
etk::UString colorName = pGuiNode->getAttribute("name");
if (colorName.size() == 0) {
APPL_ERROR("(l "<< pGuiNode->getPos() <<") node with no name");
continue;
}
int32_t id = 0;
@ -190,56 +190,56 @@ void classColorManager::LoadFile(const etk::UString& _xmlFilename)
} else if (colorName == "LIST_textModify") {
id = COLOR_LIST_TEXT_MODIFY;
} else {
APPL_ERROR("(l "<<pGuiNode->GetPos()<<") Unknown basic gui color : \"" << colorName << "\"" );
APPL_ERROR("(l "<<pGuiNode->getPos()<<") Unknown basic gui color : \"" << colorName << "\"" );
continue;
}
etk::UString color = pGuiNode->GetAttribute("val");
if (color.Size()!=0) {
etk::UString color = pGuiNode->getAttribute("val");
if (color.size()!=0) {
basicColors[id] = color;
}
}
} else if (pNode->GetValue()=="syntax") {
for(int32_t iii=0; iii< pNode->Size(); iii++) {
exml::Element* pGuiNode = pNode->GetElement(iii);
} else if (pNode->getValue() == "syntax") {
for(int32_t iii=0; iii< pNode->size(); iii++) {
exml::Element* pGuiNode = pNode->getElement(iii);
if (pGuiNode == NULL) {
continue;
}
if (pGuiNode->GetValue()!="color") {
APPL_ERROR(PFX"(l "<<pGuiNode->GetPos()<<") node not suported : \""<<pGuiNode->GetValue()<<"\" must be [color]");
if (pGuiNode->getValue()!="color") {
APPL_ERROR(PFX"(l "<<pGuiNode->getPos()<<") node not suported : \""<<pGuiNode->GetValue()<<"\" must be [color]");
continue;
}
//--------------------------------------------------------------------------------------------
//<color name="basicBackground" FG="#000000" BG="#000000" bold="no" italic="no"/>
//--------------------------------------------------------------------------------------------
// get the name of the Chaine
etk::UString colorName = pGuiNode->GetAttribute("name");
if (colorName.Size()==0) {
APPL_ERROR(PFX"(l "<< pGuiNode->GetPos() <<") node with no name");
etk::UString colorName = pGuiNode->getAttribute("name");
if (colorName.size() == 0) {
APPL_ERROR(PFX"(l "<< pGuiNode->getPos() <<") node with no name");
continue;
}
Colorize* myNewColor = new Colorize();
if (NULL == myNewColor) {
APPL_ERROR(PFX"(l "<< pGuiNode->GetPos() <<") ==> allocation error");
APPL_ERROR(PFX"(l "<< pGuiNode->getPos() <<") == > allocation error");
continue;
}
myNewColor->SetName(colorName);
etk::UString colorBG = pGuiNode->GetAttribute("BG");
if (colorBG.Size()!=0) {
myNewColor->SetBgColor(colorBG);
myNewColor->setName(colorName);
etk::UString colorBG = pGuiNode->getAttribute("BG");
if (colorBG.size()!=0) {
myNewColor->setBgColor(colorBG);
}
etk::UString colorFG = pGuiNode->GetAttribute("FG");
if (colorFG.Size()!=0) {
myNewColor->SetFgColor(colorFG);
etk::UString colorFG = pGuiNode->getAttribute("FG");
if (colorFG.size()!=0) {
myNewColor->setFgColor(colorFG);
}
etk::UString bold = pGuiNode->GetAttribute("bold");
if (bold.Size()!=0) {
myNewColor->SetBold(bold.ToBool());
etk::UString bold = pGuiNode->getAttribute("bold");
if (bold.size()!=0) {
myNewColor->setBold(bold.toBool());
}
etk::UString italic = pGuiNode->GetAttribute("italic");
if (italic.Size()!=0) {
myNewColor->SetItalic(italic.ToBool());
etk::UString italic = pGuiNode->getAttribute("italic");
if (italic.size()!=0) {
myNewColor->setItalic(italic.toBool());
}
listMyColor.PushBack(myNewColor);
listMyColor.pushBack(myNewColor);
}
}
}
@ -253,7 +253,7 @@ void classColorManager::LoadFile(const etk::UString& _xmlFilename)
static classColorManager * localManager = NULL;
void ColorizeManager::Init(void)
void ColorizeManager::init(void)
{
if (NULL != localManager) {
EWOL_ERROR("ColorizeManager == > already exist, just unlink the previous ...");
@ -276,30 +276,30 @@ void ColorizeManager::UnInit(void)
localManager = NULL;
}
void ColorizeManager::LoadFile(const etk::UString& _xmlFilename)
void ColorizeManager::loadFile(const etk::UString& _xmlFilename)
{
if (NULL == localManager) {
return;
}
localManager->LoadFile(_xmlFilename);
localManager->loadFile(_xmlFilename);
}
Colorize* ColorizeManager::Get(const etk::UString& _colorName)
Colorize* ColorizeManager::get(const etk::UString& _colorName)
{
if (NULL == localManager) {
return NULL;
}
return localManager->Get(_colorName);
return localManager->get(_colorName);
}
etk::Color<>& ColorizeManager::Get(basicColor_te _myColor)
etk::Color<>& ColorizeManager::get(basicColor_te _myColor)
{
static etk::Color<> errorColor;
if (NULL == localManager) {
return errorColor;
}
return localManager->Get(_myColor);
return localManager->get(_myColor);
}
bool ColorizeManager::Exist(const etk::UString& _colorName)
@ -310,12 +310,12 @@ bool ColorizeManager::Exist(const etk::UString& _colorName)
return localManager->Exist(_colorName);
}
void ColorizeManager::DisplayListOfColor(void)
void ColorizeManager::displayListOfColor(void)
{
if (NULL == localManager) {
return;
}
localManager->DisplayListOfColor();
localManager->displayListOfColor();
}

View File

@ -35,13 +35,13 @@ typedef enum {
namespace ColorizeManager
{
void Init(void);
void init(void);
void UnInit(void);
void LoadFile(const etk::UString& _xmlFilename);
Colorize * Get(const etk::UString& _colorName);
etk::Color<>& Get(basicColor_te _myColor);
void loadFile(const etk::UString& _xmlFilename);
Colorize * get(const etk::UString& _colorName);
etk::Color<>& get(basicColor_te _myColor);
bool Exist(const etk::UString& _colorName);
void DisplayListOfColor(void);
void displayListOfColor(void);
};
#endif

View File

@ -22,20 +22,20 @@
static void SortElementList(etk::Vector<appl::dataBufferStruct *> &list)
{
etk::Vector<appl::dataBufferStruct *> tmpList = list;
list.Clear();
for(int32_t iii=0; iii<tmpList.Size(); iii++) {
list.clear();
for(int32_t iii=0; iii<tmpList.size(); iii++) {
if (NULL != tmpList[iii]) {
int32_t findPos = 0;
for(int32_t jjj=0; jjj<list.Size(); jjj++) {
for(int32_t jjj=0; jjj<list.size(); jjj++) {
//EWOL_DEBUG("compare : \""<<*tmpList[iii] << "\" and \"" << *m_listDirectory[jjj] << "\"");
if (list[jjj]!=NULL) {
if (tmpList[iii]->m_bufferName.GetNameFile() > list[jjj]->m_bufferName.GetNameFile()) {
if (tmpList[iii]->m_bufferName.getNameFile() > list[jjj]->m_bufferName.GetNameFile()) {
findPos = jjj+1;
}
}
}
//EWOL_DEBUG("position="<<findPos);
list.Insert(findPos, tmpList[iii]);
list.insert(findPos, tmpList[iii]);
}
}
}
@ -44,7 +44,7 @@ static void SortElementList(etk::Vector<appl::dataBufferStruct *> &list)
BufferView::BufferView(void)
{
SetCanHaveFocus(true);
setCanHaveFocus(true);
RegisterMultiCast(ednMsgBufferListChange);
RegisterMultiCast(ednMsgBufferState);
RegisterMultiCast(ednMsgBufferId);
@ -54,37 +54,37 @@ BufferView::BufferView(void)
BufferView::~BufferView(void)
{
RemoveAllElement();
removeAllElement();
}
void BufferView::RemoveAllElement(void)
void BufferView::removeAllElement(void)
{
for(int32_t iii=0; iii<m_list.Size(); iii++) {
for(int32_t iii=0; iii<m_list.size(); iii++) {
if (NULL!=m_list[iii]) {
delete(m_list[iii]);
m_list[iii] = NULL;
}
}
m_list.Clear();
m_list.clear();
}
void BufferView::OnReceiveMessage(const ewol::EMessage& _msg)
void BufferView::onReceiveMessage(const ewol::EMessage& _msg)
{
widget::List::OnReceiveMessage(_msg);
if (_msg.GetMessage() == ednMsgBufferListChange) {
widget::List::onReceiveMessage(_msg);
if (_msg.getMessage() == ednMsgBufferListChange) {
// clean The list
RemoveAllElement();
// Get all the buffer name and properties:
int32_t nbBufferOpen = BufferManager::Size();
removeAllElement();
// get all the buffer name and properties:
int32_t nbBufferOpen = BufferManager::size();
for (int32_t iii=0; iii<nbBufferOpen; iii++) {
if (BufferManager::Exist(iii)) {
BufferText* tmpBuffer = BufferManager::Get(iii);
BufferText* tmpBuffer = BufferManager::get(iii);
if (NULL != tmpBuffer) {
bool isModify = tmpBuffer->IsModify();
etk::FSNode name = tmpBuffer->GetFileName();
bool isModify = tmpBuffer->isModify();
etk::FSNode name = tmpBuffer->getFileName();
appl::dataBufferStruct* tmpElement = new appl::dataBufferStruct(name, iii, isModify);
if (NULL != tmpElement) {
m_list.PushBack(tmpElement);
m_list.pushBack(tmpElement);
} else {
APPL_ERROR("Allocation error of the tmp buffer list element");
}
@ -94,44 +94,44 @@ void BufferView::OnReceiveMessage(const ewol::EMessage& _msg)
if (true == globals::OrderTheBufferList() ) {
SortElementList(m_list);
}
MarkToRedraw();
}else if (_msg.GetMessage() == ednMsgBufferId) {
m_selectedIdRequested = BufferManager::GetSelected();
MarkToRedraw();
}else if (_msg.GetMessage() == ednMsgBufferState) {
// Update list of modify section ...
for (int32_t iii=0; iii<m_list.Size(); iii++) {
markToRedraw();
}else if (_msg.getMessage() == ednMsgBufferId) {
m_selectedIdRequested = BufferManager::getSelected();
markToRedraw();
}else if (_msg.getMessage() == ednMsgBufferState) {
// update list of modify section ...
for (int32_t iii=0; iii<m_list.size(); iii++) {
if (NULL!=m_list[iii]) {
m_list[iii]->m_isModify = BufferManager::Get(m_list[iii]->m_bufferID)->IsModify();
m_list[iii]->m_isModify = BufferManager::get(m_list[iii]->m_bufferID)->isModify();
}
}
MarkToRedraw();
markToRedraw();
}
}
etk::Color<> BufferView::GetBasicBG(void)
etk::Color<> BufferView::getBasicBG(void)
{
return ColorizeManager::Get(COLOR_LIST_BG_1);
return ColorizeManager::get(COLOR_LIST_BG_1);
}
uint32_t BufferView::GetNuberOfColomn(void)
uint32_t BufferView::getNuberOfColomn(void)
{
return 1;
}
bool BufferView::GetTitle(int32_t colomn, etk::UString &myTitle, etk::Color<> &fg, etk::Color<> &bg)
bool BufferView::getTitle(int32_t colomn, etk::UString &myTitle, etk::Color<> &fg, etk::Color<> &bg)
{
myTitle = "Buffers : ";
return true;
}
uint32_t BufferView::GetNuberOfRaw(void)
uint32_t BufferView::getNuberOfRaw(void)
{
return m_list.Size();
return m_list.size();
}
bool BufferView::GetElement(int32_t colomn, int32_t raw, etk::UString &myTextToWrite, etk::Color<> &fg, etk::Color<> &bg)
bool BufferView::getElement(int32_t colomn, int32_t raw, etk::UString &myTextToWrite, etk::Color<> &fg, etk::Color<> &bg)
{
bool isModify;
basicColor_te selectFG = COLOR_LIST_TEXT_NORMAL;
@ -141,9 +141,9 @@ bool BufferView::GetElement(int32_t colomn, int32_t raw, etk::UString &myTextToW
m_selectedID = -1;
}
if( raw >= 0
&& raw<m_list.Size()
&& raw<m_list.size()
&& NULL != m_list[raw]) {
myTextToWrite = m_list[raw]->m_bufferName.GetNameFile();
myTextToWrite = m_list[raw]->m_bufferName.getNameFile();
if (true == m_list[raw]->m_isModify) {
selectFG = COLOR_LIST_TEXT_MODIFY;
@ -161,7 +161,7 @@ bool BufferView::GetElement(int32_t colomn, int32_t raw, etk::UString &myTextToW
// stop searching
m_selectedIdRequested = -1;
// set the raw visible :
SetRawVisible(m_selectedID);
setRawVisible(m_selectedID);
}
if (m_selectedID == raw) {
selectBG = COLOR_LIST_BG_SELECTED;
@ -169,23 +169,23 @@ bool BufferView::GetElement(int32_t colomn, int32_t raw, etk::UString &myTextToW
} else {
myTextToWrite = "ERROR";
}
fg = ColorizeManager::Get(selectFG);
bg = ColorizeManager::Get(selectBG);
fg = ColorizeManager::get(selectFG);
bg = ColorizeManager::get(selectBG);
return true;
}
bool BufferView::OnItemEvent(int32_t IdInput, ewol::keyEvent::status_te typeEvent, int32_t colomn, int32_t raw, float x, float y)
bool BufferView::onItemEvent(int32_t IdInput, ewol::keyEvent::status_te typeEvent, int32_t colomn, int32_t raw, float x, float y)
{
if (1 == IdInput && typeEvent == ewol::keyEvent::statusSingle) {
APPL_INFO("Event on List : IdInput=" << IdInput << " colomn=" << colomn << " raw=" << raw );
if( raw >= 0
&& raw<m_list.Size()
&& raw<m_list.size()
&& NULL != m_list[raw]) {
m_selectedIdRequested = m_list[raw]->m_bufferID;
SendMultiCast(ednMsgBufferId, m_list[raw]->m_bufferID);
}
}
MarkToRedraw();
markToRedraw();
return false;
}

View File

@ -46,19 +46,19 @@ class BufferView : public widget::List
BufferView(void);
~BufferView(void);
// Derived function
const char * const GetObjectType(void) { return "ApplBufferView"; };
const char * const getObjectType(void) { return "ApplBufferView"; };
// Derived function
virtual void OnReceiveMessage(const ewol::EMessage& _msg);
virtual void onReceiveMessage(const ewol::EMessage& _msg);
protected:
// function call to display the list :
virtual etk::Color<> GetBasicBG(void);
void RemoveAllElement(void);
virtual etk::Color<> getBasicBG(void);
void removeAllElement(void);
// Derived function
virtual uint32_t GetNuberOfColomn(void);
virtual bool GetTitle(int32_t colomn, etk::UString &myTitle, etk::Color<> &fg, etk::Color<> &bg);
virtual uint32_t GetNuberOfRaw(void);
virtual bool GetElement(int32_t colomn, int32_t raw, etk::UString &myTextToWrite, etk::Color<> &fg, etk::Color<> &bg);
virtual bool OnItemEvent(int32_t IdInput, ewol::keyEvent::status_te typeEvent, int32_t colomn, int32_t raw, float x, float y);
virtual uint32_t getNuberOfColomn(void);
virtual bool getTitle(int32_t colomn, etk::UString &myTitle, etk::Color<> &fg, etk::Color<> &bg);
virtual uint32_t getNuberOfRaw(void);
virtual bool getElement(int32_t colomn, int32_t raw, etk::UString &myTextToWrite, etk::Color<> &fg, etk::Color<> &bg);
virtual bool onItemEvent(int32_t IdInput, ewol::keyEvent::status_te typeEvent, int32_t colomn, int32_t raw, float x, float y);
};

View File

@ -23,20 +23,20 @@
#undef __class__
#define __class__ "CodeView"
void CodeView::Init(void)
void CodeView::init(void)
{
m_label = "CodeView is disable ...";
m_bufferID = -1;
m_buttunOneSelected = false;
m_lineNumberList.Clear();
m_lineNumberList.clear();
m_textColorFg = etk::color::black;
m_textColorBg = etk::color::black;
m_textColorBg.SetA(0x40);
SetCanHaveFocus(true);
m_textColorBg.setA(0x40);
setCanHaveFocus(true);
RegisterMultiCast(ednMsgBufferId);
RegisterMultiCast(ednMsgGuiCopy);
RegisterMultiCast(ednMsgGuiPaste);
@ -49,7 +49,7 @@ void CodeView::Init(void)
RegisterMultiCast(ednMsgGuiFind);
RegisterMultiCast(ednMsgGuiReplace);
RegisterMultiCast(ednMsgGuiGotoLine);
SetLimitScrolling(0.2);
setLimitScrolling(0.2);
ShortCutAdd("ctrl+w", ednMsgGuiRm, "Line");
ShortCutAdd("ctrl+shift+w", ednMsgGuiRm, "Paragraph");
@ -63,12 +63,12 @@ void CodeView::Init(void)
CodeView::CodeView(etk::UString fontName, int32_t fontSize) :
m_displayText(fontName, fontSize)
{
Init();
init();
}
CodeView::CodeView(void)
{
Init();
init();
}
CodeView::~CodeView(void)
@ -81,78 +81,78 @@ CodeView::~CodeView(void)
* @brief Check if the number of reference buffer is good or not ...
* @param[in] bufferID id of the current Buffer that needed to have a reference
*/
void CodeView::UpdateNumberOfLineReference(int32_t bufferID)
void CodeView::updateNumberOfLineReference(int32_t bufferID)
{
vec2 tmpCoord(0,0);
if (m_lineNumberList.Size()<=bufferID) {
if (m_lineNumberList.size() <= bufferID) {
// update the number of elements :
for (int32_t iii=m_lineNumberList.Size(); iii <= bufferID; iii++) {
for (int32_t iii=m_lineNumberList.size(); iii <= bufferID; iii++) {
// add start line at 0 :
m_lineNumberList.PushBack(tmpCoord);
m_lineNumberList.pushBack(tmpCoord);
}
}
}
bool CodeView::CalculateMinSize(void)
bool CodeView::calculateMinSize(void)
{
m_minSize.setValue(50,50);
return true;
}
void CodeView::CalculateMaxSize(void)
void CodeView::calculateMaxSize(void)
{
m_maxSize.setX(2048);
int32_t letterHeight = m_displayText.CalculateSize(etk::UniChar('A')).y();
BufferText* tmpBuffer = BufferManager::Get(m_bufferID);
int32_t letterHeight = m_displayText.calculateSize(etk::UniChar('A')).y();
BufferText* tmpBuffer = BufferManager::get(m_bufferID);
if (NULL!=tmpBuffer) {
m_maxSize.setY(tmpBuffer->GetNumberOfLine() * letterHeight);
m_maxSize.setY(tmpBuffer->getNumberOfLine() * letterHeight);
} else {
m_maxSize.setY(50);
}
}
void CodeView::OnDraw(void)
void CodeView::onDraw(void)
{
m_displayDrawing.Draw();
m_displayText.Draw();
WidgetScrooled::OnDraw();
m_displayDrawing.draw();
m_displayText.draw();
WidgetScrooled::onDraw();
}
void CodeView::OnRegenerateDisplay(void)
void CodeView::onRegenerateDisplay(void)
{
if (true == NeedRedraw()) {
int64_t startTime = ewol::GetTime();
if (true == needRedraw()) {
int64_t startTime = ewol::getTime();
// For the scrooling windows
CalculateMaxSize();
m_displayDrawing.Clear();
m_displayText.Clear();
calculateMaxSize();
m_displayDrawing.clear();
m_displayText.clear();
// Reset the background :
m_displayDrawing.SetPos(vec3(-2048, -2048, 0));
m_displayDrawing.SetColor(ColorizeManager::Get(COLOR_CODE_BASIC_BG));
m_displayDrawing.RectangleWidth(vec3(4096, 4096, 0) );
// reset the background :
m_displayDrawing.setPos(vec3(-2048, -2048, 0));
m_displayDrawing.setColor(ColorizeManager::get(COLOR_CODE_BASIC_BG));
m_displayDrawing.rectangleWidth(vec3(4096, 4096, 0) );
BufferText* tmpBuffer = BufferManager::Get(m_bufferID);
BufferText* tmpBuffer = BufferManager::get(m_bufferID);
if( NULL != tmpBuffer
&& true == tmpBuffer->NeedToUpdateDisplayPosition() ) {
vec2 borderWidth = BufferManager::Get(m_bufferID)->GetBorderSize();
&& true == tmpBuffer->needToUpdateDisplayPosition() ) {
vec2 borderWidth = BufferManager::get(m_bufferID)->getBorderSize();
bool centerRequested = false;
// TODO : set it back ...
vec2 currentPosition = BufferManager::Get(m_bufferID)->GetPosition(999/*m_OObjectTextNormal.GetFontID()*/, centerRequested);
SetScrollingPositionDynamic(borderWidth, currentPosition, centerRequested);
vec2 currentPosition = BufferManager::get(m_bufferID)->getPosition(999/*m_OObjectTextNormal.getFontID()*/, centerRequested);
setScrollingPositionDynamic(borderWidth, currentPosition, centerRequested);
} // else : nothing to do ...
// generate the objects :
if (-1 == m_bufferID) {
m_displayText.SetTextAlignement(10, m_size.x()-20, ewol::Text::alignLeft);
m_displayDrawing.SetColor(0x00000022);
m_displayDrawing.SetPos(vec3(10, 0, 0));
m_displayDrawing.Rectangle(vec3((int32_t)m_size.x()-20, 1500, 0) );
m_displayText.setTextAlignement(10, m_size.x()-20, ewol::Text::alignLeft);
m_displayDrawing.setColor(0x00000022);
m_displayDrawing.setPos(vec3(10, 0, 0));
m_displayDrawing.rectangle(vec3((int32_t)m_size.x()-20, 1500, 0) );
m_displayText.SetRelPos(vec3(10, 0, 0));
m_displayText.setRelPos(vec3(10, 0, 0));
// nothing to display :
etk::UString tmpString("<br/>\n"
"<font color=\"red\">\n"
@ -167,71 +167,71 @@ void CodeView::OnRegenerateDisplay(void)
" No Buffer Availlable to display\n"
" </i>\n"
"</font>\n");
m_displayText.SetPos(vec3(0.0f, m_size.y(), 0.0f) );
m_displayText.ForceLineReturn();
m_displayText.PrintDecorated(tmpString);
m_displayText.setPos(vec3(0.0f, m_size.y(), 0.0f) );
m_displayText.forceLineReturn();
m_displayText.printDecorated(tmpString);
} else {
BufferText* tmpBuffer = BufferManager::Get(m_bufferID);
BufferText* tmpBuffer = BufferManager::get(m_bufferID);
if (NULL!=tmpBuffer) {
tmpBuffer->Display(m_displayText, m_originScrooled.x(), m_originScrooled.y(), m_size.x(), m_size.y());
tmpBuffer->display(m_displayText, m_originScrooled.x(), m_originScrooled.y(), m_size.x(), m_size.y());
}
// set the current size of the windows
SetMaxSize(BufferManager::Get(m_bufferID)->GetMaxSize());
setMaxSize(BufferManager::get(m_bufferID)->getMaxSize());
}
int64_t stopTime = ewol::GetTime();
int64_t stopTime = ewol::getTime();
APPL_DEBUG("Display Code Generation = " << stopTime - startTime << " micro-s");
// call the herited class...
WidgetScrooled::OnRegenerateDisplay();
WidgetScrooled::onRegenerateDisplay();
}
}
bool CodeView::OnEventEntry(const ewol::EventEntry& _event)
bool CodeView::onEventEntry(const ewol::EventEntry& _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) {
BufferText* tmpBuffer = BufferManager::Get(m_bufferID);
if (_event.getStatus() == ewol::keyEvent::statusDown) {
BufferText* tmpBuffer = BufferManager::get(m_bufferID);
if (NULL!=tmpBuffer) {
tmpBuffer->AddChar(_event.GetChar());
tmpBuffer->addChar(_event.getChar());
}
MarkToRedraw();
markToRedraw();
}
return true;
}
// move events ...
if (_event.GetStatus() == ewol::keyEvent::statusDown) {
BufferText* tmpBuffer = BufferManager::Get(m_bufferID);
if (_event.getStatus() == ewol::keyEvent::statusDown) {
BufferText* tmpBuffer = BufferManager::get(m_bufferID);
if (NULL!=tmpBuffer) {
tmpBuffer->cursorMove(_event.GetType());
tmpBuffer->cursorMove(_event.getType());
}
MarkToRedraw();
markToRedraw();
}
return true;
}
void CodeView::OnEventClipboard(ewol::clipBoard::clipboardListe_te _clipboardID)
void CodeView::onEventClipboard(ewol::clipBoard::clipboardListe_te _clipboardID)
{
BufferText* tmpBuffer = BufferManager::Get(m_bufferID);
BufferText* tmpBuffer = BufferManager::get(m_bufferID);
if (NULL!=tmpBuffer) {
tmpBuffer->Paste(_clipboardID);
}
MarkToRedraw();
markToRedraw();
}
bool CodeView::OnEventInput(const ewol::EventInput& _event)
bool CodeView::onEventInput(const ewol::EventInput& _event)
{
vec2 relativePos = RelativePosition(_event.GetPos());
//APPL_DEBUG("Event at pos : " << _event.GetPos() << " ==> " << relativePos );
vec2 relativePos = relativePosition(_event.getPos());
//APPL_DEBUG("Event at pos : " << _event.getPos() << " == > " << relativePos );
// corection for the openGl abstraction
//relativePos.y = m_size.y - relativePos.y;
vec2 limitedPos = relativePos;
limitedPos.setValue(etk_avg(1, limitedPos.x(), m_size.x()-1),
etk_avg(1, limitedPos.y(), m_size.y()-1));
if (true == WidgetScrooled::OnEventInput(_event)) {
KeepFocus();
if (true == WidgetScrooled::onEventInput(_event)) {
keepFocus();
// nothing to do ... done on upper widget ...
return true;
}
@ -240,51 +240,51 @@ bool CodeView::OnEventInput(const ewol::EventInput& _event)
return false;
}
if (1 == _event.GetId()) {
if (1 == _event.getId()) {
if (ewol::keyEvent::typeMouse == _event.GetType()) {
if (ewol::keyEvent::statusDown == _event.GetStatus()) {
if (ewol::keyEvent::typeMouse == _event.getType()) {
if (ewol::keyEvent::statusDown == _event.getStatus()) {
m_buttunOneSelected = true;
KeepFocus();
// TODO : Set something good
BufferText* tmpBuffer = BufferManager::Get(m_bufferID);
keepFocus();
// TODO : set something good
BufferText* tmpBuffer = BufferManager::get(m_bufferID);
if (NULL!=tmpBuffer) {
tmpBuffer->MouseEvent(limitedPos);
}
MarkToRedraw();
} else if (ewol::keyEvent::statusUp == _event.GetStatus()) {
markToRedraw();
} else if (ewol::keyEvent::statusUp == _event.getStatus()) {
m_buttunOneSelected = false;
BufferText* tmpBuffer = BufferManager::Get(m_bufferID);
BufferText* tmpBuffer = BufferManager::get(m_bufferID);
if (NULL!=tmpBuffer) {
tmpBuffer->Copy(ewol::clipBoard::clipboardSelection);
}
MarkToRedraw();
markToRedraw();
}
}
if (ewol::keyEvent::statusSingle == _event.GetStatus()) {
if (ewol::keyEvent::typeMouse == _event.GetType()) {
KeepFocus();
BufferText* tmpBuffer = BufferManager::Get(m_bufferID);
if (ewol::keyEvent::statusSingle == _event.getStatus()) {
if (ewol::keyEvent::typeMouse == _event.getType()) {
keepFocus();
BufferText* tmpBuffer = BufferManager::get(m_bufferID);
if (NULL!=tmpBuffer) {
tmpBuffer->MouseEvent(limitedPos);
}
MarkToRedraw();
markToRedraw();
} else {
// nothing to do ...
}
} else if (ewol::keyEvent::statusDouble == _event.GetStatus()) {
BufferText* tmpBuffer = BufferManager::Get(m_bufferID);
} else if (ewol::keyEvent::statusDouble == _event.getStatus()) {
BufferText* tmpBuffer = BufferManager::get(m_bufferID);
if (NULL!=tmpBuffer) {
tmpBuffer->MouseEventDouble();
}
MarkToRedraw();
} else if (ewol::keyEvent::statusTriple == _event.GetStatus()) {
BufferText* tmpBuffer = BufferManager::Get(m_bufferID);
markToRedraw();
} else if (ewol::keyEvent::statusTriple == _event.getStatus()) {
BufferText* tmpBuffer = BufferManager::get(m_bufferID);
if (NULL!=tmpBuffer) {
tmpBuffer->MouseEventTriple();
}
MarkToRedraw();
} else if (ewol::keyEvent::statusMove == _event.GetStatus()) {
markToRedraw();
} else if (ewol::keyEvent::statusMove == _event.getStatus()) {
if (true == m_buttunOneSelected) {
int xxx, yyy;
xxx = relativePos.x();
@ -296,185 +296,185 @@ bool CodeView::OnEventInput(const ewol::EventInput& _event)
yyy = 0;
}
//APPL_INFO("mouse-motion BT1 %d, %d", xxx, yyy);
// TODO : Set something good
BufferText* tmpBuffer = BufferManager::Get(m_bufferID);
// TODO : set something good
BufferText* tmpBuffer = BufferManager::get(m_bufferID);
if (NULL!=tmpBuffer) {
tmpBuffer->MouseSelectFromCursorTo(limitedPos);
}
MarkToRedraw();
markToRedraw();
}
}
} else if (2 == _event.GetId()) {
if (ewol::keyEvent::statusSingle == _event.GetStatus()) {
// TODO : Set something good
BufferText* tmpBuffer = BufferManager::Get(m_bufferID);
} else if (2 == _event.getId()) {
if (ewol::keyEvent::statusSingle == _event.getStatus()) {
// TODO : set something good
BufferText* tmpBuffer = BufferManager::get(m_bufferID);
if (NULL!=tmpBuffer) {
tmpBuffer->MouseEvent(limitedPos);
}
ewol::clipBoard::Request(ewol::clipBoard::clipboardSelection);
KeepFocus();
keepFocus();
}
}
return true;
}
void CodeView::OnReceiveMessage(const ewol::EMessage& _msg)
void CodeView::onReceiveMessage(const ewol::EMessage& _msg)
{
widget::WidgetScrooled::OnReceiveMessage(_msg);
APPL_DEBUG("Extern Event : " << _msg.GetCaller() << " type : " << _msg.GetMessage() << " data=\"" << _msg.GetData() << "\"");
widget::WidgetScrooled::onReceiveMessage(_msg);
APPL_DEBUG("Extern Event : " << _msg.getCaller() << " type : " << _msg.GetMessage() << " data=\"" << _msg.GetData() << "\"");
if(_msg.GetMessage() == ednMsgBufferId) {
if(_msg.getMessage() == ednMsgBufferId) {
//keep the reference of the display offset :
if( m_bufferID >= 0
&& m_bufferID < m_lineNumberList.Size()) {
&& m_bufferID < m_lineNumberList.size()) {
m_lineNumberList[m_bufferID] = m_originScrooled;
}
int32_t bufferID = 0;
sscanf(_msg.GetData().c_str(), "%d", &bufferID);
sscanf(_msg.getData().c_str(), "%d", &bufferID);
APPL_INFO("Select a new Buffer ... " << bufferID);
// set the new buffer ID
m_bufferID = bufferID;
// update the start display position...
UpdateNumberOfLineReference(m_bufferID);
updateNumberOfLineReference(m_bufferID);
// set back if needed the display position ...
if( m_bufferID >= 0
&& m_bufferID < m_lineNumberList.Size()) {
&& m_bufferID < m_lineNumberList.size()) {
m_originScrooled = m_lineNumberList[m_bufferID];
}
} else if (_msg.GetMessage() == ednMsgGuiCopy) {
BufferText* tmpBuffer = BufferManager::Get(m_bufferID);
} else if (_msg.getMessage() == ednMsgGuiCopy) {
BufferText* tmpBuffer = BufferManager::get(m_bufferID);
if (NULL!=tmpBuffer) {
tmpBuffer->Copy(ewol::clipBoard::clipboardStd);
}
} else if (_msg.GetMessage() == ednMsgGuiCut) {
BufferText* tmpBuffer = BufferManager::Get(m_bufferID);
} else if (_msg.getMessage() == ednMsgGuiCut) {
BufferText* tmpBuffer = BufferManager::get(m_bufferID);
if (NULL!=tmpBuffer) {
tmpBuffer->Cut(ewol::clipBoard::clipboardStd);
}
} else if (_msg.GetMessage() == ednMsgGuiPaste) {
} else if (_msg.getMessage() == ednMsgGuiPaste) {
ewol::clipBoard::Request(ewol::clipBoard::clipboardStd);
} else if (_msg.GetMessage() == ednMsgGuiUndo) {
BufferText* tmpBuffer = BufferManager::Get(m_bufferID);
} else if (_msg.getMessage() == ednMsgGuiUndo) {
BufferText* tmpBuffer = BufferManager::get(m_bufferID);
if (NULL!=tmpBuffer) {
tmpBuffer->Undo();
}
} else if (_msg.GetMessage() == ednMsgGuiRedo) {
BufferText* tmpBuffer = BufferManager::Get(m_bufferID);
} else if (_msg.getMessage() == ednMsgGuiRedo) {
BufferText* tmpBuffer = BufferManager::get(m_bufferID);
if (NULL!=tmpBuffer) {
tmpBuffer->Redo();
}
} else if (_msg.GetMessage() == ednMsgGuiRm) {
} else if (_msg.getMessage() == ednMsgGuiRm) {
// data : "Word" "Line" "Paragraph"
if (_msg.GetData() == "Word") {
APPL_WARNING(" on event " << _msg.GetMessage() << " data=\"" << _msg.GetData() << "\" ==> not coded" );
} else if (_msg.GetData() == "Line") {
BufferText* tmpBuffer = BufferManager::Get(m_bufferID);
if (_msg.getData() == "Word") {
APPL_WARNING(" on event " << _msg.getMessage() << " data=\"" << _msg.GetData() << "\" == > not coded" );
} else if (_msg.getData() == "Line") {
BufferText* tmpBuffer = BufferManager::get(m_bufferID);
if (NULL!=tmpBuffer) {
tmpBuffer->RemoveLine();
tmpBuffer->removeLine();
}
} else if (_msg.GetData() == "Paragraph") {
APPL_WARNING(" on event " << _msg.GetMessage() << " data=\"" << _msg.GetData() << "\" ==> not coded" );
} else if (_msg.getData() == "Paragraph") {
APPL_WARNING(" on event " << _msg.getMessage() << " data=\"" << _msg.GetData() << "\" == > not coded" );
} else {
APPL_ERROR(" on event " << _msg.GetMessage() << " unknow data=\"" << _msg.GetData() << "\"" );
APPL_ERROR(" on event " << _msg.getMessage() << " unknow data=\"" << _msg.GetData() << "\"" );
}
} else if (_msg.GetMessage() == ednMsgGuiSelect) {
} else if (_msg.getMessage() == ednMsgGuiSelect) {
// data : "ALL" "NONE"
if (_msg.GetData() == "ALL") {
BufferText* tmpBuffer = BufferManager::Get(m_bufferID);
if (_msg.getData() == "ALL") {
BufferText* tmpBuffer = BufferManager::get(m_bufferID);
if (NULL!=tmpBuffer) {
tmpBuffer->SelectAll();
}
} else if (_msg.GetData() == "NONE") {
BufferText* tmpBuffer = BufferManager::Get(m_bufferID);
} else if (_msg.getData() == "NONE") {
BufferText* tmpBuffer = BufferManager::get(m_bufferID);
if (NULL!=tmpBuffer) {
tmpBuffer->SelectNone();
}
} else {
APPL_ERROR(" on event " << _msg.GetMessage() << " unknow data=\"" << _msg.GetData() << "\"" );
APPL_ERROR(" on event " << _msg.getMessage() << " unknow data=\"" << _msg.GetData() << "\"" );
}
} else if (_msg.GetMessage() == ednMsgGuiChangeCharset) {
} else if (_msg.getMessage() == ednMsgGuiChangeCharset) {
// data : "UTF-8" "ISO-8859-1" "ISO-8859-15"
if (_msg.GetData() == "UTF-8") {
BufferText* tmpBuffer = BufferManager::Get(m_bufferID);
if (_msg.getData() == "UTF-8") {
BufferText* tmpBuffer = BufferManager::get(m_bufferID);
if (NULL!=tmpBuffer) {
tmpBuffer->SetCharset(unicode::EDN_CHARSET_UTF8);
tmpBuffer->setCharset(unicode::EDN_CHARSET_UTF8);
}
} else if (_msg.GetData() == "ISO-8859-1") {
BufferText* tmpBuffer = BufferManager::Get(m_bufferID);
} else if (_msg.getData() == "ISO-8859-1") {
BufferText* tmpBuffer = BufferManager::get(m_bufferID);
if (NULL!=tmpBuffer) {
tmpBuffer->SetCharset(unicode::EDN_CHARSET_ISO_8859_1);
tmpBuffer->setCharset(unicode::EDN_CHARSET_ISO_8859_1);
}
} else if (_msg.GetData() == "ISO-8859-15") {
BufferText* tmpBuffer = BufferManager::Get(m_bufferID);
} else if (_msg.getData() == "ISO-8859-15") {
BufferText* tmpBuffer = BufferManager::get(m_bufferID);
if (NULL!=tmpBuffer) {
tmpBuffer->SetCharset(unicode::EDN_CHARSET_ISO_8859_15);
tmpBuffer->setCharset(unicode::EDN_CHARSET_ISO_8859_15);
}
} else {
APPL_ERROR(" on event " << _msg.GetMessage() << " unknow data=\"" << _msg.GetData() << "\"" );
APPL_ERROR(" on event " << _msg.getMessage() << " unknow data=\"" << _msg.GetData() << "\"" );
}
} else if (_msg.GetMessage() == ednMsgGuiFind) {
} else if (_msg.getMessage() == ednMsgGuiFind) {
etk::UString myDataString;
SearchData::GetSearch(myDataString);
if (_msg.GetData() == "Next") {
BufferText* tmpBuffer = BufferManager::Get(m_bufferID);
SearchData::getSearch(myDataString);
if (_msg.getData() == "Next") {
BufferText* tmpBuffer = BufferManager::get(m_bufferID);
if (NULL!=tmpBuffer) {
tmpBuffer->Search(myDataString, false, SearchData::GetCase(), SearchData::GetWrap(), SearchData::GetRegExp() );
tmpBuffer->Search(myDataString, false, SearchData::getCase(), SearchData::GetWrap(), SearchData::GetRegExp() );
}
} else if (_msg.GetData() == "Previous") {
BufferText* tmpBuffer = BufferManager::Get(m_bufferID);
} else if (_msg.getData() == "Previous") {
BufferText* tmpBuffer = BufferManager::get(m_bufferID);
if (NULL!=tmpBuffer) {
tmpBuffer->Search(myDataString, true, SearchData::GetCase(), SearchData::GetWrap(), SearchData::GetRegExp() );
tmpBuffer->Search(myDataString, true, SearchData::getCase(), SearchData::GetWrap(), SearchData::GetRegExp() );
}
}
} else if (_msg.GetMessage() == ednMsgGuiReplace) {
} else if (_msg.getMessage() == ednMsgGuiReplace) {
etk::UString myDataString;
SearchData::GetReplace(myDataString);
if (_msg.GetData() == "Normal") {
BufferText* tmpBuffer = BufferManager::Get(m_bufferID);
SearchData::getReplace(myDataString);
if (_msg.getData() == "Normal") {
BufferText* tmpBuffer = BufferManager::get(m_bufferID);
if (NULL!=tmpBuffer) {
tmpBuffer->Replace(myDataString);
}
} else if (_msg.GetData() == "All") {
} else if (_msg.getData() == "All") {
}
} else if (_msg.GetMessage() == ednMsgGuiGotoLine) {
} else if (_msg.getMessage() == ednMsgGuiGotoLine) {
int32_t lineID = 0;
sscanf(_msg.GetData().c_str(), "%d", &lineID);
sscanf(_msg.getData().c_str(), "%d", &lineID);
APPL_INFO("Goto line : " << lineID);
BufferText* tmpBuffer = BufferManager::Get(m_bufferID);
BufferText* tmpBuffer = BufferManager::get(m_bufferID);
if (NULL!=tmpBuffer) {
tmpBuffer->JumpAtLine(lineID);
}
}
// Force redraw of the widget
MarkToRedraw();
// force redraw of the widget
markToRedraw();
}
void CodeView::OnGetFocus(void)
void CodeView::onGetFocus(void)
{
/*
ewol::widgetMessageMultiCast::Send(GetWidgetId(), ednMsgBufferId, m_bufferID);
ewol::widgetMessageMultiCast::Send(getWidgetId(), ednMsgBufferId, m_bufferID);
*/
ShowKeyboard();
APPL_INFO("Focus - In");
}
void CodeView::OnLostFocus(void)
void CodeView::onLostFocus(void)
{
HideKeyboard();
APPL_INFO("Focus - out");
}
void CodeView::SetFontSize(int32_t size)
void CodeView::setFontSize(int32_t size)
{
m_displayText.SetFontSize(size);
SetScrollingSize(size*3.0*1.46); // 1.46 is a magic nmber ...
m_displayText.setFontSize(size);
setScrollingSize(size*3.0*1.46); // 1.46 is a magic nmber ...
}
void CodeView::SetFontName(etk::UString fontName)
void CodeView::setFontName(etk::UString fontName)
{
m_displayText.SetFontName(fontName);
m_displayText.setFontName(fontName);
}

View File

@ -21,7 +21,7 @@
class CodeView :public widget::WidgetScrooled
{
public:
void Init(void);
void init(void);
CodeView(etk::UString fontName, int32_t fontSize);
CodeView(void);
virtual ~CodeView(void);
@ -32,27 +32,27 @@ class CodeView :public widget::WidgetScrooled
int32_t m_bufferID;
bool m_buttunOneSelected;
etk::Vector<vec2 > m_lineNumberList;
void UpdateNumberOfLineReference(int32_t bufferID);
void updateNumberOfLineReference(int32_t bufferID);
// drawing elements :
ewol::Text m_displayText;
ewol::Drawing m_displayDrawing;
ewol::drawing m_displayDrawing;
public:
void SetFontSize(int32_t size);
void SetFontName(etk::UString fontName);
void setFontSize(int32_t size);
void setFontName(etk::UString fontName);
private:
void CalculateMaxSize(void);
void calculateMaxSize(void);
protected: // derived function
virtual void OnDraw(void);
virtual void onDraw(void);
public: // Derived function
const char * const GetObjectType(void) { return "ApplCodeView"; };
virtual bool CalculateMinSize(void);
virtual void OnRegenerateDisplay(void);
virtual void OnReceiveMessage(const ewol::EMessage& _msg);
virtual bool OnEventInput(const ewol::EventInput& _event);
virtual bool OnEventEntry(const ewol::EventEntry& _event);
virtual void OnEventClipboard(ewol::clipBoard::clipboardListe_te clipboardID);
virtual void OnGetFocus(void);
virtual void OnLostFocus(void);
const char * const getObjectType(void) { return "ApplCodeView"; };
virtual bool calculateMinSize(void);
virtual void onRegenerateDisplay(void);
virtual void onReceiveMessage(const ewol::EMessage& _msg);
virtual bool onEventInput(const ewol::EventInput& _event);
virtual bool onEventEntry(const ewol::EventEntry& _event);
virtual void onEventClipboard(ewol::clipBoard::clipboardListe_te clipboardID);
virtual void onGetFocus(void);
virtual void onLostFocus(void);
};
#endif

View File

@ -35,14 +35,14 @@
namespace appl
{
etk::UString GetVersion(void)
etk::UString getVersion(void)
{
#define FIRST_YEAR (2010)
etk::UString tmpOutput = (date::GetYear()-FIRST_YEAR);
etk::UString tmpOutput = (date::getYear()-FIRST_YEAR);
tmpOutput += ".";
tmpOutput += date::GetMonth();
tmpOutput += date::getMonth();
tmpOutput += ".";
tmpOutput += date::GetDay();
tmpOutput += date::getDay();
return tmpOutput;
}
@ -67,23 +67,23 @@ class ParameterAboutGui : public widget::Sizer
if (NULL == mySpacer) {
APPL_ERROR("Can not allocate widget == > display might be in error");
} else {
mySpacer->SetExpand(bvec2(true,true));
SubWidgetAdd(mySpacer);
mySpacer->setExpand(bvec2(true,true));
subWidgetAdd(mySpacer);
}
etk::UString tmpLabel = "<left>";
tmpLabel += " <b>Editeur De N'ours</b> : v:";
tmpLabel += appl::GetVersion();
tmpLabel += appl::getVersion();
tmpLabel += "<br/>";
tmpLabel += " <b>Build Time</b> : ";
tmpLabel += date::GetYear();
tmpLabel += date::getYear();
tmpLabel += "/";
tmpLabel += date::GetMonth();
tmpLabel += date::getMonth();
tmpLabel += "/";
tmpLabel += date::GetDay();
tmpLabel += date::getDay();
tmpLabel += " ";
tmpLabel += date::GetHour();
tmpLabel += date::getHour();
tmpLabel += "h";
tmpLabel += date::GetMinute();
tmpLabel += date::getMinute();
tmpLabel += "<br/>";
tmpLabel += " <b>Website</b> : https://github.com/HeeroYui/edn<br/>";
tmpLabel += " <b>License</b> : GPL v3<br/>";
@ -97,8 +97,8 @@ class ParameterAboutGui : public widget::Sizer
if (NULL == myLabel) {
APPL_ERROR("Can not allocate widget == > display might be in error");
} else {
myLabel->SetExpand(bvec2(true,false));
SubWidgetAdd(myLabel);
myLabel->setExpand(bvec2(true,false));
subWidgetAdd(myLabel);
}
};
@ -126,117 +126,117 @@ MainWindows::MainWindows(void)
widget::Menu * myMenu = NULL;
mySizerVert = new widget::Sizer(widget::Sizer::modeVert);
SetSubWidget(mySizerVert);
setSubWidget(mySizerVert);
mySizerHori = new widget::Sizer(widget::Sizer::modeHori);
mySizerVert->SubWidgetAdd(mySizerHori);
mySizerVert->subWidgetAdd(mySizerHori);
myBufferView = new BufferView();
myBufferView->SetExpand(bvec2(false,true));
myBufferView->SetFill(bvec2(true,true));
mySizerHori->SubWidgetAdd(myBufferView);
myBufferView->setExpand(bvec2(false,true));
myBufferView->setFill(bvec2(true,true));
mySizerHori->subWidgetAdd(myBufferView);
mySizerVert2 = new widget::Sizer(widget::Sizer::modeVert);
mySizerHori->SubWidgetAdd(mySizerVert2);
mySizerHori->subWidgetAdd(mySizerVert2);
// main buffer Area :
myTextView = new appl::TextViewer("FreeSerif;FreeMono;DejaVuSansMono", 11);
myTextView->SetExpand(bvec2(true,true));
myTextView->SetFill(bvec2(true,true));
mySizerVert2->SubWidgetAdd(myTextView);
myTextView->setExpand(bvec2(true,true));
myTextView->setFill(bvec2(true,true));
mySizerVert2->subWidgetAdd(myTextView);
/*
myCodeView = new CodeView("FreeMono;DejaVuSansMono", 11);
myCodeView->SetExpand(bvec2(true,true));
myCodeView->SetFill(bvec2(true,true));
mySizerVert2->SubWidgetAdd(myCodeView);
myCodeView->setExpand(bvec2(true,true));
myCodeView->setFill(bvec2(true,true));
mySizerVert2->subWidgetAdd(myCodeView);
*/
// search area :
Search * mySearch = new Search();
mySizerVert2->SubWidgetAdd(mySearch);
mySizerVert2->subWidgetAdd(mySearch);
#ifdef APPL_BUFFER_FONT_DISTANCE_FIELD
{
widget::Sizer * mySizerHori2 = new widget::Sizer(widget::Sizer::modeHori);
mySizerVert2->SubWidgetAdd(mySizerHori2);
mySizerVert2->subWidgetAdd(mySizerHori2);
widget::CheckBox* tmpCheck = new widget::CheckBox("smooth");
mySizerHori2->SubWidgetAdd(tmpCheck);
tmpCheck->RegisterOnEvent(this, ewolEventCheckBoxClicked, l_smoothChick);
mySizerHori2->subWidgetAdd(tmpCheck);
tmpCheck->registerOnEvent(this, ewolEventCheckBoxClicked, l_smoothChick);
widget::Slider* tmpSlider = new widget::Slider();
mySizerHori2->SubWidgetAdd(tmpSlider);
tmpSlider->RegisterOnEvent(this, ewolEventSliderChange, l_smoothMin);
tmpSlider->SetExpand(bvec2(true,false));
tmpSlider->SetMin(0);
tmpSlider->SetMax(1000);
tmpSlider->SetValue(0450);
mySizerHori2->subWidgetAdd(tmpSlider);
tmpSlider->registerOnEvent(this, ewolEventSliderChange, l_smoothMin);
tmpSlider->setExpand(bvec2(true,false));
tmpSlider->setMin(0);
tmpSlider->setMax(1000);
tmpSlider->setValue(0450);
tmpSliderMin = tmpSlider;
tmpSlider = new widget::Slider();
mySizerHori2->SubWidgetAdd(tmpSlider);
tmpSlider->RegisterOnEvent(this, ewolEventSliderChange, l_smoothMax);
tmpSlider->SetExpand(bvec2(true,false));
tmpSlider->SetMin(0);
tmpSlider->SetMax(1000);
tmpSlider->SetValue(0550);
mySizerHori2->subWidgetAdd(tmpSlider);
tmpSlider->registerOnEvent(this, ewolEventSliderChange, l_smoothMax);
tmpSlider->setExpand(bvec2(true,false));
tmpSlider->setMin(0);
tmpSlider->setMax(1000);
tmpSlider->setValue(0550);
tmpSliderMax = tmpSlider;
}
#endif
mySizerHori = new widget::Sizer(widget::Sizer::modeHori);
mySizerVert->SubWidgetAdd(mySizerHori);
mySizerVert->subWidgetAdd(mySizerHori);
myMenu = new widget::Menu();
mySizerHori->SubWidgetAdd(myMenu);
int32_t idMenuFile = myMenu->AddTitle("File");
(void)myMenu->Add(idMenuFile, "New", "", ednMsgGuiNew);
(void)myMenu->AddSpacer();
(void)myMenu->Add(idMenuFile, "Open", "THEME:GUI:Load.svg", ednMsgGuiOpen);
(void)myMenu->Add(idMenuFile, "Close", "THEME:GUI:Close.svg", ednMsgGuiClose, "current");
(void)myMenu->Add(idMenuFile, "Close (all)", "", ednMsgGuiClose, "All");
(void)myMenu->Add(idMenuFile, "Save", "THEME:GUI:Save.svg", ednMsgGuiSave, "current");
(void)myMenu->Add(idMenuFile, "Save As ...", "", ednMsgGuiSaveAs);
(void)myMenu->AddSpacer();
//(void)myMenu->Add(idMenuFile, "Exit", "", ednMsgGuiExit);
(void)myMenu->AddSpacer();
(void)myMenu->Add(idMenuFile, "Properties", "THEME:GUI:Parameter.svg", ednMsgProperties);
int32_t idMenuEdit = myMenu->AddTitle("Edit");
(void)myMenu->Add(idMenuEdit, "Undo", "THEME:GUI:Undo.svg", ednMsgGuiUndo);
(void)myMenu->Add(idMenuEdit, "Redo", "THEME:GUI:Redo.svg", ednMsgGuiRedo);
(void)myMenu->AddSpacer();
(void)myMenu->Add(idMenuEdit, "Copy", "", ednMsgGuiCopy, "STD");
(void)myMenu->Add(idMenuEdit, "Cut", "", ednMsgGuiCut, "STD");
(void)myMenu->Add(idMenuEdit, "Paste", "", ednMsgGuiPaste, "STD");
(void)myMenu->Add(idMenuEdit, "Remove", "", ednMsgGuiRm);
(void)myMenu->AddSpacer();
(void)myMenu->Add(idMenuEdit, "Select All","", ednMsgGuiSelect, "ALL");
(void)myMenu->Add(idMenuEdit, "Un-Select","", ednMsgGuiSelect, "NONE");
(void)myMenu->Add(idMenuEdit, "Goto line ...","", ednMsgGuiGotoLine, "???");
int32_t idMenuSearch = myMenu->AddTitle("Search");
(void)myMenu->Add(idMenuSearch, "Search", "THEME:GUI:Search.svg", ednMsgGuiSearch);
(void)myMenu->Add(idMenuSearch, "Replace", "THEME:GUI:Replace.svg", ednMsgGuiReplace);
(void)myMenu->AddSpacer();
(void)myMenu->Add(idMenuSearch, "Find (previous)","", ednMsgGuiFind, "Previous");
(void)myMenu->Add(idMenuSearch, "Find (next)", "", ednMsgGuiFind, "Next");
(void)myMenu->Add(idMenuSearch, "Find (all)", "", ednMsgGuiFind, "All");
(void)myMenu->Add(idMenuSearch, "Un-Select", "", ednMsgGuiFind, "None");
int32_t idMenuCTags = myMenu->AddTitle("C-tags");
(void)myMenu->Add(idMenuCTags, "Load", "", ednMsgGuiCtags, "Load");
(void)myMenu->Add(idMenuCTags, "ReLoad", "", ednMsgGuiCtags, "ReLoad");
(void)myMenu->Add(idMenuCTags, "Jump", "", ednMsgGuiCtags, "Jump");
(void)myMenu->Add(idMenuCTags, "Back", "", ednMsgGuiCtags, "Back");
int32_t idMenugDisplay = myMenu->AddTitle("Display");
(void)myMenu->Add(idMenugDisplay, "Charset UTF-8", "", ednMsgGuiChangeCharset, "UTF-8");
(void)myMenu->Add(idMenugDisplay, "Charset ISO-8859-1", "", ednMsgGuiChangeCharset, "ISO-8859-1");
(void)myMenu->Add(idMenugDisplay, "Charset ISO-8859-15", "", ednMsgGuiChangeCharset, "ISO-8859-15");
(void)myMenu->AddSpacer();
(void)myMenu->Add(idMenugDisplay, "Color Black", "", ednMsgGuiChangeColor, "Black");
(void)myMenu->Add(idMenugDisplay, "Color White", "", ednMsgGuiChangeColor, "White");
(void)myMenu->AddSpacer();
(void)myMenu->Add(idMenugDisplay, "Reload OpenGl Shader", "", ednMsgGuiReloadShader);
mySizerHori->subWidgetAdd(myMenu);
int32_t idMenuFile = myMenu->addTitle("File");
(void)myMenu->add(idMenuFile, "New", "", ednMsgGuiNew);
(void)myMenu->addSpacer();
(void)myMenu->add(idMenuFile, "Open", "THEME:GUI:Load.svg", ednMsgGuiOpen);
(void)myMenu->add(idMenuFile, "Close", "THEME:GUI:Close.svg", ednMsgGuiClose, "current");
(void)myMenu->add(idMenuFile, "Close (all)", "", ednMsgGuiClose, "All");
(void)myMenu->add(idMenuFile, "Save", "THEME:GUI:Save.svg", ednMsgGuiSave, "current");
(void)myMenu->add(idMenuFile, "Save As ...", "", ednMsgGuiSaveAs);
(void)myMenu->addSpacer();
//(void)myMenu->add(idMenuFile, "Exit", "", ednMsgGuiExit);
(void)myMenu->addSpacer();
(void)myMenu->add(idMenuFile, "Properties", "THEME:GUI:Parameter.svg", ednMsgProperties);
int32_t idMenuEdit = myMenu->addTitle("Edit");
(void)myMenu->add(idMenuEdit, "Undo", "THEME:GUI:Undo.svg", ednMsgGuiUndo);
(void)myMenu->add(idMenuEdit, "Redo", "THEME:GUI:Redo.svg", ednMsgGuiRedo);
(void)myMenu->addSpacer();
(void)myMenu->add(idMenuEdit, "Copy", "", ednMsgGuiCopy, "STD");
(void)myMenu->add(idMenuEdit, "Cut", "", ednMsgGuiCut, "STD");
(void)myMenu->add(idMenuEdit, "Paste", "", ednMsgGuiPaste, "STD");
(void)myMenu->add(idMenuEdit, "Remove", "", ednMsgGuiRm);
(void)myMenu->addSpacer();
(void)myMenu->add(idMenuEdit, "Select All","", ednMsgGuiSelect, "ALL");
(void)myMenu->add(idMenuEdit, "Un-Select","", ednMsgGuiSelect, "NONE");
(void)myMenu->add(idMenuEdit, "Goto line ...","", ednMsgGuiGotoLine, "???");
int32_t idMenuSearch = myMenu->addTitle("Search");
(void)myMenu->add(idMenuSearch, "Search", "THEME:GUI:Search.svg", ednMsgGuiSearch);
(void)myMenu->add(idMenuSearch, "Replace", "THEME:GUI:Replace.svg", ednMsgGuiReplace);
(void)myMenu->addSpacer();
(void)myMenu->add(idMenuSearch, "Find (previous)","", ednMsgGuiFind, "Previous");
(void)myMenu->add(idMenuSearch, "Find (next)", "", ednMsgGuiFind, "Next");
(void)myMenu->add(idMenuSearch, "Find (all)", "", ednMsgGuiFind, "All");
(void)myMenu->add(idMenuSearch, "Un-Select", "", ednMsgGuiFind, "None");
int32_t idMenuCTags = myMenu->addTitle("C-tags");
(void)myMenu->add(idMenuCTags, "Load", "", ednMsgGuiCtags, "Load");
(void)myMenu->add(idMenuCTags, "ReLoad", "", ednMsgGuiCtags, "ReLoad");
(void)myMenu->add(idMenuCTags, "Jump", "", ednMsgGuiCtags, "Jump");
(void)myMenu->add(idMenuCTags, "Back", "", ednMsgGuiCtags, "Back");
int32_t idMenugDisplay = myMenu->addTitle("Display");
(void)myMenu->add(idMenugDisplay, "Charset UTF-8", "", ednMsgGuiChangeCharset, "UTF-8");
(void)myMenu->add(idMenugDisplay, "Charset ISO-8859-1", "", ednMsgGuiChangeCharset, "ISO-8859-1");
(void)myMenu->add(idMenugDisplay, "Charset ISO-8859-15", "", ednMsgGuiChangeCharset, "ISO-8859-15");
(void)myMenu->addSpacer();
(void)myMenu->add(idMenugDisplay, "Color Black", "", ednMsgGuiChangeColor, "Black");
(void)myMenu->add(idMenugDisplay, "Color White", "", ednMsgGuiChangeColor, "White");
(void)myMenu->addSpacer();
(void)myMenu->add(idMenugDisplay, "Reload openGl Shader", "", ednMsgGuiReloadShader);
m_widgetLabelFileName = new widget::Label("<left>FileName</left>");
m_widgetLabelFileName->SetExpand(bvec2(true,false));
m_widgetLabelFileName->SetFill(bvec2(false,true));;
mySizerHori->SubWidgetAdd(m_widgetLabelFileName);
m_widgetLabelFileName->setExpand(bvec2(true,false));
m_widgetLabelFileName->setFill(bvec2(false,true));;
mySizerHori->subWidgetAdd(m_widgetLabelFileName);
// add generic shortcut ...
@ -283,102 +283,102 @@ const char *const ednEventPopUpFileSelected = "edn-mainWindows-openSelected";
const char *const ednEventPopUpFileSaveAs = "edn-mainWindows-saveAsSelected";
void MainWindows::OnReceiveMessage(const ewol::EMessage& _msg)
void MainWindows::onReceiveMessage(const ewol::EMessage& _msg)
{
ewol::Windows::OnReceiveMessage(_msg);
ewol::Windows::onReceiveMessage(_msg);
//APPL_INFO("Receive Event from the main windows ... : \"" << eventId << "\" == > data=\"" << data << "\"" );
// Open file Section ...
if (_msg.GetMessage() == ednMsgGuiOpen) {
widget::FileChooser* tmpWidget = new widget::FileChooser();
tmpWidget->SetTitle("Open Files ...");
tmpWidget->SetValidateLabel("Open");
if (BufferManager::GetSelected()!=-1) {
BufferText * myBuffer = BufferManager::Get(BufferManager::GetSelected());
// open file Section ...
if (_msg.getMessage() == ednMsgGuiOpen) {
widget::fileChooser* tmpWidget = new widget::FileChooser();
tmpWidget->setTitle("Open files ...");
tmpWidget->setValidateLabel("Open");
if (BufferManager::getSelected()!=-1) {
BufferText * myBuffer = BufferManager::get(BufferManager::GetSelected());
if (NULL!=myBuffer) {
etk::FSNode tmpFile = myBuffer->GetFileName();
tmpWidget->SetFolder(tmpFile.GetNameFolder());
etk::FSNode tmpFile = myBuffer->getFileName();
tmpWidget->setFolder(tmpFile.getNameFolder());
}
}
PopUpWidgetPush(tmpWidget);
tmpWidget->RegisterOnEvent(this, ewolEventFileChooserValidate, ednEventPopUpFileSelected);
} else if (_msg.GetMessage() == ednEventPopUpFileSelected) {
APPL_DEBUG("Request opening the file : " << _msg.GetData());
SendMultiCast(ednMsgOpenFile, _msg.GetData());
} else if (_msg.GetMessage() == ednMsgGuiSaveAs) {
if (_msg.GetData() == "") {
popUpWidgetPush(tmpWidget);
tmpWidget->registerOnEvent(this, ewolEventFileChooserValidate, ednEventPopUpFileSelected);
} else if (_msg.getMessage() == ednEventPopUpFileSelected) {
APPL_DEBUG("Request opening the file : " << _msg.getData());
SendMultiCast(ednMsgOpenFile, _msg.getData());
} else if (_msg.getMessage() == ednMsgGuiSaveAs) {
if (_msg.getData() == "") {
APPL_ERROR("Null data for Save As file ... ");
} else {
m_currentSavingAsIdBuffer = -1;
if (_msg.GetData() == "current") {
m_currentSavingAsIdBuffer = BufferManager::GetSelected();
if (_msg.getData() == "current") {
m_currentSavingAsIdBuffer = BufferManager::getSelected();
} else {
sscanf(_msg.GetData().c_str(), "%d", &m_currentSavingAsIdBuffer);
sscanf(_msg.getData().c_str(), "%d", &m_currentSavingAsIdBuffer);
}
if (false == BufferManager::Exist(m_currentSavingAsIdBuffer)) {
APPL_ERROR("Request saveAs on non existant Buffer ID=" << m_currentSavingAsIdBuffer);
} else {
BufferText* myBuffer = BufferManager::Get(m_currentSavingAsIdBuffer);
widget::FileChooser* tmpWidget = new widget::FileChooser();
BufferText* myBuffer = BufferManager::get(m_currentSavingAsIdBuffer);
widget::fileChooser* tmpWidget = new widget::FileChooser();
if (NULL == tmpWidget) {
APPL_ERROR("Can not allocate widget == > display might be in error");
} else {
tmpWidget->SetTitle("Save Files As...");
tmpWidget->SetValidateLabel("Save");
tmpWidget->setTitle("Save files As...");
tmpWidget->setValidateLabel("Save");
etk::UString folder = "/home/";
etk::UString fileName = "";
if (true == myBuffer->HaveName()) {
etk::FSNode tmpName = myBuffer->GetFileName();
folder = tmpName.GetNameFolder();
fileName = tmpName.GetNameFile();
if (true == myBuffer->haveName()) {
etk::FSNode tmpName = myBuffer->getFileName();
folder = tmpName.getNameFolder();
fileName = tmpName.getNameFile();
}
tmpWidget->SetFolder(folder);
tmpWidget->SetFileName(fileName);
PopUpWidgetPush(tmpWidget);
tmpWidget->RegisterOnEvent(this, ewolEventFileChooserValidate, ednEventPopUpFileSaveAs);
tmpWidget->setFolder(folder);
tmpWidget->setFileName(fileName);
popUpWidgetPush(tmpWidget);
tmpWidget->registerOnEvent(this, ewolEventFileChooserValidate, ednEventPopUpFileSaveAs);
}
}
}
} else if (_msg.GetMessage() == ednEventPopUpFileSaveAs) {
} else if (_msg.getMessage() == ednEventPopUpFileSaveAs) {
// get the filename :
etk::UString tmpData = _msg.GetData();
etk::UString tmpData = _msg.getData();
APPL_DEBUG("Request Saving As file : " << tmpData);
BufferManager::Get(m_currentSavingAsIdBuffer)->SetFileName(tmpData);
BufferManager::get(m_currentSavingAsIdBuffer)->setFileName(tmpData);
SendMultiCast(ednMsgGuiSave, m_currentSavingAsIdBuffer);
} else if( _msg.GetMessage() == ednMsgBufferState
|| _msg.GetMessage() == ednMsgBufferId) {
} else if( _msg.getMessage() == ednMsgBufferState
|| _msg.getMessage() == ednMsgBufferId) {
// the buffer change we need to update the widget string
BufferText* tmpBuffer = BufferManager::Get(BufferManager::GetSelected());
BufferText* tmpBuffer = BufferManager::get(BufferManager::GetSelected());
if (NULL != tmpBuffer) {
etk::FSNode compleateName = tmpBuffer->GetFileName();
bool isModify = tmpBuffer->IsModify();
etk::UString directName = compleateName.GetName();
etk::FSNode compleateName = tmpBuffer->getFileName();
bool isModify = tmpBuffer->isModify();
etk::UString directName = compleateName.getName();
if (true == isModify) {
directName += " *";
}
if (NULL != m_widgetLabelFileName) {
m_widgetLabelFileName->SetLabel(etk::UString("<left>") + directName + "</left>");
m_widgetLabelFileName->setLabel(etk::UString("<left>") + directName + "</left>");
}
etk::UString windowsTitle = "edn - ";
windowsTitle += directName;
SetTitle(windowsTitle);
setTitle(windowsTitle);
return;
} else {
m_widgetLabelFileName->SetLabel("");
SetTitle("edn");
m_widgetLabelFileName->setLabel("");
setTitle("edn");
}
return;
// TODO : Set the Title ....
} else if (_msg.GetMessage() == ednMsgProperties) {
// TODO : set the Title ....
} else if (_msg.getMessage() == ednMsgProperties) {
// Request the parameter GUI
widget::Parameter* tmpWidget = new widget::Parameter();
if (NULL == tmpWidget) {
APPL_ERROR("Can not allocate widget == > display might be in error");
} else {
tmpWidget->SetTitle("Properties");
PopUpWidgetPush(tmpWidget);
tmpWidget->setTitle("Properties");
popUpWidgetPush(tmpWidget);
tmpWidget->MenuAddGroup("Editor");
ewol::Widget* tmpSubWidget = new globals::ParameterGlobalsGui();
tmpWidget->MenuAdd("Editor", "", tmpSubWidget);
@ -389,19 +389,19 @@ void MainWindows::OnReceiveMessage(const ewol::EMessage& _msg)
tmpSubWidget = new ParameterAboutGui();
tmpWidget->MenuAdd("About", "", tmpSubWidget);
}
} else if (_msg.GetMessage() == ednMsgGuiReloadShader) {
ewol::GetContext().GetResourcesManager().ReLoadResources();
ewol::GetContext().ForceRedrawAll();
} else if (_msg.GetMessage() == ednMsgGuiExit) {
} else if (_msg.getMessage() == ednMsgGuiReloadShader) {
ewol::getContext().getResourcesManager().ReLoadResources();
ewol::getContext().forceRedrawAll();
} else if (_msg.getMessage() == ednMsgGuiExit) {
// TODO ...
}
return;
}
void MainWindows::OnObjectRemove(ewol::EObject * _removeObject)
void MainWindows::onObjectRemove(ewol::EObject * _removeObject)
{
ewol::Windows::OnObjectRemove(_removeObject);
ewol::Windows::onObjectRemove(_removeObject);
if (m_widgetLabelFileName == _removeObject) {
m_widgetLabelFileName = NULL;
}

View File

@ -27,9 +27,9 @@ class MainWindows : public ewol::Windows
MainWindows(void);
~MainWindows(void);
public: // Derived function
virtual const char * const GetObjectType(void) { return "MainWindows"; };
virtual void OnReceiveMessage(const ewol::EMessage& _msg);
virtual void OnObjectRemove(ewol::EObject * _removeObject);
virtual const char * const getObjectType(void) { return "MainWindows"; };
virtual void onReceiveMessage(const ewol::EMessage& _msg);
virtual void onObjectRemove(ewol::EObject * _removeObject);
};
#define EDN_CAST_MAIN_WINDOWS(curentPointer) EWOL_CAST(TYPE_EOBJECT_EDN_MAIN_WINDOWS,MainWindows,curentPointer)

View File

@ -37,7 +37,7 @@ Search::Search(void) :
m_replaceEntry(NULL)
{
m_forward = false;
// TODO : Change the mode of creating interface :
// TODO : change the mode of creating interface :
/*
<composer>
<sizer mode="hori" expand="true,false" fill="true" lock="true">
@ -73,21 +73,21 @@ Search::Search(void) :
APPL_ERROR("Widget allocation error == > it will missing in the display");
} else {
widget::Image* tmpImage = new widget::Image("THEME:GUI:Remove.svg");
tmpImage->SetImageSize(ewol::Dimension(vec2(8,8), ewol::Dimension::Millimeter));
myButtonImage->SetSubWidget(tmpImage);
myButtonImage->RegisterOnEvent(this, widget::Button::eventPressed, l_eventHideBt);
SubWidgetAdd(myButtonImage);
tmpImage->setImageSize(ewol::Dimension(vec2(8,8), ewol::Dimension::Millimeter));
myButtonImage->setSubWidget(tmpImage);
myButtonImage->registerOnEvent(this, widget::Button::eventPressed, l_eventHideBt);
subWidgetAdd(myButtonImage);
}
m_searchEntry = new widget::Entry();
if (NULL == m_searchEntry) {
APPL_ERROR("Widget allocation error == > it will missing in the display");
} else {
m_searchEntry->RegisterOnEvent(this, widget::Entry::eventModify, l_eventSearchEntry);
m_searchEntry->RegisterOnEvent(this, widget::Entry::eventEnter, l_eventSearchEntryEnter);
m_searchEntry->SetExpand(bvec2(true,false));
m_searchEntry->SetFill(bvec2(true,false));
SubWidgetAdd(m_searchEntry);
m_searchEntry->registerOnEvent(this, widget::Entry::eventModify, l_eventSearchEntry);
m_searchEntry->registerOnEvent(this, widget::Entry::eventEnter, l_eventSearchEntryEnter);
m_searchEntry->setExpand(bvec2(true,false));
m_searchEntry->setFill(bvec2(true,false));
subWidgetAdd(m_searchEntry);
}
myButtonImage = new widget::Button();
@ -95,21 +95,21 @@ Search::Search(void) :
APPL_ERROR("Widget allocation error == > it will missing in the display");
} else {
widget::Image* tmpImage = new widget::Image("THEME:GUI:Search.svg");
tmpImage->SetImageSize(ewol::Dimension(vec2(8,8), ewol::Dimension::Millimeter));
myButtonImage->SetSubWidget(tmpImage);
myButtonImage->RegisterOnEvent(this, widget::Button::eventPressed, l_eventSearchBt);
SubWidgetAdd(myButtonImage);
tmpImage->setImageSize(ewol::Dimension(vec2(8,8), ewol::Dimension::Millimeter));
myButtonImage->setSubWidget(tmpImage);
myButtonImage->registerOnEvent(this, widget::Button::eventPressed, l_eventSearchBt);
subWidgetAdd(myButtonImage);
}
m_replaceEntry = new widget::Entry();
if (NULL == m_replaceEntry) {
APPL_ERROR("Widget allocation error == > it will missing in the display");
} else {
m_replaceEntry->RegisterOnEvent(this, widget::Entry::eventModify, l_eventReplaceEntry);
m_replaceEntry->RegisterOnEvent(this, widget::Entry::eventEnter, l_eventReplaceEntryEnter);
m_replaceEntry->SetExpand(bvec2(true,false));
m_replaceEntry->SetFill(bvec2(true,false));
SubWidgetAdd(m_replaceEntry);
m_replaceEntry->registerOnEvent(this, widget::Entry::eventModify, l_eventReplaceEntry);
m_replaceEntry->registerOnEvent(this, widget::Entry::eventEnter, l_eventReplaceEntryEnter);
m_replaceEntry->setExpand(bvec2(true,false));
m_replaceEntry->setFill(bvec2(true,false));
subWidgetAdd(m_replaceEntry);
}
myButtonImage = new widget::Button();
@ -117,67 +117,67 @@ Search::Search(void) :
APPL_ERROR("Widget allocation error == > it will missing in the display");
} else {
widget::Image* tmpImage = new widget::Image("THEME:GUI:Replace.svg");
tmpImage->SetImageSize(ewol::Dimension(vec2(8,8), ewol::Dimension::Millimeter));
myButtonImage->SetSubWidget(tmpImage);
myButtonImage->RegisterOnEvent(this, widget::Button::eventPressed, l_eventReplaceBt);
SubWidgetAdd(myButtonImage);
tmpImage->setImageSize(ewol::Dimension(vec2(8,8), ewol::Dimension::Millimeter));
myButtonImage->setSubWidget(tmpImage);
myButtonImage->registerOnEvent(this, widget::Button::eventPressed, l_eventReplaceBt);
subWidgetAdd(myButtonImage);
}
myButtonImage = new widget::Button();
if (NULL == myButtonImage) {
APPL_ERROR("Widget allocation error == > it will missing in the display");
} else {
myButtonImage->SetToggleMode(true);
myButtonImage->setToggleMode(true);
widget::Image* tmpImage = new widget::Image("THEME:GUI:CaseSensitive.svg");
tmpImage->SetImageSize(ewol::Dimension(vec2(8,8), ewol::Dimension::Millimeter));
myButtonImage->SetSubWidget(tmpImage);
tmpImage->setImageSize(ewol::Dimension(vec2(8,8), ewol::Dimension::Millimeter));
myButtonImage->setSubWidget(tmpImage);
tmpImage = new widget::Image("THEME:GUI:CaseSensitive.svg"); // TODO : Set color on Image .... 0xFFFFFF5F
tmpImage->SetImageSize(ewol::Dimension(vec2(8,8), ewol::Dimension::Millimeter));
myButtonImage->SetSubWidgetToggle(tmpImage);
tmpImage = new widget::Image("THEME:GUI:CaseSensitive.svg"); // TODO : set color on Image .... 0xFFFFFF5F
tmpImage->setImageSize(ewol::Dimension(vec2(8,8), ewol::Dimension::Millimeter));
myButtonImage->setSubWidgetToggle(tmpImage);
myButtonImage->SetValue(!SearchData::GetCase());
myButtonImage->RegisterOnEvent(this, widget::Button::eventPressed, l_eventCaseCb);
SubWidgetAdd(myButtonImage);
myButtonImage->setValue(!SearchData::getCase());
myButtonImage->registerOnEvent(this, widget::Button::eventPressed, l_eventCaseCb);
subWidgetAdd(myButtonImage);
}
myButtonImage = new widget::Button();
if (NULL == myButtonImage) {
APPL_ERROR("Widget allocation error == > it will missing in the display");
} else {
myButtonImage->SetToggleMode(true);
myButtonImage->setToggleMode(true);
widget::Image* tmpImage = new widget::Image("THEME:GUI:WrapAround.svg");
tmpImage->SetImageSize(ewol::Dimension(vec2(8,8), ewol::Dimension::Millimeter));
myButtonImage->SetSubWidget(tmpImage);
tmpImage->setImageSize(ewol::Dimension(vec2(8,8), ewol::Dimension::Millimeter));
myButtonImage->setSubWidget(tmpImage);
tmpImage = new widget::Image("THEME:GUI:WrapAround.svg"); // TODO : Set color on Image .... 0xFFFFFF5F
tmpImage->SetImageSize(ewol::Dimension(vec2(8,8), ewol::Dimension::Millimeter));
myButtonImage->SetSubWidgetToggle(tmpImage);
tmpImage = new widget::Image("THEME:GUI:WrapAround.svg"); // TODO : set color on Image .... 0xFFFFFF5F
tmpImage->setImageSize(ewol::Dimension(vec2(8,8), ewol::Dimension::Millimeter));
myButtonImage->setSubWidgetToggle(tmpImage);
myButtonImage->SetValue(!SearchData::GetWrap());
myButtonImage->RegisterOnEvent(this, widget::Button::eventPressed, l_eventWrapCb);
SubWidgetAdd(myButtonImage);
myButtonImage->setValue(!SearchData::getWrap());
myButtonImage->registerOnEvent(this, widget::Button::eventPressed, l_eventWrapCb);
subWidgetAdd(myButtonImage);
}
myButtonImage = new widget::Button();
if (NULL == myButtonImage) {
APPL_ERROR("Widget allocation error == > it will missing in the display");
} else {
myButtonImage->SetToggleMode(true);
myButtonImage->setToggleMode(true);
widget::Image* tmpImage = new widget::Image("THEME:GUI:Up.svg");
tmpImage->SetImageSize(ewol::Dimension(vec2(8,8), ewol::Dimension::Millimeter));
myButtonImage->SetSubWidget(tmpImage);
tmpImage->setImageSize(ewol::Dimension(vec2(8,8), ewol::Dimension::Millimeter));
myButtonImage->setSubWidget(tmpImage);
tmpImage = new widget::Image("THEME:GUI:Down.svg");
tmpImage->SetImageSize(ewol::Dimension(vec2(8,8), ewol::Dimension::Millimeter));
myButtonImage->SetSubWidgetToggle(tmpImage);
tmpImage->setImageSize(ewol::Dimension(vec2(8,8), ewol::Dimension::Millimeter));
myButtonImage->setSubWidgetToggle(tmpImage);
myButtonImage->SetValue(!m_forward);
myButtonImage->RegisterOnEvent(this, widget::Button::eventPressed, l_eventForwardCb);
SubWidgetAdd(myButtonImage);
myButtonImage->setValue(!m_forward);
myButtonImage->registerOnEvent(this, widget::Button::eventPressed, l_eventForwardCb);
subWidgetAdd(myButtonImage);
}
RegisterMultiCast(ednMsgGuiSearch);
@ -191,74 +191,74 @@ Search::~Search(void)
}
void Search::OnReceiveMessage(const ewol::EMessage& _msg)
void Search::onReceiveMessage(const ewol::EMessage& _msg)
{
widget::Sizer::OnReceiveMessage(_msg);
widget::Sizer::onReceiveMessage(_msg);
//APPL_INFO("Search receive message : \"" << eventId << "\" data=\"" << data << "\"");
if ( _msg.GetMessage() == l_eventSearchEntry) {
SearchData::SetSearch(_msg.GetData());
} else if ( _msg.GetMessage() == l_eventSearchEntryEnter) {
SearchData::SetSearch(_msg.GetData());
if ( _msg.getMessage() == l_eventSearchEntry) {
SearchData::setSearch(_msg.getData());
} else if ( _msg.getMessage() == l_eventSearchEntryEnter) {
SearchData::setSearch(_msg.getData());
if (true == m_forward) {
SendMultiCast(ednMsgGuiFind, "Previous");
} else {
SendMultiCast(ednMsgGuiFind, "Next");
}
} else if ( _msg.GetMessage() == l_eventReplaceEntry) {
SearchData::SetReplace(_msg.GetData());
} else if ( _msg.GetMessage() == l_eventReplaceEntryEnter) {
SearchData::SetReplace(_msg.GetData());
} else if ( _msg.getMessage() == l_eventReplaceEntry) {
SearchData::setReplace(_msg.getData());
} else if ( _msg.getMessage() == l_eventReplaceEntryEnter) {
SearchData::setReplace(_msg.getData());
SendMultiCast(ednMsgGuiReplace, "Normal");
if (true == m_forward) {
SendMultiCast(ednMsgGuiFind, "Previous");
} else {
SendMultiCast(ednMsgGuiFind, "Next");
}
} else if ( _msg.GetMessage() == l_eventSearchBt) {
} else if ( _msg.getMessage() == l_eventSearchBt) {
if (true == m_forward) {
SendMultiCast(ednMsgGuiFind, "Previous");
} else {
SendMultiCast(ednMsgGuiFind, "Next");
}
} else if ( _msg.GetMessage() == l_eventReplaceBt) {
} else if ( _msg.getMessage() == l_eventReplaceBt) {
SendMultiCast(ednMsgGuiReplace, "Normal");
if (true == m_forward) {
SendMultiCast(ednMsgGuiFind, "Previous");
} else {
SendMultiCast(ednMsgGuiFind, "Next");
}
} else if ( _msg.GetMessage() == l_eventCaseCb) {
if (_msg.GetData() == "1") {
SearchData::SetCase(false);
} else if ( _msg.getMessage() == l_eventCaseCb) {
if (_msg.getData() == "1") {
SearchData::setCase(false);
} else {
SearchData::SetCase(true);
SearchData::setCase(true);
}
} else if ( _msg.GetMessage() == l_eventWrapCb) {
if (_msg.GetData() == "1") {
SearchData::SetWrap(false);
} else if ( _msg.getMessage() == l_eventWrapCb) {
if (_msg.getData() == "1") {
SearchData::setWrap(false);
} else {
SearchData::SetWrap(true);
SearchData::setWrap(true);
}
} else if ( _msg.GetMessage() == l_eventForwardCb) {
if (_msg.GetData() == "1") {
} else if ( _msg.getMessage() == l_eventForwardCb) {
if (_msg.getData() == "1") {
m_forward = false;
} else {
m_forward = true;
}
} else if ( _msg.GetMessage() == l_eventHideBt) {
} else if ( _msg.getMessage() == l_eventHideBt) {
Hide();
} else if ( _msg.GetMessage() == ednMsgGuiSearch) {
if (true == IsHide()) {
} else if ( _msg.getMessage() == ednMsgGuiSearch) {
if (true == isHide()) {
Show();
if (m_searchEntry!= NULL) {
m_searchEntry->KeepFocus();
m_searchEntry->keepFocus();
}
} else {
if( (m_searchEntry!=NULL && true==m_searchEntry->GetFocus())
|| (m_replaceEntry!=NULL && true==m_replaceEntry->GetFocus()) ) {
if( (m_searchEntry!=NULL && true == m_searchEntry->getFocus())
|| (m_replaceEntry!=NULL && true == m_replaceEntry->getFocus()) ) {
Hide();
} else if (m_searchEntry!= NULL) {
m_searchEntry->KeepFocus();
m_searchEntry->keepFocus();
} else {
Hide();
}
@ -266,9 +266,9 @@ void Search::OnReceiveMessage(const ewol::EMessage& _msg)
}
}
void Search::OnObjectRemove(ewol::EObject * _removeObject)
void Search::onObjectRemove(ewol::EObject * _removeObject)
{
widget::Sizer::OnObjectRemove(_removeObject);
widget::Sizer::onObjectRemove(_removeObject);
if (_removeObject == m_searchEntry) {
m_searchEntry = NULL;
}

View File

@ -24,9 +24,9 @@ class Search : public widget::Sizer
Search(void);
~Search(void);
public: // derived function
virtual const char * const GetObjectType(void) { return "ApplSearch"; };
virtual void OnReceiveMessage(const ewol::EMessage& _msg);
virtual void OnObjectRemove(ewol::EObject * _removeObject);
virtual const char * const getObjectType(void) { return "ApplSearch"; };
virtual void onReceiveMessage(const ewol::EMessage& _msg);
virtual void onObjectRemove(ewol::EObject * _removeObject);
};
#endif

View File

@ -16,34 +16,34 @@
static etk::UString m_findRequest = "";
void SearchData::SetSearch(const etk::UString &myData)
void SearchData::setSearch(const etk::UString &myData)
{
m_findRequest = myData;
}
void SearchData::GetSearch(etk::UString &myData)
void SearchData::getSearch(etk::UString &myData)
{
myData = m_findRequest;
}
bool SearchData::IsSearchEmpty(void)
bool SearchData::isSearchEmpty(void)
{
if(m_findRequest.Size() > 0) {
if(m_findRequest.size() > 0) {
return false;
}
return true;
}
static etk::UString m_replaceRequest = "";
void SearchData::SetReplace(const etk::UString &myData)
void SearchData::setReplace(const etk::UString &myData)
{
m_replaceRequest = myData;
}
void SearchData::GetReplace(etk::UString &myData)
void SearchData::getReplace(etk::UString &myData)
{
myData = m_replaceRequest;
}
bool SearchData::IsReplaceEmpty(void)
bool SearchData::isReplaceEmpty(void)
{
if(m_replaceRequest.Size() > 0) {
if(m_replaceRequest.size() > 0) {
return false;
}
return true;
@ -51,33 +51,33 @@ bool SearchData::IsReplaceEmpty(void)
static bool m_case = false;
void SearchData::SetCase(bool value)
void SearchData::setCase(bool value)
{
m_case = value;
}
bool SearchData::GetCase(void)
bool SearchData::getCase(void)
{
return m_case;
}
static bool m_wrap = true;
void SearchData::SetWrap(bool value)
void SearchData::setWrap(bool value)
{
m_wrap = value;
}
bool SearchData::GetWrap(void)
bool SearchData::getWrap(void)
{
return m_wrap;
}
static bool m_RegExp = false;
void SearchData::SetRegExp(bool value)
void SearchData::setRegExp(bool value)
{
m_RegExp = value;
}
bool SearchData::GetRegExp(void)
bool SearchData::getRegExp(void)
{
return m_RegExp;
}

View File

@ -14,18 +14,18 @@
namespace SearchData
{
void SetSearch(const etk::UString &myData);
void GetSearch(etk::UString &myData);
bool IsSearchEmpty(void);
void SetReplace(const etk::UString &myData);
void GetReplace(etk::UString &myData);
bool IsReplaceEmpty(void);
void SetCase(bool value);
bool GetCase(void);
void SetWrap(bool value);
bool GetWrap(void);
void SetRegExp(bool value);
bool GetRegExp(void);
void setSearch(const etk::UString &myData);
void getSearch(etk::UString &myData);
bool isSearchEmpty(void);
void setReplace(const etk::UString &myData);
void getReplace(etk::UString &myData);
bool isReplaceEmpty(void);
void setCase(bool value);
bool getCase(void);
void setWrap(bool value);
bool getWrap(void);
void setRegExp(bool value);
bool getRegExp(void);
}

View File

@ -20,15 +20,15 @@ extern const char * const applEventCtagsListValidate = "appl-event-ctags-list-
appl::TagFileList::TagFileList(void)
{
m_selectedLine = -1;
AddEventId(applEventCtagsListSelect);
AddEventId(applEventCtagsListValidate);
SetMouseLimit(1);
addEventId(applEventCtagsListSelect);
addEventId(applEventCtagsListValidate);
setMouseLimit(1);
}
appl::TagFileList::~TagFileList(void)
{
for (int32_t iii=0; iii<m_list.Size(); iii++) {
for (int32_t iii=0; iii<m_list.size(); iii++) {
if (NULL != m_list[iii]) {
delete(m_list[iii]);
m_list[iii] = NULL;
@ -36,25 +36,25 @@ appl::TagFileList::~TagFileList(void)
}
}
etk::Color<> appl::TagFileList::GetBasicBG(void) {
etk::Color<> appl::TagFileList::getBasicBG(void) {
return 0x00000010;
}
uint32_t appl::TagFileList::GetNuberOfColomn(void) {
uint32_t appl::TagFileList::getNuberOfColomn(void) {
return 2;
}
bool appl::TagFileList::GetTitle(int32_t colomn, etk::UString &myTitle, etk::Color<> &fg, etk::Color<> &bg) {
bool appl::TagFileList::getTitle(int32_t colomn, etk::UString &myTitle, etk::Color<> &fg, etk::Color<> &bg) {
myTitle = "title";
return true;
}
uint32_t appl::TagFileList::GetNuberOfRaw(void) {
return m_list.Size();
uint32_t appl::TagFileList::getNuberOfRaw(void) {
return m_list.size();
}
bool appl::TagFileList::GetElement(int32_t colomn, int32_t raw, etk::UString &myTextToWrite, etk::Color<> &fg, etk::Color<> &bg) {
if (raw >= 0 && raw < m_list.Size() && NULL != m_list[raw]) {
bool appl::TagFileList::getElement(int32_t colomn, int32_t raw, etk::UString &myTextToWrite, etk::Color<> &fg, etk::Color<> &bg) {
if (raw >= 0 && raw < m_list.size() && NULL != m_list[raw]) {
if (0 == colomn) {
myTextToWrite = etk::UString(m_list[raw]->fileLine);
} else {
@ -88,13 +88,13 @@ bool appl::TagFileList::GetElement(int32_t colomn, int32_t raw, etk::UString &my
};
bool appl::TagFileList::OnItemEvent(int32_t IdInput, ewol::keyEvent::status_te typeEvent, int32_t colomn, int32_t raw, float x, float y)
bool appl::TagFileList::onItemEvent(int32_t IdInput, ewol::keyEvent::status_te typeEvent, int32_t colomn, int32_t raw, float x, float y)
{
if (typeEvent == ewol::keyEvent::statusSingle) {
EWOL_INFO("Event on List : IdInput=" << IdInput << " colomn=" << colomn << " raw=" << raw );
if (1 == IdInput) {
int32_t previousRaw = m_selectedLine;
if (raw > m_list.Size() ) {
if (raw > m_list.size() ) {
m_selectedLine = -1;
} else {
m_selectedLine = raw;
@ -104,14 +104,14 @@ bool appl::TagFileList::OnItemEvent(int32_t IdInput, ewol::keyEvent::status_te t
event = applEventCtagsListSelect;
}
if( m_selectedLine >= 0
&& m_selectedLine < m_list.Size()
&& m_selectedLine < m_list.size()
&& NULL != m_list[m_selectedLine] ) {
GenerateEventId(event, etk::UString(m_list[raw]->fileLine)+":"+m_list[m_selectedLine]->filename);
generateEventId(event, etk::UString(m_list[raw]->fileLine)+":"+m_list[m_selectedLine]->filename);
} else {
GenerateEventId(applEventCtagsListUnSelect);
generateEventId(applEventCtagsListUnSelect);
}
// need to regenerate the display of the list :
MarkToRedraw();
markToRedraw();
return true;
}
}
@ -120,18 +120,18 @@ bool appl::TagFileList::OnItemEvent(int32_t IdInput, ewol::keyEvent::status_te t
/**
* @brief Add a Ctags item on the curent list
* @brief add a Ctags item on the curent list
* @param[in] file Compleate file name
* @param[in] jump line id
* @return ---
*/
void appl::TagFileList::Add(etk::UString& file, int32_t line)
void appl::TagFileList::add(etk::UString& file, int32_t line)
{
appl::TagListElement *tmpFile = new appl::TagListElement(file, line);
if (NULL != tmpFile) {
m_list.PushBack(tmpFile);
m_list.pushBack(tmpFile);
}
MarkToRedraw();
markToRedraw();
}

View File

@ -34,21 +34,21 @@ namespace appl {
TagFileList(void);
~TagFileList(void);
// display API :
virtual etk::Color<> GetBasicBG(void);
uint32_t GetNuberOfColomn(void);
bool GetTitle(int32_t colomn, etk::UString &myTitle, etk::Color<> &fg, etk::Color<> &bg);
uint32_t GetNuberOfRaw(void);
bool GetElement(int32_t colomn, int32_t raw, etk::UString &myTextToWrite, etk::Color<> &fg, etk::Color<> &bg);
bool OnItemEvent(int32_t IdInput, ewol::keyEvent::status_te typeEvent, int32_t colomn, int32_t raw, float x, float y);
virtual etk::Color<> getBasicBG(void);
uint32_t getNuberOfColomn(void);
bool getTitle(int32_t colomn, etk::UString &myTitle, etk::Color<> &fg, etk::Color<> &bg);
uint32_t getNuberOfRaw(void);
bool getElement(int32_t colomn, int32_t raw, etk::UString &myTextToWrite, etk::Color<> &fg, etk::Color<> &bg);
bool onItemEvent(int32_t IdInput, ewol::keyEvent::status_te typeEvent, int32_t colomn, int32_t raw, float x, float y);
// derived function
const char * const GetObjectType(void) { return "TagFileList"; };
const char * const getObjectType(void) { return "TagFileList"; };
public:
/**
* @brief Add a Ctags item on the curent list
* @brief add a Ctags item on the curent list
* @param[in] file Compleate file name
* @param[in] jump line id
*/
void Add(etk::UString& file, int32_t line);
void add(etk::UString& file, int32_t line);
};
};

View File

@ -32,8 +32,8 @@ extern const char * const applEventctagsCancel = "appl-event-ctags-
appl::TagFileSelection::TagFileSelection(void)
{
AddEventId(applEventctagsSelection);
AddEventId(applEventctagsCancel);
addEventId(applEventctagsSelection);
addEventId(applEventctagsCancel);
widget::Label* myWidgetTitle = NULL;
widget::Button* myWidgetValidate = NULL;
@ -43,11 +43,11 @@ appl::TagFileSelection::TagFileSelection(void)
widget::Sizer * mySizerHori = NULL;
widget::Spacer * mySpacer = NULL;
#if defined(__TARGET_OS__Android)
SetMinSize(ewol::Dimension(vec2(90,90),ewol::Dimension::Pourcent));
setMinSize(ewol::Dimension(vec2(90,90),ewol::Dimension::Pourcent));
#elif defined(__TARGET_OS__Windows)
SetMinSize(ewol::Dimension(vec2(80,80),ewol::Dimension::Pourcent));
setMinSize(ewol::Dimension(vec2(80,80),ewol::Dimension::Pourcent));
#else
SetMinSize(ewol::Dimension(vec2(80,80),ewol::Dimension::Pourcent));
setMinSize(ewol::Dimension(vec2(80,80),ewol::Dimension::Pourcent));
#endif
mySizerVert = new widget::Sizer(widget::Sizer::modeVert);
@ -56,25 +56,25 @@ appl::TagFileSelection::TagFileSelection(void)
} else {
mySizerVert->LockExpand(bvec2(true,true));
// set it in the pop-up-system :
SetSubWidget(mySizerVert);
setSubWidget(mySizerVert);
mySizerHori = new widget::Sizer(widget::Sizer::modeHori);
if (NULL == mySizerHori) {
EWOL_ERROR("Can not allocate widget == > display might be in error");
} else {
mySizerVert->SubWidgetAdd(mySizerHori);
mySizerVert->subWidgetAdd(mySizerHori);
mySpacer = new widget::Spacer();
if (NULL == mySpacer) {
EWOL_ERROR("Can not allocate widget == > display might be in error");
} else {
mySpacer->SetExpand(bvec2(true,false));
mySizerHori->SubWidgetAdd(mySpacer);
mySpacer->setExpand(bvec2(true,false));
mySizerHori->subWidgetAdd(mySpacer);
}
myWidgetValidate = new widget::Button();
if (NULL == myWidgetValidate) {
EWOL_ERROR("Can not allocate widget == > display might be in error");
} else {
myWidgetValidate->SetSubWidget(
myWidgetValidate->setSubWidget(
new widget::Composer(widget::Composer::String,
"<composer>\n"
" <sizer mode=\"hori\">\n"
@ -83,14 +83,14 @@ appl::TagFileSelection::TagFileSelection(void)
" </sizer>\n"
"</composer\n"));
myWidgetValidate->RegisterOnEvent(this, widget::Button::eventPressed, applEventctagsSelection);
mySizerHori->SubWidgetAdd(myWidgetValidate);
myWidgetValidate->registerOnEvent(this, widget::Button::eventPressed, applEventctagsSelection);
mySizerHori->subWidgetAdd(myWidgetValidate);
}
myWidgetCancel = new widget::Button();
if (NULL == myWidgetCancel) {
EWOL_ERROR("Can not allocate widget == > display might be in error");
} else {
myWidgetCancel->SetSubWidget(
myWidgetCancel->setSubWidget(
new widget::Composer(widget::Composer::String,
"<composer>\n"
" <sizer mode=\"hori\">\n"
@ -98,27 +98,27 @@ appl::TagFileSelection::TagFileSelection(void)
" <label>Cancel</label>\n"
" </sizer>\n"
"</composer\n"));
myWidgetCancel->RegisterOnEvent(this, widget::Button::eventPressed, applEventctagsCancel);
mySizerHori->SubWidgetAdd(myWidgetCancel);
myWidgetCancel->registerOnEvent(this, widget::Button::eventPressed, applEventctagsCancel);
mySizerHori->subWidgetAdd(myWidgetCancel);
}
}
m_listTag = new appl::TagFileList();
if (NULL == m_listTag) {
EWOL_ERROR("Can not allocate widget == > display might be in error");
} else {
m_listTag->RegisterOnEvent(this, applEventCtagsListValidate);
m_listTag->RegisterOnEvent(this, applEventCtagsListSelect);
m_listTag->RegisterOnEvent(this, applEventCtagsListUnSelect);
m_listTag->SetExpand(bvec2(true,true));
m_listTag->SetFill(bvec2(true,true));
mySizerVert->SubWidgetAdd(m_listTag);
m_listTag->registerOnEvent(this, applEventCtagsListValidate);
m_listTag->registerOnEvent(this, applEventCtagsListSelect);
m_listTag->registerOnEvent(this, applEventCtagsListUnSelect);
m_listTag->setExpand(bvec2(true,true));
m_listTag->setFill(bvec2(true,true));
mySizerVert->subWidgetAdd(m_listTag);
}
myWidgetTitle = new widget::Label("Ctags Jump Selection ...");
if (NULL == myWidgetTitle) {
EWOL_ERROR("Can not allocate widget == > display might be in error");
} else {
mySizerVert->SubWidgetAdd(myWidgetTitle);
mySizerVert->subWidgetAdd(myWidgetTitle);
}
}
}
@ -129,26 +129,26 @@ appl::TagFileSelection::~TagFileSelection(void)
}
void appl::TagFileSelection::OnReceiveMessage(const ewol::EMessage& _msg)
void appl::TagFileSelection::onReceiveMessage(const ewol::EMessage& _msg)
{
EWOL_INFO("ctags LIST ... : \"" << _msg.GetMessage() << "\" ==> data=\"" << _msg.GetData() << "\"" );
if (_msg.GetMessage() == applEventctagsSelection) {
EWOL_INFO("ctags LIST ... : \"" << _msg.getMessage() << "\" == > data=\"" << _msg.GetData() << "\"" );
if (_msg.getMessage() == applEventctagsSelection) {
if (m_eventNamed!="") {
GenerateEventId(applEventctagsSelection, m_eventNamed);
generateEventId(applEventctagsSelection, m_eventNamed);
// == > Auto remove ...
AutoDestroy();
}
} else if (_msg.GetMessage() == applEventCtagsListSelect) {
m_eventNamed = _msg.GetData();
} else if (_msg.getMessage() == applEventCtagsListSelect) {
m_eventNamed = _msg.getData();
} else if (_msg.GetMessage() == applEventCtagsListUnSelect) {
} else if (_msg.getMessage() == applEventCtagsListUnSelect) {
m_eventNamed = "";
} else if (_msg.GetMessage() == applEventCtagsListValidate) {
GenerateEventId(applEventctagsSelection, _msg.GetData());
} else if (_msg.getMessage() == applEventCtagsListValidate) {
generateEventId(applEventctagsSelection, _msg.getData());
// == > Auto remove ...
AutoDestroy();
} else if (_msg.GetMessage() == applEventctagsCancel) {
GenerateEventId(applEventctagsCancel, "");
} else if (_msg.getMessage() == applEventctagsCancel) {
generateEventId(applEventctagsCancel, "");
// == > Auto remove ...
AutoDestroy();
}
@ -157,21 +157,21 @@ void appl::TagFileSelection::OnReceiveMessage(const ewol::EMessage& _msg)
/**
* @brief Add a Ctags item on the curent list
* @brief add a Ctags item on the curent list
* @param[in] file Compleate file name
* @param[in] jump line id
*/
void appl::TagFileSelection::AddCtagsNewItem(etk::UString file, int32_t line)
void appl::TagFileSelection::addCtagsNewItem(etk::UString file, int32_t line)
{
if (NULL != m_listTag) {
m_listTag->Add(file, line);
m_listTag->add(file, line);
}
}
void appl::TagFileSelection::OnObjectRemove(ewol::EObject * _removeObject)
void appl::TagFileSelection::onObjectRemove(ewol::EObject * _removeObject)
{
// First step call parrent :
widget::PopUp::OnObjectRemove(_removeObject);
widget::PopUp::onObjectRemove(_removeObject);
// second step find if in all the elements ...
if(_removeObject == m_listTag) {
m_listTag = NULL;

View File

@ -26,15 +26,15 @@ namespace appl {
TagFileSelection(void);
virtual ~TagFileSelection(void);
/**
* @brief Add a Ctags item on the curent list
* @brief add a Ctags item on the curent list
* @param[in] file Compleate file name
* @param[in] jump line id
*/
void AddCtagsNewItem(etk::UString file, int32_t line);
void addCtagsNewItem(etk::UString file, int32_t line);
public: // herited function
const char * const GetObjectType(void) { return "EwolFileChooser"; };
void OnReceiveMessage(const ewol::EMessage& _msg);
void OnObjectRemove(ewol::EObject * _removeObject);
const char * const getObjectType(void) { return "EwolFileChooser"; };
void onReceiveMessage(const ewol::EMessage& _msg);
void onObjectRemove(ewol::EObject * _removeObject);
};
};

View File

@ -27,7 +27,7 @@ appl::TextViewer::TextViewer(const etk::UString& _fontName, int32_t _fontSize) :
m_displayText(_fontName, _fontSize),
m_insertMode(false)
{
SetCanHaveFocus(true);
setCanHaveFocus(true);
RegisterMultiCast(ednMsgBufferId);
RegisterMultiCast(ednMsgGuiCopy);
RegisterMultiCast(ednMsgGuiPaste);
@ -40,7 +40,7 @@ appl::TextViewer::TextViewer(const etk::UString& _fontName, int32_t _fontSize) :
RegisterMultiCast(ednMsgGuiFind);
RegisterMultiCast(ednMsgGuiReplace);
RegisterMultiCast(ednMsgGuiGotoLine);
SetLimitScrolling(0.2);
setLimitScrolling(0.2);
ShortCutAdd("ctrl+w", ednMsgGuiRm, "Line");
ShortCutAdd("ctrl+shift+w", ednMsgGuiRm, "Paragraph");
@ -57,7 +57,7 @@ appl::TextViewer::TextViewer(const etk::UString& _fontName, int32_t _fontSize) :
APPL_ERROR("can not create buffer ... ");
return;
}
m_buffer->LoadFile("./example.txt");
m_buffer->loadFile("./example.txt");
}
@ -67,44 +67,44 @@ appl::TextViewer::~TextViewer(void)
}
bool appl::TextViewer::CalculateMinSize(void)
bool appl::TextViewer::calculateMinSize(void)
{
m_minSize.setValue(50,50);
return true;
}
void appl::TextViewer::CalculateMaxSize(void)
void appl::TextViewer::calculateMaxSize(void)
{
m_maxSize.setX(256);
m_maxSize.setY(256);
}
void appl::TextViewer::OnDraw(void)
void appl::TextViewer::onDraw(void)
{
m_displayDrawing.Draw();
m_displayText.Draw();
WidgetScrooled::OnDraw();
m_displayDrawing.draw();
m_displayText.draw();
WidgetScrooled::onDraw();
}
void appl::TextViewer::OnRegenerateDisplay(void)
void appl::TextViewer::onRegenerateDisplay(void)
{
if (false == NeedRedraw()) {
if (false == needRedraw()) {
return;
}
// For the scrooling windows
CalculateMaxSize();
m_displayDrawing.Clear();
m_displayText.Clear();
calculateMaxSize();
m_displayDrawing.clear();
m_displayText.clear();
// Reset the background :
m_displayDrawing.SetPos(vec3(0, 0, 0));
m_displayDrawing.SetColor(etk::Color<>(220, 220, 220, 256));
m_displayDrawing.RectangleWidth(m_size);
// reset the background :
m_displayDrawing.setPos(vec3(0, 0, 0));
m_displayDrawing.setColor(etk::Color<>(220, 220, 220, 256));
m_displayDrawing.rectangleWidth(m_size);
if (m_buffer == NULL) {
m_displayText.SetTextAlignement(10, m_size.x()-20, ewol::Text::alignLeft);
m_displayText.SetRelPos(vec3(10, 0, 0));
m_displayText.setTextAlignement(10, m_size.x()-20, ewol::Text::alignLeft);
m_displayText.setRelPos(vec3(10, 0, 0));
etk::UString tmpString("<br/>\n"
"<font color=\"red\">\n"
" <b>\n"
@ -118,33 +118,33 @@ void appl::TextViewer::OnRegenerateDisplay(void)
" No Buffer Availlable to display\n"
" </i>\n"
"</font>\n");
m_displayText.SetPos(vec3(0.0f, m_size.y(), 0.0f) );
m_displayText.ForceLineReturn();
m_displayText.PrintDecorated(tmpString);
m_displayText.setPos(vec3(0.0f, m_size.y(), 0.0f) );
m_displayText.forceLineReturn();
m_displayText.printDecorated(tmpString);
// call the herited class...
WidgetScrooled::OnRegenerateDisplay();
WidgetScrooled::onRegenerateDisplay();
return;
}
// normal displa of the buffer :
vec3 tmpCursorPosition(0, 0, -1);
// real display ...
etk::Buffer& buf = m_buffer->GetData();
m_displayText.SetColor(etk::Color<>(0, 0, 0, 256));
etk::Buffer& buf = m_buffer->getData();
m_displayText.setColor(etk::Color<>(0, 0, 0, 256));
float countNbLine = 1;
esize_t countColomn = 0;
vec3 tmpLetterSize = m_displayText.CalculateSize((uniChar_t)'A');
vec3 tmpLetterSize = m_displayText.calculateSize((uniChar_t)'A');
vec3 positionCurentDisplay(0.0f, m_size.y()-tmpLetterSize.y(), 0.0f);
m_displayText.SetPos(positionCurentDisplay);
m_displayText.setPos(positionCurentDisplay);
// the siplay string :
etk::UString stringToDisplay;
esize_t bufferElementSize = 0;
etk::UniChar currentValue;
for (int32_t iii=0; iii<buf.Size(); iii+=bufferElementSize) {
for (int32_t iii=0; iii<buf.size(); iii+=bufferElementSize) {
if (iii == m_buffer->m_cursorPos) {
// need to display the cursor :
tmpCursorPosition = positionCurentDisplay;
}
bufferElementSize = m_buffer->Get(iii, currentValue);
bufferElementSize = m_buffer->get(iii, currentValue);
//APPL_DEBUG(" element size : " << iii << " : " << bufferElementSize);
if (currentValue == etk::UniChar::Return) {
countNbLine += 1;
@ -154,17 +154,17 @@ void appl::TextViewer::OnRegenerateDisplay(void)
}
positionCurentDisplay.setX(0);
positionCurentDisplay.setY(positionCurentDisplay.y()-tmpLetterSize.y());
m_displayText.SetPos(positionCurentDisplay);
m_displayText.setPos(positionCurentDisplay);
continue;
}
m_buffer->Expand(countColomn, currentValue, stringToDisplay);
//APPL_DEBUG("display : '" << currentValue << "' == > '" << stringToDisplay << "'");
//m_displayText.SetPos(positionCurentDisplay);
for (esize_t kkk=0; kkk<stringToDisplay.Size(); ++kkk) {
m_displayText.Print(stringToDisplay[kkk]);
//m_displayText.setPos(positionCurentDisplay);
for (esize_t kkk=0; kkk<stringToDisplay.size(); ++kkk) {
m_displayText.print(stringToDisplay[kkk]);
}
positionCurentDisplay = m_displayText.GetPos();
countColomn += stringToDisplay.Size();
positionCurentDisplay = m_displayText.getPos();
countColomn += stringToDisplay.size();
if (bufferElementSize == 0) {
bufferElementSize = 1;
@ -173,76 +173,76 @@ void appl::TextViewer::OnRegenerateDisplay(void)
if (tmpCursorPosition.z()!=-1) {
// display the cursor:
//APPL_DEBUG("display cursor at position : " << tmpCursorPosition);
m_displayText.SetPos(tmpCursorPosition);
m_displayText.SetColor(etk::Color<>(0xFF0000FF));
m_displayText.SetColorBg(etk::Color<>(0xFF0000FF));
m_displayText.PrintCursor(m_insertMode);
m_displayText.setPos(tmpCursorPosition);
m_displayText.setColor(etk::Color<>(0xFF0000FF));
m_displayText.setColorBg(etk::Color<>(0xFF0000FF));
m_displayText.printCursor(m_insertMode);
}
// call the herited class...
WidgetScrooled::OnRegenerateDisplay();
WidgetScrooled::onRegenerateDisplay();
}
bool appl::TextViewer::OnEventEntry(const ewol::EventEntry& _event)
bool appl::TextViewer::onEventEntry(const ewol::EventEntry& _event)
{
if (m_buffer == NULL) {
return false;
}
// just forward event == > manage directly in the buffer
if (m_buffer->OnEventEntry(_event) == true) {
MarkToRedraw();
if (m_buffer->onEventEntry(_event) == true) {
markToRedraw();
return true;
}
return false;
}
bool appl::TextViewer::OnEventInput(const ewol::EventInput& _event)
bool appl::TextViewer::onEventInput(const ewol::EventInput& _event)
{
vec2 relativePos = RelativePosition(_event.GetPos());
vec2 relativePos = relativePosition(_event.getPos());
if (m_buffer != NULL) {
}
KeepFocus();
keepFocus();
return true;
}
void appl::TextViewer::OnEventClipboard(ewol::clipBoard::clipboardListe_te _clipboardID)
void appl::TextViewer::onEventClipboard(ewol::clipBoard::clipboardListe_te _clipboardID)
{
if (m_buffer != NULL) {
//tmpBuffer->Paste(_clipboardID);
}
MarkToRedraw();
markToRedraw();
}
void appl::TextViewer::OnReceiveMessage(const ewol::EMessage& _msg)
void appl::TextViewer::onReceiveMessage(const ewol::EMessage& _msg)
{
// Force redraw of the widget
MarkToRedraw();
// force redraw of the widget
markToRedraw();
}
void appl::TextViewer::OnGetFocus(void)
void appl::TextViewer::onGetFocus(void)
{
ShowKeyboard();
APPL_INFO("Focus - In");
}
void appl::TextViewer::OnLostFocus(void)
void appl::TextViewer::onLostFocus(void)
{
HideKeyboard();
APPL_INFO("Focus - out");
}
void appl::TextViewer::SetFontSize(int32_t _size)
void appl::TextViewer::setFontSize(int32_t _size)
{
m_displayText.SetFontSize(_size);
SetScrollingSize(_size*3.0*1.46); // 1.46 is a magic number ...
m_displayText.setFontSize(_size);
setScrollingSize(_size*3.0*1.46); // 1.46 is a magic number ...
}
void appl::TextViewer::SetFontName(const etk::UString& _fontName)
void appl::TextViewer::setFontName(const etk::UString& _fontName)
{
m_displayText.SetFontName(_fontName);
m_displayText.setFontName(_fontName);
}

View File

@ -28,24 +28,24 @@ namespace appl
private:
appl::Buffer* m_buffer; //!< pointer on the current buffer to display (can be null if the buffer is remover or in state of changing buffer)
ewol::Text m_displayText; //!< Text display properties.
ewol::Drawing m_displayDrawing; //!< Other diaplay requested.
ewol::drawing m_displayDrawing; //!< Other diaplay requested.
public:
void SetFontSize(int32_t _size);
void SetFontName(const etk::UString& _fontName);
void setFontSize(int32_t _size);
void setFontName(const etk::UString& _fontName);
private:
void CalculateMaxSize(void);
void calculateMaxSize(void);
protected: // derived function
virtual void OnDraw(void);
virtual void onDraw(void);
public: // Derived function
const char * const GetObjectType(void) { return "ApplCodeView"; };
virtual bool CalculateMinSize(void);
virtual void OnRegenerateDisplay(void);
virtual void OnReceiveMessage(const ewol::EMessage& _msg);
virtual bool OnEventInput(const ewol::EventInput& _event);
virtual bool OnEventEntry(const ewol::EventEntry& _event);
virtual void OnEventClipboard(ewol::clipBoard::clipboardListe_te clipboardID);
virtual void OnGetFocus(void);
virtual void OnLostFocus(void);
const char * const getObjectType(void) { return "ApplCodeView"; };
virtual bool calculateMinSize(void);
virtual void onRegenerateDisplay(void);
virtual void onReceiveMessage(const ewol::EMessage& _msg);
virtual bool onEventInput(const ewol::EventInput& _event);
virtual bool onEventEntry(const ewol::EventEntry& _event);
virtual void onEventClipboard(ewol::clipBoard::clipboardListe_te clipboardID);
virtual void onGetFocus(void);
virtual void onLostFocus(void);
private:
bool m_insertMode; //!< the insert mode is enable
};

View File

@ -23,7 +23,7 @@ void Highlight::ParseRules(exml::Element* child, etk::Vector<HighlightPattern*>
// parse under Element
myPattern->ParseRules(child, level);
// add element in the list
mListPatern.PushBack(myPattern);
mListPatern.pushBack(myPattern);
}
@ -31,11 +31,11 @@ void Highlight::ParseRules(exml::Element* child, etk::Vector<HighlightPattern*>
Highlight::Highlight(const etk::UString& _xmlFilename)
{
exml::Document doc;
if (doc.Load(_xmlFilename)==false) {
if (doc.load(_xmlFilename) == false) {
APPL_ERROR(" can not load file XML : " << _xmlFilename);
return;
}
exml::Element* root = (exml::Element*)doc.GetNamed("EdnLang");
exml::Element* root = (exml::Element*)doc.getNamed("EdnLang");
if (NULL == root ) {
APPL_ERROR("(l ?) main node not find: \"EdnLang\" ...");
return;
@ -43,46 +43,46 @@ Highlight::Highlight(const etk::UString& _xmlFilename)
int32_t level1 = 0;
int32_t level2 = 0;
// parse all the elements :
for(int32_t iii=0; iii< root->Size(); iii++) {
exml::Element* child = root->GetElement(iii);
for(int32_t iii=0; iii< root->size(); iii++) {
exml::Element* child = root->getElement(iii);
if (child == NULL) {
// trash here all that is not element ...
continue;
}
if (child->GetValue() == "ext") {
etk::UString myData = child->GetText();
if (myData.Size()!=0) {
if (child->getValue() == "ext") {
etk::UString myData = child->getText();
if (myData.size()!=0) {
//APPL_INFO(PFX"(l %d) node fined : %s=\"%s\"", child->Row(), child->Value() , myData);
m_listExtentions.PushBack(myData);
m_listExtentions.pushBack(myData);
}
} else if (child->GetValue()=="pass1") {
// Get sub Nodes ...
for(int32_t jjj=0; jjj< child->Size(); jjj++) {
exml::Element* passChild = child->GetElement(jjj);
} else if (child->getValue() == "pass1") {
// get sub Nodes ...
for(int32_t jjj=0; jjj< child->size(); jjj++) {
exml::Element* passChild = child->getElement(jjj);
if (passChild == NULL) {
continue;
}
if (passChild->GetValue() != "rule") {
APPL_ERROR("(l "<< passChild->GetPos() << ") node not suported : \""<< passChild->GetValue() << "\" must be [rule]" );
if (passChild->getValue() != "rule") {
APPL_ERROR("(l "<< passChild->getPos() << ") node not suported : \""<< passChild->GetValue() << "\" must be [rule]" );
continue;
}
ParseRules(passChild, m_listHighlightPass1, level1++);
}
} else if (child->GetValue() == "pass2") {
// Get sub Nodes ...
for(int32_t jjj=0; jjj< child->Size(); jjj++) {
exml::Element* passChild = child->GetElement(jjj);
} else if (child->getValue() == "pass2") {
// get sub Nodes ...
for(int32_t jjj=0; jjj< child->size(); jjj++) {
exml::Element* passChild = child->getElement(jjj);
if (passChild == NULL) {
continue;
}
if (passChild->GetValue() != "rule") {
APPL_ERROR("(l "<< passChild->GetPos() << ") node not suported : \""<< passChild->GetValue() << "\" must be [rule]" );
if (passChild->getValue() != "rule") {
APPL_ERROR("(l "<< passChild->getPos() << ") node not suported : \""<< passChild->GetValue() << "\" must be [rule]" );
continue;
}
ParseRules(passChild, m_listHighlightPass2, level2++);
}
} else {
APPL_ERROR("(l "<< child->GetPos() << ") node not suported : \""<< child->GetValue() << "\" must be [ext,pass1,pass2]" );
APPL_ERROR("(l "<< child->getPos() << ") node not suported : \""<< child->GetValue() << "\" must be [ext,pass1,pass2]" );
}
}
}
@ -91,36 +91,36 @@ Highlight::~Highlight(void)
{
int32_t i;
// clean all Element
for (i=0; i< m_listHighlightPass1.Size(); i++) {
for (i=0; i< m_listHighlightPass1.size(); i++) {
if (NULL != m_listHighlightPass1[i]) {
delete(m_listHighlightPass1[i]);
m_listHighlightPass1[i] = NULL;
}
}
// clear the compleate list
m_listHighlightPass1.Clear();
m_listHighlightPass1.clear();
// clear the compleate list
m_listExtentions.Clear();
m_listExtentions.clear();
}
void Highlight::ReloadColor(void)
{
int32_t i;
for (i=0; i< m_listHighlightPass1.Size(); i++) {
for (i=0; i< m_listHighlightPass1.size(); i++) {
if (NULL != m_listHighlightPass1[i]) {
m_listHighlightPass1[i]->ReloadColor();
}
}
for (i=0; i< m_listHighlightPass2.Size(); i++) {
for (i=0; i< m_listHighlightPass2.size(); i++) {
if (NULL != m_listHighlightPass2[i]) {
m_listHighlightPass2[i]->ReloadColor();
}
}
}
bool Highlight::HasExtention(const etk::UString& _ext)
bool Highlight::hasExtention(const etk::UString& _ext)
{
for (int32_t iii=0; iii<m_listExtentions.Size(); iii++) {
for (int32_t iii=0; iii<m_listExtentions.size(); iii++) {
if (_ext == m_listExtentions[iii] ) {
return true;
}
@ -128,18 +128,18 @@ bool Highlight::HasExtention(const etk::UString& _ext)
return false;
}
bool Highlight::FileNameCompatible(etk::FSNode &_fileName)
bool Highlight::fileNameCompatible(etk::FSNode &_fileName)
{
etk::UString extention;
if (true == _fileName.FileHasExtention() ) {
if (true == _fileName.fileHasExtention() ) {
extention = "*.";
extention += _fileName.FileGetExtention();
extention += _fileName.fileGetExtention();
} else {
extention = _fileName.GetNameFile();
extention = _fileName.getNameFile();
}
APPL_DEBUG(" try to find : in \"" << _fileName << "\" extention:\"" << extention << "\" ");
for (int32_t iii=0; iii<m_listExtentions.Size(); iii++) {
for (int32_t iii=0; iii<m_listExtentions.size(); iii++) {
if (extention == m_listExtentions[iii] ) {
return true;
}
@ -148,24 +148,24 @@ bool Highlight::FileNameCompatible(etk::FSNode &_fileName)
}
void Highlight::Display(void)
void Highlight::display(void)
{
APPL_INFO("List of ALL Highlight : ");
for (int32_t iii=0; iii< m_listExtentions.Size(); iii++) {
for (int32_t iii=0; iii< m_listExtentions.size(); iii++) {
APPL_INFO(" Extention : " << iii << " : " << m_listExtentions[iii] );
}
// Display all elements
for (int32_t iii=0; iii< m_listHighlightPass1.Size(); iii++) {
APPL_INFO(" " << iii << " Pass 1 : " << m_listHighlightPass1[iii]->GetName() );
//m_listHighlightPass1[i]->Display();
// display all elements
for (int32_t iii=0; iii< m_listHighlightPass1.size(); iii++) {
APPL_INFO(" " << iii << " Pass 1 : " << m_listHighlightPass1[iii]->getName() );
//m_listHighlightPass1[i]->display();
}
// Display all elements
for (int32_t iii=0; iii< m_listHighlightPass2.Size(); iii++) {
APPL_INFO(" " << iii << " Pass 2 : " << m_listHighlightPass2[iii]->GetName() );
//m_listHighlightPass2[i]->Display();
// display all elements
for (int32_t iii=0; iii< m_listHighlightPass2.size(); iii++) {
APPL_INFO(" " << iii << " Pass 2 : " << m_listHighlightPass2[iii]->getName() );
//m_listHighlightPass2[i]->display();
}
}
// 13h 46min 22s | (l= 214) Highlight::Parse | [II] Find Pattern in the Buffer : (2457,2479)
// 13h 46min 22s | (l= 214) Highlight::Parse | [II] find Pattern in the Buffer : (2457,2479)
// TODO : Celui qui appelle suprime des element pour rien ... Enfin c'est pas trègrave... Il suffirait juste de suprimer celuis d'avant si il n'est pas terminer...
@ -178,44 +178,44 @@ void Highlight::Parse(int32_t start,
if (0 > addingPos) {
addingPos = 0;
}
//APPL_DEBUG("Parse element 0 => " << m_listHighlightPass1.Size() << " ==> position search: (" << start << "," << stop << ")" );
//APPL_DEBUG("Parse element 0 => " << m_listHighlightPass1.size() << " == > position search: (" << start << "," << stop << ")" );
int32_t elementStart = start;
int32_t elementStop = stop;
colorInformation_ts resultat;
while (elementStart<elementStop) {
//APPL_DEBUG("Parse element in the buffer id=" << elementStart);
//try to fond the HL in ALL of we have
for (int32_t jjj=0; jjj<m_listHighlightPass1.Size(); jjj++){
for (int32_t jjj=0; jjj<m_listHighlightPass1.size(); jjj++){
resultFind_te ret = HLP_FIND_OK;
//APPL_DEBUG("Parse HL id=" << jjj << " position search: (" << start << "," << buffer.Size() << ")" );
//APPL_DEBUG("Parse HL id=" << jjj << " position search: (" << start << "," << buffer.size() << ")" );
// Stop the search to the end (to get the end of the pattern)
ret = m_listHighlightPass1[jjj]->Find(elementStart, buffer.Size(), resultat, buffer);
ret = m_listHighlightPass1[jjj]->find(elementStart, buffer.size(), resultat, buffer);
if (HLP_FIND_ERROR != ret) {
//APPL_INFO("Find Pattern in the Buffer : (" << resultat.beginStart << "," << resultat.endStop << ")" );
// Remove element in the current List where the current Element have a end inside the next...
// remove element in the current List where the current Element have a end inside the next...
int32_t kkk=addingPos;
while(kkk < metaData.Size() ) {
while(kkk < metaData.size() ) {
if (metaData[kkk].beginStart <= resultat.endStop) {
// Remove element
// remove element
//APPL_INFO("Erase element=" << kkk);
metaData.EraseLen(kkk, kkk+1);
// Increase the end of search
if (kkk < metaData.Size()) {
if (kkk < metaData.size()) {
// just befor the end of the next element
elementStop = metaData[kkk].beginStart-1;
} else {
// end of the buffer
elementStop = buffer.Size();
elementStop = buffer.size();
}
} else {
// Not find == > exit the cycle :
break;
}
}
// Add curent element in the list ...
metaData.Insert(addingPos, resultat);
// add curent element in the list ...
metaData.insert(addingPos, resultat);
//APPL_DEBUG("INSERT at "<< addingPos << " S=" << resultat.beginStart << " E=" << resultat.endStop );
// Update the current research starting element: (Set position at the end of the current element
// update the current research starting element: (set position at the end of the current element
elementStart = resultat.endStop-1;
// increment the position of insertion:
addingPos++;
@ -246,15 +246,15 @@ void Highlight::Parse2(int32_t start,
//APPL_DEBUG("Parse element in the buffer id=" << elementStart);
//try to fond the HL in ALL of we have
int32_t jjj;
for (jjj=0; jjj<m_listHighlightPass2.Size(); jjj++){
for (jjj=0; jjj<m_listHighlightPass2.size(); jjj++){
resultFind_te ret = HLP_FIND_OK;
//APPL_DEBUG("Parse HL id=" << jjj << " position search: (" << start << "," << buffer.Size() << ")" );
//APPL_DEBUG("Parse HL id=" << jjj << " position search: (" << start << "," << buffer.size() << ")" );
// Stop the search to the end (to get the end of the pattern)
ret = m_listHighlightPass2[jjj]->Find(elementStart, elementStop, resultat, buffer);
ret = m_listHighlightPass2[jjj]->find(elementStart, elementStop, resultat, buffer);
if (HLP_FIND_ERROR != ret) {
//APPL_INFO("Find Pattern in the Buffer : (" << resultat.beginStart << "," << resultat.endStop << ")" );
// Add curent element in the list ...
metaData.PushBack(resultat);
// add curent element in the list ...
metaData.pushBack(resultat);
elementStart = resultat.endStop-1;
// Exit current cycle
break;

View File

@ -36,9 +36,9 @@ class Highlight {
// Constructeur
Highlight(const etk::UString& _xmlFilename);
~Highlight(void);
bool HasExtention(const etk::UString& _ext);
bool FileNameCompatible(etk::FSNode &_fileName);
void Display(void);
bool hasExtention(const etk::UString& _ext);
bool fileNameCompatible(etk::FSNode &_fileName);
void display(void);
void ReloadColor(void);
void Parse(int32_t start,
int32_t stop,

View File

@ -22,36 +22,36 @@ class localClassHighlightManager: public ewol::EObject
public:
// Constructeur
localClassHighlightManager(void) {
//ewol::widgetMessageMultiCast::Add(GetWidgetId(), ednMsgBufferColor);
//ewol::widgetMessageMultiCast::add(getWidgetId(), ednMsgBufferColor);
};
~localClassHighlightManager(void) {
int32_t i;
// clean all Element
for (i=0; i< listHighlight.Size(); i++) {
for (i=0; i< listHighlight.size(); i++) {
if (NULL != listHighlight[i]) {
delete(listHighlight[i]);
listHighlight[i] = NULL;
}
}
// clear the compleate list
listHighlight.Clear();
listHighlight.clear();
};
// herited function
const char * const GetObjectType(void)
const char * const getObjectType(void)
{
return "ApplHighlightManager";
}
// herited function
virtual void OnReceiveMessage(const ewol::EMessage& _msg)
virtual void onReceiveMessage(const ewol::EMessage& _msg)
{
/*
switch (id)
{
case APPL_MSG__COLOR_HAS_CHANGE:
APPL_INFO("UPDATE the color pointer on the HL");
for (int32_t i=0; i<listHighlight.Size(); i++) {
for (int32_t i=0; i<listHighlight.size(); i++) {
if (NULL != listHighlight[i]) {
listHighlight[i]->ReloadColor();
}
@ -61,11 +61,11 @@ class localClassHighlightManager: public ewol::EObject
*/
}
Highlight* Get(etk::FSNode &fileName)
Highlight* get(etk::FSNode &fileName)
{
int32_t i;
for (i=0; i<listHighlight.Size(); i++) {
if (true == listHighlight[i]->FileNameCompatible(fileName) ) {
for (i=0; i<listHighlight.size(); i++) {
if (true == listHighlight[i]->fileNameCompatible(fileName) ) {
return listHighlight[i];
}
}
@ -74,7 +74,7 @@ class localClassHighlightManager: public ewol::EObject
bool Exist(etk::FSNode &fileName)
{
if (NULL != Get(fileName) ) {
if (NULL != get(fileName) ) {
return true;
}
return false;
@ -86,17 +86,17 @@ class localClassHighlightManager: public ewol::EObject
etk::FSNode myFile("DATA:languages/");
// get the subfolder list :
etk::Vector<etk::FSNode *> list = myFile.FolderGetSubList(false, true, false,false);
for ( int32_t iii=0 ; iii<list.Size() ; iii++ ) {
for ( int32_t iii=0 ; iii<list.size() ; iii++ ) {
if (NULL!=list[iii]) {
if (list[iii]->GetNodeType()==etk::FSN_FOLDER) {
etk::UString filename = list[iii]->GetName() + "/highlight.xml";
if (list[iii]->getNodeType() == etk::FSN_FOLDER) {
etk::UString filename = list[iii]->getName() + "/highlight.xml";
APPL_DEBUG("Load xml name : " << filename);
Highlight *myHightline = new Highlight(filename);
listHighlight.PushBack(myHightline);
listHighlight.pushBack(myHightline);
}
}
}
//myHightline->Display();
//myHightline->display();
}
};
@ -105,7 +105,7 @@ static localClassHighlightManager * localManager = NULL;
void HighlightManager::Init(void)
void HighlightManager::init(void)
{
if (NULL != localManager) {
APPL_ERROR("HighlightManager == > already exist, just unlink the previous ...");
@ -136,12 +136,12 @@ void HighlightManager::loadLanguages(void)
localManager->loadLanguages();
}
Highlight* HighlightManager::Get(etk::FSNode &fileName)
Highlight* HighlightManager::get(etk::FSNode &fileName)
{
if (NULL == localManager) {
return NULL;
}
return localManager->Get(fileName);
return localManager->get(fileName);
}
bool HighlightManager::Exist(etk::FSNode &fileName)

View File

@ -16,10 +16,10 @@
#include <ewol/widget/Widget.h>
namespace HighlightManager{
void Init(void);
void init(void);
void UnInit(void);
void loadLanguages(void);
Highlight* Get(etk::FSNode &fileName);
Highlight* get(etk::FSNode &fileName);
bool Exist(etk::FSNode &fileName);
};

View File

@ -21,7 +21,7 @@ HighlightPattern::HighlightPattern(void)
{
m_haveStopPatern = false;
m_multiline = false;
m_color = ColorizeManager::Get("normal");
m_color = ColorizeManager::get("normal");
m_regExpStart = new etk::RegExp<etk::Buffer>();
m_regExpStop = new etk::RegExp<etk::Buffer>();
m_escapeChar = 0;
@ -33,24 +33,24 @@ HighlightPattern::~HighlightPattern(void)
delete(m_regExpStop);
}
void HighlightPattern::SetPaternStart(etk::UString &regExp)
void HighlightPattern::setPaternStart(etk::UString &regExp)
{
m_regExpStart->SetRegExp(regExp);
m_regExpStart->setRegExp(regExp);
}
void HighlightPattern::SetPaternStop(etk::UString &regExp)
void HighlightPattern::setPaternStop(etk::UString &regExp)
{
if (regExp.Size() != 0) {
m_regExpStop->SetRegExp(regExp);
if (regExp.size() != 0) {
m_regExpStop->setRegExp(regExp);
m_haveStopPatern = true;
} else {
m_haveStopPatern = false;
}
}
void HighlightPattern::SetEscapeChar(etk::UString &EscapeChar)
void HighlightPattern::setEscapeChar(etk::UString &EscapeChar)
{
if (EscapeChar.Size()>0) {
if (EscapeChar.size()>0) {
m_escapeChar = EscapeChar[0];
} else {
m_escapeChar = 0;
@ -58,13 +58,13 @@ void HighlightPattern::SetEscapeChar(etk::UString &EscapeChar)
}
void HighlightPattern::SetColor(etk::UString &colorName)
void HighlightPattern::setColor(etk::UString &colorName)
{
m_colorName = colorName;
m_color = ColorizeManager::Get(m_colorName);
m_color = ColorizeManager::get(m_colorName);
}
bool HighlightPattern::IsEnable(void)
bool HighlightPattern::isEnable(void)
{
return true;
}
@ -72,7 +72,7 @@ bool HighlightPattern::IsEnable(void)
void HighlightPattern::ReloadColor(void)
{
m_color = ColorizeManager::Get(m_colorName);
m_color = ColorizeManager::get(m_colorName);
}
/**
@ -83,13 +83,13 @@ void HighlightPattern::ReloadColor(void)
* @eturn
*
*/
void HighlightPattern::Display(void)
void HighlightPattern::display(void)
{
/*
APPL_INFO("patern : \"" << m_paternName << "\" level=" << m_level );
APPL_INFO(" == > colorName \"" << m_colorName << "\"");
APPL_INFO(" ==> regExpStart \"" << m_regExpStart->GetRegExp() << "\"");
APPL_INFO(" ==> regExpStop \"" << m_regExpStop->GetRegExp() << "\"");
APPL_INFO(" == > regExpStart \"" << m_regExpStart->getRegExp() << "\"");
APPL_INFO(" == > regExpStop \"" << m_regExpStop->getRegExp() << "\"");
if (true == m_haveStopPatern) {
APPL_INFO(" == > stop pattern: YES");
} else {
@ -101,10 +101,10 @@ void HighlightPattern::Display(void)
APPL_INFO(" == > multiline pattern: NO");
}
*/
// Display all elements
for (int32_t i=0; i< m_subPatern.Size(); i++) {
APPL_INFO(" " << i << " SubPattern : " << m_subPatern[i]->GetName() );
m_subPatern[i]->Display();
// display all elements
for (int32_t i=0; i< m_subPatern.size(); i++) {
APPL_INFO(" " << i << " subPattern : " << m_subPatern[i]->getName() );
m_subPatern[i]->display();
}
}
void HighlightPattern::ParseRules(exml::Element *child, int32_t level)
@ -120,51 +120,51 @@ void HighlightPattern::ParseRules(exml::Element *child, int32_t level)
*/
//--------------------------------------------------------------------------------------------
// process attribute
etk::UString highLightName = child->GetAttribute("name");
etk::UString highLightName = child->getAttribute("name");
etk::UString myEdnDataTmp = "???";
if (highLightName.Size()!=0) {
if (highLightName.size()!=0) {
myEdnDataTmp = highLightName;
}
SetName(myEdnDataTmp);
SetLevel(level);
setName(myEdnDataTmp);
setLevel(level);
exml::Element* xChild = (exml::Element*)child->GetNamed("color");
exml::Element* xChild = (exml::Element*)child->getNamed("color");
if (NULL != xChild) {
etk::UString myData = xChild->GetText();
if (myData.Size()!=0) {
etk::UString myData = xChild->getText();
if (myData.size()!=0) {
//APPL_INFO(PFX"(l %d) node fined : %s=\"%s\"", xChild->Row(), xChild->Value() , myData);
etk::UString myEdnData = myData;
SetColor(myEdnData);
setColor(myEdnData);
}
}
xChild = (exml::Element*)child->GetNamed("start");
xChild = (exml::Element*)child->getNamed("start");
if (NULL != xChild) {
etk::UString myData = xChild->GetText();
if (myData.Size()!=0) {
etk::UString myData = xChild->getText();
if (myData.size()!=0) {
//APPL_INFO(PFX"(l %d) node fined : %s=\"%s\"", xChild->Row(), xChild->Value() , myData);
etk::UString myEdnData = myData;
SetPaternStart(myEdnData);
setPaternStart(myEdnData);
}
}
xChild = (exml::Element*)child->GetNamed("end");
xChild = (exml::Element*)child->getNamed("end");
if (NULL != xChild) {
etk::UString myData = xChild->GetText();
if (myData.Size()!=0) {
etk::UString myData = xChild->getText();
if (myData.size()!=0) {
//APPL_INFO(PFX"(l %d) node fined : %s=\"%s\"", xChild->Row(), xChild->Value() , myData);
etk::UString myEdnData = myData;
SetPaternStop(myEdnData);
setPaternStop(myEdnData);
}
}
xChild = (exml::Element*)child->GetNamed("EscapeChar");
xChild = (exml::Element*)child->getNamed("EscapeChar");
if (NULL != xChild) {
etk::UString myData = xChild->GetText();
if (myData.Size()!=0) {
etk::UString myData = xChild->getText();
if (myData.size()!=0) {
//APPL_INFO(PFX"(l %d) node fined : %s=\"%s\"", xChild->Row(), xChild->Value() , myData);
etk::UString myEdnData = myData;
SetEscapeChar(myEdnData);
setEscapeChar(myEdnData);
}
}
xChild = (exml::Element*)child->GetNamed("rule");
xChild = (exml::Element*)child->getNamed("rule");
if (NULL != xChild) {
/*
// Create the patern ...
@ -172,7 +172,7 @@ void HighlightPattern::ParseRules(exml::Element *child, int32_t level)
// parse under Element
myPattern->ParseRules(ruleChild, level+1);
// add element in the list
m_subPatern.PushBack(myPattern);
m_subPatern.pushBack(myPattern);
//ParseRules(passChild, m_listHighlightPass1, level1++);
*/
}
@ -180,7 +180,7 @@ void HighlightPattern::ParseRules(exml::Element *child, int32_t level)
/**
* @brief Find Element only in the specify start characters and find the end with the range done
* @brief find Element only in the specify start characters and find the end with the range done
*
* @param[in] start First character to search data (if recognise it start here)
* @param[in] stop End of the possibility whe search can continue
@ -191,7 +191,7 @@ void HighlightPattern::ParseRules(exml::Element *child, int32_t level)
* @return HLP_FIND_OK_NO_END Xe find a partial pattern (missing end)
* @return HLP_FIND_ERROR Not find the pattern
*/
resultFind_te HighlightPattern::Find(int32_t start, int32_t stop, colorInformation_ts &resultat, etk::Buffer &buffer)
resultFind_te HighlightPattern::find(int32_t start, int32_t stop, colorInformation_ts &resultat, etk::Buffer &buffer)
{
//APPL_DEBUG(" try to find the element");
resultat.beginStart = -1;

View File

@ -34,22 +34,22 @@ class HighlightPattern {
HighlightPattern(void);
~HighlightPattern(void);
void SetName(etk::UString &name) { m_paternName = name;};
etk::UString GetName(void) { return m_paternName;};
void setName(etk::UString &name) { m_paternName = name;};
etk::UString getName(void) { return m_paternName;};
void SetPaternStart(etk::UString &regExp);
void SetPaternStop(etk::UString &regExp);
void SetColor(etk::UString &colorName);
void SetEscapeChar(etk::UString &EscapeChar);
void SetMultiline(bool enable) { m_multiline = enable; };
void setPaternStart(etk::UString &regExp);
void setPaternStop(etk::UString &regExp);
void setColor(etk::UString &colorName);
void setEscapeChar(etk::UString &EscapeChar);
void setMultiline(bool enable) { m_multiline = enable; };
void SetLevel(int32_t newLevel) { m_level = newLevel; };
int32_t GetLevel(void) { return m_level; };
void setLevel(int32_t newLevel) { m_level = newLevel; };
int32_t getLevel(void) { return m_level; };
bool IsEnable(void);
void Display(void);
resultFind_te Find(int32_t start, int32_t stop, colorInformation_ts &resultat, etk::Buffer &buffer);
Colorize * GetColor(void) { return m_color; };
bool isEnable(void);
void display(void);
resultFind_te find(int32_t start, int32_t stop, colorInformation_ts &resultat, etk::Buffer &buffer);
Colorize * getColor(void) { return m_color; };
void ParseRules(exml::Element *child, int32_t level);
void ReloadColor(void);

View File

@ -27,18 +27,18 @@ class CTagsManager: public ewol::EObject
CTagsManager(void);
~CTagsManager(void);
const char * const GetObjectType(void)
const char * const getObjectType(void)
{
return "CTagsManager";
};
void OnReceiveMessage(const ewol::EMessage& _msg);
void onReceiveMessage(const ewol::EMessage& _msg);
int32_t m_currentSelectedID;
void LoadTagFile(void);
void loadTagFile(void);
int32_t MultipleJump(void);
void JumpTo(void);
void PrintTag(const tagEntry *entry);
etk::UString GetFolder(etk::UString &inputString);
void printTag(const tagEntry *entry);
etk::UString getFolder(etk::UString &inputString);
etk::UString m_tagFolderBase;
etk::UString m_tagFilename;
tagFile * m_ctagFile;
@ -49,7 +49,7 @@ class CTagsManager: public ewol::EObject
};
static CTagsManager* s_elementPointer = NULL;
void cTagsManager::Init(void)
void cTagsManager::init(void)
{
if (NULL != s_elementPointer) {
s_elementPointer = NULL;
@ -103,66 +103,66 @@ CTagsManager::CTagsManager(void)
CTagsManager::~CTagsManager(void)
{
EWOL_INFO("Ctags manager (Un-INIT)");
if(0 != m_historyList.Size()) {
for (int32_t iii=0; iii< m_historyList.Size(); iii++) {
if(0 != m_historyList.size()) {
for (int32_t iii=0; iii< m_historyList.size(); iii++) {
delete(m_historyList[iii]);
}
m_historyList.Clear();
m_historyList.clear();
}
}
const char * ednEventPopUpCtagsLoadFile = "edn-event-load-ctags";
void CTagsManager::OnReceiveMessage(const ewol::EMessage& _msg)
void CTagsManager::onReceiveMessage(const ewol::EMessage& _msg)
{
//EWOL_INFO("ctags manager event ... : \"" << eventId << "\" == > data=\"" << data << "\"" );
if (_msg.GetMessage() == ednMsgBufferId) {
if (_msg.getMessage() == ednMsgBufferId) {
//m_currentSelectedID = dataID;
} else if( _msg.GetMessage() == ednEventPopUpCtagsLoadFile
|| _msg.GetMessage() == ednMsgCtagsLoadFile) {
} else if( _msg.getMessage() == ednEventPopUpCtagsLoadFile
|| _msg.getMessage() == ednMsgCtagsLoadFile) {
// open the new one :
etk::FSNode tmpFilename = _msg.GetData();
m_tagFilename = tmpFilename.GetNameFile();
m_tagFolderBase = tmpFilename.GetNameFolder();
etk::FSNode tmpFilename = _msg.getData();
m_tagFilename = tmpFilename.getNameFile();
m_tagFolderBase = tmpFilename.getNameFolder();
APPL_DEBUG("Receive load Ctags file : " << m_tagFolderBase << "/" << m_tagFilename << " ");
LoadTagFile();
} else if (_msg.GetMessage() == ednMsgGuiCtags) {
if (_msg.GetData() == "Load") {
loadTagFile();
} else if (_msg.getMessage() == ednMsgGuiCtags) {
if (_msg.getData() == "Load") {
APPL_INFO("Request opening ctag file");
widget::FileChooser* tmpWidget = new widget::FileChooser();
widget::fileChooser* tmpWidget = new widget::FileChooser();
if (NULL == tmpWidget) {
APPL_ERROR("Can not allocate widget == > display might be in error");
} else {
tmpWidget->SetTitle("Open Exuberant Ctags File");
tmpWidget->SetValidateLabel("Open");
ewol::GetContext().GetWindows()->PopUpWidgetPush(tmpWidget);
tmpWidget->RegisterOnEvent(this, ewolEventFileChooserValidate, ednEventPopUpCtagsLoadFile);
tmpWidget->setTitle("Open Exuberant Ctags file");
tmpWidget->setValidateLabel("Open");
ewol::getContext().getWindows()->popUpWidgetPush(tmpWidget);
tmpWidget->registerOnEvent(this, ewolEventFileChooserValidate, ednEventPopUpCtagsLoadFile);
}
} else if (_msg.GetData() == "ReLoad") {
} else if (_msg.getData() == "ReLoad") {
APPL_INFO("Request re-load ctag file");
LoadTagFile();
} else if (_msg.GetData() == "Jump") {
loadTagFile();
} else if (_msg.getData() == "Jump") {
JumpTo();
} else if (_msg.GetData() == "Back") {
if (m_historyList.Size() > 0) {
int32_t id = m_historyList.Size()-1;
SendMultiCast(ednMsgOpenFile, m_historyList[id]->GetName() );
SendMultiCast(ednMsgGuiGotoLine, 0);// TODO : m_historyList[id]->GetLineNumber());
// Remove element ....
} else if (_msg.getData() == "Back") {
if (m_historyList.size() > 0) {
int32_t id = m_historyList.size()-1;
SendMultiCast(ednMsgOpenFile, m_historyList[id]->getName() );
SendMultiCast(ednMsgGuiGotoLine, 0);// TODO : m_historyList[id]->getLineNumber());
// remove element ....
delete(m_historyList[id]);
m_historyList[id]=NULL;
m_historyList.PopBack();
m_historyList.popBack();
}
} else {
}
} else if (_msg.GetMessage() == applEventctagsSelection) {
} else if (_msg.getMessage() == applEventctagsSelection) {
// save the current file in the history
RegisterHistory();
// parse the input data
char tmp[4096];
int32_t lineID;
sscanf(_msg.GetData().c_str(), "%d:%s", &lineID, tmp);
sscanf(_msg.getData().c_str(), "%d:%s", &lineID, tmp);
// generate envents
SendMultiCast(ednMsgOpenFile, tmp);
SendMultiCast(ednMsgGuiGotoLine, lineID - 1);
@ -170,7 +170,7 @@ void CTagsManager::OnReceiveMessage(const ewol::EMessage& _msg)
}
void CTagsManager::LoadTagFile(void)
void CTagsManager::loadTagFile(void)
{
tagFileInfo info;
@ -196,13 +196,13 @@ void CTagsManager::LoadTagFile(void)
void CTagsManager::RegisterHistory(void)
{
APPL_INFO("save curent filename and position : ");
int32_t currentSelected = BufferManager::GetSelected();
BufferText* tmpBuf = BufferManager::Get(currentSelected);
int32_t currentSelected = BufferManager::getSelected();
BufferText* tmpBuf = BufferManager::get(currentSelected);
if (NULL != tmpBuf) {
etk::FSNode * bufferFilename = new etk::FSNode();
*bufferFilename = tmpBuf->GetFileName();
// TODO : bufferFilename->SetLineNumber(tmpBuf->GetCurrentLine());
m_historyList.PushBack(bufferFilename);
*bufferFilename = tmpBuf->getFileName();
// TODO : bufferFilename->setLineNumber(tmpBuf->getCurrentLine());
m_historyList.pushBack(bufferFilename);
}
}
@ -211,9 +211,9 @@ void CTagsManager::JumpTo(void)
{
if (NULL != m_ctagFile) {
// get the middle button of the clipboard == > represent the current selection ...
etk::UString data = ewol::clipBoard::Get(ewol::clipBoard::clipboardSelection);
etk::UString data = ewol::clipBoard::get(ewol::clipBoard::clipboardSelection);
APPL_DEBUG("clipboard data : \"" << data << "\"");
if (data.Size() == 0) {
if (data.size() == 0) {
APPL_INFO("No current selection");
}
tagEntry entry;
@ -226,7 +226,7 @@ void CTagsManager::JumpTo(void)
etk::UString tmpFile(m_tagFolderBase + "/" + entry.file);
etk::FSNode myfile(tmpFile);
int32_t lineID = entry.address.lineNumber;
PrintTag(&entry);
printTag(&entry);
if (tagsFindNext (m_ctagFile, &entry) == TagSuccess) {
APPL_INFO("Multiple file destination ...");
@ -234,21 +234,21 @@ void CTagsManager::JumpTo(void)
if (NULL == tmpWidget) {
APPL_ERROR("Can not allocate widget == > display might be in error");
} else {
tmpWidget->AddCtagsNewItem(myfile.GetName(), lineID);
tmpWidget->addCtagsNewItem(myfile.getName(), lineID);
do {
tmpFile = m_tagFolderBase + "/" + entry.file;
myfile = tmpFile;
lineID = entry.address.lineNumber;
PrintTag(&entry);
tmpWidget->AddCtagsNewItem(myfile.GetName(), lineID);
printTag(&entry);
tmpWidget->addCtagsNewItem(myfile.getName(), lineID);
} while (tagsFindNext (m_ctagFile, &entry) == TagSuccess);
ewol::GetContext().GetWindows()->PopUpWidgetPush(tmpWidget);
tmpWidget->RegisterOnEvent(this, applEventctagsSelection);
ewol::getContext().getWindows()->popUpWidgetPush(tmpWidget);
tmpWidget->registerOnEvent(this, applEventctagsSelection);
}
} else {
RegisterHistory();
APPL_INFO(" OPEN the TAG file Destination : " << tmpFile );
SendMultiCast(ednMsgOpenFile, myfile.GetName());
SendMultiCast(ednMsgOpenFile, myfile.getName());
SendMultiCast(ednMsgGuiGotoLine, lineID - 1);
}
} else {
@ -258,7 +258,7 @@ void CTagsManager::JumpTo(void)
}
void CTagsManager::PrintTag(const tagEntry *entry)
void CTagsManager::printTag(const tagEntry *entry)
{
#if 1
APPL_INFO("find Tag file : name=\"" << entry->name << "\" in file=\"" << entry->file

View File

@ -18,7 +18,7 @@
namespace cTagsManager
{
void Init(void);
void init(void);
void UnInit(void);
};

View File

@ -201,7 +201,7 @@ extern tagResult tagsNext (tagFile *const file, tagEntry *const entry);
extern const char *tagsField (const tagEntry *const entry, const char *const key);
/*
* Find the first tag matching `name'. The structure pointed to by `entry'
* find the first tag matching `name'. The structure pointed to by `entry'
* will be populated with information about the tag file entry. If a tag file
* is sorted using the C locale, a binary search algorithm is used to search
* the tag file, resulting in very fast tag lookups, even in huge tag files.
@ -212,7 +212,7 @@ extern const char *tagsField (const tagEntry *const entry, const char *const key
* Tags whose leading characters match `name' will qualify.
*
* TAG_FULLMATCH
* Only tags whose full lengths match `name' will qualify.
* only tags whose full lengths match `name' will qualify.
*
* TAG_IGNORECASE
* Matching will be performed in a case-insenstive manner. Note that
@ -228,7 +228,7 @@ extern const char *tagsField (const tagEntry *const entry, const char *const key
extern tagResult tagsFind (tagFile *const file, tagEntry *const entry, const char *const name, const int options);
/*
* Find the next tag matching the name and options supplied to the most recent
* find the next tag matching the name and options supplied to the most recent
* call to tagsFind() for the same tag file. The structure pointed to by
* `entry' will be populated with information about the tag file entry. The
* function will return TagSuccess if another tag matching the name is found,

View File

@ -32,40 +32,40 @@ class myParamGlobal : public ewol::EObject
bool m_displaySpaceChar;
public :
myParamGlobal(void) {
m_static = true; // Note : Set the object static notification( Must be set or assert at the end of process)
SetName("edn_global_param");
m_static = true; // Note : set the object static notification( Must be set or assert at the end of process)
setName("edn_global_param");
m_displayEOL=false;
m_AutoIndent = true;
m_displayTabChar = true;
m_displaySpaceChar = true;
RegisterConfig(configEOL, "bool", NULL, "Display end of line character");
RegisterConfig(configAutoIndent, "bool", NULL, "Auto indent when create new line");
RegisterConfig(configShowTabChar, "bool", NULL, "Display the Tab char");
RegisterConfig(configShowSpaceChar, "bool", NULL, "Display the space char");
registerConfig(configEOL, "bool", NULL, "Display end of line character");
registerConfig(configAutoIndent, "bool", NULL, "Auto indent when create new line");
registerConfig(configShowTabChar, "bool", NULL, "Display the Tab char");
registerConfig(configShowSpaceChar, "bool", NULL, "Display the space char");
}
bool OnSetConfig(const ewol::EConfig& _conf)
bool onSetConfig(const ewol::EConfig& _conf)
{
// Not set the EObject node parameter (name == > not change ...)
if (_conf.GetConfig() == configEOL) {
m_displayEOL = _conf.GetData().ToBool();
if (_conf.getConfig() == configEOL) {
m_displayEOL = _conf.getData().toBool();
return true;
}
if (_conf.GetConfig() == configAutoIndent) {
m_AutoIndent = _conf.GetData().ToBool();
if (_conf.getConfig() == configAutoIndent) {
m_AutoIndent = _conf.getData().toBool();
return true;
}
if (_conf.GetConfig() == configShowTabChar) {
m_displayTabChar = _conf.GetData().ToBool();
if (_conf.getConfig() == configShowTabChar) {
m_displayTabChar = _conf.getData().toBool();
return true;
}
if (_conf.GetConfig() == configShowSpaceChar) {
m_displaySpaceChar = _conf.GetData().ToBool();
if (_conf.getConfig() == configShowSpaceChar) {
m_displaySpaceChar = _conf.getData().toBool();
return true;
}
return false;
}
bool OnGetConfig(const char* _config, etk::UString& _result) const
bool onGetConfig(const char* _config, etk::UString& _result) const
{
// Not set the EObject node parameter (name == > not change ...)
if (_config == configEOL) {
@ -117,9 +117,9 @@ static myParamGlobal& l_obj(void)
void globals::Init(void)
void globals::init(void)
{
//ewol::userConfig::AddUserConfig(&l_obj());
//ewol::userConfig::addUserConfig(&l_obj());
}
void globals::UnInit(void)
@ -130,47 +130,47 @@ void globals::UnInit(void)
// -----------------------------------------------------------
bool globals::IsSetDisplayEndOfLine(void)
bool globals::isSetDisplayEndOfLine(void)
{
return l_obj().m_displayEOL;
}
void globals::SetDisplayEndOfLine(bool newVal)
void globals::setDisplayEndOfLine(bool newVal)
{
l_obj().m_displayEOL = newVal;
//ewol::widgetMessageMultiCast::Send(-1, ednMsgUserDisplayChange);
}
// -----------------------------------------------------------
bool globals::IsSetDisplaySpaceChar(void)
bool globals::isSetDisplaySpaceChar(void)
{
return l_obj().m_displaySpaceChar;
}
void globals::SetDisplaySpaceChar(bool newVal)
void globals::setDisplaySpaceChar(bool newVal)
{
l_obj().m_displaySpaceChar = newVal;
//ewol::widgetMessageMultiCast::Send(-1, ednMsgUserDisplayChange);
}
// -----------------------------------------------------------
bool globals::IsSetDisplayTabChar(void)
bool globals::isSetDisplayTabChar(void)
{
return l_obj().m_displayTabChar;
}
void globals::SetDisplayTabChar(bool newVal)
void globals::setDisplayTabChar(bool newVal)
{
l_obj().m_displayTabChar = newVal;
//ewol::widgetMessageMultiCast::Send(-1, ednMsgUserDisplayChange);
}
// -----------------------------------------------------------
bool globals::IsSetAutoIndent(void)
bool globals::isSetAutoIndent(void)
{
return l_obj().m_AutoIndent;
}
void globals::SetAutoIndent(bool newVal)
void globals::setAutoIndent(bool newVal)
{
l_obj().m_AutoIndent = newVal;
}
@ -215,53 +215,53 @@ globals::ParameterGlobalsGui::ParameterGlobalsGui(void) :
if (NULL == mySpacer) {
APPL_ERROR("Can not allocate widget == > display might be in error");
} else {
mySpacer->SetExpand(bvec2(true,true));
SubWidgetAdd(mySpacer);
mySpacer->setExpand(bvec2(true,true));
subWidgetAdd(mySpacer);
}
myCheckbox = new widget::CheckBox("Automatic Indentation");
if (NULL == myCheckbox) {
APPL_ERROR("Can not allocate widget == > display might be in error");
} else {
myCheckbox->SetExpand(bvec2(true,false));
myCheckbox->SetValue(IsSetAutoIndent());
myCheckbox->RegisterOnEvent(this, ewolEventCheckBoxClicked, l_changeIndentation);
SubWidgetAdd(myCheckbox);
myCheckbox->setExpand(bvec2(true,false));
myCheckbox->setValue(isSetAutoIndent());
myCheckbox->registerOnEvent(this, ewolEventCheckBoxClicked, l_changeIndentation);
subWidgetAdd(myCheckbox);
}
myCheckbox = new widget::CheckBox("Display space char (' ')");
if (NULL == myCheckbox) {
APPL_ERROR("Can not allocate widget == > display might be in error");
} else {
myCheckbox->SetExpand(bvec2(true,false));
myCheckbox->SetValue(IsSetDisplaySpaceChar());
myCheckbox->RegisterOnEvent(this, ewolEventCheckBoxClicked, l_changeSpace);
SubWidgetAdd(myCheckbox);
myCheckbox->setExpand(bvec2(true,false));
myCheckbox->setValue(isSetDisplaySpaceChar());
myCheckbox->registerOnEvent(this, ewolEventCheckBoxClicked, l_changeSpace);
subWidgetAdd(myCheckbox);
}
myCheckbox = new widget::CheckBox("Display tabulation char ('\\t')");
if (NULL == myCheckbox) {
APPL_ERROR("Can not allocate widget == > display might be in error");
} else {
myCheckbox->SetExpand(bvec2(true,false));
myCheckbox->SetValue(IsSetDisplayTabChar());
myCheckbox->RegisterOnEvent(this, ewolEventCheckBoxClicked, l_changeTabulation);
SubWidgetAdd(myCheckbox);
myCheckbox->setExpand(bvec2(true,false));
myCheckbox->setValue(isSetDisplayTabChar());
myCheckbox->registerOnEvent(this, ewolEventCheckBoxClicked, l_changeTabulation);
subWidgetAdd(myCheckbox);
}
myCheckbox = new widget::CheckBox("Display end of line ('\\n')");
if (NULL == myCheckbox) {
APPL_ERROR("Can not allocate widget == > display might be in error");
} else {
myCheckbox->SetExpand(bvec2(true,false));
myCheckbox->SetValue(IsSetDisplayEndOfLine());
myCheckbox->RegisterOnEvent(this, ewolEventCheckBoxClicked, l_changeEndOfLine);
SubWidgetAdd(myCheckbox);
myCheckbox->setExpand(bvec2(true,false));
myCheckbox->setValue(isSetDisplayEndOfLine());
myCheckbox->registerOnEvent(this, ewolEventCheckBoxClicked, l_changeEndOfLine);
subWidgetAdd(myCheckbox);
}
myCheckbox = new widget::CheckBox("switch Rounded/default");
if (NULL == myCheckbox) {
APPL_ERROR("Can not allocate widget == > display might be in error");
} else {
myCheckbox->SetExpand(bvec2(true,false));
myCheckbox->SetValue(IsSetDisplayEndOfLine());
myCheckbox->RegisterOnEvent(this, ewolEventCheckBoxClicked, l_changeRounded);
SubWidgetAdd(myCheckbox);
myCheckbox->setExpand(bvec2(true,false));
myCheckbox->setValue(isSetDisplayEndOfLine());
myCheckbox->registerOnEvent(this, ewolEventCheckBoxClicked, l_changeRounded);
subWidgetAdd(myCheckbox);
}
}
@ -271,43 +271,43 @@ globals::ParameterGlobalsGui::~ParameterGlobalsGui(void)
}
void globals::ParameterGlobalsGui::OnReceiveMessage(const ewol::EMessage& _msg)
void globals::ParameterGlobalsGui::onReceiveMessage(const ewol::EMessage& _msg)
{
widget::Sizer::OnReceiveMessage(_msg);
widget::Sizer::onReceiveMessage(_msg);
if (_msg.GetMessage() == l_changeEndOfLine) {
if (_msg.GetData() == "true") {
SetDisplayEndOfLine(true);
if (_msg.getMessage() == l_changeEndOfLine) {
if (_msg.getData() == "true") {
setDisplayEndOfLine(true);
} else {
SetDisplayEndOfLine(false);
setDisplayEndOfLine(false);
}
} else if (_msg.GetMessage() == l_changeIndentation) {
if (_msg.GetData() == "true") {
SetAutoIndent(true);
} else if (_msg.getMessage() == l_changeIndentation) {
if (_msg.getData() == "true") {
setAutoIndent(true);
} else {
SetAutoIndent(false);
setAutoIndent(false);
}
} else if (_msg.GetMessage() == l_changeSpace) {
if (_msg.GetData() == "true") {
SetDisplaySpaceChar(true);
} else if (_msg.getMessage() == l_changeSpace) {
if (_msg.getData() == "true") {
setDisplaySpaceChar(true);
} else {
SetDisplaySpaceChar(false);
setDisplaySpaceChar(false);
}
} else if (_msg.GetMessage() == l_changeTabulation) {
if (_msg.GetData() == "true") {
SetDisplayTabChar(true);
} else if (_msg.getMessage() == l_changeTabulation) {
if (_msg.getData() == "true") {
setDisplayTabChar(true);
} else {
SetDisplayTabChar(false);
setDisplayTabChar(false);
}
} else if (_msg.GetMessage() == l_changeRounded) {
if (_msg.GetData() == "true") {
etk::theme::SetName("GUI", "rounded");;
} else if (_msg.getMessage() == l_changeRounded) {
if (_msg.getData() == "true") {
etk::theme::setName("GUI", "rounded");;
} else {
etk::theme::SetName("GUI", "default");;
etk::theme::setName("GUI", "default");;
}
// Reload shaders and graphic system ...
ewol::GetContext().GetResourcesManager().ReLoadResources();
ewol::GetContext().ForceRedrawAll();
ewol::getContext().getResourcesManager().ReLoadResources();
ewol::getContext().forceRedrawAll();
}
}

View File

@ -15,22 +15,22 @@
namespace globals
{
void Init(void);
void init(void);
void UnInit(void);
int32_t getNbColoneBorder(void);
int32_t getNbLineBorder(void);
bool IsSetDisplayEndOfLine(void);
void SetDisplayEndOfLine(bool newVal);
bool isSetDisplayEndOfLine(void);
void setDisplayEndOfLine(bool newVal);
bool IsSetDisplaySpaceChar(void);
void SetDisplaySpaceChar(bool newVal);
bool isSetDisplaySpaceChar(void);
void setDisplaySpaceChar(bool newVal);
bool IsSetDisplayTabChar(void);
void SetDisplayTabChar(bool newVal);
bool isSetDisplayTabChar(void);
void setDisplayTabChar(bool newVal);
bool IsSetAutoIndent(void);
void SetAutoIndent(bool newVal);
bool isSetAutoIndent(void);
void setAutoIndent(bool newVal);
void init2(void);
@ -42,7 +42,7 @@ namespace globals
ParameterGlobalsGui(void);
~ParameterGlobalsGui(void);
// herited function
virtual void OnReceiveMessage(const ewol::EMessage& _msg);
virtual void onReceiveMessage(const ewol::EMessage& _msg);
};
}

View File

@ -43,44 +43,44 @@ int main(int _argc, const char *_argv[])
/**
* @brief main application function Initialisation
* @brief main application function initialisation
*/
bool APP_Init(ewol::eContext& _context)
{
APPL_INFO("==> Init APPL (START) [" << ewol::GetBoardType() << "] (" << ewol::GetCompilationMode() << ")");
APPL_INFO(" == > init APPL (START) [" << ewol::getBoardType() << "] (" << ewol::GetCompilationMode() << ")");
// TODO : Remove this : Move if in the windows properties
_context.SetSize(vec2(800, 600));
// TODO : remove this : Move if in the windows properties
_context.setSize(vec2(800, 600));
// select internal data for font ...
_context.GetFontDefault().SetUseExternal(true);
_context.getFontDefault().setUseExternal(true);
#ifdef __TARGET_OS__Android
_context.GetFontDefault().Set("FreeSerif", 19);
_context.getFontDefault().set("FreeSerif", 19);
#else
_context.GetFontDefault().Set("FreeSerif;DejaVuSansMono",14);
_context.getFontDefault().set("FreeSerif;DejaVuSansMono",14);
#endif
// set the application icon ...
_context.SetIcon("DATA:icon.png");
_context.setIcon("DATA:icon.png");
// init internal global value
globals::Init();
globals::init();
// init ALL Singleton :
//(void)CTagsManager::getInstance();
BufferManager::Init();
BufferManager::init();
// set color and other trucs...
ColorizeManager::Init();
ColorizeManager::LoadFile( "white" );
ColorizeManager::DisplayListOfColor();
ColorizeManager::init();
ColorizeManager::loadFile( "white" );
ColorizeManager::displayListOfColor();
HighlightManager::Init();
HighlightManager::init();
HighlightManager::loadLanguages();
cTagsManager::Init();
cTagsManager::init();
// Request load of the user configuration ...
//ewol::userConfig::Load();
//ewol::userConfig::load();
char cCurrentPath[FILENAME_MAX];
// get the curent program folder
@ -98,27 +98,27 @@ bool APP_Init(ewol::eContext& _context)
return false;
}
// create the specific windows
_context.SetWindows(basicWindows);
_context.setWindows(basicWindows);
// add files
APPL_INFO("show list of files : ");
bool ctagDetected = false;
for( int32_t iii=0 ; iii<_context.GetCmd().Size(); iii++) {
etk::UString tmpppp = _context.GetCmd().Get(iii);
for( int32_t iii=0 ; iii<_context.getCmd().size(); iii++) {
etk::UString tmpppp = _context.getCmd().Get(iii);
if (tmpppp == "-t") {
ctagDetected = true;
} else if (true == ctagDetected) {
APPL_INFO("Load ctag file : \"" << tmpppp << "\"" );
ctagDetected = false;
_context.GetEObjectManager().MultiCast().AnonymousSend(ednMsgCtagsLoadFile, tmpppp);
_context.getEObjectManager().MultiCast().AnonymousSend(ednMsgCtagsLoadFile, tmpppp);
} else {
APPL_INFO("need load file : \"" << tmpppp << "\"" );
_context.GetEObjectManager().MultiCast().AnonymousSend(ednMsgOpenFile, tmpppp);
_context.getEObjectManager().MultiCast().AnonymousSend(ednMsgOpenFile, tmpppp);
}
}
APPL_INFO("==> Init "PROJECT_NAME" (END)");
APPL_INFO(" == > init "PROJECT_NAME" (END)");
return true;
}
@ -129,9 +129,9 @@ bool APP_Init(ewol::eContext& _context)
void APP_UnInit(ewol::eContext& _context)
{
APPL_INFO(" == > Un-Init "PROJECT_NAME" (START)");
ewol::Windows* tmpWindows = _context.GetWindows();
ewol::Windows* tmpWindows = _context.getWindows();
_context.SetWindows(NULL);
_context.setWindows(NULL);
if (NULL != tmpWindows) {
delete(tmpWindows);