Add the maximum size of the current text edition

This commit is contained in:
Edouard Dupin 2012-04-24 13:36:25 +02:00
parent 845232656b
commit a3c58a6c33
3 changed files with 15 additions and 4 deletions

View File

@ -116,13 +116,16 @@ class Buffer {
// moving with cursor change position:
private:
bool m_updatePositionRequested;
bool m_updatePositionRequested; //!< if a position xhange in the windows ...
coord2D_ts m_maximumSize; //!< current maxSize of the buffer
protected:
void RequestUpdateOfThePosition(void) { m_updatePositionRequested = true; };
void SetMaximumSize(coord2D_ts maxSize) { m_maximumSize = maxSize; };
public:
bool NeedToUpdateDisplayPosition(void);
virtual coord2D_ts GetBorderSize(void); // this is to requested the minimum size for the buffer that is not consider as visible ...
virtual coord2D_ts GetPosition(int32_t fontId, bool& centerRequested);
coord2D_ts GetMaxSize(void) { return m_maximumSize; };
protected:
bool m_fileModify; //!<
// naming

View File

@ -297,7 +297,9 @@ int32_t BufferText::Display(ewol::OObject2DTextColored& OOTextNormal,
// update the display position with the scroll ofset :
int32_t displayStartBufferPos = m_EdnBuf.CountForwardNLines(0, displayStartLineId);
coord2D_ts maxSize;
maxSize.x = 0.0;
maxSize.y = m_EdnBuf.NumberOfLines() * letterHeight;
int32_t nbColoneForLineNumber = GetLineNumberNumberOfElement();
// update the number of element that can be displayed
@ -367,6 +369,7 @@ int32_t BufferText::Display(ewol::OObject2DTextColored& OOTextNormal,
OOTextBoldItalic.clippingSet(drawClippingTextArea);
OOColored.clippingSet(drawClippingTextArea);
etkFloat_t lineMaxSize = 0.0;
for (iii=displayStartBufferPos; iii<mylen && displayLines < m_displaySize.y ; iii = new_i) {
//APPL_DEBUG("diplay element=" << iii);
int displaywidth;
@ -438,9 +441,12 @@ int32_t BufferText::Display(ewol::OObject2DTextColored& OOTextNormal,
// display the cursor:
DrawCursor(&OOColored, pixelX - offsetX, y, letterHeight, letterWidth, drawClippingTextArea);
}
lineMaxSize += drawSize;
pixelX += drawSize;
// move to next line ...
if (currentChar=='\n') {
maxSize.x = etk_max(lineMaxSize, maxSize.x);
lineMaxSize = 0.0;
idX =0;
pixelX = x_base + SEPARATION_SIZE_LINE_NUMBER;
y += letterHeight;
@ -457,7 +463,8 @@ int32_t BufferText::Display(ewol::OObject2DTextColored& OOTextNormal,
if (m_cursorPos == iii) {
DrawCursor(&OOColored, pixelX - offsetX, y, letterHeight, letterWidth, drawClippingTextArea);
}
// set the maximum size for the display ...
SetMaximumSize(maxSize);
int64_t stopTime2 = GetCurrentTime();
APPL_DEBUG("DRAW text (brut) = " << stopTime2 - stopTime << " micro-s");

View File

@ -163,7 +163,6 @@ void CodeView::OnRegenerateDisplay(void)
bool centerRequested = false;
coord2D_ts currentPosition = BufferManager::Get(m_bufferID)->GetPosition(m_OObjectTextNormal[m_currentCreateId].GetFontID(), centerRequested);
SetScrollingPositionDynamic(borderWidth, currentPosition, centerRequested);
} // else : nothing to do ...
// generate the objects :
@ -173,6 +172,8 @@ void CodeView::OnRegenerateDisplay(void)
m_OObjectTextBoldItalic[m_currentCreateId],
m_OObjectsColored[m_currentCreateId],
m_originScrooled.x, m_originScrooled.y, m_size.x, m_size.y);
// set the current size of the windows
SetMaxSize(BufferManager::Get(m_bufferID)->GetMaxSize());
int64_t stopTime = GetCurrentTime();
APPL_DEBUG("Display Code Generation = " << stopTime - startTime << " micro-s");