basic optimisation of line update ==> not tested
This commit is contained in:
@@ -530,6 +530,7 @@ int32_t Buffer::AnchorCurrentId(void)
|
||||
|
||||
void Buffer::AnchorForceRedrawAll(int32_t realAnchorId)
|
||||
{
|
||||
EDN_DEBUG("AnchorForceRedrawAll(" << realAnchorId << ")");
|
||||
if (-5000 == realAnchorId) {
|
||||
int32_t localID = AnchorCurrentId();
|
||||
if (localID >=0) {
|
||||
@@ -572,51 +573,47 @@ void Buffer::AnchorForceRedrawOffsef(int32_t offset)
|
||||
EDN_DEBUG("offset ID=" << localID);
|
||||
m_AnchorList[localID].m_BufferNumberLineOffset += offset;
|
||||
|
||||
EDN_DEBUG("move redraw request : [" << m_AnchorList[localID].m_displaySize.y << "," << MAX_LINE_DISPLAYABLE_BY_BUFFER << "[=true");
|
||||
for(int32_t iii=m_AnchorList[localID].m_displaySize.y; iii < MAX_LINE_DISPLAYABLE_BY_BUFFER; iii++) {
|
||||
m_AnchorList[localID].m_redrawLine[iii] = true;
|
||||
}
|
||||
|
||||
int32_t maxSize = edn_min(m_AnchorList[localID].m_displaySize.y, MAX_LINE_DISPLAYABLE_BY_BUFFER);
|
||||
|
||||
if (offset < 0) {
|
||||
if (-1 * offset < MAX_LINE_DISPLAYABLE_BY_BUFFER) {
|
||||
EDN_DEBUG("move redraw request : [" << -1*offset << "," << MAX_LINE_DISPLAYABLE_BY_BUFFER << "[=[" << -1*offset + offset << "," << MAX_LINE_DISPLAYABLE_BY_BUFFER+offset << "[");
|
||||
//for(int32_t iii=MAX_LINE_DISPLAYABLE_BY_BUFFER; iii >= -1*offset; iii--) {
|
||||
for(int32_t iii=-1*offset; iii < MAX_LINE_DISPLAYABLE_BY_BUFFER; iii++) {
|
||||
//EDN_DEBUG("move redraw request : " << iii << " <== " << iii+offset << " val=" << m_AnchorList[localID].m_redrawLine[iii+offset]);
|
||||
if (-1 * offset < maxSize) {
|
||||
EDN_DEBUG("move redraw request : ]" << maxSize << "," << -1*offset << "]=]" << maxSize+offset << "," << -1*offset + offset << "]");
|
||||
for(int32_t iii=maxSize-1; iii >= -1*offset; iii--) {
|
||||
m_AnchorList[localID].m_redrawLine[iii] = m_AnchorList[localID].m_redrawLine[iii+offset];
|
||||
}
|
||||
EDN_DEBUG("move redraw request : [" << 0 << "," << -1*offset << "[=true");
|
||||
for(int32_t iii=0; iii < -1*offset; iii++) {
|
||||
//EDN_DEBUG("move redraw request : " << iii << " <== true");
|
||||
m_AnchorList[localID].m_redrawLine[iii] = true;
|
||||
}
|
||||
} else {
|
||||
EDN_WARNING("FORCE a total redraw... 1");
|
||||
for(int32_t iii=0; iii < MAX_LINE_DISPLAYABLE_BY_BUFFER; iii++) {
|
||||
//EDN_DEBUG("move redraw request : " << iii << " <== true");
|
||||
for(int32_t iii=0; iii < maxSize; iii++) {
|
||||
m_AnchorList[localID].m_redrawLine[iii] = true;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (offset < MAX_LINE_DISPLAYABLE_BY_BUFFER) {
|
||||
EDN_DEBUG("move redraw request : [" << 0 << "," << MAX_LINE_DISPLAYABLE_BY_BUFFER-offset << "[=[" << offset << "," << MAX_LINE_DISPLAYABLE_BY_BUFFER << "[");
|
||||
for(int32_t iii=0; iii < MAX_LINE_DISPLAYABLE_BY_BUFFER-offset ; iii++) {
|
||||
//EDN_DEBUG("move redraw request : " << iii << " <== " << iii+offset << " val=" << m_AnchorList[localID].m_redrawLine[iii+offset]);
|
||||
if (offset < maxSize) {
|
||||
EDN_DEBUG("move redraw request : [" << 0 << "," << maxSize-offset << "[=[" << offset << "," << maxSize << "[");
|
||||
for(int32_t iii=0; iii < maxSize-offset ; iii++) {
|
||||
m_AnchorList[localID].m_redrawLine[iii] = m_AnchorList[localID].m_redrawLine[iii+offset];
|
||||
}
|
||||
EDN_DEBUG("move redraw request : [" << MAX_LINE_DISPLAYABLE_BY_BUFFER-offset+1 << "," << MAX_LINE_DISPLAYABLE_BY_BUFFER << "[=true");
|
||||
for(int32_t iii=MAX_LINE_DISPLAYABLE_BY_BUFFER-offset+1; iii < MAX_LINE_DISPLAYABLE_BY_BUFFER; iii++) {
|
||||
//EDN_DEBUG("move redraw request : " << iii << " <== true");
|
||||
// note the -1 is to force the redisplay of the previous of the last line ==> special case of the gtk 3.0 marker to resize the windows
|
||||
EDN_DEBUG("move redraw request : [" << maxSize-offset-1 << "," << maxSize << "[=true");
|
||||
for(int32_t iii=maxSize-offset-1; iii < maxSize; iii++) {
|
||||
m_AnchorList[localID].m_redrawLine[iii] = true;
|
||||
}
|
||||
} else {
|
||||
EDN_WARNING("FORCE a total redraw... 2");
|
||||
for(int32_t iii=0; iii < MAX_LINE_DISPLAYABLE_BY_BUFFER; iii++) {
|
||||
//EDN_DEBUG("move redraw request : " << iii << " <== true");
|
||||
for(int32_t iii=0; iii < maxSize; iii++) {
|
||||
m_AnchorList[localID].m_redrawLine[iii] = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
EDN_DEBUG("move redraw request : [" << m_AnchorList[localID].m_displaySize.y << "," << MAX_LINE_DISPLAYABLE_BY_BUFFER << "[=true");
|
||||
for(int32_t iii=m_AnchorList[localID].m_displaySize.y; iii < MAX_LINE_DISPLAYABLE_BY_BUFFER; iii++) {
|
||||
//EDN_DEBUG("move redraw request : " << iii << " <== true");
|
||||
m_AnchorList[localID].m_redrawLine[iii] = true;
|
||||
}
|
||||
} else {
|
||||
EDN_ERROR("can not find the real ID in linste.Size()=" << m_AnchorList.Size());
|
||||
}
|
||||
|
@@ -807,24 +807,23 @@ void BufferText::cursorMove(int32_t gtkKey)
|
||||
*/
|
||||
void BufferText::UpdateWindowsPosition(bool centerPage)
|
||||
{
|
||||
int32_t linePreviousID = m_EdnBuf.CountLines(0, m_cursorPosPrevious);
|
||||
AnchorForceRedrawLine(linePreviousID);
|
||||
|
||||
if (centerPage == false) {
|
||||
// Display position (Y mode):
|
||||
int32_t lineStartPos;
|
||||
// Get current position of cursor :
|
||||
position_ts cursorPosition;
|
||||
cursorPosition.y = m_EdnBuf.CountLines(0, m_cursorPos);
|
||||
AnchorForceRedrawLine(cursorPosition.y);
|
||||
lineStartPos = m_EdnBuf.StartOfLine(m_cursorPos);
|
||||
cursorPosition.x = m_EdnBuf.CountDispChars(lineStartPos, m_cursorPos);
|
||||
//EDN_INFO(" curent cursor position : (" << cursorPosition.x << "," << cursorPosition.y << ")");
|
||||
int32_t iii = AnchorCurrentId();
|
||||
if (iii >=0) {
|
||||
int32_t linePreviousID = m_EdnBuf.GetLinesIdWithRef(m_cursorPosPrevious, m_AnchorList[iii].m_bufferPos, m_AnchorList[iii].m_lineId);
|
||||
AnchorForceRedrawLine(linePreviousID);
|
||||
|
||||
// Done for all Anchor elements ...
|
||||
//for (int32_t iii=0; iii < m_AnchorList.Size() ; iii++) {
|
||||
int32_t iii = AnchorCurrentId();
|
||||
if (iii >=0) {
|
||||
if (centerPage == false) {
|
||||
// Display position (Y mode):
|
||||
int32_t lineStartPos;
|
||||
// Get current position of cursor :
|
||||
position_ts cursorPosition;
|
||||
EDN_WARNING("plop");
|
||||
cursorPosition.y = m_EdnBuf.GetLinesIdWithRef(m_cursorPos, m_AnchorList[iii].m_bufferPos, m_AnchorList[iii].m_lineId);
|
||||
AnchorForceRedrawLine(cursorPosition.y);
|
||||
lineStartPos = m_EdnBuf.StartOfLine(m_cursorPos);
|
||||
cursorPosition.x = m_EdnBuf.CountDispChars(lineStartPos, m_cursorPos);
|
||||
//EDN_INFO(" curent cursor position : (" << cursorPosition.x << "," << cursorPosition.y << ")");
|
||||
|
||||
position_ts displayPreviousStart = m_AnchorList[iii].m_displayStart;
|
||||
//EDN_INFO(" m_displayStart(" << m_AnchorList[iii].m_displayStart.x << "," << m_AnchorList[iii].m_displayStart.y << ") m_displaySize(" << m_AnchorList[iii].m_displaySize.x << "," << m_AnchorList[iii].m_displaySize.y << ")");
|
||||
if (m_AnchorList[iii].m_displayStart.y > (int32_t)cursorPosition.y - globals::getNbLineBorder() ) {
|
||||
@@ -853,10 +852,10 @@ void BufferText::UpdateWindowsPosition(bool centerPage)
|
||||
AnchorForceRedrawAll(iii);
|
||||
} else {
|
||||
if (m_AnchorList[iii].m_displayStart.y != displayPreviousStart.y) {
|
||||
EDN_WARNING("SELECT an ofset : displayPreviousStart.y=" << displayPreviousStart.y << " m_AnchorList[iii].m_displayStart.y=" << m_AnchorList[iii].m_displayStart.y << " ==>" << m_AnchorList[iii].m_displayStart.y - displayPreviousStart.y);
|
||||
EDN_WARNING("SELECT ... offset = " << m_AnchorList[iii].m_BufferNumberLineOffset);
|
||||
//EDN_WARNING("SELECT an ofset : displayPreviousStart.y=" << displayPreviousStart.y << " m_AnchorList[iii].m_displayStart.y=" << m_AnchorList[iii].m_displayStart.y << " ==>" << m_AnchorList[iii].m_displayStart.y - displayPreviousStart.y);
|
||||
//EDN_WARNING("SELECT ... offset = " << m_AnchorList[iii].m_BufferNumberLineOffset);
|
||||
AnchorForceRedrawOffsef(m_AnchorList[iii].m_displayStart.y - displayPreviousStart.y);
|
||||
EDN_WARNING("SELECT ... offset = " << m_AnchorList[iii].m_BufferNumberLineOffset);
|
||||
//EDN_WARNING("SELECT ... offset = " << m_AnchorList[iii].m_BufferNumberLineOffset);
|
||||
}
|
||||
int32_t SelectionStart, SelectionEnd, SelectionRectStart, SelectionRectEnd;
|
||||
bool SelectionIsRect;
|
||||
@@ -864,24 +863,20 @@ void BufferText::UpdateWindowsPosition(bool centerPage)
|
||||
if (true == haveSelectionActive) {
|
||||
int32_t start = edn_min(linePreviousID, cursorPosition.y);
|
||||
int32_t stop = edn_max(linePreviousID, cursorPosition.y);
|
||||
EDN_WARNING("SELECT force redraw range of lines : (" << start << "," << stop << ")");
|
||||
//EDN_WARNING("SELECT force redraw range of lines : (" << start << "," << stop << ")");
|
||||
for (int32_t jjj=start; jjj <= stop; jjj++) {
|
||||
AnchorForceRedrawLine(jjj);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// center the line at the middle of the screen :
|
||||
position_ts cursorPosition;
|
||||
//EDN_DEBUG(" -------------------------------------------------");
|
||||
cursorPosition.y = m_EdnBuf.CountLines(0, m_cursorPos);
|
||||
//EDN_DEBUG(" cursor position : " << m_cursorPos << " ==> ligne=" << cursorPosition.y);
|
||||
cursorPosition.x = 0;
|
||||
// Done for all Anchor elements ...
|
||||
//for (int32_t iii=0; iii < m_AnchorList.Size() ; iii++) {
|
||||
int32_t iii = AnchorCurrentId();
|
||||
if (iii >=0) {
|
||||
} else {
|
||||
// center the line at the middle of the screen :
|
||||
position_ts cursorPosition;
|
||||
//EDN_DEBUG(" -------------------------------------------------");
|
||||
cursorPosition.y = m_EdnBuf.GetLinesIdWithRef(m_cursorPos, m_AnchorList[iii].m_bufferPos, m_AnchorList[iii].m_lineId);
|
||||
//EDN_DEBUG(" cursor position : " << m_cursorPos << " ==> ligne=" << cursorPosition.y);
|
||||
cursorPosition.x = 0;
|
||||
|
||||
m_AnchorList[iii].m_displayStart.x = 0;
|
||||
//EDN_DEBUG(" display size : " << m_displaySize.y);
|
||||
m_AnchorList[iii].m_displayStart.y = cursorPosition.y - m_AnchorList[iii].m_displaySize.y/2;
|
||||
|
Reference in New Issue
Block a user