keyboard correction, change clipping methode of the oobject
This commit is contained in:
parent
551684fe8e
commit
514f666a15
@ -42,14 +42,15 @@ namespace ewol {
|
||||
|
||||
class OObject
|
||||
{
|
||||
protected:
|
||||
bool m_hasClipping;
|
||||
clipping_ts m_clipping;
|
||||
public:
|
||||
OObject(void);
|
||||
virtual ~OObject(void);
|
||||
public:
|
||||
void SetClipping(clipping_ts clip) {m_clipping = clip; m_hasClipping = true;};
|
||||
void RmClipping(void) {m_hasClipping = false;};
|
||||
virtual void Draw(void) = 0;
|
||||
public:
|
||||
// use to crop element outside the display
|
||||
virtual void UpdateSize(etkFloat_t sizeX, etkFloat_t sizeY) { };
|
||||
};
|
||||
};
|
||||
|
||||
|
@ -283,49 +283,6 @@ void SutherlandHodgman(etk::VectorType<coord2D_ts> & input, etk::VectorType<coor
|
||||
}
|
||||
|
||||
|
||||
void ewol::OObject2DColored::UpdateSize(etkFloat_t sizeX, etkFloat_t sizeY)
|
||||
{
|
||||
// copy the data
|
||||
etk::VectorType<coord2D_ts> coord = m_coord;
|
||||
etk::VectorType<color_ts> color = m_coordColor;
|
||||
// Clear the generated display ...
|
||||
m_coord.Clear();
|
||||
m_coordColor.Clear();
|
||||
// Check if the triangle is in the area...
|
||||
int32_t nbTriangle = coord.Size()/3;
|
||||
for (int32_t iii=0; iii<nbTriangle; iii++) {
|
||||
if( coord[iii*3+0].x >= 0.0 && coord[iii*3+0].x < sizeX
|
||||
&& coord[iii*3+0].y >= 0.0 && coord[iii*3+0].y < sizeY
|
||||
&& coord[iii*3+1].x >= 0.0 && coord[iii*3+1].x < sizeX
|
||||
&& coord[iii*3+1].y >= 0.0 && coord[iii*3+1].y < sizeY
|
||||
&& coord[iii*3+2].x >= 0.0 && coord[iii*3+2].x < sizeX
|
||||
&& coord[iii*3+2].y >= 0.0 && coord[iii*3+2].y < sizeY)
|
||||
{
|
||||
// point 1-2-3 inside
|
||||
m_coord.PushBack(coord[iii*3+0]);
|
||||
m_coordColor.PushBack(color[iii*3+0]);
|
||||
m_coord.PushBack(coord[iii*3+1]);
|
||||
m_coordColor.PushBack(color[iii*3+1]);
|
||||
m_coord.PushBack(coord[iii*3+2]);
|
||||
m_coordColor.PushBack(color[iii*3+2]);
|
||||
} else {
|
||||
etk::VectorType<coord2D_ts> tmpCoord;
|
||||
etk::VectorType<coord2D_ts> tmpCoordOut;
|
||||
tmpCoord.PushBack(coord[iii*3+0]);
|
||||
tmpCoord.PushBack(coord[iii*3+1]);
|
||||
tmpCoord.PushBack(coord[iii*3+2]);
|
||||
|
||||
SutherlandHodgman(tmpCoord, tmpCoordOut, 0, 0, sizeX, sizeY);
|
||||
tmpCoord.Clear();
|
||||
generatePolyGone(tmpCoordOut, tmpCoord);
|
||||
for (int32_t jjj=0; jjj<tmpCoord.Size(); jjj++) {
|
||||
m_coord.PushBack(tmpCoord[jjj]);
|
||||
m_coordColor.PushBack(color[iii*3+0]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ewol::OObject2DColored::GenerateTriangle(void)
|
||||
{
|
||||
m_triElement = 0;
|
||||
@ -435,30 +392,10 @@ void ewol::OObject2DColored::Line(etkFloat_t sx, etkFloat_t sy, etkFloat_t ex, e
|
||||
SetPoint(sx - offsetx, sy - offsety);
|
||||
}
|
||||
|
||||
|
||||
void ewol::OObject2DColored::Rectangle(etkFloat_t x, etkFloat_t y, etkFloat_t w, etkFloat_t h)
|
||||
{
|
||||
ResetCount();
|
||||
|
||||
if( 0 >= h
|
||||
|| 0 >= w) {
|
||||
return;
|
||||
}
|
||||
|
||||
SetPoint(x , y + h);
|
||||
SetPoint(x , y);
|
||||
SetPoint(x + w, y);
|
||||
|
||||
SetPoint(x + w, y);
|
||||
SetPoint(x + w, y + h);
|
||||
SetPoint(x , y + h);
|
||||
}
|
||||
|
||||
|
||||
void ewol::OObject2DColored::Rectangle(etkFloat_t x, etkFloat_t y, etkFloat_t w, etkFloat_t h, clipping_ts& drawClipping)
|
||||
{
|
||||
ResetCount();
|
||||
|
||||
/* Bitmap position
|
||||
* xA xB
|
||||
* yC *------*
|
||||
@ -471,24 +408,24 @@ void ewol::OObject2DColored::Rectangle(etkFloat_t x, etkFloat_t y, etkFloat_t w,
|
||||
etkFloat_t dyC = y;
|
||||
etkFloat_t dyD = y + h;
|
||||
|
||||
//EWOL_INFO("Rectangle size : (" << x << "," << y << ") in clipping (" << drawClipping.x << "," << drawClipping.y << ") ==> (" << drawClipping.w << "," << drawClipping.h << ")");
|
||||
if (dxA < drawClipping.x) {
|
||||
dxA = drawClipping.x;
|
||||
if (true == m_hasClipping) {
|
||||
if (dxA < m_clipping.x) {
|
||||
dxA = m_clipping.x;
|
||||
}
|
||||
if (dxB > drawClipping.x + drawClipping.w) {
|
||||
dxB = drawClipping.x + drawClipping.w;
|
||||
if (dxB > m_clipping.x + m_clipping.w) {
|
||||
dxB = m_clipping.x + m_clipping.w;
|
||||
}
|
||||
if (dyC < drawClipping.y) {
|
||||
dyC = drawClipping.y;
|
||||
if (dyC < m_clipping.y) {
|
||||
dyC = m_clipping.y;
|
||||
}
|
||||
if (dyD > m_clipping.y + m_clipping.h) {
|
||||
dyD = m_clipping.y + m_clipping.h;
|
||||
}
|
||||
if (dyD > drawClipping.y + drawClipping.h) {
|
||||
dyD = drawClipping.y + drawClipping.h;
|
||||
}
|
||||
if( dyC >= dyD
|
||||
|| dxA >= dxB) {
|
||||
return;
|
||||
}
|
||||
|
||||
SetPoint(dxA, dyD);
|
||||
SetPoint(dxA, dyC);
|
||||
SetPoint(dxB, dyC);
|
||||
|
@ -52,15 +52,11 @@ namespace ewol {
|
||||
void SetPoint(etkFloat_t x, etkFloat_t y);
|
||||
void Line(etkFloat_t sx, etkFloat_t sy, etkFloat_t ex, etkFloat_t ey, etkFloat_t thickness);
|
||||
void Rectangle(etkFloat_t x, etkFloat_t y, etkFloat_t w, etkFloat_t h);
|
||||
void Rectangle(etkFloat_t x, etkFloat_t y, etkFloat_t w, etkFloat_t h, clipping_ts& drawClipping);
|
||||
void RectangleBorder(etkFloat_t x, etkFloat_t y, etkFloat_t w, etkFloat_t h, etkFloat_t thickness);
|
||||
void Circle(etkFloat_t x, etkFloat_t y, etkFloat_t radius, etkFloat_t thickness);
|
||||
void CirclePart(etkFloat_t x, etkFloat_t y, etkFloat_t radius, etkFloat_t thickness, etkFloat_t angleStart, etkFloat_t angleStop);
|
||||
void Disc(etkFloat_t x, etkFloat_t y, etkFloat_t radius);
|
||||
void DiscPart(etkFloat_t x, etkFloat_t y, etkFloat_t radius, etkFloat_t angleStart, etkFloat_t angleStop);
|
||||
public:
|
||||
// Ewol internal ... : done to update at the origin of the widget ...
|
||||
virtual void UpdateSize(etkFloat_t sizeX, etkFloat_t sizeY);
|
||||
};
|
||||
};
|
||||
|
||||
|
@ -25,6 +25,7 @@
|
||||
#include <ewol/Widget.h>
|
||||
#include <ewol/WidgetManager.h>
|
||||
#include <ewol/WidgetMessageMultiCast.h>
|
||||
#include <ewol/ewol.h>
|
||||
#include <ewol/importgl.h>
|
||||
|
||||
char* ewol::GetCharTypeMoveEvent(eventKbMoveType_te type)
|
||||
@ -253,7 +254,7 @@ bool ewol::Widget::GenDraw(void)
|
||||
etkFloat_t testSizeY = m_size.y-TEST_CLIPPING_SIZE*2;
|
||||
// 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 + TEST_CLIPPING_SIZE,
|
||||
600 - m_size.y - m_origin.y + TEST_CLIPPING_SIZE,
|
||||
ewol::GetCurrentHeight() - m_size.y - m_origin.y + TEST_CLIPPING_SIZE,
|
||||
testSizeX,
|
||||
testSizeY);
|
||||
glMatrixMode(GL_PROJECTION);
|
||||
|
@ -37,6 +37,17 @@ ewol::Windows* gui_uniqueWindows = NULL;
|
||||
etkFloat_t gui_width = 320;
|
||||
etkFloat_t gui_height = 480;
|
||||
|
||||
|
||||
int32_t ewol::GetCurrentWidth(void)
|
||||
{
|
||||
return gui_width;
|
||||
}
|
||||
|
||||
int32_t ewol::GetCurrentHeight(void)
|
||||
{
|
||||
return gui_height;
|
||||
}
|
||||
|
||||
void ewol::RmPopUp(int32_t widgetID)
|
||||
{
|
||||
if (NULL != gui_uniqueWindows) {
|
||||
|
@ -59,6 +59,9 @@ namespace ewol {
|
||||
void Add(bool shift, bool control, bool alt, bool meta, uniChar_t unicodeValue, const char * generateEventId, etk::UString& data);
|
||||
void Add(char * descriptiveString, const char * generateEventId, etk::UString& data);
|
||||
};
|
||||
|
||||
int32_t GetCurrentWidth(void);
|
||||
int32_t GetCurrentHeight(void);
|
||||
};
|
||||
|
||||
int64_t GetCurrentTime(void);
|
||||
|
@ -49,10 +49,6 @@ void ewol::Drawable::AddOObject(ewol::OObject* newObject, int32_t pos)
|
||||
EWOL_ERROR("Try to add an empty object in the Widget generic display system");
|
||||
return;
|
||||
}
|
||||
// TODO : Chow why I use this ...
|
||||
//EWOL_INFO("UPDATE AT size : (" << m_size.x << "," << m_size.y << ")");
|
||||
newObject->UpdateSize(m_size.x, m_size.y);
|
||||
|
||||
if (pos < 0 || pos >= m_listOObject[m_currentCreateId].Size() ) {
|
||||
m_listOObject[m_currentCreateId].PushBack(newObject);
|
||||
} else {
|
||||
|
@ -79,6 +79,7 @@ bool ewol::Label::CalculateMinSize(void)
|
||||
void ewol::Label::SetLabel(etk::UString newLabel)
|
||||
{
|
||||
m_label = newLabel;
|
||||
MarkToReedraw();
|
||||
}
|
||||
|
||||
|
||||
|
@ -246,7 +246,7 @@ bool ewol::Keyboard::CalculateSize(etkFloat_t availlableX, etkFloat_t availlable
|
||||
subWidgetSize.x = (int32_t)subWidgetSize.x;
|
||||
subWidgetSize.y = (int32_t)subWidgetSize.y;
|
||||
|
||||
m_subWidget->SetOrigin(0, 0);
|
||||
m_subWidget->SetOrigin(m_origin.x, m_origin.y);
|
||||
m_subWidget->CalculateSize(subWidgetSize.x, subWidgetSize.y);
|
||||
}
|
||||
MarkToReedraw();
|
||||
|
Loading…
x
Reference in New Issue
Block a user