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

This reverts commit 0633355169f59630eb5364564f82bf4f98226d8c.
This commit is contained in:
Edouard DUPIN 2013-05-21 09:11:14 +02:00
parent 0633355169
commit cd8b5772e9
6 changed files with 382 additions and 194 deletions

View File

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

View File

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

View File

@ -11,46 +11,39 @@
#include <draw/Color.h>
#include <etk/UString.h>
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; };
class Colorize {
public:
// Constructeur
Colorize(void);
Colorize(etk::UString &newColorName);
~Colorize(void);
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; };
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:
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);
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;
};
#endif

View File

@ -29,15 +29,20 @@ class classColorManager: public ewol::EObject
}
virtual void OnReceiveMessage(const ewol::EMessage& _msg);
public:
void LoadFile(const etk::UString& _xmlFilename);
appl::Colorize* Get(const etk::UString& _colorName);
bool Exist(void etk::UString& _colorName);
void DisplayListOfColor(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);
private:
etk::UString m_fileColor;
etk::Vector<appl::Colorize*> m_list; //!< List of ALL Color
appl::Colorize * m_colorizeError;
etk::UString m_fileColor;
etk::Vector<Colorize*> listMyColor; //!< List of ALL Color
Colorize * errorColor;
draw::Color basicColors[COLOR_NUMBER_MAX];
};
@ -48,18 +53,18 @@ classColorManager::classColorManager(void)
classColorManager::~classColorManager(void)
{
delete(m_colorizeError);
delete(errorColor);
int32_t i;
// clean all Element
for (i=0; i< m_list.Size(); i++) {
if (NULL != m_list[i]) {
delete(m_list[i]);
m_list[i] = NULL;
for (i=0; i< listMyColor.Size(); i++) {
if (NULL != listMyColor[i]) {
delete(listMyColor[i]);
listMyColor[i] = NULL;
}
}
// clear the compleate list
m_list.Clear();
listMyColor.Clear();
}
void classColorManager::OnReceiveMessage(const ewol::EMessage& _msg)
@ -79,30 +84,38 @@ void classColorManager::OnReceiveMessage(const ewol::EMessage& _msg)
*/
}
void classColorManager::LoadFile(const etk::UString& _xmlFilename)
void classColorManager::LoadFile(etk::UString &xmlFilename)
{
// TODO : Remove this
LoadFile(xmlFilename.c_str());
}
// TODO : Remove this ...
void classColorManager::LoadFile(const char * xmlFilename)
{
// Remove all old color :
int32_t i;
// clean all Element
for (i=0; i< m_list.Size(); i++) {
if (NULL != m_list[i]) {
delete(m_list[i]);
m_list[i] = NULL;
for (i=0; i< listMyColor.Size(); i++) {
if (NULL != listMyColor[i]) {
delete(listMyColor[i]);
listMyColor[i] = NULL;
}
}
// clear the compleate list
m_list.Clear();
listMyColor.Clear();
m_fileColor = _xmlFilename;
APPL_DEBUG("open file (COLOR) \"" << _xmlFilename << "\" ? = \"" << m_fileColor << "\"");
m_colorizeError = new Colorize();
m_colorizeError->SetBgColor("#00FF00FF");
m_colorizeError->SetFgColor("#FF00FFFF");
m_fileColor = xmlFilename;
APPL_DEBUG("open file (COLOR) \"" << xmlFilename << "\" ? = \"" << m_fileColor << "\"");
errorColor = new Colorize();
errorColor->SetBgColor("#00FF00FF");
errorColor->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;
@ -139,45 +152,109 @@ void classColorManager::LoadFile(const etk::UString& _xmlFilename)
while(NULL != pNode) {
if (pNode->Type()==TiXmlNode::TINYXML_COMMENT) {
// nothing to do, just proceed to next step
} 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");
} 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]");
}
// 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);
} 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]");
}
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 [color]");
APPL_ERROR(PFX"(l "<<pNode->Row()<<") node not suported : \""<<pNode->Value()<<"\" must be [gui,syntax]");
}
// get next node element
pNode = pNode->NextSibling();
@ -190,34 +267,64 @@ void classColorManager::LoadFile(const etk::UString& _xmlFilename)
//SendMessage(APPL_MSG__USER_DISPLAY_CHANGE);
}
Colorize *classColorManager::Get(const etk::UString& _colorName)
// TODO : Remove this ...
Colorize *classColorManager::Get(const char *colorName)
{
for (int32_t iii=0; iii<m_list.Size(); iii++) {
if (_colorName == m_list[iii]->GetName()) {
return m_list[iii];
int32_t i;
for (i=0; i<listMyColor.Size(); i++) {
etk::UString elementName = listMyColor[i]->GetName();
if (elementName == colorName) {
return listMyColor[i];
}
}
APPL_ERROR(PFX"Color does not Existed ["<< _colorName<<"]" );
APPL_ERROR(PFX"Color does not Existed ["<< colorName<<"]" );
// an error
return m_colorizeError;
return errorColor;
}
bool classColorManager::Exist(const etk::UString& _colorName)
Colorize *classColorManager::Get(etk::UString &colorName)
{
for (int32_t iii=0; iii<m_list.Size(); iii++) {
if (_colorName == m_list[iii]->GetName()) {
// 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) {
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 (iii=0; iii<m_list.Size(); iii++) {
APPL_INFO(" " << i << " : " << *m_list[i]);
for (i=0; i<listMyColor.Size(); i++) {
//etk::UString elementName = listMyColor[i]->GetName();
//APPL_INFO(i << " : \"" << elementName.c_str() << "\"" );
listMyColor[i]->Display(i);
}
}
@ -249,28 +356,63 @@ void ColorizeManager::UnInit(void)
localManager = NULL;
}
void ColorizeManager::LoadFile(const etk::UString& _xmlFilename)
void ColorizeManager::LoadFile(etk::UString &xmlFilename)
{
if (NULL == localManager) {
return;
}
localManager->LoadFile(_xmlFilename);
localManager->LoadFile(xmlFilename);
}
Colorize* ColorizeManager::Get(const etk::UString& _colorName)
void ColorizeManager::LoadFile(const char * xmlFilename)
{
if (NULL == localManager) {
return;
}
localManager->LoadFile(xmlFilename);
}
Colorize* ColorizeManager::Get(const char *colorName)
{
if (NULL == localManager) {
return NULL;
}
return localManager->Get(_colorName);
return localManager->Get(colorName);
}
bool ColorizeManager::Exist(const etk::UString& _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)
{
if (NULL == localManager) {
return false;
}
return localManager->Exist(_colorName);
return localManager->Exist(colorName);
}
bool ColorizeManager::Exist(const char *colorName)
{
if (NULL == localManager) {
return false;
}
return localManager->Exist(colorName);
}
void ColorizeManager::DisplayListOfColor(void)

View File

@ -14,18 +14,38 @@
#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 appl
namespace ColorizeManager
{
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);
};
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);
};
#endif

View File

@ -32,37 +32,32 @@ namespace appl
};
~dataBufferStruct(void) { };
};
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);
};
};
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);
};