Some correction of the Display color is now availlable

This commit is contained in:
Edouard Dupin 2012-01-16 14:37:09 +01:00
parent 10ceb14268
commit c61876b919
13 changed files with 84 additions and 45 deletions

3
ctags.sh Executable file
View File

@ -0,0 +1,3 @@
#!/bin/bash
ctags -R --fields=+n jni/ ../../../../usr/include/freetype2 ../ewol/

View File

@ -146,7 +146,7 @@ void Buffer::SetLineDisplay(uint32_t lineNumber)
* @return --- * @return ---
* *
*/ */
int32_t Buffer::Display(ewol::OObject2DText* OOText, ewol::OObject2DColored* OOColored, int32_t sizeX, int32_t sizeY) int32_t Buffer::Display(ewol::OObject2DTextColored* OOText, ewol::OObject2DColored* OOColored, int32_t sizeX, int32_t sizeY)
{ {
return ERR_NONE; return ERR_NONE;
} }

View File

@ -82,7 +82,7 @@ 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::OObject2DText* OOText, ewol::OObject2DColored* OOColored, int32_t sizeX, int32_t sizeY); virtual int32_t Display(ewol::OObject2DTextColored* OOText, 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(int32_t gtkKey); virtual void cursorMove(int32_t gtkKey);

View File

@ -67,8 +67,14 @@ BufferEmpty::~BufferEmpty(void)
* @return --- * @return ---
* *
*/ */
int32_t BufferEmpty::Display(ewol::OObject2DText* OOText, ewol::OObject2DColored* OOColored, int32_t sizeX, int32_t sizeY) int32_t BufferEmpty::Display(ewol::OObject2DTextColored* OOText, ewol::OObject2DColored* OOColored, int32_t sizeX, int32_t sizeY)
{ {
ColorizeManager * myColorManager = ColorizeManager::getInstance();
// Get color :
Colorize *myColor = NULL;
//drawer.Flush();
if (NULL == OOText) { if (NULL == OOText) {
EDN_ERROR("Input VALUE is NULL"); EDN_ERROR("Input VALUE is NULL");
return ERR_FAIL; return ERR_FAIL;
@ -77,7 +83,13 @@ int32_t BufferEmpty::Display(ewol::OObject2DText* OOText, ewol::OObject2DColored
EDN_ERROR("Input VALUE is NULL"); EDN_ERROR("Input VALUE is NULL");
return ERR_FAIL; return ERR_FAIL;
} }
myColor = myColorManager->Get("normal");
OOText->SetColor(myColor->GetFG());
OOText->TextAdd(20, 20, "edn - Editeur De N'ours, l'Editeur Desoxyribo-Nucleique", sizeX); OOText->TextAdd(20, 20, "edn - Editeur De N'ours, l'Editeur Desoxyribo-Nucleique", sizeX);
myColor = myColorManager->Get("commentDoxygen");
OOText->SetColor(myColor->GetFG());
OOText->TextAdd(20, 50, "No Buffer Availlable to display", sizeX); OOText->TextAdd(20, 50, "No Buffer Availlable to display", sizeX);

View File

@ -32,7 +32,7 @@ class BufferEmpty : public Buffer {
public: public:
BufferEmpty(void); BufferEmpty(void);
virtual ~BufferEmpty(void); virtual ~BufferEmpty(void);
int32_t Display(ewol::OObject2DText* OOText, ewol::OObject2DColored* OOColored, int32_t sizeX, int32_t sizeY); int32_t Display(ewol::OObject2DTextColored* OOText, ewol::OObject2DColored* OOColored, int32_t sizeX, int32_t sizeY);
}; };

View File

@ -238,11 +238,12 @@ void BufferText::SetLineDisplay(uint32_t lineNumber)
} }
void BufferText::DrawLineNumber(ewol::OObject2DText* 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);
//drawer.Text(myColorManager->Get(COLOR_CODE_LINE_NUMBER), 1, positionY, tmpLineNumber); //drawer.Text(myColorManager->Get(COLOR_CODE_LINE_NUMBER), 1, positionY, tmpLineNumber);
OOText->SetColor(myColorManager->Get(COLOR_CODE_LINE_NUMBER));
OOText->TextAdd(1, positionY, tmpLineNumber, -1); OOText->TextAdd(1, positionY, tmpLineNumber, -1);
} }
@ -250,14 +251,12 @@ void BufferText::DrawLineNumber(ewol::OObject2DText* OOText, ewol::OObject2DColo
void BufferText::CursorDisplay(ewol::OObject2DColored* OOColored, int32_t x, int32_t y, int32_t letterHeight, int32_t letterWidth) void BufferText::CursorDisplay(ewol::OObject2DColored* OOColored, int32_t x, int32_t y, int32_t letterHeight, int32_t letterWidth)
{ {
EWOL_ERROR("RequestCursorDisplay(" << x << "," << y << ")" ); //EDN_ERROR("RequestCursorDisplay(" << x << "," << y << ")" );
/*
color_ts & tmpppppp = ColorizeManager::getInstance()->Get(COLOR_CODE_CURSOR); color_ts & tmpppppp = ColorizeManager::getInstance()->Get(COLOR_CODE_CURSOR);
OOColored->SetColor(tmpppppp); OOColored->SetColor(tmpppppp);
OOColored->Rectangle( x, y, letterWidth, letterHeight); OOColored->Rectangle( x, y, letterWidth, letterHeight);
*/
// get the cursor Color : // get the cursor Color :
//color_ts myColor = ColorizeManager::getInstance()->Get(COLOR_CODE_CURSOR); //color_ts myColor = ColorizeManager::getInstance()->Get(COLOR_CODE_CURSOR);
@ -326,7 +325,7 @@ void BufferText::UpdatePointerNumber(void)
* @return * @return
* *
*/ */
int32_t BufferText::Display(ewol::OObject2DText* OOText, ewol::OObject2DColored* OOColored, int32_t sizeX, int32_t sizeY) int32_t BufferText::Display(ewol::OObject2DTextColored* OOText, 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;
@ -468,9 +467,11 @@ int32_t BufferText::Display(ewol::OObject2DText* OOText, ewol::OObject2DColored*
} }
if (currentChar <= 0x7F) { if (currentChar <= 0x7F) {
//drawer.Text(selectColor, pixelX ,y, tmpDisplayOfset); //drawer.Text(selectColor, pixelX ,y, tmpDisplayOfset);
OOText->SetColor(selectColor->GetFG());
OOText->TextAdd(pixelX, y, tmpDisplayOfset, -1); OOText->TextAdd(pixelX, y, tmpDisplayOfset, -1);
} else { } else {
//drawer.Text(selectColor, pixelX ,y, displayChar); //drawer.Text(selectColor, pixelX ,y, displayChar);
OOText->SetColor(selectColor->GetFG());
OOText->TextAdd(pixelX, y, displayChar, -1); OOText->TextAdd(pixelX, y, displayChar, -1);
} }
} }
@ -481,12 +482,8 @@ int32_t BufferText::Display(ewol::OObject2DText* OOText, ewol::OObject2DColored*
// display cursor : // display cursor :
//EDN_DEBUG(" is equal : " << m_cursorPos << "=" << iii); //EDN_DEBUG(" is equal : " << m_cursorPos << "=" << iii);
if (m_cursorPos == iii) { if (m_cursorPos == iii) {
EDN_DEBUG("Yes ...");
// display the cursor: // display the cursor:
CursorDisplay(OOColored, pixelX, y+letterHeight, letterHeight, letterWidth); CursorDisplay(OOColored, pixelX, y, letterHeight, letterWidth);
color_ts & tmpppppp = ColorizeManager::getInstance()->Get(COLOR_CODE_CURSOR);
OOColored->SetColor(tmpppppp);
OOColored->Rectangle( pixelX, y+letterHeight, letterWidth, letterHeight);
/*if (true == m_cursorOn) { /*if (true == m_cursorOn) {
//Cursor(OOColored, pixelX, y+letterHeight, letterHeight, letterWidth); //Cursor(OOColored, pixelX, y+letterHeight, letterHeight, letterWidth);
//m_cursorOn = false; //m_cursorOn = false;
@ -529,6 +526,7 @@ int32_t BufferText::Display(ewol::OObject2DText* OOText, ewol::OObject2DColored*
void BufferText::GetMousePosition(int32_t width, int32_t height, int32_t &x, int32_t &y) void BufferText::GetMousePosition(int32_t width, int32_t height, int32_t &x, int32_t &y)
{ {
x = (width - 3) / Display::GetFontWidth() - nbColoneForLineNumber; x = (width - 3) / Display::GetFontWidth() - nbColoneForLineNumber;
y = height / Display::GetFontHeight(); y = height / Display::GetFontHeight();
if (x < 0) { if (x < 0) {

View File

@ -46,7 +46,7 @@ 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::OObject2DText* OOText, ewol::OObject2DColored* OOColored, int32_t sizeX, int32_t sizeY); int32_t Display(ewol::OObject2DTextColored* OOText, 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(int32_t gtkKey); void cursorMove(int32_t gtkKey);
@ -114,7 +114,7 @@ class BufferText : public Buffer {
void GetMousePosition(int32_t width, int32_t height, int32_t &x, int32_t &y); void GetMousePosition(int32_t width, int32_t height, int32_t &x, int32_t &y);
void MoveUpDown(int32_t ofset); void MoveUpDown(int32_t ofset);
void DrawLineNumber(ewol::OObject2DText* OOText, ewol::OObject2DColored* OOColored, int32_t sizeX, int32_t sizeY,char *myPrint, int32_t lineNumber, int32_t positionY); void DrawLineNumber(ewol::OObject2DTextColored* OOText, ewol::OObject2DColored* OOColored, int32_t sizeX, int32_t sizeY,char *myPrint, int32_t lineNumber, int32_t positionY);
void CursorDisplay(ewol::OObject2DColored* OOColored, int32_t x, int32_t y, int32_t letterHeight, int32_t letterWidth); void CursorDisplay(ewol::OObject2DColored* OOColored, int32_t x, int32_t y, int32_t letterHeight, int32_t letterWidth);

View File

@ -38,9 +38,11 @@ Colorize::Colorize( etk::String &newColorName)
m_colorFG.red=0; m_colorFG.red=0;
m_colorFG.green=0; m_colorFG.green=0;
m_colorFG.blue=0; m_colorFG.blue=0;
m_colorFG.alpha=1;
m_colorBG.red=0; m_colorBG.red=0;
m_colorBG.green=0; m_colorBG.green=0;
m_colorBG.blue=0; m_colorBG.blue=0;
m_colorBG.alpha=1;
italic = false; italic = false;
bold = false; bold = false;
@ -57,9 +59,11 @@ Colorize::Colorize(void)
m_colorFG.red=0; m_colorFG.red=0;
m_colorFG.green=0; m_colorFG.green=0;
m_colorFG.blue=0; m_colorFG.blue=0;
m_colorFG.alpha=1;
m_colorBG.red=0; m_colorBG.red=0;
m_colorBG.green=0; m_colorBG.green=0;
m_colorBG.blue=0; m_colorBG.blue=0;
m_colorBG.alpha=1;
italic = false; italic = false;
bold = false; bold = false;
@ -97,24 +101,38 @@ etk::String Colorize::GetName(void)
void Colorize::SetFgColor(const char *myColor) void Colorize::SetFgColor(const char *myColor)
{ {
haveFG = true; haveFG = true;
unsigned int r=0; signed int r=0;
unsigned int v=0; signed int v=0;
unsigned int b=0; signed int b=0;
sscanf(myColor, "#%02x%02x%02x", &r,&v,&b); signed int a=-1;
sscanf(myColor, "#%02x%02x%02x%02x", &r, &v, &b, &a);
m_colorFG.red = (float)r/255.0; m_colorFG.red = (float)r/255.0;
m_colorFG.green = (float)v/255.0; m_colorFG.green = (float)v/255.0;
m_colorFG.blue = (float)b/255.0; m_colorFG.blue = (float)b/255.0;
if (-1 == a) {
m_colorFG.alpha = 1;
} else {
m_colorFG.alpha = (float)a/255.0;
}
//EDN_INFO(myColor << " ==> r="<< r <<" v="<< v <<" b="<< b ); //EDN_INFO(myColor << " ==> r="<< r <<" v="<< v <<" b="<< b );
} }
void Colorize::SetBgColor(const char *myColor) void Colorize::SetBgColor(const char *myColor)
{ {
haveBG = true; haveBG = true;
unsigned int r,v,b; signed int r=0;
sscanf(myColor, "#%02x%02x%02x", &r,&v,&b); signed int v=0;
signed int b=0;
signed int a=-1;
sscanf(myColor, "#%02x%02x%02x%02x", &r, &v, &b, &a);
m_colorBG.red = (float)r/255.0; m_colorBG.red = (float)r/255.0;
m_colorBG.green = (float)v/255.0; m_colorBG.green = (float)v/255.0;
m_colorBG.blue = (float)b/255.0; m_colorBG.blue = (float)b/255.0;
if (-1 == a) {
m_colorBG.alpha = 1;
} else {
m_colorBG.alpha = (float)a/255.0;
}
} }
bool Colorize::HaveBg(void) bool Colorize::HaveBg(void)

View File

@ -150,13 +150,19 @@ void ColorizeManager::LoadFile(const char * xmlFilename)
} }
const char *color = pGuiNode->ToElement()->Attribute("val"); const char *color = pGuiNode->ToElement()->Attribute("val");
if (NULL != color) { if (NULL != color) {
unsigned int r=0; int r=0;
unsigned int v=0; int v=0;
unsigned int b=0; int b=0;
sscanf(color, "#%02x%02x%02x", &r,&v,&b); int a=-1;
sscanf(color, "#%02x%02x%02x%02x", &r, &v, &b, &a);
basicColors[id].red = (float)r/255.0; basicColors[id].red = (float)r/255.0;
basicColors[id].green = (float)v/255.0; basicColors[id].green = (float)v/255.0;
basicColors[id].blue = (float)b/255.0; basicColors[id].blue = (float)b/255.0;
if (-1 == a) {
basicColors[id].alpha = 1;
} else {
basicColors[id].alpha = (float)a/255.0;
}
/* /*
EDN_INFO(" Specify color for system ID="<< id ); EDN_INFO(" Specify color for system ID="<< id );
EDN_INFO(" " << color << " ==> r="<< r <<" v="<< v <<" b="<< b ); EDN_INFO(" " << color << " ==> r="<< r <<" v="<< v <<" b="<< b );

View File

@ -81,7 +81,7 @@ bool CodeView::CalculateMinSize(void)
void CodeView::OnRegenerateDisplay(void) void CodeView::OnRegenerateDisplay(void)
{ {
// create tmp object : // create tmp object :
ewol::OObject2DText* myOObjectText = new ewol::OObject2DText("", -1, m_textColorFg); ewol::OObject2DTextColored* myOObjectText = new ewol::OObject2DTextColored("", -1);
ewol::OObject2DColored* myOObjectsColored = new ewol::OObject2DColored(); ewol::OObject2DColored* myOObjectsColored = new ewol::OObject2DColored();
// generate the objects : // generate the objects :
@ -128,6 +128,8 @@ bool CodeView::OnEventKb(ewol::eventKbType_te typeEvent, char UTF8_data[UTF8_MAX
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)
{ {
x -= m_origin.x;
y -= m_origin.y;
/* /*
etk::String type = (int)typeEvent; etk::String type = (int)typeEvent;
switch (typeEvent) switch (typeEvent)
@ -232,7 +234,7 @@ void CodeView::OnMessage(int32_t id, int32_t dataID)
//EDN_INFO("Select a new Buffer ... " << dataID); //EDN_INFO("Select a new Buffer ... " << dataID);
m_bufferID = dataID; m_bufferID = dataID;
m_bufferManager->Get(m_bufferID)->ForceReDraw(true); m_bufferManager->Get(m_bufferID)->ForceReDraw(true);
// request the dispplay of the curent Editor // request the display of the curent Editor
SendMessage(EDN_MSG__BUFFER_CHANGE_CURRENT, m_bufferID); SendMessage(EDN_MSG__BUFFER_CHANGE_CURRENT, m_bufferID);
break; break;
case EDN_MSG__CURRENT_SAVE: case EDN_MSG__CURRENT_SAVE:

View File

@ -137,13 +137,11 @@ void APP_Init(int argc, char *argv[])
{ {
EDN_INFO("need load file : \"" << "avancement.boo" << "\"" ); EDN_INFO("need load file : \"" << "avancement.boo" << "\"" );
etk::File myfile("avancement.boo", etk::FILE_TYPE_DIRECT); etk::File myfile("avancement.boo", etk::FILE_TYPE_DIRECT);
if (false == myBufferManager->Exist(myfile) ) { if (false == myBufferManager->Exist(myfile) ) {
int32_t idBuffOpened = myBufferManager->Open(myfile); int32_t idBuffOpened = myBufferManager->Open(myfile);
MsgBroadcastCore::getInstance()->SendMessage(NULL, EDN_MSG__CURRENT_CHANGE_BUFFER_ID, idBuffOpened); MsgBroadcastCore::getInstance()->SendMessage(NULL, EDN_MSG__CURRENT_CHANGE_BUFFER_ID, idBuffOpened);
} }
} }
basicWindows = new MainWindows(); basicWindows = new MainWindows();
if (NULL == basicWindows) { if (NULL == basicWindows) {
EDN_ERROR("Can not allocate the basic windows"); EDN_ERROR("Can not allocate the basic windows");

View File

@ -105,12 +105,14 @@ void Display::UnInit(void)
int32_t Display::GetFontHeight(void) int32_t Display::GetFontHeight(void)
{ {
return m_pangoFontHeight; int32_t fontId = ewol::GetDefaultFontId();
return ewol::GetHeight(fontId);
} }
int32_t Display::GetFontWidth(void) int32_t Display::GetFontWidth(void)
{ {
return m_pangoFontWidth; int32_t fontId = ewol::GetDefaultFontId();
return ewol::GetWidth(fontId, "A");
} }