[DEV] coding style review
This commit is contained in:
parent
d677075e16
commit
730f637695
@ -11,36 +11,29 @@
|
|||||||
#include <appl/Debug.h>
|
#include <appl/Debug.h>
|
||||||
|
|
||||||
appl::Buffer::Buffer(void) :
|
appl::Buffer::Buffer(void) :
|
||||||
m_cursorPos(0),
|
m_cursorPos(0),
|
||||||
m_cursorPreferredCol(-1)
|
m_cursorPreferredCol(-1) {
|
||||||
{
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool appl::Buffer::loadFile(const etk::UString& _name)
|
bool appl::Buffer::loadFile(const etk::UString& _name) {
|
||||||
{
|
|
||||||
APPL_DEBUG("Load file : '" << _name << "'");
|
APPL_DEBUG("Load file : '" << _name << "'");
|
||||||
m_fileName = _name;
|
m_fileName = _name;
|
||||||
etk::FSNode file(m_fileName);
|
etk::FSNode file(m_fileName);
|
||||||
if (file.Exist() == false) {
|
if (file.exist() == false) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (true == m_data.DumpFrom(file) ) {
|
if (true == m_data.dumpFrom(file) ) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void appl::Buffer::setFileName(const etk::UString& _name) {
|
||||||
|
|
||||||
void appl::Buffer::setFileName(const etk::UString& _name)
|
|
||||||
{
|
|
||||||
// TODO : ...
|
// TODO : ...
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void appl::Buffer::moveCursorRight(appl::Buffer::moveMode _mode) {
|
||||||
void appl::Buffer::MoveCursorRight(appl::Buffer::moveMode _mode)
|
|
||||||
{
|
|
||||||
m_cursorPreferredCol = -1;
|
m_cursorPreferredCol = -1;
|
||||||
etk::UniChar value;
|
etk::UniChar value;
|
||||||
esize_t nbElement;
|
esize_t nbElement;
|
||||||
@ -62,8 +55,7 @@ void appl::Buffer::MoveCursorRight(appl::Buffer::moveMode _mode)
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void appl::Buffer::MoveCursorLeft(appl::Buffer::moveMode _mode)
|
void appl::Buffer::moveCursorLeft(appl::Buffer::moveMode _mode) {
|
||||||
{
|
|
||||||
m_cursorPreferredCol = -1;
|
m_cursorPreferredCol = -1;
|
||||||
etk::UniChar value;
|
etk::UniChar value;
|
||||||
esize_t nbElement;
|
esize_t nbElement;
|
||||||
@ -84,72 +76,67 @@ void appl::Buffer::MoveCursorLeft(appl::Buffer::moveMode _mode)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void appl::Buffer::MoveCursorUp(esize_t _nbLine)
|
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);
|
esize_t lineStartPos = startLine(m_cursorPos);
|
||||||
// check if we can go up ...
|
// check if we can go up ...
|
||||||
if (lineStartPos == 0) {
|
if (lineStartPos == 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// Decide what column to move to, if there's a preferred column use that
|
// Decide what column to move to, if there's a preferred column use that
|
||||||
if (m_cursorPreferredCol < 0) {
|
if (m_cursorPreferredCol < 0) {
|
||||||
m_cursorPreferredCol = CountDispChars(lineStartPos, m_cursorPos);
|
m_cursorPreferredCol = countDispChars(lineStartPos, m_cursorPos);
|
||||||
}
|
}
|
||||||
EWOL_DEBUG("ploop : " << m_cursorPreferredCol);
|
EWOL_DEBUG("ploop : " << m_cursorPreferredCol);
|
||||||
// get the previous line
|
// get the previous line
|
||||||
esize_t prevLineStartPos = CountBackwardNLines(lineStartPos, _nbLine);
|
esize_t prevLineStartPos = countBackwardNLines(lineStartPos, _nbLine);
|
||||||
//APPL_INFO("Move line UP result : prevLineStartPos=" << prevLineStartPos);
|
//APPL_INFO("Move line UP result : prevLineStartPos=" << prevLineStartPos);
|
||||||
// get the display char position
|
// get the display char position
|
||||||
esize_t newPos = CountForwardDispChars(prevLineStartPos, m_cursorPreferredCol);
|
esize_t newPos = countForwardDispChars(prevLineStartPos, m_cursorPreferredCol);
|
||||||
//APPL_INFO("Move to colomn : column=" << column << " newPos=" << newPos);
|
//APPL_INFO("Move to colomn : column=" << column << " newPos=" << newPos);
|
||||||
//SetInsertPosition(newPos);
|
//SetInsertPosition(newPos);
|
||||||
m_cursorPos = newPos;
|
m_cursorPos = newPos;
|
||||||
}
|
}
|
||||||
|
|
||||||
void appl::Buffer::MoveCursorDown(esize_t _nbLine)
|
void appl::Buffer::moveCursorDown(esize_t _nbLine) {
|
||||||
{
|
|
||||||
// check if we are not at the end of Buffer
|
// check if we are not at the end of Buffer
|
||||||
if (m_cursorPos == m_data.size() ) {
|
if (m_cursorPos == m_data.size() ) {
|
||||||
return;
|
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);
|
esize_t lineStartPos = startLine(m_cursorPos);
|
||||||
|
|
||||||
if (m_cursorPreferredCol < 0) {
|
if (m_cursorPreferredCol < 0) {
|
||||||
m_cursorPreferredCol = CountDispChars(lineStartPos, m_cursorPos);
|
m_cursorPreferredCol = countDispChars(lineStartPos, m_cursorPos);
|
||||||
}
|
}
|
||||||
EWOL_DEBUG("ploop : " << m_cursorPreferredCol);
|
EWOL_DEBUG("ploop : " << m_cursorPreferredCol);
|
||||||
// get the next line :
|
// get the next line :
|
||||||
esize_t nextLineStartPos = CountForwardNLines(lineStartPos, _nbLine);
|
esize_t nextLineStartPos = countForwardNLines(lineStartPos, _nbLine);
|
||||||
//APPL_INFO("Move line DOWN result : nextLineStartPos=" << nextLineStartPos);
|
//APPL_INFO("Move line DOWN result : nextLineStartPos=" << nextLineStartPos);
|
||||||
// get the display char position
|
// get the display char position
|
||||||
esize_t newPos = CountForwardDispChars(nextLineStartPos, m_cursorPreferredCol);
|
esize_t newPos = countForwardDispChars(nextLineStartPos, m_cursorPreferredCol);
|
||||||
//APPL_INFO("Move to colomn : column=" << column << " newPos=" << newPos);
|
//APPL_INFO("Move to colomn : column=" << column << " newPos=" << newPos);
|
||||||
//SetInsertPosition(newPos);
|
//SetInsertPosition(newPos);
|
||||||
m_cursorPos = newPos;
|
m_cursorPos = newPos;
|
||||||
}
|
}
|
||||||
|
|
||||||
esize_t appl::Buffer::StartLine(esize_t _pos)
|
esize_t appl::Buffer::startLine(esize_t _pos) {
|
||||||
{
|
|
||||||
esize_t startPos;
|
esize_t startPos;
|
||||||
if (false == SearchBack(_pos, etk::UniChar::Return, startPos)) {
|
if (false == searchBack(_pos, etk::UniChar::Return, startPos)) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
return startPos + 1;
|
return startPos + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
esize_t appl::Buffer::EndLine(esize_t _pos)
|
esize_t appl::Buffer::endLine(esize_t _pos) {
|
||||||
{
|
|
||||||
esize_t endPos;
|
esize_t endPos;
|
||||||
if (false == Search(_pos, etk::UniChar::Return, endPos)) {
|
if (false == search(_pos, etk::UniChar::Return, endPos)) {
|
||||||
endPos = m_data.size();
|
endPos = m_data.size();
|
||||||
}
|
}
|
||||||
return endPos;
|
return endPos;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool appl::Buffer::Search(esize_t _pos, const etk::UniChar& _search, esize_t& _result)
|
bool appl::Buffer::search(esize_t _pos, const etk::UniChar& _search, esize_t& _result) {
|
||||||
{
|
|
||||||
// move in the string
|
// move in the string
|
||||||
esize_t nbElementBuffer = 0;
|
esize_t nbElementBuffer = 0;
|
||||||
etk::UniChar value;
|
etk::UniChar value;
|
||||||
@ -167,8 +154,7 @@ bool appl::Buffer::Search(esize_t _pos, const etk::UniChar& _search, esize_t& _r
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool appl::Buffer::SearchBack(esize_t _pos, const etk::UniChar& _search, esize_t& _result)
|
bool appl::Buffer::searchBack(esize_t _pos, const etk::UniChar& _search, esize_t& _result) {
|
||||||
{
|
|
||||||
// move in the string
|
// move in the string
|
||||||
esize_t nbElementBuffer = 0;
|
esize_t nbElementBuffer = 0;
|
||||||
etk::UniChar value;
|
etk::UniChar value;
|
||||||
@ -185,10 +171,8 @@ bool appl::Buffer::SearchBack(esize_t _pos, const etk::UniChar& _search, esize_t
|
|||||||
_result = 0;
|
_result = 0;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
// TODO : vec2 _displaySize
|
||||||
|
bool appl::Buffer::onEventEntry(const ewol::EventEntry& _event, ewol::Text& _testDrawer) {
|
||||||
bool appl::Buffer::onEventEntry(const ewol::EventEntry& _event) // TODO : , vec2 _displaySize)
|
|
||||||
{
|
|
||||||
//APPL_DEBUG(" event : " << _event);
|
//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);
|
//APPL_DEBUG("KB EVENT : \"" << UTF8_data << "\" size=" << strlen(UTF8_data) << "type=" << (int32_t)typeEvent);
|
||||||
@ -219,13 +203,13 @@ bool appl::Buffer::onEventEntry(const ewol::EventEntry& _event) // TODO : , vec2
|
|||||||
} else {
|
} else {
|
||||||
// normal adding char ...
|
// normal adding char ...
|
||||||
char output[5];
|
char output[5];
|
||||||
int32_t nbElement = _event.getChar().GetUtf8(output);
|
int32_t nbElement = _event.getChar().getUtf8(output);
|
||||||
if (_event.getSpecialKey().isSetInsert() == false) {
|
if (_event.getSpecialKey().isSetInsert() == false) {
|
||||||
m_data.insert(m_cursorPos, (int8_t*)output, nbElement);
|
m_data.insert(m_cursorPos, (int8_t*)output, nbElement);
|
||||||
} else {
|
} else {
|
||||||
etk::UniChar value;
|
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_data.replace(m_cursorPos, nbElementRemove, (int8_t*)output, nbElement);
|
||||||
}
|
}
|
||||||
m_cursorPos += nbElement;
|
m_cursorPos += nbElement;
|
||||||
}
|
}
|
||||||
@ -238,19 +222,19 @@ bool appl::Buffer::onEventEntry(const ewol::EventEntry& _event) // TODO : , vec2
|
|||||||
switch(_event.getType()) {
|
switch(_event.getType()) {
|
||||||
case ewol::keyEvent::keyboardLeft:
|
case ewol::keyEvent::keyboardLeft:
|
||||||
//APPL_INFO("keyEvent : <LEFT>");
|
//APPL_INFO("keyEvent : <LEFT>");
|
||||||
MoveCursorLeft();
|
moveCursorLeft();
|
||||||
break;
|
break;
|
||||||
case ewol::keyEvent::keyboardRight:
|
case ewol::keyEvent::keyboardRight:
|
||||||
//APPL_INFO("keyEvent : <RIGHT>");
|
//APPL_INFO("keyEvent : <RIGHT>");
|
||||||
MoveCursorRight();
|
moveCursorRight();
|
||||||
break;
|
break;
|
||||||
case ewol::keyEvent::keyboardUp:
|
case ewol::keyEvent::keyboardUp:
|
||||||
//APPL_INFO("keyEvent : <UP>");
|
//APPL_INFO("keyEvent : <UP>");
|
||||||
MoveCursorUp(1);
|
moveCursorUp(1);
|
||||||
break;
|
break;
|
||||||
case ewol::keyEvent::keyboardDown:
|
case ewol::keyEvent::keyboardDown:
|
||||||
//APPL_INFO("keyEvent : <DOWN>");
|
//APPL_INFO("keyEvent : <DOWN>");
|
||||||
MoveCursorDown(1);
|
moveCursorDown(1);
|
||||||
break;
|
break;
|
||||||
case ewol::keyEvent::keyboardPageUp:
|
case ewol::keyEvent::keyboardPageUp:
|
||||||
//APPL_INFO("keyEvent : <PAGE-UP>");
|
//APPL_INFO("keyEvent : <PAGE-UP>");
|
||||||
@ -262,11 +246,11 @@ bool appl::Buffer::onEventEntry(const ewol::EventEntry& _event) // TODO : , vec2
|
|||||||
break;
|
break;
|
||||||
case ewol::keyEvent::keyboardStart:
|
case ewol::keyEvent::keyboardStart:
|
||||||
//APPL_INFO("keyEvent : <Start of line>");
|
//APPL_INFO("keyEvent : <Start of line>");
|
||||||
MoveCursorLeft(moveEnd);
|
moveCursorLeft(moveEnd);
|
||||||
break;
|
break;
|
||||||
case ewol::keyEvent::keyboardEnd:
|
case ewol::keyEvent::keyboardEnd:
|
||||||
//APPL_INFO("keyEvent : <End of line>");
|
//APPL_INFO("keyEvent : <End of line>");
|
||||||
MoveCursorRight(moveEnd);
|
moveCursorRight(moveEnd);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
@ -282,8 +266,7 @@ 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';
|
_value = '\0';
|
||||||
if (_pos<0 && _pos<m_data.size()) {
|
if (_pos<0 && _pos<m_data.size()) {
|
||||||
return 0;
|
return 0;
|
||||||
@ -292,7 +275,7 @@ esize_t appl::Buffer::get(esize_t _pos, etk::UniChar& _value, unicode::charset_t
|
|||||||
char tmpVal[5];
|
char tmpVal[5];
|
||||||
memset(tmpVal, 0, sizeof(tmpVal));
|
memset(tmpVal, 0, sizeof(tmpVal));
|
||||||
tmpVal[0] = m_data[_pos];
|
tmpVal[0] = m_data[_pos];
|
||||||
int8_t nbChar = etk::UniChar::TheoricUTF8Len(tmpVal[0]);
|
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];
|
tmpVal[iii] = m_data[_pos+iii];
|
||||||
}
|
}
|
||||||
@ -305,8 +288,7 @@ esize_t appl::Buffer::get(esize_t _pos, etk::UniChar& _value, unicode::charset_t
|
|||||||
return 1;
|
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';
|
_value = '\0';
|
||||||
if (_pos<0 && _pos<m_data.size()) {
|
if (_pos<0 && _pos<m_data.size()) {
|
||||||
return 0;
|
return 0;
|
||||||
@ -317,7 +299,7 @@ esize_t appl::Buffer::getBack(esize_t _pos, etk::UniChar& _value, unicode::chars
|
|||||||
memset(tmpVal, 0, sizeof(tmpVal));
|
memset(tmpVal, 0, sizeof(tmpVal));
|
||||||
*pointerVal = m_data[_pos];
|
*pointerVal = m_data[_pos];
|
||||||
int32_t iii=0;
|
int32_t iii=0;
|
||||||
while( etk::UniChar::TheoricUTF8First(*pointerVal) == false
|
while( etk::UniChar::theoricUTF8First(*pointerVal) == false
|
||||||
&& pointerVal > tmpVal
|
&& pointerVal > tmpVal
|
||||||
&& _pos-iii>0) {
|
&& _pos-iii>0) {
|
||||||
--pointerVal;
|
--pointerVal;
|
||||||
@ -336,8 +318,7 @@ static const char *ControlCodeTable[32] = {
|
|||||||
"NUL", "soh", "stx", "etx", "eot", "enq", "ack", "bel", "bs", "ht", "nl", "vt", "np", "cr", "so", "si",
|
"NUL", "soh", "stx", "etx", "eot", "enq", "ack", "bel", "bs", "ht", "nl", "vt", "np", "cr", "so", "si",
|
||||||
"dle", "dc1", "dc2", "dc3", "dc4", "nak", "syn", "etb", "can", "em", "sub", "esc", "fs", "gs", "rs", "us"};
|
"dle", "dc1", "dc2", "dc3", "dc4", "nak", "syn", "etb", "can", "em", "sub", "esc", "fs", "gs", "rs", "us"};
|
||||||
|
|
||||||
void appl::Buffer::Expand(esize_t& _indent, const etk::UniChar& _value, etk::UString& _out) const
|
void appl::Buffer::expand(esize_t& _indent, const etk::UniChar& _value, etk::UString& _out) const {
|
||||||
{
|
|
||||||
_out.clear();
|
_out.clear();
|
||||||
int32_t tabDist = 4;
|
int32_t tabDist = 4;
|
||||||
if (_value == etk::UniChar::Tabulation) {
|
if (_value == etk::UniChar::Tabulation) {
|
||||||
@ -383,8 +364,7 @@ void appl::Buffer::Expand(esize_t& _indent, const etk::UniChar& _value, etk::USt
|
|||||||
//APPL_DEBUG("plop : " << _out);
|
//APPL_DEBUG("plop : " << _out);
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t appl::Buffer::CountDispChars(esize_t _posStart, esize_t _posEnd)
|
int32_t appl::Buffer::countDispChars(esize_t _posStart, esize_t _posEnd) {
|
||||||
{
|
|
||||||
int32_t charCount = 0;
|
int32_t charCount = 0;
|
||||||
etk::UString expanded;
|
etk::UString expanded;
|
||||||
esize_t bufferElementSize;
|
esize_t bufferElementSize;
|
||||||
@ -394,7 +374,7 @@ int32_t appl::Buffer::CountDispChars(esize_t _posStart, esize_t _posEnd)
|
|||||||
// get the element value:
|
// get the element value:
|
||||||
bufferElementSize = get(iii, value);
|
bufferElementSize = get(iii, value);
|
||||||
//APPL_DEBUG(" get : " << value << " size=" << bufferElementSize);
|
//APPL_DEBUG(" get : " << value << " size=" << bufferElementSize);
|
||||||
Expand(charCount, value, expanded);
|
expand(charCount, value, expanded);
|
||||||
charCount += expanded.size();
|
charCount += expanded.size();
|
||||||
if (bufferElementSize <= 0) {
|
if (bufferElementSize <= 0) {
|
||||||
bufferElementSize = 1;
|
bufferElementSize = 1;
|
||||||
@ -404,8 +384,7 @@ int32_t appl::Buffer::CountDispChars(esize_t _posStart, esize_t _posEnd)
|
|||||||
return charCount;
|
return charCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
esize_t appl::Buffer::CountForwardDispChars(esize_t _posStart, int32_t _nChars)
|
esize_t appl::Buffer::countForwardDispChars(esize_t _posStart, int32_t _nChars) {
|
||||||
{
|
|
||||||
int32_t charCount = 0;
|
int32_t charCount = 0;
|
||||||
etk::UString expanded;
|
etk::UString expanded;
|
||||||
esize_t bufferElementSize;
|
esize_t bufferElementSize;
|
||||||
@ -417,7 +396,7 @@ esize_t appl::Buffer::CountForwardDispChars(esize_t _posStart, int32_t _nChars)
|
|||||||
if (value == etk::UniChar::Return) {
|
if (value == etk::UniChar::Return) {
|
||||||
return iii;
|
return iii;
|
||||||
}
|
}
|
||||||
Expand(charCount, value, expanded);
|
expand(charCount, value, expanded);
|
||||||
charCount += expanded.size();
|
charCount += expanded.size();
|
||||||
if (bufferElementSize <= 0) {
|
if (bufferElementSize <= 0) {
|
||||||
bufferElementSize = 1;
|
bufferElementSize = 1;
|
||||||
@ -427,8 +406,7 @@ esize_t appl::Buffer::CountForwardDispChars(esize_t _posStart, int32_t _nChars)
|
|||||||
return iii;
|
return iii;
|
||||||
}
|
}
|
||||||
|
|
||||||
esize_t appl::Buffer::CountForwardNLines(esize_t _startPos, int32_t _nLines)
|
esize_t appl::Buffer::countForwardNLines(esize_t _startPos, int32_t _nLines) {
|
||||||
{
|
|
||||||
if (_nLines <= 0) {
|
if (_nLines <= 0) {
|
||||||
return _startPos;
|
return _startPos;
|
||||||
} else if (_startPos > m_data.size() ) {
|
} else if (_startPos > m_data.size() ) {
|
||||||
@ -456,8 +434,7 @@ esize_t appl::Buffer::CountForwardNLines(esize_t _startPos, int32_t _nLines)
|
|||||||
return m_data.size();
|
return m_data.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
esize_t appl::Buffer::CountBackwardNLines(esize_t _startPos, int32_t _nLines)
|
esize_t appl::Buffer::countBackwardNLines(esize_t _startPos, int32_t _nLines) {
|
||||||
{
|
|
||||||
if (_startPos <= 0) {
|
if (_startPos <= 0) {
|
||||||
return 0;
|
return 0;
|
||||||
} else if (_startPos > m_data.size() ) {
|
} else if (_startPos > m_data.size() ) {
|
||||||
|
@ -16,11 +16,10 @@
|
|||||||
#include <etk/Buffer.h>
|
#include <etk/Buffer.h>
|
||||||
#include <ewol/renderer/EObject.h>
|
#include <ewol/renderer/EObject.h>
|
||||||
#include <ewol/widget/Widget.h>
|
#include <ewol/widget/Widget.h>
|
||||||
|
#include <ewol/compositing/Text.h>
|
||||||
|
|
||||||
namespace appl
|
namespace appl {
|
||||||
{
|
class Buffer : public ewol::EObject {
|
||||||
class Buffer : public ewol::EObject
|
|
||||||
{
|
|
||||||
public:
|
public:
|
||||||
Buffer(void);
|
Buffer(void);
|
||||||
~Buffer(void) { };
|
~Buffer(void) { };
|
||||||
@ -30,13 +29,17 @@ namespace appl
|
|||||||
/**
|
/**
|
||||||
* @brief get the curent filename of the Buffer
|
* @brief get the curent filename of the Buffer
|
||||||
*/
|
*/
|
||||||
const etk::UString& getFileName(void) { return m_fileName; }
|
const etk::UString& getFileName(void) {
|
||||||
|
return m_fileName;
|
||||||
|
}
|
||||||
bool loadFile(const etk::UString& _name);
|
bool loadFile(const etk::UString& _name);
|
||||||
void setFileName(const etk::UString& _name);
|
void setFileName(const etk::UString& _name);
|
||||||
bool m_isModify; //!< true if the file is modify
|
bool m_isModify; //!< true if the file is modify
|
||||||
etk::Buffer m_data; //!< copy of the file buffer
|
etk::Buffer m_data; //!< copy of the file buffer
|
||||||
public:
|
public:
|
||||||
etk::Buffer& getData(void) { return m_data; };
|
etk::Buffer& getData(void) {
|
||||||
|
return m_data;
|
||||||
|
};
|
||||||
/*
|
/*
|
||||||
appl::History m_history;
|
appl::History m_history;
|
||||||
Highlight m_highlight;
|
Highlight m_highlight;
|
||||||
@ -46,7 +49,8 @@ namespace appl
|
|||||||
public:
|
public:
|
||||||
esize_t m_cursorPos; //!< cursor position.
|
esize_t m_cursorPos; //!< cursor position.
|
||||||
int32_t m_cursorPreferredCol; //!< position of the cursor when up and down is done.
|
int32_t m_cursorPreferredCol; //!< position of the cursor when up and down is done.
|
||||||
bool onEventEntry(const ewol::EventEntry& _event);
|
// note : We need the text drawer interface due to the fact that the move depend on the text display properties.
|
||||||
|
bool onEventEntry(const ewol::EventEntry& _event, ewol::Text& _testDrawer);
|
||||||
/**
|
/**
|
||||||
* @brief get the next element in the buffer.
|
* @brief get the next element in the buffer.
|
||||||
* @param[in] _pos Position in the buffer
|
* @param[in] _pos Position in the buffer
|
||||||
@ -69,7 +73,7 @@ namespace appl
|
|||||||
* @param[in] _value Current value to transform
|
* @param[in] _value Current value to transform
|
||||||
* @param[out] _out String that represent the curent value to display
|
* @param[out] _out String that represent the curent value to display
|
||||||
*/
|
*/
|
||||||
void Expand(esize_t& _indent, const etk::UniChar& _value, etk::UString& _out) const;
|
void expand(esize_t& _indent, const etk::UniChar& _value, etk::UString& _out) const;
|
||||||
private:
|
private:
|
||||||
enum moveMode {
|
enum moveMode {
|
||||||
moveLetter,
|
moveLetter,
|
||||||
@ -80,34 +84,34 @@ namespace appl
|
|||||||
* Move the cursor right in the line (no stop of a new line)
|
* Move the cursor right in the line (no stop of a new line)
|
||||||
* @param[in] _mode Moving mode char, word, ...
|
* @param[in] _mode Moving mode char, word, ...
|
||||||
*/
|
*/
|
||||||
void MoveCursorRight(moveMode _mode = moveLetter);
|
void moveCursorRight(moveMode _mode = moveLetter);
|
||||||
/**
|
/**
|
||||||
* Move the cursor left in the line (no stop of a new line)
|
* Move the cursor left in the line (no stop of a new line)
|
||||||
* @param[in] _mode Moving mode char, word, ...
|
* @param[in] _mode Moving mode char, word, ...
|
||||||
*/
|
*/
|
||||||
void MoveCursorLeft(moveMode _mode = moveLetter);
|
void moveCursorLeft(moveMode _mode = moveLetter);
|
||||||
/**
|
/**
|
||||||
* @brief Move the cursor at an other position upper.
|
* @brief Move the cursor at an other position upper.
|
||||||
* @param[in] _nbLine number of up line that might be moved
|
* @param[in] _nbLine number of up line that might be moved
|
||||||
*/
|
*/
|
||||||
void MoveCursorUp(esize_t _nbLine);
|
void moveCursorUp(esize_t _nbLine);
|
||||||
/**
|
/**
|
||||||
* @brief Move the cursor at an other position under.
|
* @brief Move the cursor at an other position under.
|
||||||
* @param[in] _nbLine number of down line that might be moved
|
* @param[in] _nbLine number of down line that might be moved
|
||||||
*/
|
*/
|
||||||
void MoveCursorDown(esize_t _nbLine);
|
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.
|
* @param[in] _pos position in the buffer.
|
||||||
* @return The position in the buffer of the start of the line.
|
* @return The position in the buffer of the start of the line.
|
||||||
*/
|
*/
|
||||||
esize_t StartLine(esize_t _pos);
|
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.
|
* @param[in] _pos position in the buffer.
|
||||||
* @return The position in the buffer of the end of the line.
|
* @return The position in the buffer of the end of the line.
|
||||||
*/
|
*/
|
||||||
esize_t EndLine(esize_t _pos);
|
esize_t endLine(esize_t _pos);
|
||||||
/**
|
/**
|
||||||
* @brief Search a character in the buffer.
|
* @brief Search a character in the buffer.
|
||||||
* @param[in] _pos Position to start the search of the element.
|
* @param[in] _pos Position to start the search of the element.
|
||||||
@ -115,7 +119,7 @@ namespace appl
|
|||||||
* @param[out] _result Research position.
|
* @param[out] _result Research position.
|
||||||
* @return true if pos if fined.
|
* @return true if pos if fined.
|
||||||
*/
|
*/
|
||||||
bool Search(esize_t _pos, const etk::UniChar& _search, esize_t& _result);
|
bool search(esize_t _pos, const etk::UniChar& _search, esize_t& _result);
|
||||||
/**
|
/**
|
||||||
* @brief Search a character in the buffer in back mode.
|
* @brief Search a character in the buffer in back mode.
|
||||||
* @param[in] _pos Position to start the search of the element.
|
* @param[in] _pos Position to start the search of the element.
|
||||||
@ -123,7 +127,7 @@ namespace appl
|
|||||||
* @param[out] _result Research position.
|
* @param[out] _result Research position.
|
||||||
* @return true if pos if fined.
|
* @return true if pos if fined.
|
||||||
*/
|
*/
|
||||||
bool SearchBack(esize_t _pos, const etk::UniChar& _search, esize_t& _result);
|
bool searchBack(esize_t _pos, const etk::UniChar& _search, esize_t& _result);
|
||||||
/**
|
/**
|
||||||
* @brief Count the number of displayed characters between buffer position
|
* @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
|
||||||
@ -132,28 +136,28 @@ namespace appl
|
|||||||
* @param[in] _posEnd End position
|
* @param[in] _posEnd End position
|
||||||
* @return the ID in the buffer of the requested char
|
* @return the ID in the buffer of the requested char
|
||||||
*/
|
*/
|
||||||
int32_t CountDispChars(esize_t _posStart, esize_t _posEnd);
|
int32_t countDispChars(esize_t _posStart, esize_t _posEnd);
|
||||||
/**
|
/**
|
||||||
* @brief Return the position of the nth diplaye char
|
* @brief Return the position of the nth diplaye char
|
||||||
* @param[in] _posStart Position of the start
|
* @param[in] _posStart Position of the start
|
||||||
* @param[in] _nChars search in the next nChars elements
|
* @param[in] _nChars search in the next nChars elements
|
||||||
* @return position of the char i the buffer
|
* @return position of the char i the buffer
|
||||||
*/
|
*/
|
||||||
esize_t CountForwardDispChars(esize_t _posStart, int32_t _nChars);
|
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] _startPos Start position.
|
||||||
* @param[in,out] _nLines Number of line to count.
|
* @param[in,out] _nLines Number of line to count.
|
||||||
* @return position of the starting the line.
|
* @return position of the starting the line.
|
||||||
*/
|
*/
|
||||||
esize_t CountForwardNLines(esize_t _startPos, int32_t _nLines);
|
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] _startPos Start position to count (this caracter is not counted)
|
||||||
* @param[in,out] _nLines Number of line to count (if == 0 means find the beginning of the line)
|
* @param[in,out] _nLines Number of line to count (if == 0 means find the beginning of the line)
|
||||||
* @return position of the starting the line
|
* @return position of the starting the line
|
||||||
*/
|
*/
|
||||||
esize_t CountBackwardNLines(esize_t _startPos, int32_t _nLines);
|
esize_t countBackwardNLines(esize_t _startPos, int32_t _nLines);
|
||||||
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
@ -14,9 +14,8 @@
|
|||||||
|
|
||||||
#undef __class__
|
#undef __class__
|
||||||
#define __class__ "classBufferManager"
|
#define __class__ "classBufferManager"
|
||||||
|
#if 0
|
||||||
class classBufferManager: public ewol::EObject
|
class classBufferManager: public ewol::EObject {
|
||||||
{
|
|
||||||
public:
|
public:
|
||||||
// Constructeur
|
// Constructeur
|
||||||
classBufferManager(void);
|
classBufferManager(void);
|
||||||
@ -30,7 +29,7 @@ class classBufferManager: public ewol::EObject
|
|||||||
private:
|
private:
|
||||||
// return the ID of the buffer allocated
|
// return the ID of the buffer allocated
|
||||||
// create a buffer with no element
|
// create a buffer with no element
|
||||||
int32_t Create(void);
|
int32_t create(void);
|
||||||
// open curent filename
|
// open curent filename
|
||||||
int32_t open(etk::FSNode &myFile);
|
int32_t open(etk::FSNode &myFile);
|
||||||
bool remove(int32_t BufferID);
|
bool remove(int32_t BufferID);
|
||||||
@ -38,13 +37,13 @@ class classBufferManager: public ewol::EObject
|
|||||||
int32_t getSelected(void) { return m_idSelected;};
|
int32_t getSelected(void) { return m_idSelected;};
|
||||||
//void setSelected(int32_t id) {m_idSelected = id;};
|
//void setSelected(int32_t id) {m_idSelected = id;};
|
||||||
BufferText* get(int32_t BufferID);
|
BufferText* get(int32_t BufferID);
|
||||||
bool Exist(int32_t BufferID);
|
bool exist(int32_t BufferID);
|
||||||
bool Exist(etk::FSNode &myFile);
|
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
|
// return the number of buffer (open in the past) if 5 buffer open and 4 close == > return 5
|
||||||
uint32_t size(void);
|
uint32_t size(void);
|
||||||
uint32_t sizeOpen(void);
|
uint32_t sizeOpen(void);
|
||||||
int32_t WitchBuffer(int32_t iEmeElement);
|
int32_t witchBuffer(int32_t iEmeElement);
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@ -234,22 +233,7 @@ void classBufferManager::onReceiveMessage(const ewol::EMessage& _msg)
|
|||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void classBufferManager::removeAll(void) {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief remove all buffer opened
|
|
||||||
*
|
|
||||||
* @param[in,out] ---
|
|
||||||
*
|
|
||||||
* @return ---
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
void classBufferManager::removeAll(void)
|
|
||||||
{
|
|
||||||
int32_t i;
|
int32_t i;
|
||||||
for (i=0; i<listBuffer.size(); i++) {
|
for (i=0; i<listBuffer.size(); i++) {
|
||||||
remove(i);
|
remove(i);
|
||||||
@ -261,14 +245,9 @@ void classBufferManager::removeAll(void)
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Create a new buffer with no name and empty
|
* @brief Create a new buffer with no name and empty
|
||||||
*
|
|
||||||
* @param[in,out] ---
|
|
||||||
*
|
|
||||||
* @return The ID of the curent buffer where the file is loaded
|
* @return The ID of the curent buffer where the file is loaded
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
int32_t classBufferManager::Create(void)
|
int32_t classBufferManager::create(void) {
|
||||||
{
|
|
||||||
// allocate a new Buffer
|
// allocate a new Buffer
|
||||||
BufferText *myBuffer = new BufferText();
|
BufferText *myBuffer = new BufferText();
|
||||||
// add at the list of element
|
// add at the list of element
|
||||||
@ -280,17 +259,12 @@ int32_t classBufferManager::Create(void)
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief open a file with the name set in parameters
|
* @brief open a file with the name set in parameters
|
||||||
*
|
* @param[in] filename curent filename
|
||||||
* @param[in] filename curent filename
|
|
||||||
*
|
|
||||||
* @return The ID of the curent buffer where the file is loaded
|
* @return The ID of the curent buffer where the file is loaded
|
||||||
*
|
|
||||||
* @todo : check if this file is not curently open and return the old ID
|
* @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)) {
|
||||||
if (false == Exist(myFile)) {
|
|
||||||
// allocate a new Buffer
|
// allocate a new Buffer
|
||||||
BufferText *myBuffer = new BufferText(myFile);
|
BufferText *myBuffer = new BufferText(myFile);
|
||||||
// add at the list of element
|
// add at the list of element
|
||||||
@ -302,10 +276,7 @@ int32_t classBufferManager::open(etk::FSNode &myFile)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
BufferText * classBufferManager::get(int32_t BufferID) {
|
||||||
|
|
||||||
BufferText * classBufferManager::get(int32_t BufferID)
|
|
||||||
{
|
|
||||||
// possible special case : -1;
|
// possible special case : -1;
|
||||||
if (-1 >= BufferID) {
|
if (-1 >= BufferID) {
|
||||||
return NULL;
|
return NULL;
|
||||||
@ -324,9 +295,7 @@ BufferText * classBufferManager::get(int32_t BufferID)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool classBufferManager::exist(int32_t BufferID) {
|
||||||
bool classBufferManager::Exist(int32_t BufferID)
|
|
||||||
{
|
|
||||||
if (-1 >= BufferID) {
|
if (-1 >= BufferID) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -340,18 +309,14 @@ bool classBufferManager::Exist(int32_t BufferID)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool classBufferManager::exist(etk::FSNode &myFile) {
|
||||||
bool classBufferManager::Exist(etk::FSNode &myFile )
|
|
||||||
{
|
|
||||||
if (-1 == getId(myFile)) {
|
if (-1 == getId(myFile)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int32_t classBufferManager::getId(etk::FSNode &myFile) {
|
||||||
int32_t classBufferManager::getId(etk::FSNode &myFile)
|
|
||||||
{
|
|
||||||
int32_t iii;
|
int32_t iii;
|
||||||
// check if the Buffer existed
|
// check if the Buffer existed
|
||||||
for (iii=0; iii < listBuffer.size(); iii++) {
|
for (iii=0; iii < listBuffer.size(); iii++) {
|
||||||
@ -367,14 +332,12 @@ 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
|
// 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 ...
|
// nb of opens file Now ...
|
||||||
uint32_t classBufferManager::sizeOpen(void)
|
uint32_t classBufferManager::sizeOpen(void) {
|
||||||
{
|
|
||||||
uint32_t jjj = 0;
|
uint32_t jjj = 0;
|
||||||
// check if the Buffer existed
|
// check if the Buffer existed
|
||||||
for (int32_t iii=0; iii<listBuffer.size(); iii++) {
|
for (int32_t iii=0; iii<listBuffer.size(); iii++) {
|
||||||
@ -386,16 +349,7 @@ uint32_t classBufferManager::sizeOpen(void)
|
|||||||
return jjj;
|
return jjj;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
bool classBufferManager::remove(int32_t BufferID) {
|
||||||
* @brief
|
|
||||||
*
|
|
||||||
* @param[in,out] ---
|
|
||||||
*
|
|
||||||
* @return ---
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
bool classBufferManager::remove(int32_t BufferID)
|
|
||||||
{
|
|
||||||
if (-1 >= BufferID) {
|
if (-1 >= BufferID) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -427,15 +381,9 @@ bool classBufferManager::remove(int32_t BufferID)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief to get the element 14 in the buffer
|
* @brief to get the element 14 in the buffer
|
||||||
*
|
|
||||||
* @param[in,out] ---
|
|
||||||
*
|
|
||||||
* @return ---
|
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
int32_t classBufferManager::WitchBuffer(int32_t iEmeElement)
|
int32_t classBufferManager::witchBuffer(int32_t iEmeElement) {
|
||||||
{
|
|
||||||
int32_t i;
|
int32_t i;
|
||||||
for (i=0; i<listBuffer.size(); i++) {
|
for (i=0; i<listBuffer.size(); i++) {
|
||||||
if (NULL != listBuffer[i]) {
|
if (NULL != listBuffer[i]) {
|
||||||
@ -455,9 +403,9 @@ int32_t classBufferManager::WitchBuffer(int32_t iEmeElement)
|
|||||||
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
static classBufferManager * localManager = NULL;
|
static classBufferManager * localManager = NULL;
|
||||||
|
#endif
|
||||||
void BufferManager::init(void)
|
void BufferManager::init(void) {
|
||||||
{
|
/*
|
||||||
if (NULL != localManager) {
|
if (NULL != localManager) {
|
||||||
EWOL_ERROR("classBufferManager == > already exist, just unlink the previous ...");
|
EWOL_ERROR("classBufferManager == > already exist, just unlink the previous ...");
|
||||||
localManager = NULL;
|
localManager = NULL;
|
||||||
@ -467,88 +415,106 @@ void BufferManager::init(void)
|
|||||||
if (NULL == localManager) {
|
if (NULL == localManager) {
|
||||||
EWOL_CRITICAL("Allocation of classBufferManager not done ...");
|
EWOL_CRITICAL("Allocation of classBufferManager not done ...");
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
void BufferManager::UnInit(void)
|
void BufferManager::unInit(void) {
|
||||||
{
|
/*
|
||||||
if (NULL == localManager) {
|
if (NULL == localManager) {
|
||||||
EWOL_ERROR("classBufferManager == > request UnInit, but does not exist ...");
|
EWOL_ERROR("classBufferManager == > request UnInit, but does not exist ...");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
delete(localManager);
|
delete(localManager);
|
||||||
localManager = NULL;
|
localManager = NULL;
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t BufferManager::getSelected(void)
|
int32_t BufferManager::getSelected(void) {
|
||||||
{
|
/*
|
||||||
if (NULL == localManager) {
|
if (NULL == localManager) {
|
||||||
EWOL_ERROR("classBufferManager == > request UnInit, but does not exist ...");
|
EWOL_ERROR("classBufferManager == > request UnInit, but does not exist ...");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
return localManager->getSelected();
|
return localManager->getSelected();
|
||||||
|
*/
|
||||||
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
BufferText * BufferManager::get(int32_t BufferID)
|
appl::Buffer * BufferManager::get(int32_t BufferID) {
|
||||||
{
|
/*
|
||||||
if (NULL == localManager) {
|
if (NULL == localManager) {
|
||||||
EWOL_ERROR("classBufferManager == > request UnInit, but does not exist ...");
|
EWOL_ERROR("classBufferManager == > request UnInit, but does not exist ...");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
return localManager->get(BufferID);
|
return localManager->get(BufferID);
|
||||||
|
*/
|
||||||
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool BufferManager::Exist(int32_t BufferID)
|
bool BufferManager::exist(int32_t BufferID) {
|
||||||
{
|
/*
|
||||||
if (NULL == localManager) {
|
if (NULL == localManager) {
|
||||||
EWOL_ERROR("classBufferManager == > request UnInit, but does not exist ...");
|
EWOL_ERROR("classBufferManager == > request UnInit, but does not exist ...");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return localManager->Exist(BufferID);
|
return localManager->exist(BufferID);
|
||||||
|
*/
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool BufferManager::Exist(etk::FSNode &myFile)
|
bool BufferManager::exist(etk::FSNode &myFile) {
|
||||||
{
|
/*
|
||||||
if (NULL == localManager) {
|
if (NULL == localManager) {
|
||||||
EWOL_ERROR("classBufferManager == > request UnInit, but does not exist ...");
|
EWOL_ERROR("classBufferManager == > request UnInit, but does not exist ...");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return localManager->Exist(myFile);
|
return localManager->exist(myFile);
|
||||||
|
*/
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t BufferManager::getId(etk::FSNode &myFile)
|
int32_t BufferManager::getId(etk::FSNode &myFile) {
|
||||||
{
|
/*
|
||||||
if (NULL == localManager) {
|
if (NULL == localManager) {
|
||||||
EWOL_ERROR("classBufferManager == > request UnInit, but does not exist ...");
|
EWOL_ERROR("classBufferManager == > request UnInit, but does not exist ...");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
return localManager->getId(myFile);
|
return localManager->getId(myFile);
|
||||||
|
*/
|
||||||
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t BufferManager::size(void)
|
uint32_t BufferManager::size(void) {
|
||||||
{
|
/*
|
||||||
if (NULL == localManager) {
|
if (NULL == localManager) {
|
||||||
EWOL_ERROR("classBufferManager == > request UnInit, but does not exist ...");
|
EWOL_ERROR("classBufferManager == > request UnInit, but does not exist ...");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
return localManager->size();
|
return localManager->size();
|
||||||
|
*/
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t BufferManager::sizeOpen(void)
|
uint32_t BufferManager::sizeOpen(void) {
|
||||||
{
|
/*
|
||||||
if (NULL == localManager) {
|
if (NULL == localManager) {
|
||||||
EWOL_ERROR("classBufferManager == > request UnInit, but does not exist ...");
|
EWOL_ERROR("classBufferManager == > request UnInit, but does not exist ...");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
return localManager->sizeOpen();
|
return localManager->sizeOpen();
|
||||||
|
*/
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t BufferManager::WitchBuffer(int32_t iEmeElement)
|
int32_t BufferManager::witchBuffer(int32_t iEmeElement) {
|
||||||
{
|
/*
|
||||||
if (NULL == localManager) {
|
if (NULL == localManager) {
|
||||||
EWOL_ERROR("classBufferManager == > request UnInit, but does not exist ...");
|
EWOL_ERROR("classBufferManager == > request UnInit, but does not exist ...");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
return localManager->WitchBuffer(iEmeElement);
|
return localManager->witchBuffer(iEmeElement);
|
||||||
|
*/
|
||||||
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -9,23 +9,23 @@
|
|||||||
#ifndef __BUFFER_MANAGER_H__
|
#ifndef __BUFFER_MANAGER_H__
|
||||||
#define __BUFFER_MANAGER_H__
|
#define __BUFFER_MANAGER_H__
|
||||||
|
|
||||||
#include <BufferText.h>
|
#include <Buffer.h>
|
||||||
#include <appl/globalMsg.h>
|
#include <appl/globalMsg.h>
|
||||||
#include <ewol/widget/Widget.h>
|
#include <ewol/widget/Widget.h>
|
||||||
|
|
||||||
namespace BufferManager
|
namespace BufferManager
|
||||||
{
|
{
|
||||||
void init(void);
|
void init(void);
|
||||||
void UnInit(void);
|
void unInit(void);
|
||||||
int32_t getSelected(void);
|
int32_t getSelected(void);
|
||||||
BufferText* get(int32_t BufferID);
|
appl::Buffer* get(int32_t BufferID);
|
||||||
bool Exist(int32_t BufferID);
|
bool exist(int32_t BufferID);
|
||||||
bool Exist(etk::FSNode &myFile);
|
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
|
// return the number of buffer (open in the past) if 5 buffer open and 4 close == > return 5
|
||||||
uint32_t size(void);
|
uint32_t size(void);
|
||||||
uint32_t sizeOpen(void);
|
uint32_t sizeOpen(void);
|
||||||
int32_t WitchBuffer(int32_t iEmeElement);
|
int32_t witchBuffer(int32_t iEmeElement);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -16,8 +16,7 @@
|
|||||||
|
|
||||||
#define PFX "ColorizeManager "
|
#define PFX "ColorizeManager "
|
||||||
|
|
||||||
class classColorManager: public ewol::EObject
|
class classColorManager: public ewol::EObject {
|
||||||
{
|
|
||||||
private:
|
private:
|
||||||
etk::UString m_fileColor;
|
etk::UString m_fileColor;
|
||||||
etk::Vector<Colorize*> listMyColor; //!< List of ALL Color
|
etk::Vector<Colorize*> listMyColor; //!< List of ALL Color
|
||||||
@ -26,12 +25,10 @@ class classColorManager: public ewol::EObject
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
// Constructeur
|
// Constructeur
|
||||||
classColorManager(void)
|
classColorManager(void) {
|
||||||
{
|
|
||||||
//ewol::widgetMessageMultiCast::add(getWidgetId(), ednMsgGuiChangeColor);
|
//ewol::widgetMessageMultiCast::add(getWidgetId(), ednMsgGuiChangeColor);
|
||||||
}
|
}
|
||||||
~classColorManager(void)
|
~classColorManager(void) {
|
||||||
{
|
|
||||||
delete(errorColor);
|
delete(errorColor);
|
||||||
|
|
||||||
int32_t i;
|
int32_t i;
|
||||||
@ -46,12 +43,10 @@ class classColorManager: public ewol::EObject
|
|||||||
listMyColor.clear();
|
listMyColor.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
const char * const getObjectType(void)
|
const char * const getObjectType(void) {
|
||||||
{
|
|
||||||
return "Appl::ColorManager";
|
return "Appl::ColorManager";
|
||||||
}
|
}
|
||||||
void onReceiveMessage(const ewol::EMessage& _msg)
|
void onReceiveMessage(const ewol::EMessage& _msg) {
|
||||||
{
|
|
||||||
/*
|
/*
|
||||||
switch (id)
|
switch (id)
|
||||||
{
|
{
|
||||||
@ -68,8 +63,7 @@ class classColorManager: public ewol::EObject
|
|||||||
}
|
}
|
||||||
public:
|
public:
|
||||||
void loadFile(const etk::UString& _xmlFilename);
|
void loadFile(const etk::UString& _xmlFilename);
|
||||||
Colorize* get(const etk::UString& _colorName)
|
Colorize* get(const etk::UString& _colorName) {
|
||||||
{
|
|
||||||
int32_t i;
|
int32_t i;
|
||||||
for (i=0; i<listMyColor.size(); i++) {
|
for (i=0; i<listMyColor.size(); i++) {
|
||||||
if (listMyColor[i]->getName() == _colorName) {
|
if (listMyColor[i]->getName() == _colorName) {
|
||||||
@ -80,16 +74,14 @@ class classColorManager: public ewol::EObject
|
|||||||
// an error
|
// an error
|
||||||
return errorColor;
|
return errorColor;
|
||||||
}
|
}
|
||||||
etk::Color<>& get(basicColor_te _myColor)
|
etk::Color<>& get(basicColor_te _myColor) {
|
||||||
{
|
|
||||||
if (_myColor < COLOR_NUMBER_MAX) {
|
if (_myColor < COLOR_NUMBER_MAX) {
|
||||||
return basicColors[_myColor];
|
return basicColors[_myColor];
|
||||||
} else {
|
} else {
|
||||||
return basicColors[0];
|
return basicColors[0];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
bool Exist(const etk::UString& _colorName)
|
bool exist(const etk::UString& _colorName) {
|
||||||
{
|
|
||||||
int32_t i;
|
int32_t i;
|
||||||
for (i=0; i<listMyColor.size(); i++) {
|
for (i=0; i<listMyColor.size(); i++) {
|
||||||
if (listMyColor[i]->getName() == _colorName) {
|
if (listMyColor[i]->getName() == _colorName) {
|
||||||
@ -98,8 +90,7 @@ class classColorManager: public ewol::EObject
|
|||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
void displayListOfColor(void)
|
void displayListOfColor(void) {
|
||||||
{
|
|
||||||
int32_t i;
|
int32_t i;
|
||||||
APPL_INFO(PFX"List of ALL COLOR : ");
|
APPL_INFO(PFX"List of ALL COLOR : ");
|
||||||
for (i=0; i<listMyColor.size(); i++) {
|
for (i=0; i<listMyColor.size(); i++) {
|
||||||
@ -110,8 +101,7 @@ class classColorManager: public ewol::EObject
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
void classColorManager::loadFile(const etk::UString& _xmlFilename)
|
void classColorManager::loadFile(const etk::UString& _xmlFilename) {
|
||||||
{
|
|
||||||
// remove all old color :
|
// remove all old color :
|
||||||
for (int32_t iii=0; iii< listMyColor.size(); iii++) {
|
for (int32_t iii=0; iii< listMyColor.size(); iii++) {
|
||||||
if (NULL != listMyColor[iii]) {
|
if (NULL != listMyColor[iii]) {
|
||||||
@ -137,7 +127,7 @@ void classColorManager::loadFile(const etk::UString& _xmlFilename)
|
|||||||
}
|
}
|
||||||
exml::Element* root = (exml::Element*)doc.getNamed("EdnColor");
|
exml::Element* root = (exml::Element*)doc.getNamed("EdnColor");
|
||||||
if (NULL == root ) {
|
if (NULL == root ) {
|
||||||
APPL_ERROR("[" << getId() << "] {" << GetObjectType() << "} (l ?) main node not find: \"EdnColor\" ...");
|
APPL_ERROR("[" << getId() << "] {" << getObjectType() << "} (l ?) main node not find: \"EdnColor\" ...");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -157,7 +147,7 @@ void classColorManager::loadFile(const etk::UString& _xmlFilename)
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (pGuiNode->getValue()!="color") {
|
if (pGuiNode->getValue()!="color") {
|
||||||
APPL_ERROR("(l "<<pGuiNode->getPos()<<") node not suported : \""<<pGuiNode->GetValue()<<"\" must be [color]");
|
APPL_ERROR("(l "<<pGuiNode->getPos()<<") node not suported : \""<<pGuiNode->getValue()<<"\" must be [color]");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
//--------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------
|
||||||
@ -205,7 +195,7 @@ void classColorManager::loadFile(const etk::UString& _xmlFilename)
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (pGuiNode->getValue()!="color") {
|
if (pGuiNode->getValue()!="color") {
|
||||||
APPL_ERROR(PFX"(l "<<pGuiNode->getPos()<<") node not suported : \""<<pGuiNode->GetValue()<<"\" must be [color]");
|
APPL_ERROR(PFX"(l "<<pGuiNode->getPos()<<") node not suported : \""<<pGuiNode->getValue()<<"\" must be [color]");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
//--------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------
|
||||||
@ -253,8 +243,7 @@ void classColorManager::loadFile(const etk::UString& _xmlFilename)
|
|||||||
static classColorManager * localManager = NULL;
|
static classColorManager * localManager = NULL;
|
||||||
|
|
||||||
|
|
||||||
void ColorizeManager::init(void)
|
void ColorizeManager::init(void) {
|
||||||
{
|
|
||||||
if (NULL != localManager) {
|
if (NULL != localManager) {
|
||||||
EWOL_ERROR("ColorizeManager == > already exist, just unlink the previous ...");
|
EWOL_ERROR("ColorizeManager == > already exist, just unlink the previous ...");
|
||||||
localManager = NULL;
|
localManager = NULL;
|
||||||
@ -266,8 +255,7 @@ void ColorizeManager::init(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ColorizeManager::UnInit(void)
|
void ColorizeManager::unInit(void) {
|
||||||
{
|
|
||||||
if (NULL == localManager) {
|
if (NULL == localManager) {
|
||||||
EWOL_ERROR("ColorizeManager == > request UnInit, but does not exist ...");
|
EWOL_ERROR("ColorizeManager == > request UnInit, but does not exist ...");
|
||||||
return;
|
return;
|
||||||
@ -276,16 +264,14 @@ void ColorizeManager::UnInit(void)
|
|||||||
localManager = NULL;
|
localManager = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ColorizeManager::loadFile(const etk::UString& _xmlFilename)
|
void ColorizeManager::loadFile(const etk::UString& _xmlFilename) {
|
||||||
{
|
|
||||||
if (NULL == localManager) {
|
if (NULL == localManager) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
localManager->loadFile(_xmlFilename);
|
localManager->loadFile(_xmlFilename);
|
||||||
}
|
}
|
||||||
|
|
||||||
Colorize* ColorizeManager::get(const etk::UString& _colorName)
|
Colorize* ColorizeManager::get(const etk::UString& _colorName) {
|
||||||
{
|
|
||||||
if (NULL == localManager) {
|
if (NULL == localManager) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@ -293,8 +279,7 @@ Colorize* ColorizeManager::get(const etk::UString& _colorName)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
etk::Color<>& ColorizeManager::get(basicColor_te _myColor)
|
etk::Color<>& ColorizeManager::get(basicColor_te _myColor) {
|
||||||
{
|
|
||||||
static etk::Color<> errorColor;
|
static etk::Color<> errorColor;
|
||||||
if (NULL == localManager) {
|
if (NULL == localManager) {
|
||||||
return errorColor;
|
return errorColor;
|
||||||
@ -302,16 +287,14 @@ etk::Color<>& ColorizeManager::get(basicColor_te _myColor)
|
|||||||
return localManager->get(_myColor);
|
return localManager->get(_myColor);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ColorizeManager::Exist(const etk::UString& _colorName)
|
bool ColorizeManager::exist(const etk::UString& _colorName) {
|
||||||
{
|
|
||||||
if (NULL == localManager) {
|
if (NULL == localManager) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return localManager->Exist(_colorName);
|
return localManager->exist(_colorName);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ColorizeManager::displayListOfColor(void)
|
void ColorizeManager::displayListOfColor(void) {
|
||||||
{
|
|
||||||
if (NULL == localManager) {
|
if (NULL == localManager) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -36,11 +36,11 @@ typedef enum {
|
|||||||
namespace ColorizeManager
|
namespace ColorizeManager
|
||||||
{
|
{
|
||||||
void init(void);
|
void init(void);
|
||||||
void UnInit(void);
|
void unInit(void);
|
||||||
void loadFile(const etk::UString& _xmlFilename);
|
void loadFile(const etk::UString& _xmlFilename);
|
||||||
Colorize * get(const etk::UString& _colorName);
|
Colorize * get(const etk::UString& _colorName);
|
||||||
etk::Color<>& get(basicColor_te _myColor);
|
etk::Color<>& get(basicColor_te _myColor);
|
||||||
bool Exist(const etk::UString& _colorName);
|
bool exist(const etk::UString& _colorName);
|
||||||
void displayListOfColor(void);
|
void displayListOfColor(void);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -15,50 +15,44 @@
|
|||||||
#include <ewol/renderer/EObject.h>
|
#include <ewol/renderer/EObject.h>
|
||||||
|
|
||||||
#undef __class__
|
#undef __class__
|
||||||
#define __class__ "BufferView"
|
#define __class__ "BufferView"
|
||||||
|
|
||||||
|
static void SortElementList(etk::Vector<appl::dataBufferStruct*>& _list) {
|
||||||
|
etk::Vector<appl::dataBufferStruct *> tmpList = _list;
|
||||||
static void SortElementList(etk::Vector<appl::dataBufferStruct *> &list)
|
_list.clear();
|
||||||
{
|
|
||||||
etk::Vector<appl::dataBufferStruct *> tmpList = list;
|
|
||||||
list.clear();
|
|
||||||
for(int32_t iii=0; iii<tmpList.size(); iii++) {
|
for(int32_t iii=0; iii<tmpList.size(); iii++) {
|
||||||
if (NULL != tmpList[iii]) {
|
if (NULL == tmpList[iii]) {
|
||||||
int32_t findPos = 0;
|
continue;
|
||||||
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()) {
|
|
||||||
findPos = jjj+1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//EWOL_DEBUG("position="<<findPos);
|
|
||||||
list.insert(findPos, tmpList[iii]);
|
|
||||||
}
|
}
|
||||||
|
int32_t findPos = 0;
|
||||||
|
for(int32_t jjj=0; jjj<_list.size(); jjj++) {
|
||||||
|
//EWOL_DEBUG("compare : \""<<*tmpList[iii] << "\" and \"" << *m_listDirectory[jjj] << "\"");
|
||||||
|
if (_list[jjj] == NULL) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (tmpList[iii]->m_bufferName.getNameFile() > _list[jjj]->m_bufferName.getNameFile()) {
|
||||||
|
findPos = jjj+1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//EWOL_DEBUG("position="<<findPos);
|
||||||
|
_list.insert(findPos, tmpList[iii]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
BufferView::BufferView(void) {
|
||||||
|
|
||||||
BufferView::BufferView(void)
|
|
||||||
{
|
|
||||||
setCanHaveFocus(true);
|
setCanHaveFocus(true);
|
||||||
RegisterMultiCast(ednMsgBufferListChange);
|
registerMultiCast(ednMsgBufferListChange);
|
||||||
RegisterMultiCast(ednMsgBufferState);
|
registerMultiCast(ednMsgBufferState);
|
||||||
RegisterMultiCast(ednMsgBufferId);
|
registerMultiCast(ednMsgBufferId);
|
||||||
m_selectedID = -1;
|
m_selectedID = -1;
|
||||||
m_selectedIdRequested = -1;
|
m_selectedIdRequested = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
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]) {
|
if (NULL!=m_list[iii]) {
|
||||||
delete(m_list[iii]);
|
delete(m_list[iii]);
|
||||||
@ -68,8 +62,7 @@ void BufferView::removeAllElement(void)
|
|||||||
m_list.clear();
|
m_list.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
void BufferView::onReceiveMessage(const ewol::EMessage& _msg)
|
void BufferView::onReceiveMessage(const ewol::EMessage& _msg) {
|
||||||
{
|
|
||||||
widget::List::onReceiveMessage(_msg);
|
widget::List::onReceiveMessage(_msg);
|
||||||
if (_msg.getMessage() == ednMsgBufferListChange) {
|
if (_msg.getMessage() == ednMsgBufferListChange) {
|
||||||
// clean The list
|
// clean The list
|
||||||
@ -77,7 +70,8 @@ void BufferView::onReceiveMessage(const ewol::EMessage& _msg)
|
|||||||
// get all the buffer name and properties:
|
// get all the buffer name and properties:
|
||||||
int32_t nbBufferOpen = BufferManager::size();
|
int32_t nbBufferOpen = BufferManager::size();
|
||||||
for (int32_t iii=0; iii<nbBufferOpen; iii++) {
|
for (int32_t iii=0; iii<nbBufferOpen; iii++) {
|
||||||
if (BufferManager::Exist(iii)) {
|
if (BufferManager::exist(iii)) {
|
||||||
|
/*
|
||||||
BufferText* tmpBuffer = BufferManager::get(iii);
|
BufferText* tmpBuffer = BufferManager::get(iii);
|
||||||
if (NULL != tmpBuffer) {
|
if (NULL != tmpBuffer) {
|
||||||
bool isModify = tmpBuffer->isModify();
|
bool isModify = tmpBuffer->isModify();
|
||||||
@ -89,6 +83,7 @@ void BufferView::onReceiveMessage(const ewol::EMessage& _msg)
|
|||||||
APPL_ERROR("Allocation error of the tmp buffer list element");
|
APPL_ERROR("Allocation error of the tmp buffer list element");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (true == globals::OrderTheBufferList() ) {
|
if (true == globals::OrderTheBufferList() ) {
|
||||||
@ -102,7 +97,7 @@ void BufferView::onReceiveMessage(const ewol::EMessage& _msg)
|
|||||||
// update list of modify section ...
|
// update list of modify section ...
|
||||||
for (int32_t iii=0; iii<m_list.size(); iii++) {
|
for (int32_t iii=0; iii<m_list.size(); iii++) {
|
||||||
if (NULL!=m_list[iii]) {
|
if (NULL!=m_list[iii]) {
|
||||||
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();
|
||||||
@ -110,29 +105,24 @@ void BufferView::onReceiveMessage(const ewol::EMessage& _msg)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
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;
|
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 : ";
|
||||||
myTitle = "Buffers : ";
|
|
||||||
return true;
|
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;
|
bool isModify;
|
||||||
basicColor_te selectFG = COLOR_LIST_TEXT_NORMAL;
|
basicColor_te selectFG = COLOR_LIST_TEXT_NORMAL;
|
||||||
basicColor_te selectBG = COLOR_LIST_BG_1;
|
basicColor_te selectBG = COLOR_LIST_BG_1;
|
||||||
@ -140,49 +130,49 @@ bool BufferView::getElement(int32_t colomn, int32_t raw, etk::UString &myTextToW
|
|||||||
if (m_selectedIdRequested != -1) {
|
if (m_selectedIdRequested != -1) {
|
||||||
m_selectedID = -1;
|
m_selectedID = -1;
|
||||||
}
|
}
|
||||||
if( raw >= 0
|
if( _raw >= 0
|
||||||
&& raw<m_list.size()
|
&& _raw<m_list.size()
|
||||||
&& NULL != m_list[raw]) {
|
&& 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) {
|
if (true == m_list[_raw]->m_isModify) {
|
||||||
selectFG = COLOR_LIST_TEXT_MODIFY;
|
selectFG = COLOR_LIST_TEXT_MODIFY;
|
||||||
} else {
|
} else {
|
||||||
selectFG = COLOR_LIST_TEXT_NORMAL;
|
selectFG = COLOR_LIST_TEXT_NORMAL;
|
||||||
}
|
}
|
||||||
if (raw%2 == 0) {
|
if (_raw%2 == 0) {
|
||||||
selectBG = COLOR_LIST_BG_1;
|
selectBG = COLOR_LIST_BG_1;
|
||||||
} else {
|
} else {
|
||||||
selectBG = COLOR_LIST_BG_2;
|
selectBG = COLOR_LIST_BG_2;
|
||||||
}
|
}
|
||||||
// the buffer change of selection ...
|
// the buffer change of selection ...
|
||||||
if (m_selectedIdRequested == m_list[raw]->m_bufferID) {
|
if (m_selectedIdRequested == m_list[_raw]->m_bufferID) {
|
||||||
m_selectedID = raw;
|
m_selectedID = _raw;
|
||||||
// stop searching
|
// stop searching
|
||||||
m_selectedIdRequested = -1;
|
m_selectedIdRequested = -1;
|
||||||
// set the raw visible :
|
// set the raw visible :
|
||||||
setRawVisible(m_selectedID);
|
setRawVisible(m_selectedID);
|
||||||
}
|
}
|
||||||
if (m_selectedID == raw) {
|
if (m_selectedID == _raw) {
|
||||||
selectBG = COLOR_LIST_BG_SELECTED;
|
selectBG = COLOR_LIST_BG_SELECTED;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
myTextToWrite = "ERROR";
|
_myTextToWrite = "ERROR";
|
||||||
}
|
}
|
||||||
fg = ColorizeManager::get(selectFG);
|
_fg = ColorizeManager::get(selectFG);
|
||||||
bg = ColorizeManager::get(selectBG);
|
_bg = ColorizeManager::get(selectBG);
|
||||||
return true;
|
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) {
|
if (1 == _IdInput && _typeEvent == ewol::keyEvent::statusSingle) {
|
||||||
APPL_INFO("Event on List : IdInput=" << IdInput << " colomn=" << colomn << " raw=" << raw );
|
APPL_INFO("Event on List : IdInput=" << _IdInput << " colomn=" << _colomn << " raw=" << _raw );
|
||||||
if( raw >= 0
|
if( _raw >= 0
|
||||||
&& raw<m_list.size()
|
&& _raw<m_list.size()
|
||||||
&& NULL != m_list[raw]) {
|
&& NULL != m_list[_raw]) {
|
||||||
m_selectedIdRequested = m_list[raw]->m_bufferID;
|
m_selectedIdRequested = m_list[_raw]->m_bufferID;
|
||||||
SendMultiCast(ednMsgBufferId, m_list[raw]->m_bufferID);
|
sendMultiCast(ednMsgBufferId, m_list[_raw]->m_bufferID);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
markToRedraw();
|
markToRedraw();
|
||||||
|
@ -10,7 +10,6 @@
|
|||||||
#define __BUFFER_VIEW_H__
|
#define __BUFFER_VIEW_H__
|
||||||
|
|
||||||
#include <appl/Debug.h>
|
#include <appl/Debug.h>
|
||||||
#include <CodeView.h>
|
|
||||||
#include <BufferManager.h>
|
#include <BufferManager.h>
|
||||||
#include <appl/globalMsg.h>
|
#include <appl/globalMsg.h>
|
||||||
#include <ewol/widget/List.h>
|
#include <ewol/widget/List.h>
|
||||||
@ -24,11 +23,10 @@ namespace appl
|
|||||||
etk::FSNode m_bufferName;
|
etk::FSNode m_bufferName;
|
||||||
uint32_t m_bufferID;
|
uint32_t m_bufferID;
|
||||||
bool m_isModify;
|
bool m_isModify;
|
||||||
dataBufferStruct(etk::FSNode& bufferName, int32_t bufferID, bool isModify) :
|
dataBufferStruct(etk::FSNode& _bufferName, int32_t _bufferID, bool _isModify) :
|
||||||
m_bufferName(bufferName),
|
m_bufferName(_bufferName),
|
||||||
m_bufferID(bufferID),
|
m_bufferID(_bufferID),
|
||||||
m_isModify(isModify)
|
m_isModify(_isModify) {
|
||||||
{
|
|
||||||
|
|
||||||
};
|
};
|
||||||
~dataBufferStruct(void) { };
|
~dataBufferStruct(void) { };
|
||||||
@ -38,9 +36,9 @@ namespace appl
|
|||||||
class BufferView : public widget::List
|
class BufferView : public widget::List
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
int32_t m_selectedIdRequested;
|
int32_t m_selectedIdRequested;
|
||||||
int32_t m_selectedID;
|
int32_t m_selectedID;
|
||||||
etk::Vector<appl::dataBufferStruct*> m_list;
|
etk::Vector<appl::dataBufferStruct*> m_list;
|
||||||
public:
|
public:
|
||||||
// Constructeur
|
// Constructeur
|
||||||
BufferView(void);
|
BufferView(void);
|
||||||
@ -55,10 +53,10 @@ class BufferView : public widget::List
|
|||||||
void removeAllElement(void);
|
void removeAllElement(void);
|
||||||
// Derived function
|
// Derived function
|
||||||
virtual uint32_t getNuberOfColomn(void);
|
virtual uint32_t getNuberOfColomn(void);
|
||||||
virtual bool getTitle(int32_t colomn, etk::UString &myTitle, etk::Color<> &fg, etk::Color<> &bg);
|
virtual bool getTitle(int32_t _colomn, etk::UString& _myTitle, etk::Color<>& _fg, etk::Color<>& _bg);
|
||||||
virtual uint32_t getNuberOfRaw(void);
|
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 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 bool onItemEvent(int32_t _IdInput, ewol::keyEvent::status_te _typeEvent, int32_t _colomn, int32_t _raw, float _x, float _y);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -10,7 +10,6 @@
|
|||||||
#include <appl/Debug.h>
|
#include <appl/Debug.h>
|
||||||
#include <appl/global.h>
|
#include <appl/global.h>
|
||||||
#include <MainWindows.h>
|
#include <MainWindows.h>
|
||||||
#include <CodeView.h>
|
|
||||||
#include <BufferView.h>
|
#include <BufferView.h>
|
||||||
#include <TextViewer.h>
|
#include <TextViewer.h>
|
||||||
#include <Search.h>
|
#include <Search.h>
|
||||||
@ -55,12 +54,10 @@ namespace appl
|
|||||||
#include <ewol/widget/Label.h>
|
#include <ewol/widget/Label.h>
|
||||||
#include <ewol/widget/Spacer.h>
|
#include <ewol/widget/Spacer.h>
|
||||||
|
|
||||||
class ParameterAboutGui : public widget::Sizer
|
class ParameterAboutGui : public widget::Sizer {
|
||||||
{
|
|
||||||
public :
|
public :
|
||||||
ParameterAboutGui(void) :
|
ParameterAboutGui(void) :
|
||||||
widget::Sizer(widget::Sizer::modeVert)
|
widget::Sizer(widget::Sizer::modeVert) {
|
||||||
{
|
|
||||||
widget::Spacer* mySpacer = NULL;
|
widget::Spacer* mySpacer = NULL;
|
||||||
|
|
||||||
mySpacer = new widget::Spacer();
|
mySpacer = new widget::Spacer();
|
||||||
@ -102,7 +99,9 @@ class ParameterAboutGui : public widget::Sizer
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
~ParameterAboutGui(void) { };
|
~ParameterAboutGui(void) {
|
||||||
|
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -111,16 +110,14 @@ const char * l_smoothMin = "tmpEvent_minChange";
|
|||||||
const char * l_smoothMax = "tmpEvent_maxChange";
|
const char * l_smoothMax = "tmpEvent_maxChange";
|
||||||
|
|
||||||
#undef __class__
|
#undef __class__
|
||||||
#define __class__ "MainWindows"
|
#define __class__ "MainWindows"
|
||||||
|
|
||||||
MainWindows::MainWindows(void)
|
MainWindows::MainWindows(void) {
|
||||||
{
|
|
||||||
APPL_DEBUG("CREATE WINDOWS ... ");
|
APPL_DEBUG("CREATE WINDOWS ... ");
|
||||||
widget::Sizer * mySizerVert = NULL;
|
widget::Sizer * mySizerVert = NULL;
|
||||||
widget::Sizer * mySizerVert2 = NULL;
|
widget::Sizer * mySizerVert2 = NULL;
|
||||||
widget::Sizer * mySizerHori = NULL;
|
widget::Sizer * mySizerHori = NULL;
|
||||||
//ewol::Button * myButton = NULL;
|
//ewol::Button * myButton = NULL;
|
||||||
CodeView * myCodeView = NULL;
|
|
||||||
appl::TextViewer * myTextView = NULL;
|
appl::TextViewer * myTextView = NULL;
|
||||||
BufferView * myBufferView = NULL;
|
BufferView * myBufferView = NULL;
|
||||||
widget::Menu * myMenu = NULL;
|
widget::Menu * myMenu = NULL;
|
||||||
@ -241,40 +238,39 @@ MainWindows::MainWindows(void)
|
|||||||
|
|
||||||
// add generic shortcut ...
|
// add generic shortcut ...
|
||||||
// (shift, control, alt, meta, uniChar_t unicodeValue, const char * generateEventId, etk::UString& data)
|
// (shift, control, alt, meta, uniChar_t unicodeValue, const char * generateEventId, etk::UString& data)
|
||||||
ShortCutAdd("ctrl+o", ednMsgGuiOpen, "", true);
|
shortCutAdd("ctrl+o", ednMsgGuiOpen, "", true);
|
||||||
ShortCutAdd("ctrl+n", ednMsgGuiNew, "", true);
|
shortCutAdd("ctrl+n", ednMsgGuiNew, "", true);
|
||||||
|
|
||||||
ShortCutAdd("ctrl+s", ednMsgGuiSave, "current", true);
|
shortCutAdd("ctrl+s", ednMsgGuiSave, "current", true);
|
||||||
ShortCutAdd("ctrl+shift+s", ednMsgGuiSave, "All", true);
|
shortCutAdd("ctrl+shift+s", ednMsgGuiSave, "All", true);
|
||||||
|
|
||||||
ShortCutAdd("ctrl+q", ednMsgGuiClose, "current", true);
|
shortCutAdd("ctrl+q", ednMsgGuiClose, "current", true);
|
||||||
ShortCutAdd("ctrl+shift+q", ednMsgGuiClose, "All", true);
|
shortCutAdd("ctrl+shift+q", ednMsgGuiClose, "All", true);
|
||||||
|
|
||||||
ShortCutAdd("ctrl+z", ednMsgGuiUndo, "", true);
|
shortCutAdd("ctrl+z", ednMsgGuiUndo, "", true);
|
||||||
ShortCutAdd("ctrl+shift+z", ednMsgGuiRedo, "", true);
|
shortCutAdd("ctrl+shift+z", ednMsgGuiRedo, "", true);
|
||||||
|
|
||||||
ShortCutAdd("ctrl+l", ednMsgGuiGotoLine, "???", true);
|
shortCutAdd("ctrl+l", ednMsgGuiGotoLine, "???", true);
|
||||||
|
|
||||||
ShortCutAdd("ctrl+f", ednMsgGuiSearch, "", true);
|
shortCutAdd("ctrl+f", ednMsgGuiSearch, "", true);
|
||||||
ShortCutAdd("F12", ednMsgGuiReloadShader, "", true);
|
shortCutAdd("F12", ednMsgGuiReloadShader, "", true);
|
||||||
|
|
||||||
ShortCutAdd("ctrl+d", ednMsgGuiCtags, "Jump", true);
|
shortCutAdd("ctrl+d", ednMsgGuiCtags, "Jump", true);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Generic event ...
|
// Generic event ...
|
||||||
RegisterMultiCast(ednMsgGuiSaveAs);
|
registerMultiCast(ednMsgGuiSaveAs);
|
||||||
RegisterMultiCast(ednMsgProperties);
|
registerMultiCast(ednMsgProperties);
|
||||||
RegisterMultiCast(ednMsgGuiOpen);
|
registerMultiCast(ednMsgGuiOpen);
|
||||||
// to update the title ...
|
// to update the title ...
|
||||||
RegisterMultiCast(ednMsgBufferState);
|
registerMultiCast(ednMsgBufferState);
|
||||||
RegisterMultiCast(ednMsgBufferId);
|
registerMultiCast(ednMsgBufferId);
|
||||||
RegisterMultiCast(ednMsgGuiReloadShader);
|
registerMultiCast(ednMsgGuiReloadShader);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
MainWindows::~MainWindows(void)
|
MainWindows::~MainWindows(void) {
|
||||||
{
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -283,28 +279,29 @@ const char *const ednEventPopUpFileSelected = "edn-mainWindows-openSelected";
|
|||||||
const char *const ednEventPopUpFileSaveAs = "edn-mainWindows-saveAsSelected";
|
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 << "\"" );
|
//APPL_INFO("Receive Event from the main windows ... : \"" << eventId << "\" == > data=\"" << data << "\"" );
|
||||||
// open file Section ...
|
// open file Section ...
|
||||||
if (_msg.getMessage() == ednMsgGuiOpen) {
|
if (_msg.getMessage() == ednMsgGuiOpen) {
|
||||||
widget::fileChooser* tmpWidget = new widget::FileChooser();
|
widget::FileChooser* tmpWidget = new widget::FileChooser();
|
||||||
tmpWidget->setTitle("Open files ...");
|
tmpWidget->setTitle("Open files ...");
|
||||||
tmpWidget->setValidateLabel("Open");
|
tmpWidget->setValidateLabel("Open");
|
||||||
if (BufferManager::getSelected()!=-1) {
|
if (BufferManager::getSelected()!=-1) {
|
||||||
BufferText * myBuffer = BufferManager::get(BufferManager::GetSelected());
|
/*
|
||||||
|
BufferText * myBuffer = BufferManager::get(BufferManager::getSelected());
|
||||||
if (NULL!=myBuffer) {
|
if (NULL!=myBuffer) {
|
||||||
etk::FSNode tmpFile = myBuffer->getFileName();
|
etk::FSNode tmpFile = myBuffer->getFileName();
|
||||||
tmpWidget->setFolder(tmpFile.getNameFolder());
|
tmpWidget->setFolder(tmpFile.getNameFolder());
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
popUpWidgetPush(tmpWidget);
|
popUpWidgetPush(tmpWidget);
|
||||||
tmpWidget->registerOnEvent(this, ewolEventFileChooserValidate, ednEventPopUpFileSelected);
|
tmpWidget->registerOnEvent(this, ewolEventFileChooserValidate, ednEventPopUpFileSelected);
|
||||||
} else if (_msg.getMessage() == ednEventPopUpFileSelected) {
|
} else if (_msg.getMessage() == ednEventPopUpFileSelected) {
|
||||||
APPL_DEBUG("Request opening the file : " << _msg.getData());
|
APPL_DEBUG("Request opening the file : " << _msg.getData());
|
||||||
SendMultiCast(ednMsgOpenFile, _msg.getData());
|
sendMultiCast(ednMsgOpenFile, _msg.getData());
|
||||||
} else if (_msg.getMessage() == ednMsgGuiSaveAs) {
|
} else if (_msg.getMessage() == ednMsgGuiSaveAs) {
|
||||||
if (_msg.getData() == "") {
|
if (_msg.getData() == "") {
|
||||||
APPL_ERROR("Null data for Save As file ... ");
|
APPL_ERROR("Null data for Save As file ... ");
|
||||||
@ -316,11 +313,12 @@ void MainWindows::onReceiveMessage(const ewol::EMessage& _msg)
|
|||||||
sscanf(_msg.getData().c_str(), "%d", &m_currentSavingAsIdBuffer);
|
sscanf(_msg.getData().c_str(), "%d", &m_currentSavingAsIdBuffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (false == BufferManager::Exist(m_currentSavingAsIdBuffer)) {
|
if (false == BufferManager::exist(m_currentSavingAsIdBuffer)) {
|
||||||
APPL_ERROR("Request saveAs on non existant Buffer ID=" << m_currentSavingAsIdBuffer);
|
APPL_ERROR("Request saveAs on non existant Buffer ID=" << m_currentSavingAsIdBuffer);
|
||||||
} else {
|
} else {
|
||||||
|
/*
|
||||||
BufferText* myBuffer = BufferManager::get(m_currentSavingAsIdBuffer);
|
BufferText* myBuffer = BufferManager::get(m_currentSavingAsIdBuffer);
|
||||||
widget::fileChooser* tmpWidget = new widget::FileChooser();
|
widget::FileChooser* tmpWidget = new widget::FileChooser();
|
||||||
if (NULL == tmpWidget) {
|
if (NULL == tmpWidget) {
|
||||||
APPL_ERROR("Can not allocate widget == > display might be in error");
|
APPL_ERROR("Can not allocate widget == > display might be in error");
|
||||||
} else {
|
} else {
|
||||||
@ -338,6 +336,7 @@ void MainWindows::onReceiveMessage(const ewol::EMessage& _msg)
|
|||||||
popUpWidgetPush(tmpWidget);
|
popUpWidgetPush(tmpWidget);
|
||||||
tmpWidget->registerOnEvent(this, ewolEventFileChooserValidate, ednEventPopUpFileSaveAs);
|
tmpWidget->registerOnEvent(this, ewolEventFileChooserValidate, ednEventPopUpFileSaveAs);
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (_msg.getMessage() == ednEventPopUpFileSaveAs) {
|
} else if (_msg.getMessage() == ednEventPopUpFileSaveAs) {
|
||||||
@ -346,11 +345,12 @@ void MainWindows::onReceiveMessage(const ewol::EMessage& _msg)
|
|||||||
APPL_DEBUG("Request Saving As file : " << tmpData);
|
APPL_DEBUG("Request Saving As file : " << tmpData);
|
||||||
|
|
||||||
BufferManager::get(m_currentSavingAsIdBuffer)->setFileName(tmpData);
|
BufferManager::get(m_currentSavingAsIdBuffer)->setFileName(tmpData);
|
||||||
SendMultiCast(ednMsgGuiSave, m_currentSavingAsIdBuffer);
|
sendMultiCast(ednMsgGuiSave, m_currentSavingAsIdBuffer);
|
||||||
} else if( _msg.getMessage() == ednMsgBufferState
|
} else if( _msg.getMessage() == ednMsgBufferState
|
||||||
|| _msg.getMessage() == ednMsgBufferId) {
|
|| _msg.getMessage() == ednMsgBufferId) {
|
||||||
// the buffer change we need to update the widget string
|
// 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) {
|
if (NULL != tmpBuffer) {
|
||||||
etk::FSNode compleateName = tmpBuffer->getFileName();
|
etk::FSNode compleateName = tmpBuffer->getFileName();
|
||||||
bool isModify = tmpBuffer->isModify();
|
bool isModify = tmpBuffer->isModify();
|
||||||
@ -369,6 +369,7 @@ void MainWindows::onReceiveMessage(const ewol::EMessage& _msg)
|
|||||||
m_widgetLabelFileName->setLabel("");
|
m_widgetLabelFileName->setLabel("");
|
||||||
setTitle("edn");
|
setTitle("edn");
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
return;
|
return;
|
||||||
// TODO : set the Title ....
|
// TODO : set the Title ....
|
||||||
} else if (_msg.getMessage() == ednMsgProperties) {
|
} else if (_msg.getMessage() == ednMsgProperties) {
|
||||||
@ -379,18 +380,18 @@ void MainWindows::onReceiveMessage(const ewol::EMessage& _msg)
|
|||||||
} else {
|
} else {
|
||||||
tmpWidget->setTitle("Properties");
|
tmpWidget->setTitle("Properties");
|
||||||
popUpWidgetPush(tmpWidget);
|
popUpWidgetPush(tmpWidget);
|
||||||
tmpWidget->MenuAddGroup("Editor");
|
tmpWidget->menuAddGroup("Editor");
|
||||||
ewol::Widget* tmpSubWidget = new globals::ParameterGlobalsGui();
|
ewol::Widget* tmpSubWidget = new globals::ParameterGlobalsGui();
|
||||||
tmpWidget->MenuAdd("Editor", "", tmpSubWidget);
|
tmpWidget->menuAdd("Editor", "", tmpSubWidget);
|
||||||
tmpWidget->MenuAdd("Font & Color", "", NULL);
|
tmpWidget->menuAdd("Font & Color", "", NULL);
|
||||||
tmpWidget->MenuAdd("Highlight", "", NULL);
|
tmpWidget->menuAdd("Highlight", "", NULL);
|
||||||
tmpWidget->MenuAddGroup("General");
|
tmpWidget->menuAddGroup("General");
|
||||||
tmpWidget->MenuAdd("Display", "", NULL);
|
tmpWidget->menuAdd("Display", "", NULL);
|
||||||
tmpSubWidget = new ParameterAboutGui();
|
tmpSubWidget = new ParameterAboutGui();
|
||||||
tmpWidget->MenuAdd("About", "", tmpSubWidget);
|
tmpWidget->menuAdd("About", "", tmpSubWidget);
|
||||||
}
|
}
|
||||||
} else if (_msg.getMessage() == ednMsgGuiReloadShader) {
|
} else if (_msg.getMessage() == ednMsgGuiReloadShader) {
|
||||||
ewol::getContext().getResourcesManager().ReLoadResources();
|
ewol::getContext().getResourcesManager().reLoadResources();
|
||||||
ewol::getContext().forceRedrawAll();
|
ewol::getContext().forceRedrawAll();
|
||||||
} else if (_msg.getMessage() == ednMsgGuiExit) {
|
} else if (_msg.getMessage() == ednMsgGuiExit) {
|
||||||
// TODO ...
|
// TODO ...
|
||||||
@ -399,8 +400,7 @@ void MainWindows::onReceiveMessage(const ewol::EMessage& _msg)
|
|||||||
return;
|
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) {
|
if (m_widgetLabelFileName == _removeObject) {
|
||||||
m_widgetLabelFileName = NULL;
|
m_widgetLabelFileName = NULL;
|
||||||
|
@ -12,13 +12,11 @@
|
|||||||
#include <appl/Debug.h>
|
#include <appl/Debug.h>
|
||||||
#include <appl/globalMsg.h>
|
#include <appl/globalMsg.h>
|
||||||
|
|
||||||
#include <CodeView.h>
|
|
||||||
#include <BufferView.h>
|
#include <BufferView.h>
|
||||||
#include <BufferManager.h>
|
#include <BufferManager.h>
|
||||||
#include <ewol/widget/Label.h>
|
#include <ewol/widget/Label.h>
|
||||||
|
|
||||||
class MainWindows : public ewol::Windows
|
class MainWindows : public ewol::Windows {
|
||||||
{
|
|
||||||
private:
|
private:
|
||||||
int32_t m_currentSavingAsIdBuffer;
|
int32_t m_currentSavingAsIdBuffer;
|
||||||
widget::Label* m_widgetLabelFileName;
|
widget::Label* m_widgetLabelFileName;
|
||||||
|
@ -32,10 +32,9 @@ const char* const l_eventForwardCb = "appl-forward-CheckBox";
|
|||||||
const char* const l_eventHideBt = "appl-hide-button";
|
const char* const l_eventHideBt = "appl-hide-button";
|
||||||
|
|
||||||
Search::Search(void) :
|
Search::Search(void) :
|
||||||
widget::Sizer(widget::Sizer::modeHori),
|
widget::Sizer(widget::Sizer::modeHori),
|
||||||
m_searchEntry(NULL),
|
m_searchEntry(NULL),
|
||||||
m_replaceEntry(NULL)
|
m_replaceEntry(NULL) {
|
||||||
{
|
|
||||||
m_forward = false;
|
m_forward = false;
|
||||||
// TODO : change the mode of creating interface :
|
// TODO : change the mode of creating interface :
|
||||||
/*
|
/*
|
||||||
@ -180,19 +179,17 @@ Search::Search(void) :
|
|||||||
subWidgetAdd(myButtonImage);
|
subWidgetAdd(myButtonImage);
|
||||||
}
|
}
|
||||||
|
|
||||||
RegisterMultiCast(ednMsgGuiSearch);
|
registerMultiCast(ednMsgGuiSearch);
|
||||||
// basicly hiden ...
|
// basicly hiden ...
|
||||||
Hide();
|
hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
Search::~Search(void)
|
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 << "\"");
|
//APPL_INFO("Search receive message : \"" << eventId << "\" data=\"" << data << "\"");
|
||||||
if ( _msg.getMessage() == l_eventSearchEntry) {
|
if ( _msg.getMessage() == l_eventSearchEntry) {
|
||||||
@ -200,74 +197,73 @@ void Search::onReceiveMessage(const ewol::EMessage& _msg)
|
|||||||
} else if ( _msg.getMessage() == l_eventSearchEntryEnter) {
|
} else if ( _msg.getMessage() == l_eventSearchEntryEnter) {
|
||||||
SearchData::setSearch(_msg.getData());
|
SearchData::setSearch(_msg.getData());
|
||||||
if (true == m_forward) {
|
if (true == m_forward) {
|
||||||
SendMultiCast(ednMsgGuiFind, "Previous");
|
sendMultiCast(ednMsgGuiFind, "Previous");
|
||||||
} else {
|
} else {
|
||||||
SendMultiCast(ednMsgGuiFind, "Next");
|
sendMultiCast(ednMsgGuiFind, "Next");
|
||||||
}
|
}
|
||||||
} else if ( _msg.getMessage() == l_eventReplaceEntry) {
|
} else if ( _msg.getMessage() == l_eventReplaceEntry) {
|
||||||
SearchData::setReplace(_msg.getData());
|
SearchData::setReplace(_msg.getData());
|
||||||
} else if ( _msg.getMessage() == l_eventReplaceEntryEnter) {
|
} else if ( _msg.getMessage() == l_eventReplaceEntryEnter) {
|
||||||
SearchData::setReplace(_msg.getData());
|
SearchData::setReplace(_msg.getData());
|
||||||
SendMultiCast(ednMsgGuiReplace, "Normal");
|
sendMultiCast(ednMsgGuiReplace, "Normal");
|
||||||
if (true == m_forward) {
|
if (true == m_forward) {
|
||||||
SendMultiCast(ednMsgGuiFind, "Previous");
|
sendMultiCast(ednMsgGuiFind, "Previous");
|
||||||
} else {
|
} else {
|
||||||
SendMultiCast(ednMsgGuiFind, "Next");
|
sendMultiCast(ednMsgGuiFind, "Next");
|
||||||
}
|
}
|
||||||
} else if ( _msg.getMessage() == l_eventSearchBt) {
|
} else if ( _msg.getMessage() == l_eventSearchBt) {
|
||||||
if (true == m_forward) {
|
if (true == m_forward) {
|
||||||
SendMultiCast(ednMsgGuiFind, "Previous");
|
sendMultiCast(ednMsgGuiFind, "Previous");
|
||||||
} else {
|
} else {
|
||||||
SendMultiCast(ednMsgGuiFind, "Next");
|
sendMultiCast(ednMsgGuiFind, "Next");
|
||||||
}
|
}
|
||||||
} else if ( _msg.getMessage() == l_eventReplaceBt) {
|
} else if ( _msg.getMessage() == l_eventReplaceBt) {
|
||||||
SendMultiCast(ednMsgGuiReplace, "Normal");
|
sendMultiCast(ednMsgGuiReplace, "Normal");
|
||||||
if (true == m_forward) {
|
if (true == m_forward) {
|
||||||
SendMultiCast(ednMsgGuiFind, "Previous");
|
sendMultiCast(ednMsgGuiFind, "Previous");
|
||||||
} else {
|
} else {
|
||||||
SendMultiCast(ednMsgGuiFind, "Next");
|
sendMultiCast(ednMsgGuiFind, "Next");
|
||||||
}
|
}
|
||||||
} else if ( _msg.getMessage() == l_eventCaseCb) {
|
} else if ( _msg.getMessage() == l_eventCaseCb) {
|
||||||
if (_msg.getData() == "1") {
|
if (_msg.getData() == "true") {
|
||||||
SearchData::setCase(false);
|
SearchData::setCase(false);
|
||||||
} else {
|
} else {
|
||||||
SearchData::setCase(true);
|
SearchData::setCase(true);
|
||||||
}
|
}
|
||||||
} else if ( _msg.getMessage() == l_eventWrapCb) {
|
} else if ( _msg.getMessage() == l_eventWrapCb) {
|
||||||
if (_msg.getData() == "1") {
|
if (_msg.getData() == "true") {
|
||||||
SearchData::setWrap(false);
|
SearchData::setWrap(false);
|
||||||
} else {
|
} else {
|
||||||
SearchData::setWrap(true);
|
SearchData::setWrap(true);
|
||||||
}
|
}
|
||||||
} else if ( _msg.getMessage() == l_eventForwardCb) {
|
} else if ( _msg.getMessage() == l_eventForwardCb) {
|
||||||
if (_msg.getData() == "1") {
|
if (_msg.getData() == "true") {
|
||||||
m_forward = false;
|
m_forward = false;
|
||||||
} else {
|
} else {
|
||||||
m_forward = true;
|
m_forward = true;
|
||||||
}
|
}
|
||||||
} else if ( _msg.getMessage() == l_eventHideBt) {
|
} else if ( _msg.getMessage() == l_eventHideBt) {
|
||||||
Hide();
|
hide();
|
||||||
} else if ( _msg.getMessage() == ednMsgGuiSearch) {
|
} else if ( _msg.getMessage() == ednMsgGuiSearch) {
|
||||||
if (true == isHide()) {
|
if (true == isHide()) {
|
||||||
Show();
|
show();
|
||||||
if (m_searchEntry!= NULL) {
|
if (m_searchEntry!= NULL) {
|
||||||
m_searchEntry->keepFocus();
|
m_searchEntry->keepFocus();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if( (m_searchEntry!=NULL && true == m_searchEntry->getFocus())
|
if( (m_searchEntry!=NULL && true == m_searchEntry->getFocus())
|
||||||
|| (m_replaceEntry!=NULL && true == m_replaceEntry->getFocus()) ) {
|
|| (m_replaceEntry!=NULL && true == m_replaceEntry->getFocus()) ) {
|
||||||
Hide();
|
hide();
|
||||||
} else if (m_searchEntry!= NULL) {
|
} else if (m_searchEntry!= NULL) {
|
||||||
m_searchEntry->keepFocus();
|
m_searchEntry->keepFocus();
|
||||||
} else {
|
} else {
|
||||||
Hide();
|
hide();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Search::onObjectRemove(ewol::EObject * _removeObject)
|
void Search::onObjectRemove(ewol::EObject * _removeObject) {
|
||||||
{
|
|
||||||
widget::Sizer::onObjectRemove(_removeObject);
|
widget::Sizer::onObjectRemove(_removeObject);
|
||||||
if (_removeObject == m_searchEntry) {
|
if (_removeObject == m_searchEntry) {
|
||||||
m_searchEntry = NULL;
|
m_searchEntry = NULL;
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
class Search : public widget::Sizer
|
class Search : public widget::Sizer
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
bool m_forward;
|
bool m_forward;
|
||||||
widget::Entry * m_searchEntry;
|
widget::Entry * m_searchEntry;
|
||||||
widget::Entry * m_replaceEntry;
|
widget::Entry * m_replaceEntry;
|
||||||
public:
|
public:
|
||||||
|
@ -10,15 +10,13 @@
|
|||||||
#include <appl/Gui/TagFileList.h>
|
#include <appl/Gui/TagFileList.h>
|
||||||
|
|
||||||
#undef __class__
|
#undef __class__
|
||||||
#define __class__ "TagFileList"
|
#define __class__ "TagFileList"
|
||||||
|
|
||||||
extern const char * const applEventCtagsListSelect = "appl-event-ctags-list-select";
|
extern const char * const applEventCtagsListSelect = "appl-event-ctags-list-select";
|
||||||
extern const char * const applEventCtagsListUnSelect = "appl-event-ctags-list-un-select";
|
extern const char * const applEventCtagsListUnSelect = "appl-event-ctags-list-un-select";
|
||||||
extern const char * const applEventCtagsListValidate = "appl-event-ctags-list-validate";
|
extern const char * const applEventCtagsListValidate = "appl-event-ctags-list-validate";
|
||||||
|
|
||||||
|
appl::TagFileList::TagFileList(void) {
|
||||||
appl::TagFileList::TagFileList(void)
|
|
||||||
{
|
|
||||||
m_selectedLine = -1;
|
m_selectedLine = -1;
|
||||||
addEventId(applEventCtagsListSelect);
|
addEventId(applEventCtagsListSelect);
|
||||||
addEventId(applEventCtagsListValidate);
|
addEventId(applEventCtagsListValidate);
|
||||||
@ -26,8 +24,7 @@ appl::TagFileList::TagFileList(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
appl::TagFileList::~TagFileList(void)
|
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]) {
|
if (NULL != m_list[iii]) {
|
||||||
delete(m_list[iii]);
|
delete(m_list[iii]);
|
||||||
@ -44,8 +41,8 @@ uint32_t appl::TagFileList::getNuberOfColomn(void) {
|
|||||||
return 2;
|
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";
|
_myTitle = "title";
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -53,51 +50,50 @@ uint32_t appl::TagFileList::getNuberOfRaw(void) {
|
|||||||
return m_list.size();
|
return m_list.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool appl::TagFileList::getElement(int32_t colomn, int32_t raw, etk::UString &myTextToWrite, etk::Color<> &fg, etk::Color<> &bg) {
|
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 (_raw >= 0 && _raw < m_list.size() && NULL != m_list[_raw]) {
|
||||||
if (0 == colomn) {
|
if (0 == _colomn) {
|
||||||
myTextToWrite = etk::UString(m_list[raw]->fileLine);
|
_myTextToWrite = etk::UString(m_list[_raw]->fileLine);
|
||||||
} else {
|
} else {
|
||||||
myTextToWrite = m_list[raw]->filename;
|
_myTextToWrite = m_list[_raw]->filename;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
myTextToWrite = "ERROR";
|
_myTextToWrite = "ERROR";
|
||||||
}
|
}
|
||||||
fg = etk::color::black;
|
_fg = etk::color::black;
|
||||||
if (raw % 2) {
|
if (_raw % 2) {
|
||||||
if (colomn%2 == 0) {
|
if (_colomn%2 == 0) {
|
||||||
bg = 0xFFFFFF00;
|
_bg = 0xFFFFFF00;
|
||||||
} else {
|
} else {
|
||||||
bg = 0xFFFFFF10;
|
_bg = 0xFFFFFF10;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (colomn%2 == 0) {
|
if (_colomn%2 == 0) {
|
||||||
bg = 0xBFBFBFFF;
|
_bg = 0xBFBFBFFF;
|
||||||
} else {
|
} else {
|
||||||
bg = 0xCFCFCFFF;
|
_bg = 0xCFCFCFFF;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (m_selectedLine == raw) {
|
if (m_selectedLine == _raw) {
|
||||||
if (colomn%2 == 0) {
|
if (_colomn%2 == 0) {
|
||||||
bg = 0x8F8FFFFF;
|
_bg = 0x8F8FFFFF;
|
||||||
} else {
|
} else {
|
||||||
bg = 0x7F7FFFFF;
|
_bg = 0x7F7FFFFF;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
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) {
|
||||||
if (typeEvent == ewol::keyEvent::statusSingle) {
|
EWOL_INFO("Event on List : IdInput=" << _IdInput << " colomn=" << _colomn << " raw=" << _raw );
|
||||||
EWOL_INFO("Event on List : IdInput=" << IdInput << " colomn=" << colomn << " raw=" << raw );
|
if (_IdInput == 1) {
|
||||||
if (1 == IdInput) {
|
|
||||||
int32_t previousRaw = m_selectedLine;
|
int32_t previousRaw = m_selectedLine;
|
||||||
if (raw > m_list.size() ) {
|
if (_raw > m_list.size() ) {
|
||||||
m_selectedLine = -1;
|
m_selectedLine = -1;
|
||||||
} else {
|
} else {
|
||||||
m_selectedLine = raw;
|
m_selectedLine = _raw;
|
||||||
}
|
}
|
||||||
const char * event = applEventCtagsListValidate;
|
const char * event = applEventCtagsListValidate;
|
||||||
if (previousRaw != m_selectedLine) {
|
if (previousRaw != m_selectedLine) {
|
||||||
@ -106,7 +102,7 @@ bool appl::TagFileList::onItemEvent(int32_t IdInput, ewol::keyEvent::status_te t
|
|||||||
if( m_selectedLine >= 0
|
if( m_selectedLine >= 0
|
||||||
&& m_selectedLine < m_list.size()
|
&& m_selectedLine < m_list.size()
|
||||||
&& NULL != m_list[m_selectedLine] ) {
|
&& 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 {
|
} else {
|
||||||
generateEventId(applEventCtagsListUnSelect);
|
generateEventId(applEventCtagsListUnSelect);
|
||||||
}
|
}
|
||||||
@ -123,11 +119,9 @@ 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] file Compleate file name
|
||||||
* @param[in] jump line id
|
* @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);
|
||||||
appl::TagListElement *tmpFile = new appl::TagListElement(file, line);
|
|
||||||
if (NULL != tmpFile) {
|
if (NULL != tmpFile) {
|
||||||
m_list.pushBack(tmpFile);
|
m_list.pushBack(tmpFile);
|
||||||
}
|
}
|
||||||
|
@ -22,11 +22,16 @@ namespace appl {
|
|||||||
public:
|
public:
|
||||||
etk::UString filename;
|
etk::UString filename;
|
||||||
int32_t fileLine;
|
int32_t fileLine;
|
||||||
TagListElement(etk::UString& file, int32_t line) : filename(file), fileLine(line) {};
|
TagListElement(etk::UString& _file, int32_t _line) :
|
||||||
~TagListElement(void) {};
|
filename(_file),
|
||||||
|
fileLine(_line) {
|
||||||
|
|
||||||
|
};
|
||||||
|
~TagListElement(void) {
|
||||||
|
|
||||||
|
};
|
||||||
};
|
};
|
||||||
class TagFileList : public widget::List
|
class TagFileList : public widget::List {
|
||||||
{
|
|
||||||
private:
|
private:
|
||||||
int32_t m_selectedLine;
|
int32_t m_selectedLine;
|
||||||
etk::Vector<appl::TagListElement*> m_list;
|
etk::Vector<appl::TagListElement*> m_list;
|
||||||
@ -36,19 +41,21 @@ namespace appl {
|
|||||||
// display API :
|
// display API :
|
||||||
virtual etk::Color<> getBasicBG(void);
|
virtual etk::Color<> getBasicBG(void);
|
||||||
uint32_t getNuberOfColomn(void);
|
uint32_t getNuberOfColomn(void);
|
||||||
bool getTitle(int32_t colomn, etk::UString &myTitle, etk::Color<> &fg, etk::Color<> &bg);
|
bool getTitle(int32_t _colomn, etk::UString& _myTitle, etk::Color<>& _fg, etk::Color<>& _bg);
|
||||||
uint32_t getNuberOfRaw(void);
|
uint32_t getNuberOfRaw(void);
|
||||||
bool getElement(int32_t colomn, int32_t raw, etk::UString &myTextToWrite, etk::Color<> &fg, etk::Color<> &bg);
|
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);
|
bool onItemEvent(int32_t _IdInput, ewol::keyEvent::status_te _typeEvent, int32_t _colomn, int32_t _raw, float _x, float _y);
|
||||||
// derived function
|
// derived function
|
||||||
const char * const getObjectType(void) { return "TagFileList"; };
|
const char * const getObjectType(void) {
|
||||||
|
return "appl::TagFileList";
|
||||||
|
};
|
||||||
public:
|
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] file Compleate file name
|
||||||
* @param[in] jump line id
|
* @param[in] jump line id
|
||||||
*/
|
*/
|
||||||
void add(etk::UString& file, int32_t line);
|
void add(etk::UString& _file, int32_t _line);
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -23,11 +23,11 @@
|
|||||||
|
|
||||||
|
|
||||||
#undef __class__
|
#undef __class__
|
||||||
#define __class__ "TagFileSelection"
|
#define __class__ "TagFileSelection"
|
||||||
|
|
||||||
|
|
||||||
extern const char * const applEventctagsSelection = "appl-event-ctags-validate";
|
extern const char * const applEventctagsSelection = "appl-event-ctags-validate";
|
||||||
extern const char * const applEventctagsCancel = "appl-event-ctags-cancel";
|
extern const char * const applEventctagsCancel = "appl-event-ctags-cancel";
|
||||||
|
|
||||||
|
|
||||||
appl::TagFileSelection::TagFileSelection(void)
|
appl::TagFileSelection::TagFileSelection(void)
|
||||||
@ -54,7 +54,7 @@ appl::TagFileSelection::TagFileSelection(void)
|
|||||||
if (NULL == mySizerVert) {
|
if (NULL == mySizerVert) {
|
||||||
EWOL_ERROR("Can not allocate widget == > display might be in error");
|
EWOL_ERROR("Can not allocate widget == > display might be in error");
|
||||||
} else {
|
} else {
|
||||||
mySizerVert->LockExpand(bvec2(true,true));
|
mySizerVert->lockExpand(bvec2(true,true));
|
||||||
// set it in the pop-up-system :
|
// set it in the pop-up-system :
|
||||||
setSubWidget(mySizerVert);
|
setSubWidget(mySizerVert);
|
||||||
|
|
||||||
@ -124,19 +124,17 @@ appl::TagFileSelection::TagFileSelection(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
appl::TagFileSelection::~TagFileSelection(void)
|
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 );
|
||||||
EWOL_INFO("ctags LIST ... : \"" << _msg.getMessage() << "\" == > data=\"" << _msg.GetData() << "\"" );
|
|
||||||
if (_msg.getMessage() == applEventctagsSelection) {
|
if (_msg.getMessage() == applEventctagsSelection) {
|
||||||
if (m_eventNamed!="") {
|
if (m_eventNamed!="") {
|
||||||
generateEventId(applEventctagsSelection, m_eventNamed);
|
generateEventId(applEventctagsSelection, m_eventNamed);
|
||||||
// == > Auto remove ...
|
// == > Auto remove ...
|
||||||
AutoDestroy();
|
autoDestroy();
|
||||||
}
|
}
|
||||||
} else if (_msg.getMessage() == applEventCtagsListSelect) {
|
} else if (_msg.getMessage() == applEventCtagsListSelect) {
|
||||||
m_eventNamed = _msg.getData();
|
m_eventNamed = _msg.getData();
|
||||||
@ -146,11 +144,11 @@ void appl::TagFileSelection::onReceiveMessage(const ewol::EMessage& _msg)
|
|||||||
} else if (_msg.getMessage() == applEventCtagsListValidate) {
|
} else if (_msg.getMessage() == applEventCtagsListValidate) {
|
||||||
generateEventId(applEventctagsSelection, _msg.getData());
|
generateEventId(applEventctagsSelection, _msg.getData());
|
||||||
// == > Auto remove ...
|
// == > Auto remove ...
|
||||||
AutoDestroy();
|
autoDestroy();
|
||||||
} else if (_msg.getMessage() == applEventctagsCancel) {
|
} else if (_msg.getMessage() == applEventctagsCancel) {
|
||||||
generateEventId(applEventctagsCancel, "");
|
generateEventId(applEventctagsCancel, "");
|
||||||
// == > Auto remove ...
|
// == > Auto remove ...
|
||||||
AutoDestroy();
|
autoDestroy();
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
};
|
};
|
||||||
@ -161,15 +159,13 @@ void appl::TagFileSelection::onReceiveMessage(const ewol::EMessage& _msg)
|
|||||||
* @param[in] file Compleate file name
|
* @param[in] file Compleate file name
|
||||||
* @param[in] jump line id
|
* @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) {
|
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 :
|
// First step call parrent :
|
||||||
widget::PopUp::onObjectRemove(_removeObject);
|
widget::PopUp::onObjectRemove(_removeObject);
|
||||||
// second step find if in all the elements ...
|
// second step find if in all the elements ...
|
||||||
|
@ -17,11 +17,10 @@ extern const char * const applEventctagsSelection;
|
|||||||
extern const char * const applEventctagsCancel;
|
extern const char * const applEventctagsCancel;
|
||||||
|
|
||||||
namespace appl {
|
namespace appl {
|
||||||
class TagFileSelection : public widget::PopUp
|
class TagFileSelection : public widget::PopUp {
|
||||||
{
|
|
||||||
private:
|
private:
|
||||||
appl::TagFileList* m_listTag;
|
appl::TagFileList* m_listTag;
|
||||||
etk::UString m_eventNamed;
|
etk::UString m_eventNamed;
|
||||||
public:
|
public:
|
||||||
TagFileSelection(void);
|
TagFileSelection(void);
|
||||||
virtual ~TagFileSelection(void);
|
virtual ~TagFileSelection(void);
|
||||||
|
@ -6,8 +6,6 @@
|
|||||||
* @license GPL v3 (see license file)
|
* @license GPL v3 (see license file)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <CodeView.h>
|
|
||||||
|
|
||||||
#include <appl/Debug.h>
|
#include <appl/Debug.h>
|
||||||
#include <appl/global.h>
|
#include <appl/global.h>
|
||||||
#include <TextViewer.h>
|
#include <TextViewer.h>
|
||||||
@ -20,35 +18,34 @@
|
|||||||
#include <ewol/renderer/EObject.h>
|
#include <ewol/renderer/EObject.h>
|
||||||
|
|
||||||
#undef __class__
|
#undef __class__
|
||||||
#define __class__ "TextViewer"
|
#define __class__ "TextViewer"
|
||||||
|
|
||||||
appl::TextViewer::TextViewer(const etk::UString& _fontName, int32_t _fontSize) :
|
appl::TextViewer::TextViewer(const etk::UString& _fontName, int32_t _fontSize) :
|
||||||
m_buffer(NULL),
|
m_buffer(NULL),
|
||||||
m_displayText(_fontName, _fontSize),
|
m_displayText(_fontName, _fontSize),
|
||||||
m_insertMode(false)
|
m_insertMode(false) {
|
||||||
{
|
|
||||||
setCanHaveFocus(true);
|
setCanHaveFocus(true);
|
||||||
RegisterMultiCast(ednMsgBufferId);
|
registerMultiCast(ednMsgBufferId);
|
||||||
RegisterMultiCast(ednMsgGuiCopy);
|
registerMultiCast(ednMsgGuiCopy);
|
||||||
RegisterMultiCast(ednMsgGuiPaste);
|
registerMultiCast(ednMsgGuiPaste);
|
||||||
RegisterMultiCast(ednMsgGuiCut);
|
registerMultiCast(ednMsgGuiCut);
|
||||||
RegisterMultiCast(ednMsgGuiRedo);
|
registerMultiCast(ednMsgGuiRedo);
|
||||||
RegisterMultiCast(ednMsgGuiUndo);
|
registerMultiCast(ednMsgGuiUndo);
|
||||||
RegisterMultiCast(ednMsgGuiRm);
|
registerMultiCast(ednMsgGuiRm);
|
||||||
RegisterMultiCast(ednMsgGuiSelect);
|
registerMultiCast(ednMsgGuiSelect);
|
||||||
RegisterMultiCast(ednMsgGuiChangeCharset);
|
registerMultiCast(ednMsgGuiChangeCharset);
|
||||||
RegisterMultiCast(ednMsgGuiFind);
|
registerMultiCast(ednMsgGuiFind);
|
||||||
RegisterMultiCast(ednMsgGuiReplace);
|
registerMultiCast(ednMsgGuiReplace);
|
||||||
RegisterMultiCast(ednMsgGuiGotoLine);
|
registerMultiCast(ednMsgGuiGotoLine);
|
||||||
setLimitScrolling(0.2);
|
setLimitScrolling(0.2);
|
||||||
|
|
||||||
ShortCutAdd("ctrl+w", ednMsgGuiRm, "Line");
|
shortCutAdd("ctrl+w", ednMsgGuiRm, "Line");
|
||||||
ShortCutAdd("ctrl+shift+w", ednMsgGuiRm, "Paragraph");
|
shortCutAdd("ctrl+shift+w", ednMsgGuiRm, "Paragraph");
|
||||||
ShortCutAdd("ctrl+x", ednMsgGuiCut, "STD");
|
shortCutAdd("ctrl+x", ednMsgGuiCut, "STD");
|
||||||
ShortCutAdd("ctrl+c", ednMsgGuiCopy, "STD");
|
shortCutAdd("ctrl+c", ednMsgGuiCopy, "STD");
|
||||||
ShortCutAdd("ctrl+v", ednMsgGuiPaste, "STD");
|
shortCutAdd("ctrl+v", ednMsgGuiPaste, "STD");
|
||||||
ShortCutAdd("ctrl+a", ednMsgGuiSelect, "ALL");
|
shortCutAdd("ctrl+a", ednMsgGuiSelect, "ALL");
|
||||||
ShortCutAdd("ctrl+shift+a", ednMsgGuiSelect, "NONE");
|
shortCutAdd("ctrl+shift+a", ednMsgGuiSelect, "NONE");
|
||||||
|
|
||||||
// by default we load an example object:
|
// by default we load an example object:
|
||||||
|
|
||||||
@ -61,34 +58,27 @@ appl::TextViewer::TextViewer(const etk::UString& _fontName, int32_t _fontSize) :
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
appl::TextViewer::~TextViewer(void)
|
appl::TextViewer::~TextViewer(void) {
|
||||||
{
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool appl::TextViewer::calculateMinSize(void) {
|
||||||
bool appl::TextViewer::calculateMinSize(void)
|
|
||||||
{
|
|
||||||
m_minSize.setValue(50,50);
|
m_minSize.setValue(50,50);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void appl::TextViewer::calculateMaxSize(void)
|
void appl::TextViewer::calculateMaxSize(void) {
|
||||||
{
|
|
||||||
m_maxSize.setX(256);
|
m_maxSize.setX(256);
|
||||||
m_maxSize.setY(256);
|
m_maxSize.setY(256);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void appl::TextViewer::onDraw(void) {
|
||||||
void appl::TextViewer::onDraw(void)
|
|
||||||
{
|
|
||||||
m_displayDrawing.draw();
|
m_displayDrawing.draw();
|
||||||
m_displayText.draw();
|
m_displayText.draw();
|
||||||
WidgetScrooled::onDraw();
|
WidgetScrooled::onDraw();
|
||||||
}
|
}
|
||||||
|
|
||||||
void appl::TextViewer::onRegenerateDisplay(void)
|
void appl::TextViewer::onRegenerateDisplay(void) {
|
||||||
{
|
|
||||||
if (false == needRedraw()) {
|
if (false == needRedraw()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -157,7 +147,7 @@ void appl::TextViewer::onRegenerateDisplay(void)
|
|||||||
m_displayText.setPos(positionCurentDisplay);
|
m_displayText.setPos(positionCurentDisplay);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
m_buffer->Expand(countColomn, currentValue, stringToDisplay);
|
m_buffer->expand(countColomn, currentValue, stringToDisplay);
|
||||||
//APPL_DEBUG("display : '" << currentValue << "' == > '" << stringToDisplay << "'");
|
//APPL_DEBUG("display : '" << currentValue << "' == > '" << stringToDisplay << "'");
|
||||||
//m_displayText.setPos(positionCurentDisplay);
|
//m_displayText.setPos(positionCurentDisplay);
|
||||||
for (esize_t kkk=0; kkk<stringToDisplay.size(); ++kkk) {
|
for (esize_t kkk=0; kkk<stringToDisplay.size(); ++kkk) {
|
||||||
@ -182,23 +172,19 @@ void appl::TextViewer::onRegenerateDisplay(void)
|
|||||||
WidgetScrooled::onRegenerateDisplay();
|
WidgetScrooled::onRegenerateDisplay();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool appl::TextViewer::onEventEntry(const ewol::EventEntry& _event) {
|
||||||
bool appl::TextViewer::onEventEntry(const ewol::EventEntry& _event)
|
|
||||||
{
|
|
||||||
if (m_buffer == NULL) {
|
if (m_buffer == NULL) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
// just forward event == > manage directly in the buffer
|
// just forward event == > manage directly in the buffer
|
||||||
if (m_buffer->onEventEntry(_event) == true) {
|
if (m_buffer->onEventEntry(_event, m_displayText) == true) {
|
||||||
markToRedraw();
|
markToRedraw();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
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) {
|
if (m_buffer != NULL) {
|
||||||
|
|
||||||
@ -207,42 +193,34 @@ bool appl::TextViewer::onEventInput(const ewol::EventInput& _event)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void appl::TextViewer::onEventClipboard(ewol::clipBoard::clipboardListe_te _clipboardID)
|
void appl::TextViewer::onEventClipboard(ewol::clipBoard::clipboardListe_te _clipboardID) {
|
||||||
{
|
|
||||||
if (m_buffer != NULL) {
|
if (m_buffer != NULL) {
|
||||||
//tmpBuffer->Paste(_clipboardID);
|
//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
|
// force redraw of the widget
|
||||||
markToRedraw();
|
markToRedraw();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void appl::TextViewer::onGetFocus(void) {
|
||||||
void appl::TextViewer::onGetFocus(void)
|
showKeyboard();
|
||||||
{
|
|
||||||
ShowKeyboard();
|
|
||||||
APPL_INFO("Focus - In");
|
APPL_INFO("Focus - In");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void appl::TextViewer::onLostFocus(void) {
|
||||||
void appl::TextViewer::onLostFocus(void)
|
hideKeyboard();
|
||||||
{
|
|
||||||
HideKeyboard();
|
|
||||||
APPL_INFO("Focus - out");
|
APPL_INFO("Focus - out");
|
||||||
}
|
}
|
||||||
|
|
||||||
void appl::TextViewer::setFontSize(int32_t _size)
|
void appl::TextViewer::setFontSize(int32_t _size) {
|
||||||
{
|
|
||||||
m_displayText.setFontSize(_size);
|
m_displayText.setFontSize(_size);
|
||||||
setScrollingSize(_size*3.0*1.46); // 1.46 is a magic number ...
|
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);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -10,7 +10,6 @@
|
|||||||
#define __APPL_TEXT_VIEWER_H__
|
#define __APPL_TEXT_VIEWER_H__
|
||||||
|
|
||||||
#include <appl/Debug.h>
|
#include <appl/Debug.h>
|
||||||
#include <CodeView.h>
|
|
||||||
#include <appl/Buffer/Buffer.h>
|
#include <appl/Buffer/Buffer.h>
|
||||||
#include <appl/globalMsg.h>
|
#include <appl/globalMsg.h>
|
||||||
|
|
||||||
@ -18,17 +17,15 @@
|
|||||||
#include <ewol/compositing/Text.h>
|
#include <ewol/compositing/Text.h>
|
||||||
#include <ewol/compositing/Drawing.h>
|
#include <ewol/compositing/Drawing.h>
|
||||||
|
|
||||||
namespace appl
|
namespace appl {
|
||||||
{
|
class TextViewer : public widget::WidgetScrooled {
|
||||||
class TextViewer : public widget::WidgetScrooled
|
|
||||||
{
|
|
||||||
public:
|
public:
|
||||||
TextViewer(const etk::UString& _fontName="", int32_t _fontSize=-1);
|
TextViewer(const etk::UString& _fontName="", int32_t _fontSize=-1);
|
||||||
virtual ~TextViewer(void);
|
virtual ~TextViewer(void);
|
||||||
private:
|
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)
|
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::Text m_displayText; //!< Text display properties.
|
||||||
ewol::drawing m_displayDrawing; //!< Other diaplay requested.
|
ewol::Drawing m_displayDrawing; //!< Other diaplay requested.
|
||||||
public:
|
public:
|
||||||
void setFontSize(int32_t _size);
|
void setFontSize(int32_t _size);
|
||||||
void setFontName(const etk::UString& _fontName);
|
void setFontName(const etk::UString& _fontName);
|
||||||
|
@ -16,20 +16,16 @@
|
|||||||
#define __class__ "Highlight"
|
#define __class__ "Highlight"
|
||||||
|
|
||||||
|
|
||||||
void Highlight::ParseRules(exml::Element* child, etk::Vector<HighlightPattern*> &mListPatern, int32_t level)
|
void Highlight::parseRules(exml::Element* _child, etk::Vector<HighlightPattern*>& _mListPatern, int32_t _level) {
|
||||||
{
|
|
||||||
// Create the patern ...
|
// Create the patern ...
|
||||||
HighlightPattern *myPattern = new HighlightPattern();
|
HighlightPattern *myPattern = new HighlightPattern();
|
||||||
// parse under Element
|
// parse under Element
|
||||||
myPattern->ParseRules(child, level);
|
myPattern->parseRules(_child, _level);
|
||||||
// add element in the list
|
// add element in the list
|
||||||
mListPatern.pushBack(myPattern);
|
_mListPatern.pushBack(myPattern);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Highlight::Highlight(const etk::UString& _xmlFilename) {
|
||||||
|
|
||||||
Highlight::Highlight(const etk::UString& _xmlFilename)
|
|
||||||
{
|
|
||||||
exml::Document doc;
|
exml::Document doc;
|
||||||
if (doc.load(_xmlFilename) == false) {
|
if (doc.load(_xmlFilename) == false) {
|
||||||
APPL_ERROR(" can not load file XML : " << _xmlFilename);
|
APPL_ERROR(" can not load file XML : " << _xmlFilename);
|
||||||
@ -63,10 +59,10 @@ Highlight::Highlight(const etk::UString& _xmlFilename)
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (passChild->getValue() != "rule") {
|
if (passChild->getValue() != "rule") {
|
||||||
APPL_ERROR("(l "<< passChild->getPos() << ") node not suported : \""<< passChild->GetValue() << "\" must be [rule]" );
|
APPL_ERROR("(l "<< passChild->getPos() << ") node not suported : \""<< passChild->getValue() << "\" must be [rule]" );
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
ParseRules(passChild, m_listHighlightPass1, level1++);
|
parseRules(passChild, m_listHighlightPass1, level1++);
|
||||||
}
|
}
|
||||||
} else if (child->getValue() == "pass2") {
|
} else if (child->getValue() == "pass2") {
|
||||||
// get sub Nodes ...
|
// get sub Nodes ...
|
||||||
@ -76,19 +72,18 @@ Highlight::Highlight(const etk::UString& _xmlFilename)
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (passChild->getValue() != "rule") {
|
if (passChild->getValue() != "rule") {
|
||||||
APPL_ERROR("(l "<< passChild->getPos() << ") node not suported : \""<< passChild->GetValue() << "\" must be [rule]" );
|
APPL_ERROR("(l "<< passChild->getPos() << ") node not suported : \""<< passChild->getValue() << "\" must be [rule]" );
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
ParseRules(passChild, m_listHighlightPass2, level2++);
|
parseRules(passChild, m_listHighlightPass2, level2++);
|
||||||
}
|
}
|
||||||
} else {
|
} 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]" );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Highlight::~Highlight(void)
|
Highlight::~Highlight(void) {
|
||||||
{
|
|
||||||
int32_t i;
|
int32_t i;
|
||||||
// clean all Element
|
// clean all Element
|
||||||
for (i=0; i< m_listHighlightPass1.size(); i++) {
|
for (i=0; i< m_listHighlightPass1.size(); i++) {
|
||||||
@ -103,23 +98,21 @@ Highlight::~Highlight(void)
|
|||||||
m_listExtentions.clear();
|
m_listExtentions.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Highlight::ReloadColor(void)
|
void Highlight::reloadColor(void) {
|
||||||
{
|
|
||||||
int32_t i;
|
int32_t i;
|
||||||
for (i=0; i< m_listHighlightPass1.size(); i++) {
|
for (i=0; i< m_listHighlightPass1.size(); i++) {
|
||||||
if (NULL != m_listHighlightPass1[i]) {
|
if (NULL != m_listHighlightPass1[i]) {
|
||||||
m_listHighlightPass1[i]->ReloadColor();
|
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]) {
|
if (NULL != m_listHighlightPass2[i]) {
|
||||||
m_listHighlightPass2[i]->ReloadColor();
|
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] ) {
|
if (_ext == m_listExtentions[iii] ) {
|
||||||
return true;
|
return true;
|
||||||
@ -128,8 +121,7 @@ bool Highlight::hasExtention(const etk::UString& _ext)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Highlight::fileNameCompatible(etk::FSNode &_fileName)
|
bool Highlight::fileNameCompatible(etk::FSNode &_fileName) {
|
||||||
{
|
|
||||||
etk::UString extention;
|
etk::UString extention;
|
||||||
if (true == _fileName.fileHasExtention() ) {
|
if (true == _fileName.fileHasExtention() ) {
|
||||||
extention = "*.";
|
extention = "*.";
|
||||||
@ -148,8 +140,7 @@ bool Highlight::fileNameCompatible(etk::FSNode &_fileName)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Highlight::display(void)
|
void Highlight::display(void) {
|
||||||
{
|
|
||||||
APPL_INFO("List of ALL Highlight : ");
|
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] );
|
APPL_INFO(" Extention : " << iii << " : " << m_listExtentions[iii] );
|
||||||
@ -169,12 +160,11 @@ void Highlight::display(void)
|
|||||||
|
|
||||||
|
|
||||||
// TODO : Celui qui appelle suprime des element pour rien ... Enfin c'est pas trègrave... Il suffirait juste de suprimer celuis d'avant si il n'est pas terminer...
|
// TODO : Celui qui appelle suprime des element pour rien ... Enfin c'est pas trègrave... Il suffirait juste de suprimer celuis d'avant si il n'est pas terminer...
|
||||||
void Highlight::Parse(int32_t start,
|
void Highlight::parse(int32_t start,
|
||||||
int32_t stop,
|
int32_t stop,
|
||||||
etk::Vector<colorInformation_ts> &metaData,
|
etk::Vector<colorInformation_ts> &metaData,
|
||||||
int32_t addingPos,
|
int32_t addingPos,
|
||||||
etk::Buffer &buffer)
|
etk::Buffer &buffer) {
|
||||||
{
|
|
||||||
if (0 > addingPos) {
|
if (0 > addingPos) {
|
||||||
addingPos = 0;
|
addingPos = 0;
|
||||||
}
|
}
|
||||||
@ -198,7 +188,7 @@ void Highlight::Parse(int32_t start,
|
|||||||
if (metaData[kkk].beginStart <= resultat.endStop) {
|
if (metaData[kkk].beginStart <= resultat.endStop) {
|
||||||
// remove element
|
// remove element
|
||||||
//APPL_INFO("Erase element=" << kkk);
|
//APPL_INFO("Erase element=" << kkk);
|
||||||
metaData.EraseLen(kkk, kkk+1);
|
metaData.eraseLen(kkk, kkk+1);
|
||||||
// Increase the end of search
|
// Increase the end of search
|
||||||
if (kkk < metaData.size()) {
|
if (kkk < metaData.size()) {
|
||||||
// just befor the end of the next element
|
// just befor the end of the next element
|
||||||
@ -233,11 +223,10 @@ void Highlight::Parse(int32_t start,
|
|||||||
* @brief second pass of the hightlight
|
* @brief second pass of the hightlight
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
void Highlight::Parse2(int32_t start,
|
void Highlight::parse2(int32_t start,
|
||||||
int32_t stop,
|
int32_t stop,
|
||||||
etk::Vector<colorInformation_ts> &metaData,
|
etk::Vector<colorInformation_ts> &metaData,
|
||||||
etk::Buffer &buffer)
|
etk::Buffer &buffer) {
|
||||||
{
|
|
||||||
//APPL_DEBUG("Parse element 0 => " << m_listHighlightPass2.size() << " == > position search: (" << start << "," << stop << ")" );
|
//APPL_DEBUG("Parse element 0 => " << m_listHighlightPass2.size() << " == > position search: (" << start << "," << stop << ")" );
|
||||||
int32_t elementStart = start;
|
int32_t elementStart = start;
|
||||||
int32_t elementStop = stop;
|
int32_t elementStop = stop;
|
||||||
|
@ -14,14 +14,13 @@ class Highlight;
|
|||||||
class HighlightPattern;
|
class HighlightPattern;
|
||||||
|
|
||||||
extern "C" {
|
extern "C" {
|
||||||
typedef struct
|
typedef struct {
|
||||||
{
|
int32_t beginStart;
|
||||||
int32_t beginStart;
|
int32_t beginStop;
|
||||||
int32_t beginStop;
|
int32_t endStart;
|
||||||
int32_t endStart;
|
int32_t endStop;
|
||||||
int32_t endStop;
|
bool notEnded;
|
||||||
bool notEnded;
|
HighlightPattern* patern; // pointer on class :
|
||||||
HighlightPattern * patern; // pointer on class :
|
|
||||||
} colorInformation_ts;
|
} colorInformation_ts;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -39,18 +38,18 @@ class Highlight {
|
|||||||
bool hasExtention(const etk::UString& _ext);
|
bool hasExtention(const etk::UString& _ext);
|
||||||
bool fileNameCompatible(etk::FSNode &_fileName);
|
bool fileNameCompatible(etk::FSNode &_fileName);
|
||||||
void display(void);
|
void display(void);
|
||||||
void ReloadColor(void);
|
void reloadColor(void);
|
||||||
void Parse(int32_t start,
|
void parse(int32_t start,
|
||||||
int32_t stop,
|
int32_t stop,
|
||||||
etk::Vector<colorInformation_ts> &metaData,
|
etk::Vector<colorInformation_ts> &metaData,
|
||||||
int32_t addingPos,
|
int32_t addingPos,
|
||||||
etk::Buffer &buffer);
|
etk::Buffer &buffer);
|
||||||
void Parse2(int32_t start,
|
void parse2(int32_t start,
|
||||||
int32_t stop,
|
int32_t stop,
|
||||||
etk::Vector<colorInformation_ts> &metaData,
|
etk::Vector<colorInformation_ts> &metaData,
|
||||||
etk::Buffer &buffer);
|
etk::Buffer &buffer);
|
||||||
private:
|
private:
|
||||||
void ParseRules(exml::Element* child, etk::Vector<HighlightPattern*> &mListPatern, int32_t level);
|
void parseRules(exml::Element* child, etk::Vector<HighlightPattern*> &mListPatern, int32_t level);
|
||||||
etk::UString m_styleName; //!< curent style name (like "c++" or "c" or "script Bash")
|
etk::UString m_styleName; //!< curent style name (like "c++" or "c" or "script Bash")
|
||||||
etk::Vector<etk::UString> m_listExtentions; //!< List of possible extention for this high-light, like : ".c", ".cpp", ".h"
|
etk::Vector<etk::UString> m_listExtentions; //!< List of possible extention for this high-light, like : ".c", ".cpp", ".h"
|
||||||
etk::Vector<HighlightPattern*> m_listHighlightPass1; //!< List of ALL hightlight modules (pass 1 == > when we load and wride data on the buffer)
|
etk::Vector<HighlightPattern*> m_listHighlightPass1; //!< List of ALL hightlight modules (pass 1 == > when we load and wride data on the buffer)
|
||||||
|
@ -13,12 +13,11 @@
|
|||||||
#include <ewol/renderer/EObjectManager.h>
|
#include <ewol/renderer/EObjectManager.h>
|
||||||
|
|
||||||
#undef __class__
|
#undef __class__
|
||||||
#define __class__ "HighlightManager"
|
#define __class__ "HighlightManager"
|
||||||
|
|
||||||
class localClassHighlightManager: public ewol::EObject
|
class localClassHighlightManager: public ewol::EObject {
|
||||||
{
|
|
||||||
private:
|
private:
|
||||||
etk::Vector<Highlight*> listHighlight; //!< List of ALL hightlight modules
|
etk::Vector<Highlight*> listHighlight; //!< List of ALL hightlight modules
|
||||||
public:
|
public:
|
||||||
// Constructeur
|
// Constructeur
|
||||||
localClassHighlightManager(void) {
|
localClassHighlightManager(void) {
|
||||||
@ -38,14 +37,12 @@ class localClassHighlightManager: public ewol::EObject
|
|||||||
};
|
};
|
||||||
|
|
||||||
// herited function
|
// herited function
|
||||||
const char * const getObjectType(void)
|
const char * const getObjectType(void) {
|
||||||
{
|
|
||||||
return "ApplHighlightManager";
|
return "ApplHighlightManager";
|
||||||
}
|
}
|
||||||
|
|
||||||
// herited function
|
// herited function
|
||||||
virtual void onReceiveMessage(const ewol::EMessage& _msg)
|
virtual void onReceiveMessage(const ewol::EMessage& _msg) {
|
||||||
{
|
|
||||||
/*
|
/*
|
||||||
switch (id)
|
switch (id)
|
||||||
{
|
{
|
||||||
@ -61,31 +58,27 @@ class localClassHighlightManager: public ewol::EObject
|
|||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
Highlight* get(etk::FSNode &fileName)
|
Highlight* get(etk::FSNode& _fileName) {
|
||||||
{
|
|
||||||
int32_t i;
|
int32_t i;
|
||||||
for (i=0; i<listHighlight.size(); i++) {
|
for (i=0; i<listHighlight.size(); ++i) {
|
||||||
if (true == listHighlight[i]->fileNameCompatible(fileName) ) {
|
if (true == listHighlight[i]->fileNameCompatible(_fileName) ) {
|
||||||
return listHighlight[i];
|
return listHighlight[i];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Exist(etk::FSNode &fileName)
|
bool exist(etk::FSNode& _fileName) {
|
||||||
{
|
if (NULL != get(_fileName) ) {
|
||||||
if (NULL != get(fileName) ) {
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void loadLanguages(void) {
|
||||||
void loadLanguages(void)
|
|
||||||
{
|
|
||||||
etk::FSNode myFile("DATA:languages/");
|
etk::FSNode myFile("DATA:languages/");
|
||||||
// get the subfolder list :
|
// get the subfolder list :
|
||||||
etk::Vector<etk::FSNode *> list = myFile.FolderGetSubList(false, true, false,false);
|
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 (NULL!=list[iii]) {
|
||||||
if (list[iii]->getNodeType() == etk::FSN_FOLDER) {
|
if (list[iii]->getNodeType() == etk::FSN_FOLDER) {
|
||||||
@ -98,15 +91,12 @@ class localClassHighlightManager: public ewol::EObject
|
|||||||
}
|
}
|
||||||
//myHightline->display();
|
//myHightline->display();
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
static localClassHighlightManager * localManager = NULL;
|
static localClassHighlightManager * localManager = NULL;
|
||||||
|
|
||||||
|
|
||||||
|
void HighlightManager::init(void) {
|
||||||
void HighlightManager::init(void)
|
|
||||||
{
|
|
||||||
if (NULL != localManager) {
|
if (NULL != localManager) {
|
||||||
APPL_ERROR("HighlightManager == > already exist, just unlink the previous ...");
|
APPL_ERROR("HighlightManager == > already exist, just unlink the previous ...");
|
||||||
localManager = NULL;
|
localManager = NULL;
|
||||||
@ -118,8 +108,7 @@ void HighlightManager::init(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void HighlightManager::UnInit(void)
|
void HighlightManager::unInit(void) {
|
||||||
{
|
|
||||||
if (NULL == localManager) {
|
if (NULL == localManager) {
|
||||||
APPL_ERROR("HighlightManager == > request UnInit, but does not exist ...");
|
APPL_ERROR("HighlightManager == > request UnInit, but does not exist ...");
|
||||||
return;
|
return;
|
||||||
@ -128,28 +117,25 @@ void HighlightManager::UnInit(void)
|
|||||||
localManager = NULL;
|
localManager = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
void HighlightManager::loadLanguages(void)
|
void HighlightManager::loadLanguages(void) {
|
||||||
{
|
|
||||||
if (NULL == localManager) {
|
if (NULL == localManager) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
localManager->loadLanguages();
|
localManager->loadLanguages();
|
||||||
}
|
}
|
||||||
|
|
||||||
Highlight* HighlightManager::get(etk::FSNode &fileName)
|
Highlight* HighlightManager::get(etk::FSNode& _fileName) {
|
||||||
{
|
|
||||||
if (NULL == localManager) {
|
if (NULL == localManager) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
return localManager->get(fileName);
|
return localManager->get(_fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool HighlightManager::Exist(etk::FSNode &fileName)
|
bool HighlightManager::exist(etk::FSNode& _fileName) {
|
||||||
{
|
|
||||||
if (NULL == localManager) {
|
if (NULL == localManager) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return localManager->Exist(fileName);
|
return localManager->exist(_fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -16,11 +16,11 @@
|
|||||||
#include <ewol/widget/Widget.h>
|
#include <ewol/widget/Widget.h>
|
||||||
|
|
||||||
namespace HighlightManager{
|
namespace HighlightManager{
|
||||||
void init(void);
|
void init(void);
|
||||||
void UnInit(void);
|
void unInit(void);
|
||||||
void loadLanguages(void);
|
void loadLanguages(void);
|
||||||
Highlight* get(etk::FSNode &fileName);
|
Highlight* get(etk::FSNode &fileName);
|
||||||
bool Exist(etk::FSNode &fileName);
|
bool exist(etk::FSNode &fileName);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -11,14 +11,10 @@
|
|||||||
#include <HighlightPattern.h>
|
#include <HighlightPattern.h>
|
||||||
#include <ColorizeManager.h>
|
#include <ColorizeManager.h>
|
||||||
|
|
||||||
|
|
||||||
#undef __class__
|
#undef __class__
|
||||||
#define __class__ "HighlightPattern"
|
#define __class__ "HighlightPattern"
|
||||||
|
|
||||||
|
HighlightPattern::HighlightPattern(void) {
|
||||||
|
|
||||||
HighlightPattern::HighlightPattern(void)
|
|
||||||
{
|
|
||||||
m_haveStopPatern = false;
|
m_haveStopPatern = false;
|
||||||
m_multiline = false;
|
m_multiline = false;
|
||||||
m_color = ColorizeManager::get("normal");
|
m_color = ColorizeManager::get("normal");
|
||||||
@ -27,64 +23,46 @@ HighlightPattern::HighlightPattern(void)
|
|||||||
m_escapeChar = 0;
|
m_escapeChar = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
HighlightPattern::~HighlightPattern(void)
|
HighlightPattern::~HighlightPattern(void) {
|
||||||
{
|
|
||||||
delete(m_regExpStart);
|
delete(m_regExpStart);
|
||||||
delete(m_regExpStop);
|
delete(m_regExpStop);
|
||||||
}
|
}
|
||||||
|
|
||||||
void HighlightPattern::setPaternStart(etk::UString ®Exp)
|
void HighlightPattern::setPaternStart(etk::UString& _regExp) {
|
||||||
{
|
m_regExpStart->setRegExp(_regExp);
|
||||||
m_regExpStart->setRegExp(regExp);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void HighlightPattern::setPaternStop(etk::UString ®Exp)
|
void HighlightPattern::setPaternStop(etk::UString& _regExp) {
|
||||||
{
|
if (_regExp.size() != 0) {
|
||||||
if (regExp.size() != 0) {
|
m_regExpStop->setRegExp(_regExp);
|
||||||
m_regExpStop->setRegExp(regExp);
|
|
||||||
m_haveStopPatern = true;
|
m_haveStopPatern = true;
|
||||||
} else {
|
} else {
|
||||||
m_haveStopPatern = false;
|
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];
|
||||||
m_escapeChar = EscapeChar[0];
|
|
||||||
} else {
|
} else {
|
||||||
m_escapeChar = 0;
|
m_escapeChar = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void HighlightPattern::setColor(etk::UString& _colorName) {
|
||||||
void HighlightPattern::setColor(etk::UString &colorName)
|
m_colorName = _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;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void HighlightPattern::reloadColor(void) {
|
||||||
void HighlightPattern::ReloadColor(void)
|
|
||||||
{
|
|
||||||
m_color = ColorizeManager::get(m_colorName);
|
m_color = ColorizeManager::get(m_colorName);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
void HighlightPattern::display(void) {
|
||||||
* @brief
|
|
||||||
*
|
|
||||||
* @param[in,out]
|
|
||||||
*
|
|
||||||
* @eturn
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
void HighlightPattern::display(void)
|
|
||||||
{
|
|
||||||
/*
|
/*
|
||||||
APPL_INFO("patern : \"" << m_paternName << "\" level=" << m_level );
|
APPL_INFO("patern : \"" << m_paternName << "\" level=" << m_level );
|
||||||
APPL_INFO(" == > colorName \"" << m_colorName << "\"");
|
APPL_INFO(" == > colorName \"" << m_colorName << "\"");
|
||||||
@ -107,8 +85,8 @@ void HighlightPattern::display(void)
|
|||||||
m_subPatern[i]->display();
|
m_subPatern[i]->display();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
void HighlightPattern::ParseRules(exml::Element *child, int32_t level)
|
|
||||||
{
|
void HighlightPattern::parseRules(exml::Element *child, int32_t level) {
|
||||||
//--------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------
|
||||||
/*
|
/*
|
||||||
<rule name="my preprocesseur">
|
<rule name="my preprocesseur">
|
||||||
@ -191,8 +169,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_OK_NO_END Xe find a partial pattern (missing end)
|
||||||
* @return HLP_FIND_ERROR Not find the pattern
|
* @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");
|
//APPL_DEBUG(" try to find the element");
|
||||||
resultat.beginStart = -1;
|
resultat.beginStart = -1;
|
||||||
resultat.beginStop = -1;
|
resultat.beginStop = -1;
|
||||||
@ -203,22 +180,22 @@ resultFind_te HighlightPattern::find(int32_t start, int32_t stop, colorInformati
|
|||||||
|
|
||||||
// when we have only one element :
|
// when we have only one element :
|
||||||
if (false == m_haveStopPatern) {
|
if (false == m_haveStopPatern) {
|
||||||
if (true == m_regExpStart->ProcessOneElement(buffer, start, stop)) {
|
if (true == m_regExpStart->processOneElement(buffer, start, stop)) {
|
||||||
resultat.beginStart = m_regExpStart->Start();
|
resultat.beginStart = m_regExpStart->start();
|
||||||
resultat.beginStop = m_regExpStart->Stop();
|
resultat.beginStop = m_regExpStart->stop();
|
||||||
resultat.endStart = m_regExpStart->Start();
|
resultat.endStart = m_regExpStart->start();
|
||||||
resultat.endStop = m_regExpStart->Stop();
|
resultat.endStop = m_regExpStart->stop();
|
||||||
return HLP_FIND_OK;
|
return HLP_FIND_OK;
|
||||||
}
|
}
|
||||||
//APPL_DEBUG("NOT find hightlightpatern ...");
|
//APPL_DEBUG("NOT find hightlightpatern ...");
|
||||||
} else {
|
} else {
|
||||||
// try while we find the first element
|
// try while we find the first element
|
||||||
if (true == m_regExpStart->ProcessOneElement(buffer, start, stop, m_escapeChar)) {
|
if (true == m_regExpStart->processOneElement(buffer, start, stop, m_escapeChar)) {
|
||||||
resultat.beginStart = m_regExpStart->Start();
|
resultat.beginStart = m_regExpStart->start();
|
||||||
resultat.beginStop = m_regExpStart->Stop();
|
resultat.beginStop = m_regExpStart->stop();
|
||||||
if (true == m_regExpStop->Process(buffer, resultat.beginStop, stop, m_escapeChar)) {
|
if (true == m_regExpStop->process(buffer, resultat.beginStop, stop, m_escapeChar)) {
|
||||||
resultat.endStart = m_regExpStop->Start();
|
resultat.endStart = m_regExpStop->start();
|
||||||
resultat.endStop = m_regExpStop->Stop();
|
resultat.endStop = m_regExpStop->stop();
|
||||||
return HLP_FIND_OK;
|
return HLP_FIND_OK;
|
||||||
} else {
|
} else {
|
||||||
resultat.endStart = stop+1;
|
resultat.endStart = stop+1;
|
||||||
|
@ -26,7 +26,6 @@ typedef enum {
|
|||||||
HLP_FIND_OK_NO_END,
|
HLP_FIND_OK_NO_END,
|
||||||
}resultFind_te;
|
}resultFind_te;
|
||||||
|
|
||||||
class HighlightPattern;
|
|
||||||
|
|
||||||
class HighlightPattern {
|
class HighlightPattern {
|
||||||
public:
|
public:
|
||||||
@ -34,38 +33,50 @@ class HighlightPattern {
|
|||||||
HighlightPattern(void);
|
HighlightPattern(void);
|
||||||
~HighlightPattern(void);
|
~HighlightPattern(void);
|
||||||
|
|
||||||
void setName(etk::UString &name) { m_paternName = name;};
|
void setName(etk::UString& _name) {
|
||||||
etk::UString getName(void) { return m_paternName;};
|
m_paternName = _name;
|
||||||
|
};
|
||||||
|
etk::UString getName(void) {
|
||||||
|
return m_paternName;
|
||||||
|
};
|
||||||
|
|
||||||
void setPaternStart(etk::UString ®Exp);
|
void setPaternStart(etk::UString& _regExp);
|
||||||
void setPaternStop(etk::UString ®Exp);
|
void setPaternStop(etk::UString& _regExp);
|
||||||
void setColor(etk::UString &colorName);
|
void setColor(etk::UString& _colorName);
|
||||||
void setEscapeChar(etk::UString &EscapeChar);
|
void setEscapeChar(etk::UString& _EscapeChar);
|
||||||
void setMultiline(bool enable) { m_multiline = enable; };
|
void setMultiline(bool _enable) {
|
||||||
|
m_multiline = _enable;
|
||||||
|
};
|
||||||
|
|
||||||
void setLevel(int32_t newLevel) { m_level = newLevel; };
|
void setLevel(int32_t _newLevel) {
|
||||||
int32_t getLevel(void) { return m_level; };
|
m_level = _newLevel;
|
||||||
|
};
|
||||||
|
int32_t getLevel(void) {
|
||||||
|
return m_level;
|
||||||
|
};
|
||||||
|
|
||||||
bool isEnable(void);
|
bool isEnable(void);
|
||||||
void display(void);
|
void display(void);
|
||||||
resultFind_te find(int32_t start, int32_t stop, colorInformation_ts &resultat, etk::Buffer &buffer);
|
resultFind_te find(int32_t _start, int32_t _stop, colorInformation_ts& _resultat, etk::Buffer& _buffer);
|
||||||
Colorize * getColor(void) { return m_color; };
|
Colorize* getColor(void) {
|
||||||
void ParseRules(exml::Element *child, int32_t level);
|
return m_color;
|
||||||
|
};
|
||||||
|
void parseRules(exml::Element* _child, int32_t _level);
|
||||||
|
|
||||||
void ReloadColor(void);
|
void reloadColor(void);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
int32_t m_level; //!< Level of the pattern == > this is to overwrite next pattern when we create an higher ....
|
int32_t m_level; //!< Level of the pattern == > this is to overwrite next pattern when we create an higher ....
|
||||||
etk::UString m_paternName; //!< Current style name (like "c++" or "c" or "script Bash")
|
etk::UString m_paternName; //!< Current style name (like "c++" or "c" or "script Bash")
|
||||||
etk::UString m_colorName; //!< Current color name
|
etk::UString m_colorName; //!< Current color name
|
||||||
Colorize * m_color; //!< Link to the color manager
|
Colorize* m_color; //!< Link to the color manager
|
||||||
etk::RegExp<etk::Buffer> * m_regExpStart; //!< Start of Regular expression
|
etk::RegExp<etk::Buffer>* m_regExpStart; //!< Start of Regular expression
|
||||||
etk::RegExp<etk::Buffer> * m_regExpStop; //!< Stop of Regular Expression
|
etk::RegExp<etk::Buffer>* m_regExpStop; //!< Stop of Regular Expression
|
||||||
bool m_haveStopPatern; //!< Stop patern presence
|
bool m_haveStopPatern; //!< Stop patern presence
|
||||||
bool m_multiline; //!< The patern is multiline
|
bool m_multiline; //!< The patern is multiline
|
||||||
etk::UniChar m_escapeChar; //!< Escape char to prevent exeit of patern ....
|
etk::UniChar m_escapeChar; //!< Escape char to prevent exeit of patern ....
|
||||||
etk::Vector<HighlightPattern *> m_subPatern; //!< Under patern of this one
|
etk::Vector<HighlightPattern*> m_subPatern; //!< Under patern of this one
|
||||||
// etk::Vector<HighlightPattern *> m_subColor; //!< Under Color in the start RegExp ...
|
// etk::Vector<HighlightPattern*> m_subColor; //!< Under Color in the start RegExp ...
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -18,25 +18,23 @@
|
|||||||
// TODO : The line ID is no more stored in the file system (FSNode) ...
|
// TODO : The line ID is no more stored in the file system (FSNode) ...
|
||||||
|
|
||||||
#undef __class__
|
#undef __class__
|
||||||
#define __class__ "CTagsManager"
|
#define __class__ "CTagsManager"
|
||||||
|
|
||||||
class CTagsManager: public ewol::EObject
|
class CTagsManager: public ewol::EObject {
|
||||||
{
|
|
||||||
public:
|
public:
|
||||||
// Constructeur
|
// Constructeur
|
||||||
CTagsManager(void);
|
CTagsManager(void);
|
||||||
~CTagsManager(void);
|
~CTagsManager(void);
|
||||||
|
|
||||||
const char * const getObjectType(void)
|
const char * const getObjectType(void) {
|
||||||
{
|
|
||||||
return "CTagsManager";
|
return "CTagsManager";
|
||||||
};
|
};
|
||||||
void onReceiveMessage(const ewol::EMessage& _msg);
|
void onReceiveMessage(const ewol::EMessage& _msg);
|
||||||
|
|
||||||
int32_t m_currentSelectedID;
|
int32_t m_currentSelectedID;
|
||||||
void loadTagFile(void);
|
void loadTagFile(void);
|
||||||
int32_t MultipleJump(void);
|
int32_t multipleJump(void);
|
||||||
void JumpTo(void);
|
void jumpTo(void);
|
||||||
void printTag(const tagEntry *entry);
|
void printTag(const tagEntry *entry);
|
||||||
etk::UString getFolder(etk::UString &inputString);
|
etk::UString getFolder(etk::UString &inputString);
|
||||||
etk::UString m_tagFolderBase;
|
etk::UString m_tagFolderBase;
|
||||||
@ -45,12 +43,11 @@ class CTagsManager: public ewol::EObject
|
|||||||
// history system
|
// history system
|
||||||
int32_t m_historyPos;
|
int32_t m_historyPos;
|
||||||
etk::Vector<etk::FSNode*> m_historyList;
|
etk::Vector<etk::FSNode*> m_historyList;
|
||||||
void RegisterHistory(void);
|
void registerHistory(void);
|
||||||
};
|
};
|
||||||
|
|
||||||
static CTagsManager* s_elementPointer = NULL;
|
static CTagsManager* s_elementPointer = NULL;
|
||||||
void cTagsManager::init(void)
|
void cTagsManager::init(void) {
|
||||||
{
|
|
||||||
if (NULL != s_elementPointer) {
|
if (NULL != s_elementPointer) {
|
||||||
s_elementPointer = NULL;
|
s_elementPointer = NULL;
|
||||||
EWOL_WARNING("Ctags manager already instanciate ... == > restart IT (can have memory leek ...)");
|
EWOL_WARNING("Ctags manager already instanciate ... == > restart IT (can have memory leek ...)");
|
||||||
@ -60,8 +57,7 @@ void cTagsManager::init(void)
|
|||||||
EWOL_ERROR("Ctags manager error to instanciate ...");
|
EWOL_ERROR("Ctags manager error to instanciate ...");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
void cTagsManager::UnInit(void)
|
void cTagsManager::unInit(void) {
|
||||||
{
|
|
||||||
if (NULL != s_elementPointer) {
|
if (NULL != s_elementPointer) {
|
||||||
delete(s_elementPointer);
|
delete(s_elementPointer);
|
||||||
s_elementPointer = NULL;
|
s_elementPointer = NULL;
|
||||||
@ -70,38 +66,18 @@ void cTagsManager::UnInit(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CTagsManager::CTagsManager(void) {
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief
|
|
||||||
*
|
|
||||||
* @param[in,out] ---
|
|
||||||
*
|
|
||||||
* @return ---
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
CTagsManager::CTagsManager(void)
|
|
||||||
{
|
|
||||||
m_tagFilename = "";
|
m_tagFilename = "";
|
||||||
m_tagFolderBase = "";
|
m_tagFolderBase = "";
|
||||||
m_ctagFile = NULL;
|
m_ctagFile = NULL;
|
||||||
m_historyPos = 0;
|
m_historyPos = 0;
|
||||||
RegisterMultiCast(ednMsgGuiCtags);
|
registerMultiCast(ednMsgGuiCtags);
|
||||||
RegisterMultiCast(ednMsgBufferId);
|
registerMultiCast(ednMsgBufferId);
|
||||||
RegisterMultiCast(ednMsgCtagsLoadFile);
|
registerMultiCast(ednMsgCtagsLoadFile);
|
||||||
EWOL_INFO("Ctags manager (INIT)");
|
EWOL_INFO("Ctags manager (INIT)");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
CTagsManager::~CTagsManager(void) {
|
||||||
* @brief
|
|
||||||
*
|
|
||||||
* @param[in,out] ---
|
|
||||||
*
|
|
||||||
* @return ---
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
CTagsManager::~CTagsManager(void)
|
|
||||||
{
|
|
||||||
EWOL_INFO("Ctags manager (Un-INIT)");
|
EWOL_INFO("Ctags manager (Un-INIT)");
|
||||||
if(0 != m_historyList.size()) {
|
if(0 != m_historyList.size()) {
|
||||||
for (int32_t iii=0; iii< m_historyList.size(); iii++) {
|
for (int32_t iii=0; iii< m_historyList.size(); iii++) {
|
||||||
@ -113,8 +89,7 @@ CTagsManager::~CTagsManager(void)
|
|||||||
|
|
||||||
const char * ednEventPopUpCtagsLoadFile = "edn-event-load-ctags";
|
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 << "\"" );
|
//EWOL_INFO("ctags manager event ... : \"" << eventId << "\" == > data=\"" << data << "\"" );
|
||||||
if (_msg.getMessage() == ednMsgBufferId) {
|
if (_msg.getMessage() == ednMsgBufferId) {
|
||||||
//m_currentSelectedID = dataID;
|
//m_currentSelectedID = dataID;
|
||||||
@ -129,7 +104,7 @@ void CTagsManager::onReceiveMessage(const ewol::EMessage& _msg)
|
|||||||
} else if (_msg.getMessage() == ednMsgGuiCtags) {
|
} else if (_msg.getMessage() == ednMsgGuiCtags) {
|
||||||
if (_msg.getData() == "Load") {
|
if (_msg.getData() == "Load") {
|
||||||
APPL_INFO("Request opening ctag file");
|
APPL_INFO("Request opening ctag file");
|
||||||
widget::fileChooser* tmpWidget = new widget::FileChooser();
|
widget::FileChooser* tmpWidget = new widget::FileChooser();
|
||||||
if (NULL == tmpWidget) {
|
if (NULL == tmpWidget) {
|
||||||
APPL_ERROR("Can not allocate widget == > display might be in error");
|
APPL_ERROR("Can not allocate widget == > display might be in error");
|
||||||
} else {
|
} else {
|
||||||
@ -142,12 +117,12 @@ void CTagsManager::onReceiveMessage(const ewol::EMessage& _msg)
|
|||||||
APPL_INFO("Request re-load ctag file");
|
APPL_INFO("Request re-load ctag file");
|
||||||
loadTagFile();
|
loadTagFile();
|
||||||
} else if (_msg.getData() == "Jump") {
|
} else if (_msg.getData() == "Jump") {
|
||||||
JumpTo();
|
jumpTo();
|
||||||
} else if (_msg.getData() == "Back") {
|
} else if (_msg.getData() == "Back") {
|
||||||
if (m_historyList.size() > 0) {
|
if (m_historyList.size() > 0) {
|
||||||
int32_t id = m_historyList.size()-1;
|
int32_t id = m_historyList.size()-1;
|
||||||
SendMultiCast(ednMsgOpenFile, m_historyList[id]->getName() );
|
sendMultiCast(ednMsgOpenFile, m_historyList[id]->getName() );
|
||||||
SendMultiCast(ednMsgGuiGotoLine, 0);// TODO : m_historyList[id]->getLineNumber());
|
sendMultiCast(ednMsgGuiGotoLine, 0);// TODO : m_historyList[id]->getLineNumber());
|
||||||
// remove element ....
|
// remove element ....
|
||||||
delete(m_historyList[id]);
|
delete(m_historyList[id]);
|
||||||
m_historyList[id]=NULL;
|
m_historyList[id]=NULL;
|
||||||
@ -158,22 +133,20 @@ void CTagsManager::onReceiveMessage(const ewol::EMessage& _msg)
|
|||||||
}
|
}
|
||||||
} else if (_msg.getMessage() == applEventctagsSelection) {
|
} else if (_msg.getMessage() == applEventctagsSelection) {
|
||||||
// save the current file in the history
|
// save the current file in the history
|
||||||
RegisterHistory();
|
registerHistory();
|
||||||
// parse the input data
|
// parse the input data
|
||||||
char tmp[4096];
|
char tmp[4096];
|
||||||
int32_t lineID;
|
int32_t lineID;
|
||||||
sscanf(_msg.getData().c_str(), "%d:%s", &lineID, tmp);
|
sscanf(_msg.getData().c_str(), "%d:%s", &lineID, tmp);
|
||||||
// generate envents
|
// generate envents
|
||||||
SendMultiCast(ednMsgOpenFile, tmp);
|
sendMultiCast(ednMsgOpenFile, tmp);
|
||||||
SendMultiCast(ednMsgGuiGotoLine, lineID - 1);
|
sendMultiCast(ednMsgGuiGotoLine, lineID - 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void CTagsManager::loadTagFile(void)
|
void CTagsManager::loadTagFile(void) {
|
||||||
{
|
|
||||||
tagFileInfo info;
|
tagFileInfo info;
|
||||||
|
|
||||||
// close previous tag file
|
// close previous tag file
|
||||||
if (NULL != m_ctagFile) {
|
if (NULL != m_ctagFile) {
|
||||||
tagsClose(m_ctagFile);
|
tagsClose(m_ctagFile);
|
||||||
@ -192,11 +165,10 @@ void CTagsManager::loadTagFile(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CTagsManager::registerHistory(void) {
|
||||||
void CTagsManager::RegisterHistory(void)
|
|
||||||
{
|
|
||||||
APPL_INFO("save curent filename and position : ");
|
APPL_INFO("save curent filename and position : ");
|
||||||
int32_t currentSelected = BufferManager::getSelected();
|
int32_t currentSelected = BufferManager::getSelected();
|
||||||
|
/*
|
||||||
BufferText* tmpBuf = BufferManager::get(currentSelected);
|
BufferText* tmpBuf = BufferManager::get(currentSelected);
|
||||||
if (NULL != tmpBuf) {
|
if (NULL != tmpBuf) {
|
||||||
etk::FSNode * bufferFilename = new etk::FSNode();
|
etk::FSNode * bufferFilename = new etk::FSNode();
|
||||||
@ -204,11 +176,10 @@ void CTagsManager::RegisterHistory(void)
|
|||||||
// TODO : bufferFilename->setLineNumber(tmpBuf->getCurrentLine());
|
// TODO : bufferFilename->setLineNumber(tmpBuf->getCurrentLine());
|
||||||
m_historyList.pushBack(bufferFilename);
|
m_historyList.pushBack(bufferFilename);
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CTagsManager::jumpTo(void) {
|
||||||
void CTagsManager::JumpTo(void)
|
|
||||||
{
|
|
||||||
if (NULL != m_ctagFile) {
|
if (NULL != m_ctagFile) {
|
||||||
// get the middle button of the clipboard == > represent the current selection ...
|
// 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);
|
||||||
@ -246,10 +217,10 @@ void CTagsManager::JumpTo(void)
|
|||||||
tmpWidget->registerOnEvent(this, applEventctagsSelection);
|
tmpWidget->registerOnEvent(this, applEventctagsSelection);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
RegisterHistory();
|
registerHistory();
|
||||||
APPL_INFO(" OPEN the TAG file Destination : " << tmpFile );
|
APPL_INFO(" OPEN the TAG file Destination : " << tmpFile );
|
||||||
SendMultiCast(ednMsgOpenFile, myfile.getName());
|
sendMultiCast(ednMsgOpenFile, myfile.getName());
|
||||||
SendMultiCast(ednMsgGuiGotoLine, lineID - 1);
|
sendMultiCast(ednMsgGuiGotoLine, lineID - 1);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
APPL_INFO("no tag find ...");
|
APPL_INFO("no tag find ...");
|
||||||
@ -258,8 +229,7 @@ void CTagsManager::JumpTo(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void CTagsManager::printTag(const tagEntry *entry)
|
void CTagsManager::printTag(const tagEntry *entry) {
|
||||||
{
|
|
||||||
#if 1
|
#if 1
|
||||||
APPL_INFO("find Tag file : name=\"" << entry->name << "\" in file=\"" << entry->file
|
APPL_INFO("find Tag file : name=\"" << entry->name << "\" in file=\"" << entry->file
|
||||||
<< "\" at line="<< (int32_t)entry->address.lineNumber);
|
<< "\" at line="<< (int32_t)entry->address.lineNumber);
|
||||||
|
@ -16,10 +16,9 @@
|
|||||||
|
|
||||||
#define MAX_REG_EXP_SEARCH (1024)
|
#define MAX_REG_EXP_SEARCH (1024)
|
||||||
|
|
||||||
namespace cTagsManager
|
namespace cTagsManager {
|
||||||
{
|
|
||||||
void init(void);
|
void init(void);
|
||||||
void UnInit(void);
|
void unInit(void);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -16,10 +16,9 @@
|
|||||||
//#include <ewol/UserConfig.h>
|
//#include <ewol/UserConfig.h>
|
||||||
|
|
||||||
#undef __class__
|
#undef __class__
|
||||||
#define __class__ "globals"
|
#define __class__ "globals"
|
||||||
|
|
||||||
class myParamGlobal : public ewol::EObject
|
class myParamGlobal : public ewol::EObject {
|
||||||
{
|
|
||||||
public:
|
public:
|
||||||
static const char * const configEOL;
|
static const char * const configEOL;
|
||||||
static const char * const configAutoIndent;
|
static const char * const configAutoIndent;
|
||||||
@ -44,8 +43,7 @@ class myParamGlobal : public ewol::EObject
|
|||||||
registerConfig(configShowSpaceChar, "bool", NULL, "Display the space 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 ...)
|
// Not set the EObject node parameter (name == > not change ...)
|
||||||
if (_conf.getConfig() == configEOL) {
|
if (_conf.getConfig() == configEOL) {
|
||||||
m_displayEOL = _conf.getData().toBool();
|
m_displayEOL = _conf.getData().toBool();
|
||||||
@ -65,8 +63,7 @@ class myParamGlobal : public ewol::EObject
|
|||||||
}
|
}
|
||||||
return false;
|
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 ...)
|
// Not set the EObject node parameter (name == > not change ...)
|
||||||
if (_config == configEOL) {
|
if (_config == configEOL) {
|
||||||
if (true == m_displayEOL) {
|
if (true == m_displayEOL) {
|
||||||
@ -109,90 +106,69 @@ const char * const myParamGlobal::configAutoIndent = "auto-indent";
|
|||||||
const char * const myParamGlobal::configShowTabChar = "display-tab";
|
const char * const myParamGlobal::configShowTabChar = "display-tab";
|
||||||
const char * const myParamGlobal::configShowSpaceChar = "display-space";
|
const char * const myParamGlobal::configShowSpaceChar = "display-space";
|
||||||
|
|
||||||
static myParamGlobal& l_obj(void)
|
static myParamGlobal& l_obj(void) {
|
||||||
{
|
|
||||||
static myParamGlobal s_obj;
|
static myParamGlobal s_obj;
|
||||||
return s_obj;
|
return s_obj;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void globals::init(void) {
|
||||||
|
|
||||||
void globals::init(void)
|
|
||||||
{
|
|
||||||
//ewol::userConfig::addUserConfig(&l_obj());
|
//ewol::userConfig::addUserConfig(&l_obj());
|
||||||
}
|
}
|
||||||
|
|
||||||
void globals::UnInit(void)
|
void globals::UnInit(void) {
|
||||||
{
|
|
||||||
// nothing to do ...
|
// nothing to do ...
|
||||||
//ewol::userConfig::RmUserConfig(&l_obj());
|
//ewol::userConfig::RmUserConfig(&l_obj());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// -----------------------------------------------------------
|
// -----------------------------------------------------------
|
||||||
bool globals::isSetDisplayEndOfLine(void)
|
bool globals::isSetDisplayEndOfLine(void) {
|
||||||
{
|
|
||||||
return l_obj().m_displayEOL;
|
return l_obj().m_displayEOL;
|
||||||
}
|
}
|
||||||
|
|
||||||
void globals::setDisplayEndOfLine(bool newVal)
|
void globals::setDisplayEndOfLine(bool newVal) {
|
||||||
{
|
|
||||||
l_obj().m_displayEOL = newVal;
|
l_obj().m_displayEOL = newVal;
|
||||||
//ewol::widgetMessageMultiCast::Send(-1, ednMsgUserDisplayChange);
|
//ewol::widgetMessageMultiCast::Send(-1, ednMsgUserDisplayChange);
|
||||||
}
|
}
|
||||||
|
|
||||||
// -----------------------------------------------------------
|
// -----------------------------------------------------------
|
||||||
bool globals::isSetDisplaySpaceChar(void)
|
bool globals::isSetDisplaySpaceChar(void) {
|
||||||
{
|
|
||||||
return l_obj().m_displaySpaceChar;
|
return l_obj().m_displaySpaceChar;
|
||||||
}
|
}
|
||||||
|
|
||||||
void globals::setDisplaySpaceChar(bool newVal)
|
void globals::setDisplaySpaceChar(bool _newVal) {
|
||||||
{
|
l_obj().m_displaySpaceChar = _newVal;
|
||||||
l_obj().m_displaySpaceChar = newVal;
|
|
||||||
//ewol::widgetMessageMultiCast::Send(-1, ednMsgUserDisplayChange);
|
//ewol::widgetMessageMultiCast::Send(-1, ednMsgUserDisplayChange);
|
||||||
}
|
}
|
||||||
// -----------------------------------------------------------
|
// -----------------------------------------------------------
|
||||||
bool globals::isSetDisplayTabChar(void)
|
bool globals::isSetDisplayTabChar(void) {
|
||||||
{
|
|
||||||
return l_obj().m_displayTabChar;
|
return l_obj().m_displayTabChar;
|
||||||
}
|
}
|
||||||
|
|
||||||
void globals::setDisplayTabChar(bool newVal)
|
void globals::setDisplayTabChar(bool _newVal) {
|
||||||
{
|
l_obj().m_displayTabChar = _newVal;
|
||||||
l_obj().m_displayTabChar = newVal;
|
|
||||||
//ewol::widgetMessageMultiCast::Send(-1, ednMsgUserDisplayChange);
|
//ewol::widgetMessageMultiCast::Send(-1, ednMsgUserDisplayChange);
|
||||||
}
|
}
|
||||||
|
|
||||||
// -----------------------------------------------------------
|
// -----------------------------------------------------------
|
||||||
bool globals::isSetAutoIndent(void)
|
bool globals::isSetAutoIndent(void) {
|
||||||
{
|
|
||||||
return l_obj().m_AutoIndent;
|
return l_obj().m_AutoIndent;
|
||||||
}
|
}
|
||||||
|
|
||||||
void globals::setAutoIndent(bool newVal)
|
void globals::setAutoIndent(bool _newVal) {
|
||||||
{
|
l_obj().m_AutoIndent = _newVal;
|
||||||
l_obj().m_AutoIndent = newVal;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// -----------------------------------------------------------
|
// -----------------------------------------------------------
|
||||||
|
bool globals::OrderTheBufferList(void) {
|
||||||
|
|
||||||
bool globals::OrderTheBufferList(void)
|
|
||||||
{
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// -----------------------------------------------------------
|
// -----------------------------------------------------------
|
||||||
|
int32_t globals::getNbColoneBorder(void) {
|
||||||
|
|
||||||
int32_t globals::getNbColoneBorder(void)
|
|
||||||
{
|
|
||||||
return 6;
|
return 6;
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t globals::getNbLineBorder(void)
|
int32_t globals::getNbLineBorder(void) {
|
||||||
{
|
|
||||||
return 3;
|
return 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -206,8 +182,7 @@ static const char * const l_changeEndOfLine = "edn-event-change-endOfLine";
|
|||||||
static const char * const l_changeRounded = "edn-event-change-rounded";
|
static const char * const l_changeRounded = "edn-event-change-rounded";
|
||||||
|
|
||||||
globals::ParameterGlobalsGui::ParameterGlobalsGui(void) :
|
globals::ParameterGlobalsGui::ParameterGlobalsGui(void) :
|
||||||
widget::Sizer(widget::Sizer::modeVert)
|
widget::Sizer(widget::Sizer::modeVert) {
|
||||||
{
|
|
||||||
widget::CheckBox* myCheckbox = NULL;
|
widget::CheckBox* myCheckbox = NULL;
|
||||||
widget::Spacer* mySpacer = NULL;
|
widget::Spacer* mySpacer = NULL;
|
||||||
|
|
||||||
@ -265,14 +240,12 @@ globals::ParameterGlobalsGui::ParameterGlobalsGui(void) :
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
globals::ParameterGlobalsGui::~ParameterGlobalsGui(void)
|
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.getMessage() == l_changeEndOfLine) {
|
||||||
@ -306,7 +279,7 @@ void globals::ParameterGlobalsGui::onReceiveMessage(const ewol::EMessage& _msg)
|
|||||||
etk::theme::setName("GUI", "default");;
|
etk::theme::setName("GUI", "default");;
|
||||||
}
|
}
|
||||||
// Reload shaders and graphic system ...
|
// Reload shaders and graphic system ...
|
||||||
ewol::getContext().getResourcesManager().ReLoadResources();
|
ewol::getContext().getResourcesManager().reLoadResources();
|
||||||
ewol::getContext().forceRedrawAll();
|
ewol::getContext().forceRedrawAll();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -17,27 +17,26 @@ namespace globals
|
|||||||
{
|
{
|
||||||
void init(void);
|
void init(void);
|
||||||
void UnInit(void);
|
void UnInit(void);
|
||||||
int32_t getNbColoneBorder(void);
|
int32_t getNbColoneBorder(void);
|
||||||
int32_t getNbLineBorder(void);
|
int32_t getNbLineBorder(void);
|
||||||
|
|
||||||
bool isSetDisplayEndOfLine(void);
|
bool isSetDisplayEndOfLine(void);
|
||||||
void setDisplayEndOfLine(bool newVal);
|
void setDisplayEndOfLine(bool _newVal);
|
||||||
|
|
||||||
bool isSetDisplaySpaceChar(void);
|
bool isSetDisplaySpaceChar(void);
|
||||||
void setDisplaySpaceChar(bool newVal);
|
void setDisplaySpaceChar(bool _newVal);
|
||||||
|
|
||||||
bool isSetDisplayTabChar(void);
|
bool isSetDisplayTabChar(void);
|
||||||
void setDisplayTabChar(bool newVal);
|
void setDisplayTabChar(bool _newVal);
|
||||||
|
|
||||||
bool isSetAutoIndent(void);
|
bool isSetAutoIndent(void);
|
||||||
void setAutoIndent(bool newVal);
|
void setAutoIndent(bool _newVal);
|
||||||
|
|
||||||
void init2(void);
|
void init2(void);
|
||||||
|
|
||||||
bool OrderTheBufferList(void);
|
bool OrderTheBufferList(void);
|
||||||
|
|
||||||
class ParameterGlobalsGui : public widget::Sizer
|
class ParameterGlobalsGui : public widget::Sizer {
|
||||||
{
|
|
||||||
public :
|
public :
|
||||||
ParameterGlobalsGui(void);
|
ParameterGlobalsGui(void);
|
||||||
~ParameterGlobalsGui(void);
|
~ParameterGlobalsGui(void);
|
||||||
|
@ -38,7 +38,7 @@
|
|||||||
int main(int _argc, const char *_argv[])
|
int main(int _argc, const char *_argv[])
|
||||||
{
|
{
|
||||||
// only one things to do:
|
// only one things to do:
|
||||||
return ewol::Run(_argc, _argv);
|
return ewol::run(_argc, _argv);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -47,7 +47,7 @@ int main(int _argc, const char *_argv[])
|
|||||||
*/
|
*/
|
||||||
bool APP_Init(ewol::eContext& _context)
|
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
|
// TODO : remove this : Move if in the windows properties
|
||||||
_context.setSize(vec2(800, 600));
|
_context.setSize(vec2(800, 600));
|
||||||
@ -94,7 +94,7 @@ bool APP_Init(ewol::eContext& _context)
|
|||||||
|
|
||||||
if (NULL == basicWindows) {
|
if (NULL == basicWindows) {
|
||||||
APPL_ERROR("Can not allocate the basic windows");
|
APPL_ERROR("Can not allocate the basic windows");
|
||||||
_context.Stop();
|
_context.stop();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
// create the specific windows
|
// create the specific windows
|
||||||
@ -105,16 +105,16 @@ bool APP_Init(ewol::eContext& _context)
|
|||||||
APPL_INFO("show list of files : ");
|
APPL_INFO("show list of files : ");
|
||||||
bool ctagDetected = false;
|
bool ctagDetected = false;
|
||||||
for( int32_t iii=0 ; iii<_context.getCmd().size(); iii++) {
|
for( int32_t iii=0 ; iii<_context.getCmd().size(); iii++) {
|
||||||
etk::UString tmpppp = _context.getCmd().Get(iii);
|
etk::UString tmpppp = _context.getCmd().get(iii);
|
||||||
if (tmpppp == "-t") {
|
if (tmpppp == "-t") {
|
||||||
ctagDetected = true;
|
ctagDetected = true;
|
||||||
} else if (true == ctagDetected) {
|
} else if (true == ctagDetected) {
|
||||||
APPL_INFO("Load ctag file : \"" << tmpppp << "\"" );
|
APPL_INFO("Load ctag file : \"" << tmpppp << "\"" );
|
||||||
ctagDetected = false;
|
ctagDetected = false;
|
||||||
_context.getEObjectManager().MultiCast().AnonymousSend(ednMsgCtagsLoadFile, tmpppp);
|
_context.getEObjectManager().multiCast().anonymousSend(ednMsgCtagsLoadFile, tmpppp);
|
||||||
} else {
|
} else {
|
||||||
APPL_INFO("need load file : \"" << tmpppp << "\"" );
|
APPL_INFO("need load file : \"" << tmpppp << "\"" );
|
||||||
_context.getEObjectManager().MultiCast().AnonymousSend(ednMsgOpenFile, tmpppp);
|
_context.getEObjectManager().multiCast().anonymousSend(ednMsgOpenFile, tmpppp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -138,15 +138,15 @@ void APP_UnInit(ewol::eContext& _context)
|
|||||||
tmpWindows = NULL;
|
tmpWindows = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
cTagsManager::UnInit();
|
cTagsManager::unInit();
|
||||||
|
|
||||||
APPL_INFO("Stop Hightlight");
|
APPL_INFO("Stop Hightlight");
|
||||||
HighlightManager::UnInit();
|
HighlightManager::unInit();
|
||||||
//Kill all singleton
|
//Kill all singleton
|
||||||
APPL_INFO("Stop BufferManager");
|
APPL_INFO("Stop BufferManager");
|
||||||
BufferManager::UnInit();
|
BufferManager::unInit();
|
||||||
APPL_INFO("Stop ColorizeManager");
|
APPL_INFO("Stop ColorizeManager");
|
||||||
ColorizeManager::UnInit();
|
ColorizeManager::unInit();
|
||||||
APPL_INFO(" == > Un-Init "PROJECT_NAME" (END)");
|
APPL_INFO(" == > Un-Init "PROJECT_NAME" (END)");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -20,7 +20,6 @@ def Create(target):
|
|||||||
# Gui:
|
# Gui:
|
||||||
myModule.AddSrcFile([
|
myModule.AddSrcFile([
|
||||||
'appl/Gui/BufferView.cpp',
|
'appl/Gui/BufferView.cpp',
|
||||||
'appl/Gui/CodeView.cpp',
|
|
||||||
'appl/Gui/TextViewer.cpp',
|
'appl/Gui/TextViewer.cpp',
|
||||||
'appl/Gui/MainWindows.cpp',
|
'appl/Gui/MainWindows.cpp',
|
||||||
'appl/Gui/Search.cpp',
|
'appl/Gui/Search.cpp',
|
||||||
@ -31,12 +30,6 @@ def Create(target):
|
|||||||
# All needed for the buffer management :
|
# All needed for the buffer management :
|
||||||
myModule.AddSrcFile([
|
myModule.AddSrcFile([
|
||||||
'appl/Buffer/Buffer.cpp',
|
'appl/Buffer/Buffer.cpp',
|
||||||
'appl/Buffer/EdnBuf/EdnBuf.cpp',
|
|
||||||
'appl/Buffer/EdnBuf/EdnBuf_HighLight.cpp',
|
|
||||||
'appl/Buffer/EdnBuf/EdnBuf_History.cpp',
|
|
||||||
'appl/Buffer/EdnBuf/EdnBuf_Selection.cpp',
|
|
||||||
'appl/Buffer/EdnBuf/EdnBufHistory.cpp',
|
|
||||||
'appl/Buffer/BufferText.cpp',
|
|
||||||
'appl/Buffer/BufferManager.cpp'])
|
'appl/Buffer/BufferManager.cpp'])
|
||||||
|
|
||||||
# Generic color management for the text editor :
|
# Generic color management for the text editor :
|
||||||
|
Loading…
x
Reference in New Issue
Block a user