[DEV] try to find a display error due to a minimal size who is wrong

This commit is contained in:
Edouard DUPIN 2013-05-16 21:58:02 +02:00
parent a8dae7592c
commit 810abe02bc
10 changed files with 33 additions and 13 deletions

2
external/etk vendored

@ -1 +1 @@
Subproject commit 5f8b094486e0812fef4c59d3d226ae32ba275c71
Subproject commit b75f2ea69853af387d92374a0cd56fedf766ddbf

View File

@ -135,6 +135,11 @@ void widget::Button::CalculateSize(const vec2& _availlable)
// set minimal size
m_size = m_minSize;
if (m_origin.x()<0) {
EWOL_ERROR("[" << GetId() << "] position error ori=" << m_origin << " size=" << m_size);
etk::DisplayBacktrace();
}
vec2 minimumSizeBase(0,0);
vec2 minimumSizeToggle(0,0);
// Checking the expand properties :

View File

@ -195,7 +195,6 @@ void widget::ContainerN::SystemDraw(const ewol::DrawProperty& _displayProp)
void widget::ContainerN::CalculateSize(const vec2& _availlable)
{
EWOL_DEBUG("Update Size ???");
m_size = _availlable;
for (int32_t iii=0; iii<m_subWidget.Size(); iii++) {
if (NULL != m_subWidget[iii]) {

View File

@ -76,7 +76,7 @@ void widget::Label::OnRegenerateDisplay(void)
vec2 tmpMax = m_userMaxSize.GetPixel();
// to know the size of one Line :
vec3 minSize = m_text.CalculateSize('A');
vec3 minSize = m_text.CalculateSize(etk::UniChar('A'));
if (tmpMax.x() <= 999999) {
m_text.SetTextAlignement(0, tmpMax.x()-2*paddingSize, ewol::Text::alignLeft);
}

View File

@ -161,7 +161,7 @@ void widget::List::OnRegenerateDisplay(void)
ewol::Text * tmpText = new ewol::Text();
if (NULL != tmpText) {
// get font size :
int32_t tmpFontHeight = tmpText->CalculateSize('A').y();
int32_t tmpFontHeight = tmpText->CalculateSize(etk::UniChar('A')).y();
displayPositionY-=(tmpFontHeight+m_paddingSizeY);
BGOObjects->SetColor(bg);

View File

@ -31,28 +31,38 @@ widget::PopUp::~PopUp(void)
}
void widget::PopUp::CalculateSize(const vec2& availlable)
void widget::PopUp::CalculateSize(const vec2& _availlable)
{
m_size = availlable;
ewol::Widget::CalculateSize(_availlable);
EWOL_DEBUG(" _availlable : " << _availlable);
m_size = _availlable;
if (NULL != m_subWidget) {
vec2 subElementSize = m_minSize;
EWOL_DEBUG(" subElementSize : " << subElementSize);
vec2 subElementOrigin = m_origin + (m_size-m_minSize)/2.0f;
EWOL_DEBUG(" subElementOrigin : " << subElementOrigin);
vec2 subWidgetSize = m_subWidget->GetCalculateMinSize();
EWOL_DEBUG(" subWidgetSize : " << subWidgetSize);
if (true == m_subWidget->CanExpand().x()) {
subWidgetSize.setX(m_minSize.x());
}
if (true == m_subWidget->CanExpand().y()) {
subWidgetSize.setY(m_minSize.y());
}
EWOL_DEBUG(" subWidgetSize : " << subWidgetSize);
// limit the size of the element :
subWidgetSize.setMin(m_minSize);
EWOL_DEBUG(" subWidgetSize : " << subWidgetSize);
// posiition at a int32_t pos :
subWidgetSize = vec2ClipInt32(subWidgetSize);
EWOL_DEBUG(" subWidgetSize : " << subWidgetSize);
// set config to the Sub-widget
vec2 subWidgetOrigin = m_origin + (m_size-subWidgetSize)/2.0f;
EWOL_DEBUG(" subWidgetOrigin : " << subWidgetOrigin);
subWidgetOrigin = vec2ClipInt32(subWidgetOrigin);
EWOL_DEBUG(" subWidgetOrigin : " << subWidgetOrigin);
m_subWidget->SetOrigin(subWidgetOrigin);
m_subWidget->CalculateSize(subWidgetSize);

View File

@ -30,9 +30,9 @@ namespace widget {
protected: // Derived function
virtual void OnDraw(void);
public: // Derived function
virtual void SystemDraw(const ewol::DrawProperty& displayProp);
virtual void SystemDraw(const ewol::DrawProperty& _displayProp);
virtual void OnRegenerateDisplay(void);
virtual void CalculateSize(const vec2& availlable);
virtual void CalculateSize(const vec2& _availlable);
//virtual void CalculateMinMaxSize(void);
virtual const char * const GetObjectType(void) { return "ewol::PopUp"; };
virtual ewol::Widget* GetWidgetAtPos(const vec2& pos);

View File

@ -66,7 +66,7 @@ void widget::Sizer::CalculateSize(const vec2& _availlable)
{
ewol::Widget::CalculateSize(_availlable);
vec2 tmpBorderSize = m_borderSize.GetPixel();
//EWOL_DEBUG("[" << GetId() << "] Update Size : " << availlable << " nbElement : " << m_subWidget.Size());
EWOL_DEBUG("[" << GetId() << "] Update Size : " << _availlable << " nbElement : " << m_subWidget.Size() << " borderSize=" << tmpBorderSize << " from border=" << m_borderSize);
m_size -= tmpBorderSize*2;
// calculate unExpandable Size :
float unexpandableSize=0.0;
@ -110,7 +110,7 @@ void widget::Sizer::CalculateSize(const vec2& _availlable)
if (NULL != m_subWidget[iii]) {
vec2 tmpSize = m_subWidget[iii]->GetCalculateMinSize();
// Set the origin :
//EWOL_DEBUG("[" << GetId() << "] Set ORIGIN : " << tmpOrigin);
EWOL_DEBUG("[" << GetId() << "] Set iii=" << iii << " ORIGIN : " << tmpOrigin << " & offset=" << m_offset);
m_subWidget[iii]->SetOrigin(vec2ClipInt32(tmpOrigin+m_offset));
// Now Update his Size his size in X and the curent sizer size in Y:
if (m_mode==widget::Sizer::modeVert) {

View File

@ -393,6 +393,12 @@ float ewol::Widget::GetZoom(void)
void ewol::Widget::SetOrigin(const vec2& _pos)
{
#if DEBUG_LEVEL > 2
if( m_origin.x() < -5000
|| m_origin.y() < -5000) {
EWOL_WARNING("[" << GetId() << "] Set origin < 5000 : " << m_origin);
}
#endif
m_origin = _pos;
}

View File

@ -50,10 +50,10 @@ ewol::Windows::~Windows(void)
}
void ewol::Windows::CalculateSize(const vec2& availlable)
void ewol::Windows::CalculateSize(const vec2& _availlable)
{
//EWOL_DEBUG("calculateSize on : " << m_currentCreateId);
m_size = availlable;
EWOL_DEBUG(" _availlable : " << _availlable);
m_size = _availlable;
if (NULL != m_subWidget) {
m_subWidget->CalculateMinMaxSize();
// TODO : Check if min Size is possible ...