[DEV] code style step 1

This commit is contained in:
2013-10-07 22:04:21 +02:00
parent 211c253116
commit d677075e16
45 changed files with 1890 additions and 1890 deletions

View File

@@ -25,7 +25,7 @@ Colorize::Colorize(const etk::UString &_newColorName) :
APPL_VERBOSE("New(Colorise)");
}
void Colorize::SetItalic(bool _enable)
void Colorize::setItalic(bool _enable)
{
m_italic = _enable;
if (true == _enable) {
@@ -35,7 +35,7 @@ void Colorize::SetItalic(bool _enable)
}
}
void Colorize::SetBold(bool _enable)
void Colorize::setBold(bool _enable)
{
m_bold = _enable;
if (true == _enable) {

View File

@@ -20,32 +20,32 @@ class Colorize {
private:
etk::UString m_colorName; //!< curent color Name
public:
void SetName(const etk::UString& _newColorName) { m_colorName = _newColorName; };
const etk::UString& GetName(void) { return m_colorName; };
void setName(const etk::UString& _newColorName) { m_colorName = _newColorName; };
const etk::UString& getName(void) { return m_colorName; };
private:
etk::Color<> m_colorFG;
public:
void SetFgColor(const etk::UString& _myColor) { m_colorFG=_myColor; };
const etk::Color<>& GetFG(void) { return m_colorFG; };
bool HaveFg(void) { return m_colorFG.a()!=0; };
void setFgColor(const etk::UString& _myColor) { m_colorFG=_myColor; };
const etk::Color<>& getFG(void) { return m_colorFG; };
bool haveFg(void) { return m_colorFG.a()!=0; };
private:
etk::Color<> m_colorBG;
public:
void SetBgColor(const etk::UString& _myColor) { m_colorBG=_myColor; };
const etk::Color<>& GetBG(void) { return m_colorBG; };
bool HaveBg(void) { return m_colorBG.a()!=0; };
void setBgColor(const etk::UString& _myColor) { m_colorBG=_myColor; };
const etk::Color<>& getBG(void) { return m_colorBG; };
bool haveBg(void) { return m_colorBG.a()!=0; };
private:
bool m_italic;
public:
void SetItalic(bool _enable);
bool GetItalic(void) { return m_italic; };
void setItalic(bool _enable);
bool getItalic(void) { return m_italic; };
private:
bool m_bold;
public:
void SetBold(bool _enable);
bool GetBold(void) { return m_bold; };
void Display(int32_t _i) { APPL_INFO(" " << _i << " : fg="<< m_colorFG << " bold=" << m_italic << " bold=" << m_italic << "\"" << m_colorName << "\""); };
void setBold(bool _enable);
bool getBold(void) { return m_bold; };
void display(int32_t _i) { APPL_INFO(" " << _i << " : fg="<< m_colorFG << " bold=" << m_italic << " bold=" << m_italic << "\"" << m_colorName << "\""); };
};
#endif

View File

@@ -28,7 +28,7 @@ class classColorManager: public ewol::EObject
// Constructeur
classColorManager(void)
{
//ewol::widgetMessageMultiCast::Add(GetWidgetId(), ednMsgGuiChangeColor);
//ewol::widgetMessageMultiCast::add(getWidgetId(), ednMsgGuiChangeColor);
}
~classColorManager(void)
{
@@ -36,43 +36,43 @@ class classColorManager: public ewol::EObject
int32_t i;
// clean all Element
for (i=0; i< listMyColor.Size(); i++) {
for (i=0; i< listMyColor.size(); i++) {
if (NULL != listMyColor[i]) {
delete(listMyColor[i]);
listMyColor[i] = NULL;
}
}
// clear the compleate list
listMyColor.Clear();
listMyColor.clear();
}
const char * const GetObjectType(void)
const char * const getObjectType(void)
{
return "Appl::ColorManager";
}
void OnReceiveMessage(const ewol::EMessage& _msg)
void onReceiveMessage(const ewol::EMessage& _msg)
{
/*
switch (id)
{
case APPL_MSG__RELOAD_COLOR_FILE:
{
// Reaload File
// Reaload file
// TODO : Check this : Pb in the recopy etk::UString element
etk::UString plop = m_fileColor;
LoadFile(plop);
loadFile(plop);
}
break;
}
*/
}
public:
void LoadFile(const etk::UString& _xmlFilename);
Colorize* Get(const etk::UString& _colorName)
void loadFile(const etk::UString& _xmlFilename);
Colorize* get(const etk::UString& _colorName)
{
int32_t i;
for (i=0; i<listMyColor.Size(); i++) {
if (listMyColor[i]->GetName() == _colorName) {
for (i=0; i<listMyColor.size(); i++) {
if (listMyColor[i]->getName() == _colorName) {
return listMyColor[i];
}
}
@@ -80,7 +80,7 @@ class classColorManager: public ewol::EObject
// an error
return errorColor;
}
etk::Color<>& Get(basicColor_te _myColor)
etk::Color<>& get(basicColor_te _myColor)
{
if (_myColor < COLOR_NUMBER_MAX) {
return basicColors[_myColor];
@@ -91,155 +91,155 @@ class classColorManager: public ewol::EObject
bool Exist(const etk::UString& _colorName)
{
int32_t i;
for (i=0; i<listMyColor.Size(); i++) {
if (listMyColor[i]->GetName() == _colorName) {
for (i=0; i<listMyColor.size(); i++) {
if (listMyColor[i]->getName() == _colorName) {
return true;
}
}
return false;
}
void DisplayListOfColor(void)
void 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();
for (i=0; i<listMyColor.size(); i++) {
//etk::UString elementName = listMyColor[i]->getName();
//APPL_INFO(i << " : \"" << elementName.c_str() << "\"" );
listMyColor[i]->Display(i);
listMyColor[i]->display(i);
}
}
};
void classColorManager::LoadFile(const etk::UString& _xmlFilename)
void classColorManager::loadFile(const etk::UString& _xmlFilename)
{
// Remove all old color :
for (int32_t iii=0; iii< listMyColor.Size(); iii++) {
// remove all old color :
for (int32_t iii=0; iii< listMyColor.size(); iii++) {
if (NULL != listMyColor[iii]) {
delete(listMyColor[iii]);
listMyColor[iii] = NULL;
}
}
// clear the compleate list
listMyColor.Clear();
listMyColor.clear();
m_fileColor = _xmlFilename;
APPL_DEBUG("open file (COLOR) \"" << _xmlFilename << "\" ? = \"" << m_fileColor << "\"");
errorColor = new Colorize();
errorColor->SetBgColor("#00FF00FF");
errorColor->SetFgColor("#FF00FFFF");
errorColor->setBgColor("#00FF00FF");
errorColor->setFgColor("#FF00FFFF");
// open the curent File
// open the curent file
etk::UString fileName(etk::UString("DATA:color/") + _xmlFilename + etk::UString(".xml"));
exml::Document doc;
if (doc.Load(fileName)==false) {
if (doc.load(fileName) == false) {
APPL_ERROR(" can not load file XML : " << fileName);
return;
}
exml::Element* root = (exml::Element*)doc.GetNamed("EdnColor");
exml::Element* root = (exml::Element*)doc.getNamed("EdnColor");
if (NULL == root ) {
APPL_ERROR("[" << GetId() << "] {" << GetObjectType() << "} (l ?) main node not find: \"EdnColor\" ...");
APPL_ERROR("[" << getId() << "] {" << GetObjectType() << "} (l ?) main node not find: \"EdnColor\" ...");
return;
}
// parse all the elements :
for(int32_t iii=0; iii< root->Size(); iii++) {
exml::Element* pNode = root->GetElement(iii);
if (pNode==NULL) {
for(int32_t iii=0; iii< root->size(); iii++) {
exml::Element* pNode = root->getElement(iii);
if (pNode == NULL) {
// trash here all that is not element.
continue;
}
if (pNode->GetValue()=="gui") {
for(int32_t iii=0; iii< pNode->Size(); iii++) {
exml::Element* pGuiNode = pNode->GetElement(iii);
if (pGuiNode==NULL) {
if (pNode->getValue() == "gui") {
for(int32_t iii=0; iii< pNode->size(); iii++) {
exml::Element* pGuiNode = pNode->getElement(iii);
if (pGuiNode == NULL) {
// trash here all that is not element.
continue;
}
if (pGuiNode->GetValue()!="color") {
APPL_ERROR("(l "<<pGuiNode->GetPos()<<") node not suported : \""<<pGuiNode->GetValue()<<"\" must be [color]");
if (pGuiNode->getValue()!="color") {
APPL_ERROR("(l "<<pGuiNode->getPos()<<") node not suported : \""<<pGuiNode->GetValue()<<"\" must be [color]");
continue;
}
//--------------------------------------------------------------------------------------------
//<color name="basicBackground" val="#000000"/>
//--------------------------------------------------------------------------------------------
etk::UString colorName = pGuiNode->GetAttribute("name");
if (colorName.Size()==0) {
APPL_ERROR("(l "<< pGuiNode->GetPos() <<") node with no name");
etk::UString colorName = pGuiNode->getAttribute("name");
if (colorName.size() == 0) {
APPL_ERROR("(l "<< pGuiNode->getPos() <<") node with no name");
continue;
}
int32_t id = 0;
if (colorName=="CODE_space") {
if (colorName == "CODE_space") {
id = COLOR_CODE_SPACE;
} else if (colorName=="CODE_tabulation") {
} else if (colorName == "CODE_tabulation") {
id = COLOR_CODE_TAB;
} else if (colorName=="CODE_basicBackgroung") {
} else if (colorName == "CODE_basicBackgroung") {
id = COLOR_CODE_BASIC_BG;
} else if (colorName=="CODE_cursor") {
} else if (colorName == "CODE_cursor") {
id = COLOR_CODE_CURSOR;
} else if (colorName=="CODE_lineNumber") {
} else if (colorName == "CODE_lineNumber") {
id = COLOR_CODE_LINE_NUMBER;
} else if (colorName=="LIST_backgroung1") {
} else if (colorName == "LIST_backgroung1") {
id = COLOR_LIST_BG_1;
} else if (colorName=="LIST_backgroung2") {
} else if (colorName == "LIST_backgroung2") {
id = COLOR_LIST_BG_2;
} else if (colorName=="LIST_backgroungSelected") {
} else if (colorName == "LIST_backgroungSelected") {
id = COLOR_LIST_BG_SELECTED;
} else if (colorName=="LIST_textNormal") {
} else if (colorName == "LIST_textNormal") {
id = COLOR_LIST_TEXT_NORMAL;
} else if (colorName=="LIST_textModify") {
} else if (colorName == "LIST_textModify") {
id = COLOR_LIST_TEXT_MODIFY;
} else {
APPL_ERROR("(l "<<pGuiNode->GetPos()<<") Unknown basic gui color : \"" << colorName << "\"" );
APPL_ERROR("(l "<<pGuiNode->getPos()<<") Unknown basic gui color : \"" << colorName << "\"" );
continue;
}
etk::UString color = pGuiNode->GetAttribute("val");
if (color.Size()!=0) {
etk::UString color = pGuiNode->getAttribute("val");
if (color.size()!=0) {
basicColors[id] = color;
}
}
} else if (pNode->GetValue()=="syntax") {
for(int32_t iii=0; iii< pNode->Size(); iii++) {
exml::Element* pGuiNode = pNode->GetElement(iii);
if (pGuiNode==NULL) {
} else if (pNode->getValue() == "syntax") {
for(int32_t iii=0; iii< pNode->size(); iii++) {
exml::Element* pGuiNode = pNode->getElement(iii);
if (pGuiNode == NULL) {
continue;
}
if (pGuiNode->GetValue()!="color") {
APPL_ERROR(PFX"(l "<<pGuiNode->GetPos()<<") node not suported : \""<<pGuiNode->GetValue()<<"\" must be [color]");
if (pGuiNode->getValue()!="color") {
APPL_ERROR(PFX"(l "<<pGuiNode->getPos()<<") node not suported : \""<<pGuiNode->GetValue()<<"\" must be [color]");
continue;
}
//--------------------------------------------------------------------------------------------
//<color name="basicBackground" FG="#000000" BG="#000000" bold="no" italic="no"/>
//--------------------------------------------------------------------------------------------
// get the name of the Chaine
etk::UString colorName = pGuiNode->GetAttribute("name");
if (colorName.Size()==0) {
APPL_ERROR(PFX"(l "<< pGuiNode->GetPos() <<") node with no name");
etk::UString colorName = pGuiNode->getAttribute("name");
if (colorName.size() == 0) {
APPL_ERROR(PFX"(l "<< pGuiNode->getPos() <<") node with no name");
continue;
}
Colorize* myNewColor = new Colorize();
if (NULL==myNewColor) {
APPL_ERROR(PFX"(l "<< pGuiNode->GetPos() <<") ==> allocation error");
if (NULL == myNewColor) {
APPL_ERROR(PFX"(l "<< pGuiNode->getPos() <<") == > allocation error");
continue;
}
myNewColor->SetName(colorName);
etk::UString colorBG = pGuiNode->GetAttribute("BG");
if (colorBG.Size()!=0) {
myNewColor->SetBgColor(colorBG);
myNewColor->setName(colorName);
etk::UString colorBG = pGuiNode->getAttribute("BG");
if (colorBG.size()!=0) {
myNewColor->setBgColor(colorBG);
}
etk::UString colorFG = pGuiNode->GetAttribute("FG");
if (colorFG.Size()!=0) {
myNewColor->SetFgColor(colorFG);
etk::UString colorFG = pGuiNode->getAttribute("FG");
if (colorFG.size()!=0) {
myNewColor->setFgColor(colorFG);
}
etk::UString bold = pGuiNode->GetAttribute("bold");
if (bold.Size()!=0) {
myNewColor->SetBold(bold.ToBool());
etk::UString bold = pGuiNode->getAttribute("bold");
if (bold.size()!=0) {
myNewColor->setBold(bold.toBool());
}
etk::UString italic = pGuiNode->GetAttribute("italic");
if (italic.Size()!=0) {
myNewColor->SetItalic(italic.ToBool());
etk::UString italic = pGuiNode->getAttribute("italic");
if (italic.size()!=0) {
myNewColor->setItalic(italic.toBool());
}
listMyColor.PushBack(myNewColor);
listMyColor.pushBack(myNewColor);
}
}
}
@@ -253,10 +253,10 @@ void classColorManager::LoadFile(const etk::UString& _xmlFilename)
static classColorManager * localManager = NULL;
void ColorizeManager::Init(void)
void ColorizeManager::init(void)
{
if (NULL != localManager) {
EWOL_ERROR("ColorizeManager ==> already exist, just unlink the previous ...");
EWOL_ERROR("ColorizeManager == > already exist, just unlink the previous ...");
localManager = NULL;
}
localManager = new classColorManager();
@@ -269,37 +269,37 @@ void ColorizeManager::Init(void)
void ColorizeManager::UnInit(void)
{
if (NULL == localManager) {
EWOL_ERROR("ColorizeManager ==> request UnInit, but does not exist ...");
EWOL_ERROR("ColorizeManager == > request UnInit, but does not exist ...");
return;
}
delete(localManager);
localManager = NULL;
}
void ColorizeManager::LoadFile(const etk::UString& _xmlFilename)
void ColorizeManager::loadFile(const etk::UString& _xmlFilename)
{
if (NULL == localManager) {
return;
}
localManager->LoadFile(_xmlFilename);
localManager->loadFile(_xmlFilename);
}
Colorize* ColorizeManager::Get(const etk::UString& _colorName)
Colorize* ColorizeManager::get(const etk::UString& _colorName)
{
if (NULL == localManager) {
return NULL;
}
return localManager->Get(_colorName);
return localManager->get(_colorName);
}
etk::Color<>& ColorizeManager::Get(basicColor_te _myColor)
etk::Color<>& ColorizeManager::get(basicColor_te _myColor)
{
static etk::Color<> errorColor;
if (NULL == localManager) {
return errorColor;
}
return localManager->Get(_myColor);
return localManager->get(_myColor);
}
bool ColorizeManager::Exist(const etk::UString& _colorName)
@@ -310,12 +310,12 @@ bool ColorizeManager::Exist(const etk::UString& _colorName)
return localManager->Exist(_colorName);
}
void ColorizeManager::DisplayListOfColor(void)
void ColorizeManager::displayListOfColor(void)
{
if (NULL == localManager) {
return;
}
localManager->DisplayListOfColor();
localManager->displayListOfColor();
}

View File

@@ -35,13 +35,13 @@ typedef enum {
namespace ColorizeManager
{
void Init(void);
void init(void);
void UnInit(void);
void LoadFile(const etk::UString& _xmlFilename);
Colorize * Get(const etk::UString& _colorName);
etk::Color<>& Get(basicColor_te _myColor);
void loadFile(const etk::UString& _xmlFilename);
Colorize * get(const etk::UString& _colorName);
etk::Color<>& get(basicColor_te _myColor);
bool Exist(const etk::UString& _colorName);
void DisplayListOfColor(void);
void displayListOfColor(void);
};
#endif