redisplay lines where we are adding char
This commit is contained in:
parent
127ad0aac5
commit
df4b14611e
@ -59,6 +59,10 @@ Buffer::Buffer()
|
|||||||
tmpAnchor.m_idAnchor = -1;
|
tmpAnchor.m_idAnchor = -1;
|
||||||
tmpAnchor.m_lineId = 0;
|
tmpAnchor.m_lineId = 0;
|
||||||
tmpAnchor.m_bufferPos = 0;
|
tmpAnchor.m_bufferPos = 0;
|
||||||
|
for(int32_t iii=0; iii<MAX_LINE_DISPLAYABLE_BY_BUFFER; iii++) {
|
||||||
|
tmpAnchor.m_redrawLine[iii] = true;
|
||||||
|
}
|
||||||
|
tmpAnchor.m_BufferNumberLineOffset = 0;
|
||||||
m_AnchorList.PushBack(tmpAnchor);
|
m_AnchorList.PushBack(tmpAnchor);
|
||||||
|
|
||||||
m_lineWidth = 10;
|
m_lineWidth = 10;
|
||||||
@ -86,6 +90,10 @@ Buffer::Buffer(Edn::File &newName)
|
|||||||
tmpAnchor.m_idAnchor = -1;
|
tmpAnchor.m_idAnchor = -1;
|
||||||
tmpAnchor.m_lineId = 0;
|
tmpAnchor.m_lineId = 0;
|
||||||
tmpAnchor.m_bufferPos = 0;
|
tmpAnchor.m_bufferPos = 0;
|
||||||
|
for(int32_t iii=0; iii<MAX_LINE_DISPLAYABLE_BY_BUFFER; iii++) {
|
||||||
|
tmpAnchor.m_redrawLine[iii] = true;
|
||||||
|
}
|
||||||
|
tmpAnchor.m_BufferNumberLineOffset = 0;
|
||||||
m_AnchorList .PushBack(tmpAnchor);
|
m_AnchorList .PushBack(tmpAnchor);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -399,6 +407,9 @@ void Buffer::AnchorAdd(int32_t anchorID)
|
|||||||
bufferAnchorReference_ts tmpAnchor = m_AnchorList[0];
|
bufferAnchorReference_ts tmpAnchor = m_AnchorList[0];
|
||||||
m_AnchorList[0].m_curent = false;
|
m_AnchorList[0].m_curent = false;
|
||||||
tmpAnchor.m_idAnchor = anchorID;
|
tmpAnchor.m_idAnchor = anchorID;
|
||||||
|
for(int32_t iii=0; iii<MAX_LINE_DISPLAYABLE_BY_BUFFER; iii++) {
|
||||||
|
tmpAnchor.m_redrawLine[iii] = true;
|
||||||
|
}
|
||||||
m_AnchorList.PushBack(tmpAnchor);
|
m_AnchorList.PushBack(tmpAnchor);
|
||||||
EDN_DEBUG("[" << m_uniqueID << "] AnchorID="<< anchorID << " ==> Added");
|
EDN_DEBUG("[" << m_uniqueID << "] AnchorID="<< anchorID << " ==> Added");
|
||||||
}
|
}
|
||||||
@ -415,6 +426,10 @@ void Buffer::AnchorRm(int32_t anchorID)
|
|||||||
if (localID >=0) {
|
if (localID >=0) {
|
||||||
if (m_AnchorList.Size() == 2) {
|
if (m_AnchorList.Size() == 2) {
|
||||||
m_AnchorList[0] = m_AnchorList[1];
|
m_AnchorList[0] = m_AnchorList[1];
|
||||||
|
for(int32_t iii=0; iii<MAX_LINE_DISPLAYABLE_BY_BUFFER; iii++) {
|
||||||
|
m_AnchorList[0].m_redrawLine[iii] = true;
|
||||||
|
}
|
||||||
|
m_AnchorList[0].m_BufferNumberLineOffset = 0;
|
||||||
}
|
}
|
||||||
m_AnchorList.Erase(localID);
|
m_AnchorList.Erase(localID);
|
||||||
EDN_DEBUG("[" << m_uniqueID << "] AnchorID="<< anchorID << " ==> Remove");
|
EDN_DEBUG("[" << m_uniqueID << "] AnchorID="<< anchorID << " ==> Remove");
|
||||||
@ -485,3 +500,78 @@ int32_t Buffer::AnchorCurrentId(void)
|
|||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Buffer::AnchorForceRedrawAll(void)
|
||||||
|
{
|
||||||
|
int32_t localID = AnchorCurrentId();
|
||||||
|
if (localID >=0) {
|
||||||
|
m_AnchorList[localID].m_BufferNumberLineOffset = 0;
|
||||||
|
for(int32_t iii=0; iii < MAX_LINE_DISPLAYABLE_BY_BUFFER; iii++) {
|
||||||
|
m_AnchorList[localID].m_redrawLine[iii] = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void Buffer::AnchorForceRedrawLine(int32_t lineID)
|
||||||
|
{
|
||||||
|
for(int32_t iii=0; iii < m_AnchorList.Size(); iii++) {
|
||||||
|
if( m_AnchorList[iii].m_displayStart.y <= lineID
|
||||||
|
&& m_AnchorList[iii].m_displayStart.y + MAX_LINE_DISPLAYABLE_BY_BUFFER > lineID )
|
||||||
|
{
|
||||||
|
m_AnchorList[iii].m_redrawLine[lineID-m_AnchorList[iii].m_displayStart.y] = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// TODO : optimiser cette fonction qui met plusieurs fois des variables a true ....
|
||||||
|
|
||||||
|
void Buffer::AnchorForceRedrawOffsef(int32_t offset)
|
||||||
|
{
|
||||||
|
//offset *= -1;
|
||||||
|
//EDN_DEBUG("** => set ofset : " << offset);
|
||||||
|
int32_t localID = AnchorCurrentId();
|
||||||
|
if (localID >=0) {
|
||||||
|
m_AnchorList[localID].m_BufferNumberLineOffset += offset;
|
||||||
|
|
||||||
|
if (offset < 0) {
|
||||||
|
if (-1 * offset < MAX_LINE_DISPLAYABLE_BY_BUFFER) {
|
||||||
|
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]);
|
||||||
|
m_AnchorList[localID].m_redrawLine[iii] = m_AnchorList[localID].m_redrawLine[iii+offset];
|
||||||
|
}
|
||||||
|
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");
|
||||||
|
m_AnchorList[localID].m_redrawLine[iii] = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (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]);
|
||||||
|
m_AnchorList[localID].m_redrawLine[iii] = m_AnchorList[localID].m_redrawLine[iii+offset];
|
||||||
|
}
|
||||||
|
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");
|
||||||
|
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");
|
||||||
|
m_AnchorList[localID].m_redrawLine[iii] = 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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -31,6 +31,8 @@
|
|||||||
#include "charset.h"
|
#include "charset.h"
|
||||||
#include "Edn.h"
|
#include "Edn.h"
|
||||||
|
|
||||||
|
#define MAX_LINE_DISPLAYABLE_BY_BUFFER (200)
|
||||||
|
|
||||||
extern "C"
|
extern "C"
|
||||||
{
|
{
|
||||||
typedef struct{
|
typedef struct{
|
||||||
@ -49,6 +51,8 @@ extern "C"
|
|||||||
int32_t m_bufferPos; //!< position of the first lineId
|
int32_t m_bufferPos; //!< position of the first lineId
|
||||||
position_ts m_displayStart; //!< start display position
|
position_ts m_displayStart; //!< start display position
|
||||||
position_ts m_displaySize; //!< size of the curent display
|
position_ts m_displaySize; //!< size of the curent display
|
||||||
|
bool m_redrawLine[MAX_LINE_DISPLAYABLE_BY_BUFFER]; //!< List of the current line that must be redisplayed
|
||||||
|
int32_t m_BufferNumberLineOffset; //!< number of line that might be an ofset on the curent screen
|
||||||
} bufferAnchorReference_ts;
|
} bufferAnchorReference_ts;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
@ -60,6 +64,8 @@ extern "C"
|
|||||||
int32_t m_posStop; //!< position of the end of the line
|
int32_t m_posStop; //!< position of the end of the line
|
||||||
int32_t m_selectionPosStart; //!< position of the selection start
|
int32_t m_selectionPosStart; //!< position of the selection start
|
||||||
int32_t m_selectionPosStop; //!< position of the selection stop
|
int32_t m_selectionPosStop; //!< position of the selection stop
|
||||||
|
bool m_redrawLine[MAX_LINE_DISPLAYABLE_BY_BUFFER]; //!< List of the current line that must be redisplayed
|
||||||
|
int32_t m_BufferNumberLineOffset; //!< number of line that might be an ofset on the curent screen
|
||||||
} bufferAnchor_ts;
|
} bufferAnchor_ts;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -152,6 +158,9 @@ class Buffer {
|
|||||||
int32_t m_lineHeight;
|
int32_t m_lineHeight;
|
||||||
int32_t AnchorRealId(int32_t anchorID);
|
int32_t AnchorRealId(int32_t anchorID);
|
||||||
int32_t AnchorCurrentId(void);
|
int32_t AnchorCurrentId(void);
|
||||||
|
void AnchorForceRedrawAll(void);
|
||||||
|
void AnchorForceRedrawLine(int32_t lineID);
|
||||||
|
void AnchorForceRedrawOffsef(int32_t offset);
|
||||||
Edn::VectorType<bufferAnchorReference_ts> m_AnchorList; //!< list of all line anchor in the current buffer
|
Edn::VectorType<bufferAnchorReference_ts> m_AnchorList; //!< list of all line anchor in the current buffer
|
||||||
int32_t m_uniqueID;
|
int32_t m_uniqueID;
|
||||||
|
|
||||||
|
@ -86,7 +86,6 @@ void BufferText::NameChange(void)
|
|||||||
m_EdnBuf.SetHLSystem(myHL);
|
m_EdnBuf.SetHLSystem(myHL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -183,7 +182,7 @@ BufferText::~BufferText(void)
|
|||||||
*/
|
*/
|
||||||
void BufferText::GetInfo(infoStatBuffer_ts &infoToUpdate)
|
void BufferText::GetInfo(infoStatBuffer_ts &infoToUpdate)
|
||||||
{
|
{
|
||||||
|
EDN_WARNING("TODO ...");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -196,7 +195,7 @@ void BufferText::GetInfo(infoStatBuffer_ts &infoToUpdate)
|
|||||||
*/
|
*/
|
||||||
void BufferText::SetLineDisplay(uint32_t lineNumber)
|
void BufferText::SetLineDisplay(uint32_t lineNumber)
|
||||||
{
|
{
|
||||||
|
EDN_WARNING("TODO ...");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -515,6 +514,8 @@ void BufferText::SelectNone(void)
|
|||||||
m_EdnBuf.Unselect(SELECTION_PRIMARY);
|
m_EdnBuf.Unselect(SELECTION_PRIMARY);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#define SCROLL_NB_LINE (3)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief
|
* @brief
|
||||||
*
|
*
|
||||||
@ -525,7 +526,8 @@ void BufferText::SelectNone(void)
|
|||||||
*/
|
*/
|
||||||
void BufferText::ScrollDown(void)
|
void BufferText::ScrollDown(void)
|
||||||
{
|
{
|
||||||
MoveUpDown(3);
|
|
||||||
|
MoveUpDown(SCROLL_NB_LINE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -539,7 +541,7 @@ void BufferText::ScrollDown(void)
|
|||||||
*/
|
*/
|
||||||
void BufferText::ScrollUp(void)
|
void BufferText::ScrollUp(void)
|
||||||
{
|
{
|
||||||
MoveUpDown(-3);
|
MoveUpDown(-1 * SCROLL_NB_LINE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -558,7 +560,9 @@ void BufferText::MoveUpDown(int32_t ofset)
|
|||||||
int32_t nbLine = m_EdnBuf.NumberOfLines();
|
int32_t nbLine = m_EdnBuf.NumberOfLines();
|
||||||
if (m_AnchorList[iii].m_displayStart.y+ofset+3 > nbLine) {
|
if (m_AnchorList[iii].m_displayStart.y+ofset+3 > nbLine) {
|
||||||
m_AnchorList[iii].m_displayStart.y = nbLine-3;
|
m_AnchorList[iii].m_displayStart.y = nbLine-3;
|
||||||
|
AnchorForceRedrawOffsef(m_AnchorList[iii].m_displayStart.y-(nbLine-3));
|
||||||
} else {
|
} else {
|
||||||
|
AnchorForceRedrawOffsef(ofset);
|
||||||
m_AnchorList[iii].m_displayStart.y += ofset;
|
m_AnchorList[iii].m_displayStart.y += ofset;
|
||||||
}
|
}
|
||||||
m_AnchorList[iii].m_bufferPos = m_EdnBuf.CountForwardNLines(0, m_AnchorList[iii].m_displayStart.y);
|
m_AnchorList[iii].m_bufferPos = m_EdnBuf.CountForwardNLines(0, m_AnchorList[iii].m_displayStart.y);
|
||||||
@ -566,10 +570,12 @@ void BufferText::MoveUpDown(int32_t ofset)
|
|||||||
} else {
|
} else {
|
||||||
ofset *= -1;
|
ofset *= -1;
|
||||||
if (m_AnchorList[iii].m_displayStart.y < ofset) {
|
if (m_AnchorList[iii].m_displayStart.y < ofset) {
|
||||||
|
AnchorForceRedrawOffsef(-1 * m_AnchorList[iii].m_displayStart.y);
|
||||||
m_AnchorList[iii].m_displayStart.y = 0;
|
m_AnchorList[iii].m_displayStart.y = 0;
|
||||||
m_AnchorList[iii].m_bufferPos = 0;
|
m_AnchorList[iii].m_bufferPos = 0;
|
||||||
m_AnchorList[iii].m_lineId = 0;
|
m_AnchorList[iii].m_lineId = 0;
|
||||||
} else {
|
} else {
|
||||||
|
AnchorForceRedrawOffsef(-1 * ofset);
|
||||||
m_AnchorList[iii].m_displayStart.y -= ofset;
|
m_AnchorList[iii].m_displayStart.y -= ofset;
|
||||||
m_AnchorList[iii].m_bufferPos = m_EdnBuf.CountForwardNLines(0, m_AnchorList[iii].m_displayStart.y);
|
m_AnchorList[iii].m_bufferPos = m_EdnBuf.CountForwardNLines(0, m_AnchorList[iii].m_displayStart.y);
|
||||||
m_AnchorList[iii].m_lineId = m_AnchorList[iii].m_displayStart.y;
|
m_AnchorList[iii].m_lineId = m_AnchorList[iii].m_displayStart.y;
|
||||||
@ -703,6 +709,7 @@ bool BufferText::TextDMoveDown(int32_t offset)
|
|||||||
*/
|
*/
|
||||||
void BufferText::cursorMove(int32_t gtkKey)
|
void BufferText::cursorMove(int32_t gtkKey)
|
||||||
{
|
{
|
||||||
|
int32_t tmplineID;
|
||||||
bool needUpdatePosition = true;
|
bool needUpdatePosition = true;
|
||||||
switch(gtkKey) {
|
switch(gtkKey) {
|
||||||
# ifdef USE_GTK_VERSION_3_0
|
# ifdef USE_GTK_VERSION_3_0
|
||||||
@ -714,6 +721,8 @@ void BufferText::cursorMove(int32_t gtkKey)
|
|||||||
if (m_cursorPos > 0) {
|
if (m_cursorPos > 0) {
|
||||||
SetInsertPosition(m_cursorPos - 1);
|
SetInsertPosition(m_cursorPos - 1);
|
||||||
}
|
}
|
||||||
|
tmplineID = m_EdnBuf.CountLines(0, m_cursorPos);
|
||||||
|
AnchorForceRedrawLine(tmplineID);
|
||||||
break;
|
break;
|
||||||
# ifdef USE_GTK_VERSION_3_0
|
# ifdef USE_GTK_VERSION_3_0
|
||||||
case GDK_KEY_Right:
|
case GDK_KEY_Right:
|
||||||
@ -724,6 +733,8 @@ void BufferText::cursorMove(int32_t gtkKey)
|
|||||||
if (m_cursorPos < m_EdnBuf.Size() ) {
|
if (m_cursorPos < m_EdnBuf.Size() ) {
|
||||||
SetInsertPosition(m_cursorPos + 1);
|
SetInsertPosition(m_cursorPos + 1);
|
||||||
}
|
}
|
||||||
|
tmplineID = m_EdnBuf.CountLines(0, m_cursorPos);
|
||||||
|
AnchorForceRedrawLine(tmplineID);
|
||||||
break;
|
break;
|
||||||
# ifdef USE_GTK_VERSION_3_0
|
# ifdef USE_GTK_VERSION_3_0
|
||||||
case GDK_KEY_Up:
|
case GDK_KEY_Up:
|
||||||
@ -731,7 +742,10 @@ void BufferText::cursorMove(int32_t gtkKey)
|
|||||||
case GDK_Up:
|
case GDK_Up:
|
||||||
# endif
|
# endif
|
||||||
//EDN_INFO("keyEvent : <UP>");
|
//EDN_INFO("keyEvent : <UP>");
|
||||||
|
tmplineID = m_EdnBuf.CountLines(0, m_cursorPos);
|
||||||
|
AnchorForceRedrawLine(tmplineID);
|
||||||
TextDMoveUp(1);
|
TextDMoveUp(1);
|
||||||
|
AnchorForceRedrawLine(tmplineID-1);
|
||||||
break;
|
break;
|
||||||
# ifdef USE_GTK_VERSION_3_0
|
# ifdef USE_GTK_VERSION_3_0
|
||||||
case GDK_KEY_Down:
|
case GDK_KEY_Down:
|
||||||
@ -740,7 +754,10 @@ void BufferText::cursorMove(int32_t gtkKey)
|
|||||||
# endif
|
# endif
|
||||||
//EDN_INFO("keyEvent : <DOWN>");
|
//EDN_INFO("keyEvent : <DOWN>");
|
||||||
// check if we have enought line ...
|
// check if we have enought line ...
|
||||||
|
tmplineID = m_EdnBuf.CountLines(0, m_cursorPos);
|
||||||
|
AnchorForceRedrawLine(tmplineID);
|
||||||
TextDMoveDown(1);
|
TextDMoveDown(1);
|
||||||
|
AnchorForceRedrawLine(tmplineID+1);
|
||||||
break;
|
break;
|
||||||
# ifdef USE_GTK_VERSION_3_0
|
# ifdef USE_GTK_VERSION_3_0
|
||||||
case GDK_KEY_Page_Up:
|
case GDK_KEY_Page_Up:
|
||||||
@ -975,7 +992,8 @@ void BufferText::AddChar(char * UTF8data)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
int32_t tmplineID = m_EdnBuf.CountLines(0, m_cursorPos);
|
||||||
|
AnchorForceRedrawLine(tmplineID);
|
||||||
SetModify(true);
|
SetModify(true);
|
||||||
UpdateWindowsPosition();
|
UpdateWindowsPosition();
|
||||||
}
|
}
|
||||||
@ -1248,7 +1266,7 @@ bool BufferText::AnchorGet(int32_t anchorID, bufferAnchor_ts & anchor)
|
|||||||
anchor.m_displayStart.y = m_AnchorList[localID].m_displayStart.y;
|
anchor.m_displayStart.y = m_AnchorList[localID].m_displayStart.y;
|
||||||
anchor.m_nbIterationMax = anchor.m_displaySize.y;
|
anchor.m_nbIterationMax = anchor.m_displaySize.y;
|
||||||
// update to buffer position
|
// update to buffer position
|
||||||
anchor.m_lineNumber = m_AnchorList[localID].m_lineId +1;
|
anchor.m_lineNumber = m_AnchorList[localID].m_lineId+1;
|
||||||
anchor.m_posStart = m_AnchorList[localID].m_bufferPos;
|
anchor.m_posStart = m_AnchorList[localID].m_bufferPos;
|
||||||
if (anchor.m_posStart >= m_EdnBuf.Size()+1) {
|
if (anchor.m_posStart >= m_EdnBuf.Size()+1) {
|
||||||
return false;
|
return false;
|
||||||
@ -1265,6 +1283,17 @@ bool BufferText::AnchorGet(int32_t anchorID, bufferAnchor_ts & anchor)
|
|||||||
anchor.m_selectionPosStart = selStart+1;
|
anchor.m_selectionPosStart = selStart+1;
|
||||||
anchor.m_selectionPosStop = selEnd+1;
|
anchor.m_selectionPosStop = selEnd+1;
|
||||||
}
|
}
|
||||||
|
EDN_DEBUG("SET in anchor " << m_AnchorList[localID].m_displaySize.y << " lines to display");
|
||||||
|
for(int32_t iii=0; iii</*edn_min(*/m_AnchorList[localID].m_displaySize.y/*, MAX_LINE_DISPLAYABLE_BY_BUFFER)*/; iii++) {
|
||||||
|
anchor.m_redrawLine[iii] = m_AnchorList[localID].m_redrawLine[iii];
|
||||||
|
m_AnchorList[localID].m_redrawLine[iii] = false;
|
||||||
|
/*if (iii > m_AnchorList[localID].m_displaySize.y - 4) {
|
||||||
|
anchor.m_redrawLine[iii] = true;
|
||||||
|
}*/
|
||||||
|
}
|
||||||
|
anchor.m_BufferNumberLineOffset = m_AnchorList[localID].m_BufferNumberLineOffset;
|
||||||
|
m_AnchorList[localID].m_BufferNumberLineOffset = 0;
|
||||||
|
|
||||||
EDN_DEBUG("Request display : line=" << anchor.m_lineNumber << " (" << anchor.m_posStart << "," << anchor.m_posStop << ")");
|
EDN_DEBUG("Request display : line=" << anchor.m_lineNumber << " (" << anchor.m_posStart << "," << anchor.m_posStop << ")");
|
||||||
EDN_DEBUG(" ==> select : (" << anchor.m_selectionPosStart << "," << anchor.m_selectionPosStop << ")");
|
EDN_DEBUG(" ==> select : (" << anchor.m_selectionPosStart << "," << anchor.m_selectionPosStop << ")");
|
||||||
return true;
|
return true;
|
||||||
|
@ -235,15 +235,8 @@ gboolean CodeView::CB_displayDraw( GtkWidget *widget, GdkEventExpose *event, gpo
|
|||||||
ColorizeManager *myColorManager = NULL;
|
ColorizeManager *myColorManager = NULL;
|
||||||
myColorManager = ColorizeManager::getInstance();
|
myColorManager = ColorizeManager::getInstance();
|
||||||
|
|
||||||
DrawerManager monDrawer(widget, self->m_shawableAreaX, self->m_shawableAreaY);
|
|
||||||
Buffer * tmpBuf = self->m_bufferManager->Get(self->m_bufferID);
|
Buffer * tmpBuf = self->m_bufferManager->Get(self->m_bufferID);
|
||||||
|
|
||||||
// set cursor :
|
|
||||||
/*
|
|
||||||
GdkCursor plop;
|
|
||||||
plop.GSEAL = GDK_PENCIL;
|
|
||||||
gdk_window_set_cursor(gtk_widget_get_window(self->m_widget), &plop);
|
|
||||||
*/
|
|
||||||
#ifdef COUNT_TIME
|
#ifdef COUNT_TIME
|
||||||
GTimeVal timeStart;
|
GTimeVal timeStart;
|
||||||
g_get_current_time(&timeStart);
|
g_get_current_time(&timeStart);
|
||||||
@ -252,19 +245,27 @@ gboolean CodeView::CB_displayDraw( GtkWidget *widget, GdkEventExpose *event, gpo
|
|||||||
|
|
||||||
tmpBuf->AnchorSetSize(self->m_displayUniqueId, self->m_shawableAreaX, self->m_shawableAreaY);
|
tmpBuf->AnchorSetSize(self->m_displayUniqueId, self->m_shawableAreaX, self->m_shawableAreaY);
|
||||||
bool enableToWrite = tmpBuf->AnchorGet(self->m_displayUniqueId, anchor);
|
bool enableToWrite = tmpBuf->AnchorGet(self->m_displayUniqueId, anchor);
|
||||||
|
DrawerManager monDrawer(widget, self->m_shawableAreaX, self->m_shawableAreaY, Display::GetFontHeight()*anchor.m_BufferNumberLineOffset);
|
||||||
|
|
||||||
|
int32_t currentLineID = 0;
|
||||||
while (true == enableToWrite) {
|
while (true == enableToWrite) {
|
||||||
|
if (true == anchor.m_redrawLine[currentLineID]) {
|
||||||
|
EDN_DEBUG("draw line : " << currentLineID);
|
||||||
tmpBuf->DrawLine(monDrawer, anchor);
|
tmpBuf->DrawLine(monDrawer, anchor);
|
||||||
|
}
|
||||||
enableToWrite = tmpBuf->AnchorNext(anchor);
|
enableToWrite = tmpBuf->AnchorNext(anchor);
|
||||||
|
currentLineID++;
|
||||||
}
|
}
|
||||||
monDrawer.Flush();
|
monDrawer.Flush();
|
||||||
|
|
||||||
// Need to clean the end of windows (sometimes)...
|
// Need to clean the end of windows (sometimes)...
|
||||||
/*
|
if(currentLineID<anchor.m_displaySize.y+1) {
|
||||||
if (iii<lineIdEnd+1) {
|
int32_t positionY = Display::GetFontHeight() * (currentLineID);
|
||||||
int32_t positionY = letterHeight * (iii - m_displayStart.y - 1);
|
int32_t positionZ = Display::GetFontHeight() * (anchor.m_displaySize.y-currentLineID);
|
||||||
drawer.Rectangle(myColorManager->Get(COLOR_CODE_BASIC_BG), 0, positionY, drawer.GetWidth(), letterHeight*(lineIdEnd+1-iii) );
|
//monDrawer.Rectangle(myColorManager->Get(COLOR_CODE_BASIC_BG), 0, positionY, monDrawer.GetWidth(), positionZ );
|
||||||
|
monDrawer.Rectangle(myColorManager->Get(COLOR_CODE_CURSOR), 0, positionY, monDrawer.GetWidth(), positionZ );
|
||||||
|
currentLineID ++;
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
#ifdef COUNT_TIME
|
#ifdef COUNT_TIME
|
||||||
GTimeVal timeStop;
|
GTimeVal timeStop;
|
||||||
g_get_current_time(&timeStop);
|
g_get_current_time(&timeStop);
|
||||||
|
@ -40,7 +40,7 @@
|
|||||||
#define FONT_ITALIC_YES (1)
|
#define FONT_ITALIC_YES (1)
|
||||||
|
|
||||||
|
|
||||||
// Variables privé du namespace
|
// Variables privé du namespace
|
||||||
#define POLICE_NAME "Monospace"
|
#define POLICE_NAME "Monospace"
|
||||||
|
|
||||||
#ifdef USE_GTK_VERSION_3_0
|
#ifdef USE_GTK_VERSION_3_0
|
||||||
@ -140,7 +140,7 @@ cairo_font_face_t * Display::GetFont(bool bold, bool italic)
|
|||||||
* @return ---
|
* @return ---
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
DrawerManager::DrawerManager(GtkWidget * widget, int32_t x, int32_t y)
|
DrawerManager::DrawerManager(GtkWidget * widget, int32_t x, int32_t y, int32_t scrollOffset)
|
||||||
{
|
{
|
||||||
m_size.x = x;
|
m_size.x = x;
|
||||||
m_size.y = y;
|
m_size.y = y;
|
||||||
@ -162,8 +162,10 @@ DrawerManager::DrawerManager(GtkWidget * widget, int32_t x, int32_t y)
|
|||||||
m_cairo = gdk_cairo_create(m_windows);
|
m_cairo = gdk_cairo_create(m_windows);
|
||||||
// Copy the previous display data from the current display to the double buffer area:
|
// Copy the previous display data from the current display to the double buffer area:
|
||||||
cairo_surface_t * drawableSurface = cairo_get_target(cairoWindows);
|
cairo_surface_t * drawableSurface = cairo_get_target(cairoWindows);
|
||||||
|
TranslateVertical(-1* scrollOffset);
|
||||||
cairo_set_source_surface(m_cairo, drawableSurface, 0, 0);
|
cairo_set_source_surface(m_cairo, drawableSurface, 0, 0);
|
||||||
cairo_paint(m_cairo);
|
cairo_paint(m_cairo);
|
||||||
|
TranslateVertical(scrollOffset);
|
||||||
//cairo_surface_destroy(drawableSurface);
|
//cairo_surface_destroy(drawableSurface);
|
||||||
cairo_destroy(cairoWindows);
|
cairo_destroy(cairoWindows);
|
||||||
}
|
}
|
||||||
@ -172,7 +174,7 @@ DrawerManager::DrawerManager(GtkWidget * widget, int32_t x, int32_t y)
|
|||||||
|
|
||||||
// for Test only : this remove slowly the old line that is not rewritten
|
// for Test only : this remove slowly the old line that is not rewritten
|
||||||
cairo_set_source_rgb(m_cairo, 0, 0, 0);
|
cairo_set_source_rgb(m_cairo, 0, 0, 0);
|
||||||
cairo_set_source_rgba(m_cairo, 1, 1, 1, 0.3);
|
cairo_set_source_rgba(m_cairo, 1, 1, 1, 0.05);
|
||||||
cairo_paint(m_cairo);
|
cairo_paint(m_cairo);
|
||||||
|
|
||||||
cairo_set_font_size(m_cairo, POLICE_SIZE);
|
cairo_set_font_size(m_cairo, POLICE_SIZE);
|
||||||
@ -598,6 +600,14 @@ void DrawerManager::UTF8UnknownElement(Colorize *SelectColor, int32_t x, int32_t
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void DrawerManager::TranslateVertical(int32_t nbPixelTranslation)
|
||||||
|
{
|
||||||
|
Flush();
|
||||||
|
//scale((xmax-xmin)/W, (ymax-ymin)/H)
|
||||||
|
cairo_translate(m_cairo, 0, nbPixelTranslation);
|
||||||
|
cairo_fill(m_cairo);
|
||||||
|
cairo_paint(m_cairo);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Basic axample with cairo and pango...
|
/* Basic axample with cairo and pango...
|
||||||
|
@ -52,7 +52,7 @@ class DrawerManager;
|
|||||||
class DrawerManager {
|
class DrawerManager {
|
||||||
public:
|
public:
|
||||||
// Constructeur
|
// Constructeur
|
||||||
DrawerManager(GtkWidget * widget, int32_t x, int32_t y);
|
DrawerManager(GtkWidget * widget, int32_t x, int32_t y, int32_t scrollOffset=0);
|
||||||
~DrawerManager();
|
~DrawerManager();
|
||||||
|
|
||||||
void Rectangle(Colorize *SelectColor, int32_t x, int32_t y, int32_t width, int32_t height);
|
void Rectangle(Colorize *SelectColor, int32_t x, int32_t y, int32_t width, int32_t height);
|
||||||
@ -72,6 +72,7 @@ class DrawerManager {
|
|||||||
void Flush(void);
|
void Flush(void);
|
||||||
int32_t GetWidth(void) { return m_size.x; };
|
int32_t GetWidth(void) { return m_size.x; };
|
||||||
int32_t GetHeight(void) { return m_size.y; };
|
int32_t GetHeight(void) { return m_size.y; };
|
||||||
|
void TranslateVertical(int32_t nbPixelTranslation);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void DirectRectangle(Colorize *SelectColor, int32_t x, int32_t y, int32_t width, int32_t height);
|
void DirectRectangle(Colorize *SelectColor, int32_t x, int32_t y, int32_t width, int32_t height);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user