From d21d661f1542ce926557ead11a38d8ed61379404 Mon Sep 17 00:00:00 2001 From: Edouard Dupin Date: Thu, 8 Sep 2011 14:57:25 +0200 Subject: [PATCH] SYS : color display is back ==> but so slow ... --- Sources/Buffer/BufferText.cpp | 174 +++------------------- Sources/tools/EdnBuf/EdnBuf_HighLight.cpp | 10 +- 2 files changed, 27 insertions(+), 157 deletions(-) diff --git a/Sources/Buffer/BufferText.cpp b/Sources/Buffer/BufferText.cpp index 1cce543..729c0b4 100644 --- a/Sources/Buffer/BufferText.cpp +++ b/Sources/Buffer/BufferText.cpp @@ -292,12 +292,19 @@ void BufferText::DrawLine(DrawerManager &drawer, int32_t lineNumber, int32_t sta Colorize * myColorNormal = myColorManager->Get("normal"); Colorize * myColorSelected = myColorManager->Get("SelectedText"); Colorize * selectColor = NULL; + colorInformation_ts * HLColor = NULL; + + // Regenerate the colorizing if necessary ... + displayHLData_ts myDisplayLocalSyntax; + m_EdnBuf.HightlightGenerateLines(myDisplayLocalSyntax, startPos, 1); + bool selHave = selStartPos == -1 ? false : true; - - for (int32_t iii=startPos; iiipatern) { selectColor = HLColor->patern->GetColor(); } } -*/ // If user want to display space char : overwrite curent color if( ' ' == currentChar && true == globals::IsSetDisplaySpaceChar() ) @@ -385,11 +390,16 @@ void BufferText::DrawLine(DrawerManager &drawer, int32_t lineNumber, int32_t sta pixelX += widthToDisplay*letterWidth; } idX += displaywidth; - /* - drawer.Text(selectColor, pixelX ,positionY, displayChar); - idX++; - pixelX += displaywidth * letterWidth; - */ + } + // special case : the cursor is at the end of the buffer... + if (m_cursorPos == iii) { + // display the cursor: + if (true == m_cursorOn) { + drawer.Cursor(pixelX, positionY+letterHeight); + //m_cursorOn = false; + } else { + m_cursorOn = true; + } } } @@ -420,38 +430,17 @@ int32_t BufferText::Display(DrawerManager &drawer) selStart = -1; selEnd = -1; } - colorInformation_ts * HLColor = NULL; - - uint32_t y = 0; - int32_t iii, new_i; - // Get color : - Colorize * myColor = myColorManager->Get("normal"); - Colorize * myColorSel = myColorManager->Get("SelectedText"); - color_ts & myColorSpace = myColorManager->Get(COLOR_CODE_SPACE); - color_ts & myColorTab = myColorManager->Get(COLOR_CODE_TAB); - Colorize * selectColor = NULL; - char displayChar[MAX_EXP_CHAR_LEN]; - memset(displayChar, 0, sizeof(char)*MAX_EXP_CHAR_LEN); - - int mylen = m_EdnBuf.Size(); - int32_t x_base=m_nbColoneForLineNumber*letterWidth + 3; - uint32_t xx = 0; - int32_t idX = 0; drawer.Clean(myColorManager->Get(COLOR_CODE_BASIC_BG)); - int displayLines = 0; - // Regenerate the colorizing if necessary ... - //m_EdnBuf.HightlightGenerateLines(m_displayLocalSyntax, m_displayStartBufferPos, m_displaySize.y); GTimeVal timeStart; g_get_current_time(&timeStart); int32_t lineStartPos=m_displayStartBufferPos; int32_t lineEndPos=-1; -#if 1 int32_t lineIdStart = m_displayStart.y + 1; int32_t lineIdEnd = m_displayStart.y + m_displaySize.y; EDN_DEBUG("lineIdStart=" << lineIdStart << " lineIdEnd=" << lineIdEnd ); - for (iii=lineIdStart; iii