diff --git a/avancement.boo b/avancement.boo index 6413f7d..e100355 100644 --- a/avancement.boo +++ b/avancement.boo @@ -1,4 +1,12 @@ # action a faire (ordonner par révision) : + +dans la liste des truc important a refaire + l'annalyseur d'expression regulière pour le display, le faire ligne par ligne + ne pas regénéré l'affichage des widget quand les taille change + mettre en place le positionnement des élément par matrice ... ==> gain de temps en repaint... + + + * 0.2.X : - gui : Amelioration du full-screen et du display de base (sans l'entete de la fenetre) - gui : Mise en place d'un display ligne par ligne diff --git a/jni/Linux.mk b/jni/Linux.mk index 286d973..06ec1a9 100644 --- a/jni/Linux.mk +++ b/jni/Linux.mk @@ -15,7 +15,8 @@ LOCAL_SRC_FILES := $(FILE_LIST) LOCAL_LDLIBS := -LOCAL_CFLAGS := -DEWOL_USE_FREE_TYPE \ +LOCAL_CFLAGS := -D__PLATFORM__Linux \ + -DEWOL_USE_FREE_TYPE \ -DEDN_DEBUG_LEVEL=3 include $(BUILD_EXECUTABLE) diff --git a/jni/edn/Buffer/Buffer.cpp b/jni/edn/Buffer/Buffer.cpp index 423893f..db4ac92 100644 --- a/jni/edn/Buffer/Buffer.cpp +++ b/jni/edn/Buffer/Buffer.cpp @@ -148,10 +148,10 @@ void Buffer::SetLineDisplay(uint32_t lineNumber) * @return --- * */ -int32_t Buffer::Display(ewol::OObject2DTextColored* OOTextNormal, - ewol::OObject2DTextColored* OOTextBold, - ewol::OObject2DTextColored* OOTextItalic, - ewol::OObject2DTextColored* OOTextBoldItalic, ewol::OObject2DColored* OOColored, +int32_t Buffer::Display(ewol::OObject2DTextColored& OOTextNormal, + ewol::OObject2DTextColored& OOTextBold, + ewol::OObject2DTextColored& OOTextItalic, + ewol::OObject2DTextColored& OOTextBoldItalic, ewol::OObject2DColored& OOColored, int32_t offsetX, int32_t offsetY, int32_t sizeX, int32_t sizeY) { return ERR_NONE; diff --git a/jni/edn/Buffer/Buffer.h b/jni/edn/Buffer/Buffer.h index 5f64d30..75b210e 100644 --- a/jni/edn/Buffer/Buffer.h +++ b/jni/edn/Buffer/Buffer.h @@ -82,11 +82,11 @@ class Buffer { virtual void GetInfo(infoStatBuffer_ts &infoToUpdate); virtual void SetLineDisplay(uint32_t lineNumber); - virtual int32_t Display(ewol::OObject2DTextColored* OOTextNormal, - ewol::OObject2DTextColored* OOTextBold, - ewol::OObject2DTextColored* OOTextItalic, - ewol::OObject2DTextColored* OOTextBoldItalic, - ewol::OObject2DColored* OOColored, int32_t offsetX, int32_t offsetY, int32_t sizeX, int32_t sizeY); + virtual int32_t Display(ewol::OObject2DTextColored& OOTextNormal, + ewol::OObject2DTextColored& OOTextBold, + ewol::OObject2DTextColored& OOTextItalic, + ewol::OObject2DTextColored& OOTextBoldItalic, + ewol::OObject2DColored& OOColored, int32_t offsetX, int32_t offsetY, int32_t sizeX, int32_t sizeY); virtual void ForceReDraw(bool allElement); virtual void AddChar(uniChar_t unicodeData); virtual void cursorMove(ewol::eventKbMoveType_te moveTypeEvent); diff --git a/jni/edn/Buffer/BufferEmpty.cpp b/jni/edn/Buffer/BufferEmpty.cpp index 226c88f..26ab3f5 100644 --- a/jni/edn/Buffer/BufferEmpty.cpp +++ b/jni/edn/Buffer/BufferEmpty.cpp @@ -67,27 +67,17 @@ BufferEmpty::~BufferEmpty(void) * @return --- * */ -int32_t BufferEmpty::Display(ewol::OObject2DTextColored* OOTextNormal, - ewol::OObject2DTextColored* OOTextBold, - ewol::OObject2DTextColored* OOTextItalic, - ewol::OObject2DTextColored* OOTextBoldItalic, - ewol::OObject2DColored* OOColored, int32_t offsetX, int32_t offsetY, int32_t sizeX, int32_t sizeY) +int32_t BufferEmpty::Display(ewol::OObject2DTextColored& OOTextNormal, + ewol::OObject2DTextColored& OOTextBold, + ewol::OObject2DTextColored& OOTextItalic, + ewol::OObject2DTextColored& OOTextBoldItalic, + ewol::OObject2DColored& OOColored, int32_t offsetX, int32_t offsetY, int32_t sizeX, int32_t sizeY) { ColorizeManager * myColorManager = ColorizeManager::getInstance(); // Get color : Colorize *myColor = NULL; - //drawer.Flush(); - - if (NULL == OOTextNormal) { - EDN_ERROR("Input VALUE is NULL"); - return ERR_FAIL; - } - if (NULL == OOColored) { - EDN_ERROR("Input VALUE is NULL"); - return ERR_FAIL; - } - int32_t fontId = OOTextNormal->GetFontID(); + int32_t fontId = OOTextNormal.GetFontID(); int32_t letterHeight = ewol::GetHeight(fontId); coord2D_ts textPos; @@ -100,15 +90,15 @@ int32_t BufferEmpty::Display(ewol::OObject2DTextColored* OOTextNormal, drawClipping.h = sizeY; myColor = myColorManager->Get("normal"); - OOTextNormal->SetColor(myColor->GetFG()); + OOTextNormal.SetColor(myColor->GetFG()); etk::UString tmpDisplay = "edn - Editeur De N'ours"; - OOTextBold->Text(textPos, drawClipping, tmpDisplay); + OOTextBold.Text(textPos, drawClipping, tmpDisplay); myColor = myColorManager->Get("commentDoxygen"); - OOTextNormal->SetColor(myColor->GetFG()); + OOTextNormal.SetColor(myColor->GetFG()); textPos.y = (int32_t)(textPos.y + letterHeight*1.30); tmpDisplay = "No Buffer Availlable to display"; - OOTextNormal->Text(textPos, drawClipping, tmpDisplay); + OOTextNormal.Text(textPos, drawClipping, tmpDisplay); color_ts bgColor; //!< Text color @@ -116,8 +106,8 @@ int32_t BufferEmpty::Display(ewol::OObject2DTextColored* OOTextNormal, bgColor.green = 1.0; bgColor.blue = 1.0; bgColor.alpha = 1.0; - OOColored->SetColor(bgColor); - OOColored->Rectangle( 0, 0, sizeX, sizeY); + OOColored.SetColor(bgColor); + OOColored.Rectangle( 0, 0, sizeX, sizeY); return ERR_NONE; } diff --git a/jni/edn/Buffer/BufferEmpty.h b/jni/edn/Buffer/BufferEmpty.h index c613c2c..4277874 100644 --- a/jni/edn/Buffer/BufferEmpty.h +++ b/jni/edn/Buffer/BufferEmpty.h @@ -32,11 +32,11 @@ class BufferEmpty : public Buffer { public: BufferEmpty(void); virtual ~BufferEmpty(void); - int32_t Display(ewol::OObject2DTextColored* OOTextNormal, - ewol::OObject2DTextColored* OOTextBold, - ewol::OObject2DTextColored* OOTextItalic, - ewol::OObject2DTextColored* OOTextBoldItalic, - ewol::OObject2DColored* OOColored, int32_t offsetX, int32_t offsetY, int32_t sizeX, int32_t sizeY); + int32_t Display(ewol::OObject2DTextColored& OOTextNormal, + ewol::OObject2DTextColored& OOTextBold, + ewol::OObject2DTextColored& OOTextItalic, + ewol::OObject2DTextColored& OOTextBoldItalic, + ewol::OObject2DColored& OOColored, int32_t offsetX, int32_t offsetY, int32_t sizeX, int32_t sizeY); }; diff --git a/jni/edn/Buffer/BufferText.cpp b/jni/edn/Buffer/BufferText.cpp index 9be1f8f..c37c232 100644 --- a/jni/edn/Buffer/BufferText.cpp +++ b/jni/edn/Buffer/BufferText.cpp @@ -324,11 +324,11 @@ static int32_t g_basicfontId = 0; * @return * */ -int32_t BufferText::Display(ewol::OObject2DTextColored* OOTextNormal, - ewol::OObject2DTextColored* OOTextBold, - ewol::OObject2DTextColored* OOTextItalic, - ewol::OObject2DTextColored* OOTextBoldItalic, - ewol::OObject2DColored* OOColored, +int32_t BufferText::Display(ewol::OObject2DTextColored& OOTextNormal, + ewol::OObject2DTextColored& OOTextBold, + ewol::OObject2DTextColored& OOTextItalic, + ewol::OObject2DTextColored& OOTextBoldItalic, + ewol::OObject2DColored& OOColored, int32_t offsetX, int32_t offsetY, int32_t sizeX, int32_t sizeY) { @@ -340,7 +340,7 @@ int32_t BufferText::Display(ewol::OObject2DTextColored* OOTextNormal, bool selIsRect; int32_t selHave; - int32_t fontId = OOTextNormal->GetFontID(); + int32_t fontId = OOTextNormal.GetFontID(); // TODO : Remove this ... g_basicfontId = fontId; int32_t letterWidth = ewol::GetWidth(fontId, "A"); @@ -390,14 +390,18 @@ int32_t BufferText::Display(ewol::OObject2DTextColored* OOTextNormal, int32_t x_base=nbColoneForLineNumber*letterWidth; int32_t idX = 0; - OOColored->SetColor(myColorManager->Get(COLOR_CODE_BASIC_BG)); - OOColored->Rectangle( 0, 0, sizeX, sizeY); + OOColored.SetColor(myColorManager->Get(COLOR_CODE_BASIC_BG)); + OOColored.Rectangle( 0, 0, sizeX, sizeY); + int64_t startTime = GetCurrentTime(); int displayLines = 0; // Regenerate the colorizing if necessary ... displayHLData_ts m_displayLocalSyntax; m_EdnBuf.HightlightGenerateLines(m_displayLocalSyntax, m_displayStartBufferPos, m_displaySize.y); + int64_t stopTime = GetCurrentTime(); + EDN_DEBUG("Parsing Highlight = " << stopTime - startTime << " milli-s"); + uniChar_t displayChar[MAX_EXP_CHAR_LEN]; memset(displayChar, 0, sizeof(uniChar_t)*MAX_EXP_CHAR_LEN); etk::UString myStringToDisplay; @@ -407,7 +411,7 @@ int32_t BufferText::Display(ewol::OObject2DTextColored* OOTextNormal, EDN_VERBOSE("cursor Pos : " << m_cursorPos << "start at pos=" << m_displayStartBufferPos); - DrawLineNumber(OOTextNormal, OOColored, x_base, sizeY, myPrint, currentLineID, y); + DrawLineNumber(&OOTextNormal, &OOColored, x_base, sizeY, myPrint, currentLineID, y); int32_t pixelX = x_base + SEPARATION_SIZE_LINE_NUMBER; clipping_ts drawClipping; @@ -444,21 +448,21 @@ int32_t BufferText::Display(ewol::OObject2DTextColored* OOTextNormal, && selEnd > iii) { selectColor = myColorSel; - OOColored->SetColor(selectColor->GetBG()); + OOColored.SetColor(selectColor->GetBG()); haveBg = selectColor->HaveBg(); } else { if( ' ' == currentChar && true == globals::IsSetDisplaySpaceChar() ) { - OOColored->SetColor(myColorSpace); + OOColored.SetColor(myColorSpace); haveBg = true; } else if( '\t' == currentChar && true == globals::IsSetDisplaySpaceChar() ) { - OOColored->SetColor(myColorTab); + OOColored.SetColor(myColorTab); haveBg = true; } else { - OOColored->SetColor(selectColor->GetBG()); + OOColored.SetColor(selectColor->GetBG()); haveBg = selectColor->HaveBg(); } } @@ -467,30 +471,31 @@ int32_t BufferText::Display(ewol::OObject2DTextColored* OOTextNormal, textPos.y = y; if (true == selectColor->GetItalic() ) { if (true == selectColor->GetBold() ) { - OOTextSelected = OOTextBoldItalic; + OOTextSelected = &OOTextBoldItalic; } else { - OOTextSelected = OOTextItalic; + OOTextSelected = &OOTextItalic; } } else { if (true == selectColor->GetBold() ) { - OOTextSelected = OOTextBold; + OOTextSelected = &OOTextBold; } else { - OOTextSelected = OOTextNormal; + OOTextSelected = &OOTextNormal; } } OOTextSelected->SetColor(selectColor->GetFG()); // TODO : Remove this unreallistic leak of time myStringToDisplay = displayChar; drawSize = OOTextSelected->Text(textPos, drawClippingTextArea, myStringToDisplay); + if (true == haveBg ) { - OOColored->Rectangle(textPos.x, y, drawSize, letterHeight, drawClippingTextArea); + OOColored.Rectangle(textPos.x, y, drawSize, letterHeight, drawClippingTextArea); } } idX += displaywidth; // display cursor : if (m_cursorPos == iii) { // display the cursor: - CursorDisplay(OOColored, pixelX, y, letterHeight, letterWidth); + CursorDisplay(&OOColored, pixelX, y, letterHeight, letterWidth); } pixelX += drawSize; // move to next line ... @@ -500,13 +505,16 @@ int32_t BufferText::Display(ewol::OObject2DTextColored* OOTextNormal, y += letterHeight; displayLines++; currentLineID++; - DrawLineNumber(OOTextNormal, OOColored, x_base, sizeY, myPrint, currentLineID, y); + DrawLineNumber(&OOTextNormal, &OOColored, x_base, sizeY, myPrint, currentLineID, y); } } // special case : the cursor is at the end of the buffer... if (m_cursorPos == iii) { - CursorDisplay(OOColored, pixelX, y, letterHeight, letterWidth); + CursorDisplay(&OOColored, pixelX, y, letterHeight, letterWidth); } + + int64_t stopTime2 = GetCurrentTime(); + EDN_DEBUG("DRAW text (brut) = " << stopTime2 - stopTime << " milli-s"); return ERR_NONE; } diff --git a/jni/edn/Buffer/BufferText.h b/jni/edn/Buffer/BufferText.h index 0250f4b..89f6aad 100644 --- a/jni/edn/Buffer/BufferText.h +++ b/jni/edn/Buffer/BufferText.h @@ -46,11 +46,11 @@ class BufferText : public Buffer { void GetInfo(infoStatBuffer_ts &infoToUpdate); void SetLineDisplay(uint32_t lineNumber); - int32_t Display(ewol::OObject2DTextColored* OOTextNormal, - ewol::OObject2DTextColored* OOTextBold, - ewol::OObject2DTextColored* OOTextItalic, - ewol::OObject2DTextColored* OOTextBoldItalic, - ewol::OObject2DColored* OOColored, + int32_t Display(ewol::OObject2DTextColored& OOTextNormal, + ewol::OObject2DTextColored& OOTextBold, + ewol::OObject2DTextColored& OOTextItalic, + ewol::OObject2DTextColored& OOTextBoldItalic, + ewol::OObject2DColored& OOColored, int32_t offsetX, int32_t offsetY, int32_t sizeX, int32_t sizeY); void ForceReDraw(bool allElement); diff --git a/jni/edn/Gui/CodeView.cpp b/jni/edn/Gui/CodeView.cpp index 28cf7cd..8617305 100644 --- a/jni/edn/Gui/CodeView.cpp +++ b/jni/edn/Gui/CodeView.cpp @@ -70,6 +70,9 @@ CodeView::CodeView(void) m_textColorBg.alpha = 0.25; SetCanHaveFocus(true); ewol::widgetMessageMultiCast::Add(GetWidgetId(), ednMsgBufferId); + + GenericDrawDisable(); + SpecificDrawEnable(); } CodeView::~CodeView(void) @@ -90,8 +93,21 @@ void CodeView::CalculateMaxSize(void) int32_t letterHeight = ewol::GetHeight(m_fontNormal); m_maxSize.y = m_bufferManager->Get(m_bufferID)->GetNumberOfLine() * letterHeight; } +// TODO : remove this from here ... +#include - +bool CodeView::OnDraw(void) +{ + //glLoadIdentity(); + glTranslatef(m_origin.x,m_origin.y, 0); + m_OObjectsColored[ m_currentDrawId].Draw(); + m_OObjectTextNormal[ m_currentDrawId].Draw(); + m_OObjectTextBold[ m_currentDrawId].Draw(); + m_OObjectTextItalic[ m_currentDrawId].Draw(); + m_OObjectTextBoldItalic[m_currentDrawId].Draw(); + glTranslatef(-m_origin.x,-m_origin.y, 0); + return true; +} void CodeView::OnRegenerateDisplay(void) { @@ -101,32 +117,33 @@ void CodeView::OnRegenerateDisplay(void) // For the scrooling windows CalculateMaxSize(); - // create tmp object : - ewol::OObject2DTextColored* myOObjectTextNormal = new ewol::OObject2DTextColored(m_fontNormal); - ewol::OObject2DTextColored* myOObjectTextBold = new ewol::OObject2DTextColored(m_fontBold); - ewol::OObject2DTextColored* myOObjectTextItalic = new ewol::OObject2DTextColored(m_fontItalic); - ewol::OObject2DTextColored* myOObjectTextBoldItalic = new ewol::OObject2DTextColored(m_fontBoldItalic); - ewol::OObject2DColored* myOObjectsColored = new ewol::OObject2DColored(); + // clean internal elements ... + m_OObjectTextNormal[ m_currentCreateId].SetFontID(m_fontNormal); + m_OObjectTextBold[ m_currentCreateId].SetFontID(m_fontBold); + m_OObjectTextItalic[ m_currentCreateId].SetFontID(m_fontItalic); + m_OObjectTextBoldItalic[m_currentCreateId].SetFontID(m_fontBoldItalic); + + m_OObjectTextNormal[ m_currentCreateId].Clear(); + m_OObjectTextBold[ m_currentCreateId].Clear(); + m_OObjectTextItalic[ m_currentCreateId].Clear(); + m_OObjectTextBoldItalic[m_currentCreateId].Clear(); + m_OObjectsColored[ m_currentCreateId].Clear(); + // generate the objects : - //m_bufferID = 0; - m_bufferManager->Get(m_bufferID)->Display(myOObjectTextNormal, myOObjectTextBold, myOObjectTextItalic, myOObjectTextBoldItalic, myOObjectsColored, + m_bufferManager->Get(m_bufferID)->Display(m_OObjectTextNormal[m_currentCreateId], + m_OObjectTextBold[m_currentCreateId], + m_OObjectTextItalic[m_currentCreateId], + m_OObjectTextBoldItalic[m_currentCreateId], + m_OObjectsColored[m_currentCreateId], m_originScrooled.x, m_originScrooled.y, m_size.x, m_size.y); - // clean the object list ... - ClearOObjectList(); - // add generated element - AddOObject(myOObjectsColored, "CodeViewBackground"); - AddOObject(myOObjectTextNormal, "CodeViewTextNormal"); - AddOObject(myOObjectTextBold, "CodeViewTextBold"); - AddOObject(myOObjectTextItalic, "CodeViewTextItalic"); - AddOObject(myOObjectTextBoldItalic, "CodeViewTextBoldItalic"); - int64_t stopTime = GetCurrentTime(); EDN_DEBUG("Display Code Generation = " << stopTime - startTime << " milli-s"); // call the herited class... WidgetScrooled::OnRegenerateDisplay(); + m_needFlipFlop = true; } } diff --git a/jni/edn/Gui/CodeView.h b/jni/edn/Gui/CodeView.h index 16f273c..95631fa 100644 --- a/jni/edn/Gui/CodeView.h +++ b/jni/edn/Gui/CodeView.h @@ -42,13 +42,20 @@ class CodeView :public ewol::WidgetScrooled virtual ~CodeView(void); virtual bool CalculateMinSize(void); private: - etk::UString m_label; - color_ts m_textColorFg; //!< Text color - color_ts m_textColorBg; //!< Background color - BufferManager * m_bufferManager; - ColorizeManager * m_colorManager; - int32_t m_bufferID; - bool m_buttunOneSelected; + etk::UString m_label; + color_ts m_textColorFg; //!< Text color + color_ts m_textColorBg; //!< Background color + BufferManager * m_bufferManager; + ColorizeManager * m_colorManager; + int32_t m_bufferID; + bool m_buttunOneSelected; + // drawing elements : + ewol::OObject2DTextColored m_OObjectTextNormal[NB_BOUBLE_BUFFER]; + ewol::OObject2DTextColored m_OObjectTextBold[NB_BOUBLE_BUFFER]; + ewol::OObject2DTextColored m_OObjectTextItalic[NB_BOUBLE_BUFFER]; + ewol::OObject2DTextColored m_OObjectTextBoldItalic[NB_BOUBLE_BUFFER]; + ewol::OObject2DColored m_OObjectsColored[NB_BOUBLE_BUFFER]; + public: virtual void OnRegenerateDisplay(void); bool OnEventAreaExternal(int32_t widgetID, const char * generateEventId, const char * eventExternId, etkFloat_t x, etkFloat_t y); @@ -72,6 +79,9 @@ class CodeView :public ewol::WidgetScrooled void SetFontNameBoldItalic(etk::UString fontName); private: void CalculateMaxSize(void); + // widget drawing : + protected: + virtual bool OnDraw(void); }; #endif