Add the display of the buffer list and change some generic event of the edn system.
Add the text display with a different font ==> must rework all the event X/Y position of the mouse
This commit is contained in:
parent
9e0720b476
commit
0341795cbb
@ -147,7 +147,10 @@ void Buffer::SetLineDisplay(uint32_t lineNumber)
|
|||||||
* @return ---
|
* @return ---
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
int32_t Buffer::Display(ewol::OObject2DTextColored* OOText, ewol::OObject2DColored* OOColored, int32_t sizeX, int32_t sizeY)
|
int32_t Buffer::Display(ewol::OObject2DTextColored* OOTextNormal,
|
||||||
|
ewol::OObject2DTextColored* OOTextBold,
|
||||||
|
ewol::OObject2DTextColored* OOTextItalic,
|
||||||
|
ewol::OObject2DTextColored* OOTextBoldItalic, ewol::OObject2DColored* OOColored, int32_t sizeX, int32_t sizeY)
|
||||||
{
|
{
|
||||||
return ERR_NONE;
|
return ERR_NONE;
|
||||||
}
|
}
|
||||||
|
@ -82,7 +82,11 @@ class Buffer {
|
|||||||
virtual void GetInfo(infoStatBuffer_ts &infoToUpdate);
|
virtual void GetInfo(infoStatBuffer_ts &infoToUpdate);
|
||||||
virtual void SetLineDisplay(uint32_t lineNumber);
|
virtual void SetLineDisplay(uint32_t lineNumber);
|
||||||
|
|
||||||
virtual int32_t Display(ewol::OObject2DTextColored* OOText, ewol::OObject2DColored* OOColored, int32_t sizeX, int32_t sizeY);
|
virtual int32_t Display(ewol::OObject2DTextColored* OOTextNormal,
|
||||||
|
ewol::OObject2DTextColored* OOTextBold,
|
||||||
|
ewol::OObject2DTextColored* OOTextItalic,
|
||||||
|
ewol::OObject2DTextColored* OOTextBoldItalic,
|
||||||
|
ewol::OObject2DColored* OOColored, 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);
|
||||||
|
@ -67,7 +67,11 @@ BufferEmpty::~BufferEmpty(void)
|
|||||||
* @return ---
|
* @return ---
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
int32_t BufferEmpty::Display(ewol::OObject2DTextColored* OOText, ewol::OObject2DColored* OOColored, int32_t sizeX, int32_t sizeY)
|
int32_t BufferEmpty::Display(ewol::OObject2DTextColored* OOTextNormal,
|
||||||
|
ewol::OObject2DTextColored* OOTextBold,
|
||||||
|
ewol::OObject2DTextColored* OOTextItalic,
|
||||||
|
ewol::OObject2DTextColored* OOTextBoldItalic,
|
||||||
|
ewol::OObject2DColored* OOColored, int32_t sizeX, int32_t sizeY)
|
||||||
{
|
{
|
||||||
ColorizeManager * myColorManager = ColorizeManager::getInstance();
|
ColorizeManager * myColorManager = ColorizeManager::getInstance();
|
||||||
// Get color :
|
// Get color :
|
||||||
@ -75,7 +79,7 @@ int32_t BufferEmpty::Display(ewol::OObject2DTextColored* OOText, ewol::OObject2D
|
|||||||
//drawer.Flush();
|
//drawer.Flush();
|
||||||
|
|
||||||
|
|
||||||
if (NULL == OOText) {
|
if (NULL == OOTextNormal) {
|
||||||
EDN_ERROR("Input VALUE is NULL");
|
EDN_ERROR("Input VALUE is NULL");
|
||||||
return ERR_FAIL;
|
return ERR_FAIL;
|
||||||
}
|
}
|
||||||
@ -83,14 +87,16 @@ int32_t BufferEmpty::Display(ewol::OObject2DTextColored* OOText, ewol::OObject2D
|
|||||||
EDN_ERROR("Input VALUE is NULL");
|
EDN_ERROR("Input VALUE is NULL");
|
||||||
return ERR_FAIL;
|
return ERR_FAIL;
|
||||||
}
|
}
|
||||||
|
int32_t fontId = OOTextNormal->GetFontID();
|
||||||
|
int32_t letterHeight = ewol::GetHeight(fontId);
|
||||||
|
|
||||||
myColor = myColorManager->Get("normal");
|
myColor = myColorManager->Get("normal");
|
||||||
OOText->SetColor(myColor->GetFG());
|
OOTextNormal->SetColor(myColor->GetFG());
|
||||||
OOText->TextAdd(20, 20, "edn - Editeur De N'ours, l'Editeur Desoxyribo-Nucleique", sizeX);
|
OOTextNormal->TextAdd(20, 20, "edn - Editeur De N'ours, l'Editeur Desoxyribo-Nucleique", sizeX);
|
||||||
|
|
||||||
myColor = myColorManager->Get("commentDoxygen");
|
myColor = myColorManager->Get("commentDoxygen");
|
||||||
OOText->SetColor(myColor->GetFG());
|
OOTextNormal->SetColor(myColor->GetFG());
|
||||||
OOText->TextAdd(20, 50, "No Buffer Availlable to display", sizeX);
|
OOTextNormal->TextAdd(20, 20 + letterHeight*1.30, "No Buffer Availlable to display", sizeX);
|
||||||
|
|
||||||
|
|
||||||
color_ts bgColor; //!< Text color
|
color_ts bgColor; //!< Text color
|
||||||
|
@ -32,7 +32,11 @@ class BufferEmpty : public Buffer {
|
|||||||
public:
|
public:
|
||||||
BufferEmpty(void);
|
BufferEmpty(void);
|
||||||
virtual ~BufferEmpty(void);
|
virtual ~BufferEmpty(void);
|
||||||
int32_t Display(ewol::OObject2DTextColored* OOText, ewol::OObject2DColored* OOColored, int32_t sizeX, int32_t sizeY);
|
int32_t Display(ewol::OObject2DTextColored* OOTextNormal,
|
||||||
|
ewol::OObject2DTextColored* OOTextBold,
|
||||||
|
ewol::OObject2DTextColored* OOTextItalic,
|
||||||
|
ewol::OObject2DTextColored* OOTextBoldItalic,
|
||||||
|
ewol::OObject2DColored* OOColored, int32_t sizeX, int32_t sizeY);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -46,11 +46,14 @@ BufferManager::BufferManager(void)
|
|||||||
// nothing to do ...
|
// nothing to do ...
|
||||||
BufferNotExiste = new BufferEmpty();
|
BufferNotExiste = new BufferEmpty();
|
||||||
m_idSelected = -1;
|
m_idSelected = -1;
|
||||||
|
ewol::widgetMessageMultiCast::Add(GetWidgetId(), ednMsgGuiNew);
|
||||||
|
/*
|
||||||
ewol::widgetMessageMultiCast::Add(GetWidgetId(), ednMsgBufferManagerNewFile);
|
ewol::widgetMessageMultiCast::Add(GetWidgetId(), ednMsgBufferManagerNewFile);
|
||||||
ewol::widgetMessageMultiCast::Add(GetWidgetId(), ednMsgBufferManagerSaveAll);
|
ewol::widgetMessageMultiCast::Add(GetWidgetId(), ednMsgBufferManagerSaveAll);
|
||||||
ewol::widgetMessageMultiCast::Add(GetWidgetId(), ednMsgBufferManagerCloseAll);
|
ewol::widgetMessageMultiCast::Add(GetWidgetId(), ednMsgBufferManagerCloseAll);
|
||||||
ewol::widgetMessageMultiCast::Add(GetWidgetId(), ednMsgBufferManagerClose);
|
ewol::widgetMessageMultiCast::Add(GetWidgetId(), ednMsgBufferManagerClose);
|
||||||
ewol::widgetMessageMultiCast::Add(GetWidgetId(), ednMsgBufferManagerSave);
|
ewol::widgetMessageMultiCast::Add(GetWidgetId(), ednMsgBufferManagerSave);
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -76,6 +79,15 @@ BufferManager::~BufferManager(void)
|
|||||||
|
|
||||||
bool BufferManager::OnEventAreaExternal(int32_t widgetID, const char * generateEventId, const char * eventExternId, etkFloat_t x, etkFloat_t y)
|
bool BufferManager::OnEventAreaExternal(int32_t widgetID, const char * generateEventId, const char * eventExternId, etkFloat_t x, etkFloat_t y)
|
||||||
{
|
{
|
||||||
|
if (generateEventId == ednMsgGuiNew) {
|
||||||
|
int32_t newOne = Create();
|
||||||
|
if (-1 != newOne) {
|
||||||
|
ewol::widgetMessageMultiCast::Send(GetWidgetId(), ednMsgBufferId, newOne);
|
||||||
|
ewol::widgetMessageMultiCast::Send(GetWidgetId(), ednMsgBufferListChange);
|
||||||
|
}
|
||||||
|
} else if (generateEventId == NULL) {
|
||||||
|
|
||||||
|
}
|
||||||
/*
|
/*
|
||||||
switch (id)
|
switch (id)
|
||||||
{
|
{
|
||||||
|
@ -238,12 +238,14 @@ void BufferText::SetLineDisplay(uint32_t lineNumber)
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#define SEPARATION_SIZE_LINE_NUMBER (3)
|
||||||
|
|
||||||
void BufferText::DrawLineNumber(ewol::OObject2DTextColored* OOText, ewol::OObject2DColored* OOColored, int32_t sizeX, int32_t sizeY,char *myPrint, int32_t lineNumber, int32_t positionY)
|
void BufferText::DrawLineNumber(ewol::OObject2DTextColored* OOText, ewol::OObject2DColored* OOColored, int32_t sizeX, int32_t sizeY,char *myPrint, int32_t lineNumber, int32_t positionY)
|
||||||
{
|
{
|
||||||
char tmpLineNumber[50];
|
char tmpLineNumber[50];
|
||||||
sprintf(tmpLineNumber, myPrint, lineNumber);
|
sprintf(tmpLineNumber, myPrint, lineNumber);
|
||||||
OOColored->SetColor(myColorManager->Get(COLOR_LIST_BG_2));
|
OOColored->SetColor(myColorManager->Get(COLOR_LIST_BG_2));
|
||||||
OOColored->Rectangle( 0, positionY, 68, sizeY);
|
OOColored->Rectangle( 0, positionY, sizeX+0.5*SEPARATION_SIZE_LINE_NUMBER, sizeY);
|
||||||
OOText->SetColor(myColorManager->Get(COLOR_CODE_LINE_NUMBER));
|
OOText->SetColor(myColorManager->Get(COLOR_CODE_LINE_NUMBER));
|
||||||
OOText->TextAdd(1, positionY, tmpLineNumber, -1);
|
OOText->TextAdd(1, positionY, tmpLineNumber, -1);
|
||||||
}
|
}
|
||||||
@ -291,6 +293,11 @@ void BufferText::UpdatePointerNumber(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
// TODO : Remove this ... it is really bad...
|
||||||
|
|
||||||
|
static int32_t g_basicfontId = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Display the curent buffer with all the probematic imposed by the xharset and the user contraint.
|
* @brief Display the curent buffer with all the probematic imposed by the xharset and the user contraint.
|
||||||
*
|
*
|
||||||
@ -299,13 +306,19 @@ void BufferText::UpdatePointerNumber(void)
|
|||||||
* @return
|
* @return
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
int32_t BufferText::Display(ewol::OObject2DTextColored* OOText, ewol::OObject2DColored* OOColored, int32_t sizeX, int32_t sizeY)
|
int32_t BufferText::Display(ewol::OObject2DTextColored* OOTextNormal,
|
||||||
|
ewol::OObject2DTextColored* OOTextBold,
|
||||||
|
ewol::OObject2DTextColored* OOTextItalic,
|
||||||
|
ewol::OObject2DTextColored* OOTextBoldItalic,
|
||||||
|
ewol::OObject2DColored* OOColored, int32_t sizeX, int32_t sizeY)
|
||||||
{
|
{
|
||||||
int32_t selStart, selEnd, selRectStart, selRectEnd;
|
int32_t selStart, selEnd, selRectStart, selRectEnd;
|
||||||
bool selIsRect;
|
bool selIsRect;
|
||||||
int32_t selHave;
|
int32_t selHave;
|
||||||
|
|
||||||
int32_t fontId = ewol::GetDefaultFontId();
|
int32_t fontId = OOTextNormal->GetFontID();
|
||||||
|
// TODO : Remove this ...
|
||||||
|
g_basicfontId = fontId;
|
||||||
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);
|
||||||
|
|
||||||
@ -341,9 +354,10 @@ int32_t BufferText::Display(ewol::OObject2DTextColored* OOText, ewol::OObject2DC
|
|||||||
color_ts & myColorSpace = myColorManager->Get(COLOR_CODE_SPACE);
|
color_ts & myColorSpace = myColorManager->Get(COLOR_CODE_SPACE);
|
||||||
color_ts & myColorTab = myColorManager->Get(COLOR_CODE_TAB);
|
color_ts & myColorTab = myColorManager->Get(COLOR_CODE_TAB);
|
||||||
Colorize * selectColor = NULL;
|
Colorize * selectColor = NULL;
|
||||||
|
ewol::OObject2DTextColored* OOTextSelected = NULL;
|
||||||
|
|
||||||
int mylen = m_EdnBuf.Size();
|
int mylen = m_EdnBuf.Size();
|
||||||
int32_t x_base=nbColoneForLineNumber*letterWidth + 3;
|
int32_t x_base=nbColoneForLineNumber*letterWidth;
|
||||||
int32_t idX = 0;
|
int32_t idX = 0;
|
||||||
|
|
||||||
OOColored->SetColor(myColorManager->Get(COLOR_CODE_BASIC_BG));
|
OOColored->SetColor(myColorManager->Get(COLOR_CODE_BASIC_BG));
|
||||||
@ -369,8 +383,8 @@ int32_t BufferText::Display(ewol::OObject2DTextColored* OOText, ewol::OObject2DC
|
|||||||
drawClipping.w = sizeX;
|
drawClipping.w = sizeX;
|
||||||
drawClipping.h = sizeY;
|
drawClipping.h = sizeY;
|
||||||
|
|
||||||
DrawLineNumber(OOText, OOColored, sizeX, sizeY, myPrint, currentLineID, y);
|
DrawLineNumber(OOTextNormal, OOColored, x_base, sizeY, myPrint, currentLineID, y);
|
||||||
int32_t pixelX = x_base;
|
int32_t pixelX = x_base + SEPARATION_SIZE_LINE_NUMBER;
|
||||||
for (iii=m_displayStartBufferPos; iii<mylen && displayLines < m_displaySize.y ; iii = new_i) {
|
for (iii=m_displayStartBufferPos; iii<mylen && displayLines < m_displaySize.y ; iii = new_i) {
|
||||||
//EDN_DEBUG("diplay element=" << iii);
|
//EDN_DEBUG("diplay element=" << iii);
|
||||||
int displaywidth;
|
int displaywidth;
|
||||||
@ -411,11 +425,24 @@ int32_t BufferText::Display(ewol::OObject2DTextColored* OOText, ewol::OObject2DC
|
|||||||
haveBg = selectColor->HaveBg();
|
haveBg = selectColor->HaveBg();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
OOText->SetColor(selectColor->GetFG());
|
|
||||||
coord2D_ts textPos;
|
coord2D_ts textPos;
|
||||||
textPos.x = pixelX-m_displayStartPixelX;
|
textPos.x = pixelX-m_displayStartPixelX;
|
||||||
textPos.y = y;
|
textPos.y = y;
|
||||||
drawSize = OOText->TextAdd(textPos, drawClipping, displayChar);
|
if (true == selectColor->GetItalic() ) {
|
||||||
|
if (true == selectColor->GetBold() ) {
|
||||||
|
OOTextSelected = OOTextBoldItalic;
|
||||||
|
} else {
|
||||||
|
OOTextSelected = OOTextItalic;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (true == selectColor->GetBold() ) {
|
||||||
|
OOTextSelected = OOTextBold;
|
||||||
|
} else {
|
||||||
|
OOTextSelected = OOTextNormal;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
OOTextSelected->SetColor(selectColor->GetFG());
|
||||||
|
drawSize = OOTextSelected->TextAdd(textPos, drawClipping, displayChar);
|
||||||
if (true == haveBg ) {
|
if (true == haveBg ) {
|
||||||
OOColored->Rectangle( pixelX, y, drawSize, letterHeight, drawClipping);
|
OOColored->Rectangle( pixelX, y, drawSize, letterHeight, drawClipping);
|
||||||
}
|
}
|
||||||
@ -430,11 +457,11 @@ int32_t BufferText::Display(ewol::OObject2DTextColored* OOText, ewol::OObject2DC
|
|||||||
// move to next line ...
|
// move to next line ...
|
||||||
if (currentChar=='\n') {
|
if (currentChar=='\n') {
|
||||||
idX =0;
|
idX =0;
|
||||||
pixelX = x_base;
|
pixelX = x_base + SEPARATION_SIZE_LINE_NUMBER;
|
||||||
y += letterHeight;
|
y += letterHeight;
|
||||||
displayLines++;
|
displayLines++;
|
||||||
currentLineID++;
|
currentLineID++;
|
||||||
DrawLineNumber(OOText, OOColored, sizeX, sizeY, myPrint, currentLineID, y);
|
DrawLineNumber(OOTextNormal, OOColored, x_base, sizeY, myPrint, currentLineID, y);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// special case : the cursor is at the end of the buffer...
|
// special case : the cursor is at the end of the buffer...
|
||||||
@ -453,9 +480,8 @@ int32_t BufferText::Display(ewol::OObject2DTextColored* OOText, ewol::OObject2DC
|
|||||||
|
|
||||||
int32_t BufferText::GetMousePosition(int32_t width, int32_t height)
|
int32_t BufferText::GetMousePosition(int32_t width, int32_t height)
|
||||||
{
|
{
|
||||||
int32_t fontId = ewol::GetDefaultFontId();
|
int32_t letterWidth = ewol::GetWidth(g_basicfontId, "9");
|
||||||
int32_t letterWidth = ewol::GetWidth(fontId, "9");
|
int32_t letterHeight = ewol::GetHeight(g_basicfontId);
|
||||||
int32_t letterHeight = ewol::GetHeight(fontId);
|
|
||||||
|
|
||||||
int32_t lineOffset = height / letterHeight;
|
int32_t lineOffset = height / letterHeight;
|
||||||
|
|
||||||
@ -479,7 +505,7 @@ int32_t BufferText::GetMousePosition(int32_t width, int32_t height)
|
|||||||
int32_t iii, new_i;
|
int32_t iii, new_i;
|
||||||
|
|
||||||
int mylen = m_EdnBuf.Size();
|
int mylen = m_EdnBuf.Size();
|
||||||
int32_t x_base=nbColoneForLineNumber*letterWidth + 3;
|
int32_t x_base=nbColoneForLineNumber*letterWidth + SEPARATION_SIZE_LINE_NUMBER;
|
||||||
int32_t idX = 0;
|
int32_t idX = 0;
|
||||||
|
|
||||||
uniChar_t displayChar[MAX_EXP_CHAR_LEN];
|
uniChar_t displayChar[MAX_EXP_CHAR_LEN];
|
||||||
@ -499,7 +525,7 @@ int32_t BufferText::GetMousePosition(int32_t width, int32_t height)
|
|||||||
new_i = iii;
|
new_i = iii;
|
||||||
displaywidth = m_EdnBuf.GetExpandedChar(new_i, idX, displayChar, currentChar);
|
displaywidth = m_EdnBuf.GetExpandedChar(new_i, idX, displayChar, currentChar);
|
||||||
if (currentChar!='\n') {
|
if (currentChar!='\n') {
|
||||||
int32_t drawSize = ewol::GetWidth(fontId, displayChar);
|
int32_t drawSize = ewol::GetWidth(g_basicfontId, displayChar);
|
||||||
EDN_DEBUG(" Element : " << currentChar << "=\"" << (char)currentChar << "\" display offset=" << pixelX << "px width=" << drawSize << "px");
|
EDN_DEBUG(" Element : " << currentChar << "=\"" << (char)currentChar << "\" display offset=" << pixelX << "px width=" << drawSize << "px");
|
||||||
pixelX += drawSize;
|
pixelX += drawSize;
|
||||||
if (width <= pixelX) {
|
if (width <= pixelX) {
|
||||||
|
@ -46,7 +46,11 @@ class BufferText : public Buffer {
|
|||||||
void GetInfo(infoStatBuffer_ts &infoToUpdate);
|
void GetInfo(infoStatBuffer_ts &infoToUpdate);
|
||||||
void SetLineDisplay(uint32_t lineNumber);
|
void SetLineDisplay(uint32_t lineNumber);
|
||||||
|
|
||||||
int32_t Display(ewol::OObject2DTextColored* OOText, ewol::OObject2DColored* OOColored, int32_t sizeX, int32_t sizeY);
|
int32_t Display(ewol::OObject2DTextColored* OOTextNormal,
|
||||||
|
ewol::OObject2DTextColored* OOTextBold,
|
||||||
|
ewol::OObject2DTextColored* OOTextItalic,
|
||||||
|
ewol::OObject2DTextColored* OOTextBoldItalic,
|
||||||
|
ewol::OObject2DColored* OOColored, 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);
|
||||||
|
@ -37,46 +37,13 @@
|
|||||||
|
|
||||||
BufferView::BufferView(void)
|
BufferView::BufferView(void)
|
||||||
{
|
{
|
||||||
m_shawableAreaX = 0;
|
|
||||||
m_shawableAreaY = 0;
|
|
||||||
//ewol::widgetMessageMultiCast::Add(GetWidgetId(), ednMsgBufferManagerNewFile);
|
|
||||||
// Init link with the buffer Manager
|
// Init link with the buffer Manager
|
||||||
//m_bufferManager = BufferManager::Get();
|
m_bufferManager = BufferManager::getInstance();
|
||||||
//m_colorManager = ColorizeManager::Get();
|
m_colorManager = ColorizeManager::getInstance();
|
||||||
#if 0
|
SetCanHaveFocus(true);
|
||||||
m_widget = gtk_drawing_area_new();
|
ewol::widgetMessageMultiCast::Add(GetWidgetId(), ednMsgBufferListChange);
|
||||||
gtk_widget_set_size_request( m_widget, 250, 100);
|
ewol::widgetMessageMultiCast::Add(GetWidgetId(), ednMsgBufferState);
|
||||||
|
ewol::widgetMessageMultiCast::Add(GetWidgetId(), ednMsgBufferId);
|
||||||
gtk_widget_add_events( m_widget,
|
|
||||||
GDK_KEY_PRESS_MASK
|
|
||||||
| GDK_BUTTON_PRESS_MASK
|
|
||||||
| GDK_BUTTON_RELEASE_MASK
|
|
||||||
| GDK_POINTER_MOTION_MASK
|
|
||||||
| GDK_POINTER_MOTION_HINT_MASK);
|
|
||||||
|
|
||||||
# ifdef USE_GTK_VERSION_3_0
|
|
||||||
g_object_set(m_widget,"can-focus", TRUE, NULL);
|
|
||||||
# elif defined( USE_GTK_VERSION_2_0 )
|
|
||||||
GTK_WIDGET_SET_FLAGS(m_widget, GTK_CAN_FOCUS);
|
|
||||||
# endif
|
|
||||||
// Focus Event
|
|
||||||
g_signal_connect( G_OBJECT(m_widget), "focus_in_event", G_CALLBACK(CB_focusGet), this);
|
|
||||||
g_signal_connect( G_OBJECT(m_widget), "focus_out_event", G_CALLBACK(CB_focusLost), this);
|
|
||||||
// Keyboard Event
|
|
||||||
g_signal_connect_after( G_OBJECT(m_widget), "key_press_event", G_CALLBACK(CB_keyboardEvent), this);
|
|
||||||
g_signal_connect_after( G_OBJECT(m_widget), "key_release_event", G_CALLBACK(CB_keyboardEvent), this);
|
|
||||||
// Mouse Event
|
|
||||||
g_signal_connect( G_OBJECT(m_widget), "button_press_event", G_CALLBACK(CB_mouseButtonEvent), this);
|
|
||||||
g_signal_connect( G_OBJECT(m_widget), "button_release_event", G_CALLBACK(CB_mouseButtonEvent), this);
|
|
||||||
g_signal_connect( G_OBJECT(m_widget), "motion_notify_event", G_CALLBACK(CB_mouseMotionEvent), this);
|
|
||||||
// Display Event
|
|
||||||
g_signal_connect( G_OBJECT(m_widget), "realize", G_CALLBACK(CB_displayInit), this);
|
|
||||||
# ifdef USE_GTK_VERSION_3_0
|
|
||||||
g_signal_connect( G_OBJECT(m_widget), "draw", G_CALLBACK(CB_displayDraw), this);
|
|
||||||
# elif defined( USE_GTK_VERSION_2_0 )
|
|
||||||
g_signal_connect( G_OBJECT(m_widget), "expose_event", G_CALLBACK(CB_displayDraw), this);
|
|
||||||
# endif
|
|
||||||
#endif
|
|
||||||
m_selectedID = -1;
|
m_selectedID = -1;
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -93,25 +60,105 @@ 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) {
|
||||||
switch (id)
|
OnRegenerateDisplay();
|
||||||
{
|
}else if (ednMsgBufferId == ednMsgBufferListChange) {
|
||||||
case EDN_MSG__BUFFER_CHANGE_CURRENT:
|
OnRegenerateDisplay();
|
||||||
m_selectedID = dataID;
|
}else if (ednMsgBufferState == ednMsgBufferListChange) {
|
||||||
case EDN_MSG__BUFFER_CHANGE_STATE:
|
OnRegenerateDisplay();
|
||||||
case EDN_MSG__BUFFER_CHANGE_NAME:
|
|
||||||
case EDN_MSG__BUFFER_CHANGE_MODIFY:
|
|
||||||
// change Title :
|
|
||||||
//gtk_widget_queue_draw(m_widget);
|
|
||||||
break;
|
|
||||||
case EDN_MSG__USER_DISPLAY_CHANGE:
|
|
||||||
// Redraw all the display ...
|
|
||||||
//gtk_widget_queue_draw(m_widget);
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
color_ts BufferView::GetBasicBG(void)
|
||||||
|
{
|
||||||
|
return m_colorManager->Get(COLOR_LIST_BG_1);
|
||||||
|
}
|
||||||
|
|
||||||
|
uint32_t BufferView::GetNuberOfColomn(void)
|
||||||
|
{
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool BufferView::GetTitle(int32_t colomn, etk::String &myTitle, color_ts &fg, color_ts &bg)
|
||||||
|
{
|
||||||
|
myTitle = "Buffers : ";
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint32_t BufferView::GetNuberOfRaw(void)
|
||||||
|
{
|
||||||
|
if (NULL != m_bufferManager) {
|
||||||
|
return m_bufferManager->Size();
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool BufferView::GetElement(int32_t colomn, int32_t raw, etk::String &myTextToWrite, color_ts &fg, color_ts &bg)
|
||||||
|
{
|
||||||
|
etk::File name;
|
||||||
|
bool isModify;
|
||||||
|
basicColor_te selectFG = COLOR_LIST_TEXT_NORMAL;
|
||||||
|
basicColor_te selectBG = COLOR_LIST_BG_1;
|
||||||
|
if (m_bufferManager->Exist(raw)) {
|
||||||
|
isModify = m_bufferManager->Get(raw)->IsModify();
|
||||||
|
name = m_bufferManager->Get(raw)->GetFileName();
|
||||||
|
char *tmpModify = (char*)" ";
|
||||||
|
if (true == isModify) {
|
||||||
|
tmpModify = (char*)"M";
|
||||||
|
}
|
||||||
|
char name2[1024] = "";
|
||||||
|
sprintf(name2, "[%2d](%s) %s", raw, tmpModify, name.GetShortFilename().c_str() );
|
||||||
|
|
||||||
|
myTextToWrite = name2;
|
||||||
|
|
||||||
|
if (true == isModify) {
|
||||||
|
selectFG = COLOR_LIST_TEXT_MODIFY;
|
||||||
|
} else {
|
||||||
|
selectFG = COLOR_LIST_TEXT_NORMAL;
|
||||||
|
}
|
||||||
|
if (raw%2==0) {
|
||||||
|
selectBG = COLOR_LIST_BG_1;
|
||||||
|
} else {
|
||||||
|
selectBG = COLOR_LIST_BG_2;
|
||||||
|
}
|
||||||
|
if (m_selectedID == raw) {
|
||||||
|
selectBG = COLOR_LIST_BG_SELECTED;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
myTextToWrite = "ERROR";
|
||||||
|
}
|
||||||
|
fg = m_colorManager->Get(selectFG);
|
||||||
|
bg = m_colorManager->Get(selectBG);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool BufferView::OnItemEvent(int32_t IdInput, ewol::eventInputType_te typeEvent, int32_t colomn, int32_t raw, etkFloat_t x, etkFloat_t y)
|
||||||
|
{
|
||||||
|
if (typeEvent == ewol::EVENT_INPUT_TYPE_SINGLE) {
|
||||||
|
EDN_INFO("Event on List : IdInput=" << IdInput << " colomn=" << colomn << " raw=" << raw );
|
||||||
|
int32_t selectBuf = m_bufferManager->WitchBuffer(raw+1);
|
||||||
|
if ( 0 <= selectBuf) {
|
||||||
|
m_selectedID = raw;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (typeEvent == ewol::EVENT_INPUT_TYPE_DOUBLE) {
|
||||||
|
EDN_INFO("Event Double on List : IdInput=" << IdInput << " colomn=" << colomn << " raw=" << raw );
|
||||||
|
int32_t selectBuf = m_bufferManager->WitchBuffer(raw+1);
|
||||||
|
//EDN_INFO(" plop %d / %d = %d ==> %d", (uint32_t)event->y, fontHeight, ((uint32_t)event->y / fontHeight), selectBuf);
|
||||||
|
if ( 0 <= selectBuf) {
|
||||||
|
ewol::widgetMessageMultiCast::Send(GetWidgetId(), ednMsgBufferId, selectBuf);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
OnRegenerateDisplay();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
|
|
||||||
gboolean BufferView::CB_displayDraw( GtkWidget *widget, GdkEventExpose *event, gpointer data)
|
gboolean BufferView::CB_displayDraw( GtkWidget *widget, GdkEventExpose *event, gpointer data)
|
||||||
|
@ -30,10 +30,11 @@
|
|||||||
#include <BufferManager.h>
|
#include <BufferManager.h>
|
||||||
#include <Display.h>
|
#include <Display.h>
|
||||||
#include <MsgBroadcast.h>
|
#include <MsgBroadcast.h>
|
||||||
|
#include <ewol/widget/List.h>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class BufferView : public ewol::Widget
|
class BufferView : public ewol::List
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
// Constructeur
|
// Constructeur
|
||||||
@ -41,34 +42,19 @@ class BufferView : public ewol::Widget
|
|||||||
~BufferView(void);
|
~BufferView(void);
|
||||||
//GtkWidget *GetMainWidget(void);
|
//GtkWidget *GetMainWidget(void);
|
||||||
bool OnEventAreaExternal(int32_t widgetID, const char * generateEventId, const char * eventExternId, etkFloat_t x, etkFloat_t y);
|
bool OnEventAreaExternal(int32_t widgetID, const char * generateEventId, const char * eventExternId, etkFloat_t x, etkFloat_t y);
|
||||||
/*
|
protected:
|
||||||
// sur : GTK+ callback :
|
// function call to display the list :
|
||||||
static gboolean CB_displayDraw( GtkWidget *widget, GdkEventExpose *event, gpointer data);
|
virtual color_ts GetBasicBG(void);
|
||||||
static gboolean CB_displayInit( GtkWidget *widget, gpointer data);
|
virtual uint32_t GetNuberOfColomn(void);
|
||||||
static gint CB_focusGet( GtkWidget *widget, GdkEventFocus *event, gpointer data);
|
virtual bool GetTitle(int32_t colomn, etk::String &myTitle, color_ts &fg, color_ts &bg);
|
||||||
static gint CB_focusLost( GtkWidget *widget, GdkEventFocus *event, gpointer data);
|
virtual uint32_t GetNuberOfRaw(void);
|
||||||
static gint CB_keyboardEvent( GtkWidget *widget, GdkEventKey *event, gpointer data);
|
virtual bool GetElement(int32_t colomn, int32_t raw, etk::String &myTextToWrite, color_ts &fg, color_ts &bg);
|
||||||
static gint CB_mouseButtonEvent(GtkWidget *widget, GdkEventButton *event, gpointer data);
|
virtual bool OnItemEvent(int32_t IdInput, ewol::eventInputType_te typeEvent, int32_t colomn, int32_t raw, etkFloat_t x, etkFloat_t y);
|
||||||
static gint CB_mouseMotionEvent( GtkWidget *widget, GdkEventMotion *event, gpointer data);
|
|
||||||
static void CB_EventOnBufferManager(gpointer data);
|
|
||||||
|
|
||||||
static void OnPopupEventShow(GtkWidget *menuitem, gpointer data);
|
|
||||||
static void OnPopupEventClose(GtkWidget *menuitem, gpointer data);
|
|
||||||
static void OnPopupEventSave(GtkWidget *menuitem, gpointer data);
|
|
||||||
static void OnPopupEventSaveAs(GtkWidget *menuitem, gpointer data);
|
|
||||||
*/
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
//void ViewPopupMenu(GtkWidget *parrent, GdkEventButton *event, int32_t BufferID);
|
|
||||||
// main windows widget :
|
|
||||||
//GtkWidget * m_widget;
|
|
||||||
// récupération des proprieter général...
|
// récupération des proprieter général...
|
||||||
BufferManager * m_bufferManager;
|
BufferManager * m_bufferManager;
|
||||||
ColorizeManager * m_colorManager;
|
ColorizeManager * m_colorManager;
|
||||||
int32_t m_shawableAreaX;
|
|
||||||
int32_t m_shawableAreaY;
|
|
||||||
int32_t m_selectedID;
|
int32_t m_selectedID;
|
||||||
int32_t m_contectMenuSelectID;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -46,6 +46,12 @@
|
|||||||
CodeView::CodeView(void)
|
CodeView::CodeView(void)
|
||||||
{
|
{
|
||||||
m_label = "CodeView is disable ...";
|
m_label = "CodeView is disable ...";
|
||||||
|
m_fontNormal = -1;
|
||||||
|
m_fontBold = -1;
|
||||||
|
m_fontItalic = -1;
|
||||||
|
m_fontBoldItalic = -1;
|
||||||
|
m_fontSize = 15;
|
||||||
|
|
||||||
m_bufferID = -1;
|
m_bufferID = -1;
|
||||||
m_buttunOneSelected = false;
|
m_buttunOneSelected = false;
|
||||||
|
|
||||||
@ -63,6 +69,10 @@ CodeView::CodeView(void)
|
|||||||
m_textColorBg.blue = 0.0;
|
m_textColorBg.blue = 0.0;
|
||||||
m_textColorBg.alpha = 0.25;
|
m_textColorBg.alpha = 0.25;
|
||||||
SetCanHaveFocus(true);
|
SetCanHaveFocus(true);
|
||||||
|
ewol::widgetMessageMultiCast::Add(GetWidgetId(), ednMsgBufferId);
|
||||||
|
|
||||||
|
|
||||||
|
//old
|
||||||
ewol::widgetMessageMultiCast::Add(GetWidgetId(), ednMsgCodeViewCurrentChangeBufferId);
|
ewol::widgetMessageMultiCast::Add(GetWidgetId(), ednMsgCodeViewCurrentChangeBufferId);
|
||||||
ewol::widgetMessageMultiCast::Add(GetWidgetId(), ednMsgCodeViewCurrentSave);
|
ewol::widgetMessageMultiCast::Add(GetWidgetId(), ednMsgCodeViewCurrentSave);
|
||||||
ewol::widgetMessageMultiCast::Add(GetWidgetId(), ednMsgCodeViewCurrentSaveAs);
|
ewol::widgetMessageMultiCast::Add(GetWidgetId(), ednMsgCodeViewCurrentSaveAs);
|
||||||
@ -101,37 +111,24 @@ bool CodeView::CalculateMinSize(void)
|
|||||||
void CodeView::OnRegenerateDisplay(void)
|
void CodeView::OnRegenerateDisplay(void)
|
||||||
{
|
{
|
||||||
// create tmp object :
|
// create tmp object :
|
||||||
ewol::OObject2DTextColored* myOObjectText = new ewol::OObject2DTextColored("", -1);
|
ewol::OObject2DTextColored* myOObjectTextNormal = new ewol::OObject2DTextColored(m_fontNormal);
|
||||||
|
ewol::OObject2DTextColored* myOObjectTextBold = new ewol::OObject2DTextColored(m_fontBold);
|
||||||
|
ewol::OObject2DTextColored* myOObjectTextItalic = new ewol::OObject2DTextColored(m_fontItalic);
|
||||||
|
ewol::OObject2DTextColored* myOObjectTextBoldItalic = new ewol::OObject2DTextColored(m_fontBoldItalic);
|
||||||
ewol::OObject2DColored* myOObjectsColored = new ewol::OObject2DColored();
|
ewol::OObject2DColored* myOObjectsColored = new ewol::OObject2DColored();
|
||||||
|
|
||||||
// generate the objects :
|
// generate the objects :
|
||||||
//m_bufferID = 0;
|
//m_bufferID = 0;
|
||||||
m_bufferManager->Get(m_bufferID)->Display(myOObjectText, myOObjectsColored, m_size.x, m_size.y);
|
m_bufferManager->Get(m_bufferID)->Display(myOObjectTextNormal, myOObjectTextBold, myOObjectTextItalic, myOObjectTextBoldItalic, myOObjectsColored, m_size.x, m_size.y);
|
||||||
|
|
||||||
// clean the object list ...
|
// clean the object list ...
|
||||||
ClearOObjectList();
|
ClearOObjectList();
|
||||||
// add generated element
|
// add generated element
|
||||||
AddOObject(myOObjectsColored, "CodeViewBackground");
|
AddOObject(myOObjectsColored, "CodeViewBackground");
|
||||||
AddOObject(myOObjectText, "CodeViewText");
|
AddOObject(myOObjectTextNormal, "CodeViewTextNormal");
|
||||||
}
|
AddOObject(myOObjectTextBold, "CodeViewTextBold");
|
||||||
|
AddOObject(myOObjectTextItalic, "CodeViewTextItalic");
|
||||||
bool CodeView::OnEventArea(const char * generateEventId, etkFloat_t x, etkFloat_t y)
|
AddOObject(myOObjectTextBoldItalic, "CodeViewTextBoldItalic");
|
||||||
{
|
|
||||||
/*
|
|
||||||
//bool eventIsOK = false;
|
|
||||||
//EWOL_DEBUG("Receive event : \"" << generateEventId << "\"");
|
|
||||||
if(ewolEventButtonPressed == generateEventId) {
|
|
||||||
EWOL_INFO("BT pressed ... " << m_label);
|
|
||||||
//eventIsOK = true;
|
|
||||||
ewol::widgetManager::FocusKeep(this);
|
|
||||||
} else if(ewolEventButtonEnter == generateEventId) {
|
|
||||||
OnRegenerateDisplay();
|
|
||||||
}
|
|
||||||
//return eventIsOK;
|
|
||||||
*/
|
|
||||||
// in every case this not stop the propagation of the event
|
|
||||||
return false;
|
|
||||||
// if overwrited... you can ...
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -239,13 +236,13 @@ bool CodeView::OnEventInput(int32_t IdInput, ewol::eventInputType_te typeEvent,
|
|||||||
ewol::widgetManager::FocusKeep(this);
|
ewol::widgetManager::FocusKeep(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (4 == IdInput && ewol::EVENT_INPUT_TYPE_SINGLE == 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();
|
OnRegenerateDisplay();
|
||||||
ewol::widgetManager::FocusKeep(this);
|
ewol::widgetManager::FocusKeep(this);
|
||||||
} else if (5 == IdInput && ewol::EVENT_INPUT_TYPE_SINGLE == 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();
|
||||||
@ -257,18 +254,29 @@ bool CodeView::OnEventInput(int32_t IdInput, ewol::eventInputType_te typeEvent,
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
bool CodeView::OnEventAreaExternal(int32_t widgetID, const char * generateEventId, const char * eventExternId, etkFloat_t x, etkFloat_t y)
|
bool CodeView::OnEventAreaExternal(int32_t widgetID, const char * generateEventId, const char * data, etkFloat_t x, etkFloat_t y)
|
||||||
{
|
{
|
||||||
EDN_DEBUG("Extern Event : " << widgetID << " type : " << generateEventId << " position(" << x << "," << y << ")");
|
EDN_DEBUG("Extern Event : " << widgetID << " type : " << generateEventId << " position(" << x << "," << y << ")");
|
||||||
|
|
||||||
if( ednMsgCodeViewCurrentChangeBufferId == generateEventId) {
|
|
||||||
|
|
||||||
|
if( ednMsgBufferId == generateEventId) {
|
||||||
int32_t bufferID = 0;
|
int32_t bufferID = 0;
|
||||||
sscanf(eventExternId, "%d", &bufferID);
|
sscanf(data, "%d", &bufferID);
|
||||||
|
EDN_INFO("Select a new Buffer ... " << bufferID);
|
||||||
|
m_bufferID = bufferID;
|
||||||
|
m_bufferManager->Get(m_bufferID)->ForceReDraw(true);
|
||||||
|
// TODO : need to update the state of the file and the filenames ...
|
||||||
|
}
|
||||||
|
// old
|
||||||
|
else if( ednMsgCodeViewCurrentChangeBufferId == generateEventId) {
|
||||||
|
int32_t bufferID = 0;
|
||||||
|
sscanf(data, "%d", &bufferID);
|
||||||
EDN_INFO("Select a new Buffer ... " << bufferID);
|
EDN_INFO("Select a new Buffer ... " << bufferID);
|
||||||
m_bufferID = bufferID;
|
m_bufferID = bufferID;
|
||||||
m_bufferManager->Get(m_bufferID)->ForceReDraw(true);
|
m_bufferManager->Get(m_bufferID)->ForceReDraw(true);
|
||||||
// request the display of the curent Editor
|
// request the display of the curent Editor
|
||||||
ewol::widgetMessageMultiCast::Send(GetWidgetId(), ednMsgBufferChangeCurrent, (char*)eventExternId);
|
ewol::widgetMessageMultiCast::Send(GetWidgetId(), ednMsgBufferChangeCurrent, (char*)data);
|
||||||
|
|
||||||
} else if (ednMsgCodeViewCurrentSave == generateEventId) {
|
} else if (ednMsgCodeViewCurrentSave == generateEventId) {
|
||||||
|
|
||||||
@ -420,4 +428,39 @@ void CodeView::OnLostFocus(void)
|
|||||||
EDN_INFO("Focus - out");
|
EDN_INFO("Focus - out");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CodeView::SetFontSize(int32_t size)
|
||||||
|
{
|
||||||
|
m_fontSize = size;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CodeView::SetFontNameNormal(etk::String fontName)
|
||||||
|
{
|
||||||
|
int32_t fontID = ewol::LoadFont(fontName, m_fontSize);
|
||||||
|
if (fontID >= 0) {
|
||||||
|
m_fontNormal = fontID;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CodeView::SetFontNameBold(etk::String fontName)
|
||||||
|
{
|
||||||
|
int32_t fontID = ewol::LoadFont(fontName, m_fontSize);
|
||||||
|
if (fontID >= 0) {
|
||||||
|
m_fontBold = fontID;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CodeView::SetFontNameItalic(etk::String fontName)
|
||||||
|
{
|
||||||
|
int32_t fontID = ewol::LoadFont(fontName, m_fontSize);
|
||||||
|
if (fontID >= 0) {
|
||||||
|
m_fontItalic = fontID;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CodeView::SetFontNameBoldItalic(etk::String fontName)
|
||||||
|
{
|
||||||
|
int32_t fontID = ewol::LoadFont(fontName, m_fontSize);
|
||||||
|
if (fontID >= 0) {
|
||||||
|
m_fontBoldItalic = fontID;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -54,50 +54,23 @@ class CodeView :public ewol::Widget
|
|||||||
bool OnEventAreaExternal(int32_t widgetID, const char * generateEventId, const char * eventExternId, etkFloat_t x, etkFloat_t y);
|
bool OnEventAreaExternal(int32_t widgetID, const char * generateEventId, const char * eventExternId, etkFloat_t x, etkFloat_t y);
|
||||||
public:
|
public:
|
||||||
virtual bool OnEventInput(int32_t IdInput, ewol::eventInputType_te typeEvent, etkFloat_t x, etkFloat_t y);
|
virtual bool OnEventInput(int32_t IdInput, ewol::eventInputType_te typeEvent, etkFloat_t x, etkFloat_t y);
|
||||||
virtual bool OnEventArea(const char * generateEventId, etkFloat_t x, etkFloat_t y);
|
|
||||||
virtual bool OnEventKb(ewol::eventKbType_te typeEvent, char UTF8_data[UTF8_MAX_SIZE]);
|
virtual bool OnEventKb(ewol::eventKbType_te typeEvent, char UTF8_data[UTF8_MAX_SIZE]);
|
||||||
virtual bool OnEventKbMove(ewol::eventKbType_te typeEvent, ewol::eventKbMoveType_te moveTypeEvent);
|
virtual bool OnEventKbMove(ewol::eventKbType_te typeEvent, ewol::eventKbMoveType_te moveTypeEvent);
|
||||||
virtual void OnGetFocus(void);
|
virtual void OnGetFocus(void);
|
||||||
virtual void OnLostFocus(void);
|
virtual void OnLostFocus(void);
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#if 0
|
|
||||||
class CodeView : public MsgBroadcast
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
// Constructeur
|
|
||||||
CodeView(void);
|
|
||||||
~CodeView(void);
|
|
||||||
void OnMessage(int32_t id, int32_t dataID);
|
|
||||||
/*
|
|
||||||
GtkWidget *GetMainWidget(void);
|
|
||||||
// sur : GTK+ callback :
|
|
||||||
static gboolean CB_displayDraw( GtkWidget *widget, GdkEventExpose *event, gpointer data);
|
|
||||||
static gboolean CB_displayInit( GtkWidget *widget, gpointer data);
|
|
||||||
static gint CB_focusGet( GtkWidget *widget, GdkEventFocus *event, gpointer data);
|
|
||||||
static gint CB_focusLost( GtkWidget *widget, GdkEventFocus *event, gpointer data);
|
|
||||||
static gint CB_keyboardEvent( GtkWidget *widget, GdkEventKey *event, gpointer data);
|
|
||||||
static gint CB_mouseButtonEvent(GtkWidget *widget, GdkEventButton *event, gpointer data);
|
|
||||||
static gint CB_mouseMotionEvent( GtkWidget *widget, GdkEventMotion *event, gpointer data);
|
|
||||||
static gint CB_mouseScrollEvent( GtkWidget *widget, GdkEventScroll *event, gpointer data);
|
|
||||||
*/
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// main windows widget :
|
int32_t m_fontSize;
|
||||||
//GtkWidget * m_widget;
|
int32_t m_fontNormal;
|
||||||
// récupération des proprieter général...
|
int32_t m_fontBold;
|
||||||
BufferManager * m_bufferManager;
|
int32_t m_fontItalic;
|
||||||
ColorizeManager * m_colorManager;
|
int32_t m_fontBoldItalic;
|
||||||
int32_t m_shawableAreaX;
|
public:
|
||||||
int32_t m_shawableAreaY;
|
void SetFontSize(int32_t size);
|
||||||
int32_t m_bufferID;
|
void SetFontNameNormal(etk::String fontName);
|
||||||
bool m_buttunOneSelected;
|
void SetFontNameBold(etk::String fontName);
|
||||||
|
void SetFontNameItalic(etk::String fontName);
|
||||||
|
void SetFontNameBoldItalic(etk::String fontName);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -49,6 +49,7 @@
|
|||||||
#define __class__ "MainWindows"
|
#define __class__ "MainWindows"
|
||||||
|
|
||||||
|
|
||||||
|
const char * const ednEventNewFile = "edn-New-File";
|
||||||
const char * const ednEventOpenFile = "edn-Open-File";
|
const char * const ednEventOpenFile = "edn-Open-File";
|
||||||
const char * const ednEventCloseFile = "edn-Close-File";
|
const char * const ednEventCloseFile = "edn-Close-File";
|
||||||
const char * const ednEventSaveFile = "edn-Save-File";
|
const char * const ednEventSaveFile = "edn-Save-File";
|
||||||
@ -64,6 +65,7 @@ MainWindows::MainWindows(void)
|
|||||||
ewol::Button * myButton = NULL;
|
ewol::Button * myButton = NULL;
|
||||||
ewol::Label * myLabel = NULL;
|
ewol::Label * myLabel = NULL;
|
||||||
CodeView * myCodeView = NULL;
|
CodeView * myCodeView = NULL;
|
||||||
|
BufferView * myBufferView = NULL;
|
||||||
|
|
||||||
mySizerVert = new ewol::SizerVert();
|
mySizerVert = new ewol::SizerVert();
|
||||||
SetSubWidget(mySizerVert);
|
SetSubWidget(mySizerVert);
|
||||||
@ -71,6 +73,12 @@ MainWindows::MainWindows(void)
|
|||||||
mySizerHori = new ewol::SizerHori();
|
mySizerHori = new ewol::SizerHori();
|
||||||
mySizerVert->SubWidgetAdd(mySizerHori);
|
mySizerVert->SubWidgetAdd(mySizerHori);
|
||||||
|
|
||||||
|
myButton = new ewol::Button("New");
|
||||||
|
mySizerHori->SubWidgetAdd(myButton);
|
||||||
|
if (false == myButton->ExternLinkOnEvent(ewolEventButtonPressed, GetWidgetId(), ednEventNewFile) ) {
|
||||||
|
EDN_CRITICAL("link with an entry event");
|
||||||
|
}
|
||||||
|
|
||||||
myButton = new ewol::Button("Open");
|
myButton = new ewol::Button("Open");
|
||||||
mySizerHori->SubWidgetAdd(myButton);
|
mySizerHori->SubWidgetAdd(myButton);
|
||||||
if (false == myButton->ExternLinkOnEvent(ewolEventButtonPressed, GetWidgetId(), ednEventOpenFile) ) {
|
if (false == myButton->ExternLinkOnEvent(ewolEventButtonPressed, GetWidgetId(), ednEventOpenFile) ) {
|
||||||
@ -103,11 +111,22 @@ MainWindows::MainWindows(void)
|
|||||||
|
|
||||||
mySizerHori = new ewol::SizerHori();
|
mySizerHori = new ewol::SizerHori();
|
||||||
mySizerVert->SubWidgetAdd(mySizerHori);
|
mySizerVert->SubWidgetAdd(mySizerHori);
|
||||||
|
myBufferView = new BufferView();
|
||||||
|
myBufferView->SetExpendX(false);
|
||||||
|
myBufferView->SetExpendY(true);
|
||||||
|
myBufferView->SetFillX(true);
|
||||||
|
myBufferView->SetFillY(true);
|
||||||
|
mySizerHori->SubWidgetAdd(myBufferView);
|
||||||
myCodeView = new CodeView();
|
myCodeView = new CodeView();
|
||||||
myCodeView->SetExpendX(true);
|
myCodeView->SetExpendX(true);
|
||||||
myCodeView->SetExpendY(true);
|
myCodeView->SetExpendY(true);
|
||||||
myCodeView->SetFillX(true);
|
myCodeView->SetFillX(true);
|
||||||
myCodeView->SetFillY(true);
|
myCodeView->SetFillY(true);
|
||||||
|
myCodeView->SetFontSize(11);
|
||||||
|
myCodeView->SetFontNameNormal( "freefont/FreeMono.ttf");
|
||||||
|
myCodeView->SetFontNameBold( "freefont/FreeMonoBold.ttf");
|
||||||
|
myCodeView->SetFontNameItalic( "freefont/FreeMonoOblique.ttf");
|
||||||
|
myCodeView->SetFontNameBoldItalic("freefont/FreeMonoBoldOblique.ttf");
|
||||||
mySizerHori->SubWidgetAdd(myCodeView);
|
mySizerHori->SubWidgetAdd(myCodeView);
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -123,7 +142,12 @@ MainWindows::~MainWindows(void)
|
|||||||
bool MainWindows::OnEventAreaExternal(int32_t widgetID, const char * generateEventId, const char * data, etkFloat_t x, etkFloat_t y)
|
bool MainWindows::OnEventAreaExternal(int32_t widgetID, const char * generateEventId, const char * data, etkFloat_t x, etkFloat_t y)
|
||||||
{
|
{
|
||||||
EDN_INFO("Receive Event from the main windows ... : widgetid=" << widgetID << "\"" << generateEventId << "\" ==> data=\"" << data << "\"" );
|
EDN_INFO("Receive Event from the main windows ... : widgetid=" << widgetID << "\"" << generateEventId << "\" ==> data=\"" << data << "\"" );
|
||||||
if (generateEventId == ednEventOpenFile) {
|
// newFile section ...
|
||||||
|
if (generateEventId == ednEventNewFile) {
|
||||||
|
ewol::widgetMessageMultiCast::Send(GetWidgetId(), ednMsgGuiNew);
|
||||||
|
}
|
||||||
|
// Open file Section ...
|
||||||
|
else if (generateEventId == ednEventOpenFile) {
|
||||||
ewol::FileChooser* tmpWidget = new ewol::FileChooser();
|
ewol::FileChooser* tmpWidget = new ewol::FileChooser();
|
||||||
tmpWidget->SetTitle("Open Files ...");
|
tmpWidget->SetTitle("Open Files ...");
|
||||||
tmpWidget->SetValidateLabel("Open");
|
tmpWidget->SetValidateLabel("Open");
|
||||||
|
@ -129,7 +129,7 @@ void APP_Init(void)
|
|||||||
if (false == myBufferManager->Exist(myfile) ) {
|
if (false == myBufferManager->Exist(myfile) ) {
|
||||||
int32_t idBuffOpened = myBufferManager->Open(myfile);
|
int32_t idBuffOpened = myBufferManager->Open(myfile);
|
||||||
if (1==iii) {
|
if (1==iii) {
|
||||||
ewol::widgetMessageMultiCast::Send(-1, ednMsgCodeViewCurrentChangeBufferId, idBuffOpened);
|
ewol::widgetMessageMultiCast::Send(-1, ednMsgCodeViewCurrentChangeBufferId, idBuffOpened-1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -28,6 +28,53 @@
|
|||||||
#include <MsgBroadcast.h>
|
#include <MsgBroadcast.h>
|
||||||
|
|
||||||
|
|
||||||
|
// new list of edn event generic :
|
||||||
|
////////////////////////////////////////////////////////////////////////
|
||||||
|
// Event of the gui request something :
|
||||||
|
////////////////////////////////////////////////////////////////////////
|
||||||
|
extern const char* const ednMsgGuiNew = "edn-Msg-Gui-New";
|
||||||
|
extern const char* const ednMsgGuiOpen = "edn-Msg-Gui-Open";
|
||||||
|
extern const char* const ednMsgGuiClose = "edn-Msg-Gui-Close";
|
||||||
|
extern const char* const ednMsgGuiSave = "edn-Msg-Gui-Save";
|
||||||
|
extern const char* const ednMsgGuiSaveAs = "edn-Msg-Gui-SaveAs";
|
||||||
|
|
||||||
|
extern const char* const ednMsgGuiUndo = "edn-Msg-Gui-Undo";
|
||||||
|
extern const char* const ednMsgGuiRedo = "edn-Msg-Gui-Redo";
|
||||||
|
extern const char* const ednMsgGuiCopy = "edn-Msg-Gui-Copy";
|
||||||
|
extern const char* const ednMsgGuiCut = "edn-Msg-Gui-Cut";
|
||||||
|
extern const char* const ednMsgGuiPaste = "edn-Msg-Gui-Paste";
|
||||||
|
extern const char* const ednMsgGuiRm = "edn-Msg-Gui-Rm";
|
||||||
|
extern const char* const ednMsgGuiSelect = "edn-Msg-Gui-Select";
|
||||||
|
extern const char* const ednMsgGuiGotoLine = "edn-Msg-Gui-GotoLine";
|
||||||
|
|
||||||
|
extern const char* const ednMsgGuiSearch = "edn-Msg-Gui-Search";
|
||||||
|
extern const char* const ednMsgGuiReplace = "edn-Msg-Gui-Replace";
|
||||||
|
extern const char* const ednMsgGuiFind = "edn-Msg-Gui-Find";
|
||||||
|
|
||||||
|
extern const char* const ednMsgGuiChangeColor = "edn-Msg-Gui-ChangeColor";
|
||||||
|
extern const char* const ednMsgGuiChangeCharset = "edn-Msg-Gui-ChangeCharset";
|
||||||
|
extern const char* const ednMsgGuiShowSpaces = "edn-Msg-Gui-ShowSpaces";
|
||||||
|
extern const char* const ednMsgGuiShowEndOfLine = "edn-Msg-Gui-ShowEndOfLine";
|
||||||
|
|
||||||
|
extern const char* const ednMsgGuiCtags = "edn-Msg-Gui-CTags";
|
||||||
|
|
||||||
|
extern const char* const ednMsgGuiAbout = "edn-Msg-Gui-About";
|
||||||
|
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////
|
||||||
|
// Event internal :
|
||||||
|
////////////////////////////////////////////////////////////////////////
|
||||||
|
extern const char* const ednMsgBufferState = "edn-Msg-Buffer-State";
|
||||||
|
extern const char* const ednMsgBufferName = "edn-Msg-Buffer-Name";
|
||||||
|
extern const char* const ednMsgBufferId = "edn-Msg-Buffer-Id";
|
||||||
|
extern const char* const ednMsgOpenFile = "edn-Msg-OpenFile";
|
||||||
|
|
||||||
|
extern const char* const ednMsgBufferListChange = "edn-Msg-BufferListChange";
|
||||||
|
|
||||||
|
extern const char* const ednMsgBufferColor = "edn-Msg-Buffer-Color";
|
||||||
|
|
||||||
|
|
||||||
|
// old ...
|
||||||
|
|
||||||
extern const char* const ednMsgBufferChangeCurrent = "edn-Msg-Buffer-Change-Current";
|
extern const char* const ednMsgBufferChangeCurrent = "edn-Msg-Buffer-Change-Current";
|
||||||
extern const char* const ednMsgUserDisplayChange = "edn-Msg-User-Display-Change";
|
extern const char* const ednMsgUserDisplayChange = "edn-Msg-User-Display-Change";
|
||||||
|
@ -30,6 +30,56 @@
|
|||||||
#include <etk/String.h>
|
#include <etk/String.h>
|
||||||
|
|
||||||
|
|
||||||
|
// new list of edn event generic :
|
||||||
|
////////////////////////////////////////////////////////////////////////
|
||||||
|
// Event of the gui request something :
|
||||||
|
////////////////////////////////////////////////////////////////////////
|
||||||
|
extern const char* const ednMsgGuiNew; // data : ""
|
||||||
|
extern const char* const ednMsgGuiOpen; // data : ""
|
||||||
|
extern const char* const ednMsgGuiClose; // data : "current" "All"
|
||||||
|
extern const char* const ednMsgGuiSave; // data : ""
|
||||||
|
extern const char* const ednMsgGuiSaveAs; // data : ""
|
||||||
|
|
||||||
|
extern const char* const ednMsgGuiUndo; // data : ""
|
||||||
|
extern const char* const ednMsgGuiRedo; // data : ""
|
||||||
|
extern const char* const ednMsgGuiCopy; // data : "STD" "Middle" "1" ... "9"
|
||||||
|
extern const char* const ednMsgGuiCut; // data : "STD" "Middle" "1" ... "9"
|
||||||
|
extern const char* const ednMsgGuiPaste; // data : "STD" "Middle" "1" ... "9"
|
||||||
|
extern const char* const ednMsgGuiRm; // data : "Word" "Line" "Paragraph"
|
||||||
|
extern const char* const ednMsgGuiSelect; // data : "ALL" "NONE"
|
||||||
|
extern const char* const ednMsgGuiGotoLine; // data : "???" / "1" ... "999999999999"
|
||||||
|
|
||||||
|
extern const char* const ednMsgGuiSearch; // data : ""
|
||||||
|
extern const char* const ednMsgGuiReplace; // data : ""
|
||||||
|
extern const char* const ednMsgGuiFind; // data : "Next" "Previous"
|
||||||
|
|
||||||
|
extern const char* const ednMsgGuiChangeColor; // data : "Black" "White"
|
||||||
|
extern const char* const ednMsgGuiChangeCharset; // data : "UTF-8" "ISO-8859-1" "ISO-8859-15"
|
||||||
|
extern const char* const ednMsgGuiShowSpaces; // data : "enable" "disable"
|
||||||
|
extern const char* const ednMsgGuiShowEndOfLine; // data : "enable" "disable"
|
||||||
|
|
||||||
|
extern const char* const ednMsgGuiCtagsLoad; // data : "Load" "ReLoad" "Jump" "Back"
|
||||||
|
|
||||||
|
extern const char* const ednMsgGuiAbout; // data : ""
|
||||||
|
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////
|
||||||
|
// Event internal :
|
||||||
|
////////////////////////////////////////////////////////////////////////
|
||||||
|
extern const char* const ednMsgBufferState; // data : "Saved" "Modify" "HasHistory" "HasNotHistory" "HasFutureHistory" "HasNotFutureHistory"
|
||||||
|
extern const char* const ednMsgBufferName; // data : "filename"
|
||||||
|
extern const char* const ednMsgBufferId; // data : "0" ... "99999999999"
|
||||||
|
extern const char* const ednMsgOpenFile; // data : "/Compleate/file/name.xx"
|
||||||
|
|
||||||
|
extern const char* const ednMsgBufferListChange; // data : ""
|
||||||
|
|
||||||
|
extern const char* const ednMsgBufferColor; // data : "new"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// old list :
|
||||||
|
|
||||||
extern const char* const ednMsgBufferChangeCurrent; // set the new current BUFFER ...
|
extern const char* const ednMsgBufferChangeCurrent; // set the new current BUFFER ...
|
||||||
extern const char* const ednMsgUserDisplayChange; // User change the display ==> need to reload all the display depending on color internal
|
extern const char* const ednMsgUserDisplayChange; // User change the display ==> need to reload all the display depending on color internal
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user