start Abstraction of the scrooling windows
This commit is contained in:
parent
d088866891
commit
7734a8ce36
@ -150,7 +150,8 @@ void Buffer::SetLineDisplay(uint32_t lineNumber)
|
|||||||
int32_t Buffer::Display(ewol::OObject2DTextColored* OOTextNormal,
|
int32_t Buffer::Display(ewol::OObject2DTextColored* OOTextNormal,
|
||||||
ewol::OObject2DTextColored* OOTextBold,
|
ewol::OObject2DTextColored* OOTextBold,
|
||||||
ewol::OObject2DTextColored* OOTextItalic,
|
ewol::OObject2DTextColored* OOTextItalic,
|
||||||
ewol::OObject2DTextColored* OOTextBoldItalic, ewol::OObject2DColored* OOColored, int32_t sizeX, int32_t sizeY)
|
ewol::OObject2DTextColored* OOTextBoldItalic, ewol::OObject2DColored* OOColored,
|
||||||
|
int32_t offsetX, int32_t offsetY, int32_t sizeX, int32_t sizeY)
|
||||||
{
|
{
|
||||||
return ERR_NONE;
|
return ERR_NONE;
|
||||||
}
|
}
|
||||||
|
@ -86,7 +86,7 @@ class Buffer {
|
|||||||
ewol::OObject2DTextColored* OOTextBold,
|
ewol::OObject2DTextColored* OOTextBold,
|
||||||
ewol::OObject2DTextColored* OOTextItalic,
|
ewol::OObject2DTextColored* OOTextItalic,
|
||||||
ewol::OObject2DTextColored* OOTextBoldItalic,
|
ewol::OObject2DTextColored* OOTextBoldItalic,
|
||||||
ewol::OObject2DColored* OOColored, int32_t sizeX, int32_t sizeY);
|
ewol::OObject2DColored* OOColored, int32_t offsetX, int32_t offsetY, int32_t sizeX, int32_t sizeY);
|
||||||
virtual void ForceReDraw(bool allElement);
|
virtual void ForceReDraw(bool allElement);
|
||||||
virtual void AddChar(char * UTF8data);
|
virtual void AddChar(char * UTF8data);
|
||||||
virtual void cursorMove(ewol::eventKbMoveType_te moveTypeEvent);
|
virtual void cursorMove(ewol::eventKbMoveType_te moveTypeEvent);
|
||||||
|
@ -71,7 +71,7 @@ int32_t BufferEmpty::Display(ewol::OObject2DTextColored* OOTextNormal,
|
|||||||
ewol::OObject2DTextColored* OOTextBold,
|
ewol::OObject2DTextColored* OOTextBold,
|
||||||
ewol::OObject2DTextColored* OOTextItalic,
|
ewol::OObject2DTextColored* OOTextItalic,
|
||||||
ewol::OObject2DTextColored* OOTextBoldItalic,
|
ewol::OObject2DTextColored* OOTextBoldItalic,
|
||||||
ewol::OObject2DColored* OOColored, int32_t sizeX, int32_t sizeY)
|
ewol::OObject2DColored* OOColored, int32_t offsetX, int32_t offsetY, int32_t sizeX, int32_t sizeY)
|
||||||
{
|
{
|
||||||
ColorizeManager * myColorManager = ColorizeManager::getInstance();
|
ColorizeManager * myColorManager = ColorizeManager::getInstance();
|
||||||
// Get color :
|
// Get color :
|
||||||
|
@ -36,7 +36,7 @@ class BufferEmpty : public Buffer {
|
|||||||
ewol::OObject2DTextColored* OOTextBold,
|
ewol::OObject2DTextColored* OOTextBold,
|
||||||
ewol::OObject2DTextColored* OOTextItalic,
|
ewol::OObject2DTextColored* OOTextItalic,
|
||||||
ewol::OObject2DTextColored* OOTextBoldItalic,
|
ewol::OObject2DTextColored* OOTextBoldItalic,
|
||||||
ewol::OObject2DColored* OOColored, int32_t sizeX, int32_t sizeY);
|
ewol::OObject2DColored* OOColored, int32_t offsetX, int32_t offsetY, int32_t sizeX, int32_t sizeY);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -310,7 +310,9 @@ int32_t BufferText::Display(ewol::OObject2DTextColored* OOTextNormal,
|
|||||||
ewol::OObject2DTextColored* OOTextBold,
|
ewol::OObject2DTextColored* OOTextBold,
|
||||||
ewol::OObject2DTextColored* OOTextItalic,
|
ewol::OObject2DTextColored* OOTextItalic,
|
||||||
ewol::OObject2DTextColored* OOTextBoldItalic,
|
ewol::OObject2DTextColored* OOTextBoldItalic,
|
||||||
ewol::OObject2DColored* OOColored, int32_t sizeX, int32_t sizeY)
|
ewol::OObject2DColored* OOColored,
|
||||||
|
int32_t offsetX, int32_t offsetY,
|
||||||
|
int32_t sizeX, int32_t sizeY)
|
||||||
{
|
{
|
||||||
int32_t selStart, selEnd, selRectStart, selRectEnd;
|
int32_t selStart, selEnd, selRectStart, selRectEnd;
|
||||||
bool selIsRect;
|
bool selIsRect;
|
||||||
@ -322,6 +324,12 @@ int32_t BufferText::Display(ewol::OObject2DTextColored* OOTextNormal,
|
|||||||
int32_t letterWidth = ewol::GetWidth(fontId, "A");
|
int32_t letterWidth = ewol::GetWidth(fontId, "A");
|
||||||
int32_t letterHeight = ewol::GetHeight(fontId);
|
int32_t letterHeight = ewol::GetHeight(fontId);
|
||||||
|
|
||||||
|
m_displayStartLineId = offsetY / letterHeight;
|
||||||
|
|
||||||
|
// update the display position with the scroll ofset :
|
||||||
|
m_displayStartBufferPos = m_EdnBuf.CountForwardNLines(0, m_displayStartLineId);
|
||||||
|
|
||||||
|
|
||||||
// update the number of element that can be displayed
|
// update the number of element that can be displayed
|
||||||
m_displaySize.x = (sizeX/letterWidth) + 1 - nbColoneForLineNumber;
|
m_displaySize.x = (sizeX/letterWidth) + 1 - nbColoneForLineNumber;
|
||||||
m_displaySize.y = (sizeY/letterHeight) + 1;
|
m_displaySize.y = (sizeY/letterHeight) + 1;
|
||||||
|
@ -50,7 +50,9 @@ class BufferText : public Buffer {
|
|||||||
ewol::OObject2DTextColored* OOTextBold,
|
ewol::OObject2DTextColored* OOTextBold,
|
||||||
ewol::OObject2DTextColored* OOTextItalic,
|
ewol::OObject2DTextColored* OOTextItalic,
|
||||||
ewol::OObject2DTextColored* OOTextBoldItalic,
|
ewol::OObject2DTextColored* OOTextBoldItalic,
|
||||||
ewol::OObject2DColored* OOColored, int32_t sizeX, int32_t sizeY);
|
ewol::OObject2DColored* OOColored,
|
||||||
|
int32_t offsetX, int32_t offsetY,
|
||||||
|
int32_t sizeX, int32_t sizeY);
|
||||||
void ForceReDraw(bool allElement);
|
void ForceReDraw(bool allElement);
|
||||||
void AddChar(char * UTF8data);
|
void AddChar(char * UTF8data);
|
||||||
void cursorMove(ewol::eventKbMoveType_te moveTypeEvent);
|
void cursorMove(ewol::eventKbMoveType_te moveTypeEvent);
|
||||||
|
@ -61,11 +61,11 @@ GtkWidget * BufferView::GetMainWidget(void)
|
|||||||
bool BufferView::OnEventAreaExternal(int32_t widgetID, const char * generateEventId, const char * eventExternId, etkFloat_t x, etkFloat_t y)
|
bool BufferView::OnEventAreaExternal(int32_t widgetID, const char * generateEventId, const char * eventExternId, etkFloat_t x, etkFloat_t y)
|
||||||
{
|
{
|
||||||
if (generateEventId == ednMsgBufferListChange) {
|
if (generateEventId == ednMsgBufferListChange) {
|
||||||
OnRegenerateDisplay();
|
MarkToReedraw();
|
||||||
}else if (ednMsgBufferId == ednMsgBufferListChange) {
|
}else if (ednMsgBufferId == ednMsgBufferListChange) {
|
||||||
OnRegenerateDisplay();
|
MarkToReedraw();
|
||||||
}else if (ednMsgBufferState == ednMsgBufferListChange) {
|
}else if (ednMsgBufferState == ednMsgBufferListChange) {
|
||||||
OnRegenerateDisplay();
|
MarkToReedraw();
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -144,7 +144,7 @@ bool BufferView::OnItemEvent(int32_t IdInput, ewol::eventInputType_te typeEvent,
|
|||||||
ewol::widgetMessageMultiCast::Send(GetWidgetId(), ednMsgBufferId, selectBuf);
|
ewol::widgetMessageMultiCast::Send(GetWidgetId(), ednMsgBufferId, selectBuf);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
OnRegenerateDisplay();
|
MarkToReedraw();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -119,7 +119,8 @@ void CodeView::OnRegenerateDisplay(void)
|
|||||||
|
|
||||||
// generate the objects :
|
// generate the objects :
|
||||||
//m_bufferID = 0;
|
//m_bufferID = 0;
|
||||||
m_bufferManager->Get(m_bufferID)->Display(myOObjectTextNormal, myOObjectTextBold, myOObjectTextItalic, myOObjectTextBoldItalic, myOObjectsColored, m_size.x, m_size.y);
|
m_bufferManager->Get(m_bufferID)->Display(myOObjectTextNormal, myOObjectTextBold, myOObjectTextItalic, myOObjectTextBoldItalic, myOObjectsColored,
|
||||||
|
m_originScrooledX, m_originScrooledY, m_size.x, m_size.y);
|
||||||
|
|
||||||
// clean the object list ...
|
// clean the object list ...
|
||||||
ClearOObjectList();
|
ClearOObjectList();
|
||||||
@ -137,7 +138,7 @@ bool CodeView::OnEventKb(ewol::eventKbType_te typeEvent, char UTF8_data[UTF8_MAX
|
|||||||
//EDN_DEBUG("KB EVENT : \"" << UTF8_data << "\" size=" << strlen(UTF8_data) << "type=" << (int32_t)typeEvent);
|
//EDN_DEBUG("KB EVENT : \"" << UTF8_data << "\" size=" << strlen(UTF8_data) << "type=" << (int32_t)typeEvent);
|
||||||
if (typeEvent == ewol::EVENT_KB_TYPE_DOWN) {
|
if (typeEvent == ewol::EVENT_KB_TYPE_DOWN) {
|
||||||
m_bufferManager->Get(m_bufferID)->AddChar(UTF8_data);
|
m_bufferManager->Get(m_bufferID)->AddChar(UTF8_data);
|
||||||
OnRegenerateDisplay();
|
MarkToReedraw();
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -147,7 +148,7 @@ bool CodeView::OnEventKbMove(ewol::eventKbType_te typeEvent, ewol::eventKbMoveTy
|
|||||||
{
|
{
|
||||||
if (typeEvent == ewol::EVENT_KB_TYPE_DOWN) {
|
if (typeEvent == ewol::EVENT_KB_TYPE_DOWN) {
|
||||||
m_bufferManager->Get(m_bufferID)->cursorMove(moveTypeEvent);
|
m_bufferManager->Get(m_bufferID)->cursorMove(moveTypeEvent);
|
||||||
OnRegenerateDisplay();
|
MarkToReedraw();
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -156,6 +157,11 @@ bool CodeView::OnEventKbMove(ewol::eventKbType_te typeEvent, ewol::eventKbMoveTy
|
|||||||
|
|
||||||
bool CodeView::OnEventInput(int32_t IdInput, ewol::eventInputType_te typeEvent, etkFloat_t x, etkFloat_t y)
|
bool CodeView::OnEventInput(int32_t IdInput, ewol::eventInputType_te typeEvent, etkFloat_t x, etkFloat_t y)
|
||||||
{
|
{
|
||||||
|
if (true == WidgetScrooled::OnEventInput(IdInput, typeEvent, x, y)) {
|
||||||
|
ewol::widgetManager::FocusKeep(this);
|
||||||
|
// nothing to do ... done on upper widet ...
|
||||||
|
return true;
|
||||||
|
}
|
||||||
x -= m_origin.x;
|
x -= m_origin.x;
|
||||||
y -= m_origin.y;
|
y -= m_origin.y;
|
||||||
/*
|
/*
|
||||||
@ -199,19 +205,19 @@ bool CodeView::OnEventInput(int32_t IdInput, ewol::eventInputType_te typeEvent,
|
|||||||
} else if (ewol::EVENT_INPUT_TYPE_UP == typeEvent) {
|
} else if (ewol::EVENT_INPUT_TYPE_UP == typeEvent) {
|
||||||
m_buttunOneSelected = false;
|
m_buttunOneSelected = false;
|
||||||
m_bufferManager->Get(m_bufferID)->Copy(COPY_MIDDLE_BUTTON);
|
m_bufferManager->Get(m_bufferID)->Copy(COPY_MIDDLE_BUTTON);
|
||||||
OnRegenerateDisplay();
|
MarkToReedraw();
|
||||||
} else if (ewol::EVENT_INPUT_TYPE_SINGLE == typeEvent) {
|
} else if (ewol::EVENT_INPUT_TYPE_SINGLE == typeEvent) {
|
||||||
//EDN_INFO("mouse-event BT1 ==> One Clicked %d, %d", (uint32_t)event->x, (uint32_t)event->y);
|
//EDN_INFO("mouse-event BT1 ==> One Clicked %d, %d", (uint32_t)event->x, (uint32_t)event->y);
|
||||||
m_bufferManager->Get(m_bufferID)->MouseEvent(x, y);
|
m_bufferManager->Get(m_bufferID)->MouseEvent(x, y);
|
||||||
OnRegenerateDisplay();
|
MarkToReedraw();
|
||||||
} else if (ewol::EVENT_INPUT_TYPE_DOUBLE == typeEvent) {
|
} else if (ewol::EVENT_INPUT_TYPE_DOUBLE == typeEvent) {
|
||||||
//EDN_INFO("mouse-event BT1 ==> Double Clicked %d, %d", (uint32_t)event->x, (uint32_t)event->y);
|
//EDN_INFO("mouse-event BT1 ==> Double Clicked %d, %d", (uint32_t)event->x, (uint32_t)event->y);
|
||||||
m_bufferManager->Get(m_bufferID)->MouseEventDouble();
|
m_bufferManager->Get(m_bufferID)->MouseEventDouble();
|
||||||
OnRegenerateDisplay();
|
MarkToReedraw();
|
||||||
} else if (ewol::EVENT_INPUT_TYPE_TRIPLE == typeEvent) {
|
} else if (ewol::EVENT_INPUT_TYPE_TRIPLE == typeEvent) {
|
||||||
//EDN_INFO("mouse-event BT1 ==> Triple Clicked");
|
//EDN_INFO("mouse-event BT1 ==> Triple Clicked");
|
||||||
m_bufferManager->Get(m_bufferID)->MouseEventTriple();
|
m_bufferManager->Get(m_bufferID)->MouseEventTriple();
|
||||||
OnRegenerateDisplay();
|
MarkToReedraw();
|
||||||
} else if (ewol::EVENT_INPUT_TYPE_MOVE == typeEvent) {
|
} else if (ewol::EVENT_INPUT_TYPE_MOVE == typeEvent) {
|
||||||
if (true == m_buttunOneSelected) {
|
if (true == m_buttunOneSelected) {
|
||||||
int xxx, yyy;
|
int xxx, yyy;
|
||||||
@ -225,30 +231,33 @@ bool CodeView::OnEventInput(int32_t IdInput, ewol::eventInputType_te typeEvent,
|
|||||||
}
|
}
|
||||||
//EDN_INFO("mouse-motion BT1 %d, %d", xxx, yyy);
|
//EDN_INFO("mouse-motion BT1 %d, %d", xxx, yyy);
|
||||||
m_bufferManager->Get(m_bufferID)->MouseSelectFromCursorTo(xxx, yyy);
|
m_bufferManager->Get(m_bufferID)->MouseSelectFromCursorTo(xxx, yyy);
|
||||||
OnRegenerateDisplay();
|
MarkToReedraw();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (2 == IdInput) {
|
} else if (2 == IdInput) {
|
||||||
if (ewol::EVENT_INPUT_TYPE_SINGLE == typeEvent) {
|
if (ewol::EVENT_INPUT_TYPE_SINGLE == typeEvent) {
|
||||||
m_bufferManager->Get(m_bufferID)->MouseEvent(x, y);
|
m_bufferManager->Get(m_bufferID)->MouseEvent(x, y);
|
||||||
m_bufferManager->Get(m_bufferID)->Paste(COPY_MIDDLE_BUTTON);
|
m_bufferManager->Get(m_bufferID)->Paste(COPY_MIDDLE_BUTTON);
|
||||||
OnRegenerateDisplay();
|
MarkToReedraw();
|
||||||
ewol::widgetManager::FocusKeep(this);
|
ewol::widgetManager::FocusKeep(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// TODO : No mere used here ... ==> set in the scrooled windows ...
|
||||||
|
/*
|
||||||
if (4 == IdInput && ewol::EVENT_INPUT_TYPE_UP == typeEvent)
|
if (4 == IdInput && ewol::EVENT_INPUT_TYPE_UP == typeEvent)
|
||||||
{
|
{
|
||||||
//EDN_INFO("mouse-event GDK_SCROLL_UP");
|
//EDN_INFO("mouse-event GDK_SCROLL_UP");
|
||||||
m_bufferManager->Get(m_bufferID)->ScrollUp();
|
m_bufferManager->Get(m_bufferID)->ScrollUp();
|
||||||
OnRegenerateDisplay();
|
MarkToReedraw();
|
||||||
ewol::widgetManager::FocusKeep(this);
|
ewol::widgetManager::FocusKeep(this);
|
||||||
} else if (5 == IdInput && ewol::EVENT_INPUT_TYPE_UP == typeEvent)
|
} else if (5 == IdInput && ewol::EVENT_INPUT_TYPE_UP == typeEvent)
|
||||||
{
|
{
|
||||||
//EDN_INFO("mouse-event GDK_SCROLL_DOWN");
|
//EDN_INFO("mouse-event GDK_SCROLL_DOWN");
|
||||||
m_bufferManager->Get(m_bufferID)->ScrollDown();
|
m_bufferManager->Get(m_bufferID)->ScrollDown();
|
||||||
OnRegenerateDisplay();
|
MarkToReedraw();
|
||||||
ewol::widgetManager::FocusKeep(this);
|
ewol::widgetManager::FocusKeep(this);
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -410,7 +419,7 @@ bool CodeView::OnEventAreaExternal(int32_t widgetID, const char * generateEventI
|
|||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
// Force redraw of the widget
|
// Force redraw of the widget
|
||||||
OnRegenerateDisplay();
|
MarkToReedraw();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -34,8 +34,9 @@
|
|||||||
|
|
||||||
#include <etk/Types.h>
|
#include <etk/Types.h>
|
||||||
#include <ewol/Widget.h>
|
#include <ewol/Widget.h>
|
||||||
|
#include <ewol/widget/WidgetScrolled.h>
|
||||||
|
|
||||||
class CodeView :public ewol::Widget
|
class CodeView :public ewol::WidgetScrooled
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
CodeView(void);
|
CodeView(void);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user