[DEV] some display update

This commit is contained in:
Edouard DUPIN 2013-11-22 21:48:05 +01:00
parent e15cb8e4b6
commit 26d206caae
6 changed files with 124 additions and 100 deletions

View File

@ -83,7 +83,7 @@ char32_t appl::Buffer::Iterator::operator* (void) {
} }
appl::Buffer::Iterator appl::Buffer::position(esize_t _pos) { appl::Buffer::Iterator appl::Buffer::position(int64_t _pos) {
return appl::Buffer::Iterator(this, _pos); return appl::Buffer::Iterator(this, _pos);
} }
@ -258,12 +258,15 @@ bool appl::Buffer::searchBack(const appl::Buffer::Iterator& _pos, const char32_t
return false; return false;
} }
void appl::Buffer::moveCursor(esize_t _pos) { void appl::Buffer::moveCursor(int64_t _pos) {
m_cursorPreferredCol = -1; m_cursorPreferredCol = -1;
// selecting mode ... // selecting mode ...
if (m_selectMode == true) { if (m_selectMode == true) {
if (m_cursorSelectPos == -1) { if (m_cursorSelectPos == -1) {
m_cursorSelectPos = m_cursorPos; m_cursorSelectPos = m_cursorPos;
if (m_cursorSelectPos < 0) {
m_cursorSelectPos = 0;
}
} }
//APPL_DEBUG("Select : " << m_cursorSelectPos << " ==> " << newPos); //APPL_DEBUG("Select : " << m_cursorSelectPos << " ==> " << newPos);
m_cursorPos = _pos; m_cursorPos = _pos;
@ -311,7 +314,8 @@ bool appl::Buffer::getPosAround(const appl::Buffer::Iterator& _startPos,
} }
} }
return true; return true;
} else if( false == etk::isSpecialChar(currentValue)){ } else if( etk::isSpecialChar(currentValue) == false
|| currentValue == '_') {
APPL_DEBUG("select normal Char"); APPL_DEBUG("select normal Char");
// Search back // Search back
for (Iterator it = --position(_startPos); for (Iterator it = --position(_startPos);
@ -479,8 +483,8 @@ bool appl::Buffer::copy(std::string& _data) {
void appl::Buffer::copy(std::string& _data, const appl::Buffer::Iterator& _pos, const appl::Buffer::Iterator& _posEnd) { void appl::Buffer::copy(std::string& _data, const appl::Buffer::Iterator& _pos, const appl::Buffer::Iterator& _posEnd) {
_data.clear(); _data.clear();
esize_t startPos = getStartSelectionPos(); int64_t startPos = getStartSelectionPos();
esize_t endPos = getStopSelectionPos(); int64_t endPos = getStopSelectionPos();
for (Iterator it = _pos; for (Iterator it = _pos;
it != _posEnd && it != _posEnd &&
(bool)it == true; (bool)it == true;
@ -490,24 +494,32 @@ void appl::Buffer::copy(std::string& _data, const appl::Buffer::Iterator& _pos,
} }
bool appl::Buffer::write(const std::string& _data, const appl::Buffer::Iterator& _pos) { bool appl::Buffer::write(const std::string& _data, const appl::Buffer::Iterator& _pos) {
if ((esize_t)_pos <= 0) { int64_t position = (int64_t)_pos;
m_data.insert(0, (int8_t*)(_data.c_str()), _data.size()); if (position < 0){
} else { position = 0;
m_data.insert(_pos, (int8_t*)(_data.c_str()), _data.size());
} }
regenerateHighLightAt(_pos, 0, _data.size()); APPL_ERROR("writye at pos: " << (int64_t)_pos << " ==> " << position);
m_data.insert(position, (int8_t*)(_data.c_str()), _data.size());
if (m_cursorPos < 0) {
m_cursorPos = 0;
}
regenerateHighLightAt(position, 0, _data.size());
m_selectMode = false; m_selectMode = false;
moveCursor((esize_t)_pos+_data.size()); moveCursor(position+_data.size());
countNumberofLine(); // TODO : use more intelligent counter countNumberofLine(); // TODO : use more intelligent counter
setModification(true); setModification(true);
return true; return true;
} }
bool appl::Buffer::replace(const std::string& _data, const appl::Buffer::Iterator& _pos, const appl::Buffer::Iterator& _posEnd) { bool appl::Buffer::replace(const std::string& _data, const appl::Buffer::Iterator& _pos, const appl::Buffer::Iterator& _posEnd) {
m_data.replace(_pos, (esize_t)_posEnd-(esize_t)_pos, (int8_t*)(_data.c_str()), _data.size()); int64_t position = (int64_t)_pos;
regenerateHighLightAt(_pos, (esize_t)_posEnd-(esize_t)_pos, _data.size()); if (position < 0){
position = 0;
}
m_data.replace(position, (int64_t)_posEnd-(int64_t)_pos, (int8_t*)(_data.c_str()), _data.size());
regenerateHighLightAt(position, (int64_t)_posEnd-(int64_t)_pos, _data.size());
m_selectMode = false; m_selectMode = false;
moveCursor((esize_t)_pos+_data.size()); moveCursor(position+_data.size());
countNumberofLine(); // TODO : use more intelligent counter countNumberofLine(); // TODO : use more intelligent counter
setModification(true); setModification(true);
return true; return true;
@ -517,8 +529,8 @@ void appl::Buffer::removeSelection(void) {
if (hasTextSelected() == false) { if (hasTextSelected() == false) {
return; return;
} }
esize_t startPos = getStartSelectionPos(); int64_t startPos = getStartSelectionPos();
esize_t endPos = getStopSelectionPos(); int64_t endPos = getStopSelectionPos();
m_data.remove(startPos, endPos-startPos); m_data.remove(startPos, endPos-startPos);
regenerateHighLightAt(startPos, endPos-startPos, 0); regenerateHighLightAt(startPos, endPos-startPos, 0);
m_selectMode = false; m_selectMode = false;
@ -552,7 +564,7 @@ void appl::Buffer::setHighlightType(const std::string& _type) {
generateHighLightAt(0, m_data.size()); generateHighLightAt(0, m_data.size());
} }
void appl::Buffer::regenerateHighLightAt(int32_t _pos, int32_t _nbDeleted, int32_t _nbAdded) { void appl::Buffer::regenerateHighLightAt(int64_t _pos, int64_t _nbDeleted, int64_t _nbAdded) {
// prevent ERROR... // prevent ERROR...
if (NULL == m_highlight) { if (NULL == m_highlight) {
return; return;
@ -564,11 +576,10 @@ void appl::Buffer::regenerateHighLightAt(int32_t _pos, int32_t _nbDeleted, int32
} }
// normal case // normal case
//APPL_INFO("(pos="<<pos<<", nbDeleted="<<nbDeleted<<", nbAdded=" << nbAdded << "\");"); //APPL_INFO("(pos="<<pos<<", nbDeleted="<<nbDeleted<<", nbAdded=" << nbAdded << "\");");
int32_t i; int64_t posEnd = _pos + _nbDeleted;
int32_t posEnd = _pos + _nbDeleted;
// search position of the old element to reparse IT... // search position of the old element to reparse IT...
int32_t startId; int64_t startId;
int32_t stopId; int64_t stopId;
// clean data if needed // clean data if needed
if (m_HLDataPass1.size() == 0) { if (m_HLDataPass1.size() == 0) {
// Parse the new element ... // Parse the new element ...
@ -604,13 +615,13 @@ void appl::Buffer::regenerateHighLightAt(int32_t _pos, int32_t _nbDeleted, int32
} }
//APPL_DEBUG("new size=" << (int32_t)m_HLDataPass1.size()-1); //APPL_DEBUG("new size=" << (int32_t)m_HLDataPass1.size()-1);
// update position after the range position : // update position after the range position :
int32_t elemStart; int64_t elemStart;
if (startId == -1) { if (startId == -1) {
elemStart = 0; elemStart = 0;
} else { } else {
elemStart = startId+1; elemStart = startId+1;
} }
for (esize_t iii = elemStart; iii < m_HLDataPass1.size(); ++iii) { for (int64_t iii = elemStart; iii < m_HLDataPass1.size(); ++iii) {
//APPL_DEBUG("move element=" << i); //APPL_DEBUG("move element=" << i);
m_HLDataPass1[iii].beginStart += _nbAdded - _nbDeleted; m_HLDataPass1[iii].beginStart += _nbAdded - _nbDeleted;
m_HLDataPass1[iii].beginStop += _nbAdded - _nbDeleted; m_HLDataPass1[iii].beginStop += _nbAdded - _nbDeleted;
@ -634,10 +645,10 @@ void appl::Buffer::regenerateHighLightAt(int32_t _pos, int32_t _nbDeleted, int32
} }
} }
void appl::Buffer::findMainHighLightPosition(int32_t _startPos, void appl::Buffer::findMainHighLightPosition(int64_t _startPos,
int32_t _endPos, int64_t _endPos,
int32_t& _startId, int64_t& _startId,
int32_t& _stopId, int64_t& _stopId,
bool _backPreviousNotEnded) { bool _backPreviousNotEnded) {
_startId = -1; _startId = -1;
_stopId = -1; _stopId = -1;
@ -693,7 +704,7 @@ void appl::Buffer::findMainHighLightPosition(int32_t _startPos,
_startId = iii-1; _startId = iii-1;
} }
} }
int32_t elemStart; int64_t elemStart;
if(_startId == -1) { if(_startId == -1) {
elemStart = 0; elemStart = 0;
} else { } else {
@ -707,7 +718,7 @@ void appl::Buffer::findMainHighLightPosition(int32_t _startPos,
} }
} }
void appl::Buffer::generateHighLightAt(int32_t _pos, int32_t _endPos, int32_t _addingPos) { void appl::Buffer::generateHighLightAt(int64_t _pos, int64_t _endPos, int64_t _addingPos) {
if (NULL == m_highlight) { if (NULL == m_highlight) {
return; return;
} }
@ -721,7 +732,7 @@ void appl::Buffer::cleanHighLight(void) {
} }
appl::HighlightInfo* appl::Buffer::getElementColorAtPosition(int32_t _pos, int32_t &_starPos) { appl::HighlightInfo* appl::Buffer::getElementColorAtPosition(int64_t _pos, int64_t &_starPos) {
int32_t start = etk_max(0, _starPos-1); int32_t start = etk_max(0, _starPos-1);
for (esize_t iii = start; iii < m_HLDataPass1.size(); ++iii) { for (esize_t iii = start; iii < m_HLDataPass1.size(); ++iii) {
_starPos = iii; _starPos = iii;
@ -737,7 +748,7 @@ appl::HighlightInfo* appl::Buffer::getElementColorAtPosition(int32_t _pos, int32
} }
void appl::Buffer::hightlightGenerateLines(appl::DisplayHLData& _MData, int32_t _HLStart, int32_t _nbLines) { void appl::Buffer::hightlightGenerateLines(appl::DisplayHLData& _MData, int64_t _HLStart, int64_t _nbLines) {
_MData.posHLPass1 = 0; _MData.posHLPass1 = 0;
_MData.posHLPass2 = 0; _MData.posHLPass2 = 0;
if (NULL == m_highlight) { if (NULL == m_highlight) {
@ -747,13 +758,14 @@ void appl::Buffer::hightlightGenerateLines(appl::DisplayHLData& _MData, int32_t
//g_get_current_time(&timeStart); //g_get_current_time(&timeStart);
_HLStart = (esize_t)getStartLine(position(_HLStart)); _HLStart = (esize_t)getStartLine(position(_HLStart));
_MData.HLData.clear(); _MData.HLData.clear();
int32_t HLStop = countForwardNLines(position(_HLStart), _nbLines); int64_t HLStop = countForwardNLines(position(_HLStart), _nbLines);
int32_t startId, stopId; int64_t startId = 0;
int64_t stopId = 0;
// find element previous // find element previous
findMainHighLightPosition(_HLStart, HLStop, startId, stopId, true); findMainHighLightPosition(_HLStart, HLStop, startId, stopId, true);
//APPL_DEBUG("List of section between : "<< startId << " & " << stopId); //APPL_DEBUG("List of section between : "<< startId << " & " << stopId);
int32_t endSearch = stopId+1; int64_t endSearch = stopId+1;
if (stopId == -1) { if (stopId == -1) {
endSearch = m_HLDataPass1.size(); endSearch = m_HLDataPass1.size();
} }
@ -802,17 +814,16 @@ void appl::Buffer::hightlightGenerateLines(appl::DisplayHLData& _MData, int32_t
} }
appl::HighlightInfo* appl::Buffer::getElementColorAtPosition(appl::DisplayHLData& _MData, int32_t _pos) { appl::HighlightInfo* appl::Buffer::getElementColorAtPosition(appl::DisplayHLData& _MData, int64_t _pos) {
int32_t i; int64_t start = etk_max(0, _MData.posHLPass2-1);
int32_t start = etk_max(0, _MData.posHLPass2-1); for (int64_t iii=start; iii<(int32_t)_MData.HLData.size(); iii++) {
for (i=start; i<(int32_t)_MData.HLData.size(); i++) { _MData.posHLPass2 = iii;
_MData.posHLPass2 = i; if( _MData.HLData[iii].beginStart <= _pos
if( _MData.HLData[i].beginStart <= _pos && _MData.HLData[iii].endStop > _pos)
&& _MData.HLData[i].endStop > _pos)
{ {
return &_MData.HLData[i]; return &_MData.HLData[iii];
} }
if(_MData.HLData[i].beginStart > _pos) { if(_MData.HLData[iii].beginStart > _pos) {
return getElementColorAtPosition(_pos, _MData.posHLPass1); return getElementColorAtPosition(_pos, _MData.posHLPass1);
} }
} }

View File

@ -24,8 +24,8 @@ namespace appl {
class DisplayHLData { class DisplayHLData {
public: public:
std::vector<appl::HighlightInfo> HLData; std::vector<appl::HighlightInfo> HLData;
int32_t posHLPass1; int64_t posHLPass1;
int32_t posHLPass2; int64_t posHLPass2;
}; };
class Buffer : public ewol::EObject { class Buffer : public ewol::EObject {
public: public:
@ -94,7 +94,7 @@ namespace appl {
* @brief basic boolean cast * @brief basic boolean cast
* @return true if the element is present in buffer * @return true if the element is present in buffer
*/ */
operator esize_t (void) const { operator int64_t (void) const {
if (m_data == NULL) { if (m_data == NULL) {
return 0; return 0;
} }
@ -217,7 +217,7 @@ namespace appl {
* @brief Get the position in the buffer * @brief Get the position in the buffer
* @return The requested position. * @return The requested position.
*/ */
esize_t getPos(void) const { int64_t getPos(void) const {
if (m_data == NULL) { if (m_data == NULL) {
return 0; return 0;
} }
@ -233,9 +233,16 @@ namespace appl {
* @brief move the element position * @brief move the element position
* @return a new iterator. * @return a new iterator.
*/ */
Iterator operator+ (const int64_t _val) const {
Iterator tmpp(*this);
for (int64_t iii=0; iii<_val; ++iii) {
++tmpp;
}
return tmpp;
};
Iterator operator+ (const int32_t _val) const { Iterator operator+ (const int32_t _val) const {
Iterator tmpp(*this); Iterator tmpp(*this);
for (int32_t iii=0; iii<_val; ++iii) { for (int64_t iii=0; iii<_val; ++iii) {
++tmpp; ++tmpp;
} }
return tmpp; return tmpp;
@ -244,15 +251,22 @@ namespace appl {
* @brief move the element position * @brief move the element position
* @return a new iterator. * @return a new iterator.
*/ */
Iterator operator- (const int64_t _val) const {
Iterator tmpp(*this);
for (int64_t iii=0; iii<_val; ++iii) {
--tmpp;
}
return tmpp;
};
Iterator operator- (const int32_t _val) const { Iterator operator- (const int32_t _val) const {
Iterator tmpp(*this); Iterator tmpp(*this);
for (int32_t iii=0; iii<_val; ++iii) { for (int64_t iii=0; iii<_val; ++iii) {
--tmpp; --tmpp;
} }
return tmpp; return tmpp;
}; };
private: private:
Iterator(Buffer* _obj, int32_t _pos) : Iterator(Buffer* _obj, int64_t _pos) :
m_current(_pos), m_current(_pos),
m_data(_obj), m_data(_obj),
m_value(etk::UChar::Null) { m_value(etk::UChar::Null) {
@ -325,9 +339,9 @@ namespace appl {
protected: protected:
int64_t m_cursorPos; //!< cursor position. int64_t m_cursorPos; //!< cursor position.
public: public:
void moveCursor(esize_t _pos); void moveCursor(int64_t _pos);
protected: protected:
int32_t m_cursorSelectPos; //!< cursor position. int64_t m_cursorSelectPos; //!< cursor position.
public: public:
/** /**
* @brief Set the selection position in the buffer. * @brief Set the selection position in the buffer.
@ -490,7 +504,7 @@ namespace appl {
* @param[in] _pos Requested position of the iterator. * @param[in] _pos Requested position of the iterator.
* @return The Iterator * @return The Iterator
*/ */
Iterator position(esize_t _pos); Iterator position(int64_t _pos);
/** /**
* @brief Get an Iterator on the start position. * @brief Get an Iterator on the start position.
* @return The Iterator * @return The Iterator
@ -559,17 +573,17 @@ namespace appl {
return m_highlightType; return m_highlightType;
}; };
void regenerateHighLightAt(int32_t _pos, int32_t _nbDeleted, int32_t _nbAdded); void regenerateHighLightAt(int64_t _pos, int64_t _nbDeleted, int64_t _nbAdded);
void findMainHighLightPosition(int32_t _startPos, void findMainHighLightPosition(int64_t _startPos,
int32_t _endPos, int64_t _endPos,
int32_t& _startId, int64_t& _startId,
int32_t& _stopId, int64_t& _stopId,
bool _backPreviousNotEnded); bool _backPreviousNotEnded);
void generateHighLightAt(int32_t _pos, int32_t _endPos, int32_t _addingPos=0); void generateHighLightAt(int64_t _pos, int64_t _endPos, int64_t _addingPos=0);
void cleanHighLight(void); void cleanHighLight(void);
appl::HighlightInfo* getElementColorAtPosition(int32_t _pos, int32_t &_starPos); appl::HighlightInfo* getElementColorAtPosition(int64_t _pos, int64_t &_starPos);
void hightlightGenerateLines(appl::DisplayHLData& _MData, int32_t _HLStart, int32_t _nbLines); void hightlightGenerateLines(appl::DisplayHLData& _MData, int64_t _HLStart, int64_t _nbLines);
appl::HighlightInfo* getElementColorAtPosition(appl::DisplayHLData& _MData, int32_t _pos); appl::HighlightInfo* getElementColorAtPosition(appl::DisplayHLData& _MData, int64_t _pos);
}; };
}; };

View File

@ -144,10 +144,10 @@ void appl::TextViewer::onRegenerateDisplay(void) {
etk::Buffer& buf = m_buffer->getData(); etk::Buffer& buf = m_buffer->getData();
m_displayText.setColor(etk::Color<>(0, 0, 0, 256)); m_displayText.setColor(etk::Color<>(0, 0, 0, 256));
float countNbLine = 1; float countNbLine = 1;
esize_t countColomn = 0; int32_t countColomn = 0;
// the siplay string : // the siplay string :
std::u32string stringToDisplay; std::u32string stringToDisplay;
esize_t bufferElementSize = 0; int64_t bufferElementSize = 0;
bool isSelect = false; bool isSelect = false;
appl::Buffer::Iterator selectPosStart = m_buffer->begin(); appl::Buffer::Iterator selectPosStart = m_buffer->begin();
appl::Buffer::Iterator selectPosStop = m_buffer->begin(); appl::Buffer::Iterator selectPosStop = m_buffer->begin();
@ -158,7 +158,7 @@ void appl::TextViewer::onRegenerateDisplay(void) {
m_displayText.setPos(vec3(-m_originScrooled.x(), m_size.y()+m_originScrooled.y(), 0)); m_displayText.setPos(vec3(-m_originScrooled.x(), m_size.y()+m_originScrooled.y(), 0));
m_displayText.forceLineReturn(); m_displayText.forceLineReturn();
appl::Buffer::Iterator startingIt = m_buffer->begin(); appl::Buffer::Iterator startingIt = m_buffer->begin();
int32_t startLineId = 0; int64_t startLineId = 0;
if (m_size.y() < m_displayText.getPos().y()) { if (m_size.y() < m_displayText.getPos().y()) {
for (startingIt = m_buffer->begin(); for (startingIt = m_buffer->begin();
(bool)startingIt == true; (bool)startingIt == true;
@ -177,7 +177,7 @@ void appl::TextViewer::onRegenerateDisplay(void) {
m_lastOffsetDisplay = 0; m_lastOffsetDisplay = 0;
vec3 tmpLetterSize = m_displayText.calculateSize((char32_t)'A'); vec3 tmpLetterSize = m_displayText.calculateSize((char32_t)'A');
{ {
esize_t nbLine = m_buffer->getNumberOfLines(); int32_t nbLine = m_buffer->getNumberOfLines();
float nbLineCalc = nbLine; float nbLineCalc = nbLine;
int32_t nbChar = 0; int32_t nbChar = 0;
while (nbLineCalc >= 1.0f) { while (nbLineCalc >= 1.0f) {
@ -208,7 +208,7 @@ void appl::TextViewer::onRegenerateDisplay(void) {
m_displayText.setClipping(vec2(m_lastOffsetDisplay, 0), m_size); m_displayText.setClipping(vec2(m_lastOffsetDisplay, 0), m_size);
} }
appl::DisplayHLData displayLocalSyntax; appl::DisplayHLData displayLocalSyntax;
m_buffer->hightlightGenerateLines(displayLocalSyntax, (esize_t)startingIt, m_size.y()); m_buffer->hightlightGenerateLines(displayLocalSyntax, (int64_t)startingIt, m_size.y());
float maxSizeX = 0; float maxSizeX = 0;
appl::HighlightInfo * HLColor = NULL; appl::HighlightInfo * HLColor = NULL;
for (appl::Buffer::Iterator it = startingIt; for (appl::Buffer::Iterator it = startingIt;
@ -240,7 +240,7 @@ void appl::TextViewer::onRegenerateDisplay(void) {
} }
continue; continue;
} }
HLColor = m_buffer->getElementColorAtPosition(displayLocalSyntax, (esize_t)it); HLColor = m_buffer->getElementColorAtPosition(displayLocalSyntax, (int64_t)it);
bool haveBackground = false; bool haveBackground = false;
if ( HLColor != NULL if ( HLColor != NULL
&& HLColor->patern != NULL) { && HLColor->patern != NULL) {
@ -287,7 +287,7 @@ void appl::TextViewer::onRegenerateDisplay(void) {
// set maximum size (X&Y) : // set maximum size (X&Y) :
{ {
vec3 tmpLetterSize = m_displayText.calculateSize((char32_t)'A'); vec3 tmpLetterSize = m_displayText.calculateSize((char32_t)'A');
esize_t nbLines = m_buffer->getNumberOfLines(); int64_t nbLines = m_buffer->getNumberOfLines();
m_maxSize.setX(maxSizeX+m_originScrooled.x()); m_maxSize.setX(maxSizeX+m_originScrooled.x());
m_maxSize.setY((float)nbLines*tmpLetterSize.y()); m_maxSize.setY((float)nbLines*tmpLetterSize.y());
} }
@ -533,7 +533,7 @@ appl::Buffer::Iterator appl::TextViewer::getMousePosition(const vec2& _relativeP
char32_t currentValue; char32_t currentValue;
vec3 positionCurentDisplay(0,0,0); vec3 positionCurentDisplay(0,0,0);
vec3 tmpLetterSize = m_displayText.calculateSize((char32_t)'A'); vec3 tmpLetterSize = m_displayText.calculateSize((char32_t)'A');
esize_t countColomn = 0; int32_t countColomn = 0;
std::u32string stringToDisplay; std::u32string stringToDisplay;
m_displayText.clear(); m_displayText.clear();
m_displayText.forceLineReturn(); m_displayText.forceLineReturn();
@ -542,7 +542,7 @@ appl::Buffer::Iterator appl::TextViewer::getMousePosition(const vec2& _relativeP
++it) { ++it) {
currentValue = *it; currentValue = *it;
m_buffer->expand(countColomn, currentValue, stringToDisplay); m_buffer->expand(countColomn, currentValue, stringToDisplay);
for (esize_t kkk=0; kkk<stringToDisplay.size(); ++kkk) { for (size_t kkk=0; kkk<stringToDisplay.size(); ++kkk) {
if (stringToDisplay[kkk] == etk::UChar::Return) { if (stringToDisplay[kkk] == etk::UChar::Return) {
// TODO : Remove this, use the automatic line manager ... // TODO : Remove this, use the automatic line manager ...
m_displayText.forceLineReturn(); m_displayText.forceLineReturn();
@ -708,7 +708,7 @@ bool appl::TextViewer::moveCursor(const appl::Buffer::Iterator& _pos) {
updateScrolling(); updateScrolling();
return true; return true;
} }
m_buffer->moveCursor((esize_t)_pos); m_buffer->moveCursor((int64_t)_pos);
updateScrolling(); updateScrolling();
return true; return true;
} }
@ -790,7 +790,7 @@ void appl::TextViewer::moveCursorRight(appl::TextViewer::moveMode _mode) {
case moveLetter: case moveLetter:
it = m_buffer->cursor(); it = m_buffer->cursor();
++it; ++it;
APPL_ERROR("Cursor position : " << (esize_t)it); APPL_ERROR("Cursor position : " << (int64_t)it);
moveCursor(it); moveCursor(it);
break; break;
case moveWord: case moveWord:
@ -814,7 +814,7 @@ void appl::TextViewer::moveCursorLeft(appl::TextViewer::moveMode _mode) {
case moveLetter: case moveLetter:
it = m_buffer->cursor();; it = m_buffer->cursor();;
--it; --it;
APPL_ERROR("Cursor position : " << (esize_t)it); APPL_ERROR("Cursor position : " << (int64_t)it);
moveCursor(it); moveCursor(it);
break; break;
case moveWord: case moveWord:
@ -827,7 +827,7 @@ void appl::TextViewer::moveCursorLeft(appl::TextViewer::moveMode _mode) {
} }
} }
void appl::TextViewer::moveCursorUp(esize_t _nbLine) { void appl::TextViewer::moveCursorUp(uint32_t _nbLine) {
if (m_buffer == NULL) { if (m_buffer == NULL) {
return; return;
} }
@ -854,7 +854,7 @@ void appl::TextViewer::moveCursorUp(esize_t _nbLine) {
m_buffer->setFavoriteUpDownPos(posStore); m_buffer->setFavoriteUpDownPos(posStore);
} }
void appl::TextViewer::moveCursorDown(esize_t _nbLine) { void appl::TextViewer::moveCursorDown(uint32_t _nbLine) {
if (m_buffer == NULL) { if (m_buffer == NULL) {
return; return;
} }
@ -884,7 +884,7 @@ void appl::TextViewer::moveCursorDown(esize_t _nbLine) {
// TODO : Rename ... // TODO : Rename ...
appl::Buffer::Iterator appl::TextViewer::getPosSize(const appl::Buffer::Iterator& _startLinePos, float _distance) { appl::Buffer::Iterator appl::TextViewer::getPosSize(const appl::Buffer::Iterator& _startLinePos, float _distance) {
char32_t currentValue; char32_t currentValue;
esize_t countColomn = 0; int32_t countColomn = 0;
std::u32string stringToDisplay; std::u32string stringToDisplay;
m_displayText.clear(); m_displayText.clear();
m_displayText.forceLineReturn(); m_displayText.forceLineReturn();
@ -893,7 +893,7 @@ appl::Buffer::Iterator appl::TextViewer::getPosSize(const appl::Buffer::Iterator
++it) { ++it) {
currentValue = *it; currentValue = *it;
m_buffer->expand(countColomn, currentValue, stringToDisplay); m_buffer->expand(countColomn, currentValue, stringToDisplay);
for (esize_t kkk=0; kkk<stringToDisplay.size(); ++kkk) { for (size_t kkk=0; kkk<stringToDisplay.size(); ++kkk) {
if (stringToDisplay[kkk] == etk::UChar::Return) { if (stringToDisplay[kkk] == etk::UChar::Return) {
return it; return it;
} else { } else {
@ -912,7 +912,7 @@ appl::Buffer::Iterator appl::TextViewer::getPosSize(const appl::Buffer::Iterator
float appl::TextViewer::getScreenSize(const appl::Buffer::Iterator& _startLinePos, const appl::Buffer::Iterator& _stopPos) { float appl::TextViewer::getScreenSize(const appl::Buffer::Iterator& _startLinePos, const appl::Buffer::Iterator& _stopPos) {
float ret = 0; float ret = 0;
char32_t currentValue; char32_t currentValue;
esize_t countColomn = 0; int32_t countColomn = 0;
std::u32string stringToDisplay; std::u32string stringToDisplay;
m_displayText.clear(); m_displayText.clear();
@ -922,7 +922,7 @@ float appl::TextViewer::getScreenSize(const appl::Buffer::Iterator& _startLinePo
currentValue = *it; currentValue = *it;
//APPL_DEBUG("parse : " << currentValue); //APPL_DEBUG("parse : " << currentValue);
m_buffer->expand(countColomn, currentValue, stringToDisplay); m_buffer->expand(countColomn, currentValue, stringToDisplay);
for (esize_t kkk=0; kkk<stringToDisplay.size(); ++kkk) { for (size_t kkk=0; kkk<stringToDisplay.size(); ++kkk) {
if (stringToDisplay[kkk] == etk::UChar::Return) { if (stringToDisplay[kkk] == etk::UChar::Return) {
return m_displayText.getPos().x() + 2; // TODO : Add the +2 for the end of line ... return m_displayText.getPos().x() + 2; // TODO : Add the +2 for the end of line ...
} else { } else {

View File

@ -107,12 +107,12 @@ namespace appl {
* @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(uint32_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(uint32_t _nbLine);
appl::Buffer::Iterator getPosSize(const appl::Buffer::Iterator& _startLinePos, float _distance); appl::Buffer::Iterator getPosSize(const appl::Buffer::Iterator& _startLinePos, float _distance);
float getScreenSize(const appl::Buffer::Iterator& _startLinePos, const appl::Buffer::Iterator& _stopPos); float getScreenSize(const appl::Buffer::Iterator& _startLinePos, const appl::Buffer::Iterator& _stopPos);

View File

@ -158,22 +158,22 @@ void appl::Highlight::display(void) {
/* TODO : Celui qui appelle suprime des element pour rien ... Enfin c'est pas très grave... /* TODO : Celui qui appelle suprime des element pour rien ... Enfin c'est pas très grave...
* Il suffirait juste de suprimer celui d'avant si il n'est pas terminer... * Il suffirait juste de suprimer celui d'avant si il n'est pas terminer...
*/ */
void appl::Highlight::parse(int32_t start, void appl::Highlight::parse(int64_t start,
int32_t stop, int64_t stop,
std::vector<appl::HighlightInfo> &metaData, std::vector<appl::HighlightInfo> &metaData,
int32_t addingPos, int64_t addingPos,
etk::Buffer &buffer) { etk::Buffer &buffer) {
if (0 > addingPos) { if (0 > addingPos) {
addingPos = 0; addingPos = 0;
} }
//APPL_DEBUG("Parse element 0 => " << m_listHighlightPass1.size() << " == > position search: (" << start << "," << stop << ")" ); //APPL_DEBUG("Parse element 0 => " << m_listHighlightPass1.size() << " == > position search: (" << start << "," << stop << ")" );
int32_t elementStart = start; int64_t elementStart = start;
int32_t elementStop = stop; int64_t elementStop = stop;
appl::HighlightInfo resultat; appl::HighlightInfo resultat;
while (elementStart<elementStop) { while (elementStart<elementStop) {
//APPL_DEBUG("Parse element in the buffer id=" << elementStart); //APPL_DEBUG("Parse element in the buffer id=" << elementStart);
//try to fond the HL in ALL of we have //try to fond the HL in ALL of we have
for (int32_t jjj=0; jjj<m_listHighlightPass1.size(); jjj++){ for (int64_t jjj=0; jjj<m_listHighlightPass1.size(); jjj++){
enum resultFind ret = HLP_FIND_OK; enum resultFind ret = HLP_FIND_OK;
//APPL_DEBUG("Parse HL id=" << jjj << " position search: (" << start << "," << buffer.size() << ")" ); //APPL_DEBUG("Parse HL id=" << jjj << " position search: (" << start << "," << buffer.size() << ")" );
// Stop the search to the end (to get the end of the pattern) // Stop the search to the end (to get the end of the pattern)
@ -181,7 +181,7 @@ void appl::Highlight::parse(int32_t start,
if (HLP_FIND_ERROR != ret) { if (HLP_FIND_ERROR != ret) {
//APPL_INFO("Find Pattern in the Buffer : (" << resultat.beginStart << "," << resultat.endStop << ")" ); //APPL_INFO("Find Pattern in the Buffer : (" << resultat.beginStart << "," << resultat.endStop << ")" );
// remove element in the current List where the current Element have a end inside the next... // remove element in the current List where the current Element have a end inside the next...
int32_t kkk=addingPos; int64_t kkk=addingPos;
while(kkk < metaData.size() ) { while(kkk < metaData.size() ) {
if (metaData[kkk].beginStart <= resultat.endStop) { if (metaData[kkk].beginStart <= resultat.endStop) {
// remove element // remove element
@ -221,19 +221,18 @@ void appl::Highlight::parse(int32_t start,
* @brief second pass of the hightlight * @brief second pass of the hightlight
* *
*/ */
void appl::Highlight::parse2(int32_t start, void appl::Highlight::parse2(int64_t start,
int32_t stop, int64_t stop,
std::vector<appl::HighlightInfo> &metaData, std::vector<appl::HighlightInfo> &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; int64_t elementStart = start;
int32_t elementStop = stop; int64_t elementStop = stop;
appl::HighlightInfo resultat; appl::HighlightInfo resultat;
while (elementStart<elementStop) { while (elementStart<elementStop) {
//APPL_DEBUG("Parse element in the buffer id=" << elementStart); //APPL_DEBUG("Parse element in the buffer id=" << elementStart);
//try to fond the HL in ALL of we have //try to fond the HL in ALL of we have
int32_t jjj; for (int64_t jjj=0; jjj<m_listHighlightPass2.size(); jjj++){
for (jjj=0; jjj<m_listHighlightPass2.size(); jjj++){
enum resultFind ret = HLP_FIND_OK; enum resultFind ret = HLP_FIND_OK;
//APPL_DEBUG("Parse HL id=" << jjj << " position search: (" << start << "," << buffer.size() << ")" ); //APPL_DEBUG("Parse HL id=" << jjj << " position search: (" << start << "," << buffer.size() << ")" );
// Stop the search to the end (to get the end of the pattern) // Stop the search to the end (to get the end of the pattern)

View File

@ -49,13 +49,13 @@ namespace appl {
bool hasExtention(const std::string& _ext); bool hasExtention(const std::string& _ext);
bool fileNameCompatible(const std::string& _fileName); bool fileNameCompatible(const std::string& _fileName);
void display(void); void display(void);
void parse(int32_t _start, void parse(int64_t _start,
int32_t _stop, int64_t _stop,
std::vector<appl::HighlightInfo> &_metaData, std::vector<appl::HighlightInfo> &_metaData,
int32_t _addingPos, int64_t _addingPos,
etk::Buffer &_buffer); etk::Buffer &_buffer);
void parse2(int32_t _start, void parse2(int64_t _start,
int32_t _stop, int64_t _stop,
std::vector<appl::HighlightInfo> &_metaData, std::vector<appl::HighlightInfo> &_metaData,
etk::Buffer &_buffer); etk::Buffer &_buffer);
private: private: