Change the redraw methode of the code viewer ==> reparse every time needed the line in the buffer for the second pass of highlight
This commit is contained in:
parent
7734a8ce36
commit
8ba3e2e3d4
@ -113,6 +113,8 @@ class Buffer {
|
|||||||
virtual void JumpAtLine(int32_t newLine);
|
virtual void JumpAtLine(int32_t newLine);
|
||||||
virtual int32_t GetCurrentLine(void);
|
virtual int32_t GetCurrentLine(void);
|
||||||
|
|
||||||
|
virtual int32_t GetNumberOfLine(void) { return 1; };
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
bool m_fileModify; //!<
|
bool m_fileModify; //!<
|
||||||
// naming
|
// naming
|
||||||
|
@ -79,7 +79,6 @@ void BufferText::BasicInit(void)
|
|||||||
m_displayStartLineId = 0;
|
m_displayStartLineId = 0;
|
||||||
m_displaySize.x = 200;
|
m_displaySize.x = 200;
|
||||||
m_displaySize.y = 20;
|
m_displaySize.y = 20;
|
||||||
m_displayLocalSyntax.idSequence = -1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -294,6 +293,12 @@ void BufferText::UpdatePointerNumber(void)
|
|||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
int32_t BufferText::GetNumberOfLine(void)
|
||||||
|
{
|
||||||
|
return m_EdnBuf.CountLines();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// TODO : Remove this ... it is really bad...
|
// TODO : Remove this ... it is really bad...
|
||||||
|
|
||||||
static int32_t g_basicfontId = 0;
|
static int32_t g_basicfontId = 0;
|
||||||
@ -314,6 +319,10 @@ int32_t BufferText::Display(ewol::OObject2DTextColored* OOTextNormal,
|
|||||||
int32_t offsetX, int32_t offsetY,
|
int32_t offsetX, int32_t offsetY,
|
||||||
int32_t sizeX, int32_t sizeY)
|
int32_t sizeX, int32_t sizeY)
|
||||||
{
|
{
|
||||||
|
offsetX -= 40;
|
||||||
|
if (offsetX<0) {
|
||||||
|
offsetX = 0;
|
||||||
|
}
|
||||||
int32_t selStart, selEnd, selRectStart, selRectEnd;
|
int32_t selStart, selEnd, selRectStart, selRectEnd;
|
||||||
bool selIsRect;
|
bool selIsRect;
|
||||||
int32_t selHave;
|
int32_t selHave;
|
||||||
@ -373,6 +382,7 @@ int32_t BufferText::Display(ewol::OObject2DTextColored* OOTextNormal,
|
|||||||
|
|
||||||
int displayLines = 0;
|
int displayLines = 0;
|
||||||
// Regenerate the colorizing if necessary ...
|
// Regenerate the colorizing if necessary ...
|
||||||
|
displayHLData_ts m_displayLocalSyntax;
|
||||||
m_EdnBuf.HightlightGenerateLines(m_displayLocalSyntax, m_displayStartBufferPos, m_displaySize.y);
|
m_EdnBuf.HightlightGenerateLines(m_displayLocalSyntax, m_displayStartBufferPos, m_displaySize.y);
|
||||||
//GTimeVal timeStart;
|
//GTimeVal timeStart;
|
||||||
//g_get_current_time(&timeStart);
|
//g_get_current_time(&timeStart);
|
||||||
@ -385,14 +395,22 @@ int32_t BufferText::Display(ewol::OObject2DTextColored* OOTextNormal,
|
|||||||
EDN_DEBUG("Start display of text buffer [" << m_displayStartBufferPos<< ".." << mylen << "]");
|
EDN_DEBUG("Start display of text buffer [" << m_displayStartBufferPos<< ".." << mylen << "]");
|
||||||
EDN_DEBUG("cursor Pos : " << m_cursorPos << "start at pos=" << m_displayStartBufferPos);
|
EDN_DEBUG("cursor Pos : " << m_cursorPos << "start at pos=" << m_displayStartBufferPos);
|
||||||
|
|
||||||
|
|
||||||
|
DrawLineNumber(OOTextNormal, OOColored, x_base, sizeY, myPrint, currentLineID, y);
|
||||||
|
int32_t pixelX = x_base + SEPARATION_SIZE_LINE_NUMBER;
|
||||||
|
|
||||||
clipping_ts drawClipping;
|
clipping_ts drawClipping;
|
||||||
drawClipping.x = 0;
|
drawClipping.x = 0;
|
||||||
drawClipping.y = 0;
|
drawClipping.y = 0;
|
||||||
drawClipping.w = sizeX;
|
drawClipping.w = sizeX;
|
||||||
drawClipping.h = sizeY;
|
drawClipping.h = sizeY;
|
||||||
|
|
||||||
DrawLineNumber(OOTextNormal, OOColored, x_base, sizeY, myPrint, currentLineID, y);
|
clipping_ts drawClippingTextArea;
|
||||||
int32_t pixelX = x_base + SEPARATION_SIZE_LINE_NUMBER;
|
drawClippingTextArea.x = pixelX;
|
||||||
|
drawClippingTextArea.y = 0;
|
||||||
|
drawClippingTextArea.w = sizeX - drawClipping.x;
|
||||||
|
drawClippingTextArea.h = sizeY;
|
||||||
|
|
||||||
for (iii=m_displayStartBufferPos; iii<mylen && displayLines < m_displaySize.y ; iii = new_i) {
|
for (iii=m_displayStartBufferPos; iii<mylen && displayLines < m_displaySize.y ; iii = new_i) {
|
||||||
//EDN_DEBUG("diplay element=" << iii);
|
//EDN_DEBUG("diplay element=" << iii);
|
||||||
int displaywidth;
|
int displaywidth;
|
||||||
@ -434,7 +452,7 @@ int32_t BufferText::Display(ewol::OObject2DTextColored* OOTextNormal,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
coord2D_ts textPos;
|
coord2D_ts textPos;
|
||||||
textPos.x = pixelX-m_displayStartPixelX;
|
textPos.x = pixelX-offsetX;
|
||||||
textPos.y = y;
|
textPos.y = y;
|
||||||
if (true == selectColor->GetItalic() ) {
|
if (true == selectColor->GetItalic() ) {
|
||||||
if (true == selectColor->GetBold() ) {
|
if (true == selectColor->GetBold() ) {
|
||||||
@ -450,9 +468,9 @@ int32_t BufferText::Display(ewol::OObject2DTextColored* OOTextNormal,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
OOTextSelected->SetColor(selectColor->GetFG());
|
OOTextSelected->SetColor(selectColor->GetFG());
|
||||||
drawSize = OOTextSelected->TextAdd(textPos, drawClipping, displayChar);
|
drawSize = OOTextSelected->TextAdd(textPos, drawClippingTextArea, displayChar);
|
||||||
if (true == haveBg ) {
|
if (true == haveBg ) {
|
||||||
OOColored->Rectangle( pixelX, y, drawSize, letterHeight, drawClipping);
|
OOColored->Rectangle(textPos.x, y, drawSize, letterHeight, drawClippingTextArea);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
idX += displaywidth;
|
idX += displaywidth;
|
||||||
@ -525,8 +543,8 @@ int32_t BufferText::GetMousePosition(int32_t width, int32_t height)
|
|||||||
EDN_DEBUG(" Element : Befor the start of the line ... ==> END");
|
EDN_DEBUG(" Element : Befor the start of the line ... ==> END");
|
||||||
return startLinePosition;
|
return startLinePosition;
|
||||||
}
|
}
|
||||||
EDN_DEBUG("Get id element : x=" << width << "px y=" << height << "px");
|
EDN_VERBOSE("Get id element : x=" << width << "px y=" << height << "px");
|
||||||
EDN_DEBUG(" line offset = " << lineOffset);
|
EDN_VERBOSE(" line offset = " << lineOffset);
|
||||||
for (iii=startLinePosition; iii<mylen; iii = new_i) {
|
for (iii=startLinePosition; iii<mylen; iii = new_i) {
|
||||||
int displaywidth;
|
int displaywidth;
|
||||||
uint32_t currentChar = '\0';
|
uint32_t currentChar = '\0';
|
||||||
@ -534,21 +552,21 @@ int32_t BufferText::GetMousePosition(int32_t width, int32_t height)
|
|||||||
displaywidth = m_EdnBuf.GetExpandedChar(new_i, idX, displayChar, currentChar);
|
displaywidth = m_EdnBuf.GetExpandedChar(new_i, idX, displayChar, currentChar);
|
||||||
if (currentChar!='\n') {
|
if (currentChar!='\n') {
|
||||||
int32_t drawSize = ewol::GetWidth(g_basicfontId, displayChar);
|
int32_t drawSize = ewol::GetWidth(g_basicfontId, displayChar);
|
||||||
EDN_DEBUG(" Element : " << currentChar << "=\"" << (char)currentChar << "\" display offset=" << pixelX << "px width=" << drawSize << "px");
|
EDN_VERBOSE(" Element : " << currentChar << "=\"" << (char)currentChar << "\" display offset=" << pixelX << "px width=" << drawSize << "px");
|
||||||
pixelX += drawSize;
|
pixelX += drawSize;
|
||||||
if (width <= pixelX) {
|
if (width <= pixelX) {
|
||||||
EDN_DEBUG(" Find IT ==> END");
|
EDN_VERBOSE(" Find IT ==> END");
|
||||||
// find position ...
|
// find position ...
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
EDN_DEBUG(" Element : \"\\n\" display width=---px ==> end of line ==> END");
|
EDN_VERBOSE(" Element : \"\\n\" display width=---px ==> end of line ==> END");
|
||||||
// end of line ... exit cycle
|
// end of line ... exit cycle
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
idX += displaywidth;
|
idX += displaywidth;
|
||||||
}
|
}
|
||||||
EDN_DEBUG("BufferText::GetMousePosition(" << width << "," << height << "); ==> " << iii );
|
EDN_VERBOSE("BufferText::GetMousePosition(" << width << "," << height << "); ==> " << iii );
|
||||||
return iii;
|
return iii;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -721,7 +739,6 @@ void BufferText::ScrollUp(void)
|
|||||||
*/
|
*/
|
||||||
void BufferText::MoveUpDown(int32_t ofset)
|
void BufferText::MoveUpDown(int32_t ofset)
|
||||||
{
|
{
|
||||||
m_displayLocalSyntax.idSequence = -1;
|
|
||||||
if (ofset >= 0) {
|
if (ofset >= 0) {
|
||||||
int32_t nbLine = m_EdnBuf.NumberOfLines();
|
int32_t nbLine = m_EdnBuf.NumberOfLines();
|
||||||
if (m_displayStartLineId+ofset+3 > nbLine) {
|
if (m_displayStartLineId+ofset+3 > nbLine) {
|
||||||
@ -756,7 +773,6 @@ void BufferText::MoveUpDown(int32_t ofset)
|
|||||||
void BufferText::ForceReDraw(bool allElement)
|
void BufferText::ForceReDraw(bool allElement)
|
||||||
{
|
{
|
||||||
NeedToCleanEndPage = true;
|
NeedToCleanEndPage = true;
|
||||||
//m_displayLocalSyntax.idSequence = -1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void BufferText::SetInsertPosition(int32_t newPos, bool insertChar)
|
void BufferText::SetInsertPosition(int32_t newPos, bool insertChar)
|
||||||
|
@ -79,6 +79,7 @@ class BufferText : public Buffer {
|
|||||||
void Undo(void);
|
void Undo(void);
|
||||||
void Redo(void);
|
void Redo(void);
|
||||||
void SetCharset(unicode::charset_te newCharset);
|
void SetCharset(unicode::charset_te newCharset);
|
||||||
|
int32_t GetNumberOfLine(void);
|
||||||
protected:
|
protected:
|
||||||
void NameChange(void);
|
void NameChange(void);
|
||||||
|
|
||||||
@ -100,8 +101,6 @@ class BufferText : public Buffer {
|
|||||||
int32_t m_cursorPreferredCol; //!< colomn of the last up and down ...
|
int32_t m_cursorPreferredCol; //!< colomn of the last up and down ...
|
||||||
cursorDisplayMode_te m_cursorMode; //!< type of cursor Selected
|
cursorDisplayMode_te m_cursorMode; //!< type of cursor Selected
|
||||||
|
|
||||||
displayHLData_ts m_displayLocalSyntax; //!< for the display of the local elements (display HL mode)
|
|
||||||
|
|
||||||
// internal function
|
// internal function
|
||||||
void BasicInit(void);
|
void BasicInit(void);
|
||||||
void UpdateWindowsPosition(bool centerPage = false);
|
void UpdateWindowsPosition(bool centerPage = false);
|
||||||
|
@ -115,11 +115,12 @@ void ColorizeManager::LoadFile(const char * xmlFilename)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// allocate data
|
// allocate data
|
||||||
char * fileBuffer = new char[fileSize];
|
char * fileBuffer = new char[fileSize+5];
|
||||||
if (NULL == fileBuffer) {
|
if (NULL == fileBuffer) {
|
||||||
EWOL_ERROR("Error Memory allocation size=" << fileSize);
|
EWOL_ERROR("Error Memory allocation size=" << fileSize);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
memset(fileBuffer, 0, (fileSize+5)*sizeof(char));
|
||||||
// load data from the file :
|
// load data from the file :
|
||||||
fileName.fRead(fileBuffer, 1, fileSize);
|
fileName.fRead(fileBuffer, 1, fileSize);
|
||||||
// close the file:
|
// close the file:
|
||||||
|
@ -73,6 +73,7 @@ CodeView::CodeView(void)
|
|||||||
|
|
||||||
|
|
||||||
//old
|
//old
|
||||||
|
/*
|
||||||
ewol::widgetMessageMultiCast::Add(GetWidgetId(), ednMsgCodeViewCurrentChangeBufferId);
|
ewol::widgetMessageMultiCast::Add(GetWidgetId(), ednMsgCodeViewCurrentChangeBufferId);
|
||||||
ewol::widgetMessageMultiCast::Add(GetWidgetId(), ednMsgCodeViewCurrentSave);
|
ewol::widgetMessageMultiCast::Add(GetWidgetId(), ednMsgCodeViewCurrentSave);
|
||||||
ewol::widgetMessageMultiCast::Add(GetWidgetId(), ednMsgCodeViewCurrentSaveAs);
|
ewol::widgetMessageMultiCast::Add(GetWidgetId(), ednMsgCodeViewCurrentSaveAs);
|
||||||
@ -92,6 +93,7 @@ CodeView::CodeView(void)
|
|||||||
ewol::widgetMessageMultiCast::Add(GetWidgetId(), ednMsgCodeViewCurrentRedo);
|
ewol::widgetMessageMultiCast::Add(GetWidgetId(), ednMsgCodeViewCurrentRedo);
|
||||||
ewol::widgetMessageMultiCast::Add(GetWidgetId(), ednMsgCodeViewCurrentGotoLine);
|
ewol::widgetMessageMultiCast::Add(GetWidgetId(), ednMsgCodeViewCurrentGotoLine);
|
||||||
ewol::widgetMessageMultiCast::Add(GetWidgetId(), ednMsgCodeViewCurrentSetCharset);
|
ewol::widgetMessageMultiCast::Add(GetWidgetId(), ednMsgCodeViewCurrentSetCharset);
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
CodeView::~CodeView(void)
|
CodeView::~CodeView(void)
|
||||||
@ -106,30 +108,45 @@ bool CodeView::CalculateMinSize(void)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CodeView::CalculateMaxSize(void)
|
||||||
|
{
|
||||||
|
m_maxSize.x = 4096;
|
||||||
|
int32_t letterHeight = ewol::GetHeight(m_fontNormal);
|
||||||
|
m_maxSize.y = m_bufferManager->Get(m_bufferID)->GetNumberOfLine() * letterHeight;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void CodeView::OnRegenerateDisplay(void)
|
void CodeView::OnRegenerateDisplay(void)
|
||||||
{
|
{
|
||||||
// create tmp object :
|
if (true == NeedRedraw()) {
|
||||||
ewol::OObject2DTextColored* myOObjectTextNormal = new ewol::OObject2DTextColored(m_fontNormal);
|
// For the scrooling windows
|
||||||
ewol::OObject2DTextColored* myOObjectTextBold = new ewol::OObject2DTextColored(m_fontBold);
|
CalculateMaxSize();
|
||||||
ewol::OObject2DTextColored* myOObjectTextItalic = new ewol::OObject2DTextColored(m_fontItalic);
|
|
||||||
ewol::OObject2DTextColored* myOObjectTextBoldItalic = new ewol::OObject2DTextColored(m_fontBoldItalic);
|
|
||||||
ewol::OObject2DColored* myOObjectsColored = new ewol::OObject2DColored();
|
|
||||||
|
|
||||||
// generate the objects :
|
// create tmp object :
|
||||||
//m_bufferID = 0;
|
ewol::OObject2DTextColored* myOObjectTextNormal = new ewol::OObject2DTextColored(m_fontNormal);
|
||||||
m_bufferManager->Get(m_bufferID)->Display(myOObjectTextNormal, myOObjectTextBold, myOObjectTextItalic, myOObjectTextBoldItalic, myOObjectsColored,
|
ewol::OObject2DTextColored* myOObjectTextBold = new ewol::OObject2DTextColored(m_fontBold);
|
||||||
m_originScrooledX, m_originScrooledY, m_size.x, m_size.y);
|
ewol::OObject2DTextColored* myOObjectTextItalic = new ewol::OObject2DTextColored(m_fontItalic);
|
||||||
|
ewol::OObject2DTextColored* myOObjectTextBoldItalic = new ewol::OObject2DTextColored(m_fontBoldItalic);
|
||||||
|
ewol::OObject2DColored* myOObjectsColored = new ewol::OObject2DColored();
|
||||||
|
|
||||||
// clean the object list ...
|
// generate the objects :
|
||||||
ClearOObjectList();
|
//m_bufferID = 0;
|
||||||
// add generated element
|
m_bufferManager->Get(m_bufferID)->Display(myOObjectTextNormal, myOObjectTextBold, myOObjectTextItalic, myOObjectTextBoldItalic, myOObjectsColored,
|
||||||
AddOObject(myOObjectsColored, "CodeViewBackground");
|
m_originScrooled.x, m_originScrooled.y, m_size.x, m_size.y);
|
||||||
AddOObject(myOObjectTextNormal, "CodeViewTextNormal");
|
|
||||||
AddOObject(myOObjectTextBold, "CodeViewTextBold");
|
// clean the object list ...
|
||||||
AddOObject(myOObjectTextItalic, "CodeViewTextItalic");
|
ClearOObjectList();
|
||||||
AddOObject(myOObjectTextBoldItalic, "CodeViewTextBoldItalic");
|
// add generated element
|
||||||
|
AddOObject(myOObjectsColored, "CodeViewBackground");
|
||||||
|
AddOObject(myOObjectTextNormal, "CodeViewTextNormal");
|
||||||
|
AddOObject(myOObjectTextBold, "CodeViewTextBold");
|
||||||
|
AddOObject(myOObjectTextItalic, "CodeViewTextItalic");
|
||||||
|
AddOObject(myOObjectTextBoldItalic, "CodeViewTextBoldItalic");
|
||||||
|
|
||||||
|
// call the herited class...
|
||||||
|
WidgetScrooled::OnRegenerateDisplay();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -202,14 +219,15 @@ bool CodeView::OnEventInput(int32_t IdInput, ewol::eventInputType_te typeEvent,
|
|||||||
if (ewol::EVENT_INPUT_TYPE_DOWN == typeEvent) {
|
if (ewol::EVENT_INPUT_TYPE_DOWN == typeEvent) {
|
||||||
m_buttunOneSelected = true;
|
m_buttunOneSelected = true;
|
||||||
ewol::widgetManager::FocusKeep(this);
|
ewol::widgetManager::FocusKeep(this);
|
||||||
|
//EDN_INFO("mouse-event BT1 ==> One Clicked %d, %d", (uint32_t)event->x, (uint32_t)event->y);
|
||||||
|
m_bufferManager->Get(m_bufferID)->MouseEvent(x, y);
|
||||||
|
MarkToReedraw();
|
||||||
} else if (ewol::EVENT_INPUT_TYPE_UP == typeEvent) {
|
} else if (ewol::EVENT_INPUT_TYPE_UP == typeEvent) {
|
||||||
m_buttunOneSelected = false;
|
m_buttunOneSelected = false;
|
||||||
m_bufferManager->Get(m_bufferID)->Copy(COPY_MIDDLE_BUTTON);
|
m_bufferManager->Get(m_bufferID)->Copy(COPY_MIDDLE_BUTTON);
|
||||||
MarkToReedraw();
|
MarkToReedraw();
|
||||||
} else if (ewol::EVENT_INPUT_TYPE_SINGLE == typeEvent) {
|
} else if (ewol::EVENT_INPUT_TYPE_SINGLE == typeEvent) {
|
||||||
//EDN_INFO("mouse-event BT1 ==> One Clicked %d, %d", (uint32_t)event->x, (uint32_t)event->y);
|
// nothing to do ...
|
||||||
m_bufferManager->Get(m_bufferID)->MouseEvent(x, y);
|
|
||||||
MarkToReedraw();
|
|
||||||
} else if (ewol::EVENT_INPUT_TYPE_DOUBLE == typeEvent) {
|
} else if (ewol::EVENT_INPUT_TYPE_DOUBLE == typeEvent) {
|
||||||
//EDN_INFO("mouse-event BT1 ==> Double Clicked %d, %d", (uint32_t)event->x, (uint32_t)event->y);
|
//EDN_INFO("mouse-event BT1 ==> Double Clicked %d, %d", (uint32_t)event->x, (uint32_t)event->y);
|
||||||
m_bufferManager->Get(m_bufferID)->MouseEventDouble();
|
m_bufferManager->Get(m_bufferID)->MouseEventDouble();
|
||||||
|
@ -71,6 +71,8 @@ class CodeView :public ewol::WidgetScrooled
|
|||||||
void SetFontNameBold(etk::String fontName);
|
void SetFontNameBold(etk::String fontName);
|
||||||
void SetFontNameItalic(etk::String fontName);
|
void SetFontNameItalic(etk::String fontName);
|
||||||
void SetFontNameBoldItalic(etk::String fontName);
|
void SetFontNameBoldItalic(etk::String fontName);
|
||||||
|
private:
|
||||||
|
void CalculateMaxSize(void);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -122,13 +122,20 @@ MainWindows::MainWindows(void)
|
|||||||
myCodeView->SetExpendY(true);
|
myCodeView->SetExpendY(true);
|
||||||
myCodeView->SetFillX(true);
|
myCodeView->SetFillX(true);
|
||||||
myCodeView->SetFillY(true);
|
myCodeView->SetFillY(true);
|
||||||
|
|
||||||
myCodeView->SetFontSize(11);
|
myCodeView->SetFontSize(11);
|
||||||
myCodeView->SetFontNameNormal( "freefont/FreeMono.ttf");
|
myCodeView->SetFontNameNormal( "freefont/FreeMono.ttf");
|
||||||
myCodeView->SetFontNameBold( "freefont/FreeMonoBold.ttf");
|
myCodeView->SetFontNameBold( "freefont/FreeMonoBold.ttf");
|
||||||
myCodeView->SetFontNameItalic( "freefont/FreeMonoOblique.ttf");
|
myCodeView->SetFontNameItalic( "freefont/FreeMonoOblique.ttf");
|
||||||
myCodeView->SetFontNameBoldItalic("freefont/FreeMonoBoldOblique.ttf");
|
myCodeView->SetFontNameBoldItalic("freefont/FreeMonoBoldOblique.ttf");
|
||||||
|
/*
|
||||||
|
myCodeView->SetFontSize(11);
|
||||||
|
myCodeView->SetFontNameNormal( "ubuntu/UbuntuMono-R.ttf");
|
||||||
|
myCodeView->SetFontNameBold( "ubuntu/UbuntuMono-B.ttf");
|
||||||
|
myCodeView->SetFontNameItalic( "ubuntu/UbuntuMono-RI.ttf");
|
||||||
|
myCodeView->SetFontNameBoldItalic("ubuntu/UbuntuMono-BI.ttf");
|
||||||
|
*/
|
||||||
mySizerHori->SubWidgetAdd(myCodeView);
|
mySizerHori->SubWidgetAdd(myCodeView);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -64,11 +64,12 @@ Highlight::Highlight(etk::String &xmlFilename)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// allocate data
|
// allocate data
|
||||||
char * fileBuffer = new char[fileSize];
|
char * fileBuffer = new char[fileSize+5];
|
||||||
if (NULL == fileBuffer) {
|
if (NULL == fileBuffer) {
|
||||||
EWOL_ERROR("Error Memory allocation size=" << fileSize);
|
EWOL_ERROR("Error Memory allocation size=" << fileSize);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
memset(fileBuffer, 0, (fileSize+5)*sizeof(char));
|
||||||
// load data from the file :
|
// load data from the file :
|
||||||
fileName.fRead(fileBuffer, 1, fileSize);
|
fileName.fRead(fileBuffer, 1, fileSize);
|
||||||
// close the file:
|
// close the file:
|
||||||
|
@ -78,7 +78,6 @@ EdnBuf::EdnBuf(void)
|
|||||||
// basicly no HL system ...
|
// basicly no HL system ...
|
||||||
m_Highlight = NULL;
|
m_Highlight = NULL;
|
||||||
m_nbLine = 1;
|
m_nbLine = 1;
|
||||||
m_HLDataSequence = 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -68,7 +68,6 @@ typedef enum{
|
|||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
etk::VectorType<colorInformation_ts> HLData;
|
etk::VectorType<colorInformation_ts> HLData;
|
||||||
int32_t idSequence;
|
|
||||||
int32_t posHLPass1;
|
int32_t posHLPass1;
|
||||||
int32_t posHLPass2;
|
int32_t posHLPass2;
|
||||||
}displayHLData_ts;
|
}displayHLData_ts;
|
||||||
@ -159,7 +158,6 @@ class EdnBuf {
|
|||||||
private:
|
private:
|
||||||
Highlight * m_Highlight; //!< internal link with the Highlight system
|
Highlight * m_Highlight; //!< internal link with the Highlight system
|
||||||
etk::VectorType<colorInformation_ts> m_HLDataPass1; //!< colorisation position in the current buffer pass 1
|
etk::VectorType<colorInformation_ts> m_HLDataPass1; //!< colorisation position in the current buffer pass 1
|
||||||
int32_t m_HLDataSequence; //!< position of the start of line requested by the screen viewer
|
|
||||||
void RegenerateHighLightAt(int32_t pos, int32_t nbDeleted, int32_t nbAdded);
|
void RegenerateHighLightAt(int32_t pos, int32_t nbDeleted, int32_t nbAdded);
|
||||||
void GenerateHighLightAt(int32_t pos, int32_t endPos, int32_t addinPos=0);
|
void GenerateHighLightAt(int32_t pos, int32_t endPos, int32_t addinPos=0);
|
||||||
void CleanHighLight(void);
|
void CleanHighLight(void);
|
||||||
|
@ -46,9 +46,6 @@ void EdnBuf::RegenerateHighLightAt(int32_t pos, int32_t nbDeleted, int32_t nbAdd
|
|||||||
//GTimeVal timeStart;
|
//GTimeVal timeStart;
|
||||||
//g_get_current_time(&timeStart);
|
//g_get_current_time(&timeStart);
|
||||||
|
|
||||||
// remove display HL...
|
|
||||||
m_HLDataSequence++;
|
|
||||||
|
|
||||||
// prevent ERROR...
|
// prevent ERROR...
|
||||||
if (NULL == m_Highlight) {
|
if (NULL == m_Highlight) {
|
||||||
return;
|
return;
|
||||||
@ -287,7 +284,6 @@ colorInformation_ts *EdnBuf::GetElementColorAtPosition(int32_t pos, int32_t &sta
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void EdnBuf::HightlightGenerateLines(displayHLData_ts & MData, int32_t HLStart, int32_t nbLines)
|
void EdnBuf::HightlightGenerateLines(displayHLData_ts & MData, int32_t HLStart, int32_t nbLines)
|
||||||
{
|
{
|
||||||
MData.posHLPass1 = 0;
|
MData.posHLPass1 = 0;
|
||||||
@ -295,65 +291,62 @@ void EdnBuf::HightlightGenerateLines(displayHLData_ts & MData, int32_t HLStart,
|
|||||||
if (NULL == m_Highlight) {
|
if (NULL == m_Highlight) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (MData.idSequence != m_HLDataSequence) {
|
//GTimeVal timeStart;
|
||||||
//GTimeVal timeStart;
|
//g_get_current_time(&timeStart);
|
||||||
//g_get_current_time(&timeStart);
|
HLStart = StartOfLine(HLStart);
|
||||||
MData.idSequence = m_HLDataSequence;
|
MData.HLData.Clear();
|
||||||
HLStart = StartOfLine(HLStart);
|
int32_t HLStop = CountForwardNLines(HLStart, nbLines);
|
||||||
MData.HLData.Clear();
|
int32_t startId, stopId;
|
||||||
int32_t HLStop = CountForwardNLines(HLStart, nbLines);
|
// find element previous
|
||||||
int32_t startId, stopId;
|
FindMainHighLightPosition(HLStart, HLStop, startId, stopId, true);
|
||||||
// find element previous
|
|
||||||
FindMainHighLightPosition(HLStart, HLStop, startId, stopId, true);
|
|
||||||
|
|
||||||
int32_t k;
|
int32_t k;
|
||||||
//EDN_DEBUG("List of section between : "<< startId << " & " << stopId);
|
//EDN_DEBUG("List of section between : "<< startId << " & " << stopId);
|
||||||
int32_t endSearch = stopId+1;
|
int32_t endSearch = stopId+1;
|
||||||
if (-1 == stopId) {
|
if (-1 == stopId) {
|
||||||
endSearch = m_HLDataPass1.Size();
|
endSearch = m_HLDataPass1.Size();
|
||||||
}
|
}
|
||||||
for (k=edn_max(startId, 0); k<endSearch; k++) {
|
for (k=edn_max(startId, 0); k<endSearch; k++) {
|
||||||
// empty section :
|
// empty section :
|
||||||
if (0==k) {
|
if (0==k) {
|
||||||
if (HLStart < m_HLDataPass1[k].beginStart) {
|
if (HLStart < m_HLDataPass1[k].beginStart) {
|
||||||
//EDN_DEBUG(" ==> (empty section 1 ) k="<<k<<" start="<<HLStart<<" stop="<<m_HLDataPass1[k].beginStart );
|
//EDN_DEBUG(" ==> (empty section 1 ) k="<<k<<" start="<<HLStart<<" stop="<<m_HLDataPass1[k].beginStart );
|
||||||
m_Highlight->Parse2(HLStart,
|
m_Highlight->Parse2(HLStart,
|
||||||
m_HLDataPass1[k].beginStart,
|
|
||||||
MData.HLData,
|
|
||||||
m_data);
|
|
||||||
} // else : nothing to do ...
|
|
||||||
} else {
|
|
||||||
//EDN_DEBUG(" ==> (empty section 2 ) k="<<k<<" start="<<m_HLDataPass1[k-1].endStop<<" stop="<<m_HLDataPass1[k].beginStart );
|
|
||||||
m_Highlight->Parse2(m_HLDataPass1[k-1].endStop,
|
|
||||||
m_HLDataPass1[k].beginStart,
|
m_HLDataPass1[k].beginStart,
|
||||||
MData.HLData,
|
MData.HLData,
|
||||||
m_data);
|
m_data);
|
||||||
}
|
} // else : nothing to do ...
|
||||||
// under section :
|
} else {
|
||||||
//EDN_DEBUG(" ==> (under section ) k="<<k<<" start="<<m_HLDataPass1[k].beginStart<<" stop="<<m_HLDataPass1[k].endStop << " subSectionOfID=" << 99999999);
|
//EDN_DEBUG(" ==> (empty section 2 ) k="<<k<<" start="<<m_HLDataPass1[k-1].endStop<<" stop="<<m_HLDataPass1[k].beginStart );
|
||||||
// TODO : ...
|
m_Highlight->Parse2(m_HLDataPass1[k-1].endStop,
|
||||||
|
m_HLDataPass1[k].beginStart,
|
||||||
|
MData.HLData,
|
||||||
|
m_data);
|
||||||
}
|
}
|
||||||
if (endSearch == (int32_t)m_HLDataPass1.Size() ){
|
// under section :
|
||||||
//if( k < (int32_t)m_HLDataPass1.Size()) {
|
//EDN_DEBUG(" ==> (under section ) k="<<k<<" start="<<m_HLDataPass1[k].beginStart<<" stop="<<m_HLDataPass1[k].endStop << " subSectionOfID=" << 99999999);
|
||||||
if (m_HLDataPass1.Size() != 0) {
|
// TODO : ...
|
||||||
//EDN_DEBUG(" ==> (empty section 3 ) k="<<k<<" start="<<m_HLDataPass1[k-1].endStop<<" stop="<<HLStop );
|
|
||||||
m_Highlight->Parse2(m_HLDataPass1[k-1].endStop,
|
|
||||||
HLStop,
|
|
||||||
MData.HLData,
|
|
||||||
m_data);
|
|
||||||
} else {
|
|
||||||
//EDN_DEBUG(" ==> (empty section 4 ) k="<<k<<" start=0 stop="<<HLStop );
|
|
||||||
m_Highlight->Parse2(0,
|
|
||||||
HLStop,
|
|
||||||
MData.HLData,
|
|
||||||
m_data);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//GTimeVal timeStop;
|
|
||||||
//g_get_current_time(&timeStop);
|
|
||||||
//EDN_DEBUG("Display reAnnalyse = " << timeStop.tv_usec - timeStart.tv_usec << " micro-s");
|
|
||||||
}
|
}
|
||||||
|
if (endSearch == (int32_t)m_HLDataPass1.Size() ){
|
||||||
|
//if( k < (int32_t)m_HLDataPass1.Size()) {
|
||||||
|
if (m_HLDataPass1.Size() != 0) {
|
||||||
|
//EDN_DEBUG(" ==> (empty section 3 ) k="<<k<<" start="<<m_HLDataPass1[k-1].endStop<<" stop="<<HLStop );
|
||||||
|
m_Highlight->Parse2(m_HLDataPass1[k-1].endStop,
|
||||||
|
HLStop,
|
||||||
|
MData.HLData,
|
||||||
|
m_data);
|
||||||
|
} else {
|
||||||
|
//EDN_DEBUG(" ==> (empty section 4 ) k="<<k<<" start=0 stop="<<HLStop );
|
||||||
|
m_Highlight->Parse2(0,
|
||||||
|
HLStop,
|
||||||
|
MData.HLData,
|
||||||
|
m_data);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//GTimeVal timeStop;
|
||||||
|
//g_get_current_time(&timeStop);
|
||||||
|
//EDN_DEBUG("Display reAnnalyse = " << timeStop.tv_usec - timeStart.tv_usec << " micro-s");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user