[DEV] update all the element at the new etk vectir nomage (like bullet)
This commit is contained in:
parent
bb3307f736
commit
73a42f4e17
2
external/agg
vendored
2
external/agg
vendored
@ -1 +1 @@
|
||||
Subproject commit 404b68ec9fcd970c3daf5aa6a43331bd852551df
|
||||
Subproject commit 0f43afbed24ac157fc0572061518fc76f42fbce5
|
2
external/etk
vendored
2
external/etk
vendored
@ -1 +1 @@
|
||||
Subproject commit d7d32588c2a77c994f17bd54300ee86f6266b68d
|
||||
Subproject commit 0c035b17f9ee126896a5c62af65d0b77419b3016
|
@ -395,26 +395,26 @@ void ewol::Drawing::SetClippingWidth(vec3 pos, vec3 width)
|
||||
void ewol::Drawing::SetClipping(vec3 pos, vec3 posEnd)
|
||||
{
|
||||
// note the internal system all time request to have a bounding all time in the same order
|
||||
if (pos.x <= posEnd.x) {
|
||||
m_clippingPosStart.x = pos.x;
|
||||
m_clippingPosStop.x = posEnd.x;
|
||||
if (pos.x() <= posEnd.x()) {
|
||||
m_clippingPosStart.setX(pos.x());
|
||||
m_clippingPosStop.setX(posEnd.x());
|
||||
} else {
|
||||
m_clippingPosStart.x = posEnd.x;
|
||||
m_clippingPosStop.x = pos.x;
|
||||
m_clippingPosStart.setX(posEnd.x());
|
||||
m_clippingPosStop.setX(pos.x());
|
||||
}
|
||||
if (pos.y <= posEnd.y) {
|
||||
m_clippingPosStart.y = pos.y;
|
||||
m_clippingPosStop.y = posEnd.y;
|
||||
if (pos.y() <= posEnd.y()) {
|
||||
m_clippingPosStart.setY(pos.y());
|
||||
m_clippingPosStop.setY(posEnd.y());
|
||||
} else {
|
||||
m_clippingPosStart.y = posEnd.y;
|
||||
m_clippingPosStop.y = pos.y;
|
||||
m_clippingPosStart.setY(posEnd.y());
|
||||
m_clippingPosStop.setY(pos.y());
|
||||
}
|
||||
if (pos.z <= posEnd.z) {
|
||||
m_clippingPosStart.z = pos.z;
|
||||
m_clippingPosStop.z = posEnd.z;
|
||||
if (pos.z() <= posEnd.z()) {
|
||||
m_clippingPosStart.setZ(pos.z());
|
||||
m_clippingPosStop.setZ(posEnd.z());
|
||||
} else {
|
||||
m_clippingPosStart.z = posEnd.z;
|
||||
m_clippingPosStop.z = pos.z;
|
||||
m_clippingPosStart.setZ(posEnd.z());
|
||||
m_clippingPosStop.setZ(pos.z());
|
||||
}
|
||||
m_clippingEnable = true;
|
||||
}
|
||||
@ -447,16 +447,16 @@ void ewol::Drawing::LineTo(vec3 dest)
|
||||
{
|
||||
ResetCount();
|
||||
InternalSetColor(m_color);
|
||||
if (m_position.x == dest.x && m_position.y == dest.y) {
|
||||
if (m_position.x() == dest.x() && m_position.y() == dest.y()) {
|
||||
EWOL_WARNING("Try to draw an line width 0");
|
||||
return;
|
||||
}
|
||||
//teta = tan-1(oposer/adjacent)
|
||||
float teta = 0;
|
||||
if (m_position.x <= dest.x) {
|
||||
teta = atan((dest.y-m_position.y)/(dest.x-m_position.x));
|
||||
if (m_position.x() <= dest.x()) {
|
||||
teta = atan((dest.y()-m_position.y())/(dest.x()-m_position.x()));
|
||||
} else {
|
||||
teta = M_PI + atan((dest.y-m_position.y)/(dest.x-m_position.x));
|
||||
teta = M_PI + atan((dest.y()-m_position.y())/(dest.x()-m_position.x()));
|
||||
}
|
||||
if (teta < 0) {
|
||||
teta += 2*M_PI;
|
||||
@ -467,13 +467,13 @@ void ewol::Drawing::LineTo(vec3 dest)
|
||||
float offsety = sin(teta-M_PI/2) * (m_thickness/2);
|
||||
float offsetx = cos(teta-M_PI/2) * (m_thickness/2);
|
||||
|
||||
SetPoint(vec3(m_position.x - offsetx, m_position.y - offsety, (float)0.0) );
|
||||
SetPoint(vec3(m_position.x + offsetx, m_position.y + offsety, (float)0.0) );
|
||||
SetPoint(vec3(dest.x + offsetx, dest.y + offsety, (float)0.0) );
|
||||
SetPoint(vec3(m_position.x() - offsetx, m_position.y() - offsety, (float)0.0) );
|
||||
SetPoint(vec3(m_position.x() + offsetx, m_position.y() + offsety, (float)0.0) );
|
||||
SetPoint(vec3(dest.x() + offsetx, dest.y() + offsety, (float)0.0) );
|
||||
|
||||
SetPoint(vec3(dest.x + offsetx, dest.y + offsety, (float)0.0) );
|
||||
SetPoint(vec3(dest.x - offsetx, dest.y - offsety, (float)0.0) );
|
||||
SetPoint(vec3(m_position.x - offsetx, m_position.y - offsety, (float)0.0) );
|
||||
SetPoint(vec3(dest.x() + offsetx, dest.y() + offsety, (float)0.0) );
|
||||
SetPoint(vec3(dest.x() - offsetx, dest.y() - offsety, (float)0.0) );
|
||||
SetPoint(vec3(m_position.x() - offsetx, m_position.y() - offsety, (float)0.0) );
|
||||
// update the system position :
|
||||
m_position = dest;
|
||||
}
|
||||
@ -495,35 +495,35 @@ void ewol::Drawing::Rectangle(vec3 dest)
|
||||
* | |
|
||||
* yD *------*
|
||||
*/
|
||||
float dxA = m_position.x;
|
||||
float dxB = dest.x;
|
||||
float dyC = m_position.y;
|
||||
float dyD = dest.y;
|
||||
float dxA = m_position.x();
|
||||
float dxB = dest.x();
|
||||
float dyC = m_position.y();
|
||||
float dyD = dest.y();
|
||||
if (true == m_clippingEnable) {
|
||||
if (dxA < m_clippingPosStart.x) {
|
||||
dxA = m_clippingPosStart.x;
|
||||
if (dxA < m_clippingPosStart.x()) {
|
||||
dxA = m_clippingPosStart.x();
|
||||
}
|
||||
if (dxB > m_clippingPosStop.x) {
|
||||
dxB = m_clippingPosStop.x;
|
||||
if (dxB > m_clippingPosStop.x()) {
|
||||
dxB = m_clippingPosStop.x();
|
||||
}
|
||||
if (dyC < m_clippingPosStart.y) {
|
||||
dyC = m_clippingPosStart.y;
|
||||
if (dyC < m_clippingPosStart.y()) {
|
||||
dyC = m_clippingPosStart.y();
|
||||
}
|
||||
if (dyD > m_clippingPosStop.y) {
|
||||
dyD = m_clippingPosStop.y;
|
||||
if (dyD > m_clippingPosStop.y()) {
|
||||
dyD = m_clippingPosStop.y();
|
||||
}
|
||||
}
|
||||
if( dyC >= dyD
|
||||
|| dxA >= dxB) {
|
||||
return;
|
||||
}
|
||||
SetPoint(vec3(dxA, dyD, (float)0.0) );
|
||||
SetPoint(vec3(dxA, dyC, (float)0.0) );
|
||||
SetPoint(vec3(dxB, dyC, (float)0.0) );
|
||||
SetPoint(vec3(dxA, dyD, 0) );
|
||||
SetPoint(vec3(dxA, dyC, 0) );
|
||||
SetPoint(vec3(dxB, dyC, 0) );
|
||||
|
||||
SetPoint(vec3(dxB, dyC, (float)0.0) );
|
||||
SetPoint(vec3(dxB, dyD, (float)0.0) );
|
||||
SetPoint(vec3(dxA, dyD, (float)0.0) );
|
||||
SetPoint(vec3(dxB, dyC, 0) );
|
||||
SetPoint(vec3(dxB, dyD, 0) );
|
||||
SetPoint(vec3(dxA, dyD, 0) );
|
||||
}
|
||||
|
||||
|
||||
@ -560,19 +560,25 @@ void ewol::Drawing::Circle(float radius, float angleStart, float angleStop)
|
||||
if (m_colorBg.a!=0) {
|
||||
InternalSetColor(m_colorBg);
|
||||
for (int32_t iii=0; iii<nbOcurence; iii++) {
|
||||
SetPoint(vec3(m_position.x, m_position.y) );
|
||||
SetPoint(vec3(m_position.x(),
|
||||
m_position.y(),
|
||||
0) );
|
||||
|
||||
float angleOne = angleStart + (angleStop* iii / nbOcurence) ;
|
||||
float offsety = sin(angleOne) * radius;
|
||||
float offsetx = cos(angleOne) * radius;
|
||||
|
||||
SetPoint(vec3(m_position.x + offsetx, m_position.y + offsety) );
|
||||
SetPoint(vec3(m_position.x() + offsetx,
|
||||
m_position.y() + offsety,
|
||||
0) );
|
||||
|
||||
float angleTwo = angleStart + (angleStop* (iii+1) / nbOcurence) ;
|
||||
offsety = sin(angleTwo) * radius;
|
||||
offsetx = cos(angleTwo) * radius;
|
||||
|
||||
SetPoint(vec3(m_position.x + offsetx, m_position.y + offsety) );
|
||||
SetPoint(vec3(m_position.x() + offsetx,
|
||||
m_position.y() + offsety,
|
||||
0) );
|
||||
}
|
||||
}
|
||||
|
||||
@ -596,13 +602,13 @@ void ewol::Drawing::Circle(float radius, float angleStart, float angleStop)
|
||||
float offsetInt2y = sin(angleTwo) * (radius-m_thickness/2);
|
||||
float offsetInt2x = cos(angleTwo) * (radius-m_thickness/2);
|
||||
|
||||
SetPoint(vec3(m_position.x + offsetIntx, m_position.y + offsetInty));
|
||||
SetPoint(vec3(m_position.x + offsetExtx, m_position.y + offsetExty));
|
||||
SetPoint(vec3(m_position.x + offsetExt2x, m_position.y + offsetExt2y));
|
||||
SetPoint(vec3(m_position.x() + offsetIntx, m_position.y() + offsetInty, 0));
|
||||
SetPoint(vec3(m_position.x() + offsetExtx, m_position.y() + offsetExty, 0));
|
||||
SetPoint(vec3(m_position.x() + offsetExt2x, m_position.y() + offsetExt2y, 0));
|
||||
|
||||
SetPoint(vec3(m_position.x + offsetExt2x, m_position.y + offsetExt2y));
|
||||
SetPoint(vec3(m_position.x + offsetInt2x, m_position.y + offsetInt2y));
|
||||
SetPoint(vec3(m_position.x + offsetIntx, m_position.y + offsetInty));
|
||||
SetPoint(vec3(m_position.x() + offsetExt2x, m_position.y() + offsetExt2y, 0));
|
||||
SetPoint(vec3(m_position.x() + offsetInt2x, m_position.y() + offsetInt2y, 0));
|
||||
SetPoint(vec3(m_position.x() + offsetIntx, m_position.y() + offsetInty, 0));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -140,26 +140,26 @@ void ewol::Image::SetClippingWidth(vec3 pos, vec3 width)
|
||||
void ewol::Image::SetClipping(vec3 pos, vec3 posEnd)
|
||||
{
|
||||
// note the internal system all time request to have a bounding all time in the same order
|
||||
if (pos.x <= posEnd.x) {
|
||||
m_clippingPosStart.x = pos.x;
|
||||
m_clippingPosStop.x = posEnd.x;
|
||||
if (pos.x() <= posEnd.x()) {
|
||||
m_clippingPosStart.setX(pos.x());
|
||||
m_clippingPosStop.setX(posEnd.x());
|
||||
} else {
|
||||
m_clippingPosStart.x = posEnd.x;
|
||||
m_clippingPosStop.x = pos.x;
|
||||
m_clippingPosStart.setX(posEnd.x());
|
||||
m_clippingPosStop.setX(pos.x());
|
||||
}
|
||||
if (pos.y <= posEnd.y) {
|
||||
m_clippingPosStart.y = pos.y;
|
||||
m_clippingPosStop.y = posEnd.y;
|
||||
if (pos.y() <= posEnd.y()) {
|
||||
m_clippingPosStart.setY(pos.y());
|
||||
m_clippingPosStop.setY(posEnd.y());
|
||||
} else {
|
||||
m_clippingPosStart.y = posEnd.y;
|
||||
m_clippingPosStop.y = pos.y;
|
||||
m_clippingPosStart.setY(posEnd.y());
|
||||
m_clippingPosStop.setY(pos.y());
|
||||
}
|
||||
if (pos.z <= posEnd.z) {
|
||||
m_clippingPosStart.z = pos.z;
|
||||
m_clippingPosStop.z = posEnd.z;
|
||||
if (pos.z() <= posEnd.z()) {
|
||||
m_clippingPosStart.setZ(pos.z());
|
||||
m_clippingPosStop.setZ(posEnd.z());
|
||||
} else {
|
||||
m_clippingPosStart.z = posEnd.z;
|
||||
m_clippingPosStop.z = pos.z;
|
||||
m_clippingPosStart.setZ(posEnd.z());
|
||||
m_clippingPosStop.setZ(pos.z());
|
||||
}
|
||||
m_clippingEnable = true;
|
||||
}
|
||||
@ -175,41 +175,36 @@ void ewol::Image::SetAngle(vec3 axes, float angle)
|
||||
{
|
||||
m_axes = axes;
|
||||
m_angle = angle;
|
||||
if( m_axes.x == 0
|
||||
&& m_axes.y == 0
|
||||
&& m_axes.z == 0) {
|
||||
if( m_axes.x() == 0
|
||||
&& m_axes.y() == 0
|
||||
&& m_axes.z() == 0) {
|
||||
m_angle = 0;
|
||||
}
|
||||
}
|
||||
|
||||
void ewol::Image::Print(ivec2 size)
|
||||
{
|
||||
vec3 point;
|
||||
vec2 tex;
|
||||
point.z = 0;
|
||||
vec3 point(0,0,0);
|
||||
vec2 tex(0,1);
|
||||
|
||||
tex.x = 0;
|
||||
tex.y = 1;
|
||||
point.x = m_position.x;
|
||||
point.y = m_position.y;
|
||||
point.setX(m_position.x());
|
||||
point.setY(m_position.y());
|
||||
m_coord.PushBack(point);
|
||||
m_coordTex.PushBack(tex);
|
||||
m_coordColor.PushBack(m_color);
|
||||
|
||||
|
||||
tex.x = 1;
|
||||
tex.y = 1;
|
||||
point.x = m_position.x + size.x;
|
||||
point.y = m_position.y;
|
||||
tex.setValue(1,1);
|
||||
point.setX(m_position.x() + size.x());
|
||||
point.setY(m_position.y());
|
||||
m_coord.PushBack(point);
|
||||
m_coordTex.PushBack(tex);
|
||||
m_coordColor.PushBack(m_color);
|
||||
|
||||
|
||||
tex.x = 1;
|
||||
tex.y = 0;
|
||||
point.x = m_position.x + size.x;
|
||||
point.y = m_position.y + size.y;
|
||||
tex.setValue(1,0);
|
||||
point.setX(m_position.x() + size.x());
|
||||
point.setY(m_position.y() + size.y());
|
||||
m_coord.PushBack(point);
|
||||
m_coordTex.PushBack(tex);
|
||||
m_coordColor.PushBack(m_color);
|
||||
@ -218,18 +213,16 @@ void ewol::Image::Print(ivec2 size)
|
||||
m_coordTex.PushBack(tex);
|
||||
m_coordColor.PushBack(m_color);
|
||||
|
||||
tex.x = 0;
|
||||
tex.y = 0;
|
||||
point.x = m_position.x;
|
||||
point.y = m_position.y + size.y;
|
||||
tex.setValue(0,0);
|
||||
point.setX(m_position.x());
|
||||
point.setY(m_position.y() + size.y());
|
||||
m_coord.PushBack(point);
|
||||
m_coordTex.PushBack(tex);
|
||||
m_coordColor.PushBack(m_color);
|
||||
|
||||
tex.x = 0;
|
||||
tex.y = 1;
|
||||
point.x = m_position.x;
|
||||
point.y = m_position.y;
|
||||
tex.setValue(0,1);
|
||||
point.setX(m_position.x());
|
||||
point.setY(m_position.y());
|
||||
m_coord.PushBack(point);
|
||||
m_coordTex.PushBack(tex);
|
||||
m_coordColor.PushBack(m_color);
|
||||
|
@ -130,10 +130,10 @@ void ewol::Shaper::Draw(void)
|
||||
// position :
|
||||
m_GLprogram->SendAttribute(m_GLPosition, 2/*x,y*/, m_coord);
|
||||
// all entry parameters :
|
||||
m_GLprogram->Uniform2fv(m_GLPropertySize, 1, &m_propertySize.x);
|
||||
m_GLprogram->Uniform2fv(m_GLPropertyOrigin, 1, &m_propertyOrigin.x);
|
||||
m_GLprogram->Uniform2fv(m_GLPropertyInsidePos, 1, &m_propertyInsidePosition.x);
|
||||
m_GLprogram->Uniform2fv(m_GLPropertyInsideSize, 1, &m_propertyInsideSize.x);
|
||||
m_GLprogram->Uniform2fv(m_GLPropertySize, 1, &m_propertySize.m_floats[0]);
|
||||
m_GLprogram->Uniform2fv(m_GLPropertyOrigin, 1, &m_propertyOrigin.m_floats[0]);
|
||||
m_GLprogram->Uniform2fv(m_GLPropertyInsidePos, 1, &m_propertyInsidePosition.m_floats[0]);
|
||||
m_GLprogram->Uniform2fv(m_GLPropertyInsideSize, 1, &m_propertyInsideSize.m_floats[0]);
|
||||
m_GLprogram->Uniform1i(m_GLStateOld, m_stateOld);
|
||||
m_GLprogram->Uniform1i(m_GLStateNew, m_stateNew);
|
||||
m_GLprogram->Uniform1f(m_GLStateTransition, m_stateTransition);
|
||||
@ -205,19 +205,19 @@ bool ewol::Shaper::PeriodicCall(int64_t localTime)
|
||||
void ewol::Shaper::UpdateVectex(void)
|
||||
{
|
||||
// set coord ==> must be a static VBO ...
|
||||
m_coord[0].x= m_propertyOrigin.x;
|
||||
m_coord[0].y= m_propertyOrigin.y+m_propertySize.y;
|
||||
m_coord[1].x= m_propertyOrigin.x;
|
||||
m_coord[1].y= m_propertyOrigin.y;
|
||||
m_coord[2].x= m_propertyOrigin.x+m_propertySize.x;
|
||||
m_coord[2].y= m_propertyOrigin.y;
|
||||
m_coord[0].setValue( m_propertyOrigin.x(),
|
||||
m_propertyOrigin.y()+m_propertySize.y());
|
||||
m_coord[1].setValue( m_propertyOrigin.x(),
|
||||
m_propertyOrigin.y());
|
||||
m_coord[2].setValue( m_propertyOrigin.x()+m_propertySize.x(),
|
||||
m_propertyOrigin.y());
|
||||
|
||||
m_coord[3].x= m_propertyOrigin.x+m_propertySize.x;
|
||||
m_coord[3].y= m_propertyOrigin.y;
|
||||
m_coord[4].x= m_propertyOrigin.x+m_propertySize.x;
|
||||
m_coord[4].y= m_propertyOrigin.y+m_propertySize.y;
|
||||
m_coord[5].x= m_propertyOrigin.x;
|
||||
m_coord[5].y= m_propertyOrigin.y+m_propertySize.y;
|
||||
m_coord[3].setValue( m_propertyOrigin.x()+m_propertySize.x(),
|
||||
m_propertyOrigin.y());
|
||||
m_coord[4].setValue( m_propertyOrigin.x()+m_propertySize.x(),
|
||||
m_propertyOrigin.y()+m_propertySize.y());
|
||||
m_coord[5].setValue( m_propertyOrigin.x(),
|
||||
m_propertyOrigin.y()+m_propertySize.y());
|
||||
}
|
||||
|
||||
void ewol::Shaper::SetOrigin(vec2 newOri)
|
||||
@ -252,8 +252,8 @@ vec2 ewol::Shaper::GetPadding(void)
|
||||
{
|
||||
vec2 padding;
|
||||
if (m_config!=NULL) {
|
||||
padding.x = m_config->GetFloat(m_confIdPaddingX);
|
||||
padding.y = m_config->GetFloat(m_confIdPaddingY);
|
||||
padding.setValue(m_config->GetFloat(m_confIdPaddingX),
|
||||
m_config->GetFloat(m_confIdPaddingY));
|
||||
}
|
||||
return padding;
|
||||
}
|
||||
|
@ -204,10 +204,10 @@ void ewol::Text::SetPos(vec3 pos)
|
||||
// check min max for display area
|
||||
if (m_nbCharDisplayed != 0) {
|
||||
EWOL_VERBOSE("update size 1 " << m_sizeDisplayStart << " " << m_sizeDisplayStop);
|
||||
m_sizeDisplayStop.x = etk_max(m_position.x, m_sizeDisplayStop.x);
|
||||
m_sizeDisplayStop.y = etk_max(m_position.y, m_sizeDisplayStop.y);
|
||||
m_sizeDisplayStart.x = etk_min(m_position.x, m_sizeDisplayStart.x);
|
||||
m_sizeDisplayStart.y = etk_min(m_position.y, m_sizeDisplayStart.y);
|
||||
m_sizeDisplayStop.setX(etk_max(m_position.x(), m_sizeDisplayStop.x()));
|
||||
m_sizeDisplayStop.setY(etk_max(m_position.y(), m_sizeDisplayStop.y()));
|
||||
m_sizeDisplayStart.setX(etk_min(m_position.x(), m_sizeDisplayStart.x()));
|
||||
m_sizeDisplayStart.setY(etk_min(m_position.y(), m_sizeDisplayStart.y()));
|
||||
EWOL_VERBOSE("update size 2 " << m_sizeDisplayStart << " " << m_sizeDisplayStop);
|
||||
}
|
||||
// update position
|
||||
@ -218,14 +218,14 @@ void ewol::Text::SetPos(vec3 pos)
|
||||
if (m_nbCharDisplayed == 0) {
|
||||
m_sizeDisplayStart = m_position;
|
||||
m_sizeDisplayStop = m_position;
|
||||
m_sizeDisplayStop.y += m_font->GetHeight(m_mode);
|
||||
m_sizeDisplayStop.setY( m_sizeDisplayStop.y()+ m_font->GetHeight(m_mode));
|
||||
EWOL_VERBOSE("update size 0 " << m_sizeDisplayStart << " " << m_sizeDisplayStop);
|
||||
} else {
|
||||
EWOL_VERBOSE("update size 3 " << m_sizeDisplayStart << " " << m_sizeDisplayStop);
|
||||
m_sizeDisplayStop.x = etk_max(m_position.x, m_sizeDisplayStop.x);
|
||||
m_sizeDisplayStop.y = etk_max(m_position.y, m_sizeDisplayStop.y);
|
||||
m_sizeDisplayStart.x = etk_min(m_position.x, m_sizeDisplayStart.x);
|
||||
m_sizeDisplayStart.y = etk_min(m_position.y, m_sizeDisplayStart.y);
|
||||
m_sizeDisplayStop.setX(etk_max(m_position.x(), m_sizeDisplayStop.x()));
|
||||
m_sizeDisplayStop.setY(etk_max(m_position.y(), m_sizeDisplayStop.y()));
|
||||
m_sizeDisplayStart.setX(etk_min(m_position.x(), m_sizeDisplayStart.x()));
|
||||
m_sizeDisplayStart.setY(etk_min(m_position.y(), m_sizeDisplayStart.y()));
|
||||
EWOL_VERBOSE("update size 4 " << m_sizeDisplayStart << " " << m_sizeDisplayStop);
|
||||
}
|
||||
}
|
||||
@ -260,26 +260,26 @@ void ewol::Text::SetClippingWidth(vec3 pos, vec3 width)
|
||||
void ewol::Text::SetClipping(vec3 pos, vec3 posEnd)
|
||||
{
|
||||
// note the internal system all time request to have a bounding all time in the same order
|
||||
if (pos.x <= posEnd.x) {
|
||||
m_clippingPosStart.x = pos.x;
|
||||
m_clippingPosStop.x = posEnd.x;
|
||||
if (pos.x() <= posEnd.x()) {
|
||||
m_clippingPosStart.setX(pos.x());
|
||||
m_clippingPosStop.setX(posEnd.x());
|
||||
} else {
|
||||
m_clippingPosStart.x = posEnd.x;
|
||||
m_clippingPosStop.x = pos.x;
|
||||
m_clippingPosStart.setX(posEnd.x());
|
||||
m_clippingPosStop.setX(pos.x());
|
||||
}
|
||||
if (pos.y <= posEnd.y) {
|
||||
m_clippingPosStart.y = pos.y;
|
||||
m_clippingPosStop.y = posEnd.y;
|
||||
if (pos.y() <= posEnd.y()) {
|
||||
m_clippingPosStart.setY(pos.y());
|
||||
m_clippingPosStop.setY(posEnd.y());
|
||||
} else {
|
||||
m_clippingPosStart.y = posEnd.y;
|
||||
m_clippingPosStop.y = pos.y;
|
||||
m_clippingPosStart.setY(posEnd.y());
|
||||
m_clippingPosStop.setY(pos.y());
|
||||
}
|
||||
if (pos.z <= posEnd.z) {
|
||||
m_clippingPosStart.z = pos.z;
|
||||
m_clippingPosStop.z = posEnd.z;
|
||||
if (pos.z() <= posEnd.z()) {
|
||||
m_clippingPosStart.setZ(pos.z());
|
||||
m_clippingPosStop.setZ(posEnd.z());
|
||||
} else {
|
||||
m_clippingPosStart.z = posEnd.z;
|
||||
m_clippingPosStop.z = pos.z;
|
||||
m_clippingPosStart.setZ(posEnd.z());
|
||||
m_clippingPosStop.setZ(pos.z());
|
||||
}
|
||||
m_clippingEnable = true;
|
||||
//m_vectorialDraw.SetClipping(m_clippingPosStart, m_clippingPosStop);
|
||||
@ -578,7 +578,7 @@ void ewol::Text::Print(const etk::UString& text, const etk::Vector<TextDecoratio
|
||||
m_vectorialDraw.SetPos(pos);
|
||||
Print(text[iii]);
|
||||
float fontHeigh = m_font->GetHeight(m_mode);
|
||||
m_vectorialDraw.RectangleWidth(vec3(m_position.x-pos.x,fontHeigh,0.0f) );
|
||||
m_vectorialDraw.RectangleWidth(vec3(m_position.x()-pos.x(),fontHeigh,0.0f) );
|
||||
m_nbCharDisplayed++;
|
||||
} else {
|
||||
Print(text[iii]);
|
||||
@ -594,10 +594,10 @@ void ewol::Text::Print(const etk::UString& text, const etk::Vector<TextDecoratio
|
||||
}
|
||||
} else {
|
||||
// special start case at the right of the endpoint :
|
||||
if (m_stopTextPos < m_position.x) {
|
||||
if (m_stopTextPos < m_position.x()) {
|
||||
ForceLineReturn();
|
||||
}
|
||||
float basicSpaceWidth = CalculateSize(' ').x;
|
||||
float basicSpaceWidth = CalculateSize(' ').x();
|
||||
int32_t currentId = 0;
|
||||
int32_t stop;
|
||||
int32_t space;
|
||||
@ -620,17 +620,17 @@ void ewol::Text::Print(const etk::UString& text, const etk::Vector<TextDecoratio
|
||||
case ewol::Text::alignRight:
|
||||
if (m_needDisplay == true) {
|
||||
// Move the first char at the right :
|
||||
SetPos(vec3(m_position.x + freeSpace,
|
||||
m_position.y,
|
||||
m_position.z) );
|
||||
SetPos(vec3(m_position.x() + freeSpace,
|
||||
m_position.y(),
|
||||
m_position.z()) );
|
||||
}
|
||||
break;
|
||||
case ewol::Text::alignCenter:
|
||||
if (m_needDisplay == true) {
|
||||
// Move the first char at the right :
|
||||
SetPos(vec3(m_position.x + freeSpace/2,
|
||||
m_position.y,
|
||||
m_position.z) );
|
||||
SetPos(vec3(m_position.x() + freeSpace/2,
|
||||
m_position.y(),
|
||||
m_position.z()) );
|
||||
}
|
||||
break;
|
||||
}
|
||||
@ -669,9 +669,9 @@ void ewol::Text::Print(const etk::UString& text, const etk::Vector<TextDecoratio
|
||||
m_vectorialDraw.SetPos(m_position);
|
||||
}
|
||||
// Must generate a dynamic space :
|
||||
SetPos(vec3(m_position.x + interpolation,
|
||||
m_position.y,
|
||||
m_position.z) );
|
||||
SetPos(vec3(m_position.x() + interpolation,
|
||||
m_position.y(),
|
||||
m_position.z()) );
|
||||
if( true == m_needDisplay
|
||||
&& m_colorBg.a != 0) {
|
||||
m_vectorialDraw.RectangleWidth(vec3(interpolation,fontHeigh,0.0f) );
|
||||
@ -683,7 +683,7 @@ void ewol::Text::Print(const etk::UString& text, const etk::Vector<TextDecoratio
|
||||
vec3 pos = m_position;
|
||||
m_vectorialDraw.SetPos(pos);
|
||||
Print(text[iii]);
|
||||
m_vectorialDraw.RectangleWidth(vec3(m_position.x-pos.x,fontHeigh,0.0f) );
|
||||
m_vectorialDraw.RectangleWidth(vec3(m_position.x()-pos.x(),fontHeigh,0.0f) );
|
||||
m_nbCharDisplayed++;
|
||||
} else {
|
||||
Print(text[iii]);
|
||||
@ -704,15 +704,15 @@ void ewol::Text::Print(const etk::UString& text, const etk::Vector<TextDecoratio
|
||||
currentId = stop+1;
|
||||
// Reset position :
|
||||
SetPos(vec3(m_startTextpos,
|
||||
(float)(m_position.y - m_font->GetHeight(m_mode)),
|
||||
m_position.z) );
|
||||
(float)(m_position.y() - m_font->GetHeight(m_mode)),
|
||||
m_position.z()) );
|
||||
m_nbCharDisplayed++;
|
||||
} else if(text[stop] == (uniChar_t)'\n') {
|
||||
currentId = stop+1;
|
||||
// Reset position :
|
||||
SetPos(vec3(m_startTextpos,
|
||||
(float)(m_position.y - m_font->GetHeight(m_mode)),
|
||||
m_position.z) );
|
||||
(float)(m_position.y() - m_font->GetHeight(m_mode)),
|
||||
m_position.z()) );
|
||||
m_nbCharDisplayed++;
|
||||
} else {
|
||||
currentId = stop;
|
||||
@ -750,62 +750,62 @@ void ewol::Text::Print(const uniChar_t charcode)
|
||||
* | |
|
||||
* yD *------*
|
||||
*/
|
||||
float dxA = m_position.x + myGlyph->m_bearing.x + kerningOffset;
|
||||
float dxB = dxA + myGlyph->m_sizeTexture.x;
|
||||
float dyC = m_position.y + myGlyph->m_bearing.y + fontHeigh - fontSize;
|
||||
float dyD = dyC - myGlyph->m_sizeTexture.y;
|
||||
float dxA = m_position.x() + myGlyph->m_bearing.x() + kerningOffset;
|
||||
float dxB = dxA + myGlyph->m_sizeTexture.x();
|
||||
float dyC = m_position.y() + myGlyph->m_bearing.y() + fontHeigh - fontSize;
|
||||
float dyD = dyC - myGlyph->m_sizeTexture.y();
|
||||
|
||||
float tuA = myGlyph->m_texturePosStart.x;
|
||||
float tuB = myGlyph->m_texturePosStop.x;
|
||||
float tvC = myGlyph->m_texturePosStart.y;
|
||||
float tvD = myGlyph->m_texturePosStop.y;
|
||||
float tuA = myGlyph->m_texturePosStart.x();
|
||||
float tuB = myGlyph->m_texturePosStop.x();
|
||||
float tvC = myGlyph->m_texturePosStart.y();
|
||||
float tvD = myGlyph->m_texturePosStop.y();
|
||||
|
||||
|
||||
// Clipping and drawing area
|
||||
if( true == m_clippingEnable
|
||||
&& ( dxB < m_clippingPosStart.x
|
||||
|| dxA > m_clippingPosStop.x
|
||||
|| dyC < m_clippingPosStart.y
|
||||
|| dyD > m_clippingPosStop.y ) ) {
|
||||
&& ( dxB < m_clippingPosStart.x()
|
||||
|| dxA > m_clippingPosStop.x()
|
||||
|| dyC < m_clippingPosStart.y()
|
||||
|| dyD > m_clippingPosStop.y() ) ) {
|
||||
// Nothing to diplay ...
|
||||
} else {
|
||||
if (true == m_clippingEnable) {
|
||||
// generata positions...
|
||||
float TexSizeX = tuB - tuA;
|
||||
if (dxA < m_clippingPosStart.x) {
|
||||
if (dxA < m_clippingPosStart.x()) {
|
||||
// clip display
|
||||
float drawSize = m_clippingPosStart.x - dxA;
|
||||
float drawSize = m_clippingPosStart.x() - dxA;
|
||||
// Update element start display
|
||||
dxA = m_clippingPosStart.x;
|
||||
float addElement = TexSizeX * drawSize / (float)myGlyph->m_sizeTexture.x;
|
||||
dxA = m_clippingPosStart.x();
|
||||
float addElement = TexSizeX * drawSize / (float)myGlyph->m_sizeTexture.x();
|
||||
// update texture start X Pos
|
||||
tuA += addElement;
|
||||
}
|
||||
if (dxB > m_clippingPosStop.x) {
|
||||
if (dxB > m_clippingPosStop.x()) {
|
||||
// clip display
|
||||
float drawSize = dxB - m_clippingPosStop.x;
|
||||
float drawSize = dxB - m_clippingPosStop.x();
|
||||
// Update element start display
|
||||
dxB = m_clippingPosStop.x;
|
||||
float addElement = TexSizeX * drawSize / (float)myGlyph->m_sizeTexture.x;
|
||||
dxB = m_clippingPosStop.x();
|
||||
float addElement = TexSizeX * drawSize / (float)myGlyph->m_sizeTexture.x();
|
||||
// update texture start X Pos
|
||||
tuB -= addElement;
|
||||
}
|
||||
float TexSizeY = tvC - tvD;
|
||||
if (dyC > m_clippingPosStop.y) {
|
||||
if (dyC > m_clippingPosStop.y()) {
|
||||
// clip display
|
||||
float drawSize = dyC - m_clippingPosStop.y;
|
||||
float drawSize = dyC - m_clippingPosStop.y();
|
||||
// Update element start display
|
||||
dyC = m_clippingPosStop.y;
|
||||
float addElement = TexSizeY * drawSize / (float)myGlyph->m_sizeTexture.y;
|
||||
dyC = m_clippingPosStop.y();
|
||||
float addElement = TexSizeY * drawSize / (float)myGlyph->m_sizeTexture.y();
|
||||
// update texture start X Pos
|
||||
tvC -= addElement;
|
||||
}
|
||||
if (dyD < m_clippingPosStart.y) {
|
||||
if (dyD < m_clippingPosStart.y()) {
|
||||
// clip display
|
||||
float drawSize = m_clippingPosStart.y - dyD;
|
||||
float drawSize = m_clippingPosStart.y() - dyD;
|
||||
// Update element start display
|
||||
dyD = m_clippingPosStart.y;
|
||||
float addElement = TexSizeY * drawSize / (float)myGlyph->m_sizeTexture.y;
|
||||
dyD = m_clippingPosStart.y();
|
||||
float addElement = TexSizeY * drawSize / (float)myGlyph->m_sizeTexture.y();
|
||||
// update texture start X Pos
|
||||
tvD += addElement;
|
||||
}
|
||||
@ -822,15 +822,10 @@ void ewol::Text::Print(const uniChar_t charcode)
|
||||
*/
|
||||
if (m_needDisplay == true) {
|
||||
ivec2 bitmapDrawPos[4];
|
||||
bitmapDrawPos[0].x = (int32_t)dxA;
|
||||
bitmapDrawPos[1].x = (int32_t)dxB;
|
||||
bitmapDrawPos[2].x = (int32_t)dxB;
|
||||
bitmapDrawPos[3].x = (int32_t)dxA;
|
||||
|
||||
bitmapDrawPos[0].y = (int32_t)dyC;
|
||||
bitmapDrawPos[1].y = (int32_t)dyC;
|
||||
bitmapDrawPos[2].y = (int32_t)dyD;
|
||||
bitmapDrawPos[3].y = (int32_t)dyD;
|
||||
bitmapDrawPos[0].setValue((int32_t)dxA, (int32_t)dyC);
|
||||
bitmapDrawPos[1].setValue((int32_t)dxB, (int32_t)dyC);
|
||||
bitmapDrawPos[2].setValue((int32_t)dxB, (int32_t)dyD);
|
||||
bitmapDrawPos[3].setValue((int32_t)dxA, (int32_t)dyD);
|
||||
/* texture Position :
|
||||
* 0------1
|
||||
* | |
|
||||
@ -838,15 +833,10 @@ void ewol::Text::Print(const uniChar_t charcode)
|
||||
* 3------2
|
||||
*/
|
||||
vec2 texturePos[4];
|
||||
texturePos[0].x = tuA+m_mode;
|
||||
texturePos[1].x = tuB+m_mode;
|
||||
texturePos[2].x = tuB+m_mode;
|
||||
texturePos[3].x = tuA+m_mode;
|
||||
|
||||
texturePos[0].y = tvC;
|
||||
texturePos[1].y = tvC;
|
||||
texturePos[2].y = tvD;
|
||||
texturePos[3].y = tvD;
|
||||
texturePos[0].setValue(tuA+m_mode, tvC);
|
||||
texturePos[1].setValue(tuB+m_mode, tvC);
|
||||
texturePos[2].setValue(tuB+m_mode, tvD);
|
||||
texturePos[3].setValue(tuA+m_mode, tvD);
|
||||
|
||||
// NOTE : Android does not support the Quads elements ...
|
||||
/* Step 1 :
|
||||
@ -892,7 +882,7 @@ void ewol::Text::Print(const uniChar_t charcode)
|
||||
}
|
||||
}
|
||||
// move the position :
|
||||
m_position.x += myGlyph->m_advance.x + kerningOffset;
|
||||
m_position.setX(m_position.x() + myGlyph->m_advance.x() + kerningOffset);
|
||||
// Register the previous character
|
||||
m_previousCharcode = charcode;
|
||||
return;
|
||||
@ -901,7 +891,7 @@ void ewol::Text::Print(const uniChar_t charcode)
|
||||
void ewol::Text::ForceLineReturn(void)
|
||||
{
|
||||
// Reset position :
|
||||
SetPos(vec3(m_startTextpos, m_position.y - m_font->GetHeight(m_mode), 0) );
|
||||
SetPos(vec3(m_startTextpos, m_position.y() - m_font->GetHeight(m_mode), 0) );
|
||||
}
|
||||
|
||||
|
||||
@ -940,17 +930,19 @@ vec3 ewol::Text::CalculateSizeHTML(const etk::UString& text)
|
||||
// same as print without the end display ...
|
||||
PrintHTML(text);
|
||||
// get the last elements
|
||||
m_sizeDisplayStop.x = etk_max(m_position.x, m_sizeDisplayStop.x);
|
||||
m_sizeDisplayStop.y = etk_max(m_position.y, m_sizeDisplayStop.y);
|
||||
m_sizeDisplayStart.x = etk_min(m_position.x, m_sizeDisplayStart.x);
|
||||
m_sizeDisplayStart.y = etk_min(m_position.y, m_sizeDisplayStart.y);
|
||||
m_sizeDisplayStop.setValue(etk_max(m_position.x(), m_sizeDisplayStop.x()) ,
|
||||
etk_max(m_position.y(), m_sizeDisplayStop.y()) ,
|
||||
0);
|
||||
m_sizeDisplayStart.setValue(etk_min(m_position.x(), m_sizeDisplayStart.x()) ,
|
||||
etk_min(m_position.y(), m_sizeDisplayStart.y()) ,
|
||||
0);
|
||||
|
||||
// set back the display system
|
||||
m_needDisplay = true;
|
||||
|
||||
return vec3( m_sizeDisplayStop.x-m_sizeDisplayStart.x,
|
||||
m_sizeDisplayStop.y-m_sizeDisplayStart.y,
|
||||
m_sizeDisplayStop.z-m_sizeDisplayStart.z);
|
||||
return vec3( m_sizeDisplayStop.x()-m_sizeDisplayStart.x(),
|
||||
m_sizeDisplayStop.y()-m_sizeDisplayStart.y(),
|
||||
m_sizeDisplayStop.z()-m_sizeDisplayStart.z());
|
||||
}
|
||||
|
||||
vec3 ewol::Text::CalculateSizeDecorated(const etk::UString& text)
|
||||
@ -971,10 +963,10 @@ vec3 ewol::Text::CalculateSize(const etk::UString& text)
|
||||
vec3 outputSize(0, 0, 0);
|
||||
for(int32_t iii=0; iii<text.Size(); iii++) {
|
||||
vec3 tmpp = CalculateSize(text[iii]);
|
||||
if (outputSize.y == 0) {
|
||||
outputSize.y += tmpp.y;
|
||||
if (outputSize.y() == 0) {
|
||||
outputSize.setY(tmpp.y());
|
||||
}
|
||||
outputSize.x += tmpp.x;
|
||||
outputSize.setX( outputSize.x() + tmpp.x());
|
||||
}
|
||||
return outputSize;
|
||||
}
|
||||
@ -995,7 +987,7 @@ vec3 ewol::Text::CalculateSize(const uniChar_t charcode)
|
||||
kerningOffset = myGlyph->KerningGet(m_previousCharcode);
|
||||
}
|
||||
|
||||
vec3 outputSize((float)(myGlyph->m_advance.x + kerningOffset),
|
||||
vec3 outputSize((float)(myGlyph->m_advance.x() + kerningOffset),
|
||||
(float)(fontHeigh),
|
||||
(float)(0.0));
|
||||
// Register the previous character
|
||||
@ -1028,7 +1020,7 @@ bool ewol::Text::ExtrapolateLastId(const etk::UString& text, const int32_t start
|
||||
int32_t lastSpacePosition = start;
|
||||
int32_t lastSpacefreeSize;
|
||||
|
||||
float endPos = m_position.x;
|
||||
float endPos = m_position.x();
|
||||
bool endOfLine = false;
|
||||
|
||||
float stopPosition = m_stopTextPos;
|
||||
@ -1040,7 +1032,7 @@ bool ewol::Text::ExtrapolateLastId(const etk::UString& text, const int32_t start
|
||||
for (int32_t iii=start; iii<text.Size(); iii++) {
|
||||
vec3 tmpSize = CalculateSize(text[iii]);
|
||||
// check oveflow :
|
||||
if (endPos + tmpSize.x > stopPosition) {
|
||||
if (endPos + tmpSize.x() > stopPosition) {
|
||||
stop = iii;
|
||||
break;
|
||||
}
|
||||
@ -1055,7 +1047,7 @@ bool ewol::Text::ExtrapolateLastId(const etk::UString& text, const int32_t start
|
||||
break;
|
||||
}
|
||||
// update local size :
|
||||
endPos += tmpSize.x;
|
||||
endPos += tmpSize.x();
|
||||
}
|
||||
freeSpace = stopPosition - endPos;
|
||||
// retore previous :
|
||||
|
@ -16,9 +16,9 @@ void game::Camera::Update(void)
|
||||
m_matrix.Identity();
|
||||
m_matrix.Rotate(vec3(0,0,1), M_PI/2.0 );
|
||||
m_matrix.Rotate(vec3(0,1,0), M_PI/2.0 );
|
||||
m_matrix.Rotate(vec3(1,0,0), m_angles.x );
|
||||
m_matrix.Rotate(vec3(0,1,0), m_angles.y );
|
||||
m_matrix.Rotate(vec3(0,0,1), m_angles.z );
|
||||
m_matrix.Rotate(vec3(1,0,0), m_angles.x() );
|
||||
m_matrix.Rotate(vec3(0,1,0), m_angles.y() );
|
||||
m_matrix.Rotate(vec3(0,0,1), m_angles.z() );
|
||||
vec3 tmpp = m_position * -1;
|
||||
m_matrix.Translate(tmpp);
|
||||
m_needUpdate = false;
|
||||
|
@ -298,12 +298,12 @@ static int32_t nextP2(int32_t value)
|
||||
|
||||
bool ewol::resource::Keep(etk::UString& filename, ewol::TextureFile*& object, ivec2 size)
|
||||
{
|
||||
ivec2 size2(nextP2(size.x), nextP2(size.y));
|
||||
ivec2 size2(nextP2(size.x()), nextP2(size.y()));
|
||||
etk::UString TmpFilename = filename;
|
||||
TmpFilename += ":";
|
||||
TmpFilename += size2.x;
|
||||
TmpFilename += size2.x();
|
||||
TmpFilename += "x";
|
||||
TmpFilename += size2.y;
|
||||
TmpFilename += size2.y();
|
||||
|
||||
EWOL_INFO("KEEP : TextureFile : file : \"" << TmpFilename << "\" basic size=" << size);
|
||||
object = static_cast<ewol::TextureFile*>(LocalKeep(TmpFilename));
|
||||
|
@ -130,8 +130,7 @@ void ewolProcessEvents(void)
|
||||
break;
|
||||
case THREAD_RESIZE:
|
||||
//EWOL_DEBUG("Receive MSG : THREAD_RESIZE");
|
||||
windowsSize.x = data.dimention.x;
|
||||
windowsSize.y = data.dimention.y;
|
||||
windowsSize = data.dimention;
|
||||
eSystem::ForceRedrawAll();
|
||||
break;
|
||||
case THREAD_INPUT_MOTION:
|
||||
@ -319,8 +318,7 @@ void eSystem::Resize(int w, int h )
|
||||
if (true == isGlobalSystemInit) {
|
||||
eSystemMessage data;
|
||||
data.TypeMessage = THREAD_RESIZE;
|
||||
data.dimention.x = w;
|
||||
data.dimention.y = h;
|
||||
data.dimention.setValue(w,h);
|
||||
l_msgSystem.Post(data);
|
||||
}
|
||||
}
|
||||
@ -344,8 +342,7 @@ void eSystem::SetInputMotion(int pointerID, float x, float y )
|
||||
data.TypeMessage = THREAD_INPUT_MOTION;
|
||||
data.inputType = ewol::keyEvent::typeFinger;
|
||||
data.inputId = pointerID;
|
||||
data.dimention.x = x;
|
||||
data.dimention.y = y;
|
||||
data.dimention.setValue(x,y);
|
||||
l_msgSystem.Post(data);
|
||||
}
|
||||
}
|
||||
@ -359,8 +356,7 @@ void eSystem::SetInputState(int pointerID, bool isDown, float x, float y )
|
||||
data.inputType = ewol::keyEvent::typeFinger;
|
||||
data.inputId = pointerID;
|
||||
data.stateIsDown = isDown;
|
||||
data.dimention.x = x;
|
||||
data.dimention.y = y;
|
||||
data.dimention.setValue(x,y);
|
||||
l_msgSystem.Post(data);
|
||||
}
|
||||
}
|
||||
@ -373,8 +369,7 @@ void eSystem::SetMouseMotion(int pointerID, float x, float y )
|
||||
data.TypeMessage = THREAD_INPUT_MOTION;
|
||||
data.inputType = ewol::keyEvent::typeMouse;
|
||||
data.inputId = pointerID;
|
||||
data.dimention.x = x;
|
||||
data.dimention.y = y;
|
||||
data.dimention.setValue(x,y);
|
||||
l_msgSystem.Post(data);
|
||||
}
|
||||
}
|
||||
@ -388,8 +383,7 @@ void eSystem::SetMouseState(int pointerID, bool isDown, float x, float y )
|
||||
data.inputType = ewol::keyEvent::typeMouse;
|
||||
data.inputId = pointerID;
|
||||
data.stateIsDown = isDown;
|
||||
data.dimention.x = x;
|
||||
data.dimention.y = y;
|
||||
data.dimention.setValue(x,y);
|
||||
l_msgSystem.Post(data);
|
||||
}
|
||||
}
|
||||
@ -553,7 +547,7 @@ void eSystem::ForceRedrawAll(void)
|
||||
ewol::Windows* tmpWindows = eSystem::GetCurrentWindows();
|
||||
if (NULL != tmpWindows) {
|
||||
ivec2 tmpSize = eSystem::GetSize();
|
||||
tmpWindows->CalculateSize(tmpSize.x, tmpSize.y);
|
||||
tmpWindows->CalculateSize(tmpSize.x(), tmpSize.y());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -55,13 +55,13 @@ void ewol::eSystemInput::CleanElement(InputPoperty_ts *eventTable, int32_t idInp
|
||||
eventTable[idInput].destinationInputId = 0;
|
||||
eventTable[idInput].lastTimeEvent = 0;
|
||||
eventTable[idInput].curentWidgetEvent = NULL;
|
||||
eventTable[idInput].origin = vec2(0,0);
|
||||
eventTable[idInput].size = vec2(99999999,99999999);
|
||||
eventTable[idInput].downStart = vec2(0,0);
|
||||
eventTable[idInput].origin.setValue(0,0);
|
||||
eventTable[idInput].size.setValue(99999999,99999999);
|
||||
eventTable[idInput].downStart.setValue(0,0);
|
||||
eventTable[idInput].isDown = false;
|
||||
eventTable[idInput].isInside = false;
|
||||
eventTable[idInput].nbClickEvent = 0;
|
||||
eventTable[idInput].posEvent = vec2(0,0);
|
||||
eventTable[idInput].posEvent.setValue(0,0);
|
||||
}
|
||||
|
||||
|
||||
@ -119,7 +119,7 @@ void ewol::eSystemInput::GrabPointer(ewol::Widget* widget)
|
||||
return;
|
||||
}
|
||||
m_grabWidget = widget;
|
||||
guiInterface::GrabPointerEvents(true, widget->GetOrigin() + widget->GetSize()/2.0f);
|
||||
guiInterface::GrabPointerEvents(true, widget->GetOrigin() + ivec2(widget->GetSize().x()/2.0f, widget->GetSize().y()/2.0f) );
|
||||
}
|
||||
|
||||
void ewol::eSystemInput::UnGrabPointer(void)
|
||||
@ -198,9 +198,6 @@ int32_t ewol::eSystemInput::localGetDestinationId(ewol::keyEvent::type_te type,
|
||||
// note if id<0 ==> the it was finger event ...
|
||||
void ewol::eSystemInput::Motion(ewol::keyEvent::type_te type, int pointerID, vec2 pos)
|
||||
{
|
||||
// convert position in Open-GL coordonates ...
|
||||
pos.y = pos.y;
|
||||
|
||||
InputPoperty_ts *eventTable = NULL;
|
||||
if (type == ewol::keyEvent::typeMouse) {
|
||||
eventTable = m_eventMouseSaved;
|
||||
@ -231,10 +228,10 @@ void ewol::eSystemInput::Motion(ewol::keyEvent::type_te type, int pointerID, vec
|
||||
}
|
||||
if( tmpWidget != eventTable[pointerID].curentWidgetEvent
|
||||
|| ( true == eventTable[pointerID].isInside
|
||||
&& ( eventTable[pointerID].origin.x > pos.x
|
||||
|| eventTable[pointerID].origin.y > pos.y
|
||||
|| (eventTable[pointerID].origin.x + eventTable[pointerID].size.x) < pos.x
|
||||
|| (eventTable[pointerID].origin.y + eventTable[pointerID].size.y) < pos.y) ) ) {
|
||||
&& ( eventTable[pointerID].origin.x() > pos.x()
|
||||
|| eventTable[pointerID].origin.y() > pos.y()
|
||||
|| (eventTable[pointerID].origin.x() + eventTable[pointerID].size.x()) < pos.x()
|
||||
|| (eventTable[pointerID].origin.y() + eventTable[pointerID].size.y()) < pos.y()) ) ) {
|
||||
eventTable[pointerID].isInside = false;
|
||||
EVENT_DEBUG("GUI : Input ID=" << pointerID << "==>" << eventTable[pointerID].destinationInputId << " [LEAVE] " << pos);
|
||||
eventTable[pointerID].posEvent = pos;
|
||||
@ -262,20 +259,20 @@ void ewol::eSystemInput::Motion(ewol::keyEvent::type_te type, int pointerID, vec
|
||||
localEventInput(type, eventTable[pointerID].curentWidgetEvent, eventTable[pointerID].destinationInputId, ewol::keyEvent::statusMove, pos);
|
||||
} else if (true == eventTable[pointerID].isUsed) {
|
||||
if (true == eventTable[pointerID].isInside) {
|
||||
if( eventTable[pointerID].origin.x > pos.x
|
||||
|| eventTable[pointerID].origin.y > pos.y
|
||||
|| (eventTable[pointerID].origin.x + eventTable[pointerID].size.x) < pos.x
|
||||
|| (eventTable[pointerID].origin.y + eventTable[pointerID].size.y) < pos.y) {
|
||||
if( eventTable[pointerID].origin.x() > pos.x()
|
||||
|| eventTable[pointerID].origin.y() > pos.y()
|
||||
|| (eventTable[pointerID].origin.x() + eventTable[pointerID].size.x()) < pos.x()
|
||||
|| (eventTable[pointerID].origin.y() + eventTable[pointerID].size.y()) < pos.y()) {
|
||||
eventTable[pointerID].isInside = false;
|
||||
EVENT_DEBUG("GUI : Input ID=" << pointerID << "==>" << eventTable[pointerID].destinationInputId << " [LEAVE] " << pos);
|
||||
eventTable[pointerID].posEvent = pos;
|
||||
localEventInput(type, eventTable[pointerID].curentWidgetEvent, eventTable[pointerID].destinationInputId, ewol::keyEvent::statusLeave, pos);
|
||||
}
|
||||
} else {
|
||||
if( ( eventTable[pointerID].origin.x <= pos.x
|
||||
&& (eventTable[pointerID].origin.x + eventTable[pointerID].size.x) >= pos.x )
|
||||
&& ( eventTable[pointerID].origin.y <= pos.y
|
||||
&& (eventTable[pointerID].origin.y + eventTable[pointerID].size.y) >= pos.y ) ) {
|
||||
if( ( eventTable[pointerID].origin.x() <= pos.x()
|
||||
&& (eventTable[pointerID].origin.x() + eventTable[pointerID].size.x()) >= pos.x() )
|
||||
&& ( eventTable[pointerID].origin.y() <= pos.y()
|
||||
&& (eventTable[pointerID].origin.y() + eventTable[pointerID].size.y()) >= pos.y() ) ) {
|
||||
eventTable[pointerID].isInside = true;
|
||||
EVENT_DEBUG("GUI : Input ID=" << pointerID << "==>" << eventTable[pointerID].destinationInputId << " [ENTER] " << pos);
|
||||
eventTable[pointerID].posEvent = pos;
|
||||
@ -318,8 +315,8 @@ void ewol::eSystemInput::State(ewol::keyEvent::type_te type, int pointerID, bool
|
||||
// we have an event previously ... check delay between click and offset position
|
||||
if (currentTime - eventTable[pointerID].lastTimeEvent > localLimit.sepatateTime) {
|
||||
CleanElement(eventTable, pointerID);
|
||||
} else if( abs(eventTable[pointerID].downStart.x - pos.x) >= localLimit.DpiOffset
|
||||
|| abs(eventTable[pointerID].downStart.y - pos.y) >= localLimit.DpiOffset ){
|
||||
} else if( abs(eventTable[pointerID].downStart.x() - pos.x()) >= localLimit.DpiOffset
|
||||
|| abs(eventTable[pointerID].downStart.y() - pos.y()) >= localLimit.DpiOffset ){
|
||||
CleanElement(eventTable, pointerID);
|
||||
}
|
||||
}
|
||||
@ -376,8 +373,8 @@ void ewol::eSystemInput::State(ewol::keyEvent::type_te type, int pointerID, bool
|
||||
eventTable[pointerID].posEvent = pos;
|
||||
localEventInput(type, eventTable[pointerID].curentWidgetEvent, pointerID, ewol::keyEvent::statusUp, pos);
|
||||
// generate event (single)
|
||||
if( abs(eventTable[pointerID].downStart.x - pos.x) < localLimit.DpiOffset
|
||||
&& abs(eventTable[pointerID].downStart.y - pos.y) < localLimit.DpiOffset ){
|
||||
if( abs(eventTable[pointerID].downStart.x() - pos.x()) < localLimit.DpiOffset
|
||||
&& abs(eventTable[pointerID].downStart.y() - pos.y()) < localLimit.DpiOffset ){
|
||||
// Save current position :
|
||||
eventTable[pointerID].downStart = pos;
|
||||
// save start time
|
||||
|
@ -343,8 +343,8 @@ void guiInterface::SetIcon(etk::UString inputFile)
|
||||
char* tmpPointer = tmpVal;
|
||||
switch(depth) {
|
||||
case 16:
|
||||
for(ivec2 pos(0,0); pos.y<dataImage.GetHeight(); pos.y++) {
|
||||
for(pos.x=0; pos.x<dataImage.GetHeight(); pos.x++) {
|
||||
for(ivec2 pos(0,0); pos.y()<dataImage.GetHeight(); pos.setY(pos.y()+1)) {
|
||||
for(pos.setX(0); pos.x()<dataImage.GetHeight(); pos.setX(pos.x()+1)) {
|
||||
draw::Color tmpColor = dataImage.Get(pos);
|
||||
int16_t tmpVal = ((uint16_t)((uint16_t)tmpColor.r>>3))<<11
|
||||
+ ((uint16_t)((uint16_t)tmpColor.g>>2))<<5
|
||||
@ -355,8 +355,8 @@ void guiInterface::SetIcon(etk::UString inputFile)
|
||||
}
|
||||
break;
|
||||
case 24:
|
||||
for(ivec2 pos(0,0); pos.y<dataImage.GetHeight(); pos.y++) {
|
||||
for(pos.x=0; pos.x<dataImage.GetHeight(); pos.x++) {
|
||||
for(ivec2 pos(0,0); pos.y()<dataImage.GetHeight(); pos.setY(pos.y()+1)) {
|
||||
for(pos.setX(0); pos.x()<dataImage.GetHeight(); pos.setX(pos.x()+1)) {
|
||||
draw::Color tmpColor = dataImage.Get(pos);
|
||||
*tmpPointer++ = tmpColor.b;
|
||||
*tmpPointer++ = tmpColor.g;
|
||||
@ -366,8 +366,8 @@ void guiInterface::SetIcon(etk::UString inputFile)
|
||||
}
|
||||
break;
|
||||
case 32:
|
||||
for(ivec2 pos(0,0); pos.y<dataImage.GetHeight(); pos.y++) {
|
||||
for(pos.x=0; pos.x<dataImage.GetHeight(); pos.x++) {
|
||||
for(ivec2 pos(0,0); pos.y()<dataImage.GetHeight(); pos.setY(pos.y()+1)) {
|
||||
for(pos.setX(0); pos.x()<dataImage.GetHeight(); pos.setX(pos.x()+1)) {
|
||||
draw::Color tmpColor = dataImage.Get(pos);
|
||||
*tmpPointer++ = tmpColor.a;
|
||||
*tmpPointer++ = tmpColor.b;
|
||||
@ -805,8 +805,8 @@ void X11_Run(void)
|
||||
case MotionNotify:
|
||||
X11_INFO("X11 event MotionNotify");
|
||||
if( true==m_grabAllEvent
|
||||
&& event.xmotion.x == (int32_t)m_forcePos.x
|
||||
&& event.xmotion.y == (int32_t)m_forcePos.y) {
|
||||
&& event.xmotion.x == (int32_t)m_forcePos.x()
|
||||
&& event.xmotion.y == (int32_t)m_forcePos.y()) {
|
||||
X11_VERBOSE("X11 reject mouse move (grab mode)");
|
||||
// we get our requested position...
|
||||
m_positionChangeRequested = false;
|
||||
@ -815,13 +815,13 @@ void X11_Run(void)
|
||||
m_cursorEventX = event.xmotion.x;
|
||||
m_cursorEventY = (m_currentHeight-event.xmotion.y);
|
||||
if(true==m_grabAllEvent) {
|
||||
m_cursorEventX -= m_forcePos.x;
|
||||
m_cursorEventY -= (m_currentHeight-m_forcePos.y);
|
||||
m_cursorEventX -= m_forcePos.x();
|
||||
m_cursorEventY -= (m_currentHeight-m_forcePos.y());
|
||||
}
|
||||
vec2 newDelta = vec2(m_cursorEventX, m_cursorEventY);
|
||||
if(true==m_grabAllEvent) {
|
||||
m_cursorEventX -= m_curentGrabDelta.x;
|
||||
m_cursorEventY -= m_curentGrabDelta.y;
|
||||
m_cursorEventX -= m_curentGrabDelta.x();
|
||||
m_cursorEventY -= m_curentGrabDelta.y();
|
||||
}
|
||||
m_curentGrabDelta = newDelta;
|
||||
// For compatibility of the Android system :
|
||||
@ -840,7 +840,7 @@ void X11_Run(void)
|
||||
if (true==m_grabAllEvent) {
|
||||
if (m_positionChangeRequested == false) {
|
||||
X11_DEBUG("X11 Set pointer position : " << m_forcePos);
|
||||
XWarpPointer(m_display, None, WindowHandle, 0,0, 0, 0, m_forcePos.x, m_forcePos.y);
|
||||
XWarpPointer(m_display, None, WindowHandle, 0,0, 0, 0, m_forcePos.x(), m_forcePos.y());
|
||||
XFlush(m_display);
|
||||
m_positionChangeRequested = true;
|
||||
}
|
||||
@ -1147,18 +1147,18 @@ void guiInterface::KeyboardHide(void)
|
||||
void guiInterface::ChangeSize(ivec2 size)
|
||||
{
|
||||
X11_INFO("X11-API: ChangeSize=" << size);
|
||||
m_currentHeight = size.y;
|
||||
m_currentWidth = size.x;
|
||||
XResizeWindow(m_display, WindowHandle, size.x, size.y);
|
||||
m_currentHeight = size.y();
|
||||
m_currentWidth = size.x();
|
||||
XResizeWindow(m_display, WindowHandle, size.x(), size.y());
|
||||
}
|
||||
|
||||
|
||||
void guiInterface::ChangePos(ivec2 pos)
|
||||
{
|
||||
X11_INFO("X11-API: ChangePos=" << pos);
|
||||
XMoveWindow(m_display, WindowHandle, pos.x, pos.y);
|
||||
m_originX = pos.x;
|
||||
m_originY = pos.y;
|
||||
XMoveWindow(m_display, WindowHandle, pos.x(), pos.y());
|
||||
m_originX = pos.x();
|
||||
m_originY = pos.y();
|
||||
}
|
||||
|
||||
|
||||
@ -1168,7 +1168,7 @@ void guiInterface::GetAbsPos(ivec2& pos)
|
||||
int tmp;
|
||||
unsigned int tmp2;
|
||||
Window fromroot, tmpwin;
|
||||
XQueryPointer(m_display, WindowHandle, &fromroot, &tmpwin, &pos.x, &pos.y, &tmp, &tmp, &tmp2);
|
||||
XQueryPointer(m_display, WindowHandle, &fromroot, &tmpwin, &pos.m_floats[0], &pos.m_floats[1], &tmp, &tmp, &tmp2);
|
||||
}
|
||||
|
||||
#include <X11/cursorfont.h>
|
||||
@ -1300,11 +1300,11 @@ void guiInterface::GrabPointerEvents(bool isGrabbed, vec2 forcedPosition)
|
||||
}
|
||||
}
|
||||
m_forcePos = forcedPosition;
|
||||
m_forcePos.y = m_currentHeight - m_forcePos.y;
|
||||
m_forcePos.setY(m_currentHeight - m_forcePos.y());
|
||||
m_grabAllEvent = true;
|
||||
// change the pointer position to generate a good mouving at the start ...
|
||||
X11_DEBUG("X11-API: Set pointer position : " << m_forcePos);
|
||||
XWarpPointer(m_display, None, WindowHandle, 0,0, 0, 0, m_forcePos.x, m_forcePos.y);
|
||||
XWarpPointer(m_display, None, WindowHandle, 0,0, 0, 0, m_forcePos.x(), m_forcePos.y());
|
||||
XFlush(m_display);
|
||||
m_positionChangeRequested = true;
|
||||
m_curentGrabDelta = vec2(0,0);
|
||||
|
@ -153,12 +153,9 @@ bool ewol::FontFreeType::GetGlyphProperty(int32_t fontSize,
|
||||
}
|
||||
// set properties :
|
||||
property.m_glyphIndex = glyph_index;
|
||||
property.m_sizeTexture.x = slot->bitmap.width;
|
||||
property.m_sizeTexture.y = slot->bitmap.rows;
|
||||
property.m_bearing.x = slot->metrics.horiBearingX>>6;
|
||||
property.m_bearing.y = slot->metrics.horiBearingY>>6;
|
||||
property.m_advance.x = slot->metrics.horiAdvance>>6;
|
||||
property.m_advance.y = slot->metrics.vertAdvance>>6;
|
||||
property.m_sizeTexture.setValue(slot->bitmap.width, slot->bitmap.rows);
|
||||
property.m_bearing.setValue( slot->metrics.horiBearingX>>6 , slot->metrics.horiBearingY>>6 );
|
||||
property.m_advance.setValue( slot->metrics.horiAdvance>>6 , slot->metrics.vertAdvance>>6 );
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -202,7 +199,7 @@ bool ewol::FontFreeType::DrawGlyph(draw::Image& imageOut,
|
||||
draw::Color tlpppp(0xFF,0xFF,0xFF,0x00);
|
||||
for(int32_t jjj=0; jjj < slot->bitmap.rows;jjj++) {
|
||||
for(int32_t iii=0; iii < slot->bitmap.width; iii++){
|
||||
tlpppp = imageOut.Get(ivec2(glyphPosition.x+iii, glyphPosition.y+jjj));
|
||||
tlpppp = imageOut.Get(ivec2(glyphPosition.x()+iii, glyphPosition.y()+jjj));
|
||||
uint8_t valueColor = slot->bitmap.buffer[iii + slot->bitmap.width*jjj];
|
||||
// set only alpha :
|
||||
switch(posInImage)
|
||||
@ -222,7 +219,7 @@ bool ewol::FontFreeType::DrawGlyph(draw::Image& imageOut,
|
||||
break;
|
||||
}
|
||||
// real set of color
|
||||
imageOut.Set(ivec2(glyphPosition.x+iii, glyphPosition.y+jjj), tlpppp );
|
||||
imageOut.Set(ivec2(glyphPosition.x()+iii, glyphPosition.y()+jjj), tlpppp );
|
||||
}
|
||||
}
|
||||
return true;
|
||||
|
@ -26,7 +26,7 @@ ewol::TextureFile::TextureFile(etk::UString genName, etk::UString tmpfileName, i
|
||||
{
|
||||
etk::UString tmpName = tmpfileName;
|
||||
// get the upper paw2 ot the size requested...
|
||||
if (size.x>0 && size.y>0) {
|
||||
if (size.x()>0 && size.y()>0) {
|
||||
SetImageSize(size);
|
||||
}
|
||||
// load data
|
||||
|
@ -47,17 +47,17 @@ ewol::MeshObj::MeshObj(etk::UString _fileName) :
|
||||
if (inputDataLine[1]=='n') {
|
||||
// Vertice normal : vn 0.000000 0.000000 -1.000000
|
||||
vec3 vertex;
|
||||
sscanf(&inputDataLine[3], "%f %f %f", &vertex.x, &vertex.y, &vertex.z );
|
||||
sscanf(&inputDataLine[3], "%f %f %f", &vertex.m_floats[0], &vertex.m_floats[1], &vertex.m_floats[1] );
|
||||
normals.PushBack(vertex);
|
||||
} else if (inputDataLine[1]=='t') {
|
||||
// Texture position : vt 0.748573 0.750412
|
||||
vec2 vertex;
|
||||
sscanf(&inputDataLine[3], "%f %f", &vertex.x, &vertex.y);
|
||||
sscanf(&inputDataLine[3], "%f %f", &vertex.m_floats[0], &vertex.m_floats[1]);
|
||||
uvTextures.PushBack(vertex);
|
||||
} else {
|
||||
// Vertice position : v 1.000000 -1.000000 -1.000000
|
||||
vec3 vertex;
|
||||
sscanf(&inputDataLine[2], "%f %f %f", &vertex.x, &vertex.y, &vertex.z );
|
||||
sscanf(&inputDataLine[2], "%f %f %f", &vertex.m_floats[0], &vertex.m_floats[1], &vertex.m_floats[1] );
|
||||
vertices.PushBack(vertex);
|
||||
}
|
||||
} else if (inputDataLine[0]=='f') {
|
||||
@ -183,12 +183,12 @@ ewol::MeshObj::MeshObj(etk::UString _fileName) :
|
||||
|
||||
// Put the attributes in buffers
|
||||
m_vertices.PushBack(vertices[vertexIndex-1]);
|
||||
m_verticesVBO->GetRefBuffer(0).PushBack(vertices[vertexIndex-1].x);
|
||||
m_verticesVBO->GetRefBuffer(0).PushBack(vertices[vertexIndex-1].y);
|
||||
m_verticesVBO->GetRefBuffer(0).PushBack(vertices[vertexIndex-1].z);
|
||||
m_verticesVBO->GetRefBuffer(0).PushBack(vertices[vertexIndex-1].x());
|
||||
m_verticesVBO->GetRefBuffer(0).PushBack(vertices[vertexIndex-1].y());
|
||||
m_verticesVBO->GetRefBuffer(0).PushBack(vertices[vertexIndex-1].z());
|
||||
m_uvTextures.PushBack(uvTextures[uvIndex-1]);
|
||||
m_verticesVBO->GetRefBuffer(1).PushBack(uvTextures[uvIndex-1].x);
|
||||
m_verticesVBO->GetRefBuffer(1).PushBack(uvTextures[uvIndex-1].y);
|
||||
m_verticesVBO->GetRefBuffer(1).PushBack(uvTextures[uvIndex-1].x());
|
||||
m_verticesVBO->GetRefBuffer(1).PushBack(uvTextures[uvIndex-1].y());
|
||||
draw::Color tmpppp(0xFFFFFFFF);
|
||||
draw::Colorf tmppppp(tmpppp);
|
||||
m_coordColor.PushBack(tmppppp);
|
||||
@ -200,9 +200,9 @@ ewol::MeshObj::MeshObj(etk::UString _fileName) :
|
||||
if (indicesNormal.Size()>iii) {
|
||||
uint32_t normalIndex = indicesNormal[iii];
|
||||
m_normals.PushBack(normals[normalIndex-1]);
|
||||
m_verticesVBO->GetRefBuffer(3).PushBack(normals[normalIndex-1].x);
|
||||
m_verticesVBO->GetRefBuffer(3).PushBack(normals[normalIndex-1].y);
|
||||
m_verticesVBO->GetRefBuffer(3).PushBack(normals[normalIndex-1].z);
|
||||
m_verticesVBO->GetRefBuffer(3).PushBack(normals[normalIndex-1].x());
|
||||
m_verticesVBO->GetRefBuffer(3).PushBack(normals[normalIndex-1].y());
|
||||
m_verticesVBO->GetRefBuffer(3).PushBack(normals[normalIndex-1].z());
|
||||
}
|
||||
}
|
||||
// update all the VBO elements ...
|
||||
|
@ -42,8 +42,7 @@ ewol::Texture::Texture(etk::UString tmpName) :
|
||||
{
|
||||
m_loaded = false;
|
||||
m_texId = 0;
|
||||
m_endPointSize.x = 1.0;
|
||||
m_endPointSize.y = 1.0;
|
||||
m_endPointSize.setValue(1.0,1.0);
|
||||
}
|
||||
|
||||
|
||||
@ -113,8 +112,7 @@ void ewol::Texture::Flush(void)
|
||||
|
||||
void ewol::Texture::SetImageSize(ivec2 newSize)
|
||||
{
|
||||
newSize.x = nextP2(newSize.x);
|
||||
newSize.y = nextP2(newSize.y);
|
||||
newSize.setValue( nextP2(newSize.x()), nextP2(newSize.y()) );
|
||||
m_data.Resize(newSize);
|
||||
}
|
||||
|
||||
|
@ -57,14 +57,10 @@ ewol::TexturedFont::TexturedFont(etk::UString fontName) :
|
||||
m_modeWraping[2] = ewol::font::Regular;
|
||||
m_modeWraping[3] = ewol::font::Regular;
|
||||
|
||||
m_lastGlyphPos[0].x = 0;
|
||||
m_lastGlyphPos[0].y = 0;
|
||||
m_lastGlyphPos[1].x = 0;
|
||||
m_lastGlyphPos[1].y = 0;
|
||||
m_lastGlyphPos[2].x = 0;
|
||||
m_lastGlyphPos[2].y = 0;
|
||||
m_lastGlyphPos[3].x = 0;
|
||||
m_lastGlyphPos[3].y = 0;
|
||||
m_lastGlyphPos[0].setValue(0,0);
|
||||
m_lastGlyphPos[1].setValue(0,0);
|
||||
m_lastGlyphPos[2].setValue(0,0);
|
||||
m_lastGlyphPos[3].setValue(0,0);
|
||||
|
||||
m_lastRawHeigh[0] = 0;
|
||||
m_lastRawHeigh[1] = 0;
|
||||
@ -192,8 +188,8 @@ ewol::TexturedFont::TexturedFont(etk::UString fontName) :
|
||||
int32_t nbElement = 0xFF - 0x20 + 1;
|
||||
int32_t coter = simpleSQRT(nbElement);
|
||||
// note : +1 is for the overlapping of the glyph (Part 1)
|
||||
int32_t glyphMaxWidth = tmpproperty.m_advance.x +1;
|
||||
int32_t glyphMaxHeight = tmpproperty.m_advance.y +1;
|
||||
int32_t glyphMaxWidth = tmpproperty.m_advance.x() +1;
|
||||
int32_t glyphMaxHeight = tmpproperty.m_advance.y() +1;
|
||||
int32_t textureWidth = nextP2(coter*glyphMaxWidth);
|
||||
int32_t nbRaws = textureWidth / glyphMaxWidth;
|
||||
if (nbRaws <= 0) {
|
||||
@ -221,27 +217,27 @@ ewol::TexturedFont::TexturedFont(etk::UString fontName) :
|
||||
for (int32_t iii=0; iii<m_listElement[iiiFontId].Size(); iii++) {
|
||||
if (true == m_font[iiiFontId]->GetGlyphProperty(m_size, (m_listElement[iiiFontId])[iii])) {
|
||||
// change line if needed ...
|
||||
if (glyphPosition.x+(m_listElement[iiiFontId])[iii].m_sizeTexture.x > textureWidth) {
|
||||
glyphPosition.x = 0;
|
||||
glyphPosition.y += CurrentLineHigh;
|
||||
if (glyphPosition.x()+(m_listElement[iiiFontId])[iii].m_sizeTexture.x() > textureWidth) {
|
||||
glyphPosition.setX(0);
|
||||
glyphPosition.setY(glyphPosition.y()+CurrentLineHigh);
|
||||
CurrentLineHigh = 0;
|
||||
}
|
||||
// draw the glyph
|
||||
m_font[iiiFontId]->DrawGlyph(m_data, m_size, glyphPosition, (m_listElement[iiiFontId])[iii], iiiFontId);
|
||||
// set video position
|
||||
(m_listElement[iiiFontId])[iii].m_texturePosStart.x = (float)(glyphPosition.x) / (float)textureWidth;
|
||||
(m_listElement[iiiFontId])[iii].m_texturePosStart.y = (float)(glyphPosition.y) / (float)textureHeight;
|
||||
(m_listElement[iiiFontId])[iii].m_texturePosStop.x = (float)(glyphPosition.x + (m_listElement[iiiFontId])[iii].m_sizeTexture.x) / (float)textureWidth;
|
||||
(m_listElement[iiiFontId])[iii].m_texturePosStop.y = (float)(glyphPosition.y + (m_listElement[iiiFontId])[iii].m_sizeTexture.y) / (float)textureHeight;
|
||||
(m_listElement[iiiFontId])[iii].m_texturePosStart.setValue( (float)(glyphPosition.x()) / (float)textureWidth,
|
||||
(float)(glyphPosition.y()) / (float)textureHeight );
|
||||
(m_listElement[iiiFontId])[iii].m_texturePosStop.setValue( (float)(glyphPosition.x() + (m_listElement[iiiFontId])[iii].m_sizeTexture.x()) / (float)textureWidth,
|
||||
(float)(glyphPosition.y() + (m_listElement[iiiFontId])[iii].m_sizeTexture.y()) / (float)textureHeight );
|
||||
|
||||
// update the maximum of the line hight :
|
||||
if (CurrentLineHigh<(m_listElement[iiiFontId])[iii].m_sizeTexture.y) {
|
||||
if (CurrentLineHigh<(m_listElement[iiiFontId])[iii].m_sizeTexture.y()) {
|
||||
// note : +1 is for the overlapping of the glyph (Part 2)
|
||||
CurrentLineHigh = (m_listElement[iiiFontId])[iii].m_sizeTexture.y+1;
|
||||
CurrentLineHigh = (m_listElement[iiiFontId])[iii].m_sizeTexture.y()+1;
|
||||
}
|
||||
// note : +1 is for the overlapping of the glyph (Part 3)
|
||||
// update the Bitmap position drawing :
|
||||
glyphPosition.x += (m_listElement[iiiFontId])[iii].m_sizeTexture.x+1;
|
||||
glyphPosition.setX(glyphPosition.x() + (m_listElement[iiiFontId])[iii].m_sizeTexture.x()+1);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -84,21 +84,21 @@ bool widget::Button::CalculateMinSize(void)
|
||||
{
|
||||
vec2 padding = m_shaper.GetPadding();
|
||||
m_displayText.Clear();
|
||||
ivec3 minSize = m_displayText.CalculateSizeDecorated(m_label);
|
||||
vec3 minSize = m_displayText.CalculateSizeDecorated(m_label);
|
||||
if( true == m_toggleMode
|
||||
&& m_labelToggle.Size()!=0) {
|
||||
m_displayText.Clear();
|
||||
ivec3 minSizeToggle = m_displayText.CalculateSizeDecorated(m_labelToggle);
|
||||
minSize.x = etk_max(minSize.x, minSizeToggle.x);
|
||||
minSize.y = etk_max(minSize.y, minSizeToggle.y);
|
||||
minSize.z = etk_max(minSize.z, minSizeToggle.z);
|
||||
vec3 minSizeToggle = m_displayText.CalculateSizeDecorated(m_labelToggle);
|
||||
minSize.setValue(etk_max(minSize.x(), minSizeToggle.x()),
|
||||
etk_max(minSize.y(), minSizeToggle.y()),
|
||||
etk_max(minSize.z(), minSizeToggle.z()));
|
||||
}
|
||||
m_minSize.x = padding.x*2 + minSize.x;
|
||||
m_minSize.y = padding.y*2 + minSize.y;
|
||||
m_minSize.setX(padding.x()*2 + minSize.x());
|
||||
m_minSize.setY(padding.y()*2 + minSize.y());
|
||||
// Add the image element ...
|
||||
if( true == m_displayImage.HasSources()
|
||||
|| true == m_displayImageToggle.HasSources()) {
|
||||
m_minSize.x += padding.x/2 + m_imageDisplaySize;
|
||||
m_minSize.setX(m_minSize.x()+ padding.x()/2 + m_imageDisplaySize);
|
||||
}
|
||||
MarkToRedraw();
|
||||
return true;
|
||||
@ -172,8 +172,8 @@ void widget::Button::OnRegenerateDisplay(void)
|
||||
|
||||
vec2 padding = m_shaper.GetPadding();
|
||||
// to know the size of one Line :
|
||||
ivec3 minSize = m_displayText.CalculateSize('A');
|
||||
ivec3 curentTextSize;
|
||||
vec3 minSize = m_displayText.CalculateSize('A');
|
||||
vec3 curentTextSize;
|
||||
if( false == m_toggleMode
|
||||
|| false == m_value
|
||||
|| m_labelToggle.Size()==0) {
|
||||
@ -189,39 +189,36 @@ void widget::Button::OnRegenerateDisplay(void)
|
||||
|
||||
ivec2 localSize = m_minSize;
|
||||
|
||||
vec3 tmpOrigin((m_size.x - m_minSize.x) / 2.0,
|
||||
(m_size.y - m_minSize.y) / 2.0,
|
||||
vec3 tmpOrigin((m_size.x() - m_minSize.x()) / 2.0,
|
||||
(m_size.y() - m_minSize.y()) / 2.0,
|
||||
0);
|
||||
// no change for the text orogin :
|
||||
vec3 tmpTextOrigin((m_size.x - m_minSize.x) / 2.0,
|
||||
(m_size.y - m_minSize.y) / 2.0,
|
||||
vec3 tmpTextOrigin((m_size.x() - m_minSize.x()) / 2.0,
|
||||
(m_size.y() - m_minSize.y()) / 2.0,
|
||||
0);
|
||||
|
||||
if (true==m_userFill.x) {
|
||||
localSize.x = m_size.x;
|
||||
tmpOrigin.x = 0;
|
||||
tmpTextOrigin.x = 0;
|
||||
if (true==m_userFill.x()) {
|
||||
localSize.setX(m_size.x());
|
||||
tmpOrigin.setX(0);
|
||||
tmpTextOrigin.setX(0);
|
||||
}
|
||||
if (true==m_userFill.y) {
|
||||
localSize.y = m_size.y;
|
||||
if (true==m_userFill.y()) {
|
||||
localSize.setY(m_size.y());
|
||||
}
|
||||
tmpOrigin.x += padding.x;
|
||||
tmpOrigin.y += padding.y;
|
||||
tmpTextOrigin.x += padding.x;
|
||||
tmpTextOrigin.y += padding.y;
|
||||
localSize.x -= 2*padding.x;
|
||||
localSize.y -= 2*padding.y;
|
||||
tmpOrigin += vec3(padding.x(),padding.y(),0);
|
||||
tmpTextOrigin += vec3(padding.x(), padding.y(), 0);
|
||||
localSize -= ivec2(2*padding.x(), 2*padding.y());
|
||||
|
||||
tmpTextOrigin.y += (m_minSize.y-2*padding.y) - minSize.y;
|
||||
tmpTextOrigin.setY(tmpTextOrigin.x()+ (m_minSize.y()-2*padding.y()) - minSize.y());
|
||||
|
||||
vec2 textPos(tmpTextOrigin.x, tmpTextOrigin.y);
|
||||
vec2 textPos(tmpTextOrigin.x(), tmpTextOrigin.y());
|
||||
|
||||
if( true == m_displayImage.HasSources()
|
||||
|| true == m_displayImageToggle.HasSources()) {
|
||||
ivec3 imagePos(tmpOrigin.x-padding.x/4,
|
||||
tmpOrigin.y-padding.x/4+(m_minSize.y-m_imageDisplaySize-2*padding.y)/2.0,
|
||||
vec3 imagePos(tmpOrigin.x()-padding.x()/4,
|
||||
tmpOrigin.y()-padding.x()/4+(m_minSize.y()-m_imageDisplaySize-2*padding.y())/2.0,
|
||||
0);
|
||||
ivec2 imageSize(m_imageDisplaySize,
|
||||
vec2 imageSize(m_imageDisplaySize,
|
||||
m_imageDisplaySize);
|
||||
if( false==m_toggleMode
|
||||
|| false==m_value) {
|
||||
@ -234,12 +231,12 @@ void widget::Button::OnRegenerateDisplay(void)
|
||||
m_displayImageToggle.Print(imageSize);
|
||||
}
|
||||
// update the text position ...
|
||||
tmpTextOrigin.x += padding.x/2 + m_imageDisplaySize;
|
||||
tmpTextOrigin.setX(tmpTextOrigin.x() + padding.x()/2 + m_imageDisplaySize);
|
||||
}
|
||||
|
||||
vec3 drawClippingPos(padding.x, padding.y, -0.5);
|
||||
vec3 drawClippingSize((m_size.x - padding.x),
|
||||
(m_size.y - padding.y),
|
||||
vec3 drawClippingPos(padding.x(), padding.y(), -0.5);
|
||||
vec3 drawClippingSize((m_size.x() - padding.x()),
|
||||
(m_size.y() - padding.y()),
|
||||
1);
|
||||
|
||||
// clean the element
|
||||
@ -247,9 +244,9 @@ void widget::Button::OnRegenerateDisplay(void)
|
||||
m_displayText.SetPos(tmpTextOrigin);
|
||||
if( true == m_displayImage.HasSources()
|
||||
|| true == m_displayImageToggle.HasSources()) {
|
||||
m_displayText.SetTextAlignement(tmpTextOrigin.x, tmpTextOrigin.x+localSize.x-m_imageDisplaySize, ewol::Text::alignCenter);
|
||||
m_displayText.SetTextAlignement(tmpTextOrigin.x(), tmpTextOrigin.x()+localSize.x()-m_imageDisplaySize, ewol::Text::alignCenter);
|
||||
} else {
|
||||
m_displayText.SetTextAlignement(tmpTextOrigin.x, tmpTextOrigin.x+localSize.x, ewol::Text::alignCenter);
|
||||
m_displayText.SetTextAlignement(tmpTextOrigin.x(), tmpTextOrigin.x()+localSize.x(), ewol::Text::alignCenter);
|
||||
}
|
||||
m_displayText.SetClipping(drawClippingPos, drawClippingSize);
|
||||
if( false == m_toggleMode
|
||||
@ -262,18 +259,18 @@ void widget::Button::OnRegenerateDisplay(void)
|
||||
//m_displayText.Translate(tmpOrigin);
|
||||
|
||||
|
||||
if (true==m_userFill.y) {
|
||||
tmpOrigin.y = padding.y;
|
||||
if (true==m_userFill.y()) {
|
||||
tmpOrigin.setY(padding.y());
|
||||
}
|
||||
|
||||
// selection area :
|
||||
m_selectableAreaPos = vec2(tmpOrigin.x-padding.x, tmpOrigin.y-padding.y);
|
||||
m_selectableAreaPos = vec2(tmpOrigin.x()-padding.x(), tmpOrigin.y()-padding.y());
|
||||
m_selectableAreaSize = localSize + vec2(2,2)*padding;
|
||||
m_shaper.SetOrigin(m_selectableAreaPos );
|
||||
m_shaper.SetSize(m_selectableAreaSize);
|
||||
m_shaper.SetInsidePos(vec2(tmpTextOrigin.x, tmpTextOrigin.y) );
|
||||
m_shaper.SetInsidePos(vec2(tmpTextOrigin.x(), tmpTextOrigin.y()) );
|
||||
vec3 tmpp = m_displayText.CalculateSize(m_label);
|
||||
vec2 tmpp2(tmpp.x, tmpp.y);
|
||||
vec2 tmpp2(tmpp.x(), tmpp.y());
|
||||
m_shaper.SetInsideSize(tmpp2);
|
||||
|
||||
}
|
||||
@ -289,10 +286,10 @@ bool widget::Button::OnEventInput(ewol::keyEvent::type_te type, int32_t IdInput,
|
||||
} else {
|
||||
vec2 relativePos = RelativePosition(pos);
|
||||
// prevent error from ouside the button
|
||||
if( relativePos.x < m_selectableAreaPos.x
|
||||
|| relativePos.y < m_selectableAreaPos.y
|
||||
|| relativePos.x > m_selectableAreaPos.x + m_selectableAreaSize.x
|
||||
|| relativePos.y > m_selectableAreaPos.y + m_selectableAreaSize.y ) {
|
||||
if( relativePos.x() < m_selectableAreaPos.x()
|
||||
|| relativePos.y() < m_selectableAreaPos.y()
|
||||
|| relativePos.x() > m_selectableAreaPos.x() + m_selectableAreaSize.x()
|
||||
|| relativePos.y() > m_selectableAreaPos.y() + m_selectableAreaSize.y() ) {
|
||||
m_mouseHover = false;
|
||||
m_buttonPressed = false;
|
||||
} else {
|
||||
|
@ -57,9 +57,9 @@ bool widget::ButtonColor::CalculateMinSize(void)
|
||||
{
|
||||
vec2 padding = m_shaper.GetPadding();
|
||||
etk::UString label = draw::GetString(m_textColorFg);
|
||||
ivec3 minSize = m_text.CalculateSize(label);
|
||||
m_minSize.x = padding.x*2 + minSize.x + 7;
|
||||
m_minSize.y = padding.y*2 + minSize.y;
|
||||
vec3 minSize = m_text.CalculateSize(label);
|
||||
m_minSize.setX(padding.x()*2 + minSize.x() + 7);
|
||||
m_minSize.setY(padding.y()*2 + minSize.y() );
|
||||
MarkToRedraw();
|
||||
return true;
|
||||
}
|
||||
@ -85,28 +85,25 @@ void widget::ButtonColor::OnRegenerateDisplay(void)
|
||||
|
||||
ivec2 localSize = m_minSize;
|
||||
|
||||
vec3 tmpOrigin((m_size.x - m_minSize.x) / 2.0,
|
||||
(m_size.y - m_minSize.y) / 2.0,
|
||||
vec3 tmpOrigin((m_size.x() - m_minSize.x()) / 2.0,
|
||||
(m_size.y() - m_minSize.y()) / 2.0,
|
||||
0);
|
||||
// no change for the text orogin :
|
||||
vec3 tmpTextOrigin((m_size.x - m_minSize.x) / 2.0,
|
||||
(m_size.y - m_minSize.y) / 2.0,
|
||||
vec3 tmpTextOrigin((m_size.x() - m_minSize.x()) / 2.0,
|
||||
(m_size.y() - m_minSize.y()) / 2.0,
|
||||
0);
|
||||
|
||||
if (true==m_userFill.x) {
|
||||
localSize.x = m_size.x;
|
||||
tmpOrigin.x = 0;
|
||||
tmpTextOrigin.x = 0;
|
||||
if (true==m_userFill.x()) {
|
||||
localSize.setX(m_size.x());
|
||||
tmpOrigin.setX(0);
|
||||
tmpTextOrigin.setX(0);
|
||||
}
|
||||
if (true==m_userFill.y) {
|
||||
localSize.y = m_size.y;
|
||||
if (true==m_userFill.y()) {
|
||||
localSize.setY(m_size.y());
|
||||
}
|
||||
tmpOrigin.x += padding.x;
|
||||
tmpOrigin.y += padding.y;
|
||||
tmpTextOrigin.x += padding.x;
|
||||
tmpTextOrigin.y += padding.y;
|
||||
localSize.x -= 2*padding.x;
|
||||
localSize.y -= 2*padding.y;
|
||||
tmpOrigin += vec3(padding.x(), padding.y(), 0);
|
||||
tmpTextOrigin += vec3(padding.x(), padding.y(), 0);
|
||||
localSize -= ivec2(2*padding.x(), 2*padding.y());
|
||||
|
||||
// clean the element
|
||||
m_text.Reset();
|
||||
@ -119,22 +116,22 @@ void widget::ButtonColor::OnRegenerateDisplay(void)
|
||||
}
|
||||
m_text.SetPos(tmpTextOrigin);
|
||||
m_text.SetColorBg(m_textColorFg);
|
||||
m_text.SetTextAlignement(tmpTextOrigin.x, tmpTextOrigin.x+localSize.x, ewol::Text::alignCenter);
|
||||
m_text.SetTextAlignement(tmpTextOrigin.x(), tmpTextOrigin.x()+localSize.x(), ewol::Text::alignCenter);
|
||||
m_text.Print(label);
|
||||
|
||||
|
||||
if (true==m_userFill.y) {
|
||||
tmpOrigin.y = padding.y;
|
||||
if (true==m_userFill.y()) {
|
||||
tmpOrigin.setY(padding.y());
|
||||
}
|
||||
|
||||
// selection area :
|
||||
m_selectableAreaPos = vec2(tmpOrigin.x-padding.x, tmpOrigin.y-padding.y);
|
||||
m_selectableAreaPos = vec2(tmpOrigin.x()-padding.x(), tmpOrigin.y()-padding.y());
|
||||
m_selectableAreaSize = localSize + vec2(2,2)*padding;
|
||||
m_shaper.SetOrigin(m_selectableAreaPos );
|
||||
m_shaper.SetSize(m_selectableAreaSize);
|
||||
m_shaper.SetInsidePos(vec2(tmpTextOrigin.x, tmpTextOrigin.y) );
|
||||
m_shaper.SetInsidePos(vec2(tmpTextOrigin.x(), tmpTextOrigin.y()) );
|
||||
vec3 tmpp = m_text.CalculateSize(label);
|
||||
vec2 tmpp2(tmpp.x, tmpp.y);
|
||||
vec2 tmpp2(tmpp.x(), tmpp.y());
|
||||
m_shaper.SetInsideSize(tmpp2);
|
||||
}
|
||||
}
|
||||
@ -149,10 +146,10 @@ bool widget::ButtonColor::OnEventInput(ewol::keyEvent::type_te type, int32_t IdI
|
||||
} else {
|
||||
vec2 relativePos = RelativePosition(pos);
|
||||
// prevent error from ouside the button
|
||||
if( relativePos.x < m_selectableAreaPos.x
|
||||
|| relativePos.y < m_selectableAreaPos.y
|
||||
|| relativePos.x > m_selectableAreaPos.x + m_selectableAreaSize.x
|
||||
|| relativePos.y > m_selectableAreaPos.y + m_selectableAreaSize.y ) {
|
||||
if( relativePos.x() < m_selectableAreaPos.x()
|
||||
|| relativePos.y() < m_selectableAreaPos.y()
|
||||
|| relativePos.x() > m_selectableAreaPos.x() + m_selectableAreaSize.x()
|
||||
|| relativePos.y() > m_selectableAreaPos.y() + m_selectableAreaSize.y() ) {
|
||||
m_mouseHover = false;
|
||||
m_buttonPressed = false;
|
||||
} else {
|
||||
@ -181,7 +178,7 @@ bool widget::ButtonColor::OnEventInput(ewol::keyEvent::type_te type, int32_t IdI
|
||||
return true;
|
||||
}
|
||||
vec2 tmpPos = m_origin + m_selectableAreaPos + m_selectableAreaSize;
|
||||
tmpPos.x -= m_minSize.x/2.0;
|
||||
tmpPos.setX( tmpPos.x() - m_minSize.x()/2.0);
|
||||
m_widgetContextMenu->SetPositionMark(widget::CONTEXT_MENU_MARK_BOTTOM, tmpPos );
|
||||
|
||||
widget::ColorChooser * myColorChooser = new widget::ColorChooser();
|
||||
|
@ -47,10 +47,10 @@ widget::CheckBox::~CheckBox(void)
|
||||
|
||||
bool widget::CheckBox::CalculateMinSize(void)
|
||||
{
|
||||
ivec3 minSize = m_oObjectText.CalculateSize(m_label);
|
||||
float boxSize = etk_max(20, minSize.y) + 5;
|
||||
m_minSize.x = boxSize+minSize.x;
|
||||
m_minSize.y = etk_max(boxSize, minSize.y)+3;
|
||||
vec3 minSize = m_oObjectText.CalculateSize(m_label);
|
||||
float boxSize = etk_max(20, minSize.y()) + 5;
|
||||
m_minSize.setX(boxSize+minSize.x());
|
||||
m_minSize.setY(etk_max(boxSize, minSize.y())+3);
|
||||
MarkToRedraw();
|
||||
return true;
|
||||
}
|
||||
@ -89,17 +89,14 @@ void widget::CheckBox::OnRegenerateDisplay(void)
|
||||
m_oObjectDecoration.Clear();
|
||||
m_oObjectText.Clear();
|
||||
|
||||
ivec3 minSize = m_oObjectText.CalculateSize(m_label);
|
||||
float boxSize = etk_max(20, minSize.y) + 5;
|
||||
vec3 minSize = m_oObjectText.CalculateSize(m_label);
|
||||
float boxSize = etk_max(20, minSize.y()) + 5;
|
||||
//int32_t fontWidth = ewol::GetWidth(fontId, m_label.c_str());
|
||||
int32_t posy = (m_size.y - minSize.y - 6)/2 + 3;
|
||||
int32_t posy = (m_size.y() - minSize.y() - 6)/2 + 3;
|
||||
//int32_t posx = (m_size.x - fontWidth - 6)/2 + 25;
|
||||
|
||||
|
||||
vec3 textPos;
|
||||
textPos.x = boxSize+5;
|
||||
textPos.y = posy;
|
||||
textPos.z = 0;
|
||||
vec3 textPos(boxSize+5, posy, 0);
|
||||
m_oObjectText.SetPos(textPos);
|
||||
m_oObjectText.Print(m_label);
|
||||
|
||||
|
@ -23,8 +23,7 @@ extern const char * const ewolEventColorBarChange = "ewol-color-bar-change";
|
||||
widget::ColorBar::ColorBar(void)
|
||||
{
|
||||
AddEventId(ewolEventColorBarChange);
|
||||
m_currentUserPos.x=0;
|
||||
m_currentUserPos.y=0;
|
||||
m_currentUserPos.setValue(0,0);
|
||||
m_currentColor = draw::color::black;
|
||||
SetCanHaveFocus(true);
|
||||
SetMouseLimit(1);
|
||||
@ -38,8 +37,7 @@ widget::ColorBar::~ColorBar(void)
|
||||
|
||||
bool widget::ColorBar::CalculateMinSize(void)
|
||||
{
|
||||
m_minSize.x = 160;
|
||||
m_minSize.y = 80;
|
||||
m_minSize.setValue(160, 80);
|
||||
MarkToRedraw();
|
||||
return true;
|
||||
}
|
||||
@ -80,17 +78,17 @@ void widget::ColorBar::OnRegenerateDisplay(void)
|
||||
// clean the object list ...
|
||||
m_draw.Clear();
|
||||
|
||||
int32_t tmpSizeX = m_minSize.x;
|
||||
int32_t tmpSizeY = m_minSize.y;
|
||||
int32_t tmpOriginX = (m_size.x - m_minSize.x) / 2;
|
||||
int32_t tmpOriginY = (m_size.y - m_minSize.y) / 2;
|
||||
int32_t tmpSizeX = m_minSize.x();
|
||||
int32_t tmpSizeY = m_minSize.y();
|
||||
int32_t tmpOriginX = (m_size.x() - m_minSize.x()) / 2;
|
||||
int32_t tmpOriginY = (m_size.y() - m_minSize.y()) / 2;
|
||||
|
||||
if (true==m_userFill.x) {
|
||||
tmpSizeX = m_size.x;
|
||||
if (true==m_userFill.x()) {
|
||||
tmpSizeX = m_size.x();
|
||||
tmpOriginX = 0;
|
||||
}
|
||||
if (true==m_userFill.y) {
|
||||
tmpSizeY = m_size.y;
|
||||
if (true==m_userFill.y()) {
|
||||
tmpSizeY = m_size.y();
|
||||
tmpOriginY = 0;
|
||||
}
|
||||
|
||||
@ -103,13 +101,13 @@ void widget::ColorBar::OnRegenerateDisplay(void)
|
||||
* ********
|
||||
*/
|
||||
m_draw.SetColor(s_listColorWhite);
|
||||
m_draw.SetPos(vec3(tmpOriginX + (iii)*(tmpSizeX/NB_BAND_COLOR), tmpOriginY) );
|
||||
m_draw.SetPos(vec3(tmpOriginX + (iii)*(tmpSizeX/NB_BAND_COLOR), tmpOriginY, 0) );
|
||||
m_draw.AddVertex();
|
||||
m_draw.SetColor(s_listColor[iii+1]);
|
||||
m_draw.SetPos(vec3(tmpOriginX + (iii+1)*(tmpSizeX/NB_BAND_COLOR), tmpOriginY+tmpSizeY/2) );
|
||||
m_draw.SetPos(vec3(tmpOriginX + (iii+1)*(tmpSizeX/NB_BAND_COLOR), tmpOriginY+tmpSizeY/2, 0) );
|
||||
m_draw.AddVertex();
|
||||
m_draw.SetColor(s_listColor[iii]);
|
||||
m_draw.SetPos(vec3(tmpOriginX + iii*(tmpSizeX/NB_BAND_COLOR), tmpOriginY+tmpSizeY/2) );
|
||||
m_draw.SetPos(vec3(tmpOriginX + iii*(tmpSizeX/NB_BAND_COLOR), tmpOriginY+tmpSizeY/2, 0) );
|
||||
m_draw.AddVertex();
|
||||
/* Step 2 :
|
||||
* ********
|
||||
@ -119,13 +117,13 @@ void widget::ColorBar::OnRegenerateDisplay(void)
|
||||
*
|
||||
*/
|
||||
m_draw.SetColor(s_listColorWhite);
|
||||
m_draw.SetPos(vec3(tmpOriginX + iii*(tmpSizeX/NB_BAND_COLOR), tmpOriginY) );
|
||||
m_draw.SetPos(vec3(tmpOriginX + iii*(tmpSizeX/NB_BAND_COLOR), tmpOriginY, 0) );
|
||||
m_draw.AddVertex();
|
||||
m_draw.SetColor(s_listColorWhite);
|
||||
m_draw.SetPos(vec3(tmpOriginX + (iii+1)*(tmpSizeX/NB_BAND_COLOR), tmpOriginY) );
|
||||
m_draw.SetPos(vec3(tmpOriginX + (iii+1)*(tmpSizeX/NB_BAND_COLOR), tmpOriginY, 0) );
|
||||
m_draw.AddVertex();
|
||||
m_draw.SetColor(s_listColor[iii+1]);
|
||||
m_draw.SetPos(vec3(tmpOriginX + (iii+1)*(tmpSizeX/NB_BAND_COLOR), tmpOriginY+tmpSizeY/2) );
|
||||
m_draw.SetPos(vec3(tmpOriginX + (iii+1)*(tmpSizeX/NB_BAND_COLOR), tmpOriginY+tmpSizeY/2, 0) );
|
||||
m_draw.AddVertex();
|
||||
/* Step 3 :
|
||||
*
|
||||
@ -135,13 +133,13 @@ void widget::ColorBar::OnRegenerateDisplay(void)
|
||||
* ********
|
||||
*/
|
||||
m_draw.SetColor(s_listColor[iii]);
|
||||
m_draw.SetPos(vec3(tmpOriginX + iii*(tmpSizeX/NB_BAND_COLOR), tmpOriginY+tmpSizeY/2));
|
||||
m_draw.SetPos(vec3(tmpOriginX + iii*(tmpSizeX/NB_BAND_COLOR), tmpOriginY+tmpSizeY/2, 0));
|
||||
m_draw.AddVertex();
|
||||
m_draw.SetColor(s_listColorBlack);
|
||||
m_draw.SetPos(vec3(tmpOriginX + (iii+1)*(tmpSizeX/NB_BAND_COLOR), tmpOriginY+tmpSizeY));
|
||||
m_draw.SetPos(vec3(tmpOriginX + (iii+1)*(tmpSizeX/NB_BAND_COLOR), tmpOriginY+tmpSizeY, 0));
|
||||
m_draw.AddVertex();
|
||||
m_draw.SetColor(s_listColorBlack);
|
||||
m_draw.SetPos(vec3(tmpOriginX + iii*(tmpSizeX/NB_BAND_COLOR), tmpOriginY+tmpSizeY));
|
||||
m_draw.SetPos(vec3(tmpOriginX + iii*(tmpSizeX/NB_BAND_COLOR), tmpOriginY+tmpSizeY, 0));
|
||||
m_draw.AddVertex();
|
||||
/* Step 4 :
|
||||
* ********
|
||||
@ -151,21 +149,21 @@ void widget::ColorBar::OnRegenerateDisplay(void)
|
||||
*
|
||||
*/
|
||||
m_draw.SetColor(s_listColor[iii]);
|
||||
m_draw.SetPos(vec3(tmpOriginX + iii*(tmpSizeX/NB_BAND_COLOR), tmpOriginY+tmpSizeY/2));
|
||||
m_draw.SetPos(vec3(tmpOriginX + iii*(tmpSizeX/NB_BAND_COLOR), tmpOriginY+tmpSizeY/2, 0));
|
||||
m_draw.AddVertex();
|
||||
m_draw.SetColor(s_listColor[iii+1]);
|
||||
m_draw.SetPos(vec3(tmpOriginX + (iii+1)*(tmpSizeX/NB_BAND_COLOR), tmpOriginY+tmpSizeY/2));
|
||||
m_draw.SetPos(vec3(tmpOriginX + (iii+1)*(tmpSizeX/NB_BAND_COLOR), tmpOriginY+tmpSizeY/2, 0));
|
||||
m_draw.AddVertex();
|
||||
m_draw.SetColor(s_listColorBlack);
|
||||
m_draw.SetPos(vec3(tmpOriginX + (iii+1)*(tmpSizeX/NB_BAND_COLOR), tmpOriginY+tmpSizeY));
|
||||
m_draw.SetPos(vec3(tmpOriginX + (iii+1)*(tmpSizeX/NB_BAND_COLOR), tmpOriginY+tmpSizeY, 0));
|
||||
m_draw.AddVertex();
|
||||
}
|
||||
if (m_currentUserPos.y > 0.5) {
|
||||
if (m_currentUserPos.y() > 0.5) {
|
||||
m_draw.SetColor(draw::color::white);
|
||||
} else {
|
||||
m_draw.SetColor(draw::color::black);
|
||||
}
|
||||
m_draw.SetPos(vec3(m_currentUserPos.x*m_size.x, m_currentUserPos.y*m_size.y) );
|
||||
m_draw.SetPos(vec3(m_currentUserPos.x()*m_size.x(), m_currentUserPos.y()*m_size.y(), 0) );
|
||||
m_draw.SetThickness(1);
|
||||
m_draw.Circle(3.0);
|
||||
|
||||
@ -178,19 +176,19 @@ bool widget::ColorBar::OnEventInput(ewol::keyEvent::type_te type, int32_t IdInpu
|
||||
vec2 relativePos = RelativePosition(pos);
|
||||
//EWOL_DEBUG("Event on BT ...");
|
||||
if (1 == IdInput) {
|
||||
relativePos.x = etk_max(etk_min(relativePos.x, m_size.x),0);
|
||||
relativePos.y = etk_max(etk_min(relativePos.y, m_size.y),0);
|
||||
relativePos.setValue( etk_max(etk_min(relativePos.x(), m_size.x()),0),
|
||||
etk_max(etk_min(relativePos.y(), m_size.y()),0));
|
||||
if( ewol::keyEvent::statusSingle == typeEvent
|
||||
|| ewol::keyEvent::statusMove == typeEvent) {
|
||||
// nothing to do ...
|
||||
m_currentUserPos.x=relativePos.x/m_size.x;
|
||||
m_currentUserPos.y=relativePos.y/m_size.y;
|
||||
m_currentUserPos.setValue( relativePos.x()/m_size.x(),
|
||||
relativePos.y()/m_size.y() );
|
||||
MarkToRedraw();
|
||||
//==> try to estimate color
|
||||
EWOL_VERBOSE("event on (" << relativePos.x << "," << relativePos.y << ")");
|
||||
int32_t bandID = (int32_t)(relativePos.x/(m_size.x/6));
|
||||
float localPos = relativePos.x - (m_size.x/6) * bandID;
|
||||
float poroportionnalPos = localPos/(m_size.x/6);
|
||||
EWOL_VERBOSE("event on (" << relativePos.x() << "," << relativePos.y() << ")");
|
||||
int32_t bandID = (int32_t)(relativePos.x()/(m_size.x()/6));
|
||||
float localPos = relativePos.x() - (m_size.x()/6) * bandID;
|
||||
float poroportionnalPos = localPos/(m_size.x()/6);
|
||||
EWOL_VERBOSE("bandId=" << bandID << " relative pos=" << localPos);
|
||||
draw::Color estimateColor = draw::color::white;
|
||||
if (s_listColor[bandID].r == s_listColor[bandID+1].r) {
|
||||
@ -215,15 +213,15 @@ bool widget::ColorBar::OnEventInput(ewol::keyEvent::type_te type, int32_t IdInpu
|
||||
estimateColor.b = s_listColor[bandID+1].b + (s_listColor[bandID].b-s_listColor[bandID+1].b)*(1-poroportionnalPos);
|
||||
}
|
||||
// step 2 generate the white and black ...
|
||||
if (m_currentUserPos.y == 0.5) {
|
||||
if (m_currentUserPos.y() == 0.5) {
|
||||
// nothing to do ... just get the current color ...
|
||||
} else if (m_currentUserPos.y < 0.5) {
|
||||
float poroportionnalWhite = (0.5-m_currentUserPos.y)*2.0;
|
||||
} else if (m_currentUserPos.y() < 0.5) {
|
||||
float poroportionnalWhite = (0.5-m_currentUserPos.y())*2.0;
|
||||
estimateColor.r = estimateColor.r + (0xFF-estimateColor.r)*poroportionnalWhite;
|
||||
estimateColor.g = estimateColor.g + (0xFF-estimateColor.g)*poroportionnalWhite;
|
||||
estimateColor.b = estimateColor.b + (0xFF-estimateColor.b)*poroportionnalWhite;
|
||||
} else {
|
||||
float poroportionnalBlack = (m_currentUserPos.y-0.5)*2.0;
|
||||
float poroportionnalBlack = (m_currentUserPos.y()-0.5)*2.0;
|
||||
estimateColor.r = estimateColor.r - estimateColor.r*poroportionnalBlack;
|
||||
estimateColor.g = estimateColor.g - estimateColor.g*poroportionnalBlack;
|
||||
estimateColor.b = estimateColor.b - estimateColor.b*poroportionnalBlack;
|
||||
|
@ -16,11 +16,9 @@
|
||||
|
||||
widget::ContextMenu::ContextMenu(void)
|
||||
{
|
||||
m_userExpend.x = true;
|
||||
m_userExpend.y = true;
|
||||
m_userExpend.setValue(true,true);
|
||||
|
||||
m_padding.x = 4;
|
||||
m_padding.y = 4;
|
||||
m_padding.setValue(4,4);
|
||||
m_offset = 20;
|
||||
|
||||
m_colorBackGroung = draw::color::white;
|
||||
@ -28,8 +26,7 @@ widget::ContextMenu::ContextMenu(void)
|
||||
m_colorBorder = draw::color::black;
|
||||
m_colorBorder.a = 0x7F;
|
||||
|
||||
m_arrowPos.x = 0;
|
||||
m_arrowPos.y = 0;
|
||||
m_arrowPos.setValue(0,0);
|
||||
m_arrawBorder = widget::CONTEXT_MENU_MARK_TOP;
|
||||
SetMouseLimit(1);
|
||||
}
|
||||
@ -44,71 +41,65 @@ bool widget::ContextMenu::CalculateSize(float availlableX, float availlableY)
|
||||
{
|
||||
EWOL_DEBUG("CalculateSize(" << availlableX << "," << availlableY << ")");
|
||||
// pop-up fill all the display :
|
||||
m_size.x = availlableX;
|
||||
m_size.y = availlableY;
|
||||
m_size.setValue(availlableX, availlableY);
|
||||
|
||||
if (NULL != m_subWidget) {
|
||||
vec2 subWidgetSize;
|
||||
vec2 subWidgetOrigin;
|
||||
subWidgetSize = m_subWidget->GetMinSize();
|
||||
if (true == m_subWidget->CanExpentX()) {
|
||||
subWidgetSize.x = m_size.x;
|
||||
subWidgetSize.setX(m_size.x());
|
||||
}
|
||||
if (true == m_subWidget->CanExpentY()) {
|
||||
subWidgetSize.y = m_size.y;
|
||||
subWidgetSize.setY(m_size.y());
|
||||
}
|
||||
int32_t minWidth = 100;
|
||||
int32_t maxWidth = 300;
|
||||
subWidgetSize.x = (int32_t)etk_max(minWidth, subWidgetSize.x);
|
||||
subWidgetSize.x = (int32_t)etk_min(maxWidth, subWidgetSize.x);
|
||||
subWidgetSize.y = (int32_t)subWidgetSize.y;
|
||||
subWidgetSize.setX((int32_t)etk_max(minWidth, subWidgetSize.x()));
|
||||
subWidgetSize.setX((int32_t)etk_min(maxWidth, subWidgetSize.x()));
|
||||
subWidgetSize.setY((int32_t)subWidgetSize.y());
|
||||
|
||||
// set config to the Sub-widget
|
||||
switch (m_arrawBorder)
|
||||
{
|
||||
case widget::CONTEXT_MENU_MARK_TOP:
|
||||
subWidgetOrigin.x = (int32_t)(m_arrowPos.x - subWidgetSize.x/2);
|
||||
subWidgetOrigin.y = (int32_t)(m_arrowPos.y - m_offset - subWidgetSize.y);
|
||||
subWidgetOrigin.setX((int32_t)(m_arrowPos.x() - subWidgetSize.x()/2));
|
||||
subWidgetOrigin.setY((int32_t)(m_arrowPos.y() - m_offset - subWidgetSize.y()));
|
||||
break;
|
||||
case widget::CONTEXT_MENU_MARK_BOTTOM:
|
||||
subWidgetOrigin.x = (int32_t)(m_arrowPos.x - subWidgetSize.x/2);
|
||||
subWidgetOrigin.y = (int32_t)(m_arrowPos.y + m_offset);
|
||||
subWidgetOrigin.setX((int32_t)(m_arrowPos.x() - subWidgetSize.x()/2));
|
||||
subWidgetOrigin.setY((int32_t)(m_arrowPos.y() + m_offset));
|
||||
break;
|
||||
case widget::CONTEXT_MENU_MARK_RIGHT:
|
||||
case widget::CONTEXT_MENU_MARK_LEFT:
|
||||
default:
|
||||
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;
|
||||
subWidgetOrigin.setX((int32_t)(m_size.x() - m_origin.x() - subWidgetSize.x())/2 + m_origin.x());
|
||||
subWidgetOrigin.setY((int32_t)(m_size.y() - m_origin.y() - subWidgetSize.y())/2 + m_origin.y());
|
||||
break;
|
||||
}
|
||||
// set the widget position at the border of the screen
|
||||
subWidgetOrigin.x -= m_padding.x*2;
|
||||
subWidgetOrigin.x = etk_max(0, subWidgetOrigin.x);
|
||||
subWidgetOrigin.x += m_padding.x*2;
|
||||
subWidgetOrigin.x = (int32_t)subWidgetOrigin.x;
|
||||
|
||||
subWidgetOrigin.y -= m_padding.y*2;
|
||||
subWidgetOrigin.y = etk_max(0, subWidgetOrigin.y);
|
||||
subWidgetOrigin.y += m_padding.y*2;
|
||||
subWidgetOrigin.y = (int32_t)subWidgetOrigin.y;
|
||||
subWidgetOrigin.setX( (int32_t)( etk_max(0, (subWidgetOrigin.x()-m_padding.x()*2))
|
||||
+ m_padding.x()*2) );
|
||||
subWidgetOrigin.setY( (int32_t)( etk_max(0, (subWidgetOrigin.y()-m_padding.y()*2))
|
||||
+ m_padding.y()*2) );
|
||||
switch (m_arrawBorder)
|
||||
{
|
||||
default:
|
||||
case widget::CONTEXT_MENU_MARK_TOP:
|
||||
case widget::CONTEXT_MENU_MARK_BOTTOM:
|
||||
if (m_arrowPos.x <= m_offset ) {
|
||||
subWidgetOrigin.x = m_arrowPos.x+m_padding.x;
|
||||
if (m_arrowPos.x() <= m_offset ) {
|
||||
subWidgetOrigin.setX(m_arrowPos.x()+m_padding.x());
|
||||
}
|
||||
break;
|
||||
case widget::CONTEXT_MENU_MARK_RIGHT:
|
||||
case widget::CONTEXT_MENU_MARK_LEFT:
|
||||
if (m_arrowPos.y <= m_offset ) {
|
||||
subWidgetOrigin.y = m_arrowPos.y+m_padding.y;
|
||||
if (m_arrowPos.y() <= m_offset ) {
|
||||
subWidgetOrigin.setY(m_arrowPos.y()+m_padding.y());
|
||||
}
|
||||
break;
|
||||
}
|
||||
m_subWidget->SetOrigin(subWidgetOrigin.x, subWidgetOrigin.y);
|
||||
m_subWidget->CalculateSize(subWidgetSize.x, subWidgetSize.y);
|
||||
m_subWidget->SetOrigin(subWidgetOrigin.x(), subWidgetOrigin.y());
|
||||
m_subWidget->CalculateSize(subWidgetSize.x(), subWidgetSize.y());
|
||||
}
|
||||
MarkToRedraw();
|
||||
return true;
|
||||
@ -118,17 +109,13 @@ bool widget::ContextMenu::CalculateSize(float availlableX, float availlableY)
|
||||
bool widget::ContextMenu::CalculateMinSize(void)
|
||||
{
|
||||
EWOL_DEBUG("CalculateMinSize");
|
||||
m_userExpend.x=false;
|
||||
m_userExpend.y=false;
|
||||
m_minSize.x = 50.0;
|
||||
m_minSize.y = 50.0;
|
||||
m_userExpend.setValue(false,false);
|
||||
m_minSize.setValue(50,50);
|
||||
if (NULL != m_subWidget) {
|
||||
m_subWidget->CalculateMinSize();
|
||||
vec2 tmpSize = m_subWidget->GetMinSize();
|
||||
m_minSize.x = tmpSize.x;
|
||||
m_minSize.y = tmpSize.y;
|
||||
m_minSize = m_subWidget->GetMinSize();
|
||||
}
|
||||
EWOL_DEBUG("CalculateMinSize(" << m_minSize.x << "," << m_minSize.y << ")");
|
||||
EWOL_DEBUG("CalculateMinSize=>>" << m_minSize);
|
||||
MarkToRedraw();
|
||||
return true;
|
||||
}
|
||||
@ -194,36 +181,36 @@ void widget::ContextMenu::OnRegenerateDisplay(void)
|
||||
switch (m_arrawBorder)
|
||||
{
|
||||
case widget::CONTEXT_MENU_MARK_TOP:
|
||||
BGOObjects->SetPos(vec3(m_arrowPos.x, m_arrowPos.y, 0.0f) );
|
||||
BGOObjects->SetPos(vec3(m_arrowPos.x(), m_arrowPos.y(), 0.0f) );
|
||||
BGOObjects->AddVertex();
|
||||
if (m_arrowPos.x <= tmpOrigin.x ) {
|
||||
float laking = m_offset - m_padding.y;
|
||||
BGOObjects->SetPos(vec3(m_arrowPos.x+laking, m_arrowPos.y-laking, 0.0f) );
|
||||
if (m_arrowPos.x() <= tmpOrigin.x() ) {
|
||||
float laking = m_offset - m_padding.y();
|
||||
BGOObjects->SetPos(vec3(m_arrowPos.x()+laking, m_arrowPos.y()-laking, 0.0f) );
|
||||
BGOObjects->AddVertex();
|
||||
BGOObjects->SetPos(vec3(m_arrowPos.x, m_arrowPos.y-laking, 0.0f) );
|
||||
BGOObjects->SetPos(vec3(m_arrowPos.x(), m_arrowPos.y()-laking, 0.0f) );
|
||||
BGOObjects->AddVertex();
|
||||
} else {
|
||||
float laking = m_offset - m_padding.y;
|
||||
BGOObjects->SetPos(vec3(m_arrowPos.x+laking, m_arrowPos.y-laking, 0.0f) );
|
||||
float laking = m_offset - m_padding.y();
|
||||
BGOObjects->SetPos(vec3(m_arrowPos.x()+laking, m_arrowPos.y()-laking, 0.0f) );
|
||||
BGOObjects->AddVertex();
|
||||
BGOObjects->SetPos(vec3(m_arrowPos.x-laking, m_arrowPos.y-laking, 0.0f) );
|
||||
BGOObjects->SetPos(vec3(m_arrowPos.x()-laking, m_arrowPos.y()-laking, 0.0f) );
|
||||
BGOObjects->AddVertex();
|
||||
}
|
||||
break;
|
||||
case widget::CONTEXT_MENU_MARK_BOTTOM:
|
||||
BGOObjects->SetPos(vec3(m_arrowPos.x, m_arrowPos.y, 0.0f) );
|
||||
BGOObjects->SetPos(vec3(m_arrowPos.x(), m_arrowPos.y(), 0) );
|
||||
BGOObjects->AddVertex();
|
||||
if (m_arrowPos.x <= tmpOrigin.x ) {
|
||||
int32_t laking = m_offset - m_padding.y;
|
||||
BGOObjects->SetPos(vec3(m_arrowPos.x+laking, m_arrowPos.y+laking, 0.0f) );
|
||||
if (m_arrowPos.x() <= tmpOrigin.x() ) {
|
||||
int32_t laking = m_offset - m_padding.y();
|
||||
BGOObjects->SetPos(vec3(m_arrowPos.x()+laking, m_arrowPos.y()+laking, 0.0f) );
|
||||
BGOObjects->AddVertex();
|
||||
BGOObjects->SetPos(vec3(m_arrowPos.x, m_arrowPos.y+laking, 0.0f) );
|
||||
BGOObjects->SetPos(vec3(m_arrowPos.x(), m_arrowPos.y()+laking, 0.0f) );
|
||||
BGOObjects->AddVertex();
|
||||
} else {
|
||||
int32_t laking = m_offset - m_padding.y;
|
||||
BGOObjects->SetPos(vec3(m_arrowPos.x+laking, m_arrowPos.y+laking, 0.0f) );
|
||||
int32_t laking = m_offset - m_padding.y();
|
||||
BGOObjects->SetPos(vec3(m_arrowPos.x()+laking, m_arrowPos.y()+laking, 0.0f) );
|
||||
BGOObjects->AddVertex();
|
||||
BGOObjects->SetPos(vec3(m_arrowPos.x-laking, m_arrowPos.y+laking, 0.0f) );
|
||||
BGOObjects->SetPos(vec3(m_arrowPos.x()-laking, m_arrowPos.y()+laking, 0.0f) );
|
||||
BGOObjects->AddVertex();
|
||||
}
|
||||
break;
|
||||
@ -233,12 +220,12 @@ void widget::ContextMenu::OnRegenerateDisplay(void)
|
||||
EWOL_TODO("later");
|
||||
break;
|
||||
}
|
||||
BGOObjects->SetPos(vec3(tmpOrigin.x-m_padding.x, tmpOrigin.y - m_padding.y, 0.0f) );
|
||||
BGOObjects->RectangleWidth(vec3(tmpSize.x + m_padding.x*2, tmpSize.y + m_padding.y*2, 0.0f) );
|
||||
BGOObjects->SetPos(vec3(tmpOrigin.x()-m_padding.x(), tmpOrigin.y() - m_padding.y(), 0.0f) );
|
||||
BGOObjects->RectangleWidth(vec3(tmpSize.x() + m_padding.x()*2, tmpSize.y() + m_padding.y()*2, 0.0f) );
|
||||
// set the area in white ...
|
||||
BGOObjects->SetColor(m_colorBackGroung);
|
||||
BGOObjects->SetPos(vec3(tmpOrigin.x, tmpOrigin.y, 0.0f) );
|
||||
BGOObjects->RectangleWidth(vec3(tmpSize.x, tmpSize.y, 0.0f) );
|
||||
BGOObjects->SetPos(vec3(tmpOrigin.x(), tmpOrigin.y(), 0.0f) );
|
||||
BGOObjects->RectangleWidth(vec3(tmpSize.x(), tmpSize.y(), 0.0f) );
|
||||
}
|
||||
if (NULL != m_subWidget) {
|
||||
m_subWidget->OnRegenerateDisplay();
|
||||
@ -254,8 +241,8 @@ ewol::Widget * widget::ContextMenu::GetWidgetAtPos(vec2 pos)
|
||||
if (NULL != m_subWidget) {
|
||||
vec2 tmpSize = m_subWidget->GetSize();
|
||||
vec2 tmpOrigin = m_subWidget->GetOrigin();
|
||||
if( (tmpOrigin.x <= relativePos.x && tmpOrigin.x + tmpSize.x >= relativePos.x)
|
||||
&& (tmpOrigin.y <= relativePos.y && tmpOrigin.y + tmpSize.y >= relativePos.y) )
|
||||
if( (tmpOrigin.x() <= relativePos.x() && tmpOrigin.x() + tmpSize.x() >= relativePos.x())
|
||||
&& (tmpOrigin.y() <= relativePos.y() && tmpOrigin.y() + tmpSize.y() >= relativePos.y()) )
|
||||
{
|
||||
return m_subWidget->GetWidgetAtPos(pos);
|
||||
}
|
||||
@ -285,7 +272,7 @@ bool widget::ContextMenu::OnEventInput(ewol::keyEvent::type_te type, int32_t IdI
|
||||
|
||||
void widget::ContextMenu::SetPositionMark(markPosition_te position, vec2 arrowPos)
|
||||
{
|
||||
EWOL_DEBUG("set context menu at the position : (" << arrowPos.x << "," << arrowPos.y << ")");
|
||||
EWOL_DEBUG("set context menu at the position : " << arrowPos);
|
||||
m_arrawBorder = position;
|
||||
m_arrowPos = arrowPos;
|
||||
MarkToRedraw();
|
||||
|
@ -70,9 +70,9 @@ bool widget::Entry::CalculateMinSize(void)
|
||||
{
|
||||
vec2 padding = m_shaper.GetPadding();
|
||||
|
||||
int32_t minHeight = m_oObjectText.CalculateSize('A').y;
|
||||
m_minSize.x = m_userSize + 2*padding.x;
|
||||
m_minSize.y = minHeight + 2*padding.y;
|
||||
int32_t minHeight = m_oObjectText.CalculateSize('A').y();
|
||||
m_minSize.setValue(m_userSize + 2*padding.x(),
|
||||
minHeight + 2*padding.y());
|
||||
UpdateTextPosition();
|
||||
MarkToRedraw();
|
||||
return true;
|
||||
@ -109,36 +109,36 @@ void widget::Entry::OnRegenerateDisplay(void)
|
||||
UpdateTextPosition();
|
||||
vec2 padding = m_shaper.GetPadding();
|
||||
|
||||
int32_t tmpSizeX = m_minSize.x;
|
||||
int32_t tmpSizeY = m_minSize.y;
|
||||
int32_t tmpSizeX = m_minSize.x();
|
||||
int32_t tmpSizeY = m_minSize.y();
|
||||
int32_t tmpOriginX = 0;
|
||||
int32_t tmpOriginY = (m_size.y - tmpSizeY) / 2;
|
||||
int32_t tmpOriginY = (m_size.y() - tmpSizeY) / 2;
|
||||
// no change for the text orogin :
|
||||
int32_t tmpTextOriginX = padding.x;
|
||||
int32_t tmpTextOriginY = tmpOriginY + padding.y;
|
||||
int32_t tmpTextOriginX = padding.x();
|
||||
int32_t tmpTextOriginY = tmpOriginY + padding.y();
|
||||
|
||||
if (true==m_userFill.x) {
|
||||
tmpSizeX = m_size.x;
|
||||
if (true==m_userFill.x()) {
|
||||
tmpSizeX = m_size.x();
|
||||
}
|
||||
if (true==m_userFill.y) {
|
||||
if (true==m_userFill.y()) {
|
||||
//tmpSizeY = m_size.y;
|
||||
tmpOriginY = 0;
|
||||
tmpTextOriginY = tmpOriginY + padding.y;
|
||||
tmpTextOriginY = tmpOriginY + padding.y();
|
||||
}
|
||||
tmpOriginX += padding.x;
|
||||
tmpOriginY += padding.y;
|
||||
tmpSizeX -= 2*padding.x;
|
||||
tmpSizeY -= 2*padding.y;
|
||||
tmpOriginX += padding.x();
|
||||
tmpOriginY += padding.y();
|
||||
tmpSizeX -= 2*padding.x();
|
||||
tmpSizeY -= 2*padding.y();
|
||||
|
||||
|
||||
vec3 textPos( tmpTextOriginX + m_displayStartPosition,
|
||||
tmpTextOriginY,
|
||||
0 );
|
||||
vec3 drawClippingPos( padding.x,
|
||||
padding.y,
|
||||
vec3 drawClippingPos( padding.x(),
|
||||
padding.y(),
|
||||
-1 );
|
||||
vec3 drawClippingSize( m_size.x - 2*drawClippingPos.x,
|
||||
m_size.y - 2*drawClippingPos.y,
|
||||
vec3 drawClippingSize( m_size.x() - 2*drawClippingPos.x(),
|
||||
m_size.y() - 2*drawClippingPos.y(),
|
||||
1 );
|
||||
m_oObjectText.SetClippingWidth(drawClippingPos, drawClippingSize);
|
||||
m_oObjectText.SetPos(textPos);
|
||||
@ -159,17 +159,17 @@ void widget::Entry::UpdateCursorPosition(vec2& pos, bool selection)
|
||||
vec2 padding = m_shaper.GetPadding();
|
||||
|
||||
vec2 relPos = RelativePosition(pos);
|
||||
relPos.x += -m_displayStartPosition - padding.x;
|
||||
relPos.setX(relPos.x()-m_displayStartPosition - padding.x());
|
||||
// try to find the new cursor position :
|
||||
etk::UString tmpDisplay = m_data.Extract(0, m_displayStartPosition);
|
||||
int32_t displayHidenSize = m_oObjectText.CalculateSize(tmpDisplay).x;
|
||||
int32_t displayHidenSize = m_oObjectText.CalculateSize(tmpDisplay).x();
|
||||
//EWOL_DEBUG("hidenSize : " << displayHidenSize);
|
||||
int32_t newCursorPosition = -1;
|
||||
int32_t tmpTextOriginX = padding.x;
|
||||
int32_t tmpTextOriginX = padding.x();
|
||||
for (int32_t iii=0; iii<m_data.Size(); iii++) {
|
||||
tmpDisplay = m_data.Extract(0, iii);
|
||||
int32_t tmpWidth = m_oObjectText.CalculateSize(tmpDisplay).x - displayHidenSize;
|
||||
if (tmpWidth>=relPos.x-tmpTextOriginX) {
|
||||
int32_t tmpWidth = m_oObjectText.CalculateSize(tmpDisplay).x() - displayHidenSize;
|
||||
if (tmpWidth>=relPos.x()-tmpTextOriginX) {
|
||||
newCursorPosition = iii;
|
||||
break;
|
||||
}
|
||||
@ -446,12 +446,12 @@ void widget::Entry::UpdateTextPosition(void)
|
||||
{
|
||||
vec2 padding = m_shaper.GetPadding();
|
||||
|
||||
int32_t tmpSizeX = m_minSize.x;
|
||||
if (true==m_userFill.x) {
|
||||
tmpSizeX = m_size.x;
|
||||
int32_t tmpSizeX = m_minSize.x();
|
||||
if (true==m_userFill.x()) {
|
||||
tmpSizeX = m_size.x();
|
||||
}
|
||||
int32_t tmpUserSize = tmpSizeX - 2*(padding.x);
|
||||
int32_t totalWidth = m_oObjectText.CalculateSize(m_data).x;
|
||||
int32_t tmpUserSize = tmpSizeX - 2*(padding.x());
|
||||
int32_t totalWidth = m_oObjectText.CalculateSize(m_data).x();
|
||||
// Check if the data inside the display can be contain in the entry box
|
||||
if (totalWidth < tmpUserSize) {
|
||||
// all can be display :
|
||||
@ -459,7 +459,7 @@ void widget::Entry::UpdateTextPosition(void)
|
||||
} else {
|
||||
// all can not be set :
|
||||
etk::UString tmpDisplay = m_data.Extract(0, m_displayCursorPos);
|
||||
int32_t pixelCursorPos = m_oObjectText.CalculateSize(tmpDisplay).x;
|
||||
int32_t pixelCursorPos = m_oObjectText.CalculateSize(tmpDisplay).x();
|
||||
// check if the Cussor is visible at 10px nearest the border :
|
||||
int32_t tmp1 = pixelCursorPos+m_displayStartPosition;
|
||||
EWOL_DEBUG("cursorPos=" << pixelCursorPos << "px maxSize=" << tmpUserSize << "px tmp1=" << tmp1);
|
||||
|
@ -23,11 +23,9 @@ void widget::Image::Init(void)
|
||||
AddEventId(ewolEventImagePressed);
|
||||
|
||||
#ifdef __TARGET_OS__Android
|
||||
m_padding.y = 12;
|
||||
m_padding.x = 12;
|
||||
m_padding.setValue(12,12);
|
||||
#else
|
||||
m_padding.y = 4;
|
||||
m_padding.x = 4;
|
||||
m_padding.setValue(4,4);
|
||||
#endif
|
||||
|
||||
m_textColorBg = draw::color::black;
|
||||
@ -61,8 +59,8 @@ void widget::Image::SetPadding(vec2 newPadding)
|
||||
|
||||
bool widget::Image::CalculateMinSize(void)
|
||||
{
|
||||
m_minSize.x = m_padding.x*2 + m_imageSize;
|
||||
m_minSize.y = m_padding.y*2 + m_imageSize;
|
||||
m_minSize.setValue(m_padding.x()*2 + m_imageSize,
|
||||
m_padding.y()*2 + m_imageSize );
|
||||
MarkToRedraw();
|
||||
return true;
|
||||
}
|
||||
@ -81,23 +79,23 @@ void widget::Image::OnRegenerateDisplay(void)
|
||||
// clean the object list ...
|
||||
ClearOObjectList();
|
||||
|
||||
int32_t tmpSizeX = m_minSize.x;
|
||||
int32_t tmpSizeY = m_minSize.y;
|
||||
int32_t tmpOriginX = (m_size.x - m_minSize.x) / 2;
|
||||
int32_t tmpOriginY = (m_size.y - m_minSize.y) / 2;
|
||||
int32_t tmpSizeX = m_minSize.x();
|
||||
int32_t tmpSizeY = m_minSize.y();
|
||||
int32_t tmpOriginX = (m_size.x() - m_minSize.x()) / 2;
|
||||
int32_t tmpOriginY = (m_size.y() - m_minSize.y()) / 2;
|
||||
|
||||
if (true==m_userFill.x) {
|
||||
tmpSizeX = m_size.x;
|
||||
if (true==m_userFill.x()) {
|
||||
tmpSizeX = m_size.x();
|
||||
tmpOriginX = 0;
|
||||
}
|
||||
if (true==m_userFill.y) {
|
||||
tmpSizeY = m_size.y;
|
||||
if (true==m_userFill.y()) {
|
||||
tmpSizeY = m_size.y();
|
||||
tmpOriginY = 0;
|
||||
}
|
||||
tmpOriginX += m_padding.x;
|
||||
tmpOriginY += m_padding.y;
|
||||
tmpSizeX -= 2*m_padding.x;
|
||||
tmpSizeY -= 2*m_padding.y;
|
||||
tmpOriginX += m_padding.x();
|
||||
tmpOriginY += m_padding.y();
|
||||
tmpSizeX -= 2*m_padding.x();
|
||||
tmpSizeY -= 2*m_padding.y();
|
||||
|
||||
|
||||
ewol::Image * tmpImage = NULL;
|
||||
|
@ -39,8 +39,7 @@ widget::Joystick::Joystick(void)
|
||||
m_colorBg = draw::color::black;
|
||||
m_colorBg.a = 0x3F;
|
||||
|
||||
m_displayPos.x = 0.0;
|
||||
m_displayPos.y = 0.0;
|
||||
m_displayPos.setValue(0,0);
|
||||
m_distance = 0.0;
|
||||
m_angle = -0.1;
|
||||
|
||||
@ -62,8 +61,7 @@ widget::Joystick::~Joystick(void)
|
||||
bool widget::Joystick::CalculateSize(float availlableX, float availlableY)
|
||||
{
|
||||
float minimumSize = etk_min(availlableX, availlableY);
|
||||
m_size.x = minimumSize;
|
||||
m_size.y = minimumSize;
|
||||
m_size.setValue(minimumSize, minimumSize);
|
||||
MarkToRedraw();
|
||||
return true;
|
||||
}
|
||||
@ -123,6 +121,7 @@ Tangent Function: tan(teta) = Opposite / Adjacent
|
||||
*/
|
||||
bool widget::Joystick::OnEventInput(ewol::keyEvent::type_te type, int32_t IdInput, ewol::keyEvent::status_te typeEvent, vec2 pos)
|
||||
{
|
||||
/*
|
||||
if (1 == IdInput) {
|
||||
if( ewol::keyEvent::statusDown == typeEvent
|
||||
|| ewol::keyEvent::statusMove == typeEvent) {
|
||||
@ -175,6 +174,7 @@ bool widget::Joystick::OnEventInput(ewol::keyEvent::type_te type, int32_t IdInpu
|
||||
}
|
||||
return false;
|
||||
}
|
||||
*/
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -35,19 +35,19 @@ widget::Label::~Label(void)
|
||||
|
||||
bool widget::Label::CalculateMinSize(void)
|
||||
{
|
||||
if (m_userMaxSize.x != -1) {
|
||||
m_text.SetTextAlignement(0, m_userMaxSize.x-4, ewol::Text::alignLeft);
|
||||
if (m_userMaxSize.x() != -1) {
|
||||
m_text.SetTextAlignement(0, m_userMaxSize.x()-4, ewol::Text::alignLeft);
|
||||
}
|
||||
ivec3 minSize = m_text.CalculateSizeDecorated(m_label);
|
||||
if (m_userMaxSize.x!=-1) {
|
||||
m_minSize.x = etk_min(4 + minSize.x, m_userMaxSize.x);
|
||||
vec3 minSize = m_text.CalculateSizeDecorated(m_label);
|
||||
if (m_userMaxSize.x()!=-1) {
|
||||
m_minSize.setX(etk_min(4 + minSize.x(), m_userMaxSize.x()));
|
||||
} else {
|
||||
m_minSize.x = 4 + minSize.x;
|
||||
m_minSize.setX(4 + minSize.x());
|
||||
}
|
||||
if (m_userMaxSize.y!=-1) {
|
||||
m_minSize.y = etk_min(4 + minSize.y, m_userMaxSize.y);
|
||||
if (m_userMaxSize.y()!=-1) {
|
||||
m_minSize.setY(etk_min(4 + minSize.y(), m_userMaxSize.y()));
|
||||
} else {
|
||||
m_minSize.y = 4 + minSize.y;
|
||||
m_minSize.setY(4 + minSize.y());
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@ -81,45 +81,43 @@ void widget::Label::OnRegenerateDisplay(void)
|
||||
|
||||
|
||||
// to know the size of one Line :
|
||||
ivec3 minSize = m_text.CalculateSize('A');
|
||||
if (m_userMaxSize.x != -1) {
|
||||
m_text.SetTextAlignement(0, m_userMaxSize.x-2*paddingSize, ewol::Text::alignLeft);
|
||||
vec3 minSize = m_text.CalculateSize('A');
|
||||
if (m_userMaxSize.x() != -1) {
|
||||
m_text.SetTextAlignement(0, m_userMaxSize.x()-2*paddingSize, ewol::Text::alignLeft);
|
||||
}
|
||||
ivec3 curentTextSize = m_text.CalculateSizeDecorated(m_label);
|
||||
vec3 curentTextSize = m_text.CalculateSizeDecorated(m_label);
|
||||
|
||||
ivec2 localSize = m_minSize;
|
||||
|
||||
// no change for the text orogin :
|
||||
vec3 tmpTextOrigin((m_size.x - m_minSize.x) / 2.0,
|
||||
(m_size.y - m_minSize.y) / 2.0,
|
||||
vec3 tmpTextOrigin((m_size.x() - m_minSize.x()) / 2.0,
|
||||
(m_size.y() - m_minSize.y()) / 2.0,
|
||||
0);
|
||||
|
||||
if (true==m_userFill.x) {
|
||||
localSize.x = m_size.x;
|
||||
tmpTextOrigin.x = 0;
|
||||
if (true==m_userFill.x()) {
|
||||
localSize.setX(m_size.x());
|
||||
tmpTextOrigin.setX(0);
|
||||
}
|
||||
if (true==m_userFill.y) {
|
||||
localSize.y = m_size.y;
|
||||
tmpTextOrigin.y = m_size.y - 2*paddingSize - curentTextSize.y;
|
||||
if (true==m_userFill.y()) {
|
||||
localSize.setY(m_size.y());
|
||||
tmpTextOrigin.setY(m_size.y() - 2*paddingSize - curentTextSize.y());
|
||||
}
|
||||
tmpTextOrigin.x += paddingSize;
|
||||
tmpTextOrigin.y += paddingSize;
|
||||
localSize.x -= 2*paddingSize;
|
||||
localSize.y -= 2*paddingSize;
|
||||
tmpTextOrigin += vec3(paddingSize, paddingSize, 0);
|
||||
localSize -= vec2(2*paddingSize,2*paddingSize);
|
||||
|
||||
tmpTextOrigin.y += (m_minSize.y-2*paddingSize) - minSize.y;
|
||||
tmpTextOrigin.setY( tmpTextOrigin.y() + (m_minSize.y()-2*paddingSize) - minSize.y());
|
||||
|
||||
vec2 textPos(tmpTextOrigin.x, tmpTextOrigin.y);
|
||||
vec2 textPos(tmpTextOrigin.x(), tmpTextOrigin.y());
|
||||
|
||||
vec3 drawClippingPos(paddingSize, paddingSize, -0.5);
|
||||
vec3 drawClippingSize((m_size.x - paddingSize),
|
||||
(m_size.y - paddingSize),
|
||||
vec3 drawClippingSize((m_size.x() - paddingSize),
|
||||
(m_size.y() - paddingSize),
|
||||
1);
|
||||
|
||||
// clean the element
|
||||
m_text.Reset();
|
||||
m_text.SetPos(tmpTextOrigin);
|
||||
m_text.SetTextAlignement(tmpTextOrigin.x, tmpTextOrigin.x+localSize.x, ewol::Text::alignLeft);
|
||||
m_text.SetTextAlignement(tmpTextOrigin.x(), tmpTextOrigin.x()+localSize.x(), ewol::Text::alignLeft);
|
||||
m_text.SetClipping(drawClippingPos, drawClippingSize);
|
||||
m_text.PrintDecorated(m_label);
|
||||
}
|
||||
|
@ -29,12 +29,11 @@ widget::Layer::~Layer(void)
|
||||
bool widget::Layer::CalculateSize(float availlableX, float availlableY)
|
||||
{
|
||||
//EWOL_DEBUG("Update Size");
|
||||
m_size.x = availlableX;
|
||||
m_size.y = availlableY;
|
||||
m_size.setValue(availlableX, availlableY);
|
||||
for (int32_t iii=0; iii<m_subWidget.Size(); iii++) {
|
||||
if (NULL != m_subWidget[iii]) {
|
||||
m_subWidget[iii]->SetOrigin(m_origin.x, m_origin.y);
|
||||
m_subWidget[iii]->CalculateSize(m_size.x, m_size.y);
|
||||
m_subWidget[iii]->SetOrigin(m_origin.x(), m_origin.y());
|
||||
m_subWidget[iii]->CalculateSize(m_size.x(), m_size.y());
|
||||
}
|
||||
}
|
||||
MarkToRedraw();
|
||||
@ -44,22 +43,20 @@ bool widget::Layer::CalculateSize(float availlableX, float availlableY)
|
||||
|
||||
bool widget::Layer::CalculateMinSize(void)
|
||||
{
|
||||
m_userExpend.x=false;
|
||||
m_userExpend.y=false;
|
||||
m_minSize.x = 0.0;
|
||||
m_minSize.y = 0.0;
|
||||
m_userExpend.setValue(false, false);
|
||||
m_minSize.setValue(0,0);
|
||||
for (int32_t iii=0; iii<m_subWidget.Size(); iii++) {
|
||||
if (NULL != m_subWidget[iii]) {
|
||||
m_subWidget[iii]->CalculateMinSize();
|
||||
if (true == m_subWidget[iii]->CanExpentX()) {
|
||||
m_userExpend.x = true;
|
||||
m_userExpend.setX(true);
|
||||
}
|
||||
if (true == m_subWidget[iii]->CanExpentY()) {
|
||||
m_userExpend.y = true;
|
||||
m_userExpend.setY(true);
|
||||
}
|
||||
vec2 tmpSize = m_subWidget[iii]->GetMinSize();
|
||||
m_minSize.x = etk_max(tmpSize.x, m_minSize.x);
|
||||
m_minSize.y = etk_max(tmpSize.y, m_minSize.y);
|
||||
m_minSize.setValue( etk_max(tmpSize.x(), m_minSize.x()),
|
||||
etk_max(tmpSize.y(), m_minSize.y()) );
|
||||
}
|
||||
}
|
||||
return true;
|
||||
@ -80,7 +77,7 @@ bool widget::Layer::CanExpentX(void)
|
||||
if (true == m_lockExpendContamination) {
|
||||
return false;
|
||||
}
|
||||
return m_userExpend.x;
|
||||
return m_userExpend.x();
|
||||
}
|
||||
|
||||
void widget::Layer::SetExpendY(bool newExpend)
|
||||
@ -93,7 +90,7 @@ bool widget::Layer::CanExpentY(void)
|
||||
if (true == m_lockExpendContamination) {
|
||||
return false;
|
||||
}
|
||||
return m_userExpend.y;
|
||||
return m_userExpend.y();
|
||||
}
|
||||
|
||||
void widget::Layer::LockExpendContamination(bool lockExpend)
|
||||
@ -181,8 +178,8 @@ ewol::Widget * widget::Layer::GetWidgetAtPos(vec2 pos)
|
||||
if (NULL != m_subWidget[iii]) {
|
||||
vec2 tmpSize = m_subWidget[iii]->GetSize();
|
||||
vec2 tmpOrigin = m_subWidget[iii]->GetOrigin();
|
||||
if( (tmpOrigin.x <= pos.x && tmpOrigin.x + tmpSize.x >= pos.x)
|
||||
&& (tmpOrigin.y <= pos.y && tmpOrigin.y + tmpSize.y >= pos.y) )
|
||||
if( (tmpOrigin.x() <= pos.x() && tmpOrigin.x() + tmpSize.x() >= pos.x())
|
||||
&& (tmpOrigin.y() <= pos.y() && tmpOrigin.y() + tmpSize.y() >= pos.y()) )
|
||||
{
|
||||
ewol::Widget * tmpWidget = m_subWidget[iii]->GetWidgetAtPos(pos);
|
||||
if (NULL != tmpWidget) {
|
||||
|
@ -51,8 +51,7 @@ bool widget::List::CalculateMinSize(void)
|
||||
m_minSize.x = 3+minWidth;
|
||||
m_minSize.y = 3+minHeight;
|
||||
*/
|
||||
m_minSize.x = 200;
|
||||
m_minSize.y = 150;
|
||||
m_minSize.setValue(200, 150);
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -117,8 +116,8 @@ void widget::List::OnRegenerateDisplay(void)
|
||||
uint32_t nbColomn = GetNuberOfColomn();
|
||||
int32_t nbRaw = GetNuberOfRaw();
|
||||
// For the scrooling windows
|
||||
m_maxSize.x = m_size.x;
|
||||
m_maxSize.y = (minHeight + 2*m_paddingSizeY) * nbRaw;
|
||||
m_maxSize = ivec2(m_size.x(),
|
||||
(minHeight + 2*m_paddingSizeY) * nbRaw );
|
||||
|
||||
|
||||
etk::Vector<int32_t> listSizeColomn;
|
||||
@ -127,9 +126,9 @@ void widget::List::OnRegenerateDisplay(void)
|
||||
draw::Color basicBG = GetBasicBG();
|
||||
BGOObjects->SetColor(basicBG);
|
||||
BGOObjects->SetPos(vec3(0, 0, 0) );
|
||||
BGOObjects->RectangleWidth(vec3(m_size.x, m_size.y, 0) );
|
||||
BGOObjects->RectangleWidth(vec3(m_size.x(), m_size.y(), 0) );
|
||||
|
||||
int32_t startRaw = m_originScrooled.y / (minHeight + 2*m_paddingSizeY);
|
||||
int32_t startRaw = m_originScrooled.y() / (minHeight + 2*m_paddingSizeY);
|
||||
|
||||
if (startRaw >= nbRaw-1 ) {
|
||||
startRaw = nbRaw - 1;
|
||||
@ -148,15 +147,15 @@ void widget::List::OnRegenerateDisplay(void)
|
||||
*/
|
||||
// remove all the positions :
|
||||
m_lineSize.Clear();
|
||||
int32_t displayPositionY = m_size.y;
|
||||
int32_t displayPositionY = m_size.y();
|
||||
int32_t displayPositionX = 0;
|
||||
ivec2 tmpRegister(startRaw, displayPositionY);
|
||||
// add the default position raw :
|
||||
m_lineSize.PushBack(tmpRegister);
|
||||
|
||||
for(int32_t jjj=0; jjj<nbColomn && displayPositionX < m_size.x ; jjj++) {
|
||||
for(int32_t jjj=0; jjj<nbColomn && displayPositionX < m_size.x() ; jjj++) {
|
||||
int32_t sizeColom = 0;
|
||||
displayPositionY = m_size.y;
|
||||
displayPositionY = m_size.y();
|
||||
for(int32_t iii=startRaw; iii<nbRaw && displayPositionY >= 0; iii++) {
|
||||
etk::UString myTextToWrite;
|
||||
draw::Color fg;
|
||||
@ -166,16 +165,16 @@ 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('A').y();
|
||||
displayPositionY-=(tmpFontHeight+m_paddingSizeY);
|
||||
|
||||
BGOObjects->SetColor(bg);
|
||||
BGOObjects->SetPos(vec3(displayPositionX, displayPositionY, 0) );
|
||||
BGOObjects->RectangleWidth(vec3(m_size.x-displayPositionX, tmpFontHeight+2*m_paddingSizeY, 0));
|
||||
BGOObjects->RectangleWidth(vec3(m_size.x()-displayPositionX, tmpFontHeight+2*m_paddingSizeY, 0));
|
||||
|
||||
// get the maximum size of the colomn :
|
||||
vec3 textSize = tmpText->CalculateSize(myTextToWrite);
|
||||
sizeColom = etk_max(sizeColom, textSize.x);
|
||||
sizeColom = etk_max(sizeColom, textSize.x());
|
||||
|
||||
tmpText->SetColor(fg);
|
||||
tmpText->SetPos(vec3(tmpOriginX + displayPositionX, displayPositionY, 0) );
|
||||
@ -185,8 +184,8 @@ void widget::List::OnRegenerateDisplay(void)
|
||||
displayPositionY -= m_paddingSizeY;
|
||||
|
||||
// add the raw position to remember it ...
|
||||
tmpRegister.x++;
|
||||
tmpRegister.y = displayPositionY;
|
||||
tmpRegister.setX(tmpRegister.x()+1);
|
||||
tmpRegister.setY(displayPositionY);
|
||||
m_lineSize.PushBack(tmpRegister);
|
||||
//EWOL_DEBUG("List indexation:" << tmpRegister);
|
||||
}
|
||||
@ -214,16 +213,16 @@ bool widget::List::OnEventInput(ewol::keyEvent::type_te type, int32_t IdInput, e
|
||||
// parse all the loged row position to find the good one...
|
||||
int32_t rawID = -1;
|
||||
for(int32_t iii=0; iii<m_lineSize.Size()-1; iii++) {
|
||||
if( relativePos.y<m_lineSize[iii].y
|
||||
&& relativePos.y>=m_lineSize[iii+1].y ) {
|
||||
if( relativePos.y()<m_lineSize[iii].y()
|
||||
&& relativePos.y()>=m_lineSize[iii+1].y() ) {
|
||||
// we find the raw :
|
||||
rawID = m_lineSize[iii].x;
|
||||
rawID = m_lineSize[iii].x();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
//EWOL_DEBUG("List event : idInput=" << IdInput << " typeEvent=" << typeEvent << " raw=" << rawID << " pos=" << pos << "");
|
||||
bool isUsed = OnItemEvent(IdInput, typeEvent, 0, rawID, pos.x, pos.y);
|
||||
bool isUsed = OnItemEvent(IdInput, typeEvent, 0, rawID, pos.x(), pos.y());
|
||||
if (true == isUsed) {
|
||||
// TODO : this generate bugs ... I did not understand why ..
|
||||
//ewol::widgetManager::FocusKeep(this);
|
||||
|
@ -68,8 +68,7 @@ void widget::ListFileSystem::RegenerateView(void)
|
||||
|
||||
m_selectedLine = -1;
|
||||
m_list.Clear();
|
||||
m_originScrooled.x = 0;
|
||||
m_originScrooled.y = 0;
|
||||
m_originScrooled.setValue(0,0);
|
||||
etk::FSNode tmpFolder(m_folder);
|
||||
// Get the new list :
|
||||
m_list = tmpFolder.FolderGetSubList(m_showHidden, m_showFolder, m_showFile, m_showTemporaryFile);
|
||||
|
@ -152,8 +152,8 @@ void widget::Menu::OnReceiveMessage(ewol::EObject * CallerObject, const char * e
|
||||
vec2 tmpOri = eventFromWidget->GetOrigin();
|
||||
vec2 tmpSize = eventFromWidget->GetSize();
|
||||
// calculate the correct position
|
||||
newPosition.x = tmpOri.x + tmpSize.x/2;
|
||||
newPosition.y = tmpOri.y;
|
||||
newPosition.setValue(tmpOri.x() + tmpSize.x()/2,
|
||||
tmpOri.y() );
|
||||
}
|
||||
|
||||
m_widgetContextMenu->SetPositionMark(widget::CONTEXT_MENU_MARK_TOP, newPosition );
|
||||
|
@ -16,8 +16,7 @@
|
||||
widget::PopUp::PopUp(void) :
|
||||
m_subWidgetNext(NULL)
|
||||
{
|
||||
m_userExpend.x = true;
|
||||
m_userExpend.y = true;
|
||||
m_userExpend.setValue(true, true);
|
||||
|
||||
m_colorBackGroung = draw::color::white;
|
||||
|
||||
@ -40,32 +39,30 @@ bool widget::PopUp::CalculateSize(float availlableX, float availlableY)
|
||||
{
|
||||
//EWOL_DEBUG("CalculateSize(" << availlableX << "," << availlableY << ")");
|
||||
// pop-up fill all the display :
|
||||
m_size.x = availlableX;
|
||||
m_size.y = availlableY;
|
||||
m_size.setValue(availlableX, availlableY);
|
||||
|
||||
if (NULL != m_subWidget) {
|
||||
vec2 subWidgetSize;
|
||||
vec2 subWidgetOrigin;
|
||||
subWidgetSize = m_subWidget->GetMinSize();
|
||||
if (true == m_subWidget->CanExpentX()) {
|
||||
subWidgetSize.x = m_size.x;
|
||||
subWidgetSize.setX(m_size.x());
|
||||
}
|
||||
if (true == m_subWidget->CanExpentY()) {
|
||||
subWidgetSize.y = m_size.y;
|
||||
subWidgetSize.setY(m_size.y());
|
||||
}
|
||||
if (m_displayRatio>0.1 && m_displayRatio<=1) {
|
||||
subWidgetSize.x = etk_max(m_size.x*m_displayRatio, subWidgetSize.x);
|
||||
subWidgetSize.y = etk_max(m_size.y*m_displayRatio, subWidgetSize.y);
|
||||
subWidgetSize.setValue(etk_max(m_size.x()*m_displayRatio, subWidgetSize.x()),
|
||||
etk_max(m_size.y()*m_displayRatio, subWidgetSize.y()) );
|
||||
}
|
||||
// force to be an integer ...
|
||||
subWidgetSize.x = (int32_t)subWidgetSize.x;
|
||||
subWidgetSize.y = (int32_t)subWidgetSize.y;
|
||||
subWidgetSize.setValue((int32_t)subWidgetSize.x(), (int32_t)subWidgetSize.y());
|
||||
// set config to the Sub-widget
|
||||
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;
|
||||
subWidgetOrigin.setValue((int32_t)(m_size.x() - m_origin.x() - subWidgetSize.x())/2 + m_origin.x(),
|
||||
(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->SetOrigin(subWidgetOrigin.x(), subWidgetOrigin.y());
|
||||
m_subWidget->CalculateSize(subWidgetSize.x(), subWidgetSize.y());
|
||||
}
|
||||
MarkToRedraw();
|
||||
return true;
|
||||
@ -75,15 +72,12 @@ bool widget::PopUp::CalculateSize(float availlableX, float availlableY)
|
||||
bool widget::PopUp::CalculateMinSize(void)
|
||||
{
|
||||
//EWOL_DEBUG("CalculateMinSize");
|
||||
m_userExpend.x=false;
|
||||
m_userExpend.y=false;
|
||||
m_minSize.x = 50.0;
|
||||
m_minSize.y = 50.0;
|
||||
m_userExpend.setValue(false,false);
|
||||
m_minSize.setValue(50, 50);
|
||||
if (NULL != m_subWidget) {
|
||||
m_subWidget->CalculateMinSize();
|
||||
vec2 tmpSize = m_subWidget->GetMinSize();
|
||||
m_minSize.x = tmpSize.x;
|
||||
m_minSize.y = tmpSize.y;
|
||||
m_minSize = tmpSize;
|
||||
}
|
||||
//EWOL_DEBUG("CalculateMinSize(" << m_minSize.x << "," << m_minSize.y << ")");
|
||||
MarkToRedraw();
|
||||
@ -150,17 +144,17 @@ void widget::PopUp::OnRegenerateDisplay(void)
|
||||
|
||||
BGOObjects->SetColor(m_colorEmptyArea);
|
||||
BGOObjects->SetPos(vec3(0,0,0));
|
||||
BGOObjects->RectangleWidth(vec3(m_size.x, m_size.y, 0));
|
||||
BGOObjects->RectangleWidth(vec3(m_size.x(), m_size.y(), 0));
|
||||
// set the area in white ...
|
||||
if (NULL != m_subWidget) {
|
||||
vec2 tmpSize = m_subWidget->GetSize();
|
||||
vec2 tmpOrigin = m_subWidget->GetOrigin();
|
||||
BGOObjects->SetColor(m_colorBorder);
|
||||
BGOObjects->SetPos(vec3(tmpOrigin.x-BORDER_SIZE_TMP, tmpOrigin.y-BORDER_SIZE_TMP,0) );
|
||||
BGOObjects->RectangleWidth(vec3(tmpSize.x+2*BORDER_SIZE_TMP, tmpSize.y+2*BORDER_SIZE_TMP, 0) );
|
||||
BGOObjects->SetPos(vec3(tmpOrigin.x()-BORDER_SIZE_TMP, tmpOrigin.y()-BORDER_SIZE_TMP,0) );
|
||||
BGOObjects->RectangleWidth(vec3(tmpSize.x()+2*BORDER_SIZE_TMP, tmpSize.y()+2*BORDER_SIZE_TMP, 0) );
|
||||
BGOObjects->SetColor(m_colorBackGroung);
|
||||
BGOObjects->SetPos(vec3(tmpOrigin.x, tmpOrigin.y,0) );
|
||||
BGOObjects->RectangleWidth(vec3(tmpSize.x, tmpSize.y, 0) );
|
||||
BGOObjects->SetPos(vec3(tmpOrigin.x(), tmpOrigin.y(),0) );
|
||||
BGOObjects->RectangleWidth(vec3(tmpSize.x(), tmpSize.y(), 0) );
|
||||
}
|
||||
if (NULL != m_subWidget) {
|
||||
m_subWidget->OnRegenerateDisplay();
|
||||
@ -176,8 +170,8 @@ ewol::Widget * widget::PopUp::GetWidgetAtPos(vec2 pos)
|
||||
if (NULL != m_subWidget) {
|
||||
vec2 tmpSize = m_subWidget->GetSize();
|
||||
vec2 tmpOrigin = m_subWidget->GetOrigin();
|
||||
if( (tmpOrigin.x <= relativePos.x && tmpOrigin.x + tmpSize.x >= relativePos.x)
|
||||
&& (tmpOrigin.y <= relativePos.y && tmpOrigin.y + tmpSize.y >= relativePos.y) )
|
||||
if( (tmpOrigin.x() <= relativePos.x() && tmpOrigin.x() + tmpSize.x() >= relativePos.x())
|
||||
&& (tmpOrigin.y() <= relativePos.y() && tmpOrigin.y() + tmpSize.y() >= relativePos.y()) )
|
||||
{
|
||||
return m_subWidget->GetWidgetAtPos(pos);
|
||||
} else {
|
||||
|
@ -37,8 +37,8 @@ widget::ProgressBar::~ProgressBar(void)
|
||||
|
||||
bool widget::ProgressBar::CalculateMinSize(void)
|
||||
{
|
||||
m_minSize.x = etk_max(m_userMinSize.x, 40);
|
||||
m_minSize.y = etk_max(m_userMinSize.y, dotRadius*2);
|
||||
m_minSize.setValue( etk_max(m_userMinSize.x(), 40),
|
||||
etk_max(m_userMinSize.y(), dotRadius*2) );
|
||||
MarkToRedraw();
|
||||
return true;
|
||||
}
|
||||
@ -46,7 +46,7 @@ bool widget::ProgressBar::CalculateMinSize(void)
|
||||
|
||||
void widget::ProgressBar::ValueSet(float val)
|
||||
{
|
||||
m_value = etk_avg(0.0, val, 1.0);
|
||||
m_value = etk_avg(0, val, 1);
|
||||
MarkToRedraw();
|
||||
}
|
||||
|
||||
@ -67,8 +67,8 @@ void widget::ProgressBar::OnRegenerateDisplay(void)
|
||||
|
||||
tmpDraw->SetColor(m_textColorFg);
|
||||
|
||||
int32_t tmpSizeX = m_size.x - 10;
|
||||
int32_t tmpSizeY = m_size.y - 10;
|
||||
int32_t tmpSizeX = m_size.x() - 10;
|
||||
int32_t tmpSizeY = m_size.y() - 10;
|
||||
int32_t tmpOriginX = 5;
|
||||
int32_t tmpOriginY = 5;
|
||||
tmpDraw->SetColor(m_textColorBgOn);
|
||||
|
@ -1026,9 +1026,9 @@ void widget::Scene::PeriodicCall(int64_t localTime)
|
||||
// request back and forward in the same time ... this is really bad ....
|
||||
} else if ( (m_walk&WALK_FLAG_FORWARD)!=0) {
|
||||
vec3 angles = m_camera.GetAngle();
|
||||
angles.x = cosf(angles.z);
|
||||
angles.y = -sinf(angles.z);
|
||||
angles.z = 0;
|
||||
angles.setValue( cosf(angles.z()),
|
||||
-sinf(angles.z()),
|
||||
0);
|
||||
//EWOL_DEBUG("Walk : " << ((int32_t)(angles.z/M_PI*180+180)%360-180) << " ==> " << angles);
|
||||
vec3 pos = m_camera.GetPosition();
|
||||
// walk is 6 km/h
|
||||
@ -1036,9 +1036,9 @@ void widget::Scene::PeriodicCall(int64_t localTime)
|
||||
m_camera.SetPosition(pos);
|
||||
} else if ( (m_walk&WALK_FLAG_BACK)!=0) {
|
||||
vec3 angles = m_camera.GetAngle();
|
||||
angles.x = -cosf(angles.z);
|
||||
angles.y = sinf(angles.z);
|
||||
angles.z = 0;
|
||||
angles.setValue(-cosf(angles.z()),
|
||||
sinf(angles.z()),
|
||||
0);
|
||||
//EWOL_DEBUG("Walk : " << ((int32_t)(angles.z/M_PI*180+180)%360-180) << " ==> " << angles);
|
||||
vec3 pos = m_camera.GetPosition();
|
||||
// walk is 6 km/h
|
||||
@ -1051,9 +1051,9 @@ void widget::Scene::PeriodicCall(int64_t localTime)
|
||||
// request left and right in the same time ... this is really bad ....
|
||||
} else if ( (m_walk&WALK_FLAG_LEFT)!=0) {
|
||||
vec3 angles = m_camera.GetAngle();
|
||||
angles.x = cosf(angles.z-M_PI/2.0);
|
||||
angles.y = -sinf(angles.z-M_PI/2.0);
|
||||
angles.z = 0;
|
||||
angles.setValue( cosf(angles.z()-M_PI/2.0),
|
||||
-sinf(angles.z()-M_PI/2.0),
|
||||
0);
|
||||
//EWOL_DEBUG("Walk : " << ((int32_t)(angles.z/M_PI*180+180)%360-180) << " ==> " << angles);
|
||||
vec3 pos = m_camera.GetPosition();
|
||||
// lateral walk is 4 km/h
|
||||
@ -1061,9 +1061,9 @@ void widget::Scene::PeriodicCall(int64_t localTime)
|
||||
m_camera.SetPosition(pos);
|
||||
} else if ( (m_walk&WALK_FLAG_RIGHT)!=0) {
|
||||
vec3 angles = m_camera.GetAngle();
|
||||
angles.x = -cosf(angles.z-M_PI/2.0);
|
||||
angles.y = sinf(angles.z-M_PI/2.0);
|
||||
angles.z = 0;
|
||||
angles.setValue(-cosf(angles.z()-M_PI/2.0),
|
||||
sinf(angles.z()-M_PI/2.0),
|
||||
0);
|
||||
//EWOL_DEBUG("Walk : " << ((int32_t)(angles.z/M_PI*180+180)%360-180) << " ==> " << angles);
|
||||
vec3 pos = m_camera.GetPosition();
|
||||
// lateral walk is 4 km/h
|
||||
@ -1078,11 +1078,11 @@ void widget::Scene::GenDraw(ewol::DrawProperty displayProp)
|
||||
{
|
||||
ewol::openGL::Push();
|
||||
// here we invert the reference of the standard OpenGl view because the reference in the common display is Top left and not buttom left
|
||||
glViewport( m_origin.x,
|
||||
m_origin.y,
|
||||
m_size.x,
|
||||
m_size.y);
|
||||
float ratio = m_size.x / m_size.y;
|
||||
glViewport( m_origin.x(),
|
||||
m_origin.y(),
|
||||
m_size.x(),
|
||||
m_size.y());
|
||||
float ratio = m_size.x() / m_size.y();
|
||||
//EWOL_INFO("ratio : " << ratio);
|
||||
mat4 tmpProjection = etk::matPerspective( M_PI/3.0, ratio, 1, 4000);
|
||||
ewol::openGL::SetCameraMatrix(m_camera.GetMatrix());
|
||||
@ -1104,30 +1104,25 @@ void widget::Scene::GenDraw(ewol::DrawProperty displayProp)
|
||||
vec2 widget::Scene::RelativePosition(vec2 pos)
|
||||
{
|
||||
// Remove origin of the widget
|
||||
pos.x -= m_origin.x;
|
||||
pos.y -= m_origin.y;
|
||||
pos -= vec2(m_origin.x(), m_origin.y());
|
||||
// move the position at the center (openGl system
|
||||
pos.x -= m_size.x/2;
|
||||
pos.y -= m_size.y/2;
|
||||
pos -= vec2(m_size.x()/2, m_size.y()/2);
|
||||
// scale the position with the ratio display of the screen
|
||||
float ratio = m_size.x / m_size.y;
|
||||
float ratio = m_size.x() / m_size.y();
|
||||
if (ratio >= 1.0) {
|
||||
pos.x /= m_size.x;
|
||||
pos.x *= ratio;
|
||||
pos.y /= m_size.y;
|
||||
pos.setX((pos.x() / m_size.x()) * ratio);
|
||||
pos.setY(pos.y() / m_size.y());
|
||||
} else {
|
||||
ratio = 1.0/ratio;
|
||||
pos.x /= m_size.x;
|
||||
pos.y /= m_size.y;
|
||||
pos.y *= ratio;
|
||||
pos.setX(pos.x() / m_size.x());
|
||||
pos.setY((pos.y() / m_size.y())* ratio);
|
||||
}
|
||||
// integrate zoom
|
||||
pos.x /= m_zoom;
|
||||
pos.y /= m_zoom;
|
||||
pos.setValue( pos.x()/m_zoom,
|
||||
pos.y()/m_zoom);
|
||||
// all the position are half the size due to the fact -1 --> 1
|
||||
pos.x *= 2;
|
||||
pos.y *= 2;
|
||||
|
||||
pos.setValue( pos.x()*2,
|
||||
pos.y()*2);
|
||||
return pos;
|
||||
};
|
||||
|
||||
@ -1146,8 +1141,8 @@ bool widget::Scene::OnEventInput(ewol::keyEvent::type_te type, int32_t IdInput,
|
||||
if (ewol::keyEvent::statusMove == statusEvent) {
|
||||
pos *= M_PI/(360.0f*6);
|
||||
vec3 oldAngles = m_camera.GetAngle();
|
||||
oldAngles.z += pos.x;
|
||||
oldAngles.y += pos.y;
|
||||
oldAngles.setZ(oldAngles.z() + pos.x());
|
||||
oldAngles.setY(oldAngles.y() + pos.y());
|
||||
m_camera.SetAngle(oldAngles);
|
||||
}
|
||||
}
|
||||
|
@ -27,8 +27,7 @@ widget::SizerHori::~SizerHori(void)
|
||||
bool widget::SizerHori::CalculateSize(float availlableX, float availlableY)
|
||||
{
|
||||
//EWOL_DEBUG("Update Size");
|
||||
m_size.x = availlableX;
|
||||
m_size.y = availlableY;
|
||||
m_size.setValue(availlableX, availlableY);
|
||||
// calculate unExpendable Size :
|
||||
float unexpendableSize=0.0;
|
||||
int32_t nbWidgetFixedSize=0;
|
||||
@ -36,7 +35,7 @@ bool widget::SizerHori::CalculateSize(float availlableX, float availlableY)
|
||||
for (int32_t iii=0; iii<m_subWidget.Size(); iii++) {
|
||||
if (NULL != m_subWidget[iii]) {
|
||||
vec2 tmpSize = m_subWidget[iii]->GetMinSize();
|
||||
unexpendableSize += tmpSize.x;
|
||||
unexpendableSize += tmpSize.x();
|
||||
if (false == m_subWidget[iii]->CanExpentX()) {
|
||||
nbWidgetFixedSize++;
|
||||
} else {
|
||||
@ -47,27 +46,25 @@ bool widget::SizerHori::CalculateSize(float availlableX, float availlableY)
|
||||
float sizeToAddAtEveryOne = 0;
|
||||
// 2 cases : 1 or more can Expend, or all is done ...
|
||||
if (0 != nbWidgetNotFixedSize) {
|
||||
sizeToAddAtEveryOne = (m_size.x - unexpendableSize) / nbWidgetNotFixedSize;
|
||||
sizeToAddAtEveryOne = (m_size.x() - unexpendableSize) / nbWidgetNotFixedSize;
|
||||
if (sizeToAddAtEveryOne<0.0) {
|
||||
sizeToAddAtEveryOne=0;
|
||||
}
|
||||
}
|
||||
vec2 tmpOrigin;
|
||||
tmpOrigin.x = m_origin.x;
|
||||
tmpOrigin.y = m_origin.y;
|
||||
vec2 tmpOrigin = m_origin;
|
||||
for (int32_t iii=0; iii<m_subWidget.Size(); iii++) {
|
||||
if (NULL != m_subWidget[iii]) {
|
||||
vec2 tmpSize = m_subWidget[iii]->GetMinSize();
|
||||
// Set the origin :
|
||||
//EWOL_DEBUG("Set ORIGIN : " << tmpOrigin.x << "," << tmpOrigin.y << ")");
|
||||
m_subWidget[iii]->SetOrigin(tmpOrigin.x, tmpOrigin.y);
|
||||
m_subWidget[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);
|
||||
tmpOrigin.x += tmpSize.x+sizeToAddAtEveryOne;
|
||||
m_subWidget[iii]->CalculateSize(tmpSize.x()+sizeToAddAtEveryOne, m_size.y());
|
||||
tmpOrigin.setX(tmpOrigin.x() + tmpSize.x()+sizeToAddAtEveryOne);
|
||||
} else {
|
||||
m_subWidget[iii]->CalculateSize(tmpSize.x, m_size.y);
|
||||
tmpOrigin.x += tmpSize.x;
|
||||
m_subWidget[iii]->CalculateSize(tmpSize.x(), m_size.y());
|
||||
tmpOrigin.setX(tmpOrigin.x() + tmpSize.x());
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -79,23 +76,21 @@ bool widget::SizerHori::CalculateSize(float availlableX, float availlableY)
|
||||
bool widget::SizerHori::CalculateMinSize(void)
|
||||
{
|
||||
//EWOL_DEBUG("Update minimum Size");
|
||||
m_userExpend.x=false;
|
||||
m_userExpend.y=false;
|
||||
m_minSize.x = 0.0;
|
||||
m_minSize.y = 0.0;
|
||||
m_userExpend.setValue(false, false);
|
||||
m_minSize.setValue(0, 0);
|
||||
for (int32_t iii=0; iii<m_subWidget.Size(); iii++) {
|
||||
if (NULL != m_subWidget[iii]) {
|
||||
m_subWidget[iii]->CalculateMinSize();
|
||||
if (true == m_subWidget[iii]->CanExpentX()) {
|
||||
m_userExpend.x = true;
|
||||
m_userExpend.setX(true);
|
||||
}
|
||||
if (true == m_subWidget[iii]->CanExpentY()) {
|
||||
m_userExpend.y = true;
|
||||
m_userExpend.setY(true);
|
||||
}
|
||||
vec2 tmpSize = m_subWidget[iii]->GetMinSize();
|
||||
m_minSize.x += tmpSize.x;
|
||||
if (tmpSize.y>m_minSize.y) {
|
||||
m_minSize.y = tmpSize.y;
|
||||
m_minSize.setX(m_minSize.x() + tmpSize.x());
|
||||
if (tmpSize.y()>m_minSize.y()) {
|
||||
m_minSize.setY(tmpSize.y());
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -119,7 +114,7 @@ bool widget::SizerHori::CanExpentX(void)
|
||||
if (true == m_lockExpendContamination) {
|
||||
return false;
|
||||
}
|
||||
return m_userExpend.x;
|
||||
return m_userExpend.x();
|
||||
}
|
||||
|
||||
void widget::SizerHori::SetExpendY(bool newExpend)
|
||||
@ -132,7 +127,7 @@ bool widget::SizerHori::CanExpentY(void)
|
||||
if (true == m_lockExpendContamination) {
|
||||
return false;
|
||||
}
|
||||
return m_userExpend.y;
|
||||
return m_userExpend.y();
|
||||
}
|
||||
|
||||
void widget::SizerHori::LockExpendContamination(bool lockExpend)
|
||||
@ -226,8 +221,8 @@ ewol::Widget * widget::SizerHori::GetWidgetAtPos(vec2 pos)
|
||||
if (NULL != m_subWidget[iii]) {
|
||||
vec2 tmpSize = m_subWidget[iii]->GetSize();
|
||||
vec2 tmpOrigin = m_subWidget[iii]->GetOrigin();
|
||||
if( (tmpOrigin.x <= pos.x && tmpOrigin.x + tmpSize.x >= pos.x)
|
||||
&& (tmpOrigin.y <= pos.y && tmpOrigin.y + tmpSize.y >= pos.y) )
|
||||
if( (tmpOrigin.x() <= pos.x() && tmpOrigin.x() + tmpSize.x() >= pos.x())
|
||||
&& (tmpOrigin.y() <= pos.y() && tmpOrigin.y() + tmpSize.y() >= pos.y()) )
|
||||
{
|
||||
ewol::Widget * tmpWidget = m_subWidget[iii]->GetWidgetAtPos(pos);
|
||||
if (NULL != tmpWidget) {
|
||||
|
@ -29,8 +29,7 @@ widget::SizerVert::~SizerVert(void)
|
||||
bool widget::SizerVert::CalculateSize(float availlableX, float availlableY)
|
||||
{
|
||||
//EWOL_DEBUG("Update Size");
|
||||
m_size.x = availlableX;
|
||||
m_size.y = availlableY;
|
||||
m_size.setValue(availlableX, availlableY);
|
||||
// calculate unExpendable Size :
|
||||
float unexpendableSize=0.0;
|
||||
int32_t nbWidgetFixedSize=0;
|
||||
@ -38,7 +37,7 @@ bool widget::SizerVert::CalculateSize(float availlableX, float availlableY)
|
||||
for (int32_t iii=0; iii<m_subWidget.Size(); iii++) {
|
||||
if (NULL != m_subWidget[iii]) {
|
||||
vec2 tmpSize = m_subWidget[iii]->GetMinSize();
|
||||
unexpendableSize += tmpSize.y;
|
||||
unexpendableSize += tmpSize.y();
|
||||
if (false == m_subWidget[iii]->CanExpentY()) {
|
||||
nbWidgetFixedSize++;
|
||||
} else {
|
||||
@ -50,27 +49,25 @@ bool widget::SizerVert::CalculateSize(float availlableX, float availlableY)
|
||||
float sizeToAddAtEveryOne = 0;
|
||||
// 2 cases : 1 or more can Expend, or all is done ...
|
||||
if (0 != nbWidgetNotFixedSize) {
|
||||
sizeToAddAtEveryOne = (m_size.y - unexpendableSize) / nbWidgetNotFixedSize;
|
||||
sizeToAddAtEveryOne = (m_size.y() - unexpendableSize) / nbWidgetNotFixedSize;
|
||||
if (sizeToAddAtEveryOne<0.0) {
|
||||
sizeToAddAtEveryOne=0;
|
||||
}
|
||||
}
|
||||
vec2 tmpOrigin;
|
||||
tmpOrigin.x = m_origin.x;
|
||||
tmpOrigin.y = m_origin.y;
|
||||
vec2 tmpOrigin = m_origin;
|
||||
for (int32_t iii=0; iii<m_subWidget.Size(); iii++) {
|
||||
if (NULL != m_subWidget[iii]) {
|
||||
vec2 tmpSize = m_subWidget[iii]->GetMinSize();
|
||||
// Set the origin :
|
||||
//EWOL_DEBUG("Set ORIGIN : " << tmpOrigin.x << "," << tmpOrigin.y << ")");
|
||||
m_subWidget[iii]->SetOrigin(tmpOrigin.x, tmpOrigin.y);
|
||||
m_subWidget[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);
|
||||
tmpOrigin.y += tmpSize.y+sizeToAddAtEveryOne;
|
||||
m_subWidget[iii]->CalculateSize(m_size.x(), tmpSize.y()+sizeToAddAtEveryOne);
|
||||
tmpOrigin.setY(tmpOrigin.y() + tmpSize.y()+sizeToAddAtEveryOne);
|
||||
} else {
|
||||
m_subWidget[iii]->CalculateSize(m_size.x, tmpSize.y);
|
||||
tmpOrigin.y += tmpSize.y;
|
||||
m_subWidget[iii]->CalculateSize(m_size.x(), tmpSize.y());
|
||||
tmpOrigin.setY(tmpOrigin.y() + tmpSize.y());
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -82,24 +79,22 @@ bool widget::SizerVert::CalculateSize(float availlableX, float availlableY)
|
||||
bool widget::SizerVert::CalculateMinSize(void)
|
||||
{
|
||||
//EWOL_DEBUG("Update minimum Size");
|
||||
m_userExpend.x=false;
|
||||
m_userExpend.y=false;
|
||||
m_minSize.x = 0.0;
|
||||
m_minSize.y = 0.0;
|
||||
m_userExpend.setValue(false, false);
|
||||
m_minSize.setValue(0,0);
|
||||
for (int32_t iii=0; iii<m_subWidget.Size(); iii++) {
|
||||
if (NULL != m_subWidget[iii]) {
|
||||
m_subWidget[iii]->CalculateMinSize();
|
||||
if (true == m_subWidget[iii]->CanExpentX()) {
|
||||
m_userExpend.x = true;
|
||||
m_userExpend.setX(true);
|
||||
}
|
||||
if (true == m_subWidget[iii]->CanExpentY()) {
|
||||
m_userExpend.y = true;
|
||||
m_userExpend.setY(true);
|
||||
}
|
||||
vec2 tmpSize = m_subWidget[iii]->GetMinSize();
|
||||
//EWOL_DEBUG(" Get minSize[" << iii << "] ("<< tmpSize.x << "," << tmpSize.y << ")");
|
||||
m_minSize.y += tmpSize.y;
|
||||
if (tmpSize.x>m_minSize.x) {
|
||||
m_minSize.x = tmpSize.x;
|
||||
m_minSize.setY(m_minSize.y() + tmpSize.y());
|
||||
if (tmpSize.x()>m_minSize.x()) {
|
||||
m_minSize.setX(tmpSize.x());
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -123,7 +118,7 @@ bool widget::SizerVert::CanExpentX(void)
|
||||
if (true == m_lockExpendContamination) {
|
||||
return false;
|
||||
}
|
||||
return m_userExpend.x;
|
||||
return m_userExpend.x();
|
||||
}
|
||||
|
||||
void widget::SizerVert::SetExpendY(bool newExpend)
|
||||
@ -136,7 +131,7 @@ bool widget::SizerVert::CanExpentY(void)
|
||||
if (true == m_lockExpendContamination) {
|
||||
return false;
|
||||
}
|
||||
return m_userExpend.y;
|
||||
return m_userExpend.y();
|
||||
}
|
||||
|
||||
void widget::SizerVert::LockExpendContamination(bool lockExpend)
|
||||
@ -229,8 +224,8 @@ ewol::Widget * widget::SizerVert::GetWidgetAtPos(vec2 pos)
|
||||
if (NULL != m_subWidget[iii]) {
|
||||
vec2 tmpSize = m_subWidget[iii]->GetSize();
|
||||
vec2 tmpOrigin = m_subWidget[iii]->GetOrigin();
|
||||
if( (tmpOrigin.x <= pos.x && tmpOrigin.x + tmpSize.x >= pos.x)
|
||||
&& (tmpOrigin.y <= pos.y && tmpOrigin.y + tmpSize.y >= pos.y) )
|
||||
if( (tmpOrigin.x() <= pos.x() && tmpOrigin.x() + tmpSize.x() >= pos.x())
|
||||
&& (tmpOrigin.y() <= pos.y() && tmpOrigin.y() + tmpSize.y() >= pos.y()) )
|
||||
{
|
||||
ewol::Widget * tmpWidget = m_subWidget[iii]->GetWidgetAtPos(pos);
|
||||
if (NULL != tmpWidget) {
|
||||
|
@ -46,8 +46,8 @@ widget::Slider::~Slider(void)
|
||||
|
||||
bool widget::Slider::CalculateMinSize(void)
|
||||
{
|
||||
m_minSize.x = etk_max(m_userMinSize.x, 40);
|
||||
m_minSize.y = etk_max(m_userMinSize.y, dotRadius*2);
|
||||
m_minSize.setValue(etk_max(m_userMinSize.x(), 40),
|
||||
etk_max(m_userMinSize.y(), dotRadius*2) );
|
||||
MarkToRedraw();
|
||||
return true;
|
||||
}
|
||||
@ -93,13 +93,13 @@ void widget::Slider::OnRegenerateDisplay(void)
|
||||
tmpDraw->SetColor(m_textColorFg);
|
||||
// draw a line :
|
||||
tmpDraw->SetThickness(1);
|
||||
tmpDraw->SetPos(vec3(dotRadius, m_size.y/2) );
|
||||
tmpDraw->LineTo(vec3(m_size.x-dotRadius, m_size.y/2) );
|
||||
tmpDraw->SetPos(vec3(dotRadius, m_size.y()/2, 0) );
|
||||
tmpDraw->LineTo(vec3(m_size.x()-dotRadius, m_size.y()/2, 0) );
|
||||
tmpDraw->SetThickness(0);
|
||||
|
||||
draw::Color borderDot = m_textColorFg;
|
||||
borderDot.a /= 2;
|
||||
tmpDraw->SetPos(vec3(4+((float)(m_value-m_min)/(float)(m_max-m_min))*(float)(m_size.x-2*dotRadius), m_size.y/2) );
|
||||
tmpDraw->SetPos(vec3(4+((float)(m_value-m_min)/(float)(m_max-m_min))*(float)(m_size.x()-2*dotRadius), m_size.y()/2, 0) );
|
||||
tmpDraw->SetColorBg(borderDot);
|
||||
tmpDraw->Circle(dotRadius);
|
||||
tmpDraw->SetColorBg(m_textColorFg);
|
||||
@ -117,9 +117,9 @@ bool widget::Slider::OnEventInput(ewol::keyEvent::type_te type, int32_t IdInput,
|
||||
if( ewol::keyEvent::statusSingle == typeEvent
|
||||
|| ewol::keyEvent::statusMove == typeEvent) {
|
||||
// get the new position :
|
||||
EWOL_VERBOSE("Event on Slider (" << relativePos.x << "," << relativePos.y << ")");
|
||||
EWOL_VERBOSE("Event on Slider (" << relativePos.x() << "," << relativePos.y() << ")");
|
||||
int32_t oldValue = m_value;
|
||||
m_value = m_min + (float)(relativePos.x - dotRadius) / (float)(m_size.x-2*dotRadius) * (float)(m_max-m_min);
|
||||
m_value = m_min + (float)(relativePos.x() - dotRadius) / (float)(m_size.x()-2*dotRadius) * (float)(m_max-m_min);
|
||||
m_value = etk_max(etk_min(m_value, m_max), m_min);
|
||||
if (oldValue != m_value) {
|
||||
EWOL_DEBUG(" new value : " << m_value << " in [" << m_min << ".." << m_max << "]");
|
||||
|
@ -32,8 +32,7 @@ widget::Spacer::~Spacer(void)
|
||||
|
||||
bool widget::Spacer::CalculateMinSize(void)
|
||||
{
|
||||
m_minSize.x = m_localSize;
|
||||
m_minSize.y = m_localSize;
|
||||
m_minSize.setValue(m_localSize, m_localSize);
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -64,6 +63,6 @@ void widget::Spacer::OnRegenerateDisplay(void)
|
||||
}
|
||||
m_draw.SetColor(m_color);
|
||||
m_draw.SetPos(vec3(0, 0, 0) );
|
||||
m_draw.RectangleWidth(vec3(m_size.x, m_size.y) );
|
||||
m_draw.RectangleWidth(vec3(m_size.x(), m_size.y(),0) );
|
||||
}
|
||||
|
||||
|
@ -22,8 +22,7 @@ widget::WSlider::WSlider(void)
|
||||
m_windowsDestination = 0;
|
||||
m_slidingProgress = 0;
|
||||
m_windowsSources = 0;
|
||||
m_underExpend.x = false;
|
||||
m_underExpend.y = false;
|
||||
m_underExpend.setValue(false,false);
|
||||
}
|
||||
|
||||
widget::WSlider::~WSlider(void)
|
||||
@ -35,30 +34,29 @@ widget::WSlider::~WSlider(void)
|
||||
bool widget::WSlider::CalculateSize(float availlableX, float availlableY)
|
||||
{
|
||||
//EWOL_DEBUG("Update Size");
|
||||
m_size.x = availlableX;
|
||||
m_size.y = availlableY;
|
||||
m_size.setValue(availlableX, availlableY);
|
||||
|
||||
if (m_windowsDestination == m_windowsSources) {
|
||||
int32_t iii = m_windowsDestination;
|
||||
if (iii < m_subWidget.Size()) {
|
||||
if (NULL != m_subWidget[iii]) {
|
||||
m_subWidget[iii]->SetOrigin(m_origin.x, m_origin.y);
|
||||
m_subWidget[iii]->CalculateSize(m_size.x, m_size.y);
|
||||
m_subWidget[iii]->SetOrigin(m_origin.x(), m_origin.y());
|
||||
m_subWidget[iii]->CalculateSize(m_size.x(), m_size.y());
|
||||
}
|
||||
}
|
||||
} else {
|
||||
int32_t iii = m_windowsSources;
|
||||
if (iii < m_subWidget.Size()) {
|
||||
if (NULL != m_subWidget[iii]) {
|
||||
m_subWidget[iii]->SetOrigin(m_origin.x - (m_size.x*(float)m_slidingProgress/1000.0), m_origin.y);
|
||||
m_subWidget[iii]->CalculateSize(m_size.x, m_size.y);
|
||||
m_subWidget[iii]->SetOrigin(m_origin.x() - (m_size.x()*(float)m_slidingProgress/1000.0), m_origin.y());
|
||||
m_subWidget[iii]->CalculateSize(m_size.x(), m_size.y());
|
||||
}
|
||||
}
|
||||
iii = m_windowsDestination;
|
||||
if (iii < m_subWidget.Size()) {
|
||||
if (NULL != m_subWidget[iii]) {
|
||||
m_subWidget[iii]->SetOrigin(m_origin.x - (m_size.x*((float)m_slidingProgress/1000.0) - m_size.x), m_origin.y);
|
||||
m_subWidget[iii]->CalculateSize(m_size.x, m_size.y);
|
||||
m_subWidget[iii]->SetOrigin(m_origin.x() - (m_size.x()*((float)m_slidingProgress/1000.0) - m_size.x()), m_origin.y());
|
||||
m_subWidget[iii]->CalculateSize(m_size.x(), m_size.y());
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -70,22 +68,20 @@ bool widget::WSlider::CalculateSize(float availlableX, float availlableY)
|
||||
bool widget::WSlider::CalculateMinSize(void)
|
||||
{
|
||||
EWOL_DEBUG("Calculate MinSize");
|
||||
m_underExpend.x=false;
|
||||
m_underExpend.y=false;
|
||||
m_minSize.x = 0.0;
|
||||
m_minSize.y = 0.0;
|
||||
m_underExpend.setValue(false,false);
|
||||
m_minSize.setValue(0,0);
|
||||
for (int32_t iii=0; iii<m_subWidget.Size(); iii++) {
|
||||
if (NULL != m_subWidget[iii]) {
|
||||
m_subWidget[iii]->CalculateMinSize();
|
||||
if (true == m_subWidget[iii]->CanExpentX()) {
|
||||
m_underExpend.x = true;
|
||||
m_underExpend.setX(true);
|
||||
}
|
||||
if (true == m_subWidget[iii]->CanExpentY()) {
|
||||
m_underExpend.y = true;
|
||||
m_underExpend.setY(true);
|
||||
}
|
||||
vec2 tmpSize = m_subWidget[iii]->GetMinSize();
|
||||
m_minSize.x = etk_max(tmpSize.x, m_minSize.x);
|
||||
m_minSize.y = etk_max(tmpSize.y, m_minSize.y);
|
||||
m_minSize.setValue(etk_max(tmpSize.x(), m_minSize.x()),
|
||||
etk_max(tmpSize.y(), m_minSize.y()));
|
||||
}
|
||||
}
|
||||
return true;
|
||||
@ -98,24 +94,24 @@ void widget::WSlider::SetMinSise(float x, float y)
|
||||
|
||||
bool widget::WSlider::CanExpentX(void)
|
||||
{
|
||||
if (m_userExpend.x == true) {
|
||||
if (m_userExpend.x() == true) {
|
||||
return true;
|
||||
}
|
||||
if (true == m_lockExpendContamination) {
|
||||
return false;
|
||||
}
|
||||
return m_underExpend.x;
|
||||
return m_underExpend.x();
|
||||
}
|
||||
|
||||
bool widget::WSlider::CanExpentY(void)
|
||||
{
|
||||
if (m_userExpend.y == true) {
|
||||
if (m_userExpend.y() == true) {
|
||||
return true;
|
||||
}
|
||||
if (true == m_lockExpendContamination) {
|
||||
return false;
|
||||
}
|
||||
return m_underExpend.y;
|
||||
return m_underExpend.y();
|
||||
}
|
||||
|
||||
void widget::WSlider::LockExpendContamination(bool lockExpend)
|
||||
@ -201,7 +197,7 @@ void widget::WSlider::PeriodicCall(int64_t localTime)
|
||||
m_slidingProgress += 30;
|
||||
m_slidingProgress = etk_avg(0, m_slidingProgress, 1000);
|
||||
}
|
||||
CalculateSize(m_size.x, m_size.y);
|
||||
CalculateSize(m_size.x(), m_size.y());
|
||||
MarkToRedraw();
|
||||
}
|
||||
|
||||
@ -280,8 +276,8 @@ ewol::Widget * widget::WSlider::GetWidgetAtPos(vec2 pos)
|
||||
if (NULL != m_subWidget[iii]) {
|
||||
vec2 tmpSize = m_subWidget[iii]->GetSize();
|
||||
vec2 tmpOrigin = m_subWidget[iii]->GetOrigin();
|
||||
if( (tmpOrigin.x <= pos.x && tmpOrigin.x + tmpSize.x >= pos.x)
|
||||
&& (tmpOrigin.y <= pos.y && tmpOrigin.y + tmpSize.y >= pos.y) )
|
||||
if( (tmpOrigin.x() <= pos.x() && tmpOrigin.x() + tmpSize.x() >= pos.x())
|
||||
&& (tmpOrigin.y() <= pos.y() && tmpOrigin.y() + tmpSize.y() >= pos.y()) )
|
||||
{
|
||||
ewol::Widget * tmpWidget = m_subWidget[iii]->GetWidgetAtPos(pos);
|
||||
if (NULL != tmpWidget) {
|
||||
|
@ -24,15 +24,11 @@ ewol::Widget::Widget(void) :
|
||||
{
|
||||
m_limitMouseEvent = 3;
|
||||
m_needRegenerateDisplay = true;
|
||||
m_origin.x = 0.0;
|
||||
m_origin.y = 0.0;
|
||||
m_size.x = 10.0;
|
||||
m_size.y = 10.0;
|
||||
m_minSize.x = -1.0;
|
||||
m_minSize.y = -1.0;
|
||||
m_origin.setValue(0,0);
|
||||
m_size.setValue(10,10);
|
||||
m_minSize.setValue(-1,-1);
|
||||
// user settings :
|
||||
m_userMinSize.x = -1.0;
|
||||
m_userMinSize.y = -1.0;
|
||||
m_userMinSize.setValue(-1,-1);
|
||||
SetExpendX();
|
||||
SetExpendY();
|
||||
SetFillX();
|
||||
@ -74,8 +70,7 @@ void ewol::Widget::Show(void)
|
||||
|
||||
bool ewol::Widget::CalculateSize(float availlableX, float availlableY)
|
||||
{
|
||||
m_size.x = availlableX;
|
||||
m_size.y = availlableY;
|
||||
m_size.setValue(availlableX, availlableY);
|
||||
MarkToRedraw();
|
||||
return true;
|
||||
}
|
||||
@ -125,49 +120,47 @@ void ewol::Widget::GenDraw(DrawProperty displayProp)
|
||||
return;
|
||||
}
|
||||
// check if the element is displayable in the windows :
|
||||
if( displayProp.m_windowsSize.x < m_origin.x
|
||||
|| displayProp.m_windowsSize.y < m_origin.y ) {
|
||||
if( displayProp.m_windowsSize.x() < m_origin.x()
|
||||
|| displayProp.m_windowsSize.y() < m_origin.y() ) {
|
||||
// out of the windows ==> nothing to display ...
|
||||
return;
|
||||
}
|
||||
ewol::openGL::Push();
|
||||
if( (displayProp.m_origin.x > m_origin.x)
|
||||
|| (displayProp.m_origin.x + displayProp.m_size.x < m_size.x + m_origin.x) ) {
|
||||
if( (displayProp.m_origin.x() > m_origin.x())
|
||||
|| (displayProp.m_origin.x() + displayProp.m_size.x() < m_size.x() + m_origin.x()) ) {
|
||||
// here we invert the reference of the standard OpenGl view because the reference in the common display is Top left and not buttom left
|
||||
int32_t tmpOriginX = etk_max(displayProp.m_origin.x, m_origin.x);
|
||||
int32_t tmppp1 = displayProp.m_origin.x + displayProp.m_size.x;
|
||||
int32_t tmppp2 = m_origin.x + m_size.x;
|
||||
int32_t tmpOriginX = etk_max(displayProp.m_origin.x(), m_origin.x());
|
||||
int32_t tmppp1 = displayProp.m_origin.x() + displayProp.m_size.x();
|
||||
int32_t tmppp2 = m_origin.x() + m_size.x();
|
||||
int32_t tmpclipX = etk_min(tmppp1, tmppp2) - tmpOriginX;
|
||||
|
||||
int32_t tmpOriginY = etk_max(displayProp.m_origin.y, m_origin.y);
|
||||
tmppp1 = displayProp.m_origin.y + displayProp.m_size.y;
|
||||
tmppp2 = m_origin.y + m_size.y;
|
||||
int32_t tmpOriginY = etk_max(displayProp.m_origin.y(), m_origin.y());
|
||||
tmppp1 = displayProp.m_origin.y() + displayProp.m_size.y();
|
||||
tmppp2 = m_origin.y() + m_size.y();
|
||||
//int32_t tmpclipY = etk_min(tmppp1, tmppp2) - tmpOriginX;
|
||||
|
||||
glViewport( tmpOriginX,
|
||||
tmpOriginY,
|
||||
tmpclipX,
|
||||
m_size.y);
|
||||
mat4 tmpTranslate = etk::matTranslate(vec3((float)(-tmpclipX/2 - (tmpOriginX-m_origin.x)), (float)(-m_size.y/2.0), -1.0f));
|
||||
mat4 tmpScale = etk::matScale(vec3(m_zoom, m_zoom, 1.0f));
|
||||
mat4 tmpProjection = etk::matOrtho(-tmpclipX/2, tmpclipX/2, -m_size.y/2, m_size.y/2, -1, 1);
|
||||
m_size.y());
|
||||
mat4 tmpTranslate = etk::matTranslate(vec3((float)(-tmpclipX/2 - (tmpOriginX-m_origin.x())), (float)(-m_size.y()/2.0), -1.0f));
|
||||
mat4 tmpScale = etk::matScale(vec3(m_zoom, m_zoom, 1));
|
||||
mat4 tmpProjection = etk::matOrtho(-tmpclipX/2, tmpclipX/2, -m_size.y()/2, m_size.y()/2, -1, 1);
|
||||
mat4 tmpMat = tmpProjection * tmpScale * tmpTranslate;
|
||||
// set internal matrix system :
|
||||
ewol::openGL::SetMatrix(tmpMat);
|
||||
// Call the widget drawing methode
|
||||
displayProp.m_origin.x = tmpOriginX;
|
||||
displayProp.m_origin.y = tmpOriginY;
|
||||
displayProp.m_size.x = tmpclipX;
|
||||
displayProp.m_size.y = m_size.y;
|
||||
displayProp.m_origin.setValue(tmpOriginX, tmpOriginY);
|
||||
displayProp.m_size.setValue(tmpclipX, m_size.y());
|
||||
OnDraw(displayProp);
|
||||
} else {
|
||||
glViewport( m_origin.x,
|
||||
m_origin.y,
|
||||
m_size.x,
|
||||
m_size.y);
|
||||
mat4 tmpTranslate = etk::matTranslate(vec3(-m_size.x/2, -m_size.y/2, -1.0f));
|
||||
glViewport( m_origin.x(),
|
||||
m_origin.y(),
|
||||
m_size.x(),
|
||||
m_size.y());
|
||||
mat4 tmpTranslate = etk::matTranslate(vec3(-m_size.x()/2, -m_size.y()/2, -1.0f));
|
||||
mat4 tmpScale = etk::matScale(vec3(m_zoom, m_zoom, 1.0f));
|
||||
mat4 tmpProjection = etk::matOrtho(-m_size.x/2, m_size.x/2, -m_size.y/2, m_size.y/2, -1, 1);
|
||||
mat4 tmpProjection = etk::matOrtho(-m_size.x()/2, m_size.x()/2, -m_size.y()/2, m_size.y()/2, -1, 1);
|
||||
mat4 tmpMat = tmpProjection * tmpScale * tmpTranslate;
|
||||
// set internal matrix system :
|
||||
ewol::openGL::SetMatrix(tmpMat);
|
||||
@ -211,8 +204,7 @@ float ewol::Widget::GetZoom(void)
|
||||
|
||||
void ewol::Widget::SetOrigin(float x, float y)
|
||||
{
|
||||
m_origin.x=x;
|
||||
m_origin.y=y;
|
||||
m_origin.setValue(x, y);
|
||||
}
|
||||
|
||||
vec2 ewol::Widget::GetOrigin(void)
|
||||
@ -222,23 +214,19 @@ vec2 ewol::Widget::GetOrigin(void)
|
||||
|
||||
vec2 ewol::Widget::RelativePosition(vec2 pos)
|
||||
{
|
||||
pos.x -= m_origin.x;
|
||||
pos.y -= m_origin.y;
|
||||
return pos;
|
||||
return pos - m_origin;
|
||||
}
|
||||
|
||||
bool ewol::Widget::CalculateMinSize(void)
|
||||
{
|
||||
m_minSize.x = m_userMinSize.x;
|
||||
m_minSize.y = m_userMinSize.y;
|
||||
m_minSize = m_userMinSize;
|
||||
MarkToRedraw();
|
||||
return true;
|
||||
}
|
||||
|
||||
void ewol::Widget::SetMinSize(float x, float y)
|
||||
{
|
||||
m_userMinSize.x = x;
|
||||
m_userMinSize.y = y;
|
||||
m_userMinSize.setValue(x, y);
|
||||
}
|
||||
|
||||
vec2 ewol::Widget::GetMinSize(void)
|
||||
@ -270,7 +258,7 @@ vec2 ewol::Widget::GetSize(void)
|
||||
|
||||
void ewol::Widget::SetExpendX(bool newExpend)
|
||||
{
|
||||
m_userExpend.x = newExpend;
|
||||
m_userExpend.setX(newExpend);
|
||||
ewol::RequestUpdateSize();
|
||||
MarkToRedraw();
|
||||
}
|
||||
@ -278,14 +266,14 @@ void ewol::Widget::SetExpendX(bool newExpend)
|
||||
bool ewol::Widget::CanExpentX(void)
|
||||
{
|
||||
if (false==IsHide()) {
|
||||
return m_userExpend.x;
|
||||
return m_userExpend.x();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void ewol::Widget::SetExpendY(bool newExpend)
|
||||
{
|
||||
m_userExpend.y = newExpend;
|
||||
m_userExpend.setY(newExpend);
|
||||
ewol::RequestUpdateSize();
|
||||
MarkToRedraw();
|
||||
}
|
||||
@ -293,31 +281,31 @@ void ewol::Widget::SetExpendY(bool newExpend)
|
||||
bool ewol::Widget::CanExpentY(void)
|
||||
{
|
||||
if (false==IsHide()) {
|
||||
return m_userExpend.y;
|
||||
return m_userExpend.y();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void ewol::Widget::SetFillX(bool newFill)
|
||||
{
|
||||
m_userFill.x = newFill;
|
||||
m_userFill.setX(newFill);
|
||||
MarkToRedraw();
|
||||
}
|
||||
|
||||
bool ewol::Widget::CanFillX(void)
|
||||
{
|
||||
return m_userFill.x;
|
||||
return m_userFill.x();
|
||||
}
|
||||
|
||||
void ewol::Widget::SetFillY(bool newFill)
|
||||
{
|
||||
m_userFill.y = newFill;
|
||||
m_userFill.setY(newFill);
|
||||
MarkToRedraw();
|
||||
}
|
||||
|
||||
bool ewol::Widget::CanFillY(void)
|
||||
{
|
||||
return m_userFill.y;
|
||||
return m_userFill.y();
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------------------------------------------
|
||||
|
@ -17,8 +17,7 @@
|
||||
|
||||
widget::WidgetScrooled::WidgetScrooled(void)
|
||||
{
|
||||
m_originScrooled.x = 0;
|
||||
m_originScrooled.y = 0;
|
||||
m_originScrooled.setValue(0,0);
|
||||
m_pixelScrolling = 20;
|
||||
m_highSpeedMode = SCROLL_DISABLE;
|
||||
m_scroollingMode = SCROLL_MODE_NORMAL;
|
||||
@ -42,7 +41,7 @@ void widget::WidgetScrooled::OnRegenerateDisplay(void)
|
||||
|
||||
} else {
|
||||
ewol::Drawing* tmpDraw = NULL;
|
||||
if(m_size.y < m_maxSize.y || m_size.x < m_maxSize.x) {
|
||||
if(m_size.y() < m_maxSize.y() || m_size.x() < m_maxSize.x()) {
|
||||
tmpDraw = new ewol::Drawing();
|
||||
tmpDraw->SetColor(0xFF00007F);
|
||||
}
|
||||
@ -50,29 +49,29 @@ void widget::WidgetScrooled::OnRegenerateDisplay(void)
|
||||
return;
|
||||
}
|
||||
tmpDraw->SetThickness(1);
|
||||
if( m_size.y < m_maxSize.y
|
||||
|| m_originScrooled.y!=0) {
|
||||
tmpDraw->SetPos(vec3(m_size.x-(SCROLL_BAR_SPACE/2), 0) );
|
||||
tmpDraw->LineTo(vec3(m_size.x-(SCROLL_BAR_SPACE/2), m_size.y ) );
|
||||
float lenScrollBar = m_size.y*m_size.y / m_maxSize.y;
|
||||
lenScrollBar = etk_avg(10, lenScrollBar, m_size.y);
|
||||
float originScrollBar = m_originScrooled.y / (m_maxSize.y-m_size.y*m_limitScrolling);
|
||||
if( m_size.y() < m_maxSize.y()
|
||||
|| m_originScrooled.y()!=0) {
|
||||
tmpDraw->SetPos(vec3(m_size.x()-(SCROLL_BAR_SPACE/2), 0, 0) );
|
||||
tmpDraw->LineTo(vec3(m_size.x()-(SCROLL_BAR_SPACE/2), m_size.y(), 0 ) );
|
||||
float lenScrollBar = m_size.y()*m_size.y() / m_maxSize.y();
|
||||
lenScrollBar = etk_avg(10, lenScrollBar, m_size.y());
|
||||
float originScrollBar = m_originScrooled.y() / (m_maxSize.y()-m_size.y()*m_limitScrolling);
|
||||
originScrollBar = etk_avg(0.0, originScrollBar, 1.0);
|
||||
originScrollBar *= (m_size.y-lenScrollBar);
|
||||
tmpDraw->SetPos(vec3(m_size.x-SCROLL_BAR_SPACE, m_size.y - originScrollBar - lenScrollBar) );
|
||||
tmpDraw->RectangleWidth(vec3(SCROLL_BAR_SPACE, lenScrollBar));
|
||||
originScrollBar *= (m_size.y()-lenScrollBar);
|
||||
tmpDraw->SetPos(vec3(m_size.x()-SCROLL_BAR_SPACE, m_size.y() - originScrollBar - lenScrollBar, 0) );
|
||||
tmpDraw->RectangleWidth(vec3(SCROLL_BAR_SPACE, lenScrollBar, 0));
|
||||
}
|
||||
if( m_size.x < m_maxSize.x
|
||||
|| m_originScrooled.x!=0) {
|
||||
if( m_size.x() < m_maxSize.x()
|
||||
|| m_originScrooled.x()!=0) {
|
||||
tmpDraw->SetPos(vec3(0, (SCROLL_BAR_SPACE/2), 0) );
|
||||
tmpDraw->LineTo(vec3(m_size.x-SCROLL_BAR_SPACE, (SCROLL_BAR_SPACE/2) ) );
|
||||
float lenScrollBar = m_size.x*(m_size.x-SCROLL_BAR_SPACE) / m_maxSize.x;
|
||||
lenScrollBar = etk_avg(10, lenScrollBar, (m_size.x-SCROLL_BAR_SPACE));
|
||||
float originScrollBar = m_originScrooled.x / (m_maxSize.x-m_size.x*m_limitScrolling);
|
||||
tmpDraw->LineTo(vec3(m_size.x()-SCROLL_BAR_SPACE, (SCROLL_BAR_SPACE/2), 0 ) );
|
||||
float lenScrollBar = m_size.x()*(m_size.x()-SCROLL_BAR_SPACE) / m_maxSize.x();
|
||||
lenScrollBar = etk_avg(10, lenScrollBar, (m_size.x()-SCROLL_BAR_SPACE));
|
||||
float originScrollBar = m_originScrooled.x() / (m_maxSize.x()-m_size.x()*m_limitScrolling);
|
||||
originScrollBar = etk_avg(0.0, originScrollBar, 1.0);
|
||||
originScrollBar *= (m_size.x-SCROLL_BAR_SPACE-lenScrollBar);
|
||||
originScrollBar *= (m_size.x()-SCROLL_BAR_SPACE-lenScrollBar);
|
||||
tmpDraw->SetPos(vec3(originScrollBar, 0, 0) );
|
||||
tmpDraw->Rectangle(vec3(lenScrollBar, SCROLL_BAR_SPACE) );
|
||||
tmpDraw->Rectangle(vec3(lenScrollBar, SCROLL_BAR_SPACE, 0) );
|
||||
}
|
||||
AddOObject(tmpDraw);
|
||||
}
|
||||
@ -83,36 +82,36 @@ bool widget::WidgetScrooled::OnEventInput(ewol::keyEvent::type_te type, int32_t
|
||||
{
|
||||
vec2 relativePos = RelativePosition(pos);
|
||||
// corection due to the open Gl invertion ...
|
||||
relativePos.y = m_size.y - relativePos.y;
|
||||
relativePos.setY(m_size.y() - relativePos.y());
|
||||
if (SCROLL_MODE_NORMAL == m_scroollingMode) {
|
||||
if (ewol::keyEvent::typeMouse==type && ( ewol::keyEvent::typeUnknow==m_highSpeedType || ewol::keyEvent::typeMouse==m_highSpeedType )) {
|
||||
if (1 == IdInput && ewol::keyEvent::statusDown == typeEvent) {
|
||||
// check if selected the scrolling position whth the scrolling bar ...
|
||||
if (relativePos.x >= (m_size.x-SCROLL_BAR_SPACE)) {
|
||||
if( m_size.y < m_maxSize.y
|
||||
|| m_originScrooled.y != 0) {
|
||||
if (relativePos.x() >= (m_size.x()-SCROLL_BAR_SPACE)) {
|
||||
if( m_size.y() < m_maxSize.y()
|
||||
|| m_originScrooled.y() != 0) {
|
||||
m_highSpeedMode = widget::SCROLL_ENABLE_VERTICAL;
|
||||
m_highSpeedType = ewol::keyEvent::typeMouse;
|
||||
m_highSpeedStartPos.x = relativePos.x;
|
||||
m_highSpeedStartPos.y = m_originScrooled.y / m_maxSize.y * (m_size.y-SCROLL_BAR_SPACE*2);
|
||||
m_highSpeedStartPos.setX(relativePos.x());
|
||||
m_highSpeedStartPos.setY(m_originScrooled.y() / m_maxSize.y() * (m_size.y()-SCROLL_BAR_SPACE*2));
|
||||
m_highSpeedButton = 1;
|
||||
// force direct scrolling in this case
|
||||
m_originScrooled.y = (int32_t)(m_maxSize.y * (relativePos.y-SCROLL_BAR_SPACE) / (m_size.y-SCROLL_BAR_SPACE*2));
|
||||
m_originScrooled.y = etk_avg(0, m_originScrooled.y, (m_maxSize.y - m_size.y*m_limitScrolling));
|
||||
m_originScrooled.setY((int32_t)(m_maxSize.y() * (relativePos.y()-SCROLL_BAR_SPACE) / (m_size.y()-SCROLL_BAR_SPACE*2)));
|
||||
m_originScrooled.setY(etk_avg(0, m_originScrooled.y(), (m_maxSize.y() - m_size.y()*m_limitScrolling)));
|
||||
MarkToRedraw();
|
||||
return true;
|
||||
}
|
||||
} else if (relativePos.y >= (m_size.y-SCROLL_BAR_SPACE)) {
|
||||
if( m_size.x < m_maxSize.x
|
||||
|| m_originScrooled.x!=0) {
|
||||
} else if (relativePos.y() >= (m_size.y()-SCROLL_BAR_SPACE)) {
|
||||
if( m_size.x() < m_maxSize.x()
|
||||
|| m_originScrooled.x()!=0) {
|
||||
m_highSpeedMode = widget::SCROLL_ENABLE_HORIZONTAL;
|
||||
m_highSpeedType = ewol::keyEvent::typeMouse;
|
||||
m_highSpeedStartPos.x = m_originScrooled.x / m_maxSize.x * (m_size.x-SCROLL_BAR_SPACE*2);
|
||||
m_highSpeedStartPos.y = relativePos.y;
|
||||
m_highSpeedStartPos.setX(m_originScrooled.x() / m_maxSize.x() * (m_size.x()-SCROLL_BAR_SPACE*2));
|
||||
m_highSpeedStartPos.setY(relativePos.y());
|
||||
m_highSpeedButton = 1;
|
||||
// force direct scrolling in this case
|
||||
m_originScrooled.x = (int32_t)(m_maxSize.x * (relativePos.x-SCROLL_BAR_SPACE) / (m_size.x-SCROLL_BAR_SPACE*2));
|
||||
m_originScrooled.x = etk_avg(0, m_originScrooled.x, (m_maxSize.x - m_size.x*m_limitScrolling));
|
||||
m_originScrooled.setX((int32_t)(m_maxSize.x() * (relativePos.x()-SCROLL_BAR_SPACE) / (m_size.x()-SCROLL_BAR_SPACE*2)));
|
||||
m_originScrooled.setY(etk_avg(0, m_originScrooled.x(), (m_maxSize.x() - m_size.x()*m_limitScrolling)));
|
||||
MarkToRedraw();
|
||||
return true;
|
||||
}
|
||||
@ -125,9 +124,9 @@ bool widget::WidgetScrooled::OnEventInput(ewol::keyEvent::type_te type, int32_t
|
||||
zoom = etk_avg(0.1, zoom, 5000);
|
||||
SetZoom(zoom);
|
||||
} else */{
|
||||
if(m_size.y < m_maxSize.y) {
|
||||
m_originScrooled.y -= m_pixelScrolling;
|
||||
m_originScrooled.y = etk_avg(0, m_originScrooled.y, (m_maxSize.y - m_size.y*m_limitScrolling));
|
||||
if(m_size.y() < m_maxSize.y()) {
|
||||
m_originScrooled.setY(m_originScrooled.y()-m_pixelScrolling);
|
||||
m_originScrooled.setY(etk_avg(0, m_originScrooled.y(), (m_maxSize.y() - m_size.y()*m_limitScrolling)));
|
||||
MarkToRedraw();
|
||||
return true;
|
||||
}
|
||||
@ -139,9 +138,9 @@ bool widget::WidgetScrooled::OnEventInput(ewol::keyEvent::type_te type, int32_t
|
||||
zoom = etk_avg(0.1, zoom, 5000);
|
||||
SetZoom(zoom);
|
||||
} else */{
|
||||
if(m_size.y < m_maxSize.y) {
|
||||
m_originScrooled.y += m_pixelScrolling;
|
||||
m_originScrooled.y = etk_avg(0, m_originScrooled.y, (m_maxSize.y - m_size.y*m_limitScrolling));
|
||||
if(m_size.y() < m_maxSize.y()) {
|
||||
m_originScrooled.setY(m_originScrooled.y()+m_pixelScrolling);
|
||||
m_originScrooled.setY(etk_avg(0, m_originScrooled.y(), (m_maxSize.y() - m_size.y()*m_limitScrolling)));
|
||||
MarkToRedraw();
|
||||
return true;
|
||||
}
|
||||
@ -157,8 +156,7 @@ bool widget::WidgetScrooled::OnEventInput(ewol::keyEvent::type_te type, int32_t
|
||||
if (ewol::keyEvent::statusDown == typeEvent) {
|
||||
m_highSpeedMode = widget::SCROLL_INIT;
|
||||
m_highSpeedType = ewol::keyEvent::typeMouse;
|
||||
m_highSpeedStartPos.x = relativePos.x;
|
||||
m_highSpeedStartPos.y = relativePos.y;
|
||||
m_highSpeedStartPos.setValue(relativePos.x(), relativePos.y());
|
||||
m_highSpeedButton = 2;
|
||||
return true;
|
||||
}
|
||||
@ -191,16 +189,16 @@ bool widget::WidgetScrooled::OnEventInput(ewol::keyEvent::type_te type, int32_t
|
||||
return true;
|
||||
} else if (widget::SCROLL_INIT==m_highSpeedMode && ewol::keyEvent::statusMove == typeEvent) {
|
||||
// wait that the cursor move more than 10 px to enable it :
|
||||
if( abs(relativePos.x - m_highSpeedStartPos.x) > 10
|
||||
|| abs(relativePos.y - m_highSpeedStartPos.y) > 10 ) {
|
||||
if( abs(relativePos.x() - m_highSpeedStartPos.x()) > 10
|
||||
|| abs(relativePos.y() - m_highSpeedStartPos.y()) > 10 ) {
|
||||
// the scrooling can start :
|
||||
// select the direction :
|
||||
if (relativePos.x == m_highSpeedStartPos.x) {
|
||||
if (relativePos.x() == m_highSpeedStartPos.x()) {
|
||||
m_highSpeedMode = widget::SCROLL_ENABLE_VERTICAL;
|
||||
} else if (relativePos.y == m_highSpeedStartPos.y) {
|
||||
} else if (relativePos.y() == m_highSpeedStartPos.y()) {
|
||||
m_highSpeedMode = widget::SCROLL_ENABLE_HORIZONTAL;
|
||||
} else {
|
||||
float coef = (relativePos.y - m_highSpeedStartPos.y) / (relativePos.x - m_highSpeedStartPos.x);
|
||||
float coef = (relativePos.y() - m_highSpeedStartPos.y()) / (relativePos.x() - m_highSpeedStartPos.x());
|
||||
if (abs(coef) <= 1 ) {
|
||||
m_highSpeedMode = widget::SCROLL_ENABLE_HORIZONTAL;
|
||||
} else {
|
||||
@ -208,22 +206,22 @@ bool widget::WidgetScrooled::OnEventInput(ewol::keyEvent::type_te type, int32_t
|
||||
}
|
||||
}
|
||||
if (m_highSpeedMode == widget::SCROLL_ENABLE_HORIZONTAL) {
|
||||
m_highSpeedStartPos.x = m_originScrooled.x / m_maxSize.x * (m_size.x-SCROLL_BAR_SPACE*2);
|
||||
m_highSpeedStartPos.setX(m_originScrooled.x() / m_maxSize.x() * (m_size.x()-SCROLL_BAR_SPACE*2));
|
||||
} else {
|
||||
m_highSpeedStartPos.y = m_originScrooled.y / m_maxSize.y * (m_size.y-SCROLL_BAR_SPACE*2);
|
||||
m_highSpeedStartPos.setY(m_originScrooled.y() / m_maxSize.y() * (m_size.y()-SCROLL_BAR_SPACE*2));
|
||||
}
|
||||
MarkToRedraw();
|
||||
}
|
||||
m_originScrooled.y = etk_avg(0, m_originScrooled.y, (m_maxSize.y - m_size.y*m_limitScrolling));
|
||||
m_originScrooled.setY(etk_avg(0, m_originScrooled.y(), (m_maxSize.y() - m_size.y()*m_limitScrolling)));
|
||||
return true;
|
||||
} if (widget::SCROLL_ENABLE_HORIZONTAL==m_highSpeedMode && ewol::keyEvent::statusMove == typeEvent) {
|
||||
m_originScrooled.x = (int32_t)(m_maxSize.x * (relativePos.x-SCROLL_BAR_SPACE) / (m_size.x-SCROLL_BAR_SPACE*2));
|
||||
m_originScrooled.x = etk_avg(0, m_originScrooled.x, (m_maxSize.x - m_size.x*m_limitScrolling));
|
||||
m_originScrooled.setX((int32_t)(m_maxSize.x() * (relativePos.x()-SCROLL_BAR_SPACE) / (m_size.x()-SCROLL_BAR_SPACE*2)));
|
||||
m_originScrooled.setX(etk_avg(0, m_originScrooled.x(), (m_maxSize.x() - m_size.x()*m_limitScrolling)));
|
||||
MarkToRedraw();
|
||||
return true;
|
||||
} if (widget::SCROLL_ENABLE_VERTICAL==m_highSpeedMode && ewol::keyEvent::statusMove == typeEvent) {
|
||||
m_originScrooled.y = (int32_t)(m_maxSize.y * (relativePos.y-SCROLL_BAR_SPACE) / (m_size.y-SCROLL_BAR_SPACE*2));
|
||||
m_originScrooled.y = etk_avg(0, m_originScrooled.y, (m_maxSize.y - m_size.y*m_limitScrolling));
|
||||
m_originScrooled.setY((int32_t)(m_maxSize.y() * (relativePos.y()-SCROLL_BAR_SPACE) / (m_size.y()-SCROLL_BAR_SPACE*2)));
|
||||
m_originScrooled.setY(etk_avg(0, m_originScrooled.y(), (m_maxSize.y() - m_size.y()*m_limitScrolling)));
|
||||
MarkToRedraw();
|
||||
return true;
|
||||
}
|
||||
@ -234,8 +232,7 @@ bool widget::WidgetScrooled::OnEventInput(ewol::keyEvent::type_te type, int32_t
|
||||
if (ewol::keyEvent::statusDown == typeEvent) {
|
||||
m_highSpeedMode = widget::SCROLL_INIT;
|
||||
m_highSpeedType = ewol::keyEvent::typeFinger;
|
||||
m_highSpeedStartPos.x = relativePos.x;
|
||||
m_highSpeedStartPos.y = relativePos.y;
|
||||
m_highSpeedStartPos.setValue(relativePos.x(), relativePos.y());
|
||||
EWOL_VERBOSE("SCROOL ==> INIT");
|
||||
return true;
|
||||
} else if (ewol::keyEvent::statusUp == typeEvent) {
|
||||
@ -246,8 +243,8 @@ bool widget::WidgetScrooled::OnEventInput(ewol::keyEvent::type_te type, int32_t
|
||||
return true;
|
||||
} else if (widget::SCROLL_INIT==m_highSpeedMode && ewol::keyEvent::statusMove == typeEvent) {
|
||||
// wait that the cursor move more than 10 px to enable it :
|
||||
if( abs(relativePos.x - m_highSpeedStartPos.x) > 10
|
||||
|| abs(relativePos.y - m_highSpeedStartPos.y) > 10 ) {
|
||||
if( abs(relativePos.x() - m_highSpeedStartPos.x()) > 10
|
||||
|| abs(relativePos.y() - m_highSpeedStartPos.y()) > 10 ) {
|
||||
// the scrooling can start :
|
||||
// select the direction :
|
||||
m_highSpeedMode = widget::SCROLL_ENABLE_FINGER;
|
||||
@ -257,13 +254,12 @@ bool widget::WidgetScrooled::OnEventInput(ewol::keyEvent::type_te type, int32_t
|
||||
return true;
|
||||
} if (widget::SCROLL_ENABLE_FINGER==m_highSpeedMode && ewol::keyEvent::statusMove == typeEvent) {
|
||||
//m_originScrooled.x = (int32_t)(m_maxSize.x * x / m_size.x);
|
||||
m_originScrooled.x -= relativePos.x - m_highSpeedStartPos.x;
|
||||
m_originScrooled.y -= relativePos.y - m_highSpeedStartPos.y;
|
||||
m_originScrooled.x = etk_avg(0, m_originScrooled.x, (m_maxSize.x - m_size.x*m_limitScrolling));
|
||||
m_originScrooled.y = etk_avg(0, m_originScrooled.y, (m_maxSize.y - m_size.y*m_limitScrolling));
|
||||
m_highSpeedStartPos.x = relativePos.x;
|
||||
m_highSpeedStartPos.y = relativePos.y;
|
||||
EWOL_VERBOSE("SCROOL ==> MOVE (" << m_originScrooled.x << "," << m_originScrooled.y << ")");
|
||||
m_originScrooled.setX(m_originScrooled.x() - relativePos.x() - m_highSpeedStartPos.x());
|
||||
m_originScrooled.setY(m_originScrooled.y() - relativePos.y() - m_highSpeedStartPos.y());
|
||||
m_originScrooled.setX(etk_avg(0, m_originScrooled.x(), (m_maxSize.x() - m_size.x()*m_limitScrolling)));
|
||||
m_originScrooled.setY(etk_avg(0, m_originScrooled.y(), (m_maxSize.y() - m_size.y()*m_limitScrolling)));
|
||||
m_highSpeedStartPos.setValue(relativePos.x(), relativePos.y());
|
||||
EWOL_VERBOSE("SCROOL ==> MOVE (" << m_originScrooled.x() << "," << m_originScrooled.y() << ")");
|
||||
MarkToRedraw();
|
||||
return true;
|
||||
}
|
||||
@ -277,8 +273,8 @@ bool widget::WidgetScrooled::OnEventInput(ewol::keyEvent::type_te type, int32_t
|
||||
}
|
||||
} else if (SCROLL_MODE_CENTER == m_scroollingMode) {
|
||||
if (ewol::keyEvent::typeMouse==type) {
|
||||
float tmp1=m_size.x / m_maxSize.y;
|
||||
float tmp2=m_size.y / m_maxSize.x;
|
||||
float tmp1=m_size.x() / m_maxSize.y();
|
||||
float tmp2=m_size.y() / m_maxSize.x();
|
||||
//EWOL_INFO(" elements Zoom : " << tmp1 << " " << tmp2);
|
||||
tmp1 = etk_min(tmp1, tmp2);
|
||||
if (4 == IdInput && ewol::keyEvent::statusUp == typeEvent) {
|
||||
@ -347,13 +343,13 @@ void widget::WidgetScrooled::GenDraw(ewol::DrawProperty displayProp)
|
||||
ewol::openGL::Push();
|
||||
if (SCROLL_MODE_CENTER == m_scroollingMode) {
|
||||
// here we invert the reference of the standard OpenGl view because the reference in the common display is Top left and not buttom left
|
||||
glViewport( m_origin.x,
|
||||
m_origin.y,
|
||||
m_size.x,
|
||||
m_size.y);
|
||||
mat4 tmpProjection = etk::matOrtho(-m_size.x/2, m_size.x/2, -m_size.y/2, m_size.y/2, -1, 1);
|
||||
glViewport( m_origin.x(),
|
||||
m_origin.y(),
|
||||
m_size.x(),
|
||||
m_size.y());
|
||||
mat4 tmpProjection = etk::matOrtho(-m_size.x()/2, m_size.x()/2, -m_size.y()/2, m_size.y()/2, -1, 1);
|
||||
mat4 tmpScale = etk::matScale(vec3(m_zoom, m_zoom, 1.0) );
|
||||
mat4 tmpTranslate = etk::matTranslate(vec3(-m_maxSize.x/2, -m_maxSize.y/2, -1.0) );
|
||||
mat4 tmpTranslate = etk::matTranslate(vec3(-m_maxSize.x()/2, -m_maxSize.y()/2, -1.0) );
|
||||
mat4 tmpMat = tmpProjection * tmpScale * tmpTranslate;
|
||||
// set internal matrix system :
|
||||
ewol::openGL::SetMatrix(tmpMat);
|
||||
@ -361,13 +357,13 @@ void widget::WidgetScrooled::GenDraw(ewol::DrawProperty displayProp)
|
||||
OnDraw(displayProp);
|
||||
} if (SCROLL_MODE_GAME == m_scroollingMode) {
|
||||
// here we invert the reference of the standard OpenGl view because the reference in the common display is Top left and not buttom left
|
||||
glViewport( m_origin.x,
|
||||
m_origin.y,
|
||||
m_size.x,
|
||||
m_size.y);
|
||||
glViewport( m_origin.x(),
|
||||
m_origin.y(),
|
||||
m_size.x(),
|
||||
m_size.y());
|
||||
|
||||
mat4 tmpProjection = etk::matOrtho(-m_size.x/2, m_size.x/2, -m_size.y/2, m_size.y/2, -1, 1);
|
||||
mat4 tmpTranslate = etk::matTranslate(vec3( -m_maxSize.x/2, -m_maxSize.y/2, -1.0) );
|
||||
mat4 tmpProjection = etk::matOrtho(-m_size.x()/2, m_size.x()/2, -m_size.y()/2, m_size.y()/2, -1, 1);
|
||||
mat4 tmpTranslate = etk::matTranslate(vec3( -m_maxSize.x()/2, -m_maxSize.y()/2, -1.0) );
|
||||
mat4 tmpMat = tmpProjection * tmpTranslate;
|
||||
// set internal matrix system :
|
||||
ewol::openGL::SetMatrix(tmpMat);
|
||||
@ -383,24 +379,24 @@ void widget::WidgetScrooled::GenDraw(ewol::DrawProperty displayProp)
|
||||
void widget::WidgetScrooled::SetScrollingPositionDynamic(vec2 borderWidth, vec2 currentPosition, bool center)
|
||||
{
|
||||
if (true == center) {
|
||||
borderWidth.x = m_size.x / 2 - borderWidth.x;
|
||||
borderWidth.y = m_size.y / 2 - borderWidth.y;
|
||||
borderWidth.setValue(m_size.x() / 2 - borderWidth.x(),
|
||||
m_size.y() / 2 - borderWidth.y() );
|
||||
}
|
||||
// check scrooling in X
|
||||
if( currentPosition.x < (m_originScrooled.x+borderWidth.x) ) {
|
||||
m_originScrooled.x = currentPosition.x - borderWidth.x;
|
||||
m_originScrooled.x = etk_max(0.0, m_originScrooled.x);
|
||||
} else if( currentPosition.x > (m_originScrooled.x+m_size.x-2*borderWidth.x) ) {
|
||||
m_originScrooled.x = currentPosition.x - m_size.x + 2*borderWidth.x;
|
||||
m_originScrooled.x = etk_max(0.0, m_originScrooled.x);
|
||||
if( currentPosition.x() < (m_originScrooled.x()+borderWidth.x()) ) {
|
||||
m_originScrooled.setX(currentPosition.x() - borderWidth.x());
|
||||
m_originScrooled.setX(etk_max(0.0, m_originScrooled.x()));
|
||||
} else if( currentPosition.x() > (m_originScrooled.x()+m_size.x()-2*borderWidth.x()) ) {
|
||||
m_originScrooled.setX(currentPosition.x() - m_size.x() + 2*borderWidth.x());
|
||||
m_originScrooled.setX(etk_max(0.0, m_originScrooled.x()));
|
||||
}
|
||||
// check scrooling in Y
|
||||
if( currentPosition.y < (m_originScrooled.y+borderWidth.y) ) {
|
||||
m_originScrooled.y = currentPosition.y - borderWidth.y;
|
||||
m_originScrooled.y = etk_max(0.0, m_originScrooled.y);
|
||||
} else if( currentPosition.y > (m_originScrooled.y+m_size.y-2*borderWidth.y) ) {
|
||||
m_originScrooled.y = currentPosition.y - m_size.y + 2*borderWidth.y;
|
||||
m_originScrooled.y = etk_max(0.0, m_originScrooled.y);
|
||||
if( currentPosition.y() < (m_originScrooled.y()+borderWidth.y()) ) {
|
||||
m_originScrooled.setY(currentPosition.y() - borderWidth.y());
|
||||
m_originScrooled.setY(etk_max(0.0, m_originScrooled.y()));
|
||||
} else if( currentPosition.y() > (m_originScrooled.y()+m_size.y()-2*borderWidth.y()) ) {
|
||||
m_originScrooled.setY(currentPosition.y() - m_size.y() + 2*borderWidth.y());
|
||||
m_originScrooled.setY(etk_max(0.0, m_originScrooled.y()));
|
||||
}
|
||||
}
|
||||
|
||||
@ -410,8 +406,8 @@ void widget::WidgetScrooled::ScroolingMode(scrollingMode_te newMode)
|
||||
m_scroollingMode = newMode;
|
||||
if (SCROLL_MODE_GAME == m_scroollingMode) {
|
||||
// set the scene maximum size :
|
||||
m_maxSize.x = etk_max(m_size.x, m_size.y);
|
||||
m_maxSize.y = m_maxSize.x;
|
||||
m_maxSize.setValue(etk_max(m_size.x(), m_size.y()),
|
||||
m_maxSize.x());
|
||||
m_zoom = 1;
|
||||
}
|
||||
}
|
||||
|
@ -53,18 +53,17 @@ ewol::Windows::~Windows(void)
|
||||
bool ewol::Windows::CalculateSize(float availlableX, float availlableY)
|
||||
{
|
||||
//EWOL_DEBUG("calculateMinSize on : " << m_currentCreateId);
|
||||
m_size.x = availlableX;
|
||||
m_size.y = availlableY;
|
||||
m_size.setValue(availlableX, availlableY);
|
||||
if (NULL != m_subWidget) {
|
||||
m_subWidget->CalculateMinSize();
|
||||
// TODO : Check if min Size is possible ...
|
||||
// TODO : Herited from MinSize .. and expand ???
|
||||
m_subWidget->CalculateSize(m_size.x, m_size.y);
|
||||
m_subWidget->CalculateSize(m_size.x(), m_size.y());
|
||||
}
|
||||
for(int32_t iii=0; iii<m_popUpWidgetList.Size(); iii++) {
|
||||
if (NULL != m_popUpWidgetList[iii]) {
|
||||
m_popUpWidgetList[iii]->CalculateMinSize();
|
||||
m_popUpWidgetList[iii]->CalculateSize(m_size.x, m_size.y);
|
||||
m_popUpWidgetList[iii]->CalculateSize(m_size.x(), m_size.y());
|
||||
}
|
||||
}
|
||||
return true;
|
||||
@ -96,7 +95,7 @@ void ewol::Windows::SysDraw(void)
|
||||
|
||||
//EWOL_DEBUG("Drow on (" << m_size.x << "," << m_size.y << ")");
|
||||
// set the size of the open GL system
|
||||
glViewport(0,0,m_size.x,m_size.y);
|
||||
glViewport(0,0,m_size.x(),m_size.y());
|
||||
glEnable(GL_BLEND);
|
||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
|
||||
@ -106,8 +105,7 @@ void ewol::Windows::SysDraw(void)
|
||||
|
||||
ewol::DrawProperty displayProp;
|
||||
displayProp.m_windowsSize = m_size;
|
||||
displayProp.m_origin.x = 0;
|
||||
displayProp.m_origin.y = 0;
|
||||
displayProp.m_origin.setValue(0,0);
|
||||
displayProp.m_size = m_size;
|
||||
|
||||
GenDraw(displayProp);
|
||||
@ -162,7 +160,7 @@ void ewol::Windows::SetSubWidget(ewol::Widget * widget)
|
||||
}
|
||||
m_subWidget = widget;
|
||||
// Regenerate the size calculation :
|
||||
CalculateSize(m_size.x, m_size.y);
|
||||
CalculateSize(m_size.x(), m_size.y());
|
||||
}
|
||||
|
||||
|
||||
@ -170,7 +168,7 @@ void ewol::Windows::PopUpWidgetPush(ewol::Widget * widget)
|
||||
{
|
||||
m_popUpWidgetList.PushBack(widget);
|
||||
// Regenerate the size calculation :
|
||||
CalculateSize(m_size.x, m_size.y);
|
||||
CalculateSize(m_size.x(), m_size.y());
|
||||
// TODO : it is dansgerous to access directly to the system ...
|
||||
eSystem::ResetIOEvent();
|
||||
}
|
||||
|
@ -59,8 +59,7 @@ bool widget::ParameterList::CalculateMinSize(void)
|
||||
m_minSize.x = 3+minWidth;
|
||||
m_minSize.y = 3+minHeight;
|
||||
*/
|
||||
m_minSize.x = 150;
|
||||
m_minSize.y = 150;
|
||||
m_minSize.setValue(150, 150);
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -132,8 +131,8 @@ void widget::ParameterList::OnRegenerateDisplay(void)
|
||||
//uint32_t nbColomn = GetNuberOfColomn();
|
||||
int32_t nbRaw = m_list.Size();
|
||||
// For the scrooling windows
|
||||
m_maxSize.x = m_size.x;
|
||||
m_maxSize.y = (minHeight + 2*m_paddingSizeY) * nbRaw;
|
||||
m_maxSize.setValue(m_size.x(),
|
||||
(minHeight + 2*m_paddingSizeY) * nbRaw );
|
||||
|
||||
|
||||
etk::Vector<int32_t> listSizeColomn;
|
||||
@ -142,11 +141,11 @@ void widget::ParameterList::OnRegenerateDisplay(void)
|
||||
ewol::Drawing * tmpDraw = new ewol::Drawing();
|
||||
tmpDraw->SetColor(0xFFFFFFFF);
|
||||
tmpDraw->SetPos(vec3(0,0,0) );
|
||||
tmpDraw->RectangleWidth(vec3(m_size.x, m_size.y) );
|
||||
tmpDraw->RectangleWidth(vec3(m_size.x(), m_size.y(), 0) );
|
||||
|
||||
uint32_t displayableRaw = m_size.y / (minHeight + 2*m_paddingSizeY) +2;
|
||||
uint32_t displayableRaw = m_size.y() / (minHeight + 2*m_paddingSizeY) +2;
|
||||
|
||||
int32_t startRaw = m_originScrooled.y / (minHeight + 2*m_paddingSizeY);
|
||||
int32_t startRaw = m_originScrooled.y() / (minHeight + 2*m_paddingSizeY);
|
||||
|
||||
if (startRaw >= nbRaw-1 ) {
|
||||
startRaw = nbRaw - 1;
|
||||
@ -155,7 +154,7 @@ void widget::ParameterList::OnRegenerateDisplay(void)
|
||||
startRaw = 0;
|
||||
}
|
||||
// Calculate the real position ...
|
||||
tmpOriginY = m_size.y - (-m_originScrooled.y + (startRaw+1)*(minHeight + 2*m_paddingSizeY));
|
||||
tmpOriginY = m_size.y() - (-m_originScrooled.y() + (startRaw+1)*(minHeight + 2*m_paddingSizeY));
|
||||
|
||||
for(int32_t iii=startRaw; iii<nbRaw && iii<(startRaw+displayableRaw); iii++) {
|
||||
etk::UString myTextToWrite = "???";
|
||||
@ -167,11 +166,11 @@ void widget::ParameterList::OnRegenerateDisplay(void)
|
||||
ewol::Text * tmpText = new ewol::Text();
|
||||
|
||||
vec3 textPos;
|
||||
textPos.x = (int32_t)tmpOriginX;
|
||||
textPos.setX((int32_t)tmpOriginX);
|
||||
if (m_list[iii]->m_group == false) {
|
||||
textPos.x += minHeight;
|
||||
textPos.setX(textPos.x() + minHeight);
|
||||
}
|
||||
textPos.y = (int32_t)(tmpOriginY + m_paddingSizeY);
|
||||
textPos.setY((int32_t)(tmpOriginY + m_paddingSizeY));
|
||||
tmpText->SetPos(textPos);
|
||||
tmpText->Print(myTextToWrite);
|
||||
|
||||
@ -196,7 +195,7 @@ bool widget::ParameterList::OnEventInput(ewol::keyEvent::type_te type, int32_t I
|
||||
if (IdInput == 1 && typeEvent == ewol::keyEvent::statusSingle) {
|
||||
vec2 relativePos = RelativePosition(pos);
|
||||
// corection for the openGl abstraction
|
||||
relativePos.y = m_size.y - relativePos.y;
|
||||
relativePos.setY(m_size.y() - relativePos.y());
|
||||
// TODO : Rework this ...
|
||||
/*
|
||||
int32_t fontId = GetDefaultFontId();
|
||||
@ -204,7 +203,7 @@ bool widget::ParameterList::OnEventInput(ewol::keyEvent::type_te type, int32_t I
|
||||
int32_t minHeight = ewol::GetHeight(fontId);
|
||||
*/
|
||||
int32_t minHeight = 20;
|
||||
int32_t rawID = (relativePos.y+m_originScrooled.y) / (minHeight + 2*m_paddingSizeY);
|
||||
int32_t rawID = (relativePos.y()+m_originScrooled.y()) / (minHeight + 2*m_paddingSizeY);
|
||||
// generate an event on a rawId if the element request change and Select it ...
|
||||
if (rawID >=0 && rawID<m_list.Size()) {
|
||||
if (m_list[rawID]!=NULL) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user