From 8989a3dea091086f138cab37ea43c54d17e4bde4 Mon Sep 17 00:00:00 2001 From: Edouard Dupin Date: Wed, 22 Feb 2012 13:40:21 +0100 Subject: [PATCH] Add the double-buffering in all needed classes that is already missing --- Sources/libewol/ewol/Widget.cpp | 3 +- Sources/libewol/ewol/Widget.h | 1 + Sources/libewol/ewol/WidgetManager.cpp | 46 ++++--- Sources/libewol/ewol/Windows.cpp | 113 ++++++++++-------- Sources/libewol/ewol/Windows.h | 5 +- Sources/libewol/ewol/base/gui.cpp | 1 + Sources/libewol/ewol/widget/PopUp.cpp | 56 +++++---- Sources/libewol/ewol/widget/PopUp.h | 3 +- Sources/libewol/ewol/widget/SizerHori.cpp | 97 ++++++++------- Sources/libewol/ewol/widget/SizerHori.h | 3 +- Sources/libewol/ewol/widget/SizerVert.cpp | 90 +++++++------- Sources/libewol/ewol/widget/SizerVert.h | 3 +- .../libewol/ewol/widgetMeta/FileChooser.cpp | 8 +- 13 files changed, 233 insertions(+), 196 deletions(-) diff --git a/Sources/libewol/ewol/Widget.cpp b/Sources/libewol/ewol/Widget.cpp index c9713d2e..5efbd9ba 100644 --- a/Sources/libewol/ewol/Widget.cpp +++ b/Sources/libewol/ewol/Widget.cpp @@ -79,7 +79,7 @@ ewol::Widget::Widget(void) m_needRegenerateDisplay = true; m_currentDrawId = 0; m_currentCreateId = 1; - m_needFlipFlop = false; + m_needFlipFlop = true; m_origin.x = 0.0; m_origin.y = 0.0; m_size.x = 10.0; @@ -202,6 +202,7 @@ void ewol::Widget::DoubleBufferFlipFlop(void) m_currentCreateId = 0; } m_needFlipFlop = false; + OnFlipFlopEvent(); } } diff --git a/Sources/libewol/ewol/Widget.h b/Sources/libewol/ewol/Widget.h index 90370652..3965fa56 100644 --- a/Sources/libewol/ewol/Widget.h +++ b/Sources/libewol/ewol/Widget.h @@ -213,6 +213,7 @@ namespace ewol { bool NeedRedraw(void) { bool tmpData=m_needRegenerateDisplay; m_needRegenerateDisplay=false; return tmpData; }; public: void DoubleBufferFlipFlop(void); + virtual void OnFlipFlopEvent(void) { /* nothing to do */ }; virtual void OnRegenerateDisplay(void) { /* nothing to do */ }; bool GenDraw(void); diff --git a/Sources/libewol/ewol/WidgetManager.cpp b/Sources/libewol/ewol/WidgetManager.cpp index bf2fec9a..5eefb580 100644 --- a/Sources/libewol/ewol/WidgetManager.cpp +++ b/Sources/libewol/ewol/WidgetManager.cpp @@ -73,7 +73,7 @@ void ewol::widgetManager::UnInit(void) } } // local acces ==> this control the mutex Lock - RemoveAllMarkWidget(); + ewol::widgetManager::RemoveAllMarkWidget(); IsInit = false; @@ -251,6 +251,8 @@ void ewol::widgetManager::GetDoubleBufferFlipFlop(void) } } needRedraw = true; + // Remove the deprecated flipFlop elements ... + pthread_mutex_unlock(&localMutex); } @@ -319,29 +321,25 @@ void ewol::widgetManager::MarkWidgetToBeRemoved(ewol::Widget * expectedWidget) void ewol::widgetManager::RemoveAllMarkWidget(void) { - if (IsInit) { - pthread_mutex_lock(&localMutex); - etk::VectorType m_widgetDeletedList_tmp = m_widgetDeletedList; - /* - if (m_widgetDeletedList.Size() > 0 ) { - EWOL_DEBUG("NB element to remove : " << m_widgetDeletedList.Size()); - } - */ - // flip/Flop all the widget registered : - for(int32_t iii=0; iii 0 ) { - EWOL_CRITICAL("Memory leak ==> not all the widget are auto-removed nb = " << m_widgetDeletedList.Size()); - // in every case clean the list ... - m_widgetDeletedList.Clear(); - } - */ - pthread_mutex_unlock(&localMutex); + etk::VectorType m_widgetDeletedList_tmp = m_widgetDeletedList; + /* + if (m_widgetDeletedList.Size() > 0 ) { + EWOL_DEBUG("NB element to remove : " << m_widgetDeletedList.Size()); } + */ + // flip/Flop all the widget registered : + for(int32_t iii=0; iii 0 ) { + EWOL_CRITICAL("Memory leak ==> not all the widget are auto-removed nb = " << m_widgetDeletedList.Size()); + // in every case clean the list ... + m_widgetDeletedList.Clear(); + } + */ } diff --git a/Sources/libewol/ewol/Windows.cpp b/Sources/libewol/ewol/Windows.cpp index 1c05d569..db964ccc 100644 --- a/Sources/libewol/ewol/Windows.cpp +++ b/Sources/libewol/ewol/Windows.cpp @@ -46,7 +46,9 @@ extern const char * const ewolEventWindowsHideKeyboard = "ewol Windows hideKey ewol::Windows::Windows(void) { SetCanHaveFocus(true); - m_subWidget = NULL; + for(int32_t iii=0; iiiSetOrigin(0, m_size.y - keyboardHigh); m_keyBoardwidget->CalculateSize(m_size.x, keyboardHigh); } - if (NULL != m_subWidget) { - m_subWidget->CalculateMinSize(); + if (NULL != m_subWidget[m_currentCreateId]) { + m_subWidget[m_currentCreateId]->CalculateMinSize(); // TODO : Check if min Size is possible ... // TODO : Herited from MinSize .. and expand ??? - m_subWidget->CalculateSize(m_size.x, m_size.y - keyboardHigh); + m_subWidget[m_currentCreateId]->CalculateSize(m_size.x, m_size.y - keyboardHigh); } - for(int32_t iii=0; iiiCalculateMinSize(); - m_popUpWidgetList[iii]->CalculateSize(m_size.x, m_size.y - keyboardHigh); + for(int32_t iii=0; iiiCalculateMinSize(); + m_popUpWidgetList[m_currentCreateId][iii]->CalculateSize(m_size.x, m_size.y - keyboardHigh); } } - // regenerate all the display ... - MarkToReedraw(); return true; } @@ -113,15 +114,15 @@ bool ewol::Windows::OnEventInput(int32_t IdInput, eventInputType_te typeEvent, e } } // event go directly on the pop-up - if (0 < m_popUpWidgetList.Size()) { - if (NULL == m_popUpWidgetList[m_popUpWidgetList.Size()-1]) { - m_popUpWidgetList.PopBack(); + if (0 < m_popUpWidgetList[m_currentCreateId].Size()) { + if (NULL == m_popUpWidgetList[m_currentCreateId][m_popUpWidgetList[m_currentCreateId].Size()-1]) { + m_popUpWidgetList[m_currentCreateId].PopBack(); } else { - m_popUpWidgetList[m_popUpWidgetList.Size()-1]->GenEventInput(IdInput, typeEvent, x, y); + m_popUpWidgetList[m_currentCreateId][m_popUpWidgetList[m_currentCreateId].Size()-1]->GenEventInput(IdInput, typeEvent, x, y); } // otherwise in the normal windows - } else if (NULL != m_subWidget) { - m_subWidget->GenEventInput(IdInput, typeEvent, x, y); + } else if (NULL != m_subWidget[m_currentCreateId]) { + m_subWidget[m_currentCreateId]->GenEventInput(IdInput, typeEvent, x, y); } return true; } @@ -176,15 +177,12 @@ void ewol::Windows::SysDraw(void) void ewol::Windows::OnRegenerateDisplay(void) { - if (true == NeedRedraw()) { - // no decoration ... + if (NULL != m_subWidget[m_currentCreateId]) { + m_subWidget[m_currentCreateId]->OnRegenerateDisplay(); } - if (NULL != m_subWidget) { - m_subWidget->OnRegenerateDisplay(); - } - for(int32_t iii=0; iiiOnRegenerateDisplay(); + for(int32_t iii=0; iiiOnRegenerateDisplay(); } } if (NULL != m_keyBoardwidget && false == m_keyBoardwidget->IsHide() ) { @@ -195,21 +193,22 @@ void ewol::Windows::OnRegenerateDisplay(void) bool ewol::Windows::OnDraw(void) { + //EWOL_WARNING(" WINDOWS draw on " << m_currentDrawId); // first display the windows on the display - if (NULL != m_subWidget) { - m_subWidget->GenDraw(); + if (NULL != m_subWidget[m_currentDrawId]) { + m_subWidget[m_currentDrawId]->GenDraw(); //EWOL_DEBUG("Draw Windows"); } // second display the pop-up - for(int32_t iii=0; iiiGenDraw(); + for(int32_t iii=0; iiiGenDraw(); //EWOL_DEBUG("Draw Pop-up"); } } if (NULL != m_keyBoardwidget && false == m_keyBoardwidget->IsHide() ) { m_keyBoardwidget->GenDraw(); - //EWOL_DEBUG("Draw Pop-up"); + //EWOL_DEBUG("Draw kewboard"); } return true; } @@ -218,33 +217,37 @@ bool ewol::Windows::OnDraw(void) void ewol::Windows::SetSubWidget(ewol::Widget * widget) { - if (NULL != m_subWidget) { + if (NULL != m_subWidget[m_currentCreateId]) { EWOL_INFO("Remove current main windows Widget..."); - ewol::widgetManager::MarkWidgetToBeRemoved(m_subWidget); - m_subWidget = NULL; + ewol::widgetManager::MarkWidgetToBeRemoved(m_subWidget[m_currentCreateId]); + m_subWidget[m_currentCreateId] = NULL; } - m_subWidget = widget; + m_subWidget[m_currentCreateId] = widget; // Regenerate the size calculation : CalculateSize(m_size.x, m_size.y); + m_needFlipFlop = true; } void ewol::Windows::PopUpWidgetPush(ewol::Widget * widget) { - m_popUpWidgetList.PushBack(widget); + m_popUpWidgetList[m_currentCreateId].PushBack(widget); // Regenerate the size calculation : CalculateSize(m_size.x, m_size.y); + m_needFlipFlop = true; } void ewol::Windows::PopUpWidgetPop(int32_t popUpId) { if(popUpId >= 0) { - for(int32_t iii=0; iiiGetWidgetId() == popUpId) { - ewol::widgetManager::MarkWidgetToBeRemoved(m_popUpWidgetList[iii]); - m_popUpWidgetList[iii] = NULL; - m_popUpWidgetList.Erase(iii); + for(int32_t iii=0; iiiGetWidgetId() == popUpId) { + ewol::widgetManager::MarkWidgetToBeRemoved(m_popUpWidgetList[m_currentCreateId][iii]); + m_popUpWidgetList[m_currentCreateId][iii] = NULL; + m_popUpWidgetList[m_currentCreateId].Erase(iii); + m_needFlipFlop = true; + CalculateSize(m_size.x, m_size.y); return; } } @@ -279,7 +282,6 @@ void ewol::Windows::KeyboardShow(ewol::keyboardMode_te mode) m_keyBoardwidget->Show(); } CalculateSize(m_size.x, m_size.y); - MarkToReedraw(); #endif } @@ -291,5 +293,14 @@ void ewol::Windows::KeyboardHide(void) m_keyBoardwidget->Hide(); } CalculateSize(m_size.x, m_size.y); - MarkToReedraw(); } + + + +void ewol::Windows::OnFlipFlopEvent(void) +{ + //EWOL_CRITICAL("FlipFlop on windows draw("< m_popUpWidgetList; + ewol::Widget* m_subWidget[NB_BOUBLE_BUFFER]; + etk::VectorType m_popUpWidgetList[NB_BOUBLE_BUFFER]; ewol::Keyboard* m_keyBoardwidget; public: void SetSubWidget(ewol::Widget * widget); @@ -81,6 +81,7 @@ namespace ewol { public: void KeyboardShow(ewol::keyboardMode_te mode); void KeyboardHide(void); + virtual void OnFlipFlopEvent(void); }; }; diff --git a/Sources/libewol/ewol/base/gui.cpp b/Sources/libewol/ewol/base/gui.cpp index 5d74202c..a85376ae 100644 --- a/Sources/libewol/ewol/base/gui.cpp +++ b/Sources/libewol/ewol/base/gui.cpp @@ -294,6 +294,7 @@ void EWOL_GenericDraw(bool everyTime) { nbDisplayTime++; gui_uniqueWindows->SysDraw(); + //EWOL_WARNING("DRAW..."); } ewol::widgetManager::GetDoubleBufferStopDraw(); // send Message that we just finished a display ... diff --git a/Sources/libewol/ewol/widget/PopUp.cpp b/Sources/libewol/ewol/widget/PopUp.cpp index 55d14d8f..e60d58bd 100644 --- a/Sources/libewol/ewol/widget/PopUp.cpp +++ b/Sources/libewol/ewol/widget/PopUp.cpp @@ -59,14 +59,14 @@ bool ewol::PopUp::CalculateSize(etkFloat_t availlableX, etkFloat_t availlableY) m_size.x = availlableX; m_size.y = availlableY; - if (NULL != m_subWidget) { + if (NULL != m_subWidget[m_currentCreateId]) { coord2D_ts subWidgetSize; coord2D_ts subWidgetOrigin; - subWidgetSize = m_subWidget->GetMinSize(); - if (true == m_subWidget->CanExpentX()) { + subWidgetSize = m_subWidget[m_currentCreateId]->GetMinSize(); + if (true == m_subWidget[m_currentCreateId]->CanExpentX()) { subWidgetSize.x = m_size.x; } - if (true == m_subWidget->CanExpentY()) { + if (true == m_subWidget[m_currentCreateId]->CanExpentY()) { subWidgetSize.y = m_size.y; } if (m_displayRatio>0.1 && m_displayRatio<=1) { @@ -80,8 +80,8 @@ bool ewol::PopUp::CalculateSize(etkFloat_t availlableX, etkFloat_t availlableY) subWidgetOrigin.x = (int32_t)(m_size.x - m_origin.x - subWidgetSize.x)/2 + m_origin.x; subWidgetOrigin.y = (int32_t)(m_size.y - m_origin.y - subWidgetSize.y)/2 + m_origin.y; - m_subWidget->SetOrigin(subWidgetOrigin.x, subWidgetOrigin.y); - m_subWidget->CalculateSize(subWidgetSize.x, subWidgetSize.y); + m_subWidget[m_currentCreateId]->SetOrigin(subWidgetOrigin.x, subWidgetOrigin.y); + m_subWidget[m_currentCreateId]->CalculateSize(subWidgetSize.x, subWidgetSize.y); } MarkToReedraw(); return true; @@ -95,9 +95,9 @@ bool ewol::PopUp::CalculateMinSize(void) m_userExpendY=false; m_minSize.x = 50.0; m_minSize.y = 50.0; - if (NULL != m_subWidget) { - m_subWidget->CalculateMinSize(); - coord2D_ts tmpSize = m_subWidget->GetMinSize(); + if (NULL != m_subWidget[m_currentCreateId]) { + m_subWidget[m_currentCreateId]->CalculateMinSize(); + coord2D_ts tmpSize = m_subWidget[m_currentCreateId]->GetMinSize(); m_minSize.x = tmpSize.x; m_minSize.y = tmpSize.y; } @@ -127,16 +127,16 @@ void ewol::PopUp::SubWidgetSet(ewol::Widget* newWidget) if (NULL == newWidget) { return; } - m_subWidget = newWidget; + m_subWidget[m_currentCreateId] = newWidget; newWidget->SetParrent(this); } void ewol::PopUp::SubWidgetRemove(void) { - if (NULL != m_subWidget) { - ewol::widgetManager::MarkWidgetToBeRemoved(m_subWidget); - m_subWidget = NULL; + if (NULL != m_subWidget[m_currentCreateId]) { + ewol::widgetManager::MarkWidgetToBeRemoved(m_subWidget[m_currentCreateId]); + m_subWidget[m_currentCreateId] = NULL; } } @@ -144,8 +144,8 @@ bool ewol::PopUp::OnDraw(void) { // draw upper classes ewol::Drawable::OnDraw(); - if (NULL != m_subWidget) { - m_subWidget->GenDraw(); + if (NULL != m_subWidget[m_currentDrawId]) { + m_subWidget[m_currentDrawId]->GenDraw(); } return true; } @@ -163,27 +163,27 @@ void ewol::PopUp::OnRegenerateDisplay(void) BGOObjects->SetColor(m_colorEmptyArea); BGOObjects->Rectangle(0, 0, m_size.x, m_size.y); // set the area in white ... - if (NULL != m_subWidget) { - coord2D_ts tmpSize = m_subWidget->GetSize(); - coord2D_ts tmpOrigin = m_subWidget->GetOrigin(); + if (NULL != m_subWidget[m_currentCreateId]) { + coord2D_ts tmpSize = m_subWidget[m_currentCreateId]->GetSize(); + coord2D_ts tmpOrigin = m_subWidget[m_currentCreateId]->GetOrigin(); BGOObjects->SetColor(m_colorBackGroung); BGOObjects->Rectangle(tmpOrigin.x, tmpOrigin.y, tmpSize.x, tmpSize.y); } - if (NULL != m_subWidget) { - m_subWidget->OnRegenerateDisplay(); + if (NULL != m_subWidget[m_currentCreateId]) { + m_subWidget[m_currentCreateId]->OnRegenerateDisplay(); } } bool ewol::PopUp::OnEventInput(int32_t IdInput, eventInputType_te typeEvent, etkFloat_t x, etkFloat_t y) { - if (NULL != m_subWidget) { - coord2D_ts tmpSize = m_subWidget->GetSize(); - coord2D_ts tmpOrigin = m_subWidget->GetOrigin(); + if (NULL != m_subWidget[m_currentCreateId]) { + coord2D_ts tmpSize = m_subWidget[m_currentCreateId]->GetSize(); + coord2D_ts tmpOrigin = m_subWidget[m_currentCreateId]->GetOrigin(); if( (tmpOrigin.x <= x && tmpOrigin.x + tmpSize.x >= x) && (tmpOrigin.y <= y && tmpOrigin.y + tmpSize.y >= y) ) { - return m_subWidget->GenEventInput(IdInput, typeEvent, x, y); + return m_subWidget[m_currentCreateId]->GenEventInput(IdInput, typeEvent, x, y); } else { //EWOL_INFO("Event ouside the Pop-up"); } @@ -197,3 +197,11 @@ void ewol::PopUp::SetDisplayRatio(etkFloat_t ratio) { m_displayRatio = ratio; } + + +void ewol::PopUp::OnFlipFlopEvent(void) +{ + // keep in the current element all the modification done ... + m_subWidget[m_currentCreateId] = m_subWidget[m_currentDrawId]; +} + diff --git a/Sources/libewol/ewol/widget/PopUp.h b/Sources/libewol/ewol/widget/PopUp.h index d00fac70..13d9d548 100644 --- a/Sources/libewol/ewol/widget/PopUp.h +++ b/Sources/libewol/ewol/widget/PopUp.h @@ -46,7 +46,7 @@ namespace ewol { private: color_ts m_colorBackGroung; color_ts m_colorEmptyArea; - ewol::Widget* m_subWidget; + ewol::Widget* m_subWidget[NB_BOUBLE_BUFFER]; etkFloat_t m_displayRatio; public: void SubWidgetSet(ewol::Widget* newWidget); @@ -57,6 +57,7 @@ namespace ewol { virtual void OnRegenerateDisplay(void); public: virtual bool OnEventInput(int32_t IdInput, eventInputType_te typeEvent, etkFloat_t x, etkFloat_t y); + virtual void OnFlipFlopEvent(void); }; }; diff --git a/Sources/libewol/ewol/widget/SizerHori.cpp b/Sources/libewol/ewol/widget/SizerHori.cpp index 1a728f50..fd5c2cab 100644 --- a/Sources/libewol/ewol/widget/SizerHori.cpp +++ b/Sources/libewol/ewol/widget/SizerHori.cpp @@ -51,11 +51,11 @@ bool ewol::SizerHori::CalculateSize(etkFloat_t availlableX, etkFloat_t availlabl etkFloat_t unexpendableSize=0.0; int32_t nbWidgetFixedSize=0; int32_t nbWidgetNotFixedSize=0; - for (int32_t iii=0; iiiGetMinSize(); + for (int32_t iii=0; iiiGetMinSize(); unexpendableSize += tmpSize.x; - if (false == m_subWidget[iii]->CanExpentX()) { + if (false == m_subWidget[m_currentCreateId][iii]->CanExpentX()) { nbWidgetFixedSize++; } else { nbWidgetNotFixedSize++; @@ -73,18 +73,18 @@ bool ewol::SizerHori::CalculateSize(etkFloat_t availlableX, etkFloat_t availlabl coord2D_ts tmpOrigin; tmpOrigin.x = 0; tmpOrigin.y = 0; - for (int32_t iii=0; iiiGetMinSize(); + for (int32_t iii=0; iiiGetMinSize(); // Set the origin : //EWOL_DEBUG("Set ORIGIN : " << tmpOrigin.x << "," << tmpOrigin.y << ")"); - m_subWidget[iii]->SetOrigin(tmpOrigin.x, tmpOrigin.y); + m_subWidget[m_currentCreateId][iii]->SetOrigin(tmpOrigin.x, tmpOrigin.y); // Now Update his Size his size in X and the curent sizer size in Y: - if (true == m_subWidget[iii]->CanExpentX()) { - m_subWidget[iii]->CalculateSize(tmpSize.x+sizeToAddAtEveryOne, m_size.y); + if (true == m_subWidget[m_currentCreateId][iii]->CanExpentX()) { + m_subWidget[m_currentCreateId][iii]->CalculateSize(tmpSize.x+sizeToAddAtEveryOne, m_size.y); tmpOrigin.x += tmpSize.x+sizeToAddAtEveryOne; } else { - m_subWidget[iii]->CalculateSize(tmpSize.x, m_size.y); + m_subWidget[m_currentCreateId][iii]->CalculateSize(tmpSize.x, m_size.y); tmpOrigin.x += tmpSize.x; } } @@ -101,16 +101,16 @@ bool ewol::SizerHori::CalculateMinSize(void) m_userExpendY=false; m_minSize.x = 0.0; m_minSize.y = 0.0; - for (int32_t iii=0; iiiCalculateMinSize(); - if (true == m_subWidget[iii]->CanExpentX()) { + for (int32_t iii=0; iiiCalculateMinSize(); + if (true == m_subWidget[m_currentCreateId][iii]->CanExpentX()) { m_userExpendX = true; } - if (true == m_subWidget[iii]->CanExpentY()) { + if (true == m_subWidget[m_currentCreateId][iii]->CanExpentY()) { m_userExpendY = true; } - coord2D_ts tmpSize = m_subWidget[iii]->GetMinSize(); + coord2D_ts tmpSize = m_subWidget[m_currentCreateId][iii]->GetMinSize(); m_minSize.x += tmpSize.x; if (tmpSize.y>m_minSize.y) { m_minSize.y = tmpSize.y; @@ -158,17 +158,17 @@ void ewol::SizerHori::LockExpendContamination(bool lockExpend) m_lockExpendContamination = lockExpend; } -//etk::VectorType m_SubWidget; +//etk::VectorType m_subWidget[m_currentCreateId]; void ewol::SizerHori::SubWidgetRemoveAll(void) { - for (int32_t iii=0; iiiSetParrent(this); } @@ -187,13 +187,13 @@ void ewol::SizerHori::SubWidgetRemove(ewol::Widget* newWidget) if (NULL == newWidget) { return; } - for (int32_t iii=0; iiiGenDraw(); + for (int32_t iii=0; iiiGenDraw(); } } return true; @@ -227,9 +227,9 @@ bool ewol::SizerHori::OnDraw(void) void ewol::SizerHori::OnRegenerateDisplay(void) { - for (int32_t iii=0; iiiOnRegenerateDisplay(); + for (int32_t iii=0; iiiOnRegenerateDisplay(); } } } @@ -237,14 +237,14 @@ void ewol::SizerHori::OnRegenerateDisplay(void) bool ewol::SizerHori::OnEventInput(int32_t IdInput, eventInputType_te typeEvent, etkFloat_t x, etkFloat_t y) { - for (int32_t iii=0; iiiGetSize(); - coord2D_ts tmpOrigin = m_subWidget[iii]->GetOrigin(); + for (int32_t iii=0; iiiGetSize(); + coord2D_ts tmpOrigin = m_subWidget[m_currentCreateId][iii]->GetOrigin(); if( (tmpOrigin.x <= x && tmpOrigin.x + tmpSize.x >= x) && (tmpOrigin.y <= y && tmpOrigin.y + tmpSize.y >= y) ) { - return m_subWidget[iii]->GenEventInput(IdInput, typeEvent, x, y); + return m_subWidget[m_currentCreateId][iii]->GenEventInput(IdInput, typeEvent, x, y); } } } @@ -252,3 +252,10 @@ bool ewol::SizerHori::OnEventInput(int32_t IdInput, eventInputType_te typeEvent, } +void ewol::SizerHori::OnFlipFlopEvent(void) +{ + // keep in the current element all the modification done ... + m_subWidget[m_currentCreateId] = m_subWidget[m_currentDrawId]; +} + + diff --git a/Sources/libewol/ewol/widget/SizerHori.h b/Sources/libewol/ewol/widget/SizerHori.h index b50b1e89..60826687 100644 --- a/Sources/libewol/ewol/widget/SizerHori.h +++ b/Sources/libewol/ewol/widget/SizerHori.h @@ -46,7 +46,7 @@ namespace ewol { void LockExpendContamination(bool lockExpend=false); private: bool m_lockExpendContamination; - etk::VectorType m_subWidget; + etk::VectorType m_subWidget[NB_BOUBLE_BUFFER]; public: virtual void SubWidgetRemoveAll(void); virtual void SubWidgetAdd(ewol::Widget* newWidget); @@ -57,6 +57,7 @@ namespace ewol { public: virtual void OnRegenerateDisplay(void); virtual bool OnEventInput(int32_t IdInput, eventInputType_te typeEvent, etkFloat_t x, etkFloat_t y); + virtual void OnFlipFlopEvent(void); }; }; diff --git a/Sources/libewol/ewol/widget/SizerVert.cpp b/Sources/libewol/ewol/widget/SizerVert.cpp index 1e8ca211..7b69d4dc 100644 --- a/Sources/libewol/ewol/widget/SizerVert.cpp +++ b/Sources/libewol/ewol/widget/SizerVert.cpp @@ -52,11 +52,11 @@ bool ewol::SizerVert::CalculateSize(etkFloat_t availlableX, etkFloat_t availlabl etkFloat_t unexpendableSize=0.0; int32_t nbWidgetFixedSize=0; int32_t nbWidgetNotFixedSize=0; - for (int32_t iii=0; iiiGetMinSize(); + for (int32_t iii=0; iiiGetMinSize(); unexpendableSize += tmpSize.y; - if (false == m_subWidget[iii]->CanExpentY()) { + if (false == m_subWidget[m_currentCreateId][iii]->CanExpentY()) { nbWidgetFixedSize++; } else { nbWidgetNotFixedSize++; @@ -75,18 +75,18 @@ bool ewol::SizerVert::CalculateSize(etkFloat_t availlableX, etkFloat_t availlabl coord2D_ts tmpOrigin; tmpOrigin.x = 0; tmpOrigin.y = 0; - for (int32_t iii=0; iiiGetMinSize(); + for (int32_t iii=0; iiiGetMinSize(); // Set the origin : //EWOL_DEBUG("Set ORIGIN : " << tmpOrigin.x << "," << tmpOrigin.y << ")"); - m_subWidget[iii]->SetOrigin(tmpOrigin.x, tmpOrigin.y); + m_subWidget[m_currentCreateId][iii]->SetOrigin(tmpOrigin.x, tmpOrigin.y); // Now Update his Size his size in X and the curent sizer size in Y: - if (true == m_subWidget[iii]->CanExpentY()) { - m_subWidget[iii]->CalculateSize(m_size.x, tmpSize.y+sizeToAddAtEveryOne); + if (true == m_subWidget[m_currentCreateId][iii]->CanExpentY()) { + m_subWidget[m_currentCreateId][iii]->CalculateSize(m_size.x, tmpSize.y+sizeToAddAtEveryOne); tmpOrigin.y += tmpSize.y+sizeToAddAtEveryOne; } else { - m_subWidget[iii]->CalculateSize(m_size.x, tmpSize.y); + m_subWidget[m_currentCreateId][iii]->CalculateSize(m_size.x, tmpSize.y); tmpOrigin.y += tmpSize.y; } } @@ -103,16 +103,16 @@ bool ewol::SizerVert::CalculateMinSize(void) m_userExpendY=false; m_minSize.x = 0.0; m_minSize.y = 0.0; - for (int32_t iii=0; iiiCalculateMinSize(); - if (true == m_subWidget[iii]->CanExpentX()) { + for (int32_t iii=0; iiiCalculateMinSize(); + if (true == m_subWidget[m_currentCreateId][iii]->CanExpentX()) { m_userExpendX = true; } - if (true == m_subWidget[iii]->CanExpentY()) { + if (true == m_subWidget[m_currentCreateId][iii]->CanExpentY()) { m_userExpendY = true; } - coord2D_ts tmpSize = m_subWidget[iii]->GetMinSize(); + coord2D_ts tmpSize = m_subWidget[m_currentCreateId][iii]->GetMinSize(); //EWOL_DEBUG(" Get minSize[" << iii << "] ("<< tmpSize.x << "," << tmpSize.y << ")"); m_minSize.y += tmpSize.y; if (tmpSize.x>m_minSize.x) { @@ -165,11 +165,11 @@ void ewol::SizerVert::LockExpendContamination(bool lockExpend) void ewol::SizerVert::SubWidgetRemoveAll(void) { - for (int32_t iii=0; iiiSetParrent(this); } @@ -188,11 +188,11 @@ void ewol::SizerVert::SubWidgetRemove(ewol::Widget* newWidget) if (NULL == newWidget) { return; } - for (int32_t iii=0; iiiGenDraw(); + for (int32_t iii=0; iiiGenDraw(); } } return true; @@ -227,9 +227,9 @@ bool ewol::SizerVert::OnDraw(void) void ewol::SizerVert::OnRegenerateDisplay(void) { - for (int32_t iii=0; iiiOnRegenerateDisplay(); + for (int32_t iii=0; iiiOnRegenerateDisplay(); } } } @@ -237,17 +237,23 @@ void ewol::SizerVert::OnRegenerateDisplay(void) bool ewol::SizerVert::OnEventInput(int32_t IdInput, eventInputType_te typeEvent, etkFloat_t x, etkFloat_t y) { - for (int32_t iii=0; iiiGetSize(); - coord2D_ts tmpOrigin = m_subWidget[iii]->GetOrigin(); + for (int32_t iii=0; iiiGetSize(); + coord2D_ts tmpOrigin = m_subWidget[m_currentCreateId][iii]->GetOrigin(); if( (tmpOrigin.x <= x && tmpOrigin.x + tmpSize.x >= x) && (tmpOrigin.y <= y && tmpOrigin.y + tmpSize.y >= y) ) { - return m_subWidget[iii]->GenEventInput(IdInput, typeEvent, x, y); + return m_subWidget[m_currentCreateId][iii]->GenEventInput(IdInput, typeEvent, x, y); } } } return true; } +void ewol::SizerVert::OnFlipFlopEvent(void) +{ + // keep in the current element all the modification done ... + m_subWidget[m_currentCreateId] = m_subWidget[m_currentDrawId]; +} + diff --git a/Sources/libewol/ewol/widget/SizerVert.h b/Sources/libewol/ewol/widget/SizerVert.h index e631816e..9a5dbc83 100644 --- a/Sources/libewol/ewol/widget/SizerVert.h +++ b/Sources/libewol/ewol/widget/SizerVert.h @@ -46,7 +46,7 @@ namespace ewol { void LockExpendContamination(bool lockExpend=false); private: bool m_lockExpendContamination; - etk::VectorType m_subWidget; + etk::VectorType m_subWidget[NB_BOUBLE_BUFFER]; public: virtual void SubWidgetRemoveAll(void); virtual void SubWidgetAdd(ewol::Widget* newWidget); @@ -58,6 +58,7 @@ namespace ewol { virtual void OnRegenerateDisplay(void); public: virtual bool OnEventInput(int32_t IdInput, eventInputType_te typeEvent, etkFloat_t x, etkFloat_t y); + virtual void OnFlipFlopEvent(void); }; }; diff --git a/Sources/libewol/ewol/widgetMeta/FileChooser.cpp b/Sources/libewol/ewol/widgetMeta/FileChooser.cpp index ed3a9bb1..13b5ebe5 100644 --- a/Sources/libewol/ewol/widgetMeta/FileChooser.cpp +++ b/Sources/libewol/ewol/widgetMeta/FileChooser.cpp @@ -118,10 +118,10 @@ class FileChooserFolderList : public ewol::List virtual color_ts GetBasicBG(void) { color_ts bg; - bg.red = 1.0; + bg.red = 0.0; bg.green = 0.0; bg.blue = 0.0; - bg.alpha = 1.0; + bg.alpha = 0.2; return bg; } @@ -217,10 +217,10 @@ class FileChooserFileList : public ewol::List }; virtual color_ts GetBasicBG(void) { color_ts bg; - bg.red = 1.0; + bg.red = 0.0; bg.green = 0.0; bg.blue = 0.0; - bg.alpha = 1.0; + bg.alpha = 0.2; return bg; } void AddElement(etk::UString element)