diff --git a/data/color/black.xml b/data/color/black.xml index bdfa2d2..b746607 100644 --- a/data/color/black.xml +++ b/data/color/black.xml @@ -1,40 +1,35 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +{ + "ednColor": [ + { name="CODE_basicBackgroung", foreground="#151515" }, + { name="CODE_space", foreground="#333333" }, + { name="CODE_tabulation", foreground="#444444" }, + { name="CODE_cursor", foreground="#eadd05" }, + { name="CODE_lineNumber", foreground="#fff725" }, + { name="LIST_backgroung1", foreground="#202020" }, + { name="LIST_backgroung2", foreground="#000000" }, + { name="LIST_backgroungSelected", foreground="#2f0ba4" }, + { name="LIST_textNormal", foreground="#EEEEEE" }, + { name="LIST_textModify", foreground="#FF0000" }, + + { name="normal", foreground="#EEEEEE"}, + { name="SelectedText", foreground="#AAAAAA", background="#225a09"}, + { name="error", foreground="#FF0000"}, + { name="doubleQuoteText", foreground="#00fF00"}, + + { name="type", foreground="#56bf10", bold="yes"}, + { name="storageKeyword", foreground="#5c8fed"}, + { name="number", foreground="#00ff00"}, + { name="systemFunction", foreground="#ffff00"}, + { name="commonDefine", foreground="#56bf10"}, + { name="boolean", foreground="#214cf1"}, + { name="preprocesseur", foreground="#FF0000"}, + { name="comment", foreground="#ef4def", italic="yes"}, + { name="commentDoxygen", foreground="#ef4d00", bold="yes", italic="yes"}, + { name="keyword", foreground="#5c8fed", bold="yes"}, + { name="macro", foreground="#6c09c8", bold="yes"}, + { name="SYNTAX_ERROR", foreground="#000000", background="#FF0000", bold="yes"}, + { name="functionName", foreground="#24d1e0", bold="yes"}, + { name="TestResultOK", foreground="#000000", background="#00FF00", bold="yes"}, + { name="TestResultERROR", FG="#000000", background="#FF0000", bold="yes"} + ] +} diff --git a/sources/appl/Buffer/EdnBuf/EdnBuf_HighLight.cpp b/sources/appl/Buffer/EdnBuf/EdnBuf_HighLight.cpp index 97a300c..01a7dad 100644 --- a/sources/appl/Buffer/EdnBuf/EdnBuf_HighLight.cpp +++ b/sources/appl/Buffer/EdnBuf/EdnBuf_HighLight.cpp @@ -248,7 +248,7 @@ void EdnBuf::CleanHighLight(void) } -colorInformation_ts *EdnBuf::getElementColorAtPosition(int32_t pos, int32_t &starPos) +appl::ColorInfo *EdnBuf::getElementColorAtPosition(int32_t pos, int32_t &starPos) { int32_t i; int32_t start = etk_max(0, starPos-1); @@ -334,7 +334,7 @@ void EdnBuf::HightlightGenerateLines(displayHLData_ts & MData, int32_t HLStart, } -colorInformation_ts * EdnBuf::getElementColorAtPosition(displayHLData_ts & MData, int32_t pos) +appl::ColorInfo * EdnBuf::getElementColorAtPosition(displayHLData_ts & MData, int32_t pos) { int32_t i; int32_t start = etk_max(0, MData.posHLPass2-1); diff --git a/sources/appl/Colorize/Colorize.h b/sources/appl/Colorize/Colorize.h deleted file mode 100644 index b7ff52e..0000000 --- a/sources/appl/Colorize/Colorize.h +++ /dev/null @@ -1,53 +0,0 @@ -/** - * @author Edouard DUPIN - * - * @copyright 2010, Edouard DUPIN, all right reserved - * - * @license GPL v3 (see license file) - */ - -#ifndef __COLORIZE_H__ -#define __COLORIZE_H__ -#include -#include - -class Colorize { - public: - // Constructeur - Colorize(const etk::UString& _newColorName="no_name"); - ~Colorize(void) { }; - - 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; }; - - 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; }; - 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; }; - private: - bool m_italic; - public: - 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 << "\""); }; -}; - -#endif - - diff --git a/sources/appl/Colorize/ColorizeManager.h b/sources/appl/Colorize/ColorizeManager.h deleted file mode 100644 index 8411ba9..0000000 --- a/sources/appl/Colorize/ColorizeManager.h +++ /dev/null @@ -1,48 +0,0 @@ -/** - * @author Edouard DUPIN - * - * @copyright 2010, Edouard DUPIN, all right reserved - * - * @license GPL v3 (see license file) - */ - -#ifndef __COLORIZE_MANAGER_H__ -#define __COLORIZE_MANAGER_H__ - -#include -#include -#include -#include - -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 -{ - void init(void); - void unInit(void); - 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); -}; - -#endif - diff --git a/sources/appl/Gui/BufferView.cpp b/sources/appl/Gui/BufferView.cpp index afa5bbe..8b30d00 100644 --- a/sources/appl/Gui/BufferView.cpp +++ b/sources/appl/Gui/BufferView.cpp @@ -106,7 +106,7 @@ void BufferView::onReceiveMessage(const ewol::EMessage& _msg) { etk::Color<> BufferView::getBasicBG(void) { - return ColorizeManager::get(COLOR_LIST_BG_1); + return etk::color::none; //ColorizeManager::get(COLOR_LIST_BG_1); } uint32_t BufferView::getNuberOfColomn(void) { @@ -123,6 +123,7 @@ uint32_t BufferView::getNuberOfRaw(void) { } bool BufferView::getElement(int32_t _colomn, int32_t _raw, etk::UString& _myTextToWrite, etk::Color<>& _fg, etk::Color<>& _bg) { + /* bool isModify; basicColor_te selectFG = COLOR_LIST_TEXT_NORMAL; basicColor_te selectBG = COLOR_LIST_BG_1; @@ -161,6 +162,7 @@ bool BufferView::getElement(int32_t _colomn, int32_t _raw, etk::UString& _myText } _fg = ColorizeManager::get(selectFG); _bg = ColorizeManager::get(selectBG); + */ return true; } diff --git a/sources/appl/Highlight/Highlight.cpp b/sources/appl/Highlight/Highlight.cpp index 7df9b5a..6149d62 100644 --- a/sources/appl/Highlight/Highlight.cpp +++ b/sources/appl/Highlight/Highlight.cpp @@ -162,7 +162,7 @@ void Highlight::display(void) { // TODO : Celui qui appelle suprime des element pour rien ... Enfin c'est pas trègrave... Il suffirait juste de suprimer celuis d'avant si il n'est pas terminer... void Highlight::parse(int32_t start, int32_t stop, - etk::Vector &metaData, + etk::Vector &metaData, int32_t addingPos, etk::Buffer &buffer) { if (0 > addingPos) { @@ -171,7 +171,7 @@ void Highlight::parse(int32_t start, //APPL_DEBUG("Parse element 0 => " << m_listHighlightPass1.size() << " == > position search: (" << start << "," << stop << ")" ); int32_t elementStart = start; int32_t elementStop = stop; - colorInformation_ts resultat; + appl::ColorInfo resultat; while (elementStart " << m_listHighlightPass2.size() << " == > position search: (" << start << "," << stop << ")" ); int32_t elementStart = start; int32_t elementStop = stop; - colorInformation_ts resultat; + appl::ColorInfo resultat; while (elementStart #include @@ -30,30 +31,34 @@ extern "C" { #include #include -class Highlight { - public: - // Constructeur - Highlight(const etk::UString& _xmlFilename); - ~Highlight(void); - bool hasExtention(const etk::UString& _ext); - bool fileNameCompatible(etk::FSNode &_fileName); - void display(void); - void reloadColor(void); - void parse(int32_t start, - int32_t stop, - etk::Vector &metaData, - int32_t addingPos, - etk::Buffer &buffer); - void parse2(int32_t start, - int32_t stop, - etk::Vector &metaData, - etk::Buffer &buffer); - private: - void parseRules(exml::Element* child, etk::Vector &mListPatern, int32_t level); - etk::UString m_styleName; //!< curent style name (like "c++" or "c" or "script Bash") - etk::Vector m_listExtentions; //!< List of possible extention for this high-light, like : ".c", ".cpp", ".h" - etk::Vector m_listHighlightPass1; //!< List of ALL hightlight modules (pass 1 == > when we load and wride data on the buffer) - etk::Vector m_listHighlightPass2; //!< List of ALL hightlight modules (pass 2 == > When we display the buffer( only the display area (100 lines)) ) +class appl { + class Highlight : public ewol::EObject { + public: + // Constructeur + Highlight(const etk::UString& _xmlFilename); + ~Highlight(void); + bool hasExtention(const etk::UString& _ext); + bool fileNameCompatible(etk::FSNode &_fileName); + void display(void); + void reloadColor(void); + void parse(int32_t _start, + int32_t _stop, + etk::Vector &_metaData, + int32_t _addingPos, + etk::Buffer &_buffer); + void parse2(int32_t _start, + int32_t _stop, + etk::Vector &_metaData, + etk::Buffer &_buffer); + private: + void parseRules(exml::Element* _child, + etk::Vector &_mListPatern, + int32_t _level); + etk::UString m_styleName; //!< curent style name (like "c++" or "c" or "script Bash") + etk::Vector m_listExtentions; //!< List of possible extention for this high-light, like : ".c", ".cpp", ".h" + etk::Vector m_listHighlightPass1; //!< List of ALL hightlight modules (pass 1 == > when we load and wride data on the buffer) + etk::Vector m_listHighlightPass2; //!< List of ALL hightlight modules (pass 2 == > When we display the buffer( only the display area (100 lines)) ) + }; }; diff --git a/sources/appl/Highlight/HighlightManager.cpp b/sources/appl/Highlight/HighlightManager.cpp index c42a3bb..5b8c9e8 100644 --- a/sources/appl/Highlight/HighlightManager.cpp +++ b/sources/appl/Highlight/HighlightManager.cpp @@ -13,130 +13,65 @@ #include #undef __class__ -#define __class__ "HighlightManager" +#define __class__ "highlightManager" -class localClassHighlightManager: public ewol::EObject { - private: - etk::Vector listHighlight; //!< List of ALL hightlight modules - public: - // Constructeur - localClassHighlightManager(void) { - //ewol::widgetMessageMultiCast::add(getWidgetId(), ednMsgBufferColor); - }; - ~localClassHighlightManager(void) { - int32_t i; - // clean all Element - for (i=0; i< listHighlight.size(); i++) { - if (NULL != listHighlight[i]) { - delete(listHighlight[i]); - listHighlight[i] = NULL; - } - } - // clear the compleate list - listHighlight.clear(); - }; - - // herited function - const char * const getObjectType(void) { - return "ApplHighlightManager"; - } - - // herited function - virtual void onReceiveMessage(const ewol::EMessage& _msg) { - /* - switch (id) - { - case APPL_MSG__COLOR_HAS_CHANGE: - APPL_INFO("UPDATE the color pointer on the HL"); - for (int32_t i=0; iReloadColor(); - } - } - break; - } - */ - } - - Highlight* get(etk::FSNode& _fileName) { - int32_t i; - for (i=0; ifileNameCompatible(_fileName) ) { - return listHighlight[i]; - } - } - return NULL; - } - - bool exist(etk::FSNode& _fileName) { - if (NULL != get(_fileName) ) { - return true; - } - return false; - } - - void loadLanguages(void) { - etk::FSNode myFile("DATA:languages/"); - // get the subfolder list : - etk::Vector list = myFile.folderGetSubList(false, true, false,false); - for ( int32_t iii=0 ; iiigetNodeType() == etk::FSN_FOLDER) { - etk::UString filename = list[iii]->getName() + "/highlight.xml"; - APPL_DEBUG("Load xml name : " << filename); - Highlight *myHightline = new Highlight(filename); - listHighlight.pushBack(myHightline); - } - } - } - //myHightline->display(); - } -}; - -static localClassHighlightManager * localManager = NULL; +static etk::Vector& s_list(void) { + static etk::Vector list; + return list; +} -void HighlightManager::init(void) { - if (NULL != localManager) { +void appl::highlightManager::init(void) { + etk::Vector& hlList = s_list(); + if (hlList.size() != 0) { APPL_ERROR("HighlightManager == > already exist, just unlink the previous ..."); - localManager = NULL; + hlList.clear(); } - localManager = new localClassHighlightManager(); - - if (NULL == localManager) { - APPL_CRITICAL("Allocation of HighlightManager not done ..."); + etk::FSNode myFile("DATA:languages/"); + // get the subfolder list : + etk::Vector list = myFile.folderGetSubList(false, true, false,false); + for (esize_t iii=0; + iiigetNodeType() != etk::FSN_FOLDER) { + continue; + } + etk::UString filename = list[iii]->getName() + "/highlight.xml"; + APPL_DEBUG("Load xml name : " << filename); + appl::Highlight *myHightline = appl::Highlight::keep(filename); + hlList.pushBack(myHightline); } } -void HighlightManager::unInit(void) { - if (NULL == localManager) { - APPL_ERROR("HighlightManager == > request UnInit, but does not exist ..."); +void appl::highlightManager::unInit(void) { + etk::Vector& hlList = s_list(); + if (hlList.size() == 0) { + APPL_DEBUG("HighlightManager ==> no highlight"); + hlList.clear(); return; } - delete(localManager); - localManager = NULL; -} - -void HighlightManager::loadLanguages(void) { - if (NULL == localManager) { - return; + for (esize_t iii = 0; + iii < hlList.size(); + ++iii ) { + if (hlList[iii] == NULL) { + continue; + } + appl::Highlight::release(hlList[iii]); + hlList[iii] = NULL; } - localManager->loadLanguages(); + hlList.clear(); } -Highlight* HighlightManager::get(etk::FSNode& _fileName) { - if (NULL == localManager) { - return NULL; - } - return localManager->get(_fileName); +etk::UString appl::highlightManager::getTypeExtention(const etk::UString& _extention) { + return ""; } -bool HighlightManager::exist(etk::FSNode& _fileName) { - if (NULL == localManager) { - return false; - } - return localManager->exist(_fileName); +etk::Vector appl::highlightManager::getTypeList(void) { + etk::Vector ret; + return ret; } - diff --git a/sources/appl/Highlight/HighlightManager.h b/sources/appl/Highlight/HighlightManager.h index e1654bc..8efa50b 100644 --- a/sources/appl/Highlight/HighlightManager.h +++ b/sources/appl/Highlight/HighlightManager.h @@ -15,12 +15,28 @@ #include #include -namespace HighlightManager{ - void init(void); - void unInit(void); - void loadLanguages(void); - Highlight* get(etk::FSNode &fileName); - bool exist(etk::FSNode &fileName); +namespace appl { + namespace highlightManager { + /** + * @brief Init the Highlight manager + */ + void init(void); + /** + * @brief Un-Init the Highlight manager + */ + void unInit(void); + /** + * @brief Un-Init the Highlight manager + * @param[in] extention of the file + * @return type of highlight + */ + etk::UString getTypeExtention(const etk::UString& _extention); + /** + * @brief Get the list of extention type + * @return the requested list. + */ + etk::Vector getTypeList(void); + }; }; diff --git a/sources/appl/Highlight/HighlightPattern.cpp b/sources/appl/Highlight/HighlightPattern.cpp index 86bad6a..221f77b 100644 --- a/sources/appl/Highlight/HighlightPattern.cpp +++ b/sources/appl/Highlight/HighlightPattern.cpp @@ -49,7 +49,7 @@ void HighlightPattern::setEscapeChar(etk::UString& _EscapeChar) { } } -void HighlightPattern::setColor(etk::UString& _colorName) { +void HighlightPattern::setColorGlyph(etk::UString& _colorName) { m_colorName = _colorName; m_color = ColorizeManager::get(m_colorName); } @@ -79,11 +79,6 @@ void HighlightPattern::display(void) { APPL_INFO(" == > multiline pattern: NO"); } */ - // display all elements - for (int32_t i=0; i< m_subPatern.size(); i++) { - APPL_INFO(" " << i << " subPattern : " << m_subPatern[i]->getName() ); - m_subPatern[i]->display(); - } } void HighlightPattern::parseRules(exml::Element *child, int32_t level) { @@ -142,18 +137,6 @@ void HighlightPattern::parseRules(exml::Element *child, int32_t level) { setEscapeChar(myEdnData); } } - xChild = (exml::Element*)child->getNamed("rule"); - if (NULL != xChild) { - /* - // Create the patern ... - HighlightPattern *myPattern = new HighlightPattern(); - // parse under Element - myPattern->ParseRules(ruleChild, level+1); - // add element in the list - m_subPatern.pushBack(myPattern); - //ParseRules(passChild, m_listHighlightPass1, level1++); - */ - } } diff --git a/sources/appl/Highlight/HighlightPattern.h b/sources/appl/Highlight/HighlightPattern.h index 625e76d..1732607 100644 --- a/sources/appl/Highlight/HighlightPattern.h +++ b/sources/appl/Highlight/HighlightPattern.h @@ -26,57 +26,71 @@ typedef enum { HLP_FIND_OK_NO_END, }resultFind_te; - -class HighlightPattern { - public: - // Constructeur - HighlightPattern(void); - ~HighlightPattern(void); - - void setName(etk::UString& _name) { - m_paternName = _name; - }; - etk::UString getName(void) { - return m_paternName; - }; - - void setPaternStart(etk::UString& _regExp); - void setPaternStop(etk::UString& _regExp); - void setColor(etk::UString& _colorName); - void setEscapeChar(etk::UString& _EscapeChar); - void setMultiline(bool _enable) { - m_multiline = _enable; - }; - - void setLevel(int32_t _newLevel) { - m_level = _newLevel; - }; - int32_t getLevel(void) { - return m_level; - }; - - bool isEnable(void); - void display(void); - resultFind_te find(int32_t _start, int32_t _stop, colorInformation_ts& _resultat, etk::Buffer& _buffer); - Colorize* getColor(void) { - return m_color; - }; - void parseRules(exml::Element* _child, int32_t _level); - - void reloadColor(void); - - private: - int32_t m_level; //!< Level of the pattern == > this is to overwrite next pattern when we create an higher .... - etk::UString m_paternName; //!< Current style name (like "c++" or "c" or "script Bash") - etk::UString m_colorName; //!< Current color name - Colorize* m_color; //!< Link to the color manager - etk::RegExp* m_regExpStart; //!< Start of Regular expression - etk::RegExp* m_regExpStop; //!< Stop of Regular Expression - bool m_haveStopPatern; //!< Stop patern presence - bool m_multiline; //!< The patern is multiline - etk::UChar m_escapeChar; //!< Escape char to prevent exeit of patern .... - etk::Vector m_subPatern; //!< Under patern of this one -// etk::Vector m_subColor; //!< Under Color in the start RegExp ... +namespace appl { + class HighlightPattern { + public: + // Constructeur + HighlightPattern(void); + ~HighlightPattern(void); + private: + etk::UString m_paternName; //!< Current style name (like "c++" or "c" or "script Bash") + public: + void setName(etk::UString& _name) { + m_paternName = _name; + }; + etk::UString getName(void) { + return m_paternName; + }; + private: + etk::RegExp* m_regExpStart; //!< Start of Regular expression + public: + void setPaternStart(etk::UString& _regExp); + private: + bool m_haveStopPatern; //!< Stop patern presence + etk::RegExp* m_regExpStop; //!< Stop of Regular Expression + public: + void setPaternStop(etk::UString& _regExp); + private: + etk::UString m_colorName; //!< Current color name + appl::ColorGlyph* m_color; //!< Link to the color manager + public: + void setColorGlyph(etk::UString& _colorName); + appl::ColorGlyph* getColorGlyph(void) { + return m_color; + }; + private: + etk::UChar m_escapeChar; //!< Escape char to prevent exeit of patern .... + public: + void setEscapeChar(etk::UString& _EscapeChar); + private: + bool m_multiline; //!< The patern is multiline + public: + void setMultiline(bool _enable) { + m_multiline = _enable; + }; + private: + int32_t m_level; //!< Level of the pattern == > this is to overwrite next pattern when we create an higher .... + public: + void setLevel(int32_t _newLevel) { + m_level = _newLevel; + }; + int32_t getLevel(void) { + return m_level; + }; + private: + + public: + bool isEnable(void); + void display(void); + resultFind_te find(int32_t _start, + int32_t _stop, + colorInformation_ts& _resultat, + etk::Buffer& _buffer); + + void parseRules(exml::Element* _child, int32_t _level); + + void reloadColor(void); + }; }; #endif diff --git a/sources/appl/Colorize/Colorize.cpp b/sources/appl/glyphDecoration/GlyphDecoration.cpp similarity index 54% rename from sources/appl/Colorize/Colorize.cpp rename to sources/appl/glyphDecoration/GlyphDecoration.cpp index 331afe6..47f07ba 100644 --- a/sources/appl/Colorize/Colorize.cpp +++ b/sources/appl/glyphDecoration/GlyphDecoration.cpp @@ -8,24 +8,23 @@ #include #include -#include - +#include #undef __class__ -#define __class__ "Colorize" +#define __class__ "GlyphDecoration" -Colorize::Colorize(const etk::UString &_newColorName) : +appl::GlyphDecoration::GlyphDecoration(const etk::UString &_newColorName) : m_colorName(_newColorName), m_colorFG(etk::color::black), m_colorBG(etk::color::none), m_italic(false), m_bold(false) { - APPL_VERBOSE("New(Colorise)"); + APPL_VERBOSE("New(" << __class__ << ")"); } -void Colorize::setItalic(bool _enable) +void appl::GlyphDecoration::setItalic(bool _enable) { m_italic = _enable; if (true == _enable) { @@ -35,7 +34,7 @@ void Colorize::setItalic(bool _enable) } } -void Colorize::setBold(bool _enable) +void appl::GlyphDecoration::setBold(bool _enable) { m_bold = _enable; if (true == _enable) { @@ -45,5 +44,12 @@ void Colorize::setBold(bool _enable) } } - - +etk::CCout& appl::operator <<(etk::CCout& _os, const appl::GlyphDecoration& _obj) +{ + _os << "{fg=" << _obj.getForeground(); + _os << ",bg=" << _obj.getBackground(); + _os << ",italic=" << _obj.getItalic(); + _os << ",bold=" << _obj.getBold(); + _os << "name='" << _obj.getName() << "'}"; + return _os; +} diff --git a/sources/appl/glyphDecoration/GlyphDecoration.h b/sources/appl/glyphDecoration/GlyphDecoration.h new file mode 100644 index 0000000..47495d4 --- /dev/null +++ b/sources/appl/glyphDecoration/GlyphDecoration.h @@ -0,0 +1,124 @@ +/** + * @author Edouard DUPIN + * + * @copyright 2010, Edouard DUPIN, all right reserved + * + * @license GPL v3 (see license file) + */ + +#ifndef __GLYPH_DECORATION_H__ +#define __GLYPH_DECORATION_H__ + +#include +#include + +namespace appl { + class GlyphDecoration { + public: + // Constructeur + GlyphDecoration(const etk::UString& _newColorName = "no_name"); + ~GlyphDecoration(void) { + // nothing to do ... + }; + private: + etk::UString m_colorName; //!< curent color Name + public: + /** + * @brief Set color name of the element. + * @param[in] _newColorName new color name. + */ + void setName(const etk::UString& _newColorName) { + m_colorName = _newColorName; + }; + /** + * @brief Get the color name. + * @return The name of the color. + */ + const etk::UString& getName(void) const { + return m_colorName; + }; + private: + etk::Color<> m_colorFG; //!< Foreground color + public: + /** + * @brief Set foreground color. + * @param[in] _myColor new color description. + */ + void setForeground(const etk::UString& _myColor) { + m_colorFG = _myColor; + }; + /** + * @brief Get the foreground color. + * @return The color. + */ + const etk::Color<>& getForeground(void) const { + return m_colorFG; + }; + /** + * @brief Get the foreground color status. + * @return true if the color is visible. + */ + bool haveFg(void) const { + return m_colorFG.a() != 0; + }; + private: + etk::Color<> m_colorBG; //!< Background color + public: + /** + * @brief Set background color. + * @param[in] _myColor new color description. + */ + void setBackground(const etk::UString& _myColor) { + m_colorBG = _myColor; + }; + /** + * @brief Get the background color. + * @return The color. + */ + const etk::Color<>& getBackground(void) const { + return m_colorBG; + }; + /** + * @brief Get the background color status. + * @return true if the color is visible. + */ + bool haveBackground(void) const { + return m_colorBG.a()!=0; + }; + private: + bool m_italic; //!< the gryph might be italic. + public: + /** + * @brief Set the italic status. + * @param[in] _enable new status of italic request. + */ + void setItalic(bool _enable); + /** + * @brief Get the italic status. + * @return true if the glyph might be display in italic. + */ + bool getItalic(void) const { + return m_italic; + }; + private: + bool m_bold; //!< the gryph might be bold. + public: + /** + * @brief Set the bold status. + * @param[in] _enable new status of bold request. + */ + void setBold(bool _enable); + /** + * @brief Get the bold status. + * @return true if the glyph might be display in bold. + */ + bool getBold(void) const { + return m_bold; + }; + }; + etk::CCout& operator <<(etk::CCout& _os, const appl::GlyphDecoration& _obj); +} + +#endif + + diff --git a/sources/appl/Colorize/ColorizeManager.cpp b/sources/appl/glyphDecoration/GlyphPainting.cpp similarity index 86% rename from sources/appl/Colorize/ColorizeManager.cpp rename to sources/appl/glyphDecoration/GlyphPainting.cpp index 02e6faf..5761d24 100644 --- a/sources/appl/Colorize/ColorizeManager.cpp +++ b/sources/appl/glyphDecoration/GlyphPainting.cpp @@ -8,13 +8,86 @@ #include #include -#include +#include #include -#include -#include #include +#include + +#undef __class__ +#define __class__ "GlyphPainting" + + + +appl::GlyphPainting::GlyphPainting(const etk::UString& _filename) : + ewol::Resource(_filename) { + EWOL_DEBUG("SFP : load \"" << _filename << "\""); + reload(); +} + +appl::GlyphPainting::~GlyphPainting(void) { + // remove all element + for (int32_t iii=0; iii(getManager().localKeep(_filename)); + if (NULL != object) { + return object; + } + // this element create a new one every time .... + object = new appl::GlyphPainting(_filename); + if (NULL == object) { + EWOL_ERROR("allocation error of a resource : ??Mesh.obj??"); + return NULL; + } + getManager().localAdd(object); + return object; +} + +void appl::GlyphPainting::release(appl::GlyphPainting*& _object) { + if (NULL == _object) { + return; + } + ewol::Resource* object2 = static_cast(_object); + getManager().release(object2); + _object = NULL; +} + + + + + + + + + + + + + + + + + + + + + + + + -#define PFX "ColorizeManager " class classColorManager: public ewol::EObject { private: diff --git a/sources/appl/glyphDecoration/GlyphPainting.h b/sources/appl/glyphDecoration/GlyphPainting.h new file mode 100644 index 0000000..11b5168 --- /dev/null +++ b/sources/appl/glyphDecoration/GlyphPainting.h @@ -0,0 +1,47 @@ +/** + * @author Edouard DUPIN + * + * @copyright 2010, Edouard DUPIN, all right reserved + * + * @license GPL v3 (see license file) + */ + +#ifndef __GLYPH_DECORATION_MANAGER_H__ +#define __GLYPH_DECORATION_MANAGER_H__ + +#include +#include +#include +#include + +namespace appl { + class GlyphPainting : public ewol::Resource { + private: + etk::Vector m_list; + protected: + GlyphPainting(const etk::UString& _filename); + virtual ~GlyphPainting(void); + public: + const char* getType(void) { + return "appl::GlyphPainting"; + }; + void reload(void); + + public: + /** + * @brief keep the resource pointer. + * @note Never free this pointer by your own... + * @param[in] _filename Name of the configuration file. + * @return pointer on the resource or NULL if an error occured. + */ + static appl::GlyphPainting* keep(const etk::UString& _filename = "GlyphPainting::default"); + /** + * @brief release the keeped resources + * @param[in,out] reference on the object pointer + */ + static void release(appl::GlyphPainting*& _object); + }; +}; + +#endif +*/ diff --git a/sources/lutin_edn.py b/sources/lutin_edn.py index 3fe49bc..ca3f29f 100755 --- a/sources/lutin_edn.py +++ b/sources/lutin_edn.py @@ -40,14 +40,14 @@ def Create(target): # Generic color management for the text editor : myModule.AddSrcFile([ - 'appl/Colorize/Colorize.cpp', - 'appl/Colorize/ColorizeManager.cpp']) + 'appl/glyphDecoration/GlyphDecoration.cpp']) + # 'appl/Colorize/ColorizeManager.cpp']) # syntax coloration for the text editor - myModule.AddSrcFile([ - 'appl/Highlight/HighlightPattern.cpp', - 'appl/Highlight/Highlight.cpp', - 'appl/Highlight/HighlightManager.cpp']) + #myModule.AddSrcFile([ + # 'appl/Highlight/HighlightPattern.cpp', + # 'appl/Highlight/Highlight.cpp', + # 'appl/Highlight/HighlightManager.cpp']) myModule.AddModuleDepend('ewol')