[DEV] BROKEN-gitcc start dev of a naw mode of display for the Internal system

This commit is contained in:
Edouard DUPIN 2013-05-14 23:20:17 +02:00
parent 52ac167872
commit 0633355169
6 changed files with 194 additions and 382 deletions

View File

@ -21,7 +21,7 @@
<!-- hightline description : -->
<color name="type" FG="#376d0a" bold="yes"/>
<color name="memberClass" FG="#005A00" bold="yes"/>
<color name="memberClass" FG="#7c5406" bold="yes"/>
<color name="inputFunction" FG="#B80000" bold="yes" italic="yes"/>
<color name="storageKeyword" FG="#466cb4"/>
<color name="number" FG="#007b00"/>

View File

@ -15,108 +15,70 @@
#define __class__ "Colorize"
Colorize::Colorize( etk::UString &newColorName)
{
appl::Colorize::Colorize(const etk::UString &_colorName) :
m_name(_colorName),
m_colorFG = draw::color::black;
m_colorBG = draw::color::none;
italic = false;
bold = false;
SetName(newColorName);
m_italic = false;
m_bold = false;
{
APPL_VERBOSE("New(Colorise)");
}
Colorize::Colorize(void)
void appl::Colorize::SetName(const etk::UString &_newColorName)
{
ColorName = "no_name";
m_colorFG = draw::color::black;
m_colorBG = draw::color::none;
italic = false;
bold = false;
APPL_VERBOSE("New(Colorise)");
APPL_VERBOSE("color change name : \"" << m_name << "\" ==> \"" << _newColorName << "\"");
m_name = _newColorName;
}
Colorize::~Colorize(void)
void appl::Colorize::SetFgColor(const etk::UString& _myColor)
{
// nothing to do ...
m_colorFG = _myColor;
APPL_VERBOSE(_myColor << " ==> "<< m_colorFG );
}
void appl::Colorize::SetBgColor(const etk::UString& _myColor)
{
m_colorBG = _myColor;
APPL_VERBOSE(_myColor << " ==> "<< m_colorBG );
}
void Colorize::SetName(const char *newColorName)
void appl::Colorize::SetItalic(bool _enable)
{
APPL_VERBOSE("color change name : \"" << ColorName << "\" ==> \"" << newColorName << "\"");
ColorName = newColorName;
}
void Colorize::SetName(etk::UString &newColorName)
{
APPL_VERBOSE("color change name : \"" << ColorName << "\" ==> \"" << newColorName << "\"");
ColorName = newColorName;
}
etk::UString Colorize::GetName(void)
{
return ColorName;
}
void Colorize::SetFgColor(const char *myColor)
{
m_colorFG = myColor;
APPL_VERBOSE(myColor << " ==> "<< m_colorFG );
}
void Colorize::SetBgColor(const char *myColor)
{
m_colorBG = myColor;
APPL_VERBOSE(myColor << " ==> "<< m_colorBG );
}
bool Colorize::HaveBg(void)
{
return m_colorBG.a!=0;
}
void Colorize::SetItalic(bool enable)
{
italic = enable;
if (true == enable) {
m_italic = _enable;
if (true == m_italic) {
APPL_VERBOSE("color : \"" << ColorName << "\" enable italic");
} else {
APPL_VERBOSE("color : \"" << ColorName << "\" disable italic");
}
}
bool Colorize::GetItalic(void)
void appl::Colorize::SetBold(bool _enable)
{
return italic;
}
void Colorize::SetBold(bool enable)
{
bold = enable;
if (true == enable) {
APPL_VERBOSE("color : \"" << ColorName << "\" enable bold");
m_bold = _enable;
if (true == m_bold) {
APPL_VERBOSE("color : \"" << m_name << "\" enable bold");
} else {
APPL_VERBOSE("color : \"" << ColorName << "\" disable bold");
APPL_VERBOSE("color : \"" << m_name << "\" disable bold");
}
}
bool Colorize::GetBold(void)
etk::CCout& appl::operator <<(etk::CCout& _os, const appl::Colorize& _obj)
{
return bold;
_os << "{name=\"" << _obj.GetName() << "\"";
_os << " fg=" << _obj.GetFG();
if (_obj.HaveBg()==true) {
_os << " bg=" << _obj.GetBG();
}
if (_obj.GetBold()==true) {
_os << " bold";
}
if (_obj.GetItalic()==true) {
_os << " italic";
}
_os << "}";
return _os;
}

View File

@ -11,39 +11,46 @@
#include <draw/Color.h>
#include <etk/UString.h>
class Colorize {
public:
// Constructeur
Colorize(void);
Colorize(etk::UString &newColorName);
~Colorize(void);
namespace appl
{
class Colorize {
public:
/**
* @brief Constructeur
* @param[in] _colorName Name of the color...
*/
Colorize(etk::UString& _colorName="no_name");
/**
* @brief Desstructeur
*/
virtual ~Colorize(void) { };
private:
etk::UString m_name; //!< curent color Name
public:
void SetName(const etk::UString &_newColorName);
const etk::UString& GetName(void) { return m_name; };
void SetName(etk::UString &newColorName);
void SetName(const char *newColorName);
etk::UString GetName(void);
void SetFgColor(const char *myColor);
void SetBgColor(const char *myColor);
private:
draw::Color m_colorFG; //!< Foreground color
draw::Color m_colorBG; //!< Background color
public:
void SetFgColor(const etk::UString& _myColor);
void SetBgColor(const etk::UString& _myColor);
const draw::Color& GetFG(void) { return m_colorFG; };
const draw::Color& GetBG(void) { return m_colorBG; };
bool HaveBg(void) { return m_colorBG.a!=0; };
draw::Color & GetFG(void) { return m_colorFG; };
draw::Color & GetBG(void) { return m_colorBG; };
bool HaveBg(void);
void SetItalic(bool enable);
void SetBold(bool enable);
bool GetItalic(void);
bool GetBold(void);
void Display(int32_t i) { APPL_INFO(" " << i << " : \"" << ColorName << "\"" << " fg="<< m_colorFG); };
private:
etk::UString ColorName; //!< curent color Name
draw::Color m_colorFG;
draw::Color m_colorBG;
bool italic;
bool bold;
private:
bool m_italic; //!< the color request italic
bool m_bold; //!< The color request bold
public:
void SetItalic(bool _enable);
void SetBold(bool _enable);
bool GetItalic(void) { return m_italic; };
bool GetBold(void) { return m_bold; };
};
etk::CCout& operator <<(etk::CCout& _os, const appl::Colorize& _obj);
};
#endif

View File

@ -29,20 +29,15 @@ class classColorManager: public ewol::EObject
}
virtual void OnReceiveMessage(const ewol::EMessage& _msg);
public:
void LoadFile(etk::UString &xmlFilename);
void LoadFile(const char * xmlFilename);
Colorize * Get(const char *colorName);
Colorize * Get(etk::UString &colorName);
draw::Color& Get(basicColor_te myColor);
bool Exist(etk::UString &colorName);
bool Exist(const char *colorName);
void DisplayListOfColor(void);
void LoadFile(const etk::UString& _xmlFilename);
appl::Colorize* Get(const etk::UString& _colorName);
bool Exist(void etk::UString& _colorName);
void DisplayListOfColor(void);
private:
etk::UString m_fileColor;
etk::Vector<Colorize*> listMyColor; //!< List of ALL Color
Colorize * errorColor;
draw::Color basicColors[COLOR_NUMBER_MAX];
etk::UString m_fileColor;
etk::Vector<appl::Colorize*> m_list; //!< List of ALL Color
appl::Colorize * m_colorizeError;
};
@ -53,18 +48,18 @@ classColorManager::classColorManager(void)
classColorManager::~classColorManager(void)
{
delete(errorColor);
delete(m_colorizeError);
int32_t i;
// clean all Element
for (i=0; i< listMyColor.Size(); i++) {
if (NULL != listMyColor[i]) {
delete(listMyColor[i]);
listMyColor[i] = NULL;
for (i=0; i< m_list.Size(); i++) {
if (NULL != m_list[i]) {
delete(m_list[i]);
m_list[i] = NULL;
}
}
// clear the compleate list
listMyColor.Clear();
m_list.Clear();
}
void classColorManager::OnReceiveMessage(const ewol::EMessage& _msg)
@ -84,38 +79,30 @@ void classColorManager::OnReceiveMessage(const ewol::EMessage& _msg)
*/
}
void classColorManager::LoadFile(etk::UString &xmlFilename)
{
// TODO : Remove this
LoadFile(xmlFilename.c_str());
}
// TODO : Remove this ...
void classColorManager::LoadFile(const char * xmlFilename)
void classColorManager::LoadFile(const etk::UString& _xmlFilename)
{
// Remove all old color :
int32_t i;
// clean all Element
for (i=0; i< listMyColor.Size(); i++) {
if (NULL != listMyColor[i]) {
delete(listMyColor[i]);
listMyColor[i] = NULL;
for (i=0; i< m_list.Size(); i++) {
if (NULL != m_list[i]) {
delete(m_list[i]);
m_list[i] = NULL;
}
}
// clear the compleate list
listMyColor.Clear();
m_list.Clear();
m_fileColor = xmlFilename;
APPL_DEBUG("open file (COLOR) \"" << xmlFilename << "\" ? = \"" << m_fileColor << "\"");
errorColor = new Colorize();
errorColor->SetBgColor("#00FF00FF");
errorColor->SetFgColor("#FF00FFFF");
m_fileColor = _xmlFilename;
APPL_DEBUG("open file (COLOR) \"" << _xmlFilename << "\" ? = \"" << m_fileColor << "\"");
m_colorizeError = new Colorize();
m_colorizeError->SetBgColor("#00FF00FF");
m_colorizeError->SetFgColor("#FF00FFFF");
// allocate the document in the stack
TiXmlDocument XmlDocument;
// open the curent File
etk::FSNode fileName(etk::UString("DATA:color/") + xmlFilename + etk::UString(".xml"));
etk::FSNode fileName(etk::UString("DATA:color/") + _xmlFilename + etk::UString(".xml"));
if (false == fileName.Exist()) {
APPL_ERROR("File Does not exist : " << fileName);
return;
@ -152,109 +139,45 @@ void classColorManager::LoadFile(const char * xmlFilename)
while(NULL != pNode) {
if (pNode->Type()==TiXmlNode::TINYXML_COMMENT) {
// nothing to do, just proceed to next step
} else if (!strcmp(pNode->Value(), "gui")) {
TiXmlNode * pGuiNode = pNode->FirstChild();
while(NULL != pGuiNode) {
if (pGuiNode->Type()==TiXmlNode::TINYXML_COMMENT) {
// nothing to do, just proceed to next step
} else if (!strcmp(pGuiNode->Value(), "color")) {
//--------------------------------------------------------------------------------------------
//<color name="basicBackground" val="#000000"/>
//--------------------------------------------------------------------------------------------
const char *colorName = pGuiNode->ToElement()->Attribute("name");
int32_t id = 0;
if (NULL == colorName) {
APPL_ERROR("(l "<< pGuiNode->Row() <<") node with no name");
// get next node element
pGuiNode = pGuiNode->NextSibling();
continue;
}
if (!strcmp(colorName, "CODE_space")) {
id = COLOR_CODE_SPACE;
} else if (!strcmp(colorName, "CODE_tabulation")) {
id = COLOR_CODE_TAB;
} else if (!strcmp(colorName, "CODE_basicBackgroung")) {
id = COLOR_CODE_BASIC_BG;
} else if (!strcmp(colorName, "CODE_cursor")) {
id = COLOR_CODE_CURSOR;
} else if (!strcmp(colorName, "CODE_lineNumber")) {
id = COLOR_CODE_LINE_NUMBER;
} else if (!strcmp(colorName, "LIST_backgroung1")) {
id = COLOR_LIST_BG_1;
} else if (!strcmp(colorName, "LIST_backgroung2")) {
id = COLOR_LIST_BG_2;
} else if (!strcmp(colorName, "LIST_backgroungSelected")) {
id = COLOR_LIST_BG_SELECTED;
} else if (!strcmp(colorName, "LIST_textNormal")) {
id = COLOR_LIST_TEXT_NORMAL;
} else if (!strcmp(colorName, "LIST_textModify")) {
id = COLOR_LIST_TEXT_MODIFY;
} else {
APPL_ERROR("(l "<<pGuiNode->Row()<<") Unknown basic gui color : \"" << colorName << "\"" );
// get next node element
pGuiNode = pGuiNode->NextSibling();
continue;
}
const char *color = pGuiNode->ToElement()->Attribute("val");
if (NULL != color) {
basicColors[id] = color;
}
} else {
APPL_ERROR("(l "<<pGuiNode->Row()<<") node not suported : \""<<pGuiNode->Value()<<"\" must be [color]");
}
} else if (!strcmp(pNode->Value(), "color")) {
appl::Colorize *myNewColor = new appl::Colorize();
//--------------------------------------------------------------------------------------------
//<color name="basicBackground" FG="#000000" BG="#000000" bold="no" italic="no"/>
//--------------------------------------------------------------------------------------------
// get the name of the Chaine
const char *colorName = pGuiNode->ToElement()->Attribute("name");
if (NULL == colorName) {
APPL_ERROR(PFX"(l "<< pGuiNode->Row() <<") node with no name");
// get next node element
pGuiNode = pGuiNode->NextSibling();
continue;
} else {
myNewColor->SetName(colorName);
//APPL_INFO(PFX"Add a new color in the panel : \"%s\"", colorName);
}
} else if (!strcmp(pNode->Value(), "syntax")) {
TiXmlNode * pGuiNode = pNode->FirstChild();
while(NULL != pGuiNode)
{
if (pGuiNode->Type()==TiXmlNode::TINYXML_COMMENT) {
// nothing to do, just proceed to next step
} else if (!strcmp(pGuiNode->Value(), "color")) {
Colorize *myNewColor = new Colorize();
//--------------------------------------------------------------------------------------------
//<color name="basicBackground" FG="#000000" BG="#000000" bold="no" italic="no"/>
//--------------------------------------------------------------------------------------------
// get the name of the Chaine
const char *colorName = pGuiNode->ToElement()->Attribute("name");
if (NULL == colorName) {
APPL_ERROR(PFX"(l "<< pGuiNode->Row() <<") node with no name");
// get next node element
pGuiNode = pGuiNode->NextSibling();
continue;
} else {
myNewColor->SetName(colorName);
//APPL_INFO(PFX"Add a new color in the panel : \"%s\"", colorName);
}
const char *colorBG = pGuiNode->ToElement()->Attribute("BG");
if (NULL != colorBG) {
myNewColor->SetBgColor(colorBG);
}
const char *colorFG = pGuiNode->ToElement()->Attribute("FG");
if (NULL != colorFG) {
myNewColor->SetFgColor(colorFG);
}
const char *bold = pGuiNode->ToElement()->Attribute("bold");
if (NULL != bold) {
if(0 == strcmp(bold, "yes") ) {
myNewColor->SetBold(true);
}
}
const char *italic = pGuiNode->ToElement()->Attribute("italic");
if (NULL != italic) {
if(0 == strcmp(italic, "yes") ) {
myNewColor->SetItalic(true);
}
}
listMyColor.PushBack(myNewColor);
} else {
APPL_ERROR(PFX"(l "<<pNode->Row()<<") node not suported : \""<<pNode->Value()<<"\" must be [color]");
const char *colorBG = pGuiNode->ToElement()->Attribute("BG");
if (NULL != colorBG) {
myNewColor->SetBgColor(colorBG);
}
const char *colorFG = pGuiNode->ToElement()->Attribute("FG");
if (NULL != colorFG) {
myNewColor->SetFgColor(colorFG);
}
const char *bold = pGuiNode->ToElement()->Attribute("bold");
if (NULL != bold) {
if(0 == strcmp(bold, "yes") ) {
myNewColor->SetBold(true);
}
pGuiNode = pGuiNode->NextSibling();
}
const char *italic = pGuiNode->ToElement()->Attribute("italic");
if (NULL != italic) {
if(0 == strcmp(italic, "yes") ) {
myNewColor->SetItalic(true);
}
}
m_list.PushBack(myNewColor);
} else {
APPL_ERROR(PFX"(l "<<pNode->Row()<<") node not suported : \""<<pNode->Value()<<"\" must be [gui,syntax]");
APPL_ERROR(PFX"(l "<<pNode->Row()<<") node not suported : \""<<pNode->Value()<<"\" must be [color]");
}
// get next node element
pNode = pNode->NextSibling();
@ -267,64 +190,34 @@ void classColorManager::LoadFile(const char * xmlFilename)
//SendMessage(APPL_MSG__USER_DISPLAY_CHANGE);
}
// TODO : Remove this ...
Colorize *classColorManager::Get(const char *colorName)
Colorize *classColorManager::Get(const etk::UString& _colorName)
{
int32_t i;
for (i=0; i<listMyColor.Size(); i++) {
etk::UString elementName = listMyColor[i]->GetName();
if (elementName == colorName) {
return listMyColor[i];
for (int32_t iii=0; iii<m_list.Size(); iii++) {
if (_colorName == m_list[iii]->GetName()) {
return m_list[iii];
}
}
APPL_ERROR(PFX"Color does not Existed ["<< colorName<<"]" );
APPL_ERROR(PFX"Color does not Existed ["<< _colorName<<"]" );
// an error
return errorColor;
return m_colorizeError;
}
Colorize *classColorManager::Get(etk::UString &colorName)
bool classColorManager::Exist(const etk::UString& _colorName)
{
// TODO : Remove this
return Get(colorName.c_str());
}
draw::Color & classColorManager::Get(basicColor_te myColor)
{
if (myColor < COLOR_NUMBER_MAX) {
return basicColors[myColor];
} else {
return basicColors[0];
}
}
// TODO : Remove this ...
bool classColorManager::Exist(const char *colorName)
{
int32_t i;
for (i=0; i<listMyColor.Size(); i++) {
etk::UString elementName = listMyColor[i]->GetName();
if (elementName == colorName) {
for (int32_t iii=0; iii<m_list.Size(); iii++) {
if (_colorName == m_list[iii]->GetName()) {
return true;
}
}
return false;
}
bool classColorManager::Exist(etk::UString &colorName)
{
// TODO : Remove this
return Exist(colorName.c_str());
}
void classColorManager::DisplayListOfColor(void)
{
int32_t i;
APPL_INFO(PFX"List of ALL COLOR : ");
for (i=0; i<listMyColor.Size(); i++) {
//etk::UString elementName = listMyColor[i]->GetName();
//APPL_INFO(i << " : \"" << elementName.c_str() << "\"" );
listMyColor[i]->Display(i);
for (iii=0; iii<m_list.Size(); iii++) {
APPL_INFO(" " << i << " : " << *m_list[i]);
}
}
@ -356,63 +249,28 @@ void ColorizeManager::UnInit(void)
localManager = NULL;
}
void ColorizeManager::LoadFile(etk::UString &xmlFilename)
void ColorizeManager::LoadFile(const etk::UString& _xmlFilename)
{
if (NULL == localManager) {
return;
}
localManager->LoadFile(xmlFilename);
localManager->LoadFile(_xmlFilename);
}
void ColorizeManager::LoadFile(const char * xmlFilename)
{
if (NULL == localManager) {
return;
}
localManager->LoadFile(xmlFilename);
}
Colorize* ColorizeManager::Get(const char *colorName)
Colorize* ColorizeManager::Get(const etk::UString& _colorName)
{
if (NULL == localManager) {
return NULL;
}
return localManager->Get(colorName);
return localManager->Get(_colorName);
}
Colorize* ColorizeManager::Get(etk::UString &colorName)
{
if (NULL == localManager) {
return NULL;
}
return localManager->Get(colorName);
}
draw::Color errorColor;
draw::Color& ColorizeManager::Get(basicColor_te myColor)
{
if (NULL == localManager) {
return errorColor;
}
return localManager->Get(myColor);
}
bool ColorizeManager::Exist(etk::UString &colorName)
bool ColorizeManager::Exist(const etk::UString& _colorName)
{
if (NULL == localManager) {
return false;
}
return localManager->Exist(colorName);
}
bool ColorizeManager::Exist(const char *colorName)
{
if (NULL == localManager) {
return false;
}
return localManager->Exist(colorName);
return localManager->Exist(_colorName);
}
void ColorizeManager::DisplayListOfColor(void)

View File

@ -14,38 +14,18 @@
#include <draw/Color.h>
#include <ewol/widget/Widget.h>
typedef enum {
// BASIC color for codeViewer
COLOR_CODE_SPACE,
COLOR_CODE_TAB,
COLOR_CODE_BASIC_BG,
COLOR_CODE_CURSOR,
COLOR_CODE_LINE_NUMBER,
// Basic color for list viewer
COLOR_LIST_BG_1,
COLOR_LIST_BG_2,
COLOR_LIST_BG_SELECTED,
COLOR_LIST_TEXT_NORMAL,
COLOR_LIST_TEXT_MODIFY,
// KNOW the number of BASIC color
COLOR_NUMBER_MAX,
}basicColor_te;
namespace ColorizeManager
namespace appl
{
void Init(void);
void UnInit(void);
void LoadFile(etk::UString &xmlFilename);
void LoadFile(const char * xmlFilename);
Colorize * Get(const char *colorName);
Colorize * Get(etk::UString &colorName);
draw::Color& Get(basicColor_te myColor);
bool Exist(etk::UString &colorName);
bool Exist(const char *colorName);
void DisplayListOfColor(void);
namespace ColorizeManager
{
void Init(void);
void UnInit(void);
void LoadFile(const etk::UString &_xmlFilename);
appl::Colorize* Get(const etk::UString &_colorName);
bool Exist(const etk::UString &_colorName);
void DisplayListOfColor(void);
};
};
#endif

View File

@ -32,32 +32,37 @@ namespace appl
};
~dataBufferStruct(void) { };
};
};
class BufferView : public widget::List
{
private:
int32_t m_selectedIdRequested;
int32_t m_selectedID;
etk::Vector<appl::dataBufferStruct*> m_list;
public:
// Constructeur
BufferView(void);
~BufferView(void);
// Derived function
const char * const GetObjectType(void) { return "ApplBufferView"; };
// Derived function
virtual void OnReceiveMessage(const ewol::EMessage& _msg);
protected:
// function call to display the list :
virtual draw::Color GetBasicBG(void);
void RemoveAllElement(void);
// Derived function
virtual uint32_t GetNuberOfColomn(void);
virtual bool GetTitle(int32_t colomn, etk::UString &myTitle, draw::Color &fg, draw::Color &bg);
virtual uint32_t GetNuberOfRaw(void);
virtual bool GetElement(int32_t colomn, int32_t raw, etk::UString &myTextToWrite, draw::Color &fg, draw::Color &bg);
virtual bool OnItemEvent(int32_t IdInput, ewol::keyEvent::status_te typeEvent, int32_t colomn, int32_t raw, float x, float y);
class BufferView : public widget::List
{
public:
/**
* @brief Constructeur
*/
BufferView(void);
/**
* @brief Destructeur
*/
virtual ~BufferView(void);
private:
int32_t m_selectedIdRequested;
int32_t m_selectedID;
etk::Vector<appl::dataBufferStruct*> m_list;
public: // Derived function
const char * const GetObjectType(void) { return "ApplBufferView"; };
virtual void OnReceiveMessage(const ewol::EMessage& _msg);
protected:
// function call to display the list :
virtual draw::Color GetBasicBG(void);
void RemoveAllElement(void);
// Derived function
virtual uint32_t GetNuberOfColomn(void);
virtual bool GetTitle(int32_t colomn, etk::UString &myTitle, draw::Color &fg, draw::Color &bg);
virtual uint32_t GetNuberOfRaw(void);
virtual bool GetElement(int32_t colomn, int32_t raw, etk::UString &myTextToWrite, draw::Color &fg, draw::Color &bg);
virtual bool OnItemEvent(int32_t IdInput, ewol::keyEvent::status_te typeEvent, int32_t colomn, int32_t raw, float x, float y);
};
};