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 ---
*
*/
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;
}

View File

@ -82,7 +82,7 @@ class Buffer {
virtual void GetInfo(infoStatBuffer_ts &infoToUpdate);
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 AddChar(char * UTF8data);
virtual void cursorMove(int32_t gtkKey);

View File

@ -67,8 +67,14 @@ BufferEmpty::~BufferEmpty(void)
* @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) {
EDN_ERROR("Input VALUE is NULL");
return ERR_FAIL;
@ -77,7 +83,13 @@ int32_t BufferEmpty::Display(ewol::OObject2DText* OOText, ewol::OObject2DColored
EDN_ERROR("Input VALUE is NULL");
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);
myColor = myColorManager->Get("commentDoxygen");
OOText->SetColor(myColor->GetFG());
OOText->TextAdd(20, 50, "No Buffer Availlable to display", sizeX);

View File

@ -32,7 +32,7 @@ class BufferEmpty : public Buffer {
public:
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

@ -46,28 +46,28 @@ class BufferManager: public etk::Singleton<BufferManager>, public MsgBroadcast
// return the ID of the buffer allocated
// create a buffer with no element
int32_t Create(void);
int32_t Create(void);
// open curent filename
int32_t Open(etk::File &myFile);
int32_t Open(etk::File &myFile);
int32_t GetSelected(void) { return m_idSelected;};
void SetSelected(int32_t id) {m_idSelected = id;};
Buffer * Get(int32_t BufferID);
bool Exist(int32_t BufferID);
bool Exist(etk::File &myFile);
int32_t GetId(etk::File &myFile);
bool Exist(int32_t BufferID);
bool Exist(etk::File &myFile);
int32_t GetId(etk::File &myFile);
// return the number of buffer (open in the past) if 5 buffer open and 4 close ==> return 5
uint32_t Size(void);
int32_t WitchBuffer(int32_t iEmeElement);
uint32_t Size(void);
int32_t WitchBuffer(int32_t iEmeElement);
bool Remove(int32_t BufferID);
bool Remove(int32_t BufferID);
private:
etk::VectorType<Buffer*> listBuffer; //!< element List of the char Elements
etk::VectorType<Buffer*> listBuffer; //!< element List of the char Elements
void RemoveAll(void); //!< remove all buffer
int32_t m_idSelected;
Buffer * BufferNotExiste; //!< When an error arrive in get buffer we return the Error buffer (not writable)
void RemoveAll(void); //!< remove all buffer
int32_t m_idSelected;
Buffer * BufferNotExiste; //!< When an error arrive in get buffer we return the Error buffer (not writable)
};
#endif

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];
sprintf(tmpLineNumber, myPrint, lineNumber);
//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);
}
@ -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)
{
EWOL_ERROR("RequestCursorDisplay(" << x << "," << y << ")" );
/*
//EDN_ERROR("RequestCursorDisplay(" << x << "," << y << ")" );
color_ts & tmpppppp = ColorizeManager::getInstance()->Get(COLOR_CODE_CURSOR);
OOColored->SetColor(tmpppppp);
OOColored->Rectangle( x, y, letterWidth, letterHeight);
*/
// get the cursor Color :
//color_ts myColor = ColorizeManager::getInstance()->Get(COLOR_CODE_CURSOR);
@ -326,7 +325,7 @@ void BufferText::UpdatePointerNumber(void)
* @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;
bool selIsRect;
@ -468,9 +467,11 @@ int32_t BufferText::Display(ewol::OObject2DText* OOText, ewol::OObject2DColored*
}
if (currentChar <= 0x7F) {
//drawer.Text(selectColor, pixelX ,y, tmpDisplayOfset);
OOText->SetColor(selectColor->GetFG());
OOText->TextAdd(pixelX, y, tmpDisplayOfset, -1);
} else {
//drawer.Text(selectColor, pixelX ,y, displayChar);
OOText->SetColor(selectColor->GetFG());
OOText->TextAdd(pixelX, y, displayChar, -1);
}
}
@ -481,12 +482,8 @@ int32_t BufferText::Display(ewol::OObject2DText* OOText, ewol::OObject2DColored*
// display cursor :
//EDN_DEBUG(" is equal : " << m_cursorPos << "=" << iii);
if (m_cursorPos == iii) {
EDN_DEBUG("Yes ...");
// display the cursor:
CursorDisplay(OOColored, pixelX, y+letterHeight, letterHeight, letterWidth);
color_ts & tmpppppp = ColorizeManager::getInstance()->Get(COLOR_CODE_CURSOR);
OOColored->SetColor(tmpppppp);
OOColored->Rectangle( pixelX, y+letterHeight, letterWidth, letterHeight);
CursorDisplay(OOColored, pixelX, y, letterHeight, letterWidth);
/*if (true == m_cursorOn) {
//Cursor(OOColored, pixelX, y+letterHeight, letterHeight, letterWidth);
//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)
{
x = (width - 3) / Display::GetFontWidth() - nbColoneForLineNumber;
y = height / Display::GetFontHeight();
if (x < 0) {

View File

@ -46,7 +46,7 @@ class BufferText : public Buffer {
void GetInfo(infoStatBuffer_ts &infoToUpdate);
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 AddChar(char * UTF8data);
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 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);

View File

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

View File

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

View File

@ -81,8 +81,8 @@ bool CodeView::CalculateMinSize(void)
void CodeView::OnRegenerateDisplay(void)
{
// create tmp object :
ewol::OObject2DText* myOObjectText = new ewol::OObject2DText("", -1, m_textColorFg);
ewol::OObject2DColored* myOObjectsColored = new ewol::OObject2DColored();
ewol::OObject2DTextColored* myOObjectText = new ewol::OObject2DTextColored("", -1);
ewol::OObject2DColored* myOObjectsColored = new ewol::OObject2DColored();
// generate the objects :
m_bufferID = 0;
@ -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)
{
x -= m_origin.x;
y -= m_origin.y;
/*
etk::String type = (int)typeEvent;
switch (typeEvent)
@ -232,7 +234,7 @@ void CodeView::OnMessage(int32_t id, int32_t dataID)
//EDN_INFO("Select a new Buffer ... " << dataID);
m_bufferID = dataID;
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);
break;
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" << "\"" );
etk::File myfile("avancement.boo", etk::FILE_TYPE_DIRECT);
if (false == myBufferManager->Exist(myfile) ) {
int32_t idBuffOpened = myBufferManager->Open(myfile);
MsgBroadcastCore::getInstance()->SendMessage(NULL, EDN_MSG__CURRENT_CHANGE_BUFFER_ID, idBuffOpened);
}
}
basicWindows = new MainWindows();
if (NULL == basicWindows) {
EDN_ERROR("Can not allocate the basic windows");

View File

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